wabbajack/Wabbajack.DTOs/Game/GameRegistry.cs

534 lines
19 KiB
C#
Raw Normal View History

2021-09-27 12:42:46 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using Wabbajack.Paths;
2021-10-23 16:51:17 +00:00
namespace Wabbajack.DTOs;
public static class GameRegistry
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
public static IReadOnlyDictionary<Game, GameMetaData> Games = new Dictionary<Game, GameMetaData>
2021-09-27 12:42:46 +00:00
{
{
2021-10-23 16:51:17 +00:00
Game.Morrowind, new GameMetaData
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
Game = Game.Morrowind,
SteamIDs = new[] {22320},
GOGIDs = new[] {1440163901, 1435828767},
NexusName = "morrowind",
NexusGameId = 100,
MO2Name = "Morrowind",
MO2ArchiveName = "morrowind",
BethNetID = 31,
RegString =
@"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\The Elder Scrolls III: Morrowind Game of the Year Edition",
RequiredFiles = new[]
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
"Morrowind.exe".ToRelativePath()
},
MainExecutable = "Morrowind.exe".ToRelativePath()
}
},
{
Game.Oblivion, new GameMetaData
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
Game = Game.Oblivion,
NexusName = "oblivion",
NexusGameId = 101,
MO2Name = "Oblivion",
MO2ArchiveName = "oblivion",
SteamIDs = new[] {22330},
GOGIDs = new[] {1458058109},
RequiredFiles = new[]
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
"oblivion.exe".ToRelativePath()
},
MainExecutable = "Oblivion.exe".ToRelativePath()
}
},
2021-09-27 12:42:46 +00:00
2021-10-23 16:51:17 +00:00
{
Game.Fallout3, new GameMetaData
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
Game = Game.Fallout3,
NexusName = "fallout3",
NexusGameId = 120,
MO2Name = "Fallout 3",
MO2ArchiveName = "fallout3",
SteamIDs = new[] {22300, 22370}, // base game and GotY
GOGIDs = new[] {1454315831}, // GotY edition
RequiredFiles = new[]
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
"Fallout3.exe".ToRelativePath()
},
MainExecutable = "Fallout3.exe".ToRelativePath()
}
},
{
Game.FalloutNewVegas, new GameMetaData
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
Game = Game.FalloutNewVegas,
NexusName = "newvegas",
NexusGameId = 130,
MO2Name = "New Vegas",
MO2ArchiveName = "falloutnv",
SteamIDs = new[] {22380, 22490}, // normal and RU version
GOGIDs = new[] {1454587428},
RequiredFiles = new[]
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
"FalloutNV.exe".ToRelativePath()
},
MainExecutable = "FalloutNV.exe".ToRelativePath()
}
},
{
Game.Skyrim, new GameMetaData
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
Game = Game.Skyrim,
NexusName = "skyrim",
NexusGameId = 110,
MO2Name = "Skyrim",
MO2ArchiveName = "skyrim",
SteamIDs = new[] {72850},
RequiredFiles = new[]
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
"tesv.exe".ToRelativePath()
},
MainExecutable = "TESV.exe".ToRelativePath(),
CommonlyConfusedWith = new[] {Game.SkyrimSpecialEdition, Game.SkyrimVR}
}
},
{
Game.SkyrimSpecialEdition, new GameMetaData
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
Game = Game.SkyrimSpecialEdition,
NexusName = "skyrimspecialedition",
NexusGameId = 1704,
MO2Name = "Skyrim Special Edition",
MO2ArchiveName = "skyrimse",
SteamIDs = new[] {489830},
RequiredFiles = new[]
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
"SkyrimSE.exe".ToRelativePath()
},
MainExecutable = "SkyrimSE.exe".ToRelativePath(),
CommonlyConfusedWith = new[] {Game.Skyrim, Game.SkyrimVR}
}
},
{
Game.Fallout4, new GameMetaData
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
Game = Game.Fallout4,
NexusName = "fallout4",
NexusGameId = 1151,
MO2Name = "Fallout 4",
MO2ArchiveName = "fallout4",
SteamIDs = new[] {377160},
RequiredFiles = new[]
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
"Fallout4.exe".ToRelativePath()
},
MainExecutable = "Fallout4.exe".ToRelativePath(),
CommonlyConfusedWith = new[] {Game.Fallout4VR}
}
},
{
Game.SkyrimVR, new GameMetaData
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
Game = Game.SkyrimVR,
NexusName = "skyrimspecialedition",
NexusGameId = 1704,
MO2Name = "Skyrim VR",
MO2ArchiveName = "skyrimse",
SteamIDs = new[] {611670},
RequiredFiles = new[]
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
"SkyrimVR.exe".ToRelativePath()
},
MainExecutable = "SkyrimVR.exe".ToRelativePath(),
CommonlyConfusedWith = new[] {Game.Skyrim, Game.SkyrimSpecialEdition},
CanSourceFrom = new[] {Game.SkyrimSpecialEdition}
}
},
{
Game.Enderal, new GameMetaData
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
Game = Game.Enderal,
NexusName = "enderal",
NexusGameId = 2736,
MO2Name = "Enderal",
MO2ArchiveName = "enderal",
SteamIDs = new[] {1027920, 933480},
RequiredFiles = new[]
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
"TESV.exe".ToRelativePath()
},
MainExecutable = "TESV.exe".ToRelativePath(),
CommonlyConfusedWith = new[] {Game.EnderalSpecialEdition}
}
},
{
Game.EnderalSpecialEdition, new GameMetaData
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
Game = Game.EnderalSpecialEdition,
NexusName = "enderalspecialedition",
NexusGameId = 3685,
MO2Name = "Enderal Special Edition",
MO2ArchiveName = "enderalse",
SteamIDs = new[] {976620},
RequiredFiles = new[]
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
"SkyrimSE.exe".ToRelativePath()
},
MainExecutable = "SkyrimSE.exe".ToRelativePath(),
CommonlyConfusedWith = new[] {Game.Enderal}
}
},
{
Game.Fallout4VR, new GameMetaData
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
Game = Game.Fallout4VR,
NexusName = "fallout4",
MO2Name = "Fallout 4 VR",
MO2ArchiveName = "Fallout4",
SteamIDs = new[] {611660},
RequiredFiles = new[]
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
"Fallout4VR.exe".ToRelativePath()
},
MainExecutable = "Fallout4VR.exe".ToRelativePath(),
CommonlyConfusedWith = new[] {Game.Fallout4},
CanSourceFrom = new[] {Game.Fallout4}
}
},
{
Game.DarkestDungeon, new GameMetaData
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
Game = Game.DarkestDungeon,
NexusName = "darkestdungeon",
MO2Name = "Darkest Dungeon",
NexusGameId = 804,
SteamIDs = new[] {262060},
GOGIDs = new[] {1450711444},
EpicGameStoreIDs = new[] {"b4eecf70e3fe4e928b78df7855a3fc2d"},
IsGenericMO2Plugin = true,
RequiredFiles = new[]
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
@"_windowsnosteam\Darkest.exe".ToRelativePath()
},
MainExecutable = @"_windowsnosteam\Darkest.exe".ToRelativePath()
}
},
{
Game.Dishonored, new GameMetaData
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
Game = Game.Dishonored,
NexusName = "dishonored",
MO2Name = "Dishonored",
NexusGameId = 802,
SteamIDs = new[] {205100},
GOGIDs = new[] {1701063787},
RequiredFiles = new[]
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
@"Binaries\Win32\Dishonored.exe".ToRelativePath()
},
MainExecutable = @"Binaries\Win32\Dishonored.exe".ToRelativePath()
}
},
{
Game.Witcher3, new GameMetaData
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
Game = Game.Witcher3,
NexusName = "witcher3",
NexusGameId = 952,
MO2Name = "The Witcher 3: Wild Hunt",
2022-09-23 03:27:37 +00:00
MO2ArchiveName = "witcher3",
2021-10-23 16:51:17 +00:00
SteamIDs = new[] {292030, 499450}, // normal and GotY
GOGIDs = new[]
{1207664643, 1495134320, 1207664663, 1640424747}, // normal, GotY and both in packages
RequiredFiles = new[]
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
@"bin\x64\witcher3.exe".ToRelativePath()
},
MainExecutable = @"bin\x64\witcher3.exe".ToRelativePath()
}
},
{
Game.StardewValley, new GameMetaData
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
Game = Game.StardewValley,
NexusName = "stardewvalley",
MO2Name = "Stardew Valley",
2022-09-20 23:18:32 +00:00
MO2ArchiveName = "stardewvalley",
2021-10-23 16:51:17 +00:00
NexusGameId = 1303,
SteamIDs = new[] {413150},
GOGIDs = new[] {1453375253},
IsGenericMO2Plugin = true,
RequiredFiles = new[]
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
"Stardew Valley.exe".ToRelativePath()
},
MainExecutable = "Stardew Valley.exe".ToRelativePath()
}
},
{
Game.KingdomComeDeliverance, new GameMetaData
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
Game = Game.KingdomComeDeliverance,
NexusName = "kingdomcomedeliverance",
MO2Name = "Kingdom Come: Deliverance",
MO2ArchiveName = "kingdomcomedeliverance",
NexusGameId = 2298,
SteamIDs = new[] {379430},
GOGIDs = new[] {1719198803},
IsGenericMO2Plugin = true,
RequiredFiles = new[]
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
@"bin\Win64\KingdomCome.exe".ToRelativePath()
},
MainExecutable = @"bin\Win64\KingdomCome.exe".ToRelativePath()
}
},
{
Game.MechWarrior5Mercenaries, new GameMetaData
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
Game = Game.MechWarrior5Mercenaries,
NexusName = "mechwarrior5mercenaries",
MO2Name = "Mechwarrior 5: Mercenaries",
MO2ArchiveName = "mechwarrior5mercenaries",
NexusGameId = 3099,
EpicGameStoreIDs = new[] {"9fd39d8ac72946a2a10a887ce86e6c35"},
IsGenericMO2Plugin = true,
RequiredFiles = new[]
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
@"MW5Mercs\Binaries\Win64\MechWarrior-Win64-Shipping.exe".ToRelativePath()
},
MainExecutable = @"MW5Mercs\Binaries\Win64\MechWarrior-Win64-Shipping.exe".ToRelativePath()
}
},
{
Game.NoMansSky, new GameMetaData
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
Game = Game.NoMansSky,
NexusName = "nomanssky",
NexusGameId = 1634,
MO2Name = "No Man's Sky",
SteamIDs = new[] {275850},
GOGIDs = new[] {1446213994},
RequiredFiles = new[]
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
@"Binaries\NMS.exe".ToRelativePath()
},
MainExecutable = @"Binaries\NMS.exe".ToRelativePath()
}
},
{
Game.DragonAgeOrigins, new GameMetaData
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
Game = Game.DragonAgeOrigins,
NexusName = "dragonage",
NexusGameId = 140,
MO2Name = "Dragon Age: Origins",
SteamIDs = new[] {47810},
OriginIDs = new[] {"DR:169789300", "DR:208591800"},
GOGIDs = new[] {1949616134},
RequiredFiles = new[]
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
@"bin_ship\daorigins.exe".ToRelativePath()
},
MainExecutable = @"bin_ship\daorigins.exe".ToRelativePath()
}
},
{
Game.DragonAge2, new GameMetaData
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
Game = Game.DragonAge2,
NexusName = "dragonage2",
NexusGameId = 141,
MO2Name = "Dragon Age 2", // Probably wrong
SteamIDs = new[] {1238040},
OriginIDs = new[] {"OFB-EAST:59474", "DR:201797000"},
RequiredFiles = new[]
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
@"bin_ship\DragonAge2.exe".ToRelativePath()
},
MainExecutable = @"bin_ship\DragonAge2.exe".ToRelativePath()
}
},
{
Game.DragonAgeInquisition, new GameMetaData
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
Game = Game.DragonAgeInquisition,
NexusName = "dragonageinquisition",
NexusGameId = 728,
MO2Name = "Dragon Age: Inquisition", // Probably wrong
SteamIDs = new[] {1222690},
OriginIDs = new[] {"OFB-EAST:51937", "OFB-EAST:1000032"},
RequiredFiles = new[]
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
@"DragonAgeInquisition.exe".ToRelativePath()
},
MainExecutable = @"DragonAgeInquisition.exe".ToRelativePath()
}
},
{
Game.KerbalSpaceProgram, new GameMetaData
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
Game = Game.KerbalSpaceProgram,
NexusName = "kerbalspaceprogram",
MO2Name = "Kerbal Space Program",
NexusGameId = 272,
SteamIDs = new[] {220200},
GOGIDs = new[] {1429864849},
IsGenericMO2Plugin = true,
RequiredFiles = new[]
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
@"KSP_x64.exe".ToRelativePath()
},
MainExecutable = @"KSP_x64.exe".ToRelativePath()
}
},
{
Game.Terraria, new GameMetaData
2021-10-16 11:21:45 +00:00
{
2021-10-23 16:51:17 +00:00
Game = Game.Terraria,
SteamIDs = new[] {1281930},
MO2Name = "Terraria",
IsGenericMO2Plugin = true,
RequiredFiles = new[]
2021-10-16 11:21:45 +00:00
{
2021-10-23 16:51:17 +00:00
@"tModLoader.exe".ToRelativePath()
},
MainExecutable = @"tModLoader.exe".ToRelativePath()
2021-09-27 12:42:46 +00:00
}
2021-11-27 08:21:11 +00:00
},
{
2021-11-27 08:24:11 +00:00
Game.Cyberpunk2077, new GameMetaData
2021-11-27 08:21:11 +00:00
{
Game = Game.Cyberpunk2077,
SteamIDs = new[] {1091500},
2022-09-26 21:58:33 +00:00
GOGIDs = new [] {2093619782, 1423049311},
2021-11-27 08:21:11 +00:00
MO2Name = "Cyberpunk 2077",
NexusName = "cyberpunk2077",
NexusGameId = 3333,
IsGenericMO2Plugin = true,
RequiredFiles = new[]
{
@"bin\x64\Cyberpunk2077.exe".ToRelativePath()
2021-11-27 08:21:11 +00:00
},
MainExecutable = @"bin\x64\Cyberpunk2077.exe".ToRelativePath()
2021-11-27 08:21:11 +00:00
}
2021-12-30 21:00:56 +00:00
},
{
Game.Sims4, new GameMetaData
{
Game = Game.Sims4,
SteamIDs = new[] {1222670},
MO2Name = "The Sims 4",
NexusName = "thesims4",
NexusGameId = 641,
IsGenericMO2Plugin = true,
RequiredFiles = new[]
{
@"Game\Bin\TS4_x64.exe".ToRelativePath()
},
MainExecutable = @"Game\Bin\TS4_x64.exe".ToRelativePath()
}
},
{
Game.DragonsDogma, new GameMetaData
{
Game = Game.DragonsDogma,
SteamIDs = new[] {367500 },
MO2Name = "Dragon's Dogma: Dark Arisen",
MO2ArchiveName = "dragonsdogma",
NexusName = "dragonsdogma",
NexusGameId = 1249,
IsGenericMO2Plugin = true,
RequiredFiles = new []
{
@"DDDA.exe".ToRelativePath()
},
MainExecutable = @"DDDA.exe".ToRelativePath()
}
2021-10-23 16:51:17 +00:00
}
};
2021-09-27 12:42:46 +00:00
2021-10-23 16:51:17 +00:00
public static ILookup<string?, GameMetaData> ByNexusName = Games.Values.ToLookup(g => g.NexusName ?? "");
2021-09-27 12:42:46 +00:00
2021-10-23 16:51:17 +00:00
public static GameMetaData? GetByMO2ArchiveName(string gameName)
{
2022-09-25 22:36:12 +00:00
return Games.Values.FirstOrDefault(g => (g.MO2ArchiveName ?? g.NexusName ?? "")!.Equals(gameName, StringComparison.InvariantCultureIgnoreCase));
2021-10-23 16:51:17 +00:00
}
2021-09-27 12:42:46 +00:00
2021-10-23 16:51:17 +00:00
public static GameMetaData? GetByNexusName(string gameName)
{
return Games.Values.FirstOrDefault(g => g.NexusName == gameName.ToLower());
}
2021-09-27 12:42:46 +00:00
2021-10-23 16:51:17 +00:00
public static GameMetaData? GetBySteamID(int id)
{
return Games.Values
.FirstOrDefault(g => g.SteamIDs.Length > 0 && g.SteamIDs.Any(i => i == id));
}
2021-09-27 12:42:46 +00:00
2021-10-23 16:51:17 +00:00
/// <summary>
/// Parse game data from an arbitrary string. Tries first via parsing as a game Enum, then by Nexus name.
/// <param nambe="someName">Name to query</param>
/// <returns>GameMetaData found</returns>
/// <exception cref="ArgumentNullException">If string could not be translated to a game</exception>
/// </summary>
public static GameMetaData GetByFuzzyName(string someName)
{
return TryGetByFuzzyName(someName) ??
throw new ArgumentNullException(nameof(someName), $"\"{someName}\" could not be translated to a game!");
}
2021-09-27 12:42:46 +00:00
2021-10-23 16:51:17 +00:00
private static GameMetaData? GetByMO2Name(string gameName)
{
gameName = gameName.ToLower();
return Games.Values.FirstOrDefault(g => g.MO2Name?.ToLower() == gameName);
}
2021-09-27 12:42:46 +00:00
2021-10-23 16:51:17 +00:00
/// <summary>
/// Tries to parse game data from an arbitrary string. Tries first via parsing as a game Enum, then by Nexus name.
/// <param nambe="someName">Name to query</param>
/// <returns>GameMetaData if found, otherwise null</returns>
/// </summary>
public static GameMetaData? TryGetByFuzzyName(string someName)
{
if (Enum.TryParse(typeof(Game), someName, true, out var metadata)) return ((Game) metadata!).MetaData();
2021-09-27 12:42:46 +00:00
2021-10-23 16:51:17 +00:00
var result = GetByNexusName(someName);
if (result != null) return result;
2021-09-27 12:42:46 +00:00
2021-10-23 16:51:17 +00:00
result = GetByMO2ArchiveName(someName);
if (result != null) return result;
2021-09-27 12:42:46 +00:00
2021-10-23 16:51:17 +00:00
result = GetByMO2Name(someName);
if (result != null) return result;
return int.TryParse(someName, out var id) ? GetBySteamID(id) : null;
}
2021-09-27 12:42:46 +00:00
2021-10-23 16:51:17 +00:00
public static bool TryGetByFuzzyName(string someName, out GameMetaData gameMetaData)
{
var result = TryGetByFuzzyName(someName);
if (result == null)
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
gameMetaData = Games.Values.First();
return false;
2021-09-27 12:42:46 +00:00
}
2021-10-23 16:51:17 +00:00
gameMetaData = result;
return true;
}
public static GameMetaData MetaData(this Game game)
{
return Games[game];
2021-09-27 12:42:46 +00:00
}
2021-11-27 08:21:11 +00:00
}