Repository navigation
Addon: [1.11.4] - MoP talent trees - #820
Merged
Merged
Conversation
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>
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.
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:
TalentExtractorSpellRank_0..4SpellIDTalentExtractorTalentTabClassIDcolumn was ignored, so rows could not be attributed at allTalentDBTalentTabids are the specialisations on this client and no talent row references one, so it returned three empty treesInitTalentQueueGetNumTalentTabsexistsThe 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:Used as columns, the arithmetic produces a uniquely misleading failure:
One tier right, one tier confidently wrong, four missing. Picks now come from
GetTalentInfo(index), which answersname, texture, tier, column, selected, availablewith 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.TalentReaderstages the batch and swaps it in whole rather than clearing on the header. One hash arrives per addon tick, andSPELLS_CHANGEDresends a batch on every spell learnt, so clearing up front would leaveTalentsempty or half filled for as many frames as the batch is long and flip aTalentrequirement 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 capturedtier/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.GetClassTalentsis likewise allocation-free — the 5.0 grid is dense, sotier * 3 + columnaddresses 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.Updatetries 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-1when 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 buildclean,luac -pclean.Pre-5.0 clients are untouched by construction:
ClassIDis zero on every one of their rows, which selects the tab path throughout.Reference
🤖 Generated with Claude Code