Repository navigation
Data Model References
System Version 4.0.0
system.abilities.<str|dex|con|int|wis|cha>.value: int
system.alignment: string <"lawful", "neutral", "chaotic">
system.attributes.ac.value: int
system.attributes.ac.<this|armor_base_type|name_of_property|unarmored>: int
system.attributes.hp.max: int
system.attributes.hp.value: int
system.coins.<gp|sp|cp>: int
system.languages: Array < uuid >
system.level.value: int
system.level.xp: int
system.luck.available: int
system.luck.remaining: int
system.renown: int
system.slots: int
system.spellcasting.classes : Array < String >
system.abilities.<str|dex|con|int|wis|cha>.mod: int
system.ancestry: uuid
system.background: uuid
system.class: uuid
system.deity: uuid
system.patron: uuid
system.slotUsage.<coins|gear|gems|treasure|total> int
system.abilities.<str|dex|con|int|wis|cha>.mod: int
system.abilities.<str|dex|con|int|wis|cha>.value: int
system.attributes.hp.max: int
system.attributes.hp.value: int
system.attributes.ac.value: int
Active Effects may target any data model keys. Formulas can be used but they must be deterministic and resolve to an integer number. ie @level.value + 1
shadowdark.dice.rollFromConfig(rollConfig)
rollConfig
{
// Actor context
"actorId": "string (UUID)", // required — the rolling actor
"itemUuid": "string (UUID)", // optional — weapon/spell/item being used
"targetUuid": "string (UUID)", // optional — target token/document
// Roll presentation
"type": "string", // "check" | "attack" | "spell" | "ability" | "damage"
"heading": "string", // display heading (localization key or plain string)
"rollMode": "string", // CONST.DICE_ROLL_MODES: "public" | "private" | "blind" | "self"
"skipPrompt": "boolean", // skip the roll dialog and roll immediately
"descriptions": ["string"], // array of HTML description strings shown on card
// Situational effects
"situational": ["string (UUID)"], // available situational effect UUIDs
"selected": ["string (UUID)"], // chosen situational effect UUIDs (set in dialog)
// Type-specific sub-objects (one present depending on roll type)
"check": { /* see CheckOptions */ },
"attack": { /* see AttackOptions */ },
"cast": { /* see CastOptions */ },
// Roll sub-objects (both share rollOptions schema)
"mainRoll": { /* rollOptions */ },
"damageRoll": { /* rollOptions */ }
}
rollOptions
{
// Formula
"type": "string", // "main" (mainRoll) | "damage" (damageRoll) — set internally
"base": "string", // base die: "d20", "d12", "d8", "d6", etc.
"formula": "string", // full dice formula: "d20+5", "2d6+3"
"modified": "boolean", // true if user edited the formula in the dialog
"bonus": "string", // formatted bonus portion: " + 5" | " - 2"
"label": "string", // display label for the roll row
// Outcome thresholds
"dc": "number", // difficulty class for success/failure evaluation
"canCritical": "boolean", // whether criticals apply
"criticalSuccessAt": "number", // die face that triggers a crit (e.g. 20)
"criticalFailureAt": "number", // die face that triggers a fumble (e.g. 1)
// Advantage system
"advantage": "number", // 1 = advantage | 0 = normal | -1 = disadvantage
// Tooltip string shown in the roll breakdown
"tooltips": "string", // comma-separated descriptor strings
// Reroll flag
"reroll": "boolean", // true when this roll is a reroll
// damageRoll-only fields
"criticalHit": "boolean", // true when the paired mainRoll was a crit
"criticalMultiplier": "number", // damage multiplier on crit (e.g. 2)
}
Active effects can be used to modify the properties of rolls. The last part of the key modifies whether the modifier will apply to all rolls, using items with a specific name or property, or only when using the item that has the effect (this). String type keys can contain full roll formulas, but Int types can only use deterministic formulas.
system.roll.spell.advantage.<all|name_of_spell> int < 1 or -1 >
system.roll.spell.bonus.<all|name_of_spell> string
system.roll.spell.damage.<all|name_of_spell> string
system.roll.<attack|melee|ranged>.advantage.<all|this|weapon_type|name_of_property> int < 1 or -1 >
system.roll.<attack|melee|ranged>.bonus.<all|this|weapon_type|name_of_property> string
system.roll.<attack|melee|ranged>.damage.<all|this|weapon_type|name_of_property> string
system.roll.<attack|melee|ranged>.extra-damage-die.<all|this|weapon_type|name_of_property> int
system.roll.<attack|melee|ranged>.upgrade-damage-die.<all|this|weapon_type|name_of_property> int < 4 to -4 >
system.roll.<attack|melee|ranged>.critical-multiplier.<all|this|weapon_type|name_of_property> int
system.roll.<attack|melee|ranged>.critical-threshold.<all|this|weapon_type|name_of_property> int
system.roll.<attack|melee|ranged>.failure-threshold.<all|this|weapon_type|name_of_property> int
system.roll.ability.advantage.<all|name_of_ability> int < 1 or -1 >
system.roll.ability.bonus.<all|name_of_ability> string
system.roll.ability.damage.<all|name_of_ability> string
system.bonus.backstabdice int
system.roll.hp.advantage int < 1 or -1 >
system.roll.hp.bonus string
system.roll.initiative.advantage int < 1 or -1 >
system.roll.initiative.bonus string
system.roll.stat.advantage.<all|str|dex|con|int|wis|cha> int < 1 or -1 >
system.roll.stat.bonus.<all|str|dex|con|int|wis|cha> int
Fires while the roll dialog is being prepared, before it renders. Can be used to modify dialog options such as situational effects, ammunition choices, and roll mode.
Cancellable: No
Argument: context (Object) — The prepared render context for the roll dialog
Fires after the roll dialog is confirmed, before an ability check is rolled. Applies to both PCs and NPCs.
Cancellable: Yes — returning false aborts the roll
Argument: config (Object) — The roll config object
Fires after the roll dialog is confirmed, before an attack roll is made.
Cancellable: Yes — returning false aborts the roll
Argument: config (Object) — The roll config object
Fires after the roll dialog is confirmed, before a player casts a spell.
Cancellable: Yes — returning false aborts the roll
Argument: config (Object) — The roll config object
Fires after the roll dialog is confirmed, before an attack roll is made.
Cancellable: Yes — returning false aborts the roll
Argument: config (Object) — The roll config object
Fires after the roll dialog is confirmed, before an NPC casts a spell.
Cancellable: Yes — returning false aborts the roll
Argument: config (Object) — The roll config object
Fires after the roll dialog is confirmed, before a class ability is used.
Cancellable: Yes — returning false aborts the action
Argument: config (Object) — The roll config object