From 63eba09fa04fa77ae5222cb0c4f7d3be0b570a4d Mon Sep 17 00:00:00 2001 From: Jos Demmers <8627157+josdemmers@users.noreply.github.com> Date: Wed, 23 Oct 2024 19:30:44 +0200 Subject: [PATCH] Fixed localisation for some items and resources. --- .../NewWorldDataStore.cs | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/NewWorldCompanion.Services/NewWorldDataStore.cs b/NewWorldCompanion.Services/NewWorldDataStore.cs index b183de8..e180623 100644 --- a/NewWorldCompanion.Services/NewWorldDataStore.cs +++ b/NewWorldCompanion.Services/NewWorldDataStore.cs @@ -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)