feat(WG): lock players to their assigned team for the war#160
Merged
Conversation
Wintergrasp cross-faction players could re-roll their faction by dropping out of the war and rejoining: the balance was recomputed on every OnBattlefieldPlayerJoinWar, and only already-faked players were guarded. Native-team assignees were never recorded, and faked players reset once they left the zone. Record each player's first WG assignment in a GUID-keyed, per-war store and reuse it on subsequent joins, so the team survives leaving the war/zone and relog. The store is cleared when the war ends. Gated behind CFBG.Battlefield.TeamLock.Enable (default 1); when disabled, every join re-balances as before. Co-Authored-By: Claude Opus 4.8 <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
Locks a Wintergrasp cross-faction player to the team they were first assigned for the duration of a war.
Previously, players could re-roll their faction by dropping out of the war and rejoining. Team assignment was recomputed on every
OnBattlefieldPlayerJoinWar, and the only guard skipped already-faked players. That left two gaps:OnPlayerUpdateZone), so re-entering and re-queuing re-rolled them too.Fix
A GUID-keyed, per-war assignment store records each player's first WG team. On subsequent joins the stored team is reused instead of re-balancing, so the assignment survives:
The store is cleared when the war ends (in
OnBattlefieldWarEnd), so the next war balances from scratch and stale entries can't accumulate. GUID keying (notPlayer*) keeps the lock valid across reconnects.Config
Gated behind a new option
CFBG.Battlefield.TeamLock.Enable(default1, requiresCFBG.Battlefield.Enable = 1). When disabled, every join re-balances exactly as before.Issues Addressed
Players being reassigned to a different team after leaving and rejoining a Wintergrasp war.
Tests Performed
C++ codestyle (
apps/codestyle/codestyle-cpp.py) passes. Not yet runtime-tested in-game.How to Test the Changes
CFBG.Enable,CFBG.Battlefield.Enable, andCFBG.Battlefield.TeamLock.Enable.