1 Module Builder Information
WBHarry edited this page 2026-03-11 11:25:44 +01:00

Various intended ways modules can alter the system.

Custom Resources

In the init hook, you can register custom resources for characters. This is done by defining new key/object pairs on CONFIG.DH.RESOURCE.character.custom. The data structure is:

{
	id - the resource key
	initial - the initial numerical value of the resource (stress starts at 6 for instance)
	max  - the maximum numerical value the resource can reach
	label - the label shown for the resource, preferably a i18n localizable string
}

Optionally, you can also define custom full and empty icons for the resource together with the above,

{
	images: {
		full: {
			value - the FontAwesome icon class or the filepath to the image if 'isIcon' is false 
			isIcon - if the image is a fontAwesome icon or an image in your filesystem
			noColorFilter - normally a uniform color is applied to the image via a css filter. If you're using a non-transparent background or just don't want it, then set this to true
		},
		empty: {
			value - see above
			isIcon - see above
			noColorFilter - see above
		}
	}
}

Example

Hooks.once('init', () => {
	CONFIG.DH.RESOURCE.character.custom.corruption = {
		id: 'corruption',
		initial: 0,
		max: 4,
		label: 'Corruption',
		images: {
		  full: {
			 value: 'systems/daggerheart/assets/icons/domains/sage.svg',
			 isIcon: false
		  },
		  empty: {
			 value: 'systems/daggerheart/assets/icons/domains/sage.svg',
			 isIcon: false
		  }
		}
	};
}