Guest User

Untitled

a guest
Jan 23rd, 2026
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 23.99 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.     IMAGE_STEP = 25
  360.     AFFECT_MAX_NUM = 32
  361.  
  362.     INFINITE_AFFECT_DURATION = 0x1FFFFFFF
  363.  
  364.     if app.RENEWAL_PICKUP_AFFECT:
  365.         pickupQuestionDialog = None
  366.  
  367.     AFFECT_DATA_DICT =  {
  368.             chr.AFFECT_POISON : (localeInfo.SKILL_TOXICDIE, "d:/ymir work/ui/skill/common/affect/poison.sub"),
  369.             chr.AFFECT_SLOW : (localeInfo.SKILL_SLOW, "d:/ymir work/ui/skill/common/affect/slow.sub"),
  370.             chr.AFFECT_STUN : (localeInfo.SKILL_STUN, "d:/ymir work/ui/skill/common/affect/stun.sub"),
  371.  
  372.             chr.AFFECT_ATT_SPEED_POTION : (localeInfo.SKILL_INC_ATKSPD, "d:/ymir work/ui/skill/common/affect/Increase_Attack_Speed.sub"),
  373.             chr.AFFECT_MOV_SPEED_POTION : (localeInfo.SKILL_INC_MOVSPD, "d:/ymir work/ui/skill/common/affect/Increase_Move_Speed.sub"),
  374.             chr.AFFECT_FISH_MIND : (localeInfo.SKILL_FISHMIND, "d:/ymir work/ui/skill/common/affect/fishmind.sub"),
  375.  
  376.             chr.AFFECT_JEONGWI : (localeInfo.SKILL_JEONGWI, "d:/ymir work/ui/skill/warrior/jeongwi_03.sub",),
  377.             chr.AFFECT_GEOMGYEONG : (localeInfo.SKILL_GEOMGYEONG, "d:/ymir work/ui/skill/warrior/geomgyeong_03.sub",),
  378.             chr.AFFECT_CHEONGEUN : (localeInfo.SKILL_CHEONGEUN, "d:/ymir work/ui/skill/warrior/cheongeun_03.sub",),
  379.             chr.AFFECT_GYEONGGONG : (localeInfo.SKILL_GYEONGGONG, "d:/ymir work/ui/skill/assassin/gyeonggong_03.sub",),
  380.             chr.AFFECT_EUNHYEONG : (localeInfo.SKILL_EUNHYEONG, "d:/ymir work/ui/skill/assassin/eunhyeong_03.sub",),
  381.             chr.AFFECT_GWIGEOM : (localeInfo.SKILL_GWIGEOM, "d:/ymir work/ui/skill/sura/gwigeom_03.sub",),
  382.             chr.AFFECT_GONGPO : (localeInfo.SKILL_GONGPO, "d:/ymir work/ui/skill/sura/gongpo_03.sub",),
  383.             chr.AFFECT_JUMAGAP : (localeInfo.SKILL_JUMAGAP, "d:/ymir work/ui/skill/sura/jumagap_03.sub"),
  384.             chr.AFFECT_HOSIN : (localeInfo.SKILL_HOSIN, "d:/ymir work/ui/skill/shaman/hosin_03.sub",),
  385.             chr.AFFECT_BOHO : (localeInfo.SKILL_BOHO, "d:/ymir work/ui/skill/shaman/boho_03.sub",),
  386.             chr.AFFECT_KWAESOK : (localeInfo.SKILL_KWAESOK, "d:/ymir work/ui/skill/shaman/kwaesok_03.sub",),
  387.             chr.AFFECT_HEUKSIN : (localeInfo.SKILL_HEUKSIN, "d:/ymir work/ui/skill/sura/heuksin_03.sub",),
  388.             chr.AFFECT_MUYEONG : (localeInfo.SKILL_MUYEONG, "d:/ymir work/ui/skill/sura/muyeong_03.sub",),
  389.             chr.AFFECT_GICHEON : (localeInfo.SKILL_GICHEON, "d:/ymir work/ui/skill/shaman/gicheon_03.sub",),
  390.             chr.AFFECT_JEUNGRYEOK : (localeInfo.SKILL_JEUNGRYEOK, "d:/ymir work/ui/skill/shaman/jeungryeok_03.sub",),
  391.             chr.AFFECT_PABEOP : (localeInfo.SKILL_PABEOP, "d:/ymir work/ui/skill/sura/pabeop_03.sub",),
  392.             chr.AFFECT_FALLEN_CHEONGEUN : (localeInfo.SKILL_CHEONGEUN, "d:/ymir work/ui/skill/warrior/cheongeun_03.sub",),
  393.             28 : (localeInfo.SKILL_FIRE, "d:/ymir work/ui/skill/sura/hwayeom_03.sub",),
  394.             chr.AFFECT_CHINA_FIREWORK : (localeInfo.SKILL_POWERFUL_STRIKE, "d:/ymir work/ui/skill/common/affect/powerfulstrike.sub",),
  395.  
  396.             #64 - END
  397.             chr.NEW_AFFECT_EXP_BONUS : (localeInfo.TOOLTIP_MALL_EXPBONUS_STATIC, "d:/ymir work/ui/skill/common/affect/exp_bonus.sub",),
  398.  
  399.             chr.NEW_AFFECT_ITEM_BONUS : (localeInfo.TOOLTIP_MALL_ITEMBONUS_STATIC, "d:/ymir work/ui/skill/common/affect/item_bonus.sub",),
  400.             chr.NEW_AFFECT_SAFEBOX : (localeInfo.TOOLTIP_MALL_SAFEBOX, "d:/ymir work/ui/skill/common/affect/safebox.sub",),
  401.             chr.NEW_AFFECT_AUTOLOOT : (localeInfo.TOOLTIP_MALL_AUTOLOOT, "d:/ymir work/ui/skill/common/affect/autoloot.sub",),
  402.             chr.NEW_AFFECT_FISH_MIND : (localeInfo.TOOLTIP_MALL_FISH_MIND, "d:/ymir work/ui/skill/common/affect/fishmind.sub",),
  403.             chr.NEW_AFFECT_MARRIAGE_FAST : (localeInfo.TOOLTIP_MALL_MARRIAGE_FAST, "d:/ymir work/ui/skill/common/affect/marriage_fast.sub",),
  404.             chr.NEW_AFFECT_GOLD_BONUS : (localeInfo.TOOLTIP_MALL_GOLDBONUS_STATIC, "d:/ymir work/ui/skill/common/affect/gold_bonus.sub",),
  405.  
  406.             chr.NEW_AFFECT_NO_DEATH_PENALTY : (localeInfo.TOOLTIP_APPLY_NO_DEATH_PENALTY, "d:/ymir work/ui/skill/common/affect/gold_premium.sub"),
  407.             chr.NEW_AFFECT_SKILL_BOOK_BONUS : (localeInfo.TOOLTIP_APPLY_SKILL_BOOK_BONUS, "d:/ymir work/ui/skill/common/affect/gold_premium.sub"),
  408.             chr.NEW_AFFECT_SKILL_BOOK_NO_DELAY : (localeInfo.TOOLTIP_APPLY_SKILL_BOOK_NO_DELAY, "d:/ymir work/ui/skill/common/affect/gold_premium.sub"),
  409.            
  410.             # ŔÚµżą°ľŕ hp, sp
  411.             chr.NEW_AFFECT_AUTO_HP_RECOVERY : (localeInfo.TOOLTIP_AUTO_POTION_REST, "d:/ymir work/ui/pattern/auto_hpgauge/05.dds"),        
  412.             chr.NEW_AFFECT_AUTO_SP_RECOVERY : (localeInfo.TOOLTIP_AUTO_POTION_REST, "d:/ymir work/ui/pattern/auto_spgauge/05.dds"),
  413.             #chr.NEW_AFFECT_AUTO_HP_RECOVERY : (localeInfo.TOOLTIP_AUTO_POTION_REST, "d:/ymir work/ui/skill/common/affect/gold_premium.sub"),          
  414.             #chr.NEW_AFFECT_AUTO_SP_RECOVERY : (localeInfo.TOOLTIP_AUTO_POTION_REST, "d:/ymir work/ui/skill/common/affect/gold_bonus.sub"),        
  415.  
  416.             MALL_DESC_IDX_START+player.POINT_MALL_ATTBONUS : (localeInfo.TOOLTIP_MALL_ATTBONUS_STATIC, "d:/ymir work/ui/skill/common/affect/att_bonus.sub",),
  417.             MALL_DESC_IDX_START+player.POINT_MALL_DEFBONUS : (localeInfo.TOOLTIP_MALL_DEFBONUS_STATIC, "d:/ymir work/ui/skill/common/affect/def_bonus.sub",),
  418.             MALL_DESC_IDX_START+player.POINT_MALL_EXPBONUS : (localeInfo.TOOLTIP_MALL_EXPBONUS, "d:/ymir work/ui/skill/common/affect/exp_bonus.sub",),
  419.             MALL_DESC_IDX_START+player.POINT_MALL_ITEMBONUS : (localeInfo.TOOLTIP_MALL_ITEMBONUS, "d:/ymir work/ui/skill/common/affect/item_bonus.sub",),
  420.             MALL_DESC_IDX_START+player.POINT_MALL_GOLDBONUS : (localeInfo.TOOLTIP_MALL_GOLDBONUS, "d:/ymir work/ui/skill/common/affect/gold_bonus.sub",),
  421.             MALL_DESC_IDX_START+player.POINT_CRITICAL_PCT : (localeInfo.TOOLTIP_APPLY_CRITICAL_PCT,"d:/ymir work/ui/skill/common/affect/critical.sub"),
  422.             MALL_DESC_IDX_START+player.POINT_PENETRATE_PCT : (localeInfo.TOOLTIP_APPLY_PENETRATE_PCT, "d:/ymir work/ui/skill/common/affect/gold_premium.sub"),
  423.             MALL_DESC_IDX_START+player.POINT_MAX_HP_PCT : (localeInfo.TOOLTIP_MAX_HP_PCT, "d:/ymir work/ui/skill/common/affect/gold_premium.sub"),
  424.             MALL_DESC_IDX_START+player.POINT_MAX_SP_PCT : (localeInfo.TOOLTIP_MAX_SP_PCT, "d:/ymir work/ui/skill/common/affect/gold_premium.sub"), 
  425.  
  426.             MALL_DESC_IDX_START+player.POINT_PC_BANG_EXP_BONUS : (localeInfo.TOOLTIP_MALL_EXPBONUS_P_STATIC, "d:/ymir work/ui/skill/common/affect/EXP_Bonus_p_on.sub",),
  427.             MALL_DESC_IDX_START+player.POINT_PC_BANG_DROP_BONUS: (localeInfo.TOOLTIP_MALL_ITEMBONUS_P_STATIC, "d:/ymir work/ui/skill/common/affect/Item_Bonus_p_on.sub",),
  428.     }
  429.     if app.RENEWAL_PICKUP_AFFECT:
  430.         AFFECT_DATA_DICT[chr.NEW_AFFECT_PICKUP_ENABLE] =  (localeInfo.NEW_AFFECT_PICKUP_ENABLE, "icon/affectshower/pickup_active.tga")
  431.         AFFECT_DATA_DICT[chr.NEW_AFFECT_PICKUP_DEACTIVE] =  (localeInfo.NEW_AFFECT_PICKUP_DEACTIVE, "icon/affectshower/pickup_deactive.tga")
  432.  
  433.     if app.ENABLE_DRAGON_SOUL_SYSTEM:
  434.         # żëČĄĽ® õ, Áö µ¦.
  435.         AFFECT_DATA_DICT[chr.NEW_AFFECT_DRAGON_SOUL_DECK1] = (localeInfo.TOOLTIP_DRAGON_SOUL_DECK1, "d:/ymir work/ui/dragonsoul/buff_ds_sky1.tga")
  436.         AFFECT_DATA_DICT[chr.NEW_AFFECT_DRAGON_SOUL_DECK2] = (localeInfo.TOOLTIP_DRAGON_SOUL_DECK2, "d:/ymir work/ui/dragonsoul/buff_ds_land1.tga")
  437.  
  438.     def __init__(self):
  439.         ui.Window.__init__(self)
  440.  
  441.         self.serverPlayTime=0
  442.         self.clientPlayTime=0
  443.        
  444.         self.lastUpdateTime=0
  445.         self.affectImageDict={}
  446.         self.horseImage=None
  447.         self.lovePointImage=None
  448.         self.autoPotionImageHP = AutoPotionImage()
  449.         self.autoPotionImageSP = AutoPotionImage()
  450.         self.SetPosition(10, 10)
  451.         self.Show()
  452.  
  453.     def ClearAllAffects(self):
  454.         self.horseImage=None
  455.         self.lovePointImage=None
  456.         self.affectImageDict={}
  457.         self.__ArrangeImageList()
  458.  
  459.     def ClearAffects(self): ## ˝şĹł ŔĚĆĺĆ®¸¸ ľřľŰ´Ď´Ů.
  460.         self.living_affectImageDict={}
  461.         for key, image in self.affectImageDict.items():
  462.             if not image.IsSkillAffect():
  463.                 self.living_affectImageDict[key] = image
  464.         self.affectImageDict = self.living_affectImageDict
  465.         self.__ArrangeImageList()
  466.  
  467.     def BINARY_NEW_AddAffect(self, type, pointIdx, value, duration):
  468.  
  469.         print "BINARY_NEW_AddAffect", type, pointIdx, value, duration
  470.  
  471.         if type < 500:
  472.             return
  473.  
  474.         if type == chr.NEW_AFFECT_MALL:
  475.             affect = self.MALL_DESC_IDX_START + pointIdx
  476.         else:
  477.             affect = type
  478.  
  479.         if self.affectImageDict.has_key(affect):
  480.             return
  481.  
  482.         if not self.AFFECT_DATA_DICT.has_key(affect):
  483.             return
  484.  
  485.         ## żë˝ĹŔÇ °ˇČŁ, Ľ±ŔÎŔÇ ±łČĆŔş Duration Ŕ» 0 Ŕ¸·Î ĽłÁ¤ÇŃ´Ů.
  486.         if affect == chr.NEW_AFFECT_NO_DEATH_PENALTY or\
  487.            affect == chr.NEW_AFFECT_SKILL_BOOK_BONUS or\
  488.            affect == chr.NEW_AFFECT_AUTO_SP_RECOVERY or\
  489.            affect == chr.NEW_AFFECT_AUTO_HP_RECOVERY or\
  490.            affect == chr.NEW_AFFECT_SKILL_BOOK_NO_DELAY:
  491.             duration = 0
  492.  
  493.         affectData = self.AFFECT_DATA_DICT[affect]
  494.         description = affectData[0]
  495.         filename = affectData[1]
  496.  
  497.         if pointIdx == player.POINT_MALL_ITEMBONUS or\
  498.            pointIdx == player.POINT_MALL_GOLDBONUS:
  499.             value = 1 + float(value) / 100.0
  500.  
  501.         trashValue = 123
  502.         #if affect == chr.NEW_AFFECT_AUTO_SP_RECOVERY or affect == chr.NEW_AFFECT_AUTO_HP_RECOVERY:
  503.         if trashValue == 1:
  504.             try:
  505.                 #image = AutoPotionImage()
  506.                 #image.SetParent(self)
  507.                 image = None
  508.                
  509.                 if affect == chr.NEW_AFFECT_AUTO_SP_RECOVERY:
  510.                     image.SetPotionType(player.AUTO_POTION_TYPE_SP)
  511.                     image = self.autoPotionImageSP
  512.                     #self.autoPotionImageSP = image;
  513.                 else:
  514.                     image.SetPotionType(player.AUTO_POTION_TYPE_HP)
  515.                     image = self.autoPotionImageHP
  516.                     #self.autoPotionImageHP = image;
  517.                
  518.                 image.SetParent(self)
  519.                 image.Show()
  520.                 image.OnUpdateAutoPotionImage()
  521.                
  522.                 self.affectImageDict[affect] = image
  523.                 self.__ArrangeImageList()
  524.                
  525.             except Exception, e:
  526.                 print "except Aff auto potion affect ", e
  527.                 pass               
  528.            
  529.         else:
  530.             if affect != chr.NEW_AFFECT_AUTO_SP_RECOVERY and affect != chr.NEW_AFFECT_AUTO_HP_RECOVERY:
  531.                 description = description(float(value))
  532.         if app.RENEWAL_PICKUP_AFFECT:
  533.             if affect == chr.NEW_AFFECT_PICKUP_ENABLE or affect == chr.NEW_AFFECT_PICKUP_DEACTIVE:
  534.                 image.SetEvent(ui.__mem_func__(self.__OnClickPickup),"mouse_click", affect)
  535.             try:
  536.                 print "Add affect %s" % affect
  537.                 image = AffectImage()
  538.                 image.SetParent(self)
  539.                 image.LoadImage(filename)
  540.                 image.SetDescription(description)
  541.                 image.SetDuration(duration)
  542.                 image.SetAffect(affect)
  543.                 if affect == chr.NEW_AFFECT_EXP_BONUS_EURO_FREE or\
  544.                     affect == chr.NEW_AFFECT_EXP_BONUS_EURO_FREE_UNDER_15 or\
  545.                     self.INFINITE_AFFECT_DURATION < duration:
  546.                     image.SetClock(FALSE)
  547.                     image.UpdateDescription()
  548.                 elif affect == chr.NEW_AFFECT_AUTO_SP_RECOVERY or affect == chr.NEW_AFFECT_AUTO_HP_RECOVERY:
  549.                     image.UpdateAutoPotionDescription()
  550.                 else:
  551.                     image.UpdateDescription()
  552.                    
  553.                 if affect == chr.NEW_AFFECT_DRAGON_SOUL_DECK1 or affect == chr.NEW_AFFECT_DRAGON_SOUL_DECK2:
  554.                     image.SetScale(1, 1)
  555.                 else:
  556.                     image.SetScale(0.7, 0.7)
  557.                 image.SetSkillAffectFlag(FALSE)
  558.                 image.Show()
  559.                 self.affectImageDict[affect] = image
  560.                 self.__ArrangeImageList()
  561.             except Exception, e:
  562.                 print "except Aff affect ", e
  563.                 pass
  564.  
  565.     if app.RENEWAL_PICKUP_AFFECT:
  566.         def OnChangePickup(self, answer):
  567.             if not self.pickupQuestionDialog:
  568.                 return
  569.             if answer:
  570.                 net.SendChatPacket("/pickup_affect")
  571.             self.pickupQuestionDialog.Close()
  572.             self.pickupQuestionDialog = None
  573.         def __OnClickPickup(self, emptyArg, affect):
  574.             if self.pickupQuestionDialog:
  575.                 self.pickupQuestionDialog.Close()
  576.             pickupQuestionDialog = uiCommon.QuestionDialog()
  577.             pickupQuestionDialog.SetText(localeInfo.PICKUP_DEACTIVE_DIALOG if chr.NEW_AFFECT_PICKUP_ENABLE else localeInfo.PICKUP_ACTIVE_DIALOG)
  578.             pickupQuestionDialog.SetAcceptEvent(lambda arg = True: self.OnChangePickup(arg))
  579.             pickupQuestionDialog.SetCancelEvent(lambda arg = False: self.OnChangePickup(arg))
  580.             pickupQuestionDialog.Open()
  581.             self.pickupQuestionDialog = pickupQuestionDialog
  582.  
  583.     def BINARY_NEW_RemoveAffect(self, type, pointIdx):
  584.         if type == chr.NEW_AFFECT_MALL:
  585.             affect = self.MALL_DESC_IDX_START + pointIdx
  586.         else:
  587.             affect = type
  588.    
  589.         print "Remove Affect %s %s" % ( type , pointIdx )
  590.         self.__RemoveAffect(affect)
  591.         self.__ArrangeImageList()
  592.  
  593.     def SetAffect(self, affect):
  594.         self.__AppendAffect(affect)
  595.         self.__ArrangeImageList()
  596.  
  597.     def ResetAffect(self, affect):
  598.         self.__RemoveAffect(affect)
  599.         self.__ArrangeImageList()
  600.  
  601.     def SetLoverInfo(self, name, lovePoint):
  602.         image = LovePointImage()
  603.         image.SetParent(self)
  604.         image.SetLoverInfo(name, lovePoint)
  605.         self.lovePointImage = image
  606.         self.__ArrangeImageList()
  607.  
  608.     def ShowLoverState(self):
  609.         if self.lovePointImage:
  610.             self.lovePointImage.Show()
  611.             self.__ArrangeImageList()
  612.  
  613.     def HideLoverState(self):
  614.         if self.lovePointImage:
  615.             self.lovePointImage.Hide()
  616.             self.__ArrangeImageList()
  617.  
  618.     def ClearLoverState(self):
  619.         self.lovePointImage = None
  620.         self.__ArrangeImageList()
  621.  
  622.     def OnUpdateLovePoint(self, lovePoint):
  623.         if self.lovePointImage:
  624.             self.lovePointImage.OnUpdateLovePoint(lovePoint)
  625.  
  626.     def SetHorseState(self, level, health, battery):
  627.         if level==0:
  628.             self.horseImage=None
  629.         else:
  630.             image = HorseImage()
  631.             image.SetParent(self)
  632.             image.SetState(level, health, battery)
  633.             image.Show()
  634.  
  635.             self.horseImage=image
  636.             self.__ArrangeImageList()
  637.  
  638.     def SetPlayTime(self, playTime):
  639.         self.serverPlayTime = playTime
  640.         self.clientPlayTime = app.GetTime()
  641.        
  642.         if localeInfo.IsVIETNAM():     
  643.             image = PlayTimeImage()
  644.             image.SetParent(self)
  645.             image.SetPlayTime(playTime)
  646.             image.Show()
  647.  
  648.             self.playTimeImage=image
  649.             self.__ArrangeImageList()
  650.  
  651.     def __AppendAffect(self, affect):
  652.  
  653.         if self.affectImageDict.has_key(affect):
  654.             return
  655.  
  656.         try:
  657.             affectData = self.AFFECT_DATA_DICT[affect]
  658.         except KeyError:
  659.             return
  660.  
  661.         name = affectData[0]
  662.         filename = affectData[1]
  663.  
  664.         skillIndex = player.AffectIndexToSkillIndex(affect)
  665.         if 0 != skillIndex:
  666.             name = skill.GetSkillName(skillIndex)
  667.  
  668.         image = AffectImage()
  669.         image.SetParent(self)
  670.         image.SetSkillAffectFlag(TRUE)
  671.  
  672.         try:
  673.             image.LoadImage(filename)
  674.         except:
  675.             pass
  676.  
  677.         image.SetToolTipText(name, 0, 40)
  678.         image.SetScale(0.7, 0.7)
  679.         image.Show()
  680.         self.affectImageDict[affect] = image
  681.  
  682.     def __RemoveAffect(self, affect):
  683.         """
  684.         if affect == chr.NEW_AFFECT_AUTO_SP_RECOVERY:
  685.             self.autoPotionImageSP.Hide()
  686.  
  687.         if affect == chr.NEW_AFFECT_AUTO_HP_RECOVERY:
  688.             self.autoPotionImageHP.Hide()
  689.         """
  690.            
  691.         if not self.affectImageDict.has_key(affect):
  692.             print "__RemoveAffect %s ( No Affect )" % affect
  693.             return
  694.  
  695.         print "__RemoveAffect %s ( Affect )" % affect
  696.         del self.affectImageDict[affect]
  697.        
  698.         self.__ArrangeImageList()
  699.  
  700.     def __ArrangeImageList(self):
  701.  
  702.         width = len(self.affectImageDict) * self.IMAGE_STEP
  703.         if self.lovePointImage:
  704.             width+=self.IMAGE_STEP
  705.         if self.horseImage:
  706.             width+=self.IMAGE_STEP
  707.  
  708.         self.SetSize(width, 26)
  709.  
  710.         xPos = 0
  711.  
  712.         if self.lovePointImage:
  713.             if self.lovePointImage.IsShow():
  714.                 self.lovePointImage.SetPosition(xPos, 0)
  715.                 xPos += self.IMAGE_STEP
  716.  
  717.         if self.horseImage:
  718.             self.horseImage.SetPosition(xPos, 0)
  719.             xPos += self.IMAGE_STEP
  720.  
  721.         for image in self.affectImageDict.values():
  722.             image.SetPosition(xPos, 0)
  723.             xPos += self.IMAGE_STEP
  724.  
  725.     def OnUpdate(self):    
  726.         try:
  727.             if app.GetGlobalTime() - self.lastUpdateTime > 500:
  728.             #if 0 < app.GetGlobalTime():
  729.                 self.lastUpdateTime = app.GetGlobalTime()
  730.  
  731.                 for image in self.affectImageDict.values():
  732.                     if image.GetAffect() == chr.NEW_AFFECT_AUTO_HP_RECOVERY or image.GetAffect() == chr.NEW_AFFECT_AUTO_SP_RECOVERY:
  733.                         image.UpdateAutoPotionDescription()
  734.                         continue
  735.                        
  736.                     if not image.IsSkillAffect():
  737.                         image.UpdateDescription()
  738.         except Exception, e:
  739.             print "AffectShower::OnUpdate error : ", e
  740.  
  741.  
Advertisement
Add Comment
Please, Sign In to add comment