Merge branch 'v1.4-fix' into 'v1.4'
Fix: commandes /rdd See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!260
This commit is contained in:
commit
8e7835c44d
@ -172,6 +172,7 @@ export class RdDActor extends Actor {
|
||||
// Initialize empty items
|
||||
RdDCarac.computeCarac(actorData.data);
|
||||
this.computeIsHautRevant();
|
||||
await this.cleanupConteneurs();
|
||||
await this.computeEncombrementTotalEtMalusArmure();
|
||||
this.computePrixTotalEquipement();
|
||||
this.computeEtatGeneral();
|
||||
@ -179,6 +180,16 @@ export class RdDActor extends Actor {
|
||||
await this.checkMonnaiePresence(actorData.items);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async cleanupConteneurs() {
|
||||
let updates = this.listItemsData('conteneur')
|
||||
.filter(c => c.data.contenu.filter(id => this.getObjet(id) == undefined).length > 0)
|
||||
.map(c => { return { _id: c._id, 'data.contenu': c.data.contenu.filter(id => this.getObjet(id) != undefined) } });
|
||||
if (updates.length > 0) {
|
||||
await this.updateEmbeddedDocuments("Item", updates)
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async checkMonnaiePresence(items) { // Ajout opportuniste si les pièces n'existent pas.
|
||||
if (!items) return; // Sanity check during import
|
||||
@ -4060,7 +4071,7 @@ export class RdDActor extends Actor {
|
||||
notifyGestionTeteSouffleQueue(item, manualMessage = true) {
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name),
|
||||
content: `${this.name} a reçu un/une ${item.type}: ${item.name}, qui ${manualMessage ? "n'est pas" : "est"} géré automatiquement. ${manualMessage ?? ''}`
|
||||
content: `${this.name} a reçu un/une ${item.type}: ${item.name}, qui ${manualMessage ? "n'est pas" : "est"} géré(e) automatiquement. ${manualMessage ? manualMessage : ''}`
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import { RdDUtility } from "./rdd-utility.js";
|
||||
import { TMRRencontres } from "./tmr-rencontres.js";
|
||||
import { TMRUtility } from "./tmr-utility.js";
|
||||
|
||||
const rddRollNumeric = /$(\d+)\s*([\+\-]?\d+)?\s*(s)?/;
|
||||
const rddRollNumeric = /^(\d+)\s*([\+\-]?\d+)?\s*(s)?/;
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class RdDCommands {
|
||||
@ -283,7 +283,7 @@ export class RdDCommands {
|
||||
finalLevel: diff,
|
||||
showDice: true,
|
||||
diviseurSignificative: significative ? 2 : 1,
|
||||
show: { title: "Table de résolution" }
|
||||
show: { title: "Table de résolution"}
|
||||
};
|
||||
await RdDResolutionTable.rollData(rollData);
|
||||
RdDCommands._chatAnswer(msg, await RdDResolutionTable.buildRollDataHtml(rollData));
|
||||
|
@ -29,6 +29,7 @@ export class RdDRollResolutionTable extends Dialog {
|
||||
finalLevel: 0,
|
||||
diffConditions: 0,
|
||||
diffLibre: 0,
|
||||
use: { conditions:true, libre:true }
|
||||
}
|
||||
mergeObject(rollData, defRollData, { overwrite: false });
|
||||
for (let i = 1; i < 21; i++) {
|
||||
|
@ -357,7 +357,8 @@ export class RdDUtility {
|
||||
static calculEncContenu(conteneur, objets) {
|
||||
const itemData = Misc.data(conteneur);
|
||||
const contenuDatas = (itemData.data.contenu ?? []).filter(id => id != undefined)
|
||||
.map(id => Misc.data(objets.find(it => (id == it._id))));
|
||||
.map(id => Misc.data(objets.find(it => (id == it._id))))
|
||||
.filter(it => it);
|
||||
let enc = Number(itemData.data.encombrement ?? 0) * Number(itemData.data.quantite ?? 1);
|
||||
for (let itemData of contenuDatas){
|
||||
if (itemData.type == 'conteneur') {
|
||||
|
Loading…
Reference in New Issue
Block a user