internal AvatarEffectsInventoryComponent(uint UserId, GameClient pClient, UserData data) { this.mClient = pClient; this.Effects = new List<AvatarEffect>(); this.UserId = UserId; this.CurrentEffect = -1; this.Effects.Clear(); StringBuilder QueryBuilder = new StringBuilder(); foreach (AvatarEffect effect in data.effects) { if (!effect.HasExpired) { Effects.Add(effect); EffectCount++; } else QueryBuilder.Append("DELETE FROM user_effects WHERE user_id = " + UserId + " AND effect_id = " + effect.EffectId + "; "); } if (QueryBuilder.Length > 0) { using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor()) dbClient.runFastQuery(QueryBuilder.ToString()); } }
internal BadgeComponent(uint userId, UserData data) { this.Badges = new Hashtable(); foreach (Badge badge in data.badges) { if (!Badges.ContainsKey(badge.Code)) Badges.Add(badge.Code, badge); } this.UserId = userId; }
internal static InventoryComponent GetInventory(uint UserId, GameClient Client, UserData data) { return new InventoryComponent(UserId, Client, data); //InventoryComponent component; //if (storage.TryGetValue(UserId, out component)) // return component; //else //{ // InventoryComponent toReturn = // storage.Add(UserId, toReturn); // return toReturn; //} }
internal InventoryComponent(uint UserId, GameClient Client, UserData UserData) { this.mClient = Client; this.UserId = UserId; this.floorItems = new Hashtable(); this.wallItems = new Hashtable(); this.discs = new Hashtable(); foreach (UserItem item in UserData.inventory) { if (item.GetBaseItem().InteractionType == InteractionType.musicdisc) discs.Add(item.Id, item); if (item.isWallItem) wallItems.Add(item.Id, item); else floorItems.Add(item.Id, item); } this.InventoryPets = new SafeDictionary<UInt32, Pet>(UserData.pets); this.InventoryBots = new SafeDictionary<UInt32, RoomBot>(UserData.Botinv); this.mAddedItems = new Hashtable(); this.mRemovedItems = new Hashtable(); this.isUpdated = false; }
internal SubscriptionManager(uint userID, UserData userData) { this.UserId = userID; Subscription = userData.subscriptions; }
internal void LoadData(UserData data) { LoadAchievements(data.achievements); LoadFavorites(data.favouritedRooms); LoadMutedUsers(data.ignores); LoadTags(data.tags); }
internal void InitInformation(UserData data) { this.SubscriptionManager = new SubscriptionManager(Id, data); this.BadgeComponent = new BadgeComponent(Id, data); this.quests = data.quests; this.Messenger = new HabboMessenger(Id); this.Messenger.Init(data.friends, data.requests); this.SpectatorMode = false; this.Disconnected = false; this.UsersRooms = data.rooms; this.Relationships = data.Relations; }
internal void Init(GameClient client, UserData data) { this.mClient = client; this.SubscriptionManager = new SubscriptionManager(Id, data); this.BadgeComponent = new BadgeComponent(Id, data); this.InventoryComponent = InventoryGlobal.GetInventory(Id, client, data); this.InventoryComponent.SetActiveState(client); this.AvatarEffectsInventoryComponent = new AvatarEffectsInventoryComponent(Id, client, data); using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor()) { if (client.GetHabbo() != null) { dbClient.setQuery("SELECT COUNT(0) FROM items WHERE user_id=@id AND room_id=''"); dbClient.addParameter("id", client.GetHabbo().Id); int lol = dbClient.getInteger(); if (lol >= 5000) client.SendNotif("You are close to the limit for items in your inventory!\n" + "The maximum is currently 8000 items, you have " + lol + " items loaded in your inventory. \nPlease note that we are not responsible for crashing because of too big inventories!"); } } this.quests = data.quests; this.Messenger = new HabboMessenger(Id); this.Messenger.Init(data.friends, data.requests); this.FriendCount = Convert.ToUInt32(data.friends.Count); this.SpectatorMode = false; this.WasSpectator = false; this.Disconnected = false; this.UsersRooms = data.rooms; this.Relationships = data.Relations; }