From 335806bfd8e9c4d84818a978f7fcd9b5f6f41750 Mon Sep 17 00:00:00 2001 From: Dev Date: Sat, 20 Jul 2024 13:44:48 +0100 Subject: [PATCH] Localised error message --- project/assets/database/locales/server/en.json | 1 + project/src/helpers/InventoryHelper.ts | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/project/assets/database/locales/server/en.json b/project/assets/database/locales/server/en.json index 436e6676..1cb6c447 100644 --- a/project/assets/database/locales/server/en.json +++ b/project/assets/database/locales/server/en.json @@ -141,6 +141,7 @@ "inventory-unable_to_inspect_item_not_in_db": "Unable to inspect item: %s as it cannot be found in the items DB", "inventory-unable_to_remove_item_id_not_found": "Unable to remove item with Id: {{childId}} from profile: {{profileId}} as it could not be found", "inventory-unable_to_remove_item_no_id_given": "Unable to remove item as no itemId supplied", + "inventory-unable_to_remove_item_restart_immediately": "Unable to remove item: {{item}} from mail: {{mailId}} as item could not be found, RESTART GAME CLIENT IMMEDIATELY to prevent data corruption", "inventory-unable_to_sort_inventory_restart_game": "Unable to find inventory item: %s to auto-sort, YOU MUST RELOAD YOUR GAME IMMEDIATELY TO AVOID CORRUPTING YOUR PROFILE", "inventory-unable_to_toggle_item_not_found": "Unable to toggle inventory item with id: %s, item not found", "item-durability_value_invalid_use_default": "getRepairableItemQualityValue() weapon tpl: %s durability value is invalid, defaulting to 1", diff --git a/project/src/helpers/InventoryHelper.ts b/project/src/helpers/InventoryHelper.ts index 4c3817d6..b10e1a76 100644 --- a/project/src/helpers/InventoryHelper.ts +++ b/project/src/helpers/InventoryHelper.ts @@ -551,7 +551,7 @@ export class InventoryHelper const dialogs = Object.values(fullProfile.dialogues); for (const dialog of dialogs) { - const messageWithReward = dialog.messages.find((x) => x._id === removeRequest.fromOwner.id); + const messageWithReward = dialog.messages.find((message) => message._id === removeRequest.fromOwner.id); if (messageWithReward) { // Find item + any possible children and remove them from mails items array @@ -566,8 +566,10 @@ export class InventoryHelper if (indexOfItemToRemove === -1) { this.logger.error( - `Unable to remove item: ${removeRequest.item} from mail: ${removeRequest.fromOwner.id} as item could not be found, restart client immediately to prevent data corruption`, + this.localisationService.getText("inventory-unable_to_remove_item_restart_immediately", + { item: removeRequest.item, mailId: removeRequest.fromOwner.id }), ); + continue; } messageWithReward.items.data.splice(indexOfItemToRemove, 1);