Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of AdditionalNetworking Experimental v2.4.0
BepInEx/plugins/AdditionalNetworking.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using AdditionalNetworking.Dependency; using AdditionalNetworking.Interfaces; using AdditionalNetworking.Networking; using AdditionalNetworking.Patches; using AdditionalNetworking.Utils; using AdditionalNetworking.Utils.IL; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using HarmonyLib.Public.Patching; using InjectionLibrary.Attributes; 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 Mono.Cecil; using Mono.Cecil.Cil; using Mono.Collections.Generic; using MonoMod.RuntimeDetour; using MonoMod.Utils; 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: RequiresInjections] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("UnityEngine.AccessibilityModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.AIModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.AndroidJNIModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.AnimationModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.AssetBundleModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.AudioModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ClothModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ClusterInputModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ClusterRendererModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ContentLoadModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.CoreModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.CrashReportingModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.DirectorModule")] [assembly: IgnoresAccessChecksTo("UnityEngine")] [assembly: IgnoresAccessChecksTo("UnityEngine.DSPGraphModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.GameCenterModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.GIModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.GridModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.HotReloadModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ImageConversionModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.IMGUIModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.InputLegacyModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.InputModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.JSONSerializeModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.LocalizationModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ParticleSystemModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.PerformanceReportingModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.Physics2DModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.PhysicsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ProfilerModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.PropertiesModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.RuntimeInitializeOnLoadManagerInitializerModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ScreenCaptureModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SharedInternalsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SpriteMaskModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SpriteShapeModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.StreamingModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SubstanceModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SubsystemsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TerrainModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TerrainPhysicsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TextCoreFontEngineModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TextCoreTextEngineModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TextRenderingModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TilemapModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TLSModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("UnityEngine.UIElementsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UIModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UmbraModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityAnalyticsCommonModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityAnalyticsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityConnectModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityCurlModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityTestProtocolModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestAssetBundleModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestAudioModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestTextureModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestWWWModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.VehiclesModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.VFXModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.VideoModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.VirtualTexturingModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.VRModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.WindModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.XRModule")] [assembly: AssemblyCompany("mattymatty")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("2.4.0")] [assembly: AssemblyInformationalVersion("2.4.0+b3188e37fb4c4f2478097fc0cd55a60c98423049")] [assembly: AssemblyProduct("AdditionalNetworking")] [assembly: AssemblyTitle("AdditionalNetworking - Plugin")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.4.0.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] internal sealed class IsUnmanagedAttribute : Attribute { } [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.4.0")] [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<bool> SkipVanillaGrabbablesSync; internal static ConfigEntry<string> IgnoreScanNodes; internal static HashSet<string> IgnoreScanNodesList = new HashSet<string>(); internal static bool ShouldSkipGrabbableSync => SkipVanillaGrabbablesSync.Value; } 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.SkipVanillaGrabbablesSync = config.Bind<bool>("Item Values", "SkipVanillaGrabbablesSync", false, "disable sync item values in SyncShipUnlockablesServerRpc, replaced by AdditionalNetworking own message"); 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(PlayerState.Crouching); LethalConfigProxy.AddConfig(Value.Enabled); LethalConfigProxy.AddConfig(Value.SkipVanillaGrabbablesSync); LethalConfigProxy.AddConfig(Value.IgnoreScanNodes); 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.4.0"; 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.4.0 Loaded!"); } catch (Exception ex) { Log.LogError((object)("Exception while initializing: \n" + ex)); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "mattymatty.AdditionalNetworking"; public const string PLUGIN_NAME = "AdditionalNetworking"; public const string PLUGIN_VERSION = "2.4.0"; } } namespace AdditionalNetworking.Patches { [HarmonyPatch] internal class NetworkManagerPatch { [HarmonyPostfix] [HarmonyPatch(typeof(NetworkManager), "Initialize")] private static void AfterInitialize() { AdditionalNetworking.Log.LogInfo((object)"Registering Named Messages!"); PlayerController.RegisterMessages(); GrabbableObject.RegisterMessages(); Shotgun.RegisterMessages(); Boombox.RegisterMessages(); } [HarmonyPatch(typeof(GameNetworkManager), "SetInstanceValuesBackToDefault")] [HarmonyPostfix] public static void SetInstanceValuesBackToDefault() { if (!((Object)(object)NetworkManager.Singleton == (Object)null) && NetworkManager.Singleton.CustomMessagingManager != null) { AdditionalNetworking.Log.LogInfo((object)"Unregistering Named Messages!"); PlayerController.UnregisterMessages(); GrabbableObject.UnregisterMessages(); Shotgun.UnregisterMessages(); Boombox.UnregisterMessages(); } } } [HarmonyPatch] internal class RoundManagerPatch { [HarmonyPrefix] [HarmonyPatch(typeof(RoundManager), "GenerateNewLevelClientRpc")] private static void OnNewLevel(RoundManager __instance) { if (((NetworkBehaviour)(object)__instance).IsRPCClientStage()) { ((INetworkRoundManager)__instance).AdditionalNetworking_ScrapPendingSync = true; } } [HarmonyFinalizer] [HarmonyPatch(typeof(RoundManager), "SyncScrapValuesClientRpc")] private static void AfterScrapValueSync(RoundManager __instance) { if (!((NetworkBehaviour)(object)__instance).IsRPCClientStage()) { ((INetworkRoundManager)__instance).AdditionalNetworking_ScrapPendingSync = false; } } } [HarmonyPatch] internal class StartOfRoundPatch { [HarmonyFinalizer] [HarmonyPatch(typeof(StartOfRound), "SyncShipUnlockablesClientRpc")] private static void AfterUnlockablesClientSync(StartOfRound __instance) { if (((NetworkBehaviour)(object)__instance).IsRPCClientStage() && !AdditionalNetworking.PluginConfig.Value.ShouldSkipGrabbableSync) { ((INetworkStartOfRound)__instance).AdditionalNetworking_ValuablesSynced = true; } } private static void SyncGrabbableReplacement() { ulong[] targets = NetworkManager.Singleton.ConnectedClientsIds.Where((ulong id) => id != 0).ToArray(); GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>(); IEnumerable<GrabbableDataHolder> source = from g in array where ((NetworkBehaviour)g).IsSpawned select new GrabbableDataHolder(g); try { AdditionalNetworking.Log.LogInfo((object)$"Syncing {array.Length} items!"); foreach (IEnumerable<GrabbableDataHolder> item in Extensions.Chunk(source, 500)) { GrabbableDataHolder[] grabbableItems = item.ToArray(); GrabbableObject.SyncMultipleValuesClientRpc(in grabbableItems, targets); } GrabbableObject.MarkValuablesSyncedClientRpc(targets); } catch (Exception arg) { AdditionalNetworking.Log.LogFatal((object)$"Exception syncing all grabbables\n{arg}"); } } [HarmonyTranspiler] [HarmonyBefore(new string[] { "LethalPerformance" })] [HarmonyPatch(typeof(StartOfRound), "SyncShipUnlockablesServerRpc")] private static IEnumerable<CodeInstruction> PatchSyncShipUnlockablesServerRpc(IEnumerable<CodeInstruction> instructions, ILGenerator ilGenerator, MethodBase method) { //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Expected O, but got Unknown //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Expected O, but got Unknown //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Expected O, but got Unknown //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Expected O, but got Unknown //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Expected O, but got Unknown CodeInstruction[] array = instructions.ToArray(); ILInjector iLInjector = new ILInjector(array, ilGenerator); iLInjector.Find(ILMatcher.Ldc(), ILMatcher.Ldc(), ILMatcher.Call(typeof(Object).GetGenericMethod("FindObjectsByType", new Type[2] { typeof(FindObjectsInactive), typeof(FindObjectsSortMode) }, new Type[1] { typeof(GrabbableObject) }), "PatchSyncShipUnlockablesServerRpc", "./Plugin/src/Patches/StartOfRoundPatch.cs", 79)); if (!iLInjector.IsValid) { AdditionalNetworking.Log.LogError((object)("Failed to find FindObjectsByType in " + method.DeclaringType.FullName + "." + method.Name)); return array; } iLInjector.DefineLabel(out var label).DefineLabel(out var label2).InsertAfterBranch(new CodeInstruction(OpCodes.Call, (object)typeof(AdditionalNetworking.PluginConfig.Value).GetProperty("ShouldSkipGrabbableSync", BindingFlags.Static | BindingFlags.NonPublic).GetMethod), new CodeInstruction(OpCodes.Brtrue, (object)label2)); iLInjector.Find(ILMatcher.Call(typeof(Enumerable).GetGenericMethod("ToArray", new Type[1] { typeof(IEnumerable<GrabbableObject>) }, new Type[1] { typeof(GrabbableObject) }), "PatchSyncShipUnlockablesServerRpc", "./Plugin/src/Patches/StartOfRoundPatch.cs", 102), ILMatcher.Stloc().CaptureAs(out var variable)); if (!iLInjector.IsValid) { AdditionalNetworking.Log.LogError((object)("Failed to find ToArray in " + method.DeclaringType.FullName + "." + method.Name)); return array; } iLInjector.GoToMatchEnd().AddLabel(label).Insert(new CodeInstruction(OpCodes.Br, (object)label), new CodeInstruction(OpCodes.Call, (object)typeof(Array).GetGenericMethod("Empty", Array.Empty<Type>(), new Type[1] { typeof(GrabbableObject) })) { labels = new List<Label>(1) { label2 } }, variable); iLInjector.Find(ILMatcher.Call(typeof(StartOfRound).GetMethod("SyncShipUnlockablesClientRpc"), "PatchSyncShipUnlockablesServerRpc", "./Plugin/src/Patches/StartOfRoundPatch.cs", 128)); if (!iLInjector.IsValid) { AdditionalNetworking.Log.LogError((object)("Failed to find call to SyncShipUnlockablesClientRpc in " + method.DeclaringType.FullName + "." + method.Name)); return array; } iLInjector.GoToMatchEnd().Insert(new CodeInstruction(OpCodes.Call, (object)typeof(StartOfRoundPatch).GetMethod("SyncGrabbableReplacement", BindingFlags.Static | BindingFlags.NonPublic))); return iLInjector.ReleaseInstructions(); } 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_00b1: Unknown result type (might be due to invalid IL or missing references) if (!AdditionalNetworking.PluginConfig.Value.Enabled.Value || ((NetworkBehaviour)__instance).IsServer || !__instance.itemProperties.isScrap || ((INetworkGrabbableObject)__instance).AdditionalNetworking_IsInitialized || ((INetworkGrabbableObject)__instance).AdditionalNetworking_RequestedSync || (StartOfRound.Instance.inShipPhase && !((INetworkStartOfRound)StartOfRound.Instance).AdditionalNetworking_ValuablesSynced) || ((INetworkRoundManager)RoundManager.Instance).AdditionalNetworking_ScrapPendingSync) { 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)); ((INetworkGrabbableObject)__instance).AdditionalNetworking_RequestedSync = true; } catch (Exception arg) { string keyForItem2 = ItemCategory.GetKeyForItem(__instance.itemProperties); AdditionalNetworking.Log.LogError((object)$"Exception during networking of {keyForItem2}({((NetworkBehaviour)__instance).NetworkObjectId}): {arg}"); } } [HarmonyPostfix] [HarmonyPatch(typeof(GrabbableObject), "SetScrapValue")] [HarmonyPatch(typeof(GrabbableObject), "LoadItemSaveData")] private static void OnInitialize(GrabbableObject __instance) { ((INetworkGrabbableObject)__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_0057: Unknown result type (might be due to invalid IL or missing references) if (!AdditionalNetworking.PluginConfig.ItemState.Animated.Value || ((NetworkBehaviour)__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 { AnimatedObject.RequestSyncServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)__instance).NetworkObject)); } catch (Exception arg) { string keyForItem2 = ItemCategory.GetKeyForItem(((GrabbableObject)__instance).itemProperties); AdditionalNetworking.Log.LogError((object)$"Exception during networking of {keyForItem2}({((NetworkBehaviour)__instance).NetworkObjectId}): {arg}"); } } [HarmonyFinalizer] [HarmonyPatch("EquipItem")] private static void OnEquipItem(AnimatedItem __instance) { if (AdditionalNetworking.PluginConfig.ItemState.Animated.Value && ((NetworkBehaviour)__instance).IsOwner) { ((INetworkAnimatedItem)__instance).AdditionalNetworking_Changed = true; } } [HarmonyFinalizer] [HarmonyPatch(typeof(GrabbableObject), "LateUpdate")] private static void OnLateUpdate(GrabbableObject __instance) { //IL_0089: 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 || ((INetworkAnimatedItem)__instance).AdditionalNetworking_Changed) { return; } ((INetworkAnimatedItem)__instance).AdditionalNetworking_Changed = 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 animator state of {keyForItem2}({((NetworkBehaviour)__instance).NetworkObjectId}):\n{arg}"); } } } } [HarmonyPatch] internal class BoomboxItemPatch { [HarmonyPrefix] [HarmonyPatch(typeof(BoomboxItem), "Start")] private static void OnStart(BoomboxItem __instance) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (!AdditionalNetworking.PluginConfig.ItemState.Boombox.Value || ((NetworkBehaviour)__instance).IsServer) { return; } try { Boombox.RequestSyncServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)__instance).NetworkObject)); } catch (Exception arg) { AdditionalNetworking.Log.LogError((object)$"Exception during networking: {arg}"); } } [HarmonyFinalizer] [HarmonyPatch(typeof(BoomboxItem), "StartMusic")] private static void OnMusicChange(BoomboxItem __instance) { if (AdditionalNetworking.PluginConfig.ItemState.Boombox.Value && ((NetworkBehaviour)__instance).IsOwner) { ((INetworkBoomboxItem)__instance).AdditionalNetworking_Changed = true; } } [HarmonyFinalizer] [HarmonyPatch(typeof(GrabbableObject), "LateUpdate")] private static void OnLateUpdate(GrabbableObject __instance) { //IL_0092: 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 || ((INetworkBoomboxItem)__instance).AdditionalNetworking_Changed) { return; } ((INetworkBoomboxItem)__instance).AdditionalNetworking_Changed = 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.LogError((object)$"Exception during networking of {keyForItem2}({((NetworkBehaviour)__instance).NetworkObjectId}): {arg}"); } } } } [HarmonyPatch] internal class NutcrackerEnemyAiPatch { [HarmonyFinalizer] [HarmonyPatch(typeof(NutcrackerEnemyAI), "ReloadGunClientRpc")] private static void OnReload(NutcrackerEnemyAI __instance) { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)(object)__instance).IsRPCClientStage() || !((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.LogError((object)$"Exception during networking of {keyForItem2}({((NetworkBehaviour)__instance).NetworkObjectId}): {arg}"); } } } [HarmonyPatch] internal class PlayerControllerBPatch { [HarmonyPrefix] [HarmonyPatch(typeof(PlayerControllerB), "GrabObjectServerRpc")] private static void OnGrabRequest(PlayerControllerB __instance) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)(object)__instance).IsRPCServerStage()) { GrabbableObject currentlyGrabbingObject = __instance.currentlyGrabbingObject; if (Object.op_Implicit((Object)(object)currentlyGrabbingObject) && currentlyGrabbingObject is ShotgunItem) { Shotgun.RequestSyncServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)__instance.currentlyGrabbingObject).NetworkObject)); } } } } [HarmonyPatch] internal class ShotgunItemPatch { [HarmonyPrefix] [HarmonyPatch(typeof(ShotgunItem), "Start")] private static void OnStart(ShotgunItem __instance) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) if (!AdditionalNetworking.PluginConfig.ItemState.Shotgun.Value || ((NetworkBehaviour)__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.LogError((object)$"Exception during networking of {keyForItem2}({((NetworkBehaviour)__instance).NetworkObjectId}): {arg}"); } } [HarmonyFinalizer] [HarmonyPatch(typeof(ShotgunItem), "ReloadGunEffectsServerRpc")] private static void OnAmmoReload(ShotgunItem __instance, bool start) { if (AdditionalNetworking.PluginConfig.ItemState.Shotgun.Value && !start && ((NetworkBehaviour)__instance).IsOwner) { ((INetworkShotgunItem)__instance).AdditionalNetworking_AmmoCountChanged = true; } } [HarmonyFinalizer] [HarmonyPatch(typeof(ShotgunItem), "ShootGun")] private static void OnShot(ShotgunItem __instance) { if (AdditionalNetworking.PluginConfig.ItemState.Shotgun.Value && ((NetworkBehaviour)__instance).IsOwner) { ((INetworkShotgunItem)__instance).AdditionalNetworking_AmmoCountChanged = true; } } [HarmonyFinalizer] [HarmonyPatch(typeof(ShotgunItem), "ItemInteractLeftRight")] private static void OnSafetyToggle(ShotgunItem __instance, bool right) { if (AdditionalNetworking.PluginConfig.ItemState.Shotgun.Value && ((NetworkBehaviour)__instance).IsOwner) { ((INetworkShotgunItem)__instance).AdditionalNetworking_SafetyChanged = true; } } [HarmonyFinalizer] [HarmonyPatch(typeof(GrabbableObject), "LateUpdate")] private static void OnLateUpdate(GrabbableObject __instance) { //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) 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 (((INetworkShotgunItem)__instance).AdditionalNetworking_AmmoCountChanged) { ((INetworkShotgunItem)__instance).AdditionalNetworking_AmmoCountChanged = 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.LogError((object)$"Exception during networking of {keyForItem2}({((NetworkBehaviour)__instance).NetworkObjectId}): {arg}"); } } } if (!((INetworkShotgunItem)__instance).AdditionalNetworking_SafetyChanged) { return; } ((INetworkShotgunItem)__instance).AdditionalNetworking_SafetyChanged = 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.LogError((object)$"Exception during networking of {keyForItem3}({((NetworkBehaviour)__instance).NetworkObjectId}): {arg2}"); } } } } namespace AdditionalNetworking.Patches.Inventory { [HarmonyPatch] internal class PlayerControllerBPatch { [HarmonyPrefix] [HarmonyPatch(typeof(PlayerControllerB), "Start")] private static void OnStart(PlayerControllerB __instance) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (!AdditionalNetworking.PluginConfig.Misc.Username.Value || ((NetworkBehaviour)__instance).IsServer) { return; } try { PlayerController.RequestSyncUsernameServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)__instance).NetworkObject)); } catch (Exception arg) { AdditionalNetworking.Log.LogError((object)$"Exception during networking of {__instance.playerUsername}({((NetworkBehaviour)__instance).NetworkObjectId}): {arg}"); } } [HarmonyFinalizer] [HarmonyPatch(typeof(PlayerControllerB), "SwitchToItemSlot")] private static void OnSlotChange(PlayerControllerB __instance, int slot) { if (AdditionalNetworking.PluginConfig.Inventory.SlotChange.Value && ((NetworkBehaviour)__instance).IsOwner) { ((INetworkPlayerControllerB)__instance).AdditionalNetworking_SlotChanged = true; } } [HarmonyFinalizer] [HarmonyPatch(typeof(PlayerControllerB), "GrabObjectClientRpc")] private static void OnItemGrabbed(PlayerControllerB __instance, bool grabValidated) { if (((NetworkBehaviour)(object)__instance).IsRPCClientStage() && AdditionalNetworking.PluginConfig.Inventory.InventoryChange.Value && ((NetworkBehaviour)__instance).IsOwner && grabValidated) { ((INetworkPlayerControllerB)__instance).AdditionalNetworking_InventoryChanged = true; } } [HarmonyFinalizer] [HarmonyPatch(typeof(PlayerControllerB), "DiscardHeldObject")] private static void OnDiscardItem(PlayerControllerB __instance) { if (AdditionalNetworking.PluginConfig.Inventory.InventoryChange.Value && ((NetworkBehaviour)__instance).IsOwner) { ((INetworkPlayerControllerB)__instance).AdditionalNetworking_InventoryChanged = true; } } [HarmonyFinalizer] [HarmonyPatch(typeof(PlayerControllerB), "DropAllHeldItems")] private static void OnDropItem(PlayerControllerB __instance) { if (AdditionalNetworking.PluginConfig.Inventory.InventoryChange.Value && ((NetworkBehaviour)__instance).IsOwner) { ((INetworkPlayerControllerB)__instance).AdditionalNetworking_InventoryChanged = true; } } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] private static void OnPlayerConnected(PlayerControllerB __instance) { //IL_0025: 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 during networking of {__instance.playerUsername}({((NetworkBehaviour)__instance).NetworkObjectId}):\n{arg}"); } } [HarmonyFinalizer] [HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")] private static void OnLateUpdate(PlayerControllerB __instance) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) if (((INetworkPlayerControllerB)__instance).AdditionalNetworking_SlotChanged) { ((INetworkPlayerControllerB)__instance).AdditionalNetworking_SlotChanged = false; if (((NetworkBehaviour)__instance).IsOwner) { try { PlayerController.SyncSelectedSlotServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)__instance).NetworkObject), __instance.currentItemSlot); } catch (Exception arg) { AdditionalNetworking.Log.LogFatal((object)$"Exception during networking of {__instance.playerUsername}({((NetworkBehaviour)__instance).NetworkObjectId}):\n{arg}"); } } } if (!((INetworkPlayerControllerB)__instance).AdditionalNetworking_InventoryChanged) { return; } ((INetworkPlayerControllerB)__instance).AdditionalNetworking_InventoryChanged = false; if (!((NetworkBehaviour)__instance).IsOwner) { return; } 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), NetworkObjectReference.op_Implicit(Object.op_Implicit((Object)(object)__instance.ItemOnlySlot) ? ((NetworkBehaviour)__instance.ItemOnlySlot).NetworkObject : null), list.ToArray(), list2.ToArray()); } catch (Exception arg2) { AdditionalNetworking.Log.LogFatal((object)$"Exception during networking of {__instance.playerUsername}({((NetworkBehaviour)__instance).NetworkObjectId}):\n{arg2}"); } } finally { ((IDisposable)val2).Dispose(); } } finally { ((IDisposable)val).Dispose(); } } } } 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsServer) { return; } try { 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); } } catch (Exception arg) { AdditionalNetworking.Log.LogError((object)$"Exception during networking: {arg}"); } } 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_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_0044: Unknown result type (might be due to invalid IL or missing references) if (senderId != 0L) { return; } try { 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)) { 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(); } } } catch (Exception arg) { AdditionalNetworking.Log.LogError((object)$"Exception during networking: {arg}"); } } 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsServer) { return; } try { 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 }); } } catch (Exception arg) { AdditionalNetworking.Log.LogError((object)$"Exception during networking: {arg}"); } } } 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); } internal static void UnregisterMessages() { NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler(SyncStateServerRpcMessage); NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler(SyncStateClientRpcMessage); NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler(RequestSyncServerRpcMessage); } 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsServer) { return; } try { 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); } } catch (Exception arg) { AdditionalNetworking.Log.LogError((object)$"Exception during networking: {arg}"); } } 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_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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (senderId != 0L) { return; } try { 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)) { 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(); } } catch (Exception arg) { AdditionalNetworking.Log.LogError((object)$"Exception during networking: {arg}"); } } 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_004e: 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; } try { 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 }); } } catch (Exception arg) { AdditionalNetworking.Log.LogError((object)$"Exception during networking: {arg}"); } } } public static class GrabbableObject { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnSyncValuesClientRpc; public static HandleNamedMessageDelegate <1>__OnRequestSyncServerRpc; public static HandleNamedMessageDelegate <2>__OnSyncMultipleValuesClientRpc; public static HandleNamedMessageDelegate <3>__OnMarkValuablesSyncedClientRpc; } private static readonly string BaseName = typeof(GrabbableObject).FullName; private static readonly string SyncValuesClientRpcMessage = BaseName + "|SyncValuesClientRpc"; private static readonly string RequestSyncServerRpcMessage = BaseName + "|RequestSyncServerRpc"; private static readonly string SyncMultipleValuesClientRpcMessage = BaseName + "|SyncMultipleValuesClientRpc"; private static readonly string MarkValuablesSyncedClientRpcMessage = BaseName + "|MarkValuablesSyncedClientRpc"; 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 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); CustomMessagingManager customMessagingManager3 = NetworkManager.Singleton.CustomMessagingManager; string syncMultipleValuesClientRpcMessage = SyncMultipleValuesClientRpcMessage; object obj3 = <>O.<2>__OnSyncMultipleValuesClientRpc; if (obj3 == null) { HandleNamedMessageDelegate val3 = OnSyncMultipleValuesClientRpc; <>O.<2>__OnSyncMultipleValuesClientRpc = val3; obj3 = (object)val3; } customMessagingManager3.RegisterNamedMessageHandler(syncMultipleValuesClientRpcMessage, (HandleNamedMessageDelegate)obj3); CustomMessagingManager customMessagingManager4 = NetworkManager.Singleton.CustomMessagingManager; string markValuablesSyncedClientRpcMessage = MarkValuablesSyncedClientRpcMessage; object obj4 = <>O.<3>__OnMarkValuablesSyncedClientRpc; if (obj4 == null) { HandleNamedMessageDelegate val4 = OnMarkValuablesSyncedClientRpc; <>O.<3>__OnMarkValuablesSyncedClientRpc = val4; obj4 = (object)val4; } customMessagingManager4.RegisterNamedMessageHandler(markValuablesSyncedClientRpcMessage, (HandleNamedMessageDelegate)obj4); } internal static void UnregisterMessages() { NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler(SyncValuesClientRpcMessage); NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler(RequestSyncServerRpcMessage); NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler(SyncMultipleValuesClientRpcMessage); NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler(MarkValuablesSyncedClientRpcMessage); } private static void SyncValuesClientRpc(in GrabbableDataHolder grabbableItem, ulong[] targets = null) { //IL_000e: 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) //IL_002c: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(1024, (Allocator)2, -1); val.WriteGrabbableDataHolder(grabbableItem); 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_000b: 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_0025: 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) if (senderId != 0L) { return; } try { data.ReadGrabbableDataHolder(out var data2); GrabbableDataHolder grabbableDataHolder = data2; var (grabbableReference, scrapValue, dataValue) = (GrabbableDataHolder)(ref grabbableDataHolder); NetworkObject val2 = default(NetworkObject); if (((NetworkObjectReference)(ref grabbableReference)).TryGet(ref val2, (NetworkManager)null)) { GrabbableObject grabbableObject = NetworkObjectReference.op_Implicit(grabbableReference).GetComponent<GrabbableObject>(); string itemTag = ItemCategory.GetKeyForItem(grabbableObject.itemProperties); AdditionalNetworking.VerboseLog((LogLevel)32, () => string.Format("{0}.OnSyncValuesClientRpc was called for {1}! ItemTag: {2} scrap: {3}, data: {4}", "GrabbableObject", ((NetworkObjectReference)(ref grabbableReference)).NetworkObjectId, itemTag, scrapValue, dataValue)); SyncSingleItem(in grabbableObject, in itemTag, in scrapValue, in dataValue); ((INetworkGrabbableObject)grabbableObject).AdditionalNetworking_RequestedSync = false; } } catch (Exception arg) { AdditionalNetworking.Log.LogError((object)$"Exception during networking: {arg}"); } } private static void SyncSingleItem(in GrabbableObject grabbableObject, in string itemTag, in int scrapValue, in int dataValue) { if (grabbableObject.itemProperties.saveItemVariable) { grabbableObject.LoadItemSaveData(dataValue); } GrabbableObject obj = grabbableObject; GiftBoxItem val = (GiftBoxItem)(object)((obj is GiftBoxItem) ? obj : null); if (val != null) { val.loadedItemFromSave = false; } if (grabbableObject.itemProperties.isScrap) { if (AdditionalNetworking.PluginConfig.Value.IgnoreScanNodesList.Contains(itemTag)) { grabbableObject.scrapValue = scrapValue; ((INetworkGrabbableObject)grabbableObject).AdditionalNetworking_IsInitialized = true; } else { grabbableObject.SetScrapValue(scrapValue); } } } 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_004e: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsServer) { return; } try { 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>(); GrabbableDataHolder grabbableItem = new GrabbableDataHolder(component); SyncValuesClientRpc(in grabbableItem, new ulong[1] { senderId }); } } catch (Exception arg) { AdditionalNetworking.Log.LogError((object)$"Exception during networking: {arg}"); } } internal static void SyncMultipleValuesClientRpc(in GrabbableDataHolder[] grabbableItems, ulong[] targets = null) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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) int grabbableDataHolderSize = GrabbableDataHolderSerializer.GrabbableDataHolderSize; int num = FastBufferWriter.GetWriteSize<int>() + grabbableDataHolderSize * grabbableItems.Length; if (num > NetworkManager.Singleton.MaximumFragmentedMessageSize) { AdditionalNetworking.Log.LogFatal((object)"SyncMultipleValuesClientRpc: grabbableItems array is too big!"); return; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(num, (Allocator)2, -1); val.WriteGrabbableDataHolderArray(grabbableItems); if (targets == null) { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll(SyncMultipleValuesClientRpcMessage, val, (NetworkDelivery)4); } else { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(SyncMultipleValuesClientRpcMessage, (IReadOnlyList<ulong>)targets, val, (NetworkDelivery)4); } } private static void OnSyncMultipleValuesClientRpc(ulong senderId, FastBufferReader data) { //IL_0005: 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_0035: Unknown result type (might be due to invalid IL or missing references) if (senderId != 0L) { return; } try { data.ReadGrabbableDataHolderArray(out var dataArray); GrabbableDataHolder[] array = dataArray; NetworkObject val2 = default(NetworkObject); for (int i = 0; i < array.Length; i++) { GrabbableDataHolder grabbableDataHolder = array[i]; var (grabbableReference, scrapValue, dataValue) = (GrabbableDataHolder)(ref grabbableDataHolder); if (!((NetworkObjectReference)(ref grabbableReference)).TryGet(ref val2, (NetworkManager)null)) { break; } GrabbableObject grabbableObject = ((Component)val2).GetComponent<GrabbableObject>(); string itemTag = ItemCategory.GetKeyForItem(grabbableObject.itemProperties); AdditionalNetworking.VerboseLog((LogLevel)32, () => string.Format("{0}.SyncMultipleValuesClientRpc was called for {1}! ItemTag: {2} isScrap:{3}, value: {4}, hasData:{5}, data: {6}", "GrabbableObject", ((NetworkObjectReference)(ref grabbableReference)).NetworkObjectId, itemTag, grabbableObject.itemProperties.isScrap, scrapValue, grabbableObject.itemProperties.saveItemVariable, dataValue)); SyncSingleItem(in grabbableObject, in itemTag, in scrapValue, in dataValue); } } catch (Exception arg) { AdditionalNetworking.Log.LogError((object)$"Exception during networking: {arg}"); } } internal static void MarkValuablesSyncedClientRpc(ulong[] targets = null) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(0, (Allocator)2, -1); if (targets == null) { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll(MarkValuablesSyncedClientRpcMessage, val, (NetworkDelivery)3); } else { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(MarkValuablesSyncedClientRpcMessage, (IReadOnlyList<ulong>)targets, val, (NetworkDelivery)3); } } private static void OnMarkValuablesSyncedClientRpc(ulong senderId, FastBufferReader data) { if (senderId != 0L) { return; } try { AdditionalNetworking.VerboseLog((LogLevel)32, () => "GrabbableObject.MarkValuablesSyncedClientRpc was called!"); ((INetworkStartOfRound)StartOfRound.Instance).AdditionalNetworking_ValuablesSynced = true; } catch (Exception arg) { AdditionalNetworking.Log.LogError((object)$"Exception during networking: {arg}"); } } } 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>__OnSyncUsernameServerRpc; public static HandleNamedMessageDelegate <6>__OnSyncUsernameClientRpc; public static HandleNamedMessageDelegate <7>__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 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 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 syncUsernameServerRpcMessage = SyncUsernameServerRpcMessage; object obj6 = <>O.<5>__OnSyncUsernameServerRpc; if (obj6 == null) { HandleNamedMessageDelegate val6 = OnSyncUsernameServerRpc; <>O.<5>__OnSyncUsernameServerRpc = val6; obj6 = (object)val6; } customMessagingManager6.RegisterNamedMessageHandler(syncUsernameServerRpcMessage, (HandleNamedMessageDelegate)obj6); CustomMessagingManager customMessagingManager7 = NetworkManager.Singleton.CustomMessagingManager; string syncUsernameClientRpcMessage = SyncUsernameClientRpcMessage; object obj7 = <>O.<6>__OnSyncUsernameClientRpc; if (obj7 == null) { HandleNamedMessageDelegate val7 = OnSyncUsernameClientRpc; <>O.<6>__OnSyncUsernameClientRpc = val7; obj7 = (object)val7; } customMessagingManager7.RegisterNamedMessageHandler(syncUsernameClientRpcMessage, (HandleNamedMessageDelegate)obj7); CustomMessagingManager customMessagingManager8 = NetworkManager.Singleton.CustomMessagingManager; string requestSyncUsernameServerRpcMessage = RequestSyncUsernameServerRpcMessage; object obj8 = <>O.<7>__OnRequestSyncUsernameServerRpc; if (obj8 == null) { HandleNamedMessageDelegate val8 = OnRequestSyncUsernameServerRpc; <>O.<7>__OnRequestSyncUsernameServerRpc = val8; obj8 = (object)val8; } customMessagingManager8.RegisterNamedMessageHandler(requestSyncUsernameServerRpcMessage, (HandleNamedMessageDelegate)obj8); } internal static void UnregisterMessages() { NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler(SyncInventoryServerRpcMessage); NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler(SyncInventoryClientRpcMessage); NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler(ThrowExtraItemsClientRpcMessage); NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler(SyncSelectedSlotServerRpcMessage); NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler(SyncSelectedSlotClientRpcMessage); NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler(SyncUsernameServerRpcMessage); NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler(SyncUsernameClientRpcMessage); NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler(RequestSyncUsernameServerRpcMessage); } public static void SyncInventoryServerRpc(NetworkObjectReference controllerReference, NetworkObjectReference toolSlot, NetworkObjectReference[] inventory, int[] slots) { //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 controllerReference); ((FastBufferWriter)(ref val)).WriteNetworkSerializable<NetworkObjectReference>(ref toolSlot); ((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_0039: 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) //IL_0079: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsServer) { return; } try { NetworkObjectReference controllerReference = default(NetworkObjectReference); ((FastBufferReader)(ref data)).ReadNetworkSerializable<NetworkObjectReference>(ref controllerReference); NetworkObjectReference toolSlot = default(NetworkObjectReference); ((FastBufferReader)(ref data)).ReadNetworkSerializable<NetworkObjectReference>(ref toolSlot); 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, toolSlot, list.ToArray(), list2.ToArray()); if (list3.Count > 0) { ThrowExtraItemsClientRpc(controllerReference, list3.ToArray(), new ulong[1] { senderId }); } } catch (Exception arg) { AdditionalNetworking.Log.LogError((object)$"Exception during networking: {arg}"); } } private static void SyncInventoryClientRpc(NetworkObjectReference controllerReference, NetworkObjectReference toolSlot, NetworkObjectReference[] inventory, int[] slots, ulong[] targets = null) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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>(ref toolSlot); ((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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_00ad: Unknown result type (might be due to invalid IL or missing references) if (senderId != 0L) { return; } try { NetworkObjectReference controllerReference = default(NetworkObjectReference); ((FastBufferReader)(ref data)).ReadNetworkSerializable<NetworkObjectReference>(ref controllerReference); NetworkObjectReference val = default(NetworkObjectReference); ((FastBufferReader)(ref data)).ReadNetworkSerializable<NetworkObjectReference>(ref val); 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 val2 = default(NetworkObject); if (!((NetworkObjectReference)(ref controllerReference)).TryGet(ref val2, (NetworkManager)null)) { 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 val4 = default(NetworkObject); GrabbableObject val5 = default(GrabbableObject); for (int i = 0; i < array.Length; i++) { int num = array2[i]; NetworkObjectReference val3 = array[i]; if (num < component.ItemSlots.Length) { if (((NetworkObjectReference)(ref val3)).TryGet(ref val4, (NetworkManager)null) && ((Component)val4).TryGetComponent<GrabbableObject>(ref val5)) { component.ItemSlots[num] = val5; } else { component.ItemSlots[num] = null; } } } NetworkObject val6 = default(NetworkObject); GrabbableObject itemOnlySlot = default(GrabbableObject); if (((NetworkObjectReference)(ref val)).TryGet(ref val6, (NetworkManager)null) && ((Component)val6).TryGetComponent<GrabbableObject>(ref itemOnlySlot)) { component.ItemOnlySlot = itemOnlySlot; } else { component.ItemOnlySlot = null; } GrabbableObject val7 = ((component.currentItemSlot == 50) ? component.ItemOnlySlot : component.ItemSlots[component.currentItemSlot]); if ((Object)(object)component.currentlyHeldObjectServer != (Object)(object)val7) { component.SwitchToItemSlot(component.currentItemSlot, (GrabbableObject)null); } } catch (Exception arg) { AdditionalNetworking.Log.LogError((object)$"Exception during networking: {arg}"); } } 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) if (senderId != 0L) { return; } try { 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)) { 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); } } } catch (Exception arg) { AdditionalNetworking.Log.LogError((object)$"Exception during networking: {arg}"); } } 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsServer) { return; } try { NetworkObjectReference control