public IEnumerable <ZoneConfiguration> GetAll() { var records = Db.Query().CommandText("select * from zones where enabled = 1").Execute(); var result = new List <ZoneConfiguration>(); var port = _globalConfiguration.ListenerPort + 1; foreach (var record in records) { var x = record.GetValue <int>("x"); var y = record.GetValue <int>("y"); var w = record.GetValue <int>("width"); var h = record.GetValue <int>("height"); var id = record.GetValue <int>("id"); var config = new ZoneConfiguration { Id = id, WorldPosition = new Point(x, y), Size = new Size(w, h), Name = record.GetValue <string>("name"), Fertility = record.GetValue <int>("fertility"), PluginName = record.GetValue <string>("zoneplugin"), //ListenerAddress = "127.0.0.1", ListenerPort = port++, NpcSpawnId = record.GetValue <int?>("spawnid") ?? 0, Protected = record.GetValue <bool>("protected"), Terraformable = record.GetValue <bool>("terraformable"), RaceId = record.GetValue <int>("raceid"), plantRuleSetId = record.GetValue <int>("plantruleset"), Type = (ZoneType)record.GetValue <int>("zonetype"), SparkCost = record.GetValue <int>("sparkcost"), MaxPlayers = 10000, MaxDockingBase = record.GetValue <int>("maxdockingbase"), PlantAltitudeScale = record.GetValue <double>("plantaltitudescale"), Note = record.GetValue <string>("note"), }; config.PlantRules = _plantRuleLoader.LoadPlantRulesWithOverrides(config.plantRuleSetId); result.Add(config); } return(result); }
public static ZoneStorage Get(ZoneConfiguration configuration) { return((ZoneStorage)GetByName(GetNameByZoneId(configuration.Id))); }