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