Add a PC list summary
This commit is contained in:
parent
31bd83b0ab
commit
7b4e5bcbfa
66
module/system/bol-character-summary.js
Normal file
66
module/system/bol-character-summary.js
Normal file
@ -0,0 +1,66 @@
|
||||
/* -------------------------------------------- */
|
||||
import { BoLUtility } from "./bol-utility.js";
|
||||
import { BoLRoll } from "../controllers/bol-rolls.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class BoLCharacterSummary extends Application {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static displayPCSummary(){
|
||||
let pcList = new BoLCharacterSummary()
|
||||
pcList.render(true)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static createSummaryPos() {
|
||||
return { top: 200, left: 200 };
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
constructor() {
|
||||
if ( !game.user.isGM ) { // Uniquement si GM
|
||||
return;
|
||||
}
|
||||
|
||||
super();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static get defaultOptions() {
|
||||
return mergeObject(super.defaultOptions, {
|
||||
template: "systems/bol/templates/apps/character-summary-template.html",
|
||||
popOut: true,
|
||||
resizable: true,
|
||||
classes: ["bol", "dialog"], width: 820, height: 'fit-content'
|
||||
})
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getData() {
|
||||
let formData = super.getData();
|
||||
|
||||
formData.pcs = game.actors.filter( ac => ac.type == "character" && ac.hasPlayerOwner )
|
||||
formData.config = game.bol.config
|
||||
|
||||
return formData
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/** @override */
|
||||
async activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
html.find('.summary-roll').click((event) => {
|
||||
const li = $(event.currentTarget).parents(".item")
|
||||
const actor = game.actors.get(li.data("actor-id"))
|
||||
let type = $(event.currentTarget).data("type")
|
||||
let key = $(event.currentTarget).data("key")
|
||||
if ( type == "attribute") {
|
||||
BoLRoll.attributeCheck(actor, key, event)
|
||||
} else if (type == "aptitude") {
|
||||
BoLRoll.aptitudeCheck(actor, key, event)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
35
templates/apps/character-summary-template.html
Normal file
35
templates/apps/character-summary-template.html
Normal file
@ -0,0 +1,35 @@
|
||||
<form class="{{cssClass}} flexcol character-summary-container" autocomplete="off">
|
||||
|
||||
<ol class="items-list">
|
||||
|
||||
<li class="item flexrow item-header">
|
||||
<div class="item-field item-name item-name-fixed-medium">{{localize "BOL.ui.name"}}</div>
|
||||
{{#each config.attackAttributes as |attr key|}}
|
||||
<div class="item-field flex2">{{abbrev3 (localize attr)}}</div>
|
||||
{{/each}}
|
||||
{{#each config.aptitudes as |apt key|}}
|
||||
<div class="item-field flex2">{{abbrev3 (localize apt)}}</div>
|
||||
{{/each}}
|
||||
{{#each config.resources as |res key|}}
|
||||
<div class="item-field flex2">{{abbrev3 (localize res)}}</div>
|
||||
{{/each}}
|
||||
</li>
|
||||
|
||||
{{#each pcs as |pc key|}}
|
||||
<li class="item flexrow" data-actor-id="{{pc.id}}">
|
||||
<div class="item-field item-name item-name-fixed-medium">{{pc.name}}</div>
|
||||
{{#each pc.system.attributes as |attr key|}}
|
||||
<div class="item-field flex2 "><a class="summary-roll" data-type="attribute" data-key="{{key}}">{{attr.value}}</a></div>
|
||||
{{/each}}
|
||||
{{#each pc.system.aptitudes as |apt key|}}
|
||||
<div class="item-field flex2 "><a class="summary-roll" data-type="aptitude" data-key="{{key}}">{{apt.value}}</a></div>
|
||||
{{/each}}
|
||||
{{#each pc.system.resources as |res key|}}
|
||||
<div class="item-field flex2 ">{{res.value}}/{{res.max}}</div>
|
||||
{{/each}}
|
||||
</li>
|
||||
{{/each}}
|
||||
|
||||
</ol>
|
||||
|
||||
</form>
|
Loading…
Reference in New Issue
Block a user