Advertisement
Guest User

Untitled

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