MrP0wers

uitooltip.py

Dec 8th, 2025
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 82.93 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 >= 72726 and itemVnum <= 72730:
  1352. self.AppendSpace(5)
  1353. self.AppendTextLine(localeInfo.ITEM_PERMANENT2, self.POSITIVE_COLOR)
  1354. self.AppendTextLine(localeInfo.ITEM_PERMANENT, self.POSITIVE_COLOR)
  1355. self.AppendSpace(3)
  1356. self.AppendTextLine(localeInfo.ITEM_PERMANENT_ANTISPAM, self.NEGATIVE_COLOR)
  1357.  
  1358. if item.USE_SPECIAL == itemSubType:
  1359. bHasRealtimeFlag = 0
  1360.  
  1361. for i in xrange(item.LIMIT_MAX_NUM):
  1362. (limitType, limitValue) = item.GetLimit(i)
  1363.  
  1364. if item.LIMIT_REAL_TIME == limitType:
  1365. bHasRealtimeFlag = 1
  1366.  
  1367. if 1 == bHasRealtimeFlag:
  1368. self.AppendMallItemLastTime(metinSlot[0])
  1369.  
  1370. else:
  1371. if 0 != metinSlot:
  1372. time = metinSlot[player.METIN_SOCKET_MAX_NUM-1]
  1373.  
  1374. if 1 == item.GetValue(2):
  1375. self.AppendMallItemLastTime(time)
  1376.  
  1377. elif item.USE_TIME_CHARGE_PER == itemSubType:
  1378. bHasRealtimeFlag = 0
  1379.  
  1380. for i in xrange(item.LIMIT_MAX_NUM):
  1381. (limitType, limitValue) = item.GetLimit(i)
  1382.  
  1383. if item.LIMIT_REAL_TIME == limitType:
  1384. bHasRealtimeFlag = 1
  1385.  
  1386. if metinSlot[2]:
  1387. self.AppendTextLine(localeInfo.TOOLTIP_TIME_CHARGER_PER(metinSlot[2]))
  1388. else:
  1389. self.AppendTextLine(localeInfo.TOOLTIP_TIME_CHARGER_PER(item.GetValue(0)))
  1390.  
  1391. if 1 == bHasRealtimeFlag:
  1392. self.AppendMallItemLastTime(metinSlot[0])
  1393.  
  1394. elif item.USE_TIME_CHARGE_FIX == itemSubType:
  1395. bHasRealtimeFlag = 0
  1396.  
  1397. for i in xrange(item.LIMIT_MAX_NUM):
  1398. (limitType, limitValue) = item.GetLimit(i)
  1399.  
  1400. if item.LIMIT_REAL_TIME == limitType:
  1401. bHasRealtimeFlag = 1
  1402.  
  1403. if metinSlot[2]:
  1404. self.AppendTextLine(localeInfo.TOOLTIP_TIME_CHARGER_FIX(metinSlot[2]))
  1405. else:
  1406. self.AppendTextLine(localeInfo.TOOLTIP_TIME_CHARGER_FIX(item.GetValue(0)))
  1407.  
  1408. if 1 == bHasRealtimeFlag:
  1409. self.AppendMallItemLastTime(metinSlot[0])
  1410.  
  1411. elif item.ITEM_TYPE_QUEST == itemType:
  1412. for i in xrange(item.LIMIT_MAX_NUM):
  1413. (limitType, limitValue) = item.GetLimit(i)
  1414.  
  1415. if item.LIMIT_REAL_TIME == limitType:
  1416. self.AppendMallItemLastTime(metinSlot[0])
  1417.  
  1418. elif item.ITEM_TYPE_PET == itemType:
  1419. for i in xrange(item.LIMIT_MAX_NUM):
  1420. (limitType, limitValue) = item.GetLimit(i)
  1421.  
  1422. if item.LIMIT_REAL_TIME == limitType:
  1423. self.AppendMallItemLastTime(metinSlot[0])
  1424.  
  1425. self.AppendSpace(5)
  1426.  
  1427. for g in xrange(item.ITEM_APPLY_MAX_NUM):
  1428. (affectType, affectValue) = item.GetAffect(g)
  1429. affectString = self.__GetAffectString(affectType, affectValue)
  1430.  
  1431. if affectString:
  1432. affectColor = self.GetChangeTextLineColor(affectValue)
  1433. self.AppendTextLine(affectString, affectColor)
  1434.  
  1435. elif item.ITEM_TYPE_DS == itemType:
  1436. self.AppendTextLine(self.__DragonSoulInfoString(itemVnum))
  1437. self.__AppendAttributeInformation(attrSlot)
  1438.  
  1439. else:
  1440. self.__AppendLimitInformation()
  1441.  
  1442. for i in xrange(item.LIMIT_MAX_NUM):
  1443. (limitType, limitValue) = item.GetLimit(i)
  1444.  
  1445. if item.LIMIT_REAL_TIME_START_FIRST_USE == limitType:
  1446. self.AppendRealTimeStartFirstUseLastTime(item, metinSlot, i)
  1447.  
  1448. elif item.LIMIT_TIMER_BASED_ON_WEAR == limitType:
  1449. self.AppendTimerBasedOnWearLastTime(metinSlot)
  1450.  
  1451. self.__work(itemVnum)
  1452.  
  1453. if chr.IsGameMaster(player.GetMainCharacterIndex()):
  1454. self.AppendSpace(5)
  1455. self.AppendTextLine("(GM) ID VNUM : {}".format(itemVnum), self.COLOR_VNUM )
  1456.  
  1457. self.AppendSpace(3)
  1458. self.AppendTextLine("(GM) ID TYPE : {} SUBTYPE {}".format(itemType, itemSubType), self.COLOR_VNUM )
  1459.  
  1460. if metinSlot:
  1461. self.AppendSpace(3)
  1462. self.AppendTextLine("(GM) ID SOCKET : {}".format(','.join([str(i) for i in metinSlot])), self.COLOR_VNUM )
  1463.  
  1464. self.AppendTextLine("(GM) ID VALUE : {}".format(", ".join([str(item.GetValue(i)) for i in range(6)])), self.COLOR_VNUM )
  1465.  
  1466. self.ShowToolTip()
  1467.  
  1468. def __DragonSoulInfoString (self, dwVnum):
  1469. step = (dwVnum / 100) % 10
  1470. refine = (dwVnum / 10) % 10
  1471.  
  1472. if 0 == step:
  1473. return localeInfo.DRAGON_SOUL_STEP_LEVEL1 + " " + localeInfo.DRAGON_SOUL_STRENGTH(refine)
  1474.  
  1475. elif 1 == step:
  1476. return localeInfo.DRAGON_SOUL_STEP_LEVEL2 + " " + localeInfo.DRAGON_SOUL_STRENGTH(refine)
  1477.  
  1478. elif 2 == step:
  1479. return localeInfo.DRAGON_SOUL_STEP_LEVEL3 + " " + localeInfo.DRAGON_SOUL_STRENGTH(refine)
  1480.  
  1481. elif 3 == step:
  1482. return localeInfo.DRAGON_SOUL_STEP_LEVEL4 + " " + localeInfo.DRAGON_SOUL_STRENGTH(refine)
  1483.  
  1484. elif 4 == step:
  1485. return localeInfo.DRAGON_SOUL_STEP_LEVEL5 + " " + localeInfo.DRAGON_SOUL_STRENGTH(refine)
  1486.  
  1487. else:
  1488. return ""
  1489.  
  1490. if app.ENABLE_MULTISHOP:
  1491. def AppendPriceTextLine(self, price, priceVnum):
  1492. item.SelectItem(priceVnum)
  1493. windowBack = ui.Window()
  1494. windowBack.SetParent(self)
  1495.  
  1496. textLine = ui.TextLine()
  1497. textLine.SetParent(windowBack)
  1498. textLine.SetFontName(self.defFontName)
  1499. textLine.SetPackedFontColor(self.FONT_COLOR)
  1500. textLine.SetText("%sx" % (localeInfo.TOOLTIP_BUYPRICE % int(price)))
  1501. textLine.SetOutline()
  1502. textLine.SetFeather(False)
  1503. textLine.SetPosition(0, 10)
  1504. textLine.Show()
  1505.  
  1506. itemImage = ui.ImageBox()
  1507. itemImage.SetParent(windowBack)
  1508. itemImage.LoadImage(item.GetIconImageFileName())
  1509. itemImage.SetPosition(textLine.GetTextSize()[0] + 2, 0)
  1510. itemImage.Show()
  1511.  
  1512. textLineName = ui.TextLine()
  1513. textLineName.SetParent(windowBack)
  1514. textLineName.SetFontName(self.defFontName)
  1515. textLineName.SetPackedFontColor(self.FONT_COLOR)
  1516. textLineName.SetText("%s" % item.GetItemName())
  1517. textLineName.SetOutline()
  1518. textLineName.SetFeather(False)
  1519. textLineName.SetPosition(textLine.GetTextSize()[0] + itemImage.GetWidth() + 4, 10)
  1520. textLineName.Show()
  1521.  
  1522. windowBack.SetPosition(0, self.toolTipHeight)
  1523. windowBack.SetSize(textLine.GetTextSize()[0] + itemImage.GetWidth() + textLineName.GetTextSize()[0] + 6, 32)
  1524. windowBack.SetWindowHorizontalAlignCenter()
  1525. windowBack.Show()
  1526.  
  1527. self.toolTipHeight += itemImage.GetHeight()
  1528.  
  1529. self.childrenList.append(textLine)
  1530. self.childrenList.append(textLineName)
  1531. self.childrenList.append(itemImage)
  1532. self.childrenList.append(windowBack)
  1533. self.ResizeToolTip()
  1534.  
  1535. def __IsHair(self, itemVnum):
  1536. return (self.__IsOldHair(itemVnum) or
  1537. self.__IsNewHair(itemVnum) or
  1538. self.__IsNewHair2(itemVnum) or
  1539. self.__IsNewHair3(itemVnum) or
  1540. self.__IsCostumeHair(itemVnum)
  1541. )
  1542.  
  1543. def __IsOldHair(self, itemVnum):
  1544. return itemVnum > 73000 and itemVnum < 74000
  1545.  
  1546. def __IsNewHair(self, itemVnum):
  1547. return itemVnum > 74000 and itemVnum < 75000
  1548.  
  1549. def __IsNewHair2(self, itemVnum):
  1550. return itemVnum > 75000 and itemVnum < 76000
  1551.  
  1552. def __IsNewHair3(self, itemVnum):
  1553. return ((74012 < itemVnum and itemVnum < 74022) or
  1554. (74262 < itemVnum and itemVnum < 74272) or
  1555. (74512 < itemVnum and itemVnum < 74522) or
  1556. (74762 < itemVnum and itemVnum < 74772) or
  1557. (45000 < itemVnum and itemVnum < 47000))
  1558.  
  1559. def __IsCostumeHair(self, itemVnum):
  1560. return app.ENABLE_COSTUME_SYSTEM and self.__IsNewHair3(itemVnum - 100000)
  1561.  
  1562. def __AppendHairIcon(self, itemVnum):
  1563. itemImage = ui.ImageBox()
  1564. itemImage.SetParent(self)
  1565. itemImage.Show()
  1566.  
  1567. if self.__IsOldHair(itemVnum):
  1568. itemImage.LoadImage("d:/ymir work/item/quest/"+str(itemVnum)+".tga")
  1569.  
  1570. elif self.__IsNewHair3(itemVnum):
  1571. itemImage.LoadImage("icon/hair/%d.sub" % (itemVnum))
  1572.  
  1573. elif self.__IsNewHair(itemVnum):
  1574. itemImage.LoadImage("d:/ymir work/item/quest/"+str(itemVnum-1000)+".tga")
  1575.  
  1576. elif self.__IsNewHair2(itemVnum):
  1577. itemImage.LoadImage("icon/hair/%d.sub" % (itemVnum))
  1578.  
  1579. elif self.__IsCostumeHair(itemVnum):
  1580. itemImage.LoadImage("icon/hair/%d.sub" % (itemVnum - 100000))
  1581.  
  1582. itemImage.SetPosition(itemImage.GetWidth()/2, self.toolTipHeight)
  1583.  
  1584. self.toolTipHeight += itemImage.GetHeight()
  1585. self.childrenList.append(itemImage)
  1586. self.ResizeToolTip()
  1587.  
  1588. def __AdjustMaxWidth(self, attrSlot, desc):
  1589. newToolTipWidth = self.toolTipWidth
  1590. newToolTipWidth = max(self.__AdjustAttrMaxWidth(attrSlot), newToolTipWidth)
  1591. newToolTipWidth = max(self.__AdjustDescMaxWidth(desc), newToolTipWidth)
  1592.  
  1593. if newToolTipWidth > self.toolTipWidth:
  1594. self.toolTipWidth = newToolTipWidth
  1595. self.ResizeToolTip()
  1596.  
  1597. def __AdjustAttrMaxWidth(self, attrSlot):
  1598. if 0 == attrSlot:
  1599. return self.toolTipWidth
  1600.  
  1601. maxWidth = self.toolTipWidth
  1602.  
  1603. for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  1604. type = attrSlot[i][0]
  1605. value = attrSlot[i][1]
  1606.  
  1607. if self.ATTRIBUTE_NEED_WIDTH.has_key(type):
  1608. if value > 0:
  1609. maxWidth = max(self.ATTRIBUTE_NEED_WIDTH[type], maxWidth)
  1610.  
  1611. return maxWidth
  1612.  
  1613. def __AdjustDescMaxWidth(self, desc):
  1614. if len(desc) < DESC_DEFAULT_MAX_COLS:
  1615. return self.toolTipWidth
  1616.  
  1617. return DESC_WESTERN_MAX_WIDTH
  1618.  
  1619. def __SetSkillBookToolTip(self, skillIndex, bookName, skillGrade):
  1620. skillName = skill.GetSkillName(skillIndex)
  1621.  
  1622. if not skillName:
  1623. return
  1624.  
  1625. itemName = skillName + " " + bookName
  1626. self.SetTitle(itemName)
  1627.  
  1628. def __AppendPickInformation(self, curLevel, curEXP, maxEXP):
  1629. self.AppendSpace(5)
  1630. self.AppendTextLine(localeInfo.TOOLTIP_PICK_LEVEL % (curLevel), self.NORMAL_COLOR)
  1631. self.AppendTextLine(localeInfo.TOOLTIP_PICK_EXP % (curEXP, maxEXP), self.NORMAL_COLOR)
  1632.  
  1633. if curEXP == maxEXP:
  1634. self.AppendSpace(5)
  1635. self.AppendTextLine(localeInfo.TOOLTIP_PICK_UPGRADE1, self.NORMAL_COLOR)
  1636. self.AppendTextLine(localeInfo.TOOLTIP_PICK_UPGRADE2, self.NORMAL_COLOR)
  1637. self.AppendTextLine(localeInfo.TOOLTIP_PICK_UPGRADE3, self.NORMAL_COLOR)
  1638.  
  1639. def __AppendRodInformation(self, curLevel, curEXP, maxEXP):
  1640. self.AppendSpace(5)
  1641. self.AppendTextLine(localeInfo.TOOLTIP_FISHINGROD_LEVEL % (curLevel), self.NORMAL_COLOR)
  1642. self.AppendTextLine(localeInfo.TOOLTIP_FISHINGROD_EXP % (curEXP, maxEXP), self.NORMAL_COLOR)
  1643.  
  1644. if curEXP == maxEXP:
  1645. self.AppendSpace(5)
  1646. self.AppendTextLine(localeInfo.TOOLTIP_FISHINGROD_UPGRADE1, self.NORMAL_COLOR)
  1647. self.AppendTextLine(localeInfo.TOOLTIP_FISHINGROD_UPGRADE2, self.NORMAL_COLOR)
  1648. self.AppendTextLine(localeInfo.TOOLTIP_FISHINGROD_UPGRADE3, self.NORMAL_COLOR)
  1649.  
  1650. def __AppendLimitInformation(self):
  1651. appendSpace = FALSE
  1652.  
  1653. for i in xrange(item.LIMIT_MAX_NUM):
  1654. (limitType, limitValue) = item.GetLimit(i)
  1655.  
  1656. if limitValue <= 0:
  1657. continue
  1658.  
  1659. if not appendSpace:
  1660. self.AppendSpace(3)
  1661. appendSpace = TRUE
  1662.  
  1663. if item.LIMIT_LEVEL == limitType:
  1664. continue
  1665.  
  1666. """
  1667. elif item.LIMIT_STR == limitType:
  1668. color = self.GetLimitTextLineColor(player.GetStatus(player.ST), limitValue)
  1669. self.AppendTextLine(localeInfo.TOOLTIP_ITEM_LIMIT_STR % (limitValue), color)
  1670.  
  1671. elif item.LIMIT_DEX == limitType:
  1672. color = self.GetLimitTextLineColor(player.GetStatus(player.DX), limitValue)
  1673. self.AppendTextLine(localeInfo.TOOLTIP_ITEM_LIMIT_DEX % (limitValue), color)
  1674.  
  1675. elif item.LIMIT_INT == limitType:
  1676. color = self.GetLimitTextLineColor(player.GetStatus(player.IQ), limitValue)
  1677. self.AppendTextLine(localeInfo.TOOLTIP_ITEM_LIMIT_INT % (limitValue), color)
  1678.  
  1679. elif item.LIMIT_CON == limitType:
  1680. color = self.GetLimitTextLineColor(player.GetStatus(player.HT), limitValue)
  1681. self.AppendTextLine(localeInfo.TOOLTIP_ITEM_LIMIT_CON % (limitValue), color)
  1682. """
  1683.  
  1684. def __GetAffectString(self, affectType, affectValue):
  1685. if 0 == affectType:
  1686. return None
  1687.  
  1688. if 0 == affectValue:
  1689. return None
  1690.  
  1691. try:
  1692. return self.AFFECT_DICT[affectType](affectValue)
  1693.  
  1694. except TypeError:
  1695. return "UNKNOWN_VALUE[%s] %s" % (affectType, affectValue)
  1696.  
  1697. except KeyError:
  1698. return "UNKNOWN_TYPE[%s] %s" % (affectType, affectValue)
  1699.  
  1700. def __AppendAffectInformation(self):
  1701. for i in xrange(item.ITEM_APPLY_MAX_NUM):
  1702.  
  1703. (affectType, affectValue) = item.GetAffect(i)
  1704.  
  1705. affectString = self.__GetAffectString(affectType, affectValue)
  1706.  
  1707. if affectString:
  1708. self.AppendTextLine(affectString, self.GetChangeTextLineColor(affectValue))
  1709.  
  1710. def AppendWearableInformation(self):
  1711. self.AppendSpace(5)
  1712. self.AppendTextLine(localeInfo.TOOLTIP_ITEM_WEARABLE_JOB, self.NORMAL_COLOR)
  1713.  
  1714. flagList = (
  1715. not item.IsAntiFlag(item.ITEM_ANTIFLAG_WARRIOR),
  1716. not item.IsAntiFlag(item.ITEM_ANTIFLAG_ASSASSIN),
  1717. not item.IsAntiFlag(item.ITEM_ANTIFLAG_SURA),
  1718. not item.IsAntiFlag(item.ITEM_ANTIFLAG_SHAMAN))
  1719.  
  1720. characterNames = ""
  1721.  
  1722. self.AppendSpace(2)
  1723.  
  1724. for i in xrange(self.CHARACTER_COUNT):
  1725.  
  1726. name = self.CHARACTER_NAMES[i]
  1727. flag = flagList[i]
  1728.  
  1729. if flag:
  1730. characterNames += " "
  1731. characterNames += name
  1732.  
  1733. self.AppendSpace(2)
  1734.  
  1735. textLine = self.AppendTextLine(characterNames, self.NORMAL_COLOR, TRUE)
  1736. textLine.SetFeather()
  1737.  
  1738. self.AppendSpace(4)
  1739.  
  1740. if app.ENABLE_QUICK_SELL:
  1741. self.AppendTextLine(localeInfo.QUICK_SELL_MESSAGE)
  1742.  
  1743. if item.IsAntiFlag(item.ITEM_ANTIFLAG_MALE):
  1744. textLine = self.AppendTextLine(localeInfo.FOR_FEMALE, self.NORMAL_COLOR, TRUE)
  1745. textLine.SetFeather()
  1746.  
  1747. if item.IsAntiFlag(item.ITEM_ANTIFLAG_FEMALE):
  1748. textLine = self.AppendTextLine(localeInfo.FOR_MALE, self.NORMAL_COLOR, TRUE)
  1749. textLine.SetFeather()
  1750.  
  1751. if app.EXCHANGE_CHECKIN_UPDATE:
  1752. def AppendTradeableInformation(self):
  1753. self.AppendSpace(5)
  1754. self.AppendTextLine(localeInfo.TOOLTIP_TRADE_ITEMS, self.NORMAL_COLOR)
  1755.  
  1756. def __AppendPotionInformation(self):
  1757. self.AppendSpace(5)
  1758.  
  1759. healHP = item.GetValue(0)
  1760. healSP = item.GetValue(1)
  1761. healStatus = item.GetValue(2)
  1762. healPercentageHP = item.GetValue(3)
  1763. healPercentageSP = item.GetValue(4)
  1764.  
  1765. if healHP > 0:
  1766. self.AppendTextLine(localeInfo.TOOLTIP_POTION_PLUS_HP_POINT % healHP, self.GetChangeTextLineColor(healHP))
  1767.  
  1768. if healSP > 0:
  1769. self.AppendTextLine(localeInfo.TOOLTIP_POTION_PLUS_SP_POINT % healSP, self.GetChangeTextLineColor(healSP))
  1770.  
  1771. if healStatus != 0:
  1772. self.AppendTextLine(localeInfo.TOOLTIP_POTION_CURE)
  1773.  
  1774. if healPercentageHP > 0:
  1775. self.AppendTextLine(localeInfo.TOOLTIP_POTION_PLUS_HP_PERCENT % healPercentageHP, self.GetChangeTextLineColor(healPercentageHP))
  1776.  
  1777. if healPercentageSP > 0:
  1778. self.AppendTextLine(localeInfo.TOOLTIP_POTION_PLUS_SP_PERCENT % healPercentageSP, self.GetChangeTextLineColor(healPercentageSP))
  1779.  
  1780. def __AppendAbilityPotionInformation(self):
  1781.  
  1782. self.AppendSpace(5)
  1783.  
  1784. abilityType = item.GetValue(0)
  1785. time = item.GetValue(1)
  1786. point = item.GetValue(2)
  1787.  
  1788. if abilityType == item.APPLY_ATT_SPEED:
  1789. self.AppendTextLine(localeInfo.TOOLTIP_POTION_PLUS_ATTACK_SPEED % point, self.GetChangeTextLineColor(point))
  1790.  
  1791. elif abilityType == item.APPLY_MOV_SPEED:
  1792. self.AppendTextLine(localeInfo.TOOLTIP_POTION_PLUS_MOVING_SPEED % point, self.GetChangeTextLineColor(point))
  1793.  
  1794. if time > 0:
  1795. minute = (time / 60)
  1796. second = (time % 60)
  1797. timeString = localeInfo.TOOLTIP_POTION_TIME
  1798.  
  1799. if minute > 0:
  1800. timeString += str(minute) + localeInfo.TOOLTIP_POTION_MIN
  1801.  
  1802. if second > 0:
  1803. timeString += " " + str(second) + localeInfo.TOOLTIP_POTION_SEC
  1804.  
  1805. self.AppendTextLine(timeString)
  1806.  
  1807. def GetPriceColor(self, price):
  1808. if price>=constInfo.HIGH_PRICE:
  1809. return self.HIGH_PRICE_COLOR
  1810.  
  1811. if price>=constInfo.MIDDLE_PRICE:
  1812. return self.MIDDLE_PRICE_COLOR
  1813.  
  1814. else:
  1815. return self.LOW_PRICE_COLOR
  1816.  
  1817. def AppendPrice(self, price):
  1818. self.AppendSpace(5)
  1819.  
  1820. if price == 0:
  1821. self.AppendTextLine(localeInfo.TOOLTIP_BUYPRICE_FREE, self.GetPriceColorFree(price))
  1822. else:
  1823. self.AppendTextLine(localeInfo.TOOLTIP_BUYPRICE % (localeInfo.NumberToMoneyString(price)), self.GetPriceColor(price))
  1824.  
  1825. def GetPriceColorFree(self, price):
  1826. if price == 0:
  1827. return self.GREEN_COLOR_PRICE_FREE
  1828.  
  1829. def AppendSellingPrice(self, price):
  1830. if item.IsAntiFlag(item.ITEM_ANTIFLAG_SELL):
  1831. self.AppendTextLine(localeInfo.TOOLTIP_ANTI_SELL, self.DISABLE_COLOR)
  1832. self.AppendSpace(5)
  1833. else:
  1834. self.AppendTextLine(localeInfo.TOOLTIP_SELLPRICE % (localeInfo.NumberToMoneyString(price)), self.GetPriceColor(price))
  1835. self.AppendSpace(5)
  1836.  
  1837. def AppendMetinInformation(self):
  1838. affectType, affectValue = item.GetAffect(0)
  1839.  
  1840. affectString = self.__GetAffectString(affectType, affectValue)
  1841.  
  1842. if affectString:
  1843. self.AppendSpace(5)
  1844. self.AppendTextLine(affectString, self.GetChangeTextLineColor(affectValue))
  1845.  
  1846. def AppendMetinWearInformation(self):
  1847.  
  1848. self.AppendSpace(5)
  1849. self.AppendTextLine(localeInfo.TOOLTIP_SOCKET_REFINABLE_ITEM, self.NORMAL_COLOR)
  1850.  
  1851. flagList = (item.IsWearableFlag(item.WEARABLE_BODY),
  1852. item.IsWearableFlag(item.WEARABLE_HEAD),
  1853. item.IsWearableFlag(item.WEARABLE_FOOTS),
  1854. item.IsWearableFlag(item.WEARABLE_WRIST),
  1855. item.IsWearableFlag(item.WEARABLE_WEAPON),
  1856. item.IsWearableFlag(item.WEARABLE_NECK),
  1857. item.IsWearableFlag(item.WEARABLE_EAR),
  1858. item.IsWearableFlag(item.WEARABLE_UNIQUE),
  1859. item.IsWearableFlag(item.WEARABLE_SHIELD),
  1860. item.IsWearableFlag(item.WEARABLE_ARROW))
  1861.  
  1862. wearNames = ""
  1863.  
  1864. for i in xrange(self.WEAR_COUNT):
  1865.  
  1866. name = self.WEAR_NAMES[i]
  1867. flag = flagList[i]
  1868.  
  1869. if flag:
  1870. wearNames += " "
  1871. wearNames += name
  1872.  
  1873. textLine = ui.TextLine()
  1874. textLine.SetParent(self)
  1875. textLine.SetFontName(self.defFontName)
  1876. textLine.SetPosition(self.toolTipWidth/2, self.toolTipHeight)
  1877. textLine.SetHorizontalAlignCenter()
  1878. textLine.SetPackedFontColor(self.NORMAL_COLOR)
  1879. textLine.SetText(wearNames)
  1880. textLine.Show()
  1881.  
  1882. self.childrenList.append(textLine)
  1883.  
  1884. self.toolTipHeight += self.TEXT_LINE_HEIGHT
  1885. self.ResizeToolTip()
  1886.  
  1887. def GetMetinSocketType(self, number):
  1888. if player.METIN_SOCKET_TYPE_NONE == number:
  1889. return player.METIN_SOCKET_TYPE_NONE
  1890.  
  1891. elif player.METIN_SOCKET_TYPE_SILVER == number:
  1892. return player.METIN_SOCKET_TYPE_SILVER
  1893.  
  1894. elif player.METIN_SOCKET_TYPE_GOLD == number:
  1895. return player.METIN_SOCKET_TYPE_GOLD
  1896.  
  1897. else:
  1898. item.SelectItem(number)
  1899. if item.METIN_NORMAL == item.GetItemSubType():
  1900. return player.METIN_SOCKET_TYPE_SILVER
  1901.  
  1902. elif item.METIN_GOLD == item.GetItemSubType():
  1903. return player.METIN_SOCKET_TYPE_GOLD
  1904.  
  1905. elif "USE_PUT_INTO_ACCESSORY_SOCKET" == item.GetUseType(number):
  1906. return player.METIN_SOCKET_TYPE_SILVER
  1907.  
  1908. return player.METIN_SOCKET_TYPE_NONE
  1909.  
  1910. def GetMetinItemIndex(self, number):
  1911. if player.METIN_SOCKET_TYPE_SILVER == number:
  1912. return 0
  1913.  
  1914. if player.METIN_SOCKET_TYPE_GOLD == number:
  1915. return 0
  1916.  
  1917. return number
  1918.  
  1919. def __AppendAccessoryMetinSlotInfo(self, metinSlot, mtrlVnum):
  1920. ACCESSORY_SOCKET_MAX_SIZE = 3
  1921.  
  1922. cur = min(metinSlot[0], ACCESSORY_SOCKET_MAX_SIZE)
  1923. end = min(metinSlot[1], ACCESSORY_SOCKET_MAX_SIZE)
  1924.  
  1925. affectType1, affectValue1 = item.GetAffect(0)
  1926. affectList1=[0, max(1, affectValue1*10/100), max(2, affectValue1*20/100), max(3, affectValue1*40/100)]
  1927.  
  1928. affectType2, affectValue2 = item.GetAffect(1)
  1929. affectList2=[0, max(1, affectValue2*10/100), max(2, affectValue2*20/100), max(3, affectValue2*40/100)]
  1930.  
  1931. mtrlPos=0
  1932. mtrlList=[mtrlVnum]*cur+[player.METIN_SOCKET_TYPE_SILVER]*(end-cur)
  1933.  
  1934. for mtrl in mtrlList:
  1935. affectString1 = self.__GetAffectString(affectType1, affectList1[mtrlPos+1]-affectList1[mtrlPos])
  1936. affectString2 = self.__GetAffectString(affectType2, affectList2[mtrlPos+1]-affectList2[mtrlPos])
  1937.  
  1938. leftTime = 0
  1939. if cur == mtrlPos+1:
  1940. leftTime=metinSlot[2]
  1941.  
  1942. self.__AppendMetinSlotInfo_AppendMetinSocketData(mtrlPos, mtrl, affectString1, affectString2, leftTime)
  1943. mtrlPos+=1
  1944.  
  1945. def __AppendMetinSlotInfo(self, metinSlot):
  1946. if self.__AppendMetinSlotInfo_IsEmptySlotList(metinSlot):
  1947. return
  1948.  
  1949. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1950. self.__AppendMetinSlotInfo_AppendMetinSocketData(i, metinSlot[i])
  1951.  
  1952. def __AppendMetinSlotInfo_IsEmptySlotList(self, metinSlot):
  1953. if 0 == metinSlot:
  1954. return 1
  1955.  
  1956. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1957. metinSlotData=metinSlot[i]
  1958. if 0 != self.GetMetinSocketType(metinSlotData):
  1959. if 0 != self.GetMetinItemIndex(metinSlotData):
  1960. return 0
  1961.  
  1962. return 1
  1963.  
  1964. def __AppendMetinSlotInfo_AppendMetinSocketData(self, index, metinSlotData, custumAffectString="", custumAffectString2="", leftTime=0):
  1965.  
  1966. slotType = self.GetMetinSocketType(metinSlotData)
  1967. itemIndex = self.GetMetinItemIndex(metinSlotData)
  1968.  
  1969. if 0 == slotType:
  1970. return
  1971.  
  1972. self.AppendSpace(5)
  1973.  
  1974. slotImage = ui.ImageBox()
  1975. slotImage.SetParent(self)
  1976. slotImage.Show()
  1977.  
  1978. nameTextLine = ui.TextLine()
  1979. nameTextLine.SetParent(self)
  1980. nameTextLine.SetFontName(self.defFontName)
  1981. nameTextLine.SetPackedFontColor(self.NORMAL_COLOR)
  1982. nameTextLine.SetOutline()
  1983. nameTextLine.SetFeather()
  1984. nameTextLine.Show()
  1985.  
  1986. self.childrenList.append(nameTextLine)
  1987.  
  1988. if player.METIN_SOCKET_TYPE_SILVER == slotType:
  1989. slotImage.LoadImage("d:/ymir work/ui/game/windows/metin_slot_silver.sub")
  1990.  
  1991. elif player.METIN_SOCKET_TYPE_GOLD == slotType:
  1992. slotImage.LoadImage("d:/ymir work/ui/game/windows/metin_slot_gold.sub")
  1993.  
  1994. self.childrenList.append(slotImage)
  1995.  
  1996. slotImage.SetPosition(9, self.toolTipHeight-1)
  1997. nameTextLine.SetPosition(50, self.toolTipHeight + 2)
  1998.  
  1999. metinImage = ui.ImageBox()
  2000. metinImage.SetParent(self)
  2001. metinImage.Show()
  2002. self.childrenList.append(metinImage)
  2003.  
  2004. if itemIndex:
  2005.  
  2006. item.SelectItem(itemIndex)
  2007.  
  2008. try:
  2009. metinImage.LoadImage(item.GetIconImageFileName())
  2010.  
  2011. except:
  2012. dbg.TraceError("ItemToolTip.__AppendMetinSocketData() - Failed to find image file %d:%s" % (itemIndex, item.GetIconImageFileName()))
  2013.  
  2014. nameTextLine.SetText(item.GetItemName())
  2015.  
  2016. affectTextLine = ui.TextLine()
  2017. affectTextLine.SetParent(self)
  2018. affectTextLine.SetFontName(self.defFontName)
  2019. affectTextLine.SetPackedFontColor(self.POSITIVE_COLOR)
  2020. affectTextLine.SetOutline()
  2021. affectTextLine.SetFeather()
  2022. affectTextLine.Show()
  2023.  
  2024. metinImage.SetPosition(10, self.toolTipHeight)
  2025. affectTextLine.SetPosition(50, self.toolTipHeight + 16 + 2)
  2026.  
  2027. if custumAffectString:
  2028. affectTextLine.SetText(custumAffectString)
  2029.  
  2030. elif itemIndex!=constInfo.ERROR_METIN_STONE:
  2031. affectType, affectValue = item.GetAffect(0)
  2032. affectString = self.__GetAffectString(affectType, affectValue)
  2033.  
  2034. if affectString:
  2035. affectTextLine.SetText(affectString)
  2036.  
  2037. else:
  2038. affectTextLine.SetText(localeInfo.TOOLTIP_APPLY_NOAFFECT)
  2039.  
  2040. self.childrenList.append(affectTextLine)
  2041.  
  2042. if custumAffectString2:
  2043. affectTextLine = ui.TextLine()
  2044. affectTextLine.SetParent(self)
  2045. affectTextLine.SetFontName(self.defFontName)
  2046. affectTextLine.SetPackedFontColor(self.POSITIVE_COLOR)
  2047. affectTextLine.SetPosition(50, self.toolTipHeight + 16 + 2 + 16 + 2)
  2048. affectTextLine.SetOutline()
  2049. affectTextLine.SetFeather()
  2050. affectTextLine.Show()
  2051. affectTextLine.SetText(custumAffectString2)
  2052. self.childrenList.append(affectTextLine)
  2053. self.toolTipHeight += 16 + 2
  2054.  
  2055. if 0 != leftTime:
  2056. timeText = (localeInfo.LEFT_TIME + " : " + localeInfo.SecondToDHM(leftTime))
  2057.  
  2058. timeTextLine = ui.TextLine()
  2059. timeTextLine.SetParent(self)
  2060. timeTextLine.SetFontName(self.defFontName)
  2061. timeTextLine.SetPackedFontColor(self.COLOR_SOCKET_PERMANENT)
  2062. timeTextLine.SetPosition(50, self.toolTipHeight + 16 + 2 + 16 + 2)
  2063. timeTextLine.SetOutline()
  2064. timeTextLine.SetFeather()
  2065. timeTextLine.Show()
  2066. timeTextLine.SetText(timeText)
  2067.  
  2068. self.childrenList.append(timeTextLine)
  2069. self.toolTipHeight += 16 + 2
  2070.  
  2071. else:
  2072. if item.ARMOR_BODY != item.GetItemSubType():
  2073. timeText = (localeInfo.SOCKET_PERMANENT)
  2074.  
  2075. timeTextLine = ui.TextLine()
  2076. timeTextLine.SetParent(self)
  2077. timeTextLine.SetFontName(self.defFontName)
  2078. timeTextLine.SetPackedFontColor(self.COLOR_SOCKET_PERMANENT)
  2079. timeTextLine.SetPosition(50, self.toolTipHeight + 16 + 2 + 16 + 2)
  2080. timeTextLine.SetOutline()
  2081. timeTextLine.SetFeather()
  2082. timeTextLine.Show()
  2083. timeTextLine.SetText(timeText)
  2084.  
  2085. self.childrenList.append(timeTextLine)
  2086. self.toolTipHeight += 16 + 2
  2087.  
  2088. else:
  2089. nameTextLine.SetText(localeInfo.TOOLTIP_SOCKET_EMPTY)
  2090.  
  2091. self.toolTipHeight += 35
  2092. self.ResizeToolTip()
  2093.  
  2094. def __AppendFishInfo(self, size):
  2095. if size > 0:
  2096. self.AppendSpace(5)
  2097. self.AppendTextLine(localeInfo.TOOLTIP_FISH_LEN % (float(size) / 100.0), self.NORMAL_COLOR)
  2098.  
  2099. def AppendUniqueItemLastTime(self, restMin):
  2100. restSecond = restMin*60
  2101. self.AppendSpace(5)
  2102. self.AppendTextLine(localeInfo.LEFT_TIME + " : " + localeInfo.SecondToDHM(restSecond), self.NORMAL_COLOR)
  2103.  
  2104. def AppendMallItemLastTime(self, endTime):
  2105. leftSec = max(0, endTime - app.GetGlobalTimeStamp())
  2106.  
  2107. self.AppendSpace(5)
  2108. self.AppendTextLine(localeInfo.LEFT_TIME + " : " + localeInfo.SecondToDHM(leftSec), self.NORMAL_COLOR)
  2109.  
  2110. def AppendTimerBasedOnWearLastTime(self, metinSlot):
  2111. if 0 == metinSlot[0]:
  2112. self.AppendSpace(5)
  2113. self.AppendTextLine(localeInfo.CANNOT_USE, self.DISABLE_COLOR)
  2114. else:
  2115. endTime = app.GetGlobalTimeStamp() + metinSlot[0]
  2116. self.AppendMallItemLastTime(endTime)
  2117.  
  2118. def AppendRealTimeStartFirstUseLastTime(self, item, metinSlot, limitIndex):
  2119. useCount = metinSlot[1]
  2120. endTime = metinSlot[0]
  2121.  
  2122. if 0 == useCount:
  2123. if 0 == endTime:
  2124. (limitType, limitValue) = item.GetLimit(limitIndex)
  2125. endTime = limitValue
  2126.  
  2127. endTime += app.GetGlobalTimeStamp()
  2128.  
  2129. self.AppendMallItemLastTime(endTime)
  2130.  
  2131. class HyperlinkItemToolTip(ItemToolTip):
  2132. def __init__(self):
  2133. ItemToolTip.__init__(self, isPickable=TRUE)
  2134.  
  2135. def SetHyperlinkItem(self, tokens):
  2136. minTokenCount = 3 + player.METIN_SOCKET_MAX_NUM
  2137. maxTokenCount = minTokenCount + 2 * player.ATTRIBUTE_SLOT_MAX_NUM
  2138.  
  2139. if tokens and len(tokens) >= minTokenCount and len(tokens) <= maxTokenCount:
  2140. head, vnum, flag = tokens[:3]
  2141. itemVnum = int(vnum, 16)
  2142. metinSlot = [int(metin, 16) for metin in tokens[3:6]]
  2143.  
  2144. rests = tokens[6:]
  2145. if rests:
  2146. attrSlot = []
  2147.  
  2148. rests.reverse()
  2149. while rests:
  2150. key = int(rests.pop(), 16)
  2151. if rests:
  2152. val = int(rests.pop())
  2153. attrSlot.append((key, val))
  2154.  
  2155. attrSlot += [(0, 0)] * (player.ATTRIBUTE_SLOT_MAX_NUM - len(attrSlot))
  2156. else:
  2157. attrSlot = [(0, 0)] * player.ATTRIBUTE_SLOT_MAX_NUM
  2158.  
  2159. self.ClearToolTip()
  2160. self.AddItemData(itemVnum, metinSlot, attrSlot)
  2161.  
  2162. ItemToolTip.OnUpdate(self)
  2163.  
  2164. def OnUpdate(self):
  2165. pass
  2166.  
  2167. def OnMouseLeftButtonDown(self):
  2168. self.Hide()
  2169.  
  2170. class SkillToolTip(ToolTip):
  2171.  
  2172. POINT_NAME_DICT = {
  2173. player.LEVEL : localeInfo.SKILL_TOOLTIP_LEVEL,
  2174. player.IQ : localeInfo.SKILL_TOOLTIP_INT,
  2175. }
  2176.  
  2177. SKILL_TOOL_TIP_WIDTH = 200
  2178. PARTY_SKILL_TOOL_TIP_WIDTH = 340
  2179.  
  2180. PARTY_SKILL_EXPERIENCE_AFFECT_LIST = ( ( 2, 2, 10,),
  2181. ( 8, 3, 20,),
  2182. (14, 4, 30,),
  2183. (22, 5, 45,),
  2184. (28, 6, 60,),
  2185. (34, 7, 80,),
  2186. (38, 8, 100,), )
  2187.  
  2188. PARTY_SKILL_PLUS_GRADE_AFFECT_LIST = ( ( 4, 2, 1, 0,),
  2189. (10, 3, 2, 0,),
  2190. (16, 4, 2, 1,),
  2191. (24, 5, 2, 2,), )
  2192.  
  2193. PARTY_SKILL_ATTACKER_AFFECT_LIST = ( ( 36, 3, ),
  2194. ( 26, 1, ),
  2195. ( 32, 2, ), )
  2196.  
  2197. SKILL_GRADE_NAME = { player.SKILL_GRADE_MASTER : localeInfo.SKILL_GRADE_NAME_MASTER,
  2198. player.SKILL_GRADE_GRAND_MASTER : localeInfo.SKILL_GRADE_NAME_GRAND_MASTER,
  2199. player.SKILL_GRADE_PERFECT_MASTER : localeInfo.SKILL_GRADE_NAME_PERFECT_MASTER, }
  2200.  
  2201. AFFECT_NAME_DICT = {
  2202. "HP" : localeInfo.TOOLTIP_SKILL_AFFECT_ATT_POWER,
  2203. "ATT_GRADE" : localeInfo.TOOLTIP_SKILL_AFFECT_ATT_GRADE,
  2204. "DEF_GRADE" : localeInfo.TOOLTIP_SKILL_AFFECT_DEF_GRADE,
  2205. "ATT_SPEED" : localeInfo.TOOLTIP_SKILL_AFFECT_ATT_SPEED,
  2206. "MOV_SPEED" : localeInfo.TOOLTIP_SKILL_AFFECT_MOV_SPEED,
  2207. "DODGE" : localeInfo.TOOLTIP_SKILL_AFFECT_DODGE,
  2208. "RESIST_NORMAL" : localeInfo.TOOLTIP_SKILL_AFFECT_RESIST_NORMAL,
  2209. "REFLECT_MELEE" : localeInfo.TOOLTIP_SKILL_AFFECT_REFLECT_MELEE,
  2210. }
  2211. AFFECT_APPEND_TEXT_DICT = {
  2212. "DODGE" : "%",
  2213. "RESIST_NORMAL" : "%",
  2214. "REFLECT_MELEE" : "%",
  2215. }
  2216.  
  2217. def __init__(self):
  2218. ToolTip.__init__(self, self.SKILL_TOOL_TIP_WIDTH)
  2219.  
  2220. def __del__(self):
  2221. ToolTip.__del__(self)
  2222.  
  2223. def SetSkill(self, skillIndex, skillLevel = -1):
  2224.  
  2225. if 0 == skillIndex:
  2226. return
  2227.  
  2228. if skill.SKILL_TYPE_GUILD == skill.GetSkillType(skillIndex):
  2229.  
  2230. if self.SKILL_TOOL_TIP_WIDTH != self.toolTipWidth:
  2231. self.toolTipWidth = self.SKILL_TOOL_TIP_WIDTH
  2232. self.ResizeToolTip()
  2233.  
  2234. self.AppendDefaultData(skillIndex)
  2235. self.AppendSkillConditionData(skillIndex)
  2236. self.AppendGuildSkillData(skillIndex, skillLevel)
  2237.  
  2238. else:
  2239.  
  2240. if self.SKILL_TOOL_TIP_WIDTH != self.toolTipWidth:
  2241. self.toolTipWidth = self.SKILL_TOOL_TIP_WIDTH
  2242. self.ResizeToolTip()
  2243.  
  2244. slotIndex = player.GetSkillSlotIndex(skillIndex)
  2245. skillGrade = player.GetSkillGrade(slotIndex)
  2246. skillLevel = player.GetSkillLevel(slotIndex)
  2247. skillCurrentPercentage = player.GetSkillCurrentEfficientPercentage(slotIndex)
  2248. skillNextPercentage = player.GetSkillNextEfficientPercentage(slotIndex)
  2249.  
  2250. self.AppendDefaultData(skillIndex)
  2251. self.AppendSkillConditionData(skillIndex)
  2252. self.AppendSkillDataNew(slotIndex, skillIndex, skillGrade, skillLevel, skillCurrentPercentage, skillNextPercentage)
  2253. self.AppendSkillRequirement(skillIndex, skillLevel)
  2254.  
  2255. self.ShowToolTip()
  2256.  
  2257. if app.ENABLE_RENEWAL_AFFECT_SHOWER:
  2258. def SetSkillEx(self, skillIndex, skillLevel = -1):
  2259. if 0 == skillIndex:
  2260. return
  2261.  
  2262. slotIndex = player.GetSkillSlotIndex(skillIndex)
  2263. skillCurrentPercentage = player.GetSkillCurrentEfficientPercentage(slotIndex)
  2264.  
  2265. for i in xrange(skill.GetSkillAffectDescriptionCount(skillIndex)):
  2266. self.AppendTextLine(skill.GetSkillAffectDescription(skillIndex, i, skillCurrentPercentage), self.ENABLE_COLOR)
  2267.  
  2268. self.ResizeToolTip()
  2269.  
  2270. def SetSkillNew(self, slotIndex, skillIndex, skillGrade, skillLevel):
  2271.  
  2272. if 0 == skillIndex:
  2273. return
  2274.  
  2275. if player.SKILL_INDEX_TONGSOL == skillIndex:
  2276.  
  2277. slotIndex = player.GetSkillSlotIndex(skillIndex)
  2278. skillLevel = player.GetSkillLevel(slotIndex)
  2279.  
  2280. self.AppendDefaultData(skillIndex)
  2281. self.AppendPartySkillData(skillGrade, skillLevel)
  2282.  
  2283. elif player.SKILL_INDEX_RIDING == skillIndex:
  2284.  
  2285. slotIndex = player.GetSkillSlotIndex(skillIndex)
  2286. self.AppendSupportSkillDefaultData(skillIndex, skillGrade, skillLevel, 30)
  2287.  
  2288. elif player.SKILL_INDEX_SUMMON == skillIndex:
  2289.  
  2290. maxLevel = 10
  2291.  
  2292. self.ClearToolTip()
  2293. self.__SetSkillTitle(skillIndex, skillGrade)
  2294.  
  2295. description = skill.GetSkillDescription(skillIndex)
  2296. self.AppendDescription(description, 25)
  2297.  
  2298. if skillLevel == 10:
  2299. self.AppendSpace(5)
  2300. self.AppendTextLine(localeInfo.TOOLTIP_SKILL_LEVEL_MASTER % (skillLevel), self.NORMAL_COLOR)
  2301. self.AppendTextLine(localeInfo.SKILL_SUMMON_DESCRIPTION % (skillLevel*10), self.NORMAL_COLOR)
  2302.  
  2303. else:
  2304. self.AppendSpace(5)
  2305. self.AppendTextLine(localeInfo.TOOLTIP_SKILL_LEVEL % (skillLevel), self.NORMAL_COLOR)
  2306. self.__AppendSummonDescription(skillLevel, self.NORMAL_COLOR)
  2307.  
  2308. self.AppendSpace(5)
  2309. self.AppendTextLine(localeInfo.TOOLTIP_SKILL_LEVEL % (skillLevel+1), self.NEGATIVE_COLOR)
  2310. self.__AppendSummonDescription(skillLevel+1, self.NEGATIVE_COLOR)
  2311.  
  2312. elif skill.SKILL_TYPE_GUILD == skill.GetSkillType(skillIndex):
  2313.  
  2314. if self.SKILL_TOOL_TIP_WIDTH != self.toolTipWidth:
  2315. self.toolTipWidth = self.SKILL_TOOL_TIP_WIDTH
  2316. self.ResizeToolTip()
  2317.  
  2318. self.AppendDefaultData(skillIndex)
  2319. self.AppendSkillConditionData(skillIndex)
  2320. self.AppendGuildSkillData(skillIndex, skillLevel)
  2321.  
  2322. else:
  2323.  
  2324. if self.SKILL_TOOL_TIP_WIDTH != self.toolTipWidth:
  2325. self.toolTipWidth = self.SKILL_TOOL_TIP_WIDTH
  2326. self.ResizeToolTip()
  2327.  
  2328. slotIndex = player.GetSkillSlotIndex(skillIndex)
  2329.  
  2330. skillCurrentPercentage = player.GetSkillCurrentEfficientPercentage(slotIndex)
  2331. skillNextPercentage = player.GetSkillNextEfficientPercentage(slotIndex)
  2332.  
  2333. self.AppendDefaultData(skillIndex, skillGrade)
  2334. self.AppendSkillConditionData(skillIndex)
  2335. self.AppendSkillDataNew(slotIndex, skillIndex, skillGrade, skillLevel, skillCurrentPercentage, skillNextPercentage)
  2336. self.AppendSkillRequirement(skillIndex, skillLevel)
  2337.  
  2338. self.ShowToolTip()
  2339.  
  2340. def __SetSkillTitle(self, skillIndex, skillGrade):
  2341. self.SetTitle(skill.GetSkillName(skillIndex, skillGrade))
  2342. self.__AppendSkillGradeName(skillIndex, skillGrade)
  2343.  
  2344. def __AppendSkillGradeName(self, skillIndex, skillGrade):
  2345. if self.SKILL_GRADE_NAME.has_key(skillGrade):
  2346. self.AppendSpace(5)
  2347. self.AppendTextLine(self.SKILL_GRADE_NAME[skillGrade] % (skill.GetSkillName(skillIndex, 0)), self.CAN_LEVEL_UP_COLOR)
  2348.  
  2349. def SetSkillOnlyName(self, slotIndex, skillIndex, skillGrade):
  2350. if 0 == skillIndex:
  2351. return
  2352.  
  2353. slotIndex = player.GetSkillSlotIndex(skillIndex)
  2354.  
  2355. self.toolTipWidth = self.SKILL_TOOL_TIP_WIDTH
  2356. self.ResizeToolTip()
  2357.  
  2358. self.ClearToolTip()
  2359. self.__SetSkillTitle(skillIndex, skillGrade)
  2360. self.AppendDefaultData(skillIndex, skillGrade)
  2361. self.AppendSkillConditionData(skillIndex)
  2362. self.ShowToolTip()
  2363.  
  2364. def AppendDefaultData(self, skillIndex, skillGrade = 0):
  2365. self.ClearToolTip()
  2366. self.__SetSkillTitle(skillIndex, skillGrade)
  2367.  
  2368. levelLimit = skill.GetSkillLevelLimit(skillIndex)
  2369. if levelLimit > 0:
  2370.  
  2371. color = self.NORMAL_COLOR
  2372. if player.GetStatus(player.LEVEL) < levelLimit:
  2373. color = self.NEGATIVE_COLOR
  2374.  
  2375. self.AppendSpace(5)
  2376. self.AppendTextLine(localeInfo.TOOLTIP_ITEM_LIMIT_LEVEL % (levelLimit), color)
  2377.  
  2378. description = skill.GetSkillDescription(skillIndex)
  2379. self.AppendDescription(description, 25)
  2380.  
  2381. def AppendSupportSkillDefaultData(self, skillIndex, skillGrade, skillLevel, maxLevel):
  2382. self.ClearToolTip()
  2383. self.__SetSkillTitle(skillIndex, skillGrade)
  2384.  
  2385. ## Description
  2386. description = skill.GetSkillDescription(skillIndex)
  2387. self.AppendDescription(description, 25)
  2388.  
  2389. if 1 == skillGrade:
  2390. skillLevel += 19
  2391.  
  2392. elif 2 == skillGrade:
  2393. skillLevel += 29
  2394.  
  2395. elif 3 == skillGrade:
  2396. skillLevel = 40
  2397.  
  2398. self.AppendSpace(5)
  2399. self.AppendTextLine(localeInfo.TOOLTIP_SKILL_LEVEL_WITH_MAX % (skillLevel, maxLevel), self.NORMAL_COLOR)
  2400.  
  2401. def AppendSkillConditionData(self, skillIndex):
  2402. conditionDataCount = skill.GetSkillConditionDescriptionCount(skillIndex)
  2403.  
  2404. if conditionDataCount > 0:
  2405. self.AppendSpace(5)
  2406. for i in xrange(conditionDataCount):
  2407. self.AppendTextLine(skill.GetSkillConditionDescription(skillIndex, i), self.CONDITION_COLOR)
  2408.  
  2409. def AppendGuildSkillData(self, skillIndex, skillLevel):
  2410. skillMaxLevel = 7
  2411. skillCurrentPercentage = float(skillLevel) / float(skillMaxLevel)
  2412. skillNextPercentage = float(skillLevel+1) / float(skillMaxLevel)
  2413.  
  2414. if skillLevel > 0:
  2415. if self.HasSkillLevelDescription(skillIndex, skillLevel):
  2416. self.AppendSpace(5)
  2417.  
  2418. if skillLevel == skillMaxLevel:
  2419. self.AppendTextLine(localeInfo.TOOLTIP_SKILL_LEVEL_MASTER % (skillLevel), self.NORMAL_COLOR)
  2420. else:
  2421. self.AppendTextLine(localeInfo.TOOLTIP_SKILL_LEVEL % (skillLevel), self.NORMAL_COLOR)
  2422.  
  2423. for i in xrange(skill.GetSkillAffectDescriptionCount(skillIndex)):
  2424. self.AppendTextLine(skill.GetSkillAffectDescription(skillIndex, i, skillCurrentPercentage), self.ENABLE_COLOR)
  2425.  
  2426. coolTime = skill.GetSkillCoolTime(skillIndex, skillCurrentPercentage)
  2427. if coolTime > 0:
  2428. self.AppendTextLine(localeInfo.TOOLTIP_SKILL_COOL_TIME + str(coolTime), self.ENABLE_COLOR)
  2429.  
  2430. needGSP = skill.GetSkillNeedSP(skillIndex, skillCurrentPercentage)
  2431. if needGSP > 0:
  2432. self.AppendTextLine(localeInfo.TOOLTIP_NEED_GSP % (needGSP), self.ENABLE_COLOR)
  2433.  
  2434. if skillLevel < skillMaxLevel:
  2435. if self.HasSkillLevelDescription(skillIndex, skillLevel+1):
  2436. self.AppendSpace(5)
  2437. self.AppendTextLine(localeInfo.TOOLTIP_NEXT_SKILL_LEVEL_1 % (skillLevel+1, skillMaxLevel), self.DISABLE_COLOR)
  2438.  
  2439. for i in xrange(skill.GetSkillAffectDescriptionCount(skillIndex)):
  2440. self.AppendTextLine(skill.GetSkillAffectDescription(skillIndex, i, skillNextPercentage), self.DISABLE_COLOR)
  2441.  
  2442. coolTime = skill.GetSkillCoolTime(skillIndex, skillNextPercentage)
  2443. if coolTime > 0:
  2444. self.AppendTextLine(localeInfo.TOOLTIP_SKILL_COOL_TIME + str(coolTime), self.DISABLE_COLOR)
  2445.  
  2446. needGSP = skill.GetSkillNeedSP(skillIndex, skillNextPercentage)
  2447. if needGSP > 0:
  2448. self.AppendTextLine(localeInfo.TOOLTIP_NEED_GSP % (needGSP), self.DISABLE_COLOR)
  2449.  
  2450. def AppendSkillDataNew(self, slotIndex, skillIndex, skillGrade, skillLevel, skillCurrentPercentage, skillNextPercentage):
  2451.  
  2452. self.skillMaxLevelStartDict = { 0 : 17, 1 : 7, 2 : 10, }
  2453. self.skillMaxLevelEndDict = { 0 : 20, 1 : 10, 2 : 10, }
  2454.  
  2455. skillLevelUpPoint = 1
  2456.  
  2457. realSkillGrade = player.GetSkillGrade(slotIndex)
  2458.  
  2459. skillMaxLevelStart = self.skillMaxLevelStartDict.get(realSkillGrade, 15)
  2460. skillMaxLevelEnd = self.skillMaxLevelEndDict.get(realSkillGrade, 20)
  2461.  
  2462. if skillLevel > 0:
  2463. if self.HasSkillLevelDescription(skillIndex, skillLevel):
  2464. self.AppendSpace(5)
  2465. if skillGrade == skill.SKILL_GRADE_COUNT:
  2466. pass
  2467.  
  2468. elif skillLevel == skillMaxLevelEnd:
  2469. self.AppendTextLine(localeInfo.TOOLTIP_SKILL_LEVEL_MASTER % (skillLevel), self.NORMAL_COLOR)
  2470.  
  2471. else:
  2472. self.AppendTextLine(localeInfo.TOOLTIP_SKILL_LEVEL % (skillLevel), self.NORMAL_COLOR)
  2473.  
  2474. self.AppendSkillLevelDescriptionNew(skillIndex, skillCurrentPercentage, self.ENABLE_COLOR)
  2475.  
  2476. if skillGrade != skill.SKILL_GRADE_COUNT:
  2477. if skillLevel < skillMaxLevelEnd:
  2478. if self.HasSkillLevelDescription(skillIndex, skillLevel+skillLevelUpPoint):
  2479. self.AppendSpace(5)
  2480.  
  2481. if skillIndex == 141 or skillIndex == 142:
  2482. self.AppendTextLine(localeInfo.TOOLTIP_NEXT_SKILL_LEVEL_3 % (skillLevel+1), self.DISABLE_COLOR)
  2483. else:
  2484. self.AppendTextLine(localeInfo.TOOLTIP_NEXT_SKILL_LEVEL_1 % (skillLevel+1, skillMaxLevelEnd), self.DISABLE_COLOR)
  2485.  
  2486. self.AppendSkillLevelDescriptionNew(skillIndex, skillNextPercentage, self.DISABLE_COLOR)
  2487.  
  2488. def AppendSkillLevelDescriptionNew(self, skillIndex, skillPercentage, color):
  2489. affectDataCount = skill.GetNewAffectDataCount(skillIndex)
  2490.  
  2491. if affectDataCount > 0:
  2492. for i in xrange(affectDataCount):
  2493. type, minValue, maxValue = skill.GetNewAffectData(skillIndex, i, skillPercentage)
  2494.  
  2495. if not self.AFFECT_NAME_DICT.has_key(type):
  2496. continue
  2497.  
  2498. minValue = int(minValue)
  2499. maxValue = int(maxValue)
  2500.  
  2501. affectText = self.AFFECT_NAME_DICT[type]
  2502.  
  2503. if "HP" == type:
  2504. if minValue < 0 and maxValue < 0:
  2505. minValue *= -1
  2506. maxValue *= -1
  2507.  
  2508. else:
  2509. affectText = localeInfo.TOOLTIP_SKILL_AFFECT_HEAL
  2510.  
  2511. affectText += str(minValue)
  2512. if minValue != maxValue:
  2513. affectText += " - " + str(maxValue)
  2514.  
  2515. affectText += self.AFFECT_APPEND_TEXT_DICT.get(type, "")
  2516.  
  2517. self.AppendTextLine(affectText, color)
  2518.  
  2519. else:
  2520. for i in xrange(skill.GetSkillAffectDescriptionCount(skillIndex)):
  2521. self.AppendTextLine(skill.GetSkillAffectDescription(skillIndex, i, skillPercentage), color)
  2522.  
  2523.  
  2524. duration = skill.GetDuration(skillIndex, skillPercentage)
  2525. if duration == 9999999:
  2526. self.AppendTextLine(localeInfo.SOCKET_PERMANENT, self.COLOR_SOCKET_PERMANENT)
  2527.  
  2528. elif duration > 0 and duration < 999999:
  2529. self.AppendTextLine(localeInfo.TOOLTIP_SKILL_DURATION % (duration), color)
  2530.  
  2531. coolTime = skill.GetSkillCoolTime(skillIndex, skillPercentage)
  2532. if coolTime > 0:
  2533. self.AppendTextLine(localeInfo.TOOLTIP_SKILL_COOL_TIME + str(coolTime), color)
  2534.  
  2535. needSP = skill.GetSkillNeedSP(skillIndex, skillPercentage)
  2536. if needSP != 0:
  2537. continuationSP = skill.GetSkillContinuationSP(skillIndex, skillPercentage)
  2538.  
  2539. if skill.IsUseHPSkill(skillIndex):
  2540. self.AppendNeedHP(needSP, continuationSP, color)
  2541. else:
  2542. self.AppendNeedSP(needSP, continuationSP, color)
  2543.  
  2544. def AppendSkillRequirement(self, skillIndex, skillLevel):
  2545.  
  2546. skillMaxLevel = skill.GetSkillMaxLevel(skillIndex)
  2547.  
  2548. if skillLevel >= skillMaxLevel:
  2549. return
  2550.  
  2551. isAppendHorizontalLine = FALSE
  2552.  
  2553. if skill.IsSkillRequirement(skillIndex):
  2554.  
  2555. if not isAppendHorizontalLine:
  2556. isAppendHorizontalLine = TRUE
  2557. self.AppendHorizontalLine()
  2558.  
  2559. requireSkillName, requireSkillLevel = skill.GetSkillRequirementData(skillIndex)
  2560.  
  2561. color = self.CANNOT_LEVEL_UP_COLOR
  2562. if skill.CheckRequirementSueccess(skillIndex):
  2563. color = self.CAN_LEVEL_UP_COLOR
  2564.  
  2565. self.AppendTextLine(localeInfo.TOOLTIP_REQUIREMENT_SKILL_LEVEL % (requireSkillName, requireSkillLevel), color)
  2566.  
  2567. requireStatCount = skill.GetSkillRequireStatCount(skillIndex)
  2568. if requireStatCount > 0:
  2569.  
  2570. for i in xrange(requireStatCount):
  2571. type, level = skill.GetSkillRequireStatData(skillIndex, i)
  2572. if self.POINT_NAME_DICT.has_key(type):
  2573.  
  2574. if not isAppendHorizontalLine:
  2575. isAppendHorizontalLine = TRUE
  2576. self.AppendHorizontalLine()
  2577.  
  2578. name = self.POINT_NAME_DICT[type]
  2579. color = self.CANNOT_LEVEL_UP_COLOR
  2580.  
  2581. if player.GetStatus(type) >= level:
  2582. color = self.CAN_LEVEL_UP_COLOR
  2583.  
  2584. self.AppendTextLine(localeInfo.TOOLTIP_REQUIREMENT_STAT_LEVEL % (name, level), color)
  2585.  
  2586. def HasSkillLevelDescription(self, skillIndex, skillLevel):
  2587. if skill.GetSkillAffectDescriptionCount(skillIndex) > 0:
  2588. return TRUE
  2589.  
  2590. if skill.GetSkillCoolTime(skillIndex, skillLevel) > 0:
  2591. return TRUE
  2592.  
  2593. if skill.GetSkillNeedSP(skillIndex, skillLevel) > 0:
  2594. return TRUE
  2595.  
  2596. return FALSE
  2597.  
  2598. def AppendMasterAffectDescription(self, index, desc, color):
  2599. self.AppendTextLine(desc, color)
  2600.  
  2601. def AppendNextAffectDescription(self, index, desc):
  2602. self.AppendTextLine(desc, self.DISABLE_COLOR)
  2603.  
  2604. def AppendNeedHP(self, needSP, continuationSP, color):
  2605.  
  2606. self.AppendTextLine(localeInfo.TOOLTIP_NEED_HP % (needSP), color)
  2607.  
  2608. if continuationSP > 0:
  2609. self.AppendTextLine(localeInfo.TOOLTIP_NEED_HP_PER_SEC % (continuationSP), color)
  2610.  
  2611. def AppendNeedSP(self, needSP, continuationSP, color):
  2612.  
  2613. if -1 == needSP:
  2614. self.AppendTextLine(localeInfo.TOOLTIP_NEED_ALL_SP, color)
  2615.  
  2616. else:
  2617. self.AppendTextLine(localeInfo.TOOLTIP_NEED_SP % (needSP), color)
  2618.  
  2619. if continuationSP > 0:
  2620. self.AppendTextLine(localeInfo.TOOLTIP_NEED_SP_PER_SEC % (continuationSP), color)
  2621.  
  2622. def AppendPartySkillData(self, skillGrade, skillLevel):
  2623.  
  2624. if 1 == skillGrade:
  2625. skillLevel += 19
  2626.  
  2627. elif 2 == skillGrade:
  2628. skillLevel += 29
  2629.  
  2630. elif 3 == skillGrade:
  2631. skillLevel = 40
  2632.  
  2633. if skillLevel <= 0:
  2634. return
  2635.  
  2636. skillIndex = player.SKILL_INDEX_TONGSOL
  2637. slotIndex = player.GetSkillSlotIndex(skillIndex)
  2638. skillPower = player.GetSkillCurrentEfficientPercentage(slotIndex)
  2639.  
  2640. k = player.GetSkillLevel(skillIndex) / 100.0
  2641.  
  2642. self.AppendSpace(5)
  2643. self.AutoAppendTextLine(localeInfo.TOOLTIP_PARTY_SKILL_LEVEL % skillLevel, self.NORMAL_COLOR)
  2644.  
  2645. if skillLevel>=10:
  2646. self.AutoAppendTextLine(localeInfo.PARTY_SKILL_ATTACKER % chop( 10 + 60 * k ))
  2647.  
  2648. if skillLevel>=20:
  2649. self.AutoAppendTextLine(localeInfo.PARTY_SKILL_BERSERKER % chop(1 + 5 * k))
  2650. self.AutoAppendTextLine(localeInfo.PARTY_SKILL_TANKER % chop(50 + 1450 * k))
  2651.  
  2652. if skillLevel>=25:
  2653. self.AutoAppendTextLine(localeInfo.PARTY_SKILL_BUFFER % chop(5 + 45 * k ))
  2654.  
  2655. if skillLevel>=35:
  2656. self.AutoAppendTextLine(localeInfo.PARTY_SKILL_SKILL_MASTER % chop(25 + 600 * k ))
  2657.  
  2658. if skillLevel>=40:
  2659. self.AutoAppendTextLine(localeInfo.PARTY_SKILL_DEFENDER % chop( 5 + 30 * k ))
  2660.  
  2661. self.AlignHorizonalCenter()
  2662.  
  2663. def __AppendSummonDescription(self, skillLevel, color):
  2664. if skillLevel > 1:
  2665. self.AppendTextLine(localeInfo.SKILL_SUMMON_DESCRIPTION % (skillLevel * 10), color)
  2666.  
  2667. elif 1 == skillLevel:
  2668. self.AppendTextLine(localeInfo.SKILL_SUMMON_DESCRIPTION % (15), color)
  2669.  
  2670. elif 0 == skillLevel:
  2671. self.AppendTextLine(localeInfo.SKILL_SUMMON_DESCRIPTION % (10), color)
  2672.  
  2673. if __name__ == "__main__":
  2674. import app
  2675. import wndMgr
  2676. import systemSetting
  2677. import mouseModule
  2678. import grp
  2679. import ui
  2680.  
  2681. app.SetMouseHandler(mouseModule.mouseController)
  2682. app.SetHairColorEnable(TRUE)
  2683.  
  2684. wndMgr.SetMouseHandler(mouseModule.mouseController)
  2685. wndMgr.SetScreenSize(systemSetting.GetWidth(), systemSetting.GetHeight())
  2686.  
  2687. app.Create("METIN2 CLOSED BETA", systemSetting.GetWidth(), systemSetting.GetHeight(), 1)
  2688.  
  2689. mouseModule.mouseController.Create()
  2690.  
  2691. toolTip = ItemToolTip()
  2692. toolTip.ClearToolTip()
  2693.  
  2694. 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."
  2695. summ = ""
  2696.  
  2697. toolTip.AddItemData_Offline(10, desc, summ, 0, 0)
  2698. toolTip.Show()
  2699.  
  2700. app.Loop()
  2701.  
Tags: uitooltip.py
Advertisement
Add Comment
Please, Sign In to add comment