Advertisement
Guest User

Untitled

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