Skip to content

Addon: [1.11.4] - MoP talent trees - #820

Merged
Xian55 merged 6 commits into
devfrom
feature/mop-talent-mapping
Jul 29, 2026
Merged

Xian55 merged 6 commits into
devfrom
feature/mop-talent-mapping

Conversation

@Xian55

@Xian55 Xian55 commented Jul 29, 2026 •

Copy link
Copy Markdown
Owner

Makes the talent page work on the legacy Mists of Pandaria client (5.4.8), where it previously threw on open and, once that was guarded, rendered nothing. Verified on a private server with a level 90 Hunter holding all six picks.

Nothing about MoP talents survived the pre-5.0 assumptions

5.0 replaced three per-class tabs of ranked talents with one per-class grid of six tiers, one pick each. Every layer still assumed the old shape, and each did so silently:

layer assumption consequence
TalentExtractor spells live in SpellRank_0..4 172 of 216 rows had no spell id - 5.0 rows carry it on SpellID
TalentExtractor class comes from TalentTab the ClassID column was ignored, so rows could not be attributed at all
TalentDB a class owns three tabs TalentTab ids are the specialisations on this client and no talent row references one, so it returned three empty trees
InitTalentQueue GetNumTalentTabs exists it does not; the addon sent no talents, so everything rendered unspent

The talent index is not the column

The near-miss worth recording. GetTalentRowSelectionInfo(tier) returns (boolean, talentIndex), and that index is the slot in the flat 18-talent grid, not the column. A level 90 with every tier taken reports:

tier 1..6  ->  1, 4, 8, 10, 13, 18

Used as columns, the arithmetic produces a uniquely misleading failure:

tier 1, index 1  -> hash 1010011 -> tier 1, col 1   correct, by coincidence (index 1 == column 1)
tier 5, index 13 -> hash 1050131 -> tier 5, col 3   accidental match -> WRONG talent displayed
tier 4, index 10 -> hash 1040101 -> tier 4, col 0   no match
tier 2/3/6       ->                 col 4 / 8 / 8   no match

One tier right, one tier confidently wrong, four missing. Picks now come from GetTalentInfo(index), which answers name, texture, tier, column, selected, available with tier and column already 1-based — no derivation, no assumption about grid ordering.

Respec

A respec picks different talents and the hashes of the old ones are never sent again, so nothing retired them and both sets showed at once. Each batch is now headed by QUEUE_COUNT_MARKER + count — the convention the spellbook and binding queues already use — and sent even when the count is zero, since unlearning everything must clear the set too.

TalentReader stages the batch and swaps it in whole rather than clearing on the header. One hash arrives per addon tick, and SPELLS_CHANGED resends a batch on every spell learnt, so clearing up front would leave Talents empty or half filled for as many frames as the batch is long and flip a Talent requirement false mid-combat. An incomplete batch never commits and the previous set stays live.

Frontend

Three allocations per render, the worst a closure per cell — FirstOrDefault's predicate captured tier/col, so a Cataclysm class allocated ~84 per render on top of the scans. Max(t => t.TierID) enumerated every tree every render; it is resolved once on load. Select((t, i) => (t, i)) became an indexed loop.

GetClassTalents is likewise allocation-free — the 5.0 grid is dense, so tier * 3 + column addresses its own slot and the result is ordered without a sort.

Wire format

Unchanged: tab * 1000000 + tier * 10000 + column * 10 + rank, with tab and rank pinned to 1. TalentDB.Update tries class first and falls back to the tab lookup, so the tab number is simply ignored on a 5.x client and every earlier client behaves exactly as before. It also no longer indexes with -1 when a talent is not found, which threw.

Testing

Level 90 Hunter, all six tiers taken: every tier renders the correct talent, verified against the MoP hunter grid (Posthaste / Narrow Escape / Crouching Tiger on tier 1 through Glaive Toss / Powershot / Barrage on tier 6). Respec confirmed to replace rather than accumulate. dotnet build clean, luac -p clean.

Pre-5.0 clients are untouched by construction: ClassID is zero on every one of their rows, which selects the tab path throughout.

Reference

🤖 Generated with Claude Code

Xian55 and others added 6 commits July 29, 2026 23:57
The extractor took spell ids from SpellRank_0..4 only. 5.0 rows leave those at
zero and carry the spell on SpellID, so 172 of the MoP table's 216 rows came out
with no spell at all - the reason the talent page rendered nothing for that
client even where a tab did resolve.

Those rows also identify their class on a ClassID column that was ignored, which
is what makes them resolvable: 5.0 replaced the three per-class tabs with one
per-class grid, and no talent row references a TalentTab id any more.

TalentTreeElement gains ClassID, zero on every pre-5.0 row, so the tab-based
path is untouched. Column 4 of the 5.x grid is filler pointing at spell 102052
"Dummy 5.0 Talent" for warrior, paladin and mage; it is not a talent and is
dropped, leaving 198 rows - 11 classes x 6 tiers x 3 columns.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
216 -> 198 rows, every one with a spell id and a class. Verified against the MoP
hunter grid: Posthaste / Narrow Escape / Crouching Tiger on tier 1 through Glaive
Toss / Powershot / Barrage on tier 6.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
TalentTab still exists on those clients but its ids are the specialisations, and
no talent row points at one - so the per-tab build handed back three empty trees
and the page threw out of Max() on the first of them.

Where ClassID is set, the class owns a single six-tier grid; the tab path stays
for everything earlier. Update tries class first, then falls back, so the tab
number the addon sends is simply ignored on a 5.x client.

The grid is dense - 18 for every class - so tier * 3 + column addresses its own
slot and the result comes out ordered without a sort. Only the returned array is
allocated: no LINQ iterators, no comparer, no intermediate buffer, and elements
are read through ref readonly. Data that does not fit the grid keeps source order
rather than landing out of bounds.

Update also no longer indexes talentTreeElements with -1 when a talent is not
found, which threw.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
InitTalentQueue bailed on 5.4.8: GetNumTalentTabs and GetNumTalents are gone,
so nothing was ever sent and the page showed every talent unspent.

Picks come from GetTalentInfo(index) over the flat 18-slot grid, which answers
name, texture, tier, column, selected, available with tier and column already
1-based. Not from GetTalentRowSelectionInfo: its second return is the talent's
INDEX, not its column - a level 90 with every tier taken reports 1, 4, 8, 10,
13, 18. Used as columns those make tier 1 look correct by coincidence (index 1
equals column 1), render tier 5 as the wrong talent (13 decodes to column 3) and
match nothing at all for the rest.

The wire format is unchanged - tab * 1000000 + tier * 10000 + column * 10 + rank
with tab and rank pinned to 1 - so TalentReader decodes it as before.

Each batch is now headed by QUEUE_COUNT_MARKER + count, the convention the
spellbook and binding queues already use, because a respec picks different
talents and the hashes of the old ones are never sent again: nothing else would
retire them and both sets showed at once. Sent even when the count is zero, since
unlearning everything has to clear the set too.

TalentReader stages the batch and swaps it in whole. Clearing on the header
instead would leave Talents empty or half filled for as many frames as the batch
is long - one hash arrives per addon tick - and SPELLS_CHANGED resends a batch on
every spell learnt, so a Talent requirement would flip false mid-combat. An
incomplete batch never commits and the previous set stays live. An addon older
than the header keeps the accumulating behaviour rather than showing nothing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Three allocations per render, the worst of them a closure per cell:
FirstOrDefault's predicate captured tier and col, so a Cataclysm class allocated
about 84 of them per render (3 trees x 7 tiers x 4 columns) on top of the linear
scan each already did. Now a static scan.

Max(t => t.TierID) enumerated every tree on every render and threw on an empty
one; it is resolved once when the trees load. Select((t, i) => (t, i)) built an
iterator and a tuple per render; an indexed for does not.

The bare `col <= 3` becomes a named MaxTalentColumns - pre-5.0 grids are 4 wide,
the 5.0 grid is 3, and the extra column simply finds nothing and renders a
placeholder.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Xian55 Xian55 added feature request This is a request for a new feature, or an expansion of an existing feature. bugfix This pull request fixes an issue. refactor This ticket concerns the possible simplification of code/data. enhancement This pull request implements a new feature. ai Artificial Intelligence tool has been contributed. labels Jul 29, 2026
@Xian55
Xian55 merged commit 7fd7459 into dev Jul 29, 2026
1 check passed
@Xian55
Xian55 deleted the feature/mop-talent-mapping branch July 29, 2026 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai Artificial Intelligence tool has been contributed. bugfix This pull request fixes an issue. enhancement This pull request implements a new feature. feature request This is a request for a new feature, or an expansion of an existing feature. refactor This ticket concerns the possible simplification of code/data.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant