avertuss 48 Posted March 2, 2019 Share Posted March 2, 2019 Hi. How can i block using showing items on shout chat (!)? I want to use showing items only on trade chat. 1 1 Link to comment Share on other sites More sharing options...
Silver Sonitex 1438 Posted March 2, 2019 Silver Share Posted March 2, 2019 int CInputMain::Chat(LPCHARACTER ch, const char * data, size_t uiBytes) { [...] //Disable linking items in shout chat std::string str = chatbuf_global; std::string str2("|Hitem:"); std::size_t found = str.find(str2); if (found!=std::string::npos) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("SHOUT_CHAT_ITEM_HYPERLINK_MESSAGE")); return(iExtraLen); } [...] } Good enough for ya 1 Link to comment Share on other sites More sharing options...
Forum Moderator VegaS™ 10274 Posted March 3, 2019 Forum Moderator Share Posted March 3, 2019 (edited) @Sonitex That's a ugly way, i'd rather something more clean. Src/Server/game/src/input_main.cpp This is the hidden content, please Sign In or Sign Up Src/Server/common.h #define ENABLE_CHAT_SHOUT_LIMIT_HYPERLINK Edited November 8, 2021 by VegaS™ 15 5 14 Check my GitHub Profile Click to find all the threads started by me [TOOL] Text file loader + JSON Link to comment Share on other sites More sharing options...
Bot Metin2 Dev 4882 Posted March 3, 2019 Bot Share Posted March 3, 2019 Quote 23 hours ago, VegaS™ said: @Sonitex That's a ugly way, i'd rather something more clean. Src/Server/game/src/input_main.cpp int CInputMain::Chat(LPCHARACTER ch, const char * data, size_t uiBytes) { [...] if (true == SpamBlockCheck(ch, buf, buflen)) { return iExtraLen; } #ifdef ENABLE_CHAT_SHOUT_LIMIT_HYPERLINK if (pinfo->type == CHAT_TYPE_SHOUT) { int hyperlinks; bool colored; GetTextTagInfo(buf, buflen, hyperlinks, colored); if (hyperlinks) { ch->ChatPacket(CHAT_TYPE_INFO, "Hyperlinks are blocked in this chat."); return iExtraLen; } } #endif [...] } Src/Server/common.h #define ENABLE_CHAT_SHOUT_LIMIT_HYPERLINK Nice! And how could we block the following? A player links an item in the chat, and then another player links the same item (without having it), doing the same process in the hyperlink. Basically copy the item visually. Is it possible to do that? Link to comment Share on other sites More sharing options...
Forum Moderator VegaS™ 10274 Posted March 7, 2019 Forum Moderator Share Posted March 7, 2019 (edited) On 3/4/2019 at 1:54 AM, WLsj24 said: And how could we block the following? A player links an item in the chat, and then another player links the same item (without having it), doing the same process in the hyperlink. Basically copy the item visually. Is it possible to do that? Yes, we can do this in server/client-side, but need some extra-checks for item attr/scokets + if exists in inventory. But have no sense to fix it since you don't want the players to do this. Why you don't disable the function chatGetLinkFromHyperlink from source client and python and showing just the tooltip when you put the mouse over the link, remove ALT+LEFT CLICK. root/game.py This is the hidden content, please Sign In or Sign Up root/uiWhisper.py Spoiler # 1.1) Search for: def OnMouseLeftButtonDown(self): hyperlink = ui.GetHyperlink() if hyperlink: if app.IsPressed(app.DIK_LALT): link = chat.GetLinkFromHyperlink(hyperlink) ime.PasteString(link) else: self.interface.MakeHyperlinkTooltip(hyperlink) # 1.2) Replace it with: def OnMouseLeftButtonDown(self): hyperlink = ui.GetHyperlink() if hyperlink: if app.ENABLE_LINK_FROM_HYPERLINK: if app.IsPressed(app.DIK_LALT): ime.PasteString(chat.GetLinkFromHyperlink(hyperlink).strip()) return self.interface.MakeHyperlinkTooltip(hyperlink) root/uiChat.py Spoiler #1.1) Search for: def OnMouseLeftButtonDown(self): hyperlink = ui.GetHyperlink() if hyperlink: if app.IsPressed(app.DIK_LALT): link = chat.GetLinkFromHyperlink(hyperlink) ime.PasteString(link) else: self.interface.MakeHyperlinkTooltip(hyperlink) #1.2) Replace it with: def OnMouseLeftButtonDown(self): hyperlink = ui.GetHyperlink() if hyperlink: if app.ENABLE_LINK_FROM_HYPERLINK: if app.IsPressed(app.DIK_LALT): ime.PasteString(chat.GetLinkFromHyperlink(hyperlink).strip()) return self.interface.MakeHyperlinkTooltip(hyperlink) # 2.1) Search for: def OnMouseLeftButtonDown(self): hyperlink = ui.GetHyperlink() if hyperlink: if app.IsPressed(app.DIK_LALT): link = chat.GetLinkFromHyperlink(hyperlink) ime.PasteString(link) else: self.interface.MakeHyperlinkTooltip(hyperlink) else: ui.EditLine.OnMouseLeftButtonDown(self) # 2.2) Replace it with: def OnMouseLeftButtonDown(self): hyperlink = ui.GetHyperlink() if hyperlink: if app.ENABLE_LINK_FROM_HYPERLINK: if app.IsPressed(app.DIK_LALT): ime.PasteString(chat.GetLinkFromHyperlink(hyperlink).strip()) return self.interface.MakeHyperlinkTooltip(hyperlink) else: ui.EditLine.OnMouseLeftButtonDown(self) Srcs/Client/UserInterface/PythonChatModule.cpp Spoiler // 1.1) Search for: { "GetLinkFromHyperlink", chatGetLinkFromHyperlink, METH_VARARGS }, // 1.2) Replace it with: #ifdef ENABLE_LINK_FROM_HYPERLINK // Link { "GetLinkFromHyperlink", chatGetLinkFromHyperlink, METH_VARARGS }, #endif Srcs/Client/UserInterface/PythonApplicationModule.cpp Spoiler // 1.1) Search for: PyModule_AddIntConstant(poModule, "CAMERA_STOP", CPythonApplication::CAMERA_STOP); // 1.2) Add after: #ifdef ENABLE_LINK_FROM_HYPERLINK PyModule_AddIntConstant(poModule, "ENABLE_LINK_FROM_HYPERLINK", 1); #else PyModule_AddIntConstant(poModule, "ENABLE_LINK_FROM_HYPERLINK", 0); #endif Srcs/Client/UserInterface/Locale_inc.h Spoiler //#define ENABLE_LINK_FROM_HYPERLINK // Enable copy a item link from hyperlink with ALT+CLICK. Edited November 8, 2021 by VegaS™ 15 4 8 Check my GitHub Profile Click to find all the threads started by me [TOOL] Text file loader + JSON Link to comment Share on other sites More sharing options...
Bot Metin2 Dev 4882 Posted March 7, 2019 Bot Share Posted March 7, 2019 Quote 9 hours ago, VegaS™ said: Yes, we can do this in server/client-side, but need some extra-checks for item attr/scokets + if exists in inventory. But have no sense to fix it since you don't want the players to do this. Why you don't disable the function chatGetLinkFromHyperlink from source client and python and showing just the tooltip when you put the mouse over the link, remove ALT+LEFT CLICK. root/game.py Reveal hidden contents # 1.1) Search for: hyperlink = ui.GetHyperlink() if hyperlink: if app.IsPressed(app.DIK_LALT): link = chat.GetLinkFromHyperlink(hyperlink) ime.PasteString(link) else: self.interface.MakeHyperlinkTooltip(hyperlink) return else: player.SetMouseState(player.MBT_LEFT, player.MBS_CLICK) # 1.2) Replace it with: hyperlink = ui.GetHyperlink() if hyperlink: if app.ENABLE_LINK_FROM_HYPERLINK: if app.IsPressed(app.DIK_LALT): ime.PasteString(chat.GetLinkFromHyperlink(hyperlink).strip()) return self.interface.MakeHyperlinkTooltip(hyperlink) else: player.SetMouseState(player.MBT_LEFT, player.MBS_CLICK) root/uiWhisper.py Reveal hidden contents # 1.1) Search for: def OnMouseLeftButtonDown(self): hyperlink = ui.GetHyperlink() if hyperlink: if app.IsPressed(app.DIK_LALT): link = chat.GetLinkFromHyperlink(hyperlink) ime.PasteString(link) else: self.interface.MakeHyperlinkTooltip(hyperlink) # 1.2) Replace it with: def OnMouseLeftButtonDown(self): hyperlink = ui.GetHyperlink() if hyperlink: if app.ENABLE_LINK_FROM_HYPERLINK: if app.IsPressed(app.DIK_LALT): ime.PasteString(chat.GetLinkFromHyperlink(hyperlink).strip()) return self.interface.MakeHyperlinkTooltip(hyperlink) root/uiChat.py Reveal hidden contents #1.1) Search for: def OnMouseLeftButtonDown(self): hyperlink = ui.GetHyperlink() if hyperlink: if app.IsPressed(app.DIK_LALT): link = chat.GetLinkFromHyperlink(hyperlink) ime.PasteString(link) else: self.interface.MakeHyperlinkTooltip(hyperlink) #1.2) Replace it with: def OnMouseLeftButtonDown(self): hyperlink = ui.GetHyperlink() if hyperlink: if app.ENABLE_LINK_FROM_HYPERLINK: if app.IsPressed(app.DIK_LALT): ime.PasteString(chat.GetLinkFromHyperlink(hyperlink).strip()) return self.interface.MakeHyperlinkTooltip(hyperlink) # 2.1) Search for: def OnMouseLeftButtonDown(self): hyperlink = ui.GetHyperlink() if hyperlink: if app.IsPressed(app.DIK_LALT): link = chat.GetLinkFromHyperlink(hyperlink) ime.PasteString(link) else: self.interface.MakeHyperlinkTooltip(hyperlink) else: ui.EditLine.OnMouseLeftButtonDown(self) # 2.2) Replace it with: def OnMouseLeftButtonDown(self): hyperlink = ui.GetHyperlink() if hyperlink: if app.ENABLE_LINK_FROM_HYPERLINK: if app.IsPressed(app.DIK_LALT): ime.PasteString(chat.GetLinkFromHyperlink(hyperlink).strip()) return self.interface.MakeHyperlinkTooltip(hyperlink) else: ui.EditLine.OnMouseLeftButtonDown(self) Srcs/Client/UserInterface/PythonChatModule.cpp Reveal hidden contents // 1.1) Search for: { "GetLinkFromHyperlink", chatGetLinkFromHyperlink, METH_VARARGS }, // 1.2) Replace it with: #ifdef ENABLE_LINK_FROM_HYPERLINK // Link { "GetLinkFromHyperlink", chatGetLinkFromHyperlink, METH_VARARGS }, #endif Srcs/Client/UserInterface/PythonApplicationModule.cpp Reveal hidden contents // 1.1) Search for: PyModule_AddIntConstant(poModule, "CAMERA_STOP", CPythonApplication::CAMERA_STOP); // 1.2) Add after: #ifdef ENABLE_LINK_FROM_HYPERLINK PyModule_AddIntConstant(poModule, "ENABLE_LINK_FROM_HYPERLINK", 1); #else PyModule_AddIntConstant(poModule, "ENABLE_LINK_FROM_HYPERLINK", 0); #endif Srcs/Client/UserInterface/Locale_inc.h Reveal hidden contents //#define ENABLE_LINK_FROM_HYPERLINK // Enable copy a item link from hyperlink with ALT+CLICK. It is a great idea to do this in this way and not complicate life by checking if it exists in the inventory. Many thanks! 1 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