From 2f3f9f1a21dc9c9b624f15fb923e875c14e0019d Mon Sep 17 00:00:00 2001 From: Kelsi Date: Tue, 10 Mar 2026 17:53:17 -0700 Subject: [PATCH] fix: enable Classic/Turtle Spell.dbc loading and add WotLK optional spell fields to layout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lower fieldCount threshold from 154→148 so Classic 1.12 and Turtle WoW Spell.dbc (148 fields, Tooltip at index 147) are accepted by the spellbook loader instead of being silently skipped. Add PowerType/ManaCost/CastingTimeIndex/RangeIndex to the WotLK dbc_layouts.json Spell section so mana cost, cast time, and range continue to display correctly when the DBC layout path is active (the old hardcoded-index fallback path is now bypassed since layout-path loads spell names first and spellData.empty() is no longer true). --- Data/expansions/wotlk/dbc_layouts.json | 3 ++- src/ui/spellbook_screen.cpp | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Data/expansions/wotlk/dbc_layouts.json b/Data/expansions/wotlk/dbc_layouts.json index 5b500741..d802b540 100644 --- a/Data/expansions/wotlk/dbc_layouts.json +++ b/Data/expansions/wotlk/dbc_layouts.json @@ -1,7 +1,8 @@ { "Spell": { "ID": 0, "Attributes": 4, "IconID": 133, - "Name": 136, "Tooltip": 139, "Rank": 153, "SchoolMask": 225 + "Name": 136, "Tooltip": 139, "Rank": 153, "SchoolMask": 225, + "PowerType": 14, "ManaCost": 39, "CastingTimeIndex": 47, "RangeIndex": 49 }, "ItemDisplayInfo": { "ID": 0, "LeftModel": 1, "LeftModelTexture": 3, diff --git a/src/ui/spellbook_screen.cpp b/src/ui/spellbook_screen.cpp index eec714b9..38c01fe8 100644 --- a/src/ui/spellbook_screen.cpp +++ b/src/ui/spellbook_screen.cpp @@ -45,8 +45,10 @@ void SpellbookScreen::loadSpellDBC(pipeline::AssetManager* assetManager) { } uint32_t fieldCount = dbc->getFieldCount(); - if (fieldCount < 154) { - LOG_WARNING("Spellbook: Spell.dbc has ", fieldCount, " fields, expected 234+"); + // Classic 1.12 Spell.dbc has 148 fields (Tooltip at index 147), TBC has ~167, WotLK has 234. + // Require at least 148 fields so all expansions can load spell names/icons via the DBC layout. + if (fieldCount < 148) { + LOG_WARNING("Spellbook: Spell.dbc has ", fieldCount, " fields, too few to load"); return; }