/// <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); }
internal void InvokeOnPreHabboLogin(object source, HabboEventArgs e) { OnHabboLogin.Invoke(source, e); }
/// <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; }
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); }