Advertisement
Guest User

Untitled

a guest
Nov 17th, 2023
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 54.77 KB | Gaming | 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 # °³ÀλóÁ¡ ¿­µ¿¾È ItemMove ¹æÁö
  17. import localeInfo
  18. import constInfo
  19. import ime
  20. import wndMgr
  21. import app
  22. import uiToolTip
  23. if app.ITEM_CHECKINOUT_UPDATE:
  24.     import exchange
  25.  
  26. ITEM_MALL_BUTTON_ENABLE = True
  27.  
  28.  
  29.  
  30. ITEM_FLAG_APPLICABLE = 1 << 14
  31.  
  32. if app.ENABLE_EXTEND_INVEN_SYSTEM:
  33.     EX_INVEN_COVER_IMG_OPEN     = "d:/ymir work/ui/ex_inven_cover_button_open.sub"
  34.     EX_INVEN_COVER_IMG_CLOSE    = "d:/ymir work/ui/ex_inven_cover_button_close.sub"
  35.  
  36. class CostumeWindow(ui.ScriptWindow):
  37.  
  38.     def __init__(self, wndInventory):
  39.         import exception
  40.        
  41.         if not app.ENABLE_COSTUME_SYSTEM:          
  42.             exception.Abort("What do you do?")
  43.             return
  44.  
  45.         if not wndInventory:
  46.             exception.Abort("wndInventory parameter must be set to InventoryWindow")
  47.             return                     
  48.                  
  49.         ui.ScriptWindow.__init__(self)
  50.  
  51.         self.isLoaded = 0
  52.         self.wndInventory = wndInventory;
  53.  
  54.         self.__LoadWindow()
  55.  
  56.     def __del__(self):
  57.         ui.ScriptWindow.__del__(self)
  58.  
  59.     def Show(self):
  60.         self.__LoadWindow()
  61.         self.RefreshCostumeSlot()
  62.  
  63.         ui.ScriptWindow.Show(self)
  64.  
  65.     def Close(self):
  66.         self.Hide()
  67.  
  68.     def __LoadWindow(self):
  69.         if self.isLoaded == 1:
  70.             return
  71.  
  72.         self.isLoaded = 1
  73.  
  74.         try:
  75.             pyScrLoader = ui.PythonScriptLoader()
  76.             pyScrLoader.LoadScriptFile(self, "UIScript/CostumeWindow.py")
  77.         except:
  78.             import exception
  79.             exception.Abort("CostumeWindow.LoadWindow.LoadObject")
  80.  
  81.         try:
  82.             wndEquip = self.GetChild("CostumeSlot")
  83.             self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
  84.            
  85.         except:
  86.             import exception
  87.             exception.Abort("CostumeWindow.LoadWindow.BindObject")
  88.  
  89.         ## Equipment
  90.         wndEquip.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
  91.         wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
  92.         wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  93.         wndEquip.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))                       
  94.         wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
  95.         wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
  96.  
  97.         self.wndEquip = wndEquip
  98.  
  99.     def RefreshCostumeSlot(self):
  100.         getItemVNum=player.GetItemIndex
  101.        
  102.         for i in xrange(item.COSTUME_SLOT_COUNT):
  103.             slotNumber = item.COSTUME_SLOT_START + i
  104.             self.wndEquip.SetItemSlot(slotNumber, getItemVNum(slotNumber), 0)
  105.  
  106.         self.wndEquip.RefreshSlot()
  107.        
  108. class BeltInventoryWindow(ui.ScriptWindow):
  109.  
  110.     def __init__(self, wndInventory):
  111.         import exception
  112.        
  113.         if not app.ENABLE_NEW_EQUIPMENT_SYSTEM:        
  114.             exception.Abort("What do you do?")
  115.             return
  116.  
  117.         if not wndInventory:
  118.             exception.Abort("wndInventory parameter must be set to InventoryWindow")
  119.             return                     
  120.                  
  121.         ui.ScriptWindow.__init__(self)
  122.  
  123.         self.isLoaded = 0
  124.         self.wndInventory = wndInventory;
  125.        
  126.         self.wndBeltInventoryLayer = None
  127.         self.wndBeltInventorySlot = None
  128.         self.expandBtn = None
  129.         self.minBtn = None
  130.  
  131.         self.__LoadWindow()
  132.  
  133.     def __del__(self):
  134.         ui.ScriptWindow.__del__(self)
  135.  
  136.     def Show(self, openBeltSlot = FALSE):
  137.         self.__LoadWindow()
  138.         self.RefreshSlot()
  139.  
  140.         ui.ScriptWindow.Show(self)
  141.        
  142.         if openBeltSlot:
  143.             self.OpenInventory()
  144.         else:
  145.             self.CloseInventory()
  146.  
  147.     def Close(self):
  148.         self.Hide()
  149.  
  150.     def IsOpeningInventory(self):
  151.         return self.wndBeltInventoryLayer.IsShow()
  152.        
  153.     def OpenInventory(self):
  154.         self.wndBeltInventoryLayer.Show()
  155.         self.expandBtn.Hide()
  156.  
  157.         if localeInfo.IsARABIC() == 0:
  158.             self.AdjustPositionAndSize()
  159.                
  160.     def CloseInventory(self):
  161.         self.wndBeltInventoryLayer.Hide()
  162.         self.expandBtn.Show()
  163.        
  164.         if localeInfo.IsARABIC() == 0:
  165.             self.AdjustPositionAndSize()
  166.  
  167.     ## ÇöÀç Àκ¥Å丮 À§Ä¡¸¦ ±âÁØÀ¸·Î BASE À§Ä¡¸¦ °è»ê, ¸®ÅÏ.. ¼ýÀÚ ÇϵåÄÚµùÇϱâ Á¤¸» ½ÈÁö¸¸ ¹æ¹ýÀÌ ¾ø´Ù..
  168.     def GetBasePosition(self):
  169.         x, y = self.wndInventory.GetGlobalPosition()
  170.         return x - 148, y + 241
  171.        
  172.     def AdjustPositionAndSize(self):
  173.         bx, by = self.GetBasePosition()
  174.        
  175.         if self.IsOpeningInventory():          
  176.             self.SetPosition(bx, by)
  177.             self.SetSize(self.ORIGINAL_WIDTH, self.GetHeight())
  178.            
  179.         else:
  180.             self.SetPosition(bx + 138, by);
  181.             self.SetSize(10, self.GetHeight())
  182.  
  183.     def __LoadWindow(self):
  184.         if self.isLoaded == 1:
  185.             return
  186.  
  187.         self.isLoaded = 1
  188.  
  189.         try:
  190.             pyScrLoader = ui.PythonScriptLoader()
  191.             pyScrLoader.LoadScriptFile(self, "UIScript/BeltInventoryWindow.py")
  192.         except:
  193.             import exception
  194.             exception.Abort("CostumeWindow.LoadWindow.LoadObject")
  195.  
  196.         try:
  197.             self.ORIGINAL_WIDTH = self.GetWidth()
  198.             wndBeltInventorySlot = self.GetChild("BeltInventorySlot")
  199.             self.wndBeltInventoryLayer = self.GetChild("BeltInventoryLayer")
  200.             self.expandBtn = self.GetChild("ExpandBtn")
  201.             self.minBtn = self.GetChild("MinimizeBtn")
  202.            
  203.             self.expandBtn.SetEvent(ui.__mem_func__(self.OpenInventory))
  204.             self.minBtn.SetEvent(ui.__mem_func__(self.CloseInventory))
  205.            
  206.             if localeInfo.IsARABIC() :
  207.                 self.expandBtn.SetPosition(self.expandBtn.GetWidth() - 2, 15)
  208.                 self.wndBeltInventoryLayer.SetPosition(self.wndBeltInventoryLayer.GetWidth() - 5, 0)
  209.                 self.minBtn.SetPosition(self.minBtn.GetWidth() + 3, 15)        
  210.    
  211.             for i in xrange(item.BELT_INVENTORY_SLOT_COUNT):
  212.                 slotNumber = item.BELT_INVENTORY_SLOT_START + i                        
  213.                 wndBeltInventorySlot.SetCoverButton(slotNumber, "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  214.                                                 "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  215.                                                 "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  216.                                                 "d:/ymir work/ui/game/belt_inventory/slot_disabled.tga", FALSE, FALSE)                                 
  217.            
  218.         except:
  219.             import exception
  220.             exception.Abort("CostumeWindow.LoadWindow.BindObject")
  221.  
  222.         ## Equipment
  223.         wndBeltInventorySlot.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
  224.         wndBeltInventorySlot.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
  225.         wndBeltInventorySlot.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  226.         wndBeltInventorySlot.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))                       
  227.         wndBeltInventorySlot.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
  228.         wndBeltInventorySlot.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
  229.  
  230.         self.wndBeltInventorySlot = wndBeltInventorySlot
  231.  
  232.     def RefreshSlot(self):
  233.         getItemVNum=player.GetItemIndex
  234.        
  235.         for i in xrange(item.BELT_INVENTORY_SLOT_COUNT):
  236.             slotNumber = item.BELT_INVENTORY_SLOT_START + i
  237.             self.wndBeltInventorySlot.SetItemSlot(slotNumber, getItemVNum(slotNumber), player.GetItemCount(slotNumber))
  238.             self.wndBeltInventorySlot.SetAlwaysRenderCoverButton(slotNumber, TRUE)
  239.            
  240.             avail = "0"
  241.            
  242.             if player.IsAvailableBeltInventoryCell(slotNumber):
  243.                 self.wndBeltInventorySlot.EnableCoverButton(slotNumber)            
  244.             else:
  245.                 self.wndBeltInventorySlot.DisableCoverButton(slotNumber)               
  246.  
  247.         self.wndBeltInventorySlot.RefreshSlot()
  248.  
  249.        
  250. class InventoryWindow(ui.ScriptWindow):
  251.  
  252.     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")
  253.  
  254.     questionDialog = None
  255.     tooltipItem = None
  256.     wndCostume = None
  257.     wndBelt = None
  258.     dlgPickMoney = None
  259.     interface = None
  260.     if app.WJ_ENABLE_TRADABLE_ICON:
  261.         bindWnds = []
  262.    
  263.     sellingSlotNumber = -1
  264.     isLoaded = 0
  265.     isOpenedCostumeWindowWhenClosingInventory = 0       # Àκ¥Å丮 ´ÝÀ» ¶§ ÄÚ½ºÃõÀÌ ¿­·ÁÀÖ¾ú´ÂÁö ¿©ºÎ-_-; ³×ÀÌ¹Ö ¤¸¤µ
  266.     isOpenedBeltWindowWhenClosingInventory = 0      # Àκ¥Å丮 ´ÝÀ» ¶§ º§Æ® Àκ¥Å丮°¡ ¿­·ÁÀÖ¾ú´ÂÁö ¿©ºÎ-_-; ³×ÀÌ¹Ö ¤¸¤µ
  267.  
  268.     def __init__(self):
  269.    
  270.         if constInfo.ENABLE_EXPANDED_MONEY_TASKBAR:
  271.             self.wndExpandedMoneyBar = None
  272.             self.wndGem = None
  273.  
  274.         ui.ScriptWindow.__init__(self)
  275.  
  276.         self.isOpenedBeltWindowWhenClosingInventory = 0     # Àκ¥Å丮 ´ÝÀ» ¶§ º§Æ® Àκ¥Å丮°¡ ¿­·ÁÀÖ¾ú´ÂÁö ¿©ºÎ-_-; ³×ÀÌ¹Ö ¤¸¤µ
  277.  
  278.         self.__LoadWindow()
  279.  
  280.     def __del__(self):
  281.         ui.ScriptWindow.__del__(self)
  282.        
  283.         if constInfo.ENABLE_EXPANDED_MONEY_TASKBAR:
  284.             self.wndExpandedMoneyBar = None
  285.             self.wndGem = None
  286.  
  287.     def Show(self):
  288.         self.__LoadWindow()
  289.  
  290.         ui.ScriptWindow.Show(self)
  291.  
  292.         # Àκ¥Å丮¸¦ ´ÝÀ» ¶§ ÄÚ½ºÃõÀÌ ¿­·ÁÀÖ¾ú´Ù¸é Àκ¥Å丮¸¦ ¿­ ¶§ ÄÚ½ºÃõµµ °°ÀÌ ¿­µµ·Ï ÇÔ.
  293.         if self.isOpenedCostumeWindowWhenClosingInventory and self.wndCostume:
  294.             self.wndCostume.Show()
  295.  
  296.         # Àκ¥Å丮¸¦ ´ÝÀ» ¶§ º§Æ® Àκ¥Å丮°¡ ¿­·ÁÀÖ¾ú´Ù¸é °°ÀÌ ¿­µµ·Ï ÇÔ.
  297.         if self.wndBelt:
  298.             self.wndBelt.Show(self.isOpenedBeltWindowWhenClosingInventory)
  299.            
  300.         if constInfo.ENABLE_EXPANDED_MONEY_TASKBAR:
  301.             if self.wndExpandedMoneyBar:
  302.                 self.wndExpandedMoneyBar.Show()
  303.  
  304.     def BindInterfaceClass(self, interface):
  305.         self.interface = interface
  306.        
  307.     if app.WJ_ENABLE_TRADABLE_ICON:
  308.         def BindWindow(self, wnd):
  309.             self.bindWnds.append(wnd)
  310.        
  311.     def __LoadWindow(self):
  312.         if self.isLoaded == 1:
  313.             return
  314.  
  315.         self.isLoaded = 1
  316.  
  317.         try:
  318.             pyScrLoader = ui.PythonScriptLoader()
  319.  
  320.             if ITEM_MALL_BUTTON_ENABLE:
  321.                 pyScrLoader.LoadScriptFile(self, uiScriptLocale.LOCALE_UISCRIPT_PATH + "InventoryWindow.py")
  322.             else:
  323.                 pyScrLoader.LoadScriptFile(self, "UIScript/InventoryWindow.py")
  324.         except:
  325.             import exception
  326.             exception.Abort("InventoryWindow.LoadWindow.LoadObject")
  327.  
  328.         try:
  329.             wndItem = self.GetChild("ItemSlot")
  330.             wndEquip = self.GetChild("EquipmentSlot")
  331.             self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
  332.             self.wndMoney = self.GetChild("Money")
  333.             self.wndMoneySlot = self.GetChild("Money_Slot")
  334.             self.mallButton = self.GetChild2("MallButton")
  335.             self.DSSButton = self.GetChild2("DSSButton")
  336.             self.costumeButton = self.GetChild2("CostumeButton")
  337.             if app.ENABLE_CHEQUE_SYSTEM:
  338.                 self.wndCheque = self.GetChild("Cheque")
  339.                 self.wndChequeSlot = self.GetChild("Cheque_Slot")
  340.  
  341.                 if app.ENABLE_GEM_SYSTEM:
  342.                     self.wndMoneyIcon = self.GetChild("Money_Icon")
  343.                     self.wndChequeIcon = self.GetChild("Cheque_Icon")
  344.                     self.wndMoneyIcon.Hide()
  345.                     self.wndMoneySlot.Hide()
  346.                     self.wndChequeIcon.Hide()
  347.                     self.wndChequeSlot.Hide()
  348.  
  349.                     ## ?? ??
  350.                     height = self.GetHeight()
  351.                     width = self.GetWidth()
  352.                     self.SetSize(width, height - 22)
  353.                     self.GetChild("board").SetSize(width, height - 22)
  354.  
  355.                 else:
  356.                     self.wndMoneyIcon = self.GetChild("Money_Icon")
  357.                     self.wndChequeIcon = self.GetChild("Cheque_Icon")
  358.                
  359.                     self.wndMoneyIcon.SetEvent(ui.__mem_func__(self.EventProgress), "mouse_over_in", 0)
  360.                     self.wndChequeIcon.SetEvent(ui.__mem_func__(self.EventProgress), "mouse_over_in", 1)
  361.                
  362.                     self.wndMoneyIcon.SetEvent(ui.__mem_func__(self.EventProgress), "mouse_over_out", 0)
  363.                     self.wndChequeIcon.SetEvent(ui.__mem_func__(self.EventProgress), "mouse_over_out", 1)
  364.                
  365.                     self.toolTip = uiToolTip.ToolTip()
  366.                     self.toolTip.ClearToolTip()
  367.             else:
  368.                 if constInfo.ENABLE_EXPANDED_MONEY_TASKBAR:
  369.                     self.wndMoneyIcon = self.GetChild("Money_Icon")
  370.                     self.wndMoneyIcon.Hide()
  371.                     self.wndMoneySlot.Hide()
  372.  
  373.                     ## lôRE Á¶Rý
  374.                     height = self.GetHeight()
  375.                     width = self.GetWidth()
  376.                     self.SetSize(width, height - 22)
  377.                     self.GetChild("board").SetSize(width, height - 22)
  378.  
  379.                 else:
  380.                     self.wndMoneyIcon = self.GetChild("Money_Icon")
  381.                     self.wndMoneyIcon.SetEvent(ui.__mem_func__(self.EventProgress), "mouse_over_in", 0)
  382.                     self.wndMoneyIcon.SetEvent(ui.__mem_func__(self.EventProgress), "mouse_over_out", 0)
  383.                     self.toolTip = uiToolTip.ToolTip()
  384.                     self.toolTip.ClearToolTip()
  385.            
  386.             self.inventoryTab = []
  387.             self.inventoryTab.append(self.GetChild("Inventory_Tab_01"))
  388.             self.inventoryTab.append(self.GetChild("Inventory_Tab_02"))
  389.             self.inventoryTab.append(self.GetChild("Inventory_Tab_03"))
  390.             self.inventoryTab.append(self.GetChild("Inventory_Tab_04"))
  391.  
  392.             self.equipmentTab = []
  393.             self.equipmentTab.append(self.GetChild("Equipment_Tab_01"))
  394.             self.equipmentTab.append(self.GetChild("Equipment_Tab_02"))
  395.             if app.BL_ENABLE_PICKUP_ITEM_EFFECT:
  396.                 self.listHighlightedSlot = []
  397.             if app.ENABLE_EXTEND_INVEN_SYSTEM:
  398.                 self.__CreateExtendInvenButton()
  399.                 self.ExInvenQuestionDlg = uiCommon.QuestionDialog()
  400.                 self.ExInvenQuestionDlg.Close()
  401.                 self.pop = None
  402.  
  403.             if self.costumeButton and not app.ENABLE_COSTUME_SYSTEM:
  404.                 self.costumeButton.Hide()
  405.                 self.costumeButton.Destroy()
  406.                 self.costumeButton = 0
  407.  
  408.             # Belt Inventory Window
  409.             self.wndBelt = None
  410.            
  411.             if app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  412.                 self.wndBelt = BeltInventoryWindow(self)
  413.            
  414.         except:
  415.             import exception
  416.             exception.Abort("InventoryWindow.LoadWindow.BindObject")
  417.  
  418.         ## Item
  419.         wndItem.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  420.         wndItem.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  421.         wndItem.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  422.         wndItem.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  423.         wndItem.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  424.         wndItem.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  425.  
  426.         ## Equipment
  427.         wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  428.         wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  429.         wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  430.         wndEquip.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  431.         wndEquip.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  432.         wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  433.  
  434.         ## PickMoneyDialog
  435.         dlgPickMoney = uiPickMoney.PickMoneyDialog()
  436.         dlgPickMoney.LoadDialog()
  437.         dlgPickMoney.Hide()
  438.  
  439.         ## RefineDialog
  440.         self.refineDialog = uiRefine.RefineDialog()
  441.         self.refineDialog.Hide()
  442.  
  443.         ## AttachMetinDialog
  444.         if app.WJ_ENABLE_TRADABLE_ICON:  
  445.             self.attachMetinDialog = uiAttachMetin.AttachMetinDialog(self)
  446.             self.BindWindow(self.attachMetinDialog)
  447.         else:
  448.             self.attachMetinDialog = uiAttachMetin.AttachMetinDialog()
  449.         self.attachMetinDialog.Hide()
  450.  
  451.         ## MoneySlot
  452.         self.wndMoneySlot.SetEvent(ui.__mem_func__(self.OpenPickMoneyDialog))
  453.  
  454.         self.inventoryTab[0].SetEvent(lambda arg=0: self.SetInventoryPage(arg))
  455.         self.inventoryTab[1].SetEvent(lambda arg=1: self.SetInventoryPage(arg))
  456.         self.inventoryTab[2].SetEvent(lambda arg=2: self.SetInventoryPage(arg))
  457.         self.inventoryTab[3].SetEvent(lambda arg=3: self.SetInventoryPage(arg))
  458.         self.inventoryTab[0].Down()
  459.                 self.inventoryPageIndex = 0
  460.  
  461.         self.equipmentTab[0].SetEvent(lambda arg=0: self.SetEquipmentPage(arg))
  462.         self.equipmentTab[1].SetEvent(lambda arg=1: self.SetEquipmentPage(arg))
  463.         self.equipmentTab[0].Down()
  464.         self.equipmentTab[0].Hide()
  465.         self.equipmentTab[1].Hide()
  466.  
  467.         self.wndItem = wndItem
  468.         self.wndEquip = wndEquip
  469.         self.dlgPickMoney = dlgPickMoney
  470.  
  471.         # MallButton
  472.         if self.mallButton:
  473.             self.mallButton.SetEvent(ui.__mem_func__(self.ClickMallButton))
  474.  
  475.         if self.DSSButton:
  476.             self.DSSButton.SetEvent(ui.__mem_func__(self.ClickDSSButton))
  477.        
  478.         # Costume Button
  479.         if self.costumeButton:
  480.             self.costumeButton.SetEvent(ui.__mem_func__(self.ClickCostumeButton))
  481.  
  482.         self.wndCostume = None
  483.        
  484.         #####
  485.  
  486.         ## Refresh
  487.         self.SetInventoryPage(0)
  488.         self.SetEquipmentPage(0)
  489.         self.RefreshItemSlot()
  490.         self.RefreshStatus()
  491.  
  492.     def Destroy(self):
  493.         self.ClearDictionary()
  494.  
  495.         self.dlgPickMoney.Destroy()
  496.         self.dlgPickMoney = 0
  497.         if app.ENABLE_EXTEND_INVEN_SYSTEM:
  498.             self.ExInvenButton = []
  499.             if self.ExInvenQuestionDlg:
  500.                 self.ExInvenQuestionDlg.Close()
  501.  
  502.         self.refineDialog.Destroy()
  503.         self.refineDialog = 0
  504.  
  505.         self.attachMetinDialog.Destroy()
  506.         self.attachMetinDialog = 0
  507.  
  508.         self.tooltipItem = None
  509.         self.wndItem = 0
  510.         self.wndEquip = 0
  511.         self.dlgPickMoney = 0
  512.         self.wndMoney = 0
  513.         self.wndMoneySlot = 0
  514.         self.questionDialog = None
  515.         self.mallButton = None
  516.         self.DSSButton = None
  517.         if app.ENABLE_DSS_ACTIVE_EFFECT_BUTTON:
  518.             self.DSSButtonEffect = None
  519.         self.interface = None
  520.         if app.WJ_ENABLE_TRADABLE_ICON:
  521.             self.bindWnds = []
  522.  
  523.         if self.wndCostume:
  524.             self.wndCostume.Destroy()
  525.             self.wndCostume = 0
  526.            
  527.         if self.wndBelt:
  528.             self.wndBelt.Destroy()
  529.             self.wndBelt = None
  530.            
  531.         self.inventoryTab = []
  532.         self.equipmentTab = []
  533.         if constInfo.ENABLE_EXPANDED_MONEY_TASKBAR:
  534.             self.wndExpandedMoneyBar = None
  535.  
  536.     def Hide(self):
  537.         if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS():
  538.             self.OnCloseQuestionDialog()
  539.             return
  540.         if None != self.tooltipItem:
  541.             self.tooltipItem.HideToolTip()
  542.  
  543.         if self.wndCostume:
  544.             self.isOpenedCostumeWindowWhenClosingInventory = self.wndCostume.IsShow()           # Àκ¥Å丮 âÀÌ ´ÝÈú ¶§ ÄÚ½ºÃõÀÌ ¿­·Á ÀÖ¾ú´Â°¡?
  545.             self.wndCostume.Close()
  546.  
  547.         if self.wndBelt:
  548.             self.isOpenedBeltWindowWhenClosingInventory = self.wndBelt.IsOpeningInventory()     # Àκ¥Å丮 âÀÌ ´ÝÈú ¶§ º§Æ® Àκ¥Å丮µµ ¿­·Á ÀÖ¾ú´Â°¡?
  549.             print "Is Opening Belt Inven?? ", self.isOpenedBeltWindowWhenClosingInventory
  550.             self.wndBelt.Close()
  551.  
  552.         if self.dlgPickMoney:
  553.             self.dlgPickMoney.Close()
  554.        
  555.         wndMgr.Hide(self.hWnd)
  556.  
  557.         if constInfo.ENABLE_EXPANDED_MONEY_TASKBAR:
  558.             if self.wndExpandedMoneyBar:
  559.                 self.wndExpandedMoneyBar.Close()
  560.        
  561.    
  562.     def Close(self):
  563.         self.Hide()
  564.        
  565.     if constInfo.ENABLE_EXPANDED_MONEY_TASKBAR:
  566.         def SetExpandedMoneyBar(self, wndBar):
  567.             self.wndExpandedMoneyBar = wndBar
  568.             if self.wndExpandedMoneyBar:
  569.                 self.wndMoneySlot = self.wndExpandedMoneyBar.GetMoneySlot()
  570.                 self.wndMoney = self.wndExpandedMoneyBar.GetMoney()
  571.                 if app.ENABLE_CHEQUE_SYSTEM:
  572.                     ## ? ??
  573.                     self.wndMoneyIcon = self.wndExpandedMoneyBar.GetMoneyIcon()
  574.                     if self.wndMoneyIcon:
  575.                         self.wndMoneyIcon.SetEvent(ui.__mem_func__(self.EventProgress), "mouse_over_in", 0)
  576.                         self.wndMoneyIcon.SetEvent(ui.__mem_func__(self.EventProgress), "mouse_over_out", 0)
  577.                     if self.wndMoneySlot:
  578.                         self.wndMoneySlot.SetEvent(ui.__mem_func__(self.OpenPickMoneyDialog), 0)
  579.                     ## 2??? ??
  580.                     self.wndChequeIcon = self.wndExpandedMoneyBar.GetChequeIcon()
  581.                     if self.wndChequeIcon:
  582.                         self.wndChequeIcon.SetEvent(ui.__mem_func__(self.EventProgress), "mouse_over_in", 1)
  583.                         self.wndChequeIcon.SetEvent(ui.__mem_func__(self.EventProgress), "mouse_over_out", 1)
  584.                     self.wndChequeSlot = self.wndExpandedMoneyBar.GetChequeSlot()
  585.                     if self.wndChequeSlot:
  586.                         self.wndChequeSlot.SetEvent(ui.__mem_func__(self.OpenPickMoneyDialog), 1)
  587.                     self.wndCheque = self.wndExpandedMoneyBar.GetCheque()
  588.                     ## ?? ??
  589.                     self.wndGemIcon = self.wndExpandedMoneyBar.GetGemIcon()
  590.                     if self.wndGemIcon:
  591.                         self.wndGemIcon.SetEvent(ui.__mem_func__(self.EventProgress), "mouse_over_in", 2)
  592.                         self.wndGemIcon.SetEvent(ui.__mem_func__(self.EventProgress), "mouse_over_out", 2)
  593.                     self.wndGem = self.wndExpandedMoneyBar.GetGaya()
  594.                     self.toolTip = uiToolTip.ToolTip()
  595.                     self.toolTip.ClearToolTip()
  596.                 else:
  597.                     if self.wndMoneySlot:
  598.                         self.wndMoneySlot.SetEvent(ui.__mem_func__(self.OpenPickMoneyDialog))
  599.  
  600.         def SetInventoryPage(self, page):
  601.             self.inventoryTab[self.inventoryPageIndex].SetUp()
  602.             self.inventoryPageIndex = page
  603.             self.inventoryTab[self.inventoryPageIndex].Down()
  604.             self.RefreshBagSlotWindow()
  605.  
  606.     def SetEquipmentPage(self, page):
  607.         self.equipmentPageIndex = page
  608.         self.equipmentTab[1-page].SetUp()
  609.         self.RefreshEquipSlotWindow()
  610.        
  611.     if app.ENABLE_EXTEND_INVEN_SYSTEM:
  612.         def __CreateExtendInvenButton(self):
  613.             parent = self.GetChild("board")
  614.             self.ExInvenButton = []
  615.             start_x     = 8
  616.             start_y     = 246
  617.             img_height  = 32
  618.             for button_index in range(player.INVENTORY_LOCKED_PAGE_COUNT*9):
  619.                 ex_inven_button = ui.Button()          
  620.                 increase_y  = img_height * (button_index % 9)
  621.                 ex_inven_button.SetParent(parent)
  622.                 ex_inven_button.SetPosition(start_x, start_y + increase_y )
  623.                 ex_inven_button.SetUpVisual(EX_INVEN_COVER_IMG_CLOSE)
  624.                 ex_inven_button.SetOverVisual(EX_INVEN_COVER_IMG_CLOSE)
  625.                 ex_inven_button.SetDownVisual(EX_INVEN_COVER_IMG_CLOSE)
  626.                 ex_inven_button.SetDisableVisual(EX_INVEN_COVER_IMG_CLOSE)
  627.                 ex_inven_button.SetEvent(ui.__mem_func__(self.__ClickExtendInvenButton), button_index)
  628.                 ex_inven_button.Hide()
  629.                 self.ExInvenButton.append(ex_inven_button)
  630.                
  631.         def __ClickExtendInvenButton(self, index):
  632.             if index >= len(self.ExInvenButton):
  633.                 self.__OpenExInvenMsgDlg(localeInfo.EXINVEN_USE_ITEM_FAIL_FOURTH_PAGE_STAGE_MAX)
  634.                 return
  635.             if self.ExInvenQuestionDlg and index == player.GetExtendInvenStage():
  636.                 needkeys = []
  637.                 for n in range(player.INVENTORY_NEED_KEY_START, (player.INVENTORY_LOCKED_PAGE_COUNT*player.INVENTORY_NEED_KEY_INCREASE)+2):
  638.                     for i in range(3):
  639.                         needkeys.append(n)
  640.                 self.ExInvenQuestionDlg.SetText(localeInfo.EXINVEN_USE_ITEM_QUESTION % needkeys[index])
  641.                 self.ExInvenQuestionDlg.SetAcceptEvent(ui.__mem_func__(self.__AcceptExInvenItemUse))
  642.                 self.ExInvenQuestionDlg.SetCancelEvent(ui.__mem_func__(self.__CancelExInvenItemUse))
  643.                 w,h = self.ExInvenQuestionDlg.GetTextSize()
  644.                 self.ExInvenQuestionDlg.SetWidth( w + 40 )
  645.                 self.ExInvenQuestionDlg.Open()
  646.         def __HideAllExtendInvenButton(self):      
  647.             for index in range( len(self.ExInvenButton) ):
  648.                 self.ExInvenButton[index].Hide()               
  649.         def __ShowExtendInvenButton(self, cur_stage):
  650.             if self.inventoryPageIndex < player.INVENTORY_OPEN_PAGE_COUNT:
  651.                 return
  652.             count = 9
  653.             min_range = (self.inventoryPageIndex - player.INVENTORY_OPEN_PAGE_COUNT) * count
  654.             max_range = min_range + count      
  655.             for button_index in range(min_range, max_range):
  656.                 if button_index == cur_stage:
  657.                     self.ExInvenButton[button_index].SetUpVisual(EX_INVEN_COVER_IMG_OPEN)
  658.                     self.ExInvenButton[button_index].SetOverVisual(EX_INVEN_COVER_IMG_OPEN)
  659.                     self.ExInvenButton[button_index].SetDownVisual(EX_INVEN_COVER_IMG_OPEN)
  660.                     self.ExInvenButton[button_index].SetDisableVisual(EX_INVEN_COVER_IMG_OPEN)             
  661.                 if button_index < cur_stage:
  662.                     self.ExInvenButton[button_index].Hide()
  663.                 else:
  664.                     self.ExInvenButton[button_index].Show()
  665.         def __RefreshExinvenCoverSlot(self):   
  666.             self.__HideAllExtendInvenButton()
  667.             self.__ShowExtendInvenButton(player.GetExtendInvenStage())
  668.         def __AcceptExInvenItemUse(self):
  669.             net.Envanter_genislet()
  670.             self.ExInvenQuestionDlg.Close()    
  671.         def __CancelExInvenItemUse(self):      
  672.             self.ExInvenQuestionDlg.Close()
  673.         def __OpenExInvenMsgDlg(self, msg):
  674.             popup = uiCommon.PopupDialog()
  675.             popup.SetText(msg)
  676.             popup.SetAcceptEvent(self.__OnClosePopupDialog)
  677.             w,h = popup.GetTextSize()
  678.             popup.SetWidth( w + 40 )
  679.             popup.Open()
  680.             if self.pop:
  681.                 self.pop.Destroy()         
  682.             self.pop = popup               
  683.         def OpenExInvenFallShortCountMsgDlg(self, enough_count):
  684.             popup = uiCommon.PopupDialog()
  685.             popup.SetText(localeInfo.EXINVEN_USE_ITEM_FAIL_FALL_SHORT % int(enough_count) )
  686.             popup.SetAcceptEvent(self.__OnClosePopupDialog)
  687.             popup.Open()           
  688.             if self.pop:
  689.                 self.pop.Destroy()     
  690.             self.pop = popup
  691.  
  692.     def ClickMallButton(self):
  693.         print "click_mall_button"
  694.         net.SendChatPacket("/click_mall")
  695.  
  696.     # DSSButton
  697.     def ClickDSSButton(self):
  698.         print "click_dss_button"
  699.         self.interface.ToggleDragonSoulWindow()
  700.        
  701.     if app.ENABLE_DSS_ACTIVE_EFFECT_BUTTON:
  702.         def UseDSSButtonEffect(self, enable):
  703.             if self.DSSButton:
  704.                 DSSButtonEffect = ui.SlotWindow()
  705.                 DSSButtonEffect.AddFlag("attach")
  706.                 DSSButtonEffect.SetParent(self.DSSButton)
  707.                 DSSButtonEffect.SetPosition(3.2, 0)
  708.  
  709.                 DSSButtonEffect.AppendSlot(0, 0, 0, 32, 32)
  710.                 DSSButtonEffect.SetRenderSlot(0)
  711.                 DSSButtonEffect.RefreshSlot()
  712.  
  713.                 if enable == True:
  714.                     DSSButtonEffect.ActivateSlot(0)
  715.                     DSSButtonEffect.Show()
  716.                 else:
  717.                     DSSButtonEffect.DeactivateSlot(0)
  718.                     DSSButtonEffect.Hide()
  719.                 self.DSSButtonEffect = DSSButtonEffect
  720.  
  721.     def ClickCostumeButton(self):
  722.         print "Click Costume Button"
  723.         if self.wndCostume:
  724.             if self.wndCostume.IsShow():
  725.                 self.wndCostume.Hide()
  726.             else:
  727.                 self.wndCostume.Show()
  728.         else:
  729.             self.wndCostume = CostumeWindow(self)
  730.             self.wndCostume.Show()
  731.  
  732.     def OpenPickMoneyDialog(self):
  733.  
  734.         if mouseModule.mouseController.isAttached():
  735.  
  736.             attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  737.             if player.SLOT_TYPE_SAFEBOX == mouseModule.mouseController.GetAttachedType():
  738.  
  739.                 if player.ITEM_MONEY == mouseModule.mouseController.GetAttachedItemIndex():
  740.                     net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
  741.                     snd.PlaySound("sound/ui/money.wav")
  742.  
  743.             mouseModule.mouseController.DeattachObject()
  744.  
  745.         else:
  746.             curMoney = player.GetElk()
  747.  
  748.             if curMoney <= 0:
  749.                 return
  750.  
  751.             self.dlgPickMoney.SetTitleName(localeInfo.PICK_MONEY_TITLE)
  752.             self.dlgPickMoney.SetAcceptEvent(ui.__mem_func__(self.OnPickMoney))
  753.             self.dlgPickMoney.Open(curMoney)
  754.             self.dlgPickMoney.SetMax(7) # Àκ¥Å丮 990000 Á¦ÇÑ ¹ö±× ¼öÁ¤
  755.  
  756.     def OnPickMoney(self, money):
  757.         mouseModule.mouseController.AttachMoney(self, player.SLOT_TYPE_INVENTORY, money)
  758.  
  759.     def OnPickItem(self, count):
  760.         itemSlotIndex = self.dlgPickMoney.itemGlobalSlotIndex
  761.         selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  762.         mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, count)
  763.  
  764.     def __InventoryLocalSlotPosToGlobalSlotPos(self, local):
  765.         if player.IsEquipmentSlot(local) or player.IsCostumeSlot(local) or (app.ENABLE_NEW_EQUIPMENT_SYSTEM and player.IsBeltInventorySlot(local)):
  766.             return local
  767.  
  768.         return self.inventoryPageIndex*player.INVENTORY_PAGE_SIZE + local
  769.        
  770.     def GetInventoryPageIndex(self):
  771.         return self.inventoryPageIndex
  772.  
  773.     if app.WJ_ENABLE_TRADABLE_ICON:
  774.         def RefreshMarkSlots(self, localIndex=None):
  775.             if not self.interface:
  776.                 return
  777.  
  778.             onTopWnd = self.interface.GetOnTopWindow()
  779.             if localIndex:
  780.                 slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(localIndex)
  781.                 if onTopWnd == player.ON_TOP_WND_NONE:
  782.                     self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  783.  
  784.                 elif onTopWnd == player.ON_TOP_WND_SHOP:
  785.                     if player.IsAntiFlagBySlot(slotNumber, item.ANTIFLAG_SELL):
  786.                         self.wndItem.SetUnusableSlotOnTopWnd(localIndex)
  787.                     else:
  788.                         self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  789.  
  790.                 elif onTopWnd == player.ON_TOP_WND_EXCHANGE:
  791.                     if player.IsAntiFlagBySlot(slotNumber, item.ANTIFLAG_GIVE):
  792.                         self.wndItem.SetUnusableSlotOnTopWnd(localIndex)
  793.                     else:
  794.                         self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  795.  
  796.                 elif onTopWnd == player.ON_TOP_WND_PRIVATE_SHOP:
  797.                     if player.IsAntiFlagBySlot(slotNumber, item.ITEM_ANTIFLAG_MYSHOP):
  798.                         self.wndItem.SetUnusableSlotOnTopWnd(localIndex)
  799.                     else:
  800.                         self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  801.  
  802.                 elif onTopWnd == player.ON_TOP_WND_SAFEBOX:
  803.                     if player.IsAntiFlagBySlot(slotNumber, item.ANTIFLAG_SAFEBOX):
  804.                         self.wndItem.SetUnusableSlotOnTopWnd(localIndex)
  805.                     else:
  806.                         self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  807.  
  808.                 return
  809.  
  810.             for i in xrange(player.INVENTORY_PAGE_SIZE):
  811.                 slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i)
  812.  
  813.                 if onTopWnd == player.ON_TOP_WND_NONE:
  814.                     self.wndItem.SetUsableSlotOnTopWnd(i)
  815.  
  816.                 elif onTopWnd == player.ON_TOP_WND_SHOP:
  817.                     if player.IsAntiFlagBySlot(slotNumber, item.ANTIFLAG_SELL):
  818.                         self.wndItem.SetUnusableSlotOnTopWnd(i)
  819.                     else:
  820.                         self.wndItem.SetUsableSlotOnTopWnd(i)
  821.  
  822.                 elif onTopWnd == player.ON_TOP_WND_EXCHANGE:
  823.                     if player.IsAntiFlagBySlot(slotNumber, item.ANTIFLAG_GIVE):
  824.                         self.wndItem.SetUnusableSlotOnTopWnd(i)
  825.                     else:
  826.                         self.wndItem.SetUsableSlotOnTopWnd(i)
  827.  
  828.                 elif onTopWnd == player.ON_TOP_WND_PRIVATE_SHOP:
  829.                     if player.IsAntiFlagBySlot(slotNumber, item.ITEM_ANTIFLAG_MYSHOP):
  830.                         self.wndItem.SetUnusableSlotOnTopWnd(i)
  831.                     else:
  832.                         self.wndItem.SetUsableSlotOnTopWnd(i)
  833.  
  834.                 elif onTopWnd == player.ON_TOP_WND_SAFEBOX:
  835.                     if player.IsAntiFlagBySlot(slotNumber, item.ANTIFLAG_SAFEBOX):
  836.                         self.wndItem.SetUnusableSlotOnTopWnd(i)
  837.                     else:
  838.                         self.wndItem.SetUsableSlotOnTopWnd(i)
  839.  
  840.     def RefreshBagSlotWindow(self):
  841.         getItemVNum=player.GetItemIndex
  842.         getItemCount=player.GetItemCount
  843.         setItemVNum=self.wndItem.SetItemSlot
  844.         if app.BL_ENABLE_PICKUP_ITEM_EFFECT:
  845.             for i in xrange(self.wndItem.GetSlotCount()):
  846.                 self.wndItem.DeactivateSlot(i)
  847.        
  848.         for i in xrange(player.INVENTORY_PAGE_SIZE):
  849.             slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i)
  850.            
  851.             itemCount = getItemCount(slotNumber)
  852.             # itemCount == 0ÀÌ¸é ¼ÒÄÏÀ» ºñ¿î´Ù.
  853.             if 0 == itemCount:
  854.                 self.wndItem.ClearSlot(i)
  855.                 continue
  856.             elif 1 == itemCount:
  857.                 itemCount = 0
  858.                
  859.             itemVnum = getItemVNum(slotNumber)
  860.             setItemVNum(i, itemVnum, itemCount)
  861.            
  862.             ## ÀÚµ¿¹°¾à (HP: #72723 ~ #72726, SP: #72727 ~ #72730) Ư¼öó¸® - ¾ÆÀÌÅÛÀε¥µµ ½½·Ô¿¡ È°¼ºÈ­/ºñÈ°¼ºÈ­ Ç¥½Ã¸¦ À§ÇÑ ÀÛ¾÷ÀÓ - [hyo]
  863.             if constInfo.IS_AUTO_POTION(itemVnum):
  864.                 # metinSocket - [0] : È°¼ºÈ­ ¿©ºÎ, [1] : »ç¿ëÇÑ ¾ç, [2] : ÃÖ´ë ¿ë·®
  865.                 metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]  
  866.                
  867.                 if slotNumber >= player.INVENTORY_PAGE_SIZE:
  868.                     slotNumber -= player.INVENTORY_PAGE_SIZE
  869.                    
  870.                 isActivated = 0 != metinSocket[0]
  871.                
  872.                 if isActivated:
  873.                     self.wndItem.ActivateSlot(slotNumber)
  874.                     potionType = 0;
  875.                     if constInfo.IS_AUTO_POTION_HP(itemVnum):
  876.                         potionType = player.AUTO_POTION_TYPE_HP
  877.                     elif constInfo.IS_AUTO_POTION_SP(itemVnum):
  878.                         potionType = player.AUTO_POTION_TYPE_SP                    
  879.                    
  880.                     usedAmount = int(metinSocket[1])
  881.                     totalAmount = int(metinSocket[2])                  
  882.                     player.SetAutoPotionInfo(potionType, isActivated, (totalAmount - usedAmount), totalAmount, self.__InventoryLocalSlotPosToGlobalSlotPos(i))
  883.                    
  884.                 else:
  885.                     self.wndItem.DeactivateSlot(slotNumber)        
  886.             elif itemVnum >= 53001 and itemVnum <= 53256:
  887.                 metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]# <!> globalSlotNumber may be different <!>
  888.                 isActivated = 0 != metinSocket[1]
  889.                 if isActivated:
  890.                     self.wndItem.ActivateSlot(i)
  891.                 else:
  892.                     self.wndItem.DeactivateSlot(i)
  893.                    
  894.             if app.WJ_ENABLE_TRADABLE_ICON:
  895.                 self.RefreshMarkSlots(i)
  896.                    
  897.         self.wndItem.RefreshSlot()
  898.         if app.BL_ENABLE_PICKUP_ITEM_EFFECT:
  899.             self.__HighlightSlot_Refresh()
  900.        
  901.         if app.ENABLE_EXTEND_INVEN_SYSTEM:
  902.             self.__RefreshExinvenCoverSlot()
  903.  
  904.         if self.wndBelt:
  905.             self.wndBelt.RefreshSlot()
  906.            
  907.         if app.WJ_ENABLE_TRADABLE_ICON:
  908.             map(lambda wnd:wnd.RefreshLockedSlot(), self.bindWnds)
  909.  
  910.     def RefreshEquipSlotWindow(self):
  911.         getItemVNum=player.GetItemIndex
  912.         getItemCount=player.GetItemCount
  913.         setItemVNum=self.wndEquip.SetItemSlot
  914.         for i in xrange(player.EQUIPMENT_PAGE_COUNT):
  915.             slotNumber = player.EQUIPMENT_SLOT_START + i
  916.             itemCount = getItemCount(slotNumber)
  917.             if itemCount <= 1:
  918.                 itemCount = 0
  919.             setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount)
  920.  
  921.         if app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  922.             for i in xrange(player.NEW_EQUIPMENT_SLOT_COUNT):
  923.                 slotNumber = player.NEW_EQUIPMENT_SLOT_START + i
  924.                 itemCount = getItemCount(slotNumber)
  925.                 if itemCount <= 1:
  926.                     itemCount = 0
  927.                 setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount)
  928.                 print "ENABLE_NEW_EQUIPMENT_SYSTEM", slotNumber, itemCount, getItemVNum(slotNumber)
  929.                
  930.  
  931.  
  932.         self.wndEquip.RefreshSlot()
  933.        
  934.         if self.wndCostume:
  935.             self.wndCostume.RefreshCostumeSlot()
  936.  
  937.     def RefreshItemSlot(self):
  938.         self.RefreshBagSlotWindow()
  939.         self.RefreshEquipSlotWindow()
  940.  
  941.     def RefreshStatus(self):
  942.         money = player.GetElk()
  943.         self.wndMoney.SetText(localeInfo.NumberToMoneyString(money))
  944.  
  945.     def SetItemToolTip(self, tooltipItem):
  946.         self.tooltipItem = tooltipItem
  947.  
  948.     def SellItem(self):
  949.         if self.sellingSlotitemIndex == player.GetItemIndex(self.sellingSlotNumber):
  950.             if self.sellingSlotitemCount == player.GetItemCount(self.sellingSlotNumber):
  951.                 ## ¿ëÈ¥¼®µµ Æȸ®°Ô ÇÏ´Â ±â´É Ãß°¡Çϸ鼭 ÀÎÀÚ type Ãß°¡
  952.                 net.SendShopSellPacketNew(self.sellingSlotNumber, self.questionDialog.count, player.INVENTORY)
  953.                 snd.PlaySound("sound/ui/money.wav")
  954.         self.OnCloseQuestionDialog()
  955.  
  956.     def OnDetachMetinFromItem(self):
  957.         if None == self.questionDialog:
  958.             return
  959.            
  960.         #net.SendItemUseToItemPacket(self.questionDialog.sourcePos, self.questionDialog.targetPos)     
  961.         self.__SendUseItemToItemPacket(self.questionDialog.sourcePos, self.questionDialog.targetPos)
  962.         self.OnCloseQuestionDialog()
  963.  
  964.     def OnCloseQuestionDialog(self):
  965.         if not self.questionDialog:
  966.             return
  967.        
  968.         self.questionDialog.Close()
  969.         self.questionDialog = None
  970.         constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
  971.  
  972.     ## Slot Event
  973.     def SelectEmptySlot(self, selectedSlotPos):
  974.         if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
  975.             return
  976.  
  977.         selectedSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(selectedSlotPos)
  978.  
  979.         if mouseModule.mouseController.isAttached():
  980.  
  981.             attachedSlotType = mouseModule.mouseController.GetAttachedType()
  982.             attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  983.             attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
  984.             attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
  985.  
  986.             if player.SLOT_TYPE_INVENTORY == attachedSlotType:
  987.                 itemCount = player.GetItemCount(attachedSlotPos)
  988.                 attachedCount = mouseModule.mouseController.GetAttachedItemCount()
  989.                 self.__SendMoveItemPacket(attachedSlotPos, selectedSlotPos, attachedCount)
  990.  
  991.                 if item.IsRefineScroll(attachedItemIndex):
  992.                     self.wndItem.SetUseMode(False)
  993.  
  994.             elif player.SLOT_TYPE_PRIVATE_SHOP == attachedSlotType:
  995.                 mouseModule.mouseController.RunCallBack("INVENTORY")
  996.  
  997.             elif player.SLOT_TYPE_SHOP == attachedSlotType:
  998.                 net.SendShopBuyPacket(attachedSlotPos)
  999.  
  1000.             elif player.SLOT_TYPE_SAFEBOX == attachedSlotType:
  1001.  
  1002.                 if player.ITEM_MONEY == attachedItemIndex:
  1003.                     net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
  1004.                     snd.PlaySound("sound/ui/money.wav")
  1005.  
  1006.                 else:
  1007.                     net.SendSafeboxCheckoutPacket(attachedSlotPos, selectedSlotPos)
  1008.  
  1009.             elif player.SLOT_TYPE_MALL == attachedSlotType:
  1010.                 net.SendMallCheckoutPacket(attachedSlotPos, selectedSlotPos)
  1011.  
  1012.             mouseModule.mouseController.DeattachObject()
  1013.  
  1014.     def SelectItemSlot(self, itemSlotIndex):
  1015.         if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
  1016.             return
  1017.  
  1018.         itemSlotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(itemSlotIndex)
  1019.  
  1020.         if mouseModule.mouseController.isAttached():
  1021.             attachedSlotType = mouseModule.mouseController.GetAttachedType()
  1022.             attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1023.             attachedItemVID = mouseModule.mouseController.GetAttachedItemIndex()
  1024.  
  1025.             if player.SLOT_TYPE_INVENTORY == attachedSlotType:
  1026.                 self.__DropSrcItemToDestItemInInventory(attachedItemVID, attachedSlotPos, itemSlotIndex)
  1027.  
  1028.             mouseModule.mouseController.DeattachObject()
  1029.  
  1030.         else:
  1031.  
  1032.             curCursorNum = app.GetCursor()
  1033.             if app.SELL == curCursorNum:
  1034.                 self.__SellItem(itemSlotIndex)
  1035.                
  1036.             elif app.BUY == curCursorNum:
  1037.                 chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SHOP_BUY_INFO)
  1038.  
  1039.             elif app.IsPressed(app.DIK_LALT):
  1040.                 link = player.GetItemLink(itemSlotIndex)
  1041.                 ime.PasteString(link)
  1042.  
  1043.             elif app.IsPressed(app.DIK_LSHIFT):
  1044.                 itemCount = player.GetItemCount(itemSlotIndex)
  1045.                
  1046.                 if itemCount > 1:
  1047.                     self.dlgPickMoney.SetTitleName(localeInfo.PICK_ITEM_TITLE)
  1048.                     self.dlgPickMoney.SetAcceptEvent(ui.__mem_func__(self.OnPickItem))
  1049.                     self.dlgPickMoney.Open(itemCount)
  1050.                     self.dlgPickMoney.itemGlobalSlotIndex = itemSlotIndex
  1051.                 #else:
  1052.                     #selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  1053.                     #mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum)
  1054.  
  1055.             elif app.IsPressed(app.DIK_LCONTROL):
  1056.                 itemIndex = player.GetItemIndex(itemSlotIndex)
  1057.  
  1058.                 if True == item.CanAddToQuickSlotItem(itemIndex):
  1059.                     player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_INVENTORY, itemSlotIndex)
  1060.                 else:
  1061.                     chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.QUICKSLOT_REGISTER_DISABLE_ITEM)
  1062.  
  1063.             else:
  1064.                 selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  1065.                 itemCount = player.GetItemCount(itemSlotIndex)
  1066.                 mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
  1067.                
  1068.                 if self.__IsUsableItemToItem(selectedItemVNum, itemSlotIndex):             
  1069.                     self.wndItem.SetUseMode(True)
  1070.                 else:                  
  1071.                     self.wndItem.SetUseMode(False)
  1072.  
  1073.                 snd.PlaySound("sound/ui/pick.wav")
  1074.  
  1075.     def __DropSrcItemToDestItemInInventory(self, srcItemVID, srcItemSlotPos, dstItemSlotPos):
  1076.         if srcItemSlotPos == dstItemSlotPos:
  1077.             return
  1078.                
  1079.         elif item.IsRefineScroll(srcItemVID):
  1080.             self.RefineItem(srcItemSlotPos, dstItemSlotPos)
  1081.             self.wndItem.SetUseMode(False)
  1082.  
  1083.         elif item.IsMetin(srcItemVID):
  1084.             self.AttachMetinToItem(srcItemSlotPos, dstItemSlotPos)
  1085.  
  1086.         elif item.IsDetachScroll(srcItemVID):
  1087.             self.DetachMetinFromItem(srcItemSlotPos, dstItemSlotPos)
  1088.  
  1089.         elif item.IsKey(srcItemVID):
  1090.             self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)         
  1091.  
  1092.         elif (player.GetItemFlags(srcItemSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1093.             self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1094.  
  1095.         elif item.GetUseType(srcItemVID) in self.USE_TYPE_TUPLE:
  1096.             self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)         
  1097.  
  1098.         else:
  1099.             #snd.PlaySound("sound/ui/drop.wav")
  1100.  
  1101.             ## À̵¿½ÃŲ °÷ÀÌ ÀåÂø ½½·ÔÀÏ °æ¿ì ¾ÆÀÌÅÛÀ» »ç¿ëÇؼ­ ÀåÂø ½ÃŲ´Ù - [levites]
  1102.             if player.IsEquipmentSlot(dstItemSlotPos):
  1103.  
  1104.                 ## µé°í ÀÖ´Â ¾ÆÀÌÅÛÀÌ ÀåºñÀ϶§¸¸
  1105.                 if item.IsEquipmentVID(srcItemVID):
  1106.                     self.__UseItem(srcItemSlotPos)
  1107.  
  1108.             else:
  1109.                 self.__SendMoveItemPacket(srcItemSlotPos, dstItemSlotPos, 0)
  1110.                 #net.SendItemMovePacket(srcItemSlotPos, dstItemSlotPos, 0)
  1111.  
  1112.     def __SellItem(self, itemSlotPos):
  1113.         if not player.IsEquipmentSlot(itemSlotPos):
  1114.             self.sellingSlotNumber = itemSlotPos
  1115.             itemIndex = player.GetItemIndex(itemSlotPos)
  1116.             itemCount = player.GetItemCount(itemSlotPos)
  1117.            
  1118.            
  1119.             self.sellingSlotitemIndex = itemIndex
  1120.             self.sellingSlotitemCount = itemCount
  1121.  
  1122.             item.SelectItem(itemIndex)
  1123.             ## ¾ÈƼ Ç÷¹±× °Ë»ç ºüÁ®¼­ Ãß°¡
  1124.             ## 20140220
  1125.             if item.IsAntiFlag(item.ANTIFLAG_SELL):
  1126.                 popup = uiCommon.PopupDialog()
  1127.                 popup.SetText(localeInfo.SHOP_CANNOT_SELL_ITEM)
  1128.                 popup.SetAcceptEvent(self.__OnClosePopupDialog)
  1129.                 popup.Open()
  1130.                 self.popup = popup
  1131.                 return
  1132.  
  1133.             itemPrice = item.GetISellItemPrice()
  1134.  
  1135.             if item.Is1GoldItem():
  1136.                 itemPrice = itemCount / itemPrice / 5
  1137.             else:
  1138.                 itemPrice = itemPrice * itemCount / 5
  1139.  
  1140.             item.GetItemName(itemIndex)
  1141.             itemName = item.GetItemName()
  1142.  
  1143.             self.questionDialog = uiCommon.QuestionDialog()
  1144.             self.questionDialog.SetText(localeInfo.DO_YOU_SELL_ITEM(itemName, itemCount, itemPrice))
  1145.             self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.SellItem))
  1146.             self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1147.             self.questionDialog.Open()
  1148.             self.questionDialog.count = itemCount
  1149.        
  1150.             constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  1151.  
  1152.     def __OnClosePopupDialog(self):
  1153.         self.pop = None
  1154.  
  1155.     def RefineItem(self, scrollSlotPos, targetSlotPos):
  1156.  
  1157.         scrollIndex = player.GetItemIndex(scrollSlotPos)
  1158.         targetIndex = player.GetItemIndex(targetSlotPos)
  1159.  
  1160.         if player.REFINE_OK != player.CanRefine(scrollIndex, targetSlotPos):
  1161.             return
  1162.  
  1163.         ###########################################################
  1164.         self.__SendUseItemToItemPacket(scrollSlotPos, targetSlotPos)
  1165.         #net.SendItemUseToItemPacket(scrollSlotPos, targetSlotPos)
  1166.         return
  1167.         ###########################################################
  1168.  
  1169.         ###########################################################
  1170.         #net.SendRequestRefineInfoPacket(targetSlotPos)
  1171.         #return
  1172.         ###########################################################
  1173.  
  1174.         result = player.CanRefine(scrollIndex, targetSlotPos)
  1175.  
  1176.         if player.REFINE_ALREADY_MAX_SOCKET_COUNT == result:
  1177.             #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1178.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_MORE_SOCKET)
  1179.  
  1180.         elif player.REFINE_NEED_MORE_GOOD_SCROLL == result:
  1181.             #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1182.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NEED_BETTER_SCROLL)
  1183.  
  1184.         elif player.REFINE_CANT_MAKE_SOCKET_ITEM == result:
  1185.             #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1186.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_SOCKET_DISABLE_ITEM)
  1187.  
  1188.         elif player.REFINE_NOT_NEXT_GRADE_ITEM == result:
  1189.             #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1190.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_UPGRADE_DISABLE_ITEM)
  1191.  
  1192.         elif player.REFINE_CANT_REFINE_METIN_TO_EQUIPMENT == result:
  1193.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_EQUIP_ITEM)
  1194.  
  1195.         if player.REFINE_OK != result:
  1196.             return
  1197.  
  1198.         self.refineDialog.Open(scrollSlotPos, targetSlotPos)
  1199.  
  1200.     def DetachMetinFromItem(self, scrollSlotPos, targetSlotPos):
  1201.         scrollIndex = player.GetItemIndex(scrollSlotPos)
  1202.         targetIndex = player.GetItemIndex(targetSlotPos)
  1203.  
  1204.         if not player.CanDetach(scrollIndex, targetSlotPos):
  1205.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_METIN_INSEPARABLE_ITEM)
  1206.             return
  1207.  
  1208.         self.questionDialog = uiCommon.QuestionDialog()
  1209.         self.questionDialog.SetText(localeInfo.REFINE_DO_YOU_SEPARATE_METIN)
  1210.         self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.OnDetachMetinFromItem))
  1211.         self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1212.         self.questionDialog.Open()
  1213.         self.questionDialog.sourcePos = scrollSlotPos
  1214.         self.questionDialog.targetPos = targetSlotPos
  1215.  
  1216.     def AttachMetinToItem(self, metinSlotPos, targetSlotPos):
  1217.         metinIndex = player.GetItemIndex(metinSlotPos)
  1218.         targetIndex = player.GetItemIndex(targetSlotPos)
  1219.  
  1220.         item.SelectItem(metinIndex)
  1221.         itemName = item.GetItemName()
  1222.  
  1223.         result = player.CanAttachMetin(metinIndex, targetSlotPos)
  1224.  
  1225.         if player.ATTACH_METIN_NOT_MATCHABLE_ITEM == result:
  1226.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_CAN_NOT_ATTACH(itemName))
  1227.  
  1228.         if player.ATTACH_METIN_NO_MATCHABLE_SOCKET == result:
  1229.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_SOCKET(itemName))
  1230.  
  1231.         elif player.ATTACH_METIN_NOT_EXIST_GOLD_SOCKET == result:
  1232.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_GOLD_SOCKET(itemName))
  1233.  
  1234.         elif player.ATTACH_METIN_CANT_ATTACH_TO_EQUIPMENT == result:
  1235.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_EQUIP_ITEM)
  1236.  
  1237.         if player.ATTACH_METIN_OK != result:
  1238.             return
  1239.  
  1240.         self.attachMetinDialog.Open(metinSlotPos, targetSlotPos)
  1241.  
  1242.  
  1243.        
  1244.     def OverOutItem(self):
  1245.         self.wndItem.SetUsableItem(False)
  1246.         if None != self.tooltipItem:
  1247.             self.tooltipItem.HideToolTip()
  1248.  
  1249.     def OverInItem(self, overSlotPos):
  1250.         overSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(overSlotPos)
  1251.         self.wndItem.SetUsableItem(False)
  1252.         if app.BL_ENABLE_PICKUP_ITEM_EFFECT:
  1253.             self.DelHighlightSlot(overSlotPos)
  1254.  
  1255.         if mouseModule.mouseController.isAttached():
  1256.             attachedItemType = mouseModule.mouseController.GetAttachedType()
  1257.             if player.SLOT_TYPE_INVENTORY == attachedItemType:
  1258.  
  1259.                 attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1260.                 attachedItemVNum = mouseModule.mouseController.GetAttachedItemIndex()
  1261.                
  1262.                 if self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPos):
  1263.                     self.wndItem.SetUsableItem(True)
  1264.                     self.ShowToolTip(overSlotPos)
  1265.                     return
  1266.                
  1267.         self.ShowToolTip(overSlotPos)
  1268.  
  1269.  
  1270.     def __IsUsableItemToItem(self, srcItemVNum, srcSlotPos):
  1271.         "´Ù¸¥ ¾ÆÀÌÅÛ¿¡ »ç¿ëÇÒ ¼ö ÀÖ´Â ¾ÆÀÌÅÛÀΰ¡?"
  1272.  
  1273.         if item.IsRefineScroll(srcItemVNum):
  1274.             return True
  1275.         elif item.IsMetin(srcItemVNum):
  1276.             return True
  1277.         elif item.IsDetachScroll(srcItemVNum):
  1278.             return True
  1279.         elif item.IsKey(srcItemVNum):
  1280.             return True
  1281.         elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1282.             return True
  1283.         else:
  1284.             if item.GetUseType(srcItemVNum) in self.USE_TYPE_TUPLE:
  1285.                 return True
  1286.            
  1287.         return False
  1288.  
  1289.     def __CanUseSrcItemToDstItem(self, srcItemVNum, srcSlotPos, dstSlotPos):
  1290.         "´ë»ó ¾ÆÀÌÅÛ¿¡ »ç¿ëÇÒ ¼ö Àִ°¡?"
  1291.  
  1292.         if srcSlotPos == dstSlotPos:
  1293.             return False
  1294.  
  1295.         if item.IsRefineScroll(srcItemVNum):
  1296.             if player.REFINE_OK == player.CanRefine(srcItemVNum, dstSlotPos):
  1297.                 return True
  1298.         elif item.IsMetin(srcItemVNum):
  1299.             if player.ATTACH_METIN_OK == player.CanAttachMetin(srcItemVNum, dstSlotPos):
  1300.                 return True
  1301.         elif item.IsDetachScroll(srcItemVNum):
  1302.             if player.DETACH_METIN_OK == player.CanDetach(srcItemVNum, dstSlotPos):
  1303.                 return True
  1304.         elif item.IsKey(srcItemVNum):
  1305.             if player.CanUnlock(srcItemVNum, dstSlotPos):
  1306.                 return True
  1307.  
  1308.         elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1309.             return True
  1310.  
  1311.         else:
  1312.             useType=item.GetUseType(srcItemVNum)
  1313.  
  1314.             if "USE_CLEAN_SOCKET" == useType:
  1315.                 if self.__CanCleanBrokenMetinStone(dstSlotPos):
  1316.                     return True
  1317.             elif "USE_CHANGE_ATTRIBUTE" == useType:
  1318.                 if self.__CanChangeItemAttrList(dstSlotPos):
  1319.                     return True
  1320.             elif "USE_ADD_ATTRIBUTE" == useType:
  1321.                 if self.__CanAddItemAttr(dstSlotPos):
  1322.                     return True
  1323.             elif "USE_ADD_ATTRIBUTE2" == useType:
  1324.                 if self.__CanAddItemAttr(dstSlotPos):
  1325.                     return True
  1326.             elif "USE_ADD_ACCESSORY_SOCKET" == useType:
  1327.                 if self.__CanAddAccessorySocket(dstSlotPos):
  1328.                     return True
  1329.             elif "USE_PUT_INTO_ACCESSORY_SOCKET" == useType:                               
  1330.                 if self.__CanPutAccessorySocket(dstSlotPos, srcItemVNum):
  1331.                     return TRUE;
  1332.             elif "USE_PUT_INTO_BELT_SOCKET" == useType:                            
  1333.                 dstItemVNum = player.GetItemIndex(dstSlotPos)
  1334.                 print "USE_PUT_INTO_BELT_SOCKET", srcItemVNum, dstItemVNum
  1335.  
  1336.                 item.SelectItem(dstItemVNum)
  1337.        
  1338.                 if item.ITEM_TYPE_BELT == item.GetItemType():
  1339.                     return True
  1340.  
  1341.         return False
  1342.  
  1343.     def __CanCleanBrokenMetinStone(self, dstSlotPos):
  1344.         dstItemVNum = player.GetItemIndex(dstSlotPos)
  1345.         if dstItemVNum == 0:
  1346.             return False
  1347.  
  1348.         item.SelectItem(dstItemVNum)
  1349.        
  1350.         if item.ITEM_TYPE_WEAPON != item.GetItemType():
  1351.             return False
  1352.  
  1353.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1354.             if player.GetItemMetinSocket(dstSlotPos, i) == constInfo.ERROR_METIN_STONE:
  1355.                 return True
  1356.  
  1357.         return False
  1358.  
  1359.     def __CanChangeItemAttrList(self, dstSlotPos):
  1360.         dstItemVNum = player.GetItemIndex(dstSlotPos)
  1361.         if dstItemVNum == 0:
  1362.             return False
  1363.  
  1364.         item.SelectItem(dstItemVNum)
  1365.        
  1366.         if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR):  
  1367.             return False
  1368.  
  1369.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1370.             if player.GetItemAttribute(dstSlotPos, i) != 0:
  1371.                 return True
  1372.  
  1373.         return False
  1374.  
  1375.     def __CanPutAccessorySocket(self, dstSlotPos, mtrlVnum):
  1376.         dstItemVNum = player.GetItemIndex(dstSlotPos)
  1377.         if dstItemVNum == 0:
  1378.             return False
  1379.  
  1380.         item.SelectItem(dstItemVNum)
  1381.  
  1382.         if item.GetItemType() != item.ITEM_TYPE_ARMOR:
  1383.             return False
  1384.  
  1385.         if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
  1386.             return False
  1387.  
  1388.         curCount = player.GetItemMetinSocket(dstSlotPos, 0)
  1389.         maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
  1390.  
  1391.         if mtrlVnum != constInfo.GET_ACCESSORY_MATERIAL_VNUM(dstItemVNum, item.GetItemSubType()):
  1392.             return False
  1393.        
  1394.         if curCount>=maxCount:
  1395.             return False
  1396.  
  1397.         return True
  1398.  
  1399.     def __CanAddAccessorySocket(self, dstSlotPos):
  1400.         dstItemVNum = player.GetItemIndex(dstSlotPos)
  1401.         if dstItemVNum == 0:
  1402.             return False
  1403.  
  1404.         item.SelectItem(dstItemVNum)
  1405.  
  1406.         if item.GetItemType() != item.ITEM_TYPE_ARMOR:
  1407.             return False
  1408.  
  1409.         if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
  1410.             return False
  1411.  
  1412.         curCount = player.GetItemMetinSocket(dstSlotPos, 0)
  1413.         maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
  1414.        
  1415.         ACCESSORY_SOCKET_MAX_SIZE = 3
  1416.         if maxCount >= ACCESSORY_SOCKET_MAX_SIZE:
  1417.             return False
  1418.  
  1419.         return True
  1420.  
  1421.     def __CanAddItemAttr(self, dstSlotPos):
  1422.         dstItemVNum = player.GetItemIndex(dstSlotPos)
  1423.         if dstItemVNum == 0:
  1424.             return False
  1425.  
  1426.         item.SelectItem(dstItemVNum)
  1427.        
  1428.         if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR):  
  1429.             return False
  1430.            
  1431.         attrCount = 0
  1432.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1433.             if player.GetItemAttribute(dstSlotPos, i) != 0:
  1434.                 attrCount += 1
  1435.  
  1436.         if attrCount<4:
  1437.             return True
  1438.                                
  1439.         return False
  1440.  
  1441.     def ShowToolTip(self, slotIndex):
  1442.         if None != self.tooltipItem:
  1443.             self.tooltipItem.SetInventoryItem(slotIndex)
  1444.  
  1445.     def OnTop(self):
  1446.         if None != self.tooltipItem:
  1447.             self.tooltipItem.SetTop()
  1448.            
  1449.         if app.WJ_ENABLE_TRADABLE_ICON:
  1450.             map(lambda wnd:wnd.RefreshLockedSlot(), self.bindWnds)
  1451.             self.RefreshMarkSlots()
  1452.            
  1453.     def OnPressEscapeKey(self):
  1454.         self.Close()
  1455.         return True
  1456.  
  1457.     def UseItemSlot(self, slotIndex):
  1458.         curCursorNum = app.GetCursor()
  1459.         if app.SELL == curCursorNum:
  1460.             return
  1461.  
  1462.         if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS():
  1463.             return
  1464.  
  1465.         slotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(slotIndex)
  1466.  
  1467.         if app.ENABLE_DRAGON_SOUL_SYSTEM:
  1468.             if self.wndDragonSoulRefine.IsShow():
  1469.                 self.wndDragonSoulRefine.AutoSetItem((player.INVENTORY, slotIndex), 1)
  1470.                 return
  1471.                
  1472.         if app.ITEM_CHECKINOUT_UPDATE:
  1473.             if self.wndSafeBox.IsShow() and slotIndex < player.EQUIPMENT_SLOT_START:
  1474.                 net.SendSafeboxCheckinPacket(slotIndex)
  1475.                 return
  1476.             if exchange.isTrading() and slotIndex < player.EQUIPMENT_SLOT_START:
  1477.                 net.SendExchangeItemAddPacket(player.INVENTORY, slotIndex, -1)
  1478.                 return
  1479.                
  1480.  
  1481.         self.__UseItem(slotIndex)
  1482.         mouseModule.mouseController.DeattachObject()
  1483.         self.OverOutItem()
  1484.  
  1485.     def __UseItem(self, slotIndex):
  1486.         ItemVNum = player.GetItemIndex(slotIndex)
  1487.         item.SelectItem(ItemVNum)
  1488.         if app.ENABLE_EXTEND_INVEN_SYSTEM and player.IsExtendInvenKey(ItemVNum):
  1489.             self.__ClickExtendInvenButton(player.GetExtendInvenStage())
  1490.         if app.__BL_CHEST_DROP_INFO__:
  1491.             if app.IsPressed(app.DIK_LCONTROL):
  1492.                 isMain = not app.IsPressed(app.DIK_LSHIFT)
  1493.                 if item.HasDropInfo(ItemVNum, isMain) and self.interface:
  1494.                     self.interface.OpenChestDropWindow(ItemVNum, isMain)
  1495.                 return
  1496.         if item.IsFlag(item.ITEM_FLAG_CONFIRM_WHEN_USE):
  1497.             self.questionDialog = uiCommon.QuestionDialog()
  1498.             self.questionDialog.SetText(localeInfo.INVENTORY_REALLY_USE_ITEM)
  1499.             self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnAccept))
  1500.             self.questionDialog.SetCancelEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnCancel))
  1501.             self.questionDialog.Open()
  1502.             self.questionDialog.slotIndex = slotIndex
  1503.        
  1504.             constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  1505.  
  1506.         else:
  1507.             self.__SendUseItemPacket(slotIndex)
  1508.             #net.SendItemUsePacket(slotIndex)  
  1509.  
  1510.     def __UseItemQuestionDialog_OnCancel(self):
  1511.         self.OnCloseQuestionDialog()
  1512.  
  1513.     def __UseItemQuestionDialog_OnAccept(self):
  1514.         self.__SendUseItemPacket(self.questionDialog.slotIndex)
  1515.         self.OnCloseQuestionDialog()       
  1516.  
  1517.     def __SendUseItemToItemPacket(self, srcSlotPos, dstSlotPos):
  1518.         # °³ÀλóÁ¡ ¿­°í ÀÖ´Â µ¿¾È ¾ÆÀÌÅÛ »ç¿ë ¹æÁö
  1519.         if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1520.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_PRIVATE_SHOP)
  1521.             return
  1522.  
  1523.         net.SendItemUseToItemPacket(srcSlotPos, dstSlotPos)
  1524.  
  1525.     def __SendUseItemPacket(self, slotPos):
  1526.         # °³ÀλóÁ¡ ¿­°í ÀÖ´Â µ¿¾È ¾ÆÀÌÅÛ »ç¿ë ¹æÁö
  1527.         if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1528.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_PRIVATE_SHOP)
  1529.             return
  1530.  
  1531.         net.SendItemUsePacket(slotPos)
  1532.    
  1533.     def __SendMoveItemPacket(self, srcSlotPos, dstSlotPos, srcItemCount):
  1534.         # °³ÀλóÁ¡ ¿­°í ÀÖ´Â µ¿¾È ¾ÆÀÌÅÛ »ç¿ë ¹æÁö
  1535.         if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1536.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.MOVE_ITEM_FAILURE_PRIVATE_SHOP)
  1537.             return
  1538.  
  1539.         net.SendItemMovePacket(srcSlotPos, dstSlotPos, srcItemCount)
  1540.    
  1541.     def SetDragonSoulRefineWindow(self, wndDragonSoulRefine):
  1542.         if app.ENABLE_DRAGON_SOUL_SYSTEM:
  1543.             self.wndDragonSoulRefine = wndDragonSoulRefine
  1544.            
  1545.     if app.ITEM_CHECKINOUT_UPDATE:
  1546.         def SetSafeboxWindow(self, wndSafeBox):
  1547.             self.wndSafeBox = wndSafeBox
  1548.            
  1549.     def OverInToolTipGold(self, arg)
  1550.         arglen = len(str(arg))
  1551.         pos_x, pos_y = wndMgr.GetMousePosition()
  1552.        
  1553.         self.toolTip.ClearToolTip()
  1554.         self.toolTip.SetThinBoardSize(11 * arglen)
  1555.         self.toolTip.SetToolTipPosition(pos_x + 5, pos_y - 5)
  1556.         self.toolTip.AppendTextLine(arg, 0xffffff00)
  1557.         self.toolTip.Show()
  1558.    
  1559.     def OverOutToolTipGold(self) :
  1560.         self.toolTip.Hide()
  1561.  
  1562.     def EventProgress(self, event_type, idx) :
  1563.         if "mouse_over_in" == str(event_type) :
  1564.             if idx == 0 :
  1565.                 self.OverInToolTipGold("Yang")
  1566.             else:
  1567.                 return
  1568.         elif "mouse_over_out" == str(event_type) :
  1569.             self.OverOutToolTipGold()
  1570.         else:
  1571.             return
  1572.            
  1573.     def OnMoveWindow(self, x, y):
  1574. #       print "Inventory Global Pos : ", self.GetGlobalPosition()
  1575.         if self.wndBelt:
  1576. #           print "Belt Global Pos : ", self.wndBelt.GetGlobalPosition()
  1577.             self.wndBelt.AdjustPositionAndSize()
  1578.                        
  1579.     if app.BL_ENABLE_PICKUP_ITEM_EFFECT:
  1580.         def ActivateSlot(self, slotindex, type):
  1581.             if type == wndMgr.HILIGHTSLOT_MAX:
  1582.                 return
  1583.                    
  1584.         def DeactivateSlot(self, slotindex, type):
  1585.             if type == wndMgr.HILIGHTSLOT_MAX:
  1586.                 return
  1587.  
  1588.         def __HighlightSlot_Refresh(self):
  1589.             for i in xrange(self.wndItem.GetSlotCount()):
  1590.                 slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i)
  1591.                 if slotNumber in self.listHighlightedSlot:
  1592.                     self.wndItem.ActivateSlot(i)
  1593.  
  1594.         def __HighlightSlot_Clear(self):
  1595.             for i in xrange(self.wndItem.GetSlotCount()):
  1596.                 slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i)
  1597.                 if slotNumber in self.listHighlightedSlot:
  1598.                     self.wndItem.DeactivateSlot(i)
  1599.                     self.listHighlightedSlot.remove(slotNumber)
  1600.        
  1601.         def HighlightSlot(self, slot):
  1602.             if slot>player.INVENTORY_PAGE_SIZE*player.INVENTORY_PAGE_COUNT:
  1603.                 return
  1604.            
  1605.             if not slot in self.listHighlightedSlot:
  1606.                 self.listHighlightedSlot.append (slot)
  1607.  
  1608.         def DelHighlightSlot(self, inventorylocalslot):
  1609.             if inventorylocalslot in self.listHighlightedSlot:
  1610.                 if inventorylocalslot >= player.INVENTORY_PAGE_SIZE:
  1611.                     self.wndItem.DeactivateSlot(inventorylocalslot - (self.inventoryPageIndex * player.INVENTORY_PAGE_SIZE) )
  1612.                 else:
  1613.                     self.wndItem.DeactivateSlot(inventorylocalslot)
  1614.  
  1615.                 self.listHighlightedSlot.remove(inventorylocalslot)
  1616.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement