Increase support

This commit is contained in:
LeRatierBretonnien 2020-05-22 22:37:02 +02:00
parent d7971d8920
commit c144b2473c
8 changed files with 150 additions and 63 deletions

View File

@ -20,13 +20,29 @@ indent_mode=2
[project]
name=RdD
base_path=/home/sigmar/work/foundryvtt/foundryvtt-reve-de-dragon
description=
[long line marker]
long_line_behaviour=1
long_line_column=72
[files]
current_page=0
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
[VTE]
last_dir=/home/sigmar

View File

@ -2,6 +2,9 @@
* Extend the basic ActorSheet with some very simple modifications
* @extends {ActorSheet}
*/
import { RdDUtility } from "./rdd-utility.js";
export class RdDActorSheet extends ActorSheet {
/** @override */
@ -16,6 +19,15 @@ export class RdDActorSheet extends ActorSheet {
});
}
/* -------------------------------------------- */
_checkNull(items) {
if (items && items.length) {
return items;
}
return [];
}
/* -------------------------------------------- */
getData() {
@ -33,7 +45,7 @@ export class RdDActorSheet extends ActorSheet {
data.competenceByCategory = {};
if (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];
if (!list) {
list = [];
@ -76,6 +88,12 @@ export class RdDActorSheet extends ActorSheet {
li.slideUp(200, () => this.render(false));
});
// Roll Skill
html.find('.competence-label a').click((event) => {
let compName = event.currentTarget.text;
this.actor.rollCompetence( compName);
});
}
/* -------------------------------------------- */

View File

@ -2,7 +2,13 @@
* Extend the base Actor entity by defining a custom roll data structure which is ideal for the Simple system.
* @extends {Actor}
*/
import { RdDUtility } from "./rdd-utility.js";
export class RdDActor extends Actor {
/* -------------------------------------------- */
prepareData() {
super.prepareData();
@ -21,6 +27,33 @@ export class RdDActor extends Actor {
_prepareCharacterData(actorData) {
}
/* -------------------------------------------- */
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 =>
{
new Dialog(
{
title: "Test de compétence",
content: dlg,
buttons:
{
rollButton:
{
label: "Lancer"
//callback: html => dialogOptions.callback(html, roll)
}
},
default: "rollButton"
}).render(true);
});
}
/* -------------------------------------------- */
/** @override */
getRollData() {

17
module/rdd-utility.js Normal file
View File

@ -0,0 +1,17 @@
/* Common useful functions shared between objects */
export class RdDUtility {
static findCompetence(compList, compName)
{
for (const item of compList) {
if (item.name == compName) {
console.log("Found item !", item);
return item;
}
}
}
}

View File

@ -22,7 +22,7 @@ RDD.level_category = {
import { RdDActor } from "./actor.js";
import { RdDItemSheet } from "./item-sheet.js";
import { RdDActorSheet } from "./actor-sheet.js";
import { RdDUtility } from "./rdd-utility.js";
/* -------------------------------------------- */
// Handlers management
@ -34,7 +34,9 @@ const preloadHandlebarsTemplates = async function () {
'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'
'systems/foundryvtt-reve-de-dragon/templates/competence-base.html',
// Dialogs
'systems/foundryvtt-reve-de-dragon/templates/dialog-competence.html'
];
return loadTemplates(templatePaths);
@ -68,13 +70,4 @@ Hooks.once("init", async function() {
Items.unregisterSheet("core", ItemSheet);
Items.registerSheet("foundryvtt-reve-de-dragon", RdDItemSheet, {makeDefault: true});
// Register system settings
game.settings.register("foundryvtt-reve-de-dragon", "macroShorthand", {
name: "Shortened Macro Syntax",
hint: "Enable a shortened macro syntax which allows referencing attributes directly, for example @str instead of @attributes.str.value. Disable this setting if you need the ability to reference the full attribute model, for example @attributes.str.label.",
scope: "world",
type: Boolean,
default: true,
config: true
});
});

View File

@ -5,7 +5,7 @@
"version": 0.2,
"minimumCoreVersion": "0.5.7",
"compatibleCoreVersion": "0.5.7",
"templateVersion": 4,
"templateVersion": 5,
"author": "LeRatierBretonnien",
"esmodules": ["module/simple.js"],
"styles": ["styles/simple.css"],

View File

@ -126,27 +126,31 @@
"description": "",
"quantite": 1,
"encombrement": 0,
"equipe": false
"equipe": false,
"cout": 0
},
"arme": {
"description": "",
"quantite": 1,
"encombrement": 0,
"equipe": false,
"dommages": 0
"dommages": 0,
"cout": 0
},
"munition": {
"description": "",
"quantite": 1,
"encombrement": 0,
"equipe": false
"equipe": false,
"cout": 0
},
"armure": {
"description": "",
"quantite": 1,
"encombrement": 0,
"equipe": false,
"pa": 0
"pa": 0,
"cout": 0
},
"competence": {
"niveau": 0,
@ -165,23 +169,29 @@
"herbe": {
"description": "",
"niveau": 0,
"base": 0
"base": 0,
"cout": 0
},
"ingredient": {
"description": "",
"niveau": 0,
"encombrement": 0,
"base": 0
"base": 0,
"cout": 0
},
"livre": {
"description": "",
"auteur": "",
"difficulte": 0,
"taches": 0,
"encombrement": 0
"points_de_tache": 0,
"points_de_tache_courant": 0,
"encombrement": 0,
"cout": 0
},
"potion": {
"description": "",
"encombrement": 0
"encombrement": 0,
"cout": 0
}
}
}

View File

@ -33,16 +33,16 @@
{{!-- Carac Tab --}}
<div class="tab carac" data-group="primary" data-tab="carac">
<header class="carac-header flexrow">
<span class="carac-key">Nom</span>
<span class="carac-value">Valeur</span>
<span class="carac-label">XP</span>
<span class="carac-title">Nom</span>
<span class="carac-title">Valeur</span>
<span class="carac-title">XP</span>
</header>
<ol class="attributes-list">
<ol class="competence-list">
{{#each data.carac as |carac key|}}
<li class="attribute flexrow" data-attribute="{{key}}">
<span class="attribute-label" name="data.carac.{{key}}.label">{{carac.label}}</span>
<input class="attribute-value" type="text" name="data.carac.{{key}}.value" value="{{carac.value}}" data-dtype="{{carac.type}}"/>
<input class="attribute-xp" type="text" name="data.carac.{{key}}.xp" value="{{carac.xp}}" data-dtype="number"/>
<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>
@ -50,77 +50,77 @@
{{!-- Compétences Tab --}}
<div class="tab competences" data-group="primary" data-tab="competences">
<header class="competences-header flexrow">
<span class="competences-key">Compétences de base</span>
<span class="competences-value">Niveau</span>
<span class="competences-label">XP</span>
<header class="competence-header flexrow">
<span class="competence-title">Compétences de base</span>
<span class="competence-title">Niveau</span>
<span class="competence-title">XP</span>
</header>
<ol class="item-list">
{{#each data.competenceByCategory.generale as |comp key|}}
<li class="item flexrow" data-attribute="{{key}}">
<span class="attribute-label" name="data.competenceByCategory.generale[{{key}}].name">{{comp.name}}</span>
<input class="attribute-value" type="text" name="data.competenceByCategory.generale[{{key}}].data.niveau" value="{{comp.data.niveau}}" data-dtype="number"/>
<input class="attribute-xp" type="text" name="data.competenceByCategory.generale[{{key}}].data.xp" value="{{comp.data.xp}}" data-dtype="number"/>
<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-xp" type="text" name="data.competenceByCategory.generale[{{key}}].data.xp" value="{{comp.data.xp}}" data-dtype="number"/>
</li>
{{/each}}
</ol>
<header class="competences-header flexrow">
<span class="competences-key">Compétences Particulières</span>
<span class="competences-value">Niveau</span>
<span class="competences-label">XP</span>
<span class="competence-title">Compétences Particulières</span>
<span class="competence-title">Niveau</span>
<span class="competence-title">XP</span>
</header>
<ol class="item-list">
{{#each data.competenceByCategory.particuliere as |comp key|}}
<li class="item flexrow" data-attribute="{{key}}">
<span class="attribute-label" name="data.competenceByCategory.particuliere[{{key}}].name">{{comp.name}}</span>
<input class="attribute-value" type="text" name="data.competenceByCategory.particuliere[{{key}}].data.niveau" value="{{comp.data.niveau}}" data-dtype="number"/>
<input class="attribute-xp" type="text" name="data.competenceByCategory.particuliere[{{key}}].data.xp" value="{{comp.data.xp}}" data-dtype="number"/>
<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-xp" type="text" name="data.competenceByCategory.particuliere[{{key}}].data.xp" value="{{comp.data.xp}}" data-dtype="number"/>
</li>
{{/each}}
</ol>
<header class="competences-header flexrow">
<span class="competences-key">Compétences Spécialisées</span>
<span class="competences-value">Niveau</span>
<span class="competences-label">XP</span>
<span class="competence-title">Compétences Spécialisées</span>
<span class="competence-title">Niveau</span>
<span class="competence-title">XP</span>
</header>
<ol class="item-list">
{{#each data.competenceByCategory.specialisee as |comp key|}}
<li class="item flexrow" data-attribute="{{key}}">
<span class="attribute-label" name="data.competenceByCategory.specialisee[{{key}}].name">{{comp.name}}</span>
<input class="attribute-value" type="text" name="data.competenceByCategory.specialisee[{{key}}].data.niveau" value="{{comp.data.niveau}}" data-dtype="number"/>
<input class="attribute-xp" type="text" name="data.competenceByCategory.specialisee[{{key}}].data.xp" value="{{comp.data.xp}}" data-dtype="number"/>
<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-xp" type="text" name="data.competenceByCategory.specialisee[{{key}}].data.xp" value="{{comp.data.xp}}" data-dtype="number"/>
</li>
{{/each}}
</ol>
<header class="competences-header flexrow">
<span class="competences-key">Connaissances</span>
<span class="competences-value">Niveau</span>
<span class="competences-label">XP</span>
<header class="competence-header flexrow">
<span class="competence-title">Connaissances</span>
<span class="competence-title">Niveau</span>
<span class="competence-title">XP</span>
</header>
<ol class="item-list">
{{#each data.competenceByCategory.connaissance as |comp key|}}
<li class="item flexrow" data-attribute="{{key}}">
<span class="attribute-label" name="data.competenceByCategory.connaissance[{{key}}].name">{{comp.name}}</span>
<input class="attribute-value" type="text" name="data.competenceByCategory.connaissance[{{key}}].data.niveau" value="{{comp.data.niveau}}" data-dtype="number"/>
<input class="attribute-xp" type="text" name="data.competenceByCategory.connaissance[{{key}}].data.xp" value="{{comp.data.xp}}" data-dtype="number"/>
<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-xp" type="text" name="data.competenceByCategory.connaissance[{{key}}].data.xp" value="{{comp.data.xp}}" data-dtype="number"/>
</li>
{{/each}}
</ol>
<header class="competences-header flexrow">
<span class="competences-key">Draconic</span>
<span class="competences-value">Niveau</span>
<span class="competences-label">XP</span>
<span class="competence-title">Draconic</span>
<span class="competence-title">Niveau</span>
<span class="competence-title">XP</span>
</header>
<ol class="item-list">
{{#each data.competenceByCategory.draconic as |comp key|}}
<li class="item flexrow" data-attribute="{{key}}">
<span class="attribute-label" name="data.competenceByCategory.draconic[{{key}}].name">{{comp.name}}</span>
<input class="attribute-value" type="text" name="data.competenceByCategory.draconic[{{key}}].data.niveau" value="{{comp.data.niveau}}" data-dtype="number"/>
<input class="attribute-xp" type="text" name="data.competenceByCategory.draconic[{{key}}].data.xp" value="{{comp.data.xp}}" data-dtype="number"/>
<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-xp" type="text" name="data.competenceByCategory.draconic[{{key}}].data.xp" value="{{comp.data.xp}}" data-dtype="number"/>
</li>
{{/each}}
</ol>