Fix creature again

This commit is contained in:
sladecraven 2020-09-20 21:45:46 +02:00
parent ad8354217c
commit 5e7a5f4ccb
4 changed files with 179 additions and 185 deletions

View File

@ -6,7 +6,7 @@
import { RdDUtility } from "./rdd-utility.js"; import { RdDUtility } from "./rdd-utility.js";
const creatureCarac = [ "taille", "constitution", "force", "perception", "volonte", "reve" ] /* -------------------------------------------- */
export class RdDActorCreatureSheet extends ActorSheet { export class RdDActorCreatureSheet extends ActorSheet {
/** @override */ /** @override */
@ -55,6 +55,7 @@ export class RdDActorCreatureSheet extends ActorSheet {
data.data.competencecreature = data.itemsByType["competencecreature"]; data.data.competencecreature = data.itemsByType["competencecreature"];
console.log("DATA:", data);
return data; return data;
} }

View File

@ -5,6 +5,7 @@
import { RdDUtility } from "./rdd-utility.js"; import { RdDUtility } from "./rdd-utility.js";
/* -------------------------------------------- */
export class RdDActorSheet extends ActorSheet { export class RdDActorSheet extends ActorSheet {
/** @override */ /** @override */
@ -20,7 +21,6 @@ export class RdDActorSheet extends ActorSheet {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_checkNull(items) { _checkNull(items) {
if (items && items.length) { if (items && items.length) {
return items; return items;
@ -29,7 +29,6 @@ export class RdDActorSheet extends ActorSheet {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
getData() { getData() {
let data = super.getData(); let data = super.getData();
@ -102,7 +101,6 @@ export class RdDActorSheet extends ActorSheet {
data.data.nbLegeres = this.actor.GetNumberBlessures(data.data.blessures.legeres.liste ); data.data.nbLegeres = this.actor.GetNumberBlessures(data.data.blessures.legeres.liste );
data.data.nbGraves = this.actor.GetNumberBlessures(data.data.blessures.graves.liste ); data.data.nbGraves = this.actor.GetNumberBlessures(data.data.blessures.graves.liste );
data.data.nbCritiques = this.actor.GetNumberBlessures(data.data.blessures.critiques.liste ); data.data.nbCritiques = this.actor.GetNumberBlessures(data.data.blessures.critiques.liste );
console.log( data.data.compteurs );
// low is normal, this the base used to compute the grid. // low is normal, this the base used to compute the grid.
data.data.fatigueHTML = "<table class='table-fatigue'>" + RdDUtility.makeHTMLfatigueMatrix( data.data.sante.fatigue.value, data.data.sante.endurance.max ).html() + "</table>"; data.data.fatigueHTML = "<table class='table-fatigue'>" + RdDUtility.makeHTMLfatigueMatrix( data.data.sante.fatigue.value, data.data.sante.endurance.max ).html() + "</table>";

View File

@ -2,7 +2,7 @@
"name": "foundryvtt-reve-de-dragon", "name": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon", "title": "Rêve de Dragon",
"description": "Rêve de Dragon RPG for FoundryVTT", "description": "Rêve de Dragon RPG for FoundryVTT",
"version": "0.9.13", "version": "0.9.14",
"minimumCoreVersion": "0.6.0", "minimumCoreVersion": "0.6.0",
"compatibleCoreVersion": "0.6.6", "compatibleCoreVersion": "0.6.6",
"templateVersion": 37, "templateVersion": 37,

View File

@ -2,9 +2,9 @@
{{!-- Sheet Header --}} {{!-- Sheet Header --}}
<header class="sheet-header"> <header class="sheet-header">
<img class="profile-img" src="{{actor.img}}" data-edit="img" title="{{actor.name}}" height="100" width="100"/> <img class="profile-img" src="{{actor.img}}" data-edit="img" title="{{actor.name}}" height="100" width="100" />
<div class="header-fields"> <div class="header-fields">
<h1 class="charname"><input name="name" type="text" value="{{actor.name}}" placeholder="Name"/></h1> <h1 class="charname"><input name="name" type="text" value="{{actor.name}}" placeholder="Name" /></h1>
<div class="flexrow"> <div class="flexrow">
<div class="flexrow"> <div class="flexrow">
<div class="flex-group-center">Blessures légères : {{data.nbLegeres}}</div> <div class="flex-group-center">Blessures légères : {{data.nbLegeres}}</div>
@ -36,41 +36,50 @@
{{#if carac.isTaille}} {{#if carac.isTaille}}
<span class="carac-label flexrow" name="data.carac.{{key}}.label">{{carac.label}}</span> <span class="carac-label flexrow" name="data.carac.{{key}}.label">{{carac.label}}</span>
{{else}} {{else}}
<span class="carac-label flexrow" name="data.carac.{{key}}.label"><a name={{key}}>{{carac.label}}</a></span> <span class="carac-label flexrow" name="data.carac.{{key}}.label"><a
name={{key}}>{{carac.label}}</a></span>
{{/if}} {{/if}}
<input class="competence-value flexrow" type="text" name="data.carac.{{key}}.value" value="{{carac.value}}" data-dtype="{{carac.type}}"/> <input class="competence-value flexrow" type="text" name="data.carac.{{key}}.value"
value="{{carac.value}}" data-dtype="{{carac.type}}" />
</li> </li>
{{/each}} {{/each}}
<li class="competence flexrow"> <li class="competence flexrow">
<span class="carac-label flexrow" name="carac-total">Total Caractéristiques </span> <span class="carac-label flexrow" name="carac-total">Total Caractéristiques</span>
<span class="competence-value flexrow" name="carac-total-value">{{data.caracSum}} </span> <span class="competence-value flexrow" name="carac-total-value">{{data.caracSum}}</span>
</li> </li>
</ol> </ol>
</div> </div>
<div class="flex-group-left flexcol" > <div class="flex-group-left flexcol">
<ol class="carac-list"> <ol class="carac-list">
{{#each data.attributs as |attr key|}} {{#each data.attributs as |attr key|}}
<li class="competence flexrow" data-attribute="{{key}}"> <li class="competence flexrow" data-attribute="{{key}}">
<span class="carac-label flexrow" name="data.attributs.{{key}}.label">{{attr.label}} : </span> <span class="carac-label flexrow" name="data.attributs.{{key}}.label">{{attr.label}} : </span>
<span><input class="attribut-value flexrow" type="text" name="data.attributs.{{key}}.value" value="{{attr.value}}" data-dtype="{{attr.type}}"/></span> <span><input class="attribut-value flexrow" type="text" name="data.attributs.{{key}}.value"
value="{{attr.value}}" data-dtype="{{attr.type}}" /></span>
</li> </li>
{{/each}} {{/each}}
<li class="competence flexrow" data-attribute="vie"> <li class="competence flexrow" data-attribute="vie">
<span class="competence-label flexrow" name="data.sante.vie.label">Vie : </span> <span class="competence-label flexrow" name="data.sante.vie.label">Vie : </span>
<span><input class="sante-value flexrow" type="text" name="data.sante.vie.value" value="{{data.sante.vie.value}}" data-dtype="Number"/></span><span>/ </span> <span><input class="sante-value flexrow" type="text" name="data.sante.vie.value"
<span><input class="sante-value flexrow" type="text" name="data.sante.vie.max" value="{{data.sante.vie.max}}" data-dtype="Number"/></span> value="{{data.sante.vie.value}}" data-dtype="Number" /></span><span>/ </span>
<span><input class="sante-value flexrow" type="text" name="data.sante.vie.max"
value="{{data.sante.vie.max}}" data-dtype="Number" /></span>
</li> </li>
<li class="competence flexrow" data-attribute="endurance"> <li class="competence flexrow" data-attribute="endurance">
<span class="competence-label flexrow" name="data.sante.endurance.label">Endurance : </span> <span class="competence-label flexrow" name="data.sante.endurance.label">Endurance : </span>
<span><input class="sante-value flexrow" type="text" name="data.sante.endurance.value" value="{{data.sante.endurance.value}}" data-dtype="Number"/></span><span>/ </span> <span><input class="sante-value flexrow" type="text" name="data.sante.endurance.value"
<span><input class="sante-value flexrow" type="text" name="data.sante.endurance.max" value="{{data.sante.endurance.max}}" data-dtype="Number"/></span> value="{{data.sante.endurance.value}}" data-dtype="Number" /></span><span>/ </span>
<span><input class="sante-value flexrow" type="text" name="data.sante.endurance.max"
value="{{data.sante.endurance.max}}" data-dtype="Number" /></span>
</li> </li>
<li class="competence flexrow" data-attribute="sonne"> <li class="competence flexrow" data-attribute="sonne">
<span class="competence-label flexrow" name="data.sante.sonne.label">Sonné : </span> <span class="competence-label flexrow" name="data.sante.sonne.label">Sonné : </span>
<input class="resource-content" type="checkbox" name="data.sante.sonne.value" value="{{data.sante.sonne.value}}" {{#if data.sante.sonne.value}}checked{{/if}} /> <input class="resource-content" type="checkbox" name="data.sante.sonne.value"
value="{{data.sante.sonne.value}}" {{#if data.sante.sonne.value}}checked{{/if}} />
</li> </li>
<li class="competence flexrow" data-attribute="etat"> <li class="competence flexrow" data-attribute="etat">
<span class="competence-label flexrow" name="data.compteurs.etat.label">Etat Général : </span> <span>{{data.compteurs.etat.value}}</span> <span class="competence-label flexrow" name="data.compteurs.etat.label">Etat Général : </span>
<span>{{data.compteurs.etat.value}}</span>
</li> </li>
</ol> </ol>
</div> </div>
@ -84,11 +93,17 @@
<ol class="item-list"> <ol class="item-list">
{{#each data.competencecreature as |comp key|}} {{#each data.competencecreature as |comp key|}}
<li class="item flexrow" data-item-id="{{comp._id}}"> <li class="item flexrow" data-item-id="{{comp._id}}">
<img class="sheet-competence-img" src="{{comp.img}}"/> <img class="sheet-competence-img" src="{{comp.img}}" />
<span class="competence-label" name="data.competencecreature[{{key}}].name"><a>{{comp.name}}</a></span> <span class="competence-label" name="data.competencecreature[{{key}}].name"><a>{{comp.name}}</a></span>
<input class="competence-value creature-carac" type="text" name="data.competencecreature[{{key}}].data.carac_value" compname="{{comp.name}}" value="{{comp.data.carac_value}}" data-dtype="number"/> <input class="competence-value creature-carac" type="text"
<input class="competence-value creature-niveau" type="text" name="data.competencecreature[{{key}}].data.niveau" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number"/> name="data.competencecreature[{{key}}].data.carac_value" compname="{{comp.name}}"
<input class="competence-value creature-dommages" type="text" name="data.competencecreature[{{key}}]].data.dommages" compname="{{comp.name}}" value="{{numberFormat comp.data.dommages decimals=0 sign=true}}" data-dtype="number"/> value="{{comp.data.carac_value}}" data-dtype="number" />
<input class="competence-value creature-niveau" type="text"
name="data.competencecreature[{{key}}].data.niveau" compname="{{comp.name}}"
value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number" />
<input class="competence-value creature-dommages" type="text"
name="data.competencecreature[{{key}}]].data.dommages" compname="{{comp.name}}"
value="{{numberFormat comp.data.dommages decimals=0 sign=true}}" data-dtype="number" />
<div class="item-controls"> <div class="item-controls">
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a> <a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a> <a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
@ -96,28 +111,8 @@
</li> </li>
{{/each}} {{/each}}
</ol> </ol>
</div> </div>
</div> </div>
{{!-- Combat Tab --}}
<div class="tab combat" data-group="primary" data-tab="combat">
<header class="competence-header flexrow">
<span class="competence-title">Armes</span>
<span class="competence-title">Niveau</span>
<span class="competence-title">XP</span>
</header>
<ol class="item-list">
{{#each data.armes as |arme key|}}
<li class="item flexrow" data-item-id="{{arme._id}}">
<span class="arme-label" name="data.armes[{{key}}].name"><a>{{arme.name}}</a></span>
<span class="competence-label" name="data.armes[{{key}}].data.competence">{{arme.data.competence}}</span>
<span class="competence-label" name="data.armes[{{key}}].data.niveau">{{numberFormat arme.data.niveau decimals=0 sign=true}}</span>
<span class="competence-label" name="data.armes[{{key}}].data.dommages">{{numberFormat arme.data.dommages decimals=0 sign=true}}</span>
</li>
{{/each}}
</ol>
</div> </div>
{{!-- blessures Tab --}} {{!-- blessures Tab --}}
@ -125,36 +120,55 @@
<span class="blessures-title">Blessures Légeres :</span> <span class="blessures-title">Blessures Légeres :</span>
<div class="blessure-data"> <div class="blessure-data">
{{#each data.blessures.legeres.liste as |bless key|}} {{#each data.blessures.legeres.liste as |bless key|}}
<li class="item flexrow blessure-data" data-blessure-type="legere" data-attribute={{key}} data-blessure-index="{{key}}"> <li class="item flexrow blessure-data" data-blessure-type="legere" data-attribute={{key}}
<a class="item-control blessure-control" title="Blessure Légère" data-blessure-active="{{bless.active}}">{{#if bless.active}}<i class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a> data-blessure-index="{{key}}">
Premiers soins <input class="blessures-soins" type="text" name='premiers_soins' data-dtype="number" value="{{this.premiers_soins}}"/> - <a class="item-control blessure-control" title="Blessure Légère"
Soins complets <input class="blessures-soins" type="text" name='soins_complets' data-dtype="number" value="{{this.soins_complets}}"/> - data-blessure-active="{{bless.active}}">{{#if bless.active}}<i class="fas fa-circle"></i>{{else}}<i
Jours <input class="blessures-soins" type="text" name='jours' data-dtype="number" value="{{this.jours}}"/> - class="fas fa-genderless"></i>{{/if}}</a>
Loc. <input class="blessures-soins" type="text" name='localisation' data-dtype="String" value="{{this.localisation}}"/> Premiers soins <input class="blessures-soins" type="text" name='premiers_soins' data-dtype="number"
value="{{this.premiers_soins}}" /> -
Soins complets <input class="blessures-soins" type="text" name='soins_complets' data-dtype="number"
value="{{this.soins_complets}}" /> -
Jours <input class="blessures-soins" type="text" name='jours' data-dtype="number" value="{{this.jours}}" />
-
Loc. <input class="blessures-soins" type="text" name='localisation' data-dtype="String"
value="{{this.localisation}}" />
</li> </li>
{{/each}} {{/each}}
</div> </div>
<span class="blessures-title">Blessures Graves :</span> <span class="blessures-title">Blessures Graves :</span>
<div> <div>
{{#each data.blessures.graves.liste as |bless key|}} {{#each data.blessures.graves.liste as |bless key|}}
<li class="item flexrow" data-blessure-type="grave" data-attribute={{key}} data-blessure-index="{{key}}" > <li class="item flexrow" data-blessure-type="grave" data-attribute={{key}} data-blessure-index="{{key}}">
<a class="item-control blessure-control" title="Blessure Grave" data-blessure-active="{{bless.active}}">{{#if bless.active}}<i class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a> <a class="item-control blessure-control" title="Blessure Grave"
Premiers soins <input class="blessures-soins" type="text" name="premiers_soins" data-dtype="number" value="{{bless.premiers_soins}}"/> - data-blessure-active="{{bless.active}}">{{#if bless.active}}<i class="fas fa-circle"></i>{{else}}<i
Soins complets <input class="blessures-soins" type="text" name="soins_complets" data-dtype="number" value="{{bless.soins_complets}}"/> - class="fas fa-genderless"></i>{{/if}}</a>
Jours <input class="blessures-soins" type="text" name="jours" data-dtype="number" value="{{bless.jours}}"/> - Premiers soins <input class="blessures-soins" type="text" name="premiers_soins" data-dtype="number"
Loc. <input class="blessures-soins" type="text" name="localisation" data-dtype="String" value="{{bless.localisation}}"/> value="{{bless.premiers_soins}}" /> -
Soins complets <input class="blessures-soins" type="text" name="soins_complets" data-dtype="number"
value="{{bless.soins_complets}}" /> -
Jours <input class="blessures-soins" type="text" name="jours" data-dtype="number" value="{{bless.jours}}" />
-
Loc. <input class="blessures-soins" type="text" name="localisation" data-dtype="String"
value="{{bless.localisation}}" />
</li> </li>
{{/each}} {{/each}}
</div> </div>
<span class="blessures-title">Blessure Critique :</span> <span class="blessures-title">Blessure Critique :</span>
<div> <div>
{{#each data.blessures.critiques.liste as |bless key|}} {{#each data.blessures.critiques.liste as |bless key|}}
<li class="item flexrow" data-blessure-type="critique" data-attribute={{key}} data-blessure-index="{{key}}" > <li class="item flexrow" data-blessure-type="critique" data-attribute={{key}} data-blessure-index="{{key}}">
<a class="item-control blessure-control" title="Blessure Critique" data-blessure-active="{{bless.active}}">{{#if bless.active}}<i class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a> <a class="item-control blessure-control" title="Blessure Critique"
Premiers soins <input class="blessures-soins" type="text" name="premiers_soins" data-dtype="number" value="{{bless.premiers_soins}}"/> - data-blessure-active="{{bless.active}}">{{#if bless.active}}<i class="fas fa-circle"></i>{{else}}<i
Soins complets <input class="blessures-soins" type="text" name="soins_complets" data-dtype="number" value="{{bless.soins_complets}}"/> - class="fas fa-genderless"></i>{{/if}}</a>
Jours <input class="blessures-soins" type="text" name="jours" data-dtype="number" value="{{bless.jours}}"/> - Premiers soins <input class="blessures-soins" type="text" name="premiers_soins" data-dtype="number"
Loc. <input class="blessures-soins" type="text" name="localisation" data-dtype="String" value="{{bless.localisation}}"/> value="{{bless.premiers_soins}}" /> -
Soins complets <input class="blessures-soins" type="text" name="soins_complets" data-dtype="number"
value="{{bless.soins_complets}}" /> -
Jours <input class="blessures-soins" type="text" name="jours" data-dtype="number" value="{{bless.jours}}" />
-
Loc. <input class="blessures-soins" type="text" name="localisation" data-dtype="String"
value="{{bless.localisation}}" />
</li> </li>
</li> </li>
{{/each}} {{/each}}
@ -162,32 +176,13 @@
</div> </div>
{{!-- Biography Tab --}} {{!-- Biography Tab --}}
<div class="tab biography" data-group="primary" data-tab="description" style="height:200px"> <div class="tab description" data-group="primary" data-tab="description" style="height:200px">
<div class="grid grid-2col">
<div class="flex-group-left flexcol competence-column">
<ol class="item-list">
<li class="item flexrow" ><span class="description-label">Sexe : </span><input class="description-value flexrow" type="text" name="data.sexe" value="{{data.sexe}}" data-dtype="String"/></li>
<li class="item flexrow" ><span class="description-label">Poids : </span><input class="description-value flexrow" type="text" name="data.poids" value="{{data.poids}}" data-dtype="String"/></li>
<li class="item flexrow" ><span class="description-label">Taille : </span><input class="description-value flexrow" type="text" name="data.taille" value="{{data.taille}}" data-dtype="String"/></li>
<li class="item flexrow" ><span class="description-label">Cheveux : </span><input class="description-value flexrow" type="text" name="data.cheveux" value="{{data.cheveux}}" data-dtype="String"/></li>
<li class="item flexrow" ><span class="description-label">Yeux : </span><input class="description-value flexrow" type="text" name="data.yeux" value="{{data.yeux}}" data-dtype="String"/></li>
</ol>
</div>
<div>
<ol class="item-list">
<li class="item flexrow" ><span class="description-label">Age : </span><input class="description-value flexrow" type="text" name="data.age" value="{{data.age}}" data-dtype="String"/></li>
<li class="item flexrow" ><span class="description-label">Heure de naissance : </span><input class="description-value flexrow" type="text" name="data.heure" value="{{data.heure}}" data-dtype="String"/></li>
<li class="item flexrow" ><span class="description-label">Beauté : </span><input class="description-value flexrow" type="text" name="data.beaute" value="{{data.beaute}}" data-dtype="String"/></li>
<li class="item flexrow" ><span class="description-label">Main directrice : </span><input class="description-value flexrow" type="text" name="data.main" value="{{data.main}}" data-dtype="String"/></li>
</ol>
</div>
</div>
<div class="form-group" style="height:200px"> <div class="form-group" style="height:200px">
{{editor content="data.biographie" target="data.biographie" button=true owner=owner editable=editable}} {{editor content="data.description" target="data.description" button=true owner=owner editable=editable}}
</div> </div>
</div> </div>
</div>
</section> </section>
</form> </form>