diff --git a/package/ose-v0.9.9.zip b/package/ose-v0.9.9.zip new file mode 100644 index 0000000..1ec0b50 Binary files /dev/null and b/package/ose-v0.9.9.zip differ diff --git a/src/module/actor/monster-sheet.js b/src/module/actor/monster-sheet.js index 15ee7c3..68537f1 100644 --- a/src/module/actor/monster-sheet.js +++ b/src/module/actor/monster-sheet.js @@ -150,6 +150,21 @@ export class OseActorSheetMonster extends OseActorSheet { } } + async _onCountChange(event) { + event.preventDefault(); + const itemId = event.currentTarget.closest(".item").dataset.itemId; + const item = this.actor.getOwnedItem(itemId); + if (event.target.dataset.field == "value") { + return item.update({ + "data.counter.value": parseInt(event.target.value), + }); + } else if (event.target.dataset.field == "max") { + return item.update({ + "data.counter.max": parseInt(event.target.value), + }); + } + } + /** * Activate event listeners using the prepared sheet HTML * @param html {HTML} The prepared HTML object ready to be rendered into the DOM @@ -221,10 +236,10 @@ export class OseActorSheetMonster extends OseActorSheet { actorObject.rollAppearing({ event: event, check: check }); }); - // html - // .find(".counter input") - // .click((ev) => ev.target.select()) - // .change(this._onCountChange.bind(this)); + html + .find(".counter input") + .click((ev) => ev.target.select()) + .change(this._onCountChange.bind(this)); html.find(".hp-roll").click((ev) => { let actorObject = this.actor; diff --git a/src/system.json b/src/system.json index 5e7925b..5272666 100644 --- a/src/system.json +++ b/src/system.json @@ -2,7 +2,7 @@ "name": "ose", "title": "Old-School Essentials", "description": "Play B/X OSR modules with Old-School Essentials on Foundry VTT", - "version": "0.9.8", + "version": "0.9.9", "minimumCoreVersion": "0.6.2", "compatibleCoreVersion": "0.6.5", "templateVersion": 2, @@ -41,5 +41,5 @@ "gridUnits": "ft", "url": "https://gitlab.com/mesfoliesludiques/foundryvtt-ose", "manifest": "https://gitlab.com/mesfoliesludiques/foundryvtt-ose/raw/master/src/system.json", - "download": "https://gitlab.com/mesfoliesludiques/foundryvtt-ose/-/raw/master/package/ose-v0.9.8.zip" + "download": "https://gitlab.com/mesfoliesludiques/foundryvtt-ose/-/raw/master/package/ose-v0.9.9.zip" }