pr #150: fix structure & little refactor

This commit is contained in:
CallowBlack 2022-06-21 23:56:55 +03:00
parent a1855e3134
commit 265915cc89
3 changed files with 67 additions and 65 deletions

View File

@ -931,7 +931,8 @@
</Command> </Command>
</PostBuildEvent> </PostBuildEvent>
<CustomBuildStep> <CustomBuildStep>
<Command>"$(OutDir)injector.exe" powershell -nop -c "&amp;amp; {sleep 15}"</Command> <Command>"$(OutDir)injector.exe"
powershell -nop -c "&amp; {sleep 20}"</Command>
<Outputs>$(OutDir)_noexist.nope;%(Outputs)</Outputs> <Outputs>$(OutDir)_noexist.nope;%(Outputs)</Outputs>
<Inputs>$(TargetPath);%(Inputs)</Inputs> <Inputs>$(TargetPath);%(Inputs)</Inputs>
</CustomBuildStep> </CustomBuildStep>

View File

@ -6,19 +6,6 @@
namespace cheat::feature 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);
std::vector<std::string> v{
"BlackMud",
"SERVER_ClimateAbility",
"ElectricWater",
"SeiraiThunder",
"UNIQUE_Monster_",
"Monster_Shougun"};
GodMode::GodMode() : Feature(), 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) NF(f_AltGodMode, "Alternative God Mode", "Player", false)
@ -64,7 +51,7 @@ namespace cheat::feature
} }
// Attack immunity (return false when target is avatar, that mean avatar entity isn't attackable) // Attack immunity (return false when target is avatar, that mean avatar entity isn't attackable)
static bool Miscs_CheckTargetAttackable_Hook(app::BaseEntity* attacker, app::BaseEntity* target, MethodInfo* method) bool GodMode::Miscs_CheckTargetAttackable_Hook(app::BaseEntity* attacker, app::BaseEntity* target, MethodInfo* method)
{ {
auto& gm = GodMode::GetInstance(); auto& gm = GodMode::GetInstance();
auto& manager = game::EntityManager::instance(); auto& manager = game::EntityManager::instance();
@ -78,7 +65,7 @@ namespace cheat::feature
// Raised when avatar fall on ground. // Raised when avatar fall on ground.
// Sending fall speed, and how many time pass from gain max fall speed (~30m/s). // Sending fall speed, and how many time pass from gain max fall speed (~30m/s).
// To disable fall damage reset reachMaxDownVelocityTime and decrease fall velocity. // To disable fall damage reset reachMaxDownVelocityTime and decrease fall velocity.
static void VCHumanoidMove_NotifyLandVelocity_Hook(app::VCHumanoidMove* __this, app::Vector3 velocity, float reachMaxDownVelocityTime, MethodInfo* method) void GodMode::VCHumanoidMove_NotifyLandVelocity_Hook(app::VCHumanoidMove* __this, app::Vector3 velocity, float reachMaxDownVelocityTime, MethodInfo* method)
{ {
auto& gm = GodMode::GetInstance(); auto& gm = GodMode::GetInstance();
if ((gm.f_Enabled || gm.f_AltGodMode) && -velocity.y > 13) if ((gm.f_Enabled || gm.f_AltGodMode) && -velocity.y > 13)
@ -92,7 +79,7 @@ namespace cheat::feature
} }
// Analog function for disable attack damage (Thanks to Taiga74164) // Analog function for disable attack damage (Thanks to Taiga74164)
static void LCBaseCombat_FireBeingHitEvent_Hook(app::LCBaseCombat* __this, uint32_t attackeeRuntimeID, app::AttackResult* attackResult, MethodInfo* method) void GodMode::LCBaseCombat_FireBeingHitEvent_Hook(app::LCBaseCombat* __this, uint32_t attackeeRuntimeID, app::AttackResult* attackResult, MethodInfo* method)
{ {
auto& gm = GodMode::GetInstance(); auto& gm = GodMode::GetInstance();
auto& manager = game::EntityManager::instance(); auto& manager = game::EntityManager::instance();
@ -103,55 +90,61 @@ namespace cheat::feature
} }
// Environmental damage immunity (Thanks to RELOADED#7236 / GitHub: @34736384) // 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) bool GodMode::MoleMole_ActorAbilityPlugin_HanlderModifierThinkTimerUp_Hook(app::ActorAbilityPlugin* __this, float delay, app::Object* arg, MethodInfo* method)
{ {
auto& gm = GodMode::GetInstance(); if (GetInstance().NeedBlockHanlerModifierThinkTimeUp(arg))
auto actorModifer = reinterpret_cast<app::MoleMole_ActorModifier*>(arg);
auto argStr = actorModifer->fields._config->fields._modifierName;
std::string name;
if ((uintptr_t)actorModifer->klass == *(uintptr_t*)app::MoleMole_ActorModifier__TypeInfo)
{
uintptr_t MoleMole_ActorModifier = (uintptr_t)arg;
uintptr_t ConfigAbilityModifier = *(uintptr_t*)(MoleMole_ActorModifier + 0x68);
if (ConfigAbilityModifier)
{
//app::String* modifierName = actorModifer->fields._config->fields._modifierName;
app::String* modifierName = *(app::String**)(ConfigAbilityModifier + 0x28);
if (modifierName)
name = il2cppi_to_string(modifierName).c_str();
}
}
if (gm.f_AltGodMode)
for (auto& v : v)
if (name.find(v) != std::string::npos)
return false; return false;
//LOG_DEBUG("%s", name.c_str());
return CALL_ORIGIN(MoleMole_ActorAbilityPlugin_HanlderModifierThinkTimerUp_Hook, __this, delay, arg, method); return CALL_ORIGIN(MoleMole_ActorAbilityPlugin_HanlderModifierThinkTimerUp_Hook, __this, delay, arg, method);
} }
}
// ____________________________________________________________________________________________________________ bool GodMode::NeedBlockHanlerModifierThinkTimeUp(app::Object* arg)
// | Name | Description | {
// |------------------------------------------------------------------------|-----------------------------------| if (!f_AltGodMode)
// | SERVER_ClimateAbility_Cold_Area | Sheer cold | return false;
// | SERVER_ClimateAbility_Cold_Lv1 | Sheer cold |
// | SERVER_ClimateAbility_Cold_Lv2 | Sheer cold | auto actorModifier = CastTo<app::MoleMole_ActorModifier>(arg, *app::MoleMole_ActorModifier__TypeInfo);
// | SERVER_ClimateAbility_TsurumiMist_Area | Electric debuff | if (actorModifier == nullptr)
// | SERVER_ClimateAbility_TatariRegion_Area | Electric debuff | return false;
// | SERVER_ClimateAbility_TatariRegion_Lv1 | Electric debuff |
// | SERVER_ClimateAbility_TatariRegion_Lv2 | Electric debuff | static std::vector<std::string> modifierBlacklist
// | SERVER_ClimateAbility_SeiraiStorm_Area | Serai Island | {
// | SERVER_ClimateAbility_SeiraiStorm_Lv1 | Serai Island | "BlackMud",
// | SERVER_ClimateAbility_SeiraiStorm_Lv2 | Serai Island | "SERVER_ClimateAbility",
// | SERVER_ClimateAbility_TsurumiMist_Area | Tsurumi Island | "ElectricWater",
// | ElectricWaterAreaModifier | All electric water in inazuma | "SeiraiThunder",
// | BlackMudAreaBuff_Avatar | | "UNIQUE_Monster_",
// | BlackMudAreaBuff_Avatar02 | | "Monster_Shougun"
// | WaterAreaModifier | | };
// | SeiraiThunder_Manager | |
// | UNIQUE_Monster_Shougun_Mitakenarukami_BurstAtk02_NotInShieldPredicated | | std::string modifierName = il2cppi_to_string(actorModifier->fields._config->fields._modifierName);
// | Monster_Shougun_Mitakenarukami_BurstAtk02_NotInShieldAtk | | for (auto& forbiddenModifierName : modifierBlacklist)
// |------------------------------------------------------------------------|-----------------------------------| if (modifierName.find(forbiddenModifierName) != std::string::npos)
return true;
return false;
}
// ____________________________________________________________________________________________________________
// | Name | Description |
// |------------------------------------------------------------------------|-----------------------------------|
// | SERVER_ClimateAbility_Cold_Area | Sheer cold |
// | SERVER_ClimateAbility_Cold_Lv1 | Sheer cold |
// | SERVER_ClimateAbility_Cold_Lv2 | Sheer cold |
// | SERVER_ClimateAbility_TsurumiMist_Area | Electric debuff |
// | SERVER_ClimateAbility_TatariRegion_Area | Electric debuff |
// | SERVER_ClimateAbility_TatariRegion_Lv1 | Electric debuff |
// | SERVER_ClimateAbility_TatariRegion_Lv2 | Electric debuff |
// | SERVER_ClimateAbility_SeiraiStorm_Area | Serai Island |
// | SERVER_ClimateAbility_SeiraiStorm_Lv1 | Serai Island |
// | SERVER_ClimateAbility_SeiraiStorm_Lv2 | Serai Island |
// | SERVER_ClimateAbility_TsurumiMist_Area | Tsurumi Island |
// | ElectricWaterAreaModifier | All electric water in inazuma |
// | BlackMudAreaBuff_Avatar | |
// | BlackMudAreaBuff_Avatar02 | |
// | WaterAreaModifier | |
// | SeiraiThunder_Manager | |
// | UNIQUE_Monster_Shougun_Mitakenarukami_BurstAtk02_NotInShieldPredicated | |
// | Monster_Shougun_Mitakenarukami_BurstAtk02_NotInShieldAtk | |
// |------------------------------------------------------------------------|-----------------------------------|
}

View File

@ -16,10 +16,18 @@ namespace cheat::feature
const FeatureGUIInfo& GetGUIInfo() const override; const FeatureGUIInfo& GetGUIInfo() const override;
void DrawMain() override; void DrawMain() override;
virtual bool NeedStatusDraw() const override; bool NeedStatusDraw() const override;
void DrawStatus() override; void DrawStatus() override;
private: private:
bool NeedBlockHanlerModifierThinkTimeUp(app::Object* arg);
static bool MoleMole_ActorAbilityPlugin_HanlderModifierThinkTimerUp_Hook(app::ActorAbilityPlugin* __this, float delay, app::Object* arg, MethodInfo* method);
static void LCBaseCombat_FireBeingHitEvent_Hook(app::LCBaseCombat* __this, uint32_t attackeeRuntimeID, app::AttackResult* attackResult, MethodInfo* method);
static void VCHumanoidMove_NotifyLandVelocity_Hook(app::VCHumanoidMove* __this, app::Vector3 velocity, float reachMaxDownVelocityTime, MethodInfo* method);
static bool Miscs_CheckTargetAttackable_Hook(app::BaseEntity* attacker, app::BaseEntity* target, MethodInfo* method);
GodMode(); GodMode();
}; };
} }