// 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"); IAccount 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); }