Jump to content
metin2dev
Sign in to follow this  
xP3NG3Rx

[Py] One safebox password per login

Recommended Posts

Hello

Today I want to share with all of you a little thing. All times when you are trying to open your safebox, it's requesting the password, isn't it? But for what?
I modified to limit these requests to one input per login. Of course if you warp or change character, you need to retype your password again.
But with extra modifications you can do it to store the password until you close the client, but I don't recommend this.

So, first go to the uiSafeBox.py file and paste this line into the __init__ method of the PasswordDialog class, with taking care of the tabulators:

self.lastPassword = ""

This variable will store your last entered password.

Then replace the Accept method of the same class with this: (take a look for the syntax, modulename, and true/false!)

	def OnAccept(self):
		self.lastPassword = str(self.passwordValue.GetText())
		m2net.SendChatPacket(self.sendMessage + self.lastPassword)
		self.CloseDialog()
		return True

When you accept the password input dialog, the entered password will be saved, if it's correct if it isn't as well. Don't worry about it, it will be reset if you entered wrong password.

The next step is that to paste these new functions into the same class.

	def InitSafeboxPassword(self):
		self.lastPassword = ""

	def GetSafeboxPwd(self):
		return self.lastPassword

As you can see, here is a function which will reset the entered password ;).
With this, the file is done.

Open interfaceModule.py and serach this line: ## Safebox then paste this function below:

	def InitSafeboxPassword(self):
		self.dlgPassword.InitSafeboxPassword()

Then replace the AskSafeboxPassword and AskMallPassword functions with these:

	def AskSafeboxPassword(self):
		if self.wndSafebox.IsShow():
			return

		if self.dlgPassword.IsShow():
			self.dlgPassword.CloseDialog()
			return

		self.dlgPassword.SetSendMessage("/safebox_password ")
		if self.dlgPassword.GetSafeboxPwd() != "":
			self.dlgPassword.OnAccept()
			return

		self.dlgPassword.SetTitle(localeInfo.PASSWORD_TITLE)
		self.dlgPassword.ShowDialog()

	def AskMallPassword(self):
		if self.wndMall.IsShow():
			return

		if self.dlgPassword.IsShow():
			self.dlgPassword.CloseDialog()
			return

		self.dlgPassword.SetSendMessage("/mall_password ")
		if self.dlgPassword.GetSafeboxPwd() != "":
			self.dlgPassword.OnAccept()
			return

		self.dlgPassword.SetTitle(localeInfo.MALL_PASSWORD_TITLE)
		self.dlgPassword.ShowDialog()

With these functions, if the last entered password is correct, the storages will open automatically with the last entered password.
The file is done.

Next, open your game.py and search this function: OnSafeBoxError and extend it with this line:

self.interface.InitSafeboxPassword()

So, as you can see this is the answer from the server to entered wrong password and this function will reset the last entered password as well :).

That's all, I hope you like it, and have fun.

  • Like 13

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×