Nezuko1996

Untitled

Oct 16th, 2019
483
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.26 KB | None | 0 0
  1. import ui
  2. import localeInfo
  3. import chr
  4. import item
  5. import app
  6. import skill
  7. import player
  8. import uiToolTip
  9. import math
  10.  
  11. # WEDDING
  12. class LovePointImage(ui.ExpandedImageBox):
  13.  
  14. FILE_PATH = "d:/ymir work/ui/pattern/LovePoint/"
  15. FILE_DICT = {
  16. 0 : FILE_PATH + "01.dds",
  17. 1 : FILE_PATH + "02.dds",
  18. 2 : FILE_PATH + "02.dds",
  19. 3 : FILE_PATH + "03.dds",
  20. 4 : FILE_PATH + "04.dds",
  21. 5 : FILE_PATH + "05.dds",
  22. }
  23.  
  24. def __init__(self):
  25. ui.ExpandedImageBox.__init__(self)
  26.  
  27. self.loverName = ""
  28. self.lovePoint = 0
  29.  
  30. self.toolTip = uiToolTip.ToolTip(100)
  31. self.toolTip.HideToolTip()
  32.  
  33. def __del__(self):
  34. ui.ExpandedImageBox.__del__(self)
  35.  
  36. def SetLoverInfo(self, name, lovePoint):
  37. self.loverName = name
  38. self.lovePoint = lovePoint
  39. self.__Refresh()
  40.  
  41. def OnUpdateLovePoint(self, lovePoint):
  42. self.lovePoint = lovePoint
  43. self.__Refresh()
  44.  
  45. def __Refresh(self):
  46. self.lovePoint = max(0, self.lovePoint)
  47. self.lovePoint = min(100, self.lovePoint)
  48.  
  49. if 0 == self.lovePoint:
  50. loveGrade = 0
  51. else:
  52. loveGrade = self.lovePoint / 25 + 1
  53. fileName = self.FILE_DICT.get(loveGrade, self.FILE_PATH+"00.dds")
  54.  
  55. try:
  56. self.LoadImage(fileName)
  57. except:
  58. import dbg
  59. dbg.TraceError("LovePointImage.SetLoverInfo(lovePoint=%d) - LoadError %s" % (self.lovePoint, fileName))
  60.  
  61. self.SetScale(0.7, 0.7)
  62.  
  63. self.toolTip.ClearToolTip()
  64. self.toolTip.SetTitle(self.loverName)
  65. self.toolTip.AppendTextLine(localeInfo.AFF_LOVE_POINT % (self.lovePoint))
  66. self.toolTip.ResizeToolTip()
  67.  
  68. def OnMouseOverIn(self):
  69. self.toolTip.ShowToolTip()
  70.  
  71. def OnMouseOverOut(self):
  72. self.toolTip.HideToolTip()
  73. # END_OF_WEDDING
  74.  
  75.  
  76. class HorseImage(ui.ExpandedImageBox):
  77.  
  78. FILE_PATH = "d:/ymir work/ui/pattern/HorseState/"
  79.  
  80. FILE_DICT = {
  81. 00 : FILE_PATH+"00.dds",
  82. 01 : FILE_PATH+"00.dds",
  83. 02 : FILE_PATH+"00.dds",
  84. 03 : FILE_PATH+"00.dds",
  85. 10 : FILE_PATH+"10.dds",
  86. 11 : FILE_PATH+"11.dds",
  87. 12 : FILE_PATH+"12.dds",
  88. 13 : FILE_PATH+"13.dds",
  89. 20 : FILE_PATH+"20.dds",
  90. 21 : FILE_PATH+"21.dds",
  91. 22 : FILE_PATH+"22.dds",
  92. 23 : FILE_PATH+"23.dds",
  93. 30 : FILE_PATH+"30.dds",
  94. 31 : FILE_PATH+"31.dds",
  95. 32 : FILE_PATH+"32.dds",
  96. 33 : FILE_PATH+"33.dds",
  97. }
  98.  
  99. def __init__(self):
  100. ui.ExpandedImageBox.__init__(self)
  101.  
  102. #self.textLineList = []
  103. self.toolTip = uiToolTip.ToolTip(100)
  104. self.toolTip.HideToolTip()
  105.  
  106. def __GetHorseGrade(self, level):
  107. if 0 == level:
  108. return 0
  109.  
  110. return (level-1)/10 + 1
  111.  
  112. def SetState(self, level, health, battery):
  113. #self.textLineList=[]
  114. self.toolTip.ClearToolTip()
  115.  
  116. if level>0:
  117.  
  118. try:
  119. grade = self.__GetHorseGrade(level)
  120. self.__AppendText(localeInfo.LEVEL_LIST[grade])
  121. except IndexError:
  122. print "HorseImage.SetState(level=%d, health=%d, battery=%d) - Unknown Index" % (level, health, battery)
  123. return
  124.  
  125. try:
  126. healthName=localeInfo.HEALTH_LIST[health]
  127. if len(healthName)>0:
  128. self.__AppendText(healthName)
  129. except IndexError:
  130. print "HorseImage.SetState(level=%d, health=%d, battery=%d) - Unknown Index" % (level, health, battery)
  131. return
  132.  
  133. if health>0:
  134. if battery==0:
  135. self.__AppendText(localeInfo.NEEFD_REST)
  136.  
  137. try:
  138. fileName=self.FILE_DICT[health*10+battery]
  139. except KeyError:
  140. print "HorseImage.SetState(level=%d, health=%d, battery=%d) - KeyError" % (level, health, battery)
  141.  
  142. try:
  143. self.LoadImage(fileName)
  144. except:
  145. print "HorseImage.SetState(level=%d, health=%d, battery=%d) - LoadError %s" % (level, health, battery, fileName)
  146.  
  147. self.SetScale(0.7, 0.7)
  148.  
  149. def __AppendText(self, text):
  150.  
  151. self.toolTip.AppendTextLine(text)
  152. self.toolTip.ResizeToolTip()
  153.  
  154. #x=self.GetWidth()/2
  155. #textLine = ui.TextLine()
  156. #textLine.SetParent(self)
  157. #textLine.SetSize(0, 0)
  158. #textLine.SetOutline()
  159. #textLine.Hide()
  160. #textLine.SetPosition(x, 40+len(self.textLineList)*16)
  161. #textLine.SetText(text)
  162. #self.textLineList.append(textLine)
  163.  
  164. def OnMouseOverIn(self):
  165. #for textLine in self.textLineList:
  166. # textLine.Show()
  167.  
  168. self.toolTip.ShowToolTip()
  169.  
  170. def OnMouseOverOut(self):
  171. #for textLine in self.textLineList:
  172. # textLine.Hide()
  173.  
  174. self.toolTip.HideToolTip()
  175.  
  176.  
  177. # AUTO_POTION
  178. class AutoPotionImage(ui.ExpandedImageBox):
  179.  
  180. FILE_PATH_HP = "d:/ymir work/ui/pattern/auto_hpgauge/"
  181. FILE_PATH_SP = "d:/ymir work/ui/pattern/auto_spgauge/"
  182.  
  183. def __init__(self):
  184. ui.ExpandedImageBox.__init__(self)
  185.  
  186. self.loverName = ""
  187. self.lovePoint = 0
  188. self.potionType = player.AUTO_POTION_TYPE_HP
  189. self.filePath = ""
  190.  
  191. self.toolTip = uiToolTip.ToolTip(100)
  192. self.toolTip.HideToolTip()
  193.  
  194. def __del__(self):
  195. ui.ExpandedImageBox.__del__(self)
  196.  
  197. def SetPotionType(self, type):
  198. self.potionType = type
  199.  
  200. if player.AUTO_POTION_TYPE_HP == type:
  201. self.filePath = self.FILE_PATH_HP
  202. elif player.AUTO_POTION_TYPE_SP == type:
  203. self.filePath = self.FILE_PATH_SP
  204.  
  205.  
  206. def OnUpdateAutoPotionImage(self):
  207. self.__Refresh()
  208.  
  209. def __Refresh(self):
  210. print "__Refresh"
  211.  
  212. isActivated, currentAmount, totalAmount, slotIndex = player.GetAutoPotionInfo(self.potionType)
  213.  
  214. amountPercent = (float(currentAmount) / totalAmount) * 100.0
  215. grade = math.ceil(amountPercent / 20)
  216.  
  217. if 5.0 > amountPercent:
  218. grade = 0
  219.  
  220. if 80.0 < amountPercent:
  221. grade = 4
  222. if 90.0 < amountPercent:
  223. grade = 5
  224.  
  225. fmt = self.filePath + "%.2d.dds"
  226. fileName = fmt % grade
  227.  
  228. print self.potionType, amountPercent, fileName
  229.  
  230. try:
  231. self.LoadImage(fileName)
  232. except:
  233. import dbg
  234. dbg.TraceError("AutoPotionImage.__Refresh(potionType=%d) - LoadError %s" % (self.potionType, fileName))
  235.  
  236. self.SetScale(0.7, 0.7)
  237.  
  238. self.toolTip.ClearToolTip()
  239.  
  240. if player.AUTO_POTION_TYPE_HP == type:
  241. self.toolTip.SetTitle(localeInfo.TOOLTIP_AUTO_POTION_HP)
  242. else:
  243. self.toolTip.SetTitle(localeInfo.TOOLTIP_AUTO_POTION_SP)
  244.  
  245. self.toolTip.AppendTextLine(localeInfo.TOOLTIP_AUTO_POTION_REST % (amountPercent))
  246. self.toolTip.ResizeToolTip()
  247.  
  248. def OnMouseOverIn(self):
  249. self.toolTip.ShowToolTip()
  250.  
  251. def OnMouseOverOut(self):
  252. self.toolTip.HideToolTip()
  253. # END_OF_AUTO_POTION
  254.  
  255.  
  256. class AffectImage(ui.ExpandedImageBox):
  257.  
  258. def __init__(self):
  259. ui.ExpandedImageBox.__init__(self)
  260.  
  261. self.toolTipText = None
  262. self.isSkillAffect = True
  263. self.description = None
  264. self.endTime = 0
  265. self.affect = None
  266. self.isClocked = True
  267.  
  268. def SetAffect(self, affect):
  269. self.affect = affect
  270.  
  271. def GetAffect(self):
  272. return self.affect
  273.  
  274. def SetToolTipText(self, text, x = 0, y = -19):
  275.  
  276. if not self.toolTipText:
  277. textLine = ui.TextLine()
  278. textLine.SetParent(self)
  279. textLine.SetSize(0, 0)
  280. textLine.SetOutline()
  281. textLine.Hide()
  282. self.toolTipText = textLine
  283.  
  284. self.toolTipText.SetText(text)
  285. w, h = self.toolTipText.GetTextSize()
  286. self.toolTipText.SetPosition(max(0, x + self.GetWidth()/2 - w/2), y)
  287.  
  288. def SetDescription(self, description):
  289. self.description = description
  290.  
  291. def SetDuration(self, duration):
  292. self.endTime = 0
  293. if duration > 0:
  294. self.endTime = app.GetGlobalTimeStamp() + duration
  295.  
  296. def UpdateAutoPotionDescription(self):
  297.  
  298. potionType = 0
  299. if self.affect == chr.NEW_AFFECT_AUTO_HP_RECOVERY:
  300. potionType = player.AUTO_POTION_TYPE_HP
  301. else:
  302. potionType = player.AUTO_POTION_TYPE_SP
  303.  
  304. isActivated, currentAmount, totalAmount, slotIndex = player.GetAutoPotionInfo(potionType)
  305.  
  306. #print "UpdateAutoPotionDescription ", isActivated, currentAmount, totalAmount, slotIndex
  307.  
  308. amountPercent = 0.0
  309.  
  310. try:
  311. amountPercent = (float(currentAmount) / totalAmount) * 100.0
  312. except:
  313. amountPercent = 100.0
  314.  
  315. self.SetToolTipText(self.description % amountPercent, 0, 40)
  316.  
  317. def SetClock(self, isClocked):
  318. self.isClocked = isClocked
  319.  
  320. def UpdateDescription(self):
  321. if not self.isClocked:
  322. self.__UpdateDescription2()
  323. return
  324.  
  325. if not self.description:
  326. return
  327.  
  328. toolTip = self.description
  329. if self.endTime > 0:
  330. leftTime = localeInfo.SecondToDHM(self.endTime - app.GetGlobalTimeStamp())
  331. toolTip += " (%s : %s)" % (localeInfo.LEFT_TIME, leftTime)
  332. self.SetToolTipText(toolTip, 0, 40)
  333.  
  334. #독일버전에서 시간을 제거하기 위해서 사용
  335. def __UpdateDescription2(self):
  336. if not self.description:
  337. return
  338.  
  339. toolTip = self.description
  340. self.SetToolTipText(toolTip, 0, 40)
  341.  
  342. def SetSkillAffectFlag(self, flag):
  343. self.isSkillAffect = flag
  344.  
  345. def IsSkillAffect(self):
  346. return self.isSkillAffect
  347.  
  348. def OnMouseOverIn(self):
  349. if self.toolTipText:
  350. self.toolTipText.Show()
  351.  
  352. def OnMouseOverOut(self):
  353. if self.toolTipText:
  354. self.toolTipText.Hide()
  355.  
  356. class AffectShower(ui.Window):
  357.  
  358. MALL_DESC_IDX_START = 1000
  359.  
  360. BLEND_IDX_START = 2000
  361. WATER_IDX_START = 2200
  362. SITE_IDX_START = 2400
  363.  
  364. IMAGE_STEP = 25
  365. AFFECT_MAX_NUM = 32
  366.  
  367. INFINITE_AFFECT_DURATION = 0x1FFFFFFF
  368.  
  369. AFFECT_DATA_DICT = {
  370. chr.AFFECT_POISON : (localeInfo.SKILL_TOXICDIE, "d:/ymir work/ui/skill/common/affect/poison.sub"),
  371. chr.AFFECT_SLOW : (localeInfo.SKILL_SLOW, "d:/ymir work/ui/skill/common/affect/slow.sub"),
  372. chr.AFFECT_STUN : (localeInfo.SKILL_STUN, "d:/ymir work/ui/skill/common/affect/stun.sub"),
  373.  
  374. chr.AFFECT_ATT_SPEED_POTION : (localeInfo.SKILL_INC_ATKSPD, "icon/item/27102.tga"),
  375. chr.AFFECT_MOV_SPEED_POTION : (localeInfo.SKILL_INC_MOVSPD, "icon/item/27105.tga"),
  376. chr.AFFECT_FISH_MIND : (localeInfo.SKILL_FISHMIND, "icon/item/27610.tga"),
  377.  
  378. chr.AFFECT_JEONGWI : (localeInfo.SKILL_JEONGWI, "d:/ymir work/ui/skill/warrior/jeongwi_03.sub",),
  379. chr.AFFECT_GEOMGYEONG : (localeInfo.SKILL_GEOMGYEONG, "d:/ymir work/ui/skill/warrior/geomgyeong_03.sub",),
  380. chr.AFFECT_CHEONGEUN : (localeInfo.SKILL_CHEONGEUN, "d:/ymir work/ui/skill/warrior/cheongeun_03.sub",),
  381. chr.AFFECT_GYEONGGONG : (localeInfo.SKILL_GYEONGGONG, "d:/ymir work/ui/skill/assassin/gyeonggong_03.sub",),
  382. chr.AFFECT_EUNHYEONG : (localeInfo.SKILL_EUNHYEONG, "d:/ymir work/ui/skill/assassin/eunhyeong_03.sub",),
  383. chr.AFFECT_GWIGEOM : (localeInfo.SKILL_GWIGEOM, "d:/ymir work/ui/skill/sura/gwigeom_03.sub",),
  384. chr.AFFECT_GONGPO : (localeInfo.SKILL_GONGPO, "d:/ymir work/ui/skill/sura/gongpo_03.sub",),
  385. chr.AFFECT_JUMAGAP : (localeInfo.SKILL_JUMAGAP, "d:/ymir work/ui/skill/sura/jumagap_03.sub"),
  386. chr.AFFECT_HOSIN : (localeInfo.SKILL_HOSIN, "d:/ymir work/ui/skill/shaman/hosin_03.sub",),
  387. chr.AFFECT_BOHO : (localeInfo.SKILL_BOHO, "d:/ymir work/ui/skill/shaman/boho_03.sub",),
  388. chr.AFFECT_KWAESOK : (localeInfo.SKILL_KWAESOK, "d:/ymir work/ui/skill/shaman/kwaesok_03.sub",),
  389. chr.AFFECT_HEUKSIN : (localeInfo.SKILL_HEUKSIN, "d:/ymir work/ui/skill/sura/heuksin_03.sub",),
  390. chr.AFFECT_MUYEONG : (localeInfo.SKILL_MUYEONG, "d:/ymir work/ui/skill/sura/muyeong_03.sub",),
  391. chr.AFFECT_GICHEON : (localeInfo.SKILL_GICHEON, "d:/ymir work/ui/skill/shaman/gicheon_03.sub",),
  392. chr.AFFECT_JEUNGRYEOK : (localeInfo.SKILL_JEUNGRYEOK, "d:/ymir work/ui/skill/shaman/jeungryeok_03.sub",),
  393. chr.AFFECT_PABEOP : (localeInfo.SKILL_PABEOP, "d:/ymir work/ui/skill/sura/pabeop_03.sub",),
  394. chr.AFFECT_FALLEN_CHEONGEUN : (localeInfo.SKILL_CHEONGEUN, "d:/ymir work/ui/skill/warrior/cheongeun_03.sub",),
  395. 28 : (localeInfo.SKILL_FIRE, "d:/ymir work/ui/skill/sura/hwayeom_03.sub",),
  396. chr.AFFECT_CHINA_FIREWORK : (localeInfo.SKILL_POWERFUL_STRIKE, "icon/item/50107.tga",),
  397.  
  398. chr.NEW_AFFECT_EXP_BONUS : (localeInfo.TOOLTIP_MALL_EXPBONUS_STATIC, "icon/item/70005.tga",),
  399. chr.NEW_AFFECT_ITEM_BONUS : (localeInfo.TOOLTIP_MALL_ITEMBONUS_STATIC, "icon/item/70043.tga",),
  400. chr.NEW_AFFECT_SAFEBOX : (localeInfo.TOOLTIP_MALL_SAFEBOX, "icon/item/71009.tga",),
  401. chr.NEW_AFFECT_AUTOLOOT : (localeInfo.TOOLTIP_MALL_AUTOLOOT, "icon/item/70002.tga",),
  402. chr.NEW_AFFECT_FISH_MIND : (localeInfo.TOOLTIP_MALL_FISH_MIND, "icon/item/27610.tga",),
  403. chr.NEW_AFFECT_MARRIAGE_FAST : (localeInfo.TOOLTIP_MALL_MARRIAGE_FAST, "icon/item/71068.tga",),
  404. chr.NEW_AFFECT_GOLD_BONUS : (localeInfo.TOOLTIP_MALL_GOLDBONUS_STATIC, "icon/item/71017.tga",),
  405.  
  406. chr.NEW_AFFECT_NO_DEATH_PENALTY : (localeInfo.TOOLTIP_APPLY_NO_DEATH_PENALTY, "icon/item/71004.tga"),
  407. chr.NEW_AFFECT_SKILL_BOOK_BONUS : (localeInfo.TOOLTIP_APPLY_SKILL_BOOK_BONUS, "icon/item/71094.tga"),
  408. chr.NEW_AFFECT_SKILL_BOOK_NO_DELAY : (localeInfo.TOOLTIP_APPLY_SKILL_BOOK_NO_DELAY, "icon/item/71001.tga"),
  409.  
  410. chr.NEW_AFFECT_AUTO_HP_RECOVERY : (localeInfo.TOOLTIP_AUTO_POTION_REST, "icon/item/72726.tga"),
  411. chr.NEW_AFFECT_AUTO_SP_RECOVERY : (localeInfo.TOOLTIP_AUTO_POTION_REST, "icon/item/72730.tga"),
  412.  
  413. MALL_DESC_IDX_START+player.POINT_MALL_ATTBONUS : (localeInfo.TOOLTIP_MALL_ATTBONUS_STATIC, "d:/ymir work/ui/skill/common/affect/att_bonus.sub",),
  414. MALL_DESC_IDX_START+player.POINT_MALL_DEFBONUS : (localeInfo.TOOLTIP_MALL_DEFBONUS_STATIC, "d:/ymir work/ui/skill/common/affect/def_bonus.sub",),
  415. MALL_DESC_IDX_START+player.POINT_MALL_EXPBONUS : (localeInfo.TOOLTIP_MALL_EXPBONUS, "icon/item/71153.tga",),
  416. MALL_DESC_IDX_START+player.POINT_MALL_ITEMBONUS : (localeInfo.TOOLTIP_MALL_ITEMBONUS, "d:/ymir work/ui/skill/common/affect/item_bonus.sub",),
  417. MALL_DESC_IDX_START+player.POINT_MALL_GOLDBONUS : (localeInfo.TOOLTIP_MALL_GOLDBONUS, "d:/ymir work/ui/skill/common/affect/gold_bonus.sub",),
  418.  
  419. BLEND_IDX_START + 40 : ( localeInfo.TOOLTIP_APPLY_CRITICAL_PCT, "icon/item/50821.tga",),
  420. BLEND_IDX_START + 41 : ( localeInfo.TOOLTIP_APPLY_PENETRATE_PCT, "icon/item/50822.tga",),
  421. BLEND_IDX_START + 17 : ( localeInfo.TOOLTIP_ATT_SPEED, "icon/item/50823.tga",),
  422. BLEND_IDX_START + 77 : ( localeInfo.TOOLTIP_RESIST_MAGIC, "icon/item/50824.tga",),
  423. BLEND_IDX_START + 95 : ( localeInfo.TOOLTIP_ATT_GRADE, "icon/item/50825.tga",),
  424. BLEND_IDX_START + 96 : ( localeInfo.TOOLTIP_DEF_GRADE, "icon/item/50826.tga",),
  425.  
  426. WATER_IDX_START + 41 : ( localeInfo.TOOLTIP_APPLY_PENETRATE_PCT, "season1/icon/item/50813.tga",),
  427. WATER_IDX_START + 40 : ( localeInfo.TOOLTIP_APPLY_CRITICAL_PCT, "season1/icon/item/50814.tga",),
  428. WATER_IDX_START + 95 : ( localeInfo.TOOLTIP_ATT_GRADE, "season1/icon/item/50817.tga",),
  429. WATER_IDX_START + 96 : ( localeInfo.TOOLTIP_DEF_GRADE, "season1/icon/item/50818.tga",),
  430. WATER_IDX_START + 77 : ( localeInfo.TOOLTIP_MAGIC_DEF_GRADE, "season1/icon/item/50819.tga",),
  431. WATER_IDX_START + 17 : ( localeInfo.TOOLTIP_ATT_SPEED, "season1/icon/item/50820.tga",),
  432.  
  433. SITE_IDX_START + player.POINT_MAX_HP_PCT : (localeInfo.TOOLTIP_MAX_HP_PCT, "icon/item/71027.tga"),
  434. SITE_IDX_START + player.POINT_MAX_SP_PCT : (localeInfo.TOOLTIP_MAX_SP_PCT, "icon/item/71029.tga"),
  435. SITE_IDX_START + 93 : (localeInfo.TOOLTIP_MALL_ATTBONUS_STATIC, "icon/item/71028.tga",),
  436. SITE_IDX_START + player.POINT_MALL_DEFBONUS : (localeInfo.TOOLTIP_MALL_DEFBONUS_STATIC, "icon/item/71030.tga",),
  437. SITE_IDX_START + player.POINT_CRITICAL_PCT : (localeInfo.TOOLTIP_APPLY_CRITICAL_PCT, "icon/item/71044.tga"),
  438. SITE_IDX_START + player.POINT_PENETRATE_PCT : (localeInfo.TOOLTIP_APPLY_PENETRATE_PCT, "icon/item/71045.tga"),
  439. SITE_IDX_START + 43 : (localeInfo.TOOLTIP_APPLY_ATTBONUS_HUMAN, "icon/item/51002.tga",),
  440. }
  441. if app.ENABLE_DRAGON_SOUL_SYSTEM:
  442. # 용혼석 천, 지 덱.
  443. AFFECT_DATA_DICT[chr.NEW_AFFECT_DRAGON_SOUL_DECK1] = (localeInfo.TOOLTIP_DRAGON_SOUL_DECK1, "d:/ymir work/ui/dragonsoul/buff_ds_sky1.tga")
  444. AFFECT_DATA_DICT[chr.NEW_AFFECT_DRAGON_SOUL_DECK2] = (localeInfo.TOOLTIP_DRAGON_SOUL_DECK2, "d:/ymir work/ui/dragonsoul/buff_ds_land1.tga")
  445.  
  446.  
  447. def __init__(self):
  448. ui.Window.__init__(self)
  449.  
  450. self.serverPlayTime=0
  451. self.clientPlayTime=0
  452.  
  453. self.lastUpdateTime=0
  454. self.affectImageDict={}
  455. self.horseImage=None
  456. self.lovePointImage=None
  457. self.autoPotionImageHP = AutoPotionImage()
  458. self.autoPotionImageSP = AutoPotionImage()
  459. self.SetPosition(10, 10)
  460. self.Show()
  461.  
  462. def ClearAllAffects(self):
  463. self.horseImage=None
  464. self.lovePointImage=None
  465. self.affectImageDict={}
  466. self.__ArrangeImageList()
  467.  
  468. def ClearAffects(self): ## 스킬 이펙트만 없앱니다.
  469. self.living_affectImageDict={}
  470. for key, image in self.affectImageDict.items():
  471. if not image.IsSkillAffect():
  472. self.living_affectImageDict[key] = image
  473. self.affectImageDict = self.living_affectImageDict
  474. self.__ArrangeImageList()
  475.  
  476. def BINARY_NEW_AddAffect(self, type, pointIdx, value, duration):
  477.  
  478. print "BINARY_NEW_AddAffect", type, pointIdx, value, duration
  479.  
  480. if type < 500:
  481. return
  482.  
  483. if type == chr.NEW_AFFECT_MALL:
  484. if pointIdx == 116 or pointIdx == 117 or pointIdx == 118:
  485. affect = self.MALL_DESC_IDX_START + pointIdx
  486. else:
  487. affect = self.SITE_IDX_START + pointIdx
  488. elif type == 531:
  489. affect = self.BLEND_IDX_START + pointIdx
  490. elif type == 516:
  491. affect = self.WATER_IDX_START + pointIdx
  492. else:
  493. affect = type
  494.  
  495. if self.affectImageDict.has_key(affect):
  496. return
  497.  
  498. if not self.AFFECT_DATA_DICT.has_key(affect):
  499. return
  500.  
  501. ## 용신의 가호, 선인의 교훈은 Duration 을 0 으로 설정한다.
  502. if affect == chr.NEW_AFFECT_NO_DEATH_PENALTY or\
  503. affect == chr.NEW_AFFECT_SKILL_BOOK_BONUS or\
  504. affect == chr.NEW_AFFECT_AUTO_SP_RECOVERY or\
  505. affect == chr.NEW_AFFECT_AUTO_HP_RECOVERY or\
  506. affect == chr.NEW_AFFECT_SKILL_BOOK_NO_DELAY:
  507. duration = 0
  508.  
  509. affectData = self.AFFECT_DATA_DICT[affect]
  510. description = affectData[0]
  511. filename = affectData[1]
  512.  
  513. if pointIdx == player.POINT_MALL_ITEMBONUS or\
  514. pointIdx == player.POINT_MALL_GOLDBONUS:
  515. value = 1 + float(value) / 100.0
  516.  
  517. trashValue = 123
  518. #if affect == chr.NEW_AFFECT_AUTO_SP_RECOVERY or affect == chr.NEW_AFFECT_AUTO_HP_RECOVERY:
  519. if trashValue == 1:
  520. try:
  521. #image = AutoPotionImage()
  522. #image.SetParent(self)
  523. image = None
  524.  
  525. if affect == chr.NEW_AFFECT_AUTO_SP_RECOVERY:
  526. image.SetPotionType(player.AUTO_POTION_TYPE_SP)
  527. image = self.autoPotionImageSP
  528. #self.autoPotionImageSP = image;
  529. else:
  530. image.SetPotionType(player.AUTO_POTION_TYPE_HP)
  531. image = self.autoPotionImageHP
  532. #self.autoPotionImageHP = image;
  533.  
  534. image.SetParent(self)
  535. image.Show()
  536. image.OnUpdateAutoPotionImage()
  537.  
  538. self.affectImageDict[affect] = image
  539. self.__ArrangeImageList()
  540.  
  541. except Exception, e:
  542. print "except Aff auto potion affect ", e
  543. pass
  544.  
  545. else:
  546. if affect != chr.NEW_AFFECT_AUTO_SP_RECOVERY and affect != chr.NEW_AFFECT_AUTO_HP_RECOVERY:
  547. description = description(float(value))
  548.  
  549. try:
  550. print "Add affect %s" % affect
  551. image = AffectImage()
  552. image.SetParent(self)
  553. image.LoadImage(filename)
  554. image.SetDescription(description)
  555. image.SetDuration(duration)
  556. image.SetAffect(affect)
  557. if affect == chr.NEW_AFFECT_EXP_BONUS_EURO_FREE or\
  558. affect == chr.NEW_AFFECT_EXP_BONUS_EURO_FREE_UNDER_15 or\
  559. self.INFINITE_AFFECT_DURATION < duration:
  560. image.SetClock(False)
  561. image.UpdateDescription()
  562. elif affect == chr.NEW_AFFECT_AUTO_SP_RECOVERY or affect == chr.NEW_AFFECT_AUTO_HP_RECOVERY:
  563. image.UpdateAutoPotionDescription()
  564. else:
  565. image.UpdateDescription()
  566.  
  567. if affect == chr.NEW_AFFECT_DRAGON_SOUL_DECK1 or affect == chr.NEW_AFFECT_DRAGON_SOUL_DECK2:
  568. image.SetScale(1, 1)
  569. else:
  570. image.SetScale(0.7, 0.7)
  571. image.SetSkillAffectFlag(False)
  572. image.Show()
  573. self.affectImageDict[affect] = image
  574. self.__ArrangeImageList()
  575. except Exception, e:
  576. print "except Aff affect ", e
  577. pass
  578.  
  579. def BINARY_NEW_RemoveAffect(self, type, pointIdx):
  580. if type == chr.NEW_AFFECT_MALL:
  581. if pointIdx == 116 or pointIdx == 117 or pointIdx == 118:
  582. affect = self.MALL_DESC_IDX_START + pointIdx
  583. else:
  584. affect = self.SITE_IDX_START + pointIdx
  585. elif type == 531:
  586. affect = self.BLEND_IDX_START + pointIdx
  587. elif type == 516:
  588. affect = self.WATER_IDX_START + pointIdx
  589. else:
  590. affect = type
  591.  
  592. print "Remove Affect %s %s" % ( type , pointIdx )
  593. self.__RemoveAffect(affect)
  594. self.__ArrangeImageList()
  595.  
  596. def SetAffect(self, affect):
  597. self.__AppendAffect(affect)
  598. self.__ArrangeImageList()
  599.  
  600. def ResetAffect(self, affect):
  601. self.__RemoveAffect(affect)
  602. self.__ArrangeImageList()
  603.  
  604. def SetLoverInfo(self, name, lovePoint):
  605. image = LovePointImage()
  606. image.SetParent(self)
  607. image.SetLoverInfo(name, lovePoint)
  608. self.lovePointImage = image
  609. self.__ArrangeImageList()
  610.  
  611. def ShowLoverState(self):
  612. if self.lovePointImage:
  613. self.lovePointImage.Show()
  614. self.__ArrangeImageList()
  615.  
  616. def HideLoverState(self):
  617. if self.lovePointImage:
  618. self.lovePointImage.Hide()
  619. self.__ArrangeImageList()
  620.  
  621. def ClearLoverState(self):
  622. self.lovePointImage = None
  623. self.__ArrangeImageList()
  624.  
  625. def OnUpdateLovePoint(self, lovePoint):
  626. if self.lovePointImage:
  627. self.lovePointImage.OnUpdateLovePoint(lovePoint)
  628.  
  629. def SetHorseState(self, level, health, battery):
  630. if level==0:
  631. self.horseImage=None
  632. else:
  633. image = HorseImage()
  634. image.SetParent(self)
  635. image.SetState(level, health, battery)
  636. image.Show()
  637.  
  638. self.horseImage=image
  639. self.__ArrangeImageList()
  640.  
  641. def SetPlayTime(self, playTime):
  642. self.serverPlayTime = playTime
  643. self.clientPlayTime = app.GetTime()
  644.  
  645. if localeInfo.IsVIETNAM():
  646. image = PlayTimeImage()
  647. image.SetParent(self)
  648. image.SetPlayTime(playTime)
  649. image.Show()
  650.  
  651. self.playTimeImage=image
  652. self.__ArrangeImageList()
  653.  
  654. def __AppendAffect(self, affect):
  655.  
  656. if self.affectImageDict.has_key(affect):
  657. return
  658.  
  659. try:
  660. affectData = self.AFFECT_DATA_DICT[affect]
  661. except KeyError:
  662. return
  663.  
  664. name = affectData[0]
  665. filename = affectData[1]
  666.  
  667. skillIndex = player.AffectIndexToSkillIndex(affect)
  668. if 0 != skillIndex:
  669. name = skill.GetSkillName(skillIndex)
  670.  
  671. image = AffectImage()
  672. image.SetParent(self)
  673. image.SetSkillAffectFlag(True)
  674.  
  675. try:
  676. image.LoadImage(filename)
  677. except:
  678. pass
  679.  
  680. image.SetToolTipText(name, 0, 40)
  681. image.SetScale(0.7, 0.7)
  682. image.Show()
  683. self.affectImageDict[affect] = image
  684.  
  685. def __RemoveAffect(self, affect):
  686. """
  687. if affect == chr.NEW_AFFECT_AUTO_SP_RECOVERY:
  688. self.autoPotionImageSP.Hide()
  689.  
  690. if affect == chr.NEW_AFFECT_AUTO_HP_RECOVERY:
  691. self.autoPotionImageHP.Hide()
  692. """
  693.  
  694. if not self.affectImageDict.has_key(affect):
  695. print "__RemoveAffect %s ( No Affect )" % affect
  696. return
  697.  
  698. print "__RemoveAffect %s ( Affect )" % affect
  699. del self.affectImageDict[affect]
  700.  
  701. self.__ArrangeImageList()
  702.  
  703. def __ArrangeImageList(self):
  704.  
  705. xPos = 0
  706. yPos = 0
  707. AffectCount = 0
  708.  
  709. if self.lovePointImage:
  710. if self.lovePointImage.IsShow():
  711. self.lovePointImage.SetPosition(xPos, 0)
  712. xPos += self.IMAGE_STEP
  713. AffectCount += 1
  714.  
  715. if self.horseImage:
  716. self.horseImage.SetPosition(xPos, 0)
  717. xPos += self.IMAGE_STEP
  718. AffectCount += 1
  719.  
  720. for image in self.affectImageDict.values():
  721. image.SetPosition(xPos, yPos)
  722. xPos += self.IMAGE_STEP
  723. AffectCount += 1
  724. if AffectCount % 8 == 0:
  725. yPos += self.IMAGE_STEP
  726. xPos = 0
  727.  
  728. self.SetSize(8 * self.IMAGE_STEP, yPos + self.IMAGE_STEP)
  729.  
  730. def OnUpdate(self):
  731. try:
  732. if app.GetGlobalTime() - self.lastUpdateTime > 500:
  733. #if 0 < app.GetGlobalTime():
  734. self.lastUpdateTime = app.GetGlobalTime()
  735.  
  736. for image in self.affectImageDict.values():
  737. if image.GetAffect() == chr.NEW_AFFECT_AUTO_HP_RECOVERY or image.GetAffect() == chr.NEW_AFFECT_AUTO_SP_RECOVERY:
  738. image.UpdateAutoPotionDescription()
  739. continue
  740.  
  741. if not image.IsSkillAffect():
  742. image.UpdateDescription()
  743. except Exception, e:
  744. print "AffectShower::OnUpdate error : ", e
Advertisement
Add Comment
Please, Sign In to add comment