Adaptation Feuilles Acteurs

This commit is contained in:
Vincent Vandemeulebrouck
2021-03-25 03:18:27 +01:00
parent 5fb8d22a7a
commit 43cf091345
25 changed files with 277 additions and 237 deletions

View File

@ -9,12 +9,12 @@ export class RdDHotbar {
*/
static initDropbar( ) {
Hooks.on("hotbarDrop", async (bar, data, slot) => {
Hooks.on("hotbarDrop", async (bar, documentData, slot) => {
// Create item macro if rollable item - weapon, spell, prayer, trait, or skill
if (data.type == "Item") {
if (data.data.type != "arme" && data.data.type != "competence" )
if (documentData.type == "Item") {
if (documentData.data.type != "arme" && documentData.data.type != "competence" )
return
let item = data.data
let item = documentData.data
let command = `game.system.rdd.RdDHotbar.rollMacro("${item.name}", "${item.type}");`;
let macro = game.macros.entities.find(m => (m.name === item.name) && (m.command === command));
if (!macro) {
@ -28,9 +28,9 @@ export class RdDHotbar {
game.user.assignHotbarMacro(macro, slot);
}
// Create a macro to open the actor sheet of the actor dropped on the hotbar
else if (data.type == "Actor") {
let actor = game.actors.get(data.id);
let command = `game.actors.get("${data.id}").sheet.render(true)`
else if (documentData.type == "Actor") {
let actor = game.actors.get(documentData.id);
let command = `game.actors.get("${documentData.id}").sheet.render(true)`
let macro = game.macros.entities.find(m => (m.name === actor.name) && (m.command === command));
if (!macro) {
macro = await Macro.create({
@ -43,9 +43,9 @@ export class RdDHotbar {
}
}
// Create a macro to open the journal sheet of the journal dropped on the hotbar
else if (data.type == "JournalEntry") {
let journal = game.journal.get(data.id);
let command = `game.journal.get("${data.id}").sheet.render(true)`
else if (documentData.type == "JournalEntry") {
let journal = game.journal.get(documentData.id);
let command = `game.journal.get("${documentData.id}").sheet.render(true)`
let macro = game.macros.entities.find(m => (m.name === journal.name) && (m.command === command));
if (!macro) {
macro = await Macro.create({