public static CommodityDefinition FromNameOrEDName(string name) { if (string.IsNullOrEmpty(name)) { return(null); } string normalizedName = NormalizedName(name); if (ignoredCommodity(normalizedName)) { return(null); } // Correct ednames that we've gotten wrong sometime in the past normalizedName = correctedCommodityEdName(normalizedName); // Now try to fetch the commodity by either ED or real name CommodityDefinition result = null; if (normalizedName != null) { result = FromName(normalizedName); } if (result == null) { result = ResourceBasedLocalizedEDName <CommodityDefinition> .FromEDName(normalizedName); } return(result); }
public static CommodityDefinition FromNameOrEDName(string name) { if (string.IsNullOrEmpty(name)) { return(null); } string normalizedName = NormalizedName(name); if (ignoredCommodity(normalizedName)) { return(null); } // Now try to fetch the commodity by either ED or real name CommodityDefinition result = null; if (normalizedName != null) { result = FromName(normalizedName); } if (result == null) { result = ResourceBasedLocalizedEDName <CommodityDefinition> .FromEDName(normalizedName); } return(result); }
public new static StationService FromEDName(string edname) { // In Elite Dangerous v3.7, "Workshop" is replaced by "Engineer" and "SearchAndRescue" is replaced by "SearchRescue" // Preserve the original edname for backwards compatibility. return(ResourceBasedLocalizedEDName <StationService> .FromEDName( edname.ToLowerInvariant().Replace("engineer", "workshop").Replace("searchrescue", "searchandrescue") )); }
new public static RingComposition FromEDName(string edname) { string normalizedEDName = edname .Replace("eRingClass_", "") .Replace("-", "") .Replace("Metalic", "Metallic"); return(ResourceBasedLocalizedEDName <RingComposition> .FromEDName(normalizedEDName)); }
new public static PlanetClass FromEDName(string edname) { if (edname == null) { return(null); } string normalizedEDName = edname.Replace(" ", "").Replace("-", ""); return(ResourceBasedLocalizedEDName <PlanetClass> .FromEDName(normalizedEDName)); }
public new static PlanetClass FromName(string name) { if (name == null) { return(null); } var normalizedName = name .Replace("ammonia-based", "ammonia based") .Replace("water-based", "water based"); return(ResourceBasedLocalizedEDName <PlanetClass> .FromName(normalizedName)); }
public new static NpcSuitLoadout FromEDName(string edname) { if (string.IsNullOrEmpty(edname)) { return(null); } var(tidiedName, grade) = titiedEDName(edname); var result = ResourceBasedLocalizedEDName <NpcSuitLoadout> .FromEDName(tidiedName); if (result != null) { result.grade = grade; } return(result); }
public static Suit FromEDName(string edname, long?suitId = null) { if (string.IsNullOrEmpty(edname)) { return(null); } var(tidiedName, grade) = titiedEDName(edname); var result = ResourceBasedLocalizedEDName <Suit> .FromEDName(tidiedName); if (result != null) { result.grade = grade; result.suitId = suitId; } return(result); }
new public static AtmosphereClass FromName(string name) { if (name == null) { return(FromName("None")); } // Temperature and pressure are defined separately so we remove them from this string (if descriptors are present) string normalizedName = name .ToLowerInvariant() .Replace("thick ", "") .Replace("thin ", "") .Replace("hot ", ""); return(ResourceBasedLocalizedEDName <AtmosphereClass> .FromName(normalizedName)); }
new public static StationModel FromName(string from) { if (from == null) { return(null); } // Translate from EDSM / EDDB station model names if these are present Dictionary <string, string> modelTranslations = new Dictionary <string, string>() { { "Coriolis Starport", "Coriolis" }, // Ocellus starports are described by the journal as either "Bernal" or "Ocellus" { "Bernal Starport", "Bernal" }, { "Ocellus Starport", "Ocellus" }, { "Orbis Starport", "Orbis" }, // The journal doesn't provide details on the type of outpost (military, civilian, scientific, etc.) // Types are likely derived from the station primary economy, but mixing these into the model name does not add value. { "Outpost", "Outpost" }, { "Civilian Outpost", "Outpost" }, { "Commercial Outpost", "Outpost" }, { "Industrial Outpost", "Outpost" }, { "Military Outpost", "Outpost" }, { "Mining Outpost", "Outpost" }, { "Scientific Outpost", "Outpost" }, { "Unknown Outpost", "Outpost" }, // Planetary ports are assigned by EDSM via marketID, from a list given to EDSM by FDev long ago. // The journal doesn't distinguish between planetary ports and outposts. { "Planetary Outpost", "SurfaceStation" }, { "Planetary Port", "SurfaceStation" }, // Planetary settlements are not dockable and require manual edits on ROSS to add to EDDB { "Planetary Settlement", "SurfaceStation" }, { "Planetary Engineer Base", "SurfaceStation" }, { "Unknown Planetary", "SurfaceStation" }, { "Asteroid base", "AsteroidBase" }, { "Mega ship", "Megaship" }, }; foreach (KeyValuePair <string, string> model in modelTranslations) { if (from == model.Key) { return(FromEDName(model.Value)); } } return(ResourceBasedLocalizedEDName <StationModel> .FromName(from)); }
public static MicroResource FromEDName(string edname, string fallbackName = null, string categoryEdName = null) { if (edname == null) { return(None); } string normalizedEDName = edname .ToLowerInvariant() .Replace("$", "") .Replace("_name;", ""); var result = ResourceBasedLocalizedEDName <MicroResource> .FromEDName(normalizedEDName); result.fallbackLocalizedName = fallbackName; if (!string.IsNullOrEmpty(categoryEdName)) { result.Category = MicroResourceCategory.FromEDName(categoryEdName); } return(result); }
public new static SignalSource FromEDName(string from) { if (from != null) { if (from.Contains("$")) { string tidiedFrom = from .Replace("$", "") .Replace(";", ""); // Extract any sub-type from the name (e.g. $SAA_Unknown_Signal:#type=$SAA_SignalType_Geological;:#index=3; ) if (tidiedFrom.Contains(":#type=")) { string[] fromArray = tidiedFrom.Split(new[] { ":#type=" }, System.StringSplitOptions.None); tidiedFrom = fromArray[1]; } // Extract any index value which might be present and then strip the index value int indexResult = 0; if (tidiedFrom.Contains(":#index=")) { string[] fromArray = tidiedFrom.Split(new[] { ":#index=" }, System.StringSplitOptions.None); if (int.TryParse(fromArray[1], out indexResult)) { } tidiedFrom = fromArray[0]; } // Find our signal source SignalSource result = ResourceBasedLocalizedEDName <SignalSource> .FromEDName(tidiedFrom); // Include our index value with our result result.index = indexResult; return(result); } } return(null); }
new public static CommodityDefinition FromEDName(string rawName) { string edName = NormalizedName(rawName); return(ResourceBasedLocalizedEDName <CommodityDefinition> .FromEDName(edName)); }
new public MaterialCategory FromEDName(string edname) { string normalizedEDName = edname.Replace("$MICRORESOURCE_CATEGORY_", "").Replace(";", ""); return(ResourceBasedLocalizedEDName <MaterialCategory> .FromEDName(normalizedEDName)); }