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).
This commit is contained in:
Kelsi 2026-03-10 18:37:05 -07:00
parent 2e38a9af65
commit 373dbbf95d
2 changed files with 4 additions and 3 deletions

View file

@ -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) {

View file

@ -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");