Skip to content

API Reference

This page lists the public/internal APIs of the TazeU Mod. All types are located in namespace TazeU.Scripts.

DGLabServer

WebSocket server core. Injects TazeUConfig upon construction, runs in an independent background thread.

csharp
public class DGLabServer(TazeUConfig config)

Properties

PropertyTypeDescription
IsConnectedboolWhether there are any bound clients
ConnectedCountintNumber of bound clients

Public Methods

Start()

Starts the WS listening thread. Creates a CancellationTokenSource and runs the TCP listen loop in the background thread TazeU-WS.

Stop()

Stops the server. Cancels the CTS, sends graceful close frames to all connected clients, and stops the TcpListener.

Restart()

Calls Stop() then Start(). Automatically triggered by ModConfig callbacks after port or bind address changes.

GetConnectUrl() → string

Returns the DG-LAB APP scan-to-connect URL:

https://www.dungeon-lab.com/app-download.php#DGLAB-SOCKET#ws://{ip}:{port}/{clientId}

TriggerShock(decimal damageValue)

Triggers a shock broadcast. Safe to call from any thread (fire-and-forget).

  1. Combo calculation (if enabled)
  2. Waveform selection
  3. Iterates over all bound clients, mapping intensity independently according to their channel caps
  4. Executing shock instruction asynchronously

DisconnectAll()

Disconnects all connected clients.

DisconnectClient(string targetId)

Disconnects the client with the specified targetId.

BlockClient(string targetId)

Blocks the specified client's IP address (session-level, not persisted). Subsequent connections from this IP will return a 403 error.

GetConnectedClients() → ClientInfo[]

Returns information DTOs for all connected clients.

csharp
public record ClientInfo(string TargetId, string RemoteEndpoint, DateTime ConnectedAt, bool IsBound);

Internal Methods

LoadCustomWaveforms()

Calls CustomWaveformLoader.LoadAll() to load/refresh custom Waveforms. Called in Entry.Init() prior to Start().

GetAllWaveformNames() → string[]

Returns an array of all available Waveform names: 8 built-in presets + custom Waveform keys + "Random". Used by the ModConfig dropdown menu.

DGLabProtocol

Protocol helper static class, providing Waveform presets and instruction formatting.

csharp
public static class DGLabProtocol

Waveform Constants

ConstantTypeDescription
BreathWaveV3string[]Breath (12 sets)
TideV3string[]Tide
BatterV3string[]Batter
PinchV3string[]Pinch
PinchRampV3string[]PinchRamp
HeartbeatV3string[]Heartbeat
SqueezeV3string[]Squeeze
RhythmV3string[]Rhythm
AllWaveformsstring[][]All presets collection

Static Methods

GetWaveformByName(string name) → string[]?

Looks up Waveform presets by name, case-insensitive. Returns null if not found.

StrengthCommand(int channelA, int channelB) → string

Generates strength control instructions:

csharp
StrengthCommand(50, 30) → "strength-0+0+50+30"

PulseCommand(string channel, string[] waveHexArray) → string

Generates pulse Waveform instructions:

csharp
PulseCommand("A", ["0A0A0A0A64646464"]) → "pulse-A:[\"0A0A0A0A64646464\"]"

ClearCommand(string channel) → string

Generates clear instructions:

csharp
ClearCommand("A") → "clear-A"

ConstantWaveChunk(int frequency = 100, int intensity = 60) → string

Generates a single Waveform HEX with constant frequency/intensity. Frequency limiting 10-240, intensity limiting 0-100.

TazeUConfig

Configuration model, JSONC serialization.

csharp
public class TazeUConfig

Properties

PropertyTypeDefault ValueDescription
Portint9999WS listen port
BindAddressstring""Custom bind IP (leave blank for auto-detect)
MinStrengthint5Minimum output intensity (0-200)
DamageCapint25Damage mapping cap
Waveformstring"Breath"Waveform preset name
UseChannelAbooltrueEnable Channel A
UseChannelBbooltrueEnable Channel B
ComboEnabledboolfalseCombo Increment toggle
ComboRatefloat0.15Increment ratio per stack
ComboWindowfloat3.0Combo time window (seconds)
ComboMaxStacksint8Maximum stack layers
OnlyOwnOrbsbooltrueOnly own Lightning Orbs trigger
MaxConnectionsint8Maximum concurrent connections
TestDamageint3Test shock damage value

Static Methods

Load() → TazeUConfig

Loads configs from default_config.jsonc. Writes the default config and returns it if the file does not exist. Returns a default instance if a load exception occurs.

Instance Methods

Save()

Serializes and writes the current config to disk. Automatically creates the directory if it doesn't exist.

ModConfigBridge

Connects to ModConfig-STS2 via reflection with zero dependency.

csharp
internal static class ModConfigBridge

Properties

PropertyTypeDescription
IsAvailableboolWhether ModConfig is available (detected upon first access)
ShowQRKeylongShow QR hotkey (Godot Key code)
TestShockKeylongTest shock hotkey
DisconnectKeylongDisconnect connection hotkey

Methods

Register(TazeUConfig config, DGLabServer server)

Registers all configs items to ModConfig menu.