Guest User

uitooltip

a guest
May 7th, 2017
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 85.68 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 pointop(n):
  31.     t = int(n)
  32.     if t / 10 < 1:
  33.         return "0."+n
  34.     else:      
  35.         return n[0:len(n)-1]+"."+n[len(n)-1:]
  36.    
  37. def SplitDescription(desc, limit):
  38.     total_tokens = desc.split()
  39.     line_tokens = []
  40.     line_len = 0
  41.     lines = []
  42.     for token in total_tokens:
  43.         if "|" in token:
  44.             sep_pos = token.find("|")
  45.             line_tokens.append(token[:sep_pos])
  46.  
  47.             lines.append(" ".join(line_tokens))
  48.             line_len = len(token) - (sep_pos + 1)
  49.             line_tokens = [token[sep_pos+1:]]
  50.         else:
  51.             line_len += len(token)
  52.             if len(line_tokens) + line_len > limit:
  53.                 lines.append(" ".join(line_tokens))
  54.                 line_len = len(token)
  55.                 line_tokens = [token]
  56.             else:
  57.                 line_tokens.append(token)
  58.    
  59.     if line_tokens:
  60.         lines.append(" ".join(line_tokens))
  61.  
  62.     return lines
  63.  
  64. ###################################################################################################
  65. ## ToolTip
  66. ##
  67. ##   NOTE : 현재는 Item과 Skill을 상속으로 특화 시켜두었음
  68. ##          하지만 그다지 의미가 없어 보임
  69. ##
  70. class ToolTip(ui.ThinBoard):
  71.  
  72.     TOOL_TIP_WIDTH = 190
  73.     TOOL_TIP_HEIGHT = 10
  74.  
  75.     TEXT_LINE_HEIGHT = 17
  76.  
  77.     TITLE_COLOR = grp.GenerateColor(0.9490, 0.9058, 0.7568, 1.0)
  78.     SPECIAL_TITLE_COLOR = grp.GenerateColor(1.0, 0.7843, 0.0, 1.0)
  79.     NORMAL_COLOR = grp.GenerateColor(0.7607, 0.7607, 0.7607, 1.0)
  80.     FONT_COLOR = grp.GenerateColor(0.7607, 0.7607, 0.7607, 1.0)
  81.     PRICE_COLOR = 0xffFFB96D
  82.  
  83.     HIGH_PRICE_COLOR = SPECIAL_TITLE_COLOR
  84.     MIDDLE_PRICE_COLOR = grp.GenerateColor(0.85, 0.85, 0.85, 1.0)
  85.     LOW_PRICE_COLOR = grp.GenerateColor(0.7, 0.7, 0.7, 1.0)
  86.  
  87.     ENABLE_COLOR = grp.GenerateColor(0.7607, 0.7607, 0.7607, 1.0)
  88.     DISABLE_COLOR = grp.GenerateColor(0.9, 0.4745, 0.4627, 1.0)
  89.  
  90.     NEGATIVE_COLOR = grp.GenerateColor(0.9, 0.4745, 0.4627, 1.0)
  91.     POSITIVE_COLOR = grp.GenerateColor(0.5411, 0.7254, 0.5568, 1.0)
  92.     SPECIAL_POSITIVE_COLOR = grp.GenerateColor(0.6911, 0.8754, 0.7068, 1.0)
  93.     SPECIAL_POSITIVE_COLOR2 = grp.GenerateColor(0.8824, 0.9804, 0.8824, 1.0)
  94.  
  95.     CONDITION_COLOR = 0xffBEB47D
  96.     CAN_LEVEL_UP_COLOR = 0xff8EC292
  97.     CANNOT_LEVEL_UP_COLOR = DISABLE_COLOR
  98.     NEED_SKILL_POINT_COLOR = 0xff9A9CDB
  99.  
  100.     def __init__(self, width = TOOL_TIP_WIDTH, isPickable=False):
  101.         ui.ThinBoard.__init__(self, "TOP_MOST")
  102.  
  103.         if isPickable:
  104.             pass
  105.         else:
  106.             self.AddFlag("not_pick")
  107.  
  108.         self.AddFlag("float")
  109.  
  110.         self.followFlag = True
  111.         self.toolTipWidth = width
  112.  
  113.         self.xPos = -1
  114.         self.yPos = -1
  115.  
  116.         self.defFontName = localeInfo.UI_DEF_FONT
  117.         self.ClearToolTip()
  118.  
  119.     def __del__(self):
  120.         ui.ThinBoard.__del__(self)
  121.  
  122.     def ClearToolTip(self):
  123.         self.toolTipHeight = 12
  124.         self.childrenList = []
  125.  
  126.     def SetFollow(self, flag):
  127.         self.followFlag = flag
  128.  
  129.     def SetDefaultFontName(self, fontName):
  130.         self.defFontName = fontName
  131.  
  132.     def AppendSpace(self, size):
  133.         self.toolTipHeight += size
  134.         self.ResizeToolTip()
  135.  
  136.     def AppendHorizontalLine(self):
  137.  
  138.         for i in xrange(2):
  139.             horizontalLine = ui.Line()
  140.             horizontalLine.SetParent(self)
  141.             horizontalLine.SetPosition(0, self.toolTipHeight + 3 + i)
  142.             horizontalLine.SetWindowHorizontalAlignCenter()
  143.             horizontalLine.SetSize(150, 0)
  144.             horizontalLine.Show()
  145.  
  146.             if 0 == i:
  147.                 horizontalLine.SetColor(0xff555555)
  148.             else:
  149.                 horizontalLine.SetColor(0xff000000)
  150.  
  151.             self.childrenList.append(horizontalLine)
  152.  
  153.         self.toolTipHeight += 11
  154.         self.ResizeToolTip()
  155.  
  156.     def AlignHorizonalCenter(self):
  157.         for child in self.childrenList:
  158.             (x, y)=child.GetLocalPosition()
  159.             child.SetPosition(self.toolTipWidth/2, y)
  160.  
  161.         self.ResizeToolTip()
  162.  
  163.     def AutoAppendTextLine(self, text, color = FONT_COLOR, centerAlign = True):
  164.         textLine = ui.TextLine()
  165.         textLine.SetParent(self)
  166.         textLine.SetFontName(self.defFontName)
  167.         textLine.SetPackedFontColor(color)
  168.         textLine.SetText(text)
  169.         textLine.SetOutline()
  170.         textLine.SetFeather(False)
  171.         textLine.Show()
  172.  
  173.         if centerAlign:
  174.             textLine.SetPosition(self.toolTipWidth/2, self.toolTipHeight)
  175.             textLine.SetHorizontalAlignCenter()
  176.  
  177.         else:
  178.             textLine.SetPosition(10, self.toolTipHeight)
  179.  
  180.         self.childrenList.append(textLine)
  181.  
  182.         (textWidth, textHeight)=textLine.GetTextSize()
  183.  
  184.         textWidth += 40
  185.         textHeight += 5
  186.  
  187.         if self.toolTipWidth < textWidth:
  188.             self.toolTipWidth = textWidth
  189.  
  190.         self.toolTipHeight += textHeight
  191.  
  192.         return textLine
  193.  
  194.     def AutoAppendNewTextLine(self, text, color = FONT_COLOR, centerAlign = True):
  195.         textLine = ui.TextLine()
  196.         textLine.SetParent(self)
  197.         textLine.SetFontName(self.defFontName)
  198.         textLine.SetPackedFontColor(color)
  199.         textLine.SetText(text)
  200.         textLine.SetOutline()
  201.         textLine.SetFeather(FALSE)
  202.         textLine.Show()
  203.         textLine.SetPosition(15, self.toolTipHeight)
  204.        
  205.         self.childrenList.append(textLine)
  206.         (textWidth, textHeight) = textLine.GetTextSize()
  207.         textWidth += 30
  208.         textHeight += 10
  209.         if self.toolTipWidth < textWidth:
  210.             self.toolTipWidth = textWidth
  211.        
  212.         self.toolTipHeight += textHeight
  213.         self.ResizeToolTipText(textWidth, self.toolTipHeight)
  214.         return textLine
  215.  
  216.     def AppendTextLine(self, text, color = FONT_COLOR, centerAlign = True):
  217.         textLine = ui.TextLine()
  218.         textLine.SetParent(self)
  219.         textLine.SetFontName(self.defFontName)
  220.         textLine.SetPackedFontColor(color)
  221.         textLine.SetText(text)
  222.         textLine.SetOutline()
  223.         textLine.SetFeather(False)
  224.         textLine.Show()
  225.  
  226.         if centerAlign:
  227.             textLine.SetPosition(self.toolTipWidth/2, self.toolTipHeight)
  228.             textLine.SetHorizontalAlignCenter()
  229.  
  230.         else:
  231.             textLine.SetPosition(10, self.toolTipHeight)
  232.  
  233.         self.childrenList.append(textLine)
  234.  
  235.         self.toolTipHeight += self.TEXT_LINE_HEIGHT
  236.         self.ResizeToolTip()
  237.  
  238.         return textLine
  239.  
  240.     def AppendDescription(self, desc, limit, color = FONT_COLOR):
  241.         if localeInfo.IsEUROPE():
  242.             self.__AppendDescription_WesternLanguage(desc, color)
  243.         else:
  244.             self.__AppendDescription_EasternLanguage(desc, limit, color)
  245.  
  246.     def __AppendDescription_EasternLanguage(self, description, characterLimitation, color=FONT_COLOR):
  247.         length = len(description)
  248.         if 0 == length:
  249.             return
  250.  
  251.         lineCount = grpText.GetSplitingTextLineCount(description, characterLimitation)
  252.         for i in xrange(lineCount):
  253.             if 0 == i:
  254.                 self.AppendSpace(5)
  255.             self.AppendTextLine(grpText.GetSplitingTextLine(description, characterLimitation, i), color)
  256.  
  257.     def __AppendDescription_WesternLanguage(self, desc, color=FONT_COLOR):
  258.         lines = SplitDescription(desc, DESC_WESTERN_MAX_COLS)
  259.         if not lines:
  260.             return
  261.  
  262.         self.AppendSpace(5)
  263.         for line in lines:
  264.             self.AppendTextLine(line, color)
  265.            
  266.  
  267.     def ResizeToolTip(self):
  268.         self.SetSize(self.toolTipWidth, self.TOOL_TIP_HEIGHT + self.toolTipHeight)
  269.  
  270.     def ResizeToolTipText(self, x, y):
  271.         self.SetSize(x, y)
  272.  
  273.     def SetTitle(self, name):
  274.         self.AppendTextLine(name, self.TITLE_COLOR)
  275.  
  276.     def GetLimitTextLineColor(self, curValue, limitValue):
  277.         if curValue < limitValue:
  278.             return self.DISABLE_COLOR
  279.  
  280.         return self.ENABLE_COLOR
  281.  
  282.     def GetChangeTextLineColor(self, value, isSpecial=False):
  283.         if value > 0:
  284.             if isSpecial:
  285.                 return self.SPECIAL_POSITIVE_COLOR
  286.             else:
  287.                 return self.POSITIVE_COLOR
  288.  
  289.         if 0 == value:
  290.             return self.NORMAL_COLOR
  291.  
  292.         return self.NEGATIVE_COLOR
  293.  
  294.     def SetToolTipPosition(self, x = -1, y = -1):
  295.         self.xPos = x
  296.         self.yPos = y
  297.  
  298.     def ShowToolTip(self):
  299.         self.SetTop()
  300.         self.Show()
  301.  
  302.         self.OnUpdate()
  303.  
  304.     def HideToolTip(self):
  305.         self.Hide()
  306.  
  307.     def OnUpdate(self):
  308.  
  309.         if not self.followFlag:
  310.             return
  311.  
  312.         x = 0
  313.         y = 0
  314.         width = self.GetWidth()
  315.         height = self.toolTipHeight
  316.  
  317.         if -1 == self.xPos and -1 == self.yPos:
  318.  
  319.             (mouseX, mouseY) = wndMgr.GetMousePosition()
  320.  
  321.             if mouseY < wndMgr.GetScreenHeight() - 300:
  322.                 y = mouseY + 40
  323.             else:
  324.                 y = mouseY - height - 30
  325.  
  326.             x = mouseX - width/2               
  327.  
  328.         else:
  329.  
  330.             x = self.xPos - width/2
  331.             y = self.yPos - height
  332.  
  333.         x = max(x, 0)
  334.         y = max(y, 0)
  335.         x = min(x + width/2, wndMgr.GetScreenWidth() - width/2) - width/2
  336.         y = min(y + self.GetHeight(), wndMgr.GetScreenHeight()) - self.GetHeight()
  337.  
  338.         parentWindow = self.GetParentProxy()
  339.         if parentWindow:
  340.             (gx, gy) = parentWindow.GetGlobalPosition()
  341.             x -= gx
  342.             y -= gy
  343.  
  344.         self.SetPosition(x, y)
  345.  
  346. class ItemToolTip(ToolTip):
  347.     if app.ENABLE_SEND_TARGET_INFO:
  348.         isStone = False
  349.         isBook = False
  350.         isBook2 = False
  351.  
  352.     CHARACTER_NAMES = (
  353.         localeInfo.TOOLTIP_WARRIOR,
  354.         localeInfo.TOOLTIP_ASSASSIN,
  355.         localeInfo.TOOLTIP_SURA,
  356.         localeInfo.TOOLTIP_SHAMAN
  357.     )
  358.  
  359.     CHARACTER_COUNT = len(CHARACTER_NAMES)
  360.     WEAR_NAMES = (
  361.         localeInfo.TOOLTIP_ARMOR,
  362.         localeInfo.TOOLTIP_HELMET,
  363.         localeInfo.TOOLTIP_SHOES,
  364.         localeInfo.TOOLTIP_WRISTLET,
  365.         localeInfo.TOOLTIP_WEAPON,
  366.         localeInfo.TOOLTIP_NECK,
  367.         localeInfo.TOOLTIP_EAR,
  368.         localeInfo.TOOLTIP_UNIQUE,
  369.         localeInfo.TOOLTIP_SHIELD,
  370.         localeInfo.TOOLTIP_ARROW,
  371.     )
  372.     WEAR_COUNT = len(WEAR_NAMES)
  373.  
  374.     AFFECT_DICT = {
  375.         item.APPLY_MAX_HP : localeInfo.TOOLTIP_MAX_HP,
  376.         item.APPLY_MAX_SP : localeInfo.TOOLTIP_MAX_SP,
  377.         item.APPLY_CON : localeInfo.TOOLTIP_CON,
  378.         item.APPLY_INT : localeInfo.TOOLTIP_INT,
  379.         item.APPLY_STR : localeInfo.TOOLTIP_STR,
  380.         item.APPLY_DEX : localeInfo.TOOLTIP_DEX,
  381.         item.APPLY_ATT_SPEED : localeInfo.TOOLTIP_ATT_SPEED,
  382.         item.APPLY_MOV_SPEED : localeInfo.TOOLTIP_MOV_SPEED,
  383.         item.APPLY_CAST_SPEED : localeInfo.TOOLTIP_CAST_SPEED,
  384.         item.APPLY_HP_REGEN : localeInfo.TOOLTIP_HP_REGEN,
  385.         item.APPLY_SP_REGEN : localeInfo.TOOLTIP_SP_REGEN,
  386.         item.APPLY_POISON_PCT : localeInfo.TOOLTIP_APPLY_POISON_PCT,
  387.         item.APPLY_STUN_PCT : localeInfo.TOOLTIP_APPLY_STUN_PCT,
  388.         item.APPLY_SLOW_PCT : localeInfo.TOOLTIP_APPLY_SLOW_PCT,
  389.         item.APPLY_CRITICAL_PCT : localeInfo.TOOLTIP_APPLY_CRITICAL_PCT,
  390.         item.APPLY_PENETRATE_PCT : localeInfo.TOOLTIP_APPLY_PENETRATE_PCT,
  391.  
  392.         item.APPLY_ATTBONUS_WARRIOR : localeInfo.TOOLTIP_APPLY_ATTBONUS_WARRIOR,
  393.         item.APPLY_ATTBONUS_ASSASSIN : localeInfo.TOOLTIP_APPLY_ATTBONUS_ASSASSIN,
  394.         item.APPLY_ATTBONUS_SURA : localeInfo.TOOLTIP_APPLY_ATTBONUS_SURA,
  395.         item.APPLY_ATTBONUS_SHAMAN : localeInfo.TOOLTIP_APPLY_ATTBONUS_SHAMAN,
  396.         item.APPLY_ATTBONUS_MONSTER : localeInfo.TOOLTIP_APPLY_ATTBONUS_MONSTER,
  397.  
  398.         item.APPLY_ATTBONUS_HUMAN : localeInfo.TOOLTIP_APPLY_ATTBONUS_HUMAN,
  399.         item.APPLY_ATTBONUS_ANIMAL : localeInfo.TOOLTIP_APPLY_ATTBONUS_ANIMAL,
  400.         item.APPLY_ATTBONUS_ORC : localeInfo.TOOLTIP_APPLY_ATTBONUS_ORC,
  401.         item.APPLY_ATTBONUS_MILGYO : localeInfo.TOOLTIP_APPLY_ATTBONUS_MILGYO,
  402.         item.APPLY_ATTBONUS_UNDEAD : localeInfo.TOOLTIP_APPLY_ATTBONUS_UNDEAD,
  403.         item.APPLY_ATTBONUS_DEVIL : localeInfo.TOOLTIP_APPLY_ATTBONUS_DEVIL,
  404.         item.APPLY_STEAL_HP : localeInfo.TOOLTIP_APPLY_STEAL_HP,
  405.         item.APPLY_STEAL_SP : localeInfo.TOOLTIP_APPLY_STEAL_SP,
  406.         item.APPLY_MANA_BURN_PCT : localeInfo.TOOLTIP_APPLY_MANA_BURN_PCT,
  407.         item.APPLY_DAMAGE_SP_RECOVER : localeInfo.TOOLTIP_APPLY_DAMAGE_SP_RECOVER,
  408.         item.APPLY_BLOCK : localeInfo.TOOLTIP_APPLY_BLOCK,
  409.         item.APPLY_DODGE : localeInfo.TOOLTIP_APPLY_DODGE,
  410.         item.APPLY_RESIST_SWORD : localeInfo.TOOLTIP_APPLY_RESIST_SWORD,
  411.         item.APPLY_RESIST_TWOHAND : localeInfo.TOOLTIP_APPLY_RESIST_TWOHAND,
  412.         item.APPLY_RESIST_DAGGER : localeInfo.TOOLTIP_APPLY_RESIST_DAGGER,
  413.         item.APPLY_RESIST_BELL : localeInfo.TOOLTIP_APPLY_RESIST_BELL,
  414.         item.APPLY_RESIST_FAN : localeInfo.TOOLTIP_APPLY_RESIST_FAN,
  415.         item.APPLY_RESIST_BOW : localeInfo.TOOLTIP_RESIST_BOW,
  416.         item.APPLY_RESIST_FIRE : localeInfo.TOOLTIP_RESIST_FIRE,
  417.         item.APPLY_RESIST_ELEC : localeInfo.TOOLTIP_RESIST_ELEC,
  418.         item.APPLY_RESIST_MAGIC : localeInfo.TOOLTIP_RESIST_MAGIC,
  419.         item.APPLY_RESIST_WIND : localeInfo.TOOLTIP_APPLY_RESIST_WIND,
  420.         item.APPLY_REFLECT_MELEE : localeInfo.TOOLTIP_APPLY_REFLECT_MELEE,
  421.         item.APPLY_REFLECT_CURSE : localeInfo.TOOLTIP_APPLY_REFLECT_CURSE,
  422.         item.APPLY_POISON_REDUCE : localeInfo.TOOLTIP_APPLY_POISON_REDUCE,
  423.         item.APPLY_KILL_SP_RECOVER : localeInfo.TOOLTIP_APPLY_KILL_SP_RECOVER,
  424.         item.APPLY_EXP_DOUBLE_BONUS : localeInfo.TOOLTIP_APPLY_EXP_DOUBLE_BONUS,
  425.         item.APPLY_GOLD_DOUBLE_BONUS : localeInfo.TOOLTIP_APPLY_GOLD_DOUBLE_BONUS,
  426.         item.APPLY_ITEM_DROP_BONUS : localeInfo.TOOLTIP_APPLY_ITEM_DROP_BONUS,
  427.         item.APPLY_POTION_BONUS : localeInfo.TOOLTIP_APPLY_POTION_BONUS,
  428.         item.APPLY_KILL_HP_RECOVER : localeInfo.TOOLTIP_APPLY_KILL_HP_RECOVER,
  429.         item.APPLY_IMMUNE_STUN : localeInfo.TOOLTIP_APPLY_IMMUNE_STUN,
  430.         item.APPLY_IMMUNE_SLOW : localeInfo.TOOLTIP_APPLY_IMMUNE_SLOW,
  431.         item.APPLY_IMMUNE_FALL : localeInfo.TOOLTIP_APPLY_IMMUNE_FALL,
  432.         item.APPLY_BOW_DISTANCE : localeInfo.TOOLTIP_BOW_DISTANCE,
  433.         item.APPLY_DEF_GRADE_BONUS : localeInfo.TOOLTIP_DEF_GRADE,
  434.         item.APPLY_ATT_GRADE_BONUS : localeInfo.TOOLTIP_ATT_GRADE,
  435.         item.APPLY_MAGIC_ATT_GRADE : localeInfo.TOOLTIP_MAGIC_ATT_GRADE,
  436.         item.APPLY_MAGIC_DEF_GRADE : localeInfo.TOOLTIP_MAGIC_DEF_GRADE,
  437.         item.APPLY_MAX_STAMINA : localeInfo.TOOLTIP_MAX_STAMINA,
  438.         item.APPLY_MALL_ATTBONUS : localeInfo.TOOLTIP_MALL_ATTBONUS,
  439.         item.APPLY_MALL_DEFBONUS : localeInfo.TOOLTIP_MALL_DEFBONUS,
  440.         item.APPLY_MALL_EXPBONUS : localeInfo.TOOLTIP_MALL_EXPBONUS,
  441.         item.APPLY_MALL_ITEMBONUS : localeInfo.TOOLTIP_MALL_ITEMBONUS,
  442.         item.APPLY_MALL_GOLDBONUS : localeInfo.TOOLTIP_MALL_GOLDBONUS,
  443.         item.APPLY_SKILL_DAMAGE_BONUS : localeInfo.TOOLTIP_SKILL_DAMAGE_BONUS,
  444.         item.APPLY_NORMAL_HIT_DAMAGE_BONUS : localeInfo.TOOLTIP_NORMAL_HIT_DAMAGE_BONUS,
  445.         item.APPLY_SKILL_DEFEND_BONUS : localeInfo.TOOLTIP_SKILL_DEFEND_BONUS,
  446.         item.APPLY_NORMAL_HIT_DEFEND_BONUS : localeInfo.TOOLTIP_NORMAL_HIT_DEFEND_BONUS,
  447.         item.APPLY_PC_BANG_EXP_BONUS : localeInfo.TOOLTIP_MALL_EXPBONUS_P_STATIC,
  448.         item.APPLY_PC_BANG_DROP_BONUS : localeInfo.TOOLTIP_MALL_ITEMBONUS_P_STATIC,
  449.         item.APPLY_RESIST_WARRIOR : localeInfo.TOOLTIP_APPLY_RESIST_WARRIOR,
  450.         item.APPLY_RESIST_ASSASSIN : localeInfo.TOOLTIP_APPLY_RESIST_ASSASSIN,
  451.         item.APPLY_RESIST_SURA : localeInfo.TOOLTIP_APPLY_RESIST_SURA,
  452.         item.APPLY_RESIST_SHAMAN : localeInfo.TOOLTIP_APPLY_RESIST_SHAMAN,
  453.         item.APPLY_MAX_HP_PCT : localeInfo.TOOLTIP_APPLY_MAX_HP_PCT,
  454.         item.APPLY_MAX_SP_PCT : localeInfo.TOOLTIP_APPLY_MAX_SP_PCT,
  455.         item.APPLY_ENERGY : localeInfo.TOOLTIP_ENERGY,
  456.         item.APPLY_COSTUME_ATTR_BONUS : localeInfo.TOOLTIP_COSTUME_ATTR_BONUS,
  457.        
  458.         item.APPLY_MAGIC_ATTBONUS_PER : localeInfo.TOOLTIP_MAGIC_ATTBONUS_PER,
  459.         item.APPLY_MELEE_MAGIC_ATTBONUS_PER : localeInfo.TOOLTIP_MELEE_MAGIC_ATTBONUS_PER,
  460.         item.APPLY_RESIST_ICE : localeInfo.TOOLTIP_RESIST_ICE,
  461.         item.APPLY_RESIST_EARTH : localeInfo.TOOLTIP_RESIST_EARTH,
  462.         item.APPLY_RESIST_DARK : localeInfo.TOOLTIP_RESIST_DARK,
  463.         item.APPLY_ANTI_CRITICAL_PCT : localeInfo.TOOLTIP_ANTI_CRITICAL_PCT,
  464.         item.APPLY_ANTI_PENETRATE_PCT : localeInfo.TOOLTIP_ANTI_PENETRATE_PCT,
  465.     }
  466.  
  467.     if app.ENABLE_ANTI_RESIST_MAGIC_BONUS_SYSTEM:
  468.         AFFECT_DICT.update({
  469.             item.APPLY_ANTI_RESIST_MAGIC : localeInfo.APPLY_ANTI_RESIST_MAGIC,
  470.         })
  471.  
  472.     ATTRIBUTE_NEED_WIDTH = {
  473.         23 : 230,
  474.         24 : 230,
  475.         25 : 230,
  476.         26 : 220,
  477.         27 : 210,
  478.  
  479.         35 : 210,
  480.         36 : 210,
  481.         37 : 210,
  482.         38 : 210,
  483.         39 : 210,
  484.         40 : 210,
  485.         41 : 210,
  486.  
  487.         42 : 220,
  488.         43 : 230,
  489.         45 : 230,
  490.     }
  491.  
  492.     ANTI_FLAG_DICT = {
  493.         0 : item.ITEM_ANTIFLAG_WARRIOR,
  494.         1 : item.ITEM_ANTIFLAG_ASSASSIN,
  495.         2 : item.ITEM_ANTIFLAG_SURA,
  496.         3 : item.ITEM_ANTIFLAG_SHAMAN,
  497.     }
  498.  
  499.     FONT_COLOR = grp.GenerateColor(0.7607, 0.7607, 0.7607, 1.0)
  500.  
  501.     def __init__(self, *args, **kwargs):
  502.         ToolTip.__init__(self, *args, **kwargs)
  503.         self.itemVnum = 0
  504.         self.isShopItem = False
  505.  
  506.         # 아이템 툴팁을 표시할 때 현재 캐릭터가 착용할 수 없는 아이템이라면 강제로 Disable Color로 설정 (이미 그렇게 작동하고 있으나 꺼야 할 필요가 있어서)
  507.         self.bCannotUseItemForceSetDisableColor = True
  508.  
  509.     def __del__(self):
  510.         ToolTip.__del__(self)
  511.  
  512.     def SetCannotUseItemForceSetDisableColor(self, enable):
  513.         self.bCannotUseItemForceSetDisableColor = enable
  514.  
  515.     def CanEquip(self):
  516.         if not item.IsEquipmentVID(self.itemVnum):
  517.             return True
  518.  
  519.         race = player.GetRace()
  520.         job = chr.RaceToJob(race)
  521.         if not self.ANTI_FLAG_DICT.has_key(job):
  522.             return False
  523.  
  524.         if item.IsAntiFlag(self.ANTI_FLAG_DICT[job]):
  525.             return False
  526.  
  527.         sex = chr.RaceToSex(race)
  528.        
  529.         MALE = 1
  530.         FEMALE = 0
  531.  
  532.         if item.IsAntiFlag(item.ITEM_ANTIFLAG_MALE) and sex == MALE:
  533.             return False
  534.  
  535.         if item.IsAntiFlag(item.ITEM_ANTIFLAG_FEMALE) and sex == FEMALE:
  536.             return False
  537.  
  538.         for i in xrange(item.LIMIT_MAX_NUM):
  539.             (limitType, limitValue) = item.GetLimit(i)
  540.  
  541.             if item.LIMIT_LEVEL == limitType:
  542.                 if player.GetStatus(player.LEVEL) < limitValue:
  543.                     return False
  544.             """
  545.             elif item.LIMIT_STR == limitType:
  546.                 if player.GetStatus(player.ST) < limitValue:
  547.                     return False
  548.             elif item.LIMIT_DEX == limitType:
  549.                 if player.GetStatus(player.DX) < limitValue:
  550.                     return False
  551.             elif item.LIMIT_INT == limitType:
  552.                 if player.GetStatus(player.IQ) < limitValue:
  553.                     return False
  554.             elif item.LIMIT_CON == limitType:
  555.                 if player.GetStatus(player.HT) < limitValue:
  556.                     return False
  557.             """
  558.  
  559.         return True
  560.  
  561.     def AppendTextLine(self, text, color = FONT_COLOR, centerAlign = True):
  562.         if not self.CanEquip() and self.bCannotUseItemForceSetDisableColor:
  563.             color = self.DISABLE_COLOR
  564.  
  565.         return ToolTip.AppendTextLine(self, text, color, centerAlign)
  566.  
  567.     def ClearToolTip(self):
  568.         self.isShopItem = False
  569.         self.toolTipWidth = self.TOOL_TIP_WIDTH
  570.         ToolTip.ClearToolTip(self)
  571.  
  572.     def SetInventoryItem(self, slotIndex, window_type = player.INVENTORY):
  573.         itemVnum = player.GetItemIndex(window_type, slotIndex)
  574.         if 0 == itemVnum:
  575.             return
  576.  
  577.         self.ClearToolTip()
  578.         if shop.IsOpen():
  579.             if not shop.IsPrivateShop():
  580.                 item.SelectItem(itemVnum)
  581.                 self.AppendSellingPrice(player.GetISellItemPrice(window_type, slotIndex))
  582.  
  583.         metinSlot = [player.GetItemMetinSocket(window_type, slotIndex, i) for i in xrange(player.METIN_SOCKET_MAX_NUM)]
  584.         attrSlot = [player.GetItemAttribute(window_type, slotIndex, i) for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM)]
  585.  
  586.         self.AddItemData(itemVnum, metinSlot, attrSlot)
  587.        
  588.     if app.ENABLE_SEND_TARGET_INFO:
  589.         def SetItemToolTipStone(self, itemVnum):
  590.             self.itemVnum = itemVnum
  591.             item.SelectItem(itemVnum)
  592.             itemType = item.GetItemType()
  593.  
  594.             itemDesc = item.GetItemDescription()
  595.             itemSummary = item.GetItemSummary()
  596.             attrSlot = 0
  597.             self.__AdjustMaxWidth(attrSlot, itemDesc)
  598.             itemName = item.GetItemName()
  599.             realName = itemName[:itemName.find("+")]
  600.             self.SetTitle(realName + " +0 - +4")
  601.  
  602.             ## Description ###
  603.             self.AppendDescription(itemDesc, 26)
  604.             self.AppendDescription(itemSummary, 26, self.CONDITION_COLOR)
  605.  
  606.             if item.ITEM_TYPE_METIN == itemType:
  607.                 self.AppendMetinInformation()
  608.                 self.AppendMetinWearInformation()
  609.  
  610.             for i in xrange(item.LIMIT_MAX_NUM):
  611.                 (limitType, limitValue) = item.GetLimit(i)
  612.  
  613.                 if item.LIMIT_REAL_TIME_START_FIRST_USE == limitType:
  614.                     self.AppendRealTimeStartFirstUseLastTime(item, metinSlot, i)
  615.  
  616.                 elif item.LIMIT_TIMER_BASED_ON_WEAR == limitType:
  617.                     self.AppendTimerBasedOnWearLastTime(metinSlot)
  618.  
  619.             self.ShowToolTip()
  620.  
  621.     def SetShopItem(self, slotIndex):
  622.         itemVnum = shop.GetItemID(slotIndex)
  623.         if 0 == itemVnum:
  624.             return
  625.  
  626.         price = shop.GetItemPrice(slotIndex)
  627.         self.ClearToolTip()
  628.         self.isShopItem = True
  629.  
  630.         metinSlot = []
  631.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  632.             metinSlot.append(shop.GetItemMetinSocket(slotIndex, i))
  633.         attrSlot = []
  634.         for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  635.             attrSlot.append(shop.GetItemAttribute(slotIndex, i))
  636.  
  637.         self.AddItemData(itemVnum, metinSlot, attrSlot)
  638.         self.AppendPrice(price)
  639.  
  640.     def SetShopItemBySecondaryCoin(self, slotIndex):
  641.         itemVnum = shop.GetItemID(slotIndex)
  642.         if 0 == itemVnum:
  643.             return
  644.  
  645.         price = shop.GetItemPrice(slotIndex)
  646.         self.ClearToolTip()
  647.         self.isShopItem = True
  648.  
  649.         metinSlot = []
  650.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  651.             metinSlot.append(shop.GetItemMetinSocket(slotIndex, i))
  652.         attrSlot = []
  653.         for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  654.             attrSlot.append(shop.GetItemAttribute(slotIndex, i))
  655.  
  656.         self.AddItemData(itemVnum, metinSlot, attrSlot)
  657.         self.AppendPriceBySecondaryCoin(price)
  658.  
  659.     def SetExchangeOwnerItem(self, slotIndex):
  660.         itemVnum = exchange.GetItemVnumFromSelf(slotIndex)
  661.         if 0 == itemVnum:
  662.             return
  663.  
  664.         self.ClearToolTip()
  665.  
  666.         metinSlot = []
  667.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  668.             metinSlot.append(exchange.GetItemMetinSocketFromSelf(slotIndex, i))
  669.         attrSlot = []
  670.         for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  671.             attrSlot.append(exchange.GetItemAttributeFromSelf(slotIndex, i))
  672.         self.AddItemData(itemVnum, metinSlot, attrSlot)
  673.  
  674.     def SetExchangeTargetItem(self, slotIndex):
  675.         itemVnum = exchange.GetItemVnumFromTarget(slotIndex)
  676.         if 0 == itemVnum:
  677.             return
  678.  
  679.         self.ClearToolTip()
  680.  
  681.         metinSlot = []
  682.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  683.             metinSlot.append(exchange.GetItemMetinSocketFromTarget(slotIndex, i))
  684.         attrSlot = []
  685.         for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  686.             attrSlot.append(exchange.GetItemAttributeFromTarget(slotIndex, i))
  687.         self.AddItemData(itemVnum, metinSlot, attrSlot)
  688.  
  689.     def SetPrivateShopBuilderItem(self, invenType, invenPos, privateShopSlotIndex):
  690.         itemVnum = player.GetItemIndex(invenType, invenPos)
  691.         if 0 == itemVnum:
  692.             return
  693.  
  694.         item.SelectItem(itemVnum)
  695.         self.ClearToolTip()
  696.         self.AppendSellingPrice(shop.GetPrivateShopItemPrice(invenType, invenPos))
  697.  
  698.         metinSlot = []
  699.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  700.             metinSlot.append(player.GetItemMetinSocket(invenPos, i))
  701.         attrSlot = []
  702.         for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  703.             attrSlot.append(player.GetItemAttribute(invenPos, i))
  704.  
  705.         self.AddItemData(itemVnum, metinSlot, attrSlot)
  706.  
  707.     def SetSafeBoxItem(self, slotIndex):
  708.         itemVnum = safebox.GetItemID(slotIndex)
  709.         if 0 == itemVnum:
  710.             return
  711.  
  712.         self.ClearToolTip()
  713.         metinSlot = []
  714.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  715.             metinSlot.append(safebox.GetItemMetinSocket(slotIndex, i))
  716.         attrSlot = []
  717.         for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  718.             attrSlot.append(safebox.GetItemAttribute(slotIndex, i))
  719.        
  720.         self.AddItemData(itemVnum, metinSlot, attrSlot, safebox.GetItemFlags(slotIndex))
  721.  
  722.         if app.ENABLE_SOULBIND_SYSTEM:
  723.             self.__AppendSealInformation(player.SAFEBOX, slotIndex)
  724.  
  725.     def SetMallItem(self, slotIndex):
  726.         itemVnum = safebox.GetMallItemID(slotIndex)
  727.         if 0 == itemVnum:
  728.             return
  729.  
  730.         self.ClearToolTip()
  731.         metinSlot = []
  732.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  733.             metinSlot.append(safebox.GetMallItemMetinSocket(slotIndex, i))
  734.         attrSlot = []
  735.         for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  736.             attrSlot.append(safebox.GetMallItemAttribute(slotIndex, i))
  737.  
  738.         self.AddItemData(itemVnum, metinSlot, attrSlot)
  739.  
  740.         if app.ENABLE_SOULBIND_SYSTEM:
  741.             self.__AppendSealInformation(player.MALL, slotIndex)
  742.  
  743.     def SetItemToolTip(self, itemVnum):
  744.         self.ClearToolTip()
  745.         metinSlot = []
  746.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  747.             metinSlot.append(0)
  748.         attrSlot = []
  749.         for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  750.             attrSlot.append((0, 0))
  751.  
  752.         self.AddItemData(itemVnum, metinSlot, attrSlot)
  753.  
  754.     def __AppendAttackSpeedInfo(self, item):
  755.         atkSpd = item.GetValue(0)
  756.  
  757.         if atkSpd < 80:
  758.             stSpd = localeInfo.TOOLTIP_ITEM_VERY_FAST
  759.         elif atkSpd <= 95:
  760.             stSpd = localeInfo.TOOLTIP_ITEM_FAST
  761.         elif atkSpd <= 105:
  762.             stSpd = localeInfo.TOOLTIP_ITEM_NORMAL
  763.         elif atkSpd <= 120:
  764.             stSpd = localeInfo.TOOLTIP_ITEM_SLOW
  765.         else:
  766.             stSpd = localeInfo.TOOLTIP_ITEM_VERY_SLOW
  767.  
  768.         self.AppendTextLine(localeInfo.TOOLTIP_ITEM_ATT_SPEED % stSpd, self.NORMAL_COLOR)
  769.  
  770.     def __AppendAttackGradeInfo(self):
  771.         atkGrade = item.GetValue(1)
  772.         self.AppendTextLine(localeInfo.TOOLTIP_ITEM_ATT_GRADE % atkGrade, self.GetChangeTextLineColor(atkGrade))
  773.  
  774.     def __AppendAttackPowerInfo(self):
  775.         minPower = item.GetValue(3)
  776.         maxPower = item.GetValue(4)
  777.         addPower = item.GetValue(5)
  778.         if maxPower > minPower:
  779.             self.AppendTextLine(localeInfo.TOOLTIP_ITEM_ATT_POWER % (minPower+addPower, maxPower+addPower), self.POSITIVE_COLOR)
  780.         else:
  781.             self.AppendTextLine(localeInfo.TOOLTIP_ITEM_ATT_POWER_ONE_ARG % (minPower+addPower), self.POSITIVE_COLOR)
  782.  
  783.     def __AppendMagicAttackInfo(self):
  784.         minMagicAttackPower = item.GetValue(1)
  785.         maxMagicAttackPower = item.GetValue(2)
  786.         addPower = item.GetValue(5)
  787.  
  788.         if minMagicAttackPower > 0 or maxMagicAttackPower > 0:
  789.             if maxMagicAttackPower > minMagicAttackPower:
  790.                 self.AppendTextLine(localeInfo.TOOLTIP_ITEM_MAGIC_ATT_POWER % (minMagicAttackPower+addPower, maxMagicAttackPower+addPower), self.POSITIVE_COLOR)
  791.             else:
  792.                 self.AppendTextLine(localeInfo.TOOLTIP_ITEM_MAGIC_ATT_POWER_ONE_ARG % (minMagicAttackPower+addPower), self.POSITIVE_COLOR)
  793.  
  794.     def __AppendMagicDefenceInfo(self):
  795.         magicDefencePower = item.GetValue(0)
  796.  
  797.         if magicDefencePower > 0:
  798.             self.AppendTextLine(localeInfo.TOOLTIP_ITEM_MAGIC_DEF_POWER % magicDefencePower, self.GetChangeTextLineColor(magicDefencePower))
  799.  
  800.     def __AppendAttributeInformation(self, attrSlot):
  801.         if 0 != attrSlot:
  802.  
  803.             for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  804.                 type = attrSlot[i][0]
  805.                 value = attrSlot[i][1]
  806.  
  807.                 if 0 == value:
  808.                     continue
  809.  
  810.                 affectString = self.__GetAffectString(type, value)
  811.                 if affectString:
  812.                     affectColor = self.__GetAttributeColor(i, value)
  813.                     self.AppendTextLine(affectString, affectColor)
  814.                    
  815.     def __AppendAcceAttributeInformation(self, attrSlot):
  816.         if 0 != attrSlot:
  817.             hasAttack = 0
  818.             hasMagicAttack = 0
  819.             minPower = 0
  820.             maxPower = 0
  821.             minMagicAttackPower = 0
  822.             maxMagicAttackPower = 0
  823.            
  824.             for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  825.                 if i <= 6:
  826.                     continue
  827.                 else:
  828.                     type = attrSlot[i][0]
  829.                     value = attrSlot[i][1]
  830.                     if 0 == value:
  831.                         continue
  832.                    
  833.                     if type == 53 and i == 8:
  834.                         hasAttack = 1
  835.                         minPower = value
  836.                     elif type == 53 and i == 9:
  837.                         hasAttack = 1
  838.                         maxPower = value
  839.                     elif type == 55 and i == 10:
  840.                         hasMagicAttack = 1
  841.                         minMagicAttackPower = value
  842.                     elif type == 55 and i == 11:
  843.                         hasMagicAttack = 1
  844.                         maxMagicAttackPower = value
  845.            
  846.             if hasAttack == 1:
  847.                 self.__AppendAttackAccePowerInfo(minPower, maxPower)
  848.            
  849.             if hasMagicAttack == 1:
  850.                 self.__AppendMagicAttackAcceInfo(minMagicAttackPower, maxMagicAttackPower)
  851.            
  852.             for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  853.                 if i <= 6 or i >= 8 and i <= 11:
  854.                     continue
  855.                 else:
  856.                     type = attrSlot[i][0]
  857.                     value = attrSlot[i][1]
  858.                     if 0 == value:
  859.                         continue
  860.                    
  861.                     affectString = self.__GetAffectString(type, value)
  862.                     if affectString:
  863.                         affectColor = self.__GetAttributeColor(i, value)
  864.                         self.AppendTextLine(affectString, affectColor)
  865.            
  866.             for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  867.                 if i >= 7:
  868.                     continue
  869.                 else:
  870.                     type = attrSlot[i][0]
  871.                     value = attrSlot[i][1]
  872.                     if 0 == value:
  873.                         continue
  874.                    
  875.                     affectString = self.__GetAffectString(type, value)
  876.                     if affectString:
  877.                         affectColor = self.__GetAttributeColor(i, value)
  878.                         self.AppendTextLine(affectString, affectColor)
  879.  
  880.     def __AppendAttackAccePowerInfo(self, minPower, maxPower):
  881.         minPower_final = minPower
  882.         maxPower_final = maxPower
  883.         if maxPower > minPower:
  884.             self.AppendTextLine(localeInfo.TOOLTIP_ITEM_ATT_POWER % (minPower_final, maxPower_final), self.POSITIVE_COLOR)
  885.         else:
  886.             self.AppendTextLine(localeInfo.TOOLTIP_ITEM_ATT_POWER_ONE_ARG % (minPower_final), self.POSITIVE_COLOR)
  887.  
  888.     def __AppendMagicAttackAcceInfo(self, minMagicAttackPower, maxMagicAttackPower):
  889.         minMagicAttackPower_final = minMagicAttackPower
  890.         maxMagicAttackPower_final = maxMagicAttackPower
  891.         if minMagicAttackPower_final > 0 or maxMagicAttackPower_final > 0:
  892.             if maxMagicAttackPower_final > minMagicAttackPower_final:
  893.                 self.AppendTextLine(localeInfo.TOOLTIP_ITEM_MAGIC_ATT_POWER % (minMagicAttackPower_final, maxMagicAttackPower_final), self.POSITIVE_COLOR)
  894.             else:
  895.                 self.AppendTextLine(localeInfo.TOOLTIP_ITEM_MAGIC_ATT_POWER_ONE_ARG % (minMagicAttackPower_final), self.POSITIVE_COLOR)
  896.  
  897.     def __GetAttributeColor(self, index, value):
  898.         if value > 0:
  899.             if index >= 5 and index <= 6:
  900.                 return self.SPECIAL_POSITIVE_COLOR2
  901.             elif index >= 7:
  902.                 return self.POSITIVE_COLOR
  903.             else:
  904.                 return self.SPECIAL_POSITIVE_COLOR
  905.         elif value == 0:
  906.             return self.NORMAL_COLOR
  907.         else:
  908.             return self.NEGATIVE_COLOR
  909.  
  910.     def __IsPolymorphItem(self, itemVnum):
  911.         if itemVnum >= 70103 and itemVnum <= 70106:
  912.             return 1
  913.         return 0
  914.  
  915.     def __SetPolymorphItemTitle(self, monsterVnum):
  916.         if localeInfo.IsVIETNAM():
  917.             itemName =item.GetItemName()
  918.             itemName+=" "
  919.             itemName+=nonplayer.GetMonsterName(monsterVnum)
  920.         else:
  921.             itemName =nonplayer.GetMonsterName(monsterVnum)
  922.             itemName+=" "
  923.             itemName+=item.GetItemName()
  924.         self.SetTitle(itemName)
  925.  
  926.     def __SetNormalItemTitle(self):
  927.         if app.ENABLE_SEND_TARGET_INFO:
  928.             if self.isStone:
  929.                 itemName = item.GetItemName()
  930.                 realName = itemName[:itemName.find("+")]
  931.                 self.SetTitle(realName + " +0 - +4")
  932.             else:
  933.                 self.SetTitle(item.GetItemName())
  934.         else:
  935.             self.SetTitle(item.GetItemName())
  936.  
  937.     def __SetSpecialItemTitle(self):
  938.         self.AppendTextLine(item.GetItemName(), self.SPECIAL_TITLE_COLOR)
  939.  
  940.     def __SetItemTitle(self, itemVnum, metinSlot, attrSlot):
  941.         if localeInfo.IsCANADA():
  942.             if 72726 == itemVnum or 72730 == itemVnum:
  943.                 self.AppendTextLine(item.GetItemName(), grp.GenerateColor(1.0, 0.7843, 0.0, 1.0))
  944.                 return
  945.            
  946.         if self.__IsPolymorphItem(itemVnum):
  947.             self.__SetPolymorphItemTitle(metinSlot[0])
  948.         else:
  949.             if self.__IsAttr(attrSlot):
  950.                 self.__SetSpecialItemTitle()
  951.                 return
  952.  
  953.             self.__SetNormalItemTitle()
  954.  
  955.     def __IsAttr(self, attrSlot):
  956.         if not attrSlot:
  957.             return False
  958.  
  959.         for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  960.             type = attrSlot[i][0]
  961.             if 0 != type:
  962.                 return True
  963.  
  964.         return False
  965.    
  966.     def AddRefineItemData(self, itemVnum, metinSlot, attrSlot = 0):
  967.         for i in xrange(player.METIN_SOCKET_MAX_NUM):
  968.             metinSlotData=metinSlot[i]
  969.             if self.GetMetinItemIndex(metinSlotData) == constInfo.ERROR_METIN_STONE:
  970.                 metinSlot[i]=player.METIN_SOCKET_TYPE_SILVER
  971.  
  972.         self.AddItemData(itemVnum, metinSlot, attrSlot)
  973.  
  974.     def AddItemData_Offline(self, itemVnum, itemDesc, itemSummary, metinSlot, attrSlot):
  975.         self.__AdjustMaxWidth(attrSlot, itemDesc)
  976.         self.__SetItemTitle(itemVnum, metinSlot, attrSlot)
  977.        
  978.         if self.__IsHair(itemVnum):
  979.             self.__AppendHairIcon(itemVnum)
  980.  
  981.         ### Description ###
  982.         self.AppendDescription(itemDesc, 26)
  983.         self.AppendDescription(itemSummary, 26, self.CONDITION_COLOR)
  984.  
  985.     def check_sigillo(self, item_vnum):
  986.         for x in range(55701,55707):
  987.             if x == item_vnum:
  988.                 return TRUE
  989.         if item_vnum == 55801:
  990.             return TRUE
  991.         return FALSE
  992.        
  993.     def AddItemData(self, itemVnum, metinSlot, attrSlot = 0, flags = 0, unbindTime = 0):
  994.         self.itemVnum = itemVnum
  995.         item.SelectItem(itemVnum)
  996.         itemType = item.GetItemType()
  997.         itemSubType = item.GetItemSubType()
  998.  
  999.         if 50026 == itemVnum:
  1000.             if 0 != metinSlot:
  1001.                 name = item.GetItemName()
  1002.                 if metinSlot[0] > 0:
  1003.                     name += " "
  1004.                     name += localeInfo.NumberToMoneyString(metinSlot[0])
  1005.                 self.SetTitle(name)
  1006.  
  1007.                 self.ShowToolTip()
  1008.             return
  1009.  
  1010.         ### Skill Book ###
  1011.         if app.ENABLE_SEND_TARGET_INFO:
  1012.             if 50300 == itemVnum and not self.isBook:
  1013.                 if 0 != metinSlot and not self.isBook:
  1014.                     self.__SetSkillBookToolTip(metinSlot[0], localeInfo.TOOLTIP_SKILLBOOK_NAME, 1)
  1015.                     self.ShowToolTip()
  1016.                 elif self.isBook:
  1017.                     self.SetTitle(item.GetItemName())
  1018.                     self.AppendDescription(item.GetItemDescription(), 26)
  1019.                     self.AppendDescription(item.GetItemSummary(), 26, self.CONDITION_COLOR)
  1020.                     self.ShowToolTip()                 
  1021.                 return
  1022.             elif 70037 == itemVnum :
  1023.                 if 0 != metinSlot and not self.isBook2:
  1024.                     self.__SetSkillBookToolTip(metinSlot[0], localeInfo.TOOLTIP_SKILL_FORGET_BOOK_NAME, 0)
  1025.                     self.AppendDescription(item.GetItemDescription(), 26)
  1026.                     self.AppendDescription(item.GetItemSummary(), 26, self.CONDITION_COLOR)
  1027.                     self.ShowToolTip()
  1028.                 elif self.isBook2:
  1029.                     self.SetTitle(item.GetItemName())
  1030.                     self.AppendDescription(item.GetItemDescription(), 26)
  1031.                     self.AppendDescription(item.GetItemSummary(), 26, self.CONDITION_COLOR)
  1032.                     self.ShowToolTip()                 
  1033.                 return
  1034.             elif 70055 == itemVnum:
  1035.                 if 0 != metinSlot:
  1036.                     self.__SetSkillBookToolTip(metinSlot[0], localeInfo.TOOLTIP_SKILL_FORGET_BOOK_NAME, 0)
  1037.                     self.AppendDescription(item.GetItemDescription(), 26)
  1038.                     self.AppendDescription(item.GetItemSummary(), 26, self.CONDITION_COLOR)
  1039.                     self.ShowToolTip()
  1040.                 return
  1041.         else:
  1042.             if 50300 == itemVnum:
  1043.                 if 0 != metinSlot:
  1044.                     self.__SetSkillBookToolTip(metinSlot[0], localeInfo.TOOLTIP_SKILLBOOK_NAME, 1)
  1045.                     self.ShowToolTip()
  1046.                 return
  1047.             elif 70037 == itemVnum:
  1048.                 if 0 != metinSlot:
  1049.                     self.__SetSkillBookToolTip(metinSlot[0], localeInfo.TOOLTIP_SKILL_FORGET_BOOK_NAME, 0)
  1050.                     self.AppendDescription(item.GetItemDescription(), 26)
  1051.                     self.AppendDescription(item.GetItemSummary(), 26, self.CONDITION_COLOR)
  1052.                     self.ShowToolTip()
  1053.                 return
  1054.             elif 70055 == itemVnum:
  1055.                 if 0 != metinSlot:
  1056.                     self.__SetSkillBookToolTip(metinSlot[0], localeInfo.TOOLTIP_SKILL_FORGET_BOOK_NAME, 0)
  1057.                     self.AppendDescription(item.GetItemDescription(), 26)
  1058.                     self.AppendDescription(item.GetItemSummary(), 26, self.CONDITION_COLOR)
  1059.                     self.ShowToolTip()
  1060.                 return
  1061.         ###########################################################################################
  1062.  
  1063.  
  1064.         itemDesc = item.GetItemDescription()
  1065.         itemSummary = item.GetItemSummary()
  1066.  
  1067.         isCostumeItem = 0
  1068.         isCostumeHair = 0
  1069.         isCostumeBody = 0
  1070.         isCostumeAcce = 0
  1071.         isCostumeMount = 0
  1072.         if app.ENABLE_COSTUME_WEAPON_SYSTEM:
  1073.             isCostumeWeapon = 0
  1074.         isCostumeMount = 0
  1075.            
  1076.         if app.ENABLE_COSTUME_SYSTEM:
  1077.             if item.ITEM_TYPE_COSTUME == itemType:
  1078.                 isCostumeItem = 1
  1079.                 isCostumeHair = item.COSTUME_TYPE_HAIR == itemSubType
  1080.                 isCostumeBody = item.COSTUME_TYPE_BODY == itemSubType
  1081.                 isCostumeAcce = item.COSTUME_TYPE_ACCE == itemSubType
  1082.                 if app.ENABLE_COSTUME_WEAPON_SYSTEM:
  1083.                     isCostumeWeapon = item.COSTUME_TYPE_WEAPON == itemSubType
  1084.                 isCostumeMount = item.COSTUME_TYPE_MOUNT == itemSubType
  1085.                 #dbg.TraceError("IS_COSTUME_ITEM! body(%d) hair(%d)" % (isCostumeBody, isCostumeHair))
  1086.  
  1087.         self.__AdjustMaxWidth(attrSlot, itemDesc)
  1088.         self.__SetItemTitle(itemVnum, metinSlot, attrSlot)
  1089.        
  1090.         ### Hair Preview Image ###
  1091.         if self.__IsHair(itemVnum):
  1092.             self.__AppendHairIcon(itemVnum)
  1093.  
  1094.         ### Description ###
  1095.         self.AppendDescription(itemDesc, 26)
  1096.         self.AppendDescription(itemSummary, 26, self.CONDITION_COLOR)
  1097.        
  1098.         if self.check_sigillo(itemVnum) or itemVnum == 55002:
  1099.             if attrSlot[0][1] != 0:
  1100.                 self.AppendSpace(5)
  1101.                 self.AppendTextLine("Niveau : "+str(metinSlot[1]), self.NORMAL_COLOR)
  1102.                 self.AppendTextLine("PV : +"+pointop(str(attrSlot[0][1]))+"%", self.SPECIAL_POSITIVE_COLOR)
  1103.                 self.AppendTextLine("DEF : +"+pointop(str(attrSlot[1][1]))+"%", self.SPECIAL_POSITIVE_COLOR)
  1104.                 self.AppendTextLine("PM : +"+pointop(str(attrSlot[2][1]))+"%", self.SPECIAL_POSITIVE_COLOR)
  1105.                 self.AppendSpace(5)
  1106.                 if itemVnum != 55002:
  1107.                     days = (int(attrSlot[3][1])/60)/24
  1108.                     hours = (int(attrSlot[3][1]) - (days*60*24)) / 60
  1109.                     mins = int(attrSlot[3][1]) - (days*60*24) - (hours*60)
  1110.                     self.AppendTextLine("Temps restant : %d Jours %d Heures %d Minutes" % (days, hours, mins), self.SPECIAL_POSITIVE_COLOR)
  1111.                
  1112.  
  1113.         ### Weapon ###
  1114.         if item.ITEM_TYPE_WEAPON == itemType:
  1115.             self.__AppendLimitInformation()
  1116.             self.AppendSpace(5)
  1117.             if item.WEAPON_FAN == itemSubType:
  1118.                 self.__AppendMagicAttackInfo()
  1119.                 self.__AppendAttackPowerInfo()
  1120.             else:
  1121.                 self.__AppendAttackPowerInfo()
  1122.                 self.__AppendMagicAttackInfo()
  1123.            
  1124.             self.__AppendAffectInformation()
  1125.             self.__AppendAttributeInformation(attrSlot)
  1126.            
  1127.             self.AppendWearableInformation()
  1128.             if itemSubType != item.WEAPON_ARROW:
  1129.                 self.__AppendMetinSlotInfo(metinSlot)
  1130.             else:
  1131.                 bHasRealtimeFlag = 0
  1132.                 for i in xrange(item.LIMIT_MAX_NUM):
  1133.                     (limitType, limitValue) = item.GetLimit(i)
  1134.                     if item.LIMIT_REAL_TIME == limitType:
  1135.                         bHasRealtimeFlag = 1
  1136.                
  1137.                 if bHasRealtimeFlag == 1:
  1138.                     self.AppendMallItemLastTime(metinSlot[0])
  1139.  
  1140.         ### Armor ###
  1141.         elif item.ITEM_TYPE_ARMOR == itemType:
  1142.             self.__AppendLimitInformation()
  1143.  
  1144.             ## 방어력
  1145.             defGrade = item.GetValue(1)
  1146.             defBonus = item.GetValue(5)*2 ## 방어력 표시 잘못 되는 문제를 수정
  1147.             if defGrade > 0:
  1148.                 self.AppendSpace(5)
  1149.                 self.AppendTextLine(localeInfo.TOOLTIP_ITEM_DEF_GRADE % (defGrade+defBonus), self.GetChangeTextLineColor(defGrade))
  1150.  
  1151.             self.__AppendMagicDefenceInfo()
  1152.             self.__AppendAffectInformation()
  1153.             self.__AppendAttributeInformation(attrSlot)
  1154.  
  1155.             self.AppendWearableInformation()
  1156.  
  1157.             if itemSubType in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):             
  1158.                 self.__AppendAccessoryMetinSlotInfo(metinSlot, constInfo.GET_ACCESSORY_MATERIAL_VNUM(itemVnum, itemSubType))
  1159.             else:
  1160.                 self.__AppendMetinSlotInfo(metinSlot)
  1161.  
  1162.         ### Ring Slot Item (Not UNIQUE) ###
  1163.         elif item.ITEM_TYPE_RING == itemType:
  1164.             self.__AppendLimitInformation()
  1165.             self.__AppendAffectInformation()
  1166.             self.__AppendAttributeInformation(attrSlot)
  1167.  
  1168.             #반지 소켓 시스템 관련해선 아직 기획 미정
  1169.             #self.__AppendAccessoryMetinSlotInfo(metinSlot, 99001)
  1170.            
  1171.  
  1172.         ### Belt Item ###
  1173.         elif item.ITEM_TYPE_BELT == itemType:
  1174.             self.__AppendLimitInformation()
  1175.             self.__AppendAffectInformation()
  1176.             self.__AppendAttributeInformation(attrSlot)
  1177.  
  1178.             self.__AppendAccessoryMetinSlotInfo(metinSlot, constInfo.GET_BELT_MATERIAL_VNUM(itemVnum))
  1179.  
  1180.         ## 코스츔 아이템 ##
  1181.         elif 0 != isCostumeItem:
  1182.             self.__AppendLimitInformation()
  1183.             self.__AppendAffectInformation()
  1184.             if isCostumeAcce != 0:
  1185.                 self.__AppendAcceAttributeInformation(attrSlot)
  1186.             else:
  1187.                 self.__AppendAttributeInformation(attrSlot)
  1188.            
  1189.             self.AppendWearableInformation()
  1190.             bHasRealtimeFlag = 0
  1191.             for i in xrange(item.LIMIT_MAX_NUM):
  1192.                 (limitType, limitValue) = item.GetLimit(i)
  1193.                 if item.LIMIT_REAL_TIME == limitType:
  1194.                     bHasRealtimeFlag = 1
  1195.            
  1196.             if 1 == bHasRealtimeFlag:
  1197.                 self.AppendMallItemLastTime(metinSlot[0])
  1198.            
  1199.             if isCostumeAcce != 0:
  1200.                 if metinSlot != 0:
  1201.                     absChance = int(metinSlot[1])
  1202.                     if absChance > 0:
  1203.                         self.AppendSpace(5)
  1204.                         self.AppendTextLine(localeInfo.ACCE_ABSORB_CHANCE % (absChance), self.CONDITION_COLOR)
  1205.              
  1206.                
  1207.         ## Rod ##
  1208.         elif item.ITEM_TYPE_ROD == itemType:
  1209.  
  1210.             if 0 != metinSlot:
  1211.                 curLevel = item.GetValue(0) / 10
  1212.                 curEXP = metinSlot[0]
  1213.                 maxEXP = item.GetValue(2)
  1214.                 self.__AppendLimitInformation()
  1215.                 self.__AppendRodInformation(curLevel, curEXP, maxEXP)
  1216.  
  1217.         ## Pick ##
  1218.         elif item.ITEM_TYPE_PICK == itemType:
  1219.  
  1220.             if 0 != metinSlot:
  1221.                 curLevel = item.GetValue(0) / 10
  1222.                 curEXP = metinSlot[0]
  1223.                 maxEXP = item.GetValue(2)
  1224.                 self.__AppendLimitInformation()
  1225.                 self.__AppendPickInformation(curLevel, curEXP, maxEXP)
  1226.  
  1227.         ## Lottery ##
  1228.         elif item.ITEM_TYPE_LOTTERY == itemType:
  1229.             if 0 != metinSlot:
  1230.  
  1231.                 ticketNumber = int(metinSlot[0])
  1232.                 stepNumber = int(metinSlot[1])
  1233.  
  1234.                 self.AppendSpace(5)
  1235.                 self.AppendTextLine(localeInfo.TOOLTIP_LOTTERY_STEP_NUMBER % (stepNumber), self.NORMAL_COLOR)
  1236.                 self.AppendTextLine(localeInfo.TOOLTIP_LOTTO_NUMBER % (ticketNumber), self.NORMAL_COLOR);
  1237.  
  1238.         ### Metin ###
  1239.         elif item.ITEM_TYPE_METIN == itemType:
  1240.             self.AppendMetinInformation()
  1241.             self.AppendMetinWearInformation()
  1242.  
  1243.         ### Fish ###
  1244.         elif item.ITEM_TYPE_FISH == itemType:
  1245.             if 0 != metinSlot:
  1246.                 self.__AppendFishInfo(metinSlot[0])
  1247.        
  1248.         ## item.ITEM_TYPE_BLEND
  1249.         elif item.ITEM_TYPE_BLEND == itemType:
  1250.             self.__AppendLimitInformation()
  1251.  
  1252.             if metinSlot:
  1253.                 affectType = metinSlot[0]
  1254.                 affectValue = metinSlot[1]
  1255.                 time = metinSlot[2]
  1256.                 self.AppendSpace(5)
  1257.                 affectText = self.__GetAffectString(affectType, affectValue)
  1258.  
  1259.                 self.AppendTextLine(affectText, self.NORMAL_COLOR)
  1260.  
  1261.                 if time > 0:
  1262.                     minute = (time / 60)
  1263.                     second = (time % 60)
  1264.                     timeString = localeInfo.TOOLTIP_POTION_TIME
  1265.  
  1266.                     if minute > 0:
  1267.                         timeString += str(minute) + localeInfo.TOOLTIP_POTION_MIN
  1268.                     if second > 0:
  1269.                         timeString += " " + str(second) + localeInfo.TOOLTIP_POTION_SEC
  1270.  
  1271.                     self.AppendTextLine(timeString)
  1272.                 else:
  1273.                     self.AppendTextLine(localeInfo.BLEND_POTION_NO_TIME)
  1274.             else:
  1275.                 self.AppendTextLine("BLEND_POTION_NO_INFO")
  1276.  
  1277.         elif item.ITEM_TYPE_UNIQUE == itemType:
  1278.             if 0 != metinSlot:
  1279.                 bHasRealtimeFlag = 0
  1280.                
  1281.                 for i in xrange(item.LIMIT_MAX_NUM):
  1282.                     (limitType, limitValue) = item.GetLimit(i)
  1283.  
  1284.                     if item.LIMIT_REAL_TIME == limitType:
  1285.                         bHasRealtimeFlag = 1
  1286.                
  1287.                 if 1 == bHasRealtimeFlag:
  1288.                     self.AppendMallItemLastTime(metinSlot[0])      
  1289.                 else:
  1290.                     time = metinSlot[player.METIN_SOCKET_MAX_NUM-1]
  1291.  
  1292.                     if 1 == item.GetValue(2): ## 실시간 이용 Flag / 장착 안해도 준다
  1293.                         self.AppendMallItemLastTime(time)
  1294.                     else:
  1295.                         self.AppendUniqueItemLastTime(time)
  1296.  
  1297.         ### Use ###
  1298.         elif item.ITEM_TYPE_USE == itemType:
  1299.             self.__AppendLimitInformation()
  1300.  
  1301.             if item.USE_POTION == itemSubType or item.USE_POTION_NODELAY == itemSubType:
  1302.                 self.__AppendPotionInformation()
  1303.  
  1304.             elif item.USE_ABILITY_UP == itemSubType:
  1305.                 self.__AppendAbilityPotionInformation()
  1306.  
  1307.  
  1308.             ## 영석 감지기
  1309.             if 27989 == itemVnum or 76006 == itemVnum:
  1310.                 if 0 != metinSlot:
  1311.                     useCount = int(metinSlot[0])
  1312.  
  1313.                     self.AppendSpace(5)
  1314.                     self.AppendTextLine(localeInfo.TOOLTIP_REST_USABLE_COUNT % (6 - useCount), self.NORMAL_COLOR)
  1315.  
  1316.             ## 이벤트 감지기
  1317.             elif 50004 == itemVnum:
  1318.                 if 0 != metinSlot:
  1319.                     useCount = int(metinSlot[0])
  1320.  
  1321.                     self.AppendSpace(5)
  1322.                     self.AppendTextLine(localeInfo.TOOLTIP_REST_USABLE_COUNT % (10 - useCount), self.NORMAL_COLOR)
  1323.  
  1324.             ## 자동물약
  1325.             elif constInfo.IS_AUTO_POTION(itemVnum):
  1326.                 if 0 != metinSlot:
  1327.                     ## 0: 활성화, 1: 사용량, 2: 총량
  1328.                     isActivated = int(metinSlot[0])
  1329.                     usedAmount = float(metinSlot[1])
  1330.                     totalAmount = float(metinSlot[2])
  1331.                    
  1332.                     if 0 == totalAmount:
  1333.                         totalAmount = 1
  1334.                    
  1335.                     self.AppendSpace(5)
  1336.  
  1337.                     if 0 != isActivated:
  1338.                         self.AppendTextLine("(%s)" % (localeInfo.TOOLTIP_AUTO_POTION_USING), self.SPECIAL_POSITIVE_COLOR)
  1339.                         self.AppendSpace(5)
  1340.                        
  1341.                     self.AppendTextLine(localeInfo.TOOLTIP_AUTO_POTION_REST % (100.0 - ((usedAmount / totalAmount) * 100.0)), self.POSITIVE_COLOR)
  1342.                                
  1343.             ## 귀환 기억부
  1344.             elif itemVnum in WARP_SCROLLS:
  1345.                 if 0 != metinSlot:
  1346.                     xPos = int(metinSlot[0])
  1347.                     yPos = int(metinSlot[1])
  1348.  
  1349.                     if xPos != 0 and yPos != 0:
  1350.                         (mapName, xBase, yBase) = background.GlobalPositionToMapInfo(xPos, yPos)
  1351.                        
  1352.                         localeMapName=localeInfo.MINIMAP_ZONE_NAME_DICT.get(mapName, "")
  1353.  
  1354.                         self.AppendSpace(5)
  1355.  
  1356.                         if localeMapName!="":                      
  1357.                             self.AppendTextLine(localeInfo.TOOLTIP_MEMORIZED_POSITION % (localeMapName, int(xPos-xBase)/100, int(yPos-yBase)/100), self.NORMAL_COLOR)
  1358.                         else:
  1359.                             self.AppendTextLine(localeInfo.TOOLTIP_MEMORIZED_POSITION_ERROR % (int(xPos)/100, int(yPos)/100), self.NORMAL_COLOR)
  1360.                             dbg.TraceError("NOT_EXIST_IN_MINIMAP_ZONE_NAME_DICT: %s" % mapName)
  1361.  
  1362.             #####
  1363.             if item.USE_SPECIAL == itemSubType:
  1364.                 bHasRealtimeFlag = 0
  1365.                 for i in xrange(item.LIMIT_MAX_NUM):
  1366.                     (limitType, limitValue) = item.GetLimit(i)
  1367.  
  1368.                     if item.LIMIT_REAL_TIME == limitType:
  1369.                         bHasRealtimeFlag = 1
  1370.        
  1371.                 ## 있다면 관련 정보를 표시함. ex) 남은 시간 : 6일 6시간 58분
  1372.                 if 1 == bHasRealtimeFlag:
  1373.                     self.AppendMallItemLastTime(metinSlot[0])
  1374.                 else:
  1375.                     # ... 이거... 서버에는 이런 시간 체크 안되어 있는데...
  1376.                     # 왜 이런게 있는지 알지는 못하나 그냥 두자...
  1377.                     if 0 != metinSlot:
  1378.                         time = metinSlot[player.METIN_SOCKET_MAX_NUM-1]
  1379.  
  1380.                         ## 실시간 이용 Flag
  1381.                         if 1 == item.GetValue(2):
  1382.                             self.AppendMallItemLastTime(time)
  1383.            
  1384.             elif item.USE_TIME_CHARGE_PER == itemSubType:
  1385.                 bHasRealtimeFlag = 0
  1386.                 for i in xrange(item.LIMIT_MAX_NUM):
  1387.                     (limitType, limitValue) = item.GetLimit(i)
  1388.  
  1389.                     if item.LIMIT_REAL_TIME == limitType:
  1390.                         bHasRealtimeFlag = 1
  1391.                 if metinSlot[2]:
  1392.                     self.AppendTextLine(localeInfo.TOOLTIP_TIME_CHARGER_PER(metinSlot[2]))
  1393.                 else:
  1394.                     self.AppendTextLine(localeInfo.TOOLTIP_TIME_CHARGER_PER(item.GetValue(0)))
  1395.        
  1396.                 ## 있다면 관련 정보를 표시함. ex) 남은 시간 : 6일 6시간 58분
  1397.                 if 1 == bHasRealtimeFlag:
  1398.                     self.AppendMallItemLastTime(metinSlot[0])
  1399.  
  1400.             elif item.USE_TIME_CHARGE_FIX == itemSubType:
  1401.                 bHasRealtimeFlag = 0
  1402.                 for i in xrange(item.LIMIT_MAX_NUM):
  1403.                     (limitType, limitValue) = item.GetLimit(i)
  1404.  
  1405.                     if item.LIMIT_REAL_TIME == limitType:
  1406.                         bHasRealtimeFlag = 1
  1407.                 if metinSlot[2]:
  1408.                     self.AppendTextLine(localeInfo.TOOLTIP_TIME_CHARGER_FIX(metinSlot[2]))
  1409.                 else:
  1410.                     self.AppendTextLine(localeInfo.TOOLTIP_TIME_CHARGER_FIX(item.GetValue(0)))
  1411.        
  1412.                 ## 있다면 관련 정보를 표시함. ex) 남은 시간 : 6일 6시간 58분
  1413.                 if 1 == bHasRealtimeFlag:
  1414.                     self.AppendMallItemLastTime(metinSlot[0])
  1415.  
  1416.         elif item.ITEM_TYPE_QUEST == itemType:
  1417.             for i in xrange(item.LIMIT_MAX_NUM):
  1418.                 (limitType, limitValue) = item.GetLimit(i)
  1419.  
  1420.                 if item.LIMIT_REAL_TIME == limitType:
  1421.                     self.AppendMallItemLastTime(metinSlot[0])
  1422.         elif item.ITEM_TYPE_DS == itemType:
  1423.             self.AppendTextLine(self.__DragonSoulInfoString(itemVnum))
  1424.             self.__AppendAttributeInformation(attrSlot)
  1425.         else:
  1426.             self.__AppendLimitInformation()
  1427.  
  1428.         for i in xrange(item.LIMIT_MAX_NUM):
  1429.             (limitType, limitValue) = item.GetLimit(i)
  1430.             #dbg.TraceError("LimitType : %d, limitValue : %d" % (limitType, limitValue))
  1431.            
  1432.             if item.LIMIT_REAL_TIME_START_FIRST_USE == limitType:
  1433.                 self.AppendRealTimeStartFirstUseLastTime(item, metinSlot, i)
  1434.                 #dbg.TraceError("2) REAL_TIME_START_FIRST_USE flag On ")
  1435.                
  1436.             elif item.LIMIT_TIMER_BASED_ON_WEAR == limitType:
  1437.                 self.AppendTimerBasedOnWearLastTime(metinSlot)
  1438.                 #dbg.TraceError("1) REAL_TIME flag On ")
  1439.  
  1440.  
  1441.                
  1442.         self.ShowToolTip()
  1443.  
  1444.     def __DragonSoulInfoString (self, dwVnum):
  1445.         step = (dwVnum / 100) % 10
  1446.         refine = (dwVnum / 10) % 10
  1447.         if 0 == step:
  1448.             return localeInfo.DRAGON_SOUL_STEP_LEVEL1 + " " + localeInfo.DRAGON_SOUL_STRENGTH(refine)
  1449.         elif 1 == step:
  1450.             return localeInfo.DRAGON_SOUL_STEP_LEVEL2 + " " + localeInfo.DRAGON_SOUL_STRENGTH(refine)
  1451.         elif 2 == step:
  1452.             return localeInfo.DRAGON_SOUL_STEP_LEVEL3 + " " + localeInfo.DRAGON_SOUL_STRENGTH(refine)
  1453.         elif 3 == step:
  1454.             return localeInfo.DRAGON_SOUL_STEP_LEVEL4 + " " + localeInfo.DRAGON_SOUL_STRENGTH(refine)
  1455.         elif 4 == step:
  1456.             return localeInfo.DRAGON_SOUL_STEP_LEVEL5 + " " + localeInfo.DRAGON_SOUL_STRENGTH(refine)
  1457.         else:
  1458.             return ""
  1459.  
  1460.  
  1461.     ## 헤어인가?
  1462.     def __IsHair(self, itemVnum):
  1463.         return (self.__IsOldHair(itemVnum) or
  1464.             self.__IsNewHair(itemVnum) or
  1465.             self.__IsNewHair2(itemVnum) or
  1466.             self.__IsNewHair3(itemVnum) or
  1467.             self.__IsCostumeHair(itemVnum)
  1468.             )
  1469.  
  1470.     def __IsOldHair(self, itemVnum):
  1471.         return itemVnum > 73000 and itemVnum < 74000   
  1472.  
  1473.     def __IsNewHair(self, itemVnum):
  1474.         return itemVnum > 74000 and itemVnum < 75000   
  1475.  
  1476.     def __IsNewHair2(self, itemVnum):
  1477.         return itemVnum > 75000 and itemVnum < 76000   
  1478.  
  1479.     def __IsNewHair3(self, itemVnum):
  1480.         return ((74012 < itemVnum and itemVnum < 74022) or
  1481.             (74262 < itemVnum and itemVnum < 74272) or
  1482.             (74512 < itemVnum and itemVnum < 74522) or
  1483.             (74762 < itemVnum and itemVnum < 74772) or
  1484.             (45000 < itemVnum and itemVnum < 47000))
  1485.  
  1486.     def __IsCostumeHair(self, itemVnum):
  1487.         return app.ENABLE_COSTUME_SYSTEM and self.__IsNewHair3(itemVnum - 100000)
  1488.        
  1489.     def __AppendHairIcon(self, itemVnum):
  1490.         itemImage = ui.ImageBox()
  1491.         itemImage.SetParent(self)
  1492.         itemImage.Show()           
  1493.  
  1494.         if self.__IsOldHair(itemVnum):
  1495.             itemImage.LoadImage("d:/ymir work/item/quest/"+str(itemVnum)+".tga")
  1496.         elif self.__IsNewHair3(itemVnum):
  1497.             itemImage.LoadImage("icon/hair/%d.sub" % (itemVnum))
  1498.         elif self.__IsNewHair(itemVnum): # 기존 헤어 번호를 연결시켜서 사용한다. 새로운 아이템은 1000만큼 번호가 늘었다.
  1499.             itemImage.LoadImage("d:/ymir work/item/quest/"+str(itemVnum-1000)+".tga")
  1500.         elif self.__IsNewHair2(itemVnum):
  1501.             itemImage.LoadImage("icon/hair/%d.sub" % (itemVnum))
  1502.         elif self.__IsCostumeHair(itemVnum):
  1503.             itemImage.LoadImage("icon/hair/%d.sub" % (itemVnum - 100000))
  1504.  
  1505.         itemImage.SetPosition(itemImage.GetWidth()/2, self.toolTipHeight)
  1506.         self.toolTipHeight += itemImage.GetHeight()
  1507.         #self.toolTipWidth += itemImage.GetWidth()/2
  1508.         self.childrenList.append(itemImage)
  1509.         self.ResizeToolTip()
  1510.  
  1511.     ## 사이즈가 큰 Description 일 경우 툴팁 사이즈를 조정한다
  1512.     def __AdjustMaxWidth(self, attrSlot, desc):
  1513.         newToolTipWidth = self.toolTipWidth
  1514.         newToolTipWidth = max(self.__AdjustAttrMaxWidth(attrSlot), newToolTipWidth)
  1515.         newToolTipWidth = max(self.__AdjustDescMaxWidth(desc), newToolTipWidth)
  1516.         if newToolTipWidth > self.toolTipWidth:
  1517.             self.toolTipWidth = newToolTipWidth
  1518.             self.ResizeToolTip()
  1519.  
  1520.     def __AdjustAttrMaxWidth(self, attrSlot):
  1521.         if 0 == attrSlot:
  1522.             return self.toolTipWidth
  1523.  
  1524.         maxWidth = self.toolTipWidth
  1525.         for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  1526.             type = attrSlot[i][0]
  1527.             value = attrSlot[i][1]
  1528.             if self.ATTRIBUTE_NEED_WIDTH.has_key(type):
  1529.                 if value > 0:
  1530.                     maxWidth = max(self.ATTRIBUTE_NEED_WIDTH[type], maxWidth)
  1531.  
  1532.                     # ATTR_CHANGE_TOOLTIP_WIDTH
  1533.                     #self.toolTipWidth = max(self.ATTRIBUTE_NEED_WIDTH[type], self.toolTipWidth)
  1534.                     #self.ResizeToolTip()
  1535.                     # END_OF_ATTR_CHANGE_TOOLTIP_WIDTH
  1536.  
  1537.         return maxWidth
  1538.  
  1539.     def __AdjustDescMaxWidth(self, desc):
  1540.         if len(desc) < DESC_DEFAULT_MAX_COLS:
  1541.             return self.toolTipWidth
  1542.    
  1543.         return DESC_WESTERN_MAX_WIDTH
  1544.  
  1545.     def __SetSkillBookToolTip(self, skillIndex, bookName, skillGrade):
  1546.         skillName = skill.GetSkillName(skillIndex)
  1547.  
  1548.         if not skillName:
  1549.             return
  1550.  
  1551.         if localeInfo.IsVIETNAM():
  1552.             itemName = bookName + " " + skillName
  1553.         else:
  1554.             itemName = skillName + " " + bookName
  1555.         self.SetTitle(itemName)
  1556.  
  1557.     def __AppendPickInformation(self, curLevel, curEXP, maxEXP):
  1558.         self.AppendSpace(5)
  1559.         self.AppendTextLine(localeInfo.TOOLTIP_PICK_LEVEL % (curLevel), self.NORMAL_COLOR)
  1560.         self.AppendTextLine(localeInfo.TOOLTIP_PICK_EXP % (curEXP, maxEXP), self.NORMAL_COLOR)
  1561.  
  1562.         if curEXP == maxEXP:
  1563.             self.AppendSpace(5)
  1564.             self.AppendTextLine(localeInfo.TOOLTIP_PICK_UPGRADE1, self.NORMAL_COLOR)
  1565.             self.AppendTextLine(localeInfo.TOOLTIP_PICK_UPGRADE2, self.NORMAL_COLOR)
  1566.             self.AppendTextLine(localeInfo.TOOLTIP_PICK_UPGRADE3, self.NORMAL_COLOR)
  1567.  
  1568.  
  1569.     def __AppendRodInformation(self, curLevel, curEXP, maxEXP):
  1570.         self.AppendSpace(5)
  1571.         self.AppendTextLine(localeInfo.TOOLTIP_FISHINGROD_LEVEL % (curLevel), self.NORMAL_COLOR)
  1572.         self.AppendTextLine(localeInfo.TOOLTIP_FISHINGROD_EXP % (curEXP, maxEXP), self.NORMAL_COLOR)
  1573.  
  1574.         if curEXP == maxEXP:
  1575.             self.AppendSpace(5)
  1576.             self.AppendTextLine(localeInfo.TOOLTIP_FISHINGROD_UPGRADE1, self.NORMAL_COLOR)
  1577.             self.AppendTextLine(localeInfo.TOOLTIP_FISHINGROD_UPGRADE2, self.NORMAL_COLOR)
  1578.             self.AppendTextLine(localeInfo.TOOLTIP_FISHINGROD_UPGRADE3, self.NORMAL_COLOR)
  1579.  
  1580.     def __AppendLimitInformation(self):
  1581.  
  1582.         appendSpace = False
  1583.  
  1584.         for i in xrange(item.LIMIT_MAX_NUM):
  1585.  
  1586.             (limitType, limitValue) = item.GetLimit(i)
  1587.  
  1588.             if limitValue > 0:
  1589.                 if False == appendSpace:
  1590.                     self.AppendSpace(5)
  1591.                     appendSpace = True
  1592.  
  1593.             else:
  1594.                 continue
  1595.  
  1596.             if item.LIMIT_LEVEL == limitType:
  1597.                 color = self.GetLimitTextLineColor(player.GetStatus(player.LEVEL), limitValue)
  1598.                 self.AppendTextLine(localeInfo.TOOLTIP_ITEM_LIMIT_LEVEL % (limitValue), color)
  1599.             """
  1600.             elif item.LIMIT_STR == limitType:
  1601.                 color = self.GetLimitTextLineColor(player.GetStatus(player.ST), limitValue)
  1602.                 self.AppendTextLine(localeInfo.TOOLTIP_ITEM_LIMIT_STR % (limitValue), color)
  1603.             elif item.LIMIT_DEX == limitType:
  1604.                 color = self.GetLimitTextLineColor(player.GetStatus(player.DX), limitValue)
  1605.                 self.AppendTextLine(localeInfo.TOOLTIP_ITEM_LIMIT_DEX % (limitValue), color)
  1606.             elif item.LIMIT_INT == limitType:
  1607.                 color = self.GetLimitTextLineColor(player.GetStatus(player.IQ), limitValue)
  1608.                 self.AppendTextLine(localeInfo.TOOLTIP_ITEM_LIMIT_INT % (limitValue), color)
  1609.             elif item.LIMIT_CON == limitType:
  1610.                 color = self.GetLimitTextLineColor(player.GetStatus(player.HT), limitValue)
  1611.                 self.AppendTextLine(localeInfo.TOOLTIP_ITEM_LIMIT_CON % (limitValue), color)
  1612.             """
  1613.  
  1614.  
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.     def __GetAffectString(self, affectType, affectValue):
  1626.         if 0 == affectType:
  1627.             return None
  1628.  
  1629.         if 0 == affectValue:
  1630.             return None
  1631.  
  1632.         try:
  1633.             return self.AFFECT_DICT[affectType](affectValue)
  1634.         except TypeError:
  1635.             return "UNKNOWN_VALUE[%s] %s" % (affectType, affectValue)
  1636.         except KeyError:
  1637.             return "UNKNOWN_TYPE[%s] %s" % (affectType, affectValue)
  1638.  
  1639.     if app.ENABLE_SOULBIND_SYSTEM:
  1640.         def __AppendSealInformation(self, window_type, slotIndex):
  1641.             if window_type == player.SAFEBOX:
  1642.                 itemSoulTime = safebox.GetItemBind(slotIndex)
  1643.             elif window_type == player.MALL:
  1644.                 itemSoulTime = safebox.GetMallItemBind(slotIndex)
  1645.             elif window_type == player.INVENTORY:
  1646.                 itemSoulTime = player.GetItemBind(window_type, slotIndex)
  1647.             else:
  1648.                 return
  1649.            
  1650.             if itemSoulTime == 0:
  1651.                 return
  1652.             elif itemSoulTime == 1:
  1653.                 self.AppendSpace(5)
  1654.                 self.AppendTextLine(localeInfo.TOOLTIP_SEALED, self.NEGATIVE_COLOR)
  1655.             elif itemSoulTime > 1:
  1656.                 self.AppendSpace(5)
  1657.                 hrs = itemSoulTime / 3600
  1658.                 itemSoulTime -= 3600 * hrs
  1659.                 mins = itemSoulTime / 60
  1660.                 itemSoulTime -= 60 * mins
  1661.                 self.AppendTextLine(localeInfo.TOOLTIP_UNSEAL_LEFT_TIME % (hrs, mins), self.NEGATIVE_COLOR)
  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