From abf50fb81f95fdcd548e4ac8dca5641617794001 Mon Sep 17 00:00:00 2001 From: Joaquin <67109235+Taiga74164@users.noreply.github.com> Date: Thu, 1 Sep 2022 23:09:12 -0600 Subject: [PATCH 1/3] Added SetCollider for Mob Vacuum --- .../src/user/cheat/world/MobVacuum.cpp | 26 ++++++++++++++++--- .../src/user/cheat/world/MobVacuum.h | 1 + 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/cheat-library/src/user/cheat/world/MobVacuum.cpp b/cheat-library/src/user/cheat/world/MobVacuum.cpp index 8e65a93..a7d3dad 100644 --- a/cheat-library/src/user/cheat/world/MobVacuum.cpp +++ b/cheat-library/src/user/cheat/world/MobVacuum.cpp @@ -22,7 +22,8 @@ namespace cheat::feature NF(f_Distance, "Distance", "MobVacuum", 1.5f), NF(f_Radius, "Radius", "MobVacuum", 10.0f), NF(f_OnlyTarget, "Only targeted", "MobVacuum", true), - NF(f_Instantly, "Instantly", "MobVacuum", false) + NF(f_Instantly, "Instantly", "MobVacuum", false), + NF(f_SetCollider, "SetCollider", "MobVacuum", false) { events::GameUpdateEvent += MY_METHOD_HANDLER(MobVacuum::OnGameUpdate); events::MoveSyncEvent += MY_METHOD_HANDLER(MobVacuum::OnMoveSync); @@ -63,6 +64,7 @@ namespace cheat::feature ConfigWidget("Instant Vacuum", f_Instantly, "Vacuum entities instantly."); ConfigWidget("Only Hostile/Aggro", f_OnlyTarget, "If enabled, vacuum will only affect monsters targeting you. Will not affect animals."); + ConfigWidget("Remove Collider", f_SetCollider, "If enabled, monsters won't be able to push you despite the distance or size"); ConfigWidget("Speed", f_Speed, 0.1f, 1.0f, 15.0f, "If 'Instant Vacuum' is not checked, mob will be vacuumed at the specified speed."); ConfigWidget("Radius (m)", f_Radius, 0.1f, 5.0f, 150.0f, "Radius of vacuum."); ConfigWidget("Distance (m)", f_Distance, 0.1f, 0.5f, 10.0f, "Distance between the player and the monster."); @@ -75,13 +77,13 @@ namespace cheat::feature void MobVacuum::DrawStatus() { - ImGui::Text("Vacuum [%s]\n[%s|%.01fm|%.01fm|%s]", + ImGui::Text("Vacuum [%s]\n[%s|%.01fm|%.01fm|%s|%s]", f_IncludeMonsters && f_IncludeAnimals ? "All" : f_IncludeMonsters ? "Monsters" : f_IncludeAnimals ? "Animals" : "None", f_Instantly ? "Instant" : fmt::format("Normal|{:.1f}", f_Speed.value()).c_str(), f_Radius.value(), f_Distance.value(), - f_OnlyTarget ? "Aggro" : "All" - ); + f_OnlyTarget ? "Aggro" : "All", + f_SetCollider ? "RCollider" : "ECollider"); } MobVacuum& MobVacuum::GetInstance() @@ -142,6 +144,18 @@ namespace cheat::feature return avatarEntity->relativePosition() + avatarEntity->forward() * f_Distance; } + // Set Monster's collider + // Taiga#5555: There might be an in-game function for this already I'm just not sure which one + void SetMonsterCollider(game::Entity* entity, bool v) + { + auto objName = entity->name(); + auto name = objName.substr(0, objName.find_first_of(" ")); + // path example: "EntityRoot/MonsterRoot/Monster_Fungus_Raptor_01(Clone)/Collider" + auto collider = app::GameObject_Find(string_to_il2cppi("/EntityRoot/MonsterRoot/" + name + "/Collider"), nullptr); + if (collider != nullptr) + app::GameObject_SetActive(collider, v, nullptr); + } + // Mob vacuum update function. // Changes position of monster, if mob vacuum enabled. void MobVacuum::OnGameUpdate() @@ -169,6 +183,8 @@ namespace cheat::feature if (!IsEntityForVac(entity)) continue; + SetMonsterCollider(entity, !f_SetCollider); + if (f_Instantly) { entity->setRelativePosition(targetPos); @@ -211,6 +227,8 @@ namespace cheat::feature if (!IsEntityForVac(entity)) return; + SetMonsterCollider(entity, !f_SetCollider); + app::Vector3 targetPos = CalcMobVacTargetPos(); app::Vector3 entityPos = entity->relativePosition(); if (app::Vector3_Distance(targetPos, entityPos, nullptr) < 0.2) diff --git a/cheat-library/src/user/cheat/world/MobVacuum.h b/cheat-library/src/user/cheat/world/MobVacuum.h index 4a76b0c..13003ab 100644 --- a/cheat-library/src/user/cheat/world/MobVacuum.h +++ b/cheat-library/src/user/cheat/world/MobVacuum.h @@ -29,6 +29,7 @@ namespace cheat::feature config::Field f_Distance; config::Field f_OnlyTarget; config::Field f_Instantly; + config::Field> f_SetCollider; static MobVacuum& GetInstance(); From fa90039ca2999ab1b5eb3e46f1670ceac9417774 Mon Sep 17 00:00:00 2001 From: Joaquin <67109235+Taiga74164@users.noreply.github.com> Date: Thu, 1 Sep 2022 23:15:08 -0600 Subject: [PATCH 2/3] Shorten draw status --- cheat-library/src/user/cheat/world/MobVacuum.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cheat-library/src/user/cheat/world/MobVacuum.cpp b/cheat-library/src/user/cheat/world/MobVacuum.cpp index a7d3dad..7561b3e 100644 --- a/cheat-library/src/user/cheat/world/MobVacuum.cpp +++ b/cheat-library/src/user/cheat/world/MobVacuum.cpp @@ -83,7 +83,7 @@ namespace cheat::feature f_Radius.value(), f_Distance.value(), f_OnlyTarget ? "Aggro" : "All", - f_SetCollider ? "RCollider" : "ECollider"); + f_SetCollider ? "RC" : ""); } MobVacuum& MobVacuum::GetInstance() From 98ca49d19c6bc5a61c4b29d18ede8eaa9e3edc89 Mon Sep 17 00:00:00 2001 From: Joaquin <67109235+Taiga74164@users.noreply.github.com> Date: Fri, 2 Sep 2022 12:15:57 -0600 Subject: [PATCH 3/3] Fixed other indexes not turning off if they share the same name --- .../src/user/cheat/world/MobVacuum.cpp | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/cheat-library/src/user/cheat/world/MobVacuum.cpp b/cheat-library/src/user/cheat/world/MobVacuum.cpp index 7561b3e..f04ac30 100644 --- a/cheat-library/src/user/cheat/world/MobVacuum.cpp +++ b/cheat-library/src/user/cheat/world/MobVacuum.cpp @@ -146,14 +146,23 @@ namespace cheat::feature // Set Monster's collider // Taiga#5555: There might be an in-game function for this already I'm just not sure which one - void SetMonsterCollider(game::Entity* entity, bool v) + void SetMonsterCollider(bool v) { - auto objName = entity->name(); - auto name = objName.substr(0, objName.find_first_of(" ")); - // path example: "EntityRoot/MonsterRoot/Monster_Fungus_Raptor_01(Clone)/Collider" - auto collider = app::GameObject_Find(string_to_il2cppi("/EntityRoot/MonsterRoot/" + name + "/Collider"), nullptr); - if (collider != nullptr) - app::GameObject_SetActive(collider, v, nullptr); + auto monsterRoot = app::GameObject_Find(string_to_il2cppi("/EntityRoot/MonsterRoot"), nullptr); + if (monsterRoot != nullptr) + { + auto transform = app::GameObject_GetComponentByName(monsterRoot, string_to_il2cppi("Transform"), nullptr); + auto monsterCount = app::Transform_get_childCount(reinterpret_cast(transform), nullptr); + for (int i = 0; i <= monsterCount - 1; i++) + { + auto monsters = app::Transform_GetChild(reinterpret_cast(transform), i, nullptr); + auto monsterGameObject = app::Component_1_get_gameObject(reinterpret_cast(monsters), nullptr); + auto monsterTransform = app::GameObject_GetComponentByName(monsterGameObject, string_to_il2cppi("Transform"), nullptr); + auto transformChild = app::Transform_GetChild(reinterpret_cast(monsterTransform), 1, nullptr); + auto colliderGameObject = app::Component_1_get_gameObject(reinterpret_cast(transformChild), nullptr); + app::GameObject_SetActive(colliderGameObject, v, nullptr); + } + } } // Mob vacuum update function. @@ -183,7 +192,7 @@ namespace cheat::feature if (!IsEntityForVac(entity)) continue; - SetMonsterCollider(entity, !f_SetCollider); + SetMonsterCollider(!f_SetCollider); if (f_Instantly) { @@ -227,7 +236,7 @@ namespace cheat::feature if (!IsEntityForVac(entity)) return; - SetMonsterCollider(entity, !f_SetCollider); + SetMonsterCollider(!f_SetCollider); app::Vector3 targetPos = CalcMobVacTargetPos(); app::Vector3 entityPos = entity->relativePosition();