forked from public/foundryvtt-reve-de-dragon
Compare commits
9 Commits
v12
...
ecdcdb69d5
Author | SHA1 | Date | |
---|---|---|---|
ecdcdb69d5 | |||
8479fdda8a | |||
83e57fbbc7 | |||
2d256b1217 | |||
526d38d32e | |||
2ff3dfef89 | |||
f1b6c01cd7 | |||
675fe5838e | |||
bafdec9924 |
@ -1,4 +1,12 @@
|
||||
# 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
|
||||
- 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
|
||||
|
@ -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('.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) {
|
||||
// On carac change
|
||||
|
@ -736,7 +736,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
await competence.update({
|
||||
"system.xp": toXp,
|
||||
"system.niveau": toNiveau,
|
||||
});
|
||||
}, { render: false })
|
||||
await ExperienceLog.add(this, XP_TOPIC.XP, fromXp, toXp, 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({
|
||||
"system.xp": newXp,
|
||||
"system.niveau": toNiveau,
|
||||
});
|
||||
}, { render: false })
|
||||
const toXpStress = Math.max(0, fromXpStress - xpUtilise);
|
||||
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());
|
||||
this.notifyCompetencesTronc(competence, toNiveau);
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -808,7 +808,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
if (isNaN(toXp) || typeof (toXp) != 'number') toXp = 0;
|
||||
const fromXp = competence.system.xp;
|
||||
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);
|
||||
if (toXp > fromXp) {
|
||||
RdDUtility.checkThanatosXP(competence)
|
||||
@ -822,7 +822,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
if (competence) {
|
||||
if (isNaN(toXpSort) || typeof (toXpSort) != 'number') toXpSort = 0;
|
||||
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);
|
||||
if (toXpSort > fromXpSort) {
|
||||
RdDUtility.checkThanatosXP(competence)
|
||||
@ -834,7 +834,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
async updateCompetenceArchetype(idOrName, compValue) {
|
||||
let competence = this.getCompetence(idOrName)
|
||||
if (competence) {
|
||||
await competence.update({ 'system.niveau_archetype': Math.max(compValue ?? 0, 0) });
|
||||
await competence.update({ 'system.niveau_archetype': Math.max(compValue ?? 0, 0) })
|
||||
}
|
||||
}
|
||||
|
||||
@ -2527,7 +2527,6 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
})
|
||||
}
|
||||
const blessure = this.getItem(blessureId, 'blessure')
|
||||
console.log('TODO update blessure', this, blessureId, rollData, rollData.tache);
|
||||
if (blessure && !blessure.system.premierssoins.done) {
|
||||
const tache = rollData.tache;
|
||||
if (rollData.rolled.isETotal) {
|
||||
|
@ -244,16 +244,19 @@ export class RdDBaseActor extends Actor {
|
||||
async onUpdateActor(update, options, actorId) { }
|
||||
async onDeleteItem(item, options, id) {
|
||||
if (item.isInventaire()) {
|
||||
this._removeItemFromConteneur(item)
|
||||
await this._removeItemFromConteneur(item)
|
||||
}
|
||||
}
|
||||
|
||||
_removeItemFromConteneur(item) {
|
||||
this.items.filter(it => it.isConteneur() && it.system.contenu.includes(item.id))
|
||||
.forEach(conteneur => {
|
||||
const nouveauContenu = conteneur.system.contenu.filter(id => id != item.id);
|
||||
conteneur.update({ 'system.contenu': nouveauContenu });
|
||||
});
|
||||
async _removeItemFromConteneur(item) {
|
||||
const updates = this.items.filter(it => it.isConteneur() && it.system.contenu.includes(item.id))
|
||||
.map(conteneur => {
|
||||
const nouveauContenu = conteneur.system.contenu.filter(id => id != item.id)
|
||||
return { _id: conteneur.id, 'system.contenu': nouveauContenu }
|
||||
})
|
||||
if (updates.length > 0) {
|
||||
await this.updateEmbeddedDocuments('Item', updates)
|
||||
}
|
||||
}
|
||||
|
||||
async onTimeChanging(oldTimestamp, newTimestamp) {
|
||||
|
@ -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 RdDMunitionSheet } from "./munition-sheet.mjs"
|
||||
|
||||
|
@ -1,8 +1,20 @@
|
||||
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 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) {
|
||||
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 }
|
||||
/**
|
||||
* Different sheet modes.
|
||||
* @enum {number}
|
||||
*/
|
||||
static SHEET_MODES = { EDIT: 0, PLAY: 1 }
|
||||
|
||||
constructor(options = {}) {
|
||||
super(options)
|
||||
this.#dragDrop = this.#createDragDropHandlers()
|
||||
}
|
||||
|
||||
#dragDrop
|
||||
_sheetMode = this.constructor.SHEET_MODES.PLAY
|
||||
static get TEMPLATES() { return [] }
|
||||
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
@ -41,140 +62,30 @@ export default class RdDItemSheet extends HandlebarsApplicationMixin(foundry.app
|
||||
window: {
|
||||
resizable: true,
|
||||
},
|
||||
dragDrop: [{ dragSelector: "[data-drag]", dropSelector: null }],
|
||||
actions: {
|
||||
toggleSheet: RdDItemSheet.#onToggleSheet,
|
||||
editImage: RdDItemSheet.#onEditImage,
|
||||
},
|
||||
editImage: RdDItemBaseSheet.#onEditImage,
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the sheet currently in 'Play' mode?
|
||||
* @type {boolean}
|
||||
*/
|
||||
get isPlayMode() {
|
||||
return this._sheetMode === this.constructor.SHEET_MODES.PLAY
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the sheet currently in 'Edit' mode?
|
||||
* @type {boolean}
|
||||
*/
|
||||
get isEditMode() {
|
||||
return this._sheetMode === this.constructor.SHEET_MODES.EDIT
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = {
|
||||
return {
|
||||
item: this.document,
|
||||
options: RdDSheetUtility.getOptions(this.document, this.isEditable),
|
||||
fields: this.document.schema.fields,
|
||||
systemFields: this.document.system.schema.fields,
|
||||
item: this.document,
|
||||
system: this.document.system,
|
||||
source: this.document.toObject(),
|
||||
isEditMode: this.isEditMode,
|
||||
isPlayMode: this.isPlayMode,
|
||||
isEditable: this.isEditable,
|
||||
}
|
||||
return context
|
||||
}
|
||||
|
||||
/** @override */
|
||||
_onRender(context, options) {
|
||||
this.#dragDrop.forEach((d) => d.bind(this.element))
|
||||
}
|
||||
|
||||
// #region Drag-and-Drop Workflow
|
||||
/**
|
||||
* Create drag-and-drop workflow handlers for this Application
|
||||
* @returns {DragDrop[]} An array of DragDrop handlers
|
||||
* @private
|
||||
*/
|
||||
#createDragDropHandlers() {
|
||||
return this.options.dragDrop.map((d) => {
|
||||
d.permissions = {
|
||||
dragstart: this._canDragStart.bind(this),
|
||||
drop: this._canDragDrop.bind(this),
|
||||
}
|
||||
d.callbacks = {
|
||||
dragstart: this._onDragStart.bind(this),
|
||||
dragover: this._onDragOver.bind(this),
|
||||
drop: this._onDrop.bind(this),
|
||||
}
|
||||
return new DragDrop(d)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Define whether a user is able to begin a dragstart workflow for a given drag selector
|
||||
* @param {string} selector The candidate HTML selector for dragging
|
||||
* @returns {boolean} Can the current user drag this selector?
|
||||
* @protected
|
||||
*/
|
||||
_canDragStart(selector) {
|
||||
return this.isEditable
|
||||
}
|
||||
|
||||
/**
|
||||
* Define whether a user is able to conclude a drag-and-drop workflow for a given drop selector
|
||||
* @param {string} selector The candidate HTML selector for the drop target
|
||||
* @returns {boolean} Can the current user drop on this selector?
|
||||
* @protected
|
||||
*/
|
||||
_canDragDrop(selector) {
|
||||
return this.isEditable && this.document.isOwner
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback actions which occur at the beginning of a drag start workflow.
|
||||
* @param {DragEvent} event The originating DragEvent
|
||||
* @protected
|
||||
*/
|
||||
_onDragStart(event) {
|
||||
const el = event.currentTarget
|
||||
if ("link" in event.target.dataset) return
|
||||
|
||||
// Extract the data you need
|
||||
let dragData = null
|
||||
|
||||
if (!dragData) return
|
||||
|
||||
// Set data transfer
|
||||
event.dataTransfer.setData("text/plain", JSON.stringify(dragData))
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback actions which occur when a dragged element is over a drop target.
|
||||
* @param {DragEvent} event The originating DragEvent
|
||||
* @protected
|
||||
*/
|
||||
_onDragOver(event) { }
|
||||
|
||||
/**
|
||||
* Callback actions which occur when a dragged element is dropped on a target.
|
||||
* @param {DragEvent} event The originating DragEvent
|
||||
* @protected
|
||||
*/
|
||||
async _onDrop(event) { }
|
||||
|
||||
// #endregion
|
||||
|
||||
// #region Actions
|
||||
/**
|
||||
* Handle toggling between Edit and Play mode.
|
||||
* @param {Event} event The initiating click event.
|
||||
* @param {HTMLElement} target The current target of the event listener.
|
||||
*/
|
||||
static #onToggleSheet(event, target) {
|
||||
const modes = this.constructor.SHEET_MODES
|
||||
this._sheetMode = this.isEditMode ? modes.PLAY : modes.EDIT
|
||||
this.render()
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle changing a Document's image.
|
||||
*
|
||||
* @this RdDItemSheet
|
||||
* @this RdDItemBaseSheet
|
||||
* @param {PointerEvent} event The originating click event
|
||||
* @param {HTMLElement} target The capturing HTML element which defined a [data-action]
|
||||
* @returns {Promise}
|
||||
|
@ -1,35 +1,35 @@
|
||||
import { TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE } from "../../common/_module.mjs";
|
||||
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 */
|
||||
static get ITEM_TYPE() { return ITEM_TYPES.monnaie }
|
||||
static get TEMPLATES() { return [TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE] }
|
||||
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
static DEFAULT_OPTIONS = Object.assign({},
|
||||
RdDItemBaseSheet.DEFAULT_OPTIONS,
|
||||
{
|
||||
classes: ["fvtt-rdd", "item", "monnaie"],
|
||||
position: {
|
||||
width: 600,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["monnaie-content"],
|
||||
},
|
||||
}
|
||||
position: { width: 400 },
|
||||
window: { contentClasses: ["monnaie-content"] }
|
||||
})
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
main: {
|
||||
template: "systems/foundryvtt-reve-de-dragon/templates/item/monnaie.hbs",
|
||||
template: "systems/foundryvtt-reve-de-dragon/templates/sheets/item/monnaie.hbs",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
return Object.assign(context,
|
||||
await TEMPLATE_DESCRIPTION.prepareContext(this.item),
|
||||
await TEMPLATE_INVENTAIRE.prepareContext(this.item)
|
||||
return Object.assign(
|
||||
await super._prepareContext(),
|
||||
await TEMPLATE_DESCRIPTION.prepareContext(this.document),
|
||||
await TEMPLATE_INVENTAIRE.prepareContext(this.document)
|
||||
)
|
||||
}
|
||||
}
|
@ -1,35 +1,34 @@
|
||||
import { TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE } from "../../common/_module.mjs";
|
||||
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 */
|
||||
static get ITEM_TYPE() { return ITEM_TYPES.munition }
|
||||
static get TEMPLATES() { return [TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE] }
|
||||
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
static DEFAULT_OPTIONS = Object.assign({},
|
||||
RdDItemBaseSheet.DEFAULT_OPTIONS,
|
||||
{
|
||||
classes: ["fvtt-rdd", "item", "munition"],
|
||||
position: {
|
||||
width: 600,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["munition-content"],
|
||||
},
|
||||
}
|
||||
position: { width: 400 },
|
||||
window: { contentClasses: ["munition-content"] }
|
||||
})
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
main: {
|
||||
template: "systems/foundryvtt-reve-de-dragon/templates/item/munition.hbs",
|
||||
template: "systems/foundryvtt-reve-de-dragon/templates/sheets/item/munition.hbs",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
return Object.assign(context,
|
||||
await TEMPLATE_DESCRIPTION.prepareContext(this.item),
|
||||
await TEMPLATE_INVENTAIRE.prepareContext(this.item)
|
||||
return Object.assign(
|
||||
await super._prepareContext(),
|
||||
await TEMPLATE_DESCRIPTION.prepareContext(this.document),
|
||||
await TEMPLATE_INVENTAIRE.prepareContext(this.document)
|
||||
)
|
||||
}
|
||||
}
|
@ -62,7 +62,6 @@ export class ChatUtility {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
static removeMessages(socketData) {
|
||||
if (Misc.isFirstConnectedGM()) {
|
||||
ChatUtility.onRemoveMessages(socketData);
|
||||
@ -97,7 +96,7 @@ export class ChatUtility {
|
||||
}
|
||||
break
|
||||
case "gmroll":
|
||||
messageData.whisper = ChatUtility.getOwners(actor)
|
||||
messageData.whisper = actor ? ChatUtility.getOwners(actor) : ChatUtility.getUserAndGMs()
|
||||
break
|
||||
case "selfroll":
|
||||
messageData.whisper = [game.user]
|
||||
@ -108,7 +107,7 @@ export class ChatUtility {
|
||||
}
|
||||
|
||||
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() {
|
||||
|
@ -4,4 +4,5 @@ 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]
|
||||
|
||||
|
@ -4,5 +4,7 @@
|
||||
*/
|
||||
export default class CommonTemplate {
|
||||
fields() { }
|
||||
handlebars() { return [] }
|
||||
actions() { return {} }
|
||||
async prepareContext(item) { }
|
||||
}
|
@ -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) {
|
||||
return {
|
||||
const enriched = {
|
||||
description: await RdDTextEditor.enrichHTML(item.system.description, item),
|
||||
descriptionmj: await RdDTextEditor.enrichHTML(item.system.descriptionmj, item),
|
||||
}
|
||||
return { enriched }
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 DECIMAL_SIGNED = { required: true, nullable: false, integer: false }
|
||||
export const STRING = { required: true, nullable: false, blank: true, trim: true }
|
||||
export const HTMLSTRING = { initial: "", required: true, nullable: false, blank: true, trim: false, textSearch: true }
|
||||
export const HTMLSTRING = { initial: "", required: true, nullable: false, blank: true, textSearch: true }
|
||||
|
||||
export const MODEL_ARRAY = { initial: [], required: true, nullable: false }
|
||||
|
||||
|
@ -23,6 +23,14 @@ export class CommonInventaire extends CommonTemplate {
|
||||
{ label: "Environnement", ...MODEL_ARRAY }),
|
||||
}
|
||||
}
|
||||
|
||||
handlebars() {
|
||||
return [
|
||||
"systems/foundryvtt-reve-de-dragon/templates/sheets/item/common/template-inventaire.hbs"
|
||||
]
|
||||
}
|
||||
|
||||
async prepareContext(item) {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ export class RdDItemSheetV1 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),
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
@ -213,8 +213,10 @@ export class SystemReveDeDragon {
|
||||
makeDefault: true
|
||||
})
|
||||
|
||||
sheets.RdDItemSheet.register(sheets.RdDMonnaieSheet)
|
||||
sheets.RdDItemSheet.register(sheets.RdDMunitionSheet)
|
||||
sheets.RdDItemBaseSheet.registerAll(
|
||||
sheets.RdDMonnaieSheet,
|
||||
sheets.RdDMunitionSheet
|
||||
)
|
||||
|
||||
Items.registerSheet(SYSTEM_RDD, RdDItemSheetV1, {
|
||||
types: [
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -1,15 +1,18 @@
|
||||
<div>
|
||||
<ul class="item-list">
|
||||
<li class="item flexrow">
|
||||
<li class="flexrow">
|
||||
<label class="derivee-label" for="system.compteurs.experience.value">Stress transformé</label>
|
||||
{{#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}}
|
||||
<label name="system.compteurs.experience.value">{{system.compteurs.experience.value}}</label>
|
||||
{{/if}}
|
||||
</li>
|
||||
{{#if options.vueDetaillee}}
|
||||
<li class="item flexrow">
|
||||
<li class="flexrow">
|
||||
<span class="generic-label">Total XP compétences</span>
|
||||
<span class="competence-value">{{calc.competenceXPTotal}}</span>
|
||||
</li>
|
||||
|
@ -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}}
|
||||
|
@ -4,7 +4,7 @@
|
||||
<hr>
|
||||
<div>
|
||||
{{#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}}
|
||||
{{alias}} n'a pas pu interpréter le signe draconique.
|
||||
{{/if}}
|
||||
|
@ -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>
|
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>
|
17
templates/sheets/item/common/template-inventaire.hbs
Normal file
17
templates/sheets/item/common/template-inventaire.hbs
Normal 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>
|
5
templates/sheets/item/monnaie.hbs
Normal file
5
templates/sheets/item/monnaie.hbs
Normal 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>
|
5
templates/sheets/item/munition.hbs
Normal file
5
templates/sheets/item/munition.hbs
Normal 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>
|
Reference in New Issue
Block a user