Advertisement
Guest User

Untitled

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