Merge branch 'character-sheet-style' into 'v1.4'

Character sheet style - Align and sort skills

See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!247
This commit is contained in:
Leratier Bretonnien 2021-05-20 22:16:55 +00:00
commit 24a7aad9e5
6 changed files with 115 additions and 51 deletions

View File

@ -30,7 +30,8 @@ export class RdDActorSheet extends ActorSheet {
dragDrop: [{ dragSelector: ".item-list .item", dropSelector: null }], dragDrop: [{ dragSelector: ".item-list .item", dropSelector: null }],
editCaracComp: false, editCaracComp: false,
showCompNiveauBase: false, showCompNiveauBase: false,
montrerArchetype: false montrerArchetype: false,
hideControls: true
}); });
} }
@ -483,6 +484,10 @@ export class RdDActorSheet extends ActorSheet {
this.options.montrerArchetype = !this.options.montrerArchetype; this.options.montrerArchetype = !this.options.montrerArchetype;
this.render(true); this.render(true);
}); });
html.find('.lock-unlock-controls').click((event) => {console.log("CONTROLS",this.options.hideControls)
this.options.hideControls = !this.options.hideControls;
this.render(true);
});
// On pts de reve change // On pts de reve change
html.find('.pointsreve-value').change((event) => { html.find('.pointsreve-value').change((event) => {

View File

@ -220,6 +220,36 @@ export class RdDUtility {
Handlebars.registerHelper('caseTmr-type', coord => TMRUtility.getTMRType(coord)); Handlebars.registerHelper('caseTmr-type', coord => TMRUtility.getTMRType(coord));
Handlebars.registerHelper('typeTmr-name', coord => TMRUtility.typeTmrName(coord)); Handlebars.registerHelper('typeTmr-name', coord => TMRUtility.typeTmrName(coord));
Handlebars.registerHelper('equals', (a, b) => a == b); Handlebars.registerHelper('equals', (a, b) => a == b);
Handlebars.registerHelper('sortCompetence', competences => competences.sort((a, b) => {
if (a.name.startsWith("Survie") && b.name.startsWith("Survie")) {
if (a.name.includes("Cité")) return -1;
if (b.name.includes("Cité")) return 1;
if (a.name.includes("Extérieur")) return -1;
if (b.name.includes("Extérieur")) return 1;
return a.name.localeCompare(b.name);
}
if (a.data.categorie.startsWith("melee") && b.data.categorie.startsWith("melee")) {
if (a.name.includes("Corps")) return -1;
if (b.name.includes("Corps")) return 1;
if (a.name.includes("Dague")) return -1;
if (b.name.includes("Dague")) return 1;
if (a.name.includes("Esquive")) return -1;
if (b.name.includes("Esquive")) return 1;
return a.name.localeCompare(b.name);
}
if (a.name.startsWith("Voie") && b.name.startsWith("Voie")) {
if (a.name.includes("Oniros")) return -1;
if (b.name.includes("Oniros")) return 1;
if (a.name.includes("Hypnos")) return -1;
if (b.name.includes("Hypnos")) return 1;
if (a.name.includes("Narcos")) return -1;
if (b.name.includes("Narcos")) return 1;
if (a.name.includes("Thanatos")) return -1;
if (b.name.includes("Thanatos")) return 1;
return a.name.localeCompare(b.name);
}
return a.name.localeCompare(b.name);
}));
return loadTemplates(templatePaths); return loadTemplates(templatePaths);
} }

View File

@ -429,6 +429,13 @@ table {border: 1px solid #7a7971;}
text-align: right; text-align: right;
} }
.competence-list .item-controls {
display: contents !important;
}
.competence-list .item-controls.hidden-controls {
display: none !important;
}
.rdddialog .dialog-roll-sort s{ .rdddialog .dialog-roll-sort s{
width: 600px; width: 600px;
height: 430px; height: 430px;
@ -612,8 +619,27 @@ section.sheet-body:after {
} }
.window-app.sheet .window-content .carac-value, .window-app.sheet .window-content .competence-xp { .window-app.sheet .window-content .carac-value, .window-app.sheet .window-content .competence-xp {
flex-grow: 0;
margin: 0.05rem; margin: 0.05rem;
flex-basis: 3rem; flex-basis: 2rem;
text-align: center;
}
.window-app.sheet .window-content .carac-value, .window-app.sheet .window-content .competence-value {
flex-grow: 0;
margin: 0.05rem;
flex-basis: 2rem;
text-align: center;
}
.window-app.sheet .window-content .carac-value, .window-app.sheet .window-content .competence-archetype {
flex-grow: 0;
margin: 0.05rem;
flex-basis: 2rem;
text-align: center;
}
.window-app.sheet .window-content .carac-value, .window-app.sheet .window-content .competence-xp-sort {
flex-grow: 0;
margin: 0.05rem;
flex-basis: 2rem;
text-align: center; text-align: center;
} }
@ -658,7 +684,7 @@ ul, li {
border-radius: 0.25rem; border-radius: 0.25rem;
padding: 0.125rem; padding: 0.125rem;
flex: 1 1 5rem; flex: 1 1 5rem;
background: rgba(195, 152, 22, 0.5); background: rgba(195, 152, 22, 0.5) !important;
} }
.blessures-list ul { .blessures-list ul {
@ -684,6 +710,8 @@ ul, li {
border-radius: 0.25rem; border-radius: 0.25rem;
padding: 0.125rem; padding: 0.125rem;
flex: 1 1 5rem; flex: 1 1 5rem;
display: flex !important;
align-items: baseline !important;
} }
.table-row { .table-row {
@ -734,6 +762,7 @@ ul, li {
height: 24px; height: 24px;
flex-grow: 0; flex-grow: 0;
margin-right: 0.25rem; margin-right: 0.25rem;
vertical-align: bottom;
} }
.competence-column { .competence-column {
flex-direction: column; flex-direction: column;

View File

@ -1,7 +1,7 @@
<header class="competence-header flexrow"> <header class="competence-header flexrow">
<span class="competence-title">{{categorie}}</span> <span class="competence-title">{{categorie}}</span>
</header> </header>
<ul class="item-list alterne-list"> <ul class="item-list alterne-list competence-list">
{{#each competences as |comp key|}} {{#each competences as |comp key|}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-competence-partial.html" comp}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-competence-partial.html" comp}}
{{/each}} {{/each}}

View File

@ -1,34 +1,31 @@
{{#if visible}} {{#if visible}}
{{#if data.isLevelUp}} <li class="item flexrow list-item {{#if data.isLevelUp}}xp-level-up tooltip{{/if}}" data-item-id="{{_id}}">
<li class="item flexrow xp-level-up" data-item-id="{{_id}}"> <a class="competence-label" name="{{name}}">
{{else}} <img class="sheet-competence-img" src="{{img}}"/>
<li class="item flexrow list-item" data-item-id="{{_id}}"> <span class="competence-label">{{name}}</span>
{{/if}} </a>
<a class="competence-label" name="{{name}}"> <input class="competence-value" type="text" compname="{{name}}"
<img class="sheet-competence-img" src="{{img}}" /> value="{{numberFormat data.niveau decimals=0 sign=true}}" data-dtype="number"
{{#if data.isLevelUp}} {{#unless @root.options.editCaracComp}}disabled{{/unless}} />
<span class="competence-label tooltip"> <input class="competence-xp" type="text" compname="{{name}}"
<span class="tooltiptext ttt-xp"> value="{{numberFormat data.xp decimals=0 sign=false}}" data-dtype="number"
Vous pouvez dépenser {{data.xpNext}} points d'Experience pour augmenter de 1 votre compétence {{name}} {{#unless @root.options.editCaracComp}}disabled{{/unless}} />
</span> {{#if (eq data.categorie 'draconic')}}
{{name}} <input class="competence-xp-sort" type="text" compname="{{name}}"
</span> value="{{numberFormat data.xp_sort decimals=0 sign=false}}" data-dtype="number"
{{else}} {{#unless @root.options.editCaracComp}}disabled{{/unless}}/>
<span class="competence-label">{{name}}</span>
{{/if}} {{/if}}
</a> {{#if @root.options.montrerArchetype}}
<input class="competence-value" type="text" compname="{{name}}" value="{{numberFormat data.niveau decimals=0 sign=true}}" data-dtype="number" {{#unless @root.options.editCaracComp}}disabled{{/unless}} /> <input class="competence-archetype" type="text" compname="{{name}}"
<input class="competence-xp" type="text" compname="{{name}}" value="{{numberFormat data.xp decimals=0 sign=false}}" data-dtype="number" {{#unless @root.options.editCaracComp}}disabled{{/unless}} /> value="{{numberFormat data.niveau_archetype decimals=0 sign=true}}" data-dtype="number"
{{#if (eq data.categorie 'draconic')}} {{#unless @root.options.editCaracComp}}disabled{{/unless}} />
<input class="competence-xp-sort" type="text" compname="{{name}}" value="{{numberFormat data.xp_sort decimals=0 sign=false}}" data-dtype="number" {{#unless @root.options.editCaracComp}}disabled{{/unless}}/> {{/if}}
{{/if}} {{#if data.isLevelUp}}
<div class="item-controls"> <span class="tooltiptext ttt-xp">Vous pouvez dépenser {{data.xpNext}} points d'Experience pour augmenter de 1 votre compétence {{name}}</span>
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a> {{/if}}
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a> <div class="item-controls {{#if @root.options.hideControls}}hidden-controls{{/if}}">
</div> <a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
{{#if @root.options.montrerArchetype}} <a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
<input class="competence-archetype" type="text" compname="{{name}}" </div>
value="{{numberFormat data.niveau_archetype decimals=0 sign=true}}" data-dtype="number" {{#unless @root.options.editCaracComp}}disabled{{/unless}} /> </li>
{{/if}}
</li>
{{/if}} {{/if}}

View File

@ -156,7 +156,7 @@
</div> </div>
<div class="flex-group-left flexcol" > <div class="flex-group-left flexcol" >
<ul class="carac-list"> <ul class="carac-list">
<li class="competence flexrow list-item"> <li class="competence flexrow list-item">
<span class="competence-label flexrow" name="beaute">Beauté : <span class="competence-label flexrow" name="beaute">Beauté :
<input class="description-value" type="text" name="data.beaute" value="{{data.beaute}}" data-dtype="String" {{#unless @root.options.editCaracComp}}disabled{{/unless}}/> <input class="description-value" type="text" name="data.beaute" value="{{data.beaute}}" data-dtype="String" {{#unless @root.options.editCaracComp}}disabled{{/unless}}/>
</span> </span>
@ -230,21 +230,24 @@
<span><a id="show-hide-archetype"><img class="small-button-container" <span><a id="show-hide-archetype"><img class="small-button-container"
src="systems/foundryvtt-reve-de-dragon/icons/{{#if options.montrerArchetype}}no-filter.svg{{else}}filter.svg{{/if}}" alt="filter/montrer l'archétype" src="systems/foundryvtt-reve-de-dragon/icons/{{#if options.montrerArchetype}}no-filter.svg{{else}}filter.svg{{/if}}" alt="filter/montrer l'archétype"
>{{#if options.montrerArchetype}}Masquer l'archétype{{else}}Voir l'archétype{{/if}}</a></span> >{{#if options.montrerArchetype}}Masquer l'archétype{{else}}Voir l'archétype{{/if}}</a></span>
<span><a class="lock-unlock-controls">i class="fas fa-lock{{#if options.hideControls}}-open{{/if}}"></i>
{{#if options.hideControls}}Voir les contrôles{{else}}Masquer les contrôles{{/if}}
</a></span>
</div> </div>
<div class="grid grid-2col"> <div class="grid grid-2col">
<div class="flex-group-left flexcol competence-column"> <div class="flex-group-left flexcol competence-column">
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=competenceByCategory.generale categorie="Compétences générales"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(sortCompetence competenceByCategory.generale) categorie="Compétences générales"}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=competenceByCategory.particuliere categorie="Compétences Particulières"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(sortCompetence competenceByCategory.particuliere) categorie="Compétences Particulières"}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=competenceByCategory.specialisee categorie="Compétences Spécialisées"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(sortCompetence competenceByCategory.specialisee) categorie="Compétences Spécialisées"}}
</div> </div>
<div class="flex-group-left flexcol competence-column"> <div class="flex-group-left flexcol competence-column">
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=competenceByCategory.melee categorie="Compétences de Mêlée"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(sortCompetence competenceByCategory.melee) categorie="Compétences de Mêlée"}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=competenceByCategory.tir categorie="Compétences de Tir"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(sortCompetence competenceByCategory.tir) categorie="Compétences de Tir"}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=competenceByCategory.lancer categorie="Compétences de Lancer"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(sortCompetence competenceByCategory.lancer) categorie="Compétences de Lancer"}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=competenceByCategory.connaissance categorie="Connaissances"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(sortCompetence competenceByCategory.connaissance) categorie="Connaissances"}}
{{#if (or data.attributs.hautrevant.value options.montrerArchetype)}} {{#if (or data.attributs.hautrevant.value options.montrerArchetype)}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=competenceByCategory.draconic categorie="Draconic"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(sortCompetence competenceByCategory.draconic) categorie="Draconic"}}
{{/if}} {{/if}}
<div> <div>