ENhance and fix

This commit is contained in:
2026-05-10 23:12:21 +02:00
parent e200b5f7b0
commit 7542890232
43 changed files with 638 additions and 390 deletions
+36 -7
View File
@@ -92,11 +92,8 @@ export class CharacterSheetL5r5e extends BaseCharacterSheetL5r5e {
gaugeColor: gauge > 0 ? "#d4a855" : gauge < 0 ? "#5588aa" : "#888888",
};
// Chiaroscuro: État items active on the character
sheetData.data.etatItems = sheetData.items.filter((i) => i.type === "etat");
// Chiaroscuro: Invocations split by type (from splitTechniquesList)
const invocations = sheetData.data.splitTechniquesList["mot_invocation"] ?? [];
// Chiaroscuro: Invocations split by type (direct from items)
const invocations = sheetData.items.filter((i) => i.type === "mot_invocation");
sheetData.data.splitInvocationsList = {
general: invocations.filter((t) => !t.system.invocation_type || t.system.invocation_type === "general"),
neutre: invocations.filter((t) => t.system.invocation_type === "neutre"),
@@ -109,6 +106,9 @@ export class CharacterSheetL5r5e extends BaseCharacterSheetL5r5e {
// Chiaroscuro: Mystere items
sheetData.data.mystereItems = sheetData.items.filter((i) => i.type === "mystere");
// Chiaroscuro: Technique École items
sheetData.data.techniqueEcoleItems = sheetData.items.filter((i) => i.type === "technique_ecole");
// Chiaroscuro: Identity tabs enriched HTML
sheetData.data.enrichedHtml.identity_text1 = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
this.actor.system.identity_text1 ?? "", { async: true }
@@ -191,6 +191,34 @@ export class CharacterSheetL5r5e extends BaseCharacterSheetL5r5e {
.activate("advancement_rank_" + (this.actor.system.identity.school_rank || 0));
}
/**
* Override to handle mot_invocation creation with invocation_type from the column.
* @param {Event} event
* @override
*/
async _addSubItem(event) {
const type = $(event.currentTarget).data("item-type");
if (type === "mot_invocation") {
event.preventDefault();
event.stopPropagation();
const invocationType = $(event.currentTarget).data("invocation-type") || "general";
const created = await this.actor.createEmbeddedDocuments("Item", [
{
name: game.i18n.localize(`TYPES.Item.mot_invocation`),
type: "mot_invocation",
img: `${CONFIG.l5r5e.paths.assets}icons/items/mot_invocation.svg`,
system: { invocation_type: invocationType },
},
]);
if (created?.length > 0) {
const item = this.actor.items.get(created[0].id);
item?.sheet.render(true);
}
return;
}
return super._addSubItem(event);
}
/**
* Override base dice picker to open Chiaroscuro d6 dialog.
* @param {Event} event
@@ -198,9 +226,10 @@ export class CharacterSheetL5r5e extends BaseCharacterSheetL5r5e {
_openDicePickerForSkill(event) {
event.preventDefault();
const el = $(event.currentTarget);
const skillId = el.data("skill");
const weapon = this._getWeaponInfos(el.data("weapon-id") || null);
const skillId = weapon?.skill || el.data("skill");
const ringId = el.data("ring") || this.actor.system?.default_ring || "void";
new game.l5r5e.ChiaroscuroDiceDialog({ actor: this.actor, ringId, skillId }).render(true);
new game.l5r5e.ChiaroscuroDiceDialog({ actor: this.actor, ringId, skillId, itemUuid: weapon?.uuid }).render(true);
}
/**