void UIItemInventory::icondropped(int16_t identifier) { if (!icons.count(identifier)) return; using Net::MoveItemPacket; Session::get().dispatch(MoveItemPacket(tab, identifier, 0, 1)); }
void UIItemInventory::dropicon(Point<int16_t> cursorpos, Type type, int16_t identifier) { int16_t slot = slotbypos(cursorpos - position); if (slot > 0) { switch (type) { case ITEMINVENTORY: if (slot != identifier) { using Net::MoveItemPacket; Session::get().dispatch(MoveItemPacket(tab, identifier, slot, 1)); } break; case EQUIPINVENTORY: if (tab == Inventory::EQUIP) { Optional<Item> item = inventory.getitem(Inventory::EQUIP, slot); if (item) { int32_t itemid = item.map(&Item::getid); Equipslot::Value eqslot = inventory.findequipslot(itemid); if (identifier == eqslot) { using Net::EquipItemPacket; Session::get().dispatch(EquipItemPacket(identifier, eqslot)); } } else { using Net::UnequipItemPacket; Session::get().dispatch(UnequipItemPacket(identifier, slot)); } } break; } } }