Example #1
0
 /// <summary>
 ///   Add a Habbo into the cache.
 /// </summary>
 /// <param name = "theHabbo">The Habbo to cache.</param>
 private void CacheHabbo(Habbo theHabbo)
 {
     lock (this)
     {
         // Cache the Habbo.
         _habboCache.Add(theHabbo.GetID(), new WeakReference(theHabbo));
         // Cache the Username-ID.
         _usernameIDCache.Add(theHabbo.GetUsername(), theHabbo.GetID());
     }
 }
        public SubscriptionData(Habbo habbo, string type)
        {
            _habbo = habbo;

            using (ISession db = CoreManager.ServerCore.GetDatabaseSession())
            {
                _subscriptionDatabase = db.CreateCriteria<Subscription>().
                    Add(Restrictions.Eq("habbo_id", _habbo.GetID())).
                    Add(Restrictions.Eq("subscription_type", type)).
                    UniqueResult<Subscription>();
            }
            if (_subscriptionDatabase != null) return;
            _subscriptionDatabase = new Subscription {habbo_id = habbo.GetID()};
        }
Example #3
0
 /// <summary>
 ///   Add a Habbo into the cache.
 /// </summary>
 /// <param name = "theHabbo">The Habbo to cache.</param>
 private void CacheHabbo(Habbo theHabbo)
 {
     lock (this)
     {
         // Cache the Habbo.
         _habboCache.Add(theHabbo.GetID(), new WeakReference(theHabbo));
         // Cache the Username-ID.
         _usernameIDCache.Add(theHabbo.GetUsername(), theHabbo.GetID());
     }
 }
Example #4
0
 /// <summary>
 /// Checks if a given user is friends with this user.
 /// </summary>
 /// <param name="RequireLoggedIn">If true then the user must also be online.</param>
 /// <returns>True if the user is on the friends list (and online if required), false otherwise.</returns>
 public bool IsFriendsWith(Habbo User, bool RequireLoggedIn)
 {
     if (!this.fFriends.ContainsKey(User.GetID()))
         return false;
     if (RequireLoggedIn)
         return User.IsLoggedIn();
     return true;
 }