diff --git a/src/Universalis.GameData/BoilmasterGameDataProvider.cs b/src/Universalis.GameData/BoilmasterGameDataProvider.cs index 09708442..4df41a1b 100644 --- a/src/Universalis.GameData/BoilmasterGameDataProvider.cs +++ b/src/Universalis.GameData/BoilmasterGameDataProvider.cs @@ -246,15 +246,21 @@ private static Task> LoadMarketableItemStackSizes( private static Task> LoadDataCenters(IEnumerable worlds, IEnumerable dcs) { + // Build a mapping from world name to world ID + var worldNameToId = GetValidWorlds(worlds) + .ToDictionary(w => w.Fields.Name, w => w.RowId); + return Task.FromResult>(dcs .Where(dc => dc.RowId is > 0 and < 99) .Select(dc => new DataCenter { Name = dc.Fields.Name, Region = Regions.Map[dc.Fields.Region], - WorldIds = GetValidWorlds(worlds) - .Where(w => w.Fields.DataCenter.RowId == dc.RowId) - .Select(w => w.RowId) + // Use hardcoded mapping instead of w.Fields.DataCenter.RowId, which is broken upstream + WorldIds = GlobalServers.WorldToDataCenter + .Where(kvp => kvp.Value == dc.Fields.Name) + .Where(kvp => worldNameToId.ContainsKey(kvp.Key)) + .Select(kvp => worldNameToId[kvp.Key]) .ToArray(), }) .Where(dc => dc.WorldIds.Length > 0) diff --git a/src/Universalis.GameData/CsvGameDataProvider.cs b/src/Universalis.GameData/CsvGameDataProvider.cs index 1f5c9801..66c1cf6d 100644 --- a/src/Universalis.GameData/CsvGameDataProvider.cs +++ b/src/Universalis.GameData/CsvGameDataProvider.cs @@ -148,15 +148,21 @@ private static Task> LoadMarketableItemStackSizes( private static Task> LoadDataCenters(IEnumerable worlds, IEnumerable dcs) { + // Build a mapping from world name to world ID + var worldNameToId = GetValidWorlds(worlds) + .ToDictionary(w => w.Name, w => w.RowId); + return Task.FromResult>(dcs .Where(dc => dc.RowId is > 0 and < 99) .Select(dc => new DataCenter { Name = dc.Name, Region = Regions.Map[dc.Region], - WorldIds = GetValidWorlds(worlds) - .Where(w => w.DataCenter == dc.RowId) - .Select(w => w.RowId) + // Use hardcoded mapping instead of w.DataCenter, which is broken upstream + WorldIds = GlobalServers.WorldToDataCenter + .Where(kvp => kvp.Value == dc.Name) + .Where(kvp => worldNameToId.ContainsKey(kvp.Key)) + .Select(kvp => worldNameToId[kvp.Key]) .ToArray(), }) .Where(dc => dc.WorldIds.Length > 0)