Advertisement
Guest User

tag

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