DiceOpsPlugin

v1.1.1·Updated 2025-11-13

Dependency plugin for easily subscribing to dice related events and easier parsing of dice results.

About this mod Author’s original text

Dice Operations Plugin

This unofficial TaleSpire mod allows users to create dice related plugins more easily. The plugin allows you to

subscrive to notification for various dice related events (both before and after the event), provides two virtual

methods that can be overriden to change dice results before they are displayed, and provides a helper function to

convert the convoluted dice results to a much more easily read format.

Install

Use R2ModMan or similar installer to install. Since this is a dependency plugin it will be installed automatically

when needed. The user does not need to install this plugin.

Usage

Dice Notifications

There are three functions for managing notifications:

`System.Guid AddNotification(EventCallbackDelegate)`

`void RemoveNotification(System.Guid subscrition))`

When a notification is added, a subscription guid is returned which can be used with the RemoveNotification methods

to unsubscribe from any notifications associated with the subscription guid.

The following events are available:

`LoadDiceInTrayCallback(DiceEvent diceEvent,RollId rollId,ref DiceRollDescriptor rollDescriptor,ref bool showResult)`

`SpawnDiceFromTrayCallback(DiceEvent diceEvent, RollId rollId, DiceRollDescriptor diceRollDescriptor, ref float3 pos, ref bool isGmRoll, ref bool showResult)`

`GatherDiceCallback(DiceEvent diceEvent, RollId rollId, ref Vector3 position)`

`RollDiceCallback(DiceEvent diceEvent, RollId rollId, ref float3 velocity)`

`ClearDiceCallback(DiceEvent diceEvent, RollId rollId)`

`DiceRollResultCallback(DiceEvent diceEvent, RollId rollId, ref Dice.RollResults rollResultData, ref ClientGuid sender)`

`DiceRollChatResultCallback(DiceEvent diceEvent, RollId rollId, ref RollResults diceResult, ref UIChatMessageManager.DiceResultsReference.ResultsOrigin origin, ref ClientGuid sender, ref bool hidden, UIChatMessageManager.IChatFocusable focus = null)`

It is possible to either provide the callback as a lambda expression or as a callback method:

AddNotification((RollDiceCallback)((DiceEvent diceEvent, RollId rollId, ref float3 velocity) => { LoggingPlugin.LogDebug("Event: "+diceEvent+", RollId: "+rollId+", Velocity: "+velocity); }));

or

AddNotification((RollDiceCallback)rollCallback);

public void rollCallback(DiceEvent diceEvent, RollId rollId, ref float3 velocity)

{

LoggingPlugin.LogDebug("Event: "+diceEvent+", RollId: "+rollId+", Velocity: "+velocity);

}

It should be noted that notification will trigger with a before and after event. Use the diceEvenet parameter to identify which event the callback is associated with.

DiceEvents is an enumeration of the following events:

DiceEvents.beforeLoadDiceInTray

DiceEvents.afterLoadDiceInTray

DiceEvents.beforeSpawnDiceFromTray

DiceEvents.afterSpawnDiceFromTray

DiceEvents.beforeGatherDice

DiceEvents.afterGatherDice

DiceEvents.beforeRollDice

DiceEvents.afterRollDice

DiceEvents.beforeDiceRollResult

DiceEvents.afterDiceRollResult

DiceEvents.beforeDiceRollChatResult

DiceEvents.afterDiceRollChatResult

DiceEvents.beforeClearDice

DiceEvents.afterClearDice

Each callback has different parameters that it provies but all callbacks have DiceEvent and RollId as the first two parameters.

Dice Methods

Dice operations can be do using the provided IEnumerator methods. The following methods are available:

`IEnumerator SpawnTrayDice(float delay)`

`IEnumerator GatherDice(RollId rollId, Vector3 pos, float delay)`

`IEnumerator RollDice(RollId rollId, float delay)`

`IEnumerator ClearDice(RollId rollId, float delay)`

Where rollId is usually obtaine from one of the notifications (excluding either of the LoadDiceInTray which always some back with a default roll id).

These functions are intended to be run as Coroutines and thus something like:

`_self.StartCoroutine(DiceOpsPlugin.SpawnTrayDice(0.5f));`

Result Modification

Many of the parameters provided to the callback are ref parameters allowing the callback to modify these parameters. Typically the user will want to change these

Install & use Install: follow the bundled instructions

  1. Unzip the archive from playbuff and read the bundled readme / instructions first.
  2. Most mods rely on the game's mod loader — the usual route is a community mod manager (such as r2modman): pick this game, install, and it handles the loader and dependencies.
  3. For a manual install, put the mod files into the matching Mod / plugins folder inside the game directory.
  4. Launch the game to confirm it loaded; mods with listed dependencies need those installed as well.

Install locations vary a lot between mods — the bundled readme is the most reliable guide.

Dependencies

Install these first, or the mod will not work:

LordAshes-LoggingPlugin

File & checksum

Filename
DiceOpsPlugin-1.1.1.zip
File size
35.5 KiB