Cleanup & Reformatage

This commit is contained in:
Vincent Vandemeulebrouck 2022-11-05 18:06:30 +01:00
parent d183ce505a
commit e198cb60b1
21 changed files with 1111 additions and 1175 deletions

View File

@ -1,14 +1,9 @@
import { RdDActorSheet } from "./actor-sheet.js";
/** /**
* Extend the basic ActorSheet with some very simple modifications * Extend the basic ActorSheet with some very simple modifications
* @extends {ActorSheet} * @extends {ActorSheet}
*/ */
import { RdDUtility } from "./rdd-utility.js";
import { RdDActorSheet } from "./actor-sheet.js";
import { RdDCarac } from "./rdd-carac.js";
/* -------------------------------------------- */
export class RdDActorCreatureSheet extends RdDActorSheet { export class RdDActorCreatureSheet extends RdDActorSheet {
/** @override */ /** @override */
@ -19,7 +14,7 @@ export class RdDActorCreatureSheet extends RdDActorSheet {
width: 640, width: 640,
height: 720, height: 720,
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac" }], tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac" }],
dragDrop: [{ dragSelector: ".item-list .item", dropSelector: null }] dragDrop: [{ dragSelector: ".item-list .item", dropSelector: undefined }]
}); });
} }

View File

@ -1,6 +1,4 @@
import { RdDActorSheet } from "./actor-sheet.js"; import { RdDActorSheet } from "./actor-sheet.js";
import { HtmlUtility } from "./html-utility.js";
import { RdDUtility } from "./rdd-utility.js";
export class RdDActorEntiteSheet extends RdDActorSheet { export class RdDActorEntiteSheet extends RdDActorSheet {
@ -12,7 +10,7 @@ export class RdDActorEntiteSheet extends RdDActorSheet {
width: 640, width: 640,
height: 720, height: 720,
tabs: [{navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac"}], tabs: [{navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac"}],
dragDrop: [{dragSelector: ".item-list .item", dropSelector: null}] dragDrop: [{dragSelector: ".item-list .item", dropSelector: undefined}]
}); });
} }

View File

@ -1,8 +1,3 @@
/**
* Extend the basic ActorSheet with some very simple modifications
* @extends {ActorSheet}
*/
import { RdDUtility } from "./rdd-utility.js"; import { RdDUtility } from "./rdd-utility.js";
import { HtmlUtility } from "./html-utility.js"; import { HtmlUtility } from "./html-utility.js";
import { RdDItemArme } from "./item-arme.js"; import { RdDItemArme } from "./item-arme.js";
@ -18,6 +13,10 @@ import { RdDSheetUtility } from "./rdd-sheet-utility.js";
import { STATUSES } from "./status-effects.js"; import { STATUSES } from "./status-effects.js";
/* -------------------------------------------- */ /* -------------------------------------------- */
/**
* Extend the basic ActorSheet with some very simple modifications
* @extends {ActorSheet}
*/
export class RdDActorSheet extends ActorSheet { export class RdDActorSheet extends ActorSheet {
/** @override */ /** @override */
@ -28,7 +27,7 @@ export class RdDActorSheet extends ActorSheet {
template: "systems/foundryvtt-reve-de-dragon/templates/actor-sheet.html", template: "systems/foundryvtt-reve-de-dragon/templates/actor-sheet.html",
width: 640, width: 640,
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac" }], tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac" }],
dragDrop: [{ dragSelector: ".item-list .item", dropSelector: null }], dragDrop: [{ dragSelector: ".item-list .item", dropSelector: undefined }],
showCompNiveauBase: false, showCompNiveauBase: false,
vueDetaillee: false vueDetaillee: false
}); });

View File

@ -1,5 +1,4 @@
import { RdDUtility } from "./rdd-utility.js"; import { RdDUtility } from "./rdd-utility.js";
import { RdDSheetUtility } from "./rdd-sheet-utility.js";
import { RdDActorSheet } from "./actor-sheet.js"; import { RdDActorSheet } from "./actor-sheet.js";
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -15,7 +14,7 @@ export class RdDActorVehiculeSheet extends RdDActorSheet {
width: 640, width: 640,
height: 720, height: 720,
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac" }], tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac" }],
dragDrop: [{ dragSelector: ".item-list .item", dropSelector: null }] dragDrop: [{ dragSelector: ".item-list .item", dropSelector: undefined }]
}); });
} }

View File

@ -56,6 +56,7 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
static init() { static init() {
Hooks.on("preUpdateItem", (item, change, options, id) => RdDActor.getParentActor(item)?.onPreUpdateItem(item, change, options, id)); Hooks.on("preUpdateItem", (item, change, options, id) => RdDActor.getParentActor(item)?.onPreUpdateItem(item, change, options, id));
// TODO: replace with pre-hooks?
Hooks.on("createItem", (item, options, id) => RdDActor.getParentActor(item)?.onCreateItem(item, options, id)); Hooks.on("createItem", (item, options, id) => RdDActor.getParentActor(item)?.onCreateItem(item, options, id));
Hooks.on("deleteItem", (item, options, id) => RdDActor.getParentActor(item)?.onDeleteItem(item, options, id)); Hooks.on("deleteItem", (item, options, id) => RdDActor.getParentActor(item)?.onDeleteItem(item, options, id));
Hooks.on("updateActor", (actor, change, options, actorId) => actor.onUpdateActor(change, options, actorId)); Hooks.on("updateActor", (actor, change, options, actorId) => actor.onUpdateActor(change, options, actorId));

View File

@ -6,7 +6,7 @@ const LATEST_USED_JOURNAL_ID = "chronologie-dernier-journal";
export class DialogChronologie extends Dialog { export class DialogChronologie extends Dialog {
static onInit() { static init() {
game.settings.register(SYSTEM_RDD, LATEST_USED_JOURNAL_ID, { game.settings.register(SYSTEM_RDD, LATEST_USED_JOURNAL_ID, {
name: "Dernier article de journal utilisé pour enregistrer la chronologie", name: "Dernier article de journal utilisé pour enregistrer la chronologie",
scope: "client", scope: "client",

View File

@ -4,7 +4,6 @@ import { RdDAlchimie } from "./rdd-alchimie.js";
import { RdDItemCompetence } from "./item-competence.js"; import { RdDItemCompetence } from "./item-competence.js";
import { RdDHerbes } from "./rdd-herbes.js"; import { RdDHerbes } from "./rdd-herbes.js";
import { RdDGemme } from "./rdd-gemme.js"; import { RdDGemme } from "./rdd-gemme.js";
import { Misc } from "./misc.js";
import { HtmlUtility } from "./html-utility.js"; import { HtmlUtility } from "./html-utility.js";
import { ReglesOptionelles } from "./regles-optionelles.js"; import { ReglesOptionelles } from "./regles-optionelles.js";
import { SYSTEM_RDD } from "./constants.js"; import { SYSTEM_RDD } from "./constants.js";
@ -67,8 +66,6 @@ export class RdDItemSheet extends ItemSheet {
img: this.item.img, img: this.item.img,
name: this.item.name, name: this.item.name,
system: this.item.system, system: this.item.system,
// TODO: v10 remove
data: this.item.system,
isGM: game.user.isGM, isGM: game.user.isGM,
actorId: this.actor?.id, actorId: this.actor?.id,
owner: this.item.isOwner, owner: this.item.isOwner,

View File

@ -301,8 +301,7 @@ export class RdDItem extends Item {
async postItem(modeOverride) { async postItem(modeOverride) {
console.log(this); console.log(this);
let chatData = duplicate(this); let chatData = duplicate(this);
const properties = this.getProprietes(); chatData["properties"] = this.getProprietes();
chatData["properties"] = properties
if (this.actor) { if (this.actor) {
chatData.actor = { id: this.actor.id }; chatData.actor = { id: this.actor.id };
} }
@ -325,254 +324,204 @@ export class RdDItem extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
_objetChatData() { _objetChatData() {
const tplData = this.system return [].concat(
let properties = [].concat( RdDItem.propertyIfDefined('Résistance', this.system.resistance, this.system.resistance),
RdDItem.propertyIfDefined('Résistance', tplData.resistance, tplData.resistance), RdDItem.propertyIfDefined('Qualité', this.system.qualite, this.system.qualite),
RdDItem.propertyIfDefined('Qualité', tplData.qualite, tplData.qualite), RdDItem.propertyIfDefined('Encombrement', this.system.encombrement),
RdDItem.propertyIfDefined('Encombrement', tplData.encombrement),
); );
return properties;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_nourritureboissonChatData() { _nourritureboissonChatData() {
const tplData = this.system return [].concat(
let properties = [].concat( RdDItem.propertyIfDefined('Sustentation', this.system.sust, this.system.sust > 0),
RdDItem.propertyIfDefined('Sustentation', tplData.sust, tplData.sust > 0), RdDItem.propertyIfDefined('Désaltère', this.system.desaltere, this.system.boisson),
RdDItem.propertyIfDefined('Désaltère', tplData.desaltere, tplData.boisson), RdDItem.propertyIfDefined('Force alcool', this.system.force, this.system.boisson && this.system.alcoolise),
RdDItem.propertyIfDefined('Force alcool', tplData.force, tplData.boisson && tplData.alcoolise), RdDItem.propertyIfDefined('Exotisme', this.system.exotisme, this.system.exotisme < 0),
RdDItem.propertyIfDefined('Exotisme', tplData.exotisme, tplData.exotisme < 0), RdDItem.propertyIfDefined('Qualité', this.system.qualite, this.system.qualite),
RdDItem.propertyIfDefined('Qualité', tplData.qualite, tplData.qualite), RdDItem.propertyIfDefined('Encombrement', this.system.encombrement),
RdDItem.propertyIfDefined('Encombrement', tplData.encombrement),
); );
return properties;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_armeChatData() { _armeChatData() {
const tplData = this.system return [
let properties = [ `<b>Compétence</b>: ${this.system.competence}`,
`<b>Compétence</b>: ${tplData.competence}`, `<b>Dommages</b>: ${this.system.dommages}`,
`<b>Dommages</b>: ${tplData.dommages}`, `<b>Force minimum</b>: ${this.system.force}`,
`<b>Force minimum</b>: ${tplData.force}`, `<b>Resistance</b>: ${this.system.resistance}`,
`<b>Resistance</b>: ${tplData.resistance}`, `<b>Encombrement</b>: ${this.system.encombrement}`
`<b>Encombrement</b>: ${tplData.encombrement}`
] ]
return properties;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_conteneurChatData() { _conteneurChatData() {
const tplData = this.system return [
let properties = [ `<b>Capacité</b>: ${this.system.capacite} Enc.`,
`<b>Capacité</b>: ${tplData.capacite} Enc.`, `<b>Encombrement</b>: ${this.system.encombrement}`
`<b>Encombrement</b>: ${tplData.encombrement}`
] ]
return properties;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_munitionChatData() { _munitionChatData() {
const tplData = this.system return [
let properties = [ `<b>Encombrement</b>: ${this.system.encombrement}`
`<b>Encombrement</b>: ${tplData.encombrement}`
] ]
return properties;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_armureChatData() { _armureChatData() {
const tplData = this.system return [
let properties = [ `<b>Protection</b>: ${this.system.protection}`,
`<b>Protection</b>: ${tplData.protection}`, `<b>Détérioration</b>: ${this.system.deterioration}`,
`<b>Détérioration</b>: ${tplData.deterioration}`, `<b>Malus armure</b>: ${this.system.malus}`,
`<b>Malus armure</b>: ${tplData.malus}`, `<b>Encombrement</b>: ${this.system.encombrement}`
`<b>Encombrement</b>: ${tplData.encombrement}`
] ]
return properties;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_competenceChatData() { _competenceChatData() {
const tplData = this.system return [
let properties = [ `<b>Catégorie</b>: ${this.system.categorie}`,
`<b>Catégorie</b>: ${tplData.categorie}`, `<b>Niveau</b>: ${this.system.niveau}`,
`<b>Niveau</b>: ${tplData.niveau}`, `<b>Caractéristique par défaut</b>: ${this.system.carac_defaut}`,
`<b>Caractéristique par défaut</b>: ${tplData.carac_defaut}`, `<b>XP</b>: ${this.system.xp}`
`<b>XP</b>: ${tplData.xp}`
] ]
return properties;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_competencecreatureChatData() { _competencecreatureChatData() {
const tplData = this.system return [
let properties = [ `<b>Catégorie</b>: ${this.system.categorie}`,
`<b>Catégorie</b>: ${tplData.categorie}`, `<b>Niveau</b>: ${this.system.niveau}`,
`<b>Niveau</b>: ${tplData.niveau}`, `<b>Caractéristique</b>: ${this.system.carac_value}`,
`<b>Caractéristique</b>: ${tplData.carac_value}`, `<b>XP</b>: ${this.system.xp}`
`<b>XP</b>: ${tplData.xp}`
] ]
return properties;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_sortChatData() { _sortChatData() {
const tplData = this.system return [
let properties = [ `<b>Draconic</b>: ${this.system.draconic}`,
`<b>Draconic</b>: ${tplData.draconic}`, `<b>Difficulté</b>: ${this.system.difficulte}`,
`<b>Difficulté</b>: ${tplData.difficulte}`, `<b>Case TMR</b>: ${this.system.caseTMR}`,
`<b>Case TMR</b>: ${tplData.caseTMR}`, `<b>Points de Rêve</b>: ${this.system.ptreve}`
`<b>Points de Rêve</b>: ${tplData.ptreve}`
] ]
return properties;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_herbeChatData() { _herbeChatData() {
const tplData = this.system return [
let properties = [ `<b>Milieu</b>: ${this.system.milieu}`,
`<b>Milieu</b>: ${tplData.milieu}`, `<b>Rareté</b>: ${this.system.rarete}`,
`<b>Rareté</b>: ${tplData.rarete}`, `<b>Catégorie</b>: ${this.system.categorie}`,
`<b>Catégorie</b>: ${tplData.categorie}`,
] ]
return properties;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_ingredientChatData() { _ingredientChatData() {
const tplData = this.system return [
let properties = [ `<b>Milieu</b>: ${this.system.milieu}`,
`<b>Milieu</b>: ${tplData.milieu}`, `<b>Rareté</b>: ${this.system.rarete}`,
`<b>Rareté</b>: ${tplData.rarete}`, `<b>Catégorie</b>: ${this.system.categorie}`,
`<b>Catégorie</b>: ${tplData.categorie}`,
] ]
return properties;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_tacheChatData() { _tacheChatData() {
const tplData = this.system return [
let properties = [ `<b>Caractéristique</b>: ${this.system.carac}`,
`<b>Caractéristique</b>: ${tplData.carac}`, `<b>Compétence</b>: ${this.system.competence}`,
`<b>Compétence</b>: ${tplData.competence}`, `<b>Périodicité</b>: ${this.system.periodicite}`,
`<b>Périodicité</b>: ${tplData.periodicite}`, `<b>Fatigue</b>: ${this.system.fatigue}`,
`<b>Fatigue</b>: ${tplData.fatigue}`, `<b>Difficulté</b>: ${this.system.difficulte}`
`<b>Difficulté</b>: ${tplData.difficulte}`
].concat([ ].concat([
tplData.cacher_points_de_tache ? [] :`<b>Points de Tâche</b>: ${tplData.points_de_tache}` this.system.cacher_points_de_tache ? [] :`<b>Points de Tâche</b>: ${this.system.points_de_tache}`
]).concat([ ]).concat([
`<b>Points de Tâche atteints</b>: ${tplData.points_de_tache_courant}`] `<b>Points de Tâche atteints</b>: ${this.system.points_de_tache_courant}`]
); );
return properties;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_livreChatData() { _livreChatData() {
const tplData = this.system return [
let properties = [ `<b>Compétence</b>: ${this.system.competence}`,
`<b>Compétence</b>: ${tplData.competence}`, `<b>Auteur</b>: ${this.system.auteur}`,
`<b>Auteur</b>: ${tplData.auteur}`, `<b>Difficulté</b>: ${this.system.difficulte}`,
`<b>Difficulté</b>: ${tplData.difficulte}`, `<b>Points de Tâche</b>: ${this.system.points_de_tache}`,
`<b>Points de Tâche</b>: ${tplData.points_de_tache}`, `<b>Encombrement</b>: ${this.system.encombrement}`
`<b>Encombrement</b>: ${tplData.encombrement}`
] ]
return properties;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_potionChatData() { _potionChatData() {
const tplData = this.system return [
let properties = [ `<b>Rareté</b>: ${this.system.rarete}`,
`<b>Rareté</b>: ${tplData.rarete}`, `<b>Catégorie</b>: ${this.system.categorie}`,
`<b>Catégorie</b>: ${tplData.categorie}`, `<b>Encombrement</b>: ${this.system.encombrement}`,
`<b>Encombrement</b>: ${tplData.encombrement}`,
] ]
return properties;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_queueChatData() { _queueChatData() {
const tplData = this.system return [
let properties = [ `<b>Refoulement</b>: ${this.system.refoulement}`
`<b>Refoulement</b>: ${tplData.refoulement}`
] ]
return properties;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_ombreChatData() { _ombreChatData() {
const tplData = this.system return [
let properties = [ `<b>Refoulement</b>: ${this.system.refoulement}`
`<b>Refoulement</b>: ${tplData.refoulement}`
] ]
return properties;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_souffleChatData() { _souffleChatData() {
const tplData = this.system return [];
let properties = [];
return properties;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_teteChatData() { _teteChatData() {
const tplData = this.system return [];
let properties = [];
return properties;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_tarotChatData() { _tarotChatData() {
const tplData = this.system return [
let properties = [ `<b>Concept</b>: ${this.system.concept}`,
`<b>Concept</b>: ${tplData.concept}`, `<b>Aspect</b>: ${this.system.aspect}`,
`<b>Aspect</b>: ${tplData.aspect}`,
] ]
return properties;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_nombreastralChatData() { _nombreastralChatData() {
const tplData = this.system return [
let properties = [ `<b>Valeur</b>: ${this.system.value}`,
`<b>Valeur</b>: ${tplData.value}`, `<b>Jour</b>: ${this.system.jourlabel}`,
`<b>Jour</b>: ${tplData.jourlabel}`,
] ]
return properties;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_monnaieChatData() { _monnaieChatData() {
const tplData = this.system return [
let properties = [ `<b>Valeur en Deniers</b>: ${this.system.valeur_deniers}`,
`<b>Valeur en Deniers</b>: ${tplData.valeur_deniers}`, `<b>Encombrement</b>: ${this.system.encombrement}`
`<b>Encombrement</b>: ${tplData.encombrement}`
] ]
return properties;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_meditationChatData() { _meditationChatData() {
const tplData = this.system return [
let properties = [ `<b>Thème</b>: ${this.system.theme}`,
`<b>Thème</b>: ${tplData.theme}`, `<b>Compétence</b>: ${this.system.competence}`,
`<b>Compétence</b>: ${tplData.competence}`, `<b>Support</b>: ${this.system.support}`,
`<b>Support</b>: ${tplData.support}`, `<b>Heure</b>: ${this.system.heure}`,
`<b>Heure</b>: ${tplData.heure}`, `<b>Purification</b>: ${this.system.purification}`,
`<b>Purification</b>: ${tplData.purification}`, `<b>Vêture</b>: ${this.system.veture}`,
`<b>Vêture</b>: ${tplData.veture}`, `<b>Comportement</b>: ${this.system.comportement}`,
`<b>Comportement</b>: ${tplData.comportement}`, `<b>Case TMR</b>: ${this.system.tmr}`
`<b>Case TMR</b>: ${tplData.tmr}`
] ]
return properties;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_casetmrChatData() { _casetmrChatData() {
const tplData = this.system return [
let properties = [ `<b>Coordonnée</b>: ${this.system.coord}`,
`<b>Coordonnée</b>: ${tplData.coord}`, `<b>Spécificité</b>: ${this.system.specific}`
`<b>Spécificité</b>: ${tplData.specific}`
] ]
return properties;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_maladieChatData() { _maladieChatData() {
const tplData = this.system if (!this.system.identifie) {
let properties return [`<b>Inconnue</b>`]
if (tplData.identifie) { }
properties = [ let properties = [
`<b>Malignité</b>: ${tplData.malignite}`, `<b>Malignité</b>: ${this.system.malignite}`,
`<b>Périodicité</b>: ${tplData.periodicite}`, `<b>Périodicité</b>: ${this.system.periodicite}`,
`<b>Dommages</b>: ${tplData.dommages}` `<b>Dommages</b>: ${this.system.dommages}`
] ]
if (tplData.remedesconnus) { if (this.system.remedesconnus) {
properties.push(`<b>Remedes</b>: ${tplData.remedes}`) properties.push(`<b>Remedes</b>: ${this.system.remedes}`)
}
} else {
properties = [
`<b>Inconnue</b>`]
} }
return properties; return properties;
} }
@ -584,15 +533,13 @@ export class RdDItem extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
_gemmeChatData() { _gemmeChatData() {
const tplData = this.system return [
let properties = [ `<b>Pureté</b>: ${this.system.purete}`,
`<b>Pureté</b>: ${tplData.purete}`, `<b>Taille</b>: ${this.system.taille}`,
`<b>Taille</b>: ${tplData.taille}`, `<b>Inertie</b>: ${this.system.inertie}`,
`<b>Inertie</b>: ${tplData.inertie}`, `<b>Enchantabilité</b>: ${this.system.enchantabilite}`,
`<b>Enchantabilité</b>: ${tplData.enchantabilite}`, `<b>Prix</b>: ${this.system.cout}`,
`<b>Prix</b>: ${tplData.cout}`,
] ]
return properties;
} }

View File

@ -458,7 +458,7 @@ export class RdDCalendrier extends Application {
function check() { function check() {
let elmnt = document.getElementById("calendar-time-container"); let elmnt = document.getElementById("calendar-time-container");
if (elmnt) { if (elmnt) {
elmnt.style.bottom = null; elmnt.style.bottom = undefined;
let xPos = (pos.left) > window.innerWidth ? window.innerWidth - 200 : pos.left; let xPos = (pos.left) > window.innerWidth ? window.innerWidth - 200 : pos.left;
let yPos = (pos.top) > window.innerHeight - 20 ? window.innerHeight - 100 : pos.top; let yPos = (pos.top) > window.innerHeight - 20 ? window.innerHeight - 100 : pos.top;
elmnt.style.top = (yPos) + "px"; elmnt.style.top = (yPos) + "px";
@ -615,16 +615,16 @@ export class RdDCalendrier extends Application {
pos3 = e.clientX; pos3 = e.clientX;
pos4 = e.clientY; pos4 = e.clientY;
// set the element's new position: // set the element's new position:
elmnt.style.bottom = null elmnt.style.bottom = undefined
elmnt.style.top = (elmnt.offsetTop - pos2) + "px"; elmnt.style.top = (elmnt.offsetTop - pos2) + "px";
elmnt.style.left = (elmnt.offsetLeft - pos1) + "px"; elmnt.style.left = (elmnt.offsetLeft - pos1) + "px";
} }
function closeDragElement() { function closeDragElement() {
// stop moving when mouse button is released: // stop moving when mouse button is released:
elmnt.onmousedown = null; elmnt.onmousedown = undefined;
document.onmouseup = null; document.onmouseup = undefined;
document.onmousemove = null; document.onmousemove = undefined;
let xPos = (elmnt.offsetLeft - pos1) > window.innerWidth ? window.innerWidth - 200 : (elmnt.offsetLeft - pos1); let xPos = (elmnt.offsetLeft - pos1) > window.innerWidth ? window.innerWidth - 200 : (elmnt.offsetLeft - pos1);
let yPos = (elmnt.offsetTop - pos2) > window.innerHeight - 20 ? window.innerHeight - 100 : (elmnt.offsetTop - pos2) let yPos = (elmnt.offsetTop - pos2) > window.innerHeight - 20 ? window.innerHeight - 100 : (elmnt.offsetTop - pos2)
xPos = xPos < 0 ? 0 : xPos; xPos = xPos < 0 ? 0 : xPos;

View File

@ -121,7 +121,7 @@ export class RdDCombatManager extends Combat {
{ {
speaker: { speaker: {
scene: canvas.scene._id, scene: canvas.scene._id,
actor: combatant.actor ? combatant.actor._id : null, actor: combatant.actor?._id,
token: combatant.token._id, token: combatant.token._id,
alias: combatant.token.name, alias: combatant.token.name,
sound: CONFIG.sounds.dice, sound: CONFIG.sounds.dice,
@ -498,7 +498,7 @@ export class RdDCombat {
let defender = canvas.tokens.get(msg.defenderTokenId).actor; let defender = canvas.tokens.get(msg.defenderTokenId).actor;
if (Misc.isOwnerPlayerOrUniqueConnectedGM()) { if (Misc.isOwnerPlayerOrUniqueConnectedGM()) {
let attackerRoll = msg.attackerRoll; let attackerRoll = msg.attackerRoll;
let attacker = msg.attackerId ? game.actors.get(msg.attackerId) : null; let attacker = msg.attackerId ? game.actors.get(msg.attackerId) : undefined;
defender.encaisserDommages(attackerRoll, attacker); defender.encaisserDommages(attackerRoll, attacker);
const rddCombat = RdDCombat.createForAttackerAndDefender(msg.attackerId, msg.defenderTokenId); const rddCombat = RdDCombat.createForAttackerAndDefender(msg.attackerId, msg.defenderTokenId);

View File

@ -29,13 +29,14 @@ export class RddCompendiumOrganiser {
static getEntityTypeLabel(entity) { static getEntityTypeLabel(entity) {
const documentName = entity?.documentName const documentName = entity?.documentName
const type = entity?.type const type = entity?.type
if (documentName === 'Actor' || documentName === 'Item') { if (documentName === 'Actor' || documentName === 'Item') {
const label = CONFIG[documentName]?.typeLabels?.[type] ?? type; const label = CONFIG[documentName]?.typeLabels?.[type] ?? type;
return game.i18n.has(label) ? game.i18n.localize(label) : t; if (game.i18n.has(label)) {
return game.i18n.localize(label);
}
} }
return type; return type;
} }
} }

View File

@ -241,7 +241,7 @@ export class RdDDice {
} }
static _getWhisperBlind(options) { static _getWhisperBlind(options) {
let whisper = null; let whisper = undefined;
let blind = false; let blind = false;
let rollMode = options.rollMode ?? game.settings.get("core", "rollMode"); let rollMode = options.rollMode ?? game.settings.get("core", "rollMode");
switch (rollMode) { switch (rollMode) {

View File

@ -143,8 +143,6 @@ Hooks.once("init", async function () {
default: "aucun" default: "aucun"
}); });
DialogChronologie.onInit();
/* -------------------------------------------- */ /* -------------------------------------------- */
// Set an initiative formula for the system // Set an initiative formula for the system
CONFIG.Combat.initiative = { CONFIG.Combat.initiative = {
@ -197,6 +195,7 @@ Hooks.once("init", async function () {
CONFIG.Combat.documentClass = RdDCombatManager; CONFIG.Combat.documentClass = RdDCombatManager;
// préparation des différents modules // préparation des différents modules
DialogChronologie.init();
ReglesOptionelles.init(); ReglesOptionelles.init();
RdDUtility.init(); RdDUtility.init();
RdDDice.init(); RdDDice.init();

View File

@ -54,7 +54,7 @@ export class RdDResolutionTable {
/* -------------------------------------------- */ /* -------------------------------------------- */
static explain(rolled) { static explain(rolled) {
let message = "<br>Jet : <strong>" + rolled.roll + "</strong> sur " + rolled.score + "% "; let message = "<br>Jet : <strong>" + rolled.roll + "</strong> sur " + rolled.score + "% ";
if (rolled.caracValue != null && rolled.finalLevel != null) { if (rolled.caracValue != undefined && rolled.finalLevel != undefined) {
message += (rolled.diviseurSignificative > 1 ? `(1/${rolled.diviseurSignificative} de ` : "(") message += (rolled.diviseurSignificative > 1 ? `(1/${rolled.diviseurSignificative} de ` : "(")
+ rolled.caracValue + " à " + Misc.toSignedString(rolled.finalLevel) + ") "; + rolled.caracValue + " à " + Misc.toSignedString(rolled.finalLevel) + ") ";
} }
@ -116,7 +116,7 @@ export class RdDResolutionTable {
static _updateChancesFactor(chances, diviseur) { static _updateChancesFactor(chances, diviseur) {
if (chances.level > -11 && diviseur && diviseur > 1) { if (chances.level > -11 && diviseur && diviseur > 1) {
let newScore = Math.floor(chances.score / diviseur); let newScore = Math.floor(chances.score / diviseur);
mergeObject(chances, this._computeCell(null, newScore), { overwrite: true }); mergeObject(chances, this._computeCell(undefined, newScore), { overwrite: true });
} }
} }
@ -124,7 +124,7 @@ export class RdDResolutionTable {
static _updateChancesWithBonus(chances, bonus, finalLevel) { static _updateChancesWithBonus(chances, bonus, finalLevel) {
if (bonus && finalLevel>-11) { if (bonus && finalLevel>-11) {
let newScore = Number(chances.score) + bonus; let newScore = Number(chances.score) + bonus;
mergeObject(chances, this._computeCell(null, newScore), { overwrite: true }); mergeObject(chances, this._computeCell(undefined, newScore), { overwrite: true });
} }
} }

View File

@ -364,9 +364,7 @@ export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */ /* -------------------------------------------- */
async quitterLesTMRInconscient() { async quitterLesTMRInconscient() {
if (this.currentRencontre?.isPersistant) { await this.refouler();
await this.refouler();
}
this.close(); this.close();
} }

View File

@ -13,7 +13,6 @@ import { Monnaie } from "./item-monnaie.js";
import { RdDPossession } from "./rdd-possession.js"; import { RdDPossession } from "./rdd-possession.js";
import { RdDNameGen } from "./rdd-namegen.js"; import { RdDNameGen } from "./rdd-namegen.js";
import { RdDConfirm } from "./rdd-confirm.js"; import { RdDConfirm } from "./rdd-confirm.js";
import { RdDActor } from "./actor.js";
import { RdDCalendrier } from "./rdd-calendrier.js"; import { RdDCalendrier } from "./rdd-calendrier.js";
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -1,5 +1,4 @@
import { Grammar } from "./grammar.js"; import { Grammar } from "./grammar.js";
import { Misc } from "./misc.js";
import { RdDDice } from "./rdd-dice.js"; import { RdDDice } from "./rdd-dice.js";
import { TMRUtility } from "./tmr-utility.js"; import { TMRUtility } from "./tmr-utility.js";
import { TMRType } from "./tmr-utility.js"; import { TMRType } from "./tmr-utility.js";
@ -45,13 +44,13 @@ const typeRencontres = {
tmrDialog.choisirCasePortee(rencData.tmr.coord, rencData.rencontre.force); tmrDialog.choisirCasePortee(rencData.tmr.coord, rencData.rencontre.force);
}, },
poesieSucces: { poesieSucces: {
reference: "Femmes damnées (2), Charles Baudelaire", reference: "Le bateau ivre, Arthur Rimbaud",
extrait: `Comme je descendais des Fleuves impassibles, extrait: `Comme je descendais des Fleuves impassibles,
<br>Je ne me sentis plus guidé par les haleurs : <br>Je ne me sentis plus guidé par les haleurs :
<br>Des Peaux-Rouges criards les avaient pris pour cibles, <br>Des Peaux-Rouges criards les avaient pris pour cibles,
<br>Les ayant cloués nus aux poteaux de couleurs.`}, <br>Les ayant cloués nus aux poteaux de couleurs.`},
poesieEchec: { poesieEchec: {
reference: "Le bateau ivre, Arthur Rimbaud", reference: "Femmes damnées (2), Charles Baudelaire",
extrait: `Loin des peuples vivants, errantes, condamnées, extrait: `Loin des peuples vivants, errantes, condamnées,
<br>A travers les déserts courez comme les loups ; <br>A travers les déserts courez comme les loups ;
<br>Faites votre destin, âmes désordonnées, <br>Faites votre destin, âmes désordonnées,

View File

@ -77,6 +77,10 @@
--gradient-violet: linear-gradient(150deg, rgba(100, 45, 124, 0.6), rgba(216, 157, 192, 0.3), rgba(177, 157, 216, 0.5), rgba(107, 62, 121, 0.3), rgba(100, 45, 124, 0.6)); --gradient-violet: linear-gradient(150deg, rgba(100, 45, 124, 0.6), rgba(216, 157, 192, 0.3), rgba(177, 157, 216, 0.5), rgba(107, 62, 121, 0.3), rgba(100, 45, 124, 0.6));
--gradient-purple-black: linear-gradient(150deg, rgba(0, 0, 0, 0.7), rgba(100, 45, 124, 0.4), rgba(82, 17, 131, 0.3),rgba(100, 45, 124, 0.4), rgba(0, 0, 0, 0.7)); --gradient-purple-black: linear-gradient(150deg, rgba(0, 0, 0, 0.7), rgba(100, 45, 124, 0.4), rgba(82, 17, 131, 0.3),rgba(100, 45, 124, 0.4), rgba(0, 0, 0, 0.7));
--gradient-silver-light: linear-gradient(30deg, rgba(61, 55, 93, 0.2), rgba(178, 179, 196, 0.1), rgba(59, 62, 63, 0.2), rgba(206, 204, 199, 0.1), rgba(61, 46, 49, 0.2)); --gradient-silver-light: linear-gradient(30deg, rgba(61, 55, 93, 0.2), rgba(178, 179, 196, 0.1), rgba(59, 62, 63, 0.2), rgba(206, 204, 199, 0.1), rgba(61, 46, 49, 0.2));
--background-custom-button: linear-gradient(to bottom, rgba(33, 55, 74, 0.988) 5%, rgba(21, 40, 51, 0.671) 100%);
--background-custom-button-hover: linear-gradient(to bottom, rgb(128, 0, 0) 5%, rgb(62, 1, 1) 100%);
--background-tooltip: rgba(220,220,210,0.95);
} }
/*@import url("https://fonts.googleapis.com/css2?family=Martel:wght@400;800&family=Roboto:wght@300;400;500&display=swap");*/ /*@import url("https://fonts.googleapis.com/css2?family=Martel:wght@400;800&family=Roboto:wght@300;400;500&display=swap");*/
@ -316,7 +320,6 @@ input:is(.blessure-premiers_soins, .blessure-soins_complets) {
-webkit-box-pack: start; -webkit-box-pack: start;
-ms-flex-pack: start; -ms-flex-pack: start;
justify-content: flex-start; justify-content: flex-start;
margin-bottom: 10px;
} }
.foundryvtt-reve-de-dragon .sheet-header .profile-img { .foundryvtt-reve-de-dragon .sheet-header .profile-img {
@ -1596,7 +1599,7 @@ display: inline-flex;
.tooltip .ttt-ajustements { .tooltip .ttt-ajustements {
width: 150px; width: 150px;
background: rgba(220,220,210,0.95); background: var(--background-tooltip);
border-radius: 6px; border-radius: 6px;
font-size: 0.9rem; font-size: 0.9rem;
padding: 3px 0; padding: 3px 0;
@ -1606,7 +1609,7 @@ display: inline-flex;
text-align: justify; text-align: justify;
width: 100%; width: 100%;
top: 30px; top: 30px;
background: rgba(220,220,210,0.95); background: var(--background-tooltip);
border-radius: 6px; border-radius: 6px;
font-size: 0.9rem; font-size: 0.9rem;
padding: 3px; padding: 3px;
@ -1614,7 +1617,7 @@ display: inline-flex;
.tooltip :is(.ttt-xp,.ttt-levelup) { .tooltip :is(.ttt-xp,.ttt-levelup) {
width: 250px; width: 250px;
background: rgba(220,220,210,0.95) !important; background: var(--background-tooltip) !important;
border-radius: 6px; border-radius: 6px;
font-size: 0.9rem; font-size: 0.9rem;
padding: 3px 0; padding: 3px 0;
@ -1628,7 +1631,7 @@ display: inline-flex;
.chat-card-button { .chat-card-button {
box-shadow: inset 0px 1px 0px 0px #a6827e; box-shadow: inset 0px 1px 0px 0px #a6827e;
background: linear-gradient(to bottom, #21374afc 5%, #152833ab 100%); background: var(--background-custom-button);
background-color: #7d5d3b00; background-color: #7d5d3b00;
border-radius: 3px; border-radius: 3px;
border: 2px ridge #846109; border: 2px ridge #846109;
@ -1644,10 +1647,12 @@ display: inline-flex;
margin:5px; margin:5px;
} }
.chat-card-button:hover { .chat-card-button:hover {
background: linear-gradient(to bottom, #800000 5%, #3e0101 100%); background: var(--background-custom-button-hover);
background-color: red; background-color: red;
} }
.chat-card-button:active { .chat-card-button:active {
position:relative; position:relative;
top:1px; top:1px;

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@
</header> </header>
<label>&nbsp;&nbsp;Conditions</label> <label>&nbsp;&nbsp;Conditions</label>
<select name="diffConditions" id="diffConditions" data-dtype="number"> <select name="diffConditions" id="diffConditions" data-dtype="Number">
{{#select diffConditions}} {{#select diffConditions}}
{{#each ajustementsConditions as |key|}} {{#each ajustementsConditions as |key|}}
<option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option> <option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>
@ -14,7 +14,7 @@
{{/select}} {{/select}}
</select> </select>
<label>&nbsp;&nbsp;Jours</label> <label>&nbsp;&nbsp;Jours</label>
<select name="joursAstrologie" id="joursAstrologie" data-dtype="number"> <select name="joursAstrologie" id="joursAstrologie" data-dtype="Number">
{{#select joursSuivants}} {{#select joursSuivants}}
{{#each dates as |date key|}} {{#each dates as |date key|}}
<option value={{date.index}}>{{date.label}}</option> <option value={{date.index}}>{{date.label}}</option>

View File

@ -2,7 +2,6 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/header-item.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/header-item.html"}}
<section class="sheet-body"> <section class="sheet-body">
{{log 'sortreserve' this}}
{{#if (and system.sortid sort)}} {{#if (and system.sortid sort)}}
<div class="form-group"> <div class="form-group">
<label>Sort</label> <label>Sort</label>