Guest User

uitooltip

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