diff --git a/module/system/bol-character-summary.js b/module/system/bol-character-summary.js new file mode 100644 index 0000000..e9548b3 --- /dev/null +++ b/module/system/bol-character-summary.js @@ -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) + } + }) + } + +} \ No newline at end of file diff --git a/templates/apps/character-summary-template.html b/templates/apps/character-summary-template.html new file mode 100644 index 0000000..dd1395d --- /dev/null +++ b/templates/apps/character-summary-template.html @@ -0,0 +1,35 @@ +
+ +
    + +
  1. +
    {{localize "BOL.ui.name"}}
    + {{#each config.attackAttributes as |attr key|}} +
    {{abbrev3 (localize attr)}}
    + {{/each}} + {{#each config.aptitudes as |apt key|}} +
    {{abbrev3 (localize apt)}}
    + {{/each}} + {{#each config.resources as |res key|}} +
    {{abbrev3 (localize res)}}
    + {{/each}} +
  2. + + {{#each pcs as |pc key|}} +
  3. +
    {{pc.name}}
    + {{#each pc.system.attributes as |attr key|}} + + {{/each}} + {{#each pc.system.aptitudes as |apt key|}} + + {{/each}} + {{#each pc.system.resources as |res key|}} +
    {{res.value}}/{{res.max}}
    + {{/each}} +
  4. + {{/each}} + +
+ +
\ No newline at end of file