Update SWB system for FVTT version 0.5.2

This commit is contained in:
Andrew 2020-03-30 20:49:30 -07:00
parent c3402a0acf
commit 57b5be22dc
3 changed files with 26 additions and 58 deletions

View file

@ -1,38 +1,23 @@
/** /**
* Extend the basic ActorSheet with some very simple modifications * Extend the basic ActorSheet with some very simple modifications
* @extends {ActorSheet}
*/ */
export class SimpleActorSheet extends ActorSheet { export class SimpleActorSheet extends ActorSheet {
constructor(...args) {
super(...args);
/** /** @override */
* Keep track of the currently active sheet tab
* @type {string}
*/
this._sheetTab = "description";
}
/* -------------------------------------------- */
/**
* Extend and override the default options used by the 5e Actor Sheet
* @returns {Object}
*/
static get defaultOptions() { static get defaultOptions() {
return mergeObject(super.defaultOptions, { return mergeObject(super.defaultOptions, {
classes: ["worldbuilding", "sheet", "actor"], classes: ["worldbuilding", "sheet", "actor"],
template: "systems/worldbuilding/templates/actor-sheet.html", template: "systems/worldbuilding/templates/actor-sheet.html",
width: 600, width: 600,
height: 600 height: 600,
tabs: [{navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description"}]
}); });
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
/** /** @override */
* Prepare data for rendering the Actor sheet
* The prepared data object contains both the actor data as well as additional sheet options
*/
getData() { getData() {
const data = super.getData(); const data = super.getData();
data.dtypes = ["String", "Number", "Boolean"]; data.dtypes = ["String", "Number", "Boolean"];
@ -44,10 +29,7 @@ export class SimpleActorSheet extends ActorSheet {
/* -------------------------------------------- */ /* -------------------------------------------- */
/** /** @override */
* Activate event listeners using the prepared sheet HTML
* @param html {HTML} The prepared HTML object ready to be rendered into the DOM
*/
activateListeners(html) { activateListeners(html) {
super.activateListeners(html); super.activateListeners(html);
@ -82,6 +64,11 @@ export class SimpleActorSheet extends ActorSheet {
/* -------------------------------------------- */ /* -------------------------------------------- */
/**
* Listen for click events on an attribute control to modify the composition of attributes in the sheet
* @param {MouseEvent} event The originating left click event
* @private
*/
async _onClickAttributeControl(event) { async _onClickAttributeControl(event) {
event.preventDefault(); event.preventDefault();
const a = event.currentTarget; const a = event.currentTarget;
@ -109,11 +96,7 @@ export class SimpleActorSheet extends ActorSheet {
/* -------------------------------------------- */ /* -------------------------------------------- */
/** /** @override */
* Implement the _updateObject method as required by the parent class spec
* This defines how to update the subject of the form when the form is submitted
* @private
*/
_updateObject(event, formData) { _updateObject(event, formData) {
// Handle the free-form attributes list // Handle the free-form attributes list

View file

@ -1,36 +1,23 @@
/** /**
* Extend the basic ItemSheet with some very simple modifications * Extend the basic ItemSheet with some very simple modifications
* @extends {ItemSheet}
*/ */
export class SimpleItemSheet extends ItemSheet { export class SimpleItemSheet extends ItemSheet {
constructor(...args) {
super(...args);
/** /** @override */
* Keep track of the currently active sheet tab
* @type {string}
*/
this._sheetTab = "description";
}
/**
* Extend and override the default options used by the Simple Item Sheet
* @returns {Object}
*/
static get defaultOptions() { static get defaultOptions() {
return mergeObject(super.defaultOptions, { return mergeObject(super.defaultOptions, {
classes: ["worldbuilding", "sheet", "item"], classes: ["worldbuilding", "sheet", "item"],
template: "systems/worldbuilding/templates/item-sheet.html", template: "systems/worldbuilding/templates/item-sheet.html",
width: 520, width: 520,
height: 480, height: 480,
tabs: [{navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description"}]
}); });
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
/** /** @override */
* Prepare data for rendering the Item sheet
* The prepared data object contains both the actor data as well as additional sheet options
*/
getData() { getData() {
const data = super.getData(); const data = super.getData();
data.dtypes = ["String", "Number", "Boolean"]; data.dtypes = ["String", "Number", "Boolean"];
@ -42,10 +29,7 @@ export class SimpleItemSheet extends ItemSheet {
/* -------------------------------------------- */ /* -------------------------------------------- */
/** /** @override */
* Activate event listeners using the prepared sheet HTML
* @param html {HTML} The prepared HTML object ready to be rendered into the DOM
*/
activateListeners(html) { activateListeners(html) {
super.activateListeners(html); super.activateListeners(html);
@ -66,6 +50,11 @@ export class SimpleItemSheet extends ItemSheet {
/* -------------------------------------------- */ /* -------------------------------------------- */
/**
* Listen for click events on an attribute control to modify the composition of attributes in the sheet
* @param {MouseEvent} event The originating left click event
* @private
*/
async _onClickAttributeControl(event) { async _onClickAttributeControl(event) {
event.preventDefault(); event.preventDefault();
const a = event.currentTarget; const a = event.currentTarget;
@ -93,11 +82,7 @@ export class SimpleItemSheet extends ItemSheet {
/* -------------------------------------------- */ /* -------------------------------------------- */
/** /** @override */
* Implement the _updateObject method as required by the parent class spec
* This defines how to update the subject of the form when the form is submitted
* @private
*/
_updateObject(event, formData) { _updateObject(event, formData) {
// Handle the free-form attributes list // Handle the free-form attributes list

View file

@ -2,9 +2,9 @@
"name": "worldbuilding", "name": "worldbuilding",
"title": "Simple World-Building", "title": "Simple World-Building",
"description": "A minimalist game system with very simple Actor and Item models to support free-form system agnostic gameplay.", "description": "A minimalist game system with very simple Actor and Item models to support free-form system agnostic gameplay.",
"version": 0.32, "version": 0.33,
"minimumCoreVersion": "0.4.4", "minimumCoreVersion": "0.5.2",
"compatibleCoreVersion": "0.5.0", "compatibleCoreVersion": "0.5.3",
"templateVersion": 2, "templateVersion": 2,
"author": "Atropos", "author": "Atropos",
"esmodules": ["module/simple.js"], "esmodules": ["module/simple.js"],