Roll window is now working for simple skills

This commit is contained in:
LeRatierBretonnien 2020-05-27 21:09:37 +02:00
parent 1b794e5953
commit 59d2f9c6c2
5 changed files with 62 additions and 32 deletions

View File

@ -27,22 +27,20 @@ long_line_behaviour=1
long_line_column=72
[files]
current_page=6
FILE_NAME_0=4198;JSON;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplate.json;0;2
FILE_NAME_1=3416;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Factor-sheet.html;0;2
FILE_NAME_2=241;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Fsimple.js;0;2
FILE_NAME_3=1321;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Factor-sheet.js;0;2
FILE_NAME_4=946;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Factor.js;0;2
FILE_NAME_5=127;TypeScript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Fswade%2Fsrc%2Fmodule%2Fitem-sheet.ts;0;2
FILE_NAME_6=6346;TypeScript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Fswade%2Fsrc%2Fmodule%2Fcharacter-sheet.ts;0;2
FILE_NAME_7=4589;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Fswade%2Fsrc%2Ftemplates%2Factors%2Fcharacter-sheet.html;0;2
FILE_NAME_8=0;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Fswade%2Fsrc%2Ftemplates%2Factors%2Fpartials%2Fedges-tab.html;0;2
FILE_NAME_9=0;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Fswade%2Fsrc%2Ftemplates%2Factors%2Fpartials%2Fsummary-tab.html;0;2
FILE_NAME_10=77;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Frdd-utility.js;0;2
FILE_NAME_11=3385;TypeScript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Fswade%2Fsrc%2Fmodule%2Fentity.ts;0;2
FILE_NAME_12=427;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2FWFRP-4th-Edition-FoundryVTT_SLADECRAVEN%2Fscripts%2Futility-wfrp4e.js;0;2
FILE_NAME_13=42276;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2FWFRP-4th-Edition-FoundryVTT_SLADECRAVEN%2Fscripts%2Factor%2Factor-wfrp4e.js;0;2
FILE_NAME_14=4223;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2FWFRP-4th-Edition-FoundryVTT_SLADECRAVEN%2Fscripts%2Fdice-wfrp4e.js;0;2
current_page=4
FILE_NAME_0=5110;JSON;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplate.json;0;2
FILE_NAME_1=332;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Factor-sheet.js;0;2
FILE_NAME_2=1730;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Fdialog-competence.html;0;2
FILE_NAME_3=1479;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Factor.js;0;2
FILE_NAME_4=2451;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Factor-sheet.html;0;2
FILE_NAME_5=6844;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Frdd-utility.js;0;2
FILE_NAME_6=335;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Fitem-competence-sheet.html;0;2
FILE_NAME_7=985;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Fsimple.js;0;2
FILE_NAME_8=28185;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2FWFRP-4th-Edition-FoundryVTT_SLADECRAVEN%2Fscripts%2Fdice-wfrp4e.js;0;2
FILE_NAME_9=674;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2FWFRP-4th-Edition-FoundryVTT_SLADECRAVEN%2Ftemplates%2Fchat%2Fskill-dialog.html;0;2
FILE_NAME_10=5952;CSS;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fstyles%2Fsimple.css;0;2
FILE_NAME_11=2003;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2FWFRP-4th-Edition-FoundryVTT_SLADECRAVEN%2Fscripts%2Factor%2Factor-wfrp4e.js;0;2
FILE_NAME_12=105669;CSS;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2FWFRP-4th-Edition-FoundryVTT_SLADECRAVEN%2Fcss%2Fwfrp4e.css;0;2
[VTE]
last_dir=/home/sigmar

View File

@ -119,7 +119,11 @@ export class RdDActor extends Actor {
}
},
default: "rollButton"
}).render(true);
}, {
classes: ["rdddialog"],
width: 600,
height: 320
} ).render(true);
});
}

View File

@ -109,41 +109,49 @@ export class RdDUtility {
}
/* -------------------------------------------- */
static __buildHTMLResolutionHead( dataRow ) {
static __buildHTMLResolutionHead( dataRow, minLevel=0, maxLevel=32 ) {
let r = dataRow;
var row = $("<tr/>");
$.each(r, function(colIndex, c) {
for (var colIndex=minLevel; colIndex <= maxLevel; colIndex++) {
let c = dataRow[colIndex];
let txt = (c.niveau > 0) ? "+"+c.niveau : c.niveau;
row.append($("<th class='table-resolution-level'/>").text(txt) );
});
}
return row;
}
/* -------------------------------------------- */
static __buildHTMLResolutionRow( dataRow ) {
static __buildHTMLResolutionRow( dataRow, minLevel=0, maxLevel=32, rowIndex, caracValue, levelValue ) {
let r = dataRow;
var row = $("<tr/>");
$.each(r, function(colIndex, c) {
for (var colIndex=minLevel; colIndex <= maxLevel; colIndex++) {
let c = dataRow[colIndex];
if (rowIndex == caracValue && levelValue+10 == colIndex) {
row.append($("<td class='table-resolution-target'/>").text(c.score));
} else {
if ( colIndex == 2 )
row.append($("<td class='table-resolution-carac'/>").text(c.score));
else
row.append($("<td/>").text(c.score));
});
}
}
return row;
}
/* -------------------------------------------- */
static makeHTMLResolutionTable(container, minCarac = 1, maxCarac = 21) {
static makeHTMLResolutionTable(container, minCarac = 1, maxCarac = 21, minLevel=-10, maxLevel=22, caracValue, levelValue) {
minCarac = (minCarac < 1) ? 1 : minCarac;
maxCarac = (maxCarac > 21) ? 21 : maxCarac;
let data = CONFIG.RDD.resolutionTable;
var table = $("<table/>").addClass('table-resolution');
// Build first row of levels
let row = this.__buildHTMLResolutionHead( data[0] );
minLevel = (minLevel < -10) ? 0 : minLevel+10;
maxLevel = (maxLevel > 22) ? 32 : maxLevel+10;
let row = this.__buildHTMLResolutionHead( data[0], minLevel, maxLevel );
table.append(row);
// Then the rest...
for (var rowIndex=minCarac; rowIndex <= maxCarac; rowIndex++) {
let row = this.__buildHTMLResolutionRow( data[rowIndex] );
let row = this.__buildHTMLResolutionRow( data[rowIndex], minLevel, maxLevel, rowIndex, caracValue, levelValue );
table.append(row);
}
return container.append(table);

View File

@ -291,4 +291,23 @@
text-align: right;
}
.rdddialog {
width: 600px;
height: 400px;
}
.table-resolution-carac {
background-color: yellow;
}
.table-resolution-target {
font-weight: bold;
background-color: lightblue;
}
select {
font-family: "GoudyAcc", sans-serif;
}
button {
font-family: "GoudyAcc", sans-serif;
}

View File

@ -34,12 +34,13 @@
function updateRollResult( rollData ) {
rollData.finalLevel = parseInt(rollData.competence.data.niveau) + parseInt(rollData.bmValue);
$(".table-resolution").remove();
game.data.RdDUtility.makeHTMLResolutionTable( $("#resolutionTable"), rollData.selectedCarac.value-2, parseInt(rollData.selectedCarac.value) + 2 );
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