Localised strings

Improved nullguards
This commit is contained in:
Chomp
2025-06-09 14:45:47 +01:00
parent d9132e5325
commit 8179e5c86b
6 changed files with 30 additions and 19 deletions
@@ -58,6 +58,7 @@
"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",
"cultistcircle-no_matching_threshhold_found": "Unable to find matching cultist circle threshold value that matches rouble amount: ({{rewardAmountRoubles}}), using fallback of 12 hour craft time",
"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}}",
@@ -189,6 +190,8 @@
"loot-default_preset_not_found_using_random": "Default preset for weapon: %s not found, choosing random of same weapon type instead",
"loot-item_missing_parentid": "Item: %s lacks a parentId value, unable to use item as loot",
"loot-non_item_picked_as_sealed_weapon_crate_reward": "Invalid weapon: %s, was picked as reward for sealed weapon crate, unable to create loot",
"loot-preset_pool_is_empty": "Unable to find random preset in the given pool as it is empty, skipping",
"loot-chosen_preset_missing_encyclopedia_value": "Chosen preset: %s lacks encyclopedia property, skipping",
"mail-unable_to_find_message_sender_by_id": "Unable to find mail message sender with id: %s",
"mail-unable_to_give_gift_not_handled": "Unable to give player gift using reward code: %s it is not handled by server",
"mailsend-missing_npc_dialog": "Unable to send message from: %s to player. A Dialog object for them does not exist",
@@ -631,6 +634,7 @@
"ragfair-unable_to_remove_offer_doesnt_exist": "Unable to remove offer with id: %s as it cannot be found in flea market",
"ragfair-unable_to_remove_offer_not_found_in_profile": "Unable to find offer: {{offerId}} in profile: {{profileId}} as offer is undefined, creating",
"ragfair-generating_offers": "Generating flea offers...",
"ragfair-offer_page_doesnt_exist": "The current flag page no longer exists, showing end of offers list",
"release-beta-disclaimer": "By pressing OK you agree that no support is offered and that this is for bug testing only. NOT actual gameplay. Mods are disabled. New profiles may be required frequently. Report all bugs in the reports channel in discord, or on the issues page on the website. If you don't press OK by the time specified, the game will close.",
"release-beta-disclaimer-accept": "User accepted the beta disclaimer",
"release-beta-disclaimer-mods-enabled": "By pressing OK you agree that no support is offered and that this is for bug testing only. NOT actual gameplay. Mods are enabled, do NOT report issues with mods. Do NOT ask mod authors for updated mods. Report all bugs in the reports channel in discord, or on the issues page on the website. If you dont press OK by the time specificed, the game will close.",
@@ -695,6 +699,7 @@
"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",
"scavcase-no_cartridges_found_matching_price": "Unable to get a list of ammo that matches desired criteria for scav case reward",
"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",
@@ -216,7 +216,7 @@ public class RagfairController
{
// Occurs when player edits "item count shown per page" value when on page near end of offer list
// The page no longer exists due to the larger number of items on each page, show them the very end of the offer list instead
_logger.Warning("Ragfair page no longer exists, showing end of offers list");
_logger.Warning(_localisationService.GetText("ragfair-offer_page_doesnt_exist"));
startIndex = result.Offers.Count - perPageLimit;
endIndex = result.Offers.Count;
}
@@ -399,21 +399,22 @@ public class LootGenerator(
HashSet<string> itemBlacklist,
List<List<Item>> result)
{
// Choose random preset and get details from item db using encyclopedia value (encyclopedia === tplId)
var chosenPreset = _randomUtil.GetArrayValue(presetPool);
if (chosenPreset is null)
if (presetPool.Count == 0)
{
_logger.Warning("Unable to find random preset in given presets, skipping");
_logger.Warning(_localisationService.GetText("loot-preset_pool_is_empty"));
return false;
}
// Choose random preset and get details from item db using encyclopedia value (encyclopedia === tplId)
var chosenPreset = _randomUtil.GetArrayValue(presetPool);
// No `_encyclopedia` property, not possible to reliably get root item tpl
if (chosenPreset.Encyclopedia is null)
if (chosenPreset?.Encyclopedia is null)
{
if (_logger.IsLogEnabled(LogLevel.Debug))
{
_logger.Debug($"Preset with id: {chosenPreset?.Id} lacks encyclopedia property, skipping");
_logger.Warning(_localisationService.GetText("loot-chosen_preset_missing_encyclopedia_value", chosenPreset?.Id));
}
return false;
@@ -432,13 +433,13 @@ public class LootGenerator(
}
// Skip preset if root item is blacklisted
if (itemBlacklist.Contains(chosenPreset.Items[0].Template))
if (itemBlacklist.Contains(chosenPreset.Items.FirstOrDefault().Template))
{
return false;
}
// Some custom mod items lack a parent property
if (itemDbDetails.Value.Parent is null)
if (itemDbDetails.Value?.Parent is null)
{
_logger.Error(_localisationService.GetText("loot-item_missing_parentid", itemDbDetails.Value?.Name));
@@ -26,6 +26,7 @@ public class ScavCaseRewardGenerator(
RagfairPriceService _ragfairPriceService,
SeasonalEventService _seasonalEventService,
ItemFilterService _itemFilterService,
LocalisationService localisationService,
ConfigServer _configServer,
ICloner _cloner
)
@@ -295,7 +296,7 @@ public class ScavCaseRewardGenerator(
/// <summary>
/// Get a random ammo from items.json that is not in the ammo blacklist AND inside the price range defined in scavcase.json config
/// </summary>
/// <param name="rarity">The rarity this ammo reward is for</param>
/// <param name="rarity">The rarity desired ammo reward is for</param>
/// <returns>random ammo item from items.json</returns>
protected TemplateItem GetRandomAmmo(string rarity)
{
@@ -303,9 +304,10 @@ public class ScavCaseRewardGenerator(
{
// Is ammo handbook price between desired range
var handbookPrice = _ragfairPriceService.GetStaticPriceForItem(ammo.Id);
if (
handbookPrice >= _scavCaseConfig.AmmoRewards.AmmoRewardValueRangeRub[rarity].Min &&
handbookPrice <= _scavCaseConfig.AmmoRewards.AmmoRewardValueRangeRub[rarity].Max
if (_scavCaseConfig.AmmoRewards.AmmoRewardValueRangeRub.TryGetValue(rarity,
out var matchingAmmoRewardForRarity) &&
handbookPrice >= matchingAmmoRewardForRarity.Min &&
handbookPrice <= matchingAmmoRewardForRarity.Max
)
{
return true;
@@ -317,7 +319,8 @@ public class ScavCaseRewardGenerator(
if (!possibleAmmoPool.Any())
{
_logger.Warning("Unable to get a list of ammo that matches desired criteria for scav case reward");
// Filtered pool is empty
_logger.Warning(localisationService.GetText("scavcase-no_cartridges_found_matching_price"));
}
// Get a random ammo and return it
@@ -329,6 +332,7 @@ public class ScavCaseRewardGenerator(
/// Also add a stack count to ammo and money
/// </summary>
/// <param name="rewardItems">items to convert</param>
/// <param name="rarity">The rarity desired ammo reward is for</param>
/// <returns>Product array</returns>
protected List<List<Item>> RandomiseContainerItemRewards(List<TemplateItem> rewardItems, string rarity)
{
@@ -255,12 +255,13 @@ public class CircleOfCultistService(
// No matching threshold, make one
if (matchingThreshold is null)
{
// None found, use a defalt
_logger.Warning("Unable to find a matching cultist circle threshold, using fallback of 12 hours");
// None found, use a default
_logger.Warning(
localisationService.GetText("cultistcircle-no_matching_threshhold_found", new { rewardAmountRoubles = rewardAmountRoubles }));
// Use first threshold value (cheapest) from parameter array, otherwise use 12 hours
var firstThreshold = thresholds.FirstOrDefault();
var craftTime = firstThreshold?.CraftTimeSeconds is not null && firstThreshold.CraftTimeSeconds > 0
var craftTime = firstThreshold?.CraftTimeSeconds > 0
? firstThreshold.CraftTimeSeconds
: _timeUtil.GetHoursAsSeconds(12);
@@ -147,7 +147,7 @@ public class LocaleService(
var platformLocale = GetPlatformLocale();
if (platformLocale == null)
{
_logger.Warning("System language could not be found, falling back to english");
_logger.Warning("System language not found, falling back to english");
return "en";
}
@@ -190,7 +190,7 @@ public class LocaleService(
var platformLocale = GetPlatformLocale();
if (platformLocale == null)
{
_logger.Warning("System language could not be found, falling back to english");
_logger.Warning("System language not found, falling back to english");
return "en";
}