Caut de ceva timp funcție pentru depozit ca atunci când dai click dreapta pe un item să se pună automat în inventar, cum este și pe oficial.
Dacă are cineva această funcție și este drăguț să o împartă și cu mine...
[ Postat de pe Android ]


#[...] import item #[...] class SafeboxWindow(ui.ScriptWindow): #[...] def GetEmptyItemPos(self, itemHeight): #DaRealFreak is freak :oPartea de sursă:inventory_size = player.INVENTORY_PAGE_SIZE * player.INVENTORY_PAGE_COUNT # function to return the blocked slots based on the item size GetBlockedSlots = lambda slot, size: [slot+(round*5) for round in xrange(size)] # check if an item in on the slot and get the blocked slots, in the end chain all of our lists together blocked_slots = [element for sublist in [GetBlockedSlots(slot, item.GetItemSize(item.SelectItem(player.GetItemIndex(slot)))[1]) for slot in xrange(inventory_size) if player.isItem(slot)] for element in sublist] # check is only necessary if our item size is > 1, else bigger performance loss in list comprehension if itemHeight > 1: # add the slots where f.e. size 2 items won't fit because of the 2-page-separated inventory [[blocked_slots.append(slot) for slot in range(inventory_size/round-(itemHeight-1)*5, inventory_size/round) if not slot in blocked_slots] for round in xrange(1,3)] # check for every slot if it's not in the blocked_slots list and check also for the size the lower slots free_slots = [slot for slot in xrange(inventory_size) if not slot in blocked_slots and not True in [e in blocked_slots for e in [slot+(round*5) for round in xrange(itemHeight)]]] # if our free_slot list is empty return -1 as error code, else return the first possible slot return [free_slots, -1][len(free_slots) == 0] def UseItemSlot(self, slotIndex): if mouseModule.mouseController.isAttached(): mouseModule.mouseController.DeattachObject() item.SelectItem(safebox.GetItemID(self.__LocalPosToGlobalPos(slotIndex))) (w, h) = item.GetItemSize() emptyInvenSlots = self.GetEmptyItemPos(h) if emptyInvenSlots == -1: return net.SendSafeboxCheckoutPacket(slotIndex, emptyInvenSlots[0]) #[...]
void CInputMain::SafeboxCheckout(LPCHARACTER ch, const char * c_pData, bool bMall)
{
pkSafebox->Remove(p->bSafePos);
pkItem->SetLastOwnerPID(ch->GetPlayerID()); #fixme slothighlight
pkItem->AddToCharacter(ch, p->ItemPos);
ITEM_MANAGER::instance().FlushDelayedSave(pkItem);
}
Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 4 vizitatori