Advertisement
Guest User

Untitled

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