Merge pull request #364 from Taiga74164/changes-1

Fix #32 , Added Freeze Enemy Animation, Solved #207
This commit is contained in:
Taiga 2022-07-25 03:44:02 -07:00 committed by GitHub
commit a68cda230f
13 changed files with 184 additions and 32 deletions

View File

@ -58,7 +58,7 @@ As well as setting up **`cheat-library`** as startup project.
#### Player
- Invincible
- Attack Modifier
- No Cooldown Skill/Ultimate/Sprint
- No Cooldown Skill/Ultimate/Sprint/Bow
- Unlimited Stamina
- No Clip
@ -66,6 +66,7 @@ As well as setting up **`cheat-library`** as startup project.
- Auto Seelie
- Vacuum Loot
- Dumb Enemies
- Freeze Enemies
- Auto Destroy Objects
- Auto Loot
- Pickup Range
@ -92,7 +93,7 @@ As well as setting up **`cheat-library`** as startup project.
- Chest Indicator
- Hide UI
- In-game Embedded Browser
- Enable Peaking
- Enable Peeking
- Profile Changer
- Free Camera
- Texture Changer
@ -135,9 +136,9 @@ As well as setting up **`cheat-library`** as startup project.
<h1 align="center">Bugs</h1>
Welcome to the short explanation for bug reporting
1. You Found a bug.
1. write down what happened, as well as your first thoughts on what you think caused it.
1. can it be reproduced? Yes or no. If yes: Explain in as much clear as possible. i.e what happens when the bug occurs and why it occurs.
1. You found a bug.
1. Write down what happened, as well as your first thoughts on what you think caused it.
1. Can it be reproduced? Yes or no. If yes: Explain in as much clear as possible. i.e what happens when the bug occurs and why it occurs.
1. Tell us which version you are using. copy the `SHA`/ Version Number of the latest commit when you built the mod. For example: `bd17a00ec388f3b93624280cde9e1c66e740edf9` / Release 0.7
## Bug reporting template

View File

@ -34,7 +34,7 @@
<ClInclude Include="src\user\cheat\teleport\CustomTeleports.h" />
<ClInclude Include="src\user\cheat\visuals\Browser.h" />
<ClInclude Include="src\user\cheat\visuals\CameraZoom.h" />
<ClInclude Include="src\user\cheat\visuals\EnablePeaking.h" />
<ClInclude Include="src\user\cheat\visuals\EnablePeeking.h" />
<ClInclude Include="src\user\cheat\visuals\FPSUnlock.h" />
<ClInclude Include="src\user\cheat\visuals\HideUI.h" />
<ClInclude Include="src\user\cheat\visuals\NoFog.h" />
@ -95,6 +95,7 @@
<ClInclude Include="src\user\cheat\world\AutoTreeFarm.h" />
<ClInclude Include="src\user\cheat\world\DialogSkip.h" />
<ClInclude Include="src\user\cheat\world\DumbEnemies.h" />
<ClInclude Include="src\user\cheat\world\FreezeEnemies.h" />
<ClInclude Include="src\user\cheat\world\KillAura.h" />
<ClInclude Include="src\user\cheat\world\MobVacuum.h" />
<ClInclude Include="src\user\cheat\world\VacuumLoot.h" />
@ -124,7 +125,7 @@
<ClCompile Include="src\user\cheat\GenshinCM.cpp" />
<ClCompile Include="src\user\cheat\visuals\Browser.cpp" />
<ClCompile Include="src\user\cheat\visuals\CameraZoom.cpp" />
<ClCompile Include="src\user\cheat\visuals\EnablePeaking.cpp" />
<ClCompile Include="src\user\cheat\visuals\EnablePeeking.cpp" />
<ClCompile Include="src\user\cheat\visuals\FPSUnlock.cpp" />
<ClCompile Include="src\user\cheat\visuals\HideUI.cpp" />
<ClCompile Include="src\user\cheat\visuals\NoFog.cpp" />
@ -182,6 +183,7 @@
<ClCompile Include="src\user\cheat\world\AutoTreeFarm.cpp" />
<ClCompile Include="src\user\cheat\world\DialogSkip.cpp" />
<ClCompile Include="src\user\cheat\world\DumbEnemies.cpp" />
<ClCompile Include="src\user\cheat\world\FreezeEnemies.cpp" />
<ClCompile Include="src\user\cheat\world\KillAura.cpp" />
<ClCompile Include="src\user\cheat\world\MobVacuum.cpp" />
<ClCompile Include="src\user\cheat\world\VacuumLoot.cpp" />

View File

@ -213,7 +213,7 @@
<ClInclude Include="src\user\cheat\visuals\Browser.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\user\cheat\visuals\EnablePeaking.h">
<ClInclude Include="src\user\cheat\visuals\EnablePeeking.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\user\cheat\visuals\TextureChanger.h">
@ -246,6 +246,9 @@
<ClInclude Include="src\user\cheat\player\AutoRun.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\user\cheat\world\FreezeEnemies.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Font Include="res\Ruda-Bold.ttf" />
@ -417,7 +420,7 @@
<ClCompile Include="src\user\cheat\visuals\Browser.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\user\cheat\visuals\EnablePeaking.cpp">
<ClCompile Include="src\user\cheat\visuals\EnablePeeking.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\user\cheat\visuals\TextureChanger.cpp">
@ -450,6 +453,9 @@
<ClCompile Include="src\user\cheat\player\AutoRun.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\user\cheat\world\FreezeEnemies.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="res\res.rc">

View File

@ -22,6 +22,7 @@
#include <cheat/world/AutoLoot.h>
#include <cheat/world/DialogSkip.h>
#include <cheat/world/DumbEnemies.h>
#include <cheat/world/FreezeEnemies.h>
#include <cheat/world/ElementalSight.h>
#include <cheat/world/KillAura.h>
#include <cheat/world/MobVacuum.h>
@ -50,7 +51,7 @@
#include <cheat/visuals/PaimonFollow.h>
#include <cheat/visuals/HideUI.h>
#include <cheat/visuals/Browser.h>
#include <cheat/visuals/EnablePeaking.h>
#include <cheat/visuals/EnablePeeking.h>
#include <cheat/visuals/TextureChanger.h>
#include <cheat/visuals/FreeCamera.h>
@ -91,6 +92,7 @@ namespace cheat
FEAT_INST(VacuumLoot),
FEAT_INST(DialogSkip),
FEAT_INST(DumbEnemies),
FEAT_INST(FreezeEnemies),
FEAT_INST(ElementalSight),
FEAT_INST(KillAura),
FEAT_INST(MobVacuum),
@ -115,7 +117,7 @@ namespace cheat
FEAT_INST(PaimonFollow),
FEAT_INST(HideUI),
FEAT_INST(Browser),
FEAT_INST(EnablePeaking),
FEAT_INST(EnablePeeking),
FEAT_INST(TextureChanger),
FEAT_INST(FreeCamera)

View File

@ -205,6 +205,18 @@ namespace cheat::game
SAFE_END();
}
app::Animator* Entity::animator()
{
if (!isLoaded())
return nullptr;
SAFE_BEGIN();
return app::MoleMole_BaseEntity_get_animator(m_RawEntity, nullptr);
SAFE_ERROR();
return nullptr;
SAFE_END();
}
app::GameObject* Entity::gameObject()
{
if (!isLoaded())

View File

@ -37,6 +37,7 @@ namespace cheat::game
app::GameObject* gameObject();
app::Rigidbody* rigidbody();
app::Animator* animator();
app::Vector3 forward();
app::Vector3 back();

View File

@ -139,8 +139,12 @@ namespace cheat::feature
auto rigidBody = avatarEntity->rigidbody();
if (rigidBody == nullptr)
return;
if (!f_FreeflightMode)
{
app::Rigidbody_set_collisionDetectionMode(rigidBody, app::CollisionDetectionMode__Enum::Continuous, nullptr);
app::Rigidbody_set_detectCollisions(rigidBody, false, nullptr);
}
if (!f_VelocityMode)
app::Rigidbody_set_velocity(rigidBody, zero, nullptr);

View File

@ -1,5 +1,5 @@
#include "pch-il2cpp.h"
#include "EnablePeaking.h"
#include "EnablePeeking.h"
#include <helpers.h>
@ -7,43 +7,43 @@ namespace cheat::feature
{
static void MoleMole_VCBaseSetDitherValue_set_ManagerDitherAlphaValue_Hook(app::MoleMole_VCBaseSetDitherValue* __this, float value, MethodInfo* method);
EnablePeaking::EnablePeaking() : Feature(),
NF(f_Enabled, "Enable Peaking", "Visuals::EnablePeaking", false)
EnablePeeking::EnablePeeking() : Feature(),
NF(f_Enabled, "Enable Peeking", "Visuals::EnablePeeking", false)
{
HookManager::install(app::MoleMole_VCBaseSetDitherValue_set_ManagerDitherAlphaValue, MoleMole_VCBaseSetDitherValue_set_ManagerDitherAlphaValue_Hook);
}
const FeatureGUIInfo& EnablePeaking::GetGUIInfo() const
const FeatureGUIInfo& EnablePeeking::GetGUIInfo() const
{
static const FeatureGUIInfo info{ "EnablePeaking", "Visuals", false };
static const FeatureGUIInfo info{ "EnablePeeking", "Visuals", false };
return info;
}
void EnablePeaking::DrawMain()
void EnablePeeking::DrawMain()
{
ConfigWidget(f_Enabled, ";)");
}
bool EnablePeaking::NeedStatusDraw() const
bool EnablePeeking::NeedStatusDraw() const
{
return f_Enabled;
}
void EnablePeaking::DrawStatus()
void EnablePeeking::DrawStatus()
{
ImGui::Text("Enable Peaking");
ImGui::Text("Enable Peeking");
}
EnablePeaking& EnablePeaking::GetInstance()
EnablePeeking& EnablePeeking::GetInstance()
{
static EnablePeaking instance;
static EnablePeeking instance;
return instance;
}
static void MoleMole_VCBaseSetDitherValue_set_ManagerDitherAlphaValue_Hook(app::MoleMole_VCBaseSetDitherValue* __this, float value, MethodInfo* method)
{
EnablePeaking& EnablePeaking = EnablePeaking::GetInstance();
if (EnablePeaking.f_Enabled)
EnablePeeking& EnablePeeking = EnablePeeking::GetInstance();
if (EnablePeeking.f_Enabled)
value = 1;
CALL_ORIGIN(MoleMole_VCBaseSetDitherValue_set_ManagerDitherAlphaValue_Hook, __this, value, method);

View File

@ -0,0 +1,25 @@
#pragma once
#include <cheat-base/cheat/Feature.h>
#include <cheat-base/config/config.h>
namespace cheat::feature
{
class EnablePeeking : public Feature
{
public:
config::Field<config::Toggle<Hotkey>> f_Enabled;
static EnablePeeking& GetInstance();
const FeatureGUIInfo& GetGUIInfo() const override;
void DrawMain() override;
virtual bool NeedStatusDraw() const override;
void DrawStatus() override;
private:
EnablePeeking();
};
}

View File

@ -3,6 +3,7 @@
#include <helpers.h>
#include <cheat/events.h>
#include <cheat/game/EntityManager.h>
namespace cheat::feature
{
@ -20,6 +21,7 @@ namespace cheat::feature
FreeCamera::FreeCamera() : Feature(),
NF(f_Enabled, "Free Camera", "Visuals::FreeCamera", false),
NF(f_FreezeAnimation, "Freeze Character Animation", "Visuals::FreeCamera", false),
NF(f_Speed, "Speed", "Visuals::FreeCamera", 1.0f),
NF(f_LookSens, "Look Sensitivity", "Visuals::FreeCamera", 1.0f),
NF(f_RollSpeed, "Roll Speed", "Visuals::FreeCamera", 1.0f),
@ -50,6 +52,7 @@ namespace cheat::feature
void FreeCamera::DrawMain()
{
ConfigWidget("Enable", f_Enabled);
ConfigWidget("Freeze Character Animation", f_FreezeAnimation, "Freezes the active character's animation.\nAfter disabling, jump to un-freeze your character.");
if (ImGui::BeginTable("FreeCameraDrawTable", 1, ImGuiTableFlags_NoBordersInBody))
{
ImGui::TableNextRow();
@ -245,5 +248,25 @@ namespace cheat::feature
}
else
DisableFreeCam();
// Taiga#5555: There's probably be a better way of implementing this. But for now, this is just what I came up with.
auto& manager = game::EntityManager::instance();
auto animator = manager.avatar()->animator();
auto rigidBody = manager.avatar()->rigidbody();
if (animator == nullptr && rigidBody == nullptr)
return;
if (f_FreezeAnimation)
{
//auto constraints = app::Rigidbody_get_constraints(rigidBody, nullptr);
//LOG_DEBUG("%s", magic_enum::enum_name(constraints).data());
app::Rigidbody_set_constraints(rigidBody, app::RigidbodyConstraints__Enum::FreezePosition, nullptr);
app::Animator_set_speed(animator, 0.f, nullptr);
}
else
{
app::Rigidbody_set_constraints(rigidBody, app::RigidbodyConstraints__Enum::FreezeRotation, nullptr);
app::Animator_set_speed(animator, 1.f, nullptr);
}
}
}

View File

@ -8,6 +8,7 @@ namespace cheat::feature
{
public:
config::Field<config::Toggle<Hotkey>> f_Enabled;
config::Field<config::Toggle<Hotkey>> f_FreezeAnimation;
config::Field<float> f_Speed;
config::Field<float> f_LookSens;
config::Field<float> f_RollSpeed;

View File

@ -0,0 +1,73 @@
#include "pch-il2cpp.h"
#include "FreezeEnemies.h"
#include <helpers.h>
#include <cheat/events.h>
#include <cheat/game/EntityManager.h>
#include <cheat/game/filters.h>
namespace cheat::feature
{
FreezeEnemies::FreezeEnemies() : Feature(),
NF(f_Enabled, "Freeze Enemies", "FreezeEnemies", false)
{
events::GameUpdateEvent += MY_METHOD_HANDLER(FreezeEnemies::OnGameUpdate);
}
const FeatureGUIInfo& FreezeEnemies::GetGUIInfo() const
{
static const FeatureGUIInfo info{ "", "World", false };
return info;
}
void FreezeEnemies::DrawMain()
{
ConfigWidget(f_Enabled, "Freezes all enemies' animation speed.");
}
bool FreezeEnemies::NeedStatusDraw() const
{
return f_Enabled;
}
void FreezeEnemies::DrawStatus()
{
ImGui::Text("Freeze Enemies");
}
FreezeEnemies& FreezeEnemies::GetInstance()
{
static FreezeEnemies instance;
return instance;
}
// Taiga#5555: There's probably be a better way of implementing this. But for now, this is just what I came up with.
void FreezeEnemies::OnGameUpdate()
{
auto& manager = game::EntityManager::instance();
for (const auto& monster : manager.entities(game::filters::combined::Monsters))
{
auto animator = monster->animator();
auto rigidBody = monster->rigidbody();
if (animator == nullptr && rigidBody == nullptr)
return;
if (f_Enabled)
{
//auto constraints = app::Rigidbody_get_constraints(rigidBody, nullptr);
//LOG_DEBUG("%s", magic_enum::enum_name(constraints).data());
app::Rigidbody_set_constraints(rigidBody, app::RigidbodyConstraints__Enum::FreezeAll, nullptr);
app::Animator_set_speed(animator, 0.f, nullptr);
}
else
{
app::Rigidbody_set_constraints(rigidBody, app::RigidbodyConstraints__Enum::FreezeRotation, nullptr);
app::Animator_set_speed(animator, 1.f, nullptr);
}
}
}
}

View File

@ -5,12 +5,14 @@
namespace cheat::feature
{
class EnablePeaking : public Feature
{
class FreezeEnemies : public Feature
{
public:
config::Field<config::Toggle<Hotkey>> f_Enabled;
static EnablePeaking& GetInstance();
static FreezeEnemies& GetInstance();
void OnGameUpdate();
const FeatureGUIInfo& GetGUIInfo() const override;
void DrawMain() override;
@ -19,7 +21,7 @@ namespace cheat::feature
void DrawStatus() override;
private:
EnablePeaking();
FreezeEnemies();
};
}