Skip to content

Commit

Permalink
Added new weapons tab to wfrp
Browse files Browse the repository at this point in the history
  • Loading branch information
Robak132 committed May 1, 2023
1 parent 96dc9e0 commit ab8d95d
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 45 deletions.
26 changes: 25 additions & 1 deletion module/systemProviders/wfrp4eProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,19 @@ export class wfrp4eProvider extends SystemProvider {
return {
currencies: { id: "currencies", visible: true, localization: "Money" },
skills: { id: "skills", visible: true, localization: "Skills" },
talents: { id: "talents", visible: true, localization: "Talents" },
talents: { id: "talents", visible: true, localization: "Talents"},
equipment: { id: "equipment", visible: true, localization: "Trappings" },
};
}

get template() {
return "/modules/party-overview/templates/wfrp4e.hbs";
}

get width() {
return 700;
}

getCurrency(actor) {
const money = actor.getItemTypes("money").map(m => m.toObject());
const currency = {
Expand Down Expand Up @@ -85,6 +90,16 @@ export class wfrp4eProvider extends SystemProvider {
otherAdvanced: otherAdvanced
}
}
getWeapons(actor) {
let weapons = actor.getItemTypes("weapon")
.map(weapon => ({
name: weapon.name,
category: WFRP4E.weaponGroups[weapon.system.weaponGroup.value]
}))
weapons.sort((a,b) => a.name.localeCompare(b.name))

return weapons
}

getActorDetails(actor) {
const data = actor.system;
Expand All @@ -106,8 +121,17 @@ export class wfrp4eProvider extends SystemProvider {
max: data.status.corruption.max,
},
status: data.details.status.value,
encumbrance: {
value: data.status.encumbrance.current,
max: data.status.encumbrance.max,
},
exp: {
value: data.details.experience.total - data.details.experience.spent,
total: data.details.experience.total
},
skills: this.getSkills(actor),
talents: this.getTalents(actor),
weapons: this.getWeapons(actor),
currency: this.getCurrency(actor)
};
}
Expand Down
141 changes: 97 additions & 44 deletions templates/wfrp4e.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
<div class="num" title="{{localize "Wounds"}}"><i class="fas fa-heart"></i></div>
<div class="num" title="{{localize "Advantage"}}"><i class="fas fa-plus-circle"></i></div>
<div class="num" title="{{localize "Movement"}}"><i class="fas fa-shoe-prints"></i></div>
<div class="num" title="{{localize "Encumbrance"}}"><i class="fas fa-weight-hanging"></i></div>
<div class="num" title="{{localize "Corruption"}}"><i class="fas fa-gear"></i></div>
<div class="num" title="{{localize "Fortune"}}/{{localize "Fate"}}"><i class="fas fa-dice"></i></div>
<div class="num" title="{{localize "Resolve"}}/{{localize "Resilience"}}"><i class="fas fa-hand-fist"></i></div>
<div class="num" title="{{localize "Experience"}}"><i class="fas fa-star"></i></div>
</div>

{{#each actors as | actor | }}
Expand All @@ -20,9 +22,11 @@
<div class="num">{{ actor.wounds.value }}/{{ actor.wounds.max }}</div>
<div class="num">{{ actor.advantage }}</div>
<div class="num">{{ actor.movement }}</div>
<div class="num">{{ actor.encumbrance.value }}/{{ actor.corruption.max }}</div>
<div class="num">{{ actor.corruption.value }}/{{ actor.corruption.max }}</div>
<div class="num">{{ actor.fortune }}/{{ actor.fate }}</div>
<div class="num">{{ actor.resolve }}/{{ actor.resilience }}</div>
<div class="num">{{ actor.exp.value }}/{{ actor.exp.total }}</div>
</div>
{{/each}}
</div>
Expand Down Expand Up @@ -52,7 +56,7 @@
{{/each}}
<div class="table-row">
<div class="button"></div>
<div class="text">Total</div>
<div class="text"><b>Total</b></div>
<div class="num">{{totalCurrency.bp}}</div>
<div class="num">{{totalCurrency.ss}}</div>
<div class="num">{{totalCurrency.gc}}</div>
Expand All @@ -65,73 +69,122 @@
<div class="table-row header">
{{> "modules/party-overview/templates/parts/FilterButton.html"}}
<div class="text">{{localize "party-overview.NAME"}}</div>
<div class="text" style="flex-grow: 1;flex-basis: 80px">Melee & Ranged</div>
<div class="text" style="flex-grow: 1">Languages</div>
<div class="text" style="flex-grow: 1">Lore</div>
<div class="text" style="flex-grow: 1">Trade</div>
<div class="text">Other Basic</div>
<div class="text">Other Advanced</div>
{{#each actors as | actor | }}
{{> "modules/party-overview/templates/parts/ToggleVisibilityButton.html" actor=actor}}
<div class="text">{{actor.shortestName}}</div>
{{/each}}
</div>

<div class="table-row">
<div class="text"><b>Melee & Ranged</b></div>
{{#each actors as | actor | }}
<div class="text small">
{{#each actor.skills.meleeRanged as | skill | }}
{{skill.nameSpec}} {{skill.total}}<br>
{{/each}}
</div>
{{/each}}
</div>
<div class="table-row">
<div class="text"><b>Languages</b></div>
{{#each actors as | actor | }}
<div class="text small">
{{#each actor.skills.languages as | skill | }}
{{skill.nameSpec}} {{skill.total}}<br>
{{/each}}
</div>
{{/each}}
</div>
<div class="table-row">
<div class="text"><b>Lore</b></div>
{{#each actors as | actor | }}
<div class="text small">
{{#each actor.skills.lore as | skill | }}
{{skill.nameSpec}} {{skill.total}}<br>
{{/each}}
</div>
{{/each}}
</div>
<div class="table-row">
<div class="text"><b>Trade</b></div>
{{#each actors as | actor | }}
<div class="text small">
{{#each actor.skills.trade as | skill | }}
{{skill.nameSpec}} {{skill.total}}<br>
{{/each}}
</div>
{{/each}}
</div>
<div class="table-row">
<div class="text"><b>Other Basic</b></div>
{{#each actors as | actor | }}
<div class="text small">
{{#each actor.skills.otherBasic as | skill | }}
{{skill.name}} {{skill.total}}<br>
{{/each}}
</div>
{{/each}}
</div>
<div class="table-row">
<div class="text"><b>Other Advanced</b></div>
{{#each actors as | actor | }}
<div class="text small">
{{#each actor.skills.otherAdvanced as | skill | }}
{{skill.name}} {{skill.total}}<br>
{{/each}}
</div>
{{/each}}
</div>
</div>

<!-- Talents -->
<div class="tab" data-tab="talents" data-group="party">
<div class="table-row header">
{{> "modules/party-overview/templates/parts/FilterButton.html"}}
<div class="text" style="flex: 1">{{localize "party-overview.NAME"}}</div>
<div class="text" style="flex: 2">Talent</div>
<div class="text" style="flex: 3">Test</div>
</div>

{{#each actors as | actor | }}
<div class="table-row">
{{> "modules/party-overview/templates/parts/ToggleVisibilityButton.html" actor=actor}}
<div class="text">{{ actor.shortestName }}</div>
<div class="text small" style="flex-grow: 1;flex-basis: 80px">
{{#each actor.skills.meleeRanged as | skill | }}
{{skill.nameSpec}} {{skill.total}}<br>
<div class="text" style="flex: 1">{{ actor.shortestName }}</div>
<div class="text small" style="flex: 2">
{{#each actor.talents as | talent | }}
{{talent.name}}<br>
{{/each}}
</div>
<div class="text small" style="flex-grow: 1">
{{#each actor.skills.languages as | skill | }}
{{skill.nameSpec}} {{skill.total}}<br>
{{/each}}
</div>
<div class="text small" style="flex-grow: 1">
{{#each actor.skills.lore as | skill | }}
{{skill.nameSpec}} {{skill.total}}<br>
{{/each}}
</div>
<div class="text small" style="flex-grow: 1">
{{#each actor.skills.trade as | skill | }}
{{skill.nameSpec}} {{skill.total}}<br>
{{/each}}
</div>
<div class="text small">
{{#each actor.skills.otherBasic as | skill | }}
{{skill.name}} {{skill.total}}<br>
{{/each}}
</div>
<div class="text small">
{{#each actor.skills.otherAdvanced as | skill | }}
{{skill.name}} {{skill.total}}<br>
<div class="text small" style="flex: 3">
{{#each actor.talents as | talent | }}
{{talent.test}}<br>
{{/each}}
</div>
</div>
{{/each}}
</div>

<!-- Talents -->
<div class="tab" data-tab="talents" data-group="party">
<!-- Equipment -->
<div class="tab" data-tab="equipment" data-group="party">
<div class="table-row header">
{{> "modules/party-overview/templates/parts/FilterButton.html"}}
<div class="text">{{localize "party-overview.NAME"}}</div>
<div class="text">Name</div>
<div class="text">Test</div>
<div class="text">Broń</div>
<div class="text">Kategoria</div>
</div>

{{#each actors as | actor | }}
<div class="table-row">
{{> "modules/party-overview/templates/parts/ToggleVisibilityButton.html" actor=actor}}
<div class="text">{{ actor.shortestName }}</div>
<div class="text small">
{{#each actor.talents as | talents | }}
{{talents.name}}<br>
<div class="text">
{{#each actor.weapons as | weapon | }}
{{weapon.name}}<br>
{{/each}}
</div>
<div class="text small">
{{#each actor.talents as | talents | }}
{{talents.test}}<br>
<div class="text">
{{#each actor.weapons as | weapon | }}
{{weapon.category}}<br>
{{/each}}
</div>
</div>
Expand Down

0 comments on commit ab8d95d

Please sign in to comment.