Untitled


SUBMITTED BY: Guest

DATE: Dec. 21, 2013, 12:26 a.m.

FORMAT: Text only

SIZE: 74.8 kB

HITS: 1195

  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 locale
  12. import app
  13. import background
  14. import nonplayer
  15. import chr
  16. import ui
  17. import mouseModule
  18. import constInfo
  19. WARP_SCROLLS = [22011, 22000, 22010]
  20. DESC_DEFAULT_MAX_COLS = 26
  21. DESC_WESTERN_MAX_COLS = 35
  22. DESC_WESTERN_MAX_WIDTH = 220
  23. def chop(n):
  24. return round(n - 0.5, 1)
  25. def SplitDescription(desc, limit):
  26. total_tokens = desc.split()
  27. line_tokens = []
  28. line_len = 0
  29. lines = []
  30. for token in total_tokens:
  31. if "|" in token:
  32. sep_pos = token.find("|")
  33. line_tokens.append(token[:sep_pos])
  34. lines.append(" ".join(line_tokens))
  35. line_len = len(token) - (sep_pos + 1)
  36. line_tokens = [token[sep_pos+1:]]
  37. else:
  38. line_len += len(token)
  39. if len(line_tokens) + line_len > limit:
  40. lines.append(" ".join(line_tokens))
  41. line_len = len(token)
  42. line_tokens = [token]
  43. else:
  44. line_tokens.append(token)
  45. if line_tokens:
  46. lines.append(" ".join(line_tokens))
  47. return lines
  48. ###################################################################################################
  49. ## ToolTip
  50. ##
  51. ## NOTE : ÇöŔç´Â Item°ú SkillŔ» »óĽÓŔ¸·Î ĆŻČ­ ˝ĂÄѵξúŔ˝
  52. ## ÇĎÁö¸¸ ±×´ŮÁö Ŕǹ̰ˇ ľřľî ş¸ŔÓ
  53. ##
  54. class ToolTip(ui.ThinBoard):
  55. TOOL_TIP_WIDTH = 190
  56. TOOL_TIP_HEIGHT = 10
  57. TEXT_LINE_HEIGHT = 17
  58. TITLE_COLOR = grp.GenerateColor(0.9490, 0.9058, 0.7568, 1.0)
  59. SPECIAL_TITLE_COLOR = grp.GenerateColor(1.0, 0.7843, 0.0, 1.0)
  60. NORMAL_COLOR = grp.GenerateColor(0.7607, 0.7607, 0.7607, 1.0)
  61. FONT_COLOR = grp.GenerateColor(0.7607, 0.7607, 0.7607, 1.0)
  62. PRICE_COLOR = 0xffFFB96D
  63. HIGH_PRICE_COLOR = SPECIAL_TITLE_COLOR
  64. MIDDLE_PRICE_COLOR = grp.GenerateColor(0.85, 0.85, 0.85, 1.0)
  65. LOW_PRICE_COLOR = grp.GenerateColor(0.7, 0.7, 0.7, 1.0)
  66. ENABLE_COLOR = grp.GenerateColor(0.7607, 0.7607, 0.7607, 1.0)
  67. DISABLE_COLOR = grp.GenerateColor(0.9, 0.4745, 0.4627, 1.0)
  68. NEGATIVE_COLOR = grp.GenerateColor(0.9, 0.4745, 0.4627, 1.0)
  69. POSITIVE_COLOR = grp.GenerateColor(0.5411, 0.7254, 0.5568, 1.0)
  70. SPECIAL_POSITIVE_COLOR = grp.GenerateColor(0.6911, 0.8754, 0.7068, 1.0)
  71. SPECIAL_POSITIVE_COLOR2 = grp.GenerateColor(0.8824, 0.9804, 0.8824, 1.0)
  72. CONDITION_COLOR = 0xffBEB47D
  73. CAN_LEVEL_UP_COLOR = 0xff8EC292
  74. CANNOT_LEVEL_UP_COLOR = DISABLE_COLOR
  75. NEED_SKILL_POINT_COLOR = 0xff9A9CDB
  76. def __init__(self, width = TOOL_TIP_WIDTH, isPickable=FALSE):
  77. ui.ThinBoard.__init__(self, "TOP_MOST")
  78. if isPickable:
  79. pass
  80. else:
  81. self.AddFlag("not_pick")
  82. self.AddFlag("float")
  83. self.followFlag = TRUE
  84. self.toolTipWidth = width
  85. self.xPos = -1
  86. self.yPos = -1
  87. self.defFontName = locale.UI_DEF_FONT
  88. self.ClearToolTip()
  89. def __del__(self):
  90. ui.ThinBoard.__del__(self)
  91. def ClearToolTip(self):
  92. self.toolTipHeight = 12
  93. self.childrenList = []
  94. def SetFollow(self, flag):
  95. self.followFlag = flag
  96. def SetDefaultFontName(self, fontName):
  97. self.defFontName = fontName
  98. def AppendSpace(self, size):
  99. self.toolTipHeight += size
  100. self.ResizeToolTip()
  101. def AppendHorizontalLine(self):
  102. for i in xrange(2):
  103. horizontalLine = ui.Line()
  104. horizontalLine.SetParent(self)
  105. horizontalLine.SetPosition(0, self.toolTipHeight + 3 + i)
  106. horizontalLine.SetWindowHorizontalAlignCenter()
  107. horizontalLine.SetSize(150, 0)
  108. horizontalLine.Show()
  109. if 0 == i:
  110. horizontalLine.SetColor(0xff555555)
  111. else:
  112. horizontalLine.SetColor(0xff000000)
  113. self.childrenList.append(horizontalLine)
  114. self.toolTipHeight += 11
  115. self.ResizeToolTip()
  116. def AlignHorizonalCenter(self):
  117. for child in self.childrenList:
  118. (x, y)=child.GetLocalPosition()
  119. child.SetPosition(self.toolTipWidth/2, y)
  120. self.ResizeToolTip()
  121. def AutoAppendTextLine(self, text, color = FONT_COLOR, centerAlign = TRUE):
  122. textLine = ui.TextLine()
  123. textLine.SetParent(self)
  124. textLine.SetFontName(self.defFontName)
  125. textLine.SetPackedFontColor(color)
  126. textLine.SetText(text)
  127. textLine.SetOutline()
  128. textLine.SetFeather(FALSE)
  129. textLine.Show()
  130. if centerAlign:
  131. textLine.SetPosition(self.toolTipWidth/2, self.toolTipHeight)
  132. textLine.SetHorizontalAlignCenter()
  133. else:
  134. textLine.SetPosition(10, self.toolTipHeight)
  135. self.childrenList.append(textLine)
  136. (textWidth, textHeight)=textLine.GetTextSize()
  137. textWidth += 40
  138. textHeight += 5
  139. if self.toolTipWidth < textWidth:
  140. self.toolTipWidth = textWidth
  141. self.toolTipHeight += textHeight
  142. return textLine
  143. def AppendTextLine(self, text, color = FONT_COLOR, centerAlign = TRUE):
  144. textLine = ui.TextLine()
  145. textLine.SetParent(self)
  146. textLine.SetFontName(self.defFontName)
  147. textLine.SetPackedFontColor(color)
  148. textLine.SetText(text)
  149. textLine.SetOutline()
  150. textLine.SetFeather(FALSE)
  151. textLine.Show()
  152. if centerAlign:
  153. textLine.SetPosition(self.toolTipWidth/2, self.toolTipHeight)
  154. textLine.SetHorizontalAlignCenter()
  155. else:
  156. textLine.SetPosition(10, self.toolTipHeight)
  157. self.childrenList.append(textLine)
  158. self.toolTipHeight += self.TEXT_LINE_HEIGHT
  159. self.ResizeToolTip()
  160. return textLine
  161. def AppendDescription(self, desc, limit, color = FONT_COLOR):
  162. if locale.IsEUROPE():
  163. self.__AppendDescription_WesternLanguage(desc, color)
  164. else:
  165. self.__AppendDescription_EasternLanguage(desc, limit, color)
  166. def __AppendDescription_EasternLanguage(self, description, characterLimitation, color=FONT_COLOR):
  167. length = len(description)
  168. if 0 == length:
  169. return
  170. lineCount = grpText.GetSplitingTextLineCount(description, characterLimitation)
  171. for i in xrange(lineCount):
  172. if 0 == i:
  173. self.AppendSpace(5)
  174. self.AppendTextLine(grpText.GetSplitingTextLine(description, characterLimitation, i), color)
  175. def __AppendDescription_WesternLanguage(self, desc, color=FONT_COLOR):
  176. lines = SplitDescription(desc, DESC_WESTERN_MAX_COLS)
  177. if not lines:
  178. return
  179. self.AppendSpace(5)
  180. for line in lines:
  181. self.AppendTextLine(line, color)
  182. def ResizeToolTip(self):
  183. self.SetSize(self.toolTipWidth, self.TOOL_TIP_HEIGHT + self.toolTipHeight)
  184. def SetTitle(self, name):
  185. self.AppendTextLine(name, self.TITLE_COLOR)
  186. def GetLimitTextLineColor(self, curValue, limitValue):
  187. if curValue < limitValue:
  188. return self.DISABLE_COLOR
  189. return self.ENABLE_COLOR
  190. def GetChangeTextLineColor(self, value, isSpecial=FALSE):
  191. if value > 0:
  192. if isSpecial:
  193. return self.SPECIAL_POSITIVE_COLOR
  194. else:
  195. return self.POSITIVE_COLOR
  196. if 0 == value:
  197. return self.NORMAL_COLOR
  198. return self.NEGATIVE_COLOR
  199. def SetToolTipPosition(self, x = -1, y = -1):
  200. self.xPos = x
  201. self.yPos = y
  202. def ShowToolTip(self):
  203. self.SetTop()
  204. self.Show()
  205. self.OnUpdate()
  206. def HideToolTip(self):
  207. self.Hide()
  208. def OnUpdate(self):
  209. if not self.followFlag:
  210. return
  211. x = 0
  212. y = 0
  213. width = self.GetWidth()
  214. height = self.toolTipHeight
  215. if -1 == self.xPos and -1 == self.yPos:
  216. (mouseX, mouseY) = wndMgr.GetMousePosition()
  217. if mouseY < wndMgr.GetScreenHeight() - 200:
  218. y = mouseY + 40
  219. else:
  220. y = mouseY - height - 30
  221. x = mouseX - width/2
  222. else:
  223. x = self.xPos - width/2
  224. y = self.yPos - height
  225. x = max(x, 0)
  226. y = max(y, 0)
  227. x = min(x + width/2, wndMgr.GetScreenWidth() - width/2) - width/2
  228. y = min(y + self.GetHeight(), wndMgr.GetScreenHeight()) - self.GetHeight()
  229. parentWindow = self.GetParentProxy()
  230. if parentWindow:
  231. (gx, gy) = parentWindow.GetGlobalPosition()
  232. x -= gx
  233. y -= gy
  234. self.SetPosition(x, y)
  235. class ItemToolTip(ToolTip):
  236. CHARACTER_NAMES = (
  237. locale.TOOLTIP_WARRIOR,
  238. locale.TOOLTIP_ASSASSIN,
  239. locale.TOOLTIP_SURA,
  240. locale.TOOLTIP_SHAMAN
  241. )
  242. CHARACTER_COUNT = len(CHARACTER_NAMES)
  243. WEAR_NAMES = (
  244. locale.TOOLTIP_ARMOR,
  245. locale.TOOLTIP_HELMET,
  246. locale.TOOLTIP_SHOES,
  247. locale.TOOLTIP_WRISTLET,
  248. locale.TOOLTIP_WEAPON,
  249. locale.TOOLTIP_NECK,
  250. locale.TOOLTIP_EAR,
  251. locale.TOOLTIP_UNIQUE,
  252. locale.TOOLTIP_SHIELD,
  253. locale.TOOLTIP_ARROW,
  254. )
  255. WEAR_COUNT = len(WEAR_NAMES)
  256. AFFECT_DICT = {
  257. item.APPLY_MAX_HP : locale.TOOLTIP_MAX_HP,
  258. item.APPLY_MAX_SP : locale.TOOLTIP_MAX_SP,
  259. item.APPLY_CON : locale.TOOLTIP_CON,
  260. item.APPLY_INT : locale.TOOLTIP_INT,
  261. item.APPLY_STR : locale.TOOLTIP_STR,
  262. item.APPLY_DEX : locale.TOOLTIP_DEX,
  263. item.APPLY_ATT_SPEED : locale.TOOLTIP_ATT_SPEED,
  264. item.APPLY_MOV_SPEED : locale.TOOLTIP_MOV_SPEED,
  265. item.APPLY_CAST_SPEED : locale.TOOLTIP_CAST_SPEED,
  266. item.APPLY_HP_REGEN : locale.TOOLTIP_HP_REGEN,
  267. item.APPLY_SP_REGEN : locale.TOOLTIP_SP_REGEN,
  268. item.APPLY_POISON_PCT : locale.TOOLTIP_APPLY_POISON_PCT,
  269. item.APPLY_STUN_PCT : locale.TOOLTIP_APPLY_STUN_PCT,
  270. item.APPLY_SLOW_PCT : locale.TOOLTIP_APPLY_SLOW_PCT,
  271. item.APPLY_CRITICAL_PCT : locale.TOOLTIP_APPLY_CRITICAL_PCT,
  272. item.APPLY_PENETRATE_PCT : locale.TOOLTIP_APPLY_PENETRATE_PCT,
  273. item.APPLY_ATTBONUS_WARRIOR : locale.TOOLTIP_APPLY_ATTBONUS_WARRIOR,
  274. item.APPLY_ATTBONUS_ASSASSIN : locale.TOOLTIP_APPLY_ATTBONUS_ASSASSIN,
  275. item.APPLY_ATTBONUS_SURA : locale.TOOLTIP_APPLY_ATTBONUS_SURA,
  276. item.APPLY_ATTBONUS_SHAMAN : locale.TOOLTIP_APPLY_ATTBONUS_SHAMAN,
  277. item.APPLY_ATTBONUS_MONSTER : locale.TOOLTIP_APPLY_ATTBONUS_MONSTER,
  278. item.APPLY_ATTBONUS_HUMAN : locale.TOOLTIP_APPLY_ATTBONUS_HUMAN,
  279. item.APPLY_ATTBONUS_ANIMAL : locale.TOOLTIP_APPLY_ATTBONUS_ANIMAL,
  280. item.APPLY_ATTBONUS_ORC : locale.TOOLTIP_APPLY_ATTBONUS_ORC,
  281. item.APPLY_ATTBONUS_MILGYO : locale.TOOLTIP_APPLY_ATTBONUS_MILGYO,
  282. item.APPLY_ATTBONUS_UNDEAD : locale.TOOLTIP_APPLY_ATTBONUS_UNDEAD,
  283. item.APPLY_ATTBONUS_DEVIL : locale.TOOLTIP_APPLY_ATTBONUS_DEVIL,
  284. item.APPLY_STEAL_HP : locale.TOOLTIP_APPLY_STEAL_HP,
  285. item.APPLY_STEAL_SP : locale.TOOLTIP_APPLY_STEAL_SP,
  286. item.APPLY_MANA_BURN_PCT : locale.TOOLTIP_APPLY_MANA_BURN_PCT,
  287. item.APPLY_DAMAGE_SP_RECOVER : locale.TOOLTIP_APPLY_DAMAGE_SP_RECOVER,
  288. item.APPLY_BLOCK : locale.TOOLTIP_APPLY_BLOCK,
  289. item.APPLY_DODGE : locale.TOOLTIP_APPLY_DODGE,
  290. item.APPLY_RESIST_SWORD : locale.TOOLTIP_APPLY_RESIST_SWORD,
  291. item.APPLY_RESIST_TWOHAND : locale.TOOLTIP_APPLY_RESIST_TWOHAND,
  292. item.APPLY_RESIST_DAGGER : locale.TOOLTIP_APPLY_RESIST_DAGGER,
  293. item.APPLY_RESIST_BELL : locale.TOOLTIP_APPLY_RESIST_BELL,
  294. item.APPLY_RESIST_FAN : locale.TOOLTIP_APPLY_RESIST_FAN,
  295. item.APPLY_RESIST_BOW : locale.TOOLTIP_RESIST_BOW,
  296. item.APPLY_RESIST_FIRE : locale.TOOLTIP_RESIST_FIRE,
  297. item.APPLY_RESIST_ELEC : locale.TOOLTIP_RESIST_ELEC,
  298. item.APPLY_RESIST_MAGIC : locale.TOOLTIP_RESIST_MAGIC,
  299. item.APPLY_RESIST_WIND : locale.TOOLTIP_APPLY_RESIST_WIND,
  300. item.APPLY_REFLECT_MELEE : locale.TOOLTIP_APPLY_REFLECT_MELEE,
  301. item.APPLY_REFLECT_CURSE : locale.TOOLTIP_APPLY_REFLECT_CURSE,
  302. item.APPLY_POISON_REDUCE : locale.TOOLTIP_APPLY_POISON_REDUCE,
  303. item.APPLY_KILL_SP_RECOVER : locale.TOOLTIP_APPLY_KILL_SP_RECOVER,
  304. item.APPLY_EXP_DOUBLE_BONUS : locale.TOOLTIP_APPLY_EXP_DOUBLE_BONUS,
  305. item.APPLY_GOLD_DOUBLE_BONUS : locale.TOOLTIP_APPLY_GOLD_DOUBLE_BONUS,
  306. item.APPLY_ITEM_DROP_BONUS : locale.TOOLTIP_APPLY_ITEM_DROP_BONUS,
  307. item.APPLY_POTION_BONUS : locale.TOOLTIP_APPLY_POTION_BONUS,
  308. item.APPLY_KILL_HP_RECOVER : locale.TOOLTIP_APPLY_KILL_HP_RECOVER,
  309. item.APPLY_IMMUNE_STUN : locale.TOOLTIP_APPLY_IMMUNE_STUN,
  310. item.APPLY_IMMUNE_SLOW : locale.TOOLTIP_APPLY_IMMUNE_SLOW,
  311. item.APPLY_IMMUNE_FALL : locale.TOOLTIP_APPLY_IMMUNE_FALL,
  312. item.APPLY_BOW_DISTANCE : locale.TOOLTIP_BOW_DISTANCE,
  313. 54 : locale.TOOLTIP_DEF_GRADE,
  314. 53 : locale.TOOLTIP_ATT_GRADE,
  315. item.APPLY_MAGIC_ATT_GRADE : locale.TOOLTIP_MAGIC_ATT_GRADE,
  316. item.APPLY_MAGIC_DEF_GRADE : locale.TOOLTIP_MAGIC_DEF_GRADE,
  317. item.APPLY_MAX_STAMINA : locale.TOOLTIP_MAX_STAMINA,
  318. item.APPLY_MALL_ATTBONUS : locale.TOOLTIP_MALL_ATTBONUS,
  319. item.APPLY_MALL_DEFBONUS : locale.TOOLTIP_MALL_DEFBONUS,
  320. item.APPLY_MALL_EXPBONUS : locale.TOOLTIP_MALL_EXPBONUS,
  321. item.APPLY_MALL_ITEMBONUS : locale.TOOLTIP_MALL_ITEMBONUS,
  322. item.APPLY_MALL_GOLDBONUS : locale.TOOLTIP_MALL_GOLDBONUS,
  323. item.APPLY_SKILL_DAMAGE_BONUS : locale.TOOLTIP_SKILL_DAMAGE_BONUS,
  324. item.APPLY_NORMAL_HIT_DAMAGE_BONUS : locale.TOOLTIP_NORMAL_HIT_DAMAGE_BONUS,
  325. item.APPLY_SKILL_DEFEND_BONUS : locale.TOOLTIP_SKILL_DEFEND_BONUS,
  326. item.APPLY_NORMAL_HIT_DEFEND_BONUS : locale.TOOLTIP_NORMAL_HIT_DEFEND_BONUS,
  327. item.APPLY_PC_BANG_EXP_BONUS : locale.TOOLTIP_MALL_EXPBONUS_P_STATIC,
  328. item.APPLY_PC_BANG_DROP_BONUS : locale.TOOLTIP_MALL_ITEMBONUS_P_STATIC,
  329. item.APPLY_RESIST_WARRIOR : locale.TOOLTIP_APPLY_RESIST_WARRIOR,
  330. item.APPLY_RESIST_ASSASSIN : locale.TOOLTIP_APPLY_RESIST_ASSASSIN,
  331. item.APPLY_RESIST_SURA : locale.TOOLTIP_APPLY_RESIST_SURA,
  332. item.APPLY_RESIST_SHAMAN : locale.TOOLTIP_APPLY_RESIST_SHAMAN,
  333. 599 : locale.TOOLTIP_ENERGY,
  334. 598 : locale.TOOLTIP_COSTUME_ATTR_BONUS,
  335. }
  336. ATTRIBUTE_NEED_WIDTH = {
  337. 23 : 230,
  338. 24 : 230,
  339. 25 : 230,
  340. 26 : 220,
  341. 27 : 210,
  342. 35 : 210,
  343. 36 : 210,
  344. 37 : 210,
  345. 38 : 210,
  346. 39 : 210,
  347. 40 : 210,
  348. 41 : 210,
  349. 42 : 220,
  350. 43 : 230,
  351. 45 : 230,
  352. }
  353. ANTI_FLAG_DICT = {
  354. 0 : item.ITEM_ANTIFLAG_WARRIOR,
  355. 1 : item.ITEM_ANTIFLAG_ASSASSIN,
  356. 2 : item.ITEM_ANTIFLAG_SURA,
  357. 3 : item.ITEM_ANTIFLAG_SHAMAN,
  358. }
  359. FONT_COLOR = grp.GenerateColor(0.7607, 0.7607, 0.7607, 1.0)
  360. def __init__(self, *args, **kwargs):
  361. ToolTip.__init__(self, *args, **kwargs)
  362. self.itemVnum = 0
  363. self.isShopItem = FALSE
  364. def __del__(self):
  365. ToolTip.__del__(self)
  366. def CanEquip(self):
  367. if not item.IsEquipmentVID(self.itemVnum):
  368. return TRUE
  369. race = player.GetRace()
  370. job = chr.RaceToJob(race)
  371. if not self.ANTI_FLAG_DICT.has_key(job):
  372. return FALSE
  373. if item.IsAntiFlag(self.ANTI_FLAG_DICT[job]):
  374. return FALSE
  375. sex = chr.RaceToSex(race)
  376. MALE = 1
  377. FEMALE = 0
  378. if item.IsAntiFlag(item.ITEM_ANTIFLAG_MALE) and sex == MALE:
  379. return FALSE
  380. if item.IsAntiFlag(item.ITEM_ANTIFLAG_FEMALE) and sex == FEMALE:
  381. return FALSE
  382. for i in xrange(item.LIMIT_MAX_NUM):
  383. (limitType, limitValue) = item.GetLimit(i)
  384. if item.LIMIT_LEVEL == limitType:
  385. if player.GetStatus(player.LEVEL) < limitValue:
  386. return FALSE
  387. """
  388. elif item.LIMIT_STR == limitType:
  389. if player.GetStatus(player.ST) < limitValue:
  390. return FALSE
  391. elif item.LIMIT_DEX == limitType:
  392. if player.GetStatus(player.DX) < limitValue:
  393. return FALSE
  394. elif item.LIMIT_INT == limitType:
  395. if player.GetStatus(player.IQ) < limitValue:
  396. return FALSE
  397. elif item.LIMIT_CON == limitType:
  398. if player.GetStatus(player.HT) < limitValue:
  399. return FALSE
  400. """
  401. return TRUE
  402. def AppendTextLine(self, text, color = FONT_COLOR, centerAlign = TRUE):
  403. if not self.CanEquip():
  404. color = self.DISABLE_COLOR
  405. return ToolTip.AppendTextLine(self, text, color, centerAlign)
  406. def ClearToolTip(self):
  407. self.isShopItem = FALSE
  408. self.toolTipWidth = self.TOOL_TIP_WIDTH
  409. ToolTip.ClearToolTip(self)
  410. def SetInventoryItem(self, slotIndex):
  411. itemVnum = player.GetItemIndex(slotIndex)
  412. if 0 == itemVnum:
  413. return
  414. self.ClearToolTip()
  415. if shop.IsOpen():
  416. if not shop.IsPrivateShop():
  417. item.SelectItem(itemVnum)
  418. self.AppendSellingPrice(player.GetISellItemPrice(slotIndex))
  419. metinSlot = [player.GetItemMetinSocket(slotIndex, i) for i in xrange(player.METIN_SOCKET_MAX_NUM)]
  420. attrSlot = [player.GetItemAttribute(slotIndex, i) for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM)]
  421. #print itemVnum, metinSlot, attrSlot
  422. self.AddItemData(itemVnum, metinSlot, attrSlot)
  423. def SetShopItem(self, slotIndex, addprice = 0, waltype = 0):
  424. itemVnum = shop.GetItemID(slotIndex)
  425. if 0 == itemVnum:
  426. return
  427. price = shop.GetItemPrice(slotIndex)
  428. self.ClearToolTip()
  429. self.isShopItem = TRUE
  430. item.SelectItem(itemVnum)
  431. metinSlot = []
  432. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  433. metinSlot.append(shop.GetItemMetinSocket(slotIndex, i))
  434. attrSlot = []
  435. for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  436. attrSlot.append(shop.GetItemAttribute(slotIndex, i))
  437. self.AddItemData(itemVnum, metinSlot, attrSlot)
  438. if waltype == 0:
  439. self.AppendPrice(price)
  440. else:
  441. self.AppendSpace(5)
  442. self.AppendTextLine("Cena: %s PP" % (locale.NumberToMoneyString(addprice)[:-5]), self.SPECIAL_TITLE_COLOR)
  443. def SetExchangeOwnerItem(self, slotIndex):
  444. itemVnum = exchange.GetItemVnumFromSelf(slotIndex)
  445. if 0 == itemVnum:
  446. return
  447. self.ClearToolTip()
  448. metinSlot = []
  449. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  450. metinSlot.append(exchange.GetItemMetinSocketFromSelf(slotIndex, i))
  451. attrSlot = []
  452. for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  453. attrSlot.append(exchange.GetItemAttributeFromSelf(slotIndex, i))
  454. self.AddItemData(itemVnum, metinSlot, attrSlot)
  455. def SetExchangeTargetItem(self, slotIndex):
  456. itemVnum = exchange.GetItemVnumFromTarget(slotIndex)
  457. if 0 == itemVnum:
  458. return
  459. self.ClearToolTip()
  460. metinSlot = []
  461. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  462. metinSlot.append(exchange.GetItemMetinSocketFromTarget(slotIndex, i))
  463. attrSlot = []
  464. for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  465. attrSlot.append(exchange.GetItemAttributeFromTarget(slotIndex, i))
  466. self.AddItemData(itemVnum, metinSlot, attrSlot)
  467. def SetPrivateShopBuilderItem(self, inventorySlotIndex, privateShopSlotIndex):
  468. itemVnum = player.GetItemIndex(inventorySlotIndex)
  469. if 0 == itemVnum:
  470. return
  471. item.SelectItem(itemVnum)
  472. self.ClearToolTip()
  473. self.AppendSellingPrice(shop.GetPrivateShopItemPrice(inventorySlotIndex))
  474. metinSlot = []
  475. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  476. metinSlot.append(player.GetItemMetinSocket(inventorySlotIndex, i))
  477. attrSlot = []
  478. for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  479. attrSlot.append(player.GetItemAttribute(inventorySlotIndex, i))
  480. self.AddItemData(itemVnum, metinSlot, attrSlot)
  481. def SetSafeBoxItem(self, slotIndex):
  482. itemVnum = safebox.GetItemID(slotIndex)
  483. if 0 == itemVnum:
  484. return
  485. self.ClearToolTip()
  486. metinSlot = []
  487. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  488. metinSlot.append(safebox.GetItemMetinSocket(slotIndex, i))
  489. attrSlot = []
  490. for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  491. attrSlot.append(safebox.GetItemAttribute(slotIndex, i))
  492. self.AddItemData(itemVnum, metinSlot, attrSlot)
  493. def SetMallItem(self, slotIndex):
  494. itemVnum = safebox.GetMallItemID(slotIndex)
  495. if 0 == itemVnum:
  496. return
  497. self.ClearToolTip()
  498. metinSlot = []
  499. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  500. metinSlot.append(safebox.GetMallItemMetinSocket(slotIndex, i))
  501. attrSlot = []
  502. for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  503. attrSlot.append(safebox.GetMallItemAttribute(slotIndex, i))
  504. self.AddItemData(itemVnum, metinSlot, attrSlot)
  505. def SetItemToolTip(self, itemVnum):
  506. self.ClearToolTip()
  507. metinSlot = []
  508. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  509. metinSlot.append(0)
  510. attrSlot = []
  511. for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  512. attrSlot.append((0, 0))
  513. self.AddItemData(itemVnum, metinSlot, attrSlot)
  514. def __AppendAttackSpeedInfo(self, item):
  515. atkSpd = item.GetValue(0)
  516. if atkSpd < 80:
  517. stSpd = locale.TOOLTIP_ITEM_VERY_FAST
  518. elif atkSpd <= 95:
  519. stSpd = locale.TOOLTIP_ITEM_FAST
  520. elif atkSpd <= 105:
  521. stSpd = locale.TOOLTIP_ITEM_NORMAL
  522. elif atkSpd <= 120:
  523. stSpd = locale.TOOLTIP_ITEM_SLOW
  524. else:
  525. stSpd = locale.TOOLTIP_ITEM_VERY_SLOW
  526. self.AppendTextLine(locale.TOOLTIP_ITEM_ATT_SPEED % stSpd, self.NORMAL_COLOR)
  527. def __AppendAttackGradeInfo(self):
  528. atkGrade = item.GetValue(1)
  529. self.AppendTextLine(locale.TOOLTIP_ITEM_ATT_GRADE % atkGrade, self.GetChangeTextLineColor(atkGrade))
  530. def __AppendAttackPowerInfo(self):
  531. minPower = item.GetValue(3)
  532. maxPower = item.GetValue(4)
  533. addPower = item.GetValue(5)
  534. if maxPower > minPower:
  535. self.AppendTextLine(locale.TOOLTIP_ITEM_ATT_POWER % (minPower+addPower, maxPower+addPower), self.POSITIVE_COLOR)
  536. else:
  537. self.AppendTextLine(locale.TOOLTIP_ITEM_ATT_POWER_ONE_ARG % (minPower+addPower), self.POSITIVE_COLOR)
  538. def __AppendMagicAttackInfo(self):
  539. minMagicAttackPower = item.GetValue(1)
  540. maxMagicAttackPower = item.GetValue(2)
  541. addPower = item.GetValue(5)
  542. if minMagicAttackPower > 0 or maxMagicAttackPower > 0:
  543. if maxMagicAttackPower > minMagicAttackPower:
  544. self.AppendTextLine(locale.TOOLTIP_ITEM_MAGIC_ATT_POWER % (minMagicAttackPower+addPower, maxMagicAttackPower+addPower), self.POSITIVE_COLOR)
  545. else:
  546. self.AppendTextLine(locale.TOOLTIP_ITEM_MAGIC_ATT_POWER_ONE_ARG % (minMagicAttackPower+addPower), self.POSITIVE_COLOR)
  547. def __AppendMagicDefenceInfo(self):
  548. magicDefencePower = item.GetValue(0)
  549. if magicDefencePower > 0:
  550. self.AppendTextLine(locale.TOOLTIP_ITEM_MAGIC_DEF_POWER % magicDefencePower, self.GetChangeTextLineColor(magicDefencePower))
  551. def __AppendAttributeInformation(self, attrSlot):
  552. if 0 != attrSlot:
  553. for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  554. type = attrSlot[i][0]
  555. value = attrSlot[i][1]
  556. if 0 == value:
  557. continue
  558. affectString = self.__GetAffectString(type, value)
  559. if affectString:
  560. affectColor = self.__GetAttributeColor(i, value)
  561. self.AppendTextLine(affectString, affectColor)
  562. def __GetAttributeColor(self, index, value):
  563. if value > 0:
  564. if index >= 5:
  565. return self.SPECIAL_POSITIVE_COLOR2
  566. else:
  567. return self.SPECIAL_POSITIVE_COLOR
  568. elif value == 0:
  569. return self.NORMAL_COLOR
  570. else:
  571. return self.NEGATIVE_COLOR
  572. def __IsPolymorphItem(self, itemVnum):
  573. if itemVnum >= 70103 and itemVnum <= 70106:
  574. return 1
  575. return 0
  576. def __SetPolymorphItemTitle(self, monsterVnum):
  577. if locale.IsVIETNAM():
  578. itemName =item.GetItemName()
  579. itemName+=" "
  580. itemName+=nonplayer.GetMonsterName(monsterVnum)
  581. else:
  582. itemName =nonplayer.GetMonsterName(monsterVnum)
  583. itemName+=" "
  584. itemName+=item.GetItemName()
  585. self.SetTitle(itemName)
  586. def __SetNormalItemTitle(self):
  587. self.SetTitle(item.GetItemName())
  588. def __SetSpecialItemTitle(self):
  589. self.AppendTextLine(item.GetItemName(), self.SPECIAL_TITLE_COLOR)
  590. def __SetItemTitle(self, itemVnum, metinSlot, attrSlot):
  591. if self.__IsPolymorphItem(itemVnum):
  592. self.__SetPolymorphItemTitle(metinSlot[0])
  593. else:
  594. if self.__IsAttr(attrSlot):
  595. self.__SetSpecialItemTitle()
  596. return
  597. self.__SetNormalItemTitle()
  598. def __IsAttr(self, attrSlot):
  599. if not attrSlot:
  600. return FALSE
  601. for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  602. type = attrSlot[i][0]
  603. if 0 != type:
  604. return TRUE
  605. return FALSE
  606. def AddRefineItemData(self, itemVnum, metinSlot, attrSlot = 0):
  607. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  608. metinSlotData=metinSlot[i]
  609. if self.GetMetinItemIndex(metinSlotData) == constInfo.ERROR_METIN_STONE:
  610. metinSlot[i]=player.METIN_SOCKET_TYPE_SILVER
  611. self.AddItemData(itemVnum, metinSlot, attrSlot)
  612. def AddItemData_Offline(self, itemVnum, itemDesc, itemSummary, metinSlot, attrSlot):
  613. self.__AdjustMaxWidth(attrSlot, itemDesc)
  614. self.__SetItemTitle(itemVnum, metinSlot, attrSlot)
  615. if self.__IsHair(itemVnum):
  616. self.__AppendHairIcon(itemVnum)
  617. ### Description ###
  618. self.AppendDescription(itemDesc, 26)
  619. self.AppendDescription(itemSummary, 26, self.CONDITION_COLOR)
  620. def AddItemData(self, itemVnum, metinSlot, attrSlot = 0):
  621. self.itemVnum = itemVnum
  622. item.SelectItem(itemVnum)
  623. itemType = item.GetItemType()
  624. itemSubType = item.GetItemSubType()
  625. if 50026 == itemVnum:
  626. if 0 != metinSlot:
  627. name = item.GetItemName()
  628. if metinSlot[0] > 0:
  629. name += " "
  630. name += locale.NumberToMoneyString(metinSlot[0])
  631. self.SetTitle(name)
  632. self.ShowToolTip()
  633. return
  634. ### Skill Book ###
  635. elif 50300 == itemVnum:
  636. if 0 != metinSlot:
  637. self.__SetSkillBookToolTip(metinSlot[0], locale.TOOLTIP_SKILLBOOK_NAME, 1)
  638. self.ShowToolTip()
  639. return
  640. elif 70037 == itemVnum:
  641. if 0 != metinSlot:
  642. self.__SetSkillBookToolTip(metinSlot[0], locale.TOOLTIP_SKILL_FORGET_BOOK_NAME, 0)
  643. self.AppendDescription(item.GetItemDescription(), 26)
  644. self.AppendDescription(item.GetItemSummary(), 26, self.CONDITION_COLOR)
  645. self.ShowToolTip()
  646. return
  647. elif 70055 == itemVnum:
  648. if 0 != metinSlot:
  649. self.__SetSkillBookToolTip(metinSlot[0], locale.TOOLTIP_SKILL_FORGET_BOOK_NAME, 0)
  650. self.AppendDescription(item.GetItemDescription(), 26)
  651. self.AppendDescription(item.GetItemSummary(), 26, self.CONDITION_COLOR)
  652. self.ShowToolTip()
  653. return
  654. elif itemVnum > 999889 and itemVnum <= 99998889:
  655. self.SetTitle(item.GetItemName())
  656. self.AppendDescription(item.GetItemDescription(), 26)
  657. if SuperTejm == 0:
  658. time = metinSlot[2]
  659. leftSec = max(0, time - app.GetGlobalTimeStamp())
  660. else:
  661. leftSec = SuperTejm
  662. self.AppendSpace(5)
  663. self.__AppendAffectInformation()
  664. self.AppendWearableInformation()
  665. self.AppendSpace(5)
  666. self.AppendTextLine("Pozostało: " + locale.SecondToDHM(leftSec), self.NORMAL_COLOR)
  667. self.ShowToolTip()
  668. return
  669. ###########################################################################################
  670. itemDesc = item.GetItemDescription()
  671. itemSummary = item.GetItemSummary()
  672. self.__AdjustMaxWidth(attrSlot, itemDesc)
  673. self.__SetItemTitle(itemVnum, metinSlot, attrSlot)
  674. if self.__IsHair(itemVnum):
  675. self.__AppendHairIcon(itemVnum)
  676. ### Description ###
  677. self.AppendDescription(itemDesc, 26)
  678. self.AppendDescription(itemSummary, 26, self.CONDITION_COLOR)
  679. ### Weapon ###
  680. if item.ITEM_TYPE_WEAPON == itemType:
  681. self.__AppendLimitInformation()
  682. self.AppendSpace(5)
  683. ## şÎäŔĎ °ćżě ¸¶°řŔ» ¸ŐŔú ÇĄ˝ĂÇŃ´Ů.
  684. if item.WEAPON_FAN == itemSubType:
  685. self.__AppendMagicAttackInfo()
  686. self.__AppendAttackPowerInfo()
  687. else:
  688. self.__AppendAttackPowerInfo()
  689. self.__AppendMagicAttackInfo()
  690. self.__AppendAffectInformation()
  691. self.__AppendAttributeInformation(attrSlot)
  692. self.AppendWearableInformation()
  693. self.__AppendMetinSlotInfo(metinSlot)
  694. ### Armor ###
  695. elif item.ITEM_TYPE_ARMOR == itemType:
  696. self.__AppendLimitInformation()
  697. ## ąćľî·Â
  698. defGrade = item.GetValue(1)
  699. defBonus = item.GetValue(5)*2 ## ąćľî·Â ÇĄ˝Ă Ŕ߸ř µÇ´Â ą®Á¦¸¦ ĽöÁ¤
  700. if defGrade > 0:
  701. self.AppendSpace(5)
  702. self.AppendTextLine(locale.TOOLTIP_ITEM_DEF_GRADE % (defGrade+defBonus), self.GetChangeTextLineColor(defGrade))
  703. self.__AppendMagicDefenceInfo()
  704. self.__AppendAffectInformation()
  705. self.__AppendAttributeInformation(attrSlot)
  706. self.AppendWearableInformation()
  707. if itemSubType in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
  708. self.__AppendAccessoryMetinSlotInfo(metinSlot, constInfo.GET_ACCESSORY_MATERIAL_VNUM(itemVnum, itemSubType))
  709. else:
  710. self.__AppendMetinSlotInfo(metinSlot)
  711. elif 0 != isCostumeItem:
  712. self.__AppendLimitInformation()
  713. self.__AppendAffectInformation()
  714. self.__AppendAttributeInformation(attrSlot)
  715. self.AppendWearableInformation()
  716. bHasRealtimeFlag = 0
  717. ## »çżë°ˇ´É ˝Ă°Ł Á¦ÇŃŔĚ ŔÖ´ÂÁö ĂŁľĆş¸°í
  718. for i in xrange(item.LIMIT_MAX_NUM):
  719. (limitType, limitValue) = item.GetLimit(i)
  720. if item.LIMIT_REAL_TIME == limitType:
  721. bHasRealtimeFlag = 1
  722. ## ŔÖ´Ů¸é °ü·Ă Á¤ş¸¸¦ ÇĄ˝ĂÇÔ. ex) ł˛Ŕş ˝Ă°Ł : 6ŔĎ 6˝Ă°Ł 58şĐ
  723. if 1 == bHasRealtimeFlag:
  724. self.AppendMallItemLastTime(metinSlot[0])
  725. #dbg.TraceError("1) REAL_TIME flag On ")
  726. ## Rod ##
  727. elif item.ITEM_TYPE_ROD == itemType:
  728. if 0 != metinSlot:
  729. curLevel = item.GetValue(0) / 10
  730. curEXP = metinSlot[0]
  731. maxEXP = item.GetValue(2)
  732. self.__AppendLimitInformation()
  733. self.__AppendRodInformation(curLevel, curEXP, maxEXP)
  734. ## Pick ##
  735. elif item.ITEM_TYPE_PICK == itemType:
  736. if 0 != metinSlot:
  737. curLevel = item.GetValue(0) / 10
  738. curEXP = metinSlot[0]
  739. maxEXP = item.GetValue(2)
  740. self.__AppendLimitInformation()
  741. self.__AppendPickInformation(curLevel, curEXP, maxEXP)
  742. ## Lottery ##
  743. elif item.ITEM_TYPE_LOTTERY == itemType:
  744. if 0 != metinSlot:
  745. ticketNumber = int(metinSlot[0])
  746. stepNumber = str(metinSlot[1])
  747. self.AppendSpace(5)
  748. self.AppendTextLine("Postać: %s" % (stepNumber), self.SPECIAL_TITLE_COLOR)
  749. ### Metin ###
  750. elif item.ITEM_TYPE_METIN == itemType:
  751. self.AppendMetinInformation()
  752. self.AppendMetinWearInformation()
  753. ### Fish ###
  754. elif item.ITEM_TYPE_FISH == itemType:
  755. if 0 != metinSlot:
  756. self.__AppendFishInfo(metinSlot[0])
  757. ## item.ITEM_TYPE_BLEND
  758. elif item.ITEM_TYPE_BLEND == itemType:
  759. self.__AppendLimitInformation()
  760. if metinSlot:
  761. affectType = metinSlot[0]
  762. affectValue = metinSlot[1]
  763. time = metinSlot[2]
  764. self.AppendSpace(5)
  765. affectText = self.__GetAffectString(affectType, affectValue)
  766. self.AppendTextLine(affectText, self.NORMAL_COLOR)
  767. if time > 0:
  768. minute = (time / 60)
  769. second = (time % 60)
  770. timeString = locale.TOOLTIP_POTION_TIME
  771. if minute > 0:
  772. timeString += str(minute) + locale.TOOLTIP_POTION_MIN
  773. if second > 0:
  774. timeString += " " + str(second) + locale.TOOLTIP_POTION_SEC
  775. self.AppendTextLine(timeString)
  776. else:
  777. self.AppendTextLine(locale.BLEND_POTION_NO_TIME)
  778. else:
  779. self.AppendTextLine("BLEND_POTION_NO_INFO")
  780. elif item.ITEM_TYPE_UNIQUE == itemType:
  781. if 0 != metinSlot:
  782. time = metinSlot[player.METIN_SOCKET_MAX_NUM-1]
  783. if 1 == item.GetValue(2): ## ˝Ç˝Ă°Ł ŔĚżë Flag / ŔĺÂř ľČÇصµ ÁŘ´Ů
  784. self.AppendMallItemLastTime(time)
  785. else:
  786. self.AppendUniqueItemLastTime(time)
  787. ### Use ###
  788. elif item.ITEM_TYPE_USE == itemType:
  789. self.__AppendLimitInformation()
  790. if item.USE_POTION == itemSubType or item.USE_POTION_NODELAY == itemSubType:
  791. self.__AppendPotionInformation()
  792. elif item.USE_ABILITY_UP == itemSubType:
  793. self.__AppendAbilityPotionInformation()
  794. ## żµĽ® °¨Áö±â
  795. if 27989 == itemVnum:
  796. if 0 != metinSlot:
  797. useCount = int(metinSlot[0])
  798. self.AppendSpace(5)
  799. self.AppendTextLine(locale.TOOLTIP_REST_USABLE_COUNT % (6 - useCount), self.NORMAL_COLOR)
  800. ## ŔĚşĄĆ® °¨Áö±â
  801. elif 50004 == itemVnum:
  802. if 0 != metinSlot:
  803. useCount = int(metinSlot[0])
  804. self.AppendSpace(5)
  805. self.AppendTextLine(locale.TOOLTIP_REST_USABLE_COUNT % (10 - useCount), self.NORMAL_COLOR)
  806. ## ŔÚµżą°ľŕ
  807. elif 72723 == itemVnum or 72724 == itemVnum:
  808. if 0 != metinSlot:
  809. ## 0: Č°ĽşČ­, 1: »çżë·®, 2: ĂŃ·®
  810. isActivated = int(metinSlot[0])
  811. usedAmount = float(metinSlot[1])
  812. totalAmount = float(metinSlot[2])
  813. if 0 == totalAmount:
  814. totalAmount = 1
  815. self.AppendSpace(5)
  816. if 0 != isActivated:
  817. self.AppendTextLine("(%s)" % (locale.TOOLTIP_AUTO_POTION_USING), self.SPECIAL_POSITIVE_COLOR)
  818. self.AppendSpace(5)
  819. self.AppendTextLine(locale.TOOLTIP_AUTO_POTION_REST % (100.0 - ((usedAmount / totalAmount) * 100.0)), self.POSITIVE_COLOR)
  820. ## ±ÍČŻ ±âľďşÎ
  821. elif itemVnum in WARP_SCROLLS:
  822. if 0 != metinSlot:
  823. xPos = int(metinSlot[0])
  824. yPos = int(metinSlot[1])
  825. if xPos != 0 and yPos != 0:
  826. (mapName, xBase, yBase) = background.GlobalPositionToMapInfo(xPos, yPos)
  827. localeMapName=locale.MINIMAP_ZONE_NAME_DICT.get(mapName, "")
  828. self.AppendSpace(5)
  829. if localeMapName!="":
  830. self.AppendTextLine(locale.TOOLTIP_MEMORIZED_POSITION % (localeMapName, int(xPos-xBase)/100, int(yPos-yBase)/100), self.NORMAL_COLOR)
  831. else:
  832. self.AppendTextLine(locale.TOOLTIP_MEMORIZED_POSITION_ERROR % (int(xPos)/100, int(yPos)/100), self.NORMAL_COLOR)
  833. dbg.TraceError("NOT_EXIST_IN_MINIMAP_ZONE_NAME_DICT: %s" % mapName)
  834. #####
  835. if item.USE_SPECIAL == itemSubType:
  836. if 0 != metinSlot:
  837. time = metinSlot[player.METIN_SOCKET_MAX_NUM-1]
  838. ## ˝Ç˝Ă°Ł ŔĚżë Flag
  839. if 1 == item.GetValue(2):
  840. self.AppendMallItemLastTime(time)
  841. else:
  842. self.__AppendLimitInformation()
  843. self.ShowToolTip()
  844. ## ÇěľîŔΰˇ?
  845. def __IsHair(self, itemVnum):
  846. return (self.__IsOldHair(itemVnum) or
  847. self.__IsNewHair(itemVnum) or
  848. self.__IsNewHair2(itemVnum) or
  849. self.__IsNewHair3(itemVnum) or
  850. self.__IsCostumeHair(itemVnum)
  851. )
  852. def __IsCostumeHair(self, itemVnum):
  853. return app.ENABLE_COSTUME_SYSTEM and self.__IsNewHair3(itemVnum - 100000)
  854. def __IsOldHair(self, itemVnum):
  855. return itemVnum > 73000 and itemVnum < 74000
  856. def __IsNewHair(self, itemVnum):
  857. return itemVnum > 74000 and itemVnum < 75000
  858. def __IsNewHair2(self, itemVnum):
  859. return itemVnum > 75000 and itemVnum < 77000
  860. def __IsNewHair3(self, itemVnum):
  861. return ((74012 < itemVnum and itemVnum < 74022) or
  862. (74262 < itemVnum and itemVnum < 74272) or
  863. (74512 < itemVnum and itemVnum < 74522) or
  864. (74762 < itemVnum and itemVnum < 74772) or
  865. (45000 < itemVnum and itemVnum < 47000))
  866. def __IsCostume(self, itemVnum):
  867. return itemVnum in [45018, 45017, 45016, 45015, 45014, 45013, 45012, 45011, 41114, 41113, 41112, 41111, 41110, 41109, 41108, 41107, 41106, 41105, 41104, 41103, 41102, 41101, 41100, 41099, 41098, 41097, 41096, 41095, 41094, 41093, 41092, 41091, 41090, 41089, 41088, 41087, 41086, 41085, 41054, 41053, 41052, 41051, 41050, 41049, 41048, 41047, 41046, 41045, 41044, 41043, 41042, 41041, 41040, 41039, 41038, 41037, 41036, 41035, 41034, 41033, 41032, 41031, 41030, 41029]
  868. def __AppendHairIcon(self, itemVnum):
  869. itemImage = ui.ImageBox()
  870. itemImage.SetParent(self)
  871. itemImage.Show()
  872. if self.__IsOldHair(itemVnum):
  873. itemImage.LoadImage("d:/ymir work/item/quest/"+str(itemVnum)+".tga")
  874. elif self.__IsNewHair3(itemVnum):
  875. itemImage.LoadImage("icon/hair/%d.sub" % (itemVnum))
  876. elif self.__IsNewHair(itemVnum): # ±âÁ¸ Çěľî ąřČŁ¸¦ ż¬°á˝ĂÄŃĽ­ »çżëÇŃ´Ů. »ő·Îżî ľĆŔĚĹŰŔş 1000¸¸Ĺ­ ąřČŁ°ˇ ´Ăľú´Ů.
  877. itemImage.LoadImage("d:/ymir work/item/quest/"+str(itemVnum-1000)+".tga")
  878. elif self.__IsNewHair2(itemVnum):
  879. itemImage.LoadImage("icon/hair/%d.sub" % (itemVnum))
  880. elif self.__IsCostumeHair(itemVnum):
  881. itemImage.LoadImage("icon/hair/%d.sub" % (itemVnum - 100000))
  882. itemImage.SetPosition(itemImage.GetWidth()/2, self.toolTipHeight)
  883. self.toolTipHeight += itemImage.GetHeight()
  884. #self.toolTipWidth += itemImage.GetWidth()/2
  885. self.childrenList.append(itemImage)
  886. self.ResizeToolTip()
  887. ## »çŔĚÁî°ˇ Ĺ« Description ŔĎ °ćżě ĹřĆÁ »çŔĚÁ Á¶Á¤ÇŃ´Ů
  888. def __AdjustMaxWidth(self, attrSlot, desc):
  889. newToolTipWidth = self.toolTipWidth
  890. newToolTipWidth = max(self.__AdjustAttrMaxWidth(attrSlot), newToolTipWidth)
  891. newToolTipWidth = max(self.__AdjustDescMaxWidth(desc), newToolTipWidth)
  892. if newToolTipWidth > self.toolTipWidth:
  893. self.toolTipWidth = newToolTipWidth
  894. self.ResizeToolTip()
  895. def __AdjustAttrMaxWidth(self, attrSlot):
  896. if 0 == attrSlot:
  897. return self.toolTipWidth
  898. maxWidth = self.toolTipWidth
  899. for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
  900. type = attrSlot[i][0]
  901. value = attrSlot[i][1]
  902. if self.ATTRIBUTE_NEED_WIDTH.has_key(type):
  903. if value > 0:
  904. maxWidth = max(self.ATTRIBUTE_NEED_WIDTH[type], maxWidth)
  905. # ATTR_CHANGE_TOOLTIP_WIDTH
  906. #self.toolTipWidth = max(self.ATTRIBUTE_NEED_WIDTH[type], self.toolTipWidth)
  907. #self.ResizeToolTip()
  908. # END_OF_ATTR_CHANGE_TOOLTIP_WIDTH
  909. return maxWidth
  910. def __AdjustDescMaxWidth(self, desc):
  911. if len(desc) < DESC_DEFAULT_MAX_COLS:
  912. return self.toolTipWidth
  913. return DESC_WESTERN_MAX_WIDTH
  914. def __SetSkillBookToolTip(self, skillIndex, bookName, skillGrade):
  915. skillName = skill.GetSkillName(skillIndex)
  916. if not skillName:
  917. return
  918. if locale.IsVIETNAM():
  919. itemName = bookName + " " + skillName
  920. else:
  921. itemName = skillName + " " + bookName
  922. self.SetTitle(itemName)
  923. def __AppendPickInformation(self, curLevel, curEXP, maxEXP):
  924. self.AppendSpace(5)
  925. self.AppendTextLine(locale.TOOLTIP_PICK_LEVEL % (curLevel), self.NORMAL_COLOR)
  926. self.AppendTextLine(locale.TOOLTIP_PICK_EXP % (curEXP, maxEXP), self.NORMAL_COLOR)
  927. if curEXP == maxEXP:
  928. self.AppendSpace(5)
  929. self.AppendTextLine(locale.TOOLTIP_PICK_UPGRADE1, self.NORMAL_COLOR)
  930. self.AppendTextLine(locale.TOOLTIP_PICK_UPGRADE2, self.NORMAL_COLOR)
  931. self.AppendTextLine(locale.TOOLTIP_PICK_UPGRADE3, self.NORMAL_COLOR)
  932. def __AppendRodInformation(self, curLevel, curEXP, maxEXP):
  933. self.AppendSpace(5)
  934. self.AppendTextLine(locale.TOOLTIP_FISHINGROD_LEVEL % (curLevel), self.NORMAL_COLOR)
  935. self.AppendTextLine(locale.TOOLTIP_FISHINGROD_EXP % (curEXP, maxEXP), self.NORMAL_COLOR)
  936. if curEXP == maxEXP:
  937. self.AppendSpace(5)
  938. self.AppendTextLine(locale.TOOLTIP_FISHINGROD_UPGRADE1, self.NORMAL_COLOR)
  939. self.AppendTextLine(locale.TOOLTIP_FISHINGROD_UPGRADE2, self.NORMAL_COLOR)
  940. self.AppendTextLine(locale.TOOLTIP_FISHINGROD_UPGRADE3, self.NORMAL_COLOR)
  941. def __AppendLimitInformation(self):
  942. appendSpace = FALSE
  943. for i in xrange(item.LIMIT_MAX_NUM):
  944. (limitType, limitValue) = item.GetLimit(i)
  945. if limitValue > 0:
  946. if FALSE == appendSpace:
  947. self.AppendSpace(5)
  948. appendSpace = TRUE
  949. else:
  950. continue
  951. if item.LIMIT_LEVEL == limitType:
  952. color = self.GetLimitTextLineColor(player.GetStatus(player.LEVEL), limitValue)
  953. self.AppendTextLine(locale.TOOLTIP_ITEM_LIMIT_LEVEL % (limitValue), color)
  954. """
  955. elif item.LIMIT_STR == limitType:
  956. color = self.GetLimitTextLineColor(player.GetStatus(player.ST), limitValue)
  957. self.AppendTextLine(locale.TOOLTIP_ITEM_LIMIT_STR % (limitValue), color)
  958. elif item.LIMIT_DEX == limitType:
  959. color = self.GetLimitTextLineColor(player.GetStatus(player.DX), limitValue)
  960. self.AppendTextLine(locale.TOOLTIP_ITEM_LIMIT_DEX % (limitValue), color)
  961. elif item.LIMIT_INT == limitType:
  962. color = self.GetLimitTextLineColor(player.GetStatus(player.IQ), limitValue)
  963. self.AppendTextLine(locale.TOOLTIP_ITEM_LIMIT_INT % (limitValue), color)
  964. elif item.LIMIT_CON == limitType:
  965. color = self.GetLimitTextLineColor(player.GetStatus(player.HT), limitValue)
  966. self.AppendTextLine(locale.TOOLTIP_ITEM_LIMIT_CON % (limitValue), color)
  967. """
  968. def __GetAffectString(self, affectType, affectValue):
  969. if 0 == affectType:
  970. return None
  971. if 0 == affectValue:
  972. return None
  973. try:
  974. return self.AFFECT_DICT[affectType](affectValue)
  975. except TypeError:
  976. return "UNKNOWN_VALUE[%s] %s" % (affectType, affectValue)
  977. except KeyError:
  978. return "UNKNOWN_TYPE[%s] %s" % (affectType, affectValue)
  979. def __AppendAffectInformation(self):
  980. for i in xrange(item.ITEM_APPLY_MAX_NUM):
  981. (affectType, affectValue) = item.GetAffect(i)
  982. affectString = self.__GetAffectString(affectType, affectValue)
  983. if affectString:
  984. self.AppendTextLine(affectString, self.GetChangeTextLineColor(affectValue))
  985. def AppendWearableInformation(self):
  986. self.AppendSpace(5)
  987. self.AppendTextLine(locale.TOOLTIP_ITEM_WEARABLE_JOB, self.NORMAL_COLOR)
  988. flagList = (
  989. not item.IsAntiFlag(item.ITEM_ANTIFLAG_WARRIOR),
  990. not item.IsAntiFlag(item.ITEM_ANTIFLAG_ASSASSIN),
  991. not item.IsAntiFlag(item.ITEM_ANTIFLAG_SURA),
  992. not item.IsAntiFlag(item.ITEM_ANTIFLAG_SHAMAN))
  993. characterNames = ""
  994. for i in xrange(self.CHARACTER_COUNT):
  995. name = self.CHARACTER_NAMES[i]
  996. flag = flagList[i]
  997. if flag:
  998. characterNames += " "
  999. characterNames += name
  1000. textLine = self.AppendTextLine(characterNames, self.NORMAL_COLOR, TRUE)
  1001. textLine.SetFeather()
  1002. if item.IsAntiFlag(item.ITEM_ANTIFLAG_MALE):
  1003. textLine = self.AppendTextLine(locale.FOR_FEMALE, self.NORMAL_COLOR, TRUE)
  1004. textLine.SetFeather()
  1005. if item.IsAntiFlag(item.ITEM_ANTIFLAG_FEMALE):
  1006. textLine = self.AppendTextLine(locale.FOR_MALE, self.NORMAL_COLOR, TRUE)
  1007. textLine.SetFeather()
  1008. def __AppendPotionInformation(self):
  1009. self.AppendSpace(5)
  1010. healHP = item.GetValue(0)
  1011. healSP = item.GetValue(1)
  1012. healStatus = item.GetValue(2)
  1013. healPercentageHP = item.GetValue(3)
  1014. healPercentageSP = item.GetValue(4)
  1015. if healHP > 0:
  1016. self.AppendTextLine(locale.TOOLTIP_POTION_PLUS_HP_POINT % healHP, self.GetChangeTextLineColor(healHP))
  1017. if healSP > 0:
  1018. self.AppendTextLine(locale.TOOLTIP_POTION_PLUS_SP_POINT % healSP, self.GetChangeTextLineColor(healSP))
  1019. if healStatus != 0:
  1020. self.AppendTextLine(locale.TOOLTIP_POTION_CURE)
  1021. if healPercentageHP > 0:
  1022. self.AppendTextLine(locale.TOOLTIP_POTION_PLUS_HP_PERCENT % healPercentageHP, self.GetChangeTextLineColor(healPercentageHP))
  1023. if healPercentageSP > 0:
  1024. self.AppendTextLine(locale.TOOLTIP_POTION_PLUS_SP_PERCENT % healPercentageSP, self.GetChangeTextLineColor(healPercentageSP))
  1025. def __AppendAbilityPotionInformation(self):
  1026. self.AppendSpace(5)
  1027. abilityType = item.GetValue(0)
  1028. time = item.GetValue(1)
  1029. point = item.GetValue(2)
  1030. if abilityType == item.APPLY_ATT_SPEED:
  1031. self.AppendTextLine(locale.TOOLTIP_POTION_PLUS_ATTACK_SPEED % point, self.GetChangeTextLineColor(point))
  1032. elif abilityType == item.APPLY_MOV_SPEED:
  1033. self.AppendTextLine(locale.TOOLTIP_POTION_PLUS_MOVING_SPEED % point, self.GetChangeTextLineColor(point))
  1034. if time > 0:
  1035. minute = (time / 60)
  1036. second = (time % 60)
  1037. timeString = locale.TOOLTIP_POTION_TIME
  1038. if minute > 0:
  1039. timeString += str(minute) + locale.TOOLTIP_POTION_MIN
  1040. if second > 0:
  1041. timeString += " " + str(second) + locale.TOOLTIP_POTION_SEC
  1042. self.AppendTextLine(timeString)
  1043. def GetPriceColor(self, price):
  1044. if price>=constInfo.HIGH_PRICE:
  1045. return self.HIGH_PRICE_COLOR
  1046. if price>=constInfo.MIDDLE_PRICE:
  1047. return self.MIDDLE_PRICE_COLOR
  1048. else:
  1049. return self.LOW_PRICE_COLOR
  1050. def AppendPrice(self, price):
  1051. self.AppendSpace(5)
  1052. self.AppendTextLine(locale.TOOLTIP_BUYPRICE % (locale.NumberToMoneyString(price)), self.GetPriceColor(price))
  1053. def AppendSellingPrice(self, price):
  1054. if item.IsAntiFlag(item.ITEM_ANTIFLAG_SELL):
  1055. self.AppendTextLine(locale.TOOLTIP_ANTI_SELL, self.DISABLE_COLOR)
  1056. self.AppendSpace(5)
  1057. else:
  1058. self.AppendTextLine(locale.TOOLTIP_SELLPRICE % (locale.NumberToMoneyString(price)), self.GetPriceColor(price))
  1059. self.AppendSpace(5)
  1060. def AppendMetinInformation(self):
  1061. affectType, affectValue = item.GetAffect(0)
  1062. #affectType = item.GetValue(0)
  1063. #affectValue = item.GetValue(1)
  1064. affectString = self.__GetAffectString(affectType, affectValue)
  1065. if affectString:
  1066. self.AppendSpace(5)
  1067. self.AppendTextLine(affectString, self.GetChangeTextLineColor(affectValue))
  1068. def AppendMetinWearInformation(self):
  1069. self.AppendSpace(5)
  1070. self.AppendTextLine(locale.TOOLTIP_SOCKET_REFINABLE_ITEM, self.NORMAL_COLOR)
  1071. flagList = (item.IsWearableFlag(item.WEARABLE_BODY),
  1072. item.IsWearableFlag(item.WEARABLE_HEAD),
  1073. item.IsWearableFlag(item.WEARABLE_FOOTS),
  1074. item.IsWearableFlag(item.WEARABLE_WRIST),
  1075. item.IsWearableFlag(item.WEARABLE_WEAPON),
  1076. item.IsWearableFlag(item.WEARABLE_NECK),
  1077. item.IsWearableFlag(item.WEARABLE_EAR),
  1078. item.IsWearableFlag(item.WEARABLE_UNIQUE),
  1079. item.IsWearableFlag(item.WEARABLE_SHIELD),
  1080. item.IsWearableFlag(item.WEARABLE_ARROW))
  1081. wearNames = ""
  1082. for i in xrange(self.WEAR_COUNT):
  1083. name = self.WEAR_NAMES[i]
  1084. flag = flagList[i]
  1085. if flag:
  1086. wearNames += " "
  1087. wearNames += name
  1088. textLine = ui.TextLine()
  1089. textLine.SetParent(self)
  1090. textLine.SetFontName(self.defFontName)
  1091. textLine.SetPosition(self.toolTipWidth/2, self.toolTipHeight)
  1092. textLine.SetHorizontalAlignCenter()
  1093. textLine.SetPackedFontColor(self.NORMAL_COLOR)
  1094. textLine.SetText(wearNames)
  1095. textLine.Show()
  1096. self.childrenList.append(textLine)
  1097. self.toolTipHeight += self.TEXT_LINE_HEIGHT
  1098. self.ResizeToolTip()
  1099. def GetMetinSocketType(self, number):
  1100. if player.METIN_SOCKET_TYPE_NONE == number:
  1101. return player.METIN_SOCKET_TYPE_NONE
  1102. elif player.METIN_SOCKET_TYPE_SILVER == number:
  1103. return player.METIN_SOCKET_TYPE_SILVER
  1104. elif player.METIN_SOCKET_TYPE_GOLD == number:
  1105. return player.METIN_SOCKET_TYPE_GOLD
  1106. else:
  1107. item.SelectItem(number)
  1108. if item.METIN_NORMAL == item.GetItemSubType():
  1109. return player.METIN_SOCKET_TYPE_SILVER
  1110. elif item.METIN_GOLD == item.GetItemSubType():
  1111. return player.METIN_SOCKET_TYPE_GOLD
  1112. elif "USE_PUT_INTO_ACCESSORY_SOCKET" == item.GetUseType(number):
  1113. return player.METIN_SOCKET_TYPE_SILVER
  1114. return player.METIN_SOCKET_TYPE_NONE
  1115. def GetMetinItemIndex(self, number):
  1116. if player.METIN_SOCKET_TYPE_SILVER == number:
  1117. return 0
  1118. if player.METIN_SOCKET_TYPE_GOLD == number:
  1119. return 0
  1120. return number
  1121. def __AppendAccessoryMetinSlotInfo(self, metinSlot, mtrlVnum):
  1122. ACCESSORY_SOCKET_MAX_SIZE = 3
  1123. cur=min(metinSlot[0], ACCESSORY_SOCKET_MAX_SIZE)
  1124. end=min(metinSlot[1], ACCESSORY_SOCKET_MAX_SIZE)
  1125. affectType1, affectValue1 = item.GetAffect(0)
  1126. affectList1=[0, max(1, affectValue1*10/100), max(2, affectValue1*20/100), max(3, affectValue1*40/100)]
  1127. affectType2, affectValue2 = item.GetAffect(1)
  1128. affectList2=[0, max(1, affectValue2*10/100), max(2, affectValue2*20/100), max(3, affectValue2*40/100)]
  1129. mtrlPos=0
  1130. mtrlList=[mtrlVnum]*cur+[player.METIN_SOCKET_TYPE_SILVER]*(end-cur)
  1131. for mtrl in mtrlList:
  1132. affectString1 = self.__GetAffectString(affectType1, affectList1[mtrlPos+1]-affectList1[mtrlPos])
  1133. affectString2 = self.__GetAffectString(affectType2, affectList2[mtrlPos+1]-affectList2[mtrlPos])
  1134. leftTime = 0
  1135. if cur == mtrlPos+1:
  1136. leftTime=metinSlot[2]
  1137. self.__AppendMetinSlotInfo_AppendMetinSocketData(mtrlPos, mtrl, affectString1, affectString2, leftTime)
  1138. mtrlPos+=1
  1139. def __AppendMetinSlotInfo(self, metinSlot):
  1140. if self.__AppendMetinSlotInfo_IsEmptySlotList(metinSlot):
  1141. return
  1142. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1143. self.__AppendMetinSlotInfo_AppendMetinSocketData(i, metinSlot[i])
  1144. def __AppendMetinSlotInfo_IsEmptySlotList(self, metinSlot):
  1145. if 0 == metinSlot:
  1146. return 1
  1147. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1148. metinSlotData=metinSlot[i]
  1149. if 0 != self.GetMetinSocketType(metinSlotData):
  1150. if 0 != self.GetMetinItemIndex(metinSlotData):
  1151. return 0
  1152. return 1
  1153. def __AppendMetinSlotInfo_AppendMetinSocketData(self, index, metinSlotData, custumAffectString="", custumAffectString2="", leftTime=0):
  1154. slotType = self.GetMetinSocketType(metinSlotData)
  1155. itemIndex = self.GetMetinItemIndex(metinSlotData)
  1156. if 0 == slotType:
  1157. return
  1158. self.AppendSpace(5)
  1159. slotImage = ui.ImageBox()
  1160. slotImage.SetParent(self)
  1161. slotImage.SetPosition(9, self.toolTipHeight-1)
  1162. slotImage.Show()
  1163. ## Name
  1164. nameTextLine = ui.TextLine()
  1165. nameTextLine.SetParent(self)
  1166. nameTextLine.SetFontName(self.defFontName)
  1167. nameTextLine.SetPackedFontColor(self.NORMAL_COLOR)
  1168. nameTextLine.SetPosition(50, self.toolTipHeight + 2)
  1169. nameTextLine.SetOutline()
  1170. nameTextLine.SetFeather()
  1171. nameTextLine.Show()
  1172. self.childrenList.append(nameTextLine)
  1173. if player.METIN_SOCKET_TYPE_SILVER == slotType:
  1174. slotImage.LoadImage("d:/ymir work/ui/game/windows/metin_slot_silver.sub")
  1175. elif player.METIN_SOCKET_TYPE_GOLD == slotType:
  1176. slotImage.LoadImage("d:/ymir work/ui/game/windows/metin_slot_gold.sub")
  1177. self.childrenList.append(slotImage)
  1178. metinImage = ui.ImageBox()
  1179. metinImage.SetParent(self)
  1180. metinImage.SetPosition(10, self.toolTipHeight)
  1181. metinImage.Show()
  1182. self.childrenList.append(metinImage)
  1183. if itemIndex:
  1184. item.SelectItem(itemIndex)
  1185. ## Image
  1186. try:
  1187. metinImage.LoadImage(item.GetIconImageFileName())
  1188. except:
  1189. dbg.TraceError("ItemToolTip.__AppendMetinSocketData() - Failed to find image file %d:%s" %
  1190. (itemIndex, item.GetIconImageFileName())
  1191. )
  1192. nameTextLine.SetText(item.GetItemName())
  1193. ## Affect
  1194. affectTextLine = ui.TextLine()
  1195. affectTextLine.SetParent(self)
  1196. affectTextLine.SetFontName(self.defFontName)
  1197. affectTextLine.SetPackedFontColor(self.POSITIVE_COLOR)
  1198. affectTextLine.SetPosition(50, self.toolTipHeight + 16 + 2)
  1199. affectTextLine.SetOutline()
  1200. affectTextLine.SetFeather()
  1201. affectTextLine.Show()
  1202. if custumAffectString:
  1203. affectTextLine.SetText(custumAffectString)
  1204. elif itemIndex!=constInfo.ERROR_METIN_STONE:
  1205. affectType, affectValue = item.GetAffect(0)
  1206. affectString = self.__GetAffectString(affectType, affectValue)
  1207. if affectString:
  1208. affectTextLine.SetText(affectString)
  1209. else:
  1210. affectTextLine.SetText(locale.TOOLTIP_APPLY_NOAFFECT)
  1211. self.childrenList.append(affectTextLine)
  1212. if custumAffectString2:
  1213. affectTextLine = ui.TextLine()
  1214. affectTextLine.SetParent(self)
  1215. affectTextLine.SetFontName(self.defFontName)
  1216. affectTextLine.SetPackedFontColor(self.POSITIVE_COLOR)
  1217. affectTextLine.SetPosition(50, self.toolTipHeight + 16 + 2 + 16 + 2)
  1218. affectTextLine.SetOutline()
  1219. affectTextLine.SetFeather()
  1220. affectTextLine.Show()
  1221. affectTextLine.SetText(custumAffectString2)
  1222. self.childrenList.append(affectTextLine)
  1223. self.toolTipHeight += 16 + 2
  1224. if 0 != leftTime:
  1225. timeText = (locale.LEFT_TIME + " : " + locale.SecondToDHM(leftTime))
  1226. timeTextLine = ui.TextLine()
  1227. timeTextLine.SetParent(self)
  1228. timeTextLine.SetFontName(self.defFontName)
  1229. timeTextLine.SetPackedFontColor(self.POSITIVE_COLOR)
  1230. timeTextLine.SetPosition(50, self.toolTipHeight + 16 + 2 + 16 + 2)
  1231. timeTextLine.SetOutline()
  1232. timeTextLine.SetFeather()
  1233. timeTextLine.Show()
  1234. timeTextLine.SetText(timeText)
  1235. self.childrenList.append(timeTextLine)
  1236. self.toolTipHeight += 16 + 2
  1237. else:
  1238. nameTextLine.SetText(locale.TOOLTIP_SOCKET_EMPTY)
  1239. self.toolTipHeight += 35
  1240. self.ResizeToolTip()
  1241. def __AppendFishInfo(self, size):
  1242. if size > 0:
  1243. self.AppendSpace(5)
  1244. self.AppendTextLine(locale.TOOLTIP_FISH_LEN % (float(size) / 100.0), self.NORMAL_COLOR)
  1245. def AppendUniqueItemLastTime(self, restMin):
  1246. restSecond = restMin*60
  1247. self.AppendSpace(5)
  1248. self.AppendTextLine(locale.LEFT_TIME + " : " + locale.SecondToHM(restSecond), self.NORMAL_COLOR)
  1249. def AppendMallItemLastTime(self, endTime):
  1250. leftSec = max(0, endTime - app.GetGlobalTimeStamp())
  1251. self.AppendSpace(5)
  1252. self.AppendTextLine(locale.LEFT_TIME + " : " + locale.SecondToDHM(leftSec), self.NORMAL_COLOR)
  1253. class HyperlinkItemToolTip(ItemToolTip):
  1254. def __init__(self):
  1255. ItemToolTip.__init__(self, isPickable=TRUE)
  1256. def SetHyperlinkItem(self, tokens):
  1257. minTokenCount = 3 + player.METIN_SOCKET_MAX_NUM
  1258. maxTokenCount = minTokenCount + 2 * player.ATTRIBUTE_SLOT_MAX_NUM
  1259. if tokens and len(tokens) >= minTokenCount and len(tokens) <= maxTokenCount:
  1260. head, vnum, flag = tokens[:3]
  1261. itemVnum = int(vnum, 16)
  1262. metinSlot = [int(metin, 16) for metin in tokens[3:6]]
  1263. rests = tokens[6:]
  1264. if rests:
  1265. attrSlot = []
  1266. rests.reverse()
  1267. while rests:
  1268. key = int(rests.pop(), 16)
  1269. if rests:
  1270. val = int(rests.pop())
  1271. attrSlot.append((key, val))
  1272. attrSlot += [(0, 0)] * (player.ATTRIBUTE_SLOT_MAX_NUM - len(attrSlot))
  1273. else:
  1274. attrSlot = [(0, 0)] * player.ATTRIBUTE_SLOT_MAX_NUM
  1275. self.ClearToolTip()
  1276. self.AddItemData(itemVnum, metinSlot, attrSlot)
  1277. ItemToolTip.OnUpdate(self)
  1278. def OnUpdate(self):
  1279. pass
  1280. def OnMouseLeftButtonDown(self):
  1281. self.Hide()
  1282. class SkillToolTip(ToolTip):
  1283. POINT_NAME_DICT = {
  1284. player.LEVEL : locale.SKILL_TOOLTIP_LEVEL,
  1285. player.IQ : locale.SKILL_TOOLTIP_INT,
  1286. }
  1287. SKILL_TOOL_TIP_WIDTH = 200
  1288. PARTY_SKILL_TOOL_TIP_WIDTH = 340
  1289. PARTY_SKILL_EXPERIENCE_AFFECT_LIST = ( ( 2, 2, 10,),
  1290. ( 8, 3, 20,),
  1291. (14, 4, 30,),
  1292. (22, 5, 45,),
  1293. (28, 6, 60,),
  1294. (34, 7, 80,),
  1295. (38, 8, 100,), )
  1296. PARTY_SKILL_PLUS_GRADE_AFFECT_LIST = ( ( 4, 2, 1, 0,),
  1297. (10, 3, 2, 0,),
  1298. (16, 4, 2, 1,),
  1299. (24, 5, 2, 2,), )
  1300. PARTY_SKILL_ATTACKER_AFFECT_LIST = ( ( 36, 3, ),
  1301. ( 26, 1, ),
  1302. ( 32, 2, ), )
  1303. SKILL_GRADE_NAME = { player.SKILL_GRADE_MASTER : locale.SKILL_GRADE_NAME_MASTER,
  1304. player.SKILL_GRADE_GRAND_MASTER : locale.SKILL_GRADE_NAME_GRAND_MASTER,
  1305. player.SKILL_GRADE_PERFECT_MASTER : locale.SKILL_GRADE_NAME_PERFECT_MASTER, }
  1306. AFFECT_NAME_DICT = {
  1307. "HP" : locale.TOOLTIP_SKILL_AFFECT_ATT_POWER,
  1308. "ATT_GRADE" : locale.TOOLTIP_SKILL_AFFECT_ATT_GRADE,
  1309. "DEF_GRADE" : locale.TOOLTIP_SKILL_AFFECT_DEF_GRADE,
  1310. "ATT_SPEED" : locale.TOOLTIP_SKILL_AFFECT_ATT_SPEED,
  1311. "MOV_SPEED" : locale.TOOLTIP_SKILL_AFFECT_MOV_SPEED,
  1312. "DODGE" : locale.TOOLTIP_SKILL_AFFECT_DODGE,
  1313. "RESIST_NORMAL" : locale.TOOLTIP_SKILL_AFFECT_RESIST_NORMAL,
  1314. "REFLECT_MELEE" : locale.TOOLTIP_SKILL_AFFECT_REFLECT_MELEE,
  1315. }
  1316. AFFECT_APPEND_TEXT_DICT = {
  1317. "DODGE" : "%",
  1318. "RESIST_NORMAL" : "%",
  1319. "REFLECT_MELEE" : "%",
  1320. }
  1321. def __init__(self):
  1322. ToolTip.__init__(self, self.SKILL_TOOL_TIP_WIDTH)
  1323. def __del__(self):
  1324. ToolTip.__del__(self)
  1325. def SetSkill(self, skillIndex, skillLevel = -1):
  1326. if 0 == skillIndex:
  1327. return
  1328. if skill.SKILL_TYPE_GUILD == skill.GetSkillType(skillIndex):
  1329. if self.SKILL_TOOL_TIP_WIDTH != self.toolTipWidth:
  1330. self.toolTipWidth = self.SKILL_TOOL_TIP_WIDTH
  1331. self.ResizeToolTip()
  1332. self.AppendDefaultData(skillIndex)
  1333. self.AppendSkillConditionData(skillIndex)
  1334. self.AppendGuildSkillData(skillIndex, skillLevel)
  1335. else:
  1336. if self.SKILL_TOOL_TIP_WIDTH != self.toolTipWidth:
  1337. self.toolTipWidth = self.SKILL_TOOL_TIP_WIDTH
  1338. self.ResizeToolTip()
  1339. slotIndex = player.GetSkillSlotIndex(skillIndex)
  1340. skillGrade = player.GetSkillGrade(slotIndex)
  1341. skillLevel = player.GetSkillLevel(slotIndex)
  1342. skillCurrentPercentage = player.GetSkillCurrentEfficientPercentage(slotIndex)
  1343. skillNextPercentage = player.GetSkillNextEfficientPercentage(slotIndex)
  1344. self.AppendDefaultData(skillIndex)
  1345. self.AppendSkillConditionData(skillIndex)
  1346. self.AppendSkillDataNew(slotIndex, skillIndex, skillGrade, skillLevel, skillCurrentPercentage, skillNextPercentage)
  1347. self.AppendSkillRequirement(skillIndex, skillLevel)
  1348. self.ShowToolTip()
  1349. def SetSkillNew(self, slotIndex, skillIndex, skillGrade, skillLevel):
  1350. if 0 == skillIndex:
  1351. return
  1352. if player.SKILL_INDEX_TONGSOL == skillIndex:
  1353. slotIndex = player.GetSkillSlotIndex(skillIndex)
  1354. skillLevel = player.GetSkillLevel(slotIndex)
  1355. self.AppendDefaultData(skillIndex)
  1356. self.AppendPartySkillData(skillGrade, skillLevel)
  1357. elif player.SKILL_INDEX_RIDING == skillIndex:
  1358. slotIndex = player.GetSkillSlotIndex(skillIndex)
  1359. self.AppendSupportSkillDefaultData(skillIndex, skillGrade, skillLevel, 30)
  1360. elif player.SKILL_INDEX_SUMMON == skillIndex:
  1361. maxLevel = 10
  1362. self.ClearToolTip()
  1363. self.__SetSkillTitle(skillIndex, skillGrade)
  1364. ## Description
  1365. description = skill.GetSkillDescription(skillIndex)
  1366. self.AppendDescription(description, 25)
  1367. if skillLevel == 10:
  1368. self.AppendSpace(5)
  1369. self.AppendTextLine(locale.TOOLTIP_SKILL_LEVEL_MASTER % (skillLevel), self.NORMAL_COLOR)
  1370. self.AppendTextLine(locale.SKILL_SUMMON_DESCRIPTION % (skillLevel*10), self.NORMAL_COLOR)
  1371. else:
  1372. self.AppendSpace(5)
  1373. self.AppendTextLine(locale.TOOLTIP_SKILL_LEVEL % (skillLevel), self.NORMAL_COLOR)
  1374. self.__AppendSummonDescription(skillLevel, self.NORMAL_COLOR)
  1375. self.AppendSpace(5)
  1376. self.AppendTextLine(locale.TOOLTIP_SKILL_LEVEL % (skillLevel+1), self.NEGATIVE_COLOR)
  1377. self.__AppendSummonDescription(skillLevel+1, self.NEGATIVE_COLOR)
  1378. elif skill.SKILL_TYPE_GUILD == skill.GetSkillType(skillIndex):
  1379. if self.SKILL_TOOL_TIP_WIDTH != self.toolTipWidth:
  1380. self.toolTipWidth = self.SKILL_TOOL_TIP_WIDTH
  1381. self.ResizeToolTip()
  1382. self.AppendDefaultData(skillIndex)
  1383. self.AppendSkillConditionData(skillIndex)
  1384. self.AppendGuildSkillData(skillIndex, skillLevel)
  1385. else:
  1386. if self.SKILL_TOOL_TIP_WIDTH != self.toolTipWidth:
  1387. self.toolTipWidth = self.SKILL_TOOL_TIP_WIDTH
  1388. self.ResizeToolTip()
  1389. slotIndex = player.GetSkillSlotIndex(skillIndex)
  1390. skillCurrentPercentage = player.GetSkillCurrentEfficientPercentage(slotIndex)
  1391. skillNextPercentage = player.GetSkillNextEfficientPercentage(slotIndex)
  1392. self.AppendDefaultData(skillIndex, skillGrade)
  1393. self.AppendSkillConditionData(skillIndex)
  1394. self.AppendSkillDataNew(slotIndex, skillIndex, skillGrade, skillLevel, skillCurrentPercentage, skillNextPercentage)
  1395. self.AppendSkillRequirement(skillIndex, skillLevel)
  1396. self.ShowToolTip()
  1397. def __SetSkillTitle(self, skillIndex, skillGrade):
  1398. self.SetTitle(skill.GetSkillName(skillIndex, skillGrade))
  1399. self.__AppendSkillGradeName(skillIndex, skillGrade)
  1400. def __AppendSkillGradeName(self, skillIndex, skillGrade):
  1401. if self.SKILL_GRADE_NAME.has_key(skillGrade):
  1402. self.AppendSpace(5)
  1403. self.AppendTextLine(self.SKILL_GRADE_NAME[skillGrade] % (skill.GetSkillName(skillIndex, 0)), self.CAN_LEVEL_UP_COLOR)
  1404. def SetSkillOnlyName(self, slotIndex, skillIndex, skillGrade):
  1405. if 0 == skillIndex:
  1406. return
  1407. slotIndex = player.GetSkillSlotIndex(skillIndex)
  1408. self.toolTipWidth = self.SKILL_TOOL_TIP_WIDTH
  1409. self.ResizeToolTip()
  1410. self.ClearToolTip()
  1411. self.__SetSkillTitle(skillIndex, skillGrade)
  1412. self.AppendDefaultData(skillIndex, skillGrade)
  1413. self.AppendSkillConditionData(skillIndex)
  1414. self.ShowToolTip()
  1415. def AppendDefaultData(self, skillIndex, skillGrade = 0):
  1416. self.ClearToolTip()
  1417. self.__SetSkillTitle(skillIndex, skillGrade)
  1418. ## Level Limit
  1419. levelLimit = skill.GetSkillLevelLimit(skillIndex)
  1420. if levelLimit > 0:
  1421. color = self.NORMAL_COLOR
  1422. if player.GetStatus(player.LEVEL) < levelLimit:
  1423. color = self.NEGATIVE_COLOR
  1424. self.AppendSpace(5)
  1425. self.AppendTextLine(locale.TOOLTIP_ITEM_LIMIT_LEVEL % (levelLimit), color)
  1426. ## Description
  1427. description = skill.GetSkillDescription(skillIndex)
  1428. self.AppendDescription(description, 25)
  1429. def AppendSupportSkillDefaultData(self, skillIndex, skillGrade, skillLevel, maxLevel):
  1430. self.ClearToolTip()
  1431. self.__SetSkillTitle(skillIndex, skillGrade)
  1432. ## Description
  1433. description = skill.GetSkillDescription(skillIndex)
  1434. self.AppendDescription(description, 25)
  1435. if 1 == skillGrade:
  1436. skillLevel += 19
  1437. elif 2 == skillGrade:
  1438. skillLevel += 29
  1439. elif 3 == skillGrade:
  1440. skillLevel = 40
  1441. self.AppendSpace(5)
  1442. self.AppendTextLine(locale.TOOLTIP_SKILL_LEVEL_WITH_MAX % (skillLevel, maxLevel), self.NORMAL_COLOR)
  1443. def AppendSkillConditionData(self, skillIndex):
  1444. conditionDataCount = skill.GetSkillConditionDescriptionCount(skillIndex)
  1445. if conditionDataCount > 0:
  1446. self.AppendSpace(5)
  1447. for i in xrange(conditionDataCount):
  1448. self.AppendTextLine(skill.GetSkillConditionDescription(skillIndex, i), self.CONDITION_COLOR)
  1449. def AppendGuildSkillData(self, skillIndex, skillLevel):
  1450. skillMaxLevel = 7
  1451. skillCurrentPercentage = float(skillLevel) / float(skillMaxLevel)
  1452. skillNextPercentage = float(skillLevel+1) / float(skillMaxLevel)
  1453. ## Current Level
  1454. if skillLevel > 0:
  1455. if self.HasSkillLevelDescription(skillIndex, skillLevel):
  1456. self.AppendSpace(5)
  1457. if skillLevel == skillMaxLevel:
  1458. self.AppendTextLine(locale.TOOLTIP_SKILL_LEVEL_MASTER % (skillLevel), self.NORMAL_COLOR)
  1459. else:
  1460. self.AppendTextLine(locale.TOOLTIP_SKILL_LEVEL % (skillLevel), self.NORMAL_COLOR)
  1461. #####
  1462. for i in xrange(skill.GetSkillAffectDescriptionCount(skillIndex)):
  1463. self.AppendTextLine(skill.GetSkillAffectDescription(skillIndex, i, skillCurrentPercentage), self.ENABLE_COLOR)
  1464. ## Cooltime
  1465. coolTime = skill.GetSkillCoolTime(skillIndex, skillCurrentPercentage)
  1466. if coolTime > 0:
  1467. self.AppendTextLine(locale.TOOLTIP_SKILL_COOL_TIME + str(coolTime), self.ENABLE_COLOR)
  1468. ## SP
  1469. needGSP = skill.GetSkillNeedSP(skillIndex, skillCurrentPercentage)
  1470. if needGSP > 0:
  1471. self.AppendTextLine(locale.TOOLTIP_NEED_GSP % (needGSP), self.ENABLE_COLOR)
  1472. ## Next Level
  1473. if skillLevel < skillMaxLevel:
  1474. if self.HasSkillLevelDescription(skillIndex, skillLevel+1):
  1475. self.AppendSpace(5)
  1476. self.AppendTextLine(locale.TOOLTIP_NEXT_SKILL_LEVEL_1 % (skillLevel+1, skillMaxLevel), self.DISABLE_COLOR)
  1477. #####
  1478. for i in xrange(skill.GetSkillAffectDescriptionCount(skillIndex)):
  1479. self.AppendTextLine(skill.GetSkillAffectDescription(skillIndex, i, skillNextPercentage), self.DISABLE_COLOR)
  1480. ## Cooltime
  1481. coolTime = skill.GetSkillCoolTime(skillIndex, skillNextPercentage)
  1482. if coolTime > 0:
  1483. self.AppendTextLine(locale.TOOLTIP_SKILL_COOL_TIME + str(coolTime), self.DISABLE_COLOR)
  1484. ## SP
  1485. needGSP = skill.GetSkillNeedSP(skillIndex, skillNextPercentage)
  1486. if needGSP > 0:
  1487. self.AppendTextLine(locale.TOOLTIP_NEED_GSP % (needGSP), self.DISABLE_COLOR)
  1488. def AppendSkillDataNew(self, slotIndex, skillIndex, skillGrade, skillLevel, skillCurrentPercentage, skillNextPercentage):
  1489. self.skillMaxLevelStartDict = { 0 : 17, 1 : 7, 2 : 10, }
  1490. self.skillMaxLevelEndDict = { 0 : 20, 1 : 10, 2 : 10, }
  1491. skillLevelUpPoint = 1
  1492. realSkillGrade = player.GetSkillGrade(slotIndex)
  1493. skillMaxLevelStart = self.skillMaxLevelStartDict.get(realSkillGrade, 15)
  1494. skillMaxLevelEnd = self.skillMaxLevelEndDict.get(realSkillGrade, 20)
  1495. ## Current Level
  1496. if skillLevel > 0:
  1497. if self.HasSkillLevelDescription(skillIndex, skillLevel):
  1498. self.AppendSpace(5)
  1499. if skillGrade == skill.SKILL_GRADE_COUNT:
  1500. pass
  1501. elif skillLevel == skillMaxLevelEnd:
  1502. self.AppendTextLine(locale.TOOLTIP_SKILL_LEVEL_MASTER % (skillLevel), self.NORMAL_COLOR)
  1503. else:
  1504. self.AppendTextLine(locale.TOOLTIP_SKILL_LEVEL % (skillLevel), self.NORMAL_COLOR)
  1505. self.AppendSkillLevelDescriptionNew(skillIndex, skillCurrentPercentage, self.ENABLE_COLOR)
  1506. ## Next Level
  1507. if skillGrade != skill.SKILL_GRADE_COUNT:
  1508. if skillLevel < skillMaxLevelEnd:
  1509. if self.HasSkillLevelDescription(skillIndex, skillLevel+skillLevelUpPoint):
  1510. self.AppendSpace(5)
  1511. ## HPş¸°­, °üĹëȸÇÇ ş¸Á¶˝şĹłŔÇ °ćżě
  1512. if skillIndex == 141 or skillIndex == 142:
  1513. self.AppendTextLine(locale.TOOLTIP_NEXT_SKILL_LEVEL_3 % (skillLevel+1), self.DISABLE_COLOR)
  1514. else:
  1515. self.AppendTextLine(locale.TOOLTIP_NEXT_SKILL_LEVEL_1 % (skillLevel+1, skillMaxLevelEnd), self.DISABLE_COLOR)
  1516. self.AppendSkillLevelDescriptionNew(skillIndex, skillNextPercentage, self.DISABLE_COLOR)
  1517. def AppendSkillLevelDescriptionNew(self, skillIndex, skillPercentage, color):
  1518. affectDataCount = skill.GetNewAffectDataCount(skillIndex)
  1519. if affectDataCount > 0:
  1520. for i in xrange(affectDataCount):
  1521. type, minValue, maxValue = skill.GetNewAffectData(skillIndex, i, skillPercentage)
  1522. if not self.AFFECT_NAME_DICT.has_key(type):
  1523. continue
  1524. minValue = int(minValue)
  1525. maxValue = int(maxValue)
  1526. affectText = self.AFFECT_NAME_DICT[type]
  1527. if "HP" == type:
  1528. if minValue < 0 and maxValue < 0:
  1529. minValue *= -1
  1530. maxValue *= -1
  1531. else:
  1532. affectText = locale.TOOLTIP_SKILL_AFFECT_HEAL
  1533. affectText += str(minValue)
  1534. if minValue != maxValue:
  1535. affectText += " - " + str(maxValue)
  1536. affectText += self.AFFECT_APPEND_TEXT_DICT.get(type, "")
  1537. #import debugInfo
  1538. #if debugInfo.IsDebugMode():
  1539. # affectText = "!!" + affectText
  1540. self.AppendTextLine(affectText, color)
  1541. else:
  1542. for i in xrange(skill.GetSkillAffectDescriptionCount(skillIndex)):
  1543. self.AppendTextLine(skill.GetSkillAffectDescription(skillIndex, i, skillPercentage), color)
  1544. ## Duration
  1545. duration = skill.GetDuration(skillIndex, skillPercentage)
  1546. if duration > 0:
  1547. self.AppendTextLine(locale.TOOLTIP_SKILL_DURATION % (duration), color)
  1548. ## Cooltime
  1549. coolTime = skill.GetSkillCoolTime(skillIndex, skillPercentage)
  1550. if coolTime > 0:
  1551. self.AppendTextLine(locale.TOOLTIP_SKILL_COOL_TIME + str(coolTime), color)
  1552. ## SP
  1553. needSP = skill.GetSkillNeedSP(skillIndex, skillPercentage)
  1554. if needSP != 0:
  1555. continuationSP = skill.GetSkillContinuationSP(skillIndex, skillPercentage)
  1556. if skill.IsUseHPSkill(skillIndex):
  1557. self.AppendNeedHP(needSP, continuationSP, color)
  1558. else:
  1559. self.AppendNeedSP(needSP, continuationSP, color)
  1560. def AppendSkillRequirement(self, skillIndex, skillLevel):
  1561. skillMaxLevel = skill.GetSkillMaxLevel(skillIndex)
  1562. if skillLevel >= skillMaxLevel:
  1563. return
  1564. isAppendHorizontalLine = FALSE
  1565. ## Requirement
  1566. if skill.IsSkillRequirement(skillIndex):
  1567. if not isAppendHorizontalLine:
  1568. isAppendHorizontalLine = TRUE
  1569. self.AppendHorizontalLine()
  1570. requireSkillName, requireSkillLevel = skill.GetSkillRequirementData(skillIndex)
  1571. color = self.CANNOT_LEVEL_UP_COLOR
  1572. if skill.CheckRequirementSueccess(skillIndex):
  1573. color = self.CAN_LEVEL_UP_COLOR
  1574. self.AppendTextLine(locale.TOOLTIP_REQUIREMENT_SKILL_LEVEL % (requireSkillName, requireSkillLevel), color)
  1575. ## Require Stat
  1576. requireStatCount = skill.GetSkillRequireStatCount(skillIndex)
  1577. if requireStatCount > 0:
  1578. for i in xrange(requireStatCount):
  1579. type, level = skill.GetSkillRequireStatData(skillIndex, i)
  1580. if self.POINT_NAME_DICT.has_key(type):
  1581. if not isAppendHorizontalLine:
  1582. isAppendHorizontalLine = TRUE
  1583. self.AppendHorizontalLine()
  1584. name = self.POINT_NAME_DICT[type]
  1585. color = self.CANNOT_LEVEL_UP_COLOR
  1586. if player.GetStatus(type) >= level:
  1587. color = self.CAN_LEVEL_UP_COLOR
  1588. self.AppendTextLine(locale.TOOLTIP_REQUIREMENT_STAT_LEVEL % (name, level), color)
  1589. def HasSkillLevelDescription(self, skillIndex, skillLevel):
  1590. if skill.GetSkillAffectDescriptionCount(skillIndex) > 0:
  1591. return TRUE
  1592. if skill.GetSkillCoolTime(skillIndex, skillLevel) > 0:
  1593. return TRUE
  1594. if skill.GetSkillNeedSP(skillIndex, skillLevel) > 0:
  1595. return TRUE
  1596. return FALSE
  1597. def AppendMasterAffectDescription(self, index, desc, color):
  1598. self.AppendTextLine(desc, color)
  1599. def AppendNextAffectDescription(self, index, desc):
  1600. self.AppendTextLine(desc, self.DISABLE_COLOR)
  1601. def AppendNeedHP(self, needSP, continuationSP, color):
  1602. self.AppendTextLine(locale.TOOLTIP_NEED_HP % (needSP), color)
  1603. if continuationSP > 0:
  1604. self.AppendTextLine(locale.TOOLTIP_NEED_HP_PER_SEC % (continuationSP), color)
  1605. def AppendNeedSP(self, needSP, continuationSP, color):
  1606. if -1 == needSP:
  1607. self.AppendTextLine(locale.TOOLTIP_NEED_ALL_SP, color)
  1608. else:
  1609. self.AppendTextLine(locale.TOOLTIP_NEED_SP % (needSP), color)
  1610. if continuationSP > 0:
  1611. self.AppendTextLine(locale.TOOLTIP_NEED_SP_PER_SEC % (continuationSP), color)
  1612. def AppendPartySkillData(self, skillGrade, skillLevel):
  1613. if 1 == skillGrade:
  1614. skillLevel += 19
  1615. elif 2 == skillGrade:
  1616. skillLevel += 29
  1617. elif 3 == skillGrade:
  1618. skillLevel = 40
  1619. if skillLevel <= 0:
  1620. return
  1621. skillIndex = player.SKILL_INDEX_TONGSOL
  1622. slotIndex = player.GetSkillSlotIndex(skillIndex)
  1623. skillPower = player.GetSkillCurrentEfficientPercentage(slotIndex)
  1624. if locale.IsBRAZIL():
  1625. k = skillPower
  1626. else:
  1627. k = player.GetSkillLevel(skillIndex) / 100.0
  1628. self.AppendSpace(5)
  1629. self.AutoAppendTextLine(locale.TOOLTIP_PARTY_SKILL_LEVEL % skillLevel, self.NORMAL_COLOR)
  1630. if skillLevel>=10:
  1631. self.AutoAppendTextLine(locale.PARTY_SKILL_ATTACKER % chop( 10 + 60 * k ))
  1632. if skillLevel>=20:
  1633. self.AutoAppendTextLine(locale.PARTY_SKILL_BERSERKER % chop(1 + 5 * k))
  1634. self.AutoAppendTextLine(locale.PARTY_SKILL_TANKER % chop(50 + 1450 * k))
  1635. if skillLevel>=25:
  1636. self.AutoAppendTextLine(locale.PARTY_SKILL_BUFFER % chop(5 + 45 * k ))
  1637. if skillLevel>=35:
  1638. self.AutoAppendTextLine(locale.PARTY_SKILL_SKILL_MASTER % chop(25 + 600 * k ))
  1639. if skillLevel>=40:
  1640. self.AutoAppendTextLine(locale.PARTY_SKILL_DEFENDER % chop( 5 + 30 * k ))
  1641. self.AlignHorizonalCenter()
  1642. def __AppendSummonDescription(self, skillLevel, color):
  1643. if skillLevel > 1:
  1644. self.AppendTextLine(locale.SKILL_SUMMON_DESCRIPTION % (skillLevel * 10), color)
  1645. elif 1 == skillLevel:
  1646. self.AppendTextLine(locale.SKILL_SUMMON_DESCRIPTION % (15), color)
  1647. elif 0 == skillLevel:
  1648. self.AppendTextLine(locale.SKILL_SUMMON_DESCRIPTION % (10), color)
  1649. if __name__ == "__main__":
  1650. import app
  1651. import wndMgr
  1652. import systemSetting
  1653. import mouseModule
  1654. import grp
  1655. import ui
  1656. #wndMgr.SetOutlineFlag(TRUE)
  1657. app.SetMouseHandler(mouseModule.mouseController)
  1658. app.SetHairColorEnable(TRUE)
  1659. wndMgr.SetMouseHandler(mouseModule.mouseController)
  1660. wndMgr.SetScreenSize(systemSetting.GetWidth(), systemSetting.GetHeight())
  1661. app.Create("METIN2 CLOSED BETA", systemSetting.GetWidth(), systemSetting.GetHeight(), 1)
  1662. mouseModule.mouseController.Create()
  1663. toolTip = ItemToolTip()
  1664. toolTip.ClearToolTip()
  1665. #toolTip.AppendTextLine("Test")
  1666. 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."
  1667. summ = ""
  1668. toolTip.AddItemData_Offline(10, desc, summ, 0, 0)
  1669. toolTip.Show()
  1670. app.Loop()

comments powered by Disqus