Decompiled source of WesleysInteriorsAddon v1.0.1

com.github.zehsteam.WesleysInteriorsAddon.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using DunGen;
using HarmonyLib;
using LethalLevelLoader;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using com.github.zehsteam.WesleysInteriorsAddon.MonoBehaviours;
using com.github.zehsteam.WesleysInteriorsAddon.NetcodePatcher;
using com.github.zehsteam.WesleysInteriorsAddon.Patches;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.github.zehsteam.WesleysInteriorsAddon")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+716d7997cd3c3a73186099da3e13b87a4ed39f8e")]
[assembly: AssemblyProduct("WesleysInteriorsAddon")]
[assembly: AssemblyTitle("com.github.zehsteam.WesleysInteriorsAddon")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace com.github.zehsteam.WesleysInteriorsAddon
{
	internal class ConfigManager
	{
		private ConfigEntry<bool> ExtendedLoggingCfg;

		private ConfigEntry<float> ToystoreNutcrackerMinInitialActivateTimeCfg;

		private ConfigEntry<float> ToystoreNutcrackerMaxInitialActivateTimeCfg;

		private ConfigEntry<float> ToystoreNutcrackerMinActivateTimeCfg;

		private ConfigEntry<float> ToystoreNutcrackerMaxActivateTimeCfg;

		internal bool ExtendedLogging
		{
			get
			{
				return ExtendedLoggingCfg.Value;
			}
			set
			{
				ExtendedLoggingCfg.Value = value;
			}
		}

		internal float ToystoreNutcrackerMinInitialActivateTime
		{
			get
			{
				return ToystoreNutcrackerMinInitialActivateTimeCfg.Value;
			}
			set
			{
				ToystoreNutcrackerMinInitialActivateTimeCfg.Value = value;
			}
		}

		internal float ToystoreNutcrackerMaxInitialActivateTime
		{
			get
			{
				return ToystoreNutcrackerMaxInitialActivateTimeCfg.Value;
			}
			set
			{
				ToystoreNutcrackerMaxInitialActivateTimeCfg.Value = value;
			}
		}

		internal float ToystoreNutcrackerMinActivateTime
		{
			get
			{
				return ToystoreNutcrackerMinActivateTimeCfg.Value;
			}
			set
			{
				ToystoreNutcrackerMinActivateTimeCfg.Value = value;
			}
		}

		internal float ToystoreNutcrackerMaxActivateTime
		{
			get
			{
				return ToystoreNutcrackerMaxActivateTimeCfg.Value;
			}
			set
			{
				ToystoreNutcrackerMaxActivateTimeCfg.Value = value;
			}
		}

		public ConfigManager()
		{
			BindConfigs();
			ClearUnusedEntries();
		}

		private void BindConfigs()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0033: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_0063: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			//IL_0093: Expected O, but got Unknown
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Expected O, but got Unknown
			//IL_00c3: Expected O, but got Unknown
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_00f3: Expected O, but got Unknown
			ConfigFile config = ((BaseUnityPlugin)Plugin.Instance).Config;
			ExtendedLoggingCfg = config.Bind<bool>(new ConfigDefinition("General Settings", "ExtendedLogging"), false, new ConfigDescription("Enable extended logging.", (AcceptableValueBase)null, Array.Empty<object>()));
			ToystoreNutcrackerMinInitialActivateTimeCfg = config.Bind<float>(new ConfigDefinition("Toystore Settings", "ToystoreNutcrackerMinInitialActivateTime"), 15f, new ConfigDescription("The minimum amount of time in seconds before the Nutcrackers start activating. (After pulling the apparatus)", (AcceptableValueBase)null, Array.Empty<object>()));
			ToystoreNutcrackerMaxInitialActivateTimeCfg = config.Bind<float>(new ConfigDefinition("Toystore Settings", "ToystoreNutcrackerMaxInitialActivateTime"), 30f, new ConfigDescription("The maximum amount of time in seconds before the Nutcrackers start activating. (After pulling the apparatus)", (AcceptableValueBase)null, Array.Empty<object>()));
			ToystoreNutcrackerMinActivateTimeCfg = config.Bind<float>(new ConfigDefinition("Toystore Settings", "ToystoreNutcrackerMinActivateTime"), 7.5f, new ConfigDescription("The minimum amount of time in seconds between Nutcracker activation. (After pulling the apparatus)", (AcceptableValueBase)null, Array.Empty<object>()));
			ToystoreNutcrackerMaxActivateTimeCfg = config.Bind<float>(new ConfigDefinition("Toystore Settings", "ToystoreNutcrackerMaxActivateTime"), 15f, new ConfigDescription("The maximum amount of time in seconds between Nutcracker activation. (After pulling the apparatus)", (AcceptableValueBase)null, Array.Empty<object>()));
		}

		private void ClearUnusedEntries()
		{
			ConfigFile config = ((BaseUnityPlugin)Plugin.Instance).Config;
			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();
		}
	}
	internal class Content
	{
		public static GameObject networkHandlerPrefab;

		public static void Load()
		{
			LoadAssetsFromAssetBundle();
		}

		private static void LoadAssetsFromAssetBundle()
		{
			try
			{
				string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)Plugin.Instance).Info.Location);
				string text = Path.Combine(directoryName, "wesleysinteriorsaddon_assets");
				AssetBundle val = AssetBundle.LoadFromFile(text);
				networkHandlerPrefab = val.LoadAsset<GameObject>("NetworkHandler");
				networkHandlerPrefab.AddComponent<PluginNetworkBehaviour>();
				Plugin.logger.LogInfo((object)"Successfully loaded assets from AssetBundle!");
			}
			catch (Exception arg)
			{
				Plugin.logger.LogError((object)$"Error: failed to load assets from AssetBundle.\n\n{arg}");
			}
		}
	}
	internal class EnemyHelper
	{
		public static void SpawnNutcrackerOnServer(Vector3 position, float yRot)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.IsHostOrServer)
			{
				Plugin.logger.LogError((object)"[EnemyHelper] Only the host can spawn enemies.");
			}
			else
			{
				SpawnEnemyOnServer("Nutcracker", position, yRot);
			}
		}

		public static void SpawnEnemyOnServer(string enemyName, Vector3 position, float yRot)
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.IsHostOrServer)
			{
				Plugin.logger.LogError((object)"[EnemyHelper] Only the host can spawn enemies.");
				return;
			}
			EnemyType enemyType = GetEnemyType(enemyName);
			if ((Object)(object)enemyType == (Object)null)
			{
				Plugin.logger.LogError((object)("[EnemyHelper] Failed to find EnemyType \"" + enemyName + "\"."));
				return;
			}
			RoundManager.Instance.SpawnEnemyGameObject(position, yRot, -1, enemyType);
			Plugin.Instance.LogInfoExtended($"[EnemyHelper] Spawned \"{enemyType.enemyName}\" at position: ({position.x}, {position.y}, {position.z}), yRot: {yRot}");
		}

		public static EnemyType GetEnemyType(string enemyName)
		{
			foreach (EnemyType allEnemyType in GetAllEnemyTypes())
			{
				if (allEnemyType.enemyName == enemyName)
				{
					return allEnemyType;
				}
			}
			return null;
		}

		private static List<EnemyType> GetAllEnemyTypes()
		{
			List<EnemyType> list = new List<EnemyType>();
			SelectableLevel[] levels = StartOfRound.Instance.levels;
			foreach (SelectableLevel val in levels)
			{
				list.AddRange(val.Enemies.Select((SpawnableEnemyWithRarity _) => _.enemyType));
				list.AddRange(val.DaytimeEnemies.Select((SpawnableEnemyWithRarity _) => _.enemyType));
				list.AddRange(val.OutsideEnemies.Select((SpawnableEnemyWithRarity _) => _.enemyType));
			}
			return list.Distinct().ToList();
		}
	}
	internal class InteriorHelper
	{
		public static string GetDungeonName()
		{
			string dungeonName;
			return TryGetDungeonName(out dungeonName) ? dungeonName : string.Empty;
		}

		public static bool TryGetDungeonName(out string dungeonName)
		{
			dungeonName = string.Empty;
			try
			{
				ExtendedDungeonFlow currentExtendedDungeonFlow = DungeonManager.CurrentExtendedDungeonFlow;
				if ((Object)(object)currentExtendedDungeonFlow == (Object)null)
				{
					return false;
				}
				dungeonName = currentExtendedDungeonFlow.DungeonName;
				return true;
			}
			catch
			{
				Plugin.logger.LogError((object)"[InteriorHelper] Failed to get dungeon name.");
				return false;
			}
		}

		public static bool IsToystoreInterior()
		{
			string dungeonName = GetDungeonName();
			if (dungeonName.Equals("ToystoreFlow", StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (dungeonName.Equals("Toy Store", StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			return false;
		}
	}
	[BepInPlugin("com.github.zehsteam.WesleysInteriorsAddon", "WesleysInteriorsAddon", "1.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	internal class Plugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("com.github.zehsteam.WesleysInteriorsAddon");

		internal static Plugin Instance;

		internal static ManualLogSource logger;

		internal static ConfigManager ConfigManager;

		public static bool IsHostOrServer => NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			logger = Logger.CreateLogSource("com.github.zehsteam.WesleysInteriorsAddon");
			logger.LogInfo((object)"WesleysInteriorsAddon has awoken!");
			harmony.PatchAll(typeof(GameNetworkManagerPatch));
			harmony.PatchAll(typeof(StartOfRoundPatch));
			harmony.PatchAll(typeof(RoundManagerPatch));
			harmony.PatchAll(typeof(LungPropPatch));
			ConfigManager = new ConfigManager();
			Content.Load();
			NetcodePatcherAwake();
		}

		private void NetcodePatcherAwake()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}

		public void OnLocalDisconnect()
		{
			Toystore.Reset();
		}

		public void OnFinishGeneratingLevel()
		{
			Toystore.FindNutcrackerStatues();
		}

		public void OnShipHasLeft()
		{
			Toystore.Reset();
		}

		public void LogInfoExtended(object data)
		{
			if (ConfigManager.ExtendedLogging)
			{
				logger.LogInfo(data);
			}
		}
	}
	internal class Toystore
	{
		private static List<GameObject> nutcrackerObjects = new List<GameObject>();

		private static Coroutine activateNutcrackerStatuesCoroutine = null;

		public static void Reset()
		{
			nutcrackerObjects = new List<GameObject>();
			if (activateNutcrackerStatuesCoroutine != null)
			{
				((MonoBehaviour)StartOfRound.Instance).StopCoroutine(activateNutcrackerStatuesCoroutine);
			}
		}

		public static void FindNutcrackerStatues()
		{
			if (InteriorHelper.IsToystoreInterior())
			{
				nutcrackerObjects = GetNutcrackerStatues();
				Plugin.logger.LogInfo((object)$"[Toystore] Found {nutcrackerObjects.Count} Nutcracker statues.");
			}
		}

		public static void OnApparatusRemoved()
		{
			if (Plugin.IsHostOrServer && InteriorHelper.IsToystoreInterior())
			{
				Plugin.Instance.LogInfoExtended("[Toystore] Apparatus was pulled.");
				activateNutcrackerStatuesCoroutine = ((MonoBehaviour)StartOfRound.Instance).StartCoroutine(ActivateNutcrackerStatuesOnServer());
			}
		}

		private static IEnumerator ActivateNutcrackerStatuesOnServer()
		{
			if (Plugin.IsHostOrServer && nutcrackerObjects.Count != 0)
			{
				float minInitialActivateTime = Plugin.ConfigManager.ToystoreNutcrackerMinInitialActivateTime;
				float maxInitialActivateTime = Plugin.ConfigManager.ToystoreNutcrackerMaxInitialActivateTime;
				float minActivateTime = Plugin.ConfigManager.ToystoreNutcrackerMinActivateTime;
				float maxActivateTime = Plugin.ConfigManager.ToystoreNutcrackerMaxActivateTime;
				yield return (object)new WaitForSeconds(Random.Range(minInitialActivateTime, maxInitialActivateTime + 1f));
				Plugin.Instance.LogInfoExtended("[Toystore] Start activating Nutcrackers.");
				int amount = nutcrackerObjects.Count;
				for (int i = 0; i < amount; i++)
				{
					int index = Random.Range(0, nutcrackerObjects.Count);
					ActivateNutcrackerStatueOnServer(nutcrackerObjects[index]);
					nutcrackerObjects.RemoveAt(index);
					yield return (object)new WaitForSeconds(Random.Range(minActivateTime, maxActivateTime + 1f));
				}
			}
		}

		private static void ActivateNutcrackerStatueOnServer(GameObject nutcrackerObject)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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_0048: 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)
			if (Plugin.IsHostOrServer)
			{
				PluginNetworkBehaviour.Instance.HideNutcrackerStatueClientRpc(nutcrackerObject.transform.position);
				HideNutcrackerStatueOnLocalClient(nutcrackerObject.transform.position);
				Vector3 position = nutcrackerObject.transform.position;
				float y = nutcrackerObject.transform.eulerAngles.y;
				EnemyHelper.SpawnNutcrackerOnServer(position, y);
			}
		}

		public static void HideNutcrackerStatueOnLocalClient(Vector3 position)
		{
			//IL_0020: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = null;
			foreach (GameObject nutcrackerObject in nutcrackerObjects)
			{
				if (Vector3.Distance(nutcrackerObject.transform.position, position) <= 0.25f)
				{
					val = nutcrackerObject;
					break;
				}
			}
			if ((Object)(object)val == (Object)null)
			{
				Plugin.logger.LogError((object)$"[Toystore] Failed to hide Nutcracker statue. Could not find Nutcracker statue at position: ({position.x}, {position.y}, {position.z})");
			}
			else
			{
				val.SetActive(false);
			}
		}

		private static List<GameObject> GetNutcrackerStatues()
		{
			List<GameObject> list = new List<GameObject>();
			foreach (GameObject item in from _ in Object.FindObjectsByType<Tile>((FindObjectsSortMode)0)
				select ((Component)_).gameObject)
			{
				list.AddRange(GetNutcrackerStatuesInTile(item));
			}
			return list;
		}

		private static List<GameObject> GetNutcrackerStatuesInTile(GameObject tileObject)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			List<GameObject> list = new List<GameObject>();
			foreach (Transform item in from _ in tileObject.GetComponentsInChildren<LODGroup>()
				select ((Component)_).transform)
			{
				if (((Object)item).name.Contains("LOD0") && !(item.localScale != new Vector3(0.3f, 0.3f, 0.3f)))
				{
					list.Add(((Component)item).gameObject);
				}
			}
			return list;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "com.github.zehsteam.WesleysInteriorsAddon";

		public const string PLUGIN_NAME = "WesleysInteriorsAddon";

		public const string PLUGIN_VERSION = "1.0.1";
	}
}
namespace com.github.zehsteam.WesleysInteriorsAddon.Patches
{
	[HarmonyPatch(typeof(GameNetworkManager))]
	internal class GameNetworkManagerPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void StartPatch()
		{
			AddNetworkPrefabs();
		}

		private static void AddNetworkPrefabs()
		{
			AddNetworkPrefab(Content.networkHandlerPrefab);
		}

		private static void AddNetworkPrefab(GameObject prefab)
		{
			if (!((Object)(object)prefab == (Object)null))
			{
				NetworkManager.Singleton.AddNetworkPrefab(prefab);
				Plugin.logger.LogInfo((object)("Registered \"" + ((Object)prefab).name + "\" network prefab."));
			}
		}
	}
	[HarmonyPatch(typeof(LungProp))]
	internal class LungPropPatch
	{
		[HarmonyPatch("EquipItem")]
		[HarmonyPrefix]
		private static void EquipItemPatch(ref LungProp __instance)
		{
			if (__instance.isLungDocked)
			{
				Toystore.OnApparatusRemoved();
			}
		}
	}
	[HarmonyPatch(typeof(RoundManager))]
	internal class RoundManagerPatch
	{
		[HarmonyPatch("FinishGeneratingLevel")]
		[HarmonyPostfix]
		[HarmonyPriority(300)]
		private static void FinishGeneratingLevelPatch()
		{
			Plugin.Instance.OnFinishGeneratingLevel();
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void AwakePatch()
		{
			SpawnNetworkHandler();
		}

		private static void SpawnNetworkHandler()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.IsHostOrServer)
			{
				GameObject val = Object.Instantiate<GameObject>(Content.networkHandlerPrefab, Vector3.zero, Quaternion.identity);
				val.GetComponent<NetworkObject>().Spawn(false);
			}
		}

		[HarmonyPatch("OnLocalDisconnect")]
		[HarmonyPrefix]
		private static void OnLocalDisconnectPatch()
		{
			Plugin.Instance.OnLocalDisconnect();
		}

		[HarmonyPatch("ShipHasLeft")]
		[HarmonyPostfix]
		private static void ShipHasLeftPatch()
		{
			Plugin.Instance.OnShipHasLeft();
		}
	}
}
namespace com.github.zehsteam.WesleysInteriorsAddon.MonoBehaviours
{
	internal class PluginNetworkBehaviour : NetworkBehaviour
	{
		public static PluginNetworkBehaviour Instance;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
		}

		[ClientRpc]
		public void HideNutcrackerStatueClientRpc(Vector3 position)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1017602883u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1017602883u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !Plugin.IsHostOrServer)
				{
					Toystore.HideNutcrackerStatueOnLocalClient(position);
				}
			}
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_PluginNetworkBehaviour()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(1017602883u, new RpcReceiveHandler(__rpc_handler_1017602883));
		}

		private static void __rpc_handler_1017602883(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0036: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((PluginNetworkBehaviour)(object)target).HideNutcrackerStatueClientRpc(position);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "PluginNetworkBehaviour";
		}
	}
}
namespace com.github.zehsteam.WesleysInteriorsAddon.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}