Allow comp. saves
This commit is contained in:
parent
64108932ca
commit
7a15bcc0ba
13
RdD.geany
13
RdD.geany
@ -27,16 +27,17 @@ long_line_behaviour=1
|
|||||||
long_line_column=72
|
long_line_column=72
|
||||||
|
|
||||||
[files]
|
[files]
|
||||||
current_page=1
|
current_page=6
|
||||||
FILE_NAME_0=6873;JSON;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplate.json;0;2
|
FILE_NAME_0=8094;JSON;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplate.json;0;2
|
||||||
FILE_NAME_1=4562;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Factor-sheet.js;0;2
|
FILE_NAME_1=0;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Factor-sheet.js;0;2
|
||||||
FILE_NAME_2=314;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Factor-sheet.html;0;2
|
FILE_NAME_2=4774;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Factor-sheet.html;0;2
|
||||||
FILE_NAME_3=13323;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Frdd-utility.js;0;2
|
FILE_NAME_3=13265;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Frdd-utility.js;0;2
|
||||||
FILE_NAME_4=985;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Fsimple.js;0;2
|
FILE_NAME_4=985;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Fsimple.js;0;2
|
||||||
FILE_NAME_5=6984;CSS;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fstyles%2Fsimple.css;0;2
|
FILE_NAME_5=6984;CSS;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fstyles%2Fsimple.css;0;2
|
||||||
FILE_NAME_6=3632;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Factor.js;0;2
|
FILE_NAME_6=8465;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Factor.js;0;2
|
||||||
FILE_NAME_7=1134;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2FWFRP-4th-Edition-FoundryVTT_SLADECRAVEN%2Ftemplates%2Factors%2Factor-skills.html;0;2
|
FILE_NAME_7=1134;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2FWFRP-4th-Edition-FoundryVTT_SLADECRAVEN%2Ftemplates%2Factors%2Factor-skills.html;0;2
|
||||||
FILE_NAME_8=7542;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2FWFRP-4th-Edition-FoundryVTT_SLADECRAVEN%2Fscripts%2Factor%2Fsheet%2Fcharacter-sheet.js;0;2
|
FILE_NAME_8=7542;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2FWFRP-4th-Edition-FoundryVTT_SLADECRAVEN%2Fscripts%2Factor%2Fsheet%2Fcharacter-sheet.js;0;2
|
||||||
|
FILE_NAME_9=956;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Fdialog-competence.html;0;2
|
||||||
|
|
||||||
[VTE]
|
[VTE]
|
||||||
last_dir=/home/sigmar
|
last_dir=/home/sigmar
|
||||||
|
@ -45,7 +45,7 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
data.competenceByCategory = {};
|
data.competenceByCategory = {};
|
||||||
if (data.itemsByType.competence) {
|
if (data.itemsByType.competence) {
|
||||||
for (const item of data.itemsByType.competence) {
|
for (const item of data.itemsByType.competence) {
|
||||||
//console.log("Push...", item, item.data.categorie);
|
console.log("Push...", item, item.data.categorie);
|
||||||
let list = data.competenceByCategory[item.data.categorie];
|
let list = data.competenceByCategory[item.data.categorie];
|
||||||
if (!list) {
|
if (!list) {
|
||||||
list = [];
|
list = [];
|
||||||
@ -99,11 +99,17 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// On carac change
|
// On carac change
|
||||||
$(".competence-value").change((event) => {
|
$(".carac-value").change((event) => {
|
||||||
let caracName = event.currentTarget.name.replace(".value", "").replace("data.carac.", "");
|
let caracName = event.currentTarget.name.replace(".value", "").replace("data.carac.", "");
|
||||||
console.log("Value changed :", event, caracName);
|
console.log("Value changed :", event, caracName);
|
||||||
this.actor.updateCarac( caracName, parseInt(event.target.value) );
|
this.actor.updateCarac( caracName, parseInt(event.target.value) );
|
||||||
} );
|
} );
|
||||||
|
// On competence change
|
||||||
|
$(".competence-value").change((event) => {
|
||||||
|
let compName = event.currentTarget.attributes.compname.value;
|
||||||
|
console.log("Competence changed :", compName);
|
||||||
|
this.actor.updateCompetence( compName, parseInt(event.target.value) );
|
||||||
|
} );
|
||||||
|
|
||||||
$("#vie-plus").click((event) => {
|
$("#vie-plus").click((event) => {
|
||||||
this.actor.santeIncDec("vie", 1);
|
this.actor.santeIncDec("vie", 1);
|
||||||
|
118
module/actor.js
118
module/actor.js
@ -49,15 +49,21 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
performRoll( html, rollData ) {
|
performRoll( rollData ) {
|
||||||
let myroll = new Roll("d100");
|
let myroll = new Roll("d100");
|
||||||
myroll.roll();
|
myroll.roll();
|
||||||
let quality = "Echec";
|
let quality = "Echec";
|
||||||
|
let xpmsg = "";
|
||||||
let tache = 0;
|
let tache = 0;
|
||||||
//console.log(">>> ROLL", rollData.selectedCarac.label, rollData.rollTarget.score, myroll.total );
|
//console.log(">>> ROLL", rollData.selectedCarac.label, rollData.rollTarget.score, myroll.total );
|
||||||
let result = myroll.total;
|
let result = myroll.total;
|
||||||
if (result <= rollData.rollTarget.part) {
|
if (result <= rollData.rollTarget.part) {
|
||||||
quality = "Réussite Particulière!";
|
quality = "Réussite Particulière!";
|
||||||
|
if ( rollData.finalLevel < 0 ) {
|
||||||
|
let xpcarac = Math.floor( Math.abs(rollData.finalLevel) / 2);
|
||||||
|
let xpcomp = (Math.abs(rollData.finalLevel) % 2 == 1) ? xpcarac+1 : xpcarac;
|
||||||
|
xpmsg = "<br>Points d'expérience gagné ! " + xpcarac + " - " + xpcomp;
|
||||||
|
}
|
||||||
tache = 4;
|
tache = 4;
|
||||||
} else if (result <= (rollData.rollTarget.score /2) ) {
|
} else if (result <= (rollData.rollTarget.score /2) ) {
|
||||||
quality = "Réussite Significative";
|
quality = "Réussite Significative";
|
||||||
@ -76,9 +82,9 @@ export class RdDActor extends Actor {
|
|||||||
tache = -4;
|
tache = -4;
|
||||||
}
|
}
|
||||||
|
|
||||||
let chatOptions = { "content": "<strong>Test : " + rollData.selectedCarac.label + " / " + rollData.competence.name + "</strong><br>Modificateur : " + rollData.bmValue + " - " +
|
let chatOptions = { "content": "<strong>Test : " + rollData.selectedCarac.label + " / " + rollData.competence.name + "</strong><br>Jet : " +
|
||||||
rollData.selectedCarac.value + " / " + rollData.finalLevelStr + "<br><strong>Résutat : </strong>" + myroll.total + "<br>" +
|
rollData.selectedCarac.value + " / " + rollData.finalLevelStr + " - " + rollData.rollTarget.score + "%<br><strong>Résutat : </strong>" + myroll.total + "<br>" +
|
||||||
"<strong>" + quality + "</strong><br>Points de taches : " + tache ,
|
"<strong>" + quality + "</strong><br>Points de taches : " + tache + xpmsg,
|
||||||
"title": "Test"
|
"title": "Test"
|
||||||
}
|
}
|
||||||
ChatMessage.create( chatOptions );
|
ChatMessage.create( chatOptions );
|
||||||
@ -92,6 +98,21 @@ export class RdDActor extends Actor {
|
|||||||
RdDUtility.computeCarac( data );
|
RdDUtility.computeCarac( data );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
async updateCompetence( compName, compValue )
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
computeEtatGeneral( )
|
computeEtatGeneral( )
|
||||||
{
|
{
|
||||||
@ -128,18 +149,15 @@ export class RdDActor extends Actor {
|
|||||||
|
|
||||||
if (name == "endurance") {
|
if (name == "endurance") {
|
||||||
if ( inc < 0 ) // Each endurance lost -> fatigue lost
|
if ( inc < 0 ) // Each endurance lost -> fatigue lost
|
||||||
this.data.data.sante.fatigue = this.data.data.sante.fatigue + inc
|
this.data.data.sante.fatigue.value = this.data.data.sante.fatigue.value - inc
|
||||||
let diffEndurance = data.max - data.value;
|
|
||||||
if ( this.data.data.sante.fatigue < diffEndurance) // If endurance lost, then the same amount of fatigue cannot be recovered
|
|
||||||
this.data.data.sante.fatigue = diffEndurance;
|
|
||||||
|
|
||||||
// If endurance is 0 -> -1 vie
|
// If endurance is 0 -> -1 vie
|
||||||
if ( data.value == 0 ) {
|
if ( data.value == 0 ) {
|
||||||
this.data.data.sante.vie.value = this.data.data.sante.vie.value - 1;
|
this.data.data.sante.vie.value = this.data.data.sante.vie.value - 1;
|
||||||
}
|
}
|
||||||
let diffVie = this.data.data.sante.vie.max - this.data.data.sante.vie.value;
|
let diffVie = this.data.data.sante.vie.max - this.data.data.sante.vie.value;
|
||||||
if ( data.value > data.max - (diffvie*2) ) {
|
if ( data.value > data.max - (diffVie*2) ) {
|
||||||
data.value = data.max - (diffvie*2);
|
data.value = data.max - (diffVie*2);
|
||||||
}
|
}
|
||||||
|
|
||||||
let blessures = this.data.data.blessures;
|
let blessures = this.data.data.blessures;
|
||||||
@ -150,25 +168,40 @@ export class RdDActor extends Actor {
|
|||||||
if (lastValue - data.value > 1) this.testSiSonne(data); // Peut-être sonné si 2 points d'endurance perdus d'un coup
|
if (lastValue - data.value > 1) this.testSiSonne(data); // Peut-être sonné si 2 points d'endurance perdus d'un coup
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let diffEndurance = this.data.data.sante.endurance.max - this.data.data.sante.endurance.value;
|
||||||
|
if ( this.data.data.sante.fatigue.value < diffEndurance) // If endurance lost, then the same amount of fatigue cannot be recovered
|
||||||
|
this.data.data.sante.fatigue.value = diffEndurance;
|
||||||
|
|
||||||
console.log(">>>> NEW VI", name, data.value);
|
console.log(">>>> NEW VI", name, data.value);
|
||||||
this.computeEtatGeneral();
|
this.computeEtatGeneral();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
rollCompetence( compName ) {
|
rollArme( armeName ) {
|
||||||
|
// TODO : Search the weapon in the items
|
||||||
|
|
||||||
|
// TODO : Get the associated compentence
|
||||||
|
|
||||||
|
// TODO call rollCompetence with the comp+arme
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
async rollCompetence( compName, arme ) {
|
||||||
|
|
||||||
let compItem = RdDUtility.findCompetence( this.data.items, compName);
|
let compItem = RdDUtility.findCompetence( this.data.items, compName);
|
||||||
let rollData = {
|
let rollData = {
|
||||||
"competence": compItem,
|
"competence": compItem,
|
||||||
"carac": this.data.data.carac,
|
"carac": this.data.data.carac,
|
||||||
"bonusmalusTable": CONFIG.RDD.bonusmalus,
|
"bonusmalusTable": CONFIG.RDD.bonusmalus,
|
||||||
|
"etat": this.data.data.compteurs.etat.value,
|
||||||
"bmValue": 0,
|
"bmValue": 0,
|
||||||
|
"arme": arme,
|
||||||
"finalLevel": 0
|
"finalLevel": 0
|
||||||
}
|
}
|
||||||
CONFIG.currentRollData = rollData;
|
|
||||||
renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-competence.html', rollData).then(dlg =>
|
let dlg = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-competence.html', rollData);
|
||||||
{
|
let mydialog = new Dialog(
|
||||||
new Dialog(
|
|
||||||
{
|
{
|
||||||
title: "Test de compétence",
|
title: "Test de compétence",
|
||||||
content: dlg,
|
content: dlg,
|
||||||
@ -177,16 +210,65 @@ export class RdDActor extends Actor {
|
|||||||
rollButton:
|
rollButton:
|
||||||
{
|
{
|
||||||
label: "Lancer",
|
label: "Lancer",
|
||||||
callback: html => this.performRoll(html, rollData)
|
callback: html => this.performRoll(html)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
default: "rollButton"
|
default: "rollButton"
|
||||||
}, {
|
}, {
|
||||||
classes: ["rdddialog"],
|
classes: ["rdddialog"],
|
||||||
width: 600,
|
width: 600,
|
||||||
height: 320
|
height: 360
|
||||||
} ).render(true);
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
mydialog.data.rollData = rollData;
|
||||||
|
mydialog.data.actor = this;
|
||||||
|
mydialog.activateListeners = function(html) {
|
||||||
|
// Get the rollData stuff
|
||||||
|
var rollData = this.data.rollData;
|
||||||
|
|
||||||
|
function updateRollResult( rollData ) {
|
||||||
|
rollData.finalLevel = parseInt(rollData.competence.data.niveau) + parseInt(rollData.bmValue) + parseInt(rollData.etat);
|
||||||
|
rollData.finalLevelStr = (rollData.finalLevel >= 0 ) ? "+" + rollData.finalLevel : rollData.finalLevel;
|
||||||
|
$("#roll-param").text( rollData.selectedCarac.value + " / " + rollData.finalLevelStr );
|
||||||
|
rollData.rollTarget = game.data.RdDUtility.getResolutionField( rollData.selectedCarac.value, rollData.finalLevel);
|
||||||
|
let niveauStr = (rollData.competence.data.niveau >= 0) ? "+" + rollData.competence.data.niveau : rollData.competence.data.niveau;
|
||||||
|
$("#compdialogTitle").text( rollData.competence.name + " - " + niveauStr + " - " + rollData.selectedCarac.label );
|
||||||
|
$(".table-resolution").remove();
|
||||||
|
game.data.RdDUtility.makeHTMLResolutionTable( $("#resolutionTable"), rollData.selectedCarac.value-2, parseInt(rollData.selectedCarac.value) + 2, -10, 11,
|
||||||
|
rollData.selectedCarac.value, rollData.finalLevel );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setup everything onload
|
||||||
|
$(function() {
|
||||||
|
// Set the default carac from the competence item
|
||||||
|
rollData.selectedCarac = rollData.carac[rollData.competence.data.carac_defaut];
|
||||||
|
// Update html, according to data
|
||||||
|
$("#carac").val( rollData.competence.data.carac_defaut );
|
||||||
|
$("#bonusmalus").val( rollData.bmValue );
|
||||||
|
updateRollResult(rollData);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// Replace again the button action, as i overwritten it
|
||||||
|
$('button').click((event) => {
|
||||||
|
mydialog.data.actor.performRoll(rollData);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Update !
|
||||||
|
$('#bonusmalus').click((event) => {
|
||||||
|
rollData.bmValue = event.currentTarget.value; // Update the selected bonus/malus
|
||||||
|
//console.log("BM CLICKED !!!", rollData.bmValue, rollData.competence.data.niveau, parseInt(rollData.competence.data.niveau) + parseInt(rollData.bmValue) );
|
||||||
|
updateRollResult(rollData);
|
||||||
|
});
|
||||||
|
$('#carac').click((event) => {
|
||||||
|
let caracKey = event.currentTarget.value;
|
||||||
|
rollData.selectedCarac = rollData.carac[caracKey]; // Update the selectedCarac
|
||||||
|
//console.log("CARAC CLICKED !!!", rollData.selectedCarac, rollData.competence.data.niveau, rollData.bmValue);
|
||||||
|
updateRollResult(rollData);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
mydialog.render(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -293,7 +293,7 @@
|
|||||||
|
|
||||||
.rdddialog {
|
.rdddialog {
|
||||||
width: 600px;
|
width: 600px;
|
||||||
height: 400px;
|
height: 430px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.table-resolution-carac {
|
.table-resolution-carac {
|
||||||
|
@ -303,6 +303,7 @@
|
|||||||
"dommages": 0,
|
"dommages": 0,
|
||||||
"force": 0,
|
"force": 0,
|
||||||
"resistance": 0,
|
"resistance": 0,
|
||||||
|
"famille": "",
|
||||||
"cout": 0
|
"cout": 0
|
||||||
},
|
},
|
||||||
"munition": {
|
"munition": {
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
<nav class="sheet-tabs tabs" data-group="primary">
|
<nav class="sheet-tabs tabs" data-group="primary">
|
||||||
<a class="item" data-tab="carac">Caractéristiques</a>
|
<a class="item" data-tab="carac">Caractéristiques</a>
|
||||||
<a class="item" data-tab="competences">Compétences</a>
|
<a class="item" data-tab="competences">Compétences</a>
|
||||||
|
<a class="item" data-tab="combat">Combat</a>
|
||||||
<a class="item" data-tab="description">Description</a>
|
<a class="item" data-tab="description">Description</a>
|
||||||
<a class="item" data-tab="items">Items</a>
|
<a class="item" data-tab="items">Items</a>
|
||||||
<a class="item" data-tab="attributes">Attributes</a>
|
<a class="item" data-tab="attributes">Attributes</a>
|
||||||
@ -52,8 +53,8 @@
|
|||||||
{{#if carac.derivee}}
|
{{#if carac.derivee}}
|
||||||
<label class="competence-value flexrow">{{carac.value}}</label>
|
<label class="competence-value flexrow">{{carac.value}}</label>
|
||||||
{{else}}
|
{{else}}
|
||||||
<input class="competence-value flexrow" type="text" name="data.carac.{{key}}.value" value="{{carac.value}}" data-dtype="{{carac.type}}"/>
|
<input class="carac-value flexrow" type="text" name="data.carac.{{key}}.value" value="{{carac.value}}" data-dtype="{{carac.type}}"/>
|
||||||
<input class="competence-xp flexrow" type="text" name="data.carac.{{key}}.xp" value="{{carac.xp}}" data-dtype="number"/>
|
<input class="carac-xp flexrow" type="text" name="data.carac.{{key}}.xp" value="{{carac.xp}}" data-dtype="number"/>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</li>
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
@ -87,8 +88,8 @@
|
|||||||
{{#each data.competenceByCategory.generale as |comp key|}}
|
{{#each data.competenceByCategory.generale as |comp key|}}
|
||||||
<li class="item flexrow" data-attribute="{{key}}">
|
<li class="item flexrow" data-attribute="{{key}}">
|
||||||
<span class="competence-label" name="data.competenceByCategory.generale[{{key}}].name"><a>{{comp.name}}</a></span>
|
<span class="competence-label" name="data.competenceByCategory.generale[{{key}}].name"><a>{{comp.name}}</a></span>
|
||||||
<input class="competence-value" type="text" name="data.competenceByCategory.generale[{{key}}].data.niveau" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number"/>
|
<input class="competence-value" type="text" name="data.competenceByCategory.generale[{{key}}].data.value" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number"/>
|
||||||
<input class="competence-xp" type="text" name="data.competenceByCategory.generale[{{key}}].data.xp" value="{{comp.data.xp}}" data-dtype="number"/>
|
<input class="competence-xp" type="text" name="data.competenceByCategory.generale[{{key}}]].data.xp" compname="{{comp.name}}" value="{{comp.data.xp}}" data-dtype="number"/>
|
||||||
</li>
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ol>
|
</ol>
|
||||||
@ -102,8 +103,8 @@
|
|||||||
{{#each data.competenceByCategory.particuliere as |comp key|}}
|
{{#each data.competenceByCategory.particuliere as |comp key|}}
|
||||||
<li class="item flexrow" data-attribute="{{key}}">
|
<li class="item flexrow" data-attribute="{{key}}">
|
||||||
<span class="competence-label" name="data.competenceByCategory.particuliere[{{key}}].name"><a>{{comp.name}}</a></span>
|
<span class="competence-label" name="data.competenceByCategory.particuliere[{{key}}].name"><a>{{comp.name}}</a></span>
|
||||||
<input class="competence-value" type="text" name="data.competenceByCategory.particuliere[{{key}}].data.niveau" value="{{comp.data.niveau}}" data-dtype="number"/>
|
<input class="competence-value" type="text" name="data.competenceByCategory.particuliere[{{key}}].data.niveau" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number"/>
|
||||||
<input class="competence-xp" type="text" name="data.competenceByCategory.particuliere[{{key}}].data.xp" value="{{comp.data.xp}}" data-dtype="number"/>
|
<input class="competence-xp" type="text" name="data.competenceByCategory.particuliere[{{key}}].data.xp" compname="{{comp.name}}" value="{{comp.data.xp}}" data-dtype="number"/>
|
||||||
</li>
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ol>
|
</ol>
|
||||||
@ -117,8 +118,8 @@
|
|||||||
{{#each data.competenceByCategory.specialisee as |comp key|}}
|
{{#each data.competenceByCategory.specialisee as |comp key|}}
|
||||||
<li class="item flexrow" data-attribute="{{key}}">
|
<li class="item flexrow" data-attribute="{{key}}">
|
||||||
<span class="competence-label" name="data.competenceByCategory.specialisee[{{key}}].name"><a>{{comp.name}}</a></span>
|
<span class="competence-label" name="data.competenceByCategory.specialisee[{{key}}].name"><a>{{comp.name}}</a></span>
|
||||||
<input class="competence-value" type="text" name="data.competenceByCategory.specialisee[{{key}}].data.niveau" value="{{comp.data.niveau}}" data-dtype="number"/>
|
<input class="competence-value" type="text" name="data.competenceByCategory.specialisee[{{key}}].data.niveau" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number"/>
|
||||||
<input class="competence-xp" type="text" name="data.competenceByCategory.specialisee[{{key}}].data.xp" value="{{comp.data.xp}}" data-dtype="number"/>
|
<input class="competence-xp" type="text" name="data.competenceByCategory.specialisee[{{key}}].data.xp" compname="{{comp.name}}" value="{{comp.data.xp}}" data-dtype="number"/>
|
||||||
</li>
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ol>
|
</ol>
|
||||||
@ -132,8 +133,8 @@
|
|||||||
{{#each data.competenceByCategory.connaissance as |comp key|}}
|
{{#each data.competenceByCategory.connaissance as |comp key|}}
|
||||||
<li class="item flexrow" data-attribute="{{key}}">
|
<li class="item flexrow" data-attribute="{{key}}">
|
||||||
<span class="competence-label" name="data.competenceByCategory.connaissance[{{key}}].name"><a>{{comp.name}}</a></span>
|
<span class="competence-label" name="data.competenceByCategory.connaissance[{{key}}].name"><a>{{comp.name}}</a></span>
|
||||||
<input class="competence-value" type="text" name="data.competenceByCategory.connaissance[{{key}}].data.niveau" value="{{comp.data.niveau}}" data-dtype="number"/>
|
<input class="competence-value" type="text" name="data.competenceByCategory.connaissance[{{key}}].data.niveau" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number"/>
|
||||||
<input class="competence-xp" type="text" name="data.competenceByCategory.connaissance[{{key}}].data.xp" value="{{comp.data.xp}}" data-dtype="number"/>
|
<input class="competence-xp" type="text" name="data.competenceByCategory.connaissance[{{key}}].data.xp" compname="{{comp.name}}" value="{{comp.data.xp}}" data-dtype="number"/>
|
||||||
</li>
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ol>
|
</ol>
|
||||||
@ -147,14 +148,60 @@
|
|||||||
{{#each data.competenceByCategory.draconic as |comp key|}}
|
{{#each data.competenceByCategory.draconic as |comp key|}}
|
||||||
<li class="item flexrow" data-attribute="{{key}}">
|
<li class="item flexrow" data-attribute="{{key}}">
|
||||||
<span class="competence-label" name="data.competenceByCategory.draconic[{{key}}].name"><a>{{comp.name}}</a></span>
|
<span class="competence-label" name="data.competenceByCategory.draconic[{{key}}].name"><a>{{comp.name}}</a></span>
|
||||||
<input class="competence-value" type="text" name="data.competenceByCategory.draconic[{{key}}].data.niveau" value="{{comp.data.niveau}}" data-dtype="number"/>
|
<input class="competence-value" type="text" name="data.competenceByCategory.draconic[{{key}}].data.niveau" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number"/>
|
||||||
<input class="competence-xp" type="text" name="data.competenceByCategory.draconic[{{key}}].data.xp" value="{{comp.data.xp}}" data-dtype="number"/>
|
<input class="competence-xp" type="text" name="data.competenceByCategory.draconic[{{key}}].data.xp" compname="{{comp.name}}" value="{{comp.data.xp}}" data-dtype="number"/>
|
||||||
</li>
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{!-- Combat Tab --}}
|
||||||
|
<div class="tab combat" data-group="primary" data-tab="combat">
|
||||||
|
<header class="competence-header flexrow">
|
||||||
|
<span class="competence-title">Compétences de Mêlée</span>
|
||||||
|
<span class="competence-title">Niveau</span>
|
||||||
|
<span class="competence-title">XP</span>
|
||||||
|
</header>
|
||||||
|
<ol class="item-list">
|
||||||
|
{{#each data.competenceByCategory.melee as |comp key|}}
|
||||||
|
<li class="item flexrow" data-attribute="{{key}}">
|
||||||
|
<span class="competence-label" name="data.competenceByCategory.melee[{{key}}].name"><a>{{comp.name}}</a></span>
|
||||||
|
<input class="competence-value" type="text" name="data.competenceByCategory.melee[{{key}}].data.niveau" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number"/>
|
||||||
|
<input class="competence-xp" type="text" name="data.competenceByCategory.melee[{{key}}].data.xp" compname="{{comp.name}}" value="{{comp.data.xp}}" data-dtype="number"/>
|
||||||
|
</li>
|
||||||
|
{{/each}}
|
||||||
|
</ol>
|
||||||
|
<header class="competence-header flexrow">
|
||||||
|
<span class="competence-title">Compétences de Tir</span>
|
||||||
|
<span class="competence-title">Niveau</span>
|
||||||
|
<span class="competence-title">XP</span>
|
||||||
|
</header>
|
||||||
|
<ol class="item-list">
|
||||||
|
{{#each data.competenceByCategory.tir as |comp key|}}
|
||||||
|
<li class="item flexrow" data-attribute="{{key}}">
|
||||||
|
<span class="competence-label" name="data.competenceByCategory.tir[{{key}}].name"><a>{{comp.name}}</a></span>
|
||||||
|
<input class="competence-value" type="text" name="data.competenceByCategory.tir[{{key}}].data.niveau" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number"/>
|
||||||
|
<input class="competence-xp" type="text" name="data.competenceByCategory.tir[{{key}}].data.xp" compname="{{comp.name}}" value="{{comp.data.xp}}" data-dtype="number"/>
|
||||||
|
</li>
|
||||||
|
{{/each}}
|
||||||
|
</ol>
|
||||||
|
<header class="competence-header flexrow">
|
||||||
|
<span class="competence-title">Compétences de Lancer</span>
|
||||||
|
<span class="competence-title">Niveau</span>
|
||||||
|
<span class="competence-title">XP</span>
|
||||||
|
</header>
|
||||||
|
<ol class="item-list">
|
||||||
|
{{#each data.competenceByCategory.lancer as |comp key|}}
|
||||||
|
<li class="item flexrow" data-attribute="{{key}}">
|
||||||
|
<span class="competence-label" name="data.competenceByCategory.lancer[{{key}}].name"><a>{{comp.name}}</a></span>
|
||||||
|
<input class="competence-value" type="text" name="data.competenceByCategory.lancer[{{key}}].data.niveau" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number"/>
|
||||||
|
<input class="competence-xp" type="text" name="data.competenceByCategory.lancer[{{key}}].data.xp" compname="{{comp.name}}" value="{{comp.data.xp}}" data-dtype="number"/>
|
||||||
|
</li>
|
||||||
|
{{/each}}
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
|
||||||
{{!-- Biography Tab --}}
|
{{!-- Biography Tab --}}
|
||||||
<div class="tab biography" data-group="primary" data-tab="description" style="height:200px">
|
<div class="tab biography" data-group="primary" data-tab="description" style="height:200px">
|
||||||
{{editor content=data.biographie target="data.biographie" button=true owner=owner editable=editable}}
|
{{editor content=data.biographie target="data.biographie" button=true owner=owner editable=editable}}
|
||||||
|
@ -15,13 +15,16 @@
|
|||||||
<select name="bonusmalus" id="bonusmalus" data-dtype="number">
|
<select name="bonusmalus" id="bonusmalus" data-dtype="number">
|
||||||
{{#select bonusmalus}}
|
{{#select bonusmalus}}
|
||||||
{{#each bonusmalusTable as |bmvalue key|}}
|
{{#each bonusmalusTable as |bmvalue key|}}
|
||||||
<option value={{bmvalue}}>{{bmvalue}}</option>
|
<option value={{bmvalue}}>{{numberFormat bmvalue decimals=0 sign=true}}</option>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Résultat : </label><label id="roll-param">10 / 0</label>
|
<label for="categorie">Etat général</label><label>{{numberFormat etat decimals=0 sign=true}}</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Ajustement final : </label><label id="roll-param">10 / 0</label>
|
||||||
</div>
|
</div>
|
||||||
<div id="resolutionTable">
|
<div id="resolutionTable">
|
||||||
|
|
||||||
@ -29,40 +32,4 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Get the rollData stuff
|
|
||||||
var rollData = CONFIG.currentRollData;
|
|
||||||
|
|
||||||
function updateRollResult( rollData ) {
|
|
||||||
rollData.finalLevel = parseInt(rollData.competence.data.niveau) + parseInt(rollData.bmValue);
|
|
||||||
rollData.finalLevelStr = (rollData.finalLevel > 0 ) ? "+" + rollData.finalLevel : rollData.finalLevel;
|
|
||||||
$("#roll-param").text( rollData.selectedCarac.value + " / " + rollData.finalLevelStr );
|
|
||||||
rollData.rollTarget = game.data.RdDUtility.getResolutionField( rollData.selectedCarac.value, rollData.finalLevel);
|
|
||||||
$("#compdialogTitle").text( rollData.competence.name + " - " + rollData.competence.data.niveau + " - " + rollData.selectedCarac.label );
|
|
||||||
$(".table-resolution").remove();
|
|
||||||
game.data.RdDUtility.makeHTMLResolutionTable( $("#resolutionTable"), rollData.selectedCarac.value-2, parseInt(rollData.selectedCarac.value) + 2, -10, 11,
|
|
||||||
rollData.selectedCarac.value, rollData.finalLevel );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Setup everything onload
|
|
||||||
$(function() {
|
|
||||||
// Set the default carac from the competence item
|
|
||||||
rollData.selectedCarac = rollData.carac[rollData.competence.data.carac_defaut];
|
|
||||||
// Update html, according to data
|
|
||||||
$("#carac").val( rollData.competence.data.carac_defaut );
|
|
||||||
$("#bonusmalus").val( rollData.bmValue );
|
|
||||||
updateRollResult(rollData);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Update !
|
|
||||||
$('#bonusmalus').click((event) => {
|
|
||||||
rollData.bmValue = event.currentTarget.value; // Update the selected bonus/malus
|
|
||||||
console.log("BM CLICKED !!!", rollData.bmValue, rollData.competence.data.niveau, parseInt(rollData.competence.data.niveau) + parseInt(rollData.bmValue) );
|
|
||||||
updateRollResult(rollData);
|
|
||||||
});
|
|
||||||
$('#carac').click((event) => {
|
|
||||||
let caracKey = event.currentTarget.value;
|
|
||||||
rollData.selectedCarac = rollData.carac[caracKey]; // Update the selectedCarac
|
|
||||||
console.log("CARAC CLICKED !!!", rollData.selectedCarac, rollData.competence.data.niveau, rollData.bmValue);
|
|
||||||
updateRollResult(rollData);
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user