Get the base favourite mechanism working so the items are visible on the skills card
This commit is contained in:
parent
7d39c487dc
commit
c495f45015
14 changed files with 165 additions and 27 deletions
|
|
@ -139,7 +139,23 @@ export class HeroSkillsCardV1 extends GenericAppMixin(HandlebarsApplicationMixin
|
|||
};
|
||||
|
||||
static async prepareAmmo(ctx) {
|
||||
ctx.ammo = 0;
|
||||
let total = 0;
|
||||
ctx.favouriteAmmo = [];
|
||||
|
||||
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({
|
||||
uuid: ammo.uuid,
|
||||
name: ammo.name,
|
||||
quantity: ammo.system.quantity,
|
||||
});
|
||||
};
|
||||
};
|
||||
ctx.favouriteAmmo.length = 3; // assert array length
|
||||
|
||||
ctx.ammo = total;
|
||||
return ctx;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue