mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-24 08:00: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
|
|
@ -2356,7 +2356,14 @@ void InventoryScreen::renderItemSlot(game::Inventory& inventory, const game::Ite
|
|||
} else if (item.inventoryType > 0) {
|
||||
gameHandler_->autoEquipItemBySlot(backpackIndex);
|
||||
} else {
|
||||
gameHandler_->useItemBySlot(backpackIndex);
|
||||
// itemClass==1 (Container) with inventoryType==0 means a lockbox;
|
||||
// use CMSG_OPEN_ITEM so the server checks keyring automatically.
|
||||
auto* info = gameHandler_->getItemInfo(item.itemId);
|
||||
if (info && info->valid && info->itemClass == 1) {
|
||||
gameHandler_->openItemBySlot(backpackIndex);
|
||||
} else {
|
||||
gameHandler_->useItemBySlot(backpackIndex);
|
||||
}
|
||||
}
|
||||
} else if (kind == SlotKind::BACKPACK && isBagSlot) {
|
||||
LOG_INFO("Right-click bag item: name='", item.name,
|
||||
|
|
@ -2369,7 +2376,12 @@ void InventoryScreen::renderItemSlot(game::Inventory& inventory, const game::Ite
|
|||
} else if (item.inventoryType > 0) {
|
||||
gameHandler_->autoEquipItemInBag(bagIndex, bagSlotIndex);
|
||||
} else {
|
||||
gameHandler_->useItemInBag(bagIndex, bagSlotIndex);
|
||||
auto* info = gameHandler_->getItemInfo(item.itemId);
|
||||
if (info && info->valid && info->itemClass == 1) {
|
||||
gameHandler_->openItemInBag(bagIndex, bagSlotIndex);
|
||||
} else {
|
||||
gameHandler_->useItemInBag(bagIndex, bagSlotIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue