From a2cc95089ec8b43ca0723abeec4b65a581e4ab58 Mon Sep 17 00:00:00 2001 From: Joaquin <67109235+Taiga74164@users.noreply.github.com> Date: Sun, 19 Jun 2022 01:38:38 -0600 Subject: [PATCH] Added Alternative God Mode Co-Authored-By: KKKKKKKKKKKKK <25654009+34736384@users.noreply.github.com> --- cheat-library/src/appdata/il2cpp-functions.h | 3 +- .../src/user/cheat/player/GodMode.cpp | 49 +++++++++++++------ cheat-library/src/user/cheat/player/GodMode.h | 1 + 3 files changed, 38 insertions(+), 15 deletions(-) diff --git a/cheat-library/src/appdata/il2cpp-functions.h b/cheat-library/src/appdata/il2cpp-functions.h index ba32aa4..495d1b5 100644 --- a/cheat-library/src/appdata/il2cpp-functions.h +++ b/cheat-library/src/appdata/il2cpp-functions.h @@ -42,7 +42,8 @@ DO_APP_FUNC(0x016189E0, void, MoleMole_DataItem_HandleNormalProp, (DataItem* __t // God mode DO_APP_FUNC(0x027DB100, void, VCHumanoidMove_NotifyLandVelocity, (VCHumanoidMove* __this, Vector3 velocity, float reachMaxDownVelocityTime, MethodInfo* method)); DO_APP_FUNC(0x036889B0, bool, Miscs_CheckTargetAttackable, (BaseEntity* attackerEntity, BaseEntity* targetEntity, MethodInfo* method)); -// DO_APP_FUNC(0x00D0CA90, void, MoleMole_LCBaseCombat_FireBeingHitEvent, (LCBaseCombat* __this, uint32_t attackeeRuntimeID, AttackResult* attackResult, MethodInfo* method)); +DO_APP_FUNC(0x00D0CA90, void, MoleMole_LCBaseCombat_FireBeingHitEvent, (LCBaseCombat* __this, uint32_t attackeeRuntimeID, AttackResult* attackResult, MethodInfo* method)); +DO_APP_FUNC(0x02383880, bool, MoleMole_ActorAbilityPlugin_HanlderModifierThinkTimerUp, (ActorAbilityPlugin* __this, float delay, Object* arg, MethodInfo* method)); // Cooldown cheats diff --git a/cheat-library/src/user/cheat/player/GodMode.cpp b/cheat-library/src/user/cheat/player/GodMode.cpp index 0a93b2e..0e4e3d4 100644 --- a/cheat-library/src/user/cheat/player/GodMode.cpp +++ b/cheat-library/src/user/cheat/player/GodMode.cpp @@ -8,13 +8,17 @@ namespace cheat::feature { static bool Miscs_CheckTargetAttackable_Hook(app::BaseEntity* attacker, app::BaseEntity* target, MethodInfo* method); static void VCHumanoidMove_NotifyLandVelocity_Hook(app::VCHumanoidMove* __this, app::Vector3 velocity, float reachMaxDownVelocityTime, MethodInfo* method); + static void LCBaseCombat_FireBeingHitEvent_Hook(app::LCBaseCombat* __this, uint32_t attackeeRuntimeID, app::AttackResult* attackResult, MethodInfo* method); + static bool MoleMole_ActorAbilityPlugin_HanlderModifierThinkTimerUp_Hook(app::ActorAbilityPlugin* __this, float delay, app::Object* arg, MethodInfo* method); GodMode::GodMode() : Feature(), - NFEX(f_Enabled, "God mode", "m_GodMode", "Player", false, false) + NFEX(f_Enabled, "God mode", "m_GodMode", "Player", false, false), + NF(f_AltGodMode, "Alternative God Mode", "Player", false) { - // HookManager::install(app::MoleMole_LCBaseCombat_FireBeingHitEvent, LCBaseCombat_FireBeingHitEvent_Hook); HookManager::install(app::VCHumanoidMove_NotifyLandVelocity, VCHumanoidMove_NotifyLandVelocity_Hook); HookManager::install(app::Miscs_CheckTargetAttackable, Miscs_CheckTargetAttackable_Hook); + HookManager::install(app::MoleMole_LCBaseCombat_FireBeingHitEvent, LCBaseCombat_FireBeingHitEvent_Hook); + HookManager::install(app::MoleMole_ActorAbilityPlugin_HanlderModifierThinkTimerUp, MoleMole_ActorAbilityPlugin_HanlderModifierThinkTimerUp_Hook); } const FeatureGUIInfo& GodMode::GetGUIInfo() const @@ -28,16 +32,21 @@ namespace cheat::feature ConfigWidget("God Mode", f_Enabled, "Enables god mode, i.e. no incoming damage.\n" \ "May not work with some types of damage."); + ImGui::Indent(); + ConfigWidget("Alternative God Mode", f_AltGodMode, + "Alternative god mode that ignores incoming damage\n" \ + "including environmental damage."); + ImGui::Unindent(); } bool GodMode::NeedStatusDraw() const -{ - return f_Enabled; + { + return f_Enabled || f_AltGodMode; } void GodMode::DrawStatus() { - ImGui::Text("God Mode"); + ImGui::Text("God Mode%s", f_AltGodMode ? "+Alt " : " "); } GodMode& GodMode::GetInstance() @@ -64,7 +73,7 @@ namespace cheat::feature static void VCHumanoidMove_NotifyLandVelocity_Hook(app::VCHumanoidMove* __this, app::Vector3 velocity, float reachMaxDownVelocityTime, MethodInfo* method) { auto& gm = GodMode::GetInstance(); - if (gm.f_Enabled && -velocity.y > 13) + if ((gm.f_Enabled || gm.f_AltGodMode) && -velocity.y > 13) { float randAdd = (float)(std::rand() % 1000) / 1000; velocity.y = -8 - randAdd; @@ -75,13 +84,25 @@ namespace cheat::feature } // Analog function for disable attack damage (Thanks to Taiga74164) - //void LCBaseCombat_FireBeingHitEvent_Hook(app::LCBaseCombat* __this, uint32_t attackeeRuntimeID, app::AttackResult* attackResult, MethodInfo* method) - //{ - // auto avatarEntity = GetAvatarEntity(); - // if (avatarEntity != nullptr && Config::cfgGodModEnable.GetValue() && avatarEntity->fields._runtimeID_k__BackingField == attackeeRuntimeID) - // return; - // - // return callOrigin(LCBaseCombat_FireBeingHitEvent_Hook, __this, attackeeRuntimeID, attackResult, method); - //} + static void LCBaseCombat_FireBeingHitEvent_Hook(app::LCBaseCombat* __this, uint32_t attackeeRuntimeID, app::AttackResult* attackResult, MethodInfo* method) + { + auto& gm = GodMode::GetInstance(); + auto& manager = game::EntityManager::instance(); + if (gm.f_AltGodMode) + if (manager.avatar()->runtimeID() == attackeeRuntimeID) + return; + + CALL_ORIGIN(LCBaseCombat_FireBeingHitEvent_Hook, __this, attackeeRuntimeID, attackResult, method); + } + + // Environmental damage immunity (Thanks to RELOADED#7236 / GitHub: @34736384) + static bool MoleMole_ActorAbilityPlugin_HanlderModifierThinkTimerUp_Hook(app::ActorAbilityPlugin* __this, float delay, app::Object* arg, MethodInfo* method) + { + auto& gm = GodMode::GetInstance(); + if (gm.f_AltGodMode/* || gm.f_Enabled*/) + return FALSE; + + return CALL_ORIGIN(MoleMole_ActorAbilityPlugin_HanlderModifierThinkTimerUp_Hook, __this, delay, arg, method); + } } diff --git a/cheat-library/src/user/cheat/player/GodMode.h b/cheat-library/src/user/cheat/player/GodMode.h index 750398f..79baf5a 100644 --- a/cheat-library/src/user/cheat/player/GodMode.h +++ b/cheat-library/src/user/cheat/player/GodMode.h @@ -9,6 +9,7 @@ namespace cheat::feature { public: config::Field> f_Enabled; + config::Field> f_AltGodMode; static GodMode& GetInstance();