fix(WG): Restore fake faction immediately when war ends#139
Merged
Nyeriah merged 1 commit intoMay 8, 2026
Merged
Conversation
Add OnBattlefieldWarEnd hook to BattlefieldScript, called from Battlefield::EndBattle() after OnBattleEnd() completes. The module uses this to iterate its own _wgWarPlayers tracking and call ClearFakePlayer for each participant, since the core clears PlayersInWar in bulk with no per-player hook and players remaining in the zone never trigger OnBattlefieldPlayerLeaveZone. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes Proposed:
Fixes cross-faction players remaining disguised as the opposite faction after a Wintergrasp war ends, until they physically leave the zone or relog.
Root cause: When
Battlefield::EndBattle()fires,BattlefieldWG::OnBattleEnd()clearsPlayersInWarin bulk —OnBattlefieldPlayerLeaveWarnever fires per-player. Players who stay in the WG zone after war ends never triggerOnBattlefieldPlayerLeaveZoneeither. The fake race/faction set bySetFakeRaceAndMorphForBFtherefore persists indefinitely post-war.Fix: Subscribe to the new
OnBattlefieldWarEndhook (added in azerothcore-wotlk#25754). On war end, iterate the module's own_wgWarPlayerstracking (still populated since only the core'sPlayersInWarwas cleared) and callClearFakePlayerfor each participant, then clear the sets. The existingOnBattlefieldPlayerLeaveZonecatch-all remains as a safety net and becomes a no-op for this path.Requires: azerothcore-wotlk#25754 —
OnBattlefieldWarEndcore hook.AI-assisted Pull Requests
Claude Sonnet 4.6 (Claude Code) was used to diagnose the bug and author the fix.
Issues Addressed:
Tests Performed:
This PR has been:
How to Test the Changes:
.bf stop)Known Issues and TODO List: