Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/Universalis.GameData/BoilmasterGameDataProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,15 +246,21 @@ private static Task<IReadOnlyDictionary<int, int>> LoadMarketableItemStackSizes(
private static Task<IReadOnlyList<DataCenter>> LoadDataCenters(IEnumerable<ApiWorld> worlds,
IEnumerable<ApiDataCenter> 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<IReadOnlyList<DataCenter>>(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)
Expand Down
12 changes: 9 additions & 3 deletions src/Universalis.GameData/CsvGameDataProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,21 @@ private static Task<IReadOnlyDictionary<int, int>> LoadMarketableItemStackSizes(

private static Task<IReadOnlyList<DataCenter>> LoadDataCenters(IEnumerable<CsvWorld> worlds, IEnumerable<CsvDc> dcs)
{
// Build a mapping from world name to world ID
var worldNameToId = GetValidWorlds(worlds)
.ToDictionary(w => w.Name, w => w.RowId);

return Task.FromResult<IReadOnlyList<DataCenter>>(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)
Expand Down
Loading