

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.
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.
There are three functions for managing notifications:
System.Guid AddNotification(DiceEvents evt, Action<DiceEvents,RollId> notificationCallback)
System.Guid AddNotifications(List<DiceEvents> evt, Action<DiceEvents,RollId> notificationCallback)
void RemoveNotification(System.Guid subscrition))
When notification(s) are added, a subscription guid is returned which can be used with the RemoveNotification methods to unsubscribe from any notifications associated with the subscription guid.
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
The callback returns the event enumeration and the RollId. By returning the event enumeration, it is possible to use a common callback for multiple dice events.
The plugin trigger two virtual methods when posting dice results and when posting dice results into the chat. If a plugin wants to change the results (e.g. implement roll with advantage and disadvantage) before they are posted, the user can override these virtual functions.
public virtual Dice.RollResults ModifyDiceResult(Dice.RollResults rollResultData)
{
return rollResultData;
}
public virtual Dice.RollResults ModifyChatDiceResult(Dice.RollResults diceResult)
{
return diceResult;
}
These methods take in Dice.RollResults and return a Dice.RollResults. The method must return a Dice.RollResults in all cases but if the roll is one that does not need to be modified the method can just return the incoming Dice.RollResults as the virtual methods do.
A helper method is provided to parse Dice.RollResults objects. The helper function returns an object which contains the roll formula, an array of all dice values in the same order as the roll formula, and a array of all totals.
Sample usage:
var simplifiedRoll = DiceOpsPlugin.RollSimplifier.ParseRollResults(rollResultData);
LoggingPlugin.LogInfo($"Roll Id: {rollResultData.RollId}");
LoggingPlugin.LogInfo($"Roll Formula: {simplifiedRoll.RollString}");
LoggingPlugin.LogInfo($"Roll Dice: [{string.Join(", ", simplifiedRoll.AllDiceValues)}]");
LoggingPlugin.LogInfo($"Roll Totals: [{string.Join(", ", simplifiedRoll.Totals)}]");
would return something like:
2025.11.11 17:59:07.712 - Info - DiceOpsPlugin - Roll Formula: 1d20+5 / 1d8+3+2d6+2
2025.11.11 17:59:07.713 - Info - DiceOpsPlugin - Roll Dice: [9, 3, 1, 2]
2025.11.11 17:59:07.714 - Info - DiceOpsPlugin - Roll Totals: [14, 11]
Notice that the totals property is also an array providing the total for each roll group.
Currently the notification events are just that...notifications of those events occuring. They do not, however, provided any details about the event beyond the RollId. They also do not allow the results to be modified except for the virtual functions that are triggered when dice results are displayed.