Fix party sheet

master
John Downey 2022-04-09 15:22:18 -05:00
parent 7088263c05
commit 32297ccbd9
3 changed files with 30 additions and 28 deletions

View File

@ -89,11 +89,13 @@ export class AcksPartySheet extends FormApplication {
}).render(true);
}
async _selectActors(ev) {
async _selectActors(event) {
event.preventDefault();
const template = "/systems/acks/templates/apps/party-select.html";
const templateData = {
actors: this.object.entities
}
actors: this.object.documents,
};
const content = await renderTemplate(template, templateData);
new Dialog({
title: "Select Party Characters",
@ -106,7 +108,7 @@ export class AcksPartySheet extends FormApplication {
let checks = html.find("input[data-action='select-actor']");
checks.each(async (_, c) => {
let key = c.getAttribute('name');
await this.object.entities[key].setFlag('acks', 'party', c.checked);
await this.object.documents[key].setFlag('acks', 'party', c.checked);
});
},
},
@ -117,11 +119,12 @@ export class AcksPartySheet extends FormApplication {
/** @override */
activateListeners(html) {
super.activateListeners(html);
html
.find(".item-controls .item-control .select-actors")
.click(this._selectActors.bind(this));
html.find(".item-controls .item-control .deal-xp").click(this._dealXP.bind(this));
html.find(".item-controls .item-control .deal-xp").click(this._dealXP.bind(this));
html.find("a.resync").click(() => this.render(true));

View File

@ -9,7 +9,6 @@ export const addControl = (object, html) => {
}
export const showPartySheet = (object) => {
event.preventDefault();
new AcksPartySheet(object, {
top: window.screen.height / 2 - 180,
left:window.screen.width / 2 - 140,

View File

@ -15,10 +15,10 @@
{{/if}}
</div>
<ol class="actor-list">
{{#each data.entities as |e|}} {{#if e.data.flags.acks.party}}
<li class="actor flexrow" data-actor-id="{{e.id}}">
{{#each data.documents as |actor|}} {{#if actor.data.flags.acks.party}}
<li class="actor flexrow" data-actor-id="{{actor.id}}">
<div class="field-img">
<img src="{{e.img}}" />
<img src="{{actor.img}}" />
<div class="img-btns flexrow">
<button type="button" data-action="open-sheet"><i class="fas fa-user"></i></button>
</div>
@ -26,17 +26,17 @@
<div class="fields">
<div class="flexrow field-row">
<div class="field-name flex2">
<strong>{{e.name}}</strong>
<strong>{{actor.name}}</strong>
</div>
<div class="field-long" title="{{localize 'ACKS.Health'}}">
<i class="fas fa-heart"></i>
{{e.data.data.hp.value}}/{{e.data.data.hp.max}}
{{actor.data.data.hp.value}}/{{actor.data.data.hp.max}}
</div>
<div class="field-short" title="{{localize 'ACKS.ArmorClass'}}">
<i class="fas fa-shield-alt"></i>
{{#if @root.settings.ascending}}<strong>{{e.data.data.aac.value}}</strong>
<sub>{{e.data.data.aac.naked}}</sub>
{{else}}<strong>{{e.data.data.ac.value}}</strong> <sub>{{e.data.data.ac.naked}}</sub>
{{#if @root.settings.ascending}}<strong>{{actor.data.data.aac.value}}</strong>
<sub>{{actor.data.data.aac.naked}}</sub>
{{else}}<strong>{{actor.data.data.ac.value}}</strong> <sub>{{actor.data.data.ac.naked}}</sub>
{{/if}}
</div>
</div>
@ -44,40 +44,40 @@
<div class="field-short" title="{{localize 'ACKS.Thac0'}}">
<i class="fas fa-crosshairs"></i>
{{#unless @root.settings.ascending}}
{{e.data.data.thac0.value}}
{{actor.data.data.thac0.value}}
{{else}}
{{e.data.data.thac0.throw}}
{{actor.data.data.thac0.throw}}
{{/unless}}
</div>
{{#if (eq e.data.type 'character')}}
{{#if (eq actor.data.type 'character')}}
<div class="field-short" title="{{localize 'ACKS.Melee'}}">
<i class="fas fa-fist-raised"></i>
{{add e.data.data.scores.str.mod e.data.data.thac0.mod.melee}}
{{add actor.data.data.scores.str.mod actor.data.data.thac0.mod.melee}}
</div>
<div class="field-short" title="{{localize 'ACKS.Missile'}}">
<i class="fas fa-bullseye"></i>
{{add e.data.data.scores.dex.mod e.data.data.thac0.mod.missile}}
{{add actor.data.data.scores.dex.mod actor.data.data.thac0.mod.missile}}
</div>
{{/if}}
<div class="field-short flex2">
<i class="fas fa-shoe-prints" title="{{localize 'ACKS.movement.base'}}"></i>
<span title="{{localize 'ACKS.movement.encounter.long'}}">{{e.data.data.movement.encounter}}</span> <sub
title="{{localize 'ACKS.movement.exploration.long'}}">{{e.data.data.movement.base}}</sub>
<span title="{{localize 'ACKS.movement.encounter.long'}}">{{actor.data.data.movement.encounter}}</span> <sub
title="{{localize 'ACKS.movement.exploration.long'}}">{{actor.data.data.movement.base}}</sub>
</div>
{{#if (eq e.data.type 'character')}}
{{#if (eq actor.data.type 'character')}}
<div class="field-short flex2">
<i class="fas fa-weight-hanging" title="{{localize 'ACKS.Encumbrance'}}"></i>
{{roundWeight e.data.data.encumbrance.value}}k
{{roundWeight actor.data.data.encumbrance.value}}k
</div>
{{/if}}
</div>
<div class="flexrow field-row">
<div class="field-longer flexrow">
{{#each e.data.data.saves as |s i|}}
{{#each actor.data.data.saves as |s i|}}
<span title="{{lookup @root.config.saves_long i}}">{{lookup @root.config.saves_short i}} {{s.value}}</span>
{{/each}}
{{#if (eq e.data.type 'character')}}<span><i class="fas fa-magic"
title="{{localize 'ACKS.saves.magic.long'}}"></i>{{mod e.data.data.scores.wis.mod}}</span>{{/if}}
{{#if (eq actor.data.type 'character')}}<span><i class="fas fa-magic"
title="{{localize 'ACKS.saves.magic.long'}}"></i>{{mod actor.data.data.scores.wis.mod}}</span>{{/if}}
</div>
</div>
</div>