Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import ui
- import net
- import item
- import skill
- import localeInfo
- import wndMgr
- import player
- import constInfo
- import mouseModule
- import uiScriptLocale
- import app
- import chat
- import math
- MOUSE_SETTINGS = [0, 0]
- def InitMouseButtonSettings(left, right):
- global MOUSE_SETTINGS
- MOUSE_SETTINGS = [left, right]
- def SetMouseButtonSetting(dir, event):
- global MOUSE_SETTINGS
- MOUSE_SETTINGS[dir] = event
- def GetMouseButtonSettings():
- global MOUSE_SETTINGS
- return MOUSE_SETTINGS
- def SaveMouseButtonSettings():
- global MOUSE_SETTINGS
- open("mouse.cfg", "w").write("%s\t%s" % tuple(MOUSE_SETTINGS))
- def LoadMouseButtonSettings():
- global MOUSE_SETTINGS
- tokens = open("mouse.cfg", "r").read().split()
- if len(tokens) != 2:
- raise RuntimeError, "MOUSE_SETTINGS_FILE_ERROR"
- MOUSE_SETTINGS[0] = int(tokens[0])
- MOUSE_SETTINGS[1] = int(tokens[1])
- def unsigned32(n):
- return n & 0xFFFFFFFFL
- #-------------------Giftbox Begin------------------------------
- class GiftBox(ui.ScriptWindow):
- class TextToolTip(ui.Window):
- def __init__(self):
- ui.Window.__init__(self, "TOP_MOST")
- self.SetWindowName("GiftBox")
- textLine = ui.TextLine()
- textLine.SetParent(self)
- textLine.SetHorizontalAlignCenter()
- textLine.SetOutline()
- textLine.Show()
- self.textLine = textLine
- def __del__(self):
- ui.Window.__del__(self)
- def SetText(self, text):
- self.textLine.SetText(text)
- def OnRender(self):
- (mouseX, mouseY) = wndMgr.GetMousePosition()
- self.textLine.SetPosition(mouseX, mouseY - 15)
- def __init__(self):
- #print "NEW TASKBAR ----------------------------------------------------------------------------"
- ui.ScriptWindow.__init__(self)
- self.tooltipGift = self.TextToolTip()
- self.tooltipGift.Show()
- def __del__(self):
- #print "---------------------------------------------------------------------------- DELETE TASKBAR"
- ui.ScriptWindow.__del__(self)
- def LoadWindow(self):
- try:
- pyScrLoader = ui.PythonScriptLoader()
- pyScrLoader.LoadScriptFile(self, uiScriptLocale.LOCALE_UISCRIPT_PATH + "giftbox.py")
- except:
- import exception
- exception.Abort("GiftBox.LoadWindow.LoadObject")
- self.giftBoxIcon = self.GetChild("GiftBox_Icon")
- self.giftBoxToolTip = self.GetChild("GiftBox_ToolTip")
- def Destroy(self):
- self.giftBoxIcon = 0
- self.giftBoxToolTip = 0
- #-------------------Giftbox End------------------------------
- class EnergyBar(ui.ScriptWindow):
- class TextToolTip(ui.Window):
- def __init__(self):
- ui.Window.__init__(self, "TOP_MOST")
- self.SetWindowName("EnergyBar")
- textLine = ui.TextLine()
- textLine.SetParent(self)
- textLine.SetHorizontalAlignCenter()
- textLine.SetOutline()
- textLine.Show()
- self.textLine = textLine
- def __del__(self):
- ui.Window.__del__(self)
- def SetText(self, text):
- self.textLine.SetText(text)
- def OnRender(self):
- (mouseX, mouseY) = wndMgr.GetMousePosition()
- self.textLine.SetPosition(mouseX, mouseY - 15)
- def __init__(self):
- #print "NEW TASKBAR ----------------------------------------------------------------------------"
- ui.ScriptWindow.__init__(self)
- self.tooltipEnergy = self.TextToolTip()
- self.tooltipEnergy.Show()
- def __del__(self):
- #print "---------------------------------------------------------------------------- DELETE TASKBAR"
- ui.ScriptWindow.__del__(self)
- def LoadWindow(self):
- try:
- pyScrLoader = ui.PythonScriptLoader()
- pyScrLoader.LoadScriptFile(self, uiScriptLocale.LOCALE_UISCRIPT_PATH + "EnergyBar.py")
- except:
- import exception
- exception.Abort("EnergyBar.LoadWindow.LoadObject")
- self.energyEmpty = self.GetChild("EnergyGauge_Empty")
- self.energyHungry = self.GetChild("EnergyGauge_Hungry")
- self.energyFull = self.GetChild("EnergyGauge_Full")
- self.energyGaugeBoard = self.GetChild("EnergyGauge_Board")
- self.energyGaugeToolTip = self.GetChild("EnergyGauge_ToolTip")
- def Destroy(self):
- self.energyEmpty = None
- self.energyHungry = None
- self.energyFull = None
- self.energyGaugeBoard = 0
- self.energyGaugeToolTip = 0
- self.tooltipEnergy = 0
- ## Gauge
- def RefreshStatus(self):
- pointEnergy = player.GetStatus (player.ENERGY)
- leftTimeEnergy = player.GetStatus (player.ENERGY_END_TIME) - app.GetGlobalTimeStamp()
- ##this for game.py
- def SetEnergy (self, point, leftTime, maxTime):
- leftTime = max (leftTime, 0)
- maxTime = max (maxTime, 0)
- self.energyEmpty.Hide()
- self.energyHungry.Hide()
- self.energyFull.Hide()
- if leftTime == 0:
- self.energyEmpty.Show()
- elif ((leftTime * 100) / maxTime) < 15:
- self.energyHungry.Show()
- else:
- self.energyFull.Show()
- self.tooltipEnergy.SetText("%s" % (localeInfo.TOOLTIP_ENERGY(point)))
- def OnUpdate(self):
- if True == self.energyGaugeToolTip.IsIn():
- self.RefreshStatus()
- self.tooltipEnergy.Show()
- else:
- self.tooltipEnergy.Hide()
- class ExpandedTaskBar(ui.ScriptWindow):
- BUTTON_DRAGON_SOUL = 0
- def __init__(self):
- ui.Window.__init__(self)
- self.SetWindowName("ExpandedTaskBar")
- def LoadWindow(self):
- try:
- pyScrLoader = ui.PythonScriptLoader()
- pyScrLoader.LoadScriptFile(self, uiScriptLocale.LOCALE_UISCRIPT_PATH + "ExpandedTaskBar.py")
- except:
- import exception
- exception.Abort("ExpandedTaskBar.LoadWindow.LoadObject")
- self.expandedTaskBarBoard = self.GetChild("ExpanedTaskBar_Board")
- self.toggleButtonDict = {}
- self.toggleButtonDict[ExpandedTaskBar.BUTTON_DRAGON_SOUL] = self.GetChild("DragonSoulButton")
- self.toggleButtonDict[ExpandedTaskBar.BUTTON_DRAGON_SOUL].SetParent(self)
- def SetTop(self):
- super(ExpandedTaskBar, self).SetTop()
- for button in self.toggleButtonDict.values():
- button.SetTop()
- def Show(self):
- ui.ScriptWindow.Show(self)
- def Close(self):
- self.Hide()
- def SetToolTipText(self, eButton, text):
- self.toggleButtonDict[eButton].SetToolTipText(text)
- def SetToggleButtonEvent(self, eButton, kEventFunc):
- self.toggleButtonDict[eButton].SetEvent(kEventFunc)
- def OnPressEscapeKey(self):
- self.Close()
- return True
- class TaskBar(ui.ScriptWindow):
- BUTTON_CHARACTER = 0
- BUTTON_INVENTORY = 1
- BUTTON_MESSENGER = 2
- BUTTON_SYSTEM = 3
- BUTTON_CHAT = 4
- BUTTON_EXPAND = 4
- IS_EXPANDED = False
- MOUSE_BUTTON_LEFT = 0
- MOUSE_BUTTON_RIGHT = 1
- NONE = 255
- EVENT_MOVE = 0
- EVENT_ATTACK = 1
- EVENT_MOVE_AND_ATTACK = 2
- EVENT_CAMERA = 3
- EVENT_SKILL = 4
- EVENT_AUTO = 5
- GAUGE_WIDTH = 95
- GAUGE_HEIGHT = 13
- QUICKPAGE_NUMBER_FILENAME = [
- "button/quickslot_page1.tga",
- "button/quickslot_page2.tga",
- "button/quickslot_page3.tga",
- "button/quickslot_page4.tga",
- ]
- #gift icon show and hide
- def ShowGift(self):
- if not localeInfo.IsBRAZIL():
- self.wndGiftBox.Show()
- def HideGift(self):
- self.wndGiftBox.Hide()
- class TextToolTip(ui.Window):
- def __init__(self):
- ui.ScriptWindow.__init__(self, "TOP_MOST")
- self.rightTaskBar = ui.ScriptWindow("TOP_MOST")
- self.quickPageNumImageBox = None
- self.tooltipItem = 0
- self.tooltipSkill = 0
- self.mouseModeButtonList = [ ui.ScriptWindow("TOP_MOST"), ui.ScriptWindow("TOP_MOST") ]
- self.skillCategoryNameList = [ "ACTIVE_1", "ACTIVE_2", "ACTIVE_3" ]
- self.skillPageStartSlotIndexDict = {
- "ACTIVE_1" : 1,
- "ACTIVE_2" : 21,
- "ACTIVE_3" : 41,
- }
- self.selectSkillButtonList = []
- self.lastUpdateQuickSlot = 0
- self.SetWindowName("TaskBar")
- def __del__(self):
- ui.Window.__del__(self)
- def SetText(self, text):
- self.textLine.SetText(text)
- def OnRender(self):
- (mouseX, mouseY) = wndMgr.GetMousePosition()
- self.textLine.SetPosition(mouseX, mouseY - 15)
- class SkillButton(ui.SlotWindow):
- def __init__(self):
- ui.SlotWindow.__init__(self)
- self.event = 0
- self.arg = 0
- self.slotIndex = 0
- self.skillIndex = 0
- slotIndex = 0
- wndMgr.SetSlotBaseImage(self.hWnd, "d:/ymir work/ui/public/slot_base.sub", 1.0, 1.0, 1.0, 1.0)
- wndMgr.AppendSlot(self.hWnd, slotIndex, 0, 0, 32, 32)
- self.SetCoverButton(slotIndex, "d:/ymir work/ui/public/slot_cover_button_01.sub",\
- "d:/ymir work/ui/public/slot_cover_button_02.sub",\
- "d:/ymir work/ui/public/slot_cover_button_03.sub",\
- "d:/ymir work/ui/public/slot_cover_button_04.sub", True, False)
- self.SetSize(32, 32)
- def __del__(self):
- ui.SlotWindow.__del__(self)
- def Destroy(self):
- if 0 != self.tooltipSkill:
- self.tooltipSkill.HideToolTip()
- def RefreshSkill(self):
- if 0 != self.slotIndex:
- self.SetSkill(self.slotIndex)
- def SetSkillToolTip(self, tooltip):
- self.tooltipSkill = tooltip
- def SetSkill(self, skillSlotNumber):
- slotNumber = 0
- skillIndex = player.GetSkillIndex(skillSlotNumber)
- skillGrade = player.GetSkillGrade(skillSlotNumber)
- skillLevel = player.GetSkillLevel(skillSlotNumber)
- skillType = skill.GetSkillType(skillIndex)
- self.skillIndex = skillIndex
- if 0 == self.skillIndex:
- self.ClearSlot(slotNumber)
- return
- self.slotIndex = skillSlotNumber
- self.SetSkillSlotNew(slotNumber, skillIndex, skillGrade, skillLevel)
- self.SetSlotCountNew(slotNumber, skillGrade, skillLevel)
- ## NOTE : CoolTime üũ
- if player.IsSkillCoolTime(skillSlotNumber):
- (coolTime, elapsedTime) = player.GetSkillCoolTime(skillSlotNumber)
- self.SetSlotCoolTime(slotNumber, coolTime, elapsedTime)
- ## NOTE : Activate µÇ¾î ÀÖ´Ù¸é ¾ÆÀÌÄܵµ ¾÷µ¥ÀÌÆ®
- if player.IsSkillActive(skillSlotNumber):
- self.ActivateSlot(slotNumber)
- def SetSkillEvent(self, event, arg=0):
- self.event = event
- self.arg = arg
- def GetSkillIndex(self):
- return self.skillIndex
- def GetSlotIndex(self):
- return self.slotIndex
- def Activate(self, coolTime):
- self.SetSlotCoolTime(0, coolTime)
- if skill.IsToggleSkill(self.skillIndex):
- self.ActivateSlot(0)
- def Deactivate(self):
- if skill.IsToggleSkill(self.skillIndex):
- self.DeactivateSlot(0)
- def OnOverInItem(self, dummy):
- self.tooltipSkill.SetSkill(self.skillIndex)
- def OnOverOutItem(self):
- self.tooltipSkill.HideToolTip()
- def OnSelectItemSlot(self, dummy):
- if 0 != self.event:
- if 0 != self.arg:
- self.event(self.arg)
- else:
- self.event()
- def __init__(self):
- ui.ScriptWindow.__init__(self, "TOP_MOST")
- self.quickPageNumImageBox = None
- self.tooltipItem = 0
- self.tooltipSkill = 0
- self.mouseModeButtonList = [ ui.ScriptWindow("TOP_MOST"), ui.ScriptWindow("TOP_MOST") ]
- self.tooltipHP = self.TextToolTip()
- self.tooltipHP.Show()
- self.tooltipSP = self.TextToolTip()
- self.tooltipSP.Show()
- self.tooltipST = self.TextToolTip()
- self.tooltipST.Show()
- self.tooltipEXP = self.TextToolTip()
- self.tooltipEXP.Show()
- self.skillCategoryNameList = [ "ACTIVE_1", "ACTIVE_2", "ACTIVE_3" ]
- self.skillPageStartSlotIndexDict = {
- "ACTIVE_1" : 1,
- "ACTIVE_2" : 21,
- "ACTIVE_3" : 41,
- }
- self.selectSkillButtonList = []
- self.lastUpdateQuickSlot = 0
- self.SetWindowName("TaskBar")
- def __del__(self):
- #print "---------------------------------------------------------------------------- DELETE TASKBAR"
- ui.ScriptWindow.__del__(self)
- def LoadWindow(self):
- try:
- pyScrLoader = ui.PythonScriptLoader()
- pyScrLoader.LoadScriptFile(self, "UIScript/TaskBar.py")
- pyScrLoader.LoadScriptFile(self.mouseModeButtonList[self.MOUSE_BUTTON_LEFT], "UIScript/MouseButtonWindow.py")
- pyScrLoader.LoadScriptFile(self.mouseModeButtonList[self.MOUSE_BUTTON_RIGHT], "UIScript/RightMouseButtonWindow.py")
- pyScrLoader.LoadScriptFile(self.rightTaskBar, "UIScript/RightTaskBar.py")
- except:
- import exception
- exception.Abort("TaskBar.LoadWindow.LoadObject")
- self.quickslot = []
- self.quickslot.append(self.GetChild("quick_slot_1"))
- self.quickslot.append(self.GetChild("quick_slot_2"))
- for slot in self.quickslot:
- slot.SetSlotStyle(wndMgr.SLOT_STYLE_NONE)
- slot.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptyQuickSlot))
- slot.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemQuickSlot))
- slot.SetUnselectItemSlotEvent(ui.__mem_func__(self.UnselectItemQuickSlot))
- slot.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
- slot.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
- toggleButtonDict = {}
- toggleButtonDict[TaskBar.BUTTON_CHARACTER]=self.GetChild("CharacterButton")
- toggleButtonDict[TaskBar.BUTTON_INVENTORY]=self.rightTaskBar.GetChild("InventoryButton")
- toggleButtonDict[TaskBar.BUTTON_MESSENGER]=self.rightTaskBar.GetChild("MessengerButton")
- toggleButtonDict[TaskBar.BUTTON_SYSTEM]=self.rightTaskBar.GetChild("SystemButton")
- # ChatButton, ExpandButton µÑ Áß Çϳª´Â ¹Ýµå½Ã Á¸ÀçÇÑ´Ù.
- try:
- toggleButtonDict[TaskBar.BUTTON_CHAT]=self.GetChild("ChatButton")
- except:
- toggleButtonDict[TaskBar.BUTTON_EXPAND]=self.GetChild("ExpandButton")
- TaskBar.IS_EXPANDED = TRUE
- if localeInfo.IsARABIC():
- systemButton = toggleButtonDict[TaskBar.BUTTON_SYSTEM]
- if systemButton.ToolTipText:
- tx, ty = systemButton.ToolTipText.GetLocalPosition()
- tw = systemButton.ToolTipText.GetWidth()
- systemButton.ToolTipText.SetPosition(-tw/2, ty)
- self.quickPageNumImageBox=self.GetChild("QuickPageNumber")
- self.BlackImage = self.GetChild("Black_Window")
- self.BlackImage.Hide()
- self.BlackShow = 0
- self.GetChild("QuickPageUpButton").SetEvent(ui.__mem_func__(self.__OnClickQuickPageUpButton))
- self.GetChild("QuickPageDownButton").SetEvent(ui.__mem_func__(self.__OnClickQuickPageDownButton))
- mouseLeftButtonModeButton = self.GetChild("LeftMouseButton")
- mouseRightButtonModeButton = self.GetChild("RightMouseButton")
- mouseLeftButtonModeButton.SetEvent(ui.__mem_func__(self.ToggleLeftMouseButtonModeWindow))
- mouseRightButtonModeButton.SetEvent(ui.__mem_func__(self.ToggleRightMouseButtonModeWindow))
- self.curMouseModeButton = [ mouseLeftButtonModeButton, mouseRightButtonModeButton ]
- (xLocalRight, yLocalRight) = mouseRightButtonModeButton.GetLocalPosition()
- self.curSkillButton = self.SkillButton()
- self.curSkillButton.SetParent(self)
- self.curSkillButton.SetPosition(xLocalRight, 3)
- self.curSkillButton.SetSkillEvent(ui.__mem_func__(self.ToggleRightMouseButtonModeWindow))
- self.curSkillButton.Hide()
- (xLeft, yLeft) = mouseLeftButtonModeButton.GetGlobalPosition()
- (xRight, yRight) = mouseRightButtonModeButton.GetGlobalPosition()
- leftModeButtonList = self.mouseModeButtonList[self.MOUSE_BUTTON_LEFT]
- leftModeButtonList.SetPosition(xLeft, yLeft - leftModeButtonList.GetHeight()-5)
- rightModeButtonList = self.mouseModeButtonList[self.MOUSE_BUTTON_RIGHT]
- rightModeButtonList.SetPosition(xRight - rightModeButtonList.GetWidth() + 32, yRight - rightModeButtonList.GetHeight()-5)
- rightModeButtonList.GetChild("button_skill").SetEvent(lambda adir=self.MOUSE_BUTTON_RIGHT, aevent=self.EVENT_SKILL: self.SelectMouseButtonEvent(adir, aevent))
- rightModeButtonList.GetChild("button_skill").Hide()
- mouseImage = ui.ImageBox("TOP_MOST")
- mouseImage.AddFlag("float")
- mouseImage.LoadImage("d:/ymir work/ui/game/taskbar/mouse_button_camera_01.sub")
- mouseImage.SetPosition(xRight, wndMgr.GetScreenHeight() - 34)
- mouseImage.Hide()
- self.mouseImage = mouseImage
- dir = self.MOUSE_BUTTON_LEFT
- wnd = self.mouseModeButtonList[dir]
- wnd.GetChild("button_move_and_attack").SetEvent(lambda adir=dir, aevent=self.EVENT_MOVE_AND_ATTACK: self.SelectMouseButtonEvent(adir, aevent))
- wnd.GetChild("button_auto_attack").SetEvent(lambda adir=dir, aevent=self.EVENT_AUTO: self.SelectMouseButtonEvent(adir, aevent))
- wnd.GetChild("button_camera").SetEvent(lambda adir=dir, aevent=self.EVENT_CAMERA: self.SelectMouseButtonEvent(adir, aevent))
- dir = self.MOUSE_BUTTON_RIGHT
- wnd = self.mouseModeButtonList[dir]
- wnd.GetChild("button_move_and_attack").SetEvent(lambda adir=dir, aevent=self.EVENT_MOVE_AND_ATTACK: self.SelectMouseButtonEvent(adir, aevent))
- wnd.GetChild("button_camera").SetEvent(lambda adir=dir, aevent=self.EVENT_CAMERA: self.SelectMouseButtonEvent(adir, aevent))
- self.toggleButtonDict = toggleButtonDict
- ##Exp Bubble ----------------------------------------
- self.ExpBubbleAnimation = self.GetChild("ExpAnimation")
- self.ExpBubbleFull = self.GetChild("ExpFull")
- self.SetCenterBubble()
- self.ExpToolTip = self.TextToolTip()
- ###### end bubble -----------------------------------
- self.LoadRightTaskBar()
- ###begin mp and hp bar----------------------------------
- self.HpCenter = self.GetChild("HpCenter")
- self.HpHead = self.GetChild("HpHead")
- self.HpRecoveryCenter = self.GetChild("HpRecoveryCenter")
- self.HpRecoveryCenter.SetAlpha(0.2)
- self.HpRecoveryHead = self.GetChild("HpRecoveryHead")
- self.HpRecoveryHead.SetAlpha(0.2)
- self.HpStatus = 0
- self.HpRecoveryStatus = 0
- self.MpStatus = 0
- self.MpRecoveryStatus = 0
- self.MpCenter = self.GetChild("MpCenter")
- self.MpHead = self.GetChild("MpHead")
- self.MpRecoveryCenter = self.GetChild("MpRecoveryCenter")
- self.MpRecoveryHead = self.GetChild("MpRecoveryHead")
- self.HpEmptyBar = self.GetChild("HpEmpty")
- self.MpEmptyBar = self.GetChild("MpEmpty")
- self.SetParameters()
- #tooltip
- self.HPToolTip = self.TextToolTip()
- self.MPToolTip = self.TextToolTip()
- ###end mp and hp bar ------------------------------------
- ##begin race image and text set
- self.RaceImage = []
- self.race = net.GetMainActorRace()
- print"Race = %s "%str(self.race)
- for num_race in xrange(0,9):
- image_name = "race_0"+str(num_race)
- self.RaceImage.append(self.GetChild(image_name))
- if self.race != num_race:
- self.RaceImage[num_race].Hide()
- self.array_race_name = ["Guerriero","Ninja","Sura","Shamana","Guerriera","Ninja","Sura","Shamano","Lycan"]
- self.Race = self.GetChild("RaceText")
- self.Race.SetText(self.array_race_name[self.race])
- self.level_string = "Lv" + str(player.GetStatus(player.LEVEL))
- self.Level = self.GetChild("LvText")
- self.Level.SetText(self.level_string)
- ##end race image
- #giftbox object
- wndGiftBox = GiftBox()
- wndGiftBox.LoadWindow()
- self.wndGiftBox = wndGiftBox
- self.__LoadMouseSettings()
- self.RefreshQuickSlot()
- mouseRightButtonModeButton.Hide()
- def LoadRightTaskBar(self):
- right_task = self.rightTaskBar
- self.rampageGauge1 = right_task.GetChild("RampageGauge")
- self.rampageGauge1.Show()
- self.rampageGauge1.SetTop()
- self.ItemShopIsAlreadyInside = False
- right_task.Show()
- right_task.GetChild("ItemShopButton").Hide()
- right_task.GetChild("ItemShopButton").SetEvent(ui.__mem_func__(self.OnClickButtonItemShop))
- self.EnergyImage = []
- for j in xrange(1,18):
- name = "EnergyBar_" + str(j)
- self.EnergyImage.append(right_task.GetChild(name))
- self.EnergyImage[j-1].Hide()
- self.EnergyActualImage = 0
- self.EnergyStatus = 2
- self.EnergyToolTip = self.TextToolTip()
- def Destroy(self):
- SaveMouseButtonSettings()
- self.ClearDictionary()
- self.mouseModeButtonList[0].ClearDictionary()
- self.mouseModeButtonList[1].ClearDictionary()
- self.mouseModeButtonList = 0
- self.curMouseModeButton = 0
- self.curSkillButton = 0
- self.selectSkillButtonList = 0
- self.tooltipItem = 0
- self.tooltipSkill = 0
- self.quickslot = 0
- self.toggleButtonDict = 0
- self.mouseImage = None
- #removed all gauge
- def __OnClickQuickPageUpButton(self):
- player.SetQuickPage(player.GetQuickPage()-1)
- def __OnClickQuickPageDownButton(self):
- player.SetQuickPage(player.GetQuickPage()+1)
- def SetToggleButtonEvent(self, eButton, kEventFunc):
- self.toggleButtonDict[eButton].SetEvent(kEventFunc)
- def OnClickButtonItemShop(self):
- print "rampage_up"
- net.SendChatPacket("/in_game_mall")
- def SetItemToolTip(self, tooltipItem):
- self.tooltipItem = tooltipItem
- def SetSkillToolTip(self, tooltipSkill):
- self.tooltipSkill = tooltipSkill
- self.curSkillButton.SetSkillToolTip(self.tooltipSkill)
- ## Mouse Image
- def ShowMouseImage(self):
- #self.mouseImage.SetTop()
- self.mouseImage.Hide()
- def HideMouseImage(self):
- player.SetQuickCameraMode(False)
- self.mouseImage.Hide()
- ## Gauge
- def RefreshStatus(self):
- self.UpdateLevelAndRace()
- self.RefreshEnergy()
- def RefreshStamina(self):
- curST = player.GetStatus(player.STAMINA)
- maxST = player.GetStatus(player.MAX_STAMINA)
- def RefreshSkill(self):
- self.curSkillButton.RefreshSkill()
- for button in self.selectSkillButtonList:
- button.RefreshSkill()
- ## QuickSlot
- def RefreshQuickSlot(self):
- pageNum = player.GetQuickPage()
- try:
- self.quickPageNumImageBox.LoadImage(TaskBar.QUICKPAGE_NUMBER_FILENAME[pageNum])
- except:
- pass
- startNumber = 0
- for slot in self.quickslot:
- for i in xrange(4):
- slotNumber = i+startNumber
- (Type, Position) = player.GetLocalQuickSlot(slotNumber)
- if player.SLOT_TYPE_NONE == Type:
- slot.ClearSlot(slotNumber)
- continue
- if player.SLOT_TYPE_INVENTORY == Type:
- itemIndex = player.GetItemIndex(Position)
- itemCount = player.GetItemCount(Position)
- if itemCount <= 1:
- itemCount = 0
- ## ÀÚµ¿¹°¾à (#72723, #72724) Ư¼öó¸® - ¾ÆÀÌÅÛÀε¥µµ ½½·Ô¿¡ È°¼ºÈ/ºñÈ°¼ºÈ Ç¥½Ã¸¦ À§ÇÑ ÀÛ¾÷ÀÓ - [hyo]
- if constInfo.IS_AUTO_POTION(itemIndex):
- # metinSocket - [0] : È°¼ºÈ ¿©ºÎ, [1] : »ç¿ëÇÑ ¾ç, [2] : ÃÖ´ë ¿ë·®
- metinSocket = [player.GetItemMetinSocket(Position, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
- if 0 != int(metinSocket[0]):
- slot.ActivateSlot(slotNumber)
- else:
- slot.DeactivateSlot(slotNumber)
- slot.SetItemSlot(slotNumber, itemIndex, itemCount)
- elif player.SLOT_TYPE_SKILL == Type:
- skillIndex = player.GetSkillIndex(Position)
- if 0 == skillIndex:
- slot.ClearSlot(slotNumber)
- continue
- skillType = skill.GetSkillType(skillIndex)
- if skill.SKILL_TYPE_GUILD == skillType:
- import guild
- skillGrade = 0
- skillLevel = guild.GetSkillLevel(Position)
- else:
- skillGrade = player.GetSkillGrade(Position)
- skillLevel = player.GetSkillLevel(Position)
- slot.SetSkillSlotNew(slotNumber, skillIndex, skillGrade, skillLevel)
- slot.SetSlotCountNew(slotNumber, skillGrade, skillLevel)
- slot.SetCoverButton(slotNumber)
- ## NOTE : CoolTime üũ
- if player.IsSkillCoolTime(Position):
- (coolTime, elapsedTime) = player.GetSkillCoolTime(Position)
- slot.SetSlotCoolTime(slotNumber, coolTime, elapsedTime)
- ## NOTE : Activate µÇ¾î ÀÖ´Ù¸é ¾ÆÀÌÄܵµ ¾÷µ¥ÀÌÆ®
- if player.IsSkillActive(Position):
- slot.ActivateSlot(slotNumber)
- elif player.SLOT_TYPE_EMOTION == Type:
- emotionIndex = Position
- slot.SetEmotionSlot(slotNumber, emotionIndex)
- slot.SetCoverButton(slotNumber)
- slot.SetSlotCount(slotNumber, 0)
- slot.RefreshSlot()
- startNumber += 4
- def canAddQuickSlot(self, Type, slotNumber):
- if player.SLOT_TYPE_INVENTORY == Type:
- itemIndex = player.GetItemIndex(slotNumber)
- return item.CanAddToQuickSlotItem(itemIndex)
- return True
- def AddQuickSlot(self, localSlotIndex):
- AttachedSlotType = mouseModule.mouseController.GetAttachedType()
- AttachedSlotNumber = mouseModule.mouseController.GetAttachedSlotNumber()
- AttachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
- if player.SLOT_TYPE_QUICK_SLOT == AttachedSlotType:
- player.RequestMoveGlobalQuickSlotToLocalQuickSlot(AttachedSlotNumber, localSlotIndex)
- elif player.SLOT_TYPE_EMOTION == AttachedSlotType:
- player.RequestAddLocalQuickSlot(localSlotIndex, AttachedSlotType, AttachedItemIndex)
- elif True == self.canAddQuickSlot(AttachedSlotType, AttachedSlotNumber):
- ## Online Code
- player.RequestAddLocalQuickSlot(localSlotIndex, AttachedSlotType, AttachedSlotNumber)
- mouseModule.mouseController.DeattachObject()
- self.RefreshQuickSlot()
- def SelectEmptyQuickSlot(self, slotIndex):
- if True == mouseModule.mouseController.isAttached():
- self.AddQuickSlot(slotIndex)
- def SelectItemQuickSlot(self, localQuickSlotIndex):
- if True == mouseModule.mouseController.isAttached():
- self.AddQuickSlot(localQuickSlotIndex)
- else:
- globalQuickSlotIndex=player.LocalQuickSlotIndexToGlobalQuickSlotIndex(localQuickSlotIndex)
- mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_QUICK_SLOT, globalQuickSlotIndex, globalQuickSlotIndex)
- def UnselectItemQuickSlot(self, localSlotIndex):
- if False == mouseModule.mouseController.isAttached():
- player.RequestUseLocalQuickSlot(localSlotIndex)
- return
- elif mouseModule.mouseController.isAttached():
- mouseModule.mouseController.DeattachObject()
- return
- def OnUseSkill(self, usedSlotIndex, coolTime):
- QUICK_SLOT_SLOT_COUNT = 4
- slotIndex = 0
- ## Current Skill Button
- if usedSlotIndex == self.curSkillButton.GetSlotIndex():
- self.curSkillButton.Activate(coolTime)
- ## Quick Slot
- for slotWindow in self.quickslot:
- for i in xrange(QUICK_SLOT_SLOT_COUNT):
- (Type, Position) = player.GetLocalQuickSlot(slotIndex)
- if Type == player.SLOT_TYPE_SKILL:
- if usedSlotIndex == Position:
- slotWindow.SetSlotCoolTime(slotIndex, coolTime)
- return
- slotIndex += 1
- def OnActivateSkill(self, usedSlotIndex):
- slotIndex = 0
- ## Current Skill Button
- if usedSlotIndex == self.curSkillButton.GetSlotIndex():
- self.curSkillButton.Deactivate()
- ## Quick Slot
- for slotWindow in self.quickslot:
- for i in xrange(4):
- (Type, Position) = player.GetLocalQuickSlot(slotIndex)
- if Type == player.SLOT_TYPE_SKILL:
- if usedSlotIndex == Position:
- slotWindow.ActivateSlot(slotIndex)
- return
- slotIndex += 1
- def OnDeactivateSkill(self, usedSlotIndex):
- slotIndex = 0
- ## Current Skill Button
- if usedSlotIndex == self.curSkillButton.GetSlotIndex():
- self.curSkillButton.Deactivate()
- ## Quick Slot
- for slotWindow in self.quickslot:
- for i in xrange(4):
- (Type, Position) = player.GetLocalQuickSlot(slotIndex)
- if Type == player.SLOT_TYPE_SKILL:
- if usedSlotIndex == Position:
- slotWindow.DeactivateSlot(slotIndex)
- return
- slotIndex += 1
- ## ToolTip
- def OverInItem(self, slotNumber):
- if mouseModule.mouseController.isAttached():
- return
- (Type, Position) = player.GetLocalQuickSlot(slotNumber)
- if player.SLOT_TYPE_INVENTORY == Type:
- self.tooltipItem.SetInventoryItem(Position)
- self.tooltipSkill.HideToolTip()
- elif player.SLOT_TYPE_SKILL == Type:
- skillIndex = player.GetSkillIndex(Position)
- skillType = skill.GetSkillType(skillIndex)
- if skill.SKILL_TYPE_GUILD == skillType:
- import guild
- skillGrade = 0
- skillLevel = guild.GetSkillLevel(Position)
- else:
- skillGrade = player.GetSkillGrade(Position)
- skillLevel = player.GetSkillLevel(Position)
- self.tooltipSkill.SetSkillNew(Position, skillIndex, skillGrade, skillLevel)
- self.tooltipItem.HideToolTip()
- def OverOutItem(self):
- if 0 != self.tooltipItem:
- self.tooltipItem.HideToolTip()
- if 0 != self.tooltipSkill:
- self.tooltipSkill.HideToolTip()
- def OnUpdate(self):
- if app.GetGlobalTime() - self.lastUpdateQuickSlot > 500:
- self.lastUpdateQuickSlot = app.GetGlobalTime()
- self.RefreshQuickSlot()
- self.Mouse_x , self.Mouse_y = wndMgr.GetMousePosition()
- self.SetVerticalBarHp()
- self.SetVerticalBarMp()
- self.SetVerticalBarHpRecovery()
- self.SetVerticalBarMpRecovery()
- self.SetExpirience()
- self.SetToolTipPoint()
- self.IsOnItemShopTag()
- self.SetEnergyToolTip()
- def UpdateLevelAndRace(self):
- race = net.GetMainActorRace()
- level = "Lv" + str(player.GetStatus(player.LEVEL))
- if level == self.level_string and race == self.race:
- print"Ritorno"
- return
- else:
- self.Race.SetText(self.array_race_name[race])
- self.Level.SetText(level)
- self.race = race
- self.level_string = level
- print"Nuovo livello rilevato!"
- for a in xrange(0,9):
- if race != a:
- self.RaceImage[a].Hide()
- else:
- self.RaceImage[a].Show()
- #exp refresh
- def SetCenterBubble(self):
- exp_x , exp_y = self.ExpBubbleFull.GetGlobalPosition()
- self.CenterBubble_x = exp_x + (self.ExpBubbleFull.GetWidth()/2)
- self.CenterBubble_y = exp_y + (self.ExpBubbleFull.GetHeight()/2)
- def SetExpirience(self):
- PointExp = max(0,unsigned32(player.GetStatus(player.EXP)))
- NextExp = max(0,unsigned32(player.GetStatus(player.NEXT_EXP)))
- self.ExpBubbleAnimation.SetPercentageVerticalTop(PointExp,NextExp)
- self.ExpBubbleFull.SetPercentageVerticalTop(PointExp,NextExp)
- if self.MouseIsInExpBubble():
- self.ExpToolTip.SetText("%s : %.2f%%" % (localeInfo.TASKBAR_EXP, float(PointExp) / max(1, float(NextExp)) * 100))
- self.ExpToolTip.Show()
- else:
- self.ExpToolTip.Hide()
- def MouseIsInExpBubble(self):
- #if mouse is out of the square circumscribed of the circle
- if self.Mouse_x < self.CenterBubble_x - (self.ExpBubbleFull.GetWidth()/2) or self.Mouse_x > self.CenterBubble_x + (self.ExpBubbleFull.GetWidth()/2):
- return False
- elif self.Mouse_y < self.CenterBubble_y - (self.ExpBubbleFull.GetHeight()/2) or self.Mouse_y > self.CenterBubble_y + (self.ExpBubbleFull.GetHeight()/2):
- return False
- #if mouse is out of the circle
- distance_of_center_x = max(self.CenterBubble_x - self.Mouse_x , self.Mouse_x - self.CenterBubble_x)
- distance_of_center_y = max(self.CenterBubble_y - self.Mouse_y , self.Mouse_y - self.CenterBubble_y)
- distance_of_center_absolute = math.sqrt((distance_of_center_y*distance_of_center_y)+(distance_of_center_x*distance_of_center_x))
- if distance_of_center_absolute > (self.ExpBubbleFull.GetWidth()/2) -4 : ##-4 because the image of bubble isn't Perfectly cropped
- return False
- #else
- return True
- ##end of exp refresh
- ###item scioppp
- def IsOnItemShopTag(self):
- b_is_in_rampage = self.IsInImageSquare(self.rampageGauge1)
- if b_is_in_rampage and not self.ItemShopIsAlreadyInside :
- if self.rampageGauge1.IsShow():
- self.rampageGauge1.Hide()
- self.rightTaskBar.GetChild("ItemShopButton").Show()
- self.rightTaskBar.GetChild("ItemShopButton").SetTop()
- else:
- self.rightTaskBar.GetChild("ItemShopButton").Hide()
- self.rampageGauge1.Show()
- self.ItemShopIsAlreadyInside = True
- print"ItemShopIsAlreadyInside Settato su True"
- else:
- if not b_is_in_rampage and self.ItemShopIsAlreadyInside:
- print"ItemShopIsAlreadyInside settato su false"
- self.ItemShopIsAlreadyInside = False
- self.rightTaskBar.GetChild("ItemShopButton").Hide()
- self.rampageGauge1.Show()
- ###HP and MP gauge refresh ---------------------------------------------------------------------
- def SetParameters(self):
- MpBase_x,MpBase_y = self.MpEmptyBar.GetGlobalPosition()
- HpBase_x,HpBase_y = self.HpEmptyBar.GetGlobalPosition()
- self.HpHeightCenter = self.HpCenter.GetHeight()
- self.MpHeightCenter = self.MpCenter.GetHeight()
- self.MpHeightHead = self.MpHead.GetHeight()
- self.HpHeightHead = self.HpHead.GetHeight()
- HpCenter_xpos,CenterHp_y = self.HpCenter.GetGlobalPosition()
- HpHead_xpos , HeadHp_y = self.HpHead.GetGlobalPosition()
- MpCenter_xpos,CenterMp_y = self.MpCenter.GetGlobalPosition()
- MpHead_xpos , HeadMp_y = self.MpHead.GetGlobalPosition()
- self.HpTotalHeight = self.HpHeightCenter + self.HpHeightHead
- self.MpTotalHeight = self.MpHeightCenter + self.MpHeightHead
- self.HpCenter_y = CenterHp_y - HpBase_y
- self.HpHead_y = HeadHp_y - HpBase_y
- self.MpCenter_y = CenterMp_y - MpBase_y
- self.MpHead_y = HeadMp_y - MpBase_y
- self.HpCenter_x = HpCenter_xpos - HpBase_x
- self.HpHead_x = HpHead_xpos-HpBase_x
- self.MpCenter_x = MpCenter_xpos - MpBase_x
- self.MpHead_x = MpHead_xpos - MpBase_x
- cord_x_energy , cord_y_energy = self.EnergyImage[0].GetGlobalPosition()
- cord_x_energy += 6 #this operation adjust the wrong position of bar in image
- cord_y_energy += 6 #idem for this operation
- self.RadiusEnergy = 81 ##This is the radius of the circle
- self.CenterOfEnergyCircle_x = cord_x_energy + self.RadiusEnergy
- self.CenterOfEnergyCircle_y = cord_y_energy + self.RadiusEnergy
- self.CircleThicknessEnergy = 19 ##the thickness of the circle in image
- def SetFullBar(self,bar):
- if bar == 1 :
- self.HpCenter.SetPosition(self.HpCenter_x,self.HpCenter_y)
- self.HpHead.SetPosition(self.HpHead_x,self.HpHead_y)
- self.HpCenter.SetRenderingRect(0.0,0.0,0.0,0.0)
- self.HpHead.SetRenderingRect(0.0,0.0,0.0,0.0)
- self.HpCenter.Show()
- self.HpHead.Show()
- self.HpStatus = 3
- elif bar == 2 :
- self.MpCenter.SetPosition(self.MpCenter_x,self.MpCenter_y)
- self.MpHead.SetPosition(self.MpHead_x,self.MpHead_y)
- self.MpCenter.SetRenderingRect(0.0,0.0,0.0,0.0)
- self.MpHead.SetRenderingRect(0.0,0.0,0.0,0.0)
- self.MpCenter.Show()
- self.MpHead.Show()
- self.MpStatus = 3
- elif bar == 3 :
- self.HpRecoveryCenter.SetPosition(self.HpCenter_x,self.HpCenter_y)
- self.HpRecoveryHead.SetPosition(self.HpHead_x,self.HpHead_y)
- self.HpRecoveryCenter.SetRenderingRect(0.0,0.0,0.0,0.0)
- self.HpRecoveryHead.SetRenderingRect(0.0,0.0,0.0,0.0)
- self.HpRecoveryCenter.Show()
- self.HpRecoveryHead.Show()
- self.HpRecoveryStatus = 3
- elif bar == 4 :
- self.MpRecoveryCenter.SetPosition(self.MpCenter_x,self.MpCenter_y)
- self.MpRecoveryHead.SetPosition(self.MpHead_x,self.MpHead_y)
- self.MpRecoveryCenter.SetRenderingRect(0.0,0.0,0.0,0.0)
- self.MpRecoveryHead.SetRenderingRect(0.0,0.0,0.0,0.0)
- self.MpRecoveryCenter.Show()
- self.MpRecoveryHead.Show()
- self.MpRecoveryStatus = 3
- def SetEmptyBar(self,bar):
- if bar == 1 :
- self.HpHead.Hide()
- self.HpCenter.Hide()
- self.HpStatus = 0
- elif bar == 2 :
- self.MpHead.Hide()
- self.MpCenter.Hide()
- self.MpStatus = 0
- elif bar == 3 :
- self.HpRecoveryHead.Hide()
- self.HpRecoveryCenter.Hide()
- self.HpRecoveryStatus = 0
- elif bar == 4 :
- self.MpRecoveryHead.Hide()
- self.MpRecoveryCenter.Hide()
- self.MpRecoveryStatus = 0
- def SetVerticalBarHp(self):
- self.hp_have = max(0,player.GetStatus(player.HP))
- self.hp_max = max(1,player.GetStatus(player.MAX_HP))
- if self.hp_have >= self.hp_max:
- if self.HpStatus == 3:
- return
- else:
- self.SetFullBar(1)
- return
- if self.hp_have <= 0 :
- if self.HpStatus == 0:
- return
- else:
- self.SetEmptyBar(1)
- return
- self.HpHead.Show()
- self.HpCenter.Show()
- percentageHP = float(self.hp_have)/float(self.hp_max) ##percentage of bar to show.
- percentageHpHead = (float(self.HpHeightHead)/float(self.HpTotalHeight))
- pixel = self.HpTotalHeight*(1.0-percentageHP)
- if percentageHP < percentageHpHead :
- self.HpHead.SetPercentageVerticalBottom(1 * percentageHP,1 * percentageHpHead)
- self.HpHead.SetPosition(self.HpHead_x , self.HpHead_y + pixel )
- self.HpCenter.Hide()
- else :
- self.HpHead.SetPosition(self.HpHead_x,self.HpHead_y + pixel)
- self.HpCenter.SetPosition(self.HpCenter_x , self.HpCenter_y+pixel)
- self.HpCenter.SetPercentageVerticalBottom(self.HpHeightCenter - pixel , self.HpHeightCenter)
- self.HpHead.SetPercentageVerticalBottom(10 , 10)
- self.HpStatus = 2
- def SetVerticalBarHpRecovery(self):
- self.hp_recovery = max(0, player.GetStatus(player.HP_RECOVERY))
- self.hp_recovery = min(self.hp_recovery + self.hp_have , self.hp_max)
- if self.hp_recovery >= self.hp_max:
- if self.HpRecoveryStatus == 3:
- return
- else:
- self.SetFullBar(3)
- return
- if self.hp_recovery <= 0 :
- if self.HpRecoveryStatus == 0:
- return
- else:
- self.SetEmptyBar(3)
- return
- self.HpRecoveryHead.Show()
- self.HpRecoveryCenter.Show()
- percentageHP = float(self.hp_recovery)/float(self.hp_max) ##percentage of bar to show.
- percentageHpHead = (float(self.HpHeightHead)/float(self.HpTotalHeight))
- pixel = self.HpTotalHeight*(1.0-percentageHP)
- if percentageHP < percentageHpHead :
- self.HpRecoveryHead.SetPercentageVerticalBottom(1 * percentageHP,1 * percentageHpHead)
- self.HpRecoveryHead.SetPosition(self.HpHead_x , self.HpHead_y + pixel )
- self.HpRecoveryCenter.Hide()
- else :
- self.HpRecoveryHead.SetPosition(self.HpHead_x,self.HpHead_y + pixel)
- self.HpRecoveryCenter.SetPosition(self.HpCenter_x , self.HpCenter_y+pixel)
- self.HpRecoveryCenter.SetPercentageVerticalBottom(self.HpHeightCenter - pixel , self.HpHeightCenter)
- self.HpRecoveryHead.SetPercentageVerticalBottom(10 , 10)
- self.HpRecoveryStatus = 2
- def SetVerticalBarMp(self):
- self.mp_have = max(0,player.GetStatus(player.SP))
- self.mp_max = max(1,player.GetStatus(player.MAX_SP))
- if self.mp_have >= self.mp_max:
- if self.MpStatus == 3:
- return
- else:
- self.SetFullBar(2)
- return
- if self.mp_have <= 0 :
- if self.MpStatus == 0:
- return
- else:
- self.SetEmptyBar(2)
- return
- self.MpHead.Show()
- self.MpCenter.Show()
- percentageMP = float(self.mp_have)/float(self.mp_max) ##percentage of bar to show.
- percentageMpHead = (float(self.MpHeightHead)/float(self.MpTotalHeight))
- pixel = self.MpTotalHeight*(1.0-percentageMP)
- if percentageMP < percentageMpHead :
- self.MpHead.SetPercentageVerticalBottom(1 * percentageMP,1 * percentageMpHead)
- self.MpHead.SetPosition(self.MpHead_x , self.MpHead_y + pixel )
- self.MpCenter.Hide()
- else :
- self.MpHead.SetPercentageVerticalBottom(10 , 10)
- self.MpHead.SetPosition(self.MpHead_x,self.MpHead_y + pixel)
- self.MpCenter.SetPosition(self.MpCenter_x , self.MpCenter_y+pixel)
- self.MpCenter.SetPercentageVerticalBottom(self.MpHeightCenter - pixel , self.MpHeightCenter)
- self.MpHead.SetPercentageVerticalBottom(10 , 10)
- self.MpStatus = 2
- def SetVerticalBarMpRecovery(self):
- self.mp_recovery = max(0,player.GetStatus(player.SP_RECOVERY))
- self.mp_recovery = min(self.mp_recovery + self.mp_have , self.mp_max)
- if self.mp_recovery >= self.mp_max:
- if self.MpRecoveryStatus == 3:
- return
- else:
- self.SetFullBar(4)
- return
- if self.mp_recovery <= 0 :
- if self.MpRecoveryStatus == 0:
- return
- else:
- self.SetEmptyBar(4)
- return
- self.MpRecoveryHead.Show()
- self.MpRecoveryCenter.Show()
- percentageMP = float(self.mp_recovery)/float(self.mp_max) ##percentage of bar to show.
- percentageMpHead = (float(self.MpHeightHead)/float(self.MpTotalHeight))
- pixel = self.MpTotalHeight*(1.0-percentageMP)
- if percentageMP < percentageMpHead :
- self.MpRecoveryHead.SetPercentageVerticalBottom(1 * percentageMP,1 * percentageMpHead)
- self.MpRecoveryHead.SetPosition(self.MpHead_x , self.MpHead_y + pixel )
- self.MpRecoveryCenter.Hide()
- else :
- self.MpRecoveryHead.SetPercentageVerticalBottom(10 , 10)
- self.MpRecoveryHead.SetPosition(self.MpHead_x,self.MpHead_y + pixel)
- self.MpRecoveryCenter.SetPosition(self.MpCenter_x , self.MpCenter_y+pixel)
- self.MpRecoveryCenter.SetPercentageVerticalBottom(self.MpHeightCenter - pixel , self.MpHeightCenter)
- self.MpRecoveryHead.SetPercentageVerticalBottom(10 , 10)
- self.MpRecoveryStatus = 2
- def IsInImageSquare(self,image):
- pos_x,pos_y = image.GetGlobalPosition()
- if image == self.rampageGauge1:
- pos_x += 2
- pos_y += 2
- if self.Mouse_x < pos_x or self.Mouse_y < pos_y:
- return False
- widthImage = image.GetWidth()
- heightImage = image.GetHeight()
- if self.Mouse_x > pos_x+widthImage or self.Mouse_y > pos_y + heightImage:
- return False
- return True
- def SetToolTipPoint(self):
- if True == self.IsInImageSquare(self.HpEmptyBar):
- self.HPToolTip.SetText(" %s : %d / %d" % (localeInfo.TASKBAR_HP, self.hp_have, self.hp_max))
- self.HPToolTip.Show()
- else:
- self.HPToolTip.Hide()
- if True == self.IsInImageSquare(self.MpEmptyBar):
- self.MPToolTip.SetText(" %s : %d / %d" % (localeInfo.TASKBAR_SP, self.mp_have, self.mp_max))
- self.MPToolTip.Show()
- else:
- self.MPToolTip.Hide()
- ####end of hp and mp gauge -------------------------------------------------------
- ###tooltip ENERGY
- def IsInEnergyGauge(self):
- if self.EnergyImage[self.EnergyActualImage].IsIn() or self.rightTaskBar.GetChild("EnergyBarEmpty").IsIn():
- x_cord = self.Mouse_x
- y_cord = self.Mouse_y
- distance_x = max(x_cord - self.CenterOfEnergyCircle_x , self.CenterOfEnergyCircle_x - x_cord)
- distance_y = max(y_cord - self.CenterOfEnergyCircle_y , self.CenterOfEnergyCircle_y - y_cord)
- distance_absolute_energy = math.sqrt((distance_x * distance_x) + (distance_y * distance_y))
- if distance_absolute_energy < self.RadiusEnergy - self.CircleThicknessEnergy or distance_absolute_energy > self.RadiusEnergy:
- return False
- else:
- return True
- else:
- return False
- def SetEnergyToolTip(self):
- if self.IsInEnergyGauge():
- self.EnergyToolTip.Show()
- else:
- self.EnergyToolTip.Hide()
- #end tooltip energy
- ####energy refresh
- def RefreshEnergy(self):
- leftTimeEnergy = max(0,player.GetStatus(player.ENERGY_END_TIME) - app.GetGlobalTimeStamp())
- if leftTimeEnergy == 0 and self.EnergyStatus == 0:
- return
- elif leftTimeEnergy == 0 and self.EnergyStatus != 0:
- if self.EnergyActualImage != 0:
- self.EnergyImage[self.EnergyActualImage].Hide()
- pointEnergy = max(0,player.GetStatus(player.ENERGY))
- self.EnergyToolTip.SetText(localeInfo.SecondToHM(leftTimeEnergy) + " - Energia +" + str(pointEnergy) + "%")
- self.EnergyStatus = 0
- else:
- totalTimeEnergy = 7200 ###Usually this value is 7200, if your game is different, change it
- timeToImage = max(1,int(float(leftTimeEnergy)/float(totalTimeEnergy) * 17.0))
- if timeToImage != self.EnergyActualImage:
- if self.EnergyStatus == 0:
- self.EnergyImage[timeToImage-1].Show()
- self.EnergyActualImage = timeToImage-1
- pointEnergy = max(0,player.GetStatus(player.ENERGY))
- self.EnergyToolTip.SetText(localeInfo.SecondToHM(leftTimeEnergy) + " - Energia +" + str(pointEnergy) + "%")
- self.EnergyStatus = 1
- else:
- self.EnergyImage[self.EnergyActualImage].Hide()
- self.EnergyImage[timeToImage-1].Show()
- self.EnergyActualImage = timeToImage-1
- pointEnergy = max(0,player.GetStatus(player.ENERGY))
- self.EnergyToolTip.SetText(localeInfo.SecondToHM(leftTimeEnergy) + " - Energia +" + str(pointEnergy) + "%")
- self.EnergyStatus = 1
- ## Skill
- def ToggleLeftMouseButtonModeWindow(self):
- wndMouseButtonMode = self.mouseModeButtonList[self.MOUSE_BUTTON_LEFT]
- if TRUE == wndMouseButtonMode.IsShow():
- wndMouseButtonMode.Hide()
- else:
- wndMouseButtonMode.Show()
- self.GetChild("RightMouseButton").Hide()
- def ToggleRightMouseButtonModeWindow(self):
- wndMouseButtonMode = self.mouseModeButtonList[self.MOUSE_BUTTON_RIGHT]
- if True == wndMouseButtonMode.IsShow():
- wndMouseButtonMode.Hide()
- self.CloseSelectSkill()
- else:
- wndMouseButtonMode.Show()
- self.OpenSelectSkill()
- def OpenSelectSkill(self):
- PAGE_SLOT_COUNT = 6
- (xSkillButton, y) = self.curSkillButton.GetGlobalPosition()
- y -= (37 + 32 + 1)
- for key in self.skillCategoryNameList:
- appendCount = 0
- startNumber = self.skillPageStartSlotIndexDict[key]
- x = xSkillButton
- getSkillIndex=player.GetSkillIndex
- getSkillLevel=player.GetSkillLevel
- for i in xrange(PAGE_SLOT_COUNT):
- skillIndex = getSkillIndex(startNumber+i)
- skillLevel = getSkillLevel(startNumber+i)
- if 0 == skillIndex:
- continue
- if 0 == skillLevel:
- continue
- if skill.IsStandingSkill(skillIndex):
- continue
- ## FIXME : ½ºÅ³ Çϳª´ç ½½·Ô Çϳª¾¿ ÇÒ´çÇÏ´Â°Ç ¾Æ¹«¸® ºÁµµ ºÎÇÏ°¡ Å©´Ù.
- ## ÀÌ ºÎºÐÀº ½Ã°£À» ³ª¸é °íÄ¡µµ·Ï. - [levites]
- skillButton = self.SkillButton()
- skillButton.SetSkill(startNumber+i)
- skillButton.SetPosition(x, y)
- skillButton.SetSkillEvent(ui.__mem_func__(self.CloseSelectSkill), startNumber+i+1)
- skillButton.SetSkillToolTip(self.tooltipSkill)
- skillButton.SetTop()
- skillButton.Show()
- self.selectSkillButtonList.append(skillButton)
- appendCount += 1
- x -= 32
- if appendCount > 0:
- y -= 32
- def CloseSelectSkill(self, slotIndex=-1):
- self.mouseModeButtonList[self.MOUSE_BUTTON_RIGHT].Hide()
- for button in self.selectSkillButtonList:
- button.Destroy()
- self.selectSkillButtonList = []
- if -1 != slotIndex:
- self.curSkillButton.Show()
- self.curMouseModeButton[self.MOUSE_BUTTON_RIGHT].Hide()
- player.SetMouseFunc(player.MBT_RIGHT, player.MBF_SKILL)
- player.ChangeCurrentSkillNumberOnly(slotIndex-1)
- else:
- self.curSkillButton.Hide()
- self.curMouseModeButton[self.MOUSE_BUTTON_RIGHT].Show()
- def SelectMouseButtonEvent(self, dir, event):
- SetMouseButtonSetting(dir, event)
- self.CloseSelectSkill()
- self.mouseModeButtonList[dir].Hide()
- btn = 0
- type = self.NONE
- func = self.NONE
- tooltip_text = ""
- if self.MOUSE_BUTTON_LEFT == dir:
- type = player.MBT_LEFT
- elif self.MOUSE_BUTTON_RIGHT == dir:
- type = player.MBT_RIGHT
- if self.EVENT_MOVE == event:
- btn = self.mouseModeButtonList[dir].GetChild("button_move")
- func = player.MBF_MOVE
- tooltip_text = localeInfo.TASKBAR_MOVE
- elif self.EVENT_ATTACK == event:
- btn = self.mouseModeButtonList[dir].GetChild("button_attack")
- func = player.MBF_ATTACK
- tooltip_text = localeInfo.TASKBAR_ATTACK
- elif self.EVENT_AUTO == event:
- btn = self.mouseModeButtonList[dir].GetChild("button_auto_attack")
- func = player.MBF_AUTO
- tooltip_text = localeInfo.TASKBAR_AUTO
- elif self.EVENT_MOVE_AND_ATTACK == event:
- btn = self.mouseModeButtonList[dir].GetChild("button_move_and_attack")
- func = player.MBF_SMART
- tooltip_text = localeInfo.TASKBAR_ATTACK
- elif self.EVENT_CAMERA == event:
- btn = self.mouseModeButtonList[dir].GetChild("button_camera")
- func = player.MBF_CAMERA
- tooltip_text = localeInfo.TASKBAR_CAMERA
- elif self.EVENT_SKILL == event:
- btn = self.mouseModeButtonList[dir].GetChild("button_skill")
- func = player.MBF_SKILL
- tooltip_text = localeInfo.TASKBAR_SKILL
- if 0 != btn:
- self.curMouseModeButton[dir].SetToolTipText(tooltip_text, 0, -18)
- self.curMouseModeButton[dir].SetUpVisual(btn.GetUpVisualFileName())
- self.curMouseModeButton[dir].SetOverVisual(btn.GetOverVisualFileName())
- self.curMouseModeButton[dir].SetDownVisual(btn.GetDownVisualFileName())
- self.curMouseModeButton[dir].Show()
- player.SetMouseFunc(type, func)
- self.GetChild("RightMouseButton").Hide()#to do not show rightmousebutton
- def OnChangeCurrentSkill(self, skillSlotNumber):
- self.curSkillButton.SetSkill(skillSlotNumber)
- self.curSkillButton.Show()
- self.curMouseModeButton[self.MOUSE_BUTTON_RIGHT].Hide()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement