From e2301b1cfd6509918dfec49e14ff2a2fc2401044 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Sun, 27 Sep 2020 22:33:02 +0200 Subject: [PATCH] Fix return statement --- module/actor.js | 2 +- module/toto_init_hook.js | 62 ---------------------------------------- 2 files changed, 1 insertion(+), 63 deletions(-) delete mode 100644 module/toto_init_hook.js diff --git a/module/actor.js b/module/actor.js index 7ef498f3..06e921f0 100644 --- a/module/actor.js +++ b/module/actor.js @@ -52,7 +52,7 @@ export class RdDActor extends Actor { data.items.push(compItem); } - super.create(data, options); + return super.create(data, options); } /* -------------------------------------------- */ diff --git a/module/toto_init_hook.js b/module/toto_init_hook.js deleted file mode 100644 index e5f47748..00000000 --- a/module/toto_init_hook.js +++ /dev/null @@ -1,62 +0,0 @@ -Combat.prototype.rollInitiative = async function ( - ids, - formula = null, - messageOptions = {} -) { - console.log( - `${game.data.system.data.title} | Combat.rollInitiative()`, - ids, - formula, - messageOptions - ); - // Structure input data - ids = typeof ids === "string" ? [ids] : ids; - const currentId = this.combatant._id; - - // calculate initiative - if (ids.length == 1) { - const c = this.getCombatant(ids[0]); - if (!c) return results; - - const cf = formula || this._getInitiativeFormula(c); - const roll = this._getInitiativeRoll(c, cf); - - const updates = this.combatants - .filter( - (combatant) => - !combatant.actor || combatant.actor.data.type == "character" - ) - .map((combatant) => { - return { _id: combatant._id, initiative: roll.total }; - }); - - if (!updates.length) return this; - - // Update multiple combatants - await this.updateEmbeddedEntity("Combatant", updates); - - // Ensure the turn order remains with the same combatant - await this.update({ - turn: this.turns.findIndex((t) => t._id === currentId), - }); - - // Send a chat message - let rollMode = - messageOptions.rollMode || game.settings.get("core", "rollMode"); - let messageData = mergeObject( - { - speaker: { - scene: canvas.scene._id, - actor: c.actor ? c.actor._id : null, - token: c.token._id, - alias: c.token.name, - sound: CONFIG.sounds.dice, - }, - flavor: `${c.token.name} rolls for Party Initiative!`, - }, - messageOptions - ); - roll.toMessage(messageData, { rollMode, create: true }); - return this; - } -};