示例#1
0
        public Habbo GetHabbo(string sUsername)
        {
            // TODO: some sort of cache?

            Habbo habbo = new Habbo();
            if (habbo.LoadByUsername(IonEnvironment.GetDatabase(), sUsername))
            {
                return habbo;
            }

            return null;
        }
示例#2
0
        public Habbo Login(string sUsername, string sPassword)
        {
            // Do not use HabboManager.GetHabbo(string) here, as caching is planned to be implemented there
            Habbo habbo = new Habbo();
            if (habbo.LoadByUsername(IonEnvironment.GetDatabase(), sUsername) == false)
                throw new IncorrectLoginException("login incorrect: Wrong username");

            if (habbo.Password != sPassword)
                throw new IncorrectLoginException("login incorrect: Wrong password");

            // Drop old client (if logged in via other connection)
            IonEnvironment.GetHabboHotel().GetClients().KillClientOfHabbo(habbo.ID);

            return habbo;
        }
示例#3
0
        public Habbo Login(string sTicket)
        {
            // Do not use HabboManager.GetHabbo(string) here, as caching is planned to be implemented there
            Habbo habbo = new Habbo();
            if (!habbo.LoadBySsoTicket(IonEnvironment.GetDatabase(), sTicket))
            {
                throw new IncorrectLoginException("login incorrect: Wrong ticket");
            }
            else
            {
                // Drop old client (if logged in via other connection)
                IonEnvironment.GetHabboHotel().GetClients().KillClientOfHabbo(habbo.ID);

                return habbo;
            }
        }
示例#4
0
        public Habbo GetHabbo(uint ID)
        {
            // Prefer active client over Database
            GameClient client = IonEnvironment.GetHabboHotel().GetClients().GetClientOfHabbo(ID);
            if (client != null)
            {
                return client.GetHabbo();
            }
            else
            {
                Habbo habbo = new Habbo();
                if (habbo.LoadByID(IonEnvironment.GetDatabase(), ID))
                {
                    return habbo;
                }
            }

            return null;
        }
示例#5
0
 public bool UpdateHabbo(Habbo habbo)
 {
     return(IonEnvironment.GetDatabase().UPDATE(habbo));
 }
示例#6
0
        /// <summary>
        /// Stops the client, removes this user from room, updates last online values etc.
        /// </summary>
        public void Stop()
        {
            // Leave room
            // Update last online
            mHabbo = null;
            mConnection = null;

            mMessageHandler.Destroy();
            mMessageHandler = null;
        }
示例#7
0
        /// <summary>
        /// Attempts to reload the Habbo DataObject of this session from the Database. If no DataObject is found anymore, the old one is kept.
        /// </summary>
        public bool ReloadUserObject()
        {
            if (mHabbo != null)
            {
                Habbo newObject = IonEnvironment.GetHabboHotel().GetHabbos().GetHabbo(mHabbo.ID);
                if (newObject != null)
                {
                    mHabbo = newObject;
                    return true;
                }
            }

            return false;
        }
示例#8
0
        /// <summary>
        /// Tries to login this client on a Habbo account with a given username and password.
        /// </summary>
        /// <param name="sUsername">The username of the Habbo to attempt to login on.</param>
        /// <param name="sPassword">The login password of the Habbo username. Case sensitive.</param>
        public void Login(string sUsername, string sPassword)
        {
            try
            {
                // Try to login
                mHabbo = IonEnvironment.GetHabboHotel().GetAuthenticator().Login(sUsername, sPassword);

                // Authenticator has forced unique login now
                this.CompleteLogin();
            }
            catch (IncorrectLoginException exLogin)
            {
                SendClientError(exLogin.Message);
            }
            catch (ModerationBanException exBan)
            {
                SendBanMessage(exBan.Message);
            }
        }
示例#9
0
 public bool UpdateHabbo(Habbo habbo)
 {
     return IonEnvironment.GetDatabase().UPDATE(habbo);
 }