You are viewing a potentially older version of this package. View all versions.
LordAshes-ChatService-2.2.1 icon

ChatService

Dependency plugin to add services to the chat.

Date uploaded 2 years ago
Version 2.2.1
Download link LordAshes-ChatService-2.2.1.zip
Downloads 132
Dependency string LordAshes-ChatService-2.2.1

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
LordAshes-FileAccessPlugin-1.4.1 icon
LordAshes-FileAccessPlugin

Provides standardized methods for accessing both local file and url resources. Automatically handles searching local folders for assets.

Preferred version: 1.4.1
HolloFox_TS-RadialUIPlugin-2.6.0 icon
HolloFox_TS-RadialUIPlugin

This is a developer tool based package used to manage and configure Radial UI Menus.

Preferred version: 2.6.0

README

Chat Service Plugin

This unofficial TaleSpire plugin is a dependency plugin for creating local chat service functionality. The plugin allows registering of key words with corresponding handlders to create functionality such as whispers or dice rolling functionality.

Change Log

2.2.1: Improved logs and handler processing
2.2.0: Improved speaker setting code to eliminate exception at start
2.1.1: Made method for checking if a chat key is registered
2.1.0: Added custom header messages
2.1.0: Improved patching to not replace code so that it works with updates like the chat ! roll
2.1.0: Removed legacy code and legacy access
2.0.2: Fix bug with diagnostic configuration setting
2.0.1: Added configurable diagnostic log level
2.0.0: Fix after BR HF Integration update
1.2.0: Added ChatMessageService class for proper subscription and sending handling and AssetData support.
1.1.2: Corrected documentation. No plugin change.
1.1.1: Fixed soft dependency check to avoid exception when soft dependency is not found
1.1.1: Corrected dependency list to include FileAccessPlugin
1.1.0: Added optional deselect action to the character radial menu to deselect the mini and returns
       the chat box input back to speaking a player (and not creature). Can be turned on or off in
	   the R2ModMan settings for plugin. If on, requires RadialUI plugin. If off, RadialUI plugin is
	   not needed.
1.0.1: Added source in the handler to distinguish messages from gm, player or creature.
1.0.1: Fixed bug when using multiple hanlders and one returns a null.
1.0.0: Initial release

Install

Use R2ModMan or similar installer to install this plugin.

Optional Dependency

Chat Service Plugin has a soft dependency on Radial UI plugin. If the deselect option is turned on in the settings then Radial UI plugin is required. If the deselect option is turned off then Radial UI plugin is not required.

Usage

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

chatMessgeServiceHandlers.Add(serviceKey, handler)

Where the service key is a string that must appear at the beginning of the chat 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 hanlder returns a string, the modified message or null. Returning null prevents the message from being displayed.

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

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

### Usage programatically

You can also use this function for sending messages to other clients without having the request triggered
by the user from the chat. This can be done by using the core TS function:

``ChatManager.SendChatMessage(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 "/w" assuming it is a whisper message to the GM:

``ChatManager.SendChatMessage("/w I pickpocket the person I am speaking to", LocalPlayer.Id.Value)``

### Custom Headers

Messages whose content contains text in square brackets is treated as custom header messages. The message
must start with an opening square bracket, have some text, have an ending square bracket, and finally have
some content. Such messages will replace the usual character or player name in the chat message header with
the contents between the square brackets and limit the message content to the contents after the ending
square. For example:

[Bilbo]Is it time to eat yet?

Would create a chat message whose header would be "Bilbo" and message content would be "Is it time to eat yet?"
regardless of who sent the message.