Advertisement
Guest User

Untitled

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