From 373dbbf95d05a00fb0988b6a7d195e86c455226a Mon Sep 17 00:00:00 2001 From: Kelsi Date: Tue, 10 Mar 2026 18:37:05 -0700 Subject: [PATCH] fix: use authoritative autocast state for pet action bar and correct tooltip labels - Use isPetSpellAutocast() instead of parsing the slot value high byte for autocast detection; the authoritative source is the SMSG_PET_SPELLS spell list activeFlags, not the action bar slot value. - Fix tooltip mapping: actionId==2 maps to "Follow", actionId==5 to "Attack", others to "Stay" (removed erroneous duplicate Follow case for actionId==4). - Update spellbook comment: TBC Spell.dbc has ~220+ fields (not ~167). --- src/ui/game_screen.cpp | 5 +++-- src/ui/spellbook_screen.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ui/game_screen.cpp b/src/ui/game_screen.cpp index f61d03cd..f66e6749 100644 --- a/src/ui/game_screen.cpp +++ b/src/ui/game_screen.cpp @@ -2068,7 +2068,8 @@ void GameScreen::renderPetFrame(game::GameHandler& gameHandler) { if (slotVal == 0) continue; uint32_t actionId = slotVal & 0x00FFFFFFu; - bool autocastOn = (slotVal & 0xFF000000u) == 0x80000000u; + // Use the authoritative autocast set from SMSG_PET_SPELLS spell list flags. + bool autocastOn = gameHandler.isPetSpellAutocast(actionId); ImGui::PushID(i); if (rendered > 0) ImGui::SameLine(0.0f, spacing); @@ -2117,7 +2118,7 @@ void GameScreen::renderPetFrame(game::GameHandler& gameHandler) { // Tooltip: show spell name or built-in command name. if (ImGui::IsItemHovered()) { const char* tip = builtinLabel - ? (actionId == 5 ? "Attack" : actionId == 4 ? "Follow" : actionId == 2 ? "Follow" : "Stay") + ? (actionId == 5 ? "Attack" : actionId == 2 ? "Follow" : "Stay") : nullptr; std::string spellNm; if (!tip && actionId > 5) { diff --git a/src/ui/spellbook_screen.cpp b/src/ui/spellbook_screen.cpp index 99af8c1f..08cdf0a0 100644 --- a/src/ui/spellbook_screen.cpp +++ b/src/ui/spellbook_screen.cpp @@ -45,7 +45,7 @@ void SpellbookScreen::loadSpellDBC(pipeline::AssetManager* assetManager) { } uint32_t fieldCount = dbc->getFieldCount(); - // Classic 1.12 Spell.dbc has 148 fields (Tooltip at index 147), TBC has ~167, WotLK has 234. + // Classic 1.12 Spell.dbc has 148 fields (Tooltip at index 147), TBC has ~220+ (SchoolMask at 215), 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");