loongTyler

uitaskbar Client

Oct 24th, 2024
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import ui
  2. import net
  3. import item
  4. import skill
  5. import localeInfo
  6. import wndMgr
  7. import player
  8. import constInfo
  9. import mouseModule
  10. import uiScriptLocale
  11. import app
  12.  
  13. MOUSE_SETTINGS = [0, 0]
  14.  
  15. def InitMouseButtonSettings(left, right):
  16.     global MOUSE_SETTINGS
  17.     MOUSE_SETTINGS = [left, right]
  18.  
  19. def SetMouseButtonSetting(dir, event):
  20.     global MOUSE_SETTINGS
  21.     MOUSE_SETTINGS[dir] = event
  22.  
  23. def GetMouseButtonSettings():
  24.     global MOUSE_SETTINGS
  25.     return MOUSE_SETTINGS
  26.  
  27. def SaveMouseButtonSettings():
  28.     global MOUSE_SETTINGS
  29.     old_open("mouse.cfg", "w").write("%s\t%s" % tuple(MOUSE_SETTINGS))
  30.  
  31. def LoadMouseButtonSettings():
  32.     global MOUSE_SETTINGS
  33.     tokens = old_open("mouse.cfg", "r").read().split()
  34.  
  35.     if len(tokens) != 2:
  36.         raise RuntimeError, "MOUSE_SETTINGS_FILE_ERROR"
  37.  
  38.     MOUSE_SETTINGS[0] = int(tokens[0])
  39.     MOUSE_SETTINGS[1] = int(tokens[1])
  40.  
  41. def unsigned32(n):
  42.     return n & 0xFFFFFFFFL
  43.  
  44. #-------------------Giftbox Begin------------------------------
  45.  
  46. class GiftBox(ui.ScriptWindow):
  47.     class TextToolTip(ui.Window):
  48.         def __init__(self):
  49.             ui.Window.__init__(self, "TOP_MOST")
  50.             self.SetWindowName("GiftBox")
  51.             textLine = ui.TextLine()
  52.             textLine.SetParent(self)
  53.             textLine.SetHorizontalAlignCenter()
  54.             textLine.SetOutline()
  55.             textLine.Show()
  56.             self.textLine = textLine
  57.  
  58.         def __del__(self):
  59.             ui.Window.__del__(self)
  60.  
  61.         def SetText(self, text):
  62.             self.textLine.SetText(text)
  63.  
  64.         def OnRender(self):
  65.             (mouseX, mouseY) = wndMgr.GetMousePosition()
  66.             self.textLine.SetPosition(mouseX, mouseY - 15)
  67.  
  68.     def __init__(self):
  69.         #print "NEW TASKBAR  ----------------------------------------------------------------------------"
  70.         ui.ScriptWindow.__init__(self)
  71.         self.tooltipGift = self.TextToolTip()
  72.         self.tooltipGift.Show()
  73.  
  74.     def __del__(self):
  75.         #print "---------------------------------------------------------------------------- DELETE TASKBAR"
  76.         ui.ScriptWindow.__del__(self)
  77.  
  78.     def LoadWindow(self):
  79.         try:
  80.             pyScrLoader = ui.PythonScriptLoader()
  81.             pyScrLoader.LoadScriptFile(self, uiScriptLocale.LOCALE_UISCRIPT_PATH + "giftbox.py")
  82.         except:
  83.             import exception
  84.             exception.Abort("GiftBox.LoadWindow.LoadObject")
  85.  
  86.         self.giftBoxIcon = self.GetChild("GiftBox_Icon")
  87.         self.giftBoxToolTip = self.GetChild("GiftBox_ToolTip")
  88.  
  89.     def Destroy(self):
  90.         self.giftBoxIcon = 0
  91.         self.giftBoxToolTip = 0
  92.  
  93. #-------------------Giftbox End------------------------------
  94.  
  95. class EnergyBar(ui.ScriptWindow):
  96.     class TextToolTip(ui.Window):
  97.         def __init__(self):
  98.             ui.Window.__init__(self, "TOP_MOST")
  99.             self.SetWindowName("EnergyBar")
  100.             textLine = ui.TextLine()
  101.             textLine.SetParent(self)
  102.             textLine.SetHorizontalAlignCenter()
  103.             textLine.SetOutline()
  104.             textLine.Show()
  105.             self.textLine = textLine
  106.  
  107.         def __del__(self):
  108.             ui.Window.__del__(self)
  109.  
  110.         def SetText(self, text):
  111.             self.textLine.SetText(text)
  112.  
  113.         def OnRender(self):
  114.             (mouseX, mouseY) = wndMgr.GetMousePosition()
  115.             self.textLine.SetPosition(mouseX, mouseY - 15)
  116.  
  117.     def __init__(self):
  118.         #print "NEW TASKBAR  ----------------------------------------------------------------------------"
  119.         ui.ScriptWindow.__init__(self)
  120.         self.tooltipEnergy = self.TextToolTip()
  121.         self.tooltipEnergy.Show()
  122.  
  123.     def __del__(self):
  124.         #print "---------------------------------------------------------------------------- DELETE TASKBAR"
  125.         ui.ScriptWindow.__del__(self)
  126.  
  127.     def LoadWindow(self):
  128.         try:
  129.             pyScrLoader = ui.PythonScriptLoader()
  130.             pyScrLoader.LoadScriptFile(self, uiScriptLocale.LOCALE_UISCRIPT_PATH + "EnergyBar.py")
  131.         except:
  132.             import exception
  133.             exception.Abort("EnergyBar.LoadWindow.LoadObject")
  134.  
  135.         self.energyEmpty = self.GetChild("EnergyGauge_Empty")
  136.         self.energyHungry = self.GetChild("EnergyGauge_Hungry")
  137.         self.energyFull = self.GetChild("EnergyGauge_Full")
  138.  
  139.         self.energyGaugeBoard = self.GetChild("EnergyGauge_Board")
  140.         self.energyGaugeToolTip = self.GetChild("EnergyGauge_ToolTip")
  141.  
  142.  
  143.     def Destroy(self):
  144.         self.energyEmpty = None
  145.         self.energyHungry = None
  146.         self.energyFull = None
  147.         self.energyGaugeBoard = 0
  148.         self.energyGaugeToolTip = 0
  149.         self.tooltipEnergy = 0
  150.  
  151.     ## Gauge
  152.     def RefreshStatus(self):
  153.         pointEnergy = player.GetStatus (player.ENERGY)
  154.         leftTimeEnergy = player.GetStatus (player.ENERGY_END_TIME) - app.GetGlobalTimeStamp()
  155.         self.SetEnergy (pointEnergy, leftTimeEnergy, 7200)
  156.  
  157.     def SetEnergy (self, point, leftTime, maxTime):
  158.         leftTime = max (leftTime, 0)
  159.         maxTime = max (maxTime, 0)
  160.  
  161.         self.energyEmpty.Hide()
  162.         self.energyHungry.Hide()
  163.         self.energyFull.Hide()
  164.  
  165.         if leftTime == 0:
  166.             self.energyEmpty.Show()
  167.         elif ((leftTime * 100) / maxTime) < 15:
  168.             self.energyHungry.Show()
  169.         else:
  170.             self.energyFull.Show()
  171.  
  172.         self.tooltipEnergy.SetText("%s" % (localeInfo.TOOLTIP_ENERGY(point)))
  173.  
  174.     def OnUpdate(self):
  175.         if True == self.energyGaugeToolTip.IsIn():
  176.             self.RefreshStatus()
  177.             self.tooltipEnergy.Show()
  178.         else:
  179.             self.tooltipEnergy.Hide()
  180.  
  181. class ExpandedTaskBar(ui.ScriptWindow):
  182.     BUTTON_DRAGON_SOUL = 0
  183.     def __init__(self):
  184.         ui.Window.__init__(self)
  185.         self.SetWindowName("ExpandedTaskBar")
  186.  
  187.     def LoadWindow(self):
  188.         try:
  189.             pyScrLoader = ui.PythonScriptLoader()
  190.             pyScrLoader.LoadScriptFile(self, uiScriptLocale.LOCALE_UISCRIPT_PATH + "ExpandedTaskBar.py")
  191.         except:
  192.             import exception
  193.             exception.Abort("ExpandedTaskBar.LoadWindow.LoadObject")
  194.  
  195.         self.expandedTaskBarBoard = self.GetChild("ExpanedTaskBar_Board")
  196.  
  197.         self.toggleButtonDict = {}
  198.         self.toggleButtonDict[ExpandedTaskBar.BUTTON_DRAGON_SOUL] = self.GetChild("DragonSoulButton")
  199.         self.toggleButtonDict[ExpandedTaskBar.BUTTON_DRAGON_SOUL].SetParent(self)
  200.  
  201.     def SetTop(self):
  202.         super(ExpandedTaskBar, self).SetTop()
  203.         for button in self.toggleButtonDict.values():
  204.             button.SetTop()
  205.  
  206.     def Show(self):
  207.         ui.ScriptWindow.Show(self)
  208.  
  209.     def Close(self):
  210.         self.Hide()
  211.  
  212.     def SetToolTipText(self, eButton, text):
  213.         self.toggleButtonDict[eButton].SetToolTipText(text)
  214.  
  215.     def SetToggleButtonEvent(self, eButton, kEventFunc):
  216.         self.toggleButtonDict[eButton].SetEvent(kEventFunc)
  217.  
  218.     def OnPressEscapeKey(self):
  219.         self.Close()
  220.         return True
  221.  
  222. class TaskBar(ui.ScriptWindow):
  223.  
  224.     BUTTON_CHARACTER = 0
  225.     BUTTON_INVENTORY = 1
  226.     BUTTON_MESSENGER = 2
  227.     BUTTON_SYSTEM = 3
  228.     BUTTON_CHAT = 4
  229.     BUTTON_EXPAND = 4
  230.     IS_EXPANDED = False
  231.  
  232.     MOUSE_BUTTON_LEFT = 0
  233.     MOUSE_BUTTON_RIGHT = 1
  234.     NONE = 255
  235.  
  236.     EVENT_MOVE = 0
  237.     EVENT_ATTACK = 1
  238.     EVENT_MOVE_AND_ATTACK = 2
  239.     EVENT_CAMERA = 3
  240.     EVENT_SKILL = 4
  241.     EVENT_AUTO = 5
  242.  
  243.     GAUGE_WIDTH = 95
  244.     GAUGE_HEIGHT = 13
  245.  
  246.     QUICKPAGE_NUMBER_FILENAME = [
  247.         "d:/ymir work/ui/game/taskbar/1.sub",
  248.         "d:/ymir work/ui/game/taskbar/2.sub",
  249.         "d:/ymir work/ui/game/taskbar/3.sub",
  250.         "d:/ymir work/ui/game/taskbar/4.sub",
  251.     ]
  252.  
  253.     #gift icon show and hide
  254.     def ShowGift(self):
  255.         self.wndGiftBox.Show()
  256.  
  257.     def HideGift(self):
  258.         self.wndGiftBox.Hide()
  259.  
  260.     class TextToolTip(ui.Window):
  261.         def __init__(self):
  262.             ui.Window.__init__(self, "TOP_MOST")
  263.  
  264.             textLine = ui.TextLine()
  265.             textLine.SetParent(self)
  266.             textLine.SetHorizontalAlignCenter()
  267.             textLine.SetOutline()
  268.             textLine.Show()
  269.             self.textLine = textLine
  270.  
  271.         def __del__(self):
  272.             ui.Window.__del__(self)
  273.  
  274.         def SetText(self, text):
  275.             self.textLine.SetText(text)
  276.  
  277.         def OnRender(self):
  278.             (mouseX, mouseY) = wndMgr.GetMousePosition()
  279.             self.textLine.SetPosition(mouseX, mouseY - 15)
  280.  
  281.     class SkillButton(ui.SlotWindow):
  282.  
  283.         def __init__(self):
  284.             ui.SlotWindow.__init__(self)
  285.  
  286.             self.event = 0
  287.             self.arg = 0
  288.  
  289.             self.slotIndex = 0
  290.             self.skillIndex = 0
  291.  
  292.             slotIndex = 0
  293.             wndMgr.SetSlotBaseImage(self.hWnd, "d:/ymir work/ui/public/slot_base.sub", 1.0, 1.0, 1.0, 1.0)
  294.             wndMgr.AppendSlot(self.hWnd, slotIndex, 0, 0, 32, 32)
  295.             self.SetCoverButton(slotIndex,  "d:/ymir work/ui/public/slot_cover_button_01.sub",\
  296.                                             "d:/ymir work/ui/public/slot_cover_button_02.sub",\
  297.                                             "d:/ymir work/ui/public/slot_cover_button_03.sub",\
  298.                                             "d:/ymir work/ui/public/slot_cover_button_04.sub", True, False)
  299.             self.SetSize(32, 32)
  300.  
  301.         def __del__(self):
  302.             ui.SlotWindow.__del__(self)
  303.  
  304.         def Destroy(self):
  305.             if 0 != self.tooltipSkill:
  306.                 self.tooltipSkill.HideToolTip()
  307.  
  308.         def RefreshSkill(self):
  309.             if 0 != self.slotIndex:
  310.                 self.SetSkill(self.slotIndex)
  311.  
  312.         def SetSkillToolTip(self, tooltip):
  313.             self.tooltipSkill = tooltip
  314.  
  315.         def SetSkill(self, skillSlotNumber):
  316.             slotNumber = 0
  317.             skillIndex = player.GetSkillIndex(skillSlotNumber)
  318.             skillGrade = player.GetSkillGrade(skillSlotNumber)
  319.             skillLevel = player.GetSkillLevel(skillSlotNumber)
  320.             skillType = skill.GetSkillType(skillIndex)
  321.  
  322.             self.skillIndex = skillIndex
  323.             if 0 == self.skillIndex:
  324.                 self.ClearSlot(slotNumber)
  325.                 return
  326.  
  327.             self.slotIndex = skillSlotNumber
  328.  
  329.             self.SetSkillSlotNew(slotNumber, skillIndex, skillGrade, skillLevel)
  330.             self.SetSlotCountNew(slotNumber, skillGrade, skillLevel)
  331.  
  332.             if player.IsSkillCoolTime(skillSlotNumber):
  333.                 (coolTime, elapsedTime) = player.GetSkillCoolTime(skillSlotNumber)
  334.                 self.SetSlotCoolTime(slotNumber, coolTime, elapsedTime)
  335.  
  336.             if player.IsSkillActive(skillSlotNumber):
  337.                 self.ActivateSlot(slotNumber)
  338.  
  339.         def SetSkillEvent(self, event, arg=0):
  340.             self.event = event
  341.             self.arg = arg
  342.  
  343.         def GetSkillIndex(self):
  344.             return self.skillIndex
  345.  
  346.         def GetSlotIndex(self):
  347.             return self.slotIndex
  348.  
  349.         def Activate(self, coolTime):
  350.             self.SetSlotCoolTime(0, coolTime)
  351.  
  352.             if skill.IsToggleSkill(self.skillIndex):
  353.                 self.ActivateSlot(0)
  354.  
  355.         def Deactivate(self):
  356.             if skill.IsToggleSkill(self.skillIndex):
  357.                 self.DeactivateSlot(0)
  358.  
  359.         def OnOverInItem(self, dummy):
  360.             self.tooltipSkill.SetSkill(self.skillIndex)
  361.  
  362.         def OnOverOutItem(self):
  363.             self.tooltipSkill.HideToolTip()
  364.  
  365.         def OnSelectItemSlot(self, dummy):
  366.             if 0 != self.event:
  367.                 if 0 != self.arg:
  368.                     self.event(self.arg)
  369.                 else:
  370.                     self.event()
  371.  
  372.     def __init__(self):
  373.         #print "NEW TASKBAR  ----------------------------------------------------------------------------"
  374.  
  375.         ui.ScriptWindow.__init__(self, "TOP_MOST")
  376.  
  377.         self.quickPageNumImageBox = None
  378.         self.tooltipItem = 0
  379.         self.tooltipSkill = 0
  380.         self.mouseModeButtonList = [ ui.ScriptWindow("TOP_MOST"), ui.ScriptWindow("TOP_MOST") ]
  381.  
  382.         self.tooltipHP = self.TextToolTip()
  383.         self.tooltipHP.Show()
  384.         self.tooltipSP = self.TextToolTip()
  385.         self.tooltipSP.Show()
  386.         self.tooltipST = self.TextToolTip()
  387.         self.tooltipST.Show()
  388.         self.tooltipEXP = self.TextToolTip()
  389.         self.tooltipEXP.Show()
  390.  
  391.         self.skillCategoryNameList = [ "ACTIVE_1", "ACTIVE_2", "ACTIVE_3" ]
  392.         self.skillPageStartSlotIndexDict = {
  393.             "ACTIVE_1" : 1,
  394.             "ACTIVE_2" : 21,
  395.             "ACTIVE_3" : 41,
  396.         }
  397.  
  398.         self.selectSkillButtonList = []
  399.  
  400.         self.lastUpdateQuickSlot = 0
  401.         self.SetWindowName("TaskBar")
  402.  
  403.     def __del__(self):
  404.         #print "---------------------------------------------------------------------------- DELETE TASKBAR"
  405.         ui.ScriptWindow.__del__(self)
  406.  
  407.     def LoadWindow(self):
  408.         try:
  409.             pyScrLoader = ui.PythonScriptLoader()
  410.  
  411.             if constInfo.IN_GAME_SHOP_ENABLE:
  412.                 pyScrLoader.LoadScriptFile(self, uiScriptLocale.LOCALE_UISCRIPT_PATH + "TaskBar.py")
  413.             else:
  414.                 pyScrLoader.LoadScriptFile(self, "UIScript/TaskBar.py")
  415.             pyScrLoader.LoadScriptFile(self.mouseModeButtonList[self.MOUSE_BUTTON_LEFT], "UIScript/MouseButtonWindow.py")
  416.             pyScrLoader.LoadScriptFile(self.mouseModeButtonList[self.MOUSE_BUTTON_RIGHT], "UIScript/RightMouseButtonWindow.py")
  417.         except:
  418.             import exception
  419.             exception.Abort("TaskBar.LoadWindow.LoadObject")
  420.  
  421.         self.quickslot = []
  422.         self.quickslot.append(self.GetChild("quick_slot_1"))
  423.         self.quickslot.append(self.GetChild("quick_slot_2"))
  424.         for slot in self.quickslot:
  425.             slot.SetSlotStyle(wndMgr.SLOT_STYLE_NONE)
  426.             slot.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptyQuickSlot))
  427.             slot.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemQuickSlot))
  428.             slot.SetUnselectItemSlotEvent(ui.__mem_func__(self.UnselectItemQuickSlot))
  429.             slot.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  430.             slot.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  431.  
  432.         toggleButtonDict = {}
  433.         toggleButtonDict[TaskBar.BUTTON_CHARACTER]=self.GetChild("CharacterButton")
  434.         toggleButtonDict[TaskBar.BUTTON_INVENTORY]=self.GetChild("InventoryButton")
  435.         toggleButtonDict[TaskBar.BUTTON_MESSENGER]=self.GetChild("MessengerButton")
  436.         toggleButtonDict[TaskBar.BUTTON_SYSTEM]=self.GetChild("SystemButton")
  437.  
  438.         try:
  439.             toggleButtonDict[TaskBar.BUTTON_CHAT]=self.GetChild("ChatButton")
  440.         except:
  441.             toggleButtonDict[TaskBar.BUTTON_EXPAND]=self.GetChild("ExpandButton")
  442.             TaskBar.IS_EXPANDED = True
  443.  
  444.  
  445.         if localeInfo.IsARABIC():
  446.             systemButton = toggleButtonDict[TaskBar.BUTTON_SYSTEM]
  447.             if systemButton.ToolTipText:
  448.                 tx, ty = systemButton.ToolTipText.GetLocalPosition()
  449.                 tw = systemButton.ToolTipText.GetWidth()
  450.                 systemButton.ToolTipText.SetPosition(-tw/2, ty)
  451.  
  452.  
  453.         expGauge = []
  454.         expGauge.append(self.GetChild("EXPGauge_01"))
  455.         expGauge.append(self.GetChild("EXPGauge_02"))
  456.         expGauge.append(self.GetChild("EXPGauge_03"))
  457.         expGauge.append(self.GetChild("EXPGauge_04"))
  458.  
  459.         for exp in expGauge:
  460.             exp.SetSize(0, 0)
  461.  
  462.  
  463.         self.quickPageNumImageBox=self.GetChild("QuickPageNumber")
  464.  
  465.         self.GetChild("QuickPageUpButton").SetEvent(ui.__mem_func__(self.__OnClickQuickPageUpButton))
  466.         self.GetChild("QuickPageDownButton").SetEvent(ui.__mem_func__(self.__OnClickQuickPageDownButton))
  467.  
  468.         mouseLeftButtonModeButton = self.GetChild("LeftMouseButton")
  469.         mouseRightButtonModeButton = self.GetChild("RightMouseButton")
  470.         mouseLeftButtonModeButton.SetEvent(ui.__mem_func__(self.ToggleLeftMouseButtonModeWindow))
  471.         mouseRightButtonModeButton.SetEvent(ui.__mem_func__(self.ToggleRightMouseButtonModeWindow))
  472.         self.curMouseModeButton = [ mouseLeftButtonModeButton, mouseRightButtonModeButton ]
  473.  
  474.         (xLocalRight, yLocalRight) = mouseRightButtonModeButton.GetLocalPosition()
  475.         self.curSkillButton = self.SkillButton()
  476.         self.curSkillButton.SetParent(self)
  477.         self.curSkillButton.SetPosition(xLocalRight, 3)
  478.         self.curSkillButton.SetSkillEvent(ui.__mem_func__(self.ToggleRightMouseButtonModeWindow))
  479.         self.curSkillButton.Hide()
  480.  
  481.         (xLeft, yLeft) = mouseLeftButtonModeButton.GetGlobalPosition()
  482.         (xRight, yRight) = mouseRightButtonModeButton.GetGlobalPosition()
  483.         leftModeButtonList = self.mouseModeButtonList[self.MOUSE_BUTTON_LEFT]
  484.         leftModeButtonList.SetPosition(xLeft, yLeft - leftModeButtonList.GetHeight()-5)
  485.         rightModeButtonList = self.mouseModeButtonList[self.MOUSE_BUTTON_RIGHT]
  486.         rightModeButtonList.SetPosition(xRight - rightModeButtonList.GetWidth() + 32, yRight - rightModeButtonList.GetHeight()-5)
  487.         rightModeButtonList.GetChild("button_skill").SetEvent(lambda adir=self.MOUSE_BUTTON_RIGHT, aevent=self.EVENT_SKILL: self.SelectMouseButtonEvent(adir, aevent))
  488.         rightModeButtonList.GetChild("button_skill").Hide()
  489.  
  490.         mouseImage = ui.ImageBox("TOP_MOST")
  491.         mouseImage.AddFlag("float")
  492.         mouseImage.LoadImage("d:/ymir work/ui/game/taskbar/mouse_button_camera_01.sub")
  493.         mouseImage.SetPosition(xRight, wndMgr.GetScreenHeight() - 34)
  494.         mouseImage.Hide()
  495.         self.mouseImage = mouseImage
  496.  
  497.         dir = self.MOUSE_BUTTON_LEFT
  498.         wnd = self.mouseModeButtonList[dir]
  499.         wnd.GetChild("button_move_and_attack").SetEvent(lambda adir=dir, aevent=self.EVENT_MOVE_AND_ATTACK: self.SelectMouseButtonEvent(adir, aevent))
  500.         wnd.GetChild("button_auto_attack").SetEvent(lambda adir=dir, aevent=self.EVENT_AUTO: self.SelectMouseButtonEvent(adir, aevent))
  501.         wnd.GetChild("button_camera").SetEvent(lambda adir=dir, aevent=self.EVENT_CAMERA: self.SelectMouseButtonEvent(adir, aevent))
  502.  
  503.         dir = self.MOUSE_BUTTON_RIGHT
  504.         wnd = self.mouseModeButtonList[dir]
  505.         wnd.GetChild("button_move_and_attack").SetEvent(lambda adir=dir, aevent=self.EVENT_MOVE_AND_ATTACK: self.SelectMouseButtonEvent(adir, aevent))
  506.         wnd.GetChild("button_camera").SetEvent(lambda adir=dir, aevent=self.EVENT_CAMERA: self.SelectMouseButtonEvent(adir, aevent))
  507.  
  508.         self.toggleButtonDict = toggleButtonDict
  509.         self.expGauge = expGauge
  510.  
  511.         if constInfo.IN_GAME_SHOP_ENABLE:
  512.             self.rampageGauge1  = self.GetChild("RampageGauge")
  513.             self.rampageGauge1.OnMouseOverIn = ui.__mem_func__(self.__RampageGauge_OverIn)
  514.             self.rampageGauge2 = self.GetChild("RampageGauge2")
  515.             self.rampageGauge2.OnMouseOverOut = ui.__mem_func__(self.__RampageGauge_OverOut)
  516.             self.rampageGauge2.OnMouseLeftButtonUp = ui.__mem_func__(self.__RampageGauge_Click)
  517.             print "[DEBUG]: constInfo.IN_GAME_SHOP_ENABLE / self.rampageGauge1",constInfo.IN_GAME_SHOP_ENABLE, self.rampageGauge1
  518.             self.__RampageGauge_OverOut()
  519.  
  520.         self.hpGauge = self.GetChild("HPGauge")
  521.         self.mpGauge = self.GetChild("SPGauge")
  522.         self.stGauge = self.GetChild("STGauge")
  523.         self.hpRecoveryGaugeBar = self.GetChild("HPRecoveryGaugeBar")
  524.         self.spRecoveryGaugeBar = self.GetChild("SPRecoveryGaugeBar")
  525.  
  526.         self.hpGaugeBoard=self.GetChild("HPGauge_Board")
  527.         self.mpGaugeBoard=self.GetChild("SPGauge_Board")
  528.         self.stGaugeBoard=self.GetChild("STGauge_Board")
  529.         self.expGaugeBoard=self.GetChild("EXP_Gauge_Board")
  530.  
  531.         #giftbox object
  532.         wndGiftBox = GiftBox()
  533.         wndGiftBox.LoadWindow()
  534.         self.wndGiftBox = wndGiftBox
  535.  
  536.         self.__LoadMouseSettings()
  537.         self.RefreshStatus()
  538.         self.RefreshQuickSlot()
  539.  
  540.     def __RampageGauge_OverIn(self):
  541.         print "rampage_over_in"
  542.         self.rampageGauge2.Show()
  543.         self.rampageGauge1.Hide()
  544.  
  545.     def __RampageGauge_OverOut(self):
  546.         print "rampage_over_out"
  547.         self.rampageGauge2.Hide()
  548.         self.rampageGauge1.Show()
  549.  
  550.     def __RampageGauge_Click(self):
  551.         print "rampage_up"
  552.         # net.SendChatPacket("/in_game_mall")
  553.         # gift icon hide when click mall icon
  554.         self.wndGiftBox.Hide()
  555.  
  556.     def __LoadMouseSettings(self):
  557.         try:
  558.             LoadMouseButtonSettings()
  559.             (mouseLeftButtonEvent, mouseRightButtonEvent) = GetMouseButtonSettings()
  560.             if not self.__IsInSafeMouseButtonSettingRange(mouseLeftButtonEvent) or not self.__IsInSafeMouseButtonSettingRange(mouseRightButtonEvent):
  561.                     raise RuntimeError, "INVALID_MOUSE_BUTTON_SETTINGS"
  562.         except:
  563.             InitMouseButtonSettings(self.EVENT_MOVE_AND_ATTACK, self.EVENT_CAMERA)
  564.             (mouseLeftButtonEvent, mouseRightButtonEvent) = GetMouseButtonSettings()
  565.  
  566.         try:
  567.             self.SelectMouseButtonEvent(self.MOUSE_BUTTON_LEFT, mouseLeftButtonEvent)
  568.             self.SelectMouseButtonEvent(self.MOUSE_BUTTON_RIGHT,    mouseRightButtonEvent)
  569.         except:
  570.             InitMouseButtonSettings(self.EVENT_MOVE_AND_ATTACK, self.EVENT_CAMERA)
  571.             (mouseLeftButtonEvent, mouseRightButtonEvent) = GetMouseButtonSettings()
  572.  
  573.             self.SelectMouseButtonEvent(self.MOUSE_BUTTON_LEFT, mouseLeftButtonEvent)
  574.             self.SelectMouseButtonEvent(self.MOUSE_BUTTON_RIGHT,    mouseRightButtonEvent)
  575.  
  576.  
  577.  
  578.     def __IsInSafeMouseButtonSettingRange(self, arg):
  579.         return arg >= self.EVENT_MOVE and arg <= self.EVENT_AUTO
  580.  
  581.     def Destroy(self):
  582.         SaveMouseButtonSettings()
  583.  
  584.         self.ClearDictionary()
  585.         self.mouseModeButtonList[0].ClearDictionary()
  586.         self.mouseModeButtonList[1].ClearDictionary()
  587.         self.mouseModeButtonList = 0
  588.         self.curMouseModeButton = 0
  589.         self.curSkillButton = 0
  590.         self.selectSkillButtonList = 0
  591.  
  592.  
  593.         self.expGauge = None
  594.         self.hpGauge = None
  595.         self.mpGauge = None
  596.         self.stGauge = None
  597.         self.hpRecoveryGaugeBar = None
  598.         self.spRecoveryGaugeBar = None
  599.  
  600.         self.tooltipItem = 0
  601.         self.tooltipSkill = 0
  602.         self.quickslot = 0
  603.         self.toggleButtonDict = 0
  604.  
  605.         self.hpGaugeBoard = 0
  606.         self.mpGaugeBoard = 0
  607.         self.stGaugeBoard = 0
  608.  
  609.         self.expGaugeBoard = 0
  610.  
  611.         self.tooltipHP = 0
  612.         self.tooltipSP = 0
  613.         self.tooltipST = 0
  614.         self.tooltipEXP = 0
  615.  
  616.         self.mouseImage = None
  617.  
  618.     def __OnClickQuickPageUpButton(self):
  619.         player.SetQuickPage(player.GetQuickPage()-1)
  620.  
  621.     def __OnClickQuickPageDownButton(self):
  622.         player.SetQuickPage(player.GetQuickPage()+1)
  623.  
  624.     def SetToggleButtonEvent(self, eButton, kEventFunc):
  625.         self.toggleButtonDict[eButton].SetEvent(kEventFunc)
  626.  
  627.     def SetItemToolTip(self, tooltipItem):
  628.         self.tooltipItem = tooltipItem
  629.  
  630.     def SetSkillToolTip(self, tooltipSkill):
  631.         self.tooltipSkill = tooltipSkill
  632.         self.curSkillButton.SetSkillToolTip(self.tooltipSkill)
  633.  
  634.     ## Mouse Image
  635.     def ShowMouseImage(self):
  636.         self.mouseImage.SetTop()
  637.         self.mouseImage.Show()
  638.  
  639.     def HideMouseImage(self):
  640.         player.SetQuickCameraMode(False)
  641.         self.mouseImage.Hide()
  642.  
  643.     ## Gauge
  644.     def RefreshStatus(self):
  645.         curHP = player.GetStatus(player.HP)
  646.         maxHP = player.GetStatus(player.MAX_HP)
  647.         curSP = player.GetStatus(player.SP)
  648.         maxSP = player.GetStatus(player.MAX_SP)
  649.         curEXP = unsigned32(player.GetStatus(player.EXP))
  650.         nextEXP = unsigned32(player.GetStatus(player.NEXT_EXP))
  651.         recoveryHP = player.GetStatus(player.HP_RECOVERY)
  652.         recoverySP = player.GetStatus(player.SP_RECOVERY)
  653.  
  654.         self.RefreshStamina()
  655.  
  656.         self.SetHP(curHP, recoveryHP, maxHP)
  657.         self.SetSP(curSP, recoverySP, maxSP)
  658.         self.SetExperience(curEXP, nextEXP)
  659.  
  660.     def RefreshStamina(self):
  661.         curST = player.GetStatus(player.STAMINA)
  662.         maxST = player.GetStatus(player.MAX_STAMINA)
  663.         self.SetST(curST, maxST)
  664.  
  665.     def RefreshSkill(self):
  666.         self.curSkillButton.RefreshSkill()
  667.         for button in self.selectSkillButtonList:
  668.             button.RefreshSkill()
  669.  
  670.     def SetHP(self, curPoint, recoveryPoint, maxPoint):
  671.         curPoint = min(curPoint, maxPoint)
  672.         if maxPoint > 0:
  673.             self.hpGauge.SetPercentage(curPoint, maxPoint)
  674.             self.tooltipHP.SetText("%s : %d / %d" % (localeInfo.TASKBAR_HP, curPoint, maxPoint))
  675.  
  676.             if 0 == recoveryPoint:
  677.                 self.hpRecoveryGaugeBar.Hide()
  678.             else:
  679.                 destPoint = min(maxPoint, curPoint + recoveryPoint)
  680.                 newWidth = int(self.GAUGE_WIDTH * (float(destPoint) / float(maxPoint)))
  681.                 self.hpRecoveryGaugeBar.SetSize(newWidth, self.GAUGE_HEIGHT)
  682.                 self.hpRecoveryGaugeBar.Show()
  683.  
  684.     def SetSP(self, curPoint, recoveryPoint, maxPoint):
  685.         curPoint = min(curPoint, maxPoint)
  686.         if maxPoint > 0:
  687.             self.mpGauge.SetPercentage(curPoint, maxPoint)
  688.             self.tooltipSP.SetText("%s : %d / %d" % (localeInfo.TASKBAR_SP, curPoint, maxPoint))
  689.  
  690.             if 0 == recoveryPoint:
  691.                 self.spRecoveryGaugeBar.Hide()
  692.             else:
  693.                 destPoint = min(maxPoint, curPoint + recoveryPoint)
  694.                 newWidth = int(self.GAUGE_WIDTH * (float(destPoint) / float(maxPoint)))
  695.                 self.spRecoveryGaugeBar.SetSize(newWidth, self.GAUGE_HEIGHT)
  696.                 self.spRecoveryGaugeBar.Show()
  697.  
  698.     def SetST(self, curPoint, maxPoint):
  699.         curPoint = min(curPoint, maxPoint)
  700.         if maxPoint > 0:
  701.             self.stGauge.SetPercentage(curPoint, maxPoint)
  702.             self.tooltipST.SetText("%s : %d / %d" % (localeInfo.TASKBAR_ST, curPoint, maxPoint))
  703.  
  704.     def SetExperience(self, curPoint, maxPoint):
  705.  
  706.         curPoint = min(curPoint, maxPoint)
  707.         curPoint = max(curPoint, 0)
  708.         maxPoint = max(maxPoint, 0)
  709.  
  710.         quarterPoint = maxPoint / 4
  711.         FullCount = 0
  712.  
  713.         if 0 != quarterPoint:
  714.             FullCount = min(4, curPoint / quarterPoint)
  715.  
  716.         for i in xrange(4):
  717.             self.expGauge[i].Hide()
  718.  
  719.         for i in xrange(FullCount):
  720.             self.expGauge[i].SetRenderingRect(0.0, 0.0, 0.0, 0.0)
  721.             self.expGauge[i].Show()
  722.  
  723.         if 0 != quarterPoint:
  724.             if FullCount < 4:
  725.                 Percentage = float(curPoint % quarterPoint) / quarterPoint - 1.0
  726.                 self.expGauge[FullCount].SetRenderingRect(0.0, Percentage, 0.0, 0.0)
  727.                 self.expGauge[FullCount].Show()
  728.  
  729.         #####
  730.         self.tooltipEXP.SetText("%s : %.2f%%" % (localeInfo.TASKBAR_EXP, float(curPoint) / max(1, float(maxPoint)) * 100))
  731.  
  732.  
  733.     ## QuickSlot
  734.     def RefreshQuickSlot(self):
  735.  
  736.         pageNum = player.GetQuickPage()
  737.  
  738.         try:
  739.             self.quickPageNumImageBox.LoadImage(TaskBar.QUICKPAGE_NUMBER_FILENAME[pageNum])
  740.         except:
  741.             pass
  742.  
  743.         startNumber = 0
  744.         for slot in self.quickslot:
  745.  
  746.             for i in xrange(4):
  747.  
  748.                 slotNumber = i+startNumber
  749.  
  750.                 (Type, Position) = player.GetLocalQuickSlot(slotNumber)
  751.  
  752.                 if player.SLOT_TYPE_NONE == Type:
  753.                     slot.ClearSlot(slotNumber)
  754.                     continue
  755.  
  756.                 if player.SLOT_TYPE_INVENTORY == Type:
  757.  
  758.                     itemIndex = player.GetItemIndex(Position)
  759.                     itemCount = player.GetItemCount(Position)
  760.                     if itemCount <= 1:
  761.                         itemCount = 0
  762.  
  763.                     if constInfo.IS_AUTO_POTION(itemIndex):
  764.                         metinSocket = [player.GetItemMetinSocket(Position, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
  765.  
  766.                         if 0 != int(metinSocket[0]):
  767.                             slot.ActivateSlot(slotNumber)
  768.                         else:
  769.                             slot.DeactivateSlot(slotNumber)
  770.  
  771.                     slot.SetItemSlot(slotNumber, itemIndex, itemCount)
  772.  
  773.                 elif player.SLOT_TYPE_SKILL == Type:
  774.  
  775.                     skillIndex = player.GetSkillIndex(Position)
  776.                     if 0 == skillIndex:
  777.                         slot.ClearSlot(slotNumber)
  778.                         continue
  779.  
  780.                     skillType = skill.GetSkillType(skillIndex)
  781.                     if skill.SKILL_TYPE_GUILD == skillType:
  782.                         import guild
  783.                         skillGrade = 0
  784.                         skillLevel = guild.GetSkillLevel(Position)
  785.  
  786.                     else:
  787.                         skillGrade = player.GetSkillGrade(Position)
  788.                         skillLevel = player.GetSkillLevel(Position)
  789.  
  790.                     slot.SetSkillSlotNew(slotNumber, skillIndex, skillGrade, skillLevel)
  791.                     slot.SetSlotCountNew(slotNumber, skillGrade, skillLevel)
  792.                     slot.SetCoverButton(slotNumber)
  793.  
  794.                     if player.IsSkillCoolTime(Position):
  795.                         (coolTime, elapsedTime) = player.GetSkillCoolTime(Position)
  796.                         slot.SetSlotCoolTime(slotNumber, coolTime, elapsedTime)
  797.  
  798.                     if player.IsSkillActive(Position):
  799.                         slot.ActivateSlot(slotNumber)
  800.  
  801.                 elif player.SLOT_TYPE_EMOTION == Type:
  802.  
  803.                     emotionIndex = Position
  804.                     slot.SetEmotionSlot(slotNumber, emotionIndex)
  805.                     slot.SetCoverButton(slotNumber)
  806.                     slot.SetSlotCount(slotNumber, 0)
  807.  
  808.             slot.RefreshSlot()
  809.             startNumber += 4
  810.  
  811.     def canAddQuickSlot(self, Type, slotNumber):
  812.  
  813.         if player.SLOT_TYPE_INVENTORY == Type:
  814.  
  815.             itemIndex = player.GetItemIndex(slotNumber)
  816.             return item.CanAddToQuickSlotItem(itemIndex)
  817.  
  818.         return True
  819.  
  820.     def AddQuickSlot(self, localSlotIndex):
  821.         AttachedSlotType = mouseModule.mouseController.GetAttachedType()
  822.         AttachedSlotNumber = mouseModule.mouseController.GetAttachedSlotNumber()
  823.         AttachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
  824.  
  825.         if player.SLOT_TYPE_QUICK_SLOT == AttachedSlotType:
  826.             player.RequestMoveGlobalQuickSlotToLocalQuickSlot(AttachedSlotNumber, localSlotIndex)
  827.  
  828.         elif player.SLOT_TYPE_EMOTION == AttachedSlotType:
  829.  
  830.             player.RequestAddLocalQuickSlot(localSlotIndex, AttachedSlotType, AttachedItemIndex)
  831.  
  832.         elif True == self.canAddQuickSlot(AttachedSlotType, AttachedSlotNumber):
  833.  
  834.             ## Online Code
  835.             player.RequestAddLocalQuickSlot(localSlotIndex, AttachedSlotType, AttachedSlotNumber)
  836.  
  837.         mouseModule.mouseController.DeattachObject()
  838.         self.RefreshQuickSlot()
  839.  
  840.     def SelectEmptyQuickSlot(self, slotIndex):
  841.  
  842.         if True == mouseModule.mouseController.isAttached():
  843.             self.AddQuickSlot(slotIndex)
  844.  
  845.     def SelectItemQuickSlot(self, localQuickSlotIndex):
  846.  
  847.         if True == mouseModule.mouseController.isAttached():
  848.             self.AddQuickSlot(localQuickSlotIndex)
  849.  
  850.         else:
  851.             globalQuickSlotIndex=player.LocalQuickSlotIndexToGlobalQuickSlotIndex(localQuickSlotIndex)
  852.             mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_QUICK_SLOT, globalQuickSlotIndex, globalQuickSlotIndex)
  853.  
  854.     def UnselectItemQuickSlot(self, localSlotIndex):
  855.  
  856.         if False == mouseModule.mouseController.isAttached():
  857.             player.RequestUseLocalQuickSlot(localSlotIndex)
  858.             return
  859.  
  860.         elif mouseModule.mouseController.isAttached():
  861.             mouseModule.mouseController.DeattachObject()
  862.             return
  863.  
  864.  
  865.     def OnUseSkill(self, usedSlotIndex, coolTime):
  866.  
  867.         QUICK_SLOT_SLOT_COUNT = 4
  868.         slotIndex = 0
  869.  
  870.         ## Current Skill Button
  871.         if usedSlotIndex == self.curSkillButton.GetSlotIndex():
  872.             self.curSkillButton.Activate(coolTime)
  873.  
  874.         ## Quick Slot
  875.         for slotWindow in self.quickslot:
  876.  
  877.             for i in xrange(QUICK_SLOT_SLOT_COUNT):
  878.  
  879.                 (Type, Position) = player.GetLocalQuickSlot(slotIndex)
  880.  
  881.                 if Type == player.SLOT_TYPE_SKILL:
  882.                     if usedSlotIndex == Position:
  883.                         slotWindow.SetSlotCoolTime(slotIndex, coolTime)
  884.                         return
  885.  
  886.                 slotIndex += 1
  887.  
  888.     def OnActivateSkill(self, usedSlotIndex):
  889.         slotIndex = 0
  890.  
  891.         ## Current Skill Button
  892.         if usedSlotIndex == self.curSkillButton.GetSlotIndex():
  893.             self.curSkillButton.Deactivate()
  894.  
  895.         ## Quick Slot
  896.         for slotWindow in self.quickslot:
  897.  
  898.             for i in xrange(4):
  899.  
  900.                 (Type, Position) = player.GetLocalQuickSlot(slotIndex)
  901.  
  902.                 if Type == player.SLOT_TYPE_SKILL:
  903.                     if usedSlotIndex == Position:
  904.                         slotWindow.ActivateSlot(slotIndex)
  905.                         return
  906.  
  907.                 slotIndex += 1
  908.  
  909.     def OnDeactivateSkill(self, usedSlotIndex):
  910.         slotIndex = 0
  911.  
  912.         ## Current Skill Button
  913.         if usedSlotIndex == self.curSkillButton.GetSlotIndex():
  914.             self.curSkillButton.Deactivate()
  915.  
  916.         ## Quick Slot
  917.         for slotWindow in self.quickslot:
  918.  
  919.             for i in xrange(4):
  920.  
  921.                 (Type, Position) = player.GetLocalQuickSlot(slotIndex)
  922.  
  923.                 if Type == player.SLOT_TYPE_SKILL:
  924.                     if usedSlotIndex == Position:
  925.                         slotWindow.DeactivateSlot(slotIndex)
  926.                         return
  927.  
  928.                 slotIndex += 1
  929.  
  930.     ## ToolTip
  931.     def OverInItem(self, slotNumber):
  932.         if mouseModule.mouseController.isAttached():
  933.             return
  934.  
  935.         (Type, Position) = player.GetLocalQuickSlot(slotNumber)
  936.  
  937.         if player.SLOT_TYPE_INVENTORY == Type:
  938.             self.tooltipItem.SetInventoryItem(Position)
  939.             self.tooltipSkill.HideToolTip()
  940.  
  941.         elif player.SLOT_TYPE_SKILL == Type:
  942.  
  943.             skillIndex = player.GetSkillIndex(Position)
  944.             skillType = skill.GetSkillType(skillIndex)
  945.  
  946.             if skill.SKILL_TYPE_GUILD == skillType:
  947.                 import guild
  948.                 skillGrade = 0
  949.                 skillLevel = guild.GetSkillLevel(Position)
  950.  
  951.             else:
  952.                 skillGrade = player.GetSkillGrade(Position)
  953.                 skillLevel = player.GetSkillLevel(Position)
  954.  
  955.             self.tooltipSkill.SetSkillNew(Position, skillIndex, skillGrade, skillLevel)
  956.             self.tooltipItem.HideToolTip()
  957.  
  958.     def OverOutItem(self):
  959.         if 0 != self.tooltipItem:
  960.             self.tooltipItem.HideToolTip()
  961.         if 0 != self.tooltipSkill:
  962.             self.tooltipSkill.HideToolTip()
  963.  
  964.     def OnUpdate(self):
  965.         if app.GetGlobalTime() - self.lastUpdateQuickSlot > 500:
  966.             self.lastUpdateQuickSlot = app.GetGlobalTime()
  967.             self.RefreshQuickSlot()
  968.  
  969.         if True == self.hpGaugeBoard.IsIn():
  970.             self.tooltipHP.Show()
  971.         else:
  972.             self.tooltipHP.Hide()
  973.  
  974.         if True == self.mpGaugeBoard.IsIn():
  975.             self.tooltipSP.Show()
  976.         else:
  977.             self.tooltipSP.Hide()
  978.  
  979.         if True == self.stGaugeBoard.IsIn():
  980.             self.tooltipST.Show()
  981.         else:
  982.             self.tooltipST.Hide()
  983.  
  984.         if True == self.expGaugeBoard.IsIn():
  985.             self.tooltipEXP.Show()
  986.         else:
  987.             self.tooltipEXP.Hide()
  988.  
  989.     ## Skill
  990.     def ToggleLeftMouseButtonModeWindow(self):
  991.  
  992.         wndMouseButtonMode = self.mouseModeButtonList[self.MOUSE_BUTTON_LEFT]
  993.  
  994.         if True == wndMouseButtonMode.IsShow():
  995.  
  996.             wndMouseButtonMode.Hide()
  997.  
  998.         else:
  999.             wndMouseButtonMode.Show()
  1000.  
  1001.     def ToggleRightMouseButtonModeWindow(self):
  1002.  
  1003.         wndMouseButtonMode = self.mouseModeButtonList[self.MOUSE_BUTTON_RIGHT]
  1004.  
  1005.         if True == wndMouseButtonMode.IsShow():
  1006.  
  1007.             wndMouseButtonMode.Hide()
  1008.             self.CloseSelectSkill()
  1009.  
  1010.         else:
  1011.             wndMouseButtonMode.Show()
  1012.             self.OpenSelectSkill()
  1013.  
  1014.     def OpenSelectSkill(self):
  1015.  
  1016.         PAGE_SLOT_COUNT = 6
  1017.  
  1018.         (xSkillButton, y) = self.curSkillButton.GetGlobalPosition()
  1019.         y -= (37 + 32 + 1)
  1020.  
  1021.         for key in self.skillCategoryNameList:
  1022.  
  1023.             appendCount = 0
  1024.             startNumber = self.skillPageStartSlotIndexDict[key]
  1025.             x = xSkillButton
  1026.  
  1027.             getSkillIndex=player.GetSkillIndex
  1028.             getSkillLevel=player.GetSkillLevel
  1029.             for i in xrange(PAGE_SLOT_COUNT):
  1030.  
  1031.                 skillIndex = getSkillIndex(startNumber+i)
  1032.                 skillLevel = getSkillLevel(startNumber+i)
  1033.  
  1034.                 if 0 == skillIndex:
  1035.                     continue
  1036.                 if 0 == skillLevel:
  1037.                     continue
  1038.                 if skill.IsStandingSkill(skillIndex):
  1039.                     continue
  1040.  
  1041.                 skillButton = self.SkillButton()
  1042.                 skillButton.SetSkill(startNumber+i)
  1043.                 skillButton.SetPosition(x, y)
  1044.                 skillButton.SetSkillEvent(ui.__mem_func__(self.CloseSelectSkill), startNumber+i+1)
  1045.                 skillButton.SetSkillToolTip(self.tooltipSkill)
  1046.                 skillButton.SetTop()
  1047.                 skillButton.Show()
  1048.                 self.selectSkillButtonList.append(skillButton)
  1049.  
  1050.                 appendCount += 1
  1051.                 x -= 32
  1052.  
  1053.             if appendCount > 0:
  1054.                 y -= 32
  1055.  
  1056.     def CloseSelectSkill(self, slotIndex=-1):
  1057.  
  1058.         self.mouseModeButtonList[self.MOUSE_BUTTON_RIGHT].Hide()
  1059.         for button in self.selectSkillButtonList:
  1060.             button.Destroy()
  1061.  
  1062.         self.selectSkillButtonList = []
  1063.  
  1064.         if -1 != slotIndex:
  1065.             self.curSkillButton.Show()
  1066.             self.curMouseModeButton[self.MOUSE_BUTTON_RIGHT].Hide()
  1067.             player.SetMouseFunc(player.MBT_RIGHT, player.MBF_SKILL)
  1068.             player.ChangeCurrentSkillNumberOnly(slotIndex-1)
  1069.         else:
  1070.             self.curSkillButton.Hide()
  1071.             self.curMouseModeButton[self.MOUSE_BUTTON_RIGHT].Show()
  1072.  
  1073.     def SelectMouseButtonEvent(self, dir, event):
  1074.         SetMouseButtonSetting(dir, event)
  1075.  
  1076.         self.CloseSelectSkill()
  1077.         self.mouseModeButtonList[dir].Hide()
  1078.  
  1079.         btn = 0
  1080.         type = self.NONE
  1081.         func = self.NONE
  1082.         tooltip_text = ""
  1083.  
  1084.         if self.MOUSE_BUTTON_LEFT == dir:
  1085.             type = player.MBT_LEFT
  1086.  
  1087.         elif self.MOUSE_BUTTON_RIGHT == dir:
  1088.             type = player.MBT_RIGHT
  1089.  
  1090.         if self.EVENT_MOVE == event:
  1091.             btn = self.mouseModeButtonList[dir].GetChild("button_move")
  1092.             func = player.MBF_MOVE
  1093.             tooltip_text = localeInfo.TASKBAR_MOVE
  1094.         elif self.EVENT_ATTACK == event:
  1095.             btn = self.mouseModeButtonList[dir].GetChild("button_attack")
  1096.             func = player.MBF_ATTACK
  1097.             tooltip_text = localeInfo.TASKBAR_ATTACK
  1098.         elif self.EVENT_AUTO == event:
  1099.             btn = self.mouseModeButtonList[dir].GetChild("button_auto_attack")
  1100.             func = player.MBF_AUTO
  1101.             tooltip_text = localeInfo.TASKBAR_AUTO
  1102.         elif self.EVENT_MOVE_AND_ATTACK == event:
  1103.             btn = self.mouseModeButtonList[dir].GetChild("button_move_and_attack")
  1104.             func = player.MBF_SMART
  1105.             tooltip_text = localeInfo.TASKBAR_ATTACK
  1106.         elif self.EVENT_CAMERA == event:
  1107.             btn = self.mouseModeButtonList[dir].GetChild("button_camera")
  1108.             func = player.MBF_CAMERA
  1109.             tooltip_text = localeInfo.TASKBAR_CAMERA
  1110.         elif self.EVENT_SKILL == event:
  1111.             btn = self.mouseModeButtonList[dir].GetChild("button_skill")
  1112.             func = player.MBF_SKILL
  1113.             tooltip_text = localeInfo.TASKBAR_SKILL
  1114.  
  1115.         if 0 != btn:
  1116.             self.curMouseModeButton[dir].SetToolTipText(tooltip_text, 0, -18)
  1117.             self.curMouseModeButton[dir].SetUpVisual(btn.GetUpVisualFileName())
  1118.             self.curMouseModeButton[dir].SetOverVisual(btn.GetOverVisualFileName())
  1119.             self.curMouseModeButton[dir].SetDownVisual(btn.GetDownVisualFileName())
  1120.             self.curMouseModeButton[dir].Show()
  1121.  
  1122.         player.SetMouseFunc(type, func)
  1123.  
  1124.     def OnChangeCurrentSkill(self, skillSlotNumber):
  1125.         self.curSkillButton.SetSkill(skillSlotNumber)
  1126.         self.curSkillButton.Show()
  1127.         self.curMouseModeButton[self.MOUSE_BUTTON_RIGHT].Hide()
  1128.  
  1129.  
Advertisement
Add Comment
Please, Sign In to add comment