Token Ring configuration Singleton Class.

Example

Add a new custom ring configuration. Allow only ring pulse, ring gradient and background wave effects.
const customConfig = new foundry.canvas.tokens.DynamicRingData({
id: "myCustomRingId",
label: "Custom Ring",
effects: {
RING_PULSE: "TOKEN.RING.EFFECTS.RING_PULSE",
RING_GRADIENT: "TOKEN.RING.EFFECTS.RING_GRADIENT",
BACKGROUND_WAVE: "TOKEN.RING.EFFECTS.BACKGROUND_WAVE"
},
spritesheet: "canvas/tokens/myCustomRings.json",
framework: {
shaderClass: MyCustomTokenRingSamplerShader,
ringClass: TokenRing
}
});
CONFIG.Token.ring.addConfig(customConfig.id, customConfig);

Example

Get a specific ring configuration
const config = CONFIG.Token.ring.getConfig("myCustomRingId");
console.log(config.spritesheet); // Output: canvas/tokens/myCustomRings.json

Example

Use a specific ring configuration
const success = CONFIG.Token.ring.useConfig("myCustomRingId");
console.log(success); // Output: true

Example

Get the labels of all configurations
const configLabels = CONFIG.Token.ring.configLabels;
console.log(configLabels);
// Output:
// {
// "coreSteel": "Foundry VTT Steel Ring",
// "coreBronze": "Foundry VTT Bronze Ring",
// "myCustomRingId" : "My Super Power Ring"
// }

Example

Get the IDs of all configurations
const configIDs = CONFIG.Token.ring.configIDs;
console.log(configIDs); // Output: ["coreSteel", "coreBronze", "myCustomRingId"]

Example

Create a hook to add a custom token ring configuration. This ring configuration will appear in the settings.
Hooks.on("initializeDynamicTokenRingConfig", ringConfig => {
const mySuperPowerRings = new foundry.canvas.tokens.DynamicRingData({
id: "myCustomRingId",
label: "My Super Power Rings",
effects: {
RING_PULSE: "TOKEN.RING.EFFECTS.RING_PULSE",
RING_GRADIENT: "TOKEN.RING.EFFECTS.RING_GRADIENT",
BACKGROUND_WAVE: "TOKEN.RING.EFFECTS.BACKGROUND_WAVE"
},
spritesheet: "canvas/tokens/mySuperPowerRings.json"
});
ringConfig.addConfig("mySuperPowerRings", mySuperPowerRings);
});

Example

Activate color bands debugging visuals to ease configuration
CONFIG.Token.ring.debugColorBands = true;

Properties

subjectPaths: Record<string, string> = {}

A mapping of token subject paths where modules or systems have configured subject images.

debugColorBands: boolean = false

All color bands visual debug flag.

#configs: Map<string, DynamicRingData> = ...

Ring configurations.

#currentConfig: DynamicRingData

The current ring configuration.

CORE_TOKEN_RINGS: Readonly<Record<string, RingData>> = ...

Core token rings used in Foundry VTT. Each key is a string identifier for a ring, and the value is an object containing the ring's data. This object is frozen to prevent any modifications.

CORE_TOKEN_RINGS_FIT_MODES: object = ...

Core token rings fit modes used in Foundry VTT.

#instance: TokenRingConfig

The token ring config instance.

#initialized: boolean = false

To know if the ring config is initialized.

#closedRegistration: boolean = true

To know if a Token Ring registration is possible.

Accessors

  • get ringClass(): any
  • Get the current ring class.

    Returns any

  • get effects(): Record<string, string>
  • Get the current effects.

    Returns Record<string, string>

  • get spritesheet(): string
  • Get the current spritesheet.

    Returns string

  • get shaderClass(): any
  • Get the current shader class.

    Returns any

  • get label(): string
  • Get the current localized label.

    Returns string

  • get id(): string
  • Get the current id.

    Returns string

  • get isGridFitMode(): boolean
  • Is a custom fit mode active?

    Returns boolean

  • get configIDs(): string[]
  • Get the IDs of all configurations.

    Returns string[]

    The names of all configurations.

  • get configLabels(): Record<string, string>
  • Get the labels of all configurations.

    Returns Record<string, string>

    An object with configuration names as keys and localized labels as values.

Methods

  • Add a new ring configuration.

    Parameters

    • id: string

      The id of the ring configuration.

    • config: RingConfig

      The configuration object for the ring.

    Returns void

  • Get a ring configuration.

    Parameters

    • id: string

      The id of the ring configuration.

    Returns RingConfig

    The ring configuration object.

  • Use a ring configuration.

    Parameters

    • id: string

      The id of the ring configuration to use.

    Returns boolean

    True if the configuration was successfully set, false otherwise.

  • Register the token ring config and initialize it

    Returns void

  • Register game settings used by the Token Ring

    Returns void