Local sync

This commit is contained in:
2020-06-12 22:46:04 +02:00
parent 711ff19b10
commit 3962f33e84
8 changed files with 321 additions and 118 deletions

View File

@ -154,7 +154,8 @@ export class RdDActor extends Actor {
await this.setFlag( "foundryvtt-reve-de-dragon", "rollData", undefined );
await this.setFlag( "foundryvtt-reve-de-dragon", "rollData", rollData );
let chatOptions = { content: "<strong>Test : " + rollData.selectedCarac.label + " / " + rollData.competence.name + "</strong><br>Jet : " +
let lvl = (rollData.competence) ? rollData.competence.name : rollData.bmValue;
let chatOptions = { content: "<strong>Test : " + rollData.selectedCarac.label + " / " + lvl + "</strong><br>Jet : " +
rollData.selectedCarac.value + " / " + rollData.finalLevelStr + " - " + rollData.rollTarget.score + "%<br><strong>Résutat : </strong>" + myroll.total + "<br>" +
"<strong>" + quality + "</strong>" + specialStr + xpmsg,
user: game.user._id,
@ -175,11 +176,8 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */
updateCarac( caracName, caracValue )
{
//let data = this.data.data;
let caracpath = "data.carac." + caracName + ".value"
this.update( { caracpath: caracValue } );
//data.carac[caracName].value = caracValue; // Force update ?
//RdDUtility.computeCarac( data );
}
/* -------------------------------------------- */
@ -187,11 +185,20 @@ export class RdDActor extends Actor {
{
let comp = RdDUtility.findCompetence( this.data.items, compName);
if ( comp ) {
//console.log("ACTOR", this);
//comp.data.niveau = compValue;
const update = {_id: comp._id, 'data.niveau': compValue };
const updated = await this.updateEmbeddedEntity("OwnedItem", update); // Updates one EmbeddedEntity
//console.log("UP", updated);
} else {
console.log("Competence not found", compName);
}
}
/* -------------------------------------------- */
async updateCompetenceXP( compName, compValue )
{
let comp = RdDUtility.findCompetence( this.data.items, compName);
if ( comp ) {
const update = {_id: comp._id, 'data.xp': compValue };
const updated = await this.updateEmbeddedEntity("OwnedItem", update); // Updates one EmbeddedEntity
} else {
console.log("Competence not found", compName);
}
@ -298,7 +305,21 @@ export class RdDActor extends Actor {
if ( blessuresData.legeres > 0 || blessuresData.graves > 0 || blessuresData.critiques > 0 )
this.update( { "data.blessures": blessures } );
}
/* -------------------------------------------- */
async rollCarac( caracName )
{
let rollData = {
"selectedCarac": this.data.data.carac[caracName],
"bonusmalusTable": CONFIG.RDD.bonusmalus,
"etat": this.data.data.compteurs.etat.value,
"finalLevel": 0,
"bmValue": 0
}
console.log(caracName, rollData);
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html', rollData);
new RdDRollDialog("carac", html, rollData, this ).render(true);
}
/* -------------------------------------------- */
rollArme( armeName )
{