예제 #1
0
파일: Habbo.cs 프로젝트: 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);
        }
예제 #2
0
 internal void InvokeOnPreHabboLogin(object source, HabboEventArgs e)
 {
     OnHabboLogin.Invoke(source, e);
 }
예제 #3
0
파일: Habbo.cs 프로젝트: 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;
        }
예제 #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);
        }
예제 #5
0
 internal void InvokeOnPreHabboLogin(object source, HabboEventArgs e)
 {
     OnHabboLogin.Invoke(source, e);
 }