From f23b2ea2f6e3a52d80e658ac45d141a3c3bfa0e7 Mon Sep 17 00:00:00 2001 From: Gonzalo Date: Sat, 27 Sep 2025 08:06:16 -0300 Subject: [PATCH 1/2] fix: Optimize DrinkAction to check mana in isUseful instead of Execute (#1666) * fix: Optimize DrinkAction to check mana in isUseful instead of Execute - Move HasManaValue check from Execute to isUseful for better performance - Prevents non-mana classes from executing drink actions unnecessarily - Improves AI efficiency by early filtering in isUseful method Addresses reviewer feedback about HasManaValue usage optimization * Update NonCombatActions.cpp --------- Co-authored-by: bash <31279994+hermensbas@users.noreply.github.com> --- src/strategy/actions/NonCombatActions.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/strategy/actions/NonCombatActions.cpp b/src/strategy/actions/NonCombatActions.cpp index d3c49dec..262e0f20 100644 --- a/src/strategy/actions/NonCombatActions.cpp +++ b/src/strategy/actions/NonCombatActions.cpp @@ -13,10 +13,6 @@ bool DrinkAction::Execute(Event event) if (bot->IsInCombat()) return false; - bool hasMana = AI_VALUE2(bool, "has mana", "self target"); - if (!hasMana) - return false; - if (botAI->HasCheat(BotCheatMask::food)) { // if (bot->IsNonMeleeSpellCast(true)) @@ -54,7 +50,14 @@ bool DrinkAction::Execute(Event event) return UseItemAction::Execute(event); } -bool DrinkAction::isUseful() { return UseItemAction::isUseful() && AI_VALUE2(uint8, "mana", "self target") < 100; } +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() { From f5a6194808f5b8c6029d6aa6ed7af8de405d6837 Mon Sep 17 00:00:00 2001 From: Crow Date: Sat, 27 Sep 2025 13:31:06 -0500 Subject: [PATCH 2/2] Fixed some comments in the config (#1668) --- conf/playerbots.conf.dist | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/playerbots.conf.dist b/conf/playerbots.conf.dist index 4e76eb09..b4e715f9 100644 --- a/conf/playerbots.conf.dist +++ b/conf/playerbots.conf.dist @@ -519,7 +519,7 @@ AiPlayerbot.AutoGearScoreLimit = 0 # "taxi" (bots may use all flight paths, though they will not actually learn them) # "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 +# Default: food, taxi, and raid are enabled AiPlayerbot.BotCheats = "food,taxi,raid" # @@ -1603,10 +1603,10 @@ AiPlayerbot.PremadeSpecLink.11.6.80 = 05320021--230033312031500531353013251 # # -# Applies a permanent buff to all bots simulating effects of spells, flasks, food, runes, etc. +# Applies automatically refreshing buffs to bots simulating effects of spells, flasks, food, runes, etc. # Requires sending the command "nc +worldbuff" in chat to a bot (or a group of bots) to enable # Each entry in the matrix should be formatted as follows: Entry:FactionID,ClassID,SpecID,MinimumLevel,MaximumLevel:SpellID1,SpellID2,etc.; -# Use 0 for any field to make it agnostic (e.g., 0 for FactionID means the entry will apply buffs to either faction) +# FactionID may be set to 0 for the entry to apply buffs to bots of either faction # The default entries create a cross-faction list of level 80 buffs for each implemented pve spec from the "Premade Specs" section # The default entries may be deleted or modified, and new custom entries may be added