Sync with head

This commit is contained in:
LeRatierBretonnien 2020-05-24 20:19:57 +02:00
parent c144b2473c
commit 003d548f1f
10 changed files with 754 additions and 175 deletions

BIN
fonts/goudyacc.ttf Executable file

Binary file not shown.

View File

@ -93,7 +93,12 @@ export class RdDActorSheet extends ActorSheet {
let compName = event.currentTarget.text;
this.actor.rollCompetence( compName);
});
// On carac change
$(".competence-value").change((event) => {
let caracName = event.currentTarget.name.replace(".value", "").replace("data.carac.", "");
console.log("Value changed :", event, caracName);
this.actor.updateCarac( caracName, parseInt(event.target.value) );
} );
}
/* -------------------------------------------- */

View File

@ -7,6 +7,25 @@ import { RdDUtility } from "./rdd-utility.js";
export class RdDActor extends Actor {
/* -------------------------------------------- */
/**
* Override the create() function to provide additional RdD functionality.
*
* This overrided create() function adds initial items
* Namely: Basic skills, money,
*
* @param {Object} data Barebones actor data which this function adds onto.
* @param {Object} options (Unused) Additional options which customize the creation workflow.
*
*/
static async create(data, options) {
// If the created actor has items (only applicable to duplicated actors) bypass the new actor creation logic
if (data.items) {
return super.create(data, options);
}
super.create(data, options);
}
/* -------------------------------------------- */
prepareData() {
@ -25,16 +44,67 @@ export class RdDActor extends Actor {
* Prepare Character type specific data
*/
_prepareCharacterData(actorData) {
// Initialize empty items
RdDUtility.computeCarac(actorData.data);
}
/* -------------------------------------------- */
performRoll( html, rollData ) {
let myroll = new Roll("d100");
myroll.roll();
let quality = "Echec";
let tache = 0;
//console.log(">>> ROLL", rollData.selectedCarac.label, rollData.rollTarget.score, myroll.total );
let result = myroll.total;
if (result <= rollData.rollTarget.part) {
quality = "Réussite Particulière!";
tache = 4;
} else if (result <= (rollData.rollTarget.score /2) ) {
quality = "Réussite Significative";
tache = 2;
} else if (result <= (rollData.rollTarget.score) ) {
quality = "Réussite Normale";
tache = 1;
} else if (result < (rollData.rollTarget.epart) ) {
quality = "Echec Normal";
tache = 0;
} else if (result < (rollData.rollTarget.etotal) ) {
quality = "Echec Particulier";
tache = -2;
} else if (result >= (rollData.rollTarget.etotal) ) {
quality = "Echec Total";
tache = -4;
}
let chatOptions = { "content": "<strong>Test : " + rollData.selectedCarac.label + " / " + rollData.competence.name + "</strong><br>Modificateur : " + rollData.bmValue + " - " +
rollData.selectedCarac.value + " / " + rollData.finalLevelStr + "<br><strong>Résutat : </strong>" + myroll.total + "<br>" +
"<strong>" + quality + "</strong><br>Points de taches : " + tache ,
"title": "Test"
}
ChatMessage.create( chatOptions );
}
/* -------------------------------------------- */
updateCarac( caracName, caracValue )
{
let data = this.data.data;
data.carac[caracName].value = caracValue; // Force update ?
RdDUtility.computeCarac( data );
}
/* -------------------------------------------- */
/* -------------------------------------------- */
rollCompetence( compName ) {
let compItem = RdDUtility.findCompetence( this.data.items, compName);
console.log("Roll !", compItem );
renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-competence.html', compItem).then(dlg =>
let rollData = {
"competence": compItem,
"carac": this.data.data.carac,
"bonusmalusTable": CONFIG.RDD.bonusmalus,
"bmValue": 0,
"finalLevel": 0
}
CONFIG.currentRollData = rollData;
renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-competence.html', rollData).then(dlg =>
{
new Dialog(
{
@ -44,8 +114,8 @@ export class RdDActor extends Actor {
{
rollButton:
{
label: "Lancer"
//callback: html => dialogOptions.callback(html, roll)
label: "Lancer",
callback: html => this.performRoll(html, rollData)
}
},
default: "rollButton"
@ -53,8 +123,7 @@ export class RdDActor extends Actor {
});
}
/* -------------------------------------------- */
/* -------------------------------------------- */
/** @override */
getRollData() {
const data = super.getRollData();

View File

@ -1,7 +1,207 @@
/* Common useful functions shared between objects */
const level_category = {
"generale": "-4",
"particuliere": "-8",
"speciale": "-11",
"connaissance": "-11",
"draconic": "-11",
"melee": "-6",
"tir": "-8",
"lancer": "-8"
}
const carac_array = [ "taille", "apparence", "constitution", "force", "agilite", "dexterite", "vue", "ouie", "odoratgout", "volonte", "intellect", "empathie", "reve", "chance", "melee", "tir", "lancer", "derobee"];
const bonusmalus = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, +1, +2, +3, +4, +5, +6, +7, +8, +9, +10];
const specialResults = [ { "part": 0, "epart": 0, "etotal": 0 }, // 0
{ "part": 1, "epart": 81, "etotal": 92 }, // 01-05
{ "part": 2, "epart": 82, "etotal": 92 }, // 06-10
{ "part": 3, "epart": 83, "etotal": 93 }, // 11-15
{ "part": 4, "epart": 84, "etotal": 93 }, // 16-20
{ "part": 5, "epart": 85, "etotal": 94 }, // 21-25
{ "part": 6, "epart": 86, "etotal": 94 }, // 26-30
{ "part": 7, "epart": 87, "etotal": 95 }, // 31-35
{ "part": 8, "epart": 88, "etotal": 95 }, // 36-40
{ "part": 9, "epart": 89, "etotal": 96 }, // 41-45
{ "part": 10, "epart": 90, "etotal": 96 }, // 46-50
{ "part": 11, "epart": 91, "etotal": 97 }, // 51-55
{ "part": 12, "epart": 92, "etotal": 97 }, // 56-60
{ "part": 13, "epart": 93, "etotal": 98 }, // 61-65
{ "part": 14, "epart": 94, "etotal": 98 }, // 65-70
{ "part": 15, "epart": 95, "etotal": 99 }, // 71-75
{ "part": 16, "epart": 96, "etotal": 99 }, // 76-80
{ "part": 17, "epart": 97, "etotal": 100 }, // 81-85
{ "part": 18, "epart": 98, "etotal": 100 }, // 86-90
{ "part": 19, "epart": 99, "etotal": 100 }, // 81-95
{ "part": 20, "epart": 100, "etotal": 100 } // 96-00
];
const levelDown = [ { "level": -11, "score": 1, "part": 0, "epart": 2, "etotal": 90 },
{ "level": -12, "score": 1, "part": 0, "epart": 2, "etotal": 70 },
{ "level": -13, "score": 1, "part": 0, "epart": 2, "etotal": 50 },
{ "level": -14, "score": 1, "part": 0, "epart": 2, "etotal": 30 },
{ "level": -15, "score": 1, "part": 0, "epart": 2, "etotal": 10 },
{ "level": -16, "score": 1, "part": 0, "epart": 2, "etotal": 2 },
];
export class RdDUtility {
/* -------------------------------------------- */
static async preloadHandlebarsTemplates( ) {
const templatePaths = [
//Character Sheets
'systems/foundryvtt-reve-de-dragon/templates/actor-sheet.html',
//Items
'systems/foundryvtt-reve-de-dragon/templates/item-competence-sheet.html',
'systems/foundryvtt-reve-de-dragon/templates/competence-categorie.html',
'systems/foundryvtt-reve-de-dragon/templates/competence-carac-defaut.html',
'systems/foundryvtt-reve-de-dragon/templates/competence-base.html',
// Dialogs
'systems/foundryvtt-reve-de-dragon/templates/dialog-competence.html'
];
return loadTemplates(templatePaths);
}
/* -------------------------------------------- */
static buildResolutionTable( ) {
let tableRes = []
for (var j=0; j<=21; j++) {
let subtab = [];
for (var i=-10; i<=22; i++) {
var m = (i + 10) * 0.5;
var v;
if (i == -9) {
v = Math.floor(j / 2);
} else if (i == -10) {
v = Math.floor(j / 4);
} else {
if (j % 2 == 0) {
var v = Math.ceil(j * m);
} else {
var v = Math.floor(j * m);
}
}
if (v < 1) v = 1;
let specResults
if ( v > 100 )
specResults = { "part": Math.ceil(v / 5), "epart": 1000, "etotal": 1000 };
else
specResults = specialResults[Math.ceil(v / 5 )];
let tabIndex = i+10;
subtab[tabIndex] = { "niveau": i, "score": v, "part": specResults.part, "epart": specResults.epart, "etotal": specResults.etotal }
}
tableRes[j] = subtab;
}
return tableRes;
}
/* -------------------------------------------- */
static getLevelCategory( )
{
return level_category;
}
static getCaracArray()
{
return carac_array;
}
static getBonusMalus()
{
return bonusmalus;
}
/* -------------------------------------------- */
static __buildHTMLResolutionHead( dataRow ) {
let r = dataRow;
var row = $("<tr/>");
$.each(r, function(colIndex, c) {
let txt = (c.niveau > 0) ? "+"+c.niveau : c.niveau;
row.append($("<th class='table-resolution-level'/>").text(txt) );
});
return row;
}
/* -------------------------------------------- */
static __buildHTMLResolutionRow( dataRow ) {
let r = dataRow;
var row = $("<tr/>");
$.each(r, function(colIndex, c) {
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) {
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] );
table.append(row);
// Then the rest...
for (var rowIndex=minCarac; rowIndex <= maxCarac; rowIndex++) {
let row = this.__buildHTMLResolutionRow( data[rowIndex] );
table.append(row);
}
return container.append(table);
}
/* -------------------------------------------- */
static getResolutionField(caracValue, levelValue )
{
if ( levelValue < -16 ) {
return { "score": 0, "part": 0, "epart": 1, "etotal": 1};
} if ( levelValue < -10 ) {
return levelDown.find(levelData => levelData.level == levelValue);
}
return CONFIG.RDD.resolutionTable[caracValue][levelValue+10];
}
/* -------------------------------------------- */
static computeCarac( data)
{
let fmax = parseInt(data.carac.taille.value) + 4;
if ( data.carac.force.value > fmax )
data.carac.force.value = fmax;
data.carac.derobee.value = Math.floor(parseInt(((21 - data.carac.taille.value)) + parseInt(data.carac.agilite.value)) / 2);
let bonusDomKey = Math.floor( (parseInt(data.carac.force.value) + parseInt(data.carac.taille.value)) / 2);
data.attributs.plusdom.value = 2
if (bonusDomKey < 8)
data.attributs.plusdom.value = -1;
else if (bonusDomKey < 12)
data.attributs.plusdom.value = 0;
else if (bonusDomKey < 14)
data.attributs.plusdom.value = 1;
data.attributs.encombrement.value = (parseInt(data.carac.force.value) + parseInt(data.carac.taille.value)) / 2;
data.carac.melee.value = Math.floor( (parseInt(data.carac.force.value) + parseInt(data.carac.agilite.value)) / 2);
data.carac.tir.value = Math.floor( (parseInt(data.carac.vue.value) + parseInt(data.carac.dexterite.value)) / 2);
data.carac.lancer.value = Math.floor( (parseInt(data.carac.tir.value) + parseInt(data.carac.force.value)) / 2);
data.sante.vie.max = Math.ceil( parseInt(data.carac.taille.value) + parseInt(data.carac.constitution.value) /2 );
let endurance = Math.max( parseInt(data.carac.taille.value) + parseInt(data.carac.constitution.value), parseInt(data.sante.vie.max) + parseInt(data.carac.volonte.value) );
data.sante.endurance.max = endurance;
data.attributs.sconst.value = 5; // Max !
if ( data.carac.constitution.value < 9 )
data.attributs.sconst.value = 2;
else if (data.carac.constitution.value < 12 )
data.attributs.sconst.value = 3;
else if (data.carac.constitution.value < 15 )
data.attributs.sconst.value = 4;
data.attributs.sust.value = 4; // Max !
if ( data.carac.constitution.value < 10 )
data.attributs.sconst.value = 2;
else if (data.carac.constitution.value < 14 )
data.attributs.sconst.value = 3;
}
/* -------------------------------------------- */
static findCompetence(compList, compName)
{
for (const item of compList) {
@ -12,6 +212,4 @@ export class RdDUtility {
}
}
}

View File

@ -5,17 +5,6 @@
*/
/* -------------------------------------------- */
const RDD = {}
RDD.level_category = {
"generale": "-4",
"particuliere": "-8",
"speciale": "-11",
"connaissance": "-11",
"draconic": "-11",
"melee": "-6",
"tir": "-8",
"lancer": "-8"
}
/* -------------------------------------------- */
// Import Modules
@ -24,33 +13,16 @@ import { RdDItemSheet } from "./item-sheet.js";
import { RdDActorSheet } from "./actor-sheet.js";
import { RdDUtility } from "./rdd-utility.js";
/* -------------------------------------------- */
// Handlers management
const preloadHandlebarsTemplates = async function () {
const templatePaths = [
//Character Sheets
'systems/foundryvtt-reve-de-dragon/templates/actor-sheet.html',
//Items
'systems/foundryvtt-reve-de-dragon/templates/item-competence-sheet.html',
'systems/foundryvtt-reve-de-dragon/templates/competence-categorie.html',
'systems/foundryvtt-reve-de-dragon/templates/competence-carac-defaut.html',
'systems/foundryvtt-reve-de-dragon/templates/competence-base.html',
// Dialogs
'systems/foundryvtt-reve-de-dragon/templates/dialog-competence.html'
];
return loadTemplates(templatePaths);
}
/* -------------------------------------------- */
/* Foundry VTT Initialization */
/* -------------------------------------------- */
Hooks.once("init", async function() {
console.log(`Initializing Reve de Dragon System`);
// preload handlebars templates
preloadHandlebarsTemplates();
// preload handlebars templates
RdDUtility.preloadHandlebarsTemplates();
/**
* Set an initiative formula for the system
* @type {String}
@ -62,7 +34,12 @@ Hooks.once("init", async function() {
// Define custom Entity classes
CONFIG.Actor.entityClass = RdDActor;
CONFIG.RDD = RDD;
CONFIG.RDD = {}
CONFIG.RDD.resolutionTable = RdDUtility.buildResolutionTable();
CONFIG.RDD.level_category = RdDUtility.getLevelCategory();
CONFIG.RDD.carac_array = RdDUtility.getCaracArray();
CONFIG.RDD.bonusmalus = RdDUtility.getBonusMalus();
game.data.RdDUtility = RdDUtility;
// Register sheet application classes
Actors.unregisterSheet("core", ActorSheet);

View File

@ -1,146 +1,294 @@
.foundryvtt-reve-de-dragon {
/* Sheet Tabs */
/* Items List */
/* Attributes */
/* ==================== (A) GOUDY ==================== */
@font-face {
font-family: "GoudyAcc";
src: url('../fonts/goudyacc.ttf');
}
:root {
/* =================== 1. ACTOR SHEET FONT STYLES =========== */
--window-header-title-font-family: GoudyAcc;
--window-header-title-font-size: 19px;
--window-header-title-font-weight: normal;
--window-header-title-color: #f5f5f5;
--major-button-font-family: GoudyAcc;
--major-button-font-size: 20px;
--major-button-font-weight: normal;
--major-button-color: #dadada;
--tab-header-font-family: GoudyAcc;
--tab-header-font-size: 16px;
--tab-header-font-weight: 700;
--tab-header-color: #403f3e;
--tab-header-color-active: #4a0404;
--actor-input-font-family: GoudyAcc;
--actor-input-font-size: 14px;
--actor-input-font-weight: 500;
--actor-input-color: black;
--actor-label-font-family: GoudyAcc;
--actor-label-font-size: 16px;
--actor-label-font-weight: 700;
--actor-label-color: #464331c4;
/* =================== 2. DEBUGGING HIGHLIGHTERS ============ */
--debug-background-color-red: #ff000054;
--debug-background-color-blue: #1d00ff54;
--debug-background-color-green: #54ff0054;
--debug-box-shadow-red: inset 0 0 2px red;
--debug-box-shadow-blue: inset 0 0 2px blue;
--debug-box-shadow-green: inset 0 0 2px green;
}
/*@import url("https://fonts.googleapis.com/css2?family=Martel:wght@400;800&family=Roboto:wght@300;400;500&display=swap");*/
/* Global styles */
.window-app {
font-family: "GoudyAcc", sans-serif;
}
.foundryvtt-reve-de-dragon .window-content {
height: 100%;
.rollable:hover, .rollable:focus {
color: #000;
text-shadow: 0 0 10px red;
cursor: pointer;
}
.grid,
.grid-2col {
display: grid;
grid-column: span 2 / span 2;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 10px;
margin: 10px 0;
padding: 0;
}
.grid-3col {
grid-column: span 3 / span 3;
grid-template-columns: repeat(3, minmax(0, 1fr));
}
.grid-4col {
grid-column: span 4 / span 4;
grid-template-columns: repeat(4, minmax(0, 1fr));
}
.grid-5col {
grid-column: span 5 / span 5;
grid-template-columns: repeat(5, minmax(0, 1fr));
}
.grid-6col {
grid-column: span 5 / span 5;
grid-template-columns: repeat(5, minmax(0, 1fr));
}
.grid-7col {
grid-column: span 7 / span 7;
grid-template-columns: repeat(7, minmax(0, 1fr));
}
.grid-8col {
grid-column: span 8 / span 8;
grid-template-columns: repeat(8, minmax(0, 1fr));
}
.grid-9col {
grid-column: span 9 / span 9;
grid-template-columns: repeat(9, minmax(0, 1fr));
}
.grid-10col {
grid-column: span 10 / span 10;
grid-template-columns: repeat(10, minmax(0, 1fr));
}
.grid-11col {
grid-column: span 11 / span 11;
grid-template-columns: repeat(11, minmax(0, 1fr));
}
.grid-12col {
grid-column: span 12 / span 12;
grid-template-columns: repeat(12, minmax(0, 1fr));
}
.flex-group-center,
.flex-group-left,
.flex-group-right {
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
text-align: center;
padding: 5px;
overflow-y: hidden;
border: 1px solid #999;
}
.flex-group-left {
-webkit-box-pack: start;
-ms-flex-pack: start;
justify-content: flex-start;
text-align: left;
}
.flex-group-right {
-webkit-box-pack: end;
-ms-flex-pack: end;
justify-content: flex-end;
text-align: right;
}
.flex-center {
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
text-align: center;
}
.flex-between {
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
}
/* Styles limited to foundryvtt-reve-de-dragon sheets */
.foundryvtt-reve-de-dragon .item-form {
font-family: "Roboto", sans-serif;
}
.foundryvtt-reve-de-dragon .sheet-header {
height: 100px;
-webkit-box-flex: 0;
-ms-flex: 0 0 210px;
flex: 0 0 210px;
overflow: hidden;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-ms-flex-direction: row;
flex-direction: row;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-box-pack: start;
-ms-flex-pack: start;
justify-content: flex-start;
margin-bottom: 10px;
}
.foundryvtt-reve-de-dragon .sheet-header .profile-img {
-webkit-box-flex: 0;
-ms-flex: 0 0 100px;
flex: 0 0 100px;
height: 100px;
margin-right: 10px;
}
.foundryvtt-reve-de-dragon .sheet-header .header-fields {
-webkit-box-flex: 1;
-ms-flex: 1;
flex: 1;
height: 100px;
}
.foundryvtt-reve-de-dragon .sheet-header h1.charname {
height: 50px;
padding: 0px;
margin: 5px 0;
border-bottom: 0;
}
.foundryvtt-reve-de-dragon .sheet-header h1.charname input {
width: 100%;
height: 100%;
margin: 0;
}
.foundryvtt-reve-de-dragon .resource {
width: 50%;
height: 40px;
margin-top: 10px;
float: left;
text-align: center;
.foundryvtt-reve-de-dragon .sheet-tabs {
-webkit-box-flex: 0;
-ms-flex: 0;
flex: 0;
}
.foundryvtt-reve-de-dragon .resource input {
width: 100px;
height: 28px;
.foundryvtt-reve-de-dragon .sheet-body,
.foundryvtt-reve-de-dragon .sheet-body .tab,
.foundryvtt-reve-de-dragon .sheet-body .tab .editor {
height: 100%;
}
.foundryvtt-reve-de-dragon .tox .tox-editor-container {
background: #fff;
}
.foundryvtt-reve-de-dragon .tox .tox-edit-area {
padding: 0 8px;
}
.foundryvtt-reve-de-dragon .resource-label {
font-weight: bold;
text-transform: uppercase;
}
.foundryvtt-reve-de-dragon .tabs {
height: 40px;
border-top: 1px solid #AAA;
border-bottom: 1px solid #AAA;
}
.foundryvtt-reve-de-dragon .tabs .item {
line-height: 40px;
font-weight: bold;
}
.foundryvtt-reve-de-dragon .tabs .item.active {
text-decoration: underline;
text-shadow: none;
}
.foundryvtt-reve-de-dragon .sheet-body {
overflow: hidden;
}
.foundryvtt-reve-de-dragon .sheet-body .tab {
height: 100%;
overflow-y: auto;
}
.foundryvtt-reve-de-dragon .editor,
.foundryvtt-reve-de-dragon .editor-content {
height: 100%;
}
.foundryvtt-reve-de-dragon .item-list {
.foundryvtt-reve-de-dragon .items-list {
list-style: none;
margin: 7px 0;
padding: 0;
overflow-y: auto;
}
.foundryvtt-reve-de-dragon .item-list .item {
.foundryvtt-reve-de-dragon .items-list .item-header {
font-weight: bold;
}
.foundryvtt-reve-de-dragon .items-list .item {
height: 30px;
line-height: 24px;
padding: 3px 0;
border-bottom: 1px solid #BBB;
}
.foundryvtt-reve-de-dragon .item-list .item img {
.foundryvtt-reve-de-dragon .items-list .item .item-image {
-webkit-box-flex: 0;
-ms-flex: 0 0 24px;
flex: 0 0 24px;
margin-right: 5px;
}
.foundryvtt-reve-de-dragon .item-list .item-name {
margin: 0;
}
.foundryvtt-reve-de-dragon .item-list .item-controls {
flex: 0 0 36px;
}
.foundryvtt-reve-de-dragon .attributes-header {
padding: 5px;
margin: 5px 0;
background: rgba(0, 0, 0, 0.05);
border: 1px solid #AAA;
border-radius: 2px;
text-align: center;
font-weight: bold;
}
.foundryvtt-reve-de-dragon .attributes-header .attribute-label {
flex: 1.5;
}
.foundryvtt-reve-de-dragon .attributes-header .attribute-control {
flex: 0 0 20px;
}
.foundryvtt-reve-de-dragon .attributes-list {
list-style: none;
margin: 0;
padding: 0;
}
.foundryvtt-reve-de-dragon .attributes-list li > * {
margin: 0 3px;
height: 28px;
line-height: 24px;
background: transparent;
border: none;
border-radius: 0;
border-bottom: 1px solid #AAA;
}
.foundryvtt-reve-de-dragon .attributes-list a.attribute-control {
flex: 0 0 20px;
text-align: center;
line-height: 28px;
border: none;
}
.foundryvtt-reve-de-dragon.sheet.actor {
min-width: 560px;
min-height: 420px;
}
.foundryvtt-reve-de-dragon.sheet.item {
min-width: 460px;
min-height: 400px;
.foundryvtt-reve-de-dragon .items-list .item img {
display: block;
}
//Editor
.editor {
border: $section-border;
height: 300px;
width: 100%;
.foundryvtt-reve-de-dragon .items-list .item-name {
margin: 0;
}
.foundryvtt-reve-de-dragon .items-list .item-controls {
-webkit-box-flex: 0;
-ms-flex: 0 0 86px;
flex: 0 0 86px;
text-align: right;
}

View File

@ -2,10 +2,10 @@
"name": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon",
"description": "L'implémentation de Rêve de Dragon pour FoundryVTT",
"version": 0.2,
"version": 0.3,
"minimumCoreVersion": "0.5.7",
"compatibleCoreVersion": "0.5.7",
"templateVersion": 5,
"templateVersion": 6,
"author": "LeRatierBretonnien",
"esmodules": ["module/simple.js"],
"styles": ["styles/simple.css"],

View File

@ -5,7 +5,13 @@
"background": {
"biographie": "Histoire personnelle...",
"yeux": "",
"cheveux": ""
"cheveux": "",
"poids": "",
"heure": 0,
"sexe": "",
"age": 0,
"beaute": 10,
"main": "droitier"
},
"common": {
"carac": {
@ -13,85 +19,127 @@
"type": "number",
"value": 10,
"label": "Taille",
"xp": 0
"xp": 0,
"derivee": false
},
"apparence": {
"type": "number",
"value": 10,
"label": "Apparence",
"xp": 0
"xp": 0,
"derivee": false
},
"constitution": {
"type": "number",
"value": 10,
"label": "Constitution",
"xp": 0
"xp": 0,
"derivee": false
},
"force": {
"type": "number",
"value": 10,
"label": "Force",
"xp": 0
"xp": 0,
"derivee": false
},
"agilite": {
"type": "number",
"value": 10,
"label": "Agilité",
"xp": 0
"xp": 0,
"derivee": false
},
"dexterite": {
"type": "number",
"value": 10,
"label": "Dexterité",
"xp": 0
"xp": 0,
"derivee": false
},
"vue": {
"type": "number",
"value": 10,
"label": "Vue",
"xp": 0
"xp": 0,
"derivee": false
},
"ouie": {
"type": "number",
"value": 10,
"label": "Ouïe",
"xp": 0
"xp": 0,
"derivee": false
},
"odoratgout": {
"type": "number",
"value": 10,
"label": "Odorat-Goût",
"xp": 0
"xp": 0,
"derivee": false
},
"volonte": {
"type": "number",
"value": 10,
"label": "Volonté",
"xp": 0
"xp": 0,
"derivee": false
},
"intellect": {
"type": "number",
"value": 10,
"label": "Intellect",
"xp": 0
"xp": 0,
"derivee": false
},
"empathie": {
"type": "number",
"value": 10,
"label": "Empathie",
"xp": 0
"xp": 0,
"derivee": false
},
"reve": {
"type": "number",
"value": 10,
"label": "Rêve",
"xp": 0
"xp": 0,
"derivee": false
},
"chance": {
"type": "number",
"value": 10,
"label": "Chance",
"xp": 0
"xp": 0,
"derivee": false
},
"melee": {
"type": "number",
"value": 10,
"label": "Mêlée",
"xp": 0,
"derivee": true
},
"tir": {
"type": "number",
"value": 10,
"label": "Tir",
"xp": 0,
"derivee": true
},
"lancer": {
"type": "number",
"value": 10,
"label": "Lancer",
"xp": 0,
"derivee": true
},
"derobee": {
"type": "number",
"value": 10,
"label": "Dérobée",
"xp": 0,
"derivee": true
}
},
"sante": {
@ -99,19 +147,66 @@
"type": "number",
"max": 10,
"value": 10,
"label": "Points de Vie"
"label": "Points de Vie",
"derivee": true
},
"endurance": {
"type": "number",
"max": 10,
"value": 10,
"label": "Points d'Endurance"
"label": "Points d'Endurance",
"derivee": true
},
"fatigue": {
"type": "number",
"max": 40,
"value": 10,
"label": "Points de Fatigue"
"label": "Points de Fatigue",
"derivee": true
}
},
"attributs": {
"sconst": {
"type": "number",
"value": 0,
"label": "S. Const",
"derivee": true
},
"sust": {
"type": "number",
"value": 0,
"label": "Sustentation",
"derivee": true
},
"plusdom": {
"type": "number",
"value": 0,
"label": "+dom",
"derivee": true
},
"encombrement": {
"type": "number",
"value": 0,
"label": "Encombrement",
"derivee": true
}
"malusarmure": {
"type": "number",
"value": 0,
"label": "Malus Armure",
"derivee": true
}
},
"argent": {
"deniers": {
"label": "Denier",
"value": 0,
"enc": 0
},
"sols": {
"label": "Sol",
"value": 0,
"enc": 0
}
}
}

View File

@ -1,20 +1,18 @@
<form class="{{cssClass}}" autocomplete="off">
<form class="{{cssClass}} flexcol" autocomplete="off">
{{!-- Sheet Header --}}
<header class="sheet-header">
<img class="profile-img" src="{{actor.img}}" data-edit="img" title="{{actor.name}}" height="100" width="100"/>
<div class="header-fields">
<h1 class="charname"><input name="name" type="text" value="{{actor.name}}" placeholder="Name"/></h1>
<div class="resource">
<input type="text" name="data.sante.vie.value" value="{{data.sante.vie.value}}" data-dtype="Number"/>
<span> / </span>
<input type="text" name="data.sante.vie.max" value="{{data.sante.vie.max}}" data-dtype="Number"/>
<h1 class="charname"><input name="name" type="text" value="{{actor.name}}" placeholder="Name"/></h1>
<div class="grid grid-2col">
<div class="flex-group-center">
<input class="resource-content flexrow flex-center flex-between" type="text" name="data.sante.vie.value" value="{{data.sante.vie.value}}" data-dtype="Number"/>/{{data.sante.vie.max}}
</div>
<div class="resource">
<input type="text" name="data.sante.fatigue.value" value="{{data.sante.fatigue.value}}" data-dtype="Number"/>
<span> / </span>
<input type="text" name="data.sante.fatigue.max" value="{{data.sante.fatigue.max}}" data-dtype="Number"/>
<div class="flex-group-center">
<input class="resource-content flexrow flex-center flex-between" type="text" name="data.sante.fatigue.value" value="{{data.sante.fatigue.value}}" data-dtype="Number"/>/{{data.sante.fatigue.max}}
</div>
</div>
</div>
</header>
@ -31,23 +29,45 @@
<section class="sheet-body">
{{!-- Carac Tab --}}
<div class="tab carac" data-group="primary" data-tab="carac">
<header class="carac-header flexrow">
<span class="carac-title">Nom</span>
<span class="carac-title">Valeur</span>
<span class="carac-title">XP</span>
</header>
<ol class="competence-list">
{{#each data.carac as |carac key|}}
<li class="competence flexrow" data-attribute="{{key}}">
<span class="competence-label" name="data.carac.{{key}}.label">{{carac.label}}</span>
<input class="competence-value" type="text" name="data.carac.{{key}}.value" value="{{carac.value}}" data-dtype="{{carac.type}}"/>
<input class="competence-xp" type="text" name="data.carac.{{key}}.xp" value="{{carac.xp}}" data-dtype="number"/>
</li>
{{/each}}
</ol>
<div class="tab" data-group="primary" data-tab="carac">
<div class="grid grid-2col">
<div class="flex-group-center">
<header class="carac-header flexrow">
<span class="carac-title">Nom</span>
<span class="carac-title">Valeur</span>
<span class="carac-title">XP</span>
</header>
<ol class="carac-list">
{{#each data.carac as |carac key|}}
<li class="competence flexrow" data-attribute="{{key}}">
<span class="competence-label" name="data.carac.{{key}}.label">{{carac.label}}</span>
{{#if carac.derivee}}
<label class="competence-value">{{carac.value}}</label>
{{else}}
<input class="competence-value" type="text" name="data.carac.{{key}}.value" value="{{carac.value}}" data-dtype="{{carac.type}}"/>
<input class="competence-xp" type="text" name="data.carac.{{key}}.xp" value="{{carac.xp}}" data-dtype="number"/>
{{/if}}
</li>
{{/each}}
</ol>
</div>
<div class="flex-group-center" >
<header class="attributs-header flexrow">
<span class="attributs-title">Nom</span>
<span class="attributs-title">Valeur</span>
</header>
<ol class="attributs-list">
{{#each data.attributs as |attr key|}}
<li class="attribut flexrow" data-attribute="{{key}}">
<span class="attribut-label" name="data.attributs.{{key}}.label">{{attr.label}}</span>
<label class="attribut-value">{{attr.value}}</label>
</li>
{{/each}}
</ol>
</div>
</div>
</div>
{{!-- Compétences Tab --}}
<div class="tab competences" data-group="primary" data-tab="competences">
<header class="competence-header flexrow">
@ -59,7 +79,7 @@
{{#each data.competenceByCategory.generale as |comp key|}}
<li class="item flexrow" data-attribute="{{key}}">
<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="{{comp.data.niveau}}" data-dtype="number"/>
<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-xp" type="text" name="data.competenceByCategory.generale[{{key}}].data.xp" value="{{comp.data.xp}}" data-dtype="number"/>
</li>
{{/each}}

View File

@ -0,0 +1,67 @@
<form class="skill-roll-dialog">
<h2 class="compdialog" id="compdialogTitle"></h2>
<div class="form-group">
<label for="categorie">Caractéristique </label>
<select name="carac" id="carac" data-dtype="String">
{{#select carac}}
{{#each carac as |caracitem key|}}
<option value={{key}}>{{caracitem.label}}</option>
{{/each}}
{{/select}}
</select>
</div>
<div class="form-group">
<label for="categorie">Bonus/Malus</label>
<select name="bonusmalus" id="bonusmalus" data-dtype="number">
{{#select bonusmalus}}
{{#each bonusmalusTable as |bmvalue key|}}
<option value={{bmvalue}}>{{bmvalue}}</option>
{{/each}}
{{/select}}
</select>
</div>
<div class="form-group">
<label>Résultat : </label><label id="roll-param">10 / 0</label>
</div>
<div id="resolutionTable">
</div>
</form>
<script>
// Get the rollData stuff
var rollData = CONFIG.currentRollData;
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 );
}
// 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>