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