Advertisement
Guest User

uitooltip.py

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