Merge pull request '12.0.5 - Les mauvais jours d'Astrobazzarh' (#706) from VincentVk/foundryvtt-reve-de-dragon:v11 into v11

Reviewed-on: #706
This commit is contained in:
uberwald 2024-07-08 22:14:15 +02:00
commit 5a4ef6da7e
15 changed files with 52 additions and 37 deletions

View File

@ -1,4 +1,9 @@
# 12.0 # 12.0
## 12.0.5 - Les mauvais jours d'Astrobazzarh
- Fix: on peut de nouveau ouvrir l'édition de calendrier
- Fix: on ne peut plus ouvrir plusieurs fenêtres de lancer de sort
- Fix: Failed to execute 'getComputedStyle' on 'Window'
## 12.0.4 - La plaie d'Astrobazzarh ## 12.0.4 - La plaie d'Astrobazzarh
- **Support V12** - **Support V12**
- Fix: les boutons d'encaissement dans le tchat fonctionnent de nouveau - Fix: les boutons d'encaissement dans le tchat fonctionnent de nouveau

View File

@ -1146,8 +1146,7 @@ export class RdDActor extends RdDBaseActorSang {
diffNbDoses: -Number(this.system.compteurs.ethylisme.nb_doses || 0), diffNbDoses: -Number(this.system.compteurs.ethylisme.nb_doses || 0),
finalLevel: 0, finalLevel: 0,
diffConditions: 0, diffConditions: 0,
ajustementsForce: CONFIG.RDD.difficultesLibres, ajustementsForce: CONFIG.RDD.difficultesLibres
config: game.system.rdd.config
} }
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-ethylisme.html', rollData); let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-ethylisme.html', rollData);
new RdDRollDialogEthylisme(html, rollData, this, r => this.saouler(r.forceAlcool)).render(true); new RdDRollDialogEthylisme(html, rollData, this, r => this.saouler(r.forceAlcool)).render(true);

View File

@ -38,8 +38,7 @@ export class RdDBaseActorSheet extends ActorSheet {
description: await TextEditor.enrichHTML(this.actor.system.description, { async: true }), description: await TextEditor.enrichHTML(this.actor.system.description, { async: true }),
notesmj: await TextEditor.enrichHTML(this.actor.system.notesmj, { async: true }), notesmj: await TextEditor.enrichHTML(this.actor.system.notesmj, { async: true }),
options: RdDSheetUtility.mergeDocumentRights(this.options, this.actor, this.isEditable), options: RdDSheetUtility.mergeDocumentRights(this.options, this.actor, this.isEditable),
effects: this.actor.effects, effects: this.actor.effects
config: game.system.rdd.config
} }
RdDBaseActorSheet.filterItemsPerTypeForSheet(formData, this.actor.itemTypes); RdDBaseActorSheet.filterItemsPerTypeForSheet(formData, this.actor.itemTypes);

View File

@ -232,11 +232,13 @@ export class RdDBaseActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
async cleanupConteneurs() { async cleanupConteneurs() {
let updates = this.itemTypes['conteneur'] if (Misc.isOwnerPlayerOrUniqueConnectedGM(this)) {
.filter(c => c.system.contenu.filter(id => this.getItem(id) == undefined).length > 0) let updates = this.itemTypes['conteneur']
.map(c => { return { _id: c._id, 'system.contenu': c.system.contenu.filter(id => this.getItem(id) != undefined) } }); .filter(c => c.system.contenu.filter(id => this.getItem(id) == undefined).length > 0)
if (updates.length > 0) { .map(c => { return { _id: c._id, 'system.contenu': c.system.contenu.filter(id => this.getItem(id) != undefined) } });
await this.updateEmbeddedDocuments("Item", updates) if (updates.length > 0) {
await this.updateEmbeddedDocuments("Item", updates)
}
} }
} }

View File

@ -25,7 +25,6 @@ export class DialogChronologie extends Dialog {
journalId: game.settings.get(SYSTEM_RDD, LATEST_USED_JOURNAL_ID), journalId: game.settings.get(SYSTEM_RDD, LATEST_USED_JOURNAL_ID),
journaux: game.journal.filter(it => it.testUserPermission(game.user, CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER)), journaux: game.journal.filter(it => it.testUserPermission(game.user, CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER)),
timestamp: game.system.rdd.calendrier.timestamp, timestamp: game.system.rdd.calendrier.timestamp,
config: game.system.rdd.config,
dateReel: game.system.rdd.calendrier.dateReel() dateReel: game.system.rdd.calendrier.dateReel()
}; };
const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/dialog-chronologie.html", dialogData); const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/dialog-chronologie.html", dialogData);

View File

@ -99,7 +99,6 @@ export class RdDItemSheet extends ItemSheet {
descriptionmj: await TextEditor.enrichHTML(this.item.system.descriptionmj, { async: true }), descriptionmj: await TextEditor.enrichHTML(this.item.system.descriptionmj, { async: true }),
isComestible: this.item.getUtilisationCuisine(), isComestible: this.item.getUtilisationCuisine(),
options: RdDSheetUtility.mergeDocumentRights(this.options, this.item, this.isEditable), options: RdDSheetUtility.mergeDocumentRights(this.options, this.item, this.isEditable),
config: game.system.rdd.config
} }
if (this.item.type == TYPES.competencecreature) { if (this.item.type == TYPES.competencecreature) {
formData.isparade = RdDItemCompetenceCreature.isParade(this.item) formData.isparade = RdDItemCompetenceCreature.isParade(this.item)

View File

@ -71,15 +71,16 @@ import { RdDTMRDialog } from "./rdd-tmr-dialog.js";
* Software License: GNU GPLv3 * Software License: GNU GPLv3
*/ */
export class SystemReveDeDragon { export class SystemReveDeDragon {
static start() { static start() {
const system = new SystemReveDeDragon() const system = new SystemReveDeDragon()
Hooks.once('init', async () => await system.onInit()) Hooks.once('init', async () => await system.onInit())
Hooks.once('diceSoNiceReady', (dice3d) => RdDDice.diceSoNiceReady(dice3d)) Hooks.once('diceSoNiceReady', (dice3d) => RdDDice.diceSoNiceReady(dice3d))
Hooks.once('ready', () => system.onReady()) Hooks.once('ready', () => system.onReady())
} }
constructor() { constructor() {
this.config = RDD_CONFIG;
this.RdDUtility = RdDUtility; this.RdDUtility = RdDUtility;
this.RdDHotbar = RdDHotbar; this.RdDHotbar = RdDHotbar;
this.itemClasses = { this.itemClasses = {
@ -108,7 +109,6 @@ export class SystemReveDeDragon {
/* -------------------------------------------- */ /* -------------------------------------------- */
async onInit() { async onInit() {
game.system.rdd = this; game.system.rdd = this;
game.system.rdd.config = RDD_CONFIG;
this.AppAstrologie = AppAstrologie; this.AppAstrologie = AppAstrologie;

View File

@ -129,7 +129,7 @@ export class RdDTMRDialog extends Dialog {
this.html.find('form.tmr-dialog *').click(event => this.subdialog?.bringToTop()); this.html.find('form.tmr-dialog *').click(event => this.subdialog?.bringToTop());
// Roll Sort // Roll Sort
this.html.find('.lancer-sort').click(event => this.actor.rollUnSort(this._getCoordActor())); this.html.find('.lancer-sort').click(event => this.lancerUnSort());
this.html.find('.lire-signe-draconique').click(event => this.actor.rollLireSigneDraconique(this._getCoordActor())); this.html.find('.lire-signe-draconique').click(event => this.actor.rollLireSigneDraconique(this._getCoordActor()));
this.html.find('img.tmr-move').click(event => this.deplacementTMR(this.html.find(event.currentTarget)?.data('move'))); this.html.find('img.tmr-move').click(event => this.deplacementTMR(this.html.find(event.currentTarget)?.data('move')));
@ -142,6 +142,13 @@ export class RdDTMRDialog extends Dialog {
this.updateValuesDisplay(); this.updateValuesDisplay();
} }
lancerUnSort() {
if (this.subdialog) {
return this.forceTMRContinueAction();
}
return this.actor.rollUnSort(this._getCoordActor());
}
async onDeplacement() { async onDeplacement() {
await this.manageRencontre(TMRUtility.getTMR(this._getCoordActor())); await this.manageRencontre(TMRUtility.getTMR(this._getCoordActor()));
} }
@ -164,23 +171,25 @@ export class RdDTMRDialog extends Dialog {
async forceTMRDisplay() { async forceTMRDisplay() {
if (this.rendered) { if (this.rendered) {
this.bringToTop() this.bringToTop()
if (this.subdialog?.bringToTop) { this.bringSubDialogToTop();
this.subdialog.bringToTop(); }
} }
bringSubDialogToTop() {
if (this.subdialog?.bringToTop && this.subdialog?.element[0]) {
this.subdialog.bringToTop();
} }
} }
async restoreTMRAfterAction() { async restoreTMRAfterAction() {
this.subdialog = undefined this.subdialog = undefined
await this.maximize(); await this.maximize()
this.bringToTop(); this.bringToTop()
} }
forceTMRContinueAction() { forceTMRContinueAction() {
ui.notifications.warn('Vous devez finir votre action avant de continuer dans les TMR'); ui.notifications.warn('Vous devez finir votre action avant de continuer dans les TMR');
if (this.subdialog?.bringToTop) { this.bringSubDialogToTop();
this.subdialog.bringToTop();
}
return; return;
} }
@ -302,7 +311,7 @@ export class RdDTMRDialog extends Dialog {
} }
const coord = this._getCoordActor(); const coord = this._getCoordActor();
HtmlUtility.showControlWhen(this.html.find(".lire-signe-draconique"), this.actor.isResonanceSigneDraconique(coord)); HtmlUtility.showControlWhen(this.html.find(".lire-signe-draconique"), this.actor.isResonanceSigneDraconique(coord));
let ptsreve = document.getElementById("tmr-pointsreve-value"); let ptsreve = document.getElementById("tmr-pointsreve-value");
ptsreve.innerHTML = this.actor.system.reve.reve.value; ptsreve.innerHTML = this.actor.system.reve.reve.value;

View File

@ -19,6 +19,7 @@ import { RdDEmpoignade } from "./rdd-empoignade.js";
import { ExperienceLog } from "./actor/experience-log.js"; import { ExperienceLog } from "./actor/experience-log.js";
import { RdDCoeur } from "./coeur/rdd-coeur.js"; import { RdDCoeur } from "./coeur/rdd-coeur.js";
import { APP_ASTROLOGIE_REFRESH } from "./sommeil/app-astrologie.js"; import { APP_ASTROLOGIE_REFRESH } from "./sommeil/app-astrologie.js";
import { RDD_CONFIG } from "./constants.js";
/* -------------------------------------------- */ /* -------------------------------------------- */
// This table starts at 0 -> niveau -10 // This table starts at 0 -> niveau -10
@ -262,8 +263,6 @@ export class RdDUtility {
]; ];
Handlebars.registerHelper('either', (a, b) => a ?? b); Handlebars.registerHelper('either', (a, b) => a ?? b);
Handlebars.registerHelper('computeResolutionScore', (row, col) => RdDResolutionTable.computePercentage(row, col));
Handlebars.registerHelper('computeResolutionChances', (row, col) => RdDResolutionTable.computeChances(row, col));
Handlebars.registerHelper('upperFirst', str => Misc.upperFirst(str ?? 'Null')); Handlebars.registerHelper('upperFirst', str => Misc.upperFirst(str ?? 'Null'));
Handlebars.registerHelper('lowerFirst', str => Misc.lowerFirst(str ?? 'Null')); Handlebars.registerHelper('lowerFirst', str => Misc.lowerFirst(str ?? 'Null'));
Handlebars.registerHelper('upper', str => str?.toUpperCase() ?? ''); Handlebars.registerHelper('upper', str => str?.toUpperCase() ?? '');
@ -272,6 +271,10 @@ export class RdDUtility {
Handlebars.registerHelper('apostrophe', (article, str) => Grammar.apostrophe(article, str)); Handlebars.registerHelper('apostrophe', (article, str) => Grammar.apostrophe(article, str));
Handlebars.registerHelper('un', str => Grammar.articleIndetermine(str)); Handlebars.registerHelper('un', str => Grammar.articleIndetermine(str));
Handlebars.registerHelper('accord', (genre, ...args) => Grammar.accord(genre, args)); Handlebars.registerHelper('accord', (genre, ...args) => Grammar.accord(genre, args));
Handlebars.registerHelper('RDD_CONFIG', path => RDD_CONFIG[path])
Handlebars.registerHelper('computeResolutionScore', (row, col) => RdDResolutionTable.computePercentage(row, col));
Handlebars.registerHelper('computeResolutionChances', (row, col) => RdDResolutionTable.computeChances(row, col));
Handlebars.registerHelper('buildLigneInventaire', (item, options) => { return new Handlebars.SafeString(RdDUtility.buildLigneInventaire(item, options)); }); Handlebars.registerHelper('buildLigneInventaire', (item, options) => { return new Handlebars.SafeString(RdDUtility.buildLigneInventaire(item, options)); });
Handlebars.registerHelper('buildInventaireConteneur', (actorId, itemId, options) => { return new Handlebars.SafeString(RdDUtility.buildInventaireConteneur(actorId, itemId, options)); }); Handlebars.registerHelper('buildInventaireConteneur', (actorId, itemId, options) => { return new Handlebars.SafeString(RdDUtility.buildInventaireConteneur(actorId, itemId, options)); });
Handlebars.registerHelper('buildContenuConteneur', (item, options) => { return new Handlebars.SafeString(RdDUtility.buildContenuConteneur(item, options)); }); Handlebars.registerHelper('buildContenuConteneur', (item, options) => { return new Handlebars.SafeString(RdDUtility.buildContenuConteneur(item, options)); });

View File

@ -123,9 +123,9 @@ export class RdDCalendrier extends Application {
/* -------------------------------------------- */ /* -------------------------------------------- */
fillCalendrierData(formData = {}) { fillCalendrierData(formData = {}) {
foundry.utils.mergeObject(formData, this.timestamp.toCalendrier()); foundry.utils.mergeObject(formData, this.timestamp.toCalendrier());
formData.isGM = game.user.isGM; formData.isGM = game.user.isGM
formData.heures = RdDTimestamp.definitions() formData.heures = RdDTimestamp.definitions()
formData.horlogeAnalogique = this.horlogeAnalogique; formData.horlogeAnalogique = this.horlogeAnalogique
formData.autoDarkness = AutoAdjustDarkness.isAuto() formData.autoDarkness = AutoAdjustDarkness.isAuto()
return formData; return formData;
} }
@ -372,7 +372,7 @@ export class RdDCalendrier extends Application {
game.socket.emit(SYSTEM_SOCKET_ID, { msg: "msg_app_astrologie_refresh", data: {} }) game.socket.emit(SYSTEM_SOCKET_ID, { msg: "msg_app_astrologie_refresh", data: {} })
} }
} }
async addNbAstralJoueur(actor, date, nbAstral, isValid) { async addNbAstralJoueur(actor, date, nbAstral, isValid) {
const nombresAstraux = this.getNombresAstraux() const nombresAstraux = this.getNombresAstraux()
const astralData = nombresAstraux.find(it => it.index == date) const astralData = nombresAstraux.find(it => it.index == date)

View File

@ -1,8 +1,8 @@
{ {
"id": "foundryvtt-reve-de-dragon", "id": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon", "title": "Rêve de Dragon",
"version": "12.0.4", "version": "12.0.5",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-12.0.4.zip", "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-12.0.5.zip",
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v11/system.json", "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v11/system.json",
"changelog": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v11/changelog.md", "changelog": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v11/changelog.md",
"compatibility": { "compatibility": {

View File

@ -55,7 +55,7 @@
<li class="caracteristique flexrow list-item" data-tooltip="Niveau d'éthylisme"> <li class="caracteristique flexrow list-item" data-tooltip="Niveau d'éthylisme">
<label class="derivee-label" for="system.compteurs.ethylisme.value">{{system.compteurs.ethylisme.label}}</label> <label class="derivee-label" for="system.compteurs.ethylisme.value">{{system.compteurs.ethylisme.label}}</label>
<select class="derivee-value" name="system.compteurs.ethylisme.value" data-dtype="Number"> <select class="derivee-value" name="system.compteurs.ethylisme.value" data-dtype="Number">
{{selectOptions @root.config.niveauEthylisme selected=system.compteurs.ethylisme.value valueAttr="value" nameAttr="value" labelAttr="label"}} {{selectOptions (RDD_CONFIG 'niveauEthylisme') selected=system.compteurs.ethylisme.value valueAttr="value" nameAttr="value" labelAttr="label"}}
</select> </select>
</li> </li>

View File

@ -2,13 +2,13 @@
<li class="caracteristique flexrow list-item"> <li class="caracteristique flexrow list-item">
<span class="carac-label" name="catEntite">Catégorie : </span> <span class="carac-label" name="catEntite">Catégorie : </span>
<select name="system.definition.categorieentite" value="{{system.definition.categorieentite}}" data-dtype="String" {{#unless @root.options.vueDetaillee}}disabled{{/unless}}> <select name="system.definition.categorieentite" value="{{system.definition.categorieentite}}" data-dtype="String" {{#unless @root.options.vueDetaillee}}disabled{{/unless}}>
{{selectOptions @root.config.categorieEntite selected=system.definition.categorieentite}} {{selectOptions (RDD_CONFIG 'categorieEntite') selected=system.definition.categorieentite}}
</select> </select>
</li> </li>
<li class="caracteristique flexrow list-item"> <li class="caracteristique flexrow list-item">
<span class="carac-label" name="typeEntite">Type d'entité : </span> <span class="carac-label" name="typeEntite">Type d'entité : </span>
<select name="system.definition.typeentite" value="{{system.definition.typeentite}}" data-dtype="String" {{#unless @root.options.vueDetaillee}}disabled{{/unless}}> <select name="system.definition.typeentite" value="{{system.definition.typeentite}}" data-dtype="String" {{#unless @root.options.vueDetaillee}}disabled{{/unless}}>
{{selectOptions @root.config.typeEntite selected=system.definition.typeentite}} {{selectOptions (RDD_CONFIG 'typeEntite') selected=system.definition.typeentite}}
</select> </select>
</li> </li>
{{#each system.attributs as |attr key|}} {{#each system.attributs as |attr key|}}

View File

@ -6,7 +6,7 @@
type="number" data-dtype="Number" min="1" max="28" type="number" data-dtype="Number" min="1" max="28"
name="{{path}}.jourDuMois" value="{{jourDuMois}}" /> name="{{path}}.jourDuMois" value="{{jourDuMois}}" />
<select {{#if disabled}}{{disabled}}{{/if}} name="{{path}}.mois" class="calendar-signe-heure" data-dtype="String"> <select {{#if disabled}}{{disabled}}{{/if}} name="{{path}}.mois" class="calendar-signe-heure" data-dtype="String">
{{selectOptions @root.config.heuresRdD selected=mois.key labelAttr="label" nameAttr="value" valueAttr="value"}} {{selectOptions (RDD_CONFIG 'heuresRdD') selected=mois.key labelAttr="label" nameAttr="value" valueAttr="value"}}
</select> </select>
{{timestamp-imgSigne mois}} {{timestamp-imgSigne mois}}
<input {{#if disabled}}{{disabled}}{{/if}} type="number" class="number-x2" name="{{path}}.annee" value="{{annee}}" data-dtype="Number"/> <input {{#if disabled}}{{disabled}}{{/if}} type="number" class="number-x2" name="{{path}}.annee" value="{{annee}}" data-dtype="Number"/>
@ -15,7 +15,7 @@
<label></label> <label></label>
<label>heure</label> <label>heure</label>
<select {{#if disabled}}{{disabled}}{{/if}} name="{{path}}.heure" class="calendar-signe-heure" data-dtype="String"> <select {{#if disabled}}{{disabled}}{{/if}} name="{{path}}.heure" class="calendar-signe-heure" data-dtype="String">
{{selectOptions @root.config.heuresRdD selected=heure.key labelAttr="label" nameAttr="value" valueAttr="value"}} {{selectOptions (RDD_CONFIG 'heuresRdD') selected=heure.key labelAttr="label" nameAttr="value" valueAttr="value"}}
</select> </select>
{{timestamp-imgSigne heure}} {{timestamp-imgSigne heure}}
<input {{#if disabled}}{{disabled}}{{/if}} type="number" class="number-x2" name="{{path}}.minute" value="{{minute}}" data-dtype="Number"/> <input {{#if disabled}}{{disabled}}{{/if}} type="number" class="number-x2" name="{{path}}.minute" value="{{minute}}" data-dtype="Number"/>

View File

@ -27,7 +27,7 @@
</label> </label>
<span class="flexrow"> <span class="flexrow">
<select name="milieu-{{key}}-rarete" class="environnement-rarete flex-shrink" data-dtype="String"> <select name="milieu-{{key}}-rarete" class="environnement-rarete flex-shrink" data-dtype="String">
{{selectOptions @root.config.raretes selected=env.rarete labelAttr="label" valueAttr="value" nameAttr="value"}} {{selectOptions (RDD_CONFIG 'raretes') selected=env.rarete labelAttr="label" valueAttr="value" nameAttr="value"}}
</select> </select>
{{rangePicker name="milieu-{{key}}-frequence" value=env.frequence min=(rarete-getChamp env.rarete 'min') max=(rarete-getChamp env.rarete 'max') step=1}} {{rangePicker name="milieu-{{key}}-frequence" value=env.frequence min=(rarete-getChamp env.rarete 'min') max=(rarete-getChamp env.rarete 'max') step=1}}
<label>[{{rarete-getChamp env.rarete 'min'}}-{{rarete-getChamp env.rarete 'max'}}]</label> <label>[{{rarete-getChamp env.rarete 'min'}}-{{rarete-getChamp env.rarete 'max'}}]</label>