Compare commits

..

9 Commits

Author SHA1 Message Date
ecdcdb69d5 Item munition 2025-02-07 21:56:36 +01:00
8479fdda8a Affichage du coût
- affichage en erreur des monnaies sans valeur (dites "de glipzouk")
- gestion du prix parfois non modifiable
2025-02-07 21:56:36 +01:00
83e57fbbc7 Correction: diminution stress transformé 2025-02-07 21:56:35 +01:00
2d256b1217 Message d'expérience en sort
Adaptation du message d'xp en sort au renommage des voies draconiques
2025-02-07 20:48:19 +01:00
526d38d32e Commande /tirer cachée
Pour les messages sans actor, la méthode getOwners ne marchait
pas. En cas d'absence d'acteur, les gmroll doivent être pour le
joueur courant et les MJs
2025-02-07 20:48:19 +01:00
2ff3dfef89 Merge pull request 'v13 - DataModels & SheetV2 pour les monnaies' (#747) from VincentVk/foundryvtt-reve-de-dragon:v13 into v13
Reviewed-on: public/foundryvtt-reve-de-dragon#747
2025-02-06 10:42:16 +01:00
f1b6c01cd7 DataModel & SheetV2 pour les items Monnaie 2025-02-06 00:18:09 +01:00
675fe5838e Fix choix particulière 2025-02-05 22:59:02 +01:00
bafdec9924 Correction message min/max de race 2025-02-05 22:58:24 +01:00
30 changed files with 256 additions and 224 deletions

View File

@ -1,4 +1,12 @@
# 12.0 # 12.0
## 12.0.41 - La loupe d'Astrobazzarh
- On peut de nouveau effectuer des tirages cachés
- Le stress transformé est bien diminué lorsqu'on met le stress dans une compétence
## 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 ## 12.0.39 - Les mains d'Astrobazzarh
- les armes à 1 ou 2 mains fonctionnent dans les liens de jets de dés - 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 - commande `/jet` pour poster une demande de jet de dés

View File

@ -237,7 +237,11 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
this.html.find('.carac-xp-augmenter').click(async event => await this.actor.updateCaracXPAuto(event.currentTarget.name.replace("augmenter.", ""))) this.html.find('.carac-xp-augmenter').click(async event => await this.actor.updateCaracXPAuto(event.currentTarget.name.replace("augmenter.", "")))
this.html.find('.competence-xp-augmenter').click(async event => await this.actor.updateCompetenceXPAuto(RdDSheetUtility.getItemId(event))) this.html.find('.competence-xp-augmenter').click(async event => await this.actor.updateCompetenceXPAuto(RdDSheetUtility.getItemId(event)))
this.html.find('.competence-stress-augmenter').click(async event => await this.actor.updateCompetenceStress(RdDSheetUtility.getItemId(event))) this.html.find('.competence-stress-augmenter').click(async event =>{
await this.actor.updateCompetenceStress(RdDSheetUtility.getItemId(event))
this.render(true)
}
)
if (this.options.vueDetaillee) { if (this.options.vueDetaillee) {
// On carac change // On carac change

View File

@ -736,7 +736,7 @@ export class RdDActor extends RdDBaseActorSang {
await competence.update({ await competence.update({
"system.xp": toXp, "system.xp": toXp,
"system.niveau": toNiveau, "system.niveau": toNiveau,
}); }, { render: false })
await ExperienceLog.add(this, XP_TOPIC.XP, fromXp, toXp, competence.name); await ExperienceLog.add(this, XP_TOPIC.XP, fromXp, toXp, competence.name);
await ExperienceLog.add(this, XP_TOPIC.NIVEAU, fromNiveau, toNiveau, competence.name); await ExperienceLog.add(this, XP_TOPIC.NIVEAU, fromNiveau, toNiveau, competence.name);
} }
@ -767,7 +767,7 @@ export class RdDActor extends RdDBaseActorSang {
await competence.update({ await competence.update({
"system.xp": newXp, "system.xp": newXp,
"system.niveau": toNiveau, "system.niveau": toNiveau,
}); }, { render: false })
const toXpStress = Math.max(0, fromXpStress - xpUtilise); const toXpStress = Math.max(0, fromXpStress - xpUtilise);
await this.update({ "system.compteurs.experience.value": toXpStress }); await this.update({ "system.compteurs.experience.value": toXpStress });
@ -783,7 +783,7 @@ export class RdDActor extends RdDBaseActorSang {
const toNiveau = compValue ?? RdDItemCompetence.getNiveauBase(competence.system.categorie, competence.getCategories()); const toNiveau = compValue ?? RdDItemCompetence.getNiveauBase(competence.system.categorie, competence.getCategories());
this.notifyCompetencesTronc(competence, toNiveau); this.notifyCompetencesTronc(competence, toNiveau);
const fromNiveau = competence.system.niveau; const fromNiveau = competence.system.niveau;
await competence.update({ 'system.niveau': toNiveau }); await competence.update({ 'system.niveau': toNiveau }, { render: false })
await ExperienceLog.add(this, XP_TOPIC.NIVEAU, fromNiveau, toNiveau, competence.name, true); await ExperienceLog.add(this, XP_TOPIC.NIVEAU, fromNiveau, toNiveau, competence.name, true);
} }
} }
@ -808,7 +808,7 @@ export class RdDActor extends RdDBaseActorSang {
if (isNaN(toXp) || typeof (toXp) != 'number') toXp = 0; if (isNaN(toXp) || typeof (toXp) != 'number') toXp = 0;
const fromXp = competence.system.xp; const fromXp = competence.system.xp;
this.checkCompetenceXP(idOrName, toXp); this.checkCompetenceXP(idOrName, toXp);
await competence.update({ 'system.xp': toXp }); await competence.update({ 'system.xp': toXp }, { render: false })
await ExperienceLog.add(this, XP_TOPIC.XP, fromXp, toXp, competence.name, true); await ExperienceLog.add(this, XP_TOPIC.XP, fromXp, toXp, competence.name, true);
if (toXp > fromXp) { if (toXp > fromXp) {
RdDUtility.checkThanatosXP(competence) RdDUtility.checkThanatosXP(competence)
@ -822,7 +822,7 @@ export class RdDActor extends RdDBaseActorSang {
if (competence) { if (competence) {
if (isNaN(toXpSort) || typeof (toXpSort) != 'number') toXpSort = 0; if (isNaN(toXpSort) || typeof (toXpSort) != 'number') toXpSort = 0;
const fromXpSort = competence.system.xp_sort; const fromXpSort = competence.system.xp_sort;
await competence.update({ 'system.xp_sort': toXpSort }); await competence.update({ 'system.xp_sort': toXpSort }, { render: false })
await ExperienceLog.add(this, XP_TOPIC.XPSORT, fromXpSort, toXpSort, competence.name, true); await ExperienceLog.add(this, XP_TOPIC.XPSORT, fromXpSort, toXpSort, competence.name, true);
if (toXpSort > fromXpSort) { if (toXpSort > fromXpSort) {
RdDUtility.checkThanatosXP(competence) RdDUtility.checkThanatosXP(competence)
@ -834,7 +834,7 @@ export class RdDActor extends RdDBaseActorSang {
async updateCompetenceArchetype(idOrName, compValue) { async updateCompetenceArchetype(idOrName, compValue) {
let competence = this.getCompetence(idOrName) let competence = this.getCompetence(idOrName)
if (competence) { if (competence) {
await competence.update({ 'system.niveau_archetype': Math.max(compValue ?? 0, 0) }); await competence.update({ 'system.niveau_archetype': Math.max(compValue ?? 0, 0) })
} }
} }
@ -1584,7 +1584,7 @@ export class RdDActor extends RdDBaseActorSang {
/* -------------------------------------------- */ /* -------------------------------------------- */
async _appliquerAppelMoral(rollData) { async _appliquerAppelMoral(rollData) {
if (!rollData.use.moral || game.settings.get("core", "rollMode") == 'selfroll'){ if (!rollData.use.moral || game.settings.get("core", "rollMode") == 'selfroll') {
return return
} }
if (rollData.rolled.isEchec || if (rollData.rolled.isEchec ||
@ -2527,7 +2527,6 @@ export class RdDActor extends RdDBaseActorSang {
}) })
} }
const blessure = this.getItem(blessureId, 'blessure') const blessure = this.getItem(blessureId, 'blessure')
console.log('TODO update blessure', this, blessureId, rollData, rollData.tache);
if (blessure && !blessure.system.premierssoins.done) { if (blessure && !blessure.system.premierssoins.done) {
const tache = rollData.tache; const tache = rollData.tache;
if (rollData.rolled.isETotal) { if (rollData.rolled.isETotal) {

View File

@ -244,16 +244,19 @@ export class RdDBaseActor extends Actor {
async onUpdateActor(update, options, actorId) { } async onUpdateActor(update, options, actorId) { }
async onDeleteItem(item, options, id) { async onDeleteItem(item, options, id) {
if (item.isInventaire()) { if (item.isInventaire()) {
this._removeItemFromConteneur(item) await this._removeItemFromConteneur(item)
} }
} }
_removeItemFromConteneur(item) { async _removeItemFromConteneur(item) {
this.items.filter(it => it.isConteneur() && it.system.contenu.includes(item.id)) const updates = this.items.filter(it => it.isConteneur() && it.system.contenu.includes(item.id))
.forEach(conteneur => { .map(conteneur => {
const nouveauContenu = conteneur.system.contenu.filter(id => id != item.id); const nouveauContenu = conteneur.system.contenu.filter(id => id != item.id)
conteneur.update({ 'system.contenu': nouveauContenu }); return { _id: conteneur.id, 'system.contenu': nouveauContenu }
}); })
if (updates.length > 0) {
await this.updateEmbeddedDocuments('Item', updates)
}
} }
async onTimeChanging(oldTimestamp, newTimestamp) { async onTimeChanging(oldTimestamp, newTimestamp) {

View File

@ -1,3 +1,4 @@
export { default as RdDItemSheet} from "./common-item-sheet.mjs" export { default as RdDItemBaseSheet} from "./common-item-sheet.mjs"
export { default as RdDMonnaieSheet } from "./monnaie-sheet.mjs" export { default as RdDMonnaieSheet } from "./monnaie-sheet.mjs"
export { default as RdDMunitionSheet } from "./munition-sheet.mjs" export { default as RdDMunitionSheet } from "./munition-sheet.mjs"

View File

@ -1,8 +1,20 @@
const { HandlebarsApplicationMixin } = foundry.applications.api const { HandlebarsApplicationMixin } = foundry.applications.api
import { SYSTEM_RDD } from "../../constants.js" import { SYSTEM_RDD } from "../../constants.js"
import { Misc } from "../../misc.js" import { Misc } from "../../misc.js"
import { RdDSheetUtility } from "../../rdd-sheet-utility.js";
export default class RdDItemSheet extends HandlebarsApplicationMixin(foundry.applications.sheets.ItemSheetV2) {
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) { static register(sheetClass) {
const itemType = sheetClass.ITEM_TYPE const itemType = sheetClass.ITEM_TYPE
@ -13,20 +25,29 @@ export default class RdDItemSheet extends HandlebarsApplicationMixin(foundry.app
}) })
} }
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 } static get ITEM_TYPE() { return undefined }
/**
* Different sheet modes.
* @enum {number}
*/
static SHEET_MODES = { EDIT: 0, PLAY: 1 }
constructor(options = {}) { constructor(options = {}) {
super(options) super(options)
this.#dragDrop = this.#createDragDropHandlers()
} }
#dragDrop static get TEMPLATES() { return [] }
_sheetMode = this.constructor.SHEET_MODES.PLAY
/** @override */ /** @override */
static DEFAULT_OPTIONS = { static DEFAULT_OPTIONS = {
@ -41,140 +62,30 @@ export default class RdDItemSheet extends HandlebarsApplicationMixin(foundry.app
window: { window: {
resizable: true, resizable: true,
}, },
dragDrop: [{ dragSelector: "[data-drag]", dropSelector: null }],
actions: { actions: {
toggleSheet: RdDItemSheet.#onToggleSheet, editImage: RdDItemBaseSheet.#onEditImage,
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 */ /** @override */
async _prepareContext() { async _prepareContext() {
const context = { return {
item: this.document,
options: RdDSheetUtility.getOptions(this.document, this.isEditable),
fields: this.document.schema.fields, fields: this.document.schema.fields,
systemFields: this.document.system.schema.fields, systemFields: this.document.system.schema.fields,
item: this.document,
system: this.document.system, system: this.document.system,
source: this.document.toObject(), source: this.document.toObject(),
isEditMode: this.isEditMode,
isPlayMode: this.isPlayMode,
isEditable: this.isEditable, 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 // #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. * Handle changing a Document's image.
* *
* @this RdDItemSheet * @this RdDItemBaseSheet
* @param {PointerEvent} event The originating click event * @param {PointerEvent} event The originating click event
* @param {HTMLElement} target The capturing HTML element which defined a [data-action] * @param {HTMLElement} target The capturing HTML element which defined a [data-action]
* @returns {Promise} * @returns {Promise}

View File

@ -1,35 +1,35 @@
import { TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE } from "../../common/_module.mjs"; import { TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE } from "../../common/_module.mjs";
import { ITEM_TYPES } from "../../constants.js"; import { ITEM_TYPES } from "../../constants.js";
import RdDItemSheet from "./common-item-sheet.mjs"; import RdDItemBaseSheet from "./common-item-sheet.mjs";
export default class RdDMonnaieSheet extends RdDItemBaseSheet {
export default class RdDMonnaieSheet extends RdDItemSheet {
/** @override */ /** @override */
static get ITEM_TYPE() { return ITEM_TYPES.monnaie } static get ITEM_TYPE() { return ITEM_TYPES.monnaie }
static get TEMPLATES() { return [TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE] }
/** @override */ /** @override */
static DEFAULT_OPTIONS = { static DEFAULT_OPTIONS = Object.assign({},
RdDItemBaseSheet.DEFAULT_OPTIONS,
{
classes: ["fvtt-rdd", "item", "monnaie"], classes: ["fvtt-rdd", "item", "monnaie"],
position: { position: { width: 400 },
width: 600, window: { contentClasses: ["monnaie-content"] }
}, })
window: {
contentClasses: ["monnaie-content"],
},
}
/** @override */ /** @override */
static PARTS = { static PARTS = {
main: { main: {
template: "systems/foundryvtt-reve-de-dragon/templates/item/monnaie.hbs", template: "systems/foundryvtt-reve-de-dragon/templates/sheets/item/monnaie.hbs",
}, },
} }
/** @override */ /** @override */
async _prepareContext() { async _prepareContext() {
const context = await super._prepareContext() return Object.assign(
return Object.assign(context, await super._prepareContext(),
await TEMPLATE_DESCRIPTION.prepareContext(this.item), await TEMPLATE_DESCRIPTION.prepareContext(this.document),
await TEMPLATE_INVENTAIRE.prepareContext(this.item) await TEMPLATE_INVENTAIRE.prepareContext(this.document)
) )
} }
} }

View File

@ -1,35 +1,34 @@
import { TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE } from "../../common/_module.mjs"; import { TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE } from "../../common/_module.mjs";
import { ITEM_TYPES } from "../../constants.js"; import { ITEM_TYPES } from "../../constants.js";
import RdDItemSheet from "./common-item-sheet.mjs"; import RdDItemBaseSheet from "./common-item-sheet.mjs";
export default class RdDMunitionSheet extends RdDItemSheet { export default class RdDMunitionSheet extends RdDItemBaseSheet {
/** @override */ /** @override */
static get ITEM_TYPE() { return ITEM_TYPES.munition } static get ITEM_TYPE() { return ITEM_TYPES.munition }
static get TEMPLATES() { return [TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE] }
/** @override */ /** @override */
static DEFAULT_OPTIONS = { static DEFAULT_OPTIONS = Object.assign({},
RdDItemBaseSheet.DEFAULT_OPTIONS,
{
classes: ["fvtt-rdd", "item", "munition"], classes: ["fvtt-rdd", "item", "munition"],
position: { position: { width: 400 },
width: 600, window: { contentClasses: ["munition-content"] }
}, })
window: {
contentClasses: ["munition-content"],
},
}
/** @override */ /** @override */
static PARTS = { static PARTS = {
main: { main: {
template: "systems/foundryvtt-reve-de-dragon/templates/item/munition.hbs", template: "systems/foundryvtt-reve-de-dragon/templates/sheets/item/munition.hbs",
}, },
} }
/** @override */ /** @override */
async _prepareContext() { async _prepareContext() {
const context = await super._prepareContext() return Object.assign(
return Object.assign(context, await super._prepareContext(),
await TEMPLATE_DESCRIPTION.prepareContext(this.item), await TEMPLATE_DESCRIPTION.prepareContext(this.document),
await TEMPLATE_INVENTAIRE.prepareContext(this.item) await TEMPLATE_INVENTAIRE.prepareContext(this.document)
) )
} }
} }

View File

@ -62,7 +62,6 @@ export class ChatUtility {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static removeMessages(socketData) { static removeMessages(socketData) {
if (Misc.isFirstConnectedGM()) { if (Misc.isFirstConnectedGM()) {
ChatUtility.onRemoveMessages(socketData); ChatUtility.onRemoveMessages(socketData);
@ -97,7 +96,7 @@ export class ChatUtility {
} }
break break
case "gmroll": case "gmroll":
messageData.whisper = ChatUtility.getOwners(actor) messageData.whisper = actor ? ChatUtility.getOwners(actor) : ChatUtility.getUserAndGMs()
break break
case "selfroll": case "selfroll":
messageData.whisper = [game.user] messageData.whisper = [game.user]
@ -108,7 +107,7 @@ export class ChatUtility {
} }
static getOwners(document) { static getOwners(document) {
return game.users.filter(it => document.getUserLevel(it) == CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER) return document ? game.users.filter(it => document.getUserLevel(it) == CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER) : [game.user]
} }
static getUserAndGMs() { static getUserAndGMs() {
@ -199,7 +198,7 @@ export class ChatUtility {
static async onCreateChatMessage(chatMessage, options, id) { static async onCreateChatMessage(chatMessage, options, id) {
if (chatMessage.isAuthor) { if (chatMessage.isAuthor) {
await chatMessage.setFlag(SYSTEM_RDD, 'rdd-timestamp', game.system.rdd.calendrier.getTimestamp()); await chatMessage.setFlag(SYSTEM_RDD, 'rdd-timestamp', game.system.rdd.calendrier.getTimestamp());
await chatMessage.update({ content: await RdDTextEditor.enrichHTML(chatMessage.content, undefined, {showLink:false}) }) await chatMessage.update({ content: await RdDTextEditor.enrichHTML(chatMessage.content, undefined, { showLink: false }) })
} }
} }
} }

View File

@ -4,4 +4,5 @@ import { CommonInventaire } from "./inventaire.mjs";
export const TEMPLATE_DESCRIPTION = new CommonDescription() export const TEMPLATE_DESCRIPTION = new CommonDescription()
export const TEMPLATE_INVENTAIRE = new CommonInventaire() export const TEMPLATE_INVENTAIRE = new CommonInventaire()
export const ALL_COMMON_TEMPLATES = [TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE]

View File

@ -4,5 +4,7 @@
*/ */
export default class CommonTemplate { export default class CommonTemplate {
fields() { } fields() { }
handlebars() { return [] }
actions() { return {} }
async prepareContext(item) { } async prepareContext(item) { }
} }

View File

@ -12,11 +12,21 @@ export class CommonDescription extends CommonTemplate {
} }
} }
handlebars() {
return [
"systems/foundryvtt-reve-de-dragon/templates/sheets/item/common/template-description.hbs",
]
}
actions() {
return {}
}
async prepareContext(item) { async prepareContext(item) {
return { const enriched = {
description: await RdDTextEditor.enrichHTML(item.system.description, item), description: await RdDTextEditor.enrichHTML(item.system.description, item),
descriptionmj: await RdDTextEditor.enrichHTML(item.system.descriptionmj, item), descriptionmj: await RdDTextEditor.enrichHTML(item.system.descriptionmj, item),
} }
return { enriched }
} }
} }

View File

@ -3,7 +3,7 @@ export const DECIMAL = { required: true, nullable: false, min: 0, integer: false
export const INTEGER_SIGNED = { required: true, nullable: false, integer: true } export const INTEGER_SIGNED = { required: true, nullable: false, integer: true }
export const DECIMAL_SIGNED = { required: true, nullable: false, integer: false } export const DECIMAL_SIGNED = { required: true, nullable: false, integer: false }
export const STRING = { required: true, nullable: false, blank: true, trim: true } 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 HTMLSTRING = { initial: "", required: true, nullable: false, blank: true, textSearch: true }
export const MODEL_ARRAY = { initial: [], required: true, nullable: false } export const MODEL_ARRAY = { initial: [], required: true, nullable: false }

View File

@ -23,6 +23,14 @@ export class CommonInventaire extends CommonTemplate {
{ label: "Environnement", ...MODEL_ARRAY }), { label: "Environnement", ...MODEL_ARRAY }),
} }
} }
handlebars() {
return [
"systems/foundryvtt-reve-de-dragon/templates/sheets/item/common/template-inventaire.hbs"
]
}
async prepareContext(item) { async prepareContext(item) {
return {}
} }
} }

View File

@ -100,7 +100,7 @@ export class RdDItemSheetV1 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),
} }

View File

@ -832,7 +832,10 @@ export class RdDCombat {
/* -------------------------------------------- */ /* -------------------------------------------- */
async _onAttaqueNormale(attackerRoll) { async _onAttaqueNormale(attackerRoll) {
if (!RdDCombat.isReussite(attackerRoll) || RdDCombat.isParticuliere(attackerRoll)) { if (!RdDCombat.isReussite(attackerRoll)) {
return
}
if (RdDCombat.isParticuliere(attackerRoll) && attackerRoll.particuliere == undefined) {
return return
} }
console.log("RdDCombat.onAttaqueNormale >>>", attackerRoll); console.log("RdDCombat.onAttaqueNormale >>>", attackerRoll);
@ -849,7 +852,7 @@ export class RdDCombat {
return; return;
} }
if (this.target) { if (this.defender) {
await this._sendMessageDefense(attackerRoll, defenderRoll); await this._sendMessageDefense(attackerRoll, defenderRoll);
} }
} }
@ -999,7 +1002,7 @@ export class RdDCombat {
this.removeChatMessageActionsPasseArme(rollData.passeArme); this.removeChatMessageActionsPasseArme(rollData.passeArme);
rollData.particuliere = choix; rollData.particuliere = choix;
await this._onAttaqueNormale(rollData); await this._onAttaqueNormale(rollData)
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -213,8 +213,10 @@ export class SystemReveDeDragon {
makeDefault: true makeDefault: true
}) })
sheets.RdDItemSheet.register(sheets.RdDMonnaieSheet) sheets.RdDItemBaseSheet.registerAll(
sheets.RdDItemSheet.register(sheets.RdDMunitionSheet) sheets.RdDMonnaieSheet,
sheets.RdDMunitionSheet
)
Items.registerSheet(SYSTEM_RDD, RdDItemSheetV1, { Items.registerSheet(SYSTEM_RDD, RdDItemSheetV1, {
types: [ types: [

View File

@ -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))
} }

View File

@ -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;
} }

View File

@ -1,15 +1,18 @@
<div> <div>
<ul class="item-list"> <ul class="item-list">
<li class="item flexrow"> <li class="flexrow">
<label class="derivee-label" for="system.compteurs.experience.value">Stress transformé</label> <label class="derivee-label" for="system.compteurs.experience.value">Stress transformé</label>
{{#if options.vueDetaillee}} {{#if options.vueDetaillee}}
<input class="derivee-value" type="number" name="system.compteurs.experience.value" value="{{system.compteurs.experience.value}}" data-dtype="number" size="3"/> <input class="resource-content"
type="text" data-dtype="Number" size="3"
name="system.compteurs.experience.value"
value="{{system.compteurs.experience.value}}"/>
{{else}} {{else}}
<label name="system.compteurs.experience.value">{{system.compteurs.experience.value}}</label> <label name="system.compteurs.experience.value">{{system.compteurs.experience.value}}</label>
{{/if}} {{/if}}
</li> </li>
{{#if options.vueDetaillee}} {{#if options.vueDetaillee}}
<li class="item flexrow"> <li class="flexrow">
<span class="generic-label">Total XP compétences</span> <span class="generic-label">Total XP compétences</span>
<span class="competence-value">{{calc.competenceXPTotal}}</span> <span class="competence-value">{{calc.competenceXPTotal}}</span>
</li> </li>

View File

@ -2,19 +2,22 @@
<h4 class="rdd-roll-part">{{alias}} réussit une attaque particulière!</strong></h4> <h4 class="rdd-roll-part">{{alias}} réussit une attaque particulière!</strong></h4>
{{#if isForce}} {{#if isForce}}
<br> <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 Attaquer en Force
</a> </a>
{{/if}} {{/if}}
{{#if isRapide}} {{#if isRapide}}
<br> <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é Attaquer en Rapidité
</a> </a>
{{/if}} {{/if}}
{{#if isFinesse}} {{#if isFinesse}}
<br> <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 Attaquer en Finesse
</a> </a>
{{/if}} {{/if}}

View File

@ -4,7 +4,7 @@
<hr> <hr>
<div> <div>
{{#if rolled.isSuccess}} {{#if rolled.isSuccess}}
{{alias}} a gagné {{xpSort}} points d'expérience en sorts dans la {{competence.name}}. {{alias}} a gagné {{xpSort}} points d'expérience en sorts en {{competence.name}}.
{{else}} {{else}}
{{alias}} n'a pas pu interpréter le signe draconique. {{alias}} n'a pas pu interpréter le signe draconique.
{{/if}} {{/if}}

View File

@ -1,14 +0,0 @@
<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>

View 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>

View 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>

View File

@ -0,0 +1,17 @@
<fieldset>
{{formField systemFields.qualite value=system.qualite}}
{{formField systemFields.encombrement value=system.encombrement}}
{{formField systemFields.quantite value=system.quantite}}
<div class="form-group item-cout">
<label>Prix (sols)</label>
<div class="form-fields">
<input class="attribute-value number-x3 {{#if (and (eq item.type 'monnaie') (eq system.cout 0))}} field-error{{/if}}"
type="number" data-dtype="Number"
name="system.cout"
value="{{numberFormat system.cout decimals=2 sign=false}}"
{{#unless (isFieldInventaireModifiable type 'cout')}}disabled{{/unless}}
/>
</div>
</div>
</fieldset>

View File

@ -0,0 +1,5 @@
<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>

View File

@ -0,0 +1,5 @@
<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>