From 45c726a137a7673aeec31f4054769c3fcd11f405 Mon Sep 17 00:00:00 2001 From: ile <59745756+ileboii@users.noreply.github.com> Date: Thu, 19 Dec 2024 16:34:46 +0200 Subject: [PATCH] World Buffs: Implement timed in-game event based trigger * Fixed typo on focus heal targets Prevents bots with focus heal being stuck after the focus heal targets list is cleared. * World Buffs: Implement in-game event based buff trigger --- playerbot/PlayerbotAIConfig.cpp | 6 +++--- playerbot/PlayerbotAIConfig.h | 1 + playerbot/aiplayerbot.conf.dist.in | 4 +++- playerbot/strategy/actions/WorldBuffAction.cpp | 4 ++++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/playerbot/PlayerbotAIConfig.cpp b/playerbot/PlayerbotAIConfig.cpp index fba1e327..10e79ff7 100644 --- a/playerbot/PlayerbotAIConfig.cpp +++ b/playerbot/PlayerbotAIConfig.cpp @@ -462,10 +462,10 @@ bool PlayerbotAIConfig::Initialize() for (auto value : values) { std::vector ids = split(value, '.'); - std::vector params = { 0,0,0,0,0 }; + std::vector params = { 0,0,0,0,0,0 }; //Extract faction, class, spec, minlevel, maxlevel - for (uint8 i = 0; i < 5; i++) + for (uint8 i = 0; i < 6; i++) if (ids.size() > i + 2) params[i] = stoi(ids[i + 2]); @@ -476,7 +476,7 @@ bool PlayerbotAIConfig::Initialize() //Store buffs for later application. for (auto buff : buffs) { - worldBuff wb = { buff, params[0], params[1], params[2], params[3], params[4] }; + worldBuff wb = { buff, params[0], params[1], params[2], params[3], params[4], params[5] }; worldBuffs.push_back(wb); } diff --git a/playerbot/PlayerbotAIConfig.h b/playerbot/PlayerbotAIConfig.h index 2be7a55e..616870b4 100644 --- a/playerbot/PlayerbotAIConfig.h +++ b/playerbot/PlayerbotAIConfig.h @@ -341,6 +341,7 @@ class PlayerbotAIConfig uint32 specId = 0; uint32 minLevel = 0; uint32 maxLevel = 0; + uint32 eventId = 0; }; std::vector worldBuffs; diff --git a/playerbot/aiplayerbot.conf.dist.in b/playerbot/aiplayerbot.conf.dist.in index 5c0a1b52..16588153 100644 --- a/playerbot/aiplayerbot.conf.dist.in +++ b/playerbot/aiplayerbot.conf.dist.in @@ -678,7 +678,7 @@ AiPlayerbot.PremadeSpecName.11.9 = pvp dps balance (boomkin) AiPlayerbot.PremadeSpecLink.11.9.60 = 0143503002551351--5005021 # Applies a permanent buff to all bots. -# WorldBuff.Faction.Class.MinLevel.MaxLevel = spellId +# WorldBuff.Faction.Class.MinLevel.MaxLevel,EventID = spellId # All bots: Rallying Cry of the Dragonslayer for all bots # AiPlayerbot.WorldBuff = 22888 # All horde Warchief's Blessing for all horde @@ -689,6 +689,8 @@ AiPlayerbot.PremadeSpecLink.11.9.60 = 0143503002551351--5005021 # AiPlayerbot.WorldBuff.0.9.1.10 = 18149,3436 # All alliance lvl60 rogues Plainsrunning & Sprint & Speed # AiPlayerbot.WorldBuff.1.4.60 = 12566,11305,2379 +# Darkmoon Faire - Elwynn Forest Sayge's Dark Fortune of Damage +AiPlayerbot.WorldBuff.0.0.0.0.0.4 = 23768 # Prefix for bot chat commands (e.g. follow, stay) #AiPlayerbot.CommandPrefix = diff --git a/playerbot/strategy/actions/WorldBuffAction.cpp b/playerbot/strategy/actions/WorldBuffAction.cpp index 7492f62d..4f5049a4 100644 --- a/playerbot/strategy/actions/WorldBuffAction.cpp +++ b/playerbot/strategy/actions/WorldBuffAction.cpp @@ -2,6 +2,7 @@ #include "WorldBuffAction.h" #include "playerbot/AiFactory.h" #include "playerbot/PlayerbotAIConfig.h" +#include "GameEvents/GameEventMgr.h" using namespace ai; @@ -46,6 +47,9 @@ std::vector WorldBuffAction::NeedWorldBuffs(Unit* unit) if (wb.maxLevel != 0 && wb.maxLevel < unit->GetLevel()) continue; + if (wb.eventId != 0 && !sGameEventMgr.IsActiveEvent(wb.eventId)) + continue; + if (unit->HasAura(wb.spellId)) continue;