Skip to content

Commit

Permalink
Tormenta20 Proficiencies
Browse files Browse the repository at this point in the history
  • Loading branch information
mclemente committed Mar 22, 2022
1 parent 20a698f commit 2a776a1
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 23 deletions.
42 changes: 32 additions & 10 deletions module/SystemProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -1107,11 +1107,24 @@ export class swadeProvider extends SystemProvider {
}

export class tormenta20Provider extends SystemProvider {
constructor(id) {
super(id);
Handlebars.registerHelper("partyOverviewGetSkillList", function (skill, actors, opt) {
return actors.map((actor) => {
if (!isNaN(actor.pericias[skill]?.value))
return {
...actor.pericias[skill],
};
return {};
});
});
}

get tabs() {
return {
// languages: { id: "idiomas", visible: true, localization: "Idiomas" },
currencies: { id: "dinheiro", visible: true, localization: "Dinheiro" },
// proficiencies: { id: "pericias", visible: true, localization: "Perícias" },
proficiencies: { id: "pericias", visible: true, localization: "Perícias" },
};
}

Expand Down Expand Up @@ -1162,6 +1175,12 @@ export class tormenta20Provider extends SystemProvider {
delete pericias.fort;
delete pericias.refl;
delete pericias.vont;
delete pericias.defe;
for (let pericia in pericias) {
pericias[pericia] = {
value: data.pericias[pericia].value,
};
}
return pericias;
}
getSpeed(data) {
Expand Down Expand Up @@ -1198,7 +1217,8 @@ export class tormenta20Provider extends SystemProvider {
pm: this.getManaPoints(data),
atributos: data.atributos,
defesa: data.attributes.defesa.value,
pericias: data.pericias,
// pericias: data.pericias,
pericias: this.getPericias(data),
// languages: data.traits.languages ? data.traits.languages.value.map((code) => CONFIG.DND5E.languages[code]) : [],
// alignment: data.details.alignment,
dinheiro: data.dinheiro,
Expand Down Expand Up @@ -1228,17 +1248,19 @@ export class tormenta20Provider extends SystemProvider {
}
);
let totalPartyGP = actors.reduce((totalGP, actor) => totalGP + parseFloat(actor.dinheiroTotal), 0).toFixed(2);
// let pericias = foundry.utils.deepClone(CONFIG.T20.pericias);
// delete pericias.luta;
// delete pericias.pont;
// delete pericias.fort;
// delete pericias.refl;
// delete pericias.vont;
// delete pericias.ofic;
let pericias = foundry.utils.deepClone(CONFIG.T20.pericias);
delete pericias.luta;
delete pericias.pont;
delete pericias.fort;
delete pericias.refl;
delete pericias.vont;
delete pericias.ofic;
delete pericias.defe;
delete pericias.ocul;
return [
actors,
{
// pericias: pericias,
pericias: pericias,
totalCurrency: totalCurrency,
totalPartyGP: totalPartyGP,
},
Expand Down
3 changes: 2 additions & 1 deletion style/party-overview.css
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ button.party-overview-button:not(.wfrp4e) {

.party-overview-window.archmage .proficiencies.tab .header .num,
.party-overview-window.dnd5e .proficiencies.tab .header .num,
.party-overview-window.pf2e .proficiencies.tab .header .num {
.party-overview-window.pf2e .proficiencies.tab .header .num,
.party-overview-window.tormenta20 .proficiencies.tab .header .num {
flex: 1;
}

Expand Down
28 changes: 16 additions & 12 deletions templates/tormenta20.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -69,27 +69,31 @@
</div>

<!-- Proficencies-->
<!--
<div class="tab" data-tab="pericias" data-group="party">
<div class="tab proficiencies" data-tab="pericias" data-group="party">
<div class="table-row header">
{{> "modules/party-overview/templates/parts/FilterButton.html"}}
<div class="text">{{localize "party-overview.NAME"}}</div>
{{#each pericias as | s | }}
<div class="num" style="flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis">{{s}}</div>
{{#each actors as | actor | }}
{{> "modules/party-overview/templates/parts/ToggleVisibilityButton.html" actor=actor}}
<div class="num party-overview-ellipsis party-overview-ellipsis-no-border" title="{{ actor.shortestName }}">
{{ actor.shortestName }}
</div>
{{/each}}
</div>

{{#each actors as | actor | }}

{{#each pericias as | value key | }}
<div class="table-row">
{{> "modules/party-overview/templates/parts/ToggleVisibilityButton.html" actor=actor}}
<div class="text">{{ actor.shortestName }}</div>
{{#each actor.pericias as | skill| }}
<div class="num" style="flex: 1">{{skill.value}}</div>
{{/each}}
</div>
<div></div>
<div class="text">{{localize value}}</div>
{{#each (partyOverviewGetSkillList key ../actors)}}
<div class="num" style="flex: 1;">
{{numberFormat this.value decimals=0 sign=true}}
</div>
{{/each}}
</div>
{{/each}}
</div>
-->

</section>
</div>

0 comments on commit 2a776a1

Please sign in to comment.