From 776dfd526da9d0d3efe6350b76570aeb3ee06972 Mon Sep 17 00:00:00 2001 From: Veilza Date: Wed, 28 Aug 2024 21:46:24 -0500 Subject: [PATCH 01/11] Enable the storyteller to override the default actor header background --- display/htr/actors/cell-sheet.hbs | 2 +- display/htr/actors/hunter-sheet.hbs | 2 +- display/shared/actors/mortal-sheet.hbs | 2 +- display/shared/actors/spc-sheet.hbs | 2 +- display/vtm/actors/coterie-sheet.hbs | 2 +- display/vtm/actors/ghoul-sheet.hbs | 2 +- display/vtm/actors/vampire-sheet.hbs | 2 +- display/wta/actors/pack-sheet.hbs | 2 +- display/wta/actors/werewolf-sheet.hbs | 2 +- lang/en/core-en.json | 6 ++++-- system/actor/scripts/get-actor-header.js | 15 +++++++++++++++ system/actor/wod-v5-sheet.js | 3 +++ system/scripts/settings.js | 15 +++++++++++++++ 13 files changed, 46 insertions(+), 11 deletions(-) create mode 100644 system/actor/scripts/get-actor-header.js diff --git a/display/htr/actors/cell-sheet.hbs b/display/htr/actors/cell-sheet.hbs index 6f53b45c..2163083f 100644 --- a/display/htr/actors/cell-sheet.hbs +++ b/display/htr/actors/cell-sheet.hbs @@ -1,6 +1,6 @@
{{!-- Cell Sheet Header --}} -
+
{{> "systems/vtm5e/display/shared/actors/parts/group/header-profile.hbs"}}
diff --git a/display/htr/actors/hunter-sheet.hbs b/display/htr/actors/hunter-sheet.hbs index 7f59f522..0aea003b 100644 --- a/display/htr/actors/hunter-sheet.hbs +++ b/display/htr/actors/hunter-sheet.hbs @@ -1,6 +1,6 @@ {{!-- Hunter Sheet Header --}} -
+
{{!-- Health Tracker --}} diff --git a/display/shared/actors/mortal-sheet.hbs b/display/shared/actors/mortal-sheet.hbs index ee153251..fb2325eb 100644 --- a/display/shared/actors/mortal-sheet.hbs +++ b/display/shared/actors/mortal-sheet.hbs @@ -1,6 +1,6 @@ {{!-- Mortal Sheet Header --}} -
+
{{!-- Health Tracker --}} diff --git a/display/shared/actors/spc-sheet.hbs b/display/shared/actors/spc-sheet.hbs index 3e2bd48f..08659b89 100644 --- a/display/shared/actors/spc-sheet.hbs +++ b/display/shared/actors/spc-sheet.hbs @@ -1,6 +1,6 @@ {{!-- SPC Sheet Header --}} -
+
{{!-- Health Tracker --}} diff --git a/display/vtm/actors/coterie-sheet.hbs b/display/vtm/actors/coterie-sheet.hbs index b1b89ba6..0ff8f935 100644 --- a/display/vtm/actors/coterie-sheet.hbs +++ b/display/vtm/actors/coterie-sheet.hbs @@ -1,6 +1,6 @@ {{!-- Coterie Sheet Header --}} -
+
{{> "systems/vtm5e/display/shared/actors/parts/group/header-profile.hbs"}}
diff --git a/display/vtm/actors/ghoul-sheet.hbs b/display/vtm/actors/ghoul-sheet.hbs index 3efae739..2f0714cd 100644 --- a/display/vtm/actors/ghoul-sheet.hbs +++ b/display/vtm/actors/ghoul-sheet.hbs @@ -1,6 +1,6 @@ {{!-- Ghoul Sheet Header --}} -
+
{{!-- Health Tracker --}} diff --git a/display/vtm/actors/vampire-sheet.hbs b/display/vtm/actors/vampire-sheet.hbs index bcbce319..65d8e6e7 100644 --- a/display/vtm/actors/vampire-sheet.hbs +++ b/display/vtm/actors/vampire-sheet.hbs @@ -1,6 +1,6 @@ {{!-- Vampire Sheet Header --}} -
+
{{!-- Health Tracker --}} diff --git a/display/wta/actors/pack-sheet.hbs b/display/wta/actors/pack-sheet.hbs index d1a7886c..4d2487c2 100644 --- a/display/wta/actors/pack-sheet.hbs +++ b/display/wta/actors/pack-sheet.hbs @@ -1,6 +1,6 @@ {{!-- Pack Sheet Header --}} -
+
{{> "systems/vtm5e/display/shared/actors/parts/group/header-profile.hbs"}}
diff --git a/display/wta/actors/werewolf-sheet.hbs b/display/wta/actors/werewolf-sheet.hbs index 4da6f1fa..ded4ed07 100644 --- a/display/wta/actors/werewolf-sheet.hbs +++ b/display/wta/actors/werewolf-sheet.hbs @@ -1,6 +1,6 @@ {{!-- Werewolf Sheet Header --}} -
+
{{!-- Health Tracker --}} diff --git a/lang/en/core-en.json b/lang/en/core-en.json index 90f2fa05..5b476874 100644 --- a/lang/en/core-en.json +++ b/lang/en/core-en.json @@ -234,7 +234,9 @@ "StorytellerMenu": "Storyteller Menu", "StorytellerMenuHint": "Modify the system, such as renaming existing and creating custom skills and attributes.", "WorldVersion": "World Version", - "WorldVersionHint": "Automatically upgrades data when the system.json is upgraded." + "WorldVersionHint": "Automatically upgrades data when the system.json is upgraded.", + "actorHeaderOverride": "Default Actor Header", + "actorHeaderOverrideHint": "Determine the default image used for actor headers." }, "SkillsList": { "Academics": "Academics", @@ -299,4 +301,4 @@ "StorytellerNotes": "Storyteller Notes" } } -} \ No newline at end of file +} diff --git a/system/actor/scripts/get-actor-header.js b/system/actor/scripts/get-actor-header.js new file mode 100644 index 00000000..051c2752 --- /dev/null +++ b/system/actor/scripts/get-actor-header.js @@ -0,0 +1,15 @@ +/* global game */ + +export const getActorHeader = async function (actor) { + const actorBG = actor.system?.settings?.headerbg || '' + const settingsBG = game.settings.get('vtm5e', 'actorHeaderOverride') || '' + + if (actorBG) { // Always prefer the actor-specific header setting override + return actorBG + } else if (settingsBG) { // Use the settings header if one is set and the actor field doesn't have one + return settingsBG + } + + // Return an empty string, telling Handlebars to use the default background + return '' +} diff --git a/system/actor/wod-v5-sheet.js b/system/actor/wod-v5-sheet.js index 6807ed1b..4eae2e3e 100644 --- a/system/actor/wod-v5-sheet.js +++ b/system/actor/wod-v5-sheet.js @@ -5,6 +5,7 @@ import { prepareSkills } from './scripts/prepare-skills.js' import { prepareAttributes } from './scripts/prepare-attributes.js' import { _onHealthChange } from './scripts/on-health-change.js' import { _onWillpowerChange } from './scripts/on-willpower-change.js' +import { getActorHeader } from './scripts/get-actor-header.js' // Roll function import { WOD5eDice } from '../scripts/system-rolls.js' import { _onRoll } from './scripts/roll.js' @@ -67,6 +68,8 @@ export class WoDActor extends ActorSheet { data.displayBanner = game.settings.get('vtm5e', 'actorBanner') + data.headerbg = await getActorHeader(actor) + // Enrich non-header editor fields if (actorData.biography) { data.enrichedBiography = await TextEditor.enrichHTML(actorData.biography) } if (actorData.appearance) { data.enrichedAppearance = await TextEditor.enrichHTML(actorData.appearance) } diff --git a/system/scripts/settings.js b/system/scripts/settings.js index 40e4ae29..f9fee49d 100644 --- a/system/scripts/settings.js +++ b/system/scripts/settings.js @@ -303,6 +303,21 @@ export const loadSettings = async function () { } }) + // Override for the default actor header image + game.settings.register('vtm5e', 'actorHeaderOverride', { + name: game.i18n.localize('WOD5E.Settings.actorHeaderOverride'), + hint: game.i18n.localize('WOD5E.Settings.actorHeaderOverrideHint'), + scope: 'world', + config: true, + default: '', + type: String, + filePicker: 'image', + onChange: async () => { + // Reload actorsheets + resetActors() + } + }) + // World Version, only really needed by developers game.settings.register('vtm5e', 'worldVersion', { name: game.i18n.localize('WOD5E.Settings.WorldVersion'), From f6980a2abc93a8c6200bc361a2d06eef9195dd48 Mon Sep 17 00:00:00 2001 From: Veilza Date: Wed, 28 Aug 2024 21:47:02 -0500 Subject: [PATCH 02/11] Add other localization keys for new actor header setting --- lang/de/core-de.json | 2 ++ lang/en/core-en.json | 8 ++++---- lang/es/core-es.json | 2 ++ lang/fr/core-fr.json | 2 ++ lang/it/core-it.json | 2 ++ lang/pl/core-pl.json | 2 ++ lang/pt-BR/core-pt-BR.json | 2 ++ lang/ru/core-ru.json | 2 ++ lang/template/core-template.json | 2 ++ lang/uk/core-uk.json | 2 ++ 10 files changed, 22 insertions(+), 4 deletions(-) diff --git a/lang/de/core-de.json b/lang/de/core-de.json index 464d3e00..04d1fd68 100644 --- a/lang/de/core-de.json +++ b/lang/de/core-de.json @@ -184,6 +184,8 @@ "Settings": { "ActorBanner": "Charakter-Typ-Banner anzeigen", "ActorBannerHint": "Zeigt einen farbigen Banner oben am Charakterbogen, der den Typ von Wesen anzeigt.", + "_actorHeaderOverride": "", + "_actorHeaderOverrideHint": "", "AddAttributeModification": "Attributs-Modifikation hinzufügen", "AddCustomAttribute": "Eigenes Attribut hinzufügen", "_AddCustomDiscipline": "", diff --git a/lang/en/core-en.json b/lang/en/core-en.json index 5b476874..5e6e5ddc 100644 --- a/lang/en/core-en.json +++ b/lang/en/core-en.json @@ -184,6 +184,8 @@ "Settings": { "ActorBanner": "Enable Character Type Banner", "ActorBannerHint": "Display a banner at the top of actor sheets to represent the character type.", + "actorHeaderOverride": "Default Actor Header", + "actorHeaderOverrideHint": "Determine the default image used for actor headers.", "AddAttributeModification": "Add Attribute Modification", "AddCustomAttribute": "Add Custom Attribute", "AddCustomDiscipline": "Add Custom Discipline", @@ -234,9 +236,7 @@ "StorytellerMenu": "Storyteller Menu", "StorytellerMenuHint": "Modify the system, such as renaming existing and creating custom skills and attributes.", "WorldVersion": "World Version", - "WorldVersionHint": "Automatically upgrades data when the system.json is upgraded.", - "actorHeaderOverride": "Default Actor Header", - "actorHeaderOverrideHint": "Determine the default image used for actor headers." + "WorldVersionHint": "Automatically upgrades data when the system.json is upgraded." }, "SkillsList": { "Academics": "Academics", @@ -301,4 +301,4 @@ "StorytellerNotes": "Storyteller Notes" } } -} +} \ No newline at end of file diff --git a/lang/es/core-es.json b/lang/es/core-es.json index 2a0b7c75..753683b4 100644 --- a/lang/es/core-es.json +++ b/lang/es/core-es.json @@ -184,6 +184,8 @@ "Settings": { "_ActorBanner": "", "_ActorBannerHint": "", + "_actorHeaderOverride": "", + "_actorHeaderOverrideHint": "", "_AddAttributeModification": "", "_AddCustomAttribute": "", "_AddCustomDiscipline": "", diff --git a/lang/fr/core-fr.json b/lang/fr/core-fr.json index 12b0ce0e..8d14fab9 100644 --- a/lang/fr/core-fr.json +++ b/lang/fr/core-fr.json @@ -184,6 +184,8 @@ "Settings": { "_ActorBanner": "", "_ActorBannerHint": "", + "_actorHeaderOverride": "", + "_actorHeaderOverrideHint": "", "_AddAttributeModification": "", "_AddCustomAttribute": "", "_AddCustomDiscipline": "", diff --git a/lang/it/core-it.json b/lang/it/core-it.json index 494475a1..1356d1ba 100644 --- a/lang/it/core-it.json +++ b/lang/it/core-it.json @@ -184,6 +184,8 @@ "Settings": { "ActorBanner": "Etichetta tipo personaggio", "ActorBannerHint": "Mostra un etichetta sulla scheda che rappresenta il tipo di personaggio.", + "_actorHeaderOverride": "", + "_actorHeaderOverrideHint": "", "AddAttributeModification": "Aggiungi modifica attributo", "AddCustomAttribute": "Aggiungi attributo personalizzato", "_AddCustomDiscipline": "", diff --git a/lang/pl/core-pl.json b/lang/pl/core-pl.json index d4ab7694..39c19dd7 100644 --- a/lang/pl/core-pl.json +++ b/lang/pl/core-pl.json @@ -184,6 +184,8 @@ "Settings": { "_ActorBanner": "", "_ActorBannerHint": "", + "_actorHeaderOverride": "", + "_actorHeaderOverrideHint": "", "_AddAttributeModification": "", "_AddCustomAttribute": "", "_AddCustomDiscipline": "", diff --git a/lang/pt-BR/core-pt-BR.json b/lang/pt-BR/core-pt-BR.json index 194e166c..2df49cd1 100644 --- a/lang/pt-BR/core-pt-BR.json +++ b/lang/pt-BR/core-pt-BR.json @@ -184,6 +184,8 @@ "Settings": { "_ActorBanner": "", "_ActorBannerHint": "", + "_actorHeaderOverride": "", + "_actorHeaderOverrideHint": "", "_AddAttributeModification": "", "_AddCustomAttribute": "", "_AddCustomDiscipline": "", diff --git a/lang/ru/core-ru.json b/lang/ru/core-ru.json index 429d6227..edfb5073 100644 --- a/lang/ru/core-ru.json +++ b/lang/ru/core-ru.json @@ -184,6 +184,8 @@ "Settings": { "_ActorBanner": "", "_ActorBannerHint": "", + "_actorHeaderOverride": "", + "_actorHeaderOverrideHint": "", "_AddAttributeModification": "", "_AddCustomAttribute": "", "_AddCustomDiscipline": "", diff --git a/lang/template/core-template.json b/lang/template/core-template.json index 1d23d0c0..dce98d33 100644 --- a/lang/template/core-template.json +++ b/lang/template/core-template.json @@ -184,6 +184,8 @@ "Settings": { "_ActorBanner": "", "_ActorBannerHint": "", + "_actorHeaderOverride": "", + "_actorHeaderOverrideHint": "", "_AddAttributeModification": "", "_AddCustomAttribute": "", "_AddCustomDiscipline": "", diff --git a/lang/uk/core-uk.json b/lang/uk/core-uk.json index 9f6263b3..4b05d718 100644 --- a/lang/uk/core-uk.json +++ b/lang/uk/core-uk.json @@ -184,6 +184,8 @@ "Settings": { "_ActorBanner": "", "_ActorBannerHint": "", + "_actorHeaderOverride": "", + "_actorHeaderOverrideHint": "", "_AddAttributeModification": "", "_AddCustomAttribute": "", "_AddCustomDiscipline": "", From 9062177220eb693dbfdddbe24e95cda7379d8e41 Mon Sep 17 00:00:00 2001 From: Veilza Date: Thu, 29 Aug 2024 00:45:17 -0500 Subject: [PATCH 03/11] Add the ability to switch actor types through the actor settings --- .../shared/actors/parts/actor-settings.hbs | 20 ++++--- .../actors/parts/group/type-selector.hbs | 4 +- .../shared/actors/parts/spc/type-selector.hbs | 6 +-- system/actor/group-actor-sheet.js | 7 --- system/actor/scripts/get-actor-types.js | 53 +++++++++++++++++++ system/actor/spc-actor-sheet.js | 9 ---- system/actor/wod-v5-sheet.js | 6 +++ 7 files changed, 78 insertions(+), 27 deletions(-) create mode 100644 system/actor/scripts/get-actor-types.js diff --git a/display/shared/actors/parts/actor-settings.hbs b/display/shared/actors/parts/actor-settings.hbs index cf8bb2da..fb04a9f3 100644 --- a/display/shared/actors/parts/actor-settings.hbs +++ b/display/shared/actors/parts/actor-settings.hbs @@ -1,8 +1,16 @@
-
- -
- +
+ +
+ +
-
-
\ No newline at end of file +
+ +
+ +
+
+
diff --git a/display/shared/actors/parts/group/type-selector.hbs b/display/shared/actors/parts/group/type-selector.hbs index 20da9b25..d726f91a 100644 --- a/display/shared/actors/parts/group/type-selector.hbs +++ b/display/shared/actors/parts/group/type-selector.hbs @@ -1,5 +1,5 @@
- + {{selectOptions actorOptions selected=currentActorType localize=true}}
diff --git a/display/shared/actors/parts/spc/type-selector.hbs b/display/shared/actors/parts/spc/type-selector.hbs index e8491955..c3b08452 100644 --- a/display/shared/actors/parts/spc/type-selector.hbs +++ b/display/shared/actors/parts/spc/type-selector.hbs @@ -1,5 +1,5 @@
- +
diff --git a/system/actor/group-actor-sheet.js b/system/actor/group-actor-sheet.js index d377fa68..fd6602e1 100644 --- a/system/actor/group-actor-sheet.js +++ b/system/actor/group-actor-sheet.js @@ -105,13 +105,6 @@ export class GroupActorSheet extends WoDActor { // Apply new CSS classes to the sheet, if necessary this._applyClasses() - // Group type options - data.groupTypes = { - coterie: 'WOD5E.VTM.Coterie', - cell: 'WOD5E.HTR.Cell', - pack: 'WOD5E.WTA.Pack' - } - return data } diff --git a/system/actor/scripts/get-actor-types.js b/system/actor/scripts/get-actor-types.js new file mode 100644 index 00000000..2b2bcbb8 --- /dev/null +++ b/system/actor/scripts/get-actor-types.js @@ -0,0 +1,53 @@ +export const getActorTypes = async function (actor) { + const currentActorType = actor.type + + const playerTypes = { + mortal: 'WOD5E.Mortal', + vampire: 'WOD5E.VTM.Label', + ghoul: 'WOD5E.VTM.Ghoul', + werewolf: 'WOD5E.WTA.Label', + hunter: 'WOD5E.HTR.Label' + } + + const spcTypes = { + mortal: 'WOD5E.Mortal', + vampire: 'WOD5E.VTM.Label', + werewolf: 'WOD5E.WTA.Label', + hunter: 'WOD5E.HTR.Label' + } + + const groupTypes = { + coterie: 'WOD5E.VTM.Coterie', + cell: 'WOD5E.HTR.Cell', + pack: 'WOD5E.WTA.Pack' + } + + if (currentActorType in playerTypes) { + return { + currentActorType, + typePath: 'type', + types: playerTypes + } + } else if (currentActorType === 'spc') { + return { + currentActorType, + typePath: 'system.spcType', + types: spcTypes + } + } else if (currentActorType === 'group') { + return { + currentActorType, + typePath: 'system.groupType', + types: groupTypes + } + } else { + // The default is an object that has only the current type in it + return { + currentActorType, + typePath: 'type', + types: { + [currentActorType]: currentActorType + } + } + } +} diff --git a/system/actor/spc-actor-sheet.js b/system/actor/spc-actor-sheet.js index 1a1b1370..63c6b30c 100644 --- a/system/actor/spc-actor-sheet.js +++ b/system/actor/spc-actor-sheet.js @@ -62,15 +62,6 @@ export class SPCActorSheet extends WoDActor { // Apply new CSS classes to the sheet, if necessary this._applyClasses() - // SPC type options - data.spcTypes = { - mortal: 'WOD5E.Mortal', - vampire: 'WOD5E.VTM.Label', - ghoul: 'WOD5E.VTM.Ghoul', - hunter: 'WOD5E.HTR.Label', - werewolf: 'WOD5E.WTA.Label' - } - // Determine gamesystem based on spcType const spcType = this.actor.system.spcType diff --git a/system/actor/wod-v5-sheet.js b/system/actor/wod-v5-sheet.js index 4eae2e3e..6f93f6ea 100644 --- a/system/actor/wod-v5-sheet.js +++ b/system/actor/wod-v5-sheet.js @@ -6,6 +6,7 @@ import { prepareAttributes } from './scripts/prepare-attributes.js' import { _onHealthChange } from './scripts/on-health-change.js' import { _onWillpowerChange } from './scripts/on-willpower-change.js' import { getActorHeader } from './scripts/get-actor-header.js' +import { getActorTypes } from './scripts/get-actor-types.js' // Roll function import { WOD5eDice } from '../scripts/system-rolls.js' import { _onRoll } from './scripts/roll.js' @@ -70,6 +71,11 @@ export class WoDActor extends ActorSheet { data.headerbg = await getActorHeader(actor) + const actorTypeData = await getActorTypes(actor) + data.currentActorType = actorTypeData.currentActorType + data.actorTypePath = actorTypeData.typePath + data.actorOptions = actorTypeData.types + // Enrich non-header editor fields if (actorData.biography) { data.enrichedBiography = await TextEditor.enrichHTML(actorData.biography) } if (actorData.appearance) { data.enrichedAppearance = await TextEditor.enrichHTML(actorData.appearance) } From 2111d8adcbbb83366cbfddaf8a7fbb82a5a6d39c Mon Sep 17 00:00:00 2001 From: Veilza Date: Thu, 29 Aug 2024 01:01:16 -0500 Subject: [PATCH 04/11] Fix a couple of edge cases / data prep --- .../shared/actors/parts/group/header-profile.hbs | 14 -------------- system/actor/scripts/get-actor-types.js | 4 ++-- template.json | 10 +++++----- 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/display/shared/actors/parts/group/header-profile.hbs b/display/shared/actors/parts/group/header-profile.hbs index 79e0f184..9cd7c3de 100644 --- a/display/shared/actors/parts/group/header-profile.hbs +++ b/display/shared/actors/parts/group/header-profile.hbs @@ -14,17 +14,3 @@
-
-
-
Group Type
-
- {{#if locked}} -
- {{generateLocalizedLabel actor.system.groupType 'grouptype'}} -
- {{else}} - {{> "systems/vtm5e/display/shared/actors/parts/group/type-selector.hbs"}} - {{/if}} -
-
-
diff --git a/system/actor/scripts/get-actor-types.js b/system/actor/scripts/get-actor-types.js index 2b2bcbb8..99940eb6 100644 --- a/system/actor/scripts/get-actor-types.js +++ b/system/actor/scripts/get-actor-types.js @@ -30,13 +30,13 @@ export const getActorTypes = async function (actor) { } } else if (currentActorType === 'spc') { return { - currentActorType, + currentActorType: actor.system.spcType, typePath: 'system.spcType', types: spcTypes } } else if (currentActorType === 'group') { return { - currentActorType, + currentActorType: actor.system.groupType, typePath: 'system.groupType', types: groupTypes } diff --git a/template.json b/template.json index 0eb7328a..121970b3 100644 --- a/template.json +++ b/template.json @@ -842,23 +842,23 @@ } }, "mortal": { - "templates": ["base", "settings"], + "templates": ["base", "vampire_traits", "ghoul_traits", "disciplines", "werewolf_traits", "gifts", "hunter_traits", "edges", "settings"], "gamesystem": "mortal" }, "vampire": { - "templates": ["base", "vampire_traits", "disciplines", "settings"], + "templates": ["base", "vampire_traits", "ghoul_traits", "disciplines", "werewolf_traits", "gifts", "hunter_traits", "edges", "settings"], "gamesystem": "vampire" }, "werewolf": { - "templates": ["base", "werewolf_traits", "renown", "werewolfForms", "gifts", "settings"], + "templates": ["base", "vampire_traits", "ghoul_traits", "disciplines", "werewolf_traits", "gifts", "hunter_traits", "edges", "settings"], "gamesystem": "werewolf" }, "hunter": { - "templates": ["base", "hunter_traits", "edges", "settings"], + "templates": ["base", "vampire_traits", "ghoul_traits", "disciplines", "werewolf_traits", "gifts", "hunter_traits", "edges", "settings"], "gamesystem": "hunter" }, "ghoul": { - "templates": ["base", "vampire_traits", "ghoul_traits", "disciplines", "settings"], + "templates": ["base", "vampire_traits", "ghoul_traits", "disciplines", "werewolf_traits", "gifts", "hunter_traits", "edges", "settings"], "gamesystem": "vampire" }, "group": { From 788c9f3cd9f8a4a8e52a60194ee74c25d8f6d9d6 Mon Sep 17 00:00:00 2001 From: Veilza Date: Thu, 29 Aug 2024 01:09:05 -0500 Subject: [PATCH 05/11] Remove unnecessary type spc/group select fields --- display/shared/actors/parts/group/type-selector.hbs | 5 ----- display/shared/actors/parts/spc/type-selector.hbs | 5 ----- display/shared/actors/spc-sheet.hbs | 5 +---- system/scripts/templates.js | 2 -- 4 files changed, 1 insertion(+), 16 deletions(-) delete mode 100644 display/shared/actors/parts/group/type-selector.hbs delete mode 100644 display/shared/actors/parts/spc/type-selector.hbs diff --git a/display/shared/actors/parts/group/type-selector.hbs b/display/shared/actors/parts/group/type-selector.hbs deleted file mode 100644 index d726f91a..00000000 --- a/display/shared/actors/parts/group/type-selector.hbs +++ /dev/null @@ -1,5 +0,0 @@ -
- -
diff --git a/display/shared/actors/parts/spc/type-selector.hbs b/display/shared/actors/parts/spc/type-selector.hbs deleted file mode 100644 index c3b08452..00000000 --- a/display/shared/actors/parts/spc/type-selector.hbs +++ /dev/null @@ -1,5 +0,0 @@ -
- -
diff --git a/display/shared/actors/spc-sheet.hbs b/display/shared/actors/spc-sheet.hbs index 08659b89..d65c2004 100644 --- a/display/shared/actors/spc-sheet.hbs +++ b/display/shared/actors/spc-sheet.hbs @@ -68,10 +68,7 @@ {{!-- Actor Type Banner --}} {{#if displayBanner}}
-
- {{localize "WOD5E.SPC.Label"}} -
- {{> "systems/vtm5e/display/shared/actors/parts/spc/type-selector.hbs"}} + {{localize "WOD5E.SPC.Label"}}
{{/if}} diff --git a/system/scripts/templates.js b/system/scripts/templates.js index eb89346f..08f78b00 100644 --- a/system/scripts/templates.js +++ b/system/scripts/templates.js @@ -62,11 +62,9 @@ export const preloadHandlebarsTemplates = async function () { 'systems/vtm5e/display/shared/actors/parts/spc/spc-disciplines.hbs', 'systems/vtm5e/display/shared/actors/parts/spc/spc-gifts.hbs', 'systems/vtm5e/display/shared/actors/parts/spc/spc-edges.hbs', - 'systems/vtm5e/display/shared/actors/parts/spc/type-selector.hbs', // Group Sheet Partials 'systems/vtm5e/display/shared/actors/parts/group/navbar.hbs', - 'systems/vtm5e/display/shared/actors/parts/group/type-selector.hbs', 'systems/vtm5e/display/shared/actors/parts/group/group-members.hbs', 'systems/vtm5e/display/shared/actors/parts/group/description.hbs', 'systems/vtm5e/display/shared/actors/parts/group/header-profile.hbs', From a123442410f65104b7b0e8af322c8a60f7cc65c3 Mon Sep 17 00:00:00 2001 From: Veilza Date: Thu, 29 Aug 2024 01:10:37 -0500 Subject: [PATCH 06/11] Fix an issue where the mortal styling was sticking onto SPC sheets --- system/actor/spc-actor-sheet.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system/actor/spc-actor-sheet.js b/system/actor/spc-actor-sheet.js index 63c6b30c..c9f14ee1 100644 --- a/system/actor/spc-actor-sheet.js +++ b/system/actor/spc-actor-sheet.js @@ -357,13 +357,13 @@ export class SPCActorSheet extends WoDActor { // Add a new sheet class depending on the type of sheet if (spcType === 'vampire' || spcType === 'ghoul') { - sheetElement.removeClass('hunter werewolf') + sheetElement.removeClass('hunter werewolf mortal') sheetElement.addClass('vampire') } else if (spcType === 'hunter') { - sheetElement.removeClass('vampire werewolf') + sheetElement.removeClass('vampire werewolf mortal') sheetElement.addClass('hunter') } else if (spcType === 'werewolf') { - sheetElement.removeClass('hunter vampire') + sheetElement.removeClass('hunter vampire mortal') sheetElement.addClass('werewolf') } else { // Default to a mortal sheet From 29a473bee16dfd2c428388b8d7329ce8ef7e2bf7 Mon Sep 17 00:00:00 2001 From: Veilza Date: Thu, 29 Aug 2024 17:53:53 -0500 Subject: [PATCH 07/11] Recode of the definition files for better maintenance in the future --- system/actor/htr/scripts/edges.js | 2 +- system/actor/scripts/experience.js | 2 +- system/actor/scripts/item-roll.js | 2 +- system/actor/scripts/roll.js | 2 +- system/actor/scripts/specialty-bonuses.js | 6 +- system/actor/spc-actor-sheet.js | 8 +-- system/actor/wod-v5-sheet.js | 16 ++--- system/actor/wta/scripts/gifts.js | 2 +- system/api/def/actortypes.js | 32 +--------- system/api/def/attributes.js | 64 ++----------------- system/api/def/base-definition-class.js | 77 +++++++++++++++++++++++ system/api/def/disciplines.js | 62 ++---------------- system/api/def/features.js | 31 +-------- system/api/def/itemtypes.js | 31 +-------- system/api/def/skills.js | 64 ++----------------- system/api/def/systems.js | 31 +-------- system/api/def/were-forms.js | 28 +++------ system/api/dicepool-list.js | 4 +- system/api/generate-localization.js | 10 +-- system/api/wod5e-api.js | 4 +- system/item/item.js | 2 +- system/main.js | 2 +- system/scripts/system-rolls.js | 2 +- system/scripts/willpower-reroll.js | 2 +- 24 files changed, 141 insertions(+), 345 deletions(-) create mode 100644 system/api/def/base-definition-class.js 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) { From c3116c9f43c4fc82ee7c0d6f93259614715f906f Mon Sep 17 00:00:00 2001 From: Veilza Date: Thu, 29 Aug 2024 17:58:21 -0500 Subject: [PATCH 08/11] Linting --- system/api/def/base-definition-class.js | 2 +- system/api/def/were-forms.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/system/api/def/base-definition-class.js b/system/api/def/base-definition-class.js index 8c93de69..a9f11e60 100644 --- a/system/api/def/base-definition-class.js +++ b/system/api/def/base-definition-class.js @@ -43,7 +43,7 @@ export class BaseDefinitionClass { // 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 diff --git a/system/api/def/were-forms.js b/system/api/def/were-forms.js index 25b4e2a3..6aa93f46 100644 --- a/system/api/def/were-forms.js +++ b/system/api/def/were-forms.js @@ -4,7 +4,7 @@ import { BaseDefinitionClass } from './base-definition-class.js' export class WereForms extends BaseDefinitionClass { // Override the initializeLabels method to add extra functionality - static initializeLabels() { + static initializeLabels () { super.initializeLabels() for (const [, value] of Object.entries(this)) { From 77b1919313079fd412d79a96eb3d18e50d86f9e5 Mon Sep 17 00:00:00 2001 From: Veilza Date: Thu, 29 Aug 2024 22:24:12 -0500 Subject: [PATCH 09/11] Add Werewolf ability localization keys --- lang/de/werewolf-de.json | 19 +++++++++++++++++++ lang/en/werewolf-en.json | 19 +++++++++++++++++++ lang/es/werewolf-es.json | 19 +++++++++++++++++++ lang/fr/werewolf-fr.json | 19 +++++++++++++++++++ lang/it/werewolf-it.json | 19 +++++++++++++++++++ lang/pl/werewolf-pl.json | 19 +++++++++++++++++++ lang/pt-BR/werewolf-pt-BR.json | 19 +++++++++++++++++++ lang/ru/werewolf-ru.json | 19 +++++++++++++++++++ lang/template/werewolf-template.json | 19 +++++++++++++++++++ lang/uk/werewolf-uk.json | 19 +++++++++++++++++++ 10 files changed, 190 insertions(+) diff --git a/lang/de/werewolf-de.json b/lang/de/werewolf-de.json index f6b499bb..26e6bd23 100644 --- a/lang/de/werewolf-de.json +++ b/lang/de/werewolf-de.json @@ -10,8 +10,17 @@ "Ban": "Bann", "BlackFury": "Schwarze Furie", "BoneGnawer": "Knochenbeißer", + "_CausesDelirium": "", "ChildrenOfGaia": "Kind von Gaia", + "_CrinosBite": "", + "_CrinosClaws": "", + "_CrinosFrenzy": "", + "_CrinosHealth": "", + "_CrinosMentalTests": "", "CrinosName": "Crinos", + "_CrinosPhysicalTests": "", + "_CrinosRegenerate": "", + "_CrinosSocialTests": "", "CrinosTitle": "Die Kriegsform, Das Monster", "EndFrenzy": "Raserei beenden", "EnterFrenzy": "In Raserei fallen", @@ -29,6 +38,9 @@ "GiftsandRites": "Gaben und Riten", "GiftType": "Gaben-Typ", "GlabroName": "Glabro", + "_GlabroPhysicalTests": "", + "_GlabroRegenerate": "", + "_GlabroSocialTests": "", "GlabroTitle": "Der Fast-Mensch", "GlassWalker": "Glaswandler", "Glory": "Ruhm", @@ -38,7 +50,12 @@ "HasCost": "Hat Kosten", "Hauglosk": "Hauglosk", "HaugloskTest": "Hauglosk-Probe", + "_HispoBite": "", "HispoName": "Hispo", + "_HispoPhysicalTests": "", + "_HispoRegenerate": "", + "_HispoSocialTests": "", + "_HispoStealthTests": "", "HispoTitle": "Der Schreckenswolf", "HomidName": "Homid", "HomidTitle": "Der Mensch", @@ -50,6 +67,7 @@ "LostWolfShiftDown": "Dieser Akteur hat den Wolf in sich verloren und kann nicht in übernatürlicher Form bleiben. Wähle eine Form zum Zurückverwandeln.", "LostWolfWarning": "Dieser Akteur hat 0 Zorn und den Wolf in sich verloren.", "LupusName": "Lupus", + "_LupusSocialTests": "", "LupusTitle": "Der Wolf", "Native": "Native", "NewGift": "Neue Gabe", @@ -73,6 +91,7 @@ "ShadowLord": "Schattenlord", "SilentStrider": "Stiller Wanderer", "SilverFang": "Silberfang", + "_SilverImmunity": "", "_StringGifts": "", "Theurge": "Theurg", "TheWolf": "Der Wolf", diff --git a/lang/en/werewolf-en.json b/lang/en/werewolf-en.json index 16061a4b..77e65d18 100644 --- a/lang/en/werewolf-en.json +++ b/lang/en/werewolf-en.json @@ -10,8 +10,17 @@ "Ban": "Ban", "BlackFury": "Black Fury", "BoneGnawer": "Bone Gnawer", + "CausesDelirium": "Causes Delirium", "ChildrenOfGaia": "Children of Gaia", + "CrinosBite": "Bite: +1 Aggravated", + "CrinosClaws": "Claws: +3", + "CrinosFrenzy": "Frenzy Risk, 1 Willpower/turn", + "CrinosHealth": "Health: +4", + "CrinosMentalTests": "Mental Tests: Auto-failure", "CrinosName": "Crinos", + "CrinosPhysicalTests": "Physical Tests: +4", + "CrinosRegenerate": "Regenerate: 2/Rage Check", + "CrinosSocialTests": "Social Tests: Auto-failure", "CrinosTitle": "The War-Form, The Monster", "EndFrenzy": "End Frenzy", "EnterFrenzy": "Enter Frenzy", @@ -29,6 +38,9 @@ "GiftsandRites": "Gifts & Rites", "GiftType": "Gift Type", "GlabroName": "Glabro", + "GlabroPhysicalTests": "Physical Tests: +2", + "GlabroRegenerate": "Regenerate: 1/Rage Check", + "GlabroSocialTests": "Social Tests: -2", "GlabroTitle": "The Near-Human", "GlassWalker": "Glass Walker", "Glory": "Glory", @@ -38,7 +50,12 @@ "HasCost": "Has Cost", "Hauglosk": "Hauglosk", "HaugloskTest": "Hauglosk Test", + "HispoBite": "Bite: +1 Aggravated", "HispoName": "Hispo", + "HispoPhysicalTests": "(Non-Stealth) Physical Tests: +2", + "HispoRegenerate": "Regenerate: 1/Rage Check", + "HispoSocialTests": "Social Tests: Limited to wolves and Garou", + "HispoStealthTests": "Stealth Tests: -2", "HispoTitle": "The Dire Wolf", "HomidName": "Homid", "HomidTitle": "The Human", @@ -50,6 +67,7 @@ "LostWolfShiftDown": "This actor has Lost the Wolf and cannot remain in supernatural forms. Choose a form to shift down into.", "LostWolfWarning": "This actor has 0 rage and has lost the wolf.", "LupusName": "Lupus", + "LupusSocialTests": "Social Tests: Limited to wolves and Garou", "LupusTitle": "The Wolf", "Native": "Native", "NewGift": "New Gift", @@ -73,6 +91,7 @@ "ShadowLord": "Shadow Lord", "SilentStrider": "Silent Strider", "SilverFang": "Silver fang", + "SilverImmunity": "Silver Immunity", "StringGifts": "{string} Gifts", "Theurge": "Theurge", "TheWolf": "The Wolf", diff --git a/lang/es/werewolf-es.json b/lang/es/werewolf-es.json index 5871d8dc..8e732ece 100644 --- a/lang/es/werewolf-es.json +++ b/lang/es/werewolf-es.json @@ -10,8 +10,17 @@ "_Ban": "", "_BlackFury": "", "_BoneGnawer": "", + "_CausesDelirium": "", "_ChildrenOfGaia": "", + "_CrinosBite": "", + "_CrinosClaws": "", + "_CrinosFrenzy": "", + "_CrinosHealth": "", + "_CrinosMentalTests": "", "CrinosName": "Crinos", + "_CrinosPhysicalTests": "", + "_CrinosRegenerate": "", + "_CrinosSocialTests": "", "_CrinosTitle": "", "_EndFrenzy": "", "_EnterFrenzy": "", @@ -29,6 +38,9 @@ "_GiftsandRites": "", "_GiftType": "", "GlabroName": "Glabro", + "_GlabroPhysicalTests": "", + "_GlabroRegenerate": "", + "_GlabroSocialTests": "", "_GlabroTitle": "", "_GlassWalker": "", "Glory": "Gloria", @@ -38,7 +50,12 @@ "HasCost": "Tiene coste", "Hauglosk": "Hauglosk", "_HaugloskTest": "", + "_HispoBite": "", "HispoName": "Hispo", + "_HispoPhysicalTests": "", + "_HispoRegenerate": "", + "_HispoSocialTests": "", + "_HispoStealthTests": "", "_HispoTitle": "", "HomidName": "Homid", "HomidTitle": "El humano", @@ -50,6 +67,7 @@ "_LostWolfShiftDown": "", "_LostWolfWarning": "", "LupusName": "Lupus", + "_LupusSocialTests": "", "_LupusTitle": "", "_Native": "", "_NewGift": "", @@ -73,6 +91,7 @@ "_ShadowLord": "", "_SilentStrider": "", "_SilverFang": "", + "_SilverImmunity": "", "_StringGifts": "", "_Theurge": "", "TheWolf": "El lobo", diff --git a/lang/fr/werewolf-fr.json b/lang/fr/werewolf-fr.json index 21f653b8..4aa30d03 100644 --- a/lang/fr/werewolf-fr.json +++ b/lang/fr/werewolf-fr.json @@ -10,8 +10,17 @@ "_Ban": "", "_BlackFury": "", "_BoneGnawer": "", + "_CausesDelirium": "", "_ChildrenOfGaia": "", + "_CrinosBite": "", + "_CrinosClaws": "", + "_CrinosFrenzy": "", + "_CrinosHealth": "", + "_CrinosMentalTests": "", "_CrinosName": "", + "_CrinosPhysicalTests": "", + "_CrinosRegenerate": "", + "_CrinosSocialTests": "", "_CrinosTitle": "", "_EndFrenzy": "", "_EnterFrenzy": "", @@ -29,6 +38,9 @@ "_GiftsandRites": "", "_GiftType": "", "_GlabroName": "", + "_GlabroPhysicalTests": "", + "_GlabroRegenerate": "", + "_GlabroSocialTests": "", "_GlabroTitle": "", "_GlassWalker": "", "_Glory": "", @@ -38,7 +50,12 @@ "_HasCost": "", "_Hauglosk": "", "_HaugloskTest": "", + "_HispoBite": "", "_HispoName": "", + "_HispoPhysicalTests": "", + "_HispoRegenerate": "", + "_HispoSocialTests": "", + "_HispoStealthTests": "", "_HispoTitle": "", "_HomidName": "", "_HomidTitle": "", @@ -50,6 +67,7 @@ "_LostWolfShiftDown": "", "_LostWolfWarning": "", "_LupusName": "", + "_LupusSocialTests": "", "_LupusTitle": "", "_Native": "", "_NewGift": "", @@ -73,6 +91,7 @@ "_ShadowLord": "", "_SilentStrider": "", "_SilverFang": "", + "_SilverImmunity": "", "_StringGifts": "", "_Theurge": "", "_TheWolf": "", diff --git a/lang/it/werewolf-it.json b/lang/it/werewolf-it.json index 1a72358e..f02f7cb0 100644 --- a/lang/it/werewolf-it.json +++ b/lang/it/werewolf-it.json @@ -10,8 +10,17 @@ "Ban": "Tabù", "BlackFury": "Furie Nere", "BoneGnawer": "Rosicchia Ossa", + "_CausesDelirium": "", "ChildrenOfGaia": "Figli di Gaia", + "_CrinosBite": "", + "_CrinosClaws": "", + "_CrinosFrenzy": "", + "_CrinosHealth": "", + "_CrinosMentalTests": "", "CrinosName": "Crinos", + "_CrinosPhysicalTests": "", + "_CrinosRegenerate": "", + "_CrinosSocialTests": "", "CrinosTitle": "La forma da guerra, il Mostro", "EndFrenzy": "Esci Dalla frenesia", "EnterFrenzy": "Entra in Frenesia", @@ -29,6 +38,9 @@ "GiftsandRites": "Doni e Riti", "GiftType": "Tipo di Dono", "GlabroName": "Glabro", + "_GlabroPhysicalTests": "", + "_GlabroRegenerate": "", + "_GlabroSocialTests": "", "GlabroTitle": "Il Quasi-Umano", "GlassWalker": "Calpestavetro", "Glory": "Gloria", @@ -38,7 +50,12 @@ "HasCost": "Ha un costo", "Hauglosk": "Hauglosk", "HaugloskTest": "Prova di Hauglosk", + "_HispoBite": "", "HispoName": "Hispo", + "_HispoPhysicalTests": "", + "_HispoRegenerate": "", + "_HispoSocialTests": "", + "_HispoStealthTests": "", "HispoTitle": "L'Enocione", "HomidName": "Homid", "HomidTitle": "L'umano", @@ -50,6 +67,7 @@ "LostWolfShiftDown": "Questo personaggio ha perso il lupo e non può rimanere nella sua forma sovrannaturale. Scegli una forma a cui scendere", "LostWolfWarning": "Questo personaggio ha furia zero e ha perso il lupo", "LupusName": "Lupus", + "_LupusSocialTests": "", "LupusTitle": "Il Lupo", "Native": "Nativo", "NewGift": "Nuovo Dono", @@ -73,6 +91,7 @@ "ShadowLord": "Signori dell'Ombra", "SilentStrider": "Viandanti Silenti", "SilverFang": "Zanne d'Argento", + "_SilverImmunity": "", "_StringGifts": "", "Theurge": "Theurge", "TheWolf": "Il Lupo", diff --git a/lang/pl/werewolf-pl.json b/lang/pl/werewolf-pl.json index efd77e68..71b3d1f8 100644 --- a/lang/pl/werewolf-pl.json +++ b/lang/pl/werewolf-pl.json @@ -10,8 +10,17 @@ "Ban": "Zakaz", "BlackFury": "Czarne Furie", "BoneGnawer": "Gnatożuje", + "_CausesDelirium": "", "ChildrenOfGaia": "Dzieci Gai", + "_CrinosBite": "", + "_CrinosClaws": "", + "_CrinosFrenzy": "", + "_CrinosHealth": "", + "_CrinosMentalTests": "", "CrinosName": "Crinos", + "_CrinosPhysicalTests": "", + "_CrinosRegenerate": "", + "_CrinosSocialTests": "", "CrinosTitle": "Potworna forma bojowa", "EndFrenzy": "Zakończ furię", "EnterFrenzy": "Wpadnij w furię", @@ -29,6 +38,9 @@ "GiftsandRites": "Dary i Rytuały", "GiftType": "Rodzaj daru", "GlabroName": "Glabro", + "_GlabroPhysicalTests": "", + "_GlabroRegenerate": "", + "_GlabroSocialTests": "", "GlabroTitle": "Prawie człowiek", "GlassWalker": "Kroczący po Szkle", "Glory": "Chwała", @@ -38,7 +50,12 @@ "HasCost": "Posiada koszt", "Hauglosk": "Hauglosk", "HaugloskTest": "Test Hauglosk", + "_HispoBite": "", "HispoName": "Hispo", + "_HispoPhysicalTests": "", + "_HispoRegenerate": "", + "_HispoSocialTests": "", + "_HispoStealthTests": "", "HispoTitle": "Canis dirus", "HomidName": "Homid", "HomidTitle": "Człowiek", @@ -50,6 +67,7 @@ "LostWolfShiftDown": "Ten aktor utracił wilka i nie może utrzymać nadnaturalnej formy. Wybierz formę, którą chcesz przyjąć.", "LostWolfWarning": "Ten aktor ma 0 Szału i utracił wilka.", "LupusName": "Lupus", + "_LupusSocialTests": "", "LupusTitle": "Wilk", "Native": "Ogólne", "NewGift": "Nowy Dar", @@ -73,6 +91,7 @@ "ShadowLord": "Władcy Cienia", "SilentStrider": "Milczący Wędrowcy", "SilverFang": "Srebne Kły", + "_SilverImmunity": "", "_StringGifts": "", "Theurge": "Teurg", "TheWolf": "Wilk", diff --git a/lang/pt-BR/werewolf-pt-BR.json b/lang/pt-BR/werewolf-pt-BR.json index 4562980a..6396ea71 100644 --- a/lang/pt-BR/werewolf-pt-BR.json +++ b/lang/pt-BR/werewolf-pt-BR.json @@ -10,8 +10,17 @@ "_Ban": "", "_BlackFury": "", "_BoneGnawer": "", + "_CausesDelirium": "", "_ChildrenOfGaia": "", + "_CrinosBite": "", + "_CrinosClaws": "", + "_CrinosFrenzy": "", + "_CrinosHealth": "", + "_CrinosMentalTests": "", "_CrinosName": "", + "_CrinosPhysicalTests": "", + "_CrinosRegenerate": "", + "_CrinosSocialTests": "", "_CrinosTitle": "", "_EndFrenzy": "", "_EnterFrenzy": "", @@ -29,6 +38,9 @@ "_GiftsandRites": "", "_GiftType": "", "_GlabroName": "", + "_GlabroPhysicalTests": "", + "_GlabroRegenerate": "", + "_GlabroSocialTests": "", "_GlabroTitle": "", "_GlassWalker": "", "_Glory": "", @@ -38,7 +50,12 @@ "_HasCost": "", "_Hauglosk": "", "_HaugloskTest": "", + "_HispoBite": "", "_HispoName": "", + "_HispoPhysicalTests": "", + "_HispoRegenerate": "", + "_HispoSocialTests": "", + "_HispoStealthTests": "", "_HispoTitle": "", "_HomidName": "", "_HomidTitle": "", @@ -50,6 +67,7 @@ "_LostWolfShiftDown": "", "_LostWolfWarning": "", "_LupusName": "", + "_LupusSocialTests": "", "_LupusTitle": "", "_Native": "", "_NewGift": "", @@ -73,6 +91,7 @@ "_ShadowLord": "", "_SilentStrider": "", "_SilverFang": "", + "_SilverImmunity": "", "_StringGifts": "", "_Theurge": "", "_TheWolf": "", diff --git a/lang/ru/werewolf-ru.json b/lang/ru/werewolf-ru.json index 96fff2e3..b94159f3 100644 --- a/lang/ru/werewolf-ru.json +++ b/lang/ru/werewolf-ru.json @@ -10,8 +10,17 @@ "Ban": "Запрет", "BlackFury": "Чёрные фурии", "BoneGnawer": "Костегрызы", + "_CausesDelirium": "", "ChildrenOfGaia": "Дети Гайи", + "_CrinosBite": "", + "_CrinosClaws": "", + "_CrinosFrenzy": "", + "_CrinosHealth": "", + "_CrinosMentalTests": "", "_CrinosName": "", + "_CrinosPhysicalTests": "", + "_CrinosRegenerate": "", + "_CrinosSocialTests": "", "CrinosTitle": "Полу-волчья боевая форма", "EndFrenzy": "Прекратить Безумие", "EnterFrenzy": "Впасть в Безумие", @@ -29,6 +38,9 @@ "GiftsandRites": "Дары и Обряды", "GiftType": "Тип дара", "GlabroName": "Глабро", + "_GlabroPhysicalTests": "", + "_GlabroRegenerate": "", + "_GlabroSocialTests": "", "GlabroTitle": "Почти человеческая форма", "GlassWalker": "Ходящие по стеклу", "Glory": "Слава", @@ -38,7 +50,12 @@ "_HasCost": "", "Hauglosk": "Хауглоск", "HaugloskTest": "Проверка Хауглоск", + "_HispoBite": "", "HispoName": "Хиспо", + "_HispoPhysicalTests": "", + "_HispoRegenerate": "", + "_HispoSocialTests": "", + "_HispoStealthTests": "", "HispoTitle": "Почти волчья форма", "HomidName": "Хомид", "HomidTitle": "Человек", @@ -50,6 +67,7 @@ "_LostWolfShiftDown": "", "_LostWolfWarning": "", "LupusName": "Люпус", + "_LupusSocialTests": "", "LupusTitle": "Волчья форма", "Native": "Коренной", "NewGift": "Новый дар", @@ -73,6 +91,7 @@ "ShadowLord": "Теневые владыки", "SilentStrider": "Безмолвные странники", "SilverFang": "Серебряные клыки", + "_SilverImmunity": "", "_StringGifts": "", "Theurge": "Теург", "TheWolf": "Волк", diff --git a/lang/template/werewolf-template.json b/lang/template/werewolf-template.json index 71cb47c4..c70854a7 100644 --- a/lang/template/werewolf-template.json +++ b/lang/template/werewolf-template.json @@ -10,8 +10,17 @@ "_Ban": "", "_BlackFury": "", "_BoneGnawer": "", + "_CausesDelirium": "", "_ChildrenOfGaia": "", + "_CrinosBite": "", + "_CrinosClaws": "", + "_CrinosFrenzy": "", + "_CrinosHealth": "", + "_CrinosMentalTests": "", "_CrinosName": "", + "_CrinosPhysicalTests": "", + "_CrinosRegenerate": "", + "_CrinosSocialTests": "", "_CrinosTitle": "", "_EndFrenzy": "", "_EnterFrenzy": "", @@ -29,6 +38,9 @@ "_GiftsandRites": "", "_GiftType": "", "_GlabroName": "", + "_GlabroPhysicalTests": "", + "_GlabroRegenerate": "", + "_GlabroSocialTests": "", "_GlabroTitle": "", "_GlassWalker": "", "_Glory": "", @@ -38,7 +50,12 @@ "_HasCost": "", "_Hauglosk": "", "_HaugloskTest": "", + "_HispoBite": "", "_HispoName": "", + "_HispoPhysicalTests": "", + "_HispoRegenerate": "", + "_HispoSocialTests": "", + "_HispoStealthTests": "", "_HispoTitle": "", "_HomidName": "", "_HomidTitle": "", @@ -50,6 +67,7 @@ "_LostWolfShiftDown": "", "_LostWolfWarning": "", "_LupusName": "", + "_LupusSocialTests": "", "_LupusTitle": "", "_Native": "", "_NewGift": "", @@ -73,6 +91,7 @@ "_ShadowLord": "", "_SilentStrider": "", "_SilverFang": "", + "_SilverImmunity": "", "_StringGifts": "", "_Theurge": "", "_TheWolf": "", diff --git a/lang/uk/werewolf-uk.json b/lang/uk/werewolf-uk.json index cadf47d6..21b66bc2 100644 --- a/lang/uk/werewolf-uk.json +++ b/lang/uk/werewolf-uk.json @@ -10,8 +10,17 @@ "Ban": "Засудження", "_BlackFury": "", "_BoneGnawer": "", + "_CausesDelirium": "", "_ChildrenOfGaia": "", + "_CrinosBite": "", + "_CrinosClaws": "", + "_CrinosFrenzy": "", + "_CrinosHealth": "", + "_CrinosMentalTests": "", "_CrinosName": "", + "_CrinosPhysicalTests": "", + "_CrinosRegenerate": "", + "_CrinosSocialTests": "", "CrinosTitle": "Бойова форма, Монстр", "EndFrenzy": "Завершити Скаженість", "EnterFrenzy": "Увійти в Скаженість", @@ -29,6 +38,9 @@ "GiftsandRites": "Дари й Обряди", "GiftType": "Тип Дару", "_GlabroName": "", + "_GlabroPhysicalTests": "", + "_GlabroRegenerate": "", + "_GlabroSocialTests": "", "GlabroTitle": "Напівлюдина", "_GlassWalker": "", "Glory": "Слава", @@ -38,7 +50,12 @@ "_HasCost": "", "_Hauglosk": "", "HaugloskTest": "Перевірка Hauglosk", + "_HispoBite": "", "_HispoName": "", + "_HispoPhysicalTests": "", + "_HispoRegenerate": "", + "_HispoSocialTests": "", + "_HispoStealthTests": "", "HispoTitle": "Лютововк", "_HomidName": "", "HomidTitle": "Людина", @@ -50,6 +67,7 @@ "_LostWolfShiftDown": "", "_LostWolfWarning": "", "_LupusName": "", + "_LupusSocialTests": "", "LupusTitle": "Вовк", "_Native": "", "NewGift": "Новий Дар", @@ -73,6 +91,7 @@ "_ShadowLord": "", "_SilentStrider": "", "_SilverFang": "", + "_SilverImmunity": "", "_StringGifts": "", "_Theurge": "", "TheWolf": "Вовк", From b7ad8c6268873b4157dc5e426f9aac5ffd642fae Mon Sep 17 00:00:00 2001 From: Veilza Date: Thu, 29 Aug 2024 23:28:29 -0500 Subject: [PATCH 10/11] Remove forms from template and implement them with localization in their own dataprep file --- display/wta/actors/parts/forms.hbs | 2 +- system/actor/wta/scripts/forms.js | 45 +++++---- system/actor/wta/scripts/prepare-data.js | 31 ++++++ system/actor/wta/werewolf-actor-sheet.js | 6 +- system/api/def/were-forms.js | 48 +++++---- template.json | 121 +---------------------- 6 files changed, 90 insertions(+), 163 deletions(-) diff --git a/display/wta/actors/parts/forms.hbs b/display/wta/actors/parts/forms.hbs index b40932b7..fb82d1bc 100644 --- a/display/wta/actors/parts/forms.hbs +++ b/display/wta/actors/parts/forms.hbs @@ -2,7 +2,7 @@
{{#each actor.system.forms as |form id|}}
- +
diff --git a/system/actor/wta/scripts/forms.js b/system/actor/wta/scripts/forms.js index 5772fc12..5f70ae37 100644 --- a/system/actor/wta/scripts/forms.js +++ b/system/actor/wta/scripts/forms.js @@ -14,7 +14,7 @@ export const _onLostTheWolf = async function (actor) { if (actor.system.lostTheWolf) return // Update the listTheWolf key - actor.update({ 'system.lostTheWolf': true }) + await actor.update({ 'system.lostTheWolf': true }) // Define the template to be used const template = ` @@ -29,19 +29,19 @@ export const _onLostTheWolf = async function (actor) { homid: { label: 'Homid', callback: async () => { - actor.update({ 'system.activeForm': 'homid' }) + await actor.update({ 'system.activeForm': 'homid' }) } }, lupus: { label: 'Lupus', callback: async () => { - actor.update({ 'system.activeForm': 'lupus' }) + await actor.update({ 'system.activeForm': 'lupus' }) } } } new Dialog({ - title: 'Lost the Wolf', + title: game.i18n.localize('WOD5E.WTA.LostTheWolf'), content: template, buttons, default: 'homid' @@ -62,21 +62,21 @@ export const _onShiftForm = async function (event) { switch (form) { case 'glabro': - this.handleFormChange(actor, 'glabro', 1) + await handleFormChange(actor, 'glabro', 1) break case 'crinos': - this.handleFormChange(actor, 'crinos', 2) + await handleFormChange(actor, 'crinos', 2) break case 'hispo': - this.handleFormChange(actor, 'hispo', 1) + await handleFormChange(actor, 'hispo', 1) break case 'lupus': - actor.update({ 'system.activeForm': 'lupus' }) - this._onFormToChat(event) + await actor.update({ 'system.activeForm': 'lupus' }) + await _onFormToChat(event, actor) break default: - actor.update({ 'system.activeForm': 'homid' }) - this._onFormToChat(event) + await actor.update({ 'system.activeForm': 'homid' }) + await _onFormToChat(event, actor) } } @@ -86,11 +86,10 @@ export const handleFormChange = async function (actor, form, diceCount) { // If automatedRage is turned on and the actor's rage is 0, present a warning if (game.settings.get('vtm5e', 'automatedRage') && actor.system.rage.value === 0) { - this._onInsufficientRage(form) + _onInsufficientRage(actor, form) } else { // Variables const formData = actor.system.forms[form] - const flavor = formData.description // Handle getting any situational modifiers const activeBonuses = await getActiveBonuses({ @@ -99,17 +98,17 @@ export const handleFormChange = async function (actor, form, diceCount) { }) // Roll the rage dice necessary - WOD5eDice.Roll({ + await WOD5eDice.Roll({ advancedDice: diceCount + activeBonuses.totalValue, title: form, + flavor: formData.description, actor, data: actor.system, - flavor, quickRoll: true, disableBasicDice: true, decreaseRage: true, selectors, - callback: (err, rollData) => { + callback: async (err, rollData) => { if (err) console.log(err) // Calculate the number of rage dice the actor has left @@ -118,25 +117,25 @@ export const handleFormChange = async function (actor, form, diceCount) { // If rolling rage dice didn't reduce the actor to 0 rage, then update the current form if (newRageAmount > 0) { - actor.update({ 'system.activeForm': form }) + await actor.update({ 'system.activeForm': form }) } } }) } } -export const _onFormToChat = async function (event) { +export const _onFormToChat = async function (event, originActor) { event.preventDefault() // Top-level variables - const actor = this.actor + const actor = originActor || this.actor const element = event.currentTarget const dataset = Object.assign({}, element.dataset) const form = dataset.form // Secondary variables const formData = actor.system.forms[form] - const formName = formData.name + const formName = formData.displayName const formDescription = formData.description ? `

${formData.description}

` : '' const formAbilities = formData.attributes @@ -171,7 +170,7 @@ export const _onFormEdit = async function (event) { // Secondary variables const formData = actor.system.forms[form] - const formName = formData.name + const formName = formData.displayName const formDescription = formData.description // Variables yet to be defined @@ -193,7 +192,7 @@ export const _onFormEdit = async function (event) { callback: async (html) => { const newDescription = html.find('#formDescription')[0].value - actor.update({ [`system.forms.${form}.description`]: newDescription }) + await actor.update({ [`system.forms.${form}.description`]: newDescription }) } }, cancel: { @@ -232,7 +231,7 @@ export const _onInsufficientRage = async function (actor, form) { icon: '', label: 'Shift Anyway', callback: async () => { - actor.update({ 'system.activeForm': form }) + await actor.update({ 'system.activeForm': form }) } }, cancel: { diff --git a/system/actor/wta/scripts/prepare-data.js b/system/actor/wta/scripts/prepare-data.js index da62cb4d..78b2517b 100644 --- a/system/actor/wta/scripts/prepare-data.js +++ b/system/actor/wta/scripts/prepare-data.js @@ -75,3 +75,34 @@ export const prepareRiteData = async function (sheetData) { return rites } + +// Handle form data +export const prepareFormData = async function (sheetData) { + const wereForms = WOD5E.WereForms.getList({}) + + // Fields to keep from the existing data + const fieldsToKeep = [ + 'description' + ] + + // Merge new form data with existing form data + const mergedForms = {} + for (const formKey in wereForms) { + if (Object.prototype.hasOwnProperty.call(wereForms, formKey)) { + // Start with the new form data + mergedForms[formKey] = { ...wereForms[formKey] } + + // Check if the existing form data has additional fields + if (sheetData.actor.system.forms[formKey]) { + // Add fields to keep from the existing form data + for (const field of fieldsToKeep) { + if (sheetData.actor.system.forms[formKey][field] !== undefined) { + mergedForms[formKey][field] = sheetData.actor.system.forms[formKey][field] + } + } + } + } + } + + return mergedForms +} diff --git a/system/actor/wta/werewolf-actor-sheet.js b/system/actor/wta/werewolf-actor-sheet.js index f96442d1..ed5c7b1c 100644 --- a/system/actor/wta/werewolf-actor-sheet.js +++ b/system/actor/wta/werewolf-actor-sheet.js @@ -1,11 +1,12 @@ /* global game, foundry */ import { WoDActor } from '../wod-v5-sheet.js' -import { _prepareWerewolfItems, prepareGiftData, prepareRiteData } from './scripts/prepare-data.js' +import { _prepareWerewolfItems, prepareGiftData, prepareRiteData, prepareFormData } from './scripts/prepare-data.js' import { _onAddGift, _onRemoveGift, _onGiftToChat } from './scripts/gifts.js' import { _onBeginFrenzy, _onEndFrenzy } from './scripts/frenzy.js' import { _onShiftForm, _onFormToChat, _onFormEdit } from './scripts/forms.js' import { _onHaranoRoll, _onHaugloskRoll } from './scripts/balance.js' +import { _onLostTheWolf } from './scripts/forms.js' /** * Extend the basic ActorSheet with some very simple modifications @@ -44,6 +45,7 @@ export class WerewolfActorSheet extends WoDActor { // Prepare gifts and rites data data.actor.system.gifts = await prepareGiftData(data) data.actor.system.rites = await prepareRiteData(data) + data.actor.system.forms = await prepareFormData(data) // If the actor's rage is above 0, make sure they aren't in "lost the wolf" form if (data.actor.system.rage.value > 0 && data.actor.system.lostTheWolf) { @@ -53,7 +55,7 @@ export class WerewolfActorSheet extends WoDActor { // Check if the actor's rage is 0, they're in a supernatural form, and they haven't already lost the wolf const supernaturalForms = ['glabro', 'crinos', 'hispo'] if ((data.actor.system.rage.value === 0) && (supernaturalForms.indexOf(data.actor.system.activeForm) > -1)) { - this._onLostTheWolf() + _onLostTheWolf(this.actor) } return data diff --git a/system/api/def/were-forms.js b/system/api/def/were-forms.js index 6aa93f46..da40fb46 100644 --- a/system/api/def/were-forms.js +++ b/system/api/def/were-forms.js @@ -11,6 +11,11 @@ export class WereForms extends BaseDefinitionClass { if (typeof value === 'object' && value !== null && !Array.isArray(value)) { // Initialize the nickname label too value.nickname = game.i18n.localize(value.nickname) + + // Localize the Werewolf attributes + value.attributes = value.attributes.map(attribute => { + return game.i18n.localize(attribute) + }) } } } @@ -24,14 +29,19 @@ export class WereForms extends BaseDefinitionClass { label: 'WOD5E.WTA.HomidName', nickname: 'WOD5E.WTA.HomidTitle', cost: 0, - attributes: ['Silver Immunity'] + attributes: [ + 'WOD5E.WTA.SilverImmunity' + ] } static lupus = { label: 'WOD5E.WTA.LupusName', nickname: 'WOD5E.WTA.LupusTitle', cost: 0, - attributes: ['Silver Immunity', 'Social Tests: Limited to wolves and Garou'] + attributes: [ + 'WOD5E.WTA.SilverImmunity', + 'WOD5E.WTA.LupusSocialTests' + ] } static hispo = { @@ -39,11 +49,11 @@ export class WereForms extends BaseDefinitionClass { nickname: 'WOD5E.WTA.HispoTitle', cost: 1, attributes: [ - '(Non-Stealth) Physical Tests: +2', - 'Stealth Tests: -2', - 'Social Tests: Limited to wolves and Garou', - 'Regenerate: 1/Rage Check', - 'Bite: +1 Aggravated' + 'WOD5E.WTA.HispoPhysicalTests', + 'WOD5E.WTA.HispoStealthTests', + 'WOD5E.WTA.HispoSocialTests', + 'WOD5E.WTA.HispoRegenerate', + 'WOD5E.WTA.HispoBite' ], bonuses: [ { @@ -74,7 +84,11 @@ export class WereForms extends BaseDefinitionClass { label: 'WOD5E.WTA.GlabroName', nickname: 'WOD5E.WTA.GlabroTitle', cost: 1, - attributes: ['Physical Tests: +2', 'Social Tests: -2', 'Regenerate: 1/Rage Check'], + attributes: [ + 'WOD5E.WTA.GlabroPhysicalTests', + 'WOD5E.WTA.GlabroSocialTests', + 'WOD5E.WTA.GlabroRegenerate' + ], bonuses: [ { source: 'WOD5E.WTA.GlabroName', @@ -104,15 +118,15 @@ export class WereForms extends BaseDefinitionClass { nickname: 'WOD5E.WTA.CrinosTitle', cost: 2, attributes: [ - 'Frenzy Risk, 1 Willpower/turn', - 'Physical Tests: +4', - 'Health: +4', - 'Social Tests: Auto-failure', - 'Mental Tests: Auto-failure', - 'Regenerate: 2/Rage Check', - 'Claws: +3', - 'Bite: +1 Aggravated', - 'Causes Delirium' + 'WOD5E.WTA.CrinosFrenzy', + 'WOD5E.WTA.CrinosPhysicalTests', + 'WOD5E.WTA.CrinosHealth', + 'WOD5E.WTA.CrinosSocialTests', + 'WOD5E.WTA.CrinosMentalTests', + 'WOD5E.WTA.CrinosRegenerate', + 'WOD5E.WTA.CrinosClaws', + 'WOD5E.WTA.CrinosBite', + 'WOD5E.WTA.CausesDelirium' ], bonuses: [ { diff --git a/template.json b/template.json index 121970b3..688ff09f 100644 --- a/template.json +++ b/template.json @@ -529,126 +529,7 @@ } }, "werewolfForms": { - "activeForm": "homid", - "forms": { - "homid": { - "name": "WOD5E.WTA.HomidName", - "nickname": "WOD5E.WTA.HomidTitle", - "cost": 0, - "description": "", - "attributes": [ - "Silver Immunity" - ] - }, - "glabro": { - "name": "WOD5E.WTA.GlabroName", - "nickname": "WOD5E.WTA.GlabroTitle", - "cost": 1, - "description": "", - "attributes": [ - "Physical Tests: +2", - "Social Tests: -2", - "Regenerate: 1/Rage Check" - ], - "bonuses": [ - { - "source": "WOD5E.WTA.GlabroName", - "value": 2, - "paths": ["attributes.strength", "attributes.dexterity", "attributes.stamina"], - "activeWhen": { - "check": "isEqual", - "path": "activeForm", - "value": "glabro" - } - }, - { - "source": "WOD5E.WTA.GlabroName", - "value": -2, - "paths": ["attributes.charisma", "attributes.manipulation", "attributes.composure"], - "activeWhen": { - "check": "isEqual", - "path": "activeForm", - "value": "glabro" - } - } - ] - }, - "crinos": { - "name": "WOD5E.WTA.CrinosName", - "nickname": "WOD5E.WTA.CrinosTitle", - "cost": 2, - "description": "", - "attributes": [ - "Frenzy Risk, 1 Willpower/turn", - "Physical Tests: +4", - "Health: +4", - "Social Tests: Auto-failure", - "Mental Tests: Auto-failure", - "Regenerate: 2/Rage Check", - "Claws: +3", - "Bite: +1 Aggravated", - "Causes Delirium" - ], - "bonuses": [ - { - "source": "WOD5E.WTA.CrinosName", - "value": 4, - "paths": ["attributes.strength", "attributes.dexterity", "attributes.stamina"], - "activeWhen": { - "check": "isEqual", - "path": "activeForm", - "value": "crinos" - } - } - ] - }, - "hispo": { - "name": "WOD5E.WTA.HispoName", - "nickname": "WOD5E.WTA.HispoTitle", - "cost": 1, - "description": "", - "attributes": [ - "(Non-Stealth) Physical Tests: +2", - "Stealth Tests: -2", - "Social Tests: Limited to wolves and Garou", - "Regenerate: 1/Rage Check", - "Bite: +1 Aggravated" - ], - "bonuses": [ - { - "source": "WOD5E.WTA.HispoName", - "value": 2, - "paths": ["attributes.strength", "attributes.dexterity", "attributes.stamina"], - "unless": ["skills.stealth"], - "activeWhen": { - "check": "isEqual", - "path": "activeForm", - "value": "hispo" - } - }, - { - "source": "WOD5E.WTA.HispoName", - "value": -2, - "paths": ["skills.stealth"], - "activeWhen": { - "check": "isEqual", - "path": "activeForm", - "value": "hispo" - } - } - ] - }, - "lupus": { - "name": "WOD5E.WTA.LupusName", - "nickname": "WOD5E.WTA.LupusTitle", - "cost": 0, - "description": "", - "attributes": [ - "Silver Immunity", - "Social Tests: Limited to wolves and Garou" - ] - } - } + "activeForm": "homid" }, "gifts": { "gifts": { From 49862b3b38a939bb2d0e4aa21fe03e2206c2b821 Mon Sep 17 00:00:00 2001 From: Veilza Date: Fri, 30 Aug 2024 01:09:22 -0500 Subject: [PATCH 11/11] Fix duplicate import --- system/actor/wta/werewolf-actor-sheet.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/system/actor/wta/werewolf-actor-sheet.js b/system/actor/wta/werewolf-actor-sheet.js index ed5c7b1c..beb81484 100644 --- a/system/actor/wta/werewolf-actor-sheet.js +++ b/system/actor/wta/werewolf-actor-sheet.js @@ -4,9 +4,8 @@ import { WoDActor } from '../wod-v5-sheet.js' import { _prepareWerewolfItems, prepareGiftData, prepareRiteData, prepareFormData } from './scripts/prepare-data.js' import { _onAddGift, _onRemoveGift, _onGiftToChat } from './scripts/gifts.js' import { _onBeginFrenzy, _onEndFrenzy } from './scripts/frenzy.js' -import { _onShiftForm, _onFormToChat, _onFormEdit } from './scripts/forms.js' +import { _onShiftForm, _onFormToChat, _onFormEdit, _onLostTheWolf } from './scripts/forms.js' import { _onHaranoRoll, _onHaugloskRoll } from './scripts/balance.js' -import { _onLostTheWolf } from './scripts/forms.js' /** * Extend the basic ActorSheet with some very simple modifications