add file to identify powers
This commit is contained in:
parent
894918b5ba
commit
32dbde2c82
101
EDPlayerJournal/PowerPlay/Powers.cs
Normal file
101
EDPlayerJournal/PowerPlay/Powers.cs
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
namespace EDPlayerJournal.PowerPlay;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Holds a list of all available powers in E:D, and helps
|
||||||
|
/// to translate commonly used short-hands and aliases to
|
||||||
|
/// journal approved power names.
|
||||||
|
/// </summary>
|
||||||
|
public class Powers {
|
||||||
|
public static readonly string
|
||||||
|
// Basking
|
||||||
|
ALavignyDuval = "A. Lavigny-Duval",
|
||||||
|
AislingDuval = "Aisling Duval",
|
||||||
|
DentonPatreus = "Denton Patreus",
|
||||||
|
ZeminaTorval = "Zemina Torval",
|
||||||
|
// Feds
|
||||||
|
JeromeArcher = "Jerome Archer",
|
||||||
|
FeliciaWinters = "Felicia Winters",
|
||||||
|
// Alliance
|
||||||
|
EdmunMahon = "Edmund Mahon",
|
||||||
|
NakatoKaine = "Nakato Kaine",
|
||||||
|
// Independents
|
||||||
|
YuriGrom = "Yuri Grom",
|
||||||
|
ArchonDelaine = "Archon Delaine",
|
||||||
|
LiYongRui = "Li Yong-Rui",
|
||||||
|
PranavAntal = "Pranav Antal"
|
||||||
|
;
|
||||||
|
|
||||||
|
public static readonly Dictionary<string, string> aliases = new() {
|
||||||
|
// ALD
|
||||||
|
{ Powers.ALavignyDuval, Powers.ALavignyDuval },
|
||||||
|
{ "ALD", Powers.ALavignyDuval },
|
||||||
|
{ "Arissa", Powers.ALavignyDuval },
|
||||||
|
{ "Emperor", Powers.ALavignyDuval },
|
||||||
|
{ "Kaiser", Powers.ALavignyDuval },
|
||||||
|
// AD
|
||||||
|
{ Powers.AislingDuval, Powers.AislingDuval },
|
||||||
|
{ "AD", Powers.AislingDuval },
|
||||||
|
{ "Aisling", Powers.AislingDuval },
|
||||||
|
// DP
|
||||||
|
{ Powers.DentonPatreus, Powers.DentonPatreus },
|
||||||
|
{ "DP", Powers.DentonPatreus },
|
||||||
|
{ "Denton", Powers.DentonPatreus },
|
||||||
|
// ZT
|
||||||
|
{ Powers.ZeminaTorval, Powers.ZeminaTorval },
|
||||||
|
{ "ZT", Powers.ZeminaTorval },
|
||||||
|
{ "Torval", Powers.ZeminaTorval },
|
||||||
|
// Archer
|
||||||
|
{ Powers.JeromeArcher, Powers.JeromeArcher },
|
||||||
|
{ "JA", Powers.JeromeArcher },
|
||||||
|
{ "Archer", Powers.JeromeArcher },
|
||||||
|
// Winters
|
||||||
|
{ Powers.FeliciaWinters, Powers.FeliciaWinters },
|
||||||
|
{ "FW", Powers.FeliciaWinters },
|
||||||
|
{ "Winters", Powers.FeliciaWinters },
|
||||||
|
// Mahon
|
||||||
|
{ Powers.EdmunMahon, Powers.EdmunMahon },
|
||||||
|
{ "EM", Powers.EdmunMahon },
|
||||||
|
{ "Mahon", Powers.EdmunMahon },
|
||||||
|
// Kaine
|
||||||
|
{ Powers.NakatoKaine, Powers.NakatoKaine },
|
||||||
|
{ "NK", Powers.NakatoKaine },
|
||||||
|
{ "Kaine", Powers.NakatoKaine },
|
||||||
|
// Grom
|
||||||
|
{ Powers.YuriGrom, Powers.YuriGrom },
|
||||||
|
{ "YG", Powers.YuriGrom },
|
||||||
|
{ "Grom", Powers.YuriGrom },
|
||||||
|
// Archon
|
||||||
|
{ Powers.ArchonDelaine, Powers.ArchonDelaine },
|
||||||
|
{ "Archon", Powers.ArchonDelaine },
|
||||||
|
{ "Kumo", Powers.ArchonDelaine },
|
||||||
|
{ "KumoBurger", Powers.ArchonDelaine },
|
||||||
|
// LYR
|
||||||
|
{ Powers.LiYongRui, Powers.LiYongRui },
|
||||||
|
{ "LYR", Powers.LiYongRui },
|
||||||
|
// Pranav
|
||||||
|
{ Powers.PranavAntal, Powers.PranavAntal },
|
||||||
|
{ "PA", Powers.PranavAntal },
|
||||||
|
{ "Pranav", Powers.PranavAntal },
|
||||||
|
};
|
||||||
|
|
||||||
|
public static bool IsValidPower(string power) {
|
||||||
|
try {
|
||||||
|
string p = GetPower(power);
|
||||||
|
return true;
|
||||||
|
} catch (Exception) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetPower(string nameOrAlias) {
|
||||||
|
string? val = aliases
|
||||||
|
.Where(x => string.Compare(x.Key, nameOrAlias, StringComparison.InvariantCultureIgnoreCase) == 0)
|
||||||
|
.Select(x => x.Value)
|
||||||
|
.FirstOrDefault()
|
||||||
|
;
|
||||||
|
if (string.IsNullOrEmpty(val)) {
|
||||||
|
throw new ApplicationException($"not a valid power: {nameOrAlias}");
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user