LordAshes-StatMessagingPlugin icon

StatMessagingPlugin

Adds support for JSON broadcast messages to clients, based on Creature Name synchronization. Use this plugin for any Character Name synchronization to ensure compatability with other plugins.

Last updated 5 days ago
Total downloads 121
Total rating 0 
Categories Networked Integration
Dependency string LordAshes-StatMessagingPlugin-1.2.1
Dependants 7 other mods depend on this mod

This mod requires the following mods to function

bbepisTaleSpire-BepInExPack-5.4.10 icon
bbepisTaleSpire-BepInExPack

Unified BepInEx all-in-one modding pack - plugin framework, detour library

Preferred version: 5.4.10
brcoding-SetInjectionFlagPlugin-2.3.0 icon
brcoding-SetInjectionFlagPlugin

Allows players to flag mods are installed

Preferred version: 2.3.0

README

Stat Messaging Plugin

This unofficial TaleSpire plugin is for adding JSON broadcast messages to all clients.
If you plan to use the Creature Name synchronization for distributing messages to other client,
please use this plugin because it will ensure that there is no conflict between other plugins
using the same synchronization technique.

Change Log

1.2.1: Fixed bug with renaming mini
1.2.0: Implemented subscription implementation fixing the bug that one parent plugin consumed all changes.
Plugins should now use the Subscribe() method and don't need to call the Check() method anymore but
legacy support has been added to support the previous Check() architecture while fixing the bug.
1.2.0: Removed a log of diagnostic infomation put into the log
1.1.2: Bug fix to ReadInfo
1.1.1: Added ReadInfo to be able to read the last value for a given key
1.1.0: Initial contents are processed as changes
1.1.0: Reset added for situations like board changes where old data should be purged
1.0.0: Initial release

Install

Install using R2ModMan or similar. The plugin is then available for any parent plugin to use it.

Usage

To check for Stat Messaging changes (i.e. messages), issue the following command:

StatMessaging.Subscribe(*key*, *callback*);

This is a static method so you don't need to initialize any class to do it. This method triggers
the specified callback when the specified key changes. Multiple subscriptions to the same key can
be made (typically by different plugins) without one consuming the data changes. An asteriks (*) can be
used in place of the key to subscribe to all messages but this is typically not needed since a plugin
will be written for specific key changes. Subscribing to specific keys means the parent plugin will
only get changes for that key which typically means only changes that the plugin is interested in.
Using the wild card asteriks means the parent plugin gets all messages and needs to sort through them
in order to determine which are relevant. The subscribe method returns a Guid which can be used with
the Unscubscribe command to remove subscriptions.

Messages are sent using a key/value pair system. Typically a plugin will set one or more keys and
will monitor for those key changes. To set a key with a value, issue the following command:

StatMessaging.SetInfo(cid, *keyName*, *content*);

Where keyName is a unique string that identifies the content. The keyName can be considered to
identify the communication channel (not the piece of data). Typically a plugin will use one key
for its information but in some cases a plugin may more than one key.

Where content is a string of the data to be sent.

It should be noted that Stat Messaging works on changes. Sending the same content as was already
posted will not generate new notifications. If it is possible that the same content needs to be
send multiple times, the plugin will need to implement a reset (e.g. change content to blank and
have the plugin ignore blank changes) and then repost the desired content.

To clear a key that is no loner needed, use the following code:

StatMessaging.ClearInfo(cid, *keyName*);

Warning About Keys

Ideally a plugin should use one common key (i.e. a hard code key which is not determined by any
value such a campaign id or board id) for all communication. However, as mentioned, in some cases
using multiple keys can be advantageous. In such a case, please ensure that the number of keys
used is finite and small. There may be a limit to the Character Name length and using multiple
keys quickly depleats such a length limitation.

Similarly don't keys which are tied to some values that will change between sessions because
this will mean that the keys from old sessions will no longer be used but will still be present
on the minis.

if possible, use the ClearInfo() if a key is no longer going to be used.

Rename Character Compensation

When a character is renamed using the GM Options, the trailing information (not viaible in the
rename) is likely to be erased. The Stat Messaging plugin has compensation for this and will
detect such occurances and re-link the last known stat block information with the renamed
character.

Available versions

Please note that the install buttons only work if you have compatible client software installed, such as the Thunderstore Mod Manager. Otherwise use the zip download links instead.

Upload date Version number Downloads Download link  
2021-6-16 1.2.1 58 Version 1.2.1 Install
2021-6-10 1.2.0 44 Version 1.2.0 Install
2021-6-8 1.1.2 12 Version 1.1.2 Install
2021-6-8 1.1.1 2 Version 1.1.1 Install
2021-6-8 1.1.0 3 Version 1.1.0 Install
2021-6-7 1.0.0 2 Version 1.0.0 Install