Merge conteneur + fix hotbar

This commit is contained in:
sladecraven 2022-09-25 21:17:47 +02:00
parent e325ab9278
commit b35eaad757
2 changed files with 10 additions and 46 deletions

View File

@ -2,16 +2,6 @@ import { Misc } from "./misc.js";
export class RdDHotbar {
static async createMacro(item, command) {
let macro = await Macro.create({
name: item.name,
type: "script",
img: item.img,
command: command
}, { displaySheet: false })
return macro
}
/**
* Create a macro when dropping an entity on the hotbar
* Item - open roll dialog for item
@ -20,7 +10,7 @@ export class RdDHotbar {
*/
static initDropbar() {
Hooks.on("hotbarDrop", (bar, documentData, slot) => {
Hooks.on("hotbarDrop", async (bar, documentData, slot) => {
// Create item macro if rollable item - weapon, spell, prayer, trait, or skill
if (documentData.type == "Item") {
@ -35,44 +25,18 @@ export class RdDHotbar {
let command = `game.system.rdd.RdDHotbar.rollMacro("${item.name}", "${item.type}");`;
let macro = game.macros.contents.find(m => (m.name === item.name) && (m.command === command));
if (!macro) {
macro = this.createMacro(item, command)
macro = await Macro.create({
name: item.name,
type: "script",
img: item.img,
command: command
}, { displaySheet: false })
}
game.user.assignHotbarMacro(macro, slot);
return false
}
// Create a macro to open the actor sheet of the actor dropped on the hotbar
/*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.contents.find(m => (m.name === actor.name) && (m.command === command));
if (!macro) {
macro = await Macro.create({
name: actor.name,
type: "script",
img: actor.img,
command: command
}, { displaySheet: false })
game.user.assignHotbarMacro(macro, slot);
}
}
// Create a macro to open the journal sheet of the journal dropped on the hotbar
else if (documentData.type == "JournalEntry") {
let journal = fromUuidSync(documentData.uuid)
let command = `game.journal.get("${documentData.id}").sheet.render(true)`
let macro = game.macros.contents.find(m => (m.name === journal.name) && (m.command === command));
if (!macro) {
macro = await Macro.create({
name: journal.name,
type: "script",
img: "systems/foundryvtt-reve-de-dragon/icons/templates/icone_parchement_vierge.webp",
command: command
}, { displaySheet: false })
game.user.assignHotbarMacro(macro, slot);
}
}*/
return true;
return true
});
}

View File

@ -34,7 +34,7 @@
],
"url": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/",
"license": "LICENSE.txt",
"version": "10.0.19",
"version": "10.0.20",
"compatibility": {
"minimum": "10",
"verified": "10.286"
@ -333,7 +333,7 @@
],
"socket": true,
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.0.19.zip",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.0.20.zip",
"gridDistance": 1,
"gridUnits": "m",
"primaryTokenAttribute": "sante.vie",