Skip to content

Commit

Permalink
fix: revert changes from when playing around with sheets.
Browse files Browse the repository at this point in the history
  • Loading branch information
xdy committed Jun 28, 2020
1 parent 33d62ac commit ff7f5ae
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 248 deletions.
18 changes: 9 additions & 9 deletions src/module/actor/actor-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class twodsixActorSheet extends ActorSheet {
getData() {
const data = super.getData();
data.dtypes = ["String", "Number", "Boolean"];
for (let attr of Object.values(data.data.attributes)) {
for (const attr of Object.values(data.data.attributes)) {
attr.isCheckbox = attr.dtype === "Boolean";
}
return data;
Expand Down Expand Up @@ -66,19 +66,19 @@ export class twodsixActorSheet extends ActorSheet {
event.preventDefault();
const header = event.currentTarget;
// Get the type of item to create.
const type = header.dataset.type;
const {type} = header.dataset;
// Grab any data associated with this control.
const data = duplicate(header.dataset);
// Initialize a default name.
const name = `New ${type.capitalize()}`;
// Prepare the item object.
const itemData = {
name: name,
type: type,
data: data
name,
type,
data
};
// Remove the type from the dataset since it's in the itemData.type prop.
delete itemData.data["type"];
delete itemData.data.type;

// Finally, create the item!
return this.actor.createOwnedItem(itemData);
Expand All @@ -92,11 +92,11 @@ export class twodsixActorSheet extends ActorSheet {
_onRoll(event) {
event.preventDefault();
const element = event.currentTarget;
const dataset = element.dataset;
const {dataset} = element;

if (dataset.roll) {
let roll = new Roll(dataset.roll, this.actor.data.data);
let label = dataset.label ? `Rolling ${dataset.label}` : '';
const roll = new Roll(dataset.roll, this.actor.data.data);
const label = dataset.label ? `Rolling ${dataset.label}` : '';
roll.roll().toMessage({
speaker: ChatMessage.getSpeaker({ actor: this.actor }),
flavor: label
Expand Down
8 changes: 4 additions & 4 deletions src/module/actor/actor.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export class twodsixActor extends Actor {
super.prepareData();

const actorData = this.data;
const data = actorData.data;
const flags = actorData.flags;
const {data} = actorData;
const {flags} = actorData;

// Make separate methods for each Actor type (character, npc, etc.) to keep
// things organized.
Expand All @@ -23,12 +23,12 @@ export class twodsixActor extends Actor {
* Prepare Character type specific data
*/
_prepareCharacterData(actorData) {
const data = actorData.data;
const {data} = actorData;

// Make modifications to data here. For example:

// Loop through ability scores, and add their modifiers to our sheet output.
for (let [key, ability] of Object.entries(data.abilities)) {
for (const [key, ability] of Object.entries(data.abilities)) {
// Calculate the modifier using d20 rules.
ability.mod = Math.floor((ability.value - 10) / 2);
}
Expand Down
2 changes: 1 addition & 1 deletion src/module/item/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ export class twodsixItem extends Item {
// Get the Item's data
const itemData = this.data;
const actorData = this.actor ? this.actor.data : {};
const data = itemData.data;
const {data} = itemData;
}
}
3 changes: 0 additions & 3 deletions src/module/templates.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
export const templates = async function() {
const templatePaths = [
// Add paths to "systems/twodsix/templates"
"systems/twodsix/templates/actors/parts/actor-skills.html",
"systems/twodsix/src/templates/actors/parts/actor-weapons.html",
"systems/twodsix/src/templates/actors/actor-sheet.html",
"systems/twodsix/src/templates/actors/character-sheet.html",
"systems/twodsix/src/templates/items/item-sheet.html"
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ <h1 class="charname"><input name="name" type="text" value="{{actor.name}}" place
<nav class="sheet-tabs tabs" data-group="primary">
<a class="item" data-tab="description">Description</a>
<a class="item" data-tab="items">Items</a>
<a class="item" data-tab="attributes">Attributes</a>
</nav>

{{!-- Sheet Body --}}
Expand Down Expand Up @@ -82,38 +81,6 @@ <h4 class="item-name">{{item.name}}</h4>
</ol>
</div>

{{!-- Attributes Tab --}}
<div class="tab attributes" data-group="primary" data-tab="attributes">
<header class="attributes-header flexrow">
<span class="attribute-key">Attribute Key</span>
<span class="attribute-value">Value</span>
<span class="attribute-label">Label</span>
<span class="attribute-dtype">Data Type</span>
<a class="attribute-control" data-action="create"><i class="fas fa-plus"></i></a>
</header>

<ol class="attributes-list">
{{#each actor.characteristics as |attr key|}}
<li class="attribute flexrow" data-attribute="{{key}}">
<input class="attribute-key" type="text" name="data.attributes.{{key}}.key" value="{{key}}"/>
{{#if attr.isCheckbox}}
<label class="attribute-value checkbox"><input type="checkbox" name="data.attributes.{{key}}.value" {{checked attr.value}}/></label>
{{else}}
<input class="attribute-value" type="text" name="actor.attributes.{{key}}.value" value="{{attr.value}}" data-dtype="{{attr.dtype}}"/>
{{/if}}
<input class="attribute-label" type="text" name="actor.attributes.{{key}}.label" value="{{attr.label}}"/>
<select class="attribute-dtype" name="actor.attributes.{{key}}.dtype">
{{#select attr.dtype}}
{{#each ../dtypes as |t|}}
<option value="{{t}}">{{t}}</option>
{{/each}}
{{/select}}
</select>
<a class="attribute-control" data-action="delete"><i class="fas fa-trash"></i></a>
</li>
{{/each}}
</ol>
</div>
</section>
</form>

136 changes: 0 additions & 136 deletions src/templates/actors/character-sheet.html

This file was deleted.

17 changes: 0 additions & 17 deletions src/templates/actors/parts/actor-skills.html

This file was deleted.

45 changes: 0 additions & 45 deletions src/templates/actors/parts/actor-weapons.html

This file was deleted.

0 comments on commit ff7f5ae

Please sign in to comment.