Skip to content

fix(WG): re-apply crossfaction fake on resurrect#161

Merged
Nyeriah merged 2 commits into
azerothcore:masterfrom
Nyeriah:fix/wg-reapply-fake-on-resurrect
Jun 3, 2026
Merged

fix(WG): re-apply crossfaction fake on resurrect#161
Nyeriah merged 2 commits into
azerothcore:masterfrom
Nyeriah:fix/wg-reapply-fake-on-resurrect

Conversation

@Nyeriah

@Nyeriah Nyeriah commented Jun 3, 2026

Copy link
Copy Markdown
Member

What

Re-applies a crossfaction Wintergrasp player's fake faction and morph when they resurrect, so they don't revert to their native race/faction after the ghost→alive transition.

Why

A crossfaction WG player assigned to the opposite team is morphed via setRace / SetDisplayId / SetFaction (stored in _fakePlayerStore). The stored entry survives death, but the resurrection transition can leave the player showing their native race/faction. This re-pushes the stored fake values on resurrect.

How

  • New CFBG::ReapplyFakePlayer(Player*) re-applies the stored FakePlayer race/morph/faction (reuses the existing GetFakePlayer lookup and SetFactionForRace; idempotent).
  • Hooked from a new OnPlayerResurrect override in CFBG_Player. Player::ResurrectPlayer fires this on every resurrect path (corpse run, spirit-healer, soulstone), so a single hook covers all cases.
  • Gated to Wintergrasp only: enabled system + WG system + the player's zone resolving to a BATTLEFIELD_WG battlefield. Battleground fakes remain owned by the BG hooks and are untouched.

Config

New option CFBG.Battlefield.ReapplyOnResurrect.Enable (default 1) toggles the behaviour. Documented in CFBG.conf.dist, read in LoadConfig, and checked in the hook alongside the existing WG gates.

Pets / summons

SetFactionForRace already loops player->m_Controlled and re-syncs faction, so any controlled unit alive at resurrect time is covered. Pets re-summoned after resurrection inherit the owner's (fake) faction automatically via core's summon path.

Testing

C++ codestyle passes (apps/codestyle/codestyle-cpp.py).

Nyeriah and others added 2 commits June 2, 2026 23:06
A crossfaction WG player could lose their assigned faction/morph after
the ghost->alive transition, reverting to their native race. Re-push the
stored fake values on OnPlayerResurrect so the assigned faction and morph
survive resurrection.

Gated to WG fakes only (enabled system + WG system + player in a
BATTLEFIELD_WG zone); battleground fakes remain owned by the BG hooks.
SetFactionForRace also re-syncs any controlled pets/summons.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add CFBG.Battlefield.ReapplyOnResurrect.Enable (default 1) so the WG
resurrect re-apply can be disabled. Wired through LoadConfig and checked
in the OnPlayerResurrect hook alongside the existing WG gates.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Nyeriah Nyeriah merged commit 5a34d9a into azerothcore:master Jun 3, 2026
1 check passed
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