Advertisement
Guest User

Untitled

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