-
Notifications
You must be signed in to change notification settings - Fork 9
API
Idle edited this page Dec 12, 2024
·
10 revisions
The module exposes some functions that can be useful to third parties.
// retrieves the api object containing the different functions
game.modules.get("pf2e-dailies")?.api;
/*
* returns true if the character can currently cast a spell of that rank
* note that cantrips have heightened ranks and should be filtered before calling this function
*/
canCastRank(actor: CharacterPF2e, rank: ZeroToTen): boolean
/*
* returns the physical staff item from the character's inventory
*/
getStaffItem(actor: CharacterPF2e): PhysicalItemPF2e<CharacterPF2e> | null
/*
* will set the charges value of the character's staff if any
* if no value is provided, it will reset the charges to their max value
*/
setStaffChargesValue(actor: CharacterPF2e, value?: number): void
/*
* Can this actor make daily preparations
*/
canPrepareDailies(actor: CharacterPF2e): Promise<void>;
/*
* Retrieve the daily preparation summary or a generic message if none could be found
*/
getDailiesSummary(actor: ActorPF2e): string;
/*
* Open the daily preparation window for the character if it can prep
*/
openDailiesInterface(actor: CharacterPF2e): Promise<void>;
/*
* Register custom dailies without adding them to the world setting
*/
registerCustomDailies(dailies: Daily[]): void
/*
* The list of disabled dailies for this character
*/
getDisabledDailies(actor: CharacterPF2e): Record<string, boolean>
/*
* Configs for the animist daily to show or not summaries for lores & spells
* This only affects summary entries generated by the animist daily
* A missing value is equal to `true`
*/
getAnimistConfigs(actor: CharacterPF2e): { lores: boolean; spells: boolean; signatures: boolean; }
/**
* Retrieve the vessel focus spellcasting entry & list of primary vessel spell ids
*/
getAnimistVesselsData(actor: CharacterPF2e): { entry: SpellcastingEntryPF2e; primary: string[]; } | undefined;
/*
* Exposed collection of utils normally injected in a custom daily function
* This is needed if you want to use them in a registered daily
* https://github.com/reonZ/pf2e-dailies/blob/master/src/utils.ts#L22
*/
utils: object;
/*
* Exposed collection of daily helpers that create entire dailies
* Like `utils` those are normally injected into custom daily functions
*/
dailyHelpers: {
createComboSkillDaily: (key: string, uuid: string, options?: {
rank?: OneToFour | undefined;
removeRules?: boolean | undefined;
}) => Daily,
createLoreSkillDaily: (key: string, uuid: string) => Daily,
createLanguageDaily: (key: string, uuid: string) => Daily,
createResistanceDaily: (
key: string,
uuid: string,
resistances: string[],
resistance: SimplifiableRuleValue,
isRandom = false
) => Daily,
createScrollChainDaily: (key: string, uuids: [string, string, string]) => Daily,
},