Guest User

uitooltip.py

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