Skip to content

Analyzing Outgoing Data

FCheat edited this page Jun 28, 2018 · 1 revision

Analyzing outgoing data going to clients

This page acts as a general idea holder for handling outgoing data that the server is sending to clients.

Using the data here, you can interpret, manipulate, and mimic outgoing (and possibly incoming) data with the right mindset.

The class that's mainly used for data is SDG.Unturned.SteamChannel (You can view this in your Object Browser) ObjBrowser

The easy way to analyze outgoing data (if you look around) would be the large amount of sends here, but in reality they all boil down to one that calls an event "onTriggerSend" (Similar to the chat)

I'm gonna make this easier for you to play around with since the other wiki tutorial shows you how to find these for yourself.

TriggerSend is going to need: SDG.Unturned.SteamPlayer player, string name, SDG.Unturned.ESteamCall mode, SDG.Unturned.ESteamPacket type, params object[] arguments - One thing if you've messed about through C# is you'll notice our typical delegate defines aren't going to work here, and for one specific reason. This is because params won't be valid in delegate due to (what I think) was when it swapped from an array of System.Object[] , But what we do know is it doesn't work.

The way we'll have to do this is by making an actual void and adding it to the field. Setup like so;

void HandleTriggerSend(SDG.Unturned.SteamPlayer player,
                       string name,
                       SDG.Unturned.ESteamCall mode,
                       SDG.Unturned.ESteamPacket type,
                       params object[] arguments)
{
}

Next, in the same area where we've added to the chat previously, add the function to the type.

SDG.Unturned.SteamChannel.onTriggerSend += HandleTriggerSend;

From here, you can (inside the function) find out any data going through and print it out.

Here's some interesting things I've found so far that you can handle:

Upon Joining:
	========================
	@Player
	:"askLife"
	:SERVER
	:UPDATE_RELIABLE_BUFFER
	:-
	========================
	@Player
	:"askSkills"
	:SERVER
	:UPDATE_RELIABLE_BUFFER
	:-
	========================
	@Player
	:"askEmote"
	:SERVER
	:UPDATE_RELIABLE_BUFFER
	:-
	========================
	@Player
	:"askEquipment"
	:SERVER
	:UPDATE_RELIABLE_BUFFER
	:-
	========================

Action Types:
	Left Click-
		@Player
		:"tellGesture"
		:NOT_OWNER
		:UPDATE_RELIABLE_BUFFER
		:4
	Right Click-
		@Player
		:"tellGesture"
		:NOT_OWNER
		:UPDATE_RELIABLE_BUFFER
		:5
	Prone-
		@Player
		:"tellStance"
		:NOT_OWNER
		:UPDATE_UNRELIABLE_BUFFER
		:5
	Lean (Left?)-
		@Player
		:"tellLean"
		:NOT_OWNER
		:UPDATE_UNRELIABLE_BUFFER
		:1

Per Tick/Updates:
	Update Water / Food
		@Player
		:"tellFood" / "tellWater"
		:OWNER
		:UPDATE_RELIABLE_BUFFER
		:*amount*

Be aware that NOT ALL CALLS will have a specific player, a check for this has been added in the actual project.

If a player doesn't exist, you can get common weather sets:

tellLightingWind
tellLightingRain