Guest User

uitooltip

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