Advertisement
Guest User

Untitled

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