- 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

@@ -174,10 +174,6 @@ AiPlayerbot.SummonWhenGroup = 1
# Selfbot permission level (0 = disabled, 1 = GM only (default), 2 = all players, 3 = activate on login)
AiPlayerbot.SelfBotLevel = 1
# Give free food to bots
# Default: 1 (enabled)
AiPlayerbot.FreeFood = 1
# Non-GM player can only use init=auto to initialize bots based on their own level and gearscore
# Default: 0 (non-GM player can use any intialization commands)
AiPlayerbot.AutoInitOnly = 0
@@ -496,6 +492,7 @@ AiPlayerbot.AutoGearQualityLimit = 3
AiPlayerbot.AutoGearScoreLimit = 0
# Enable/Disable cheats for bots
# "food" (bots use cheat when eat or drink)
# "gold" (bots have infinite gold)
# "health" (bots have infinite health)
# "mana" (bots have infinite mana)
@@ -504,7 +501,7 @@ AiPlayerbot.AutoGearScoreLimit = 0
# "raid" (bots use cheats implemented into raid strategies)
# To use multiple cheats, separate them by commas below (e.g., to enable all, use "gold,health,mana,power,raid,taxi")
# Default: taxi and raid are enabled
AiPlayerbot.BotCheats = "taxi,raid"
AiPlayerbot.BotCheats = "food,taxi,raid"
#
#

View File

@@ -462,11 +462,13 @@ bool PlayerbotAIConfig::Initialize()
}
botCheats.clear();
LoadListString<std::vector<std::string>>(sConfigMgr->GetOption<std::string>("AiPlayerbot.BotCheats", "taxi,raid"),
LoadListString<std::vector<std::string>>(sConfigMgr->GetOption<std::string>("AiPlayerbot.BotCheats", "food,taxi,raid"),
botCheats);
botCheatMask = 0;
if (std::find(botCheats.begin(), botCheats.end(), "food") != botCheats.end())
botCheatMask |= (uint32)BotCheatMask::food;
if (std::find(botCheats.begin(), botCheats.end(), "taxi") != botCheats.end())
botCheatMask |= (uint32)BotCheatMask::taxi;
if (std::find(botCheats.begin(), botCheats.end(), "gold") != botCheats.end())
@@ -598,7 +600,6 @@ bool PlayerbotAIConfig::Initialize()
RpgStatusProbWeight[RPG_REST] = sConfigMgr->GetOption<int32>("AiPlayerbot.RpgStatusProbWeight.Rest", 5);
syncLevelWithPlayers = sConfigMgr->GetOption<bool>("AiPlayerbot.SyncLevelWithPlayers", false);
freeFood = sConfigMgr->GetOption<bool>("AiPlayerbot.FreeFood", true);
randomBotGroupNearby = sConfigMgr->GetOption<bool>("AiPlayerbot.RandomBotGroupNearby", true);
// arena

View File

@@ -23,7 +23,8 @@ enum class BotCheatMask : uint32
mana = 8,
power = 16,
raid = 32,
maxMask = 64
food = 64,
maxMask = 128
};
enum class HealingManaEfficiency : uint8
@@ -340,7 +341,6 @@ public:
bool enableNewRpgStrategy;
std::unordered_map<NewRpgStatus, uint32> RpgStatusProbWeight;
bool syncLevelWithPlayers;
bool freeFood;
bool autoLearnQuestSpells;
bool autoTeleportForLevel;
bool randomBotGroupNearby;

View File

@@ -3244,7 +3244,7 @@ std::vector<uint32> PlayerbotFactory::GetCurrentGemsCount()
void PlayerbotFactory::InitFood()
{
if (sPlayerbotAIConfig->freeFood)
if (!botAI->HasCheat(BotCheatMask::food))
{
return;
}

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