Guest User

Untitled

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