diff --git a/include/game/spell_handler.hpp b/include/game/spell_handler.hpp index 2201fcd3..e93e58ed 100644 --- a/include/game/spell_handler.hpp +++ b/include/game/spell_handler.hpp @@ -307,6 +307,7 @@ private: // Spell book tabs std::vector spellBookTabs_; + size_t lastSpellCount_ = 0; bool spellBookTabsDirty_ = true; // Talent wipe confirm dialog diff --git a/src/game/spell_handler.cpp b/src/game/spell_handler.cpp index 8b1a16ca..a3d86c69 100644 --- a/src/game/spell_handler.cpp +++ b/src/game/spell_handler.cpp @@ -547,10 +547,12 @@ void SpellHandler::useItemById(uint32_t itemId) { } const std::vector& SpellHandler::getSpellBookTabs() { - static size_t lastSpellCount = 0; - if (lastSpellCount == knownSpells_.size() && !spellBookTabsDirty_) + // Must be an instance member, not static — a static is shared across all + // SpellHandler instances, so switching characters with the same spell count + // would skip the rebuild and return the previous character's tabs. + if (lastSpellCount_ == knownSpells_.size() && !spellBookTabsDirty_) return spellBookTabs_; - lastSpellCount = knownSpells_.size(); + lastSpellCount_ = knownSpells_.size(); spellBookTabsDirty_ = false; spellBookTabs_.clear();