diff --git a/README.md b/README.md index 5885ef9..b89bac9 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,9 @@ This system provides character sheets and items for your play, if you would lik ## Release Notes +v4.6.4 +- 🐛 fix error happening on Forge: players getting a message of lacking of permission + v4.6.1 - 🐛 system was attempting to update the change log for actors without one which caused changes to fail on NPC and Vaesen actor type [#117](https://github.com/fvtt-fria-ligan/vaesen-foundry-vtt/issues/117) - 🐛 error when updating actors when no scene was active diff --git a/script/actor/vaesen.js b/script/actor/vaesen.js index 0ff3fcf..76621e5 100644 --- a/script/actor/vaesen.js +++ b/script/actor/vaesen.js @@ -220,6 +220,8 @@ export class VaesenActor extends Actor { options, userId ) { + if (!this.isOwner) return; + const addedText = game.i18n.localize("CHANGELOG.ADDED"); await this._handleItem(documents[0], userId, addedText); @@ -241,6 +243,8 @@ export class VaesenActor extends Actor { options, userId ) { + if (!this.isOwner) return; + const removedText = game.i18n.localize("CHANGELOG.REMOVED"); await this._handleItem(documents[0], userId, removedText); diff --git a/script/hooks.js b/script/hooks.js index 7b7b171..9c2f9c3 100644 --- a/script/hooks.js +++ b/script/hooks.js @@ -76,14 +76,12 @@ Hooks.once("init", () => { registerSystemSettings(); preloadHandlebarsTemplates(); - - Handlebars.registerHelper("enrichHtmlHelper", function (rawText) { return TextEditor.enrichHTML(rawText, { async: false }); }); - Handlebars.registerHelper('ifIn', function(elem, list, options) { - if(list && list.indexOf(elem) > -1) { + Handlebars.registerHelper('ifIn', function (elem, list, options) { + if (list && list.indexOf(elem) > -1) { return options.fn(this); } return options.inverse(this); @@ -100,7 +98,7 @@ Hooks.once("init", () => { }); Hooks.once("ready", async function () { - + setupCards(); conditions.onReady(); Hooks.on("hotbarDrop", (bar, data, slot) => createRollMacro(data, slot)); @@ -113,17 +111,16 @@ Hooks.on('canvasReady', () => { canvas.hud.token = new VaesenTokenHUD(); }); -Hooks.on("updateActor", (actor,changes,diff,userId) => { +Hooks.on("updateActor", (actor, changes, diff, userId) => { // if we don't have an active scene, don't do anything - if (!game.scenes.current) return; + if (!game.scenes.current || !actor.isOwner || changes.name == undefined) return; console.log("updateActor", actor, changes, diff, userId); game.scenes.current.tokens.forEach(x => { if (x.actorId !== actor._id) return; - if (changes.name !== undefined) { - actor.update({"token.name": actor.name}); - x.update({"name": actor.name}); - } + + actor.update({ "token.name": actor.name }); + x.update({ "name": actor.name }); }); }); @@ -136,11 +133,11 @@ Hooks.on('dropActorSheetData', async (actor, sheet, data) => { sheet._dropHeadquarter(headquarter); }); -Hooks.on("yze-combat.fast-action-button-clicked", async function(data) { +Hooks.on("yze-combat.fast-action-button-clicked", async function (data) { await conditions.onActionCondition(data); }); -Hooks.on("yze-combat.slow-action-button-clicked", async function(data) { +Hooks.on("yze-combat.slow-action-button-clicked", async function (data) { await conditions.onActionCondition(data); }); @@ -247,7 +244,7 @@ async function setupCards() { const initiativeDeck = game.cards?.get(initiativeDeckId); //return early if both the deck and the ID exist in the world if (initiativeDeckId && initiativeDeck) - return; + return; ui.notifications.info('UI.NoInitiativeDeckFound', { localize: true }); const preset = CONFIG.Cards.presets.initiative; const data = await foundry.utils.fetchJsonWithTimeout(preset.src); @@ -343,7 +340,7 @@ actor.sheet.rollWeapon("${data.itemId}");`; flags: { "vaesen.skillRoll": true } }); } - + game.user.assignHotbarMacro(macro, slot); return false; } \ No newline at end of file diff --git a/system.json b/system.json index 258f53a..a8d3cdb 100644 --- a/system.json +++ b/system.json @@ -1,7 +1,7 @@ { "title": "Vaesen", "description": "Nordic horror role-playing", - "version": "4.6.3", + "version": "4.6.4", "esmodules": [ "script/hooks.js" ],