Advertisement
Guest User

Untitled

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