Advertisement
Guest User

Untitled

a guest
Jul 31st, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 35.92 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 miniMap
  12. import playerSettingModule
  13. import app
  14. import uiToolTip
  15.  
  16. from ui import ExpandedImageBox, ImageBox, Button
  17.  
  18. MOUSE_SETTINGS = [0, 0]
  19.  
  20. FACE_IMAGE_DICT = {
  21. playerSettingModule.RACE_WARRIOR_M : "d:/ymir work/interface/faces_taskbar/icon_mwarrior.tga",
  22. playerSettingModule.RACE_WARRIOR_W : "d:/ymir work/interface/faces_taskbar/icon_wwarrior.tga",
  23. playerSettingModule.RACE_ASSASSIN_M : "d:/ymir work/interface/faces_taskbar/icon_mninja.tga",
  24. playerSettingModule.RACE_ASSASSIN_W : "d:/ymir work/interface/faces_taskbar/icon_wninja.tga",
  25. playerSettingModule.RACE_SURA_M : "d:/ymir work/interface/faces_taskbar/icon_msura.tga",
  26. playerSettingModule.RACE_SURA_W : "d:/ymir work/interface/faces_taskbar/icon_wsura.tga",
  27. playerSettingModule.RACE_SHAMAN_M : "d:/ymir work/interface/faces_taskbar/icon_mshaman.tga",
  28. playerSettingModule.RACE_SHAMAN_W : "d:/ymir work/interface/faces_taskbar/icon_wshaman.tga",
  29. }
  30.  
  31. def InitMouseButtonSettings(left, right):
  32. global MOUSE_SETTINGS
  33. MOUSE_SETTINGS = [left, right]
  34.  
  35. def SetMouseButtonSetting(dir, event):
  36. global MOUSE_SETTINGS
  37. MOUSE_SETTINGS[dir] = event
  38.  
  39. def GetMouseButtonSettings():
  40. global MOUSE_SETTINGS
  41. return MOUSE_SETTINGS
  42.  
  43. def SaveMouseButtonSettings():
  44. global MOUSE_SETTINGS
  45. open("mouse.cfg", "w").write("%s\t%s" % tuple(MOUSE_SETTINGS))
  46.  
  47. def LoadMouseButtonSettings():
  48. global MOUSE_SETTINGS
  49. tokens = open("mouse.cfg", "r").read().split()
  50.  
  51. if len(tokens) != 2:
  52. raise RuntimeError, "MOUSE_SETTINGS_FILE_ERROR"
  53.  
  54. MOUSE_SETTINGS[0] = int(tokens[0])
  55. MOUSE_SETTINGS[1] = int(tokens[1])
  56.  
  57. def unsigned32(n):
  58. return n & 0xFFFFFFFFFL
  59.  
  60. class EnergyBar(ui.ScriptWindow):
  61. class TextToolTip(ui.Window):
  62. def __init__(self):
  63. ui.Window.__init__(self)
  64. self.SetWindowName("EnergyBar")
  65. textLine = ui.TextLine()
  66. textLine.SetParent(self)
  67. textLine.SetHorizontalAlignCenter()
  68. textLine.SetOutline()
  69. textLine.Show()
  70. self.textLine = textLine
  71.  
  72. def __del__(self):
  73. ui.Window.__del__(self)
  74.  
  75. def SetText(self, text):
  76. self.textLine.SetText(text)
  77.  
  78. def OnRender(self):
  79. (mouseX, mouseY) = wndMgr.GetMousePosition()
  80. self.textLine.SetPosition(mouseX, mouseY - 15)
  81.  
  82. def __init__(self):
  83. #print "NEW TASKBAR ----------------------------------------------------------------------------"
  84. ui.ScriptWindow.__init__(self)
  85. self.tooltipEnergy = self.TextToolTip()
  86. self.tooltipEnergy.Show()
  87.  
  88. def __del__(self):
  89. #print "---------------------------------------------------------------------------- DELETE TASKBAR"
  90. ui.ScriptWindow.__del__(self)
  91.  
  92. def LoadWindow(self):
  93. try:
  94. pyScrLoader = ui.PythonScriptLoader()
  95. pyScrLoader.LoadScriptFile(self, uiScriptLocale.LOCALE_UISCRIPT_PATH + "EnergyBar.py")
  96. except:
  97. import exception
  98. exception.Abort("EnergyBar.LoadWindow.LoadObject")
  99.  
  100. self.energyEmpty = self.GetChild("EnergyGauge_Empty")
  101. self.energyHungry = self.GetChild("EnergyGauge_Hungry")
  102. self.energyFull = self.GetChild("EnergyGauge_Full")
  103.  
  104. self.energyGaugeBoard = self.GetChild("EnergyGauge_Board")
  105. self.energyGaugeToolTip = self.GetChild("EnergyGauge_ToolTip")
  106.  
  107.  
  108. def Destroy(self):
  109. self.energyEmpty = None
  110. self.energyHungry = None
  111. self.energyFull = None
  112. self.energyGaugeBoard = 0
  113. self.energyGaugeToolTip = 0
  114. self.tooltipEnergy = 0
  115.  
  116. ## Gauge
  117. def RefreshStatus(self):
  118. pointEnergy = player.GetStatus (player.ENERGY)
  119. leftTimeEnergy = player.GetStatus (player.ENERGY_END_TIME) - app.GetGlobalTimeStamp()
  120. # Ăć±âČŻ ÁöĽÓ ˝Ă°Ł = 2˝Ă°Ł.
  121. self.SetEnergy (pointEnergy, leftTimeEnergy, 7200)
  122.  
  123. def SetEnergy (self, point, leftTime, maxTime):
  124. leftTime = max (leftTime, 0)
  125. maxTime = max (maxTime, 0)
  126.  
  127. self.energyEmpty.Hide()
  128. self.energyHungry.Hide()
  129. self.energyFull.Hide()
  130.  
  131. if leftTime == 0:
  132. self.energyEmpty.Show()
  133. elif ((leftTime * 100) / maxTime) < 15:
  134. self.energyHungry.Show()
  135. else:
  136. self.energyFull.Show()
  137.  
  138. self.tooltipEnergy.SetText(" " + localeInfo.SecondToHM(leftTime) + " - Energie +" + str(point) + "%")
  139.  
  140. def OnUpdate(self):
  141. if TRUE == self.energyGaugeToolTip.IsIn():
  142. self.RefreshStatus()
  143. self.tooltipEnergy.Show()
  144. else:
  145. self.tooltipEnergy.Hide()
  146.  
  147. class ExpandedTaskBar(ui.ScriptWindow):
  148. BUTTON_VEGAS_CALCULATOR = 0
  149. BUTTON_DRAGON_SOUL = 0
  150. def __init__(self):
  151. ui.Window.__init__(self)
  152. self.SetWindowName("ExpandedTaskBar")
  153.  
  154. def LoadWindow(self):
  155. try:
  156. pyScrLoader = ui.PythonScriptLoader()
  157. pyScrLoader.LoadScriptFile(self, uiScriptLocale.LOCALE_UISCRIPT_PATH + "ExpandedTaskBar.py")
  158. except:
  159. import exception
  160. exception.Abort("ExpandedTaskBar.LoadWindow.LoadObject")
  161.  
  162. self.expandedTaskBarBoard = self.GetChild("ExpanedTaskBar_Board")
  163.  
  164. self.toggleButtonDict = {}
  165. self.toggleButtonDict[ExpandedTaskBar.BUTTON_VEGAS_CALCULATOR] = self.GetChild("CalculatorTitan2")
  166. self.toggleButtonDict[ExpandedTaskBar.BUTTON_VEGAS_CALCULATOR].SetParent(self)
  167. self.toggleButtonDict[ExpandedTaskBar.BUTTON_DRAGON_SOUL] = self.GetChild("DragonSoulButton")
  168. self.toggleButtonDict[ExpandedTaskBar.BUTTON_DRAGON_SOUL].SetParent(self)
  169.  
  170. def SetTop(self):
  171. super(ExpandedTaskBar, self).SetTop()
  172. for button in self.toggleButtonDict.values():
  173. button.SetTop()
  174.  
  175. def Show(self):
  176. ui.ScriptWindow.Show(self)
  177.  
  178. def Close(self):
  179. self.Hide()
  180.  
  181. def SetToolTipText(self, eButton, text):
  182. self.toggleButtonDict[eButton].SetToolTipText(text)
  183.  
  184. def SetToggleButtonEvent(self, eButton, kEventFunc):
  185. self.toggleButtonDict[eButton].SetEvent(kEventFunc)
  186.  
  187. def OnPressEscapeKey(self):
  188. self.Close()
  189. return TRUE
  190.  
  191.  
  192.  
  193.  
  194. class TaskBar(ui.ScriptWindow):
  195.  
  196. BUTTON_CHARACTER = 0
  197. BUTTON_INVENTORY = 1
  198. BUTTON_MESSENGER = 2
  199. BUTTON_SYSTEM = 3
  200. BUTTON_CHAT = 4
  201. BUTTON_HORSEQUICK = 5
  202. BUTTON_VECTORS = 6
  203. BUTTON_HZL = 7
  204. BUTTON_DARKMMO = 8
  205. BUTTON_EXPAND = 4
  206. IS_EXPANDED = FALSE
  207.  
  208. MOUSE_BUTTON_LEFT = 0
  209. MOUSE_BUTTON_RIGHT = 1
  210. NONE = 255
  211.  
  212. EVENT_MOVE = 0
  213. EVENT_ATTACK = 1
  214. EVENT_MOVE_AND_ATTACK = 2
  215. EVENT_CAMERA = 3
  216. EVENT_SKILL = 4
  217. EVENT_AUTO = 5
  218.  
  219. GAUGE_WIDTH = 95
  220. GAUGE_HEIGHT = 13
  221.  
  222. QUICKPAGE_NUMBER_FILENAME = [
  223. "d:/ymir work/interface/taskbar/numbers/btn_slotpageone_03_active.tga",
  224. "d:/ymir work/interface/taskbar/numbers/btn_slotpagetwo_03_active.tga",
  225. "d:/ymir work/interface/taskbar/numbers/btn_slotpagethree_03_active.tga",
  226. "d:/ymir work/interface/taskbar/numbers/btn_slotpagefour_03_active.tga",
  227. ]
  228.  
  229. class TextToolTip(ui.Window):
  230. def __init__(self):
  231. ui.Window.__init__(self, "TOP_MOST")
  232.  
  233. textLine = ui.TextLine()
  234. textLine.SetParent(self)
  235. textLine.SetHorizontalAlignCenter()
  236. textLine.SetOutline()
  237. textLine.Show()
  238. self.textLine = textLine
  239.  
  240. def __del__(self):
  241. ui.Window.__del__(self)
  242.  
  243. def SetText(self, text):
  244. self.textLine.SetText(text)
  245.  
  246. def OnRender(self):
  247. (mouseX, mouseY) = wndMgr.GetMousePosition()
  248. self.textLine.SetPosition(mouseX, mouseY - 15)
  249.  
  250. class SkillButton(ui.SlotWindow):
  251.  
  252. def __init__(self):
  253. ui.SlotWindow.__init__(self)
  254.  
  255. self.event = 0
  256. self.arg = 0
  257.  
  258. self.slotIndex = 0
  259. self.skillIndex = 0
  260.  
  261. slotIndex = 0
  262. wndMgr.SetSlotBaseImage(self.hWnd, "d:/ymir work/ui/public/slot_base.sub", 1.0, 1.0, 1.0, 1.0)
  263. wndMgr.AppendSlot(self.hWnd, slotIndex, 0, 0, 32, 32)
  264. self.SetCoverButton(slotIndex, "d:/ymir work/ui/public/slot_base.sub",\
  265. "d:/ymir work/ui/public/slot_base.sub",\
  266. "d:/ymir work/ui/public/slot_base.sub",\
  267. "d:/ymir work/ui/public/slot_base.sub", TRUE, FALSE)
  268. self.SetSize(32, 32)
  269.  
  270. def __del__(self):
  271. ui.SlotWindow.__del__(self)
  272.  
  273. def Destroy(self):
  274. if 0 != self.tooltipSkill:
  275. self.tooltipSkill.HideToolTip()
  276.  
  277. def RefreshSkill(self):
  278. if 0 != self.slotIndex:
  279. self.SetSkill(self.slotIndex)
  280.  
  281. def SetSkillToolTip(self, tooltip):
  282. self.tooltipSkill = tooltip
  283.  
  284. def SetSkill(self, skillSlotNumber):
  285. slotNumber = 0
  286. skillIndex = player.GetSkillIndex(skillSlotNumber)
  287. skillGrade = player.GetSkillGrade(skillSlotNumber)
  288. skillLevel = player.GetSkillLevel(skillSlotNumber)
  289. skillType = skill.GetSkillType(skillIndex)
  290.  
  291. self.skillIndex = skillIndex
  292. if 0 == self.skillIndex:
  293. self.ClearSlot(slotNumber)
  294. return
  295.  
  296. self.slotIndex = skillSlotNumber
  297.  
  298. self.SetSkillSlotNew(slotNumber, skillIndex, skillGrade, skillLevel)
  299. self.SetSlotCountNew(slotNumber, skillGrade, skillLevel)
  300.  
  301.  
  302. if player.IsSkillCoolTime(skillSlotNumber):
  303. (coolTime, elapsedTime) = player.GetSkillCoolTime(skillSlotNumber)
  304. self.SetSlotCoolTime(slotNumber, coolTime, elapsedTime)
  305.  
  306.  
  307. if player.IsSkillActive(skillSlotNumber):
  308. self.ActivateSlot(slotNumber)
  309.  
  310. def SetSkillEvent(self, event, arg=0):
  311. self.event = event
  312. self.arg = arg
  313.  
  314. def GetSkillIndex(self):
  315. return self.skillIndex
  316.  
  317. def GetSlotIndex(self):
  318. return self.slotIndex
  319.  
  320. def Activate(self, coolTime):
  321. self.SetSlotCoolTime(0, coolTime)
  322.  
  323. if skill.IsToggleSkill(self.skillIndex):
  324. self.ActivateSlot(0)
  325.  
  326. def Deactivate(self):
  327. if skill.IsToggleSkill(self.skillIndex):
  328. self.DeactivateSlot(0)
  329.  
  330. def OnOverInItem(self, dummy):
  331. self.tooltipSkill.SetSkill(self.skillIndex)
  332.  
  333. def OnOverOutItem(self):
  334. self.tooltipSkill.HideToolTip()
  335.  
  336. def OnSelectItemSlot(self, dummy):
  337. if 0 != self.event:
  338. if 0 != self.arg:
  339. self.event(self.arg)
  340. else:
  341. self.event()
  342.  
  343.  
  344. def __init__(self):
  345. #print "NEW TASKBAR ----------------------------------------------------------------------------"
  346.  
  347. ui.ScriptWindow.__init__(self, "TOP_MOST")
  348. self.text = {}
  349.  
  350. self.quickPageNumImageBox = None
  351. self.tooltipItem = 0
  352. self.tooltipSkill = 0
  353. self.TaskBarLeft = ui.ScriptWindow("TOP_MOST")
  354. self.TaskBarLeft2 = ui.ScriptWindow("TOP_MOST")
  355. self.mouseModeButtonList = [ ui.ScriptWindow("TOP_MOST"), ui.ScriptWindow("TOP_MOST") ]
  356.  
  357. self.tooltipHP = self.TextToolTip()
  358. self.tooltipHP.Hide()
  359. self.tooltipSP = self.TextToolTip()
  360. self.tooltipSP.Hide()
  361. self.tooltipST = self.TextToolTip()
  362. self.tooltipST.Hide()
  363. self.tooltipEXP = self.TextToolTip()
  364. self.tooltipEXP.Hide()
  365. self.toolTipAlignment = uiToolTip.ToolTip()
  366. # self.toolTipAlignment.Hide()
  367.  
  368. self.skillCategoryNameList = [ "ACTIVE_1", "ACTIVE_2", "ACTIVE_3" ]
  369. self.skillPageStartSlotIndexDict = {
  370. "ACTIVE_1" : 1,
  371. "ACTIVE_2" : 21,
  372. "ACTIVE_3" : 41,
  373. }
  374.  
  375. self.selectSkillButtonList = []
  376.  
  377. self.lastUpdateQuickSlot = 0
  378. self.SetWindowName("TaskBar")
  379. self.LoadWindow()
  380.  
  381.  
  382. def __del__(self):
  383. #print "---------------------------------------------------------------------------- DELETE TASKBAR"
  384. ui.ScriptWindow.__del__(self)
  385.  
  386. def LoadWindow(self):
  387. try:
  388. pyScrLoader = ui.PythonScriptLoader()
  389.  
  390. pyScrLoader.LoadScriptFile(self, "uiscript/TaskBar.py")
  391. pyScrLoader.LoadScriptFile(self.TaskBarLeft, "UIScript/TaskBar_left.py")
  392. pyScrLoader.LoadScriptFile(self.TaskBarLeft2, "UIScript/TaskBar_left2.py")
  393. pyScrLoader.LoadScriptFile(self.mouseModeButtonList[self.MOUSE_BUTTON_LEFT], "UIScript/MouseButtonWindow.py")
  394. pyScrLoader.LoadScriptFile(self.mouseModeButtonList[self.MOUSE_BUTTON_RIGHT], "UIScript/RightMouseButtonWindow.py")
  395. except:
  396. import exception
  397. exception.Abort("TaskBar.LoadWindow.LoadObject")
  398.  
  399. self.quickslot = []
  400. self.quickslot.append(self.GetChild("quick_slot_1"))
  401. self.quickslot.append(self.GetChild("quick_slot_2"))
  402. for slot in self.quickslot:
  403. slot.SetSlotStyle(wndMgr.SLOT_STYLE_NONE)
  404. slot.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptyQuickSlot))
  405. slot.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemQuickSlot))
  406. slot.SetUnselectItemSlotEvent(ui.__mem_func__(self.UnselectItemQuickSlot))
  407. slot.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  408. slot.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  409.  
  410. toggleButtonDict = {}
  411. toggleButtonDict[TaskBar.BUTTON_CHARACTER]=self.TaskBarLeft.GetChild("CharacterButton")
  412. toggleButtonDict[TaskBar.BUTTON_VECTORS]=self.GetChild("VectorsEfsunButton")
  413. toggleButtonDict[TaskBar.BUTTON_HORSEQUICK]=self.GetChild("button_horse")
  414. toggleButtonDict[TaskBar.BUTTON_HZL]=self.GetChild("VectorsHzl")
  415. toggleButtonDict[TaskBar.BUTTON_DARKMMO]=self.GetChild("DarkmmoBalikButton")
  416. toggleButtonDict[TaskBar.BUTTON_INVENTORY]=self.TaskBarLeft2.GetChild("InventoryButton")
  417. toggleButtonDict[TaskBar.BUTTON_MESSENGER]=self.TaskBarLeft2.GetChild("MessengerButton")
  418. toggleButtonDict[TaskBar.BUTTON_SYSTEM]=self.TaskBarLeft2.GetChild("SystemButton")
  419.  
  420.  
  421. try:
  422. toggleButtonDict[TaskBar.BUTTON_CHAT]=self.GetChild("ChatButton")
  423. except:
  424. toggleButtonDict[TaskBar.BUTTON_EXPAND]=self.GetChild("ExpandButton")
  425. TaskBar.IS_EXPANDED = TRUE
  426.  
  427.  
  428. if localeInfo.IsARABIC():
  429. systemButton = toggleButtonDict[TaskBar.BUTTON_SYSTEM]
  430. if systemButton.ToolTipText:
  431. tx, ty = systemButton.ToolTipText.GetLocalPosition()
  432. tw = systemButton.ToolTipText.GetWidth()
  433. systemButton.ToolTipText.SetPosition(-tw/2, ty)
  434.  
  435.  
  436. race = net.GetMainActorRace()
  437. self.img = ui.ImageBox()
  438. self.img.SetParent(self.TaskBarLeft.GetChild("MiniMapWindow2"))
  439. self.img.SetPosition(39,0)
  440. self.img.LoadImage(FACE_IMAGE_DICT[race])
  441. self.img.Show()
  442.  
  443. self.quickPageNumImageBox=self.GetChild("QuickPageNumber")
  444.  
  445.  
  446.  
  447.  
  448. # self.GetChild("QuickPageUpButton").SetEvent(ui.__mem_func__(self.__OnClickQuickPageUpButton))
  449. self.GetChild("QuickPageDownButton").SetEvent(ui.__mem_func__(self.__OnClickQuickPageDownButton))
  450.  
  451. mouseLeftButtonModeButton = self.GetChild("LeftMouseButton")
  452. mouseRightButtonModeButton = self.GetChild("RightMouseButton")
  453. mouseLeftButtonModeButton.SetEvent(ui.__mem_func__(self.ToggleLeftMouseButtonModeWindow))
  454. mouseRightButtonModeButton.SetEvent(ui.__mem_func__(self.ToggleRightMouseButtonModeWindow))
  455. self.curMouseModeButton = [ mouseLeftButtonModeButton, mouseRightButtonModeButton ]
  456.  
  457. (xLocalRight, yLocalRight) = mouseRightButtonModeButton.GetLocalPosition()
  458. self.curSkillButton = self.SkillButton()
  459. self.curSkillButton.SetParent(self)
  460. self.curSkillButton.SetPosition(xLocalRight, 3)
  461. self.curSkillButton.SetSkillEvent(ui.__mem_func__(self.ToggleRightMouseButtonModeWindow))
  462. self.curSkillButton.Hide()
  463.  
  464. (xLeft, yLeft) = mouseLeftButtonModeButton.GetGlobalPosition()
  465. (xRight, yRight) = mouseRightButtonModeButton.GetGlobalPosition()
  466. leftModeButtonList = self.mouseModeButtonList[self.MOUSE_BUTTON_LEFT]
  467. leftModeButtonList.SetPosition(xLeft, yLeft - leftModeButtonList.GetHeight()-5)
  468. rightModeButtonList = self.mouseModeButtonList[self.MOUSE_BUTTON_RIGHT]
  469. rightModeButtonList.SetPosition(xRight - rightModeButtonList.GetWidth() + 32, yRight - rightModeButtonList.GetHeight()-5)
  470. rightModeButtonList.GetChild("button_skill").SetEvent(lambda adir=self.MOUSE_BUTTON_RIGHT, aevent=self.EVENT_SKILL: self.SelectMouseButtonEvent(adir, aevent))
  471. rightModeButtonList.GetChild("button_skill").Hide()
  472.  
  473. mouseImage = ui.ImageBox("TOP_MOST")
  474. mouseImage.AddFlag("float")
  475. mouseImage.LoadImage("d:/ymir work/ui/game/taskbar/mouse_button_camera_01.sub")
  476. mouseImage.SetPosition(xRight, wndMgr.GetScreenHeight() - 34)
  477. mouseImage.Hide()
  478. self.mouseImage = mouseImage
  479.  
  480. dir = self.MOUSE_BUTTON_LEFT
  481. wnd = self.mouseModeButtonList[dir]
  482. wnd.GetChild("button_move_and_attack").SetEvent(lambda adir=dir, aevent=self.EVENT_MOVE_AND_ATTACK: self.SelectMouseButtonEvent(adir, aevent))
  483. wnd.GetChild("button_auto_attack").SetEvent(lambda adir=dir, aevent=self.EVENT_AUTO: self.SelectMouseButtonEvent(adir, aevent))
  484. wnd.GetChild("button_camera").SetEvent(lambda adir=dir, aevent=self.EVENT_CAMERA: self.SelectMouseButtonEvent(adir, aevent))
  485.  
  486. dir = self.MOUSE_BUTTON_RIGHT
  487. wnd = self.mouseModeButtonList[dir]
  488. wnd.GetChild("button_move_and_attack").SetEvent(lambda adir=dir, aevent=self.EVENT_MOVE_AND_ATTACK: self.SelectMouseButtonEvent(adir, aevent))
  489. wnd.GetChild("button_camera").SetEvent(lambda adir=dir, aevent=self.EVENT_CAMERA: self.SelectMouseButtonEvent(adir, aevent))
  490.  
  491. self.HpEmpty = ExpandedImageBox()
  492. self.HpEmpty.AddFlag("not_pick")
  493. self.HpEmpty.SetParent(self.TaskBarLeft.GetChild("Window1"))
  494. self.HpEmpty.SetPosition(-24, 42)
  495. self.HpEmpty.LoadImage("d:/ymir work/interface/taskbar/gauge_hp/gauge_hp_empty.tga")
  496. self.HpEmpty.Show()
  497. self.HpRefresh = []
  498. for i in xrange(0,6):
  499. part = ExpandedImageBox()
  500. part.AddFlag("not_pick")
  501. part.LoadImage("d:/ymir work/interface/taskbar/gauge_hp/gauge_hp_fill_0"+ str(i+1)+".tga")
  502. part.SetAlpha(0.3)
  503. part.SetParent(self.TaskBarLeft.GetChild("Window1"))
  504. part.SetPosition(-24, 42)
  505. part.Show()
  506. self.HpRefresh.append(part)
  507. part = ExpandedImageBox()
  508. part.AddFlag("not_pick")
  509. part.LoadImage("d:/ymir work/interface/taskbar/gauge_hp/gauge_hp_transition.tga")
  510. part.SetAlpha(0.3)
  511. part.SetParent(self.TaskBarLeft.GetChild("Window1"))
  512. part.SetPosition(-24, 42)
  513. part.Show()
  514. self.HpRefresh.append(part)
  515.  
  516. self.HpFull = []
  517. for i in xrange(0,6):
  518. part = ExpandedImageBox()
  519. part.AddFlag("not_pick")
  520. part.LoadImage("d:/ymir work/interface/taskbar/gauge_hp/gauge_hp_fill_0"+ str(i+1)+".tga")
  521. part.SetParent(self.TaskBarLeft.GetChild("Window1"))
  522. part.SetPosition(-24, 42)
  523. part.Show()
  524. self.HpFull.append(part)
  525. part = ExpandedImageBox()
  526. part.AddFlag("not_pick")
  527. part.LoadImage("d:/ymir work/interface/taskbar/gauge_hp/gauge_hp_transition.tga")
  528. part.SetParent(self.TaskBarLeft.GetChild("Window1"))
  529. part.SetPosition(-24, 42)
  530. part.Show()
  531. self.HpFull.append(part)
  532.  
  533. self.MpEmpty = ExpandedImageBox()
  534. self.MpEmpty.AddFlag("not_pick")
  535. self.MpEmpty.SetParent(self.TaskBarLeft.GetChild("Window1"))
  536. self.MpEmpty.SetPosition(-23, 42)
  537. self.MpEmpty.LoadImage("d:/ymir work/interface/taskbar/gauge_mp/gauge_mp_empty.tga")
  538. self.MpEmpty.Show()
  539.  
  540.  
  541. self.MpRefresh = []
  542. for i in xrange(0,77):
  543. part = ExpandedImageBox()
  544. part.AddFlag("not_pick")
  545. s = str(i)
  546. if(i < 10):
  547. s = "0"+s
  548. part.LoadImage("d:/ymir work/interface/taskbar/gauge_mp/gauge_mp_fill_"+ s+".tga")
  549. part.SetParent(self.TaskBarLeft.GetChild("Window1"))
  550. part.SetPosition(30, 95)
  551. part.SetAlpha(0.3)
  552. part.Hide()
  553. self.MpRefresh.append(part)
  554.  
  555. self.MpFull = []
  556. for i in xrange(0,77):
  557. part = ExpandedImageBox()
  558. part.AddFlag("not_pick")
  559. s = str(i)
  560. if(i < 10):
  561. s = "0"+s
  562. part.LoadImage("d:/ymir work/interface/taskbar/gauge_mp/gauge_mp_fill_"+ s+".tga")
  563. part.SetParent(self.TaskBarLeft.GetChild("Window1"))
  564. part.SetPosition(30, 95)
  565. part.Show()
  566. self.MpFull.append(part)
  567.  
  568. self.toggleButtonDict = toggleButtonDict
  569. self.TaskBarLeft.GetChild("ItemShopButton").SetEvent(self.OpenIShopWindow)
  570. self.expGauge = self.TaskBarLeft.GetChild("EXPGauge_01")
  571. self.TaskBarLeft.Show()
  572. self.TaskBarLeft2.Show()
  573.  
  574. u = 0
  575. for i in xrange(2):
  576. self.text[i] = ui.TextLine()
  577. self.text[i].SetParent(self.TaskBarLeft.GetChild("MiniMapWindow2"))
  578. self.text[i].SetPosition(136,47+u)
  579. if i == 0:
  580. self.text[i].SetPackedFontColor(0xffa33437)
  581. else:
  582. self.text[i].SetPackedFontColor(0xff3453a3)
  583. self.text[i].Show()
  584. u += 15
  585.  
  586. self.__LoadMouseSettings()
  587. self.RefreshStatus()
  588. self.RefreshQuickSlot()
  589.  
  590. def __LoadMouseSettings(self):
  591. try:
  592. LoadMouseButtonSettings()
  593. (mouseLeftButtonEvent, mouseRightButtonEvent) = GetMouseButtonSettings()
  594. if not self.__IsInSafeMouseButtonSettingRange(mouseLeftButtonEvent) or not self.__IsInSafeMouseButtonSettingRange(mouseRightButtonEvent):
  595. raise RuntimeError, "INVALID_MOUSE_BUTTON_SETTINGS"
  596. except:
  597. InitMouseButtonSettings(self.EVENT_MOVE_AND_ATTACK, self.EVENT_CAMERA)
  598. (mouseLeftButtonEvent, mouseRightButtonEvent) = GetMouseButtonSettings()
  599.  
  600. try:
  601. self.SelectMouseButtonEvent(self.MOUSE_BUTTON_LEFT, mouseLeftButtonEvent)
  602. self.SelectMouseButtonEvent(self.MOUSE_BUTTON_RIGHT, mouseRightButtonEvent)
  603. except:
  604. InitMouseButtonSettings(self.EVENT_MOVE_AND_ATTACK, self.EVENT_CAMERA)
  605. (mouseLeftButtonEvent, mouseRightButtonEvent) = GetMouseButtonSettings()
  606.  
  607. self.SelectMouseButtonEvent(self.MOUSE_BUTTON_LEFT, mouseLeftButtonEvent)
  608. self.SelectMouseButtonEvent(self.MOUSE_BUTTON_RIGHT, mouseRightButtonEvent)
  609.  
  610.  
  611.  
  612. def __IsInSafeMouseButtonSettingRange(self, arg):
  613. return arg >= self.EVENT_MOVE and arg <= self.EVENT_AUTO
  614.  
  615. def Destroy(self):
  616. SaveMouseButtonSettings()
  617.  
  618. self.ClearDictionary()
  619. self.TaskBarLeft.ClearDictionary()
  620. self.TaskBarLeft2.ClearDictionary()
  621.  
  622. self.mouseModeButtonList[0].ClearDictionary()
  623. self.mouseModeButtonList[1].ClearDictionary()
  624. self.TaskBarLeft = 0
  625. self.TaskBarLeft2 = 0
  626. self.mouseModeButtonList = 0
  627. self.curMouseModeButton = 0
  628. self.curSkillButton = 0
  629. self.selectSkillButtonList = 0
  630.  
  631. self.img = None
  632. self.expGauge = None
  633. self.hpGauge = None
  634. self.mpGauge = None
  635. self.hpRecoveryGaugeBar = None
  636. self.spRecoveryGaugeBar = None
  637.  
  638. self.tooltipItem = 0
  639. self.tooltipSkill = 0
  640. self.quickslot = 0
  641. self.toggleButtonDict = 0
  642.  
  643. self.tooltipHP = 0
  644. self.tooltipSP = 0
  645. self.tooltipST = 0
  646. self.tooltipEXP = 0
  647. self.toolTipAlignment = 0
  648.  
  649. self.mouseImage = None
  650.  
  651. def OpenIShopWindow(self):
  652. net.SendChatPacket("/in_game_mall")
  653.  
  654. def __OnClickQuickPageDownButton(self):
  655. player.SetQuickPage(player.GetQuickPage()+1)
  656.  
  657. def SetToggleButtonEvent(self, eButton, kEventFunc):
  658. self.toggleButtonDict[eButton].SetEvent(kEventFunc)
  659.  
  660. def SetItemToolTip(self, tooltipItem):
  661. self.tooltipItem = tooltipItem
  662.  
  663. def SetSkillToolTip(self, tooltipSkill):
  664. self.tooltipSkill = tooltipSkill
  665. self.curSkillButton.SetSkillToolTip(self.tooltipSkill)
  666.  
  667. ## Mouse Image
  668. def ShowMouseImage(self):
  669. self.mouseImage.SetTop()
  670. self.mouseImage.Show()
  671.  
  672. def HideMouseImage(self):
  673. player.SetQuickCameraMode(FALSE)
  674. self.mouseImage.Hide()
  675.  
  676. ## Gauge
  677. def RefreshStatus(self):
  678. curHP = player.GetStatus(player.HP)
  679. maxHP = player.GetStatus(player.MAX_HP)
  680. curSP = player.GetStatus(player.SP)
  681. maxSP = player.GetStatus(player.MAX_SP)
  682. curEXP = unsigned32(player.GetStatus(player.EXP))
  683. nextEXP = unsigned32(player.GetStatus(player.NEXT_EXP))
  684. recoveryHP = player.GetStatus(player.HP_RECOVERY)
  685. recoverySP = player.GetStatus(player.SP_RECOVERY)
  686.  
  687. self.RefreshStamina()
  688. self.SetExperience(curEXP, nextEXP)
  689.  
  690. def RefreshStamina(self):
  691. curST = player.GetStatus(player.STAMINA)
  692. maxST = player.GetStatus(player.MAX_STAMINA)
  693. # self.SetST(curST, maxST)
  694.  
  695. def RefreshSkill(self):
  696. self.curSkillButton.RefreshSkill()
  697. for button in self.selectSkillButtonList:
  698. button.RefreshSkill()
  699.  
  700. def SetHp(self, _actual,_recovery, _max):
  701. _max = max(1, _max)
  702. trans_actual = 270 * (1.0-(float(_actual) / float(_max)))
  703. trans_recovery = 270 * (1.0-(float(_recovery) / float(_max)))
  704. for i in xrange(0,7):
  705. i2 =i
  706. if(i == 6):
  707. i2 = 0
  708. max_transition = 270.0 - float(i2)*45.0
  709. trans = -min(max_transition, trans_actual)
  710. trans_rec = -min(max_transition, trans_recovery)
  711. self.HpFull[i].SetRotation(trans)
  712. self.HpRefresh[i].SetRotation(trans_rec)
  713. def SetMp(self, _actual, _recovery, _max):
  714. max_show = 76 -int(76.0 * float(_actual)/ float(_max))
  715. max_rec = 76 -int(76.0 * float(_recovery)/ float(_max))
  716. for i in xrange(0,77):
  717. self.MpFull[i].Hide()
  718. self.MpRefresh[i].Hide()
  719. self.MpRefresh[max_rec].Show()
  720. self.MpFull[max_show].Show()
  721.  
  722. def SetExperience(self, curPoint, maxPoint):
  723. curPoint = min(curPoint, maxPoint)
  724. if maxPoint > 0:
  725. self.expGauge.SetPercentage(curPoint, maxPoint)
  726. self.tooltipEXP.SetText("%s : %.2f%%" % (localeInfo.TASKBAR_EXP, float(curPoint) / max(1, float(maxPoint)) * 100))
  727.  
  728.  
  729. ## QuickSlot
  730. def RefreshQuickSlot(self):
  731.  
  732. pageNum = player.GetQuickPage()
  733.  
  734. try:
  735. self.quickPageNumImageBox.LoadImage(TaskBar.QUICKPAGE_NUMBER_FILENAME[pageNum])
  736. except:
  737. pass
  738.  
  739. startNumber = 0
  740. for slot in self.quickslot:
  741.  
  742. for i in xrange(4):
  743.  
  744. slotNumber = i+startNumber
  745.  
  746. (Type, Position) = player.GetLocalQuickSlot(slotNumber)
  747.  
  748. if player.SLOT_TYPE_NONE == Type:
  749. slot.ClearSlot(slotNumber)
  750. continue
  751.  
  752. if player.SLOT_TYPE_INVENTORY == Type:
  753.  
  754. itemIndex = player.GetItemIndex(Position)
  755. itemCount = player.GetItemCount(Position)
  756. if itemCount <= 1:
  757. itemCount = 0
  758.  
  759.  
  760. if constInfo.IS_AUTO_POTION(itemIndex):
  761.  
  762. metinSocket = [player.GetItemMetinSocket(Position, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
  763.  
  764. if 0 != int(metinSocket[0]):
  765. slot.ActivateSlot(slotNumber)
  766. else:
  767. slot.DeactivateSlot(slotNumber)
  768.  
  769. slot.SetItemSlot(slotNumber, itemIndex, itemCount)
  770.  
  771. elif player.SLOT_TYPE_SKILL == Type:
  772.  
  773. skillIndex = player.GetSkillIndex(Position)
  774. if 0 == skillIndex:
  775. slot.ClearSlot(slotNumber)
  776. continue
  777.  
  778. skillType = skill.GetSkillType(skillIndex)
  779. if skill.SKILL_TYPE_GUILD == skillType:
  780. import guild
  781. skillGrade = 0
  782. skillLevel = guild.GetSkillLevel(Position)
  783.  
  784. else:
  785. skillGrade = player.GetSkillGrade(Position)
  786. skillLevel = player.GetSkillLevel(Position)
  787.  
  788. slot.SetSkillSlotNew(slotNumber, skillIndex, skillGrade, skillLevel)
  789. slot.SetSlotCountNew(slotNumber, skillGrade, skillLevel)
  790. slot.SetCoverButton(slotNumber)
  791.  
  792.  
  793. if player.IsSkillCoolTime(Position):
  794. (coolTime, elapsedTime) = player.GetSkillCoolTime(Position)
  795. slot.SetSlotCoolTime(slotNumber, coolTime, elapsedTime)
  796.  
  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.  
  965. def OnUpdate(self):
  966. self.text[0].SetText(str(player.GetStatus(player.HP)))
  967. self.text[1].SetText(str(player.GetStatus(player.SP)))
  968.  
  969. curHP = player.GetStatus(player.HP)
  970. maxHP = player.GetStatus(player.MAX_HP)
  971. curSP = player.GetStatus(player.SP)
  972. maxSP = player.GetStatus(player.MAX_SP)
  973. recoveryHP = player.GetStatus(player.HP_RECOVERY)
  974. recoverySP = player.GetStatus(player.SP_RECOVERY)
  975. self.SetHp(curHP, recoveryHP, maxHP)
  976. self.SetMp(curSP, recoverySP, maxSP)
  977.  
  978.  
  979. if app.GetGlobalTime() - self.lastUpdateQuickSlot > 500:
  980. self.lastUpdateQuickSlot = app.GetGlobalTime()
  981. self.RefreshQuickSlot()
  982.  
  983. if TRUE == self.expGauge.IsIn():
  984. self.tooltipEXP.Show()
  985. self.tooltipEXP.SetTop()
  986. else:
  987. self.tooltipEXP.Hide()
  988.  
  989. if TRUE == self.img.IsIn():
  990. point, grade = player.GetAlignmentData()
  991.  
  992. import colorInfo
  993. COLOR_DICT = { 0 : colorInfo.TITLE_RGB_GOOD_4,
  994. 1 : colorInfo.TITLE_RGB_GOOD_3,
  995. 2 : colorInfo.TITLE_RGB_GOOD_2,
  996. 3 : colorInfo.TITLE_RGB_GOOD_1,
  997. 4 : colorInfo.TITLE_RGB_NORMAL,
  998. 5 : colorInfo.TITLE_RGB_EVIL_1,
  999. 6 : colorInfo.TITLE_RGB_EVIL_2,
  1000. 7 : colorInfo.TITLE_RGB_EVIL_3,
  1001. 8 : colorInfo.TITLE_RGB_EVIL_4, }
  1002. colorList = COLOR_DICT.get(grade, colorInfo.TITLE_RGB_NORMAL)
  1003. gradeColor = ui.GenerateColor(colorList[0], colorList[1], colorList[2])
  1004.  
  1005. self.toolTipAlignment.ClearToolTip()
  1006. self.toolTipAlignment.AutoAppendTextLine(localeInfo.TITLE_NAME_LIST[grade], gradeColor)
  1007. self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGNMENT_NAME + str(point))
  1008. self.toolTipAlignment.AlignHorizonalCenter()
  1009. self.toolTipAlignment.ShowToolTip()
  1010. else:
  1011. self.toolTipAlignment.HideToolTip()
  1012.  
  1013. ## Skill
  1014. def ToggleLeftMouseButtonModeWindow(self):
  1015.  
  1016. wndMouseButtonMode = self.mouseModeButtonList[self.MOUSE_BUTTON_LEFT]
  1017.  
  1018. if TRUE == wndMouseButtonMode.IsShow():
  1019.  
  1020. wndMouseButtonMode.Hide()
  1021.  
  1022. else:
  1023. wndMouseButtonMode.Show()
  1024.  
  1025. def ToggleRightMouseButtonModeWindow(self):
  1026.  
  1027. wndMouseButtonMode = self.mouseModeButtonList[self.MOUSE_BUTTON_RIGHT]
  1028.  
  1029. if TRUE == wndMouseButtonMode.IsShow():
  1030.  
  1031. wndMouseButtonMode.Hide()
  1032. self.CloseSelectSkill()
  1033.  
  1034. else:
  1035. wndMouseButtonMode.Show()
  1036. self.OpenSelectSkill()
  1037.  
  1038. def OpenSelectSkill(self):
  1039.  
  1040. PAGE_SLOT_COUNT = 6
  1041.  
  1042. (xSkillButton, y) = self.curSkillButton.GetGlobalPosition()
  1043. y -= (37 + 32 + 1)
  1044.  
  1045. for key in self.skillCategoryNameList:
  1046.  
  1047. appendCount = 0
  1048. startNumber = self.skillPageStartSlotIndexDict[key]
  1049. x = xSkillButton
  1050.  
  1051. getSkillIndex=player.GetSkillIndex
  1052. getSkillLevel=player.GetSkillLevel
  1053. for i in xrange(PAGE_SLOT_COUNT):
  1054.  
  1055. skillIndex = getSkillIndex(startNumber+i)
  1056. skillLevel = getSkillLevel(startNumber+i)
  1057.  
  1058. if 0 == skillIndex:
  1059. continue
  1060. if 0 == skillLevel:
  1061. continue
  1062. if skill.IsStandingSkill(skillIndex):
  1063. continue
  1064.  
  1065.  
  1066. skillButton = self.SkillButton()
  1067. skillButton.SetSkill(startNumber+i)
  1068. skillButton.SetPosition(x, y)
  1069. skillButton.SetSkillEvent(ui.__mem_func__(self.CloseSelectSkill), startNumber+i+1)
  1070. skillButton.SetSkillToolTip(self.tooltipSkill)
  1071. skillButton.SetTop()
  1072. skillButton.Show()
  1073. self.selectSkillButtonList.append(skillButton)
  1074.  
  1075. appendCount += 1
  1076. x -= 32
  1077.  
  1078. if appendCount > 0:
  1079. y -= 32
  1080.  
  1081. def CloseSelectSkill(self, slotIndex=-1):
  1082.  
  1083. self.mouseModeButtonList[self.MOUSE_BUTTON_RIGHT].Hide()
  1084. for button in self.selectSkillButtonList:
  1085. button.Destroy()
  1086.  
  1087. self.selectSkillButtonList = []
  1088.  
  1089. if -1 != slotIndex:
  1090. self.curSkillButton.Show()
  1091. self.curMouseModeButton[self.MOUSE_BUTTON_RIGHT].Hide()
  1092. player.SetMouseFunc(player.MBT_RIGHT, player.MBF_SKILL)
  1093. player.ChangeCurrentSkillNumberOnly(slotIndex-1)
  1094. else:
  1095. self.curSkillButton.Hide()
  1096. self.curMouseModeButton[self.MOUSE_BUTTON_RIGHT].Show()
  1097.  
  1098. def SelectMouseButtonEvent(self, dir, event):
  1099. SetMouseButtonSetting(dir, event)
  1100.  
  1101. self.CloseSelectSkill()
  1102. self.mouseModeButtonList[dir].Hide()
  1103.  
  1104. btn = 0
  1105. type = self.NONE
  1106. func = self.NONE
  1107. tooltip_text = ""
  1108.  
  1109. if self.MOUSE_BUTTON_LEFT == dir:
  1110. type = player.MBT_LEFT
  1111.  
  1112. elif self.MOUSE_BUTTON_RIGHT == dir:
  1113. type = player.MBT_RIGHT
  1114.  
  1115. if self.EVENT_MOVE == event:
  1116. btn = self.mouseModeButtonList[dir].GetChild("button_move")
  1117. func = player.MBF_MOVE
  1118. tooltip_text = localeInfo.TASKBAR_MOVE
  1119. elif self.EVENT_ATTACK == event:
  1120. btn = self.mouseModeButtonList[dir].GetChild("button_attack")
  1121. func = player.MBF_ATTACK
  1122. tooltip_text = localeInfo.TASKBAR_ATTACK
  1123. elif self.EVENT_AUTO == event:
  1124. btn = self.mouseModeButtonList[dir].GetChild("button_auto_attack")
  1125. func = player.MBF_AUTO
  1126. tooltip_text = localeInfo.TASKBAR_AUTO
  1127. elif self.EVENT_MOVE_AND_ATTACK == event:
  1128. btn = self.mouseModeButtonList[dir].GetChild("button_move_and_attack")
  1129. func = player.MBF_SMART
  1130. tooltip_text = localeInfo.TASKBAR_ATTACK
  1131. elif self.EVENT_CAMERA == event:
  1132. btn = self.mouseModeButtonList[dir].GetChild("button_camera")
  1133. func = player.MBF_CAMERA
  1134. tooltip_text = localeInfo.TASKBAR_CAMERA
  1135. elif self.EVENT_SKILL == event:
  1136. btn = self.mouseModeButtonList[dir].GetChild("button_skill")
  1137. func = player.MBF_SKILL
  1138. tooltip_text = localeInfo.TASKBAR_SKILL
  1139.  
  1140. if 0 != btn:
  1141. self.curMouseModeButton[dir].SetToolTipText(tooltip_text, 0, -18)
  1142. self.curMouseModeButton[dir].SetUpVisual(btn.GetUpVisualFileName())
  1143. self.curMouseModeButton[dir].SetOverVisual(btn.GetOverVisualFileName())
  1144. self.curMouseModeButton[dir].SetDownVisual(btn.GetDownVisualFileName())
  1145. self.curMouseModeButton[dir].Show()
  1146.  
  1147. player.SetMouseFunc(type, func)
  1148.  
  1149. def OnChangeCurrentSkill(self, skillSlotNumber):
  1150. self.curSkillButton.SetSkill(skillSlotNumber)
  1151. self.curSkillButton.Show()
  1152. self.curMouseModeButton[self.MOUSE_BUTTON_RIGHT].Hide()
  1153.  
  1154. # a=TaskBar()
  1155. # a.Show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement