mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
fix: use CMSG_OPEN_ITEM for locked containers (lockboxes)
Right-clicking a locked container (e.g. Dead-Tooth's Strong Box) was sending CMSG_USE_ITEM with spellId=0, which the server rejects. Locked containers (itemClass==1, inventoryType==0) now send CMSG_OPEN_ITEM instead, letting the server auto-check the keyring for the required key.
This commit is contained in:
parent
2fb7901cca
commit
25138b5648
5 changed files with 50 additions and 2 deletions
|
|
@ -21165,6 +21165,26 @@ void GameHandler::useItemInBag(int bagIndex, int slotIndex) {
|
|||
}
|
||||
}
|
||||
|
||||
void GameHandler::openItemBySlot(int backpackIndex) {
|
||||
if (backpackIndex < 0 || backpackIndex >= inventory.getBackpackSize()) return;
|
||||
if (inventory.getBackpackSlot(backpackIndex).empty()) return;
|
||||
if (state != WorldState::IN_WORLD || !socket) return;
|
||||
auto packet = OpenItemPacket::build(0xFF, static_cast<uint8_t>(23 + backpackIndex));
|
||||
LOG_INFO("openItemBySlot: CMSG_OPEN_ITEM bag=0xFF slot=", (23 + backpackIndex));
|
||||
socket->send(packet);
|
||||
}
|
||||
|
||||
void GameHandler::openItemInBag(int bagIndex, int slotIndex) {
|
||||
if (bagIndex < 0 || bagIndex >= inventory.NUM_BAG_SLOTS) return;
|
||||
if (slotIndex < 0 || slotIndex >= inventory.getBagSize(bagIndex)) return;
|
||||
if (inventory.getBagSlot(bagIndex, slotIndex).empty()) return;
|
||||
if (state != WorldState::IN_WORLD || !socket) return;
|
||||
uint8_t wowBag = static_cast<uint8_t>(19 + bagIndex);
|
||||
auto packet = OpenItemPacket::build(wowBag, static_cast<uint8_t>(slotIndex));
|
||||
LOG_INFO("openItemInBag: CMSG_OPEN_ITEM bag=", (int)wowBag, " slot=", slotIndex);
|
||||
socket->send(packet);
|
||||
}
|
||||
|
||||
void GameHandler::useItemById(uint32_t itemId) {
|
||||
if (itemId == 0) return;
|
||||
LOG_DEBUG("useItemById: searching for itemId=", itemId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue