const for skills map, and raw 20 questions template

This commit is contained in:
Vlyan
2020-12-14 18:22:49 +01:00
parent 4870ad2302
commit 45ca9d1071
6 changed files with 597 additions and 19 deletions

View File

@@ -2,6 +2,7 @@
* L5R Dice picker dialog
* @extends {FormApplication}
*/
import { L5R5E } from "../l5r5e-config.js";
import { RollL5r5e } from "./roll.js";
export class DicePickerDialog extends FormApplication {
@@ -138,7 +139,7 @@ export class DicePickerDialog extends FormApplication {
name: "",
};
const cat = RollL5r5e.getCategoryForSkillId(skillId);
const cat = L5R5E.skills.get(skillId);
if (!cat) {
return;
}

View File

@@ -1,3 +1,4 @@
import { L5R5E } from "../l5r5e-config.js";
import { L5rBaseDie } from "./dietype/l5r-base-die.js";
/**
@@ -197,9 +198,7 @@ export class RollL5r5e extends Roll {
}
const skillName =
game.i18n.translations.l5r5e.skills?.[RollL5r5e.getCategoryForSkillId(this.l5r5e.skillId)]?.[
this.l5r5e.skillId
] || "";
game.i18n.translations.l5r5e.skills?.[L5R5E.skills.get(this.l5r5e.skillId)]?.[this.l5r5e.skillId] || "";
// Define chat data
const chatData = {
@@ -275,17 +274,6 @@ export class RollL5r5e extends Roll {
return create ? CONFIG.ChatMessage.entityClass.create(messageData, messageOptions) : messageData;
}
/**
* Return the categoryId for the skillId
* TODO in proper category helper ?
* @param skillId
*/
static getCategoryForSkillId(skillId) {
return Object.keys(game.i18n.translations.l5r5e.skills).find((e) => {
return !!game.i18n.translations.l5r5e.skills?.[e]?.[skillId];
});
}
/** @override */
static fromData(data) {
const roll = super.fromData(data);