RC-116 | Weapons showing as equipped when they shouldn't be
This commit is contained in:
parent
0c39efe32f
commit
dd8ba4df83
2 changed files with 28 additions and 5 deletions
|
|
@ -174,14 +174,32 @@ export class HeroSummaryCardV1 extends GenericAppMixin(HandlebarsApplicationMixi
|
|||
const limit = ctx.actor.system.limit.weapons;
|
||||
const embedded = ctx.actor.itemTypes.weapon;
|
||||
ctx.weapons = [];
|
||||
for (let i = 0; i < limit; i++) {
|
||||
for (const item of embedded) {
|
||||
if (!item.system.equipped) { continue };
|
||||
|
||||
const index = ctx.weapons.length;
|
||||
ctx.weapons.push({
|
||||
data: embedded[i],
|
||||
empty: embedded.at(i) === undefined,
|
||||
index: i + 1,
|
||||
class: i % 2 === 1 ? `row-alt` : ``,
|
||||
data: item,
|
||||
empty: false,
|
||||
index,
|
||||
class: index % 2 === 1 ? `row-alt` : ``,
|
||||
});
|
||||
|
||||
if (ctx.weapons.length >= limit) { break };
|
||||
};
|
||||
|
||||
if (ctx.weapons.length < limit) {
|
||||
for (let i = ctx.weapons.length - 1; i <= limit; i++) {
|
||||
const itemIndex = ctx.weapons.length;
|
||||
ctx.weapons.push({
|
||||
data: null,
|
||||
empty: true,
|
||||
index: itemIndex,
|
||||
class: itemIndex % 2 === 1 ? `row-alt` : ``,
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
return ctx;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,11 @@ export class WeaponData extends CommonItemData {
|
|||
trim: true,
|
||||
choices: gameTerms.Access,
|
||||
}),
|
||||
equipped: new fields.BooleanField({
|
||||
initial: false,
|
||||
required: true,
|
||||
nullable: false,
|
||||
}),
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue