Jump to content

How can I change "PM" in shout?


Recommended Posts

  • Active Member
1 hour ago, Aerrow said:

Search for "[PM]" in uichat.py, if not there search in the source (mainly in the server source).

The click function intrested me too.

Here is it:
 

def __SendShoutChatPacket(self, text):

        if 1 == len(text):
            self.RunCloseEvent()
            return

        if app.GetTime() < self.lastShoutTime + 15:
            chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CHAT_SHOUT_LIMIT)
            self.__ResetChat()
            return

        a = net.GetServerInfo()
        Metin2 = a[-3:]
        if not self.Mapy():
            self.__SendChatPacket(constInfo.Metin2 +'|cFFFFFF00|HMetin2:' + str(player.GetName()) + '|h[PM]|h|r ' + ': ' + text[1:], chat.CHAT_TYPE_SHOUT)    
            self.__ResetChat()
            self.lastShoutTime = app.GetTime()

I'll be always helpful! 👊 

Link to comment
Share on other sites

If you want to use the original, change like this:

 

	def __SendShoutChatPacket(self, text):

		if 1 == len(text):
			self.RunCloseEvent()
			return

		if app.GetTime() < self.lastShoutTime + 15:
			chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CHAT_SHOUT_LIMIT)
			self.__ResetChat()
			return

		self.__SendChatPacket(text[1:], chat.CHAT_TYPE_SHOUT)
		self.__ResetChat()

		self.lastShoutTime = app.GetTime()

 

 

Link to comment
Share on other sites

  • Active Member
1 hour ago, Aerrow said:

If you want to use the original, change like this:

 


	def __SendShoutChatPacket(self, text):

		if 1 == len(text):
			self.RunCloseEvent()
			return

		if app.GetTime() < self.lastShoutTime + 15:
			chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CHAT_SHOUT_LIMIT)
			self.__ResetChat()
			return

		self.__SendChatPacket(text[1:], chat.CHAT_TYPE_SHOUT)
		self.__ResetChat()

		self.lastShoutTime = app.GetTime()

 

 

I don't want the original. I want replace the "PM" with this: When I click on the name somebody in shout, chat whisper will open. 

I'll be always helpful! 👊 

Link to comment
Share on other sites

  • Developer

If you search further, you'll see that this was made by Sanchez a few time ago:

 

Quote

Maybe someone interested, here it is for the source:

Open game/input_main.cpp and search for this:

 


int len = snprintf(chatbuf, sizeof(chatbuf), "%s : %s", ch->GetName(), buf);


 

Replace with this:


	int len;
	if (pinfo->type == CHAT_TYPE_SHOUT)
	{
		len = snprintf(chatbuf, sizeof(chatbuf), "|Hmsg:%s|h%s|h|r : %s", ch->GetName(), ch->GetName(), buf);
	}
	else
	{
		len = snprintf(chatbuf, sizeof(chatbuf), "%s : %s", ch->GetName(), buf);
	}    int len;

 

On client-side just do the modifications in the interfacemodule.py, the uichat.py modification is not required anymore.

 

 

  • Love 1

when you return 0 and server doesn't boot:

unknown.png

Link to comment
Share on other sites

  • 3 months later...
On 16/5/2016 at 6:50 PM, PACI said:

If you search further, you'll see that this was made by Sanchez a few time ago:

 

 

 

Hey :) I tried it it works good but there is one problem: the name appears twice. If I make it like this

len = snprintf(chatbuf, sizeof(chatbuf), "|Hmsg:%s|h|r : %s", ch->GetName(), buf);

the click doens't work...

Link to comment
Share on other sites

  • Developer

Try this then:

  • Add the changes made by Sanchez
  • Now open your interfaceModule.py, search for the MakeHyperlinkTooltip function and make it look like this: 2572c0d91d.png

 

Should be enough I think.

Edited by Metin2 Dev
Core X - External 2 Internal

when you return 0 and server doesn't boot:

unknown.png

Link to comment
Share on other sites

On 23/8/2016 at 5:42 PM, PACI said:

Try this then:

  • Add the changes made by Sanchez
  • Now open your interfaceModule.py, search for the MakeHyperlinkTooltip function and make it look like this: 2572c0d91d.png

 

Should be enough I think.

Click to PM function not working :/

interfaceModule.py:

Spoiler

def MakeHyperlinkTooltip(self, hyperlink):
        tokens = hyperlink.split(":")
        if tokens and len(tokens):
            type = tokens[0]
            if "item" == type:
                self.hyperlinkItemTooltip.SetHyperlinkItem(tokens)
            elif "msg" == type:
                self.OpenWhisperDialog(str(tokens[1]))

 

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • 2 months later...
  • 2 years later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

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.