From d9b57fcfd4decd0efe66183c9e718683d3cb59ef Mon Sep 17 00:00:00 2001 From: bash <31279994+hermensbas@users.noreply.github.com> Date: Sat, 27 Sep 2025 23:26:29 +0200 Subject: [PATCH] Updated the locations of the checks, also added the checks as additional gatekeeper of the execute. --- src/strategy/actions/NonCombatActions.cpp | 38 ++++++++++------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/src/strategy/actions/NonCombatActions.cpp b/src/strategy/actions/NonCombatActions.cpp index f7b5a26a..6037948a 100644 --- a/src/strategy/actions/NonCombatActions.cpp +++ b/src/strategy/actions/NonCombatActions.cpp @@ -10,13 +10,8 @@ bool DrinkAction::Execute(Event event) { - if (bot->IsInCombat()) - return false; - - if (bot->IsMounted()) - return false; - - if (botAI->HasAnyAuraOf(GetTarget(), "dire bear form", "bear form", "cat form", "travel form", "aquatic form","flight form", "swift flight form", nullptr)) + // gatekeeper + if (!isPossible()) return false; if (botAI->HasCheat(BotCheatMask::food)) @@ -58,27 +53,22 @@ bool DrinkAction::Execute(Event event) bool DrinkAction::isUseful() { - // check class uses mana - if (!AI_VALUE2(bool, "has mana", "self target")) - return false; - return UseItemAction::isUseful() && AI_VALUE2(uint8, "mana", "self target") < 100; } bool DrinkAction::isPossible() { - return !bot->IsInCombat() && (botAI->HasCheat(BotCheatMask::food) || UseItemAction::isPossible()); + return !bot->IsInCombat() && + AI_VALUE2(bool, "has mana", "self target") && + !bot->IsMounted() && + !botAI->HasAnyAuraOf(GetTarget(), "dire bear form", "bear form", "cat form", "travel form", "aquatic form","flight form", "swift flight form", nullptr) && + (botAI->HasCheat(BotCheatMask::food) || UseItemAction::isPossible()); } bool EatAction::Execute(Event event) { - if (bot->IsInCombat()) - return false; - - if (bot->IsMounted()) - return false; - - if (botAI->HasAnyAuraOf(GetTarget(), "dire bear form", "bear form", "cat form", "travel form", "aquatic form","flight form", "swift flight form", nullptr)) + // gatekeeper + if (!isPossible()) return false; if (botAI->HasCheat(BotCheatMask::food)) @@ -118,9 +108,15 @@ bool EatAction::Execute(Event event) return UseItemAction::Execute(event); } -bool EatAction::isUseful() { return UseItemAction::isUseful() && AI_VALUE2(uint8, "health", "self target") < 85; } +bool EatAction::isUseful() +{ + return UseItemAction::isUseful() && AI_VALUE2(uint8, "health", "self target") < 100; +} bool EatAction::isPossible() { - return !bot->IsInCombat() && (botAI->HasCheat(BotCheatMask::food) || UseItemAction::isPossible()); + return !bot->IsInCombat() && + !bot->IsMounted() && + !botAI->HasAnyAuraOf(GetTarget(), "dire bear form", "bear form", "cat form", "travel form", "aquatic form","flight form", "swift flight form", nullptr) && + (botAI->HasCheat(BotCheatMask::food) || UseItemAction::isPossible()); }