Honorable Member Owsap 8165 Posted June 17, 2022 Honorable Member Share Posted June 17, 2022 (edited) This is the hidden content, please Sign In or Sign Up Other Mirros This is the hidden content, please Sign In or Sign Up (GitHub) This is the hidden content, please Sign In or Sign Up (Mega) Hey M2Dev, I want to share something small but visually appreciated by players that are paying attention to details. What I'm sharing with you today will solve the issue of item tooltips with large strings, these strings overflow the width of the tooltip causing the text to hang out of the edge, especially when metin stones are attached to your weapon or armor. BEFORE PREVIEW Spoiler AFTER PREVIEW Spoiler . Edited June 17, 2022 by Owsap Corrected some flaws. 278 1 4 1 1 4 1 1 49 11 105 https://owsap.dev/ / https://osf.owsap.dev/ Link to comment Share on other sites More sharing options...
Hik 108 Posted June 17, 2022 Share Posted June 17, 2022 Thanks, that was annoying! 1 Link to comment Share on other sites More sharing options...
Active Member ReFresh 2339 Posted June 17, 2022 Active Member Share Posted June 17, 2022 (edited) @OwsapThanks, for the release. Good job! Would be nice, if you can do something like that for question dialogs too, because when you want to drop for example 1000x pcs of some item, the text will overflow the question dialog (sometimes it happens with lower counts of item, for example books, they have a long names). Do something like when the text can overflow the question dialog width, then add 20px to question dialog width. Edited June 17, 2022 by ReFresh 2 I'll be always helpful! Link to comment Share on other sites More sharing options...
Active+ Member HFWhite 497 Posted June 17, 2022 Active+ Member Share Posted June 17, 2022 (edited) The metin attach part is broken for me I did everything like the tutorial. it looks like this: Edited August 16, 2022 by Metin2 Dev Core X - External 2 Internal 1 3 Link to comment Share on other sites More sharing options...
Honorable Member Owsap 8165 Posted June 17, 2022 Author Honorable Member Share Posted June 17, 2022 (edited) 7 minutes ago, SCOOB said: The metin attach part is broken for me I did everything like the tutorial. it looks like this: Here is an example of the AttachMetinDialog, https://metin2.dev/bin/?d7f919364d8cf49c#2t1csJzQNkg9s4jk9tTS6DnEdtGzMPctDhDEwRnX1UMo Edited August 16, 2022 by Metin2 Dev Core X - External 2 Internal 1 https://owsap.dev/ / https://osf.owsap.dev/ Link to comment Share on other sites More sharing options...
Active+ Member HFWhite 497 Posted June 17, 2022 Active+ Member Share Posted June 17, 2022 (edited) 25 minutes ago, Owsap said: Here is an example of the AttachMetinDialog, https://metin2.dev/bin/?d7f919364d8cf49c#2t1csJzQNkg9s4jk9tTS6DnEdtGzMPctDhDEwRnX1UMo thank you, all's working fine now Spoiler Edited August 16, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Honorable Member Owsap 8165 Posted June 17, 2022 Author Honorable Member Share Posted June 17, 2022 (edited) 26 minutes ago, SCOOB said: thank you, all's working fine now Hide contents Found another problem.. If you're on a player character, some item names are corrupted, for example: Can you share with us your uittoltip.py? or do you know why does this problem occur? @ Owsap I don't believe this is related to the fix. No item positions, sockets, title names or bonus names where changed in any of the code, only the size of the thinboard. Edited August 16, 2022 by Metin2 Dev Core X - External 2 Internal https://owsap.dev/ / https://osf.owsap.dev/ Link to comment Share on other sites More sharing options...
Premium Syreldar 1875 Posted June 17, 2022 Premium Share Posted June 17, 2022 (edited) Two things @ Owsap. 1. For sure an overlook, this should be self.newTooltip.AddItemData(itemIndex, metinSlot) 2. You forgot to tell them to add this line: self.newToolTip.SetPosition(15 + self.oldToolTip.GetWidth() + 45, 38) Before if localeInfo.IsARABIC(): Edited August 16, 2022 by Metin2 Dev Core X - External 2 Internal 1 1 "Nothing's free in this life. Ignorant people have an obligation to make up for their ignorance by paying those who help them. Either you got the brains or cash, if you lack both you're useless." Syreldar Link to comment Share on other sites More sharing options...
Honorable Member Owsap 8165 Posted June 17, 2022 Author Honorable Member Share Posted June 17, 2022 (edited) 3 hours ago, Syreldar said: Two things @ Owsap. 1. For sure an overlook, this should be self.newTooltip.AddItemData(itemIndex, metinSlot) 2. You forgot to tell them to add this line: self.newToolTip.SetPosition(15 + self.oldToolTip.GetWidth() + 45, 38) Before if localeInfo.IsARABIC(): Thanks, I have updated the files. Edited August 16, 2022 by Metin2 Dev Core X - External 2 Internal 1 1 https://owsap.dev/ / https://osf.owsap.dev/ Link to comment Share on other sites More sharing options...
Active+ Member HFWhite 497 Posted June 18, 2022 Active+ Member Share Posted June 18, 2022 Yay, the latest update fixed my problem. 1 Link to comment Share on other sites More sharing options...
avertusss 8 Posted June 19, 2022 Share Posted June 19, 2022 Nice but it works only with default font. If someone use Tahoma:14 there is the same problem. ToolTip is too small. Can you extend that fix with other fonts? Link to comment Share on other sites More sharing options...
Active Member ReFresh 2339 Posted June 24, 2022 Active Member Share Posted June 24, 2022 @avertusss File: root/uiattachmetin.py Spoiler Find: newToolTip.SetPosition(230 + 20, 38) Change to: newToolTip.SetPosition(300 + 20, 38) Find: newWidth = self.newToolTip.GetWidth() + 230 + 15 + 20 Change to: newWidth = self.newToolTip.GetWidth() + 300 + 15 + 20 Find: self.SetPosition(x, y) Change to: self.SetCenterPosition() File: uiscript/attachstonedialog.py Spoiler I believe this will fix your problem with font. I'll be always helpful! Link to comment Share on other sites More sharing options...
avertusss 8 Posted June 24, 2022 Share Posted June 24, 2022 15 hours ago, ReFresh said: @avertusss File: root/uiattachmetin.py Reveal hidden contents Find: newToolTip.SetPosition(230 + 20, 38) Change to: newToolTip.SetPosition(300 + 20, 38) Find: newWidth = self.newToolTip.GetWidth() + 230 + 15 + 20 Change to: newWidth = self.newToolTip.GetWidth() + 300 + 15 + 20 Find: self.SetPosition(x, y) Change to: self.SetCenterPosition() File: uiscript/attachstonedialog.py Reveal hidden contents I believe this will fix your problem with font. It's not fix. It's just change size of tooltip. If someone will have font changer ingame it will looks weird if you make it big af but someone want use small font instead of big. 1 Link to comment Share on other sites More sharing options...
jegarba1996 1 Posted August 16, 2022 Share Posted August 16, 2022 (edited) txn you very much for sharing, I followed everything to the letter but I still see everything the same I don't have any errors. image Edited September 11, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Premium EnKor 42 Posted August 20, 2022 Premium Share Posted August 20, 2022 (edited) This "fix" is causing this error: 0820 10:31:33723 :: Cannot find item by 2972 0820 10:31:45273 :: Cannot find item by 2972 0820 10:31:45849 :: Cannot find item by 2972 0820 10:31:46098 :: Cannot find item by 2972 0820 10:31:46924 :: Cannot find item by 2972 Any ideia why? I have 100% sure it's something in uitooltip.py If i follow all the fix i have that error, if i remove it i have none, and if i do all fix, but do not change uitooltip. Error come back! Edit2 Error come from item 72702 . This item have no description and if i move the mouse over him, i see the uitooltip with no problem, but i got syserr 0820 10:31:33723 :: Cannot find item by 2972 Any help? EDIT3 I change this function: Spoiler def __CalculateToolTipWidth(self): affectTextLineLenList = [] metinSocket = self.metinSlot if metinSocket > 0: for socketIndex in metinSocket: if socketIndex: item.SelectItem(socketIndex) affectType, affectValue = item.GetAffect(0) affectString = self.__GetAffectString(affectType, affectValue) if affectString: affectTextLineLenList.append(len(affectString)) if self.itemVnum: item.SelectItem(self.itemVnum) self.metinSlot = None if self.toolTipWidth == self.TOOL_TIP_WIDTH: if affectTextLineLenList: self.toolTipWidth += max(affectTextLineLenList) + 10 self.AlignTextLineHorizonalCenter() with: Spoiler def __CalculateToolTipWidth(self): affectTextLineLenList = [] affectType, affectValue = item.GetAffect(0) affectString = self.__GetAffectString(affectType, affectValue) if affectString: affectTextLineLenList.append(len(affectString)) if self.toolTipWidth == self.TOOL_TIP_WIDTH: if affectTextLineLenList: self.toolTipWidth += max(affectTextLineLenList) + 10 self.AlignTextLineHorizonalCenter() And no more syserr and i belive all tooltips are ok.... But if i have cause anyother error, let me know please Edited August 20, 2022 by EnKor if pc.get_sex() == true and npc.get_sex() == false then npc.purge() end Link to comment Share on other sites More sharing options...
Trudix 43 Posted August 20, 2022 Share Posted August 20, 2022 (edited) Everything works as it should, but if I have the 6/7 bonuses and no stones on the weapon, the problem still persists. Can you do an update about that? Edited August 26, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
LordZiege 279 Posted August 26, 2022 Share Posted August 26, 2022 (edited) i found a litle problem with very long bonuses Edited August 26, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Premium filipw1 1927 Posted August 26, 2022 Premium Share Posted August 26, 2022 (edited) 36 minutes ago, LordZiege said: i found a litle problem with very long bonuses Fix is fairly simple, just replace function (uiToolTip) Spoiler def __AdjustAttrMaxWidth(self, attrSlot): if 0 == attrSlot: return self.toolTipWidth maxWidth = self.toolTipWidth for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM): type = attrSlot[i][0] value = attrSlot[i][1] attrText = self.AppendTextLine(self.__GetAffectString(type, value)) (tW, _) = attrText.GetTextSize() self.childrenList.remove(attrText) self.toolTipHeight -= self.TEXT_LINE_HEIGHT maxWidth = max(tW + 12, maxWidth) return maxWidth Edited August 26, 2022 by Metin2 Dev Core X - External 2 Internal 3 2 2 Link to comment Share on other sites More sharing options...
Artvr3 19 Posted September 18, 2022 Share Posted September 18, 2022 (edited) @EnKor this code will solve the problems #Cannot find item by 'xxx' if item.GetItemType() != item.ITEM_TYPE_ARMOR and item.GetItemType() != item.ITEM_TYPE_WEAPON: return @avertusssI have adapted the code to the font size , good for those who use dynamic font Preview: https://metin2.download/video/7PY3NxZw6WpdkmH72T8q5Q1SyjCLkCO8/.mp4 here is the complete code Spoiler def __CalculateToolTipWidth(self): if item.GetItemType() != item.ITEM_TYPE_ARMOR and item.GetItemType() != item.ITEM_TYPE_WEAPON: return affectTextLineLenList = [] metinSocket = self.metinSlot if metinSocket: for socketIndex in metinSocket: if socketIndex: item.SelectItem(socketIndex) affectType, affectValue = item.GetAffect(0) affectString = self.__GetAffectString(affectType, affectValue) if affectString: affectTextLineLenList.append(len(affectString)) if self.itemVnum: item.SelectItem(self.itemVnum) self.metinSlot = None if self.toolTipWidth == self.TOOL_TIP_WIDTH: if affectTextLineLenList: FontSize = int(''.join(filter(str.isdigit, localeInfo.UI_DEF_FONT))) #Tested on Tahoma font if FontSize <= 12: self.toolTipWidth += max(affectTextLineLenList) + 25 # the gaps can be adjusted by yourself elif FontSize <= 14: self.toolTipWidth += max(affectTextLineLenList) + 25 + FontSize*2.5 elif FontSize <= 16: self.toolTipWidth += max(affectTextLineLenList) + 25 + FontSize*3 elif FontSize == 17: self.toolTipWidth += max(affectTextLineLenList) + 25 + FontSize*4 elif FontSize == 18: self.toolTipWidth += max(affectTextLineLenList) + 25 + FontSize*4.5 else: self.toolTipWidth += max(affectTextLineLenList) + 25 + FontSize*8 self.AlignTextLineHorizonalCenter() I also shares a modification for resize a ToolTip/SkillToolTip but it is not perfect and may have errors if you want to use it go ahead , this is done quickly to check the effect Preview : https://metin2.download/video/OO2cIBUk0K1Q1bidKF49BvTONh8atFJh/.mp4 Spoiler #found def AppendTextLine(self, text, color = FONT_COLOR, centerAlign = TRUE): #change it def AppendTextLine(self, text, color = FONT_COLOR, centerAlign = TRUE): textLine = ui.TextLine() textLine.SetParent(self) textLine.SetFontName(self.defFontName) textLine.SetPackedFontColor(color) textLine.SetText(text) textLine.SetOutline() textLine.SetFeather(FALSE) textLine.Show() if centerAlign: textLine.SetPosition(self.toolTipWidth/2, self.toolTipHeight) textLine.SetHorizontalAlignCenter() else: textLine.SetPosition(10, self.toolTipHeight) self.childrenList.append(textLine) (textWidth, textHeight)=textLine.GetTextSize() textWidth += 20 if self.toolTipWidth < textWidth: self.toolTipWidth = textWidth self.toolTipHeight += self.TEXT_LINE_HEIGHT self.AlignTextLineHorizonalCenter() return textLine #if you use: self.AppendTextLine("[Vnum: %d]" # Search @ class ItemToolTip @ def AddItemData if not item.GetItemDescription(): self.__CalculateToolTipWidth() # Add above if chr.IsGameMaster(player.GetMainCharacterIndex()): self.AppendTextLine("[Vnum: %d]" % itemVnum, ToolTip.SPECIAL_TITLE_COLOR) Edited September 19, 2022 by Metin2 Dev Core X - External 2 Internal 2 Link to comment Share on other sites More sharing options...
TronTR 1 Posted March 16, 2023 Share Posted March 16, 2023 Thanks, that was annoying! Link to comment Share on other sites More sharing options...
Debloat 88 Posted June 10, 2023 Share Posted June 10, 2023 (edited) On 8/20/2022 at 11:17 PM, Trudix said: Everything works as it should, but if I have the 6/7 bonuses and no stones on the weapon, the problem still persists. Can you do an update about that? I can confirm this. If no stone is attached to the item, 6/7 attr will overflow Edited June 10, 2023 by Debloat Link to comment Share on other sites More sharing options...
Volkan 108 Posted November 28, 2023 Share Posted November 28, 2023 How can I do something like this with accesory socket? Link to comment Share on other sites More sharing options...
josehdelaro 5 Posted January 13 Share Posted January 13 (edited) Hello, first I would like to thank you, it works very well, I also applied the code that Filip left with auto adjustment, it works very well but my problem is that the stones had no effect and when inserting them into a weapon or armor there is still no change, does anyone know why what's happening? I make it clear that following the tutorial completely, this problem still happens with the stone tooltip. working: not working: Edited January 13 by Metin2 Dev International Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Recommended Posts