The singleton registry of script call categories/trigger events. At runtime this registry is accessible as pf1.registry.scriptCalls.

Hierarchy (View Summary)

Constructors

Properties

The class each of this registry's content is expected to be an instance of.

_defaultData: readonly [
    {
        _id: "use";
        info: "Called when the item has been 'used' (attack, drink potion, etc.). Has the extra array variable <code>attacks</code>, which contains the action's attack rolls, if any.";
        itemTypes: readonly [
            "attack",
            "buff",
            "feat",
            "loot",
            "equipment",
            "implant",
            "consumable",
            "spell",
            "weapon",
        ];
        name: "Use";
    },
    {
        _id: "postUse";
        info: "Called after the item has been 'used' and all relevant processing by the system has finished.";
        itemTypes: readonly [
            "attack",
            "buff",
            "feat",
            "loot",
            "equipment",
            "implant",
            "consumable",
            "spell",
            "weapon",
        ];
        name: "Post-Use";
    },
    {
        _id: "equip";
        info: "Called when the item has been equipped or unequipped. Has the extra boolean variable <code>equipped</code>.";
        itemTypes: readonly ["weapon", "equipment", "loot"];
        name: "Equip";
    },
    {
        _id: "implant";
        info: "Called when the item has been implanted or unimplanted. Has the extra boolean variable <code>implanted</code>.";
        itemTypes: readonly ["implant"];
        name: "Implant";
    },
    {
        _id: "toggle";
        info: "Called when the item has been enabled or disabled. Has the extra boolean variable <code>state</code>.";
        itemTypes: readonly ["buff", "feat"];
        name: "Toggle";
    },
    {
        _id: "changeQuantity";
        info: "Called when the quantity of the item has been changed. Has the extra numeric variables <code>quantity.previous</code> and <code>quantity.new</code>.";
        itemTypes: readonly [
            "loot",
            "equipment",
            "weapon",
            "implant",
            "consumable",
            "container",
        ];
        name: "Change Quantity";
    },
    {
        _id: "changeLevel";
        info: "Called when the level of the item has been changed. Has the extra numeric variables <code>level.previous</code> and <code>level.new</code>.";
        itemTypes: readonly ["buff", "class"];
        name: "Change Level";
    },
] = ...

An array of data used to initialize this registry.

model: typeof ScriptCallCategory = ScriptCallCategory

The class each of this registry's content is expected to be an instance of.

Accessors

Methods

  • Returns an object of the registry's contents, with the id as key and the name as value.

    Parameters

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

      Additional options

      • Optionalsort?: boolean

        Sort result

    Returns { [id: string]: string }

    The names of each value in the registry, by id

  • Registers a new instance of Model with the registry, using a partial of its data as the base.

    Parameters

    • namespace: string

      The namespace for which this value is registered.

    • id: string

      The unique key of the value.

    • value: object

      A Partial of the data to use as the base for the new value.

    Returns Registry<any>

    The registry itself, after the value has been registered.

    pf1.registry.damageTypes.register("my-module", "my-damage-type", {
    name: "My Damage Type",
    img: "icons/svg/damage.svg",
    category: "physical",
    });
  • Returns the contents of this registry as object, using ids as keys.

    Parameters

    • Optionalsource: boolean = false

      Whether to include the source data instead of its prepared data for each value.

    Returns { [id: string]: object }

    The data of each value in the registry, by id

  • Unregisters a value from the registry, or if no id is provided, all values belonging to the namespace.

    Parameters

    • namespace: string

      The namespace for which this value is unregistered.

    • Optionalid: string

      The unique key of the value, or undefined to unregister all values belonging to the namespace.

    Returns void