Merge branch 'v1.5-fix-macros' into 'v1.5'

Fix ajout de macros en v9

See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!311
This commit is contained in:
Leratier Bretonnien 2022-01-07 19:06:58 +00:00
commit eb54f3a467

View File

@ -17,7 +17,7 @@ export class RdDHotbar {
return
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));
let macro = game.macros.contents.find(m => (m.name === item.name) && (m.command === command));
if (!macro) {
macro = await Macro.create({
name: item.name,
@ -32,7 +32,7 @@ export class RdDHotbar {
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));
let macro = game.macros.contents.find(m => (m.name === actor.name) && (m.command === command));
if (!macro) {
macro = await Macro.create({
name: actor.data.name,
@ -47,7 +47,7 @@ export class RdDHotbar {
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));
let macro = game.macros.contents.find(m => (m.name === journal.name) && (m.command === command));
if (!macro) {
macro = await Macro.create({
name: journal.data.name,