Advertisement
Guest User

Untitled

a guest
Mar 5th, 2018
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 51.51 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 # 개인상점 열동안 ItemMove 방지
  17. import localeInfo
  18. import constInfo
  19. import ime
  20. import wndMgr
  21. import event
  22. import exchange
  23. import paginabonusuri
  24. import background
  25. import playerSettingModule
  26. import biolog_on_button
  27. if app.ENABLE_BIOLOG_SYSTEM:
  28.     import uiprofessionalbiolog, uiToolTip
  29.  
  30. ITEM_MALL_BUTTON_ENABLE = TRUE
  31.  
  32. if app.ENABLE_SASH_SYSTEM:
  33.     import sash
  34.    
  35. if app.ENABLE_CHANGELOOK_SYSTEM:
  36.     import changelook
  37.  
  38. ITEM_FLAG_APPLICABLE = 1 << 14
  39.  
  40. EQUIPEMENT_GENDER = {
  41.     playerSettingModule.RACE_WARRIOR_M  : "d:/ymir work/interface/inventory/equipement/male.tga",
  42.     playerSettingModule.RACE_WARRIOR_W  : "d:/ymir work/interface/inventory/equipement/female.tga",
  43.     playerSettingModule.RACE_ASSASSIN_M : "d:/ymir work/interface/inventory/equipement/male.tga",
  44.     playerSettingModule.RACE_ASSASSIN_W : "d:/ymir work/interface/inventory/equipement/female.tga",
  45.     playerSettingModule.RACE_SURA_M     : "d:/ymir work/interface/inventory/equipement/male.tga",
  46.     playerSettingModule.RACE_SURA_W     : "d:/ymir work/interface/inventory/equipement/female.tga",
  47.     playerSettingModule.RACE_SHAMAN_M   : "d:/ymir work/interface/inventory/equipement/male.tga",
  48.     playerSettingModule.RACE_SHAMAN_W   : "d:/ymir work/interface/inventory/equipement/female.tga",
  49. }
  50.  
  51. class CostumeWindow(ui.ScriptWindow):
  52.  
  53.     def __init__(self, wndInventory):
  54.         import exception
  55.        
  56.         if not app.ENABLE_COSTUME_SYSTEM:          
  57.             exception.Abort("What do you do?")
  58.             return
  59.  
  60.         if not wndInventory:
  61.             exception.Abort("wndInventory parameter must be set to InventoryWindow")
  62.             return                     
  63.                  
  64.         ui.ScriptWindow.__init__(self)
  65.  
  66.         self.isLoaded = 0
  67.         self.wndInventory = wndInventory;
  68.  
  69.         self.__LoadWindow()
  70.  
  71.     def __del__(self):
  72.         ui.ScriptWindow.__del__(self)
  73.  
  74.     def Show(self):
  75.         self.__LoadWindow()
  76.         self.RefreshCostumeSlot()
  77.  
  78.         ui.ScriptWindow.Show(self)
  79.  
  80.     def Close(self):
  81.         self.Hide()
  82.  
  83.     def __LoadWindow(self):
  84.         if self.isLoaded == 1:
  85.             return
  86.  
  87.         self.isLoaded = 1
  88.  
  89.         try:
  90.             pyScrLoader = ui.PythonScriptLoader()
  91.             pyScrLoader.LoadScriptFile(self, "UIScript/CostumeWindow.py")
  92.         except:
  93.             import exception
  94.             exception.Abort("CostumeWindow.LoadWindow.LoadObject")
  95.  
  96.         try:
  97.             wndEquip = self.GetChild("CostumeSlot")
  98.             self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
  99.            
  100.         except:
  101.             import exception
  102.             exception.Abort("CostumeWindow.LoadWindow.BindObject")
  103.  
  104.         ## Equipment
  105.         wndEquip.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
  106.         wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
  107.         wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  108.         wndEquip.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))                       
  109.         wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
  110.         wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
  111.  
  112.         self.wndEquip = wndEquip
  113.  
  114.     def RefreshCostumeSlot(self):
  115.         getItemVNum=player.GetItemIndex
  116.        
  117.         for i in xrange(item.COSTUME_SLOT_COUNT):
  118.             slotNumber = item.COSTUME_SLOT_START + i
  119.             self.wndEquip.SetItemSlot(slotNumber, getItemVNum(slotNumber), 0)
  120.             if app.ENABLE_CHANGELOOK_SYSTEM:
  121.                 itemTransmutedVnum = player.GetItemTransmutation(slotNumber)
  122.                 if not itemTransmutedVnum:
  123.                     self.wndEquip.EnableCoverButton(slotNumber)
  124.                 else:
  125.                     self.wndEquip.DisableCoverButton(slotNumber)
  126.  
  127.         self.wndEquip.RefreshSlot()
  128.        
  129. class BeltInventoryWindow(ui.ScriptWindow):
  130.  
  131.     def __init__(self, wndInventory):
  132.         import exception
  133.        
  134.         if not app.ENABLE_NEW_EQUIPMENT_SYSTEM:        
  135.             exception.Abort("What do you do?")
  136.             return
  137.  
  138.         if not wndInventory:
  139.             exception.Abort("wndInventory parameter must be set to InventoryWindow")
  140.             return                     
  141.                  
  142.         ui.ScriptWindow.__init__(self)
  143.  
  144.         self.isLoaded = 0
  145.         self.wndInventory = wndInventory;
  146.        
  147.         self.wndBeltInventoryLayer = None
  148.         self.wndBeltInventorySlot = None
  149.         self.expandBtn = None
  150.         self.minBtn = None
  151.  
  152.         self.__LoadWindow()
  153.  
  154.     def __del__(self):
  155.         ui.ScriptWindow.__del__(self)
  156.  
  157.     def Show(self, openBeltSlot = FALSE):
  158.         self.__LoadWindow()
  159.         self.RefreshSlot()
  160.  
  161.         ui.ScriptWindow.Show(self)
  162.        
  163.         if openBeltSlot:
  164.             self.OpenInventory()
  165.         else:
  166.             self.CloseInventory()
  167.  
  168.     def Close(self):
  169.         self.Hide()
  170.  
  171.     def IsOpeningInventory(self):
  172.         return self.wndBeltInventoryLayer.IsShow()
  173.        
  174.     def OpenInventory(self):
  175.         self.wndBeltInventoryLayer.Show()
  176.         self.expandBtn.Hide()
  177.  
  178.         self.AdjustPositionAndSize()
  179.                
  180.     def CloseInventory(self):
  181.         self.wndBeltInventoryLayer.Hide()
  182.         self.expandBtn.Show()
  183.  
  184.         self.AdjustPositionAndSize()
  185.  
  186.     ## 현재 인벤토리 위치를 기준으로 BASE 위치를 계산, 리턴.. 숫자 하드코딩하기 정말 싫지만 방법이 없다..
  187.     def GetBasePosition(self):
  188.         x, y = self.wndInventory.GetGlobalPosition()
  189.         return x - 148, y + 241
  190.        
  191.     def AdjustPositionAndSize(self):
  192.         bx, by = self.GetBasePosition()
  193.        
  194.         if self.IsOpeningInventory():          
  195.             self.SetPosition(bx, by)
  196.             self.SetSize(self.ORIGINAL_WIDTH, self.GetHeight())
  197.            
  198.         else:
  199.             self.SetPosition(bx + 138, by);
  200.             self.SetSize(10, self.GetHeight())
  201.  
  202.     def __LoadWindow(self):
  203.         if self.isLoaded == 1:
  204.             return
  205.  
  206.         self.isLoaded = 1
  207.  
  208.         try:
  209.             pyScrLoader = ui.PythonScriptLoader()
  210.             pyScrLoader.LoadScriptFile(self, "UIScript/BeltInventoryWindow.py")
  211.         except:
  212.             import exception
  213.             exception.Abort("CostumeWindow.LoadWindow.LoadObject")
  214.  
  215.         try:
  216.             self.ORIGINAL_WIDTH = self.GetWidth()
  217.             wndBeltInventorySlot = self.GetChild("BeltInventorySlot")
  218.             self.wndBeltInventoryLayer = self.GetChild("BeltInventoryLayer")
  219.             self.expandBtn = self.GetChild("ExpandBtn")
  220.             self.minBtn = self.GetChild("MinimizeBtn")
  221.            
  222.             self.expandBtn.SetEvent(ui.__mem_func__(self.OpenInventory))
  223.             self.minBtn.SetEvent(ui.__mem_func__(self.CloseInventory))     
  224.    
  225.             for i in xrange(item.BELT_INVENTORY_SLOT_COUNT):
  226.                 slotNumber = item.BELT_INVENTORY_SLOT_START + i                        
  227.                 wndBeltInventorySlot.SetCoverButton(slotNumber, "d:/ymir work/interface/inventory/slot.tga",\
  228.                                                 "d:/ymir work/interface/inventory/slot.tga",\
  229.                                                 "d:/ymir work/interface/inventory/slot.tga",\
  230.                                                 "d:/ymir work/interface/inventory/slot_unavailable.tga", FALSE, FALSE)                                 
  231.    
  232.         except:
  233.             import exception
  234.             exception.Abort("CostumeWindow.LoadWindow.BindObject")
  235.  
  236.         ## Equipment
  237.         wndBeltInventorySlot.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
  238.         wndBeltInventorySlot.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
  239.         wndBeltInventorySlot.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  240.         wndBeltInventorySlot.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))                       
  241.         wndBeltInventorySlot.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
  242.         wndBeltInventorySlot.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
  243.  
  244.         self.wndBeltInventorySlot = wndBeltInventorySlot
  245.  
  246.     def RefreshSlot(self):
  247.         getItemVNum=player.GetItemIndex
  248.        
  249.         for i in xrange(item.BELT_INVENTORY_SLOT_COUNT):
  250.             slotNumber = item.BELT_INVENTORY_SLOT_START + i
  251.             self.wndBeltInventorySlot.SetItemSlot(slotNumber, getItemVNum(slotNumber), player.GetItemCount(slotNumber))
  252.             self.wndBeltInventorySlot.SetAlwaysRenderCoverButton(slotNumber, TRUE)
  253.            
  254.             avail = "0"
  255.            
  256.             if player.IsAvailableBeltInventoryCell(slotNumber):
  257.                 self.wndBeltInventorySlot.EnableCoverButton(slotNumber)            
  258.             else:
  259.                 self.wndBeltInventorySlot.DisableCoverButton(slotNumber)               
  260.  
  261.         self.wndBeltInventorySlot.RefreshSlot()
  262.        
  263. class InventoryWindow(ui.ScriptWindow):
  264.  
  265.     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")
  266.     MINIMIZE_INVENTORY_TWIX = FALSE
  267.     questionDialog = None
  268.     tooltipItem = None
  269.     wndCostume = None
  270.     wndBelt = None
  271.     dlgPickMoney = None
  272.    
  273.     sellingSlotNumber = -1
  274.     isLoaded = 0
  275.     isOpenedCostumeWindowWhenClosingInventory = 0       # 인벤토리 닫을 때 코스츔이 열려있었는지 여부-_-; 네이밍 ㅈㅅ
  276.     isOpenedBeltWindowWhenClosingInventory = 0      # 인벤토리 닫을 때 벨트 인벤토리가 열려있었는지 여부-_-; 네이밍 ㅈㅅ
  277.  
  278.     def __init__(self):
  279.         ui.ScriptWindow.__init__(self)
  280.  
  281.         self.isOpenedBeltWindowWhenClosingInventory = 0     # 인벤토리 닫을 때 벨트 인벤토리가 열려있었는지 여부-_-; 네이밍 ㅈㅅ
  282.  
  283.         self.__LoadWindow()
  284.  
  285.     def __del__(self):
  286.         ui.ScriptWindow.__del__(self)
  287.  
  288.     def Show(self):
  289.         self.__LoadWindow()
  290.         self.RefreshNewSlotSash()
  291.  
  292.         ui.ScriptWindow.Show(self)
  293.  
  294.         # 인벤토리를 닫을 때 코스츔이 열려있었다면 인벤토리를 열 때 코스츔도 같이 열도록 함.
  295.         if self.isOpenedCostumeWindowWhenClosingInventory and self.wndCostume:
  296.             self.wndCostume.Show()
  297.  
  298.     def BindInterfaceClass(self, interface):
  299.         self.interface = interface
  300.        
  301.     def __LoadWindow(self):
  302.         if self.isLoaded == 1:
  303.             return
  304.  
  305.         self.isLoaded = 1
  306.  
  307.         try:
  308.             pyScrLoader = ui.PythonScriptLoader()
  309.  
  310.             if ITEM_MALL_BUTTON_ENABLE:
  311.                 pyScrLoader.LoadScriptFile(self, uiScriptLocale.LOCALE_UISCRIPT_PATH + "InventoryWindow.py")
  312.             else:
  313.                 pyScrLoader.LoadScriptFile(self, "UIScript/InventoryWindow.py")
  314.         except:
  315.             import exception
  316.             exception.Abort("InventoryWindow.LoadWindow.LoadObject")
  317.  
  318.         try:
  319.             wndItem = self.GetChild("ItemSlot")
  320.             wndEquip = self.GetChild("EquipmentSlot")
  321.             self.genderEquip = self.GetChild("Gender_Equipment")
  322.             self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
  323.             self.wndMoney = self.GetChild("Money")
  324.             if app.ENABLE_COINS_INVENTORY:
  325.                 self.wndCoins = self.GetChild("Coins")
  326.             ##TWIX_SYSTEM_START
  327.             self.ButonMinimize = self.GetChild2("MinimizeInventory")
  328.             self.ButonMinimize.SetEvent(ui.__mem_func__(self.MinimizeInventoryTWIX))
  329.             self.twix_switchboot = self.GetChild2("switchboot")
  330.             self.twix_bonusuri = self.GetChild2("bonusuri")
  331.             self.twix_teleport = self.GetChild2("teleport")
  332.             self.twix_noaptezi = self.GetChild2("noaptezi")
  333.             self.twix_depozit = self.GetChild2("depozit")
  334.             self.twix_localization = self.GetChild2("localization")
  335.             self.twix_biolog_button = self.GetChild2("biolog")
  336.             ##TWIX_SYSTE_END
  337.             self.wndMoneySlot = self.GetChild("Money_Slot")
  338.             self.mallButton = self.GetChild2("MallButton")
  339.             self.DSSButton = self.GetChild2("DSSButton")
  340.             self.costumeButton = self.GetChild2("CostumeButton")
  341.            
  342.             self.inventoryTab = []
  343.             self.inventoryTab.append(self.GetChild("Inventory_Tab_01"))
  344.             self.inventoryTab.append(self.GetChild("Inventory_Tab_02"))
  345.             self.inventoryTab.append(self.GetChild("Inventory_Tab_03"))
  346.             self.inventoryTab.append(self.GetChild("Inventory_Tab_04"))
  347.            
  348.             self.equipmentTab = []
  349.             self.equipmentTab.append(self.GetChild("Equipment_Tab_01"))
  350.             self.equipmentTab.append(self.GetChild("Equipment_Tab_02"))
  351.  
  352.             if self.costumeButton and not app.ENABLE_COSTUME_SYSTEM:
  353.                 self.costumeButton.Hide()
  354.                 self.costumeButton.Destroy()
  355.                 self.costumeButton = 0
  356.  
  357.             # Belt Inventory Window
  358.             self.wndBelt = None
  359.            
  360.             if app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  361.                 self.wndBelt = BeltInventoryWindow(self)
  362.            
  363.         except:
  364.             import exception
  365.             exception.Abort("InventoryWindow.LoadWindow.BindObject")
  366.  
  367.         race = net.GetMainActorRace()
  368.         try:
  369.             genderImage = EQUIPEMENT_GENDER[race]
  370.             try:
  371.                 self.genderEquip.LoadImage(genderImage)
  372.             except:
  373.                 print ("Face.RefreshCharacter(race=%d, genderImage=%s)" % (race,genderImage))
  374.                 self.genderEquip.Hide()
  375.         except KeyError:
  376.             self.genderEquip.Hide()
  377.         ## Item
  378.         wndItem.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  379.         wndItem.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  380.         wndItem.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  381.         wndItem.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  382.         wndItem.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  383.         wndItem.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  384.  
  385.         ## Equipment
  386.         wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  387.         wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  388.         wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  389.         wndEquip.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  390.         wndEquip.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  391.         wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  392.  
  393.         ## PickMoneyDialog
  394.         dlgPickMoney = uiPickMoney.PickMoneyDialog()
  395.         dlgPickMoney.LoadDialog()
  396.         dlgPickMoney.Hide()
  397.        
  398.         self.BonusPage = paginabonusuri.BonusBoardDialog() 
  399.         self.BonusPage.Hide()
  400.  
  401.         ## RefineDialog
  402.         self.refineDialog = uiRefine.RefineDialog()
  403.         self.refineDialog.Hide()
  404.  
  405.         ## AttachMetinDialog
  406.         self.attachMetinDialog = uiAttachMetin.AttachMetinDialog()
  407.         self.attachMetinDialog.Hide()
  408.  
  409.         ## MoneySlot
  410.         self.wndMoneySlot.SetEvent(ui.__mem_func__(self.OpenPickMoneyDialog))
  411.  
  412.         self.inventoryTab[0].SetEvent(lambda arg=0: self.SetInventoryPage(arg))
  413.         self.inventoryTab[1].SetEvent(lambda arg=1: self.SetInventoryPage(arg))
  414.         self.inventoryTab[2].SetEvent(lambda arg=2: self.SetInventoryPage(arg))
  415.         self.inventoryTab[3].SetEvent(lambda arg=3: self.SetInventoryPage(arg))
  416.         self.inventoryTab[0].Down()
  417.  
  418.         self.equipmentTab[0].SetEvent(lambda arg=0: self.SetEquipmentPage(arg))
  419.         self.equipmentTab[1].SetEvent(lambda arg=1: self.SetEquipmentPage(arg))
  420.         self.equipmentTab[0].Down()
  421.         self.equipmentTab[0].Hide()
  422.         self.equipmentTab[1].Hide()
  423.  
  424.         self.wndItem = wndItem
  425.         self.wndEquip = wndEquip
  426.         self.dlgPickMoney = dlgPickMoney
  427.         self.inventoryPageIndex = 0
  428.  
  429.         # MallButton
  430.         if self.mallButton:
  431.             self.mallButton.SetEvent(ui.__mem_func__(self.ClickMallButton))
  432.  
  433.         if self.DSSButton:
  434.             #self.DSSButton.Hide()
  435.             self.DSSButton.SetEvent(ui.__mem_func__(self.ClickDSSButton))
  436.        
  437.         # Costume Button
  438.         if self.costumeButton:
  439.             self.costumeButton.SetEvent(ui.__mem_func__(self.ClickCostumeButton))
  440.            
  441.         ##SYSTEM_TWIX_START
  442.         if self.twix_switchboot:
  443.             self.twix_switchboot.SetEvent(ui.__mem_func__(self.ClickSwitchboot))
  444.            
  445.         if self.twix_bonusuri:
  446.             self.twix_bonusuri.SetEvent(ui.__mem_func__(self.ClickBonusuri))
  447.            
  448.         if self.twix_teleport:
  449.             self.twix_teleport.SetEvent(ui.__mem_func__(self.ClickTeleport))
  450.  
  451.         if self.twix_noaptezi:
  452.             self.twix_noaptezi.SetEvent(ui.__mem_func__(self.ClickNoaptezi))
  453.            
  454.         if self.twix_depozit:
  455.             self.twix_depozit.SetEvent(ui.__mem_func__(self.ClickDepozit)) 
  456.            
  457.         if self.twix_localization:
  458.             self.twix_localization.SetEvent(ui.__mem_func__(self.ClickLocalization))
  459.            
  460.         if self.twix_biolog_button:
  461.             self.twix_biolog_button.SetEvent(ui.__mem_func__(self.ClickBiologButton))
  462.         ##SYSTEM_TWIX_END  
  463.  
  464.         self.wndCostume = None
  465.        
  466.         #####
  467.  
  468.         ## Refresh
  469.         if app.ENABLE_SASH_SYSTEM:
  470.             self.listAttachedSashs = []
  471.         if app.ENABLE_CHANGELOOK_SYSTEM:
  472.             self.listAttachedCl = []
  473.         self.SetInventoryPage(0)
  474.         self.SetEquipmentPage(0)
  475.         self.RefreshItemSlot()
  476.         self.RefreshStatus()
  477.        
  478.         ##SYSTEM_TWIX_START
  479.     def MinimizeInventoryTWIX(self):
  480.         if self.MINIMIZE_INVENTORY_TWIX == FALSE:
  481.             self.GetChild("board").SetSize(185,661)
  482.             self.GetChild("TitleBar").SetWidth(170)
  483.             self.GetChild("TitleName").SetPosition(77, 3)
  484.             self.GetChild("MinimizeInventory").SetPosition(170 - 60, 10)
  485.             self.SetSize(185, 661)
  486.             self.SetPosition(wndMgr.GetScreenWidth() - 200, wndMgr.GetScreenHeight() - 37 - 680)
  487.             self.GetChild("Money_Slot").SetPosition(8, 24*2)
  488.             self.GetChild("Coins_Slot").SetPosition(8, 47*2)
  489.             self.MINIMIZE_INVENTORY_TWIX = TRUE
  490.         else:
  491.             self.GetChild("board").SetSize(240,661)
  492.             self.GetChild("TitleBar").SetWidth(170 + 55)
  493.             self.GetChild("TitleName").SetPosition((170  + 55) / 2, 3)
  494.             self.GetChild("MinimizeInventory").SetPosition(170 + 55 - 60, 10)
  495.             self.SetSize(240, 661)
  496.             self.SetPosition(wndMgr.GetScreenWidth() - 200 - 55, wndMgr.GetScreenHeight() - 37 - 680)
  497.             self.GetChild("Money_Slot").SetPosition(-20, 24*2)
  498.             self.GetChild("Coins_Slot").SetPosition(-20, 47*2)
  499.             self.MINIMIZE_INVENTORY_TWIX = FALSE
  500.            
  501.         self.PageInventoryTWIX(self.MINIMIZE_INVENTORY_TWIX)
  502.        
  503.     def PageInventoryTWIX(self, arg):
  504.         if arg == TRUE:
  505.             self.GetChild("switchboot").Hide()
  506.             self.GetChild("bonusuri").Hide()
  507.             self.GetChild("teleport").Hide()
  508.             self.GetChild("noaptezi").Hide()
  509.             self.GetChild("depozit").Hide()
  510.             self.GetChild("MallButton").Hide()
  511.             self.GetChild("CostumeButton").Hide()
  512.             self.GetChild("localization").Hide()
  513.             self.GetChild("biolog").Hide()
  514.         else:
  515.             self.GetChild("switchboot").Show()
  516.             self.GetChild("bonusuri").Show()
  517.             self.GetChild("teleport").Show()
  518.             self.GetChild("noaptezi").Show()
  519.             self.GetChild("depozit").Show()
  520.             self.GetChild("MallButton").Show()
  521.             self.GetChild("CostumeButton").Show()
  522.             self.GetChild("localization").Show()
  523.             self.GetChild("biolog").Show()
  524.         ##SYSTEM_TWIX_END
  525.  
  526.     def Destroy(self):
  527.         self.ClearDictionary()
  528.  
  529.         self.dlgPickMoney.Destroy()
  530.         self.dlgPickMoney = 0
  531.  
  532.         self.refineDialog.Destroy()
  533.         self.refineDialog = 0
  534.  
  535.         self.attachMetinDialog.Destroy()
  536.         self.attachMetinDialog = 0
  537.  
  538.         self.tooltipItem = None
  539.         self.wndItem = 0
  540.         self.wndEquip = 0
  541.         self.dlgPickMoney = 0
  542.         self.wndMoney = 0
  543.         self.wndMoneySlot = 0
  544.         self.questionDialog = None
  545.         self.mallButton = None
  546.         self.genderEquip = None
  547.         self.DSSButton = None
  548.         self.interface = None
  549.  
  550.         if self.wndCostume:
  551.             self.wndCostume.Destroy()
  552.             self.wndCostume = 0
  553.            
  554.         if self.wndBelt:
  555.             self.wndBelt.Destroy()
  556.             self.wndBelt = None
  557.            
  558.         self.inventoryTab = []
  559.         self.equipmentTab = []
  560.  
  561.     def Hide(self):
  562.         if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS():
  563.             self.OnCloseQuestionDialog()
  564.             return
  565.         if None != self.tooltipItem:
  566.             self.tooltipItem.HideToolTip()
  567.  
  568.         if self.wndCostume:
  569.             self.isOpenedCostumeWindowWhenClosingInventory = self.wndCostume.IsShow()           # 인벤토리 창이 닫힐 때 코스츔이 열려 있었는가?
  570.             self.wndCostume.Close()
  571.  
  572.         if self.wndBelt:
  573.             self.isOpenedBeltWindowWhenClosingInventory = self.wndBelt.IsOpeningInventory()     # 인벤토리 창이 닫힐 때 벨트 인벤토리도 열려 있었는가?
  574.             print "Is Opening Belt Inven?? ", self.isOpenedBeltWindowWhenClosingInventory
  575.             self.wndBelt.Close()
  576.  
  577.         if self.dlgPickMoney:
  578.             self.dlgPickMoney.Close()
  579.        
  580.         wndMgr.Hide(self.hWnd)
  581.        
  582.    
  583.     def Close(self):
  584.         self.Hide()
  585.  
  586. #   def SetInventoryPage(self, page):
  587. #       self.inventoryTab[self.inventoryPageIndex].SetUp()
  588. #       self.inventoryPageIndex = page
  589. #       self.RefreshBagSlotWindow()
  590.  
  591.     def SetInventoryPage(self, page):
  592.         self.inventoryTab[self.inventoryPageIndex].SetUp()
  593.         self.inventoryPageIndex = page
  594.         self.inventoryTab[self.inventoryPageIndex].Down()
  595.         self.RefreshBagSlotWindow()
  596.    
  597.     def SetEquipmentPage(self, page):
  598.         self.equipmentPageIndex = page
  599.         self.equipmentTab[1-page].SetUp()
  600.         self.RefreshEquipSlotWindow()
  601.  
  602.     def ClickMallButton(self):
  603.         print "click_mall_button"
  604.         net.SendChatPacket("/click_mall")
  605.  
  606.     # DSSButton
  607.     def ClickDSSButton(self):
  608.         print "click_dss_button"
  609.         self.interface.ToggleDragonSoulWindow()
  610.  
  611.     def ClickCostumeButton(self):
  612.         print "Click Costume Button"
  613.         if self.wndCostume:
  614.             if self.wndCostume.IsShow():
  615.                 self.wndCostume.Hide()
  616.             else:
  617.                 self.wndCostume.Show()
  618.         else:
  619.             self.wndCostume = CostumeWindow(self)
  620.             self.wndCostume.Show()
  621.  
  622.     def OpenPickMoneyDialog(self):
  623.  
  624.         if mouseModule.mouseController.isAttached():
  625.  
  626.             attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  627.             if player.SLOT_TYPE_SAFEBOX == mouseModule.mouseController.GetAttachedType():
  628.  
  629.                 if player.ITEM_MONEY == mouseModule.mouseController.GetAttachedItemIndex():
  630.                     net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
  631.                     snd.PlaySound("sound/ui/money.wav")
  632.  
  633.             mouseModule.mouseController.DeattachObject()
  634.  
  635.         else:
  636.             curMoney = player.GetElk()
  637.  
  638.             if curMoney <= 0:
  639.                 return
  640.  
  641.             self.dlgPickMoney.SetTitleName(localeInfo.PICK_MONEY_TITLE)
  642.             self.dlgPickMoney.SetAcceptEvent(ui.__mem_func__(self.OnPickMoney))
  643.             self.dlgPickMoney.Open(curMoney)
  644.             self.dlgPickMoney.SetMax(7) # 인벤토리 990000 제한 버그 수정
  645.  
  646.     def OnPickMoney(self, money):
  647.         mouseModule.mouseController.AttachMoney(self, player.SLOT_TYPE_INVENTORY, money)
  648.  
  649.     def OnPickItem(self, count):
  650.         itemSlotIndex = self.dlgPickMoney.itemGlobalSlotIndex
  651.         selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  652.         mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, count)
  653.  
  654.     def __InventoryLocalSlotPosToGlobalSlotPos(self, local):
  655.         if player.IsEquipmentSlot(local) or player.IsCostumeSlot(local) or (app.ENABLE_NEW_EQUIPMENT_SYSTEM and player.IsBeltInventorySlot(local)):
  656.             return local
  657.  
  658.         return self.inventoryPageIndex*player.INVENTORY_PAGE_SIZE + local
  659.  
  660.     def RefreshBagSlotWindow(self):
  661.         getItemVNum=player.GetItemIndex
  662.         getItemCount=player.GetItemCount
  663.         setItemVNum=self.wndItem.SetItemSlot
  664.        
  665.         for i in xrange(player.INVENTORY_PAGE_SIZE):
  666.             slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i)
  667.            
  668.             itemCount = getItemCount(slotNumber)
  669.             # itemCount == 0이면 소켓을 비운다.
  670.             if 0 == itemCount:
  671.                 self.wndItem.ClearSlot(i)
  672.                 continue
  673.             elif 1 == itemCount:
  674.                 itemCount = 0
  675.                
  676.             itemVnum = getItemVNum(slotNumber)
  677.             setItemVNum(i, itemVnum, itemCount)
  678.            
  679.             if app.ENABLE_CHANGELOOK_SYSTEM:
  680.                 itemTransmutedVnum = player.GetItemTransmutation(slotNumber)
  681.                 if not itemTransmutedVnum:
  682.                     self.wndItem.EnableCoverButton(i)
  683.                 else:
  684.                     self.wndItem.DisableCoverButton(i)
  685.  
  686.             ## 자동물약 (HP: #72723 ~ #72726, SP: #72727 ~ #72730) 특수처리 - 아이템인데도 슬롯에 활성화/비활성화 표시를 위한 작업임 - [hyo]
  687.             if constInfo.IS_AUTO_POTION(itemVnum):
  688.                 # metinSocket - [0] : 활성화 여부, [1] : 사용한 양, [2] : 최대 용량
  689.                 metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]  
  690.                
  691.                 if slotNumber >= player.INVENTORY_PAGE_SIZE*self.inventoryPageIndex:
  692.                     slotNumber -= player.INVENTORY_PAGE_SIZE*self.inventoryPageIndex
  693.                    
  694.                 isActivated = 0 != metinSocket[0]
  695.                
  696.                 if isActivated:
  697.                     self.wndItem.ActivateSlot(slotNumber)
  698.                     potionType = 0;
  699.                     if constInfo.IS_AUTO_POTION_HP(itemVnum):
  700.                         potionType = player.AUTO_POTION_TYPE_HP
  701.                     elif constInfo.IS_AUTO_POTION_SP(itemVnum):
  702.                         potionType = player.AUTO_POTION_TYPE_SP
  703.                    
  704.                     usedAmount = int(metinSocket[1])
  705.                     totalAmount = int(metinSocket[2])
  706.                     player.SetAutoPotionInfo(potionType, isActivated, (totalAmount - usedAmount), totalAmount, self.__InventoryLocalSlotPosToGlobalSlotPos(i))
  707.                    
  708.                 else:
  709.                     self.wndItem.DeactivateSlot(slotNumber)
  710.                    
  711.             elif 53001 <= itemVnum and 53025 >= itemVnum:
  712.                 metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
  713.  
  714.                 if slotNumber >= player.INVENTORY_PAGE_SIZE*self.inventoryPageIndex:
  715.                     slotNumber -= player.INVENTORY_PAGE_SIZE*self.inventoryPageIndex
  716.  
  717.                 isActivated = 0 != metinSocket[1]
  718.                
  719.                 if isActivated:
  720.                     self.wndItem.ActivateSlot(slotNumber)
  721.                 else:
  722.                     self.wndItem.DeactivateSlot(slotNumber)
  723.                    
  724.             elif 71124 <= itemVnum and 71128 >= itemVnum:
  725.                 metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
  726.  
  727.                 if slotNumber >= player.INVENTORY_PAGE_SIZE*self.inventoryPageIndex:
  728.                     slotNumber -= player.INVENTORY_PAGE_SIZE*self.inventoryPageIndex
  729.  
  730.                 isActivated = 0 != metinSocket[1]
  731.                
  732.                 if isActivated:
  733.                     self.wndItem.ActivateSlot(slotNumber)
  734.                    
  735.             if app.ENABLE_SASH_SYSTEM:
  736.                 slotNumberChecked = 0
  737.                 if not constInfo.IS_AUTO_POTION(itemVnum):
  738.                     self.wndItem.DeactivateSlot(i)
  739.                
  740.                 for j in xrange(sash.WINDOW_MAX_MATERIALS):
  741.                     (isHere, iCell) = sash.GetAttachedItem(j)
  742.                     if isHere:
  743.                         if iCell == slotNumber:
  744.                             self.wndItem.ActivateSlot(i, (36.00 / 255.0), (222.00 / 255.0), (3.00 / 255.0), 1.0)
  745.                             if not slotNumber in self.listAttachedSashs:
  746.                                 self.listAttachedSashs.append(slotNumber)
  747.                            
  748.                             slotNumberChecked = 1
  749.                     else:
  750.                         if slotNumber in self.listAttachedSashs and not slotNumberChecked:
  751.                             self.wndItem.DeactivateSlot(i)
  752.                             self.listAttachedSashs.remove(slotNumber)
  753.                            
  754.             if app.ENABLE_CHANGELOOK_SYSTEM:
  755.                 slotClNumberChecked = 0
  756.                 if not constInfo.IS_AUTO_POTION(itemVnum):
  757.                     self.wndItem.DeactivateSlot(i)
  758.                
  759.                 for q in xrange(changelook.WINDOW_MAX_MATERIALS):
  760.                     (isHere, iCell) = changelook.GetAttachedItem(q)
  761.                     if isHere:
  762.                         if iCell == slotNumber:
  763.                             self.wndItem.ActivateSlot(i, (238.00 / 255.0), (11.00 / 255.0), (11.00 / 255.0), 1.0)
  764.                             if not slotNumber in self.listAttachedCl:
  765.                                 self.listAttachedCl.append(slotNumber)
  766.                            
  767.                             slotClNumberChecked = 1
  768.                     else:
  769.                         if slotNumber in self.listAttachedCl and not slotClNumberChecked:
  770.                             self.wndItem.DeactivateSlot(i)
  771.                             self.listAttachedCl.remove(slotNumber)
  772.                            
  773.         self.wndItem.RefreshSlot()
  774.  
  775.         if self.wndBelt:
  776.             self.wndBelt.RefreshSlot()
  777.            
  778.     def RefreshNewSlotSash(self):
  779.         getSashVnum=player.GetItemIndex
  780.      
  781.         illumina_slot_sash = item.COSTUME_SLOT_COUNT
  782.         for sash_illumina in xrange(illumina_slot_sash):
  783.             slot_Sash = item.COSTUME_SLOT_START + sash_illumina
  784.             self.wndEquip.SetItemSlot(slot_Sash, getSashVnum(slot_Sash), 0)
  785.  
  786.         self.wndEquip.RefreshSlot()
  787.  
  788.     def RefreshEquipSlotWindow(self):
  789.         getItemVNum=player.GetItemIndex
  790.         getItemCount=player.GetItemCount
  791.         setItemVNum=self.wndEquip.SetItemSlot
  792.         for i in xrange(player.EQUIPMENT_PAGE_COUNT):
  793.             slotNumber = player.EQUIPMENT_SLOT_START + i
  794.             itemCount = getItemCount(slotNumber)
  795.             if itemCount <= 1:
  796.                 itemCount = 0
  797.             setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount)
  798.            
  799.             illumina_slot_sash = item.COSTUME_SLOT_COUNT
  800.             for sash_illumina in xrange(illumina_slot_sash):
  801.                 slot_Sash = item.COSTUME_SLOT_START + sash_illumina
  802.                 self.wndEquip.SetItemSlot(slot_Sash, getItemVNum(slot_Sash), 0)
  803.  
  804.             if app.ENABLE_CHANGELOOK_SYSTEM:
  805.                 itemTransmutedVnum = player.GetItemTransmutation(slotNumber)
  806.                 if not itemTransmutedVnum:
  807.                     self.wndEquip.EnableCoverButton(slotNumber)
  808.                 else:
  809.                     self.wndEquip.DisableCoverButton(slotNumber)
  810.  
  811.         if app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  812.             for i in xrange(player.NEW_EQUIPMENT_SLOT_COUNT):
  813.                 slotNumber = player.NEW_EQUIPMENT_SLOT_START + i
  814.                 itemCount = getItemCount(slotNumber)
  815.                 if itemCount <= 1:
  816.                     itemCount = 0
  817.                 setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount)
  818.                 if app.ENABLE_CHANGELOOK_SYSTEM:
  819.                     itemTransmutedVnum = player.GetItemTransmutation(slotNumber)
  820.                     if not itemTransmutedVnum:
  821.                         self.wndEquip.EnableCoverButton(slotNumber)
  822.                     else:
  823.                         self.wndEquip.DisableCoverButton(slotNumber)
  824.                 print "ENABLE_NEW_EQUIPMENT_SYSTEM", slotNumber, itemCount, getItemVNum(slotNumber)
  825.  
  826.         self.wndEquip.RefreshSlot()
  827.        
  828.         if self.wndCostume:
  829.             self.wndCostume.RefreshCostumeSlot()
  830.  
  831.     def RefreshItemSlot(self):
  832.         self.RefreshBagSlotWindow()
  833.         self.RefreshEquipSlotWindow()
  834.  
  835.     def RefreshStatus(self):
  836.         money = player.GetElk()
  837.         self.wndMoney.SetText(localeInfo.NumberToMoneyString(money))
  838.         if app.ENABLE_COINS_INVENTORY:
  839.             self.wndCoins.SetText(localeInfo.NumberToSecondaryCoinString(constInfo.Coins))
  840.  
  841.     def SetItemToolTip(self, tooltipItem):
  842.         self.tooltipItem = tooltipItem
  843.  
  844.     def SellItem(self):
  845.         if self.sellingSlotitemIndex == player.GetItemIndex(self.sellingSlotNumber):
  846.             if self.sellingSlotitemCount == player.GetItemCount(self.sellingSlotNumber):
  847.                 ## 용혼석도 팔리게 하는 기능 추가하면서 인자 type 추가
  848.                 net.SendShopSellPacketNew(self.sellingSlotNumber, self.questionDialog.count, player.INVENTORY)
  849.                 snd.PlaySound("sound/ui/money.wav")
  850.         self.OnCloseQuestionDialog()
  851.  
  852.     def OnDetachMetinFromItem(self):
  853.         if None == self.questionDialog:
  854.             return
  855.            
  856.         #net.SendItemUseToItemPacket(self.questionDialog.sourcePos, self.questionDialog.targetPos)     
  857.         self.__SendUseItemToItemPacket(self.questionDialog.sourcePos, self.questionDialog.targetPos)
  858.         self.OnCloseQuestionDialog()
  859.  
  860.     def OnCloseQuestionDialog(self):
  861.         if not self.questionDialog:
  862.             return
  863.        
  864.         self.questionDialog.Close()
  865.         self.questionDialog = None
  866.         constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
  867.  
  868.     ## Slot Event
  869.     def SelectEmptySlot(self, selectedSlotPos):
  870.         if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
  871.             return
  872.  
  873.         selectedSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(selectedSlotPos)
  874.  
  875.         if mouseModule.mouseController.isAttached():
  876.  
  877.             attachedSlotType = mouseModule.mouseController.GetAttachedType()
  878.             attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  879.             attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
  880.             attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
  881.  
  882.             if player.SLOT_TYPE_INVENTORY == attachedSlotType:
  883.                 itemCount = player.GetItemCount(attachedSlotPos)
  884.                 attachedCount = mouseModule.mouseController.GetAttachedItemCount()
  885.                 self.__SendMoveItemPacket(attachedSlotPos, selectedSlotPos, attachedCount)
  886.  
  887.                 if item.IsRefineScroll(attachedItemIndex):
  888.                     self.wndItem.SetUseMode(FALSE)
  889.  
  890.             elif player.SLOT_TYPE_PRIVATE_SHOP == attachedSlotType:
  891.                 mouseModule.mouseController.RunCallBack("INVENTORY")
  892.  
  893.             elif player.SLOT_TYPE_SHOP == attachedSlotType:
  894.                 net.SendShopBuyPacket(attachedSlotPos)
  895.  
  896.             elif player.SLOT_TYPE_SAFEBOX == attachedSlotType:
  897.  
  898.                 if player.ITEM_MONEY == attachedItemIndex:
  899.                     net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
  900.                     snd.PlaySound("sound/ui/money.wav")
  901.  
  902.                 else:
  903.                     net.SendSafeboxCheckoutPacket(attachedSlotPos, selectedSlotPos)
  904.  
  905.             elif player.SLOT_TYPE_MALL == attachedSlotType:
  906.                 net.SendMallCheckoutPacket(attachedSlotPos, selectedSlotPos)
  907.  
  908.             mouseModule.mouseController.DeattachObject()
  909.  
  910.     def SelectItemSlot(self, itemSlotIndex):
  911.         if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
  912.             return
  913.  
  914.         itemSlotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(itemSlotIndex)
  915.  
  916.         if mouseModule.mouseController.isAttached():
  917.             attachedSlotType = mouseModule.mouseController.GetAttachedType()
  918.             attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  919.             attachedItemVID = mouseModule.mouseController.GetAttachedItemIndex()
  920.  
  921.             if player.SLOT_TYPE_INVENTORY == attachedSlotType:
  922.                 self.__DropSrcItemToDestItemInInventory(attachedItemVID, attachedSlotPos, itemSlotIndex)
  923.  
  924.             mouseModule.mouseController.DeattachObject()
  925.  
  926.         else:
  927.  
  928.             curCursorNum = app.GetCursor()
  929.             if app.SELL == curCursorNum:
  930.                 self.__SellItem(itemSlotIndex)
  931.                
  932.             elif app.BUY == curCursorNum:
  933.                 chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SHOP_BUY_INFO)
  934.  
  935.             elif app.IsPressed(app.DIK_LALT):
  936.                 link = player.GetItemLink(itemSlotIndex)
  937.                 ime.PasteString(link)
  938.  
  939.             elif app.IsPressed(app.DIK_LSHIFT):
  940.                 itemCount = player.GetItemCount(itemSlotIndex)
  941.                
  942.                 if itemCount > 1:
  943.                     self.dlgPickMoney.SetTitleName(localeInfo.PICK_ITEM_TITLE)
  944.                     self.dlgPickMoney.SetAcceptEvent(ui.__mem_func__(self.OnPickItem))
  945.                     self.dlgPickMoney.Open(itemCount)
  946.                     self.dlgPickMoney.itemGlobalSlotIndex = itemSlotIndex
  947.                 #else:
  948.                     #selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  949.                     #mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum)
  950.  
  951.             elif app.IsPressed(app.DIK_LCONTROL):
  952.                 itemIndex = player.GetItemIndex(itemSlotIndex)
  953.  
  954.                 if TRUE == item.CanAddToQuickSlotItem(itemIndex):
  955.                     player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_INVENTORY, itemSlotIndex)
  956.                 else:
  957.                     chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.QUICKSLOT_REGISTER_DISABLE_ITEM)
  958.  
  959.             else:
  960.                 selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  961.                 itemCount = player.GetItemCount(itemSlotIndex)
  962.                 mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
  963.                
  964.                 if self.__IsUsableItemToItem(selectedItemVNum, itemSlotIndex):             
  965.                     self.wndItem.SetUseMode(TRUE)
  966.                 else:                  
  967.                     self.wndItem.SetUseMode(FALSE)
  968.  
  969.                 snd.PlaySound("sound/ui/pick.wav")
  970.  
  971.     def __DropSrcItemToDestItemInInventory(self, srcItemVID, srcItemSlotPos, dstItemSlotPos):
  972.         if srcItemSlotPos == dstItemSlotPos:
  973.             return
  974.                
  975.         elif item.IsRefineScroll(srcItemVID):
  976.             self.RefineItem(srcItemSlotPos, dstItemSlotPos)
  977.             self.wndItem.SetUseMode(FALSE)
  978.  
  979.         elif item.IsMetin(srcItemVID):
  980.             self.AttachMetinToItem(srcItemSlotPos, dstItemSlotPos)
  981.  
  982.         elif item.IsDetachScroll(srcItemVID):
  983.             self.DetachMetinFromItem(srcItemSlotPos, dstItemSlotPos)
  984.  
  985.         elif item.IsKey(srcItemVID):
  986.             self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)         
  987.  
  988.         elif (player.GetItemFlags(srcItemSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  989.             self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  990.  
  991.         elif item.GetUseType(srcItemVID) in self.USE_TYPE_TUPLE:
  992.             self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)         
  993.  
  994.         else:
  995.             #snd.PlaySound("sound/ui/drop.wav")
  996.  
  997.             ## 이동시킨 곳이 장착 슬롯일 경우 아이템을 사용해서 장착 시킨다 - [levites]
  998.             if player.IsEquipmentSlot(dstItemSlotPos):
  999.  
  1000.                 ## 들고 있는 아이템이 장비일때만
  1001.                 if item.IsEquipmentVID(srcItemVID):
  1002.                     self.__UseItem(srcItemSlotPos)
  1003.  
  1004.             else:
  1005.                 self.__SendMoveItemPacket(srcItemSlotPos, dstItemSlotPos, 0)
  1006.                 #net.SendItemMovePacket(srcItemSlotPos, dstItemSlotPos, 0)
  1007.  
  1008.     def __SellItem(self, itemSlotPos):
  1009.         if not player.IsEquipmentSlot(itemSlotPos):
  1010.             self.sellingSlotNumber = itemSlotPos
  1011.             itemIndex = player.GetItemIndex(itemSlotPos)
  1012.             itemCount = player.GetItemCount(itemSlotPos)
  1013.            
  1014.            
  1015.             self.sellingSlotitemIndex = itemIndex
  1016.             self.sellingSlotitemCount = itemCount
  1017.  
  1018.             item.SelectItem(itemIndex)
  1019.             ## 안티 플레그 검사 빠져서 추가
  1020.             ## 20140220
  1021.             if item.IsAntiFlag(item.ANTIFLAG_SELL):
  1022.                 popup = uiCommon.PopupDialog()
  1023.                 popup.SetText(localeInfo.SHOP_CANNOT_SELL_ITEM)
  1024.                 popup.SetAcceptEvent(self.__OnClosePopupDialog)
  1025.                 popup.Open()
  1026.                 self.popup = popup
  1027.                 return
  1028.  
  1029.             itemPrice = item.GetISellItemPrice()
  1030.  
  1031.             if item.Is1GoldItem():
  1032.                 itemPrice = itemCount / itemPrice / 5
  1033.             else:
  1034.                 itemPrice = itemPrice * itemCount / 5
  1035.  
  1036.             item.GetItemName(itemIndex)
  1037.             itemName = item.GetItemName()
  1038.  
  1039.             self.questionDialog = uiCommon.QuestionDialog()
  1040.             self.questionDialog.SetText(localeInfo.DO_YOU_SELL_ITEM(itemName, itemCount, itemPrice))
  1041.             self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.SellItem))
  1042.             self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1043.             self.questionDialog.Open()
  1044.             self.questionDialog.count = itemCount
  1045.        
  1046.             constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  1047.  
  1048.     def __OnClosePopupDialog(self):
  1049.         self.pop = None
  1050.  
  1051.     def RefineItem(self, scrollSlotPos, targetSlotPos):
  1052.  
  1053.         scrollIndex = player.GetItemIndex(scrollSlotPos)
  1054.         targetIndex = player.GetItemIndex(targetSlotPos)
  1055.  
  1056.         if player.REFINE_OK != player.CanRefine(scrollIndex, targetSlotPos):
  1057.             return
  1058.  
  1059.         ###########################################################
  1060.         self.__SendUseItemToItemPacket(scrollSlotPos, targetSlotPos)
  1061.         #net.SendItemUseToItemPacket(scrollSlotPos, targetSlotPos)
  1062.         return
  1063.         ###########################################################
  1064.  
  1065.         ###########################################################
  1066.         #net.SendRequestRefineInfoPacket(targetSlotPos)
  1067.         #return
  1068.         ###########################################################
  1069.  
  1070.         result = player.CanRefine(scrollIndex, targetSlotPos)
  1071.  
  1072.         if player.REFINE_ALREADY_MAX_SOCKET_COUNT == result:
  1073.             #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1074.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_MORE_SOCKET)
  1075.  
  1076.         elif player.REFINE_NEED_MORE_GOOD_SCROLL == result:
  1077.             #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1078.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NEED_BETTER_SCROLL)
  1079.  
  1080.         elif player.REFINE_CANT_MAKE_SOCKET_ITEM == result:
  1081.             #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1082.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_SOCKET_DISABLE_ITEM)
  1083.  
  1084.         elif player.REFINE_NOT_NEXT_GRADE_ITEM == result:
  1085.             #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1086.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_UPGRADE_DISABLE_ITEM)
  1087.  
  1088.         elif player.REFINE_CANT_REFINE_METIN_TO_EQUIPMENT == result:
  1089.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_EQUIP_ITEM)
  1090.  
  1091.         if player.REFINE_OK != result:
  1092.             return
  1093.  
  1094.         self.refineDialog.Open(scrollSlotPos, targetSlotPos)
  1095.  
  1096.     def DetachMetinFromItem(self, scrollSlotPos, targetSlotPos):
  1097.         scrollIndex = player.GetItemIndex(scrollSlotPos)
  1098.         targetIndex = player.GetItemIndex(targetSlotPos)
  1099.  
  1100.         if app.ENABLE_SASH_SYSTEM:
  1101.             if not player.CanDetach(scrollIndex, targetSlotPos):
  1102.                 item.SelectItem(scrollIndex)
  1103.                 if item.GetValue(0) == sash.CLEAN_ATTR_VALUE0:
  1104.                     chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SASH_FAILURE_CLEAN)
  1105.                 else:
  1106.                     chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_METIN_INSEPARABLE_ITEM)
  1107.                
  1108.                 return
  1109.         else:
  1110.             if not player.CanDetach(scrollIndex, targetSlotPos):
  1111.                 chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_METIN_INSEPARABLE_ITEM)
  1112.                 return
  1113.                
  1114.         if app.ENABLE_CHANGELOOK_SYSTEM:
  1115.             if not player.CanDetach(scrollIndex, targetSlotPos):
  1116.                 item.SelectItem(scrollIndex)
  1117.                 if item.GetValue(0) == changelook.CLEAN_ATTR_VALUE0:
  1118.                     chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CHANGE_LOOK_FAILURE_CLEAN)
  1119.                 else:
  1120.                     chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_METIN_INSEPARABLE_ITEM)
  1121.                
  1122.                 return
  1123.         else:
  1124.             if not player.CanDetach(scrollIndex, targetSlotPos):
  1125.                 chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_METIN_INSEPARABLE_ITEM)
  1126.                 return
  1127.        
  1128.         self.questionDialog = uiCommon.QuestionDialog()
  1129.         self.questionDialog.SetText(localeInfo.REFINE_DO_YOU_SEPARATE_METIN)
  1130.  
  1131.         if app.ENABLE_SASH_SYSTEM:
  1132.             item.SelectItem(targetIndex)
  1133.             if item.GetItemType() == item.ITEM_TYPE_COSTUME and item.GetItemSubType() == item.COSTUME_TYPE_SASH:
  1134.                 item.SelectItem(scrollIndex)
  1135.                 if item.GetValue(0) == sash.CLEAN_ATTR_VALUE0:
  1136.                     self.questionDialog.SetText(localeInfo.SASH_DO_YOU_CLEAN)
  1137.                    
  1138.         if app.ENABLE_CHANGELOOK_SYSTEM:
  1139.             item.SelectItem(targetIndex)
  1140.             if item.GetItemType() == item.ITEM_TYPE_WEAPON or item.GetItemType() == item.ITEM_TYPE_ARMOR or item.GetItemType() == item.ITEM_TYPE_COSTUME:
  1141.                 item.SelectItem(scrollIndex)
  1142.                 if item.GetValue(0) == changelook.CLEAN_ATTR_VALUE0:
  1143.                     self.questionDialog.SetText(localeInfo.CHANGE_LOOK_DO_YOU_CLEAN)
  1144.        
  1145.         self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.OnDetachMetinFromItem))
  1146.         self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1147.         self.questionDialog.Open()
  1148.         self.questionDialog.sourcePos = scrollSlotPos
  1149.         self.questionDialog.targetPos = targetSlotPos
  1150.  
  1151.     def AttachMetinToItem(self, metinSlotPos, targetSlotPos):
  1152.         metinIndex = player.GetItemIndex(metinSlotPos)
  1153.         targetIndex = player.GetItemIndex(targetSlotPos)
  1154.  
  1155.         item.SelectItem(metinIndex)
  1156.         itemName = item.GetItemName()
  1157.  
  1158.         result = player.CanAttachMetin(metinIndex, targetSlotPos)
  1159.  
  1160.         if player.ATTACH_METIN_NOT_MATCHABLE_ITEM == result:
  1161.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_CAN_NOT_ATTACH(itemName))
  1162.  
  1163.         if player.ATTACH_METIN_NO_MATCHABLE_SOCKET == result:
  1164.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_SOCKET(itemName))
  1165.  
  1166.         elif player.ATTACH_METIN_NOT_EXIST_GOLD_SOCKET == result:
  1167.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_GOLD_SOCKET(itemName))
  1168.  
  1169.         elif player.ATTACH_METIN_CANT_ATTACH_TO_EQUIPMENT == result:
  1170.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_EQUIP_ITEM)
  1171.  
  1172.         if player.ATTACH_METIN_OK != result:
  1173.             return
  1174.  
  1175.         self.attachMetinDialog.Open(metinSlotPos, targetSlotPos)
  1176.  
  1177.  
  1178.        
  1179.     def OverOutItem(self):
  1180.         self.wndItem.SetUsableItem(FALSE)
  1181.         if None != self.tooltipItem:
  1182.             self.tooltipItem.HideToolTip()
  1183.  
  1184.     def OverInItem(self, overSlotPos):
  1185.         overSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(overSlotPos)
  1186.         self.wndItem.SetUsableItem(FALSE)
  1187.  
  1188.         if mouseModule.mouseController.isAttached():
  1189.             attachedItemType = mouseModule.mouseController.GetAttachedType()
  1190.             if player.SLOT_TYPE_INVENTORY == attachedItemType:
  1191.  
  1192.                 attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1193.                 attachedItemVNum = mouseModule.mouseController.GetAttachedItemIndex()
  1194.                
  1195.                 if self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPos):
  1196.                     self.wndItem.SetUsableItem(TRUE)
  1197.                     self.ShowToolTip(overSlotPos)
  1198.                     return
  1199.                
  1200.         self.ShowToolTip(overSlotPos)
  1201.  
  1202.  
  1203.     def __IsUsableItemToItem(self, srcItemVNum, srcSlotPos):
  1204.         "다른 아이템에 사용할 수 있는 아이템인가?"
  1205.  
  1206.         if item.IsRefineScroll(srcItemVNum):
  1207.             return TRUE
  1208.         elif item.IsMetin(srcItemVNum):
  1209.             return TRUE
  1210.         elif item.IsDetachScroll(srcItemVNum):
  1211.             return TRUE
  1212.         elif item.IsKey(srcItemVNum):
  1213.             return TRUE
  1214.         elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1215.             return TRUE
  1216.         else:
  1217.             if item.GetUseType(srcItemVNum) in self.USE_TYPE_TUPLE:
  1218.                 return TRUE
  1219.            
  1220.         return FALSE
  1221.  
  1222.     def __CanUseSrcItemToDstItem(self, srcItemVNum, srcSlotPos, dstSlotPos):
  1223.         "대상 아이템에 사용할 수 있는가?"
  1224.  
  1225.         if srcSlotPos == dstSlotPos:
  1226.             return FALSE
  1227.  
  1228.         if item.IsRefineScroll(srcItemVNum):
  1229.             if player.REFINE_OK == player.CanRefine(srcItemVNum, dstSlotPos):
  1230.                 return TRUE
  1231.         elif item.IsMetin(srcItemVNum):
  1232.             if player.ATTACH_METIN_OK == player.CanAttachMetin(srcItemVNum, dstSlotPos):
  1233.                 return TRUE
  1234.         elif item.IsDetachScroll(srcItemVNum):
  1235.             if player.DETACH_METIN_OK == player.CanDetach(srcItemVNum, dstSlotPos):
  1236.                 return TRUE
  1237.         elif item.IsKey(srcItemVNum):
  1238.             if player.CanUnlock(srcItemVNum, dstSlotPos):
  1239.                 return TRUE
  1240.  
  1241.         elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1242.             return TRUE
  1243.  
  1244.         else:
  1245.             useType=item.GetUseType(srcItemVNum)
  1246.  
  1247.             if "USE_CLEAN_SOCKET" == useType:
  1248.                 if self.__CanCleanBrokenMetinStone(dstSlotPos):
  1249.                     return TRUE
  1250.             elif "USE_CHANGE_ATTRIBUTE" == useType:
  1251.                 if self.__CanChangeItemAttrList(dstSlotPos):
  1252.                     return TRUE
  1253.             elif "USE_ADD_ATTRIBUTE" == useType:
  1254.                 if self.__CanAddItemAttr(dstSlotPos):
  1255.                     return TRUE
  1256.             elif "USE_ADD_ATTRIBUTE2" == useType:
  1257.                 if self.__CanAddItemAttr(dstSlotPos):
  1258.                     return TRUE
  1259.             elif "USE_ADD_ACCESSORY_SOCKET" == useType:
  1260.                 if self.__CanAddAccessorySocket(dstSlotPos):
  1261.                     return TRUE
  1262.             elif "USE_PUT_INTO_ACCESSORY_SOCKET" == useType:                               
  1263.                 if self.__CanPutAccessorySocket(dstSlotPos, srcItemVNum):
  1264.                     return TRUE;
  1265.             elif "USE_PUT_INTO_BELT_SOCKET" == useType:                            
  1266.                 dstItemVNum = player.GetItemIndex(dstSlotPos)
  1267.                 print "USE_PUT_INTO_BELT_SOCKET", srcItemVNum, dstItemVNum
  1268.  
  1269.                 item.SelectItem(dstItemVNum)
  1270.        
  1271.                 if item.ITEM_TYPE_BELT == item.GetItemType():
  1272.                     return TRUE
  1273.  
  1274.         return FALSE
  1275.  
  1276.     def __CanCleanBrokenMetinStone(self, dstSlotPos):
  1277.         dstItemVNum = player.GetItemIndex(dstSlotPos)
  1278.         if dstItemVNum == 0:
  1279.             return FALSE
  1280.  
  1281.         item.SelectItem(dstItemVNum)
  1282.        
  1283.         if item.ITEM_TYPE_WEAPON != item.GetItemType():
  1284.             return FALSE
  1285.  
  1286.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1287.             if player.GetItemMetinSocket(dstSlotPos, i) == constInfo.ERROR_METIN_STONE:
  1288.                 return TRUE
  1289.  
  1290.         return FALSE
  1291.  
  1292.     def __CanChangeItemAttrList(self, dstSlotPos):
  1293.         dstItemVNum = player.GetItemIndex(dstSlotPos)
  1294.         if dstItemVNum == 0:
  1295.             return FALSE
  1296.  
  1297.         item.SelectItem(dstItemVNum)
  1298.        
  1299.         if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR):  
  1300.             return FALSE
  1301.  
  1302.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1303.             if player.GetItemAttribute(dstSlotPos, i) != 0:
  1304.                 return TRUE
  1305.  
  1306.         return FALSE
  1307.  
  1308.     def __CanPutAccessorySocket(self, dstSlotPos, mtrlVnum):
  1309.         dstItemVNum = player.GetItemIndex(dstSlotPos)
  1310.         if dstItemVNum == 0:
  1311.             return FALSE
  1312.  
  1313.         item.SelectItem(dstItemVNum)
  1314.  
  1315.         if item.GetItemType() != item.ITEM_TYPE_ARMOR:
  1316.             return FALSE
  1317.  
  1318.         if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
  1319.             return FALSE
  1320.  
  1321.         curCount = player.GetItemMetinSocket(dstSlotPos, 0)
  1322.         maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
  1323.  
  1324.         if mtrlVnum != constInfo.GET_ACCESSORY_MATERIAL_VNUM(dstItemVNum, item.GetItemSubType()):
  1325.             return FALSE
  1326.        
  1327.         if curCount>=maxCount:
  1328.             return FALSE
  1329.  
  1330.         return TRUE
  1331.  
  1332.     def __CanAddAccessorySocket(self, dstSlotPos):
  1333.         dstItemVNum = player.GetItemIndex(dstSlotPos)
  1334.         if dstItemVNum == 0:
  1335.             return FALSE
  1336.  
  1337.         item.SelectItem(dstItemVNum)
  1338.  
  1339.         if item.GetItemType() != item.ITEM_TYPE_ARMOR:
  1340.             return FALSE
  1341.  
  1342.         if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
  1343.             return FALSE
  1344.  
  1345.         curCount = player.GetItemMetinSocket(dstSlotPos, 0)
  1346.         maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
  1347.        
  1348.         ACCESSORY_SOCKET_MAX_SIZE = 3
  1349.         if maxCount >= ACCESSORY_SOCKET_MAX_SIZE:
  1350.             return FALSE
  1351.  
  1352.         return TRUE
  1353.  
  1354.     def __CanAddItemAttr(self, dstSlotPos):
  1355.         dstItemVNum = player.GetItemIndex(dstSlotPos)
  1356.         if dstItemVNum == 0:
  1357.             return FALSE
  1358.  
  1359.         item.SelectItem(dstItemVNum)
  1360.        
  1361.         if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR):  
  1362.             return FALSE
  1363.            
  1364.         attrCount = 0
  1365.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1366.             if player.GetItemAttribute(dstSlotPos, i) != 0:
  1367.                 attrCount += 1
  1368.  
  1369.         if attrCount<4:
  1370.             return TRUE
  1371.                                
  1372.         return FALSE
  1373.  
  1374.     def ShowToolTip(self, slotIndex):
  1375.         if None != self.tooltipItem:
  1376.             self.tooltipItem.SetInventoryItem(slotIndex)
  1377.  
  1378.     def OnTop(self):
  1379.         if None != self.tooltipItem:
  1380.             self.tooltipItem.SetTop()
  1381.  
  1382.     def OnPressEscapeKey(self):
  1383.         self.Close()
  1384.         return TRUE
  1385.  
  1386.     def UseItemSlot(self, slotIndex):
  1387.         if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS():
  1388.             return
  1389.        
  1390.         slotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(slotIndex)
  1391.         if app.ENABLE_DRAGON_SOUL_SYSTEM:
  1392.             if self.wndDragonSoulRefine.IsShow():
  1393.                 self.wndDragonSoulRefine.AutoSetItem((player.INVENTORY, slotIndex), 1)
  1394.                 return
  1395.        
  1396.         if app.ENABLE_SASH_SYSTEM:
  1397.             if self.isShowSashWindow():
  1398.                 sash.Add(player.INVENTORY, slotIndex, 255)
  1399.                 return
  1400.                
  1401.         if app.ENABLE_CHANGELOOK_SYSTEM:
  1402.             if self.isShowChangeLookWindow():
  1403.                 changelook.Add(player.INVENTORY, slotIndex, 255)
  1404.                 return
  1405.        
  1406.         self.__UseItem(slotIndex)
  1407.         mouseModule.mouseController.DeattachObject()
  1408.         self.OverOutItem()
  1409.        
  1410.     if app.ENABLE_FAST_CHEST_OPEN:
  1411.         def IsTreasureBox(self, slotIndex):
  1412.             itemVnum = player.GetItemIndex(slotIndex)
  1413.             item.SelectItem(itemVnum)
  1414.            
  1415.             if item.GetItemType() == item.ITEM_TYPE_GIFTBOX:
  1416.                 return True
  1417.                
  1418.                
  1419.             ## you can set own treasures which not have item giftbox type, simply add vnums here
  1420.             treasures = {
  1421.                 0: 50011,
  1422.                 1: 50024,
  1423.                 2: 50025,
  1424.                 3: 50031,
  1425.                 4: 50032,
  1426.             }
  1427.            
  1428.             if itemVnum in treasures.values():
  1429.                 return True
  1430.                
  1431.             return False
  1432.  
  1433.         def SendMultipleUseItemPacket(self, slotIndex):
  1434.             for i in xrange(player.GetItemCount(slotIndex)):
  1435.                 self.__SendUseItemPacket(slotIndex)
  1436.  
  1437.     def __UseItem(self, slotIndex):
  1438.         ItemVNum = player.GetItemIndex(slotIndex)
  1439.         item.SelectItem(ItemVNum)
  1440.         if item.IsFlag(item.ITEM_FLAG_CONFIRM_WHEN_USE):
  1441.             self.questionDialog = uiCommon.QuestionDialog()
  1442.             self.questionDialog.SetText(localeInfo.INVENTORY_REALLY_USE_ITEM)
  1443.             self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnAccept))
  1444.             self.questionDialog.SetCancelEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnCancel))
  1445.             self.questionDialog.Open()
  1446.             self.questionDialog.slotIndex = slotIndex
  1447.        
  1448.             constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  1449.  
  1450.         else:
  1451.             self.__SendUseItemPacket(slotIndex)
  1452.             #net.SendItemUsePacket(slotIndex)
  1453.  
  1454.         if app.ENABLE_FAST_CHEST_OPEN:
  1455.             if app.IsPressed(app.DIK_LCONTROL) and self.IsTreasureBox(slotIndex):
  1456.                 self.SendMultipleUseItemPacket(slotIndex)
  1457.                 return         
  1458.  
  1459.     def __UseItemQuestionDialog_OnCancel(self):
  1460.         self.OnCloseQuestionDialog()
  1461.  
  1462.     def __UseItemQuestionDialog_OnAccept(self):
  1463.         self.__SendUseItemPacket(self.questionDialog.slotIndex)
  1464.         self.OnCloseQuestionDialog()       
  1465.  
  1466.     def __SendUseItemToItemPacket(self, srcSlotPos, dstSlotPos):
  1467.         # 개인상점 열고 있는 동안 아이템 사용 방지
  1468.         if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1469.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_PRIVATE_SHOP)
  1470.             return
  1471.  
  1472.         net.SendItemUseToItemPacket(srcSlotPos, dstSlotPos)
  1473.  
  1474.     def __SendUseItemPacket(self, slotPos):
  1475.         # 개인상점 열고 있는 동안 아이템 사용 방지
  1476.         if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1477.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_PRIVATE_SHOP)
  1478.             return
  1479.  
  1480.         net.SendItemUsePacket(slotPos)
  1481.    
  1482.     def __SendMoveItemPacket(self, srcSlotPos, dstSlotPos, srcItemCount):
  1483.         # 개인상점 열고 있는 동안 아이템 사용 방지
  1484.         if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1485.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.MOVE_ITEM_FAILURE_PRIVATE_SHOP)
  1486.             return
  1487.  
  1488.         net.SendItemMovePacket(srcSlotPos, dstSlotPos, srcItemCount)
  1489.    
  1490.     def SetDragonSoulRefineWindow(self, wndDragonSoulRefine):
  1491.         if app.ENABLE_DRAGON_SOUL_SYSTEM:
  1492.             self.wndDragonSoulRefine = wndDragonSoulRefine
  1493.            
  1494.     if app.ENABLE_SASH_SYSTEM:
  1495.         def SetSashWindow(self, wndSashCombine, wndSashAbsorption):
  1496.             self.wndSashCombine = wndSashCombine
  1497.             self.wndSashAbsorption = wndSashAbsorption
  1498.  
  1499.         def isShowSashWindow(self):
  1500.             if self.wndSashCombine:
  1501.                 if self.wndSashCombine.IsShow():
  1502.                     return 1
  1503.  
  1504.             if self.wndSashAbsorption:
  1505.                 if self.wndSashAbsorption.IsShow():
  1506.                     return 1
  1507.            
  1508.             return 0
  1509.            
  1510.     if app.ENABLE_CHANGELOOK_SYSTEM:
  1511.         def SetChangeLookWindow(self, wndChangeLook):
  1512.             self.wndChangeLook = wndChangeLook
  1513.  
  1514.         def isShowChangeLookWindow(self):
  1515.             if self.wndChangeLook:
  1516.                 if self.wndChangeLook.IsShow():
  1517.                     return 1
  1518.            
  1519.             return 0
  1520.            
  1521.     def OnMoveWindow(self, x, y):
  1522. #       print "Inventory Global Pos : ", self.GetGlobalPosition()
  1523.         if self.wndBelt:
  1524. #           print "Belt Global Pos : ", self.wndBelt.GetGlobalPosition()
  1525.             self.wndBelt.AdjustPositionAndSize()
  1526.                        
  1527.  
  1528.     ##SYSTEM_TWIX_START
  1529.     def ClickSwitchboot(self):
  1530.         constInfo.SWITCHBOT = 1
  1531.         snd.PlaySound('sound/ui/pick.wav')
  1532.        
  1533.     def ClickTeleport(self):
  1534.         import event
  1535.         qid = constInfo.Teleportqin
  1536.         event.QuestButtonClick(qid)
  1537.        
  1538.     def ClickBonusuri(self):
  1539.         self.BonusPage.OpenWindow()
  1540.         snd.PlaySound('sound/ui/pick.wav')
  1541.  
  1542.     def ClickNoaptezi(self):
  1543.         if constInfo.Night == 0:
  1544.             background.RegisterEnvironmentData(1, constInfo.ENVIRONMENT_NIGHT)
  1545.             background.SetEnvironmentData(1)
  1546.             constInfo.Night = 1
  1547.         else:
  1548.             background.SetEnvironmentData(0)
  1549.             constInfo.Night = 0
  1550.         snd.PlaySound('sound/ui/pick.wav')
  1551.  
  1552.     def ClickDepozit(self):
  1553.         import event
  1554.         qid = constInfo.Depozitqin
  1555.         event.QuestButtonClick(qid)
  1556.         snd.PlaySound('sound/ui/pick.wav') 
  1557.  
  1558.     def ClickLocalization(self):
  1559.         net.SendChatPacket("/localization open")
  1560.         snd.PlaySound('sound/ui/pick.wav')     
  1561.        
  1562.     def ClickBiologButton(self):
  1563.         self.biolog = biolog_on_button.CollectInventoryWindow()
  1564.         self.biolog.Show()
  1565.         self.Close()
  1566.         snd.PlaySound('sound/ui/pick.wav')
  1567.     ##SYSTEM_TWIX_END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement