This commit is contained in:
Vlyan
2020-12-08 18:48:02 +01:00
40 changed files with 615 additions and 229 deletions

View File

@@ -1,21 +1,20 @@
import { L5RItemSheet } from "./item-sheet.js";
import { ItemSheetL5r5e } from "./item-sheet.js";
/**
* @extends {ItemSheet}
*/
export class L5RFeatSheet extends L5RItemSheet {
* @extends {ItemSheet}
*/
export class FeatSheetL5r5e extends ItemSheetL5r5e {
/** @override */
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
classes: ["l5r", "sheet", "feat"],
template: "systems/l5r/templates/item/feat-sheet.html",
template: "systems/l5r5e/templates/item/feat-sheet.html",
width: 520,
height: 480,
tabs: [{navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description"}]
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description" }],
});
}
/** @override */
getData() {
const sheetData = super.getData();
@@ -33,19 +32,18 @@ export class L5RFeatSheet extends L5RItemSheet {
*/
activateListeners(html) {
super.activateListeners(html);
// Everything below here is only needed if the sheet is editable
if (!this.options.editable) return;
}
/**
* Update feat with the data from the sheet.
* @param event
* @param formData
* @param event
* @param formData
*/
_updateObject(event, formData) {
// Update the Item
return this.object.update(formData);
}
}
}

View File

@@ -1,46 +1,45 @@
/**
* Extend the basic ItemSheet with some very simple modifications
* @extends {ItemSheet}
*/
export class L5RItemSheet extends ItemSheet {
* Extend the basic ItemSheet with some very simple modifications
* @extends {ItemSheet}
*/
export class ItemSheetL5r5e extends ItemSheet {
/** @override */
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
classes: ["l5r", "sheet", "item"],
template: "systems/l5r/templates/item/item-sheet.html",
template: "systems/l5r5e/templates/item/item-sheet.html",
width: 520,
height: 480,
tabs: [{navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description"}]
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description" }],
});
}
getData() {
const sheetData = super.getData();
sheetData.data.dtypes = ["String", "Number", "Boolean"];
sheetData.data.isEquipment = true;
return sheetData;
}
/**
* Subscribe to events from the sheet.
* @param html HTML content of the sheet.
*/
* Subscribe to events from the sheet.
* @param html HTML content of the sheet.
*/
activateListeners(html) {
super.activateListeners(html);
// Everything below here is only needed if the sheet is editable
if (!this.options.editable) return;
}
/**
* Update the item with data from the sheet.
* @param event
* @param formData
*/
* Update the item with data from the sheet.
* @param event
* @param formData
*/
_updateObject(event, formData) {
return this.object.update(formData);
}

View File

@@ -1,4 +1 @@
export class L5RItem extends Item {
}
export class ItemL5r5e extends Item {}

View File

@@ -1,48 +1,47 @@
import { L5RItemSheet } from "./item-sheet.js";
import { ItemSheetL5r5e } from "./item-sheet.js";
/**
* @extends {ItemSheet}
*/
export class L5RWeaponSheet extends L5RItemSheet {
* @extends {ItemSheet}
*/
export class WeaponSheetL5r5e extends ItemSheetL5r5e {
/** @override */
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
classes: ["l5r", "sheet", "weapon"],
template: "systems/l5r/templates/item/weapon-sheet.html",
template: "systems/l5r5e/templates/item/weapon-sheet.html",
width: 520,
height: 480,
tabs: [{navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description"}]
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description" }],
});
}
getData() {
const sheetData = super.getData();
sheetData.data.dtypes = ["String", "Number", "Boolean"];
sheetData.data.isWeapon = true;
sheetData.data.isEquipment = true;
return sheetData;
}
/**
* Subscribe to events from the sheet.
* @param html HTML content of the sheet.
*/
* Subscribe to events from the sheet.
* @param html HTML content of the sheet.
*/
activateListeners(html) {
super.activateListeners(html);
// Everything below here is only needed if the sheet is editable
if (!this.options.editable) return;
}
/**
* Update item with values from the sheet.
* @param event
* @param formData
*/
* Update item with values from the sheet.
* @param event
* @param formData
*/
_updateObject(event, formData) {
return this.object.update(formData);
}
}
}

View File

@@ -6,6 +6,10 @@ import { ActorSheetL5r5e } from "./sheets/actor-sheet.js";
import { RollL5r5e } from "./dice/roll.js";
import { AbilityDie } from "./dice/dietype/ability-die.js";
import { RingDie } from "./dice/dietype/ring-die.js";
import { ItemL5r5e } from "./items/item.js";
import { ItemSheetL5r5e } from "./items/item-sheet.js";
import { WeaponSheetL5r5e } from "./items/weapon-sheet.js";
import { FeatSheetL5r5e } from "./items/feat-sheet.js";
// Import Dice Types
@@ -18,6 +22,7 @@ Hooks.once("init", async function () {
// Assign custom classes and constants here
CONFIG.Actor.entityClass = ActorL5r5e;
CONFIG.Actor.sheetClasses = ActorSheetL5r5e;
CONFIG.Item.entityClass = ItemL5r5e;
// Define custom Roll class
CONFIG.Dice.rolls.push(CONFIG.Dice.rolls[0]);
@@ -46,6 +51,12 @@ Hooks.once("init", async function () {
Actors.unregisterSheet("core", ActorSheet);
Actors.registerSheet("l5r5e", ActorSheetL5r5e, { types: ["character"], makeDefault: true });
// Items sheet
Items.unregisterSheet("core", ItemSheet);
Items.registerSheet("l5r5e", ItemSheetL5r5e, { types: ["item"], makeDefault: true });
Items.registerSheet("l5r5e", WeaponSheetL5r5e, { types: ["weapon"], makeDefault: true });
Items.registerSheet("l5r5e", FeatSheetL5r5e, { types: ["feat"], makeDefault: true });
Handlebars.registerHelper("localizeSkillCategory", function (skillName) {
const key = "L5r5e.Skills." + skillName + ".Title";
return game.i18n.localize(key);

View File

@@ -1,25 +1,27 @@
export const PreloadTemplates = async function() {
const templatePaths = [
// Add paths to "systems/l5r5e/templates"
'systems/l5r5e/templates/sheets/actor/rings.html',
'systems/l5r5e/templates/sheets/actor/identity.html',
'systems/l5r5e/templates/sheets/actor/category.html',
'systems/l5r5e/templates/sheets/actor/skill.html',
'systems/l5r5e/templates/sheets/actor/social.html',
'systems/l5r5e/templates/sheets/actor/conflict.html',
'systems/l5r5e/templates/sheets/actor/stance.html',
'systems/l5r5e/templates/sheets/actor/feats.html',
'systems/l5r5e/templates/sheets/actor/experience.html',
'systems/l5r5e/templates/sheets/actor/adquisition.html',
// items
'systems/l5r5e/templates/item/weapon-sheet.html',
'systems/l5r5e/templates/item/items.html',
'systems/l5r5e/templates/item/item-entry.html',
'systems/l5r5e/templates/item/weapons.html',
'systems/l5r5e/templates/item/weapon-entry.html',
'systems/l5r5e/templates/item/feat-sheet.html',
'systems/l5r5e/templates/item/feat-entry.html'
];
export const PreloadTemplates = async function () {
const templatePaths = [
// Add paths to "systems/l5r5e/templates"
"systems/l5r5e/templates/sheets/actor/rings.html",
"systems/l5r5e/templates/sheets/actor/narrative.html",
"systems/l5r5e/templates/sheets/actor/identity.html",
"systems/l5r5e/templates/sheets/actor/category.html",
"systems/l5r5e/templates/sheets/actor/skill.html",
"systems/l5r5e/templates/sheets/actor/social.html",
"systems/l5r5e/templates/sheets/actor/attributes.html",
"systems/l5r5e/templates/sheets/actor/conflict.html",
"systems/l5r5e/templates/sheets/actor/stance.html",
"systems/l5r5e/templates/sheets/actor/feats.html",
"systems/l5r5e/templates/sheets/actor/experience.html",
"systems/l5r5e/templates/sheets/actor/adquisition.html",
// items
"systems/l5r5e/templates/item/weapon-sheet.html",
"systems/l5r5e/templates/item/items.html",
"systems/l5r5e/templates/item/item-entry.html",
"systems/l5r5e/templates/item/weapons.html",
"systems/l5r5e/templates/item/weapon-entry.html",
"systems/l5r5e/templates/item/feat-sheet.html",
"systems/l5r5e/templates/item/feat-entry.html",
];
return loadTemplates(templatePaths);
}
return loadTemplates(templatePaths);
};