Jump to content

PM Direct on Name (any chat category)


Recommended Posts

  • Premium

Download Center

This is the hidden content, please
 or 
This is the hidden content, please

With this 'system' you will be able to open the PM Window just by clicking on the Player Name on any Chat Category not only on Global (normal, group, guild...)
I use martysama so if you use anything else you need to edit it for your sources.
Because i did not found an full tutorial here it is, is not perfect i know.

Preview:
https://metin2.download/video/LvKhN1mSH9tnmz9NSSzf1luZTVDN0Hk2/.mp4

Bellow is just an example, follow the tutorial on github or download it from dev.

Pack
Search inside interfacemodule.py and edit it like bellow:

def MakeHyperlinkTooltip(self, hyperlink):
  tokens = hyperlink.split(":")
  if tokens and len(tokens):
    type = tokens[0]
    if "item" == type:
      self.hyperlinkItemTooltip.SetHyperlinkItem(tokens)
    # Add this under like here
    elif "msg" == type and str(tokens[1]) != player.GetMainCharacterName():
      self.OpenWhisperDialog(str(tokens[1]))

Server Srcs
Search inside input_main.cpp and make the changes like bellow:

// With Chat Color
#ifdef ENABLE_CHAT_COLOR_SYSTEM
	static const char* colorbuf[] = {"|cFFffa200|H|h[Staff]|h|r", "|cFFff0000|H|h[Shinsoo]|h|r", "|cFFffc700|H|h[Chunjo]|h|r", "|cFF000bff|H|h[Jinno]|h|r"};
	int len = snprintf(chatbuf, sizeof(chatbuf), "%s |Hmsg:%s|h%s|h|r : %s", (ch->IsGM()?colorbuf[0]:colorbuf[MINMAX(0, ch->GetEmpire(), 3)]), ch->GetName(), ch->GetName(), buf);
#endif
  
// Without Chat Color just change it like this
	int len = snprintf(chatbuf, sizeof(chatbuf), "|Hmsg:%s|h%s|h|r : %s", ch->GetName(), ch->GetName(), buf);

Source @ Sanchez 

Client Srcs
Search inside PythonNetworkStreamPhaseGame.cpp

bool CPythonNetworkStream::RecvChatPacket()
{
  ..
  // Search this like
  case CHAT_TYPE_WHISPER:
  {
      ..
  }
  ..
}

And add this inside the case, like this:

Spoiler
  // Under this line
  char* p = strchr(buf, ':');

  // Add this
  if (p != NULL) {
    p = strchr(p + 1, ':');
  }
  // end
Edited by DemOnJR
  • Metin2 Dev 45
  • Eyes 1
  • Good 7
  • Love 24

plague.png.1f5de75b42146262dcd655a5a8078

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

  • Premium
	char chatbuf[CHAT_MAX_LEN + 1];

	int len = 0;
	static const char* colorbuf[] = { "|cFFffa200|H|h[Anubis-Staff]|h|r", "|cFFff0000|H|h[Shinsoo]|h|r", "|cFFffc700|H|h[Chunjo]|h|r", "|cFF000bff|H|h[Jinno]|h|r" };

	if (CHAT_TYPE_SHOUT == pinfo->type)
	{
		if (ch->GetGuild())
		{
			len = snprintf(chatbuf, sizeof(chatbuf), "%s %s [%d][%s]: %s |cFFffa200|Hwhisper:%s|h[Napsat]|h|r",
				(ch->IsGM() ? colorbuf[0] : colorbuf[MINMAX(0, ch->GetEmpire(), 3)]),
				ch->GetName(), ch->GetLevel(), ch->GetGuild()->GetName(),
				buf, ch->GetName());
		}
		else
		{
			len = snprintf(chatbuf, sizeof(chatbuf), "%s %s [%d]: %s |cFFffa200|Hwhisper:%s|h[Napsat]|h|r",
				(ch->IsGM() ? colorbuf[0] : colorbuf[MINMAX(0, ch->GetEmpire(), 3)]),
				ch->GetName(), ch->GetLevel(), buf, ch->GetName());
		}
	}
	else
	{
		len = snprintf(chatbuf, sizeof(chatbuf), "%s %s: %s",
			(ch->IsGM() ? colorbuf[0] : colorbuf[MINMAX(0, ch->GetEmpire(), 3)]),
			ch->GetName(), buf);
	}

 

4 minutes ago, TAUMP said:

	char chatbuf[CHAT_MAX_LEN + 1];

	int len = 0;
	static const char* colorbuf[] = { "|cFFffa200|H|h[Anubis-Staff]|h|r", "|cFFff0000|H|h[Shinsoo]|h|r", "|cFFffc700|H|h[Chunjo]|h|r", "|cFF000bff|H|h[Jinno]|h|r" };

	if (CHAT_TYPE_SHOUT == pinfo->type)
	{
		if (ch->GetGuild())
		{
			len = snprintf(chatbuf, sizeof(chatbuf), "%s %s [%d][%s]: %s |cFFffa200|Hwhisper:%s|h[Napsat]|h|r",
				(ch->IsGM() ? colorbuf[0] : colorbuf[MINMAX(0, ch->GetEmpire(), 3)]),
				ch->GetName(), ch->GetLevel(), ch->GetGuild()->GetName(),
				buf, ch->GetName());
		}
		else
		{
			len = snprintf(chatbuf, sizeof(chatbuf), "%s %s [%d]: %s |cFFffa200|Hwhisper:%s|h[Napsat]|h|r",
				(ch->IsGM() ? colorbuf[0] : colorbuf[MINMAX(0, ch->GetEmpire(), 3)]),
				ch->GetName(), ch->GetLevel(), buf, ch->GetName());
		}
	}
	else
	{
		len = snprintf(chatbuf, sizeof(chatbuf), "%s %s: %s",
			(ch->IsGM() ? colorbuf[0] : colorbuf[MINMAX(0, ch->GetEmpire(), 3)]),
			ch->GetName(), buf);
	}

 

Also included Guild Name at ! bla bla

 

Edited by TAUMP


 

Link to comment
Share on other sites

  • Premium

An error was found when you press CTRL+1 , 2 ... the Emoticon will show only to you, with his own key as message.
At this time idk to solve it i will be back with an update if i solve this.

Topic updated full fixed, i have also added github link for those who want to see how to add it more easily.

Edited by DemOnJR

plague.png.1f5de75b42146262dcd655a5a8078

Link to comment
Share on other sites

  • 1 month later...
  • Active+ Member
On 7/9/2023 at 6:16 PM, DemOnJR said:

Client Srcs
Search inside PythonNetworkStreamPhaseGame.cpp

bool CPythonNetworkStream::RecvChatPacket()
{
  ..
  // Search this like
  case CHAT_TYPE_WHISPER:
  {
      ..
  }
  ..
}

And add this inside the case, like this:

  Hide contents
  // Under this line
  char* p = strchr(buf, ':');

  // Add this
  if (p != NULL) {
    p = strchr(p + 1, ':');
  }
  // end

thank you! this fixed my issue where if i add the function to click on name to PM in normal chat, the name of the player appears also above the character in game.

 

https://metin2.download/video/LvKhN1mSH9tnmz9NSSzf1luZTVDN0Hk2/.mp4

Edited by Metin2 Dev International
Core X - External 2 Internal

spacer.png

Link to comment
Share on other sites

  • Premium
4 hours ago, SCOOB said:

thank you! this fixed my issue where if i add the function to click on name to PM in normal chat, the name of the player appears also above the character in game.

 

https://metin2.download/video/LvKhN1mSH9tnmz9NSSzf1luZTVDN0Hk2/.mp4

Yep, you're welcome. 🥰

plague.png.1f5de75b42146262dcd655a5a8078

Link to comment
Share on other sites

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.