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] [project]
name=RdD name=RdD
base_path=/home/sigmar/work/foundryvtt/foundryvtt-reve-de-dragon base_path=/home/sigmar/work/foundryvtt/foundryvtt-reve-de-dragon
description=
[long line marker] [long line marker]
long_line_behaviour=1 long_line_behaviour=1
long_line_column=72 long_line_column=72
[files] [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] [VTE]
last_dir=/home/sigmar last_dir=/home/sigmar

View File

@ -2,6 +2,9 @@
* Extend the basic ActorSheet with some very simple modifications * Extend the basic ActorSheet with some very simple modifications
* @extends {ActorSheet} * @extends {ActorSheet}
*/ */
import { RdDUtility } from "./rdd-utility.js";
export class RdDActorSheet extends ActorSheet { export class RdDActorSheet extends ActorSheet {
/** @override */ /** @override */
@ -18,6 +21,15 @@ export class RdDActorSheet extends ActorSheet {
/* -------------------------------------------- */ /* -------------------------------------------- */
_checkNull(items) {
if (items && items.length) {
return items;
}
return [];
}
/* -------------------------------------------- */
getData() { getData() {
let data = super.getData(); let data = super.getData();
@ -33,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 = [];
@ -76,6 +88,12 @@ export class RdDActorSheet extends ActorSheet {
li.slideUp(200, () => this.render(false)); 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. * Extend the base Actor entity by defining a custom roll data structure which is ideal for the Simple system.
* @extends {Actor} * @extends {Actor}
*/ */
import { RdDUtility } from "./rdd-utility.js";
export class RdDActor extends Actor { export class RdDActor extends Actor {
/* -------------------------------------------- */
prepareData() { prepareData() {
super.prepareData(); super.prepareData();
@ -22,6 +28,33 @@ export class RdDActor extends Actor {
} }
/* -------------------------------------------- */
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 */ /** @override */
getRollData() { getRollData() {
const data = super.getRollData(); const data = super.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 { RdDActor } from "./actor.js";
import { RdDItemSheet } from "./item-sheet.js"; import { RdDItemSheet } from "./item-sheet.js";
import { RdDActorSheet } from "./actor-sheet.js"; import { RdDActorSheet } from "./actor-sheet.js";
import { RdDUtility } from "./rdd-utility.js";
/* -------------------------------------------- */ /* -------------------------------------------- */
// Handlers management // 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/item-competence-sheet.html',
'systems/foundryvtt-reve-de-dragon/templates/competence-categorie.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-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); return loadTemplates(templatePaths);
@ -68,13 +70,4 @@ Hooks.once("init", async function() {
Items.unregisterSheet("core", ItemSheet); Items.unregisterSheet("core", ItemSheet);
Items.registerSheet("foundryvtt-reve-de-dragon", RdDItemSheet, {makeDefault: true}); 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, "version": 0.2,
"minimumCoreVersion": "0.5.7", "minimumCoreVersion": "0.5.7",
"compatibleCoreVersion": "0.5.7", "compatibleCoreVersion": "0.5.7",
"templateVersion": 4, "templateVersion": 5,
"author": "LeRatierBretonnien", "author": "LeRatierBretonnien",
"esmodules": ["module/simple.js"], "esmodules": ["module/simple.js"],
"styles": ["styles/simple.css"], "styles": ["styles/simple.css"],

View File

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

View File

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