From cfc7e1504a10fc5c3f55ef19f1cbb74b230aee4b Mon Sep 17 00:00:00 2001 From: Vlyan Date: Sun, 30 Jan 2022 10:54:56 +0100 Subject: [PATCH] Added ability to switch between stance/prepared on mouse clic (left/right). --- CHANGELOG.md | 4 +++- system/scripts/gm/gm-monitor.js | 25 +++++++++++++++++++++++++ system/templates/gm/gm-monitor.html | 12 ++++++++++-- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f399729..600ea91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,9 @@ - Added SoftLock functionality. - Added a new button bar for system specific buttons. - Added +/- buttons to add or subtract Fatigue and Strife (PC & NPC Sheet), Casualties and Panic (Armies Sheet). -- GmMonitor : Added ability to add or subtract fatigue/strife/void/casualties/panic points on mouse clic (left/right). +- GmMonitor : + - Added ability to add or subtract fatigue/strife/void/casualties/panic points on mouse clic (left/right/middle). + - Added ability to switch between stance/prepared on mouse clic (left/right). - Compendiums : - Techniques : QoL - Trying a cheap Rank filter. - Inversion techniques : Updated xp cost from 3 to 6. diff --git a/system/scripts/gm/gm-monitor.js b/system/scripts/gm/gm-monitor.js index f784cdb..3bf7739 100644 --- a/system/scripts/gm/gm-monitor.js +++ b/system/scripts/gm/gm-monitor.js @@ -274,6 +274,15 @@ export class GmMonitor extends FormApplication { // Mouse bt : middle = 0, left +1, right -1 const add = event.which === 2 ? -999 : event.which === 1 ? 1 : -1; + // Stance + let stanceIdx = + CONFIG.l5r5e.stances.findIndex((s) => s === actor.data.data.stance) + (event.which === 1 ? 1 : -1); + if (stanceIdx < 0) { + stanceIdx = CONFIG.l5r5e.stances.length - 1; + } else if (stanceIdx > CONFIG.l5r5e.stances.length - 1) { + stanceIdx = 0; + } + switch (type) { // *** Characters *** case "fatigue": @@ -309,6 +318,22 @@ export class GmMonitor extends FormApplication { }); break; + case "stance": + await actor.update({ + data: { + stance: CONFIG.l5r5e.stances[stanceIdx], + }, + }); + break; + + case "prepared": + await actor.update({ + data: { + prepared: !actor.data.data.prepared, + }, + }); + break; + // *** Armies *** case "casualties": await actor.update({ diff --git a/system/templates/gm/gm-monitor.html b/system/templates/gm/gm-monitor.html index 14d7913..28f6a46 100644 --- a/system/templates/gm/gm-monitor.html +++ b/system/templates/gm/gm-monitor.html @@ -26,8 +26,16 @@ {{actor.name}} {{#if actor.data.data.attitude}}

({{actor.data.data.attitude}})

{{/if}} - - + + + + + + + + + + {{#if actor.haveWeaponEquipped}}{{/if}} {{#if actor.haveArmorEquipped}}{{/if}}