def OnUpdate(self):
USE_EXCHANGE_LIMIT_RANGE = 1000
(x, y, z) = player.GetMainCharacterPosition()
if abs(x - self.xStart) > USE_EXCHANGE_LIMIT_RANGE or abs(y - self.yStart) > USE_EXCHANGE_LIMIT_RANGE:
(self.xStart, self.yStart, z) = player.GetMainCharacterPosition()
net.SendExchangeExitPacket()
if app.WJ_ENABLE_TRADABLE_ICON:
if app.ENABLE_SPECIAL_INVENTORY_SYSTEM:
if not self.inven or not self.invenSpecial:
return
else:
if not self.inven:
return
page = self.inven.GetInventoryPageIndex() # range 0 ~ 1
if app.ENABLE_SPECIAL_INVENTORY_SYSTEM:
special_page = self.invenSpecial.GetInventoryPageIndex()
for i in self.ItemListIdx:
if (page * INVENTORY_PAGE_SIZE) <= i < ((page + 1) * INVENTORY_PAGE_SIZE): # range 0 ~ 44, 45 ~ 89
lock_idx = i - (page * INVENTORY_PAGE_SIZE)
self.inven.wndItem.SetCantMouseEventSlot(lock_idx)
if app.ENABLE_SPECIAL_INVENTORY_SYSTEM:
if self.invenSpecial.GetInventoryType() == 0:
if (item.SKILL_BOOK_INVENTORY_SLOT_START + (special_page * SPECIAL_INVENTORY_PAGE_SIZE)) <= i < (item.SKILL_BOOK_INVENTORY_SLOT_START + (((special_page + 1) * SPECIAL_INVENTORY_PAGE_SIZE))):
lock_idx = i - (item.SKILL_BOOK_INVENTORY_SLOT_START + (special_page * SPECIAL_INVENTORY_PAGE_SIZE))
self.invenSpecial.wndItem.SetCantMouseEventSlot(lock_idx)
if self.invenSpecial.GetInventoryType() == 1:
if (item.UPGRADE_ITEMS_INVENTORY_SLOT_START + (special_page * SPECIAL_INVENTORY_PAGE_SIZE)) <= i < (item.UPGRADE_ITEMS_INVENTORY_SLOT_START + (((special_page + 1) * SPECIAL_INVENTORY_PAGE_SIZE))):
lock_idx = i - (item.UPGRADE_ITEMS_INVENTORY_SLOT_START + (special_page * SPECIAL_INVENTORY_PAGE_SIZE))
self.invenSpecial.wndItem.SetCantMouseEventSlot(lock_idx)
if self.invenSpecial.GetInventoryType() == 2:
if (item.STONE_INVENTORY_SLOT_START + (special_page * SPECIAL_INVENTORY_PAGE_SIZE)) <= i < (item.STONE_INVENTORY_SLOT_START + (((special_page + 1) * SPECIAL_INVENTORY_PAGE_SIZE))):
lock_idx = i - (item.STONE_INVENTORY_SLOT_START + (special_page * SPECIAL_INVENTORY_PAGE_SIZE))
self.invenSpecial.wndItem.SetCantMouseEventSlot(lock_idx)
if self.invenSpecial.GetInventoryType() == 3:
if (item.GIFT_BOX_INVENTORY_SLOT_START + (special_page * SPECIAL_INVENTORY_PAGE_SIZE)) <= i < (item.GIFT_BOX_INVENTORY_SLOT_START + (((special_page + 1) * SPECIAL_INVENTORY_PAGE_SIZE))):
lock_idx = i - (item.GIFT_BOX_INVENTORY_SLOT_START + (special_page * SPECIAL_INVENTORY_PAGE_SIZE))
self.invenSpecial.wndItem.SetCantMouseEventSlot(lock_idx)
if app.WJ_ENABLE_TRADABLE_ICON:
def CantTradableItem(self, slotIndex):
itemIndex = player.GetItemIndex(slotIndex)
if itemIndex:
return player.IsAntiFlagBySlot(slotIndex, item.ANTIFLAG_GIVE)
return False
def BindInterface(self, interface):
from _weakref import proxy
self.interface = proxy(interface)
def OnTop(self):
self.tooltipItem.SetTop()
if not self.interface:
return
self.interface.SetOnTopWindow(player.ON_TOP_WND_EXCHANGE)
self.interface.RefreshMarkInventoryBag()
def SetInven(self, inven):
self.inven = inven
if app.ENABLE_SPECIAL_INVENTORY_SYSTEM:
def SetSpecialInven(self, invenSpecial):
self.invenSpecial = invenSpecial
def AddExchangeItemSlotIndex(self, idx):
self.ItemListIdx.append(idx)