mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 16:10:36 +00:00
Previously it only read the local player's talent tree (the engine's runtime per-tab arrays at VAR_TALENT_TAB_INFO_ARRAY, built only for the player's class). Addons that want another class's talent IDs -- build tooling, spec previews -- had no way to get them. Add an optional 3rd arg: nil/omitted keeps the runtime path (player's class, unchanged); a numeric classID resolves against the Talent.dbc / TalentTab.dbc flat arrays instead, so any class works. Ordering matches the player-class path exactly because it replicates the engine's tree builder FUN_004f2c00: tabs taken from TalentTab.dbc in row order filtered by classMask (+0x30; mask 0 = all, race not a factor -- FUN_004f2e50 is a plain bitmask test), then talents from Talent.dbc in row order within each TabID. The runtime arrays are built from that same walk, so GetTalentIDByIndex(t,i) == GetTalentIDByIndex(t,i,<player class>). New Offsets: the flat (row-order) DBC array globals the builder uses (VAR_TALENTTAB_DBC_FLAT_* / VAR_TALENT_DBC_FLAT_*), distinct from the sparse by-ID index SetTalentByID uses. Verified in-game: own-class parity (166 == 166), Mage (8) tabs 1/2/3 first talents = 37/1/18, and out-of-range tab/index/class all return nil with no fault.