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:
@@ -404,8 +404,11 @@ void Battlefield::EndBattle(bool endByTimer)
|
|||||||
else
|
else
|
||||||
DoPlaySoundToAll(BF_HORDE_WINS);
|
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);
|
sScriptMgr->OnBattlefieldWarEnd(this, endByTimer);
|
||||||
|
OnBattleEnd(endByTimer);
|
||||||
|
|
||||||
for (uint8 team = 0; team < PVP_TEAMS_COUNT; ++team)
|
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_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_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_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_ON_PLAYER_KILL, // 6 - fires in HandleKill for every player-kills-player event
|
||||||
BATTLEFIELDHOOK_END
|
BATTLEFIELDHOOK_END
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user