Idee von Liron
Bitte melden Sie sich an, um diesen Link zu sehen.
Bitte melden Sie sich an, um diesen Link zu sehen.
Shortcut:
strg + rechter mausklick
oeffne root/uiinventory.py
Python
- ## add to imports:
- import exchange
- ## search for:
- def UseItemSlot(self, slotIndex):
- curCursorNum = app.GetCursor()
- if app.SELL == curCursorNum:
- return
- if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS():
- return
- slotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(slotIndex)
- if app.ENABLE_DRAGON_SOUL_SYSTEM:
- if self.wndDragonSoulRefine.IsShow():
- self.wndDragonSoulRefine.AutoSetItem((player.INVENTORY, slotIndex), 1)
- return
- self.__UseItem(slotIndex)
- mouseModule.mouseController.DeattachObject()
- self.OverOutItem()
- ## replace complete function with:
- def UseItemSlot(self, slotIndex):
- curCursorNum = app.GetCursor()
- if app.SELL == curCursorNum:
- return
- if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS():
- return
- slotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(slotIndex)
- if app.ENABLE_DRAGON_SOUL_SYSTEM:
- if self.wndDragonSoulRefine.IsShow():
- self.wndDragonSoulRefine.AutoSetItem((player.INVENTORY, slotIndex), 1)
- return
- if self.interface.dlgExchange.IsShow() and (app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL)):
- item.SelectItem(player.GetItemIndex(slotIndex))
- emptyExchangeSlots = self.GetExchangeEmptyItemPos(item.GetItemSize()[1])
- if emptyExchangeSlots == -1:
- return
- if item.IsAntiFlag(item.ANTIFLAG_GIVE):
- chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.EXCHANGE_CANNOT_GIVE)
- return
- net.SendExchangeItemAddPacket(player.SLOT_TYPE_INVENTORY, slotIndex, emptyExchangeSlots[0])
- else:
- self.__UseItem(slotIndex)
- mouseModule.mouseController.DeattachObject()
- self.OverOutItem()
- ## Thanks to xP3NG3Rx for the basic version of the function
- def GetExchangeEmptyItemPos(self, itemHeight):
- inventorySize = exchange.EXCHANGE_ITEM_MAX_NUM
- inventoryWidth = 4
- GetBlockedSlots = lambda slot, size: [slot+(round*inventoryWidth) for round in xrange(size)]
- blockedSlots = [element for sublist in [GetBlockedSlots(slot, item.GetItemSize(item.SelectItem(exchange.GetItemVnumFromSelf(slot)))[1]) for slot in xrange(inventorySize) if exchange.GetItemVnumFromSelf(slot) != 0] for element in sublist]
- freeSlots = [slot for slot in xrange(inventorySize) if not slot in blockedSlots and not True in [e in blockedSlots for e in [slot+(round*inventoryWidth) for round in xrange(itemHeight)]]]
- return [freeSlots, -1][len(freeSlots) == 0]