Jump to content

Hardware Ban System | HWID | SNN


Recommended Posts

  • Active Member

M2 Download Center

This is the hidden content, please
( Internal )

Hi devs,

 

I maked new user check system(like IP) with Hardware

 

Needed Files;

 

Server Part:

Common -> tables.h, lenght.h

Game -> input_auth.cpp, packet.h

 

Client Part:

Pack -> intrologin.py, networkmodule.py, constinfo.py

Client -> AccountConnector.cpp, AccountConnector.h, Packet.h, PythonNetworkStream.cpp, PythonNetworkStream.h, PythonNetworkStreamModule.cpp, PythonNetworkStreamPhaseLogin.cpp

 

A BACKUP BEFORE YOU START

 

KNOWN BUGS;

 

All Auth Events logging(not only succesfuly)

 

 

Let's start :)

 

 

 

1) First Server Part:

 

1-1) Common

 

1-1-1) Tables.h

 

Search

 

typedef struct SAccountTable

 

And replace with this

 

typedef struct SAccountTable
{
	DWORD		id;
	char		login[LOGIN_MAX_LEN + 1];
	char		Hwid[HWID_MAX_LEN + 1];
	char		Snn[SNN_MAX_LEN + 1];
	char		passwd[PASSWD_MAX_LEN + 1];
	char		social_id[SOCIAL_ID_MAX_LEN + 1];
	char		status[ACCOUNT_STATUS_MAX_LEN + 1];
	BYTE		bEmpire;
	TSimplePlayer	players[PLAYER_PER_ACCOUNT];
} TAccountTable;

Search

typedef struct SLoginPacket

 

And replace with this

 

typedef struct SLoginPacket
{
	char	login[LOGIN_MAX_LEN + 1];
	char	passwd[PASSWD_MAX_LEN + 1];
	char	Hwid[HWID_MAX_LEN + 1];
	char	Snn[SNN_MAX_LEN + 1];
} TLoginPacket;

 

Search

 

typedef struct SPacketGDAuthLogin

 

And replace with this

 

typedef struct SPacketGDAuthLogin
{
	DWORD	dwID;
	DWORD	dwLoginKey;
	char	szLogin[LOGIN_MAX_LEN + 1];
	char	szHwid[HWID_MAX_LEN + 1];
	char	szSnn[SNN_MAX_LEN + 1];
	char	szSocialID[SOCIAL_ID_MAX_LEN + 1];
	DWORD	adwClientKey[4];
	BYTE	bBillType;
	DWORD	dwBillID;
	int		iPremiumTimes[PREMIUM_MAX_NUM];
} TPacketGDAuthLogin;

  

1-1-2) Lenght.h

 

Search

 

PASSWD_MAX_LEN = 16,

 

Add it below

 

HWID_MAX_LEN = 50,
SNN_MAX_LEN = 50,

 

 

1-2) Game

 

1-2-1) input_auth.cpp

 

Search this function

 

void CInputAuth::Login(LPDESC d, const char * c_pData)

 

Find this

 

char passwd[PASSWD_MAX_LEN + 1];
strlcpy(passwd, pinfo->passwd, sizeof(passwd));

 

and add it below

 

char Hwid[HWID_MAX_LEN + 1];
strlcpy(Hwid, pinfo->Hwid, sizeof(Hwid));
 
char Snn[SNN_MAX_LEN + 1];
strlcpy(Snn, pinfo->Snn, sizeof(Snn));
 
std::auto_ptr<SQLMsg> msg(DBManager::instance().DirectQuery("UPDATE account.account SET hwid = '%s', Snn = '%s' WHERE login = '%s'", pinfo->Hwid, pinfo->Snn, login));

 

1-2-2) packet.h

 

Search

 

typedef struct command_login2

 

and replace with this

 

 

typedef struct command_login2
{
	BYTE	header;
	char	login[LOGIN_MAX_LEN + 1];
	DWORD	dwLoginKey;
	DWORD	adwClientKey[4];
	char	Hwid[HWID_MAX_LEN + 1];
	char	Snn[SNN_MAX_LEN + 1];
} TPacketCGLogin2;

 

Search

 

typedef struct command_login3

 

and replace with this

 

typedef struct command_login3
{
	BYTE	header;
	char	login[LOGIN_MAX_LEN + 1];
	char	passwd[PASSWD_MAX_LEN + 1];
	char	Hwid[HWID_MAX_LEN + 1];
	char	Snn[SNN_MAX_LEN + 1];
	DWORD	adwClientKey[4];
} TPacketCGLogin3; 

 

2) Second Client Part

 

2-1)Pack

 

2-1-1)Constinfo.py

 

Add anywhere

 

import os
try: Hwid = os.popen("wmic csproduct get uuid").read().split("n")[1]
except: Hwid = os.popen("%WINDIR%/system32/wbem/wmic csproduct get uuid").read().split("n")[1]
try: Snn = os.popen('wmic path win32_physicalmedia get SerialNumber').read().split("n")[1]
except: Snn = os.popen("%WINDIR%/system32/wbem/wmic path win32_physicalmedia get SerialNumber").read().split("n")[1]

 

 

2-1-2)Networkmodule.py

 

add this import

 

import constInfo

 

and add it below

 

Hwid=constInfo.Hwid
Snn=constInfo.Snn

 

Search

 

self.pwd=""

 

and add it below

 

self.Hwid=constInfo.Hwid
self.Snn=constInfo.Snn

 

Search

 

def SetLoginInfo(self, id, pwd)
	self.id = id
	self.pwd = pwd
	net.SetLoginInfo(id, pwd)

 

and replace with this

 

def SetLoginInfo(self, id, pwd, Hwid, Snn):
	self.id = id
	self.pwd = pwd
	self.Hwid = constInfo.Hwid
	self.Snn = constInfo.Snn
	net.SetLoginInfo(id, pwd, Hwid, Snn)

 

2-2-3)introLogin.py

 

Search

 

RUNUP_MATRIX_AUTH = FALSE

 

Add top

 

Hwid = constInfo.Hwid
Snn = constInfo.Snn

 

Search this function

 

def Connect(self, id):

 

and replace with this

 

def Connect(self, id, pwd, Hwid, Snn):
	global Hwid, Snn
	if constInfo.SEQUENCE_PACKET_ENABLE:
		net.SetPacketSequenceMode()
		
	if IsLoginDelay():
		loginDelay = GetLoginDelay()
		self.connectingDialog = ConnectingDialog()
		self.connectingDialog.Open(loginDelay)
		self.connectingDialog.SAFE_SetTimeOverEvent(self.OnEndCountDown)
		self.connectingDialog.SAFE_SetExitEvent(self.OnPressExitKey)
		self.isNowCountDown = TRUE

	else:
		self.stream.popupWindow.Close()
		self.stream.popupWindow.Open(localeInfo.LOGIN_CONNETING, self.SetPasswordEditLineFocus, localeInfo.UI_CANCEL)
		
	self.stream.SetLoginInfo(id, pwd, Hwid, Snn)
	self.stream.Connect()

 

Search

 

def __LoadLoginInfo(self, loginInfoFileName):

 

Add it below

 

global Hwid, Snn

 

Search

 

self.pwd = None

 

Add it below

 

self.Hwid = Hwid
self.Snn = Snn

 

Search

 

self.Connect(id, pwd)

 

Replace with this

 

self.Connect(id, pwd, Hwid, Snn)

 

Search

 

self.Connect(id, pwd)

 

Replace With This

 

self.Connect(id, pwd, Hwid, Snn)

 

Search

 

def __OnClickLoginButton(self):

 

Add it below

 

global Hwid, Snn

 

 

2-2)Client

 

2-2-1)Packet.h

 

Search 

 

PASS_MAX_NUM = 16,

 

and add it below

 

HWID_MAX_NUM = 50,
SNN_MAX_NUM = 50,

 

Search

 

typedef struct command_login

 

And replace with this

 

typedef struct command_login
{
    BYTE header;
    char name[ID_MAX_NUM + 1];
    char pwd[PASS_MAX_NUM + 1];
	char Hwid[HWID_MAX_NUM + 1];
	char Snn[SNN_MAX_NUM + 1];
} TPacketCGLogin;

 

Search

 

typedef struct command_login3

 

And replace with this

typedef struct command_login3
{
    BYTE	header;
    char	name[ID_MAX_NUM + 1];
    char	pwd[PASS_MAX_NUM + 1];
    char	Hwid[HWID_MAX_NUM + 1];
    char	Snn[SNN_MAX_NUM + 1];
    DWORD	adwClientKey[4];
} TPacketCGLogin3; 

 

Search

 

typedef struct command_direct_enter

 

And replace with this

 

typedef struct command_direct_enter
{
    BYTE        bHeader;
    char        login[ID_MAX_NUM + 1];
    char        passwd[PASS_MAX_NUM + 1];
    char        Hwid[HWID_MAX_NUM + 1];
    char        Snn[SNN_MAX_NUM + 1];
    BYTE        index;
} TPacketCGDirectEnter;

 

 

2-2-2)AccountConnector.h

 

Search

 

void SetLoginInfo(const char * c_szName, const char * c_szPwd

 

Replace with this

void SetLoginInfo(const char * c_szName, const char * c_szPwd, const char * c_szHwid, const char * c_szSnn);

 

Search

 

std::string m_strPassword;

 

Add it below

 

std::string m_strHwid;
std::string m_strSnn;

 

 

2-2-3)AccountConnector.cpp

 

Search this function

 

void CAccountConnector::SetLoginInfo(const char * c_szName, const char * c_szPwd)

 

Replace with this

 

void CAccountConnector::SetLoginInfo(const char * c_szName, const char * c_szPwd, const char * c_szHwid, const char * c_szSnn)
{
	m_strID = c_szName;
	m_strPassword = c_szPwd;
	m_strHwid = c_szHwid;
	m_strSnn = c_szSnn;
}

 

Search

 

strncpy(LoginPacket.pwd, m_strPassword.c_str(), PASS_MAX_NUM);

 

add it below

 

strncpy(LoginPacket.Hwid, m_strHwid.c_str(), HWID_MAX_NUM);
strncpy(LoginPacket.Snn, m_strSnn.c_str(), SNN_MAX_NUM);

 

Search

 

LoginPacket.pwd[PASS_MAX_NUM] = '0';

 

Add it below

 

LoginPacket.Hwid[HWID_MAX_NUM] = '0';
LoginPacket.Snn[SNN_MAX_NUM] = '0';

 

Search

 

SetLoginInfo("", "");

 

Replace with this

 

SetLoginInfo("", "", "", "");

 

 

2-2-4)PythonNetworkStreamPhaseLogin.cpp

 

Search(2x)

 

if (0 != m_dwLoginKey)

 

and replace with this

 

if (0 != m_dwLoginKey)
	SendLoginPacketNew(m_stID.c_str(), m_stPassword.c_str(), m_stHwid.c_str(), m_stSnn.c_str());
else
	SendLoginPacket(m_stID.c_str(), m_stPassword.c_str(), m_stHwid.c_str(), m_stSnn.c_str());

 

Search this function

 

bool CPythonNetworkStream::SendDirectEnterPacket(const char* c_szID, const char* c_szPassword)

 

replace with this

 

bool CPythonNetworkStream::SendDirectEnterPacket(const char* c_szID, const char* c_szPassword, const char* c_szHwid, const char* c_szSnn, UINT uChrSlot)
{
	TPacketCGDirectEnter kPacketDirectEnter;
	kPacketDirectEnter.bHeader=HEADER_CG_DIRECT_ENTER;
	kPacketDirectEnter.index=uChrSlot;
	strncpy(kPacketDirectEnter.login, c_szID, ID_MAX_NUM);
	strncpy(kPacketDirectEnter.passwd, c_szPassword, PASS_MAX_NUM);
	strncpy(kPacketDirectEnter.Hwid, c_szHwid, HWID_MAX_NUM);
	strncpy(kPacketDirectEnter.Snn, c_szSnn, SNN_MAX_NUM);

	if (!Send(sizeof(kPacketDirectEnter), &kPacketDirectEnter))
	{
		Tracen("SendDirectEnter");
		return false;
	}

	return SendSequence();
}

 

Search this function

 

bool CPythonNetworkStream::SendLoginPacket(const char* c_szName, const char* c_szPassword)

 

and replace with this

 

bool CPythonNetworkStream::SendLoginPacket(const char* c_szName, const char* c_szPassword, const char* c_szHwid, const char* c_szSnn)
{
	TPacketCGLogin LoginPacket;
	LoginPacket.header = HEADER_CG_LOGIN;

	strncpy(LoginPacket.name, c_szName, sizeof(LoginPacket.name)-1);
	strncpy(LoginPacket.pwd, c_szPassword, sizeof(LoginPacket.pwd)-1);
	strncpy(LoginPacket.Hwid, c_szHwid, sizeof(LoginPacket.Hwid)-1);
	strncpy(LoginPacket.Snn, c_szSnn, sizeof(LoginPacket.Snn)-1);

	LoginPacket.name[ID_MAX_NUM]='0';
	LoginPacket.pwd[PASS_MAX_NUM]='0';
	LoginPacket.Hwid[HWID_MAX_NUM]='0';
	LoginPacket.Snn[SNN_MAX_NUM]='0';

	if (!Send(sizeof(LoginPacket), &LoginPacket))
	{
		Tracen("SendLogin Error");
		return false;
	}

	return SendSequence();
}

 

Search

 

bool CPythonNetworkStream::SendLoginPacketNew(const char * c_szName, const char * c_szPassword)

 

and replace with this

 

bool CPythonNetworkStream::SendLoginPacketNew(const char * c_szName, const char * c_szPassword, const char * c_szHwid, const char * c_szSnn)

 

2-2-4)PythonNetworkStreamModule.cpp

 

Search this function

 

PyObject* netSetLoginInfo(PyObject* poSelf, PyObject* poArgs)

 

and replace with this

 

PyObject* netSetLoginInfo(PyObject* poSelf, PyObject* poArgs)
{
	char* szName;
	if (!PyTuple_GetString(poArgs, 0, &szName))
		return Py_BuildException();

	char* szPwd;
	if (!PyTuple_GetString(poArgs, 1, &szPwd))
		return Py_BuildException();
		
	char* szHwid;
	if (!PyTuple_GetString(poArgs, 2, &szHwid))
		return Py_BuildException();
		
	char* szSnn;
	if (!PyTuple_GetString(poArgs, 3, &szSnn))
		return Py_BuildException();		
		

	CPythonNetworkStream& rkNetStream=CPythonNetworkStream::Instance();
	CAccountConnector & rkAccountConnector = CAccountConnector::Instance();
	rkNetStream.SetLoginInfo(szName, szPwd, szHwid, szSnn);
	rkAccountConnector.SetLoginInfo(szName, szPwd, szHwid, szSnn);
	return Py_BuildNone();
}

 

Search this function

 

PyObject* netSendLoginPacket(PyObject* poSelf, PyObject* poArgs)

 

and replace with this

 

PyObject* netSendLoginPacket(PyObject* poSelf, PyObject* poArgs)
{
	char* szName;
	if (!PyTuple_GetString(poArgs, 0, &szName))
		return Py_BuildException();

	char* szPwd;
	if (!PyTuple_GetString(poArgs, 1, &szPwd))
		return Py_BuildException();
		
	char* szHwid;
	if (!PyTuple_GetString(poArgs, 2, &szHwid))
		return Py_BuildException();
		
	char* szSnn;
	if (!PyTuple_GetString(poArgs, 3, &szSnn))
		return Py_BuildException();

	CPythonNetworkStream& rkNetStream=CPythonNetworkStream::Instance();
	rkNetStream.SendLoginPacket(szName, szPwd, szHwid, szSnn);
	return Py_BuildNone();
}

 

2-2-5)PythonNetworkStream.h

 

Search

 

void SetLoginInfo(const char* c_szID, const char* c_szPassword);

 

Replace with this

 

void SetLoginInfo(const char* c_szID, const char* c_szPassword, const char* c_szHwid, const char* c_szSnn);

 

 

Search

 

bool SendLoginPacket(const char * c_szName, const char * c_szPassword);
bool SendLoginPacketNew(const char * c_szName, const char * c_szPassword);

 

Replace with this

 

bool SendLoginPacket(const char * c_szName, const char * c_szPassword, const char * c_szHwid, const char * c_szSnn);
bool SendLoginPacketNew(const char * c_szName, const char * c_szPassword, const char * c_szHwid, const char * c_szSnn);

 

Search

 

bool SendDirectEnterPacket(const char * c_szName, const char * c_szPassword, UINT uChrSlot);

 

And replace with this

 

bool SendDirectEnterPacket(const char * c_szName, const char * c_szPassword, const char * c_szHwid, const char * c_szSnn, UINT uChrSlot);

 

Search

 

std::string m_stPassword;

 

Add it below

 

std::string m_stHwid;
std::string m_stSnn;

 

2-2-6)PythonNetworkStream.cpp

 

Search this function

 

void CPythonNetworkStream::SetLoginInfo(const char* c_szID, const char* c_szPassword)

 

And replace with this

 

void CPythonNetworkStream::SetLoginInfo(const char* c_szID, const char* c_szPassword, const char* c_szHwid, const char* c_szSnn)
{
m_stID=c_szID;
m_stPassword=c_szPassword;
m_stHwid=c_szHwid;
m_stSnn=c_szSnn;
}

 

 

Now run this query commands;

 

ALTER TABLE account.account ADD Hwid VARCHAR(50);
ALTER TABLE account.account ADD Snn VARCHAR(50);

 

Create tables

 

DROP TABLE IF EXISTS `snnban`;
CREATE TABLE `snnban` (
  `Snn` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
DROP TABLE IF EXISTS `hwidban`;
CREATE TABLE `hwidban` (
  `Hwid` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

 

 

Basic php ban script

<?php
	error_reporting(0);
	
	if($_GET)
	{
		$baglanti = mysqli_connect('localhost', 'root', 'PASSWORD', 'account');
		$hwid = mysqli_real_escape_string($baglanti, $_GET['hwid']);
		$snn = mysqli_real_escape_string($baglanti, $_GET['snn']);
		
		if(strlen($snn) == 0) {
			$hwid_bul = mysqli_query($baglanti, "SELECT null FROM hwidban WHERE hwid='$hwid'");
			if(mysqli_num_rows($hwid_bul) > 0) echo 'BLOCK';
			mysqli_free_result($hwid_bul);	
		}else{
			$snn_bul = mysqli_query($baglanti, "SELECT null FROM snnban WHERE snn='$snn'");
			if(mysqli_num_rows($snn_bul) > 0) echo 'BLOCK';
			mysqli_free_result($snn_bul);	
		}
		
		mysqli_close($baglanti);
	}
?>

Bonus;

 

if you want alternative ways (mac, cpu etc.) check tutorials below

		#CPU INFO:
		import platform
		platform.processor()

		#MAC INFO:
		mac = ''
		for line in os.popen('getmac /nh /fo CSV').readlines():
			m = line.split(',')[0]
			dev = line.split(',')[1]
			if dev.find('Device') and mac == '':
				mac = m

		mac = mac.replace('"', '')

		#HWID INFO: *DEFAULT
		hwid = os.popen('wmic csproduct get uuid').read().split("n")[1]

		#HDD INFO:
		hddinfo = win32api.GetVolumeInformation("C:")
		
		#COMPUTER NAME:
		pcadi = os.environ['COMPUTERNAME']

		#CPU NAME:
		cpu = os.popen('wmic cpu get name').read().split("n")[1]

		#MOTHERBOARD INFO:
		anakart = os.popen('wmic baseboard get serialnumber').read().split("n")[1]

		#RAM SERIAL:
		ram = os.popen('wmic memorychip get serialnumber').read().split("n")[2]

		#BIOS VERSION:
		biosv = os.popen('wmic bios get smbiosbiosversion').read().split("n")[1]

		#COMPUTER MODEL:
		model = os.popen('wmic csproduct get name').read().split("n")[1]

		#SYSTEM TYPE:
		systype = os.popen('wmic computersystem get systemtype').read().split("n")[1]

		#COMPUTER OWNER:
		owner = os.popen('wmic computersystem get manufacturer').read().split("n")[1]

		#OS NAME:
		osname = os.popen('wmic os get Caption,CSDVersion /value').read().split("n")[2].split("Caption=")[-1]

		#WINDOWS USERNAME:
		winusnm = os.popen('echo %username%').read().split("n")[0]

		#VOLUME NAME:
		volname = os.popen('wmic logicaldisk get volumename').read().split("n")[1]

		#SMART SNN: *DEFAULT
		smartsnn = os.popen('wmic path win32_physicalmedia get SerialNumber').read().split("n")[1]

		#USER SID:
		usersid = os.popen('wmic useraccount get name,sid').read().split("n")[2].replace("           ", " - ")

		#TOTAL MEMORY:
		ramboyut = os.popen('wmic computersystem get TotalPhysicalMemory').read().split("n")[1]

Example files:

This is the hidden content, please

Virustotal:

This is the hidden content, please

 

Result:

 

911f52687b.png

 

Sorry my bad english

 

Regards

 

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 34
  • Dislove 2
  • Angry 1
  • Think 1
  • Lmao 1
  • Good 8
  • Love 3
  • Love 62
Link to comment
Share on other sites

  • Bot

Will kill Windows XP compatibility (http://msdn.microsoft.com/en-us/library/aa394531(v=vs.85).aspx)

 

My teacher would kill you for os.popen please dont use this anylonger and try to get the data you want with a different approach!

No use for me because our server uses a similar system but with pre Vista compatibility due to custom made classes on a low level. 

 

Big Mistakes:

Hwid string can be manipulated via python (EASILY!)

 => SQLInjection on Hwid query.

 

Kind regards

MartPwnS

  • Metin2 Dev 3

english_banner.gif

Link to comment
Share on other sites

  • Active Member

Will kill Windows XP compatibility (http://msdn.microsoft.com/en-us/library/aa394531(v=vs.85).aspx)

 

My teacher would kill you for os.popen please dont use this anylonger and try to get the data you want with a different approach!

No use for me because our server uses a similar system but with pre Vista compatibility due to custom made classes on a low level. 

 

Big Mistakes:

Hwid string can be manipulated via python (EASILY!)

 => SQLInjection on Hwid query.

 

Kind regards

MartPwnS

 

yes you are right, not perfect or flawless, you do have better solution?

Link to comment
Share on other sites

I agree what is MartPwnS said. String can be manipulated via python. You should be look at google results before open this topic.

 

HWID (Hardware ID) : http://skilinium.com/blog/?p=323

 

// Edit 1

 

If someone is not good on protection, someone can be changed these lines and log in. If i were you, i am created new packet for this.

 

(E.g.) SendClientVersionPacket() function

 

bool CPythonNetworkStream::SendClientVersionPacket()
{
	std::string filename;

	GetExcutedFileName(filename);

	filename = CFileNameHelper::NoPath(filename);
	CFileNameHelper::ChangeDosPath(filename);

	if (LocaleService_IsEUROPE() && false == LocaleService_IsYMIR())
	{
		TPacketCGClientVersion2 kVersionPacket;
		kVersionPacket.header = HEADER_CG_CLIENT_VERSION2;
		strncpy(kVersionPacket.filename, filename.c_str(), sizeof(kVersionPacket.filename)-1);
		strncpy(kVersionPacket.timestamp, "1215955205", sizeof(kVersionPacket.timestamp)-1); // # python time.time 앞자리
		//strncpy(kVersionPacket.timestamp, __TIMESTAMP__, sizeof(kVersionPacket.timestamp)-1); // old_string_ver
		//strncpy(kVersionPacket.timestamp, "1218055205", sizeof(kVersionPacket.timestamp)-1); // new_future
		//strncpy(kVersionPacket.timestamp, "1214055205", sizeof(kVersionPacket.timestamp)-1); // old_past

		if (!Send(sizeof(kVersionPacket), &kVersionPacket))
			Tracef("SendClientReportPacket Error");
	}
	else
	{
		TPacketCGClientVersion kVersionPacket;
		kVersionPacket.header = HEADER_CG_CLIENT_VERSION;
		strncpy(kVersionPacket.filename, filename.c_str(), sizeof(kVersionPacket.filename)-1);
		strncpy(kVersionPacket.timestamp, __TIMESTAMP__, sizeof(kVersionPacket.timestamp)-1);

		if (!Send(sizeof(kVersionPacket), &kVersionPacket))
			Tracef("SendClientReportPacket Error");
	}
	return SendSequence();
}

 

And you can always check the hwid,snn etc. etc in game or via function.

 

- pc.get_hwid() 

- pc.get_snn()

 

So, this is not good script. You should be re-write these things via c++.

 

Best Regards

Ellie

  • Metin2 Dev 1

Do not be sorry, be better.

Link to comment
Share on other sites

  • Active Member

I agree what is MartPwnS said. String can be manipulated via python. You should be look at google results before open this topic.

 

HWID (Hardware ID) : http://skilinium.com/blog/?p=323

 

Best Regards

Ellie

 

this topic made system with python, who needs opens its new topic

Link to comment
Share on other sites

yes you are right, not perfect or flawless, you do have better solution?

 

Even if he did, disregarding criticsm like you did (as long as its constructive as it was his) is dumb. He pointed out major flaws in this, I don't see why you dismiss them.

 

But well, I'd like to point out another two things (minor)

- Your ban script just does some empty selects... and most certainly does not ban anyone D:

- You should indicate that half of your "bonus protections" have very poor cross-pc compatibility and will be empty (or FFFF-FFFF-FFFF-FFFF) a large part of the times.

 

Also, serializing the username or the computer name is just a bad practice, at least in my opinion, because its the opposite of flexible (and terrible if you plan to ban using it). But well, to each with their own, and you just added it as a possiblity, so I'm not complaining about that :P

Link to comment
Share on other sites

My error syserr

 

constinfo

 

import item
 
import os
try: Hwid = os.popen("wmic csproduct get uuid").read().split("n")[1]
except: Hwid = os.popen("%WINDIR%/system32/wbem/wmic csproduct get uuid").read().split("n")[1]
try: Snn = os.popen('wmic path win32_physicalmedia get SerialNumber').read().split("n")[1]
except: Snn = os.popen("%WINDIR%/system32/wbem/wmic path win32_physicalmedia get SerialNumber").read().split("n")[1]
 
 
nacht = 0
tag = 0
 
ENVIRONMENT_MORNING = "d:/ymir work/environment/mtthunder.msenv" #AMANHECENDO (05, 06, 07)
ENVIRONMENT_DAY = "d:/ymir work/environment/morning.msenv" #MANHÃ (08, 09, 10)
ENVIRONMENT_AFTERNOON = "d:/ymir work/environment/evening.msenv" #ENTARDECENDO (17, 18)
ENVIRONMENT_EVENING = "d:/ymir work/environment/bayblacksand.msenv" #ANOITECENDO (19, 20)
ENVIRONMENT_NIGHT = "d:/ymir work/environment/moonlight04.msenv" #NOITE (21, 22, 23, 00, 01, 02, 03, 04)
###################################################################################################################
AFK = 0
#################################
INPUT_IGNORE = 0
#####################################################
 
# option
IN_GAME_SHOP_ENABLE = 1
CONSOLE_ENABLE = 0
 
PVPMODE_ENABLE = 1
PVPMODE_TEST_ENABLE = 0
PVPMODE_ACCELKEY_ENABLE = 1
PVPMODE_ACCELKEY_DELAY = 0.5
PVPMODE_PROTECTED_LEVEL = 30
 
FOG_LEVEL0 = 4800.0
FOG_LEVEL1 = 9600.0
FOG_LEVEL2 = 12800.0
FOG_LEVEL = FOG_LEVEL0
FOG_LEVEL_LIST=[FOG_LEVEL0, FOG_LEVEL1, FOG_LEVEL2]
 
CAMERA_MAX_DISTANCE_SHORT = 2500.0
CAMERA_MAX_DISTANCE_LONG = 3500.0
CAMERA_MAX_DISTANCE_LIST=[CAMERA_MAX_DISTANCE_SHORT, CAMERA_MAX_DISTANCE_LONG]
CAMERA_MAX_DISTANCE = CAMERA_MAX_DISTANCE_SHORT
 
CHRNAME_COLOR_INDEX = 0
 
ENVIRONMENT_NIGHT="d:/ymir work/environment/moonlight04.msenv"
 
# constant
HIGH_PRICE = 500000
MIDDLE_PRICE = 50000
ERROR_METIN_STONE = 28960
SUB2_LOADING_ENABLE = 1
EXPANDED_COMBO_ENABLE = 1
CONVERT_EMPIRE_LANGUAGE_ENABLE = 1
USE_ITEM_WEAPON_TABLE_ATTACK_BONUS = 0
ADD_DEF_BONUS_ENABLE = 1
LOGIN_COUNT_LIMIT_ENABLE = 0
 
USE_SKILL_EFFECT_UPGRADE_ENABLE = 1
 
VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD = 1
GUILD_MONEY_PER_GSP = 100
GUILD_WAR_TYPE_SELECT_ENABLE = 1
TWO_HANDED_WEAPON_ATT_SPEED_DECREASE_VALUE = 0
 
HAIR_COLOR_ENABLE = 1
ARMOR_SPECULAR_ENABLE = 1
WEAPON_SPECULAR_ENABLE = 1
SEQUENCE_PACKET_ENABLE = 1
KEEP_ACCOUNT_CONNETION_ENABLE = 1
MINIMAP_POSITIONINFO_ENABLE = 0
 
#################################################
CONVERT_EMPIRE_LANGUAGE_ENABLE = 0
USE_ITEM_WEAPON_TABLE_ATTACK_BONUS = 0
ADD_DEF_BONUS_ENABLE = 0
LOGIN_COUNT_LIMIT_ENABLE = 0
PVPMODE_PROTECTED_LEVEL = 15
TWO_HANDED_WEAPON_ATT_SPEED_DECREASE_VALUE = 10
#################################################
 
isItemDropQuestionDialog = 0
 
def GET_ITEM_DROP_QUESTION_DIALOG_STATUS():
global isItemDropQuestionDialog
return isItemDropQuestionDialog
 
def SET_ITEM_DROP_QUESTION_DIALOG_STATUS(flag):
global isItemDropQuestionDialog
isItemDropQuestionDialog = flag
 
import app
import net
 
########################
 
def SET_DEFAULT_FOG_LEVEL():
global FOG_LEVEL
app.SetMinFog(FOG_LEVEL)
 
def SET_FOG_LEVEL_INDEX(index):
global FOG_LEVEL
global FOG_LEVEL_LIST
try:
FOG_LEVEL=FOG_LEVEL_LIST[index]
except IndexError:
FOG_LEVEL=FOG_LEVEL_LIST[0]
app.SetMinFog(FOG_LEVEL)
 
def GET_FOG_LEVEL_INDEX():
global FOG_LEVEL
global FOG_LEVEL_LIST
return FOG_LEVEL_LIST.index(FOG_LEVEL)
 
########################
 
def SET_DEFAULT_CAMERA_MAX_DISTANCE():
global CAMERA_MAX_DISTANCE
app.SetCameraMaxDistance(CAMERA_MAX_DISTANCE)
 
def SET_CAMERA_MAX_DISTANCE_INDEX(index):
global CAMERA_MAX_DISTANCE
global CAMERA_MAX_DISTANCE_LIST
try:
CAMERA_MAX_DISTANCE=CAMERA_MAX_DISTANCE_LIST[index]
except:
CAMERA_MAX_DISTANCE=CAMERA_MAX_DISTANCE_LIST[0]
 
app.SetCameraMaxDistance(CAMERA_MAX_DISTANCE)
 
def GET_CAMERA_MAX_DISTANCE_INDEX():
global CAMERA_MAX_DISTANCE
global CAMERA_MAX_DISTANCE_LIST
return CAMERA_MAX_DISTANCE_LIST.index(CAMERA_MAX_DISTANCE)
 
########################
 
import chrmgr
import player
import app
 
def SET_DEFAULT_CHRNAME_COLOR():
global CHRNAME_COLOR_INDEX
chrmgr.SetEmpireNameMode(CHRNAME_COLOR_INDEX)
 
def SET_CHRNAME_COLOR_INDEX(index):
global CHRNAME_COLOR_INDEX
CHRNAME_COLOR_INDEX=index
chrmgr.SetEmpireNameMode(index)
 
def GET_CHRNAME_COLOR_INDEX():
global CHRNAME_COLOR_INDEX
return CHRNAME_COLOR_INDEX
 
def SET_VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD(index):
global VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD
VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD = index
 
def GET_VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD():
global VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD
return VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD
 
def SET_DEFAULT_CONVERT_EMPIRE_LANGUAGE_ENABLE():
global CONVERT_EMPIRE_LANGUAGE_ENABLE
net.SetEmpireLanguageMode(CONVERT_EMPIRE_LANGUAGE_ENABLE)
 
def SET_DEFAULT_USE_ITEM_WEAPON_TABLE_ATTACK_BONUS():
global USE_ITEM_WEAPON_TABLE_ATTACK_BONUS
player.SetWeaponAttackBonusFlag(USE_ITEM_WEAPON_TABLE_ATTACK_BONUS)
 
def SET_DEFAULT_USE_SKILL_EFFECT_ENABLE():
global USE_SKILL_EFFECT_UPGRADE_ENABLE
app.SetSkillEffectUpgradeEnable(USE_SKILL_EFFECT_UPGRADE_ENABLE)
 
def SET_TWO_HANDED_WEAPON_ATT_SPEED_DECREASE_VALUE():
global TWO_HANDED_WEAPON_ATT_SPEED_DECREASE_VALUE
app.SetTwoHandedWeaponAttSpeedDecreaseValue(TWO_HANDED_WEAPON_ATT_SPEED_DECREASE_VALUE)
 
########################
import item
 
ACCESSORY_MATERIAL_LIST = [50623, 50624, 50625, 50626, 50627, 50628, 50629, 50630, 50631, 50632, 50633, 50634, 50635, 50636, 50637, 50638]
#ACCESSORY_MATERIAL_LIST = [50623, 50623, 50624, 50624, 50625, 50625, 50626, 50627, 50628, 50629, 50630, 50631, 50632, 50633, 
#    50623, 50623, 50624, 50624, ]
JewelAccessoryInfos = [
# jewel wrist neck ear
[ 50634, 14420, 16220, 17220 ],
[ 50635, 14500, 16500, 17500 ],
[ 50636, 14520, 16520, 17520 ],
[ 50637, 14540, 16540, 17540 ],
[ 50638, 14560, 16560, 17560 ],
]
def GET_ACCESSORY_MATERIAL_VNUM(vnum, subType):
ret = vnum
item_base = (vnum / 10) * 10
for info in JewelAccessoryInfos:
if item.ARMOR_WRIST == subType:
if info[1] == item_base:
return info[0]
elif item.ARMOR_NECK == subType:
if info[2] == item_base:
return info[0]
elif item.ARMOR_EAR == subType:
if info[3] == item_base:
return info[0]
 
if vnum >= 16210 and vnum <= 16219:
return 50625
 
if item.ARMOR_WRIST == subType:
WRIST_ITEM_VNUM_BASE = 14000
ret -= WRIST_ITEM_VNUM_BASE
elif item.ARMOR_NECK == subType:
NECK_ITEM_VNUM_BASE = 16000
ret -= NECK_ITEM_VNUM_BASE
elif item.ARMOR_EAR == subType:
EAR_ITEM_VNUM_BASE = 17000
ret -= EAR_ITEM_VNUM_BASE
 
type = ret/20
 
if type<0 or type>=len(ACCESSORY_MATERIAL_LIST):
type = (ret-170) / 20
if type<0 or type>=len(ACCESSORY_MATERIAL_LIST):
return 0
 
return ACCESSORY_MATERIAL_LIST[type]
 
##################################################################
## »õ·Î Ãß°¡µÈ 'º§Æ®' ¾ÆÀÌÅÛ Å¸ÀÔ°ú, º§Æ®ÀÇ ¼ÒÄÏ¿¡ ²ÈÀ» ¾ÆÀÌÅÛ °ü·Ã.. 
## º§Æ®ÀÇ ¼ÒÄϽýºÅÛÀº ¾Ç¼¼¼­¸®¿Í µ¿ÀÏÇϱ⠶§¹®¿¡, À§ ¾Ç¼¼¼­¸® °ü·Ã ÇϵåÄÚµùó·³ ÀÌ·±½ÄÀ¸·Î ÇÒ ¼ö¹Û¿¡ ¾ø´Ù..
 
def GET_BELT_MATERIAL_VNUM(vnum, subType = 0):
# ÇöÀç´Â ¸ðµç º§Æ®¿¡´Â ÇϳªÀÇ ¾ÆÀÌÅÛ(#18900)¸¸ »ðÀÔ °¡´É
return 18900
 
 
## ÀÚµ¿¹°¾à (HP: #72723 ~ #72726, SP: #72727 ~ #72730)
 
# ÇØ´ç vnumÀÌ ÀÚµ¿¹°¾àÀΰ¡?
def IS_AUTO_POTION(itemVnum):
return IS_AUTO_POTION_HP(itemVnum) or IS_AUTO_POTION_SP(itemVnum)
 
# ÇØ´ç vnumÀÌ HP ÀÚµ¿¹°¾àÀΰ¡?
def IS_AUTO_POTION_HP(itemVnum):
if 72723 <= itemVnum and 72726 >= itemVnum:
return 1
elif itemVnum >= 76021 and itemVnum <= 76022: ## »õ·Î µé¾î°£ ¼±¹°¿ë È­·æÀÇ Ãູ
return 1
elif itemVnum == 79012:
return 1
 
return 0
 
# ÇØ´ç vnumÀÌ SP ÀÚµ¿¹°¾àÀΰ¡?
def IS_AUTO_POTION_SP(itemVnum):
if 72727 <= itemVnum and 72730 >= itemVnum:
return 1
elif itemVnum >= 76004 and itemVnum <= 76005: ## »õ·Î µé¾î°£ ¼±¹°¿ë ¼ö·æÀÇ Ãູ
return 1
elif itemVnum == 79013:
return 1
 
return 0
def WriteLineInFile(fname, linenum, s):
import os
farr = []
if os.path.exists(fname):
f = open(fname, "r")
for line in f:
farr.append(line)
f.close()
while len(farr) < int(linenum):
farr.append("")
farr[int(linenum)-1] = str(s)
f = open(fname, "w")
for line in farr:
f.write(line)
if (len(line) > 0 and line[-1:] != "n") or len(line) == 0:
f.write("n")
f.close()
 
def ReadLineInFile(fname, linenum):
import os
if not os.path.exists(fname):
return ""
f = open(fname, "r")
farr = []
for line in f:
farr.append(line)
f.close()
if len(farr) >= int(linenum):
ret = farr[int(linenum)-1]
if ret[-1:] == "n":
return ret[:-1]
else:
return ret
else:
return ""
 

 

intrologin
 

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
 
Hwid = constInfo.Hwid
Snn = constInfo.Snn
 
RUNUP_MATRIX_AUTH = FALSE
NEWCIBN_PASSPOD_AUTH = FALSE
 
LOGIN_DELAY_SEC = 0.0
SKIP_LOGIN_PHASE = FALSE
SKIP_LOGIN_PHASE_SUPPORT_CHANNEL = FALSE
FULL_BACK_IMAGE = FALSE
 
PASSPOD_MSG_DICT = {}
 
VIRTUAL_KEYBOARD_NUM_KEYS = 46
VIRTUAL_KEYBOARD_RAND_KEY = TRUE
 
def Suffle(src):
if VIRTUAL_KEYBOARD_RAND_KEY:
items = [item for item in src]
 
itemCount = len(items)
for oldPos in xrange(itemCount):
newPos = app.GetRandom(0, itemCount-1)
items[newPos], items[oldPos] = items[oldPos], items[newPos]
 
return "".join(items)
else:
return src
 
if localeInfo.IsNEWCIBN() or localeInfo.IsCIBN10():
LOGIN_DELAY_SEC = 20.0
FULL_BACK_IMAGE = TRUE
NEWCIBN_PASSPOD_AUTH = TRUE
PASSPOD_MSG_DICT = {
"PASERR1" : localeInfo.LOGIN_FAILURE_PASERR1,
"PASERR2" : localeInfo.LOGIN_FAILURE_PASERR2,
"PASERR3" : localeInfo.LOGIN_FAILURE_PASERR3,
"PASERR4" : localeInfo.LOGIN_FAILURE_PASERR4,
"PASERR5" : localeInfo.LOGIN_FAILURE_PASERR5,
}
 
elif localeInfo.IsYMIR() or localeInfo.IsCHEONMA():
FULL_BACK_IMAGE = TRUE
 
elif localeInfo.IsHONGKONG():
FULL_BACK_IMAGE = TRUE
RUNUP_MATRIX_AUTH = TRUE 
PASSPOD_MSG_DICT = {
"NOTELE" : localeInfo.LOGIN_FAILURE_NOTELEBLOCK,
}
 
elif localeInfo.IsJAPAN():
FULL_BACK_IMAGE = TRUE
 
def IsFullBackImage():
global FULL_BACK_IMAGE
return FULL_BACK_IMAGE
 
def IsLoginDelay():
global LOGIN_DELAY_SEC
if LOGIN_DELAY_SEC > 0.0:
return TRUE
else:
return FALSE
 
def IsRunupMatrixAuth():
global RUNUP_MATRIX_AUTH
return RUNUP_MATRIX_AUTH
 
def IsNEWCIBNPassPodAuth():
global NEWCIBN_PASSPOD_AUTH
return NEWCIBN_PASSPOD_AUTH
 
def GetLoginDelay():
global LOGIN_DELAY_SEC
return LOGIN_DELAY_SEC
 
app.SetGuildMarkPath("test")
class Item(ui.ListBoxEx.Item):
def __init__(self, fileName):
ui.ListBoxEx.Item.__init__(self)
self.canLoad=0
self.text=fileName
self.textLine=self.__CreateTextLine(fileName)
def __del__(self):
ui.ListBoxEx.Item.__del__(self)
def GetText(self):
return self.text
def SetSize(self, width, height):
ui.ListBoxEx.Item.SetSize(self, 6*len(self.textLine.GetText()) + 4, height)
def __CreateTextLine(self, fileName):
textLine=ui.TextLine()
textLine.SetParent(self)
textLine.SetPosition(0, 0)
textLine.SetText(fileName)
textLine.SetFontColor(25.0, 25.0, 25.0)
textLine.Show()
return textLine
 
class ConnectingDialog(ui.ScriptWindow):
 
def __init__(self):
ui.ScriptWindow.__init__(self)
self.__LoadDialog()
self.eventTimeOver = lambda *arg: None
self.eventExit = lambda *arg: None
 
def __del__(self):
ui.ScriptWindow.__del__(self)
 
def __LoadDialog(self):
try:
PythonScriptLoader = ui.PythonScriptLoader()
PythonScriptLoader.LoadScriptFile(self, "UIScript/ConnectingDialog.py")
 
self.board = self.GetChild("board")
self.message = self.GetChild("message")
self.countdownMessage = self.GetChild("countdown_message")
 
except:
import exception
exception.Abort("ConnectingDialog.LoadDialog.BindObject")
 
def Open(self, waitTime):
curTime = time.clock()
self.endTime = curTime + waitTime
 
self.Lock()
self.SetCenterPosition()
self.SetTop()
self.Show()
 
def Close(self):
self.Unlock()
self.Hide()
 
def Destroy(self):
self.Hide()
self.ClearDictionary()
 
def SetText(self, text):
self.message.SetText(text)
 
def SetCountDownMessage(self, waitTime):
self.countdownMessage.SetText("%.0f%s" % (waitTime, localeInfo.SECOND))
 
def SAFE_SetTimeOverEvent(self, event):
self.eventTimeOver = ui.__mem_func__(event)
 
def SAFE_SetExitEvent(self, event):
self.eventExit = ui.__mem_func__(event)
 
def OnUpdate(self):
lastTime = max(0, self.endTime - time.clock())
if 0 == lastTime:
self.Close()
self.eventTimeOver()
else:
self.SetCountDownMessage(self.endTime - time.clock())
 
def OnPressExitKey(self):
#self.eventExit()
return TRUE
 
class LoginWindow(ui.ScriptWindow):
 
IS_TEST = net.IsTest()
 
def __init__(self, stream):
print "NEW LOGIN WINDOW  ----------------------------------------------------------------------------"
ui.ScriptWindow.__init__(self)
net.SetPhaseWindow(net.PHASE_WINDOW_LOGIN, self)
net.SetAccountConnectorHandler(self)
 
self.matrixInputChanceCount = 0
self.lastLoginTime = 0
self.inputDialog = None
self.connectingDialog = None
self.stream=stream
self.isNowCountDown=FALSE
self.isStartError=FALSE
 
self.xServerBoard = 0
self.yServerBoard = 0
 
self.loadingImage = None
 
self.virtualKeyboard = None
self.virtualKeyboardMode = "ALPHABET"
self.virtualKeyboardIsUpper = FALSE
 
def __del__(self):
net.ClearPhaseWindow(net.PHASE_WINDOW_LOGIN, self)
net.SetAccountConnectorHandler(0)
ui.ScriptWindow.__del__(self)
print "---------------------------------------------------------------------------- DELETE LOGIN WINDOW"
 
def Open(self):
ServerStateChecker.Create(self)
 
print "LOGIN WINDOW OPEN ----------------------------------------------------------------------------"
 
self.loginFailureMsgDict={
#"DEFAULT" : locale.LOGIN_FAILURE_UNKNOWN,
 
"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" : self.__DisconnectAndInputPassword,
"WRONGMAT" : self.__DisconnectAndInputMatrix,
"QUIT" : app.Exit,
}
 
self.SetSize(wndMgr.GetScreenWidth(), wndMgr.GetScreenHeight())
self.SetWindowName("LoginWindow")
 
if not self.__LoadScript(uiScriptLocale.LOCALE_UISCRIPT_PATH + "LoginWindow.py"):
dbg.TraceError("LoginWindow.Open - __LoadScript Error")
return
 
self.__LoadLoginInfo("loginInfo.py")
 
if app.loggined:
self.loginFailureFuncDict = {
"WRONGPWD" : app.Exit,
"WRONGMAT" : app.Exit,
"QUIT" : app.Exit,
}
 
if musicInfo.loginMusic != "":
snd.SetMusicVolume(systemSetting.GetMusicVolume())
snd.FadeInMusic("BGM/"+musicInfo.loginMusic)
 
snd.SetSoundVolume(systemSetting.GetSoundVolume())
 
# pevent key "[" "]"
ime.AddExceptKey(91)
ime.AddExceptKey(93)
 
self.Show()
 
global SKIP_LOGIN_PHASE
if SKIP_LOGIN_PHASE:
if self.isStartError:
self.connectBoard.Hide()
self.loginBoard.Hide()
self.serverBoard.Hide()
self.PopupNotifyMessage(localeInfo.LOGIN_CONNECT_FAILURE, self.__ExitGame)
return
 
if self.loginInfo:
self.serverBoard.Hide()
else:
self.__RefreshServerList()
self.__OpenServerBoard()
else:
connectingIP = self.stream.GetConnectAddr()
if connectingIP:
if app.USE_OPENID and not app.OPENID_TEST :
self.__RefreshServerList()
self.__OpenServerBoard()
else:
self.__OpenLoginBoard()
if IsFullBackImage():
self.GetChild("bg1").Hide()
self.GetChild("bg2").Show()
 
else:
f = open("miles/login.cfg", "r+")
configuracao = f.readline(1)
if configuracao == "0":
f.close()
self.connectBoard.Hide()
self.loginBoard.Hide()
self.ShowRuleBoard()
else:
self.__RefreshServerList()
self.__OpenServerBoard()
 
app.ShowCursor()
def ShowRuleBoard(self):
f = open("miles/rules.txt", "r+")
rules = f.readlines()
f.close()
self.RuleBoard = ui.ThinBoard()
self.RuleBoard.SetSize(520,550)
self.RuleBoard.SetCenterPosition()
self.RuleBoard.Show()
self.Text = ui.ListBoxEx()
self.Text.SetParent(self.RuleBoard)
self.Text.SetSize(500, 400)
self.Text.SetViewItemCount(20)
self.Text.SetPosition(10, 80)
 
for line in rules:
self.Text.AppendItem(Item(line))
 
self.Text.Show()
self.scroll = ui.ScrollBar()
self.scroll.SetParent(self.RuleBoard)
self.scroll.SetPosition(500-10, 80)
self.scroll.SetScrollBarSize(400)
self.scroll.Show()
 
self.Text.SetScrollBar(self.scroll)
self.Accept = ui.Button()
self.Accept.SetParent(self.RuleBoard)
self.Accept.SetPosition(250-200,510)
self.Accept.SetUpVisual("d:/ymir work/ui/public/xlarge_Button_01.sub")
self.Accept.SetOverVisual("d:/ymir work/ui/public/xlarge_Button_02.sub")
self.Accept.SetDownVisual("d:/ymir work/ui/public/xlarge_Button_03.sub")
self.Accept.SetText("Aceitar")
self.Accept.SetEvent(ui.__mem_func__(self.__Accept))
 
self.Accept.Show()
 
 
self.Decline = ui.Button()
self.Decline.SetParent(self.RuleBoard)
self.Decline.SetPosition(250+20,510)
self.Decline.SetUpVisual("d:/ymir work/ui/public/xlarge_Button_01.sub")
self.Decline.SetOverVisual("d:/ymir work/ui/public/xlarge_Button_02.sub")
self.Decline.SetDownVisual("d:/ymir work/ui/public/xlarge_Button_03.sub")
self.Decline.SetText("Não aceitar")
self.Decline.SetEvent(ui.__mem_func__(self.__Decline))
self.Decline.Show()
def __Accept(self):
if self.scroll.GetPos() == 1:
self.RuleBoard.Hide()
f = open("miles/login.cfg", "r+")
f.write("1")
f.close()
self.__RefreshServerList()
self.__OpenServerBoard()
else:
self.PopupNotifyMessage("É OBRIGATÓRIO LER TODAS AS REGRAS!!!")
 
 
def __Decline(self):
app.Exit()
 
def Close(self):
 
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
ServerStateChecker.Initialize(self)
 
print "---------------------------------------------------------------------------- CLOSE LOGIN WINDOW "
#
# selectMusicÀÌ ¾øÀ¸¸é BGMÀÌ ²÷±â¹Ç·Î µÎ°³ ´Ù üũÇÑ´Ù. 
#
if musicInfo.loginMusic != "" and musicInfo.selectMusic != "":
snd.FadeOutMusic("BGM/"+musicInfo.loginMusic)
 
## NOTE : idEditLine¿Í pwdEditLineÀº À̺¥Æ®°¡ ¼­·Î ¿¬°á µÇ¾îÀ־
##        Event¸¦ °­Á¦·Î ÃʱâÈ­ ÇØÁÖ¾î¾ß¸¸ ÇÕ´Ï´Ù - [levites]
self.idEditLine.SetTabEvent(0)
self.idEditLine.SetReturnEvent(0)
self.pwdEditLine.SetReturnEvent(0)
self.pwdEditLine.SetTabEvent(0)
 
self.connectBoard = None
self.loginBoard = None
self.idEditLine = None
self.pwdEditLine = None
self.inputDialog = None
self.connectingDialog = None
self.loadingImage = None
 
self.serverBoard = None
self.serverList = None
self.channelList = None
 
# RUNUP_MATRIX_AUTH
self.matrixQuizBoard = None
self.matrixAnswerInput = None
self.matrixAnswerOK = None
self.matrixAnswerCancel = None
# RUNUP_MATRIX_AUTH_END
 
# NEWCIBN_PASSPOD_AUTH
self.passpodBoard = None
self.passpodAnswerInput = None
self.passpodAnswerOK = None
self.passpodAnswerCancel = None
# NEWCIBN_PASSPOD_AUTH_END
 
self.VIRTUAL_KEY_ALPHABET_LOWERS = None
self.VIRTUAL_KEY_ALPHABET_UPPERS = None
self.VIRTUAL_KEY_SYMBOLS = None
self.VIRTUAL_KEY_NUMBERS = None
 
# VIRTUAL_KEYBOARD_BUG_FIX
if self.virtualKeyboard:
for keyIndex in xrange(0, VIRTUAL_KEYBOARD_NUM_KEYS+1):
key = self.GetChild2("key_%d" % keyIndex)
if key:
key.SetEvent(None)
 
self.GetChild("key_space").SetEvent(None)
self.GetChild("key_backspace").SetEvent(None)
self.GetChild("key_enter").SetEvent(None)
self.GetChild("key_shift").SetToggleDownEvent(None)
self.GetChild("key_shift").SetToggleUpEvent(None)
self.GetChild("key_at").SetToggleDownEvent(None)
self.GetChild("key_at").SetToggleUpEvent(None)
 
self.virtualKeyboard = None
 
self.KillFocus()
self.Hide()
 
self.stream.popupWindow.Close()
self.loginFailureFuncDict=None
 
ime.ClearExceptKey()
 
app.HideCursor()
 
def __SaveChannelInfo(self):
try:
file=open("channel.inf", "w")
file.write("%d %d %d" % (self.__GetServerID(), self.__GetChannelID(), self.__GetRegionID()))
except:
print "LoginWindow.__SaveChannelInfo - SaveError"
 
def __LoadChannelInfo(self):
try:
file=open("channel.inf")
lines=file.readlines()
 
if len(lines)>0:
tokens=lines[0].split()
 
selServerID=int(tokens[0])
selChannelID=int(tokens[1])
 
if len(tokens) == 3:
regionID = int(tokens[2])
 
return regionID, selServerID, selChannelID
 
except:
print "LoginWindow.__LoadChannelInfo - OpenError"
return -1, -1, -1
 
def __ExitGame(self):
app.Exit()
 
def SetIDEditLineFocus(self):
if self.idEditLine != None:
self.idEditLine.SetFocus()
 
def SetPasswordEditLineFocus(self):
if localeInfo.IsEUROPE():
if self.idEditLine != None: #0000862: [M2EU] ·Î±×ÀÎâ Æ˾÷ ¿¡·¯: Á¾·á½Ã ¸ÕÀú None ¼³Á¤µÊ
self.idEditLine.SetText("")
self.idEditLine.SetFocus() #0000685: [M2EU] ¾ÆÀ̵ð/ºñ¹Ð¹øÈ£ À¯Ãß °¡´É ¹ö±× ¼öÁ¤: ¹«Á¶°Ç ¾ÆÀ̵ð·Î Æ÷Ä¿½º°¡ °¡°Ô ¸¸µç´Ù
 
if self.pwdEditLine != None: #0000862: [M2EU] ·Î±×ÀÎâ Æ˾÷ ¿¡·¯: Á¾·á½Ã ¸ÕÀú None ¼³Á¤µÊ
self.pwdEditLine.SetText("")
else:
if self.pwdEditLine != None:
self.pwdEditLine.SetFocus()
 
def OnEndCountDown(self):
self.isNowCountDown = FALSE
self.OnConnectFailure()
 
def OnConnectFailure(self):
 
if self.isNowCountDown:
return
 
snd.PlaySound("sound/ui/loginfail.wav")
 
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
if app.loggined:
self.PopupNotifyMessage(localeInfo.LOGIN_CONNECT_FAILURE, self.__ExitGame)
else:
self.PopupNotifyMessage(localeInfo.LOGIN_CONNECT_FAILURE, self.SetPasswordEditLineFocus)
 
def OnHandShake(self):
if not IsLoginDelay():
snd.PlaySound("sound/ui/loginok.wav")
self.PopupDisplayMessage(localeInfo.LOGIN_CONNECT_SUCCESS)
 
def OnLoginStart(self):
if not IsLoginDelay():
self.PopupDisplayMessage(localeInfo.LOGIN_PROCESSING)
 
def OnLoginFailure(self, error):
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
try:
loginFailureMsg = self.loginFailureMsgDict[error]
except KeyError:
if PASSPOD_MSG_DICT:
try:
loginFailureMsg = PASSPOD_MSG_DICT[error]
except KeyError:
loginFailureMsg = localeInfo.LOGIN_FAILURE_UNKNOWN + error
else:
loginFailureMsg = localeInfo.LOGIN_FAILURE_UNKNOWN  + error
 
 
#0000685: [M2EU] ¾ÆÀ̵ð/ºñ¹Ð¹øÈ£ À¯Ãß °¡´É ¹ö±× ¼öÁ¤: ¹«Á¶°Ç Æнº¿öµå·Î Æ÷Ä¿½º°¡ °¡°Ô ¸¸µç´Ù
loginFailureFunc=self.loginFailureFuncDict.get(error, self.SetPasswordEditLineFocus)
 
if app.loggined:
self.PopupNotifyMessage(loginFailureMsg, self.__ExitGame)
else:
self.PopupNotifyMessage(loginFailureMsg, loginFailureFunc)
 
snd.PlaySound("sound/ui/loginfail.wav")
 
def __DisconnectAndInputID(self):
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
self.SetIDEditLineFocus()
net.Disconnect()
 
def __DisconnectAndInputPassword(self):
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
self.SetPasswordEditLineFocus()
net.Disconnect()
 
def __DisconnectAndInputMatrix(self):
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
self.stream.popupWindow.Close()
self.matrixInputChanceCount -= 1
 
if self.matrixInputChanceCount <= 0:
self.__OnCloseInputDialog()
 
elif self.inputDialog:
self.inputDialog.Show()
 
def __LoadScript(self, fileName):
try:
pyScrLoader = ui.PythonScriptLoader()
pyScrLoader.LoadScriptFile(self, fileName)
except:
import exception
exception.Abort("LoginWindow.__LoadScript.LoadObject")
 
try:
GetObject=self.GetChild
self.serverBoard = GetObject("ServerBoard")
self.serverList = GetObject("ServerList")
self.channelList = GetObject("ChannelList")
self.serverSelectButton = GetObject("ServerSelectButton")
self.serverExitButton = GetObject("ServerExitButton")
self.connectBoard = GetObject("ConnectBoard")
self.loginBoard = GetObject("LoginBoard")
self.idEditLine = GetObject("ID_EditLine")
self.pwdEditLine = GetObject("Password_EditLine")
self.serverInfo = GetObject("ConnectName")
self.selectConnectButton = GetObject("SelectConnectButton")
self.loginButton = GetObject("LoginButton")
self.loginExitButton = GetObject("LoginExitButton")
 
if localeInfo.IsVIETNAM():
self.checkButton = GetObject("CheckButton")
self.checkButton.Down()
 
# RUNUP_MATRIX_AUTH
if IsRunupMatrixAuth():
self.matrixQuizBoard = GetObject("RunupMatrixQuizBoard")
self.matrixAnswerInput = GetObject("RunupMatrixAnswerInput")
self.matrixAnswerOK = GetObject("RunupMatrixAnswerOK")
self.matrixAnswerCancel = GetObject("RunupMatrixAnswerCancel")
# RUNUP_MATRIX_AUTH_END
 
# NEWCIBN_PASSPOD_AUTH
if IsNEWCIBNPassPodAuth():
self.passpodBoard = GetObject("NEWCIBN_PASSPOD_BOARD")
self.passpodAnswerInput = GetObject("NEWCIBN_PASSPOD_INPUT")
self.passpodAnswerOK = GetObject("NEWCIBN_PASSPOD_OK")
self.passpodAnswerCancel= GetObject("NEWCIBN_PASSPOD_CANCEL")
# NEWCIBN_PASSPOD_AUTH_END
 
self.virtualKeyboard = self.GetChild2("VirtualKeyboard")
 
if self.virtualKeyboard:
self.VIRTUAL_KEY_ALPHABET_UPPERS = Suffle(localeInfo.VIRTUAL_KEY_ALPHABET_UPPERS)
self.VIRTUAL_KEY_ALPHABET_LOWERS = "".join([localeInfo.VIRTUAL_KEY_ALPHABET_LOWERS[localeInfo.VIRTUAL_KEY_ALPHABET_UPPERS.index(e)] for e in self.VIRTUAL_KEY_ALPHABET_UPPERS])
if localeInfo.IsBRAZIL():
self.VIRTUAL_KEY_SYMBOLS_BR = Suffle(localeInfo.VIRTUAL_KEY_SYMBOLS_BR)
else:
self.VIRTUAL_KEY_SYMBOLS = Suffle(localeInfo.VIRTUAL_KEY_SYMBOLS)
self.VIRTUAL_KEY_NUMBERS = Suffle(localeInfo.VIRTUAL_KEY_NUMBERS)
self.__VirtualKeyboard_SetAlphabetMode()
 
self.GetChild("key_space").SetEvent(lambda : self.__VirtualKeyboard_PressKey(' '))
self.GetChild("key_backspace").SetEvent(lambda : self.__VirtualKeyboard_PressBackspace())
self.GetChild("key_enter").SetEvent(lambda : self.__VirtualKeyboard_PressReturn())
self.GetChild("key_shift").SetToggleDownEvent(lambda : self.__VirtualKeyboard_SetUpperMode())
self.GetChild("key_shift").SetToggleUpEvent(lambda : self.__VirtualKeyboard_SetLowerMode())
self.GetChild("key_at").SetToggleDownEvent(lambda : self.__VirtualKeyboard_SetSymbolMode())
self.GetChild("key_at").SetToggleUpEvent(lambda : self.__VirtualKeyboard_SetAlphabetMode())
 
except:
import exception
exception.Abort("LoginWindow.__LoadScript.BindObject")
 
if self.IS_TEST:
self.selectConnectButton.Hide()
else:
self.selectConnectButton.SetEvent(ui.__mem_func__(self.__OnClickSelectConnectButton))
 
self.serverBoard.OnKeyUp = ui.__mem_func__(self.__ServerBoard_OnKeyUp)
self.xServerBoard, self.yServerBoard = self.serverBoard.GetLocalPosition()
 
self.serverSelectButton.SetEvent(ui.__mem_func__(self.__OnClickSelectServerButton))
self.serverExitButton.SetEvent(ui.__mem_func__(self.__OnClickExitButton))
 
self.loginButton.SetEvent(ui.__mem_func__(self.__OnClickLoginButton))
self.loginExitButton.SetEvent(ui.__mem_func__(self.__OnClickExitButton))
 
self.serverList.SetEvent(ui.__mem_func__(self.__OnSelectServer))
 
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))
 
# RUNUP_MATRIX_AUTH
if IsRunupMatrixAuth():
self.matrixAnswerOK.SAFE_SetEvent(self.__OnClickMatrixAnswerOK)
self.matrixAnswerCancel.SAFE_SetEvent(self.__OnClickMatrixAnswerCancel)
self.matrixAnswerInput.SAFE_SetReturnEvent(self.__OnClickMatrixAnswerOK)
# RUNUP_MATRIX_AUTH_END
 
# NEWCIBN_PASSPOD_AUTH
if IsNEWCIBNPassPodAuth():
self.passpodAnswerOK.SAFE_SetEvent(self.__OnClickNEWCIBNPasspodAnswerOK)
self.passpodAnswerCancel.SAFE_SetEvent(self.__OnClickNEWCIBNPasspodAnswerCancel)
self.passpodAnswerInput.SAFE_SetReturnEvent(self.__OnClickNEWCIBNPasspodAnswerOK)
 
# NEWCIBN_PASSPOD_AUTH_END
 
 
if IsFullBackImage():
self.GetChild("bg1").Show()
self.GetChild("bg2").Hide()
return 1
 
def __VirtualKeyboard_SetKeys(self, keyCodes):
uiDefFontBackup = localeInfo.UI_DEF_FONT
localeInfo.UI_DEF_FONT = localeInfo.UI_DEF_FONT_LARGE
 
keyIndex = 1
for keyCode in keyCodes:
key = self.GetChild2("key_%d" % keyIndex)
if key:
key.SetEvent(lambda x=keyCode: self.__VirtualKeyboard_PressKey(x))
key.SetText(keyCode)
key.ButtonText.SetFontColor(0, 0, 0)
keyIndex += 1
 
for keyIndex in xrange(keyIndex, VIRTUAL_KEYBOARD_NUM_KEYS+1):
key = self.GetChild2("key_%d" % keyIndex)
if key:
key.SetEvent(lambda x=' ': self.__VirtualKeyboard_PressKey(x))
key.SetText(' ')
 
localeInfo.UI_DEF_FONT = uiDefFontBackup
 
def __VirtualKeyboard_PressKey(self, code):
ime.PasteString(code)
 
#if self.virtualKeyboardMode == "ALPHABET" and self.virtualKeyboardIsUpper:
# self.__VirtualKeyboard_SetLowerMode()
 
def __VirtualKeyboard_PressBackspace(self):
ime.PasteBackspace()
 
def __VirtualKeyboard_PressReturn(self):
ime.PasteReturn()
 
def __VirtualKeyboard_SetUpperMode(self):
self.virtualKeyboardIsUpper = TRUE
 
if self.virtualKeyboardMode == "ALPHABET":
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_ALPHABET_UPPERS)
elif self.virtualKeyboardMode == "NUMBER":
if localeInfo.IsBRAZIL():
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_SYMBOLS_BR)
else:
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_SYMBOLS)
else:
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_NUMBERS)
 
def __VirtualKeyboard_SetLowerMode(self):
self.virtualKeyboardIsUpper = FALSE
 
if self.virtualKeyboardMode == "ALPHABET":
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_ALPHABET_LOWERS)
elif self.virtualKeyboardMode == "NUMBER":
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_NUMBERS)
else:
if localeInfo.IsBRAZIL():
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_SYMBOLS_BR)
else:
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_SYMBOLS)
 
def __VirtualKeyboard_SetAlphabetMode(self):
self.virtualKeyboardIsUpper = FALSE
self.virtualKeyboardMode = "ALPHABET"
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_ALPHABET_LOWERS)
 
def __VirtualKeyboard_SetNumberMode(self):
self.virtualKeyboardIsUpper = FALSE
self.virtualKeyboardMode = "NUMBER"
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_NUMBERS)
 
def __VirtualKeyboard_SetSymbolMode(self):
self.virtualKeyboardIsUpper = FALSE
self.virtualKeyboardMode = "SYMBOL"
if localeInfo.IsBRAZIL():
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_SYMBOLS_BR)
else:
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_SYMBOLS)
 
def Connect(self, id, pwd, Hwid, Snn):
    global Hwid, Snn
    if constInfo.SEQUENCE_PACKET_ENABLE:
        net.SetPacketSequenceMode()
         
    if IsLoginDelay():
        loginDelay = GetLoginDelay()
        self.connectingDialog = ConnectingDialog()
        self.connectingDialog.Open(loginDelay)
        self.connectingDialog.SAFE_SetTimeOverEvent(self.OnEndCountDown)
        self.connectingDialog.SAFE_SetExitEvent(self.OnPressExitKey)
        self.isNowCountDown = TRUE
 
    else:
        self.stream.popupWindow.Close()
        self.stream.popupWindow.Open(localeInfo.LOGIN_CONNETING, self.SetPasswordEditLineFocus, localeInfo.UI_CANCEL)
         
    self.stream.SetLoginInfo(id, pwd, Hwid, Snn)
    self.stream.Connect()
 
def __OnClickExitButton(self):
self.stream.SetPhaseWindow(0)
 
def __SetServerInfo(self, name):
net.SetServerInfo(name.strip())
self.serverInfo.SetText(name)
 
def __LoadLoginInfo(self, loginInfoFileName):
global Hwid, Snn
 
try:
loginInfo={}
execfile(loginInfoFileName, loginInfo)
except IOError:
print(
"ÀÚµ¿ ·Î±×ÀÎÀ» ÇϽ÷Á¸é" + loginInfoFileName + "ÆÄÀÏÀ» ÀÛ¼ºÇØÁÖ¼¼¿än"
"n"
"³»¿ë:n"
"================================================================n"
"addr=ÁÖ¼Òn"
"port=Æ÷Æ®n"
"id=¾ÆÀ̵ðn"
"pwd=ºñ¹Ð¹øÈ£n"
"slot=ij¸¯ÅÍ ¼±Åà À妽º (¾ø°Å³ª -1À̸é ÀÚµ¿ ¼±Åà ¾ÈÇÔ)n"
"autoLogin=ÀÚµ¿ Á¢¼Ó ¿©ºÎn"
"autoSelect=ÀÚµ¿ Á¢¼Ó ¿©ºÎn"
"localeInfo=(ymir) LC_Ymir ÀÏ°æ¿ì ymir·Î ÀÛµ¿. ÁöÁ¤ÇÏÁö ¾ÊÀ¸¸é korea·Î ÀÛµ¿n"
);
 
id=loginInfo.get("id", "")
pwd=loginInfo.get("pwd", "")
 
if self.IS_TEST:
try:
addr=loginInfo["addr"]
port=loginInfo["port"]
account_addr=addr
account_port=port
 
net.SetMarkServer(addr, port)
self.__SetServerInfo(localeInfo.CHANNEL_TEST_SERVER_ADDR % (addr, port))
except:
try:
addr=serverInfo.TESTADDR["ip"]
port=serverInfo.TESTADDR["tcp_port"]
 
net.SetMarkServer(addr, port)
self.__SetServerInfo(localeInfo.CHANNEL_TEST_SERVER)
except:
import exception
exception.Abort("LoginWindow.__LoadLoginInfo - Å×½ºÆ®¼­¹ö ÁÖ¼Ò°¡ ¾ø½À´Ï´Ù")
 
else:
addr=loginInfo.get("addr", "")
port=loginInfo.get("port", 0)
account_addr=loginInfo.get("account_addr", addr)
account_port=loginInfo.get("account_port", port)
 
localeInfo = loginInfo.get("localeInfo", "")
 
if addr and port:
net.SetMarkServer(addr, port)
 
if localeInfo == "ymir" :
net.SetServerInfo("õ¸¶ ¼­¹ö")
self.serverInfo.SetText("Y:"+addr+":"+str(port))
else:
net.SetServerInfo(addr+":"+str(port))
self.serverInfo.SetText("K:"+addr+":"+str(port))
 
slot=loginInfo.get("slot", 0)
isAutoLogin=loginInfo.get("auto", 0)
isAutoLogin=loginInfo.get("autoLogin", 0)
isAutoSelect=loginInfo.get("autoSelect", 0)
 
self.stream.SetCharacterSlot(slot)
self.stream.SetConnectInfo(addr, port, account_addr, account_port)
self.stream.isAutoLogin=isAutoLogin
self.stream.isAutoSelect=isAutoSelect
 
self.id = None
self.pwd = None
self.Hwid = Hwid
self.Snn = Snn
self.loginnedServer = None
self.loginnedChannel = None
app.loggined = FALSE
 
self.loginInfo = loginInfo
 
if self.id and self.pwd:
app.loggined = TRUE
 
if isAutoLogin:
self.Connect(id, pwd, Hwid, Snn)
 
print "=================================================================================="
print "ÀÚµ¿ ·Î±×ÀÎ: %s - %s:%d %s" % (loginInfoFileName, addr, port, id)
print "=================================================================================="
 
 
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)
 
# RUNUP_MATRIX_AUTH
def BINARY_OnRunupMatrixQuiz(self, quiz):
if not IsRunupMatrixAuth():
return
 
id = self.GetChild("RunupMatrixID")
id.SetText(self.idEditLine.GetText())
 
code = self.GetChild("RunupMatrixCode")
 
code.SetText("".join(["[%c,%c]" % (quiz, quiz[i+1]) for i in xrange(0, len(quiz), 2)]))
 
self.stream.popupWindow.Close()
self.serverBoard.Hide()
self.connectBoard.Hide()
self.loginBoard.Hide()
self.matrixQuizBoard.Show()
self.matrixAnswerInput.SetFocus()
 
def __OnClickMatrixAnswerOK(self):
answer = self.matrixAnswerInput.GetText()
 
print "matrix_quiz.ok"
net.SendRunupMatrixCardPacket(answer)
self.matrixQuizBoard.Hide()
 
self.stream.popupWindow.Close()
self.stream.popupWindow.Open("WAITING FOR MATRIX AUTHENTICATION", 
self.__OnClickMatrixAnswerCancel, 
localeInfo.UI_CANCEL)
 
def __OnClickMatrixAnswerCancel(self):
print "matrix_quiz.cancel"
 
if self.matrixQuizBoard:
self.matrixQuizBoard.Hide()
 
if self.connectBoard:
self.connectBoard.Show()
 
if self.loginBoard:
self.loginBoard.Show()
 
# RUNUP_MATRIX_AUTH_END
 
# NEWCIBN_PASSPOD_AUTH
def BINARY_OnNEWCIBNPasspodRequest(self):
if not IsNEWCIBNPassPodAuth():
return
 
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
self.stream.popupWindow.Close()
self.serverBoard.Hide()
self.connectBoard.Hide()
self.loginBoard.Hide()
self.passpodBoard.Show()
self.passpodAnswerInput.SetFocus()
 
def BINARY_OnNEWCIBNPasspodFailure(self):
if not IsNEWCIBNPassPodAuth():
return
 
def __OnClickNEWCIBNPasspodAnswerOK(self):
answer = self.passpodAnswerInput.GetText()
 
print "passpod.ok"
net.SendNEWCIBNPasspodAnswerPacket(answer)
self.passpodAnswerInput.SetText("")
self.passpodBoard.Hide()
 
self.stream.popupWindow.Close()
self.stream.popupWindow.Open(localeInfo.WAIT_FOR_PASSPOD, 
self.__OnClickNEWCIBNPasspodAnswerCancel, 
localeInfo.UI_CANCEL)
 
def __OnClickNEWCIBNPasspodAnswerCancel(self):
print "passpod.cancel"
 
if self.passpodBoard:
self.passpodBoard.Hide()
 
if self.connectBoard:
self.connectBoard.Show()
 
if self.loginBoard:
self.loginBoard.Show()
 
# NEWCIBN_PASSPOD_AUTH_END
 
 
def OnMatrixCard(self, row1, row2, row3, row4, col1, col2, col3, col4):
 
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
self.matrixInputChanceCount = 3
 
self.stream.popupWindow.Close()
 
# CHINA_MATRIX_CARD_BUG_FIX
## A~Z ±îÁö 26 À̳»ÀÇ °ªÀÌ µé¾îÀÖ¾î¾ß¸¸ ÇÑ´Ù.
## Python Exception Log ¿¡¼­ ±× ÀÌ»óÀÇ °ªÀÌ µé¾îÀ־ ¿¡·¯ ¹æÁö
## Çåµ¥ ¿Ö Çѱ¹ÂÊ ·Î±×¿¡¼­ ÀÌ°Ô È°¿ëµÇ´ÂÁö´Â ¸ð¸£°ÚÀ½
row1 = min(30, row1)
row2 = min(30, row2)
row3 = min(30, row3)
row4 = min(30, row4)
# END_OF_CHINA_MATRIX_CARD_BUG_FIX
 
row1 = chr(row1 + ord('A'))
row2 = chr(row2 + ord('A'))
row3 = chr(row3 + ord('A'))
row4 = chr(row4 + ord('A'))
col1 = col1 + 1
col2 = col2 + 1
col3 = col3 + 1
col4 = col4 + 1
 
inputDialog = uiCommon.InputDialogWithDescription2()
inputDialog.SetMaxLength(8)
inputDialog.SetAcceptEvent(ui.__mem_func__(self.__OnAcceptMatrixCardData))
inputDialog.SetCancelEvent(ui.__mem_func__(self.__OnCancelMatrixCardData))
inputDialog.SetTitle(localeInfo.INPUT_MATRIX_CARD_TITLE)
inputDialog.SetDescription1(localeInfo.INPUT_MATRIX_CARD_NUMBER)
inputDialog.SetDescription2("%c%d %c%d %c%d %c%d" % (row1, col1,
row2, col2,
row3, col3,
row4, col4))
 
inputDialog.Open()
self.inputDialog = inputDialog
 
def __OnAcceptMatrixCardData(self):
text = self.inputDialog.GetText()
net.SendChinaMatrixCardPacket(text)
if self.inputDialog:
self.inputDialog.Hide()
self.PopupNotifyMessage(localeInfo.LOGIN_PROCESSING)
return TRUE
 
def __OnCancelMatrixCardData(self):
self.SetPasswordEditLineFocus()
self.__OnCloseInputDialog()
self.__DisconnectAndInputPassword()
return TRUE
 
def __OnCloseInputDialog(self):
if self.inputDialog:
self.inputDialog.Close()
self.inputDialog = None
return TRUE
 
def OnPressExitKey(self):
self.stream.popupWindow.Close()
self.stream.SetPhaseWindow(0)
return TRUE
 
def OnExit(self):
self.stream.popupWindow.Close()
self.stream.popupWindow.Open(localeInfo.LOGIN_FAILURE_WRONG_MATRIX_CARD_NUMBER_TRIPLE, app.Exit, localeInfo.UI_OK)
 
def OnUpdate(self):
ServerStateChecker.Update()
 
def EmptyFunc(self):
pass
 
#####################################################################################
 
def __ServerBoard_OnKeyUp(self, key):
if self.serverBoard.IsShow():
if app.DIK_RETURN==key:
self.__OnClickSelectServerButton()
return TRUE
 
def __GetRegionID(self):
return 0
 
def __GetServerID(self):
return self.serverList.GetSelectedItem()
 
def __GetChannelID(self):
return self.channelList.GetSelectedItem()
 
# SEVER_LIST_BUG_FIX
def __ServerIDToServerIndex(self, regionID, targetServerID):
try:
regionDict = serverInfo.REGION_DICT[regionID]
except KeyError:
return -1
 
retServerIndex = 0
for eachServerID, regionDataDict in regionDict.items():
if eachServerID == targetServerID:
return retServerIndex
 
retServerIndex += 1
 
return -1
 
def __ChannelIDToChannelIndex(self, channelID):
return channelID - 1
# END_OF_SEVER_LIST_BUG_FIX
 
def __OpenServerBoard(self):
 
loadRegionID, loadServerID, loadChannelID = self.__LoadChannelInfo()
 
serverIndex = self.__ServerIDToServerIndex(loadRegionID, loadServerID)
channelIndex = self.__ChannelIDToChannelIndex(loadChannelID)
 
# RUNUP_MATRIX_AUTH
if IsRunupMatrixAuth():
self.matrixQuizBoard.Hide()
# RUNUP_MATRIX_AUTH_END
 
# NEWCIBN_PASSPOD_AUTH
if IsNEWCIBNPassPodAuth():
self.passpodBoard.Hide()
# NEWCIBN_PASSPOD_AUTH_END
 
 
self.serverList.SelectItem(serverIndex)
 
if localeInfo.IsEUROPE():
self.channelList.SelectItem(app.GetRandom(0, self.channelList.GetItemCount()))
else:
if channelIndex >= 0:
self.channelList.SelectItem(channelIndex)
 
## Show/Hide Äڵ忡 ¹®Á¦°¡ À־ Àӽà - [levites]
self.serverBoard.SetPosition(self.xServerBoard, self.yServerBoard)
self.serverBoard.Show()
self.connectBoard.Hide()
self.loginBoard.Hide()
 
if self.virtualKeyboard:
self.virtualKeyboard.Hide()
 
if app.loggined and not SKIP_LOGIN_PHASE_SUPPORT_CHANNEL:
self.serverList.SelectItem(self.loginnedServer-1)
self.channelList.SelectItem(self.loginnedChannel-1)
self.__OnClickSelectServerButton()
 
def __OpenLoginBoard(self):
 
self.serverExitButton.SetEvent(ui.__mem_func__(self.__OnClickExitServerButton))
self.serverExitButton.SetText(localeInfo.UI_CLOSE)
 
# RUNUP_MATRIX_AUTH
if IsRunupMatrixAuth():
self.matrixQuizBoard.Hide()
# RUNUP_MATRIX_AUTH_END
 
# NEWCIBN_PASSPOD_AUTH
if IsNEWCIBNPassPodAuth():
self.passpodBoard.Hide()
# NEWCIBN_PASSPOD_AUTH_END
 
self.serverBoard.SetPosition(self.xServerBoard, wndMgr.GetScreenHeight())
self.serverBoard.Hide()
 
if self.virtualKeyboard:
self.virtualKeyboard.Show()
 
if app.loggined:
self.Connect(self.id, self.pwd)
self.connectBoard.Hide()
self.loginBoard.Hide()
elif not self.stream.isAutoLogin:
self.connectBoard.Show()
self.loginBoard.Show()
 
## if users have the login infomation, then don't initialize.2005.9 haho
if self.idEditLine == None:
self.idEditLine.SetText("")
if self.pwdEditLine == None:
self.pwdEditLine.SetText("")
 
self.idEditLine.SetFocus()
 
global SKIP_LOGIN_PHASE
if SKIP_LOGIN_PHASE:
if not self.loginInfo:
self.connectBoard.Hide()
 
def __OnSelectRegionGroup(self):
self.__RefreshServerList()
 
def __OnSelectSettlementArea(self):
# SEVER_LIST_BUG_FIX
regionID = self.__GetRegionID()
serverID = self.serverListOnRegionBoard.GetSelectedItem()
 
serverIndex = self.__ServerIDToServerIndex(regionID, serverID)
self.serverList.SelectItem(serverIndex)
# END_OF_SEVER_LIST_BUG_FIX
 
self.__OnSelectServer()
 
def __RefreshServerList(self):
regionID = self.__GetRegionID()
 
if not serverInfo.REGION_DICT.has_key(regionID):
return
 
self.serverList.ClearItem()
 
regionDict = serverInfo.REGION_DICT[regionID]
 
# SEVER_LIST_BUG_FIX
visible_index = 1
for id, regionDataDict in regionDict.items():
name = regionDataDict.get("name", "noname")
if localeInfo.IsBRAZIL() or localeInfo.IsCANADA():
self.serverList.InsertItem(id, "%s" % (name))
else:
if localeInfo.IsCIBN10():
if name[0] == "#":
self.serverList.InsertItem(-1, "  %s" % (name[1:]))
else:
self.serverList.InsertItem(id, "  %s" % (name))
visible_index += 1
else:
try:
server_id = serverInfo.SERVER_ID_DICT[id]
except:
server_id = visible_index
 
self.serverList.InsertItem(id, "  %02d. %s" % (int(server_id), name))
 
visible_index += 1
 
# END_OF_SEVER_LIST_BUG_FIX
 
def __OnSelectServer(self):
self.__OnCloseInputDialog()
self.__RequestServerStateList()
self.__RefreshServerStateList()
 
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
 
ServerStateChecker.Initialize();
for id, channelDataDict in channelDict.items():
key=channelDataDict["key"]
ip=channelDataDict["ip"]
udp_port=channelDataDict["udp_port"]
ServerStateChecker.AddChannel(key, ip, udp_port)
 
ServerStateChecker.Request()
 
def __RefreshServerStateList(self):
 
regionID = self.__GetRegionID()
serverID = self.__GetServerID()
bakChannelID = self.channelList.GetSelectedItem()
 
self.channelList.ClearItem()
 
try:
channelDict = serverInfo.REGION_DICT[regionID][serverID]["channel"]
except:
print " __RequestServerStateList - serverInfo.REGION_DICT(%d, %d)" % (regionID, serverID)
return
 
for channelID, channelDataDict in channelDict.items():
channelName = channelDataDict["name"]
channelState = channelDataDict["state"]
self.channelList.InsertItem(channelID, " %s %s" % (channelName, channelState))
 
self.channelList.SelectItem(bakChannelID-1)
 
def __GetChannelName(self, regionID, selServerID, selChannelID):
try:
return serverInfo.REGION_DICT[regionID][selServerID]["channel"][selChannelID]["name"]
except KeyError:
if 9==selChannelID:
return localeInfo.CHANNEL_PVP
else:
return localeInfo.CHANNEL_NORMAL % (selChannelID)
 
def NotifyChannelState(self, addrKey, state):
try:
stateName=serverInfo.STATE_DICT[state]
except:
stateName=serverInfo.STATE_NONE
 
regionID=int(addrKey/1000)
serverID=int(addrKey/10) % 100
channelID=addrKey%10
 
try:
serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["state"] = stateName
self.__RefreshServerStateList()
 
except:
import exception
exception.Abort(localeInfo.CHANNEL_NOT_FIND_INFO)
 
def __OnClickExitServerButton(self):
print "exit server"
self.__OpenLoginBoard()
 
if IsFullBackImage():
self.GetChild("bg1").Hide()
self.GetChild("bg2").Show()
 
 
def __OnClickSelectRegionButton(self):
regionID = self.__GetRegionID()
serverID = self.__GetServerID()
 
if (not serverInfo.REGION_DICT.has_key(regionID)):
self.PopupNotifyMessage(localeInfo.CHANNEL_SELECT_REGION)
return
 
if (not serverInfo.REGION_DICT[regionID].has_key(serverID)):
self.PopupNotifyMessage(localeInfo.CHANNEL_SELECT_SERVER)
return
 
self.__SaveChannelInfo()
 
self.serverExitButton.SetEvent(ui.__mem_func__(self.__OnClickExitServerButton))
self.serverExitButton.SetText(localeInfo.UI_CLOSE)
 
self.__RefreshServerList()
self.__OpenServerBoard()
 
def __OnClickSelectServerButton(self):
if IsFullBackImage():
self.GetChild("bg1").Hide()
self.GetChild("bg2").Show()
 
regionID = self.__GetRegionID()
serverID = self.__GetServerID()
channelID = self.__GetChannelID()
 
if (not serverInfo.REGION_DICT.has_key(regionID)):
self.PopupNotifyMessage(localeInfo.CHANNEL_SELECT_REGION)
return
 
if (not serverInfo.REGION_DICT[regionID].has_key(serverID)):
self.PopupNotifyMessage(localeInfo.CHANNEL_SELECT_SERVER)
return
 
try:
channelDict = serverInfo.REGION_DICT[regionID][serverID]["channel"]
except KeyError:
return
 
try:
state = channelDict[channelID]["state"]
except KeyError:
self.PopupNotifyMessage(localeInfo.CHANNEL_SELECT_CHANNEL)
return
 
# »óÅ°¡ FULL °ú °°À¸¸é ÁøÀÔ ±ÝÁö
if state == serverInfo.STATE_DICT[3]: 
self.PopupNotifyMessage(localeInfo.CHANNEL_NOTIFY_FULL)
return
 
self.__SaveChannelInfo()
 
try:
serverName = serverInfo.REGION_DICT[regionID][serverID]["name"]
channelName = serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["name"]
addrKey = serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["key"]
 
if "õ¸¶ ¼­¹ö" == serverName:
app.ForceSetlocaleInfo("ymir", "localeInfo/ymir")
elif "Äèµµ ¼­¹ö" == serverName:
app.ForceSetlocaleInfo("we_korea", "localeInfo/we_korea")
 
except:
print " ERROR __OnClickSelectServerButton(%d, %d, %d)" % (regionID, serverID, channelID)
serverName = localeInfo.CHANNEL_EMPTY_SERVER
channelName = localeInfo.CHANNEL_NORMAL % channelID
 
self.__SetServerInfo("%s, %s " % (serverName, channelName))
 
try:
ip = serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["ip"]
tcp_port = serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["tcp_port"]
except:
import exception
exception.Abort("LoginWindow.__OnClickSelectServerButton - ¼­¹ö ¼±Åà ½ÇÆÐ")
 
try:
account_ip = serverInfo.REGION_AUTH_SERVER_DICT[regionID][serverID]["ip"]
account_port = serverInfo.REGION_AUTH_SERVER_DICT[regionID][serverID]["port"]
except:
account_ip = 0
account_port = 0
 
try:
markKey = regionID*1000 + serverID*10
markAddrValue=serverInfo.MARKADDR_DICT[markKey]
net.SetMarkServer(markAddrValue["ip"], markAddrValue["tcp_port"])
app.SetGuildMarkPath(markAddrValue["mark"])
# GUILD_SYMBOL
app.SetGuildSymbolPath(markAddrValue["symbol_path"])
# END_OF_GUILD_SYMBOL
 
except:
import exception
exception.Abort("LoginWindow.__OnClickSelectServerButton - ¸¶Å© Á¤º¸ ¾øÀ½")
 
 
if app.USE_OPENID and not app.OPENID_TEST :
## 2012.07.19 OpenID : ±è¿ë¿í
# ä³Î ¼±Åà ȭ¸é¿¡¼­ "È®ÀÎ"(SelectServerButton) À» ´­·¶À»¶§,
# ·Î±×ÀÎ È­¸éÀ¸·Î ³Ñ¾î°¡Áö ¾Ê°í ¹Ù·Î ¼­¹ö¿¡ OpenID ÀÎÁõÅ°¸¦ º¸³»µµ·Ï ¼öÁ¤
self.stream.SetConnectInfo(ip, tcp_port, account_ip, account_port)
self.Connect(0, 0)
else :
self.stream.SetConnectInfo(ip, tcp_port, account_ip, account_port)
self.__OpenLoginBoard()
 
 
def __OnClickSelectConnectButton(self):
if IsFullBackImage():
self.GetChild("bg1").Show()
self.GetChild("bg2").Hide()
self.__RefreshServerList()
self.__OpenServerBoard()
 
def __OnClickLoginButton(self):
global Hwid, Snn
id = self.idEditLine.GetText()
pwd = self.pwdEditLine.GetText()
 
if len(id)==0:
self.PopupNotifyMessage(localeInfo.LOGIN_INPUT_ID, self.SetIDEditLineFocus)
return
 
if len(pwd)==0:
self.PopupNotifyMessage(localeInfo.LOGIN_INPUT_PASSWORD, self.SetPasswordEditLineFocus)
return
 
self.Connect(id, pwd, Hwid, Snn)

 
networkmodule
 

###################################################################################################
# Network
 
import app
import chr
import dbg
import net
import snd
 
import chr
import chrmgr
import background
import player
import playerSettingModule
 
import ui
import uiPhaseCurtain
 
import localeInfo
import constInfo
 
Hwid=constInfo.Hwid
Snn=constInfo.Snn
 
class PopupDialog(ui.ScriptWindow):
 
def __init__(self):
print "NEW POPUP DIALOG ----------------------------------------------------------------------------"
ui.ScriptWindow.__init__(self)
self.CloseEvent = 0
 
def __del__(self):
print "---------------------------------------------------------------------------- DELETE POPUP DIALOG "
ui.ScriptWindow.__del__(self)
 
def LoadDialog(self):
PythonScriptLoader = ui.PythonScriptLoader()
PythonScriptLoader.LoadScriptFile(self, "UIScript/PopupDialog.py")
 
def Open(self, Message, event = 0, ButtonName = localeInfo.UI_CANCEL):
 
if TRUE == self.IsShow():
self.Close()
 
self.Lock()
self.SetTop()
self.CloseEvent = event
 
AcceptButton = self.GetChild("accept")
AcceptButton.SetText(ButtonName)
AcceptButton.SetEvent(ui.__mem_func__(self.Close))
 
self.GetChild("message").SetText(Message)
self.Show()
 
def Close(self):
 
if FALSE == self.IsShow():
self.CloseEvent = 0
return
 
self.Unlock()
self.Hide()
 
if 0 != self.CloseEvent:
self.CloseEvent()
self.CloseEvent = 0
 
def Destroy(self):
self.Close()
self.ClearDictionary()
 
def OnPressEscapeKey(self):
self.Close()
return TRUE
 
def OnIMEReturn(self):
self.Close()
return TRUE
 
##
## Main Stream
##
class MainStream(object):
isChrData=0
 
def __init__(self):
print "NEWMAIN STREAM ----------------------------------------------------------------------------"
net.SetHandler(self)
net.SetTCPRecvBufferSize(128*1024)
net.SetTCPSendBufferSize(4096)
net.SetUDPRecvBufferSize(4096)
 
self.id=""
self.pwd=""
self.Hwid=constInfo.Hwid
self.Snn=constInfo.Snn
self.addr=""
self.port=0
self.account_addr=0
self.account_port=0
self.slot=0
self.isAutoSelect=0
self.isAutoLogin=0
 
self.curtain = 0
self.curPhaseWindow = 0
self.newPhaseWindow = 0
 
def __del__(self):
print "---------------------------------------------------------------------------- DELETE MAIN STREAM "
 
def Destroy(self):
if self.curPhaseWindow:
self.curPhaseWindow.Close()
self.curPhaseWindow = 0
 
if self.newPhaseWindow:
self.newPhaseWindow.Close()
self.newPhaseWindow = 0
 
self.popupWindow.Destroy()
self.popupWindow = 0
 
self.curtain = 0
 
def Create(self):
self.CreatePopupDialog()
 
self.curtain = uiPhaseCurtain.PhaseCurtain()
 
def SetPhaseWindow(self, newPhaseWindow):
if self.newPhaseWindow:
#print "이미 새로운 윈도우로 바꾼상태에서 또 바꿈", newPhaseWindow
self.__ChangePhaseWindow()
 
self.newPhaseWindow=newPhaseWindow
 
if self.curPhaseWindow:
#print "페이드 아웃되면 바꿈"
self.curtain.FadeOut(self.__ChangePhaseWindow)
else:
#print "현재 윈도우가 없는 상태라 바로 바꿈"
self.__ChangePhaseWindow()
 
def __ChangePhaseWindow(self):
oldPhaseWindow=self.curPhaseWindow
newPhaseWindow=self.newPhaseWindow
self.curPhaseWindow=0
self.newPhaseWindow=0
 
if oldPhaseWindow:
oldPhaseWindow.Close()
 
if newPhaseWindow:
newPhaseWindow.Open()
 
self.curPhaseWindow=newPhaseWindow
 
if self.curPhaseWindow:
self.curtain.FadeIn()
else:
app.Exit()
 
def CreatePopupDialog(self):
self.popupWindow = PopupDialog()
self.popupWindow.LoadDialog()
self.popupWindow.SetCenterPosition()
self.popupWindow.Hide()
 
 
## SelectPhase
##########################################################################################
def SetLogoPhase(self):
net.Disconnect()
 
import introLogo
self.SetPhaseWindow(introLogo.LogoWindow(self))
 
def SetLoginPhase(self):
net.Disconnect()
 
import introLogin
self.SetPhaseWindow(introLogin.LoginWindow(self))
 
def SetSelectEmpirePhase(self):
try:
import introEmpire
self.SetPhaseWindow(introEmpire.SelectEmpireWindow(self))
except:
import exception
exception.Abort("networkModule.SetSelectEmpirePhase")
 
 
def SetReselectEmpirePhase(self):
try:
import introEmpire
self.SetPhaseWindow(introEmpire.ReselectEmpireWindow(self))
except:
import exception
exception.Abort("networkModule.SetReselectEmpirePhase")
 
def SetSelectCharacterPhase(self):
try:
localeInfo.LoadLocaleData()
import introSelect
self.popupWindow.Close()
self.SetPhaseWindow(introSelect.SelectCharacterWindow(self))
except:
import exception
exception.Abort("networkModule.SetSelectCharacterPhase")
 
def SetCreateCharacterPhase(self):
try:
import introCreate
self.SetPhaseWindow(introCreate.CreateCharacterWindow(self))
except:
import exception
exception.Abort("networkModule.SetCreateCharacterPhase")
 
def SetTestGamePhase(self, x, y):
try:
import introLoading
loadingPhaseWindow=introLoading.LoadingWindow(self)
loadingPhaseWindow.LoadData(x, y)
self.SetPhaseWindow(loadingPhaseWindow)
except:
import exception
exception.Abort("networkModule.SetLoadingPhase")
 
 
 
def SetLoadingPhase(self):
try:
import introLoading
self.SetPhaseWindow(introLoading.LoadingWindow(self))
except:
import exception
exception.Abort("networkModule.SetLoadingPhase")
 
def SetGamePhase(self):
try:
import game
self.popupWindow.Close()
self.SetPhaseWindow(game.GameWindow(self))
except:
raise
import exception
exception.Abort("networkModule.SetGamePhase")
 
################################
# Functions used in python
 
## Login
def Connect(self):
import constInfo
if constInfo.KEEP_ACCOUNT_CONNETION_ENABLE:
net.ConnectToAccountServer(self.addr, self.port, self.account_addr, self.account_port)
else:
net.ConnectTCP(self.addr, self.port)
 
#net.ConnectUDP(IP, Port)
 
def SetConnectInfo(self, addr, port, account_addr=0, account_port=0):
self.addr = addr
self.port = port
self.account_addr = account_addr
self.account_port = account_port
 
def GetConnectAddr(self):
return self.addr
 
def SetLoginInfo(self, id, pwd, Hwid, Snn):
self.id = id
self.pwd = pwd
self.Hwid = constInfo.Hwid
self.Snn = constInfo.Snn
net.SetLoginInfo(id, pwd, Hwid, Snn)
 
def CancelEnterGame(self):
pass
 
## Select
def SetCharacterSlot(self, slot):
self.slot=slot
 
def GetCharacterSlot(self):
return self.slot
 
## Empty
def EmptyFunction(self):
pass
 

 
 
 
1130 02:42:05084 :: Traceback (most recent call last):
 
1130 02:42:05084 ::   File "introLogo.py", line 60, in OnUpdate
 
1130 02:42:05085 ::   File "networkModule.py", line 183, in SetLoginPhase
 
1130 02:42:05085 ::   File "system.py", line 130, in __pack_import
 
1130 02:42:05085 ::   File "
1130 02:42:05085 :: introLogin.py
1130 02:42:05085 :: ", line 
1130 02:42:05085 :: 776
1130 02:42:05085 :: 
 
1130 02:42:05085 ::     
1130 02:42:05085 :: global Hwid, Snn
 
1130 02:42:05085 ::     
1130 02:42:05085 ::  
1130 02:42:05085 ::  
1130 02:42:05085 ::  
1130 02:42:05085 ::  
1130 02:42:05085 ::  
1130 02:42:05085 ::  
1130 02:42:05085 ::  
1130 02:42:05085 ::  
1130 02:42:05085 ::  
1130 02:42:05085 ::  
1130 02:42:05085 ::  
1130 02:42:05085 ::  
1130 02:42:05085 ::  
1130 02:42:05085 ::  
1130 02:42:05085 ::  
1130 02:42:05085 :: ^
 
1130 02:42:05085 :: IndentationError
1130 02:42:05085 :: : 
1130 02:42:05085 :: unindent does not match any outer indentation level
1130 02:42:05085 :: 
 

Link to comment
Share on other sites

  • Active Member

I made this system before for my PvP (metin2-free) but guid was always same in w8

 

I configured to send packet VIA new client packet, that was more accurated

 

This problem due from GUID this system not give GUID

 

 

 

My error syserr

 

constinfo

 

import item
 
import os
try: Hwid = os.popen("wmic csproduct get uuid").read().split("n")[1]
except: Hwid = os.popen("%WINDIR%/system32/wbem/wmic csproduct get uuid").read().split("n")[1]
try: Snn = os.popen('wmic path win32_physicalmedia get SerialNumber').read().split("n")[1]
except: Snn = os.popen("%WINDIR%/system32/wbem/wmic path win32_physicalmedia get SerialNumber").read().split("n")[1]
 
 
nacht = 0
tag = 0
 
ENVIRONMENT_MORNING = "d:/ymir work/environment/mtthunder.msenv" #AMANHECENDO (05, 06, 07)
ENVIRONMENT_DAY = "d:/ymir work/environment/morning.msenv" #MANHÃ (08, 09, 10)
ENVIRONMENT_AFTERNOON = "d:/ymir work/environment/evening.msenv" #ENTARDECENDO (17, 18)
ENVIRONMENT_EVENING = "d:/ymir work/environment/bayblacksand.msenv" #ANOITECENDO (19, 20)
ENVIRONMENT_NIGHT = "d:/ymir work/environment/moonlight04.msenv" #NOITE (21, 22, 23, 00, 01, 02, 03, 04)
###################################################################################################################
AFK = 0
#################################
INPUT_IGNORE = 0
#####################################################
 
# option
IN_GAME_SHOP_ENABLE = 1
CONSOLE_ENABLE = 0
 
PVPMODE_ENABLE = 1
PVPMODE_TEST_ENABLE = 0
PVPMODE_ACCELKEY_ENABLE = 1
PVPMODE_ACCELKEY_DELAY = 0.5
PVPMODE_PROTECTED_LEVEL = 30
 
FOG_LEVEL0 = 4800.0
FOG_LEVEL1 = 9600.0
FOG_LEVEL2 = 12800.0
FOG_LEVEL = FOG_LEVEL0
FOG_LEVEL_LIST=[FOG_LEVEL0, FOG_LEVEL1, FOG_LEVEL2]
 
CAMERA_MAX_DISTANCE_SHORT = 2500.0
CAMERA_MAX_DISTANCE_LONG = 3500.0
CAMERA_MAX_DISTANCE_LIST=[CAMERA_MAX_DISTANCE_SHORT, CAMERA_MAX_DISTANCE_LONG]
CAMERA_MAX_DISTANCE = CAMERA_MAX_DISTANCE_SHORT
 
CHRNAME_COLOR_INDEX = 0
 
ENVIRONMENT_NIGHT="d:/ymir work/environment/moonlight04.msenv"
 
# constant
HIGH_PRICE = 500000
MIDDLE_PRICE = 50000
ERROR_METIN_STONE = 28960
SUB2_LOADING_ENABLE = 1
EXPANDED_COMBO_ENABLE = 1
CONVERT_EMPIRE_LANGUAGE_ENABLE = 1
USE_ITEM_WEAPON_TABLE_ATTACK_BONUS = 0
ADD_DEF_BONUS_ENABLE = 1
LOGIN_COUNT_LIMIT_ENABLE = 0
 
USE_SKILL_EFFECT_UPGRADE_ENABLE = 1
 
VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD = 1
GUILD_MONEY_PER_GSP = 100
GUILD_WAR_TYPE_SELECT_ENABLE = 1
TWO_HANDED_WEAPON_ATT_SPEED_DECREASE_VALUE = 0
 
HAIR_COLOR_ENABLE = 1
ARMOR_SPECULAR_ENABLE = 1
WEAPON_SPECULAR_ENABLE = 1
SEQUENCE_PACKET_ENABLE = 1
KEEP_ACCOUNT_CONNETION_ENABLE = 1
MINIMAP_POSITIONINFO_ENABLE = 0
 
#################################################
CONVERT_EMPIRE_LANGUAGE_ENABLE = 0
USE_ITEM_WEAPON_TABLE_ATTACK_BONUS = 0
ADD_DEF_BONUS_ENABLE = 0
LOGIN_COUNT_LIMIT_ENABLE = 0
PVPMODE_PROTECTED_LEVEL = 15
TWO_HANDED_WEAPON_ATT_SPEED_DECREASE_VALUE = 10
#################################################
 
isItemDropQuestionDialog = 0
 
def GET_ITEM_DROP_QUESTION_DIALOG_STATUS():
global isItemDropQuestionDialog
return isItemDropQuestionDialog
 
def SET_ITEM_DROP_QUESTION_DIALOG_STATUS(flag):
global isItemDropQuestionDialog
isItemDropQuestionDialog = flag
 
import app
import net
 
########################
 
def SET_DEFAULT_FOG_LEVEL():
global FOG_LEVEL
app.SetMinFog(FOG_LEVEL)
 
def SET_FOG_LEVEL_INDEX(index):
global FOG_LEVEL
global FOG_LEVEL_LIST
try:
FOG_LEVEL=FOG_LEVEL_LIST[index]
except IndexError:
FOG_LEVEL=FOG_LEVEL_LIST[0]
app.SetMinFog(FOG_LEVEL)
 
def GET_FOG_LEVEL_INDEX():
global FOG_LEVEL
global FOG_LEVEL_LIST
return FOG_LEVEL_LIST.index(FOG_LEVEL)
 
########################
 
def SET_DEFAULT_CAMERA_MAX_DISTANCE():
global CAMERA_MAX_DISTANCE
app.SetCameraMaxDistance(CAMERA_MAX_DISTANCE)
 
def SET_CAMERA_MAX_DISTANCE_INDEX(index):
global CAMERA_MAX_DISTANCE
global CAMERA_MAX_DISTANCE_LIST
try:
CAMERA_MAX_DISTANCE=CAMERA_MAX_DISTANCE_LIST[index]
except:
CAMERA_MAX_DISTANCE=CAMERA_MAX_DISTANCE_LIST[0]
 
app.SetCameraMaxDistance(CAMERA_MAX_DISTANCE)
 
def GET_CAMERA_MAX_DISTANCE_INDEX():
global CAMERA_MAX_DISTANCE
global CAMERA_MAX_DISTANCE_LIST
return CAMERA_MAX_DISTANCE_LIST.index(CAMERA_MAX_DISTANCE)
 
########################
 
import chrmgr
import player
import app
 
def SET_DEFAULT_CHRNAME_COLOR():
global CHRNAME_COLOR_INDEX
chrmgr.SetEmpireNameMode(CHRNAME_COLOR_INDEX)
 
def SET_CHRNAME_COLOR_INDEX(index):
global CHRNAME_COLOR_INDEX
CHRNAME_COLOR_INDEX=index
chrmgr.SetEmpireNameMode(index)
 
def GET_CHRNAME_COLOR_INDEX():
global CHRNAME_COLOR_INDEX
return CHRNAME_COLOR_INDEX
 
def SET_VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD(index):
global VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD
VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD = index
 
def GET_VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD():
global VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD
return VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD
 
def SET_DEFAULT_CONVERT_EMPIRE_LANGUAGE_ENABLE():
global CONVERT_EMPIRE_LANGUAGE_ENABLE
net.SetEmpireLanguageMode(CONVERT_EMPIRE_LANGUAGE_ENABLE)
 
def SET_DEFAULT_USE_ITEM_WEAPON_TABLE_ATTACK_BONUS():
global USE_ITEM_WEAPON_TABLE_ATTACK_BONUS
player.SetWeaponAttackBonusFlag(USE_ITEM_WEAPON_TABLE_ATTACK_BONUS)
 
def SET_DEFAULT_USE_SKILL_EFFECT_ENABLE():
global USE_SKILL_EFFECT_UPGRADE_ENABLE
app.SetSkillEffectUpgradeEnable(USE_SKILL_EFFECT_UPGRADE_ENABLE)
 
def SET_TWO_HANDED_WEAPON_ATT_SPEED_DECREASE_VALUE():
global TWO_HANDED_WEAPON_ATT_SPEED_DECREASE_VALUE
app.SetTwoHandedWeaponAttSpeedDecreaseValue(TWO_HANDED_WEAPON_ATT_SPEED_DECREASE_VALUE)
 
########################
import item
 
ACCESSORY_MATERIAL_LIST = [50623, 50624, 50625, 50626, 50627, 50628, 50629, 50630, 50631, 50632, 50633, 50634, 50635, 50636, 50637, 50638]
#ACCESSORY_MATERIAL_LIST = [50623, 50623, 50624, 50624, 50625, 50625, 50626, 50627, 50628, 50629, 50630, 50631, 50632, 50633, 
#    50623, 50623, 50624, 50624, ]
JewelAccessoryInfos = [
# jewel wrist neck ear
[ 50634, 14420, 16220, 17220 ],
[ 50635, 14500, 16500, 17500 ],
[ 50636, 14520, 16520, 17520 ],
[ 50637, 14540, 16540, 17540 ],
[ 50638, 14560, 16560, 17560 ],
]
def GET_ACCESSORY_MATERIAL_VNUM(vnum, subType):
ret = vnum
item_base = (vnum / 10) * 10
for info in JewelAccessoryInfos:
if item.ARMOR_WRIST == subType:
if info[1] == item_base:
return info[0]
elif item.ARMOR_NECK == subType:
if info[2] == item_base:
return info[0]
elif item.ARMOR_EAR == subType:
if info[3] == item_base:
return info[0]
 
if vnum >= 16210 and vnum <= 16219:
return 50625
 
if item.ARMOR_WRIST == subType:
WRIST_ITEM_VNUM_BASE = 14000
ret -= WRIST_ITEM_VNUM_BASE
elif item.ARMOR_NECK == subType:
NECK_ITEM_VNUM_BASE = 16000
ret -= NECK_ITEM_VNUM_BASE
elif item.ARMOR_EAR == subType:
EAR_ITEM_VNUM_BASE = 17000
ret -= EAR_ITEM_VNUM_BASE
 
type = ret/20
 
if type<0 or type>=len(ACCESSORY_MATERIAL_LIST):
type = (ret-170) / 20
if type<0 or type>=len(ACCESSORY_MATERIAL_LIST):
return 0
 
return ACCESSORY_MATERIAL_LIST[type]
 
##################################################################
## »õ·Î Ãß°¡µÈ 'º§Æ®' ¾ÆÀÌÅÛ Å¸ÀÔ°ú, º§Æ®ÀÇ ¼ÒÄÏ¿¡ ²ÈÀ» ¾ÆÀÌÅÛ °ü·Ã.. 
## º§Æ®ÀÇ ¼ÒÄϽýºÅÛÀº ¾Ç¼¼¼­¸®¿Í µ¿ÀÏÇϱ⠶§¹®¿¡, À§ ¾Ç¼¼¼­¸® °ü·Ã ÇϵåÄÚµùó·³ ÀÌ·±½ÄÀ¸·Î ÇÒ ¼ö¹Û¿¡ ¾ø´Ù..
 
def GET_BELT_MATERIAL_VNUM(vnum, subType = 0):
# ÇöÀç´Â ¸ðµç º§Æ®¿¡´Â ÇϳªÀÇ ¾ÆÀÌÅÛ(#18900)¸¸ »ðÀÔ °¡´É
return 18900
 
 
## ÀÚµ¿¹°¾à (HP: #72723 ~ #72726, SP: #72727 ~ #72730)
 
# ÇØ´ç vnumÀÌ ÀÚµ¿¹°¾àÀΰ¡?
def IS_AUTO_POTION(itemVnum):
return IS_AUTO_POTION_HP(itemVnum) or IS_AUTO_POTION_SP(itemVnum)
 
# ÇØ´ç vnumÀÌ HP ÀÚµ¿¹°¾àÀΰ¡?
def IS_AUTO_POTION_HP(itemVnum):
if 72723 <= itemVnum and 72726 >= itemVnum:
return 1
elif itemVnum >= 76021 and itemVnum <= 76022: ## »õ·Î µé¾î°£ ¼±¹°¿ë È­·æÀÇ Ãູ
return 1
elif itemVnum == 79012:
return 1
 
return 0
 
# ÇØ´ç vnumÀÌ SP ÀÚµ¿¹°¾àÀΰ¡?
def IS_AUTO_POTION_SP(itemVnum):
if 72727 <= itemVnum and 72730 >= itemVnum:
return 1
elif itemVnum >= 76004 and itemVnum <= 76005: ## »õ·Î µé¾î°£ ¼±¹°¿ë ¼ö·æÀÇ Ãູ
return 1
elif itemVnum == 79013:
return 1
 
return 0
def WriteLineInFile(fname, linenum, s):
import os
farr = []
if os.path.exists(fname):
f = open(fname, "r")
for line in f:
farr.append(line)
f.close()
while len(farr) < int(linenum):
farr.append("")
farr[int(linenum)-1] = str(s)
f = open(fname, "w")
for line in farr:
f.write(line)
if (len(line) > 0 and line[-1:] != "n") or len(line) == 0:
f.write("n")
f.close()
 
def ReadLineInFile(fname, linenum):
import os
if not os.path.exists(fname):
return ""
f = open(fname, "r")
farr = []
for line in f:
farr.append(line)
f.close()
if len(farr) >= int(linenum):
ret = farr[int(linenum)-1]
if ret[-1:] == "n":
return ret[:-1]
else:
return ret
else:
return ""
 

 

intrologin

 

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
 
Hwid = constInfo.Hwid
Snn = constInfo.Snn
 
RUNUP_MATRIX_AUTH = FALSE
NEWCIBN_PASSPOD_AUTH = FALSE
 
LOGIN_DELAY_SEC = 0.0
SKIP_LOGIN_PHASE = FALSE
SKIP_LOGIN_PHASE_SUPPORT_CHANNEL = FALSE
FULL_BACK_IMAGE = FALSE
 
PASSPOD_MSG_DICT = {}
 
VIRTUAL_KEYBOARD_NUM_KEYS = 46
VIRTUAL_KEYBOARD_RAND_KEY = TRUE
 
def Suffle(src):
if VIRTUAL_KEYBOARD_RAND_KEY:
items = [item for item in src]
 
itemCount = len(items)
for oldPos in xrange(itemCount):
newPos = app.GetRandom(0, itemCount-1)
items[newPos], items[oldPos] = items[oldPos], items[newPos]
 
return "".join(items)
else:
return src
 
if localeInfo.IsNEWCIBN() or localeInfo.IsCIBN10():
LOGIN_DELAY_SEC = 20.0
FULL_BACK_IMAGE = TRUE
NEWCIBN_PASSPOD_AUTH = TRUE
PASSPOD_MSG_DICT = {
"PASERR1" : localeInfo.LOGIN_FAILURE_PASERR1,
"PASERR2" : localeInfo.LOGIN_FAILURE_PASERR2,
"PASERR3" : localeInfo.LOGIN_FAILURE_PASERR3,
"PASERR4" : localeInfo.LOGIN_FAILURE_PASERR4,
"PASERR5" : localeInfo.LOGIN_FAILURE_PASERR5,
}
 
elif localeInfo.IsYMIR() or localeInfo.IsCHEONMA():
FULL_BACK_IMAGE = TRUE
 
elif localeInfo.IsHONGKONG():
FULL_BACK_IMAGE = TRUE
RUNUP_MATRIX_AUTH = TRUE 
PASSPOD_MSG_DICT = {
"NOTELE" : localeInfo.LOGIN_FAILURE_NOTELEBLOCK,
}
 
elif localeInfo.IsJAPAN():
FULL_BACK_IMAGE = TRUE
 
def IsFullBackImage():
global FULL_BACK_IMAGE
return FULL_BACK_IMAGE
 
def IsLoginDelay():
global LOGIN_DELAY_SEC
if LOGIN_DELAY_SEC > 0.0:
return TRUE
else:
return FALSE
 
def IsRunupMatrixAuth():
global RUNUP_MATRIX_AUTH
return RUNUP_MATRIX_AUTH
 
def IsNEWCIBNPassPodAuth():
global NEWCIBN_PASSPOD_AUTH
return NEWCIBN_PASSPOD_AUTH
 
def GetLoginDelay():
global LOGIN_DELAY_SEC
return LOGIN_DELAY_SEC
 
app.SetGuildMarkPath("test")
class Item(ui.ListBoxEx.Item):
def __init__(self, fileName):
ui.ListBoxEx.Item.__init__(self)
self.canLoad=0
self.text=fileName
self.textLine=self.__CreateTextLine(fileName)
def __del__(self):
ui.ListBoxEx.Item.__del__(self)
def GetText(self):
return self.text
def SetSize(self, width, height):
ui.ListBoxEx.Item.SetSize(self, 6*len(self.textLine.GetText()) + 4, height)
def __CreateTextLine(self, fileName):
textLine=ui.TextLine()
textLine.SetParent(self)
textLine.SetPosition(0, 0)
textLine.SetText(fileName)
textLine.SetFontColor(25.0, 25.0, 25.0)
textLine.Show()
return textLine
 
class ConnectingDialog(ui.ScriptWindow):
 
def __init__(self):
ui.ScriptWindow.__init__(self)
self.__LoadDialog()
self.eventTimeOver = lambda *arg: None
self.eventExit = lambda *arg: None
 
def __del__(self):
ui.ScriptWindow.__del__(self)
 
def __LoadDialog(self):
try:
PythonScriptLoader = ui.PythonScriptLoader()
PythonScriptLoader.LoadScriptFile(self, "UIScript/ConnectingDialog.py")
 
self.board = self.GetChild("board")
self.message = self.GetChild("message")
self.countdownMessage = self.GetChild("countdown_message")
 
except:
import exception
exception.Abort("ConnectingDialog.LoadDialog.BindObject")
 
def Open(self, waitTime):
curTime = time.clock()
self.endTime = curTime + waitTime
 
self.Lock()
self.SetCenterPosition()
self.SetTop()
self.Show()
 
def Close(self):
self.Unlock()
self.Hide()
 
def Destroy(self):
self.Hide()
self.ClearDictionary()
 
def SetText(self, text):
self.message.SetText(text)
 
def SetCountDownMessage(self, waitTime):
self.countdownMessage.SetText("%.0f%s" % (waitTime, localeInfo.SECOND))
 
def SAFE_SetTimeOverEvent(self, event):
self.eventTimeOver = ui.__mem_func__(event)
 
def SAFE_SetExitEvent(self, event):
self.eventExit = ui.__mem_func__(event)
 
def OnUpdate(self):
lastTime = max(0, self.endTime - time.clock())
if 0 == lastTime:
self.Close()
self.eventTimeOver()
else:
self.SetCountDownMessage(self.endTime - time.clock())
 
def OnPressExitKey(self):
#self.eventExit()
return TRUE
 
class LoginWindow(ui.ScriptWindow):
 
IS_TEST = net.IsTest()
 
def __init__(self, stream):
print "NEW LOGIN WINDOW  ----------------------------------------------------------------------------"
ui.ScriptWindow.__init__(self)
net.SetPhaseWindow(net.PHASE_WINDOW_LOGIN, self)
net.SetAccountConnectorHandler(self)
 
self.matrixInputChanceCount = 0
self.lastLoginTime = 0
self.inputDialog = None
self.connectingDialog = None
self.stream=stream
self.isNowCountDown=FALSE
self.isStartError=FALSE
 
self.xServerBoard = 0
self.yServerBoard = 0
 
self.loadingImage = None
 
self.virtualKeyboard = None
self.virtualKeyboardMode = "ALPHABET"
self.virtualKeyboardIsUpper = FALSE
 
def __del__(self):
net.ClearPhaseWindow(net.PHASE_WINDOW_LOGIN, self)
net.SetAccountConnectorHandler(0)
ui.ScriptWindow.__del__(self)
print "---------------------------------------------------------------------------- DELETE LOGIN WINDOW"
 
def Open(self):
ServerStateChecker.Create(self)
 
print "LOGIN WINDOW OPEN ----------------------------------------------------------------------------"
 
self.loginFailureMsgDict={
#"DEFAULT" : locale.LOGIN_FAILURE_UNKNOWN,
 
"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" : self.__DisconnectAndInputPassword,
"WRONGMAT" : self.__DisconnectAndInputMatrix,
"QUIT" : app.Exit,
}
 
self.SetSize(wndMgr.GetScreenWidth(), wndMgr.GetScreenHeight())
self.SetWindowName("LoginWindow")
 
if not self.__LoadScript(uiScriptLocale.LOCALE_UISCRIPT_PATH + "LoginWindow.py"):
dbg.TraceError("LoginWindow.Open - __LoadScript Error")
return
 
self.__LoadLoginInfo("loginInfo.py")
 
if app.loggined:
self.loginFailureFuncDict = {
"WRONGPWD" : app.Exit,
"WRONGMAT" : app.Exit,
"QUIT" : app.Exit,
}
 
if musicInfo.loginMusic != "":
snd.SetMusicVolume(systemSetting.GetMusicVolume())
snd.FadeInMusic("BGM/"+musicInfo.loginMusic)
 
snd.SetSoundVolume(systemSetting.GetSoundVolume())
 
# pevent key "[" "]"
ime.AddExceptKey(91)
ime.AddExceptKey(93)
 
self.Show()
 
global SKIP_LOGIN_PHASE
if SKIP_LOGIN_PHASE:
if self.isStartError:
self.connectBoard.Hide()
self.loginBoard.Hide()
self.serverBoard.Hide()
self.PopupNotifyMessage(localeInfo.LOGIN_CONNECT_FAILURE, self.__ExitGame)
return
 
if self.loginInfo:
self.serverBoard.Hide()
else:
self.__RefreshServerList()
self.__OpenServerBoard()
else:
connectingIP = self.stream.GetConnectAddr()
if connectingIP:
if app.USE_OPENID and not app.OPENID_TEST :
self.__RefreshServerList()
self.__OpenServerBoard()
else:
self.__OpenLoginBoard()
if IsFullBackImage():
self.GetChild("bg1").Hide()
self.GetChild("bg2").Show()
 
else:
f = open("miles/login.cfg", "r+")
configuracao = f.readline(1)
if configuracao == "0":
f.close()
self.connectBoard.Hide()
self.loginBoard.Hide()
self.ShowRuleBoard()
else:
self.__RefreshServerList()
self.__OpenServerBoard()
 
app.ShowCursor()
def ShowRuleBoard(self):
f = open("miles/rules.txt", "r+")
rules = f.readlines()
f.close()
self.RuleBoard = ui.ThinBoard()
self.RuleBoard.SetSize(520,550)
self.RuleBoard.SetCenterPosition()
self.RuleBoard.Show()
self.Text = ui.ListBoxEx()
self.Text.SetParent(self.RuleBoard)
self.Text.SetSize(500, 400)
self.Text.SetViewItemCount(20)
self.Text.SetPosition(10, 80)
 
for line in rules:
self.Text.AppendItem(Item(line))
 
self.Text.Show()
self.scroll = ui.ScrollBar()
self.scroll.SetParent(self.RuleBoard)
self.scroll.SetPosition(500-10, 80)
self.scroll.SetScrollBarSize(400)
self.scroll.Show()
 
self.Text.SetScrollBar(self.scroll)
self.Accept = ui.Button()
self.Accept.SetParent(self.RuleBoard)
self.Accept.SetPosition(250-200,510)
self.Accept.SetUpVisual("d:/ymir work/ui/public/xlarge_Button_01.sub")
self.Accept.SetOverVisual("d:/ymir work/ui/public/xlarge_Button_02.sub")
self.Accept.SetDownVisual("d:/ymir work/ui/public/xlarge_Button_03.sub")
self.Accept.SetText("Aceitar")
self.Accept.SetEvent(ui.__mem_func__(self.__Accept))
 
self.Accept.Show()
 
 
self.Decline = ui.Button()
self.Decline.SetParent(self.RuleBoard)
self.Decline.SetPosition(250+20,510)
self.Decline.SetUpVisual("d:/ymir work/ui/public/xlarge_Button_01.sub")
self.Decline.SetOverVisual("d:/ymir work/ui/public/xlarge_Button_02.sub")
self.Decline.SetDownVisual("d:/ymir work/ui/public/xlarge_Button_03.sub")
self.Decline.SetText("Não aceitar")
self.Decline.SetEvent(ui.__mem_func__(self.__Decline))
self.Decline.Show()
def __Accept(self):
if self.scroll.GetPos() == 1:
self.RuleBoard.Hide()
f = open("miles/login.cfg", "r+")
f.write("1")
f.close()
self.__RefreshServerList()
self.__OpenServerBoard()
else:
self.PopupNotifyMessage("É OBRIGATÓRIO LER TODAS AS REGRAS!!!")
 
 
def __Decline(self):
app.Exit()
 
def Close(self):
 
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
ServerStateChecker.Initialize(self)
 
print "---------------------------------------------------------------------------- CLOSE LOGIN WINDOW "
#
# selectMusicÀÌ ¾øÀ¸¸é BGMÀÌ ²÷±â¹Ç·Î µÎ°³ ´Ù üũÇÑ´Ù. 
#
if musicInfo.loginMusic != "" and musicInfo.selectMusic != "":
snd.FadeOutMusic("BGM/"+musicInfo.loginMusic)
 
## NOTE : idEditLine¿Í pwdEditLineÀº À̺¥Æ®°¡ ¼­·Î ¿¬°á µÇ¾îÀ־
##        Event¸¦ °­Á¦·Î ÃʱâÈ­ ÇØÁÖ¾î¾ß¸¸ ÇÕ´Ï´Ù - [levites]
self.idEditLine.SetTabEvent(0)
self.idEditLine.SetReturnEvent(0)
self.pwdEditLine.SetReturnEvent(0)
self.pwdEditLine.SetTabEvent(0)
 
self.connectBoard = None
self.loginBoard = None
self.idEditLine = None
self.pwdEditLine = None
self.inputDialog = None
self.connectingDialog = None
self.loadingImage = None
 
self.serverBoard = None
self.serverList = None
self.channelList = None
 
# RUNUP_MATRIX_AUTH
self.matrixQuizBoard = None
self.matrixAnswerInput = None
self.matrixAnswerOK = None
self.matrixAnswerCancel = None
# RUNUP_MATRIX_AUTH_END
 
# NEWCIBN_PASSPOD_AUTH
self.passpodBoard = None
self.passpodAnswerInput = None
self.passpodAnswerOK = None
self.passpodAnswerCancel = None
# NEWCIBN_PASSPOD_AUTH_END
 
self.VIRTUAL_KEY_ALPHABET_LOWERS = None
self.VIRTUAL_KEY_ALPHABET_UPPERS = None
self.VIRTUAL_KEY_SYMBOLS = None
self.VIRTUAL_KEY_NUMBERS = None
 
# VIRTUAL_KEYBOARD_BUG_FIX
if self.virtualKeyboard:
for keyIndex in xrange(0, VIRTUAL_KEYBOARD_NUM_KEYS+1):
key = self.GetChild2("key_%d" % keyIndex)
if key:
key.SetEvent(None)
 
self.GetChild("key_space").SetEvent(None)
self.GetChild("key_backspace").SetEvent(None)
self.GetChild("key_enter").SetEvent(None)
self.GetChild("key_shift").SetToggleDownEvent(None)
self.GetChild("key_shift").SetToggleUpEvent(None)
self.GetChild("key_at").SetToggleDownEvent(None)
self.GetChild("key_at").SetToggleUpEvent(None)
 
self.virtualKeyboard = None
 
self.KillFocus()
self.Hide()
 
self.stream.popupWindow.Close()
self.loginFailureFuncDict=None
 
ime.ClearExceptKey()
 
app.HideCursor()
 
def __SaveChannelInfo(self):
try:
file=open("channel.inf", "w")
file.write("%d %d %d" % (self.__GetServerID(), self.__GetChannelID(), self.__GetRegionID()))
except:
print "LoginWindow.__SaveChannelInfo - SaveError"
 
def __LoadChannelInfo(self):
try:
file=open("channel.inf")
lines=file.readlines()
 
if len(lines)>0:
tokens=lines[0].split()
 
selServerID=int(tokens[0])
selChannelID=int(tokens[1])
 
if len(tokens) == 3:
regionID = int(tokens[2])
 
return regionID, selServerID, selChannelID
 
except:
print "LoginWindow.__LoadChannelInfo - OpenError"
return -1, -1, -1
 
def __ExitGame(self):
app.Exit()
 
def SetIDEditLineFocus(self):
if self.idEditLine != None:
self.idEditLine.SetFocus()
 
def SetPasswordEditLineFocus(self):
if localeInfo.IsEUROPE():
if self.idEditLine != None: #0000862: [M2EU] ·Î±×ÀÎâ Æ˾÷ ¿¡·¯: Á¾·á½Ã ¸ÕÀú None ¼³Á¤µÊ
self.idEditLine.SetText("")
self.idEditLine.SetFocus() #0000685: [M2EU] ¾ÆÀ̵ð/ºñ¹Ð¹øÈ£ À¯Ãß °¡´É ¹ö±× ¼öÁ¤: ¹«Á¶°Ç ¾ÆÀ̵ð·Î Æ÷Ä¿½º°¡ °¡°Ô ¸¸µç´Ù
 
if self.pwdEditLine != None: #0000862: [M2EU] ·Î±×ÀÎâ Æ˾÷ ¿¡·¯: Á¾·á½Ã ¸ÕÀú None ¼³Á¤µÊ
self.pwdEditLine.SetText("")
else:
if self.pwdEditLine != None:
self.pwdEditLine.SetFocus()
 
def OnEndCountDown(self):
self.isNowCountDown = FALSE
self.OnConnectFailure()
 
def OnConnectFailure(self):
 
if self.isNowCountDown:
return
 
snd.PlaySound("sound/ui/loginfail.wav")
 
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
if app.loggined:
self.PopupNotifyMessage(localeInfo.LOGIN_CONNECT_FAILURE, self.__ExitGame)
else:
self.PopupNotifyMessage(localeInfo.LOGIN_CONNECT_FAILURE, self.SetPasswordEditLineFocus)
 
def OnHandShake(self):
if not IsLoginDelay():
snd.PlaySound("sound/ui/loginok.wav")
self.PopupDisplayMessage(localeInfo.LOGIN_CONNECT_SUCCESS)
 
def OnLoginStart(self):
if not IsLoginDelay():
self.PopupDisplayMessage(localeInfo.LOGIN_PROCESSING)
 
def OnLoginFailure(self, error):
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
try:
loginFailureMsg = self.loginFailureMsgDict[error]
except KeyError:
if PASSPOD_MSG_DICT:
try:
loginFailureMsg = PASSPOD_MSG_DICT[error]
except KeyError:
loginFailureMsg = localeInfo.LOGIN_FAILURE_UNKNOWN + error
else:
loginFailureMsg = localeInfo.LOGIN_FAILURE_UNKNOWN  + error
 
 
#0000685: [M2EU] ¾ÆÀ̵ð/ºñ¹Ð¹øÈ£ À¯Ãß °¡´É ¹ö±× ¼öÁ¤: ¹«Á¶°Ç Æнº¿öµå·Î Æ÷Ä¿½º°¡ °¡°Ô ¸¸µç´Ù
loginFailureFunc=self.loginFailureFuncDict.get(error, self.SetPasswordEditLineFocus)
 
if app.loggined:
self.PopupNotifyMessage(loginFailureMsg, self.__ExitGame)
else:
self.PopupNotifyMessage(loginFailureMsg, loginFailureFunc)
 
snd.PlaySound("sound/ui/loginfail.wav")
 
def __DisconnectAndInputID(self):
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
self.SetIDEditLineFocus()
net.Disconnect()
 
def __DisconnectAndInputPassword(self):
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
self.SetPasswordEditLineFocus()
net.Disconnect()
 
def __DisconnectAndInputMatrix(self):
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
self.stream.popupWindow.Close()
self.matrixInputChanceCount -= 1
 
if self.matrixInputChanceCount <= 0:
self.__OnCloseInputDialog()
 
elif self.inputDialog:
self.inputDialog.Show()
 
def __LoadScript(self, fileName):
try:
pyScrLoader = ui.PythonScriptLoader()
pyScrLoader.LoadScriptFile(self, fileName)
except:
import exception
exception.Abort("LoginWindow.__LoadScript.LoadObject")
 
try:
GetObject=self.GetChild
self.serverBoard = GetObject("ServerBoard")
self.serverList = GetObject("ServerList")
self.channelList = GetObject("ChannelList")
self.serverSelectButton = GetObject("ServerSelectButton")
self.serverExitButton = GetObject("ServerExitButton")
self.connectBoard = GetObject("ConnectBoard")
self.loginBoard = GetObject("LoginBoard")
self.idEditLine = GetObject("ID_EditLine")
self.pwdEditLine = GetObject("Password_EditLine")
self.serverInfo = GetObject("ConnectName")
self.selectConnectButton = GetObject("SelectConnectButton")
self.loginButton = GetObject("LoginButton")
self.loginExitButton = GetObject("LoginExitButton")
 
if localeInfo.IsVIETNAM():
self.checkButton = GetObject("CheckButton")
self.checkButton.Down()
 
# RUNUP_MATRIX_AUTH
if IsRunupMatrixAuth():
self.matrixQuizBoard = GetObject("RunupMatrixQuizBoard")
self.matrixAnswerInput = GetObject("RunupMatrixAnswerInput")
self.matrixAnswerOK = GetObject("RunupMatrixAnswerOK")
self.matrixAnswerCancel = GetObject("RunupMatrixAnswerCancel")
# RUNUP_MATRIX_AUTH_END
 
# NEWCIBN_PASSPOD_AUTH
if IsNEWCIBNPassPodAuth():
self.passpodBoard = GetObject("NEWCIBN_PASSPOD_BOARD")
self.passpodAnswerInput = GetObject("NEWCIBN_PASSPOD_INPUT")
self.passpodAnswerOK = GetObject("NEWCIBN_PASSPOD_OK")
self.passpodAnswerCancel= GetObject("NEWCIBN_PASSPOD_CANCEL")
# NEWCIBN_PASSPOD_AUTH_END
 
self.virtualKeyboard = self.GetChild2("VirtualKeyboard")
 
if self.virtualKeyboard:
self.VIRTUAL_KEY_ALPHABET_UPPERS = Suffle(localeInfo.VIRTUAL_KEY_ALPHABET_UPPERS)
self.VIRTUAL_KEY_ALPHABET_LOWERS = "".join([localeInfo.VIRTUAL_KEY_ALPHABET_LOWERS[localeInfo.VIRTUAL_KEY_ALPHABET_UPPERS.index(e)] for e in self.VIRTUAL_KEY_ALPHABET_UPPERS])
if localeInfo.IsBRAZIL():
self.VIRTUAL_KEY_SYMBOLS_BR = Suffle(localeInfo.VIRTUAL_KEY_SYMBOLS_BR)
else:
self.VIRTUAL_KEY_SYMBOLS = Suffle(localeInfo.VIRTUAL_KEY_SYMBOLS)
self.VIRTUAL_KEY_NUMBERS = Suffle(localeInfo.VIRTUAL_KEY_NUMBERS)
self.__VirtualKeyboard_SetAlphabetMode()
 
self.GetChild("key_space").SetEvent(lambda : self.__VirtualKeyboard_PressKey(' '))
self.GetChild("key_backspace").SetEvent(lambda : self.__VirtualKeyboard_PressBackspace())
self.GetChild("key_enter").SetEvent(lambda : self.__VirtualKeyboard_PressReturn())
self.GetChild("key_shift").SetToggleDownEvent(lambda : self.__VirtualKeyboard_SetUpperMode())
self.GetChild("key_shift").SetToggleUpEvent(lambda : self.__VirtualKeyboard_SetLowerMode())
self.GetChild("key_at").SetToggleDownEvent(lambda : self.__VirtualKeyboard_SetSymbolMode())
self.GetChild("key_at").SetToggleUpEvent(lambda : self.__VirtualKeyboard_SetAlphabetMode())
 
except:
import exception
exception.Abort("LoginWindow.__LoadScript.BindObject")
 
if self.IS_TEST:
self.selectConnectButton.Hide()
else:
self.selectConnectButton.SetEvent(ui.__mem_func__(self.__OnClickSelectConnectButton))
 
self.serverBoard.OnKeyUp = ui.__mem_func__(self.__ServerBoard_OnKeyUp)
self.xServerBoard, self.yServerBoard = self.serverBoard.GetLocalPosition()
 
self.serverSelectButton.SetEvent(ui.__mem_func__(self.__OnClickSelectServerButton))
self.serverExitButton.SetEvent(ui.__mem_func__(self.__OnClickExitButton))
 
self.loginButton.SetEvent(ui.__mem_func__(self.__OnClickLoginButton))
self.loginExitButton.SetEvent(ui.__mem_func__(self.__OnClickExitButton))
 
self.serverList.SetEvent(ui.__mem_func__(self.__OnSelectServer))
 
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))
 
# RUNUP_MATRIX_AUTH
if IsRunupMatrixAuth():
self.matrixAnswerOK.SAFE_SetEvent(self.__OnClickMatrixAnswerOK)
self.matrixAnswerCancel.SAFE_SetEvent(self.__OnClickMatrixAnswerCancel)
self.matrixAnswerInput.SAFE_SetReturnEvent(self.__OnClickMatrixAnswerOK)
# RUNUP_MATRIX_AUTH_END
 
# NEWCIBN_PASSPOD_AUTH
if IsNEWCIBNPassPodAuth():
self.passpodAnswerOK.SAFE_SetEvent(self.__OnClickNEWCIBNPasspodAnswerOK)
self.passpodAnswerCancel.SAFE_SetEvent(self.__OnClickNEWCIBNPasspodAnswerCancel)
self.passpodAnswerInput.SAFE_SetReturnEvent(self.__OnClickNEWCIBNPasspodAnswerOK)
 
# NEWCIBN_PASSPOD_AUTH_END
 
 
if IsFullBackImage():
self.GetChild("bg1").Show()
self.GetChild("bg2").Hide()
return 1
 
def __VirtualKeyboard_SetKeys(self, keyCodes):
uiDefFontBackup = localeInfo.UI_DEF_FONT
localeInfo.UI_DEF_FONT = localeInfo.UI_DEF_FONT_LARGE
 
keyIndex = 1
for keyCode in keyCodes:
key = self.GetChild2("key_%d" % keyIndex)
if key:
key.SetEvent(lambda x=keyCode: self.__VirtualKeyboard_PressKey(x))
key.SetText(keyCode)
key.ButtonText.SetFontColor(0, 0, 0)
keyIndex += 1
 
for keyIndex in xrange(keyIndex, VIRTUAL_KEYBOARD_NUM_KEYS+1):
key = self.GetChild2("key_%d" % keyIndex)
if key:
key.SetEvent(lambda x=' ': self.__VirtualKeyboard_PressKey(x))
key.SetText(' ')
 
localeInfo.UI_DEF_FONT = uiDefFontBackup
 
def __VirtualKeyboard_PressKey(self, code):
ime.PasteString(code)
 
#if self.virtualKeyboardMode == "ALPHABET" and self.virtualKeyboardIsUpper:
# self.__VirtualKeyboard_SetLowerMode()
 
def __VirtualKeyboard_PressBackspace(self):
ime.PasteBackspace()
 
def __VirtualKeyboard_PressReturn(self):
ime.PasteReturn()
 
def __VirtualKeyboard_SetUpperMode(self):
self.virtualKeyboardIsUpper = TRUE
 
if self.virtualKeyboardMode == "ALPHABET":
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_ALPHABET_UPPERS)
elif self.virtualKeyboardMode == "NUMBER":
if localeInfo.IsBRAZIL():
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_SYMBOLS_BR)
else:
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_SYMBOLS)
else:
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_NUMBERS)
 
def __VirtualKeyboard_SetLowerMode(self):
self.virtualKeyboardIsUpper = FALSE
 
if self.virtualKeyboardMode == "ALPHABET":
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_ALPHABET_LOWERS)
elif self.virtualKeyboardMode == "NUMBER":
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_NUMBERS)
else:
if localeInfo.IsBRAZIL():
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_SYMBOLS_BR)
else:
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_SYMBOLS)
 
def __VirtualKeyboard_SetAlphabetMode(self):
self.virtualKeyboardIsUpper = FALSE
self.virtualKeyboardMode = "ALPHABET"
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_ALPHABET_LOWERS)
 
def __VirtualKeyboard_SetNumberMode(self):
self.virtualKeyboardIsUpper = FALSE
self.virtualKeyboardMode = "NUMBER"
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_NUMBERS)
 
def __VirtualKeyboard_SetSymbolMode(self):
self.virtualKeyboardIsUpper = FALSE
self.virtualKeyboardMode = "SYMBOL"
if localeInfo.IsBRAZIL():
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_SYMBOLS_BR)
else:
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_SYMBOLS)
 
def Connect(self, id, pwd, Hwid, Snn):
    global Hwid, Snn
    if constInfo.SEQUENCE_PACKET_ENABLE:
        net.SetPacketSequenceMode()
         
    if IsLoginDelay():
        loginDelay = GetLoginDelay()
        self.connectingDialog = ConnectingDialog()
        self.connectingDialog.Open(loginDelay)
        self.connectingDialog.SAFE_SetTimeOverEvent(self.OnEndCountDown)
        self.connectingDialog.SAFE_SetExitEvent(self.OnPressExitKey)
        self.isNowCountDown = TRUE
 
    else:
        self.stream.popupWindow.Close()
        self.stream.popupWindow.Open(localeInfo.LOGIN_CONNETING, self.SetPasswordEditLineFocus, localeInfo.UI_CANCEL)
         
    self.stream.SetLoginInfo(id, pwd, Hwid, Snn)
    self.stream.Connect()
 
def __OnClickExitButton(self):
self.stream.SetPhaseWindow(0)
 
def __SetServerInfo(self, name):
net.SetServerInfo(name.strip())
self.serverInfo.SetText(name)
 
def __LoadLoginInfo(self, loginInfoFileName):
global Hwid, Snn
 
try:
loginInfo={}
execfile(loginInfoFileName, loginInfo)
except IOError:
print(
"ÀÚµ¿ ·Î±×ÀÎÀ» ÇϽ÷Á¸é" + loginInfoFileName + "ÆÄÀÏÀ» ÀÛ¼ºÇØÁÖ¼¼¿än"
"n"
"³»¿ë:n"
"================================================================n"
"addr=ÁÖ¼Òn"
"port=Æ÷Æ®n"
"id=¾ÆÀ̵ðn"
"pwd=ºñ¹Ð¹øÈ£n"
"slot=ij¸¯ÅÍ ¼±Åà À妽º (¾ø°Å³ª -1À̸é ÀÚµ¿ ¼±Åà ¾ÈÇÔ)n"
"autoLogin=ÀÚµ¿ Á¢¼Ó ¿©ºÎn"
"autoSelect=ÀÚµ¿ Á¢¼Ó ¿©ºÎn"
"localeInfo=(ymir) LC_Ymir ÀÏ°æ¿ì ymir·Î ÀÛµ¿. ÁöÁ¤ÇÏÁö ¾ÊÀ¸¸é korea·Î ÀÛµ¿n"
);
 
id=loginInfo.get("id", "")
pwd=loginInfo.get("pwd", "")
 
if self.IS_TEST:
try:
addr=loginInfo["addr"]
port=loginInfo["port"]
account_addr=addr
account_port=port
 
net.SetMarkServer(addr, port)
self.__SetServerInfo(localeInfo.CHANNEL_TEST_SERVER_ADDR % (addr, port))
except:
try:
addr=serverInfo.TESTADDR["ip"]
port=serverInfo.TESTADDR["tcp_port"]
 
net.SetMarkServer(addr, port)
self.__SetServerInfo(localeInfo.CHANNEL_TEST_SERVER)
except:
import exception
exception.Abort("LoginWindow.__LoadLoginInfo - Å×½ºÆ®¼­¹ö ÁÖ¼Ò°¡ ¾ø½À´Ï´Ù")
 
else:
addr=loginInfo.get("addr", "")
port=loginInfo.get("port", 0)
account_addr=loginInfo.get("account_addr", addr)
account_port=loginInfo.get("account_port", port)
 
localeInfo = loginInfo.get("localeInfo", "")
 
if addr and port:
net.SetMarkServer(addr, port)
 
if localeInfo == "ymir" :
net.SetServerInfo("õ¸¶ ¼­¹ö")
self.serverInfo.SetText("Y:"+addr+":"+str(port))
else:
net.SetServerInfo(addr+":"+str(port))
self.serverInfo.SetText("K:"+addr+":"+str(port))
 
slot=loginInfo.get("slot", 0)
isAutoLogin=loginInfo.get("auto", 0)
isAutoLogin=loginInfo.get("autoLogin", 0)
isAutoSelect=loginInfo.get("autoSelect", 0)
 
self.stream.SetCharacterSlot(slot)
self.stream.SetConnectInfo(addr, port, account_addr, account_port)
self.stream.isAutoLogin=isAutoLogin
self.stream.isAutoSelect=isAutoSelect
 
self.id = None
self.pwd = None
self.Hwid = Hwid
self.Snn = Snn
self.loginnedServer = None
self.loginnedChannel = None
app.loggined = FALSE
 
self.loginInfo = loginInfo
 
if self.id and self.pwd:
app.loggined = TRUE
 
if isAutoLogin:
self.Connect(id, pwd, Hwid, Snn)
 
print "=================================================================================="
print "ÀÚµ¿ ·Î±×ÀÎ: %s - %s:%d %s" % (loginInfoFileName, addr, port, id)
print "=================================================================================="
 
 
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)
 
# RUNUP_MATRIX_AUTH
def BINARY_OnRunupMatrixQuiz(self, quiz):
if not IsRunupMatrixAuth():
return
 
id = self.GetChild("RunupMatrixID")
id.SetText(self.idEditLine.GetText())
 
code = self.GetChild("RunupMatrixCode")
 
code.SetText("".join(["[%c,%c]" % (quiz, quiz[i+1]) for i in xrange(0, len(quiz), 2)]))
 
self.stream.popupWindow.Close()
self.serverBoard.Hide()
self.connectBoard.Hide()
self.loginBoard.Hide()
self.matrixQuizBoard.Show()
self.matrixAnswerInput.SetFocus()
 
def __OnClickMatrixAnswerOK(self):
answer = self.matrixAnswerInput.GetText()
 
print "matrix_quiz.ok"
net.SendRunupMatrixCardPacket(answer)
self.matrixQuizBoard.Hide()
 
self.stream.popupWindow.Close()
self.stream.popupWindow.Open("WAITING FOR MATRIX AUTHENTICATION", 
self.__OnClickMatrixAnswerCancel, 
localeInfo.UI_CANCEL)
 
def __OnClickMatrixAnswerCancel(self):
print "matrix_quiz.cancel"
 
if self.matrixQuizBoard:
self.matrixQuizBoard.Hide()
 
if self.connectBoard:
self.connectBoard.Show()
 
if self.loginBoard:
self.loginBoard.Show()
 
# RUNUP_MATRIX_AUTH_END
 
# NEWCIBN_PASSPOD_AUTH
def BINARY_OnNEWCIBNPasspodRequest(self):
if not IsNEWCIBNPassPodAuth():
return
 
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
self.stream.popupWindow.Close()
self.serverBoard.Hide()
self.connectBoard.Hide()
self.loginBoard.Hide()
self.passpodBoard.Show()
self.passpodAnswerInput.SetFocus()
 
def BINARY_OnNEWCIBNPasspodFailure(self):
if not IsNEWCIBNPassPodAuth():
return
 
def __OnClickNEWCIBNPasspodAnswerOK(self):
answer = self.passpodAnswerInput.GetText()
 
print "passpod.ok"
net.SendNEWCIBNPasspodAnswerPacket(answer)
self.passpodAnswerInput.SetText("")
self.passpodBoard.Hide()
 
self.stream.popupWindow.Close()
self.stream.popupWindow.Open(localeInfo.WAIT_FOR_PASSPOD, 
self.__OnClickNEWCIBNPasspodAnswerCancel, 
localeInfo.UI_CANCEL)
 
def __OnClickNEWCIBNPasspodAnswerCancel(self):
print "passpod.cancel"
 
if self.passpodBoard:
self.passpodBoard.Hide()
 
if self.connectBoard:
self.connectBoard.Show()
 
if self.loginBoard:
self.loginBoard.Show()
 
# NEWCIBN_PASSPOD_AUTH_END
 
 
def OnMatrixCard(self, row1, row2, row3, row4, col1, col2, col3, col4):
 
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
self.matrixInputChanceCount = 3
 
self.stream.popupWindow.Close()
 
# CHINA_MATRIX_CARD_BUG_FIX
## A~Z ±îÁö 26 À̳»ÀÇ °ªÀÌ µé¾îÀÖ¾î¾ß¸¸ ÇÑ´Ù.
## Python Exception Log ¿¡¼­ ±× ÀÌ»óÀÇ °ªÀÌ µé¾îÀ־ ¿¡·¯ ¹æÁö
## Çåµ¥ ¿Ö Çѱ¹ÂÊ ·Î±×¿¡¼­ ÀÌ°Ô È°¿ëµÇ´ÂÁö´Â ¸ð¸£°ÚÀ½
row1 = min(30, row1)
row2 = min(30, row2)
row3 = min(30, row3)
row4 = min(30, row4)
# END_OF_CHINA_MATRIX_CARD_BUG_FIX
 
row1 = chr(row1 + ord('A'))
row2 = chr(row2 + ord('A'))
row3 = chr(row3 + ord('A'))
row4 = chr(row4 + ord('A'))
col1 = col1 + 1
col2 = col2 + 1
col3 = col3 + 1
col4 = col4 + 1
 
inputDialog = uiCommon.InputDialogWithDescription2()
inputDialog.SetMaxLength(8)
inputDialog.SetAcceptEvent(ui.__mem_func__(self.__OnAcceptMatrixCardData))
inputDialog.SetCancelEvent(ui.__mem_func__(self.__OnCancelMatrixCardData))
inputDialog.SetTitle(localeInfo.INPUT_MATRIX_CARD_TITLE)
inputDialog.SetDescription1(localeInfo.INPUT_MATRIX_CARD_NUMBER)
inputDialog.SetDescription2("%c%d %c%d %c%d %c%d" % (row1, col1,
row2, col2,
row3, col3,
row4, col4))
 
inputDialog.Open()
self.inputDialog = inputDialog
 
def __OnAcceptMatrixCardData(self):
text = self.inputDialog.GetText()
net.SendChinaMatrixCardPacket(text)
if self.inputDialog:
self.inputDialog.Hide()
self.PopupNotifyMessage(localeInfo.LOGIN_PROCESSING)
return TRUE
 
def __OnCancelMatrixCardData(self):
self.SetPasswordEditLineFocus()
self.__OnCloseInputDialog()
self.__DisconnectAndInputPassword()
return TRUE
 
def __OnCloseInputDialog(self):
if self.inputDialog:
self.inputDialog.Close()
self.inputDialog = None
return TRUE
 
def OnPressExitKey(self):
self.stream.popupWindow.Close()
self.stream.SetPhaseWindow(0)
return TRUE
 
def OnExit(self):
self.stream.popupWindow.Close()
self.stream.popupWindow.Open(localeInfo.LOGIN_FAILURE_WRONG_MATRIX_CARD_NUMBER_TRIPLE, app.Exit, localeInfo.UI_OK)
 
def OnUpdate(self):
ServerStateChecker.Update()
 
def EmptyFunc(self):
pass
 
#####################################################################################
 
def __ServerBoard_OnKeyUp(self, key):
if self.serverBoard.IsShow():
if app.DIK_RETURN==key:
self.__OnClickSelectServerButton()
return TRUE
 
def __GetRegionID(self):
return 0
 
def __GetServerID(self):
return self.serverList.GetSelectedItem()
 
def __GetChannelID(self):
return self.channelList.GetSelectedItem()
 
# SEVER_LIST_BUG_FIX
def __ServerIDToServerIndex(self, regionID, targetServerID):
try:
regionDict = serverInfo.REGION_DICT[regionID]
except KeyError:
return -1
 
retServerIndex = 0
for eachServerID, regionDataDict in regionDict.items():
if eachServerID == targetServerID:
return retServerIndex
 
retServerIndex += 1
 
return -1
 
def __ChannelIDToChannelIndex(self, channelID):
return channelID - 1
# END_OF_SEVER_LIST_BUG_FIX
 
def __OpenServerBoard(self):
 
loadRegionID, loadServerID, loadChannelID = self.__LoadChannelInfo()
 
serverIndex = self.__ServerIDToServerIndex(loadRegionID, loadServerID)
channelIndex = self.__ChannelIDToChannelIndex(loadChannelID)
 
# RUNUP_MATRIX_AUTH
if IsRunupMatrixAuth():
self.matrixQuizBoard.Hide()
# RUNUP_MATRIX_AUTH_END
 
# NEWCIBN_PASSPOD_AUTH
if IsNEWCIBNPassPodAuth():
self.passpodBoard.Hide()
# NEWCIBN_PASSPOD_AUTH_END
 
 
self.serverList.SelectItem(serverIndex)
 
if localeInfo.IsEUROPE():
self.channelList.SelectItem(app.GetRandom(0, self.channelList.GetItemCount()))
else:
if channelIndex >= 0:
self.channelList.SelectItem(channelIndex)
 
## Show/Hide Äڵ忡 ¹®Á¦°¡ À־ Àӽà - [levites]
self.serverBoard.SetPosition(self.xServerBoard, self.yServerBoard)
self.serverBoard.Show()
self.connectBoard.Hide()
self.loginBoard.Hide()
 
if self.virtualKeyboard:
self.virtualKeyboard.Hide()
 
if app.loggined and not SKIP_LOGIN_PHASE_SUPPORT_CHANNEL:
self.serverList.SelectItem(self.loginnedServer-1)
self.channelList.SelectItem(self.loginnedChannel-1)
self.__OnClickSelectServerButton()
 
def __OpenLoginBoard(self):
 
self.serverExitButton.SetEvent(ui.__mem_func__(self.__OnClickExitServerButton))
self.serverExitButton.SetText(localeInfo.UI_CLOSE)
 
# RUNUP_MATRIX_AUTH
if IsRunupMatrixAuth():
self.matrixQuizBoard.Hide()
# RUNUP_MATRIX_AUTH_END
 
# NEWCIBN_PASSPOD_AUTH
if IsNEWCIBNPassPodAuth():
self.passpodBoard.Hide()
# NEWCIBN_PASSPOD_AUTH_END
 
self.serverBoard.SetPosition(self.xServerBoard, wndMgr.GetScreenHeight())
self.serverBoard.Hide()
 
if self.virtualKeyboard:
self.virtualKeyboard.Show()
 
if app.loggined:
self.Connect(self.id, self.pwd)
self.connectBoard.Hide()
self.loginBoard.Hide()
elif not self.stream.isAutoLogin:
self.connectBoard.Show()
self.loginBoard.Show()
 
## if users have the login infomation, then don't initialize.2005.9 haho
if self.idEditLine == None:
self.idEditLine.SetText("")
if self.pwdEditLine == None:
self.pwdEditLine.SetText("")
 
self.idEditLine.SetFocus()
 
global SKIP_LOGIN_PHASE
if SKIP_LOGIN_PHASE:
if not self.loginInfo:
self.connectBoard.Hide()
 
def __OnSelectRegionGroup(self):
self.__RefreshServerList()
 
def __OnSelectSettlementArea(self):
# SEVER_LIST_BUG_FIX
regionID = self.__GetRegionID()
serverID = self.serverListOnRegionBoard.GetSelectedItem()
 
serverIndex = self.__ServerIDToServerIndex(regionID, serverID)
self.serverList.SelectItem(serverIndex)
# END_OF_SEVER_LIST_BUG_FIX
 
self.__OnSelectServer()
 
def __RefreshServerList(self):
regionID = self.__GetRegionID()
 
if not serverInfo.REGION_DICT.has_key(regionID):
return
 
self.serverList.ClearItem()
 
regionDict = serverInfo.REGION_DICT[regionID]
 
# SEVER_LIST_BUG_FIX
visible_index = 1
for id, regionDataDict in regionDict.items():
name = regionDataDict.get("name", "noname")
if localeInfo.IsBRAZIL() or localeInfo.IsCANADA():
self.serverList.InsertItem(id, "%s" % (name))
else:
if localeInfo.IsCIBN10():
if name[0] == "#":
self.serverList.InsertItem(-1, "  %s" % (name[1:]))
else:
self.serverList.InsertItem(id, "  %s" % (name))
visible_index += 1
else:
try:
server_id = serverInfo.SERVER_ID_DICT[id]
except:
server_id = visible_index
 
self.serverList.InsertItem(id, "  %02d. %s" % (int(server_id), name))
 
visible_index += 1
 
# END_OF_SEVER_LIST_BUG_FIX
 
def __OnSelectServer(self):
self.__OnCloseInputDialog()
self.__RequestServerStateList()
self.__RefreshServerStateList()
 
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
 
ServerStateChecker.Initialize();
for id, channelDataDict in channelDict.items():
key=channelDataDict["key"]
ip=channelDataDict["ip"]
udp_port=channelDataDict["udp_port"]
ServerStateChecker.AddChannel(key, ip, udp_port)
 
ServerStateChecker.Request()
 
def __RefreshServerStateList(self):
 
regionID = self.__GetRegionID()
serverID = self.__GetServerID()
bakChannelID = self.channelList.GetSelectedItem()
 
self.channelList.ClearItem()
 
try:
channelDict = serverInfo.REGION_DICT[regionID][serverID]["channel"]
except:
print " __RequestServerStateList - serverInfo.REGION_DICT(%d, %d)" % (regionID, serverID)
return
 
for channelID, channelDataDict in channelDict.items():
channelName = channelDataDict["name"]
channelState = channelDataDict["state"]
self.channelList.InsertItem(channelID, " %s %s" % (channelName, channelState))
 
self.channelList.SelectItem(bakChannelID-1)
 
def __GetChannelName(self, regionID, selServerID, selChannelID):
try:
return serverInfo.REGION_DICT[regionID][selServerID]["channel"][selChannelID]["name"]
except KeyError:
if 9==selChannelID:
return localeInfo.CHANNEL_PVP
else:
return localeInfo.CHANNEL_NORMAL % (selChannelID)
 
def NotifyChannelState(self, addrKey, state):
try:
stateName=serverInfo.STATE_DICT[state]
except:
stateName=serverInfo.STATE_NONE
 
regionID=int(addrKey/1000)
serverID=int(addrKey/10) % 100
channelID=addrKey%10
 
try:
serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["state"] = stateName
self.__RefreshServerStateList()
 
except:
import exception
exception.Abort(localeInfo.CHANNEL_NOT_FIND_INFO)
 
def __OnClickExitServerButton(self):
print "exit server"
self.__OpenLoginBoard()
 
if IsFullBackImage():
self.GetChild("bg1").Hide()
self.GetChild("bg2").Show()
 
 
def __OnClickSelectRegionButton(self):
regionID = self.__GetRegionID()
serverID = self.__GetServerID()
 
if (not serverInfo.REGION_DICT.has_key(regionID)):
self.PopupNotifyMessage(localeInfo.CHANNEL_SELECT_REGION)
return
 
if (not serverInfo.REGION_DICT[regionID].has_key(serverID)):
self.PopupNotifyMessage(localeInfo.CHANNEL_SELECT_SERVER)
return
 
self.__SaveChannelInfo()
 
self.serverExitButton.SetEvent(ui.__mem_func__(self.__OnClickExitServerButton))
self.serverExitButton.SetText(localeInfo.UI_CLOSE)
 
self.__RefreshServerList()
self.__OpenServerBoard()
 
def __OnClickSelectServerButton(self):
if IsFullBackImage():
self.GetChild("bg1").Hide()
self.GetChild("bg2").Show()
 
regionID = self.__GetRegionID()
serverID = self.__GetServerID()
channelID = self.__GetChannelID()
 
if (not serverInfo.REGION_DICT.has_key(regionID)):
self.PopupNotifyMessage(localeInfo.CHANNEL_SELECT_REGION)
return
 
if (not serverInfo.REGION_DICT[regionID].has_key(serverID)):
self.PopupNotifyMessage(localeInfo.CHANNEL_SELECT_SERVER)
return
 
try:
channelDict = serverInfo.REGION_DICT[regionID][serverID]["channel"]
except KeyError:
return
 
try:
state = channelDict[channelID]["state"]
except KeyError:
self.PopupNotifyMessage(localeInfo.CHANNEL_SELECT_CHANNEL)
return
 
# »óÅ°¡ FULL °ú °°À¸¸é ÁøÀÔ ±ÝÁö
if state == serverInfo.STATE_DICT[3]: 
self.PopupNotifyMessage(localeInfo.CHANNEL_NOTIFY_FULL)
return
 
self.__SaveChannelInfo()
 
try:
serverName = serverInfo.REGION_DICT[regionID][serverID]["name"]
channelName = serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["name"]
addrKey = serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["key"]
 
if "õ¸¶ ¼­¹ö" == serverName:
app.ForceSetlocaleInfo("ymir", "localeInfo/ymir")
elif "Äèµµ ¼­¹ö" == serverName:
app.ForceSetlocaleInfo("we_korea", "localeInfo/we_korea")
 
except:
print " ERROR __OnClickSelectServerButton(%d, %d, %d)" % (regionID, serverID, channelID)
serverName = localeInfo.CHANNEL_EMPTY_SERVER
channelName = localeInfo.CHANNEL_NORMAL % channelID
 
self.__SetServerInfo("%s, %s " % (serverName, channelName))
 
try:
ip = serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["ip"]
tcp_port = serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["tcp_port"]
except:
import exception
exception.Abort("LoginWindow.__OnClickSelectServerButton - ¼­¹ö ¼±Åà ½ÇÆÐ")
 
try:
account_ip = serverInfo.REGION_AUTH_SERVER_DICT[regionID][serverID]["ip"]
account_port = serverInfo.REGION_AUTH_SERVER_DICT[regionID][serverID]["port"]
except:
account_ip = 0
account_port = 0
 
try:
markKey = regionID*1000 + serverID*10
markAddrValue=serverInfo.MARKADDR_DICT[markKey]
net.SetMarkServer(markAddrValue["ip"], markAddrValue["tcp_port"])
app.SetGuildMarkPath(markAddrValue["mark"])
# GUILD_SYMBOL
app.SetGuildSymbolPath(markAddrValue["symbol_path"])
# END_OF_GUILD_SYMBOL
 
except:
import exception
exception.Abort("LoginWindow.__OnClickSelectServerButton - ¸¶Å© Á¤º¸ ¾øÀ½")
 
 
if app.USE_OPENID and not app.OPENID_TEST :
## 2012.07.19 OpenID : ±è¿ë¿í
# ä³Î ¼±Åà ȭ¸é¿¡¼­ "È®ÀÎ"(SelectServerButton) À» ´­·¶À»¶§,
# ·Î±×ÀÎ È­¸éÀ¸·Î ³Ñ¾î°¡Áö ¾Ê°í ¹Ù·Î ¼­¹ö¿¡ OpenID ÀÎÁõÅ°¸¦ º¸³»µµ·Ï ¼öÁ¤
self.stream.SetConnectInfo(ip, tcp_port, account_ip, account_port)
self.Connect(0, 0)
else :
self.stream.SetConnectInfo(ip, tcp_port, account_ip, account_port)
self.__OpenLoginBoard()
 
 
def __OnClickSelectConnectButton(self):
if IsFullBackImage():
self.GetChild("bg1").Show()
self.GetChild("bg2").Hide()
self.__RefreshServerList()
self.__OpenServerBoard()
 
def __OnClickLoginButton(self):
global Hwid, Snn
id = self.idEditLine.GetText()
pwd = self.pwdEditLine.GetText()
 
if len(id)==0:
self.PopupNotifyMessage(localeInfo.LOGIN_INPUT_ID, self.SetIDEditLineFocus)
return
 
if len(pwd)==0:
self.PopupNotifyMessage(localeInfo.LOGIN_INPUT_PASSWORD, self.SetPasswordEditLineFocus)
return
 
self.Connect(id, pwd, Hwid, Snn)

 
networkmodule
 

###################################################################################################
# Network
 
import app
import chr
import dbg
import net
import snd
 
import chr
import chrmgr
import background
import player
import playerSettingModule
 
import ui
import uiPhaseCurtain
 
import localeInfo
import constInfo
 
Hwid=constInfo.Hwid
Snn=constInfo.Snn
 
class PopupDialog(ui.ScriptWindow):
 
def __init__(self):
print "NEW POPUP DIALOG ----------------------------------------------------------------------------"
ui.ScriptWindow.__init__(self)
self.CloseEvent = 0
 
def __del__(self):
print "---------------------------------------------------------------------------- DELETE POPUP DIALOG "
ui.ScriptWindow.__del__(self)
 
def LoadDialog(self):
PythonScriptLoader = ui.PythonScriptLoader()
PythonScriptLoader.LoadScriptFile(self, "UIScript/PopupDialog.py")
 
def Open(self, Message, event = 0, ButtonName = localeInfo.UI_CANCEL):
 
if TRUE == self.IsShow():
self.Close()
 
self.Lock()
self.SetTop()
self.CloseEvent = event
 
AcceptButton = self.GetChild("accept")
AcceptButton.SetText(ButtonName)
AcceptButton.SetEvent(ui.__mem_func__(self.Close))
 
self.GetChild("message").SetText(Message)
self.Show()
 
def Close(self):
 
if FALSE == self.IsShow():
self.CloseEvent = 0
return
 
self.Unlock()
self.Hide()
 
if 0 != self.CloseEvent:
self.CloseEvent()
self.CloseEvent = 0
 
def Destroy(self):
self.Close()
self.ClearDictionary()
 
def OnPressEscapeKey(self):
self.Close()
return TRUE
 
def OnIMEReturn(self):
self.Close()
return TRUE
 
##
## Main Stream
##
class MainStream(object):
isChrData=0
 
def __init__(self):
print "NEWMAIN STREAM ----------------------------------------------------------------------------"
net.SetHandler(self)
net.SetTCPRecvBufferSize(128*1024)
net.SetTCPSendBufferSize(4096)
net.SetUDPRecvBufferSize(4096)
 
self.id=""
self.pwd=""
self.Hwid=constInfo.Hwid
self.Snn=constInfo.Snn
self.addr=""
self.port=0
self.account_addr=0
self.account_port=0
self.slot=0
self.isAutoSelect=0
self.isAutoLogin=0
 
self.curtain = 0
self.curPhaseWindow = 0
self.newPhaseWindow = 0
 
def __del__(self):
print "---------------------------------------------------------------------------- DELETE MAIN STREAM "
 
def Destroy(self):
if self.curPhaseWindow:
self.curPhaseWindow.Close()
self.curPhaseWindow = 0
 
if self.newPhaseWindow:
self.newPhaseWindow.Close()
self.newPhaseWindow = 0
 
self.popupWindow.Destroy()
self.popupWindow = 0
 
self.curtain = 0
 
def Create(self):
self.CreatePopupDialog()
 
self.curtain = uiPhaseCurtain.PhaseCurtain()
 
def SetPhaseWindow(self, newPhaseWindow):
if self.newPhaseWindow:
#print "이미 새로운 윈도우로 바꾼상태에서 또 바꿈", newPhaseWindow
self.__ChangePhaseWindow()
 
self.newPhaseWindow=newPhaseWindow
 
if self.curPhaseWindow:
#print "페이드 아웃되면 바꿈"
self.curtain.FadeOut(self.__ChangePhaseWindow)
else:
#print "현재 윈도우가 없는 상태라 바로 바꿈"
self.__ChangePhaseWindow()
 
def __ChangePhaseWindow(self):
oldPhaseWindow=self.curPhaseWindow
newPhaseWindow=self.newPhaseWindow
self.curPhaseWindow=0
self.newPhaseWindow=0
 
if oldPhaseWindow:
oldPhaseWindow.Close()
 
if newPhaseWindow:
newPhaseWindow.Open()
 
self.curPhaseWindow=newPhaseWindow
 
if self.curPhaseWindow:
self.curtain.FadeIn()
else:
app.Exit()
 
def CreatePopupDialog(self):
self.popupWindow = PopupDialog()
self.popupWindow.LoadDialog()
self.popupWindow.SetCenterPosition()
self.popupWindow.Hide()
 
 
## SelectPhase
##########################################################################################
def SetLogoPhase(self):
net.Disconnect()
 
import introLogo
self.SetPhaseWindow(introLogo.LogoWindow(self))
 
def SetLoginPhase(self):
net.Disconnect()
 
import introLogin
self.SetPhaseWindow(introLogin.LoginWindow(self))
 
def SetSelectEmpirePhase(self):
try:
import introEmpire
self.SetPhaseWindow(introEmpire.SelectEmpireWindow(self))
except:
import exception
exception.Abort("networkModule.SetSelectEmpirePhase")
 
 
def SetReselectEmpirePhase(self):
try:
import introEmpire
self.SetPhaseWindow(introEmpire.ReselectEmpireWindow(self))
except:
import exception
exception.Abort("networkModule.SetReselectEmpirePhase")
 
def SetSelectCharacterPhase(self):
try:
localeInfo.LoadLocaleData()
import introSelect
self.popupWindow.Close()
self.SetPhaseWindow(introSelect.SelectCharacterWindow(self))
except:
import exception
exception.Abort("networkModule.SetSelectCharacterPhase")
 
def SetCreateCharacterPhase(self):
try:
import introCreate
self.SetPhaseWindow(introCreate.CreateCharacterWindow(self))
except:
import exception
exception.Abort("networkModule.SetCreateCharacterPhase")
 
def SetTestGamePhase(self, x, y):
try:
import introLoading
loadingPhaseWindow=introLoading.LoadingWindow(self)
loadingPhaseWindow.LoadData(x, y)
self.SetPhaseWindow(loadingPhaseWindow)
except:
import exception
exception.Abort("networkModule.SetLoadingPhase")
 
 
 
def SetLoadingPhase(self):
try:
import introLoading
self.SetPhaseWindow(introLoading.LoadingWindow(self))
except:
import exception
exception.Abort("networkModule.SetLoadingPhase")
 
def SetGamePhase(self):
try:
import game
self.popupWindow.Close()
self.SetPhaseWindow(game.GameWindow(self))
except:
raise
import exception
exception.Abort("networkModule.SetGamePhase")
 
################################
# Functions used in python
 
## Login
def Connect(self):
import constInfo
if constInfo.KEEP_ACCOUNT_CONNETION_ENABLE:
net.ConnectToAccountServer(self.addr, self.port, self.account_addr, self.account_port)
else:
net.ConnectTCP(self.addr, self.port)
 
#net.ConnectUDP(IP, Port)
 
def SetConnectInfo(self, addr, port, account_addr=0, account_port=0):
self.addr = addr
self.port = port
self.account_addr = account_addr
self.account_port = account_port
 
def GetConnectAddr(self):
return self.addr
 
def SetLoginInfo(self, id, pwd, Hwid, Snn):
self.id = id
self.pwd = pwd
self.Hwid = constInfo.Hwid
self.Snn = constInfo.Snn
net.SetLoginInfo(id, pwd, Hwid, Snn)
 
def CancelEnterGame(self):
pass
 
## Select
def SetCharacterSlot(self, slot):
self.slot=slot
 
def GetCharacterSlot(self):
return self.slot
 
## Empty
def EmptyFunction(self):
pass
 

 
 
 
1130 02:42:05084 :: Traceback (most recent call last):

 

1130 02:42:05084 ::   File "introLogo.py", line 60, in OnUpdate

 

1130 02:42:05085 ::   File "networkModule.py", line 183, in SetLoginPhase

 

1130 02:42:05085 ::   File "system.py", line 130, in __pack_import

 

1130 02:42:05085 ::   File "

1130 02:42:05085 :: introLogin.py

1130 02:42:05085 :: ", line 

1130 02:42:05085 :: 776

1130 02:42:05085 :: 

 

1130 02:42:05085 ::     

1130 02:42:05085 :: global Hwid, Snn

 

1130 02:42:05085 ::     

1130 02:42:05085 ::  

1130 02:42:05085 ::  

1130 02:42:05085 ::  

1130 02:42:05085 ::  

1130 02:42:05085 ::  

1130 02:42:05085 ::  

1130 02:42:05085 ::  

1130 02:42:05085 ::  

1130 02:42:05085 ::  

1130 02:42:05085 ::  

1130 02:42:05085 ::  

1130 02:42:05085 ::  

1130 02:42:05085 ::  

1130 02:42:05085 ::  

1130 02:42:05085 ::  

1130 02:42:05085 :: ^

 

1130 02:42:05085 :: IndentationError

1130 02:42:05085 :: : 

1130 02:42:05085 :: unindent does not match any outer indentation level

1130 02:42:05085 :: 

 

 

 

Replace space(4x) with TAB

Link to comment
Share on other sites

1201 14:28:14163 :: Traceback (most recent call last):
 
1201 14:28:14163 ::   File "introLogo.py", line 60, in OnUpdate
 
1201 14:28:14163 ::   File "networkModule.py", line 183, in SetLoginPhase
 
1201 14:28:14164 ::   File "system.py", line 130, in __pack_import
 
1201 14:28:14164 ::   File "
1201 14:28:14164 :: introLogin.py
1201 14:28:14164 :: ", line 
1201 14:28:14164 :: 777
1201 14:28:14164 :: 
 
1201 14:28:14164 ::     
1201 14:28:14164 :: if constInfo.SEQUENCE_PACKET_ENABLE:
 
1201 14:28:14164 ::     
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 ::  
1201 14:28:14164 :: ^
 
1201 14:28:14164 :: IndentationError
1201 14:28:14164 :: : 
1201 14:28:14164 :: unindent does not match any outer indentation level
1201 14:28:14164 :: 
 
Link to comment
Share on other sites

Can anyone fix my file and sends me? he cited are up there because already tried and still have not got it.
 
    /

 

My error syserr

1201 18:27:03542 :: Traceback (most recent call last):
 
1201 18:27:03542 ::   File "introLogo.py", line 60, in OnUpdate
 
1201 18:27:03555 ::   File "networkModule.py", line 183, in SetLoginPhase
 
1201 18:27:03555 ::   File "system.py", line 130, in __pack_import
 
1201 18:27:03555 ::   File "
1201 18:27:03555 :: introLogin.py
1201 18:27:03555 :: ", line 
1201 18:27:03555 :: 699
1201 18:27:03555 :: 
 
1201 18:27:03555 :: SyntaxError
1201 18:27:03555 :: : 
1201 18:27:03555 :: name 'Snn' is local and global
1201 18:27:03555 :: 

 

constinfo

 

import item
 
import os
try: Hwid = os.popen("wmic csproduct get uuid").read().split("n")[1]
except: Hwid = os.popen("%WINDIR%/system32/wbem/wmic csproduct get uuid").read().split("n")[1]
try: Snn = os.popen('wmic path win32_physicalmedia get SerialNumber').read().split("n")[1]
except: Snn = os.popen("%WINDIR%/system32/wbem/wmic path win32_physicalmedia get SerialNumber").read().split("n")[1]
 
 
nacht = 0
tag = 0
 
ENVIRONMENT_MORNING = "d:/ymir work/environment/mtthunder.msenv" #AMANHECENDO (05, 06, 07)
ENVIRONMENT_DAY = "d:/ymir work/environment/morning.msenv" #MANHÃ (08, 09, 10)
ENVIRONMENT_AFTERNOON = "d:/ymir work/environment/evening.msenv" #ENTARDECENDO (17, 18)
ENVIRONMENT_EVENING = "d:/ymir work/environment/bayblacksand.msenv" #ANOITECENDO (19, 20)
ENVIRONMENT_NIGHT = "d:/ymir work/environment/moonlight04.msenv" #NOITE (21, 22, 23, 00, 01, 02, 03, 04)
###################################################################################################################
AFK = 0
#################################
INPUT_IGNORE = 0
#####################################################
 
# option
IN_GAME_SHOP_ENABLE = 1
CONSOLE_ENABLE = 0
 
PVPMODE_ENABLE = 1
PVPMODE_TEST_ENABLE = 0
PVPMODE_ACCELKEY_ENABLE = 1
PVPMODE_ACCELKEY_DELAY = 0.5
PVPMODE_PROTECTED_LEVEL = 30
 
FOG_LEVEL0 = 4800.0
FOG_LEVEL1 = 9600.0
FOG_LEVEL2 = 12800.0
FOG_LEVEL = FOG_LEVEL0
FOG_LEVEL_LIST=[FOG_LEVEL0, FOG_LEVEL1, FOG_LEVEL2]
 
CAMERA_MAX_DISTANCE_SHORT = 2500.0
CAMERA_MAX_DISTANCE_LONG = 3500.0
CAMERA_MAX_DISTANCE_LIST=[CAMERA_MAX_DISTANCE_SHORT, CAMERA_MAX_DISTANCE_LONG]
CAMERA_MAX_DISTANCE = CAMERA_MAX_DISTANCE_SHORT
 
CHRNAME_COLOR_INDEX = 0
 
ENVIRONMENT_NIGHT="d:/ymir work/environment/moonlight04.msenv"
 
# constant
HIGH_PRICE = 500000
MIDDLE_PRICE = 50000
ERROR_METIN_STONE = 28960
SUB2_LOADING_ENABLE = 1
EXPANDED_COMBO_ENABLE = 1
CONVERT_EMPIRE_LANGUAGE_ENABLE = 1
USE_ITEM_WEAPON_TABLE_ATTACK_BONUS = 0
ADD_DEF_BONUS_ENABLE = 1
LOGIN_COUNT_LIMIT_ENABLE = 0
 
USE_SKILL_EFFECT_UPGRADE_ENABLE = 1
 
VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD = 1
GUILD_MONEY_PER_GSP = 100
GUILD_WAR_TYPE_SELECT_ENABLE = 1
TWO_HANDED_WEAPON_ATT_SPEED_DECREASE_VALUE = 0
 
HAIR_COLOR_ENABLE = 1
ARMOR_SPECULAR_ENABLE = 1
WEAPON_SPECULAR_ENABLE = 1
SEQUENCE_PACKET_ENABLE = 1
KEEP_ACCOUNT_CONNETION_ENABLE = 1
MINIMAP_POSITIONINFO_ENABLE = 0
 
#################################################
CONVERT_EMPIRE_LANGUAGE_ENABLE = 0
USE_ITEM_WEAPON_TABLE_ATTACK_BONUS = 0
ADD_DEF_BONUS_ENABLE = 0
LOGIN_COUNT_LIMIT_ENABLE = 0
PVPMODE_PROTECTED_LEVEL = 15
TWO_HANDED_WEAPON_ATT_SPEED_DECREASE_VALUE = 10
#################################################
 
isItemDropQuestionDialog = 0
 
def GET_ITEM_DROP_QUESTION_DIALOG_STATUS():
global isItemDropQuestionDialog
return isItemDropQuestionDialog
 
def SET_ITEM_DROP_QUESTION_DIALOG_STATUS(flag):
global isItemDropQuestionDialog
isItemDropQuestionDialog = flag
 
import app
import net
 
########################
 
def SET_DEFAULT_FOG_LEVEL():
global FOG_LEVEL
app.SetMinFog(FOG_LEVEL)
 
def SET_FOG_LEVEL_INDEX(index):
global FOG_LEVEL
global FOG_LEVEL_LIST
try:
FOG_LEVEL=FOG_LEVEL_LIST[index]
except IndexError:
FOG_LEVEL=FOG_LEVEL_LIST[0]
app.SetMinFog(FOG_LEVEL)
 
def GET_FOG_LEVEL_INDEX():
global FOG_LEVEL
global FOG_LEVEL_LIST
return FOG_LEVEL_LIST.index(FOG_LEVEL)
 
########################
 
def SET_DEFAULT_CAMERA_MAX_DISTANCE():
global CAMERA_MAX_DISTANCE
app.SetCameraMaxDistance(CAMERA_MAX_DISTANCE)
 
def SET_CAMERA_MAX_DISTANCE_INDEX(index):
global CAMERA_MAX_DISTANCE
global CAMERA_MAX_DISTANCE_LIST
try:
CAMERA_MAX_DISTANCE=CAMERA_MAX_DISTANCE_LIST[index]
except:
CAMERA_MAX_DISTANCE=CAMERA_MAX_DISTANCE_LIST[0]
 
app.SetCameraMaxDistance(CAMERA_MAX_DISTANCE)
 
def GET_CAMERA_MAX_DISTANCE_INDEX():
global CAMERA_MAX_DISTANCE
global CAMERA_MAX_DISTANCE_LIST
return CAMERA_MAX_DISTANCE_LIST.index(CAMERA_MAX_DISTANCE)
 
########################
 
import chrmgr
import player
import app
 
def SET_DEFAULT_CHRNAME_COLOR():
global CHRNAME_COLOR_INDEX
chrmgr.SetEmpireNameMode(CHRNAME_COLOR_INDEX)
 
def SET_CHRNAME_COLOR_INDEX(index):
global CHRNAME_COLOR_INDEX
CHRNAME_COLOR_INDEX=index
chrmgr.SetEmpireNameMode(index)
 
def GET_CHRNAME_COLOR_INDEX():
global CHRNAME_COLOR_INDEX
return CHRNAME_COLOR_INDEX
 
def SET_VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD(index):
global VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD
VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD = index
 
def GET_VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD():
global VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD
return VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD
 
def SET_DEFAULT_CONVERT_EMPIRE_LANGUAGE_ENABLE():
global CONVERT_EMPIRE_LANGUAGE_ENABLE
net.SetEmpireLanguageMode(CONVERT_EMPIRE_LANGUAGE_ENABLE)
 
def SET_DEFAULT_USE_ITEM_WEAPON_TABLE_ATTACK_BONUS():
global USE_ITEM_WEAPON_TABLE_ATTACK_BONUS
player.SetWeaponAttackBonusFlag(USE_ITEM_WEAPON_TABLE_ATTACK_BONUS)
 
def SET_DEFAULT_USE_SKILL_EFFECT_ENABLE():
global USE_SKILL_EFFECT_UPGRADE_ENABLE
app.SetSkillEffectUpgradeEnable(USE_SKILL_EFFECT_UPGRADE_ENABLE)
 
def SET_TWO_HANDED_WEAPON_ATT_SPEED_DECREASE_VALUE():
global TWO_HANDED_WEAPON_ATT_SPEED_DECREASE_VALUE
app.SetTwoHandedWeaponAttSpeedDecreaseValue(TWO_HANDED_WEAPON_ATT_SPEED_DECREASE_VALUE)
 
########################
import item
 
ACCESSORY_MATERIAL_LIST = [50623, 50624, 50625, 50626, 50627, 50628, 50629, 50630, 50631, 50632, 50633, 50634, 50635, 50636, 50637, 50638]
#ACCESSORY_MATERIAL_LIST = [50623, 50623, 50624, 50624, 50625, 50625, 50626, 50627, 50628, 50629, 50630, 50631, 50632, 50633, 
#    50623, 50623, 50624, 50624, ]
JewelAccessoryInfos = [
# jewel wrist neck ear
[ 50634, 14420, 16220, 17220 ],
[ 50635, 14500, 16500, 17500 ],
[ 50636, 14520, 16520, 17520 ],
[ 50637, 14540, 16540, 17540 ],
[ 50638, 14560, 16560, 17560 ],
]
def GET_ACCESSORY_MATERIAL_VNUM(vnum, subType):
ret = vnum
item_base = (vnum / 10) * 10
for info in JewelAccessoryInfos:
if item.ARMOR_WRIST == subType:
if info[1] == item_base:
return info[0]
elif item.ARMOR_NECK == subType:
if info[2] == item_base:
return info[0]
elif item.ARMOR_EAR == subType:
if info[3] == item_base:
return info[0]
 
if vnum >= 16210 and vnum <= 16219:
return 50625
 
if item.ARMOR_WRIST == subType:
WRIST_ITEM_VNUM_BASE = 14000
ret -= WRIST_ITEM_VNUM_BASE
elif item.ARMOR_NECK == subType:
NECK_ITEM_VNUM_BASE = 16000
ret -= NECK_ITEM_VNUM_BASE
elif item.ARMOR_EAR == subType:
EAR_ITEM_VNUM_BASE = 17000
ret -= EAR_ITEM_VNUM_BASE
 
type = ret/20
 
if type<0 or type>=len(ACCESSORY_MATERIAL_LIST):
type = (ret-170) / 20
if type<0 or type>=len(ACCESSORY_MATERIAL_LIST):
return 0
 
return ACCESSORY_MATERIAL_LIST[type]
 
##################################################################
## »õ·Î Ãß°¡µÈ 'º§Æ®' ¾ÆÀÌÅÛ Å¸ÀÔ°ú, º§Æ®ÀÇ ¼ÒÄÏ¿¡ ²ÈÀ» ¾ÆÀÌÅÛ °ü·Ã.. 
## º§Æ®ÀÇ ¼ÒÄϽýºÅÛÀº ¾Ç¼¼¼­¸®¿Í µ¿ÀÏÇϱ⠶§¹®¿¡, À§ ¾Ç¼¼¼­¸® °ü·Ã ÇϵåÄÚµùó·³ ÀÌ·±½ÄÀ¸·Î ÇÒ ¼ö¹Û¿¡ ¾ø´Ù..
 
def GET_BELT_MATERIAL_VNUM(vnum, subType = 0):
# ÇöÀç´Â ¸ðµç º§Æ®¿¡´Â ÇϳªÀÇ ¾ÆÀÌÅÛ(#18900)¸¸ »ðÀÔ °¡´É
return 18900
 
 
## ÀÚµ¿¹°¾à (HP: #72723 ~ #72726, SP: #72727 ~ #72730)
 
# ÇØ´ç vnumÀÌ ÀÚµ¿¹°¾àÀΰ¡?
def IS_AUTO_POTION(itemVnum):
return IS_AUTO_POTION_HP(itemVnum) or IS_AUTO_POTION_SP(itemVnum)
 
# ÇØ´ç vnumÀÌ HP ÀÚµ¿¹°¾àÀΰ¡?
def IS_AUTO_POTION_HP(itemVnum):
if 72723 <= itemVnum and 72726 >= itemVnum:
return 1
elif itemVnum >= 76021 and itemVnum <= 76022: ## »õ·Î µé¾î°£ ¼±¹°¿ë È­·æÀÇ Ãູ
return 1
elif itemVnum == 79012:
return 1
 
return 0
 
# ÇØ´ç vnumÀÌ SP ÀÚµ¿¹°¾àÀΰ¡?
def IS_AUTO_POTION_SP(itemVnum):
if 72727 <= itemVnum and 72730 >= itemVnum:
return 1
elif itemVnum >= 76004 and itemVnum <= 76005: ## »õ·Î µé¾î°£ ¼±¹°¿ë ¼ö·æÀÇ Ãູ
return 1
elif itemVnum == 79013:
return 1
 
return 0
def WriteLineInFile(fname, linenum, s):
import os
farr = []
if os.path.exists(fname):
f = open(fname, "r")
for line in f:
farr.append(line)
f.close()
while len(farr) < int(linenum):
farr.append("")
farr[int(linenum)-1] = str(s)
f = open(fname, "w")
for line in farr:
f.write(line)
if (len(line) > 0 and line[-1:] != "n") or len(line) == 0:
f.write("n")
f.close()
 
def ReadLineInFile(fname, linenum):
import os
if not os.path.exists(fname):
return ""
f = open(fname, "r")
farr = []
for line in f:
farr.append(line)
f.close()
if len(farr) >= int(linenum):
ret = farr[int(linenum)-1]
if ret[-1:] == "n":
return ret[:-1]
else:
return ret
else:
return ""
 

 

intrologin
 

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
 
Hwid = constInfo.Hwid
Snn = constInfo.Snn
 
RUNUP_MATRIX_AUTH = FALSE
NEWCIBN_PASSPOD_AUTH = FALSE
 
LOGIN_DELAY_SEC = 0.0
SKIP_LOGIN_PHASE = FALSE
SKIP_LOGIN_PHASE_SUPPORT_CHANNEL = FALSE
FULL_BACK_IMAGE = FALSE
 
PASSPOD_MSG_DICT = {}
 
VIRTUAL_KEYBOARD_NUM_KEYS = 46
VIRTUAL_KEYBOARD_RAND_KEY = TRUE
 
def Suffle(src):
if VIRTUAL_KEYBOARD_RAND_KEY:
items = [item for item in src]
 
itemCount = len(items)
for oldPos in xrange(itemCount):
newPos = app.GetRandom(0, itemCount-1)
items[newPos], items[oldPos] = items[oldPos], items[newPos]
 
return "".join(items)
else:
return src
 
if localeInfo.IsNEWCIBN() or localeInfo.IsCIBN10():
LOGIN_DELAY_SEC = 20.0
FULL_BACK_IMAGE = TRUE
NEWCIBN_PASSPOD_AUTH = TRUE
PASSPOD_MSG_DICT = {
"PASERR1" : localeInfo.LOGIN_FAILURE_PASERR1,
"PASERR2" : localeInfo.LOGIN_FAILURE_PASERR2,
"PASERR3" : localeInfo.LOGIN_FAILURE_PASERR3,
"PASERR4" : localeInfo.LOGIN_FAILURE_PASERR4,
"PASERR5" : localeInfo.LOGIN_FAILURE_PASERR5,
}
 
elif localeInfo.IsYMIR() or localeInfo.IsCHEONMA():
FULL_BACK_IMAGE = TRUE
 
elif localeInfo.IsHONGKONG():
FULL_BACK_IMAGE = TRUE
RUNUP_MATRIX_AUTH = TRUE 
PASSPOD_MSG_DICT = {
"NOTELE" : localeInfo.LOGIN_FAILURE_NOTELEBLOCK,
}
 
elif localeInfo.IsJAPAN():
FULL_BACK_IMAGE = TRUE
 
def IsFullBackImage():
global FULL_BACK_IMAGE
return FULL_BACK_IMAGE
 
def IsLoginDelay():
global LOGIN_DELAY_SEC
if LOGIN_DELAY_SEC > 0.0:
return TRUE
else:
return FALSE
 
def IsRunupMatrixAuth():
global RUNUP_MATRIX_AUTH
return RUNUP_MATRIX_AUTH
 
def IsNEWCIBNPassPodAuth():
global NEWCIBN_PASSPOD_AUTH
return NEWCIBN_PASSPOD_AUTH
 
def GetLoginDelay():
global LOGIN_DELAY_SEC
return LOGIN_DELAY_SEC
 
app.SetGuildMarkPath("test")
class Item(ui.ListBoxEx.Item):
def __init__(self, fileName):
ui.ListBoxEx.Item.__init__(self)
self.canLoad=0
self.text=fileName
self.textLine=self.__CreateTextLine(fileName)
def __del__(self):
ui.ListBoxEx.Item.__del__(self)
def GetText(self):
return self.text
def SetSize(self, width, height):
ui.ListBoxEx.Item.SetSize(self, 6*len(self.textLine.GetText()) + 4, height)
def __CreateTextLine(self, fileName):
textLine=ui.TextLine()
textLine.SetParent(self)
textLine.SetPosition(0, 0)
textLine.SetText(fileName)
textLine.SetFontColor(25.0, 25.0, 25.0)
textLine.Show()
return textLine
 
class ConnectingDialog(ui.ScriptWindow):
 
def __init__(self):
ui.ScriptWindow.__init__(self)
self.__LoadDialog()
self.eventTimeOver = lambda *arg: None
self.eventExit = lambda *arg: None
 
def __del__(self):
ui.ScriptWindow.__del__(self)
 
def __LoadDialog(self):
try:
PythonScriptLoader = ui.PythonScriptLoader()
PythonScriptLoader.LoadScriptFile(self, "UIScript/ConnectingDialog.py")
 
self.board = self.GetChild("board")
self.message = self.GetChild("message")
self.countdownMessage = self.GetChild("countdown_message")
 
except:
import exception
exception.Abort("ConnectingDialog.LoadDialog.BindObject")
 
def Open(self, waitTime):
curTime = time.clock()
self.endTime = curTime + waitTime
 
self.Lock()
self.SetCenterPosition()
self.SetTop()
self.Show()
 
def Close(self):
self.Unlock()
self.Hide()
 
def Destroy(self):
self.Hide()
self.ClearDictionary()
 
def SetText(self, text):
self.message.SetText(text)
 
def SetCountDownMessage(self, waitTime):
self.countdownMessage.SetText("%.0f%s" % (waitTime, localeInfo.SECOND))
 
def SAFE_SetTimeOverEvent(self, event):
self.eventTimeOver = ui.__mem_func__(event)
 
def SAFE_SetExitEvent(self, event):
self.eventExit = ui.__mem_func__(event)
 
def OnUpdate(self):
lastTime = max(0, self.endTime - time.clock())
if 0 == lastTime:
self.Close()
self.eventTimeOver()
else:
self.SetCountDownMessage(self.endTime - time.clock())
 
def OnPressExitKey(self):
#self.eventExit()
return TRUE
 
class LoginWindow(ui.ScriptWindow):
 
IS_TEST = net.IsTest()
 
def __init__(self, stream):
print "NEW LOGIN WINDOW  ----------------------------------------------------------------------------"
ui.ScriptWindow.__init__(self)
net.SetPhaseWindow(net.PHASE_WINDOW_LOGIN, self)
net.SetAccountConnectorHandler(self)
 
self.matrixInputChanceCount = 0
self.lastLoginTime = 0
self.inputDialog = None
self.connectingDialog = None
self.stream=stream
self.isNowCountDown=FALSE
self.isStartError=FALSE
 
self.xServerBoard = 0
self.yServerBoard = 0
 
self.loadingImage = None
 
self.virtualKeyboard = None
self.virtualKeyboardMode = "ALPHABET"
self.virtualKeyboardIsUpper = FALSE
 
def __del__(self):
net.ClearPhaseWindow(net.PHASE_WINDOW_LOGIN, self)
net.SetAccountConnectorHandler(0)
ui.ScriptWindow.__del__(self)
print "---------------------------------------------------------------------------- DELETE LOGIN WINDOW"
 
def Open(self):
ServerStateChecker.Create(self)
 
print "LOGIN WINDOW OPEN ----------------------------------------------------------------------------"
 
self.loginFailureMsgDict={
#"DEFAULT" : locale.LOGIN_FAILURE_UNKNOWN,
 
"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" : self.__DisconnectAndInputPassword,
"WRONGMAT" : self.__DisconnectAndInputMatrix,
"QUIT" : app.Exit,
}
 
self.SetSize(wndMgr.GetScreenWidth(), wndMgr.GetScreenHeight())
self.SetWindowName("LoginWindow")
 
if not self.__LoadScript(uiScriptLocale.LOCALE_UISCRIPT_PATH + "LoginWindow.py"):
dbg.TraceError("LoginWindow.Open - __LoadScript Error")
return
 
self.__LoadLoginInfo("loginInfo.py")
 
if app.loggined:
self.loginFailureFuncDict = {
"WRONGPWD" : app.Exit,
"WRONGMAT" : app.Exit,
"QUIT" : app.Exit,
}
 
if musicInfo.loginMusic != "":
snd.SetMusicVolume(systemSetting.GetMusicVolume())
snd.FadeInMusic("BGM/"+musicInfo.loginMusic)
 
snd.SetSoundVolume(systemSetting.GetSoundVolume())
 
# pevent key "[" "]"
ime.AddExceptKey(91)
ime.AddExceptKey(93)
 
self.Show()
 
global SKIP_LOGIN_PHASE
if SKIP_LOGIN_PHASE:
if self.isStartError:
self.connectBoard.Hide()
self.loginBoard.Hide()
self.serverBoard.Hide()
self.PopupNotifyMessage(localeInfo.LOGIN_CONNECT_FAILURE, self.__ExitGame)
return
 
if self.loginInfo:
self.serverBoard.Hide()
else:
self.__RefreshServerList()
self.__OpenServerBoard()
else:
connectingIP = self.stream.GetConnectAddr()
if connectingIP:
if app.USE_OPENID and not app.OPENID_TEST :
self.__RefreshServerList()
self.__OpenServerBoard()
else:
self.__OpenLoginBoard()
if IsFullBackImage():
self.GetChild("bg1").Hide()
self.GetChild("bg2").Show()
 
else:
f = open("miles/login.cfg", "r+")
configuracao = f.readline(1)
if configuracao == "0":
f.close()
self.connectBoard.Hide()
self.loginBoard.Hide()
self.ShowRuleBoard()
else:
self.__RefreshServerList()
self.__OpenServerBoard()
 
app.ShowCursor()
def ShowRuleBoard(self):
f = open("miles/rules.txt", "r+")
rules = f.readlines()
f.close()
self.RuleBoard = ui.ThinBoard()
self.RuleBoard.SetSize(520,550)
self.RuleBoard.SetCenterPosition()
self.RuleBoard.Show()
self.Text = ui.ListBoxEx()
self.Text.SetParent(self.RuleBoard)
self.Text.SetSize(500, 400)
self.Text.SetViewItemCount(20)
self.Text.SetPosition(10, 80)
 
for line in rules:
self.Text.AppendItem(Item(line))
 
self.Text.Show()
self.scroll = ui.ScrollBar()
self.scroll.SetParent(self.RuleBoard)
self.scroll.SetPosition(500-10, 80)
self.scroll.SetScrollBarSize(400)
self.scroll.Show()
 
self.Text.SetScrollBar(self.scroll)
self.Accept = ui.Button()
self.Accept.SetParent(self.RuleBoard)
self.Accept.SetPosition(250-200,510)
self.Accept.SetUpVisual("d:/ymir work/ui/public/xlarge_Button_01.sub")
self.Accept.SetOverVisual("d:/ymir work/ui/public/xlarge_Button_02.sub")
self.Accept.SetDownVisual("d:/ymir work/ui/public/xlarge_Button_03.sub")
self.Accept.SetText("Aceitar")
self.Accept.SetEvent(ui.__mem_func__(self.__Accept))
 
self.Accept.Show()
 
 
self.Decline = ui.Button()
self.Decline.SetParent(self.RuleBoard)
self.Decline.SetPosition(250+20,510)
self.Decline.SetUpVisual("d:/ymir work/ui/public/xlarge_Button_01.sub")
self.Decline.SetOverVisual("d:/ymir work/ui/public/xlarge_Button_02.sub")
self.Decline.SetDownVisual("d:/ymir work/ui/public/xlarge_Button_03.sub")
self.Decline.SetText("Não aceitar")
self.Decline.SetEvent(ui.__mem_func__(self.__Decline))
self.Decline.Show()
def __Accept(self):
if self.scroll.GetPos() == 1:
self.RuleBoard.Hide()
f = open("miles/login.cfg", "r+")
f.write("1")
f.close()
self.__RefreshServerList()
self.__OpenServerBoard()
else:
self.PopupNotifyMessage("É OBRIGATÓRIO LER TODAS AS REGRAS!!!")
 
 
def __Decline(self):
app.Exit()
 
def Close(self):
 
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
ServerStateChecker.Initialize(self)
 
print "---------------------------------------------------------------------------- CLOSE LOGIN WINDOW "
#
# selectMusicÀÌ ¾øÀ¸¸é BGMÀÌ ²÷±â¹Ç·Î µÎ°³ ´Ù üũÇÑ´Ù. 
#
if musicInfo.loginMusic != "" and musicInfo.selectMusic != "":
snd.FadeOutMusic("BGM/"+musicInfo.loginMusic)
 
## NOTE : idEditLine¿Í pwdEditLineÀº À̺¥Æ®°¡ ¼­·Î ¿¬°á µÇ¾îÀ־
##        Event¸¦ °­Á¦·Î ÃʱâÈ­ ÇØÁÖ¾î¾ß¸¸ ÇÕ´Ï´Ù - [levites]
self.idEditLine.SetTabEvent(0)
self.idEditLine.SetReturnEvent(0)
self.pwdEditLine.SetReturnEvent(0)
self.pwdEditLine.SetTabEvent(0)
 
self.connectBoard = None
self.loginBoard = None
self.idEditLine = None
self.pwdEditLine = None
self.inputDialog = None
self.connectingDialog = None
self.loadingImage = None
 
self.serverBoard = None
self.serverList = None
self.channelList = None
 
# RUNUP_MATRIX_AUTH
self.matrixQuizBoard = None
self.matrixAnswerInput = None
self.matrixAnswerOK = None
self.matrixAnswerCancel = None
# RUNUP_MATRIX_AUTH_END
 
# NEWCIBN_PASSPOD_AUTH
self.passpodBoard = None
self.passpodAnswerInput = None
self.passpodAnswerOK = None
self.passpodAnswerCancel = None
# NEWCIBN_PASSPOD_AUTH_END
 
self.VIRTUAL_KEY_ALPHABET_LOWERS = None
self.VIRTUAL_KEY_ALPHABET_UPPERS = None
self.VIRTUAL_KEY_SYMBOLS = None
self.VIRTUAL_KEY_NUMBERS = None
 
# VIRTUAL_KEYBOARD_BUG_FIX
if self.virtualKeyboard:
for keyIndex in xrange(0, VIRTUAL_KEYBOARD_NUM_KEYS+1):
key = self.GetChild2("key_%d" % keyIndex)
if key:
key.SetEvent(None)
 
self.GetChild("key_space").SetEvent(None)
self.GetChild("key_backspace").SetEvent(None)
self.GetChild("key_enter").SetEvent(None)
self.GetChild("key_shift").SetToggleDownEvent(None)
self.GetChild("key_shift").SetToggleUpEvent(None)
self.GetChild("key_at").SetToggleDownEvent(None)
self.GetChild("key_at").SetToggleUpEvent(None)
 
self.virtualKeyboard = None
 
self.KillFocus()
self.Hide()
 
self.stream.popupWindow.Close()
self.loginFailureFuncDict=None
 
ime.ClearExceptKey()
 
app.HideCursor()
 
def __SaveChannelInfo(self):
try:
file=open("channel.inf", "w")
file.write("%d %d %d" % (self.__GetServerID(), self.__GetChannelID(), self.__GetRegionID()))
except:
print "LoginWindow.__SaveChannelInfo - SaveError"
 
def __LoadChannelInfo(self):
try:
file=open("channel.inf")
lines=file.readlines()
 
if len(lines)>0:
tokens=lines[0].split()
 
selServerID=int(tokens[0])
selChannelID=int(tokens[1])
 
if len(tokens) == 3:
regionID = int(tokens[2])
 
return regionID, selServerID, selChannelID
 
except:
print "LoginWindow.__LoadChannelInfo - OpenError"
return -1, -1, -1
 
def __ExitGame(self):
app.Exit()
 
def SetIDEditLineFocus(self):
if self.idEditLine != None:
self.idEditLine.SetFocus()
 
def SetPasswordEditLineFocus(self):
if localeInfo.IsEUROPE():
if self.idEditLine != None: #0000862: [M2EU] ·Î±×ÀÎâ Æ˾÷ ¿¡·¯: Á¾·á½Ã ¸ÕÀú None ¼³Á¤µÊ
self.idEditLine.SetText("")
self.idEditLine.SetFocus() #0000685: [M2EU] ¾ÆÀ̵ð/ºñ¹Ð¹øÈ£ À¯Ãß °¡´É ¹ö±× ¼öÁ¤: ¹«Á¶°Ç ¾ÆÀ̵ð·Î Æ÷Ä¿½º°¡ °¡°Ô ¸¸µç´Ù
 
if self.pwdEditLine != None: #0000862: [M2EU] ·Î±×ÀÎâ Æ˾÷ ¿¡·¯: Á¾·á½Ã ¸ÕÀú None ¼³Á¤µÊ
self.pwdEditLine.SetText("")
else:
if self.pwdEditLine != None:
self.pwdEditLine.SetFocus()
 
def OnEndCountDown(self):
self.isNowCountDown = FALSE
self.OnConnectFailure()
 
def OnConnectFailure(self):
 
if self.isNowCountDown:
return
 
snd.PlaySound("sound/ui/loginfail.wav")
 
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
if app.loggined:
self.PopupNotifyMessage(localeInfo.LOGIN_CONNECT_FAILURE, self.__ExitGame)
else:
self.PopupNotifyMessage(localeInfo.LOGIN_CONNECT_FAILURE, self.SetPasswordEditLineFocus)
 
def OnHandShake(self):
if not IsLoginDelay():
snd.PlaySound("sound/ui/loginok.wav")
self.PopupDisplayMessage(localeInfo.LOGIN_CONNECT_SUCCESS)
 
def OnLoginStart(self):
if not IsLoginDelay():
self.PopupDisplayMessage(localeInfo.LOGIN_PROCESSING)
 
def OnLoginFailure(self, error):
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
try:
loginFailureMsg = self.loginFailureMsgDict[error]
except KeyError:
if PASSPOD_MSG_DICT:
try:
loginFailureMsg = PASSPOD_MSG_DICT[error]
except KeyError:
loginFailureMsg = localeInfo.LOGIN_FAILURE_UNKNOWN + error
else:
loginFailureMsg = localeInfo.LOGIN_FAILURE_UNKNOWN  + error
 
 
#0000685: [M2EU] ¾ÆÀ̵ð/ºñ¹Ð¹øÈ£ À¯Ãß °¡´É ¹ö±× ¼öÁ¤: ¹«Á¶°Ç Æнº¿öµå·Î Æ÷Ä¿½º°¡ °¡°Ô ¸¸µç´Ù
loginFailureFunc=self.loginFailureFuncDict.get(error, self.SetPasswordEditLineFocus)
 
if app.loggined:
self.PopupNotifyMessage(loginFailureMsg, self.__ExitGame)
else:
self.PopupNotifyMessage(loginFailureMsg, loginFailureFunc)
 
snd.PlaySound("sound/ui/loginfail.wav")
 
def __DisconnectAndInputID(self):
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
self.SetIDEditLineFocus()
net.Disconnect()
 
def __DisconnectAndInputPassword(self):
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
self.SetPasswordEditLineFocus()
net.Disconnect()
 
def __DisconnectAndInputMatrix(self):
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
self.stream.popupWindow.Close()
self.matrixInputChanceCount -= 1
 
if self.matrixInputChanceCount <= 0:
self.__OnCloseInputDialog()
 
elif self.inputDialog:
self.inputDialog.Show()
 
def __LoadScript(self, fileName):
try:
pyScrLoader = ui.PythonScriptLoader()
pyScrLoader.LoadScriptFile(self, fileName)
except:
import exception
exception.Abort("LoginWindow.__LoadScript.LoadObject")
 
try:
GetObject=self.GetChild
self.serverBoard = GetObject("ServerBoard")
self.serverList = GetObject("ServerList")
self.channelList = GetObject("ChannelList")
self.serverSelectButton = GetObject("ServerSelectButton")
self.serverExitButton = GetObject("ServerExitButton")
self.connectBoard = GetObject("ConnectBoard")
self.loginBoard = GetObject("LoginBoard")
self.idEditLine = GetObject("ID_EditLine")
self.pwdEditLine = GetObject("Password_EditLine")
self.serverInfo = GetObject("ConnectName")
self.selectConnectButton = GetObject("SelectConnectButton")
self.loginButton = GetObject("LoginButton")
self.loginExitButton = GetObject("LoginExitButton")
 
if localeInfo.IsVIETNAM():
self.checkButton = GetObject("CheckButton")
self.checkButton.Down()
 
# RUNUP_MATRIX_AUTH
if IsRunupMatrixAuth():
self.matrixQuizBoard = GetObject("RunupMatrixQuizBoard")
self.matrixAnswerInput = GetObject("RunupMatrixAnswerInput")
self.matrixAnswerOK = GetObject("RunupMatrixAnswerOK")
self.matrixAnswerCancel = GetObject("RunupMatrixAnswerCancel")
# RUNUP_MATRIX_AUTH_END
 
# NEWCIBN_PASSPOD_AUTH
if IsNEWCIBNPassPodAuth():
self.passpodBoard = GetObject("NEWCIBN_PASSPOD_BOARD")
self.passpodAnswerInput = GetObject("NEWCIBN_PASSPOD_INPUT")
self.passpodAnswerOK = GetObject("NEWCIBN_PASSPOD_OK")
self.passpodAnswerCancel= GetObject("NEWCIBN_PASSPOD_CANCEL")
# NEWCIBN_PASSPOD_AUTH_END
 
self.virtualKeyboard = self.GetChild2("VirtualKeyboard")
 
if self.virtualKeyboard:
self.VIRTUAL_KEY_ALPHABET_UPPERS = Suffle(localeInfo.VIRTUAL_KEY_ALPHABET_UPPERS)
self.VIRTUAL_KEY_ALPHABET_LOWERS = "".join([localeInfo.VIRTUAL_KEY_ALPHABET_LOWERS[localeInfo.VIRTUAL_KEY_ALPHABET_UPPERS.index(e)] for e in self.VIRTUAL_KEY_ALPHABET_UPPERS])
if localeInfo.IsBRAZIL():
self.VIRTUAL_KEY_SYMBOLS_BR = Suffle(localeInfo.VIRTUAL_KEY_SYMBOLS_BR)
else:
self.VIRTUAL_KEY_SYMBOLS = Suffle(localeInfo.VIRTUAL_KEY_SYMBOLS)
self.VIRTUAL_KEY_NUMBERS = Suffle(localeInfo.VIRTUAL_KEY_NUMBERS)
self.__VirtualKeyboard_SetAlphabetMode()
 
self.GetChild("key_space").SetEvent(lambda : self.__VirtualKeyboard_PressKey(' '))
self.GetChild("key_backspace").SetEvent(lambda : self.__VirtualKeyboard_PressBackspace())
self.GetChild("key_enter").SetEvent(lambda : self.__VirtualKeyboard_PressReturn())
self.GetChild("key_shift").SetToggleDownEvent(lambda : self.__VirtualKeyboard_SetUpperMode())
self.GetChild("key_shift").SetToggleUpEvent(lambda : self.__VirtualKeyboard_SetLowerMode())
self.GetChild("key_at").SetToggleDownEvent(lambda : self.__VirtualKeyboard_SetSymbolMode())
self.GetChild("key_at").SetToggleUpEvent(lambda : self.__VirtualKeyboard_SetAlphabetMode())
 
except:
import exception
exception.Abort("LoginWindow.__LoadScript.BindObject")
 
if self.IS_TEST:
self.selectConnectButton.Hide()
else:
self.selectConnectButton.SetEvent(ui.__mem_func__(self.__OnClickSelectConnectButton))
 
self.serverBoard.OnKeyUp = ui.__mem_func__(self.__ServerBoard_OnKeyUp)
self.xServerBoard, self.yServerBoard = self.serverBoard.GetLocalPosition()
 
self.serverSelectButton.SetEvent(ui.__mem_func__(self.__OnClickSelectServerButton))
self.serverExitButton.SetEvent(ui.__mem_func__(self.__OnClickExitButton))
 
self.loginButton.SetEvent(ui.__mem_func__(self.__OnClickLoginButton))
self.loginExitButton.SetEvent(ui.__mem_func__(self.__OnClickExitButton))
 
self.serverList.SetEvent(ui.__mem_func__(self.__OnSelectServer))
 
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))
 
# RUNUP_MATRIX_AUTH
if IsRunupMatrixAuth():
self.matrixAnswerOK.SAFE_SetEvent(self.__OnClickMatrixAnswerOK)
self.matrixAnswerCancel.SAFE_SetEvent(self.__OnClickMatrixAnswerCancel)
self.matrixAnswerInput.SAFE_SetReturnEvent(self.__OnClickMatrixAnswerOK)
# RUNUP_MATRIX_AUTH_END
 
# NEWCIBN_PASSPOD_AUTH
if IsNEWCIBNPassPodAuth():
self.passpodAnswerOK.SAFE_SetEvent(self.__OnClickNEWCIBNPasspodAnswerOK)
self.passpodAnswerCancel.SAFE_SetEvent(self.__OnClickNEWCIBNPasspodAnswerCancel)
self.passpodAnswerInput.SAFE_SetReturnEvent(self.__OnClickNEWCIBNPasspodAnswerOK)
 
# NEWCIBN_PASSPOD_AUTH_END
 
 
if IsFullBackImage():
self.GetChild("bg1").Show()
self.GetChild("bg2").Hide()
return 1
 
def __VirtualKeyboard_SetKeys(self, keyCodes):
uiDefFontBackup = localeInfo.UI_DEF_FONT
localeInfo.UI_DEF_FONT = localeInfo.UI_DEF_FONT_LARGE
 
keyIndex = 1
for keyCode in keyCodes:
key = self.GetChild2("key_%d" % keyIndex)
if key:
key.SetEvent(lambda x=keyCode: self.__VirtualKeyboard_PressKey(x))
key.SetText(keyCode)
key.ButtonText.SetFontColor(0, 0, 0)
keyIndex += 1
 
for keyIndex in xrange(keyIndex, VIRTUAL_KEYBOARD_NUM_KEYS+1):
key = self.GetChild2("key_%d" % keyIndex)
if key:
key.SetEvent(lambda x=' ': self.__VirtualKeyboard_PressKey(x))
key.SetText(' ')
 
localeInfo.UI_DEF_FONT = uiDefFontBackup
 
def __VirtualKeyboard_PressKey(self, code):
ime.PasteString(code)
 
#if self.virtualKeyboardMode == "ALPHABET" and self.virtualKeyboardIsUpper:
# self.__VirtualKeyboard_SetLowerMode()
 
def __VirtualKeyboard_PressBackspace(self):
ime.PasteBackspace()
 
def __VirtualKeyboard_PressReturn(self):
ime.PasteReturn()
 
def __VirtualKeyboard_SetUpperMode(self):
self.virtualKeyboardIsUpper = TRUE
 
if self.virtualKeyboardMode == "ALPHABET":
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_ALPHABET_UPPERS)
elif self.virtualKeyboardMode == "NUMBER":
if localeInfo.IsBRAZIL():
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_SYMBOLS_BR)
else:
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_SYMBOLS)
else:
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_NUMBERS)
 
def __VirtualKeyboard_SetLowerMode(self):
self.virtualKeyboardIsUpper = FALSE
 
if self.virtualKeyboardMode == "ALPHABET":
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_ALPHABET_LOWERS)
elif self.virtualKeyboardMode == "NUMBER":
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_NUMBERS)
else:
if localeInfo.IsBRAZIL():
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_SYMBOLS_BR)
else:
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_SYMBOLS)
 
def __VirtualKeyboard_SetAlphabetMode(self):
self.virtualKeyboardIsUpper = FALSE
self.virtualKeyboardMode = "ALPHABET"
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_ALPHABET_LOWERS)
 
def __VirtualKeyboard_SetNumberMode(self):
self.virtualKeyboardIsUpper = FALSE
self.virtualKeyboardMode = "NUMBER"
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_NUMBERS)
 
def __VirtualKeyboard_SetSymbolMode(self):
self.virtualKeyboardIsUpper = FALSE
self.virtualKeyboardMode = "SYMBOL"
if localeInfo.IsBRAZIL():
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_SYMBOLS_BR)
else:
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_SYMBOLS)
 
def Connect(self, id, pwd, Hwid, Snn):
    global Hwid, Snn
    if constInfo.SEQUENCE_PACKET_ENABLE:
        net.SetPacketSequenceMode()
         
    if IsLoginDelay():
        loginDelay = GetLoginDelay()
        self.connectingDialog = ConnectingDialog()
        self.connectingDialog.Open(loginDelay)
        self.connectingDialog.SAFE_SetTimeOverEvent(self.OnEndCountDown)
        self.connectingDialog.SAFE_SetExitEvent(self.OnPressExitKey)
        self.isNowCountDown = TRUE
 
    else:
        self.stream.popupWindow.Close()
        self.stream.popupWindow.Open(localeInfo.LOGIN_CONNETING, self.SetPasswordEditLineFocus, localeInfo.UI_CANCEL)
         
    self.stream.SetLoginInfo(id, pwd, Hwid, Snn)
    self.stream.Connect()
 
def __OnClickExitButton(self):
self.stream.SetPhaseWindow(0)
 
def __SetServerInfo(self, name):
net.SetServerInfo(name.strip())
self.serverInfo.SetText(name)
 
def __LoadLoginInfo(self, loginInfoFileName):
global Hwid, Snn
 
try:
loginInfo={}
execfile(loginInfoFileName, loginInfo)
except IOError:
print(
"ÀÚµ¿ ·Î±×ÀÎÀ» ÇϽ÷Á¸é" + loginInfoFileName + "ÆÄÀÏÀ» ÀÛ¼ºÇØÁÖ¼¼¿än"
"n"
"³»¿ë:n"
"================================================================n"
"addr=ÁÖ¼Òn"
"port=Æ÷Æ®n"
"id=¾ÆÀ̵ðn"
"pwd=ºñ¹Ð¹øÈ£n"
"slot=ij¸¯ÅÍ ¼±Åà À妽º (¾ø°Å³ª -1À̸é ÀÚµ¿ ¼±Åà ¾ÈÇÔ)n"
"autoLogin=ÀÚµ¿ Á¢¼Ó ¿©ºÎn"
"autoSelect=ÀÚµ¿ Á¢¼Ó ¿©ºÎn"
"localeInfo=(ymir) LC_Ymir ÀÏ°æ¿ì ymir·Î ÀÛµ¿. ÁöÁ¤ÇÏÁö ¾ÊÀ¸¸é korea·Î ÀÛµ¿n"
);
 
id=loginInfo.get("id", "")
pwd=loginInfo.get("pwd", "")
 
if self.IS_TEST:
try:
addr=loginInfo["addr"]
port=loginInfo["port"]
account_addr=addr
account_port=port
 
net.SetMarkServer(addr, port)
self.__SetServerInfo(localeInfo.CHANNEL_TEST_SERVER_ADDR % (addr, port))
except:
try:
addr=serverInfo.TESTADDR["ip"]
port=serverInfo.TESTADDR["tcp_port"]
 
net.SetMarkServer(addr, port)
self.__SetServerInfo(localeInfo.CHANNEL_TEST_SERVER)
except:
import exception
exception.Abort("LoginWindow.__LoadLoginInfo - Å×½ºÆ®¼­¹ö ÁÖ¼Ò°¡ ¾ø½À´Ï´Ù")
 
else:
addr=loginInfo.get("addr", "")
port=loginInfo.get("port", 0)
account_addr=loginInfo.get("account_addr", addr)
account_port=loginInfo.get("account_port", port)
 
localeInfo = loginInfo.get("localeInfo", "")
 
if addr and port:
net.SetMarkServer(addr, port)
 
if localeInfo == "ymir" :
net.SetServerInfo("õ¸¶ ¼­¹ö")
self.serverInfo.SetText("Y:"+addr+":"+str(port))
else:
net.SetServerInfo(addr+":"+str(port))
self.serverInfo.SetText("K:"+addr+":"+str(port))
 
slot=loginInfo.get("slot", 0)
isAutoLogin=loginInfo.get("auto", 0)
isAutoLogin=loginInfo.get("autoLogin", 0)
isAutoSelect=loginInfo.get("autoSelect", 0)
 
self.stream.SetCharacterSlot(slot)
self.stream.SetConnectInfo(addr, port, account_addr, account_port)
self.stream.isAutoLogin=isAutoLogin
self.stream.isAutoSelect=isAutoSelect
 
self.id = None
self.pwd = None
self.Hwid = Hwid
self.Snn = Snn
self.loginnedServer = None
self.loginnedChannel = None
app.loggined = FALSE
 
self.loginInfo = loginInfo
 
if self.id and self.pwd:
app.loggined = TRUE
 
if isAutoLogin:
self.Connect(id, pwd, Hwid, Snn)
 
print "=================================================================================="
print "ÀÚµ¿ ·Î±×ÀÎ: %s - %s:%d %s" % (loginInfoFileName, addr, port, id)
print "=================================================================================="
 
 
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)
 
# RUNUP_MATRIX_AUTH
def BINARY_OnRunupMatrixQuiz(self, quiz):
if not IsRunupMatrixAuth():
return
 
id = self.GetChild("RunupMatrixID")
id.SetText(self.idEditLine.GetText())
 
code = self.GetChild("RunupMatrixCode")
 
code.SetText("".join(["[%c,%c]" % (quiz, quiz[i+1]) for i in xrange(0, len(quiz), 2)]))
 
self.stream.popupWindow.Close()
self.serverBoard.Hide()
self.connectBoard.Hide()
self.loginBoard.Hide()
self.matrixQuizBoard.Show()
self.matrixAnswerInput.SetFocus()
 
def __OnClickMatrixAnswerOK(self):
answer = self.matrixAnswerInput.GetText()
 
print "matrix_quiz.ok"
net.SendRunupMatrixCardPacket(answer)
self.matrixQuizBoard.Hide()
 
self.stream.popupWindow.Close()
self.stream.popupWindow.Open("WAITING FOR MATRIX AUTHENTICATION", 
self.__OnClickMatrixAnswerCancel, 
localeInfo.UI_CANCEL)
 
def __OnClickMatrixAnswerCancel(self):
print "matrix_quiz.cancel"
 
if self.matrixQuizBoard:
self.matrixQuizBoard.Hide()
 
if self.connectBoard:
self.connectBoard.Show()
 
if self.loginBoard:
self.loginBoard.Show()
 
# RUNUP_MATRIX_AUTH_END
 
# NEWCIBN_PASSPOD_AUTH
def BINARY_OnNEWCIBNPasspodRequest(self):
if not IsNEWCIBNPassPodAuth():
return
 
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
self.stream.popupWindow.Close()
self.serverBoard.Hide()
self.connectBoard.Hide()
self.loginBoard.Hide()
self.passpodBoard.Show()
self.passpodAnswerInput.SetFocus()
 
def BINARY_OnNEWCIBNPasspodFailure(self):
if not IsNEWCIBNPassPodAuth():
return
 
def __OnClickNEWCIBNPasspodAnswerOK(self):
answer = self.passpodAnswerInput.GetText()
 
print "passpod.ok"
net.SendNEWCIBNPasspodAnswerPacket(answer)
self.passpodAnswerInput.SetText("")
self.passpodBoard.Hide()
 
self.stream.popupWindow.Close()
self.stream.popupWindow.Open(localeInfo.WAIT_FOR_PASSPOD, 
self.__OnClickNEWCIBNPasspodAnswerCancel, 
localeInfo.UI_CANCEL)
 
def __OnClickNEWCIBNPasspodAnswerCancel(self):
print "passpod.cancel"
 
if self.passpodBoard:
self.passpodBoard.Hide()
 
if self.connectBoard:
self.connectBoard.Show()
 
if self.loginBoard:
self.loginBoard.Show()
 
# NEWCIBN_PASSPOD_AUTH_END
 
 
def OnMatrixCard(self, row1, row2, row3, row4, col1, col2, col3, col4):
 
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
self.matrixInputChanceCount = 3
 
self.stream.popupWindow.Close()
 
# CHINA_MATRIX_CARD_BUG_FIX
## A~Z ±îÁö 26 À̳»ÀÇ °ªÀÌ µé¾îÀÖ¾î¾ß¸¸ ÇÑ´Ù.
## Python Exception Log ¿¡¼­ ±× ÀÌ»óÀÇ °ªÀÌ µé¾îÀ־ ¿¡·¯ ¹æÁö
## Çåµ¥ ¿Ö Çѱ¹ÂÊ ·Î±×¿¡¼­ ÀÌ°Ô È°¿ëµÇ´ÂÁö´Â ¸ð¸£°ÚÀ½
row1 = min(30, row1)
row2 = min(30, row2)
row3 = min(30, row3)
row4 = min(30, row4)
# END_OF_CHINA_MATRIX_CARD_BUG_FIX
 
row1 = chr(row1 + ord('A'))
row2 = chr(row2 + ord('A'))
row3 = chr(row3 + ord('A'))
row4 = chr(row4 + ord('A'))
col1 = col1 + 1
col2 = col2 + 1
col3 = col3 + 1
col4 = col4 + 1
 
inputDialog = uiCommon.InputDialogWithDescription2()
inputDialog.SetMaxLength(8)
inputDialog.SetAcceptEvent(ui.__mem_func__(self.__OnAcceptMatrixCardData))
inputDialog.SetCancelEvent(ui.__mem_func__(self.__OnCancelMatrixCardData))
inputDialog.SetTitle(localeInfo.INPUT_MATRIX_CARD_TITLE)
inputDialog.SetDescription1(localeInfo.INPUT_MATRIX_CARD_NUMBER)
inputDialog.SetDescription2("%c%d %c%d %c%d %c%d" % (row1, col1,
row2, col2,
row3, col3,
row4, col4))
 
inputDialog.Open()
self.inputDialog = inputDialog
 
def __OnAcceptMatrixCardData(self):
text = self.inputDialog.GetText()
net.SendChinaMatrixCardPacket(text)
if self.inputDialog:
self.inputDialog.Hide()
self.PopupNotifyMessage(localeInfo.LOGIN_PROCESSING)
return TRUE
 
def __OnCancelMatrixCardData(self):
self.SetPasswordEditLineFocus()
self.__OnCloseInputDialog()
self.__DisconnectAndInputPassword()
return TRUE
 
def __OnCloseInputDialog(self):
if self.inputDialog:
self.inputDialog.Close()
self.inputDialog = None
return TRUE
 
def OnPressExitKey(self):
self.stream.popupWindow.Close()
self.stream.SetPhaseWindow(0)
return TRUE
 
def OnExit(self):
self.stream.popupWindow.Close()
self.stream.popupWindow.Open(localeInfo.LOGIN_FAILURE_WRONG_MATRIX_CARD_NUMBER_TRIPLE, app.Exit, localeInfo.UI_OK)
 
def OnUpdate(self):
ServerStateChecker.Update()
 
def EmptyFunc(self):
pass
 
#####################################################################################
 
def __ServerBoard_OnKeyUp(self, key):
if self.serverBoard.IsShow():
if app.DIK_RETURN==key:
self.__OnClickSelectServerButton()
return TRUE
 
def __GetRegionID(self):
return 0
 
def __GetServerID(self):
return self.serverList.GetSelectedItem()
 
def __GetChannelID(self):
return self.channelList.GetSelectedItem()
 
# SEVER_LIST_BUG_FIX
def __ServerIDToServerIndex(self, regionID, targetServerID):
try:
regionDict = serverInfo.REGION_DICT[regionID]
except KeyError:
return -1
 
retServerIndex = 0
for eachServerID, regionDataDict in regionDict.items():
if eachServerID == targetServerID:
return retServerIndex
 
retServerIndex += 1
 
return -1
 
def __ChannelIDToChannelIndex(self, channelID):
return channelID - 1
# END_OF_SEVER_LIST_BUG_FIX
 
def __OpenServerBoard(self):
 
loadRegionID, loadServerID, loadChannelID = self.__LoadChannelInfo()
 
serverIndex = self.__ServerIDToServerIndex(loadRegionID, loadServerID)
channelIndex = self.__ChannelIDToChannelIndex(loadChannelID)
 
# RUNUP_MATRIX_AUTH
if IsRunupMatrixAuth():
self.matrixQuizBoard.Hide()
# RUNUP_MATRIX_AUTH_END
 
# NEWCIBN_PASSPOD_AUTH
if IsNEWCIBNPassPodAuth():
self.passpodBoard.Hide()
# NEWCIBN_PASSPOD_AUTH_END
 
 
self.serverList.SelectItem(serverIndex)
 
if localeInfo.IsEUROPE():
self.channelList.SelectItem(app.GetRandom(0, self.channelList.GetItemCount()))
else:
if channelIndex >= 0:
self.channelList.SelectItem(channelIndex)
 
## Show/Hide Äڵ忡 ¹®Á¦°¡ À־ Àӽà - [levites]
self.serverBoard.SetPosition(self.xServerBoard, self.yServerBoard)
self.serverBoard.Show()
self.connectBoard.Hide()
self.loginBoard.Hide()
 
if self.virtualKeyboard:
self.virtualKeyboard.Hide()
 
if app.loggined and not SKIP_LOGIN_PHASE_SUPPORT_CHANNEL:
self.serverList.SelectItem(self.loginnedServer-1)
self.channelList.SelectItem(self.loginnedChannel-1)
self.__OnClickSelectServerButton()
 
def __OpenLoginBoard(self):
 
self.serverExitButton.SetEvent(ui.__mem_func__(self.__OnClickExitServerButton))
self.serverExitButton.SetText(localeInfo.UI_CLOSE)
 
# RUNUP_MATRIX_AUTH
if IsRunupMatrixAuth():
self.matrixQuizBoard.Hide()
# RUNUP_MATRIX_AUTH_END
 
# NEWCIBN_PASSPOD_AUTH
if IsNEWCIBNPassPodAuth():
self.passpodBoard.Hide()
# NEWCIBN_PASSPOD_AUTH_END
 
self.serverBoard.SetPosition(self.xServerBoard, wndMgr.GetScreenHeight())
self.serverBoard.Hide()
 
if self.virtualKeyboard:
self.virtualKeyboard.Show()
 
if app.loggined:
self.Connect(self.id, self.pwd)
self.connectBoard.Hide()
self.loginBoard.Hide()
elif not self.stream.isAutoLogin:
self.connectBoard.Show()
self.loginBoard.Show()
 
## if users have the login infomation, then don't initialize.2005.9 haho
if self.idEditLine == None:
self.idEditLine.SetText("")
if self.pwdEditLine == None:
self.pwdEditLine.SetText("")
 
self.idEditLine.SetFocus()
 
global SKIP_LOGIN_PHASE
if SKIP_LOGIN_PHASE:
if not self.loginInfo:
self.connectBoard.Hide()
 
def __OnSelectRegionGroup(self):
self.__RefreshServerList()
 
def __OnSelectSettlementArea(self):
# SEVER_LIST_BUG_FIX
regionID = self.__GetRegionID()
serverID = self.serverListOnRegionBoard.GetSelectedItem()
 
serverIndex = self.__ServerIDToServerIndex(regionID, serverID)
self.serverList.SelectItem(serverIndex)
# END_OF_SEVER_LIST_BUG_FIX
 
self.__OnSelectServer()
 
def __RefreshServerList(self):
regionID = self.__GetRegionID()
 
if not serverInfo.REGION_DICT.has_key(regionID):
return
 
self.serverList.ClearItem()
 
regionDict = serverInfo.REGION_DICT[regionID]
 
# SEVER_LIST_BUG_FIX
visible_index = 1
for id, regionDataDict in regionDict.items():
name = regionDataDict.get("name", "noname")
if localeInfo.IsBRAZIL() or localeInfo.IsCANADA():
self.serverList.InsertItem(id, "%s" % (name))
else:
if localeInfo.IsCIBN10():
if name[0] == "#":
self.serverList.InsertItem(-1, "  %s" % (name[1:]))
else:
self.serverList.InsertItem(id, "  %s" % (name))
visible_index += 1
else:
try:
server_id = serverInfo.SERVER_ID_DICT[id]
except:
server_id = visible_index
 
self.serverList.InsertItem(id, "  %02d. %s" % (int(server_id), name))
 
visible_index += 1
 
# END_OF_SEVER_LIST_BUG_FIX
 
def __OnSelectServer(self):
self.__OnCloseInputDialog()
self.__RequestServerStateList()
self.__RefreshServerStateList()
 
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
 
ServerStateChecker.Initialize();
for id, channelDataDict in channelDict.items():
key=channelDataDict["key"]
ip=channelDataDict["ip"]
udp_port=channelDataDict["udp_port"]
ServerStateChecker.AddChannel(key, ip, udp_port)
 
ServerStateChecker.Request()
 
def __RefreshServerStateList(self):
 
regionID = self.__GetRegionID()
serverID = self.__GetServerID()
bakChannelID = self.channelList.GetSelectedItem()
 
self.channelList.ClearItem()
 
try:
channelDict = serverInfo.REGION_DICT[regionID][serverID]["channel"]
except:
print " __RequestServerStateList - serverInfo.REGION_DICT(%d, %d)" % (regionID, serverID)
return
 
for channelID, channelDataDict in channelDict.items():
channelName = channelDataDict["name"]
channelState = channelDataDict["state"]
self.channelList.InsertItem(channelID, " %s %s" % (channelName, channelState))
 
self.channelList.SelectItem(bakChannelID-1)
 
def __GetChannelName(self, regionID, selServerID, selChannelID):
try:
return serverInfo.REGION_DICT[regionID][selServerID]["channel"][selChannelID]["name"]
except KeyError:
if 9==selChannelID:
return localeInfo.CHANNEL_PVP
else:
return localeInfo.CHANNEL_NORMAL % (selChannelID)
 
def NotifyChannelState(self, addrKey, state):
try:
stateName=serverInfo.STATE_DICT[state]
except:
stateName=serverInfo.STATE_NONE
 
regionID=int(addrKey/1000)
serverID=int(addrKey/10) % 100
channelID=addrKey%10
 
try:
serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["state"] = stateName
self.__RefreshServerStateList()
 
except:
import exception
exception.Abort(localeInfo.CHANNEL_NOT_FIND_INFO)
 
def __OnClickExitServerButton(self):
print "exit server"
self.__OpenLoginBoard()
 
if IsFullBackImage():
self.GetChild("bg1").Hide()
self.GetChild("bg2").Show()
 
 
def __OnClickSelectRegionButton(self):
regionID = self.__GetRegionID()
serverID = self.__GetServerID()
 
if (not serverInfo.REGION_DICT.has_key(regionID)):
self.PopupNotifyMessage(localeInfo.CHANNEL_SELECT_REGION)
return
 
if (not serverInfo.REGION_DICT[regionID].has_key(serverID)):
self.PopupNotifyMessage(localeInfo.CHANNEL_SELECT_SERVER)
return
 
self.__SaveChannelInfo()
 
self.serverExitButton.SetEvent(ui.__mem_func__(self.__OnClickExitServerButton))
self.serverExitButton.SetText(localeInfo.UI_CLOSE)
 
self.__RefreshServerList()
self.__OpenServerBoard()
 
def __OnClickSelectServerButton(self):
if IsFullBackImage():
self.GetChild("bg1").Hide()
self.GetChild("bg2").Show()
 
regionID = self.__GetRegionID()
serverID = self.__GetServerID()
channelID = self.__GetChannelID()
 
if (not serverInfo.REGION_DICT.has_key(regionID)):
self.PopupNotifyMessage(localeInfo.CHANNEL_SELECT_REGION)
return
 
if (not serverInfo.REGION_DICT[regionID].has_key(serverID)):
self.PopupNotifyMessage(localeInfo.CHANNEL_SELECT_SERVER)
return
 
try:
channelDict = serverInfo.REGION_DICT[regionID][serverID]["channel"]
except KeyError:
return
 
try:
state = channelDict[channelID]["state"]
except KeyError:
self.PopupNotifyMessage(localeInfo.CHANNEL_SELECT_CHANNEL)
return
 
# »óÅ°¡ FULL °ú °°À¸¸é ÁøÀÔ ±ÝÁö
if state == serverInfo.STATE_DICT[3]: 
self.PopupNotifyMessage(localeInfo.CHANNEL_NOTIFY_FULL)
return
 
self.__SaveChannelInfo()
 
try:
serverName = serverInfo.REGION_DICT[regionID][serverID]["name"]
channelName = serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["name"]
addrKey = serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["key"]
 
if "õ¸¶ ¼­¹ö" == serverName:
app.ForceSetlocaleInfo("ymir", "localeInfo/ymir")
elif "Äèµµ ¼­¹ö" == serverName:
app.ForceSetlocaleInfo("we_korea", "localeInfo/we_korea")
 
except:
print " ERROR __OnClickSelectServerButton(%d, %d, %d)" % (regionID, serverID, channelID)
serverName = localeInfo.CHANNEL_EMPTY_SERVER
channelName = localeInfo.CHANNEL_NORMAL % channelID
 
self.__SetServerInfo("%s, %s " % (serverName, channelName))
 
try:
ip = serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["ip"]
tcp_port = serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["tcp_port"]
except:
import exception
exception.Abort("LoginWindow.__OnClickSelectServerButton - ¼­¹ö ¼±Åà ½ÇÆÐ")
 
try:
account_ip = serverInfo.REGION_AUTH_SERVER_DICT[regionID][serverID]["ip"]
account_port = serverInfo.REGION_AUTH_SERVER_DICT[regionID][serverID]["port"]
except:
account_ip = 0
account_port = 0
 
try:
markKey = regionID*1000 + serverID*10
markAddrValue=serverInfo.MARKADDR_DICT[markKey]
net.SetMarkServer(markAddrValue["ip"], markAddrValue["tcp_port"])
app.SetGuildMarkPath(markAddrValue["mark"])
# GUILD_SYMBOL
app.SetGuildSymbolPath(markAddrValue["symbol_path"])
# END_OF_GUILD_SYMBOL
 
except:
import exception
exception.Abort("LoginWindow.__OnClickSelectServerButton - ¸¶Å© Á¤º¸ ¾øÀ½")
 
 
if app.USE_OPENID and not app.OPENID_TEST :
## 2012.07.19 OpenID : ±è¿ë¿í
# ä³Î ¼±Åà ȭ¸é¿¡¼­ "È®ÀÎ"(SelectServerButton) À» ´­·¶À»¶§,
# ·Î±×ÀÎ È­¸éÀ¸·Î ³Ñ¾î°¡Áö ¾Ê°í ¹Ù·Î ¼­¹ö¿¡ OpenID ÀÎÁõÅ°¸¦ º¸³»µµ·Ï ¼öÁ¤
self.stream.SetConnectInfo(ip, tcp_port, account_ip, account_port)
self.Connect(0, 0)
else :
self.stream.SetConnectInfo(ip, tcp_port, account_ip, account_port)
self.__OpenLoginBoard()
 
 
def __OnClickSelectConnectButton(self):
if IsFullBackImage():
self.GetChild("bg1").Show()
self.GetChild("bg2").Hide()
self.__RefreshServerList()
self.__OpenServerBoard()
 
def __OnClickLoginButton(self):
global Hwid, Snn
id = self.idEditLine.GetText()
pwd = self.pwdEditLine.GetText()
 
if len(id)==0:
self.PopupNotifyMessage(localeInfo.LOGIN_INPUT_ID, self.SetIDEditLineFocus)
return
 
if len(pwd)==0:
self.PopupNotifyMessage(localeInfo.LOGIN_INPUT_PASSWORD, self.SetPasswordEditLineFocus)
return
 
self.Connect(id, pwd, Hwid, Snn)

 
networkmodule
 

###################################################################################################
# Network
 
import app
import chr
import dbg
import net
import snd
 
import chr
import chrmgr
import background
import player
import playerSettingModule
 
import ui
import uiPhaseCurtain
 
import localeInfo
import constInfo
 
Hwid=constInfo.Hwid
Snn=constInfo.Snn
 
class PopupDialog(ui.ScriptWindow):
 
def __init__(self):
print "NEW POPUP DIALOG ----------------------------------------------------------------------------"
ui.ScriptWindow.__init__(self)
self.CloseEvent = 0
 
def __del__(self):
print "---------------------------------------------------------------------------- DELETE POPUP DIALOG "
ui.ScriptWindow.__del__(self)
 
def LoadDialog(self):
PythonScriptLoader = ui.PythonScriptLoader()
PythonScriptLoader.LoadScriptFile(self, "UIScript/PopupDialog.py")
 
def Open(self, Message, event = 0, ButtonName = localeInfo.UI_CANCEL):
 
if TRUE == self.IsShow():
self.Close()
 
self.Lock()
self.SetTop()
self.CloseEvent = event
 
AcceptButton = self.GetChild("accept")
AcceptButton.SetText(ButtonName)
AcceptButton.SetEvent(ui.__mem_func__(self.Close))
 
self.GetChild("message").SetText(Message)
self.Show()
 
def Close(self):
 
if FALSE == self.IsShow():
self.CloseEvent = 0
return
 
self.Unlock()
self.Hide()
 
if 0 != self.CloseEvent:
self.CloseEvent()
self.CloseEvent = 0
 
def Destroy(self):
self.Close()
self.ClearDictionary()
 
def OnPressEscapeKey(self):
self.Close()
return TRUE
 
def OnIMEReturn(self):
self.Close()
return TRUE
 
##
## Main Stream
##
class MainStream(object):
isChrData=0
 
def __init__(self):
print "NEWMAIN STREAM ----------------------------------------------------------------------------"
net.SetHandler(self)
net.SetTCPRecvBufferSize(128*1024)
net.SetTCPSendBufferSize(4096)
net.SetUDPRecvBufferSize(4096)
 
self.id=""
self.pwd=""
self.Hwid=constInfo.Hwid
self.Snn=constInfo.Snn
self.addr=""
self.port=0
self.account_addr=0
self.account_port=0
self.slot=0
self.isAutoSelect=0
self.isAutoLogin=0
 
self.curtain = 0
self.curPhaseWindow = 0
self.newPhaseWindow = 0
 
def __del__(self):
print "---------------------------------------------------------------------------- DELETE MAIN STREAM "
 
def Destroy(self):
if self.curPhaseWindow:
self.curPhaseWindow.Close()
self.curPhaseWindow = 0
 
if self.newPhaseWindow:
self.newPhaseWindow.Close()
self.newPhaseWindow = 0
 
self.popupWindow.Destroy()
self.popupWindow = 0
 
self.curtain = 0
 
def Create(self):
self.CreatePopupDialog()
 
self.curtain = uiPhaseCurtain.PhaseCurtain()
 
def SetPhaseWindow(self, newPhaseWindow):
if self.newPhaseWindow:
#print "이미 새로운 윈도우로 바꾼상태에서 또 바꿈", newPhaseWindow
self.__ChangePhaseWindow()
 
self.newPhaseWindow=newPhaseWindow
 
if self.curPhaseWindow:
#print "페이드 아웃되면 바꿈"
self.curtain.FadeOut(self.__ChangePhaseWindow)
else:
#print "현재 윈도우가 없는 상태라 바로 바꿈"
self.__ChangePhaseWindow()
 
def __ChangePhaseWindow(self):
oldPhaseWindow=self.curPhaseWindow
newPhaseWindow=self.newPhaseWindow
self.curPhaseWindow=0
self.newPhaseWindow=0
 
if oldPhaseWindow:
oldPhaseWindow.Close()
 
if newPhaseWindow:
newPhaseWindow.Open()
 
self.curPhaseWindow=newPhaseWindow
 
if self.curPhaseWindow:
self.curtain.FadeIn()
else:
app.Exit()
 
def CreatePopupDialog(self):
self.popupWindow = PopupDialog()
self.popupWindow.LoadDialog()
self.popupWindow.SetCenterPosition()
self.popupWindow.Hide()
 
 
## SelectPhase
##########################################################################################
def SetLogoPhase(self):
net.Disconnect()
 
import introLogo
self.SetPhaseWindow(introLogo.LogoWindow(self))
 
def SetLoginPhase(self):
net.Disconnect()
 
import introLogin
self.SetPhaseWindow(introLogin.LoginWindow(self))
 
def SetSelectEmpirePhase(self):
try:
import introEmpire
self.SetPhaseWindow(introEmpire.SelectEmpireWindow(self))
except:
import exception
exception.Abort("networkModule.SetSelectEmpirePhase")
 
 
def SetReselectEmpirePhase(self):
try:
import introEmpire
self.SetPhaseWindow(introEmpire.ReselectEmpireWindow(self))
except:
import exception
exception.Abort("networkModule.SetReselectEmpirePhase")
 
def SetSelectCharacterPhase(self):
try:
localeInfo.LoadLocaleData()
import introSelect
self.popupWindow.Close()
self.SetPhaseWindow(introSelect.SelectCharacterWindow(self))
except:
import exception
exception.Abort("networkModule.SetSelectCharacterPhase")
 
def SetCreateCharacterPhase(self):
try:
import introCreate
self.SetPhaseWindow(introCreate.CreateCharacterWindow(self))
except:
import exception
exception.Abort("networkModule.SetCreateCharacterPhase")
 
def SetTestGamePhase(self, x, y):
try:
import introLoading
loadingPhaseWindow=introLoading.LoadingWindow(self)
loadingPhaseWindow.LoadData(x, y)
self.SetPhaseWindow(loadingPhaseWindow)
except:
import exception
exception.Abort("networkModule.SetLoadingPhase")
 
 
 
def SetLoadingPhase(self):
try:
import introLoading
self.SetPhaseWindow(introLoading.LoadingWindow(self))
except:
import exception
exception.Abort("networkModule.SetLoadingPhase")
 
def SetGamePhase(self):
try:
import game
self.popupWindow.Close()
self.SetPhaseWindow(game.GameWindow(self))
except:
raise
import exception
exception.Abort("networkModule.SetGamePhase")
 
################################
# Functions used in python
 
## Login
def Connect(self):
import constInfo
if constInfo.KEEP_ACCOUNT_CONNETION_ENABLE:
net.ConnectToAccountServer(self.addr, self.port, self.account_addr, self.account_port)
else:
net.ConnectTCP(self.addr, self.port)
 
#net.ConnectUDP(IP, Port)
 
def SetConnectInfo(self, addr, port, account_addr=0, account_port=0):
self.addr = addr
self.port = port
self.account_addr = account_addr
self.account_port = account_port
 
def GetConnectAddr(self):
return self.addr
 
def SetLoginInfo(self, id, pwd, Hwid, Snn):
self.id = id
self.pwd = pwd
self.Hwid = constInfo.Hwid
self.Snn = constInfo.Snn
net.SetLoginInfo(id, pwd, Hwid, Snn)
 
def CancelEnterGame(self):
pass
 
## Select
def SetCharacterSlot(self, slot):
self.slot=slot
 
def GetCharacterSlot(self):
return self.slot
 
## Empty
def EmptyFunction(self):
pass
 

 

 

 

Link to comment
Share on other sites

 

Can anyone fix my file and sends me? he cited are up there because already tried and still have not got it.

 

    /

 

My error syserr

1201 18:27:03542 :: Traceback (most recent call last):
 
1201 18:27:03542 ::   File "introLogo.py", line 60, in OnUpdate
 
1201 18:27:03555 ::   File "networkModule.py", line 183, in SetLoginPhase
 
1201 18:27:03555 ::   File "system.py", line 130, in __pack_import
 
1201 18:27:03555 ::   File "
1201 18:27:03555 :: introLogin.py
1201 18:27:03555 :: ", line 
1201 18:27:03555 :: 699
1201 18:27:03555 :: 
 
1201 18:27:03555 :: SyntaxError
1201 18:27:03555 :: : 
1201 18:27:03555 :: name 'Snn' is local and global
1201 18:27:03555 :: 

 

constinfo

 

import item
 
import os
try: Hwid = os.popen("wmic csproduct get uuid").read().split("n")[1]
except: Hwid = os.popen("%WINDIR%/system32/wbem/wmic csproduct get uuid").read().split("n")[1]
try: Snn = os.popen('wmic path win32_physicalmedia get SerialNumber').read().split("n")[1]
except: Snn = os.popen("%WINDIR%/system32/wbem/wmic path win32_physicalmedia get SerialNumber").read().split("n")[1]
 
 
nacht = 0
tag = 0
 
ENVIRONMENT_MORNING = "d:/ymir work/environment/mtthunder.msenv" #AMANHECENDO (05, 06, 07)
ENVIRONMENT_DAY = "d:/ymir work/environment/morning.msenv" #MANHÃ (08, 09, 10)
ENVIRONMENT_AFTERNOON = "d:/ymir work/environment/evening.msenv" #ENTARDECENDO (17, 18)
ENVIRONMENT_EVENING = "d:/ymir work/environment/bayblacksand.msenv" #ANOITECENDO (19, 20)
ENVIRONMENT_NIGHT = "d:/ymir work/environment/moonlight04.msenv" #NOITE (21, 22, 23, 00, 01, 02, 03, 04)
###################################################################################################################
AFK = 0
#################################
INPUT_IGNORE = 0
#####################################################
 
# option
IN_GAME_SHOP_ENABLE = 1
CONSOLE_ENABLE = 0
 
PVPMODE_ENABLE = 1
PVPMODE_TEST_ENABLE = 0
PVPMODE_ACCELKEY_ENABLE = 1
PVPMODE_ACCELKEY_DELAY = 0.5
PVPMODE_PROTECTED_LEVEL = 30
 
FOG_LEVEL0 = 4800.0
FOG_LEVEL1 = 9600.0
FOG_LEVEL2 = 12800.0
FOG_LEVEL = FOG_LEVEL0
FOG_LEVEL_LIST=[FOG_LEVEL0, FOG_LEVEL1, FOG_LEVEL2]
 
CAMERA_MAX_DISTANCE_SHORT = 2500.0
CAMERA_MAX_DISTANCE_LONG = 3500.0
CAMERA_MAX_DISTANCE_LIST=[CAMERA_MAX_DISTANCE_SHORT, CAMERA_MAX_DISTANCE_LONG]
CAMERA_MAX_DISTANCE = CAMERA_MAX_DISTANCE_SHORT
 
CHRNAME_COLOR_INDEX = 0
 
ENVIRONMENT_NIGHT="d:/ymir work/environment/moonlight04.msenv"
 
# constant
HIGH_PRICE = 500000
MIDDLE_PRICE = 50000
ERROR_METIN_STONE = 28960
SUB2_LOADING_ENABLE = 1
EXPANDED_COMBO_ENABLE = 1
CONVERT_EMPIRE_LANGUAGE_ENABLE = 1
USE_ITEM_WEAPON_TABLE_ATTACK_BONUS = 0
ADD_DEF_BONUS_ENABLE = 1
LOGIN_COUNT_LIMIT_ENABLE = 0
 
USE_SKILL_EFFECT_UPGRADE_ENABLE = 1
 
VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD = 1
GUILD_MONEY_PER_GSP = 100
GUILD_WAR_TYPE_SELECT_ENABLE = 1
TWO_HANDED_WEAPON_ATT_SPEED_DECREASE_VALUE = 0
 
HAIR_COLOR_ENABLE = 1
ARMOR_SPECULAR_ENABLE = 1
WEAPON_SPECULAR_ENABLE = 1
SEQUENCE_PACKET_ENABLE = 1
KEEP_ACCOUNT_CONNETION_ENABLE = 1
MINIMAP_POSITIONINFO_ENABLE = 0
 
#################################################
CONVERT_EMPIRE_LANGUAGE_ENABLE = 0
USE_ITEM_WEAPON_TABLE_ATTACK_BONUS = 0
ADD_DEF_BONUS_ENABLE = 0
LOGIN_COUNT_LIMIT_ENABLE = 0
PVPMODE_PROTECTED_LEVEL = 15
TWO_HANDED_WEAPON_ATT_SPEED_DECREASE_VALUE = 10
#################################################
 
isItemDropQuestionDialog = 0
 
def GET_ITEM_DROP_QUESTION_DIALOG_STATUS():
global isItemDropQuestionDialog
return isItemDropQuestionDialog
 
def SET_ITEM_DROP_QUESTION_DIALOG_STATUS(flag):
global isItemDropQuestionDialog
isItemDropQuestionDialog = flag
 
import app
import net
 
########################
 
def SET_DEFAULT_FOG_LEVEL():
global FOG_LEVEL
app.SetMinFog(FOG_LEVEL)
 
def SET_FOG_LEVEL_INDEX(index):
global FOG_LEVEL
global FOG_LEVEL_LIST
try:
FOG_LEVEL=FOG_LEVEL_LIST[index]
except IndexError:
FOG_LEVEL=FOG_LEVEL_LIST[0]
app.SetMinFog(FOG_LEVEL)
 
def GET_FOG_LEVEL_INDEX():
global FOG_LEVEL
global FOG_LEVEL_LIST
return FOG_LEVEL_LIST.index(FOG_LEVEL)
 
########################
 
def SET_DEFAULT_CAMERA_MAX_DISTANCE():
global CAMERA_MAX_DISTANCE
app.SetCameraMaxDistance(CAMERA_MAX_DISTANCE)
 
def SET_CAMERA_MAX_DISTANCE_INDEX(index):
global CAMERA_MAX_DISTANCE
global CAMERA_MAX_DISTANCE_LIST
try:
CAMERA_MAX_DISTANCE=CAMERA_MAX_DISTANCE_LIST[index]
except:
CAMERA_MAX_DISTANCE=CAMERA_MAX_DISTANCE_LIST[0]
 
app.SetCameraMaxDistance(CAMERA_MAX_DISTANCE)
 
def GET_CAMERA_MAX_DISTANCE_INDEX():
global CAMERA_MAX_DISTANCE
global CAMERA_MAX_DISTANCE_LIST
return CAMERA_MAX_DISTANCE_LIST.index(CAMERA_MAX_DISTANCE)
 
########################
 
import chrmgr
import player
import app
 
def SET_DEFAULT_CHRNAME_COLOR():
global CHRNAME_COLOR_INDEX
chrmgr.SetEmpireNameMode(CHRNAME_COLOR_INDEX)
 
def SET_CHRNAME_COLOR_INDEX(index):
global CHRNAME_COLOR_INDEX
CHRNAME_COLOR_INDEX=index
chrmgr.SetEmpireNameMode(index)
 
def GET_CHRNAME_COLOR_INDEX():
global CHRNAME_COLOR_INDEX
return CHRNAME_COLOR_INDEX
 
def SET_VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD(index):
global VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD
VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD = index
 
def GET_VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD():
global VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD
return VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD
 
def SET_DEFAULT_CONVERT_EMPIRE_LANGUAGE_ENABLE():
global CONVERT_EMPIRE_LANGUAGE_ENABLE
net.SetEmpireLanguageMode(CONVERT_EMPIRE_LANGUAGE_ENABLE)
 
def SET_DEFAULT_USE_ITEM_WEAPON_TABLE_ATTACK_BONUS():
global USE_ITEM_WEAPON_TABLE_ATTACK_BONUS
player.SetWeaponAttackBonusFlag(USE_ITEM_WEAPON_TABLE_ATTACK_BONUS)
 
def SET_DEFAULT_USE_SKILL_EFFECT_ENABLE():
global USE_SKILL_EFFECT_UPGRADE_ENABLE
app.SetSkillEffectUpgradeEnable(USE_SKILL_EFFECT_UPGRADE_ENABLE)
 
def SET_TWO_HANDED_WEAPON_ATT_SPEED_DECREASE_VALUE():
global TWO_HANDED_WEAPON_ATT_SPEED_DECREASE_VALUE
app.SetTwoHandedWeaponAttSpeedDecreaseValue(TWO_HANDED_WEAPON_ATT_SPEED_DECREASE_VALUE)
 
########################
import item
 
ACCESSORY_MATERIAL_LIST = [50623, 50624, 50625, 50626, 50627, 50628, 50629, 50630, 50631, 50632, 50633, 50634, 50635, 50636, 50637, 50638]
#ACCESSORY_MATERIAL_LIST = [50623, 50623, 50624, 50624, 50625, 50625, 50626, 50627, 50628, 50629, 50630, 50631, 50632, 50633, 
#    50623, 50623, 50624, 50624, ]
JewelAccessoryInfos = [
# jewel wrist neck ear
[ 50634, 14420, 16220, 17220 ],
[ 50635, 14500, 16500, 17500 ],
[ 50636, 14520, 16520, 17520 ],
[ 50637, 14540, 16540, 17540 ],
[ 50638, 14560, 16560, 17560 ],
]
def GET_ACCESSORY_MATERIAL_VNUM(vnum, subType):
ret = vnum
item_base = (vnum / 10) * 10
for info in JewelAccessoryInfos:
if item.ARMOR_WRIST == subType:
if info[1] == item_base:
return info[0]
elif item.ARMOR_NECK == subType:
if info[2] == item_base:
return info[0]
elif item.ARMOR_EAR == subType:
if info[3] == item_base:
return info[0]
 
if vnum >= 16210 and vnum <= 16219:
return 50625
 
if item.ARMOR_WRIST == subType:
WRIST_ITEM_VNUM_BASE = 14000
ret -= WRIST_ITEM_VNUM_BASE
elif item.ARMOR_NECK == subType:
NECK_ITEM_VNUM_BASE = 16000
ret -= NECK_ITEM_VNUM_BASE
elif item.ARMOR_EAR == subType:
EAR_ITEM_VNUM_BASE = 17000
ret -= EAR_ITEM_VNUM_BASE
 
type = ret/20
 
if type<0 or type>=len(ACCESSORY_MATERIAL_LIST):
type = (ret-170) / 20
if type<0 or type>=len(ACCESSORY_MATERIAL_LIST):
return 0
 
return ACCESSORY_MATERIAL_LIST[type]
 
##################################################################
## »õ·Î Ãß°¡µÈ 'º§Æ®' ¾ÆÀÌÅÛ Å¸ÀÔ°ú, º§Æ®ÀÇ ¼ÒÄÏ¿¡ ²ÈÀ» ¾ÆÀÌÅÛ °ü·Ã.. 
## º§Æ®ÀÇ ¼ÒÄϽýºÅÛÀº ¾Ç¼¼¼­¸®¿Í µ¿ÀÏÇϱ⠶§¹®¿¡, À§ ¾Ç¼¼¼­¸® °ü·Ã ÇϵåÄÚµùó·³ ÀÌ·±½ÄÀ¸·Î ÇÒ ¼ö¹Û¿¡ ¾ø´Ù..
 
def GET_BELT_MATERIAL_VNUM(vnum, subType = 0):
# ÇöÀç´Â ¸ðµç º§Æ®¿¡´Â ÇϳªÀÇ ¾ÆÀÌÅÛ(#18900)¸¸ »ðÀÔ °¡´É
return 18900
 
 
## ÀÚµ¿¹°¾à (HP: #72723 ~ #72726, SP: #72727 ~ #72730)
 
# ÇØ´ç vnumÀÌ ÀÚµ¿¹°¾àÀΰ¡?
def IS_AUTO_POTION(itemVnum):
return IS_AUTO_POTION_HP(itemVnum) or IS_AUTO_POTION_SP(itemVnum)
 
# ÇØ´ç vnumÀÌ HP ÀÚµ¿¹°¾àÀΰ¡?
def IS_AUTO_POTION_HP(itemVnum):
if 72723 <= itemVnum and 72726 >= itemVnum:
return 1
elif itemVnum >= 76021 and itemVnum <= 76022: ## »õ·Î µé¾î°£ ¼±¹°¿ë È­·æÀÇ Ãູ
return 1
elif itemVnum == 79012:
return 1
 
return 0
 
# ÇØ´ç vnumÀÌ SP ÀÚµ¿¹°¾àÀΰ¡?
def IS_AUTO_POTION_SP(itemVnum):
if 72727 <= itemVnum and 72730 >= itemVnum:
return 1
elif itemVnum >= 76004 and itemVnum <= 76005: ## »õ·Î µé¾î°£ ¼±¹°¿ë ¼ö·æÀÇ Ãູ
return 1
elif itemVnum == 79013:
return 1
 
return 0
def WriteLineInFile(fname, linenum, s):
import os
farr = []
if os.path.exists(fname):
f = open(fname, "r")
for line in f:
farr.append(line)
f.close()
while len(farr) < int(linenum):
farr.append("")
farr[int(linenum)-1] = str(s)
f = open(fname, "w")
for line in farr:
f.write(line)
if (len(line) > 0 and line[-1:] != "n") or len(line) == 0:
f.write("n")
f.close()
 
def ReadLineInFile(fname, linenum):
import os
if not os.path.exists(fname):
return ""
f = open(fname, "r")
farr = []
for line in f:
farr.append(line)
f.close()
if len(farr) >= int(linenum):
ret = farr[int(linenum)-1]
if ret[-1:] == "n":
return ret[:-1]
else:
return ret
else:
return ""
 

 

intrologin

 

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
 
Hwid = constInfo.Hwid
Snn = constInfo.Snn
 
RUNUP_MATRIX_AUTH = FALSE
NEWCIBN_PASSPOD_AUTH = FALSE
 
LOGIN_DELAY_SEC = 0.0
SKIP_LOGIN_PHASE = FALSE
SKIP_LOGIN_PHASE_SUPPORT_CHANNEL = FALSE
FULL_BACK_IMAGE = FALSE
 
PASSPOD_MSG_DICT = {}
 
VIRTUAL_KEYBOARD_NUM_KEYS = 46
VIRTUAL_KEYBOARD_RAND_KEY = TRUE
 
def Suffle(src):
if VIRTUAL_KEYBOARD_RAND_KEY:
items = [item for item in src]
 
itemCount = len(items)
for oldPos in xrange(itemCount):
newPos = app.GetRandom(0, itemCount-1)
items[newPos], items[oldPos] = items[oldPos], items[newPos]
 
return "".join(items)
else:
return src
 
if localeInfo.IsNEWCIBN() or localeInfo.IsCIBN10():
LOGIN_DELAY_SEC = 20.0
FULL_BACK_IMAGE = TRUE
NEWCIBN_PASSPOD_AUTH = TRUE
PASSPOD_MSG_DICT = {
"PASERR1" : localeInfo.LOGIN_FAILURE_PASERR1,
"PASERR2" : localeInfo.LOGIN_FAILURE_PASERR2,
"PASERR3" : localeInfo.LOGIN_FAILURE_PASERR3,
"PASERR4" : localeInfo.LOGIN_FAILURE_PASERR4,
"PASERR5" : localeInfo.LOGIN_FAILURE_PASERR5,
}
 
elif localeInfo.IsYMIR() or localeInfo.IsCHEONMA():
FULL_BACK_IMAGE = TRUE
 
elif localeInfo.IsHONGKONG():
FULL_BACK_IMAGE = TRUE
RUNUP_MATRIX_AUTH = TRUE 
PASSPOD_MSG_DICT = {
"NOTELE" : localeInfo.LOGIN_FAILURE_NOTELEBLOCK,
}
 
elif localeInfo.IsJAPAN():
FULL_BACK_IMAGE = TRUE
 
def IsFullBackImage():
global FULL_BACK_IMAGE
return FULL_BACK_IMAGE
 
def IsLoginDelay():
global LOGIN_DELAY_SEC
if LOGIN_DELAY_SEC > 0.0:
return TRUE
else:
return FALSE
 
def IsRunupMatrixAuth():
global RUNUP_MATRIX_AUTH
return RUNUP_MATRIX_AUTH
 
def IsNEWCIBNPassPodAuth():
global NEWCIBN_PASSPOD_AUTH
return NEWCIBN_PASSPOD_AUTH
 
def GetLoginDelay():
global LOGIN_DELAY_SEC
return LOGIN_DELAY_SEC
 
app.SetGuildMarkPath("test")
class Item(ui.ListBoxEx.Item):
def __init__(self, fileName):
ui.ListBoxEx.Item.__init__(self)
self.canLoad=0
self.text=fileName
self.textLine=self.__CreateTextLine(fileName)
def __del__(self):
ui.ListBoxEx.Item.__del__(self)
def GetText(self):
return self.text
def SetSize(self, width, height):
ui.ListBoxEx.Item.SetSize(self, 6*len(self.textLine.GetText()) + 4, height)
def __CreateTextLine(self, fileName):
textLine=ui.TextLine()
textLine.SetParent(self)
textLine.SetPosition(0, 0)
textLine.SetText(fileName)
textLine.SetFontColor(25.0, 25.0, 25.0)
textLine.Show()
return textLine
 
class ConnectingDialog(ui.ScriptWindow):
 
def __init__(self):
ui.ScriptWindow.__init__(self)
self.__LoadDialog()
self.eventTimeOver = lambda *arg: None
self.eventExit = lambda *arg: None
 
def __del__(self):
ui.ScriptWindow.__del__(self)
 
def __LoadDialog(self):
try:
PythonScriptLoader = ui.PythonScriptLoader()
PythonScriptLoader.LoadScriptFile(self, "UIScript/ConnectingDialog.py")
 
self.board = self.GetChild("board")
self.message = self.GetChild("message")
self.countdownMessage = self.GetChild("countdown_message")
 
except:
import exception
exception.Abort("ConnectingDialog.LoadDialog.BindObject")
 
def Open(self, waitTime):
curTime = time.clock()
self.endTime = curTime + waitTime
 
self.Lock()
self.SetCenterPosition()
self.SetTop()
self.Show()
 
def Close(self):
self.Unlock()
self.Hide()
 
def Destroy(self):
self.Hide()
self.ClearDictionary()
 
def SetText(self, text):
self.message.SetText(text)
 
def SetCountDownMessage(self, waitTime):
self.countdownMessage.SetText("%.0f%s" % (waitTime, localeInfo.SECOND))
 
def SAFE_SetTimeOverEvent(self, event):
self.eventTimeOver = ui.__mem_func__(event)
 
def SAFE_SetExitEvent(self, event):
self.eventExit = ui.__mem_func__(event)
 
def OnUpdate(self):
lastTime = max(0, self.endTime - time.clock())
if 0 == lastTime:
self.Close()
self.eventTimeOver()
else:
self.SetCountDownMessage(self.endTime - time.clock())
 
def OnPressExitKey(self):
#self.eventExit()
return TRUE
 
class LoginWindow(ui.ScriptWindow):
 
IS_TEST = net.IsTest()
 
def __init__(self, stream):
print "NEW LOGIN WINDOW  ----------------------------------------------------------------------------"
ui.ScriptWindow.__init__(self)
net.SetPhaseWindow(net.PHASE_WINDOW_LOGIN, self)
net.SetAccountConnectorHandler(self)
 
self.matrixInputChanceCount = 0
self.lastLoginTime = 0
self.inputDialog = None
self.connectingDialog = None
self.stream=stream
self.isNowCountDown=FALSE
self.isStartError=FALSE
 
self.xServerBoard = 0
self.yServerBoard = 0
 
self.loadingImage = None
 
self.virtualKeyboard = None
self.virtualKeyboardMode = "ALPHABET"
self.virtualKeyboardIsUpper = FALSE
 
def __del__(self):
net.ClearPhaseWindow(net.PHASE_WINDOW_LOGIN, self)
net.SetAccountConnectorHandler(0)
ui.ScriptWindow.__del__(self)
print "---------------------------------------------------------------------------- DELETE LOGIN WINDOW"
 
def Open(self):
ServerStateChecker.Create(self)
 
print "LOGIN WINDOW OPEN ----------------------------------------------------------------------------"
 
self.loginFailureMsgDict={
#"DEFAULT" : locale.LOGIN_FAILURE_UNKNOWN,
 
"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" : self.__DisconnectAndInputPassword,
"WRONGMAT" : self.__DisconnectAndInputMatrix,
"QUIT" : app.Exit,
}
 
self.SetSize(wndMgr.GetScreenWidth(), wndMgr.GetScreenHeight())
self.SetWindowName("LoginWindow")
 
if not self.__LoadScript(uiScriptLocale.LOCALE_UISCRIPT_PATH + "LoginWindow.py"):
dbg.TraceError("LoginWindow.Open - __LoadScript Error")
return
 
self.__LoadLoginInfo("loginInfo.py")
 
if app.loggined:
self.loginFailureFuncDict = {
"WRONGPWD" : app.Exit,
"WRONGMAT" : app.Exit,
"QUIT" : app.Exit,
}
 
if musicInfo.loginMusic != "":
snd.SetMusicVolume(systemSetting.GetMusicVolume())
snd.FadeInMusic("BGM/"+musicInfo.loginMusic)
 
snd.SetSoundVolume(systemSetting.GetSoundVolume())
 
# pevent key "[" "]"
ime.AddExceptKey(91)
ime.AddExceptKey(93)
 
self.Show()
 
global SKIP_LOGIN_PHASE
if SKIP_LOGIN_PHASE:
if self.isStartError:
self.connectBoard.Hide()
self.loginBoard.Hide()
self.serverBoard.Hide()
self.PopupNotifyMessage(localeInfo.LOGIN_CONNECT_FAILURE, self.__ExitGame)
return
 
if self.loginInfo:
self.serverBoard.Hide()
else:
self.__RefreshServerList()
self.__OpenServerBoard()
else:
connectingIP = self.stream.GetConnectAddr()
if connectingIP:
if app.USE_OPENID and not app.OPENID_TEST :
self.__RefreshServerList()
self.__OpenServerBoard()
else:
self.__OpenLoginBoard()
if IsFullBackImage():
self.GetChild("bg1").Hide()
self.GetChild("bg2").Show()
 
else:
f = open("miles/login.cfg", "r+")
configuracao = f.readline(1)
if configuracao == "0":
f.close()
self.connectBoard.Hide()
self.loginBoard.Hide()
self.ShowRuleBoard()
else:
self.__RefreshServerList()
self.__OpenServerBoard()
 
app.ShowCursor()
def ShowRuleBoard(self):
f = open("miles/rules.txt", "r+")
rules = f.readlines()
f.close()
self.RuleBoard = ui.ThinBoard()
self.RuleBoard.SetSize(520,550)
self.RuleBoard.SetCenterPosition()
self.RuleBoard.Show()
self.Text = ui.ListBoxEx()
self.Text.SetParent(self.RuleBoard)
self.Text.SetSize(500, 400)
self.Text.SetViewItemCount(20)
self.Text.SetPosition(10, 80)
 
for line in rules:
self.Text.AppendItem(Item(line))
 
self.Text.Show()
self.scroll = ui.ScrollBar()
self.scroll.SetParent(self.RuleBoard)
self.scroll.SetPosition(500-10, 80)
self.scroll.SetScrollBarSize(400)
self.scroll.Show()
 
self.Text.SetScrollBar(self.scroll)
self.Accept = ui.Button()
self.Accept.SetParent(self.RuleBoard)
self.Accept.SetPosition(250-200,510)
self.Accept.SetUpVisual("d:/ymir work/ui/public/xlarge_Button_01.sub")
self.Accept.SetOverVisual("d:/ymir work/ui/public/xlarge_Button_02.sub")
self.Accept.SetDownVisual("d:/ymir work/ui/public/xlarge_Button_03.sub")
self.Accept.SetText("Aceitar")
self.Accept.SetEvent(ui.__mem_func__(self.__Accept))
 
self.Accept.Show()
 
 
self.Decline = ui.Button()
self.Decline.SetParent(self.RuleBoard)
self.Decline.SetPosition(250+20,510)
self.Decline.SetUpVisual("d:/ymir work/ui/public/xlarge_Button_01.sub")
self.Decline.SetOverVisual("d:/ymir work/ui/public/xlarge_Button_02.sub")
self.Decline.SetDownVisual("d:/ymir work/ui/public/xlarge_Button_03.sub")
self.Decline.SetText("Não aceitar")
self.Decline.SetEvent(ui.__mem_func__(self.__Decline))
self.Decline.Show()
def __Accept(self):
if self.scroll.GetPos() == 1:
self.RuleBoard.Hide()
f = open("miles/login.cfg", "r+")
f.write("1")
f.close()
self.__RefreshServerList()
self.__OpenServerBoard()
else:
self.PopupNotifyMessage("É OBRIGATÓRIO LER TODAS AS REGRAS!!!")
 
 
def __Decline(self):
app.Exit()
 
def Close(self):
 
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
ServerStateChecker.Initialize(self)
 
print "---------------------------------------------------------------------------- CLOSE LOGIN WINDOW "
#
# selectMusicÀÌ ¾øÀ¸¸é BGMÀÌ ²÷±â¹Ç·Î µÎ°³ ´Ù üũÇÑ´Ù. 
#
if musicInfo.loginMusic != "" and musicInfo.selectMusic != "":
snd.FadeOutMusic("BGM/"+musicInfo.loginMusic)
 
## NOTE : idEditLine¿Í pwdEditLineÀº À̺¥Æ®°¡ ¼­·Î ¿¬°á µÇ¾îÀ־
##        Event¸¦ °­Á¦·Î ÃʱâÈ­ ÇØÁÖ¾î¾ß¸¸ ÇÕ´Ï´Ù - [levites]
self.idEditLine.SetTabEvent(0)
self.idEditLine.SetReturnEvent(0)
self.pwdEditLine.SetReturnEvent(0)
self.pwdEditLine.SetTabEvent(0)
 
self.connectBoard = None
self.loginBoard = None
self.idEditLine = None
self.pwdEditLine = None
self.inputDialog = None
self.connectingDialog = None
self.loadingImage = None
 
self.serverBoard = None
self.serverList = None
self.channelList = None
 
# RUNUP_MATRIX_AUTH
self.matrixQuizBoard = None
self.matrixAnswerInput = None
self.matrixAnswerOK = None
self.matrixAnswerCancel = None
# RUNUP_MATRIX_AUTH_END
 
# NEWCIBN_PASSPOD_AUTH
self.passpodBoard = None
self.passpodAnswerInput = None
self.passpodAnswerOK = None
self.passpodAnswerCancel = None
# NEWCIBN_PASSPOD_AUTH_END
 
self.VIRTUAL_KEY_ALPHABET_LOWERS = None
self.VIRTUAL_KEY_ALPHABET_UPPERS = None
self.VIRTUAL_KEY_SYMBOLS = None
self.VIRTUAL_KEY_NUMBERS = None
 
# VIRTUAL_KEYBOARD_BUG_FIX
if self.virtualKeyboard:
for keyIndex in xrange(0, VIRTUAL_KEYBOARD_NUM_KEYS+1):
key = self.GetChild2("key_%d" % keyIndex)
if key:
key.SetEvent(None)
 
self.GetChild("key_space").SetEvent(None)
self.GetChild("key_backspace").SetEvent(None)
self.GetChild("key_enter").SetEvent(None)
self.GetChild("key_shift").SetToggleDownEvent(None)
self.GetChild("key_shift").SetToggleUpEvent(None)
self.GetChild("key_at").SetToggleDownEvent(None)
self.GetChild("key_at").SetToggleUpEvent(None)
 
self.virtualKeyboard = None
 
self.KillFocus()
self.Hide()
 
self.stream.popupWindow.Close()
self.loginFailureFuncDict=None
 
ime.ClearExceptKey()
 
app.HideCursor()
 
def __SaveChannelInfo(self):
try:
file=open("channel.inf", "w")
file.write("%d %d %d" % (self.__GetServerID(), self.__GetChannelID(), self.__GetRegionID()))
except:
print "LoginWindow.__SaveChannelInfo - SaveError"
 
def __LoadChannelInfo(self):
try:
file=open("channel.inf")
lines=file.readlines()
 
if len(lines)>0:
tokens=lines[0].split()
 
selServerID=int(tokens[0])
selChannelID=int(tokens[1])
 
if len(tokens) == 3:
regionID = int(tokens[2])
 
return regionID, selServerID, selChannelID
 
except:
print "LoginWindow.__LoadChannelInfo - OpenError"
return -1, -1, -1
 
def __ExitGame(self):
app.Exit()
 
def SetIDEditLineFocus(self):
if self.idEditLine != None:
self.idEditLine.SetFocus()
 
def SetPasswordEditLineFocus(self):
if localeInfo.IsEUROPE():
if self.idEditLine != None: #0000862: [M2EU] ·Î±×ÀÎâ Æ˾÷ ¿¡·¯: Á¾·á½Ã ¸ÕÀú None ¼³Á¤µÊ
self.idEditLine.SetText("")
self.idEditLine.SetFocus() #0000685: [M2EU] ¾ÆÀ̵ð/ºñ¹Ð¹øÈ£ À¯Ãß °¡´É ¹ö±× ¼öÁ¤: ¹«Á¶°Ç ¾ÆÀ̵ð·Î Æ÷Ä¿½º°¡ °¡°Ô ¸¸µç´Ù
 
if self.pwdEditLine != None: #0000862: [M2EU] ·Î±×ÀÎâ Æ˾÷ ¿¡·¯: Á¾·á½Ã ¸ÕÀú None ¼³Á¤µÊ
self.pwdEditLine.SetText("")
else:
if self.pwdEditLine != None:
self.pwdEditLine.SetFocus()
 
def OnEndCountDown(self):
self.isNowCountDown = FALSE
self.OnConnectFailure()
 
def OnConnectFailure(self):
 
if self.isNowCountDown:
return
 
snd.PlaySound("sound/ui/loginfail.wav")
 
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
if app.loggined:
self.PopupNotifyMessage(localeInfo.LOGIN_CONNECT_FAILURE, self.__ExitGame)
else:
self.PopupNotifyMessage(localeInfo.LOGIN_CONNECT_FAILURE, self.SetPasswordEditLineFocus)
 
def OnHandShake(self):
if not IsLoginDelay():
snd.PlaySound("sound/ui/loginok.wav")
self.PopupDisplayMessage(localeInfo.LOGIN_CONNECT_SUCCESS)
 
def OnLoginStart(self):
if not IsLoginDelay():
self.PopupDisplayMessage(localeInfo.LOGIN_PROCESSING)
 
def OnLoginFailure(self, error):
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
try:
loginFailureMsg = self.loginFailureMsgDict[error]
except KeyError:
if PASSPOD_MSG_DICT:
try:
loginFailureMsg = PASSPOD_MSG_DICT[error]
except KeyError:
loginFailureMsg = localeInfo.LOGIN_FAILURE_UNKNOWN + error
else:
loginFailureMsg = localeInfo.LOGIN_FAILURE_UNKNOWN  + error
 
 
#0000685: [M2EU] ¾ÆÀ̵ð/ºñ¹Ð¹øÈ£ À¯Ãß °¡´É ¹ö±× ¼öÁ¤: ¹«Á¶°Ç Æнº¿öµå·Î Æ÷Ä¿½º°¡ °¡°Ô ¸¸µç´Ù
loginFailureFunc=self.loginFailureFuncDict.get(error, self.SetPasswordEditLineFocus)
 
if app.loggined:
self.PopupNotifyMessage(loginFailureMsg, self.__ExitGame)
else:
self.PopupNotifyMessage(loginFailureMsg, loginFailureFunc)
 
snd.PlaySound("sound/ui/loginfail.wav")
 
def __DisconnectAndInputID(self):
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
self.SetIDEditLineFocus()
net.Disconnect()
 
def __DisconnectAndInputPassword(self):
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
self.SetPasswordEditLineFocus()
net.Disconnect()
 
def __DisconnectAndInputMatrix(self):
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
self.stream.popupWindow.Close()
self.matrixInputChanceCount -= 1
 
if self.matrixInputChanceCount <= 0:
self.__OnCloseInputDialog()
 
elif self.inputDialog:
self.inputDialog.Show()
 
def __LoadScript(self, fileName):
try:
pyScrLoader = ui.PythonScriptLoader()
pyScrLoader.LoadScriptFile(self, fileName)
except:
import exception
exception.Abort("LoginWindow.__LoadScript.LoadObject")
 
try:
GetObject=self.GetChild
self.serverBoard = GetObject("ServerBoard")
self.serverList = GetObject("ServerList")
self.channelList = GetObject("ChannelList")
self.serverSelectButton = GetObject("ServerSelectButton")
self.serverExitButton = GetObject("ServerExitButton")
self.connectBoard = GetObject("ConnectBoard")
self.loginBoard = GetObject("LoginBoard")
self.idEditLine = GetObject("ID_EditLine")
self.pwdEditLine = GetObject("Password_EditLine")
self.serverInfo = GetObject("ConnectName")
self.selectConnectButton = GetObject("SelectConnectButton")
self.loginButton = GetObject("LoginButton")
self.loginExitButton = GetObject("LoginExitButton")
 
if localeInfo.IsVIETNAM():
self.checkButton = GetObject("CheckButton")
self.checkButton.Down()
 
# RUNUP_MATRIX_AUTH
if IsRunupMatrixAuth():
self.matrixQuizBoard = GetObject("RunupMatrixQuizBoard")
self.matrixAnswerInput = GetObject("RunupMatrixAnswerInput")
self.matrixAnswerOK = GetObject("RunupMatrixAnswerOK")
self.matrixAnswerCancel = GetObject("RunupMatrixAnswerCancel")
# RUNUP_MATRIX_AUTH_END
 
# NEWCIBN_PASSPOD_AUTH
if IsNEWCIBNPassPodAuth():
self.passpodBoard = GetObject("NEWCIBN_PASSPOD_BOARD")
self.passpodAnswerInput = GetObject("NEWCIBN_PASSPOD_INPUT")
self.passpodAnswerOK = GetObject("NEWCIBN_PASSPOD_OK")
self.passpodAnswerCancel= GetObject("NEWCIBN_PASSPOD_CANCEL")
# NEWCIBN_PASSPOD_AUTH_END
 
self.virtualKeyboard = self.GetChild2("VirtualKeyboard")
 
if self.virtualKeyboard:
self.VIRTUAL_KEY_ALPHABET_UPPERS = Suffle(localeInfo.VIRTUAL_KEY_ALPHABET_UPPERS)
self.VIRTUAL_KEY_ALPHABET_LOWERS = "".join([localeInfo.VIRTUAL_KEY_ALPHABET_LOWERS[localeInfo.VIRTUAL_KEY_ALPHABET_UPPERS.index(e)] for e in self.VIRTUAL_KEY_ALPHABET_UPPERS])
if localeInfo.IsBRAZIL():
self.VIRTUAL_KEY_SYMBOLS_BR = Suffle(localeInfo.VIRTUAL_KEY_SYMBOLS_BR)
else:
self.VIRTUAL_KEY_SYMBOLS = Suffle(localeInfo.VIRTUAL_KEY_SYMBOLS)
self.VIRTUAL_KEY_NUMBERS = Suffle(localeInfo.VIRTUAL_KEY_NUMBERS)
self.__VirtualKeyboard_SetAlphabetMode()
 
self.GetChild("key_space").SetEvent(lambda : self.__VirtualKeyboard_PressKey(' '))
self.GetChild("key_backspace").SetEvent(lambda : self.__VirtualKeyboard_PressBackspace())
self.GetChild("key_enter").SetEvent(lambda : self.__VirtualKeyboard_PressReturn())
self.GetChild("key_shift").SetToggleDownEvent(lambda : self.__VirtualKeyboard_SetUpperMode())
self.GetChild("key_shift").SetToggleUpEvent(lambda : self.__VirtualKeyboard_SetLowerMode())
self.GetChild("key_at").SetToggleDownEvent(lambda : self.__VirtualKeyboard_SetSymbolMode())
self.GetChild("key_at").SetToggleUpEvent(lambda : self.__VirtualKeyboard_SetAlphabetMode())
 
except:
import exception
exception.Abort("LoginWindow.__LoadScript.BindObject")
 
if self.IS_TEST:
self.selectConnectButton.Hide()
else:
self.selectConnectButton.SetEvent(ui.__mem_func__(self.__OnClickSelectConnectButton))
 
self.serverBoard.OnKeyUp = ui.__mem_func__(self.__ServerBoard_OnKeyUp)
self.xServerBoard, self.yServerBoard = self.serverBoard.GetLocalPosition()
 
self.serverSelectButton.SetEvent(ui.__mem_func__(self.__OnClickSelectServerButton))
self.serverExitButton.SetEvent(ui.__mem_func__(self.__OnClickExitButton))
 
self.loginButton.SetEvent(ui.__mem_func__(self.__OnClickLoginButton))
self.loginExitButton.SetEvent(ui.__mem_func__(self.__OnClickExitButton))
 
self.serverList.SetEvent(ui.__mem_func__(self.__OnSelectServer))
 
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))
 
# RUNUP_MATRIX_AUTH
if IsRunupMatrixAuth():
self.matrixAnswerOK.SAFE_SetEvent(self.__OnClickMatrixAnswerOK)
self.matrixAnswerCancel.SAFE_SetEvent(self.__OnClickMatrixAnswerCancel)
self.matrixAnswerInput.SAFE_SetReturnEvent(self.__OnClickMatrixAnswerOK)
# RUNUP_MATRIX_AUTH_END
 
# NEWCIBN_PASSPOD_AUTH
if IsNEWCIBNPassPodAuth():
self.passpodAnswerOK.SAFE_SetEvent(self.__OnClickNEWCIBNPasspodAnswerOK)
self.passpodAnswerCancel.SAFE_SetEvent(self.__OnClickNEWCIBNPasspodAnswerCancel)
self.passpodAnswerInput.SAFE_SetReturnEvent(self.__OnClickNEWCIBNPasspodAnswerOK)
 
# NEWCIBN_PASSPOD_AUTH_END
 
 
if IsFullBackImage():
self.GetChild("bg1").Show()
self.GetChild("bg2").Hide()
return 1
 
def __VirtualKeyboard_SetKeys(self, keyCodes):
uiDefFontBackup = localeInfo.UI_DEF_FONT
localeInfo.UI_DEF_FONT = localeInfo.UI_DEF_FONT_LARGE
 
keyIndex = 1
for keyCode in keyCodes:
key = self.GetChild2("key_%d" % keyIndex)
if key:
key.SetEvent(lambda x=keyCode: self.__VirtualKeyboard_PressKey(x))
key.SetText(keyCode)
key.ButtonText.SetFontColor(0, 0, 0)
keyIndex += 1
 
for keyIndex in xrange(keyIndex, VIRTUAL_KEYBOARD_NUM_KEYS+1):
key = self.GetChild2("key_%d" % keyIndex)
if key:
key.SetEvent(lambda x=' ': self.__VirtualKeyboard_PressKey(x))
key.SetText(' ')
 
localeInfo.UI_DEF_FONT = uiDefFontBackup
 
def __VirtualKeyboard_PressKey(self, code):
ime.PasteString(code)
 
#if self.virtualKeyboardMode == "ALPHABET" and self.virtualKeyboardIsUpper:
# self.__VirtualKeyboard_SetLowerMode()
 
def __VirtualKeyboard_PressBackspace(self):
ime.PasteBackspace()
 
def __VirtualKeyboard_PressReturn(self):
ime.PasteReturn()
 
def __VirtualKeyboard_SetUpperMode(self):
self.virtualKeyboardIsUpper = TRUE
 
if self.virtualKeyboardMode == "ALPHABET":
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_ALPHABET_UPPERS)
elif self.virtualKeyboardMode == "NUMBER":
if localeInfo.IsBRAZIL():
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_SYMBOLS_BR)
else:
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_SYMBOLS)
else:
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_NUMBERS)
 
def __VirtualKeyboard_SetLowerMode(self):
self.virtualKeyboardIsUpper = FALSE
 
if self.virtualKeyboardMode == "ALPHABET":
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_ALPHABET_LOWERS)
elif self.virtualKeyboardMode == "NUMBER":
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_NUMBERS)
else:
if localeInfo.IsBRAZIL():
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_SYMBOLS_BR)
else:
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_SYMBOLS)
 
def __VirtualKeyboard_SetAlphabetMode(self):
self.virtualKeyboardIsUpper = FALSE
self.virtualKeyboardMode = "ALPHABET"
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_ALPHABET_LOWERS)
 
def __VirtualKeyboard_SetNumberMode(self):
self.virtualKeyboardIsUpper = FALSE
self.virtualKeyboardMode = "NUMBER"
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_NUMBERS)
 
def __VirtualKeyboard_SetSymbolMode(self):
self.virtualKeyboardIsUpper = FALSE
self.virtualKeyboardMode = "SYMBOL"
if localeInfo.IsBRAZIL():
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_SYMBOLS_BR)
else:
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_SYMBOLS)
 
def Connect(self, id, pwd, Hwid, Snn):
    global Hwid, Snn
    if constInfo.SEQUENCE_PACKET_ENABLE:
        net.SetPacketSequenceMode()
         
    if IsLoginDelay():
        loginDelay = GetLoginDelay()
        self.connectingDialog = ConnectingDialog()
        self.connectingDialog.Open(loginDelay)
        self.connectingDialog.SAFE_SetTimeOverEvent(self.OnEndCountDown)
        self.connectingDialog.SAFE_SetExitEvent(self.OnPressExitKey)
        self.isNowCountDown = TRUE
 
    else:
        self.stream.popupWindow.Close()
        self.stream.popupWindow.Open(localeInfo.LOGIN_CONNETING, self.SetPasswordEditLineFocus, localeInfo.UI_CANCEL)
         
    self.stream.SetLoginInfo(id, pwd, Hwid, Snn)
    self.stream.Connect()
 
def __OnClickExitButton(self):
self.stream.SetPhaseWindow(0)
 
def __SetServerInfo(self, name):
net.SetServerInfo(name.strip())
self.serverInfo.SetText(name)
 
def __LoadLoginInfo(self, loginInfoFileName):
global Hwid, Snn
 
try:
loginInfo={}
execfile(loginInfoFileName, loginInfo)
except IOError:
print(
"ÀÚµ¿ ·Î±×ÀÎÀ» ÇϽ÷Á¸é" + loginInfoFileName + "ÆÄÀÏÀ» ÀÛ¼ºÇØÁÖ¼¼¿än"
"n"
"³»¿ë:n"
"================================================================n"
"addr=ÁÖ¼Òn"
"port=Æ÷Æ®n"
"id=¾ÆÀ̵ðn"
"pwd=ºñ¹Ð¹øÈ£n"
"slot=ij¸¯ÅÍ ¼±Åà À妽º (¾ø°Å³ª -1À̸é ÀÚµ¿ ¼±Åà ¾ÈÇÔ)n"
"autoLogin=ÀÚµ¿ Á¢¼Ó ¿©ºÎn"
"autoSelect=ÀÚµ¿ Á¢¼Ó ¿©ºÎn"
"localeInfo=(ymir) LC_Ymir ÀÏ°æ¿ì ymir·Î ÀÛµ¿. ÁöÁ¤ÇÏÁö ¾ÊÀ¸¸é korea·Î ÀÛµ¿n"
);
 
id=loginInfo.get("id", "")
pwd=loginInfo.get("pwd", "")
 
if self.IS_TEST:
try:
addr=loginInfo["addr"]
port=loginInfo["port"]
account_addr=addr
account_port=port
 
net.SetMarkServer(addr, port)
self.__SetServerInfo(localeInfo.CHANNEL_TEST_SERVER_ADDR % (addr, port))
except:
try:
addr=serverInfo.TESTADDR["ip"]
port=serverInfo.TESTADDR["tcp_port"]
 
net.SetMarkServer(addr, port)
self.__SetServerInfo(localeInfo.CHANNEL_TEST_SERVER)
except:
import exception
exception.Abort("LoginWindow.__LoadLoginInfo - Å×½ºÆ®¼­¹ö ÁÖ¼Ò°¡ ¾ø½À´Ï´Ù")
 
else:
addr=loginInfo.get("addr", "")
port=loginInfo.get("port", 0)
account_addr=loginInfo.get("account_addr", addr)
account_port=loginInfo.get("account_port", port)
 
localeInfo = loginInfo.get("localeInfo", "")
 
if addr and port:
net.SetMarkServer(addr, port)
 
if localeInfo == "ymir" :
net.SetServerInfo("õ¸¶ ¼­¹ö")
self.serverInfo.SetText("Y:"+addr+":"+str(port))
else:
net.SetServerInfo(addr+":"+str(port))
self.serverInfo.SetText("K:"+addr+":"+str(port))
 
slot=loginInfo.get("slot", 0)
isAutoLogin=loginInfo.get("auto", 0)
isAutoLogin=loginInfo.get("autoLogin", 0)
isAutoSelect=loginInfo.get("autoSelect", 0)
 
self.stream.SetCharacterSlot(slot)
self.stream.SetConnectInfo(addr, port, account_addr, account_port)
self.stream.isAutoLogin=isAutoLogin
self.stream.isAutoSelect=isAutoSelect
 
self.id = None
self.pwd = None
self.Hwid = Hwid
self.Snn = Snn
self.loginnedServer = None
self.loginnedChannel = None
app.loggined = FALSE
 
self.loginInfo = loginInfo
 
if self.id and self.pwd:
app.loggined = TRUE
 
if isAutoLogin:
self.Connect(id, pwd, Hwid, Snn)
 
print "=================================================================================="
print "ÀÚµ¿ ·Î±×ÀÎ: %s - %s:%d %s" % (loginInfoFileName, addr, port, id)
print "=================================================================================="
 
 
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)
 
# RUNUP_MATRIX_AUTH
def BINARY_OnRunupMatrixQuiz(self, quiz):
if not IsRunupMatrixAuth():
return
 
id = self.GetChild("RunupMatrixID")
id.SetText(self.idEditLine.GetText())
 
code = self.GetChild("RunupMatrixCode")
 
code.SetText("".join(["[%c,%c]" % (quiz, quiz[i+1]) for i in xrange(0, len(quiz), 2)]))
 
self.stream.popupWindow.Close()
self.serverBoard.Hide()
self.connectBoard.Hide()
self.loginBoard.Hide()
self.matrixQuizBoard.Show()
self.matrixAnswerInput.SetFocus()
 
def __OnClickMatrixAnswerOK(self):
answer = self.matrixAnswerInput.GetText()
 
print "matrix_quiz.ok"
net.SendRunupMatrixCardPacket(answer)
self.matrixQuizBoard.Hide()
 
self.stream.popupWindow.Close()
self.stream.popupWindow.Open("WAITING FOR MATRIX AUTHENTICATION", 
self.__OnClickMatrixAnswerCancel, 
localeInfo.UI_CANCEL)
 
def __OnClickMatrixAnswerCancel(self):
print "matrix_quiz.cancel"
 
if self.matrixQuizBoard:
self.matrixQuizBoard.Hide()
 
if self.connectBoard:
self.connectBoard.Show()
 
if self.loginBoard:
self.loginBoard.Show()
 
# RUNUP_MATRIX_AUTH_END
 
# NEWCIBN_PASSPOD_AUTH
def BINARY_OnNEWCIBNPasspodRequest(self):
if not IsNEWCIBNPassPodAuth():
return
 
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
self.stream.popupWindow.Close()
self.serverBoard.Hide()
self.connectBoard.Hide()
self.loginBoard.Hide()
self.passpodBoard.Show()
self.passpodAnswerInput.SetFocus()
 
def BINARY_OnNEWCIBNPasspodFailure(self):
if not IsNEWCIBNPassPodAuth():
return
 
def __OnClickNEWCIBNPasspodAnswerOK(self):
answer = self.passpodAnswerInput.GetText()
 
print "passpod.ok"
net.SendNEWCIBNPasspodAnswerPacket(answer)
self.passpodAnswerInput.SetText("")
self.passpodBoard.Hide()
 
self.stream.popupWindow.Close()
self.stream.popupWindow.Open(localeInfo.WAIT_FOR_PASSPOD, 
self.__OnClickNEWCIBNPasspodAnswerCancel, 
localeInfo.UI_CANCEL)
 
def __OnClickNEWCIBNPasspodAnswerCancel(self):
print "passpod.cancel"
 
if self.passpodBoard:
self.passpodBoard.Hide()
 
if self.connectBoard:
self.connectBoard.Show()
 
if self.loginBoard:
self.loginBoard.Show()
 
# NEWCIBN_PASSPOD_AUTH_END
 
 
def OnMatrixCard(self, row1, row2, row3, row4, col1, col2, col3, col4):
 
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
 
self.matrixInputChanceCount = 3
 
self.stream.popupWindow.Close()
 
# CHINA_MATRIX_CARD_BUG_FIX
## A~Z ±îÁö 26 À̳»ÀÇ °ªÀÌ µé¾îÀÖ¾î¾ß¸¸ ÇÑ´Ù.
## Python Exception Log ¿¡¼­ ±× ÀÌ»óÀÇ °ªÀÌ µé¾îÀ־ ¿¡·¯ ¹æÁö
## Çåµ¥ ¿Ö Çѱ¹ÂÊ ·Î±×¿¡¼­ ÀÌ°Ô È°¿ëµÇ´ÂÁö´Â ¸ð¸£°ÚÀ½
row1 = min(30, row1)
row2 = min(30, row2)
row3 = min(30, row3)
row4 = min(30, row4)
# END_OF_CHINA_MATRIX_CARD_BUG_FIX
 
row1 = chr(row1 + ord('A'))
row2 = chr(row2 + ord('A'))
row3 = chr(row3 + ord('A'))
row4 = chr(row4 + ord('A'))
col1 = col1 + 1
col2 = col2 + 1
col3 = col3 + 1
col4 = col4 + 1
 
inputDialog = uiCommon.InputDialogWithDescription2()
inputDialog.SetMaxLength(8)
inputDialog.SetAcceptEvent(ui.__mem_func__(self.__OnAcceptMatrixCardData))
inputDialog.SetCancelEvent(ui.__mem_func__(self.__OnCancelMatrixCardData))
inputDialog.SetTitle(localeInfo.INPUT_MATRIX_CARD_TITLE)
inputDialog.SetDescription1(localeInfo.INPUT_MATRIX_CARD_NUMBER)
inputDialog.SetDescription2("%c%d %c%d %c%d %c%d" % (row1, col1,
row2, col2,
row3, col3,
row4, col4))
 
inputDialog.Open()
self.inputDialog = inputDialog
 
def __OnAcceptMatrixCardData(self):
text = self.inputDialog.GetText()
net.SendChinaMatrixCardPacket(text)
if self.inputDialog:
self.inputDialog.Hide()
self.PopupNotifyMessage(localeInfo.LOGIN_PROCESSING)
return TRUE
 
def __OnCancelMatrixCardData(self):
self.SetPasswordEditLineFocus()
self.__OnCloseInputDialog()
self.__DisconnectAndInputPassword()
return TRUE
 
def __OnCloseInputDialog(self):
if self.inputDialog:
self.inputDialog.Close()
self.inputDialog = None
return TRUE
 
def OnPressExitKey(self):
self.stream.popupWindow.Close()
self.stream.SetPhaseWindow(0)
return TRUE
 
def OnExit(self):
self.stream.popupWindow.Close()
self.stream.popupWindow.Open(localeInfo.LOGIN_FAILURE_WRONG_MATRIX_CARD_NUMBER_TRIPLE, app.Exit, localeInfo.UI_OK)
 
def OnUpdate(self):
ServerStateChecker.Update()
 
def EmptyFunc(self):
pass
 
#####################################################################################
 
def __ServerBoard_OnKeyUp(self, key):
if self.serverBoard.IsShow():
if app.DIK_RETURN==key:
self.__OnClickSelectServerButton()
return TRUE
 
def __GetRegionID(self):
return 0
 
def __GetServerID(self):
return self.serverList.GetSelectedItem()
 
def __GetChannelID(self):
return self.channelList.GetSelectedItem()
 
# SEVER_LIST_BUG_FIX
def __ServerIDToServerIndex(self, regionID, targetServerID):
try:
regionDict = serverInfo.REGION_DICT[regionID]
except KeyError:
return -1
 
retServerIndex = 0
for eachServerID, regionDataDict in regionDict.items():
if eachServerID == targetServerID:
return retServerIndex
 
retServerIndex += 1
 
return -1
 
def __ChannelIDToChannelIndex(self, channelID):
return channelID - 1
# END_OF_SEVER_LIST_BUG_FIX
 
def __OpenServerBoard(self):
 
loadRegionID, loadServerID, loadChannelID = self.__LoadChannelInfo()
 
serverIndex = self.__ServerIDToServerIndex(loadRegionID, loadServerID)
channelIndex = self.__ChannelIDToChannelIndex(loadChannelID)
 
# RUNUP_MATRIX_AUTH
if IsRunupMatrixAuth():
self.matrixQuizBoard.Hide()
# RUNUP_MATRIX_AUTH_END
 
# NEWCIBN_PASSPOD_AUTH
if IsNEWCIBNPassPodAuth():
self.passpodBoard.Hide()
# NEWCIBN_PASSPOD_AUTH_END
 
 
self.serverList.SelectItem(serverIndex)
 
if localeInfo.IsEUROPE():
self.channelList.SelectItem(app.GetRandom(0, self.channelList.GetItemCount()))
else:
if channelIndex >= 0:
self.channelList.SelectItem(channelIndex)
 
## Show/Hide Äڵ忡 ¹®Á¦°¡ À־ Àӽà - [levites]
self.serverBoard.SetPosition(self.xServerBoard, self.yServerBoard)
self.serverBoard.Show()
self.connectBoard.Hide()
self.loginBoard.Hide()
 
if self.virtualKeyboard:
self.virtualKeyboard.Hide()
 
if app.loggined and not SKIP_LOGIN_PHASE_SUPPORT_CHANNEL:
self.serverList.SelectItem(self.loginnedServer-1)
self.channelList.SelectItem(self.loginnedChannel-1)
self.__OnClickSelectServerButton()
 
def __OpenLoginBoard(self):
 
self.serverExitButton.SetEvent(ui.__mem_func__(self.__OnClickExitServerButton))
self.serverExitButton.SetText(localeInfo.UI_CLOSE)
 
# RUNUP_MATRIX_AUTH
if IsRunupMatrixAuth():
self.matrixQuizBoard.Hide()
# RUNUP_MATRIX_AUTH_END
 
# NEWCIBN_PASSPOD_AUTH
if IsNEWCIBNPassPodAuth():
self.passpodBoard.Hide()
# NEWCIBN_PASSPOD_AUTH_END
 
self.serverBoard.SetPosition(self.xServerBoard, wndMgr.GetScreenHeight())
self.serverBoard.Hide()
 
if self.virtualKeyboard:
self.virtualKeyboard.Show()
 
if app.loggined:
self.Connect(self.id, self.pwd)
self.connectBoard.Hide()
self.loginBoard.Hide()
elif not self.stream.isAutoLogin:
self.connectBoard.Show()
self.loginBoard.Show()
 
## if users have the login infomation, then don't initialize.2005.9 haho
if self.idEditLine == None:
self.idEditLine.SetText("")
if self.pwdEditLine == None:
self.pwdEditLine.SetText("")
 
self.idEditLine.SetFocus()
 
global SKIP_LOGIN_PHASE
if SKIP_LOGIN_PHASE:
if not self.loginInfo:
self.connectBoard.Hide()
 
def __OnSelectRegionGroup(self):
self.__RefreshServerList()
 
def __OnSelectSettlementArea(self):
# SEVER_LIST_BUG_FIX
regionID = self.__GetRegionID()
serverID = self.serverListOnRegionBoard.GetSelectedItem()
 
serverIndex = self.__ServerIDToServerIndex(regionID, serverID)
self.serverList.SelectItem(serverIndex)
# END_OF_SEVER_LIST_BUG_FIX
 
self.__OnSelectServer()
 
def __RefreshServerList(self):
regionID = self.__GetRegionID()
 
if not serverInfo.REGION_DICT.has_key(regionID):
return
 
self.serverList.ClearItem()
 
regionDict = serverInfo.REGION_DICT[regionID]
 
# SEVER_LIST_BUG_FIX
visible_index = 1
for id, regionDataDict in regionDict.items():
name = regionDataDict.get("name", "noname")
if localeInfo.IsBRAZIL() or localeInfo.IsCANADA():
self.serverList.InsertItem(id, "%s" % (name))
else:
if localeInfo.IsCIBN10():
if name[0] == "#":
self.serverList.InsertItem(-1, "  %s" % (name[1:]))
else:
self.serverList.InsertItem(id, "  %s" % (name))
visible_index += 1
else:
try:
server_id = serverInfo.SERVER_ID_DICT[id]
except:
server_id = visible_index
 
self.serverList.InsertItem(id, "  %02d. %s" % (int(server_id), name))
 
visible_index += 1
 
# END_OF_SEVER_LIST_BUG_FIX
 
def __OnSelectServer(self):
self.__OnCloseInputDialog()
self.__RequestServerStateList()
self.__RefreshServerStateList()
 
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
 
ServerStateChecker.Initialize();
for id, channelDataDict in channelDict.items():
key=channelDataDict["key"]
ip=channelDataDict["ip"]
udp_port=channelDataDict["udp_port"]
ServerStateChecker.AddChannel(key, ip, udp_port)
 
ServerStateChecker.Request()
 
def __RefreshServerStateList(self):
 
regionID = self.__GetRegionID()
serverID = self.__GetServerID()
bakChannelID = self.channelList.GetSelectedItem()
 
self.channelList.ClearItem()
 
try:
channelDict = serverInfo.REGION_DICT[regionID][serverID]["channel"]
except:
print " __RequestServerStateList - serverInfo.REGION_DICT(%d, %d)" % (regionID, serverID)
return
 
for channelID, channelDataDict in channelDict.items():
channelName = channelDataDict["name"]
channelState = channelDataDict["state"]
self.channelList.InsertItem(channelID, " %s %s" % (channelName, channelState))
 
self.channelList.SelectItem(bakChannelID-1)
 
def __GetChannelName(self, regionID, selServerID, selChannelID):
try:
return serverInfo.REGION_DICT[regionID][selServerID]["channel"][selChannelID]["name"]
except KeyError:
if 9==selChannelID:
return localeInfo.CHANNEL_PVP
else:
return localeInfo.CHANNEL_NORMAL % (selChannelID)
 
def NotifyChannelState(self, addrKey, state):
try:
stateName=serverInfo.STATE_DICT[state]
except:
stateName=serverInfo.STATE_NONE
 
regionID=int(addrKey/1000)
serverID=int(addrKey/10) % 100
channelID=addrKey%10
 
try:
serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["state"] = stateName
self.__RefreshServerStateList()
 
except:
import exception
exception.Abort(localeInfo.CHANNEL_NOT_FIND_INFO)
 
def __OnClickExitServerButton(self):
print "exit server"
self.__OpenLoginBoard()
 
if IsFullBackImage():
self.GetChild("bg1").Hide()
self.GetChild("bg2").Show()
 
 
def __OnClickSelectRegionButton(self):
regionID = self.__GetRegionID()
serverID = self.__GetServerID()
 
if (not serverInfo.REGION_DICT.has_key(regionID)):
self.PopupNotifyMessage(localeInfo.CHANNEL_SELECT_REGION)
return
 
if (not serverInfo.REGION_DICT[regionID].has_key(serverID)):
self.PopupNotifyMessage(localeInfo.CHANNEL_SELECT_SERVER)
return
 
self.__SaveChannelInfo()
 
self.serverExitButton.SetEvent(ui.__mem_func__(self.__OnClickExitServerButton))
self.serverExitButton.SetText(localeInfo.UI_CLOSE)
 
self.__RefreshServerList()
self.__OpenServerBoard()
 
def __OnClickSelectServerButton(self):
if IsFullBackImage():
self.GetChild("bg1").Hide()
self.GetChild("bg2").Show()
 
regionID = self.__GetRegionID()
serverID = self.__GetServerID()
channelID = self.__GetChannelID()
 
if (not serverInfo.REGION_DICT.has_key(regionID)):
self.PopupNotifyMessage(localeInfo.CHANNEL_SELECT_REGION)
return
 
if (not serverInfo.REGION_DICT[regionID].has_key(serverID)):
self.PopupNotifyMessage(localeInfo.CHANNEL_SELECT_SERVER)
return
 
try:
channelDict = serverInfo.REGION_DICT[regionID][serverID]["channel"]
except KeyError:
return
 
try:
state = channelDict[channelID]["state"]
except KeyError:
self.PopupNotifyMessage(localeInfo.CHANNEL_SELECT_CHANNEL)
return
 
# »óÅ°¡ FULL °ú °°À¸¸é ÁøÀÔ ±ÝÁö
if state == serverInfo.STATE_DICT[3]: 
self.PopupNotifyMessage(localeInfo.CHANNEL_NOTIFY_FULL)
return
 
self.__SaveChannelInfo()
 
try:
serverName = serverInfo.REGION_DICT[regionID][serverID]["name"]
channelName = serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["name"]
addrKey = serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["key"]
 
if "õ¸¶ ¼­¹ö" == serverName:
app.ForceSetlocaleInfo("ymir", "localeInfo/ymir")
elif "Äèµµ ¼­¹ö" == serverName:
app.ForceSetlocaleInfo("we_korea", "localeInfo/we_korea")
 
except:
print " ERROR __OnClickSelectServerButton(%d, %d, %d)" % (regionID, serverID, channelID)
serverName = localeInfo.CHANNEL_EMPTY_SERVER
channelName = localeInfo.CHANNEL_NORMAL % channelID
 
self.__SetServerInfo("%s, %s " % (serverName, channelName))
 
try:
ip = serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["ip"]
tcp_port = serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["tcp_port"]
except:
import exception
exception.Abort("LoginWindow.__OnClickSelectServerButton - ¼­¹ö ¼±Åà ½ÇÆÐ")
 
try:
account_ip = serverInfo.REGION_AUTH_SERVER_DICT[regionID][serverID]["ip"]
account_port = serverInfo.REGION_AUTH_SERVER_DICT[regionID][serverID]["port"]
except:
account_ip = 0
account_port = 0
 
try:
markKey = regionID*1000 + serverID*10
markAddrValue=serverInfo.MARKADDR_DICT[markKey]
net.SetMarkServer(markAddrValue["ip"], markAddrValue["tcp_port"])
app.SetGuildMarkPath(markAddrValue["mark"])
# GUILD_SYMBOL
app.SetGuildSymbolPath(markAddrValue["symbol_path"])
# END_OF_GUILD_SYMBOL
 
except:
import exception
exception.Abort("LoginWindow.__OnClickSelectServerButton - ¸¶Å© Á¤º¸ ¾øÀ½")
 
 
if app.USE_OPENID and not app.OPENID_TEST :
## 2012.07.19 OpenID : ±è¿ë¿í
# ä³Î ¼±Åà ȭ¸é¿¡¼­ "È®ÀÎ"(SelectServerButton) À» ´­·¶À»¶§,
# ·Î±×ÀÎ È­¸éÀ¸·Î ³Ñ¾î°¡Áö ¾Ê°í ¹Ù·Î ¼­¹ö¿¡ OpenID ÀÎÁõÅ°¸¦ º¸³»µµ·Ï ¼öÁ¤
self.stream.SetConnectInfo(ip, tcp_port, account_ip, account_port)
self.Connect(0, 0)
else :
self.stream.SetConnectInfo(ip, tcp_port, account_ip, account_port)
self.__OpenLoginBoard()
 
 
def __OnClickSelectConnectButton(self):
if IsFullBackImage():
self.GetChild("bg1").Show()
self.GetChild("bg2").Hide()
self.__RefreshServerList()
self.__OpenServerBoard()
 
def __OnClickLoginButton(self):
global Hwid, Snn
id = self.idEditLine.GetText()
pwd = self.pwdEditLine.GetText()
 
if len(id)==0:
self.PopupNotifyMessage(localeInfo.LOGIN_INPUT_ID, self.SetIDEditLineFocus)
return
 
if len(pwd)==0:
self.PopupNotifyMessage(localeInfo.LOGIN_INPUT_PASSWORD, self.SetPasswordEditLineFocus)
return
 
self.Connect(id, pwd, Hwid, Snn)

 
networkmodule
 

###################################################################################################
# Network
 
import app
import chr
import dbg
import net
import snd
 
import chr
import chrmgr
import background
import player
import playerSettingModule
 
import ui
import uiPhaseCurtain
 
import localeInfo
import constInfo
 
Hwid=constInfo.Hwid
Snn=constInfo.Snn
 
class PopupDialog(ui.ScriptWindow):
 
def __init__(self):
print "NEW POPUP DIALOG ----------------------------------------------------------------------------"
ui.ScriptWindow.__init__(self)
self.CloseEvent = 0
 
def __del__(self):
print "---------------------------------------------------------------------------- DELETE POPUP DIALOG "
ui.ScriptWindow.__del__(self)
 
def LoadDialog(self):
PythonScriptLoader = ui.PythonScriptLoader()
PythonScriptLoader.LoadScriptFile(self, "UIScript/PopupDialog.py")
 
def Open(self, Message, event = 0, ButtonName = localeInfo.UI_CANCEL):
 
if TRUE == self.IsShow():
self.Close()
 
self.Lock()
self.SetTop()
self.CloseEvent = event
 
AcceptButton = self.GetChild("accept")
AcceptButton.SetText(ButtonName)
AcceptButton.SetEvent(ui.__mem_func__(self.Close))
 
self.GetChild("message").SetText(Message)
self.Show()
 
def Close(self):
 
if FALSE == self.IsShow():
self.CloseEvent = 0
return
 
self.Unlock()
self.Hide()
 
if 0 != self.CloseEvent:
self.CloseEvent()
self.CloseEvent = 0
 
def Destroy(self):
self.Close()
self.ClearDictionary()
 
def OnPressEscapeKey(self):
self.Close()
return TRUE
 
def OnIMEReturn(self):
self.Close()
return TRUE
 
##
## Main Stream
##
class MainStream(object):
isChrData=0
 
def __init__(self):
print "NEWMAIN STREAM ----------------------------------------------------------------------------"
net.SetHandler(self)
net.SetTCPRecvBufferSize(128*1024)
net.SetTCPSendBufferSize(4096)
net.SetUDPRecvBufferSize(4096)
 
self.id=""
self.pwd=""
self.Hwid=constInfo.Hwid
self.Snn=constInfo.Snn
self.addr=""
self.port=0
self.account_addr=0
self.account_port=0
self.slot=0
self.isAutoSelect=0
self.isAutoLogin=0
 
self.curtain = 0
self.curPhaseWindow = 0
self.newPhaseWindow = 0
 
def __del__(self):
print "---------------------------------------------------------------------------- DELETE MAIN STREAM "
 
def Destroy(self):
if self.curPhaseWindow:
self.curPhaseWindow.Close()
self.curPhaseWindow = 0
 
if self.newPhaseWindow:
self.newPhaseWindow.Close()
self.newPhaseWindow = 0
 
self.popupWindow.Destroy()
self.popupWindow = 0
 
self.curtain = 0
 
def Create(self):
self.CreatePopupDialog()
 
self.curtain = uiPhaseCurtain.PhaseCurtain()
 
def SetPhaseWindow(self, newPhaseWindow):
if self.newPhaseWindow:
#print "이미 새로운 윈도우로 바꾼상태에서 또 바꿈", newPhaseWindow
self.__ChangePhaseWindow()
 
self.newPhaseWindow=newPhaseWindow
 
if self.curPhaseWindow:
#print "페이드 아웃되면 바꿈"
self.curtain.FadeOut(self.__ChangePhaseWindow)
else:
#print "현재 윈도우가 없는 상태라 바로 바꿈"
self.__ChangePhaseWindow()
 
def __ChangePhaseWindow(self):
oldPhaseWindow=self.curPhaseWindow
newPhaseWindow=self.newPhaseWindow
self.curPhaseWindow=0
self.newPhaseWindow=0
 
if oldPhaseWindow:
oldPhaseWindow.Close()
 
if newPhaseWindow:
newPhaseWindow.Open()
 
self.curPhaseWindow=newPhaseWindow
 
if self.curPhaseWindow:
self.curtain.FadeIn()
else:
app.Exit()
 
def CreatePopupDialog(self):
self.popupWindow = PopupDialog()
self.popupWindow.LoadDialog()
self.popupWindow.SetCenterPosition()
self.popupWindow.Hide()
 
 
## SelectPhase
##########################################################################################
def SetLogoPhase(self):
net.Disconnect()
 
import introLogo
self.SetPhaseWindow(introLogo.LogoWindow(self))
 
def SetLoginPhase(self):
net.Disconnect()
 
import introLogin
self.SetPhaseWindow(introLogin.LoginWindow(self))
 
def SetSelectEmpirePhase(self):
try:
import introEmpire
self.SetPhaseWindow(introEmpire.SelectEmpireWindow(self))
except:
import exception
exception.Abort("networkModule.SetSelectEmpirePhase")
 
 
def SetReselectEmpirePhase(self):
try:
import introEmpire
self.SetPhaseWindow(introEmpire.ReselectEmpireWindow(self))
except:
import exception
exception.Abort("networkModule.SetReselectEmpirePhase")
 
def SetSelectCharacterPhase(self):
try:
localeInfo.LoadLocaleData()
import introSelect
self.popupWindow.Close()
self.SetPhaseWindow(introSelect.SelectCharacterWindow(self))
except:
import exception
exception.Abort("networkModule.SetSelectCharacterPhase")
 
def SetCreateCharacterPhase(self):
try:
import introCreate
self.SetPhaseWindow(introCreate.CreateCharacterWindow(self))
except:
import exception
exception.Abort("networkModule.SetCreateCharacterPhase")
 
def SetTestGamePhase(self, x, y):
try:
import introLoading
loadingPhaseWindow=introLoading.LoadingWindow(self)
loadingPhaseWindow.LoadData(x, y)
self.SetPhaseWindow(loadingPhaseWindow)
except:
import exception
exception.Abort("networkModule.SetLoadingPhase")
 
 
 
def SetLoadingPhase(self):
try:
import introLoading
self.SetPhaseWindow(introLoading.LoadingWindow(self))
except:
import exception
exception.Abort("networkModule.SetLoadingPhase")
 
def SetGamePhase(self):
try:
import game
self.popupWindow.Close()
self.SetPhaseWindow(game.GameWindow(self))
except:
raise
import exception
exception.Abort("networkModule.SetGamePhase")
 
################################
# Functions used in python
 
## Login
def Connect(self):
import constInfo
if constInfo.KEEP_ACCOUNT_CONNETION_ENABLE:
net.ConnectToAccountServer(self.addr, self.port, self.account_addr, self.account_port)
else:
net.ConnectTCP(self.addr, self.port)
 
#net.ConnectUDP(IP, Port)
 
def SetConnectInfo(self, addr, port, account_addr=0, account_port=0):
self.addr = addr
self.port = port
self.account_addr = account_addr
self.account_port = account_port
 
def GetConnectAddr(self):
return self.addr
 
def SetLoginInfo(self, id, pwd, Hwid, Snn):
self.id = id
self.pwd = pwd
self.Hwid = constInfo.Hwid
self.Snn = constInfo.Snn
net.SetLoginInfo(id, pwd, Hwid, Snn)
 
def CancelEnterGame(self):
pass
 
## Select
def SetCharacterSlot(self, slot):
self.slot=slot
 
def GetCharacterSlot(self):
return self.slot
 
## Empty
def EmptyFunction(self):
pass
 

 
I found the problem and that the solution

def Connect(self, id, pwd, Hwid, Snn):
    global Hwid, Snn
    if constInfo.SEQUENCE_PACKET_ENABLE:
        net.SetPacketSequenceMode()
        
    if IsLoginDelay():
        loginDelay = GetLoginDelay()
        self.connectingDialog = ConnectingDialog()
        self.connectingDialog.Open(loginDelay)
        self.connectingDialog.SAFE_SetTimeOverEvent(self.OnEndCountDown)
        self.connectingDialog.SAFE_SetExitEvent(self.OnPressExitKey)
        self.isNowCountDown = TRUE
 
    else:
        self.stream.popupWindow.Close()
        self.stream.popupWindow.Open(localeInfo.LOGIN_CONNETING, self.SetPasswordEditLineFocus, localeInfo.UI_CANCEL)
        
    self.stream.SetLoginInfo(id, pwd, Hwid, Snn)
    self.stream.Connect()
 

Change it to this

global Hwid, Snn
Hwid = constInfo.Hwid
Snn = constInfo.Snn
So getting.

def Connect(self, id, pwd, Hwid, Snn):
# global Hwid 
# global Snn
Hwid = constInfo.Hwid
Snn = constInfo.Snn
if constInfo.SEQUENCE_PACKET_ENABLE:
net.SetPacketSequenceMode()
 
if IsLoginDelay():
loginDelay = GetLoginDelay()
self.connectingDialog = ConnectingDialog()
self.connectingDialog.Open(loginDelay)
self.connectingDialog.SAFE_SetTimeOverEvent(self.OnEndCountDown)
self.connectingDialog.SAFE_SetExitEvent(self.OnPressExitKey)
self.isNowCountDown = TRUE
 
else:
self.stream.popupWindow.Close()
self.stream.popupWindow.Open(localeInfo.LOGIN_CONNETING, self.SetPasswordEditLineFocus, localeInfo.UI_CANCEL)
 
self.stream.SetLoginInfo(id, pwd, Hwid, Snn)
self.stream.Connect()

 

 

Edited by thiagosaliba
  • Love 2
Link to comment
Share on other sites

  • 2 months later...
  • 3 months later...
  • 2 weeks later...
  • 2 months later...

Hi. Problem?

0724 19:15:02121 :: Traceback (most recent call last):

0724 19:15:02121 ::   File "introLogo.py", line 60, in OnUpdate

0724 19:15:02122 ::   File "networkModule.py", line 183, in SetLoginPhase

0724 19:15:02122 ::   File "system.py", line 130, in __pack_import

0724 19:15:02122 ::   File "
0724 19:15:02122 :: introLogin.py
0724 19:15:02122 :: ", line
0724 19:15:02122 :: 698
0724 19:15:02122 ::

0724 19:15:02122 :: SyntaxError
0724 19:15:02122 :: :
0724 19:15:02122 :: name 'Hwid' is local and global
0724 19:15:02122 ::

 

Link to comment
Share on other sites

  • 1 month later...

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.