xGalardo 13 Posted September 14, 2021 Share Posted September 14, 2021 (edited) Hi guys, I found a "bug" in the target information system, namely, if I scroll down for many items and then open a monster that doesn't drop anything, the scrollbar stays there. I found a fix for it, put it in, but it didn't solve my problem. Image: Bug Thanks in advance for your help! Edited September 4, 2022 by Metin2 Dev Core X - External 2 Internal 1 Link to comment Share on other sites More sharing options...
Schyck 13 Posted September 14, 2021 Share Posted September 14, 2021 # In the InfoBoard class: (uiTarget.py) # 1 def __init__(self): ui.ThinBoard.__init__(self) self.HideCorners(self.LT) self.HideCorners(self.RT) self.HideLine(self.T) self.race = 0 self.hasItems = False self.itemTooltip = uiToolTip.ItemToolTip() self.itemTooltip.HideToolTip() self.stoneImg = None self.stoneVnum = None self.lastStoneVnum = 0 self.nextStoneIconChange = 0 self.itemScrollBar = None # Add this line self.SetSize(self.BOARD_WIDTH, 0) # 2 def Close(self): self.itemTooltip.HideToolTip() self.itemScrollBar = None # Add this line self.Hide() Link to comment Share on other sites More sharing options...
xGalardo 13 Posted September 14, 2021 Author Share Posted September 14, 2021 (edited) Thanks, but not work! class TargetBoard(ui.ThinBoard): if app.ENABLE_SEND_TARGET_INFO: class InfoBoard(ui.ThinBoard): class ItemListBoxItem(ui.ListBoxExNew.Item): def __init__(self, width): ui.ListBoxExNew.Item.__init__(self) image = ui.ExpandedImageBox() image.SetParent(self) image.Show() self.image = image nameLine = ui.TextLine() nameLine.SetParent(self) nameLine.SetPosition(32 + 5, 0) nameLine.Show() self.nameLine = nameLine if app.ENABLE_SEND_TARGET_INFO_EXTENDED: rarity = ui.TextLine() rarity.SetParent(self) rarity.SetPosition(32 + 5, 11) rarity.Show() self.rarity = rarity self.SetSize(width, 32 + 5) def LoadImage(self, image, name = None): self.image.LoadImage(image) self.SetSize(self.GetWidth(), self.image.GetHeight() + 5 * (self.image.GetHeight() / 32)) if name != None: self.SetText(name) def SetText(self, text): self.nameLine.SetText(text) if app.ENABLE_SEND_TARGET_INFO_EXTENDED: def SetRarity(self, rarity): if rarity <= 0: return real_rarity = rarity / 10000 self.rarity.SetText(str(self.GetRarity(real_rarity))) def GetRarity(self, rarity): if rarity >= 100: return "|cFFFFFFFFGarantált|r" elif rarity < 100 and rarity >= 70: return "|cFFFFFFFFÁtlagos|r" elif rarity < 70 and rarity >= 50: return "|cFF32CD32Átlagon felüli|r" elif rarity < 50 and rarity >= 30: return "|cFF9400D3Ritka|r" elif rarity < 30 and rarity >= 11: return "|cFF1E90FFEpikus|r" elif rarity <= 10: return "|cFFFFD700Legendás|r" return "" def RefreshHeight(self): ui.ListBoxExNew.Item.RefreshHeight(self) self.image.SetRenderingRect(0.0, 0.0 - float(self.removeTop) / float(self.GetHeight()), 0.0, 0.0 - float(self.removeBottom) / float(self.GetHeight())) self.image.SetPosition(0, - self.removeTop) MAX_ITEM_COUNT = 5 EXP_BASE_LVDELTA = [ 1, # -15 0 5, # -14 1 10, # -13 2 20, # -12 3 30, # -11 4 50, # -10 5 70, # -9 6 80, # -8 7 85, # -7 8 90, # -6 9 92, # -5 10 94, # -4 11 96, # -3 12 98, # -2 13 100, # -1 14 100, # 0 15 105, # 1 16 110, # 2 17 115, # 3 18 120, # 4 19 125, # 5 20 130, # 6 21 135, # 7 22 140, # 8 23 145, # 9 24 150, # 10 25 155, # 11 26 160, # 12 27 165, # 13 28 170, # 14 29 180, # 15 30 ] RACE_FLAG_TO_NAME = { 1 << 0 : localeInfo.TARGET_INFO_RACE_ANIMAL, 1 << 1 : localeInfo.TARGET_INFO_RACE_UNDEAD, 1 << 2 : localeInfo.TARGET_INFO_RACE_DEVIL, 1 << 3 : localeInfo.TARGET_INFO_RACE_HUMAN, 1 << 4 : localeInfo.TARGET_INFO_RACE_ORC, 1 << 5 : localeInfo.TARGET_INFO_RACE_MILGYO, 1 << 6 : localeInfo.TARGET_INFO_NEWRACE_INSECT, 1 << 7 : localeInfo.TARGET_INFO_NEWRACE_FIRE, 1 << 8 : localeInfo.TARGET_INFO_NEWRACE_ICE, 1 << 9 : localeInfo.TARGET_INFO_NEWRACE_DESERT, 1 << 10 : localeInfo.TARGET_INFO_NEWRACE_TREE, } SUB_RACE_FLAG_TO_NAME = { 1 << 11 : localeInfo.TARGET_INFO_RACE_ELEC, 1 << 12 : localeInfo.TARGET_INFO_RACE_FIRE, 1 << 13 : localeInfo.TARGET_INFO_RACE_ICE, 1 << 14 : localeInfo.TARGET_INFO_RACE_WIND, 1 << 15 : localeInfo.TARGET_INFO_RACE_EARTH, 1 << 16 : localeInfo.TARGET_INFO_RACE_DARK, } STONE_START_VNUM = 28030 STONE_LAST_VNUM = 28042 BOARD_WIDTH = 250 def __init__(self): ui.ThinBoard.__init__(self) self.HideCorners(self.LT) self.HideCorners(self.RT) self.HideLine(self.T) self.race = 0 self.hasItems = False self.itemTooltip = uiToolTip.ItemToolTip() self.itemTooltip.HideToolTip() self.stoneImg = None self.stoneVnum = None self.lastStoneVnum = 0 self.nextStoneIconChange = 0 self.itemScrollBar = None self.SetSize(self.BOARD_WIDTH, 0) def __del__(self): ui.ThinBoard.__del__(self) def __UpdatePosition(self, targetBoard): self.SetPosition(targetBoard.GetLeft() + (targetBoard.GetWidth() - self.GetWidth()) / 2, targetBoard.GetBottom() - 17) def Open(self, targetBoard, race): self.__LoadInformation(race) self.SetSize(self.BOARD_WIDTH, self.yPos + 10) self.__UpdatePosition(targetBoard) self.Show() def Refresh(self): self.__LoadInformation(self.race) self.SetSize(self.BOARD_WIDTH, self.yPos + 10) def Close(self): self.itemTooltip.HideToolTip() self.itemScrollBar = None self.Hide() def __LoadInformation(self, race): self.yPos = 7 self.children = [] self.race = race self.stoneImg = None self.stoneVnum = None self.nextStoneIconChange = 0 self.itemScrollBar = None self.__LoadInformation_Default(race) self.__LoadInformation_Race(race) self.__LoadInformation_Resists(race) self.__LoadInformation_Drops(race) def __LoadInformation_Default_GetHitRate(self, race): attacker_dx = nonplayer.GetMonsterDX(race) attacker_level = nonplayer.GetMonsterLevel(race) self_dx = player.GetStatus(player.DX) self_level = player.GetStatus(player.LEVEL) iARSrc = min(90, (attacker_dx * 4 + attacker_level * 2) / 6) iERSrc = min(90, (self_dx * 4 + self_level * 2) / 6) fAR = (float(iARSrc) + 210.0) / 300.0 fER = (float(iERSrc) * 2 + 5) / (float(iERSrc) + 95) * 3.0 / 10.0 return fAR - fER def __LoadInformation_Resists(self, race): self.AppendSeperator() self.AppendTextLine(localeInfo.TARGET_INFO_RESISTS) self.AppendTextLine(localeInfo.TARGET_INFO_RESISTS_LINE0 % (nonplayer.GetResist(race, nonplayer.MOB_RESIST_SWORD), nonplayer.GetResist(race, nonplayer.MOB_RESIST_TWOHAND), nonplayer.GetResist(race, nonplayer.MOB_RESIST_BELL))) self.AppendTextLine(localeInfo.TARGET_INFO_RESISTS_LINE1 % (nonplayer.GetResist(race, nonplayer.MOB_RESIST_DAGGER), nonplayer.GetResist(race, nonplayer.MOB_RESIST_FAN), nonplayer.GetResist(race, nonplayer.MOB_RESIST_BOW))) self.AppendTextLine(localeInfo.TARGET_INFO_RESISTS_LINE2 % (nonplayer.GetResist(race, nonplayer.MOB_RESIST_MAGIC))) def __LoadInformation_Default(self, race): self.AppendSeperator() self.AppendTextLine(localeInfo.TARGET_INFO_MAX_HP % localeInfo.DottedNumber(nonplayer.GetMonsterMaxHP(race))) # calc att damage monsterLevel = nonplayer.GetMonsterLevel(race) fHitRate = self.__LoadInformation_Default_GetHitRate(race) iDamMin, iDamMax = nonplayer.GetMonsterDamage(race) iDamMin = int((iDamMin + nonplayer.GetMonsterST(race)) * 2 * fHitRate) + monsterLevel * 2 iDamMax = int((iDamMax + nonplayer.GetMonsterST(race)) * 2 * fHitRate) + monsterLevel * 2 iDef = player.GetStatus(player.DEF_GRADE) * (100 + player.GetStatus(player.DEF_BONUS)) / 100 fDamMulti = nonplayer.GetMonsterDamageMultiply(race) iDamMin = int(max(0, iDamMin - iDef) * fDamMulti) iDamMax = int(max(0, iDamMax - iDef) * fDamMulti) if iDamMin < 1: iDamMin = 1 if iDamMax < 5: iDamMax = 5 self.AppendTextLine(localeInfo.TARGET_INFO_DAMAGE % (str(iDamMin), str(iDamMax))) idx = min(len(self.EXP_BASE_LVDELTA) - 1, max(0, (monsterLevel + 15) - player.GetStatus(player.LEVEL))) iExp = nonplayer.GetMonsterExp(race) * self.EXP_BASE_LVDELTA[idx] / 100 self.AppendTextLine(localeInfo.TARGET_INFO_EXP % localeInfo.DottedNumber(iExp)) self.AppendTextLine(localeInfo.TARGET_INFO_GOLD_MIN_MAX % (localeInfo.DottedNumber(nonplayer.GetMobGoldMin(race)), localeInfo.DottedNumber(nonplayer.GetMobGoldMax(race)))) self.AppendTextLine(localeInfo.TARGET_INFO_REGEN_INFO % (nonplayer.GetMobRegenPercent(race), nonplayer.GetMobRegenCycle(race))) def __LoadInformation_Race(self, race): dwRaceFlag = nonplayer.GetMonsterRaceFlag(race) self.AppendSeperator() mainrace = "" subrace = "" for i in xrange(17): curFlag = 1 << i if HAS_FLAG(dwRaceFlag, curFlag): if self.RACE_FLAG_TO_NAME.has_key(curFlag): mainrace += self.RACE_FLAG_TO_NAME[curFlag] + ", " elif self.SUB_RACE_FLAG_TO_NAME.has_key(curFlag): subrace += self.SUB_RACE_FLAG_TO_NAME[curFlag] + ", " if nonplayer.IsMonsterStone(race): mainrace += localeInfo.TARGET_INFO_RACE_METIN + ", " if mainrace == "": mainrace = localeInfo.TARGET_INFO_NO_RACE else: mainrace = mainrace[:-2] if subrace == "": subrace = localeInfo.TARGET_INFO_NO_RACE else: subrace = subrace[:-2] self.AppendTextLine(localeInfo.TARGET_INFO_MAINRACE % mainrace) self.AppendTextLine(localeInfo.TARGET_INFO_SUBRACE % subrace) def __LoadInformation_Drops(self, race): self.AppendSeperator() if race in MONSTER_INFO_DATA: if len(MONSTER_INFO_DATA[race]["items"]) == 0: if self.itemScrollBar.IsShow(): self.AppendTextLine(localeInfo.TARGET_INFO_NO_DEBUG) else: self.AppendTextLine(localeInfo.TARGET_INFO_NO_ITEM_TEXT) else: itemListBox = ui.ListBoxExNew(32 + 5, self.MAX_ITEM_COUNT) itemListBox.SetSize(self.GetWidth() - 15 * 2 - ui.ScrollBar.SCROLLBAR_WIDTH, (32 + 5) * self.MAX_ITEM_COUNT) height = 0 for curItem in MONSTER_INFO_DATA[race]["items"]: if curItem.has_key("vnum_list"): height += self.AppendItem(itemListBox, curItem["vnum_list"], curItem["count"], curItem["rarity"]) else: height += self.AppendItem(itemListBox, curItem["vnum"], curItem["count"], curItem["rarity"]) if height < itemListBox.GetHeight(): itemListBox.SetSize(itemListBox.GetWidth(), height) self.AppendWindow(itemListBox, 15) itemListBox.SetBasePos(0) if len(MONSTER_INFO_DATA[race]["items"]) > itemListBox.GetViewItemCount(): itemScrollBar = ui.ScrollBar() itemScrollBar.SetParent(self) itemScrollBar.SetPosition(itemListBox.GetRight(), itemListBox.GetTop()) itemScrollBar.SetScrollBarSize(32 * self.MAX_ITEM_COUNT + 5 * (self.MAX_ITEM_COUNT - 1)) itemScrollBar.SetMiddleBarSize(float(self.MAX_ITEM_COUNT) / float(height / (32 + 5))) itemScrollBar.Show() itemListBox.SetScrollBar(itemScrollBar) else: self.AppendTextLine(localeInfo.TARGET_INFO_NO_ITEM_TEXT) def AppendTextLine(self, text): textLine = ui.TextLine() textLine.SetParent(self) textLine.SetWindowHorizontalAlignCenter() textLine.SetHorizontalAlignCenter() textLine.SetText(text) textLine.SetPosition(0, self.yPos) textLine.Show() self.children.append(textLine) self.yPos += 17 def AppendSeperator(self): img = ui.ImageBox() img.LoadImage("d:/ymir work/ui/seperator.tga") self.AppendWindow(img) img.SetPosition(img.GetLeft(), img.GetTop() - 15) self.yPos -= 15 #def AppendItem(self, listBox, vnums, count): def AppendItem(self, listBox, vnums, count, rarity = 0): if type(vnums) == int: vnum = vnums else: vnum = vnums[0] item.SelectItem(vnum) itemName = item.GetItemName() if type(vnums) != int and len(vnums) > 1: vnums = sorted(vnums) realName = itemName[:itemName.find("+")] if item.GetItemType() == item.ITEM_TYPE_METIN: realName = localeInfo.TARGET_INFO_STONE_NAME itemName = realName + "+0 - +4" else: itemName = realName + "+" + str(vnums[0] % 10) + " - +" + str(vnums[len(vnums) - 1] % 10) vnum = vnums[len(vnums) - 1] myItem = self.ItemListBoxItem(listBox.GetWidth()) myItem.LoadImage(item.GetIconImageFileName()) if count <= 1: myItem.SetText(itemName) else: myItem.SetText("%dx %s" % (count, itemName)) if app.ENABLE_SEND_TARGET_INFO_EXTENDED: myItem.SetRarity(rarity) myItem.SAFE_SetOverInEvent(self.OnShowItemTooltip, vnum) myItem.SAFE_SetOverOutEvent(self.OnHideItemTooltip) listBox.AppendItem(myItem) if item.GetItemType() == item.ITEM_TYPE_METIN: self.stoneImg = myItem self.stoneVnum = vnums self.lastStoneVnum = self.STONE_LAST_VNUM + vnums[len(vnums) - 1] % 1000 / 100 * 100 return myItem.GetHeight() def OnShowItemTooltip(self, vnum): item.SelectItem(vnum) if item.GetItemType() == item.ITEM_TYPE_METIN: self.itemTooltip.isStone = True self.itemTooltip.isBook = False self.itemTooltip.isBook2 = False self.itemTooltip.SetItemToolTip(self.lastStoneVnum) else: self.itemTooltip.isStone = False self.itemTooltip.isBook = True self.itemTooltip.isBook2 = True self.itemTooltip.SetItemToolTip(vnum) def OnHideItemTooltip(self): self.itemTooltip.HideToolTip() def AppendWindow(self, wnd, x = 0, width = 0, height = 0): if width == 0: width = wnd.GetWidth() if height == 0: height = wnd.GetHeight() wnd.SetParent(self) if x == 0: wnd.SetPosition((self.GetWidth() - width) / 2, self.yPos) else: wnd.SetPosition(x, self.yPos) wnd.Show() self.children.append(wnd) self.yPos += height + 5 def OnUpdate(self): if self.stoneImg != None and self.stoneVnum != None and app.GetTime() >= self.nextStoneIconChange: nextImg = self.lastStoneVnum + 1 if nextImg % 100 > self.STONE_LAST_VNUM % 100: nextImg -= (self.STONE_LAST_VNUM - self.STONE_START_VNUM) + 1 self.lastStoneVnum = nextImg self.nextStoneIconChange = app.GetTime() + 2.5 item.SelectItem(nextImg) itemName = item.GetItemName() realName = itemName[:itemName.find("+")] realName = realName + "+0 - +4" self.stoneImg.LoadImage(item.GetIconImageFileName(), realName) if self.itemTooltip.IsShow() and self.itemTooltip.isStone: self.itemTooltip.SetItemToolTip(nextImg) Edited September 14, 2021 by xGalardo Link to comment Share on other sites More sharing options...
Schyck 13 Posted September 15, 2021 Share Posted September 15, 2021 #3 def __LoadInformation(self, race): self.yPos = 7 self.children = [] self.race = race self.stoneImg = None self.stoneVnum = None self.nextStoneIconChange = 0 self.__LoadInformation_Default(race) self.__LoadInformation_Race(race) self.__LoadInformation_Resists(race) self.__LoadInformation_Drops(race) #4 def __LoadInformation_Drops(self, race): self.AppendSeperator() if race in MONSTER_INFO_DATA: if len(MONSTER_INFO_DATA[race]["items"]) == 0: if self.itemScrollBar.IsShow(): self.AppendTextLine(localeInfo.TARGET_INFO_NO_DEBUG) else: self.AppendTextLine(localeInfo.TARGET_INFO_NO_ITEM_TEXT) else: itemListBox = ui.ListBoxExNew(32 + 5, self.MAX_ITEM_COUNT) itemListBox.SetSize(self.GetWidth() - 15 * 2 - ui.ScrollBar.SCROLLBAR_WIDTH, (32 + 5) * self.MAX_ITEM_COUNT) height = 0 for curItem in MONSTER_INFO_DATA[race]["items"]: if curItem.has_key("vnum_list"): height += self.AppendItem(itemListBox, curItem["vnum_list"], curItem["count"], curItem["rarity"]) else: height += self.AppendItem(itemListBox, curItem["vnum"], curItem["count"], curItem["rarity"]) if height < itemListBox.GetHeight(): itemListBox.SetSize(itemListBox.GetWidth(), height) self.AppendWindow(itemListBox, 15) itemListBox.SetBasePos(0) if len(MONSTER_INFO_DATA[race]["items"]) > itemListBox.GetViewItemCount(): itemScrollBar = ui.ScrollBar() itemScrollBar.SetParent(self) itemScrollBar.SetPosition(itemListBox.GetRight(), itemListBox.GetTop()) itemScrollBar.SetScrollBarSize(32 * self.MAX_ITEM_COUNT + 5 * (self.MAX_ITEM_COUNT - 1)) itemScrollBar.SetMiddleBarSize(float(self.MAX_ITEM_COUNT) / float(height / (32 + 5))) itemScrollBar.Show() itemListBox.SetScrollBar(itemScrollBar) self.itemScrollBar = itemScrollBar else: self.AppendTextLine(localeInfo.TARGET_INFO_NO_ITEM_TEXT) Link to comment Share on other sites More sharing options...
xGalardo 13 Posted September 15, 2021 Author Share Posted September 15, 2021 (edited) Not work. class TargetBoard(ui.ThinBoard): if app.ENABLE_SEND_TARGET_INFO: class InfoBoard(ui.ThinBoard): class ItemListBoxItem(ui.ListBoxExNew.Item): def __init__(self, width): ui.ListBoxExNew.Item.__init__(self) image = ui.ExpandedImageBox() image.SetParent(self) image.Show() self.image = image nameLine = ui.TextLine() nameLine.SetParent(self) nameLine.SetPosition(32 + 5, 0) nameLine.Show() self.nameLine = nameLine if app.ENABLE_SEND_TARGET_INFO_EXTENDED: rarity = ui.TextLine() rarity.SetParent(self) rarity.SetPosition(32 + 5, 11) rarity.Show() self.rarity = rarity self.SetSize(width, 32 + 5) def LoadImage(self, image, name = None): self.image.LoadImage(image) self.SetSize(self.GetWidth(), self.image.GetHeight() + 5 * (self.image.GetHeight() / 32)) if name != None: self.SetText(name) def SetText(self, text): self.nameLine.SetText(text) if app.ENABLE_SEND_TARGET_INFO_EXTENDED: def SetRarity(self, rarity): if rarity <= 0: return real_rarity = rarity / 10000 self.rarity.SetText(str(self.GetRarity(real_rarity))) def GetRarity(self, rarity): if rarity >= 100: return "|cFFFFFFFFGarantált|r" elif rarity < 100 and rarity >= 70: return "|cFFFFFFFFÁtlagos|r" elif rarity < 70 and rarity >= 50: return "|cFF32CD32Átlagon felüli|r" elif rarity < 50 and rarity >= 30: return "|cFF9400D3Ritka|r" elif rarity < 30 and rarity >= 11: return "|cFF1E90FFEpikus|r" elif rarity <= 10: return "|cFFFFD700Legendás|r" return "" def RefreshHeight(self): ui.ListBoxExNew.Item.RefreshHeight(self) self.image.SetRenderingRect(0.0, 0.0 - float(self.removeTop) / float(self.GetHeight()), 0.0, 0.0 - float(self.removeBottom) / float(self.GetHeight())) self.image.SetPosition(0, - self.removeTop) MAX_ITEM_COUNT = 5 EXP_BASE_LVDELTA = [ 1, # -15 0 5, # -14 1 10, # -13 2 20, # -12 3 30, # -11 4 50, # -10 5 70, # -9 6 80, # -8 7 85, # -7 8 90, # -6 9 92, # -5 10 94, # -4 11 96, # -3 12 98, # -2 13 100, # -1 14 100, # 0 15 105, # 1 16 110, # 2 17 115, # 3 18 120, # 4 19 125, # 5 20 130, # 6 21 135, # 7 22 140, # 8 23 145, # 9 24 150, # 10 25 155, # 11 26 160, # 12 27 165, # 13 28 170, # 14 29 180, # 15 30 ] RACE_FLAG_TO_NAME = { 1 << 0 : localeInfo.TARGET_INFO_RACE_ANIMAL, 1 << 1 : localeInfo.TARGET_INFO_RACE_UNDEAD, 1 << 2 : localeInfo.TARGET_INFO_RACE_DEVIL, 1 << 3 : localeInfo.TARGET_INFO_RACE_HUMAN, 1 << 4 : localeInfo.TARGET_INFO_RACE_ORC, 1 << 5 : localeInfo.TARGET_INFO_RACE_MILGYO, 1 << 6 : localeInfo.TARGET_INFO_NEWRACE_INSECT, 1 << 7 : localeInfo.TARGET_INFO_NEWRACE_FIRE, 1 << 8 : localeInfo.TARGET_INFO_NEWRACE_ICE, 1 << 9 : localeInfo.TARGET_INFO_NEWRACE_DESERT, 1 << 10 : localeInfo.TARGET_INFO_NEWRACE_TREE, } SUB_RACE_FLAG_TO_NAME = { 1 << 11 : localeInfo.TARGET_INFO_RACE_ELEC, 1 << 12 : localeInfo.TARGET_INFO_RACE_FIRE, 1 << 13 : localeInfo.TARGET_INFO_RACE_ICE, 1 << 14 : localeInfo.TARGET_INFO_RACE_WIND, 1 << 15 : localeInfo.TARGET_INFO_RACE_EARTH, 1 << 16 : localeInfo.TARGET_INFO_RACE_DARK, } STONE_START_VNUM = 28030 STONE_LAST_VNUM = 28042 BOARD_WIDTH = 250 def __init__(self): ui.ThinBoard.__init__(self) self.HideCorners(self.LT) self.HideCorners(self.RT) self.HideLine(self.T) self.race = 0 self.hasItems = False self.itemTooltip = uiToolTip.ItemToolTip() self.itemTooltip.HideToolTip() self.stoneImg = None self.stoneVnum = None self.lastStoneVnum = 0 self.nextStoneIconChange = 0 self.itemScrollBar = None self.SetSize(self.BOARD_WIDTH, 0) def __del__(self): ui.ThinBoard.__del__(self) def __UpdatePosition(self, targetBoard): self.SetPosition(targetBoard.GetLeft() + (targetBoard.GetWidth() - self.GetWidth()) / 2, targetBoard.GetBottom() - 17) def Open(self, targetBoard, race): self.__LoadInformation(race) self.SetSize(self.BOARD_WIDTH, self.yPos + 10) self.__UpdatePosition(targetBoard) self.Show() def Refresh(self): self.__LoadInformation(self.race) self.SetSize(self.BOARD_WIDTH, self.yPos + 10) def Close(self): self.itemTooltip.HideToolTip() self.itemScrollBar = None self.Hide() def __LoadInformation(self, race): self.yPos = 7 self.children = [] self.race = race self.stoneImg = None self.stoneVnum = None self.nextStoneIconChange = 0 self.__LoadInformation_Default(race) self.__LoadInformation_Race(race) self.__LoadInformation_Resists(race) self.__LoadInformation_Drops(race) def __LoadInformation_Default_GetHitRate(self, race): attacker_dx = nonplayer.GetMonsterDX(race) attacker_level = nonplayer.GetMonsterLevel(race) self_dx = player.GetStatus(player.DX) self_level = player.GetStatus(player.LEVEL) iARSrc = min(90, (attacker_dx * 4 + attacker_level * 2) / 6) iERSrc = min(90, (self_dx * 4 + self_level * 2) / 6) fAR = (float(iARSrc) + 210.0) / 300.0 fER = (float(iERSrc) * 2 + 5) / (float(iERSrc) + 95) * 3.0 / 10.0 return fAR - fER def __LoadInformation_Resists(self, race): self.AppendSeperator() self.AppendTextLine(localeInfo.TARGET_INFO_RESISTS) self.AppendTextLine(localeInfo.TARGET_INFO_RESISTS_LINE0 % (nonplayer.GetResist(race, nonplayer.MOB_RESIST_SWORD), nonplayer.GetResist(race, nonplayer.MOB_RESIST_TWOHAND), nonplayer.GetResist(race, nonplayer.MOB_RESIST_BELL))) self.AppendTextLine(localeInfo.TARGET_INFO_RESISTS_LINE1 % (nonplayer.GetResist(race, nonplayer.MOB_RESIST_DAGGER), nonplayer.GetResist(race, nonplayer.MOB_RESIST_FAN), nonplayer.GetResist(race, nonplayer.MOB_RESIST_BOW))) self.AppendTextLine(localeInfo.TARGET_INFO_RESISTS_LINE2 % (nonplayer.GetResist(race, nonplayer.MOB_RESIST_MAGIC))) def __LoadInformation_Default(self, race): self.AppendSeperator() self.AppendTextLine(localeInfo.TARGET_INFO_MAX_HP % localeInfo.DottedNumber(nonplayer.GetMonsterMaxHP(race))) # calc att damage monsterLevel = nonplayer.GetMonsterLevel(race) fHitRate = self.__LoadInformation_Default_GetHitRate(race) iDamMin, iDamMax = nonplayer.GetMonsterDamage(race) iDamMin = int((iDamMin + nonplayer.GetMonsterST(race)) * 2 * fHitRate) + monsterLevel * 2 iDamMax = int((iDamMax + nonplayer.GetMonsterST(race)) * 2 * fHitRate) + monsterLevel * 2 iDef = player.GetStatus(player.DEF_GRADE) * (100 + player.GetStatus(player.DEF_BONUS)) / 100 fDamMulti = nonplayer.GetMonsterDamageMultiply(race) iDamMin = int(max(0, iDamMin - iDef) * fDamMulti) iDamMax = int(max(0, iDamMax - iDef) * fDamMulti) if iDamMin < 1: iDamMin = 1 if iDamMax < 5: iDamMax = 5 self.AppendTextLine(localeInfo.TARGET_INFO_DAMAGE % (str(iDamMin), str(iDamMax))) idx = min(len(self.EXP_BASE_LVDELTA) - 1, max(0, (monsterLevel + 15) - player.GetStatus(player.LEVEL))) iExp = nonplayer.GetMonsterExp(race) * self.EXP_BASE_LVDELTA[idx] / 100 self.AppendTextLine(localeInfo.TARGET_INFO_EXP % localeInfo.DottedNumber(iExp)) self.AppendTextLine(localeInfo.TARGET_INFO_GOLD_MIN_MAX % (localeInfo.DottedNumber(nonplayer.GetMobGoldMin(race)), localeInfo.DottedNumber(nonplayer.GetMobGoldMax(race)))) self.AppendTextLine(localeInfo.TARGET_INFO_REGEN_INFO % (nonplayer.GetMobRegenPercent(race), nonplayer.GetMobRegenCycle(race))) def __LoadInformation_Race(self, race): dwRaceFlag = nonplayer.GetMonsterRaceFlag(race) self.AppendSeperator() mainrace = "" subrace = "" for i in xrange(17): curFlag = 1 << i if HAS_FLAG(dwRaceFlag, curFlag): if self.RACE_FLAG_TO_NAME.has_key(curFlag): mainrace += self.RACE_FLAG_TO_NAME[curFlag] + ", " elif self.SUB_RACE_FLAG_TO_NAME.has_key(curFlag): subrace += self.SUB_RACE_FLAG_TO_NAME[curFlag] + ", " if nonplayer.IsMonsterStone(race): mainrace += localeInfo.TARGET_INFO_RACE_METIN + ", " if mainrace == "": mainrace = localeInfo.TARGET_INFO_NO_RACE else: mainrace = mainrace[:-2] if subrace == "": subrace = localeInfo.TARGET_INFO_NO_RACE else: subrace = subrace[:-2] self.AppendTextLine(localeInfo.TARGET_INFO_MAINRACE % mainrace) self.AppendTextLine(localeInfo.TARGET_INFO_SUBRACE % subrace) def __LoadInformation_Drops(self, race): self.AppendSeperator() if race in MONSTER_INFO_DATA: if len(MONSTER_INFO_DATA[race]["items"]) == 0: if self.itemScrollBar.IsShow(): self.AppendTextLine(localeInfo.TARGET_INFO_NO_DEBUG) else: self.AppendTextLine(localeInfo.TARGET_INFO_NO_ITEM_TEXT) else: itemListBox = ui.ListBoxExNew(32 + 5, self.MAX_ITEM_COUNT) itemListBox.SetSize(self.GetWidth() - 15 * 2 - ui.ScrollBar.SCROLLBAR_WIDTH, (32 + 5) * self.MAX_ITEM_COUNT) height = 0 for curItem in MONSTER_INFO_DATA[race]["items"]: if curItem.has_key("vnum_list"): height += self.AppendItem(itemListBox, curItem["vnum_list"], curItem["count"], curItem["rarity"]) else: height += self.AppendItem(itemListBox, curItem["vnum"], curItem["count"], curItem["rarity"]) if height < itemListBox.GetHeight(): itemListBox.SetSize(itemListBox.GetWidth(), height) self.AppendWindow(itemListBox, 15) itemListBox.SetBasePos(0) if len(MONSTER_INFO_DATA[race]["items"]) > itemListBox.GetViewItemCount(): itemScrollBar = ui.ScrollBar() itemScrollBar.SetParent(self) itemScrollBar.SetPosition(itemListBox.GetRight(), itemListBox.GetTop()) itemScrollBar.SetScrollBarSize(32 * self.MAX_ITEM_COUNT + 5 * (self.MAX_ITEM_COUNT - 1)) itemScrollBar.SetMiddleBarSize(float(self.MAX_ITEM_COUNT) / float(height / (32 + 5))) itemScrollBar.Show() itemListBox.SetScrollBar(itemScrollBar) self.itemScrollBar = itemScrollBar else: self.AppendTextLine(localeInfo.TARGET_INFO_NO_ITEM_TEXT) def AppendTextLine(self, text): textLine = ui.TextLine() textLine.SetParent(self) textLine.SetWindowHorizontalAlignCenter() textLine.SetHorizontalAlignCenter() textLine.SetText(text) textLine.SetPosition(0, self.yPos) textLine.Show() self.children.append(textLine) self.yPos += 17 def AppendSeperator(self): img = ui.ImageBox() img.LoadImage("d:/ymir work/ui/seperator.tga") self.AppendWindow(img) img.SetPosition(img.GetLeft(), img.GetTop() - 15) self.yPos -= 15 #def AppendItem(self, listBox, vnums, count): def AppendItem(self, listBox, vnums, count, rarity = 0): if type(vnums) == int: vnum = vnums else: vnum = vnums[0] item.SelectItem(vnum) itemName = item.GetItemName() if type(vnums) != int and len(vnums) > 1: vnums = sorted(vnums) realName = itemName[:itemName.find("+")] if item.GetItemType() == item.ITEM_TYPE_METIN: realName = localeInfo.TARGET_INFO_STONE_NAME itemName = realName + "+0 - +4" else: itemName = realName + "+" + str(vnums[0] % 10) + " - +" + str(vnums[len(vnums) - 1] % 10) vnum = vnums[len(vnums) - 1] myItem = self.ItemListBoxItem(listBox.GetWidth()) myItem.LoadImage(item.GetIconImageFileName()) if count <= 1: myItem.SetText(itemName) else: myItem.SetText("%dx %s" % (count, itemName)) if app.ENABLE_SEND_TARGET_INFO_EXTENDED: myItem.SetRarity(rarity) myItem.SAFE_SetOverInEvent(self.OnShowItemTooltip, vnum) myItem.SAFE_SetOverOutEvent(self.OnHideItemTooltip) listBox.AppendItem(myItem) if item.GetItemType() == item.ITEM_TYPE_METIN: self.stoneImg = myItem self.stoneVnum = vnums self.lastStoneVnum = self.STONE_LAST_VNUM + vnums[len(vnums) - 1] % 1000 / 100 * 100 return myItem.GetHeight() def OnShowItemTooltip(self, vnum): item.SelectItem(vnum) if item.GetItemType() == item.ITEM_TYPE_METIN: self.itemTooltip.isStone = True self.itemTooltip.isBook = False self.itemTooltip.isBook2 = False self.itemTooltip.SetItemToolTip(self.lastStoneVnum) else: self.itemTooltip.isStone = False self.itemTooltip.isBook = True self.itemTooltip.isBook2 = True self.itemTooltip.SetItemToolTip(vnum) def OnHideItemTooltip(self): self.itemTooltip.HideToolTip() def AppendWindow(self, wnd, x = 0, width = 0, height = 0): if width == 0: width = wnd.GetWidth() if height == 0: height = wnd.GetHeight() wnd.SetParent(self) if x == 0: wnd.SetPosition((self.GetWidth() - width) / 2, self.yPos) else: wnd.SetPosition(x, self.yPos) wnd.Show() self.children.append(wnd) self.yPos += height + 5 def OnUpdate(self): if self.stoneImg != None and self.stoneVnum != None and app.GetTime() >= self.nextStoneIconChange: nextImg = self.lastStoneVnum + 1 if nextImg % 100 > self.STONE_LAST_VNUM % 100: nextImg -= (self.STONE_LAST_VNUM - self.STONE_START_VNUM) + 1 self.lastStoneVnum = nextImg self.nextStoneIconChange = app.GetTime() + 2.5 item.SelectItem(nextImg) itemName = item.GetItemName() realName = itemName[:itemName.find("+")] realName = realName + "+0 - +4" self.stoneImg.LoadImage(item.GetIconImageFileName(), realName) if self.itemTooltip.IsShow() and self.itemTooltip.isStone: self.itemTooltip.SetItemToolTip(nextImg) Edited September 15, 2021 by xGalardo Link to comment Share on other sites More sharing options...
xDiiZeRx 40 Posted September 16, 2021 Share Posted September 16, 2021 This is my problem too. Can anyone help me? Link to comment Share on other sites More sharing options...
xDiiZeRx 40 Posted September 17, 2021 Share Posted September 17, 2021 Up Link to comment Share on other sites More sharing options...
EAkar 8 Posted May 2, 2022 Share Posted May 2, 2022 I'm having the same problem. And I don't think anyone can solve it Link to comment Share on other sites More sharing options...
jegarba1996 1 Posted August 28, 2022 Share Posted August 28, 2022 up Link to comment Share on other sites More sharing options...
mgSHOCK 2 Posted November 13, 2022 Share Posted November 13, 2022 I'm having the same problem. Link to comment Share on other sites More sharing options...
Preet 0 Posted November 19, 2022 Share Posted November 19, 2022 (edited) Having the same problem. Would appreciate a fix/help! https://metin2.download/picture/2PbHnJ515W76RHmDiATZFnKF5foo776N/.gif Edited November 19, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now