Avancement OwnedItems et Items

- remplacer xxxOwnedItems par xxxEmbeddedDocuments
- corrections des accès aux items vs itemData
- corrections cases spéciales TMR et effets draconiques
- correction monnaies/payer
This commit is contained in:
Vincent Vandemeulebrouck 2021-03-29 23:41:08 +02:00
parent 7f75361a08
commit 0cd4c7c158
29 changed files with 136 additions and 125 deletions

View File

@ -71,14 +71,14 @@ export class RdDActorEntiteSheet extends ActorSheet {
// Update Inventory Item // Update Inventory Item
html.find('.item-edit').click(ev => { html.find('.item-edit').click(ev => {
const li = $(ev.currentTarget).parents(".item"); const li = $(ev.currentTarget).parents(".item");
const item = this.actor.getOwnedItem(li.data("itemId")); const item = this.actor.getEmbeddedDocuments('Item', li.data("itemId"));
item.sheet.render(true); item.sheet.render(true);
}); });
// Delete Inventory Item // Delete Inventory Item
html.find('.item-delete').click(ev => { html.find('.item-delete').click(ev => {
const li = $(ev.currentTarget).parents(".item"); const li = $(ev.currentTarget).parents(".item");
this.actor.deleteOwnedItem(li.data("itemId")); this.actor.deleteEmbeddedDocuments('Item', [li.data("itemId")]);
li.slideUp(200, () => this.render(false)); li.slideUp(200, () => this.render(false));
}); });

View File

@ -87,7 +87,7 @@ export class RdDActorVehiculeSheet extends ActorSheet {
// Update Inventory Item // Update Inventory Item
html.find('.item-edit').click(ev => { html.find('.item-edit').click(ev => {
const li = $(ev.currentTarget).parents(".item"); const li = $(ev.currentTarget).parents(".item");
const item = this.actor.getOwnedItem(li.data("itemId")); const item = this.actor.getEmbeddedDocuments('Item', li.data("itemId"));
item.sheet.render(true); item.sheet.render(true);
}); });
// Delete Inventory Item // Delete Inventory Item

View File

@ -39,8 +39,10 @@ export class RdDActor extends Actor {
static init() { static init() {
Hooks.on("deleteActiveEffect", (effect, options, userId) => RdDActor.getParentActor(effect)?.onDeleteActiveEffect(effect, options)); Hooks.on("deleteActiveEffect", (effect, options, userId) => RdDActor.getParentActor(effect)?.onDeleteActiveEffect(effect, options));
Hooks.on("createActiveEffect", (effect, options, userId) => RdDActor.getParentActor(effect)?.onCreateActiveEffect(effect, options)); Hooks.on("createActiveEffect", (effect, options, userId) => RdDActor.getParentActor(effect)?.onCreateActiveEffect(effect, options));
Hooks.on("createOwnedItem", (item, options, id) => RdDActor.getParentActor(item)?.onCreateOwnedItem(item, options, id));
Hooks.on("deleteOwnedItem", (item, options, id) => RdDActor.getParentActor(item)?.onDeleteOwnedItem(item, options, id)); Hooks.on("preUpdateItem", (item, change, options, id) => RdDActor.getParentActor(item)?.onPreUpdateItem(item, change, 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("updateActor", (actor, change, options, actorId) => actor.onUpdateActor(change, options, actorId)); Hooks.on("updateActor", (actor, change, options, actorId) => actor.onUpdateActor(change, options, actorId));
} }
@ -241,10 +243,10 @@ export class RdDActor extends Actor {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
getObjet(id) { getObjet(id) {
return id ? this.items.find(it => it._id == id) : undefined; return id ? this.data.items.find(it => it.id == id) : undefined;
} }
getItemOfType(type, id) { getItemOfType(id, type) {
return id ? this.items.find(it => it._id == id && it.type == type) : undefined; return id ? this.data.items.find(it => it.id == id && it.type == type) : undefined;
} }
getMonnaie(id) { getMonnaie(id) {
return this.getItemOfType(id, 'monnaie'); return this.getItemOfType(id, 'monnaie');
@ -266,7 +268,7 @@ export class RdDActor extends Actor {
return this.getItemOfType(id, 'musique'); return this.getItemOfType(id, 'musique');
} }
getOeuvre(id, type = 'oeuvre') { getOeuvre(id, type = 'oeuvre') {
return this.getItemOfType(type, id); return this.getItemOfType(id, type);
} }
getJeu(id) { getJeu(id) {
return this.getItemOfType(id, 'jeu'); return this.getItemOfType(id, 'jeu');
@ -685,7 +687,7 @@ export class RdDActor extends Actor {
else else
update['data.carac_value'] = compValue; update['data.carac_value'] = compValue;
//console.log(update); //console.log(update);
const updated = await this.updateEmbeddedDocuments("Item", update); // Updates one EmbeddedEntity const updated = await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity
} }
} }
@ -706,7 +708,7 @@ export class RdDActor extends Actor {
}); });
} }
const update = { _id: comp.id, 'data.niveau': nouveauNiveau }; const update = { _id: comp.id, 'data.niveau': nouveauNiveau };
await this.updateEmbeddedDocuments("Item", update); // Updates one EmbeddedEntity await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity
} else { } else {
console.log("Competence not found", compName); console.log("Competence not found", compName);
} }
@ -719,7 +721,7 @@ export class RdDActor extends Actor {
compValue = compValue ?? 0; compValue = compValue ?? 0;
this.checkCompetenceXP(compName, compValue); this.checkCompetenceXP(compName, compValue);
const update = { _id: comp.id, 'data.xp': compValue }; const update = { _id: comp.id, 'data.xp': compValue };
await this.updateEmbeddedDocuments("OwnedItem", update); // Updates one EmbeddedEntity await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity
} else { } else {
console.log("Competence not found", compName); console.log("Competence not found", compName);
} }
@ -732,7 +734,7 @@ export class RdDActor extends Actor {
if (comp) { if (comp) {
compValue = compValue ?? 0; compValue = compValue ?? 0;
const update = { _id: comp.id, 'data.xp_sort': compValue }; const update = { _id: comp.id, 'data.xp_sort': compValue };
await this.updateEmbeddedDocuments("OwnedItem", update); // Updates one EmbeddedEntity await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity
} else { } else {
console.log("Competence not found", compName); console.log("Competence not found", compName);
} }
@ -744,7 +746,7 @@ export class RdDActor extends Actor {
if (comp) { if (comp) {
compValue = compValue ?? 0; compValue = compValue ?? 0;
const update = { _id: comp.id, 'data.niveau_archetype': compValue }; const update = { _id: comp.id, 'data.niveau_archetype': compValue };
await this.updateEmbeddedDocuments("OwnedItem", update); // Updates one EmbeddedEntity await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity
} else { } else {
console.log("Competence not found", compName); console.log("Competence not found", compName);
} }
@ -860,10 +862,7 @@ export class RdDActor extends Actor {
let list = []; let list = [];
list.push({ id: itemId, conteneurId: undefined }); // Init list list.push({ id: itemId, conteneurId: undefined }); // Init list
this.buildSubConteneurObjetList(itemId, list); this.buildSubConteneurObjetList(itemId, list);
//console.log("List to delete", list); await this.deleteEmbeddedDocuments('Item', list.map(it => it.id));
for (let item of list) {
await this.deleteOwnedItem(item.id);
}
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -880,7 +879,7 @@ export class RdDActor extends Actor {
contenu.splice(index, 1); contenu.splice(index, 1);
index = contenu.indexOf(itemId); index = contenu.indexOf(itemId);
} }
await this.updateEmbeddedDocuments("OwnedItem", data2use); await this.updateEmbeddedDocuments('Item', [data2use]);
} }
} }
@ -892,7 +891,7 @@ export class RdDActor extends Actor {
if (conteneur?.type == 'conteneur') { if (conteneur?.type == 'conteneur') {
let data2use = duplicate(Misc.data(conteneur)); let data2use = duplicate(Misc.data(conteneur));
data2use.data.contenu.push(itemId); data2use.data.contenu.push(itemId);
await this.updateEmbeddedDocuments("OwnedItem", data2use); await this.updateEmbeddedDocuments('Item', [data2use]);
} }
} }
@ -907,7 +906,7 @@ export class RdDActor extends Actor {
} }
} }
if (conteneurFixedList.length > 0) if (conteneurFixedList.length > 0)
await this.updateOwnedItem(conteneurFixedList); await this.updateEmbeddedDocuments('Item', conteneurFixedList);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -935,11 +934,11 @@ export class RdDActor extends Actor {
console.log('New conteneur filling!', newConteneur, newItemId, item); console.log('New conteneur filling!', newConteneur, newItemId, item);
let contenu = duplicate(newConteneur.data.contenu); let contenu = duplicate(newConteneur.data.contenu);
contenu.push(newItemId); contenu.push(newItemId);
await this.updateOwnedItem({ _id: newConteneurId, 'data.contenu': contenu }); await this.updateEmbeddedDocuments('Item', [{ _id: newConteneurId, 'data.contenu': contenu }]);
} }
} }
for (let item of itemsList) { for (let item of itemsList) {
await sourceActor.deleteOwnedItem(item.id); await sourceActor.deleteEmbeddedDocuments('Item', [item.id]);
} }
} }
@ -1837,7 +1836,7 @@ export class RdDActor extends Actor {
if (rencSpecial) { if (rencSpecial) {
rencSpecial = duplicate(rencSpecial); // To keep it rencSpecial = duplicate(rencSpecial); // To keep it
if (rencSpecial.type != 'souffle') { if (rencSpecial.type != 'souffle') {
this.deleteOwnedItem(rencSpecial._id); // Suppression dans la liste des queues this.deleteEmbeddedDocuments('Item', [rencSpecial._id]); // Suppression dans la liste des queues
addMsg = " La queue a été supprimée de votre fiche automatiquement"; addMsg = " La queue a été supprimée de votre fiche automatiquement";
} else { } else {
addMsg = " Vous devez gérer manuellement le décompte de mauvaises rencontres manuellement."; addMsg = " Vous devez gérer manuellement le décompte de mauvaises rencontres manuellement.";
@ -2075,7 +2074,7 @@ export class RdDActor extends Actor {
async _tacheResult(rollData) { async _tacheResult(rollData) {
// Mise à jour de la tache // Mise à jour de la tache
rollData.tache.data.points_de_tache_courant += rollData.rolled.ptTache; rollData.tache.data.points_de_tache_courant += rollData.rolled.ptTache;
this.updateEmbeddedDocuments("OwnedItem", rollData.tache); this.updateEmbeddedDocuments('Item', [rollData.tache]);
this.santeIncDec("fatigue", rollData.tache.data.fatigue); this.santeIncDec("fatigue", rollData.tache.data.fatigue);
RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-tache.html'); RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-tache.html');
@ -2084,7 +2083,7 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
_tacheETotal(rollData) { _tacheETotal(rollData) {
rollData.tache.data.difficulte--; rollData.tache.data.difficulte--;
this.updateEmbeddedDocuments("OwnedItem", rollData.tache); this.updateEmbeddedDocuments('Item', [rollData.tache]);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -2249,7 +2248,7 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
_meditationETotal(meditationData) { _meditationETotal(meditationData) {
meditationData.meditation.data.malus--; meditationData.meditation.data.malus--;
this.updateEmbeddedDocuments("OwnedItem", meditationData.meditation); this.updateEmbeddedDocuments('Item', [meditationData.meditation]);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -2352,7 +2351,7 @@ export class RdDActor extends Actor {
xpComp = xp - xpCarac; xpComp = xp - xpCarac;
competence = duplicate(competence); competence = duplicate(competence);
competence.data.xp = Misc.toInt(competence.data.xp) + xpComp; competence.data.xp = Misc.toInt(competence.data.xp) + xpComp;
await this.updateEmbeddedDocuments("OwnedItem", competence); await this.updateEmbeddedDocuments('Item', [competence]);
} else { } else {
xpCarac = Math.max(xpCarac, 1); xpCarac = Math.max(xpCarac, 1);
} }
@ -2386,12 +2385,12 @@ export class RdDActor extends Actor {
name: "Nombre Astral", type: "nombreastral", data: name: "Nombre Astral", type: "nombreastral", data:
{ value: data.nbAstral, istrue: data.isvalid, jourindex: Number(data.date), jourlabel: game.system.rdd.calendrier.getDateFromIndex(Number(data.date)) } { value: data.nbAstral, istrue: data.isvalid, jourindex: Number(data.date), jourlabel: game.system.rdd.calendrier.getDateFromIndex(Number(data.date)) }
}; };
await this.createEmbeddedDocuments("OwnedItem", [item]); await this.createEmbeddedDocuments("Item", [item]);
// Suppression des anciens nombres astraux // Suppression des anciens nombres astraux
let toDelete = this.data.items.filter(it => it.data.jourindex < game.system.rdd.calendrier.getCurrentDayIndex()); let toDelete = this.data.items.filter(it => it.data.jourindex < game.system.rdd.calendrier.getCurrentDayIndex());
const deletions = toDelete.map(it => it._id); const deletions = toDelete.map(it => it._id);
await this.deleteEmbeddedDocuments("OwnedItem", deletions); await this.deleteEmbeddedDocuments("Item", deletions);
// Affichage Dialog // Affichage Dialog
this.astrologieNombresAstraux(); this.astrologieNombresAstraux();
@ -2533,7 +2532,7 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
getArmeParade(armeParadeId) { getArmeParade(armeParadeId) {
const item = armeParadeId ? this.getOwnedItem(armeParadeId) : undefined; const item = armeParadeId ? this.getEmbeddedDocuments('Item', armeParadeId) : undefined;
return RdDItemArme.getArmeData(item); return RdDItemArme.getArmeData(item);
} }
@ -2550,12 +2549,12 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
async equiperObjet(itemID) { async equiperObjet(itemID) {
let item = this.getOwnedItem(itemID); let item = this.getEmbeddedDocuments('Item', itemID);
if (item?.data?.data) { if (item?.data?.data) {
let itemData = Misc.itemData(item); let itemData = Misc.itemData(item);
const isEquipe = !itemData.data.equipe; const isEquipe = !itemData.data.equipe;
let update = { _id: item._id, "data.equipe": isEquipe }; let update = { _id: item._id, "data.equipe": isEquipe };
await this.updateEmbeddedDocuments("OwnedItem", update); await this.updateEmbeddedDocuments('Item', [update]);
this.computeEncombrementTotalEtMalusArmure(); // Mise à jour encombrement this.computeEncombrementTotalEtMalusArmure(); // Mise à jour encombrement
this.computePrixTotalEquipement(); // Mis à jour du prix total de l'équipement this.computePrixTotalEquipement(); // Mis à jour du prix total de l'équipement
if (isEquipe) if (isEquipe)
@ -2595,7 +2594,7 @@ export class RdDActor extends Actor {
if (!ReglesOptionelles.isUsing('deteriorationArmure')) { if (!ReglesOptionelles.isUsing('deteriorationArmure')) {
return; return;
} }
let itemData = duplicate(Misc.itemData(item)); let itemData = duplicate(Misc.data(item));
itemData.data.deterioration = (itemData.data.deterioration ?? 0) + dmg; itemData.data.deterioration = (itemData.data.deterioration ?? 0) + dmg;
if (itemData.data.deterioration >= 10) { if (itemData.data.deterioration >= 10) {
itemData.data.deterioration = 0; itemData.data.deterioration = 0;
@ -2612,7 +2611,7 @@ export class RdDActor extends Actor {
} }
ChatMessage.create({ content: "Votre armure s'est détériorée, elle protège maintenant de " + itemData.data.protection }); ChatMessage.create({ content: "Votre armure s'est détériorée, elle protège maintenant de " + itemData.data.protection });
} }
this.updateEmbeddedDocuments("OwnedItem", itemData); this.updateEmbeddedDocuments('Item', [itemData]);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -2857,17 +2856,18 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
async optimizeArgent(sumDenier, monnaies) { async optimizeArgent(sumDenier, monnaies) {
let parValeur = Misc.classifyFirst(monnaies, it => it.data.valeur_deniers); let parValeur = Misc.classifyFirst(monnaies, it => Misc.templateData(it).valeur_deniers);
let fortune = { let fortune = {
1000: Math.floor(sumDenier / 1000), // or 1000: Math.floor(sumDenier / 1000), // or
100: Math.floor(sumDenier / 100) % 10, // argent 100: Math.floor(sumDenier / 100) % 10, // argent
10: Math.floor(sumDenier / 10) % 10, // bronze 10: Math.floor(sumDenier / 10) % 10, // bronze
1: sumDenier % 10 // étain 1: sumDenier % 10 // étain
} }
let updates = []
for (const [valeur, nombre] of Object.entries(fortune)) { for (const [valeur, nombre] of Object.entries(fortune)) {
let piece = parValeur[valeur]; updates.push( { _id: parValeur[valeur]._id, 'data.quantite': nombre });
await this.updateEmbeddedDocuments("OwnedItem", { _id: piece._id, 'data.quantite': nombre });
} }
await this.updateEmbeddedDocuments('Item', updates);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -2881,8 +2881,8 @@ export class RdDActor extends Actor {
sumDenier = Number(sumDenier); sumDenier = Number(sumDenier);
let denierDisponible = 0; let denierDisponible = 0;
for (let piece of monnaies) { for (let pieceData of monnaies.map(m => Misc.data(m))) {
denierDisponible += piece.data.valeur_deniers * Number(piece.data.quantite); denierDisponible += pieceData.data.valeur_deniers * Number(pieceData.data.quantite);
} }
console.log("DENIER", game.user.character, sumDenier, denierDisponible); console.log("DENIER", game.user.character, sumDenier, denierDisponible);
@ -2916,7 +2916,7 @@ export class RdDActor extends Actor {
let monnaie = this.getMonnaie(id); let monnaie = this.getMonnaie(id);
if (monnaie) { if (monnaie) {
const quantite = Math.max(0, Misc.templateData(monnaie).quantite + value); const quantite = Math.max(0, Misc.templateData(monnaie).quantite + value);
await this.updateEmbeddedDocuments("OwnedItem", { _id: monnaie.id, 'data.quantite': quantite }); await this.updateEmbeddedDocuments('Item', [{ _id: monnaie.id, 'data.quantite': quantite }]);
} }
} }
@ -3138,15 +3138,7 @@ export class RdDActor extends Actor {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async updateEmbeddedDocuments(embeddedName, data, options) { async onCreateItem(item, options, id) {
if (data?.type == 'competence' && data['data.defaut_carac'] && data['data.xp']) { // C'est une compétence
this.checkCompetenceXP(data['name'], data['data.xp']);
}
return super.updateEmbeddedDocuments(embeddedName, [data], options);
}
/* -------------------------------------------- */
async onCreateOwnedItem(item, options, id) {
switch (item.type) { switch (item.type) {
case 'tete': case 'tete':
case 'queue': case 'queue':
@ -3157,7 +3149,14 @@ export class RdDActor extends Actor {
} }
} }
async onDeleteOwnedItem(item, options, id) { async onPreUpdateItem(item, change, options, id) {
const itemData = Misc.data(item);
if (itemData.type == 'competence' && itemData.data.defaut_carac && itemData.data.xp) {
await this.checkCompetenceXP(itemData.name, itemData.data.xp);
}
}
async onDeleteItem(item, options, id) {
switch (item.type) { switch (item.type) {
case 'tete': case 'tete':
case 'queue': case 'queue':

View File

@ -3,7 +3,7 @@ import { RdDUtility } from "./rdd-utility.js";
/* -------------------------------------------- */ /* -------------------------------------------- */
// Activate chat listeners defined // Activate chat listeners defined
Hooks.on('renderChatLog', (log, html, data) => { // Hooks.on('renderChatLog', (log, html, data) => {
RdDUtility.chatListeners(html); // RdDUtility.chatListeners(html);
}); // });

View File

@ -106,7 +106,7 @@ export class RdDItemSort extends Item {
// Sauvegarde/update // Sauvegarde/update
let bonuscase = StringList.toString(); let bonuscase = StringList.toString();
//console.log("Bonus cae :", bonuscase); //console.log("Bonus cae :", bonuscase);
actor.updateEmbeddedDocuments("OwnedItem", { _id: sort._id, 'data.bonuscase': bonuscase } ); actor.updateEmbeddedDocuments('Item', [{ _id: sort._id, 'data.bonuscase': bonuscase }] );
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -104,7 +104,7 @@ export class RdDCombatManager extends Combat {
const roll = super._getInitiativeRoll(c, rollFormula); const roll = super._getInitiativeRoll(c, rollFormula);
if (roll.total <= 0) roll.total = 0.00; if (roll.total <= 0) roll.total = 0.00;
console.log("Compute init for", rollFormula, roll.total); console.log("Compute init for", rollFormula, roll.total);
await this.updateEmbeddedDocuments("Combatant", { _id: c._id, initiative: roll.total }); await this.updateEmbeddedDocuments("Combatant", [{ _id: c._id, initiative: roll.total }]);
// Send a chat message // Send a chat message
let rollMode = messageOptions.rollMode || game.settings.get("core", "rollMode"); let rollMode = messageOptions.rollMode || game.settings.get("core", "rollMode");
@ -334,8 +334,8 @@ export class RdDCombat {
static init() { static init() {
this.initStorePasseArmes(); this.initStorePasseArmes();
Hooks.on("updateCombat", (combat, data) => { RdDCombat.onUpdateCombat(combat, data) }); Hooks.on("updateCombat", (combat, change, options, userId) => { RdDCombat.onUpdateCombat(combat, change, options, userId) });
Hooks.on("preDeleteCombat", (combat, options) => { RdDCombat.onPreDeleteCombat(combat, options); }); Hooks.on("preDeleteCombat", (combat, options, userId) => { RdDCombat.onPreDeleteCombat(combat, options, userId); });
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -357,14 +357,14 @@ export class RdDCombat {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static onUpdateCombat(combat, data) { static onUpdateCombat(combat, change, options, userId) {
if (combat.data.round != 0 && combat.turns && combat.data.active) { if (combat.data.round != 0 && combat.turns && combat.data.active) {
RdDCombat.combatNouveauTour(combat); RdDCombat.combatNouveauTour(combat);
} }
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static onPreDeleteCombat(combat, options) { static onPreDeleteCombat(combat, options, userId) {
if (game.user.isGM) { if (game.user.isGM) {
combat.cleanItemUse(); combat.cleanItemUse();
ChatUtility.removeChatMessageContaining(`<div data-combatid="${combat.id}" data-combatmessage="actor-turn-summary">`) ChatUtility.removeChatMessageContaining(`<div data-combatid="${combat.id}" data-combatmessage="actor-turn-summary">`)
@ -1130,7 +1130,7 @@ export class RdDCombat {
resistance -= perteResistance; resistance -= perteResistance;
defenderRoll.show.deteriorationArme = resistance <= 0 ? 'brise' : 'perte'; defenderRoll.show.deteriorationArme = resistance <= 0 ? 'brise' : 'perte';
defenderRoll.show.perteResistance = perteResistance; defenderRoll.show.perteResistance = perteResistance;
this.defender.updateEmbeddedDocuments("OwnedItem", { _id: defenderRoll.arme._id, 'data.resistance': resistance }); this.defender.updateEmbeddedDocuments('Item', [{ _id: defenderRoll.arme._id, 'data.resistance': resistance }]);
} }
} }
} else { } else {
@ -1147,7 +1147,7 @@ export class RdDCombat {
resistance -= dmg; resistance -= dmg;
defenderRoll.show.deteriorationArme = resistance <= 0 ? 'brise' : 'perte'; defenderRoll.show.deteriorationArme = resistance <= 0 ? 'brise' : 'perte';
defenderRoll.show.perteResistance = dmg; defenderRoll.show.perteResistance = dmg;
this.defender.updateEmbeddedDocuments("OwnedItem", { _id: defenderRoll.arme._id, 'data.resistance': resistance }); this.defender.updateEmbeddedDocuments('Item', [{ _id: defenderRoll.arme._id, 'data.resistance': resistance }]);
} }
} }
// Si l'arme de parade n'est pas un bouclier, jet de désarmement (p.132) // Si l'arme de parade n'est pas un bouclier, jet de désarmement (p.132)

View File

@ -153,6 +153,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
RdDUtility.init();
RdDCommands.init(); RdDCommands.init();
RdDCombat.init(); RdDCombat.init();
RdDCombatManager.init(), RdDCombatManager.init(),
@ -224,8 +225,3 @@ Hooks.on("chatMessage", (html, content, msg) => {
return true; return true;
}); });
/* -------------------------------------------- */
Hooks.on("renderChatMessage", async (app, html, msg) => {
RdDUtility.onRenderChatMessage(app, html, msg);
});

View File

@ -130,14 +130,16 @@ export class RdDTMRDialog extends Dialog {
return EffetsDraconiques.rencontre.token(this.pixiTMR, rencontre, () => rencontre.coord); return EffetsDraconiques.rencontre.token(this.pixiTMR, rencontre, () => rencontre.coord);
} }
_tokenCaseSpeciale(casetmr) { _tokenCaseSpeciale(casetmr) {
const draconique = Draconique.get(casetmr.data.specific); const caseData = Misc.data(casetmr);
return draconique?.token(this.pixiTMR, casetmr, () => casetmr.data.coord); const draconique = Draconique.get(caseData.data.specific);
return draconique?.token(this.pixiTMR, caseData, () => caseData.data.coord);
} }
_tokenSortEnReserve(sortEnReserve) { _tokenSortEnReserve(sortEnReserve) {
return EffetsDraconiques.sortReserve.token(this.pixiTMR, sortEnReserve.sort, () => sortEnReserve.coord); return EffetsDraconiques.sortReserve.token(this.pixiTMR, sortEnReserve.sort, () => sortEnReserve.coord);
} }
_tokenDemiReve() { _tokenDemiReve() {
return EffetsDraconiques.demiReve.token(this.pixiTMR, this.actor, () => Misc.data(this.actor).data.reve.tmrpos.coord); const actorData = Misc.data(this.actor);
return EffetsDraconiques.demiReve.token(this.pixiTMR, actorData, () => actorData.data.reve.tmrpos.coord);
} }
_updateDemiReve() { _updateDemiReve() {

View File

@ -92,6 +92,13 @@ const definitionsEncaissement = {
/* -------------------------------------------- */ /* -------------------------------------------- */
export class RdDUtility { export class RdDUtility {
/* -------------------------------------------- */
static async init() {
Hooks.on("renderChatMessage", async (app, html, msg) => RdDUtility.onRenderChatMessage(app, html, msg));
Hooks.on('renderChatLog', (log, html, data) => RdDUtility.chatListeners(html));
}
/* -------------------------------------------- */ /* -------------------------------------------- */
static async preloadHandlebarsTemplates() { static async preloadHandlebarsTemplates() {
const templatePaths = [ const templatePaths = [
@ -544,7 +551,7 @@ export class RdDUtility {
actor.tmrApp.lancerSortEnReserve(coord, sortId); actor.tmrApp.lancerSortEnReserve(coord, sortId);
}); });
// Gestion du bouton payer // Gestion du bouton payer
html.on("click", '#payer-button', event => { html.on("click", '.payer-button', event => {
let sumdenier = event.currentTarget.attributes['data-somme-denier'].value; let sumdenier = event.currentTarget.attributes['data-somme-denier'].value;
let quantite = 1; let quantite = 1;
if (event.currentTarget.attributes['data-quantite']) { if (event.currentTarget.attributes['data-quantite']) {
@ -595,7 +602,7 @@ export class RdDUtility {
let sumtotald = sumd + (sums * 100); let sumtotald = sumd + (sums * 100);
let msgPayer = "La somme de " + sums + " Sols et " + sumd + " Deniers est à payer, cliquer sur le lien ci-dessous si besoin.<br>"; let msgPayer = "La somme de " + sums + " Sols et " + sumd + " Deniers est à payer, cliquer sur le lien ci-dessous si besoin.<br>";
msgPayer += "<a id='payer-button' class='chat-card-button' data-somme-denier='" + sumtotald + "'>Payer</a>" msgPayer += "<a class='payer-button chat-card-button' data-somme-denier='" + sumtotald + "'>Payer</a>"
ChatMessage.create({ content: msgPayer }); ChatMessage.create({ content: msgPayer });
} }
@ -658,7 +665,7 @@ export class RdDUtility {
label: "Supprimer l'objet", label: "Supprimer l'objet",
callback: () => { callback: () => {
console.log("Delete : ", itemId); console.log("Delete : ", itemId);
actorSheet.actor.deleteOwnedItem(itemId); actorSheet.actor.deleteEmbeddedDocuments('Item', [itemId]);
li.slideUp(200, () => actorSheet.render(false)); li.slideUp(200, () => actorSheet.render(false));
} }
}, },

View File

@ -29,14 +29,14 @@ export class Conquete extends Draconique {
} }
async _creerConquete(actor, queue) { async _creerConquete(actor, queue) {
let existants = actor.data.items.filter(it => this.isCase(it)).map(it => it.data.coord); let existants = actor.data.items.filter(it => this.isCase(it)).map(it => Misc.data(it).data.coord);
let possibles = TMRUtility.filterTMR(tmr => !TMRUtility.isCaseHumide(tmr) && !existants.includes(tmr.coord)); let possibles = TMRUtility.filterTMR(tmr => !TMRUtility.isCaseHumide(tmr) && !existants.includes(tmr.coord));
let conquete = Misc.rollOneOf(possibles); let conquete = Misc.rollOneOf(possibles);
await this.createCaseTmr(actor, 'Conquête: ' + conquete.label, conquete, queue._id); await this.createCaseTmr(actor, 'Conquête: ' + conquete.label, conquete, queue.id);
} }
async onActorDeleteCaseTmr(actor, casetmr) { async onActorDeleteCaseTmr(actor, casetmr) {
await actor.deleteOwnedItem(casetmr.data.sourceid); await actor.deleteEmbeddedDocuments('Item', [casetmr.data.sourceid]);
} }
} }

View File

@ -14,7 +14,7 @@ export class Debordement extends Draconique {
async onActorCreateOwned(actor, souffle) { async onActorCreateOwned(actor, souffle) {
const existants = actor.data.items.filter(it => this.isCase(it)).map(it => it.data.coord); const existants = actor.data.items.filter(it => this.isCase(it)).map(it => it.data.coord);
const tmr = TMRUtility.getTMRAleatoire(it => !(TMRUtility.isCaseHumide(it) || existants.includes(it.coord))); const tmr = TMRUtility.getTMRAleatoire(it => !(TMRUtility.isCaseHumide(it) || existants.includes(it.coord)));
await this.createCaseTmr(actor, 'Debordement: ' + tmr.label, tmr, souffle._id); await this.createCaseTmr(actor, 'Debordement: ' + tmr.label, tmr, souffle.id);
} }
code() { return 'debordement' } code() { return 'debordement' }

View File

@ -43,7 +43,7 @@ export class Desorientation extends Draconique {
const existants = actor.data.items.filter(it => this.isCase(it)).map(it => it.data.coord); const existants = actor.data.items.filter(it => this.isCase(it)).map(it => it.data.coord);
let tmrs = TMRUtility.filterTMR(it => it.type == type && !existants.includes(it.coord)); let tmrs = TMRUtility.filterTMR(it => it.type == type && !existants.includes(it.coord));
for (let tmr of tmrs) { for (let tmr of tmrs) {
await this.createCaseTmr(actor, 'Désorientation: ' + tmr.label, tmr, souffle._id); await this.createCaseTmr(actor, 'Désorientation: ' + tmr.label, tmr, souffle.id);
} }
} }

View File

@ -1,3 +1,4 @@
import { Misc } from "../misc.js";
import { TMRUtility } from "../tmr-utility.js"; import { TMRUtility } from "../tmr-utility.js";
import { PixiTMR } from "./pixi-tmr.js"; import { PixiTMR } from "./pixi-tmr.js";
@ -8,11 +9,11 @@ const registeredEffects = [
* Définition des informations d'une "draconique" (queue, ombre, tête, souffle) qui influence les TMR * Définition des informations d'une "draconique" (queue, ombre, tête, souffle) qui influence les TMR
*/ */
export class Draconique { export class Draconique {
static isCaseTMR(element) { return element.type == 'casetmr'; } static isCaseTMR(itemData) { return itemData.type == 'casetmr'; }
static isQueueDragon(element) { return element.type == 'queue' || element.type == 'ombre'; } static isQueueDragon(itemData) { return itemData.type == 'queue' || itemData.type == 'ombre'; }
static isSouffleDragon(element) { return element.type == 'souffle'; } static isSouffleDragon(itemData) { return itemData.type == 'souffle'; }
static isTeteDragon(element) { return element.type == 'tete'; } static isTeteDragon(itemData) { return itemData.type == 'tete'; }
static isQueueSouffle(it) { return Draconique.isQueueDragon(it) || Draconique.isSouffleDragon(it); } static isQueueSouffle(itemData) { return Draconique.isQueueDragon(itemData) || Draconique.isSouffleDragon(itemData); }
tmrLabel(linkData) { return TMRUtility.getTMRLabel(linkData.data.coord); } tmrLabel(linkData) { return TMRUtility.getTMRLabel(linkData.data.coord); }
@ -37,7 +38,8 @@ export class Draconique {
* @returns true si l'item correspond * @returns true si l'item correspond
*/ */
match(item) { match(item) {
return Draconique.isQueueDragon(item) || Draconique.isSouffleDragon(item) || Draconique.isTeteDragon(item); const itemData = Misc.data(item);
return Draconique.isQueueDragon(itemData) || Draconique.isSouffleDragon(itemData) || Draconique.isTeteDragon(itemData);
} }
/** /**
@ -110,35 +112,40 @@ export class Draconique {
/** /**
* *
* @param {*} it un item à tester * @param {*} item un item à tester
* @param {*} coord les coordonnées d'une case. Si undefined toute case du type correspondra, * @param {*} coord les coordonnées d'une case. Si undefined toute case du type correspondra,
*/ */
isCase(it, coord = undefined) { isCase(item, coord = undefined) {
return Draconique.isCaseTMR(it) && it.data.specific == this.code() && (coord ? it.data.coord == coord : true); const itemData = Misc.data(item);
return Draconique.isCaseTMR(itemData) && itemData.data.specific == this.code() && (coord ? itemData.data.coord == coord : true);
} }
find(list, coord = undefined) { find(list, coord = undefined) {
return list.find(c => this.isCase(c, coord)); return list.find(c => this.isCase(Misc.data(c), coord));
} }
async createCaseTmr(actor, label, tmr, sourceId = undefined) { async createCaseTmr(actor, label, tmr, sourceId = undefined) {
await actor.createEmbeddedDocuments('Item',[{ const casetmrData = {
name: label, type: 'casetmr', img: this.img(), _id: randomID(16), name: label, type: 'casetmr', img: this.img(),
data: { coord: tmr.coord, specific: this.code(), sourceid: sourceId } data: { coord: tmr.coord, specific: this.code(), sourceid: sourceId }
}]); };
await actor.createEmbeddedDocuments('Item', [casetmrData]);
} }
async deleteCasesTmr(actor, draconique) { async deleteCasesTmr(actor, draconique) {
let caseTmrs = actor.data.items.filter(it => this.isCase(it) && it.data.sourceid == draconique._id); let caseTmrs = actor.data.items.filter(it => this.isCaseForSource(it, draconique));
for (let casetmr of caseTmrs) { await actor.deleteEmbeddedDocuments('Item', caseTmrs.map(it => it.id));
await actor.deleteOwnedItem(casetmr._id);
} }
isCaseForSource(item, draconique) {
const itemData = Misc.data(item);
return Draconique.isCaseTMR(itemData) && itemData.data.specific == this.code() && itemData.data.sourceid == draconique.id;
} }
async onVisiteSupprimer(actor, tmr, onRemoveToken) { async onVisiteSupprimer(actor, tmr, onRemoveToken) {
let existants = actor.data.items.filter(it => this.isCase(it, tmr.coord)); let existants = actor.data.items.filter(it => this.isCase(it, tmr.coord));
await actor.deleteEmbeddedDocuments('Item', existants.map(it => it.id));
for (let casetmr of existants) { for (let casetmr of existants) {
await actor.deleteOwnedItem(casetmr._id);
onRemoveToken(tmr, casetmr); onRemoveToken(tmr, casetmr);
} }
} }

View File

@ -32,7 +32,7 @@ export class FermetureCites extends Draconique {
let existants = actor.data.items.filter(it => this.isCase(it)).map(it => it.data.coord); let existants = actor.data.items.filter(it => this.isCase(it)).map(it => it.data.coord);
let ouvertes = TMRUtility.filterTMR(it => it.type == 'cite' && !existants.includes(it.coord)); let ouvertes = TMRUtility.filterTMR(it => it.type == 'cite' && !existants.includes(it.coord));
for (let tmr of ouvertes) { for (let tmr of ouvertes) {
await this.createCaseTmr(actor, 'Fermeture: ' + tmr.label, tmr, souffle._id); await this.createCaseTmr(actor, 'Fermeture: ' + tmr.label, tmr, souffle.id);
} }
} }
} }

View File

@ -14,7 +14,7 @@ export class Pelerinage extends Draconique {
async onActorCreateOwned(actor, queue) { async onActorCreateOwned(actor, queue) {
let tmr = TMRUtility.getTMRAleatoire(); let tmr = TMRUtility.getTMRAleatoire();
await this.createCaseTmr(actor, 'Pèlerinage: ' + tmr.label, tmr, queue._id); await this.createCaseTmr(actor, 'Pèlerinage: ' + tmr.label, tmr, queue.id);
} }
@ -32,7 +32,7 @@ export class Pelerinage extends Draconique {
} }
async onActorDeleteCaseTmr(actor, casetmr) { async onActorDeleteCaseTmr(actor, casetmr) {
await actor.deleteOwnedItem(casetmr.data.sourceid); await actor.deleteEmbeddedDocuments('Item', [casetmr.data.sourceid]);
} }
} }

View File

@ -16,7 +16,7 @@ export class Periple extends Draconique {
let terrain = new Roll("1d2").evaluate().total == 1 ? 'sanctuaire' : 'necropole'; let terrain = new Roll("1d2").evaluate().total == 1 ? 'sanctuaire' : 'necropole';
let tmrs = TMRUtility.getListTMR(terrain); let tmrs = TMRUtility.getListTMR(terrain);
for (let tmr of tmrs) { for (let tmr of tmrs) {
await this.createCaseTmr(actor, 'Périple: ' + tmr.label, tmr, souffle._id); await this.createCaseTmr(actor, 'Périple: ' + tmr.label, tmr, souffle.id);
} }
} }

View File

@ -14,7 +14,7 @@ export class PontImpraticable extends Draconique {
async onActorCreateOwned(actor, souffle) { async onActorCreateOwned(actor, souffle) {
const ponts = TMRUtility.getListTMR('pont'); const ponts = TMRUtility.getListTMR('pont');
for (let tmr of ponts) { for (let tmr of ponts) {
await this.createCaseTmr(actor, 'Pont impraticable: ' + tmr.label, tmr, souffle._id); await this.createCaseTmr(actor, 'Pont impraticable: ' + tmr.label, tmr, souffle.id);
} }
} }

View File

@ -40,7 +40,7 @@ export class PresentCites extends Draconique {
else { else {
let cites = TMRUtility.filterTMR(it => it.type == 'cite'); let cites = TMRUtility.filterTMR(it => it.type == 'cite');
for (let tmr of cites) { for (let tmr of cites) {
await this.createCaseTmr(actor, 'Présent: ' + tmr.label, tmr, tete._id); await this.createCaseTmr(actor, 'Présent: ' + tmr.label, tmr, tete.id);
} }
} }
} }
@ -60,6 +60,6 @@ export class PresentCites extends Draconique {
} }
async ouvrirLePresent(actor, casetmr) { async ouvrirLePresent(actor, casetmr) {
await actor.deleteOwnedItem(casetmr._id); await actor.deleteEmbeddedDocuments('Item', [casetmr.id]);
} }
} }

View File

@ -11,7 +11,7 @@ export class QueteEaux extends Draconique {
match(item) { return Draconique.isTeteDragon(item) && Grammar.toLowerCaseNoAccent(item.name).includes("quete des eaux"); } match(item) { return Draconique.isTeteDragon(item) && Grammar.toLowerCaseNoAccent(item.name).includes("quete des eaux"); }
manualMessage() { return "Vous devrez re-configurer votre Quête des Eaux une fois un lac ou marais vaincu" } manualMessage() { return "Vous devrez re-configurer votre Quête des Eaux une fois un lac ou marais vaincu" }
async onActorCreateOwned(actor, tete) { async onActorCreateOwned(actor, tete) {
await this.createCaseTmr(actor, "Quête des eaux à déterminer", { coord: 'A0' }, tete._id); await this.createCaseTmr(actor, "Quête des eaux à déterminer", { coord: 'A0' }, tete.id);
} }
code() { return 'maitrisee' } code() { return 'maitrisee' }

View File

@ -13,7 +13,7 @@ export class ReserveExtensible extends Draconique {
async onActorCreateOwned(actor, tete) { async onActorCreateOwned(actor, tete) {
const existants = actor.data.items.filter(it => this.isCase(it)).map(it => it.data.coord); const existants = actor.data.items.filter(it => this.isCase(it)).map(it => it.data.coord);
const tmr = TMRUtility.getTMRAleatoire(it => !(it.type == 'fleuve' || existants.includes(it.coord))); const tmr = TMRUtility.getTMRAleatoire(it => !(it.type == 'fleuve' || existants.includes(it.coord)));
await this.createCaseTmr(actor, "Nouvelle Réserve extensible", tmr, tete._id); await this.createCaseTmr(actor, "Nouvelle Réserve extensible", tmr, tete.id);
} }
code() { return 'reserve_extensible' } code() { return 'reserve_extensible' }

View File

@ -12,7 +12,7 @@ export class TerreAttache extends Draconique {
manualMessage() { return "Vous pouvez re-configurer votre Terre d'Attache" } manualMessage() { return "Vous pouvez re-configurer votre Terre d'Attache" }
async onActorCreateOwned(actor, tete) { async onActorCreateOwned(actor, tete) {
await this.createCaseTmr(actor, "Terre d'attache à déterminer", { coord: 'A0' }, tete._id); await this.createCaseTmr(actor, "Terre d'attache à déterminer", { coord: 'A0' }, tete.id);
} }
code() { return 'attache' } code() { return 'attache' }

View File

@ -14,7 +14,7 @@ export class TrouNoir extends Draconique {
async onActorCreateOwned(actor, souffle) { async onActorCreateOwned(actor, souffle) {
const existants = actor.data.items.filter(it => this.isCase(it)).map(it => it.data.coord); const existants = actor.data.items.filter(it => this.isCase(it)).map(it => it.data.coord);
const tmr = TMRUtility.getTMRAleatoire(it => !(TMRUtility.isCaseHumide(it) || existants.includes(it.coord))); const tmr = TMRUtility.getTMRAleatoire(it => !(TMRUtility.isCaseHumide(it) || existants.includes(it.coord)));
await this.createCaseTmr(actor, 'Trou noir: ' + tmr.label, tmr, souffle._id); await this.createCaseTmr(actor, 'Trou noir: ' + tmr.label, tmr, souffle.id);
} }
code() { return 'trounoir' } code() { return 'trounoir' }

View File

@ -24,19 +24,19 @@ export class UrgenceDraconique extends Draconique {
content: `En l'absence de sorts en réserve, l'urgence draconique de ${actor.name} se transforme en ${ideeFixe.name}` content: `En l'absence de sorts en réserve, l'urgence draconique de ${actor.name} se transforme en ${ideeFixe.name}`
}); });
await actor.createEmbeddedDocuments('Item', [ideeFixe]); await actor.createEmbeddedDocuments('Item', [ideeFixe]);
await actor.deleteOwnedItem(queue._id); await actor.deleteEmbeddedDocuments('Item', [queue.id]);
return; return;
} }
else { else {
const demiReve = actor.getDemiReve(); const demiReve = actor.getDemiReve();
coordSortsReserve.sort(Misc.ascending(t => TMRUtility.distanceTMR(t, demiReve))); coordSortsReserve.sort(Misc.ascending(t => TMRUtility.distanceTMR(t, demiReve)));
const tmr = TMRUtility.getTMR(coordSortsReserve[0]); const tmr = TMRUtility.getTMR(coordSortsReserve[0]);
await this.createCaseTmr(actor, 'Urgence draconique: ' + tmr.label, tmr, queue._id); await this.createCaseTmr(actor, 'Urgence draconique: ' + tmr.label, tmr, queue.id);
} }
} }
async onActorDeleteCaseTmr(actor, casetmr) { async onActorDeleteCaseTmr(actor, casetmr) {
await actor.deleteOwnedItem(casetmr.data.sourceid); await actor.deleteEmbeddedDocuments('Item', [casetmr.data.sourceid]);
} }
code() { return 'urgence' } code() { return 'urgence' }

View File

@ -31,7 +31,7 @@
"name": "Fab" "name": "Fab"
} }
], ],
"esmodules": [ "module/rdd-main.js", "module/hook-renderChatLog.js" ], "esmodules": [ "module/rdd-main.js"],
"styles": ["styles/simple.css"], "styles": ["styles/simple.css"],
"media": [ "media": [
{ {

View File

@ -15,7 +15,7 @@
<div class="form-group"> <div class="form-group">
<label for="niveau">Mode spécifique</label> <label for="niveau">Mode spécifique</label>
<select name="data.specific" id="specific" data-dtype="String"> <select name="data.specific" id="specific" data-dtype="String">
{{#select item.data.specific}} {{#select data.specific}}
{{>"systems/foundryvtt-reve-de-dragon/templates/casetmr-specific-list.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/casetmr-specific-list.html"}}
{{/select}} {{/select}}
</select> </select>

View File

@ -11,7 +11,7 @@
<div class="form-group"> <div class="form-group">
<label class="alchimie-title" for="xp">Type</label> <label class="alchimie-title" for="xp">Type</label>
<select name="data.type" data-dtype="String"> <select name="data.type" data-dtype="String">
{{#select item.data.type}} {{#select data.type}}
<option value="adressehasard">Adresse/Hasard</option> <option value="adressehasard">Adresse/Hasard</option>
<option value="de">Dés</option> <option value="de">Dés</option>
<option value="carte">Cartes</option> <option value="carte">Cartes</option>

View File

@ -11,7 +11,7 @@
<div class="form-group"> <div class="form-group">
<label for="xp">Compétence</label> <label for="xp">Compétence</label>
<select name="data.competence" id="competenceselect" data-dtype="String"> <select name="data.competence" id="competenceselect" data-dtype="String">
{{#select item.data.competence}} {{#select data.competence}}
{{#each competences as |competence key|}} {{#each competences as |competence key|}}
<option value="{{competence.name}}">{{competence.name}}</option> <option value="{{competence.name}}">{{competence.name}}</option>
{{/each}} {{/each}}
@ -29,7 +29,7 @@
<div class="form-group"> <div class="form-group">
<label for="xp">Heure</label> <label for="xp">Heure</label>
<select name="data.heure" id="heure" data-dtype="String"> <select name="data.heure" id="heure" data-dtype="String">
{{#select item.data.heure}} {{#select data.heure}}
{{>"systems/foundryvtt-reve-de-dragon/templates/heures-select-option.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/heures-select-option.html"}}
{{/select}} {{/select}}
</select> </select>
@ -49,7 +49,7 @@
<div class="form-group"> <div class="form-group">
<label for="xp">Case TMR</label> <label for="xp">Case TMR</label>
<select name="data.tmr" id="tmr" data-dtype="String"> <select name="data.tmr" id="tmr" data-dtype="String">
{{#select item.data.tmr}} {{#select data.tmr}}
{{>"systems/foundryvtt-reve-de-dragon/templates/sort-tmr.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/sort-tmr.html"}}
{{/select}} {{/select}}
</select> </select>
@ -58,7 +58,7 @@
<label for="xp">Malus</label> <label for="xp">Malus</label>
{{#if isGM}} {{#if isGM}}
<select name="data.malus" id="malus" data-dtype="Number"> <select name="data.malus" id="malus" data-dtype="Number">
{{#select item.data.malus}} {{#select data.malus}}
<option value="0">0</option> <option value="0">0</option>
<option value="-1">-1</option> <option value="-1">-1</option>
<option value="-2">-2</option> <option value="-2">-2</option>

View File

@ -11,7 +11,7 @@
<div class="form-group"> <div class="form-group">
<label>Caractéristique</label> <label>Caractéristique</label>
<select name="data.default_carac" id="default_carac" data-dtype="String"> <select name="data.default_carac" id="default_carac" data-dtype="String">
{{#select item.data.default_carac}} {{#select data.default_carac}}
{{>"systems/foundryvtt-reve-de-dragon/templates/competence-carac-defaut.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/competence-carac-defaut.html"}}
{{/select}} {{/select}}
</select> </select>
@ -19,7 +19,7 @@
<div class="form-group"> <div class="form-group">
<label>Compétence</label> <label>Compétence</label>
<select name="data.competence" id="competenceselect" data-dtype="String"> <select name="data.competence" id="competenceselect" data-dtype="String">
{{#select item.data.competence}} {{#select data.competence}}
{{#each competences as |competence key|}} {{#each competences as |competence key|}}
<option value="{{competence.name}}">{{competence.name}}</option> <option value="{{competence.name}}">{{competence.name}}</option>
{{/each}} {{/each}}

View File

@ -26,7 +26,7 @@
{{#if hasPrice}} {{#if hasPrice}}
<span class="chat-card-button-area"> <span class="chat-card-button-area">
<a id='payer-button' class='chat-card-button market-button' data-jsondata='{{jsondata}}' <a class='payer-button chat-card-button market-button' data-jsondata='{{jsondata}}'
data-somme-denier="{{data.cout_deniers_total}}" data-quantite="{{data.quantite}}">Payer</a> data-somme-denier="{{data.cout_deniers_total}}" data-quantite="{{data.quantite}}">Payer</a>
</span> </span>
{{/if}} {{/if}}