Advertisement
djfred9

uitooltip.py

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