Montrer/cacher l'archétype
This commit is contained in:
parent
3211c30519
commit
0072861c3f
@ -20,7 +20,8 @@ export class RdDActorSheet extends ActorSheet {
|
||||
tabs: [{navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac"}],
|
||||
dragDrop: [{dragSelector: ".item-list .item", dropSelector: null}],
|
||||
editCaracComp: false,
|
||||
cacherCompetencesNiveauBase: false,
|
||||
montrerCompetencesNiveauBase: false,
|
||||
montrerArchetype: false
|
||||
});
|
||||
}
|
||||
|
||||
@ -28,17 +29,13 @@ export class RdDActorSheet extends ActorSheet {
|
||||
getData() {
|
||||
let data = super.getData();
|
||||
|
||||
// Gestion du lock/unlock des zones éditables (carac+compétences)
|
||||
data.data.editCaracComp = this.options.editCaracComp;
|
||||
data.data.lockUnlockText = (this.options.editCaracComp) ? "Bloquer" : "Débloquer";
|
||||
data.data.lockUnlockIcon = (this.options.editCaracComp) ? "unlocked.svg" : "locked.svg";
|
||||
// Gestion de l'affichage total/partiel des compétences
|
||||
data.data.cacherCompetencesNiveauBase = this.options.cacherCompetencesNiveauBase;
|
||||
data.data.showHideCompetenceText = (this.options.cacherCompetencesNiveauBase) ? "Montrer tout" : "Filtrer" ;
|
||||
data.data.showHideCompetenceIcon = (this.options.cacherCompetencesNiveauBase) ? "no-filter.svg" : "filter.svg";
|
||||
data.data.montrerCompetencesNiveauBase = this.options.montrerCompetencesNiveauBase;
|
||||
data.data.montrerArchetype = this.options.montrerArchetype;
|
||||
|
||||
let compCategorieNiveau = RdDUtility.getLevelCategory(); // recup catégorie
|
||||
data.itemsByType = RdDUtility.buildItemsClassification(data.items);
|
||||
|
||||
// Competence per category
|
||||
data.competenceByCategory = {};
|
||||
let competenceXPTotal = 0;
|
||||
@ -54,7 +51,7 @@ export class RdDActorSheet extends ActorSheet {
|
||||
if (!RdDUtility.isTronc( item.name ) ) // Ignorer les compétences 'troncs' à ce stade
|
||||
competenceXPTotal += RdDUtility.computeCompetenceXPCost(item);
|
||||
item.data.afficherCompetence = true;
|
||||
if ( data.data.cacherCompetencesNiveauBase && (Number(item.data.niveau) == Number(compCategorieNiveau[item.data.categorie]) ) ) {
|
||||
if ( data.data.montrerCompetencesNiveauBase && (Number(item.data.niveau) == Number(compCategorieNiveau[item.data.categorie]) ) ) {
|
||||
item.data.afficherCompetence = false;
|
||||
}
|
||||
list.push(item);
|
||||
@ -170,31 +167,6 @@ export class RdDActorSheet extends ActorSheet {
|
||||
d.render(true);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
afficheResumeArchetype() {
|
||||
let levelCategory = RdDUtility.getLevelCategory();
|
||||
let labelCategory = RdDUtility.getLabelCategory();
|
||||
let contentHTML = "";
|
||||
for (let compCategory in this.competenceByCategory) {
|
||||
console.log(">>>>", compCategory);
|
||||
contentHTML += "<br><b>" + labelCategory[compCategory] + "</b>";
|
||||
for (let comp of this.competenceByCategory[compCategory]) {
|
||||
if ( !comp.data.niveau_archetype ) comp.data.niveau_archetype = levelCategory[compCategory];
|
||||
contentHTML += "<br>" + comp.name + " : " + comp.data.niveau_archetype;
|
||||
}
|
||||
}
|
||||
let dialogData = {
|
||||
content: contentHTML,
|
||||
buttons: {
|
||||
one: {
|
||||
icon: '<i class="fas fa-check"></i>',
|
||||
label: "Fermer"
|
||||
}
|
||||
}
|
||||
}
|
||||
new Dialog( dialogData ).render(true);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async createEmptyTache( ) {
|
||||
await this.actor.createOwnedItem( { name: 'Nouvelle tache', type: 'tache'}, { renderSheet: true } );
|
||||
@ -419,6 +391,11 @@ export class RdDActorSheet extends ActorSheet {
|
||||
let compName = event.currentTarget.attributes.compname.value;
|
||||
this.actor.updateCompetenceXP( compName, parseInt(event.target.value) );
|
||||
} );
|
||||
// On competence archetype change
|
||||
html.find('.competence-archetype').change((event) => {
|
||||
let compName = event.currentTarget.attributes.compname.value;
|
||||
this.actor.updateCompetenceArchetype( compName, parseInt(event.target.value) );
|
||||
} );
|
||||
}
|
||||
|
||||
// Gestion du bouton lock/unlock
|
||||
@ -426,8 +403,12 @@ export class RdDActorSheet extends ActorSheet {
|
||||
this.options.editCaracComp = !this.options.editCaracComp;
|
||||
this.render(true);
|
||||
});
|
||||
html.find('.show-hide-competences').click((event) => {
|
||||
this.options.cacherCompetencesNiveauBase = !this.options.cacherCompetencesNiveauBase;
|
||||
html.find('#show-hide-competences').click((event) => {
|
||||
this.options.montrerCompetencesNiveauBase = !this.options.montrerCompetencesNiveauBase;
|
||||
this.render(true);
|
||||
});
|
||||
html.find('#show-hide-archetype').click((event) => {
|
||||
this.options.montrerArchetype = !this.options.montrerArchetype;
|
||||
this.render(true);
|
||||
});
|
||||
|
||||
@ -458,12 +439,6 @@ export class RdDActorSheet extends ActorSheet {
|
||||
html.find('#ethylisme').change((event) => {
|
||||
this.actor.setEthylisme(parseInt(event.target.value) );
|
||||
} );
|
||||
|
||||
// Dialog d'archetype
|
||||
html.find("#affiche-archetype").click((event) => {
|
||||
this.afficheResumeArchetype()
|
||||
} );
|
||||
|
||||
html.find('#stress-test').click((event) => {
|
||||
this.actor.stressTest();
|
||||
this.render(true);
|
||||
|
@ -612,6 +612,18 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async updateCompetenceArchetype( compName, compValue )
|
||||
{
|
||||
let comp = this.getCompetence(compName);
|
||||
if ( comp ) {
|
||||
const update = {_id: comp._id, 'data.niveau_archetype': compValue };
|
||||
const updated = await this.updateEmbeddedEntity("OwnedItem", update); // Updates one EmbeddedEntity
|
||||
} else {
|
||||
console.log("Competence not found", compName);
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async updateCompteurValue( fieldName, fieldValue )
|
||||
{
|
||||
|
@ -98,7 +98,9 @@
|
||||
<div class="tab items" data-group="primary" data-tab="carac">
|
||||
<div class="grid grid-2col">
|
||||
<div class="flex-group-left flexcol">
|
||||
<span><a class="lock-unlock-sheet"><img class="small-button-container" src="systems/foundryvtt-reve-de-dragon/icons/{{data.lockUnlockIcon}}" alt="blocker/débloquer">{{data.lockUnlockText}}</a></span>
|
||||
<span><a class="lock-unlock-sheet"><img class="small-button-container"
|
||||
src="systems/foundryvtt-reve-de-dragon/icons/{{#if data.editCaracComp}}unlocked.svg{{else}}locked.svg{{/if}}" alt="blocker/débloquer"
|
||||
>{{#if data.editCaracComp}}Vérouiller{{else}}Dévérouiller{{/if}}</a></span>
|
||||
<ul class="carac-list alterne-list">
|
||||
{{#each data.carac as |carac key|}}
|
||||
<li class="competence flexrow list-item" data-attribute="{{key}}">
|
||||
@ -184,8 +186,15 @@
|
||||
{{!-- Compétences Tab --}}
|
||||
<div class="tab competences" data-group="primary" data-tab="competences">
|
||||
<div class="flexrow">
|
||||
<span><a class="lock-unlock-sheet"><img class="small-button-container" src="systems/foundryvtt-reve-de-dragon/icons/{{data.lockUnlockIcon}}" alt="blocker/débloquer">{{data.lockUnlockText}}</a></span>
|
||||
<span><a class="show-hide-competences"><img class="small-button-container" src="systems/foundryvtt-reve-de-dragon/icons/{{data.showHideCompetenceIcon}}" alt="filter/montrer tout">{{data.showHideCompetenceText}}</a></span>
|
||||
<span><a class="lock-unlock-sheet"><img class="small-button-container"
|
||||
src="systems/foundryvtt-reve-de-dragon/icons/{{#if data.editCaracComp}}unlocked.svg{{else}}locked.svg{{/if}}" alt="blocker/débloquer"
|
||||
>{{#if data.editCaracComp}}Vérouiller{{else}}Dévérouiller{{/if}}</a></span>
|
||||
<span><a id="show-hide-competences"><img class="small-button-container"
|
||||
src="systems/foundryvtt-reve-de-dragon/icons/{{#if data.montrerCompetencesNiveauBase}}no-filter.svg{{else}}filter.svg{{/if}}" alt="filter/montrer tout"
|
||||
>{{#if data.montrerCompetencesNiveauBase}}Montrer tout{{else}}Filtrer{{/if}}</a></span>
|
||||
<span><a id="show-hide-archetype"><img class="small-button-container"
|
||||
src="systems/foundryvtt-reve-de-dragon/icons/{{#if data.montrerArchetype}}no-filter.svg{{else}}filter.svg{{/if}}" alt="filter/montrer l'archétype"
|
||||
>{{#if data.montrerArchetype}}Masquer l'archétype{{else}}Voir l'archétype{{/if}}</a></span>
|
||||
</div>
|
||||
<div class="grid grid-2col">
|
||||
<div class="flex-group-left flexcol competence-column">
|
||||
@ -204,6 +213,9 @@
|
||||
<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>
|
||||
</div>
|
||||
{{#if ../data.montrerArchetype}}
|
||||
<input class="competence-archetype" type="text" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau_archetype decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
|
||||
{{/if}}
|
||||
</li>
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
@ -224,6 +236,9 @@
|
||||
<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>
|
||||
</div>
|
||||
{{#if ../data.montrerArchetype}}
|
||||
<input class="competence-archetype" type="text" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau_archetype decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
|
||||
{{/if}}
|
||||
</li>
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
@ -243,6 +258,9 @@
|
||||
<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>
|
||||
</div>
|
||||
{{#if ../data.montrerArchetype}}
|
||||
<input class="competence-archetype" type="text" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau_archetype decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
|
||||
{{/if}}
|
||||
</li>
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
@ -265,6 +283,9 @@
|
||||
<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>
|
||||
</div>
|
||||
{{#if ../data.montrerArchetype}}
|
||||
<input class="competence-archetype" type="text" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau_archetype decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
|
||||
{{/if}}
|
||||
</li>
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
@ -285,6 +306,9 @@
|
||||
<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>
|
||||
</div>
|
||||
{{#if ../data.montrerArchetype}}
|
||||
<input class="competence-archetype" type="text" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau_archetype decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
|
||||
{{/if}}
|
||||
</li>
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
@ -305,6 +329,9 @@
|
||||
<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>
|
||||
</div>
|
||||
{{#if ../data.montrerArchetype}}
|
||||
<input class="competence-archetype" type="text" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau_archetype decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
|
||||
{{/if}}
|
||||
</li>
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
@ -325,6 +352,9 @@
|
||||
<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>
|
||||
</div>
|
||||
{{#if ../data.montrerArchetype}}
|
||||
<input class="competence-archetype" type="text" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau_archetype decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
|
||||
{{/if}}
|
||||
</li>
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
@ -345,6 +375,9 @@
|
||||
<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>
|
||||
</div>
|
||||
{{#if ../data.montrerArchetype}}
|
||||
<input class="competence-archetype" type="text" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau_archetype decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
|
||||
{{/if}}
|
||||
</li>
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
@ -355,9 +388,6 @@
|
||||
<span class="generic-label">Total XP compétences</span>
|
||||
<span class="competence-value">{{data.competenceXPTotal}}</span>
|
||||
</li>
|
||||
<li class="item flexrow">
|
||||
<span class="generic-label"><a id="affiche-archetype">Voir l'Archetype</a></span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user