ENH: Macros
parent
f7531d48a3
commit
ca75ff35a1
|
@ -16,7 +16,7 @@ export async function createOseMacro(data, slot) {
|
||||||
const item = data.data;
|
const item = data.data;
|
||||||
|
|
||||||
// Create the macro command
|
// Create the macro command
|
||||||
const command = `game.dnd5e.rollItemMacro("${item.name}");`;
|
const command = `game.ose.rollItemMacro("${item.name}");`;
|
||||||
let macro = game.macros.entities.find(m => (m.name === item.name) && (m.command === command));
|
let macro = game.macros.entities.find(m => (m.name === item.name) && (m.command === command));
|
||||||
if ( !macro ) {
|
if ( !macro ) {
|
||||||
macro = await Macro.create({
|
macro = await Macro.create({
|
||||||
|
@ -24,7 +24,7 @@ export async function createOseMacro(data, slot) {
|
||||||
type: "script",
|
type: "script",
|
||||||
img: item.img,
|
img: item.img,
|
||||||
command: command,
|
command: command,
|
||||||
flags: {"dnd5e.itemMacro": true}
|
flags: {"ose.itemMacro": true}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
game.user.assignHotbarMacro(macro, slot);
|
game.user.assignHotbarMacro(macro, slot);
|
||||||
|
@ -55,7 +55,6 @@ export async function createOseMacro(data, slot) {
|
||||||
const item = items[0];
|
const item = items[0];
|
||||||
|
|
||||||
// Trigger the item roll
|
// Trigger the item roll
|
||||||
if ( item.data.type === "spell" ) return actor.useSpell(item);
|
|
||||||
return item.roll();
|
return item.roll();
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,10 @@ Hooks.once("init", async function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
CONFIG.OSE = OSE;
|
CONFIG.OSE = OSE;
|
||||||
|
|
||||||
|
game.ose = {
|
||||||
|
rollItemMacro: macros.rollItemMacro
|
||||||
|
}
|
||||||
|
|
||||||
// Custom Handlebars helpers
|
// Custom Handlebars helpers
|
||||||
registerHelpers();
|
registerHelpers();
|
||||||
|
|
Loading…
Reference in New Issue