MonsterManager monsterManager; public MapManager(string conString, string providerName) : base(conString, providerName) { portalManager = new PortalManager(conString, providerName); npcManager = new NpcManager(conString, providerName); monsterManager = new MonsterManager(conString, providerName); } public Map[] GetAllMaps()
MonsterManager monsterManager; public MapManager(string conString, string providerName) : base(conString, providerName) { portalManager = new PortalManager(conString, providerName); npcManager = new NpcManager(conString, providerName); monsterManager = new MonsterManager(conString, providerName); } public Map[] GetAllMaps() { _db.Open(); DbDataReader reader = _db.ExcecuteReader(DbNames.GETALLMAPS_STOREDPROC, System.Data.CommandType.StoredProcedure, null); int ordinalId = reader.GetOrdinal(DbNames.MAP_ID); int ordinalName = reader.GetOrdinal(DbNames.MAP_NAME); int ordinalMultiplyValue = reader.GetOrdinal(DbNames.MAP_MULTIPLYVALUE); int ordinalSpawnX = reader.GetOrdinal(DbNames.MAP_SPAWNX); int ordinalSpawnY = reader.GetOrdinal(DbNames.MAP_SPAWNY); List<Map> maps = new List<Map>(); while (reader.Read()) { Map m = new Map() { MapID = reader.GetInt32(ordinalId), Name = reader.GetString(ordinalName), MultiplyValue = reader.GetInt32(ordinalMultiplyValue), SpawnX = reader.GetInt32(ordinalSpawnX), SpawnY = reader.GetInt32(ordinalSpawnY) }; maps.Add(m); } reader.Close(); _db.Close(); foreach (Map map in maps) { map.Portals = portalManager.GetPortalsByMapId(map.MapID); map.Npcs = npcManager.GetNpcsByMapId(map.MapID);