From ea3064d7a2978b3afa0928e42ca5e01cbbc91398 Mon Sep 17 00:00:00 2001 From: LeRatierBretonnier Date: Sat, 28 Mar 2026 11:09:17 +0100 Subject: [PATCH] fix: tests complets - onglets, message de tchat, scores bonus/malus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Onglets item (Anomalie/Aspect/Attribut): correction tabGroups + data-group sur chaque et
- Onglets acteur (PJ/PNJ): tab.cssClass dans les templates pour l'état actif initial - Message de tchat: alignement des noms de variables _getChatCardData <-> chat-message.hbs - actorName, actorImg, success/failure, diceResults, statLabel/skillLabel localisés - difficultyLabel et moonPhaseLabel localisés depuis SYSTEM - Dialogue de jet (roll-dialog.hbs): correction noms variables + min/max modificateur - lang/fr.json: ajout Roll.title, Roll.roll, clés Moon (minuscules), Difficulty (unknown/ardu) - character.mjs: passage statLabel à CelestopolRoll.prompt() - global.less: padding + overflow-y sur .tab pour contenu visible - item-scores.hbs: passage system=system au partial + suppression garde isEditable - Templates anomaly/aspect/attribute: passage system=system au partial item-scores - chat-message.mjs: getHTML() → renderHTML() (dépréciation FVTT v13) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- lang/fr.json | 64 +++++++++++------- .../applications/sheets/base-item-sheet.mjs | 15 ++++ module/applications/sheets/npc-sheet.mjs | 1 + module/documents/chat-message.mjs | 5 +- module/documents/roll.mjs | 28 +++++--- module/models/character.mjs | 1 + packs-system/anomalies/000003.log | 0 packs-system/anomalies/CURRENT | 1 + packs-system/anomalies/LOCK | 0 packs-system/anomalies/LOG | 1 + packs-system/anomalies/MANIFEST-000002 | Bin 0 -> 50 bytes packs-system/aspects/000003.log | 0 packs-system/aspects/CURRENT | 1 + packs-system/aspects/LOCK | 0 packs-system/aspects/LOG | 1 + packs-system/aspects/MANIFEST-000002 | Bin 0 -> 50 bytes styles/character.less | 2 +- styles/global.less | 13 +++- styles/items.less | 4 +- styles/npc.less | 2 +- templates/anomaly.hbs | 18 ++--- templates/aspect.hbs | 14 ++-- templates/attribute.hbs | 14 ++-- templates/character-biography.hbs | 2 +- templates/character-blessures.hbs | 2 +- templates/character-competences.hbs | 2 +- templates/character-factions.hbs | 2 +- templates/character-main.hbs | 4 +- templates/chat-message.hbs | 2 +- templates/equipment.hbs | 4 +- templates/npc-blessures.hbs | 2 +- templates/npc-competences.hbs | 2 +- templates/npc-main.hbs | 4 +- templates/partials/item-scores.hbs | 14 ++-- templates/roll-dialog.hbs | 17 +++-- 35 files changed, 150 insertions(+), 92 deletions(-) create mode 100644 packs-system/anomalies/000003.log create mode 100644 packs-system/anomalies/CURRENT create mode 100644 packs-system/anomalies/LOCK create mode 100644 packs-system/anomalies/LOG create mode 100644 packs-system/anomalies/MANIFEST-000002 create mode 100644 packs-system/aspects/000003.log create mode 100644 packs-system/aspects/CURRENT create mode 100644 packs-system/aspects/LOCK create mode 100644 packs-system/aspects/LOG create mode 100644 packs-system/aspects/MANIFEST-000002 diff --git a/lang/fr.json b/lang/fr.json index 45ad040..893985a 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -1,4 +1,16 @@ { + "TYPES": { + "Actor": { + "character": "Personnage", + "npc": "PNJ" + }, + "Item": { + "anomaly": "Anomalie", + "aspect": "Aspect", + "attribute": "Attribut", + "equipment": "Équipement" + } + }, "CELESTOPOL": { "Actor": { "name": "Nom", @@ -36,14 +48,14 @@ "Anomaly": { "type": "Type d'anomalie", "none": "Aucune", - "charnel": "Charnel", - "mecanique": "Mécanique", - "spectral": "Spectral", - "onirique": "Onirique", - "telepath": "Télépathique", - "alchimique": "Alchimique", - "cosmique": "Cosmique", - "temporel": "Temporel" + "entropie": "Entropie", + "communicationaveclesmorts": "Communication avec les morts", + "illusion": "Illusion", + "suggestion": "Suggestion", + "tarotdivinatoire": "Tarot divinatoire", + "telekinesie": "Télékinésie", + "telepathie": "Télépathie", + "voyageastral": "Voyage astral" }, "Attribut": { "entregent": "Entregent", @@ -92,24 +104,28 @@ "criticalSuccess": "Succès critique !", "criticalFailure": "Échec critique !", "moonBonus": "Bonus de lune", + "title": "Jet de dés", + "roll": "Lancer !", "rollTitle": "Lancer les dés" }, "Moon": { - "nouvelleLune": "Nouvelle Lune", - "croissantDebutant": "Croissant débutant", - "croissantMontant": "Croissant montant", - "gibbeuseMontante": "Gibbeuse montante", - "pleineLune": "Pleine Lune", - "gibbeuseDecroissante": "Gibbeuse décroissante", - "croissantDecroissant": "Croissant décroissant", - "croissantFinissant": "Croissant finissant" + "none": "Aucune phase", + "nouvellelune": "Nouvelle Lune", + "premiercroissant": "Premier Croissant", + "premierquartier": "Premier Quartier", + "lunegibbeuse": "Lune Gibbeuse", + "lunevoutee": "Lune Voûtée", + "derniercroissant": "Dernier Croissant", + "dernierquartier": "Dernier Quartier", + "pleinelune": "Pleine Lune" }, "Difficulty": { + "unknown": "Aucun seuil", "facile": "Facile", "normal": "Normal", "difficile": "Difficile", - "extreme": "Extrême", - "impossible": "Impossible" + "ardu": "Ardu", + "extreme": "Extrême" }, "Item": { "anomalies": "Anomalies", @@ -134,13 +150,11 @@ "weight": "Poids" }, "Equipment": { - "type": { - "general": "Général", - "arme": "Arme", - "armure": "Armure", - "vehicule": "Véhicule", - "gadget": "Gadget" - } + "autre": "Autre", + "arme": "Arme", + "protection": "Protection / Armure", + "vehicule": "Véhicule", + "type": "Type d'équipement" }, "Sheet": { "editMode": "Mode édition", diff --git a/module/applications/sheets/base-item-sheet.mjs b/module/applications/sheets/base-item-sheet.mjs index f4c0cd5..fa62910 100644 --- a/module/applications/sheets/base-item-sheet.mjs +++ b/module/applications/sheets/base-item-sheet.mjs @@ -12,6 +12,9 @@ export default class CelestopolItemSheet extends HandlebarsApplicationMixin(foun }, } + /** Default tab group for item sheets */ + tabGroups = { "item-tabs": "description" } + /** @override */ async _prepareContext() { return { @@ -21,9 +24,21 @@ export default class CelestopolItemSheet extends HandlebarsApplicationMixin(foun system: this.document.system, source: this.document.toObject(), isEditable: this.isEditable, + activeTab: this.tabGroups["item-tabs"] ?? "description", } } + /** @override */ + _onRender(context, options) { + // Wire up tab navigation for inline item tabs + this.element.querySelectorAll('.item-tabs [data-tab]').forEach(tabEl => { + tabEl.addEventListener('click', () => { + const group = "item-tabs" + this.changeTab(tabEl.dataset.tab, group) + }) + }) + } + static async #onEditImage(event, target) { const attr = target.dataset.edit const current = foundry.utils.getProperty(this.document, attr) diff --git a/module/applications/sheets/npc-sheet.mjs b/module/applications/sheets/npc-sheet.mjs index b15e435..cf65591 100644 --- a/module/applications/sheets/npc-sheet.mjs +++ b/module/applications/sheets/npc-sheet.mjs @@ -37,6 +37,7 @@ export default class CelestopolNPCSheet extends CelestopolActorSheet { context.tabs = this.#getTabs() context.stats = SYSTEM.STATS context.skills = SYSTEM.SKILLS + context.anomalyTypes = SYSTEM.ANOMALY_TYPES context.woundLevels = SYSTEM.WOUND_LEVELS return context } diff --git a/module/documents/chat-message.mjs b/module/documents/chat-message.mjs index 5bae106..aa181a9 100644 --- a/module/documents/chat-message.mjs +++ b/module/documents/chat-message.mjs @@ -1,7 +1,6 @@ export default class CelestopolChatMessage extends ChatMessage { /** @override */ - async getHTML() { - const html = await super.getHTML() - return html + async renderHTML(options = {}) { + return super.renderHTML(options) } } diff --git a/module/documents/roll.mjs b/module/documents/roll.mjs index cab0c32..d1470bd 100644 --- a/module/documents/roll.mjs +++ b/module/documents/roll.mjs @@ -35,9 +35,11 @@ export class CelestopolRoll extends Roll { const dialogContext = { actorName: options.actorName, + statLabel: options.statLabel, skillLabel: options.skillLabel, skillValue: options.skillValue, woundMalus: options.woundMalus ?? 0, + nbDice: Math.max(1, options.skillValue ?? 1), difficultyChoices:SYSTEM.DIFFICULTY_CHOICES, moonPhaseChoices: SYSTEM.MOON_DICE_PHASES, defaultDifficulty:options.difficulty ?? "normal", @@ -135,25 +137,33 @@ export class CelestopolRoll extends Roll { } async _getChatCardData(isPrivate) { + const statLabel = this.options.statLabel + const skillLabel = this.options.skillLabel + const resultType = this.resultType + const diceResults = this.dice[0]?.results?.map(r => r.result) ?? [] + return { - css: [SYSTEM.id, "dice-roll"], cssClass: [SYSTEM.id, "dice-roll"].join(" "), actorId: this.actorId, - actingCharName: this.actorName, - actingCharImg: this.actorImage, - skillLabel: this.skillLabel, + actorName: this.actorName, + actorImg: this.actorImage, + statLabel: statLabel ? game.i18n.localize(statLabel) : "", + skillLabel: skillLabel ? game.i18n.localize(skillLabel) : "", formula: this.formula, total: this.total, - resultType: this.resultType, - isSuccess: this.isSuccess, - isFailure: this.isFailure, + resultType, + resultClass: resultType === "success" ? "success" : resultType === "failure" ? "failure" : "", + success: this.isSuccess, + failure: this.isFailure, difficulty: this.options.difficulty, - difficultyValue:this.options.difficultyValue, + difficultyLabel:game.i18n.localize(SYSTEM.DIFFICULTY_CHOICES[this.options.difficulty]?.label ?? ""), moonPhase: this.options.moonPhase, + moonPhaseLabel: game.i18n.localize(SYSTEM.MOON_DICE_PHASES[this.options.moonPhase]?.label ?? ""), moonBonus: this.moonBonus, + modifier: this.options.modifier, isPrivate, tooltip: isPrivate ? "" : await this.getTooltip(), - results: this.dice[0]?.results ?? [], + diceResults, } } diff --git a/module/models/character.mjs b/module/models/character.mjs index 4abe1e5..e23dfac 100644 --- a/module/models/character.mjs +++ b/module/models/character.mjs @@ -165,6 +165,7 @@ export default class CelestopolCharacter extends foundry.abstract.TypeDataModel actorImage: this.parent.img, statId, skillId, + statLabel: SYSTEM.STATS[statId]?.label, skillLabel: skill.label, skillValue: skill.value, woundMalus: this.getWoundMalus(), diff --git a/packs-system/anomalies/000003.log b/packs-system/anomalies/000003.log new file mode 100644 index 0000000..e69de29 diff --git a/packs-system/anomalies/CURRENT b/packs-system/anomalies/CURRENT new file mode 100644 index 0000000..1a84852 --- /dev/null +++ b/packs-system/anomalies/CURRENT @@ -0,0 +1 @@ +MANIFEST-000002 diff --git a/packs-system/anomalies/LOCK b/packs-system/anomalies/LOCK new file mode 100644 index 0000000..e69de29 diff --git a/packs-system/anomalies/LOG b/packs-system/anomalies/LOG new file mode 100644 index 0000000..ed6d6cc --- /dev/null +++ b/packs-system/anomalies/LOG @@ -0,0 +1 @@ +2026/03/28-09:47:34.669467 7f0018fff6c0 Delete type=3 #1 diff --git a/packs-system/anomalies/MANIFEST-000002 b/packs-system/anomalies/MANIFEST-000002 new file mode 100644 index 0000000000000000000000000000000000000000..bbbc585686bcbcc33686059c69d80b7b4e1291cd GIT binary patch literal 50 zcmWIhx#Ncn10$nUPHI_dPD+xVQ)NkNd1i5{bAE0?Vo_pAe$kRS-TOEg7@3$k8JJmE F7y#sj5K{mE literal 0 HcmV?d00001 diff --git a/packs-system/aspects/000003.log b/packs-system/aspects/000003.log new file mode 100644 index 0000000..e69de29 diff --git a/packs-system/aspects/CURRENT b/packs-system/aspects/CURRENT new file mode 100644 index 0000000..1a84852 --- /dev/null +++ b/packs-system/aspects/CURRENT @@ -0,0 +1 @@ +MANIFEST-000002 diff --git a/packs-system/aspects/LOCK b/packs-system/aspects/LOCK new file mode 100644 index 0000000..e69de29 diff --git a/packs-system/aspects/LOG b/packs-system/aspects/LOG new file mode 100644 index 0000000..25eefb2 --- /dev/null +++ b/packs-system/aspects/LOG @@ -0,0 +1 @@ +2026/03/28-09:47:34.653497 7effcaffd6c0 Delete type=3 #1 diff --git a/packs-system/aspects/MANIFEST-000002 b/packs-system/aspects/MANIFEST-000002 new file mode 100644 index 0000000000000000000000000000000000000000..bbbc585686bcbcc33686059c69d80b7b4e1291cd GIT binary patch literal 50 zcmWIhx#Ncn10$nUPHI_dPD+xVQ)NkNd1i5{bAE0?Vo_pAe$kRS-TOEg7@3$k8JJmE F7y#sj5K{mE literal 0 HcmV?d00001 diff --git a/styles/character.less b/styles/character.less index f27daa1..d0fafa6 100644 --- a/styles/character.less +++ b/styles/character.less @@ -2,7 +2,7 @@ // ─── Character sheet specifics ─────────────────────────────────────────────── -.celestopol.character-sheet { +.fvtt-celestopol.character { // Attributs perso (Entregent, Fortune, Rêve, Vision) .perso-attributs { diff --git a/styles/global.less b/styles/global.less index 4dbcc87..4469824 100644 --- a/styles/global.less +++ b/styles/global.less @@ -1,5 +1,9 @@ // ─── Variables CSS (couleurs + typo) ──────────────────────────────────────── +// ─── FVTT-wide type label fix ──────────────────────────────────────────────── +// Override window title color for celestopol sheets +.fvtt-celestopol .window-title { color: var(--cel-orange, #e07b00); } + :root { --cel-green: rgb(12, 76, 12); --cel-green-light: rgb(20, 110, 20); @@ -17,7 +21,7 @@ // ─── Sheet base layout ─────────────────────────────────────────────────────── -.celestopol { +.fvtt-celestopol { &.sheet { background: var(--cel-cream); font-family: var(--cel-font-body); @@ -154,5 +158,10 @@ padding: 8px; } - .tab { display: none; &.active { display: block; } } + .tab { + display: none; + padding: 8px; + overflow-y: auto; + &.active { display: block; } + } } diff --git a/styles/items.less b/styles/items.less index 940e601..784f7be 100644 --- a/styles/items.less +++ b/styles/items.less @@ -2,7 +2,7 @@ // ─── Item sheets shared ─────────────────────────────────────────────────────── -.celestopol.item-sheet { +.fvtt-celestopol.item { .item-header { display: flex; @@ -147,7 +147,7 @@ } // Equipment-specific - &.equipment-sheet { + &.equipment { .equipment-stats { display: grid; grid-template-columns: repeat(3, 1fr); diff --git a/styles/npc.less b/styles/npc.less index 7b06383..4bad616 100644 --- a/styles/npc.less +++ b/styles/npc.less @@ -2,7 +2,7 @@ // ─── NPC sheet specifics ───────────────────────────────────────────────────── -.celestopol.npc-sheet { +.fvtt-celestopol.npc { .stats-grid { display: grid; diff --git a/templates/anomaly.hbs b/templates/anomaly.hbs index 056d937..59f1647 100644 --- a/templates/anomaly.hbs +++ b/templates/anomaly.hbs @@ -7,7 +7,9 @@
-
+
{{editor system.technique target="system.technique" button=true editable=isEditable}} @@ -46,7 +48,7 @@
-
- {{> "systems/fvtt-celestopol/templates/partials/item-scores.hbs" skills=skills stats=stats}} +
+ {{> "systems/fvtt-celestopol/templates/partials/item-scores.hbs" skills=skills stats=stats system=system}}
diff --git a/templates/aspect.hbs b/templates/aspect.hbs index 7b84b46..e56d54c 100644 --- a/templates/aspect.hbs +++ b/templates/aspect.hbs @@ -13,20 +13,20 @@ -
+
{{editor system.description target="system.description" button=true editable=isEditable}}
-
+
{{editor system.technique target="system.technique" button=true editable=isEditable}} {{editor system.narratif target="system.narratif" button=true editable=isEditable}}
-
- {{> "systems/fvtt-celestopol/templates/partials/item-scores.hbs" skills=skills}} +
+ {{> "systems/fvtt-celestopol/templates/partials/item-scores.hbs" skills=skills system=system}}
diff --git a/templates/attribute.hbs b/templates/attribute.hbs index 8daade3..e9e4f66 100644 --- a/templates/attribute.hbs +++ b/templates/attribute.hbs @@ -13,20 +13,20 @@ -
+
{{editor system.description target="system.description" button=true editable=isEditable}}
-
+
{{editor system.technique target="system.technique" button=true editable=isEditable}} {{editor system.narratif target="system.narratif" button=true editable=isEditable}}
-
- {{> "systems/fvtt-celestopol/templates/partials/item-scores.hbs" skills=skills}} +
+ {{> "systems/fvtt-celestopol/templates/partials/item-scores.hbs" skills=skills system=system}}
diff --git a/templates/character-biography.hbs b/templates/character-biography.hbs index 943422c..ae2ee39 100644 --- a/templates/character-biography.hbs +++ b/templates/character-biography.hbs @@ -1,4 +1,4 @@ -
+
{{!-- Équipements --}}
diff --git a/templates/character-blessures.hbs b/templates/character-blessures.hbs index 9aa2fe8..2d52356 100644 --- a/templates/character-blessures.hbs +++ b/templates/character-blessures.hbs @@ -1,4 +1,4 @@ -
+
{{!-- Blessures --}}
diff --git a/templates/character-competences.hbs b/templates/character-competences.hbs index d18ad8c..e32aa74 100644 --- a/templates/character-competences.hbs +++ b/templates/character-competences.hbs @@ -1,4 +1,4 @@ -
+
{{!-- Grille des 4 stats × 4 compétences --}}
{{#each stats as |stat statId|}} diff --git a/templates/character-factions.hbs b/templates/character-factions.hbs index 3868e8d..2e72717 100644 --- a/templates/character-factions.hbs +++ b/templates/character-factions.hbs @@ -1,4 +1,4 @@ -
+
diff --git a/templates/character-main.hbs b/templates/character-main.hbs index 3e347f7..b86d5be 100644 --- a/templates/character-main.hbs +++ b/templates/character-main.hbs @@ -27,7 +27,9 @@ {{#if isEditMode}} {{else}} diff --git a/templates/chat-message.hbs b/templates/chat-message.hbs index 0d1986f..188ca83 100644 --- a/templates/chat-message.hbs +++ b/templates/chat-message.hbs @@ -33,7 +33,7 @@
{{localize "CELESTOPOL.Roll.total"}} {{total}} - vs {{difficulty}} + vs {{difficultyLabel}}
diff --git a/templates/equipment.hbs b/templates/equipment.hbs index 35bee20..0ef8711 100644 --- a/templates/equipment.hbs +++ b/templates/equipment.hbs @@ -7,7 +7,9 @@
diff --git a/templates/npc-blessures.hbs b/templates/npc-blessures.hbs index e63c1e3..aad8ba4 100644 --- a/templates/npc-blessures.hbs +++ b/templates/npc-blessures.hbs @@ -1,4 +1,4 @@ -
+
{{localize "CELESTOPOL.Track.blessures"}} diff --git a/templates/npc-competences.hbs b/templates/npc-competences.hbs index f37a991..03ad90c 100644 --- a/templates/npc-competences.hbs +++ b/templates/npc-competences.hbs @@ -1,4 +1,4 @@ -
+
{{#each stats as |stat statId|}}
diff --git a/templates/npc-main.hbs b/templates/npc-main.hbs index 01be299..785d171 100644 --- a/templates/npc-main.hbs +++ b/templates/npc-main.hbs @@ -28,7 +28,9 @@ {{#if isEditMode}} {{else}} diff --git a/templates/partials/item-scores.hbs b/templates/partials/item-scores.hbs index c56a044..71e4f57 100644 --- a/templates/partials/item-scores.hbs +++ b/templates/partials/item-scores.hbs @@ -10,14 +10,12 @@ {{#each statSkills as |skill skillId|}}
{{localize skill.label}} - {{#if ../isEditable}} - - - {{/if}} + +
{{/each}}
diff --git a/templates/roll-dialog.hbs b/templates/roll-dialog.hbs index 1c00d64..3c26e82 100644 --- a/templates/roll-dialog.hbs +++ b/templates/roll-dialog.hbs @@ -1,15 +1,14 @@
- {{statLabel}} - - {{skillLabel}} + {{#if statLabel}}{{localize statLabel}}{{/if}} + {{localize skillLabel}}
- {{#each difficulties as |diff key|}} - {{/each}} @@ -29,7 +28,7 @@
- +