Merge pull request #436 from hellomykami/AutoChallengeBombbarrelDestroy

Add bombbarrel destroy in auto challenge
This commit is contained in:
Taiga 2022-08-09 03:27:10 -07:00 committed by GitHub
commit a045de4195
5 changed files with 19 additions and 0 deletions

View File

@ -321,6 +321,7 @@ namespace cheat::game::filters
SimpleFilter StarlightCoalescence = { EntityType__Enum_1::Field, "_PaperStar" }; SimpleFilter StarlightCoalescence = { EntityType__Enum_1::Field, "_PaperStar" };
SimpleFilter TheRavenForum = { EntityType__Enum_1::Gadget, "_NightCrowStatue" }; SimpleFilter TheRavenForum = { EntityType__Enum_1::Gadget, "_NightCrowStatue" };
WhitelistFilter TimeTrialChallengeCollection = { { EntityType__Enum_1::Field, EntityType__Enum_1::Gadget }, { "SkillObj_EmptyGadget", "_GlideChampOrb" } }; WhitelistFilter TimeTrialChallengeCollection = { { EntityType__Enum_1::Field, EntityType__Enum_1::Gadget }, { "SkillObj_EmptyGadget", "_GlideChampOrb" } };
SimpleFilter Bombbarrel = { EntityType__Enum_1::Gadget, "_Bombbarrel" };
} }
namespace combined namespace combined

View File

@ -321,6 +321,7 @@ namespace cheat::game::filters
extern SimpleFilter StarlightCoalescence; extern SimpleFilter StarlightCoalescence;
extern SimpleFilter TheRavenForum; extern SimpleFilter TheRavenForum;
extern WhitelistFilter TimeTrialChallengeCollection; extern WhitelistFilter TimeTrialChallengeCollection;
extern SimpleFilter Bombbarrel;
} }
namespace combined namespace combined

View File

@ -10,6 +10,7 @@ namespace cheat::feature
AutoChallenge::AutoChallenge() : Feature(), AutoChallenge::AutoChallenge() : Feature(),
NF(f_Enabled, "Auto challenge", "AutoChallenge", false), NF(f_Enabled, "Auto challenge", "AutoChallenge", false),
NF(f_BombDestroy, "Bomb destroy", "AutoChallenge", false),
NF(f_Delay, "Collect delay", "AutoChallenge", 1000), NF(f_Delay, "Collect delay", "AutoChallenge", 1000),
NF(f_Range, "Collect range", "AutoChallenge", 20.f) NF(f_Range, "Collect range", "AutoChallenge", 20.f)
{ {
@ -25,6 +26,10 @@ namespace cheat::feature
void AutoChallenge::DrawMain() void AutoChallenge::DrawMain()
{ {
ConfigWidget("Enabled", f_Enabled, "Auto collect time challenge item"); 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); ImGui::SetNextItemWidth(200.f);
ConfigWidget("Range", f_Range, 0.1f, 0.f, 300.f, "Collect range."); ConfigWidget("Range", f_Range, 0.1f, 0.f, 300.f, "Collect range.");
ImGui::SameLine(); ImGui::SameLine();

View File

@ -9,6 +9,7 @@ namespace cheat::feature
{ {
public: public:
config::Field<config::Toggle<Hotkey>> f_Enabled; config::Field<config::Toggle<Hotkey>> f_Enabled;
config::Field<config::Toggle<Hotkey>> f_BombDestroy;
config::Field<int> f_Delay; config::Field<int> f_Delay;
config::Field<float> f_Range; config::Field<float> f_Range;

View File

@ -7,6 +7,7 @@
#include <cheat/events.h> #include <cheat/events.h>
#include <cheat/game/SimpleFilter.h> #include <cheat/game/SimpleFilter.h>
#include <cheat/game/EntityManager.h> #include <cheat/game/EntityManager.h>
#include <cheat/world/AutoChallenge.h>
#include <cheat/game/filters.h> #include <cheat/game/filters.h>
namespace cheat::feature namespace cheat::feature
@ -81,7 +82,17 @@ namespace cheat::feature
{ {
auto& manager = game::EntityManager::instance(); auto& manager = game::EntityManager::instance();
auto& autoDestroy = AutoDestroy::GetInstance(); auto& autoDestroy = AutoDestroy::GetInstance();
auto& autoChallenge = AutoChallenge::GetInstance();
auto entity = __this->fields._._._entity; 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 && if (autoDestroy.f_Enabled &&
autoDestroy.f_Range > manager.avatar()->distance(entity) && autoDestroy.f_Range > manager.avatar()->distance(entity) &&
( (