MrP0wers

uitooltip.py

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