Add bombbarrel destroy in auto challenge

This commit is contained in:
Miya 2022-08-09 15:50:37 +08:00
parent b91344a4f7
commit d7fa87cd81
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 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

View File

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

View File

@ -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();

View File

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

View File

@ -7,6 +7,7 @@
#include <cheat/events.h>
#include <cheat/game/SimpleFilter.h>
#include <cheat/game/EntityManager.h>
#include <cheat/world/AutoChallenge.h>
#include <cheat/game/filters.h>
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) &&
(