- Changed standalone config on cheat (#1585)

- Changed drink condition
This commit is contained in:
kadeshar
2025-08-26 18:28:42 +02:00
committed by GitHub
parent 704e02e9cc
commit bc737ecc68
8 changed files with 23 additions and 24 deletions

View File

@@ -76,7 +76,7 @@ bool GiveFoodAction::isUseful()
bool isRandomBot = GetTarget()->IsPlayer() && sRandomPlayerbotMgr->IsRandomBot((Player*)GetTarget());
return !isRandomBot || (isRandomBot && !sPlayerbotAIConfig->freeFood);
return !isRandomBot || (isRandomBot && !botAI->HasCheat(BotCheatMask::food));
}
Unit* GiveWaterAction::GetTarget() { return AI_VALUE(Unit*, "party member without water"); }
@@ -88,5 +88,5 @@ bool GiveWaterAction::isUseful()
bool isRandomBot = GetTarget()->IsPlayer() && sRandomPlayerbotMgr->IsRandomBot((Player*)GetTarget());
return !isRandomBot || (isRandomBot && !sPlayerbotAIConfig->freeFood);
return !isRandomBot || (isRandomBot && !botAI->HasCheat(BotCheatMask::food));
}

View File

@@ -17,7 +17,7 @@ bool DrinkAction::Execute(Event event)
if (!hasMana)
return false;
if (sPlayerbotAIConfig->freeFood)
if (botAI->HasCheat(BotCheatMask::food))
{
// if (bot->IsNonMeleeSpellCast(true))
// return false;
@@ -54,11 +54,11 @@ bool DrinkAction::Execute(Event event)
return UseItemAction::Execute(event);
}
bool DrinkAction::isUseful() { return UseItemAction::isUseful() && AI_VALUE2(uint8, "mana", "self target") < 85; }
bool DrinkAction::isUseful() { return UseItemAction::isUseful() && AI_VALUE2(uint8, "mana", "self target") < 100; }
bool DrinkAction::isPossible()
{
return !bot->IsInCombat() && (sPlayerbotAIConfig->freeFood || UseItemAction::isPossible());
return !bot->IsInCombat() && (botAI->HasCheat(BotCheatMask::food) || UseItemAction::isPossible());
}
bool EatAction::Execute(Event event)
@@ -66,7 +66,7 @@ bool EatAction::Execute(Event event)
if (bot->IsInCombat())
return false;
if (sPlayerbotAIConfig->freeFood)
if (botAI->HasCheat(BotCheatMask::food))
{
// if (bot->IsNonMeleeSpellCast(true))
// return false;
@@ -107,5 +107,5 @@ bool EatAction::isUseful() { return UseItemAction::isUseful() && AI_VALUE2(uint8
bool EatAction::isPossible()
{
return !bot->IsInCombat() && (sPlayerbotAIConfig->freeFood || UseItemAction::isPossible());
return !bot->IsInCombat() && (botAI->HasCheat(BotCheatMask::food) || UseItemAction::isPossible());
}

View File

@@ -11,13 +11,14 @@
void UseFoodStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
{
Strategy::InitTriggers(triggers);
if (sPlayerbotAIConfig->freeFood)
if (botAI->HasCheat(BotCheatMask::food))
{
triggers.push_back(new TriggerNode("medium health", NextAction::array(0, new NextAction("food", 3.0f), nullptr)));
else
triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("food", 3.0f), nullptr)));
if (sPlayerbotAIConfig->freeFood)
triggers.push_back(new TriggerNode("high mana", NextAction::array(0, new NextAction("drink", 3.0f), nullptr)));
}
else
{
triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("food", 3.0f), nullptr)));
triggers.push_back(new TriggerNode("low mana", NextAction::array(0, new NextAction("drink", 3.0f), nullptr)));
}
}

View File

@@ -249,7 +249,7 @@ bool AoeTrigger::IsActive()
bool NoFoodTrigger::IsActive()
{
bool isRandomBot = sRandomPlayerbotMgr->IsRandomBot(bot);
if (isRandomBot && sPlayerbotAIConfig->freeFood)
if (isRandomBot && botAI->HasCheat(BotCheatMask::food))
return false;
return AI_VALUE2(std::vector<Item*>, "inventory items", "conjured food").empty();
@@ -258,7 +258,7 @@ bool NoFoodTrigger::IsActive()
bool NoDrinkTrigger::IsActive()
{
bool isRandomBot = sRandomPlayerbotMgr->IsRandomBot(bot);
if (isRandomBot && sPlayerbotAIConfig->freeFood)
if (isRandomBot && botAI->HasCheat(BotCheatMask::food))
return false;
return AI_VALUE2(std::vector<Item*>, "inventory items", "conjured water").empty();