fix(BG): clear stale WG fake at BG entry to prevent team desync#153
Merged
Merged
Conversation
OnBattlefieldPlayerLeaveZone stopped clearing the fake in azerothcore#147, and the deferred OnPlayerUpdateZone path added alongside azerothcore#148 has an InBattleground() guard that prevents the clear once the teleport lands on the BG map. The WG fake therefore persists into the BG, where it short-circuits both BalanceTeamsOnEntry (its IsPlayerFake guard) and SetFakeRaceAndMorph (same guard), and can desync bgTeamId from GetTeamId() -- most visibly when a player queues for a BG before WG war pops, gets faked Horde mid-queue, and lands on the Alliance queue-side with a Horde faction and visual. Clear any pre-existing fake at the top of ValidatePlayerForBG so the BG entry path re-evaluates against bgTeamId. The azerothcore#147 timing concern does not apply here -- Battlefield::HandlePlayerLeaveZone has already finished by the time Battleground::AddPlayer runs on the new map. Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Summary
OnBattlefieldPlayerLeaveZonestopped clearing it in fix(WG): defer ClearFakePlayer to OnPlayerUpdateZone #147, and the deferredOnPlayerUpdateZoneclear is blocked by theInBattleground()guard added alongside fix: regression introduced in my previous commit + add guard #148 once the teleport lands on the BG map.BalanceTeamsOnEntry(itsIsPlayerFakeguard) andSetFakeRaceAndMorph(same guard), and can desyncbgTeamIdfromGetTeamId(). The worst case: a real Alliance player queues for a BG before WG war pops, gets faked Horde mid-queue, and lands on the Alliance queue-side spawn with a Horde faction/visual — flag captures, faction checks, and graveyard assignment all disagree.ValidatePlayerForBGso the BG entry path re-evaluates againstbgTeamId. The fix(WG): defer ClearFakePlayer to OnPlayerUpdateZone #147 timing concern doesn't apply here —Battlefield::HandlePlayerLeaveZonehas already finished by the timeBattleground::AddPlayerruns on the new map.Test plan
SETTING_CFBG_RACEhonored if set),bgTeamIdmatchesGetTeamId().BalanceTeamsOnEntrydisabled (= 0): the fix still resolves the desync; player just doesn't get rebalanced (expected).🤖 Generated with Claude Code