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); } } } }