public static List <MissionSpot> GenerateMissionSpotsFromPositions(IZone zone, MissionSpotType missionSpotType, List <Position> positions) { var result = new List <MissionSpot>(positions.Count); foreach (var pos in positions) { var ms = new MissionSpot(missionSpotType, pos, zone.Id); result.Add(ms); } return(result); }
public static MissionSpot FromRecord(IDataRecord record) { var spottype = (MissionSpotType)record.GetValue <int>("type"); var x = record.GetValue <int>("x"); var y = record.GetValue <int>("y"); var p = new Position(x, y); p = p.Center; var zoneIdSql = record.GetValue <int>("zoneid"); var si = new MissionSpot(spottype, p, zoneIdSql); return(si); }
public static List <MissionSpot> GetMissionSpotsFromUnitsOnZone(IZone zone, bool collectFindRadius = false) { var spots = new List <MissionSpot>(); var fieldTerminals = zone.Units.Where(u => u is FieldTerminal).ToList(); foreach (var fieldTerminal in fieldTerminals) { var ms = new MissionSpot(MissionSpotType.fieldterminal, fieldTerminal.CurrentPosition, zone.Id); spots.Add(ms); } var missionStructures = zone.Units.Where(u => u is MissionStructure).Cast <MissionStructure>().ToList(); foreach (var missionStructure in missionStructures) { MissionSpotType spotType; switch (missionStructure.TargetType) { case MissionTargetType.use_itemsupply: spotType = MissionSpotType.itemsupply; break; case MissionTargetType.submit_item: spotType = MissionSpotType.kiosk; break; default: spotType = MissionSpotType.mswitch; break; } var ms = new MissionSpot(spotType, missionStructure.CurrentPosition, zone.Id); if (collectFindRadius) { var missionTarget = _missionDataCache.GetTargetByStructureUnit(missionStructure); ms.SetFindRadius(missionTarget.FindRadius); } spots.Add(ms); } return(spots); }
private List <MissionSpot> CollectMissionSpots() { if (LiveMode) { //display the data from live units and targets //here we dont really need field terminals var spotInfos = MissionSpot.GetMissionSpotsFromUnitsOnZone(Zone) .Where(s => s.type == MissionSpotType.mswitch || s.type == MissionSpotType.kiosk || s.type == MissionSpotType.itemsupply).ToList(); var randomPointsInfos = MissionSpot.GetRandomPointSpotsFromTargets(Zone.Configuration); spotInfos.AddRange(randomPointsInfos); return(spotInfos); } //display the generated data var spots = MissionSpot.LoadByZoneId(Zone.Id); return(spots); }
public static List <MissionSpot> GetRandomPointSpotsFromTargets(ZoneConfiguration zoneConfig, bool collectFindRadius = false) { var pointTargets = _missionDataCache.GetAllMissionTargets.Where(t => t.Type == MissionTargetType.rnd_point && t.ZoneId == zoneConfig.Id).ToList(); var result = new List <MissionSpot>(pointTargets.Count); foreach (var missionTarget in pointTargets) { var ms = new MissionSpot(MissionSpotType.randompoint, missionTarget.targetPosition, zoneConfig.Id); if (collectFindRadius) { ms.SetFindRadius(missionTarget.FindRadius); } result.Add(ms); } return(result); }
public static MissionSpotStat CreateFromSpot(MissionSpot spot) { var mss = new MissionSpotStat(spot); return(mss); }
private MissionSpotStat(MissionSpot spot) : base(spot.type, spot.position, spot.zoneId) { }