Beispiel #1
0
        // This function callback validates an account and returns true if it has access
        // rights to use this tool.
        private static LoginCodes OnLogin(OrbClientInfo clientInfo, string password)
        {
            LoginCodes code = LoginCodes.Success;

            //Console.WriteLine("OnValidateAccount");
            Account account = Accounts.GetAccount(clientInfo.UserName);

            if (account == null || account.CheckPassword(password) == false)
            {
                code = LoginCodes.InvalidAccount;
            }
            else
            {
                if (!IsAccessAllowed(account, REQUIRED_ACCESS_LEVEL))
                {
                    Mobile player = GetOnlineMobile(account);

                    if (player == null || !IsAccessAllowed(player, REQUIRED_ACCESS_LEVEL))
                    {
                        // Neither the account or the char the account is logged in with has
                        // the required accesslevel to make this connection.
                        code = LoginCodes.NotAuthorized;
                    }
                }

                Console.WriteLine("{0} connected to the Orb Script Server", account.Username);
            }

            if (code == LoginCodes.Success)
            {
                if (m_Clients.ContainsKey(clientInfo.ClientID))
                {
                    m_Clients.Remove(clientInfo.ClientID);
                }

                m_Clients.Add(clientInfo.ClientID, new OrbClientState(clientInfo, account, DateTime.Now));
            }

            return(code);
        }
Beispiel #2
0
 internal LoginResult(LoginCodes code, string errorMessage) : this(code, errorMessage, null)
 {
 }
Beispiel #3
0
 internal LoginResult(LoginCodes code, string errorMessage, Exception e)
 {
     Code           = code;
     ErrorMessage   = errorMessage;
     LoginException = e;
 }
Beispiel #4
0
 internal LoginResult(LoginCodes code) : this(code, null, null)
 {
 }