Localised various errors

This commit is contained in:
Dev 2024-05-27 20:06:10 +01:00
parent 4b8d9f7e22
commit a37664f43a
10 changed files with 63 additions and 32 deletions

View File

@ -49,17 +49,23 @@
"bot-unable_to_generate_item_pool_no_items": "Unable to generate an item pool of type: %s as no items were provided, this will pool will be skipped",
"bot-unable_to_get_bot_difficulty_fallback_to_assault": "Unable to find bot: {{botType}} difficulty {{difficulty}}, using assault difficulty as fallback",
"bot-unable_to_get_bot_fallback_to_assault": "Unable to find bot: %s JSON, using assault bot as fallback",
"bot-unable_to_load_raid_settings_from_appcontext": "Unable to load raid settings from ApplicationContext",
"bot-weapon_contains_invalid_item": "Required slot: '{{modSlot}}' on weapon: {{weaponTpl}} has an invalid item: {{modName}}",
"bot-weapon_generated_incorrect_using_default": "Weapon %s was generated incorrectly, falling back to weapon preset see error above",
"bot-weapon_missing_magazine_or_chamber": "Weapon with tpl: {{weaponId}} has no magazine or chamber - {{botRole}}",
"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",
"chat-unable_to_register_command_already_registered": "Unble to register already registed command: %s",
"client_request": "[Client Request] %s",
"client_request_ip": "[Client Request] {{ip}} {{url}}",
"customisation-item_already_purchased": "Clothing item {{itemId}} {{itemName}} already purchased",
"customisation-suit_lacks_upd_or_stack_property": "Suit with tpl: %s lacks a upd object or stackobjectcount property",
"customisation-unable_to_find_clothing_item_in_inventory": "Clothing item not found in inventory with id: %s",
"customisation-unable_to_find_suit_by_id": "Unable to find trader suit offer with id: %s",
"customisation-unable_to_find_suit_with_id": "Unable to find suit with offer id: %s",
"customisation-unable_to_get_trader_suits": "Unable to get suits from trader: %s",
"dialog-chatbot_id_already_exists": "Chat bot: %s being registered already exists, unable to register bot",
"dialog-missing_item_template": "Unable to find item tpl {{tpl}} in db, cannot send message of type {{type}}, skipping",
"dialogue-unable_to_find_dialogs_in_profile": "No dialog object in profile: {{sessionId}}",
"dialogue-unable_to_find_in_profile": "No dialog in profile: {{sessionId}} found with id: {{dialogueId}}",
@ -101,10 +107,16 @@
"inraid-unable_to_deliver_item_no_trader_found": "Unable to deliver items as trader %s has no dialogue data",
"inraid-unable_to_find_key_in_taskconditioncounters": "Unable to find key: %s in TaskConditionCounters pre-raid data",
"inraid-unable_to_migrate_pmc_quest_not_found_in_profile": "Unable to migrate post-raid quest: %s data to profile, cannot find quest in profile",
"insurance-item_not_found_in_post_raid_data": "Unable to find insured inventory item with id: %s in post-raid data",
"insurance-missing_insurance_price_multiplier": "No insurance multiplier found for trader: %s, check it exists in InsuranceConfig.js, falling back to default value of: 0.3",
"insurance-post_raid_item_not_found": "Insured item: %s not found in post-raid inventory",
"insurance-pre_raid_item_not_found": "Pre raid inventory item: %s was not found",
"insurance-trader_lacks_dialogue_property": "Trader: %s does not have a dialogue property, unable to send insurance items",
"insurance-trader_missing_from_enum": "Trader: %s is missing from Traders enum",
"insurance-unable_to_find_attachment_in_db": "Could not find insured attachment in the database - ID: {{insuredItemId}}, Template: {{insuredItemTpl}}",
"insurance-unable_to_find_main_parent_for_attachment": "Could not find main-parent for insured attachment - ID: {{insuredItemId}}, Template: {{insuredItemTpl}}, Parent ID: {{parentId}}",
"insurance-unable_to_find_parent_of_item": "Could not find parent for insured item - ID: {{insuredItemId}}, Template: {{insuredItemTpl}}, Parent ID: {{parentId}}",
"insurance-unable_to_find_trader_by_id": "Trader: %s could not found",
"inventory-edit_trader_item": "Unable to edit a traders item",
"inventory-examine_item_does_not_exist": "examineItem() - No id with %s found",
"inventory-fill_container_failed": "fillContainerMapWithItem() returned with an error %s",
@ -168,6 +180,7 @@
"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",
"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",
"mailsend-missing_parent": "Unable to find an item with slotId of: hideout for message to: {{traderId}} sender: {{sender}}",
@ -197,6 +210,7 @@
"modloader-missing_sptversion_field": "Mod %s is missing the sptVersion field, most likely due to being out of date and incompatible with the current version of SPT",
"modloader-mod_has_no_main_property": "ModLoader: Mod (%s) is incompatible. It lacks a 'main' property",
"modloader-mod_incompatible": "ModLoader: Mod (%s) is incompatible. It must implement at least one of the following: IPostSptLoadMod, IPostDBLoadMod, IPreSptLoadMod",
"modloader-mod_isnt_present": "Mod: %s isn't present",
"modloader-mod_order_error": "ModLoader: Errors were found in order.json, GOING TO USE DEFAULT LOAD ORDER",
"modloader-mod_order_missing": "ModLoader: order.json is missing, creating...",
"modloader-mod_order_missing_from_json": "ModLoader: Mod %s is missing from order.json, adding",
@ -562,6 +576,7 @@
"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}}",
"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}}",
"ragfair-no_trader_assorts_cant_generate_flea_offers": "Unable to generate flea offers for trader %s, no assort found",
"ragfair-offer_no_longer_exists": "Offer no longer exists",
@ -593,7 +608,13 @@
"release-server-mods-debug-message": "Server mods loaded",
"release-server-mods-loaded": "One or more server mods exist on a mod enabled build, reports will be invalid until removed. See the top of the server for loaded server mods to remove to report issues again.",
"release-summary": "",
"repair-item_has_no_repair_points": "Repairable item: %s has no repair points",
"repair-item_not_found_unable_to_repair": "Item: %s not found in inventory. Unable to repair it",
"repair-repair_kit_not_found_in_inventory": "Unable to find repair kit: %s in inventory",
"repair-unable_to_find_item_in_db": "Unable to repair item: %s, cannot find in items db, cannot add repair skill points",
"repair-unable_to_find_item_in_inventory_cant_repair": "unable to find item: %s in inventory, cannot repair item",
"repair-unable_to_find_item_repair_cost": "Unable to find repair cost for item: %s",
"repair-unable_to_find_trader_details_by_id": "Unable to find trader: %s repair details",
"repeatable-accepted_repeatable_quest_not_found_in_active_quests": "Accepted a repeatable quest: %s which could not be found in the activeQuests array. Please report this bug",
"repeatable-completion_quest_whitelist_too_small_or_blacklist_too_restrictive": "Generate Completion Quest: No items remain. Either Whitelist is too small or Blacklist too restrictive",
"repeatable-difficulty_was_nan": "Repeatable Reward Generation: Difficulty was NaN. Setting to 1.",

View File

@ -214,7 +214,7 @@ export class BotController
if (raidSettings === undefined)
{
throw new Error("Raid settings could not be loaded from ApplicationContext");
throw new Error(this.localisationService.getText("bot-unable_to_load_raid_settings_from_appcontext"));
}
const pmcLevelRangeForMap
= this.pmcConfig.locationSpecificPmcLevelOverride[raidSettings.location.toLowerCase()];
@ -376,7 +376,7 @@ export class BotController
if (raidSettings === undefined)
{
throw new Error("Raid settings could not be loaded from ApplicationContext");
throw new Error(this.localisationService.getText("bot-unable_to_load_raid_settings_from_appcontext"));
}
const pmcLevelRangeForMap
= this.pmcConfig.locationSpecificPmcLevelOverride[raidSettings.location.toLowerCase()];

View File

@ -47,7 +47,8 @@ export class CustomizationController
// Return all suits that have a side array containing the players side (usec/bear)
const matchedSuits = matchingSuits?.filter((x) => templates[x.suiteId]._props.Side.includes(pmcData.Info.Side));
if (matchingSuits === undefined)
throw new Error(`Unable to get trader suits for trader ${traderID}`);
throw new Error(this.localisationService.getText("customisation-unable_to_get_trader_suits", traderID));
return matchedSuits!;
}
@ -138,8 +139,9 @@ export class CustomizationController
const foundSuit = this.getAllTraderSuits(sessionId).find((x) => x._id === offerId);
if (foundSuit === undefined)
{
throw new Error(`Unable to find suit with offer id ${offerId}`);
throw new Error(this.localisationService.getText("customisation-unable_to_find_suit_with_id", offerId));
}
return foundSuit;
}
@ -209,7 +211,7 @@ export class CustomizationController
if (!relatedItem.upd || !relatedItem.upd.StackObjectsCount)
{
throw new Error(`Suit with tpl id ${relatedItem._tpl} does not have upd or stack object count properties`);
throw new Error(this.localisationService.getText("customisation-suit_lacks_upd_or_stack_property", relatedItem._tpl));
}
if (relatedItem.upd.StackObjectsCount > clothingItem.count)

View File

@ -51,7 +51,7 @@ export class DialogueController
{
if (this.dialogueChatBots.some((cb) => cb.getChatBot()._id === chatBot.getChatBot()._id))
{
throw new Error(`The chat bot ${chatBot.getChatBot()._id} being registered already exists!`);
throw new Error(this.localisationService.getText("dialog-chatbot_id_already_exists", chatBot.getChatBot()._id));
}
this.dialogueChatBots.push(chatBot);
}

View File

@ -6,12 +6,14 @@ import { IUserDialogInfo } from "@spt/models/eft/profile/ISptProfile";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { ICoreConfig } from "@spt/models/spt/config/ICoreConfig";
import { ConfigServer } from "@spt/servers/ConfigServer";
import { LocalisationService } from "@spt/services/LocalisationService";
@injectable()
export class SptCommandoCommands implements IChatCommand
{
constructor(
@inject("ConfigServer") protected configServer: ConfigServer,
@inject("LocalisationService") protected localisationService: LocalisationService,
@injectAll("SptCommand") protected sptCommands: ISptCommand[],
)
{
@ -33,7 +35,7 @@ export class SptCommandoCommands implements IChatCommand
{
if (this.sptCommands.some((c) => c.getCommand() === command.getCommand()))
{
throw new Error(`The command "${command.getCommand()}" attempting to be registered already exists.`);
throw new Error(this.localisationService.getText("chat-unable_to_register_command_already_registered", command.getCommand()));
}
this.sptCommands.push(command);
}

View File

@ -15,6 +15,7 @@ import { ConfigServer } from "@spt/servers/ConfigServer";
import { DatabaseServer } from "@spt/servers/DatabaseServer";
import { SaveServer } from "@spt/servers/SaveServer";
import { ItemFilterService } from "@spt/services/ItemFilterService";
import { LocalisationService } from "@spt/services/LocalisationService";
import { MailSendService } from "@spt/services/MailSendService";
import { ICloner } from "@spt/utils/cloners/ICloner";
import { RandomUtil } from "@spt/utils/RandomUtil";
@ -40,6 +41,7 @@ export class RagfairServerHelper
@inject("ItemHelper") protected itemHelper: ItemHelper,
@inject("TraderHelper") protected traderHelper: TraderHelper,
@inject("MailSendService") protected mailSendService: MailSendService,
@inject("LocalisationService") protected localisationService: LocalisationService,
@inject("ItemFilterService") protected itemFilterService: ItemFilterService,
@inject("ConfigServer") protected configServer: ConfigServer,
@inject("RecursiveCloner") protected cloner: ICloner,
@ -186,7 +188,7 @@ export class RagfairServerHelper
const itemDetails = this.itemHelper.getItem(tplId);
if (!itemDetails[0])
{
throw new Error(`Item with tpl ${tplId} not found. Unable to generate a dynamic stack count.`);
throw new Error(this.localisationService.getText("ragfair-item_not_in_db_unable_to_generate_dynamic_stack_count", tplId));
}
// Item Types to return one of
@ -241,7 +243,7 @@ export class RagfairServerHelper
*/
public getPresetItems(item: Item): Item[]
{
const preset = this.cloner.clone(this.databaseServer.getTables().globals.ItemPresets[item._id]._items);
const preset = this.cloner.clone(this.databaseServer.getTables().globals!.ItemPresets[item._id]._items);
return this.itemHelper.reparentItemAndChildren(item, preset);
}
@ -253,12 +255,12 @@ export class RagfairServerHelper
public getPresetItemsByTpl(item: Item): Item[]
{
const presets = [];
for (const itemId in this.databaseServer.getTables().globals.ItemPresets)
for (const itemId in this.databaseServer.getTables().globals!.ItemPresets)
{
if (this.databaseServer.getTables().globals.ItemPresets[itemId]._items[0]._tpl === item._tpl)
if (this.databaseServer.getTables().globals!.ItemPresets[itemId]._items[0]._tpl === item._tpl)
{
const presetItems = this.cloner.clone(
this.databaseServer.getTables().globals.ItemPresets[itemId]._items,
this.databaseServer.getTables().globals!.ItemPresets[itemId]._items,
);
presets.push(this.itemHelper.reparentItemAndChildren(item, presetItems));
}

View File

@ -48,7 +48,7 @@ export class ModLoadOrder
{
if (!this.mods.has(mod))
{
throw new Error(`Mod: ${mod} isn't present.`);
throw new Error(this.localisationService.getText("modloader-mod_isnt_present", mod));
}
const config = this.mods.get(mod);
@ -70,7 +70,7 @@ export class ModLoadOrder
{
if (!this.mods.has(mod))
{
throw new Error(`Mod: ${mod} isn't present.`);
throw new Error(this.localisationService.getText("modloader-mod_isnt_present", mod));
}
const config = this.mods.get(mod);

View File

@ -105,14 +105,16 @@ export class InsuranceService
const markOfTheUnheardOnPlayer = pmcData.Inventory.items
.filter((item) => item.slotId?.startsWith("SpecialSlot"))
.find((item) => item._tpl === "65ddcc9cfa85b9f17d0dfb07");
// Get insurance items for each trader
for (const traderId in this.getInsurance(sessionID))
{
const traderBase = this.traderHelper.getTrader(traderId, sessionID);
if (!traderBase)
{
throw new Error(`The trader id ${traderId} was not found!`);
throw new Error(this.localisationService.getText("insurance-unable_to_find_trader_by_id", traderId));
}
let insuranceReturnTimestamp = this.getInsuranceReturnTimestamp(pmcData, traderBase);
if (markOfTheUnheardOnPlayer)
{
@ -120,10 +122,9 @@ export class InsuranceService
.globals!.config.Insurance.CoefOfHavingMarkOfUnknown;
}
const dialogueTemplates = this.databaseServer.getTables().traders![traderId].dialogue;
if (!dialogueTemplates)
{
throw new Error(`The trader id ${traderId} does not have dialogues for insurance`);
throw new Error(this.localisationService.getText("insurance-trader_lacks_dialogue_property", traderId));
}
const systemData = {
@ -131,10 +132,11 @@ export class InsuranceService
time: this.timeUtil.getTimeMailFormat(),
location: mapId,
};
const traderEnum = this.traderHelper.getTraderById(traderId);
if (!traderEnum)
{
throw new Error(`The trader id ${traderId} is missing from Traders enum`);
throw new Error(this.localisationService.getText("insurance-trader_missing_from_enum", traderId));
}
// Send "i will go look for your stuff" message from trader to player
this.mailSendService.sendLocalisedNpcMessageToPlayer(
@ -290,8 +292,9 @@ export class InsuranceService
?.find((insuranceItem) => insuranceItem.id === insuredItem.itemId);
if (!inventoryInsuredItem)
{
throw new Error(`Inventory insured item id ${insuredItem.itemId} was not found`);
throw new Error(this.localisationService.getText("insurance-item_not_found_in_post_raid_data", insuredItem.itemId));
}
equipmentPkg.push({
pmcData: pmcData,
itemToReturnToPlayer: this.getInsuredItemDetails(
@ -323,14 +326,14 @@ export class InsuranceService
const preRaidInventoryItem = preRaidGear.find((item) => item._id === softInsertChildModId);
if (!preRaidInventoryItem)
{
throw new Error(`Preraid inventory item ${softInsertChildModId} was not found`);
throw new Error(this.localisationService.getText("insurance-pre_raid_item_not_found", softInsertChildModId));
}
const inventoryInsuredItem = offraidData.insurance?.find(
(insuranceItem) => insuranceItem.id === softInsertChildModId,
);
if (!inventoryInsuredItem)
{
throw new Error(`Inventory insured item ${softInsertChildModId} was not found`);
throw new Error(this.localisationService.getText("insurance-post_raid_item_not_found", softInsertChildModId));
}
equipmentPkg.push({
pmcData: pmcData,

View File

@ -544,7 +544,7 @@ export class MailSendService
const senderId = this.getMessageSenderIdByType(messageDetails);
if (!senderId)
{
throw new Error(`Unable to find sender id for details ${messageDetails.sender}`);
throw new Error(this.localisationService.getText("mail-unable_to_find_message_sender_by_id", messageDetails.sender));
}
// Does dialog exist
let senderDialog = dialogsInProfile[senderId];

View File

@ -60,17 +60,17 @@ export class RepairService
traderId: string,
): RepairDetails
{
const itemToRepair = pmcData.Inventory.items.find((x) => x._id === repairItemDetails._id);
const itemToRepair = pmcData.Inventory.items.find((item) => item._id === repairItemDetails._id);
if (!itemToRepair)
{
throw new Error(`Item ${repairItemDetails._id} not found in profile inventory, unable to repair`);
throw new Error(this.localisationService.getText("repair-unable_to_find_item_in_inventory_cant_repair", repairItemDetails._id));
}
const priceCoef = this.traderHelper.getLoyaltyLevel(traderId, pmcData).repair_price_coef;
const traderRepairDetails = this.traderHelper.getTrader(traderId, sessionID)?.repair;
if (!traderRepairDetails)
{
throw new Error(`Trader details for ${traderId} was not found`);
throw new Error(this.localisationService.getText("repair-unable_to_find_trader_details_by_id", traderId));
}
const repairQualityMultiplier = Number(traderRepairDetails.quality);
const repairRate = priceCoef <= 0 ? 1 : priceCoef / 100 + 1;
@ -92,7 +92,7 @@ export class RepairService
const itemRepairCost = this.databaseServer.getTables().templates!.items[itemToRepair._tpl]._props.RepairCost;
if (!itemRepairCost)
{
throw new Error(`Item with tpl ${itemToRepair._tpl} has no repair cost`);
throw new Error(this.localisationService.getText("repair-unable_to_find_item_repair_cost", itemToRepair._tpl));
}
const repairCost = Math.round(
itemRepairCost * repairItemDetails.count * repairRate * this.repairConfig.priceMultiplier,
@ -196,7 +196,7 @@ export class RepairService
const vestSkillToLevel = isHeavyArmor ? SkillTypes.HEAVY_VESTS : SkillTypes.LIGHT_VESTS;
if (!repairDetails.repairPoints)
{
throw new Error(`Repair for ${repairDetails.repairedItem._tpl} has no repair points`);
throw new Error(this.localisationService.getText("repair-item_has_no_repair_points", repairDetails.repairedItem._tpl));
}
const pointsToAddToVestSkill
= repairDetails.repairPoints * this.repairConfig.armorKitSkillPointGainPerRepairPointMultiplier;
@ -229,8 +229,9 @@ export class RepairService
// Limit gain to a max value defined in config.maxIntellectGainPerRepair
if (!repairDetails.repairPoints)
{
throw new Error(`Repair for ${repairDetails.repairedItem._tpl} has no repair points`);
throw new Error(this.localisationService.getText("repair-item_has_no_repair_points", repairDetails.repairedItem._tpl));
}
return Math.min(
repairDetails.repairPoints * intRepairMultiplier,
this.repairConfig.maxIntellectGainPerRepair.kit,
@ -297,7 +298,7 @@ export class RepairService
const itemToRepair = pmcData.Inventory.items.find((x: { _id: string }) => x._id === itemToRepairId);
if (itemToRepair === undefined)
{
throw new Error(`Item ${itemToRepairId} not found, unable to repair`);
throw new Error(this.localisationService.getText("repair-item_not_found_unable_to_repair", itemToRepairId));
}
const itemsDb = this.databaseServer.getTables().templates!.items;
@ -322,10 +323,10 @@ export class RepairService
// Find and use repair kit defined in body
for (const repairKit of repairKits)
{
const repairKitInInventory = pmcData.Inventory.items.find((x) => x._id === repairKit._id);
const repairKitInInventory = pmcData.Inventory.items.find((item) => item._id === repairKit._id);
if (!repairKitInInventory)
{
throw new Error(`Repair kit with id ${repairKit._id} was not found in the inventory`);
throw new Error(this.localisationService.getText("repair-repair_kit_not_found_in_inventory", repairKit._id));
}
const repairKitDetails = itemsDb[repairKitInInventory._tpl];
const repairKitReductionAmount = repairKit.count;
@ -564,7 +565,7 @@ export class RepairService
if (!repairDetails.repairPoints)
{
throw new Error(`Repair for ${repairDetails.repairedItem._tpl} has no repair points`);
throw new Error(this.localisationService.getText("repair-item_has_no_repair_points", repairDetails.repairedItem._tpl));
}
const durabilityToRestorePercent = repairDetails.repairPoints / template._props.MaxDurability!;
const durabilityMultiplier = this.getDurabilityMultiplier(