Upgrade to v9

This commit is contained in:
2022-01-20 13:09:16 +01:00
parent 6098003bf9
commit 1f0c830b1f
31 changed files with 259 additions and 454 deletions

View File

@@ -2,7 +2,7 @@
import { VadentisCombat } from "./vadentis-combat.js";
/* -------------------------------------------- */
export class VadentisUtility extends Entity {
export class VadentisUtility {
/* -------------------------------------------- */
static async preloadHandlebarsTemplates() {
@@ -64,6 +64,19 @@ export class VadentisUtility extends Entity {
return undefined;
}
/* -------------------------------------------- */
static templateData(it) {
return VadentisUtility.data(it)?.data ?? {}
}
/* -------------------------------------------- */
static data(it) {
if (it instanceof Actor || it instanceof Item || it instanceof Combatant) {
return it.data;
}
return it;
}
/* -------------------------------------------- */
static processDamageString( formula, actor ) {
let workFormula = formula.toLowerCase();
@@ -76,7 +89,7 @@ export class VadentisUtility extends Entity {
/* -------------------------------------------- */
static async processRoll( formula, rollMode ) {
let myRoll = new Roll(formula);
myRoll.evaluate();
myRoll.roll( { async: false} );
if (game.modules.get("dice-so-nice") && game.modules.get("dice-so-nice").active) {
await game.dice3d.showForRoll(myRoll, game.user, true);
}
@@ -207,14 +220,13 @@ export class VadentisUtility extends Entity {
/* -------------------------------------------- */
static async confirmDelete(actorSheet, li) {
let itemId = li.data("item-id");
let objet = actorSheet.actor.items.find(item => item._id == itemId);
let msgTxt = "<p>Etes vous certain de souhaiter supprimer cet item ?";
let buttons = {
delete: {
icon: '<i class="fas fa-check"></i>',
label: "Oui, à supprimer",
callback: () => {
actorSheet.actor.deleteOwnedItem(itemId);
actorSheet.actor.deleteEmbeddedDocuments('Item', [ itemId] );
li.slideUp(200, () => actorSheet.render(false));
}
},