Updated the locations of the checks, also added the checks as additional gatekeeper of the execute.

This commit is contained in:
bash
2025-09-27 23:26:29 +02:00
committed by GitHub
parent e042e3b12b
commit d9b57fcfd4

View File

@@ -10,13 +10,8 @@
bool DrinkAction::Execute(Event event) bool DrinkAction::Execute(Event event)
{ {
if (bot->IsInCombat()) // gatekeeper
return false; if (!isPossible())
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))
return false; return false;
if (botAI->HasCheat(BotCheatMask::food)) if (botAI->HasCheat(BotCheatMask::food))
@@ -58,27 +53,22 @@ bool DrinkAction::Execute(Event event)
bool DrinkAction::isUseful() 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; return UseItemAction::isUseful() && AI_VALUE2(uint8, "mana", "self target") < 100;
} }
bool DrinkAction::isPossible() 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) bool EatAction::Execute(Event event)
{ {
if (bot->IsInCombat()) // gatekeeper
return false; if (!isPossible())
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))
return false; return false;
if (botAI->HasCheat(BotCheatMask::food)) if (botAI->HasCheat(BotCheatMask::food))
@@ -118,9 +108,15 @@ bool EatAction::Execute(Event event)
return UseItemAction::Execute(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() 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());
} }