Guest User

uitooltip.py

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