Guest User

uitooltip

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