This commit is contained in:
sladecraven 2022-09-07 09:01:23 +02:00
parent 5a32cf26dc
commit 336767c19e
25 changed files with 75 additions and 76 deletions

View File

@ -330,7 +330,7 @@ export class RdDActorSheet extends ActorSheet {
}); });
// Initiative pour l'arme // Initiative pour l'arme
html.find('.arme-initiative a').click(async event => { html.find('.arme-initiative a').click(async event => {
let combatant = game.combat.data.combatants.find(c => c.actor.data._id == this.actor.data._id); let combatant = game.combat.combatants.find(c => c.actor._id == this.actor._id);
if (combatant) { if (combatant) {
let action = this._getEventArmeCombat(event); let action = this._getEventArmeCombat(event);
RdDCombatManager.rollInitiativeAction(combatant._id, action); RdDCombatManager.rollInitiativeAction(combatant._id, action);
@ -381,11 +381,11 @@ export class RdDActorSheet extends ActorSheet {
if (this.options.editCaracComp) { if (this.options.editCaracComp) {
// On carac change // On carac change
html.find('.carac-value').change(async event => { html.find('.carac-value').change(async event => {
let caracName = event.currentTarget.name.replace(".value", "").replace("data.carac.", ""); let caracName = event.currentTarget.name.replace(".value", "").replace("system.carac.", "");
this.actor.updateCarac(caracName, parseInt(event.target.value)); this.actor.updateCarac(caracName, parseInt(event.target.value));
}); });
html.find('input.carac-xp').change(async event => { html.find('input.carac-xp').change(async event => {
let caracName = event.currentTarget.name.replace(".xp", "").replace("data.carac.", ""); let caracName = event.currentTarget.name.replace(".xp", "").replace("system.carac.", "");
this.actor.updateCaracXP(caracName, parseInt(event.target.value)); this.actor.updateCaracXP(caracName, parseInt(event.target.value));
}); });
// On competence change // On competence change
@ -579,8 +579,8 @@ export class RdDActorSheet extends ActorSheet {
async _onSplitItem(item, split) { async _onSplitItem(item, split) {
if (split >= 1 && split < item.system.quantite) { if (split >= 1 && split < item.system.quantite) {
await item.diminuerQuantite(split); await item.diminuerQuantite(split);
const itemData = duplicate(item.system); const itemData = duplicate(item);
itemData.data.quantite = split; itemData.system.quantite = split;
await this.actor.createEmbeddedDocuments('Item', [itemData]) await this.actor.createEmbeddedDocuments('Item', [itemData])
} }
} }

View File

@ -182,7 +182,7 @@ export class RdDActor extends Actor {
async cleanupConteneurs() { async cleanupConteneurs() {
let updates = this.listItemsData('conteneur') let updates = this.listItemsData('conteneur')
.filter(c => c.system.contenu.filter(id => this.getObjet(id) == undefined).length > 0) .filter(c => c.system.contenu.filter(id => this.getObjet(id) == undefined).length > 0)
.map(c => { return { _id: c._id, 'data.contenu': c.system.contenu.filter(id => this.getObjet(id) != undefined) } }); .map(c => { return { _id: c._id, 'system.contenu': c.system.contenu.filter(id => this.getObjet(id) != undefined) } });
if (updates.length > 0) { if (updates.length > 0) {
await this.updateEmbeddedDocuments("Item", updates) await this.updateEmbeddedDocuments("Item", updates)
} }
@ -402,7 +402,7 @@ export class RdDActor extends Actor {
if (!potion.system.prpermanent) { if (!potion.system.prpermanent) {
console.log(potion); console.log(potion);
let newPr = (potion.system.pr > 0) ? potion.system.pr - 1 : 0; let newPr = (potion.system.pr > 0) ? potion.system.pr - 1 : 0;
let update = { _id: potion._id, 'data.pr': newPr }; let update = { _id: potion._id, 'system.pr': newPr };
const updated = await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity const updated = await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity
let messageData = { let messageData = {
@ -1003,7 +1003,7 @@ export class RdDActor extends Actor {
if (competence) { if (competence) {
if (isNaN(newXp) || typeof (newXp) != 'number') newXp = 0; if (isNaN(newXp) || typeof (newXp) != 'number') newXp = 0;
this.checkCompetenceXP(idOrName, newXp); this.checkCompetenceXP(idOrName, newXp);
const update = { _id: competence.id, 'data.xp': newXp }; const update = { _id: competence.id, 'system.xp': newXp };
await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity
this.updateExperienceLog("XP", newXp, "XP modifié en " + competence.name); this.updateExperienceLog("XP", newXp, "XP modifié en " + competence.name);
} else { } else {
@ -2841,7 +2841,7 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
_meditationEPart(meditationRoll) { _meditationEPart(meditationRoll) {
this.updateEmbeddedDocuments('Item', [{ _id: meditationRoll.meditation._id, 'data.malus': meditationRoll.meditation.system.malus - 1 }]); this.updateEmbeddedDocuments('Item', [{ _id: meditationRoll.meditation._id, 'system.malus': meditationRoll.meditation.system.malus - 1 }]);
} }

View File

@ -10,7 +10,7 @@ export class DialogCreateSigneDraconique extends Dialog {
const signe = await RdDItemSigneDraconique.randomSigneDraconique({ephemere: true}); const signe = await RdDItemSigneDraconique.randomSigneDraconique({ephemere: true});
let dialogData = { let dialogData = {
signe: signe, signe: signe,
tmrs: TMRUtility.listSelectedTMR(signe.data.typesTMR ?? []), tmrs: TMRUtility.listSelectedTMR(signe.system.typesTMR ?? []),
actors: game.actors.filter(actor => actor.isHautRevant()).map(actor => { actors: game.actors.filter(actor => actor.isHautRevant()).map(actor => {
let actorData = duplicate(actor); let actorData = duplicate(actor);
actorData.selected = actor.hasPlayerOwner; actorData.selected = actor.hasPlayerOwner;
@ -38,7 +38,7 @@ export class DialogCreateSigneDraconique extends Dialog {
} }
async _onCreerSigneActeurs() { async _onCreerSigneActeurs() {
await $("[name='signe.data.ephemere']").change(); await $("[name='signe.system.ephemere']").change();
await $(".signe-xp-sort").change(); await $(".signe-xp-sort").change();
this.validerSigne(); this.validerSigne();
this.dialogData.actors.filter(it => it.selected).map(it => game.actors.get(it._id)) this.dialogData.actors.filter(it => it.selected).map(it => game.actors.get(it._id))
@ -58,21 +58,21 @@ export class DialogCreateSigneDraconique extends Dialog {
validerSigne() { validerSigne() {
this.dialogData.signe.name = $("[name='signe.name']").val(); this.dialogData.signe.name = $("[name='signe.name']").val();
this.dialogData.signe.data.valeur.norm = $("[name='signe.data.valeur.norm']").val(); this.dialogData.signe.system.valeur.norm = $("[name='signe.system.valeur.norm']").val();
this.dialogData.signe.data.valeur.sign = $("[name='signe.data.valeur.sign']").val(); this.dialogData.signe.system.valeur.sign = $("[name='signe.system.valeur.sign']").val();
this.dialogData.signe.data.valeur.part = $("[name='signe.data.valeur.part']").val(); this.dialogData.signe.system.valeur.part = $("[name='signe.system.valeur.part']").val();
this.dialogData.signe.data.difficulte = $("[name='signe.data.difficulte']").val(); this.dialogData.signe.system.difficulte = $("[name='signe.system.difficulte']").val();
this.dialogData.signe.data.ephemere = $("[name='signe.data.ephemere']").prop("checked"); this.dialogData.signe.system.ephemere = $("[name='signe.system.ephemere']").prop("checked");
this.dialogData.signe.data.duree = $("[name='signe.data.duree']").val(); this.dialogData.signe.system.duree = $("[name='signe.system.duree']").val();
this.dialogData.signe.data.typesTMR = $(".select-tmr").val(); this.dialogData.signe.system.typesTMR = $(".select-tmr").val();
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
activateListeners(html) { activateListeners(html) {
super.activateListeners(html); super.activateListeners(html);
this.setEphemere(this.dialogData.signe.data.ephemere); this.setEphemere(this.dialogData.signe.system.ephemere);
html.find(".signe-aleatoire").click(event => this.setSigneAleatoire()); html.find(".signe-aleatoire").click(event => this.setSigneAleatoire());
html.find("[name='signe.data.ephemere']").change((event) => this.setEphemere(event.currentTarget.checked)); html.find("[name='signe.system.ephemere']").change((event) => this.setEphemere(event.currentTarget.checked));
html.find(".select-actor").change((event) => this.onSelectActor(event)); html.find(".select-actor").change((event) => this.onSelectActor(event));
html.find(".signe-xp-sort").change((event) => this.onValeurXpSort(event)); html.find(".signe-xp-sort").change((event) => this.onValeurXpSort(event));
} }
@ -81,18 +81,18 @@ export class DialogCreateSigneDraconique extends Dialog {
const newSigne = await RdDItemSigneDraconique.randomSigneDraconique({ephemere: true}); const newSigne = await RdDItemSigneDraconique.randomSigneDraconique({ephemere: true});
$("[name='signe.name']").val(newSigne.name); $("[name='signe.name']").val(newSigne.name);
$("[name='signe.data.valeur.norm']").val(newSigne.data.valeur.norm); $("[name='signe.system.valeur.norm']").val(newSigne.system.valeur.norm);
$("[name='signe.data.valeur.sign']").val(newSigne.data.valeur.sign); $("[name='signe.system.valeur.sign']").val(newSigne.system.valeur.sign);
$("[name='signe.data.valeur.part']").val(newSigne.data.valeur.part); $("[name='signe.system.valeur.part']").val(newSigne.system.valeur.part);
$("[name='signe.data.difficulte']").val(newSigne.data.difficulte); $("[name='signe.system.difficulte']").val(newSigne.system.difficulte);
$("[name='signe.data.duree']").val(newSigne.data.duree); $("[name='signe.system.duree']").val(newSigne.system.duree);
$("[name='signe.data.ephemere']").prop("checked", newSigne.data.ephemere); $("[name='signe.system.ephemere']").prop("checked", newSigne.system.ephemere);
$(".select-tmr").val(newSigne.data.typesTMR); $(".select-tmr").val(newSigne.system.typesTMR);
this.setEphemere(newSigne.data.ephemere); this.setEphemere(newSigne.system.ephemere);
} }
async setEphemere(ephemere) { async setEphemere(ephemere) {
this.dialogData.signe.data.ephemere = ephemere; this.dialogData.signe.system.ephemere = ephemere;
HtmlUtility._showControlWhen($(".signe-data-duree"), ephemere); HtmlUtility._showControlWhen($(".signe-data-duree"), ephemere);
} }
@ -111,8 +111,8 @@ export class DialogCreateSigneDraconique extends Dialog {
onValeurXpSort(event) { onValeurXpSort(event) {
const codeReussite = event.currentTarget.attributes['data-typereussite']?.value ?? 0; const codeReussite = event.currentTarget.attributes['data-typereussite']?.value ?? 0;
const xp = Number(event.currentTarget.value); const xp = Number(event.currentTarget.value);
const oldValeur = this.dialogData.signe.data.valeur; const oldValeur = this.dialogData.signe.system.valeur;
this.dialogData.signe.data.valeur = RdDItemSigneDraconique.calculValeursXpSort(codeReussite, xp, oldValeur); this.dialogData.signe.system.valeur = RdDItemSigneDraconique.calculValeursXpSort(codeReussite, xp, oldValeur);
} }
} }

View File

@ -34,7 +34,7 @@ export class DialogItemAchat extends Dialog {
const actionAchat = venteData.prixLot > 0 ? "Acheter" : "Prendre"; const actionAchat = venteData.prixLot > 0 ? "Acheter" : "Prendre";
const buttons = {}; const buttons = {};
if (isConsommable) { if (isConsommable) {
buttons["consommer"] = { label: venteData.item.data.boisson ? "Boire" : "Manger", callback: it => { this.onAchatConsommer(); } } buttons["consommer"] = { label: venteData.item.system.boisson ? "Boire" : "Manger", callback: it => { this.onAchatConsommer(); } }
} }
buttons[actionAchat] = { label: actionAchat, callback: it => { this.onAchat(); } }; buttons[actionAchat] = { label: actionAchat, callback: it => { this.onAchat(); } };
buttons["decliner"] = { label: "Décliner", callback: it => { } }; buttons["decliner"] = { label: "Décliner", callback: it => { } };

View File

@ -49,8 +49,8 @@ export class DialogConsommer extends Dialog {
} }
switch (itemData.type) { switch (itemData.type) {
case 'nourritureboisson': case 'nourritureboisson':
consommerData.title = itemData.data.boisson ? `${itemData.name}: boire une dose` : `${itemData.name}: manger une portion`; consommerData.title = itemData.system.boisson ? `${itemData.name}: boire une dose` : `${itemData.name}: manger une portion`;
consommerData.buttonName = itemData.data.boisson ? "Boire" : "Manger"; consommerData.buttonName = itemData.system.boisson ? "Boire" : "Manger";
break; break;
case 'potion': case 'potion':
consommerData.title = `${itemData.name}: boire la potion`; consommerData.title = `${itemData.name}: boire la potion`;
@ -63,9 +63,9 @@ export class DialogConsommer extends Dialog {
static calculDoses(consommerData) { static calculDoses(consommerData) {
const doses = consommerData.choix.doses; const doses = consommerData.choix.doses;
consommerData.totalSust = Misc.keepDecimals(doses * (consommerData.item.data.sust ?? 0), 2); consommerData.totalSust = Misc.keepDecimals(doses * (consommerData.item.system.sust ?? 0), 2);
consommerData.totalDesaltere = consommerData.item.data.boisson consommerData.totalDesaltere = consommerData.item.system.boisson
? Misc.keepDecimals(doses * (consommerData.item.data.desaltere ?? 0), 2) ? Misc.keepDecimals(doses * (consommerData.item.system.desaltere ?? 0), 2)
: 0; : 0;
} }

View File

@ -168,7 +168,6 @@ export class RdDItemArme extends Item {
let corpsACorps = competences.find(it => it.name == 'Corps à corps') ?? { system: { niveau: -6 } }; let corpsACorps = competences.find(it => it.name == 'Corps à corps') ?? { system: { niveau: -6 } };
let init = RdDCombatManager.calculInitiative(corpsACorps.system.niveau, carac['melee'].value); let init = RdDCombatManager.calculInitiative(corpsACorps.system.niveau, carac['melee'].value);
armes.push(RdDItemArme.mainsNues({ niveau: corpsACorps.system.niveau, initiative: init })); armes.push(RdDItemArme.mainsNues({ niveau: corpsACorps.system.niveau, initiative: init }));
//armes.push(RdDItemArme.empoignade({ niveau: corpsACorps.data.niveau, initiative: init }));
} }
static corpsACorps(actorData) { static corpsACorps(actorData) {

View File

@ -196,7 +196,7 @@ export class RdDItemCompetence extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static isVisible(itemData) { static isVisible(itemData) {
return Number(itemData.data.niveau) != RdDItemCompetence.getNiveauBase(itemData.data.categorie); return Number(itemData.system.niveau) != RdDItemCompetence.getNiveauBase(itemData.system.categorie);
} }
static nomContientTexte(itemData, texte) { static nomContientTexte(itemData, texte) {

View File

@ -92,7 +92,7 @@ export class RdDItemSheet extends ItemSheet {
console.log(formData.competences) console.log(formData.competences)
} }
if (formData.type == 'recettealchimique') { if (formData.type == 'recettealchimique') {
RdDAlchimie.processManipulation(objectData, this.actor && this.actor.id); RdDAlchimie.processManipulation(this.object, this.actor && this.actor.id);
} }
if (formData.type == 'gemme') { if (formData.type == 'gemme') {
formData.gemmeTypeList = RdDGemme.getGemmeTypeOptionList(); formData.gemmeTypeList = RdDGemme.getGemmeTypeOptionList();
@ -145,8 +145,8 @@ export class RdDItemSheet extends ItemSheet {
html.find(".categorie").change(event => this._onSelectCategorie(event)); html.find(".categorie").change(event => this._onSelectCategorie(event));
html.find('.sheet-competence-xp').change((event) => { html.find('.sheet-competence-xp').change((event) => {
if (this.object.data.type == 'competence') { if (this.object.type == 'competence') {
RdDUtility.checkThanatosXP(this.object.data.name); RdDUtility.checkThanatosXP(this.object.name);
} }
}); });
@ -252,7 +252,7 @@ export class RdDItemSheet extends ItemSheet {
const dragData = { const dragData = {
actorId: this.actor.id, actorId: this.actor.id,
type: "Item", type: "Item",
data: item.data data: item
}; };
event.dataTransfer.setData("text/plain", JSON.stringify(dragData)); event.dataTransfer.setData("text/plain", JSON.stringify(dragData));

View File

@ -24,7 +24,7 @@ export class RdDItemSigneDraconique {
type: "signedraconique", type: "signedraconique",
img: meditation.img, img: meditation.img,
data: { data: {
typesTMR: [TMRUtility.typeTmrName(meditation.data.tmr)], typesTMR: [TMRUtility.typeTmrName(meditation.system.tmr)],
difficulte: rolled.isSuccess ? RdDItemSigneDraconique.getDiffSigneMeditation(rolled.code) : DIFFICULTE_LECTURE_SIGNE_MANQUE, difficulte: rolled.isSuccess ? RdDItemSigneDraconique.getDiffSigneMeditation(rolled.code) : DIFFICULTE_LECTURE_SIGNE_MANQUE,
ephemere: true, ephemere: true,
duree: "1 round", duree: "1 round",

View File

@ -7,12 +7,12 @@ export class RdDItemSort extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static isDifficulteVariable(sort) { static isDifficulteVariable(sort) {
return sort && (sort.data.difficulte.toLowerCase() == "variable"); return sort && (sort.system.difficulte.toLowerCase() == "variable");
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static isCoutVariable(sort) { static isCoutVariable(sort) {
return sort && (sort.data.ptreve.toLowerCase() == "variable" || sort.data.ptreve.indexOf("+") >= 0); return sort && (sort.system.ptreve.toLowerCase() == "variable" || sort.system.ptreve.indexOf("+") >= 0);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -25,7 +25,7 @@ export class RdDItemSort extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static getDifficulte(sort, variable) { static getDifficulte(sort, variable) {
if (sort && !RdDItemSort.isDifficulteVariable(sort)) { if (sort && !RdDItemSort.isDifficulteVariable(sort)) {
return Misc.toInt(sort.data.difficulte); return Misc.toInt(sort.system.difficulte);
} }
return variable; return variable;
} }
@ -54,7 +54,7 @@ export class RdDItemSort extends Item {
static getBonusCaseList( item, newCase = false ) { static getBonusCaseList( item, newCase = false ) {
// Gestion spéciale case bonus // Gestion spéciale case bonus
if ( item.type == 'sort') { if ( item.type == 'sort') {
return this.buildBonusCaseList(item.data.bonuscase, newCase ); return this.buildBonusCaseList(item.system.bonuscase, newCase );
} }
return undefined; return undefined;
} }
@ -87,7 +87,7 @@ export class RdDItemSort extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static incrementBonusCase( actor, sort, coord ) { static incrementBonusCase( actor, sort, coord ) {
let bonusCaseList = this.buildBonusCaseList(sort.data.bonuscase, false); let bonusCaseList = this.buildBonusCaseList(sort.system.bonuscase, false);
//console.log("ITEMSORT", sort, bonusCaseList); //console.log("ITEMSORT", sort, bonusCaseList);
let found = false; let found = false;
@ -111,7 +111,7 @@ export class RdDItemSort extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static getCaseBonus( sort, coord) { static getCaseBonus( sort, coord) {
let bonusCaseList = this.buildBonusCaseList(sort.data.bonuscase, false); let bonusCaseList = this.buildBonusCaseList(sort.system.bonuscase, false);
for( let bc of bonusCaseList) { for( let bc of bonusCaseList) {
if (bc.case == coord) { // Case existante if (bc.case == coord) { // Case existante
return Number(bc.bonus); return Number(bc.bonus);

View File

@ -7,9 +7,9 @@ const matchOperationTerms = new RegExp(/@(\w*){([\w\-]+)}/i);
export class RdDAlchimie { export class RdDAlchimie {
/* -------------------------------------------- */ /* -------------------------------------------- */
static processManipulation(recetteData, actorId = undefined) { static processManipulation(recette, actorId = undefined) {
//console.log("CALLED", recette, recette.isOwned, actorId ); //console.log("CALLED", recette, recette.isOwned, actorId );
let manip = recetteData.data.manipulation; let manip = recette.system.manipulation;
let matchArray = manip.match(matchOperations); let matchArray = manip.match(matchOperations);
if (matchArray) { if (matchArray) {
for (let matchStr of matchArray) { for (let matchStr of matchArray) {
@ -22,7 +22,7 @@ export class RdDAlchimie {
} }
} }
} }
recetteData.data.manipulation_update = manip; recetteData.recette.manipulation_update = manip;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -223,9 +223,9 @@ export class RdDCalendrier extends Application {
checkMaladie( periode) { checkMaladie( periode) {
for (let actor of game.actors) { for (let actor of game.actors) {
if (actor.type == 'personnage') { if (actor.type == 'personnage') {
let maladies = actor.filterItems( item => (item.type == 'maladie' || (item.type == 'poison' && item.data.active) ) && item.data.periodicite.toLowerCase().includes(periode) ); let maladies = actor.filterItems( item => (item.type == 'maladie' || (item.type == 'poison' && item.system.active) ) && item.system.periodicite.toLowerCase().includes(periode) );
for (let maladie of maladies) { for (let maladie of maladies) {
if ( maladie.data.identifie) { if ( maladie.system.identifie) {
ChatMessage.create({ content: `${actor.name} souffre de ${maladie.name} (${maladie.type}): vérifiez que les effets ne se sont pas aggravés !` }); ChatMessage.create({ content: `${actor.name} souffre de ${maladie.name} (${maladie.type}): vérifiez que les effets ne se sont pas aggravés !` });
} else { } else {
ChatMessage.create({ content: `${actor.name} souffre d'un mal inconnu (${maladie.type}): vérifiez que les effets ne se sont pas aggravés !` }); ChatMessage.create({ content: `${actor.name} souffre d'un mal inconnu (${maladie.type}): vérifiez que les effets ne se sont pas aggravés !` });

View File

@ -66,7 +66,7 @@ export class RdDCombatManager extends Combat {
/* -------------------------------------------- */ /* -------------------------------------------- */
async finDeRound(options = { terminer: false }) { async finDeRound(options = { terminer: false }) {
for (let combatant of this.data.combatants) { for (let combatant of this.combatants) {
if (combatant.actor) { if (combatant.actor) {
await combatant.actor.finDeRound(options); await combatant.actor.finDeRound(options);
} }
@ -78,7 +78,7 @@ export class RdDCombatManager extends Combat {
/************************************************************************************/ /************************************************************************************/
async rollInitiative(ids, formula = undefined, messageOptions = {}) { async rollInitiative(ids, formula = undefined, messageOptions = {}) {
console.log(`${game.data.system.data.title} | Combat.rollInitiative()`, ids, formula, messageOptions); console.log(`${game.system.title} | Combat.rollInitiative()`, ids, formula, messageOptions);
// Structure input data // Structure input data
ids = typeof ids === "string" ? [ids] : ids; ids = typeof ids === "string" ? [ids] : ids;
const currentId = this.combatant._id; const currentId = this.combatant._id;
@ -249,9 +249,9 @@ export class RdDCombatManager extends Combat {
static processPremierRoundInit() { static processPremierRoundInit() {
// Check if we have the whole init ! // Check if we have the whole init !
if (Misc.isUniqueConnectedGM() && game.combat.current.round == 1) { if (Misc.isUniqueConnectedGM() && game.combat.current.round == 1) {
let initMissing = game.combat.data.combatants.find(it => !it.initiative); let initMissing = game.combat.combatants.find(it => !it.initiative);
if (!initMissing) { // Premier round ! if (!initMissing) { // Premier round !
for (let combatant of game.combat.data.combatants) { for (let combatant of game.combat.combatants) {
let action = combatant.initiativeData?.arme; let action = combatant.initiativeData?.arme;
//console.log("Parsed !!!", combatant, initDone, game.combat.current, arme); //console.log("Parsed !!!", combatant, initDone, game.combat.current, arme);
if (action && action.type == "arme") { if (action && action.type == "arme") {
@ -415,7 +415,7 @@ export class RdDCombat {
/* -------------------------------------------- */ /* -------------------------------------------- */
static onUpdateCombat(combat, change, options, userId) { static onUpdateCombat(combat, change, options, userId) {
if (combat.data.round != 0 && combat.turns && combat.data.active) { if (combat.round != 0 && combat.turns && combat.active) {
RdDCombat.combatNouveauTour(combat); RdDCombat.combatNouveauTour(combat);
} }
} }

View File

@ -27,7 +27,7 @@ export class RdDHerbes extends Item {
for ( let herbe of listHerbes) { for ( let herbe of listHerbes) {
let herbeData = herbe.system let herbeData = herbe.system
let brins = max - herbeData.niveau; let brins = max - herbeData.niveau;
list[herbe.data.name] = `${herbe.data.name} (Bonus: ${herbeData.niveau}, Brins: ${brins})`; list[herbe.name] = `${herbe.name} (Bonus: ${herbeData.niveau}, Brins: ${brins})`;
} }
list['Autre'] = 'Autre (Bonus: variable, Brins: variable)' list['Autre'] = 'Autre (Bonus: variable, Brins: variable)'
return list; return list;

View File

@ -45,7 +45,7 @@ export class RdDHotbar {
macro = await Macro.create({ macro = await Macro.create({
name: actor.name, name: actor.name,
type: "script", type: "script",
img: actor.data.img, img: actor.img,
command: command command: command
}, { displaySheet: false }) }, { displaySheet: false })
game.user.assignHotbarMacro(macro, slot); game.user.assignHotbarMacro(macro, slot);

View File

@ -292,8 +292,8 @@ async function migrationPngWebp_1_5_34() {
await Item.updateDocuments(itemsUpdates); await Item.updateDocuments(itemsUpdates);
await Actor.updateDocuments(actorsUpdates); await Actor.updateDocuments(actorsUpdates);
game.actors.forEach(actor => { game.actors.forEach(actor => {
if (actor.data.token?.img && actor.data.token.img.match(regexOldPngJpg)) { if (actor.token?.img && actor.token.img.match(regexOldPngJpg)) {
actor.update({ "token.img": convertImgToWebp(actor.data.token.img) }); actor.update({ "token.img": convertImgToWebp(actor.token.img) });
} }
const actorItemsToUpdate = prepareDocumentsImgUpdate(actor.items); const actorItemsToUpdate = prepareDocumentsImgUpdate(actor.items);
actor.updateEmbeddedDocuments('Item', actorItemsToUpdate); actor.updateEmbeddedDocuments('Item', actorItemsToUpdate);

View File

@ -84,7 +84,7 @@ export class RdDPossession {
attacker: attacker, attacker: attacker,
defender: defender, defender: defender,
competence: defender.getDraconicOuPossession(), competence: defender.getDraconicOuPossession(),
selectedCarac: defender.system.data.carac.reve, selectedCarac: defender.system.carac.reve,
forceCarac: { 'reve-actuel': { label: "Rêve Actuel", value: defender.getReveActuel() } } forceCarac: { 'reve-actuel': { label: "Rêve Actuel", value: defender.getReveActuel() } }
} }
rollData.competence.system.defaut_carac = 'reve-actuel' rollData.competence.system.defaut_carac = 'reve-actuel'

View File

@ -166,7 +166,7 @@ export class RdDResolutionTable {
if (rollData.selectedCarac?.label.toLowerCase().includes('chance')) { if (rollData.selectedCarac?.label.toLowerCase().includes('chance')) {
return true; return true;
} }
if (rollData.selectedSort?.data.isrituel) { if (rollData.selectedSort?.system.isrituel) {
return true; return true;
} }
return false; return false;

View File

@ -221,7 +221,7 @@ export class RdDRoll extends Dialog {
}); });
html.find('#ptreve-variable').change((event) => { html.find('#ptreve-variable').change((event) => {
let ptreve = Misc.toInt(event.currentTarget.value); let ptreve = Misc.toInt(event.currentTarget.value);
this.rollData.selectedSort.data.ptreve_reel = ptreve; this.rollData.selectedSort.system.ptreve_reel = ptreve;
console.log("RdDRollSelectDialog - Cout reve", ptreve); console.log("RdDRollSelectDialog - Cout reve", ptreve);
this.updateRollResult(); this.updateRollResult();
}); });
@ -348,10 +348,10 @@ export class RdDRoll extends Dialog {
/* -------------------------------------------- */ /* -------------------------------------------- */
_computeDiffCompetence(rollData) { _computeDiffCompetence(rollData) {
if (rollData.competence) { if (rollData.competence) {
return Misc.toInt(rollData.competence.data.niveau); return Misc.toInt(rollData.competence.system.niveau);
} }
if (rollData.draconicList) { if (rollData.draconicList) {
return Misc.toInt(rollData.competence.data.niveau); return Misc.toInt(rollData.competence.system.niveau);
} }
return 0; return 0;
} }

View File

@ -753,7 +753,7 @@ export class RdDUtility {
static getSelectedActor(msgPlayer = undefined) { static getSelectedActor(msgPlayer = undefined) {
if (canvas.tokens.controlled.length == 1) { if (canvas.tokens.controlled.length == 1) {
let token = canvas.tokens.controlled[0]; let token = canvas.tokens.controlled[0];
if (token.actor && token.data.actorLink) { if (token.actor && token.actorLink) {
return token.actor; return token.actor;
} }
if (msgPlayer != undefined) { if (msgPlayer != undefined) {

View File

@ -33,7 +33,7 @@ export const referenceAjustements = {
getLabel: (rollData, actor) => rollData.selectedSort?.name ?? rollData.attackerRoll ? 'Imposée' : 'Libre', getLabel: (rollData, actor) => rollData.selectedSort?.name ?? rollData.attackerRoll ? 'Imposée' : 'Libre',
getValue: (rollData, actor) => rollData.selectedSort getValue: (rollData, actor) => rollData.selectedSort
? RdDItemSort.getDifficulte(rollData.selectedSort, rollData.diffLibre) ? RdDItemSort.getDifficulte(rollData.selectedSort, rollData.diffLibre)
: rollData.diffLibre ?? rollData.competence?.data.default_diffLibre ?? 0 : rollData.diffLibre ?? rollData.competence?.system.default_diffLibre ?? 0
}, },
diffConditions: { diffConditions: {
isUsed: (rollData, actor) => rollData.diffConditions != undefined, isUsed: (rollData, actor) => rollData.diffConditions != undefined,

View File

@ -13,7 +13,7 @@ export class SortReserve extends Draconique {
async onActorCreateOwned(actor, item) { } async onActorCreateOwned(actor, item) { }
code() { return 'sort' } code() { return 'sort' }
tooltip(sort) { return `${sort.name}, r${sort.data.ptreve_reel}` } tooltip(sort) { return `${sort.name}, r${sort.system.ptreve_reel}` }
img() { return 'systems/foundryvtt-reve-de-dragon/icons/tmr/scroll.webp' } img() { return 'systems/foundryvtt-reve-de-dragon/icons/tmr/scroll.webp' }
createSprite(pixiTMR) { createSprite(pixiTMR) {

View File

@ -37,7 +37,7 @@ export class UrgenceDraconique extends Draconique {
} }
async onActorDeleteCaseTmr(actor, casetmr) { async onActorDeleteCaseTmr(actor, casetmr) {
await actor.deleteEmbeddedDocuments('Item', [casetmr.data.sourceid]); await actor.deleteEmbeddedDocuments('Item', [casetmr.system.sourceid]);
} }
code() { return 'urgence' } code() { return 'urgence' }

View File

@ -34,7 +34,7 @@
], ],
"url": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/", "url": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/",
"license": "LICENSE.txt", "license": "LICENSE.txt",
"version": "10.0.9", "version": "10.0.10",
"compatibility": { "compatibility": {
"minimum": "10" "minimum": "10"
}, },
@ -332,7 +332,7 @@
], ],
"socket": true, "socket": true,
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json", "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.0.8.zip", "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.0.10.zip",
"gridDistance": 1, "gridDistance": 1,
"gridUnits": "m", "gridUnits": "m",
"primaryTokenAttribute": "sante.vie", "primaryTokenAttribute": "sante.vie",

View File

@ -8,7 +8,7 @@
</a> </a>
<br> <br>
{{/unless}} {{/unless}}
{{#if (gt attacker.data.compteurs.destinee.value 0)}} {{#if (gt attacker.system.compteurs.destinee.value 0)}}
<a class='chat-card-button' id='appel-destinee-attaque' data-attackerId='{{attackerId}}' <a class='chat-card-button' id='appel-destinee-attaque' data-attackerId='{{attackerId}}'
data-defenderTokenId='{{defenderTokenId}}'>Utiliser la destinée</a> data-defenderTokenId='{{defenderTokenId}}'>Utiliser la destinée</a>
</a> </a>