public async Task ParseMoon(params string[] input) { try { SystemMoon moon = moonParser.Parse(input); await RespondAsync(moon.Name); } catch (Exception e) { await RespondAsync(e.Message); } }
/// <summary> /// Try to get a moon from loaded moons list /// </summary> /// <param name="systemMoon"></param> /// <param name="moon"></param> /// <returns></returns> public bool TryGetMoon(SystemMoon systemMoon, out MoonInformation moon) { moon = null; string getMoonData = $"SELECT c.type_name, b.quantity, if (d.type = 'Tatara', true, false) FROM mapdata a, moondata b, typedata c, moonrefinery d WHERE a.item_name = '{systemMoon.Name}' AND b.moon_id = a.item_id AND d.moon_id = a.item_id AND c.type_id = b.type_id;"; Console.WriteLine(getMoonData); if (!TryRunQuery(getMoonData, out List <List <object> > result)) { return(false); } moon = new MoonInformation(systemMoon, result); return(true); }
public MoonInformation(SystemMoon systemMoon, List <List <object> > data) : base(systemMoon) { this.data = data; IsTatara = data[0][2].ToString() == "1"; for (int i = 0; i < data.Count; i++) { List <object> row = data[i]; #region MoonOre // Ubiquituous if (row[0].ToString() == "Bitumens") { Bitumens = float.Parse(row[1].ToString()); } else if (row[0].ToString() == "Sylvite") { Sylvite = float.Parse(row[1].ToString()); } else if (row[0].ToString() == "Coesite") { Coesite = float.Parse(row[1].ToString()); } else if (row[0].ToString() == "Zeolites") { Zeolites = float.Parse(row[1].ToString()); } // Common if (row[0].ToString() == "Cobaltite") { Cobaltite = float.Parse(row[1].ToString()); } else if (row[0].ToString() == "Euxenite") { Euxenite = float.Parse(row[1].ToString()); } else if (row[0].ToString() == "Scheelite") { Scheelite = float.Parse(row[1].ToString()); } else if (row[0].ToString() == "Titanite") { Titanite = float.Parse(row[1].ToString()); } // Uncommon if (row[0].ToString() == "Chromite") { Chromite = float.Parse(row[1].ToString()); } else if (row[0].ToString() == "Otavite") { Otavite = float.Parse(row[1].ToString()); } else if (row[0].ToString() == "Sperrylite") { Sperrylite = float.Parse(row[1].ToString()); } else if (row[0].ToString() == "Vanadinite") { Vanadinite = float.Parse(row[1].ToString()); } // Rare if (row[0].ToString() == "Carnotite") { Carnotite = float.Parse(row[1].ToString()); } else if (row[0].ToString() == "Cinnabar") { Cinnabar = float.Parse(row[1].ToString()); } else if (row[0].ToString() == "Pollucite") { Pollucite = float.Parse(row[1].ToString()); } else if (row[0].ToString() == "Zircon") { Zircon = float.Parse(row[1].ToString()); } // Exceptional if (row[0].ToString() == "Loparite") { Loparite = float.Parse(row[1].ToString()); } else if (row[0].ToString() == "Monazite") { Monazite = float.Parse(row[1].ToString()); } else if (row[0].ToString() == "Xenotime") { Xenotime = float.Parse(row[1].ToString()); } else if (row[0].ToString() == "Ytterbite") { Ytterbite = float.Parse(row[1].ToString()); } // High sec if (row[0].ToString() == "Veldspar") { Veldspar = float.Parse(row[1].ToString()); } else if (row[0].ToString() == "Scordite") { Scordite = float.Parse(row[1].ToString()); } else if (row[0].ToString() == "Pyroxeres") { Pyroxeres = float.Parse(row[1].ToString()); } else if (row[0].ToString() == "Plagioclase") { Plagioclase = float.Parse(row[1].ToString()); } else if (row[0].ToString() == "Omber") { Omber = float.Parse(row[1].ToString()); } else if (row[0].ToString() == "Kernite") { Kernite = float.Parse(row[1].ToString()); } else if (row[0].ToString() == "Jaspet") { Jaspet = float.Parse(row[1].ToString()); } else if (row[0].ToString() == "Hemorphite") { Hemorphite = float.Parse(row[1].ToString()); } else if (row[0].ToString() == "Hedbergite") { Hedbergite = float.Parse(row[1].ToString()); } // Null sec if (row[0].ToString() == "Gneiss") { Gneiss = float.Parse(row[1].ToString()); } else if (row[0].ToString() == "Ochre") { Ochre = float.Parse(row[1].ToString()); } else if (row[0].ToString() == "Spodumain") { Spodumain = float.Parse(row[1].ToString()); } else if (row[0].ToString() == "Crokite") { Crokite = float.Parse(row[1].ToString()); } else if (row[0].ToString() == "Bistot") { Bistot = float.Parse(row[1].ToString()); } else if (row[0].ToString() == "Arkonor") { Arkonor = float.Parse(row[1].ToString()); } #endregion #region Rarity if (Exceptional > 0) { Rarity = "R64"; if (Loparite > 0) { RarityCount++; } else if (Monazite > 0) { RarityCount++; } else if (Xenotime > 0) { RarityCount++; } else if (Ytterbite > 0) { RarityCount++; } } else if (Rare > 0) { Rarity = "R32"; if (Carnotite > 0) { RarityCount++; } else if (Cinnabar > 0) { RarityCount++; } else if (Pollucite > 0) { RarityCount++; } else if (Zircon > 0) { RarityCount++; } } else if (Uncommon > 0) { Rarity = "R32"; if (Chromite > 0) { RarityCount++; } else if (Otavite > 0) { RarityCount++; } else if (Sperrylite > 0) { RarityCount++; } else if (Vanadinite > 0) { RarityCount++; } } else if (Common > 0) { Rarity = "R16"; if (Cobaltite > 0) { RarityCount++; } else if (Euxenite > 0) { RarityCount++; } else if (Scheelite > 0) { RarityCount++; } else if (Titanite > 0) { RarityCount++; } } else if (Ubiquitous > 0) { Rarity = "R8"; if (Bitumens > 0) { RarityCount++; } else if (Coesite > 0) { RarityCount++; } else if (Sylvite > 0) { RarityCount++; } else if (Zeolites > 0) { RarityCount++; } } #endregion } }
/// <summary> /// Try to get a moon from loaded moons list /// </summary> /// <param name="system"></param> /// <param name="planetMoon"></param> /// <param name="moon"></param> /// <returns></returns> public bool TryGetMoon(string system, string planetMoon, out MoonInformation moon) { SystemMoon systemMoon = moonParser.Parse(new string[] { system, planetMoon }); return(TryGetMoon(systemMoon, out moon)); }
public SystemMoon(SystemMoon systemMoon) { System = systemMoon.System; Planet = systemMoon.Planet; Moon = systemMoon.Moon; }