Get the base favourite mechanism working so the items are visible on the skills card

This commit is contained in:
Oliver-Akins 2025-03-22 21:20:02 -06:00
parent 7d39c487dc
commit c495f45015
14 changed files with 165 additions and 27 deletions

View file

@ -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;
};