Guest User

3

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