Jump to content

Recommended Posts

  • Replies 10
  • Created
  • Last Reply

Top Posters In This Topic

On 10/22/2018 at 10:58 PM, [RaffaeL] said:

And your intrologin looks like...

Sorry...

How do i simply add a channel status checker i tried the one from standard intrologin but it didnt work :/

 

import dbg
import app
import net
import ui
import ime
import snd
import wndMgr
import musicInfo
import serverInfo
import systemSetting
import ServerStateChecker
import localeInfo
import constInfo
import uiCommon
import time
import serverCommandParser
import ime
import uiScriptLocale
import os

from _weakref import proxy

SERVER_IP = ""
CH1_PORT = 13000
CH2_PORT = 13001
CH3_PORT = 13002
CH4_PORT = 13003
LOGIN = 11002
SERVER_NAME = ""

class LoginWindow(ui.ScriptWindow):
	def __init__(self, stream):
		ui.ScriptWindow.__init__(self)
		
		net.SetPhaseWindow(net.PHASE_WINDOW_LOGIN, self)
		net.SetAccountConnectorHandler(self)

		self.stream = stream	
		
	def __del__(self):
		ui.ScriptWindow.__del__(self)
		
		net.ClearPhaseWindow(net.PHASE_WINDOW_LOGIN, self)
		net.SetAccountConnectorHandler(0)

	def Open(self):
		self.loginFailureMsgDict={

			"ALREADY"	: localeInfo.LOGIN_FAILURE_ALREAY,
			"NOID"		: localeInfo.LOGIN_FAILURE_NOT_EXIST_ID,
			"WRONGPWD"	: localeInfo.LOGIN_FAILURE_WRONG_PASSWORD,
			"FULL"		: localeInfo.LOGIN_FAILURE_TOO_MANY_USER,
			"SHUTDOWN"	: localeInfo.LOGIN_FAILURE_SHUTDOWN,
			"REPAIR"	: localeInfo.LOGIN_FAILURE_REPAIR_ID,
			"BLOCK"		: localeInfo.LOGIN_FAILURE_BLOCK_ID,
			"WRONGMAT"	: localeInfo.LOGIN_FAILURE_WRONG_MATRIX_CARD_NUMBER,
			"QUIT"		: localeInfo.LOGIN_FAILURE_WRONG_MATRIX_CARD_NUMBER_TRIPLE,
			"BESAMEKEY"	: localeInfo.LOGIN_FAILURE_BE_SAME_KEY,
			"NOTAVAIL"	: localeInfo.LOGIN_FAILURE_NOT_AVAIL,
			"NOBILL"	: localeInfo.LOGIN_FAILURE_NOBILL,
			"BLKLOGIN"	: localeInfo.LOGIN_FAILURE_BLOCK_LOGIN,
			"WEBBLK"	: localeInfo.LOGIN_FAILURE_WEB_BLOCK,
		}

		self.loginFailureFuncDict = {
			"WRONGPWD"	: localeInfo.LOGIN_FAILURE_WRONG_PASSWORD,
			"WRONGMAT"	: localeInfo.LOGIN_FAILURE_WRONG_MATRIX_CARD_NUMBER,
			"QUIT"		: app.Exit,
		}

		self.SetSize(wndMgr.GetScreenWidth(), wndMgr.GetScreenHeight())
		self.SetWindowName("LoginWindow")

		self.__LoadScript("loginwindow_new/loginwindow.py")
		
		if musicInfo.loginMusic != "":
			snd.SetMusicVolume(systemSetting.GetMusicVolume())
			snd.FadeInMusic("BGM/" + musicInfo.loginMusic)

		snd.SetSoundVolume(systemSetting.GetSoundVolume())

		ime.AddExceptKey(91)
		ime.AddExceptKey(93)
		self.SetChannel(0)
		
		self.Show()
		app.ShowCursor()	

	def Close(self):
		if musicInfo.loginMusic != "" and musicInfo.selectMusic != "":
			snd.FadeOutMusic("BGM/"+musicInfo.loginMusic)
	
		if self.stream.popupWindow:
			self.stream.popupWindow.Close()
	
		self.Hide()
		app.HideCursor()
		ime.ClearExceptKey()

	def OnConnectFailure(self):
		snd.PlaySound("sound/ui/loginfail.wav")
		self.PopupNotifyMessage(localeInfo.LOGIN_CONNECT_FAILURE, self.EmptyFunc)

	def OnHandShake(self):
		snd.PlaySound("sound/ui/loginok.wav")
		self.PopupDisplayMessage(localeInfo.LOGIN_CONNECT_SUCCESS)

	def OnLoginStart(self):
		self.PopupDisplayMessage(localeInfo.LOGIN_PROCESSING)

	def OnLoginFailure(self, error):
		try:
			loginFailureMsg = self.loginFailureMsgDict[error]
		except KeyError:
		
			loginFailureMsg = localeInfo.LOGIN_FAILURE_UNKNOWN  + error

		loginFailureFunc = self.loginFailureFuncDict.get(error, self.EmptyFunc)

		self.PopupNotifyMessage(loginFailureMsg, loginFailureFunc)

		snd.PlaySound("sound/ui/loginfail.wav")

	def __LoadScript(self, fileName):
		try:
			pyScrLoader = ui.PythonScriptLoader()
			pyScrLoader.LoadScriptFile(self, fileName)
		except:
			import exception
			exception.Abort("LoginWindow.__LoadScript.LoadObject")

		try:
			self.idEditLine = self.GetChild("id")
			self.pwdEditLine = self.GetChild("pwd")
			self.loginButton = self.GetChild("login_button")
			self.exitButton = self.GetChild("exit_button")
			self.websiteButton = self.GetChild("website_button")
			self.parolauitataButton = self.GetChild("parolauitata_button")
			self.registerButton = self.GetChild("register_button")
			self.SaveLogin1				= self.GetChild("SaveButton1")
			self.LoadLogin1				= self.GetChild("LoadButton1")
			self.SaveLogin2				= self.GetChild("SaveButton2")
			self.LoadLogin2				= self.GetChild("LoadButton2")
			self.SaveLogin3				= self.GetChild("SaveButton3")
			self.LoadLogin3				= self.GetChild("LoadButton3")
			self.SaveLogin4				= self.GetChild("SaveButton4")
			self.LoadLogin4				= self.GetChild("LoadButton4")
			
			self.channelButton = {
				0 : self.GetChild("ch1"),
				1 :	self.GetChild("ch2"),
				2 : self.GetChild("ch3"),
				3 : self.GetChild("ch4")}
			

		except:
			import exception
			exception.Abort("LoginWindow.__LoadScript.BindObject")
			
				
		for (channelID, channelButtons) in self.channelButton.items():
				channelButtons.SetEvent(ui.__mem_func__(self.SetChannel), channelID)

		self.loginButton.SetEvent(ui.__mem_func__(self.__OnClickLoginButton))
		self.exitButton.SetEvent(ui.__mem_func__(self.OnPressExitKey))
		self.websiteButton.SetEvent(ui.__mem_func__(self.GoWebSite))
		self.parolauitataButton.SetEvent(ui.__mem_func__(self.GoParolaUitata))
		self.registerButton.SetEvent(ui.__mem_func__(self.GoRegister))
		self.SaveLogin1.SetEvent(ui.__mem_func__(self.__SaveLogin1))
		self.LoadLogin1.SetEvent(ui.__mem_func__(self.__LoadLogin1))
		self.SaveLogin2.SetEvent(ui.__mem_func__(self.__SaveLogin2))
		self.LoadLogin2.SetEvent(ui.__mem_func__(self.__LoadLogin2))
		self.SaveLogin3.SetEvent(ui.__mem_func__(self.__SaveLogin3))
		self.LoadLogin3.SetEvent(ui.__mem_func__(self.__LoadLogin3))
		self.SaveLogin4.SetEvent(ui.__mem_func__(self.__SaveLogin4))
		self.LoadLogin4.SetEvent(ui.__mem_func__(self.__LoadLogin4))
		
		self.idEditLine.SetReturnEvent(ui.__mem_func__(self.pwdEditLine.SetFocus))
		self.idEditLine.SetTabEvent(ui.__mem_func__(self.pwdEditLine.SetFocus))
		self.pwdEditLine.SetReturnEvent(ui.__mem_func__(self.__OnClickLoginButton))
		self.pwdEditLine.SetTabEvent(ui.__mem_func__(self.idEditLine.SetFocus))
		self.idEditLine.SetFocus()
		
		
	def SetChannel(self, ch):
		for key, button in self.channelButton.items():
			button.SetUp()
			
		self.channelButton[ch].Down()

		self.stream.SetConnectInfo(SERVER_IP, self.ChannelPort(ch, 0), SERVER_IP, self.ChannelPort("LOGIN"))
		net.SetMarkServer(SERVER_IP, self.ChannelPort("LOGO"))
		app.SetGuildMarkPath("10.tga")
		app.SetGuildSymbolPath("10")
		net.SetServerInfo(self.ChannelPort(ch, 2))
		
	def ChannelPort(self, ch, value=0):
		channel = {

			0	:	CH1_PORT,
			1	:	CH2_PORT,
			2	:	CH3_PORT,
			3	:	CH4_PORT,}
		
		if ch == "LOGIN":
			return LOGIN
		elif ch == "LOGO":
			return channel[0]
		elif value == 2:
			return SERVER_NAME + ", CH%s" % (ch+1)
		else:
			return channel[ch]
				
	def Connect(self, id, pwd):
		if constInfo.SEQUENCE_PACKET_ENABLE:
			net.SetPacketSequenceMode()
			
		constInfo.LastAccount = id.lower()

		self.stream.popupWindow.Close()
		self.stream.popupWindow.Open(localeInfo.LOGIN_CONNETING, self.EmptyFunc, localeInfo.UI_CANCEL)

		self.stream.SetLoginInfo(id, pwd)
		self.stream.Connect()
		
	def PopupDisplayMessage(self, msg):
		self.stream.popupWindow.Close()
		self.stream.popupWindow.Open(msg)

	def PopupNotifyMessage(self, msg, func=0):
		if not func:
			func = self.EmptyFunc

		self.stream.popupWindow.Close()
		self.stream.popupWindow.Open(msg, func, localeInfo.UI_OK)

	def OnPressExitKey(self):
		if self.stream.popupWindow:
			self.stream.popupWindow.Close()
		self.stream.SetPhaseWindow(0)
		return TRUE

## BUTOANE PENTRU LINKURI ##
	def GoWebSite(self):
		import os
		os.system('@echo off && explorer "https:///"')
		return TRUE

	def GoParolaUitata(self):
		import os
		os.system('@echo off && explorer "https:///"')
		return TRUE

	def GoRegister(self):
		import os
		os.system('@echo off && explorer "https:///"')
		return TRUE
############################

	def EmptyFunc(self):
		pass

	def __OnClickLoginButton(self):
		id = self.idEditLine.GetText()
		pwd = self.pwdEditLine.GetText()

		if len(id)==0:
			self.PopupNotifyMessage(localeInfo.LOGIN_INPUT_ID, self.EmptyFunc)
			return

		if len(pwd)==0:
			self.PopupNotifyMessage(localeInfo.LOGIN_INPUT_PASSWORD, self.EmptyFunc)
			return

		self.Connect(id, pwd)

	def __SaveLogin1(self):
		id = self.idEditLine.GetText()
		pwd = self.pwdEditLine.GetText()
		
		if len(id)==0:
			self.PopupNotifyMessage(locale.LOGIN_INPUT_ID, self.SetIDEditLineFocus)
			return
			
		if len(pwd)==0:
			self.PopupNotifyMessage(locale.LOGIN_INPUT_PASSWORD, self.SetPasswordEditLineFocus)
			return
			
		open('config/Konto1.SyS', 'w').write('%s\t%s' % (id, pwd))
		self.PopupNotifyMessage("Pomyœlnie zapisano dane.")
		
	def __LoadLogin1(self):
		if os.path.exists("config/Konto1.SyS"):
			logininfo = open("config/Konto1.SyS", "r").read().split()
			self.idEditLine.SetText(logininfo[0])
			self.pwdEditLine.SetText(logininfo[1])
		else:
			self.PopupNotifyMessage("Nie zapisano tutaj konta.")

	def __SaveLogin2(self):
		id = self.idEditLine.GetText()
		pwd = self.pwdEditLine.GetText()
		
		if len(id)==0:
			self.PopupNotifyMessage(locale.LOGIN_INPUT_ID, self.SetIDEditLineFocus)
			return
			
		if len(pwd)==0:
			self.PopupNotifyMessage(locale.LOGIN_INPUT_PASSWORD, self.SetPasswordEditLineFocus)
			return
			
		open('config/Konto2.SyS', 'w').write('%s\t%s' % (id, pwd))
		self.PopupNotifyMessage("Pomyœlnie zapisano dane.")
		
	def __LoadLogin2(self):
		if os.path.exists("config/Konto2.SyS"):
			logininfo = open("config/Konto2.SyS", "r").read().split()
			self.idEditLine.SetText(logininfo[0])
			self.pwdEditLine.SetText(logininfo[1])
		else:
			self.PopupNotifyMessage("Nie zapisano tutaj konta.")
			
	def __SaveLogin3(self):
		id = self.idEditLine.GetText()
		pwd = self.pwdEditLine.GetText()
		
		if len(id)==0:
			self.PopupNotifyMessage(locale.LOGIN_INPUT_ID, self.SetIDEditLineFocus)
			return
			
		if len(pwd)==0:
			self.PopupNotifyMessage(locale.LOGIN_INPUT_PASSWORD, self.SetPasswordEditLineFocus)
			return
			
		open('config/Konto3.SyS', 'w').write('%s\t%s' % (id, pwd))
		self.PopupNotifyMessage("Pomyœlnie zapisano dane.")
		
	def __LoadLogin3(self):
		if os.path.exists("config/Konto3.SyS"):
			logininfo = open("config/Konto3.SyS", "r").read().split()
			self.idEditLine.SetText(logininfo[0])
			self.pwdEditLine.SetText(logininfo[1])
		else:
			self.PopupNotifyMessage("Nie zapisano tutaj konta.")
			
	def __SaveLogin4(self):
		id = self.idEditLine.GetText()
		pwd = self.pwdEditLine.GetText()
		
		if len(id)==0:
			self.PopupNotifyMessage(locale.LOGIN_INPUT_ID, self.SetIDEditLineFocus)
			return
			
		if len(pwd)==0:
			self.PopupNotifyMessage(locale.LOGIN_INPUT_PASSWORD, self.SetPasswordEditLineFocus)
			return
			
		open('config/Konto4.SyS', 'w').write('%s\t%s' % (id, pwd))
		self.PopupNotifyMessage("Pomyœlnie zapisano dane.")
		
	def __LoadLogin4(self):
		if os.path.exists("config/Konto4.SyS"):
			logininfo = open("config/Konto4.SyS", "r").read().split()
			self.idEditLine.SetText(logininfo[0])
			self.pwdEditLine.SetText(logininfo[1])
		else:
			self.PopupNotifyMessage("Nie zapisano tutaj konta.")
					
	def __OnClickSaveButton(self):
		id = self.idEditLine.GetText()
		pwd = self.pwdEditLine.GetText()
		
		if len(id)==0:
			self.PopupNotifyMessage(locale.LOGIN_INPUT_ID, self.SetIDEditLineFocus)
			return
			
		if len(pwd)==0:
			self.PopupNotifyMessage(locale.LOGIN_INPUT_PASSWORD, self.SetPasswordEditLineFocus)
			return

 

Link to comment
Share on other sites

	def __RequestServerStateList(self):
		regionID = self.__GetRegionID()
		serverID = self.__GetServerID()

		try:
			channelDict = serverInfo.REGION_DICT[regionID][serverID]["channel"]
		except:
			print " __RequestServerStateList - serverInfo.REGION_DICT(%d, %d)" % (regionID, serverID)
			return

		for id, channelDataDict in channelDict.items():
			key=channelDataDict["key"]
			ip=channelDataDict["ip"]
			udp_port=channelDataDict["udp_port"]
################ You must add this line for online channels ##############
			ServerStateChecker.AddChannel(key, ip, udp_port)
############################### END ######################################
			ServerStateChecker.Request(key, ip, udp_port)

 

Link to comment
Share on other sites

I dont get it im keep trying to add its not working

On 10/31/2018 at 7:21 AM, Cunoo said:

	def __RequestServerStateList(self):
		regionID = self.__GetRegionID()
		serverID = self.__GetServerID()

		try:
			channelDict = serverInfo.REGION_DICT[regionID][serverID]["channel"]
		except:
			print " __RequestServerStateList - serverInfo.REGION_DICT(%d, %d)" % (regionID, serverID)
			return

		for id, channelDataDict in channelDict.items():
			key=channelDataDict["key"]
			ip=channelDataDict["ip"]
			udp_port=channelDataDict["udp_port"]
################ You must add this line for online channels ##############
			ServerStateChecker.AddChannel(key, ip, udp_port)
############################### END ######################################
			ServerStateChecker.Request(key, ip, udp_port)

 

 

Link to comment
Share on other sites

6 minutes ago, gweilo321 said:

I obviously havent showed the ip but its in the file. When i add this code nothing is showing in login window

Yes you dont have in your intrologin.py 

ServerStateChecker

Add it and in my code :

AddChannel

I solved this problem in my client long time ago with this.. But I using 40k for 2011 client. If you need help, send me pm.

Link to comment
Share on other sites

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.