public void start() { fakeBgsRestClient = new FakeBgsRestClient(); fakeEddbRestClient = new FakeBgsRestClient(); fakeBgsService = new BgsService(fakeBgsRestClient, fakeEddbRestClient); MakeSafe(); }
private StarSystem GetSystemExtras(StarSystem starSystem, bool showInformation, bool showBodies, bool showStations, bool showFactions) { if (starSystem != null) { if (showBodies) { List <Body> bodies = edsmService.GetStarMapBodies(starSystem.systemname) ?? new List <Body>(); foreach (Body body in bodies) { body.systemname = starSystem.systemname; body.systemAddress = starSystem.systemAddress; } starSystem.AddOrUpdateBodies(bodies); } if (starSystem.population > 0) { List <Faction> factions = new List <Faction>(); List <Station> stations = new List <Station>(); if (showFactions || showStations) { factions = edsmService.GetStarMapFactions(starSystem.systemname) ?? factions; starSystem.factions = factions; } if (showStations) { stations = edsmService.GetStarMapStations(starSystem.systemname) ?? stations; starSystem.stations = SetStationFactionData(stations, factions); starSystem.stations = stations; } starSystem = new BgsService().GetSystemPowerplay(starSystem); } } return(starSystem); }
///<summary> Faction data from EliteBGS (allows search by faction name - EDSM can only search by system name). /// If a systemName is provided, we can filter factions that share a name according to whether they have a presence in a known system </summary> public Faction GetFactionByName(string factionName, string systemName = null) { if (string.IsNullOrEmpty(factionName)) { return(null); } List <KeyValuePair <string, object> > queryList = new List <KeyValuePair <string, object> >() { new KeyValuePair <string, object>(BgsService.FactionParameters.factionName, factionName) }; List <Faction> factions = BgsService.GetFactions(BgsService.factionEndpoint, queryList); // If a systemName is provided, we can filter factions that share a name according to whether they have a presence in a known system if (systemName != null && factions.Count > 1) { foreach (Faction faction in factions) { faction.presences = faction.presences.Where(f => f.systemName == systemName)?.ToList(); } } return(factions?.FirstOrDefault() ?? new Faction() { name = factionName }); }
public ScriptResolver(Dictionary <string, Script> scripts) { dataProviderService = new DataProviderService(); bgsService = new BgsService(); random = new Random(); this.scripts = scripts ?? new Dictionary <string, Script>(); setting = new CustomSetting { Trimmer = BuiltinTrimmers.CollapseBlankCharacters }; }