Merge pull request #1662 from gacuna89/patch-2

Fix: Prevent bots from eating and drinking while mounted
This commit is contained in:
kadeshar
2025-09-29 21:46:07 +02:00
committed by GitHub

View File

@@ -10,9 +10,6 @@
bool DrinkAction::Execute(Event event)
{
if (bot->IsInCombat())
return false;
if (botAI->HasCheat(BotCheatMask::food))
{
// if (bot->IsNonMeleeSpellCast(true))
@@ -52,23 +49,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;
return UseItemAction::isUseful() &&
AI_VALUE2(bool, "has mana", "self target") &&
AI_VALUE2(uint8, "mana", "self target") < 100;
}
bool DrinkAction::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());
}
bool EatAction::Execute(Event event)
{
if (bot->IsInCombat())
return false;
if (botAI->HasCheat(BotCheatMask::food))
{
// if (bot->IsNonMeleeSpellCast(true))
@@ -106,9 +102,17 @@ 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());
}