From 9aed192503c24d971eca09d5b92745282a1dc457 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Tue, 17 Mar 2026 10:20:29 -0700 Subject: [PATCH] fix: load skill DBCs on login and handle loot slot changes - Load SkillLine.dbc and SkillLineAbility.dbc during SMSG_INITIAL_SPELLS so isProfessionSpell() works immediately without visiting a trainer - Implement SMSG_LOOT_SLOT_CHANGED handler to remove items taken by other players in group loot, keeping the loot window in sync --- src/game/game_handler.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index 35e34512..506d80f3 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -2849,10 +2849,19 @@ void GameHandler::handlePacket(network::Packet& packet) { } break; } - case Opcode::SMSG_LOOT_SLOT_CHANGED: - // uint64 objectGuid + uint32 slot + ... — consume - packet.setReadPos(packet.getSize()); + case Opcode::SMSG_LOOT_SLOT_CHANGED: { + // uint8 slotIndex — another player took the item from this slot in group loot + if (packet.getSize() - packet.getReadPos() >= 1) { + uint8_t slotIndex = packet.readUInt8(); + for (auto it = currentLoot.items.begin(); it != currentLoot.items.end(); ++it) { + if (it->slotIndex == slotIndex) { + currentLoot.items.erase(it); + break; + } + } + } break; + } // ---- Spell log miss ---- case Opcode::SMSG_SPELLLOGMISS: { @@ -17966,6 +17975,11 @@ void GameHandler::handleInitialSpells(network::Packet& packet) { } } + // Pre-load skill line DBCs so isProfessionSpell() works immediately + // (not just after opening a trainer window) + loadSkillLineDbc(); + loadSkillLineAbilityDbc(); + LOG_INFO("Learned ", knownSpells.size(), " spells"); }