Go to the documentation of this file.00001 '''
00002 Anoria (c) Gsk 2010
00003 '''
00004
00005
00006 import BigWorld
00007 import ResMgr
00008
00009
00010 class LoginParams( object ):
00011 ''' this is currently only a dummy '''
00012 def __init__(self):
00013 self.username = 'user'
00014 self.password = 'password'
00015
00016
00017 class ConnectionManager():
00018 ''' This is the ConnectionManager for the Anoria Client
00019 it handles all details related to the client's connection to the server
00020 '''
00021
00022 __instance = None
00023
00024 def __init__(self):
00025 if ConnectionManager.__instance: return
00026 ConnectionManager.__instance=self;
00027
00028 def doConnect(self, host, ):
00029 BigWorld.resetEntityManager( False, True )
00030 BigWorld.clearAllSpaces( True )
00031 print "ConnectionManager(): initiating connection to server ..."
00032 BigWorld.connect(host, LoginParams(), self._connectionCallback)
00033
00034
00035 def _connectionCallback(self, stage, status, serverMsg):
00036 '''Callback trig by BigWorld to report on the status of the connection.
00037 Logs the status in the console and update the GUI accordingly.
00038 '''
00039
00040
00041
00042 loginErrorStrs = {
00043 'NOT_SET' : 'Not set',
00044 'LOGGED_ON' : 'Account Login succeeded',
00045 'CONNECTION_FAILED' : 'Login failed: Unable to contact login server',
00046 'DNS_LOOKUP_FAILED' : 'Login failed: DNS lookup failed',
00047 'UNKNOWN_ERROR' : 'Login failed: Unknown local client error',
00048 'CANCELLED' : 'Login failed: Login cancelled',
00049 'ALREADY_ONLINE_LOCALLY' : 'Login failed: Already online',
00050 'PUBLIC_KEY_LOOKUP_FAILED' : 'Login failed: Public key lookup failed',
00051 'LOGIN_MALFORMED_REQUEST' : 'Login failed: Malformed login request',
00052 'LOGIN_BAD_PROTOCOL_VERSION' : 'Login failed: Wrong protocol version',
00053 'LOGIN_REJECTED_NO_SUCH_USER' : 'Login failed: No such user: %(username)s',
00054 'LOGIN_REJECTED_INVALID_PASSWORD' : 'Login failed: Invalid password',
00055 'LOGIN_REJECTED_ALREADY_LOGGED_IN' : 'Login failed: Someone with account name %(username)s already logged in',
00056 'LOGIN_REJECTED_BAD_DIGEST' : 'Login failed: Defs digest mismatch',
00057 'LOGIN_REJECTED_DB_GENERAL_FAILURE' : 'Login failed: Misc database rejection',
00058 'LOGIN_REJECTED_DB_NOT_READY' : 'Login failed: Unable to contact server database',
00059 'LOGIN_REJECTED_ILLEGAL_CHARACTERS' : 'Login failed: Illegal characters in user name/password',
00060 'LOGIN_REJECTED_SERVER_NOT_READY' : 'Login failed: Server not ready',
00061 'LOGIN_REJECTED_UPDATER_NOT_READY' : 'Login failed: Unable to contact Updater',
00062 'LOGIN_REJECTED_NO_BASEAPPS' : 'Login failed: Unable to contact BaseApps',
00063 'LOGIN_REJECTED_BASEAPP_OVERLOAD' : 'Login failed: BaseApp overloaded',
00064 'LOGIN_REJECTED_CELLAPP_OVERLOAD' : 'Login failed: CellApp overloaded',
00065 'LOGIN_REJECTED_BASEAPP_TIMEOUT' : 'Login failed: BaseApp timed-out',
00066 'LOGIN_REJECTED_BASEAPPMGR_TIMEOUT' : 'Login failed: BaseAppMgr overloaded',
00067 'LOGIN_REJECTED_DBMGR_OVERLOAD' : 'Login failed: Database overloaded',
00068 'LOGIN_REJECTED_LOGINS_NOT_ALLOWED' : 'Login failed: Logins not allowed',
00069 }
00070
00071 if stage == 1 :
00072 defaultMsg = serverMsg if serverMsg else 'Unknown server error'
00073 errorMsg = loginErrorStrs.get(status, defaultMsg)
00074 print errorMsg
00075
00076
00077
00078
00079
00080 ''' dunno what these do in the original FD logic yet
00081 elif stage == 2:
00082 if status == 'OFFLINE':
00083 _proceedTooLevel().run()
00084 else:
00085 _showCharacterSelectionScreen().run()
00086
00087 elif stage == 6:
00088 handleDisconnectionFromServer().run()
00089 '''
00090
00091
00092 service = ConnectionManager()