diff --git a/css/mothership.css b/css/mothership.css index 7552914..44b0320 100644 --- a/css/mothership.css +++ b/css/mothership.css @@ -557,6 +557,14 @@ width: 100%; } +.mothership .creature-mainstat { + position: relative; + display: grid; + grid-template-columns: 1fr 3em; + align-items: center; + gap: 0; + width: 100%; +} .mothership .mainstatlabel { border-top-left-radius: 2em; border-bottom-left-radius: 2em; @@ -658,25 +666,21 @@ .mothership .creature-header-grid { display: grid; grid-template-areas: - 'header header header' + 'name header header' 'line line line'; - grid-gap: 10px; background: #111; } .mothership .creature-header { - display: grid; - grid-template-columns: 1fr 7em 7em 5.6em 3em 5em; - grid-template-rows: 1fr 1fr; + display: flex ; + flex-direction: row-reverse; align-items: center; - grid-column: 1/-1; color: white; font-family: "Montserrat", "Arial Black", sans-serif; font-weight: bold; text-transform: uppercase; - height: 27px; grid-area: header; padding: 8px; } @@ -722,13 +726,14 @@ } .mothership .creaturename { - margin: -0.15em; height: auto; width: 100%; padding-left: 13px; font-size: 1.3rem; + font-weight: bold; color:white; text-transform: uppercase; + font-family: "Century Gothic", "Diadact Gothic", sans-serif; } .mothership .creaturestat { @@ -743,6 +748,13 @@ .mothership .creaturedescription { height: 400px; padding: 10px; + overflow-y: auto; +} +.mothership .creaturedescription .editor-content{ + overflow-y: visible; +} +.mothership .creaturedescription .editor{ + overflow: visible; } .mothership .creature-ability-container { diff --git a/module/actor/creature-sheet.js b/module/actor/creature-sheet.js index 0c5b479..84ca43a 100644 --- a/module/actor/creature-sheet.js +++ b/module/actor/creature-sheet.js @@ -2,6 +2,10 @@ * Extend the basic ActorSheet with some very simple modifications * @extends {ActorSheet} */ +import { + DLCreatureSettings +} from "../settings/creature-settings.js"; + export class MothershipCreatureSheet extends ActorSheet { /** @override */ @@ -15,6 +19,42 @@ export class MothershipCreatureSheet extends ActorSheet { }); } + /** + * Extend and override the sheet header buttons + * @override + */ + _getHeaderButtons() { + let buttons = super._getHeaderButtons(); + const canConfigure = game.user.isGM || this.actor.owner; + if (this.options.editable && canConfigure) { + buttons = [{ + label: 'Creature Settings', + class: 'configure-actor', + icon: 'fas fa-tasks', + onclick: (ev) => this._onConfigureCreature(ev), + },].concat(buttons); + } + return buttons; + } + /* -------------------------------------------- */ + + _onConfigureCreature(event) { + event.preventDefault(); + new DLCreatureSettings(this.actor, { + top: this.position.top + 40, + left: this.position.left + (this.position.width - 400) / 2 + }).render(true); + } + + async _updateObject(event, formData) { + const actor = this.object; + const updateData = expandObject(formData); + + await actor.update(updateData, { + diff: false + }); + } + /* -------------------------------------------- */ /** @override */ @@ -153,16 +193,14 @@ export class MothershipCreatureSheet extends ActorSheet { } this.actor.updateEmbeddedEntity('OwnedItem', item); - - let actor = this.actor; - let speaker = ChatMessage.getSpeaker({ actor }); - ChatMessage.create({ - speaker, - content: `Reloading ` + item.name + "...", - type: CHAT_MESSAGE_TYPES.EMOTE - }, - { chatBubble: true }); - + // let actor = this.actor; + // let speaker = ChatMessage.getSpeaker({ actor }); + // ChatMessage.create({ + // speaker, + // content: `Reloading ` + item.name + "...", + // type: CHAT_MESSAGE_TYPES.EMOTE + // }, + // { chatBubble: true }); }); // Rollable Item/Anything with a description that we want to click on. diff --git a/module/settings/creature-settings.js b/module/settings/creature-settings.js new file mode 100644 index 0000000..b8ee6b7 --- /dev/null +++ b/module/settings/creature-settings.js @@ -0,0 +1,130 @@ +export class DLCreatureSettings extends FormApplication { + static get defaultOptions() { + const options = super.defaultOptions; + options.id = 'sheet-modifiers'; + options.classes = ["mothership", "sheet", "actor", "creature"]; + options.template = 'systems/mothership/templates/dialogs/creature-settings-dialog.html'; + options.width = 320; + options.height = 150; + return options; + } + /* -------------------------------------------- */ + /** + * Add the Entity name into the window title + * @type {String} + */ + get title() { + return `${this.object.name}: Creature Settings`; + } + /* -------------------------------------------- */ + + /** + * Construct and return the data object used to render the HTML template for this form application. + * @return {Object} + */ + getData() { + const actor = this.object.data; + + return { + actor + }; + } + /* -------------------------------------------- */ + + /** @override */ + activateListeners(html) { + super.activateListeners(html); + + html.find(`input[type=checkbox][id="data.stats.combat.enabled"]`).click(ev => { + if (ev.currentTarget.checked) { + const combat = html.find(`input[type=checkbox][id="data.stats.combat.enabled"]`).prop('checked', true); + } + + this.object.update({ + "data.stats.combat.enabled": ev.currentTarget.checked + }); + }); + html.find(`input[type=checkbox][id="data.stats.instinct.enabled"]`).click(ev => { + if (ev.currentTarget.checked) { + const instinct = html.find(`input[type=checkbox][id="data.stats.instinct.enabled"]`).prop('checked', true); + } + + this.object.update({ + "data.stats.instinct.enabled": ev.currentTarget.checked + }); + }); + html.find(`input[type=checkbox][id="data.stats.loyalty.enabled"]`).click(ev => { + if (ev.currentTarget.checked) { + const loyalty = html.find(`input[type=checkbox][id="data.stats.loyalty.enabled"]`).prop('checked', true); + } + + this.object.update({ + "data.stats.loyalty.enabled": ev.currentTarget.checked + }); + }); + html.find(`input[type=checkbox][id="data.stats.speed.enabled"]`).click(ev => { + if (ev.currentTarget.checked) { + const speed = html.find(`input[type=checkbox][id="data.stats.speed.enabled"]`).prop('checked', true); + } + + this.object.update({ + "data.stats.speed.enabled": ev.currentTarget.checked + }); + }); + html.find(`input[type=checkbox][id="data.stats.armor.enabled"]`).click(ev => { + if (ev.currentTarget.checked) { + const armor = html.find(`input[type=checkbox][id="data.stats.armor.enabled"]`).prop('checked', true); + } + + this.object.update({ + "data.stats.armor.enabled": ev.currentTarget.checked + }); + }); + html.find(`input[type=checkbox][id="data.stats.sanity.enabled"]`).click(ev => { + if (ev.currentTarget.checked) { + const sanity = html.find(`input[type=checkbox][id="data.stats.sanity.enabled"]`).prop('checked', true); + } + + this.object.update({ + "data.stats.sanity.enabled": ev.currentTarget.checked + }); + }); + } + + /** + * This method is called upon form submission after form data is validated + * @param event {Event} The initial triggering submission event + * @param formData {Object} The object of validated form data with which to update the object + * @private + */ + async _updateObject(event, formData) { + + console.log("Updating Object"); + + // Loyalty + if (this.object.data.data.stats.loyalty.enabled) { + await this.object.update({ + "data.stats.loyalty.enabled": true + }); + } + // Speed + if (this.object.data.data.stats.speed.enabled) { + await this.object.update({ + "data.stats.speed.enabled": true + }); + } + // Armor + if (this.object.data.data.stats.armor.enabled) { + await this.object.update({ + "data.stats.armor.enabled": true + }); + } + + await this.object.updateEmbeddedEntity("OwnedItem", update); + + this.object.update({ + formData + }); + this.object.sheet.render(true); + } +} diff --git a/system.json b/system.json index af8f1ad..a753554 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "name": "mothership", "title": "Mothership", "description": "The Mothership system for FoundryVTT!", - "version": "0.0.4", + "version": "0.0.5", "minimumCoreVersion": "0.5.5", "compatibleCoreVersion": "0.5.5", "templateVersion": 2, diff --git a/template.json b/template.json index 9d69cbc..326956e 100644 --- a/template.json +++ b/template.json @@ -10,9 +10,7 @@ "health": { "value": 10, "min": 0, - "max": 10, - "pool": 1, - "maxpools": 1 + "max": 10 }, "hits": { "value" : 2, @@ -99,15 +97,33 @@ "stats": { "combat": { "value": 10, - "label": "Combat" + "label": "Combat", + "enabled" : true }, "instinct": { "value": 10, - "label": "Instinct" + "label": "Instinct", + "enabled" : true }, - "move": { + "speed": { "value": 10, - "label": "Move" + "label": "Speed", + "enabled" : true + }, + "loyalty": { + "value": 10, + "label": "Loyalty", + "enabled" : false + }, + "armor": { + "value": 10, + "label": "Armor", + "enabled" : false + }, + "sanity": { + "value": 10, + "label": "Sanity", + "enabled" : false } } }, @@ -179,7 +195,8 @@ "base" ], "quantity": 1, - "weight": 0 + "weight": 0, + "cost" : 0 }, "skill": { "templates": [ diff --git a/templates/actor/actor-sheet.html b/templates/actor/actor-sheet.html index 292d712..f138c42 100644 --- a/templates/actor/actor-sheet.html +++ b/templates/actor/actor-sheet.html @@ -311,6 +311,7 @@
Item Name
Quantity
Weight
+
Value
Add Item @@ -322,6 +323,7 @@

{{item.name}}

{{item.data.quantity}}
{{item.data.weight}}
+
{{item.data.cost}}
diff --git a/templates/actor/creature-sheet.html b/templates/actor/creature-sheet.html index 0075893..fcb70cb 100644 --- a/templates/actor/creature-sheet.html +++ b/templates/actor/creature-sheet.html @@ -2,50 +2,75 @@ {{!-- Sheet Header --}}
+ +
- - - + {{#if data.stats.combat.enabled}}
-
+
COMBAT
+ {{/if}} + {{#if data.stats.instinct.enabled}}
-
+
Instinct
- + {{/if}} + {{#if data.stats.speed.enabled}} +
-
- Move - +
+ Speed +
- + {{/if}} + {{#if data.stats.loyalty.enabled}} +
-
- Hits -
- -
- () -
-
+
+ Loyalty +
+ {{/if}} + {{#if data.stats.armor.enabled}} + +
+
+ Armor + +
+
+ {{/if}} + {{#if data.stats.sanity.enabled}} + +
+
+ Sanity + +
+
+ {{/if}} +
+ + +
+ +
+ +
+ +
Current
+
Maximum
+
+ + +
+ + +
+ +
+ +
+ +
Current
+
Maximum
+
+
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/actor/ship-sheet.html b/templates/actor/ship-sheet.html index 9b0ef7e..ec426b2 100644 --- a/templates/actor/ship-sheet.html +++ b/templates/actor/ship-sheet.html @@ -288,6 +288,7 @@
Item Name
Quantity
Weight
+
Value
Add @@ -300,6 +301,7 @@

{{item.name}}

{{item.data.quantity}}
{{item.data.weight}}
+
{{item.data.cost}}
diff --git a/templates/dialogs/creature-settings-dialog.html b/templates/dialogs/creature-settings-dialog.html new file mode 100644 index 0000000..5d3a784 --- /dev/null +++ b/templates/dialogs/creature-settings-dialog.html @@ -0,0 +1,32 @@ +
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
\ No newline at end of file diff --git a/templates/item/item-item-sheet.html b/templates/item/item-item-sheet.html index 92155ce..84a31a5 100644 --- a/templates/item/item-item-sheet.html +++ b/templates/item/item-item-sheet.html @@ -3,7 +3,7 @@

-
+
@@ -12,6 +12,10 @@
+
+ + +