Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of IdentificateIdentificate v1.0.1
Identificate.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Identificate; using Identificate.NetcodePatcher; using IdentificateIdentificate.Managers; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Identificate")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Identificate")] [assembly: AssemblyTitle("Identificate")] [assembly: AssemblyVersion("1.0.0.0")] [module: NetcodePatchedAssembly] 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; } } } namespace Identificate { [BepInPlugin("CabyDJ.IdentificateIdentificate", "Identificate Identificate", "1.0.0.0")] public class Plugin : BaseUnityPlugin { private const string modGUID = "CabyDJ.IdentificateIdentificate"; private const string modName = "Identificate Identificate"; private const string modVersion = "1.0.0.0"; private readonly Harmony harmony = new Harmony("CabyDJ.IdentificateIdentificate"); public static Plugin instance; internal static ManualLogSource mls; public GameObject netManagerPrefab; internal static AudioClip[] SoundFX; internal static AssetBundle Bundle; private void Awake() { instance = this; mls = Logger.CreateLogSource("CabyDJ.IdentificateIdentificate"); mls.LogInfo((object)"(º)< Waking up identificate mod"); Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "netcodemod"); AssetBundle val = AssetBundle.LoadFromFile(text); if ((Object)(object)val != (Object)null) { netManagerPrefab = val.LoadAsset<GameObject>("Assets/Netcode/NetworkManagerIdentificate.prefab"); netManagerPrefab.AddComponent<NetworkManagerIdentificate>(); mls.LogInfo((object)"(º)< Network bundle loaded"); } else { mls.LogInfo((object)"(º`)< Error loading NetworkBundle"); } SoundFX = (AudioClip[])(object)new AudioClip[1]; string location = ((BaseUnityPlugin)instance).Info.Location; location = location.TrimEnd("IdentificateIdentificateBase.dll".ToCharArray()); Bundle = AssetBundle.LoadFromFile(location + "identificate"); if ((Object)(object)Bundle != (Object)null) { SoundFX = Bundle.LoadAllAssets<AudioClip>(); mls.LogInfo((object)"(º)< Sound asset bundle loaded"); } else { mls.LogInfo((object)"(º`)< Error loading Sound asset bundle"); } harmony.PatchAll(); mls.LogInfo((object)"(º)< Patched Identificate network"); } } } namespace Identificate.Patches { [HarmonyPatch(typeof(GameNetworkManager))] internal class GameNetworkManagerPatcher { [HarmonyPostfix] [HarmonyPatch("Start")] private static void AddToPrefabs(GameNetworkManager __instance) { ((Component)__instance).GetComponent<NetworkManager>().AddNetworkPrefab(Plugin.instance.netManagerPrefab); } } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatcher { [HarmonyPostfix] [HarmonyPatch("Emote2_performed")] private static void Emote2_performed_Patch(PlayerControllerB __instance) { if (!((NetworkBehaviour)__instance).IsOwner || __instance.isPlayerDead || __instance.isTypingChat || __instance.isClimbingLadder || __instance.inTerminalMenu) { return; } if (((NetworkBehaviour)__instance).IsHost || ((NetworkBehaviour)__instance).IsServer) { if (IsPlayingAudio(__instance)) { NetworkManagerIdentificate.instance.StopSoundIdentificateClientRpc(__instance.playerClientId); } else { NetworkManagerIdentificate.instance.PlaySoundIdentificateClientRpc(__instance.playerClientId); } } else if (IsPlayingAudio(__instance)) { NetworkManagerIdentificate.instance.StopSoundIdentificateServerRpc(__instance.playerClientId); } else { NetworkManagerIdentificate.instance.PlaySoundIdentificateServerRpc(__instance.playerClientId); } } private static bool IsPlayingAudio(PlayerControllerB __instance) { if ((Object)(object)__instance.movementAudio.clip != (Object)null && (Object)(object)__instance.movementAudio.clip == (Object)(object)Plugin.SoundFX[0] && __instance.movementAudio.isPlaying) { return true; } return false; } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatcher { [HarmonyPostfix] [HarmonyPatch("Start")] private static void spawnNetManager(StartOfRound __instance) { if (((NetworkBehaviour)__instance).IsHost) { GameObject val = Object.Instantiate<GameObject>(Plugin.instance.netManagerPrefab); val.GetComponent<NetworkObject>().Spawn(false); } } } } namespace IdentificateIdentificate.Managers { internal class NetworkManagerIdentificate : NetworkBehaviour { public static NetworkManagerIdentificate instance; private void Awake() { instance = this; } [ServerRpc(RequireOwnership = false)] public void PlaySoundIdentificateServerRpc(ulong id) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_0071: 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 = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1205477675u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, id); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1205477675u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { PlaySoundIdentificateClientRpc(id); } } } [ClientRpc] public void PlaySoundIdentificateClientRpc(ulong id) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_0071: 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 = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4173967982u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, id); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4173967982u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[(uint)id].GetComponent<PlayerControllerB>(); component.movementAudio.clip = Plugin.SoundFX[0]; component.movementAudio.Play(); } } } [ServerRpc(RequireOwnership = false)] public void StopSoundIdentificateServerRpc(ulong id) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_0071: 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 = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2523899711u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, id); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2523899711u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { StopSoundIdentificateClientRpc(id); } } } [ClientRpc] public void StopSoundIdentificateClientRpc(ulong id) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_0071: 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 = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1833903728u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, id); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1833903728u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[(uint)id].GetComponent<PlayerControllerB>(); component.movementAudio.Stop(); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_NetworkManagerIdentificate() { //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 NetworkManager.__rpc_func_table.Add(1205477675u, new RpcReceiveHandler(__rpc_handler_1205477675)); NetworkManager.__rpc_func_table.Add(4173967982u, new RpcReceiveHandler(__rpc_handler_4173967982)); NetworkManager.__rpc_func_table.Add(2523899711u, new RpcReceiveHandler(__rpc_handler_2523899711)); NetworkManager.__rpc_func_table.Add(1833903728u, new RpcReceiveHandler(__rpc_handler_1833903728)); } private static void __rpc_handler_1205477675(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong id = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref id); target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkManagerIdentificate)(object)target).PlaySoundIdentificateServerRpc(id); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4173967982(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong id = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref id); target.__rpc_exec_stage = (__RpcExecStage)2; ((NetworkManagerIdentificate)(object)target).PlaySoundIdentificateClientRpc(id); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2523899711(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong id = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref id); target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkManagerIdentificate)(object)target).StopSoundIdentificateServerRpc(id); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1833903728(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong id = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref id); target.__rpc_exec_stage = (__RpcExecStage)2; ((NetworkManagerIdentificate)(object)target).StopSoundIdentificateClientRpc(id); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "NetworkManagerIdentificate"; } } } namespace Identificate.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }