-
-
Notifications
You must be signed in to change notification settings - Fork 4
PF2eHelper.js
PF2eHelper module. Provides a couple of classes to easily manage your PF2e characters.
Author: William Leemans
Copyright: William Leemans 2024
-
PF2eHelper
-
static
-
.pf2ePlayer ⇐
pf2eActor
- new exports.pf2ePlayer(game, actor)
-
.background :
Object
-
.knownFormulas :
array
-
.pf2eNPC ⇐
pf2eActor
- new exports.pf2eNPC(game, actor)
-
.ac :
Object
-
.strikes :
array
-
.skills :
Object
-
.pf2eHelper ⇐
genericHelper
- instance
-
static
-
.abbreviateSource(value) ⇒
string
-
.strikeDamage(strike, actor) ⇒
string
-
.damageFormula(strike, actor) ⇒
string
-
.formatActivity(actionType, activity, symbols) ⇒
string
-
.formatAttributeBoosts(attributes) ⇒
string
-
.runesToTraits(runes) ⇒
array
-
.formatRunes(runes) ⇒
string
-
.formatTrait(trait) ⇒
string
-
.formatSpellCastingTime(activity, symbols) ⇒
string
-
.formatTraits(traitList) ⇒
string
-
.frequencyToHuman(frequency) ⇒
string
-
.getActorObject(game, actor) ⇒
Object
-
.isPartialBoost(actor, attribute) ⇒
boolean
-
.resolveSize(size) ⇒
string
-
.abbreviateSource(value) ⇒
-
.pf2ePlayer ⇐
-
inner
-
~pf2eActor
- new pf2eActor(game, actor)
-
.spellcastingTraditions :
Array.<string>
-
.spellcastingTypes :
Array.<string>
-
.name :
string
-
.ownerName :
string
-
.traits :
Array.<string>
-
.ancestry :
actorAncestry
-
.heritage :
actorHeritage
-
.size :
string
-
.background :
actorBackground
-
.class :
actorClass
-
.level :
number
|string
-
.xp :
number
|string
-
.heroPoints :
number
-
.attributes :
actorAttributes
-
.ac :
actorAC
-
.hasShieldEquipped :
boolean
-
.equippedShield :
actorEquippedShield
-
.defenseProficiencies :
actorDefenseProficiencies
-
.savingThrows :
actorSavingThrows
-
.hp :
actorHP
-
.dying :
Object
-
.wounded :
Object
-
.immunities :
string
-
.resistance :
string
-
.weaknesses :
string
-
.conditions :
string
-
.skills :
Object
-
.languages :
string
-
.perception :
Object
-
.senses :
string
-
.hasArmorEquipped :
boolean
-
.equippedArmor :
Object
-
.baseSpeed :
string
-
.baseMovement :
Object
-
.movement :
Array.<Object>
-
.sneakAttackDamage :
String
-
.strikes :
Array.<Object>
-
.weaponProficiencies :
Object
-
.classDC :
Object
-
.ancestryAndHeritageAbilities :
Array.<Heritage>
-
.ancestryFeats :
Array.<Feat>
-
.backgroundSkillFeats :
Array.<Feat>
-
.skillFeats :
Array.<Feat>
-
.generalFeats :
Array.<Feat>
-
.attributeBoosts :
Array.<AtrributeBoost>
-
.bonusFeats :
Array.<Feat>
-
.classFeats :
Array.<Feat>
-
.classFeatures :
Array.<Feature>
-
.items :
Array.<Item>
-
.heldItems :
Array.<Item>
-
.consumables :
Array.<Item>
-
.wornItems :
Array.<Item>
-
.coins :
Coins
-
.totalBulk :
number
-
.gemsAndArtwork :
Array.<Item>
-
.details :
Details
-
.activities :
Array.<Action>
-
.hasArcaneTradition :
boolean
-
.hasOccultTradition :
boolean
-
.hasPrimalTradition :
boolean
-
.hasDivineTradition :
boolean
-
.isPreparedCaster :
boolean
-
.isSpontaneousCaster :
boolean
-
.spellCastingEntries :
Array.<Object>
-
.spellProficiency :
Array.<Object>
-
.highestSpellProficiency :
Object
-
.spellSlots :
array
-
.cantripRank :
number
-
.focusPoints :
Object
-
.focusSpellRank :
number
-
.maximumSpellRank :
number
-
.knownSpells :
array
-
.knownFormulas :
array
-
.knownRituals :
array
-
._strike(rawStrike) ⇒
Object
-
._items([containerId], [level]) ⇒
Array.<Item>
-
._rawItem(item) ⇒
Item
-
.flatItems([itemList]) ⇒
Array.<Item>
-
._calculatePrice(price) ⇒
array
-
~pf2eActorPropertyError ⇐
Error
-
~actorAncestry :
Object
-
~actorHeritage :
Object
-
~actorBackground :
Object
-
~actorClass :
Object
-
~actorAttribute :
Object
-
~actorAttributes :
Object
-
~actorAC :
Object
-
~actorEquippedShield :
Object
-
~actorDefenseProficiency :
Object
-
~actorDefenseProficiencies :
Object
-
~actorSavingThrow :
Object
-
~actorSavingThrows :
Object
-
~actorHP :
Object
-
~actorDying :
Object
-
~Heritage :
Object
-
~Feat :
Object
-
~AtrributeBoost :
Object
-
~Feature :
Object
-
~Item :
Object
-
~Coins :
Object
-
~Details :
Object
-
~Action :
Object
-
~pf2eActor
-
static
pf2e player character class
Kind: static class of PF2eHelper
Extends: pf2eActor
-
.pf2ePlayer ⇐
pf2eActor
- new exports.pf2ePlayer(game, actor)
-
.background :
Object
-
.knownFormulas :
array
Param | Type | Description |
---|---|---|
game | Object |
the Foundry VTT game object |
actor | Object |
the Foundry VTT actor object |
actor background
Kind: instance property of pf2ePlayer
actor know formulas
Kind: instance property of pf2ePlayer
pf2e player NPC class
Kind: static class of PF2eHelper
Extends: pf2eActor
-
.pf2eNPC ⇐
pf2eActor
- new exports.pf2eNPC(game, actor)
-
.ac :
Object
-
.strikes :
array
-
.skills :
Object
Param | Type | Description |
---|---|---|
game | Object |
the Foundry VTT game object |
actor | Object |
the Foundry VTT actor object |
actor ac
Kind: instance property of pf2eNPC
actor strikes
Kind: instance property of pf2eNPC
actor skills
Kind: instance property of pf2eNPC
Kind: static class of PF2eHelper
Extends: genericHelper
-
.pf2eHelper ⇐
genericHelper
- instance
-
static
-
.abbreviateSource(value) ⇒
string
-
.strikeDamage(strike, actor) ⇒
string
-
.damageFormula(strike, actor) ⇒
string
-
.formatActivity(actionType, activity, symbols) ⇒
string
-
.formatAttributeBoosts(attributes) ⇒
string
-
.runesToTraits(runes) ⇒
array
-
.formatRunes(runes) ⇒
string
-
.formatTrait(trait) ⇒
string
-
.formatSpellCastingTime(activity, symbols) ⇒
string
-
.formatTraits(traitList) ⇒
string
-
.frequencyToHuman(frequency) ⇒
string
-
.getActorObject(game, actor) ⇒
Object
-
.isPartialBoost(actor, attribute) ⇒
boolean
-
.resolveSize(size) ⇒
string
-
.abbreviateSource(value) ⇒
Activity Glyph set for the action icons font. To be used with pf2eHelper.formatActivity
Kind: instance property of pf2eHelper
Activity Glyph set for scribe.pf2.tools. To be used with pf2eHelper.formatActivity
Kind: instance property of pf2eHelper
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 |
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 |
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 |
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 |
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 |
Format runes as traits
Kind: static method of pf2eHelper
Param | Type | Description |
---|---|---|
runes | Object |
the runes object associated with a weapon |
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 |
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 |
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 |
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 |
Resolve pf2e system frequency to human
Kind: static method of pf2eHelper
Returns: string
- human readable frequency
Param | Type | Description |
---|---|---|
frequency | string |
PF2e system frequency |
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 |
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 |
Return full size name
Kind: static method of pf2eHelper
Returns: string
- Full size name
Param | Type | Description |
---|---|---|
size | string |
the abbreviated size entry |
pf2e actor abstraction base class
This class provides a stable interface to the FoundryVTT actor object for use in your charactersheets.
Kind: inner class of PF2eHelper
-
~pf2eActor
- new pf2eActor(game, actor)
-
.spellcastingTraditions :
Array.<string>
-
.spellcastingTypes :
Array.<string>
-
.name :
string
-
.ownerName :
string
-
.traits :
Array.<string>
-
.ancestry :
actorAncestry
-
.heritage :
actorHeritage
-
.size :
string
-
.background :
actorBackground
-
.class :
actorClass
-
.level :
number
|string
-
.xp :
number
|string
-
.heroPoints :
number
-
.attributes :
actorAttributes
-
.ac :
actorAC
-
.hasShieldEquipped :
boolean
-
.equippedShield :
actorEquippedShield
-
.defenseProficiencies :
actorDefenseProficiencies
-
.savingThrows :
actorSavingThrows
-
.hp :
actorHP
-
.dying :
Object
-
.wounded :
Object
-
.immunities :
string
-
.resistance :
string
-
.weaknesses :
string
-
.conditions :
string
-
.skills :
Object
-
.languages :
string
-
.perception :
Object
-
.senses :
string
-
.hasArmorEquipped :
boolean
-
.equippedArmor :
Object
-
.baseSpeed :
string
-
.baseMovement :
Object
-
.movement :
Array.<Object>
-
.sneakAttackDamage :
String
-
.strikes :
Array.<Object>
-
.weaponProficiencies :
Object
-
.classDC :
Object
-
.ancestryAndHeritageAbilities :
Array.<Heritage>
-
.ancestryFeats :
Array.<Feat>
-
.backgroundSkillFeats :
Array.<Feat>
-
.skillFeats :
Array.<Feat>
-
.generalFeats :
Array.<Feat>
-
.attributeBoosts :
Array.<AtrributeBoost>
-
.bonusFeats :
Array.<Feat>
-
.classFeats :
Array.<Feat>
-
.classFeatures :
Array.<Feature>
-
.items :
Array.<Item>
-
.heldItems :
Array.<Item>
-
.consumables :
Array.<Item>
-
.wornItems :
Array.<Item>
-
.coins :
Coins
-
.totalBulk :
number
-
.gemsAndArtwork :
Array.<Item>
-
.details :
Details
-
.activities :
Array.<Action>
-
.hasArcaneTradition :
boolean
-
.hasOccultTradition :
boolean
-
.hasPrimalTradition :
boolean
-
.hasDivineTradition :
boolean
-
.isPreparedCaster :
boolean
-
.isSpontaneousCaster :
boolean
-
.spellCastingEntries :
Array.<Object>
-
.spellProficiency :
Array.<Object>
-
.highestSpellProficiency :
Object
-
.spellSlots :
array
-
.cantripRank :
number
-
.focusPoints :
Object
-
.focusSpellRank :
number
-
.maximumSpellRank :
number
-
.knownSpells :
array
-
.knownFormulas :
array
-
.knownRituals :
array
-
._strike(rawStrike) ⇒
Object
-
._items([containerId], [level]) ⇒
Array.<Item>
-
._rawItem(item) ⇒
Item
-
.flatItems([itemList]) ⇒
Array.<Item>
-
._calculatePrice(price) ⇒
array
Param | Type | Description |
---|---|---|
game | Object |
The foundry VTT game object |
actor | Object |
Foundry VTT actor object |
the list of spellcasting traditions
Kind: instance property of pf2eActor
Access: public
the list of spellcatsing types
Kind: instance property of pf2eActor
Access: public
Return the actor name
Kind: instance property of pf2eActor
Return the Owner name of the actor
Kind: instance property of pf2eActor
Return the actor traits
Kind: instance property of pf2eActor
Return the actor ancestry information
Kind: instance property of pf2eActor
Return the actor heritage information
Kind: instance property of pf2eActor
Return the actor's (abbreviated) size
Kind: instance property of pf2eActor
Return the actor background information
Kind: instance property of pf2eActor
Return the actor class information
Kind: instance property of pf2eActor
Return the actor level
Kind: instance property of pf2eActor
Return the actor's XP count
Kind: instance property of pf2eActor
Return the actor's hero point count
Kind: instance property of pf2eActor
return the actor's attributes
Kind: instance property of pf2eActor
Return the actor's AC information
Kind: instance property of pf2eActor
Return whether the actor has a shield equipped
Kind: instance property of pf2eActor
Return the actor's equipped shield
Kind: instance property of pf2eActor
Return the actor's defense proficiencies
Kind: instance property of pf2eActor
Return the actor's saving throws
Kind: instance property of pf2eActor
Return actor's HP information
Kind: instance property of pf2eActor
Return the actor's dying information
Kind: instance property of pf2eActor
actor wounds
Kind: instance property of pf2eActor
actor immunities
Kind: instance property of pf2eActor
actor resistance
Kind: instance property of pf2eActor
actor weaknesses
Kind: instance property of pf2eActor
actor conditions
Kind: instance property of pf2eActor
actor skills
Kind: instance property of pf2eActor
actor languages
Kind: instance property of pf2eActor
actor perception
Kind: instance property of pf2eActor
actor senses
Kind: instance property of pf2eActor
actor is wearing armor
Kind: instance property of pf2eActor
actor armor worn
Kind: instance property of pf2eActor
actor base speed
Kind: instance property of pf2eActor
actor base movement
Kind: instance property of pf2eActor
actor list of movement
Kind: instance property of pf2eActor
actor Sneak Attack Damage
Kind: instance property of pf2eActor
actor strikes
Kind: instance property of pf2eActor
actor weapon proficiencies
Kind: instance property of pf2eActor
actor class DC
Kind: instance property of pf2eActor
actor ancestry and heritage abilities
Kind: instance property of pf2eActor
actor ancestry feats
Kind: instance property of pf2eActor
actor background skill feats
Kind: instance property of pf2eActor
actor skill feats
Kind: instance property of pf2eActor
actor general feats
Kind: instance property of pf2eActor
actor attribute boosts
Kind: instance property of pf2eActor
actor bonus feats
Kind: instance property of pf2eActor
actor class feats
Kind: instance property of pf2eActor
actor class features
Kind: instance property of pf2eActor
all actor items
Kind: instance property of pf2eActor
actor held items
Kind: instance property of pf2eActor
actor consumables
Kind: instance property of pf2eActor
actor worn items
Kind: instance property of pf2eActor
actor coins
Kind: instance property of pf2eActor
actor total bulk
Kind: instance property of pf2eActor
actor gems and artwork
Kind: instance property of pf2eActor
actor details
Kind: instance property of pf2eActor
actor actions, free actions and reactions
Kind: instance property of pf2eActor
actor has spells belonging to the arcane tradition
Kind: instance property of pf2eActor
actor has spells belonging to the occult tradition
Kind: instance property of pf2eActor
actor has spells belonging to the primal tradition
Kind: instance property of pf2eActor
actor has spells belonging to the divine tradition
Kind: instance property of pf2eActor
actor is a prepared caster
Kind: instance property of pf2eActor
actor is a spontaneous caster
Kind: instance property of pf2eActor
actor spellcasting entries
Kind: instance property of pf2eActor
actor spell proficiency
Kind: instance property of pf2eActor
actor's highest spellcasting proficiency
Kind: instance property of pf2eActor
actor spellslots
Kind: instance property of pf2eActor
actor cantrip rank
Kind: instance property of pf2eActor
actor focus points
Kind: instance property of pf2eActor
actor focus spell rank
Kind: instance property of pf2eActor
actor maximum spell rank
Kind: instance property of pf2eActor
actor known spells
Kind: instance property of pf2eActor
actor know formulas
Kind: instance property of pf2eActor
actor known rituals
Kind: instance property of pf2eActor
Return a single strike with all calculated information
Kind: instance method of pf2eActor
Returns: Object
- formatted strike
Param | Type |
---|---|
rawStrike | Object |
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 |
parse an item into the requested format
Kind: instance method of pf2eActor
Param | Type | Description |
---|---|---|
item | Object |
the item to parse |
return a flat list of items
Kind: instance method of pf2eActor
Param | Type | Default | Description |
---|---|---|---|
[itemList] | Array.<Item> |
this.items |
list of items to parse |
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 |
pf2e Actor Property Error
Kind: inner class of PF2eHelper
Extends: Error
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 |
Kind: inner typedef of PF2eHelper
Properties
Name | Type |
---|---|
name | string |
description | string |
Kind: inner typedef of PF2eHelper
Properties
Name | Type |
---|---|
name | string |
description | string |
Kind: inner typedef of PF2eHelper
Properties
Name | Type |
---|---|
name | string |
description | string |
Kind: inner typedef of PF2eHelper
Properties
Name | Type |
---|---|
name | string |
description | string |
subClass | string |
id | string |
Kind: inner typedef of PF2eHelper
Properties
Name | Type |
---|---|
name | string |
modifier | number |
isPartialBoost | boolean |
Kind: inner typedef of PF2eHelper
Properties
Name | Type |
---|---|
str | actorAttribute |
dex | actorAttribute |
con | actorAttribute |
int | actorAttribute |
wis | actorAttribute |
dex | actorAttribute |
Kind: inner typedef of PF2eHelper
Properties
Name | Type |
---|---|
statusModifier | number |
attributeModifier | number |
proficiencyModifier | number |
itemModifier | number |
modifier | number |
Kind: inner typedef of PF2eHelper
Properties
Name | Type |
---|---|
ac | number |
hardness | number |
hpMax | number |
hpValue | number |
bt | number |
Kind: inner typedef of PF2eHelper
Properties
Name | Type |
---|---|
name | string |
rank | number |
Kind: inner typedef of PF2eHelper
Properties
Name | Type |
---|---|
unarmored | actorDefenseProficiency |
light | actorDefenseProficiency |
medium | actorDefenseProficiency |
heavy | actorDefenseProficiency |
'light-barding' | actorDefenseProficiency |
'heavy-barding' | actorDefenseProficiency |
Kind: inner typedef of PF2eHelper
Properties
Name | Type |
---|---|
name | string |
attributeModifier | number |
proficiencyModifier | number |
itemModifier | number |
statusModifier | number |
rank | number |
modifier | number |
Kind: inner typedef of PF2eHelper
Properties
Name | Type |
---|---|
fortitude | actorSavingThrow |
reflex | actorSavingThrow |
will | actorSavingThrow |
Kind: inner typedef of PF2eHelper
Properties
Name | Type |
---|---|
max | number |
value | number |
temp | number |
Kind: inner typedef of PF2eHelper
Properties
Name | Type |
---|---|
max | number |
value | number |
Kind: inner typedef of PF2eHelper
Properties
Name | Type | Description |
---|---|---|
name | string |
The heritage name |
displayName | string |
the heritage display name |
description | string |
the description of the heritage |
Kind: inner typedef of PF2eHelper
Properties
Name | Type | Description |
---|---|---|
description | string |
the description of the feat |
level | number |
the level of the feat |
name | string |
the name of the feat |
prerequisites | string |
the prerequisites of the feat |
traits | Array.<string> |
the traits of the feat |
an attribute boost
Kind: inner typedef of PF2eHelper
Properties
Name | Type | Description |
---|---|---|
level | number |
the level for the applied boost |
ability |
'str' | 'dex' | 'con' | 'int' | 'wis' | 'cha'
|
the shortname of the ability boost |
a class feature
Kind: inner typedef of PF2eHelper
Properties
Name | Type | Description |
---|---|---|
level | number |
the level for the feature |
name | string |
the name of the feature |
traits | Array.<string> |
teh traits of the feature |
frequency | string |
the frequency a feature can be used |
description | string |
the description of the feature |
an inventory item
Kind: inner typedef of PF2eHelper
Properties
Name | Type | Description |
---|---|---|
containerLevel | number |
the level of the container the item is in |
name | string |
the name of the item |
displayName | string |
the display name of th eitem entry |
quantity | number |
the number of this item in the inventory |
isMagical | boolean |
is the item magical? |
isInvested | boolean |
is the item invested? |
bulk | number |
the bulk value of the item |
type |
'armor' | 'weapon' | 'treasure' | 'equipment' | 'backpack'
|
the type of the item |
stackGroup | string |
don't know |
carryType |
'worn' | 'stowed'
|
how is the item carried |
level | number |
the level of the item |
price | Array.<string> |
the price of the item |
traits | Array.<string> |
the triats of the item |
description | string |
the description of the item |
items | Array.<Item> |
The items within the container |
containerId | string |
the id of the container the item is in |
Kind: inner typedef of PF2eHelper
Properties
Name | Type | Description |
---|---|---|
cp | number |
Copper pieces |
sp | number |
Silver pieces |
gp | number |
Gold pieces |
pp | number |
Platinum pieces |
Kind: inner typedef of PF2eHelper
Properties
Name | Type |
---|---|
ethnicity | string |
nationality | string |
age | string |
gender | string |
height | string |
weight | string |
deity | string |
biography | Object |
biography.appearance | string |
biography.attitude | string |
biography.edicts | string |
biography.anathema | string |
biography.dislikes | string |
biography.likes | string |
biography.catchphrases | string |
biography.campaignNotes | string |
biography.allies | string |
biography.enemies | string |
biography.organizations | string |
Kind: inner typedef of PF2eHelper
Properties
Name | Type |
---|---|
name | string |
traits | Array.<string> |
reference | string |
frequency | string |
type | string |
description | string |
actionCount | number |
category | string |
glyph | string |