Jump to content

Recommended Posts

M2 Download Center

This is the hidden content, please
( Internal )

Hi.

 

This small release save our sent and received private messages till we change the character. If you close by mistake PM with somebody and after you'll open the converastion with that player the old messages will be loaded from dictionary.

 

All changes are in root.

Let's begin.

 

constInfo.py

Add:

WHISPER_MESSAGES = {}

 

game.py

Replace these methods:

	def OnRecvWhisper(self, mode, name, line):
		if mode == chat.WHISPER_TYPE_GM:
			self.interface.RegisterGameMasterName(name)
		line.replace(" : ", ": ")

		if not self.interface.FindWhisperButton(name) and constInfo.WHISPER_MESSAGES.has_key(name) and not self.interface.whisperDialogDict.has_key(name):
			self.interface.RecvWhisper(mode, name, line, True)
		else:
			self.interface.RecvWhisper(mode, name, line, False)

		if not constInfo.WHISPER_MESSAGES.has_key(name):
			constInfo.WHISPER_MESSAGES.update({name : [(mode, line)]})
		else:
			constInfo.WHISPER_MESSAGES[name].append((mode, line))

		chat.AppendWhisper(mode, name, line)

	def OnRecvWhisperSystemMessage(self, mode, name, line):
		chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, line)
		self.interface.RecvWhisper(mode, name, line, False)

	def OnRecvWhisperError(self, mode, name, line):
		if localeInfo.WHISPER_ERROR.has_key(mode):
			chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, localeInfo.WHISPER_ERROR[mode](name))
		else:
			chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, "Whisper Unknown Error(mode=%d, name=%s)" % (mode, name))
		self.interface.RecvWhisper(mode, name, line, False)

 

interfaceModule.py

Replace this method:

	def RecvWhisper(self, mode, name, line, loadMsg):
		if loadMsg:
			for text in constInfo.WHISPER_MESSAGES[name]:
				chat.AppendWhisper(text[0], name, text[1])

		if not self.whisperDialogDict.has_key(name):
			btn = self.FindWhisperButton(name)
			if 0 == btn:
				btn = self.__MakeWhisperButton(name)
				btn.Flash()

				chat.AppendChat(chat.CHAT_TYPE_NOTICE, localeInfo.RECEIVE_MESSAGE % (name))

			else:
				btn.Flash()

		elif self.IsGameMasterName(name):
			dlg = self.whisperDialogDict[name]
			dlg.SetGameMasterLook()

 

introSelect.py

In def Open(self): add:

		WHISPER_MESSAGES = {}

 

uiWhisper.py

Add:

import constInfo

 

Replace this method:

	def OpenWithTarget(self, targetName="", loadMessages=False):
		chat.CreateWhisper(targetName)
		chat.SetWhisperBoxSize(targetName, self.GetWidth() - 60, self.GetHeight() - 90)
		self.chatLine.SetFocus()
		self.titleName.SetText(targetName)
		self.targetName = targetName
		self.textRenderer.SetTargetName(targetName)
		self.titleNameEdit.Hide()
		self.ignoreButton.Hide()
		if app.IsDevStage():
			self.reportViolentWhisperButton.Show()
		else:
			self.reportViolentWhisperButton.Hide()
		self.acceptButton.Hide()
		self.gamemasterMark.Hide()
		self.minimizeButton.Show()

		if loadMessages:
			if constInfo.WHISPER_MESSAGES.has_key(targetName):
				for text in constInfo.WHISPER_MESSAGES[targetName]:
					chat.AppendWhisper(text[0], targetName, text[1])

 

in def AcceptTarget(self): at botton add:

		if constInfo.WHISPER_MESSAGES.has_key(name):
			for text in constInfo.WHISPER_MESSAGES[name]:
				chat.AppendWhisper(text[0], name, text[1])

 

And replace this method:

	def SendWhisper(self):

		text = self.chatLine.GetText()
		textLength = len(text)

		if textLength > 0:
			if net.IsInsultIn(text):
				chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CHAT_INSULT_STRING)
				return

			net.SendWhisperPacket(self.targetName, text)
			self.chatLine.SetText("")

			if not constInfo.WHISPER_MESSAGES.has_key(self.targetName):
				constInfo.WHISPER_MESSAGES.update({self.targetName : [(1, ("{}: {}".format(player.GetName(), text)))]})
			else:
				constInfo.WHISPER_MESSAGES[self.targetName].append([1, "{}: {}".format(player.GetName(), text)])

			chat.AppendWhisper(chat.WHISPER_TYPE_CHAT, self.targetName, player.GetName() + ": " + text)

 

That's all ;)

 

If you will find any bugs just give me some feedback.

  • Metin2 Dev 24
  • Eyes 1
  • Good 8
  • Love 25
Link to comment
https://metin2.dev/topic/23586-cache-private-messages/
Share on other sites

15 hours ago, KoYGeR said:

Replace

def __FindWhisperButton

To:

def FindWhisperButton

And, self.interface.FindWhisperButton has no attribute on game.py

 

Edit:

And in introSelect.py

import constInfo

constInfo.WHISPER_MESSEGES = {}

Edited by LegolasOfficial
Adding

[!] New in this year  [!]

NkczHwR.png

~ Addicted2 - Coming soon ~

Link to comment
https://metin2.dev/topic/23586-cache-private-messages/#findComment-127032
Share on other sites

  • 6 months later...

I found the problem of which this system is not so popular:

 

Because of the loadMessages=False, if you press someone's whisper button, the chat is empty..

If loadMessages=True, the whisper button works as you designed, but the double messages are back again..

 

Can anyone find a solution please?

Thank you!

 

Edited by Shahin
Link to comment
https://metin2.dev/topic/23586-cache-private-messages/#findComment-132637
Share on other sites

  • 2 years later...
On 11/4/2020 at 2:06 AM, Shahin said:

I found the problem of which this system is not so popular:

 

Because of the loadMessages=False, if you press someone's whisper button, the chat is empty..

If loadMessages=True, the whisper button works as you designed, but the double messages are back again..

 

Can anyone find a solution please?

Thank you!

 

Anyone found a fix ?

Link to comment
https://metin2.dev/topic/23586-cache-private-messages/#findComment-159476
Share on other sites

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.