Added Alternative God Mode

Co-Authored-By: KKKKKKKKKKKKK <25654009+34736384@users.noreply.github.com>
This commit is contained in:
Joaquin 2022-06-19 01:38:38 -06:00
parent 4955c6e599
commit a2cc95089e
3 changed files with 38 additions and 15 deletions

View File

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

View File

@ -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);
}
}

View File

@ -9,6 +9,7 @@ namespace cheat::feature
{
public:
config::Field<config::Toggle<Hotkey>> f_Enabled;
config::Field<config::Toggle<Hotkey>> f_AltGodMode;
static GodMode& GetInstance();