mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
fix: clear action bar slots when spells are removed or unlearned
SMSG_REMOVED_SPELL and SMSG_SEND_UNLEARN_SPELLS both erased spells from knownSpells but left stale references on the action bar. After a respec or forced spell removal, action bar buttons would show removed talents and spells as still present. Now both handlers clear matching slots and persist the updated bar layout.
This commit is contained in:
parent
d9b9d1d2f2
commit
c58fc3073f
1 changed files with 18 additions and 0 deletions
|
|
@ -16565,6 +16565,16 @@ void GameHandler::handleRemovedSpell(network::Packet& packet) {
|
|||
uint32_t spellId = classicSpellId ? packet.readUInt16() : packet.readUInt32();
|
||||
knownSpells.erase(spellId);
|
||||
LOG_INFO("Removed spell: ", spellId);
|
||||
|
||||
// Clear any action bar slots referencing this spell
|
||||
bool barChanged = false;
|
||||
for (auto& slot : actionBar) {
|
||||
if (slot.type == ActionBarSlot::SPELL && slot.id == spellId) {
|
||||
slot = ActionBarSlot{};
|
||||
barChanged = true;
|
||||
}
|
||||
}
|
||||
if (barChanged) saveCharacterConfig();
|
||||
}
|
||||
|
||||
void GameHandler::handleSupercededSpell(network::Packet& packet) {
|
||||
|
|
@ -16622,11 +16632,19 @@ void GameHandler::handleUnlearnSpells(network::Packet& packet) {
|
|||
uint32_t spellCount = packet.readUInt32();
|
||||
LOG_INFO("Unlearning ", spellCount, " spells");
|
||||
|
||||
bool barChanged = false;
|
||||
for (uint32_t i = 0; i < spellCount && packet.getSize() - packet.getReadPos() >= 4; ++i) {
|
||||
uint32_t spellId = packet.readUInt32();
|
||||
knownSpells.erase(spellId);
|
||||
LOG_INFO(" Unlearned spell: ", spellId);
|
||||
for (auto& slot : actionBar) {
|
||||
if (slot.type == ActionBarSlot::SPELL && slot.id == spellId) {
|
||||
slot = ActionBarSlot{};
|
||||
barChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (barChanged) saveCharacterConfig();
|
||||
|
||||
if (spellCount > 0) {
|
||||
addSystemChatMessage("Unlearned " + std::to_string(spellCount) + " spells");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue