Advertisement
Guest User

Untitled

a guest
Mar 18th, 2024
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 78.89 KB | None | 0 0
  1. import ui
  2. import player
  3. import mouseModule
  4. import net
  5. import app
  6. import snd
  7. import item
  8. import player
  9. import chat
  10. import grp
  11. import uiScriptLocale
  12. import uiRefine
  13. import uiAttachMetin
  14. import uiPickMoney
  15. import uiCommon
  16. import uiPrivateShopBuilder
  17. import localeInfo
  18. import constInfo
  19. import ime
  20. import wndMgr
  21. import background
  22. import exchange
  23. import constInfo2
  24.  
  25. if app.ENABLE_CHEQUE_SYSTEM:
  26.     import uiToolTip
  27.     import uiPickETC
  28.  
  29. import event
  30.  
  31. if app.ENABLE_ACCE_SYSTEM:
  32.     import acce
  33.  
  34. ITEM_MALL_BUTTON_ENABLE = True
  35.  
  36. ITEM_FLAG_APPLICABLE = 1 << 14
  37.  
  38. if app.ENABLE_EXTEND_INVEN_SYSTEM:
  39.     EX_INVEN_COVER_IMG_OPEN = "d:/ymir work/ui/game/windows/ex_inven_cover_button_open.sub"
  40.     EX_INVEN_COVER_IMG_CLOSE = "d:/ymir work/ui/game/windows/ex_inven_cover_button_close.sub"
  41.  
  42. if app.__RENEWAL_BRAVE_CAPE__:
  43.     import os
  44.     class BraveCapeWindow(ui.Board):
  45.         __children={}
  46.         class SliderBarNew(ui.Window):
  47.             def __init__(self):
  48.                 ui.Window.__init__(self)
  49.                 self.curPos = 1.0
  50.                 self.pageSize = 1.0
  51.                 self.eventChange = None
  52.                 self.__Load()
  53.  
  54.             def __Load(self):
  55.                 IMG_DIR = "d:/ymir work/ui/game/bravery_cape/"
  56.  
  57.                 img = ui.ImageBox()
  58.                 img.SetParent(self)
  59.                 img.LoadImage(IMG_DIR+"slider_bg.tga")
  60.                 img.Show()
  61.                 self.backGroundImage = img
  62.  
  63.                 self.SetSize(self.backGroundImage.GetWidth(), self.backGroundImage.GetHeight())
  64.  
  65.                 cursor = ui.DragButton()
  66.                 cursor.AddFlag("movable")
  67.                 cursor.AddFlag("restrict_y")
  68.                 cursor.SetParent(self)
  69.                 cursor.SetMoveEvent(ui.__mem_func__(self.__OnMove))
  70.                 cursor.SetUpVisual(IMG_DIR+"drag.tga")
  71.                 cursor.SetOverVisual(IMG_DIR+"drag.tga")
  72.                 cursor.SetDownVisual(IMG_DIR+"drag.tga")
  73.                 cursor.Show()
  74.                 self.cursor = cursor
  75.  
  76.                 ##
  77.                 self.cursor.SetRestrictMovementArea(0, 0, self.backGroundImage.GetWidth(), 0)
  78.                 self.pageSize = self.backGroundImage.GetWidth() - self.cursor.GetWidth()
  79.  
  80.             def __OnMove(self):
  81.                 (xLocal, yLocal) = self.cursor.GetLocalPosition()
  82.                 self.curPos = float(xLocal) / float(self.pageSize)
  83.                 if self.eventChange:
  84.                     self.eventChange()
  85.             def SetSliderPos(self, pos):
  86.                 self.curPos = pos
  87.                 self.cursor.SetPosition(int(self.pageSize * pos), 0)
  88.             def GetSliderPos(self):
  89.                 return self.curPos
  90.             def SetEvent(self, event):
  91.                 self.eventChange = event
  92.             def Enable(self):
  93.                 self.cursor.Show()
  94.             def Disable(self):
  95.                 self.cursor.Hide()
  96.  
  97.         def Destroy(self):
  98.             self.SaveData()
  99.             self.__children={}
  100.         def CreateWindow(self, classPtr, parent, pos):
  101.             window = classPtr
  102.             window.SetParent(parent)
  103.             window.SetPosition(*pos)
  104.             window.Show()
  105.             return window
  106.         def __OverOutItem(self):
  107.             interface = constInfo.GetInterfaceInstance()
  108.             if interface:
  109.                 if interface.tooltipItem:
  110.                     interface.tooltipItem.HideToolTip()
  111.         def __OverInItem(self, itemIdx):
  112.             interface = constInfo.GetInterfaceInstance()
  113.             if interface:
  114.                 if interface.tooltipItem:
  115.                     interface.tooltipItem.SetItemToolTip(itemIdx)
  116.         def __init__(self):
  117.             ui.Board.__init__(self)
  118.             self.SetSize(140, 130 + 44)
  119.             self.AddFlag("attach")
  120.             self.AddFlag("float")
  121.  
  122.             self.__children["firstOpened"] = app.GetGlobalTimeStamp() + 5
  123.  
  124.             IMG_DIR = "d:/ymir work/ui/game/bravery_cape/"
  125.             BUTTONS_DIR = "d:/ymir work/ui/game/belt_inventory/"
  126.  
  127.             BRAVE_CAPE_ITEM_IDX = 20575
  128.  
  129.             item.SelectItem(BRAVE_CAPE_ITEM_IDX)
  130.  
  131.             bgImg = self.CreateWindow(ui.ImageBox(), self, (5, 6))
  132.             bgImg.LoadImage(IMG_DIR+"bg.tga")
  133.             self.__children["bgImg"] = bgImg
  134.  
  135.             timeTextVisual = self.CreateWindow(ui.TextLine(), bgImg, (13, 60))
  136.             timeTextVisual.SetText("Second")
  137.             self.__children["timeTextVisual"] = timeTextVisual
  138.  
  139.             timeSlider = self.CreateWindow(self.SliderBarNew(), bgImg, (13, 73 + 5))
  140.             timeSlider.SetEvent(ui.__mem_func__(self.OnChangeTimeSlider))
  141.             self.__children["timeSlider"] = timeSlider
  142.  
  143.             timeBg = self.CreateWindow(ui.ImageBox(), bgImg, (77, 64))
  144.             timeBg.LoadImage(IMG_DIR+"input_output.tga")
  145.             self.__children["timeBg"] = timeBg
  146.  
  147.             timeText = self.CreateWindow(ui.TextLine(), timeBg, (0, 0))
  148.             timeText.SetAllAlign()
  149.             timeText.SetText("0")
  150.             self.__children["timeText"] = timeText
  151.  
  152.             rangeTextVisual = self.CreateWindow(ui.TextLine(), bgImg, (13, 73 + 22 + 17 + 5 - 18))
  153.             rangeTextVisual.SetText("Range")
  154.             self.__children["rangeTextVisual"] = rangeTextVisual
  155.  
  156.             rangeSlider = self.CreateWindow(self.SliderBarNew(), bgImg, (13, 73 + 22 + 17 + 5))
  157.             rangeSlider.SetEvent(ui.__mem_func__(self.OnChangeRangeSlider))
  158.             self.__children["rangeSlider"] = rangeSlider
  159.  
  160.             rangeBg = self.CreateWindow(ui.ImageBox(), bgImg, (77, 95 + 8))
  161.             rangeBg.LoadImage(IMG_DIR+"input_output.tga")
  162.             self.__children["rangeBg"] = rangeBg
  163.  
  164.             rangeText = self.CreateWindow(ui.TextLine(), rangeBg, (0, 0))
  165.             rangeText.SetAllAlign()
  166.             rangeText.SetText("0")
  167.             self.__children["rangeText"] = rangeText
  168.  
  169.             itemIcon = self.CreateWindow(ui.ImageBox(), bgImg, (50, 13))
  170.             itemIcon.LoadImage(item.GetIconImageFileName())
  171.             itemIcon.SAFE_SetStringEvent("MOUSE_OVER_OUT",self.__OverOutItem)
  172.             itemIcon.SAFE_SetStringEvent("MOUSE_OVER_IN",self.__OverInItem, BRAVE_CAPE_ITEM_IDX)
  173.             self.__children["itemIcon"] = itemIcon
  174.  
  175.             startBtn = self.CreateWindow(ui.Button(), bgImg, (6, 95 + 39))
  176.             startBtn.SetUpVisual(IMG_DIR+"start_btn_0.tga")
  177.             startBtn.SetOverVisual(IMG_DIR+"start_btn_1.tga")
  178.             startBtn.SetDownVisual(IMG_DIR+"start_btn_2.tga")
  179.             startBtn.SetDisableVisual(IMG_DIR+"start_btn_2.tga")
  180.             startBtn.SAFE_SetEvent(self.__ClickStatusBtn, "ACTIVE")
  181.             startBtn.SetText("Start")
  182.             self.__children["startBtn"] = startBtn
  183.  
  184.             stopBtn = self.CreateWindow(ui.Button(), bgImg, (66, 95 + 39))
  185.             stopBtn.SetUpVisual(IMG_DIR+"start_btn_0.tga")
  186.             stopBtn.SetOverVisual(IMG_DIR+"start_btn_1.tga")
  187.             stopBtn.SetDownVisual(IMG_DIR+"start_btn_2.tga")
  188.             stopBtn.SetDisableVisual(IMG_DIR+"start_btn_2.tga")
  189.             stopBtn.SAFE_SetEvent(self.__ClickStatusBtn, "DEACTIVE")
  190.             stopBtn.SetText("Stop")
  191.             self.__children["stopBtn"] = stopBtn
  192.  
  193.             expandBtn = self.CreateWindow(ui.Button(), self, (0, 10))
  194.             expandBtn.SetUpVisual(BUTTONS_DIR+"btn_minimize_normal.tga")
  195.             expandBtn.SetOverVisual(BUTTONS_DIR+"btn_minimize_over.tga")
  196.             expandBtn.SetDownVisual(BUTTONS_DIR+"btn_minimize_down.tga")
  197.             expandBtn.SAFE_SetEvent(self.Close)
  198.             self.__children["expandBtn"] = expandBtn
  199.  
  200.             self.__children["second"] = 0
  201.             self.__children["range"] = 0
  202.             self.__children["status"] = False
  203.             self.Refresh()
  204.  
  205.         def Refresh(self):
  206.             (second, range, posTime, posSlider) = (self.__children["second"], self.__children["range"], 0.0, 0.0)
  207.             if second > 5800:
  208.                 second = 5800
  209.             if range > 14000:
  210.                 range = 14000
  211.  
  212.             self.__children["timeText"].SetText(str((second/100)+2))
  213.             self.__children["rangeText"].SetText(str(range+1000))
  214.  
  215.             self.__children["timeSlider"].SetSliderPos((1.0/5800.0)*second)
  216.             self.__children["rangeSlider"].SetSliderPos((1.0/14000.0)*range)
  217.  
  218.             self.__children["second"] = second
  219.             self.__children["range"] = range
  220.  
  221.         def Open(self):
  222.             interface = constInfo.GetInterfaceInstance()
  223.             if interface:
  224.                 if interface.wndInventory:
  225.                     interface.wndInventory.disbandBtn.Hide()
  226.             self.Show()
  227.  
  228.         def Close(self):
  229.             interface = constInfo.GetInterfaceInstance()
  230.             if interface:
  231.                 if interface.wndInventory:
  232.                     interface.wndInventory.disbandBtn.Show()
  233.             self.Hide()
  234.  
  235.         def __ClickStatusBtn(self, type):
  236.             if type == "ACTIVE":
  237.                 net.SendChatPacket("/brave_cape active {} {}".format((self.__children["second"]/100)+2, self.__children["range"] + 1000))
  238.             elif type == "DEACTIVE":
  239.                 net.SendChatPacket("/brave_cape deactive")
  240.  
  241.         def AdjustPosition(self, x, y):
  242.             self.SetPosition(x + 10 - self.GetWidth(), y + 220)
  243.         def OnChangeRangeSlider(self):
  244.             val = int(((1.0/14000.0)*(self.__children["rangeSlider"].GetSliderPos()*14000))*14000)
  245.             self.__children["range"] = val
  246.             self.Refresh()
  247.         def OnChangeTimeSlider(self):
  248.             val = int(((1.0/5800.0)*(self.__children["timeSlider"].GetSliderPos()*5800))*5800)
  249.             self.__children["second"] = val
  250.             self.Refresh()
  251.         def SetStatus(self, status):
  252.             self.__children["status"] = True if int(status) == 1 else False
  253.             if self.__children["status"]:
  254.                 self.__children["startBtn"].Disable()
  255.                 self.__children["stopBtn"].Enable()
  256.             else:
  257.                 self.__children["stopBtn"].Disable()
  258.                 self.__children["startBtn"].Enable()
  259.             self.Refresh()
  260.         def SaveData(self):
  261.             try:
  262.                 file = open("lib/{}_brave_cape".format(player.GetName()), "w+")
  263.                 file.write("{}#{}#{}\n".format(1 if (self.__children["status"] if self.__children.has_key("status") else False) == True else 0, self.__children["second"], self.__children["range"]))
  264.                 file.close()
  265.             except:
  266.                 pass
  267.         def LoadData(self):
  268.             try:
  269.                 splitList = open("lib/{}_brave_cape".format(player.GetName()), "r").readlines()[0].split("#")
  270.                 self.__children["status"] = True if int(splitList[0]) == 1 else False
  271.                 self.__children["second"] = int(splitList[1])
  272.                 self.__children["range"] = int(splitList[2])
  273.                 self.Refresh()
  274.                 if self.__children["status"]:
  275.                     self.__ClickStatusBtn("ACTIVE")
  276.                 os.remove("lib/{}_brave_cape".format(player.GetName()))
  277.             except:
  278.                 pass
  279.  
  280. class CostumeWindow(ui.ScriptWindow):
  281.  
  282.     def __init__(self, wndInventory):
  283.         import exception
  284.  
  285.         if not app.ENABLE_COSTUME_SYSTEM:
  286.             exception.Abort("What do you do?")
  287.             return
  288.  
  289.         if not wndInventory:
  290.             exception.Abort("wndInventory parameter must be set to InventoryWindow")
  291.             return
  292.  
  293.         ui.ScriptWindow.__init__(self)
  294.  
  295.         self.isLoaded = 0
  296.         self.wndInventory = wndInventory;
  297.         if app.ENABLE_HIDE_COSTUME_SYSTEM:
  298.             self.visibleButtonList = []
  299.  
  300.         self.__LoadWindow()
  301.  
  302.     def __del__(self):
  303.         ui.ScriptWindow.__del__(self)
  304.  
  305.     def Show(self):
  306.         self.__LoadWindow()
  307.         self.RefreshCostumeSlot()
  308.  
  309.         ui.ScriptWindow.Show(self)
  310.  
  311.     def Close(self):
  312.         self.Hide()
  313.  
  314.     def GetBasePosition(self):
  315.         x, y = self.wndInventory.GetGlobalPosition()
  316.         return x - 147, y
  317.  
  318.     def AdjustPositionAndSize(self):
  319.         bx, by = self.GetBasePosition()
  320.  
  321.         self.SetPosition(bx, by)
  322.         self.SetSize(self.GetWidth(), self.GetHeight())
  323.  
  324.     def __LoadWindow(self):
  325.         if self.isLoaded == 1:
  326.             return
  327.  
  328.         self.isLoaded = 1
  329.  
  330.         try:
  331.             pyScrLoader = ui.PythonScriptLoader()
  332.             pyScrLoader.LoadScriptFile(self, "UIScript/CostumeWindow.py")
  333.         except:
  334.             import exception
  335.             exception.Abort("CostumeWindow.LoadWindow.LoadObject")
  336.  
  337.         try:
  338.             wndEquip = self.GetChild("CostumeSlot")
  339.             self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
  340.             if app.ENABLE_HIDE_COSTUME_SYSTEM:
  341.                 self.visibleButtonList.append(self.GetChild("BodyToolTipButton"))
  342.                 self.visibleButtonList.append(self.GetChild("HairToolTipButton"))
  343.                 if app.ENABLE_ACCE_SYSTEM:
  344.                     self.visibleButtonList.append(self.GetChild("AcceToolTipButton"))
  345.                 if app.ENABLE_WEAPON_COSTUME_SYSTEM:
  346.                     self.visibleButtonList.append(self.GetChild("WeaponToolTipButton"))
  347.             # self.costume = self.GetChild("costume") # Fixed by Exygo, self. was missing before GetChild
  348.  
  349.         except:
  350.             import exception
  351.             exception.Abort("CostumeWindow.LoadWindow.BindObject")
  352.  
  353.         ## Equipment
  354.         wndEquip.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
  355.         wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
  356.         wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  357.         wndEquip.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  358.         wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
  359.         wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
  360.         # self.costume.SetEvent(ui.__mem_func__(self.__costume))
  361.  
  362.         self.wndEquip = wndEquip
  363.  
  364.         if app.ENABLE_HIDE_COSTUME_SYSTEM:
  365.             self.visibleButtonList[0].SetToggleUpEvent(ui.__mem_func__(self.VisibleCostume), 1, 0)
  366.             self.visibleButtonList[1].SetToggleUpEvent(ui.__mem_func__(self.VisibleCostume), 2, 0)
  367.             if app.ENABLE_ACCE_SYSTEM:
  368.                 self.visibleButtonList[2].SetToggleUpEvent(ui.__mem_func__(self.VisibleCostume), 3, 0)
  369.             if app.ENABLE_WEAPON_COSTUME_SYSTEM:
  370.                 self.visibleButtonList[3].SetToggleUpEvent(ui.__mem_func__(self.VisibleCostume), 4, 0)
  371.  
  372.             self.visibleButtonList[0].SetToggleDownEvent(ui.__mem_func__(self.VisibleCostume), 1, 1)
  373.             self.visibleButtonList[1].SetToggleDownEvent(ui.__mem_func__(self.VisibleCostume), 2, 1)
  374.             if app.ENABLE_ACCE_SYSTEM:
  375.                 self.visibleButtonList[2].SetToggleDownEvent(ui.__mem_func__(self.VisibleCostume), 3, 1)
  376.             if app.ENABLE_WEAPON_COSTUME_SYSTEM:
  377.                 self.visibleButtonList[3].SetToggleDownEvent(ui.__mem_func__(self.VisibleCostume), 4, 1)
  378.  
  379.     def RefreshCostumeSlot(self):
  380.         getItemVNum=player.GetItemIndex
  381.  
  382.         for i in xrange(item.COSTUME_SLOT_COUNT):
  383.             slotNumber = item.COSTUME_SLOT_START + i
  384.             self.wndEquip.SetItemSlot(slotNumber, getItemVNum(slotNumber), 0)
  385.             if app.BL_TRANSMUTATION_SYSTEM:
  386.                 if not player.GetChangeLookVnum(player.EQUIPMENT, slotNumber) == 0:
  387.                     self.wndEquip.SetSlotCoverImage(slotNumber,"icon/item/ingame_convert_Mark.tga")
  388.                 else:
  389.                     self.wndEquip.EnableSlotCoverImage(slotNumber,False)
  390.  
  391.         if app.ENABLE_WEAPON_COSTUME_SYSTEM:
  392.             self.wndEquip.SetItemSlot(item.COSTUME_SLOT_WEAPON, getItemVNum(item.COSTUME_SLOT_WEAPON), 0)
  393.  
  394.         self.wndEquip.RefreshSlot()
  395.  
  396.     # def __costume(self):
  397.         # constInfo.costume = 1
  398.         # event.QuestButtonClick(int(constInfo.QUEST_INDEX_06))
  399.         # net.SendQuestInputStringPacket(str(constInfo.costume))
  400.  
  401.     if app.ENABLE_HIDE_COSTUME_SYSTEM:
  402.         def RefreshVisibleCostume(self):
  403.             body = constInfo.HIDDEN_BODY_COSTUME
  404.             hair = constInfo.HIDDEN_HAIR_COSTUME
  405.             if app.ENABLE_ACCE_SYSTEM:
  406.                 acce = constInfo.HIDDEN_ACCE_COSTUME
  407.             if app.ENABLE_WEAPON_COSTUME_SYSTEM:
  408.                 weapon = constInfo.HIDDEN_WEAPON_COSTUME
  409.  
  410.             if body == 1:
  411.                 self.visibleButtonList[0].SetToolTipText(localeInfo.SHOW_COSTUME)
  412.                 self.visibleButtonList[0].Down()
  413.             else:
  414.                 self.visibleButtonList[0].SetToolTipText(localeInfo.HIDE_COSTUME)
  415.                 self.visibleButtonList[0].SetUp()
  416.  
  417.             if hair == 1:
  418.                 self.visibleButtonList[1].SetToolTipText(localeInfo.SHOW_COSTUME)
  419.                 self.visibleButtonList[1].Down()
  420.             else:
  421.                 self.visibleButtonList[1].SetToolTipText(localeInfo.HIDE_COSTUME)
  422.                 self.visibleButtonList[1].SetUp()
  423.  
  424.             if app.ENABLE_ACCE_SYSTEM:
  425.                 if acce == 1:
  426.                     self.visibleButtonList[2].SetToolTipText(localeInfo.SHOW_COSTUME)
  427.                     self.visibleButtonList[2].Down()
  428.                 else:
  429.                     self.visibleButtonList[2].SetToolTipText(localeInfo.HIDE_COSTUME)
  430.                     self.visibleButtonList[2].SetUp()
  431.  
  432.             if app.ENABLE_WEAPON_COSTUME_SYSTEM:
  433.                 if weapon == 1:
  434.                     self.visibleButtonList[3].SetToolTipText(localeInfo.SHOW_COSTUME)
  435.                     self.visibleButtonList[3].Down()
  436.                 else:
  437.                     self.visibleButtonList[3].SetToolTipText(localeInfo.HIDE_COSTUME)
  438.                     self.visibleButtonList[3].SetUp()
  439.  
  440.         def VisibleCostume(self, part, hidden):
  441.             net.SendChatPacket("/hide_costume %d %d" % (part, hidden))
  442.  
  443. class InventoryWindow(ui.ScriptWindow):
  444.  
  445.     USE_TYPE_TUPLE = ("USE_CLEAN_SOCKET", "USE_CHANGE_ATTRIBUTE", "USE_ADD_ATTRIBUTE", "USE_ADD_ATTRIBUTE2", "USE_ADD_ACCESSORY_SOCKET", "USE_PUT_INTO_ACCESSORY_SOCKET", "USE_PUT_INTO_BELT_SOCKET", "USE_PUT_INTO_RING_SOCKET", "USE_CHANGE_COSTUME_ATTR", "USE_RESET_COSTUME_ATTR")
  446.  
  447.     questionDialog = None
  448.     tooltipItem = None
  449.     wndCostume = None
  450.     wndBelt = None
  451.     dlgPickMoney = None
  452.     interface = None
  453.     if app.WJ_ENABLE_TRADABLE_ICON:
  454.         bindWnds = []
  455.     if app.ENABLE_CHEQUE_SYSTEM:
  456.         dlgPickETC = None
  457.  
  458.     sellingSlotNumber = -1
  459.     isLoaded = 0
  460.     isOpenedCostumeWindowWhenClosingInventory = 0
  461.     IsOpenedDisbandButton = 0
  462.    
  463.     def __init__(self):
  464.         if app.ENABLE_CHEQUE_SYSTEM:
  465.             self.wndExpandedMoneyBar = None
  466.         if app.__RENEWAL_BRAVE_CAPE__:
  467.             self.wndBraveCape = None
  468.         ui.ScriptWindow.__init__(self)
  469.  
  470.         self.inventoryPageIndex = 0
  471.  
  472.         self.__LoadWindow()
  473.  
  474.     def __del__(self):
  475.         if app.ENABLE_CHEQUE_SYSTEM:
  476.             self.wndExpandedMoneyBar = None
  477.         if app.__RENEWAL_BRAVE_CAPE__:
  478.             self.wndBraveCape = None
  479.         ui.ScriptWindow.__del__(self)
  480.  
  481.     def Show(self):
  482.         self.__LoadWindow()
  483.  
  484.         ui.ScriptWindow.Show(self)
  485.         self.RefreshItemSlot()
  486.         self.RefreshStatus()
  487.  
  488.         # If the costume was open when the inventory was closed, the costume will also be opened when the inventory is opened.
  489.         if self.isOpenedCostumeWindowWhenClosingInventory and self.wndCostume:
  490.             self.wndCostume.Show()
  491.  
  492.         if app.ENABLE_CHEQUE_SYSTEM:
  493.             if self.wndExpandedMoneyBar:
  494.                 self.wndExpandedMoneyBar.Show()
  495.  
  496.     def BindInterfaceClass(self, interface):
  497.         from _weakref import proxy
  498.         self.interface = proxy(interface)
  499.  
  500.     if app.WJ_ENABLE_TRADABLE_ICON:
  501.         def BindWindow(self, wnd):
  502.             self.bindWnds.append(wnd)
  503.  
  504.     def __LoadWindow(self):
  505.         if self.isLoaded == 1:
  506.             return
  507.  
  508.         self.isLoaded = 1
  509.  
  510.         try:
  511.             pyScrLoader = ui.PythonScriptLoader()
  512.  
  513.             if ITEM_MALL_BUTTON_ENABLE:
  514.                 if app.ENABLE_EXTEND_INVEN_SYSTEM:
  515.                     pyScrLoader.LoadScriptFile(self, uiScriptLocale.LOCALE_UISCRIPT_PATH + "New_InventoryWindow.py")
  516.                 else:
  517.                     pyScrLoader.LoadScriptFile(self, uiScriptLocale.LOCALE_UISCRIPT_PATH + "InventoryWindow.py")
  518.             else:
  519.                 if app.ENABLE_EXTEND_INVEN_SYSTEM:
  520.                     pyScrLoader.LoadScriptFile(self, "UIScript/New_InventoryWindow.py")
  521.                 else:
  522.                     pyScrLoader.LoadScriptFile(self, "UIScript/InventoryWindow.py")
  523.         except:
  524.             import exception
  525.             exception.Abort("InventoryWindow.LoadWindow.LoadObject")
  526.  
  527.         try:
  528.             wndItem = self.GetChild("ItemSlot")
  529.             wndEquip = self.GetChild("EquipmentSlot")
  530.             self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
  531.             self.wndMoney = self.GetChild("Money")
  532.             self.wndMoneySlot = self.GetChild("Money_Slot")
  533.             self.mallButton = self.GetChild2("MallButton")
  534.             self.DSSButton = self.GetChild2("DSSButton")
  535.             self.costumeButton = self.GetChild2("CostumeButton")
  536.             if app.ENABLE_CHEQUE_SYSTEM:
  537.                 self.wndCheque = self.GetChild("Cheque")
  538.                 self.wndChequeSlot = self.GetChild("Cheque_Slot")
  539.  
  540.                 if app.ENABLE_CHEQUE_SYSTEM:
  541.                     self.wndMoneyIcon = self.GetChild("Money_Icon")
  542.                     self.wndChequeIcon = self.GetChild("Cheque_Icon")
  543.                     self.wndMoneyIcon.Hide()
  544.                     self.wndMoneySlot.Hide()
  545.                     self.wndChequeIcon.Hide()
  546.                     self.wndChequeSlot.Hide()
  547.  
  548.                     ## height adjustment
  549.                     height = self.GetHeight()
  550.                     width = self.GetWidth()
  551.                     self.SetSize(width, height - 22)
  552.                     self.GetChild("board").SetSize(width, height - 22)
  553.                 else:
  554.                     self.wndMoneyIcon = self.GetChild("Money_Icon")
  555.                     self.wndChequeIcon = self.GetChild("Cheque_Icon")
  556.  
  557.                     self.wndMoneyIcon.SetEvent(ui.__mem_func__(self.EventProgress), "mouse_over_in", 0)
  558.                     self.wndChequeIcon.SetEvent(ui.__mem_func__(self.EventProgress), "mouse_over_in", 1)
  559.  
  560.                     self.wndMoneyIcon.SetEvent(ui.__mem_func__(self.EventProgress), "mouse_over_out", 0)
  561.                     self.wndChequeIcon.SetEvent(ui.__mem_func__(self.EventProgress), "mouse_over_out", 1)
  562.  
  563.                     self.toolTip = uiToolTip.ToolTip()
  564.                     self.toolTip.ClearToolTip()
  565.  
  566.             self.inventoryTab = []
  567.             self.inventoryTab.append(self.GetChild("Inventory_Tab_01"))
  568.             self.inventoryTab.append(self.GetChild("Inventory_Tab_02"))
  569.             if app.ENABLE_EXTEND_INVEN_SYSTEM:
  570.                 self.inventoryTab.append(self.GetChild("Inventory_Tab_03"))
  571.                 self.inventoryTab.append(self.GetChild("Inventory_Tab_04"))
  572.  
  573.             self.equipmentTab = []
  574.             self.equipmentTab.append(self.GetChild("Equipment_Tab_01"))
  575.             self.equipmentTab.append(self.GetChild("Equipment_Tab_02"))
  576.  
  577.             # if app.ENABLE_SORT_INVEN:
  578.                 # self.yenilebutton = self.GetChild2("YenileButton")
  579.                 # self.yenilebutton.SetEvent(ui.__mem_func__(self.ClickYenileButton))
  580.                 # self.tooltipI = uiToolTip.ToolTip()
  581.                 # self.tooltipI.Hide()
  582.                 # self.tooltipInfo = [self.tooltipI]*4
  583.                 # self.InformationText = [localeInfo.YENILE_BUTTON_TITLE,
  584.                                         # localeInfo.YENILE_BUTTON,
  585.                                         # localeInfo.YENILE_BUTTON2,
  586.                                         # localeInfo.YENILE_BUTTON3
  587.                 # ]
  588.                 # for i in xrange(len(self.tooltipInfo)):
  589.                     # self.tooltipInfo[i].SetFollow(True)
  590.                     # self.tooltipInfo[i].AlignHorizonalCenter()
  591.                     # if i == 0:
  592.                         # self.tooltipInfo[i].AppendTextLine(self.InformationText[i], 0xffffff00)
  593.                     # else:
  594.                         # self.tooltipInfo[i].AppendTextLine(self.InformationText[i])
  595.                     # self.tooltipInfo[i].Hide()
  596.  
  597.             if app.BL_TRANSMUTATION_SYSTEM:
  598.                 self.dlgQuestion = uiCommon.QuestionDialog2()
  599.                 self.dlgQuestion.Close()
  600.                 self.listHighlightedChangeLookSlot = []
  601.  
  602.             if app.BL_ENABLE_PICKUP_ITEM_EFFECT:
  603.                 self.listHighlightedSlot = []
  604.  
  605.             if self.costumeButton and not app.ENABLE_COSTUME_SYSTEM:
  606.                 self.costumeButton.Hide()
  607.                 self.costumeButton.Destroy()
  608.                 self.costumeButton = 0
  609.  
  610.             # Belt Inventory Window
  611.             # self.wndBelt = None
  612.  
  613.             # if app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  614.                 # self.wndBelt = BeltInventoryWindow(self)
  615.  
  616.         except:
  617.             import exception
  618.             exception.Abort("InventoryWindow.LoadWindow.BindObject")
  619.  
  620.         ## Item
  621.         wndItem.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  622.         wndItem.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  623.         wndItem.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  624.         wndItem.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  625.         wndItem.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  626.         wndItem.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  627.  
  628.         ## Equipment
  629.         wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  630.         wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  631.         wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  632.         wndEquip.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  633.         wndEquip.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  634.         wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  635.  
  636.         ## PickMoneyDialog
  637.         dlgPickMoney = uiPickMoney.PickMoneyDialog()
  638.         dlgPickMoney.LoadDialog()
  639.         dlgPickMoney.Hide()
  640.  
  641.         ## PickETCDialog
  642.         if app.ENABLE_CHEQUE_SYSTEM:
  643.             dlgPickETC = uiPickETC.PickETCDialog()
  644.             dlgPickETC.LoadDialog()
  645.             dlgPickETC.Hide()
  646.  
  647.         ## RefineDialog
  648.         self.refineDialog = uiRefine.RefineDialog()
  649.         self.refineDialog.Hide()
  650.  
  651.         ## AttachMetinDialog
  652.         if app.WJ_ENABLE_TRADABLE_ICON:  
  653.             self.attachMetinDialog = uiAttachMetin.AttachMetinDialog(self)
  654.             self.BindWindow(self.attachMetinDialog)
  655.         else:
  656.             self.attachMetinDialog = uiAttachMetin.AttachMetinDialog()
  657.         self.attachMetinDialog.Hide()
  658.  
  659.         ## MoneySlot
  660.         if app.ENABLE_CHEQUE_SYSTEM:
  661.             self.wndMoneySlot.SetEvent(ui.__mem_func__(self.OpenPickMoneyDialog), 0)
  662.             self.wndChequeSlot.SetEvent(ui.__mem_func__(self.OpenPickMoneyDialog), 1)
  663.         else:
  664.             self.wndMoneySlot.SetEvent(ui.__mem_func__(self.OpenPickMoneyDialog))
  665.  
  666.         if app.ENABLE_EXTEND_INVEN_SYSTEM:
  667.             for inven_index in range(player.INVENTORY_PAGE_COUNT): ## 0, 1, 2, 3
  668.                 self.inventoryTab[inven_index].SetEvent(lambda arg=inven_index: self.SetInventoryPage(arg))
  669.         else:
  670.             self.inventoryTab[0].SetEvent(lambda arg=0: self.SetInventoryPage(arg))
  671.             self.inventoryTab[1].SetEvent(lambda arg=1: self.SetInventoryPage(arg))
  672.         self.inventoryTab[0].Down()
  673.  
  674.         self.equipmentTab[0].SetEvent(lambda arg=0: self.SetEquipmentPage(arg))
  675.         self.equipmentTab[1].SetEvent(lambda arg=1: self.SetEquipmentPage(arg))
  676.         self.equipmentTab[0].Down()
  677.         self.equipmentTab[0].Hide()
  678.         self.equipmentTab[1].Hide()
  679.  
  680.         self.wndItem = wndItem
  681.         self.wndEquip = wndEquip
  682.         self.dlgPickMoney = dlgPickMoney
  683.         if app.ENABLE_CHEQUE_SYSTEM:
  684.             self.dlgPickETC = dlgPickETC
  685.  
  686.         # MallButton
  687.         if self.mallButton:
  688.             self.mallButton.SetEvent(ui.__mem_func__(self.ClickMallButton))
  689.  
  690.         if self.DSSButton:
  691.             self.DSSButton.SetEvent(ui.__mem_func__(self.ClickDSSButton))
  692.  
  693.         # Costume Button
  694.         if self.costumeButton:
  695.             self.costumeButton.SetEvent(ui.__mem_func__(self.ClickCostumeButton))
  696.  
  697.         self.wndCostume = None
  698.  
  699.         if app.__RENEWAL_BRAVE_CAPE__:
  700.             self.wndBraveCape = None
  701.  
  702.         #####
  703.  
  704.         if app.ENABLE_ACCE_SYSTEM:
  705.             self.listAttachedAcces = []
  706.  
  707.         if app.__RENEWAL_BRAVE_CAPE__:
  708.             disbandBtn = ui.Button()
  709.             disbandBtn.SetParent(self)
  710.             disbandBtn.SetPosition(0, 220)
  711.             disbandBtn.SetUpVisual("d:/ymir work/ui/game/belt_inventory/btn_expand_normal.tga")
  712.             disbandBtn.SetOverVisual("d:/ymir work/ui/game/belt_inventory/btn_expand_over.tga")
  713.             disbandBtn.SetDownVisual("d:/ymir work/ui/game/belt_inventory/btn_expand_down.tga")
  714.             disbandBtn.SAFE_SetEvent(self.ClickBraveCape)
  715.             disbandBtn.Show()
  716.             self.disbandBtn = disbandBtn
  717.  
  718.             self.wndBraveCape = BraveCapeWindow()
  719.             self.OnMoveWindow(*self.GetGlobalPosition())
  720.  
  721.         ## Refresh
  722.         self.SetInventoryPage(0)
  723.         self.SetEquipmentPage(0)
  724.         self.RefreshItemSlot()
  725.         self.RefreshStatus()
  726.  
  727.     def Destroy(self):
  728.         self.ClearDictionary()
  729.  
  730.         self.dlgPickMoney.Destroy()
  731.         self.dlgPickMoney = 0
  732.  
  733.         if app.ENABLE_CHEQUE_SYSTEM:
  734.             self.dlgPickETC.Destroy()
  735.             self.dlgPickETC = 0
  736.  
  737.         self.refineDialog.Destroy()
  738.         self.refineDialog = 0
  739.  
  740.         self.attachMetinDialog.Destroy()
  741.         self.attachMetinDialog = 0
  742.  
  743.         self.tooltipItem = None
  744.         self.wndItem = 0
  745.         self.wndEquip = 0
  746.         self.dlgPickMoney = 0
  747.         self.wndMoney = 0
  748.         self.wndMoneySlot = 0
  749.  
  750.         if app.ENABLE_CHEQUE_SYSTEM:
  751.             self.wndCheque = 0
  752.             self.wndChequeSlot = 0
  753.             self.dlgPickETC = 0
  754.  
  755.         self.questionDialog = None
  756.         self.mallButton = None
  757.         self.DSSButton = None
  758.         self.interface = None
  759.  
  760.         if app.WJ_ENABLE_TRADABLE_ICON:
  761.             self.bindWnds = []
  762.  
  763.         if self.wndCostume:
  764.             self.wndCostume.Destroy()
  765.             self.wndCostume = 0
  766.  
  767.         if app.__RENEWAL_BRAVE_CAPE__:
  768.             if self.wndBraveCape:
  769.                 self.wndBraveCape.Destroy()
  770.                 self.wndBraveCape = None
  771.  
  772.         if self.wndBelt:
  773.             self.wndBelt.Destroy()
  774.             self.wndBelt = None
  775.  
  776.         if app.BL_TRANSMUTATION_SYSTEM:
  777.             self.dlgQuestion = None
  778.  
  779.         self.inventoryTab = []
  780.         self.equipmentTab = []
  781.  
  782.         if app.ENABLE_CHEQUE_SYSTEM:
  783.             self.wndExpandedMoneyBar = None
  784.  
  785.     def Hide(self):
  786.         if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS():
  787.             self.OnCloseQuestionDialog()
  788.             return
  789.  
  790.         if None != self.tooltipItem:
  791.             self.tooltipItem.HideToolTip()
  792.  
  793.         if self.wndCostume:
  794.             self.isOpenedCostumeWindowWhenClosingInventory = self.wndCostume.IsShow()           # Was the costume open when the inventory window was closed?
  795.             self.wndCostume.Close()
  796.  
  797.         if app.__RENEWAL_BRAVE_CAPE__:
  798.             if self.wndBraveCape:
  799.                 self.IsOpenedDisbandButton = self.disbandBtn.Show
  800.                 self.wndBraveCape.Close()
  801.  
  802.         if self.dlgPickMoney:
  803.             self.dlgPickMoney.Close()
  804.  
  805.         if app.ENABLE_CHEQUE_SYSTEM:
  806.             if self.dlgPickETC:
  807.                 self.dlgPickETC.Close()
  808.  
  809.         wndMgr.Hide(self.hWnd)
  810.  
  811.     def Close(self):
  812.         self.Hide()
  813.  
  814.     if app.ENABLE_CHEQUE_SYSTEM:
  815.         def SetExpandedMoneyBar(self, wndBar):
  816.             self.wndExpandedMoneyBar = wndBar
  817.             if self.wndExpandedMoneyBar:
  818.                 self.wndMoneySlot = self.wndExpandedMoneyBar.GetMoneySlot()
  819.                 self.wndMoney = self.wndExpandedMoneyBar.GetMoney()
  820.                 if app.ENABLE_CHEQUE_SYSTEM:
  821.                     self.wndMoneyIcon = self.wndExpandedMoneyBar.GetMoneyIcon()
  822.                     if self.wndMoneyIcon:
  823.                         self.wndMoneyIcon.SetEvent(ui.__mem_func__(self.EventProgress), "mouse_over_in", 0)
  824.                         self.wndMoneyIcon.SetEvent(ui.__mem_func__(self.EventProgress), "mouse_over_out", 0)
  825.                     if self.wndMoneySlot:
  826.                         self.wndMoneySlot.SetEvent(ui.__mem_func__(self.OpenPickMoneyDialog), 0)
  827.                     self.wndChequeIcon = self.wndExpandedMoneyBar.GetChequeIcon()
  828.                     if self.wndChequeIcon:
  829.                         self.wndChequeIcon.SetEvent(ui.__mem_func__(self.EventProgress), "mouse_over_in", 1)
  830.                         self.wndChequeIcon.SetEvent(ui.__mem_func__(self.EventProgress), "mouse_over_out", 1)
  831.                     self.wndChequeSlot = self.wndExpandedMoneyBar.GetChequeSlot()
  832.                     if self.wndChequeSlot:
  833.                         self.wndChequeSlot.SetEvent(ui.__mem_func__(self.OpenPickMoneyDialog), 1)
  834.                     self.wndCheque = self.wndExpandedMoneyBar.GetCheque()
  835.                     self.toolTip = uiToolTip.ToolTip()
  836.                     self.toolTip.ClearToolTip()
  837.                 else:
  838.                     if self.wndMoneySlot:
  839.                         self.wndMoneySlot.SetEvent(ui.__mem_func__(self.OpenPickMoneyDialog))
  840.  
  841.     # if app.ENABLE_SORT_INVEN:
  842.         # def ClickYenileButton(self):
  843.             # if app.IsPressed(app.DIK_LALT):
  844.                 # net.SortInven(2)
  845.             # elif app.IsPressed(app.DIK_LCONTROL):
  846.                 # net.SortInven(3)
  847.             # else:
  848.                 # net.SortInven(1)
  849.  
  850.     if app.ENABLE_EXTEND_INVEN_SYSTEM:
  851.         def SetInventoryPage(self, page):
  852.             self.inventoryPageIndex = page
  853.  
  854.             for index in range(len(self.inventoryTab)):
  855.                 if index == page:
  856.                     continue
  857.                 self.inventoryTab[index].SetUp()
  858.  
  859.             self.RefreshBagSlotWindow()
  860.     else:
  861.         def SetInventoryPage(self, page):
  862.             self.inventoryPageIndex = page
  863.             self.inventoryTab[1-page].SetUp()
  864.             self.RefreshBagSlotWindow()
  865.  
  866.     def SetEquipmentPage(self, page):
  867.         self.equipmentPageIndex = page
  868.         self.equipmentTab[1-page].SetUp()
  869.         self.RefreshEquipSlotWindow()
  870.  
  871.     def ClickMallButton(self):
  872.         print "click_mall_button"
  873.         net.SendChatPacket("/click_mall")
  874.  
  875.     # DSSButton
  876.     def ClickDSSButton(self):
  877.         print "click_dss_button"
  878.         self.interface.ToggleDragonSoulWindow()
  879.  
  880.     if app.__RENEWAL_BRAVE_CAPE__:
  881.         def ClickBraveCape(self):
  882.             if self.wndBraveCape:
  883.                 if self.wndBraveCape.IsShow():
  884.                     self.wndBraveCape.Close()
  885.                 else:
  886.                     self.wndBraveCape.Open()
  887.  
  888.     def ClickCostumeButton(self):
  889.         print "Click Costume Button"
  890.         if self.wndCostume:
  891.             if self.wndCostume.IsShow():
  892.                 self.wndCostume.Hide()
  893.             else:
  894.                 self.wndCostume.Show()
  895.         else:
  896.             self.wndCostume = CostumeWindow(self)
  897.             self.wndCostume.Show()
  898.  
  899.     if app.ENABLE_CHEQUE_SYSTEM:
  900.         def OpenPickMoneyDialog(self, focus_idx = 0):
  901.             if mouseModule.mouseController.isAttached():
  902.  
  903.                 attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  904.                 if player.SLOT_TYPE_SAFEBOX == mouseModule.mouseController.GetAttachedType():
  905.  
  906.                     if player.ITEM_MONEY == mouseModule.mouseController.GetAttachedItemIndex():
  907.                         net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
  908.                         snd.PlaySound("sound/ui/money.wav")
  909.  
  910.                 mouseModule.mouseController.DeattachObject()
  911.  
  912.             else:
  913.                 curMoney = player.GetElk()
  914.                 curCheque = player.GetCheque()
  915.  
  916.                 if curMoney <= 0 and curCheque <= 0:
  917.                     return
  918.  
  919.                 self.dlgPickMoney.SetTitleName(localeInfo.PICK_MONEY_TITLE)
  920.                 self.dlgPickMoney.SetAcceptEvent(ui.__mem_func__(self.OnPickMoney))
  921.                 self.dlgPickMoney.Open(curMoney, curCheque)
  922.                 self.dlgPickMoney.SetMax(9) # 인벤토리 990000 제한 버그 수정
  923.                 self.dlgPickMoney.SetMaxCheque(3)
  924.                 self.dlgPickMoney.SetFocus(focus_idx)
  925.     else:
  926.         def OpenPickMoneyDialog(self):
  927.  
  928.             if mouseModule.mouseController.isAttached():
  929.  
  930.                 attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  931.                 if player.SLOT_TYPE_SAFEBOX == mouseModule.mouseController.GetAttachedType():
  932.  
  933.                     if player.ITEM_MONEY == mouseModule.mouseController.GetAttachedItemIndex():
  934.                         net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
  935.                         snd.PlaySound("sound/ui/money.wav")
  936.  
  937.                 mouseModule.mouseController.DeattachObject()
  938.  
  939.             else:
  940.                 curMoney = player.GetElk()
  941.  
  942.                 if curMoney <= 0:
  943.                     return
  944.  
  945.                 self.dlgPickMoney.SetTitleName(localeInfo.PICK_MONEY_TITLE)
  946.                 self.dlgPickMoney.SetAcceptEvent(ui.__mem_func__(self.OnPickMoney))
  947.                 self.dlgPickMoney.Open(curMoney)
  948.                 self.dlgPickMoney.SetMax(9)
  949.  
  950.     if app.ENABLE_CHEQUE_SYSTEM:
  951.         def OnPickMoney(self, money, cheque):
  952.             if cheque > 0 and money > 0:
  953.                 chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CHEQUE_ONLY_VALUE)
  954.                 return
  955.             if cheque > 0:
  956.                 mouseModule.mouseController.AttacCheque(self, player.SLOT_TYPE_INVENTORY, cheque)
  957.             else:
  958.                 mouseModule.mouseController.AttachMoney(self, player.SLOT_TYPE_INVENTORY, money)
  959.     else:
  960.         def OnPickMoney(self, money):
  961.             mouseModule.mouseController.AttachMoney(self, player.SLOT_TYPE_INVENTORY, money)
  962.  
  963.     def OnPickItem(self, count):
  964.         if app.ENABLE_CHEQUE_SYSTEM:
  965.             itemSlotIndex = self.dlgPickETC.itemGlobalSlotIndex
  966.         else:
  967.             itemSlotIndex = self.dlgPickMoney.itemGlobalSlotIndex
  968.         selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  969.         mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, count)
  970.  
  971.     def __InventoryLocalSlotPosToGlobalSlotPos(self, local):
  972.         if player.IsEquipmentSlot(local) or player.IsCostumeSlot(local) or (app.ENABLE_NEW_EQUIPMENT_SYSTEM and player.IsBeltInventorySlot(local)):
  973.             return local
  974.  
  975.         return self.inventoryPageIndex*player.INVENTORY_PAGE_SIZE + local
  976.  
  977.     def GetInventoryPageIndex(self):
  978.         return self.inventoryPageIndex
  979.  
  980.     if app.WJ_ENABLE_TRADABLE_ICON:
  981.         def RefreshMarkSlots(self, localIndex=None):
  982.             if not self.interface:
  983.                 return
  984.             if not self.wndItem:
  985.                 return
  986.  
  987.             onTopWnd = self.interface.GetOnTopWindow()
  988.             if localIndex:
  989.                 slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(localIndex)
  990.                 if onTopWnd == player.ON_TOP_WND_NONE:
  991.                     self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  992.  
  993.                 elif onTopWnd == player.ON_TOP_WND_SHOP:
  994.                     if player.IsAntiFlagBySlot(slotNumber, item.ANTIFLAG_SELL):
  995.                         self.wndItem.SetUnusableSlotOnTopWnd(localIndex)
  996.                     else:
  997.                         self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  998.  
  999.                 elif onTopWnd == player.ON_TOP_WND_EXCHANGE:
  1000.                     if player.IsAntiFlagBySlot(slotNumber, item.ANTIFLAG_GIVE):
  1001.                         self.wndItem.SetUnusableSlotOnTopWnd(localIndex)
  1002.                     else:
  1003.                         self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  1004.  
  1005.                 elif onTopWnd == player.ON_TOP_WND_PRIVATE_SHOP:
  1006.                     if player.IsAntiFlagBySlot(slotNumber, item.ITEM_ANTIFLAG_MYSHOP):
  1007.                         self.wndItem.SetUnusableSlotOnTopWnd(localIndex)
  1008.                     else:
  1009.                         self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  1010.  
  1011.                 elif onTopWnd == player.ON_TOP_WND_SAFEBOX:
  1012.                     if player.IsAntiFlagBySlot(slotNumber, item.ANTIFLAG_SAFEBOX):
  1013.                         self.wndItem.SetUnusableSlotOnTopWnd(localIndex)
  1014.                     else:
  1015.                         self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  1016.  
  1017.                 elif app.BL_MAILBOX and onTopWnd == player.ON_TOP_WND_MAILBOX:
  1018.                     if self.interface.MarkUnusableDSInvenSlotOnTopWnd(onTopWnd, slotNumber, player.INVENTORY):
  1019.                         self.wndItem.SetUnusableSlotOnTopWnd(localIndex)
  1020.                     else:
  1021.                         self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  1022.  
  1023.                 # elif app.ENABLE_ACCE_SYSTEM and onTopWnd == player.ON_TOP_WND_ACCE_COMBINE:
  1024.                     # if not (player.GetItemTypeBySlot(player.INVENTORY, slotNumber) == item.ITEM_TYPE_COSTUME and player.GetItemSubTypeBySlot(player.INVENTORY, slotNumber) == item.COSTUME_TYPE_ACCE):
  1025.                         # if app.ENABLE_SEALBIND_SYSTEM and player.IsSealedItemBySlot(player.INVENTORY, slotNumber):
  1026.                             # self.wndItem.SetUnusableSlotOnTopWnd(localIndex)
  1027.                         # else:
  1028.                             # self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  1029.                     # else:
  1030.                         # self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  1031.  
  1032.                 # elif app.ENABLE_ACCE_SYSTEM and onTopWnd == player.ON_TOP_WND_ACCE_ABSORB:
  1033.                     # if not (player.GetItemTypeBySlot(player.INVENTORY, slotNumber) == item.ITEM_TYPE_WEAPON and player.GetItemSubTypeBySlot(player.INVENTORY, slotNumber) != item.WEAPON_ARROW or (app.ENABLE_QUIVER_SYSTEM and player.GetItemTypeBySlot(player.INVENTORY, slotNumber) == item.ITEM_TYPE_WEAPON and player.GetItemSubTypeBySlot(player.INVENTORY, slotNumber) == item.WEAPON_QUIVER) or (player.GetItemTypeBySlot(player.INVENTORY, slotNumber) == item.ITEM_TYPE_COSTUME and player.GetItemSubTypeBySlot(player.INVENTORY, slotNumber) == item.COSTUME_TYPE_ACCE) or (player.GetItemTypeBySlot(player.INVENTORY, slotNumber) == item.ITEM_TYPE_ARMOR and player.GetItemSubTypeBySlot(player.INVENTORY, slotNumber) == item.ARMOR_BODY)):
  1034.                         # if app.ENABLE_SEALBIND_SYSTEM and player.IsSealedItemBySlot(player.INVENTORY, slotNumber):
  1035.                             # self.wndItem.SetUnusableSlotOnTopWnd(localIndex)
  1036.                         # else:
  1037.                             # self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  1038.                     # else:
  1039.                         # self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  1040.  
  1041.                 #elif app.ENABLE_ACCE_SYSTEM and onTopWnd == player.ON_TOP_WND_ACCE_RESTORE:
  1042.                 #   if ():
  1043.                 #       self.wndItem.SetUnusableSlotOnTopWnd(localIndex)
  1044.                 #   else:
  1045.                 #       self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  1046.  
  1047.                 return
  1048.  
  1049.             for i in xrange(player.INVENTORY_PAGE_SIZE):
  1050.                 slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i)
  1051.  
  1052.                 if onTopWnd == player.ON_TOP_WND_NONE:
  1053.                     self.wndItem.SetUsableSlotOnTopWnd(i)
  1054.  
  1055.                 elif onTopWnd == player.ON_TOP_WND_SHOP:
  1056.                     if player.IsAntiFlagBySlot(slotNumber, item.ANTIFLAG_SELL):
  1057.                         self.wndItem.SetUnusableSlotOnTopWnd(i)
  1058.                     else:
  1059.                         self.wndItem.SetUsableSlotOnTopWnd(i)
  1060.  
  1061.                 elif onTopWnd == player.ON_TOP_WND_EXCHANGE:
  1062.                     if player.IsAntiFlagBySlot(slotNumber, item.ANTIFLAG_GIVE):
  1063.                         self.wndItem.SetUnusableSlotOnTopWnd(i)
  1064.                     else:
  1065.                         self.wndItem.SetUsableSlotOnTopWnd(i)
  1066.  
  1067.                 elif onTopWnd == player.ON_TOP_WND_PRIVATE_SHOP:
  1068.                     if player.IsAntiFlagBySlot(slotNumber, item.ITEM_ANTIFLAG_MYSHOP):
  1069.                         self.wndItem.SetUnusableSlotOnTopWnd(i)
  1070.                     else:
  1071.                         self.wndItem.SetUsableSlotOnTopWnd(i)
  1072.  
  1073.                 elif onTopWnd == player.ON_TOP_WND_SAFEBOX:
  1074.                     if player.IsAntiFlagBySlot(slotNumber, item.ANTIFLAG_SAFEBOX):
  1075.                         self.wndItem.SetUnusableSlotOnTopWnd(i)
  1076.                     else:
  1077.                         self.wndItem.SetUsableSlotOnTopWnd(i)
  1078.  
  1079.                 elif app.BL_MAILBOX and onTopWnd == player.ON_TOP_WND_MAILBOX:
  1080.                     if self.interface.MarkUnusableDSInvenSlotOnTopWnd(onTopWnd, slotNumber, player.INVENTORY):
  1081.                         self.wndItem.SetUnusableSlotOnTopWnd(i)
  1082.                     else:
  1083.                         self.wndItem.SetUsableSlotOnTopWnd(i)
  1084.  
  1085.                 # elif app.ENABLE_ACCE_SYSTEM and onTopWnd == player.ON_TOP_WND_ACCE_COMBINE:
  1086.                     # if not (player.GetItemTypeBySlot(player.INVENTORY, slotNumber) == item.ITEM_TYPE_COSTUME and player.GetItemSubTypeBySlot(player.INVENTORY, slotNumber) == item.COSTUME_TYPE_ACCE):
  1087.                         # if app.ENABLE_SEALBIND_SYSTEM and player.IsSealedItemBySlot(player.INVENTORY, slotNumber):
  1088.                             # self.wndItem.SetUnusableSlotOnTopWnd(i)
  1089.                         # else:
  1090.                             # self.wndItem.SetUsableSlotOnTopWnd(i)
  1091.                     # else:
  1092.                         # self.wndItem.SetUsableSlotOnTopWnd(i)
  1093.  
  1094.                 # elif app.ENABLE_ACCE_SYSTEM and onTopWnd == player.ON_TOP_WND_ACCE_ABSORB:
  1095.                     # if not (player.GetItemTypeBySlot(player.INVENTORY, slotNumber) == item.ITEM_TYPE_WEAPON and player.GetItemSubTypeBySlot(player.INVENTORY, slotNumber) != item.WEAPON_ARROW or (app.ENABLE_QUIVER_SYSTEM and player.GetItemTypeBySlot(player.INVENTORY, slotNumber) == item.ITEM_TYPE_WEAPON and player.GetItemSubTypeBySlot(player.INVENTORY, slotNumber) == item.WEAPON_QUIVER) or (player.GetItemTypeBySlot(player.INVENTORY, slotNumber) == item.ITEM_TYPE_COSTUME and player.GetItemSubTypeBySlot(player.INVENTORY, slotNumber) == item.COSTUME_TYPE_ACCE) or (player.GetItemTypeBySlot(player.INVENTORY, slotNumber) == item.ITEM_TYPE_ARMOR and player.GetItemSubTypeBySlot(player.INVENTORY, slotNumber) == item.ARMOR_BODY)):
  1096.                         # if app.ENABLE_SEALBIND_SYSTEM and player.IsSealedItemBySlot(player.INVENTORY, slotNumber):
  1097.                             # self.wndItem.SetUnusableSlotOnTopWnd(i)
  1098.                         # else:
  1099.                             # self.wndItem.SetUsableSlotOnTopWnd(i)
  1100.                     # else:
  1101.                         # self.wndItem.SetUsableSlotOnTopWnd(i)
  1102.  
  1103.     def RefreshBagSlotWindow(self):
  1104.         if not self.wndItem:
  1105.             return
  1106.         getItemVNum=player.GetItemIndex
  1107.         getItemCount=player.GetItemCount
  1108.         setItemVNum=self.wndItem.SetItemSlot
  1109.         if app.BL_ENABLE_PICKUP_ITEM_EFFECT:
  1110.             for i in xrange(self.wndItem.GetSlotCount()):
  1111.                 self.wndItem.DeactivateSlot(i)
  1112.  
  1113.         for i in xrange(player.INVENTORY_PAGE_SIZE):
  1114.             slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i)
  1115.  
  1116.             itemCount = getItemCount(slotNumber)
  1117.             if 0 == itemCount:
  1118.                 self.wndItem.ClearSlot(i)
  1119.                 continue
  1120.             elif 1 == itemCount:
  1121.                 itemCount = 0
  1122.  
  1123.             itemVnum = getItemVNum(slotNumber)
  1124.             setItemVNum(i, itemVnum, itemCount)
  1125.  
  1126.             if app.ENABLE_AFFECT_ITEMS_PLUS:
  1127.                 item.SelectItem(itemVnum)
  1128.                 if item.USE_AFFECT == item.GetItemSubType() and not constInfo.IS_IGNORED_AFF_ITEM(itemVnum):
  1129.                     if player.GetItemMetinSocket(slotNumber, 0) == 1:
  1130.                         self.wndItem.ActivateSlot(i)
  1131.                     else:
  1132.                         self.wndItem.DeactivateSlot(i)
  1133.  
  1134.             ## Auto Potion (HP: #72723 ~ #72726, SP: #72727 ~ #72730) Special processing - This is to display activation/deactivation in the slot even though it is an item - [hyo]
  1135.             if constInfo.IS_AUTO_POTION(itemVnum):
  1136.                 # metinSocket - [0]: Enabled or not, [1]: Amount used, [2]: Maximum capacity
  1137.                 metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
  1138.  
  1139.                 isActivated = 0 != metinSocket[0]
  1140.  
  1141.                 if isActivated:
  1142.                     self.wndItem.ActivateSlotOld(i)
  1143.                     self.wndItem.SetSlotDiffuseColor(i, wndMgr.COLOR_TYPE_YELLOW)
  1144.                     self.wndItem.SetSlotFlashEffect(i, True)
  1145.                     potionType = 0
  1146.                     if constInfo.IS_AUTO_POTION_HP(itemVnum):
  1147.                         potionType = player.AUTO_POTION_TYPE_HP
  1148.                     elif constInfo.IS_AUTO_POTION_SP(itemVnum):
  1149.                         potionType = player.AUTO_POTION_TYPE_SP
  1150.  
  1151.                     usedAmount = int(metinSocket[1])
  1152.                     totalAmount = int(metinSocket[2])
  1153.                     player.SetAutoPotionInfo(potionType, isActivated, (totalAmount - usedAmount), totalAmount, self.__InventoryLocalSlotPosToGlobalSlotPos(i))
  1154.                 else:
  1155.                     self.wndItem.DeactivateSlotOld(i)
  1156.  
  1157.             if app.ENABLE_SOUL_SYSTEM:
  1158.                 if item.IsSoulItem(itemVnum):
  1159.                     metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
  1160.                     tempSlotNum = slotNumber
  1161.                     if tempSlotNum >= player.INVENTORY_PAGE_SIZE:
  1162.                         tempSlotNum -= (self.inventoryPageIndex * player.INVENTORY_PAGE_SIZE)
  1163.  
  1164.                     if 0 != metinSocket[1]:
  1165.                         self.wndItem.ActivateSlot(tempSlotNum)
  1166.                     else:
  1167.                         self.wndItem.DeactivateSlot(tempSlotNum)
  1168.  
  1169.             if app.WJ_ENABLE_TRADABLE_ICON:
  1170.                 self.RefreshMarkSlots(i)
  1171.  
  1172.             if app.ENABLE_DEWS_PLUS:
  1173.                 if constInfo.IS_DEW(itemVnum):
  1174.                     if player.GetItemMetinSocket(slotNumber, 2) == 1:
  1175.                         self.wndItem.ActivateSlot(i)
  1176.                     else:
  1177.                         self.wndItem.DeactivateSlot(i)
  1178.            
  1179.             if app.ENABLE_ACCE_SYSTEM:
  1180.                 slotNumberChecked = 0
  1181.                 # if not constInfo.IS_AUTO_POTION(itemVnum) and not (item.USE_AFFECT == item.GetItemSubType() and not constInfo.IS_IGNORED_AFF_ITEM(itemVnum)):
  1182.                 if not constInfo.IS_AUTO_POTION(itemVnum) and not constInfo.IS_DEW(itemVnum) and not (item.USE_AFFECT == item.GetItemSubType() and not constInfo.IS_IGNORED_AFF_ITEM(itemVnum)):
  1183.                     # if app.BL_ENABLE_PICKUP_ITEM_EFFECT:
  1184.                         # if not slotNumber in self.liHighlightedItems:
  1185.                             # self.wndItem.DeactivateSlot(i)
  1186.                     # else:
  1187.                     self.wndItem.DeactivateSlot(i)
  1188.                
  1189.                 for j in xrange(acce.WINDOW_MAX_MATERIALS):
  1190.                     (isHere, iCell) = acce.GetAttachedItem(j)
  1191.                     if isHere:
  1192.                         if iCell == slotNumber:
  1193.                             self.wndItem.ActivateSlot(i, (36.00 / 255.0), (222.00 / 255.0), (3.00 / 255.0), 1.0)
  1194.                             if not slotNumber in self.listAttachedAcces:
  1195.                                 self.listAttachedAcces.append(slotNumber)
  1196.                            
  1197.                             slotNumberChecked = 1
  1198.                     else:
  1199.                         if slotNumber in self.listAttachedAcces and not slotNumberChecked:
  1200.                             self.wndItem.DeactivateSlot(i)
  1201.                             self.listAttachedAcces.remove(slotNumber)
  1202.  
  1203.             if itemVnum >= 53001 and itemVnum <= 53030 or itemVnum == 55701 or itemVnum == 55702 or itemVnum == 55703 or itemVnum == 55704 or itemVnum == 55705:
  1204.                 metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
  1205.  
  1206.                 if slotNumber >= player.INVENTORY_PAGE_SIZE*self.inventoryPageIndex:
  1207.                     slotNumber -= player.INVENTORY_PAGE_SIZE*self.inventoryPageIndex
  1208.  
  1209.                 isActivated = 0 != metinSocket[1]
  1210.                 if isActivated:
  1211.                     self.wndItem.ActivateSlotOld(slotNumber)
  1212.                     self.wndItem.SetSlotDiffuseColor(slotNumber, wndMgr.COLOR_TYPE_BLUE)
  1213.                     self.wndItem.SetSlotFlashEffect(slotNumber, True)
  1214.                     # self.wndItem.ActivateSlot(slotNumber)
  1215.                 else:
  1216.                     # self.wndItem.DeactivateSlot(slotNumber)
  1217.                     self.wndItem.DeactivateSlotOld(slotNumber)
  1218.            
  1219.             # elif app.BL_ENABLE_PICKUP_ITEM_EFFECT and not constInfo.IS_AUTO_POTION(itemVnum) and not constInfo.IS_DEW(itemVnum) and not (item.USE_AFFECT == item.GetItemSubType() and not constInfo.IS_IGNORED_AFF_ITEM(itemVnum)):
  1220.                 # if not slotNumber in self.liHighlightedItems:
  1221.                     # self.wndItem.DeactivateSlot(i)       
  1222.  
  1223.             if app.BL_TRANSMUTATION_SYSTEM:
  1224.                 if not player.GetChangeLookVnum(player.INVENTORY, slotNumber) == 0:
  1225.                     self.wndItem.SetSlotCoverImage(i,"icon/item/ingame_convert_Mark.tga")
  1226.                 else:
  1227.                     self.wndItem.EnableSlotCoverImage(i,False)
  1228.  
  1229.         if app.BL_ENABLE_PICKUP_ITEM_EFFECT:
  1230.             self.__HighlightSlot_Refresh()
  1231.  
  1232.         self.wndItem.RefreshSlot()
  1233.  
  1234.         if self.wndBelt:
  1235.             self.wndBelt.RefreshSlot()
  1236.  
  1237.         if app.WJ_ENABLE_TRADABLE_ICON:
  1238.             map(lambda wnd:wnd.RefreshLockedSlot(), self.bindWnds)
  1239.  
  1240.     def RefreshEquipSlotWindow(self):
  1241.         getItemVNum=player.GetItemIndex
  1242.         getItemCount=player.GetItemCount
  1243.         setItemVNum=self.wndEquip.SetItemSlot
  1244.         for i in xrange(player.EQUIPMENT_PAGE_COUNT):
  1245.             slotNumber = player.EQUIPMENT_SLOT_START + i
  1246.             itemCount = getItemCount(slotNumber)
  1247.             if itemCount <= 1:
  1248.                 itemCount = 0
  1249.             setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount)
  1250.             if app.BL_TRANSMUTATION_SYSTEM:
  1251.                 if not player.GetChangeLookVnum(player.EQUIPMENT, slotNumber) == 0:
  1252.                     self.wndEquip.SetSlotCoverImage(slotNumber,"icon/item/ingame_convert_Mark.tga")
  1253.                 else:
  1254.                     self.wndEquip.EnableSlotCoverImage(slotNumber,False)
  1255.        
  1256.         if app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  1257.             for i in xrange(player.NEW_EQUIPMENT_SLOT_COUNT):
  1258.                 slotNumber = player.NEW_EQUIPMENT_SLOT_START + i
  1259.                 itemCount = getItemCount(slotNumber)
  1260.                 if itemCount <= 1:
  1261.                     itemCount = 0
  1262.                 setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount)
  1263.        
  1264.         self.wndEquip.RefreshSlot()
  1265.  
  1266.         if self.wndCostume:
  1267.             self.wndCostume.RefreshCostumeSlot()
  1268.  
  1269.     def RefreshItemSlot(self):
  1270.         self.RefreshBagSlotWindow()
  1271.         self.RefreshEquipSlotWindow()
  1272.  
  1273.     def RefreshStatus(self):
  1274.         money = player.GetElk()
  1275.         self.wndMoney.SetText(localeInfo.NumberToMoneyString(money))
  1276.         # self.wndMoney.SetText(str(money)+"Yang")
  1277.         # if app.ENABLE_CHEQUE_SYSTEM:
  1278.             # cheque = player.GetCheque()
  1279.             # self.wndCheque.SetText(localeInfo.NumberToGoldNotText(cheque))
  1280.         if app.ENABLE_CHEQUE_SYSTEM:
  1281.             cheque = player.GetCheque()
  1282.             self.wndCheque.SetText(str(cheque))
  1283.  
  1284.     def SetItemToolTip(self, tooltipItem):
  1285.         self.tooltipItem = tooltipItem
  1286.  
  1287.     def ExternQuestionDialog_Close(self):
  1288.         if self.attachMetinDialog.IsShow():
  1289.             self.attachMetinDialog.Close()
  1290.         self.dlgQuestion.Close()
  1291.         self.srcItemPos = (0, 0)
  1292.         self.dstItemPos = (0, 0)
  1293.  
  1294.     if app.BL_TRANSMUTATION_SYSTEM:
  1295.         def IsDlgQuestionShow(self):
  1296.             if self.dlgQuestion and self.dlgQuestion.IsShow() or self.attachMetinDialog.IsShow():
  1297.                 return True
  1298.  
  1299.             return False
  1300.        
  1301.         def CancelDlgQuestion(self):
  1302.             self.__Cancel()
  1303.        
  1304.         def __OpenQuestionDialog(self, srcItemPos, dstItemPos):
  1305.             if self.interface.IsShowDlgQuestionWindow():
  1306.                 self.interface.CloseDlgQuestionWindow()
  1307.                
  1308.             getItemVNum=player.GetItemIndex
  1309.             self.srcItemPos = srcItemPos
  1310.             self.dstItemPos = dstItemPos
  1311.            
  1312.             self.dlgQuestion.SetAcceptEvent(ui.__mem_func__(self.__Accept))
  1313.             self.dlgQuestion.SetCancelEvent(ui.__mem_func__(self.__Cancel))
  1314.  
  1315.             self.dlgQuestion.SetText1("%s" % item.GetItemName(getItemVNum(srcItemPos)) )
  1316.             self.dlgQuestion.SetText2(localeInfo.INVENTORY_REALLY_USE_ITEM)
  1317.  
  1318.             self.dlgQuestion.Open()
  1319.            
  1320.         def __Accept(self):
  1321.             self.dlgQuestion.Close()
  1322.             self.__SendUseItemToItemPacket(self.srcItemPos, self.dstItemPos)
  1323.             self.srcItemPos = (0, 0)
  1324.             self.dstItemPos = (0, 0)
  1325.  
  1326.         def __Cancel(self):
  1327.             self.srcItemPos = (0, 0)
  1328.             self.dstItemPos = (0, 0)
  1329.             self.dlgQuestion.Close()
  1330.  
  1331.     def SellItem(self):
  1332.         if self.sellingSlotitemIndex == player.GetItemIndex(self.sellingSlotNumber):
  1333.             if self.sellingSlotitemCount == player.GetItemCount(self.sellingSlotNumber):
  1334.                 ## 용혼석도 팔리게 하는 기능 추가하면서 인자 type 추가
  1335.                 net.SendShopSellPacketNew(self.sellingSlotNumber, self.questionDialog.count, player.INVENTORY)
  1336.                 snd.PlaySound("sound/ui/money.wav")
  1337.         self.OnCloseQuestionDialog()
  1338.  
  1339.     def OnDetachMetinFromItem(self):
  1340.         if None == self.questionDialog:
  1341.             return
  1342.  
  1343.         #net.SendItemUseToItemPacket(self.questionDialog.sourcePos, self.questionDialog.targetPos)
  1344.         self.__SendUseItemToItemPacket(self.questionDialog.sourcePos, self.questionDialog.targetPos)
  1345.         self.OnCloseQuestionDialog()
  1346.  
  1347.     def OnCloseQuestionDialog(self):
  1348.         if not self.questionDialog:
  1349.             return
  1350.  
  1351.         self.questionDialog.Close()
  1352.         self.questionDialog = None
  1353.         constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
  1354.  
  1355.     ## Slot Event
  1356.     def SelectEmptySlot(self, selectedSlotPos):
  1357.         if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
  1358.             return
  1359.  
  1360.         if app.BL_TRANSMUTATION_SYSTEM:
  1361.             if player.GetChangeLookWindowOpen() == 1:
  1362.                 return
  1363.  
  1364.         selectedSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(selectedSlotPos)
  1365.  
  1366.         if mouseModule.mouseController.isAttached():
  1367.  
  1368.             attachedSlotType = mouseModule.mouseController.GetAttachedType()
  1369.             attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1370.             attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
  1371.             attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
  1372.  
  1373.             if player.SLOT_TYPE_INVENTORY == attachedSlotType:
  1374.                 #@fixme011 BEGIN (block ds equip)
  1375.                 attachedInvenType = player.SlotTypeToInvenType(attachedSlotType)
  1376.                 if player.IsDSEquipmentSlot(attachedInvenType, attachedSlotPos):
  1377.                     mouseModule.mouseController.DeattachObject()
  1378.                     return
  1379.                 #@fixme011 END
  1380.  
  1381.                 itemCount = player.GetItemCount(attachedSlotPos)
  1382.                 attachedCount = mouseModule.mouseController.GetAttachedItemCount()
  1383.                 self.__SendMoveItemPacket(attachedSlotPos, selectedSlotPos, attachedCount)
  1384.  
  1385.                 if item.IsRefineScroll(attachedItemIndex):
  1386.                     self.wndItem.SetUseMode(False)
  1387.  
  1388.             elif app.ENABLE_SWITCHBOT and player.SLOT_TYPE_SWITCHBOT == attachedSlotType:
  1389.                 attachedCount = mouseModule.mouseController.GetAttachedItemCount()
  1390.                 net.SendItemMovePacket(player.SWITCHBOT, attachedSlotPos, player.INVENTORY, selectedSlotPos, attachedCount)
  1391.  
  1392.             elif player.SLOT_TYPE_PRIVATE_SHOP == attachedSlotType:
  1393.                 mouseModule.mouseController.RunCallBack("INVENTORY")
  1394.  
  1395.             elif player.SLOT_TYPE_SHOP == attachedSlotType:
  1396.                 net.SendShopBuyPacket(attachedSlotPos)
  1397.  
  1398.             elif player.SLOT_TYPE_SAFEBOX == attachedSlotType:
  1399.  
  1400.                 if player.ITEM_MONEY == attachedItemIndex:
  1401.                     net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
  1402.                     snd.PlaySound("sound/ui/money.wav")
  1403.  
  1404.                 else:
  1405.                     net.SendSafeboxCheckoutPacket(attachedSlotPos, selectedSlotPos)
  1406.  
  1407.             elif player.SLOT_TYPE_MALL == attachedSlotType:
  1408.                 net.SendMallCheckoutPacket(attachedSlotPos, selectedSlotPos)
  1409.  
  1410.             # elif app.ENABLE_GUILDSTORAGE_SYSTEM and player.SLOT_TYPE_GUILDSTORAGE == attachedSlotType:
  1411.                 # net.SendGuildstorageCheckoutPacket(attachedSlotPos, player.INVENTORY, selectedSlotPos)
  1412.  
  1413.             mouseModule.mouseController.DeattachObject()
  1414.  
  1415.     def SelectItemSlot(self, itemSlotIndex):
  1416.         if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
  1417.             return
  1418.  
  1419.         itemSlotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(itemSlotIndex)
  1420.  
  1421.         if mouseModule.mouseController.isAttached():
  1422.             attachedSlotType = mouseModule.mouseController.GetAttachedType()
  1423.             attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1424.             attachedItemVID = mouseModule.mouseController.GetAttachedItemIndex()
  1425.  
  1426.             if player.SLOT_TYPE_INVENTORY == attachedSlotType:
  1427.                 #@fixme011 BEGIN (block ds equip)
  1428.                 attachedInvenType = player.SlotTypeToInvenType(attachedSlotType)
  1429.                 if player.IsDSEquipmentSlot(attachedInvenType, attachedSlotPos):
  1430.                     mouseModule.mouseController.DeattachObject()
  1431.                     return
  1432.                 #@fixme011 END
  1433.                 self.__DropSrcItemToDestItemInInventory(attachedItemVID, attachedSlotPos, itemSlotIndex)
  1434.  
  1435.             mouseModule.mouseController.DeattachObject()
  1436.  
  1437.         else:
  1438.  
  1439.             curCursorNum = app.GetCursor()
  1440.             if app.SELL == curCursorNum:
  1441.                 self.__SellItem(itemSlotIndex)
  1442.  
  1443.             elif app.BUY == curCursorNum:
  1444.                 chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SHOP_BUY_INFO)
  1445.  
  1446.             elif app.IsPressed(app.DIK_LALT):
  1447.                 link = player.GetItemLink(itemSlotIndex)
  1448.                 ime.PasteString(link)
  1449.  
  1450.             elif app.IsPressed(app.DIK_LSHIFT):
  1451.                 itemCount = player.GetItemCount(itemSlotIndex)
  1452.  
  1453.                 if app.ENABLE_CHEQUE_SYSTEM:
  1454.                     if itemCount > 1:
  1455.                         self.dlgPickETC.SetTitleName(localeInfo.PICK_ITEM_TITLE)
  1456.                         self.dlgPickETC.SetAcceptEvent(ui.__mem_func__(self.OnPickItem))
  1457.                         self.dlgPickETC.Open(itemCount)
  1458.                         self.dlgPickETC.itemGlobalSlotIndex = itemSlotIndex
  1459.                 else:
  1460.                     if itemCount > 1:
  1461.                         self.dlgPickMoney.SetTitleName(localeInfo.PICK_ITEM_TITLE)
  1462.                         self.dlgPickMoney.SetAcceptEvent(ui.__mem_func__(self.OnPickItem))
  1463.                         self.dlgPickMoney.Open(itemCount)
  1464.                         self.dlgPickMoney.itemGlobalSlotIndex = itemSlotIndex
  1465.                     #else:
  1466.                         #selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  1467.                         #mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum)
  1468.  
  1469.             elif app.IsPressed(app.DIK_LCONTROL):
  1470.                 itemIndex = player.GetItemIndex(itemSlotIndex)
  1471.  
  1472.                 if True == item.CanAddToQuickSlotItem(itemIndex):
  1473.                     player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_INVENTORY, itemSlotIndex)
  1474.                 else:
  1475.                     chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.QUICKSLOT_REGISTER_DISABLE_ITEM)
  1476.  
  1477.             else:
  1478.                 selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  1479.                 itemCount = player.GetItemCount(itemSlotIndex)
  1480.                 mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
  1481.  
  1482.                 if self.__IsUsableItemToItem(selectedItemVNum, itemSlotIndex):
  1483.                     self.wndItem.SetUseMode(True)
  1484.                 else:
  1485.                     self.wndItem.SetUseMode(False)
  1486.  
  1487.                 snd.PlaySound("sound/ui/pick.wav")
  1488.  
  1489.     def __DropSrcItemToDestItemInInventory(self, srcItemVID, srcItemSlotPos, dstItemSlotPos):
  1490.         if srcItemSlotPos == dstItemSlotPos:
  1491.             return
  1492.  
  1493.         if app.BL_TRANSMUTATION_SYSTEM:
  1494.             if player.GetChangeLookWindowOpen() == 1:
  1495.                 return
  1496.  
  1497.         if app.ENABLE_COSTUME_TIME_EXTENDER:
  1498.             dstItemVnum = player.GetItemIndex(dstItemSlotPos)
  1499.             if dstItemVnum != 0:
  1500.                 item.SelectItem(srcItemVID)
  1501.                 srcItemType = item.GetItemType()
  1502.                 srcItemSubType = item.GetItemSubType()
  1503.                 item.SelectItem(dstItemVnum)
  1504.                 if srcItemType == item.ITEM_TYPE_USE and srcItemSubType == item.USE_EXTEND_TIME and item.GetItemType() == item.ITEM_TYPE_COSTUME and (item.GetItemSubType() == item.COSTUME_TYPE_BODY or item.GetItemSubType() == item.COSTUME_TYPE_HAIR or item.GetItemSubType() == item.COSTUME_TYPE_WEAPON):
  1505.                     self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1506.  
  1507.         # cyh itemseal 2013 11 08
  1508.         if app.ENABLE_SOULBIND_SYSTEM and item.IsSealScroll(srcItemVID):
  1509.             self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1510.  
  1511.         elif item.IsRefineScroll(srcItemVID):
  1512.             self.RefineItem(srcItemSlotPos, dstItemSlotPos)
  1513.             self.wndItem.SetUseMode(False)
  1514.  
  1515.         elif item.IsMetin(srcItemVID) and not item.IsMetin(player.GetItemIndex(dstItemSlotPos)):
  1516.             self.AttachMetinToItem(srcItemSlotPos, dstItemSlotPos)
  1517.  
  1518.         elif item.IsDetachScroll(srcItemVID):
  1519.             self.DetachMetinFromItem(srcItemSlotPos, dstItemSlotPos)
  1520.  
  1521.         elif item.IsKey(srcItemVID):
  1522.             self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1523.  
  1524.         elif (player.GetItemFlags(srcItemSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1525.             self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1526.  
  1527.         elif item.GetUseType(srcItemVID) in self.USE_TYPE_TUPLE:
  1528.             self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1529.  
  1530.         else:
  1531.             #snd.PlaySound("sound/ui/drop.wav")
  1532.  
  1533.             if app.BL_TRANSMUTATION_SYSTEM:
  1534.                 if item.IsChangeLookClearScroll(srcItemVID):
  1535.                     if player.CanChangeLookClearItem(srcItemVID, player.INVENTORY, dstItemSlotPos):
  1536.                         self.__OpenQuestionDialog(srcItemSlotPos, dstItemSlotPos)
  1537.                         return
  1538.  
  1539.             ## 이동시킨 곳이 장착 슬롯일 경우 아이템을 사용해서 장착 시킨다 - [levites]
  1540.             if player.IsEquipmentSlot(dstItemSlotPos):
  1541.  
  1542.                 ## 들고 있는 아이템이 장비일때만
  1543.                 if item.IsEquipmentVID(srcItemVID):
  1544.                     self.__UseItem(srcItemSlotPos)
  1545.  
  1546.             else:
  1547.                 self.__SendMoveItemPacket(srcItemSlotPos, dstItemSlotPos, 0)
  1548.                 #net.SendItemMovePacket(srcItemSlotPos, dstItemSlotPos, 0)
  1549.  
  1550.     def __SellItem(self, itemSlotPos):
  1551.         if not player.IsEquipmentSlot(itemSlotPos):
  1552.             self.sellingSlotNumber = itemSlotPos
  1553.             itemIndex = player.GetItemIndex(itemSlotPos)
  1554.             itemCount = player.GetItemCount(itemSlotPos)
  1555.  
  1556.  
  1557.             self.sellingSlotitemIndex = itemIndex
  1558.             self.sellingSlotitemCount = itemCount
  1559.  
  1560.             item.SelectItem(itemIndex)
  1561.             ## 안티 플레그 검사 빠져서 추가
  1562.             ## 20140220
  1563.             if item.IsAntiFlag(item.ANTIFLAG_SELL):
  1564.                 popup = uiCommon.PopupDialog()
  1565.                 popup.SetText(localeInfo.SHOP_CANNOT_SELL_ITEM)
  1566.                 popup.SetAcceptEvent(self.__OnClosePopupDialog)
  1567.                 popup.Open()
  1568.                 self.popup = popup
  1569.                 return
  1570.  
  1571.             itemPrice = item.GetISellItemPrice()
  1572.  
  1573.             if item.Is1GoldItem():
  1574.                 itemPrice = itemCount / itemPrice / 5
  1575.             else:
  1576.                 itemPrice = itemPrice * itemCount / 5
  1577.  
  1578.             item.GetItemName(itemIndex)
  1579.             itemName = item.GetItemName()
  1580.  
  1581.             self.questionDialog = uiCommon.QuestionDialog()
  1582.             self.questionDialog.SetText(localeInfo.DO_YOU_SELL_ITEM(itemName, itemCount, itemPrice))
  1583.             self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.SellItem))
  1584.             self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1585.             self.questionDialog.Open()
  1586.             self.questionDialog.count = itemCount
  1587.  
  1588.             constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  1589.  
  1590.     def __OnClosePopupDialog(self):
  1591.         self.pop = None
  1592.  
  1593.     def RefineItem(self, scrollSlotPos, targetSlotPos):
  1594.  
  1595.         scrollIndex = player.GetItemIndex(scrollSlotPos)
  1596.         targetIndex = player.GetItemIndex(targetSlotPos)
  1597.  
  1598.         if player.REFINE_OK != player.CanRefine(scrollIndex, targetSlotPos):
  1599.             return
  1600.  
  1601.         ###########################################################
  1602.         self.__SendUseItemToItemPacket(scrollSlotPos, targetSlotPos)
  1603.         #net.SendItemUseToItemPacket(scrollSlotPos, targetSlotPos)
  1604.         return
  1605.         ###########################################################
  1606.  
  1607.         ###########################################################
  1608.         #net.SendRequestRefineInfoPacket(targetSlotPos)
  1609.         #return
  1610.         ###########################################################
  1611.  
  1612.         result = player.CanRefine(scrollIndex, targetSlotPos)
  1613.  
  1614.         if player.REFINE_ALREADY_MAX_SOCKET_COUNT == result:
  1615.             #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1616.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_MORE_SOCKET)
  1617.  
  1618.         elif player.REFINE_NEED_MORE_GOOD_SCROLL == result:
  1619.             #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1620.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NEED_BETTER_SCROLL)
  1621.  
  1622.         elif player.REFINE_CANT_MAKE_SOCKET_ITEM == result:
  1623.             #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1624.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_SOCKET_DISABLE_ITEM)
  1625.  
  1626.         elif player.REFINE_NOT_NEXT_GRADE_ITEM == result:
  1627.             #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1628.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_UPGRADE_DISABLE_ITEM)
  1629.  
  1630.         elif player.REFINE_CANT_REFINE_METIN_TO_EQUIPMENT == result:
  1631.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_EQUIP_ITEM)
  1632.  
  1633.         if player.REFINE_OK != result:
  1634.             return
  1635.  
  1636.         self.refineDialog.Open(scrollSlotPos, targetSlotPos)
  1637.  
  1638.     def DetachMetinFromItem(self, scrollSlotPos, targetSlotPos):
  1639.         scrollIndex = player.GetItemIndex(scrollSlotPos)
  1640.         targetIndex = player.GetItemIndex(targetSlotPos)
  1641.         if not player.CanDetach(scrollIndex, targetSlotPos):
  1642.             if app.ENABLE_ACCE_SYSTEM:
  1643.                 item.SelectItem(scrollIndex)
  1644.                 if item.GetValue(0) == acce.CLEAN_ATTR_VALUE0:
  1645.                     chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.ACCE_FAILURE_CLEAN)
  1646.                 else:
  1647.                     chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_METIN_INSEPARABLE_ITEM)
  1648.             else:
  1649.                 chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_METIN_INSEPARABLE_ITEM)
  1650.             return
  1651.  
  1652.         self.questionDialog = uiCommon.QuestionDialog()
  1653.         self.questionDialog.SetText(localeInfo.REFINE_DO_YOU_SEPARATE_METIN)
  1654.         if app.ENABLE_ACCE_SYSTEM:
  1655.             item.SelectItem(targetIndex)
  1656.             if item.GetItemType() == item.ITEM_TYPE_COSTUME and item.GetItemSubType() == item.COSTUME_TYPE_ACCE:
  1657.                 item.SelectItem(scrollIndex)
  1658.                 if item.GetValue(0) == acce.CLEAN_ATTR_VALUE0:
  1659.                     self.questionDialog.SetText(localeInfo.ACCE_DO_YOU_CLEAN)
  1660.        
  1661.         self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.OnDetachMetinFromItem))
  1662.         self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1663.         self.questionDialog.Open()
  1664.         self.questionDialog.sourcePos = scrollSlotPos
  1665.         self.questionDialog.targetPos = targetSlotPos
  1666.  
  1667.     def AttachMetinToItem(self, metinSlotPos, targetSlotPos):
  1668.         metinIndex = player.GetItemIndex(metinSlotPos)
  1669.         targetIndex = player.GetItemIndex(targetSlotPos)
  1670.  
  1671.         item.SelectItem(metinIndex)
  1672.         itemName = item.GetItemName()
  1673.  
  1674.         result = player.CanAttachMetin(metinIndex, targetSlotPos)
  1675.  
  1676.         if player.ATTACH_METIN_NOT_MATCHABLE_ITEM == result:
  1677.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_CAN_NOT_ATTACH(itemName))
  1678.  
  1679.         if player.ATTACH_METIN_NO_MATCHABLE_SOCKET == result:
  1680.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_SOCKET(itemName))
  1681.  
  1682.         elif player.ATTACH_METIN_NOT_EXIST_GOLD_SOCKET == result:
  1683.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_GOLD_SOCKET(itemName))
  1684.  
  1685.         elif player.ATTACH_METIN_CANT_ATTACH_TO_EQUIPMENT == result:
  1686.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_EQUIP_ITEM)
  1687.  
  1688.         if player.ATTACH_METIN_OK != result:
  1689.             return
  1690.  
  1691.         self.attachMetinDialog.Open(metinSlotPos, targetSlotPos)
  1692.  
  1693.     def OverOutItem(self):
  1694.         self.wndItem.SetUsableItem(False)
  1695.         if None != self.tooltipItem:
  1696.             self.tooltipItem.HideToolTip()
  1697.    
  1698.     def OverInItem(self, overSlotPos):
  1699.         overSlotPosGlobal = self.__InventoryLocalSlotPosToGlobalSlotPos(overSlotPos)
  1700.         self.wndItem.SetUsableItem(False)
  1701.  
  1702.         if app.BL_ENABLE_PICKUP_ITEM_EFFECT:
  1703.             # self.DelHighlightSlot(overSlotPos)
  1704.             self.DelHighlightSlot(overSlotPosGlobal) #fix
  1705.  
  1706.         if mouseModule.mouseController.isAttached():
  1707.             attachedItemType = mouseModule.mouseController.GetAttachedType()
  1708.             if player.SLOT_TYPE_INVENTORY == attachedItemType:
  1709.  
  1710.                 attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1711.                 attachedItemVNum = mouseModule.mouseController.GetAttachedItemIndex()
  1712.  
  1713.                 if attachedItemVNum==player.ITEM_MONEY: # @fixme005
  1714.                     pass
  1715.                 elif self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPosGlobal):
  1716.                     self.wndItem.SetUsableItem(True)
  1717.                     self.ShowToolTip(overSlotPosGlobal)
  1718.                     return
  1719.  
  1720.         self.ShowToolTip(overSlotPosGlobal)
  1721.  
  1722.     def __IsUsableItemToItem(self, srcItemVNum, srcSlotPos):
  1723.         if srcItemVNum != 0 and app.ENABLE_COSTUME_TIME_EXTENDER:
  1724.             item.SelectItem(srcItemVNum)
  1725.             if item.GetItemType() == item.ITEM_TYPE_USE and item.GetItemSubType() == item.USE_EXTEND_TIME:
  1726.                 return True
  1727.  
  1728.         if item.IsRefineScroll(srcItemVNum):
  1729.             return True
  1730.         elif item.IsMetin(srcItemVNum):
  1731.             return True
  1732.         elif item.IsDetachScroll(srcItemVNum):
  1733.             return True
  1734.         elif item.IsKey(srcItemVNum):
  1735.             return True
  1736.         elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1737.             return True
  1738.         else:
  1739.             if app.BL_TRANSMUTATION_SYSTEM:
  1740.                 if item.IsChangeLookClearScroll(srcItemVNum):
  1741.                     return True
  1742.             if item.GetUseType(srcItemVNum) in self.USE_TYPE_TUPLE:
  1743.                 return True
  1744.  
  1745.         return False
  1746.  
  1747.     def __CanUseSrcItemToDstItem(self, srcItemVNum, srcSlotPos, dstSlotPos):
  1748.         if srcSlotPos == dstSlotPos:
  1749.             return False
  1750.  
  1751.         dstItemVnum = player.GetItemIndex(dstSlotPos)
  1752.         if dstItemVnum != 0 and app.ENABLE_COSTUME_TIME_EXTENDER:
  1753.             item.SelectItem(srcItemVNum)
  1754.             srcItemType = item.GetItemType()
  1755.             srcItemSubType = item.GetItemSubType()
  1756.             item.SelectItem(dstItemVnum)
  1757.  
  1758.             if srcItemType == item.ITEM_TYPE_USE and srcItemSubType == item.USE_EXTEND_TIME and item.GetItemType() == item.ITEM_TYPE_COSTUME and (item.GetItemSubType() == item.COSTUME_TYPE_BODY or item.GetItemSubType() == item.COSTUME_TYPE_HAIR or item.GetItemSubType() == item.COSTUME_TYPE_WEAPON):
  1759.                 return True
  1760.  
  1761.         if item.IsRefineScroll(srcItemVNum):
  1762.             if player.REFINE_OK == player.CanRefine(srcItemVNum, dstSlotPos):
  1763.                 return True
  1764.         elif item.IsMetin(srcItemVNum):
  1765.             if player.ATTACH_METIN_OK == player.CanAttachMetin(srcItemVNum, dstSlotPos) or (item.IsMetin(player.GetItemIndex(dstSlotPos)) and player.GetItemIndex(dstSlotPos) == srcItemVNum):
  1766.                 return True
  1767.         elif item.IsDetachScroll(srcItemVNum):
  1768.             if player.DETACH_METIN_OK == player.CanDetach(srcItemVNum, dstSlotPos):
  1769.                 return True
  1770.         elif item.IsKey(srcItemVNum):
  1771.             if player.CanUnlock(srcItemVNum, dstSlotPos):
  1772.                 return True
  1773.  
  1774.         elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1775.             return True
  1776.  
  1777.         else:
  1778.             if app.BL_TRANSMUTATION_SYSTEM:
  1779.                 if player.CanChangeLookClearItem(srcItemVNum, player.INVENTORY, dstSlotPos):
  1780.                     return True
  1781.             useType=item.GetUseType(srcItemVNum)
  1782.  
  1783.             if "USE_CLEAN_SOCKET" == useType:
  1784.                 if self.__CanCleanBrokenMetinStone(dstSlotPos):
  1785.                     return True
  1786.             elif "USE_CHANGE_ATTRIBUTE" == useType:
  1787.                 if self.__CanChangeItemAttrList(dstSlotPos):
  1788.                     return True
  1789.             elif "USE_ADD_ATTRIBUTE" == useType:
  1790.                 if self.__CanAddItemAttr(dstSlotPos):
  1791.                     return True
  1792.             elif "USE_ADD_ATTRIBUTE2" == useType:
  1793.                 if self.__CanAddItemAttr(dstSlotPos):
  1794.                     return True
  1795.             elif "USE_ADD_ACCESSORY_SOCKET" == useType:
  1796.                 if self.__CanAddAccessorySocket(dstSlotPos):
  1797.                     return True
  1798.             elif "USE_PUT_INTO_ACCESSORY_SOCKET" == useType:
  1799.                 if self.__CanPutAccessorySocket(dstSlotPos, srcItemVNum):
  1800.                     return True;
  1801.             elif "USE_PUT_INTO_BELT_SOCKET" == useType:
  1802.                 dstItemVNum = player.GetItemIndex(dstSlotPos)
  1803.                 print "USE_PUT_INTO_BELT_SOCKET", srcItemVNum, dstItemVNum
  1804.  
  1805.                 item.SelectItem(dstItemVNum)
  1806.  
  1807.                 if item.ITEM_TYPE_BELT == item.GetItemType():
  1808.                     return True
  1809.             elif "USE_CHANGE_COSTUME_ATTR" == useType:
  1810.                 if self.__CanChangeCostumeAttrList(dstSlotPos):
  1811.                     return True
  1812.             elif "USE_RESET_COSTUME_ATTR" == useType:
  1813.                 if self.__CanResetCostumeAttr(dstSlotPos):
  1814.                     return True
  1815.  
  1816.         return False
  1817.  
  1818.     def __CanCleanBrokenMetinStone(self, dstSlotPos):
  1819.         dstItemVNum = player.GetItemIndex(dstSlotPos)
  1820.         if dstItemVNum == 0:
  1821.             return False
  1822.  
  1823.         item.SelectItem(dstItemVNum)
  1824.  
  1825.         if item.ITEM_TYPE_WEAPON != item.GetItemType():
  1826.             return False
  1827.  
  1828.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1829.             if player.GetItemMetinSocket(dstSlotPos, i) == constInfo.ERROR_METIN_STONE:
  1830.                 return True
  1831.  
  1832.         return False
  1833.  
  1834.     def __CanChangeItemAttrList(self, dstSlotPos):
  1835.         dstItemVNum = player.GetItemIndex(dstSlotPos)
  1836.         if dstItemVNum == 0:
  1837.             return False
  1838.  
  1839.         item.SelectItem(dstItemVNum)
  1840.  
  1841.         if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR):
  1842.             return False
  1843.  
  1844.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1845.             if player.GetItemAttribute(dstSlotPos, i)[0] != 0:
  1846.                 return True
  1847.  
  1848.         return False
  1849.  
  1850.     def __CanChangeCostumeAttrList(self, dstSlotPos):
  1851.         dstItemVNum = player.GetItemIndex(dstSlotPos)
  1852.         if dstItemVNum == 0:
  1853.             return False
  1854.  
  1855.         item.SelectItem(dstItemVNum)
  1856.  
  1857.         if item.GetItemType() != item.ITEM_TYPE_COSTUME:
  1858.             return False
  1859.  
  1860.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1861.             if player.GetItemAttribute(dstSlotPos, i)[0] != 0:
  1862.                 return True
  1863.  
  1864.         return False
  1865.  
  1866.     def __CanResetCostumeAttr(self, dstSlotPos):
  1867.         dstItemVNum = player.GetItemIndex(dstSlotPos)
  1868.         if dstItemVNum == 0:
  1869.             return False
  1870.  
  1871.         item.SelectItem(dstItemVNum)
  1872.  
  1873.         if item.GetItemType() != item.ITEM_TYPE_COSTUME:
  1874.             return False
  1875.  
  1876.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1877.             if player.GetItemAttribute(dstSlotPos, i)[0] != 0:
  1878.                 return True
  1879.  
  1880.         return False
  1881.  
  1882.     def __CanPutAccessorySocket(self, dstSlotPos, mtrlVnum):
  1883.         dstItemVNum = player.GetItemIndex(dstSlotPos)
  1884.         if dstItemVNum == 0:
  1885.             return False
  1886.  
  1887.         item.SelectItem(dstItemVNum)
  1888.  
  1889.         if item.GetItemType() != item.ITEM_TYPE_ARMOR:
  1890.             return False
  1891.  
  1892.         if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
  1893.             return False
  1894.  
  1895.         curCount = player.GetItemMetinSocket(dstSlotPos, 0)
  1896.         maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
  1897.  
  1898.         if mtrlVnum != constInfo.GET_ACCESSORY_MATERIAL_VNUM(dstItemVNum, item.GetItemSubType()):
  1899.             return False
  1900.  
  1901.         if curCount>=maxCount:
  1902.             return False
  1903.  
  1904.         return True
  1905.  
  1906.     def __CanAddAccessorySocket(self, dstSlotPos):
  1907.         dstItemVNum = player.GetItemIndex(dstSlotPos)
  1908.         if dstItemVNum == 0:
  1909.             return False
  1910.  
  1911.         item.SelectItem(dstItemVNum)
  1912.  
  1913.         if item.GetItemType() != item.ITEM_TYPE_ARMOR:
  1914.             return False
  1915.  
  1916.         if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
  1917.             return False
  1918.  
  1919.         curCount = player.GetItemMetinSocket(dstSlotPos, 0)
  1920.         maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
  1921.  
  1922.         ACCESSORY_SOCKET_MAX_SIZE = 3
  1923.         if maxCount >= ACCESSORY_SOCKET_MAX_SIZE:
  1924.             return False
  1925.  
  1926.         return True
  1927.  
  1928.     def __CanAddItemAttr(self, dstSlotPos):
  1929.         dstItemVNum = player.GetItemIndex(dstSlotPos)
  1930.         if dstItemVNum == 0:
  1931.             return False
  1932.  
  1933.         item.SelectItem(dstItemVNum)
  1934.  
  1935.         if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR):
  1936.             return False
  1937.  
  1938.         attrCount = 0
  1939.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1940.             if player.GetItemAttribute(dstSlotPos, i)[0] != 0:
  1941.                 attrCount += 1
  1942.  
  1943.         if attrCount<4:
  1944.             return True
  1945.  
  1946.         return False
  1947.  
  1948.     def ShowToolTip(self, slotIndex):
  1949.         if None != self.tooltipItem:
  1950.             self.tooltipItem.SetInventoryItem(slotIndex)
  1951.  
  1952.     def OnTop(self):
  1953.         if None != self.tooltipItem:
  1954.             self.tooltipItem.SetTop()
  1955.         if app.WJ_ENABLE_TRADABLE_ICON:
  1956.             map(lambda wnd:wnd.RefreshLockedSlot(), self.bindWnds)
  1957.             self.RefreshMarkSlots()
  1958.  
  1959.     def OnPressEscapeKey(self):
  1960.         self.Close()
  1961.         return True
  1962.  
  1963.     # def UseItemSlot(self, slotIndex):
  1964.         # curCursorNum = app.GetCursor()
  1965.         # if app.SELL == curCursorNum:
  1966.             # return
  1967.  
  1968.         # if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS():
  1969.             # return
  1970.  
  1971.         # slotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(slotIndex)
  1972.  
  1973.         # if app.ENABLE_DRAGON_SOUL_SYSTEM:
  1974.             # if self.wndDragonSoulRefine.IsShow():
  1975.                 # self.wndDragonSoulRefine.AutoSetItem((player.INVENTORY, slotIndex), 1)
  1976.                 # return
  1977.         # if app.ENABLE_ACCE_SYSTEM:
  1978.             # if self.isShowAcceWindow():
  1979.                 # acce.Add(player.INVENTORY, slotIndex, 255)
  1980.                 # return
  1981.  
  1982.         # self.__UseItem(slotIndex)
  1983.         # mouseModule.mouseController.DeattachObject()
  1984.         # self.OverOutItem()
  1985.     def UseItemSlot(self, slotIndex):
  1986.         curCursorNum = app.GetCursor()
  1987.         if app.SELL == curCursorNum:
  1988.             return
  1989.         if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS():
  1990.             return
  1991.         slotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(slotIndex)
  1992.         if app.ENABLE_DRAGON_SOUL_SYSTEM:
  1993.             if self.wndDragonSoulRefine.IsShow():
  1994.                 self.wndDragonSoulRefine.AutoSetItem((player.INVENTORY, slotIndex), 1)
  1995.                 return
  1996.         if self.interface.dlgExchange.IsShow() and (app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL)):
  1997.             item.SelectItem(player.GetItemIndex(slotIndex))
  1998.             emptyExchangeSlots = self.GetExchangeEmptyItemPos(item.GetItemSize()[1])
  1999.             if emptyExchangeSlots == -1:
  2000.                 return
  2001.             if item.IsAntiFlag(item.ANTIFLAG_GIVE):
  2002.                 chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.EXCHANGE_CANNOT_GIVE)
  2003.                 return
  2004.             net.SendExchangeItemAddPacket(player.SLOT_TYPE_INVENTORY, slotIndex, emptyExchangeSlots[0])
  2005.         elif self.interface.dlgShop.IsShow() and (app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL)):
  2006.             item.SelectItem(player.GetItemIndex(slotIndex))
  2007.             if item.IsAntiFlag(item.ANTIFLAG_SELL):
  2008.                 chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SHOP_CANNOT_SELL_ITEM)
  2009.                 return
  2010.             net.SendShopSellPacketNew(slotIndex, 0, player.SLOT_TYPE_INVENTORY)
  2011.         else:
  2012.             self.__UseItem(slotIndex)
  2013.             mouseModule.mouseController.DeattachObject()
  2014.             self.OverOutItem()
  2015.  
  2016.     def GetExchangeEmptyItemPos(self, itemHeight):
  2017.         inventorySize = exchange.EXCHANGE_ITEM_MAX_NUM
  2018.         inventoryWidth = 4
  2019.         GetBlockedSlots = lambda slot, size: [slot+(round*inventoryWidth) for round in xrange(size)]
  2020.         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]
  2021.         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)]]]
  2022.         return [freeSlots, -1][len(freeSlots) == 0]
  2023.  
  2024.     def __UseItem(self, slotIndex):
  2025.         ItemVNum = player.GetItemIndex(slotIndex)
  2026.         item.SelectItem(ItemVNum)
  2027.         if app.__BL_CHEST_DROP_INFO__:
  2028.             if app.IsPressed(app.DIK_LCONTROL):
  2029.                 isMain = not app.IsPressed(app.DIK_LSHIFT)
  2030.                 if item.HasDropInfo(ItemVNum, isMain) and self.interface:
  2031.                     self.interface.OpenChestDropWindow(ItemVNum, isMain)
  2032.                 return
  2033.         if app.BL_TRANSMUTATION_SYSTEM:
  2034.             if player.GetChangeLookWindowOpen() == 1:
  2035.                 return
  2036.         itemisbox = item.GetItemType(23)
  2037.         if (item.GetItemType() == itemisbox) and app.IsPressed(app.DIK_LCONTROL):
  2038.             itemUseCount = player.GetItemCount(slotIndex) if player.GetItemCount(slotIndex) <= 200 else 200
  2039.             net.SendOpenChestPacket(slotIndex, itemUseCount)
  2040.             return
  2041.         if item.IsFlag(item.ITEM_FLAG_CONFIRM_WHEN_USE):
  2042.             self.questionDialog = uiCommon.QuestionDialog()
  2043.             self.questionDialog.SetText(localeInfo.INVENTORY_REALLY_USE_ITEM)
  2044.             self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnAccept))
  2045.             self.questionDialog.SetCancelEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnCancel))
  2046.             self.questionDialog.Open()
  2047.             self.questionDialog.slotIndex = slotIndex
  2048.  
  2049.             constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  2050.  
  2051.         else:
  2052.             self.__SendUseItemPacket(slotIndex)
  2053.             #net.SendItemUsePacket(slotIndex)
  2054.  
  2055.     def __UseItemQuestionDialog_OnCancel(self):
  2056.         self.OnCloseQuestionDialog()
  2057.  
  2058.     def __UseItemQuestionDialog_OnAccept(self):
  2059.         self.__SendUseItemPacket(self.questionDialog.slotIndex)
  2060.         self.OnCloseQuestionDialog()
  2061.  
  2062.     def __SendUseItemToItemPacket(self, srcSlotPos, dstSlotPos):
  2063.         if uiPrivateShopBuilder.IsBuildingPrivateShop():
  2064.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_PRIVATE_SHOP)
  2065.             return
  2066.  
  2067.         net.SendItemUseToItemPacket(srcSlotPos, dstSlotPos)
  2068.  
  2069.     def __SendUseItemPacket(self, slotPos):
  2070.         if uiPrivateShopBuilder.IsBuildingPrivateShop():
  2071.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_PRIVATE_SHOP)
  2072.             return
  2073.  
  2074.         net.SendItemUsePacket(slotPos)
  2075.  
  2076.     def __SendMoveItemPacket(self, srcSlotPos, dstSlotPos, srcItemCount):
  2077.         if uiPrivateShopBuilder.IsBuildingPrivateShop():
  2078.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.MOVE_ITEM_FAILURE_PRIVATE_SHOP)
  2079.             return
  2080.  
  2081.         net.SendItemMovePacket(srcSlotPos, dstSlotPos, srcItemCount)
  2082.  
  2083.     def SetDragonSoulRefineWindow(self, wndDragonSoulRefine):
  2084.         if app.ENABLE_DRAGON_SOUL_SYSTEM:
  2085.             self.wndDragonSoulRefine = wndDragonSoulRefine
  2086.  
  2087.     if app.BL_TRANSMUTATION_SYSTEM:
  2088.         def __AddHighlightSlotChangeLook(self, slotIndex):
  2089.             if not slotIndex in self.listHighlightedChangeLookSlot:
  2090.                 self.listHighlightedChangeLookSlot.append(slotIndex)
  2091.  
  2092.         def __DelHighlightSlotChangeLook(self, slotIndex):
  2093.             if slotIndex in self.listHighlightedChangeLookSlot:
  2094.                 if slotIndex >= player.INVENTORY_PAGE_SIZE:
  2095.                     self.wndItem.DeactivateSlotOld(slotIndex - (self.inventoryPageIndex * player.INVENTORY_PAGE_SIZE) )
  2096.                 else:
  2097.                     self.wndItem.DeactivateSlotOld(slotIndex)
  2098.                 self.listHighlightedChangeLookSlot.remove(slotIndex)
  2099.  
  2100.     if app.ENABLE_ACCE_SYSTEM:
  2101.         def SetAcceWindow(self, wndAcceCombine, wndAcceAbsorption):
  2102.             self.wndAcceCombine = wndAcceCombine
  2103.             self.wndAcceAbsorption = wndAcceAbsorption
  2104.  
  2105.         def isShowAcceWindow(self):
  2106.             if self.wndAcceCombine:
  2107.                 if self.wndAcceCombine.IsShow():
  2108.                     return 1
  2109.  
  2110.             if self.wndAcceAbsorption:
  2111.                 if self.wndAcceAbsorption.IsShow():
  2112.                     return 1
  2113.            
  2114.             return 0
  2115.  
  2116.     if app.ENABLE_CHEQUE_SYSTEM:
  2117.         def OverInToolTip(self, arg):
  2118.             arglen = len(str(arg))
  2119.             pos_x, pos_y = wndMgr.GetMousePosition()
  2120.            
  2121.             self.toolTip.ClearToolTip()
  2122.             self.toolTip.SetThinBoardSize(11 * arglen)
  2123.             self.toolTip.SetToolTipPosition(pos_x + 5, pos_y - 5)
  2124.             self.toolTip.AppendTextLine(arg, 0xffffff00)
  2125.             self.toolTip.Show()
  2126.  
  2127.         def OverOutToolTip(self):
  2128.             self.toolTip.Hide()
  2129.  
  2130.         def EventProgress(self, event_type, idx):
  2131.             if "mouse_over_in" == str(event_type):
  2132.                 if idx == 0 :
  2133.                     self.OverInToolTip(localeInfo.CHEQUE_SYSTEM_UNIT_YANG)
  2134.                 elif idx == 1 :
  2135.                     self.OverInToolTip(localeInfo.CHEQUE_SYSTEM_UNIT_WON)
  2136.                 elif app.ENABLE_GEM_SYSTEM and idx == 2:
  2137.                     self.OverInToolTip(localeInfo.GEM_SYSTEM_NAME)
  2138.                 else:
  2139.                     return
  2140.             elif "mouse_over_out" == str(event_type) :
  2141.                 self.OverOutToolTip()
  2142.             else:
  2143.                 return
  2144.    
  2145.     def OnMoveWindow(self, x, y):
  2146. #       print "Inventory Global Pos : ", self.GetGlobalPosition()
  2147.         if self.wndBelt:
  2148. #           print "Belt Global Pos : ", self.wndBelt.GetGlobalPosition()
  2149.             self.wndBelt.AdjustPositionAndSize()
  2150.         if self.wndCostume:
  2151.             self.wndCostume.AdjustPositionAndSize()
  2152.         if app.__RENEWAL_BRAVE_CAPE__:
  2153.             if self.wndBraveCape:
  2154.                 self.wndBraveCape.AdjustPosition(x, y)
  2155.  
  2156.     if app.BL_ENABLE_PICKUP_ITEM_EFFECT:
  2157.         def ActivateSlot(self, slotindex, type):
  2158.             if type == wndMgr.HILIGHTSLOT_MAX:
  2159.                 return
  2160.             if app.BL_TRANSMUTATION_SYSTEM:
  2161.                 if type == wndMgr.HILIGHTSLOT_CHANGE_LOOK:
  2162.                     self.__AddHighlightSlotChangeLook(slotindex)
  2163.                    
  2164.         def DeactivateSlot(self, slotindex, type):
  2165.             if type == wndMgr.HILIGHTSLOT_MAX:
  2166.                 return
  2167.             if app.BL_TRANSMUTATION_SYSTEM:
  2168.                 if type == wndMgr.HILIGHTSLOT_CHANGE_LOOK:
  2169.                     self.__DelHighlightSlotChangeLook(slotindex)
  2170.  
  2171.         def __HighlightSlot_Refresh(self):
  2172.             for i in xrange(self.wndItem.GetSlotCount()):
  2173.                 slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i)
  2174.                 if slotNumber in self.listHighlightedSlot:
  2175.                     self.wndItem.ActivateSlotOld(slotNumber)
  2176.                     self.wndItem.SetSlotDiffuseColor(slotNumber, wndMgr.COLOR_TYPE_SKY)
  2177.                     self.wndItem.SetSlotFlashEffect(slotNumber, True)
  2178.                 if app.BL_TRANSMUTATION_SYSTEM:
  2179.                     if slotNumber in self.listHighlightedChangeLookSlot:
  2180.                         self.wndItem.ActivateSlotOld(slotNumber)
  2181.                         self.wndItem.SetSlotDiffuseColor(slotNumber, wndMgr.COLOR_TYPE_RED)
  2182.                         self.wndItem.SetSlotFlashEffect(slotNumber, True)
  2183.  
  2184.         def __HighlightSlot_Clear(self):
  2185.             for i in xrange(self.wndItem.GetSlotCount()):
  2186.                 slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i)
  2187.                 if slotNumber in self.listHighlightedSlot:
  2188.                     self.wndItem.DeactivateSlotOld(slotNumber)
  2189.                     self.listHighlightedSlot.remove(slotNumber)
  2190.                 if app.BL_TRANSMUTATION_SYSTEM:
  2191.                     if slotNumber in self.listHighlightedChangeLookSlot:
  2192.                         self.wndItem.DeactivateSlotOld(slotNumber)
  2193.                         self.listHighlightedChangeLookSlot.remove(slotNumber)
  2194.        
  2195.         def HighlightSlot(self, slot):
  2196.             if slot>player.INVENTORY_PAGE_SIZE*player.INVENTORY_PAGE_COUNT:
  2197.                 return
  2198.            
  2199.             if not slot in self.listHighlightedSlot:
  2200.                 self.listHighlightedSlot.append(slot)
  2201.  
  2202.         def DelHighlightSlot(self, inventorylocalslot):
  2203.             if inventorylocalslot in self.listHighlightedSlot:
  2204.                 if inventorylocalslot >= player.INVENTORY_PAGE_SIZE:
  2205.                     self.wndItem.DeactivateSlotOld(inventorylocalslot - (self.inventoryPageIndex * player.INVENTORY_PAGE_SIZE) )
  2206.                 else:
  2207.                     self.wndItem.DeactivateSlotOld(inventorylocalslot)
  2208.  
  2209.                 self.listHighlightedSlot.remove(inventorylocalslot)
  2210.  
  2211.     if app.ENABLE_HIDE_COSTUME_SYSTEM:
  2212.         def RefreshVisibleCostume(self):
  2213.             if self.wndCostume:
  2214.                 self.wndCostume.RefreshVisibleCostume()
  2215.             else:
  2216.                 self.wndCostume = CostumeWindow(self)
  2217.                 self.wndCostume.RefreshVisibleCostume()
  2218.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement