From 7cab7de52b861b723a70ed6211434ea523df3316 Mon Sep 17 00:00:00 2001 From: Vlyan Date: Wed, 30 Dec 2020 11:28:37 +0100 Subject: [PATCH] Added a check if this macro id is already in player hotbar --- system/scripts/dice/dice-picker-dialog.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/system/scripts/dice/dice-picker-dialog.js b/system/scripts/dice/dice-picker-dialog.js index f01fc94..fee0361 100644 --- a/system/scripts/dice/dice-picker-dialog.js +++ b/system/scripts/dice/dice-picker-dialog.js @@ -455,8 +455,15 @@ export class DicePickerDialog extends FormApplication { }); } - // Search for slot (Fix for FVTT) + // Search if already in player hotbar + if (Object.values(game.user.data.hotbar).includes(macro._id)) { + return; + } + + // Search for slot (Fix for FVTT, will be fixed) // slot = false will normally do the 1st available, but always return 0 + // TODO see when issue is closed to remove these lines and use "assignHotbarMacro(macro, false)" + // https://gitlab.com/foundrynet/foundryvtt/-/issues/4382 const slot = Array.fromRange(50).find((i) => { if (i < 1) { return false;