using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalNetworkAPI.Networking;
using Microsoft.CodeAnalysis;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("LethalNetworkAPI")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Easily create networked mods.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+5b36f9c8315587346ca4cc9e30021fe8b986714a")]
[assembly: AssemblyProduct("LethalNetworkAPI")]
[assembly: AssemblyTitle("LethalNetworkAPI")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
internal class <Module>
{
static <Module>()
{
}
}
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace LethalNetworkAPI
{
public class LethalNetworkEvent
{
private readonly string _eventIdentifier;
public event Action? OnServerReceived;
public event Action<ulong>? OnServerReceivedFrom;
public event Action? OnClientReceived;
public LethalNetworkEvent(string identifier)
{
_eventIdentifier = Assembly.GetCallingAssembly().GetName().Name + ".evt." + identifier;
NetworkHandler.OnServerEvent += ReceiveServerEvent;
NetworkHandler.OnClientEvent += ReceiveClientEvent;
NetworkHandler.OnSyncedServerEvent += ReceiveSyncedServerEvent;
NetworkHandler.OnSyncedClientEvent += ReceiveSyncedClientEvent;
}
public void InvokeServer()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)NetworkHandler.Instance != (Object)null)
{
NetworkHandler.Instance.EventServerRpc(_eventIdentifier);
}
}
public void InvokeClient(ulong clientId)
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
if ((NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) && !((Object)(object)NetworkHandler.Instance == (Object)null) && NetworkManager.Singleton.ConnectedClientsIds.Contains(clientId))
{
NetworkHandler.Instance.EventClientRpc(_eventIdentifier, new ClientRpcParams
{
Send = new ClientRpcSendParams
{
TargetClientIdsNativeArray = new NativeArray<ulong>(new ulong[1] { clientId }, (Allocator)4)
}
});
}
}
public void InvokeClients(IEnumerable<ulong> clientIds)
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
if ((NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) && !((Object)(object)NetworkHandler.Instance == (Object)null))
{
NativeArray<ulong> val = default(NativeArray<ulong>);
val..ctor(clientIds.Where((ulong i) => NetworkManager.Singleton.ConnectedClientsIds.Contains(i)).ToArray(), (Allocator)4);
if (((IEnumerable<ulong>)(object)val).Any())
{
NetworkHandler.Instance.EventClientRpc(_eventIdentifier, new ClientRpcParams
{
Send = new ClientRpcSendParams
{
TargetClientIdsNativeArray = val
}
});
}
}
}
public void InvokeAllClients(bool receiveOnHost = true)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
if ((!NetworkManager.Singleton.IsHost && !NetworkManager.Singleton.IsServer) || (Object)(object)NetworkHandler.Instance == (Object)null)
{
return;
}
if (receiveOnHost)
{
NetworkHandler.Instance.EventClientRpc(_eventIdentifier);
return;
}
NativeArray<ulong> val = default(NativeArray<ulong>);
val..ctor(NetworkManager.Singleton.ConnectedClientsIds.Where((ulong i) => i != 0).ToArray(), (Allocator)4);
if (((IEnumerable<ulong>)(object)val).Any())
{
NetworkHandler.Instance.EventClientRpc(_eventIdentifier, new ClientRpcParams
{
Send = new ClientRpcSendParams
{
TargetClientIdsNativeArray = val
}
});
}
}
public void InvokeOtherClientsSynced()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
NetworkTime localTime = NetworkManager.Singleton.LocalTime;
double time = ((NetworkTime)(ref localTime)).Time;
if (!((Object)(object)NetworkHandler.Instance == (Object)null))
{
NetworkHandler.Instance.SyncedEventServerRpc(_eventIdentifier, time);
((MonoBehaviour)NetworkHandler.Instance).StartCoroutine(WaitAndInvokeEvent(0f, 99999uL));
}
}
public void InvokeAllClientsSynced(bool receiveOnHost = true)
{
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
if ((!NetworkManager.Singleton.IsHost && !NetworkManager.Singleton.IsServer) || (Object)(object)NetworkHandler.Instance == (Object)null)
{
return;
}
NetworkTime serverTime;
if (receiveOnHost)
{
NetworkHandler? instance = NetworkHandler.Instance;
string eventIdentifier = _eventIdentifier;
serverTime = NetworkManager.Singleton.ServerTime;
instance.SyncedEventClientRpc(eventIdentifier, ((NetworkTime)(ref serverTime)).Time);
return;
}
NativeArray<ulong> val = default(NativeArray<ulong>);
val..ctor(NetworkManager.Singleton.ConnectedClientsIds.Where((ulong i) => i != 0).ToArray(), (Allocator)4);
if (((IEnumerable<ulong>)(object)val).Any())
{
NetworkHandler? instance2 = NetworkHandler.Instance;
string eventIdentifier2 = _eventIdentifier;
serverTime = NetworkManager.Singleton.ServerTime;
instance2.SyncedEventClientRpc(eventIdentifier2, ((NetworkTime)(ref serverTime)).Time, new ClientRpcParams
{
Send = new ClientRpcSendParams
{
TargetClientIdsNativeArray = val
}
});
}
}
private void ReceiveServerEvent(string identifier, ulong originClientId)
{
if (!(identifier != _eventIdentifier))
{
this.OnServerReceived?.Invoke();
this.OnServerReceivedFrom?.Invoke(originClientId);
}
}
private void ReceiveClientEvent(string identifier)
{
if (!(identifier != _eventIdentifier))
{
this.OnClientReceived?.Invoke();
}
}
private void ReceiveSyncedServerEvent(string identifier, double time, ulong originatorClientId)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
if (!(identifier != _eventIdentifier) && !((Object)(object)NetworkHandler.Instance == (Object)null))
{
NetworkTime serverTime = NetworkManager.Singleton.ServerTime;
double num = time - ((NetworkTime)(ref serverTime)).Time;
NativeArray<ulong> val = default(NativeArray<ulong>);
val..ctor(NetworkManager.Singleton.ConnectedClientsIds.Where((ulong i) => i != originatorClientId).ToArray(), (Allocator)4);
if (((IEnumerable<ulong>)(object)val).Any())
{
NetworkHandler.Instance.SyncedEventClientRpc(identifier, time, new ClientRpcParams
{
Send = new ClientRpcSendParams
{
TargetClientIdsNativeArray = val
}
});
((MonoBehaviour)NetworkHandler.Instance).StartCoroutine(WaitAndInvokeEvent((float)num, originatorClientId));
}
}
}
private void ReceiveSyncedClientEvent(string identifier, double time)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
if (!(identifier != _eventIdentifier) && !((Object)(object)NetworkHandler.Instance == (Object)null))
{
NetworkTime serverTime = NetworkManager.Singleton.ServerTime;
double num = time - ((NetworkTime)(ref serverTime)).Time;
((MonoBehaviour)NetworkHandler.Instance).StartCoroutine(WaitAndInvokeEvent((float)num, 99999uL));
}
}
private IEnumerator WaitAndInvokeEvent(float timeToWait, ulong clientId = 99999uL)
{
if (timeToWait > 0f)
{
yield return (object)new WaitForSeconds(timeToWait);
}
if (clientId != 99999)
{
this.OnServerReceived?.Invoke();
this.OnServerReceivedFrom?.Invoke(clientId);
}
else
{
this.OnClientReceived?.Invoke();
}
}
}
public static class LethalNetworkExtensions
{
public static PlayerControllerB? GetPlayerFromId(ulong clientId)
{
return StartOfRound.Instance.allPlayerScripts[StartOfRound.Instance.ClientPlayerList[clientId]] ?? null;
}
}
public class LethalNetworkMessage<T>
{
private readonly string _messageIdentifier;
public event Action<T>? OnServerReceived;
public event Action<T, ulong>? OnServerReceivedFrom;
public event Action<T>? OnClientReceived;
public LethalNetworkMessage(string identifier)
{
_messageIdentifier = Assembly.GetCallingAssembly().GetName().Name + ".msg." + identifier;
NetworkHandler.OnServerMessage += ReceiveServerMessage;
NetworkHandler.OnClientMessage += ReceiveClientMessage;
}
public void SendServer(T data)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)NetworkHandler.Instance != (Object)null)
{
NetworkHandler.Instance.MessageServerRpc(_messageIdentifier, JsonUtility.ToJson((object)new ValueWrapper<T>(data)));
}
}
public void SendClient(T data, ulong clientId)
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
if ((NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) && !((Object)(object)NetworkHandler.Instance == (Object)null) && NetworkManager.Singleton.ConnectedClientsIds.Contains(clientId))
{
NetworkHandler.Instance.MessageClientRpc(_messageIdentifier, JsonUtility.ToJson((object)new ValueWrapper<T>(data)), new ClientRpcParams
{
Send = new ClientRpcSendParams
{
TargetClientIdsNativeArray = new NativeArray<ulong>(new ulong[1] { clientId }, (Allocator)4)
}
});
}
}
public void SendClients(T data, IEnumerable<ulong> clientIds)
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
if ((NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) && !((Object)(object)NetworkHandler.Instance == (Object)null))
{
NativeArray<ulong> val = default(NativeArray<ulong>);
val..ctor(clientIds.Where((ulong i) => NetworkManager.Singleton.ConnectedClientsIds.Contains(i)).ToArray(), (Allocator)4);
if (((IEnumerable<ulong>)(object)val).Any())
{
NetworkHandler.Instance.MessageClientRpc(_messageIdentifier, JsonUtility.ToJson((object)new ValueWrapper<T>(data)), new ClientRpcParams
{
Send = new ClientRpcSendParams
{
TargetClientIdsNativeArray = val
}
});
}
}
}
public void SendAllClients(T data, bool receiveOnHost = true)
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
if ((!NetworkManager.Singleton.IsHost && !NetworkManager.Singleton.IsServer) || (Object)(object)NetworkHandler.Instance == (Object)null)
{
return;
}
if (receiveOnHost)
{
NetworkHandler.Instance.MessageClientRpc(_messageIdentifier, JsonUtility.ToJson((object)new ValueWrapper<T>(data)));
return;
}
NativeArray<ulong> val = default(NativeArray<ulong>);
val..ctor(NetworkManager.Singleton.ConnectedClientsIds.Where((ulong i) => i != 0).ToArray(), (Allocator)4);
if (((IEnumerable<ulong>)(object)val).Any())
{
NetworkHandler.Instance.MessageClientRpc(_messageIdentifier, JsonUtility.ToJson((object)new ValueWrapper<T>(data)), new ClientRpcParams
{
Send = new ClientRpcSendParams
{
TargetClientIdsNativeArray = val
}
});
}
}
private void ReceiveServerMessage(string identifier, string data, ulong originClientId)
{
if (!(identifier != _messageIdentifier))
{
this.OnServerReceived?.Invoke(JsonUtility.FromJson<ValueWrapper<T>>(data).var);
this.OnServerReceivedFrom?.Invoke(JsonUtility.FromJson<ValueWrapper<T>>(data).var, originClientId);
}
}
private void ReceiveClientMessage(string identifier, string data)
{
if (!(identifier != _messageIdentifier))
{
this.OnClientReceived?.Invoke(JsonUtility.FromJson<ValueWrapper<T>>(data).var);
}
}
}
public class LethalNetworkVariable<T>
{
private readonly string _variableIdentifier;
private readonly bool _protect;
private T? _previousValue;
private T? _value;
private const ulong DefaultId = 999999uL;
private ulong _ownerClientId = 999999uL;
public T Value
{
get
{
return _value;
}
set
{
if ((!_protect || _ownerClientId != 999999) && value != null && !value.Equals(_value))
{
_value = value;
this.OnValueChanged?.Invoke(_value);
}
}
}
public event Action<T>? OnValueChanged;
public LethalNetworkVariable(string identifier)
{
_variableIdentifier = Assembly.GetCallingAssembly().GetName().Name + ".var." + identifier;
NetworkHandler.OnVariableUpdate += ReceiveUpdate;
NetworkHandler.OnOwnershipChange += OwnershipChange;
NetworkHandler.NetworkTick += OnNetworkTick;
if (typeof(LethalNetworkVariable<T>).GetCustomAttributes(typeof(LethalNetworkProtectedAttribute), inherit: true).Any())
{
_protect = true;
}
}
public bool SetOwnership(ulong clientId)
{
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
if (!_protect || (Object)(object)NetworkHandler.Instance == (Object)null)
{
return false;
}
if (NetworkManager.Singleton.LocalClientId != 0L && NetworkManager.Singleton.LocalClientId != _ownerClientId && _ownerClientId != 999999)
{
return false;
}
if (!NetworkManager.Singleton.ConnectedClientsIds.Contains(clientId))
{
return false;
}
if (NetworkManager.Singleton.IsServer)
{
NetworkHandler.Instance.UpdateOwnershipClientRpc(_variableIdentifier, new ulong[2] { _ownerClientId, clientId });
}
else
{
NetworkHandler.Instance.UpdateOwnershipServerRpc(_variableIdentifier, clientId);
}
_ownerClientId = clientId;
return true;
}
private void SendUpdate()
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)NetworkHandler.Instance == (Object)null))
{
NetworkHandler.Instance.UpdateVariableServerRpc(_variableIdentifier, JsonUtility.ToJson((object)new ValueWrapper<T>(_value)));
}
}
private void ReceiveUpdate(string identifier, string data)
{
if (!(identifier != _variableIdentifier))
{
T var = JsonUtility.FromJson<ValueWrapper<T>>(data).var;
if (var != null && !var.Equals(_previousValue))
{
_previousValue = var;
Value = var;
this.OnValueChanged?.Invoke(var);
}
}
}
private void OwnershipChange(string identifier, ulong[] clientIds)
{
if (!(identifier != _variableIdentifier) && (_ownerClientId == clientIds[0] || _ownerClientId == 999999))
{
_ownerClientId = clientIds[1];
}
}
private void OnNetworkTick()
{
if (_value != null && !_value.Equals(_previousValue))
{
_previousValue = _value;
SendUpdate();
}
}
}
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
public class LethalNetworkProtectedAttribute : Attribute
{
}
[BepInPlugin("LethalNetworkAPI", "LethalNetworkAPI", "1.0.0")]
internal class Plugin : BaseUnityPlugin
{
internal static Plugin Instance;
private static Harmony _harmony;
internal static ManualLogSource Logger { get; private set; }
private void Awake()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Expected O, but got Unknown
Instance = this;
_harmony = new Harmony("LethalNetworkAPI");
Logger = ((BaseUnityPlugin)this).Logger;
NetcodePatcher();
_harmony.PatchAll(typeof(NetworkObjectManager));
Logger.LogDebug((object)"LethalNetworkAPI Patches Applied");
}
private static void NetcodePatcher()
{
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
for (int i = 0; i < types.Length; i++)
{
MethodInfo[] methods = types[i].GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
foreach (MethodInfo methodInfo in methods)
{
if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
}
}
[Serializable]
internal class ValueWrapper<T>
{
public T? var;
public ValueWrapper(T? value)
{
var = value;
base..ctor();
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "LethalNetworkAPI";
public const string PLUGIN_NAME = "LethalNetworkAPI";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace LethalNetworkAPI.Networking
{
internal class NetworkHandler : NetworkBehaviour
{
internal static NetworkHandler? Instance { get; private set; }
internal static event Action? NetworkSpawn;
internal static event Action? NetworkDespawn;
internal static event Action? NetworkTick;
internal static event Action<string, string, ulong>? OnServerMessage;
internal static event Action<string, string>? OnClientMessage;
internal static event Action<string, string>? OnVariableUpdate;
internal static event Action<string, ulong[]>? OnOwnershipChange;
internal static event Action<string, ulong>? OnServerEvent;
internal static event Action<string>? OnClientEvent;
internal static event Action<string, double, ulong>? OnSyncedServerEvent;
internal static event Action<string, double>? OnSyncedClientEvent;
public override void OnNetworkSpawn()
{
((NetworkBehaviour)this).OnNetworkSpawn();
if ((NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) && (Object)(object)Instance != (Object)null)
{
((Component)Instance).gameObject.GetComponent<NetworkObject>().Despawn(true);
}
Instance = this;
NetworkHandler.NetworkSpawn?.Invoke();
((NetworkBehaviour)this).NetworkManager.NetworkTickSystem.Tick += NetworkHandler.NetworkTick;
}
public override void OnNetworkDespawn()
{
NetworkHandler.NetworkDespawn?.Invoke();
}
[ServerRpc(RequireOwnership = false)]
internal void MessageServerRpc(string identifier, string data, ServerRpcParams serverRpcParams = default(ServerRpcParams))
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3849563577u, serverRpcParams, (RpcDelivery)0);
bool flag = identifier != null;
((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val)).WriteValueSafe(identifier, false);
}
bool flag2 = data != null;
((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
if (flag2)
{
((FastBufferWriter)(ref val)).WriteValueSafe(data, false);
}
((NetworkBehaviour)this).__endSendServerRpc(ref val, 3849563577u, serverRpcParams, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
NetworkHandler.OnServerMessage?.Invoke(identifier, data, serverRpcParams.Receive.SenderClientId);
}
}
[ClientRpc]
internal void MessageClientRpc(string identifier, string data, ClientRpcParams clientRpcParams = default(ClientRpcParams))
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2812080063u, clientRpcParams, (RpcDelivery)0);
bool flag = identifier != null;
((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val)).WriteValueSafe(identifier, false);
}
bool flag2 = data != null;
((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
if (flag2)
{
((FastBufferWriter)(ref val)).WriteValueSafe(data, false);
}
((NetworkBehaviour)this).__endSendClientRpc(ref val, 2812080063u, clientRpcParams, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
NetworkHandler.OnClientMessage?.Invoke(identifier, data);
clientRpcParams.Send.TargetClientIdsNativeArray?.Dispose();
}
}
[ServerRpc(RequireOwnership = false)]
internal void EventServerRpc(string identifier, ServerRpcParams serverRpcParams = default(ServerRpcParams))
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1745323110u, serverRpcParams, (RpcDelivery)0);
bool flag = identifier != null;
((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val)).WriteValueSafe(identifier, false);
}
((NetworkBehaviour)this).__endSendServerRpc(ref val, 1745323110u, serverRpcParams, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
NetworkHandler.OnServerEvent?.Invoke(identifier, serverRpcParams.Receive.SenderClientId);
}
}
[ClientRpc]
internal void EventClientRpc(string identifier, ClientRpcParams clientRpcParams = default(ClientRpcParams))
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3944339578u, clientRpcParams, (RpcDelivery)0);
bool flag = identifier != null;
((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val)).WriteValueSafe(identifier, false);
}
((NetworkBehaviour)this).__endSendClientRpc(ref val, 3944339578u, clientRpcParams, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
NetworkHandler.OnClientEvent?.Invoke(identifier);
clientRpcParams.Send.TargetClientIdsNativeArray?.Dispose();
}
}
[ServerRpc(RequireOwnership = false)]
internal void SyncedEventServerRpc(string identifier, double time, ServerRpcParams serverRpcParams = default(ServerRpcParams))
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2669215490u, serverRpcParams, (RpcDelivery)0);
bool flag = identifier != null;
((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val)).WriteValueSafe(identifier, false);
}
((FastBufferWriter)(ref val)).WriteValueSafe<double>(ref time, default(ForPrimitives));
((NetworkBehaviour)this).__endSendServerRpc(ref val, 2669215490u, serverRpcParams, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
NetworkHandler.OnSyncedServerEvent?.Invoke(identifier, time, serverRpcParams.Receive.SenderClientId);
}
}
[ClientRpc]
internal void SyncedEventClientRpc(string identifier, double time, ClientRpcParams clientRpcParams = default(ClientRpcParams))
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2713544725u, clientRpcParams, (RpcDelivery)0);
bool flag = identifier != null;
((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val)).WriteValueSafe(identifier, false);
}
((FastBufferWriter)(ref val)).WriteValueSafe<double>(ref time, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val, 2713544725u, clientRpcParams, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
NetworkHandler.OnSyncedClientEvent?.Invoke(identifier, time);
clientRpcParams.Send.TargetClientIdsNativeArray?.Dispose();
}
}
[ServerRpc(RequireOwnership = false)]
internal void UpdateVariableServerRpc(string identifier, string data, ServerRpcParams serverRpcParams = default(ServerRpcParams))
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1664657928u, serverRpcParams, (RpcDelivery)0);
bool flag = identifier != null;
((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val)).WriteValueSafe(identifier, false);
}
bool flag2 = data != null;
((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
if (flag2)
{
((FastBufferWriter)(ref val)).WriteValueSafe(data, false);
}
((NetworkBehaviour)this).__endSendServerRpc(ref val, 1664657928u, serverRpcParams, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
ServerRpcParams serverRpcParams2 = serverRpcParams;
if (serverRpcParams2.Receive.SenderClientId != 0L)
{
NetworkHandler.OnVariableUpdate?.Invoke(identifier, data);
}
NativeArray<ulong> val2 = default(NativeArray<ulong>);
val2..ctor(NetworkManager.Singleton.ConnectedClientsIds.Where((ulong i) => i != serverRpcParams2.Receive.SenderClientId).ToArray(), (Allocator)4);
if (((IEnumerable<ulong>)(object)val2).Any())
{
UpdateVariableClientRpc(identifier, data, new ClientRpcParams
{
Send = new ClientRpcSendParams
{
TargetClientIdsNativeArray = val2
}
});
}
}
}
[ClientRpc]
private void UpdateVariableClientRpc(string identifier, string data, ClientRpcParams clientRpcParams = default(ClientRpcParams))
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1655085920u, clientRpcParams, (RpcDelivery)0);
bool flag = identifier != null;
((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val)).WriteValueSafe(identifier, false);
}
bool flag2 = data != null;
((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
if (flag2)
{
((FastBufferWriter)(ref val)).WriteValueSafe(data, false);
}
((NetworkBehaviour)this).__endSendClientRpc(ref val, 1655085920u, clientRpcParams, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
NetworkHandler.OnVariableUpdate?.Invoke(identifier, data);
clientRpcParams.Send.TargetClientIdsNativeArray?.Dispose();
}
}
[ServerRpc(RequireOwnership = false)]
internal void UpdateOwnershipServerRpc(string identifier, ulong newClientId, ServerRpcParams serverRpcParams = default(ServerRpcParams))
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2002843453u, serverRpcParams, (RpcDelivery)0);
bool flag = identifier != null;
((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val)).WriteValueSafe(identifier, false);
}
BytePacker.WriteValueBitPacked(val, newClientId);
((NetworkBehaviour)this).__endSendServerRpc(ref val, 2002843453u, serverRpcParams, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
UpdateOwnershipClientRpc(identifier, new ulong[2]
{
serverRpcParams.Receive.SenderClientId,
newClientId
});
}
}
[ClientRpc]
internal void UpdateOwnershipClientRpc(string identifier, ulong[] clientIds)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1291417565u, val, (RpcDelivery)0);
bool flag = identifier != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(identifier, false);
}
bool flag2 = clientIds != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
if (flag2)
{
((FastBufferWriter)(ref val2)).WriteValueSafe<ulong>(clientIds, default(ForPrimitives));
}
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1291417565u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
NetworkHandler.OnOwnershipChange?.Invoke(identifier, clientIds);
}
}
protected override void __initializeVariables()
{
((NetworkBehaviour)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_NetworkHandler()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected O, but got Unknown
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Expected O, but got Unknown
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Expected O, but got Unknown
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Expected O, but got Unknown
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Expected O, but got Unknown
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Expected O, but got Unknown
NetworkManager.__rpc_func_table.Add(3849563577u, new RpcReceiveHandler(__rpc_handler_3849563577));
NetworkManager.__rpc_func_table.Add(2812080063u, new RpcReceiveHandler(__rpc_handler_2812080063));
NetworkManager.__rpc_func_table.Add(1745323110u, new RpcReceiveHandler(__rpc_handler_1745323110));
NetworkManager.__rpc_func_table.Add(3944339578u, new RpcReceiveHandler(__rpc_handler_3944339578));
NetworkManager.__rpc_func_table.Add(2669215490u, new RpcReceiveHandler(__rpc_handler_2669215490));
NetworkManager.__rpc_func_table.Add(2713544725u, new RpcReceiveHandler(__rpc_handler_2713544725));
NetworkManager.__rpc_func_table.Add(1664657928u, new RpcReceiveHandler(__rpc_handler_1664657928));
NetworkManager.__rpc_func_table.Add(1655085920u, new RpcReceiveHandler(__rpc_handler_1655085920));
NetworkManager.__rpc_func_table.Add(2002843453u, new RpcReceiveHandler(__rpc_handler_2002843453));
NetworkManager.__rpc_func_table.Add(1291417565u, new RpcReceiveHandler(__rpc_handler_1291417565));
}
private static void __rpc_handler_3849563577(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string identifier = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref identifier, false);
}
bool flag2 = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives));
string data = null;
if (flag2)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref data, false);
}
ServerRpcParams server = rpcParams.Server;
target.__rpc_exec_stage = (__RpcExecStage)1;
((NetworkHandler)(object)target).MessageServerRpc(identifier, data, server);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2812080063(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string identifier = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref identifier, false);
}
bool flag2 = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives));
string data = null;
if (flag2)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref data, false);
}
ClientRpcParams client = rpcParams.Client;
target.__rpc_exec_stage = (__RpcExecStage)2;
((NetworkHandler)(object)target).MessageClientRpc(identifier, data, client);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1745323110(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string identifier = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref identifier, false);
}
ServerRpcParams server = rpcParams.Server;
target.__rpc_exec_stage = (__RpcExecStage)1;
((NetworkHandler)(object)target).EventServerRpc(identifier, server);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3944339578(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string identifier = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref identifier, false);
}
ClientRpcParams client = rpcParams.Client;
target.__rpc_exec_stage = (__RpcExecStage)2;
((NetworkHandler)(object)target).EventClientRpc(identifier, client);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2669215490(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string identifier = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref identifier, false);
}
double time = default(double);
((FastBufferReader)(ref reader)).ReadValueSafe<double>(ref time, default(ForPrimitives));
ServerRpcParams server = rpcParams.Server;
target.__rpc_exec_stage = (__RpcExecStage)1;
((NetworkHandler)(object)target).SyncedEventServerRpc(identifier, time, server);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2713544725(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string identifier = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref identifier, false);
}
double time = default(double);
((FastBufferReader)(ref reader)).ReadValueSafe<double>(ref time, default(ForPrimitives));
ClientRpcParams client = rpcParams.Client;
target.__rpc_exec_stage = (__RpcExecStage)2;
((NetworkHandler)(object)target).SyncedEventClientRpc(identifier, time, client);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1664657928(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string identifier = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref identifier, false);
}
bool flag2 = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives));
string data = null;
if (flag2)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref data, false);
}
ServerRpcParams server = rpcParams.Server;
target.__rpc_exec_stage = (__RpcExecStage)1;
((NetworkHandler)(object)target).UpdateVariableServerRpc(identifier, data, server);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1655085920(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string identifier = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref identifier, false);
}
bool flag2 = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives));
string data = null;
if (flag2)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref data, false);
}
ClientRpcParams client = rpcParams.Client;
target.__rpc_exec_stage = (__RpcExecStage)2;
((NetworkHandler)(object)target).UpdateVariableClientRpc(identifier, data, client);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2002843453(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string identifier = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref identifier, false);
}
ulong newClientId = default(ulong);
ByteUnpacker.ReadValueBitPacked(reader, ref newClientId);
ServerRpcParams server = rpcParams.Server;
target.__rpc_exec_stage = (__RpcExecStage)1;
((NetworkHandler)(object)target).UpdateOwnershipServerRpc(identifier, newClientId, server);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1291417565(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string identifier = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref identifier, false);
}
bool flag2 = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives));
ulong[] clientIds = null;
if (flag2)
{
((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref clientIds, default(ForPrimitives));
}
target.__rpc_exec_stage = (__RpcExecStage)2;
((NetworkHandler)(object)target).UpdateOwnershipClientRpc(identifier, clientIds);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string? __getTypeName()
{
return "NetworkHandler";
}
}
[HarmonyPatch]
internal class NetworkObjectManager
{
private static GameObject _networkPrefab;
[HarmonyPostfix]
[HarmonyPatch(typeof(GameNetworkManager), "Start")]
public static void Init()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
if (!((Object)(object)_networkPrefab != (Object)null))
{
_networkPrefab = (GameObject)AssetBundle.LoadFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("LethalNetworkAPI.asset")).LoadAsset("Assets/LethalNetworkAPI.Handler.prefab");
NetworkManager.Singleton.AddNetworkPrefab(_networkPrefab);
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(StartOfRound), "Awake")]
private static void SpawnNetworkHandler()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
{
Object.Instantiate<GameObject>(_networkPrefab, Vector3.zero, Quaternion.identity, ((Component)StartOfRound.Instance).transform).GetComponent<NetworkObject>().Spawn(false);
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}