Changed generalConfig.tiers to be number based

This commit is contained in:
WBHarry 2025-07-19 03:10:16 +02:00
parent 51ba94c83a
commit 721eb347db
7 changed files with 20 additions and 41 deletions

View file

@ -1243,10 +1243,10 @@
},
"Tiers": {
"singular": "Tier",
"tier1": "Tier 1",
"tier2": "Tier 2",
"tier3": "Tier 3",
"tier4": "Tier 4"
"1": "Tier 1",
"2": "Tier 2",
"3": "Tier 3",
"4": "Tier 4"
},
"Trait": {
"single": "Trait",

View file

@ -103,7 +103,7 @@ export default class BeastformDialog extends HandlebarsApplicationMixin(Applicat
const compendiumBeastforms = await game.packs.get(`daggerheart.beastforms`)?.getDocuments();
context.beastformTiers = [...(compendiumBeastforms ? compendiumBeastforms : []), ...game.items].reduce(
(acc, x) => {
const tier = CONFIG.DH.GENERAL.tiersAlternate[x.system.tier];
const tier = CONFIG.DH.GENERAL.tiers[x.system.tier];
if (x.type !== 'beastform' || tier.id > this.configData.tierLimit) return acc;
if (!acc[tier.id]) acc[tier.id] = { label: game.i18n.localize(tier.label), values: {} };

View file

@ -114,7 +114,7 @@ export default class DHActionConfig extends DaggerheartSheet(ApplicationV2) {
const settingsTiers = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.LevelTiers).tiers;
context.tierOptions = [
{ key: 1, label: game.i18n.localize('DAGGERHEART.GENERAL.Tiers.tier1') },
{ key: 1, label: game.i18n.localize('DAGGERHEART.GENERAL.Tiers.1') },
...Object.values(settingsTiers).map(x => ({ key: x.tier, label: x.name }))
];

View file

@ -258,44 +258,21 @@ export const deathMoves = {
};
export const tiers = {
tier1: {
id: 'tier1',
label: 'DAGGERHEART.GENERAL.Tiers.tier1',
value: 1
},
tier2: {
id: 'tier2',
label: 'DAGGERHEART.GENERAL.Tiers.tier2',
value: 2
},
tier3: {
id: 'tier3',
label: 'DAGGERHEART.GENERAL.Tiers.tier3',
value: 3
},
tier4: {
id: 'tier4',
label: 'DAGGERHEART.GENERAL.Tiers.tier4',
value: 4
}
};
export const tiersAlternate = {
1: {
id: 1,
label: 'DAGGERHEART.GENERAL.Tiers.tier1'
label: 'DAGGERHEART.GENERAL.Tiers.1'
},
2: {
id: 2,
label: 'DAGGERHEART.GENERAL.Tiers.tier2'
label: 'DAGGERHEART.GENERAL.Tiers.2'
},
3: {
id: 3,
label: 'DAGGERHEART.GENERAL.Tiers.tier3'
label: 'DAGGERHEART.GENERAL.Tiers.3'
},
4: {
id: 4,
label: 'DAGGERHEART.GENERAL.Tiers.tier4'
label: 'DAGGERHEART.GENERAL.Tiers.4'
}
};

View file

@ -18,10 +18,11 @@ export default class DhpAdversary extends BaseDataActor {
const fields = foundry.data.fields;
return {
...super.defineSchema(),
tier: new fields.StringField({
tier: new fields.NumberField({
required: true,
integer: true,
choices: CONFIG.DH.GENERAL.tiers,
initial: CONFIG.DH.GENERAL.tiers.tier1.id
initial: CONFIG.DH.GENERAL.tiers[1].id
}),
type: new fields.StringField({
required: true,

View file

@ -18,10 +18,11 @@ export default class DhEnvironment extends BaseDataActor {
const fields = foundry.data.fields;
return {
...super.defineSchema(),
tier: new fields.StringField({
tier: new fields.NumberField({
required: true,
integer: true,
choices: CONFIG.DH.GENERAL.tiers,
initial: CONFIG.DH.GENERAL.tiers.tier1.id
initial: CONFIG.DH.GENERAL.tiers[1].id
}),
type: new fields.StringField({ choices: CONFIG.DH.ACTOR.environmentTypes }),
impulses: new fields.StringField(),

View file

@ -27,8 +27,8 @@ export default class DHBeastform extends BaseDataItem {
tier: new fields.NumberField({
required: true,
integer: true,
choices: CONFIG.DH.GENERAL.tiersAlternate,
initial: CONFIG.DH.GENERAL.tiersAlternate[1].id
choices: CONFIG.DH.GENERAL.tiers,
initial: CONFIG.DH.GENERAL.tiers[1].id
}),
tokenImg: new fields.FilePathField({
initial: 'icons/svg/mystery-man.svg',
@ -59,7 +59,7 @@ export default class DHBeastform extends BaseDataItem {
evolved: new fields.SchemaField({
maximumTier: new fields.NumberField({
integer: true,
choices: CONFIG.DH.GENERAL.tiersAlternate
choices: CONFIG.DH.GENERAL.tiers
}),
mainTraitBonus: new fields.NumberField({
required: true,
@ -71,7 +71,7 @@ export default class DHBeastform extends BaseDataItem {
hybrid: new fields.SchemaField({
maximumTier: new fields.NumberField({
integer: true,
choices: CONFIG.DH.GENERAL.tiersAlternate,
choices: CONFIG.DH.GENERAL.tiers,
label: 'DAGGERHEART.ITEMS.Beastform.FIELDS.evolved.maximumTier.label'
}),
beastformOptions: new fields.NumberField({ required: true, integer: true, initial: 2, min: 2 }),