Advertisement
Guest User

uitooltip.py

a guest
Jan 25th, 2016
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 86.02 KB | None | 0 0
  1. import dbg
  2. import player
  3. import item
  4. import grp
  5. import wndMgr
  6. import skill
  7. import shop
  8. import exchange
  9. import grpText
  10. import safebox
  11. import localeInfo
  12. import app
  13. import background
  14. import nonplayer
  15. import chr
  16.  
  17. import ui
  18. import mouseModule
  19. import constInfo
  20.  
  21. WARP_SCROLLS = [22011, 22000, 22010]
  22.  
  23. DESC_DEFAULT_MAX_COLS = 26
  24. DESC_WESTERN_MAX_COLS = 35
  25. DESC_WESTERN_MAX_WIDTH = 220
  26.  
  27. def chop(n):
  28.     return round(n - 0.5, 1)
  29.  
  30. def SplitDescription(desc, limit):
  31.     total_tokens = desc.split()
  32.     line_tokens = []
  33.     line_len = 0
  34.     lines = []
  35.     for token in total_tokens:
  36.         if "|" in token:
  37.             sep_pos = token.find("|")
  38.             line_tokens.append(token[:sep_pos])
  39.  
  40.             lines.append(" ".join(line_tokens))
  41.             line_len = len(token) - (sep_pos + 1)
  42.             line_tokens = [token[sep_pos+1:]]
  43.         else:
  44.             line_len += len(token)
  45.             if len(line_tokens) + line_len > limit:
  46.                 lines.append(" ".join(line_tokens))
  47.                 line_len = len(token)
  48.                 line_tokens = [token]
  49.             else:
  50.                 line_tokens.append(token)
  51.    
  52.     if line_tokens:
  53.         lines.append(" ".join(line_tokens))
  54.  
  55.     return lines
  56.  
  57. ###################################################################################################
  58. ## ToolTip
  59. ##
  60. ##   NOTE : ??? Item? Skill? ???? ?? ?????
  61. ##          ??? ??? ??? ?? ??
  62. ##
  63. class ToolTip(ui.ThinBoard):
  64.  
  65.     TOOL_TIP_WIDTH = 190
  66.     TOOL_TIP_HEIGHT = 10
  67.  
  68.     TEXT_LINE_HEIGHT = 17
  69.  
  70.     TITLE_COLOR = grp.GenerateColor(0.9490, 0.9058, 0.7568, 1.0)
  71.     SPECIAL_TITLE_COLOR = grp.GenerateColor(1.0, 0.7843, 0.0, 1.0)
  72.     NORMAL_COLOR = grp.GenerateColor(0.7607, 0.7607, 0.7607, 1.0)
  73.     FONT_COLOR = grp.GenerateColor(0.7607, 0.7607, 0.7607, 1.0)
  74.     PRICE_COLOR = 0xffFFB96D
  75.  
  76.     HIGH_PRICE_COLOR = SPECIAL_TITLE_COLOR
  77.     MIDDLE_PRICE_COLOR = grp.GenerateColor(0.85, 0.85, 0.85, 1.0)
  78.     LOW_PRICE_COLOR = grp.GenerateColor(0.7, 0.7, 0.7, 1.0)
  79.  
  80.     ENABLE_COLOR = grp.GenerateColor(0.7607, 0.7607, 0.7607, 1.0)
  81.     DISABLE_COLOR = grp.GenerateColor(0.9, 0.4745, 0.4627, 1.0)
  82.  
  83.     NEGATIVE_COLOR = grp.GenerateColor(0.9, 0.4745, 0.4627, 1.0)
  84.     POSITIVE_COLOR = grp.GenerateColor(0.5411, 0.7254, 0.5568, 1.0)
  85.     SPECIAL_POSITIVE_COLOR = grp.GenerateColor(0.6911, 0.8754, 0.7068, 1.0)
  86.     SPECIAL_POSITIVE_COLOR2 = grp.GenerateColor(0.8824, 0.9804, 0.8824, 1.0)
  87.  
  88.     CONDITION_COLOR = 0xffBEB47D
  89.     CAN_LEVEL_UP_COLOR = 0xff8EC292
  90.     CANNOT_LEVEL_UP_COLOR = DISABLE_COLOR
  91.     NEED_SKILL_POINT_COLOR = 0xff9A9CDB
  92.  
  93.     def __init__(self, width = TOOL_TIP_WIDTH, isPickable=False):
  94.         ui.ThinBoard.__init__(self, "TOP_MOST")
  95.  
  96.         if isPickable:
  97.             pass
  98.         else:
  99.             self.AddFlag("not_pick")
  100.  
  101.         self.AddFlag("float")
  102.  
  103.         self.followFlag = True
  104.         self.toolTipWidth = width
  105.  
  106.         self.xPos = -1
  107.         self.yPos = -1
  108.  
  109.         self.defFontName = localeInfo.UI_DEF_FONT
  110.         self.ClearToolTip()
  111.  
  112.     def __del__(self):
  113.         ui.ThinBoard.__del__(self)
  114.  
  115.     def ClearToolTip(self):
  116.         self.toolTipHeight = 12
  117.         self.childrenList = []
  118.  
  119.     def SetFollow(self, flag):
  120.         self.followFlag = flag
  121.  
  122.     def SetDefaultFontName(self, fontName):
  123.         self.defFontName = fontName
  124.  
  125.     def AppendSpace(self, size):
  126.         self.toolTipHeight += size
  127.         self.ResizeToolTip()
  128.  
  129.     def AppendHorizontalLine(self):
  130.  
  131.         for i in xrange(2):
  132.             horizontalLine = ui.Line()
  133.             horizontalLine.SetParent(self)
  134.             horizontalLine.SetPosition(0, self.toolTipHeight + 3 + i)
  135.             horizontalLine.SetWindowHorizontalAlignCenter()
  136.             horizontalLine.SetSize(150, 0)
  137.             horizontalLine.Show()
  138.  
  139.             if 0 == i:
  140.                 horizontalLine.SetColor(0xff555555)
  141.             else:
  142.                 horizontalLine.SetColor(0xff000000)
  143.  
  144.             self.childrenList.append(horizontalLine)
  145.  
  146.         self.toolTipHeight += 11
  147.         self.ResizeToolTip()
  148.  
  149.     def AlignHorizonalCenter(self):
  150.         for child in self.childrenList:
  151.             (x, y)=child.GetLocalPosition()
  152.             child.SetPosition(self.toolTipWidth/2, y)
  153.  
  154.         self.ResizeToolTip()
  155.  
  156.     def AutoAppendTextLine(self, text, color = FONT_COLOR, centerAlign = True):
  157.         textLine = ui.TextLine()
  158.         textLine.SetParent(self)
  159.         textLine.SetFontName(self.defFontName)
  160.         textLine.SetPackedFontColor(color)
  161.         textLine.SetText(text)
  162.         textLine.SetOutline()
  163.         textLine.SetFeather(False)
  164.         textLine.Show()
  165.  
  166.         if centerAlign:
  167.             textLine.SetPosition(self.toolTipWidth/2, self.toolTipHeight)
  168.             textLine.SetHorizontalAlignCenter()
  169.  
  170.         else:
  171.             textLine.SetPosition(10, self.toolTipHeight)
  172.  
  173.         self.childrenList.append(textLine)
  174.  
  175.         (textWidth, textHeight)=textLine.GetTextSize()
  176.  
  177.         textWidth += 40
  178.         textHeight += 5
  179.  
  180.         if self.toolTipWidth < textWidth:
  181.             self.toolTipWidth = textWidth
  182.  
  183.         self.toolTipHeight += textHeight
  184.  
  185.         return textLine
  186.  
  187.     def AppendTextLine(self, text, color = FONT_COLOR, centerAlign = True):
  188.         textLine = ui.TextLine()
  189.         textLine.SetParent(self)
  190.         textLine.SetFontName(self.defFontName)
  191.         textLine.SetPackedFontColor(color)
  192.         textLine.SetText(text)
  193.         textLine.SetOutline()
  194.         textLine.SetFeather(False)
  195.         textLine.Show()
  196.  
  197.         if centerAlign:
  198.             textLine.SetPosition(self.toolTipWidth/2, self.toolTipHeight)
  199.             textLine.SetHorizontalAlignCenter()
  200.  
  201.         else:
  202.             textLine.SetPosition(10, self.toolTipHeight)
  203.  
  204.         self.childrenList.append(textLine)
  205.  
  206.         self.toolTipHeight += self.TEXT_LINE_HEIGHT
  207.         self.ResizeToolTip()
  208.  
  209.         return textLine
  210.  
  211.     def AppendDescription(self, desc, limit, color = FONT_COLOR):
  212.         if localeInfo.IsEUROPE():
  213.             self.__AppendDescription_WesternLanguage(desc, color)
  214.         else:
  215.             self.__AppendDescription_EasternLanguage(desc, limit, color)
  216.  
  217.     def __AppendDescription_EasternLanguage(self, description, characterLimitation, color=FONT_COLOR):
  218.         length = len(description)
  219.         if 0 == length:
  220.             return
  221.  
  222.         lineCount = grpText.GetSplitingTextLineCount(description, characterLimitation)
  223.         for i in xrange(lineCount):
  224.             if 0 == i:
  225.                 self.AppendSpace(5)
  226.             self.AppendTextLine(grpText.GetSplitingTextLine(description, characterLimitation, i), color)
  227.  
  228.     def __AppendDescription_WesternLanguage(self, desc, color=FONT_COLOR):
  229.         lines = SplitDescription(desc, DESC_WESTERN_MAX_COLS)
  230.         if not lines:
  231.             return
  232.  
  233.         self.AppendSpace(5)
  234.         for line in lines:
  235.             self.AppendTextLine(line, color)
  236.            
  237.  
  238.     def ResizeToolTip(self):
  239.         self.SetSize(self.toolTipWidth, self.TOOL_TIP_HEIGHT + self.toolTipHeight)
  240.  
  241.     def SetTitle(self, name):
  242.         self.AppendTextLine(name, self.TITLE_COLOR)
  243.  
  244.     def GetLimitTextLineColor(self, curValue, limitValue):
  245.         if curValue < limitValue:
  246.             return self.DISABLE_COLOR
  247.  
  248.         return self.ENABLE_COLOR
  249.  
  250.     def GetChangeTextLineColor(self, value, isSpecial=False):
  251.         if value > 0:
  252.             if isSpecial:
  253.                 return self.SPECIAL_POSITIVE_COLOR
  254.             else:
  255.                 return self.POSITIVE_COLOR
  256.  
  257.         if 0 == value:
  258.             return self.NORMAL_COLOR
  259.  
  260.         return self.NEGATIVE_COLOR
  261.  
  262.     def SetToolTipPosition(self, x = -1, y = -1):
  263.         self.xPos = x
  264.         self.yPos = y
  265.  
  266.     def ShowToolTip(self):
  267.         self.SetTop()
  268.         self.Show()
  269.  
  270.         self.OnUpdate()
  271.  
  272.     def HideToolTip(self):
  273.         self.Hide()
  274.  
  275.     def OnUpdate(self):
  276.  
  277.         if not self.followFlag:
  278.             return
  279.  
  280.         x = 0
  281.         y = 0
  282.         width = self.GetWidth()
  283.         height = self.toolTipHeight
  284.  
  285.         if -1 == self.xPos and -1 == self.yPos:
  286.  
  287.             (mouseX, mouseY) = wndMgr.GetMousePosition()
  288.  
  289.             if mouseY < wndMgr.GetScreenHeight() - 300:
  290.                 y = mouseY + 40
  291.             else:
  292.                 y = mouseY - height - 30
  293.  
  294.             x = mouseX - width/2               
  295.  
  296.         else:
  297.  
  298.             x = self.xPos - width/2
  299.             y = self.yPos - height
  300.  
  301.         x = max(x, 0)
  302.         y = max(y, 0)
  303.         x = min(x + width/2, wndMgr.GetScreenWidth() - width/2) - width/2
  304.         y = min(y + self.GetHeight(), wndMgr.GetScreenHeight()) - self.GetHeight()
  305.  
  306.         parentWindow = self.GetParentProxy()
  307.         if parentWindow:
  308.             (gx, gy) = parentWindow.GetGlobalPosition()
  309.             x -= gx
  310.             y -= gy
  311.  
  312.         self.SetPosition(x, y)
  313.  
  314. class ItemToolTip(ToolTip):
  315.  
  316.     CHARACTER_NAMES = (
  317.         localeInfo.TOOLTIP_WARRIOR,
  318.         localeInfo.TOOLTIP_ASSASSIN,
  319.         localeInfo.TOOLTIP_SURA,
  320.         localeInfo.TOOLTIP_SHAMAN
  321.     )      
  322.  
  323.     CHARACTER_COUNT = len(CHARACTER_NAMES)
  324.     WEAR_NAMES = (
  325.         localeInfo.TOOLTIP_ARMOR,
  326.         localeInfo.TOOLTIP_HELMET,
  327.         localeInfo.TOOLTIP_SHOES,
  328.         localeInfo.TOOLTIP_WRISTLET,
  329.         localeInfo.TOOLTIP_WEAPON,
  330.         localeInfo.TOOLTIP_NECK,
  331.         localeInfo.TOOLTIP_EAR,
  332.         localeInfo.TOOLTIP_UNIQUE,
  333.         localeInfo.TOOLTIP_SHIELD,
  334.         localeInfo.TOOLTIP_ARROW,
  335.     )
  336.     WEAR_COUNT = len(WEAR_NAMES)
  337.  
  338.     AFFECT_DICT = {
  339.         item.APPLY_MAX_HP : localeInfo.TOOLTIP_MAX_HP,
  340.         item.APPLY_MAX_SP : localeInfo.TOOLTIP_MAX_SP,
  341.         item.APPLY_CON : localeInfo.TOOLTIP_CON,
  342.         item.APPLY_INT : localeInfo.TOOLTIP_INT,
  343.         item.APPLY_STR : localeInfo.TOOLTIP_STR,
  344.         item.APPLY_DEX : localeInfo.TOOLTIP_DEX,
  345.         item.APPLY_ATT_SPEED : localeInfo.TOOLTIP_ATT_SPEED,
  346.         item.APPLY_MOV_SPEED : localeInfo.TOOLTIP_MOV_SPEED,
  347.         item.APPLY_CAST_SPEED : localeInfo.TOOLTIP_CAST_SPEED,
  348.         item.APPLY_HP_REGEN : localeInfo.TOOLTIP_HP_REGEN,
  349.         item.APPLY_SP_REGEN : localeInfo.TOOLTIP_SP_REGEN,
  350.         item.APPLY_POISON_PCT : localeInfo.TOOLTIP_APPLY_POISON_PCT,
  351.         item.APPLY_STUN_PCT : localeInfo.TOOLTIP_APPLY_STUN_PCT,
  352.         item.APPLY_SLOW_PCT : localeInfo.TOOLTIP_APPLY_SLOW_PCT,
  353.         item.APPLY_CRITICAL_PCT : localeInfo.TOOLTIP_APPLY_CRITICAL_PCT,
  354.         item.APPLY_PENETRATE_PCT : localeInfo.TOOLTIP_APPLY_PENETRATE_PCT,
  355.  
  356.         item.APPLY_ATTBONUS_WARRIOR : localeInfo.TOOLTIP_APPLY_ATTBONUS_WARRIOR,
  357.         item.APPLY_ATTBONUS_ASSASSIN : localeInfo.TOOLTIP_APPLY_ATTBONUS_ASSASSIN,
  358.         item.APPLY_ATTBONUS_SURA : localeInfo.TOOLTIP_APPLY_ATTBONUS_SURA,
  359.         item.APPLY_ATTBONUS_SHAMAN : localeInfo.TOOLTIP_APPLY_ATTBONUS_SHAMAN,
  360.         item.APPLY_ATTBONUS_MONSTER : localeInfo.TOOLTIP_APPLY_ATTBONUS_MONSTER,
  361.  
  362.         item.APPLY_ATTBONUS_HUMAN : localeInfo.TOOLTIP_APPLY_ATTBONUS_HUMAN,
  363.         item.APPLY_ATTBONUS_ANIMAL : localeInfo.TOOLTIP_APPLY_ATTBONUS_ANIMAL,
  364.         item.APPLY_ATTBONUS_ORC : localeInfo.TOOLTIP_APPLY_ATTBONUS_ORC,
  365.         item.APPLY_ATTBONUS_MILGYO : localeInfo.TOOLTIP_APPLY_ATTBONUS_MILGYO,
  366.         item.APPLY_ATTBONUS_UNDEAD : localeInfo.TOOLTIP_APPLY_ATTBONUS_UNDEAD,
  367.         item.APPLY_ATTBONUS_DEVIL : localeInfo.TOOLTIP_APPLY_ATTBONUS_DEVIL,
  368.         item.APPLY_STEAL_HP : localeInfo.TOOLTIP_APPLY_STEAL_HP,
  369.         item.APPLY_STEAL_SP : localeInfo.TOOLTIP_APPLY_STEAL_SP,
  370.         item.APPLY_MANA_BURN_PCT : localeInfo.TOOLTIP_APPLY_MANA_BURN_PCT,
  371.         item.APPLY_DAMAGE_SP_RECOVER : localeInfo.TOOLTIP_APPLY_DAMAGE_SP_RECOVER,
  372.         item.APPLY_BLOCK : localeInfo.TOOLTIP_APPLY_BLOCK,
  373.         item.APPLY_DODGE : localeInfo.TOOLTIP_APPLY_DODGE,
  374.         item.APPLY_RESIST_SWORD : localeInfo.TOOLTIP_APPLY_RESIST_SWORD,
  375.         item.APPLY_RESIST_TWOHAND : localeInfo.TOOLTIP_APPLY_RESIST_TWOHAND,
  376.         item.APPLY_RESIST_DAGGER : localeInfo.TOOLTIP_APPLY_RESIST_DAGGER,
  377.         item.APPLY_RESIST_BELL : localeInfo.TOOLTIP_APPLY_RESIST_BELL,
  378.         item.APPLY_RESIST_FAN : localeInfo.TOOLTIP_APPLY_RESIST_FAN,
  379.         item.APPLY_RESIST_BOW : localeInfo.TOOLTIP_RESIST_BOW,
  380.         item.APPLY_RESIST_FIRE : localeInfo.TOOLTIP_RESIST_FIRE,
  381.         item.APPLY_RESIST_ELEC : localeInfo.TOOLTIP_RESIST_ELEC,
  382.         item.APPLY_RESIST_MAGIC : localeInfo.TOOLTIP_RESIST_MAGIC,
  383.         item.APPLY_RESIST_WIND : localeInfo.TOOLTIP_APPLY_RESIST_WIND,
  384.         item.APPLY_REFLECT_MELEE : localeInfo.TOOLTIP_APPLY_REFLECT_MELEE,
  385.         item.APPLY_REFLECT_CURSE : localeInfo.TOOLTIP_APPLY_REFLECT_CURSE,
  386.         item.APPLY_POISON_REDUCE : localeInfo.TOOLTIP_APPLY_POISON_REDUCE,
  387.         item.APPLY_KILL_SP_RECOVER : localeInfo.TOOLTIP_APPLY_KILL_SP_RECOVER,
  388.         item.APPLY_EXP_DOUBLE_BONUS : localeInfo.TOOLTIP_APPLY_EXP_DOUBLE_BONUS,
  389.         item.APPLY_GOLD_DOUBLE_BONUS : localeInfo.TOOLTIP_APPLY_GOLD_DOUBLE_BONUS,
  390.         item.APPLY_ITEM_DROP_BONUS : localeInfo.TOOLTIP_APPLY_ITEM_DROP_BONUS,
  391.         item.APPLY_POTION_BONUS : localeInfo.TOOLTIP_APPLY_POTION_BONUS,
  392.         item.APPLY_KILL_HP_RECOVER : localeInfo.TOOLTIP_APPLY_KILL_HP_RECOVER,
  393.         item.APPLY_IMMUNE_STUN : localeInfo.TOOLTIP_APPLY_IMMUNE_STUN,
  394.         item.APPLY_IMMUNE_SLOW : localeInfo.TOOLTIP_APPLY_IMMUNE_SLOW,
  395.         item.APPLY_IMMUNE_FALL : localeInfo.TOOLTIP_APPLY_IMMUNE_FALL,
  396.         item.APPLY_BOW_DISTANCE : localeInfo.TOOLTIP_BOW_DISTANCE,
  397.         item.APPLY_DEF_GRADE_BONUS : localeInfo.TOOLTIP_DEF_GRADE,
  398.         item.APPLY_ATT_GRADE_BONUS : localeInfo.TOOLTIP_ATT_GRADE,
  399.         item.APPLY_MAGIC_ATT_GRADE : localeInfo.TOOLTIP_MAGIC_ATT_GRADE,
  400.         item.APPLY_MAGIC_DEF_GRADE : localeInfo.TOOLTIP_MAGIC_DEF_GRADE,
  401.         item.APPLY_MAX_STAMINA : localeInfo.TOOLTIP_MAX_STAMINA,
  402.         item.APPLY_MALL_ATTBONUS : localeInfo.TOOLTIP_MALL_ATTBONUS,
  403.         item.APPLY_MALL_DEFBONUS : localeInfo.TOOLTIP_MALL_DEFBONUS,
  404.         item.APPLY_MALL_EXPBONUS : localeInfo.TOOLTIP_MALL_EXPBONUS,
  405.         item.APPLY_MALL_ITEMBONUS : localeInfo.TOOLTIP_MALL_ITEMBONUS,
  406.         item.APPLY_MALL_GOLDBONUS : localeInfo.TOOLTIP_MALL_GOLDBONUS,
  407.         item.APPLY_SKILL_DAMAGE_BONUS : localeInfo.TOOLTIP_SKILL_DAMAGE_BONUS,
  408.         item.APPLY_NORMAL_HIT_DAMAGE_BONUS : localeInfo.TOOLTIP_NORMAL_HIT_DAMAGE_BONUS,
  409.         item.APPLY_SKILL_DEFEND_BONUS : localeInfo.TOOLTIP_SKILL_DEFEND_BONUS,
  410.         item.APPLY_NORMAL_HIT_DEFEND_BONUS : localeInfo.TOOLTIP_NORMAL_HIT_DEFEND_BONUS,
  411.         item.APPLY_PC_BANG_EXP_BONUS : localeInfo.TOOLTIP_MALL_EXPBONUS_P_STATIC,
  412.         item.APPLY_PC_BANG_DROP_BONUS : localeInfo.TOOLTIP_MALL_ITEMBONUS_P_STATIC,
  413.         item.APPLY_RESIST_WARRIOR : localeInfo.TOOLTIP_APPLY_RESIST_WARRIOR,
  414.         item.APPLY_RESIST_ASSASSIN : localeInfo.TOOLTIP_APPLY_RESIST_ASSASSIN,
  415.         item.APPLY_RESIST_SURA : localeInfo.TOOLTIP_APPLY_RESIST_SURA,
  416.         item.APPLY_RESIST_SHAMAN : localeInfo.TOOLTIP_APPLY_RESIST_SHAMAN,
  417.         item.APPLY_MAX_HP_PCT : localeInfo.TOOLTIP_APPLY_MAX_HP_PCT,
  418.         item.APPLY_MAX_SP_PCT : localeInfo.TOOLTIP_APPLY_MAX_SP_PCT,
  419.         item.APPLY_ENERGY : localeInfo.TOOLTIP_ENERGY,
  420.         item.APPLY_COSTUME_ATTR_BONUS : localeInfo.TOOLTIP_COSTUME_ATTR_BONUS,
  421.        
  422.         item.APPLY_MAGIC_ATTBONUS_PER : localeInfo.TOOLTIP_MAGIC_ATTBONUS_PER,
  423.         item.APPLY_MELEE_MAGIC_ATTBONUS_PER : localeInfo.TOOLTIP_MELEE_MAGIC_ATTBONUS_PER,
  424.         item.APPLY_RESIST_ICE : localeInfo.TOOLTIP_RESIST_ICE,
  425.         item.APPLY_RESIST_EARTH : localeInfo.TOOLTIP_RESIST_EARTH,
  426.         item.APPLY_RESIST_DARK : localeInfo.TOOLTIP_RESIST_DARK,
  427.         item.APPLY_ANTI_CRITICAL_PCT : localeInfo.TOOLTIP_ANTI_CRITICAL_PCT,
  428.         item.APPLY_ANTI_PENETRATE_PCT : localeInfo.TOOLTIP_ANTI_PENETRATE_PCT,
  429.     }
  430.  
  431.     ATTRIBUTE_NEED_WIDTH = {
  432.         23 : 230,
  433.         24 : 230,
  434.         25 : 230,
  435.         26 : 220,
  436.         27 : 210,
  437.  
  438.         35 : 210,
  439.         36 : 210,
  440.         37 : 210,
  441.         38 : 210,
  442.         39 : 210,
  443.         40 : 210,
  444.         41 : 210,
  445.  
  446.         42 : 220,
  447.         43 : 230,
  448.         45 : 230,
  449.     }
  450.  
  451.     ANTI_FLAG_DICT = {
  452.         0 : item.ITEM_ANTIFLAG_WARRIOR,
  453.         1 : item.ITEM_ANTIFLAG_ASSASSIN,
  454.         2 : item.ITEM_ANTIFLAG_SURA,
  455.         3 : item.ITEM_ANTIFLAG_SHAMAN,
  456.     }
  457.  
  458.     FONT_COLOR = grp.GenerateColor(0.7607, 0.7607, 0.7607, 1.0)
  459.  
  460.     def __init__(self, *args, **kwargs):
  461.         ToolTip.__init__(self, *args, **kwargs)
  462.         self.itemVnum = 0
  463.         self.isShopItem = False
  464.  
  465.         # ??? ??? ??? ? ?? ???? ??? ? ?? ?????? ??? Disable Color? ?? (?? ??? ???? ??? ?? ? ??? ???)
  466.         self.bCannotUseItemForceSetDisableColor = True
  467.  
  468.     def __del__(self):
  469.         ToolTip.__del__(self)
  470.  
  471.     def SetCannotUseItemForceSetDisableColor(self, enable):
  472.         self.bCannotUseItemForceSetDisableColor = enable
  473.  
  474.     def CanEquip(self):
  475.         if not item.IsEquipmentVID(self.itemVnum):
  476.             return True
  477.  
  478.         race = player.GetRace()
  479.         job = chr.RaceToJob(race)
  480.         if not self.ANTI_FLAG_DICT.has_key(job):
  481.             return False
  482.  
  483.         if item.IsAntiFlag(self.ANTI_FLAG_DICT[job]):
  484.             return False
  485.  
  486.         sex = chr.RaceToSex(race)
  487.        
  488.         MALE = 1
  489.         FEMALE = 0
  490.  
  491.         if item.IsAntiFlag(item.ITEM_ANTIFLAG_MALE) and sex == MALE:
  492.             return False
  493.  
  494.         if item.IsAntiFlag(item.ITEM_ANTIFLAG_FEMALE) and sex == FEMALE:
  495.             return False
  496.  
  497.         for i in xrange(item.LIMIT_MAX_NUM):
  498.             (limitType, limitValue) = item.GetLimit(i)
  499.  
  500.             if item.LIMIT_LEVEL == limitType:
  501.                 if player.GetStatus(player.LEVEL) < limitValue:
  502.                     return False
  503.             """
  504.             elif item.LIMIT_STR == limitType:
  505.                 if player.GetStatus(player.ST) < limitValue:
  506.                     return False
  507.             elif item.LIMIT_DEX == limitType:
  508.                 if player.GetStatus(player.DX) < limitValue:
  509.                     return False
  510.             elif item.LIMIT_INT == limitType:
  511.                 if player.GetStatus(player.IQ) < limitValue:
  512.                     return False
  513.             elif item.LIMIT_CON == limitType:
  514.                 if player.GetStatus(player.HT) < limitValue:
  515.                     return False
  516.             """
  517.  
  518.         return True
  519.  
  520.     def AppendTextLine(self, text, color = FONT_COLOR, centerAlign = True):
  521.         if not self.CanEquip() and self.bCannotUseItemForceSetDisableColor:
  522.             color = self.DISABLE_COLOR
  523.  
  524.         return ToolTip.AppendTextLine(self, text, color, centerAlign)
  525.  
  526.     def ClearToolTip(self):
  527.         self.isShopItem = False
  528.         self.toolTipWidth = self.TOOL_TIP_WIDTH
  529.         ToolTip.ClearToolTip(self)
  530.  
  531.     def SetInventoryItem(self, slotIndex, window_type = player.INVENTORY):
  532.         itemVnum = player.GetItemIndex(window_type, slotIndex)
  533.         if 0 == itemVnum:
  534.             return
  535.  
  536.         self.ClearToolTip()
  537.         if shop.IsOpen():
  538.             if not shop.IsPrivateShop():
  539.                 item.SelectItem(itemVnum)
  540.                 self.AppendSellingPrice(player.GetISellItemPrice(window_type, slotIndex))
  541.  
  542.         metinSlot = [player.GetItemMetinSocket(window_type, slotIndex, i) for i in xrange(player.METIN_SOCKET_MAX_NUM)]
  543.         attrSlot = [player.GetItemAttribute(window_type, slotIndex, i) for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM)]
  544.  
  545.         self.AddItemData(itemVnum, metinSlot, attrSlot)
  546.  
  547.     def SetShopItem(self, slotIndex):
  548.         itemVnum = shop.GetItemID(slotIndex)
  549.         if 0 == itemVnum:
  550.             return
  551.  
  552.         price = shop.GetItemPrice(slotIndex)
  553.         self.ClearToolTip()
  554.         self.isShopItem = True
  555.  
  556.         metinSlot = []
  557.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  558.             metinSlot.append(shop.GetItemMetinSocket(slotIndex, i))
  559.         attrSlot = []
  560.         for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  561.             attrSlot.append(shop.GetItemAttribute(slotIndex, i))
  562.  
  563.         self.AddItemData(itemVnum, metinSlot, attrSlot)
  564.         self.AppendPrice(price)
  565.  
  566.     def SetShopItemBySecondaryCoin(self, slotIndex):
  567.         itemVnum = shop.GetItemID(slotIndex)
  568.         if 0 == itemVnum:
  569.             return
  570.  
  571.         price = shop.GetItemPrice(slotIndex)
  572.         self.ClearToolTip()
  573.         self.isShopItem = True
  574.  
  575.         metinSlot = []
  576.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  577.             metinSlot.append(shop.GetItemMetinSocket(slotIndex, i))
  578.         attrSlot = []
  579.         for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  580.             attrSlot.append(shop.GetItemAttribute(slotIndex, i))
  581.  
  582.         self.AddItemData(itemVnum, metinSlot, attrSlot)
  583.         self.AppendPriceBySecondaryCoin(price)
  584.  
  585.     def SetExchangeOwnerItem(self, slotIndex):
  586.         itemVnum = exchange.GetItemVnumFromSelf(slotIndex)
  587.         if 0 == itemVnum:
  588.             return
  589.  
  590.         self.ClearToolTip()
  591.  
  592.         metinSlot = []
  593.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  594.             metinSlot.append(exchange.GetItemMetinSocketFromSelf(slotIndex, i))
  595.         attrSlot = []
  596.         for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  597.             attrSlot.append(exchange.GetItemAttributeFromSelf(slotIndex, i))
  598.         self.AddItemData(itemVnum, metinSlot, attrSlot)
  599.  
  600.     def SetExchangeTargetItem(self, slotIndex):
  601.         itemVnum = exchange.GetItemVnumFromTarget(slotIndex)
  602.         if 0 == itemVnum:
  603.             return
  604.  
  605.         self.ClearToolTip()
  606.  
  607.         metinSlot = []
  608.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  609.             metinSlot.append(exchange.GetItemMetinSocketFromTarget(slotIndex, i))
  610.         attrSlot = []
  611.         for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  612.             attrSlot.append(exchange.GetItemAttributeFromTarget(slotIndex, i))
  613.         self.AddItemData(itemVnum, metinSlot, attrSlot)
  614.  
  615.     def SetPrivateShopBuilderItem(self, invenType, invenPos, privateShopSlotIndex):
  616.         itemVnum = player.GetItemIndex(invenType, invenPos)
  617.         if 0 == itemVnum:
  618.             return
  619.  
  620.         item.SelectItem(itemVnum)
  621.         self.ClearToolTip()
  622.         self.AppendSellingPrice(shop.GetPrivateShopItemPrice(invenType, invenPos))
  623.  
  624.         metinSlot = []
  625.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  626.             metinSlot.append(player.GetItemMetinSocket(invenPos, i))
  627.         attrSlot = []
  628.         for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  629.             attrSlot.append(player.GetItemAttribute(invenPos, i))
  630.  
  631.         self.AddItemData(itemVnum, metinSlot, attrSlot)
  632.  
  633.     def SetSafeBoxItem(self, slotIndex):
  634.         itemVnum = safebox.GetItemID(slotIndex)
  635.         if 0 == itemVnum:
  636.             return
  637.  
  638.         self.ClearToolTip()
  639.         metinSlot = []
  640.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  641.             metinSlot.append(safebox.GetItemMetinSocket(slotIndex, i))
  642.         attrSlot = []
  643.         for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  644.             attrSlot.append(safebox.GetItemAttribute(slotIndex, i))
  645.        
  646.         self.AddItemData(itemVnum, metinSlot, attrSlot, safebox.GetItemFlags(slotIndex))
  647.  
  648.     def SetMallItem(self, slotIndex):
  649.         itemVnum = safebox.GetMallItemID(slotIndex)
  650.         if 0 == itemVnum:
  651.             return
  652.  
  653.         self.ClearToolTip()
  654.         metinSlot = []
  655.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  656.             metinSlot.append(safebox.GetMallItemMetinSocket(slotIndex, i))
  657.         attrSlot = []
  658.         for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  659.             attrSlot.append(safebox.GetMallItemAttribute(slotIndex, i))
  660.  
  661.         self.AddItemData(itemVnum, metinSlot, attrSlot)
  662.  
  663.     def SetItemToolTip(self, itemVnum):
  664.         self.ClearToolTip()
  665.         metinSlot = []
  666.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  667.             metinSlot.append(0)
  668.         attrSlot = []
  669.         for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  670.             attrSlot.append((0, 0))
  671.  
  672.         self.AddItemData(itemVnum, metinSlot, attrSlot)
  673.  
  674.     def __AppendAttackSpeedInfo(self, item):
  675.         atkSpd = item.GetValue(0)
  676.  
  677.         if atkSpd < 80:
  678.             stSpd = localeInfo.TOOLTIP_ITEM_VERY_FAST
  679.         elif atkSpd <= 95:
  680.             stSpd = localeInfo.TOOLTIP_ITEM_FAST
  681.         elif atkSpd <= 105:
  682.             stSpd = localeInfo.TOOLTIP_ITEM_NORMAL
  683.         elif atkSpd <= 120:
  684.             stSpd = localeInfo.TOOLTIP_ITEM_SLOW
  685.         else:
  686.             stSpd = localeInfo.TOOLTIP_ITEM_VERY_SLOW
  687.  
  688.         self.AppendTextLine(localeInfo.TOOLTIP_ITEM_ATT_SPEED % stSpd, self.NORMAL_COLOR)
  689.  
  690.     def __AppendAttackGradeInfo(self):
  691.         atkGrade = item.GetValue(1)
  692.         self.AppendTextLine(localeInfo.TOOLTIP_ITEM_ATT_GRADE % atkGrade, self.GetChangeTextLineColor(atkGrade))
  693.  
  694.     def __AppendAttackPowerInfo(self):
  695.         minPower = item.GetValue(3)
  696.         maxPower = item.GetValue(4)
  697.         addPower = item.GetValue(5)
  698.         if maxPower > minPower:
  699.             self.AppendTextLine(localeInfo.TOOLTIP_ITEM_ATT_POWER % (minPower+addPower, maxPower+addPower), self.POSITIVE_COLOR)
  700.         else:
  701.             self.AppendTextLine(localeInfo.TOOLTIP_ITEM_ATT_POWER_ONE_ARG % (minPower+addPower), self.POSITIVE_COLOR)
  702.  
  703.     def __AppendMagicAttackInfo(self):
  704.         minMagicAttackPower = item.GetValue(1)
  705.         maxMagicAttackPower = item.GetValue(2)
  706.         addPower = item.GetValue(5)
  707.  
  708.         if minMagicAttackPower > 0 or maxMagicAttackPower > 0:
  709.             if maxMagicAttackPower > minMagicAttackPower:
  710.                 self.AppendTextLine(localeInfo.TOOLTIP_ITEM_MAGIC_ATT_POWER % (minMagicAttackPower+addPower, maxMagicAttackPower+addPower), self.POSITIVE_COLOR)
  711.             else:
  712.                 self.AppendTextLine(localeInfo.TOOLTIP_ITEM_MAGIC_ATT_POWER_ONE_ARG % (minMagicAttackPower+addPower), self.POSITIVE_COLOR)
  713.  
  714.     def __AppendMagicDefenceInfo(self):
  715.         magicDefencePower = item.GetValue(0)
  716.  
  717.         if magicDefencePower > 0:
  718.             self.AppendTextLine(localeInfo.TOOLTIP_ITEM_MAGIC_DEF_POWER % magicDefencePower, self.GetChangeTextLineColor(magicDefencePower))
  719.  
  720.     ##START RARITY SYSTEM PART 1
  721.     def GetBonusColor(self, attrSlot):
  722.         # Lista de Bonus #
  723.         #1 = Max HP
  724.         #2 = Max SP
  725.         #3 = Vitalidad
  726.         #4 = Inteligencia
  727.         #5 = Fuerza
  728.         #6 = Dextreza
  729.         #7 = Velocidad de ataque
  730.         #8 = Velocidad de Movimiento
  731.         #9 = Velocidad Hechizo
  732.         #10 = Regeneración de HP
  733.         #11 = Regeneración de SP
  734.         #12 = Probabilidad de Envenenamiento
  735.         #13 = Probabilidad de Apagon
  736.         #14 = Probabilidad de Retardo
  737.         #15 = Probabilidad de golpes críticos
  738.         #16 = Probabilidad de golpes de penetración
  739.         #17 = Fuerza Contra MedioHumanos
  740.         #18 = Fuerza Contra Animales
  741.         #19 = Fuerza Contra Orcos
  742.         #20 = Fuerza Contra Místicos
  743.         #21 = Fuerza Contra No-muertos
  744.         #22 = Fuerza Contra Demonios
  745.         #23 = Probabilidad de Absorver HP
  746.         #24 = Probabilidad de Absorver SP
  747.         #25 = Probabilidad de robar HP
  748.         #26 = Probabilidad de recuperar SP al golpear
  749.         #27 = Posibilidad de bloquear un ataque cuerpo a cuerpo
  750.         #28 = Probabilidad de Esquivar Flechas
  751.         #29 = Defensa Espada
  752.         #30 = Defensa Dos Manos
  753.         #31 = Defensa Daga
  754.         #32 = Defensa Campana
  755.         #33 = Defensa Fan
  756.         #34 = Resistencia de Flechas
  757.         #35 = Resistencia Fuego
  758.         #36 = Resistencia Relámpago
  759.         #37 = Resistencia Magia
  760.         #38 = Resistencia Vento
  761.         #39 = Probabilidad de reflectar golpes físicos
  762.         #40 = Probabilidad de reflectar maldición
  763.         #41 = Resistencia veneno
  764.         #42 = Probabilidad para recuperar SP
  765.         #43 = Probabilidad de bonus de doble de EXP
  766.         #44 = Probabilidad de Caer Doble Drop de Yang
  767.         #45 = Probabilidad de Caer Doble Drop de Items
  768.         #46 = Aumentar el efecto de las pociones
  769.         #47 = Probabilidad para recuperar HP
  770.         #48 = Defensa contra Apagones
  771.         #49 = Defensa contra Retardo
  772.         #50 = Defensa contra Caidas
  773.         #51 = UNKNOWN_TYTE [51] SIN EFECTO
  774.         #52 = Alcance del arco
  775.         #53 = Valor de ataque
  776.         #54 = Defensa
  777.         #55 = Valor de Ataque mágico
  778.         #56 = Defensa Mágica
  779.         #57 = UNKNOWN_TYPE [57] SIN EFECTO
  780.         #58 = Max Resistencia
  781.         #59 = Fuerza contra Guerrero
  782.         #60 = Fuerza contra Ninja
  783.         #61 = Fuerza contra Sura
  784.         #62 = Fuerza contra Chamanes
  785.         #63 = Fuerza contra Mounstruo
  786.         #64 = Valor de ataque
  787.         #65 = Defensa
  788.         #66 = EXP
  789.         #67 = Probabilidad de capturar objetos multiplicada con x.xx (las X son un porcentaje % = Bonus)
  790.         #68 = Probabilidad de capturar Yang multiplicada con x.xx (las X son un porcentaje % = Bonus)
  791.         #69 = UNKNOWN_TYPE [69] SIN EFECTO
  792.         #70 = UNKNOWN_TYPE [70] SIN EFECTO
  793.         #71 = Dano de Habilidad
  794.         #72 = Dano Media
  795.         #73 = Resistencia al dano de habilidad ( contrarresta el bonus ID:71 )
  796.         #74 = Resistencia al dano de media( contrarresta el bonus ID:72 )
  797.         #75 = UNKNOWN_TYPE [75] SIN EFECTO
  798.         #76 = EXP Bonus x.xx (las X son un porcentaje % = Bonus)
  799.         #77 = Probabilidad de capturar objetos mas x.xx (las X son un porcentaje % = Bonus)
  800.         #78 = Defensa Contra Guerrero
  801.         #79 = Defensa Contra Ninja
  802.         #80 = Defensa Contra Sura
  803.         #81 = Defensa Contra Chaman
  804.         # Lista de Bonus End
  805.        
  806.         lista_bonus = [['1','3000'],['2','80'],['3','12'],['4','12'],['5','12'],['6','12'],['7','8'],['8','20'],['9','20'],['10','30'],['11','30'],['12','8'],['13','8'],['14','8'],['15','10'],['16','10'],['17','10'],['18','20'],['19','20'],['20','20'],['21','20'],['22','20'],['23','10'],['24','10'],['25','10'],['26','10'],['27','15'],['28','15'],['29','15'],['30','15'],['31','15'],['32','15'],['33','15'],['34','15'],['35','15'],['36','15'],['37','15'],['38','15'],['39','15'],['41','5'],['43','20'],['44','20'],['45','20'],['48','1'],['53','50'],['71','10'],['72','35']]
  807.         lista_color = [[grp.GenerateColor(051,255,255, 1.0)],[grp.GenerateColor(24,116,205, 1.0)],[grp.GenerateColor(0.63,0.13,0.94, 1.0)],[grp.GenerateColor(0,0.75,1, 1.0)],[grp.GenerateColor(0,0.79,0.34, 1.0)],[grp.GenerateColor(0.9490, 0.9058, 0.7568, 1.0)],[grp.GenerateColor(193,205,193, 1.0)],[grp.GenerateColor(131,139,131, 1.0)]]
  808.         i2 = 0
  809.         right = 0
  810.         for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  811.             type = attrSlot[i][0]
  812.             value = attrSlot[i][1]
  813.             if 0 == value:
  814.                 continue
  815.             else:
  816.                 for line in range(len(lista_bonus)):
  817.                     if int(lista_bonus[line-1][0]) == int(type):
  818.                         if int(lista_bonus[line-1][1]) == int(value) or int(lista_bonus[line-1][1]) < int(value):
  819.                             right = right+1
  820.                 i2 = i2+1
  821.         for i3 in [0,1,2,3,4,5,6,7]:
  822.             if int(i2) == int(int(right)+int(i3)):
  823.                 i2 = i3
  824.         try:
  825.             return lista_color[i2][0]
  826.         except:
  827.             dbg.TraceError("Nepovedlo se načíst seznam barev!")
  828.        
  829.  
  830.     def __AppendAttributeInformation(self, attrSlot):
  831.         if 0 != attrSlot:
  832.             TitleColor = self.GetBonusColor(attrSlot)
  833.             for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  834.                 type = attrSlot[i][0]
  835.                 value = attrSlot[i][1]
  836.  
  837.                 if 0 == value:
  838.                     continue
  839.  
  840.                 affectString = self.__GetAffectString(type, value)
  841.                 if affectString:
  842.                     affectColor = self.__GetAttributeColor(i, value)
  843.                     if attrSlot[3][1] > 0:
  844.                         self.AppendTextLine(affectString, TitleColor)
  845.                     else:
  846.                         self.AppendTextLine(affectString, affectColor)
  847.     ##END RARITY SYSTEM PART 1
  848.  
  849.     #def __AppendAttributeInformation(self, attrSlot):
  850.         #if 0 != attrSlot:
  851.  
  852.             #for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  853.                 #type = attrSlot[i][0]
  854.                 #value = attrSlot[i][1]
  855.  
  856.                 #if 0 == value:
  857.                     continue
  858.  
  859.                 #affectString = self.__GetAffectString(type, value)
  860.                 #if affectString:
  861.                     #affectColor = self.__GetAttributeColor(i, value)
  862.                     #self.AppendTextLine(affectString, affectColor)
  863.  
  864.     def __AppendAcceAttributeInformation(self, attrSlot):
  865.         if 0 != attrSlot:
  866.             hasAttack = 0
  867.             hasMagicAttack = 0
  868.             minPower = 0
  869.             maxPower = 0
  870.             minMagicAttackPower = 0
  871.             maxMagicAttackPower = 0
  872.            
  873.             for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  874.                 if i <= 6:
  875.                     continue
  876.                 else:
  877.                     type = attrSlot[i][0]
  878.                     value = attrSlot[i][1]
  879.                     if 0 == value:
  880.                         continue
  881.                    
  882.                     if type == 53 and i == 8:
  883.                         hasAttack = 1
  884.                         minPower = value
  885.                     elif type == 53 and i == 9:
  886.                         hasAttack = 1
  887.                         maxPower = value
  888.                     elif type == 55 and i == 10:
  889.                         hasMagicAttack = 1
  890.                         minMagicAttackPower = value
  891.                     elif type == 55 and i == 11:
  892.                         hasMagicAttack = 1
  893.                         maxMagicAttackPower = value
  894.            
  895.             if hasAttack == 1:
  896.                 self.__AppendAttackAccePowerInfo(minPower, maxPower)
  897.            
  898.             if hasMagicAttack == 1:
  899.                 self.__AppendMagicAttackAcceInfo(minMagicAttackPower, maxMagicAttackPower)
  900.            
  901.             for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  902.                 if i <= 6 or i >= 8 and i <= 11:
  903.                     continue
  904.                 else:
  905.                     type = attrSlot[i][0]
  906.                     value = attrSlot[i][1]
  907.                     if 0 == value:
  908.                         continue
  909.                    
  910.                     affectString = self.__GetAffectString(type, value)
  911.                     if affectString:
  912.                         affectColor = self.__GetAttributeColor(i, value)
  913.                         self.AppendTextLine(affectString, affectColor)
  914.            
  915.             for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  916.                 if i >= 7:
  917.                     continue
  918.                 else:
  919.                     type = attrSlot[i][0]
  920.                     value = attrSlot[i][1]
  921.                     if 0 == value:
  922.                         continue
  923.                    
  924.                     affectString = self.__GetAffectString(type, value)
  925.                     if affectString:
  926.                         affectColor = self.__GetAttributeColor(i, value)
  927.                         self.AppendTextLine(affectString, affectColor)
  928.  
  929.     def __AppendAttackAccePowerInfo(self, minPower, maxPower):
  930.         minPower_final = minPower
  931.         maxPower_final = maxPower
  932.         if maxPower > minPower:
  933.             self.AppendTextLine(localeInfo.TOOLTIP_ITEM_ATT_POWER % (minPower_final, maxPower_final), self.POSITIVE_COLOR)
  934.         else:
  935.             self.AppendTextLine(localeInfo.TOOLTIP_ITEM_ATT_POWER_ONE_ARG % (minPower_final), self.POSITIVE_COLOR)
  936.  
  937.     def __AppendMagicAttackAcceInfo(self, minMagicAttackPower, maxMagicAttackPower):
  938.         minMagicAttackPower_final = minMagicAttackPower
  939.         maxMagicAttackPower_final = maxMagicAttackPower
  940.         if minMagicAttackPower_final > 0 or maxMagicAttackPower_final > 0:
  941.             if maxMagicAttackPower_final > minMagicAttackPower_final:
  942.                 self.AppendTextLine(localeInfo.TOOLTIP_ITEM_MAGIC_ATT_POWER % (minMagicAttackPower_final, maxMagicAttackPower_final), self.POSITIVE_COLOR)
  943.             else:
  944.                 self.AppendTextLine(localeInfo.TOOLTIP_ITEM_MAGIC_ATT_POWER_ONE_ARG % (minMagicAttackPower_final), self.POSITIVE_COLOR)
  945.  
  946.     def __GetAttributeColor(self, index, value):
  947.         if value > 0:
  948.             if index >= 5 and index <= 6:
  949.                 return self.SPECIAL_POSITIVE_COLOR2
  950.             elif index >= 7:
  951.                 return self.POSITIVE_COLOR
  952.             else:
  953.                 return self.SPECIAL_POSITIVE_COLOR
  954.         elif value == 0:
  955.             return self.NORMAL_COLOR
  956.         else:
  957.             return self.NEGATIVE_COLOR
  958.  
  959.     def __IsPolymorphItem(self, itemVnum):
  960.         if itemVnum >= 70103 and itemVnum <= 70106:
  961.             return 1
  962.         return 0
  963.  
  964.     def __SetPolymorphItemTitle(self, monsterVnum):
  965.         if localeInfo.IsVIETNAM():
  966.             itemName =item.GetItemName()
  967.             itemName+=" "
  968.             itemName+=nonplayer.GetMonsterName(monsterVnum)
  969.         else:
  970.             itemName =nonplayer.GetMonsterName(monsterVnum)
  971.             itemName+=" "
  972.             itemName+=item.GetItemName()
  973.         self.SetTitle(itemName)
  974.  
  975.     def __SetNormalItemTitle(self):
  976.         self.SetTitle(item.GetItemName())
  977.  
  978.     def __SetSpecialItemTitle(self):
  979.         self.AppendTextLine(item.GetItemName(), self.SPECIAL_TITLE_COLOR)
  980.  
  981.     ##START RARITY SYSTEM PART 2
  982.     def Rango_Bonus(self, attrSlot):
  983.         lista_bonus = [['1','3000'],['2','80'],['3','12'],['4','12'],['5','12'],['6','12'],['7','8'],['8','20'],['9','20'],['10','30'],['11','30'],['12','8'],['13','8'],['14','8'],['15','10'],['16','10'],['17','10'],['18','20'],['19','20'],['20','20'],['21','20'],['22','20'],['23','10'],['24','10'],['25','10'],['26','10'],['27','15'],['28','15'],['29','15'],['30','15'],['31','15'],['32','15'],['33','15'],['34','15'],['35','15'],['36','15'],['37','15'],['38','15'],['39','15'],['41','5'],['43','20'],['44','20'],['45','20'],['48','1'],['53','50'],['71','10'],['72','35']]
  984.         lista_texto = [['[EXTRÉMNÍ]',grp.GenerateColor(051,255,255, 1.0)],['[Legendární]',grp.GenerateColor(24,116,205, 1.0)],['[Vzácné]',grp.GenerateColor(0.63,0.13,0.94, 1.0)],['[Silné]',grp.GenerateColor(0,0.75,1, 1.0)],['[Obstojné]',grp.GenerateColor(0,0.79,0.34, 1.0)],['[Běžné]',grp.GenerateColor(0.9490, 0.9058, 0.7568, 1.0)],['[Neznámé]',grp.GenerateColor(193,205,193, 1.0)],['[Špatné]',grp.GenerateColor(131,139,131, 1.0)]]
  985.         i2 = 0
  986.         right = 0
  987.         for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  988.             type = attrSlot[i][0]
  989.             value = attrSlot[i][1]
  990.             if 0 == value:
  991.                 continue
  992.             else:
  993.                 for line in range(len(lista_bonus)):
  994.                     if int(lista_bonus[line-1][0]) == int(type):
  995.                         if int(lista_bonus[line-1][1]) == int(value) or int(lista_bonus[line-1][1]) < int(value):
  996.                             right = right+1
  997.                 i2 = i2+1
  998.         for i3 in [0,1,2,3,4,5,6,7]:
  999.             if int(i2) == int(int(right)+int(i3)):
  1000.                 i2 = i3
  1001.         try:
  1002.             self.AppendTextLine(lista_texto[i2][0], lista_texto[i2][1])
  1003.         except:
  1004.             dbg.TraceError("Nepovedlo se načíst seznam bonusu!")
  1005.            
  1006.     def __SetItemTitle(self, itemVnum, metinSlot, attrSlot):
  1007.         if localeInfo.IsCANADA():
  1008.             if 72726 == itemVnum or 72730 == itemVnum:
  1009.                 self.AppendTextLine(item.GetItemName(), grp.GenerateColor(1.0, 0.7843, 0.0, 1.0))
  1010.                 return
  1011.            
  1012.         if self.__IsPolymorphItem(itemVnum):
  1013.             self.__SetPolymorphItemTitle(metinSlot[0])
  1014.         else:
  1015.             if self.__IsAttr(attrSlot):
  1016.                 itemType = item.GetItemType()
  1017.                 if item.ITEM_TYPE_ARMOR == itemType or item.ITEM_TYPE_WEAPON == itemType:
  1018.                     if attrSlot[3][1] > 0:
  1019.                         self.Rango_Bonus(attrSlot)
  1020.                 self.__SetSpecialItemTitle()
  1021.                 return
  1022.  
  1023.             self.__SetNormalItemTitle()
  1024.     ##END RARITY SYSTEM PART 2
  1025.  
  1026.     #def __SetItemTitle(self, itemVnum, metinSlot, attrSlot):
  1027.         #if localeInfo.IsCANADA():
  1028.             #if 72726 == itemVnum or 72730 == itemVnum:
  1029.                 #self.AppendTextLine(item.GetItemName(), grp.GenerateColor(1.0, 0.7843, 0.0, 1.0))
  1030.                 #return
  1031.            
  1032.         #if self.__IsPolymorphItem(itemVnum):
  1033.             #self.__SetPolymorphItemTitle(metinSlot[0])
  1034.         #else:
  1035.             #if self.__IsAttr(attrSlot):
  1036.                 #self.__SetSpecialItemTitle()
  1037.                 #return
  1038.  
  1039.             #self.__SetNormalItemTitle()
  1040.  
  1041.     def __IsAttr(self, attrSlot):
  1042.         if not attrSlot:
  1043.             return False
  1044.  
  1045.         for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  1046.             type = attrSlot[i][0]
  1047.             if 0 != type:
  1048.                 return True
  1049.  
  1050.         return False
  1051.    
  1052.     def AddRefineItemData(self, itemVnum, metinSlot, attrSlot = 0):
  1053.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1054.             metinSlotData=metinSlot[i]
  1055.             if self.GetMetinItemIndex(metinSlotData) == constInfo.ERROR_METIN_STONE:
  1056.                 metinSlot[i]=player.METIN_SOCKET_TYPE_SILVER
  1057.  
  1058.         self.AddItemData(itemVnum, metinSlot, attrSlot)
  1059.  
  1060.     def AddItemData_Offline(self, itemVnum, itemDesc, itemSummary, metinSlot, attrSlot):
  1061.         self.__AdjustMaxWidth(attrSlot, itemDesc)
  1062.         self.__SetItemTitle(itemVnum, metinSlot, attrSlot)
  1063.        
  1064.         if self.__IsHair(itemVnum):
  1065.             self.__AppendHairIcon(itemVnum)
  1066.  
  1067.         ### Description ###
  1068.         self.AppendDescription(itemDesc, 26)
  1069.         self.AppendDescription(itemSummary, 26, self.CONDITION_COLOR)
  1070.  
  1071.     def AddItemData(self, itemVnum, metinSlot, attrSlot = 0, flags = 0, unbindTime = 0):
  1072.         self.itemVnum = itemVnum
  1073.         item.SelectItem(itemVnum)
  1074.         itemType = item.GetItemType()
  1075.         itemSubType = item.GetItemSubType()
  1076.  
  1077.         if 50026 == itemVnum:
  1078.             if 0 != metinSlot:
  1079.                 name = item.GetItemName()
  1080.                 if metinSlot[0] > 0:
  1081.                     name += " "
  1082.                     name += localeInfo.NumberToMoneyString(metinSlot[0])
  1083.                 self.SetTitle(name)
  1084.  
  1085.                 self.ShowToolTip()
  1086.             return
  1087.  
  1088.         ### Skill Book ###
  1089.         elif 50300 == itemVnum:
  1090.             if 0 != metinSlot:
  1091.                 self.__SetSkillBookToolTip(metinSlot[0], localeInfo.TOOLTIP_SKILLBOOK_NAME, 1)
  1092.  
  1093.                 self.ShowToolTip()
  1094.             return
  1095.         elif 70037 == itemVnum:
  1096.             if 0 != metinSlot:
  1097.                 self.__SetSkillBookToolTip(metinSlot[0], localeInfo.TOOLTIP_SKILL_FORGET_BOOK_NAME, 0)
  1098.                 self.AppendDescription(item.GetItemDescription(), 26)
  1099.                 self.AppendDescription(item.GetItemSummary(), 26, self.CONDITION_COLOR)
  1100.  
  1101.                 self.ShowToolTip()
  1102.             return
  1103.         elif 70055 == itemVnum:
  1104.             if 0 != metinSlot:
  1105.                 self.__SetSkillBookToolTip(metinSlot[0], localeInfo.TOOLTIP_SKILL_FORGET_BOOK_NAME, 0)
  1106.                 self.AppendDescription(item.GetItemDescription(), 26)
  1107.                 self.AppendDescription(item.GetItemSummary(), 26, self.CONDITION_COLOR)
  1108.  
  1109.                 self.ShowToolTip()
  1110.             return
  1111.         ###########################################################################################
  1112.  
  1113.  
  1114.         itemDesc = item.GetItemDescription()
  1115.         itemSummary = item.GetItemSummary()
  1116.  
  1117.         isCostumeItem = 0
  1118.         isCostumeHair = 0
  1119.         isCostumeBody = 0
  1120.         isCostumeAcce = 0
  1121.         isCostumeMount = 0
  1122.            
  1123.         if app.ENABLE_COSTUME_SYSTEM:
  1124.             if item.ITEM_TYPE_COSTUME == itemType:
  1125.                 isCostumeItem = 1
  1126.                 isCostumeHair = item.COSTUME_TYPE_HAIR == itemSubType
  1127.                 isCostumeBody = item.COSTUME_TYPE_BODY == itemSubType
  1128.                 isCostumeAcce = item.COSTUME_TYPE_ACCE == itemSubType
  1129.                 isCostumeMount = item.COSTUME_TYPE_MOUNT == itemSubType
  1130.                
  1131.                 #dbg.TraceError("IS_COSTUME_ITEM! body(%d) hair(%d)" % (isCostumeBody, isCostumeHair))
  1132.  
  1133.         self.__AdjustMaxWidth(attrSlot, itemDesc)
  1134.         self.__SetItemTitle(itemVnum, metinSlot, attrSlot)
  1135.        
  1136.         ### Hair Preview Image ###
  1137.         if self.__IsHair(itemVnum):
  1138.             self.__AppendHairIcon(itemVnum)
  1139.  
  1140.         ### Description ###
  1141.         self.AppendDescription(itemDesc, 26)
  1142.         self.AppendDescription(itemSummary, 26, self.CONDITION_COLOR)
  1143.  
  1144.         ### Weapon ###
  1145.         if item.ITEM_TYPE_WEAPON == itemType:
  1146.  
  1147.             self.__AppendLimitInformation()
  1148.  
  1149.             self.AppendSpace(5)
  1150.  
  1151.             ## ??? ?? ??? ?? ????.
  1152.             if item.WEAPON_FAN == itemSubType:
  1153.                 self.__AppendMagicAttackInfo()
  1154.                 self.__AppendAttackPowerInfo()
  1155.  
  1156.             else:
  1157.                 self.__AppendAttackPowerInfo()
  1158.                 self.__AppendMagicAttackInfo()
  1159.  
  1160.             self.__AppendAffectInformation()
  1161.             self.__AppendAttributeInformation(attrSlot)
  1162.  
  1163.             self.AppendWearableInformation()
  1164.             self.__AppendMetinSlotInfo(metinSlot)
  1165.  
  1166.         ### Armor ###
  1167.         elif item.ITEM_TYPE_ARMOR == itemType:
  1168.             self.__AppendLimitInformation()
  1169.  
  1170.             ## ???
  1171.             defGrade = item.GetValue(1)
  1172.             defBonus = item.GetValue(5)*2 ## ??? ?? ?? ?? ??? ??
  1173.             if defGrade > 0:
  1174.                 self.AppendSpace(5)
  1175.                 self.AppendTextLine(localeInfo.TOOLTIP_ITEM_DEF_GRADE % (defGrade+defBonus), self.GetChangeTextLineColor(defGrade))
  1176.  
  1177.             self.__AppendMagicDefenceInfo()
  1178.             self.__AppendAffectInformation()
  1179.             self.__AppendAttributeInformation(attrSlot)
  1180.  
  1181.             self.AppendWearableInformation()
  1182.  
  1183.             if itemSubType in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):             
  1184.                 self.__AppendAccessoryMetinSlotInfo(metinSlot, constInfo.GET_ACCESSORY_MATERIAL_VNUM(itemVnum, itemSubType))
  1185.             else:
  1186.                 self.__AppendMetinSlotInfo(metinSlot)
  1187.  
  1188.         ### Ring Slot Item (Not UNIQUE) ###
  1189.         elif item.ITEM_TYPE_RING == itemType:
  1190.             self.__AppendLimitInformation()
  1191.             self.__AppendAffectInformation()
  1192.             self.__AppendAttributeInformation(attrSlot)
  1193.  
  1194.             #?? ?? ??? ???? ?? ?? ??
  1195.             #self.__AppendAccessoryMetinSlotInfo(metinSlot, 99001)
  1196.  
  1197.         ### Belt Item ###
  1198.         elif item.ITEM_TYPE_BELT == itemType:
  1199.             self.__AppendLimitInformation()
  1200.             self.__AppendAffectInformation()
  1201.             self.__AppendAttributeInformation(attrSlot)
  1202.  
  1203.             self.__AppendAccessoryMetinSlotInfo(metinSlot, constInfo.GET_BELT_MATERIAL_VNUM(itemVnum))
  1204.  
  1205.         ## ??? ??? ##
  1206.         elif 0 != isCostumeItem:
  1207.             self.__AppendLimitInformation()
  1208.             self.__AppendAffectInformation()
  1209.             if isCostumeAcce != 0:
  1210.                 self.__AppendAcceAttributeInformation(attrSlot)
  1211.             else:
  1212.                 self.__AppendAttributeInformation(attrSlot)
  1213.            
  1214.             self.AppendWearableInformation()
  1215.             bHasRealtimeFlag = 0
  1216.             for i in xrange(item.LIMIT_MAX_NUM):
  1217.                 (limitType, limitValue) = item.GetLimit(i)
  1218.                 if item.LIMIT_REAL_TIME == limitType:
  1219.                     bHasRealtimeFlag = 1
  1220.            
  1221.             if 1 == bHasRealtimeFlag:
  1222.                 self.AppendMallItemLastTime(metinSlot[0])
  1223.            
  1224.             if itemVnum >= 85001 and itemVnum <= 85008:
  1225.                 if metinSlot != 0:
  1226.                     absChance = int(metinSlot[1])
  1227.                     if absChance > 0:
  1228.                         self.AppendSpace(5)
  1229.                         self.AppendTextLine(localeInfo.ACCE_ABSORB_CHANCE % (absChance), self.CONDITION_COLOR)
  1230.                
  1231.         ## Rod ##
  1232.         elif item.ITEM_TYPE_ROD == itemType:
  1233.  
  1234.             if 0 != metinSlot:
  1235.                 curLevel = item.GetValue(0) / 10
  1236.                 curEXP = metinSlot[0]
  1237.                 maxEXP = item.GetValue(2)
  1238.                 self.__AppendLimitInformation()
  1239.                 self.__AppendRodInformation(curLevel, curEXP, maxEXP)
  1240.  
  1241.         ## Pick ##
  1242.         elif item.ITEM_TYPE_PICK == itemType:
  1243.  
  1244.             if 0 != metinSlot:
  1245.                 curLevel = item.GetValue(0) / 10
  1246.                 curEXP = metinSlot[0]
  1247.                 maxEXP = item.GetValue(2)
  1248.                 self.__AppendLimitInformation()
  1249.                 self.__AppendPickInformation(curLevel, curEXP, maxEXP)
  1250.  
  1251.         ## Lottery ##
  1252.         elif item.ITEM_TYPE_LOTTERY == itemType:
  1253.             if 0 != metinSlot:
  1254.  
  1255.                 ticketNumber = int(metinSlot[0])
  1256.                 stepNumber = int(metinSlot[1])
  1257.  
  1258.                 self.AppendSpace(5)
  1259.                 self.AppendTextLine(localeInfo.TOOLTIP_LOTTERY_STEP_NUMBER % (stepNumber), self.NORMAL_COLOR)
  1260.                 self.AppendTextLine(localeInfo.TOOLTIP_LOTTO_NUMBER % (ticketNumber), self.NORMAL_COLOR);
  1261.  
  1262.         ### Metin ###
  1263.         elif item.ITEM_TYPE_METIN == itemType:
  1264.             self.AppendMetinInformation()
  1265.             self.AppendMetinWearInformation()
  1266.  
  1267.         ### Fish ###
  1268.         elif item.ITEM_TYPE_FISH == itemType:
  1269.             if 0 != metinSlot:
  1270.                 self.__AppendFishInfo(metinSlot[0])
  1271.        
  1272.         ## item.ITEM_TYPE_BLEND
  1273.         elif item.ITEM_TYPE_BLEND == itemType:
  1274.             self.__AppendLimitInformation()
  1275.  
  1276.             if metinSlot:
  1277.                 affectType = metinSlot[0]
  1278.                 affectValue = metinSlot[1]
  1279.                 time = metinSlot[2]
  1280.                 self.AppendSpace(5)
  1281.                 affectText = self.__GetAffectString(affectType, affectValue)
  1282.  
  1283.                 self.AppendTextLine(affectText, self.NORMAL_COLOR)
  1284.  
  1285.                 if time > 0:
  1286.                     minute = (time / 60)
  1287.                     second = (time % 60)
  1288.                     timeString = localeInfo.TOOLTIP_POTION_TIME
  1289.  
  1290.                     if minute > 0:
  1291.                         timeString += str(minute) + localeInfo.TOOLTIP_POTION_MIN
  1292.                     if second > 0:
  1293.                         timeString += " " + str(second) + localeInfo.TOOLTIP_POTION_SEC
  1294.  
  1295.                     self.AppendTextLine(timeString)
  1296.                 else:
  1297.                     self.AppendTextLine(localeInfo.BLEND_POTION_NO_TIME)
  1298.             else:
  1299.                 self.AppendTextLine("BLEND_POTION_NO_INFO")
  1300.  
  1301.         elif item.ITEM_TYPE_UNIQUE == itemType:
  1302.             if 0 != metinSlot:
  1303.                 bHasRealtimeFlag = 0
  1304.                
  1305.                 for i in xrange(item.LIMIT_MAX_NUM):
  1306.                     (limitType, limitValue) = item.GetLimit(i)
  1307.  
  1308.                     if item.LIMIT_REAL_TIME == limitType:
  1309.                         bHasRealtimeFlag = 1
  1310.                
  1311.                 if 1 == bHasRealtimeFlag:
  1312.                     self.AppendMallItemLastTime(metinSlot[0])      
  1313.                 else:
  1314.                     time = metinSlot[player.METIN_SOCKET_MAX_NUM-1]
  1315.  
  1316.                     if 1 == item.GetValue(2): ## ??? ?? Flag / ?? ??? ??
  1317.                         self.AppendMallItemLastTime(time)
  1318.                     else:
  1319.                         self.AppendUniqueItemLastTime(time)
  1320.  
  1321.         ### Use ###
  1322.         elif item.ITEM_TYPE_USE == itemType:
  1323.             self.__AppendLimitInformation()
  1324.  
  1325.             if item.USE_POTION == itemSubType or item.USE_POTION_NODELAY == itemSubType:
  1326.                 self.__AppendPotionInformation()
  1327.  
  1328.             elif item.USE_ABILITY_UP == itemSubType:
  1329.                 self.__AppendAbilityPotionInformation()
  1330.  
  1331.  
  1332.             ## ?? ???
  1333.             if 27989 == itemVnum or 76006 == itemVnum:
  1334.                 if 0 != metinSlot:
  1335.                     useCount = int(metinSlot[0])
  1336.  
  1337.                     self.AppendSpace(5)
  1338.                     self.AppendTextLine(localeInfo.TOOLTIP_REST_USABLE_COUNT % (6 - useCount), self.NORMAL_COLOR)
  1339.  
  1340.             ## ??? ???
  1341.             elif 50004 == itemVnum:
  1342.                 if 0 != metinSlot:
  1343.                     useCount = int(metinSlot[0])
  1344.  
  1345.                     self.AppendSpace(5)
  1346.                     self.AppendTextLine(localeInfo.TOOLTIP_REST_USABLE_COUNT % (10 - useCount), self.NORMAL_COLOR)
  1347.  
  1348.             ## ????
  1349.             elif constInfo.IS_AUTO_POTION(itemVnum):
  1350.                 if 0 != metinSlot:
  1351.                     ## 0: ???, 1: ???, 2: ??
  1352.                     isActivated = int(metinSlot[0])
  1353.                     usedAmount = float(metinSlot[1])
  1354.                     totalAmount = float(metinSlot[2])
  1355.                    
  1356.                     if 0 == totalAmount:
  1357.                         totalAmount = 1
  1358.                    
  1359.                     self.AppendSpace(5)
  1360.  
  1361.                     if 0 != isActivated:
  1362.                         self.AppendTextLine("(%s)" % (localeInfo.TOOLTIP_AUTO_POTION_USING), self.SPECIAL_POSITIVE_COLOR)
  1363.                         self.AppendSpace(5)
  1364.                        
  1365.                     self.AppendTextLine(localeInfo.TOOLTIP_AUTO_POTION_REST % (100.0 - ((usedAmount / totalAmount) * 100.0)), self.POSITIVE_COLOR)
  1366.                                
  1367.             ## ?? ???
  1368.             elif itemVnum in WARP_SCROLLS:
  1369.                 if 0 != metinSlot:
  1370.                     xPos = int(metinSlot[0])
  1371.                     yPos = int(metinSlot[1])
  1372.  
  1373.                     if xPos != 0 and yPos != 0:
  1374.                         (mapName, xBase, yBase) = background.GlobalPositionToMapInfo(xPos, yPos)
  1375.                        
  1376.                         localeMapName=localeInfo.MINIMAP_ZONE_NAME_DICT.get(mapName, "")
  1377.  
  1378.                         self.AppendSpace(5)
  1379.  
  1380.                         if localeMapName!="":                      
  1381.                             self.AppendTextLine(localeInfo.TOOLTIP_MEMORIZED_POSITION % (localeMapName, int(xPos-xBase)/100, int(yPos-yBase)/100), self.NORMAL_COLOR)
  1382.                         else:
  1383.                             self.AppendTextLine(localeInfo.TOOLTIP_MEMORIZED_POSITION_ERROR % (int(xPos)/100, int(yPos)/100), self.NORMAL_COLOR)
  1384.                             dbg.TraceError("NOT_EXIST_IN_MINIMAP_ZONE_NAME_DICT: %s" % mapName)
  1385.  
  1386.             #####
  1387.             if item.USE_SPECIAL == itemSubType:
  1388.                 bHasRealtimeFlag = 0
  1389.                 for i in xrange(item.LIMIT_MAX_NUM):
  1390.                     (limitType, limitValue) = item.GetLimit(i)
  1391.  
  1392.                     if item.LIMIT_REAL_TIME == limitType:
  1393.                         bHasRealtimeFlag = 1
  1394.        
  1395.                 ## ??? ?? ??? ???. ex) ?? ?? : 6? 6?? 58?
  1396.                 if 1 == bHasRealtimeFlag:
  1397.                     self.AppendMallItemLastTime(metinSlot[0])
  1398.                 else:
  1399.                     # ... ??... ???? ?? ?? ?? ??? ???...
  1400.                     # ? ??? ??? ??? ??? ?? ??...
  1401.                     if 0 != metinSlot:
  1402.                         time = metinSlot[player.METIN_SOCKET_MAX_NUM-1]
  1403.  
  1404.                         ## ??? ?? Flag
  1405.                         if 1 == item.GetValue(2):
  1406.                             self.AppendMallItemLastTime(time)
  1407.            
  1408.             elif item.USE_TIME_CHARGE_PER == itemSubType:
  1409.                 bHasRealtimeFlag = 0
  1410.                 for i in xrange(item.LIMIT_MAX_NUM):
  1411.                     (limitType, limitValue) = item.GetLimit(i)
  1412.  
  1413.                     if item.LIMIT_REAL_TIME == limitType:
  1414.                         bHasRealtimeFlag = 1
  1415.                 if metinSlot[2]:
  1416.                     self.AppendTextLine(localeInfo.TOOLTIP_TIME_CHARGER_PER(metinSlot[2]))
  1417.                 else:
  1418.                     self.AppendTextLine(localeInfo.TOOLTIP_TIME_CHARGER_PER(item.GetValue(0)))
  1419.        
  1420.                 ## ??? ?? ??? ???. ex) ?? ?? : 6? 6?? 58?
  1421.                 if 1 == bHasRealtimeFlag:
  1422.                     self.AppendMallItemLastTime(metinSlot[0])
  1423.  
  1424.             elif item.USE_TIME_CHARGE_FIX == itemSubType:
  1425.                 bHasRealtimeFlag = 0
  1426.                 for i in xrange(item.LIMIT_MAX_NUM):
  1427.                     (limitType, limitValue) = item.GetLimit(i)
  1428.  
  1429.                     if item.LIMIT_REAL_TIME == limitType:
  1430.                         bHasRealtimeFlag = 1
  1431.                 if metinSlot[2]:
  1432.                     self.AppendTextLine(localeInfo.TOOLTIP_TIME_CHARGER_FIX(metinSlot[2]))
  1433.                 else:
  1434.                     self.AppendTextLine(localeInfo.TOOLTIP_TIME_CHARGER_FIX(item.GetValue(0)))
  1435.        
  1436.                 ## ??? ?? ??? ???. ex) ?? ?? : 6? 6?? 58?
  1437.                 if 1 == bHasRealtimeFlag:
  1438.                     self.AppendMallItemLastTime(metinSlot[0])
  1439.  
  1440.         elif item.ITEM_TYPE_QUEST == itemType:
  1441.             for i in xrange(item.LIMIT_MAX_NUM):
  1442.                 (limitType, limitValue) = item.GetLimit(i)
  1443.  
  1444.                 if item.LIMIT_REAL_TIME == limitType:
  1445.                     self.AppendMallItemLastTime(metinSlot[0])
  1446.         elif item.ITEM_TYPE_DS == itemType:
  1447.             self.AppendTextLine(self.__DragonSoulInfoString(itemVnum))
  1448.             self.__AppendAttributeInformation(attrSlot)
  1449.         else:
  1450.             self.__AppendLimitInformation()
  1451.  
  1452.         for i in xrange(item.LIMIT_MAX_NUM):
  1453.             (limitType, limitValue) = item.GetLimit(i)
  1454.             #dbg.TraceError("LimitType : %d, limitValue : %d" % (limitType, limitValue))
  1455.            
  1456.             if item.LIMIT_REAL_TIME_START_FIRST_USE == limitType:
  1457.                 self.AppendRealTimeStartFirstUseLastTime(item, metinSlot, i)
  1458.                 #dbg.TraceError("2) REAL_TIME_START_FIRST_USE flag On ")
  1459.                
  1460.             elif item.LIMIT_TIMER_BASED_ON_WEAR == limitType:
  1461.                 self.AppendTimerBasedOnWearLastTime(metinSlot)
  1462.                 #dbg.TraceError("1) REAL_TIME flag On ")
  1463.  
  1464.  
  1465.                
  1466.         self.ShowToolTip()
  1467.  
  1468.     def __DragonSoulInfoString (self, dwVnum):
  1469.         step = (dwVnum / 100) % 10
  1470.         refine = (dwVnum / 10) % 10
  1471.         if 0 == step:
  1472.             return localeInfo.DRAGON_SOUL_STEP_LEVEL1 + " " + localeInfo.DRAGON_SOUL_STRENGTH(refine)
  1473.         elif 1 == step:
  1474.             return localeInfo.DRAGON_SOUL_STEP_LEVEL2 + " " + localeInfo.DRAGON_SOUL_STRENGTH(refine)
  1475.         elif 2 == step:
  1476.             return localeInfo.DRAGON_SOUL_STEP_LEVEL3 + " " + localeInfo.DRAGON_SOUL_STRENGTH(refine)
  1477.         elif 3 == step:
  1478.             return localeInfo.DRAGON_SOUL_STEP_LEVEL4 + " " + localeInfo.DRAGON_SOUL_STRENGTH(refine)
  1479.         elif 4 == step:
  1480.             return localeInfo.DRAGON_SOUL_STEP_LEVEL5 + " " + localeInfo.DRAGON_SOUL_STRENGTH(refine)
  1481.         else:
  1482.             return ""
  1483.  
  1484.  
  1485.     ## ?????
  1486.     def __IsHair(self, itemVnum):
  1487.         return (self.__IsOldHair(itemVnum) or
  1488.             self.__IsNewHair(itemVnum) or
  1489.             self.__IsNewHair2(itemVnum) or
  1490.             self.__IsNewHair3(itemVnum) or
  1491.             self.__IsCostumeHair(itemVnum)
  1492.             )
  1493.  
  1494.     def __IsOldHair(self, itemVnum):
  1495.         return itemVnum > 73000 and itemVnum < 74000   
  1496.  
  1497.     def __IsNewHair(self, itemVnum):
  1498.         return itemVnum > 74000 and itemVnum < 75000   
  1499.  
  1500.     def __IsNewHair2(self, itemVnum):
  1501.         return itemVnum > 75000 and itemVnum < 76000   
  1502.  
  1503.     def __IsNewHair3(self, itemVnum):
  1504.         return ((74012 < itemVnum and itemVnum < 74022) or
  1505.             (74262 < itemVnum and itemVnum < 74272) or
  1506.             (74512 < itemVnum and itemVnum < 74522) or
  1507.             (74762 < itemVnum and itemVnum < 74772) or
  1508.             (45000 < itemVnum and itemVnum < 47000))
  1509.  
  1510.     def __IsCostumeHair(self, itemVnum):
  1511.         return app.ENABLE_COSTUME_SYSTEM and self.__IsNewHair3(itemVnum - 100000)
  1512.        
  1513.     def __AppendHairIcon(self, itemVnum):
  1514.         itemImage = ui.ImageBox()
  1515.         itemImage.SetParent(self)
  1516.         itemImage.Show()           
  1517.  
  1518.         if self.__IsOldHair(itemVnum):
  1519.             itemImage.LoadImage("d:/ymir work/item/quest/"+str(itemVnum)+".tga")
  1520.         elif self.__IsNewHair3(itemVnum):
  1521.             itemImage.LoadImage("icon/hair/%d.sub" % (itemVnum))
  1522.         elif self.__IsNewHair(itemVnum): # ?? ?? ??? ????? ????. ??? ???? 1000?? ??? ???.
  1523.             itemImage.LoadImage("d:/ymir work/item/quest/"+str(itemVnum-1000)+".tga")
  1524.         elif self.__IsNewHair2(itemVnum):
  1525.             itemImage.LoadImage("icon/hair/%d.sub" % (itemVnum))
  1526.         elif self.__IsCostumeHair(itemVnum):
  1527.             itemImage.LoadImage("icon/hair/%d.sub" % (itemVnum - 100000))
  1528.  
  1529.         itemImage.SetPosition(itemImage.GetWidth()/2, self.toolTipHeight)
  1530.         self.toolTipHeight += itemImage.GetHeight()
  1531.         #self.toolTipWidth += itemImage.GetWidth()/2
  1532.         self.childrenList.append(itemImage)
  1533.         self.ResizeToolTip()
  1534.  
  1535.     ## ???? ? Description ? ?? ?? ???? ????
  1536.     def __AdjustMaxWidth(self, attrSlot, desc):
  1537.         newToolTipWidth = self.toolTipWidth
  1538.         newToolTipWidth = max(self.__AdjustAttrMaxWidth(attrSlot), newToolTipWidth)
  1539.         newToolTipWidth = max(self.__AdjustDescMaxWidth(desc), newToolTipWidth)
  1540.         if newToolTipWidth > self.toolTipWidth:
  1541.             self.toolTipWidth = newToolTipWidth
  1542.             self.ResizeToolTip()
  1543.  
  1544.     def __AdjustAttrMaxWidth(self, attrSlot):
  1545.         if 0 == attrSlot:
  1546.             return self.toolTipWidth
  1547.  
  1548.         maxWidth = self.toolTipWidth
  1549.         for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  1550.             type = attrSlot[i][0]
  1551.             value = attrSlot[i][1]
  1552.             if self.ATTRIBUTE_NEED_WIDTH.has_key(type):
  1553.                 if value > 0:
  1554.                     maxWidth = max(self.ATTRIBUTE_NEED_WIDTH[type], maxWidth)
  1555.  
  1556.                     # ATTR_CHANGE_TOOLTIP_WIDTH
  1557.                     #self.toolTipWidth = max(self.ATTRIBUTE_NEED_WIDTH[type], self.toolTipWidth)
  1558.                     #self.ResizeToolTip()
  1559.                     # END_OF_ATTR_CHANGE_TOOLTIP_WIDTH
  1560.  
  1561.         return maxWidth
  1562.  
  1563.     def __AdjustDescMaxWidth(self, desc):
  1564.         if len(desc) < DESC_DEFAULT_MAX_COLS:
  1565.             return self.toolTipWidth
  1566.    
  1567.         return DESC_WESTERN_MAX_WIDTH
  1568.  
  1569.     def __SetSkillBookToolTip(self, skillIndex, bookName, skillGrade):
  1570.         skillName = skill.GetSkillName(skillIndex)
  1571.  
  1572.         if not skillName:
  1573.             return
  1574.  
  1575.         if localeInfo.IsVIETNAM():
  1576.             itemName = bookName + " " + skillName
  1577.         else:
  1578.             itemName = skillName + " " + bookName
  1579.         self.SetTitle(itemName)
  1580.  
  1581.     def __AppendPickInformation(self, curLevel, curEXP, maxEXP):
  1582.         self.AppendSpace(5)
  1583.         self.AppendTextLine(localeInfo.TOOLTIP_PICK_LEVEL % (curLevel), self.NORMAL_COLOR)
  1584.         self.AppendTextLine(localeInfo.TOOLTIP_PICK_EXP % (curEXP, maxEXP), self.NORMAL_COLOR)
  1585.  
  1586.         if curEXP == maxEXP:
  1587.             self.AppendSpace(5)
  1588.             self.AppendTextLine(localeInfo.TOOLTIP_PICK_UPGRADE1, self.NORMAL_COLOR)
  1589.             self.AppendTextLine(localeInfo.TOOLTIP_PICK_UPGRADE2, self.NORMAL_COLOR)
  1590.             self.AppendTextLine(localeInfo.TOOLTIP_PICK_UPGRADE3, self.NORMAL_COLOR)
  1591.  
  1592.  
  1593.     def __AppendRodInformation(self, curLevel, curEXP, maxEXP):
  1594.         self.AppendSpace(5)
  1595.         self.AppendTextLine(localeInfo.TOOLTIP_FISHINGROD_LEVEL % (curLevel), self.NORMAL_COLOR)
  1596.         self.AppendTextLine(localeInfo.TOOLTIP_FISHINGROD_EXP % (curEXP, maxEXP), self.NORMAL_COLOR)
  1597.  
  1598.         if curEXP == maxEXP:
  1599.             self.AppendSpace(5)
  1600.             self.AppendTextLine(localeInfo.TOOLTIP_FISHINGROD_UPGRADE1, self.NORMAL_COLOR)
  1601.             self.AppendTextLine(localeInfo.TOOLTIP_FISHINGROD_UPGRADE2, self.NORMAL_COLOR)
  1602.             self.AppendTextLine(localeInfo.TOOLTIP_FISHINGROD_UPGRADE3, self.NORMAL_COLOR)
  1603.  
  1604.     def __AppendLimitInformation(self):
  1605.  
  1606.         appendSpace = False
  1607.  
  1608.         for i in xrange(item.LIMIT_MAX_NUM):
  1609.  
  1610.             (limitType, limitValue) = item.GetLimit(i)
  1611.  
  1612.             if limitValue > 0:
  1613.                 if False == appendSpace:
  1614.                     self.AppendSpace(5)
  1615.                     appendSpace = True
  1616.  
  1617.             else:
  1618.                 continue
  1619.  
  1620.             if item.LIMIT_LEVEL == limitType:
  1621.                 color = self.GetLimitTextLineColor(player.GetStatus(player.LEVEL), limitValue)
  1622.                 self.AppendTextLine(localeInfo.TOOLTIP_ITEM_LIMIT_LEVEL % (limitValue), color)
  1623.             """
  1624.             elif item.LIMIT_STR == limitType:
  1625.                 color = self.GetLimitTextLineColor(player.GetStatus(player.ST), limitValue)
  1626.                 self.AppendTextLine(localeInfo.TOOLTIP_ITEM_LIMIT_STR % (limitValue), color)
  1627.             elif item.LIMIT_DEX == limitType:
  1628.                 color = self.GetLimitTextLineColor(player.GetStatus(player.DX), limitValue)
  1629.                 self.AppendTextLine(localeInfo.TOOLTIP_ITEM_LIMIT_DEX % (limitValue), color)
  1630.             elif item.LIMIT_INT == limitType:
  1631.                 color = self.GetLimitTextLineColor(player.GetStatus(player.IQ), limitValue)
  1632.                 self.AppendTextLine(localeInfo.TOOLTIP_ITEM_LIMIT_INT % (limitValue), color)
  1633.             elif item.LIMIT_CON == limitType:
  1634.                 color = self.GetLimitTextLineColor(player.GetStatus(player.HT), limitValue)
  1635.                 self.AppendTextLine(localeInfo.TOOLTIP_ITEM_LIMIT_CON % (limitValue), color)
  1636.             """
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.     def __GetAffectString(self, affectType, affectValue):
  1650.         if 0 == affectType:
  1651.             return None
  1652.  
  1653.         if 0 == affectValue:
  1654.             return None
  1655.  
  1656.         try:
  1657.             return self.AFFECT_DICT[affectType](affectValue)
  1658.         except TypeError:
  1659.             return "UNKNOWN_VALUE[%s] %s" % (affectType, affectValue)
  1660.         except KeyError:
  1661.             return "UNKNOWN_TYPE[%s] %s" % (affectType, affectValue)
  1662.  
  1663.     def __AppendAffectInformation(self):
  1664.         for i in xrange(item.ITEM_APPLY_MAX_NUM):
  1665.  
  1666.             (affectType, affectValue) = item.GetAffect(i)
  1667.  
  1668.             affectString = self.__GetAffectString(affectType, affectValue)
  1669.             if affectString:
  1670.                 self.AppendTextLine(affectString, self.GetChangeTextLineColor(affectValue))
  1671.  
  1672.     def AppendWearableInformation(self):
  1673.  
  1674.         self.AppendSpace(5)
  1675.         self.AppendTextLine(localeInfo.TOOLTIP_ITEM_WEARABLE_JOB, self.NORMAL_COLOR)
  1676.  
  1677.         flagList = (
  1678.             not item.IsAntiFlag(item.ITEM_ANTIFLAG_WARRIOR),
  1679.             not item.IsAntiFlag(item.ITEM_ANTIFLAG_ASSASSIN),
  1680.             not item.IsAntiFlag(item.ITEM_ANTIFLAG_SURA),
  1681.             not item.IsAntiFlag(item.ITEM_ANTIFLAG_SHAMAN))
  1682.  
  1683.         characterNames = ""
  1684.         for i in xrange(self.CHARACTER_COUNT):
  1685.  
  1686.             name = self.CHARACTER_NAMES[i]
  1687.             flag = flagList[i]
  1688.  
  1689.             if flag:
  1690.                 characterNames += " "
  1691.                 characterNames += name
  1692.  
  1693.         textLine = self.AppendTextLine(characterNames, self.NORMAL_COLOR, True)
  1694.         textLine.SetFeather()
  1695.  
  1696.         if item.IsAntiFlag(item.ITEM_ANTIFLAG_MALE):
  1697.             textLine = self.AppendTextLine(localeInfo.FOR_FEMALE, self.NORMAL_COLOR, True)
  1698.             textLine.SetFeather()
  1699.  
  1700.         if item.IsAntiFlag(item.ITEM_ANTIFLAG_FEMALE):
  1701.             textLine = self.AppendTextLine(localeInfo.FOR_MALE, self.NORMAL_COLOR, True)
  1702.             textLine.SetFeather()
  1703.  
  1704.     def __AppendPotionInformation(self):
  1705.         self.AppendSpace(5)
  1706.  
  1707.         healHP = item.GetValue(0)
  1708.         healSP = item.GetValue(1)
  1709.         healStatus = item.GetValue(2)
  1710.         healPercentageHP = item.GetValue(3)
  1711.         healPercentageSP = item.GetValue(4)
  1712.  
  1713.         if healHP > 0:
  1714.             self.AppendTextLine(localeInfo.TOOLTIP_POTION_PLUS_HP_POINT % healHP, self.GetChangeTextLineColor(healHP))
  1715.         if healSP > 0:
  1716.             self.AppendTextLine(localeInfo.TOOLTIP_POTION_PLUS_SP_POINT % healSP, self.GetChangeTextLineColor(healSP))
  1717.         if healStatus != 0:
  1718.             self.AppendTextLine(localeInfo.TOOLTIP_POTION_CURE)
  1719.         if healPercentageHP > 0:
  1720.             self.AppendTextLine(localeInfo.TOOLTIP_POTION_PLUS_HP_PERCENT % healPercentageHP, self.GetChangeTextLineColor(healPercentageHP))
  1721.         if healPercentageSP > 0:
  1722.             self.AppendTextLine(localeInfo.TOOLTIP_POTION_PLUS_SP_PERCENT % healPercentageSP, self.GetChangeTextLineColor(healPercentageSP))
  1723.  
  1724.     def __AppendAbilityPotionInformation(self):
  1725.  
  1726.         self.AppendSpace(5)
  1727.  
  1728.         abilityType = item.GetValue(0)
  1729.         time = item.GetValue(1)
  1730.         point = item.GetValue(2)
  1731.  
  1732.         if abilityType == item.APPLY_ATT_SPEED:
  1733.             self.AppendTextLine(localeInfo.TOOLTIP_POTION_PLUS_ATTACK_SPEED % point, self.GetChangeTextLineColor(point))
  1734.         elif abilityType == item.APPLY_MOV_SPEED:
  1735.             self.AppendTextLine(localeInfo.TOOLTIP_POTION_PLUS_MOVING_SPEED % point, self.GetChangeTextLineColor(point))
  1736.  
  1737.         if time > 0:
  1738.             minute = (time / 60)
  1739.             second = (time % 60)
  1740.             timeString = localeInfo.TOOLTIP_POTION_TIME
  1741.  
  1742.             if minute > 0:
  1743.                 timeString += str(minute) + localeInfo.TOOLTIP_POTION_MIN
  1744.             if second > 0:
  1745.                 timeString += " " + str(second) + localeInfo.TOOLTIP_POTION_SEC
  1746.  
  1747.             self.AppendTextLine(timeString)
  1748.  
  1749.     def GetPriceColor(self, price):
  1750.         if price>=constInfo.HIGH_PRICE:
  1751.             return self.HIGH_PRICE_COLOR
  1752.         if price>=constInfo.MIDDLE_PRICE:
  1753.             return self.MIDDLE_PRICE_COLOR
  1754.         else:
  1755.             return self.LOW_PRICE_COLOR
  1756.                        
  1757.     def AppendPrice(self, price):  
  1758.         self.AppendSpace(5)
  1759.         self.AppendTextLine(localeInfo.TOOLTIP_BUYPRICE  % (localeInfo.NumberToMoneyString(price)), self.GetPriceColor(price))
  1760.        
  1761.     def AppendPriceBySecondaryCoin(self, price):
  1762.         self.AppendSpace(5)
  1763.         self.AppendTextLine(localeInfo.TOOLTIP_BUYPRICE  % (localeInfo.NumberToSecondaryCoinString(price)), self.GetPriceColor(price))
  1764.  
  1765.     def AppendSellingPrice(self, price):
  1766.         if item.IsAntiFlag(item.ITEM_ANTIFLAG_SELL):           
  1767.             self.AppendTextLine(localeInfo.TOOLTIP_ANTI_SELL, self.DISABLE_COLOR)
  1768.             self.AppendSpace(5)
  1769.         else:
  1770.             self.AppendTextLine(localeInfo.TOOLTIP_SELLPRICE % (localeInfo.NumberToMoneyString(price)), self.GetPriceColor(price))
  1771.             self.AppendSpace(5)
  1772.  
  1773.     def AppendMetinInformation(self):
  1774.         affectType, affectValue = item.GetAffect(0)
  1775.         #affectType = item.GetValue(0)
  1776.         #affectValue = item.GetValue(1)
  1777.  
  1778.         affectString = self.__GetAffectString(affectType, affectValue)
  1779.  
  1780.         if affectString:
  1781.             self.AppendSpace(5)
  1782.             self.AppendTextLine(affectString, self.GetChangeTextLineColor(affectValue))
  1783.  
  1784.     def AppendMetinWearInformation(self):
  1785.  
  1786.         self.AppendSpace(5)
  1787.         self.AppendTextLine(localeInfo.TOOLTIP_SOCKET_REFINABLE_ITEM, self.NORMAL_COLOR)
  1788.  
  1789.         flagList = (item.IsWearableFlag(item.WEARABLE_BODY),
  1790.                     item.IsWearableFlag(item.WEARABLE_HEAD),
  1791.                     item.IsWearableFlag(item.WEARABLE_FOOTS),
  1792.                     item.IsWearableFlag(item.WEARABLE_WRIST),
  1793.                     item.IsWearableFlag(item.WEARABLE_WEAPON),
  1794.                     item.IsWearableFlag(item.WEARABLE_NECK),
  1795.                     item.IsWearableFlag(item.WEARABLE_EAR),
  1796.                     item.IsWearableFlag(item.WEARABLE_UNIQUE),
  1797.                     item.IsWearableFlag(item.WEARABLE_SHIELD),
  1798.                     item.IsWearableFlag(item.WEARABLE_ARROW))
  1799.  
  1800.         wearNames = ""
  1801.         for i in xrange(self.WEAR_COUNT):
  1802.  
  1803.             name = self.WEAR_NAMES[i]
  1804.             flag = flagList[i]
  1805.  
  1806.             if flag:
  1807.                 wearNames += "  "
  1808.                 wearNames += name
  1809.  
  1810.         textLine = ui.TextLine()
  1811.         textLine.SetParent(self)
  1812.         textLine.SetFontName(self.defFontName)
  1813.         textLine.SetPosition(self.toolTipWidth/2, self.toolTipHeight)
  1814.         textLine.SetHorizontalAlignCenter()
  1815.         textLine.SetPackedFontColor(self.NORMAL_COLOR)
  1816.         textLine.SetText(wearNames)
  1817.         textLine.Show()
  1818.         self.childrenList.append(textLine)
  1819.  
  1820.         self.toolTipHeight += self.TEXT_LINE_HEIGHT
  1821.         self.ResizeToolTip()
  1822.  
  1823.     def GetMetinSocketType(self, number):
  1824.         if player.METIN_SOCKET_TYPE_NONE == number:
  1825.             return player.METIN_SOCKET_TYPE_NONE
  1826.         elif player.METIN_SOCKET_TYPE_SILVER == number:
  1827.             return player.METIN_SOCKET_TYPE_SILVER
  1828.         elif player.METIN_SOCKET_TYPE_GOLD == number:
  1829.             return player.METIN_SOCKET_TYPE_GOLD
  1830.         else:
  1831.             item.SelectItem(number)
  1832.             if item.METIN_NORMAL == item.GetItemSubType():
  1833.                 return player.METIN_SOCKET_TYPE_SILVER
  1834.             elif item.METIN_GOLD == item.GetItemSubType():
  1835.                 return player.METIN_SOCKET_TYPE_GOLD
  1836.             elif "USE_PUT_INTO_ACCESSORY_SOCKET" == item.GetUseType(number):
  1837.                 return player.METIN_SOCKET_TYPE_SILVER
  1838.             elif "USE_PUT_INTO_RING_SOCKET" == item.GetUseType(number):
  1839.                 return player.METIN_SOCKET_TYPE_SILVER
  1840.             elif "USE_PUT_INTO_BELT_SOCKET" == item.GetUseType(number):
  1841.                 return player.METIN_SOCKET_TYPE_SILVER
  1842.  
  1843.         return player.METIN_SOCKET_TYPE_NONE
  1844.  
  1845.     def GetMetinItemIndex(self, number):
  1846.         if player.METIN_SOCKET_TYPE_SILVER == number:
  1847.             return 0
  1848.         if player.METIN_SOCKET_TYPE_GOLD == number:
  1849.             return 0
  1850.  
  1851.         return number
  1852.  
  1853.     def __AppendAccessoryMetinSlotInfo(self, metinSlot, mtrlVnum):     
  1854.         ACCESSORY_SOCKET_MAX_SIZE = 3      
  1855.  
  1856.         cur=min(metinSlot[0], ACCESSORY_SOCKET_MAX_SIZE)
  1857.         end=min(metinSlot[1], ACCESSORY_SOCKET_MAX_SIZE)
  1858.  
  1859.         affectType1, affectValue1 = item.GetAffect(0)
  1860.         affectList1=[0, max(1, affectValue1*10/100), max(2, affectValue1*20/100), max(3, affectValue1*40/100)]
  1861.  
  1862.         affectType2, affectValue2 = item.GetAffect(1)
  1863.         affectList2=[0, max(1, affectValue2*10/100), max(2, affectValue2*20/100), max(3, affectValue2*40/100)]
  1864.  
  1865.         mtrlPos=0
  1866.         mtrlList=[mtrlVnum]*cur+[player.METIN_SOCKET_TYPE_SILVER]*(end-cur)
  1867.         for mtrl in mtrlList:
  1868.             affectString1 = self.__GetAffectString(affectType1, affectList1[mtrlPos+1]-affectList1[mtrlPos])           
  1869.             affectString2 = self.__GetAffectString(affectType2, affectList2[mtrlPos+1]-affectList2[mtrlPos])
  1870.  
  1871.             leftTime = 0
  1872.             if cur == mtrlPos+1:
  1873.                 leftTime=metinSlot[2]
  1874.  
  1875.             self.__AppendMetinSlotInfo_AppendMetinSocketData(mtrlPos, mtrl, affectString1, affectString2, leftTime)
  1876.             mtrlPos+=1
  1877.  
  1878.     def __AppendMetinSlotInfo(self, metinSlot):
  1879.         if self.__AppendMetinSlotInfo_IsEmptySlotList(metinSlot):
  1880.             return
  1881.  
  1882.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1883.             self.__AppendMetinSlotInfo_AppendMetinSocketData(i, metinSlot[i])
  1884.  
  1885.     def __AppendMetinSlotInfo_IsEmptySlotList(self, metinSlot):
  1886.         if 0 == metinSlot:
  1887.             return 1
  1888.  
  1889.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1890.             metinSlotData=metinSlot[i]
  1891.             if 0 != self.GetMetinSocketType(metinSlotData):
  1892.                 if 0 != self.GetMetinItemIndex(metinSlotData):
  1893.                     return 0
  1894.  
  1895.         return 1
  1896.  
  1897.     def __AppendMetinSlotInfo_AppendMetinSocketData(self, index, metinSlotData, custumAffectString="", custumAffectString2="", leftTime=0):
  1898.  
  1899.         slotType = self.GetMetinSocketType(metinSlotData)
  1900.         itemIndex = self.GetMetinItemIndex(metinSlotData)
  1901.  
  1902.         if 0 == slotType:
  1903.             return
  1904.  
  1905.         self.AppendSpace(5)
  1906.  
  1907.         slotImage = ui.ImageBox()
  1908.         slotImage.SetParent(self)
  1909.         slotImage.Show()
  1910.  
  1911.         ## Name
  1912.         nameTextLine = ui.TextLine()
  1913.         nameTextLine.SetParent(self)
  1914.         nameTextLine.SetFontName(self.defFontName)
  1915.         nameTextLine.SetPackedFontColor(self.NORMAL_COLOR)
  1916.         nameTextLine.SetOutline()
  1917.         nameTextLine.SetFeather()
  1918.         nameTextLine.Show()        
  1919.  
  1920.         self.childrenList.append(nameTextLine)
  1921.  
  1922.         if player.METIN_SOCKET_TYPE_SILVER == slotType:
  1923.             slotImage.LoadImage("d:/ymir work/ui/game/windows/metin_slot_silver.sub")
  1924.         elif player.METIN_SOCKET_TYPE_GOLD == slotType:
  1925.             slotImage.LoadImage("d:/ymir work/ui/game/windows/metin_slot_gold.sub")
  1926.  
  1927.         self.childrenList.append(slotImage)
  1928.        
  1929.         if localeInfo.IsARABIC():
  1930.             slotImage.SetPosition(self.toolTipWidth - slotImage.GetWidth() - 9, self.toolTipHeight-1)
  1931.             nameTextLine.SetPosition(self.toolTipWidth - 50, self.toolTipHeight + 2)
  1932.         else:
  1933.             slotImage.SetPosition(9, self.toolTipHeight-1)
  1934.             nameTextLine.SetPosition(50, self.toolTipHeight + 2)
  1935.  
  1936.         metinImage = ui.ImageBox()
  1937.         metinImage.SetParent(self)
  1938.         metinImage.Show()
  1939.         self.childrenList.append(metinImage)
  1940.  
  1941.         if itemIndex:
  1942.  
  1943.             item.SelectItem(itemIndex)
  1944.  
  1945.             ## Image
  1946.             try:
  1947.                 metinImage.LoadImage(item.GetIconImageFileName())
  1948.             except:
  1949.                 dbg.TraceError("ItemToolTip.__AppendMetinSocketData() - Failed to find image file %d:%s" %
  1950.                     (itemIndex, item.GetIconImageFileName())
  1951.                 )
  1952.  
  1953.             nameTextLine.SetText(item.GetItemName())
  1954.            
  1955.             ## Affect      
  1956.             affectTextLine = ui.TextLine()
  1957.             affectTextLine.SetParent(self)
  1958.             affectTextLine.SetFontName(self.defFontName)
  1959.             affectTextLine.SetPackedFontColor(self.POSITIVE_COLOR)
  1960.             affectTextLine.SetOutline()
  1961.             affectTextLine.SetFeather()
  1962.             affectTextLine.Show()          
  1963.                
  1964.             if localeInfo.IsARABIC():
  1965.                 metinImage.SetPosition(self.toolTipWidth - metinImage.GetWidth() - 10, self.toolTipHeight)
  1966.                 affectTextLine.SetPosition(self.toolTipWidth - 50, self.toolTipHeight + 16 + 2)
  1967.             else:
  1968.                 metinImage.SetPosition(10, self.toolTipHeight)
  1969.                 affectTextLine.SetPosition(50, self.toolTipHeight + 16 + 2)
  1970.                            
  1971.             if custumAffectString:
  1972.                 affectTextLine.SetText(custumAffectString)
  1973.             elif itemIndex!=constInfo.ERROR_METIN_STONE:
  1974.                 affectType, affectValue = item.GetAffect(0)
  1975.                 affectString = self.__GetAffectString(affectType, affectValue)
  1976.                 if affectString:
  1977.                     affectTextLine.SetText(affectString)
  1978.             else:
  1979.                 affectTextLine.SetText(localeInfo.TOOLTIP_APPLY_NOAFFECT)
  1980.            
  1981.             self.childrenList.append(affectTextLine)           
  1982.  
  1983.             if custumAffectString2:
  1984.                 affectTextLine = ui.TextLine()
  1985.                 affectTextLine.SetParent(self)
  1986.                 affectTextLine.SetFontName(self.defFontName)
  1987.                 affectTextLine.SetPackedFontColor(self.POSITIVE_COLOR)
  1988.                 affectTextLine.SetPosition(50, self.toolTipHeight + 16 + 2 + 16 + 2)
  1989.                 affectTextLine.SetOutline()
  1990.                 affectTextLine.SetFeather()
  1991.                 affectTextLine.Show()
  1992.                 affectTextLine.SetText(custumAffectString2)
  1993.                 self.childrenList.append(affectTextLine)
  1994.                 self.toolTipHeight += 16 + 2
  1995.  
  1996.             if 0 != leftTime:
  1997.                 timeText = (localeInfo.LEFT_TIME + " : " + localeInfo.SecondToDHM(leftTime))
  1998.  
  1999.                 timeTextLine = ui.TextLine()
  2000.                 timeTextLine.SetParent(self)
  2001.                 timeTextLine.SetFontName(self.defFontName)
  2002.                 timeTextLine.SetPackedFontColor(self.POSITIVE_COLOR)
  2003.                 timeTextLine.SetPosition(50, self.toolTipHeight + 16 + 2 + 16 + 2)
  2004.                 timeTextLine.SetOutline()
  2005.                 timeTextLine.SetFeather()
  2006.                 timeTextLine.Show()
  2007.                 timeTextLine.SetText(timeText)
  2008.                 self.childrenList.append(timeTextLine)
  2009.                 self.toolTipHeight += 16 + 2
  2010.  
  2011.         else:
  2012.             nameTextLine.SetText(localeInfo.TOOLTIP_SOCKET_EMPTY)
  2013.  
  2014.         self.toolTipHeight += 35
  2015.         self.ResizeToolTip()
  2016.  
  2017.     def __AppendFishInfo(self, size):
  2018.         if size > 0:
  2019.             self.AppendSpace(5)
  2020.             self.AppendTextLine(localeInfo.TOOLTIP_FISH_LEN % (float(size) / 100.0), self.NORMAL_COLOR)
  2021.  
  2022.     def AppendUniqueItemLastTime(self, restMin):
  2023.         restSecond = restMin*60
  2024.         self.AppendSpace(5)
  2025.         self.AppendTextLine(localeInfo.LEFT_TIME + " : " + localeInfo.SecondToDHM(restSecond), self.NORMAL_COLOR)
  2026.  
  2027.     def AppendMallItemLastTime(self, endTime):
  2028.         leftSec = max(0, endTime - app.GetGlobalTimeStamp())
  2029.         self.AppendSpace(5)
  2030.         self.AppendTextLine(localeInfo.LEFT_TIME + " : " + localeInfo.SecondToDHM(leftSec), self.NORMAL_COLOR)
  2031.        
  2032.     def AppendTimerBasedOnWearLastTime(self, metinSlot):
  2033.         if 0 == metinSlot[0]:
  2034.             self.AppendSpace(5)
  2035.             self.AppendTextLine(localeInfo.CANNOT_USE, self.DISABLE_COLOR)
  2036.         else:
  2037.             endTime = app.GetGlobalTimeStamp() + metinSlot[0]
  2038.             self.AppendMallItemLastTime(endTime)       
  2039.    
  2040.     def AppendRealTimeStartFirstUseLastTime(self, item, metinSlot, limitIndex):    
  2041.         useCount = metinSlot[1]
  2042.         endTime = metinSlot[0]
  2043.        
  2044.         # ? ???? ????? Socket0? ?? ??(2012? 3? 1? 13? 01? ??..) ? ????.
  2045.         # ???? ???? Socket0? ??????(???? 600 ?? ?. ???)? ???? ? ??, 0??? Limit Value? ?? ??????? ????.
  2046.         if 0 == useCount:
  2047.             if 0 == endTime:
  2048.                 (limitType, limitValue) = item.GetLimit(limitIndex)
  2049.                 endTime = limitValue
  2050.  
  2051.             endTime += app.GetGlobalTimeStamp()
  2052.    
  2053.         self.AppendMallItemLastTime(endTime)
  2054.    
  2055. class HyperlinkItemToolTip(ItemToolTip):
  2056.     def __init__(self):
  2057.         ItemToolTip.__init__(self, isPickable=True)
  2058.  
  2059.     def SetHyperlinkItem(self, tokens):
  2060.         minTokenCount = 3 + player.METIN_SOCKET_MAX_NUM
  2061.         maxTokenCount = minTokenCount + 2 * player.ATTRIBUTE_SLOT_MAX_NUM
  2062.         if tokens and len(tokens) >= minTokenCount and len(tokens) <= maxTokenCount:
  2063.             head, vnum, flag = tokens[:3]
  2064.             itemVnum = int(vnum, 16)
  2065.             metinSlot = [int(metin, 16) for metin in tokens[3:6]]
  2066.  
  2067.             rests = tokens[6:]
  2068.             if rests:
  2069.                 attrSlot = []
  2070.  
  2071.                 rests.reverse()
  2072.                 while rests:
  2073.                     key = int(rests.pop(), 16)
  2074.                     if rests:
  2075.                         val = int(rests.pop())
  2076.                         attrSlot.append((key, val))
  2077.  
  2078.                 attrSlot += [(0, 0)] * (player.ATTRIBUTE_SLOT_MAX_NUM - len(attrSlot))
  2079.             else:
  2080.                 attrSlot = [(0, 0)] * player.ATTRIBUTE_SLOT_MAX_NUM
  2081.  
  2082.             self.ClearToolTip()
  2083.             self.AddItemData(itemVnum, metinSlot, attrSlot)
  2084.  
  2085.             ItemToolTip.OnUpdate(self)
  2086.  
  2087.     def OnUpdate(self):
  2088.         pass
  2089.  
  2090.     def OnMouseLeftButtonDown(self):
  2091.         self.Hide()
  2092.  
  2093. class SkillToolTip(ToolTip):
  2094.  
  2095.     POINT_NAME_DICT = {
  2096.         player.LEVEL : localeInfo.SKILL_TOOLTIP_LEVEL,
  2097.         player.IQ : localeInfo.SKILL_TOOLTIP_INT,
  2098.     }
  2099.  
  2100.     SKILL_TOOL_TIP_WIDTH = 200
  2101.     PARTY_SKILL_TOOL_TIP_WIDTH = 340
  2102.  
  2103.     PARTY_SKILL_EXPERIENCE_AFFECT_LIST = (  ( 2, 2,  10,),
  2104.                                             ( 8, 3,  20,),
  2105.                                             (14, 4,  30,),
  2106.                                             (22, 5,  45,),
  2107.                                             (28, 6,  60,),
  2108.                                             (34, 7,  80,),
  2109.                                             (38, 8, 100,), )
  2110.  
  2111.     PARTY_SKILL_PLUS_GRADE_AFFECT_LIST = (  ( 4, 2, 1, 0,),
  2112.                                             (10, 3, 2, 0,),
  2113.                                             (16, 4, 2, 1,),
  2114.                                             (24, 5, 2, 2,), )
  2115.  
  2116.     PARTY_SKILL_ATTACKER_AFFECT_LIST = (    ( 36, 3, ),
  2117.                                             ( 26, 1, ),
  2118.                                             ( 32, 2, ), )
  2119.  
  2120.     SKILL_GRADE_NAME = {    player.SKILL_GRADE_MASTER : localeInfo.SKILL_GRADE_NAME_MASTER,
  2121.                             player.SKILL_GRADE_GRAND_MASTER : localeInfo.SKILL_GRADE_NAME_GRAND_MASTER,
  2122.                             player.SKILL_GRADE_PERFECT_MASTER : localeInfo.SKILL_GRADE_NAME_PERFECT_MASTER, }
  2123.  
  2124.     AFFECT_NAME_DICT =  {
  2125.                             "HP" : localeInfo.TOOLTIP_SKILL_AFFECT_ATT_POWER,
  2126.                             "ATT_GRADE" : localeInfo.TOOLTIP_SKILL_AFFECT_ATT_GRADE,
  2127.                             "DEF_GRADE" : localeInfo.TOOLTIP_SKILL_AFFECT_DEF_GRADE,
  2128.                             "ATT_SPEED" : localeInfo.TOOLTIP_SKILL_AFFECT_ATT_SPEED,
  2129.                             "MOV_SPEED" : localeInfo.TOOLTIP_SKILL_AFFECT_MOV_SPEED,
  2130.                             "DODGE" : localeInfo.TOOLTIP_SKILL_AFFECT_DODGE,
  2131.                             "RESIST_NORMAL" : localeInfo.TOOLTIP_SKILL_AFFECT_RESIST_NORMAL,
  2132.                             "REFLECT_MELEE" : localeInfo.TOOLTIP_SKILL_AFFECT_REFLECT_MELEE,
  2133.                         }
  2134.     AFFECT_APPEND_TEXT_DICT =   {
  2135.                                     "DODGE" : "%",
  2136.                                     "RESIST_NORMAL" : "%",
  2137.                                     "REFLECT_MELEE" : "%",
  2138.                                 }
  2139.  
  2140.     def __init__(self):
  2141.         ToolTip.__init__(self, self.SKILL_TOOL_TIP_WIDTH)
  2142.     def __del__(self):
  2143.         ToolTip.__del__(self)
  2144.  
  2145.     def SetSkill(self, skillIndex, skillLevel = -1):
  2146.  
  2147.         if 0 == skillIndex:
  2148.             return
  2149.  
  2150.         if skill.SKILL_TYPE_GUILD == skill.GetSkillType(skillIndex):
  2151.  
  2152.             if self.SKILL_TOOL_TIP_WIDTH != self.toolTipWidth:
  2153.                 self.toolTipWidth = self.SKILL_TOOL_TIP_WIDTH
  2154.                 self.ResizeToolTip()
  2155.  
  2156.             self.AppendDefaultData(skillIndex)
  2157.             self.AppendSkillConditionData(skillIndex)
  2158.             self.AppendGuildSkillData(skillIndex, skillLevel)
  2159.  
  2160.         else:
  2161.  
  2162.             if self.SKILL_TOOL_TIP_WIDTH != self.toolTipWidth:
  2163.                 self.toolTipWidth = self.SKILL_TOOL_TIP_WIDTH
  2164.                 self.ResizeToolTip()
  2165.  
  2166.             slotIndex = player.GetSkillSlotIndex(skillIndex)
  2167.             skillGrade = player.GetSkillGrade(slotIndex)
  2168.             skillLevel = player.GetSkillLevel(slotIndex)
  2169.             skillCurrentPercentage = player.GetSkillCurrentEfficientPercentage(slotIndex)
  2170.             skillNextPercentage = player.GetSkillNextEfficientPercentage(slotIndex)
  2171.  
  2172.             self.AppendDefaultData(skillIndex)
  2173.             self.AppendSkillConditionData(skillIndex)
  2174.             self.AppendSkillDataNew(slotIndex, skillIndex, skillGrade, skillLevel, skillCurrentPercentage, skillNextPercentage)
  2175.             self.AppendSkillRequirement(skillIndex, skillLevel)
  2176.  
  2177.         self.ShowToolTip()
  2178.  
  2179.     def SetSkillNew(self, slotIndex, skillIndex, skillGrade, skillLevel):
  2180.  
  2181.         if 0 == skillIndex:
  2182.             return
  2183.  
  2184.         if player.SKILL_INDEX_TONGSOL == skillIndex:
  2185.  
  2186.             slotIndex = player.GetSkillSlotIndex(skillIndex)
  2187.             skillLevel = player.GetSkillLevel(slotIndex)
  2188.  
  2189.             self.AppendDefaultData(skillIndex)
  2190.             self.AppendPartySkillData(skillGrade, skillLevel)
  2191.  
  2192.         elif player.SKILL_INDEX_RIDING == skillIndex:
  2193.  
  2194.             slotIndex = player.GetSkillSlotIndex(skillIndex)
  2195.             self.AppendSupportSkillDefaultData(skillIndex, skillGrade, skillLevel, 30)
  2196.  
  2197.         elif player.SKILL_INDEX_SUMMON == skillIndex:
  2198.  
  2199.             maxLevel = 10
  2200.  
  2201.             self.ClearToolTip()
  2202.             self.__SetSkillTitle(skillIndex, skillGrade)
  2203.  
  2204.             ## Description
  2205.             description = skill.GetSkillDescription(skillIndex)
  2206.             self.AppendDescription(description, 25)
  2207.  
  2208.             if skillLevel == 10:
  2209.                 self.AppendSpace(5)
  2210.                 self.AppendTextLine(localeInfo.TOOLTIP_SKILL_LEVEL_MASTER % (skillLevel), self.NORMAL_COLOR)
  2211.                 self.AppendTextLine(localeInfo.SKILL_SUMMON_DESCRIPTION % (skillLevel*10), self.NORMAL_COLOR)
  2212.  
  2213.             else:
  2214.                 self.AppendSpace(5)
  2215.                 self.AppendTextLine(localeInfo.TOOLTIP_SKILL_LEVEL % (skillLevel), self.NORMAL_COLOR)
  2216.                 self.__AppendSummonDescription(skillLevel, self.NORMAL_COLOR)
  2217.  
  2218.                 self.AppendSpace(5)
  2219.                 self.AppendTextLine(localeInfo.TOOLTIP_SKILL_LEVEL % (skillLevel+1), self.NEGATIVE_COLOR)
  2220.                 self.__AppendSummonDescription(skillLevel+1, self.NEGATIVE_COLOR)
  2221.  
  2222.         elif skill.SKILL_TYPE_GUILD == skill.GetSkillType(skillIndex):
  2223.  
  2224.             if self.SKILL_TOOL_TIP_WIDTH != self.toolTipWidth:
  2225.                 self.toolTipWidth = self.SKILL_TOOL_TIP_WIDTH
  2226.                 self.ResizeToolTip()
  2227.  
  2228.             self.AppendDefaultData(skillIndex)
  2229.             self.AppendSkillConditionData(skillIndex)
  2230.             self.AppendGuildSkillData(skillIndex, skillLevel)
  2231.  
  2232.         else:
  2233.  
  2234.             if self.SKILL_TOOL_TIP_WIDTH != self.toolTipWidth:
  2235.                 self.toolTipWidth = self.SKILL_TOOL_TIP_WIDTH
  2236.                 self.ResizeToolTip()
  2237.  
  2238.             slotIndex = player.GetSkillSlotIndex(skillIndex)
  2239.  
  2240.             skillCurrentPercentage = player.GetSkillCurrentEfficientPercentage(slotIndex)
  2241.             skillNextPercentage = player.GetSkillNextEfficientPercentage(slotIndex)
  2242.  
  2243.             self.AppendDefaultData(skillIndex, skillGrade)
  2244.             self.AppendSkillConditionData(skillIndex)
  2245.             self.AppendSkillDataNew(slotIndex, skillIndex, skillGrade, skillLevel, skillCurrentPercentage, skillNextPercentage)
  2246.             self.AppendSkillRequirement(skillIndex, skillLevel)
  2247.  
  2248.         self.ShowToolTip()
  2249.  
  2250.     def __SetSkillTitle(self, skillIndex, skillGrade):
  2251.         self.SetTitle(skill.GetSkillName(skillIndex, skillGrade))
  2252.         self.__AppendSkillGradeName(skillIndex, skillGrade)
  2253.  
  2254.     def __AppendSkillGradeName(self, skillIndex, skillGrade):      
  2255.         if self.SKILL_GRADE_NAME.has_key(skillGrade):
  2256.             self.AppendSpace(5)
  2257.             self.AppendTextLine(self.SKILL_GRADE_NAME[skillGrade] % (skill.GetSkillName(skillIndex, 0)), self.CAN_LEVEL_UP_COLOR)
  2258.  
  2259.     def SetSkillOnlyName(self, slotIndex, skillIndex, skillGrade):
  2260.         if 0 == skillIndex:
  2261.             return
  2262.  
  2263.         slotIndex = player.GetSkillSlotIndex(skillIndex)
  2264.  
  2265.         self.toolTipWidth = self.SKILL_TOOL_TIP_WIDTH
  2266.         self.ResizeToolTip()
  2267.  
  2268.         self.ClearToolTip()
  2269.         self.__SetSkillTitle(skillIndex, skillGrade)       
  2270.         self.AppendDefaultData(skillIndex, skillGrade)
  2271.         self.AppendSkillConditionData(skillIndex)      
  2272.         self.ShowToolTip()
  2273.  
  2274.     def AppendDefaultData(self, skillIndex, skillGrade = 0):
  2275.         self.ClearToolTip()
  2276.         self.__SetSkillTitle(skillIndex, skillGrade)
  2277.  
  2278.         ## Level Limit
  2279.         levelLimit = skill.GetSkillLevelLimit(skillIndex)
  2280.         if levelLimit > 0:
  2281.  
  2282.             color = self.NORMAL_COLOR
  2283.             if player.GetStatus(player.LEVEL) < levelLimit:
  2284.                 color = self.NEGATIVE_COLOR
  2285.  
  2286.             self.AppendSpace(5)
  2287.             self.AppendTextLine(localeInfo.TOOLTIP_ITEM_LIMIT_LEVEL % (levelLimit), color)
  2288.  
  2289.         ## Description
  2290.         description = skill.GetSkillDescription(skillIndex)
  2291.         self.AppendDescription(description, 25)
  2292.  
  2293.     def AppendSupportSkillDefaultData(self, skillIndex, skillGrade, skillLevel, maxLevel):
  2294.         self.ClearToolTip()
  2295.         self.__SetSkillTitle(skillIndex, skillGrade)
  2296.  
  2297.         ## Description
  2298.         description = skill.GetSkillDescription(skillIndex)
  2299.         self.AppendDescription(description, 25)
  2300.  
  2301.         if 1 == skillGrade:
  2302.             skillLevel += 19
  2303.         elif 2 == skillGrade:
  2304.             skillLevel += 29
  2305.         elif 3 == skillGrade:
  2306.             skillLevel = 40
  2307.  
  2308.         self.AppendSpace(5)
  2309.         self.AppendTextLine(localeInfo.TOOLTIP_SKILL_LEVEL_WITH_MAX % (skillLevel, maxLevel), self.NORMAL_COLOR)
  2310.  
  2311.     def AppendSkillConditionData(self, skillIndex):
  2312.         conditionDataCount = skill.GetSkillConditionDescriptionCount(skillIndex)
  2313.         if conditionDataCount > 0:
  2314.             self.AppendSpace(5)
  2315.             for i in xrange(conditionDataCount):
  2316.                 self.AppendTextLine(skill.GetSkillConditionDescription(skillIndex, i), self.CONDITION_COLOR)
  2317.  
  2318.     def AppendGuildSkillData(self, skillIndex, skillLevel):
  2319.         skillMaxLevel = 7
  2320.         skillCurrentPercentage = float(skillLevel) / float(skillMaxLevel)
  2321.         skillNextPercentage = float(skillLevel+1) / float(skillMaxLevel)
  2322.         ## Current Level
  2323.         if skillLevel > 0:
  2324.             if self.HasSkillLevelDescription(skillIndex, skillLevel):
  2325.                 self.AppendSpace(5)
  2326.                 if skillLevel == skillMaxLevel:
  2327.                     self.AppendTextLine(localeInfo.TOOLTIP_SKILL_LEVEL_MASTER % (skillLevel), self.NORMAL_COLOR)
  2328.                 else:
  2329.                     self.AppendTextLine(localeInfo.TOOLTIP_SKILL_LEVEL % (skillLevel), self.NORMAL_COLOR)
  2330.  
  2331.                 #####
  2332.  
  2333.                 for i in xrange(skill.GetSkillAffectDescriptionCount(skillIndex)):
  2334.                     self.AppendTextLine(skill.GetSkillAffectDescription(skillIndex, i, skillCurrentPercentage), self.ENABLE_COLOR)
  2335.  
  2336.                 ## Cooltime
  2337.                 coolTime = skill.GetSkillCoolTime(skillIndex, skillCurrentPercentage)
  2338.                 if coolTime > 0:
  2339.                     self.AppendTextLine(localeInfo.TOOLTIP_SKILL_COOL_TIME + str(coolTime), self.ENABLE_COLOR)
  2340.  
  2341.                 ## SP
  2342.                 needGSP = skill.GetSkillNeedSP(skillIndex, skillCurrentPercentage)
  2343.                 if needGSP > 0:
  2344.                     self.AppendTextLine(localeInfo.TOOLTIP_NEED_GSP % (needGSP), self.ENABLE_COLOR)
  2345.  
  2346.         ## Next Level
  2347.         if skillLevel < skillMaxLevel:
  2348.             if self.HasSkillLevelDescription(skillIndex, skillLevel+1):
  2349.                 self.AppendSpace(5)
  2350.                 self.AppendTextLine(localeInfo.TOOLTIP_NEXT_SKILL_LEVEL_1 % (skillLevel+1, skillMaxLevel), self.DISABLE_COLOR)
  2351.  
  2352.                 #####
  2353.  
  2354.                 for i in xrange(skill.GetSkillAffectDescriptionCount(skillIndex)):
  2355.                     self.AppendTextLine(skill.GetSkillAffectDescription(skillIndex, i, skillNextPercentage), self.DISABLE_COLOR)
  2356.  
  2357.                 ## Cooltime
  2358.                 coolTime = skill.GetSkillCoolTime(skillIndex, skillNextPercentage)
  2359.                 if coolTime > 0:
  2360.                     self.AppendTextLine(localeInfo.TOOLTIP_SKILL_COOL_TIME + str(coolTime), self.DISABLE_COLOR)
  2361.  
  2362.                 ## SP
  2363.                 needGSP = skill.GetSkillNeedSP(skillIndex, skillNextPercentage)
  2364.                 if needGSP > 0:
  2365.                     self.AppendTextLine(localeInfo.TOOLTIP_NEED_GSP % (needGSP), self.DISABLE_COLOR)
  2366.  
  2367.     def AppendSkillDataNew(self, slotIndex, skillIndex, skillGrade, skillLevel, skillCurrentPercentage, skillNextPercentage):
  2368.  
  2369.         self.skillMaxLevelStartDict = { 0 : 17, 1 : 7, 2 : 10, }
  2370.         self.skillMaxLevelEndDict = { 0 : 20, 1 : 10, 2 : 10, }
  2371.  
  2372.         skillLevelUpPoint = 1
  2373.         realSkillGrade = player.GetSkillGrade(slotIndex)
  2374.         skillMaxLevelStart = self.skillMaxLevelStartDict.get(realSkillGrade, 15)
  2375.         skillMaxLevelEnd = self.skillMaxLevelEndDict.get(realSkillGrade, 20)
  2376.  
  2377.         ## Current Level
  2378.         if skillLevel > 0:
  2379.             if self.HasSkillLevelDescription(skillIndex, skillLevel):
  2380.                 self.AppendSpace(5)
  2381.                 if skillGrade == skill.SKILL_GRADE_COUNT:
  2382.                     pass
  2383.                 elif skillLevel == skillMaxLevelEnd:
  2384.                     self.AppendTextLine(localeInfo.TOOLTIP_SKILL_LEVEL_MASTER % (skillLevel), self.NORMAL_COLOR)
  2385.                 else:
  2386.                     self.AppendTextLine(localeInfo.TOOLTIP_SKILL_LEVEL % (skillLevel), self.NORMAL_COLOR)
  2387.                 self.AppendSkillLevelDescriptionNew(skillIndex, skillCurrentPercentage, self.ENABLE_COLOR)
  2388.  
  2389.         ## Next Level
  2390.         if skillGrade != skill.SKILL_GRADE_COUNT:
  2391.             if skillLevel < skillMaxLevelEnd:
  2392.                 if self.HasSkillLevelDescription(skillIndex, skillLevel+skillLevelUpPoint):
  2393.                     self.AppendSpace(5)
  2394.                     ## HP??, ???? ????? ??
  2395.                     if skillIndex == 141 or skillIndex == 142:
  2396.                         self.AppendTextLine(localeInfo.TOOLTIP_NEXT_SKILL_LEVEL_3 % (skillLevel+1), self.DISABLE_COLOR)
  2397.                     else:
  2398.                         self.AppendTextLine(localeInfo.TOOLTIP_NEXT_SKILL_LEVEL_1 % (skillLevel+1, skillMaxLevelEnd), self.DISABLE_COLOR)
  2399.                     self.AppendSkillLevelDescriptionNew(skillIndex, skillNextPercentage, self.DISABLE_COLOR)
  2400.  
  2401.     def AppendSkillLevelDescriptionNew(self, skillIndex, skillPercentage, color):
  2402.  
  2403.         affectDataCount = skill.GetNewAffectDataCount(skillIndex)
  2404.         if affectDataCount > 0:
  2405.             for i in xrange(affectDataCount):
  2406.                 type, minValue, maxValue = skill.GetNewAffectData(skillIndex, i, skillPercentage)
  2407.  
  2408.                 if not self.AFFECT_NAME_DICT.has_key(type):
  2409.                     continue
  2410.  
  2411.                 minValue = int(minValue)
  2412.                 maxValue = int(maxValue)
  2413.                 affectText = self.AFFECT_NAME_DICT[type]
  2414.  
  2415.                 if "HP" == type:
  2416.                     if minValue < 0 and maxValue < 0:
  2417.                         minValue *= -1
  2418.                         maxValue *= -1
  2419.  
  2420.                     else:
  2421.                         affectText = localeInfo.TOOLTIP_SKILL_AFFECT_HEAL
  2422.  
  2423.                 affectText += str(minValue)
  2424.                 if minValue != maxValue:
  2425.                     affectText += " - " + str(maxValue)
  2426.                 affectText += self.AFFECT_APPEND_TEXT_DICT.get(type, "")
  2427.  
  2428.                 #import debugInfo
  2429.                 #if debugInfo.IsDebugMode():
  2430.                 #   affectText = "!!" + affectText
  2431.  
  2432.                 self.AppendTextLine(affectText, color)
  2433.            
  2434.         else:
  2435.             for i in xrange(skill.GetSkillAffectDescriptionCount(skillIndex)):
  2436.                 self.AppendTextLine(skill.GetSkillAffectDescription(skillIndex, i, skillPercentage), color)
  2437.        
  2438.  
  2439.         ## Duration
  2440.         duration = skill.GetDuration(skillIndex, skillPercentage)
  2441.         if duration > 0:
  2442.             self.AppendTextLine(localeInfo.TOOLTIP_SKILL_DURATION % (duration), color)
  2443.  
  2444.         ## Cooltime
  2445.         coolTime = skill.GetSkillCoolTime(skillIndex, skillPercentage)
  2446.         if coolTime > 0:
  2447.             self.AppendTextLine(localeInfo.TOOLTIP_SKILL_COOL_TIME + str(coolTime), color)
  2448.  
  2449.         ## SP
  2450.         needSP = skill.GetSkillNeedSP(skillIndex, skillPercentage)
  2451.         if needSP != 0:
  2452.             continuationSP = skill.GetSkillContinuationSP(skillIndex, skillPercentage)
  2453.  
  2454.             if skill.IsUseHPSkill(skillIndex):
  2455.                 self.AppendNeedHP(needSP, continuationSP, color)
  2456.             else:
  2457.                 self.AppendNeedSP(needSP, continuationSP, color)
  2458.  
  2459.     def AppendSkillRequirement(self, skillIndex, skillLevel):
  2460.  
  2461.         skillMaxLevel = skill.GetSkillMaxLevel(skillIndex)
  2462.  
  2463.         if skillLevel >= skillMaxLevel:
  2464.             return
  2465.  
  2466.         isAppendHorizontalLine = False
  2467.  
  2468.         ## Requirement
  2469.         if skill.IsSkillRequirement(skillIndex):
  2470.  
  2471.             if not isAppendHorizontalLine:
  2472.                 isAppendHorizontalLine = True
  2473.                 self.AppendHorizontalLine()
  2474.  
  2475.             requireSkillName, requireSkillLevel = skill.GetSkillRequirementData(skillIndex)
  2476.  
  2477.             color = self.CANNOT_LEVEL_UP_COLOR
  2478.             if skill.CheckRequirementSueccess(skillIndex):
  2479.                 color = self.CAN_LEVEL_UP_COLOR
  2480.             self.AppendTextLine(localeInfo.TOOLTIP_REQUIREMENT_SKILL_LEVEL % (requireSkillName, requireSkillLevel), color)
  2481.  
  2482.         ## Require Stat
  2483.         requireStatCount = skill.GetSkillRequireStatCount(skillIndex)
  2484.         if requireStatCount > 0:
  2485.  
  2486.             for i in xrange(requireStatCount):
  2487.                 type, level = skill.GetSkillRequireStatData(skillIndex, i)
  2488.                 if self.POINT_NAME_DICT.has_key(type):
  2489.  
  2490.                     if not isAppendHorizontalLine:
  2491.                         isAppendHorizontalLine = True
  2492.                         self.AppendHorizontalLine()
  2493.  
  2494.                     name = self.POINT_NAME_DICT[type]
  2495.                     color = self.CANNOT_LEVEL_UP_COLOR
  2496.                     if player.GetStatus(type) >= level:
  2497.                         color = self.CAN_LEVEL_UP_COLOR
  2498.                     self.AppendTextLine(localeInfo.TOOLTIP_REQUIREMENT_STAT_LEVEL % (name, level), color)
  2499.  
  2500.     def HasSkillLevelDescription(self, skillIndex, skillLevel):
  2501.         if skill.GetSkillAffectDescriptionCount(skillIndex) > 0:
  2502.             return True
  2503.         if skill.GetSkillCoolTime(skillIndex, skillLevel) > 0:
  2504.             return True
  2505.         if skill.GetSkillNeedSP(skillIndex, skillLevel) > 0:
  2506.             return True
  2507.  
  2508.         return False
  2509.  
  2510.     def AppendMasterAffectDescription(self, index, desc, color):
  2511.         self.AppendTextLine(desc, color)
  2512.  
  2513.     def AppendNextAffectDescription(self, index, desc):
  2514.         self.AppendTextLine(desc, self.DISABLE_COLOR)
  2515.  
  2516.     def AppendNeedHP(self, needSP, continuationSP, color):
  2517.  
  2518.         self.AppendTextLine(localeInfo.TOOLTIP_NEED_HP % (needSP), color)
  2519.  
  2520.         if continuationSP > 0:
  2521.             self.AppendTextLine(localeInfo.TOOLTIP_NEED_HP_PER_SEC % (continuationSP), color)
  2522.  
  2523.     def AppendNeedSP(self, needSP, continuationSP, color):
  2524.  
  2525.         if -1 == needSP:
  2526.             self.AppendTextLine(localeInfo.TOOLTIP_NEED_ALL_SP, color)
  2527.  
  2528.         else:
  2529.             self.AppendTextLine(localeInfo.TOOLTIP_NEED_SP % (needSP), color)
  2530.  
  2531.         if continuationSP > 0:
  2532.             self.AppendTextLine(localeInfo.TOOLTIP_NEED_SP_PER_SEC % (continuationSP), color)
  2533.  
  2534.     def AppendPartySkillData(self, skillGrade, skillLevel):
  2535.  
  2536.         if 1 == skillGrade:
  2537.             skillLevel += 19
  2538.         elif 2 == skillGrade:
  2539.             skillLevel += 29
  2540.         elif 3 == skillGrade:
  2541.             skillLevel =  40
  2542.  
  2543.         if skillLevel <= 0:
  2544.             return
  2545.  
  2546.         skillIndex = player.SKILL_INDEX_TONGSOL
  2547.         slotIndex = player.GetSkillSlotIndex(skillIndex)
  2548.         skillPower = player.GetSkillCurrentEfficientPercentage(slotIndex)
  2549.         if localeInfo.IsBRAZIL():
  2550.             k = skillPower
  2551.         else:
  2552.             k = player.GetSkillLevel(skillIndex) / 100.0
  2553.         self.AppendSpace(5)
  2554.         self.AutoAppendTextLine(localeInfo.TOOLTIP_PARTY_SKILL_LEVEL % skillLevel, self.NORMAL_COLOR)
  2555.  
  2556.         if skillLevel>=10:
  2557.             self.AutoAppendTextLine(localeInfo.PARTY_SKILL_ATTACKER % chop( 10 + 60 * k ))
  2558.  
  2559.         if skillLevel>=20:
  2560.             self.AutoAppendTextLine(localeInfo.PARTY_SKILL_BERSERKER    % chop(1 + 5 * k))
  2561.             self.AutoAppendTextLine(localeInfo.PARTY_SKILL_TANKER   % chop(50 + 1450 * k))
  2562.  
  2563.         if skillLevel>=25:
  2564.             self.AutoAppendTextLine(localeInfo.PARTY_SKILL_BUFFER % chop(5 + 45 * k ))
  2565.  
  2566.         if skillLevel>=35:
  2567.             self.AutoAppendTextLine(localeInfo.PARTY_SKILL_SKILL_MASTER % chop(25 + 600 * k ))
  2568.  
  2569.         if skillLevel>=40:
  2570.             self.AutoAppendTextLine(localeInfo.PARTY_SKILL_DEFENDER % chop( 5 + 30 * k ))
  2571.  
  2572.         self.AlignHorizonalCenter()
  2573.  
  2574.     def __AppendSummonDescription(self, skillLevel, color):
  2575.         if skillLevel > 1:
  2576.             self.AppendTextLine(localeInfo.SKILL_SUMMON_DESCRIPTION % (skillLevel * 10), color)
  2577.         elif 1 == skillLevel:
  2578.             self.AppendTextLine(localeInfo.SKILL_SUMMON_DESCRIPTION % (15), color)
  2579.         elif 0 == skillLevel:
  2580.             self.AppendTextLine(localeInfo.SKILL_SUMMON_DESCRIPTION % (10), color)
  2581.  
  2582.  
  2583. if __name__ == "__main__"
  2584.     import app
  2585.     import wndMgr
  2586.     import systemSetting
  2587.     import mouseModule
  2588.     import grp
  2589.     import ui
  2590.    
  2591.     #wndMgr.SetOutlineFlag(True)
  2592.  
  2593.     app.SetMouseHandler(mouseModule.mouseController)
  2594.     app.SetHairColorEnable(True)
  2595.     wndMgr.SetMouseHandler(mouseModule.mouseController)
  2596.     wndMgr.SetScreenSize(systemSetting.GetWidth(), systemSetting.GetHeight())
  2597.     app.Create("METIN2 CLOSED BETA", systemSetting.GetWidth(), systemSetting.GetHeight(), 1)
  2598.     mouseModule.mouseController.Create()
  2599.  
  2600.     toolTip = ItemToolTip()
  2601.     toolTip.ClearToolTip()
  2602.     #toolTip.AppendTextLine("Test")
  2603.     desc = "Item descriptions:|increase of width of display to 35 digits per row AND installation of function that the displayed words are not broken up in two parts, but instead if one word is too long to be displayed in this row, this word will start in the next row."
  2604.     summ = ""
  2605.  
  2606.     toolTip.AddItemData_Offline(10, desc, summ, 0, 0)
  2607.     toolTip.Show()
  2608.    
  2609.     app.Loop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement