refactor(Core/Battlefield): fire OnBattlefieldWarEnd before OnBattleEnd (#26030)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Andrew
2026-05-30 19:45:51 -03:00
committed by GitHub
parent 2b932e5cb0
commit 919eefef7e
2 changed files with 5 additions and 2 deletions
+4 -1
View File
@@ -404,8 +404,11 @@ void Battlefield::EndBattle(bool endByTimer)
else
DoPlaySoundToAll(BF_HORDE_WINS);
OnBattleEnd(endByTimer);
// Hook runs BEFORE OnBattleEnd so subscribers can read PlayersInWar
// while it is still populated (OnBattleEnd hands out rewards and then
// clears the set).
sScriptMgr->OnBattlefieldWarEnd(this, endByTimer);
OnBattleEnd(endByTimer);
for (uint8 team = 0; team < PVP_TEAMS_COUNT; ++team)
{
@@ -28,7 +28,7 @@ enum BattlefieldHook
BATTLEFIELDHOOK_ON_PLAYER_JOIN_WAR, // 2 - fires after player is added to the active war
BATTLEFIELDHOOK_ON_PLAYER_LEAVE_WAR, // 3 - fires after player is removed from the active war
BATTLEFIELDHOOK_BEFORE_INVITE_PLAYER_TO_WAR, // 4 - fires in InvitePlayerToWar before InvitedPlayers insert
BATTLEFIELDHOOK_ON_WAR_END, // 5 - fires in EndBattle after OnBattleEnd(), before timer reset
BATTLEFIELDHOOK_ON_WAR_END, // 5 - fires in EndBattle before OnBattleEnd(), while PlayersInWar is still populated
BATTLEFIELDHOOK_ON_PLAYER_KILL, // 6 - fires in HandleKill for every player-kills-player event
BATTLEFIELDHOOK_END
};