Skip to content

API Reference

Hero Mancer exposes a public API for module and macro authors. Access it through either of the following, which return the same object:

  • globalThis.HEROMANCER.api
  • game.modules.get('hero-mancer').api

The methods are grouped below by purpose. For lifecycle events you can subscribe to instead of calling these directly, see Hooks.

MethodBehavior
openWizardOpens the character creation wizard, optionally pre-filling the character name.
openWizardForPlayerIntended to open the wizard for another user by id (see caution below).
openLevelUpOpens level-up mode for an existing character actor. Returns the application instance, or null if the actor is not a character.
MethodBehavior
openPendingApprovalsOpens or focuses the Gamemaster pending-approvals queue. Returns the application instance.
submitForApprovalSubmits a character payload to the approval queue. Resolves to the created page id when run as the active Gamemaster, or null when the submission is routed to the Gamemaster over the socket.
getPendingSubmissionsReturns pending submissions as journal pages, oldest first.
MethodBehavior
saveDraftSaves a wizard draft (a field map) for the current user.
getSavedDraftReturns the current user’s saved draft, or null.
clearSavedDraftDeletes the current user’s saved draft.
MethodBehavior
reindexCompendiumsRebuilds the cached index for an item subtype (race, class, background, subclass, or feat). Returns the result.
getCompendiumEntriesReturns cached entries for an item subtype, either flat or grouped by top-level folder.
findJournalPageResolves the journal page describing a document. Returns its uuid, or null.
buildProficienciesComputes render-ready proficiency categories (label, icon, and items) from race, class, background, and subclass documents.
MethodBehavior
getInfoReturns a diagnostic snapshot: version, enabled state, compatibility info, and last-seen version.