Start SheetV2 & fields
This commit is contained in:
parent
78e30b5503
commit
da1719a336
3
module/applications/sheets/_module.mjs
Normal file
3
module/applications/sheets/_module.mjs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export { default as RdDItemSheet} from "./common-item-sheet.mjs"
|
||||||
|
export { default as RdDMonnaieSheet } from "./monnaie-sheet.mjs"
|
||||||
|
export { default as RdDMunitionSheet } from "./munition-sheet.mjs"
|
200
module/applications/sheets/common-item-sheet.mjs
Normal file
200
module/applications/sheets/common-item-sheet.mjs
Normal file
@ -0,0 +1,200 @@
|
|||||||
|
const { HandlebarsApplicationMixin } = foundry.applications.api
|
||||||
|
import { SYSTEM_RDD } from "../../constants.js"
|
||||||
|
import { Misc } from "../../misc.js"
|
||||||
|
|
||||||
|
export default class RdDItemSheet extends HandlebarsApplicationMixin(foundry.applications.sheets.ItemSheetV2) {
|
||||||
|
|
||||||
|
static register(sheetClass) {
|
||||||
|
const itemType = sheetClass.ITEM_TYPE
|
||||||
|
Items.registerSheet(SYSTEM_RDD, sheetClass, {
|
||||||
|
label: Misc.typeName('Item', itemType),
|
||||||
|
types: [itemType],
|
||||||
|
makeDefault: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
static get ITEM_TYPE() { return undefined }
|
||||||
|
/**
|
||||||
|
* Different sheet modes.
|
||||||
|
* @enum {number}
|
||||||
|
*/
|
||||||
|
static SHEET_MODES = { EDIT: 0, PLAY: 1 }
|
||||||
|
|
||||||
|
constructor(options = {}) {
|
||||||
|
super(options)
|
||||||
|
this.#dragDrop = this.#createDragDropHandlers()
|
||||||
|
}
|
||||||
|
|
||||||
|
#dragDrop
|
||||||
|
_sheetMode = this.constructor.SHEET_MODES.PLAY
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static DEFAULT_OPTIONS = {
|
||||||
|
classes: ["fvtt-rdd", "item"],
|
||||||
|
position: {
|
||||||
|
width: 600,
|
||||||
|
height: "auto",
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
submitOnChange: true,
|
||||||
|
},
|
||||||
|
window: {
|
||||||
|
resizable: true,
|
||||||
|
},
|
||||||
|
dragDrop: [{ dragSelector: "[data-drag]", dropSelector: null }],
|
||||||
|
actions: {
|
||||||
|
toggleSheet: RdDItemSheet.#onToggleSheet,
|
||||||
|
editImage: RdDItemSheet.#onEditImage,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the sheet currently in 'Play' mode?
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
get isPlayMode() {
|
||||||
|
return this._sheetMode === this.constructor.SHEET_MODES.PLAY
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the sheet currently in 'Edit' mode?
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
get isEditMode() {
|
||||||
|
return this._sheetMode === this.constructor.SHEET_MODES.EDIT
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @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(),
|
||||||
|
isEditMode: this.isEditMode,
|
||||||
|
isPlayMode: this.isPlayMode,
|
||||||
|
isEditable: this.isEditable,
|
||||||
|
}
|
||||||
|
return context
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
_onRender(context, options) {
|
||||||
|
this.#dragDrop.forEach((d) => d.bind(this.element))
|
||||||
|
}
|
||||||
|
|
||||||
|
// #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 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 && this.document.isOwner
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback actions which occur at the beginning of a drag start workflow.
|
||||||
|
* @param {DragEvent} event The originating DragEvent
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
_onDragStart(event) {
|
||||||
|
const el = event.currentTarget
|
||||||
|
if ("link" in event.target.dataset) return
|
||||||
|
|
||||||
|
// Extract the data you need
|
||||||
|
let dragData = null
|
||||||
|
|
||||||
|
if (!dragData) return
|
||||||
|
|
||||||
|
// Set data transfer
|
||||||
|
event.dataTransfer.setData("text/plain", JSON.stringify(dragData))
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback actions which occur when a dragged element is over a drop target.
|
||||||
|
* @param {DragEvent} event The originating DragEvent
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
_onDragOver(event) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback actions which occur when a dragged element is dropped on a target.
|
||||||
|
* @param {DragEvent} event The originating DragEvent
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
async _onDrop(event) { }
|
||||||
|
|
||||||
|
// #endregion
|
||||||
|
|
||||||
|
// #region Actions
|
||||||
|
/**
|
||||||
|
* Handle toggling between Edit and Play mode.
|
||||||
|
* @param {Event} event The initiating click event.
|
||||||
|
* @param {HTMLElement} target The current target of the event listener.
|
||||||
|
*/
|
||||||
|
static #onToggleSheet(event, target) {
|
||||||
|
const modes = this.constructor.SHEET_MODES
|
||||||
|
this._sheetMode = this.isEditMode ? modes.PLAY : modes.EDIT
|
||||||
|
this.render()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle changing a Document's image.
|
||||||
|
*
|
||||||
|
* @this RdDItemSheet
|
||||||
|
* @param {PointerEvent} event The originating click event
|
||||||
|
* @param {HTMLElement} target The capturing HTML element which defined a [data-action]
|
||||||
|
* @returns {Promise}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
static async #onEditImage(event, target) {
|
||||||
|
const attr = target.dataset.edit
|
||||||
|
const current = foundry.utils.getProperty(this.document, attr)
|
||||||
|
const { img } = this.document.constructor.getDefaultArtwork?.(this.document.toObject()) ?? {}
|
||||||
|
const fp = new FilePicker({
|
||||||
|
current,
|
||||||
|
type: "image",
|
||||||
|
redirectToRoot: img ? [img] : [],
|
||||||
|
callback: (path) => {
|
||||||
|
this.document.update({ [attr]: path })
|
||||||
|
},
|
||||||
|
top: this.position.top + 40,
|
||||||
|
left: this.position.left + 10,
|
||||||
|
})
|
||||||
|
return fp.browse()
|
||||||
|
}
|
||||||
|
// #endregion
|
||||||
|
}
|
35
module/applications/sheets/monnaie-sheet.mjs
Normal file
35
module/applications/sheets/monnaie-sheet.mjs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import { TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE } from "../../common/_module.mjs";
|
||||||
|
import { ITEM_TYPES } from "../../constants.js";
|
||||||
|
import RdDItemSheet from "./common-item-sheet.mjs";
|
||||||
|
|
||||||
|
export default class RdDMonnaieSheet extends RdDItemSheet {
|
||||||
|
/** @override */
|
||||||
|
static get ITEM_TYPE() { return ITEM_TYPES.monnaie }
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static DEFAULT_OPTIONS = {
|
||||||
|
classes: ["fvtt-rdd", "item", "monnaie"],
|
||||||
|
position: {
|
||||||
|
width: 600,
|
||||||
|
},
|
||||||
|
window: {
|
||||||
|
contentClasses: ["monnaie-content"],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static PARTS = {
|
||||||
|
main: {
|
||||||
|
template: "systems/foundryvtt-reve-de-dragon/templates/item/monnaie.hbs",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
async _prepareContext() {
|
||||||
|
const context = await super._prepareContext()
|
||||||
|
return Object.assign(context,
|
||||||
|
await TEMPLATE_DESCRIPTION.prepareContext(this.item),
|
||||||
|
await TEMPLATE_INVENTAIRE.prepareContext(this.item)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
35
module/applications/sheets/munition-sheet.mjs
Normal file
35
module/applications/sheets/munition-sheet.mjs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import { TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE } from "../../common/_module.mjs";
|
||||||
|
import { ITEM_TYPES } from "../../constants.js";
|
||||||
|
import RdDItemSheet from "./common-item-sheet.mjs";
|
||||||
|
|
||||||
|
export default class RdDMunitionSheet extends RdDItemSheet {
|
||||||
|
/** @override */
|
||||||
|
static get ITEM_TYPE() { return ITEM_TYPES.munition }
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static DEFAULT_OPTIONS = {
|
||||||
|
classes: ["fvtt-rdd", "item", "munition"],
|
||||||
|
position: {
|
||||||
|
width: 600,
|
||||||
|
},
|
||||||
|
window: {
|
||||||
|
contentClasses: ["munition-content"],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static PARTS = {
|
||||||
|
main: {
|
||||||
|
template: "systems/foundryvtt-reve-de-dragon/templates/item/munition.hbs",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
async _prepareContext() {
|
||||||
|
const context = await super._prepareContext()
|
||||||
|
return Object.assign(context,
|
||||||
|
await TEMPLATE_DESCRIPTION.prepareContext(this.item),
|
||||||
|
await TEMPLATE_INVENTAIRE.prepareContext(this.item)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
7
module/common/_module.mjs
Normal file
7
module/common/_module.mjs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import { CommonDescription } from "./description.mjs";
|
||||||
|
import { CommonInventaire } from "./inventaire.mjs";
|
||||||
|
|
||||||
|
export const TEMPLATE_DESCRIPTION = new CommonDescription()
|
||||||
|
export const TEMPLATE_INVENTAIRE = new CommonInventaire()
|
||||||
|
|
||||||
|
|
8
module/common/common-template.mjs
Normal file
8
module/common/common-template.mjs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* class describing common methods implemented by template parts,
|
||||||
|
* used for sheet/models/documents
|
||||||
|
*/
|
||||||
|
export default class CommonTemplate {
|
||||||
|
fields() { }
|
||||||
|
async prepareContext(item) { }
|
||||||
|
}
|
22
module/common/description.mjs
Normal file
22
module/common/description.mjs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import { RdDTextEditor } from "../apps/rdd-text-roll-editor.js"
|
||||||
|
import CommonTemplate from "./common-template.mjs"
|
||||||
|
import { HTMLSTRING } from "./field-types.mjs"
|
||||||
|
|
||||||
|
const fields = foundry.data.fields
|
||||||
|
|
||||||
|
export class CommonDescription extends CommonTemplate {
|
||||||
|
fields() {
|
||||||
|
return {
|
||||||
|
description: new fields.HTMLField({ ...HTMLSTRING }),
|
||||||
|
descriptionmj: new fields.HTMLField({ gmOnly: true, ...HTMLSTRING })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async prepareContext(item) {
|
||||||
|
return {
|
||||||
|
description: await RdDTextEditor.enrichHTML(item.system.description, item),
|
||||||
|
descriptionmj: await RdDTextEditor.enrichHTML(item.system.descriptionmj, item),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
9
module/common/field-types.mjs
Normal file
9
module/common/field-types.mjs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
export const INTEGER = { required: true, nullable: false, min: 0, integer: true }
|
||||||
|
export const DECIMAL = { required: true, nullable: false, min: 0, integer: false } /* TODO: validation de nombre décimales?*/
|
||||||
|
export const INTEGER_SIGNED = { required: true, nullable: false, integer: true }
|
||||||
|
export const DECIMAL_SIGNED = { required: true, nullable: false, integer: false }
|
||||||
|
export const STRING = { required: true, nullable: false, blank: true, trim: true }
|
||||||
|
export const HTMLSTRING = { initial: "", required: true, nullable: false, blank: true, trim: false, textSearch: true }
|
||||||
|
|
||||||
|
export const MODEL_ARRAY = { initial: [], required: true, nullable: false }
|
||||||
|
|
28
module/common/inventaire.mjs
Normal file
28
module/common/inventaire.mjs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import CommonTemplate from "./common-template.mjs"
|
||||||
|
import { RARETES } from "../item/raretes.js"
|
||||||
|
import { DECIMAL, INTEGER, INTEGER_SIGNED, MODEL_ARRAY, STRING } from "./field-types.mjs"
|
||||||
|
|
||||||
|
const fields = foundry.data.fields
|
||||||
|
|
||||||
|
export class CommonInventaire extends CommonTemplate {
|
||||||
|
fields() {
|
||||||
|
return {
|
||||||
|
encombrement: new fields.NumberField({ label: "Encombrement", initial: 0, ...INTEGER }),
|
||||||
|
quantite: new fields.NumberField({ label: "Quantité", initial: 1, ...INTEGER }),
|
||||||
|
qualite: new fields.NumberField({ label: "Qualité", initial: 0, ...INTEGER_SIGNED }),
|
||||||
|
cout: new fields.NumberField({ label: "Coût", initial: 0.0, ...DECIMAL }),
|
||||||
|
environnement: new fields.ArrayField(
|
||||||
|
new fields.SchemaField({
|
||||||
|
milieu: new fields.StringField({ label: "Milieu", initial: "", ...STRING }),
|
||||||
|
rarete: new fields.StringField({
|
||||||
|
label: "Rareté", initial: RARETES[0].code, ...STRING,
|
||||||
|
validate: (value, options) => RARETES.find(it => it.code == value)
|
||||||
|
}),
|
||||||
|
frequence: new fields.NumberField({ label: "Fréquence", initial: RARETES[0].frequence, ...INTEGER }),
|
||||||
|
}),
|
||||||
|
{ label: "Environnement", ...MODEL_ARRAY }),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async prepareContext(item) {
|
||||||
|
}
|
||||||
|
}
|
2
module/documents/_module.mjs
Normal file
2
module/documents/_module.mjs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export { default as RdDModelMonnaie } from "./monnaie.mjs"
|
||||||
|
export { default as RdDModelMunition } from "./munition.mjs"
|
7
module/documents/monnaie.mjs
Normal file
7
module/documents/monnaie.mjs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import { RdDItem } from "../item.js";
|
||||||
|
|
||||||
|
export default class RdDItemMonnaie extends RdDItem {
|
||||||
|
static get defaultIcon() {
|
||||||
|
return 'systems/foundryvtt-reve-de-dragon/icons/objets/piece_etain_poisson.webp'
|
||||||
|
}
|
||||||
|
}
|
7
module/documents/munition.mjs
Normal file
7
module/documents/munition.mjs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import { RdDItem } from "../item.js";
|
||||||
|
|
||||||
|
export default class RdDItemMunition extends RdDItem {
|
||||||
|
static get defaultIcon() {
|
||||||
|
return 'systems/foundryvtt-reve-de-dragon/icons/objets/fleche.webp'
|
||||||
|
}
|
||||||
|
}
|
@ -14,12 +14,11 @@ import { RdDItem } from "./item.js";
|
|||||||
import { FLEUVE_COORD, TMRUtility } from "./tmr-utility.js";
|
import { FLEUVE_COORD, TMRUtility } from "./tmr-utility.js";
|
||||||
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
|
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
|
||||||
import { ItemAction } from "./item/item-actions.js";
|
import { ItemAction } from "./item/item-actions.js";
|
||||||
import { RdDItemGemme } from "./item/gemme.js";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extend the basic ItemSheet for RdD specific items
|
* Extend the basic ItemSheet for RdD specific items
|
||||||
*/
|
*/
|
||||||
export class RdDItemSheet extends ItemSheet {
|
export class RdDItemSheetV1 extends ItemSheet {
|
||||||
|
|
||||||
static get ITEM_TYPE() {
|
static get ITEM_TYPE() {
|
||||||
return undefined
|
return undefined
|
||||||
@ -43,7 +42,7 @@ export class RdDItemSheet extends ItemSheet {
|
|||||||
static get defaultOptions() {
|
static get defaultOptions() {
|
||||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||||
classes: [SYSTEM_RDD, "sheet", "item"],
|
classes: [SYSTEM_RDD, "sheet", "item"],
|
||||||
template: RdDItemSheet.defaultTemplate(RdDItemSheet.ITEM_TYPE),
|
template: RdDItemSheetV1.defaultTemplate(RdDItemSheetV1.ITEM_TYPE),
|
||||||
width: 550,
|
width: 550,
|
||||||
height: 550
|
height: 550
|
||||||
}, { inplace: false });
|
}, { inplace: false });
|
||||||
@ -51,7 +50,7 @@ export class RdDItemSheet extends ItemSheet {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
get template() {
|
get template() {
|
||||||
return RdDItemSheet.defaultTemplate(this.item.type);
|
return RdDItemSheetV1.defaultTemplate(this.item.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
get title() {
|
get title() {
|
||||||
@ -264,7 +263,7 @@ export class RdDItemSheet extends ItemSheet {
|
|||||||
_updateObject(event, formData) {
|
_updateObject(event, formData) {
|
||||||
switch (this.item.type) {
|
switch (this.item.type) {
|
||||||
case ITEM_TYPES.sort:
|
case ITEM_TYPES.sort:
|
||||||
formData['system.bonuscase'] = RdDItemSort.bonuscasesToString(RdDItemSheet._listCaseTmr(
|
formData['system.bonuscase'] = RdDItemSort.bonuscasesToString(RdDItemSheetV1._listCaseTmr(
|
||||||
formData.caseTmrCoord,
|
formData.caseTmrCoord,
|
||||||
formData.caseTmrBonus,
|
formData.caseTmrBonus,
|
||||||
formData.caseTmrAdd
|
formData.caseTmrAdd
|
||||||
@ -314,7 +313,7 @@ export class RdDItemSheet extends ItemSheet {
|
|||||||
|
|
||||||
async _onDrop(event) {
|
async _onDrop(event) {
|
||||||
// Try to extract the dragData
|
// Try to extract the dragData
|
||||||
let dragData = RdDItemSheet.$extractDragData(event);
|
let dragData = RdDItemSheetV1.$extractDragData(event);
|
||||||
if (!dragData) return false;
|
if (!dragData) return false;
|
||||||
const allowed = Hooks.call("dropActorSheetData", this.actor, this, dragData);
|
const allowed = Hooks.call("dropActorSheetData", this.actor, this, dragData);
|
||||||
if (allowed === false) return false;
|
if (allowed === false) return false;
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import { HtmlUtility } from "../html-utility.js";
|
import { HtmlUtility } from "../html-utility.js";
|
||||||
import { RdDItemSheet } from "../item-sheet.js";
|
import { RdDItemSheetV1 } from "../item-sheet.js";
|
||||||
import { Misc } from "../misc.js";
|
import { Misc } from "../misc.js";
|
||||||
import { RdDRaretes } from "./raretes.js";
|
import { RdDRaretes } from "./raretes.js";
|
||||||
|
|
||||||
const TYPE_ITEMS_NATURELS = ["faune", "herbe", "plante", "ingredient"];
|
const TYPE_ITEMS_NATURELS = ["faune", "herbe", "plante", "ingredient"];
|
||||||
|
|
||||||
export class RdDItemInventaireSheet extends RdDItemSheet {
|
export class RdDItemInventaireSheet extends RdDItemSheetV1 {
|
||||||
|
|
||||||
static get defaultOptions() {
|
static get defaultOptions() {
|
||||||
return foundry.utils.mergeObject(RdDItemSheet.defaultOptions, {
|
return foundry.utils.mergeObject(RdDItemSheetV1.defaultOptions, {
|
||||||
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "informations" }]
|
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "informations" }]
|
||||||
}, { inplace: false })
|
}, { inplace: false })
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { RdDItemSheet } from "../item-sheet.js";
|
import { RdDItemSheetV1 } from "../item-sheet.js";
|
||||||
|
|
||||||
export class RdDBlessureItemSheet extends RdDItemSheet {
|
export class RdDBlessureItemSheet extends RdDItemSheetV1 {
|
||||||
|
|
||||||
static get ITEM_TYPE() { return "blessure" };
|
static get ITEM_TYPE() { return "blessure" };
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { RdDRencontre } from "./rencontre.js";
|
import { RdDRencontre } from "./rencontre.js";
|
||||||
import { RdDItemSheet } from "../item-sheet.js";
|
import { RdDItemSheetV1 } from "../item-sheet.js";
|
||||||
|
|
||||||
export class RdDRencontreItemSheet extends RdDItemSheet {
|
export class RdDRencontreItemSheet extends RdDItemSheetV1 {
|
||||||
|
|
||||||
static get ITEM_TYPE() { return "rencontre" };
|
static get ITEM_TYPE() { return "rencontre" };
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { RdDItemSheet } from "../item-sheet.js";
|
import { RdDItemSheetV1 } from "../item-sheet.js";
|
||||||
|
|
||||||
export class RdDServiceItemSheet extends RdDItemSheet {
|
export class RdDServiceItemSheet extends RdDItemSheetV1 {
|
||||||
|
|
||||||
static get ITEM_TYPE() { return "service" };
|
static get ITEM_TYPE() { return "service" };
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import { RdDItemSheet } from "../item-sheet.js";
|
import { RdDItemSheetV1 } from "../item-sheet.js";
|
||||||
import { RdDItemSigneDraconique } from "./signedraconique.js";
|
import { RdDItemSigneDraconique } from "./signedraconique.js";
|
||||||
import { TMRUtility } from "../tmr-utility.js";
|
import { TMRUtility } from "../tmr-utility.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Item sheet pour signes draconiques
|
* Item sheet pour signes draconiques
|
||||||
* @extends {RdDItemSheet}
|
* @extends {RdDItemSheetV1}
|
||||||
*/
|
*/
|
||||||
export class RdDSigneDraconiqueItemSheet extends RdDItemSheet {
|
export class RdDSigneDraconiqueItemSheet extends RdDItemSheetV1 {
|
||||||
|
|
||||||
static get ITEM_TYPE() { return "signedraconique" }
|
static get ITEM_TYPE() { return "signedraconique" }
|
||||||
|
|
||||||
|
2
module/models/_module.mjs
Normal file
2
module/models/_module.mjs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export { default as RdDModelMonnaie } from "./monnaie.mjs"
|
||||||
|
export { default as RdDModelMunition } from "./munition.mjs"
|
10
module/models/monnaie.mjs
Normal file
10
module/models/monnaie.mjs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE } from "../common/_module.mjs";
|
||||||
|
|
||||||
|
export default class RdDModelMonnaie extends foundry.abstract.TypeDataModel {
|
||||||
|
static defineSchema() {
|
||||||
|
return Object.assign({},
|
||||||
|
TEMPLATE_DESCRIPTION.fields(),
|
||||||
|
TEMPLATE_INVENTAIRE.fields()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
10
module/models/munition.mjs
Normal file
10
module/models/munition.mjs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE } from "../common/_module.mjs";
|
||||||
|
|
||||||
|
export default class RdDModelMunition extends foundry.abstract.TypeDataModel {
|
||||||
|
static defineSchema() {
|
||||||
|
return Object.assign({},
|
||||||
|
TEMPLATE_DESCRIPTION.fields(),
|
||||||
|
TEMPLATE_INVENTAIRE.fields()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
@ -54,7 +54,7 @@ import { RdDItemSouffle } from "./item/souffle.js"
|
|||||||
|
|
||||||
import { RdDRencontre } from "./item/rencontre.js"
|
import { RdDRencontre } from "./item/rencontre.js"
|
||||||
|
|
||||||
import { RdDItemSheet } from "./item-sheet.js"
|
import { RdDItemSheetV1 } from "./item-sheet.js"
|
||||||
import { RdDBlessureItemSheet } from "./item/sheet-blessure.js"
|
import { RdDBlessureItemSheet } from "./item/sheet-blessure.js"
|
||||||
import { RdDServiceItemSheet } from "./item/sheet-service.js"
|
import { RdDServiceItemSheet } from "./item/sheet-service.js"
|
||||||
import { RdDRencontreItemSheet } from "./item/sheet-rencontre.js"
|
import { RdDRencontreItemSheet } from "./item/sheet-rencontre.js"
|
||||||
@ -80,6 +80,10 @@ import { RdDItemPotion } from "./item/potion.js"
|
|||||||
import { RdDItemGemme } from "./item/gemme.js"
|
import { RdDItemGemme } from "./item/gemme.js"
|
||||||
import { RdDGemmeItemSheet } from "./item/sheet-gemme.js"
|
import { RdDGemmeItemSheet } from "./item/sheet-gemme.js"
|
||||||
|
|
||||||
|
import * as models from "./models/_module.mjs"
|
||||||
|
import * as items from "./documents/_module.mjs"
|
||||||
|
import * as sheets from "./applications/sheets/_module.mjs"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RdD system
|
* RdD system
|
||||||
* Author: LeRatierBretonnien
|
* Author: LeRatierBretonnien
|
||||||
@ -100,6 +104,8 @@ export class SystemReveDeDragon {
|
|||||||
this.RdDHotbar = RdDHotbar
|
this.RdDHotbar = RdDHotbar
|
||||||
this.RdDStatBlockParser = RdDStatBlockParser
|
this.RdDStatBlockParser = RdDStatBlockParser
|
||||||
this.itemClasses = {
|
this.itemClasses = {
|
||||||
|
monnaie: items.RdDModelMonnaie,
|
||||||
|
munition: items.RdDModelMunition,
|
||||||
armure: RdDItemArmure,
|
armure: RdDItemArmure,
|
||||||
blessure: RdDItemBlessure,
|
blessure: RdDItemBlessure,
|
||||||
gemme: RdDItemGemme,
|
gemme: RdDItemGemme,
|
||||||
@ -129,6 +135,9 @@ export class SystemReveDeDragon {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
onInit() {
|
onInit() {
|
||||||
game.system.rdd = this
|
game.system.rdd = this
|
||||||
|
|
||||||
|
globalThis.RdD = game.system
|
||||||
|
|
||||||
this.AppAstrologie = AppAstrologie
|
this.AppAstrologie = AppAstrologie
|
||||||
|
|
||||||
console.log(`Initializing Reve de Dragon System Settings`)
|
console.log(`Initializing Reve de Dragon System Settings`)
|
||||||
@ -175,6 +184,10 @@ export class SystemReveDeDragon {
|
|||||||
console.log(`Initializing Reve de Dragon Documents`)
|
console.log(`Initializing Reve de Dragon Documents`)
|
||||||
CONFIG.Actor.documentClass = RdDBaseActor
|
CONFIG.Actor.documentClass = RdDBaseActor
|
||||||
CONFIG.Item.documentClass = RdDItem
|
CONFIG.Item.documentClass = RdDItem
|
||||||
|
CONFIG.Item.dataModels = {
|
||||||
|
monnaie: models.RdDModelMonnaie,
|
||||||
|
munition: models.RdDModelMunition,
|
||||||
|
}
|
||||||
CONFIG.RDD = {
|
CONFIG.RDD = {
|
||||||
resolutionTable: RdDResolutionTable.resolutionTable,
|
resolutionTable: RdDResolutionTable.resolutionTable,
|
||||||
carac_array: RdDUtility.getCaracArray(),
|
carac_array: RdDUtility.getCaracArray(),
|
||||||
@ -195,12 +208,15 @@ export class SystemReveDeDragon {
|
|||||||
|
|
||||||
Items.registerSheet(SYSTEM_RDD, RdDItemInventaireSheet, {
|
Items.registerSheet(SYSTEM_RDD, RdDItemInventaireSheet, {
|
||||||
types: [
|
types: [
|
||||||
"objet", "arme", "armure", "livre", "munition",
|
"objet", "arme", "armure", "livre", "nourritureboisson",
|
||||||
"monnaie", "nourritureboisson",
|
|
||||||
],
|
],
|
||||||
makeDefault: true
|
makeDefault: true
|
||||||
})
|
})
|
||||||
Items.registerSheet(SYSTEM_RDD, RdDItemSheet, {
|
|
||||||
|
sheets.RdDItemSheet.register(sheets.RdDMonnaieSheet)
|
||||||
|
sheets.RdDItemSheet.register(sheets.RdDMunitionSheet)
|
||||||
|
|
||||||
|
Items.registerSheet(SYSTEM_RDD, RdDItemSheetV1, {
|
||||||
types: [
|
types: [
|
||||||
"competence", "competencecreature",
|
"competence", "competencecreature",
|
||||||
"recettealchimique", "musique", "chant", "danse", "jeu", "race",
|
"recettealchimique", "musique", "chant", "danse", "jeu", "race",
|
||||||
@ -211,18 +227,18 @@ export class SystemReveDeDragon {
|
|||||||
],
|
],
|
||||||
makeDefault: true
|
makeDefault: true
|
||||||
})
|
})
|
||||||
|
|
||||||
RdDItemSheet.register(RdDBlessureItemSheet)
|
RdDItemSheetV1.register(RdDBlessureItemSheet)
|
||||||
RdDItemSheet.register(RdDConteneurItemSheet)
|
RdDItemSheetV1.register(RdDConteneurItemSheet)
|
||||||
RdDItemSheet.register(RdDFauneItemSheet)
|
RdDItemSheetV1.register(RdDFauneItemSheet)
|
||||||
RdDItemSheet.register(RdDGemmeItemSheet)
|
RdDItemSheetV1.register(RdDGemmeItemSheet)
|
||||||
RdDItemSheet.register(RdDHerbeItemSheet)
|
RdDItemSheetV1.register(RdDHerbeItemSheet)
|
||||||
RdDItemSheet.register(RdDIngredientItemSheet)
|
RdDItemSheetV1.register(RdDIngredientItemSheet)
|
||||||
RdDItemSheet.register(RdDPlanteItemSheet)
|
RdDItemSheetV1.register(RdDPlanteItemSheet)
|
||||||
RdDItemSheet.register(RdDPotionItemSheet)
|
RdDItemSheetV1.register(RdDPotionItemSheet)
|
||||||
RdDItemSheet.register(RdDRencontreItemSheet)
|
RdDItemSheetV1.register(RdDRencontreItemSheet)
|
||||||
RdDItemSheet.register(RdDServiceItemSheet)
|
RdDItemSheetV1.register(RdDServiceItemSheet)
|
||||||
RdDItemSheet.register(RdDSigneDraconiqueItemSheet)
|
RdDItemSheetV1.register(RdDSigneDraconiqueItemSheet)
|
||||||
RdDJournalSheet.register()
|
RdDJournalSheet.register()
|
||||||
|
|
||||||
// préparation des différents modules
|
// préparation des différents modules
|
||||||
|
@ -742,9 +742,6 @@
|
|||||||
"objet": {
|
"objet": {
|
||||||
"templates": ["description", "equipement", "inventaire"]
|
"templates": ["description", "equipement", "inventaire"]
|
||||||
},
|
},
|
||||||
"monnaie": {
|
|
||||||
"templates": ["description", "inventaire"]
|
|
||||||
},
|
|
||||||
"gemme": {
|
"gemme": {
|
||||||
"templates": ["description", "enchantable", "inventaire", "temporel"],
|
"templates": ["description", "enchantable", "inventaire", "temporel"],
|
||||||
"type": "",
|
"type": "",
|
||||||
@ -753,9 +750,6 @@
|
|||||||
"inertie": 0,
|
"inertie": 0,
|
||||||
"enchantabilite": 0
|
"enchantabilite": 0
|
||||||
},
|
},
|
||||||
"munition": {
|
|
||||||
"templates": ["description", "inventaire"]
|
|
||||||
},
|
|
||||||
"nourritureboisson": {
|
"nourritureboisson": {
|
||||||
"templates": ["description", "inventaire", "comestible"],
|
"templates": ["description", "inventaire", "comestible"],
|
||||||
"cuisinier": "",
|
"cuisinier": "",
|
||||||
|
14
templates/item/monnaie.hbs
Normal file
14
templates/item/monnaie.hbs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<form class="{{cssClass}}" autocomplete="off">
|
||||||
|
{{>"systems/foundryvtt-reve-de-dragon/templates/header-item.hbs"}}
|
||||||
|
<nav class="sheet-tabs tabs" data-group="primary">
|
||||||
|
<a class="item" data-tab="informations">Informations</a>
|
||||||
|
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-tab-environnement.hbs"}}
|
||||||
|
</nav>
|
||||||
|
<section class="sheet-body">
|
||||||
|
<div class="tab items flexcol" data-group="primary" data-tab="informations">
|
||||||
|
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-inventaire.hbs"}}
|
||||||
|
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.hbs"}}
|
||||||
|
</div>
|
||||||
|
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-environnement.hbs"}}
|
||||||
|
</section>
|
||||||
|
</form>
|
14
templates/item/munition.hbs
Normal file
14
templates/item/munition.hbs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<form class="{{cssClass}}" autocomplete="off">
|
||||||
|
{{>"systems/foundryvtt-reve-de-dragon/templates/header-item.hbs"}}
|
||||||
|
<nav class="sheet-tabs tabs" data-group="primary">
|
||||||
|
<a class="item" data-tab="informations">Informations</a>
|
||||||
|
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-tab-environnement.hbs"}}
|
||||||
|
</nav>
|
||||||
|
<section class="sheet-body">
|
||||||
|
<div class="tab items flexcol" data-group="primary" data-tab="informations">
|
||||||
|
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-inventaire.hbs"}}
|
||||||
|
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.hbs"}}
|
||||||
|
</div>
|
||||||
|
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-environnement.hbs"}}
|
||||||
|
</section>
|
||||||
|
</form>
|
Loading…
x
Reference in New Issue
Block a user