Fix quantité split item

This commit is contained in:
Vincent Vandemeulebrouck 2021-05-07 00:06:47 +02:00
parent 6b96f73b7a
commit e41a936def

View File

@ -623,11 +623,10 @@ export class RdDActorSheet extends ActorSheet {
} }
async _onSplitItem(item, split) { async _onSplitItem(item, split) {
const itemData = Misc.data(item); if (split >= 1 && split < Misc.data(item).data.quantite) {
if (split >= 1 && split < itemData.data.quantite) {
await item.diminuerQuantite(split); await item.diminuerQuantite(split);
const itemData = duplicate( Misc.data(item));
itemData.data.quantite = split; itemData.data.quantite = split;
itemData.id = undefined;
await this.actor.createEmbeddedDocuments('Item', [itemData]) await this.actor.createEmbeddedDocuments('Item', [itemData])
} }
} }