From a5dbfef7d003eb7822eddca0486b1a93ad3fe4ea Mon Sep 17 00:00:00 2001 From: Dev Date: Tue, 24 Oct 2023 16:40:34 +0100 Subject: [PATCH] Localise some error text --- project/assets/database/locales/server/en.json | 6 ++++++ project/src/controllers/BotController.ts | 2 +- project/src/helpers/InventoryHelper.ts | 4 ++-- project/src/services/MailSendService.ts | 11 +++++++---- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/project/assets/database/locales/server/en.json b/project/assets/database/locales/server/en.json index 9de75f9c..c3c5cc30 100644 --- a/project/assets/database/locales/server/en.json +++ b/project/assets/database/locales/server/en.json @@ -50,6 +50,7 @@ "bot-unable_to_edit_limits_of_unknown_map": "Unable to edit bot limits of map: %s as it cannot be found", "bot-unable_to_find_loot_n_value_for_bot": "Unable to find loot N value for bot: %s, using scav n value instead", "bot-unable_to_find_bot_in_cache": "Unable to find bot in cache with name: %s", + "bot-missing_application_context": "applicationContex could not find %s value. Did you restart the server without restarting the game?", "client_request": "[Client Request] %s", "customisation-item_already_purchased": "Clothing item {{itemId}} {{itemName}} already purchased", "customisation-unable_to_find_suit_by_id": "Unable to find trader suit offer with id: %s", @@ -99,6 +100,8 @@ "inventory-get_item_size_item_not_found_by_tpl": "getSizeByInventoryItemHash() Item with tpl: %s not found", "inventory-item_to_toggle_missing_upd": "Inventory item with _id: %s is missing a upd object, adding", "inventory-unable_to_toggle_item_not_found": "Unable to toggle inventory item with id: %s, item not found", + "inventory-missing_stash_size": "Unable to determine stash size as no stash found in player inventory", + "inventory-stash_not_found": "Unable to find stash %s in db", "item-durability_value_invalid_use_default": "getRepairableItemQualityValue() weapon tpl: %s durability value is invalid, defaulting to 1", "linux_use_priviledged_port_non_root": "Non-root processes cannot bind to ports below 1024", "location-containers_generated_success": "A total of %s static containers generated", @@ -115,6 +118,9 @@ "location-spawnpoint_missing_items": "Chosen dynamic spawnpoint %s has no items, skipping", "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", + "mailsend-missing_trader": "Unable to send message type: {{messageType}} to player: {{sessionId}}, given trader enum was null", + "mailsend-missing_npc_dialog": "Unable to send message from %s. Dialog for them does not exist", + "mailsend-missing_parent": "Unable to find an item with slotId of: hideout for message to: {{traderId}} sender: {{sender}}", "mod-send_bundle_url": "[BUNDLE]: %s", "modloader-checked": "checked", "modloader-checking_mod": "checking: %s", diff --git a/project/src/controllers/BotController.ts b/project/src/controllers/BotController.ts index c758c580..89fecf8b 100644 --- a/project/src/controllers/BotController.ts +++ b/project/src/controllers/BotController.ts @@ -83,7 +83,7 @@ export class BotController const raidConfig = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION)?.getValue(); if (!raidConfig) { - this.logger.error("applicationContex could not find RAID_CONFIGURATION value, raidConfig is undefined"); + this.logger.error(this.localisationService.getText("bot-missing_application_context", "RAID_CONFIGURATION")); } // Check value chosen in pre-raid difficulty dropdown diff --git a/project/src/helpers/InventoryHelper.ts b/project/src/helpers/InventoryHelper.ts index 942483eb..455f38f5 100644 --- a/project/src/helpers/InventoryHelper.ts +++ b/project/src/helpers/InventoryHelper.ts @@ -941,12 +941,12 @@ export class InventoryHelper const stashTPL = this.getStashType(sessionID); if (!stashTPL) { - this.logger.error("No stash found in player inventory"); + this.logger.error(this.localisationService.getText("inventory-missing_stash_size")); } const stashItemDetails = this.itemHelper.getItem(stashTPL); if (!stashItemDetails[0]) { - this.logger.error(`Stash with id: ${stashTPL} not found in db`); + this.logger.error(this.localisationService.getText("inventory-stash_not_found", stashTPL)); } const stashX = stashItemDetails[1]._props.Grids[0]._props.cellsH !== 0 diff --git a/project/src/services/MailSendService.ts b/project/src/services/MailSendService.ts index b1985030..88c853a0 100644 --- a/project/src/services/MailSendService.ts +++ b/project/src/services/MailSendService.ts @@ -50,7 +50,7 @@ export class MailSendService { if (!trader) { - this.logger.error(`Unable to send message type: ${messageType} to player: ${sessionId}, provided trader enum was null`); + this.logger.error(this.localisationService.getText("mailsend-missing_trader", {messageType: messageType, sessionId: sessionId})); return; } @@ -96,7 +96,7 @@ export class MailSendService { if (!trader) { - this.logger.error(`Unable to send message type: ${messageType} to player: ${sessionId}, provided trader enum was null`); + this.logger.error(this.localisationService.getText("mailsend-missing_trader", {messageType: messageType, sessionId: sessionId})); return; } @@ -264,7 +264,9 @@ export class MailSendService const dialogWithNpc = playerProfile.dialogues[targetNpcId]; if (!dialogWithNpc) { - this.logger.error(`Dialog for: ${targetNpcId} does not exist`); + this.logger.error(this.localisationService.getText("mailsend-missing_npc_dialog", targetNpcId)); + + return; } dialogWithNpc.messages.push({ @@ -348,7 +350,8 @@ export class MailSendService const parentItem = this.getBaseItemFromRewards(messageDetails.items); if (!parentItem) { - this.logger.error(`unable to find an item with slotId of: hideout for message to: ${messageDetails.trader} sender: ${messageDetails.sender}`); + this.localisationService.getText("mailsend-missing_parent", {traderId: messageDetails.trader, sender: messageDetails.sender}); + return itemsToSendToPlayer; }