Import initial

This commit is contained in:
2026-05-02 09:16:24 +02:00
parent e4b91948d2
commit 839b2b606e
76 changed files with 10025 additions and 0 deletions
@@ -0,0 +1,69 @@
const { HandlebarsApplicationMixin } = foundry.applications.api
export default class LesOubliesItemSheet extends HandlebarsApplicationMixin(foundry.applications.sheets.ItemSheetV2) {
static SHEET_MODES = { EDIT: 0, PLAY: 1 }
static DEFAULT_OPTIONS = {
classes: ["fvtt-les-oublies", "sheet", "item"],
position: {
width: 760,
height: 720,
},
window: {
resizable: true,
},
form: {
submitOnChange: true,
closeOnSubmit: false,
},
actions: {
toggleSheet: LesOubliesItemSheet.#onToggleSheet,
editImage: LesOubliesItemSheet.#onEditImage,
},
}
_sheetMode = this.constructor.SHEET_MODES.EDIT
get isEditMode() {
return this._sheetMode === this.constructor.SHEET_MODES.EDIT
}
get isPlayMode() {
return this._sheetMode === this.constructor.SHEET_MODES.PLAY
}
async _prepareContext() {
return {
item: this.document,
system: this.document.system,
source: this.document.toObject(),
fields: this.document.schema.fields,
systemFields: this.document.system.schema.fields,
isEditable: this.isEditable,
isEditMode: this.isEditMode,
isPlayMode: this.isPlayMode,
isGM: game.user.isGM,
config: CONFIG.LESOUBLIES,
enrichedDescription: await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.document.system.description ?? "", { async: true }),
}
}
static #onToggleSheet() {
const modes = this.constructor.SHEET_MODES
this._sheetMode = this.isEditMode ? modes.PLAY : modes.EDIT
this.render()
}
static async #onEditImage(event, target) {
const attr = target.dataset.edit
const current = foundry.utils.getProperty(this.document, attr)
const fp = new FilePicker({
current,
type: "image",
callback: (path) => this.document.update({ [attr]: path }),
top: this.position.top + 40,
left: this.position.left + 10,
})
return fp.browse()
}
}