Move the magic string into an enum
This commit is contained in:
parent
95443d3709
commit
bfddf855a4
4 changed files with 15 additions and 5 deletions
|
|
@ -3,6 +3,7 @@ import { documentSorter, filePath } from "../../consts.mjs";
|
|||
import { AmmoTracker } from "../popovers/AmmoTracker.mjs";
|
||||
import { gameTerms } from "../../gameTerms.mjs";
|
||||
import { GenericAppMixin } from "../GenericApp.mjs";
|
||||
import { ItemFlags } from "../../flags/item.mjs";
|
||||
import { localizer } from "../../utils/Localizer.mjs";
|
||||
import { Logger } from "../../utils/Logger.mjs";
|
||||
import { PopoverEventManager } from "../../utils/PopoverEventManager.mjs";
|
||||
|
|
@ -142,7 +143,7 @@ export class HeroSkillsCardV1 extends GenericAppMixin(HandlebarsApplicationMixin
|
|||
for (const ammo of ctx.actor.itemTypes.ammo) {
|
||||
total += ammo.system.quantity;
|
||||
|
||||
if (favouriteCount < 3 && ammo.getFlag(game.system.id, `favourited`)) {
|
||||
if (favouriteCount < 3 && ammo.getFlag(game.system.id, ItemFlags.FAVOURITE)) {
|
||||
ctx.favouriteAmmo[favouriteCount] = {
|
||||
uuid: ammo.uuid,
|
||||
name: ammo.name,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { filePath } from "../../consts.mjs";
|
||||
import { GenericPopoverMixin } from "./GenericPopoverMixin.mjs";
|
||||
import { ItemFlags } from "../../flags/item.mjs";
|
||||
import { localizer } from "../../utils/Localizer.mjs";
|
||||
import { Logger } from "../../utils/Logger.mjs";
|
||||
|
||||
|
|
@ -40,7 +41,7 @@ export class AmmoTracker extends GenericPopoverMixin(HandlebarsApplicationMixin(
|
|||
|
||||
let favouriteCount = 0;
|
||||
ctx.ammos = data.ammos.map(ammo => {
|
||||
const favourite = ammo.getFlag(game.system.id, `favourited`) ?? false;
|
||||
const favourite = ammo.getFlag(game.system.id, ItemFlags.FAVOURITE) ?? false;
|
||||
if (favourite) { favouriteCount++ };
|
||||
|
||||
return {
|
||||
|
|
@ -73,7 +74,7 @@ export class AmmoTracker extends GenericPopoverMixin(HandlebarsApplicationMixin(
|
|||
const item = await fromUuid(data.itemId);
|
||||
if (!item) { return };
|
||||
|
||||
item.setFlag(game.system.id, `favourited`, true);
|
||||
item.setFlag(game.system.id, ItemFlags.FAVOURITE, true);
|
||||
};
|
||||
|
||||
static async #unfavourite(_, el) {
|
||||
|
|
@ -87,7 +88,7 @@ export class AmmoTracker extends GenericPopoverMixin(HandlebarsApplicationMixin(
|
|||
const item = await fromUuid(data.itemId);
|
||||
if (!item) { return };
|
||||
|
||||
item.unsetFlag(game.system.id, `favourited`);
|
||||
item.unsetFlag(game.system.id, ItemFlags.FAVOURITE);
|
||||
};
|
||||
// #endregion
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue