From d7fa87cd8171e89deceac7d21fde60b92f963ef4 Mon Sep 17 00:00:00 2001 From: Miya Date: Tue, 9 Aug 2022 15:50:37 +0800 Subject: [PATCH] Add bombbarrel destroy in auto challenge --- cheat-library/src/user/cheat/game/filters.cpp | 1 + cheat-library/src/user/cheat/game/filters.h | 1 + cheat-library/src/user/cheat/world/AutoChallenge.cpp | 5 +++++ cheat-library/src/user/cheat/world/AutoChallenge.h | 1 + cheat-library/src/user/cheat/world/AutoDestroy.cpp | 11 +++++++++++ 5 files changed, 19 insertions(+) diff --git a/cheat-library/src/user/cheat/game/filters.cpp b/cheat-library/src/user/cheat/game/filters.cpp index 6c6b486..1c4ce2a 100644 --- a/cheat-library/src/user/cheat/game/filters.cpp +++ b/cheat-library/src/user/cheat/game/filters.cpp @@ -321,6 +321,7 @@ namespace cheat::game::filters SimpleFilter StarlightCoalescence = { EntityType__Enum_1::Field, "_PaperStar" }; SimpleFilter TheRavenForum = { EntityType__Enum_1::Gadget, "_NightCrowStatue" }; WhitelistFilter TimeTrialChallengeCollection = { { EntityType__Enum_1::Field, EntityType__Enum_1::Gadget }, { "SkillObj_EmptyGadget", "_GlideChampOrb" } }; + SimpleFilter Bombbarrel = { EntityType__Enum_1::Gadget, "_Bombbarrel" }; } namespace combined diff --git a/cheat-library/src/user/cheat/game/filters.h b/cheat-library/src/user/cheat/game/filters.h index a1b21a9..f7d8f05 100644 --- a/cheat-library/src/user/cheat/game/filters.h +++ b/cheat-library/src/user/cheat/game/filters.h @@ -321,6 +321,7 @@ namespace cheat::game::filters extern SimpleFilter StarlightCoalescence; extern SimpleFilter TheRavenForum; extern WhitelistFilter TimeTrialChallengeCollection; + extern SimpleFilter Bombbarrel; } namespace combined diff --git a/cheat-library/src/user/cheat/world/AutoChallenge.cpp b/cheat-library/src/user/cheat/world/AutoChallenge.cpp index 9cba70e..8c44081 100644 --- a/cheat-library/src/user/cheat/world/AutoChallenge.cpp +++ b/cheat-library/src/user/cheat/world/AutoChallenge.cpp @@ -10,6 +10,7 @@ namespace cheat::feature AutoChallenge::AutoChallenge() : Feature(), NF(f_Enabled, "Auto challenge", "AutoChallenge", false), + NF(f_BombDestroy, "Bomb destroy", "AutoChallenge", false), NF(f_Delay, "Collect delay", "AutoChallenge", 1000), NF(f_Range, "Collect range", "AutoChallenge", 20.f) { @@ -25,6 +26,10 @@ namespace cheat::feature void AutoChallenge::DrawMain() { ConfigWidget("Enabled", f_Enabled, "Auto collect time challenge item"); + ImGui::SameLine(); + ConfigWidget("Destroy Bomb", f_BombDestroy, "Auto destroy bombbarrel"); + ImGui::SameLine(); + ImGui::TextColored(ImColor(255, 165, 0, 255), "I haven't tested how high the risk is"); ImGui::SetNextItemWidth(200.f); ConfigWidget("Range", f_Range, 0.1f, 0.f, 300.f, "Collect range."); ImGui::SameLine(); diff --git a/cheat-library/src/user/cheat/world/AutoChallenge.h b/cheat-library/src/user/cheat/world/AutoChallenge.h index ca442cc..f8bcaf9 100644 --- a/cheat-library/src/user/cheat/world/AutoChallenge.h +++ b/cheat-library/src/user/cheat/world/AutoChallenge.h @@ -9,6 +9,7 @@ namespace cheat::feature { public: config::Field> f_Enabled; + config::Field> f_BombDestroy; config::Field f_Delay; config::Field f_Range; diff --git a/cheat-library/src/user/cheat/world/AutoDestroy.cpp b/cheat-library/src/user/cheat/world/AutoDestroy.cpp index 3f873e2..34ae4b5 100644 --- a/cheat-library/src/user/cheat/world/AutoDestroy.cpp +++ b/cheat-library/src/user/cheat/world/AutoDestroy.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include namespace cheat::feature @@ -81,7 +82,17 @@ namespace cheat::feature { auto& manager = game::EntityManager::instance(); auto& autoDestroy = AutoDestroy::GetInstance(); + auto& autoChallenge = AutoChallenge::GetInstance(); auto entity = __this->fields._._._entity; + // call origin ReduceModifierDurability without correct modifierDurabilityIndex will coz game crash. + // so use this hook function to destroy challenge's bombbarrel + if (autoChallenge.f_Enabled && autoChallenge.f_BombDestroy && + autoChallenge.f_Range > manager.avatar()->distance(entity) && + game::filters::puzzle::Bombbarrel.IsValid(manager.entity(entity)) + ) + { + reduceDurability = 1000.f; + } if (autoDestroy.f_Enabled && autoDestroy.f_Range > manager.avatar()->distance(entity) && (