Fix hotbar + tooltip
This commit is contained in:
parent
a1c20019e8
commit
a7991bce92
@ -2,19 +2,8 @@ import { BoLRoll } from "../controllers/bol-rolls.js";
|
|||||||
|
|
||||||
export class BoLHotbar {
|
export class BoLHotbar {
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a macro when dropping an entity on the hotbar
|
|
||||||
* Item - open roll dialog for item
|
|
||||||
* Actor - open actor sheet
|
|
||||||
* Journal - open journal sheet
|
|
||||||
*/
|
|
||||||
static init( ) {
|
|
||||||
|
|
||||||
Hooks.on("hotbarDrop", async (bar, documentData, slot) => {
|
static async assignToHotBar( item, slot) {
|
||||||
// Create item macro if rollable item - weapon, spell, prayer, trait, or skill
|
|
||||||
if (documentData.type == "Item") {
|
|
||||||
console.log("Drop done !!!", bar, documentData, slot)
|
|
||||||
let item = documentData.data
|
|
||||||
let command = `game.bol.BoLHotbar.rollMacro("${item.name}", "${item.type}");`
|
let command = `game.bol.BoLHotbar.rollMacro("${item.name}", "${item.type}");`
|
||||||
let macro = game.macros.contents.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) {
|
if (!macro) {
|
||||||
@ -25,40 +14,31 @@ export class BoLHotbar {
|
|||||||
command: command
|
command: command
|
||||||
}, { displaySheet: false })
|
}, { displaySheet: false })
|
||||||
}
|
}
|
||||||
game.user.assignHotbarMacro(macro, slot);
|
await game.user.assignHotbarMacro(macro, slot);
|
||||||
}
|
}
|
||||||
// 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);
|
* Create a macro when dropping an entity on the hotbar
|
||||||
let command = `game.actors.get("${documentData.id}").sheet.render(true)`
|
* Item - open roll dialog for item
|
||||||
let macro = game.macros.contents.find(m => (m.name === actor.name) && (m.command === command));
|
* Actor - open actor sheet
|
||||||
if (!macro) {
|
* Journal - open journal sheet
|
||||||
macro = await Macro.create({
|
*/
|
||||||
name: actor.data.name,
|
static init( ) {
|
||||||
type: "script",
|
|
||||||
img: actor.data.img,
|
Hooks.on("hotbarDrop", (bar, documentData, slot) => {
|
||||||
command: command
|
// Create item macro if rollable item - weapon, spell, prayer, trait, or skill
|
||||||
}, { displaySheet: false })
|
if (documentData.type == "Item") {
|
||||||
game.user.assignHotbarMacro(macro, slot);
|
let item = fromUuidSync(documentData.uuid)
|
||||||
|
if (item == undefined) {
|
||||||
|
item = this.actor.items.get(documentData.uuid)
|
||||||
|
}
|
||||||
|
if (item && (item.system.subtype === "weapon" || item.system.category === "spell")) {
|
||||||
|
this.assignToHotBar( item, slot )
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Create a macro to open the journal sheet of the journal dropped on the hotbar
|
return 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.contents.find(m => (m.name === journal.name) && (m.command === command));
|
|
||||||
if (!macro) {
|
|
||||||
macro = await Macro.create({
|
|
||||||
name: journal.data.name,
|
|
||||||
type: "script",
|
|
||||||
img: "systems/bol/icons/images/icone_parchement_vierge.webp",
|
|
||||||
command: command
|
|
||||||
}, { displaySheet: false })
|
|
||||||
game.user.assignHotbarMacro(macro, slot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Roll macro */
|
/** Roll macro */
|
||||||
@ -76,10 +56,10 @@ export class BoLHotbar {
|
|||||||
return ui.notifications.warn(`Impossible de trouver l'objet de cette macro`)
|
return ui.notifications.warn(`Impossible de trouver l'objet de cette macro`)
|
||||||
}
|
}
|
||||||
// Trigger the item roll
|
// Trigger the item roll
|
||||||
if (item.data.data.category === "equipment" && item.data.data.subtype === "weapon") {
|
if (item.system.category === "equipment" && item.system.subtype === "weapon") {
|
||||||
return BoLRoll.weaponCheckWithWeapon( actor, item)
|
return BoLRoll.weaponCheckWithWeapon( actor, item)
|
||||||
}
|
}
|
||||||
if (item.data.data.category === "spell") {
|
if (item.system.category === "spell") {
|
||||||
return BoLRoll.spellCheckWithSpell( actor, item)
|
return BoLRoll.spellCheckWithSpell( actor, item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<div class="flexrow box-roll">
|
<div class="flexrow box-roll">
|
||||||
<div class="flex1 center bg-darkred">
|
<div class="flex1 center bg-darkred" >
|
||||||
<label for="attr">{{localize 'BOL.ui.attribute'}}</label>
|
<label for="attr">{{localize 'BOL.ui.attribute'}}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex1 center cell">
|
<div class="flex1 center cell">
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{{#if (count boons)}}
|
{{#if (count boons)}}
|
||||||
<div class="flexrow roll-box" >
|
<div class="flexrow roll-box" >
|
||||||
<div class="flex1 center bg-darkred">
|
<div class="flex1 center bg-darkred" data-tooltip-direction="LEFT" data-tooltip="Click-gauche pour sélectionner, CTRL+Click gauche pour déselectionner">
|
||||||
<label for="mod">{{localize 'BOL.ui.boons'}}</label>
|
<label for="mod">{{localize 'BOL.ui.boons'}}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex1 center cell">
|
<div class="flex1 center cell">
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{{#if careers}}
|
{{#if careers}}
|
||||||
<div class="flexrow roll-box">
|
<div class="flexrow roll-box">
|
||||||
<div class="flex1 center bg-darkred">
|
<div class="flex1 center bg-darkred" data-tooltip-direction="LEFT" data-tooltip="Click-gauche pour selectionner, CTRL+Click gauche pour déselectionner">
|
||||||
<label for="mod">{{localize 'BOL.ui.careers'}}</label>
|
<label for="mod">{{localize 'BOL.ui.careers'}}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex1 center cell">
|
<div class="flex1 center cell">
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{{#if (count flaws)}}
|
{{#if (count flaws)}}
|
||||||
<div class="flexrow roll-box">
|
<div class="flexrow roll-box">
|
||||||
<div class="flex1 center bg-darkred">
|
<div class="flex1 center bg-darkred" data-tooltip-direction="LEFT" data-tooltip="Click-gauche pour selectionner, CTRL+Click gauche pour déselectionner">
|
||||||
<label for="mod">{{localize 'BOL.ui.flaws'}}</label>
|
<label for="mod">{{localize 'BOL.ui.flaws'}}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex1 center cell">
|
<div class="flex1 center cell">
|
||||||
|
Loading…
Reference in New Issue
Block a user