Get the calculated capacity "tooltip" implemented (closes #147 and closes #125)

This commit is contained in:
Oliver-Akins 2024-04-15 23:49:50 -06:00
parent 2737c46ffe
commit c3bb67ad7c
5 changed files with 131 additions and 3 deletions

View file

@ -1,3 +1,4 @@
import { DialogManager } from "../../utils/DialogManager.mjs";
import DOTDUNGEON from "../../config.mjs";
export class GenericItemSheet extends ItemSheet {
@ -45,6 +46,10 @@ export class GenericItemSheet extends ItemSheet {
.on(`click`, this._incrementValue.bind(this));
html.find(`button[data-decrement]`)
.on(`click`, this._decrementValue.bind(this));
html.find(`[data-help-id]`)
.on(`click`, this._helpPopup.bind(this));
};
async _incrementValue($e) {
@ -66,4 +71,15 @@ export class GenericItemSheet extends ItemSheet {
};
this.actor.update({ [data.decrement]: value - 1 });
};
async _helpPopup($e) {
const target = $e.currentTarget;
const data = target.dataset;
if (!data.helpId) return;
DialogManager.helpDialog(
data.helpId,
data.helpContent,
data.helpTitle
);
};
};