Fix #32 , Added Freeze Enemies

This commit is contained in:
Joaquin 2022-07-24 21:24:36 -06:00
parent ecf7c69ff7
commit d7f91f2393
9 changed files with 119 additions and 1 deletions

View File

@ -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" />
@ -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

@ -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" />
@ -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

@ -255,6 +255,7 @@ DO_APP_FUNC(0x03187C30, Vector3, MoleMole_BaseEntity_GetRight, (BaseEntity* __th
DO_APP_FUNC(0x03185DC0, Vector3, MoleMole_BaseEntity_GetUp, (BaseEntity* __this, MethodInfo* method));
DO_APP_FUNC(0x031A5120, bool, MoleMole_BaseEntity_IsActive, (BaseEntity* __this, MethodInfo* method));
DO_APP_FUNC(0x031AFEE0, Rigidbody*, MoleMole_BaseEntity_GetRigidbody, (BaseEntity* __this, MethodInfo* method));
DO_APP_FUNC(0x0318DB20, Animator*, MoleMole_BaseEntity_get_animator, (BaseEntity* __this, MethodInfo* method));
// type should be 'MoleMole_VCCharacterCombat' not 'MoleMole_VCBaseMove'
// function name should be 'GetVisualCombatComponent' not 'GetMoveComponent'
@ -318,6 +319,7 @@ DO_APP_FUNC(0x057E4470, void, Cursor_set_visible, (bool value, MethodInfo* metho
DO_APP_FUNC(0x057E4460, void, Cursor_set_lockState, (CursorLockMode__Enum value, MethodInfo* method));
DO_APP_FUNC(0x057E4450, bool, Cursor_get_visible, (MethodInfo* method));
DO_APP_FUNC(0x0571E980, void, Rigidbody_set_collisionDetectionMode, (Rigidbody* __this, CollisionDetectionMode__Enum value, MethodInfo* method));
DO_APP_FUNC(0x0571E9A0, void, Rigidbody_set_detectCollisions, (Rigidbody* __this, bool value, MethodInfo* method));
DO_APP_FUNC(0x0571E9E0, void, Rigidbody_set_isKinematic, (Rigidbody* __this, bool value, MethodInfo* method));
DO_APP_FUNC(0x0571E8F0, Vector3, Rigidbody_get_velocity, (Rigidbody* __this, MethodInfo* method));
@ -335,6 +337,8 @@ DO_APP_FUNC(0x057E9D10, int32_t, Camera_get_pixelHeight, (Camera* __this, Method
DO_APP_FUNC(0x0579EB70, int32_t, Screen_get_width, (MethodInfo* method));
DO_APP_FUNC(0x0579EB00, int32_t, Screen_get_height, (MethodInfo* method));
DO_APP_FUNC(0x058236F0, void, Animator_set_speed, (Animator* __this, float value, MethodInfo* method));
DO_APP_FUNC(0x058AE2D0, bool, Behaviour_get_isActiveAndEnabled, (Behaviour* __this, MethodInfo* method));
DO_APP_FUNC(0x05891610, Vector3, Quaternion_ToEulerAngles, (Quaternion rotation, MethodInfo* method));

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>
@ -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),

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,7 +37,8 @@ namespace cheat::game
app::GameObject* gameObject();
app::Rigidbody* rigidbody();
app::Animator* animator();
app::Vector3 forward();
app::Vector3 back();
app::Vector3 right();

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

@ -0,0 +1,60 @@
#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;
}
void FreezeEnemies::OnGameUpdate()
{
auto& manager = game::EntityManager::instance();
for (const auto& monster : manager.entities(game::filters::combined::Monsters))
{
auto animator = monster->animator();
if (animator == nullptr)
return;
f_Enabled ? app::Animator_set_speed(animator, 0.f, nullptr) : app::Animator_set_speed(animator, 1.f, nullptr);
}
}
}

View File

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