From e0975c695899d3603aaa09a4a6abe8ce9f49350a Mon Sep 17 00:00:00 2001 From: Chomp Date: Mon, 23 Jun 2025 11:38:26 +0100 Subject: [PATCH] Localised various error and warning messages --- .../SPT_Data/database/locales/server/en.json | 8 +++++ .../Controllers/RepeatableQuestController.cs | 14 ++++----- .../ExplorationQuestGenerator.cs | 30 +++++-------------- 3 files changed, 21 insertions(+), 31 deletions(-) diff --git a/Libraries/SPTarkov.Server.Assets/SPT_Data/database/locales/server/en.json b/Libraries/SPTarkov.Server.Assets/SPT_Data/database/locales/server/en.json index 95da578e..d9cd6ab8 100644 --- a/Libraries/SPTarkov.Server.Assets/SPT_Data/database/locales/server/en.json +++ b/Libraries/SPTarkov.Server.Assets/SPT_Data/database/locales/server/en.json @@ -661,6 +661,14 @@ "repeatable-quest_handover_failed_condition_invalid": "Quest handover error: condition not found or incorrect value. qid: {{body.qid}}, condition: {{body.conditionId}}", "repeatable-unable_to_accept_quest_see_log": "Unable to accept quest, see server log for details", "repeatable-unable_to_accept_quest_starting_message_not_found": "Unable to accept quest: {{questId}} cant find quest started message text with id: {{messageId}}", + "repeatable-unable_to_find_trader_in_pool": "Unable to draw a traderId from whitelist pool during repeatable quest generation", + "repeatable-quest_generation_failed_no_template": "Generating: %s quest failed, no quest template available", + "repeatable-available_for_finish_condition_failed_to_generate": "Generating AvailableForFinish condition failed for location: %s", + "repeatable-specific_extract_condition_failed_to_generate": "Generating SpecificExtractRequirement failed for location: %s", + "repeatable-no_location_found_for_exploration_quest_generation": "Unable tp generate Exploration repeatable quest, no remaining locations available", + "repeatable-unable_to_find_location_id_for_location_name": "Unable to find a locationId for: %s", + "repeatable-unable_to_find_exits_for_location": "Unable to get location exits for location: %s", + "repeatable-unable_choose_exit_pool_empty": "Unable to choose specific exit for map: %s as exit pool is empty", "reward-type_not_handled": "Reward type: {{rewardType}} not handled for quest/achievement: {{questId}}", "reward-unable_to_find_matching_hideout_production": "Unable to find matching hideout craft unlock for quest/achievement: {{questId}}, matches found: {{matchCount}}", "route_onupdate_no_response": "onUpdate: %s route doesn't report success or fail", diff --git a/Libraries/SPTarkov.Server.Core/Controllers/RepeatableQuestController.cs b/Libraries/SPTarkov.Server.Core/Controllers/RepeatableQuestController.cs index c7fb19d7..0c3f737e 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/RepeatableQuestController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/RepeatableQuestController.cs @@ -1,5 +1,4 @@ using SPTarkov.DI.Annotations; -using SPTarkov.Server.Core.Generators; using SPTarkov.Server.Core.Generators.RepeatableQuestGeneration; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Eft.Common; @@ -230,7 +229,7 @@ public class RepeatableQuestController( // Not free, Charge player + apply charisma bonus to cost of replacement cost.Count = (int) Math.Truncate( - cost.Count.Value * (1 - Math.Truncate(charismaBonus / 100) * 0.001) + cost.Count.Value * (1 - (Math.Truncate(charismaBonus / 100) * 0.001)) ); _paymentService.AddPaymentToOutput( pmcData, @@ -439,13 +438,10 @@ public class RepeatableQuestController( .ToList(); var traderId = _randomUtil.DrawRandomFromList(traders).FirstOrDefault(); - if (traderId is null) { - // TODO: Localize me! - _logger.Error( - "Could not draw traderId from whitelist during repeatable quest generation" - ); + _logger.Error(_localisationService.GetText("repeatable-unable_to_find_trader_in_pool")); + return null; } @@ -517,7 +513,7 @@ public class RepeatableQuestController( /// Id of quest to find /// Profile that contains quests to look through /// - protected GetRepeatableByIdResult GetRepeatableById(string questId, PmcData pmcData) + protected GetRepeatableByIdResult? GetRepeatableById(string questId, PmcData pmcData) { foreach (var repeatablesInProfile in pmcData.RepeatableQuests) { @@ -834,7 +830,7 @@ public class RepeatableQuestController( questsToKeep.Add(activeQuest); if (_logger.IsLogEnabled(LogLevel.Debug)) { - _logger.Debug( // TODO: this shouldnt happen, doesnt on live + _logger.Debug( // TODO: this shouldn't happen, doesn't on live $"Keeping repeatable quest: {activeQuest.Id} in activeQuests since it is available to hand in" ); } diff --git a/Libraries/SPTarkov.Server.Core/Generators/RepeatableQuestGeneration/ExplorationQuestGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/RepeatableQuestGeneration/ExplorationQuestGenerator.cs index 2f0baef9..cef64c42 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/RepeatableQuestGeneration/ExplorationQuestGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/RepeatableQuestGeneration/ExplorationQuestGenerator.cs @@ -67,10 +67,8 @@ public class ExplorationQuestGenerator( ) || locationInfo is null ) { - // TODO - Localize me - logger.Warning( - "Generating exploration repeatable quest failed, no remaining locations available" - ); + logger.Warning(localisationService.GetText("repeatable-no_location_found_for_exploration_quest_generation")); + return null; } @@ -84,18 +82,14 @@ public class ExplorationQuestGenerator( if (quest is null) { - // TODO - Localize me - logger.Error("Generating quest failed, no quest template available"); + logger.Error(localisationService.GetText("repeatable-quest_generation_failed_no_template", "exploration")); return null; } // Generate the available for finish exit condition if (!TryGenerateAvailableForFinish(quest, locationInfo)) { - // TODO - Localize me - logger.Error( - $"Generating AvailableForFinish failed for location {locationInfo.LocationName}" - ); + logger.Error(localisationService.GetText("repeatable-available_for_finish_condition_failed_to_generate", locationInfo.LocationName)); return null; } @@ -105,10 +99,7 @@ public class ExplorationQuestGenerator( && !TryGenerateSpecificExtractRequirement(quest, repeatableConfig, locationInfo) ) { - // TODO - Localize me - logger.Error( - $"Generating SpecificExtractRequirement failed for location {locationInfo.LocationName}" - ); + logger.Error(localisationService.GetText("repeatable-specific_extract_condition_failed_to_generate", locationInfo.LocationName)); return null; } @@ -232,8 +223,7 @@ public class ExplorationQuestGenerator( if (location is null) { - // TODO - Localize me - logger.Error($"Unable to get locationId for {locationInfo.LocationName}"); + logger.Error(localisationService.GetText("repeatable-unable_to_find_location_id_for_location_name", locationInfo.LocationName)); return false; } @@ -288,8 +278,7 @@ public class ExplorationQuestGenerator( if (mapExits is null) { - // TODO: Localize me - logger.Error($"Unable to get location list for location {locationInfo.LocationName}"); + logger.Error(localisationService.GetText("repeatable-unable_to_find_exits_for_location", locationInfo.LocationName)); return false; } @@ -308,10 +297,7 @@ public class ExplorationQuestGenerator( if (possibleExits.Count == 0) { - // TODO - Localize me! - logger.Error( - $"Unable to choose specific exit on map: {locationInfo.LocationName}, Possible exit pool was empty" - ); + logger.Error(localisationService.GetText("repeatable-unable_choose_exit_pool_empty", locationInfo.LocationName)); return false; }