Advertisement
MrKarpiuk

Untitled

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