Files
fvtt-chroniques-de-l-etrange/src/ui/sheets/actors/character.js
LeRatierBretonnier 068fca00e5 Neo-Tokyo Neon Noir design pour fiches items
- Nouvelle palette : #080c14 fond, accents néon par type (#00d4d4 item, #ff3d5a kungfu, #4a9eff spell, #cc44ff supernatural)
- Nouveaux composants LESS : .cde-neon-header (clip-path angulaire + accent line), .cde-avatar (clip-path), .cde-stat-grid/.cde-stat-cell (style terminal), .cde-badge (parallélogramme), .cde-neon-tabs (underline néon animé), .cde-check-cell
- Fix layout : .cde-sheet width: 100% + height: 100% + overflow: hidden, .cde-tab-body flex: 1 + min-height: 0, .cde-notes-editor flex stretch
- Fix positions : DEFAULT_OPTIONS height explicite pour tous les types (item 620x580, spell 660x680, kungfu 720x680, supernatural 560x520)
- 4 templates items reécrits avec nouvelles classes et structure épurée

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-26 00:18:04 +01:00

113 lines
4.2 KiB
JavaScript

import { MAGICS, SUBTYPES } from "../../../config/constants.js"
import { CDEBaseActorSheet } from "./base.js"
export class CDECharacterSheet extends CDEBaseActorSheet {
static DEFAULT_OPTIONS = {
classes: ["character"],
}
static PARTS = {
main: { template: "systems/fvtt-chroniques-de-l-etrange/templates/actor/cde-character-sheet.html" },
}
tabGroups = { primary: "description" }
async _prepareContext() {
const context = await super._prepareContext()
context.equipments = context.items.filter((item) => item.type === "item")
context.spells = context.items.filter((item) => item.type === "spell")
context.kungfus = context.items.filter((item) => item.type === "kungfu")
context.CDE = { MAGICS, SUBTYPES }
return context
}
_onRender(context, options) {
super._onRender?.(context, options)
this.#bindInitiativeControls()
this.#bindPrefs()
}
#bindInitiativeControls() {
const buttons = this.element?.querySelectorAll(".click-initiative")
if (!buttons?.length) return
buttons.forEach((button) => {
button.addEventListener("click", async () => {
const action = button.dataset.libelId
let initiative = this.document.system.initiative ?? 1
if (action === "plus") {
initiative = initiative >= 24 ? 1 : initiative + 1
await this.document.update({ "system.initiative": initiative })
return
}
if (action === "minus") {
initiative = initiative <= 1 ? 24 : initiative - 1
await this.document.update({ "system.initiative": initiative })
return
}
if (action === "create") {
const html = `
<form class="flexcol">
<div class="form-group">
<label>${game.i18n.localize("CDE.TurnOrder")}</label>
<input type="number" name="initiative" value="${initiative}" min="1" max="24" />
</div>
</form>`
const value = await Dialog.prompt({
title: game.i18n.localize("CDE.TurnOrder"),
content: html,
label: game.i18n.localize("CDE.Validate"),
callback: (dlg) => {
const input = dlg.querySelector("input[name='initiative']")
return Number(input?.value ?? initiative)
},
})
if (Number.isFinite(value)) {
const sanitized = foundry.utils.clamp(Number(value), 1, 24)
await this.document.update({ "system.initiative": sanitized })
}
}
})
})
}
#bindPrefs() {
const button = this.element?.querySelector(".click-prefs")
if (!button) return
button.addEventListener("click", async () => {
const current = this.document.system.prefs?.typeofthrow ?? { choice: "0", check: true }
const html = `
<form class="flexcol">
<div class="form-group">
<label>${game.i18n.localize("CDE.ThrowType")}</label>
<select name="choice" value="${current.choice}">
<option value="0"${current.choice === "0" ? " selected" : ""}>0</option>
<option value="1"${current.choice === "1" ? " selected" : ""}>1</option>
<option value="2"${current.choice === "2" ? " selected" : ""}>2</option>
<option value="3"${current.choice === "3" ? " selected" : ""}>3</option>
</select>
</div>
<div class="form-group">
<label>${game.i18n.localize("CDE.EnablePrompt")}</label>
<input type="checkbox" name="check" ${current.check ? "checked" : ""}/>
</div>
</form>`
const prefs = await Dialog.prompt({
title: game.i18n.localize("CDE.Preferences"),
content: html,
label: game.i18n.localize("CDE.Validate"),
callback: (dlg) => {
const choice = dlg.querySelector("select[name='choice']")?.value ?? "0"
const check = dlg.querySelector("input[name='check']")?.checked ?? false
return { choice, check }
},
})
if (prefs) {
await this.document.update({
"system.prefs.typeofthrow.choice": String(prefs.choice),
"system.prefs.typeofthrow.check": !!prefs.check,
})
}
})
}
}