Advertisement
Guest User

Untitled

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