v13 - DataModels & SheetV2 pour les monnaies #747
@ -1,4 +1,8 @@
|
||||
# 12.0
|
||||
## 12.0.40 - Les mains d'Astrobazzarh
|
||||
- correction des attaques particulières en combat
|
||||
- correction de message sur les min/max liés aux modificateurs de races (s'applique uniquement sur la taille)
|
||||
|
||||
## 12.0.39 - Les mains d'Astrobazzarh
|
||||
- les armes à 1 ou 2 mains fonctionnent dans les liens de jets de dés
|
||||
- commande `/jet` pour poster une demande de jet de dés
|
||||
|
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 { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
|
||||
import { ItemAction } from "./item/item-actions.js";
|
||||
import { RdDItemGemme } from "./item/gemme.js";
|
||||
|
||||
/**
|
||||
* Extend the basic ItemSheet for RdD specific items
|
||||
*/
|
||||
export class RdDItemSheet extends ItemSheet {
|
||||
export class RdDItemSheetV1 extends ItemSheet {
|
||||
|
||||
static get ITEM_TYPE() {
|
||||
return undefined
|
||||
@ -43,7 +42,7 @@ export class RdDItemSheet extends ItemSheet {
|
||||
static get defaultOptions() {
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
classes: [SYSTEM_RDD, "sheet", "item"],
|
||||
template: RdDItemSheet.defaultTemplate(RdDItemSheet.ITEM_TYPE),
|
||||
template: RdDItemSheetV1.defaultTemplate(RdDItemSheetV1.ITEM_TYPE),
|
||||
width: 550,
|
||||
height: 550
|
||||
}, { inplace: false });
|
||||
@ -51,7 +50,7 @@ export class RdDItemSheet extends ItemSheet {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
get template() {
|
||||
return RdDItemSheet.defaultTemplate(this.item.type);
|
||||
return RdDItemSheetV1.defaultTemplate(this.item.type);
|
||||
}
|
||||
|
||||
get title() {
|
||||
@ -101,7 +100,7 @@ export class RdDItemSheet extends ItemSheet {
|
||||
description: await RdDTextEditor.enrichHTML(this.item.system.description, this.item),
|
||||
descriptionmj: await RdDTextEditor.enrichHTML(this.item.system.descriptionmj, this.item),
|
||||
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),
|
||||
categories: RdDItem.getCategories(this.item.type),
|
||||
}
|
||||
@ -264,7 +263,7 @@ export class RdDItemSheet extends ItemSheet {
|
||||
_updateObject(event, formData) {
|
||||
switch (this.item.type) {
|
||||
case ITEM_TYPES.sort:
|
||||
formData['system.bonuscase'] = RdDItemSort.bonuscasesToString(RdDItemSheet._listCaseTmr(
|
||||
formData['system.bonuscase'] = RdDItemSort.bonuscasesToString(RdDItemSheetV1._listCaseTmr(
|
||||
formData.caseTmrCoord,
|
||||
formData.caseTmrBonus,
|
||||
formData.caseTmrAdd
|
||||
@ -314,7 +313,7 @@ export class RdDItemSheet extends ItemSheet {
|
||||
|
||||
async _onDrop(event) {
|
||||
// Try to extract the dragData
|
||||
let dragData = RdDItemSheet.$extractDragData(event);
|
||||
let dragData = RdDItemSheetV1.$extractDragData(event);
|
||||
if (!dragData) return false;
|
||||
const allowed = Hooks.call("dropActorSheetData", this.actor, this, dragData);
|
||||
if (allowed === false) return false;
|
||||
|
@ -19,10 +19,12 @@ export class RdDItemRace extends RdDItem {
|
||||
return false
|
||||
}
|
||||
}
|
||||
const carac = RdDCarac.carac(code)
|
||||
if (race.isMax(actor, code, value - 1)) {
|
||||
ui.notifications.warn(`${value} est supérieure au maximum de ${carac.label}`)
|
||||
return false
|
||||
if (code == LIST_CARAC_PERSONNAGE.taille.code) {
|
||||
const carac = RdDCarac.carac(code)
|
||||
if (race.isMax(actor, code, value - 1)) {
|
||||
ui.notifications.warn(`${value} est supérieure au maximum de ${carac.label}`)
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
@ -59,7 +61,8 @@ export class RdDItemRace extends RdDItem {
|
||||
if (code == LIST_CARAC_PERSONNAGE.force.code) {
|
||||
return value >= this.getForceMax(actor)
|
||||
}
|
||||
const max = foundry.utils.getProperty(this, path) ?? -1
|
||||
const pathMax = path.replace(".value", ".max");
|
||||
const max = foundry.utils.getProperty(this, pathMax) ?? -1
|
||||
return (max > 0 && value >= max)
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
import { HtmlUtility } from "../html-utility.js";
|
||||
import { RdDItemSheet } from "../item-sheet.js";
|
||||
import { RdDItemSheetV1 } from "../item-sheet.js";
|
||||
import { Misc } from "../misc.js";
|
||||
import { RdDRaretes } from "./raretes.js";
|
||||
|
||||
const TYPE_ITEMS_NATURELS = ["faune", "herbe", "plante", "ingredient"];
|
||||
|
||||
export class RdDItemInventaireSheet extends RdDItemSheet {
|
||||
export class RdDItemInventaireSheet extends RdDItemSheetV1 {
|
||||
|
||||
static get defaultOptions() {
|
||||
return foundry.utils.mergeObject(RdDItemSheet.defaultOptions, {
|
||||
return foundry.utils.mergeObject(RdDItemSheetV1.defaultOptions, {
|
||||
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "informations" }]
|
||||
}, { 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" };
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
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" };
|
||||
|
||||
|
@ -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" };
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { RdDItemSheet } from "../item-sheet.js";
|
||||
import { RdDItemSheetV1 } from "../item-sheet.js";
|
||||
import { RdDItemSigneDraconique } from "./signedraconique.js";
|
||||
import { TMRUtility } from "../tmr-utility.js";
|
||||
|
||||
/**
|
||||
* 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" }
|
||||
|
||||
|
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()
|
||||
)
|
||||
}
|
||||
}
|
@ -776,7 +776,7 @@ export class RdDCombat {
|
||||
|
||||
if (this.attacker.isCreatureEntite()) {
|
||||
RdDItemCompetenceCreature.setRollDataCreature(rollData);
|
||||
}
|
||||
}
|
||||
else if (arme) {
|
||||
// Usual competence
|
||||
rollData.arme = RdDItemArme.armeUneOuDeuxMains(arme, RdDItemCompetence.isArmeUneMain(competence));
|
||||
@ -832,7 +832,10 @@ export class RdDCombat {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _onAttaqueNormale(attackerRoll) {
|
||||
if (!RdDCombat.isReussite(attackerRoll) || RdDCombat.isParticuliere(attackerRoll)) {
|
||||
if (!RdDCombat.isReussite(attackerRoll)) {
|
||||
return
|
||||
}
|
||||
if (RdDCombat.isParticuliere(attackerRoll) && attackerRoll.particuliere == undefined) {
|
||||
return
|
||||
}
|
||||
console.log("RdDCombat.onAttaqueNormale >>>", attackerRoll);
|
||||
@ -849,7 +852,7 @@ export class RdDCombat {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.target) {
|
||||
if (this.defender) {
|
||||
await this._sendMessageDefense(attackerRoll, defenderRoll);
|
||||
}
|
||||
}
|
||||
@ -999,7 +1002,7 @@ export class RdDCombat {
|
||||
|
||||
this.removeChatMessageActionsPasseArme(rollData.passeArme);
|
||||
rollData.particuliere = choix;
|
||||
await this._onAttaqueNormale(rollData);
|
||||
await this._onAttaqueNormale(rollData)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
@ -54,7 +54,7 @@ import { RdDItemSouffle } from "./item/souffle.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 { RdDServiceItemSheet } from "./item/sheet-service.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 { 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
|
||||
* Author: LeRatierBretonnien
|
||||
@ -100,6 +104,7 @@ export class SystemReveDeDragon {
|
||||
this.RdDHotbar = RdDHotbar
|
||||
this.RdDStatBlockParser = RdDStatBlockParser
|
||||
this.itemClasses = {
|
||||
monnaie: items.RdDModelMonnaie,
|
||||
armure: RdDItemArmure,
|
||||
blessure: RdDItemBlessure,
|
||||
gemme: RdDItemGemme,
|
||||
@ -129,6 +134,9 @@ export class SystemReveDeDragon {
|
||||
/* -------------------------------------------- */
|
||||
onInit() {
|
||||
game.system.rdd = this
|
||||
|
||||
globalThis.RdD = game.system
|
||||
|
||||
this.AppAstrologie = AppAstrologie
|
||||
|
||||
console.log(`Initializing Reve de Dragon System Settings`)
|
||||
@ -175,6 +183,9 @@ export class SystemReveDeDragon {
|
||||
console.log(`Initializing Reve de Dragon Documents`)
|
||||
CONFIG.Actor.documentClass = RdDBaseActor
|
||||
CONFIG.Item.documentClass = RdDItem
|
||||
CONFIG.Item.dataModels = {
|
||||
monnaie: models.RdDModelMonnaie,
|
||||
}
|
||||
CONFIG.RDD = {
|
||||
resolutionTable: RdDResolutionTable.resolutionTable,
|
||||
carac_array: RdDUtility.getCaracArray(),
|
||||
@ -195,12 +206,18 @@ export class SystemReveDeDragon {
|
||||
|
||||
Items.registerSheet(SYSTEM_RDD, RdDItemInventaireSheet, {
|
||||
types: [
|
||||
"objet", "arme", "armure", "livre", "munition",
|
||||
"monnaie", "nourritureboisson",
|
||||
"objet", "arme", "armure", "livre", "munition", "nourritureboisson",
|
||||
],
|
||||
makeDefault: true
|
||||
})
|
||||
Items.registerSheet(SYSTEM_RDD, RdDItemSheet, {
|
||||
|
||||
sheets.RdDItemBaseSheet.registerAll(
|
||||
sheets.RdDMonnaieSheet
|
||||
)
|
||||
|
||||
// ,
|
||||
// sheets.RdDMunitionSheet
|
||||
Items.registerSheet(SYSTEM_RDD, RdDItemSheetV1, {
|
||||
types: [
|
||||
"competence", "competencecreature",
|
||||
"recettealchimique", "musique", "chant", "danse", "jeu", "race",
|
||||
@ -212,17 +229,17 @@ export class SystemReveDeDragon {
|
||||
makeDefault: true
|
||||
})
|
||||
|
||||
RdDItemSheet.register(RdDBlessureItemSheet)
|
||||
RdDItemSheet.register(RdDConteneurItemSheet)
|
||||
RdDItemSheet.register(RdDFauneItemSheet)
|
||||
RdDItemSheet.register(RdDGemmeItemSheet)
|
||||
RdDItemSheet.register(RdDHerbeItemSheet)
|
||||
RdDItemSheet.register(RdDIngredientItemSheet)
|
||||
RdDItemSheet.register(RdDPlanteItemSheet)
|
||||
RdDItemSheet.register(RdDPotionItemSheet)
|
||||
RdDItemSheet.register(RdDRencontreItemSheet)
|
||||
RdDItemSheet.register(RdDServiceItemSheet)
|
||||
RdDItemSheet.register(RdDSigneDraconiqueItemSheet)
|
||||
RdDItemSheetV1.register(RdDBlessureItemSheet)
|
||||
RdDItemSheetV1.register(RdDConteneurItemSheet)
|
||||
RdDItemSheetV1.register(RdDFauneItemSheet)
|
||||
RdDItemSheetV1.register(RdDGemmeItemSheet)
|
||||
RdDItemSheetV1.register(RdDHerbeItemSheet)
|
||||
RdDItemSheetV1.register(RdDIngredientItemSheet)
|
||||
RdDItemSheetV1.register(RdDPlanteItemSheet)
|
||||
RdDItemSheetV1.register(RdDPotionItemSheet)
|
||||
RdDItemSheetV1.register(RdDRencontreItemSheet)
|
||||
RdDItemSheetV1.register(RdDServiceItemSheet)
|
||||
RdDItemSheetV1.register(RdDSigneDraconiqueItemSheet)
|
||||
RdDJournalSheet.register()
|
||||
|
||||
// préparation des différents modules
|
||||
|
@ -3,11 +3,11 @@ import { RdDItem } from "./item.js";
|
||||
|
||||
export class RdDSheetUtility {
|
||||
|
||||
static mergeDocumentRights(options, document, editable) {
|
||||
static getOptions(document, editable) {
|
||||
const userRightLevel = game.user.isGM
|
||||
? CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER
|
||||
: document.getUserLevel(game.user);
|
||||
let newOptions = {
|
||||
return {
|
||||
isGM: game.user.isGM,
|
||||
isOwned: document.parent ? true : false,
|
||||
editable: editable,
|
||||
@ -16,10 +16,15 @@ export class RdDSheetUtility {
|
||||
isObserver: userRightLevel >= CONST.DOCUMENT_OWNERSHIP_LEVELS.OBSERVER,
|
||||
isOwner: userRightLevel >= CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER
|
||||
}
|
||||
}
|
||||
|
||||
static mergeDocumentRights(options, document, editable) {
|
||||
const newOptions = RdDSheetUtility.getOptions(document, editable);
|
||||
foundry.utils.mergeObject(options, newOptions);
|
||||
return options;
|
||||
}
|
||||
|
||||
|
||||
static getItem(event, actor) {
|
||||
return actor.items.get(RdDSheetUtility.getItemId(event))
|
||||
}
|
||||
|
@ -28,6 +28,9 @@
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
body {
|
||||
--input-height: 1.4rem;
|
||||
}
|
||||
:root {
|
||||
/* =================== 1. ACTOR SHEET FONT STYLES =========== */
|
||||
--window-header-title-font-family: CaslonAntique;
|
||||
@ -731,10 +734,36 @@ input:is(.blessure-premiers_soins, .blessure-soins_complets) {
|
||||
.flex-grow-3 {
|
||||
flex-grow: 3;
|
||||
}
|
||||
|
||||
.editor.prosemirror {
|
||||
fieldset {
|
||||
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;
|
||||
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 {
|
||||
border: 2;
|
||||
@ -742,6 +771,7 @@ input:is(.blessure-premiers_soins, .blessure-soins_complets) {
|
||||
min-height: 12rem;
|
||||
padding: 0 3px;
|
||||
}
|
||||
|
||||
.editor {
|
||||
border: 2;
|
||||
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){
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.foundryvtt-reve-de-dragon.sheet :is(.large-editor,.editor,.medium-editor,.small-editor) .editor.prosemirror{
|
||||
align-items: normal;
|
||||
}
|
||||
|
@ -742,9 +742,6 @@
|
||||
"objet": {
|
||||
"templates": ["description", "equipement", "inventaire"]
|
||||
},
|
||||
"monnaie": {
|
||||
"templates": ["description", "inventaire"]
|
||||
},
|
||||
"gemme": {
|
||||
"templates": ["description", "enchantable", "inventaire", "temporel"],
|
||||
"type": "",
|
||||
|
@ -2,19 +2,22 @@
|
||||
<h4 class="rdd-roll-part">{{alias}} réussit une attaque particulière!</strong></h4>
|
||||
{{#if isForce}}
|
||||
<br>
|
||||
<a class="chat-card-button particuliere-attaque" data-mode="force" data-attackerId="{{attackerId}}">
|
||||
<a class="chat-card-button particuliere-attaque" data-mode="force" data-attackerId="{{attackerId}}"
|
||||
data-defenderTokenId="{{defenderToken.id}}" data-attackerTokenId="{{attackerToken.id}}">
|
||||
Attaquer en Force
|
||||
</a>
|
||||
{{/if}}
|
||||
{{#if isRapide}}
|
||||
<br>
|
||||
<a class="chat-card-button particuliere-attaque" data-mode="rapidite" data-attackerId="{{attackerId}}">
|
||||
<a class="chat-card-button particuliere-attaque" data-mode="rapidite" data-attackerId="{{attackerId}}"
|
||||
data-defenderTokenId="{{defenderToken.id}}" data-attackerTokenId="{{attackerToken.id}}">
|
||||
Attaquer en Rapidité
|
||||
</a>
|
||||
{{/if}}
|
||||
{{#if isFinesse}}
|
||||
<br>
|
||||
<a class="chat-card-button particuliere-attaque" data-mode="finesse" data-attackerId="{{attackerId}}">
|
||||
<a class="chat-card-button particuliere-attaque" data-mode="finesse" data-attackerId="{{attackerId}}"
|
||||
data-defenderTokenId="{{defenderToken.id}}" data-attackerTokenId="{{attackerToken.id}}">
|
||||
Attaquer en Finesse
|
||||
</a>
|
||||
{{/if}}
|
||||
|
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