From 954fa155559b7fc23daf4fcb67fa0837ec463dfa Mon Sep 17 00:00:00 2001 From: Joaquin <67109235+Taiga74164@users.noreply.github.com> Date: Fri, 5 Aug 2022 19:53:20 -0600 Subject: [PATCH 1/4] configID checks for Rapid Fire --- .../src/user/cheat/player/RapidFire.cpp | 103 ++++++++++-------- 1 file changed, 59 insertions(+), 44 deletions(-) diff --git a/cheat-library/src/user/cheat/player/RapidFire.cpp b/cheat-library/src/user/cheat/player/RapidFire.cpp index bcad5ee..d49b3e2 100644 --- a/cheat-library/src/user/cheat/player/RapidFire.cpp +++ b/cheat-library/src/user/cheat/player/RapidFire.cpp @@ -6,41 +6,41 @@ #include #include -namespace cheat::feature +namespace cheat::feature { static void LCBaseCombat_DoHitEntity_Hook(app::LCBaseCombat* __this, uint32_t targetID, app::AttackResult* attackResult, bool ignoreCheckCanBeHitInMP, MethodInfo* method); - RapidFire::RapidFire() : Feature(), - NF(f_Enabled, "Attack Multiplier", "RapidFire", false), - NF(f_MultiHit, "Multi-hit", "RapidFire", false), - NF(f_Multiplier, "Hit Multiplier", "RapidFire", 2), - NF(f_OnePunch, "One Punch Mode", "RapidFire", false), - NF(f_Randomize, "Randomize", "RapidFire", false), - NF(f_minMultiplier, "Min Multiplier", "RapidFire", 1), - NF(f_maxMultiplier, "Max Multiplier", "RapidFire", 3), - NF(f_MultiTarget, "Multi-target", "RapidFire", false), - NF(f_MultiTargetRadius, "Multi-target Radius", "RapidFire", 20.0f) - { + RapidFire::RapidFire() : Feature(), + NF(f_Enabled, "Attack Multiplier", "RapidFire", false), + NF(f_MultiHit, "Multi-hit", "RapidFire", false), + NF(f_Multiplier, "Hit Multiplier", "RapidFire", 2), + NF(f_OnePunch, "One Punch Mode", "RapidFire", false), + NF(f_Randomize, "Randomize", "RapidFire", false), + NF(f_minMultiplier, "Min Multiplier", "RapidFire", 1), + NF(f_maxMultiplier, "Max Multiplier", "RapidFire", 3), + NF(f_MultiTarget, "Multi-target", "RapidFire", false), + NF(f_MultiTargetRadius, "Multi-target Radius", "RapidFire", 20.0f) + { HookManager::install(app::MoleMole_LCBaseCombat_DoHitEntity, LCBaseCombat_DoHitEntity_Hook); - } + } - const FeatureGUIInfo& RapidFire::GetGUIInfo() const - { - static const FeatureGUIInfo info{ "Attack Effects", "Player", true }; - return info; - } + const FeatureGUIInfo& RapidFire::GetGUIInfo() const + { + static const FeatureGUIInfo info{ "Attack Effects", "Player", true }; + return info; + } - void RapidFire::DrawMain() - { + void RapidFire::DrawMain() + { ConfigWidget("Enabled", f_Enabled, "Enables attack multipliers. Need to choose a mode to work."); ImGui::SameLine(); ImGui::TextColored(ImColor(255, 165, 0, 255), "Choose any or both modes below."); ConfigWidget("Multi-hit Mode", f_MultiHit, "Enables multi-hit.\n" \ - "Multiplies your attack count.\n" \ - "This is not well tested, and can be detected by anticheat.\n" \ - "Not recommended to be used with main accounts or used with high values.\n" \ + "Multiplies your attack count.\n" \ + "This is not well tested, and can be detected by anticheat.\n" \ + "Not recommended to be used with main accounts or used with high values.\n" \ "Known issues with certain multi-hit attacks, e.g. Xiao E, Ayaka CA, etc."); ImGui::Indent(); @@ -73,20 +73,20 @@ namespace cheat::feature "If multi-hit is off and there are still multiple numbers on a single target, check the Entity Manager in the Debug section to see if there are invisible entities.\n" \ "This can cause EXTREME lag and quick bans if used with multi-hit. You are warned." ); - + ImGui::Indent(); ConfigWidget("Radius (m)", f_MultiTargetRadius, 0.1f, 5.0f, 50.0f, "Radius to check for valid targets."); ImGui::Unindent(); - } + } - bool RapidFire::NeedStatusDraw() const -{ - return f_Enabled && (f_MultiHit || f_MultiTarget); - } + bool RapidFire::NeedStatusDraw() const + { + return f_Enabled && (f_MultiHit || f_MultiTarget); + } - void RapidFire::DrawStatus() - { - if (f_MultiHit) + void RapidFire::DrawStatus() + { + if (f_MultiHit) { if (f_Randomize) ImGui::Text("Multi-Hit Random[%d|%d]", f_minMultiplier.value(), f_maxMultiplier.value()); @@ -97,20 +97,20 @@ namespace cheat::feature } if (f_MultiTarget) ImGui::Text("Multi-Target [%.01fm]", f_MultiTargetRadius.value()); - } + } - RapidFire& RapidFire::GetInstance() - { - static RapidFire instance; - return instance; - } + RapidFire& RapidFire::GetInstance() + { + static RapidFire instance; + return instance; + } int RapidFire::CalcCountToKill(float attackDamage, uint32_t targetID) { if (attackDamage == 0) return f_Multiplier; - + auto& manager = game::EntityManager::instance(); auto targetEntity = manager.entity(targetID); if (targetEntity == nullptr) @@ -165,10 +165,10 @@ namespace cheat::feature entity = game::Entity(app::MoleMole_GadgetEntity_GetOwnerEntity(reinterpret_cast(entity.raw()), nullptr)); if (entity.runtimeID() == avatarID) return true; - } + } return false; - + } bool IsAttackByAvatar(game::Entity& attacker) @@ -183,6 +183,20 @@ namespace cheat::feature return attackerID == avatarID || IsAvatarOwner(attacker); } + bool IsConfigByAvatar(game::Entity& attacker) + { + if (attacker.raw() == nullptr) + return false; + + auto& manager = game::EntityManager::instance(); + auto avatarID = manager.avatar()->raw()->fields._configID_k__BackingField; + auto attackerID = attacker.raw()->fields._configID_k__BackingField; + // Taiga#5555: IDs can be found in ConfigAbility_Avatar_*.json or GadgetExcelConfigData.json + bool bulletID = attackerID >= 40000160 && attackerID <= 41069999; + + return avatarID == attackerID || bulletID; + } + bool IsValidByFilter(game::Entity* entity) { if (game::filters::combined::OrganicTargets.IsValid(entity) || @@ -192,7 +206,7 @@ namespace cheat::feature game::filters::puzzle::LargeRockPile.IsValid(entity) || game::filters::puzzle::SmallRockPile.IsValid(entity)) return true; - return false; + return false; } // Raises when any entity do hit event. @@ -203,7 +217,7 @@ namespace cheat::feature { auto attacker = game::Entity(__this->fields._._._entity); RapidFire& rapidFire = RapidFire::GetInstance(); - if (!IsAttackByAvatar(attacker) || !rapidFire.f_Enabled) + if (!IsConfigByAvatar(attacker) || !IsAttackByAvatar(attacker) || !rapidFire.f_Enabled) return CALL_ORIGIN(LCBaseCombat_DoHitEntity_Hook, __this, targetID, attackResult, ignoreCheckCanBeHitInMP, method); auto& manager = game::EntityManager::instance(); @@ -243,7 +257,8 @@ namespace cheat::feature int attackCount = rapidFire.GetAttackCount(__this, entity->runtimeID(), attackResult); for (int i = 0; i < attackCount; i++) CALL_ORIGIN(LCBaseCombat_DoHitEntity_Hook, __this, entity->runtimeID(), attackResult, ignoreCheckCanBeHitInMP, method); - } else CALL_ORIGIN(LCBaseCombat_DoHitEntity_Hook, __this, entity->runtimeID(), attackResult, ignoreCheckCanBeHitInMP, method); + } + else CALL_ORIGIN(LCBaseCombat_DoHitEntity_Hook, __this, entity->runtimeID(), attackResult, ignoreCheckCanBeHitInMP, method); } } } From 05325464a36e906c6c32a5a69738be85d2b5dc23 Mon Sep 17 00:00:00 2001 From: Joaquin <67109235+Taiga74164@users.noreply.github.com> Date: Fri, 5 Aug 2022 23:47:10 -0600 Subject: [PATCH 2/4] Added animation rapid fire --- cheat-library/src/appdata/il2cpp-functions.h | 1 + cheat-library/src/appdata/il2cpp-types.h | 55 +++++++++++++++++++ .../src/user/cheat/player/RapidFire.cpp | 28 +++++++++- .../src/user/cheat/player/RapidFire.h | 1 + 4 files changed, 83 insertions(+), 2 deletions(-) diff --git a/cheat-library/src/appdata/il2cpp-functions.h b/cheat-library/src/appdata/il2cpp-functions.h index b40a760..8d8475e 100644 --- a/cheat-library/src/appdata/il2cpp-functions.h +++ b/cheat-library/src/appdata/il2cpp-functions.h @@ -56,6 +56,7 @@ DO_APP_FUNC(0x02DB4680, void, MoleMole_ActorAbilityPlugin_AddDynamicFloatWithRan // Rapid fire DO_APP_FUNC(0x017B1D50, void, MoleMole_LCBaseCombat_DoHitEntity, (LCBaseCombat* __this, uint32_t targetID, AttackResult* attackResult, bool ignoreCheckCanBeHitInMP, MethodInfo* method)); DO_APP_FUNC(0x019DDF40, void, MoleMole_Formula_CalcAttackResult, (CombatProperty* attackCombatProperty, CombatProperty* defenseCombatProperty, AttackResult* attackResult, BaseEntity* attackerEntity, BaseEntity* attackeeEntity, MethodInfo* method)); +DO_APP_FUNC(0x0106D020, void, MoleMole_VCAnimatorEvent_HandleProcessItem, (MoleMole_VCAnimatorEvent* __this, MoleMole_VCAnimatorEvent_MoleMole_VCAnimatorEvent_AnimatorEventPatternProcessItem* processItem, AnimatorStateInfo processStateInfo, MoleMole_VCAnimatorEvent_MoleMole_VCAnimatorEvent_TriggerMode__Enum mode, MethodInfo* method)); // World cheats diff --git a/cheat-library/src/appdata/il2cpp-types.h b/cheat-library/src/appdata/il2cpp-types.h index 5fb7cd1..5cdf221 100644 --- a/cheat-library/src/appdata/il2cpp-types.h +++ b/cheat-library/src/appdata/il2cpp-types.h @@ -11998,6 +11998,61 @@ namespace app { struct MoleMole_ActorAbilityPlugin__Fields fields; }; + struct MoleMole_VCAnimatorEvent__Fields { + struct VCBase__Fields _; + struct Animator* _animator; + struct Action_1_MoleMole_AnimatorParameterEntry_* onUserInputControllerChanged; + struct Action_4_Int32_UnityEngine_AnimatorStateInfo_UnityEngine_AnimatorStateInfo_MoleMole_AnimatorStateChangeExtra_* onAnimatorStateTransitionFinish; + struct Dictionary_2_System_Int32_Dictionary_2_System_Int32_List_1_System_Int32_* _activeAnimatorEventPatterns; + struct Dictionary_2_System_Int32_System_Int32_* _filterOldPattern2newPattern; + struct Action_2_Int32_Single_* processNormalizedTimeActions; + struct Queue_1_MoleMole_CompensateDiffInfo_* authorityEventQueue; + struct Queue_1_MoleMole_CompensateDiffInfo_* remoteEventQueue; + struct MoleMole_VCMoveData* _moveData; + struct MoleMole_VCSyncAnimator* _vcSyncAnimator; + int32_t MAX_ALLOW_COMPENSATE_TIME; + struct List_1_System_Int32_* _layerIndexes; + struct Dictionary_2_System_Int32_MoleMole_VCAnimatorEvent_MoleMole_VCAnimatorEvent_AnimatorLayerItem_* _layerItems; + }; + + struct MoleMole_VCAnimatorEvent { + struct MoleMole_VCAnimatorEvent__Class* klass; + MonitorData* monitor; + struct MoleMole_VCAnimatorEvent__Fields fields; + }; + + struct AnimatorStateInfo { + int32_t m_Name; + int32_t m_Path; + int32_t m_FullPath; + float m_NormalizedTime; + float m_Length; + float m_Speed; + float m_SpeedMultiplier; + int32_t m_Tag; + int32_t m_Loop; + }; + + struct __declspec(align(8)) MoleMole_VCAnimatorEvent_MoleMole_VCAnimatorEvent_AnimatorEventPatternProcessItem__Fields { + struct List_1_System_Int32_* patterns; + struct AnimatorStateInfo stateInfo; + float lastTime; + }; + + struct MoleMole_VCAnimatorEvent_MoleMole_VCAnimatorEvent_AnimatorEventPatternProcessItem { + struct MoleMole_VCAnimatorEvent_MoleMole_VCAnimatorEvent_AnimatorEventPatternProcessItem__Class* klass; + MonitorData* monitor; + struct MoleMole_VCAnimatorEvent_MoleMole_VCAnimatorEvent_AnimatorEventPatternProcessItem__Fields fields; + }; + + enum class MoleMole_VCAnimatorEvent_MoleMole_VCAnimatorEvent_TriggerMode__Enum : int32_t { + NormalTrigger = 0x00000000, + ForceTriggerOnEnter = 0x00000001, + ForceTriggerOnExitImediately = 0x00000002, + ForceTriggerOnExitTransition = 0x00000003, + ForceTriggerOnExitTransitionFinish = 0x00000004, + }; + #if !defined(_GHIDRA_) && !defined(_IDA_) } #endif diff --git a/cheat-library/src/user/cheat/player/RapidFire.cpp b/cheat-library/src/user/cheat/player/RapidFire.cpp index d49b3e2..b8292a1 100644 --- a/cheat-library/src/user/cheat/player/RapidFire.cpp +++ b/cheat-library/src/user/cheat/player/RapidFire.cpp @@ -10,6 +10,9 @@ namespace cheat::feature { static void LCBaseCombat_DoHitEntity_Hook(app::LCBaseCombat* __this, uint32_t targetID, app::AttackResult* attackResult, bool ignoreCheckCanBeHitInMP, MethodInfo* method); + static void VCAnimatorEvent_HandleProcessItem_Hook(app::MoleMole_VCAnimatorEvent* __this, + app::MoleMole_VCAnimatorEvent_MoleMole_VCAnimatorEvent_AnimatorEventPatternProcessItem* processItem, + app::AnimatorStateInfo processStateInfo, app::MoleMole_VCAnimatorEvent_MoleMole_VCAnimatorEvent_TriggerMode__Enum mode, MethodInfo* method); RapidFire::RapidFire() : Feature(), NF(f_Enabled, "Attack Multiplier", "RapidFire", false), @@ -20,9 +23,11 @@ namespace cheat::feature NF(f_minMultiplier, "Min Multiplier", "RapidFire", 1), NF(f_maxMultiplier, "Max Multiplier", "RapidFire", 3), NF(f_MultiTarget, "Multi-target", "RapidFire", false), - NF(f_MultiTargetRadius, "Multi-target Radius", "RapidFire", 20.0f) + NF(f_MultiTargetRadius, "Multi-target Radius", "RapidFire", 20.0f), + NF(f_MultiAnimation, "Multi-animation", "RapidFire", false) { HookManager::install(app::MoleMole_LCBaseCombat_DoHitEntity, LCBaseCombat_DoHitEntity_Hook); + HookManager::install(app::MoleMole_VCAnimatorEvent_HandleProcessItem, VCAnimatorEvent_HandleProcessItem_Hook); } const FeatureGUIInfo& RapidFire::GetGUIInfo() const @@ -77,11 +82,14 @@ namespace cheat::feature ImGui::Indent(); ConfigWidget("Radius (m)", f_MultiTargetRadius, 0.1f, 5.0f, 50.0f, "Radius to check for valid targets."); ImGui::Unindent(); + + ConfigWidget("Multi-animation", f_MultiAnimation, "Enables multi-animation attacks.\n" \ + "Do keep in mind that the character's audio will also be spammed."); } bool RapidFire::NeedStatusDraw() const { - return f_Enabled && (f_MultiHit || f_MultiTarget); + return f_Enabled && (f_MultiHit || f_MultiTarget || f_MultiAnimation); } void RapidFire::DrawStatus() @@ -97,6 +105,9 @@ namespace cheat::feature } if (f_MultiTarget) ImGui::Text("Multi-Target [%.01fm]", f_MultiTargetRadius.value()); + + if (f_MultiAnimation) + ImGui::Text("Multi-Animation"); } RapidFire& RapidFire::GetInstance() @@ -261,5 +272,18 @@ namespace cheat::feature else CALL_ORIGIN(LCBaseCombat_DoHitEntity_Hook, __this, entity->runtimeID(), attackResult, ignoreCheckCanBeHitInMP, method); } } + + static void VCAnimatorEvent_HandleProcessItem_Hook(app::MoleMole_VCAnimatorEvent* __this, + app::MoleMole_VCAnimatorEvent_MoleMole_VCAnimatorEvent_AnimatorEventPatternProcessItem* processItem, + app::AnimatorStateInfo processStateInfo, app::MoleMole_VCAnimatorEvent_MoleMole_VCAnimatorEvent_TriggerMode__Enum mode, MethodInfo* method) + { + auto attacker = game::Entity(__this->fields._._._entity); + RapidFire& rapidFire = RapidFire::GetInstance(); + + if (rapidFire.f_MultiAnimation && IsAttackByAvatar(attacker)) + processItem->fields.lastTime = -1; + + CALL_ORIGIN(VCAnimatorEvent_HandleProcessItem_Hook, __this, processItem, processStateInfo, mode, method); + } } diff --git a/cheat-library/src/user/cheat/player/RapidFire.h b/cheat-library/src/user/cheat/player/RapidFire.h index 940741c..7d9d26f 100644 --- a/cheat-library/src/user/cheat/player/RapidFire.h +++ b/cheat-library/src/user/cheat/player/RapidFire.h @@ -19,6 +19,7 @@ namespace cheat::feature config::Field f_maxMultiplier; config::Field> f_MultiTarget; config::Field f_MultiTargetRadius; + config::Field> f_MultiAnimation; static RapidFire& GetInstance(); From 73a9d82cf5b8ef6566d932002f39edccd7df83c2 Mon Sep 17 00:00:00 2001 From: Joaquin <67109235+Taiga74164@users.noreply.github.com> Date: Sat, 6 Aug 2022 07:46:39 -0600 Subject: [PATCH 3/4] Fix issue with Kazuha E --- cheat-library/src/user/cheat/player/RapidFire.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cheat-library/src/user/cheat/player/RapidFire.cpp b/cheat-library/src/user/cheat/player/RapidFire.cpp index b8292a1..db2e4d5 100644 --- a/cheat-library/src/user/cheat/player/RapidFire.cpp +++ b/cheat-library/src/user/cheat/player/RapidFire.cpp @@ -281,7 +281,7 @@ namespace cheat::feature RapidFire& rapidFire = RapidFire::GetInstance(); if (rapidFire.f_MultiAnimation && IsAttackByAvatar(attacker)) - processItem->fields.lastTime = -1; + processItem->fields.lastTime = 0; CALL_ORIGIN(VCAnimatorEvent_HandleProcessItem_Hook, __this, processItem, processStateInfo, mode, method); } From e01c0612343a8f65c01c61b4946202f0a7574583 Mon Sep 17 00:00:00 2001 From: Joaquin <67109235+Taiga74164@users.noreply.github.com> Date: Sun, 7 Aug 2022 01:45:55 -0600 Subject: [PATCH 4/4] Fixed RapidFire for all polearm characters --- cheat-library/src/user/cheat/player/RapidFire.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cheat-library/src/user/cheat/player/RapidFire.cpp b/cheat-library/src/user/cheat/player/RapidFire.cpp index db2e4d5..8adf898 100644 --- a/cheat-library/src/user/cheat/player/RapidFire.cpp +++ b/cheat-library/src/user/cheat/player/RapidFire.cpp @@ -267,9 +267,9 @@ namespace cheat::feature if (rapidFire.f_MultiHit) { int attackCount = rapidFire.GetAttackCount(__this, entity->runtimeID(), attackResult); for (int i = 0; i < attackCount; i++) - CALL_ORIGIN(LCBaseCombat_DoHitEntity_Hook, __this, entity->runtimeID(), attackResult, ignoreCheckCanBeHitInMP, method); + app::MoleMole_LCBaseCombat_FireBeingHitEvent(__this, entity->runtimeID(), attackResult, method); } - else CALL_ORIGIN(LCBaseCombat_DoHitEntity_Hook, __this, entity->runtimeID(), attackResult, ignoreCheckCanBeHitInMP, method); + else app::MoleMole_LCBaseCombat_FireBeingHitEvent(__this, entity->runtimeID(), attackResult, method); } }