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 7d799b13..7776bdb4 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);