Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import ui
- import player
- import mouseModule
- import net
- import app
- import snd
- import item
- import player
- import chat
- import grp
- import uiScriptLocale
- import uiRefine
- import uiAttachMetin
- import uiPickMoney
- import uiCommon
- import uiPrivateShopBuilder # 개인상점 열동안 ItemMove 방지
- import localeInfo
- import constInfo
- import ime
- import wndMgr
- if app.BL_ENABLE_PICKUP_ITEM_EFFECT:
- def ReprGetItemIndex(window):
- return lambda pos : player.GetItemIndex(window, pos)
- ITEM_MALL_BUTTON_ENABLE = True
- ITEM_FLAG_APPLICABLE = 1 = len(self.ExInvenButton):
- self.__OpenExInvenMsgDlg(localeInfo.EXINVEN_USE_ITEM_FAIL_FOURTH_PAGE_STAGE_MAX)
- return
- if self.ExInvenQuestionDlg and index == player.GetExtendInvenStage():
- needkeys = []
- for n in range(player.INVENTORY_NEED_KEY_START, (player.INVENTORY_LOCKED_PAGE_COUNT*player.INVENTORY_NEED_KEY_INCREASE)+2):
- for i in range(3):
- needkeys.append(n)
- self.ExInvenQuestionDlg.SetText(localeInfo.EXINVEN_USE_ITEM_QUESTION % needkeys[index])
- self.ExInvenQuestionDlg.SetAcceptEvent(ui.__mem_func__(self.__AcceptExInvenItemUse))
- self.ExInvenQuestionDlg.SetCancelEvent(ui.__mem_func__(self.__CancelExInvenItemUse))
- w,h = self.ExInvenQuestionDlg.GetTextSize()
- self.ExInvenQuestionDlg.SetWidth( w + 40 )
- self.ExInvenQuestionDlg.Open()
- def __HideAllExtendInvenButton(self):
- for index in range( len(self.ExInvenButton) ):
- self.ExInvenButton[index].Hide()
- def __ShowExtendInvenButton(self, cur_stage):
- if self.inventoryPageIndex < player.INVENTORY_OPEN_PAGE_COUNT:
- return
- count = 9
- min_range = (self.inventoryPageIndex - player.INVENTORY_OPEN_PAGE_COUNT) * count
- max_range = min_range + count
- for button_index in range(min_range, max_range):
- if button_index == cur_stage:
- self.ExInvenButton[button_index].SetUpVisual(EX_INVEN_COVER_IMG_OPEN)
- self.ExInvenButton[button_index].SetOverVisual(EX_INVEN_COVER_IMG_OPEN)
- self.ExInvenButton[button_index].SetDownVisual(EX_INVEN_COVER_IMG_OPEN)
- self.ExInvenButton[button_index].SetDisableVisual(EX_INVEN_COVER_IMG_OPEN)
- if button_index < cur_stage:
- self.ExInvenButton[button_index].Hide()
- else:
- self.ExInvenButton[button_index].Show()
- def __RefreshExinvenCoverSlot(self):
- self.__HideAllExtendInvenButton()
- self.__ShowExtendInvenButton(player.GetExtendInvenStage())
- def __AcceptExInvenItemUse(self):
- net.Envanter_genislet()
- self.ExInvenQuestionDlg.Close()
- def __CancelExInvenItemUse(self):
- self.ExInvenQuestionDlg.Close()
- def __OpenExInvenMsgDlg(self, msg):
- popup = uiCommon.PopupDialog()
- popup.SetText(msg)
- popup.SetAcceptEvent(self.__OnClosePopupDialog)
- w,h = popup.GetTextSize()
- popup.SetWidth( w + 40 )
- popup.Open()
- if self.pop:
- self.pop.Destroy()
- self.pop = popup
- def OpenExInvenFallShortCountMsgDlg(self, enough_count):
- popup = uiCommon.PopupDialog()
- popup.SetText(localeInfo.EXINVEN_USE_ITEM_FAIL_FALL_SHORT % int(enough_count) )
- popup.SetAcceptEvent(self.__OnClosePopupDialog)
- popup.Open()
- if self.pop:
- self.pop.Destroy()
- self.pop = popup
- def ClickMallButton(self):
- print "click_mall_button"
- net.SendChatPacket("/click_mall")
- # DSSButton
- def ClickDSSButton(self):
- print "click_dss_button"
- self.interface.ToggleDragonSoulWindow()
- def ClickCostumeButton(self):
- print "Click Costume Button"
- if self.wndCostume:
- if self.wndCostume.IsShow():
- self.wndCostume.Hide()
- else:
- self.wndCostume.Show()
- else:
- self.wndCostume = CostumeWindow(self)
- self.wndCostume.Show()
- def OpenPickMoneyDialog(self):
- if mouseModule.mouseController.isAttached():
- attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
- if player.SLOT_TYPE_SAFEBOX == mouseModule.mouseController.GetAttachedType():
- if player.ITEM_MONEY == mouseModule.mouseController.GetAttachedItemIndex():
- net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
- snd.PlaySound("sound/ui/money.wav")
- mouseModule.mouseController.DeattachObject()
- else:
- curMoney = player.GetElk()
- if curMoney = player.INVENTORY_PAGE_SIZE * self.inventoryPageIndex:
- slotNumber -= player.INVENTORY_PAGE_SIZE * self.inventoryPageIndex
- isActivated = 0 != metinSocket[0]
- if isActivated:
- self.wndItem.ActivateSlot(slotNumber)
- potionType = 0;
- if constInfo.IS_AUTO_POTION_HP(itemVnum):
- potionType = player.AUTO_POTION_TYPE_HP
- elif constInfo.IS_AUTO_POTION_SP(itemVnum):
- potionType = player.AUTO_POTION_TYPE_SP
- usedAmount = int(metinSocket[1])
- totalAmount = int(metinSocket[2])
- player.SetAutoPotionInfo(potionType, isActivated, (totalAmount - usedAmount), totalAmount, self.__InventoryLocalSlotPosToGlobalSlotPos(i))
- else:
- self.wndItem.DeactivateSlot(slotNumber)
- if app.BL_ENABLE_PICKUP_ITEM_EFFECT:
- self.__HighlightSlot_Refresh()
- self.wndItem.RefreshSlot()
- if app.ENABLE_EXTEND_INVEN_SYSTEM:
- self.__RefreshExinvenCoverSlot()
- if self.wndBelt:
- self.wndBelt.RefreshSlot()
- def RefreshEquipSlotWindow(self):
- getItemVNum=player.GetItemIndex
- getItemCount=player.GetItemCount
- setItemVNum=self.wndEquip.SetItemSlot
- for i in xrange(player.EQUIPMENT_PAGE_COUNT):
- slotNumber = player.EQUIPMENT_SLOT_START + i
- itemCount = getItemCount(slotNumber)
- if itemCount =maxCount:
- return False
- return True
- def __CanAddAccessorySocket(self, dstSlotPos):
- dstItemVNum = player.GetItemIndex(dstSlotPos)
- if dstItemVNum == 0:
- return False
- item.SelectItem(dstItemVNum)
- if item.GetItemType() != item.ITEM_TYPE_ARMOR:
- return False
- if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
- return False
- curCount = player.GetItemMetinSocket(dstSlotPos, 0)
- maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
- ACCESSORY_SOCKET_MAX_SIZE = 3
- if maxCount >= ACCESSORY_SOCKET_MAX_SIZE:
- return False
- return True
- def __CanAddItemAttr(self, dstSlotPos):
- dstItemVNum = player.GetItemIndex(dstSlotPos)
- if dstItemVNum == 0:
- return False
- item.SelectItem(dstItemVNum)
- if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR):
- return False
- attrCount = 0
- for i in xrange(player.METIN_SOCKET_MAX_NUM):
- if player.GetItemAttribute(dstSlotPos, i) != 0:
- attrCount += 1
- if attrCountplayer.INVENTORY_PAGE_SIZE*player.INVENTORY_PAGE_COUNT:
- return
- if not slot in self.listHighlightedSlot:
- self.listHighlightedSlot.append (slot)
- def DelHighlightSlot(self, inventorylocalslot):
- if inventorylocalslot in self.listHighlightedSlot:
- if inventorylocalslot >= player.INVENTORY_PAGE_SIZE:
- self.wndItem.DeactivateSlot(inventorylocalslot - (self.inventoryPageIndex * player.INVENTORY_PAGE_SIZE) )
- else:
- self.wndItem.DeactivateSlot(inventorylocalslot)
- self.listHighlightedSlot.remove(inventorylocalslot)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement