Honorable Member xP3NG3Rx 19686 Posted January 11, 2019 Honorable Member Share Posted January 11, 2019 M2 Download Center This is the hidden content, please Sign In or Sign Up ( Internal ) Hi, folks! With this guide you will be able to combine textlines with images, like rubinum does. Usage is simple: emojiTextLine.SetText("|Eemoji/key_ctrl|e + |Eemoji/key_x|e + |Eemoji/key_rclick|e - Direct sell") The files are located in the icon pack, so basically the code will load from icon/{GIVEN_PATH}.tga - in the sample the path for the X is: icon/emoji/key_x.tga Here are the images from rubinum client: Spoiler This is the hidden content, please Sign In or Sign Up Howto: Spoiler 1.) Open EterLib/TextTag.h and add the new tags into the enum there: TEXT_TAG_EMOJI_START, // |E TEXT_TAG_EMOJI_END, // |e ex) |Epath/filename|h 2.1.) Open the EterLib/TextTag.cpp and extend the GetTextTag function with the following statements: else if (*cur == L'E') // emoji |Epath/emo|e { tagLen = 2; return TEXT_TAG_EMOJI_START; } else if (*cur == L'e') // end of emoji { tagLen = 2; return TEXT_TAG_EMOJI_END; } 2.2.) Extend the GetTextTagOutputString function with the following statements: else if (tag == TEXT_TAG_EMOJI_START) hyperlinkStep = 1; else if (tag == TEXT_TAG_EMOJI_END) hyperlinkStep = 0; 2.3.) Repeat the 2.2. in the GetTextTagInternalPosFromRenderPos function: else if (tag == TEXT_TAG_EMOJI_START) hyperlinkStep = 1; else if (tag == TEXT_TAG_EMOJI_END) hyperlinkStep = 0; 2.4.) Repeat again in the GetTextTagOutputLen function too: else if (tag == TEXT_TAG_EMOJI_START) hyperlinkStep = 1; else if (tag == TEXT_TAG_EMOJI_END) hyperlinkStep = 0; 3.1.) Open EterLib/GrpTextInstance.h and add the following line at the top of the file where the includes are: #include "GrpImageInstance.h" 3.2.) Add the following struct below of the SHyperlink struct: struct SEmoji { short x; CGraphicImageInstance * pInstance; SEmoji() : x(0) { pInstance = NULL; } }; 3.3.) Below of the m_hyperlinkVector declaration declare a new variable: std::vector<SEmoji> m_emojiVector; 4.1.) Open EterLib/GrpTextInstance.cpp and add the following line at the top of the file, where the includes are: #include "ResourceManager.h" 4.2.) In the CGraphicTextInstance::Update function add the following below of this line: m_hyperlinkVector.clear(); if (m_emojiVector.size() != 0) { for (std::vector<SEmoji>::iterator itor = m_emojiVector.begin(); itor != m_emojiVector.end(); ++itor) { SEmoji & rEmo = *itor; if (rEmo.pInstance) { CGraphicImageInstance::Delete(rEmo.pInstance); rEmo.pInstance = NULL; } } } m_emojiVector.clear(); 4.3.) This is a bit complicated, so first of all look for this line: else // ľĆ¶řżÜ ´Ů¸Ą ÁöżŞ. This is the else for the Arabic codepage, I could not test it, so I didn't make it to arab rtl style. 4.4.) Add the following below of this line: std::wstring hyperlinkBuffer; SEmoji kEmoji; int emojiStep = 0; std::wstring emojiBuffer; 4.5.) Replace this: if (hyperlinkStep == 1) hyperlinkBuffer.append(1, wText[i]); With this: if (hyperlinkStep == 1) hyperlinkBuffer.append(1, wText[i]); else if (emojiStep == 1) emojiBuffer.append(1, wText[i]); 4.6.) Then add the new processor for the new tags: else if (ret == TEXT_TAG_EMOJI_START) { emojiStep = 1; emojiBuffer = L""; } else if (ret == TEXT_TAG_EMOJI_END) { kEmoji.x = x; char retBuf[1024]; int retLen = Ymir_WideCharToMultiByte(GetDefaultCodePage(), 0, emojiBuffer.c_str(), emojiBuffer.length(), retBuf, sizeof(retBuf) - 1, NULL, NULL); retBuf[retLen] = '\0'; char szPath[255]; snprintf(szPath, sizeof(szPath), "icon/%s.tga", retBuf); if (CResourceManager::Instance().IsFileExist(szPath)) { CGraphicImage * pImage = (CGraphicImage *)CResourceManager::Instance().GetResourcePointer(szPath); kEmoji.pInstance = CGraphicImageInstance::New(); kEmoji.pInstance->SetImagePointer(pImage); m_emojiVector.push_back(kEmoji); memset(&kEmoji, 0, sizeof(SEmoji)); for (int i = 0; i < pImage->GetWidth() / (pSpaceInfo->width-1); ++i) x += __DrawCharacter(pFontTexture, dataCodePage, ' ', dwColor); if (pImage->GetWidth() % (pSpaceInfo->width - 1) > 1) x += __DrawCharacter(pFontTexture, dataCodePage, ' ', dwColor); } emojiStep = 0; emojiBuffer = L""; } 4.7.) Add the following code to the end of the CGraphicTextInstance::Render function: if (m_emojiVector.size() != 0) { for (std::vector<SEmoji>::iterator itor = m_emojiVector.begin(); itor != m_emojiVector.end(); ++itor) { SEmoji & rEmo = *itor; if (rEmo.pInstance) { rEmo.pInstance->SetPosition(fStanX + rEmo.x, (fStanY + 7.0) - (rEmo.pInstance->GetHeight() / 2)); rEmo.pInstance->Render(); } } } 4.8.) Add the following into the CGraphicTextInstance::Destroy function: if (m_emojiVector.size() != 0) { for (std::vector<SEmoji>::iterator itor = m_emojiVector.begin(); itor != m_emojiVector.end(); ++itor) { SEmoji & rEmo = *itor; if (rEmo.pInstance) { CGraphicImageInstance::Delete(rEmo.pInstance); rEmo.pInstance = NULL; } } } m_emojiVector.clear(); Have fun Sorry for arab players , for sure they have also developers, so let's go guys, finish it If you have problem, maybe I made a mistake in the guide of missed out something, just leave a comment below. PS.: Sometimes the code tag of the board puts an extra invisible character mostly the end of the lines, if your IDE cries for syntax error, but it seems correct, check that part of the file with notepad++, it will show a ?(question mark) where the problem is. 357 2 5 5 3 3 2 1 2 3 4 6 2 121 26 271 Link to comment Share on other sites More sharing options...
Honorable Member Tatsumaru 5265 Posted January 12, 2019 Honorable Member Share Posted January 12, 2019 I prepared other buttons for this system, which I think are holding a better climate. I put it here, maybe it will be useful to someone PS: I also put a project save in the package, so that you can more conveniently edit each button if necessary. Download: This is the hidden content, please Sign In or Sign Up ( This is the hidden content, please Sign In or Sign Up ) 203 2 4 4 1 3 2 1 3 2 50 7 123 Link to comment Share on other sites More sharing options...
Honorable Member xP3NG3Rx 19686 Posted January 12, 2019 Author Honorable Member Share Posted January 12, 2019 Wow, thank you, looks nice Link to comment Share on other sites More sharing options...
Legend 187 Posted January 12, 2019 Share Posted January 12, 2019 I did this long time ago for the new item currency in shops with some changes in ExtendedTextLine in ui, seems to working fine in tooltip too 1 Link to comment Share on other sites More sharing options...
Premium WeedHex 635 Posted January 12, 2019 Premium Share Posted January 12, 2019 When you use 800x600 it gonna bug? Or you fix in responsive way? 2 Link to comment Share on other sites More sharing options...
Legend 187 Posted January 12, 2019 Share Posted January 12, 2019 3 hours ago, WeedHex said: When you use 800x600 it gonna bug? Or you fix in responsive way? There is not any bug when i use 800x600 you can add 6 buttons without bug at this size. Link to comment Share on other sites More sharing options...
Active Member Exygo 1091 Posted January 12, 2019 Active Member Share Posted January 12, 2019 (edited) This is the hidden content, please Sign In or Sign Up Edited August 25, 2022 by Metin2 Dev Core X - External 2 Internal 42 1 1 11 1 21 https://www.youtube.com/channel/UCQ8mAeda9TWq6SsTzB53emw/videos Link to comment Share on other sites More sharing options...
sxvoyz 61 Posted January 12, 2019 Share Posted January 12, 2019 very usefull Link to comment Share on other sites More sharing options...
attila1995 3 Posted January 13, 2019 Share Posted January 13, 2019 Thank you for it, P3NG3R! Link to comment Share on other sites More sharing options...
Active Member ReFresh 2340 Posted January 13, 2019 Active Member Share Posted January 13, 2019 If someone getting this error or something like this: Spoiler 'snprintf': identifier not found Just add at the top of the file this: Spoiler #include <stdio.h> And change sprintf to: Spoiler _snprintf 2 4 10 I'll be always helpful! Link to comment Share on other sites More sharing options...
Active Member ReFresh 2340 Posted January 14, 2019 Active Member Share Posted January 14, 2019 Can someone tell me how to extend some item by this function (only showing the key images) ? I'll be always helpful! Link to comment Share on other sites More sharing options...
Honorable Member xP3NG3Rx 19686 Posted January 14, 2019 Author Honorable Member Share Posted January 14, 2019 What do you mean? Link to comment Share on other sites More sharing options...
Active Member ReFresh 2340 Posted January 14, 2019 Active Member Share Posted January 14, 2019 @xP3NG3Rx Basically you must have added some system which will support these keyboard and mouse shortcuts. But I just need to see these image shortcuts under some item in item description so here must be something like: Spoiler if self.itemVnum >= 29101 and self.itemVnum <= 29109: self.emojiTextLine.SetText("|Eemoji/key_ctrl|e + |Eemoji/key_x|e + |Eemoji/key_rclick|e - Direct sell") self.emojiTextLine.Show() Like you can see it on Tatsumaru image. 1 I'll be always helpful! Link to comment Share on other sites More sharing options...
Honorable Member xP3NG3Rx 19686 Posted January 15, 2019 Author Honorable Member Share Posted January 15, 2019 If you mean you need a function which shows the correct keyboard combination with text and also make it to work like what does it say, just hire a dev who can code it to you. Link to comment Share on other sites More sharing options...
Active Member ReFresh 2340 Posted January 15, 2019 Active Member Share Posted January 15, 2019 @xP3NG3Rx No. I don't need it. I just want to test the icons of keyboard combination with text on some item which I could define. Separately. I'll be always helpful! Link to comment Share on other sites More sharing options...
Premium filipw1 1934 Posted January 18, 2019 Premium Share Posted January 18, 2019 Dnia 15.01.2019 o 01:07, ReFresh napisał: @xP3NG3Rx No. I don't need it. I just want to test the icons of keyboard combination with text on some item which I could define. Separately. Try itemdesc.txt. I bet it would work Link to comment Share on other sites More sharing options...
attila1995 3 Posted January 22, 2019 Share Posted January 22, 2019 @xP3NG3Rx I have an interesting question. So, how can i break the emotion's image to a new line, like private chat? Can you make and show a code to it? Have a good day. Link to comment Share on other sites More sharing options...
Kori 170 Posted January 22, 2019 Share Posted January 22, 2019 6 hours ago, attila1995 said: @xP3NG3Rx I have an interesting question. So, how can i break the emotion's image to a new line, like private chat? Can you make and show a code to it? Have a good day. You can edit the code for the privat Chat The idea is : Hello friend :) To Hello friend You can make a replace or a find script for this I mean Find in text : ) -> replace to the emoji Link to comment Share on other sites More sharing options...
attila1995 3 Posted January 23, 2019 Share Posted January 23, 2019 17 hours ago, Kori said: You can edit the code for the privat Chat The idea is : Hello friend :) To Hello friend You can make a replace or a find script for this I mean Find in text : ) -> replace to the emoji Hi! I think you didnt understand what i have written. So when somebody writes a long message in private chat (in game), the message's line will be broken at chat's border of board (because the chat board is resizable, and his contents are following his size, so the chat line will be resied too) and the broken line will be in a next line, so when im using a smiley code in the long message and the line has been broken, the smiley's image will not be there in the broken line, that is just there at over of board in the first line, not in next line... Thank you for answers. Link to comment Share on other sites More sharing options...
evils666 0 Posted February 4, 2019 Share Posted February 4, 2019 I have this error: 15>GrpTextInstance.cpp(452): error C2065: 'kEmoji' : undeclared identifier 15>GrpTextInstance.cpp(452): error C2228: left of '.x' must have class/struct/union 15> type is 'unknown-type' 15>GrpTextInstance.cpp(472): error C2065: 'emojiStep' : undeclared identifier Please help. Link to comment Share on other sites More sharing options...
Premium TAUMP 841 Posted February 4, 2019 Premium Share Posted February 4, 2019 2 hours ago, evils666 said: I have this error: 15>GrpTextInstance.cpp(452): error C2065: 'kEmoji' : undeclared identifier 15>GrpTextInstance.cpp(452): error C2228: left of '.x' must have class/struct/union 15> type is 'unknown-type' 15>GrpTextInstance.cpp(472): error C2065: 'emojiStep' : undeclared identifier Please help. Check symbols in code "?" open notepad++ Link to comment Share on other sites More sharing options...
evils666 0 Posted February 4, 2019 Share Posted February 4, 2019 Yes i check. All look okay. Link to comment Share on other sites More sharing options...
Syriza 235 Posted March 7, 2019 Share Posted March 7, 2019 Thank you! Link to comment Share on other sites More sharing options...
Bertus 18 Posted March 24, 2019 Share Posted March 24, 2019 (edited) On 1/12/2019 at 5:30 AM, Tatsumaru said: I prepared other buttons for this system, which I think are holding a better climate. I put it here, maybe it will be useful to someone PS: I also put a project save in the package, so that you can more conveniently edit each button if necessary.Download: This is the hidden content, please Sign In or Sign Up Reupload? Edited August 25, 2022 by Metin2 Dev Core X - External 2 Internal 9 1 2 1 6 Link to comment Share on other sites More sharing options...
Honorable Member Tatsumaru 5265 Posted March 24, 2019 Honorable Member Share Posted March 24, 2019 20 minut temu, Bertus napisał: Reupload? Where is "please"? Corrected. 4 Link to comment Share on other sites More sharing options...
Recommended Posts