Guest User

uitooltip.py

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