public InventoryComponent(uint userId, GameClient client, UserDataFactory userdata) { this.Session = client; this.UserId = userId; this.Items = new List <UserItem>(); this.Pets = new Hashtable(); this.Bots = new Hashtable(); this.hashtable_1 = new Hashtable(); this.Discs = new Hashtable(); this.list_1 = new List <uint>(); foreach (DataRow row in userdata.GetItems().Rows) { string str; uint id = Convert.ToUInt32(row["Id"]); uint baseItem = Convert.ToUInt32(row["base_item"]); int ltdi = Convert.ToInt32(row["ltd_id"]); int ltdc = Convert.ToInt32(row["ltd_cnt"]); string glddata = (string)row["guild_data"]; if (!DBNull.Value.Equals(row["extra_data"])) { str = (string)row["extra_data"]; } else { str = string.Empty; } UserItem item = new UserItem(id, baseItem, str, ltdi, ltdc, glddata); Items.Add(item); if (item.GetBaseItem().InteractionType == "musicdisc") { this.Discs.Add(item.uint_0, item); } } foreach (DataRow row in userdata.GetPets().Rows) { Pet pet = Essential.GetGame().GetCatalog().GetPet(row); this.Pets.Add(pet.PetId, pet); } foreach (DataRow row in userdata.GetBots().Rows) { UserBot bot = Essential.GetGame().GetCatalog().RetrBot(row); this.Bots.Add(bot.BotId, bot); } }
public InventoryComponent(uint userId, GameClient client, UserDataFactory userdata) { this.Session = client; this.UserId = userId; this.Items = new List <UserItem>(); this.Pets = new Hashtable(); this.hashtable_1 = new Hashtable(); this.Discs = new Hashtable(); this.list_1 = new List <uint>(); foreach (DataRow row in userdata.GetItems().Rows) { string str; uint id = Convert.ToUInt32(row["Id"]); uint baseItem = Convert.ToUInt32(row["base_item"]); if (!DBNull.Value.Equals(row["extra_data"])) { str = (string)row["extra_data"]; } else { str = string.Empty; } UserItem item = new UserItem(id, baseItem, str); Items.Add(item); if (item.method_1().InteractionType == "musicdisc") { this.Discs.Add(item.uint_0, item); } } foreach (DataRow row in userdata.GetPets().Rows) { Pet pet = HabboIM.GetGame().GetCatalog().method_12(row); this.Pets.Add(pet.PetId, pet); } }
public InventoryManager(GameClient session, UserDataFactory dataFactory) { this.Session = session; this.FloorItems = new Dictionary <uint, InventoryItem>(); this.WallItems = new Dictionary <uint, InventoryItem>(); this.Pets = new Dictionary <uint, Pet>(); this.BytesWaitingToBeSend = new List <ArraySegment <byte> >(); this.QueueBytes = false; this.FloorItems.Clear(); this.WallItems.Clear(); DataTable inventoryItems = dataFactory.GetInventoryItems(); if (inventoryItems != null && inventoryItems.Rows.Count > 0) { foreach (DataRow dataRow in inventoryItems.Rows) { InventoryItem item = new InventoryItem((uint)dataRow["id"], (uint)dataRow["base_item"], (string)dataRow["extra_data"]); if (item.GetItem().IsWallItem) { this.WallItems.Add(item.ID, item); } else { this.FloorItems.Add(item.ID, item); } } } DataTable pets = dataFactory.GetPets(); if (pets != null && pets.Rows.Count > 0) { foreach (DataRow dataRow in pets.Rows) { if ((uint)dataRow["room_id"] == 0) { Pet pet = new Pet((uint)dataRow["id"], (uint)dataRow["user_id"], (int)dataRow["type"], (string)dataRow["name"], (string)dataRow["race"], (string)dataRow["color"], (int)dataRow["expirience"], (int)dataRow["energy"], (int)dataRow["happiness"], (int)dataRow["respect"], (double)dataRow["create_timestamp"]); this.Pets.Add(pet.ID, pet); } } } }