Fix item destroy packet format and wire destroy confirmation UI

This commit is contained in:
Kelsi 2026-02-19 06:34:06 -08:00
parent 0ea1106b05
commit 550366df07
3 changed files with 46 additions and 2 deletions

View file

@ -2763,6 +2763,7 @@ void GameHandler::selectCharacter(uint64_t characterGuid) {
// Reset per-character state so previous character data doesn't bleed through
inventory = Inventory();
onlineItems_.clear();
itemInfoCache_.clear();
pendingItemQueries_.clear();
equipSlotGuids_ = {};
backpackSlotGuids_ = {};
@ -9328,6 +9329,22 @@ void GameHandler::swapContainerItems(uint8_t srcBag, uint8_t srcSlot, uint8_t ds
socket->send(packet);
}
void GameHandler::destroyItem(uint8_t bag, uint8_t slot, uint8_t count) {
if (state != WorldState::IN_WORLD || !socket) return;
if (count == 0) count = 1;
// AzerothCore WotLK expects CMSG_DESTROYITEM(bag:u8, slot:u8, count:u32).
// This opcode is currently not modeled as a logical opcode in our table.
constexpr uint16_t kCmsgDestroyItem = 0x111;
network::Packet packet(kCmsgDestroyItem);
packet.writeUInt8(bag);
packet.writeUInt8(slot);
packet.writeUInt32(static_cast<uint32_t>(count));
LOG_DEBUG("Destroy item request: bag=", (int)bag, " slot=", (int)slot,
" count=", (int)count, " wire=0x", std::hex, kCmsgDestroyItem, std::dec);
socket->send(packet);
}
void GameHandler::useItemBySlot(int backpackIndex) {
if (backpackIndex < 0 || backpackIndex >= inventory.getBackpackSize()) return;
const auto& slot = inventory.getBackpackSlot(backpackIndex);