Skip to content

Commit

Permalink
World Buffs: Implement timed in-game event based trigger
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
ileboii authored Dec 19, 2024
1 parent 4217781 commit 45c726a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
6 changes: 3 additions & 3 deletions playerbot/PlayerbotAIConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,10 +462,10 @@ bool PlayerbotAIConfig::Initialize()
for (auto value : values)
{
std::vector<std::string> ids = split(value, '.');
std::vector<uint32> params = { 0,0,0,0,0 };
std::vector<uint32> 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]);

Expand All @@ -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);
}

Expand Down
1 change: 1 addition & 0 deletions playerbot/PlayerbotAIConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ class PlayerbotAIConfig
uint32 specId = 0;
uint32 minLevel = 0;
uint32 maxLevel = 0;
uint32 eventId = 0;
};

std::vector<worldBuff> worldBuffs;
Expand Down
4 changes: 3 additions & 1 deletion playerbot/aiplayerbot.conf.dist.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

This comment has been minimized.

Copy link
@Exxenoz

Exxenoz Dec 19, 2024

Member

Missing # and the other config files (aiplayerbot.conf.dist.in.tbc & aiplayerbot.conf.dist.in.wotlk should be updated too.

This comment has been minimized.

Copy link
@ileboii

ileboii Dec 19, 2024

Author Contributor

Good catch, thanks! I'll make another PR momentarily.


# Prefix for bot chat commands (e.g. follow, stay)
#AiPlayerbot.CommandPrefix =
Expand Down
4 changes: 4 additions & 0 deletions playerbot/strategy/actions/WorldBuffAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "WorldBuffAction.h"
#include "playerbot/AiFactory.h"
#include "playerbot/PlayerbotAIConfig.h"
#include "GameEvents/GameEventMgr.h"

using namespace ai;

Expand Down Expand Up @@ -46,6 +47,9 @@ std::vector<uint32> 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;

Expand Down

0 comments on commit 45c726a

Please sign in to comment.