diff --git a/module/module.json b/module/module.json index c558b47..0dbcc1e 100644 --- a/module/module.json +++ b/module/module.json @@ -5,8 +5,8 @@ "author": "troygoode, Argonius-Angelus, mattd", "url": "https://github.com/mattd/foundryvtt-progress-clocks", "manifest": "https://raw.githubusercontent.com/mattd/foundryvtt-progress-clocks/main/module/module.json", - "download": "https://github.com/mattd/foundryvtt-progress-clocks/releases/download/v1.5.2/build.zip", - "version": "1.5.2", + "download": "https://github.com/mattd/foundryvtt-progress-clocks/releases/download/v1.5.3/build.zip", + "version": "1.5.3", "minimumCoreVersion": "0.7.0", "compatibleCoreVersion": "10", "compatibility": { diff --git a/module/scripts/clock.mjs b/module/scripts/clock.mjs index 3205420..dccca5c 100644 --- a/module/scripts/clock.mjs +++ b/module/scripts/clock.mjs @@ -1,8 +1,3 @@ -const nextIndexInArray = (arr, el) => { - const idx = arr.indexOf(el); - return (idx < 0 || idx >= arr.length) ? 0 : idx + 1; -} - export class Clock { static sizes = [ 2, 3, 4, 5, 6, 8, 10, 12 @@ -48,14 +43,6 @@ export class Clock { }; } - cycleSize () { - return new Clock({ - size: Clock.sizes[nextIndexInArray(Clock.sizes, this.size)], - progress: this.progress, - theme: this.theme - }); - } - increment () { const old = this; return new Clock({ @@ -73,15 +60,4 @@ export class Clock { theme: old.theme }); } - - isEqual (clock) { - return clock - && clock.size === this.size - && clock.progress === this.progress - && clock.theme === this.theme; - } - - toString () { - return `${this.progress}/${this.size} • ${this.theme}`; - } } diff --git a/module/scripts/sheet.mjs b/module/scripts/sheet.mjs index 5b83a05..55d198d 100644 --- a/module/scripts/sheet.mjs +++ b/module/scripts/sheet.mjs @@ -87,7 +87,7 @@ export class ClockSheet extends ActorSheet { actor: this.actor }) ); - this.updateClock(oldClock.decrement()); + this.updateActorAndTokens(oldClock.decrement()); }); html.find("button[name=plus]").click(async (e) => { @@ -97,7 +97,7 @@ export class ClockSheet extends ActorSheet { actor: this.actor }) ); - this.updateClock(oldClock.increment()); + this.updateActorAndTokens(oldClock.increment()); }); html.find("button[name=reset]").click(async (e) => { @@ -112,7 +112,7 @@ export class ClockSheet extends ActorSheet { progress: 0, size: oldClock.size }); - this.updateClock(newClock); + this.updateActorAndTokens(newClock); }); } @@ -130,10 +130,10 @@ export class ClockSheet extends ActorSheet { size: form.size, theme: form.theme }); - await this.updateClock(newClock); + await this.updateActorAndTokens(newClock); } - async updateClock(clock) { + async updateActorAndTokens(clock) { const actor = this.actor; const tokens = actor.getActiveTokens(); const foundryVersion = getFoundryVersion(game); diff --git a/module/templates/buttons.html b/module/templates/buttons.html deleted file mode 100644 index fe7a4cd..0000000 --- a/module/templates/buttons.html +++ /dev/null @@ -1,15 +0,0 @@ -
- -
- - - -
- -
- -
- -
diff --git a/module/templates/sheet.html b/module/templates/sheet.html index c63fc15..a591d5a 100644 --- a/module/templates/sheet.html +++ b/module/templates/sheet.html @@ -1,63 +1,67 @@
- {{#if editable}} -
- -
- {{else}} -
- -
- {{/if}} - {{#if editable}} -
- {{#if (lte clock.progress 0)}} - + {{#if editable}} +
+ +
{{else}} - +
+ +
{{/if}} - - {{#if (gte clock.progress clock.size)}} - - {{else}} - + {{#if editable}} +
+ {{#if (lte clock.progress 0)}} + + {{else}} + + {{/if}} + + {{#if (gte clock.progress clock.size)}} + + {{else}} + + {{/if}} +
{{/if}} -
- {{/if}} -
- -
- {{#if editable}} -
-
- - +
+
-
- - + {{#if editable}} +
+
+ + {{#select clock.theme}} + + {{/select}} +
+
+ + {{#select clock.size}} + + {{/select}} +
-
- {{/if}} + {{/if}} diff --git a/package-lock.json b/package-lock.json index d1ffe73..a7cd8b0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "foundryvtt-progress-clocks", - "version": "1.5.2", + "version": "1.5.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "foundryvtt-progress-clocks", - "version": "1.5.2", + "version": "1.5.3", "license": "MIT", "devDependencies": { "ava": "^4.3.1" diff --git a/package.json b/package.json index c2a39db..a34b60a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "foundryvtt-progress-clocks", - "version": "1.5.2", + "version": "1.5.3", "description": "Brings Forged in the Dark style progress clocks to your FoundryVTT games.", "main": "module/scripts/init.mjs", "scripts": {