RC-103 | Add Access to the rest of the item types that require it
This commit is contained in:
parent
4ccfc03e59
commit
43fe433900
5 changed files with 84 additions and 7 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
import { CommonItemData } from "./Common.mjs";
|
import { CommonItemData } from "./Common.mjs";
|
||||||
|
import { gameTerms } from "../../gameTerms.mjs";
|
||||||
|
|
||||||
export class AmmoData extends CommonItemData {
|
export class AmmoData extends CommonItemData {
|
||||||
// MARK: Base Data
|
// MARK: Base Data
|
||||||
|
|
@ -25,6 +26,24 @@ export class AmmoData extends CommonItemData {
|
||||||
value: this.quantity,
|
value: this.quantity,
|
||||||
min: 0,
|
min: 0,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: `access`,
|
||||||
|
type: `dropdown`,
|
||||||
|
label: `Access`,
|
||||||
|
path: `system.access`,
|
||||||
|
value: this.access,
|
||||||
|
limited: false,
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: `RipCrypt.common.empty`,
|
||||||
|
value: ``,
|
||||||
|
},
|
||||||
|
...gameTerms.Access.map(opt => ({
|
||||||
|
label: `RipCrypt.common.access.${opt}`,
|
||||||
|
value: opt,
|
||||||
|
})),
|
||||||
|
],
|
||||||
|
},
|
||||||
];
|
];
|
||||||
return fields;
|
return fields;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,24 @@ export class ArmourData extends CommonItemData {
|
||||||
value: this.quantity,
|
value: this.quantity,
|
||||||
min: 0,
|
min: 0,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: `access`,
|
||||||
|
type: `dropdown`,
|
||||||
|
label: `Access`,
|
||||||
|
path: `system.access`,
|
||||||
|
value: this.access,
|
||||||
|
limited: false,
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: `RipCrypt.common.empty`,
|
||||||
|
value: ``,
|
||||||
|
},
|
||||||
|
...gameTerms.Access.map(opt => ({
|
||||||
|
label: `RipCrypt.common.access.${opt}`,
|
||||||
|
value: opt,
|
||||||
|
})),
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: `location`,
|
id: `location`,
|
||||||
type: `string-set`,
|
type: `string-set`,
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,19 @@
|
||||||
|
import { gameTerms } from "../../gameTerms.mjs";
|
||||||
import { requiredInteger } from "../helpers.mjs";
|
import { requiredInteger } from "../helpers.mjs";
|
||||||
|
|
||||||
|
const { fields } = foundry.data;
|
||||||
|
|
||||||
export class CommonItemData extends foundry.abstract.TypeDataModel {
|
export class CommonItemData extends foundry.abstract.TypeDataModel {
|
||||||
// MARK: Schema
|
// MARK: Schema
|
||||||
static defineSchema() {
|
static defineSchema() {
|
||||||
return {
|
return {
|
||||||
quantity: requiredInteger({ min: 0, initial: 1 }),
|
quantity: requiredInteger({ min: 0, initial: 1 }),
|
||||||
|
access: new fields.StringField({
|
||||||
|
blank: true,
|
||||||
|
nullable: false,
|
||||||
|
trim: true,
|
||||||
|
choices: gameTerms.Access,
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { CommonItemData } from "./Common.mjs";
|
import { CommonItemData } from "./Common.mjs";
|
||||||
|
import { gameTerms } from "../../gameTerms.mjs";
|
||||||
|
|
||||||
const { fields } = foundry.data;
|
const { fields } = foundry.data;
|
||||||
|
|
||||||
|
|
@ -40,6 +41,24 @@ export class GoodData extends CommonItemData {
|
||||||
value: this.quantity,
|
value: this.quantity,
|
||||||
min: 0,
|
min: 0,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: `access`,
|
||||||
|
type: `dropdown`,
|
||||||
|
label: `Access`,
|
||||||
|
path: `system.access`,
|
||||||
|
value: this.access,
|
||||||
|
limited: false,
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: `RipCrypt.common.empty`,
|
||||||
|
value: ``,
|
||||||
|
},
|
||||||
|
...gameTerms.Access.map(opt => ({
|
||||||
|
label: `RipCrypt.common.access.${opt}`,
|
||||||
|
value: opt,
|
||||||
|
})),
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: `description`,
|
id: `description`,
|
||||||
type: `prosemirror`,
|
type: `prosemirror`,
|
||||||
|
|
|
||||||
|
|
@ -28,12 +28,6 @@ export class WeaponData extends CommonItemData {
|
||||||
}),
|
}),
|
||||||
damage: requiredInteger({ min: 0, initial: 0 }),
|
damage: requiredInteger({ min: 0, initial: 0 }),
|
||||||
wear: barAttribute(0, 0, 4),
|
wear: barAttribute(0, 0, 4),
|
||||||
access: new fields.StringField({
|
|
||||||
blank: true,
|
|
||||||
nullable: false,
|
|
||||||
trim: true,
|
|
||||||
choices: gameTerms.Access,
|
|
||||||
}),
|
|
||||||
equipped: new fields.BooleanField({
|
equipped: new fields.BooleanField({
|
||||||
initial: false,
|
initial: false,
|
||||||
required: true,
|
required: true,
|
||||||
|
|
@ -87,7 +81,7 @@ export class WeaponData extends CommonItemData {
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
// #region Sheet Data
|
// #region Sheet Data
|
||||||
getFormFields(_ctx) {
|
async getFormFields(_ctx) {
|
||||||
const fields = [
|
const fields = [
|
||||||
{
|
{
|
||||||
id: `quantity`,
|
id: `quantity`,
|
||||||
|
|
@ -97,6 +91,24 @@ export class WeaponData extends CommonItemData {
|
||||||
value: this.quantity,
|
value: this.quantity,
|
||||||
min: 0,
|
min: 0,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: `access`,
|
||||||
|
type: `dropdown`,
|
||||||
|
label: `Access`,
|
||||||
|
path: `system.access`,
|
||||||
|
value: this.access,
|
||||||
|
limited: false,
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: `RipCrypt.common.empty`,
|
||||||
|
value: ``,
|
||||||
|
},
|
||||||
|
...gameTerms.Access.map(opt => ({
|
||||||
|
label: `RipCrypt.common.access.${opt}`,
|
||||||
|
value: opt,
|
||||||
|
})),
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: `traits`,
|
id: `traits`,
|
||||||
type: `string-set`,
|
type: `string-set`,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue