Migration datamodels !
This commit is contained in:
158
modules/applications/mournblade-roll-dialog.mjs
Normal file
158
modules/applications/mournblade-roll-dialog.mjs
Normal file
@@ -0,0 +1,158 @@
|
||||
import { MournbladeUtility } from "../mournblade-utility.js"
|
||||
|
||||
/**
|
||||
* Dialogue de jet de dé pour Mournblade - Version DialogV2
|
||||
*/
|
||||
export class MournbladeRollDialog {
|
||||
|
||||
/**
|
||||
* Create and display the roll dialog
|
||||
* @param {MournbladeActor} actor - The actor making the roll
|
||||
* @param {Object} rollData - Data for the roll
|
||||
* @returns {Promise<MournbladeRollDialog>}
|
||||
*/
|
||||
static async create(actor, rollData) {
|
||||
// Préparer le contexte pour le template
|
||||
const context = {
|
||||
...rollData,
|
||||
difficulte: String(rollData.difficulte || 0),
|
||||
img: actor.img,
|
||||
name: actor.name,
|
||||
config: game.system.mournblade.config,
|
||||
}
|
||||
|
||||
// Si attrKey est "tochoose", préparer la liste des attributs sélectionnables
|
||||
if (rollData.attrKey === "tochoose") {
|
||||
context.selectableAttributes = actor.system.attributs
|
||||
}
|
||||
|
||||
// Rendre le template en HTML
|
||||
const content = await foundry.applications.handlebars.renderTemplate(
|
||||
"systems/fvtt-mournblade/templates/roll-dialog-v2.hbs",
|
||||
context
|
||||
)
|
||||
|
||||
// Utiliser DialogV2.wait avec le HTML rendu
|
||||
return foundry.applications.api.DialogV2.wait({
|
||||
window: { title: "Test de Capacité", icon: "fa-solid fa-dice-d20" },
|
||||
classes: ["mournblade-roll-dialog"],
|
||||
position: { width: 500 },
|
||||
modal: false,
|
||||
content,
|
||||
buttons: [
|
||||
{
|
||||
action: "rolld10",
|
||||
label: "Lancer 1d10",
|
||||
icon: "fa-solid fa-dice-d10",
|
||||
default: true,
|
||||
callback: (event, button, dialog) => {
|
||||
this._updateRollDataFromForm(rollData, button.form.elements, actor)
|
||||
rollData.mainDice = "1d10"
|
||||
MournbladeUtility.rollMournblade(rollData)
|
||||
}
|
||||
},
|
||||
{
|
||||
action: "rolld20",
|
||||
label: "Lancer 1d20",
|
||||
icon: "fa-solid fa-dice-d20",
|
||||
callback: (event, button, dialog) => {
|
||||
this._updateRollDataFromForm(rollData, button.form.elements, actor)
|
||||
rollData.mainDice = "1d20"
|
||||
MournbladeUtility.rollMournblade(rollData)
|
||||
}
|
||||
},
|
||||
],
|
||||
rejectClose: false,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Mettre à jour rollData avec les valeurs du formulaire
|
||||
* @param {Object} rollData - L'objet rollData à mettre à jour
|
||||
* @param {HTMLFormControlsCollection} formElements - Les éléments du formulaire
|
||||
* @param {MournbladeActor} actor - L'acteur pour récupérer les attributs
|
||||
* @private
|
||||
*/
|
||||
static _updateRollDataFromForm(rollData, formElements, actor) {
|
||||
// Attributs
|
||||
if (formElements.attrKey) {
|
||||
rollData.attrKey = formElements.attrKey.value
|
||||
if (rollData.attrKey !== "tochoose" && actor) {
|
||||
rollData.attr = foundry.utils.duplicate(actor.system.attributs[rollData.attrKey])
|
||||
rollData.actionImg = "systems/fvtt-mournblade/assets/icons/" + actor.system.attributs[rollData.attrKey].labelnorm + ".webp"
|
||||
}
|
||||
}
|
||||
|
||||
// Modificateurs de base
|
||||
if (formElements.difficulte) {
|
||||
rollData.difficulte = Number(formElements.difficulte.value)
|
||||
}
|
||||
if (formElements.modificateur) {
|
||||
rollData.modificateur = Number(formElements.modificateur.value)
|
||||
}
|
||||
|
||||
// Runes
|
||||
if (formElements.runemode) {
|
||||
rollData.runemode = String(formElements.runemode.value)
|
||||
}
|
||||
if (formElements.runeame) {
|
||||
rollData.runeame = Number(formElements.runeame.value)
|
||||
}
|
||||
|
||||
// Combat mêlée
|
||||
if (formElements.typeAttaque) {
|
||||
rollData.typeAttaque = String(formElements.typeAttaque.value)
|
||||
}
|
||||
if (formElements.isMonte !== undefined) {
|
||||
rollData.isMonte = formElements.isMonte.checked
|
||||
}
|
||||
|
||||
// Combat distance
|
||||
if (formElements.visee !== undefined) {
|
||||
rollData.visee = formElements.visee.checked
|
||||
}
|
||||
if (formElements.cibleconsciente !== undefined) {
|
||||
rollData.cibleconsciente = formElements.cibleconsciente.checked
|
||||
}
|
||||
if (formElements.ciblecourt !== undefined) {
|
||||
rollData.ciblecourt = formElements.ciblecourt.checked
|
||||
}
|
||||
if (formElements.typeCouvert) {
|
||||
rollData.typeCouvert = String(formElements.typeCouvert.value)
|
||||
}
|
||||
|
||||
// Désavantages
|
||||
if (!rollData.desavantages) rollData.desavantages = {}
|
||||
|
||||
if (formElements.cibleausol !== undefined) {
|
||||
rollData.desavantages.cibleausol = formElements.cibleausol.checked
|
||||
}
|
||||
if (formElements.cibledesarmee !== undefined) {
|
||||
rollData.desavantages.cibledesarmee = formElements.cibledesarmee.checked
|
||||
}
|
||||
if (formElements.ciblerestreint !== undefined) {
|
||||
rollData.desavantages.ciblerestreint = formElements.ciblerestreint.checked
|
||||
}
|
||||
if (formElements.cibleimmobilisée !== undefined) {
|
||||
rollData.desavantages.cibleimmobilisée = formElements.cibleimmobilisée.checked
|
||||
}
|
||||
if (formElements.ciblesurplomb !== undefined) {
|
||||
rollData.desavantages.ciblesurplomb = formElements.ciblesurplomb.checked
|
||||
}
|
||||
|
||||
// Double D20
|
||||
if (formElements.doubleD20 !== undefined) {
|
||||
rollData.doubleD20 = formElements.doubleD20.checked
|
||||
}
|
||||
|
||||
// Modifiers
|
||||
if (rollData.modifiers) {
|
||||
rollData.modifiers.forEach((modifier, idx) => {
|
||||
const checkbox = formElements[`apply-modifier-${idx}`]
|
||||
if (checkbox) {
|
||||
modifier.system.apply = checkbox.checked
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
29
modules/applications/sheets/_module.mjs
Normal file
29
modules/applications/sheets/_module.mjs
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Index des applications AppV2 pour Mournblade
|
||||
* Ce fichier centralise tous les exports des applications
|
||||
*/
|
||||
|
||||
// Applications de feuilles d'acteurs
|
||||
export { default as MournbladePersonnageSheet } from './mournblade-personnage-sheet.mjs';
|
||||
export { default as MournbladeCreatureSheet } from './mournblade-creature-sheet.mjs';
|
||||
export { default as MournbladePnjSheet } from './mournblade-pnj-sheet.mjs';
|
||||
|
||||
// Applications de feuilles d'items
|
||||
export { default as MournbladeArmeSheet } from './mournblade-arme-sheet.mjs';
|
||||
export { default as MournbladeBouclierSheet } from './mournblade-bouclier-sheet.mjs';
|
||||
export { default as MournbladeCapaciteSheet } from './mournblade-capacite-sheet.mjs';
|
||||
export { default as MournbladeCompetenceSheet } from './mournblade-competence-sheet.mjs';
|
||||
export { default as MournbladeDonSheet } from './mournblade-don-sheet.mjs';
|
||||
export { default as MournbladeEquipementSheet } from './mournblade-equipement-sheet.mjs';
|
||||
export { default as MournbladeHeritageSheet } from './mournblade-heritage-sheet.mjs';
|
||||
export { default as MournbladeMetierSheet } from './mournblade-metier-sheet.mjs';
|
||||
export { default as MournbladeModifierSheet } from './mournblade-modifier-sheet.mjs';
|
||||
export { default as MournbladeMonnaieSheet } from './mournblade-monnaie-sheet.mjs';
|
||||
export { default as MournbladeOrigineSheet } from './mournblade-origine-sheet.mjs';
|
||||
export { default as MournbladePacteSheet } from './mournblade-pacte-sheet.mjs';
|
||||
export { default as MournbladeProtectionSheet } from './mournblade-protection-sheet.mjs';
|
||||
export { default as MournbladeRuneSheet } from './mournblade-rune-sheet.mjs';
|
||||
export { default as MournbladeRuneEffectSheet } from './mournblade-runeeffect-sheet.mjs';
|
||||
export { default as MournbladeTendanceSheet } from './mournblade-tendance-sheet.mjs';
|
||||
export { default as MournbladeTraitChaotiqueSheet } from './mournblade-traitchaotique-sheet.mjs';
|
||||
export { default as MournbladeTraitEspeceSheet } from './mournblade-traitespece-sheet.mjs';
|
||||
406
modules/applications/sheets/base-actor-sheet.mjs
Normal file
406
modules/applications/sheets/base-actor-sheet.mjs
Normal file
@@ -0,0 +1,406 @@
|
||||
const { HandlebarsApplicationMixin } = foundry.applications.api
|
||||
|
||||
import { MournbladeUtility } from "../../mournblade-utility.js"
|
||||
|
||||
export default class MournbladeActorSheet extends HandlebarsApplicationMixin(foundry.applications.sheets.ActorSheetV2) {
|
||||
/**
|
||||
* Different sheet modes.
|
||||
* @enum {number}
|
||||
*/
|
||||
static SHEET_MODES = { EDIT: 0, PLAY: 1 }
|
||||
|
||||
constructor(options = {}) {
|
||||
super(options)
|
||||
this.#dragDrop = this.#createDragDropHandlers()
|
||||
this._sheetMode = this.constructor.SHEET_MODES.PLAY // Commencer en mode visualisation
|
||||
}
|
||||
|
||||
#dragDrop
|
||||
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["fvtt-mournblade", "sheet", "actor"],
|
||||
position: {
|
||||
width: 650,
|
||||
height: 720,
|
||||
},
|
||||
form: {
|
||||
submitOnChange: true,
|
||||
closeOnSubmit: false,
|
||||
},
|
||||
window: {
|
||||
resizable: true,
|
||||
},
|
||||
tabs: [
|
||||
{
|
||||
navSelector: 'nav[data-group="primary"]',
|
||||
contentSelector: "section.sheet-body",
|
||||
initial: "stats",
|
||||
},
|
||||
],
|
||||
dragDrop: [{ dragSelector: ".item-list .item", dropSelector: null }],
|
||||
actions: {
|
||||
editImage: MournbladeActorSheet.#onEditImage,
|
||||
toggleSheet: MournbladeActorSheet.#onToggleSheet,
|
||||
editItem: MournbladeActorSheet.#onEditItem,
|
||||
deleteItem: MournbladeActorSheet.#onDeleteItem,
|
||||
createItem: MournbladeActorSheet.#onCreateItem,
|
||||
equipItem: MournbladeActorSheet.#onEquipItem,
|
||||
modifyQuantity: MournbladeActorSheet.#onModifyQuantity,
|
||||
modifySante: MournbladeActorSheet.#onModifySante,
|
||||
modifyAme: MournbladeActorSheet.#onModifyAme,
|
||||
rollAttribut: MournbladeActorSheet.#onRollAttribut,
|
||||
rollCompetence: MournbladeActorSheet.#onRollCompetence,
|
||||
rollRune: MournbladeActorSheet.#onRollRune,
|
||||
rollArmeOffensif: MournbladeActorSheet.#onRollArmeOffensif,
|
||||
rollArmeSpecial: MournbladeActorSheet.#onRollArmeSpecial,
|
||||
rollArmeDegats: MournbladeActorSheet.#onRollArmeDegats,
|
||||
rollAssommer: MournbladeActorSheet.#onRollAssommer,
|
||||
rollImmobiliser: MournbladeActorSheet.#onRollImmobiliser,
|
||||
rollFuir: MournbladeActorSheet.#onRollFuir,
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the sheet currently in 'Play' mode?
|
||||
* @type {boolean}
|
||||
*/
|
||||
get isPlayMode() {
|
||||
if (this._sheetMode === undefined) this._sheetMode = this.constructor.SHEET_MODES.PLAY
|
||||
return this._sheetMode === this.constructor.SHEET_MODES.PLAY
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the sheet currently in 'Edit' mode?
|
||||
* @type {boolean}
|
||||
*/
|
||||
get isEditMode() {
|
||||
if (this._sheetMode === undefined) this._sheetMode = this.constructor.SHEET_MODES.PLAY
|
||||
return this._sheetMode === this.constructor.SHEET_MODES.EDIT
|
||||
}
|
||||
|
||||
/**
|
||||
* Tab groups state
|
||||
* @type {object}
|
||||
*/
|
||||
tabGroups = { primary: "stats" }
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const actor = this.document
|
||||
|
||||
const context = {
|
||||
actor: actor,
|
||||
system: actor.system,
|
||||
source: actor.toObject(),
|
||||
fields: actor.schema.fields,
|
||||
systemFields: actor.system.schema.fields,
|
||||
isEditable: this.isEditable,
|
||||
isEditMode: this.isEditMode,
|
||||
isPlayMode: this.isPlayMode,
|
||||
isGM: game.user.isGM,
|
||||
config: game.system.mournblade.config,
|
||||
enrichedDescription: await foundry.applications.ux.TextEditor.implementation.enrichHTML(actor.system.biodata?.description || "", { async: true }),
|
||||
}
|
||||
return context
|
||||
}
|
||||
|
||||
/** @override */
|
||||
_onRender(context, options) {
|
||||
super._onRender(context, options)
|
||||
this.#dragDrop.forEach((d) => d.bind(this.element))
|
||||
|
||||
// Handle edit-item-data changes
|
||||
this.element.querySelectorAll('.edit-item-data').forEach(element => {
|
||||
element.addEventListener('change', async (event) => {
|
||||
const target = event.currentTarget
|
||||
const itemElement = target.closest('[data-item-id]')
|
||||
if (!itemElement) return
|
||||
|
||||
const itemId = itemElement.dataset.itemId
|
||||
const itemType = itemElement.dataset.itemType
|
||||
const itemField = target.dataset.itemField
|
||||
const dataType = target.dataset.dtype
|
||||
const value = target.value
|
||||
|
||||
await this.document.editItemField(itemId, itemType, itemField, dataType, value)
|
||||
})
|
||||
})
|
||||
|
||||
// Activate tab navigation manually
|
||||
const nav = this.element.querySelector('nav.tabs[data-group]')
|
||||
if (nav) {
|
||||
const group = nav.dataset.group
|
||||
// Activate the current tab
|
||||
const activeTab = this.tabGroups[group] || "stats"
|
||||
nav.querySelectorAll('[data-tab]').forEach(link => {
|
||||
const tab = link.dataset.tab
|
||||
link.classList.toggle('active', tab === activeTab)
|
||||
link.addEventListener('click', (event) => {
|
||||
event.preventDefault()
|
||||
this.tabGroups[group] = tab
|
||||
this.render()
|
||||
})
|
||||
})
|
||||
|
||||
// Show/hide tab content
|
||||
this.element.querySelectorAll('[data-group="' + group + '"][data-tab]').forEach(content => {
|
||||
content.classList.toggle('active', content.dataset.tab === activeTab)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// #region Drag-and-Drop Workflow
|
||||
/**
|
||||
* Create drag-and-drop workflow handlers for this Application
|
||||
*/
|
||||
#createDragDropHandlers() {
|
||||
return []
|
||||
}
|
||||
|
||||
// #region Actions
|
||||
/** @override */
|
||||
static ACTIONS = {
|
||||
editImage: MournbladeActorSheet.#onEditImage,
|
||||
toggleSheet: MournbladeActorSheet.#onToggleSheet,
|
||||
editItem: MournbladeActorSheet.#onEditItem,
|
||||
deleteItem: MournbladeActorSheet.#onDeleteItem,
|
||||
createItem: MournbladeActorSheet.#onCreateItem,
|
||||
equipItem: MournbladeActorSheet.#onEquipItem,
|
||||
modifyQuantity: MournbladeActorSheet.#onModifyQuantity,
|
||||
rollAttribut: MournbladeActorSheet.#onRollAttribut,
|
||||
rollCompetence: MournbladeActorSheet.#onRollCompetence,
|
||||
rollArmeOffensif: MournbladeActorSheet.#onRollArmeOffensif,
|
||||
rollArmeDegats: MournbladeActorSheet.#onRollArmeDegats,
|
||||
rollAssommer: MournbladeActorSheet.#onRollAssommer,
|
||||
rollImmobiliser: MournbladeActorSheet.#onRollImmobiliser,
|
||||
rollFuir: MournbladeActorSheet.#onRollFuir,
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle editing the actor image
|
||||
* @param {Event} event - The triggering event
|
||||
*/
|
||||
static async #onEditImage(event) {
|
||||
event.preventDefault()
|
||||
const sheet = this
|
||||
const filePicker = new FilePicker({
|
||||
type: "image",
|
||||
current: sheet.document.img,
|
||||
callback: (path) => {
|
||||
sheet.document.update({ img: path })
|
||||
},
|
||||
})
|
||||
filePicker.browse()
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle toggling the sheet mode
|
||||
* @param {Event} event - The triggering event
|
||||
*/
|
||||
static async #onToggleSheet(event) {
|
||||
event.preventDefault()
|
||||
const sheet = this
|
||||
sheet._sheetMode = sheet._sheetMode === sheet.constructor.SHEET_MODES.PLAY ? sheet.constructor.SHEET_MODES.EDIT : sheet.constructor.SHEET_MODES.PLAY
|
||||
sheet.render()
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle editing an item
|
||||
* @param {Event} event - The triggering event
|
||||
* @param {HTMLElement} target - The target element
|
||||
*/
|
||||
static async #onEditItem(event, target) {
|
||||
const li = target.closest(".item")
|
||||
const itemId = li?.dataset.itemId
|
||||
if (!itemId) return
|
||||
const item = this.actor.items.get(itemId)
|
||||
if (item) item.sheet.render(true)
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle deleting an item
|
||||
* @param {Event} event - The triggering event
|
||||
* @param {HTMLElement} target - The target element
|
||||
*/
|
||||
static async #onDeleteItem(event, target) {
|
||||
const li = target.closest(".item")
|
||||
await MournbladeUtility.confirmDelete(this, li)
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle creating an item
|
||||
* @param {Event} event - The triggering event
|
||||
* @param {HTMLElement} target - The target element
|
||||
*/
|
||||
static async #onCreateItem(event, target) {
|
||||
const itemType = target.dataset.type
|
||||
await this.actor.createEmbeddedDocuments("Item", [{ name: `Nouveau ${itemType}`, type: itemType }], { renderSheet: true })
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle equipping an item
|
||||
* @param {Event} event - The triggering event
|
||||
* @param {HTMLElement} target - The target element
|
||||
*/
|
||||
static async #onEquipItem(event, target) {
|
||||
const li = target.closest(".item")
|
||||
const itemId = li?.dataset.itemId
|
||||
if (!itemId) return
|
||||
const item = this.actor.items.get(itemId)
|
||||
if (item) {
|
||||
await item.update({ "system.equipped": !item.system.equipped })
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle modifying the quantity of an item
|
||||
* @param {Event} event - The triggering event
|
||||
* @param {HTMLElement} target - The target element
|
||||
*/
|
||||
static async #onModifyQuantity(event, target) {
|
||||
const li = target.closest('[data-item-id]')
|
||||
const itemId = li?.dataset.itemId
|
||||
const value = Number.parseInt(target.dataset.quantiteValue)
|
||||
const item = this.document.items.get(itemId)
|
||||
if (item) {
|
||||
const newQuantity = Math.max(0, (item.system.quantite || 0) + value)
|
||||
await item.update({ "system.quantite": newQuantity })
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle modifying santé (health) values
|
||||
* @param {Event} event - The triggering event
|
||||
* @param {HTMLElement} target - The target element
|
||||
*/
|
||||
static async #onModifySante(event, target) {
|
||||
const type = target.dataset.type
|
||||
const value = Number.parseInt(target.dataset.value)
|
||||
const actor = this.document
|
||||
const currentValue = actor.system.sante[type] || 0
|
||||
const newValue = Math.max(0, currentValue + value)
|
||||
await actor.update({ [`system.sante.${type}`]: newValue })
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle modifying âme (soul) value
|
||||
* @param {Event} event - The triggering event
|
||||
* @param {HTMLElement} target - The target element
|
||||
*/
|
||||
static async #onModifyAme(event, target) {
|
||||
const value = Number.parseInt(target.dataset.value)
|
||||
const actor = this.document
|
||||
const currentValue = actor.system.ame.value || 0
|
||||
const newValue = Math.max(0, currentValue + value)
|
||||
await actor.update({ "system.ame.value": newValue })
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle rolling an attribut
|
||||
* @param {Event} event - The triggering event
|
||||
*/
|
||||
static async #onRollAttribut(event, target) {
|
||||
event.preventDefault()
|
||||
const sheet = this
|
||||
const attrKey = target.dataset.attrKey
|
||||
const actor = sheet.document
|
||||
await actor.rollAttribut(attrKey)
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle rolling a competence
|
||||
* @param {Event} event - The triggering event
|
||||
*/
|
||||
static async #onRollCompetence(event, target) {
|
||||
event.preventDefault()
|
||||
const sheet = this
|
||||
const attrKey = target.dataset.attrKey
|
||||
const li = target.closest('[data-item-id]')
|
||||
const compId = li?.dataset.itemId
|
||||
const actor = sheet.document
|
||||
await actor.rollCompetence(attrKey, compId)
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle rolling a rune
|
||||
* @param {Event} event - The triggering event
|
||||
*/
|
||||
static async #onRollRune(event, target) {
|
||||
event.preventDefault()
|
||||
const sheet = this
|
||||
const li = target.closest('[data-item-id]')
|
||||
const runeId = li?.dataset.itemId
|
||||
const actor = sheet.document
|
||||
await actor.rollRune(runeId)
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle rolling an arme offensif
|
||||
* @param {Event} event - The triggering event
|
||||
*/
|
||||
static async #onRollArmeOffensif(event, target) {
|
||||
event.preventDefault()
|
||||
const sheet = this
|
||||
const armeId = target.dataset.armeId
|
||||
const actor = sheet.document
|
||||
await actor.rollArmeOffensif(armeId)
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle rolling an arme degats
|
||||
* @param {Event} event - The triggering event
|
||||
*/
|
||||
static async #onRollArmeDegats(event, target) {
|
||||
event.preventDefault()
|
||||
const sheet = this
|
||||
const armeId = target.dataset.armeId
|
||||
const actor = sheet.document
|
||||
await actor.rollArmeDegats(armeId)
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle rolling an arme special
|
||||
* @param {Event} event - The triggering event
|
||||
*/
|
||||
static async #onRollArmeSpecial(event, target) {
|
||||
event.preventDefault()
|
||||
const sheet = this
|
||||
const armeId = target.dataset.armeId
|
||||
const actor = sheet.document
|
||||
await actor.rollArmeSpecial(armeId)
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle rolling an assommer
|
||||
* @param {Event} event - The triggering event
|
||||
*/
|
||||
static async #onRollAssommer(event, target) {
|
||||
event.preventDefault()
|
||||
const sheet = this
|
||||
const actor = sheet.document
|
||||
await actor.rollAssomer()
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle rolling an immobiliser
|
||||
* @param {Event} event - The triggering event
|
||||
*/
|
||||
static async #onRollImmobiliser(event, target) {
|
||||
event.preventDefault()
|
||||
const sheet = this
|
||||
const actor = sheet.document
|
||||
await actor.rollImmobiliser()
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle rolling a fuir
|
||||
* @param {Event} event - The triggering event
|
||||
*/
|
||||
static async #onRollFuir(event, target) {
|
||||
event.preventDefault()
|
||||
const sheet = this
|
||||
const actor = sheet.document
|
||||
await actor.rollFuir()
|
||||
}
|
||||
}
|
||||
142
modules/applications/sheets/base-item-sheet.mjs
Normal file
142
modules/applications/sheets/base-item-sheet.mjs
Normal file
@@ -0,0 +1,142 @@
|
||||
const { HandlebarsApplicationMixin } = foundry.applications.api
|
||||
|
||||
export default class MournbladeItemSheet extends HandlebarsApplicationMixin(foundry.applications.sheets.ItemSheetV2) {
|
||||
constructor(options = {}) {
|
||||
super(options)
|
||||
this.#dragDrop = this.#createDragDropHandlers()
|
||||
}
|
||||
|
||||
#dragDrop
|
||||
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["fvtt-mournblade", "item"],
|
||||
position: {
|
||||
width: 620,
|
||||
height: 600,
|
||||
},
|
||||
form: {
|
||||
submitOnChange: true,
|
||||
},
|
||||
window: {
|
||||
resizable: true,
|
||||
},
|
||||
tabs: [
|
||||
{
|
||||
navSelector: 'nav[data-group="primary"]',
|
||||
contentSelector: "section.sheet-body",
|
||||
initial: "description",
|
||||
},
|
||||
],
|
||||
dragDrop: [{ dragSelector: "[data-drag]", dropSelector: null }],
|
||||
actions: {
|
||||
editImage: MournbladeItemSheet.#onEditImage,
|
||||
postItem: MournbladeItemSheet.#onPostItem,
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Tab groups state
|
||||
* @type {object}
|
||||
*/
|
||||
tabGroups = { primary: "description" }
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = {
|
||||
fields: this.document.schema.fields,
|
||||
systemFields: this.document.system.schema.fields,
|
||||
item: this.document,
|
||||
system: this.document.system,
|
||||
source: this.document.toObject(),
|
||||
enrichedDescription: await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.document.system.description, { async: true }),
|
||||
isEditMode: true,
|
||||
isEditable: this.isEditable,
|
||||
isGM: game.user.isGM,
|
||||
config: game.system.mournblade.config,
|
||||
}
|
||||
return context
|
||||
}
|
||||
|
||||
/** @override */
|
||||
_onRender(context, options) {
|
||||
super._onRender(context, options)
|
||||
this.#dragDrop.forEach((d) => d.bind(this.element))
|
||||
|
||||
// Activate tab navigation manually
|
||||
const nav = this.element.querySelector('nav.tabs[data-group]')
|
||||
if (nav) {
|
||||
const group = nav.dataset.group
|
||||
// Activate the current tab
|
||||
const activeTab = this.tabGroups[group] || "description"
|
||||
nav.querySelectorAll('[data-tab]').forEach(link => {
|
||||
const tab = link.dataset.tab
|
||||
link.classList.toggle('active', tab === activeTab)
|
||||
link.addEventListener('click', (event) => {
|
||||
event.preventDefault()
|
||||
this.tabGroups[group] = tab
|
||||
this.render()
|
||||
})
|
||||
})
|
||||
|
||||
// Show/hide tab content
|
||||
this.element.querySelectorAll('[data-group="' + group + '"][data-tab]').forEach(content => {
|
||||
content.classList.toggle('active', content.dataset.tab === activeTab)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// #region Drag-and-Drop Workflow
|
||||
/**
|
||||
* Create drag-and-drop workflow handlers for this Application
|
||||
*/
|
||||
#createDragDropHandlers() {
|
||||
return []
|
||||
}
|
||||
|
||||
// #region Actions
|
||||
|
||||
/**
|
||||
* Handle editing the item image
|
||||
* @param {Event} event - The triggering event
|
||||
*/
|
||||
static async #onEditImage(event) {
|
||||
event.preventDefault()
|
||||
const filePicker = new FilePicker({
|
||||
type: "image",
|
||||
current: this.document.img,
|
||||
callback: (path) => {
|
||||
this.document.update({ img: path })
|
||||
},
|
||||
})
|
||||
filePicker.browse()
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle posting the item to chat
|
||||
* @param {Event} event - The triggering event
|
||||
*/
|
||||
static async #onPostItem(event) {
|
||||
event.preventDefault()
|
||||
let chatData = foundry.utils.duplicate(this.document)
|
||||
if (this.document.actor) {
|
||||
chatData.actor = { id: this.document.actor.id }
|
||||
}
|
||||
// Don't post any image for the item if the default image is used
|
||||
if (chatData.img.includes("/blank.png")) {
|
||||
chatData.img = null
|
||||
}
|
||||
// JSON object for easy creation
|
||||
chatData.jsondata = JSON.stringify({
|
||||
compendium: "postedItem",
|
||||
payload: chatData,
|
||||
})
|
||||
|
||||
const html = await renderTemplate('systems/fvtt-mournblade/templates/post-item.hbs', chatData)
|
||||
const chatOptions = {
|
||||
user: game.user.id,
|
||||
content: html,
|
||||
}
|
||||
ChatMessage.create(chatOptions)
|
||||
}
|
||||
}
|
||||
49
modules/applications/sheets/mournblade-arme-sheet.mjs
Normal file
49
modules/applications/sheets/mournblade-arme-sheet.mjs
Normal file
@@ -0,0 +1,49 @@
|
||||
import MournbladeItemSheet from "./base-item-sheet.mjs"
|
||||
|
||||
export default class MournbladeArmeSheet extends MournbladeItemSheet {
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["arme"],
|
||||
position: {
|
||||
width: 620,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["arme-content"],
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
main: {
|
||||
template: "systems/fvtt-mournblade/templates/item-arme-sheet.hbs",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
tabGroups = {
|
||||
primary: "description",
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare an array of form header tabs.
|
||||
* @returns {Record<string, Partial<ApplicationTab>>}
|
||||
*/
|
||||
#getTabs() {
|
||||
const tabs = {
|
||||
details: { id: "details", group: "primary", label: "Détails" },
|
||||
description: { id: "description", group: "primary", label: "Description" }
|
||||
}
|
||||
for (const v of Object.values(tabs)) {
|
||||
v.active = this.tabGroups[v.group] === v.id
|
||||
v.cssClass = v.active ? "active" : ""
|
||||
}
|
||||
return tabs
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
context.tabs = this.#getTabs()
|
||||
return context
|
||||
}
|
||||
}
|
||||
49
modules/applications/sheets/mournblade-bouclier-sheet.mjs
Normal file
49
modules/applications/sheets/mournblade-bouclier-sheet.mjs
Normal file
@@ -0,0 +1,49 @@
|
||||
import MournbladeItemSheet from "./base-item-sheet.mjs"
|
||||
|
||||
export default class MournbladeBouclierSheet extends MournbladeItemSheet {
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["bouclier"],
|
||||
position: {
|
||||
width: 620,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["bouclier-content"],
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
main: {
|
||||
template: "systems/fvtt-mournblade/templates/item-bouclier-sheet.hbs",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
tabGroups = {
|
||||
primary: "description",
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare an array of form header tabs.
|
||||
* @returns {Record<string, Partial<ApplicationTab>>}
|
||||
*/
|
||||
#getTabs() {
|
||||
const tabs = {
|
||||
details: { id: "details", group: "primary", label: "Détails" },
|
||||
description: { id: "description", group: "primary", label: "Description" }
|
||||
}
|
||||
for (const v of Object.values(tabs)) {
|
||||
v.active = this.tabGroups[v.group] === v.id
|
||||
v.cssClass = v.active ? "active" : ""
|
||||
}
|
||||
return tabs
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
context.tabs = this.#getTabs()
|
||||
return context
|
||||
}
|
||||
}
|
||||
49
modules/applications/sheets/mournblade-capacite-sheet.mjs
Normal file
49
modules/applications/sheets/mournblade-capacite-sheet.mjs
Normal file
@@ -0,0 +1,49 @@
|
||||
import MournbladeItemSheet from "./base-item-sheet.mjs"
|
||||
|
||||
export default class MournbladeCapaciteSheet extends MournbladeItemSheet {
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["capacite"],
|
||||
position: {
|
||||
width: 620,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["capacite-content"],
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
main: {
|
||||
template: "systems/fvtt-mournblade/templates/item-capacite-sheet.hbs",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
tabGroups = {
|
||||
primary: "description",
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare an array of form header tabs.
|
||||
* @returns {Record<string, Partial<ApplicationTab>>}
|
||||
*/
|
||||
#getTabs() {
|
||||
const tabs = {
|
||||
details: { id: "details", group: "primary", label: "Détails" },
|
||||
description: { id: "description", group: "primary", label: "Description" }
|
||||
}
|
||||
for (const v of Object.values(tabs)) {
|
||||
v.active = this.tabGroups[v.group] === v.id
|
||||
v.cssClass = v.active ? "active" : ""
|
||||
}
|
||||
return tabs
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
context.tabs = this.#getTabs()
|
||||
return context
|
||||
}
|
||||
}
|
||||
49
modules/applications/sheets/mournblade-competence-sheet.mjs
Normal file
49
modules/applications/sheets/mournblade-competence-sheet.mjs
Normal file
@@ -0,0 +1,49 @@
|
||||
import MournbladeItemSheet from "./base-item-sheet.mjs"
|
||||
|
||||
export default class MournbladeCompetenceSheet extends MournbladeItemSheet {
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["competence"],
|
||||
position: {
|
||||
width: 620,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["competence-content"],
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
main: {
|
||||
template: "systems/fvtt-mournblade/templates/item-competence-sheet.hbs",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
tabGroups = {
|
||||
primary: "description",
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare an array of form header tabs.
|
||||
* @returns {Record<string, Partial<ApplicationTab>>}
|
||||
*/
|
||||
#getTabs() {
|
||||
const tabs = {
|
||||
details: { id: "details", group: "primary", label: "Détails" },
|
||||
description: { id: "description", group: "primary", label: "Description" }
|
||||
}
|
||||
for (const v of Object.values(tabs)) {
|
||||
v.active = this.tabGroups[v.group] === v.id
|
||||
v.cssClass = v.active ? "active" : ""
|
||||
}
|
||||
return tabs
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
context.tabs = this.#getTabs()
|
||||
return context
|
||||
}
|
||||
}
|
||||
43
modules/applications/sheets/mournblade-creature-sheet.mjs
Normal file
43
modules/applications/sheets/mournblade-creature-sheet.mjs
Normal file
@@ -0,0 +1,43 @@
|
||||
import MournbladeActorSheet from "./base-actor-sheet.mjs"
|
||||
|
||||
export default class MournbladeCreatureSheet extends MournbladeActorSheet {
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
...super.DEFAULT_OPTIONS,
|
||||
classes: [...super.DEFAULT_OPTIONS.classes],
|
||||
window: {
|
||||
...super.DEFAULT_OPTIONS.window,
|
||||
title: "SHEETS.Actor.creature",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
sheet: {
|
||||
template: "systems/fvtt-mournblade/templates/creature-sheet.hbs",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
tabGroups = {
|
||||
primary: "stats",
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
const actor = this.document
|
||||
|
||||
// Add creature-specific data
|
||||
context.skills = actor.getSkills()
|
||||
context.armes = foundry.utils.duplicate(actor.getWeapons())
|
||||
context.protections = foundry.utils.duplicate(actor.getArmors())
|
||||
context.runes = foundry.utils.duplicate(actor.getRunes())
|
||||
context.combat = actor.getCombatValues()
|
||||
context.equipements = foundry.utils.duplicate(actor.getEquipments())
|
||||
context.protectionTotal = actor.getProtectionTotal()
|
||||
context.santeMalus = actor.getStatusMalus()
|
||||
context.ameMalus = actor.getAmeMalus()
|
||||
return context
|
||||
}
|
||||
}
|
||||
50
modules/applications/sheets/mournblade-don-sheet.mjs
Normal file
50
modules/applications/sheets/mournblade-don-sheet.mjs
Normal file
@@ -0,0 +1,50 @@
|
||||
import MournbladeItemSheet from "./base-item-sheet.mjs"
|
||||
|
||||
export default class MournbladeDonSheet extends MournbladeItemSheet {
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["don"],
|
||||
position: {
|
||||
width: 620,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["don-content"],
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
main: {
|
||||
template: "systems/fvtt-mournblade/templates/item-don-sheet.hbs",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
tabGroups = {
|
||||
primary: "description",
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare an array of form header tabs.
|
||||
* @returns {Record<string, Partial<ApplicationTab>>}
|
||||
*/
|
||||
#getTabs() {
|
||||
const tabs = {
|
||||
details: { id: "details", group: "primary", label: "Détails" },
|
||||
description: { id: "description", group: "primary", label: "Description" }
|
||||
}
|
||||
for (const v of Object.values(tabs)) {
|
||||
v.active = this.tabGroups[v.group] === v.id
|
||||
v.cssClass = v.active ? "active" : ""
|
||||
}
|
||||
return tabs
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
context.tabs = this.#getTabs()
|
||||
context.enrichedSacrifice = await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.document.system.sacrifice, { async: true })
|
||||
return context
|
||||
}
|
||||
}
|
||||
49
modules/applications/sheets/mournblade-equipement-sheet.mjs
Normal file
49
modules/applications/sheets/mournblade-equipement-sheet.mjs
Normal file
@@ -0,0 +1,49 @@
|
||||
import MournbladeItemSheet from "./base-item-sheet.mjs"
|
||||
|
||||
export default class MournbladeEquipementSheet extends MournbladeItemSheet {
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["equipement"],
|
||||
position: {
|
||||
width: 620,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["equipement-content"],
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
main: {
|
||||
template: "systems/fvtt-mournblade/templates/item-equipement-sheet.hbs",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
tabGroups = {
|
||||
primary: "description",
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare an array of form header tabs.
|
||||
* @returns {Record<string, Partial<ApplicationTab>>}
|
||||
*/
|
||||
#getTabs() {
|
||||
const tabs = {
|
||||
details: { id: "details", group: "primary", label: "Détails" },
|
||||
description: { id: "description", group: "primary", label: "Description" }
|
||||
}
|
||||
for (const v of Object.values(tabs)) {
|
||||
v.active = this.tabGroups[v.group] === v.id
|
||||
v.cssClass = v.active ? "active" : ""
|
||||
}
|
||||
return tabs
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
context.tabs = this.#getTabs()
|
||||
return context
|
||||
}
|
||||
}
|
||||
49
modules/applications/sheets/mournblade-heritage-sheet.mjs
Normal file
49
modules/applications/sheets/mournblade-heritage-sheet.mjs
Normal file
@@ -0,0 +1,49 @@
|
||||
import MournbladeItemSheet from "./base-item-sheet.mjs"
|
||||
|
||||
export default class MournbladeHeritageSheet extends MournbladeItemSheet {
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["heritage"],
|
||||
position: {
|
||||
width: 620,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["heritage-content"],
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
main: {
|
||||
template: "systems/fvtt-mournblade/templates/item-heritage-sheet.hbs",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
tabGroups = {
|
||||
primary: "description",
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare an array of form header tabs.
|
||||
* @returns {Record<string, Partial<ApplicationTab>>}
|
||||
*/
|
||||
#getTabs() {
|
||||
const tabs = {
|
||||
details: { id: "details", group: "primary", label: "Détails" },
|
||||
description: { id: "description", group: "primary", label: "Description" }
|
||||
}
|
||||
for (const v of Object.values(tabs)) {
|
||||
v.active = this.tabGroups[v.group] === v.id
|
||||
v.cssClass = v.active ? "active" : ""
|
||||
}
|
||||
return tabs
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
context.tabs = this.#getTabs()
|
||||
return context
|
||||
}
|
||||
}
|
||||
49
modules/applications/sheets/mournblade-metier-sheet.mjs
Normal file
49
modules/applications/sheets/mournblade-metier-sheet.mjs
Normal file
@@ -0,0 +1,49 @@
|
||||
import MournbladeItemSheet from "./base-item-sheet.mjs"
|
||||
|
||||
export default class MournbladeMetierSheet extends MournbladeItemSheet {
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["metier"],
|
||||
position: {
|
||||
width: 620,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["metier-content"],
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
main: {
|
||||
template: "systems/fvtt-mournblade/templates/item-metier-sheet.hbs",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
tabGroups = {
|
||||
primary: "description",
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare an array of form header tabs.
|
||||
* @returns {Record<string, Partial<ApplicationTab>>}
|
||||
*/
|
||||
#getTabs() {
|
||||
const tabs = {
|
||||
details: { id: "details", group: "primary", label: "Détails" },
|
||||
description: { id: "description", group: "primary", label: "Description" }
|
||||
}
|
||||
for (const v of Object.values(tabs)) {
|
||||
v.active = this.tabGroups[v.group] === v.id
|
||||
v.cssClass = v.active ? "active" : ""
|
||||
}
|
||||
return tabs
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
context.tabs = this.#getTabs()
|
||||
return context
|
||||
}
|
||||
}
|
||||
49
modules/applications/sheets/mournblade-modifier-sheet.mjs
Normal file
49
modules/applications/sheets/mournblade-modifier-sheet.mjs
Normal file
@@ -0,0 +1,49 @@
|
||||
import MournbladeItemSheet from "./base-item-sheet.mjs"
|
||||
|
||||
export default class MournbladeModifierSheet extends MournbladeItemSheet {
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["modifier"],
|
||||
position: {
|
||||
width: 620,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["modifier-content"],
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
main: {
|
||||
template: "systems/fvtt-mournblade/templates/item-modifier-sheet.hbs",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
tabGroups = {
|
||||
primary: "description",
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare an array of form header tabs.
|
||||
* @returns {Record<string, Partial<ApplicationTab>>}
|
||||
*/
|
||||
#getTabs() {
|
||||
const tabs = {
|
||||
details: { id: "details", group: "primary", label: "Détails" },
|
||||
description: { id: "description", group: "primary", label: "Description" }
|
||||
}
|
||||
for (const v of Object.values(tabs)) {
|
||||
v.active = this.tabGroups[v.group] === v.id
|
||||
v.cssClass = v.active ? "active" : ""
|
||||
}
|
||||
return tabs
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
context.tabs = this.#getTabs()
|
||||
return context
|
||||
}
|
||||
}
|
||||
49
modules/applications/sheets/mournblade-monnaie-sheet.mjs
Normal file
49
modules/applications/sheets/mournblade-monnaie-sheet.mjs
Normal file
@@ -0,0 +1,49 @@
|
||||
import MournbladeItemSheet from "./base-item-sheet.mjs"
|
||||
|
||||
export default class MournbladeMonnaieSheet extends MournbladeItemSheet {
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["monnaie"],
|
||||
position: {
|
||||
width: 620,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["monnaie-content"],
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
main: {
|
||||
template: "systems/fvtt-mournblade/templates/item-monnaie-sheet.hbs",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
tabGroups = {
|
||||
primary: "description",
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare an array of form header tabs.
|
||||
* @returns {Record<string, Partial<ApplicationTab>>}
|
||||
*/
|
||||
#getTabs() {
|
||||
const tabs = {
|
||||
details: { id: "details", group: "primary", label: "Détails" },
|
||||
description: { id: "description", group: "primary", label: "Description" }
|
||||
}
|
||||
for (const v of Object.values(tabs)) {
|
||||
v.active = this.tabGroups[v.group] === v.id
|
||||
v.cssClass = v.active ? "active" : ""
|
||||
}
|
||||
return tabs
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
context.tabs = this.#getTabs()
|
||||
return context
|
||||
}
|
||||
}
|
||||
49
modules/applications/sheets/mournblade-origine-sheet.mjs
Normal file
49
modules/applications/sheets/mournblade-origine-sheet.mjs
Normal file
@@ -0,0 +1,49 @@
|
||||
import MournbladeItemSheet from "./base-item-sheet.mjs"
|
||||
|
||||
export default class MournbladeOrigineSheet extends MournbladeItemSheet {
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["origine"],
|
||||
position: {
|
||||
width: 620,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["origine-content"],
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
main: {
|
||||
template: "systems/fvtt-mournblade/templates/item-origine-sheet.hbs",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
tabGroups = {
|
||||
primary: "description",
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare an array of form header tabs.
|
||||
* @returns {Record<string, Partial<ApplicationTab>>}
|
||||
*/
|
||||
#getTabs() {
|
||||
const tabs = {
|
||||
details: { id: "details", group: "primary", label: "Détails" },
|
||||
description: { id: "description", group: "primary", label: "Description" }
|
||||
}
|
||||
for (const v of Object.values(tabs)) {
|
||||
v.active = this.tabGroups[v.group] === v.id
|
||||
v.cssClass = v.active ? "active" : ""
|
||||
}
|
||||
return tabs
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
context.tabs = this.#getTabs()
|
||||
return context
|
||||
}
|
||||
}
|
||||
49
modules/applications/sheets/mournblade-pacte-sheet.mjs
Normal file
49
modules/applications/sheets/mournblade-pacte-sheet.mjs
Normal file
@@ -0,0 +1,49 @@
|
||||
import MournbladeItemSheet from "./base-item-sheet.mjs"
|
||||
|
||||
export default class MournbladePacteSheet extends MournbladeItemSheet {
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["pacte"],
|
||||
position: {
|
||||
width: 620,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["pacte-content"],
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
main: {
|
||||
template: "systems/fvtt-mournblade/templates/item-pacte-sheet.hbs",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
tabGroups = {
|
||||
primary: "description",
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare an array of form header tabs.
|
||||
* @returns {Record<string, Partial<ApplicationTab>>}
|
||||
*/
|
||||
#getTabs() {
|
||||
const tabs = {
|
||||
details: { id: "details", group: "primary", label: "Détails" },
|
||||
description: { id: "description", group: "primary", label: "Description" }
|
||||
}
|
||||
for (const v of Object.values(tabs)) {
|
||||
v.active = this.tabGroups[v.group] === v.id
|
||||
v.cssClass = v.active ? "active" : ""
|
||||
}
|
||||
return tabs
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
context.tabs = this.#getTabs()
|
||||
return context
|
||||
}
|
||||
}
|
||||
57
modules/applications/sheets/mournblade-personnage-sheet.mjs
Normal file
57
modules/applications/sheets/mournblade-personnage-sheet.mjs
Normal file
@@ -0,0 +1,57 @@
|
||||
import MournbladeActorSheet from "./base-actor-sheet.mjs"
|
||||
|
||||
export default class MournbladePersonnageSheet extends MournbladeActorSheet {
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
...super.DEFAULT_OPTIONS,
|
||||
classes: [...super.DEFAULT_OPTIONS.classes],
|
||||
window: {
|
||||
...super.DEFAULT_OPTIONS.window,
|
||||
title: "SHEETS.Actor.personnage",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
sheet: {
|
||||
template: "systems/fvtt-mournblade/templates/actor-sheet.hbs",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
tabGroups = {
|
||||
primary: "principal",
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
const actor = this.document
|
||||
|
||||
// Add personnage-specific data
|
||||
context.skills = actor.getSkills()
|
||||
context.armes = foundry.utils.duplicate(actor.getWeapons())
|
||||
context.protections = foundry.utils.duplicate(actor.getArmors())
|
||||
context.dons = foundry.utils.duplicate(actor.getDons())
|
||||
context.pactes = foundry.utils.duplicate(actor.getPactes())
|
||||
context.alignement = actor.getAlignement()
|
||||
context.aspect = actor.getAspect()
|
||||
context.marge = actor.getMarge()
|
||||
context.tendances = foundry.utils.duplicate(actor.getTendances())
|
||||
context.runes = foundry.utils.duplicate(actor.getRunes())
|
||||
context.traitsChaotiques = foundry.utils.duplicate(actor.getTraitsChaotiques())
|
||||
context.traitsEspeces = foundry.utils.duplicate(actor.getTraitsEspeces())
|
||||
context.origine = foundry.utils.duplicate(actor.getOrigine() || {})
|
||||
context.heritage = foundry.utils.duplicate(actor.getHeritage() || {})
|
||||
context.metier = foundry.utils.duplicate(actor.getMetier() || {})
|
||||
context.combat = actor.getCombatValues()
|
||||
context.equipements = foundry.utils.duplicate(actor.getEquipments())
|
||||
context.modifiers = foundry.utils.duplicate(actor.getModifiers())
|
||||
context.monnaies = foundry.utils.duplicate(actor.getMonnaies())
|
||||
context.runeEffects = foundry.utils.duplicate(actor.getRuneEffects())
|
||||
context.protectionTotal = actor.getProtectionTotal()
|
||||
context.santeMalus = actor.getStatusMalus()
|
||||
context.ameMalus = actor.getAmeMalus()
|
||||
return context
|
||||
}
|
||||
}
|
||||
47
modules/applications/sheets/mournblade-pnj-sheet.mjs
Normal file
47
modules/applications/sheets/mournblade-pnj-sheet.mjs
Normal file
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* Application de feuille de PNJ pour Mournblade
|
||||
*/
|
||||
import MournbladeActorSheet from "./base-actor-sheet.mjs"
|
||||
|
||||
export default class MournbladePnjSheet extends MournbladeActorSheet {
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
...super.DEFAULT_OPTIONS,
|
||||
classes: [...super.DEFAULT_OPTIONS.classes],
|
||||
window: {
|
||||
...super.DEFAULT_OPTIONS.window,
|
||||
title: "SHEETS.Actor.pnj",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
sheet: {
|
||||
template: "systems/fvtt-mournblade/templates/actor-sheet.hbs",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
tabGroups = {
|
||||
primary: "principal",
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
const actor = this.document
|
||||
|
||||
// Add pnj-specific data
|
||||
context.skills = actor.getSkills()
|
||||
context.armes = foundry.utils.duplicate(actor.getWeapons())
|
||||
context.protections = foundry.utils.duplicate(actor.getArmors())
|
||||
context.dons = foundry.utils.duplicate(actor.getDons())
|
||||
context.pactes = foundry.utils.duplicate(actor.getPactes())
|
||||
context.combat = actor.getCombatValues()
|
||||
context.equipements = foundry.utils.duplicate(actor.getEquipments())
|
||||
context.protectionTotal = actor.getProtectionTotal()
|
||||
context.santeMalus = actor.getStatusMalus()
|
||||
context.ameMalus = actor.getAmeMalus()
|
||||
return context
|
||||
}
|
||||
}
|
||||
49
modules/applications/sheets/mournblade-protection-sheet.mjs
Normal file
49
modules/applications/sheets/mournblade-protection-sheet.mjs
Normal file
@@ -0,0 +1,49 @@
|
||||
import MournbladeItemSheet from "./base-item-sheet.mjs"
|
||||
|
||||
export default class MournbladeProtectionSheet extends MournbladeItemSheet {
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["protection"],
|
||||
position: {
|
||||
width: 620,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["protection-content"],
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
main: {
|
||||
template: "systems/fvtt-mournblade/templates/item-protection-sheet.hbs",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
tabGroups = {
|
||||
primary: "description",
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare an array of form header tabs.
|
||||
* @returns {Record<string, Partial<ApplicationTab>>}
|
||||
*/
|
||||
#getTabs() {
|
||||
const tabs = {
|
||||
details: { id: "details", group: "primary", label: "Détails" },
|
||||
description: { id: "description", group: "primary", label: "Description" }
|
||||
}
|
||||
for (const v of Object.values(tabs)) {
|
||||
v.active = this.tabGroups[v.group] === v.id
|
||||
v.cssClass = v.active ? "active" : ""
|
||||
}
|
||||
return tabs
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
context.tabs = this.#getTabs()
|
||||
return context
|
||||
}
|
||||
}
|
||||
49
modules/applications/sheets/mournblade-rune-sheet.mjs
Normal file
49
modules/applications/sheets/mournblade-rune-sheet.mjs
Normal file
@@ -0,0 +1,49 @@
|
||||
import MournbladeItemSheet from "./base-item-sheet.mjs"
|
||||
|
||||
export default class MournbladeRuneSheet extends MournbladeItemSheet {
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["rune"],
|
||||
position: {
|
||||
width: 620,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["rune-content"],
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
main: {
|
||||
template: "systems/fvtt-mournblade/templates/item-rune-sheet.hbs",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
tabGroups = {
|
||||
primary: "description",
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare an array of form header tabs.
|
||||
* @returns {Record<string, Partial<ApplicationTab>>}
|
||||
*/
|
||||
#getTabs() {
|
||||
const tabs = {
|
||||
details: { id: "details", group: "primary", label: "Détails" },
|
||||
description: { id: "description", group: "primary", label: "Description" }
|
||||
}
|
||||
for (const v of Object.values(tabs)) {
|
||||
v.active = this.tabGroups[v.group] === v.id
|
||||
v.cssClass = v.active ? "active" : ""
|
||||
}
|
||||
return tabs
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
context.tabs = this.#getTabs()
|
||||
return context
|
||||
}
|
||||
}
|
||||
49
modules/applications/sheets/mournblade-runeeffect-sheet.mjs
Normal file
49
modules/applications/sheets/mournblade-runeeffect-sheet.mjs
Normal file
@@ -0,0 +1,49 @@
|
||||
import MournbladeItemSheet from "./base-item-sheet.mjs"
|
||||
|
||||
export default class MournbladeRuneEffectSheet extends MournbladeItemSheet {
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["runeeffect"],
|
||||
position: {
|
||||
width: 620,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["runeeffect-content"],
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
main: {
|
||||
template: "systems/fvtt-mournblade/templates/item-runeeffect-sheet.hbs",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
tabGroups = {
|
||||
primary: "description",
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare an array of form header tabs.
|
||||
* @returns {Record<string, Partial<ApplicationTab>>}
|
||||
*/
|
||||
#getTabs() {
|
||||
const tabs = {
|
||||
details: { id: "details", group: "primary", label: "Détails" },
|
||||
description: { id: "description", group: "primary", label: "Description" }
|
||||
}
|
||||
for (const v of Object.values(tabs)) {
|
||||
v.active = this.tabGroups[v.group] === v.id
|
||||
v.cssClass = v.active ? "active" : ""
|
||||
}
|
||||
return tabs
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
context.tabs = this.#getTabs()
|
||||
return context
|
||||
}
|
||||
}
|
||||
49
modules/applications/sheets/mournblade-tendance-sheet.mjs
Normal file
49
modules/applications/sheets/mournblade-tendance-sheet.mjs
Normal file
@@ -0,0 +1,49 @@
|
||||
import MournbladeItemSheet from "./base-item-sheet.mjs"
|
||||
|
||||
export default class MournbladeTendanceSheet extends MournbladeItemSheet {
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["tendance"],
|
||||
position: {
|
||||
width: 620,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["tendance-content"],
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
main: {
|
||||
template: "systems/fvtt-mournblade/templates/item-tendance-sheet.hbs",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
tabGroups = {
|
||||
primary: "description",
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare an array of form header tabs.
|
||||
* @returns {Record<string, Partial<ApplicationTab>>}
|
||||
*/
|
||||
#getTabs() {
|
||||
const tabs = {
|
||||
details: { id: "details", group: "primary", label: "Détails" },
|
||||
description: { id: "description", group: "primary", label: "Description" }
|
||||
}
|
||||
for (const v of Object.values(tabs)) {
|
||||
v.active = this.tabGroups[v.group] === v.id
|
||||
v.cssClass = v.active ? "active" : ""
|
||||
}
|
||||
return tabs
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
context.tabs = this.#getTabs()
|
||||
return context
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
import MournbladeItemSheet from "./base-item-sheet.mjs"
|
||||
|
||||
export default class MournbladeTraitChaotiqueSheet extends MournbladeItemSheet {
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["traitchaotique"],
|
||||
position: {
|
||||
width: 620,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["traitchaotique-content"],
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
main: {
|
||||
template: "systems/fvtt-mournblade/templates/item-traitchaotique-sheet.hbs",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
tabGroups = {
|
||||
primary: "description",
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare an array of form header tabs.
|
||||
* @returns {Record<string, Partial<ApplicationTab>>}
|
||||
*/
|
||||
#getTabs() {
|
||||
const tabs = {
|
||||
details: { id: "details", group: "primary", label: "Détails" },
|
||||
description: { id: "description", group: "primary", label: "Description" }
|
||||
}
|
||||
for (const v of Object.values(tabs)) {
|
||||
v.active = this.tabGroups[v.group] === v.id
|
||||
v.cssClass = v.active ? "active" : ""
|
||||
}
|
||||
return tabs
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
context.tabs = this.#getTabs()
|
||||
return context
|
||||
}
|
||||
}
|
||||
49
modules/applications/sheets/mournblade-traitespece-sheet.mjs
Normal file
49
modules/applications/sheets/mournblade-traitespece-sheet.mjs
Normal file
@@ -0,0 +1,49 @@
|
||||
import MournbladeItemSheet from "./base-item-sheet.mjs"
|
||||
|
||||
export default class MournbladeTraitEspeceSheet extends MournbladeItemSheet {
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["traitespece"],
|
||||
position: {
|
||||
width: 620,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["traitespece-content"],
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
main: {
|
||||
template: "systems/fvtt-mournblade/templates/item-traitespece-sheet.hbs",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
tabGroups = {
|
||||
primary: "description",
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare an array of form header tabs.
|
||||
* @returns {Record<string, Partial<ApplicationTab>>}
|
||||
*/
|
||||
#getTabs() {
|
||||
const tabs = {
|
||||
details: { id: "details", group: "primary", label: "Détails" },
|
||||
description: { id: "description", group: "primary", label: "Description" }
|
||||
}
|
||||
for (const v of Object.values(tabs)) {
|
||||
v.active = this.tabGroups[v.group] === v.id
|
||||
v.cssClass = v.active ? "active" : ""
|
||||
}
|
||||
return tabs
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
context.tabs = this.#getTabs()
|
||||
return context
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user