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
This commit is contained in:
Kelsi 2026-03-17 10:20:29 -07:00
parent 7b03d5363b
commit 9aed192503

View file

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