using helpers for selects

This commit is contained in:
Vlyan
2020-12-18 13:55:28 +01:00
parent 1ad9d639f2
commit 97060b5666
22 changed files with 138 additions and 102 deletions

View File

@@ -8,7 +8,7 @@ export class ActorSheetL5r5e extends BaseSheetL5r5e {
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
classes: ["l5r5e", "sheet", "actor"],
template: CONFIG.L5r5e.paths.templates + "sheets/actor-sheet.html",
template: CONFIG.l5r5e.paths.templates + "sheets/actor-sheet.html",
width: 600,
height: 800,
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description" }],

View File

@@ -9,7 +9,7 @@ export class BaseSheetL5r5e extends ActorSheet {
const sheetData = super.getData();
sheetData.data.dtypes = ["String", "Number", "Boolean"];
sheetData.data.stances = CONFIG.L5r5e.stances;
sheetData.data.stances = CONFIG.l5r5e.stances;
return sheetData;
}

View File

@@ -9,7 +9,7 @@ export class NpcSheetL5r5e extends BaseSheetL5r5e {
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
classes: ["l5r5e", "sheet", "npc"],
template: CONFIG.L5r5e.paths.templates + "sheets/npc-sheet.html",
template: CONFIG.l5r5e.paths.templates + "sheets/npc-sheet.html",
width: 600,
height: 800,
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description" }],

View File

@@ -24,7 +24,7 @@ export class TwentyQuestionsDialog extends FormApplication {
return mergeObject(super.defaultOptions, {
id: "l5r5e-twenty-questions-dialog",
classes: ["l5r5e", "twenty-questions-dialog"],
template: CONFIG.L5r5e.paths.templates + "sheets/twenty-questions-dialog.html",
template: CONFIG.l5r5e.paths.templates + "sheets/twenty-questions-dialog.html",
title: game.i18n.localize("l5r5e.twenty_questions.title"),
width: 600,
height: 600,
@@ -77,11 +77,12 @@ export class TwentyQuestionsDialog extends FormApplication {
* @return {Object}
*/
getData(options = null) {
console.log(game.l5r5e.HelpersL5r5e.getRingsList());
return {
...super.getData(options),
elementsList: this._getElements(),
skillsList: this._getSkills(),
techniquesList: CONFIG.L5r5e.techniques,
ringsList: game.l5r5e.HelpersL5r5e.getRingsList(),
skillsList: game.l5r5e.HelpersL5r5e.getSkillsList(true),
techniquesList: CONFIG.l5r5e.techniques,
datas: this.datas,
};
}
@@ -245,38 +246,6 @@ export class TwentyQuestionsDialog extends FormApplication {
}, new Map());
}
/**
* Load elements list (id, label)
* @private
*/
_getElements() {
return CONFIG.L5r5e.stances.map((e) => {
return {
id: e,
label: game.i18n.localize(`l5r5e.rings.${e}`),
};
});
}
/**
* Load Skills list (id, cat, label)
* @private
*/
_getSkills() {
const skills = {};
Array.from(L5R5E.skills).forEach(([id, cat]) => {
if (!skills[cat]) {
skills[cat] = [];
}
skills[cat].push({
id: id,
cat: cat,
label: game.i18n.localize(`l5r5e.skills.${cat}.${id}`),
});
});
return skills;
}
/**
* Initialize form array
* @private