Skip to content

Commit

Permalink
Fixed localisation for some items and resources.
Browse files Browse the repository at this point in the history
  • Loading branch information
josdemmers committed Oct 23, 2024
1 parent 7d0fabd commit 63eba09
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion NewWorldCompanion.Services/NewWorldDataStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,27 @@ public string GetLevenshteinItemName(string itemName)

public string GetItemLocalisation(string itemMasterName)
{
return _itemDefinitionsLocalisation.GetValueOrDefault(itemMasterName.Trim(new char[] { '@' }).ToLower()) ?? itemMasterName.Trim(new char[] { '@' });
string itemMasterNameClean = itemMasterName.Trim(new char[] { '@' }).ToLower();

string? localisation = _itemDefinitionsLocalisation.GetValueOrDefault(itemMasterNameClean);

// v2 check
if (localisation == null)
{
itemMasterNameClean = itemMasterNameClean.Replace("_v2_", "_");
localisation = _itemDefinitionsLocalisation.GetValueOrDefault(itemMasterNameClean);
}

// tier check
if (localisation == null)
{
itemMasterNameClean = itemMasterNameClean.Replace("_t2", string.Empty);
itemMasterNameClean = itemMasterNameClean.Replace("_t3", string.Empty);
itemMasterNameClean = itemMasterNameClean.Replace("_t4", string.Empty);
localisation = _itemDefinitionsLocalisation.GetValueOrDefault(itemMasterNameClean);
}

return string.IsNullOrWhiteSpace(localisation) ? itemMasterName : localisation;
}

public string GetNamedItemLocalisation(string itemMasterName)
Expand Down

0 comments on commit 63eba09

Please sign in to comment.