RPCPlugin

v2.5.0·Updated 2026-06-20

This is a developer network tool to send messages over RPC via Photon

About this mod Author’s original text

RPC Plugin

This is a plugin for TaleSpire using BepInEx, it creates a consumer and service for sending data over RPC. This is designed to be light weight for small messages. If you want large messages then you should host the file externally and only message a pointer to it. This is to reduce the impact on the performance and server costs from sending large messages.

Install

Currently you need to either follow the build guide down below or use the R2ModMan.

Usage

Reference this dependency plugin in the parent plugin and then use the following syntax to add a chat

service:.AddHandler(serviceKey, handler)

Where the service key is a string that must appear at the beginning of the rpc message in order to trip the corresponding handler.

Where hander is a function that takes in two string, the message content and the sender, and a source which is a ChatSource enumeration indicating if the source if a GM message, player message or creature message. The handler returns a string for Interface compatibility.

An example of adding a inline handler for "/w" function would be:

`RPCManager.AddHandler("/w", (chatMessage, sender, source)=> { Debug.Log(sender+" whispered "+chatMessage); });`

An example of removing a inline handler for "/w" function would be:

`RPCManager.RemoveHandler("/w");`

Usage programatically

`RPCManager.SendMessage(message, sender);`

Where message is the content to be sent and should include the handling prefix.

Where sender is the NGuid of either a creature mini (CreatureId) or player (PlayerId).

For example, to use the above hander for "/doSomething" assuming it is a whisper message to the GM:

`RPCManager.SendMessage("/doSomething{\"I'm a\": \"json\"}", LocalPlayer.Id.Value)`

Usage Consumer and Messenger framework

RPC Manager now supports a Consumer and messenger workflow allowing a singleton

public class MyMessage: RpcMessage

{

// Example Data

internal int I { get; set; }

public MyMessage()

{

}

// Serialize to Binary

public override byte Value()

{

IEnumerable bytes = new List();

bytes = bytes.Concat(BitConverter.GetBytes(I));

return bytes.ToArray();

}

// Construct from Binary

public MyMessage(byte data)

{

I = BitConverter.ToInt32(data, 0);

}

}

[InitOnLoad]

public class MyConsumer: RpcConsumer

{

private static readonly MyConsumer instance = new MyConsumer();

static MyConsumer() { } // Make sure it's truly lazy

public static MyConsumer Instance { get { return instance; } }

// My constructor (If I wanted something to happen)

private MyConsumer(): base ()

{

}

public override void Handle(MyMessage message)

{

Debug.Log(message.I);

}

}

Compiling

Build the project using nuget.

Browse to the newly created /Debug or /Release folders and copy the.dll to \steamapps\common\TaleSpire\BepInEx\plugins

Changelog

  • 2.5.0: Use updated HideVolumeManager for RPC, removed patch.
  • 2.4.3: migrate to DependencyUnityPlugins to allow enable/disable the plugin without uninstalling it via chainloader
  • 2.4.2: Moved Binary Serialization libraries into separate modpack so they don't have to get re-downloaded each update.
  • 2.4.1: Bump SetInjectionFlag package version
  • 2.4.0: DependencyUnityPlugins is now used and implements logic for unpatching
  • 2.3.2: ZeroFormatter was missed, repacked into Deployment.
  • 2.3.1: Update Project files and fix bepinex dependencies with SetInjectionFlag
  • 2.3.0: Tidied up references, static typing, and fix github pipeline.
  • 2.2.1: Fix threading issue
  • 2.2.0: Fixed RPCManager and now it is a supported provider for ADP
  • 2.1.2: Sample project now uploaded on the git repo using message and consumer
  • 2.1.1: Message Id Optimization
  • 2.1.0: Added Binary message and Consumer workflow for messaging.
  • 2.0.1: Fix dependency in pipeline
  • 2.0.0: NuGet and restarting the project
  • 1.0.0: Slight Optimization, Official Release
  • 0.9.5: Updated depended dll
  • 0.9.4: Hide Volume Support and Parallelization
  • 0.9.3: Refactor RPCManager to a static class
  • 0.9.2

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:

bbepisTaleSpire-BepInExPackbrcoding-SetInjectionFlagPluginHolloFox_TS-Binary_Serialization_Libraries

File & checksum

Filename
RPCPlugin-2.5.0.zip
File size
28.1 KiB