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