Skip to content

PF2eHelper.js

William edited this page Apr 27, 2024 · 8 revisions

PF2eHelper

PF2eHelper module

Author: William Leemans
Copyright: William Leemans 2024

PF2eHelper.pf2eHelper ⇐ genericHelper

Kind: static class of PF2eHelper
Extends: genericHelper

pf2eHelper.pdfActionIconsGlyphs

Activity Glyph set for the action icons font. To be used with pf2eHelper.formatActivity

Kind: instance property of pf2eHelper

pf2eHelper.scribeActivityGlyphs

Activity Glyph set for scribe.pf2.tools. To be used with pf2eHelper.formatActivity

Kind: instance property of pf2eHelper

pf2eHelper.abbreviateSource(value) ⇒ string

Abbreviate the names of the sourcebooks a resource is from.

Kind: static method of pf2eHelper
Returns: string - PF2e Source abbreviation

Param Type Description
value string Source name

pf2eHelper.strikeDamage(strike, actor) ⇒ string

simple function to generate the damage of a strike

Kind: static method of pf2eHelper

Param Type Description
strike Object the strike object as found in actor.system.actions
actor Object the actor object to check for additional feats like weapon specialization

pf2eHelper.damageFormula(strike, actor) ⇒ string

simple function to generate the damage formula of a strike

Kind: static method of pf2eHelper

Param Type Description
strike Object the strike object as found in actor.system.actions
actor Object the actor object to check for additional feats like weapon specialization

pf2eHelper.formatActivity(actionType, activity, symbols) ⇒ string

Format the activity according to actionType and activity

Kind: static method of pf2eHelper
Returns: string - Activity Glyph

Param Type Description
actionType string action type: action, free, or reaction
activity string the activity
symbols Object the symbol set to use

pf2eHelper.formatAttributeBoosts(attributes) ⇒ string

Format and sort attribute boosts according to their order

Kind: static method of pf2eHelper
Returns: string - Sorted list of attribute boosts

Param Type Description
attributes array list of attributes

pf2eHelper.runesToTraits(runes) ⇒ array

Format runes as traits

Kind: static method of pf2eHelper

Param Type Description
runes Object the runes object associated with a weapon

pf2eHelper.formatRunes(runes) ⇒ string

Format runes into a string

Kind: static method of pf2eHelper
Returns: string - list of runes

Param Type Description
runes Object a rune entry from the PF2e actor

pf2eHelper.formatTrait(trait) ⇒ string

Format an individual trait according to certain rules

Kind: static method of pf2eHelper
Returns: string - formatted trait

Param Type Description
trait string trait to be formatted

pf2eHelper.formatSpellCastingTime(activity, symbols) ⇒ string

Format Spell Casting Times

Kind: static method of pf2eHelper
Returns: string - Activiy Glyph

Param Type Description
activity string the activity
symbols Object the symbol set to use

pf2eHelper.formatTraits(traitList) ⇒ string

Order and format traits

Kind: static method of pf2eHelper
Returns: string - sorted list of traits

Param Type Description
traitList array an array of traits to be formatted

pf2eHelper.frequencyToHuman(frequency) ⇒ string

Resolve pf2e system frequency to human

Kind: static method of pf2eHelper
Returns: string - human readable frequency

Param Type Description
frequency string PF2e system frequency

pf2eHelper.getActorObject(game, actor) ⇒ Object

Determine what type of actor we're dealing with and return an object which can parse all data

Kind: static method of pf2eHelper

Param Type Description
game Object the Foundry VTT game object
actor Object the Foundry VTT actor object

pf2eHelper.isPartialBoost(actor, attribute) ⇒ boolean

Return whether or not an attribute boost is partial

Kind: static method of pf2eHelper
Returns: boolean - whether the given attribute has a partial boost

Param Type Description
actor * the actor object
attribute * the attribute for which to discover if there is a partial boost

pf2eHelper.resolveSize(size) ⇒ string

Return full size name

Kind: static method of pf2eHelper
Returns: string - Full size name

Param Type Description
size string the abbreviated size entry

PF2eHelper~pf2eActor

pf2e actor abstraction base class

Kind: inner class of PF2eHelper

new pf2eActor(game, actor)

Param Type Description
game Object The foundry VTT game object
actor Object Foundry VTT actor object

pf2eActor.name : string

actor name

Kind: instance property of pf2eActor

pf2eActor.ownerName : string

actor owner name

Kind: instance property of pf2eActor

pf2eActor.traits : array

actor traits

Kind: instance property of pf2eActor

pf2eActor.ancestry : string

actor ancestry

Kind: instance property of pf2eActor

pf2eActor.heritage : string

actor heritage

Kind: instance property of pf2eActor

pf2eActor.size : string

actor (small) size

Kind: instance property of pf2eActor

pf2eActor.background : Object

actor background

Kind: instance property of pf2eActor

pf2eActor.class : string

actor class

Kind: instance property of pf2eActor

pf2eActor.level : number | string

actor level

Kind: instance property of pf2eActor

pf2eActor.xp : number | string

actor XPs

Kind: instance property of pf2eActor

pf2eActor.heroPoints : number

actor hero points

Kind: instance property of pf2eActor

pf2eActor.attributes : Object

actor attributes

Kind: instance property of pf2eActor

pf2eActor.ac : Object

actor ac

Kind: instance property of pf2eActor

pf2eActor.hasShieldEquipped : boolean

actor has a shield equipped

Kind: instance property of pf2eActor

pf2eActor.equippedShield : Object

actor equipped shield

Kind: instance property of pf2eActor

pf2eActor.defenseProficiencies : Object

actor defense proficiencies

Kind: instance property of pf2eActor

pf2eActor.savingThrows : Object

actor saving throws

Kind: instance property of pf2eActor

pf2eActor.hp : Object

actor HP

Kind: instance property of pf2eActor

pf2eActor.dying : Object

actor dying

Kind: instance property of pf2eActor

pf2eActor.wounded : Object

actor wounds

Kind: instance property of pf2eActor

pf2eActor.immunities : string

actor immunities

Kind: instance property of pf2eActor

pf2eActor.resistance : string

actor resistance

Kind: instance property of pf2eActor

pf2eActor.weaknesses : string

actor weaknesses

Kind: instance property of pf2eActor

pf2eActor.conditions : string

actor conditions

Kind: instance property of pf2eActor

pf2eActor.skills : Object

actor skills

Kind: instance property of pf2eActor

pf2eActor.languages : string

actor languages

Kind: instance property of pf2eActor

pf2eActor.perception : Object

actor perception

Kind: instance property of pf2eActor

pf2eActor.senses : string

actor senses

Kind: instance property of pf2eActor

pf2eActor.hasArmorEquipped : boolean

actor is wearing armor

Kind: instance property of pf2eActor

pf2eActor.equippedArmor : Object

actor armor worn

Kind: instance property of pf2eActor

pf2eActor.baseSpeed : string

actor base speed

Kind: instance property of pf2eActor

pf2eActor.baseMovement : Object

actor base movement

Kind: instance property of pf2eActor

pf2eActor.movement : array

actor list of movement

Kind: instance property of pf2eActor

pf2eActor.strikes : array

actor strikes

Kind: instance property of pf2eActor

pf2eActor.weaponProficiencies : Object

actor weapon proficiencies

Kind: instance property of pf2eActor

pf2eActor.classDC : Object

actor class DC

Kind: instance property of pf2eActor

pf2eActor.ancestryAndHeritageAbilities : array

actor ancestry and heritage abilities

Kind: instance property of pf2eActor

pf2eActor.ancestryFeats : array

actor ancestry feats

Kind: instance property of pf2eActor

pf2eActor.backgroundSkillFeats : array

actor background skill feats

Kind: instance property of pf2eActor

pf2eActor.skillFeats : array

actor skill feats

Kind: instance property of pf2eActor

pf2eActor.generalFeats : array

actor general feats

Kind: instance property of pf2eActor

pf2eActor.attributeBoosts : array

actor attribute boosts

Kind: instance property of pf2eActor

pf2eActor.classFeats : array

actor class feats

Kind: instance property of pf2eActor

pf2eActor.classFeatures : array

actor class features

Kind: instance property of pf2eActor

pf2eActor.items : array

all actor items

Kind: instance property of pf2eActor

pf2eActor.heldItems : array

actor held items

Kind: instance property of pf2eActor

pf2eActor.consumables : array

actor consumables

Kind: instance property of pf2eActor

pf2eActor.wornItems : array

actor worn items

Kind: instance property of pf2eActor

pf2eActor.coins : Object

actor coins

Kind: instance property of pf2eActor

pf2eActor.totalBulk : number

actor total bulk

Kind: instance property of pf2eActor

pf2eActor.gemsAndArtwork : array

actor gems and artwork

Kind: instance property of pf2eActor

pf2eActor.details : Object

actor details

Kind: instance property of pf2eActor

pf2eActor.activities : array

actor actions, free actions and reactions

Kind: instance property of pf2eActor

pf2eActor.hasArcaneTradition : boolean

actor has spells belonging to the arcane tradition

Kind: instance property of pf2eActor

pf2eActor.hasOccultTradition : boolean

actor has spells belonging to the occult tradition

Kind: instance property of pf2eActor

pf2eActor.hasPrimalTradition : boolean

actor has spells belonging to the primal tradition

Kind: instance property of pf2eActor

pf2eActor.hasDivineTradition : boolean

actor has spells belonging to the divine tradition

Kind: instance property of pf2eActor

pf2eActor.isPreparedCaster : boolean

actor is a prepared caster

Kind: instance property of pf2eActor

pf2eActor.isSpontaneousCaster : boolean

actor is a spontaneous caster

Kind: instance property of pf2eActor

pf2eActor.spellCastingEntries : array

actor spellcasting entries

Kind: instance property of pf2eActor

pf2eActor.spellProficiency : Object

actor spell proficiency

Kind: instance property of pf2eActor

pf2eActor.highestSpellProficiency : Object

actor's highest spellcasting proficiency

Kind: instance property of pf2eActor

pf2eActor.spellSlots : array

actor spellslots

Kind: instance property of pf2eActor

pf2eActor.cantripRank : number

actor cantrip rank

Kind: instance property of pf2eActor

pf2eActor.focusPoints : Object

actor focus points

Kind: instance property of pf2eActor

pf2eActor.focusSpellRank : number

actor focus spell rank

Kind: instance property of pf2eActor

pf2eActor.maximumSpellRank : number

actor maximum spell rank

Kind: instance property of pf2eActor

pf2eActor.knownSpells : array

actor known spells

Kind: instance property of pf2eActor

pf2eActor.knownFormulas : array

actor know formulas

Kind: instance property of pf2eActor

pf2eActor.knownRituals : array

actor known rituals

Kind: instance property of pf2eActor

pf2eActor._items(containerId, level) ⇒ array

Enumerate actor items in a container

Kind: instance method of pf2eActor

Param Type Default Description
containerId null | string the id of the container to get the items from (null for the root)
level number 0 a number indicating the level of depth the item is in

pf2eActor._rawItem(item) ⇒ Object

parse an item into the requested format

Kind: instance method of pf2eActor

Param Type Description
item Object the item to parse

pf2eActor.flatItems(itemList) ⇒ array

return a flat list of items

Kind: instance method of pf2eActor

Param Type Description
itemList array list of items to parse

pf2eActor._calculatePrice(price) ⇒ array

Calculate the price based on the price object

Kind: instance method of pf2eActor
Returns: array - an array containing all coins

Param Type Description
price Object the price object

PF2eHelper~f2eActorPropertyError ⇐ Error

pf2e Actor Property Error

Kind: inner class of PF2eHelper
Extends: Error

new f2eActorPropertyError(moduleName, className, methodName, message)

Param Type Description
moduleName string the name of the module the error has occurred in
className string the name of the class the error has occurred in
methodName string the name of the method the error has occurred in
message string the error message

PF2eHelper~pf2ePlayer ⇐ pf2eActor

pf2e player character class

Kind: inner class of PF2eHelper
Extends: pf2eActor

new pf2ePlayer(game, actor)

Param Type Description
game Object the Foundry VTT game object
actor Object the Foundry VTT actor object

pf2ePlayer.background : Object

actor background

Kind: instance property of pf2ePlayer

pf2ePlayer.knownFormulas : array

actor know formulas

Kind: instance property of pf2ePlayer

PF2eHelper~pf2eNPC ⇐ pf2eActor

pf2e player NPC class

Kind: inner class of PF2eHelper
Extends: pf2eActor

new pf2eNPC(game, actor)

Param Type Description
game Object the Foundry VTT game object
actor Object the Foundry VTT actor object

pf2eNPC.ac : Object

actor ac

Kind: instance property of pf2eNPC

pf2eNPC.strikes : array

actor strikes

Kind: instance property of pf2eNPC

pf2eNPC.skills : Object

actor skills

Kind: instance property of pf2eNPC

Clone this wiki locally