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); map.Monsters = monsterManager.GetMonstersByMapId(map.MapID); if (map.MapID != 9 && map.MapID != 10 && map.MapID != 13 && map.MapID != 14) // maps we dont have maskes for yet.. { map.WalkableTiles = GetWalkableTiles(map.Name); } } } return(maps.ToArray()); }
public class MapManager : ManagerBase { PortalManager portalManager; NpcManager npcManager; public MapManager(string conString, string providerName) : base(conString, providerName) { portalManager = new PortalManager(conString, providerName); npcManager = new NpcManager(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); } } return(maps.ToArray()); }