Skip to content

feat(WG): lock players to their assigned team for the war#160

Merged
Nyeriah merged 1 commit into
azerothcore:masterfrom
Nyeriah:feat/wg-team-lock
Jun 3, 2026
Merged

feat(WG): lock players to their assigned team for the war#160
Nyeriah merged 1 commit into
azerothcore:masterfrom
Nyeriah:feat/wg-team-lock

Conversation

@Nyeriah

@Nyeriah Nyeriah commented Jun 3, 2026

Copy link
Copy Markdown
Member

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:

  • Native-team assignees were never recorded, so they were re-balanced on every join and could be flipped to the opposite faction.
  • Faked players reset once they left the zone (the fake is cleared in 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:

  • dropping out of the war and rejoining,
  • leaving and re-entering the zone,
  • relogging during the war.

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 (not Player*) keeps the lock valid across reconnects.

Config

Gated behind a new option CFBG.Battlefield.TeamLock.Enable (default 1, requires CFBG.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

  1. Enable CFBG.Enable, CFBG.Battlefield.Enable, and CFBG.Battlefield.TeamLock.Enable.
  2. Join a Wintergrasp war and note the assigned faction.
  3. Leave the war (and/or the zone, and/or relog) and rejoin the same war — the assigned faction should be unchanged.
  4. After the war ends, a new war should balance assignments freshly.

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>
@Nyeriah Nyeriah merged commit 5cbcdaa into azerothcore:master Jun 3, 2026
1 check passed
@Nyeriah Nyeriah deleted the feat/wg-team-lock branch June 3, 2026 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant