IMplémentation de la ajorité des remarques de Nepherius
This commit is contained in:
@@ -29,6 +29,7 @@ export default class CelestopolActorSheet extends HandlebarsApplicationMixin(fou
|
||||
trackBox: CelestopolActorSheet.#onTrackBox,
|
||||
skillLevel: CelestopolActorSheet.#onSkillLevel,
|
||||
factionLevel: CelestopolActorSheet.#onFactionLevel,
|
||||
toggleArmure: CelestopolActorSheet.#onToggleArmure,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -173,12 +174,21 @@ export default class CelestopolActorSheet extends HandlebarsApplicationMixin(fou
|
||||
}
|
||||
|
||||
/** Met à jour le score d'une faction par clic sur un point. */
|
||||
static async #onToggleArmure(_event, target) {
|
||||
const uuid = target.closest('[data-item-uuid]')?.dataset.itemUuid
|
||||
if (!uuid) return
|
||||
const item = await fromUuid(uuid)
|
||||
if (item?.type === "armure") await item.update({ "system.equipped": !item.system.equipped })
|
||||
}
|
||||
|
||||
static #onFactionLevel(_event, target) {
|
||||
if (!this.isEditable) return
|
||||
const factionId = target.dataset.faction
|
||||
const index = parseInt(target.dataset.index)
|
||||
const index = parseInt(target.dataset.index) // 0-8
|
||||
const newValue = index - 4 // -4 à +4
|
||||
const current = this.document.system.factions[factionId]?.value ?? 0
|
||||
const newValue = (index <= current) ? index - 1 : index
|
||||
this.document.update({ [`system.factions.${factionId}.value`]: Math.max(0, newValue) })
|
||||
// Cliquer sur le dot actif (sauf neutre) remet à 0
|
||||
const finalValue = (newValue === current && newValue !== 0) ? 0 : newValue
|
||||
this.document.update({ [`system.factions.${factionId}.value`]: finalValue })
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user