Advertisement
Bambus3k

Untitled

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