Skip to content

Commit

Permalink
Remove world buffs when the strategy gets removed
Browse files Browse the repository at this point in the history
  • Loading branch information
davidonete committed Apr 7, 2024
1 parent e1d94ef commit 0e83bda
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions playerbot/strategy/generic/NonCombatStrategy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,19 @@ void WorldBuffStrategy::InitNonCombatTriggers(std::list<TriggerNode*>& triggers)
"need world buff",
NextAction::array(0, new NextAction("world buff", 1.0f), NULL)));
}

void WorldBuffStrategy::OnStrategyRemoved(BotState state)
{
// Remove world buffs
Player* bot = ai->GetBot();
if (bot)
{
for (auto& wb : sPlayerbotAIConfig.worldBuffs)
{
if (bot->HasAura(wb.spellId))
{
bot->RemoveAurasDueToSpell(wb.spellId);
}
}
}
}
1 change: 1 addition & 0 deletions playerbot/strategy/generic/NonCombatStrategy.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,6 @@ namespace ai

protected:
virtual void InitNonCombatTriggers(std::list<TriggerNode*>& triggers) override;
void OnStrategyRemoved(BotState state) override;
};
}

0 comments on commit 0e83bda

Please sign in to comment.