Debuting the conversion of skills to items list : Db and item Sheet

This commit is contained in:
Vlyan
2023-01-07 15:57:44 +01:00
parent ac43982f24
commit 5fbb34d882
20 changed files with 342 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ export const L5R5E = {
money: [50, 10],
stances: ["earth", "air", "water", "fire", "void"],
roles: ["artisan", "bushi", "courtier", "monk", "sage", "shinobi", "shugenja"],
skillCategories: ["artisan", "martial", "scholar", "social", "trade"],
xp: {
costPerRank: [0, 20, 24, 32, 44, 60],
bondCostPerRank: [0, 3, 4, 6, 8, 10],
@@ -45,6 +46,7 @@ L5R5E.techniques.set("title_ability", { type: "title", displayInTypes: false });
L5R5E.techniques.set("specificity", { type: "custom", displayInTypes: false });
// *** SkillId - CategoryId ***
// TODO @deprecated hardcoded skills
L5R5E.skills = new Map();
L5R5E.skills.set("aesthetics", "artisan");
L5R5E.skills.set("composition", "artisan");

View File

@@ -21,6 +21,8 @@ export class HelpersL5r5e {
* @return {{cat: any, id: any, label: *}[]}
*/
static getSkillsList(useGroup = false) {
console.warn('@deprecated hardcoded skills - helpers.getSkillsList()'); // TODO @deprecated hardcoded skills
if (!useGroup) {
return Array.from(CONFIG.l5r5e.skills).map(([id, cat]) => ({
id: id,
@@ -48,6 +50,8 @@ export class HelpersL5r5e {
* @return {Map}
*/
static getCategoriesSkillsList() {
console.warn('@deprecated hardcoded skills - helpers.getCategoriesSkillsList()'); // TODO @deprecated hardcoded skills
return Array.from(CONFIG.l5r5e.skills).reduce((acc, [id, cat]) => {
if (acc.has(cat)) {
acc.set(cat, [...acc.get(cat), id]);
@@ -297,6 +301,8 @@ export class HelpersL5r5e {
static getPackNameForCoreItem(documentId) {
const core = new Map();
core.set("Skl", "l5r5e.core-skills");
core.set("Arm", "l5r5e.core-armors");
core.set("Bon", "l5r5e.core-bonds");
core.set("Boo", "l5r5e.core-celestial-implement-boons");

View File

@@ -0,0 +1,30 @@
import { ItemSheetL5r5e } from "./item-sheet.js";
/**
* @extends {ItemSheet}
*/
export class SkillSheetL5r5e extends ItemSheetL5r5e {
/** @override */
static get defaultOptions() {
return foundry.utils.mergeObject(super.defaultOptions, {
classes: ["l5r5e", "sheet", "skill"],
template: CONFIG.l5r5e.paths.templates + "items/skill/skill-sheet.html",
width: 520,
height: 480,
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description" }],
});
}
/**
* @return {Object|Promise}
*/
async getData(options = {}) {
const sheetData = await super.getData(options);
sheetData.data.SkillCategoriesList = CONFIG.l5r5e.skillCategories;
console.log(sheetData.data.system);
return sheetData;
}
}

View File

@@ -23,6 +23,7 @@ import { CombatL5r5e } from "./combat.js";
// Items
import { ItemL5r5e } from "./item.js";
import { ItemSheetL5r5e } from "./items/item-sheet.js";
import { SkillSheetL5r5e } from "./items/skill-sheet.js";
import { ArmorSheetL5r5e } from "./items/armor-sheet.js";
import { WeaponSheetL5r5e } from "./items/weapon-sheet.js";
import { TechniqueSheetL5r5e } from "./items/technique-sheet.js";
@@ -132,6 +133,11 @@ Hooks.once("init", async () => {
label: "ITEM.TypeItem",
makeDefault: true,
});
Items.registerSheet("l5r5e", SkillSheetL5r5e, {
types: ["skill"],
label: "ITEM.TypeSkill",
makeDefault: true,
});
Items.registerSheet("l5r5e", ArmorSheetL5r5e, {
types: ["armor"],
label: "ITEM.TypeArmor",

View File

@@ -57,6 +57,9 @@ export const PreloadTemplates = async function () {
`${tpl}items/property/properties.html`,
`${tpl}items/property/property-entry.html`,
`${tpl}items/property/property-sheet.html`,
`${tpl}items/skill/skill-entry.html`,
`${tpl}items/skill/skill-sheet.html`,
`${tpl}items/skill/skill-text.html`,
`${tpl}items/signature-scroll/signature-scroll-entry.html`,
`${tpl}items/signature-scroll/signature-scroll-sheet.html`,
`${tpl}items/signature-scroll/signature-scroll-text.html`,