void CUIInventoryWnd::ProcessPropertiesBoxClicked () { if(UIPropertiesBox.GetClickedItem()) { switch(UIPropertiesBox.GetClickedItem()->GetID()) { case INVENTORY_TO_SLOT_ACTION: ToSlot(CurrentItem(), true); break; case INVENTORY_TO_BELT_ACTION: ToBelt(CurrentItem(),false); break; case INVENTORY_TO_BAG_ACTION: ToBag(CurrentItem(),false); break; case INVENTORY_DROP_ACTION: { void* d = UIPropertiesBox.GetClickedItem()->GetData(); bool b_all = (d==(void*)33); DropCurrentItem(b_all); }break; case INVENTORY_EAT_ACTION: EatItem(CurrentIItem()); break; case INVENTORY_ATTACH_ADDON: AttachAddon((PIItem)(UIPropertiesBox.GetClickedItem()->GetData())); break; case INVENTORY_DETACH_SCOPE_ADDON: DetachAddon(*(smart_cast<CWeapon*>(CurrentIItem()))->GetScopeName()); break; case INVENTORY_DETACH_SILENCER_ADDON: DetachAddon(*(smart_cast<CWeapon*>(CurrentIItem()))->GetSilencerName()); break; case INVENTORY_DETACH_GRENADE_LAUNCHER_ADDON: DetachAddon(*(smart_cast<CWeapon*>(CurrentIItem()))->GetGrenadeLauncherName()); break; case INVENTORY_ACTIVATE_ARTEFACT_ACTION: Activate_Artefact(); break; case INVENTORY_RELOAD_MAGAZINE: (smart_cast<CWeapon*>(CurrentIItem()))->Action(kWPN_RELOAD, CMD_START); break; case INVENTORY_UNLOAD_MAGAZINE: { CUICellItem * itm = CurrentItem(); (smart_cast<CWeaponMagazined*>((CWeapon*)itm->m_pData))->UnloadMagazine(); for(u32 i=0; i<itm->ChildsCount(); ++i) { CUICellItem * child_itm = itm->Child(i); (smart_cast<CWeaponMagazined*>((CWeapon*)child_itm->m_pData))->UnloadMagazine(); } }break; } } }
bool CUIActorMenu::OnItemDbClick(CUICellItem* itm) { InfoCurItem( NULL ); CUIDragDropListEx* old_owner = itm->OwnerList(); EDDListType t_old = GetListType(old_owner); switch ( t_old ) { case iActorSlot: { if ( m_currMenuMode == mmDeadBodySearch ) ToDeadBodyBag ( itm, false ); else ToBag ( itm, false ); break; } case iActorBag: { if ( m_currMenuMode == mmTrade ) { ToActorTrade( itm, false ); break; }else if ( m_currMenuMode == mmDeadBodySearch ) { ToDeadBodyBag( itm, false ); break; } if ( TryUseItem( itm ) ) { break; } if ( TryActiveSlot( itm ) ) { break; } if ( !ToSlot( itm, false ) ) { if ( !ToBelt( itm, false ) ) { ToSlot( itm, true ); } } break; } case iActorBelt: { ToBag( itm, false ); break; } case iActorTrade: { ToBag( itm, false ); break; } case iPartnerTradeBag: { ToPartnerTrade( itm, false ); break; } case iPartnerTrade: { ToPartnerTradeBag( itm, false ); break; } case iDeadBodyBag: { ToBag( itm, false ); break; } }; //switch UpdateItemsPlace(); return true; }
bool CUIActorMenu::OnItemDrop(CUICellItem* itm) { InfoCurItem( NULL ); CUIDragDropListEx* old_owner = itm->OwnerList(); CUIDragDropListEx* new_owner = CUIDragDropListEx::m_drag_item->BackList(); if ( old_owner==new_owner || !old_owner || !new_owner ) { return false; } EDDListType t_new = GetListType(new_owner); EDDListType t_old = GetListType(old_owner); if ( !AllowItemDrops(t_old, t_new) ) { Msg("incorrect action [%d]->[%d]",t_old, t_new); return true; } switch(t_new) { case iActorSlot: { if(GetSlotList(CurrentIItem()->GetSlot())==new_owner) ToSlot (itm, true); }break; case iActorBag: { ToBag (itm, true); }break; case iActorBelt: { ToBelt (itm, true); }break; case iActorTrade: { ToActorTrade(itm, true); }break; case iPartnerTrade: { if(t_old!=iPartnerTradeBag) return false; ToPartnerTrade(itm, true); }break; case iPartnerTradeBag: { if(t_old!=iPartnerTrade) return false; ToPartnerTradeBag(itm, true); }break; case iDeadBodyBag: { ToDeadBodyBag(itm, true); }break; #ifdef DRAG_DROP_TRASH case iTrashSlot: { if (CurrentIItem()->IsQuestItem()) return true; SendEvent_Item_Drop(CurrentIItem(), m_pActorInvOwner->object_id()); SetCurrentItem(NULL); }break; #endif }; OnItemDropped (CurrentIItem(), new_owner, old_owner); UpdateItemsPlace(); return true; }