Display all of the pinned ammo on the sheet and tweak the list header style.
This commit is contained in:
parent
c495f45015
commit
a7e0fe899a
5 changed files with 32 additions and 25 deletions
|
|
@ -140,20 +140,21 @@ export class HeroSkillsCardV1 extends GenericAppMixin(HandlebarsApplicationMixin
|
|||
|
||||
static async prepareAmmo(ctx) {
|
||||
let total = 0;
|
||||
ctx.favouriteAmmo = [];
|
||||
let favouriteCount = 0;
|
||||
ctx.favouriteAmmo = new Array(3).fill(null);
|
||||
|
||||
for (const ammo of ctx.actor.itemTypes.ammo) {
|
||||
total += ammo.system.quantity;
|
||||
|
||||
if (ctx.favouriteAmmo.length < 3 && ammo.getFlag(game.system.id, `favourited`)) {
|
||||
ctx.favouriteAmmo.push({
|
||||
if (favouriteCount < 3 && ammo.getFlag(game.system.id, `favourited`)) {
|
||||
ctx.favouriteAmmo[favouriteCount] = {
|
||||
uuid: ammo.uuid,
|
||||
name: ammo.name,
|
||||
quantity: ammo.system.quantity,
|
||||
});
|
||||
};
|
||||
favouriteCount++;
|
||||
};
|
||||
};
|
||||
ctx.favouriteAmmo.length = 3; // assert array length
|
||||
|
||||
ctx.ammo = total;
|
||||
return ctx;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue