Decompiled source of AdditionalNetworking Experimental v2.2.1
BepInEx/patchers/AdditionalNetworking_Preloader.dll
Decompiled 3 days agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using Mono.Collections.Generic; using MonoMod.Utils; [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: AssemblyCompany("AdditionalNetworking_Preloader")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("2.2.1.0")] [assembly: AssemblyInformationalVersion("2.2.1+b57930675309f0029c8a99c0186db7d282e521ff")] [assembly: AssemblyProduct("Additional Networking")] [assembly: AssemblyTitle("AdditionalNetworking_Preloader")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.2.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [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 AdditionalNetworking_Preloader { internal class AdditionalNetworking { public static class PluginConfig { internal static ConfigEntry<bool> Enabled; internal static ConfigEntry<string> OutputPath; internal static ConfigEntry<string> OutputExtension; public static void Init() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown ConfigFile val = new ConfigFile(Utility.CombinePaths(new string[2] { MainDir, "Development.cfg" }), true); Enabled = val.Bind<bool>("DevelOptions", "Enabled", false, "Enable development dll output"); OutputPath = val.Bind<string>("DevelOptions", "OutputPath", MainDir, "Folder where to write the modified dlls"); OutputExtension = val.Bind<string>("DevelOptions", "OutputExtension", ".pdll", "Extension to use for the modified dlls\n( Do not use .dll if outputting inside the BepInEx folders )"); PropertyInfo property = ((object)val).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic); Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(val, null); dictionary.Clear(); val.Save(); } } private static readonly string MainDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); internal static ManualLogSource Log { get; } = Logger.CreateLogSource("AdditionalNetworking"); public static IEnumerable<string> TargetDLLs { get; } = new string[1] { "Assembly-CSharp.dll" }; public static void Patch(AssemblyDefinition assembly) { //IL_0064: 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) Action<bool, string> logCallback = delegate(bool fail, string message) { if (fail) { Log.LogWarning((object)message); } Log.LogInfo((object)message); }; Log.LogWarning((object)("Patching " + ((AssemblyNameReference)assembly.Name).Name)); if (((AssemblyNameReference)assembly.Name).Name == "Assembly-CSharp") { Enumerator<TypeDefinition> enumerator = assembly.MainModule.Types.GetEnumerator(); try { while (enumerator.MoveNext()) { TypeDefinition current = enumerator.Current; switch (((MemberReference)current).FullName) { case "GrabbableObject": current.AddField((FieldAttributes)1, "AdditionalNetworking_isInitialized", ((MemberReference)current).Module.ImportReference(typeof(bool)), logCallback); current.AddField((FieldAttributes)1, "AdditionalNetworking_hasRequestedSync", ((MemberReference)current).Module.ImportReference(typeof(bool)), logCallback); break; case "GameNetcodeStuff.PlayerControllerB": current.AddField((FieldAttributes)1, "AdditionalNetworking_dirtyInventory", ((MemberReference)current).Module.ImportReference(typeof(bool)), logCallback); current.AddField((FieldAttributes)1, "AdditionalNetworking_dirtySlots", ((MemberReference)current).Module.ImportReference(typeof(bool)), logCallback); current.AddField((FieldAttributes)1, "AdditionalNetworking_lastCrouchState", ((MemberReference)current).Module.ImportReference(typeof(bool)), logCallback); break; case "ShotgunItem": current.AddField((FieldAttributes)1, "AdditionalNetworking_dirtyAmmo", ((MemberReference)current).Module.ImportReference(typeof(bool)), logCallback); current.AddField((FieldAttributes)1, "AdditionalNetworking_dirtySafety", ((MemberReference)current).Module.ImportReference(typeof(bool)), logCallback); break; case "BoomboxItem": current.AddField((FieldAttributes)1, "AdditionalNetworking_dirtyStatus", ((MemberReference)current).Module.ImportReference(typeof(bool)), logCallback); break; case "AnimatedItem": current.AddField((FieldAttributes)1, "AdditionalNetworking_dirtyStatus", ((MemberReference)current).Module.ImportReference(typeof(bool)), logCallback); break; case "StartOfRound": current.AddField((FieldAttributes)1, "AdditionalNetworking_unlockablesSynced", ((MemberReference)current).Module.ImportReference(typeof(bool)), logCallback); break; case "RoundManager": current.AddField((FieldAttributes)1, "AdditionalNetworking_spawnedScrapPendingSync", ((MemberReference)current).Module.ImportReference(typeof(bool)), logCallback); break; } } } finally { ((IDisposable)enumerator).Dispose(); } } if (PluginConfig.Enabled.Value) { string text = PluginConfig.OutputPath.Value + "/" + ((AssemblyNameReference)assembly.Name).Name + PluginConfig.OutputExtension.Value; Log.LogWarning((object)("Saving modified Assembly to " + text)); assembly.Write(text); } } public static void Initialize() { Log.LogInfo((object)"AdditionalNetworking Prepatcher Started"); PluginConfig.Init(); } public static void Finish() { Log.LogInfo((object)"AdditionalNetworking Prepatcher Finished"); } } public static class CecilHelper { public static bool AddField(this TypeDefinition self, FieldAttributes fieldAttributes, string name, TypeReference type, Action<bool, string> logCallback = null) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown logCallback?.Invoke(arg1: false, "Adding field '" + name + "' to " + ((MemberReference)self).FullName); if (Extensions.FindField(self, name) != null) { logCallback?.Invoke(arg1: true, "Field '" + name + "' already exists in " + ((MemberReference)self).FullName); return false; } self.Fields.Add(new FieldDefinition(name, fieldAttributes, type)); return true; } public static bool AddGetter(this TypeDefinition self, string name, Action<bool, string> logCallback = null) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) string text = "Get" + name; logCallback?.Invoke(arg1: false, "Adding getter for field '" + name + "' to " + ((MemberReference)self).FullName); FieldDefinition val = Extensions.FindField(self, name); if (val == null) { logCallback?.Invoke(arg1: true, "Field '" + name + "' does not exists in " + ((MemberReference)self).FullName); return false; } if (Extensions.FindMethod(self, text, true) != null) { logCallback?.Invoke(arg1: true, "Method '" + text + "' already exists in " + ((MemberReference)self).FullName); return false; } bool flag = false; MethodAttributes val2 = (MethodAttributes)0; if ((val.Attributes & 0x10) != 0) { val2 = (MethodAttributes)(val2 | 0x10); flag = true; } if ((val.Attributes & 1) != 0) { val2 = (MethodAttributes)(val2 | 1); } MethodDefinition val3 = new MethodDefinition(text, val2, ((FieldReference)val).FieldType); self.Methods.Add(val3); Extensions.InsertRange<Instruction>(val3.Body.Instructions, 0, (IEnumerable<Instruction>)new <>z__ReadOnlyArray<Instruction>((Instruction[])(object)new Instruction[3] { Instruction.Create(flag ? OpCodes.Nop : OpCodes.Ldarg_0), Instruction.Create(flag ? OpCodes.Ldsfld : OpCodes.Ldfld, (FieldReference)(object)val), Instruction.Create(OpCodes.Ret) })); return true; } public static bool AddRaise(this TypeDefinition self, string eventName, Action<bool, string> logCallback = null) { //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Expected O, but got Unknown //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: 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_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) string text = "Get" + eventName; logCallback?.Invoke(arg1: false, "Adding caller for event '" + eventName + "' to " + ((MemberReference)self).FullName); EventDefinition val = Extensions.FindEvent(self, eventName); if (val == null) { logCallback?.Invoke(arg1: true, "Event '" + eventName + "' does not exists in " + ((MemberReference)self).FullName); return false; } FieldDefinition val2 = Extensions.FindField(self, eventName); if (val2 == null) { logCallback?.Invoke(arg1: true, "Field '" + eventName + "' does not exists in " + ((MemberReference)self).FullName); return false; } if (Extensions.FindMethod(self, text, true) != null) { logCallback?.Invoke(arg1: true, "Method '" + text + "' already exists in " + ((MemberReference)self).FullName); return false; } MethodDefinition val3 = Extensions.FindMethod(((FieldReference)val2).FieldType.Resolve(), "Invoke", true); MethodReference val4 = ((MemberReference)self).Module.ImportReference((MethodReference)(object)val3); bool flag = false; MethodAttributes val5 = (MethodAttributes)0; if ((val2.Attributes & 0x10) != 0) { val5 = (MethodAttributes)(val5 | 0x10); flag = true; } if ((val2.Attributes & 1) != 0) { val5 = (MethodAttributes)(val5 | 1); } MethodDefinition val6 = new MethodDefinition(text, val5, ((FieldReference)val2).FieldType); self.Methods.Add(val6); Extensions.AddRange<ParameterDefinition>(((MethodReference)val6).Parameters, (IEnumerable<ParameterDefinition>)val4.Parameters); Collection<Instruction> instructions = val6.Body.Instructions; Instruction val7 = Instruction.Create(OpCodes.Pop); Instruction val8 = Instruction.Create(OpCodes.Ret); Extensions.AddRange<Instruction>(instructions, (IEnumerable<Instruction>)new <>z__ReadOnlyArray<Instruction>((Instruction[])(object)new Instruction[6] { Instruction.Create(flag ? OpCodes.Nop : OpCodes.Ldarg_0), Instruction.Create(flag ? OpCodes.Ldsfld : OpCodes.Ldfld, (FieldReference)(object)val2), Instruction.Create(OpCodes.Dup), Instruction.Create(OpCodes.Ldnull), Instruction.Create(OpCodes.Cgt_Un), Instruction.Create(OpCodes.Brfalse, val7) })); Enumerator<ParameterDefinition> enumerator = ((MethodReference)val6).Parameters.GetEnumerator(); try { while (enumerator.MoveNext()) { ParameterDefinition current = enumerator.Current; instructions.Add(Instruction.Create(OpCodes.Ldarg, current)); } } finally { ((IDisposable)enumerator).Dispose(); } instructions.Add(Instruction.Create(OpCodes.Callvirt, val4)); instructions.Add(Instruction.Create(OpCodes.Br, val8)); Extensions.AddRange<Instruction>(instructions, (IEnumerable<Instruction>)new <>z__ReadOnlyArray<Instruction>((Instruction[])(object)new Instruction[2] { val7, val8 })); return true; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T> { int ICollection.Count => _items.Length; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection<T>.Count => _items.Length; T IReadOnlyList<T>.this[int index] => _items[index]; int ICollection<T>.Count => _items.Length; bool ICollection<T>.IsReadOnly => true; T IList<T>.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } public <>z__ReadOnlyArray(T[] items) { _items = items; } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.CopyTo(Array array, int index) { ((ICollection)_items).CopyTo(array, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return ((IList)_items).Contains(value); } int IList.IndexOf(object value) { return ((IList)_items).IndexOf(value); } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator<T> IEnumerable<T>.GetEnumerator() { return ((IEnumerable<T>)_items).GetEnumerator(); } void ICollection<T>.Add(T item) { throw new NotSupportedException(); } void ICollection<T>.Clear() { throw new NotSupportedException(); } bool ICollection<T>.Contains(T item) { return ((ICollection<T>)_items).Contains(item); } void ICollection<T>.CopyTo(T[] array, int arrayIndex) { ((ICollection<T>)_items).CopyTo(array, arrayIndex); } bool ICollection<T>.Remove(T item) { throw new NotSupportedException(); } int IList<T>.IndexOf(T item) { return ((IList<T>)_items).IndexOf(item); } void IList<T>.Insert(int index, T item) { throw new NotSupportedException(); } void IList<T>.RemoveAt(int index) { throw new NotSupportedException(); } }
BepInEx/plugins/AdditionalNetworking.dll
Decompiled 3 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using AdditionalNetworking.Dependency; using AdditionalNetworking.Networking; using AdditionalNetworking.Patches; using AdditionalNetworking.Utils; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using JetBrains.Annotations; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using LethalLevelLoader; using LethalLib.Modules; using LobbyCompatibility.Enums; using LobbyCompatibility.Features; using Microsoft.CodeAnalysis; using MonoMod.RuntimeDetour; using TMPro; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.Pool; [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-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: AssemblyCompany("AdditionalNetworking")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("2.2.1.0")] [assembly: AssemblyInformationalVersion("2.2.1+b57930675309f0029c8a99c0186db7d282e521ff")] [assembly: AssemblyProduct("Additional Networking")] [assembly: AssemblyTitle("AdditionalNetworking")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.2.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [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 AdditionalNetworking { [BepInPlugin("mattymatty.AdditionalNetworking", "AdditionalNetworking", "2.2.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] internal class AdditionalNetworking : BaseUnityPlugin { internal static class PluginConfig { internal static class Inventory { internal static ConfigEntry<bool> SlotChange; internal static ConfigEntry<bool> InventoryChange; } internal static class ItemState { internal static ConfigEntry<bool> Shotgun; internal static ConfigEntry<bool> Boombox; internal static ConfigEntry<bool> Animated; } internal static class PlayerState { internal static ConfigEntry<bool> Crouching; } internal static class Value { internal static ConfigEntry<bool> Enabled; internal static ConfigEntry<string> IgnoreScanNodes; internal static HashSet<string> IgnoreScanNodesList = new HashSet<string>(); } internal static class Misc { internal static ConfigEntry<bool> Username; } internal static class Debug { internal static ConfigEntry<LogLevel> Verbose; } internal static void Init(BaseUnityPlugin plugin) { ConfigFile config = plugin.Config; config.SaveOnConfigSet = false; Inventory.SlotChange = config.Bind<bool>("Inventory", "SlotChange", true, "use explicit slot numbers when swapping slots"); Inventory.InventoryChange = config.Bind<bool>("Inventory", "InventoryChange", true, "broadcast the exact inventory order"); PlayerState.Crouching = config.Bind<bool>("Player state", "Crouching", true, "sync isCrouching state to allow Host AIs to correctly use the variable"); ItemState.Shotgun = config.Bind<bool>("Item state", "Shotgun", true, "use explicit values for ammo/safety instead of toggle states"); ItemState.Boombox = config.Bind<bool>("Item state", "Boombox", true, "sync state and track id"); ItemState.Animated = config.Bind<bool>("Item state", "Animated Item", true, "sync noise for ToyRobot/Dentures ecc.."); Value.Enabled = config.Bind<bool>("Item Values", "Enabled", true, "sync value of scrap if missing"); Value.IgnoreScanNodes = config.Bind<string>("Item Values", "Ignored Scan Nodes", "Vanilla/Apparatus,", "list of items that have custom scan node texts\nListSeparator=,"); ParseScanNodeList(); Value.IgnoreScanNodes.SettingChanged += delegate { ParseScanNodeList(); }; Misc.Username = config.Bind<bool>("Misc", "Username", true, "broadcast the local username once it is assigned to the player object"); Debug.Verbose = config.Bind<LogLevel>("Debug", "Verbose", (LogLevel)0, "additional log lines"); config.SaveOnConfigSet = true; PropertyInfo property = ((object)config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic); Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(config, null); dictionary.Clear(); config.Save(); if (LethalConfigProxy.Enabled) { LethalConfigProxy.AddConfig(Inventory.InventoryChange); LethalConfigProxy.AddConfig(Inventory.SlotChange); LethalConfigProxy.AddConfig(ItemState.Animated); LethalConfigProxy.AddConfig(ItemState.Boombox); LethalConfigProxy.AddConfig(ItemState.Shotgun); LethalConfigProxy.AddConfig(Value.Enabled); LethalConfigProxy.AddConfig(Value.IgnoreScanNodes); LethalConfigProxy.AddConfig(ItemState.Shotgun); LethalConfigProxy.AddConfig(Misc.Username); LethalConfigProxy.AddConfig<LogLevel>(Debug.Verbose, requiresRestart: false); } static void ParseScanNodeList() { string[] source = Value.IgnoreScanNodes.Value.Split(","); Value.IgnoreScanNodesList = (from s in source select s.Trim() into s where !Utility.IsNullOrWhiteSpace(s) select s).ToHashSet(); } } } public const string GUID = "mattymatty.AdditionalNetworking"; public const string NAME = "AdditionalNetworking"; public const string VERSION = "2.2.1"; internal static ManualLogSource Log; internal static readonly List<Hook> Hooks = new List<Hook>(); internal static void VerboseLog(LogLevel logLevel, Func<string> message) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) if (message != null && (PluginConfig.Debug.Verbose.Value & logLevel) != 0) { Log.Log(logLevel, (object)message()); } } private void Awake() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; try { if (LobbyCompatibilityChecker.Enabled) { LobbyCompatibilityChecker.Init(); } Log.LogInfo((object)"Initializing Configs"); PluginConfig.Init((BaseUnityPlugin)(object)this); Log.LogInfo((object)"Patching Methods"); Harmony val = new Harmony("mattymatty.AdditionalNetworking"); val.PatchAll(); StartOfRoundPatch.Init(); Log.LogInfo((object)"AdditionalNetworking v2.2.1 Loaded!"); } catch (Exception ex) { Log.LogError((object)("Exception while initializing: \n" + ex)); } } } } namespace AdditionalNetworking.Utils { public class ItemCategory { internal static Item[] VanillaItems; internal static readonly Dictionary<Item, (string api, string modname)> ItemModMap = new Dictionary<Item, (string, string)>(); internal static readonly Dictionary<Item, string> ItemKeyMap = new Dictionary<Item, string>(); private static readonly Regex ConfigFilterRegex = new Regex("[\\n\\t\\\\\\'\\[\\]]"); public static string GetPathForItem(Item item) { (string, string) tagForItem = GetTagForItem(item); return GetPathForTag(tagForItem, item); } public static (string api, string modname) GetTagForItem(Item item) { if (!ItemModMap.TryGetValue(item, out (string, string) value)) { value = ("Unknown", ""); ItemModMap[item] = value; } return value; } public static string GetPathForTag((string api, string modname) modTag, Item item) { string path = string.Join("_", item.itemName.Split(Path.GetInvalidFileNameChars(), StringSplitOptions.RemoveEmptyEntries)).TrimEnd('.'); string path2 = string.Join("_", modTag.modname.Split(Path.GetInvalidPathChars(), StringSplitOptions.RemoveEmptyEntries)).TrimEnd('.'); return Path.Combine(modTag.api, path2, path); } public static string GetKeyForItem(Item item) { if (ItemKeyMap.TryGetValue(item, out var value)) { return value; } string pathForItem = GetPathForItem(item); pathForItem = pathForItem.Replace(Path.DirectorySeparatorChar, '/'); value = pathForItem; ItemKeyMap[item] = value; return value; } public static string SanitizeForConfig(string input) { return ConfigFilterRegex.Replace(input, "").Trim(); } } } namespace AdditionalNetworking.Patches { [HarmonyPatch] internal class NetworkManagerPatch { [HarmonyPostfix] [HarmonyPatch(typeof(NetworkManager), "Initialize")] private static void AfterInitialize() { AdditionalNetworking.Log.LogInfo((object)"Registering CustomMessages!"); PlayerController.RegisterMessages(); GrabbableObject.RegisterMessages(); Shotgun.RegisterMessages(); Boombox.RegisterMessages(); } } [HarmonyPatch] internal class RoundManagerPatch { [HarmonyPrefix] [HarmonyPatch(typeof(RoundManager), "GenerateNewLevelClientRpc")] private static void OnNewLevel(RoundManager __instance) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)__instance).NetworkManager; if (!((Object)(object)networkManager == (Object)null) && networkManager.IsListening && (int)((NetworkBehaviour)__instance).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { __instance.AdditionalNetworking_spawnedScrapPendingSync = true; } } [HarmonyFinalizer] [HarmonyPatch(typeof(RoundManager), "SyncScrapValuesClientRpc")] private static void AfterScrapValueSync(RoundManager __instance) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)__instance).NetworkManager; if (!((Object)(object)networkManager == (Object)null) && networkManager.IsListening && (int)((NetworkBehaviour)__instance).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { __instance.AdditionalNetworking_spawnedScrapPendingSync = false; } } } [HarmonyPatch] internal class StartOfRoundPatch { [HarmonyFinalizer] [HarmonyPatch(typeof(StartOfRound), "SyncShipUnlockablesClientRpc")] private static void AfterUnlockablesSync(StartOfRound __instance) { __instance.AdditionalNetworking_unlockablesSynced = true; } internal static void Init() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown AdditionalNetworking.Hooks.Add(new Hook((MethodBase)AccessTools.Method(typeof(StartOfRound), "Awake", (Type[])null, (Type[])null), (Delegate)new Action<Action<StartOfRound>, StartOfRound>(PrepareItemCache))); } private static void PrepareItemCache(Action<StartOfRound> orig, StartOfRound __instance) { ItemCategory.ItemModMap.Clear(); if (ItemCategory.VanillaItems == null) { ItemCategory.VanillaItems = __instance.allItemsList.itemsList.ToArray(); } Item[] vanillaItems = ItemCategory.VanillaItems; foreach (Item key in vanillaItems) { ItemCategory.ItemModMap.TryAdd(key, ("Vanilla", "")); } orig(__instance); } [HarmonyPrefix] [HarmonyAfter(new string[] { "imabatby.lethallevelloader" })] [HarmonyPatch(typeof(StartOfRound), "Start")] private static void PopulateModdedCache(StartOfRound __instance) { if (LethalLibProxy.Enabled) { LethalLibProxy.GetModdedItems(in ItemCategory.ItemModMap); } if (LethalLevelLoaderProxy.Enabled) { LethalLevelLoaderProxy.GetModdedItems(in ItemCategory.ItemModMap); } foreach (Item items in __instance.allItemsList.itemsList) { ItemCategory.ItemModMap.TryAdd(items, ("Unknown", "")); } } } } namespace AdditionalNetworking.Patches.Value { [HarmonyPatch] internal class GrabbableObjectPatch { [HarmonyPostfix] [HarmonyPatch(typeof(GrabbableObject), "LateUpdate")] private static void CheckScrapHasValue(GrabbableObject __instance) { //IL_0094: Unknown result type (might be due to invalid IL or missing references) if (!AdditionalNetworking.PluginConfig.Value.Enabled.Value || !__instance.itemProperties.isScrap || __instance.AdditionalNetworking_isInitialized || __instance.AdditionalNetworking_hasRequestedSync || (StartOfRound.Instance.inShipPhase && !StartOfRound.Instance.AdditionalNetworking_unlockablesSynced) || RoundManager.Instance.AdditionalNetworking_spawnedScrapPendingSync) { return; } if (!((NetworkBehaviour)__instance).NetworkObject.IsSpawned) { string keyForItem = ItemCategory.GetKeyForItem(__instance.itemProperties); AdditionalNetworking.Log.LogFatal((object)$"{keyForItem}({((Object)__instance).GetInstanceID()}) is not spawned! nobody else in the network knows about it!"); return; } try { GrabbableObject.RequestSyncServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)__instance).NetworkObject)); __instance.AdditionalNetworking_hasRequestedSync = true; } catch (Exception arg) { string keyForItem2 = ItemCategory.GetKeyForItem(__instance.itemProperties); AdditionalNetworking.Log.LogFatal((object)$"Exception syncing value of {keyForItem2}({((NetworkBehaviour)__instance).NetworkObjectId}):\n{arg}"); } } [HarmonyPostfix] [HarmonyPatch(typeof(GrabbableObject), "SetScrapValue")] [HarmonyPatch(typeof(GrabbableObject), "LoadItemSaveData")] private static void OnInitialize(GrabbableObject __instance) { __instance.AdditionalNetworking_isInitialized = true; } } } namespace AdditionalNetworking.Patches.State { [HarmonyPatch(typeof(AnimatedItem))] internal static class AnimatedItemPatch { [HarmonyPostfix] [HarmonyPatch("Start")] private static void OnStart(AnimatedItem __instance) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (AdditionalNetworking.PluginConfig.ItemState.Animated.Value && !((NetworkBehaviour)__instance).IsServer) { AnimatedObject.RequestSyncServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)__instance).NetworkObject)); } } [HarmonyFinalizer] [HarmonyPatch("EquipItem")] private static void OnEquipItem(AnimatedItem __instance) { if (AdditionalNetworking.PluginConfig.ItemState.Animated.Value && ((NetworkBehaviour)__instance).IsOwner) { __instance.AdditionalNetworking_dirtyStatus = true; } } [HarmonyFinalizer] [HarmonyPatch(typeof(GrabbableObject), "LateUpdate")] private static void OnLateUpdate(GrabbableObject __instance) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) if (!AdditionalNetworking.PluginConfig.ItemState.Animated.Value) { return; } AnimatedItem val = (AnimatedItem)(object)((__instance is AnimatedItem) ? __instance : null); if ((Object)(object)val == (Object)null || !val.AdditionalNetworking_dirtyStatus) { return; } val.AdditionalNetworking_dirtyStatus = false; if (!((NetworkBehaviour)__instance).NetworkObject.IsSpawned) { string keyForItem = ItemCategory.GetKeyForItem(__instance.itemProperties); AdditionalNetworking.Log.LogFatal((object)$"{keyForItem}({((Object)__instance).GetInstanceID()}) is not spawned! nobody else in the network knows about it!"); } else if (((NetworkBehaviour)__instance).IsOwner) { try { AudioSource itemAudio = val.itemAudio; AnimatedObject.SyncStateServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)__instance).NetworkObject), itemAudio.isPlaying); } catch (Exception arg) { string keyForItem2 = ItemCategory.GetKeyForItem(__instance.itemProperties); AdditionalNetworking.Log.LogFatal((object)$"Exception syncing boombox state of {keyForItem2}({((NetworkBehaviour)__instance).NetworkObjectId}):\n{arg}"); } } } } [HarmonyPatch] internal class BoomboxItemPatch { [HarmonyPrefix] [HarmonyPatch(typeof(BoomboxItem), "Start")] private static void OnStart(BoomboxItem __instance) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (AdditionalNetworking.PluginConfig.ItemState.Boombox.Value && !((NetworkBehaviour)StartOfRound.Instance).IsServer) { Boombox.RequestSyncServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)__instance).NetworkObject)); } } [HarmonyFinalizer] [HarmonyPatch(typeof(BoomboxItem), "StartMusic")] private static void OnMusicChange(BoomboxItem __instance) { if (AdditionalNetworking.PluginConfig.ItemState.Boombox.Value && ((NetworkBehaviour)__instance).IsOwner) { __instance.AdditionalNetworking_dirtyStatus = true; } } [HarmonyFinalizer] [HarmonyPatch(typeof(GrabbableObject), "LateUpdate")] private static void OnLateUpdate(GrabbableObject __instance) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) BoomboxItem val = (BoomboxItem)(object)((__instance is BoomboxItem) ? __instance : null); if ((Object)(object)val == (Object)null || !val.AdditionalNetworking_dirtyStatus) { return; } val.AdditionalNetworking_dirtyStatus = false; if (!((NetworkBehaviour)__instance).NetworkObject.IsSpawned) { string keyForItem = ItemCategory.GetKeyForItem(__instance.itemProperties); AdditionalNetworking.Log.LogFatal((object)$"{keyForItem}({((Object)__instance).GetInstanceID()}) is not spawned! nobody else in the network knows about it!"); } else if (((NetworkBehaviour)__instance).IsOwner) { int track = Array.IndexOf(val.musicAudios, val.boomboxAudio.clip); bool isPlayingMusic = val.isPlayingMusic; try { Boombox.SyncStateServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)__instance).NetworkObject), isPlayingMusic, track); } catch (Exception arg) { string keyForItem2 = ItemCategory.GetKeyForItem(__instance.itemProperties); AdditionalNetworking.Log.LogFatal((object)$"Exception syncing boombox state of {keyForItem2}({((NetworkBehaviour)__instance).NetworkObjectId}):\n{arg}"); } } } } [HarmonyPatch] internal class NutcrackerEnemyAiPatch { [HarmonyFinalizer] [HarmonyPatch(typeof(NutcrackerEnemyAI), "ReloadGunClientRpc")] private static void OnReload(NutcrackerEnemyAI __instance) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 //IL_00d6: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)__instance).NetworkManager; if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening || (int)((NetworkBehaviour)__instance).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost) || !((NetworkBehaviour)__instance).IsOwner || !AdditionalNetworking.PluginConfig.ItemState.Shotgun.Value) { return; } if (!((NetworkBehaviour)__instance).NetworkObject.IsSpawned) { AdditionalNetworking.Log.LogFatal((object)$"{((Object)((NetworkBehaviour)__instance).NetworkObject).name}({((Object)__instance).GetInstanceID()}) is not spawned! nobody else in the network knows about it!"); return; } if (!((NetworkBehaviour)__instance.gun).NetworkObject.IsSpawned) { string keyForItem = ItemCategory.GetKeyForItem(((GrabbableObject)__instance.gun).itemProperties); AdditionalNetworking.Log.LogFatal((object)$"{keyForItem}({((Object)__instance.gun).GetInstanceID()}) is not spawned! nobody else in the network knows about it!"); return; } try { Shotgun.SyncAmmoServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)__instance.gun).NetworkObject), __instance.gun.shellsLoaded); } catch (Exception arg) { string keyForItem2 = ItemCategory.GetKeyForItem(((GrabbableObject)__instance.gun).itemProperties); AdditionalNetworking.Log.LogFatal((object)$"Exception syncing ammo of {keyForItem2}({((NetworkBehaviour)__instance.gun).NetworkObjectId}):\n{arg}"); } } } [HarmonyPatch] internal class ShotgunItemPatch { [HarmonyPrefix] [HarmonyPatch(typeof(ShotgunItem), "Start")] private static void OnStart(ShotgunItem __instance) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (!AdditionalNetworking.PluginConfig.ItemState.Shotgun.Value || ((NetworkBehaviour)StartOfRound.Instance).IsServer) { return; } if (!((NetworkBehaviour)__instance).NetworkObject.IsSpawned) { string keyForItem = ItemCategory.GetKeyForItem(((GrabbableObject)__instance).itemProperties); AdditionalNetworking.Log.LogFatal((object)$"{keyForItem}({((Object)__instance).GetInstanceID()}) is not spawned! nobody else in the network knows about it!"); return; } try { Shotgun.RequestSyncServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)__instance).NetworkObject)); } catch (Exception arg) { string keyForItem2 = ItemCategory.GetKeyForItem(((GrabbableObject)__instance).itemProperties); AdditionalNetworking.Log.LogFatal((object)$"Exception syncing status of {keyForItem2}({((NetworkBehaviour)__instance).NetworkObjectId}):\n{arg}"); } } [HarmonyFinalizer] [HarmonyPatch(typeof(ShotgunItem), "ReloadGunEffectsServerRpc")] private static void OnAmmoReload(ShotgunItem __instance, bool start) { if (AdditionalNetworking.PluginConfig.ItemState.Shotgun.Value && !start && ((NetworkBehaviour)__instance).IsOwner) { __instance.AdditionalNetworking_dirtyAmmo = true; } } [HarmonyFinalizer] [HarmonyPatch(typeof(ShotgunItem), "ShootGun")] private static void OnShot(ShotgunItem __instance) { if (AdditionalNetworking.PluginConfig.ItemState.Shotgun.Value && ((NetworkBehaviour)__instance).IsOwner) { __instance.AdditionalNetworking_dirtyAmmo = true; } } [HarmonyFinalizer] [HarmonyPatch(typeof(ShotgunItem), "ItemInteractLeftRight")] private static void OnSafetyToggle(ShotgunItem __instance, bool right) { if (AdditionalNetworking.PluginConfig.ItemState.Shotgun.Value && ((NetworkBehaviour)__instance).IsOwner) { __instance.AdditionalNetworking_dirtySafety = true; } } [HarmonyFinalizer] [HarmonyPatch(typeof(GrabbableObject), "LateUpdate")] private static void OnLateUpdate(GrabbableObject __instance) { //IL_00c7: 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) ShotgunItem val = (ShotgunItem)(object)((__instance is ShotgunItem) ? __instance : null); if ((Object)(object)val == (Object)null) { return; } if (!((NetworkBehaviour)__instance).NetworkObject.IsSpawned) { string keyForItem = ItemCategory.GetKeyForItem(__instance.itemProperties); AdditionalNetworking.Log.LogFatal((object)$"{keyForItem}({((Object)__instance).GetInstanceID()}) is not spawned! nobody else in the network knows about it!"); return; } if (val.AdditionalNetworking_dirtyAmmo) { val.AdditionalNetworking_dirtyAmmo = false; if (((NetworkBehaviour)__instance).IsOwner) { try { Shotgun.SyncAmmoServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)__instance).NetworkObject), val.shellsLoaded); } catch (Exception arg) { string keyForItem2 = ItemCategory.GetKeyForItem(__instance.itemProperties); AdditionalNetworking.Log.LogFatal((object)$"Exception syncing ammo of {keyForItem2}({((NetworkBehaviour)__instance).NetworkObjectId}):\n{arg}"); } } } if (!val.AdditionalNetworking_dirtySafety) { return; } val.AdditionalNetworking_dirtySafety = false; if (!((NetworkBehaviour)__instance).IsOwner) { return; } try { Shotgun.SyncSafetyServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)__instance).NetworkObject), val.safetyOn); } catch (Exception arg2) { string keyForItem3 = ItemCategory.GetKeyForItem(__instance.itemProperties); AdditionalNetworking.Log.LogFatal((object)$"Exception syncing safety of {keyForItem3}({((NetworkBehaviour)__instance).NetworkObjectId}):\n{arg2}"); } } } } namespace AdditionalNetworking.Patches.Inventory { [HarmonyPatch] internal class PlayerControllerBPatch { [HarmonyPrefix] [HarmonyPatch(typeof(PlayerControllerB), "Start")] private static void OnStart(PlayerControllerB __instance) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (AdditionalNetworking.PluginConfig.Misc.Username.Value && !((NetworkBehaviour)__instance).IsServer) { PlayerController.RequestSyncUsernameServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)__instance).NetworkObject)); } } [HarmonyFinalizer] [HarmonyPatch(typeof(PlayerControllerB), "SwitchToItemSlot")] private static void OnSlotChange(PlayerControllerB __instance, int slot) { if (AdditionalNetworking.PluginConfig.Inventory.SlotChange.Value && ((NetworkBehaviour)__instance).IsOwner) { __instance.AdditionalNetworking_dirtySlots = true; } } [HarmonyFinalizer] [HarmonyPatch(typeof(PlayerControllerB), "GrabObjectClientRpc")] private static void OnItemGrabbed(PlayerControllerB __instance, bool grabValidated) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)__instance).NetworkManager; if (!((Object)(object)networkManager == (Object)null) && networkManager.IsListening && (int)((NetworkBehaviour)__instance).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && AdditionalNetworking.PluginConfig.Inventory.InventoryChange.Value && ((NetworkBehaviour)__instance).IsOwner && grabValidated) { __instance.AdditionalNetworking_dirtyInventory = true; } } [HarmonyFinalizer] [HarmonyPatch(typeof(PlayerControllerB), "DiscardHeldObject")] private static void OnDiscardItem(PlayerControllerB __instance) { if (AdditionalNetworking.PluginConfig.Inventory.InventoryChange.Value && ((NetworkBehaviour)__instance).IsOwner) { __instance.AdditionalNetworking_dirtyInventory = true; } } [HarmonyFinalizer] [HarmonyPatch(typeof(PlayerControllerB), "DropAllHeldItems")] private static void OnDropItem(PlayerControllerB __instance) { if (AdditionalNetworking.PluginConfig.Inventory.InventoryChange.Value && ((NetworkBehaviour)__instance).IsOwner) { __instance.AdditionalNetworking_dirtyInventory = true; } } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] private static void OnPlayerConnected(PlayerControllerB __instance) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (!AdditionalNetworking.PluginConfig.Misc.Username.Value || ((NetworkBehaviour)__instance).IsServer || !((NetworkBehaviour)__instance).IsOwner) { return; } try { PlayerController.SyncUsernameServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)__instance).NetworkObject), __instance.playerUsername); } catch (Exception arg) { AdditionalNetworking.Log.LogFatal((object)$"Exception syncing name of {__instance.playerUsername}({((NetworkBehaviour)__instance).NetworkObjectId}):\n{arg}"); } } [HarmonyFinalizer] [HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")] private static void OnLateUpdate(PlayerControllerB __instance) { //IL_001d: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) if (__instance.AdditionalNetworking_dirtySlots) { __instance.AdditionalNetworking_dirtySlots = false; if (((NetworkBehaviour)__instance).IsOwner) { try { PlayerController.SyncSelectedSlotServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)__instance).NetworkObject), __instance.currentItemSlot); } catch (Exception arg) { AdditionalNetworking.Log.LogFatal((object)$"Exception syncing slots of {__instance.playerUsername}({((NetworkBehaviour)__instance).NetworkObjectId}):\n{arg}"); } } } if (__instance.AdditionalNetworking_dirtyInventory) { __instance.AdditionalNetworking_dirtyInventory = false; if (((NetworkBehaviour)__instance).IsOwner) { List<NetworkObjectReference> list = default(List<NetworkObjectReference>); PooledObject<List<NetworkObjectReference>> val = CollectionPool<List<NetworkObjectReference>, NetworkObjectReference>.Get(ref list); try { List<int> list2 = default(List<int>); PooledObject<List<int>> val2 = CollectionPool<List<int>, int>.Get(ref list2); try { for (int i = 0; i < __instance.ItemSlots.Length; i++) { GrabbableObject val3 = __instance.ItemSlots[i]; if (!((Object)(object)val3 == (Object)null) && !((Object)(object)((NetworkBehaviour)val3).NetworkObject == (Object)null)) { if (!((NetworkBehaviour)val3).NetworkObject.IsSpawned) { string keyForItem = ItemCategory.GetKeyForItem(val3.itemProperties); AdditionalNetworking.Log.LogFatal((object)$"{keyForItem}({((Object)val3).GetInstanceID()}) is not spawned! nobody else in the network knows about it!"); } else { list.Add(NetworkObjectReference.op_Implicit(((NetworkBehaviour)val3).NetworkObject)); list2.Add(i); } } } try { PlayerController.SyncInventoryServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)__instance).NetworkObject), list.ToArray(), list2.ToArray()); } catch (Exception arg2) { AdditionalNetworking.Log.LogFatal((object)$"Exception syncing inventory of {__instance.playerUsername}({((NetworkBehaviour)__instance).NetworkObjectId}):\n{arg2}"); } } finally { ((IDisposable)val2).Dispose(); } } finally { ((IDisposable)val).Dispose(); } } } if (__instance.AdditionalNetworking_lastCrouchState == __instance.isCrouching) { return; } __instance.AdditionalNetworking_lastCrouchState = __instance.isCrouching; if (AdditionalNetworking.PluginConfig.PlayerState.Crouching.Value && ((NetworkBehaviour)__instance).IsOwner) { try { PlayerController.SyncCrouchServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)__instance).NetworkObject), __instance.isCrouching); } catch (Exception arg3) { AdditionalNetworking.Log.LogFatal((object)$"Exception syncing crouching state of {__instance.playerUsername}({((NetworkBehaviour)__instance).NetworkObjectId}):\n{arg3}"); } } } } } namespace AdditionalNetworking.Networking { public static class AnimatedObject { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnSyncAudioStateServerRpc; public static HandleNamedMessageDelegate <1>__OnSyncAudioStateClientRpc; public static HandleNamedMessageDelegate <2>__OnRequestSyncServerRpc; } private static readonly string BaseName = typeof(AnimatedObject).FullName; private static readonly string SyncAudioStateServerRpcMessage = BaseName + "|SyncAudioStateServerRpc"; private static readonly string SyncAudioStateClientRpcMessage = BaseName + "|SyncAudioStateClientRpc"; private static readonly string RequestSyncServerRpcMessage = BaseName + "|RequestSyncServerRpc"; internal static void RegisterMessages() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown CustomMessagingManager customMessagingManager = NetworkManager.Singleton.CustomMessagingManager; string syncAudioStateServerRpcMessage = SyncAudioStateServerRpcMessage; object obj = <>O.<0>__OnSyncAudioStateServerRpc; if (obj == null) { HandleNamedMessageDelegate val = OnSyncAudioStateServerRpc; <>O.<0>__OnSyncAudioStateServerRpc = val; obj = (object)val; } customMessagingManager.RegisterNamedMessageHandler(syncAudioStateServerRpcMessage, (HandleNamedMessageDelegate)obj); CustomMessagingManager customMessagingManager2 = NetworkManager.Singleton.CustomMessagingManager; string syncAudioStateClientRpcMessage = SyncAudioStateClientRpcMessage; object obj2 = <>O.<1>__OnSyncAudioStateClientRpc; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnSyncAudioStateClientRpc; <>O.<1>__OnSyncAudioStateClientRpc = val2; obj2 = (object)val2; } customMessagingManager2.RegisterNamedMessageHandler(syncAudioStateClientRpcMessage, (HandleNamedMessageDelegate)obj2); CustomMessagingManager customMessagingManager3 = NetworkManager.Singleton.CustomMessagingManager; string requestSyncServerRpcMessage = RequestSyncServerRpcMessage; object obj3 = <>O.<2>__OnRequestSyncServerRpc; if (obj3 == null) { HandleNamedMessageDelegate val3 = OnRequestSyncServerRpc; <>O.<2>__OnRequestSyncServerRpc = val3; obj3 = (object)val3; } customMessagingManager3.RegisterNamedMessageHandler(requestSyncServerRpcMessage, (HandleNamedMessageDelegate)obj3); } public static void SyncStateServerRpc(NetworkObjectReference itemReference, bool playing) { //IL_001d: 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) //IL_003a: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(1024, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteNetworkSerializable<NetworkObjectReference>(ref itemReference); ((FastBufferWriter)(ref val)).WriteValue<bool>(ref playing, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(SyncAudioStateServerRpcMessage, 0uL, val, (NetworkDelivery)3); } private static void OnSyncAudioStateServerRpc(ulong senderId, FastBufferReader data) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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) if (!NetworkManager.Singleton.IsServer) { return; } NetworkObjectReference itemReference = default(NetworkObjectReference); ((FastBufferReader)(ref data)).ReadNetworkSerializable<NetworkObjectReference>(ref itemReference); bool playing = default(bool); ((FastBufferReader)(ref data)).ReadValue<bool>(ref playing, default(ForPrimitives)); NetworkObject val = default(NetworkObject); if (((NetworkObjectReference)(ref itemReference)).TryGet(ref val, (NetworkManager)null) && (senderId == 0L || val.OwnerClientId == senderId)) { AdditionalNetworking.VerboseLog((LogLevel)32, () => string.Format("{0}.SyncStateServerRpc was called for {1}! playing: {2}", "AnimatedObject", ((NetworkObjectReference)(ref itemReference)).NetworkObjectId, playing)); SyncStateClientRpc(itemReference, playing); } } private static void SyncStateClientRpc(NetworkObjectReference itemReference, bool playing, ulong[] targets = null) { //IL_001d: 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) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(1024, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteNetworkSerializable<NetworkObjectReference>(ref itemReference); ((FastBufferWriter)(ref val)).WriteValue<bool>(ref playing, default(ForPrimitives)); if (targets == null) { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll(SyncAudioStateClientRpcMessage, val, (NetworkDelivery)3); } else { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(SyncAudioStateClientRpcMessage, (IReadOnlyList<ulong>)targets, val, (NetworkDelivery)3); } } private static void OnSyncAudioStateClientRpc(ulong senderId, FastBufferReader data) { //IL_001d: 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) //IL_003e: Unknown result type (might be due to invalid IL or missing references) NetworkObjectReference itemReference = default(NetworkObjectReference); ((FastBufferReader)(ref data)).ReadNetworkSerializable<NetworkObjectReference>(ref itemReference); bool playing = default(bool); ((FastBufferReader)(ref data)).ReadValue<bool>(ref playing, default(ForPrimitives)); NetworkObject val = default(NetworkObject); if (!((NetworkObjectReference)(ref itemReference)).TryGet(ref val, (NetworkManager)null) || senderId != 0L) { return; } AnimatedItem component = NetworkObjectReference.op_Implicit(itemReference).GetComponent<AnimatedItem>(); bool oldState = component.itemAudio.isPlaying; AdditionalNetworking.VerboseLog((LogLevel)32, () => string.Format("{0}.SyncStateClientRpc was called for {1}! playing: {2} was: {3}", "Boombox", ((NetworkObjectReference)(ref itemReference)).NetworkObjectId, playing, oldState)); if (!((NetworkBehaviour)component).IsOwner && playing != oldState) { AudioSource itemAudio = component.itemAudio; if (playing) { itemAudio.clip = component.grabAudio; itemAudio.loop = component.loopGrabAudio; itemAudio.Play(); } else { itemAudio.Stop(); } } } public static void RequestSyncServerRpc(NetworkObjectReference itemReference) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(1024, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteNetworkSerializable<NetworkObjectReference>(ref itemReference); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(RequestSyncServerRpcMessage, 0uL, val, (NetworkDelivery)3); } private static void OnRequestSyncServerRpc(ulong senderId, FastBufferReader data) { //IL_004c: 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) if (!NetworkManager.Singleton.IsServer) { return; } NetworkObjectReference itemReference = default(NetworkObjectReference); ((FastBufferReader)(ref data)).ReadNetworkSerializable<NetworkObjectReference>(ref itemReference); NetworkObject val = default(NetworkObject); if (((NetworkObjectReference)(ref itemReference)).TryGet(ref val, (NetworkManager)null)) { AdditionalNetworking.VerboseLog((LogLevel)32, () => string.Format("{0}.RequestSyncServerRpc was called for {1} by {2}!", "Boombox", ((NetworkObjectReference)(ref itemReference)).NetworkObjectId, senderId)); AnimatedItem component = NetworkObjectReference.op_Implicit(itemReference).GetComponent<AnimatedItem>(); bool isPlaying = component.itemAudio.isPlaying; SyncStateClientRpc(itemReference, isPlaying, new ulong[1] { senderId }); } } } public static class Boombox { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnSyncStateServerRpc; public static HandleNamedMessageDelegate <1>__OnSyncStateClientRpc; public static HandleNamedMessageDelegate <2>__OnRequestSyncServerRpc; } private static readonly string BaseName = typeof(Boombox).FullName; private static readonly string SyncStateServerRpcMessage = BaseName + "|SyncStateServerRpc"; private static readonly string SyncStateClientRpcMessage = BaseName + "|SyncStateClientRpc"; private static readonly string RequestSyncServerRpcMessage = BaseName + "|RequestSyncServerRpc"; internal static void RegisterMessages() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown CustomMessagingManager customMessagingManager = NetworkManager.Singleton.CustomMessagingManager; string syncStateServerRpcMessage = SyncStateServerRpcMessage; object obj = <>O.<0>__OnSyncStateServerRpc; if (obj == null) { HandleNamedMessageDelegate val = OnSyncStateServerRpc; <>O.<0>__OnSyncStateServerRpc = val; obj = (object)val; } customMessagingManager.RegisterNamedMessageHandler(syncStateServerRpcMessage, (HandleNamedMessageDelegate)obj); CustomMessagingManager customMessagingManager2 = NetworkManager.Singleton.CustomMessagingManager; string syncStateClientRpcMessage = SyncStateClientRpcMessage; object obj2 = <>O.<1>__OnSyncStateClientRpc; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnSyncStateClientRpc; <>O.<1>__OnSyncStateClientRpc = val2; obj2 = (object)val2; } customMessagingManager2.RegisterNamedMessageHandler(syncStateClientRpcMessage, (HandleNamedMessageDelegate)obj2); CustomMessagingManager customMessagingManager3 = NetworkManager.Singleton.CustomMessagingManager; string requestSyncServerRpcMessage = RequestSyncServerRpcMessage; object obj3 = <>O.<2>__OnRequestSyncServerRpc; if (obj3 == null) { HandleNamedMessageDelegate val3 = OnRequestSyncServerRpc; <>O.<2>__OnRequestSyncServerRpc = val3; obj3 = (object)val3; } customMessagingManager3.RegisterNamedMessageHandler(requestSyncServerRpcMessage, (HandleNamedMessageDelegate)obj3); } public static void SyncStateServerRpc(NetworkObjectReference boomboxReference, bool playing, int track) { //IL_001d: 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) //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_004c: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(1024, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteNetworkSerializable<NetworkObjectReference>(ref boomboxReference); ((FastBufferWriter)(ref val)).WriteValue<bool>(ref playing, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValue<int>(ref track, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(SyncStateServerRpcMessage, 0uL, val, (NetworkDelivery)3); } private static void OnSyncStateServerRpc(ulong senderId, FastBufferReader data) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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) if (!NetworkManager.Singleton.IsServer) { return; } NetworkObjectReference boomboxReference = default(NetworkObjectReference); ((FastBufferReader)(ref data)).ReadNetworkSerializable<NetworkObjectReference>(ref boomboxReference); bool playing = default(bool); ((FastBufferReader)(ref data)).ReadValue<bool>(ref playing, default(ForPrimitives)); int track = default(int); ((FastBufferReader)(ref data)).ReadValue<int>(ref track, default(ForPrimitives)); NetworkObject val = default(NetworkObject); if (((NetworkObjectReference)(ref boomboxReference)).TryGet(ref val, (NetworkManager)null) && (senderId == 0L || val.OwnerClientId == senderId)) { AdditionalNetworking.VerboseLog((LogLevel)32, () => string.Format("{0}.SyncStateServerRpc was called for {1}! track: {2}, playing: {3}", "Boombox", ((NetworkObjectReference)(ref boomboxReference)).NetworkObjectId, track, playing)); SyncStateClientRpc(boomboxReference, playing, track); } } private static void SyncStateClientRpc(NetworkObjectReference boomboxReference, bool playing, int track, ulong[] targets = null) { //IL_001d: 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) //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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(1024, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteNetworkSerializable<NetworkObjectReference>(ref boomboxReference); ((FastBufferWriter)(ref val)).WriteValue<bool>(ref playing, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValue<int>(ref track, default(ForPrimitives)); if (targets == null) { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll(SyncStateClientRpcMessage, val, (NetworkDelivery)3); } else { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(SyncStateClientRpcMessage, (IReadOnlyList<ulong>)targets, val, (NetworkDelivery)3); } } private static void OnSyncStateClientRpc(ulong senderId, FastBufferReader data) { //IL_001d: 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) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) NetworkObjectReference boomboxReference = default(NetworkObjectReference); ((FastBufferReader)(ref data)).ReadNetworkSerializable<NetworkObjectReference>(ref boomboxReference); bool playing = default(bool); ((FastBufferReader)(ref data)).ReadValue<bool>(ref playing, default(ForPrimitives)); int track = default(int); ((FastBufferReader)(ref data)).ReadValue<int>(ref track, default(ForPrimitives)); NetworkObject val = default(NetworkObject); if (!((NetworkObjectReference)(ref boomboxReference)).TryGet(ref val, (NetworkManager)null) || senderId != 0L) { return; } BoomboxItem component = NetworkObjectReference.op_Implicit(boomboxReference).GetComponent<BoomboxItem>(); int oldTrack = Array.IndexOf(component.musicAudios, component.boomboxAudio.clip); bool oldState = component.isPlayingMusic; AdditionalNetworking.VerboseLog((LogLevel)32, () => string.Format("{0}.SyncStateClientRpc was called for {1}! track: {2}, playing: {3} was track: {4}, playing: {5}", "Boombox", ((NetworkObjectReference)(ref boomboxReference)).NetworkObjectId, track, playing, oldTrack, oldState)); if (((NetworkBehaviour)component).IsOwner) { return; } if (!playing) { if (oldState) { component.StartMusic(false, false); } } else if (track != -1 && (!oldState || oldTrack != track)) { component.isPlayingMusic = true; ((GrabbableObject)component).isBeingUsed = true; component.boomboxAudio.Stop(); component.boomboxAudio.clip = component.musicAudios[track]; component.boomboxAudio.pitch = 1f; component.boomboxAudio.Play(); } } public static void RequestSyncServerRpc(NetworkObjectReference boomboxReference) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(1024, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteNetworkSerializable<NetworkObjectReference>(ref boomboxReference); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(RequestSyncServerRpcMessage, 0uL, val, (NetworkDelivery)3); } private static void OnRequestSyncServerRpc(ulong senderId, FastBufferReader data) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsServer) { return; } NetworkObjectReference boomboxReference = default(NetworkObjectReference); ((FastBufferReader)(ref data)).ReadNetworkSerializable<NetworkObjectReference>(ref boomboxReference); NetworkObject val = default(NetworkObject); if (((NetworkObjectReference)(ref boomboxReference)).TryGet(ref val, (NetworkManager)null)) { AdditionalNetworking.VerboseLog((LogLevel)32, () => string.Format("{0}.RequestSyncServerRpc was called for {1} by {2}!", "Boombox", ((NetworkObjectReference)(ref boomboxReference)).NetworkObjectId, senderId)); BoomboxItem component = NetworkObjectReference.op_Implicit(boomboxReference).GetComponent<BoomboxItem>(); int track = Array.IndexOf(component.musicAudios, component.boomboxAudio.clip); bool isPlayingMusic = component.isPlayingMusic; SyncStateClientRpc(boomboxReference, isPlayingMusic, track, new ulong[1] { senderId }); } } } public static class GrabbableObject { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnSyncValuesClientRpc; public static HandleNamedMessageDelegate <1>__OnRequestSyncServerRpc; } private static readonly string BaseName = typeof(GrabbableObject).FullName; private static readonly string SyncValuesClientRpcMessage = BaseName + "|SyncValuesClientRpc"; private static readonly string RequestSyncServerRpcMessage = BaseName + "|RequestSyncServerRpc"; internal static void RegisterMessages() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown CustomMessagingManager customMessagingManager = NetworkManager.Singleton.CustomMessagingManager; string syncValuesClientRpcMessage = SyncValuesClientRpcMessage; object obj = <>O.<0>__OnSyncValuesClientRpc; if (obj == null) { HandleNamedMessageDelegate val = OnSyncValuesClientRpc; <>O.<0>__OnSyncValuesClientRpc = val; obj = (object)val; } customMessagingManager.RegisterNamedMessageHandler(syncValuesClientRpcMessage, (HandleNamedMessageDelegate)obj); CustomMessagingManager customMessagingManager2 = NetworkManager.Singleton.CustomMessagingManager; string requestSyncServerRpcMessage = RequestSyncServerRpcMessage; object obj2 = <>O.<1>__OnRequestSyncServerRpc; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnRequestSyncServerRpc; <>O.<1>__OnRequestSyncServerRpc = val2; obj2 = (object)val2; } customMessagingManager2.RegisterNamedMessageHandler(requestSyncServerRpcMessage, (HandleNamedMessageDelegate)obj2); } private static void SyncValuesClientRpc(NetworkObjectReference grabbableReference, int scrapValue, int dataValue, ulong[] targets = null) { //IL_001d: 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) //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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(1024, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteNetworkSerializable<NetworkObjectReference>(ref grabbableReference); ((FastBufferWriter)(ref val)).WriteValue<int>(ref scrapValue, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValue<int>(ref dataValue, default(ForPrimitives)); if (targets == null) { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll(SyncValuesClientRpcMessage, val, (NetworkDelivery)3); } else { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(SyncValuesClientRpcMessage, (IReadOnlyList<ulong>)targets, val, (NetworkDelivery)3); } } private static void OnSyncValuesClientRpc(ulong senderId, FastBufferReader data) { //IL_001d: 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) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) NetworkObjectReference grabbableReference = default(NetworkObjectReference); ((FastBufferReader)(ref data)).ReadNetworkSerializable<NetworkObjectReference>(ref grabbableReference); int scrapValue = default(int); ((FastBufferReader)(ref data)).ReadValue<int>(ref scrapValue, default(ForPrimitives)); int dataValue = default(int); ((FastBufferReader)(ref data)).ReadValue<int>(ref dataValue, default(ForPrimitives)); NetworkObject val = default(NetworkObject); if (((NetworkObjectReference)(ref grabbableReference)).TryGet(ref val, (NetworkManager)null) && senderId == 0L) { GrabbableObject component = NetworkObjectReference.op_Implicit(grabbableReference).GetComponent<GrabbableObject>(); AdditionalNetworking.VerboseLog((LogLevel)32, () => string.Format("{0}.SyncValuesClientRpc was called for {1}! scrap: {2}, data: {3}", "GrabbableObject", ((NetworkObjectReference)(ref grabbableReference)).NetworkObjectId, scrapValue, dataValue)); if (component.itemProperties.saveItemVariable) { component.LoadItemSaveData(dataValue); } string itemTag = ItemCategory.GetKeyForItem(component.itemProperties); AdditionalNetworking.VerboseLog((LogLevel)32, () => string.Format("{0}.SyncValuesClientRpc was called for {1}! ItemTag: {2}", "GrabbableObject", ((NetworkObjectReference)(ref grabbableReference)).NetworkObjectId, itemTag)); if (AdditionalNetworking.PluginConfig.Value.IgnoreScanNodesList.Contains(itemTag)) { component.scrapValue = scrapValue; component.AdditionalNetworking_isInitialized = true; } else { component.SetScrapValue(scrapValue); } component.AdditionalNetworking_hasRequestedSync = false; } } public static void RequestSyncServerRpc(NetworkObjectReference grabbableReference) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(1024, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteNetworkSerializable<NetworkObjectReference>(ref grabbableReference); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(RequestSyncServerRpcMessage, 0uL, val, (NetworkDelivery)3); } private static void OnRequestSyncServerRpc(ulong senderId, FastBufferReader data) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsServer) { return; } NetworkObjectReference grabbableReference = default(NetworkObjectReference); ((FastBufferReader)(ref data)).ReadNetworkSerializable<NetworkObjectReference>(ref grabbableReference); NetworkObject val = default(NetworkObject); if (((NetworkObjectReference)(ref grabbableReference)).TryGet(ref val, (NetworkManager)null)) { AdditionalNetworking.VerboseLog((LogLevel)32, () => string.Format("{0}.RequestValuesServerRpc was called for {1} by {2}!", "GrabbableObject", ((NetworkObjectReference)(ref grabbableReference)).NetworkObjectId, senderId)); GrabbableObject component = NetworkObjectReference.op_Implicit(grabbableReference).GetComponent<GrabbableObject>(); SyncValuesClientRpc(grabbableReference, component.scrapValue, component.itemProperties.saveItemVariable ? component.GetItemDataToSave() : 0, new ulong[1] { senderId }); } } } public static class PlayerController { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnSyncInventoryServerRpc; public static HandleNamedMessageDelegate <1>__OnSyncInventoryClientRpc; public static HandleNamedMessageDelegate <2>__OnThrowExtraItemsClientRpc; public static HandleNamedMessageDelegate <3>__OnSyncSelectedSlotServerRpc; public static HandleNamedMessageDelegate <4>__OnSyncSelectedSlotClientRpc; public static HandleNamedMessageDelegate <5>__OnSyncCrouchServerRpc; public static HandleNamedMessageDelegate <6>__OnSyncCrouchClientRpc; public static HandleNamedMessageDelegate <7>__OnSyncUsernameServerRpc; public static HandleNamedMessageDelegate <8>__OnSyncUsernameClientRpc; public static HandleNamedMessageDelegate <9>__OnRequestSyncUsernameServerRpc; } private static readonly string BaseName = typeof(PlayerController).FullName; private static readonly string SyncInventoryServerRpcMessage = BaseName + "|SyncInventoryServerRpc"; private static readonly string SyncInventoryClientRpcMessage = BaseName + "|SyncInventoryClientRpc"; private static readonly string ThrowExtraItemsClientRpcMessage = BaseName + "|ThrowExtraItemsClientRpc"; private static readonly string SyncSelectedSlotServerRpcMessage = BaseName + "|SyncSelectedSlotServerRpc"; private static readonly string SyncSelectedSlotClientRpcMessage = BaseName + "|SyncSelectedSlotClientRpc"; private static readonly string SyncCrouchServerRpcMessage = BaseName + "|SyncCrouchServerRpc"; private static readonly string SyncCrouchClientRpcMessage = BaseName + "|SyncCrouchClientRpc"; private static readonly string SyncUsernameServerRpcMessage = BaseName + "|SyncUsernameServerRpc"; private static readonly string SyncUsernameClientRpcMessage = BaseName + "|SyncUsernameClientRpc"; private static readonly string RequestSyncUsernameServerRpcMessage = BaseName + "|RequestSyncUsernameServerRpc"; internal static void RegisterMessages() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown //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) //IL_00e6: Expected O, but got Unknown //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Expected O, but got Unknown //IL_0139: 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_0144: Expected O, but got Unknown //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Expected O, but got Unknown //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Expected O, but got Unknown //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Expected O, but got Unknown CustomMessagingManager customMessagingManager = NetworkManager.Singleton.CustomMessagingManager; string syncInventoryServerRpcMessage = SyncInventoryServerRpcMessage; object obj = <>O.<0>__OnSyncInventoryServerRpc; if (obj == null) { HandleNamedMessageDelegate val = OnSyncInventoryServerRpc; <>O.<0>__OnSyncInventoryServerRpc = val; obj = (object)val; } customMessagingManager.RegisterNamedMessageHandler(syncInventoryServerRpcMessage, (HandleNamedMessageDelegate)obj); CustomMessagingManager customMessagingManager2 = NetworkManager.Singleton.CustomMessagingManager; string syncInventoryClientRpcMessage = SyncInventoryClientRpcMessage; object obj2 = <>O.<1>__OnSyncInventoryClientRpc; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnSyncInventoryClientRpc; <>O.<1>__OnSyncInventoryClientRpc = val2; obj2 = (object)val2; } customMessagingManager2.RegisterNamedMessageHandler(syncInventoryClientRpcMessage, (HandleNamedMessageDelegate)obj2); CustomMessagingManager customMessagingManager3 = NetworkManager.Singleton.CustomMessagingManager; string throwExtraItemsClientRpcMessage = ThrowExtraItemsClientRpcMessage; object obj3 = <>O.<2>__OnThrowExtraItemsClientRpc; if (obj3 == null) { HandleNamedMessageDelegate val3 = OnThrowExtraItemsClientRpc; <>O.<2>__OnThrowExtraItemsClientRpc = val3; obj3 = (object)val3; } customMessagingManager3.RegisterNamedMessageHandler(throwExtraItemsClientRpcMessage, (HandleNamedMessageDelegate)obj3); CustomMessagingManager customMessagingManager4 = NetworkManager.Singleton.CustomMessagingManager; string syncSelectedSlotServerRpcMessage = SyncSelectedSlotServerRpcMessage; object obj4 = <>O.<3>__OnSyncSelectedSlotServerRpc; if (obj4 == null) { HandleNamedMessageDelegate val4 = OnSyncSelectedSlotServerRpc; <>O.<3>__OnSyncSelectedSlotServerRpc = val4; obj4 = (object)val4; } customMessagingManager4.RegisterNamedMessageHandler(syncSelectedSlotServerRpcMessage, (HandleNamedMessageDelegate)obj4); CustomMessagingManager customMessagingManager5 = NetworkManager.Singleton.CustomMessagingManager; string syncSelectedSlotClientRpcMessage = SyncSelectedSlotClientRpcMessage; object obj5 = <>O.<4>__OnSyncSelectedSlotClientRpc; if (obj5 == null) { HandleNamedMessageDelegate val5 = OnSyncSelectedSlotClientRpc; <>O.<4>__OnSyncSelectedSlotClientRpc = val5; obj5 = (object)val5; } customMessagingManager5.RegisterNamedMessageHandler(syncSelectedSlotClientRpcMessage, (HandleNamedMessageDelegate)obj5); CustomMessagingManager customMessagingManager6 = NetworkManager.Singleton.CustomMessagingManager; string syncCrouchServerRpcMessage = SyncCrouchServerRpcMessage; object obj6 = <>O.<5>__OnSyncCrouchServerRpc; if (obj6 == null) { HandleNamedMessageDelegate val6 = OnSyncCrouchServerRpc; <>O.<5>__OnSyncCrouchServerRpc = val6; obj6 = (object)val6; } customMessagingManager6.RegisterNamedMessageHandler(syncCrouchServerRpcMessage, (HandleNamedMessageDelegate)obj6); CustomMessagingManager customMessagingManager7 = NetworkManager.Singleton.CustomMessagingManager; string syncCrouchClientRpcMessage = SyncCrouchClientRpcMessage; object obj7 = <>O.<6>__OnSyncCrouchClientRpc; if (obj7 == null) { HandleNamedMessageDelegate val7 = OnSyncCrouchClientRpc; <>O.<6>__OnSyncCrouchClientRpc = val7; obj7 = (object)val7; } customMessagingManager7.RegisterNamedMessageHandler(syncCrouchClientRpcMessage, (HandleNamedMessageDelegate)obj7); CustomMessagingManager customMessagingManager8 = NetworkManager.Singleton.CustomMessagingManager; string syncUsernameServerRpcMessage = SyncUsernameServerRpcMessage; object obj8 = <>O.<7>__OnSyncUsernameServerRpc; if (obj8 == null) { HandleNamedMessageDelegate val8 = OnSyncUsernameServerRpc; <>O.<7>__OnSyncUsernameServerRpc = val8; obj8 = (object)val8; } customMessagingManager8.RegisterNamedMessageHandler(syncUsernameServerRpcMessage, (HandleNamedMessageDelegate)obj8); CustomMessagingManager customMessagingManager9 = NetworkManager.Singleton.CustomMessagingManager; string syncUsernameClientRpcMessage = SyncUsernameClientRpcMessage; object obj9 = <>O.<8>__OnSyncUsernameClientRpc; if (obj9 == null) { HandleNamedMessageDelegate val9 = OnSyncUsernameClientRpc; <>O.<8>__OnSyncUsernameClientRpc = val9; obj9 = (object)val9; } customMessagingManager9.RegisterNamedMessageHandler(syncUsernameClientRpcMessage, (HandleNamedMessageDelegate)obj9); CustomMessagingManager customMessagingManager10 = NetworkManager.Singleton.CustomMessagingManager; string requestSyncUsernameServerRpcMessage = RequestSyncUsernameServerRpcMessage; object obj10 = <>O.<9>__OnRequestSyncUsernameServerRpc; if (obj10 == null) { HandleNamedMessageDelegate val10 = OnRequestSyncUsernameServerRpc; <>O.<9>__OnRequestSyncUsernameServerRpc = val10; obj10 = (object)val10; } customMessagingManager10.RegisterNamedMessageHandler(requestSyncUsernameServerRpcMessage, (HandleNamedMessageDelegate)obj10); } public static void SyncInventoryServerRpc(NetworkObjectReference controllerReference, NetworkObjectReference[] inventory, int[] slots) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(1024, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteNetworkSerializable<NetworkObjectReference>(ref controllerReference); ((FastBufferWriter)(ref val)).WriteNetworkSerializable<NetworkObjectReference>(inventory, -1, 0); ((FastBufferWriter)(ref val)).WriteValue<int>(slots, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(SyncInventoryServerRpcMessage, 0uL, val, (NetworkDelivery)3); } private static void OnSyncInventoryServerRpc(ulong senderId, FastBufferReader data) { //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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsServer) { return; } NetworkObjectReference controllerReference = default(NetworkObjectReference); ((FastBufferReader)(ref data)).ReadNetworkSerializable<NetworkObjectReference>(ref controllerReference); NetworkObjectReference[] array = default(NetworkObjectReference[]); ((FastBufferReader)(ref data)).ReadNetworkSerializable<NetworkObjectReference>(ref array); int[] array2 = default(int[]); ((FastBufferReader)(ref data)).ReadValue<int>(ref array2, default(ForPrimitives)); NetworkObject val = default(NetworkObject); if (!((NetworkObjectReference)(ref controllerReference)).TryGet(ref val, (NetworkManager)null) || val.OwnerClientId != senderId) { return; } AdditionalNetworking.VerboseLog((LogLevel)32, () => string.Format("{0}.syncInventoryServerRpc was called for {1}!", "PlayerController", ((NetworkObjectReference)(ref controllerReference)).NetworkObjectId)); PlayerControllerB component = NetworkObjectReference.op_Implicit(controllerReference).GetComponent<PlayerControllerB>(); List<NetworkObjectReference> list = new List<NetworkObjectReference>(); List<int> list2 = new List<int>(); List<NetworkObjectReference> list3 = new List<NetworkObjectReference>(); for (int i = 0; i < array2.Length; i++) { if (array2[i] < component.ItemSlots.Length) { list.Add(array[i]); list2.Add(array2[i]); } else { list3.Add(array[i]); } } SyncInventoryClientRpc(controllerReference, list.ToArray(), list2.ToArray()); if (list3.Count > 0) { ThrowExtraItemsClientRpc(controllerReference, list3.ToArray(), new ulong[1] { senderId }); } } private static void SyncInventoryClientRpc(NetworkObjectReference controllerReference, NetworkObjectReference[] inventory, int[] slots, ulong[] targets = null) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0044: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(1024, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteNetworkSerializable<NetworkObjectReference>(ref controllerReference); ((FastBufferWriter)(ref val)).WriteNetworkSerializable<NetworkObjectReference>(inventory, -1, 0); ((FastBufferWriter)(ref val)).WriteValue<int>(slots, default(ForPrimitives)); if (targets == null) { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll(SyncInventoryClientRpcMessage, val, (NetworkDelivery)3); } else { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(SyncInventoryClientRpcMessage, (IReadOnlyList<ulong>)targets, val, (NetworkDelivery)3); } } private static void OnSyncInventoryClientRpc(ulong senderId, FastBufferReader data) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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) NetworkObjectReference controllerReference = default(NetworkObjectReference); ((FastBufferReader)(ref data)).ReadNetworkSerializable<NetworkObjectReference>(ref controllerReference); NetworkObjectReference[] array = default(NetworkObjectReference[]); ((FastBufferReader)(ref data)).ReadNetworkSerializable<NetworkObjectReference>(ref array); int[] array2 = default(int[]); ((FastBufferReader)(ref data)).ReadValue<int>(ref array2, default(ForPrimitives)); NetworkObject val = default(NetworkObject); if (!((NetworkObjectReference)(ref controllerReference)).TryGet(ref val, (NetworkManager)null) || senderId != 0L) { return; } AdditionalNetworking.VerboseLog((LogLevel)32, () => string.Format("{0}.syncInventoryClientRpc was called for {1}!", "PlayerController", ((NetworkObjectReference)(ref controllerReference)).NetworkObjectId)); PlayerControllerB component = NetworkObjectReference.op_Implicit(controllerReference).GetComponent<PlayerControllerB>(); if (((NetworkBehaviour)component).IsOwner) { return; } component.ItemSlots = (GrabbableObject[])(object)new GrabbableObject[component.ItemSlots.Length]; NetworkObject val3 = default(NetworkObject); GrabbableObject val4 = default(GrabbableObject); for (int i = 0; i < array.Length; i++) { int num = array2[i]; NetworkObjectReference val2 = array[i]; if (num < component.ItemSlots.Length) { if (((NetworkObjectReference)(ref val2)).TryGet(ref val3, (NetworkManager)null) && ((Component)val3).TryGetComponent<GrabbableObject>(ref val4)) { component.ItemSlots[num] = val4; } else { component.ItemSlots[num] = null; } } } component.SwitchToItemSlot(component.currentItemSlot, (GrabbableObject)null); } private static void ThrowExtraItemsClientRpc(NetworkObjectReference controllerReference, NetworkObjectReference[] objectsToThrow, ulong[] targets = null) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(1024, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteNetworkSerializable<NetworkObjectReference>(ref controllerReference); ((FastBufferWriter)(ref val)).WriteNetworkSerializable<NetworkObjectReference>(objectsToThrow, -1, 0); if (targets == null) { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll(ThrowExtraItemsClientRpcMessage, val, (NetworkDelivery)3); } else { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(ThrowExtraItemsClientRpcMessage, (IReadOnlyList<ulong>)targets, val, (NetworkDelivery)3); } } private static void OnThrowExtraItemsClientRpc(ulong senderId, FastBufferReader data) { //IL_0047: 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_0087: 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_00a6: Unknown result type (might be due to invalid IL or missing references) NetworkObjectReference val = default(NetworkObjectReference); ((FastBufferReader)(ref data)).ReadNetworkSerializable<NetworkObjectReference>(ref val); NetworkObjectReference[] array = default(NetworkObjectReference[]); ((FastBufferReader)(ref data)).ReadNetworkSerializable<NetworkObjectReference>(ref array); NetworkObject val2 = default(NetworkObject); if (!((NetworkObjectReference)(ref val)).TryGet(ref val2, (NetworkManager)null) || senderId != 0L) { return; } AdditionalNetworking.Log.LogWarning((object)string.Format("{0}.throwExtraItemsClientRpc was called for {1}!", "PlayerController", ((NetworkObjectReference)(ref val)).NetworkObjectId)); PlayerControllerB component = NetworkObjectReference.op_Implicit(val).GetComponent<PlayerControllerB>(); if (!((NetworkBehaviour)component).IsOwner) { return; } NetworkObjectReference[] array2 = array; NetworkObject val4 = default(NetworkObject); GrabbableObject val5 = default(GrabbableObject); for (int i = 0; i < array2.Length; i++) { NetworkObjectReference val3 = array2[i]; if (((NetworkObjectReference)(ref val3)).TryGet(ref val4, (NetworkManager)null) && ((Component)val4).TryGetComponent<GrabbableObject>(ref val5)) { component.ThrowObjectServerRpc(val3, component.isInElevator, component.isInHangarShipRoom, ((Component)component).transform.position, (int)((Component)component).transform.eulerAngles.y); } } } public static void SyncSelectedSlotServerRpc(NetworkObjectReference controllerReference, int selectedSlot) { //IL_001d: 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) //IL_003a: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(1024, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteNetworkSerializable<NetworkObjectReference>(ref controllerReference); ((FastBufferWriter)(ref val)).WriteValue<int>(ref selectedSlot, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(SyncSelectedSlotServerRpcMessage, 0uL, val, (NetworkDelivery)3); } private static void OnSyncSelectedSlotServerRpc(ulong senderId, FastBufferReader data) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsServer) { return; } NetworkObjectReference controllerReference = default(NetworkObjectReference); ((FastBufferReader)(ref data)).ReadNetworkSerializable<NetworkObjectReference>(ref controllerReference); int selectedSlot = default(int); ((FastBufferReader)(ref data)).ReadValue<int>(ref selectedSlot, default(ForPrimitives)); NetworkObject val = default(NetworkObject); if (!((NetworkObjectReference)(ref controllerReference)).TryGet(ref val, (NetworkManager)null) || val.OwnerClientId != senderId) { return; } PlayerControllerB component = NetworkObjectReference.op_Implicit(controllerReference).GetComponent<PlayerControllerB>(); if (selectedSlot < 0 || selectedSlot >= component.ItemSlots.Length) { AdditionalNetworking.Log.LogWarning((object)string.Format("Invalid {0}.syncSelectedSlotServerRpc was called for {1}, Ignored! slot:{2}", "PlayerController", ((NetworkObjectReference)(ref controllerReference)).NetworkObjectId, selectedSlot)); return; } AdditionalNetworking.VerboseLog((LogLevel)32, () => string.Format("{0}.syncSelectedSlotServerRpc was called for {1}! slot:{2}", "PlayerController", ((NetworkObjectReference)(ref controllerReference)).NetworkObjectId, selectedSlot)); SyncSelectedSlotClientRpc(controllerReference, selectedSlot); } private static void SyncSelectedSlotClientRpc(NetworkObjectReference controllerReference, int selectedSlot, ulong[] targets = null) { //IL_001d: 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) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(1024, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteNetworkSerializable<NetworkObjectReference>(ref controllerReference); ((FastBufferWriter)(ref val)).WriteValue<int>(ref selectedSlot, default(ForPrimitives)); if (targets == null) { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll(SyncSelectedSlotClientRpcMessage, val, (NetworkDelivery)3); } else { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(SyncSelectedSlotClientRpcMessage, (IReadOnlyList<ulong>)targets, val, (NetworkDelivery)3); } } private static void OnSyncSelectedSlotClientRpc(ulong senderId, FastBufferReader data) { //IL_001d: 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) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkObjectReference controllerReference = default(NetworkObjectReference); ((FastBufferReader)(ref data)).ReadNetworkSerializable<NetworkObjectReference>(ref controllerReference); int selectedSlot = default(int); ((FastBufferReader)(ref data)).ReadValue<int>(ref selectedSlot, default(ForPrimitives)); NetworkObject val = default(NetworkObject); if (((NetworkObjectReference)(ref controllerReference)).TryGet(ref val, (NetworkManager)null) && senderId == 0L) { PlayerControllerB controllerB = NetworkObjectReference.op_Implicit(controllerReference).GetComponent<PlayerControllerB>(); AdditionalNetworking.VerboseLog((LogLevel)32, () => string.Format("{0}.syncSelectedSlotClientRpc was called for {1}! slot:{2} was:{3}", "PlayerController", ((NetworkObjectReference)(ref controllerReference)).NetworkObjectId, selectedSlot, controllerB.currentItemSlot)); if (!((NetworkBehaviour)controllerB).IsOwner && controllerB.currentItemSlot != selectedSlot) { controllerB.SwitchToItemSlot(selectedSlot, (GrabbableObject)null); } } } public static void SyncCrouchServerRpc(NetworkObjectReference controllerReference, bool safety) { //IL_001d: 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) //IL_003a: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(1024, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteNetworkSerializable<NetworkObjectReference>(ref controllerReference); ((FastBufferWriter)(ref val)).WriteValue<bool>(ref safety, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(SyncCrouchServerRpcMessage, 0uL, val, (NetworkDelivery)3); } private static void OnSyncCrouchServerRpc(ulong senderId, FastBufferReader data) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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) if (!NetworkManager.Singleton.IsServer) { return; } NetworkObjectReference controllerReference = default(NetworkObjectReference); ((FastBufferReader)(ref data)).ReadNetworkSerializable<NetworkObjectReference>(ref controllerReference); bool crouched = default(bool); ((FastBufferReader)(ref data)).ReadValue<bool>(ref crouched, default(ForPrimitives)); NetworkObject val = default(NetworkObject); if (((NetworkObjectReference)(ref controllerReference)).TryGet(ref val, (NetworkManager)null) && (senderId == 0L || val.OwnerClientId == senderId)) { AdditionalNetworking.VerboseLog((LogLevel)32, () => string.Format("{0}.SyncCrouchServerRpc was called for {1}! crouched:{2}", "PlayerController", ((NetworkObjectReference)(ref controllerReference)).NetworkObjectId, crouched ? "yes" : "no")); SyncCrouchClientRpc(controllerReference, crouched); } } private static void SyncCrouchClientRpc(NetworkObjectReference controllerReference, bool crouched, ulong[] targets = null) { //IL_001d: 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) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(1024, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteNetworkSerializable<NetworkObjectReference>(ref controllerReference); ((FastBufferWriter)(ref val)).WriteValue<bool>(ref crouched, default(ForPrimitives)); if (targets == null) { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll(SyncCrouchClientRpcMessage, val, (NetworkDelivery)3); } else { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(SyncCrouchClientRpcMessage, (IReadOnlyList<ulong>)targets, val, (NetworkDelivery)3); } } private static void OnSyncCrouchClientRpc(ulong senderId, FastBufferReader data) { //IL_001d: 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) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkObjectReference controllerReference = default(NetworkObjectReference); ((FastBufferReader)(ref data)).ReadNetworkSerializable<NetworkObjectReference>(ref controllerReference); bool crouched = default(bool); ((FastBufferReader)(ref data)).ReadValue<bool>(ref crouched, default(ForPrimitives)); NetworkObject val = default(NetworkObject); if (((NetworkObjectReference)(ref controllerReference)).TryGet(ref val, (NetworkManager)null) && senderId == 0L) { PlayerControllerB controller = NetworkObjectReference.op_Implicit(controllerReference).GetComponent<PlayerControllerB>(); AdditionalNetworking.VerboseLog((LogLevel)32, () => string.Format("{0}.SyncCrouchClientRpc was called for {1}! safety:{2} was: {3}", "Shotgun", ((NetworkObjectReference)(ref controllerReference)).NetworkObjectId, crouched ? "yes" : "no", controller.isCrouching ? "yes" : "no")); if (!((NetworkBehaviour)controller).IsOwner) { controller.isCrouching = crouched; } } } public static void SyncUsernameServerRpc(NetworkObjectReference controllerReference, string username) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(1024, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteNetworkSerializable<NetworkObjectReference>(ref controllerReference); ((FastBufferWriter)(ref val)).WriteValue(username, false); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(SyncUsernameServerRpcMessage, 0uL, val, (NetworkDelivery)3); } private static void OnSyncUsernameServerRpc(ulong senderId, FastBufferReader data) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsServer) { NetworkObjectReference controllerReference = default(NetworkObjectReference); ((FastBufferReader)(ref data)).ReadNetworkSerializable<NetworkObjectReference>(ref controllerReference); string username = default(string); ((FastBufferReader)(ref data)).ReadValue(ref username, false); NetworkObject val = default(NetworkObject); if (((NetworkObjectReference)(ref controllerReference)).TryGet(ref val, (NetworkManager)null) && (senderId == 0L || val.OwnerClientId == senderId)) { AdditionalNetworking.Log.LogDebug((object)string.Format("{0}.syncUsernameServerRpc was called for {1}!", "PlayerController", ((NetworkObjectReference)(ref controllerReference)).NetworkObjectId)); SyncUsernameClientRpc(controllerReference, username); } } } private static void SyncUsernameClientRpc(NetworkObjectReference controllerReference, string username, ulong[] targets = null) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(1024, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteNetworkSerializable<NetworkObjectReference>(ref controllerReference); ((FastBufferWriter)(ref val)).WriteValue(username, false); if (targets == null) { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll(SyncUsernameClientRpcMessage, val, (NetworkDelivery)3); } else { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(SyncUsernameClientRpcMessage, (IReadOnlyList<ulong>)targets, val, (NetworkDelivery)3); } } private static void OnSyncUsernameClientRpc(ulong senderId, FastBufferReader data) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) NetworkObjectReference val = default(NetworkObjectReference); ((FastBufferReader)(ref data)).ReadNetworkSerializable<NetworkObjectReference>(ref val); string text = default(string); ((FastBufferReader)(ref data)).ReadValue(ref text, false); NetworkObject val2 = default(NetworkObject); if (!((NetworkObjectReference)(ref val)).TryGet(ref val2, (NetworkManager)null) || senderId != 0L) { return; } AdditionalNetworking.Log.LogDebug((object)string.Format("{0}.syncUsernameClientRpc was called for {1}!", "PlayerController", ((NetworkObjectReference)(ref val)).NetworkObjectId)); PlayerControllerB controllerB = NetworkObjectReference.op_Implicit(val).GetComponent<PlayerControllerB>(); if (((NetworkBehaviour)controllerB).IsOwner) { return; } controllerB.playerUsername = text; ((TMP_Text)controllerB.usernameBillboardText).text = text; StartOfRound.Instance.mapScreen.ChangeNameOfTargetTransform(((Component)controllerB).transform, text); if (HUDManager.Instance.spectatingPlayerBoxes.ContainsValue(controllerB)) { GameObject gameObject = ((Component)HUDManager.Instance.spectatingPlayerBoxes.First((KeyValuePair<Animator, PlayerControllerB> x) => (Object)(object)x.Value == (Object)(object)controllerB).Key).gameObject; ((TMP_Text)gameObject.GetComponentInChildren<TextMeshProUGUI>()).text = text; } } public static void RequestSyncUsernameServerRpc(NetworkObjectReference controllerReference) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(1024, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteNetworkSerializable<NetworkObjectReference>(ref controllerReference); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(RequestSyncUsernameServerRpcMessage, 0uL, val, (NetworkDelivery)3); } private static void OnRequestSyncUsernameServerRpc(ulong senderId, FastBufferReader data) { //IL_004e: 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) if (!NetworkManager.Singleton.IsServer) { return; } NetworkObjectReference val = default(NetworkObjectReference); ((FastBufferReader)(ref data)).ReadNetworkSerializable<NetworkObjectReference>(ref val); NetworkObject val2 = default(NetworkObject); if (((NetworkObjectReference)(ref val)).TryGet(ref val2, (NetworkManager)null)) { AdditionalNetworking.Log.LogDebug((object)string.Format("{0}.requestSyncUsernameServerRpc was called for {1} by {2}!", "PlayerController", ((NetworkObjectReference)(ref val)).NetworkObjectId, senderId)); PlayerControllerB component = NetworkObjectReference.op_Implicit(val).GetComponent<PlayerControllerB>(); if (!((NetworkBehaviour)component).IsOwnedByServer) { SyncUsernameClientRpc(val, component.playerUsername, new ulong[1] { senderId }); } } } } public static class Shotgun { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnSyncAmmoServerRpc; public static HandleNamedMessageDelegate <1>__OnSyncAmmoClientRpc; public static HandleNamedMessageDelegate <2>__OnSyncSafetyServerRpc; public static HandleNamedMessageDelegate <3>__OnSyncSafetyClientRpc; public static HandleNamedMessageDelegate <4>__OnRequestSyncServerRpc; } private static readonly string BaseName = typeof(Shotgun).FullName; private static readonly string SyncAmmoClientRpcMessage = BaseName + "|SyncAmmoClientRpc"; private static readonly string SyncAmmoServerRpcMessage = BaseName + "|SyncAmmoServerRpc"; private static readonly string SyncSafetyClientRpcMessage = BaseName + "|SyncSafetyClientRpc"; private static readonly string SyncSafetyServerRpcMessage = BaseName + "|SyncSafetyServerRpc"; private static readonly string RequestSyncServerRpcMessage = BaseName + "|RequestSyncServerRpc"; internal static void RegisterMessages() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown //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) //IL_00e6: Expected O, but got Unknown CustomMessagingManager customMessagingManager = NetworkManager.Singleton.CustomMessagingManager; string syncAmmoServerRpcMessage = SyncAmmoServerRpcMessage; object obj = <>O.<0>__OnSyncAmmoServerRpc; if (obj == null) { HandleNamedMessageDelegate val = OnSyncAmmoServerRpc; <>O.<0>__OnSyncAmmoServerRpc = val; obj = (object)val; } customMessagingManager.RegisterNamedMessageHandler(syncAmmoServerRpcMessage, (HandleNamedMessageDelegate)obj); CustomMessagingManager customMessagingManager2 = NetworkManager.Singleton.CustomMessagingManager; string syncAmmoClientRpcMessage = SyncAmmoClientRpcMessage; object obj2 = <>O.<1>__OnSyncAmmoClientRpc; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnSyncAmmoClientRpc; <>O.<1>__OnSyncAmmoClientRpc = val2; obj2 = (object)val2; } customMessagingManager2.RegisterNamedMessageHandler(syncAmmoClientRpcMessage, (HandleNamedMessageDelegate)obj2); CustomMessagingManager customMessagingManager3 = NetworkManager.Singleton.CustomMessagingManager; string syncSafetyServerRpcMessage = SyncSafetyServerRpcMessage; object obj3 = <>O.<2>__OnSyncSafetyServerRpc; if (obj3 == null) { HandleNamedMessageDelegate val3 = OnSyncSafetyServerRpc; <>O.<2>__OnSyncSafetyServerRpc = val3; obj3 = (object)val3; } customMessagingManager3.RegisterNamedMessageHandler(syncSafetyServerRpcMessage, (HandleNamedMessageDelegate)obj3); CustomMessagingManager customMessagingManager4 = NetworkManager.Singleton.CustomMessagingManager; string syncSafetyClientRpcMessage = SyncSafetyClientRpcMessage; object obj4 = <>O.<3>__OnSyncSafetyClientRpc; if (obj4 == null) { HandleNamedMessageDelegate val4 = OnSyncSafetyClientRpc; <>O.<3>__OnSyncSafetyClientRpc = val4; obj4 = (object)val4; } customMessagingManager4.RegisterNamedMessageHandler(syncSafetyClientRpcMessage, (HandleNamedMessageDelegate)obj4); CustomMessagingManager customMessagingManager5 = NetworkManager.Singleton.CustomMessagingManager; string requestSyncServerRpcMessage = RequestSyncServerRpcMessage; object obj5 = <>O.<4>__OnRequestSyncServerRpc; if (obj5 == null) { HandleNamedMessageDelegate val5 = OnRequestSyncServerRpc; <>O.<4>__OnRequestSyncServerRpc = val5; obj5 = (object)val5; } customMessagingManager5.RegisterNamedMessageHandler(requestSyncServerRpcMessage, (HandleNamedMessageDelegate)obj5); } public static void SyncAmmoServerRpc(NetworkObjectReference shotgunReference, int ammoCount) { //IL_001d: 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) //IL_003a: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(1024, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteNetworkSerializable<NetworkObjectReference>(ref shotgunReference); ((FastBufferWriter)(ref val)).WriteValue<int>(ref ammoCount, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(SyncAmmoServerRpcMessage, 0uL, val, (NetworkDelivery)3); } private static void OnSyncAmmoServerRpc(ulong senderId, FastBufferReader data) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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) if (!NetworkManager.Singleton.IsServer) { return; } NetworkObjectReference shotgunReference = default(NetworkObjectReference); ((FastBufferReader)(ref data)).ReadNetworkSerializable<NetworkObjectReference>(ref shotgunReference); int ammoCount = default(int); ((FastBufferReader)(ref data)).ReadValue<int>(ref ammoCount, default(ForPrimitives)); NetworkObject val = default(NetworkObject); if (((NetworkObjectReference)(ref shotgunReference)).TryGet(ref val, (NetworkManager)null) && (senderId == 0L || val.OwnerClientId == senderId)) { AdditionalNetworking.VerboseLog((LogLevel)32, () => string.Format("{0}.SyncAmmoServerRpc was called for {1}! ammo: {2}", "Shotgun", ((NetworkObjectReference)(ref shotgunReference)).NetworkObjectId, ammoCount)); SyncAmmoClientRpc(shotgunReference, ammoCount); } } private static void SyncAmmoClientRpc(NetworkObjectReference shotgunReference, int ammoCount, ulong[] targets = null) { //IL_001d: 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) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(1024, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteNetworkSerializable<NetworkObjectReference>(ref shotgunReference); ((FastBufferWriter)(ref val)).WriteValue<int>(ref ammoCount, default(ForPrimitives)); if (targets == null) { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll(SyncAmmoClientRpcMessage, val, (NetworkDelivery)3); } else { NetworkManager.Singleton.CustomMessa