Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 41.50 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.  
  15. MOUSE_SETTINGS = [0, 0]
  16.  
  17. FACE_IMAGE_DICT = {
  18. playerSettingModule.RACE_WARRIOR_M : "d:/ymir work/interface/illumina/faces_taskbar/icon_mwarrior.tga",
  19. playerSettingModule.RACE_WARRIOR_W : "d:/ymir work/interface/illumina/faces_taskbar/icon_wwarrior.tga",
  20. playerSettingModule.RACE_ASSASSIN_M : "d:/ymir work/interface/illumina/faces_taskbar/icon_mninja.tga",
  21. playerSettingModule.RACE_ASSASSIN_W : "d:/ymir work/interface/illumina/faces_taskbar/icon_wninja.tga",
  22. playerSettingModule.RACE_SURA_M : "d:/ymir work/interface/illumina/faces_taskbar/icon_msura.tga",
  23. playerSettingModule.RACE_SURA_W : "d:/ymir work/interface/illumina/faces_taskbar/icon_wsura.tga",
  24. playerSettingModule.RACE_SHAMAN_M : "d:/ymir work/interface/illumina/faces_taskbar/icon_mshaman.tga",
  25. playerSettingModule.RACE_SHAMAN_W : "d:/ymir work/interface/illumina/faces_taskbar/icon_wshaman.tga",
  26. }
  27.  
  28. def InitMouseButtonSettings(left, right):
  29. global MOUSE_SETTINGS
  30. MOUSE_SETTINGS = [left, right]
  31.  
  32. def SetMouseButtonSetting(dir, event):
  33. global MOUSE_SETTINGS
  34. MOUSE_SETTINGS[dir] = event
  35.  
  36. def GetMouseButtonSettings():
  37. global MOUSE_SETTINGS
  38. return MOUSE_SETTINGS
  39.  
  40. def SaveMouseButtonSettings():
  41. global MOUSE_SETTINGS
  42. open("mouse.cfg", "w").write("%s\t%s" % tuple(MOUSE_SETTINGS))
  43.  
  44. def LoadMouseButtonSettings():
  45. global MOUSE_SETTINGS
  46. tokens = open("mouse.cfg", "r").read().split()
  47.  
  48. if len(tokens) != 2:
  49. raise RuntimeError, "MOUSE_SETTINGS_FILE_ERROR"
  50.  
  51. MOUSE_SETTINGS[0] = int(tokens[0])
  52. MOUSE_SETTINGS[1] = int(tokens[1])
  53.  
  54. def unsigned32(n):
  55. return n & 0xFFFFFFFFL
  56.  
  57. class AtlasWindow(ui.ScriptWindow):
  58.  
  59. class AtlasRenderer(ui.Window):
  60. def __init__(self):
  61. ui.Window.__init__(self)
  62. self.AddFlag("not_pick")
  63.  
  64. def OnUpdate(self):
  65. miniMap.UpdateAtlas()
  66.  
  67. def OnRender(self):
  68. (x, y) = self.GetGlobalPosition()
  69. fx = float(x)
  70. fy = float(y)
  71. miniMap.RenderAtlas(fx, fy)
  72.  
  73. def HideAtlas(self):
  74. miniMap.HideAtlas()
  75.  
  76. def ShowAtlas(self):
  77. miniMap.ShowAtlas()
  78.  
  79. def __init__(self):
  80. self.tooltipInfo = MapTextToolTip()
  81. self.tooltipInfo.Hide()
  82. self.infoGuildMark = ui.MarkBox()
  83. self.infoGuildMark.Hide()
  84. self.AtlasMainWindow = None
  85. self.mapName = ""
  86. self.board = 0
  87.  
  88. ui.ScriptWindow.__init__(self)
  89.  
  90. def __del__(self):
  91. ui.ScriptWindow.__del__(self)
  92.  
  93. def SetMapName(self, mapName):
  94. if 949==app.GetDefaultCodePage():
  95. try:
  96. self.board.SetTitleName(localeInfo.MINIMAP_ZONE_NAME_DICT[mapName])
  97. except:
  98. pass
  99.  
  100. def LoadWindow(self):
  101. try:
  102. pyScrLoader = ui.PythonScriptLoader()
  103. pyScrLoader.LoadScriptFile(self, "UIScript/AtlasWindow.py")
  104. except:
  105. import exception
  106. exception.Abort("AtlasWindow.LoadWindow.LoadScript")
  107.  
  108. try:
  109. self.board = self.GetChild("board")
  110.  
  111. except:
  112. import exception
  113. exception.Abort("AtlasWindow.LoadWindow.BindObject")
  114.  
  115. self.AtlasMainWindow = self.AtlasRenderer()
  116. self.board.SetCloseEvent(self.Hide)
  117. self.AtlasMainWindow.SetParent(self.board)
  118. self.AtlasMainWindow.SetPosition(12, 35)
  119. self.tooltipInfo.SetParent(self.board)
  120. self.infoGuildMark.SetParent(self.board)
  121. self.SetPosition(wndMgr.GetScreenWidth() - 136 - 256 - 10, 0)
  122. self.Hide()
  123.  
  124. miniMap.RegisterAtlasWindow(self)
  125.  
  126. def Destroy(self):
  127. miniMap.UnregisterAtlasWindow()
  128. self.ClearDictionary()
  129. self.AtlasMainWindow = None
  130. self.tooltipAtlasClose = 0
  131. self.tooltipInfo = None
  132. self.infoGuildMark = None
  133. self.board = None
  134.  
  135. def OnUpdate(self):
  136.  
  137. if not self.tooltipInfo:
  138. return
  139.  
  140. if not self.infoGuildMark:
  141. return
  142.  
  143. self.infoGuildMark.Hide()
  144. self.tooltipInfo.Hide()
  145.  
  146. if FALSE == self.board.IsIn():
  147. return
  148.  
  149. (mouseX, mouseY) = wndMgr.GetMousePosition()
  150. (bFind, sName, iPosX, iPosY, dwTextColor, dwGuildID) = miniMap.GetAtlasInfo(mouseX, mouseY)
  151.  
  152. if FALSE == bFind:
  153. return
  154.  
  155. if "empty_guild_area" == sName:
  156. sName = localeInfo.GUILD_EMPTY_AREA
  157.  
  158. if localeInfo.IsARABIC() and sName[-1].isalnum():
  159. self.tooltipInfo.SetText("(%s)%d, %d" % (sName, iPosX, iPosY))
  160. else:
  161. self.tooltipInfo.SetText("%s(%d, %d)" % (sName, iPosX, iPosY))
  162.  
  163. (x, y) = self.GetGlobalPosition()
  164. self.tooltipInfo.SetTooltipPosition(mouseX - x, mouseY - y)
  165. self.tooltipInfo.SetTextColor(dwTextColor)
  166. self.tooltipInfo.Show()
  167. self.tooltipInfo.SetTop()
  168.  
  169. if 0 != dwGuildID:
  170. textWidth, textHeight = self.tooltipInfo.GetTextSize()
  171. self.infoGuildMark.SetIndex(dwGuildID)
  172. self.infoGuildMark.SetPosition(mouseX - x - textWidth - 18 - 5, mouseY - y)
  173. self.infoGuildMark.Show()
  174.  
  175. def Hide(self):
  176. if self.AtlasMainWindow:
  177. self.AtlasMainWindow.HideAtlas()
  178. self.AtlasMainWindow.Hide()
  179. ui.ScriptWindow.Hide(self)
  180.  
  181. def Show(self):
  182. if self.AtlasMainWindow:
  183. (bGet, iSizeX, iSizeY) = miniMap.GetAtlasSize()
  184. if bGet:
  185. self.SetSize(iSizeX + 15, iSizeY + 38)
  186.  
  187. if localeInfo.IsARABIC():
  188. self.board.SetPosition(iSizeX+15, 0)
  189.  
  190. self.board.SetSize(iSizeX + 25, iSizeY + 48)
  191. #self.AtlasMainWindow.SetSize(iSizeX, iSizeY)
  192. self.AtlasMainWindow.ShowAtlas()
  193. self.AtlasMainWindow.Show()
  194. ui.ScriptWindow.Show(self)
  195.  
  196. def SetCenterPositionAdjust(self, x, y):
  197. self.SetPosition((wndMgr.GetScreenWidth() - self.GetWidth()) / 2 + x, (wndMgr.GetScreenHeight() - self.GetHeight()) / 2 + y)
  198.  
  199. def OnPressEscapeKey(self):
  200. self.Hide()
  201. return TRUE
  202.  
  203. class MapTextToolTip(ui.Window):
  204. def __init__(self):
  205. ui.Window.__init__(self,"TOP_MOST")
  206.  
  207. textLine = ui.TextLine()
  208. textLine.SetParent(self)
  209. textLine.SetHorizontalAlignCenter()
  210. textLine.SetOutline()
  211. textLine.SetHorizontalAlignRight()
  212. textLine.Show()
  213. self.textLine = textLine
  214. self.textLine.SetTop()
  215.  
  216. def __del__(self):
  217. ui.Window.__del__(self)
  218.  
  219. def SetText(self, text):
  220. self.textLine.SetText(text)
  221.  
  222. def SetTooltipPosition(self, PosX, PosY):
  223. if localeInfo.IsARABIC():
  224. w, h = self.textLine.GetTextSize()
  225. self.textLine.SetPosition(PosX - w - 5, PosY)
  226. else:
  227. self.textLine.SetPosition(PosX - 5, PosY)
  228.  
  229. def SetTextColor(self, TextColor):
  230. self.textLine.SetPackedFontColor(TextColor)
  231.  
  232. def GetTextSize(self):
  233. return self.textLine.GetTextSize()
  234.  
  235. class GiftBox(ui.ScriptWindow):
  236. class TextToolTip(ui.Window):
  237. def __init__(self):
  238. ui.Window.__init__(self, "TOP_MOST")
  239. self.SetWindowName("GiftBox")
  240. textLine = ui.TextLine()
  241. textLine.SetParent(self)
  242. textLine.SetHorizontalAlignCenter()
  243. textLine.SetOutline()
  244. textLine.Show()
  245. self.textLine = textLine
  246.  
  247. def __del__(self):
  248. ui.Window.__del__(self)
  249.  
  250. def SetText(self, text):
  251. self.textLine.SetText(text)
  252.  
  253. def OnRender(self):
  254. (mouseX, mouseY) = wndMgr.GetMousePosition()
  255. self.textLine.SetPosition(mouseX, mouseY - 15)
  256.  
  257. def __init__(self):
  258. #print "NEW TASKBAR ----------------------------------------------------------------------------"
  259. ui.ScriptWindow.__init__(self)
  260. self.tooltipGift = self.TextToolTip()
  261. self.tooltipGift.Show()
  262.  
  263. def __del__(self):
  264. #print "---------------------------------------------------------------------------- DELETE TASKBAR"
  265. ui.ScriptWindow.__del__(self)
  266.  
  267. def LoadWindow(self):
  268. try:
  269. pyScrLoader = ui.PythonScriptLoader()
  270. pyScrLoader.LoadScriptFile(self, uiScriptLocale.LOCALE_UISCRIPT_PATH + "giftbox.py")
  271. except:
  272. import exception
  273. exception.Abort("GiftBox.LoadWindow.LoadObject")
  274.  
  275. self.giftBoxIcon = self.GetChild("GiftBox_Icon")
  276. self.giftBoxToolTip = self.GetChild("GiftBox_ToolTip")
  277.  
  278. def Destroy(self):
  279. self.giftBoxIcon = 0
  280. self.giftBoxToolTip = 0
  281.  
  282. #-------------------Giftbox End------------------------------
  283.  
  284. class ExpandedTaskBar(ui.ScriptWindow):
  285. BUTTON_DRAGON_SOUL = 0
  286. BUTTON_PET_GUI = 1
  287. def __init__(self):
  288. ui.Window.__init__(self)
  289. self.SetWindowName("ExpandedTaskBar")
  290.  
  291. def LoadWindow(self):
  292. try:
  293. pyScrLoader = ui.PythonScriptLoader()
  294. pyScrLoader.LoadScriptFile(self, uiScriptLocale.LOCALE_UISCRIPT_PATH + "ExpandedTaskBar.py")
  295. except:
  296. import exception
  297. exception.Abort("ExpandedTaskBar.LoadWindow.LoadObject")
  298.  
  299. self.expandedTaskBarBoard = self.GetChild("ExpanedTaskBar_Board")
  300.  
  301. self.toggleButtonDict = {}
  302. self.toggleButtonDict[ExpandedTaskBar.BUTTON_DRAGON_SOUL] = self.GetChild("DragonSoulButton")
  303. self.toggleButtonDict[ExpandedTaskBar.BUTTON_DRAGON_SOUL].SetParent(self)
  304. self.toggleButtonDict[ExpandedTaskBar.BUTTON_PET_GUI] = self.GetChild("PetGuiButton")
  305. self.toggleButtonDict[ExpandedTaskBar.BUTTON_PET_GUI].SetParent(self)
  306.  
  307. def SetTop(self):
  308. super(ExpandedTaskBar, self).SetTop()
  309. for button in self.toggleButtonDict.values():
  310. button.SetTop()
  311.  
  312. def Show(self):
  313. ui.ScriptWindow.Show(self)
  314.  
  315. def Close(self):
  316. self.Hide()
  317.  
  318. def SetToolTipText(self, eButton, text):
  319. self.toggleButtonDict[eButton].SetToolTipText(text)
  320.  
  321. def SetToggleButtonEvent(self, eButton, kEventFunc):
  322. self.toggleButtonDict[eButton].SetEvent(kEventFunc)
  323.  
  324. def OnPressEscapeKey(self):
  325. self.Close()
  326. return TRUE
  327.  
  328. class TaskBar(ui.ScriptWindow):
  329.  
  330. BUTTON_CHARACTER = 0
  331. BUTTON_INVENTORY = 1
  332. BUTTON_MESSENGER = 2
  333. BUTTON_SYSTEM = 3
  334. BUTTON_CHAT = 4
  335. # BUTTON_VECTORS = 5
  336. BUTTON_EXPAND = 4
  337. IS_EXPANDED = FALSE
  338.  
  339. MOUSE_BUTTON_LEFT = 0
  340. MOUSE_BUTTON_RIGHT = 1
  341. NONE = 255
  342.  
  343. EVENT_MOVE = 0
  344. EVENT_ATTACK = 1
  345. EVENT_MOVE_AND_ATTACK = 2
  346. EVENT_CAMERA = 3
  347. EVENT_SKILL = 4
  348. EVENT_AUTO = 5
  349.  
  350. GAUGE_WIDTH = 95
  351. GAUGE_HEIGHT = 13
  352.  
  353. QUICKPAGE_NUMBER_FILENAME = [
  354. "d:/ymir work/interface/illumina/taskbar/numbers/btn_slotpageone_03_active.tga",
  355. "d:/ymir work/interface/illumina/taskbar/numbers/btn_slotpagetwo_03_active.tga",
  356. "d:/ymir work/interface/illumina/taskbar/numbers/btn_slotpagethree_03_active.tga",
  357. "d:/ymir work/interface/illumina/taskbar/numbers/btn_slotpagefour_03_active.tga",
  358. ]
  359.  
  360. #gift icon show and hide
  361. def ShowGift(self):
  362. if not localeInfo.IsBRAZIL():
  363. self.wndGiftBox.Show()
  364.  
  365. def HideGift(self):
  366. self.wndGiftBox.Hide()
  367.  
  368. class TextToolTip(ui.Window):
  369. def __init__(self):
  370. ui.Window.__init__(self, "TOP_MOST")
  371.  
  372. textLine = ui.TextLine()
  373. textLine.SetParent(self)
  374. textLine.SetHorizontalAlignCenter()
  375. textLine.SetOutline()
  376. textLine.Show()
  377. self.textLine = textLine
  378.  
  379. def __del__(self):
  380. ui.Window.__del__(self)
  381.  
  382. def SetText(self, text):
  383. self.textLine.SetText(text)
  384.  
  385. def OnRender(self):
  386. (mouseX, mouseY) = wndMgr.GetMousePosition()
  387. self.textLine.SetPosition(mouseX, mouseY - 15)
  388.  
  389. class SkillButton(ui.SlotWindow):
  390.  
  391. def __init__(self):
  392. ui.SlotWindow.__init__(self)
  393.  
  394. self.event = 0
  395. self.arg = 0
  396.  
  397. self.slotIndex = 0
  398. self.skillIndex = 0
  399.  
  400. slotIndex = 0
  401. wndMgr.SetSlotBaseImage(self.hWnd, "d:/ymir work/ui/public/slot_base.sub", 1.0, 1.0, 1.0, 1.0)
  402. wndMgr.AppendSlot(self.hWnd, slotIndex, 0, 0, 32, 32)
  403. self.SetCoverButton(slotIndex, "d:/ymir work/ui/public/slot_base.sub",\
  404. "d:/ymir work/ui/public/slot_base.sub",\
  405. "d:/ymir work/ui/public/slot_base.sub",\
  406. "d:/ymir work/ui/public/slot_base.sub", TRUE, FALSE)
  407. self.SetSize(32, 32)
  408.  
  409. def __del__(self):
  410. ui.SlotWindow.__del__(self)
  411.  
  412. def Destroy(self):
  413. if 0 != self.tooltipSkill:
  414. self.tooltipSkill.HideToolTip()
  415.  
  416. def RefreshSkill(self):
  417. if 0 != self.slotIndex:
  418. self.SetSkill(self.slotIndex)
  419.  
  420. def SetSkillToolTip(self, tooltip):
  421. self.tooltipSkill = tooltip
  422.  
  423. def SetSkill(self, skillSlotNumber):
  424. slotNumber = 0
  425. skillIndex = player.GetSkillIndex(skillSlotNumber)
  426. skillGrade = player.GetSkillGrade(skillSlotNumber)
  427. skillLevel = player.GetSkillLevel(skillSlotNumber)
  428. skillType = skill.GetSkillType(skillIndex)
  429.  
  430. self.skillIndex = skillIndex
  431. if 0 == self.skillIndex:
  432. self.ClearSlot(slotNumber)
  433. return
  434.  
  435. self.slotIndex = skillSlotNumber
  436.  
  437. self.SetSkillSlotNew(slotNumber, skillIndex, skillGrade, skillLevel)
  438. self.SetSlotCountNew(slotNumber, skillGrade, skillLevel)
  439.  
  440. ## NOTE : CoolTime üũ
  441. if player.IsSkillCoolTime(skillSlotNumber):
  442. (coolTime, elapsedTime) = player.GetSkillCoolTime(skillSlotNumber)
  443. self.SetSlotCoolTime(slotNumber, coolTime, elapsedTime)
  444.  
  445. ## NOTE : Activate µÇ¾î ÀÖ´Ù¸é ¾ÆÀÌÄܵµ ¾÷µ¥ÀÌÆ®
  446. if player.IsSkillActive(skillSlotNumber):
  447. self.ActivateSlot(slotNumber)
  448.  
  449. def SetSkillEvent(self, event, arg=0):
  450. self.event = event
  451. self.arg = arg
  452.  
  453. def GetSkillIndex(self):
  454. return self.skillIndex
  455.  
  456. def GetSlotIndex(self):
  457. return self.slotIndex
  458.  
  459. def Activate(self, coolTime):
  460. self.SetSlotCoolTime(0, coolTime)
  461.  
  462. if skill.IsToggleSkill(self.skillIndex):
  463. self.ActivateSlot(0)
  464.  
  465. def Deactivate(self):
  466. if skill.IsToggleSkill(self.skillIndex):
  467. self.DeactivateSlot(0)
  468.  
  469. def OnOverInItem(self, dummy):
  470. self.tooltipSkill.SetSkill(self.skillIndex)
  471.  
  472. def OnOverOutItem(self):
  473. self.tooltipSkill.HideToolTip()
  474.  
  475. def OnSelectItemSlot(self, dummy):
  476. if 0 != self.event:
  477. if 0 != self.arg:
  478. self.event(self.arg)
  479. else:
  480. self.event()
  481.  
  482. def __init__(self):
  483. #print "NEW TASKBAR ----------------------------------------------------------------------------"
  484.  
  485. ui.ScriptWindow.__init__(self, "TOP_MOST")
  486. self.text = {}
  487.  
  488. self.quickPageNumImageBox = None
  489. self.tooltipItem = 0
  490. self.tooltipSkill = 0
  491. self.mouseModeButtonList = [ ui.ScriptWindow("TOP_MOST"), ui.ScriptWindow("TOP_MOST") ]
  492.  
  493. self.tooltipHP = self.TextToolTip()
  494. self.tooltipHP.Hide()
  495. self.tooltipSP = self.TextToolTip()
  496. self.tooltipSP.Hide()
  497. self.tooltipST = self.TextToolTip()
  498. self.tooltipST.Hide()
  499. self.tooltipEXP = self.TextToolTip()
  500. self.tooltipEXP.Hide()
  501.  
  502. self.skillCategoryNameList = [ "ACTIVE_1", "ACTIVE_2", "ACTIVE_3" ]
  503. self.skillPageStartSlotIndexDict = {
  504. "ACTIVE_1" : 1,
  505. "ACTIVE_2" : 21,
  506. "ACTIVE_3" : 41,
  507. }
  508.  
  509. self.selectSkillButtonList = []
  510.  
  511. self.lastUpdateQuickSlot = 0
  512. self.SetWindowName("TaskBar")
  513. miniMap.Show()
  514. self.LoadWindow()
  515.  
  516. def __del__(self):
  517. #print "---------------------------------------------------------------------------- DELETE TASKBAR"
  518. ui.ScriptWindow.__del__(self)
  519.  
  520. def LoadWindow(self):
  521. try:
  522. pyScrLoader = ui.PythonScriptLoader()
  523.  
  524. pyScrLoader.LoadScriptFile(self, "uiscript/TaskBar.py")
  525. pyScrLoader.LoadScriptFile(self.mouseModeButtonList[self.MOUSE_BUTTON_LEFT], "UIScript/MouseButtonWindow.py")
  526. pyScrLoader.LoadScriptFile(self.mouseModeButtonList[self.MOUSE_BUTTON_RIGHT], "UIScript/RightMouseButtonWindow.py")
  527. except:
  528. import exception
  529. exception.Abort("TaskBar.LoadWindow.LoadObject")
  530.  
  531. self.quickslot = []
  532. self.quickslot.append(self.GetChild("quick_slot_1"))
  533. self.quickslot.append(self.GetChild("quick_slot_2"))
  534. for slot in self.quickslot:
  535. slot.SetSlotStyle(wndMgr.SLOT_STYLE_NONE)
  536. slot.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptyQuickSlot))
  537. slot.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemQuickSlot))
  538. slot.SetUnselectItemSlotEvent(ui.__mem_func__(self.UnselectItemQuickSlot))
  539. slot.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  540. slot.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  541.  
  542. toggleButtonDict = {}
  543. toggleButtonDict[TaskBar.BUTTON_CHARACTER]=self.GetChild("CharacterButton")
  544. # toggleButtonDict[TaskBar.BUTTON_VECTORS]=self.GetChild("VectorsEfsunButton")
  545. toggleButtonDict[TaskBar.BUTTON_INVENTORY]=self.GetChild("InventoryButton")
  546. toggleButtonDict[TaskBar.BUTTON_MESSENGER]=self.GetChild("MessengerButton")
  547. toggleButtonDict[TaskBar.BUTTON_SYSTEM]=self.GetChild("SystemButton")
  548.  
  549. self.AtlasWindow = AtlasWindow()
  550. self.AtlasWindow.LoadWindow()
  551. self.AtlasWindow.Hide()
  552.  
  553. self.MiniMapWindow = self.GetChild("MiniMapWindow")
  554. self.ScaleUpButton = self.GetChild("ScaleUpButton")
  555. self.ScaleDownButton = self.GetChild("ScaleDownButton")
  556. self.AtlasShowButton = self.GetChild("AtlasShowButton")
  557. self.ScaleUpButton.SetEvent(ui.__mem_func__(self.ScaleUp))
  558. self.ScaleDownButton.SetEvent(ui.__mem_func__(self.ScaleDown))
  559. if miniMap.IsAtlas():
  560. self.AtlasShowButton.SetEvent(ui.__mem_func__(self.ShowAtlas))
  561.  
  562. try:
  563. toggleButtonDict[TaskBar.BUTTON_CHAT]=self.GetChild("ChatButton")
  564. except:
  565. toggleButtonDict[TaskBar.BUTTON_EXPAND]=self.GetChild("ExpandButton")
  566. TaskBar.IS_EXPANDED = TRUE
  567.  
  568.  
  569. if localeInfo.IsARABIC():
  570. systemButton = toggleButtonDict[TaskBar.BUTTON_SYSTEM]
  571. if systemButton.ToolTipText:
  572. tx, ty = systemButton.ToolTipText.GetLocalPosition()
  573. tw = systemButton.ToolTipText.GetWidth()
  574. systemButton.ToolTipText.SetPosition(-tw/2, ty)
  575.  
  576. u = 0
  577. for i in xrange(2):
  578. self.text[i] = ui.TextLine()
  579. self.text[i].SetParent(self.GetChild("Base_Board_01"))
  580. self.text[i].SetPosition(250,80+u)
  581. self.text[i].SetText("99")
  582. if i == 0:
  583. self.text[i].SetPackedFontColor(0xffa33437)
  584. else:
  585. self.text[i].SetPackedFontColor(0xff3453a3)
  586. self.text[i].Show()
  587. u += 15
  588.  
  589. race = net.GetMainActorRace()
  590. self.img = ui.ImageBox()
  591. self.img.SetParent(self.GetChild("Base_Board_01"))
  592. self.img.SetPosition(150,30)
  593. self.img.LoadImage(FACE_IMAGE_DICT[race])
  594. self.img.Show()
  595.  
  596. self.quickPageNumImageBox=self.GetChild("QuickPageNumber")
  597.  
  598. # self.GetChild("QuickPageUpButton").SetEvent(ui.__mem_func__(self.__OnClickQuickPageUpButton))
  599. self.GetChild("QuickPageDownButton").SetEvent(ui.__mem_func__(self.__OnClickQuickPageDownButton))
  600.  
  601. mouseLeftButtonModeButton = self.GetChild("LeftMouseButton")
  602. mouseRightButtonModeButton = self.GetChild("RightMouseButton")
  603. mouseLeftButtonModeButton.SetEvent(ui.__mem_func__(self.ToggleLeftMouseButtonModeWindow))
  604. mouseRightButtonModeButton.SetEvent(ui.__mem_func__(self.ToggleRightMouseButtonModeWindow))
  605. self.curMouseModeButton = [ mouseLeftButtonModeButton, mouseRightButtonModeButton ]
  606.  
  607. (xLocalRight, yLocalRight) = mouseRightButtonModeButton.GetLocalPosition()
  608. self.curSkillButton = self.SkillButton()
  609. self.curSkillButton.SetParent(self)
  610. self.curSkillButton.SetPosition(xLocalRight, 3)
  611. self.curSkillButton.SetSkillEvent(ui.__mem_func__(self.ToggleRightMouseButtonModeWindow))
  612. self.curSkillButton.Hide()
  613.  
  614. (xLeft, yLeft) = mouseLeftButtonModeButton.GetGlobalPosition()
  615. (xRight, yRight) = mouseRightButtonModeButton.GetGlobalPosition()
  616. leftModeButtonList = self.mouseModeButtonList[self.MOUSE_BUTTON_LEFT]
  617. leftModeButtonList.SetPosition(xLeft, yLeft - leftModeButtonList.GetHeight()-5)
  618. rightModeButtonList = self.mouseModeButtonList[self.MOUSE_BUTTON_RIGHT]
  619. rightModeButtonList.SetPosition(xRight - rightModeButtonList.GetWidth() + 32, yRight - rightModeButtonList.GetHeight()-5)
  620. rightModeButtonList.GetChild("button_skill").SetEvent(lambda adir=self.MOUSE_BUTTON_RIGHT, aevent=self.EVENT_SKILL: self.SelectMouseButtonEvent(adir, aevent))
  621. rightModeButtonList.GetChild("button_skill").Hide()
  622.  
  623. mouseImage = ui.ImageBox("TOP_MOST")
  624. mouseImage.AddFlag("float")
  625. mouseImage.LoadImage("d:/ymir work/ui/game/taskbar/mouse_button_camera_01.sub")
  626. mouseImage.SetPosition(xRight, wndMgr.GetScreenHeight() - 34)
  627. mouseImage.Hide()
  628. self.mouseImage = mouseImage
  629.  
  630. dir = self.MOUSE_BUTTON_LEFT
  631. wnd = self.mouseModeButtonList[dir]
  632. wnd.GetChild("button_move_and_attack").SetEvent(lambda adir=dir, aevent=self.EVENT_MOVE_AND_ATTACK: self.SelectMouseButtonEvent(adir, aevent))
  633. wnd.GetChild("button_auto_attack").SetEvent(lambda adir=dir, aevent=self.EVENT_AUTO: self.SelectMouseButtonEvent(adir, aevent))
  634. wnd.GetChild("button_camera").SetEvent(lambda adir=dir, aevent=self.EVENT_CAMERA: self.SelectMouseButtonEvent(adir, aevent))
  635.  
  636. dir = self.MOUSE_BUTTON_RIGHT
  637. wnd = self.mouseModeButtonList[dir]
  638. wnd.GetChild("button_move_and_attack").SetEvent(lambda adir=dir, aevent=self.EVENT_MOVE_AND_ATTACK: self.SelectMouseButtonEvent(adir, aevent))
  639. wnd.GetChild("button_camera").SetEvent(lambda adir=dir, aevent=self.EVENT_CAMERA: self.SelectMouseButtonEvent(adir, aevent))
  640.  
  641. self.toggleButtonDict = toggleButtonDict
  642. # self.expGauge = expGauge
  643.  
  644. # if constInfo.IN_GAME_SHOP_ENABLE:
  645. # self.rampageGauge1 = self.GetChild("RampageGauge")
  646. # self.rampageGauge1.OnMouseOverIn = ui.__mem_func__(self.__RampageGauge_OverIn)
  647. # self.rampageGauge2 = self.GetChild("RampageGauge2")
  648. # self.rampageGauge2.OnMouseOverOut = ui.__mem_func__(self.__RampageGauge_OverOut)
  649. # self.rampageGauge2.OnMouseLeftButtonUp = ui.__mem_func__(self.__RampageGauge_Click)
  650. # print "[DEBUG]: constInfo.IN_GAME_SHOP_ENABLE / self.rampageGauge1",constInfo.IN_GAME_SHOP_ENABLE, self.rampageGauge1
  651. # self.__RampageGauge_OverOut()
  652.  
  653. self.hpGauge = []
  654. self.hpGauge.append(self.GetChild("HPGauge_1"))
  655. self.hpGauge.append(self.GetChild("HPGauge_2"))
  656. self.hpGauge.append(self.GetChild("HPGauge_3"))
  657. self.hpGauge.append(self.GetChild("HPGauge_4"))
  658. self.hpGauge.append(self.GetChild("HPGauge_5"))
  659. self.hpGauge.append(self.GetChild("HPGauge_6"))
  660.  
  661. # self.hpGauge = self.GetChild("HPGauge")
  662. self.mpGauge = self.GetChild("SPGauge")
  663.  
  664. # self.stGauge = self.GetChild("STGauge")
  665. self.hpRecoveryGaugeBar = []
  666. self.hpRecoveryGaugeBar.append(self.GetChild("HPRecoveryGaugeBar_1"))
  667. self.hpRecoveryGaugeBar.append(self.GetChild("HPRecoveryGaugeBar_2"))
  668. self.hpRecoveryGaugeBar.append(self.GetChild("HPRecoveryGaugeBar_3"))
  669. self.hpRecoveryGaugeBar.append(self.GetChild("HPRecoveryGaugeBar_4"))
  670. self.hpRecoveryGaugeBar.append(self.GetChild("HPRecoveryGaugeBar_5"))
  671. self.hpRecoveryGaugeBar.append(self.GetChild("HPRecoveryGaugeBar_6"))
  672. # self.hpRecoveryGaugeBar = self.GetChild("HPRecoveryGaugeBar")
  673. self.spRecoveryGaugeBar = self.GetChild("SPRecoveryGaugeBar")
  674.  
  675. # self.hpGaugeBoard=self.GetChild("HPGauge_Board")
  676. # self.mpGaugeBoard=self.GetChild("SPGauge_Board")
  677. # self.stGaugeBoard=self.GetChild("STGauge_Board")
  678. # self.expGaugeBoard=self.GetChild("EXP_Gauge_Board")
  679. self.expGauge = self.GetChild("EXPGauge_01")
  680.  
  681.  
  682. self.tooltipInfo = MapTextToolTip()
  683. self.tooltipInfo.Hide()
  684.  
  685. #giftbox object
  686. wndGiftBox = GiftBox()
  687. wndGiftBox.LoadWindow()
  688. self.wndGiftBox = wndGiftBox
  689.  
  690. self.__LoadMouseSettings()
  691. self.RefreshStatus()
  692. self.RefreshQuickSlot()
  693.  
  694. # def __RampageGauge_OverIn(self):
  695. # print "rampage_over_in"
  696. # self.rampageGauge2.Show()
  697. # self.rampageGauge1.Hide()
  698.  
  699. # def __RampageGauge_OverOut(self):
  700. # print "rampage_over_out"
  701. # self.rampageGauge2.Hide()
  702. # self.rampageGauge1.Show()
  703.  
  704. def OnRender(self):
  705. (x, y) = self.GetGlobalPosition()
  706. fx = float(x)
  707. fy = float(y)
  708. # height = float(wndMgr.GetScreenHeight()/2)
  709. # miniMap.Render(height+230.0+74.0+121.0+180.0, fy + 15.0)
  710. x,y = self.GetChild("Base_Board_01").GetGlobalPosition()
  711. miniMap.Render(float(x)+230.0+74.0+121.0+490.0, fy + 15.0)
  712.  
  713. def SetMapName(self, mapName):
  714. self.mapName=mapName
  715. self.AtlasWindow.SetMapName(mapName)
  716.  
  717. def ScaleUp(self):
  718. miniMap.ScaleUp()
  719.  
  720. def ScaleDown(self):
  721. miniMap.ScaleDown()
  722.  
  723. def ShowAtlas(self):
  724. if not miniMap.IsAtlas():
  725. return
  726. if not self.AtlasWindow.IsShow():
  727. self.AtlasWindow.Show()
  728.  
  729. def __RampageGauge_Click(self):
  730. print "rampage_up"
  731. net.SendChatPacket("/in_game_mall")
  732. # gift icon hide when click mall icon
  733. self.wndGiftBox.Hide()
  734.  
  735. def __LoadMouseSettings(self):
  736. try:
  737. LoadMouseButtonSettings()
  738. (mouseLeftButtonEvent, mouseRightButtonEvent) = GetMouseButtonSettings()
  739. if not self.__IsInSafeMouseButtonSettingRange(mouseLeftButtonEvent) or not self.__IsInSafeMouseButtonSettingRange(mouseRightButtonEvent):
  740. raise RuntimeError, "INVALID_MOUSE_BUTTON_SETTINGS"
  741. except:
  742. InitMouseButtonSettings(self.EVENT_MOVE_AND_ATTACK, self.EVENT_CAMERA)
  743. (mouseLeftButtonEvent, mouseRightButtonEvent) = GetMouseButtonSettings()
  744.  
  745. try:
  746. self.SelectMouseButtonEvent(self.MOUSE_BUTTON_LEFT, mouseLeftButtonEvent)
  747. self.SelectMouseButtonEvent(self.MOUSE_BUTTON_RIGHT, mouseRightButtonEvent)
  748. except:
  749. InitMouseButtonSettings(self.EVENT_MOVE_AND_ATTACK, self.EVENT_CAMERA)
  750. (mouseLeftButtonEvent, mouseRightButtonEvent) = GetMouseButtonSettings()
  751.  
  752. self.SelectMouseButtonEvent(self.MOUSE_BUTTON_LEFT, mouseLeftButtonEvent)
  753. self.SelectMouseButtonEvent(self.MOUSE_BUTTON_RIGHT, mouseRightButtonEvent)
  754.  
  755.  
  756.  
  757. def __IsInSafeMouseButtonSettingRange(self, arg):
  758. return arg >= self.EVENT_MOVE and arg <= self.EVENT_AUTO
  759.  
  760. def Destroy(self):
  761. SaveMouseButtonSettings()
  762.  
  763. self.ClearDictionary()
  764. self.mouseModeButtonList[0].ClearDictionary()
  765. self.mouseModeButtonList[1].ClearDictionary()
  766. self.mouseModeButtonList = 0
  767. self.curMouseModeButton = 0
  768. self.curSkillButton = 0
  769. self.selectSkillButtonList = 0
  770.  
  771.  
  772. self.expGauge = None
  773. self.hpGauge = None
  774. self.mpGauge = None
  775. # self.stGauge = None
  776. self.hpRecoveryGaugeBar = None
  777. self.spRecoveryGaugeBar = None
  778.  
  779. self.tooltipItem = 0
  780. self.tooltipSkill = 0
  781. self.quickslot = 0
  782. self.toggleButtonDict = 0
  783.  
  784. # self.hpGaugeBoard = 0
  785. # self.mpGaugeBoard = 0
  786. # self.stGaugeBoard = 0
  787.  
  788. # self.expGaugeBoard = 0
  789.  
  790. self.tooltipHP = 0
  791. self.tooltipSP = 0
  792. self.tooltipST = 0
  793. self.tooltipEXP = 0
  794.  
  795. self.mouseImage = None
  796.  
  797. # def __OnClickQuickPageUpButton(self):
  798. # player.SetQuickPage(player.GetQuickPage()-1)
  799.  
  800. def __OnClickQuickPageDownButton(self):
  801. player.SetQuickPage(player.GetQuickPage()+1)
  802.  
  803. def SetToggleButtonEvent(self, eButton, kEventFunc):
  804. self.toggleButtonDict[eButton].SetEvent(kEventFunc)
  805.  
  806. def SetItemToolTip(self, tooltipItem):
  807. self.tooltipItem = tooltipItem
  808.  
  809. def SetSkillToolTip(self, tooltipSkill):
  810. self.tooltipSkill = tooltipSkill
  811. self.curSkillButton.SetSkillToolTip(self.tooltipSkill)
  812.  
  813. ## Mouse Image
  814. def ShowMouseImage(self):
  815. self.mouseImage.SetTop()
  816. self.mouseImage.Show()
  817.  
  818. def HideMouseImage(self):
  819. player.SetQuickCameraMode(FALSE)
  820. self.mouseImage.Hide()
  821.  
  822. ## Gauge
  823. def RefreshStatus(self):
  824. curHP = player.GetStatus(player.HP)
  825. maxHP = player.GetStatus(player.MAX_HP)
  826. curSP = player.GetStatus(player.SP)
  827. maxSP = player.GetStatus(player.MAX_SP)
  828. curEXP = unsigned32(player.GetStatus(player.EXP))
  829. nextEXP = unsigned32(player.GetStatus(player.NEXT_EXP))
  830. recoveryHP = player.GetStatus(player.HP_RECOVERY)
  831. recoverySP = player.GetStatus(player.SP_RECOVERY)
  832.  
  833. self.RefreshStamina()
  834.  
  835. self.SetHP(curHP, recoveryHP, maxHP)
  836. self.SetSP(curSP, recoverySP, maxSP)
  837. self.SetExperience(curEXP, nextEXP)
  838.  
  839. def RefreshStamina(self):
  840. curST = player.GetStatus(player.STAMINA)
  841. maxST = player.GetStatus(player.MAX_STAMINA)
  842. # self.SetST(curST, maxST)
  843.  
  844. def RefreshSkill(self):
  845. self.curSkillButton.RefreshSkill()
  846. for button in self.selectSkillButtonList:
  847. button.RefreshSkill()
  848.  
  849. def CalculateHP(self, curValue, maxValue):
  850. percent = int((float(curValue) / float(maxValue)) * 6.0)
  851. for i in xrange(percent):
  852. self.hpGauge[i].Show()
  853. for i in xrange(6-percent):
  854. self.hpGauge[percent+i].Hide()
  855.  
  856. def CalculateHPREecovery(self, curValue, maxValue):
  857. percent = int((float(curValue) / float(maxValue)) * 6.0)
  858. for i in xrange(percent):
  859. self.hpRecoveryGaugeBar[i].Show()
  860. for i in xrange(6-percent):
  861. self.hpRecoveryGaugeBar[percent+i].Hide()
  862.  
  863. def SetHP(self, curPoint, recoveryPoint, maxPoint):
  864. curPoint = min(curPoint, maxPoint)
  865. self.currenthp = str(curPoint)
  866. if maxPoint > 0:
  867. self.CalculateHP(curPoint,maxPoint)
  868. # self.hpGauge.SetPercentage(curPoint, maxPoint)
  869. self.tooltipHP.SetText("%s : %d / %d" % (localeInfo.TASKBAR_HP, curPoint, maxPoint))
  870.  
  871. if 0 == recoveryPoint:
  872. for i in xrange(6):
  873. self.hpRecoveryGaugeBar[i].Hide()
  874. # self.hpRecoveryGaugeBar.Hide()
  875. else:
  876. destPoint = min(maxPoint, curPoint + recoveryPoint)
  877. newWidth = int(self.GAUGE_WIDTH * (float(destPoint) / float(maxPoint)))
  878. self.CalculateHPREecovery(curPoint, maxPoint)
  879. # self.hpRecoveryGaugeBar.SetSize(newWidth, self.GAUGE_HEIGHT)
  880. # self.hpRecoveryGaugeBar.Show()
  881.  
  882. def SetSP(self, curPoint, recoveryPoint, maxPoint):
  883. if curPoint < 0:
  884. return
  885. self.currentsp = str(curPoint)
  886. img_value_reverse = [76,75,74,73,72,71,70,69,68,67,66,65,64,63,62,61,60,59,58,57,56,55,54,53,52,51,50,
  887. 49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,
  888. 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0]
  889. percent = (float(curPoint) / float(maxPoint)) * 77.0
  890. images = int(img_value_reverse[int(percent)-1])
  891. if images < 10:
  892. images = "0"+str(images)
  893.  
  894. self.mpGauge.LoadImage("d:/ymir work/interface/Illumina_vegas/taskbar/gauge_mp/gauge_mp_fill_"+str(images)+".tga")
  895. curPoint = min(curPoint, maxPoint)
  896. if maxPoint > 0:
  897. self.tooltipSP.SetText("%s : %d / %d" % (localeInfo.TASKBAR_SP, curPoint, maxPoint))
  898.  
  899. if 0 == recoveryPoint:
  900. self.spRecoveryGaugeBar.Hide()
  901. else:
  902. destPoint = min(maxPoint, curPoint + recoveryPoint)
  903. newWidth = int(self.GAUGE_WIDTH * (float(destPoint) / float(maxPoint)))
  904. # self.spRecoveryGaugeBar.SetSize(newWidth, self.GAUGE_HEIGHT)
  905. self.spRecoveryGaugeBar.LoadImage("d:/ymir work/interface/Illumina_vegas/gauge_mp_recovery/gauge_mp_fill_"+str(images)+".tga")
  906. self.spRecoveryGaugeBar.Show()
  907.  
  908. # def SetST(self, curPoint, maxPoint):
  909. # curPoint = min(curPoint, maxPoint)
  910. # if maxPoint > 0:
  911. # self.stGauge.SetPercentage(curPoint, maxPoint)
  912. # self.tooltipST.SetText("%s : %d / %d" % (localeInfo.TASKBAR_ST, curPoint, maxPoint))
  913.  
  914. def SetExperience(self, curPoint, maxPoint):
  915. curPoint = min(curPoint, maxPoint)
  916. if maxPoint > 0:
  917. self.expGauge.SetPercentage(curPoint, maxPoint)
  918. self.tooltipEXP.SetText("%s : %.2f%%" % (localeInfo.TASKBAR_EXP, float(curPoint) / max(1, float(maxPoint)) * 100))
  919.  
  920.  
  921. ## QuickSlot
  922. def RefreshQuickSlot(self):
  923.  
  924. pageNum = player.GetQuickPage()
  925.  
  926. try:
  927. self.quickPageNumImageBox.LoadImage(TaskBar.QUICKPAGE_NUMBER_FILENAME[pageNum])
  928. except:
  929. pass
  930.  
  931. startNumber = 0
  932. for slot in self.quickslot:
  933.  
  934. for i in xrange(4):
  935.  
  936. slotNumber = i+startNumber
  937.  
  938. (Type, Position) = player.GetLocalQuickSlot(slotNumber)
  939.  
  940. if player.SLOT_TYPE_NONE == Type:
  941. slot.ClearSlot(slotNumber)
  942. continue
  943.  
  944. if player.SLOT_TYPE_INVENTORY == Type:
  945.  
  946. itemIndex = player.GetItemIndex(Position)
  947. itemCount = player.GetItemCount(Position)
  948. if itemCount <= 1:
  949. itemCount = 0
  950.  
  951. ## ÀÚµ¿¹°¾à (#72723, #72724) Ư¼öó¸® - ¾ÆÀÌÅÛÀε¥µµ ½½·Ô¿¡ È°¼ºÈ­/ºñÈ°¼ºÈ­ Ç¥½Ã¸¦ À§ÇÑ ÀÛ¾÷ÀÓ - [hyo]
  952. if constInfo.IS_AUTO_POTION(itemIndex):
  953. # metinSocket - [0] : È°¼ºÈ­ ¿©ºÎ, [1] : »ç¿ëÇÑ ¾ç, [2] : ÃÖ´ë ¿ë·®
  954. metinSocket = [player.GetItemMetinSocket(Position, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
  955.  
  956. if 0 != int(metinSocket[0]):
  957. slot.ActivateSlot(slotNumber)
  958. else:
  959. slot.DeactivateSlot(slotNumber)
  960.  
  961. slot.SetItemSlot(slotNumber, itemIndex, itemCount)
  962.  
  963. elif player.SLOT_TYPE_SKILL == Type:
  964.  
  965. skillIndex = player.GetSkillIndex(Position)
  966. if 0 == skillIndex:
  967. slot.ClearSlot(slotNumber)
  968. continue
  969.  
  970. skillType = skill.GetSkillType(skillIndex)
  971. if skill.SKILL_TYPE_GUILD == skillType:
  972. import guild
  973. skillGrade = 0
  974. skillLevel = guild.GetSkillLevel(Position)
  975.  
  976. else:
  977. skillGrade = player.GetSkillGrade(Position)
  978. skillLevel = player.GetSkillLevel(Position)
  979.  
  980. slot.SetSkillSlotNew(slotNumber, skillIndex, skillGrade, skillLevel)
  981. slot.SetSlotCountNew(slotNumber, skillGrade, skillLevel)
  982. slot.SetCoverButton(slotNumber)
  983.  
  984. ## NOTE : CoolTime üũ
  985. if player.IsSkillCoolTime(Position):
  986. (coolTime, elapsedTime) = player.GetSkillCoolTime(Position)
  987. slot.SetSlotCoolTime(slotNumber, coolTime, elapsedTime)
  988.  
  989. ## NOTE : Activate µÇ¾î ÀÖ´Ù¸é ¾ÆÀÌÄܵµ ¾÷µ¥ÀÌÆ®
  990. if player.IsSkillActive(Position):
  991. slot.ActivateSlot(slotNumber)
  992.  
  993. elif player.SLOT_TYPE_EMOTION == Type:
  994.  
  995. emotionIndex = Position
  996. slot.SetEmotionSlot(slotNumber, emotionIndex)
  997. slot.SetCoverButton(slotNumber)
  998. slot.SetSlotCount(slotNumber, 0)
  999.  
  1000. slot.RefreshSlot()
  1001. startNumber += 4
  1002.  
  1003. def canAddQuickSlot(self, Type, slotNumber):
  1004.  
  1005. if player.SLOT_TYPE_INVENTORY == Type:
  1006.  
  1007. itemIndex = player.GetItemIndex(slotNumber)
  1008. return item.CanAddToQuickSlotItem(itemIndex)
  1009.  
  1010. return TRUE
  1011.  
  1012. def AddQuickSlot(self, localSlotIndex):
  1013. AttachedSlotType = mouseModule.mouseController.GetAttachedType()
  1014. AttachedSlotNumber = mouseModule.mouseController.GetAttachedSlotNumber()
  1015. AttachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
  1016.  
  1017. if player.SLOT_TYPE_QUICK_SLOT == AttachedSlotType:
  1018. player.RequestMoveGlobalQuickSlotToLocalQuickSlot(AttachedSlotNumber, localSlotIndex)
  1019.  
  1020. elif player.SLOT_TYPE_EMOTION == AttachedSlotType:
  1021.  
  1022. player.RequestAddLocalQuickSlot(localSlotIndex, AttachedSlotType, AttachedItemIndex)
  1023.  
  1024. elif TRUE == self.canAddQuickSlot(AttachedSlotType, AttachedSlotNumber):
  1025.  
  1026. ## Online Code
  1027. player.RequestAddLocalQuickSlot(localSlotIndex, AttachedSlotType, AttachedSlotNumber)
  1028.  
  1029. mouseModule.mouseController.DeattachObject()
  1030. self.RefreshQuickSlot()
  1031.  
  1032. def SelectEmptyQuickSlot(self, slotIndex):
  1033.  
  1034. if TRUE == mouseModule.mouseController.isAttached():
  1035. self.AddQuickSlot(slotIndex)
  1036.  
  1037. def SelectItemQuickSlot(self, localQuickSlotIndex):
  1038.  
  1039. if TRUE == mouseModule.mouseController.isAttached():
  1040. self.AddQuickSlot(localQuickSlotIndex)
  1041.  
  1042. else:
  1043. globalQuickSlotIndex=player.LocalQuickSlotIndexToGlobalQuickSlotIndex(localQuickSlotIndex)
  1044. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_QUICK_SLOT, globalQuickSlotIndex, globalQuickSlotIndex)
  1045.  
  1046. def UnselectItemQuickSlot(self, localSlotIndex):
  1047.  
  1048. if FALSE == mouseModule.mouseController.isAttached():
  1049. player.RequestUseLocalQuickSlot(localSlotIndex)
  1050. return
  1051.  
  1052. elif mouseModule.mouseController.isAttached():
  1053. mouseModule.mouseController.DeattachObject()
  1054. return
  1055.  
  1056.  
  1057. def OnUseSkill(self, usedSlotIndex, coolTime):
  1058.  
  1059. QUICK_SLOT_SLOT_COUNT = 4
  1060. slotIndex = 0
  1061.  
  1062. ## Current Skill Button
  1063. if usedSlotIndex == self.curSkillButton.GetSlotIndex():
  1064. self.curSkillButton.Activate(coolTime)
  1065.  
  1066. ## Quick Slot
  1067. for slotWindow in self.quickslot:
  1068.  
  1069. for i in xrange(QUICK_SLOT_SLOT_COUNT):
  1070.  
  1071. (Type, Position) = player.GetLocalQuickSlot(slotIndex)
  1072.  
  1073. if Type == player.SLOT_TYPE_SKILL:
  1074. if usedSlotIndex == Position:
  1075. slotWindow.SetSlotCoolTime(slotIndex, coolTime)
  1076. return
  1077.  
  1078. slotIndex += 1
  1079.  
  1080. def OnActivateSkill(self, usedSlotIndex):
  1081. slotIndex = 0
  1082.  
  1083. ## Current Skill Button
  1084. if usedSlotIndex == self.curSkillButton.GetSlotIndex():
  1085. self.curSkillButton.Deactivate()
  1086.  
  1087. ## Quick Slot
  1088. for slotWindow in self.quickslot:
  1089.  
  1090. for i in xrange(4):
  1091.  
  1092. (Type, Position) = player.GetLocalQuickSlot(slotIndex)
  1093.  
  1094. if Type == player.SLOT_TYPE_SKILL:
  1095. if usedSlotIndex == Position:
  1096. slotWindow.ActivateSlot(slotIndex)
  1097. return
  1098.  
  1099. slotIndex += 1
  1100.  
  1101. def OnDeactivateSkill(self, usedSlotIndex):
  1102. slotIndex = 0
  1103.  
  1104. ## Current Skill Button
  1105. if usedSlotIndex == self.curSkillButton.GetSlotIndex():
  1106. self.curSkillButton.Deactivate()
  1107.  
  1108. ## Quick Slot
  1109. for slotWindow in self.quickslot:
  1110.  
  1111. for i in xrange(4):
  1112.  
  1113. (Type, Position) = player.GetLocalQuickSlot(slotIndex)
  1114.  
  1115. if Type == player.SLOT_TYPE_SKILL:
  1116. if usedSlotIndex == Position:
  1117. slotWindow.DeactivateSlot(slotIndex)
  1118. return
  1119.  
  1120. slotIndex += 1
  1121.  
  1122. ## ToolTip
  1123. def OverInItem(self, slotNumber):
  1124. if mouseModule.mouseController.isAttached():
  1125. return
  1126.  
  1127. (Type, Position) = player.GetLocalQuickSlot(slotNumber)
  1128.  
  1129. if player.SLOT_TYPE_INVENTORY == Type:
  1130. self.tooltipItem.SetInventoryItem(Position)
  1131. self.tooltipSkill.HideToolTip()
  1132.  
  1133. elif player.SLOT_TYPE_SKILL == Type:
  1134.  
  1135. skillIndex = player.GetSkillIndex(Position)
  1136. skillType = skill.GetSkillType(skillIndex)
  1137.  
  1138. if skill.SKILL_TYPE_GUILD == skillType:
  1139. import guild
  1140. skillGrade = 0
  1141. skillLevel = guild.GetSkillLevel(Position)
  1142.  
  1143. else:
  1144. skillGrade = player.GetSkillGrade(Position)
  1145. skillLevel = player.GetSkillLevel(Position)
  1146.  
  1147. self.tooltipSkill.SetSkillNew(Position, skillIndex, skillGrade, skillLevel)
  1148. self.tooltipItem.HideToolTip()
  1149.  
  1150. def OverOutItem(self):
  1151. if 0 != self.tooltipItem:
  1152. self.tooltipItem.HideToolTip()
  1153. if 0 != self.tooltipSkill:
  1154. self.tooltipSkill.HideToolTip()
  1155.  
  1156.  
  1157. def OnUpdate(self):
  1158. (x, y, z) = player.GetMainCharacterPosition()
  1159. miniMap.Update(x, y)
  1160. self.text[0].SetText(self.currenthp)
  1161. self.text[1].SetText(self.currentsp)
  1162.  
  1163. if self.MiniMapWindow.IsIn():
  1164. (mouseX, mouseY) = wndMgr.GetMousePosition()
  1165. (bFind, sName, iPosX, iPosY, dwTextColor) = miniMap.GetInfo(mouseX, mouseY)
  1166. if bFind == 0:
  1167. self.tooltipInfo.Hide()
  1168. else:
  1169. self.tooltipInfo.SetText("%s(%d, %d)" % (sName, iPosX, iPosY))
  1170. self.tooltipInfo.SetTooltipPosition(mouseX - 5, mouseY)
  1171. self.tooltipInfo.SetTextColor(dwTextColor)
  1172. self.tooltipInfo.Show()
  1173.  
  1174. if app.GetGlobalTime() - self.lastUpdateQuickSlot > 500:
  1175. self.lastUpdateQuickSlot = app.GetGlobalTime()
  1176. self.RefreshQuickSlot()
  1177.  
  1178. if TRUE == self.expGauge.IsIn():
  1179. self.tooltipEXP.Show()
  1180. self.tooltipEXP.SetTop()
  1181. else:
  1182. self.tooltipEXP.Hide()
  1183.  
  1184. ## Skill
  1185. def ToggleLeftMouseButtonModeWindow(self):
  1186.  
  1187. wndMouseButtonMode = self.mouseModeButtonList[self.MOUSE_BUTTON_LEFT]
  1188.  
  1189. if TRUE == wndMouseButtonMode.IsShow():
  1190.  
  1191. wndMouseButtonMode.Hide()
  1192.  
  1193. else:
  1194. wndMouseButtonMode.Show()
  1195.  
  1196. def ToggleRightMouseButtonModeWindow(self):
  1197.  
  1198. wndMouseButtonMode = self.mouseModeButtonList[self.MOUSE_BUTTON_RIGHT]
  1199.  
  1200. if TRUE == wndMouseButtonMode.IsShow():
  1201.  
  1202. wndMouseButtonMode.Hide()
  1203. self.CloseSelectSkill()
  1204.  
  1205. else:
  1206. wndMouseButtonMode.Show()
  1207. self.OpenSelectSkill()
  1208.  
  1209. def OpenSelectSkill(self):
  1210.  
  1211. PAGE_SLOT_COUNT = 6
  1212.  
  1213. (xSkillButton, y) = self.curSkillButton.GetGlobalPosition()
  1214. y -= (37 + 32 + 1)
  1215.  
  1216. for key in self.skillCategoryNameList:
  1217.  
  1218. appendCount = 0
  1219. startNumber = self.skillPageStartSlotIndexDict[key]
  1220. x = xSkillButton
  1221.  
  1222. getSkillIndex=player.GetSkillIndex
  1223. getSkillLevel=player.GetSkillLevel
  1224. for i in xrange(PAGE_SLOT_COUNT):
  1225.  
  1226. skillIndex = getSkillIndex(startNumber+i)
  1227. skillLevel = getSkillLevel(startNumber+i)
  1228.  
  1229. if 0 == skillIndex:
  1230. continue
  1231. if 0 == skillLevel:
  1232. continue
  1233. if skill.IsStandingSkill(skillIndex):
  1234. continue
  1235.  
  1236. ## FIXME : ½ºÅ³ Çϳª´ç ½½·Ô Çϳª¾¿ ÇÒ´çÇÏ´Â°Ç ¾Æ¹«¸® ºÁµµ ºÎÇÏ°¡ Å©´Ù.
  1237. ## ÀÌ ºÎºÐÀº ½Ã°£À» ³ª¸é °íÄ¡µµ·Ï. - [levites]
  1238. skillButton = self.SkillButton()
  1239. skillButton.SetSkill(startNumber+i)
  1240. skillButton.SetPosition(x, y)
  1241. skillButton.SetSkillEvent(ui.__mem_func__(self.CloseSelectSkill), startNumber+i+1)
  1242. skillButton.SetSkillToolTip(self.tooltipSkill)
  1243. skillButton.SetTop()
  1244. skillButton.Show()
  1245. self.selectSkillButtonList.append(skillButton)
  1246.  
  1247. appendCount += 1
  1248. x -= 32
  1249.  
  1250. if appendCount > 0:
  1251. y -= 32
  1252.  
  1253. def CloseSelectSkill(self, slotIndex=-1):
  1254.  
  1255. self.mouseModeButtonList[self.MOUSE_BUTTON_RIGHT].Hide()
  1256. for button in self.selectSkillButtonList:
  1257. button.Destroy()
  1258.  
  1259. self.selectSkillButtonList = []
  1260.  
  1261. if -1 != slotIndex:
  1262. self.curSkillButton.Show()
  1263. self.curMouseModeButton[self.MOUSE_BUTTON_RIGHT].Hide()
  1264. player.SetMouseFunc(player.MBT_RIGHT, player.MBF_SKILL)
  1265. player.ChangeCurrentSkillNumberOnly(slotIndex-1)
  1266. else:
  1267. self.curSkillButton.Hide()
  1268. self.curMouseModeButton[self.MOUSE_BUTTON_RIGHT].Show()
  1269.  
  1270. def SelectMouseButtonEvent(self, dir, event):
  1271. SetMouseButtonSetting(dir, event)
  1272.  
  1273. self.CloseSelectSkill()
  1274. self.mouseModeButtonList[dir].Hide()
  1275.  
  1276. btn = 0
  1277. type = self.NONE
  1278. func = self.NONE
  1279. tooltip_text = ""
  1280.  
  1281. if self.MOUSE_BUTTON_LEFT == dir:
  1282. type = player.MBT_LEFT
  1283.  
  1284. elif self.MOUSE_BUTTON_RIGHT == dir:
  1285. type = player.MBT_RIGHT
  1286.  
  1287. if self.EVENT_MOVE == event:
  1288. btn = self.mouseModeButtonList[dir].GetChild("button_move")
  1289. func = player.MBF_MOVE
  1290. tooltip_text = localeInfo.TASKBAR_MOVE
  1291. elif self.EVENT_ATTACK == event:
  1292. btn = self.mouseModeButtonList[dir].GetChild("button_attack")
  1293. func = player.MBF_ATTACK
  1294. tooltip_text = localeInfo.TASKBAR_ATTACK
  1295. elif self.EVENT_AUTO == event:
  1296. btn = self.mouseModeButtonList[dir].GetChild("button_auto_attack")
  1297. func = player.MBF_AUTO
  1298. tooltip_text = localeInfo.TASKBAR_AUTO
  1299. elif self.EVENT_MOVE_AND_ATTACK == event:
  1300. btn = self.mouseModeButtonList[dir].GetChild("button_move_and_attack")
  1301. func = player.MBF_SMART
  1302. tooltip_text = localeInfo.TASKBAR_ATTACK
  1303. elif self.EVENT_CAMERA == event:
  1304. btn = self.mouseModeButtonList[dir].GetChild("button_camera")
  1305. func = player.MBF_CAMERA
  1306. tooltip_text = localeInfo.TASKBAR_CAMERA
  1307. elif self.EVENT_SKILL == event:
  1308. btn = self.mouseModeButtonList[dir].GetChild("button_skill")
  1309. func = player.MBF_SKILL
  1310. tooltip_text = localeInfo.TASKBAR_SKILL
  1311.  
  1312. if 0 != btn:
  1313. self.curMouseModeButton[dir].SetToolTipText(tooltip_text, 0, -18)
  1314. self.curMouseModeButton[dir].SetUpVisual(btn.GetUpVisualFileName())
  1315. self.curMouseModeButton[dir].SetOverVisual(btn.GetOverVisualFileName())
  1316. self.curMouseModeButton[dir].SetDownVisual(btn.GetDownVisualFileName())
  1317. self.curMouseModeButton[dir].Show()
  1318.  
  1319. player.SetMouseFunc(type, func)
  1320.  
  1321. def OnChangeCurrentSkill(self, skillSlotNumber):
  1322. self.curSkillButton.SetSkill(skillSlotNumber)
  1323. self.curSkillButton.Show()
  1324. self.curMouseModeButton[self.MOUSE_BUTTON_RIGHT].Hide()
  1325.  
  1326. # a=TaskBar()
  1327. # a.Show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement