Migration vers DataModels et appv2

This commit is contained in:
2026-01-10 15:08:28 +01:00
parent 939cfb1e86
commit b113f630bf
75 changed files with 8232 additions and 11 deletions

View File

@@ -0,0 +1,23 @@
/**
* Export all application sheets for Les Héritiers
*/
// Actor Sheets
export { default as HeritiersPersonnageSheet } from './personnage-sheet.mjs';
export { default as HeritiersPnjSheet } from './pnj-sheet.mjs';
// Item Sheets
export { default as HeritiersAccessoireSheet } from './accessoire-sheet.mjs';
export { default as HeritiersArmeSheet } from './arme-sheet.mjs';
export { default as HeritiersAtoutFeeriqueSheet } from './atoutfeerique-sheet.mjs';
export { default as HeritiersAvantageSheet } from './avantage-sheet.mjs';
export { default as HeritiersCapaciteNaturelleSheet } from './capacitenaturelle-sheet.mjs';
export { default as HeritiersCompetenceSheet } from './competence-sheet.mjs';
export { default as HeritiersContactSheet } from './contact-sheet.mjs';
export { default as HeritiersDesavantageSheet } from './desavantage-sheet.mjs';
export { default as HeritiersEquipementSheet } from './equipement-sheet.mjs';
export { default as HeritiersFeeSheet } from './fee-sheet.mjs';
export { default as HeritiersPouvoirSheet } from './pouvoir-sheet.mjs';
export { default as HeritiersProfilSheet } from './profil-sheet.mjs';
export { default as HeritiersProtectionSheet } from './protection-sheet.mjs';
export { default as HeritiersSortSheet } from './sort-sheet.mjs';

View File

@@ -0,0 +1,19 @@
import HeritiersItemSheet from "./base-item-sheet.mjs"
export default class HeritiersAccessoireSheet extends HeritiersItemSheet {
/** @override */
static DEFAULT_OPTIONS = {
...super.DEFAULT_OPTIONS,
window: {
...super.DEFAULT_OPTIONS.window,
title: "SHEETS.Item.accessoire",
},
}
/** @override */
static PARTS = {
sheet: {
template: "systems/fvtt-les-heritiers/templates/item-accessoire-sheet.html",
},
}
}

View File

@@ -0,0 +1,19 @@
import HeritiersItemSheet from "./base-item-sheet.mjs"
export default class HeritiersArmeSheet extends HeritiersItemSheet {
/** @override */
static DEFAULT_OPTIONS = {
...super.DEFAULT_OPTIONS,
window: {
...super.DEFAULT_OPTIONS.window,
title: "SHEETS.Item.arme",
},
}
/** @override */
static PARTS = {
sheet: {
template: "systems/fvtt-les-heritiers/templates/item-arme-sheet.html",
},
}
}

View File

@@ -0,0 +1,19 @@
import HeritiersItemSheet from "./base-item-sheet.mjs"
export default class HeritiersAtoutFeeriqueSheet extends HeritiersItemSheet {
/** @override */
static DEFAULT_OPTIONS = {
...super.DEFAULT_OPTIONS,
window: {
...super.DEFAULT_OPTIONS.window,
title: "SHEETS.Item.atoutfeerique",
},
}
/** @override */
static PARTS = {
sheet: {
template: "systems/fvtt-les-heritiers/templates/item-atoutfeerique-sheet.html",
},
}
}

View File

@@ -0,0 +1,19 @@
import HeritiersItemSheet from "./base-item-sheet.mjs"
export default class HeritiersAvantageSheet extends HeritiersItemSheet {
/** @override */
static DEFAULT_OPTIONS = {
...super.DEFAULT_OPTIONS,
window: {
...super.DEFAULT_OPTIONS.window,
title: "SHEETS.Item.avantage",
},
}
/** @override */
static PARTS = {
sheet: {
template: "systems/fvtt-les-heritiers/templates/item-avantage-sheet.html",
},
}
}

View File

@@ -0,0 +1,618 @@
const { HandlebarsApplicationMixin } = foundry.applications.api
import { HeritiersUtility } from "../../heritiers-utility.js"
export default class HeritiersActorSheet 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
}
#dragDrop
/** @override */
static DEFAULT_OPTIONS = {
classes: ["fvtt-les-heritiers", "sheet", "actor"],
position: {
width: 780,
height: 840,
},
window: {
resizable: true,
},
form: {
submitOnChange: true,
closeOnSubmit: false,
},
dragDrop: [{ dragSelector: ".item-list .item", dropSelector: "form" }],
actions: {
editImage: HeritiersActorSheet.#onEditImage,
toggleSheet: HeritiersActorSheet.#onToggleSheet,
editItem: HeritiersActorSheet.#onEditItem,
deleteItem: HeritiersActorSheet.#onDeleteItem,
createItem: HeritiersActorSheet.#onCreateItem,
equipItem: HeritiersActorSheet.#onEquipItem,
modifyQuantity: HeritiersActorSheet.#onModifyQuantity,
rollInitiative: HeritiersActorSheet.#onRollInitiative,
rollCarac: HeritiersActorSheet.#onRollCarac,
rollRang: HeritiersActorSheet.#onRollRang,
rollRootCompetence: HeritiersActorSheet.#onRollRootCompetence,
rollCompetence: HeritiersActorSheet.#onRollCompetence,
rollSort: HeritiersActorSheet.#onRollSort,
rollAttaqueArme: HeritiersActorSheet.#onRollAttaqueArme,
rollAttaqueBrutaleArme: HeritiersActorSheet.#onRollAttaqueBrutaleArme,
rollAttaqueChargeArme: HeritiersActorSheet.#onRollAttaqueChargeArme,
rollAssomerArme: HeritiersActorSheet.#onRollAssomerArme,
rollPouvoir: HeritiersActorSheet.#onRollPouvoir,
toggleMasque: HeritiersActorSheet.#onToggleMasque,
dialogRecupUsage: HeritiersActorSheet.#onDialogRecupUsage,
},
}
/**
* 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: CONFIG.HERITIERS,
enrichedDescription: await foundry.applications.ux.TextEditor.implementation.enrichHTML(actor.system.biodata?.description || "", { async: true }),
enrichedHabitat: await foundry.applications.ux.TextEditor.implementation.enrichHTML(actor.system.biodata?.habitat || "", { async: true }),
enrichedRevesetranges: await foundry.applications.ux.TextEditor.implementation.enrichHTML(actor.system.biodata?.revesetranges || "", { async: true }),
enrichedSecretsdecouverts: await foundry.applications.ux.TextEditor.implementation.enrichHTML(actor.system.biodata?.secretsdecouverts || "", { async: true }),
enrichedQuestions: await foundry.applications.ux.TextEditor.implementation.enrichHTML(actor.system.biodata?.questions || "", { async: true }),
enrichedPlayernotes: await foundry.applications.ux.TextEditor.implementation.enrichHTML(actor.system.biodata?.playernotes || "", { async: true }),
}
return context
}
/** @override */
_onRender(context, options) {
super._onRender(context, options)
// Activate drag & drop handlers
this.#dragDrop.forEach(d => d.bind(this.element))
// Manual tab navigation
const html = this.element
const tabLinks = html.querySelectorAll('.sheet-tabs a.item[data-tab]')
const tabContents = html.querySelectorAll('.sheet-body .tab[data-group="primary"]')
// Hide all tabs initially
tabContents.forEach(tab => {
tab.classList.remove('active')
tab.style.display = 'none'
})
// Show active tab
const activeTab = this.tabGroups.primary
const activeTabContent = html.querySelector(`.tab[data-group="primary"][data-tab="${activeTab}"]`)
if (activeTabContent) {
activeTabContent.classList.add('active')
activeTabContent.style.display = 'block'
}
// Activate the corresponding nav link
tabLinks.forEach(link => {
if (link.dataset.tab === activeTab) {
link.classList.add('active')
} else {
link.classList.remove('active')
}
})
// Tab click handler
tabLinks.forEach(link => {
link.addEventListener('click', (event) => {
event.preventDefault()
const tab = link.dataset.tab
// Update state
this.tabGroups.primary = tab
// Hide all tabs
tabContents.forEach(t => {
t.classList.remove('active')
t.style.display = 'none'
})
// Show selected tab
const selectedTab = html.querySelector(`.tab[data-group="primary"][data-tab="${tab}"]`)
if (selectedTab) {
selectedTab.classList.add('active')
selectedTab.style.display = 'block'
}
// Update nav links
tabLinks.forEach(l => {
if (l.dataset.tab === tab) {
l.classList.add('active')
} else {
l.classList.remove('active')
}
})
})
})
// Inline item editing
html.querySelectorAll('.edit-item-data').forEach(input => {
input.addEventListener('change', (event) => {
const li = event.target.closest('.item')
const itemId = li?.dataset.itemId
const itemType = li?.dataset.itemType
const itemField = event.target.dataset.itemField
const dataType = event.target.dataset.dtype
const value = event.target.value
if (itemId && itemType && itemField) {
this.actor.editItemField(itemId, itemType, itemField, dataType, value)
}
})
})
}
// #region Drag & Drop
/**
* Create drag-and-drop workflow handlers for this Application
* @returns {DragDrop[]} An array of DragDrop handlers
* @private
*/
#createDragDropHandlers() {
return this.options.dragDrop.map((d) => {
d.permissions = {
dragstart: this._canDragStart.bind(this),
drop: this._canDragDrop.bind(this),
}
d.callbacks = {
dragstart: this._onDragStart.bind(this),
drop: this._onDrop.bind(this),
}
return new foundry.applications.ux.DragDrop(d)
})
}
/**
* Define whether a user is able to begin a dragstart workflow for a given drag selector
* @param {string} selector The candidate HTML selector for dragging
* @returns {boolean} Can the current user drag this selector?
* @protected
*/
_canDragStart(selector) {
return this.isEditable
}
/**
* Define whether a user is able to conclude a drag-and-drop workflow for a given drop selector
* @param {string} selector The candidate HTML selector for the drop target
* @returns {boolean} Can the current user drop on this selector?
* @protected
*/
_canDragDrop(selector) {
return this.isEditable
}
/**
* Callback actions which occur at the beginning of a drag start workflow.
* @param {DragEvent} event The originating DragEvent
* @protected
*/
_onDragStart(event) {
const li = event.currentTarget.closest(".item")
if (!li?.dataset.itemId) return
const item = this.actor.items.get(li.dataset.itemId)
if (!item) return
const dragData = item.toDragData()
event.dataTransfer.setData("text/plain", JSON.stringify(dragData))
}
/**
* Callback actions which occur when a dragged element is dropped on a target.
* @param {DragEvent} event The originating DragEvent
* @protected
*/
async _onDrop(event) {
const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event)
const actor = this.actor
// Handle different data types
switch (data.type) {
case "Item":
return this._onDropItem(event, data)
case "Actor":
return this._onDropActor(event, data)
case "ActiveEffect":
return this._onDropActiveEffect(event, data)
}
}
/**
* Handle dropping an Item on the actor sheet
* @param {DragEvent} event
* @param {object} data
* @private
*/
async _onDropItem(event, data) {
if (!this.actor.isOwner) return false
let item = await fromUuid(data.uuid)
if (item.pack) {
item = await HeritiersUtility.searchItem(item)
}
const itemData = item.toObject ? item.toObject() : item
return this.actor.createEmbeddedDocuments("Item", [itemData])
}
/**
* Handle dropping an Actor on the sheet
* @param {DragEvent} event
* @param {object} data
* @private
*/
async _onDropActor(event, data) {
return false
}
/**
* Handle dropping an ActiveEffect on the sheet
* @param {DragEvent} event
* @param {object} data
* @private
*/
async _onDropActiveEffect(event, data) {
return false
}
// #endregion
// #region Action Handlers
/**
* Toggle between edit and play mode
* @param {Event} event
* @param {HTMLElement} target
* @private
*/
static #onToggleSheet(event, target) {
const wasEditMode = this.isEditMode
this._sheetMode = wasEditMode ? this.constructor.SHEET_MODES.PLAY : this.constructor.SHEET_MODES.EDIT
this.render({ force: true })
}
/**
* Edit the actor image
* @param {Event} event
* @param {HTMLElement} target
* @private
*/
static async #onEditImage(event, target) {
const fp = new FilePicker({
type: "image",
current: this.actor.img,
callback: (path) => {
this.actor.update({ img: path })
},
})
return fp.browse()
}
/**
* Edit an item
* @param {Event} event
* @param {HTMLElement} target
* @private
*/
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)
}
/**
* Delete an item
* @param {Event} event
* @param {HTMLElement} target
* @private
*/
static async #onDeleteItem(event, target) {
const li = target.closest(".item")
await HeritiersUtility.confirmDelete(this, li)
}
/**
* Create a new item
* @param {Event} event
* @param {HTMLElement} target
* @private
*/
static async #onCreateItem(event, target) {
const itemType = target.dataset.type
// Cas spécial pour les sorts avec une compétence spécifique
if (itemType === "sort" && target.dataset.sortCompetence) {
const sortCompetence = target.dataset.sortCompetence
await this.actor.createEmbeddedDocuments('Item', [{
name: `Nouveau ${itemType} de ${sortCompetence}`,
type: itemType,
system: { competence: sortCompetence }
}], { renderSheet: true })
return
}
await this.actor.createEmbeddedDocuments("Item", [{ name: `Nouveau ${itemType}`, type: itemType }], { renderSheet: true })
}
/**
* Equip/unequip an item
* @param {Event} event
* @param {HTMLElement} target
* @private
*/
static async #onEquipItem(event, target) {
const li = target.closest(".item")
const itemId = li?.dataset.itemId
if (itemId) {
await this.actor.equipItem(itemId)
this.render()
}
}
/**
* Modify item quantity
* @param {Event} event
* @param {HTMLElement} target
* @private
*/
static async #onModifyQuantity(event, target) {
const li = target.closest(".item")
const itemId = li?.dataset.itemId
const value = Number(target.dataset.quantiteValue)
if (itemId) {
await this.actor.incDecQuantity(itemId, value)
}
}
/**
* Roll initiative
* @param {Event} event
* @param {HTMLElement} target
* @private
*/
static async #onRollInitiative(event, target) {
await this.actor.rollInitiative()
}
/**
* Roll caractéristique
* @param {Event} event
* @param {HTMLElement} target
* @private
*/
static async #onRollCarac(event, target) {
const key = target.dataset.key
if (key) {
await this.actor.rollCarac(key, false)
}
}
/**
* Roll rang
* @param {Event} event
* @param {HTMLElement} target
* @private
*/
static async #onRollRang(event, target) {
const key = target.dataset.rangKey
if (key) {
await this.actor.rollRang(key)
}
}
/**
* Roll root competence
* @param {Event} event
* @param {HTMLElement} target
* @private
*/
static async #onRollRootCompetence(event, target) {
const compKey = target.dataset.attrKey
if (compKey) {
await this.actor.rollRootCompetence(compKey)
}
}
/**
* Roll competence
* @param {Event} event
* @param {HTMLElement} target
* @private
*/
static async #onRollCompetence(event, target) {
const li = target.closest(".item")
const compId = li?.dataset.itemId
if (compId) {
await this.actor.rollCompetence(compId)
}
}
/**
* Roll sort
* @param {Event} event
* @param {HTMLElement} target
* @private
*/
static async #onRollSort(event, target) {
const li = target.closest(".item")
const sortId = li?.dataset.itemId
if (sortId) {
await this.actor.rollSort(sortId)
}
}
/**
* Roll attaque arme
* @param {Event} event
* @param {HTMLElement} target
* @private
*/
static async #onRollAttaqueArme(event, target) {
const li = target.closest(".item")
const armeId = li?.dataset.itemId
if (armeId) {
await this.actor.rollAttaqueArme(armeId)
}
}
/**
* Roll attaque brutale arme
* @param {Event} event
* @param {HTMLElement} target
* @private
*/
static async #onRollAttaqueBrutaleArme(event, target) {
const li = target.closest(".item")
const armeId = li?.dataset.itemId
if (armeId) {
await this.actor.rollAttaqueBrutaleArme(armeId)
}
}
/**
* Roll attaque charge arme
* @param {Event} event
* @param {HTMLElement} target
* @private
*/
static async #onRollAttaqueChargeArme(event, target) {
const li = target.closest(".item")
const armeId = li?.dataset.itemId
if (armeId) {
await this.actor.rollAttaqueChargeArme(armeId)
}
}
/**
* Roll assomer arme
* @param {Event} event
* @param {HTMLElement} target
* @private
*/
static async #onRollAssomerArme(event, target) {
const li = target.closest(".item")
const armeId = li?.dataset.itemId
if (armeId) {
await this.actor.rollAssomerArme(armeId)
}
}
/**
* Roll pouvoir
* @param {Event} event
* @param {HTMLElement} target
* @private
*/
static async #onRollPouvoir(event, target) {
const li = target.closest(".item")
const pouvoirId = li?.dataset.itemId
if (pouvoirId) {
await this.actor.rollPouvoir(pouvoirId)
}
}
/**
* Toggle masque
* @param {Event} event
* @param {HTMLElement} target
* @private
*/
static async #onToggleMasque(event, target) {
await this.actor.toggleMasqueStatut()
this.render()
}
/**
* Dialog récupération usage
* @param {Event} event
* @param {HTMLElement} target
* @private
*/
static async #onDialogRecupUsage(event, target) {
new Dialog({
title: "Récupération des Points d'Usage",
content: "<p>Combien de Points d'Usage souhaitez-vous récupérer ?</p>",
buttons: {
one: {
icon: '<i class="fas fa-check"></i>',
label: "1 Point",
callback: () => {
this.actor.recupUsage(1)
}
},
two: {
icon: '<i class="fas fa-check"></i>',
label: "2 Points",
callback: () => {
this.actor.recupUsage(2)
}
},
three: {
icon: '<i class="fas fa-check"></i>',
label: "3 Points",
callback: () => {
this.actor.recupUsage(3)
}
},
cancel: {
icon: '<i class="fas fa-times"></i>',
label: "Annuler"
}
},
default: "one"
}).render(true)
}
// #endregion
}

View File

@@ -0,0 +1,212 @@
const { HandlebarsApplicationMixin } = foundry.applications.api
export default class HeritiersItemSheet extends HandlebarsApplicationMixin(foundry.applications.sheets.ItemSheetV2) {
constructor(options = {}) {
super(options)
this.#dragDrop = this.#createDragDropHandlers()
}
#dragDrop
/** @override */
static DEFAULT_OPTIONS = {
classes: ["fvtt-les-heritiers", "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: HeritiersItemSheet.#onEditImage,
postItem: HeritiersItemSheet.#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: CONFIG.HERITIERS,
}
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
* @returns {DragDrop[]} An array of DragDrop handlers
* @private
*/
#createDragDropHandlers() {
return this.options.dragDrop.map((d) => {
d.permissions = {
dragstart: this._canDragStart.bind(this),
drop: this._canDragDrop.bind(this),
}
d.callbacks = {
dragstart: this._onDragStart.bind(this),
dragover: this._onDragOver.bind(this),
drop: this._onDrop.bind(this),
}
return new foundry.applications.ux.DragDrop(d)
})
}
/**
* Can the User start a drag workflow for a given drag selector?
* @param {string} selector The candidate HTML selector for the drag event
* @returns {boolean} Can the current user drag this selector?
* @protected
*/
_canDragStart(selector) {
return this.isEditable
}
/**
* Can the User drop an entry at a given drop selector?
* @param {string} selector The candidate HTML selector for the drop event
* @returns {boolean} Can the current user drop on this selector?
* @protected
*/
_canDragDrop(selector) {
return this.isEditable
}
/**
* Callback for dragstart events.
* @param {DragEvent} event The drag start event
* @protected
*/
_onDragStart(event) {
const target = event.currentTarget
const dragData = { type: "Item", uuid: this.document.uuid }
event.dataTransfer.setData("text/plain", JSON.stringify(dragData))
}
/**
* Callback for dragover events.
* @param {DragEvent} event The drag over event
* @protected
*/
_onDragOver(event) {
// Default behavior is fine
}
/**
* Callback for drop events.
* @param {DragEvent} event The drop event
* @protected
*/
async _onDrop(event) {
const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event)
const item = await fromUuid(data.uuid)
if (!item) return
console.log("Item dropped:", item)
}
// #endregion
// #region Action Handlers
/**
* Edit the item image
* @param {Event} event The triggering event
* @param {HTMLElement} target The target element
* @private
*/
static async #onEditImage(event, target) {
const fp = new FilePicker({
type: "image",
current: this.document.img,
callback: (path) => {
this.document.update({ img: path })
},
})
return fp.browse()
}
/**
* Post item to chat
* @param {Event} event The triggering event
* @param {HTMLElement} target The target element
* @private
*/
static async #onPostItem(event, target) {
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.includes("/mystery-man")) {
chatData.img = null
}
// JSON object for easy creation
chatData.jsondata = JSON.stringify({
compendium: "postedItem",
payload: chatData,
})
const html = await renderTemplate('systems/fvtt-les-heritiers/templates/post-item.html', chatData)
const chatOptions = {
user: game.user.id,
content: html,
}
ChatMessage.create(chatOptions)
}
// #endregion
}

View File

@@ -0,0 +1,19 @@
import HeritiersItemSheet from "./base-item-sheet.mjs"
export default class HeritiersCapaciteNaturelleSheet extends HeritiersItemSheet {
/** @override */
static DEFAULT_OPTIONS = {
...super.DEFAULT_OPTIONS,
window: {
...super.DEFAULT_OPTIONS.window,
title: "SHEETS.Item.capacitenaturelle",
},
}
/** @override */
static PARTS = {
sheet: {
template: "systems/fvtt-les-heritiers/templates/item-capacitenaturelle-sheet.html",
},
}
}

View File

@@ -0,0 +1,19 @@
import HeritiersItemSheet from "./base-item-sheet.mjs"
export default class HeritiersCompetenceSheet extends HeritiersItemSheet {
/** @override */
static DEFAULT_OPTIONS = {
...super.DEFAULT_OPTIONS,
window: {
...super.DEFAULT_OPTIONS.window,
title: "SHEETS.Item.competence",
},
}
/** @override */
static PARTS = {
sheet: {
template: "systems/fvtt-les-heritiers/templates/item-competence-sheet.html",
},
}
}

View File

@@ -0,0 +1,19 @@
import HeritiersItemSheet from "./base-item-sheet.mjs"
export default class HeritiersContactSheet extends HeritiersItemSheet {
/** @override */
static DEFAULT_OPTIONS = {
...super.DEFAULT_OPTIONS,
window: {
...super.DEFAULT_OPTIONS.window,
title: "SHEETS.Item.contact",
},
}
/** @override */
static PARTS = {
sheet: {
template: "systems/fvtt-les-heritiers/templates/item-contact-sheet.html",
},
}
}

View File

@@ -0,0 +1,19 @@
import HeritiersItemSheet from "./base-item-sheet.mjs"
export default class HeritiersDesavantageSheet extends HeritiersItemSheet {
/** @override */
static DEFAULT_OPTIONS = {
...super.DEFAULT_OPTIONS,
window: {
...super.DEFAULT_OPTIONS.window,
title: "SHEETS.Item.desavantage",
},
}
/** @override */
static PARTS = {
sheet: {
template: "systems/fvtt-les-heritiers/templates/item-desavantage-sheet.html",
},
}
}

View File

@@ -0,0 +1,19 @@
import HeritiersItemSheet from "./base-item-sheet.mjs"
export default class HeritiersEquipementSheet extends HeritiersItemSheet {
/** @override */
static DEFAULT_OPTIONS = {
...super.DEFAULT_OPTIONS,
window: {
...super.DEFAULT_OPTIONS.window,
title: "SHEETS.Item.equipement",
},
}
/** @override */
static PARTS = {
sheet: {
template: "systems/fvtt-les-heritiers/templates/item-equipement-sheet.html",
},
}
}

View File

@@ -0,0 +1,19 @@
import HeritiersItemSheet from "./base-item-sheet.mjs"
export default class HeritiersFeeSheet extends HeritiersItemSheet {
/** @override */
static DEFAULT_OPTIONS = {
...super.DEFAULT_OPTIONS,
window: {
...super.DEFAULT_OPTIONS.window,
title: "SHEETS.Item.fee",
},
}
/** @override */
static PARTS = {
sheet: {
template: "systems/fvtt-les-heritiers/templates/item-fee-sheet.html",
},
}
}

View File

@@ -0,0 +1,59 @@
import HeritiersActorSheet from "./base-actor-sheet.mjs"
export default class HeritiersPersonnageSheet extends HeritiersActorSheet {
/** @override */
static DEFAULT_OPTIONS = {
...super.DEFAULT_OPTIONS,
classes: [...super.DEFAULT_OPTIONS.classes],
window: {
...super.DEFAULT_OPTIONS.window,
title: "SHEETS.Actor.personnage",
},
actions: {
...super.DEFAULT_OPTIONS.actions,
},
}
/** @override */
static PARTS = {
sheet: {
template: "systems/fvtt-les-heritiers/templates/actor-sheet.html",
},
}
/** @override */
tabGroups = { primary: "stats" }
/** @override */
async _prepareContext() {
const context = await super._prepareContext()
const actor = this.document
// Add personnage-specific data
context.skills = actor.getSkills()
context.utileSkillsMental = actor.organizeUtileSkills("mental")
context.utileSkillsPhysical = actor.organizeUtileSkills("physical")
context.competencesMagie = game.system.lesheritiers.config.competencesMagie || []
context.futileSkills = actor.organizeFutileSkills()
context.contacts = actor.organizeContacts()
context.armes = foundry.utils.duplicate(actor.getWeapons())
context.monnaies = foundry.utils.duplicate(actor.getMonnaies())
context.pouvoirs = foundry.utils.duplicate(actor.getPouvoirs())
context.fee = foundry.utils.duplicate(actor.getFee() || {})
context.protections = foundry.utils.duplicate(actor.getArmors())
context.combat = actor.getCombatValues()
context.equipements = foundry.utils.duplicate(actor.getEquipments())
context.avantages = foundry.utils.duplicate(actor.getAvantages())
context.atouts = foundry.utils.duplicate(actor.getAtouts())
context.capacites = foundry.utils.duplicate(actor.getCapacites())
context.desavantages = foundry.utils.duplicate(actor.getDesavantages())
context.profils = foundry.utils.duplicate(actor.getProfils())
context.pvMalus = actor.getPvMalus()
context.heritage = game.settings.get("fvtt-les-heritiers", "heritiers-heritage")
context.initiative = actor.getFlag("world", "last-initiative") || -1
context.magieList = actor.prepareMagie()
context.isPNJ = false
return context
}
}

View File

@@ -0,0 +1,59 @@
import HeritiersActorSheet from "./base-actor-sheet.mjs"
export default class HeritiersPnjSheet extends HeritiersActorSheet {
/** @override */
static DEFAULT_OPTIONS = {
...super.DEFAULT_OPTIONS,
classes: [...super.DEFAULT_OPTIONS.classes],
window: {
...super.DEFAULT_OPTIONS.window,
title: "SHEETS.Actor.pnj",
},
actions: {
...super.DEFAULT_OPTIONS.actions,
},
}
/** @override */
static PARTS = {
sheet: {
template: "systems/fvtt-les-heritiers/templates/actor-pnj-sheet.html",
},
}
/** @override */
tabGroups = { primary: "stats" }
/** @override */
async _prepareContext() {
const context = await super._prepareContext()
const actor = this.document
// Add PNJ-specific data
context.skills = actor.getSkills()
context.utileSkillsMental = actor.organizeUtileSkills("mental")
context.utileSkillsPhysical = actor.organizeUtileSkills("physical")
context.competencesMagie = game.system.lesheritiers.config.competencesMagie || []
context.futileSkills = actor.organizeFutileSkills()
context.contacts = actor.organizeContacts()
context.armes = foundry.utils.duplicate(actor.getWeapons())
context.monnaies = foundry.utils.duplicate(actor.getMonnaies())
context.pouvoirs = foundry.utils.duplicate(actor.getPouvoirs())
context.fee = foundry.utils.duplicate(actor.getFee() || {})
context.protections = foundry.utils.duplicate(actor.getArmors())
context.combat = actor.getCombatValues()
context.equipements = foundry.utils.duplicate(actor.getEquipments())
context.avantages = foundry.utils.duplicate(actor.getAvantages())
context.atouts = foundry.utils.duplicate(actor.getAtouts())
context.capacites = foundry.utils.duplicate(actor.getCapacites())
context.desavantages = foundry.utils.duplicate(actor.getDesavantages())
context.profils = foundry.utils.duplicate(actor.getProfils())
context.pvMalus = actor.getPvMalus()
context.heritage = game.settings.get("fvtt-les-heritiers", "heritiers-heritage")
context.initiative = actor.getFlag("world", "last-initiative") || -1
context.magieList = actor.prepareMagie()
context.isPNJ = true
return context
}
}

View File

@@ -0,0 +1,19 @@
import HeritiersItemSheet from "./base-item-sheet.mjs"
export default class HeritiersPouvoirSheet extends HeritiersItemSheet {
/** @override */
static DEFAULT_OPTIONS = {
...super.DEFAULT_OPTIONS,
window: {
...super.DEFAULT_OPTIONS.window,
title: "SHEETS.Item.pouvoir",
},
}
/** @override */
static PARTS = {
sheet: {
template: "systems/fvtt-les-heritiers/templates/item-pouvoir-sheet.html",
},
}
}

View File

@@ -0,0 +1,19 @@
import HeritiersItemSheet from "./base-item-sheet.mjs"
export default class HeritiersProfilSheet extends HeritiersItemSheet {
/** @override */
static DEFAULT_OPTIONS = {
...super.DEFAULT_OPTIONS,
window: {
...super.DEFAULT_OPTIONS.window,
title: "SHEETS.Item.profil",
},
}
/** @override */
static PARTS = {
sheet: {
template: "systems/fvtt-les-heritiers/templates/item-profil-sheet.html",
},
}
}

View File

@@ -0,0 +1,19 @@
import HeritiersItemSheet from "./base-item-sheet.mjs"
export default class HeritiersProtectionSheet extends HeritiersItemSheet {
/** @override */
static DEFAULT_OPTIONS = {
...super.DEFAULT_OPTIONS,
window: {
...super.DEFAULT_OPTIONS.window,
title: "SHEETS.Item.protection",
},
}
/** @override */
static PARTS = {
sheet: {
template: "systems/fvtt-les-heritiers/templates/item-protection-sheet.html",
},
}
}

View File

@@ -0,0 +1,19 @@
import HeritiersItemSheet from "./base-item-sheet.mjs"
export default class HeritiersSortSheet extends HeritiersItemSheet {
/** @override */
static DEFAULT_OPTIONS = {
...super.DEFAULT_OPTIONS,
window: {
...super.DEFAULT_OPTIONS.window,
title: "SHEETS.Item.sort",
},
}
/** @override */
static PARTS = {
sheet: {
template: "systems/fvtt-les-heritiers/templates/item-sort-sheet.html",
},
}
}