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