Guest User

Untitled

a guest
Jul 22nd, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 40.89 KB | None | 0 0
  1. import ui
  2. import uiScriptLocale
  3. import app
  4. import net
  5. import dbg
  6. import snd
  7. import player
  8. import mouseModule
  9. import wndMgr
  10. import skill
  11. import playerSettingModule
  12. import quest
  13. import locale
  14. import uiToolTip
  15. import constInfo
  16. import emotion
  17. import chr
  18.  
  19. SHOW_ONLY_ACTIVE_SKILL = FALSE
  20. SHOW_LIMIT_SUPPORT_SKILL_LIST = []
  21. HIDE_SUPPORT_SKILL_POINT = FALSE
  22.  
  23. if locale.IsYMIR():
  24. SHOW_LIMIT_SUPPORT_SKILL_LIST = [121, 122, 123, 124, 126, 127, 129, 128, 131, 137, 138, 139, 140,141,142]
  25. if not locale.IsCHEONMA():
  26. HIDE_SUPPORT_SKILL_POINT = TRUE
  27. SHOW_LIMIT_SUPPORT_SKILL_LIST = [121, 122, 123, 124, 126, 127, 129, 128, 131, 137, 138, 139, 140,141,142]
  28. elif locale.IsJAPAN() or (locale.IsEUROPE() and app.GetLocalePath() != "locale/ca") and (locale.IsEUROPE() and app.GetLocalePath() != "locale/br"):
  29. HIDE_SUPPORT_SKILL_POINT = TRUE
  30. SHOW_LIMIT_SUPPORT_SKILL_LIST = [121, 122, 123, 124, 126, 127, 129, 128, 131, 137, 138, 139, 140]
  31. else:
  32. HIDE_SUPPORT_SKILL_POINT = TRUE
  33.  
  34. FACE_IMAGE_DICT = {
  35. playerSettingModule.RACE_WARRIOR_M : "icon/face/warrior_m.tga",
  36. playerSettingModule.RACE_WARRIOR_W : "icon/face/warrior_w.tga",
  37. playerSettingModule.RACE_ASSASSIN_M : "icon/face/assassin_m.tga",
  38. playerSettingModule.RACE_ASSASSIN_W : "icon/face/assassin_w.tga",
  39. playerSettingModule.RACE_SURA_M : "icon/face/sura_m.tga",
  40. playerSettingModule.RACE_SURA_W : "icon/face/sura_w.tga",
  41. playerSettingModule.RACE_SHAMAN_M : "icon/face/shaman_m.tga",
  42. playerSettingModule.RACE_SHAMAN_W : "icon/face/shaman_w.tga",
  43. }
  44.  
  45. class CharacterWindow(ui.ScriptWindow):
  46.  
  47. ACTIVE_PAGE_SLOT_COUNT = 8
  48. SUPPORT_PAGE_SLOT_COUNT = 12
  49.  
  50. PAGE_SLOT_COUNT = 12
  51. PAGE_HORSE = 2
  52.  
  53. SKILL_GROUP_NAME_DICT = {
  54. playerSettingModule.JOB_WARRIOR : { 1 : locale.SKILL_GROUP_WARRIOR_1, 2 : locale.SKILL_GROUP_WARRIOR_2, },
  55. playerSettingModule.JOB_ASSASSIN : { 1 : locale.SKILL_GROUP_ASSASSIN_1, 2 : locale.SKILL_GROUP_ASSASSIN_2, },
  56. playerSettingModule.JOB_SURA : { 1 : locale.SKILL_GROUP_SURA_1, 2 : locale.SKILL_GROUP_SURA_2, },
  57. playerSettingModule.JOB_SHAMAN : { 1 : locale.SKILL_GROUP_SHAMAN_1, 2 : locale.SKILL_GROUP_SHAMAN_2, },
  58. }
  59.  
  60. STAT_DESCRIPTION = {
  61. "HTH" : locale.STAT_TOOLTIP_CON,
  62. "INT" : locale.STAT_TOOLTIP_INT,
  63. "STR" : locale.STAT_TOOLTIP_STR,
  64. "DEX" : locale.STAT_TOOLTIP_DEX,
  65. }
  66.  
  67.  
  68. STAT_MINUS_DESCRIPTION = locale.STAT_MINUS_DESCRIPTION
  69.  
  70. def __init__(self):
  71. ui.ScriptWindow.__init__(self)
  72. self.state = "STATUS"
  73. self.isLoaded = 0
  74.  
  75. self.toolTipSkill = 0
  76.  
  77. self.__Initialize()
  78. self.__LoadWindow()
  79.  
  80. self.statusPlusCommandDict={
  81. "HTH" : "/stat ht",
  82. "INT" : "/stat iq",
  83. "STR" : "/stat st",
  84. "DEX" : "/stat dx",
  85. }
  86.  
  87. self.statusMinusCommandDict={
  88. "HTH-" : "/stat- ht",
  89. "INT-" : "/stat- iq",
  90. "STR-" : "/stat- st",
  91. "DEX-" : "/stat- dx",
  92. }
  93.  
  94. def __del__(self):
  95. ui.ScriptWindow.__del__(self)
  96.  
  97. def __Initialize(self):
  98. self.refreshToolTip = 0
  99. self.curSelectedSkillGroup = 0
  100. self.canUseHorseSkill = -1
  101.  
  102. self.toolTip = None
  103. self.toolTipJob = None
  104. self.toolTipAlignment = None
  105. self.toolTipSkill = None
  106.  
  107. self.faceImage = None
  108. self.statusPlusLabel = None
  109. self.statusPlusValue = None
  110. self.activeSlot = None
  111. self.tabDict = None
  112. self.tabButtonDict = None
  113. self.pageDict = None
  114. self.titleBarDict = None
  115. self.statusPlusButtonDict = None
  116. self.statusMinusButtonDict = None
  117.  
  118. self.skillPageDict = None
  119. self.questShowingStartIndex = 0
  120. self.questScrollBar = None
  121. self.questSlot = None
  122. self.questNameList = None
  123. self.questLastTimeList = None
  124. self.questLastCountList = None
  125. self.skillGroupButton = ()
  126.  
  127. self.activeSlot = None
  128. self.activeSkillPointValue = None
  129. self.supportSkillPointValue = None
  130. self.skillGroupButton1 = None
  131. self.skillGroupButton2 = None
  132. self.activeSkillGroupName = None
  133.  
  134. self.guildNameSlot = None
  135. self.guildNameValue = None
  136. self.characterNameSlot = None
  137. self.characterNameValue = None
  138.  
  139. self.emotionToolTip = None
  140. self.soloEmotionSlot = None
  141. self.dualEmotionSlot = None
  142.  
  143. def Show(self):
  144. self.__LoadWindow()
  145.  
  146. ui.ScriptWindow.Show(self)
  147.  
  148. def __LoadScript(self, fileName):
  149. pyScrLoader = ui.PythonScriptLoader()
  150. pyScrLoader.LoadScriptFile(self, fileName)
  151.  
  152. def __BindObject(self):
  153. self.toolTip = uiToolTip.ToolTip()
  154. self.toolTipJob = uiToolTip.ToolTip()
  155. self.toolTipAlignment = uiToolTip.ToolTip(130)
  156.  
  157. self.faceImage = self.GetChild("Face_Image")
  158.  
  159. faceSlot=self.GetChild("Face_Slot")
  160. if 949 == app.GetDefaultCodePage():
  161. faceSlot.SAFE_SetStringEvent("MOUSE_OVER_IN", self.__ShowJobToolTip)
  162. faceSlot.SAFE_SetStringEvent("MOUSE_OVER_OUT", self.__HideJobToolTip)
  163.  
  164. self.statusPlusLabel = self.GetChild("Status_Plus_Label")
  165. self.statusPlusValue = self.GetChild("Status_Plus_Value")
  166.  
  167. self.characterNameSlot = self.GetChild("Character_Name_Slot")
  168. self.characterNameValue = self.GetChild("Character_Name")
  169. self.guildNameSlot = self.GetChild("Guild_Name_Slot")
  170. self.guildNameValue = self.GetChild("Guild_Name")
  171. self.characterNameSlot.SAFE_SetStringEvent("MOUSE_OVER_IN", self.__ShowAlignmentToolTip)
  172. self.characterNameSlot.SAFE_SetStringEvent("MOUSE_OVER_OUT", self.__HideAlignmentToolTip)
  173.  
  174. self.activeSlot = self.GetChild("Skill_Active_Slot")
  175. self.activeSkillPointValue = self.GetChild("Active_Skill_Point_Value")
  176. self.supportSkillPointValue = self.GetChild("Support_Skill_Point_Value")
  177. self.skillGroupButton1 = self.GetChild("Skill_Group_Button_1")
  178. self.skillGroupButton2 = self.GetChild("Skill_Group_Button_2")
  179. self.activeSkillGroupName = self.GetChild("Active_Skill_Group_Name")
  180.  
  181. self.tabDict = {
  182. "STATUS" : self.GetChild("Tab_01"),
  183. "SKILL" : self.GetChild("Tab_02"),
  184. "EMOTICON" : self.GetChild("Tab_03"),
  185. "QUEST" : self.GetChild("Tab_04"),
  186. "Bonus" : self.GetChild("Tab_05"),
  187. }
  188.  
  189. self.tabButtonDict = {
  190. "STATUS" : self.GetChild("Tab_Button_01"),
  191. "SKILL" : self.GetChild("Tab_Button_02"),
  192. "EMOTICON" : self.GetChild("Tab_Button_03"),
  193. "QUEST" : self.GetChild("Tab_Button_04"),
  194. "Bonus" : self.GetChild("Tab_Button_05")
  195. }
  196.  
  197. self.pageDict = {
  198. "STATUS" : self.GetChild("Character_Page"),
  199. "SKILL" : self.GetChild("Skill_Page"),
  200. "EMOTICON" : self.GetChild("Emoticon_Page"),
  201. "QUEST" : self.GetChild("Quest_Page"),
  202. "Bonus" : self.GetChild("Bonus_Page")
  203. }
  204.  
  205. self.titleBarDict = {
  206. "STATUS" : self.GetChild("Character_TitleBar"),
  207. "SKILL" : self.GetChild("Skill_TitleBar"),
  208. "EMOTICON" : self.GetChild("Emoticon_TitleBar"),
  209. "QUEST" : self.GetChild("Quest_TitleBar"),
  210. "Bonus" : self.GetChild("Bonus_TitleBar")
  211. }
  212.  
  213. self.statusPlusButtonDict = {
  214. "HTH" : self.GetChild("HTH_Plus"),
  215. "INT" : self.GetChild("INT_Plus"),
  216. "STR" : self.GetChild("STR_Plus"),
  217. "DEX" : self.GetChild("DEX_Plus"),
  218. }
  219.  
  220. self.statusMinusButtonDict = {
  221. "HTH-" : self.GetChild("HTH_Minus"),
  222. "INT-" : self.GetChild("INT_Minus"),
  223. "STR-" : self.GetChild("STR_Minus"),
  224. "DEX-" : self.GetChild("DEX_Minus"),
  225. }
  226.  
  227. self.skillPageDict = {
  228. "ACTIVE" : self.GetChild("Skill_Active_Slot"),
  229. "SUPPORT" : self.GetChild("Skill_ETC_Slot"),
  230. "HORSE" : self.GetChild("Skill_Active_Slot"),
  231. }
  232.  
  233. self.skillPageStatDict = {
  234. "SUPPORT" : player.SKILL_SUPPORT,
  235. "ACTIVE" : player.SKILL_ACTIVE,
  236. "HORSE" : player.SKILL_HORSE,
  237. }
  238.  
  239. self.skillGroupButton = (
  240. self.GetChild("Skill_Group_Button_1"),
  241. self.GetChild("Skill_Group_Button_2"),
  242. )
  243.  
  244.  
  245. global SHOW_ONLY_ACTIVE_SKILL
  246. global HIDE_SUPPORT_SKILL_POINT
  247. if SHOW_ONLY_ACTIVE_SKILL or HIDE_SUPPORT_SKILL_POINT:
  248. self.GetChild("Support_Skill_Point_Label").Hide()
  249.  
  250. self.soloEmotionSlot = self.GetChild("SoloEmotionSlot")
  251. self.dualEmotionSlot = self.GetChild("DualEmotionSlot")
  252. self.__SetEmotionSlot()
  253.  
  254. self.questShowingStartIndex = 0
  255. self.questScrollBar = self.GetChild("Quest_ScrollBar")
  256. self.questScrollBar.SetScrollEvent(ui.__mem_func__(self.OnQuestScroll))
  257. self.questSlot = self.GetChild("Quest_Slot")
  258. for i in xrange(quest.QUEST_MAX_NUM):
  259. self.questSlot.HideSlotBaseImage(i)
  260. self.questSlot.SetCoverButton(i,\
  261. "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  262. "d:/ymir work/ui/game/quest/slot_button_02.sub",\
  263. "d:/ymir work/ui/game/quest/slot_button_03.sub",\
  264. "d:/ymir work/ui/game/quest/slot_button_03.sub", TRUE)
  265.  
  266. self.questNameList = []
  267. self.questLastTimeList = []
  268. self.questLastCountList = []
  269. for i in xrange(quest.QUEST_MAX_NUM):
  270. self.questNameList.append(self.GetChild("Quest_Name_0" + str(i)))
  271. self.questLastTimeList.append(self.GetChild("Quest_LastTime_0" + str(i)))
  272. self.questLastCountList.append(self.GetChild("Quest_LastCount_0" + str(i)))
  273.  
  274. def __SetSkillSlotEvent(self):
  275. for skillPageValue in self.skillPageDict.itervalues():
  276. skillPageValue.SetSlotStyle(wndMgr.SLOT_STYLE_NONE)
  277. skillPageValue.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectSkill))
  278. skillPageValue.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  279. skillPageValue.SetUnselectItemSlotEvent(ui.__mem_func__(self.ClickSkillSlot))
  280. skillPageValue.SetUseSlotEvent(ui.__mem_func__(self.ClickSkillSlot))
  281. skillPageValue.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  282. skillPageValue.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  283. skillPageValue.SetPressedSlotButtonEvent(ui.__mem_func__(self.OnPressedSlotButton))
  284. skillPageValue.AppendSlotButton("d:/ymir work/ui/game/windows/btn_plus_up.sub",\
  285. "d:/ymir work/ui/game/windows/btn_plus_over.sub",\
  286. "d:/ymir work/ui/game/windows/btn_plus_down.sub")
  287.  
  288. def __SetEmotionSlot(self):
  289.  
  290. self.emotionToolTip = uiToolTip.ToolTip()
  291.  
  292. for slot in (self.soloEmotionSlot, self.dualEmotionSlot):
  293. slot.SetSlotStyle(wndMgr.SLOT_STYLE_NONE)
  294. slot.SetSelectItemSlotEvent(ui.__mem_func__(self.__SelectEmotion))
  295. slot.SetUnselectItemSlotEvent(ui.__mem_func__(self.__ClickEmotionSlot))
  296. slot.SetUseSlotEvent(ui.__mem_func__(self.__ClickEmotionSlot))
  297. slot.SetOverInItemEvent(ui.__mem_func__(self.__OverInEmotion))
  298. slot.SetOverOutItemEvent(ui.__mem_func__(self.__OverOutEmotion))
  299. slot.AppendSlotButton("d:/ymir work/ui/game/windows/btn_plus_up.sub",\
  300. "d:/ymir work/ui/game/windows/btn_plus_over.sub",\
  301. "d:/ymir work/ui/game/windows/btn_plus_down.sub")
  302.  
  303. for slotIdx, datadict in emotion.EMOTION_DICT.items():
  304. emotionIdx = slotIdx
  305.  
  306. slot = self.soloEmotionSlot
  307. if slotIdx > 50:
  308. slot = self.dualEmotionSlot
  309.  
  310. slot.SetEmotionSlot(slotIdx, emotionIdx)
  311. slot.SetCoverButton(slotIdx)
  312.  
  313. def __SelectEmotion(self, slotIndex):
  314. if not slotIndex in emotion.EMOTION_DICT:
  315. return
  316.  
  317. if app.IsPressed(app.DIK_LCONTROL):
  318. player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_EMOTION, slotIndex)
  319. return
  320.  
  321. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_EMOTION, slotIndex, slotIndex)
  322.  
  323. def __ClickEmotionSlot(self, slotIndex):
  324. print "click emotion"
  325. if not slotIndex in emotion.EMOTION_DICT:
  326. return
  327.  
  328. print "check acting"
  329. if player.IsActingEmotion():
  330. return
  331.  
  332. command = emotion.EMOTION_DICT[slotIndex]["command"]
  333. print "command", command
  334.  
  335. if slotIndex > 50:
  336. vid = player.GetTargetVID()
  337.  
  338. if 0 == vid or vid == player.GetMainCharacterIndex() or chr.IsNPC(vid) or chr.IsEnemy(vid):
  339. import chat
  340. chat.AppendChat(chat.CHAT_TYPE_INFO, locale.EMOTION_CHOOSE_ONE)
  341. return
  342.  
  343. command += " " + chr.GetNameByVID(vid)
  344.  
  345. print "send_command", command
  346. net.SendChatPacket(command)
  347.  
  348. def ActEmotion(self, emotionIndex):
  349. self.__ClickEmotionSlot(emotionIndex)
  350.  
  351. def __OverInEmotion(self, slotIndex):
  352. if self.emotionToolTip:
  353.  
  354. if not slotIndex in emotion.EMOTION_DICT:
  355. return
  356.  
  357. self.emotionToolTip.ClearToolTip()
  358. self.emotionToolTip.SetTitle(emotion.EMOTION_DICT[slotIndex]["name"])
  359. self.emotionToolTip.AlignHorizonalCenter()
  360. self.emotionToolTip.ShowToolTip()
  361.  
  362. def __OverOutEmotion(self):
  363. if self.emotionToolTip:
  364. self.emotionToolTip.HideToolTip()
  365.  
  366. def __BindEvent(self):
  367. for i in xrange(len(self.skillGroupButton)):
  368. self.skillGroupButton[i].SetEvent(lambda arg=i: self.__SelectSkillGroup(arg))
  369.  
  370. self.RefreshQuest()
  371. self.__HideJobToolTip()
  372.  
  373. for (tabKey, tabButton) in self.tabButtonDict.items():
  374. tabButton.SetEvent(ui.__mem_func__(self.__OnClickTabButton), tabKey)
  375.  
  376. for (statusPlusKey, statusPlusButton) in self.statusPlusButtonDict.items():
  377. statusPlusButton.SAFE_SetEvent(self.__OnClickStatusPlusButton, statusPlusKey)
  378. statusPlusButton.ShowToolTip = lambda arg=statusPlusKey: self.__OverInStatButton(arg)
  379. statusPlusButton.HideToolTip = lambda arg=statusPlusKey: self.__OverOutStatButton()
  380.  
  381. for (statusMinusKey, statusMinusButton) in self.statusMinusButtonDict.items():
  382. statusMinusButton.SAFE_SetEvent(self.__OnClickStatusMinusButton, statusMinusKey)
  383. statusMinusButton.ShowToolTip = lambda arg=statusMinusKey: self.__OverInStatMinusButton(arg)
  384. statusMinusButton.HideToolTip = lambda arg=statusMinusKey: self.__OverOutStatMinusButton()
  385.  
  386. for titleBarValue in self.titleBarDict.itervalues():
  387. titleBarValue.SetCloseEvent(ui.__mem_func__(self.Hide))
  388.  
  389. self.questSlot.SetSelectItemSlotEvent(ui.__mem_func__(self.__SelectQuest))
  390.  
  391. def __LoadWindow(self):
  392. if self.isLoaded == 1:
  393. return
  394.  
  395. self.isLoaded = 1
  396.  
  397. try:
  398. if locale.IsPOLAND() or locale.IsVIETNAM() or locale.IsJAPAN():
  399. self.__LoadScript(uiScriptLocale.LOCALE_UISCRIPT_PATH + "CharacterWindow.py")
  400. else:
  401. self.__LoadScript("UIScript/CharacterWindow.py")
  402.  
  403. self.__BindObject()
  404. self.__BindEvent()
  405. except:
  406. import exception
  407. exception.Abort("CharacterWindow.__LoadWindow")
  408.  
  409. #self.tabButtonDict["EMOTICON"].Disable()
  410. self.SetState("STATUS")
  411.  
  412. def Destroy(self):
  413. self.ClearDictionary()
  414.  
  415. self.__Initialize()
  416.  
  417. def Close(self):
  418. if 0 != self.toolTipSkill:
  419. self.toolTipSkill.Hide()
  420.  
  421. self.Hide()
  422.  
  423. def SetSkillToolTip(self, toolTipSkill):
  424. self.toolTipSkill = toolTipSkill
  425.  
  426. def __OnClickStatusPlusButton(self, statusKey):
  427. try:
  428. statusPlusCommand=self.statusPlusCommandDict[statusKey]
  429. net.SendChatPacket(statusPlusCommand)
  430. except KeyError, msg:
  431. dbg.TraceError("CharacterWindow.__OnClickStatusPlusButton KeyError: %s", msg)
  432.  
  433. def __OnClickStatusMinusButton(self, statusKey):
  434. try:
  435. statusMinusCommand=self.statusMinusCommandDict[statusKey]
  436. net.SendChatPacket(statusMinusCommand)
  437. except KeyError, msg:
  438. dbg.TraceError("CharacterWindow.__OnClickStatusMinusButton KeyError: %s", msg)
  439.  
  440.  
  441. def __OnClickTabButton(self, stateKey):
  442. self.SetState(stateKey)
  443.  
  444. def SetState(self, stateKey):
  445.  
  446. self.state = stateKey
  447.  
  448. for (tabKey, tabButton) in self.tabButtonDict.items():
  449. if stateKey!=tabKey:
  450. tabButton.SetUp()
  451.  
  452. for tabValue in self.tabDict.itervalues():
  453. tabValue.Hide()
  454.  
  455. for pageValue in self.pageDict.itervalues():
  456. pageValue.Hide()
  457.  
  458. for titleBarValue in self.titleBarDict.itervalues():
  459. titleBarValue.Hide()
  460.  
  461. self.titleBarDict[stateKey].Show()
  462. self.tabDict[stateKey].Show()
  463. self.pageDict[stateKey].Show()
  464.  
  465.  
  466. def GetState(self):
  467. return self.state
  468.  
  469. def __GetTotalAtkText(self):
  470. minAtk=player.GetStatus(player.ATT_MIN)
  471. maxAtk=player.GetStatus(player.ATT_MAX)
  472. atkBonus=player.GetStatus(player.ATT_BONUS)
  473. attackerBonus=player.GetStatus(player.ATTACKER_BONUS)
  474.  
  475. if minAtk==maxAtk:
  476. return "%d" % (minAtk+atkBonus+attackerBonus)
  477. else:
  478. return "%d-%d" % (minAtk+atkBonus+attackerBonus, maxAtk+atkBonus+attackerBonus)
  479.  
  480. def __GetTotalMagAtkText(self):
  481. minMagAtk=player.GetStatus(player.MAG_ATT)+player.GetStatus(player.MIN_MAGIC_WEP)
  482. maxMagAtk=player.GetStatus(player.MAG_ATT)+player.GetStatus(player.MAX_MAGIC_WEP)
  483.  
  484. if minMagAtk==maxMagAtk:
  485. return "%d" % (minMagAtk)
  486. else:
  487. return "%d-%d" % (minMagAtk, maxMagAtk)
  488.  
  489. def __GetTotalDefText(self):
  490. defValue=player.GetStatus(player.DEF_GRADE)
  491. if constInfo.ADD_DEF_BONUS_ENABLE:
  492. defValue+=player.GetStatus(player.DEF_BONUS)
  493. return "%d" % (defValue)
  494.  
  495. def RefreshStatus(self):
  496. if self.isLoaded==0:
  497. return
  498.  
  499. try:
  500. self.GetChild("Level_Value").SetText(str(player.GetStatus(player.LEVEL)))
  501. self.GetChild("Exp_Value").SetText(str(player.GetEXP()))
  502. self.GetChild("RestExp_Value").SetText(str(player.GetStatus(player.NEXT_EXP) - player.GetStatus(player.EXP)))
  503. self.GetChild("HP_Value").SetText(str(player.GetStatus(player.HP)) + '/' + str(player.GetStatus(player.MAX_HP)))
  504. self.GetChild("SP_Value").SetText(str(player.GetStatus(player.SP)) + '/' + str(player.GetStatus(player.MAX_SP)))
  505.  
  506. self.GetChild("STR_Value").SetText(str(player.GetStatus(player.ST)))
  507. self.GetChild("DEX_Value").SetText(str(player.GetStatus(player.DX)))
  508. self.GetChild("HTH_Value").SetText(str(player.GetStatus(player.HT)))
  509. self.GetChild("INT_Value").SetText(str(player.GetStatus(player.IQ)))
  510.  
  511. self.GetChild("ATT_Value").SetText(self.__GetTotalAtkText())
  512. self.GetChild("DEF_Value").SetText(self.__GetTotalDefText())
  513.  
  514. self.GetChild("MATT_Value").SetText(self.__GetTotalMagAtkText())
  515. #self.GetChild("MATT_Value").SetText(str(player.GetStatus(player.MAG_ATT)))
  516.  
  517. self.GetChild("MDEF_Value").SetText(str(player.GetStatus(player.MAG_DEF)))
  518. self.GetChild("ASPD_Value").SetText(str(player.GetStatus(player.ATT_SPEED)))
  519. self.GetChild("MSPD_Value").SetText(str(player.GetStatus(player.MOVING_SPEED)))
  520. self.GetChild("CSPD_Value").SetText(str(player.GetStatus(player.CASTING_SPEED)))
  521. self.GetChild("ER_Value").SetText(str(player.GetStatus(player.EVADE_RATE)))
  522.  
  523. self.GetChild("Dif_spada_Value").SetText(str(self.Spada())) #Spada 29
  524. self.GetChild("Dif_spadone_Value").SetText(str(self.Spadone())) #Spadone 30
  525. self.GetChild("Dif_pugnale_Value").SetText(str(self.Pugnale())) #Pugnale 31
  526. self.GetChild("Res_magia_Value").SetText(str(self.ResMagia())) #Res Magia 37
  527. self.GetChild("Res_freccia_Value").SetText(str(self.Freccia())) #Freccia 34
  528. self.GetChild("Blocco_Value").SetText(str(self.Blocco())) #Res Veleno 41
  529. self.GetChild("Res_war_Value").SetText(str(self.ResWar())) #Res War 78
  530. self.GetChild("Res_Sura_Value").SetText(str(self.ResSura())) #Res Sura 80
  531. self.GetChild("Res_Ninja_Value").SetText(str(self.ResNinja())) #Res Ninja 79
  532. self.GetChild("Res_Shamy_Value").SetText(str(self.ResShamy())) #Res Shamy 81
  533. self.GetChild("Mezziuomini_Value").SetText(str(self.Mezzi()))#Mezzi 17
  534. self.GetChild("Danni_medi_Value").SetText(str(self.Medi()))#Medi 72
  535. self.GetChild("Danni_abi_Value").SetText(str(self.Abilita())) #Abi 71
  536. self.GetChild("Mostri_Value").SetText(str(self.Mostri())) # Vel Magia 9
  537. self.GetChild("Vs_zombie_Value").SetText(str(self.Zombie())) # Zombie 21
  538. self.GetChild("Critici_Value").SetText(str(self.Critici())) #Critici 15
  539. self.GetChild("Trafiggenti_Value").SetText(str(self.Trafi())) #Trafi 16
  540. self.GetChild("Rig_HP_Value").SetText(str(self.RigHP())) #Rig HP 10
  541. self.GetChild("Rig_MP_Value").SetText(str(self.RigMP())) #Rig MP 11
  542. self.GetChild("Veleno_Value").SetText(str(self.Avvelenamento())) #Avvelenamento 12
  543.  
  544.  
  545. except:
  546. #import exception
  547. #exception.Abort("CharacterWindow.RefreshStatus.BindObject")
  548. ## °ÔŔÓŔĚ Ć¨°Ü ąö¸˛
  549. pass
  550.  
  551. self.__RefreshStatusPlusButtonList()
  552. self.__RefreshStatusMinusButtonList()
  553. self.RefreshAlignment()
  554.  
  555. if self.refreshToolTip:
  556. self.refreshToolTip()
  557.  
  558. def __RefreshStatusPlusButtonList(self):
  559. if self.isLoaded==0:
  560. return
  561.  
  562. statusPlusPoint=player.GetStatus(player.STAT)
  563.  
  564. if statusPlusPoint>0:
  565. self.statusPlusValue.SetText(str(statusPlusPoint))
  566. self.statusPlusLabel.Show()
  567. self.ShowStatusPlusButtonList()
  568. else:
  569. self.statusPlusValue.SetText(str(0))
  570. self.statusPlusLabel.Hide()
  571. self.HideStatusPlusButtonList()
  572.  
  573. def __RefreshStatusMinusButtonList(self):
  574. if self.isLoaded==0:
  575. return
  576.  
  577. statusMinusPoint=self.__GetStatMinusPoint()
  578.  
  579. if statusMinusPoint>0:
  580. self.__ShowStatusMinusButtonList()
  581. else:
  582. self.__HideStatusMinusButtonList()
  583.  
  584. def RefreshAlignment(self):
  585. point, grade = player.GetAlignmentData()
  586.  
  587. import colorInfo
  588. COLOR_DICT = { 0 : colorInfo.TITLE_RGB_GOOD_4,
  589. 1 : colorInfo.TITLE_RGB_GOOD_3,
  590. 2 : colorInfo.TITLE_RGB_GOOD_2,
  591. 3 : colorInfo.TITLE_RGB_GOOD_1,
  592. 4 : colorInfo.TITLE_RGB_NORMAL,
  593. 5 : colorInfo.TITLE_RGB_EVIL_1,
  594. 6 : colorInfo.TITLE_RGB_EVIL_2,
  595. 7 : colorInfo.TITLE_RGB_EVIL_3,
  596. 8 : colorInfo.TITLE_RGB_EVIL_4, }
  597. colorList = COLOR_DICT.get(grade, colorInfo.TITLE_RGB_NORMAL)
  598. gradeColor = ui.GenerateColor(colorList[0], colorList[1], colorList[2])
  599.  
  600. self.toolTipAlignment.ClearToolTip()
  601. self.toolTipAlignment.AutoAppendTextLine(locale.TITLE_NAME_LIST[grade], gradeColor)
  602. self.toolTipAlignment.AutoAppendTextLine(locale.ALIGNMENT_NAME + str(point))
  603. self.toolTipAlignment.AlignHorizonalCenter()
  604.  
  605. def __ShowStatusMinusButtonList(self):
  606. for (stateMinusKey, statusMinusButton) in self.statusMinusButtonDict.items():
  607. statusMinusButton.Show()
  608.  
  609. def __HideStatusMinusButtonList(self):
  610. for (stateMinusKey, statusMinusButton) in self.statusMinusButtonDict.items():
  611. statusMinusButton.Hide()
  612.  
  613. def ShowStatusPlusButtonList(self):
  614. for (statePlusKey, statusPlusButton) in self.statusPlusButtonDict.items():
  615. statusPlusButton.Show()
  616.  
  617. def HideStatusPlusButtonList(self):
  618. for (statePlusKey, statusPlusButton) in self.statusPlusButtonDict.items():
  619. statusPlusButton.Hide()
  620.  
  621. def SelectSkill(self, skillSlotIndex):
  622.  
  623. mouseController = mouseModule.mouseController
  624.  
  625. if FALSE == mouseController.isAttached():
  626.  
  627. srcSlotIndex = self.__RealSkillSlotToSourceSlot(skillSlotIndex)
  628. selectedSkillIndex = player.GetSkillIndex(srcSlotIndex)
  629.  
  630. if skill.CanUseSkill(selectedSkillIndex):
  631.  
  632. if app.IsPressed(app.DIK_LCONTROL):
  633.  
  634. player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_SKILL, srcSlotIndex)
  635. return
  636.  
  637. mouseController.AttachObject(self, player.SLOT_TYPE_SKILL, srcSlotIndex, selectedSkillIndex)
  638.  
  639. else:
  640.  
  641. mouseController.DeattachObject()
  642.  
  643. def SelectEmptySlot(self, SlotIndex):
  644. mouseModule.mouseController.DeattachObject()
  645.  
  646. ## ToolTip
  647. def OverInItem(self, slotNumber):
  648.  
  649. if mouseModule.mouseController.isAttached():
  650. return
  651.  
  652. if 0 == self.toolTipSkill:
  653. return
  654.  
  655. srcSlotIndex = self.__RealSkillSlotToSourceSlot(slotNumber)
  656. skillIndex = player.GetSkillIndex(srcSlotIndex)
  657. skillLevel = player.GetSkillLevel(srcSlotIndex)
  658. skillGrade = player.GetSkillGrade(srcSlotIndex)
  659. skillType = skill.GetSkillType(skillIndex)
  660.  
  661. ## ACTIVE
  662. if skill.SKILL_TYPE_ACTIVE == skillType:
  663. overInSkillGrade = self.__GetSkillGradeFromSlot(slotNumber)
  664.  
  665. if overInSkillGrade == skill.SKILL_GRADE_COUNT-1 and skillGrade == skill.SKILL_GRADE_COUNT:
  666. self.toolTipSkill.SetSkillNew(srcSlotIndex, skillIndex, skillGrade, skillLevel)
  667. elif overInSkillGrade == skillGrade:
  668. self.toolTipSkill.SetSkillNew(srcSlotIndex, skillIndex, overInSkillGrade, skillLevel)
  669. else:
  670. self.toolTipSkill.SetSkillOnlyName(srcSlotIndex, skillIndex, overInSkillGrade)
  671.  
  672. else:
  673. self.toolTipSkill.SetSkillNew(srcSlotIndex, skillIndex, skillGrade, skillLevel)
  674.  
  675. def OverOutItem(self):
  676. if 0 != self.toolTipSkill:
  677. self.toolTipSkill.HideToolTip()
  678.  
  679. ## Quest
  680. def __SelectQuest(self, slotIndex):
  681. questIndex = quest.GetQuestIndex(self.questShowingStartIndex+slotIndex)
  682.  
  683. import event
  684. event.QuestButtonClick(-2147483648 + questIndex)
  685.  
  686. def RefreshQuest(self):
  687.  
  688. if self.isLoaded==0:
  689. return
  690.  
  691. questCount = quest.GetQuestCount()
  692. questRange = range(quest.QUEST_MAX_NUM)
  693.  
  694. if questCount > quest.QUEST_MAX_NUM:
  695. self.questScrollBar.Show()
  696. else:
  697. self.questScrollBar.Hide()
  698.  
  699. for i in questRange[:questCount]:
  700. (questName, questIcon, questCounterName, questCounterValue) = quest.GetQuestData(self.questShowingStartIndex+i)
  701.  
  702. self.questNameList[i].SetText(questName)
  703. self.questNameList[i].Show()
  704. self.questLastCountList[i].Show()
  705. self.questLastTimeList[i].Show()
  706.  
  707. if len(questCounterName) > 0:
  708. self.questLastCountList[i].SetText("%s : %d" % (questCounterName, questCounterValue))
  709. else:
  710. self.questLastCountList[i].SetText("")
  711.  
  712. ## Icon
  713. self.questSlot.SetSlot(i, i, 1, 1, questIcon)
  714.  
  715. for i in questRange[questCount:]:
  716. self.questNameList[i].Hide()
  717. self.questLastTimeList[i].Hide()
  718. self.questLastCountList[i].Hide()
  719. self.questSlot.ClearSlot(i)
  720. self.questSlot.HideSlotBaseImage(i)
  721.  
  722. self.__UpdateQuestClock()
  723.  
  724. def __UpdateQuestClock(self):
  725. if "QUEST" == self.state:
  726. # QUEST_LIMIT_COUNT_BUG_FIX
  727. for i in xrange(min(quest.GetQuestCount(), quest.QUEST_MAX_NUM)):
  728. # END_OF_QUEST_LIMIT_COUNT_BUG_FIX
  729. (lastName, lastTime) = quest.GetQuestLastTime(i)
  730.  
  731. clockText = locale.QUEST_UNLIMITED_TIME
  732. if len(lastName) > 0:
  733.  
  734. if lastTime <= 0:
  735. clockText = locale.QUEST_TIMEOVER
  736.  
  737. else:
  738. questLastMinute = lastTime / 60
  739. questLastSecond = lastTime % 60
  740.  
  741. clockText = lastName + " : "
  742.  
  743. if questLastMinute > 0:
  744. clockText += str(questLastMinute) + locale.QUEST_MIN
  745. if questLastSecond > 0:
  746. clockText += " "
  747.  
  748. if questLastSecond > 0:
  749. clockText += str(questLastSecond) + locale.QUEST_SEC
  750.  
  751. self.questLastTimeList[i].SetText(clockText)
  752.  
  753. def Spada(self):
  754. exsta = 69
  755. return player.GetStatus(exsta)
  756.  
  757. def Spadone(self):
  758. exsta = 70
  759. return player.GetStatus(exsta)
  760.  
  761. def Pugnale(self):
  762. exsta = 71
  763. return player.GetStatus(exsta)
  764.  
  765. def ResMagia(self):
  766. exsta = 77
  767. return player.GetStatus(exsta)
  768.  
  769. def Freccia(self):
  770. exsta = 74
  771. return player.GetStatus(exsta)
  772.  
  773. def Blocco(self):
  774. exsta = 67
  775. return player.GetStatus(exsta)
  776.  
  777. def ResWar(self):
  778. exsta = 59
  779. return player.GetStatus(exsta)
  780.  
  781. def ResSura(self):
  782. exsta = 61
  783. return player.GetStatus(exsta)
  784.  
  785. def ResNinja(self):
  786. exsta = 60
  787. return player.GetStatus(exsta)
  788.  
  789. def ResShamy(self):
  790. exsta = 62
  791. return player.GetStatus(exsta)
  792.  
  793. def Mezzi(self):
  794. exsta = 43
  795. return player.GetStatus(exsta)
  796.  
  797. def Medi(self):
  798. exsta = 121
  799. return player.GetStatus(exsta)
  800.  
  801. def Abilita(self):
  802. exsta = 122
  803. return player.GetStatus(exsta)
  804.  
  805. def Mostri(self):
  806. exsta = 53
  807. return player.GetStatus(exsta)
  808.  
  809. def Zombie(self):
  810. exsta = 47
  811. return player.GetStatus(exsta)
  812.  
  813. def Critici(self):
  814. exsta = 40
  815. return player.GetStatus(exsta)
  816.  
  817. def Trafi(self):
  818. exsta = 41
  819. return player.GetStatus(exsta)
  820.  
  821. def RigHP(self):
  822. exsta = 32
  823. return player.GetStatus(exsta)
  824.  
  825. def RigMP(self):
  826. exsta = 33
  827. return player.GetStatus(exsta)
  828.  
  829. def Avvelenamento(self):
  830. exsta = 37
  831. return player.GetStatus(exsta)
  832.  
  833. def __GetStatMinusPoint(self):
  834. POINT_STAT_RESET_COUNT = 112
  835. return player.GetStatus(POINT_STAT_RESET_COUNT)
  836.  
  837. def __OverInStatMinusButton(self, stat):
  838. try:
  839. self.__ShowStatToolTip(self.STAT_MINUS_DESCRIPTION[stat] % self.__GetStatMinusPoint())
  840. except KeyError:
  841. pass
  842.  
  843. self.refreshToolTip = lambda arg=stat: self.__OverInStatMinusButton(arg)
  844.  
  845. def __OverOutStatMinusButton(self):
  846. self.__HideStatToolTip()
  847. self.refreshToolTip = 0
  848.  
  849. def __OverInStatButton(self, stat):
  850. try:
  851. self.__ShowStatToolTip(self.STAT_DESCRIPTION[stat])
  852. except KeyError:
  853. pass
  854.  
  855. def __OverOutStatButton(self):
  856. self.__HideStatToolTip()
  857.  
  858. def __ShowStatToolTip(self, statDesc):
  859. self.toolTip.ClearToolTip()
  860. self.toolTip.AppendTextLine(statDesc)
  861. self.toolTip.Show()
  862.  
  863. def __HideStatToolTip(self):
  864. self.toolTip.Hide()
  865.  
  866. def OnPressEscapeKey(self):
  867. self.Close()
  868. return TRUE
  869.  
  870. def OnUpdate(self):
  871. self.__UpdateQuestClock()
  872.  
  873. ## Skill Process
  874. def __RefreshSkillPage(self, name, slotCount):
  875. global SHOW_LIMIT_SUPPORT_SKILL_LIST
  876.  
  877. skillPage = self.skillPageDict[name]
  878.  
  879. startSlotIndex = skillPage.GetStartIndex()
  880. if "ACTIVE" == name:
  881. if self.PAGE_HORSE == self.curSelectedSkillGroup:
  882. startSlotIndex += slotCount
  883.  
  884. getSkillType=skill.GetSkillType
  885. getSkillIndex=player.GetSkillIndex
  886. getSkillGrade=player.GetSkillGrade
  887. getSkillLevel=player.GetSkillLevel
  888. getSkillLevelUpPoint=skill.GetSkillLevelUpPoint
  889. getSkillMaxLevel=skill.GetSkillMaxLevel
  890. for i in xrange(slotCount+1):
  891.  
  892. slotIndex = i + startSlotIndex
  893. skillIndex = getSkillIndex(slotIndex)
  894.  
  895. for j in xrange(skill.SKILL_GRADE_COUNT):
  896. skillPage.ClearSlot(self.__GetRealSkillSlot(j, i))
  897.  
  898. if 0 == skillIndex:
  899. continue
  900.  
  901. skillGrade = getSkillGrade(slotIndex)
  902. skillLevel = getSkillLevel(slotIndex)
  903. skillType = getSkillType(skillIndex)
  904.  
  905. ## ˝Â¸¶ ˝şĹł żążÜ Ăł¸®
  906. if player.SKILL_INDEX_RIDING == skillIndex:
  907. if 1 == skillGrade:
  908. skillLevel += 19
  909. elif 2 == skillGrade:
  910. skillLevel += 29
  911. elif 3 == skillGrade:
  912. skillLevel = 40
  913.  
  914. skillPage.SetSkillSlotNew(slotIndex, skillIndex, max(skillLevel-1, 0), skillLevel)
  915. skillPage.SetSlotCount(slotIndex, skillLevel)
  916.  
  917. ## ACTIVE
  918. elif skill.SKILL_TYPE_ACTIVE == skillType:
  919. for j in xrange(skill.SKILL_GRADE_COUNT):
  920. realSlotIndex = self.__GetRealSkillSlot(j, slotIndex)
  921. skillPage.SetSkillSlotNew(realSlotIndex, skillIndex, j, skillLevel)
  922. skillPage.SetCoverButton(realSlotIndex)
  923.  
  924. if (skillGrade == skill.SKILL_GRADE_COUNT) and j == (skill.SKILL_GRADE_COUNT-1):
  925. skillPage.SetSlotCountNew(realSlotIndex, skillGrade, skillLevel)
  926. elif (not self.__CanUseSkillNow()) or (skillGrade != j):
  927. skillPage.SetSlotCount(realSlotIndex, 0)
  928. skillPage.DisableCoverButton(realSlotIndex)
  929. else:
  930. skillPage.SetSlotCountNew(realSlotIndex, skillGrade, skillLevel)
  931.  
  932. ## ±×żÜ
  933. else:
  934. if not SHOW_LIMIT_SUPPORT_SKILL_LIST or skillIndex in SHOW_LIMIT_SUPPORT_SKILL_LIST:
  935. realSlotIndex = self.__GetETCSkillRealSlotIndex(slotIndex)
  936. skillPage.SetSkillSlot(realSlotIndex, skillIndex, skillLevel)
  937. skillPage.SetSlotCountNew(realSlotIndex, skillGrade, skillLevel)
  938.  
  939. if skill.CanUseSkill(skillIndex):
  940. skillPage.SetCoverButton(realSlotIndex)
  941.  
  942. skillPage.RefreshSlot()
  943.  
  944.  
  945. def RefreshSkill(self):
  946.  
  947. if self.isLoaded==0:
  948. return
  949.  
  950. if self.__IsChangedHorseRidingSkillLevel():
  951. self.RefreshCharacter()
  952. return
  953.  
  954.  
  955. global SHOW_ONLY_ACTIVE_SKILL
  956. if SHOW_ONLY_ACTIVE_SKILL:
  957. self.__RefreshSkillPage("ACTIVE", self.ACTIVE_PAGE_SLOT_COUNT)
  958. else:
  959. self.__RefreshSkillPage("ACTIVE", self.ACTIVE_PAGE_SLOT_COUNT)
  960. self.__RefreshSkillPage("SUPPORT", self.SUPPORT_PAGE_SLOT_COUNT)
  961.  
  962. self.RefreshSkillPlusButtonList()
  963.  
  964. def CanShowPlusButton(self, skillIndex, skillLevel, curStatPoint):
  965.  
  966. ## ˝şĹłŔĚ ŔÖŔ¸¸é
  967. if 0 == skillIndex:
  968. return FALSE
  969.  
  970. ## ·ąş§ľ÷ Á¶°ÇŔ» ¸¸Á·ÇѴٸé
  971. if not skill.CanLevelUpSkill(skillIndex, skillLevel):
  972. return FALSE
  973.  
  974. return TRUE
  975.  
  976. def __RefreshSkillPlusButton(self, name):
  977. global HIDE_SUPPORT_SKILL_POINT
  978. if HIDE_SUPPORT_SKILL_POINT and "SUPPORT" == name:
  979. return
  980.  
  981. slotWindow = self.skillPageDict[name]
  982. slotWindow.HideAllSlotButton()
  983.  
  984. slotStatType = self.skillPageStatDict[name]
  985. if 0 == slotStatType:
  986. return
  987.  
  988. statPoint = player.GetStatus(slotStatType)
  989. startSlotIndex = slotWindow.GetStartIndex()
  990. if "HORSE" == name:
  991. startSlotIndex += self.ACTIVE_PAGE_SLOT_COUNT
  992.  
  993. if statPoint > 0:
  994. for i in xrange(self.PAGE_SLOT_COUNT):
  995. slotIndex = i + startSlotIndex
  996. skillIndex = player.GetSkillIndex(slotIndex)
  997. skillGrade = player.GetSkillGrade(slotIndex)
  998. skillLevel = player.GetSkillLevel(slotIndex)
  999.  
  1000. if skillIndex == 0:
  1001. continue
  1002. if skillGrade != 0:
  1003. continue
  1004.  
  1005. if name == "HORSE":
  1006. if player.GetStatus(player.LEVEL) >= skill.GetSkillLevelLimit(skillIndex):
  1007. if skillLevel < 20:
  1008. slotWindow.ShowSlotButton(self.__GetETCSkillRealSlotIndex(slotIndex))
  1009.  
  1010. else:
  1011. if "SUPPORT" == name:
  1012. if not SHOW_LIMIT_SUPPORT_SKILL_LIST or skillIndex in SHOW_LIMIT_SUPPORT_SKILL_LIST:
  1013. if self.CanShowPlusButton(skillIndex, skillLevel, statPoint):
  1014. slotWindow.ShowSlotButton(slotIndex)
  1015. else:
  1016. if self.CanShowPlusButton(skillIndex, skillLevel, statPoint):
  1017. slotWindow.ShowSlotButton(slotIndex)
  1018.  
  1019.  
  1020. def RefreshSkillPlusButtonList(self):
  1021.  
  1022. if self.isLoaded==0:
  1023. return
  1024.  
  1025. self.RefreshSkillPlusPointLabel()
  1026.  
  1027. if not self.__CanUseSkillNow():
  1028. return
  1029.  
  1030. try:
  1031. if self.PAGE_HORSE == self.curSelectedSkillGroup:
  1032. self.__RefreshSkillPlusButton("HORSE")
  1033. else:
  1034. self.__RefreshSkillPlusButton("ACTIVE")
  1035.  
  1036. self.__RefreshSkillPlusButton("SUPPORT")
  1037.  
  1038. except:
  1039. import exception
  1040. exception.Abort("CharacterWindow.RefreshSkillPlusButtonList.BindObject")
  1041.  
  1042. def RefreshSkillPlusPointLabel(self):
  1043. if self.isLoaded==0:
  1044. return
  1045.  
  1046. if self.PAGE_HORSE == self.curSelectedSkillGroup:
  1047. activeStatPoint = player.GetStatus(player.SKILL_HORSE)
  1048. self.activeSkillPointValue.SetText(str(activeStatPoint))
  1049.  
  1050. else:
  1051. activeStatPoint = player.GetStatus(player.SKILL_ACTIVE)
  1052. self.activeSkillPointValue.SetText(str(activeStatPoint))
  1053.  
  1054. supportStatPoint = max(0, player.GetStatus(player.SKILL_SUPPORT))
  1055. self.supportSkillPointValue.SetText(str(supportStatPoint))
  1056.  
  1057. ## Skill Level Up Button
  1058. def OnPressedSlotButton(self, slotNumber):
  1059. srcSlotIndex = self.__RealSkillSlotToSourceSlot(slotNumber)
  1060.  
  1061. skillIndex = player.GetSkillIndex(srcSlotIndex)
  1062. curLevel = player.GetSkillLevel(srcSlotIndex)
  1063. maxLevel = skill.GetSkillMaxLevel(skillIndex)
  1064.  
  1065. net.SendChatPacket("/skillup " + str(skillIndex))
  1066.  
  1067. ## Use Skill
  1068. def ClickSkillSlot(self, slotIndex):
  1069.  
  1070. srcSlotIndex = self.__RealSkillSlotToSourceSlot(slotIndex)
  1071. skillIndex = player.GetSkillIndex(srcSlotIndex)
  1072. skillType = skill.GetSkillType(skillIndex)
  1073.  
  1074. if not self.__CanUseSkillNow():
  1075. if skill.SKILL_TYPE_ACTIVE == skillType:
  1076. return
  1077.  
  1078. for slotWindow in self.skillPageDict.values():
  1079. if slotWindow.HasSlot(slotIndex):
  1080. if skill.CanUseSkill(skillIndex):
  1081. player.ClickSkillSlot(srcSlotIndex)
  1082. return
  1083.  
  1084. mouseModule.mouseController.DeattachObject()
  1085.  
  1086. ## FIXME : ˝şĹłŔ» »çżëÇßŔ»¶§ ˝˝·Ô ąřČŁ¸¦ °ˇÁö°í ÇŘ´ç ˝˝·ÔŔ» ĂŁľĆĽ­ ľ÷µĄŔĚĆ® ÇŃ´Ů.
  1087. ## ¸Ĺżě şŇÇŐ¸®. ±¸Á¶ ŔÚĂĽ¸¦ °łĽ±ÇŘľß Çҵí.
  1088. def OnUseSkill(self, slotIndex, coolTime):
  1089.  
  1090. skillIndex = player.GetSkillIndex(slotIndex)
  1091. skillType = skill.GetSkillType(skillIndex)
  1092.  
  1093. ## ACTIVE
  1094. if skill.SKILL_TYPE_ACTIVE == skillType:
  1095. skillGrade = player.GetSkillGrade(slotIndex)
  1096. slotIndex = self.__GetRealSkillSlot(skillGrade, slotIndex)
  1097. ## ETC
  1098. else:
  1099. slotIndex = self.__GetETCSkillRealSlotIndex(slotIndex)
  1100.  
  1101. for slotWindow in self.skillPageDict.values():
  1102. if slotWindow.HasSlot(slotIndex):
  1103. slotWindow.SetSlotCoolTime(slotIndex, coolTime)
  1104. return
  1105.  
  1106. def OnActivateSkill(self, slotIndex):
  1107.  
  1108. skillGrade = player.GetSkillGrade(slotIndex)
  1109. slotIndex = self.__GetRealSkillSlot(skillGrade, slotIndex)
  1110.  
  1111. for slotWindow in self.skillPageDict.values():
  1112. if slotWindow.HasSlot(slotIndex):
  1113. slotWindow.ActivateSlot(slotIndex)
  1114. return
  1115.  
  1116. def OnDeactivateSkill(self, slotIndex):
  1117.  
  1118. skillGrade = player.GetSkillGrade(slotIndex)
  1119. slotIndex = self.__GetRealSkillSlot(skillGrade, slotIndex)
  1120.  
  1121. for slotWindow in self.skillPageDict.values():
  1122. if slotWindow.HasSlot(slotIndex):
  1123. slotWindow.DeactivateSlot(slotIndex)
  1124. return
  1125.  
  1126. def __ShowJobToolTip(self):
  1127. self.toolTipJob.ShowToolTip()
  1128.  
  1129. def __HideJobToolTip(self):
  1130. self.toolTipJob.HideToolTip()
  1131.  
  1132. def __SetJobText(self, mainJob, subJob):
  1133. if player.GetStatus(player.LEVEL)<5:
  1134. subJob=0
  1135.  
  1136. if 949 == app.GetDefaultCodePage():
  1137. self.toolTipJob.ClearToolTip()
  1138.  
  1139. try:
  1140. jobInfoTitle=locale.JOBINFO_TITLE[mainJob][subJob]
  1141. jobInfoData=locale.JOBINFO_DATA_LIST[mainJob][subJob]
  1142. except IndexError:
  1143. print "uiCharacter.CharacterWindow.__SetJobText(mainJob=%d, subJob=%d)" % (mainJob, subJob)
  1144. return
  1145.  
  1146. self.toolTipJob.AutoAppendTextLine(jobInfoTitle)
  1147. self.toolTipJob.AppendSpace(5)
  1148.  
  1149. for jobInfoDataLine in jobInfoData:
  1150. self.toolTipJob.AutoAppendTextLine(jobInfoDataLine)
  1151.  
  1152. self.toolTipJob.AlignHorizonalCenter()
  1153.  
  1154. def __ShowAlignmentToolTip(self):
  1155. self.toolTipAlignment.ShowToolTip()
  1156.  
  1157. def __HideAlignmentToolTip(self):
  1158. self.toolTipAlignment.HideToolTip()
  1159.  
  1160. def RefreshCharacter(self):
  1161.  
  1162. if self.isLoaded==0:
  1163. return
  1164.  
  1165. ## Name
  1166. try:
  1167. characterName = player.GetName()
  1168. guildName = player.GetGuildName()
  1169. self.characterNameValue.SetText(characterName)
  1170. self.guildNameValue.SetText(guildName)
  1171. if not guildName:
  1172. if locale.IsARABIC():
  1173. self.characterNameSlot.SetPosition(190, 34)
  1174. else:
  1175. self.characterNameSlot.SetPosition(109, 34)
  1176.  
  1177. self.guildNameSlot.Hide()
  1178. else:
  1179. if locale.IsJAPAN():
  1180. self.characterNameSlot.SetPosition(143, 34)
  1181. else:
  1182. self.characterNameSlot.SetPosition(153, 34)
  1183. self.guildNameSlot.Show()
  1184. except:
  1185. import exception
  1186. exception.Abort("CharacterWindow.RefreshCharacter.BindObject")
  1187.  
  1188. race = net.GetMainActorRace()
  1189. group = net.GetMainActorSkillGroup()
  1190. empire = net.GetMainActorEmpire()
  1191.  
  1192. ## Job Text
  1193. job = chr.RaceToJob(race)
  1194. self.__SetJobText(job, group)
  1195.  
  1196. ## FaceImage
  1197. try:
  1198. faceImageName = FACE_IMAGE_DICT[race]
  1199.  
  1200. try:
  1201. self.faceImage.LoadImage(faceImageName)
  1202. except:
  1203. print "CharacterWindow.RefreshCharacter(race=%d, faceImageName=%s)" % (race, faceImageName)
  1204. self.faceImage.Hide()
  1205.  
  1206. except KeyError:
  1207. self.faceImage.Hide()
  1208.  
  1209. ## GroupName
  1210. self.__SetSkillGroupName(race, group)
  1211.  
  1212. ## Skill
  1213. if 0 == group:
  1214. self.__SelectSkillGroup(0)
  1215.  
  1216. else:
  1217. self.__SetSkillSlotData(race, group, empire)
  1218.  
  1219. if self.__CanUseHorseSkill():
  1220. self.__SelectSkillGroup(0)
  1221.  
  1222. def __SetSkillGroupName(self, race, group):
  1223.  
  1224. job = chr.RaceToJob(race)
  1225.  
  1226. if not self.SKILL_GROUP_NAME_DICT.has_key(job):
  1227. return
  1228.  
  1229. nameList = self.SKILL_GROUP_NAME_DICT[job]
  1230.  
  1231. if 0 == group:
  1232. self.skillGroupButton1.SetText(nameList[1])
  1233. self.skillGroupButton2.SetText(nameList[2])
  1234. self.skillGroupButton1.Show()
  1235. self.skillGroupButton2.Show()
  1236. self.activeSkillGroupName.Hide()
  1237.  
  1238. else:
  1239.  
  1240. if self.__CanUseHorseSkill():
  1241. self.activeSkillGroupName.Hide()
  1242. self.skillGroupButton1.SetText(nameList.get(group, "Noname"))
  1243. self.skillGroupButton2.SetText(locale.SKILL_GROUP_HORSE)
  1244. self.skillGroupButton1.Show()
  1245. self.skillGroupButton2.Show()
  1246.  
  1247. else:
  1248. self.activeSkillGroupName.SetText(nameList.get(group, "Noname"))
  1249. self.activeSkillGroupName.Show()
  1250. self.skillGroupButton1.Hide()
  1251. self.skillGroupButton2.Hide()
  1252.  
  1253. def __SetSkillSlotData(self, race, group, empire=0):
  1254.  
  1255. ## SkillIndex
  1256. playerSettingModule.RegisterSkill(race, group, empire)
  1257.  
  1258. ## Event
  1259. self.__SetSkillSlotEvent()
  1260.  
  1261. ## Refresh
  1262. self.RefreshSkill()
  1263.  
  1264. def __SelectSkillGroup(self, index):
  1265. for btn in self.skillGroupButton:
  1266. btn.SetUp()
  1267. self.skillGroupButton[index].Down()
  1268.  
  1269. if self.__CanUseHorseSkill():
  1270. if 0 == index:
  1271. index = net.GetMainActorSkillGroup()-1
  1272. elif 1 == index:
  1273. index = self.PAGE_HORSE
  1274.  
  1275. self.curSelectedSkillGroup = index
  1276. self.__SetSkillSlotData(net.GetMainActorRace(), index+1, net.GetMainActorEmpire())
  1277.  
  1278. def __CanUseSkillNow(self):
  1279. if 0 == net.GetMainActorSkillGroup():
  1280. return FALSE
  1281.  
  1282. return TRUE
  1283.  
  1284. def __CanUseHorseSkill(self):
  1285.  
  1286. slotIndex = player.GetSkillSlotIndex(player.SKILL_INDEX_RIDING)
  1287.  
  1288. if not slotIndex:
  1289. return FALSE
  1290.  
  1291. grade = player.GetSkillGrade(slotIndex)
  1292. level = player.GetSkillLevel(slotIndex)
  1293. if level < 0:
  1294. level *= -1
  1295. if grade >= 1 and level >= 1:
  1296. return TRUE
  1297.  
  1298. return FALSE
  1299.  
  1300. def __IsChangedHorseRidingSkillLevel(self):
  1301. ret = FALSE
  1302.  
  1303. if -1 == self.canUseHorseSkill:
  1304. self.canUseHorseSkill = self.__CanUseHorseSkill()
  1305.  
  1306. if self.canUseHorseSkill != self.__CanUseHorseSkill():
  1307. ret = TRUE
  1308.  
  1309. self.canUseHorseSkill = self.__CanUseHorseSkill()
  1310. return ret
  1311.  
  1312. def __GetRealSkillSlot(self, skillGrade, skillSlot):
  1313. return skillSlot + min(skill.SKILL_GRADE_COUNT-1, skillGrade)*skill.SKILL_GRADE_STEP_COUNT
  1314.  
  1315. def __GetETCSkillRealSlotIndex(self, skillSlot):
  1316. if skillSlot > 100:
  1317. return skillSlot
  1318. return skillSlot % self.ACTIVE_PAGE_SLOT_COUNT
  1319.  
  1320. def __RealSkillSlotToSourceSlot(self, realSkillSlot):
  1321. if realSkillSlot > 100:
  1322. return realSkillSlot
  1323. if self.PAGE_HORSE == self.curSelectedSkillGroup:
  1324. return realSkillSlot + self.ACTIVE_PAGE_SLOT_COUNT
  1325. return realSkillSlot % skill.SKILL_GRADE_STEP_COUNT
  1326.  
  1327. def __GetSkillGradeFromSlot(self, skillSlot):
  1328. return int(skillSlot / skill.SKILL_GRADE_STEP_COUNT)
  1329.  
  1330. def SelectSkillGroup(self, index):
  1331. self.__SelectSkillGroup(index)
  1332.  
  1333. def OnQuestScroll(self):
  1334. questCount = quest.GetQuestCount()
  1335. scrollLineCount = max(0, questCount - quest.QUEST_MAX_NUM)
  1336. startIndex = int(scrollLineCount * self.questScrollBar.GetPos())
  1337.  
  1338. if startIndex != self.questShowingStartIndex:
  1339. self.questShowingStartIndex = startIndex
  1340. self.RefreshQuest()
Add Comment
Please, Sign In to add comment