diff --git a/system/actor/htr/scripts/edges.js b/system/actor/htr/scripts/edges.js
index df8a0738..8ee3e00f 100644
--- a/system/actor/htr/scripts/edges.js
+++ b/system/actor/htr/scripts/edges.js
@@ -9,7 +9,7 @@ export const _onAddEdge = async function (event) {
// Secondary variables
const selectLabel = game.i18n.localize('WOD5E.HTR.SelectEdge')
- const itemOptions = WOD5E.Edges.getList()
+ const itemOptions = WOD5E.Edges.getList({})
// Variables yet to be defined
let options = []
diff --git a/system/actor/scripts/experience.js b/system/actor/scripts/experience.js
index 0a47762b..b70229da 100644
--- a/system/actor/scripts/experience.js
+++ b/system/actor/scripts/experience.js
@@ -2,7 +2,7 @@
export const _onAddExperience = async function (actor) {
// Define the actor's gamesystem, defaulting to "mortal" if it's not in the systems list
- const system = actor.system.gamesystem in WOD5E.Systems.getList() ? actor.system.gamesystem : 'mortal'
+ const system = actor.system.gamesystem in WOD5E.Systems.getList({}) ? actor.system.gamesystem : 'mortal'
// Render the template
const experienceTemplate = 'systems/vtm5e/display/shared/actors/parts/experience-display.hbs'
diff --git a/system/actor/scripts/item-roll.js b/system/actor/scripts/item-roll.js
index c0e7e62d..a09c64af 100644
--- a/system/actor/scripts/item-roll.js
+++ b/system/actor/scripts/item-roll.js
@@ -58,7 +58,7 @@ export const _onRollItem = async function (event) {
advancedDice = disableAdvancedDice ? 0 : await WOD5E.api.getAdvancedDice({ actor })
// Define the actor's gamesystem, defaulting to "mortal" if it's not in the systems list
- const system = actorData.gamesystem in WOD5E.Systems.getList() ? actorData.gamesystem : 'mortal'
+ const system = actorData.gamesystem in WOD5E.Systems.getList({}) ? actorData.gamesystem : 'mortal'
// Some quick modifications to vampire and werewolf rolls
// in order to properly display the dice in the dialog window
diff --git a/system/actor/scripts/roll.js b/system/actor/scripts/roll.js
index 450c2b1b..deaf87ad 100644
--- a/system/actor/scripts/roll.js
+++ b/system/actor/scripts/roll.js
@@ -77,7 +77,7 @@ export const _onConfirmRoll = async function (dataset, actor) {
}
// Define the actor's gamesystem, defaulting to "mortal" if it's not in the systems list
- const system = actor.system.gamesystem in WOD5E.Systems.getList() ? actor.system.gamesystem : 'mortal'
+ const system = actor.system.gamesystem in WOD5E.Systems.getList({}) ? actor.system.gamesystem : 'mortal'
// Some quick modifications to vampire and werewolf rolls
// in order to properly display the dice in the dialog window
diff --git a/system/actor/scripts/specialty-bonuses.js b/system/actor/scripts/specialty-bonuses.js
index 34c32469..09b423bb 100644
--- a/system/actor/scripts/specialty-bonuses.js
+++ b/system/actor/scripts/specialty-bonuses.js
@@ -7,7 +7,7 @@ export const _onAddBonus = async function (event, actor, data, SkillEditDialog)
const bonusPath = header.dataset.bonusPath
// Define the actor's gamesystem, defaulting to "mortal" if it's not in the systems list
- const system = actor.system.gamesystem in WOD5E.Systems.getList() ? actor.system.gamesystem : 'mortal'
+ const system = actor.system.gamesystem in WOD5E.Systems.getList({}) ? actor.system.gamesystem : 'mortal'
// Default values for a new specialty
const bonusData = {
@@ -98,7 +98,7 @@ export const _onDeleteBonus = async function (event, actor, data, SkillEditDialo
const bonusPath = header.dataset.bonusPath
// Define the actor's gamesystem, defaulting to "mortal" if it's not in the systems list
- const system = actor.system.gamesystem in WOD5E.Systems.getList() ? actor.system.gamesystem : 'mortal'
+ const system = actor.system.gamesystem in WOD5E.Systems.getList({}) ? actor.system.gamesystem : 'mortal'
// Define the existing list of bonuses
const bonusKeys = bonusPath.split('.')
@@ -133,7 +133,7 @@ export const _onEditBonus = async function (event, actor, data, SkillEditDialog)
}
// Define the actor's gamesystem, defaulting to "mortal" if it's not in the systems list
- const system = actor.system.gamesystem in WOD5E.Systems.getList() ? actor.system.gamesystem : 'mortal'
+ const system = actor.system.gamesystem in WOD5E.Systems.getList({}) ? actor.system.gamesystem : 'mortal'
// Render the template
const bonusTemplate = 'systems/vtm5e/display/shared/actors/parts/specialty-display.hbs'
diff --git a/system/actor/spc-actor-sheet.js b/system/actor/spc-actor-sheet.js
index c9f14ee1..72327e8e 100644
--- a/system/actor/spc-actor-sheet.js
+++ b/system/actor/spc-actor-sheet.js
@@ -244,7 +244,7 @@ export class SPCActorSheet extends WoDActor {
}
// Define the actor's gamesystem, defaulting to "mortal" if it's not in the systems list
- const system = actor.system.gamesystem in WOD5E.Systems.getList() ? actor.system.gamesystem : 'mortal'
+ const system = actor.system.gamesystem in WOD5E.Systems.getList({}) ? actor.system.gamesystem : 'mortal'
// Display the dialog
new Dialog({
@@ -287,7 +287,7 @@ export class SPCActorSheet extends WoDActor {
titleLabel = game.i18n.localize('WOD5E.VTM.AddDiscipline')
label = game.i18n.localize('WOD5E.VTM.SelectDiscipline')
} else if (powerType === 'gift') {
- const giftsList = WOD5E.Gifts.getList()
+ const giftsList = WOD5E.Gifts.getList({})
for (const [key, value] of Object.entries(giftsList)) {
options = options.concat(``)
}
@@ -295,7 +295,7 @@ export class SPCActorSheet extends WoDActor {
titleLabel = game.i18n.localize('WOD5E.WTA.AddGift')
label = game.i18n.localize('WOD5E.WTA.SelectGift')
} else if (powerType === 'edge') {
- const edgesList = WOD5E.Edges.getList()
+ const edgesList = WOD5E.Edges.getList({})
for (const [key, value] of Object.entries(edgesList)) {
options = options.concat(``)
}
@@ -333,7 +333,7 @@ export class SPCActorSheet extends WoDActor {
}
// Define the actor's gamesystem, defaulting to "mortal" if it's not in the systems list
- const system = actor.system.gamesystem in WOD5E.Systems.getList() ? actor.system.gamesystem : 'mortal'
+ const system = actor.system.gamesystem in WOD5E.Systems.getList({}) ? actor.system.gamesystem : 'mortal'
// Display the dialog
new Dialog({
diff --git a/system/actor/wod-v5-sheet.js b/system/actor/wod-v5-sheet.js
index 6f93f6ea..153fb18d 100644
--- a/system/actor/wod-v5-sheet.js
+++ b/system/actor/wod-v5-sheet.js
@@ -148,7 +148,7 @@ export class WoDActor extends ActorSheet {
equipment[i.system.equipmentType].push(i)
} else if (i.type === 'feature') {
// Check the featuretype field and set a default
- const featuretype = i.system.featuretype in WOD5E.Features.getList() ? i.system.featuretype : 'background'
+ const featuretype = i.system.featuretype in WOD5E.Features.getList({}) ? i.system.featuretype : 'background'
// Append to features
features[featuretype].push(i)
@@ -237,7 +237,7 @@ export class WoDActor extends ActorSheet {
const item = actor.getEmbeddedDocument('Item', li.data('itemId'))
// Define the actor's gamesystem, defaulting to "mortal" if it's not in the systems list
- const system = actor.system.gamesystem in WOD5E.Systems.getList() ? actor.system.gamesystem : 'mortal'
+ const system = actor.system.gamesystem in WOD5E.Systems.getList({}) ? actor.system.gamesystem : 'mortal'
// Variables yet to be defined
let buttons = {}
@@ -336,7 +336,7 @@ export class WoDActor extends ActorSheet {
const skill = header.dataset.skill
// Define the actor's gamesystem, defaulting to "mortal" if it's not in the systems list
- const system = actor.system.gamesystem in WOD5E.Systems.getList() ? actor.system.gamesystem : 'mortal'
+ const system = actor.system.gamesystem in WOD5E.Systems.getList({}) ? actor.system.gamesystem : 'mortal'
// Render selecting a skill/attribute to roll
const skillTemplate = 'systems/vtm5e/display/shared/actors/parts/skill-dialog.hbs'
@@ -464,7 +464,7 @@ export class WoDActor extends ActorSheet {
// Top-level variables
const actor = this.actor
const dataset = event.currentTarget.dataset
- const itemsList = WOD5E.ItemTypes.getList()
+ const itemsList = WOD5E.ItemTypes.getList({})
const type = dataset.type
// Variables to be defined later
@@ -476,7 +476,7 @@ export class WoDActor extends ActorSheet {
let options = ''
// Define the actor's gamesystem, defaulting to "mortal" if it's not in the systems list
- const system = actor.system.gamesystem in WOD5E.Systems.getList() ? actor.system.gamesystem : 'mortal'
+ const system = actor.system.gamesystem in WOD5E.Systems.getList({}) ? actor.system.gamesystem : 'mortal'
// Generate the item name
itemName = subtype ? WOD5E.api.generateLabelAndLocalize({ string: subtype, type }) : itemsList[type].label
@@ -490,12 +490,12 @@ export class WoDActor extends ActorSheet {
break
case 'perk':
selectLabel = game.i18n.localize('WOD5E.HTR.SelectEdge')
- itemOptions = WOD5E.Edges.getList()
+ itemOptions = WOD5E.Edges.getList({})
itemName = game.i18n.format('WOD5E.HTR.NewStringPerk', { string: itemName })
break
case 'gift':
selectLabel = game.i18n.localize('WOD5E.WTA.SelectGift')
- itemOptions = WOD5E.Gifts.getList()
+ itemOptions = WOD5E.Gifts.getList({})
if (subtype && subtype === 'rite') {
itemName = game.i18n.format('WOD5E.NewString', { string: itemName })
@@ -508,7 +508,7 @@ export class WoDActor extends ActorSheet {
break
case 'feature':
selectLabel = game.i18n.localize('WOD5E.ItemsList.SelectFeature')
- itemOptions = WOD5E.Features.getList()
+ itemOptions = WOD5E.Features.getList({})
itemName = game.i18n.format('WOD5E.NewString', { string: itemName })
break
default:
diff --git a/system/actor/wta/scripts/gifts.js b/system/actor/wta/scripts/gifts.js
index 661bf019..be003f37 100644
--- a/system/actor/wta/scripts/gifts.js
+++ b/system/actor/wta/scripts/gifts.js
@@ -11,7 +11,7 @@ export const _onAddGift = async function (event) {
// Secondary variables
const selectLabel = game.i18n.localize('WOD5E.WTA.SelectGift')
- const itemOptions = WOD5E.Gifts.getList()
+ const itemOptions = WOD5E.Gifts.getList({})
// Variables yet to be defined
let options = []
diff --git a/system/api/def/actortypes.js b/system/api/def/actortypes.js
index 13a61f29..a2052123 100644
--- a/system/api/def/actortypes.js
+++ b/system/api/def/actortypes.js
@@ -1,4 +1,4 @@
-/* global game, Hooks */
+/* global Hooks */
// Mortal
import { MortalActorSheet } from '../../actor/mortal-actor-sheet.js'
@@ -12,35 +12,9 @@ import { WerewolfActorSheet } from '../../actor/wta/werewolf-actor-sheet.js'
// All systems
import { SPCActorSheet } from '../../actor/spc-actor-sheet.js'
import { GroupActorSheet } from '../../actor/group-actor-sheet.js'
+import { BaseDefinitionClass } from './base-definition-class.js'
-export class ActorTypes {
- // Function to help with quickly grabbing all the listed values;
- // Will only retrieve objects (definitions)
- static getList () {
- return Object.entries(this)
- .filter(([, value]) => typeof value === 'object' && value !== null && !Array.isArray(value))
- .reduce((accumulator, [key, value]) => {
- accumulator[key] = value
- return accumulator
- }, {})
- }
-
- // Localize the labels
- static initializeLabels () {
- for (const [, value] of Object.entries(this)) {
- if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
- value.label = game.i18n.localize(value.label)
- }
-
- // Handle which label to display
- if (value.rename) {
- value.displayName = value.rename
- } else {
- value.displayName = value.label
- }
- }
- }
-
+export class ActorTypes extends BaseDefinitionClass {
// Run any necessary compilation on ready
static onReady () {
ActorTypes.initializeLabels()
diff --git a/system/api/def/attributes.js b/system/api/def/attributes.js
index 6fc46e62..6adbb1af 100644
--- a/system/api/def/attributes.js
+++ b/system/api/def/attributes.js
@@ -1,66 +1,10 @@
/* global game, Hooks */
-export class Attributes {
- // Function to help with quickly grabbing all the listed values;
- // Will only retrieve objects (definitions)
- // Optional string can be provided to filter by type
- static getList ({
- type = '',
- custom = false
- }) {
- return Object.entries(this)
- // Filter out any entries with improper formats
- .filter(([, value]) => typeof value === 'object' && value !== null && !Array.isArray(value) &&
- // Filter based on given filters provided with the function, if any
- (!type || value.type === type) && (!custom || value.custom === custom))
- // Reduce into a format the system can work with
- .reduce((accumulator, [key, value]) => {
- accumulator[key] = value
- return accumulator
- }, {})
- }
-
- // Method to add extra attributes
- static addCustom (customAttributes) {
- for (const [, value] of Object.entries(customAttributes)) {
- if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
- // Note this feature as being a custom feature
- value.custom = true
-
- this[value.id] = value
- }
- }
- }
-
- // Localize the labels
- static initializeLabels () {
- const modifications = game.settings.get('vtm5e', 'modifiedAttributes')
+import { BaseDefinitionClass } from './base-definition-class.js'
- for (const [key, value] of Object.entries(this)) {
- if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
- const checkModification = modifications.filter(attribute => attribute.id === key)
-
- value.label = game.i18n.localize(value.label)
-
- // If there are modifications, update the attribute
- if (checkModification.length > 0) {
- value.rename = checkModification[0].rename
- value.hidden = checkModification[0].hidden
- } else {
- // If there are no modifications, use default values
- value.rename = ''
- value.hidden = false
- }
- }
-
- // Handle which label to display
- if (value.rename) {
- value.displayName = value.rename
- } else {
- value.displayName = value.label
- }
- }
- }
+export class Attributes extends BaseDefinitionClass {
+ static modsEnabled = true
+ static defCategory = 'Attributes'
// Run any necessary compilation on ready
static onReady () {
diff --git a/system/api/def/base-definition-class.js b/system/api/def/base-definition-class.js
new file mode 100644
index 00000000..8c93de69
--- /dev/null
+++ b/system/api/def/base-definition-class.js
@@ -0,0 +1,77 @@
+/* global game */
+
+export class BaseDefinitionClass {
+ static modsEnabled = false
+ static defCategory = ''
+
+ // Function to help with quickly grabbing all the listed values
+ // Will only retrieve objects (definitions)
+ static getList ({
+ type = '',
+ custom = false
+ }) {
+ return Object.entries(this)
+ // Filter out any entries with improper formats
+ .filter(([, value]) => typeof value === 'object' && value !== null && !Array.isArray(value) &&
+ // Filter based on given filters provided with the function, if any
+ (!type || value.type === type) && (!custom || value.custom === custom))
+ // Reduce into a format the system can work with
+ .reduce((accumulator, [key, value]) => {
+ accumulator[key] = value
+ return accumulator
+ }, {})
+ }
+
+ // Localize the labels
+ static initializeLabels () {
+ let modifications = []
+
+ // Check if modifications are enabled
+ if (this.modsEnabled && this.defCategory) {
+ modifications = game.settings.get('vtm5e', `modified${this.defCategory}`)
+ }
+
+ // Cycle through each entry in the definition file to initialize the labels on each
+ // Quickly filter out any non-object, non-null, non-array values
+ const definitionEntries = Object.entries(this).filter(([, value]) => typeof value === 'object' && value !== null && !Array.isArray(value))
+ for (const [key, value] of definitionEntries) {
+ if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
+ // If there are no modifications, use default values
+ value.rename = ''
+ value.hidden = false
+
+ // If mods are enabled, check for a modification to the definition
+ if (this.modsEnabled) {
+ const checkModification = modifications.filter(definition => definition.id === key)
+
+ // If there are modifications, update the value's properties
+ if (checkModification.length > 0) {
+ value.rename = checkModification[0].rename
+ value.hidden = checkModification[0].hidden
+ }
+ }
+
+ value.label = game.i18n.localize(value.label)
+ }
+
+ // Handle which label to display
+ if (value.rename) {
+ value.displayName = value.rename
+ } else {
+ value.displayName = value.label
+ }
+ }
+ }
+
+ // Method to add extra definitions to a category
+ static addCustom (customDefinitions) {
+ for (const [, value] of Object.entries(customDefinitions)) {
+ if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
+ // Note this definition as being custom
+ value.custom = true
+
+ this[value.id] = value
+ }
+ }
+ }
+}
diff --git a/system/api/def/disciplines.js b/system/api/def/disciplines.js
index b69c83d9..a0d70f2c 100644
--- a/system/api/def/disciplines.js
+++ b/system/api/def/disciplines.js
@@ -1,64 +1,10 @@
/* global game, Hooks */
-export class Disciplines {
- // Function to help with quickly grabbing all the listed values;
- // Will only retrieve objects (definitions)
- static getList ({
- custom = false
- }) {
- return Object.entries(this)
- // Filter out any entries with improper formats
- .filter(([, value]) => typeof value === 'object' && value !== null && !Array.isArray(value) &&
- // Filter based on given filters provided with the function, if any
- (!custom || value.custom === custom))
- // Reduce into a format the system can work with
- .reduce((accumulator, [key, value]) => {
- accumulator[key] = value
- return accumulator
- }, {})
- }
-
- // Method to add extra disciplines
- static addCustom (customDisciplines) {
- for (const [, value] of Object.entries(customDisciplines)) {
- if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
- // Note this feature as being a custom feature
- value.custom = true
+import { BaseDefinitionClass } from './base-definition-class.js'
- this[value.id] = value
- }
- }
- }
-
- // Localize the labels
- static initializeLabels () {
- const modifications = game.settings.get('vtm5e', 'modifiedDisciplines')
-
- for (const [key, value] of Object.entries(this)) {
- if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
- const checkModification = modifications.filter(discipline => discipline.id === key)
-
- value.label = game.i18n.localize(value.label)
-
- // If there are modifications, update the attribute
- if (checkModification.length > 0) {
- value.rename = checkModification[0].rename
- value.hidden = checkModification[0].hidden
- } else {
- // If there are no modifications, use default values
- value.rename = ''
- value.hidden = false
- }
- }
-
- // Handle which label to display
- if (value.rename) {
- value.displayName = value.rename
- } else {
- value.displayName = value.label
- }
- }
- }
+export class Disciplines extends BaseDefinitionClass {
+ static modsEnabled = true
+ static defCategory = 'Disciplines'
// Run any necessary compilation on ready
static onReady () {
diff --git a/system/api/def/features.js b/system/api/def/features.js
index c2636200..08602f78 100644
--- a/system/api/def/features.js
+++ b/system/api/def/features.js
@@ -1,33 +1,8 @@
-/* global game, Hooks */
+/* global Hooks */
-export class Features {
- // Function to help with quickly grabbing all the listed values;
- // Will only retrieve objects (definitions)
- static getList () {
- return Object.entries(this)
- .filter(([, value]) => typeof value === 'object' && value !== null && !Array.isArray(value))
- .reduce((accumulator, [key, value]) => {
- accumulator[key] = value
- return accumulator
- }, {})
- }
-
- // Localize the labels
- static initializeLabels () {
- for (const [, value] of Object.entries(this)) {
- if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
- value.label = game.i18n.localize(value.label)
- }
-
- // Handle which label to display
- if (value.rename) {
- value.displayName = value.rename
- } else {
- value.displayName = value.label
- }
- }
- }
+import { BaseDefinitionClass } from './base-definition-class.js'
+export class Features extends BaseDefinitionClass {
// Run any necessary compilation on ready
static onReady () {
Features.initializeLabels()
diff --git a/system/api/def/itemtypes.js b/system/api/def/itemtypes.js
index 351c9437..5f9541cd 100644
--- a/system/api/def/itemtypes.js
+++ b/system/api/def/itemtypes.js
@@ -1,33 +1,8 @@
-/* global game, Hooks */
+/* global Hooks */
-export class ItemTypes {
- // Function to help with quickly grabbing all the listed values;
- // Will only retrieve objects (definitions)
- static getList () {
- return Object.entries(this)
- .filter(([, value]) => typeof value === 'object' && value !== null && !Array.isArray(value))
- .reduce((accumulator, [key, value]) => {
- accumulator[key] = value
- return accumulator
- }, {})
- }
-
- // Localize the labels
- static initializeLabels () {
- for (const [, value] of Object.entries(this)) {
- if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
- value.label = game.i18n.localize(value.label)
- }
-
- // Handle which label to display
- if (value.rename) {
- value.displayName = value.rename
- } else {
- value.displayName = value.label
- }
- }
- }
+import { BaseDefinitionClass } from './base-definition-class.js'
+export class ItemTypes extends BaseDefinitionClass {
// Run any necessary compilation on ready
static onReady () {
ItemTypes.initializeLabels()
diff --git a/system/api/def/skills.js b/system/api/def/skills.js
index 2b6c3022..beb442c0 100644
--- a/system/api/def/skills.js
+++ b/system/api/def/skills.js
@@ -1,66 +1,10 @@
/* global game, Hooks */
-export class Skills {
- // Function to help with quickly grabbing all the listed values;
- // Will only retrieve objects (definitions)
- // Optional string can be provided to filter by type
- static getList ({
- type = '',
- custom = false
- }) {
- return Object.entries(this)
- // Filter out any entries with improper formats
- .filter(([, value]) => typeof value === 'object' && value !== null && !Array.isArray(value) &&
- // Filter based on given filters provided with the function, if any
- (!type || value.type === type) && (!custom || value.custom === custom))
- // Reduce into a format the system can work with
- .reduce((accumulator, [key, value]) => {
- accumulator[key] = value
- return accumulator
- }, {})
- }
-
- // Method to add extra skills
- static addCustom (customSkills) {
- for (const [, value] of Object.entries(customSkills)) {
- if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
- // Note this feature as being a custom feature
- value.custom = true
-
- this[value.id] = value
- }
- }
- }
+import { BaseDefinitionClass } from './base-definition-class.js'
- // Localize the labels
- static initializeLabels () {
- const modifications = game.settings.get('vtm5e', 'modifiedSkills')
-
- for (const [key, value] of Object.entries(this)) {
- if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
- const checkModification = modifications.filter(skill => skill.id === key)
-
- value.label = game.i18n.localize(value.label)
-
- // If there are modifications, update the attribute
- if (checkModification.length > 0) {
- value.rename = checkModification[0].rename
- value.hidden = checkModification[0].hidden
- } else {
- // If there are no modifications, use default values
- value.rename = ''
- value.hidden = false
- }
- }
-
- // Handle which label to display
- if (value.rename) {
- value.displayName = value.rename
- } else {
- value.displayName = value.label
- }
- }
- }
+export class Skills extends BaseDefinitionClass {
+ static modsEnabled = true
+ static defCategory = 'Skills'
// Run any necessary compilation on ready
static onReady () {
diff --git a/system/api/def/systems.js b/system/api/def/systems.js
index 66f6c27d..b018440c 100644
--- a/system/api/def/systems.js
+++ b/system/api/def/systems.js
@@ -1,33 +1,8 @@
-/* global game, Hooks */
+/* global Hooks */
-export class Systems {
- // Function to help with quickly grabbing all the listed values;
- // Will only retrieve objects (definitions)
- static getList () {
- return Object.entries(this)
- .filter(([, value]) => typeof value === 'object' && value !== null && !Array.isArray(value))
- .reduce((accumulator, [key, value]) => {
- accumulator[key] = value
- return accumulator
- }, {})
- }
-
- // Localize the labels
- static initializeLabels () {
- for (const [, value] of Object.entries(this)) {
- if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
- value.label = game.i18n.localize(value.label)
- }
-
- // Handle which label to display
- if (value.rename) {
- value.displayName = value.rename
- } else {
- value.displayName = value.label
- }
- }
- }
+import { BaseDefinitionClass } from './base-definition-class.js'
+export class Systems extends BaseDefinitionClass {
// Run any necessary compilation on ready
static onReady () {
Systems.initializeLabels()
diff --git a/system/api/def/were-forms.js b/system/api/def/were-forms.js
index 384ad62d..25b4e2a3 100644
--- a/system/api/def/were-forms.js
+++ b/system/api/def/were-forms.js
@@ -1,31 +1,17 @@
/* global game, Hooks */
-export class WereForms {
- // Function to help with quickly grabbing all the listed values;
- // Will only retrieve objects (definitions)
- static getList () {
- return Object.entries(this)
- .filter(([, value]) => typeof value === 'object' && value !== null && !Array.isArray(value))
- .reduce((accumulator, [key, value]) => {
- accumulator[key] = value
- return accumulator
- }, {})
- }
+import { BaseDefinitionClass } from './base-definition-class.js'
+
+export class WereForms extends BaseDefinitionClass {
+ // Override the initializeLabels method to add extra functionality
+ static initializeLabels() {
+ super.initializeLabels()
- // Localize the labels
- static initializeLabels () {
for (const [, value] of Object.entries(this)) {
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
- value.label = game.i18n.localize(value.label)
+ // Initialize the nickname label too
value.nickname = game.i18n.localize(value.nickname)
}
-
- // Handle which label to display
- if (value.rename) {
- value.displayName = value.rename
- } else {
- value.displayName = value.label
- }
}
}
diff --git a/system/api/dicepool-list.js b/system/api/dicepool-list.js
index b1d64101..899878e5 100644
--- a/system/api/dicepool-list.js
+++ b/system/api/dicepool-list.js
@@ -40,7 +40,7 @@ export const getDicepoolList = async (document) => {
// Werewolf
if (gamesystem === 'werewolf') {
- const renown = WOD5E.Renown.getList()
+ const renown = WOD5E.Renown.getList({})
for (const [key, value] of Object.entries(renown)) {
masterList.push({
value: `renown.${key}`,
@@ -52,7 +52,7 @@ export const getDicepoolList = async (document) => {
// Hunter
if (gamesystem === 'hunter') {
- const edges = WOD5E.Edges.getList()
+ const edges = WOD5E.Edges.getList({})
for (const [key, value] of Object.entries(edges)) {
masterList.push({
value: `edges.${key}`,
diff --git a/system/api/generate-localization.js b/system/api/generate-localization.js
index 7ec35c01..87cf8e7e 100644
--- a/system/api/generate-localization.js
+++ b/system/api/generate-localization.js
@@ -7,7 +7,7 @@
*/
export const generateLocalizedLabel = (string, type) => {
if (type === 'actortypes' || type === 'actortype') { // Actor Types
- const actortypes = WOD5E.ActorTypes.getList()
+ const actortypes = WOD5E.ActorTypes.getList({})
return findLabel(actortypes, string)
} else if (type === 'attributes' || type === 'attribute') { // Attributes
const attributes = WOD5E.Attributes.getList({})
@@ -16,19 +16,19 @@ export const generateLocalizedLabel = (string, type) => {
const skills = WOD5E.Skills.getList({})
return findLabel(skills, string)
} else if (type === 'features' || type === 'feature') { // Features
- const features = WOD5E.Features.getList()
+ const features = WOD5E.Features.getList({})
return findLabel(features, string)
} else if (type === 'disciplines' || type === 'discipline' || type === 'power') { // Disciplines
const disciplines = WOD5E.Disciplines.getList({})
return findLabel(disciplines, string)
} else if (type === 'gifts' || type === 'gift') { // Gifts
- const gifts = WOD5E.Gifts.getList()
+ const gifts = WOD5E.Gifts.getList({})
return findLabel(gifts, string)
} else if (type === 'renown') { // Renown
- const renown = WOD5E.Renown.getList()
+ const renown = WOD5E.Renown.getList({})
return findLabel(renown, string)
} else if (type === 'edges' || type === 'edge' || type === 'perk' || type === 'edgepool') { // Edges
- const edges = WOD5E.Edges.getList()
+ const edges = WOD5E.Edges.getList({})
return findLabel(edges, string)
} else if (type === 'grouptype' || type === 'group') {
const grouptypes = {
diff --git a/system/api/wod5e-api.js b/system/api/wod5e-api.js
index 5895ac5d..c5ff4b82 100644
--- a/system/api/wod5e-api.js
+++ b/system/api/wod5e-api.js
@@ -97,7 +97,7 @@ export class wod5eAPI {
const { skill, attribute, discipline, renown } = dataset
// Define the actor's gamesystem, defaulting to "mortal" if it's not in the systems list
- const system = actor.system.gamesystem in WOD5E.Systems.getList() ? actor.system.gamesystem : 'mortal'
+ const system = actor.system.gamesystem in WOD5E.Systems.getList({}) ? actor.system.gamesystem : 'mortal'
// Attribute definitions
const attributesList = WOD5E.Attributes.getList({})
@@ -273,7 +273,7 @@ export class wod5eAPI {
const actorData = actor.system
// Define the actor's gamesystem, defaulting to "mortal" if it's not in the systems list
- const system = actor.system.gamesystem in WOD5E.Systems.getList() ? actor.system.gamesystem : 'mortal'
+ const system = actor.system.gamesystem in WOD5E.Systems.getList({}) ? actor.system.gamesystem : 'mortal'
if (system === 'vampire' && actor.type !== 'ghoul' && actor.type !== 'spc') {
// Define actor's hunger dice, ensuring it can't go below 0
diff --git a/system/item/item.js b/system/item/item.js
index e88ef57f..946ebe3b 100644
--- a/system/item/item.js
+++ b/system/item/item.js
@@ -16,7 +16,7 @@ Hooks.on('preCreateItem', (document, data) => {
// Get default item image based on the item type
if (!data.img) {
- const itemsList = WOD5E.ItemTypes.getList()
+ const itemsList = WOD5E.ItemTypes.getList({})
const itemImg = itemsList[data.type]?.img || 'systems/vtm5e/assets/icons/items/item-default.svg'
// Set the img value to the icon we get back
diff --git a/system/main.js b/system/main.js
index 32c2f7c6..3ce1d811 100644
--- a/system/main.js
+++ b/system/main.js
@@ -59,7 +59,7 @@ Hooks.once('init', async function () {
// Register actor sheet application classes
Actors.unregisterSheet('core', ActorSheet)
// Loop through each entry in the actorTypesList and register their sheet classes
- const actorTypesList = ActorTypes.getList()
+ const actorTypesList = ActorTypes.getList({})
for (const [, value] of Object.entries(actorTypesList)) {
const { label, types, sheetClass } = value
diff --git a/system/scripts/system-rolls.js b/system/scripts/system-rolls.js
index ea4aded5..02a8dc3b 100644
--- a/system/scripts/system-rolls.js
+++ b/system/scripts/system-rolls.js
@@ -57,7 +57,7 @@ class WOD5eDice {
advancedCheckDice = 0
}) {
// Define the actor's gamesystem, defaulting to 'mortal' if it's not in the systems list
- const system = actor.system.gamesystem in WOD5E.Systems.getList() ? actor.system.gamesystem : 'mortal'
+ const system = actor.system.gamesystem in WOD5E.Systems.getList({}) ? actor.system.gamesystem : 'mortal'
// Handle getting any situational modifiers
const situationalModifiers = await getSituationalModifiers({
diff --git a/system/scripts/willpower-reroll.js b/system/scripts/willpower-reroll.js
index fe863be8..06b08a4f 100644
--- a/system/scripts/willpower-reroll.js
+++ b/system/scripts/willpower-reroll.js
@@ -16,7 +16,7 @@ export const willpowerReroll = async (roll) => {
const actor = game.actors.get(message.speaker.actor)
// Define the actor's gamesystem, defaulting to 'mortal' if it's not in the systems list
- const system = actor.system.gamesystem in WOD5E.Systems.getList() ? actor.system.gamesystem : 'mortal'
+ const system = actor.system.gamesystem in WOD5E.Systems.getList({}) ? actor.system.gamesystem : 'mortal'
// Go through the message's dice and add them to the diceRolls array
Object.keys(dice).forEach(function (i) {