Add the locations selector (closes #153)

This commit is contained in:
Oliver-Akins 2024-03-31 15:35:46 -06:00
parent ad2da03f1e
commit dd5a980f4e
5 changed files with 34 additions and 14 deletions

View file

@ -12,4 +12,13 @@ export class DotDungeonItem extends Item {
};
return this.system.quantity;
};
get availableLocations() {
return [
{ value: null, label: `dotdungeon.location.unknown` },
{ value: `inventory`, label: `dotdungeon.location.inventory` },
{ value: `equipped`, label: `dotdungeon.location.equipped` },
{ value: `storage`, label: `dotdungeon.location.storage` },
];
};
};

View file

@ -2,7 +2,7 @@ import { schemaOptions } from "./schemaOptions.mjs";
import { createArray } from "./createArray.mjs";
import { detailsExpanded } from "./detailsExpanded.mjs";
import { objectValue } from "./objectValue.mjs";
import { handlebarsLocalizer } from "../utils/localizer.mjs";
import { handlebarsLocalizer, localizer } from "../utils/localizer.mjs";
import { options } from "./options.mjs";
export default {
@ -19,7 +19,7 @@ export default {
"dd-stringify": v => JSON.stringify(v, null, ` `),
"dd-empty": v => v.length == 0,
"dd-set-has": (s, k) => s.has(k),
"dd-empty-state": (v) => v ?? `--`,
"dd-empty-state": (v) => v ?? localizer(`dotdungeon.common.empty`),
// Logic helpers
"eq": (a, b) => a == b,

View file

@ -42,16 +42,8 @@ export class CommonItemData extends foundry.abstract.TypeDataModel {
nullable: false,
}),
location: new fields.StringField({
initial: null,
nullable: true,
/*
"equipped" = on player, actively having an effect (e.g. armour
is worn, weapon is held), not all items have an equipped state
"inventory" = on player, equivalent to being put in a backpack
"storage" = not on player at all, in a chest in their house or
smth, these items should be displayed in the storage tab
*/
choices: ["equipped", "inventory", "storage"],
initial: "",
nullable: false,
}),
};
};