Get the weapons block implemented

This commit is contained in:
Oliver-Akins 2023-12-24 22:53:08 -07:00
parent a8619246fe
commit f68e7161df
4 changed files with 149 additions and 27 deletions

View file

@ -19,29 +19,27 @@ export class PlayerSheet extends GenericSheet {
if (!this.isEditable) return;
console.debug(`.dungeon | Adding event listeners for Actor: ${this.id}`);
// html.find(`input.sync__input`).on("blur", ($e) => {
// console.debug(`.dungeon | input.sync__input blur event`);
// let value = parseInt($e.target.value);
// if (!value) {
// ui.notifications.error(
// `dotdungeon.notification.error.invalid-integer`,
// { localize: true }
// );
// return;
// };
// let delta = value - this.#syncValue();
// this.actor.system.syncDelta += delta;
// for (const actor of game.actors) {
// if (actor._sheet)
// }
// game.socket.emit(`system.dotdungeon`, {
// type: "reload",
// })
// });
/*
Toggles the expanded state for the detail elements in the sheet.
*/
html.find(`summary`).on(`click`, ($e) => {
console.debug(`.dungeon | summary[data-collapse-id="${$e.target.dataset.collapseId}"] click event`);
/*
This seeming inversion of logic is due to the fact that this handler
gets called before the element is updated to include/reflect the
change, so if the parentNode doesn't actually have it, then we're
opening it and vice-versa.
*/
if (!$e.target.parentNode.open) {
this._expanded.add($e.target.dataset.collapseId);
} else {
this._expanded.delete($e.target.dataset.collapseId);
};
});
};
_expanded = new Set();
#syncValue() {
let delta = 0;
for (const actor of game.actors) {
@ -62,6 +60,10 @@ export class PlayerSheet extends GenericSheet {
canChangeGroup: ctx.settings.playersCanChangeGroup || ctx.isGM,
};
ctx.meta = {
expanded: this._expanded,
};
console.groupCollapsed(`PlayerSheet.getData`);
console.log(`ctx`, ctx);
console.log(`actor`, actor);