Guest User

Untitled

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