async function createAvariceItemMacro(data, slot) {
// First, determine if this is a valid owned item.
if (data.type !== "Item") return;
if (!data.uuid.includes('Actor.') && !data.uuid.includes('Token.')) {
return ui.notifications.warn("You can only create macro buttons for owned Items");
}
// If it is, retrieve it based on the uuid.
const item = await Item.fromDropData(data);
// Create the macro command using the uuid.
const command = `game.cryptsofavarice.rollItemMacro("${item.name}");`;
let macro = game.macros.find(m => (m.name === item.name) && (m.command === command));
if (!macro) {
macro = await Macro.create({
name: item.name,
type: "script",
img: item.img,
command: command,
flags: { "cryptsofavarice.itemMacro": true }
});
}
game.user.assignHotbarMacro(macro, slot);
return false;
}
async function createAvariceItemMacro(data, slot) {
// First, determine if this is a valid owned item.
if (data.type !== "Item") return;
if (!data.uuid.includes('Actor.') && !data.uuid.includes('Token.')) {
return ui.notifications.warn("You can only create macro buttons for owned Items");
}
// If it is, retrieve it based on the uuid.
const item = await Item.fromDropData(data);
// Create the macro command using the uuid.
const command = `game.cryptsofavarice.rollItemMacro("${item.name}");`;
let macro = game.macros.find(m => (m.name === item.name) && (m.command === command));
if (!macro) {
macro = await Macro.create({
name: item.name,
type: "script",
img: item.img,
command: command,
flags: { "cryptsofavarice.itemMacro": true }
});
}
game.user.assignHotbarMacro(macro, slot);
return false;
}