Exemplo n.º 1
0
Arquivo: Habbo.cs Projeto: habb0/IHI
        /// <summary>
        ///   Set if the user is logged in.
        ///   This also updates the LastAccess time if required.
        /// </summary>
        /// <param name = "value">The user's new logged in status.</param>
        public Habbo SetLoggedIn(bool value)
        {
            if (!_isLoggedIn && value)
            {
                HabboEventArgs habboEventArgs = new HabboEventArgs();
                if (OnPreHabboLogin != null)
                {
                    OnPreHabboLogin(this, habboEventArgs);
                }

                CoreManager.ServerCore.GetHabboDistributor().InvokeOnPreHabboLogin(this, habboEventArgs);
                if (habboEventArgs.Cancelled)
                {
                    GetConnection().Disconnect();
                    return(this);
                }

                _lastAccess = DateTime.Now;
                using (ISession db = CoreManager.ServerCore.GetDatabaseSession())
                {
                    Database.Habbo habbo = db.Get <Database.Habbo>(_id);
                    habbo.last_access = _lastAccess;
                    db.Update(habbo);
                }
            }

            _isLoggedIn = value;
            return(this);
        }
Exemplo n.º 2
0
 internal void InvokeOnPreHabboLogin(object source, HabboEventArgs e)
 {
     OnHabboLogin.Invoke(source, e);
 }
Exemplo n.º 3
0
Arquivo: Habbo.cs Projeto: habb0/IHI
        /// <summary>
        ///   Set if the user is logged in.
        ///   This also updates the LastAccess time if required.
        /// </summary>
        /// <param name = "value">The user's new logged in status.</param>
        public Habbo SetLoggedIn(bool value)
        {
            if (!_isLoggedIn && value)
            {
                HabboEventArgs habboEventArgs = new HabboEventArgs();
                if (OnPreHabboLogin != null)
                    OnPreHabboLogin(this, habboEventArgs);

                CoreManager.ServerCore.GetHabboDistributor().InvokeOnPreHabboLogin(this, habboEventArgs);
                if (habboEventArgs.Cancelled)
                {
                    GetConnection().Disconnect();
                    return this;
                }

                _lastAccess = DateTime.Now;
                using (ISession db = CoreManager.ServerCore.GetDatabaseSession())
                {
                    Database.Habbo habbo = db.Get<Database.Habbo>(_id);
                    habbo.last_access = _lastAccess;
                    db.Update(habbo);
                }
            }

            _isLoggedIn = value;
            return this;
        }
Exemplo n.º 4
0
        private static void RegisterHandlers(object source, HabboEventArgs args)
        {
            Habbo target = source as Habbo;
            if (target == null)
                return;

            target
                .GetConnection()
                .AddHandler(150, PacketHandlerPriority.DefaultAction, ProcessRequestCategoryListings)
                .AddHandler(151, PacketHandlerPriority.DefaultAction, ProcessRequestUsableCategoryListing)
                .AddHandler(264, PacketHandlerPriority.DefaultAction, ProcessRequestRecommendedRoomListing)
                .AddHandler(16, PacketHandlerPriority.DefaultAction, ProcessRequestOwnRoomListing);
        }
Exemplo n.º 5
0
 internal void InvokeOnPreHabboLogin(object source, HabboEventArgs e)
 {
     OnHabboLogin.Invoke(source, e);
 }