v13 - DataModels & SheetV2 pour les monnaies #747
2
module/applications/sheets/_module.mjs
Normal file
2
module/applications/sheets/_module.mjs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export { default as RdDItemBaseSheet} from "./common-item-sheet.mjs"
|
||||||
|
export { default as RdDMonnaieSheet } from "./monnaie-sheet.mjs"
|
111
module/applications/sheets/common-item-sheet.mjs
Normal file
111
module/applications/sheets/common-item-sheet.mjs
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
const { HandlebarsApplicationMixin } = foundry.applications.api
|
||||||
|
import { SYSTEM_RDD } from "../../constants.js"
|
||||||
|
import { Misc } from "../../misc.js"
|
||||||
|
import { RdDSheetUtility } from "../../rdd-sheet-utility.js";
|
||||||
|
|
||||||
|
|
||||||
|
export default class RdDItemBaseSheet extends HandlebarsApplicationMixin(foundry.applications.sheets.ItemSheetV2) {
|
||||||
|
|
||||||
|
static preloadHandlebars(...templatesList) {
|
||||||
|
const handlebars = ["systems/foundryvtt-reve-de-dragon/templates/sheets/item/common/header.hbs"]
|
||||||
|
templatesList.forEach(templates =>
|
||||||
|
templates.forEach(t =>
|
||||||
|
t.handlebars().forEach(h => handlebars.push(h))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
loadTemplates(Misc.distinct(handlebars))
|
||||||
|
}
|
||||||
|
|
||||||
|
static register(sheetClass) {
|
||||||
|
const itemType = sheetClass.ITEM_TYPE
|
||||||
|
Items.registerSheet(SYSTEM_RDD, sheetClass, {
|
||||||
|
label: Misc.typeName('Item', itemType),
|
||||||
|
types: [itemType],
|
||||||
|
makeDefault: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
static registerAll(...sheetClasses) {
|
||||||
|
const handlebars = ["systems/foundryvtt-reve-de-dragon/templates/sheets/item/common/header.hbs"]
|
||||||
|
sheetClasses.forEach(sheetClass => {
|
||||||
|
sheetClass.TEMPLATES.forEach(t =>
|
||||||
|
t.handlebars().forEach(h => handlebars.push(h))
|
||||||
|
)
|
||||||
|
const itemType = sheetClass.ITEM_TYPE
|
||||||
|
Items.registerSheet(SYSTEM_RDD, sheetClass, {
|
||||||
|
label: Misc.typeName('Item', itemType),
|
||||||
|
types: [itemType],
|
||||||
|
makeDefault: true
|
||||||
|
})
|
||||||
|
})
|
||||||
|
loadTemplates(Misc.distinct(handlebars))
|
||||||
|
}
|
||||||
|
|
||||||
|
static get ITEM_TYPE() { return undefined }
|
||||||
|
|
||||||
|
constructor(options = {}) {
|
||||||
|
super(options)
|
||||||
|
}
|
||||||
|
|
||||||
|
static get TEMPLATES() { return [] }
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static DEFAULT_OPTIONS = {
|
||||||
|
classes: ["fvtt-rdd", "item"],
|
||||||
|
position: {
|
||||||
|
width: 600,
|
||||||
|
height: "auto",
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
submitOnChange: true,
|
||||||
|
},
|
||||||
|
window: {
|
||||||
|
resizable: true,
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
editImage: RdDItemBaseSheet.#onEditImage,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
async _prepareContext() {
|
||||||
|
return {
|
||||||
|
item: this.document,
|
||||||
|
options: RdDSheetUtility.getOptions(this.document, this.isEditable),
|
||||||
|
fields: this.document.schema.fields,
|
||||||
|
systemFields: this.document.system.schema.fields,
|
||||||
|
system: this.document.system,
|
||||||
|
source: this.document.toObject(),
|
||||||
|
isEditable: this.isEditable,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// #region Actions
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle changing a Document's image.
|
||||||
|
*
|
||||||
|
* @this RdDItemBaseSheet
|
||||||
|
* @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
|
||||||
|
}
|
40
module/applications/sheets/monnaie-sheet.mjs
Normal file
40
module/applications/sheets/monnaie-sheet.mjs
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import { TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE } from "../../common/_module.mjs";
|
||||||
|
import { ITEM_TYPES } from "../../constants.js";
|
||||||
|
import RdDItemBaseSheet from "./common-item-sheet.mjs";
|
||||||
|
|
||||||
|
export default class RdDMonnaieSheet extends RdDItemBaseSheet {
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static get ITEM_TYPE() { return ITEM_TYPES.monnaie }
|
||||||
|
static get TEMPLATES() { return [TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE] }
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static DEFAULT_OPTIONS = Object.assign({},
|
||||||
|
RdDItemBaseSheet.DEFAULT_OPTIONS,
|
||||||
|
{
|
||||||
|
classes: ["fvtt-rdd", "item", "monnaie"],
|
||||||
|
position: {
|
||||||
|
width: 400,
|
||||||
|
},
|
||||||
|
window: {
|
||||||
|
contentClasses: ["monnaie-content"],
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
static PARTS = {
|
||||||
|
main: {
|
||||||
|
template: "systems/foundryvtt-reve-de-dragon/templates/sheets/item/monnaie.hbs",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
async _prepareContext() {
|
||||||
|
return Object.assign(
|
||||||
|
await super._prepareContext(),
|
||||||
|
await TEMPLATE_DESCRIPTION.prepareContext(this.document),
|
||||||
|
await TEMPLATE_INVENTAIRE.prepareContext(this.document)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
8
module/common/_module.mjs
Normal file
8
module/common/_module.mjs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import { CommonDescription } from "./description.mjs";
|
||||||
|
import { CommonInventaire } from "./inventaire.mjs";
|
||||||
|
|
||||||
|
export const TEMPLATE_DESCRIPTION = new CommonDescription()
|
||||||
|
export const TEMPLATE_INVENTAIRE = new CommonInventaire()
|
||||||
|
|
||||||
|
export const ALL_COMMON_TEMPLATES = [TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE]
|
||||||
|
|
10
module/common/common-template.mjs
Normal file
10
module/common/common-template.mjs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
/**
|
||||||
|
* class describing common methods implemented by template parts,
|
||||||
|
* used for sheet/models/documents
|
||||||
|
*/
|
||||||
|
export default class CommonTemplate {
|
||||||
|
fields() { }
|
||||||
|
handlebars() { return [] }
|
||||||
|
actions() { return {} }
|
||||||
|
async prepareContext(item) { }
|
||||||
|
}
|
32
module/common/description.mjs
Normal file
32
module/common/description.mjs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
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 })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
handlebars() {
|
||||||
|
return [
|
||||||
|
"systems/foundryvtt-reve-de-dragon/templates/sheets/item/common/template-description.hbs",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
actions() {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
|
||||||
|
async prepareContext(item) {
|
||||||
|
const enriched = {
|
||||||
|
description: await RdDTextEditor.enrichHTML(item.system.description, item),
|
||||||
|
descriptionmj: await RdDTextEditor.enrichHTML(item.system.descriptionmj, item),
|
||||||
|
}
|
||||||
|
return { enriched }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
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, textSearch: true }
|
||||||
|
|
||||||
|
export const MODEL_ARRAY = { initial: [], required: true, nullable: false }
|
||||||
|
|
36
module/common/inventaire.mjs
Normal file
36
module/common/inventaire.mjs
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
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 }),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
handlebars() {
|
||||||
|
return [
|
||||||
|
"systems/foundryvtt-reve-de-dragon/templates/sheets/item/common/template-inventaire.hbs"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
async prepareContext(item) {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
}
|
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'
|
||||||
|
}
|
||||||
|
}
|
@ -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() {
|
||||||
@ -101,7 +100,7 @@ export class RdDItemSheet extends ItemSheet {
|
|||||||
description: await RdDTextEditor.enrichHTML(this.item.system.description, this.item),
|
description: await RdDTextEditor.enrichHTML(this.item.system.description, this.item),
|
||||||
descriptionmj: await RdDTextEditor.enrichHTML(this.item.system.descriptionmj, this.item),
|
descriptionmj: await RdDTextEditor.enrichHTML(this.item.system.descriptionmj, this.item),
|
||||||
isComestible: this.item.getUtilisationCuisine(),
|
isComestible: this.item.getUtilisationCuisine(),
|
||||||
options: RdDSheetUtility.mergeDocumentRights(this.options, this.item, this.isEditable),
|
options: RdDSheetUtility.mergeDocumentRights({}, this.item, this.isEditable),
|
||||||
competences: await SystemCompendiums.getCompetences(ACTOR_TYPES.personnage),
|
competences: await SystemCompendiums.getCompetences(ACTOR_TYPES.personnage),
|
||||||
categories: RdDItem.getCategories(this.item.type),
|
categories: RdDItem.getCategories(this.item.type),
|
||||||
}
|
}
|
||||||
@ -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" }
|
||||||
|
|
||||||
|
1
module/models/_module.mjs
Normal file
1
module/models/_module.mjs
Normal file
@ -0,0 +1 @@
|
|||||||
|
export { default as RdDModelMonnaie } from "./monnaie.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()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
@ -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,7 @@ export class SystemReveDeDragon {
|
|||||||
this.RdDHotbar = RdDHotbar
|
this.RdDHotbar = RdDHotbar
|
||||||
this.RdDStatBlockParser = RdDStatBlockParser
|
this.RdDStatBlockParser = RdDStatBlockParser
|
||||||
this.itemClasses = {
|
this.itemClasses = {
|
||||||
|
monnaie: items.RdDModelMonnaie,
|
||||||
armure: RdDItemArmure,
|
armure: RdDItemArmure,
|
||||||
blessure: RdDItemBlessure,
|
blessure: RdDItemBlessure,
|
||||||
gemme: RdDItemGemme,
|
gemme: RdDItemGemme,
|
||||||
@ -129,6 +134,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 +183,9 @@ 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,
|
||||||
|
}
|
||||||
CONFIG.RDD = {
|
CONFIG.RDD = {
|
||||||
resolutionTable: RdDResolutionTable.resolutionTable,
|
resolutionTable: RdDResolutionTable.resolutionTable,
|
||||||
carac_array: RdDUtility.getCaracArray(),
|
carac_array: RdDUtility.getCaracArray(),
|
||||||
@ -195,12 +206,18 @@ export class SystemReveDeDragon {
|
|||||||
|
|
||||||
Items.registerSheet(SYSTEM_RDD, RdDItemInventaireSheet, {
|
Items.registerSheet(SYSTEM_RDD, RdDItemInventaireSheet, {
|
||||||
types: [
|
types: [
|
||||||
"objet", "arme", "armure", "livre", "munition",
|
"objet", "arme", "armure", "livre", "munition", "nourritureboisson",
|
||||||
"monnaie", "nourritureboisson",
|
|
||||||
],
|
],
|
||||||
makeDefault: true
|
makeDefault: true
|
||||||
})
|
})
|
||||||
Items.registerSheet(SYSTEM_RDD, RdDItemSheet, {
|
|
||||||
|
sheets.RdDItemBaseSheet.registerAll(
|
||||||
|
sheets.RdDMonnaieSheet
|
||||||
|
)
|
||||||
|
|
||||||
|
// ,
|
||||||
|
// 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 +228,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
|
||||||
|
@ -3,11 +3,11 @@ import { RdDItem } from "./item.js";
|
|||||||
|
|
||||||
export class RdDSheetUtility {
|
export class RdDSheetUtility {
|
||||||
|
|
||||||
static mergeDocumentRights(options, document, editable) {
|
static getOptions(document, editable) {
|
||||||
const userRightLevel = game.user.isGM
|
const userRightLevel = game.user.isGM
|
||||||
? CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER
|
? CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER
|
||||||
: document.getUserLevel(game.user);
|
: document.getUserLevel(game.user);
|
||||||
let newOptions = {
|
return {
|
||||||
isGM: game.user.isGM,
|
isGM: game.user.isGM,
|
||||||
isOwned: document.parent ? true : false,
|
isOwned: document.parent ? true : false,
|
||||||
editable: editable,
|
editable: editable,
|
||||||
@ -16,10 +16,15 @@ export class RdDSheetUtility {
|
|||||||
isObserver: userRightLevel >= CONST.DOCUMENT_OWNERSHIP_LEVELS.OBSERVER,
|
isObserver: userRightLevel >= CONST.DOCUMENT_OWNERSHIP_LEVELS.OBSERVER,
|
||||||
isOwner: userRightLevel >= CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER
|
isOwner: userRightLevel >= CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static mergeDocumentRights(options, document, editable) {
|
||||||
|
const newOptions = RdDSheetUtility.getOptions(document, editable);
|
||||||
foundry.utils.mergeObject(options, newOptions);
|
foundry.utils.mergeObject(options, newOptions);
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static getItem(event, actor) {
|
static getItem(event, actor) {
|
||||||
return actor.items.get(RdDSheetUtility.getItemId(event))
|
return actor.items.get(RdDSheetUtility.getItemId(event))
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,9 @@
|
|||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
||||||
|
body {
|
||||||
|
--input-height: 1.4rem;
|
||||||
|
}
|
||||||
:root {
|
:root {
|
||||||
/* =================== 1. ACTOR SHEET FONT STYLES =========== */
|
/* =================== 1. ACTOR SHEET FONT STYLES =========== */
|
||||||
--window-header-title-font-family: CaslonAntique;
|
--window-header-title-font-family: CaslonAntique;
|
||||||
@ -731,10 +734,36 @@ input:is(.blessure-premiers_soins, .blessure-soins_complets) {
|
|||||||
.flex-grow-3 {
|
.flex-grow-3 {
|
||||||
flex-grow: 3;
|
flex-grow: 3;
|
||||||
}
|
}
|
||||||
|
fieldset {
|
||||||
.editor.prosemirror {
|
border-style: groove;
|
||||||
|
border-width: 0.1rem;
|
||||||
|
padding-inline: 0.2rem;
|
||||||
|
padding-block: 0.1rem;
|
||||||
|
margin-inline: 0.1rem;
|
||||||
|
margin-block: 0.1rem;
|
||||||
|
}
|
||||||
|
form.application.sheet.fvtt-rdd fieldset :is(label, input) {
|
||||||
|
font-family: CaslonAntique;
|
||||||
|
text-align: justify;
|
||||||
|
font-size: 1rem;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
}
|
||||||
|
form.application.sheet.fvtt-rdd div.form-group {
|
||||||
|
clear: both;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin: 0.1rem 0;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
form.application.sheet.fvtt-rdd .editor.prosemirror {
|
||||||
height: fit-content;
|
height: fit-content;
|
||||||
min-height: 20rem;
|
min-height: 5rem;
|
||||||
|
}
|
||||||
|
form.application.sheet.fvtt-rdd prose-mirror.prosemirror .editor-container {
|
||||||
|
min-height: 5rem;
|
||||||
|
height: fit-content;
|
||||||
|
margin: 0;
|
||||||
}
|
}
|
||||||
.large-editor {
|
.large-editor {
|
||||||
border: 2;
|
border: 2;
|
||||||
@ -742,6 +771,7 @@ input:is(.blessure-premiers_soins, .blessure-soins_complets) {
|
|||||||
min-height: 12rem;
|
min-height: 12rem;
|
||||||
padding: 0 3px;
|
padding: 0 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editor {
|
.editor {
|
||||||
border: 2;
|
border: 2;
|
||||||
height: fit-content;
|
height: fit-content;
|
||||||
@ -765,6 +795,7 @@ input:is(.blessure-premiers_soins, .blessure-soins_complets) {
|
|||||||
.foundryvtt-reve-de-dragon.sheet :is(.large-editor,.editor,.medium-editor,.small-editor){
|
.foundryvtt-reve-de-dragon.sheet :is(.large-editor,.editor,.medium-editor,.small-editor){
|
||||||
align-items: start;
|
align-items: start;
|
||||||
}
|
}
|
||||||
|
|
||||||
.foundryvtt-reve-de-dragon.sheet :is(.large-editor,.editor,.medium-editor,.small-editor) .editor.prosemirror{
|
.foundryvtt-reve-de-dragon.sheet :is(.large-editor,.editor,.medium-editor,.small-editor) .editor.prosemirror{
|
||||||
align-items: normal;
|
align-items: normal;
|
||||||
}
|
}
|
||||||
|
@ -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": "",
|
||||||
|
6
templates/sheets/item/common/header.hbs
Normal file
6
templates/sheets/item/common/header.hbs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<header class="sheet-header">
|
||||||
|
<img class="profile-img" src="{{item.img}}" data-edit="img" data-tooltip="{{item.name}}"/>
|
||||||
|
<div class="header-fields">
|
||||||
|
<h1 class="charname"><input name="name" type="text" value="{{item.name}}" placeholder="Name"/></h1>
|
||||||
|
</div>
|
||||||
|
</header>
|
21
templates/sheets/item/common/template-description.hbs
Normal file
21
templates/sheets/item/common/template-description.hbs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<fieldset>
|
||||||
|
<div>
|
||||||
|
<label>Description :</label>
|
||||||
|
{{formInput
|
||||||
|
systemFields.description
|
||||||
|
enriched=enriched.description
|
||||||
|
value=system.description
|
||||||
|
name="system.description"
|
||||||
|
toggled=true}}
|
||||||
|
</div>
|
||||||
|
{{#if options.isGM}}
|
||||||
|
<div>
|
||||||
|
<label>Description (MJ seulement):</label>
|
||||||
|
{{formInput
|
||||||
|
systemFields.descriptionmj
|
||||||
|
enriched=enriched.descriptionmj
|
||||||
|
value=system.descriptionmj
|
||||||
|
name="system.descriptionmj" toggled=true}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</fieldset>
|
6
templates/sheets/item/common/template-inventaire.hbs
Normal file
6
templates/sheets/item/common/template-inventaire.hbs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<fieldset>
|
||||||
|
{{formField systemFields.qualite value=system.qualite}}
|
||||||
|
{{formField systemFields.encombrement value=system.encombrement}}
|
||||||
|
{{formField systemFields.quantite value=system.quantite}}
|
||||||
|
{{formField systemFields.cout value=system.cout}}
|
||||||
|
</fieldset>
|
6
templates/sheets/item/monnaie.hbs
Normal file
6
templates/sheets/item/monnaie.hbs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<section>
|
||||||
|
{{> "systems/foundryvtt-reve-de-dragon/templates/sheets/item/common/header.hbs"}}
|
||||||
|
|
||||||
|
{{>"systems/foundryvtt-reve-de-dragon/templates/sheets/item/common/template-inventaire.hbs"}}
|
||||||
|
{{>"systems/foundryvtt-reve-de-dragon/templates/sheets/item/common/template-description.hbs"}}
|
||||||
|
</section>
|
Loading…
x
Reference in New Issue
Block a user