Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BadgeComponent"/> class.
 /// </summary>
 /// <param name="userId">The user identifier.</param>
 /// <param name="data">The data.</param>
 internal BadgeComponent(uint userId, UserData data)
 {
     BadgeList = new HybridDictionary();
     foreach (var current in data.Badges.Where(current => !BadgeList.Contains(current.Code)))
         BadgeList.Add(current.Code, current);
     _userId = userId;
 }
        /// <summary>
        ///     Initializes a new instance of the <see cref="InventoryComponent" /> class.
        /// </summary>
        /// <param name="userId">The user identifier.</param>
        /// <param name="client">The client.</param>
        /// <param name="userData">The user data.</param>
        internal InventoryComponent(uint userId, GameClient client, UserData userData)
        {
            _mClient = client;
            UserId = userId;
            _floorItems = new HybridDictionary();
            _wallItems = new HybridDictionary();
            SongDisks = new HybridDictionary();

            foreach (var current in userData.Inventory)
            {
                if (current.BaseItem.InteractionType == Interaction.MusicDisc)
                    SongDisks.Add(current.Id, current);
                if (current.IsWallItem)
                    _wallItems.Add(current.Id, current);
                else
                    _floorItems.Add(current.Id, current);
            }

            _inventoryPets = new HybridDictionary();
            _inventoryBots = new HybridDictionary();
            _mAddedItems = new HybridDictionary();
            _mRemovedItems = new HybridDictionary();
            _isUpdated = false;

            foreach (var bot in userData.Bots)
                AddBot(bot.Value);

            foreach (var pets in userData.Pets)
                AddPets(pets.Value);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="AvatarEffectsInventoryComponent"/> class.
 /// </summary>
 /// <param name="userId">The user identifier.</param>
 /// <param name="client">The client.</param>
 /// <param name="data">The data.</param>
 internal AvatarEffectsInventoryComponent(uint userId, GameClient client, UserData data)
 {
     _userId = userId;
     _session = client;
     _effects = new List<AvatarEffect>();
     foreach (var current in data.Effects)
         if (!current.HasExpired)
             _effects.Add(current);
         else
             using (var queryReactor = AzureEmulator.GetDatabaseManager().GetQueryReactor())
                 queryReactor.RunFastQuery("DELETE FROM users_effects WHERE user_id = " + userId + " AND effect_id = " + current.EffectId + "; ");
 }
Esempio n. 4
0
 /// <summary>
 /// Loads the data.
 /// </summary>
 /// <param name="data">The data.</param>
 internal void LoadData(UserData data)
 {
     LoadAchievements(data.Achievements);
     LoadTalents(data.Talents);
     LoadFavorites(data.FavouritedRooms);
     LoadMutedUsers(data.Ignores);
     LoadTags(data.Tags);
 }
Esempio n. 5
0
 /// <summary>
 /// Initializes the information.
 /// </summary>
 /// <param name="data">The data.</param>
 internal void InitInformation(UserData data)
 {
     _subscriptionManager = new SubscriptionManager(Id, data);
     _badgeComponent = new BadgeComponent(Id, data);
     Quests = data.Quests;
     _messenger = new HabboMessenger(Id);
     _messenger.Init(data.Friends, data.Requests);
     SpectatorMode = false;
     Disconnected = false;
     UsersRooms = data.Rooms;
     Relationships = data.Relations;
     AnsweredPolls = data.SuggestedPolls;
 }
Esempio n. 6
0
 /// <summary>
 /// Initializes the specified client.
 /// </summary>
 /// <param name="client">The client.</param>
 /// <param name="data">The data.</param>
 internal void Init(GameClient client, UserData data)
 {
     _mClient = client;
     _subscriptionManager = new SubscriptionManager(Id, data);
     _badgeComponent = new BadgeComponent(Id, data);
     _inventoryComponent = new InventoryComponent(Id, client, data);
     _inventoryComponent.SetActiveState(client);
     _avatarEffectsInventoryComponent = new AvatarEffectsInventoryComponent(Id, client, data);
     Quests = data.Quests;
     _messenger = new HabboMessenger(Id);
     _messenger.Init(data.Friends, data.Requests);
     FriendCount = Convert.ToUInt32(data.Friends.Count);
     SpectatorMode = false;
     Disconnected = false;
     UsersRooms = data.Rooms;
     MinimailUnreadMessages = data.MiniMailCount;
     Relationships = data.Relations;
     AnsweredPolls = data.SuggestedPolls;
     _clothingManager = new UserClothing(Id);
     Preferences = new UserPreferences(Id);
     _youtubeManager = new YoutubeManager(Id);
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="SubscriptionManager" /> class.
 /// </summary>
 /// <param name="userId">The user identifier.</param>
 /// <param name="userData">The user data.</param>
 internal SubscriptionManager(uint userId, UserData userData)
 {
     _userId = userId;
     _subscription = userData.Subscriptions;
 }
Esempio n. 8
0
 /// <summary>
 /// Gets the inventory.
 /// </summary>
 /// <param name="userId">The user identifier.</param>
 /// <param name="client">The client.</param>
 /// <param name="data">The data.</param>
 /// <returns>InventoryComponent.</returns>
 internal static InventoryComponent GetInventory(uint userId, GameClient client, UserData data)
 {
     return new InventoryComponent(userId, client, data);
 }