MrP0wers

Untitled

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