Working on 0.8.x
- NPC with all ring on strengths/weaknesses (CSS TODO). - Removed Custom tech "Links" as they are in fact "Bonds" and need more work. - Added Bonds, SignatureScroll, ItemPatterns and working on titles
This commit is contained in:
@@ -20,12 +20,12 @@ export class BaseSheetL5r5e extends ActorSheet {
|
||||
* Commons datas
|
||||
* @override
|
||||
*/
|
||||
getData() {
|
||||
const sheetData = super.getData();
|
||||
getData(options) {
|
||||
const sheetData = super.getData(options);
|
||||
|
||||
sheetData.data.dtypes = ["String", "Number", "Boolean"];
|
||||
sheetData.data.stances = CONFIG.l5r5e.stances;
|
||||
sheetData.data.techniquesList = game.l5r5e.HelpersL5r5e.getTechniquesList();
|
||||
sheetData.data.techniquesList = game.l5r5e.HelpersL5r5e.getTechniquesList({ displayInTypes: true });
|
||||
|
||||
// Sort Items by name
|
||||
sheetData.items.sort((a, b) => {
|
||||
@@ -47,13 +47,14 @@ export class BaseSheetL5r5e extends ActorSheet {
|
||||
*/
|
||||
_splitTechniques(sheetData) {
|
||||
const out = {};
|
||||
const schoolTechniques = Array.from(CONFIG.l5r5e.techniques)
|
||||
.filter(([id, cfg]) => cfg.type === "school")
|
||||
.map(([id, cfg]) => id);
|
||||
|
||||
// Build the list order
|
||||
[...CONFIG.l5r5e.techniques, ...CONFIG.l5r5e.techniques_custom, ...CONFIG.l5r5e.techniques_school].forEach(
|
||||
(tech) => {
|
||||
out[tech] = [];
|
||||
}
|
||||
);
|
||||
Array.from(CONFIG.l5r5e.techniques).forEach(([id, cfg]) => {
|
||||
out[id] = [];
|
||||
});
|
||||
|
||||
// Add tech the character knows
|
||||
sheetData.items.forEach((item) => {
|
||||
@@ -64,11 +65,7 @@ export class BaseSheetL5r5e extends ActorSheet {
|
||||
|
||||
// Remove unused techs
|
||||
Object.keys(out).forEach((tech) => {
|
||||
if (
|
||||
out[tech].length < 1 &&
|
||||
!sheetData.data.data.techniques[tech] &&
|
||||
!CONFIG.l5r5e.techniques_school.includes(tech)
|
||||
) {
|
||||
if (out[tech].length < 1 && !sheetData.data.data.techniques[tech] && !schoolTechniques.includes(tech)) {
|
||||
delete out[tech];
|
||||
}
|
||||
});
|
||||
@@ -145,7 +142,7 @@ export class BaseSheetL5r5e extends ActorSheet {
|
||||
|
||||
/**
|
||||
* Handle dropped data on the Actor sheet
|
||||
* @param {Event} event
|
||||
* @param {DragEvent} event
|
||||
*/
|
||||
async _onDrop(event) {
|
||||
// *** Everything below here is only needed if the sheet is editable ***
|
||||
@@ -158,7 +155,18 @@ export class BaseSheetL5r5e extends ActorSheet {
|
||||
if (
|
||||
!item ||
|
||||
item.documentName !== "Item" ||
|
||||
!["item", "armor", "weapon", "technique", "peculiarity", "advancement"].includes(item.data.type)
|
||||
![
|
||||
"item",
|
||||
"armor",
|
||||
"weapon",
|
||||
"technique",
|
||||
"peculiarity",
|
||||
"advancement",
|
||||
"title",
|
||||
"bond",
|
||||
"signature_scroll",
|
||||
"item_pattern",
|
||||
].includes(item.data.type)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
@@ -166,7 +174,7 @@ export class BaseSheetL5r5e extends ActorSheet {
|
||||
// Dropped a item with same "id" as one owned, add qte instead
|
||||
if (item.data.data.quantity && this.actor.data.items) {
|
||||
const tmpItem = this.actor.data.items.find((e) => e.name === item.name && e.type === item.type);
|
||||
if (tmpItem && this._modifyQuantity(tmpItem._id, 1)) {
|
||||
if (tmpItem && this._modifyQuantity(tmpItem.id, 1)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -174,6 +182,7 @@ export class BaseSheetL5r5e extends ActorSheet {
|
||||
// Item subtype specific
|
||||
switch (item.data.type) {
|
||||
case "advancement": // no break
|
||||
case "bond": // no break
|
||||
case "peculiarity":
|
||||
// Modify the bought at rank to the current actor rank
|
||||
if (this.actor.data.data.identity?.school_rank) {
|
||||
@@ -183,7 +192,7 @@ export class BaseSheetL5r5e extends ActorSheet {
|
||||
|
||||
case "technique":
|
||||
// School_ability and mastery_ability, allow only 1 per type
|
||||
if (CONFIG.l5r5e.techniques_school.includes(item.data.data.technique_type)) {
|
||||
if (CONFIG.l5r5e.techniques.get(item.data.data.technique_type)?.type === "school") {
|
||||
if (
|
||||
Array.from(this.actor.items).some(
|
||||
(e) =>
|
||||
@@ -316,12 +325,16 @@ export class BaseSheetL5r5e extends ActorSheet {
|
||||
|
||||
const type = $(event.currentTarget).data("item-type");
|
||||
const titles = {
|
||||
item: "l5r5e.items.title_new",
|
||||
armor: "l5r5e.armors.title_new",
|
||||
weapon: "l5r5e.weapons.title_new",
|
||||
technique: "l5r5e.techniques.title_new",
|
||||
peculiarity: "l5r5e.peculiarities.title_new",
|
||||
advancement: "l5r5e.advancements.title_new",
|
||||
item: "ITEM.TypeItem",
|
||||
armor: "ITEM.TypeArmor",
|
||||
weapon: "ITEM.TypeWeapon",
|
||||
technique: "ITEM.TypeTechnique",
|
||||
peculiarity: "ITEM.TypePeculiarity",
|
||||
advancement: "ITEM.TypeAdvancement",
|
||||
title: "ITEM.TypeTitle",
|
||||
bond: "ITEM.TypeBond",
|
||||
item_pattern: "ITEM.TypeItem_pattern",
|
||||
signature_scroll: "ITEM.TypeSignature_scroll",
|
||||
};
|
||||
const created = await this.actor.createEmbeddedDocuments("Item", [
|
||||
{
|
||||
@@ -333,9 +346,11 @@ export class BaseSheetL5r5e extends ActorSheet {
|
||||
const item = this.actor.items.get(created[0].id);
|
||||
|
||||
// assign current school rank to the new adv/tech
|
||||
if (this.actor.data.data.identity?.school_rank && ["advancement", "technique"].includes(item.data.type)) {
|
||||
item.data.data.rank = this.actor.data.data.identity.school_rank;
|
||||
if (this.actor.data.data.identity?.school_rank) {
|
||||
item.data.data.bought_at_rank = this.actor.data.data.identity.school_rank;
|
||||
if (["advancement", "technique"].includes(item.data.type)) {
|
||||
item.data.data.rank = this.actor.data.data.identity.school_rank;
|
||||
}
|
||||
}
|
||||
|
||||
switch (item.data.type) {
|
||||
@@ -349,13 +364,7 @@ export class BaseSheetL5r5e extends ActorSheet {
|
||||
case "technique": {
|
||||
// If technique, select the current type
|
||||
const techType = $(event.currentTarget).data("tech-type");
|
||||
if (
|
||||
[
|
||||
...CONFIG.l5r5e.techniques,
|
||||
...CONFIG.l5r5e.techniques_school,
|
||||
...CONFIG.l5r5e.techniques_custom,
|
||||
].includes(techType)
|
||||
) {
|
||||
if (CONFIG.l5r5e.techniques.get(techType)) {
|
||||
item.data.data.technique_type = techType;
|
||||
item.data.img = `${CONFIG.l5r5e.paths.assets}icons/techs/${techType}.svg`;
|
||||
}
|
||||
@@ -393,7 +402,7 @@ export class BaseSheetL5r5e extends ActorSheet {
|
||||
|
||||
// Remove 1 qty if possible
|
||||
const tmpItem = this.actor.items.get(itemId);
|
||||
if (tmpItem && tmpItem.data.data.quantity > 1 && this._modifyQuantity(tmpItem._id, -1)) {
|
||||
if (tmpItem && tmpItem.data.data.quantity > 1 && this._modifyQuantity(tmpItem.id, -1)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,8 +49,16 @@ export class CharacterSheetL5r5e extends BaseSheetL5r5e {
|
||||
// Split Money
|
||||
sheetData.data.data.money = this._zeniToMoney(this.actor.data.data.zeni);
|
||||
|
||||
// split advancements list by rank, and calculate xp spent
|
||||
this._prepareAdvancement(sheetData);
|
||||
// Split school advancements by rank, and calculate xp spent
|
||||
this._prepareSchoolAdvancement(sheetData);
|
||||
|
||||
// Titles
|
||||
this._prepareTitles(sheetData);
|
||||
|
||||
// Others
|
||||
this._prepareOthersAdvancement(sheetData);
|
||||
|
||||
// Total
|
||||
sheetData.data.data.xp_saved = Math.floor(
|
||||
parseInt(sheetData.data.data.xp_total) - parseInt(sheetData.data.data.xp_spent)
|
||||
);
|
||||
@@ -98,39 +106,56 @@ export class CharacterSheetL5r5e extends BaseSheetL5r5e {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the total xp spent and the current total xp spent for this rank
|
||||
* Prepare Titles, and get xp spend
|
||||
*/
|
||||
_prepareAdvancement(sheetData) {
|
||||
_prepareTitles(sheetData) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
/**
|
||||
* Split the school advancement, calculate the total xp spent and the current total xp spent by rank
|
||||
*/
|
||||
_prepareSchoolAdvancement(sheetData) {
|
||||
const adv = [];
|
||||
sheetData.data.data.xp_spent = 0;
|
||||
sheetData.items.forEach((item) => {
|
||||
if (!["peculiarity", "technique", "advancement"].includes(item.type)) {
|
||||
return;
|
||||
}
|
||||
sheetData.items
|
||||
.filter((item) => ["peculiarity", "technique", "advancement"].includes(item.type))
|
||||
.forEach((item) => {
|
||||
let xp = parseInt(item.data.xp_used) || 0;
|
||||
sheetData.data.data.xp_spent = parseInt(sheetData.data.data.xp_spent) + xp;
|
||||
|
||||
let xp = parseInt(item.data.xp_used) || 0;
|
||||
sheetData.data.data.xp_spent = parseInt(sheetData.data.data.xp_spent) + xp;
|
||||
// if not in curriculum, xp spent /2 for this item
|
||||
if (!item.data.in_curriculum && xp > 0) {
|
||||
xp = Math.ceil(xp / 2);
|
||||
}
|
||||
|
||||
// if not in curriculum, xp spent /2 for this item
|
||||
if (!item.data.in_curriculum && xp > 0) {
|
||||
xp = Math.ceil(xp / 2);
|
||||
}
|
||||
|
||||
const rank = Math.max(0, item.data.bought_at_rank);
|
||||
if (!adv[rank]) {
|
||||
adv[rank] = {
|
||||
rank: rank,
|
||||
spent: 0,
|
||||
goal: CONFIG.l5r5e.xp.costPerRank[rank] || null,
|
||||
list: [],
|
||||
};
|
||||
}
|
||||
adv[rank].list.push(item);
|
||||
adv[rank].spent = adv[rank].spent + xp;
|
||||
});
|
||||
const rank = Math.max(0, item.data.bought_at_rank);
|
||||
if (!adv[rank]) {
|
||||
adv[rank] = {
|
||||
rank: rank,
|
||||
spent: 0,
|
||||
goal: CONFIG.l5r5e.xp.costPerRank[rank] || null,
|
||||
list: [],
|
||||
};
|
||||
}
|
||||
adv[rank].list.push(item);
|
||||
adv[rank].spent = adv[rank].spent + xp;
|
||||
});
|
||||
sheetData.data.advancementsListByRank = adv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare Bonds, Item Pattern, Signature Scroll and get xp spend
|
||||
*/
|
||||
_prepareOthersAdvancement(sheetData) {
|
||||
sheetData.data.advancementsOthers = sheetData.items.filter((item) =>
|
||||
["bond", "item_pattern", "title", "signature_scroll"].includes(item.type)
|
||||
);
|
||||
|
||||
// Sort by rank desc
|
||||
// sheetData.data.bondsList.sort((a, b) => (b.data.rank || 0) - (a.data.rank || 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the actor.
|
||||
* @param event
|
||||
|
||||
@@ -142,7 +142,7 @@ export class TwentyQuestionsDialog extends FormApplication {
|
||||
skillsListStep7,
|
||||
skillsListStep17,
|
||||
noHonorSkillsList: ["commerce", "skulduggery", "medicine", "seafaring", "survival", "labor"],
|
||||
techniquesList: game.l5r5e.HelpersL5r5e.getTechniquesList(),
|
||||
techniquesList: game.l5r5e.HelpersL5r5e.getTechniquesList({ displayInTypes: true }),
|
||||
data: this.object.data,
|
||||
cache: this.cache,
|
||||
summary: {
|
||||
|
||||
@@ -7,12 +7,29 @@ L5R5E.paths = {
|
||||
|
||||
L5R5E.money = [50, 10];
|
||||
L5R5E.stances = ["earth", "air", "water", "fire", "void"];
|
||||
L5R5E.techniques = ["kata", "kiho", "inversion", "invocation", "ritual", "shuji", "maho", "ninjutsu"];
|
||||
L5R5E.techniques_custom = ["specificity"];
|
||||
L5R5E.techniques_school = ["school_ability", "mastery_ability"];
|
||||
|
||||
// *** Techniques ***
|
||||
L5R5E.techniques = new Map();
|
||||
// Core
|
||||
L5R5E.techniques.set("kata", { type: "core", displayInTypes: true });
|
||||
L5R5E.techniques.set("kiho", { type: "core", displayInTypes: true });
|
||||
L5R5E.techniques.set("inversion", { type: "core", displayInTypes: true });
|
||||
L5R5E.techniques.set("invocation", { type: "core", displayInTypes: true });
|
||||
L5R5E.techniques.set("ritual", { type: "core", displayInTypes: true });
|
||||
L5R5E.techniques.set("shuji", { type: "core", displayInTypes: true });
|
||||
L5R5E.techniques.set("maho", { type: "core", displayInTypes: true });
|
||||
L5R5E.techniques.set("ninjutsu", { type: "core", displayInTypes: true });
|
||||
// School
|
||||
L5R5E.techniques.set("school_ability", { type: "school", displayInTypes: false });
|
||||
L5R5E.techniques.set("mastery_ability", { type: "school", displayInTypes: false });
|
||||
// Title
|
||||
L5R5E.techniques.set("title_ability", { type: "title", displayInTypes: false });
|
||||
// Custom
|
||||
L5R5E.techniques.set("specificity", { type: "custom", displayInTypes: false });
|
||||
|
||||
L5R5E.xp = {
|
||||
costPerRank: [0, 20, 24, 32, 44, 60],
|
||||
bondCostPerRank: [0, 3, 4, 6, 8, 10],
|
||||
ringCostMultiplier: 3,
|
||||
skillCostMultiplier: 2,
|
||||
techniqueCost: 3,
|
||||
|
||||
@@ -5,7 +5,7 @@ import { L5rBaseDie } from "./l5r-base-die.js";
|
||||
*/
|
||||
export class AbilityDie extends L5rBaseDie {
|
||||
/** @override */
|
||||
static DENOMINATION = "ds";
|
||||
static DENOMINATION = "s";
|
||||
|
||||
static FACES = {
|
||||
1: { success: 0, explosive: 0, opportunity: 0, strife: 0, image: "skill_blank" },
|
||||
|
||||
@@ -22,20 +22,33 @@ export class L5rBaseDie extends DiceTerm {
|
||||
return this.l5r5e.success + this.l5r5e.explosive;
|
||||
}
|
||||
|
||||
/**
|
||||
* A string representation of the formula expression for this RollTerm, prior to evaluation.
|
||||
* @type {string}
|
||||
* @override
|
||||
*/
|
||||
get expression() {
|
||||
return `${this.number}d${this.constructor.DENOMINATION}${this.modifiers.join("")}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a standardized representation for the displayed formula associated with this DiceTerm
|
||||
* @override
|
||||
*/
|
||||
get formula() {
|
||||
return `${this.number}${this.constructor.DENOMINATION}${this.modifiers.join("")}`;
|
||||
// No flavor
|
||||
return this.expression;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the full img string used as the label for each rolled result
|
||||
* @override
|
||||
* Return a string used as the label for each rolled result
|
||||
* @param {DiceTermResult} result The rolled result
|
||||
* @return {string} The result label
|
||||
*/
|
||||
static getResultLabel(result) {
|
||||
return `<img src="${CONFIG.l5r5e.paths.assets}dices/default/${this.FACES[result].image}.svg" alt="${result}" />`;
|
||||
getResultLabel(result) {
|
||||
return `<img src="${CONFIG.l5r5e.paths.assets}dices/default/${
|
||||
this.constructor.FACES[result.result].image
|
||||
}.svg" alt="${result.result}" />`;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,7 @@ import { L5rBaseDie } from "./l5r-base-die.js";
|
||||
*/
|
||||
export class RingDie extends L5rBaseDie {
|
||||
/** @override */
|
||||
static DENOMINATION = "dr";
|
||||
static DENOMINATION = "r";
|
||||
|
||||
static FACES = {
|
||||
1: { success: 0, explosive: 0, opportunity: 0, strife: 0, image: "ring_blank" },
|
||||
|
||||
@@ -5,8 +5,8 @@ export class RollL5r5e extends Roll {
|
||||
static CHAT_TEMPLATE = "dice/chat-roll.html";
|
||||
static TOOLTIP_TEMPLATE = "dice/tooltip.html";
|
||||
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
constructor(formula, data = {}, options = {}) {
|
||||
super(formula, data, options);
|
||||
|
||||
this.l5r5e = {
|
||||
stance: "",
|
||||
@@ -37,7 +37,7 @@ export class RollL5r5e extends Roll {
|
||||
};
|
||||
|
||||
// Parse flavor for stance and skillId
|
||||
const flavors = Array.from(args[0].matchAll(/\d+d(s|r)\[([^\]]+)\]/gmu));
|
||||
const flavors = Array.from(formula.matchAll(/\d+d(s|r)\[([^\]]+)\]/gmu));
|
||||
flavors.forEach((res) => {
|
||||
if (res[1] === "r" && !!res[2] && this.l5r5e.stance === "") {
|
||||
this.l5r5e.stance = res[2];
|
||||
@@ -160,6 +160,8 @@ export class RollL5r5e extends Roll {
|
||||
* @override
|
||||
*/
|
||||
get total() {
|
||||
//return 0; // todo Bug : Si 0 tout le temps -> pas de pb pour le chat. mais plus d'inline :'(
|
||||
|
||||
if (!this._evaluated) {
|
||||
return null;
|
||||
}
|
||||
@@ -205,7 +207,7 @@ export class RollL5r5e extends Roll {
|
||||
display: !isL5rDie || contexte?.from !== "render",
|
||||
rolls: term.results.map((r) => {
|
||||
return {
|
||||
result: cls.getResultLabel(r.result),
|
||||
result: term.getResultLabel(r),
|
||||
classes: [
|
||||
cls.name.toLowerCase(),
|
||||
"d" + term.faces,
|
||||
@@ -273,7 +275,7 @@ export class RollL5r5e extends Roll {
|
||||
diceTypeL5r: isL5rDie,
|
||||
rolls: term.results.map((r) => {
|
||||
return {
|
||||
result: term.constructor.getResultLabel(r.result),
|
||||
result: term.getResultLabel(r),
|
||||
classes: [
|
||||
isL5rDie && r.swapped ? "swapped" : null,
|
||||
r.rerolled ? "rerolled" : null,
|
||||
@@ -292,6 +294,14 @@ export class RollL5r5e extends Roll {
|
||||
return renderTemplate(chatOptions.template, chatData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the HTML for the ChatMessage which should be added to the log
|
||||
* @return {Promise<jQuery>}
|
||||
*/
|
||||
async getHTML() {
|
||||
console.log(" --------- getHTML");
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform a Roll instance into a ChatMessage, displaying the roll result.
|
||||
* This function can either create the ChatMessage directly, or return the data object that will be used to create.
|
||||
|
||||
@@ -43,12 +43,23 @@ export class HelpersL5r5e {
|
||||
|
||||
/**
|
||||
* Get Techniques for List / Select
|
||||
* @param types core|school|title|custom
|
||||
* @param displayInTypes null|true|false
|
||||
* @returns {{displayInTypes: boolean|*, id: any, label: *, type: *}[]}
|
||||
*/
|
||||
static getTechniquesList() {
|
||||
return CONFIG.l5r5e.techniques.map((e) => ({
|
||||
id: e,
|
||||
label: game.i18n.localize(`l5r5e.techniques.${e}`),
|
||||
}));
|
||||
static getTechniquesList({ types = [], displayInTypes = null }) {
|
||||
return Array.from(CONFIG.l5r5e.techniques)
|
||||
.filter(
|
||||
([id, cfg]) =>
|
||||
(types.length === 0 || types.includes(cfg.type)) &&
|
||||
(displayInTypes === null || cfg.displayInTypes === displayInTypes)
|
||||
)
|
||||
.map(([id, cfg]) => ({
|
||||
id,
|
||||
label: game.i18n.localize(`l5r5e.techniques.${id}`),
|
||||
type: cfg.type,
|
||||
displayInTypes: cfg.displayInTypes,
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -128,7 +139,20 @@ export class HelpersL5r5e {
|
||||
* Make a temporary item for compendium drag n drop
|
||||
*/
|
||||
static async createItemFromCompendium(data) {
|
||||
if (!["item", "armor", "weapon", "technique", "peculiarity", "property"].includes(data.type)) {
|
||||
if (
|
||||
![
|
||||
"item",
|
||||
"armor",
|
||||
"weapon",
|
||||
"technique",
|
||||
"peculiarity",
|
||||
"property",
|
||||
"title",
|
||||
"bond",
|
||||
"signature_scroll",
|
||||
"item_pattern",
|
||||
].includes(data.type)
|
||||
) {
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -177,7 +201,7 @@ export class HelpersL5r5e {
|
||||
`<i class="${cfg.class}" title="${game.i18n.localize(cfg.label)}"></i>`
|
||||
);
|
||||
} else {
|
||||
text = text.replace(new RegExp(`<i class="${cfg.class}" title="[^"]*"></i>`, "gi"), tag);
|
||||
text = text.replace(new RegExp(`<i class="${cfg.class}" title(="[^"]*")?></i>`, "gi"), tag);
|
||||
}
|
||||
});
|
||||
return text;
|
||||
@@ -209,6 +233,10 @@ export class HelpersL5r5e {
|
||||
core.set("Ite", "l5r5e.core-items");
|
||||
core.set("Arm", "l5r5e.core-armors");
|
||||
core.set("Wea", "l5r5e.core-weapons");
|
||||
core.set("Bon", "l5r5e.core-bonds");
|
||||
core.set("Tit", "l5r5e.core-titles");
|
||||
core.set("Itp", "l5r5e.core-item-patterns");
|
||||
core.set("Sig", "l5r5e.core-signature-scrolls");
|
||||
core.set("Dis", "l5r5e.core-peculiarities-distinctions");
|
||||
core.set("Pas", "l5r5e.core-peculiarities-passions");
|
||||
core.set("Adv", "l5r5e.core-peculiarities-adversities");
|
||||
|
||||
@@ -20,12 +20,15 @@ export default class HooksL5r5e {
|
||||
/**
|
||||
* Do anything once the system is ready
|
||||
*/
|
||||
static ready() {
|
||||
static async ready() {
|
||||
// Migration stuff
|
||||
if (game.l5r5e.migrations.needUpdate()) {
|
||||
game.l5r5e.migrations.migrateWorld();
|
||||
}
|
||||
|
||||
// For some reasons, not always really ready, so wait a little
|
||||
await new Promise((r) => setTimeout(r, 500));
|
||||
|
||||
// Settings TN and EncounterType
|
||||
if (game.user.isGM) {
|
||||
new game.l5r5e.GmToolsDialog().render(true);
|
||||
@@ -40,9 +43,10 @@ export default class HooksL5r5e {
|
||||
.on("click", () => new game.l5r5e.HelpDialog().render(true))
|
||||
.prop("title", game.i18n.localize("l5r5e.logo.alt"));
|
||||
|
||||
// Spanish specific - Disclaimer "not translated by Edge"
|
||||
if (game.i18n.lang === "es") {
|
||||
ui.notifications.info(game.i18n.localize("l5r5e.global.edge_translation_disclaimer"));
|
||||
// If any disclaimer "not translated by Edge"
|
||||
const disclaimer = game.i18n.localize("l5r5e.global.edge_translation_disclaimer");
|
||||
if (disclaimer !== "l5r5e.global.edge_translation_disclaimer") {
|
||||
ui.notifications.info(disclaimer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ export class AdvancementSheetL5r5e extends ItemSheetL5r5e {
|
||||
});
|
||||
}
|
||||
|
||||
async getData() {
|
||||
const sheetData = await super.getData();
|
||||
async getData(options = {}) {
|
||||
const sheetData = await super.getData(options);
|
||||
|
||||
sheetData.data.subTypesList = AdvancementSheetL5r5e.types;
|
||||
sheetData.data.skillsList = game.l5r5e.HelpersL5r5e.getSkillsList(true);
|
||||
@@ -47,46 +47,18 @@ export class AdvancementSheetL5r5e extends ItemSheetL5r5e {
|
||||
|
||||
html.find("#advancement_type").on("change", (event) => {
|
||||
if ($(event.target).val() === "skill") {
|
||||
this._updateChoice(
|
||||
{
|
||||
ring: currentRing,
|
||||
},
|
||||
{
|
||||
skill: currentSkill,
|
||||
}
|
||||
);
|
||||
this._updateChoice({ ring: currentRing }, { skill: currentSkill });
|
||||
} else {
|
||||
this._updateChoice(
|
||||
{
|
||||
skill: currentSkill,
|
||||
},
|
||||
{
|
||||
ring: currentRing,
|
||||
}
|
||||
);
|
||||
this._updateChoice({ skill: currentSkill }, { ring: currentRing });
|
||||
}
|
||||
});
|
||||
|
||||
html.find("#advancement_ring").on("change", (event) => {
|
||||
this._updateChoice(
|
||||
{
|
||||
ring: currentRing,
|
||||
},
|
||||
{
|
||||
ring: $(event.target).val(),
|
||||
}
|
||||
);
|
||||
this._updateChoice({ ring: currentRing }, { ring: $(event.target).val() });
|
||||
});
|
||||
|
||||
html.find("#advancement_skill").on("change", (event) => {
|
||||
this._updateChoice(
|
||||
{
|
||||
skill: currentSkill,
|
||||
},
|
||||
{
|
||||
skill: $(event.target).val(),
|
||||
}
|
||||
);
|
||||
this._updateChoice({ skill: currentSkill }, { skill: $(event.target).val() });
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
17
system/scripts/items/bond-sheet.js
Normal file
17
system/scripts/items/bond-sheet.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import { ItemSheetL5r5e } from "./item-sheet.js";
|
||||
|
||||
/**
|
||||
* @extends {ItemSheet}
|
||||
*/
|
||||
export class BondSheetL5r5e extends ItemSheetL5r5e {
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
classes: ["l5r5e", "sheet", "bond"],
|
||||
template: CONFIG.l5r5e.paths.templates + "items/bond/bond-sheet.html",
|
||||
width: 520,
|
||||
height: 480,
|
||||
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description" }],
|
||||
});
|
||||
}
|
||||
}
|
||||
17
system/scripts/items/item-pattern-sheet.js
Normal file
17
system/scripts/items/item-pattern-sheet.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import { ItemSheetL5r5e } from "./item-sheet.js";
|
||||
|
||||
/**
|
||||
* @extends {ItemSheet}
|
||||
*/
|
||||
export class ItemPatternSheetL5r5e extends ItemSheetL5r5e {
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
classes: ["l5r5e", "sheet", "item-pattern"],
|
||||
template: CONFIG.l5r5e.paths.templates + "items/item-pattern/item-pattern-sheet.html",
|
||||
width: 520,
|
||||
height: 480,
|
||||
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description" }],
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -14,13 +14,14 @@ export class ItemSheetL5r5e extends ItemSheet {
|
||||
});
|
||||
}
|
||||
|
||||
/** @override */
|
||||
/**
|
||||
* @return {Object|Promise}
|
||||
*/
|
||||
async getData(options = {}) {
|
||||
const sheetData = super.getData();
|
||||
const sheetData = await super.getData(options);
|
||||
|
||||
sheetData.data.dtypes = ["String", "Number", "Boolean"];
|
||||
sheetData.data.ringsList = game.l5r5e.HelpersL5r5e.getRingsList();
|
||||
sheetData.data.techniquesList = game.l5r5e.HelpersL5r5e.getTechniquesList();
|
||||
|
||||
// Prepare Properties (id/name => object)
|
||||
await this._prepareProperties(sheetData);
|
||||
|
||||
@@ -21,8 +21,8 @@ export class PeculiaritySheetL5r5e extends ItemSheetL5r5e {
|
||||
});
|
||||
}
|
||||
|
||||
async getData() {
|
||||
const sheetData = await super.getData();
|
||||
async getData(options = {}) {
|
||||
const sheetData = await super.getData(options);
|
||||
|
||||
sheetData.data.subTypesList = PeculiaritySheetL5r5e.types.map((e) => ({
|
||||
id: e,
|
||||
|
||||
17
system/scripts/items/signature-scroll-sheet.js
Normal file
17
system/scripts/items/signature-scroll-sheet.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import { ItemSheetL5r5e } from "./item-sheet.js";
|
||||
|
||||
/**
|
||||
* @extends {ItemSheet}
|
||||
*/
|
||||
export class SignatureScrollSheetL5r5e extends ItemSheetL5r5e {
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
classes: ["l5r5e", "sheet", "signature-scroll"],
|
||||
template: CONFIG.l5r5e.paths.templates + "items/signature-scroll/signature-scroll-sheet.html",
|
||||
width: 520,
|
||||
height: 480,
|
||||
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description" }],
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -16,19 +16,15 @@ export class TechniqueSheetL5r5e extends ItemSheetL5r5e {
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async getData() {
|
||||
const sheetData = await super.getData();
|
||||
async getData(options = {}) {
|
||||
const sheetData = await super.getData(options);
|
||||
|
||||
// Add "school ability", "mastery ability" and customs if active
|
||||
[
|
||||
...CONFIG.l5r5e.techniques_school,
|
||||
...(game.settings.get("l5r5e", "techniques-customs") ? CONFIG.l5r5e.techniques_custom : []),
|
||||
].forEach((e) => {
|
||||
sheetData.data.techniquesList.push({
|
||||
id: e,
|
||||
label: game.i18n.localize(`l5r5e.techniques.${e}`),
|
||||
});
|
||||
});
|
||||
// List all available techniques type
|
||||
const types = ["core", "school", "title"];
|
||||
if (game.settings.get("l5r5e", "techniques-customs")) {
|
||||
types.push("custom");
|
||||
}
|
||||
sheetData.data.techniquesList = game.l5r5e.HelpersL5r5e.getTechniquesList({ types });
|
||||
|
||||
return sheetData;
|
||||
}
|
||||
|
||||
17
system/scripts/items/title-sheet.js
Normal file
17
system/scripts/items/title-sheet.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import { ItemSheetL5r5e } from "./item-sheet.js";
|
||||
|
||||
/**
|
||||
* @extends {ItemSheet}
|
||||
*/
|
||||
export class TitleSheetL5r5e extends ItemSheetL5r5e {
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
classes: ["l5r5e", "sheet", "title"],
|
||||
template: CONFIG.l5r5e.paths.templates + "items/title/title-sheet.html",
|
||||
width: 520,
|
||||
height: 480,
|
||||
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description" }],
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -15,8 +15,8 @@ export class WeaponSheetL5r5e extends ItemSheetL5r5e {
|
||||
});
|
||||
}
|
||||
|
||||
async getData() {
|
||||
const sheetData = await super.getData();
|
||||
async getData(options = {}) {
|
||||
const sheetData = await super.getData(options);
|
||||
|
||||
// Martial skills only
|
||||
sheetData.data.skills = Array.from(CONFIG.l5r5e.skills)
|
||||
|
||||
@@ -29,6 +29,10 @@ import { TechniqueSheetL5r5e } from "./items/technique-sheet.js";
|
||||
import { PropertySheetL5r5e } from "./items/property-sheet.js";
|
||||
import { AdvancementSheetL5r5e } from "./items/advancement-sheet.js";
|
||||
import { PeculiaritySheetL5r5e } from "./items/peculiarity-sheet.js";
|
||||
import { TitleSheetL5r5e } from "./items/title-sheet.js";
|
||||
import { BondSheetL5r5e } from "./items/bond-sheet.js";
|
||||
import { SignatureScrollSheetL5r5e } from "./items/signature-scroll-sheet.js";
|
||||
import { ItemPatternSheetL5r5e } from "./items/item-pattern-sheet.js";
|
||||
// JournalEntry
|
||||
import { JournalL5r5e } from "./journal.js";
|
||||
import { BaseJournalSheetL5r5e } from "./journals/base-journal-sheet.js";
|
||||
@@ -62,12 +66,11 @@ Hooks.once("init", async () => {
|
||||
CONFIG.JournalEntry.sheetClass = BaseJournalSheetL5r5e;
|
||||
|
||||
// Define custom Roll class
|
||||
CONFIG.Dice.rolls.push(CONFIG.Dice.rolls[0]);
|
||||
CONFIG.Dice.rolls[0] = RollL5r5e;
|
||||
CONFIG.Dice.rolls.unshift(RollL5r5e);
|
||||
|
||||
// Define DiceTerms
|
||||
CONFIG.Dice.terms["s"] = AbilityDie;
|
||||
CONFIG.Dice.terms["r"] = RingDie;
|
||||
CONFIG.Dice.terms[AbilityDie.DENOMINATION] = AbilityDie;
|
||||
CONFIG.Dice.terms[RingDie.DENOMINATION] = RingDie;
|
||||
|
||||
// Add some classes in game
|
||||
game.l5r5e = {
|
||||
@@ -109,6 +112,10 @@ Hooks.once("init", async () => {
|
||||
Items.registerSheet("l5r5e", PropertySheetL5r5e, { types: ["property"], makeDefault: true });
|
||||
Items.registerSheet("l5r5e", PeculiaritySheetL5r5e, { types: ["peculiarity"], makeDefault: true });
|
||||
Items.registerSheet("l5r5e", AdvancementSheetL5r5e, { types: ["advancement"], makeDefault: true });
|
||||
Items.registerSheet("l5r5e", TitleSheetL5r5e, { types: ["title"], makeDefault: true });
|
||||
Items.registerSheet("l5r5e", BondSheetL5r5e, { types: ["bond"], makeDefault: true });
|
||||
Items.registerSheet("l5r5e", SignatureScrollSheetL5r5e, { types: ["signature_scroll"], makeDefault: true });
|
||||
Items.registerSheet("l5r5e", ItemPatternSheetL5r5e, { types: ["item_pattern"], makeDefault: true });
|
||||
|
||||
// Journal
|
||||
Items.unregisterSheet("core", JournalSheet);
|
||||
|
||||
@@ -1,49 +1,56 @@
|
||||
export const PreloadTemplates = async function () {
|
||||
const templatePaths = [
|
||||
// Add paths to "systems/l5r5e/templates"
|
||||
// actors
|
||||
"systems/l5r5e/templates/actors/character/rings.html",
|
||||
"systems/l5r5e/templates/actors/character/narrative.html",
|
||||
"systems/l5r5e/templates/actors/character/identity.html",
|
||||
// *** Actors : PC ***
|
||||
"systems/l5r5e/templates/actors/character/advancement-school.html",
|
||||
"systems/l5r5e/templates/actors/character/advancement-others.html",
|
||||
"systems/l5r5e/templates/actors/character/attributes.html",
|
||||
"systems/l5r5e/templates/actors/character/category.html",
|
||||
"systems/l5r5e/templates/actors/character/conflict.html",
|
||||
"systems/l5r5e/templates/actors/character/experience.html",
|
||||
"systems/l5r5e/templates/actors/character/identity.html",
|
||||
"systems/l5r5e/templates/actors/character/narrative.html",
|
||||
"systems/l5r5e/templates/actors/character/rings.html",
|
||||
"systems/l5r5e/templates/actors/character/skill.html",
|
||||
"systems/l5r5e/templates/actors/character/social.html",
|
||||
"systems/l5r5e/templates/actors/character/attributes.html",
|
||||
"systems/l5r5e/templates/actors/character/conflict.html",
|
||||
"systems/l5r5e/templates/actors/character/stance.html",
|
||||
"systems/l5r5e/templates/actors/character/techniques.html",
|
||||
"systems/l5r5e/templates/actors/character/experience.html",
|
||||
"systems/l5r5e/templates/actors/character/advancement.html",
|
||||
"systems/l5r5e/templates/actors/character/twenty-questions-item.html",
|
||||
// npc
|
||||
"systems/l5r5e/templates/actors/npc/identity.html",
|
||||
"systems/l5r5e/templates/actors/npc/narrative.html",
|
||||
"systems/l5r5e/templates/actors/npc/social.html",
|
||||
"systems/l5r5e/templates/actors/npc/rings.html",
|
||||
// *** Actors : Npc ***
|
||||
"systems/l5r5e/templates/actors/npc/attributes.html",
|
||||
"systems/l5r5e/templates/actors/npc/conflict.html",
|
||||
"systems/l5r5e/templates/actors/npc/identity.html",
|
||||
"systems/l5r5e/templates/actors/npc/narrative.html",
|
||||
"systems/l5r5e/templates/actors/npc/rings.html",
|
||||
"systems/l5r5e/templates/actors/npc/social.html",
|
||||
"systems/l5r5e/templates/actors/npc/skill.html",
|
||||
"systems/l5r5e/templates/actors/npc/techniques.html",
|
||||
// items
|
||||
"systems/l5r5e/templates/items/advancement/advancements.html",
|
||||
// *** Items ***
|
||||
"systems/l5r5e/templates/items/advancement/advancement-entry.html",
|
||||
"systems/l5r5e/templates/items/advancement/advancement-sheet.html",
|
||||
"systems/l5r5e/templates/items/armor/armors.html",
|
||||
"systems/l5r5e/templates/items/armor/armor-entry.html",
|
||||
"systems/l5r5e/templates/items/armor/armor-sheet.html",
|
||||
"systems/l5r5e/templates/items/bond/bond-entry.html",
|
||||
"systems/l5r5e/templates/items/bond/bond-sheet.html",
|
||||
"systems/l5r5e/templates/items/item/items.html",
|
||||
"systems/l5r5e/templates/items/item/item-entry.html",
|
||||
"systems/l5r5e/templates/items/item/item-value.html",
|
||||
"systems/l5r5e/templates/items/item/item-sheet.html",
|
||||
"systems/l5r5e/templates/items/item/item-infos.html",
|
||||
"systems/l5r5e/templates/items/peculiarity/peculiarities.html",
|
||||
"systems/l5r5e/templates/items/item-pattern/item-pattern-entry.html",
|
||||
"systems/l5r5e/templates/items/item-pattern/item-pattern-sheet.html",
|
||||
"systems/l5r5e/templates/items/peculiarity/peculiarity-entry.html",
|
||||
"systems/l5r5e/templates/items/peculiarity/peculiarity-sheet.html",
|
||||
"systems/l5r5e/templates/items/property/properties.html",
|
||||
"systems/l5r5e/templates/items/property/property-entry.html",
|
||||
"systems/l5r5e/templates/items/property/property-sheet.html",
|
||||
"systems/l5r5e/templates/items/signature-scroll/signature-scroll-entry.html",
|
||||
"systems/l5r5e/templates/items/signature-scroll/signature-scroll-sheet.html",
|
||||
"systems/l5r5e/templates/items/technique/technique-entry.html",
|
||||
"systems/l5r5e/templates/items/technique/technique-sheet.html",
|
||||
"systems/l5r5e/templates/items/title/title-entry.html",
|
||||
"systems/l5r5e/templates/items/title/title-sheet.html",
|
||||
"systems/l5r5e/templates/items/weapon/weapons.html",
|
||||
"systems/l5r5e/templates/items/weapon/weapon-entry.html",
|
||||
"systems/l5r5e/templates/items/weapon/weapon-sheet.html",
|
||||
|
||||
Reference in New Issue
Block a user