Merge pull request #1473 from Tierisch/master

Add option to remove 'healer dps' strategy based on specified map.
This commit is contained in:
kadeshar
2025-07-31 16:50:06 +02:00
committed by GitHub
6 changed files with 42 additions and 1 deletions

View File

@@ -809,6 +809,14 @@ AiPlayerbot.RandomBotNonCombatStrategies = ""
AiPlayerbot.CombatStrategies = "" AiPlayerbot.CombatStrategies = ""
AiPlayerbot.NonCombatStrategies = "" AiPlayerbot.NonCombatStrategies = ""
# Remove "healer dps" strategy on specified maps.
# Default: 0 (disabled)
AiPlayerbot.HealerDPSMapRestriction = 0
# List of Map IDs where "healer dps" strategy will be removed if AiPlayerbot.HealerDPSMapRestriction is enabled
# Default: (Dungeon and Raid maps) "33,34,36,43,47,48,70,90,109,129,209,229,230,329,349,389,429,1001,1004,1007,269,540,542,543,545,546,547,552,553,554,555,556,557,558,560,585,574,575,576,578,595,599,600,601,602,604,608,619,632,650,658,668,409,469,509,531,532,534,544,548,550,564,565,580,249,533,603,615,616,624,631,649,724"
AiPlayerbot.RestrictedHealerDPSMaps = "33,34,36,43,47,48,70,90,109,129,209,229,230,329,349,389,429,1001,1004,1007,269,540,542,543,545,546,547,552,553,554,555,556,557,558,560,585,574,575,576,578,595,599,600,601,602,604,608,619,632,650,658,668,409,469,509,531,532,534,544,548,550,564,565,580,249,533,603,615,616,624,631,649,724"
# #
# #
# #

View File

@@ -420,7 +420,8 @@ void AiFactory::AddDefaultCombatStrategies(Player* player, PlayerbotAI* const fa
{ {
if (sPlayerbotAIConfig->autoSaveMana) if (sPlayerbotAIConfig->autoSaveMana)
engine->addStrategy("save mana", false); engine->addStrategy("save mana", false);
engine->addStrategy("healer dps", false); if (!sPlayerbotAIConfig->IsRestrictedHealerDPSMap(player->GetMapId()))
engine->addStrategy("healer dps", false);
} }
if (facade->IsRealPlayer() || sRandomPlayerbotMgr->IsRandomBot(player)) if (facade->IsRealPlayer() || sRandomPlayerbotMgr->IsRandomBot(player))
{ {

View File

@@ -722,6 +722,7 @@ void PlayerbotAI::HandleTeleportAck()
// SetNextCheckDelay(urand(2000, 5000)); // SetNextCheckDelay(urand(2000, 5000));
if (sPlayerbotAIConfig->applyInstanceStrategies) if (sPlayerbotAIConfig->applyInstanceStrategies)
ApplyInstanceStrategies(bot->GetMapId(), true); ApplyInstanceStrategies(bot->GetMapId(), true);
EvaluateHealerDpsStrategy();
Reset(true); Reset(true);
} }
@@ -6407,3 +6408,14 @@ void PlayerbotAI::AddTimedEvent(std::function<void()> callback, uint32 delayMs)
// Every Player already owns an EventMap called m_Events // Every Player already owns an EventMap called m_Events
bot->m_Events.AddEvent(new LambdaEvent(std::move(callback)), bot->m_Events.CalculateTime(delayMs)); bot->m_Events.AddEvent(new LambdaEvent(std::move(callback)), bot->m_Events.CalculateTime(delayMs));
} }
void PlayerbotAI::EvaluateHealerDpsStrategy()
{
if (!IsHeal(bot, true))
return;
if (sPlayerbotAIConfig->IsRestrictedHealerDPSMap(bot->GetMapId()))
ChangeStrategy("-healer dps", BOT_STATE_COMBAT);
else
ChangeStrategy("+healer dps", BOT_STATE_COMBAT);
}

View File

@@ -401,6 +401,7 @@ public:
void ClearStrategies(BotState type); void ClearStrategies(BotState type);
std::vector<std::string> GetStrategies(BotState type); std::vector<std::string> GetStrategies(BotState type);
void ApplyInstanceStrategies(uint32 mapId, bool tellMaster = false); void ApplyInstanceStrategies(uint32 mapId, bool tellMaster = false);
void EvaluateHealerDpsStrategy();
bool ContainsStrategy(StrategyType type); bool ContainsStrategy(StrategyType type);
bool HasStrategy(std::string const name, BotState type); bool HasStrategy(std::string const name, BotState type);
BotState GetState() { return currentState; }; BotState GetState() { return currentState; };

View File

@@ -190,6 +190,15 @@ bool PlayerbotAIConfig::Initialize()
sConfigMgr->GetOption<int32>("AiPlayerbot.MaxRandomBotsPriceChangeInterval", 48 * HOUR); sConfigMgr->GetOption<int32>("AiPlayerbot.MaxRandomBotsPriceChangeInterval", 48 * HOUR);
randomBotJoinLfg = sConfigMgr->GetOption<bool>("AiPlayerbot.RandomBotJoinLfg", true); randomBotJoinLfg = sConfigMgr->GetOption<bool>("AiPlayerbot.RandomBotJoinLfg", true);
restrictHealerDPS = sConfigMgr->GetOption<bool>("AiPlayerbot.HealerDPSMapRestriction", false);
LoadList<std::vector<uint32>>(
sConfigMgr->GetOption<std::string>("AiPlayerbot.RestrictedHealerDPSMaps",
"33,34,36,43,47,48,70,90,109,129,209,229,230,329,349,389,429,1001,1004,"
"1007,269,540,542,543,545,546,547,552,553,554,555,556,557,558,560,585,574,"
"575,576,578,595,599,600,601,602,604,608,619,632,650,658,668,409,469,509,"
"531,532,534,544,548,550,564,565,580,249,533,603,615,616,624,631,649,724"),
restrictedHealerDPSMaps);
//////////////////////////// ICC //////////////////////////// ICC
EnableICCBuffs = sConfigMgr->GetOption<bool>("AiPlayerbot.EnableICCBuffs", true); EnableICCBuffs = sConfigMgr->GetOption<bool>("AiPlayerbot.EnableICCBuffs", true);
@@ -653,6 +662,12 @@ bool PlayerbotAIConfig::IsInPvpProhibitedArea(uint32 id)
return find(pvpProhibitedAreaIds.begin(), pvpProhibitedAreaIds.end(), id) != pvpProhibitedAreaIds.end(); return find(pvpProhibitedAreaIds.begin(), pvpProhibitedAreaIds.end(), id) != pvpProhibitedAreaIds.end();
} }
bool PlayerbotAIConfig::IsRestrictedHealerDPSMap(uint32 mapId) const
{
return restrictHealerDPS &&
std::find(restrictedHealerDPSMaps.begin(), restrictedHealerDPSMaps.end(), mapId) != restrictedHealerDPSMaps.end();
}
std::string const PlayerbotAIConfig::GetTimestampStr() std::string const PlayerbotAIConfig::GetTimestampStr()
{ {
time_t t = time(nullptr); time_t t = time(nullptr);

View File

@@ -402,6 +402,10 @@ public:
static std::vector<std::vector<uint32>> ParseTempTalentsOrder(uint32 cls, std::string temp_talents_order); static std::vector<std::vector<uint32>> ParseTempTalentsOrder(uint32 cls, std::string temp_talents_order);
static std::vector<std::vector<uint32>> ParseTempPetTalentsOrder(uint32 spec, std::string temp_talents_order); static std::vector<std::vector<uint32>> ParseTempPetTalentsOrder(uint32 spec, std::string temp_talents_order);
bool restrictHealerDPS = false;
std::vector<uint32> restrictedHealerDPSMaps;
bool IsRestrictedHealerDPSMap(uint32 mapId) const;
}; };
#define sPlayerbotAIConfig PlayerbotAIConfig::instance() #define sPlayerbotAIConfig PlayerbotAIConfig::instance()