Pathfinder 1e for Foundry VTT
    Preparing search index...

    Loot item

    Ammunition, gear, trade goods, etc.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Accessors

    Methods

    _activeStateChange _addTypeRollData _buildEmbedHTML _canCreateItemLink _configure _createInlineEmbed _embedDescription _generateLinkData _getArmorCostMultiplier _getArmorWeightMultiplier _onCreate _onDelete _onMemorizedUpdate _onUpdate _preCreate _prepareActions _prepareChanges _prepareDependentData _prepareIdentifier _prepareScriptCalls _prepareTraits _preUpdate _preUpdateNumericValueGuard _rechargeActions _rechargeUses _resetChargesOnQuantityUpdate _sizeAdjustedHealth _transformContainerUpdateData _updateInheritedCharges _updateMaxUses _updateProtectionsAndWeaknesses addCharges addItemBooleanFlag adjustContained createItemLink displayCard executeScriptCalls getAllDamageSources getAllLinkedItems getAttackSources getChangeTargets getChatData getConditionalSubTargets getConditionalTargets getContextChanges getCostMultiplier getDefaultChargeCost getDefaultChargeFormula getDescription getDescriptionData getEmbeddedDocument getItemBooleanFlags getItemDictionaryFlag getItemDictionaryFlags getLabels getLinkedItems getLinkedItemsSync getName getProficiency getRawEffectData getRollData getScriptCalls getValue getWeightMultiplier hasItemBooleanFlag memorizeVariables prepareBaseData prepareDerivedData prepareDurability prepareLinks prepareWeight recharge removeItemBooleanFlag removeItemDictionaryFlag removeItemLink setActive setItemDictionaryFlag update use _adjustNewItem _createSupplements _hasSizeUpdate _hasVisionUpdate _onCreateOperation _onDeleteOperation _onUpdateOperation createDialog defaultName getDefaultArtwork

    Constructors

    • Parameters

      • data: CreateData

        Initial data from which to construct the Item

      • Optionalcontext: ConstructionContext

        Construction context options

      Returns ItemLootPF

    Properties

    _memoryVariables: undefined | null | {}
    actions: undefined | Collection<ItemAction, Methods<ItemAction>>

    A Collection of ItemActions.

    changes: undefined | Collection<any, Methods<any>>
    links: undefined | Record<string, ItemPF>

    An object containing links to other items.

    scriptCalls: undefined | Collection<string, ItemScriptCall>
    system: Readonly<
        {
            hasActions: true;
            hasChanges: true;
            hasIdentifier: true;
            isPhysical: true;
            subtypeName: true;
        },
    > = ...

    A static object holding system-specific metadata applicable to all instances of this Document class.

    Accessors

    • get actionTypes(): string[]

      An array containing all action types from this item's actions.

      Returns string[]

      config.itemActionTypes

    • get alignments(): null | string

      The item's alignment attributes, or null if the item has no alignment attributes

      Returns null | string

    • get allDamageSources(): undefined | ItemChange[]

      Generic damage source retrieval for default action, includes default conditionals and other item specific modifiers.

      Returns undefined | ItemChange[]

      All relevant changes, or undefined if action was not found.

    • get attackSources(): undefined | object[]

      Return attack sources for default action.

      Returns undefined | object[]

      Array of value and label pairs for attack bonus sources on the main attack.

    • get defaultAmmo(): undefined | Item<"base" | ModuleSubType>

      Linked ammunition item if any.

      Returns undefined | Item<"base" | ModuleSubType>

    • get effect(): null | ActiveEffect<"base" | ModuleSubType>

      An active effect associated with this item.

      Returns null | ActiveEffect<"base" | ModuleSubType>

      • Most item types don't have associated effect.
    • get hasChanges(): any

      Whether the item is tangible physical object in reality.

      Returns any

      • You can utilize this with raw data via CONFIG.Item.documentClasses[type]?.isPhysical
    • get isActive(): any

      Is the item is fully functional.

      This returns composite result of if the item is equipped, has quantity, is not disabled, is not out of charges, etc. and is not representative if the item can be set active or not via setActive.

      Returns any

    • get isPhysical(): any

      Whether the item is tangible physical object in reality.

      Returns any

      • You can utilize this with raw data via CONFIG.Item.documentClasses[type]?.isPhysical
    • get isProficient(): boolean

      Is the owning actor proficiency at using this as weapon.

      Returns boolean

      PF1 v10

    • get maxCharges(): number

      Maximum possible charges this item can have.

      Returns number

      • Can return zero. Usually signifying something has reduced the potential uses below usability.
      • Can return infinity, signifying lack of limits.
    • get memoryVariables(): string[]

      Returns string[]

      The keys of data variables to memorize between updates, for e.g. determining the difference in update.

    • get rootItem(): Item<"base" | ModuleSubType>
      Internal

      Root item.

      Specifically the item at bottom of the container tree.

      Returns Item<"base" | ModuleSubType>

    • get subType(): null | string

      The item's subtype, or null if the item has no subtype

      Returns null | string

    • get isPhysical(): boolean

      Whether the item is tangible physical object in reality.

      Returns boolean

      • You can utilize this with raw data via CONFIG.Item.documentClasses[type]?.isPhysical

    Methods

    • Internal

      Test if specified link can be created.

      Parameters

      • type: string

        The type of link.

      • item: Item<"base" | ModuleSubType>

        The target item to link to.

      • Optionaloptions: object = {}

        Additional options

      Returns Promise<boolean>

      Whether a link to the item is possible here.

    • Copy from foundry.documents.JournalEntryPage#_embedTextPage

      Parameters

      • config: any
      • options: {} = {}

      Returns Promise<DocumentFragment>

      foundry.documents.JournalEntryPage#_embedTextPage

    • Internal

      Parameters

      • type: string

        The type of link.

      • item: object

        The target item to link to.

      • uuid: string

        The link identifier for the item.

      Returns any[]

      An array to insert into this item's link data.

    • Prepare data potentially dependent on other items.

      This should be run at in Item.prepareDerivedData() if no actor is present, or in actor's prepareDerivedData after document preparation is done.

      Parameters

      • final: boolean = false

        Is this final call to this?

      Returns void

    • Internal

      Recharges item's uses, if any.

      Parameters

      • options: { exact: boolean; period?: string; rollData?: object } = {}

        Options

        • exact: boolean

          Exact time period only

        • Optionalperiod?: string

          Recharge only if matching this time period

        • OptionalrollData?: object

          Roll data

      Returns undefined | object

      • Update data or undefined if no update is needed.
    • Internal

      Recharges item's uses, if any.

      Parameters

      • options: {
            exact?: boolean;
            maximize?: boolean;
            period?: string;
            rollData?: object;
            value?: number;
        } = {}

        Options

        • Optionalexact?: boolean

          Match only exact time period

        • Optionalmaximize?: boolean

          Maximize instead of using recharge formula

        • Optionalperiod?: string

          Recharge only if it matches this time period

        • OptionalrollData?: object

          Roll data instance

        • Optionalvalue?: number

          Set charges to specific value

      Returns Promise<undefined | object>

      • Update data or undefined if no update is necessary.
    • Internal

      Transform given data so it becomes valid update data within parent item.

      This can, for example, be used to generate batched update to the real item.

      Parameters

      • data: object

        Update data

      • Optionaloptions: { recursive?: boolean } = {}

        Additional options

        • Optionalrecursive?: boolean

          Create data recursively, meant for the real item document.

      Returns object

      • Transformed update data
      _transformContainerUpdateData({ name: "new name" })
      // => { system: { items: { [itemID]: { name: "new name" } } } }
    • Sets a boolean flag on this item.

      Parameters

      • flagName: string

        The name/key of the flag to set.

      • context: object = {}

        Update context

      Returns Promise<boolean>

      Whether something was changed.

    • Creates a link to another item.

      Parameters

      • type: "children" | "charges" | "supplement" | "classAssociations"

        The type of link.

      • item: Item<"base" | ModuleSubType>

        The target item to link into this.

      • OptionalextraData: object

        Additional data to store int he link

      • Optionaloptions: object = {}

        Additional options

      Returns Promise<boolean>

      • Whether a link was created.
    • Display the chat card for an Item as a message in chat

      Parameters

      • OptionalmessageData: object = {}

        Optional data that will be merged into the message data.

      • Optionaloptions: { token?: TokenDocument } = {}

        Additional options.

        • Optionaltoken?: TokenDocument

          Relevant token if any.

      Returns Promise<void | ChatMessage<"base" | ModuleSubType>>

      Chat message instance if one was created.

    • Executes all script calls on this item of a specified category.

      Parameters

      • category: string

        The category of script calls to call.

      • OptionalextraParams: Record<string, any> = {}

        A dictionary of extra parameters to pass as variables for use in the script.

      • Optionalshared: object = {}

        Shared data object

      Returns Promise<object>

      The shared object between calls which may have been given data.

    • Attack sources for a specific action.

      Parameters

      • actionId: string

        Action ID

      • Optionaloptions: { rollData?: object } = {}

        Additional options

        • OptionalrollData?: object

          Roll data instance

      Returns undefined | object[]

      Array of value and label pairs for attack bonus sources on the main attack, or undefined if the action is missing.

    • Generates ChatData for this item, either in a default configuration or for a specific action.

      Parameters

      • Optionaloptions: {
            actionId?: string;
            body: any;
            chatcard?: boolean;
            extended?: boolean;
            footer: any;
            header: any;
            interactive?: boolean;
            rollData?: object;
        } = {}

        Options affecting how descriptions are enriched. rollData

        • OptionalactionId?: string

          The ID of an action on this item to generate chat data for, defaults to ItemPF.defaultAction

        • body: any
        • Optionalchatcard?: boolean

          Is this actually for chat card.

        • Optionalextended?: boolean

          Include extended information that may not be useful in all circumstances.

        • footer: any
        • header: any
        • Optionalinteractive?: boolean
        • OptionalrollData?: object

          Defaults to ItemAction#getRollData/ItemPF#getRollData.

      Returns Promise<ChatData>

      The chat data for this item (+action)

    • Finds, filters and alters changes relevant to a context, and returns the result (as an array)

      Parameters

      • context:
            | "mwdamage"
            | "twdamage"
            | "rwdamage"
            | "sdamage"
            | "mattack"
            | "wdamage"
            | "nattack"
            | "rattack"
            | "tattack"
            | "rdamage"
            | "mdamage"
            | "ndamage"
            | "tdamage" = ...

        The given context.

      Returns ItemChange[]

      • The matching changes.
      • Always returns empty array if no actor is present.
    • Get default charge cost for all actions.

      Parameters

      • Optionaloptions: { rollData?: object } = {}

        Additional options

        • OptionalrollData?: object

          Roll data instance

      Returns number

      Number for default cost.

    • Get full description.

      Parameters

      • options: {
            actionId: any;
            body?: boolean;
            chatcard?: boolean;
            data?: object;
            header?: boolean;
            identified?: boolean;
            isolated?: boolean;
            rollData?: object;
        } = {}

        Item type dependant options for rendering the description.

        • actionId: any
        • Optionalbody?: boolean

          Include main description body if such exists.

        • Optionalchatcard?: boolean

          Instruct template to render chat card in mind.

        • Optionaldata?: object

          Template data for rendering

        • Optionalheader?: boolean

          Include header if such exists.

        • Optionalidentified?: boolean

          Enforce identified description retrieval

        • Optionalisolated?: boolean
        • OptionalrollData?: object

          Roll data for transforming description

      Returns Promise<string>

      • Full description.
    • Description Data

      Required to be async due to spell associated class map building.

      Parameters

      • options: { actionId?: string; isolated?: boolean; rollData?: object } = {}

        Additional options

        • OptionalactionId?: string

          ID of an action. Default action is used if undefined.

        • Optionalisolated?: boolean

          Include extra data to reflect it not being so easily available in context.

        • OptionalrollData?: object

          Roll data instance

      Returns Promise<object>

      • Description context data
    • Get item links of type

      Parameters

      • type: string

        Link type

      • includeLinkData: boolean = false

        Include link data, return value changes from item array to object array

      • Optionaloptions: { _results?: Set<any>; recursive?: boolean } = {}

        Additional options

        • Optional_results?: Set<any>

          Internal use only.

        • Optionalrecursive?: boolean

          Retrieved linked items recursively.

      Returns Promise<object[] | Item<"base" | ModuleSubType>[]>

      • Linked items, or objects with linked items and additional data
    • Retrieve list of linked items for a type, synchronously. Intended mainly for fetching child or charge links quickly.

      Parameters

      • type: string

        Link type, e.g. "children", "charges", or "classAssociations"

      • Optionaloptions: { _results?: Set<string>; recursive?: boolean } = {}

        Additional options

        • Optional_results?: Set<string>

          Internal use only

        • Optionalrecursive?: boolean

          Retrieve links recursively.

      Returns object[] | Item<"base" | ModuleSubType>[]

      Linked items or their compendium index data

      const childItems = item.getLinkedItemsSync("children");
      
    • Parameters

      • Optionalweapon: boolean = true

        Get proficiency as a weapon. Armor otherwise.

      Returns boolean

      • Whether or not the owner of the item is proficient.
      • If item type does not support proficiency.

      PF1 v10

    • Determines the starting data for an ActiveEffect based off this item.

      Parameters

      • options: { rollData: object } = {}

        Additional options

        • rollData: object

          Roll data

      Returns Promise<object>

      • Active Effect creation data
    • Returns the displayed value of an item according to multiple options

      Parameters

      • Optionaloptions: {
            forceUnidentified?: boolean;
            identical?: boolean;
            inLowestDenomination?: boolean;
            maximized?: boolean;
            recursive?: boolean;
            sellValue?: number;
            single?: boolean;
        } = {}

        Various optional parameters affecting value calculations

        • OptionalforceUnidentified?: boolean

          Override whether the value should use the unidentified price

        • Optionalidentical?: boolean

          Treat all items in stack as identical (same number of charges).

        • OptionalinLowestDenomination?: boolean

          Whether the value should be returned in the lowest denomination

        • Optionalmaximized?: boolean

          Pretend as if the items were fresh (full charges)

        • Optionalrecursive?: boolean

          Whether the value of contained items should be included

        • OptionalsellValue?: number

          The sell value multiplier

        • Optionalsingle?: boolean

          Return value of singular item instead of the actual stack. Disables recursive option.

      Returns number

      The item's value

    • Recharges item's uses, if any.

      Parameters

      • options: {
            commit?: boolean;
            context?: object;
            exact?: boolean;
            maximize?: boolean;
            period?: "round" | "minute" | "hour" | "day" | "week" | "any";
            rollData?: object;
            value?: number;
        } = {}

        Options

        • Optionalcommit?: boolean

          Commit update directly. If false, returns the update data instead.

        • Optionalcontext?: object

          Update context

        • Optionalexact?: boolean

          Use exact time period. Otherwise "week" for example will also recharge items with "day" period.

        • Optionalmaximize?: boolean

          Recharge to full regardless of recharge formula.

        • Optionalperiod?: "round" | "minute" | "hour" | "day" | "week" | "any"

          Recharge period. Use "any" to ignore item's configuration.

        • OptionalrollData?: object

          Roll data instance to use for formulas.

        • Optionalvalue?: number

          Recharge to specific value, respecting maximum and minimum bounds.

      Returns Promise<undefined | object | ItemLootPF>

      • Promise for the update, update data object, or undefined (no update needed).
    • Removes a boolean flag from this item.

      Parameters

      • flagName: string

        The name/key of the flag to remove.

      • context: object = {}

        Update context

      Returns Promise<boolean>

      Whether something was changed.

    • Removes all link references to an item.

      Parameters

      • uuid: string

        The UUID of the item to remove links to.

      • Optionaloptions: { commit?: boolean } = {}

        Additional options

        • Optionalcommit?: boolean

          Commit changes to database. If false, resulting update data is returned instead.

      Returns Promise<undefined | object | Item<"base" | ModuleSubType>>

      • Updated document, update data, or undefined
    • Set item's active state.

      Parameters

      • active: any

        Active state

      • context: any

        Optional update context

      Returns Promise<Item<"base" | ModuleSubType>>

      • Update promise if item type supports the operation.
      • If item does not support the operation.
    • Sets a dictionary flag value on this item.

      Parameters

      • flagName: string

        The name/key of the flag to set.

      • value: string | number

        The flag's new value.

      • context: object = {}

        Update context

      Returns Promise<boolean>

      Whether something was changed.

    • Use an attack, using SharedActionData

      Parameters

      • options: {
            actionId?: string;
            chatMessage?: boolean;
            cost?: number;
            dice?: string;
            ev?: null | Event;
            options?: UseOptions;
            rollMode?: string;
            skipDialog?: boolean;
            token?: TokenDocument;
        } = {}

        Options

        • OptionalactionId?: string

          The ID of the action to use, defaults to the first action

        • OptionalchatMessage?: boolean

          Whether to send a chat message for this action

        • Optionalcost?: number

          Cost override. Replaces charge cost or slot cost as appropriate.

        • Optionaldice?: string

          The base dice to roll for this action

        • Optionalev?: null | Event

          The event that triggered the use, if any

        • Optionaloptions?: UseOptions

          Additional use options.

        • OptionalrollMode?: string

          The roll mode to use for the chat message

        • OptionalskipDialog?: boolean

          Whether to skip the dialog for this action

        • Optionaltoken?: TokenDocument

          Token this action is for, if any.

      Returns Promise<void | ActionUse | SharedActionData>

      • Action use, shared data, or nothing.
      • On some invalid inputs.
    • Internal

      Collect information on supplemental items and create them

      Parameters

      • items: Item<"base" | ModuleSubType>[]

        Array of items to draw supplemental data from

      • actor: Actor<"base" | ModuleSubType>

        Owner

      Returns Promise<void>

    • On-Create Operation

      Post-create processing so awaiting the original operation has all secondary updates completed when it returns.

      Parameters

      • documents: Document[]

        Documents

      • operation: any

        Operations and context data

      • user: User

        Triggering user

      Returns Promise<void>

    • On-Delete Operation

      Post-delete processing so awaiting the original operation has all secondary updates completed when it returns.

      Parameters

      • documents: Document[]

        Documents

      • operation: any

        Operations and context data

      • user: User

        Triggering user

      Returns Promise<void>

    • On-Update Operation

      Post-update processing so awaiting the original operation has all secondary updates completed when it returns.

      Parameters

      • documents: Document[]

        Documents

      • operation: any

        Operations and context data

      • user: User

        Triggering user

      Returns Promise<void>

    • Item create dialog.

      Parameters

      • data: object = {}

        Initial item data

      • createOptions: {} = {}
      • __namedParameters: {} = {}

      Returns Promise<null | Item<"base" | ModuleSubType>>

      Synchronized with Foundry VTT v13.347

    • Override to provide naming by subType potential.

      Parameters

      • context: {
            pack?: null | string;
            parent?: null | Document;
            subType?: string;
            type?: string;
        } = {}

        Context where the name would be used

        • Optionalpack?: null | string

          Pack this would be within

        • Optionalparent?: null | Document

          Parent document

        • OptionalsubType?: string

          Document subtype. Nonstandard option.

        • Optionaltype?: string

          Type

      Returns string

      Synced with Foundry v12.331