From f2b55804957221c15e88356dfbbf7705e6a1b411 Mon Sep 17 00:00:00 2001 From: IainD92 Date: Fri, 3 Oct 2025 10:56:16 +0100 Subject: [PATCH] Maintenance config for altbots (#1693) * Maintenance config controls bools in config * Update TrainerAction.cpp removed some note-to-selfs (personal config preferences) * Set default to true Also tidied up some comments * Update playerbots.conf.dist * Reorganised Changed the description in conf to be less conversational. Rearranged the order that options are arranged, grouping by what made sense to me (the type of gameplay made easier/skipped by the option being enabled). Rearranged the order the variables and method calls are listed in the code to match the order they are presented in the conf to make future maintenance of maintenance (:P) more intuitive. * Update playerbots.conf.dist Revert previous commit (change to call order in MaintenanceAction::Execute) conf settings grouped --- conf/playerbots.conf.dist | 28 +++++++ src/PlayerbotAIConfig.cpp | 21 +++++ src/PlayerbotAIConfig.h | 19 +++++ src/strategy/actions/TrainerAction.cpp | 103 ++++++++++++++++++++----- 4 files changed, 151 insertions(+), 20 deletions(-) diff --git a/conf/playerbots.conf.dist b/conf/playerbots.conf.dist index 19761738..bf576384 100644 --- a/conf/playerbots.conf.dist +++ b/conf/playerbots.conf.dist @@ -488,6 +488,34 @@ AiPlayerbot.RPWarningCooldown = 30 # Default: 1 (enabled) AiPlayerbot.MaintenanceCommand = 1 +# Enable/Disable specific maintenance command functionality for alt bots +# Disable to prevent players from giving free bags, spells, skill levels etc to their alt bots +# Default: 1 (enabled) +AiPlayerbot.AltMaintenanceAmmo = 1 +AiPlayerbot.AltMaintenanceFood = 1 +AiPlayerbot.AltMaintenanceReagents = 1 +AiPlayerbot.AltMaintenanceConsumables = 1 +AiPlayerbot.AltMaintenancePotions = 1 + +AiPlayerbot.AltMaintenanceBags = 1 +AiPlayerbot.AltMaintenanceMounts = 1 +AiPlayerbot.AltMaintenanceSkills = 1 + +AiPlayerbot.AltMaintenanceClassSpells = 1 # Spells from quests (tame/summon pets, totems, druid forms, etc) +AiPlayerbot.AltMaintenanceAvailableSpells = 1 # Spells learnable from trainer +AiPlayerbot.AltMaintenanceSpecialSpells = 1 # Leave DK starting area +AiPlayerbot.AltMaintenanceTalentTree = 1 +AiPlayerbot.AltMaintenanceGlyphs = 1 +AiPlayerbot.AltMaintenanceGemsEnchants = 1 + +AiPlayerbot.AltMaintenancePet = 1 +AiPlayerbot.AltMaintenancePetTalents = 1 + +AiPlayerbot.AltMaintenanceReputation = 1 +AiPlayerbot.AltMaintenanceAttunementQuests = 1 +AiPlayerbot.AltMaintenanceKeyring = 1 + + # Enable/Disable autogear command, which automatically upgrades bots' gear; the quality is limited by AutoGearQualityLimit and AutoGearScoreLimit # Default: 1 (enabled) AiPlayerbot.AutoGearCommand = 1 diff --git a/src/PlayerbotAIConfig.cpp b/src/PlayerbotAIConfig.cpp index 80cdeb97..0343be52 100644 --- a/src/PlayerbotAIConfig.cpp +++ b/src/PlayerbotAIConfig.cpp @@ -553,6 +553,27 @@ bool PlayerbotAIConfig::Initialize() addClassCommand = sConfigMgr->GetOption("AiPlayerbot.AddClassCommand", 1); addClassAccountPoolSize = sConfigMgr->GetOption("AiPlayerbot.AddClassAccountPoolSize", 50); maintenanceCommand = sConfigMgr->GetOption("AiPlayerbot.MaintenanceCommand", 1); + + altMaintenanceAttunementQs = sConfigMgr->GetOption("AiPlayerbot.AltMaintenanceAttunementQuests", true); + altMaintenanceBags = sConfigMgr->GetOption("AiPlayerbot.AltMaintenanceBags", true); + altMaintenanceAmmo = sConfigMgr->GetOption("AiPlayerbot.AltMaintenanceAmmo", true); + altMaintenanceFood = sConfigMgr->GetOption("AiPlayerbot.AltMaintenanceFood", true); + altMaintenanceReagents = sConfigMgr->GetOption("AiPlayerbot.AltMaintenanceReagents", true); + altMaintenanceConsumables = sConfigMgr->GetOption("AiPlayerbot.AltMaintenanceConsumables", true); + altMaintenancePotions = sConfigMgr->GetOption("AiPlayerbot.AltMaintenancePotions", true); + altMaintenanceTalentTree = sConfigMgr->GetOption("AiPlayerbot.AltMaintenanceTalentTree", true); + altMaintenancePet = sConfigMgr->GetOption("AiPlayerbot.AltMaintenancePet", true); + altMaintenancePetTalents = sConfigMgr->GetOption("AiPlayerbot.AltMaintenancePetTalents", true); + altMaintenanceClassSpells = sConfigMgr->GetOption("AiPlayerbot.AltMaintenanceClassSpells", true); + altMaintenanceAvailableSpells = sConfigMgr->GetOption("AiPlayerbot.AltMaintenanceAvailableSpells", true); + altMaintenanceSkills = sConfigMgr->GetOption("AiPlayerbot.AltMaintenanceSkills", true); + altMaintenanceReputation = sConfigMgr->GetOption("AiPlayerbot.AltMaintenanceReputation", true); + altMaintenanceSpecialSpells = sConfigMgr->GetOption("AiPlayerbot.AltMaintenanceSpecialSpells", true); + altMaintenanceMounts = sConfigMgr->GetOption("AiPlayerbot.AltMaintenanceMounts", true); + altMaintenanceGlyphs = sConfigMgr->GetOption("AiPlayerbot.AltMaintenanceGlyphs", true); + altMaintenanceKeyring = sConfigMgr->GetOption("AiPlayerbot.AltMaintenanceKeyring", true); + altMaintenanceGemsEnchants = sConfigMgr->GetOption("AiPlayerbot.AltMaintenanceGemsEnchants", true); + autoGearCommand = sConfigMgr->GetOption("AiPlayerbot.AutoGearCommand", 1); autoGearCommandAltBots = sConfigMgr->GetOption("AiPlayerbot.AutoGearCommandAltBots", 1); autoGearQualityLimit = sConfigMgr->GetOption("AiPlayerbot.AutoGearQualityLimit", 3); diff --git a/src/PlayerbotAIConfig.h b/src/PlayerbotAIConfig.h index e7b404d8..c20f16dd 100644 --- a/src/PlayerbotAIConfig.h +++ b/src/PlayerbotAIConfig.h @@ -393,6 +393,25 @@ public: int32 addClassCommand; int32 addClassAccountPoolSize; int32 maintenanceCommand; + bool altMaintenanceAttunementQs, + altMaintenanceBags, + altMaintenanceAmmo, + altMaintenanceFood, + altMaintenanceReagents, + altMaintenanceConsumables, + altMaintenancePotions, + altMaintenanceTalentTree, + altMaintenancePet, + altMaintenancePetTalents, + altMaintenanceClassSpells, + altMaintenanceAvailableSpells, + altMaintenanceSkills, + altMaintenanceReputation, + altMaintenanceSpecialSpells, + altMaintenanceMounts, + altMaintenanceGlyphs, + altMaintenanceKeyring, + altMaintenanceGemsEnchants; int32 autoGearCommand, autoGearCommandAltBots, autoGearQualityLimit, autoGearScoreLimit; uint32 useGroundMountAtMinLevel; diff --git a/src/strategy/actions/TrainerAction.cpp b/src/strategy/actions/TrainerAction.cpp index 2de9d283..c5509cf8 100644 --- a/src/strategy/actions/TrainerAction.cpp +++ b/src/strategy/actions/TrainerAction.cpp @@ -170,26 +170,89 @@ bool MaintenanceAction::Execute(Event event) botAI->TellMaster("I'm maintaining"); PlayerbotFactory factory(bot, bot->GetLevel()); - factory.InitAttunementQuests(); - factory.InitBags(false); - factory.InitAmmo(); - factory.InitFood(); - factory.InitReagents(); - factory.InitConsumables(); - factory.InitPotions(); - factory.InitTalentsTree(true); - factory.InitPet(); - factory.InitPetTalents(); - factory.InitClassSpells(); - factory.InitAvailableSpells(); - factory.InitSkills(); - factory.InitReputation(); - factory.InitSpecialSpells(); - factory.InitMounts(); - factory.InitGlyphs(false); - factory.InitKeyring(); - if (bot->GetLevel() >= sPlayerbotAIConfig->minEnchantingBotLevel) - factory.ApplyEnchantAndGemsNew(); + + if (!botAI->IsAlt()) + { + factory.InitAttunementQuests(); + factory.InitBags(false); + factory.InitAmmo(); + factory.InitFood(); + factory.InitReagents(); + factory.InitConsumables(); + factory.InitPotions(); + factory.InitTalentsTree(true); + factory.InitPet(); + factory.InitPetTalents(); + factory.InitClassSpells(); + factory.InitAvailableSpells(); + factory.InitSkills(); + factory.InitReputation(); + factory.InitSpecialSpells(); + factory.InitMounts(); + factory.InitGlyphs(false); + factory.InitKeyring(); + if (bot->GetLevel() >= sPlayerbotAIConfig->minEnchantingBotLevel) + factory.ApplyEnchantAndGemsNew(); + } + else + { + if (sPlayerbotAIConfig->altMaintenanceAttunementQs) + factory.InitAttunementQuests(); + + if (sPlayerbotAIConfig->altMaintenanceBags) + factory.InitBags(false); + + if (sPlayerbotAIConfig->altMaintenanceAmmo) + factory.InitAmmo(); + + if (sPlayerbotAIConfig->altMaintenanceFood) + factory.InitFood(); + + if (sPlayerbotAIConfig->altMaintenanceReagents) + factory.InitReagents(); + + if (sPlayerbotAIConfig->altMaintenanceConsumables) + factory.InitConsumables(); + + if (sPlayerbotAIConfig->altMaintenancePotions) + factory.InitPotions(); + + if (sPlayerbotAIConfig->altMaintenanceTalentTree) + factory.InitTalentsTree(true); + + if (sPlayerbotAIConfig->altMaintenancePet) + factory.InitPet(); + + if (sPlayerbotAIConfig->altMaintenancePetTalents) + factory.InitPetTalents(); + + if (sPlayerbotAIConfig->altMaintenanceClassSpells) + factory.InitClassSpells(); + + if (sPlayerbotAIConfig->altMaintenanceAvailableSpells) + factory.InitAvailableSpells(); + + if (sPlayerbotAIConfig->altMaintenanceSkills) + factory.InitSkills(); + + if (sPlayerbotAIConfig->altMaintenanceReputation) + factory.InitReputation(); + + if (sPlayerbotAIConfig->altMaintenanceSpecialSpells) + factory.InitSpecialSpells(); + + if (sPlayerbotAIConfig->altMaintenanceMounts) + factory.InitMounts(); + + if (sPlayerbotAIConfig->altMaintenanceGlyphs) + factory.InitGlyphs(false); + + if (sPlayerbotAIConfig->altMaintenanceKeyring) + factory.InitKeyring(); + + if (sPlayerbotAIConfig->altMaintenanceGemsEnchants && bot->GetLevel() >= sPlayerbotAIConfig->minEnchantingBotLevel) + factory.ApplyEnchantAndGemsNew(); + } bot->DurabilityRepairAll(false, 1.0f, false); bot->SendTalentsInfoData(false);