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