Fixed give command localization issue

This commit is contained in:
clodan 2024-05-12 22:10:12 +01:00
parent ea2ad0994b
commit 9390759621

View File

@ -188,12 +188,14 @@ export class GiveSptCommand implements ISptCommand
} }
} }
const localizedGlobal = this.databaseServer.getTables().locales.global[locale]
?? this.databaseServer.getTables().locales.global.en;
// If item is an item name, we need to search using that item name and the locale which one we want otherwise // If item is an item name, we need to search using that item name and the locale which one we want otherwise
// item is just the tplId. // item is just the tplId.
const tplId = isItemName const tplId = isItemName
? this.itemHelper.getItems() ? this.itemHelper.getItems()
.filter(i => this.isItemAllowed(i)) .filter(i => this.isItemAllowed(i))
.find(i => (this.databaseServer.getTables().locales.global[locale][`${i?._id} Name`]?.toLowerCase() ?? i._props.Name) === item)._id .find(i => (localizedGlobal[`${i?._id} Name`]?.toLowerCase() ?? i._props.Name) === item)._id
: item; : item;
const checkedItem = this.itemHelper.getItem(tplId); const checkedItem = this.itemHelper.getItem(tplId);