Advertisement
Guest User

uiinv

a guest
Feb 14th, 2022
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 7.02 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.  
  22. if app.BL_ENABLE_PICKUP_ITEM_EFFECT:
  23.     def ReprGetItemIndex(window):
  24.         return lambda pos : player.GetItemIndex(window, pos)
  25.  
  26. ITEM_MALL_BUTTON_ENABLE = True
  27.  
  28.  
  29.  
  30. ITEM_FLAG_APPLICABLE = 1 = len(self.ExInvenButton):
  31.                 self.__OpenExInvenMsgDlg(localeInfo.EXINVEN_USE_ITEM_FAIL_FOURTH_PAGE_STAGE_MAX)
  32.                 return
  33.             if self.ExInvenQuestionDlg and index == player.GetExtendInvenStage():
  34.                 needkeys = []
  35.                 for n in range(player.INVENTORY_NEED_KEY_START, (player.INVENTORY_LOCKED_PAGE_COUNT*player.INVENTORY_NEED_KEY_INCREASE)+2):
  36.                     for i in range(3):
  37.                         needkeys.append(n)
  38.                 self.ExInvenQuestionDlg.SetText(localeInfo.EXINVEN_USE_ITEM_QUESTION % needkeys[index])
  39.                 self.ExInvenQuestionDlg.SetAcceptEvent(ui.__mem_func__(self.__AcceptExInvenItemUse))
  40.                 self.ExInvenQuestionDlg.SetCancelEvent(ui.__mem_func__(self.__CancelExInvenItemUse))
  41.                 w,h = self.ExInvenQuestionDlg.GetTextSize()
  42.                 self.ExInvenQuestionDlg.SetWidth( w + 40 )
  43.                 self.ExInvenQuestionDlg.Open()
  44.         def __HideAllExtendInvenButton(self):
  45.             for index in range( len(self.ExInvenButton) ):
  46.                 self.ExInvenButton[index].Hide()
  47.         def __ShowExtendInvenButton(self, cur_stage):
  48.             if self.inventoryPageIndex < player.INVENTORY_OPEN_PAGE_COUNT:
  49.                 return
  50.             count = 9
  51.             min_range = (self.inventoryPageIndex - player.INVENTORY_OPEN_PAGE_COUNT) * count
  52.             max_range = min_range + count
  53.             for button_index in range(min_range, max_range):
  54.                 if button_index == cur_stage:
  55.                     self.ExInvenButton[button_index].SetUpVisual(EX_INVEN_COVER_IMG_OPEN)
  56.                     self.ExInvenButton[button_index].SetOverVisual(EX_INVEN_COVER_IMG_OPEN)
  57.                     self.ExInvenButton[button_index].SetDownVisual(EX_INVEN_COVER_IMG_OPEN)
  58.                     self.ExInvenButton[button_index].SetDisableVisual(EX_INVEN_COVER_IMG_OPEN)
  59.                 if button_index < cur_stage:
  60.                     self.ExInvenButton[button_index].Hide()
  61.                 else:
  62.                     self.ExInvenButton[button_index].Show()
  63.         def __RefreshExinvenCoverSlot(self):
  64.             self.__HideAllExtendInvenButton()
  65.             self.__ShowExtendInvenButton(player.GetExtendInvenStage())
  66.         def __AcceptExInvenItemUse(self):
  67.             net.Envanter_genislet()
  68.             self.ExInvenQuestionDlg.Close()
  69.         def __CancelExInvenItemUse(self):
  70.             self.ExInvenQuestionDlg.Close()
  71.         def __OpenExInvenMsgDlg(self, msg):
  72.             popup = uiCommon.PopupDialog()
  73.             popup.SetText(msg)
  74.             popup.SetAcceptEvent(self.__OnClosePopupDialog)
  75.             w,h = popup.GetTextSize()
  76.             popup.SetWidth( w + 40 )
  77.             popup.Open()
  78.             if self.pop:
  79.                 self.pop.Destroy()
  80.             self.pop = popup
  81.         def OpenExInvenFallShortCountMsgDlg(self, enough_count):
  82.             popup = uiCommon.PopupDialog()
  83.             popup.SetText(localeInfo.EXINVEN_USE_ITEM_FAIL_FALL_SHORT % int(enough_count) )
  84.             popup.SetAcceptEvent(self.__OnClosePopupDialog)
  85.             popup.Open()
  86.             if self.pop:
  87.                 self.pop.Destroy()
  88.             self.pop = popup
  89.  
  90.     def ClickMallButton(self):
  91.         print "click_mall_button"
  92.         net.SendChatPacket("/click_mall")
  93.  
  94.     # DSSButton
  95.     def ClickDSSButton(self):
  96.         print "click_dss_button"
  97.         self.interface.ToggleDragonSoulWindow()
  98.  
  99.     def ClickCostumeButton(self):
  100.         print "Click Costume Button"
  101.         if self.wndCostume:
  102.             if self.wndCostume.IsShow():
  103.                 self.wndCostume.Hide()
  104.             else:
  105.                 self.wndCostume.Show()
  106.         else:
  107.             self.wndCostume = CostumeWindow(self)
  108.             self.wndCostume.Show()
  109.  
  110.     def OpenPickMoneyDialog(self):
  111.  
  112.         if mouseModule.mouseController.isAttached():
  113.  
  114.             attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  115.             if player.SLOT_TYPE_SAFEBOX == mouseModule.mouseController.GetAttachedType():
  116.  
  117.                 if player.ITEM_MONEY == mouseModule.mouseController.GetAttachedItemIndex():
  118.                     net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
  119.                     snd.PlaySound("sound/ui/money.wav")
  120.  
  121.             mouseModule.mouseController.DeattachObject()
  122.  
  123.         else:
  124.             curMoney = player.GetElk()
  125.  
  126.             if curMoney = player.INVENTORY_PAGE_SIZE * self.inventoryPageIndex:
  127.                     slotNumber -= player.INVENTORY_PAGE_SIZE * self.inventoryPageIndex
  128.                    
  129.                 isActivated = 0 != metinSocket[0]
  130.                
  131.                 if isActivated:
  132.                     self.wndItem.ActivateSlot(slotNumber)
  133.                     potionType = 0;
  134.                     if constInfo.IS_AUTO_POTION_HP(itemVnum):
  135.                         potionType = player.AUTO_POTION_TYPE_HP
  136.                     elif constInfo.IS_AUTO_POTION_SP(itemVnum):
  137.                         potionType = player.AUTO_POTION_TYPE_SP                    
  138.                    
  139.                     usedAmount = int(metinSocket[1])
  140.                     totalAmount = int(metinSocket[2])                  
  141.                     player.SetAutoPotionInfo(potionType, isActivated, (totalAmount - usedAmount), totalAmount, self.__InventoryLocalSlotPosToGlobalSlotPos(i))
  142.                    
  143.                 else:
  144.                     self.wndItem.DeactivateSlot(slotNumber)        
  145.  
  146.         if app.BL_ENABLE_PICKUP_ITEM_EFFECT:
  147.             self.__HighlightSlot_Refresh()
  148.  
  149.         self.wndItem.RefreshSlot()
  150.  
  151.         if app.ENABLE_EXTEND_INVEN_SYSTEM:
  152.             self.__RefreshExinvenCoverSlot()
  153.  
  154.         if self.wndBelt:
  155.             self.wndBelt.RefreshSlot()
  156.  
  157.     def RefreshEquipSlotWindow(self):
  158.         getItemVNum=player.GetItemIndex
  159.         getItemCount=player.GetItemCount
  160.         setItemVNum=self.wndEquip.SetItemSlot
  161.         for i in xrange(player.EQUIPMENT_PAGE_COUNT):
  162.             slotNumber = player.EQUIPMENT_SLOT_START + i
  163.             itemCount = getItemCount(slotNumber)
  164.             if itemCount =maxCount:
  165.             return False
  166.  
  167.         return True
  168.  
  169.     def __CanAddAccessorySocket(self, dstSlotPos):
  170.         dstItemVNum = player.GetItemIndex(dstSlotPos)
  171.         if dstItemVNum == 0:
  172.             return False
  173.  
  174.         item.SelectItem(dstItemVNum)
  175.  
  176.         if item.GetItemType() != item.ITEM_TYPE_ARMOR:
  177.             return False
  178.  
  179.         if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
  180.             return False
  181.  
  182.         curCount = player.GetItemMetinSocket(dstSlotPos, 0)
  183.         maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
  184.        
  185.         ACCESSORY_SOCKET_MAX_SIZE = 3
  186.         if maxCount >= ACCESSORY_SOCKET_MAX_SIZE:
  187.             return False
  188.  
  189.         return True
  190.  
  191.     def __CanAddItemAttr(self, dstSlotPos):
  192.         dstItemVNum = player.GetItemIndex(dstSlotPos)
  193.         if dstItemVNum == 0:
  194.             return False
  195.  
  196.         item.SelectItem(dstItemVNum)
  197.        
  198.         if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR):  
  199.             return False
  200.            
  201.         attrCount = 0
  202.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  203.             if player.GetItemAttribute(dstSlotPos, i) != 0:
  204.                 attrCount += 1
  205.  
  206.         if attrCountplayer.INVENTORY_PAGE_SIZE*player.INVENTORY_PAGE_COUNT:
  207.                 return
  208.            
  209.             if not slot in self.listHighlightedSlot:
  210.                 self.listHighlightedSlot.append (slot)
  211.  
  212.         def DelHighlightSlot(self, inventorylocalslot):
  213.             if inventorylocalslot in self.listHighlightedSlot:
  214.                 if inventorylocalslot >= player.INVENTORY_PAGE_SIZE:
  215.                     self.wndItem.DeactivateSlot(inventorylocalslot - (self.inventoryPageIndex * player.INVENTORY_PAGE_SIZE) )
  216.                 else:
  217.                     self.wndItem.DeactivateSlot(inventorylocalslot)
  218.  
  219.                 self.listHighlightedSlot.remove(inventorylocalslot)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement