Localised various error messages

This commit is contained in:
Chomp
2025-06-09 09:35:47 +01:00
parent 2ff286e5ed
commit 57c9ff477e
16 changed files with 65 additions and 53 deletions
@@ -6,6 +6,7 @@
"baseclass-item_not_found_failed": "Item %s still not found in base cache after regeneration",
"baseclass-missing_db_no_cache": "Database was empty, unable to generate an item base cache",
"bleeding_edge_build": "BLEEDINGEDGE",
"btr-unable_to_find_items_in_dialog_template": "Unable to find itemsDelivered in dialogueTemplates for player: %s",
"bot-bot-cache_has_zero_bots_of_requested_type": "WARNING - Bot cache does not have a pre-generated bot of type %s, will need to be generated, configure the bot.json config property (presetBatch) to be higher",
"bot-bot_preset_count_value_missing": "Unable to find a preset count to generate for bot: %s, defaulting to 30",
"bot-compatibility_check_missing_props": "Unable to validate item: {{id}} {{name}} in slot: {{slot}} can be equipped, it is missing a _props value",
@@ -56,6 +57,7 @@
"bot-weapon_missing_mod_slot": "Slot: {{modSlot}} does not exist for weapon: {{weaponId}} {{weaponName}} on {{botRole}}",
"bot-weapons_required_slot_missing_item": "Required slot '{{modSlot}}' on {{modName}} {{slotId}} was empty on {{botRole}}",
"build-unable_to_delete_preset": "Unable to delete preset, cannot find %s in weapon, equipment or magazine presets",
"cultistcircle-unable_to_find_stash_id": "Unable to find cultist circle stash ID inside inventory [HideoutAreaStashes]! No rewards were generated",
"chat-unable_to_register_command_already_registered": "Unable to register already registered command: %s",
"client_request": "[Client Request] %s",
"client_request_ip": "[Client Request] {{ip}} {{url}}",
@@ -79,6 +81,7 @@
"fence-unable_to_find_assort_by_id": "Unable to find fence assort for id: %s",
"fence-unable_to_find_offer_by_id": "Unable to find offer with id: %s",
"fence-unable_to_get_ammo_penetration_value": "No penetration value found for Ammo: %s, Unable to check if its above penetration limit, assuming false",
"fence-unable_to_find_root_item_to_add": "Unable to add items to Fence as no root items were found",
"fixer-clothing_item_found": "Clothing item: %s found in profile that does not exist in SPT. You WILL experience errors, this can be due to using a clothing mod and removing the mod with your character still wearing it. DO NOT USE THIS PROFILE. Open SPT_Data\\Server\\configs\\core.json, edit 'removeModItemsFromProfile' to be true. This will allow the server to edit your profile and hopefully remove the missing clothing",
"fixer-mod_item_found": "Item: %s found in profile that does not exist in items db. You WILL experience errors, this can be due to using an items mod and removing the mod without deleting the modded items from your inventory. DO NOT USE THIS PROFILE. Open SPT_Data\\Server\\configs\\core.json, edit 'removeModItemsFromProfile' to be true. This will allow the server to edit your profile and hopefully remove the bad items",
"fixer-trader_found": "Trader: %s found in profile but does not exist in SPT. You WILL experience errors, this can be due to using an trader mod and removing the mod without deleting the messages from said trader. DO NOT USE THIS PROFILE. Open SPT_Data\\Server\\configs\\core.json, edit 'removeModItemsFromProfile' and `removeInvalidTradersFromProfile` to be true. This will allow the server to edit your profile and hopefully remove the bad messages",
@@ -92,6 +95,7 @@
"hideout-missing_recipe_for_area": "Could not find recipe: %s for area type",
"hideout-missing_recipe_in_db": "Failed to locate recipe with _id: %s",
"hideout-no_bitcoins_to_collect": "No bitcoins are ready for pickup",
"hideout-bitcoin_craft_missing": "Bitcoin farm craft was not found, unable to update time spent crafting",
"hideout-unable_to_apply_stashsize_bonus_no_stash_found": "Unable to apply StashSize bonus, stash with id: %s not found in profile",
"hideout-unable_to_find_area": "Unable to find hideout area: %s in profile",
"hideout-unable_to_find_area_in_database": "Unable to find area: %s in database",
@@ -601,6 +605,8 @@
"quest-unable_to_find_repeatable_to_replace": "Unable to find repeatable quest in profile to replace, skipping",
"quest-unable_to_find_trader_in_profile": "Unable to find trader: %s in profile",
"quest-unable_to_remove_scav_quest_from_profile": "Unable to remove scav quest: {{questIdToRemove}} from profile: {{profileId}}",
"quest-repeatable_generation_failed_please_report": "Repeatable quest failed to generate after %s attempts. This should never happen. Please report",
"quest-repeatable_elimination_generation_failed_please_report": "Unable to generate a repeatable Elimination quest. No locations found. Please report",
"ragfair-invalid_player_offer_request": "Unable to place offer, request is invalid",
"ragfair-item_not_in_db_unable_to_generate_dynamic_stack_count": "Item with tpl: %s not found in db. Unable to generate a dynamic stack count",
"ragfair-missing_barter_scheme": "generateFleaOffersForTrader() Failed to find barterScheme for item id: {{itemId}} tpl: {{tpl}} on {{name}}",
@@ -689,6 +695,9 @@
"server_start_player_active_botreload_skill": "Your character has the 'BotReload' skill active, this will cause your guns to reload unnaturally fast, ignore this message if this is intended",
"server_start_success": "Server has started, happy playing",
"started_webserver_success": "Started webserver at %s",
"weightedrandomhelper-supplied_items_empty": "WeightedRandom() was given 0 items, unable to choose a random weight",
"weightedrandomhelper-supplied_weights_empty": "WeightedRandom() was given 0 weights, unable to choose a random weight",
"weightedrandomhelper-supplied_data_doesnt_match": "WeightedRandom() was given {{itemCount}} items and {{weightCount}} weights, unable to choose a random weight",
"trader-missing_durability_threshold_value": "Unable to find durability threshold value for trader: {{traderId}}, falling back to default of: {{value}}",
"trader-missing_repair_property_using_default": "Trader {{traderId}} {{nickname}} is missing a repair object, adding in default values",
"trader-missing_repair_quality_property_using_default": "Trader: {{traderId}} {{nickname}} is missing a repair quality property, adding in default value",
@@ -700,6 +709,9 @@
"trader-unable_to_find_trader_by_id": "Unable to find trader with Id: %s",
"trader-unable_to_find_trader_in_enum": "Unable to find trader: %s in Traders enum",
"trader-unable_to_purchase_item_limit_reached": "Unable to purchase item from trader: {{traderId}} as their purchase limit of: {{limit}} has been reached",
"trader-unable_to_find_selltotrader_counter": "Unable to find [sellToTrader] counter for: %s quest in db, counter will not be incremented",
"trader-unable_to_find_inventory_item_for_selltotrader_counter": "Unable to find inventory item: %s to sell, cannot increment counter, skipping",
"trader-unable_to_add_custom_trader": "Unable to add custom trader: {{traderId}}, {{stackTrace}}",
"unhandled_response": "[UNHANDLED][%s]",
"unknown_request": "Unknown request!",
"validation_error_decode": "Unable to decode checks.dat. File validation skipped.",
@@ -732,5 +744,6 @@
"chatbot-added_stash_rows_please_restart": "Added 2 rows to stash, please restart your game to see them",
"chatbot-snow_enabled": "Snow is enabled for all subsequent raids until the server is restarted",
"chatbot-summer_enabled": "Summer has been enabled for all subsequent raids until the server is restarted",
"chatbot-command_was_empty": "Your typed command was empty, unable to process",
"webserver_already_running": "Another copy of the webserver is already running. Please shut it down before starting a new one."
}
@@ -110,15 +110,14 @@ public class BotController(
var result = new Dictionary<string, Dictionary<string, DifficultyCategories>>();
var botTypesDb = _databaseService.GetBots().Types;
if (botTypesDb is null)
{
return result;
}
//Get all bot types as sting array
var botTypes = Enum.GetValues<WildSpawnType>().Select(item => item.ToString()).ToList();
foreach (var botType in botTypes)
{
if (botTypesDb is null)
{
continue;
}
// If bot is usec/bear, swap to different name
var botTypeLower = _botHelper.IsBotPmc(botType)
? _botHelper.GetPmcSideByRole(botType).ToLower()
@@ -354,7 +354,7 @@ public class RepeatableQuestController(
if (attempts > maxAttempts)
{
_logger.Error("We were stuck in repeatable quest generation. This should never happen. Please report");
_logger.Error(_localisationService.GetText("quest-repeatable_generation_failed_please_report", attempts));
}
return newRepeatableQuest;
@@ -68,7 +68,7 @@ public class TradeController(
if (request.Type == "sell_to_trader")
{
var sellData = (ProcessSellTradeRequestData) request;
_tradeHelper.sellItem(pmcData, pmcData, sellData, sessionID, output);
_tradeHelper.SellItem(pmcData, pmcData, sellData, sessionID, output);
return output;
}
@@ -229,8 +229,8 @@ public class RepeatableQuestGenerator(
}
else
{
// never should reach this if everything works out
_logger.Error("Encountered issue when creating Elimination quest. Please report.");
// Never should reach this if everything works out
_logger.Error(_localisationService.GetText("quest-repeatable_elimination_generation_failed_please_report"));
}
}
@@ -10,6 +10,7 @@ namespace SPTarkov.Server.Core.Helpers.Dialogue;
public abstract class AbstractDialogChatBot(
ISptLogger<AbstractDialogChatBot> _logger,
MailSendService _mailSendService,
LocalisationService localisationService,
IEnumerable<IChatCommand> chatCommands
) : IDialogueChatBot
{
@@ -22,7 +23,7 @@ public abstract class AbstractDialogChatBot(
{
if ((request.Text ?? "").Length == 0)
{
_logger.Error("Command came in as empty text! Invalid data!");
_logger.Error(localisationService.GetText("chatbot-command_was_empty"));
return request.DialogId;
}
@@ -13,9 +13,10 @@ namespace SPTarkov.Server.Core.Helpers.Dialogue;
public class CommandoDialogChatBot(
ISptLogger<AbstractDialogChatBot> logger,
MailSendService mailSendService,
LocalisationService localisationService,
ConfigServer _configServer,
IEnumerable<IChatCommand> chatCommands
) : AbstractDialogChatBot(logger, mailSendService, chatCommands)
) : AbstractDialogChatBot(logger, mailSendService, localisationService, chatCommands)
{
protected CoreConfig _coreConfig = _configServer.GetConfig<CoreConfig>();
@@ -1067,7 +1067,7 @@ public class HideoutHelper(
{
if (btcProduction is null)
{
_logger.Error("Bitcoin farm production was null, skipping");
_logger.Error(_localisationService.GetText("hideout-bitcoin_craft_missing"));
return;
}
@@ -123,7 +123,7 @@ public class RewardHelper(
break;
case RewardType.NotificationPopup:
// TODO: Wire up to notification system
_logger.Error("Unhandled: RewardType.NotificationPopup");
_logger.Error("UNHANDLED: RewardType.NotificationPopup");
break;
default:
_logger.Error(
@@ -262,7 +262,7 @@ public class TradeHelper(
/// <param name="sellRequest">Request data</param>
/// <param name="sessionID">Session id</param>
/// <param name="output">Item event router response</param>
public void sellItem(
public void SellItem(
PmcData profileWithItemsToSell,
PmcData profileToReceiveMoney,
ProcessSellTradeRequestData sellRequest,
@@ -335,14 +335,14 @@ public class TradeHelper(
}
// Find related task condition
var taskCondition = profileToReceiveMoney.TaskConditionCounters.Values.FirstOrDefault(condition =>
var taskCondition = profileToReceiveMoney.TaskConditionCounters?.Values.FirstOrDefault(condition =>
condition.SourceId == circulateQuestId && condition.Type == "SellItemToTrader"
);
// No relevant condtion in profile, nothing to increment
// No relevant condition in profile, nothing to increment
if (taskCondition is null)
{
_logger.Error("Unable to find `sellToTrader` task counter for Circulate quest in profile, skipping");
_logger.Error($"Unable to find `sellToTrader` task counter for {circulateQuestId} quest in profile, skipping");
return;
}
@@ -357,14 +357,14 @@ public class TradeHelper(
}
// Get sellToTrader condition from quest
var sellItemToTraderCondition = circulateQuestDb[circulateQuestId]
.Conditions.AvailableForFinish.FirstOrDefault(condition => condition.ConditionType == "SellItemToTrader"
var sellItemToTraderCondition = circulateQuestDb.GetValueOrDefault(circulateQuestId)?
.Conditions?.AvailableForFinish?.FirstOrDefault(condition => condition.ConditionType == "SellItemToTrader"
);
// Quest doesnt have a sellItemToTrader condition, nothing to do
// Quest doesn't have a sellItemToTrader condition, nothing to do
if (sellItemToTraderCondition is null)
{
_logger.Error("Unable to find `sellToTrader` counter for Circulate quest in db, skipping");
_logger.Error(_localisationService.GetText("quest-unable_to_find_selltotrader_counter", circulateQuestId));
return;
}
@@ -374,11 +374,11 @@ public class TradeHelper(
foreach (var itemSoldToTrader in sellRequest.Items)
{
// Get sold items' details from profile
var itemDetails = profileWithItemsToSell.Inventory.Items.FirstOrDefault(inventoryItem => inventoryItem.Id == itemSoldToTrader.Id
var itemDetails = profileWithItemsToSell.Inventory?.Items?.FirstOrDefault(inventoryItem => inventoryItem.Id == itemSoldToTrader.Id
);
if (itemDetails is null)
{
_logger.Error($"Unable to find item in inventory to sell to trader with id: {itemSoldToTrader.Id}, cannot increment counter, skipping");
_logger.Error(_localisationService.GetText("trader-unable_to_find_inventory_item_for_selltotrader_counter", circulateQuestId));
continue;
}
@@ -1,6 +1,7 @@
using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.Models.Spt.Helper;
using SPTarkov.Server.Core.Models.Utils;
using SPTarkov.Server.Core.Services;
using SPTarkov.Server.Core.Utils;
namespace SPTarkov.Server.Core.Helpers;
@@ -8,6 +9,7 @@ namespace SPTarkov.Server.Core.Helpers;
[Injectable]
public class WeightedRandomHelper(
ISptLogger<WeightedRandomHelper> _logger,
LocalisationService localisationService,
RandomUtil _randomUtil
)
{
@@ -47,17 +49,17 @@ public class WeightedRandomHelper(
{
if (items.Count == 0)
{
_logger.Error("Items must not be empty");
_logger.Error(localisationService.GetText("weightedrandomhelper-supplied_items_empty"));
}
if (weights.Count == 0)
{
_logger.Error("Item weights must not be empty");
_logger.Error(localisationService.GetText("weightedrandomhelper-supplied_weights_empty"));
}
if (items.Count != weights.Count)
{
_logger.Error("Items and weight inputs must be of the same length");
_logger.Error(localisationService.GetText("weightedrandomhelper-supplied_data_doesnt_match", new { itemCount = items .Count, weightCount = weights.Count}));
}
// Preparing the cumulative weights list.
@@ -101,7 +101,8 @@ public class BtrDeliveryService(
if (!dialogueTemplates.TryGetValue("itemsDelivered", out var itemsDelivered))
{
_logger.Error("dialogueTemplates doesn't contain itemsDelivered");
_logger.Error(_localisationService.GetText("btr-unable_to_find_items_in_dialog_template", sessionId));
return;
}
@@ -37,6 +37,7 @@ public class CircleOfCultistService(
DatabaseService _databaseService,
ItemFilterService _itemFilterService,
SeasonalEventService _seasonalEventService,
LocalisationService localisationService,
ConfigServer _configServer
)
{
@@ -60,10 +61,10 @@ public class CircleOfCultistService(
{
var output = _eventOutputHolder.GetOutput(sessionId);
var cultistCircleStashId = pmcData.Inventory.HideoutAreaStashes.GetValueOrDefault(((int)HideoutAreas.CircleOfCultists).ToString());
var cultistCircleStashId = pmcData.Inventory?.HideoutAreaStashes?.GetValueOrDefault(((int)HideoutAreas.CircleOfCultists).ToString());
if (cultistCircleStashId is null)
{
_logger.Error("Could not find cultist circle stash ID inside inventory! No rewards generated");
_logger.Error(localisationService.GetText("cultistcircle-unable_to_find_stash_id"));
return output;
}
@@ -760,7 +760,8 @@ public class FenceService(
.ToList();
if (assortRootItems.Count == 0)
{
logger.Error("Unable to add assorts to Fence as no root items exist in items being added");
logger.Error(localisationService.GetText("fence-unable_to_find_root_item_to_add"));
return;
}
@@ -1,4 +1,5 @@
using SPTarkov.DI.Annotations;
using Microsoft.Extensions.Logging;
using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.DI;
using SPTarkov.Server.Core.Models;
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
@@ -10,35 +11,27 @@ namespace SPTarkov.Server.Core.Services;
/// Source of truth for all default traders as well as any additional trader a server mod may add.
/// </summary>
[Injectable(InjectionType.Singleton, TypePriority = OnLoadOrder.TraderRegistration)]
public class TraderStore : IOnLoad
public class TraderStore(
DatabaseService databaseService,
IEnumerable<ITrader> injectedTraders,
LocalisationService localisationService,
ISptLogger<TraderStore> logger)
: IOnLoad
{
private readonly DatabaseService _databaseService;
private readonly IEnumerable<ITrader> _injectedTraders;
private readonly ISptLogger<TraderStore> _logger;
private readonly Dictionary<string, ITrader> _traders = new();
public TraderStore(DatabaseService databaseService,
IEnumerable<ITrader> injectedTraders,
ISptLogger<TraderStore> logger)
{
_databaseService = databaseService;
_injectedTraders = injectedTraders;
_logger = logger;
}
public Task OnLoad()
{
_logger.Info("Importing traders...");
logger.Info("Importing traders...");
var customTraders = 0;
foreach (var trader in _injectedTraders)
foreach (var trader in injectedTraders)
{
if (trader is ICustomTrader customTrader)
{
try
{
var dbTrader = new Trader()
var dbTrader = new Trader
{
Assort = customTrader.GetAssort(),
Base = customTrader.GetBase(),
@@ -47,14 +40,14 @@ public class TraderStore : IOnLoad
Suits = customTrader.GetSuits(),
Services = customTrader.GetServices(),
};
_databaseService.GetTraders().Add(trader.Id, dbTrader);
databaseService.GetTraders().Add(trader.Id, dbTrader);
_traders.Add(trader.Id, trader);
_logger.Info($"Loaded custom trader: {trader.Name}");
logger.Info($"Loaded custom trader: {trader.Name}");
customTraders++;
}
catch (Exception e)
{
_logger.Error("Failed to load custom trader", e);
logger.Error(localisationService.GetText("trader-unable_to_add_custom_trader", new { traderId = trader.Name, error = e.StackTrace }));
}
}
else
@@ -63,7 +56,7 @@ public class TraderStore : IOnLoad
}
}
_logger.Info($"Importing traders complete {(customTraders == 0 ? "" : $"[{customTraders} traders loaded]")}");
logger.Info($"Importing traders complete {(customTraders == 0 ? "" : $"[{customTraders} traders loaded]")}");
return Task.CompletedTask;
}
@@ -27,7 +27,7 @@ public class ReflectionsCloner(ISptLogger<ReflectionsCloner> logger) : ICloner
}
catch (Exception e)
{
logger.Error("cloning error:", e);
logger.Error("Cloning error:", e);
return default;
}
}