Advertisement
deadx2

Untitled

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