mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
Add drag-and-drop support for inventory to bank slots
Bank window slots now act as drop targets when holding an item from inventory. Empty bank slots highlight green, and clicking drops the held item via CMSG_SWAP_ITEM. Occupied bank slots accept swaps too. Works for both main bank slots (39-66) and bank bag slots (67+).
This commit is contained in:
parent
2ab5cf5eb6
commit
af7fb4242c
3 changed files with 58 additions and 10 deletions
|
|
@ -543,6 +543,25 @@ bool InventoryScreen::dropHeldItemToEquipSlot(game::Inventory& inv, game::EquipS
|
|||
return !holdingItem;
|
||||
}
|
||||
|
||||
void InventoryScreen::dropIntoBankSlot(game::GameHandler& /*gh*/, uint8_t dstBag, uint8_t dstSlot) {
|
||||
if (!holdingItem || !gameHandler_) return;
|
||||
uint8_t srcBag = 0xFF;
|
||||
uint8_t srcSlot = 0;
|
||||
if (heldSource == HeldSource::BACKPACK && heldBackpackIndex >= 0) {
|
||||
srcSlot = static_cast<uint8_t>(23 + heldBackpackIndex);
|
||||
} else if (heldSource == HeldSource::BAG) {
|
||||
srcBag = static_cast<uint8_t>(19 + heldBagIndex);
|
||||
srcSlot = static_cast<uint8_t>(heldBagSlotIndex);
|
||||
} else if (heldSource == HeldSource::EQUIPMENT) {
|
||||
srcSlot = static_cast<uint8_t>(heldEquipSlot);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
gameHandler_->swapContainerItems(srcBag, srcSlot, dstBag, dstSlot);
|
||||
holdingItem = false;
|
||||
inventoryDirty = true;
|
||||
}
|
||||
|
||||
bool InventoryScreen::beginPickupFromEquipSlot(game::Inventory& inv, game::EquipSlot slot) {
|
||||
if (holdingItem) return false;
|
||||
const auto& eq = inv.getEquipSlot(slot);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue