Skip to content

[Decomp][Player] Extract SpellCooldownMgr and PetMgr from Player.cpp#424

Merged
billy1arm merged 1 commit into
mangoszero:masterfrom
r-log:decomp/m0-managers
Jul 4, 2026
Merged

[Decomp][Player] Extract SpellCooldownMgr and PetMgr from Player.cpp#424
billy1arm merged 1 commit into
mangoszero:masterfrom
r-log:decomp/m0-managers

Conversation

@r-log

@r-log r-log commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Ports the MangosTwo/MangosOne manager extractions to MangosZero (vanilla 1.12.x), mirroring mangostwo#234 and the mangosone managers PR. Lifts two cohesive concerns out of the Player god object into dedicated managers held by value on Player, with Player keeping its full public API as inline delegators so no external call site changes.

SpellCooldownMgr (SpellCooldownMgr.{h,cpp}) — owns the spell-cooldown map + its load/save/apply lifecycle. The SpellCooldown struct + SpellCooldowns typedef move to the manager header.

PetMgr (PetMgr.{h,cpp}) — owns the stable-slot count and the temporary-unsummon pet number. The Pet creature itself and the stable opcode handlers are untouched; they route through GetStableSlots()/SetStableSlots().

Mechanics: new XxxMgr with a Player* back-pointer; state + logic moved in with Player::XxxMgr::, thism_owner, member reads renamed; Player.h gets the include + a by-value member + inline delegators keeping the original method names/signatures; state members and out-of-line bodies removed from Player; ctor init-list gains m_spellCooldownMgr(this)/m_petMgr(this) in member-declaration order; direct readers that stay behind are rewired (SendInitialSpellsGetSpellCooldownMap(), NPCHandler stable code → GetStableSlots()/SetStableSlots()).

Vanilla bodies, not WotLK. Bodies are extracted from Zero's own Player:: code — e.g. PetMgr::UnsummonTemporaryIfAny keeps Zero's transport-passenger removal block; SpellCooldownMgr keeps the vanilla cat == 76 || cat == 351 ranged check and has no arena-cooldown method.

HonorMgr intentionally NOT ported. Vanilla honor is the classic contribution-point ranking system (m_honorCP list + m_honor_rank/m_highest_rank + m_rank_points/m_stored_honor/stored kills + AddHonorCP/UpdateHonor/_LoadHonorCP/_SaveHonorCP) — a different domain from the honor-points HonorMgr the siblings extracted (UpdateKills/Reward). Forcing that shape would be a redesign, not a port, so it is skipped (same expansion-delta category as Glyph/Rune managers being N/A here).

Built green with MSVC 2022 (game target), Eluna on and off.


This change is Reviewable

@codacy-production

codacy-production Bot commented Jul 2, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 759 complexity · 17 duplication

Metric Results
Complexity 759
Duplication 17

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@AppVeyorBot

Copy link
Copy Markdown

@r-log r-log force-pushed the decomp/m0-managers branch from d9d2af0 to b71f2c1 Compare July 4, 2026 11:01
@billy1arm billy1arm merged commit bfaf638 into mangoszero:master Jul 4, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants