Added resources to the Homebrew Menu

This commit is contained in:
WBHarry 2026-03-09 18:53:48 +01:00
parent a4a7b8e7ca
commit 2ac7ee0079
13 changed files with 488 additions and 122 deletions

View file

@ -11,3 +11,4 @@ export * as settingsConfig from './settingsConfig.mjs';
export * as systemConfig from './system.mjs';
export * as itemBrowserConfig from './itemBrowserConfig.mjs';
export * as triggerConfig from './triggerConfig.mjs';
export * as resourceConfig from './resourceConfig.mjs';

View file

@ -1,3 +1,5 @@
import { allAdversaryResources, allCharacterResources, allCompanionResources } from './resourceConfig.mjs';
export const abilities = {
agility: {
id: 'agility',
@ -55,101 +57,16 @@ export const abilities = {
}
};
/**
* Full custom typing:
* id
* initial
* max
* reverse
* label
* images {
* full { value, isPath, noColorFilter }
* empty { value, isPath noColorFilter }
* }
*/
export const characterBaseResources = {
hitPoints: {
id: 'hitPoints',
initial: 0,
max: 0,
reverse: true,
label: 'DAGGERHEART.GENERAL.HitPoints.plural',
maxLabel: 'DAGGERHEART.ACTORS.Character.maxHPBonus'
},
stress: {
id: 'stress',
initial: 0,
max: 6,
reverse: true,
label: 'DAGGERHEART.GENERAL.stress'
},
hope: {
id: 'hope',
initial: 2,
min: 0,
reverse: false,
label: 'DAGGERHEART.GENERAL.hope'
}
};
export const characterResources = {
...characterBaseResources
};
export const adversaryBaseResources = {
hitPoints: {
id: 'hitPoints',
initial: 0,
max: 0,
reverse: true,
label: 'DAGGERHEART.GENERAL.HitPoints.plural',
maxLabel: 'DAGGERHEART.ACTORS.Character.maxHPBonus'
},
stress: {
id: 'stress',
initial: 0,
max: 0,
reverse: true,
label: 'DAGGERHEART.GENERAL.stress'
}
};
export const adversaryResources = {
...adversaryBaseResources
};
export const companionBaseResources = {
stress: {
id: 'stress',
initial: 0,
max: 0,
reverse: true,
label: 'DAGGERHEART.GENERAL.stress'
},
hope: {
id: 'hope',
initial: 0,
min: 0,
reverse: false,
label: 'DAGGERHEART.GENERAL.hope'
}
};
export const companionResources = {
...companionBaseResources
};
export const getScrollingTextResources = actorType => ({
armor: {
label: 'DAGGERHEART.GENERAL.armor',
reverse: true
},
...(actorType === 'character'
? characterResources
? allCharacterResources()
: actorType === 'adversary'
? adversaryResources
: companionResources)
? allAdversaryResources
: allCompanionResources)
});
export const featureProperties = {

View file

@ -0,0 +1,100 @@
/**
* Full custom typing:
* id
* initial
* max
* reverse
* label
* images {
* full { value, isPath, noColorFilter }
* empty { value, isPath noColorFilter }
* }
*/
export const characterBaseResources = {
hitPoints: {
id: 'hitPoints',
initial: 0,
max: 0,
reverse: true,
label: 'DAGGERHEART.GENERAL.HitPoints.plural',
maxLabel: 'DAGGERHEART.ACTORS.Character.maxHPBonus'
},
stress: {
id: 'stress',
initial: 0,
max: 6,
reverse: true,
label: 'DAGGERHEART.GENERAL.stress'
},
hope: {
id: 'hope',
initial: 2,
min: 0,
reverse: false,
label: 'DAGGERHEART.GENERAL.hope'
}
};
export const characterResources = {
...characterBaseResources
};
export const allCharacterResources = () => {
const resources = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).resources.character
.resources;
return {
...Object.keys(resources).reduce((acc, key) => {
acc[key] = { ...resources[key].toObject(), id: key };
return acc;
}, {}),
...characterResources
};
};
export const adversaryBaseResources = {
hitPoints: {
id: 'hitPoints',
initial: 0,
max: 0,
reverse: true,
label: 'DAGGERHEART.GENERAL.HitPoints.plural',
maxLabel: 'DAGGERHEART.ACTORS.Character.maxHPBonus'
},
stress: {
id: 'stress',
initial: 0,
max: 0,
reverse: true,
label: 'DAGGERHEART.GENERAL.stress'
}
};
export const adversaryResources = {
...adversaryBaseResources
};
export const allAdversaryResources = () => adversaryResources;
export const companionBaseResources = {
stress: {
id: 'stress',
initial: 0,
max: 0,
reverse: true,
label: 'DAGGERHEART.GENERAL.stress'
},
hope: {
id: 'hope',
initial: 0,
min: 0,
reverse: false,
label: 'DAGGERHEART.GENERAL.hope'
}
};
export const companionResources = {
...companionBaseResources
};
export const allCompanionResources = () => companionResources;

View file

@ -2,6 +2,7 @@ import * as GENERAL from './generalConfig.mjs';
import * as DOMAIN from './domainConfig.mjs';
import * as ENCOUNTER from './encounterConfig.mjs';
import * as ACTOR from './actorConfig.mjs';
import * as RESOURCE from './resourceConfig.mjs';
import * as ITEM from './itemConfig.mjs';
import * as SETTINGS from './settingsConfig.mjs';
import * as EFFECTS from './effectConfig.mjs';
@ -19,6 +20,7 @@ export const SYSTEM = {
GENERAL,
DOMAIN,
ACTOR,
RESOURCE,
ITEM,
SETTINGS,
EFFECTS,