Decompiled source of TakeyPlush v1.5.4

com.github.zehsteam.DontTouchMyClogs.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using DontTouchMyClogs;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Video;
using com.github.zehsteam.DontTouchMyClogs;
using com.github.zehsteam.DontTouchMyClogs.MonoBehaviours;
using com.github.zehsteam.DontTouchMyClogs.NetcodePatcher;

[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.DontTouchMyClogs")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Don't touch my clogs!")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2+b88df8f2c50f22471de78a4fb6ca452826f49cf6")]
[assembly: AssemblyProduct("DontTouchMyClogs")]
[assembly: AssemblyTitle("com.github.zehsteam.DontTouchMyClogs")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>();
	}
}
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 DontTouchMyClogs
{
	[BepInPlugin("com.github.zehsteam.DontTouchMyClogs", "DontTouchMyClogs", "1.0.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("com.github.zehsteam.DontTouchMyClogs");

		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.DontTouchMyClogs");
			logger.LogInfo((object)"DontTouchMyClogs has awoken!");
			ConfigManager = new ConfigManager();
			Content.Load();
			RegisterScrapItems();
			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);
					}
				}
			}
		}

		private void RegisterScrapItems()
		{
			int spawnWeight = ConfigManager.SpawnWeight;
			bool twoHanded = ConfigManager.TwoHanded;
			int carryWeight = ConfigManager.CarryWeight;
			int minValue = ConfigManager.MinValue;
			int maxValue = ConfigManager.MaxValue;
			ScrapHelper.RegisterScrap(Content.woodenClogs, spawnWeight, twoHanded, carryWeight, minValue, maxValue);
		}

		public void SpawnVideoPlayer()
		{
			//IL_0017: 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)
			if (!((Object)(object)VideoPlayerBehaviour.Instance != (Object)null))
			{
				Object.Instantiate<GameObject>(Content.videoPlayerPrefab, Vector3.zero, Quaternion.identity);
				logger.LogInfo((object)"Spawned video player.");
			}
		}
	}
}
namespace com.github.zehsteam.DontTouchMyClogs
{
	internal class ConfigManager
	{
		private ConfigEntry<int> SpawnWeightCfg;

		private ConfigEntry<bool> TwoHandedCfg;

		private ConfigEntry<int> CarryWeightCfg;

		private ConfigEntry<int> MinValueCfg;

		private ConfigEntry<int> MaxValueCfg;

		private ConfigEntry<float> VideoVolumeCfg;

		private ConfigEntry<bool> EnableMusicCfg;

		private ConfigEntry<float> MusicVolumeCfg;

		internal int SpawnWeight
		{
			get
			{
				return SpawnWeightCfg.Value;
			}
			set
			{
				SpawnWeightCfg.Value = value;
			}
		}

		internal bool TwoHanded
		{
			get
			{
				return TwoHandedCfg.Value;
			}
			set
			{
				TwoHandedCfg.Value = value;
			}
		}

		internal int CarryWeight
		{
			get
			{
				return CarryWeightCfg.Value;
			}
			set
			{
				CarryWeightCfg.Value = value;
			}
		}

		internal int MinValue
		{
			get
			{
				return MinValueCfg.Value;
			}
			set
			{
				MinValueCfg.Value = value;
			}
		}

		internal int MaxValue
		{
			get
			{
				return MaxValueCfg.Value;
			}
			set
			{
				MaxValueCfg.Value = value;
			}
		}

		internal float VideoVolume
		{
			get
			{
				return VideoVolumeCfg.Value;
			}
			set
			{
				VideoVolumeCfg.Value = value;
			}
		}

		internal bool EnableMusic
		{
			get
			{
				return EnableMusicCfg.Value;
			}
			set
			{
				EnableMusicCfg.Value = value;
			}
		}

		internal float MusicVolume
		{
			get
			{
				return MusicVolumeCfg.Value;
			}
			set
			{
				MusicVolumeCfg.Value = value;
			}
		}

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

		private void BindConfigs()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_003a: Expected O, but got Unknown
			//IL_004b: 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_0066: Expected O, but got Unknown
			//IL_0066: Expected O, but got Unknown
			//IL_0077: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			//IL_00c0: Expected O, but got Unknown
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			//IL_00f0: Expected O, but got Unknown
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Expected O, but got Unknown
			//IL_0120: Expected O, but got Unknown
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Expected O, but got Unknown
			//IL_014c: Expected O, but got Unknown
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Expected O, but got Unknown
			//IL_017c: Expected O, but got Unknown
			ConfigFile config = ((BaseUnityPlugin)Plugin.Instance).Config;
			SpawnWeightCfg = config.Bind<int>(new ConfigDefinition("General Settings", "SpawnWeight"), 5, new ConfigDescription("Wooden Clogs spawn chance weight. higher = more common.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			TwoHandedCfg = config.Bind<bool>(new ConfigDefinition("General Settings", "TwoHanded"), false, new ConfigDescription("If enabled, the Wooden Clogs will be two-handed.", (AcceptableValueBase)null, Array.Empty<object>()));
			CarryWeightCfg = config.Bind<int>(new ConfigDefinition("General Settings", "CarryWeight"), 10, new ConfigDescription("Wooden Clogs carry weight in pounds.", (AcceptableValueBase)null, Array.Empty<object>()));
			MinValueCfg = config.Bind<int>(new ConfigDefinition("General Settings", "MinValue"), 80, new ConfigDescription("Wooden Clogs min scrap value.", (AcceptableValueBase)null, Array.Empty<object>()));
			MaxValueCfg = config.Bind<int>(new ConfigDefinition("General Settings", "MaxValue"), 250, new ConfigDescription("Wooden Clogs max scrap value.", (AcceptableValueBase)null, Array.Empty<object>()));
			VideoVolumeCfg = config.Bind<float>(new ConfigDefinition("Karaoke Settings", "VideoVolume"), 0.75f, new ConfigDescription("The volume of the karaoke video. (0.0 to 1.0)", (AcceptableValueBase)null, Array.Empty<object>()));
			EnableMusicCfg = config.Bind<bool>(new ConfigDefinition("Music Settings", "EnableMusic"), false, new ConfigDescription("STREAMER WARNING! Music is DMCA.\nIf enabled, the music will be play. (This does not affect Karaoke)", (AcceptableValueBase)null, Array.Empty<object>()));
			MusicVolumeCfg = config.Bind<float>(new ConfigDefinition("Music Settings", "MusicVolume"), 1f, new ConfigDescription("The volume of the music. (0.0 to 1.0)", (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 Item woodenClogs;

		public static GameObject videoPlayerPrefab;

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

		private static void LoadAssetsFromAssetBundle()
		{
			try
			{
				string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)Plugin.Instance).Info.Location);
				string text = Path.Combine(directoryName, "donttouchmyclogs_assets");
				AssetBundle val = AssetBundle.LoadFromFile(text);
				woodenClogs = val.LoadAsset<Item>("WoodenClogs");
				videoPlayerPrefab = val.LoadAsset<GameObject>("VideoPlayer");
				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 ScrapHelper
	{
		public static void RegisterScrap(Item item, int iRarity, bool twoHanded, int carryWeight, int minValue, int maxValue)
		{
			item.twoHanded = twoHanded;
			item.weight = (float)carryWeight / 105f + 1f;
			item.minValue = minValue;
			item.maxValue = maxValue;
			Utilities.FixMixerGroups(item.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab);
			Items.RegisterScrap(item, iRarity, (LevelTypes)(-1));
			Plugin.logger.LogInfo((object)$"Registered \"{item.itemName}\" scrap item with {iRarity} rarity.");
		}
	}
	internal class Utils
	{
		public static PlayerControllerB GetLocalPlayerScript()
		{
			return GameNetworkManager.Instance.localPlayerController;
		}

		public static void DisplayNotification(string displayText)
		{
			HUDManager.Instance.globalNotificationAnimator.SetTrigger("TriggerNotif");
			((TMP_Text)HUDManager.Instance.globalNotificationText).text = displayText;
			HUDManager.Instance.UIAudio.PlayOneShot(HUDManager.Instance.globalNotificationSFX);
		}

		public static void DisplayTip(string headerText, string bodyText, bool isWarning = false)
		{
			((TMP_Text)HUDManager.Instance.tipsPanelHeader).text = headerText;
			((TMP_Text)HUDManager.Instance.tipsPanelBody).text = bodyText;
			if (isWarning)
			{
				HUDManager.Instance.tipsPanelAnimator.SetTrigger("TriggerWarning");
				RoundManager.PlayRandomClip(HUDManager.Instance.UIAudio, HUDManager.Instance.warningSFX, false, 1f, 0, 1000);
			}
			else
			{
				HUDManager.Instance.tipsPanelAnimator.SetTrigger("TriggerHint");
				RoundManager.PlayRandomClip(HUDManager.Instance.UIAudio, HUDManager.Instance.tipsSFX, false, 1f, 0, 1000);
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "com.github.zehsteam.DontTouchMyClogs";

		public const string PLUGIN_NAME = "DontTouchMyClogs";

		public const string PLUGIN_VERSION = "1.0.2";
	}
}
namespace com.github.zehsteam.DontTouchMyClogs.MonoBehaviours
{
	public class Clogs : NoisemakerProp
	{
		[Header("Clogs")]
		[Space(3f)]
		public AudioSource musicAudio = null;

		public AudioSource musicAudioFar = null;

		[HideInInspector]
		public NetworkVariable<bool> isMusicMode = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public bool isHeldByLocalPlayer => (Object)(object)((GrabbableObject)this).playerHeldBy == (Object)(object)Utils.GetLocalPlayerScript();

		public bool isPlayingVideo => (Object)(object)VideoPlayerBehaviour.Instance != (Object)null && VideoPlayerBehaviour.Instance.isPlaying;

		public bool isPlayingMusic => musicAudio.isPlaying;

		public override void OnNetworkSpawn()
		{
			NetworkVariable<bool> obj = isMusicMode;
			obj.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(OnIsMusicModeChanged));
		}

		public override void OnNetworkDespawn()
		{
			NetworkVariable<bool> obj = isMusicMode;
			obj.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Remove((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(OnIsMusicModeChanged));
		}

		public override void Start()
		{
			((NoisemakerProp)this).Start();
			float volume = Mathf.Clamp(Plugin.ConfigManager.MusicVolume, 0f, 1f);
			if (!Plugin.ConfigManager.EnableMusic)
			{
				musicAudio.mute = true;
				musicAudioFar.mute = true;
			}
			musicAudio.volume = volume;
			musicAudioFar.volume = volume;
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			if (isHeldByLocalPlayer)
			{
				SetIsMusicMode(!isMusicMode.Value);
			}
		}

		public override void DiscardItem()
		{
			if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
			{
				((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = false;
			}
			((GrabbableObject)this).isBeingUsed = false;
			((GrabbableObject)this).DiscardItem();
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = true;
			if (isHeldByLocalPlayer)
			{
				Plugin.Instance.SpawnVideoPlayer();
			}
		}

		public override void ItemInteractLeftRight(bool right)
		{
			((GrabbableObject)this).ItemInteractLeftRight(right);
			if (isHeldByLocalPlayer)
			{
				if (right)
				{
					ItemInteractRight();
				}
				else
				{
					ItemInteractLeft();
				}
			}
		}

		private void ItemInteractLeft()
		{
			if ((Object)(object)VideoPlayerBehaviour.Instance == (Object)null)
			{
				Plugin.logger.LogError((object)"Error: Failed to reset video. VideoPlayerBehaviour Instance does not exist.");
			}
			else if (isMusicMode.Value)
			{
				ResetMusic();
			}
			else
			{
				VideoPlayerBehaviour.Instance.ResetVideo();
			}
		}

		private void ItemInteractRight()
		{
			if ((Object)(object)VideoPlayerBehaviour.Instance == (Object)null)
			{
				Plugin.logger.LogError((object)"Error: Failed to play video. VideoPlayerBehaviour Instance does not exist.");
			}
			else if (isMusicMode.Value)
			{
				bool flag = !isPlayingMusic;
				if (Plugin.ConfigManager.EnableMusic)
				{
					SetIsPlayingMusic(flag);
				}
				else if (!flag)
				{
					SetIsPlayingMusic(flag);
				}
				else
				{
					Utils.DisplayTip("DontTouchMyClogs", "STREAMER WARNING! Music is DMCA.\n\nWooden Clogs - Music is disabled in the config settings.", isWarning: true);
				}
			}
			else
			{
				VideoPlayerBehaviour.Instance.ToggleVideoPlay();
				SetControlTips();
			}
		}

		public override void SetControlTipsForItem()
		{
			SetControlTips();
		}

		private void SetControlTips()
		{
			if (isHeldByLocalPlayer)
			{
				if (isMusicMode.Value)
				{
					SetMusicControlTips();
				}
				else
				{
					SetKaraokeControlTips();
				}
			}
		}

		private void SetKaraokeControlTips()
		{
			string[] toolTips = ((GrabbableObject)this).itemProperties.toolTips;
			if (toolTips.Length <= 2)
			{
				Plugin.logger.LogError((object)"Wooden Clogs control tips array length is too short to set tips!");
				return;
			}
			if (isPlayingVideo)
			{
				toolTips[1] = "Pause Karaoke : [E]";
			}
			else
			{
				toolTips[1] = "Play Karaoke : [E]";
			}
			toolTips[2] = "Reset Karaoke : [Q]";
			HUDManager.Instance.ChangeControlTipMultiple(toolTips, isHeldByLocalPlayer, ((GrabbableObject)this).itemProperties);
		}

		private void SetMusicControlTips()
		{
			string[] toolTips = ((GrabbableObject)this).itemProperties.toolTips;
			if (toolTips.Length <= 2)
			{
				Plugin.logger.LogError((object)"Wooden Clogs control tips array length is too short to set tips!");
				return;
			}
			if (isPlayingMusic)
			{
				toolTips[1] = "Pause Music : [E]";
			}
			else
			{
				toolTips[1] = "Play Music : [E]";
			}
			toolTips[2] = "Reset Music : [Q]";
			HUDManager.Instance.ChangeControlTipMultiple(toolTips, isHeldByLocalPlayer, ((GrabbableObject)this).itemProperties);
		}

		private void SetIsMusicMode(bool enabled)
		{
			if (enabled)
			{
				VideoPlayerBehaviour.Instance.PauseVideo();
			}
			if (Plugin.IsHostOrServer)
			{
				isMusicMode.Value = enabled;
			}
			else
			{
				SetIsMusicModeServerRpc(enabled);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void SetIsMusicModeServerRpc(bool enabled)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1438064405u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref enabled, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1438064405u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					isMusicMode.Value = enabled;
				}
			}
		}

		private void OnIsMusicModeChanged(bool previous, bool current)
		{
			if (Plugin.IsHostOrServer && !current && isPlayingMusic)
			{
				SetIsPlayingMusic(isPlaying: false);
			}
			SetControlTips();
		}

		private void SetIsPlayingMusic(bool isPlaying)
		{
			if (Plugin.IsHostOrServer)
			{
				SetIsPlayingMusicClientRpc(isPlaying);
			}
			else
			{
				SetIsPlayingMusicServerRpc(isPlaying);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void SetIsPlayingMusicServerRpc(bool isPlaying)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3353686090u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isPlaying, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3353686090u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					SetIsPlayingMusicClientRpc(isPlaying);
				}
			}
		}

		[ClientRpc]
		private void SetIsPlayingMusicClientRpc(bool isPlaying)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3874246350u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isPlaying, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3874246350u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (isPlaying)
				{
					musicAudio.Play();
					musicAudioFar.Play();
				}
				else
				{
					musicAudio.Pause();
					musicAudioFar.Pause();
				}
				SetControlTips();
			}
		}

		private void ResetMusic()
		{
			if (Plugin.IsHostOrServer)
			{
				ResetMusicClientRpc();
			}
			else
			{
				ResetMusicServerRpc();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void ResetMusicServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3729213853u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3729213853u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ResetMusicClientRpc();
				}
			}
		}

		[ClientRpc]
		private void ResetMusicClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3375189455u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3375189455u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					musicAudio.time = 0f;
					musicAudioFar.time = 0f;
				}
			}
		}

		protected override void __initializeVariables()
		{
			if (isMusicMode == null)
			{
				throw new Exception("Clogs.isMusicMode cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)isMusicMode).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)isMusicMode, "isMusicMode");
			((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)isMusicMode);
			((NoisemakerProp)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_Clogs()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(1438064405u, new RpcReceiveHandler(__rpc_handler_1438064405));
			NetworkManager.__rpc_func_table.Add(3353686090u, new RpcReceiveHandler(__rpc_handler_3353686090));
			NetworkManager.__rpc_func_table.Add(3874246350u, new RpcReceiveHandler(__rpc_handler_3874246350));
			NetworkManager.__rpc_func_table.Add(3729213853u, new RpcReceiveHandler(__rpc_handler_3729213853));
			NetworkManager.__rpc_func_table.Add(3375189455u, new RpcReceiveHandler(__rpc_handler_3375189455));
		}

		private static void __rpc_handler_1438064405(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool isMusicModeServerRpc = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isMusicModeServerRpc, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Clogs)(object)target).SetIsMusicModeServerRpc(isMusicModeServerRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3353686090(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool isPlayingMusicServerRpc = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isPlayingMusicServerRpc, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Clogs)(object)target).SetIsPlayingMusicServerRpc(isPlayingMusicServerRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3874246350(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool isPlayingMusicClientRpc = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isPlayingMusicClientRpc, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((Clogs)(object)target).SetIsPlayingMusicClientRpc(isPlayingMusicClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3729213853(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Clogs)(object)target).ResetMusicServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3375189455(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((Clogs)(object)target).ResetMusicClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "Clogs";
		}
	}
	public class VideoPlayerBehaviour : MonoBehaviour
	{
		public static VideoPlayerBehaviour Instance;

		public GameObject containerObject;

		public VideoPlayer videoPlayer;

		public bool isPlaying => videoPlayer.isPlaying;

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

		private void Start()
		{
			PauseVideo();
			ResetVideo();
			float num = Mathf.Clamp(Plugin.ConfigManager.VideoVolume, 0f, 1f);
			videoPlayer.SetDirectAudioVolume((ushort)0, num);
		}

		private void OnEnable()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			videoPlayer.loopPointReached += new EventHandler(OnVideoPlayerFinished);
		}

		private void OnDisable()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			videoPlayer.loopPointReached -= new EventHandler(OnVideoPlayerFinished);
		}

		private void OnVideoPlayerFinished(VideoPlayer source)
		{
			containerObject.SetActive(false);
			ResetVideo();
		}

		public void PlayVideo()
		{
			containerObject.SetActive(true);
			videoPlayer.Play();
		}

		public void PauseVideo()
		{
			containerObject.SetActive(false);
			videoPlayer.Pause();
		}

		public void ToggleVideoPlay()
		{
			if (isPlaying)
			{
				PauseVideo();
			}
			else
			{
				PlayVideo();
			}
		}

		public void ResetVideo()
		{
			videoPlayer.time = 0.75;
		}
	}
}
namespace com.github.zehsteam.DontTouchMyClogs.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}

com.github.zehsteam.TakeyGokuBracken.dll

Decompiled 2 weeks 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.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GokuBracken.Scripts;
using Hallucinoceps;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using com.github.zehsteam.TakeyGoku;
using com.github.zehsteam.TakeyGokuBracken.Compatibility;
using com.github.zehsteam.TakeyGokuBracken.MonoBehaviours;
using com.github.zehsteam.TakeyGokuBracken.NetcodePatcher;
using com.github.zehsteam.TakeyGokuBracken.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.TakeyGokuBracken")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Adds an easter egg when you have the GokuBracken mod installed.")]
[assembly: AssemblyFileVersion("1.1.2.0")]
[assembly: AssemblyInformationalVersion("1.1.2+6201a226b55ab41cf938f38b45de3b9031d68445")]
[assembly: AssemblyProduct("TakeyGokuBracken")]
[assembly: AssemblyTitle("com.github.zehsteam.TakeyGokuBracken")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.2.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.TakeyGoku
{
	internal class ConfigManager
	{
		private ConfigEntry<int> SpawnChanceCfg;

		internal int SpawnChance
		{
			get
			{
				return SpawnChanceCfg.Value;
			}
			set
			{
				SpawnChanceCfg.Value = value;
			}
		}

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

		private void BindConfigs()
		{
			//IL_0018: 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_003b: Expected O, but got Unknown
			//IL_003b: Expected O, but got Unknown
			ConfigFile config = ((BaseUnityPlugin)Plugin.Instance).Config;
			SpawnChanceCfg = config.Bind<int>(new ConfigDefinition("General Settings", "SpawnChance"), 25, new ConfigDescription("The percent chance a Goku Bracken turns into a Takey Goku Bracken.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), 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 GameObject takeyGokuBrackenControllerPrefab;

		public static AudioClip killSFX;

		public static AudioClip kill2SFX;

		public static AudioClip creepyLaughSFX;

		public static AudioClip iLickyYourTummySFX;

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

		private static void LoadAssetsFromAssetBundle()
		{
			try
			{
				string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)Plugin.Instance).Info.Location);
				string text = Path.Combine(directoryName, "takeygokubracken_assets");
				AssetBundle val = AssetBundle.LoadFromFile(text);
				networkHandlerPrefab = val.LoadAsset<GameObject>("NetworkHandler");
				networkHandlerPrefab.AddComponent<PluginNetworkBehaviour>();
				takeyGokuBrackenControllerPrefab = val.LoadAsset<GameObject>("TakeyGokuBrackenController");
				killSFX = val.LoadAsset<AudioClip>("KillSFX");
				kill2SFX = val.LoadAsset<AudioClip>("Kill2SFX");
				creepyLaughSFX = val.LoadAsset<AudioClip>("CreepyLaughSFX");
				iLickyYourTummySFX = val.LoadAsset<AudioClip>("ILickyYourTummySFX");
				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}");
			}
		}
	}
	[BepInPlugin("com.github.zehsteam.TakeyGokuBracken", "TakeyGokuBracken", "1.1.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	internal class Plugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("com.github.zehsteam.TakeyGokuBracken");

		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.TakeyGokuBracken");
			logger.LogInfo((object)"TakeyGokuBracken has awoken!");
			harmony.PatchAll(typeof(GameNetworkManagerPatch));
			harmony.PatchAll(typeof(StartOfRoundPatch));
			harmony.PatchAll(typeof(FlowermanAIPatch));
			ConfigManager = new ConfigManager();
			Content.Load();
			GokuBrackenCompat.Initialize();
			HallucinocepsCompat.Initialize();
			FlowermanAIPatch.Reset();
			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()
		{
			FlowermanAIPatch.Reset();
		}

		public void OnShipHasLeft()
		{
			FlowermanAIPatch.DespawnAllTakeyGokuControllers();
			FlowermanAIPatch.Reset();
		}

		public bool SetTakeyGokuBrackenOnServer(FlowermanAI flowermanAI)
		{
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			if (!IsHostOrServer)
			{
				return false;
			}
			if ((Object)(object)flowermanAI == (Object)null)
			{
				logger.LogError((object)"Error: Failed to set Takey Goku Bracken on server. FlowermanAI is null.");
				return false;
			}
			NetworkObject component = ((Component)flowermanAI).GetComponent<NetworkObject>();
			if (!Utils.IsGokuBracken(flowermanAI))
			{
				logger.LogError((object)$"Error: Failed to set Takey Goku Bracken on server. Enemy is not a Goku Bracken. (NetworkObject: {component.NetworkObjectId})");
				return false;
			}
			if (Utils.IsTakeyGokuBracken(flowermanAI))
			{
				logger.LogWarning((object)$"Warning: Failed to set Takey Goku Bracken on server. Enemy is already a Takey Goku Bracken. (NetworkObject: {component.NetworkObjectId})");
				return false;
			}
			NetworkObject controllerNetworkObject = SpawnTakeyGokuControllerOnServer(((Component)component).transform);
			FlowermanAIPatch.AddTakeyGokuController(controllerNetworkObject);
			PluginNetworkBehaviour.Instance.SetTakeyGokuClientRpc(NetworkObjectReference.op_Implicit(component));
			SetTakeyGokuBrackenOnLocalClient(component);
			return true;
		}

		private NetworkObject SpawnTakeyGokuControllerOnServer(Transform parentTransform)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			if (!IsHostOrServer)
			{
				return null;
			}
			GameObject val = Object.Instantiate<GameObject>(Content.takeyGokuBrackenControllerPrefab, Vector3.zero, Quaternion.identity, parentTransform);
			NetworkObject component = val.GetComponent<NetworkObject>();
			component.Spawn(true);
			val.transform.SetParent(parentTransform);
			return component;
		}

		public void SetTakeyGokuBrackenOnLocalClient(NetworkObject enemyNetworkObject)
		{
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			if (!GokuBrackenCompat.hasMod)
			{
				return;
			}
			FlowermanAI val = default(FlowermanAI);
			if ((Object)(object)enemyNetworkObject == (Object)null)
			{
				logger.LogError((object)"Error: Failed to set Takey Goku Bracken on local client. Enemy NetworkObject is null.");
			}
			else if (((Component)enemyNetworkObject).TryGetComponent<FlowermanAI>(ref val))
			{
				if (!Utils.IsGokuBracken(val))
				{
					logger.LogError((object)$"Error: Failed to set Takey Goku Bracken on local client. Enemy \"{((Object)((Component)enemyNetworkObject).gameObject).name}\" is not a Goku Bracken. (NetworkObject: {enemyNetworkObject.NetworkObjectId})");
					return;
				}
				if (!FlowermanAIPatch.takeyGokuBrackens.Contains(val))
				{
					try
					{
						Transform val2 = ((Component)enemyNetworkObject).transform.Find("TakeyGokuBrackenController(Clone)");
						val2.localPosition = Vector3.zero;
						val2.localRotation = Quaternion.identity;
						FlowermanAIPatch.AddTakeyGokuBrackenToList(val);
						return;
					}
					catch (Exception arg)
					{
						logger.LogError((object)$"Error: Failed to set Takey Goku Bracken on local client. (NetworkObject: {enemyNetworkObject.NetworkObjectId})\n\n{arg}");
						return;
					}
				}
				logger.LogWarning((object)$"Warning: Failed to set Takey Goku Bracken on local client. Enemy is already a Takey Goku Bracken. (NetworkObject: {enemyNetworkObject.NetworkObjectId})");
			}
			else
			{
				logger.LogError((object)$"Error: Failed to set Takey Goku Bracken on local client. Could not find FlowermanAI. (NetworkObject: {enemyNetworkObject.NetworkObjectId})");
			}
		}
	}
	public class Utils
	{
		public static bool RandomPercent(int percent)
		{
			if (percent <= 0)
			{
				return false;
			}
			if (percent >= 100)
			{
				return true;
			}
			return Random.value <= (float)percent * 0.01f;
		}

		public static bool IsGokuBracken(FlowermanAI flowermanAI)
		{
			return (Object)(object)((Component)flowermanAI).GetComponentInChildren<GokuController>() != (Object)null;
		}

		public static bool IsTakeyGokuBracken(FlowermanAI flowermanAI)
		{
			return (Object)(object)((Component)flowermanAI).GetComponentInChildren<TakeyGokuBrackenBehaviour>() != (Object)null;
		}

		public static bool IsTakeyGokuBracken(FlowermanAI flowermanAI, out TakeyGokuBrackenBehaviour behaviour)
		{
			behaviour = ((Component)flowermanAI).GetComponentInChildren<TakeyGokuBrackenBehaviour>();
			return (Object)(object)behaviour != (Object)null;
		}
	}
}
namespace com.github.zehsteam.TakeyGokuBracken
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "com.github.zehsteam.TakeyGokuBracken";

		public const string PLUGIN_NAME = "TakeyGokuBracken";

		public const string PLUGIN_VERSION = "1.1.2";
	}
}
namespace com.github.zehsteam.TakeyGokuBracken.Patches
{
	[HarmonyPatch(typeof(FlowermanAI))]
	internal class FlowermanAIPatch
	{
		public static List<FlowermanAI> takeyGokuBrackens { get; private set; }

		public static List<NetworkObject> takeyGokuControllers { get; private set; }

		public static void Reset()
		{
			takeyGokuBrackens = new List<FlowermanAI>();
			takeyGokuControllers = new List<NetworkObject>();
		}

		public static void AddTakeyGokuBrackenToList(FlowermanAI flowermanAI)
		{
			if (!takeyGokuBrackens.Contains(flowermanAI))
			{
				takeyGokuBrackens.Add(flowermanAI);
			}
		}

		public static void AddTakeyGokuController(NetworkObject controllerNetworkObject)
		{
			takeyGokuControllers.Add(controllerNetworkObject);
		}

		public static void DespawnAllTakeyGokuControllers()
		{
			if (!Plugin.IsHostOrServer)
			{
				return;
			}
			foreach (NetworkObject takeyGokuController in takeyGokuControllers)
			{
				takeyGokuController.Despawn(true);
			}
			takeyGokuControllers.Clear();
			Plugin.logger.LogInfo((object)"Finished despawning all Takey Goku Controllers.");
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		[HarmonyPriority(0)]
		private static void StartPatch(ref FlowermanAI __instance)
		{
			if (Plugin.IsHostOrServer)
			{
				((MonoBehaviour)StartOfRound.Instance).StartCoroutine(LateStartCO(__instance));
			}
		}

		private static IEnumerator LateStartCO(FlowermanAI flowermanAI)
		{
			yield return (object)new WaitForSeconds(0.5f);
			LateStart(flowermanAI);
		}

		private static void LateStart(FlowermanAI flowermanAI)
		{
			if (Utils.RandomPercent(Plugin.ConfigManager.SpawnChance))
			{
				Plugin.Instance.SetTakeyGokuBrackenOnServer(flowermanAI);
			}
		}

		[HarmonyPatch("KillPlayerAnimationServerRpc")]
		[HarmonyPrefix]
		private static void KillPlayerAnimationServerRpcPatch(ref FlowermanAI __instance)
		{
			if (Utils.IsTakeyGokuBracken(__instance, out var behaviour))
			{
				behaviour.SetRandomCrackNeckSFXOnServer();
			}
		}
	}
	[HarmonyPatch(typeof(GameNetworkManager))]
	internal class GameNetworkManagerPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void StartPatch()
		{
			AddNetworkPrefabs();
		}

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

		private static void AddNetworkPrefab(GameObject prefab)
		{
			if ((Object)(object)prefab == (Object)null)
			{
				Plugin.logger.LogError((object)"Error: Failed to register network prefab. Prefab is null.");
				return;
			}
			NetworkManager.Singleton.AddNetworkPrefab(prefab);
			Plugin.logger.LogInfo((object)("Registered \"" + ((Object)prefab).name + "\" network prefab."));
		}
	}
	[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("Start")]
		[HarmonyPostfix]
		[HarmonyPriority(300)]
		private static void StartPatch()
		{
			try
			{
				HallucinocepsCompat.AddHallucinationSounds();
			}
			catch (Exception arg)
			{
				Plugin.logger.LogError((object)$"Error: Failed to add hallucination sounds to the Hallucinoceps mod.\n\n{arg}");
			}
		}

		[HarmonyPatch("ShipHasLeft")]
		[HarmonyPostfix]
		private static void ShipHasLeftPatch()
		{
			Plugin.Instance.OnShipHasLeft();
		}

		[HarmonyPatch("OnLocalDisconnect")]
		[HarmonyPrefix]
		private static void OnLocalDisconnectPatch()
		{
			Plugin.Instance.OnLocalDisconnect();
		}
	}
}
namespace com.github.zehsteam.TakeyGokuBracken.MonoBehaviours
{
	internal class PluginNetworkBehaviour : NetworkBehaviour
	{
		public static PluginNetworkBehaviour Instance;

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

		[ClientRpc]
		public void SetTakeyGokuClientRpc(NetworkObjectReference enemyReference)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3517081936u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref enemyReference, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3517081936u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((NetworkBehaviour)this).IsHost && !((NetworkBehaviour)this).IsServer)
			{
				NetworkObject takeyGokuBrackenOnLocalClient = default(NetworkObject);
				if (((NetworkObjectReference)(ref enemyReference)).TryGet(ref takeyGokuBrackenOnLocalClient, (NetworkManager)null))
				{
					Plugin.Instance.SetTakeyGokuBrackenOnLocalClient(takeyGokuBrackenOnLocalClient);
				}
				else
				{
					Plugin.Instance.SetTakeyGokuBrackenOnLocalClient(null);
				}
			}
		}

		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(3517081936u, new RpcReceiveHandler(__rpc_handler_3517081936));
		}

		private static void __rpc_handler_3517081936(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference takeyGokuClientRpc = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref takeyGokuClientRpc, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((PluginNetworkBehaviour)(object)target).SetTakeyGokuClientRpc(takeyGokuClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "PluginNetworkBehaviour";
		}
	}
	public class TakeyGokuBrackenBehaviour : NetworkBehaviour
	{
		public Material clothesMaterial = null;

		public Material headMaterial = null;

		public AudioClip[] takeyFoundSFX = (AudioClip[])(object)new AudioClip[0];

		public AudioClip[] takeyCrackNeckSFX = (AudioClip[])(object)new AudioClip[0];

		private FlowermanAI _flowermanAI;

		private ScanNodeProperties _scanNodeProperties;

		private PlayAudioAnimationEvent _playAudioAnimationEvent;

		private float timer = 0f;

		public FlowermanAI flowermanAI
		{
			get
			{
				if ((Object)(object)_flowermanAI == (Object)null)
				{
					_flowermanAI = ((Component)((Component)this).transform.parent).GetComponent<FlowermanAI>();
				}
				return _flowermanAI;
			}
		}

		public ScanNodeProperties scanNodeProperties
		{
			get
			{
				if ((Object)(object)_scanNodeProperties == (Object)null)
				{
					_scanNodeProperties = ((Component)flowermanAI).GetComponentInChildren<ScanNodeProperties>();
				}
				return _scanNodeProperties;
			}
		}

		public PlayAudioAnimationEvent playAudioAnimationEvent
		{
			get
			{
				if ((Object)(object)_playAudioAnimationEvent == (Object)null)
				{
					_playAudioAnimationEvent = ((Component)flowermanAI).GetComponentInChildren<PlayAudioAnimationEvent>();
				}
				return _playAudioAnimationEvent;
			}
		}

		private void Start()
		{
			if (GokuBrackenCompat.hasMod)
			{
				SetMaterials();
				SetScanNodeProperties("Takey Goku");
				if (Plugin.IsHostOrServer)
				{
					SetSFXOnServer();
				}
			}
		}

		private void Update()
		{
			if (GokuBrackenCompat.hasMod && Plugin.IsHostOrServer)
			{
				if (timer >= 20f)
				{
					timer = 0f;
					SetRandomFoundSFXOnServer();
				}
				timer += Time.deltaTime;
			}
		}

		private void SetMaterials()
		{
			SkinnedMeshRenderer componentInChildren = ((Component)((Component)flowermanAI).transform.GetChild(4)).GetComponentInChildren<SkinnedMeshRenderer>();
			SetSkinnedMeshRendererMaterials(componentInChildren, clothesMaterial, headMaterial);
			SkinnedMeshRenderer componentInChildren2 = ((Component)((Component)flowermanAI).transform.GetChild(5)).GetComponentInChildren<SkinnedMeshRenderer>();
			SetSkinnedMeshRendererMaterials(componentInChildren2, clothesMaterial, headMaterial);
		}

		private static void SetSkinnedMeshRendererMaterials(SkinnedMeshRenderer skinnedMeshRenderer, Material material1, Material material2)
		{
			Material[] materials = ((Renderer)skinnedMeshRenderer).materials;
			materials[0] = material1;
			materials[1] = material2;
			((Renderer)skinnedMeshRenderer).materials = materials;
		}

		private void SetSFXOnServer()
		{
			SetRandomCrackNeckSFXOnServer();
			SetRandomFoundSFXOnServer();
		}

		public void SetRandomCrackNeckSFXOnServer()
		{
			if (Plugin.IsHostOrServer)
			{
				int crackNeckSFXClientRpc = Random.Range(0, takeyCrackNeckSFX.Length);
				SetCrackNeckSFXClientRpc(crackNeckSFXClientRpc);
			}
		}

		[ClientRpc]
		private void SetCrackNeckSFXClientRpc(int index)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2929643050u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, index);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2929643050u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && GokuBrackenCompat.hasMod)
				{
					AudioClip val3 = takeyCrackNeckSFX[index];
					flowermanAI.crackNeckSFX = val3;
					flowermanAI.crackNeckAudio.clip = val3;
				}
			}
		}

		public void SetRandomFoundSFXOnServer()
		{
			if (Plugin.IsHostOrServer)
			{
				int foundSFXClientRpc = Random.Range(0, takeyFoundSFX.Length);
				SetFoundSFXClientRpc(foundSFXClientRpc);
			}
		}

		[ClientRpc]
		private void SetFoundSFXClientRpc(int index)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3425590996u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, index);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3425590996u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && GokuBrackenCompat.hasMod)
				{
					playAudioAnimationEvent.audioClip = takeyFoundSFX[index];
				}
			}
		}

		private void SetScanNodeProperties(string headerText)
		{
			scanNodeProperties.headerText = headerText;
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_TakeyGokuBrackenBehaviour()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(2929643050u, new RpcReceiveHandler(__rpc_handler_2929643050));
			NetworkManager.__rpc_func_table.Add(3425590996u, new RpcReceiveHandler(__rpc_handler_3425590996));
		}

		private static void __rpc_handler_2929643050(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int crackNeckSFXClientRpc = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref crackNeckSFXClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((TakeyGokuBrackenBehaviour)(object)target).SetCrackNeckSFXClientRpc(crackNeckSFXClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3425590996(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int foundSFXClientRpc = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref foundSFXClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((TakeyGokuBrackenBehaviour)(object)target).SetFoundSFXClientRpc(foundSFXClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "TakeyGokuBrackenBehaviour";
		}
	}
}
namespace com.github.zehsteam.TakeyGokuBracken.Compatibility
{
	internal class GokuBrackenCompat
	{
		public const string ModGUID = "Vulf.GokuBracken";

		public static bool hasMod;

		public static void Initialize()
		{
			hasMod = Chainloader.PluginInfos.ContainsKey("Vulf.GokuBracken");
		}
	}
	internal class HallucinocepsCompat
	{
		public const string ModGUID = "PloufJPEG.Hallucinoceps";

		public static bool hasMod;

		public static void Initialize()
		{
			hasMod = Chainloader.PluginInfos.ContainsKey("PloufJPEG.Hallucinoceps");
		}

		public static void AddHallucinationSounds()
		{
			if (!hasMod)
			{
				return;
			}
			try
			{
				List<AudioClip> list = CompanyCreaturesNetworker.instance.hallucinationSounds.ToList();
				list.Add(Content.killSFX);
				list.Add(Content.kill2SFX);
				list.Add(Content.creepyLaughSFX);
				list.Add(Content.iLickyYourTummySFX);
				CompanyCreaturesNetworker.instance.hallucinationSounds = list.ToArray();
				Plugin.logger.LogInfo((object)"Added hallucination sounds to the Hallucinoceps mod.");
			}
			catch (Exception arg)
			{
				Plugin.logger.LogInfo((object)$"Error: Failed to add hallucination sounds to the Hallucinoceps mod.\n\n{arg}");
			}
		}
	}
}
namespace com.github.zehsteam.TakeyGokuBracken.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}

com.github.zehsteam.TakeyPlush.dll

Decompiled 2 weeks 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 GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using LethalModDataLib.Enums;
using LethalModDataLib.Features;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using com.github.zehsteam.TakeyPlush.MonoBehaviours;
using com.github.zehsteam.TakeyPlush.NetcodePatcher;
using com.github.zehsteam.TakeyPlush.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.TakeyPlush")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Adds a customizable Takey Plushie scrap item with some functionalities. \ud83d\ude08")]
[assembly: AssemblyFileVersion("1.4.2.0")]
[assembly: AssemblyInformationalVersion("1.4.2+7a4e00c8a899716b5566a7c713e3da4db59e0cbd")]
[assembly: AssemblyProduct("TakeyPlush")]
[assembly: AssemblyTitle("com.github.zehsteam.TakeyPlush")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.4.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>();
	}
}
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.TakeyPlush
{
	internal class ConfigManager
	{
		private ConfigEntry<int> SpawnWeightCfg;

		private ConfigEntry<bool> TwoHandedCfg;

		private ConfigEntry<int> CarryWeightCfg;

		private ConfigEntry<int> MinValueCfg;

		private ConfigEntry<int> MaxValueCfg;

		private ConfigEntry<bool> EnableRadioModeCfg;

		private ConfigEntry<int> EvilTakeyChanceCfg;

		private ConfigEntry<float> FlyDurationCfg;

		private ConfigEntry<int> ExplosionDamageCfg;

		private ConfigEntry<float> MaxExplosionRangeCfg;

		internal int SpawnWeight
		{
			get
			{
				return SpawnWeightCfg.Value;
			}
			set
			{
				SpawnWeightCfg.Value = value;
			}
		}

		internal bool TwoHanded
		{
			get
			{
				return TwoHandedCfg.Value;
			}
			set
			{
				TwoHandedCfg.Value = value;
			}
		}

		internal int CarryWeight
		{
			get
			{
				return CarryWeightCfg.Value;
			}
			set
			{
				CarryWeightCfg.Value = value;
			}
		}

		internal int MinValue
		{
			get
			{
				return MinValueCfg.Value;
			}
			set
			{
				MinValueCfg.Value = value;
			}
		}

		internal int MaxValue
		{
			get
			{
				return MaxValueCfg.Value;
			}
			set
			{
				MaxValueCfg.Value = value;
			}
		}

		internal bool EnableRadioMode
		{
			get
			{
				return EnableRadioModeCfg.Value;
			}
			set
			{
				EnableRadioModeCfg.Value = value;
			}
		}

		internal int EvilTakeyChance
		{
			get
			{
				return EvilTakeyChanceCfg.Value;
			}
			set
			{
				EvilTakeyChanceCfg.Value = value;
			}
		}

		internal float FlyDuration
		{
			get
			{
				return Mathf.Clamp(FlyDurationCfg.Value, 3f, 6f);
			}
			set
			{
				FlyDurationCfg.Value = value;
			}
		}

		internal int ExplosionDamage
		{
			get
			{
				return ExplosionDamageCfg.Value;
			}
			set
			{
				ExplosionDamageCfg.Value = value;
			}
		}

		internal float MaxExplosionRange
		{
			get
			{
				return MaxExplosionRangeCfg.Value;
			}
			set
			{
				MaxExplosionRangeCfg.Value = value;
			}
		}

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

		private void BindConfigs()
		{
			//IL_0018: 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_003b: Expected O, but got Unknown
			//IL_003b: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_0067: Expected O, but got Unknown
			//IL_0078: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			//IL_00c0: Expected O, but got Unknown
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			//IL_00f0: Expected O, but got Unknown
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Expected O, but got Unknown
			//IL_011c: Expected O, but got Unknown
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Expected O, but got Unknown
			//IL_0150: Expected O, but got Unknown
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Expected O, but got Unknown
			//IL_018e: Expected O, but got Unknown
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Expected O, but got Unknown
			//IL_01bb: Expected O, but got Unknown
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Expected O, but got Unknown
			//IL_01eb: Expected O, but got Unknown
			ConfigFile config = ((BaseUnityPlugin)Plugin.Instance).Config;
			SpawnWeightCfg = config.Bind<int>(new ConfigDefinition("General Settings", "SpawnWeight"), 10, new ConfigDescription("Takey Plush spawn chance weight. higher = more common.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			TwoHandedCfg = config.Bind<bool>(new ConfigDefinition("General Settings", "TwoHanded"), false, new ConfigDescription("If enabled, the Takey Plush will be two-handed.", (AcceptableValueBase)null, Array.Empty<object>()));
			CarryWeightCfg = config.Bind<int>(new ConfigDefinition("General Settings", "CarryWeight"), 5, new ConfigDescription("Takey Plush carry weight in pounds.", (AcceptableValueBase)null, Array.Empty<object>()));
			MinValueCfg = config.Bind<int>(new ConfigDefinition("General Settings", "MinValue"), 80, new ConfigDescription("Takey Plush min scrap value.", (AcceptableValueBase)null, Array.Empty<object>()));
			MaxValueCfg = config.Bind<int>(new ConfigDefinition("General Settings", "MaxValue"), 250, new ConfigDescription("Takey Plush max scrap value.", (AcceptableValueBase)null, Array.Empty<object>()));
			EnableRadioModeCfg = config.Bind<bool>(new ConfigDefinition("General Settings", "EnableRadioMode"), false, new ConfigDescription("If enabled, you can switch from random to radio mode for the squeeze voice lines. (Host only)", (AcceptableValueBase)null, Array.Empty<object>()));
			EvilTakeyChanceCfg = config.Bind<int>(new ConfigDefinition("Evil Takey Settings", "EvilTakeyChance"), 20, new ConfigDescription("The percent chance Smol Takey becomes evil.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			FlyDurationCfg = config.Bind<float>(new ConfigDefinition("Evil Takey Settings", "FlyDuration"), 5f, new ConfigDescription("The flight duration of Evil Takey in seconds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(3f, 6f), Array.Empty<object>()));
			ExplosionDamageCfg = config.Bind<int>(new ConfigDefinition("Evil Takey Settings", "ExplosionDamage"), 50, new ConfigDescription("The explosion damage of Evil Takey.", (AcceptableValueBase)null, Array.Empty<object>()));
			MaxExplosionRangeCfg = config.Bind<float>(new ConfigDefinition("Evil Takey Settings", "MaxExplosionRange"), 6.4f, new ConfigDescription("The max explosion range of Evil Takey in meters.", (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 Item takeyPlush;

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

		private static void LoadAssetsFromAssetBundle()
		{
			try
			{
				string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)Plugin.Instance).Info.Location);
				string text = Path.Combine(directoryName, "takeyplush_assets");
				AssetBundle val = AssetBundle.LoadFromFile(text);
				networkHandlerPrefab = val.LoadAsset<GameObject>("NetworkHandler");
				networkHandlerPrefab.AddComponent<PluginNetworkBehaviour>();
				takeyPlush = val.LoadAsset<Item>("TakeyPlush");
				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}");
			}
		}
	}
	[BepInPlugin("com.github.zehsteam.TakeyPlush", "TakeyPlush", "1.4.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("com.github.zehsteam.TakeyPlush");

		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.TakeyPlush");
			logger.LogInfo((object)"TakeyPlush has awoken!");
			harmony.PatchAll(typeof(GameNetworkManagerPatch));
			harmony.PatchAll(typeof(StartOfRoundPatch));
			harmony.PatchAll(typeof(HoarderBugAIPatch));
			harmony.PatchAll(typeof(BaboonBirdAIPatch));
			ConfigManager = new ConfigManager();
			Content.Load();
			RegisterScrapItems();
			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);
					}
				}
			}
		}

		private void RegisterScrapItems()
		{
			int spawnWeight = ConfigManager.SpawnWeight;
			bool twoHanded = ConfigManager.TwoHanded;
			int carryWeight = ConfigManager.CarryWeight;
			int minValue = ConfigManager.MinValue;
			int maxValue = ConfigManager.MaxValue;
			ScrapHelper.RegisterScrap(Content.takeyPlush, spawnWeight, twoHanded, carryWeight, minValue, maxValue);
		}
	}
	internal class ScrapHelper
	{
		public static void RegisterScrap(Item item, int iRarity, bool twoHanded, int carryWeight, int minValue, int maxValue)
		{
			item.twoHanded = twoHanded;
			item.weight = (float)carryWeight / 105f + 1f;
			item.minValue = minValue;
			item.maxValue = maxValue;
			Utilities.FixMixerGroups(item.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab);
			Items.RegisterScrap(item, iRarity, (LevelTypes)(-1));
			Plugin.logger.LogInfo((object)$"Registered \"{item.itemName}\" scrap item with {iRarity} rarity.");
		}

		public static int[] GetSharedSpawnWeights(int spawnWeight, int amount)
		{
			List<int> list = new List<int>();
			int num = (int)Mathf.Max(Mathf.Floor((float)(spawnWeight / amount)), 1f);
			bool flag = num * amount < spawnWeight;
			for (int i = 0; i < amount; i++)
			{
				int num2 = ((i == 0 && flag) ? 1 : 0);
				list.Add(num + num2);
			}
			return list.ToArray();
		}
	}
	internal class Utils
	{
		public static bool RandomPercent(int percent)
		{
			if (percent <= 0)
			{
				return false;
			}
			if (percent >= 100)
			{
				return true;
			}
			return Random.value <= (float)percent * 0.01f;
		}

		public static int GetLocalPlayerId()
		{
			return (int)GetLocalPlayerScript().playerClientId;
		}

		public static bool IsLocalPlayerId(int clientId)
		{
			return clientId == GetLocalPlayerId();
		}

		public static PlayerControllerB GetLocalPlayerScript()
		{
			return GameNetworkManager.Instance.localPlayerController;
		}

		public static bool IsPlayerNearby(Vector3 position, float range)
		{
			//IL_0018: 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)
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			PlayerControllerB[] array = allPlayerScripts;
			foreach (PlayerControllerB val in array)
			{
				if (Vector3.Distance(position, ((Component)val).gameObject.transform.position) <= range)
				{
					return true;
				}
			}
			return false;
		}

		public static void CreateExplosion(Vector3 explosionPosition, bool spawnExplosionEffect = false, int damage = 20, float minDamageRange = 0f, float maxDamageRange = 6.4f, int enemyHitForce = 6, CauseOfDeath causeOfDeath = 3, PlayerControllerB attacker = null)
		{
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//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_0336: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"Spawning explosion at pos: {explosionPosition}");
			Transform val = null;
			if ((Object)(object)RoundManager.Instance != (Object)null && (Object)(object)RoundManager.Instance.mapPropsContainer != (Object)null && (Object)(object)RoundManager.Instance.mapPropsContainer.transform != (Object)null)
			{
				val = RoundManager.Instance.mapPropsContainer.transform;
			}
			if (spawnExplosionEffect)
			{
				Object.Instantiate<GameObject>(StartOfRound.Instance.explosionPrefab, explosionPosition, Quaternion.Euler(-90f, 0f, 0f), val).SetActive(true);
			}
			float num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, explosionPosition);
			if (num < 14f)
			{
				HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
			}
			else if (num < 25f)
			{
				HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
			}
			Collider[] array = Physics.OverlapSphere(explosionPosition, maxDamageRange, 2621448, (QueryTriggerInteraction)2);
			PlayerControllerB val2 = null;
			for (int i = 0; i < array.Length; i++)
			{
				float num2 = Vector3.Distance(explosionPosition, ((Component)array[i]).transform.position);
				if (num2 > 4f && Physics.Linecast(explosionPosition, ((Component)array[i]).transform.position + Vector3.up * 0.3f, 256, (QueryTriggerInteraction)1))
				{
					continue;
				}
				if (((Component)array[i]).gameObject.layer == 3)
				{
					val2 = ((Component)array[i]).gameObject.GetComponent<PlayerControllerB>();
					if ((Object)(object)val2 != (Object)null && ((NetworkBehaviour)val2).IsOwner)
					{
						float num3 = 1f - Mathf.Clamp01((num2 - minDamageRange) / (maxDamageRange - minDamageRange));
						val2.DamagePlayer((int)((float)damage * num3), true, true, causeOfDeath, 0, false, default(Vector3));
					}
				}
				else if (((Component)array[i]).gameObject.layer == 21)
				{
					Landmine componentInChildren = ((Component)array[i]).gameObject.GetComponentInChildren<Landmine>();
					if ((Object)(object)componentInChildren != (Object)null && !componentInChildren.hasExploded && num2 < 6f)
					{
						Debug.Log((object)"Setting off other mine");
						((MonoBehaviour)StartOfRound.Instance).StartCoroutine(TriggerOtherMineDelayed(componentInChildren));
					}
				}
				else if (((Component)array[i]).gameObject.layer == 19)
				{
					EnemyAICollisionDetect componentInChildren2 = ((Component)array[i]).gameObject.GetComponentInChildren<EnemyAICollisionDetect>();
					if ((Object)(object)componentInChildren2 != (Object)null && ((NetworkBehaviour)componentInChildren2.mainScript).IsOwner && num2 < 4.5f)
					{
						componentInChildren2.mainScript.HitEnemyOnLocalClient(enemyHitForce, default(Vector3), attacker, false, -1);
					}
				}
			}
			int num4 = ~LayerMask.GetMask(new string[1] { "Room" });
			num4 = ~LayerMask.GetMask(new string[1] { "Colliders" });
			array = Physics.OverlapSphere(explosionPosition, 10f, num4);
			for (int j = 0; j < array.Length; j++)
			{
				Rigidbody component = ((Component)array[j]).GetComponent<Rigidbody>();
				if ((Object)(object)component != (Object)null)
				{
					component.AddExplosionForce(70f, explosionPosition, 10f);
				}
			}
		}

		private static IEnumerator TriggerOtherMineDelayed(Landmine mine)
		{
			if (!mine.hasExploded)
			{
				mine.mineAudio.pitch = Random.Range(0.75f, 1.07f);
				mine.hasExploded = true;
				yield return (object)new WaitForSeconds(0.2f);
				mine.SetOffMineAnimation();
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "com.github.zehsteam.TakeyPlush";

		public const string PLUGIN_NAME = "TakeyPlush";

		public const string PLUGIN_VERSION = "1.4.2";
	}
}
namespace com.github.zehsteam.TakeyPlush.Patches
{
	[HarmonyPatch(typeof(BaboonBirdAI))]
	internal class BaboonBirdAIPatch
	{
		[HarmonyPatch("GrabItemAndSync")]
		[HarmonyPrefix]
		private static bool GrabItemAndSyncPatch(ref BaboonBirdAI __instance, ref NetworkObject item)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			if (!((NetworkBehaviour)__instance).IsOwner)
			{
				return true;
			}
			Takey component = ((Component)item).gameObject.GetComponent<Takey>();
			if ((Object)(object)component == (Object)null)
			{
				return true;
			}
			if ((!component.isEvil.Value && !component.isFlying) || !Utils.IsPlayerNearby(((Component)__instance).gameObject.transform.position, 20f))
			{
				return true;
			}
			if (!component.isFlying)
			{
				component.StartFlyingServerRpc();
			}
			return false;
		}

		[HarmonyPatch("DropHeldItemAndSync")]
		[HarmonyPrefix]
		private static void DropHeldItemAndSyncPatch(ref BaboonBirdAI __instance)
		{
			Takey component = ((Component)__instance.heldScrap).gameObject.GetComponent<Takey>();
			if (!((Object)(object)component == (Object)null))
			{
				component.RollIsEvilServerRpc();
			}
		}
	}
	[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(HoarderBugAI))]
	internal class HoarderBugAIPatch
	{
		[HarmonyPatch("GrabTargetItemIfClose")]
		[HarmonyPrefix]
		private static bool GrabTargetItemIfClosePatch(ref HoarderBugAI __instance, ref bool __result)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			if (!((NetworkBehaviour)__instance).IsOwner)
			{
				return true;
			}
			if ((Object)(object)__instance.targetItem != (Object)null && __instance.heldItem == null && Vector3.Distance(((Component)__instance).transform.position, ((Component)__instance.targetItem).transform.position) < 0.75f)
			{
				Takey component = ((Component)__instance.targetItem).gameObject.GetComponent<Takey>();
				if ((Object)(object)component == (Object)null)
				{
					return true;
				}
				if ((!component.isEvil.Value && !component.isFlying) || !Utils.IsPlayerNearby(((Component)__instance).gameObject.transform.position, 20f))
				{
					return true;
				}
				if (!component.isFlying)
				{
					component.StartFlyingServerRpc();
				}
				__result = true;
				return false;
			}
			return true;
		}

		[HarmonyPatch("DropItemAndCallDropRPC")]
		[HarmonyPostfix]
		private static void DropItemAndCallDropRPCPatch(ref HoarderBugAI __instance, ref NetworkObject dropItemNetworkObject)
		{
			if (((NetworkBehaviour)__instance).IsOwner)
			{
				Takey component = ((Component)dropItemNetworkObject).gameObject.GetComponent<Takey>();
				if (!((Object)(object)component == (Object)null))
				{
					component.RollIsEvilServerRpc();
				}
			}
		}
	}
	[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);
			}
		}
	}
}
namespace com.github.zehsteam.TakeyPlush.MonoBehaviours
{
	public class AdvancedNoisemakerProp : NoisemakerProp
	{
		[Header("Advanced")]
		[Space(3f)]
		public bool useDynamicCooldown = false;

		public bool cancelActiveSFXOnItemActivate = false;

		protected Random noisemakerRandom;

		[HideInInspector]
		public int uniqueId = 0;

		public bool isHostOrServer => Plugin.IsHostOrServer;

		public bool isHeldByLocalPlayer => (Object)(object)((GrabbableObject)this).playerHeldBy == (Object)(object)Utils.GetLocalPlayerScript();

		public bool canActivateItem => isHeldByLocalPlayer || ((GrabbableObject)this).isHeldByEnemy;

		public string saveKey => string.Format("{0}_{1}", "AdvancedNoisemakerProp", uniqueId);

		public override void LoadItemSaveData(int saveData)
		{
			((GrabbableObject)this).LoadItemSaveData(saveData);
			uniqueId = saveData;
		}

		public override int GetItemDataToSave()
		{
			return uniqueId;
		}

		public virtual void Awake()
		{
			if (isHostOrServer)
			{
				uniqueId = Random.Range(0, 1000000);
			}
		}

		public override void Start()
		{
			((NoisemakerProp)this).Start();
			noisemakerRandom = new Random(StartOfRound.Instance.randomMapSeed + 85);
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			if (canActivateItem)
			{
				int index = Random.Range(0, base.noiseSFX.Length);
				PlaySound(index);
			}
		}

		public void PlaySound(int index)
		{
			int fromPlayerId = (isHeldByLocalPlayer ? Utils.GetLocalPlayerId() : (-1));
			if (isHostOrServer)
			{
				PlaySoundClientRpc(index, fromPlayerId);
			}
			else
			{
				PlaySoundServerRpc(index, fromPlayerId);
			}
			PlaySoundOnLocalClient(index);
		}

		[ServerRpc(RequireOwnership = false)]
		protected void PlaySoundServerRpc(int index, int fromPlayerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3879375848u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, index);
					BytePacker.WriteValueBitPacked(val2, fromPlayerId);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3879375848u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					PlaySoundClientRpc(index, fromPlayerId);
				}
			}
		}

		[ClientRpc]
		protected void PlaySoundClientRpc(int index, int fromPlayerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1515505519u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, index);
					BytePacker.WriteValueBitPacked(val2, fromPlayerId);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1515505519u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !Utils.IsLocalPlayerId(fromPlayerId))
				{
					PlaySoundOnLocalClient(index);
				}
			}
		}

		protected void PlaySoundOnLocalClient(int index)
		{
			AudioClip audioClip = base.noiseSFX[index];
			AudioClip audioClipFar = base.noiseSFXFar[index];
			PlaySoundOnLocalClient(audioClip, audioClipFar);
		}

		protected void PlaySoundOnLocalClient(AudioClip audioClip, AudioClip audioClipFar)
		{
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			float num = (float)noisemakerRandom.Next((int)(base.minLoudness * 100f), (int)(base.maxLoudness * 100f)) / 100f;
			float pitch = (float)noisemakerRandom.Next((int)(base.minPitch * 100f), (int)(base.maxPitch * 100f)) / 100f;
			if (cancelActiveSFXOnItemActivate)
			{
				base.noiseAudio.Stop();
				base.noiseAudioFar.Stop();
			}
			if (useDynamicCooldown && !cancelActiveSFXOnItemActivate)
			{
				((GrabbableObject)this).currentUseCooldown = audioClip.length;
			}
			base.noiseAudio.pitch = pitch;
			base.noiseAudio.PlayOneShot(audioClip, num);
			if ((Object)(object)base.noiseAudioFar != (Object)null && (Object)(object)audioClipFar != (Object)null)
			{
				base.noiseAudioFar.pitch = pitch;
				base.noiseAudioFar.PlayOneShot(audioClipFar, num);
			}
			if ((Object)(object)base.triggerAnimator != (Object)null)
			{
				base.triggerAnimator.SetTrigger("playAnim");
			}
			WalkieTalkie.TransmitOneShotAudio(base.noiseAudio, audioClip, num);
			RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, base.noiseRange, num, 0, ((GrabbableObject)this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
			if (base.minLoudness >= 0.6f && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
			{
				((GrabbableObject)this).playerHeldBy.timeSinceMakingLoudNoise = 0f;
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_AdvancedNoisemakerProp()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3879375848u, new RpcReceiveHandler(__rpc_handler_3879375848));
			NetworkManager.__rpc_func_table.Add(1515505519u, new RpcReceiveHandler(__rpc_handler_1515505519));
		}

		private static void __rpc_handler_3879375848(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int index = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref index);
				int fromPlayerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref fromPlayerId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((AdvancedNoisemakerProp)(object)target).PlaySoundServerRpc(index, fromPlayerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1515505519(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int index = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref index);
				int fromPlayerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref fromPlayerId);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((AdvancedNoisemakerProp)(object)target).PlaySoundClientRpc(index, fromPlayerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "AdvancedNoisemakerProp";
		}
	}
	public class AdvancedRadioNoisemakerProp : AdvancedNoisemakerProp
	{
		[HideInInspector]
		public NetworkVariable<bool> isRadioModeEnabled = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		[HideInInspector]
		public NetworkVariable<bool> isRadioMode = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		[HideInInspector]
		public NetworkVariable<int> clipIndex = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public override void OnNetworkSpawn()
		{
			NetworkVariable<bool> obj = isRadioMode;
			obj.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(OnIsRadioModeChanged));
			NetworkVariable<int> obj2 = clipIndex;
			obj2.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Combine((Delegate?)(object)obj2.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(OnClipIndexChanged));
			isRadioModeEnabled.Value = Plugin.ConfigManager.EnableRadioMode;
		}

		public override void LoadItemSaveData(int saveData)
		{
			base.LoadItemSaveData(saveData);
			bool flag = SaveLoadHandler.LoadData<bool>(base.saveKey + "_isRadioMode", (SaveLocation)0, false, true);
			int value = SaveLoadHandler.LoadData<int>(base.saveKey + "_clipIndex", (SaveLocation)0, 0, true);
			isRadioMode.Value = isRadioModeEnabled.Value && flag;
			clipIndex.Value = value;
		}

		public override int GetItemDataToSave()
		{
			SaveItemData();
			return base.GetItemDataToSave();
		}

		private void SaveItemData()
		{
			SaveLoadHandler.SaveData<bool>(isRadioMode.Value, base.saveKey + "_isRadioMode", (SaveLocation)0, true);
			SaveLoadHandler.SaveData<int>(clipIndex.Value, base.saveKey + "_clipIndex", (SaveLocation)0, true);
		}

		public override void OnNetworkDespawn()
		{
			NetworkVariable<bool> obj = isRadioMode;
			obj.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Remove((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(OnIsRadioModeChanged));
			NetworkVariable<int> obj2 = clipIndex;
			obj2.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Remove((Delegate?)(object)obj2.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(OnClipIndexChanged));
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
			{
				((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = true;
			}
		}

		public override void DiscardItem()
		{
			if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
			{
				((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = false;
			}
			((GrabbableObject)this).DiscardItem();
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			if (base.canActivateItem)
			{
				int index = Random.Range(0, ((NoisemakerProp)this).noiseSFX.Length);
				if (isRadioMode.Value)
				{
					index = clipIndex.Value;
				}
				PlaySound(index);
			}
		}

		public override void ItemInteractLeftRight(bool right)
		{
			((GrabbableObject)this).ItemInteractLeftRight(right);
			if (base.isHeldByLocalPlayer)
			{
				if (right)
				{
					ItemInteractRight();
				}
				else
				{
					ItemInteractLeft();
				}
			}
		}

		private void ItemInteractLeft()
		{
			if (isRadioModeEnabled.Value)
			{
				SetIsRadioMode(!isRadioMode.Value);
				SaveItemData();
			}
		}

		private void ItemInteractRight()
		{
			if (isRadioMode.Value)
			{
				SetClipIndex(GetNextClipIndex());
				SaveItemData();
			}
		}

		private int GetNextClipIndex()
		{
			int num = clipIndex.Value + 1;
			if (num > ((NoisemakerProp)this).noiseSFX.Length - 1)
			{
				num = 0;
			}
			return num;
		}

		public override void SetControlTipsForItem()
		{
			SetControlTips();
		}

		private void SetControlTips()
		{
			if (base.isHeldByLocalPlayer)
			{
				if (isRadioMode.Value)
				{
					SetRadioControlTips();
				}
				else
				{
					SetDefaultControlTips();
				}
			}
		}

		private void SetDefaultControlTips()
		{
			string[] arrayWithMinLength = GetArrayWithMinLength(((GrabbableObject)this).itemProperties.toolTips, 3);
			arrayWithMinLength[0] = "Squeeze : [LMB]";
			arrayWithMinLength[1] = (isRadioModeEnabled.Value ? "Switch Mode : [Q]" : string.Empty);
			arrayWithMinLength[2] = string.Empty;
			HUDManager.Instance.ChangeControlTipMultiple(arrayWithMinLength, base.isHeldByLocalPlayer, ((GrabbableObject)this).itemProperties);
		}

		private void SetRadioControlTips()
		{
			string[] arrayWithMinLength = GetArrayWithMinLength(((GrabbableObject)this).itemProperties.toolTips, 3);
			arrayWithMinLength[0] = $"Squeeze #{clipIndex.Value} : [LMB]";
			arrayWithMinLength[1] = "Switch Mode : [Q]";
			arrayWithMinLength[2] = "Next Clip : [E]";
			HUDManager.Instance.ChangeControlTipMultiple(arrayWithMinLength, base.isHeldByLocalPlayer, ((GrabbableObject)this).itemProperties);
		}

		private void SetIsRadioMode(bool enabled)
		{
			if (base.isHostOrServer)
			{
				isRadioMode.Value = enabled;
			}
			else
			{
				SetIsRadioModeServerRpc(enabled);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void SetIsRadioModeServerRpc(bool enabled)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3305914366u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref enabled, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3305914366u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					isRadioMode.Value = enabled;
				}
			}
		}

		private void OnIsRadioModeChanged(bool previous, bool current)
		{
			SetControlTips();
		}

		private void SetClipIndex(int index)
		{
			if (base.isHostOrServer)
			{
				clipIndex.Value = index;
			}
			else
			{
				SetClipIndexServerRpc(index);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void SetClipIndexServerRpc(int index)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1409473325u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, index);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1409473325u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					clipIndex.Value = index;
				}
			}
		}

		private void OnClipIndexChanged(int previous, int current)
		{
			SetControlTips();
		}

		private string[] GetArrayWithMinLength(string[] array, int minLength)
		{
			List<string> list = array.ToList();
			int num = minLength - list.Count;
			if (num < 0)
			{
				num = 0;
			}
			for (int i = 0; i < num; i++)
			{
				list.Add(string.Empty);
			}
			return list.ToArray();
		}

		protected override void __initializeVariables()
		{
			if (isRadioModeEnabled == null)
			{
				throw new Exception("AdvancedRadioNoisemakerProp.isRadioModeEnabled cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)isRadioModeEnabled).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)isRadioModeEnabled, "isRadioModeEnabled");
			((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)isRadioModeEnabled);
			if (isRadioMode == null)
			{
				throw new Exception("AdvancedRadioNoisemakerProp.isRadioMode cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)isRadioMode).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)isRadioMode, "isRadioMode");
			((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)isRadioMode);
			if (clipIndex == null)
			{
				throw new Exception("AdvancedRadioNoisemakerProp.clipIndex cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)clipIndex).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)clipIndex, "clipIndex");
			((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)clipIndex);
			base.__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_AdvancedRadioNoisemakerProp()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3305914366u, new RpcReceiveHandler(__rpc_handler_3305914366));
			NetworkManager.__rpc_func_table.Add(1409473325u, new RpcReceiveHandler(__rpc_handler_1409473325));
		}

		private static void __rpc_handler_3305914366(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool isRadioModeServerRpc = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isRadioModeServerRpc, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((AdvancedRadioNoisemakerProp)(object)target).SetIsRadioModeServerRpc(isRadioModeServerRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1409473325(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int clipIndexServerRpc = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref clipIndexServerRpc);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((AdvancedRadioNoisemakerProp)(object)target).SetClipIndexServerRpc(clipIndexServerRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "AdvancedRadioNoisemakerProp";
		}
	}
	internal class PluginNetworkBehaviour : NetworkBehaviour
	{
		public static PluginNetworkBehaviour Instance;

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

		[ServerRpc]
		public void SpawnExplosionServerRpc(Vector3 position, int damage, float maxDamageRange)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Invalid comparison between Unknown and I4
			//IL_0138: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2232256189u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
				BytePacker.WriteValueBitPacked(val2, damage);
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref maxDamageRange, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2232256189u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				SpawnExplosionClientRpc(position, damage, maxDamageRange);
			}
		}

		[ClientRpc]
		public void SpawnExplosionClientRpc(Vector3 position, int damage, float maxDamageRange)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: 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_00fc: 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(3392826419u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
					BytePacker.WriteValueBitPacked(val2, damage);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref maxDamageRange, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3392826419u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !Plugin.IsHostOrServer)
				{
					Utils.CreateExplosion(position, spawnExplosionEffect: true, damage, 0f, maxDamageRange, 6, (CauseOfDeath)3);
				}
			}
		}

		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
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(2232256189u, new RpcReceiveHandler(__rpc_handler_2232256189));
			NetworkManager.__rpc_func_table.Add(3392826419u, new RpcReceiveHandler(__rpc_handler_3392826419));
		}

		private static void __rpc_handler_2232256189(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0029: 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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
				return;
			}
			Vector3 position = default(Vector3);
			((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
			int damage = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref damage);
			float maxDamageRange = default(float);
			((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref maxDamageRange, default(ForPrimitives));
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((PluginNetworkBehaviour)(object)target).SpawnExplosionServerRpc(position, damage, maxDamageRange);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}

		private static void __rpc_handler_3392826419(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: 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);
				int damage = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref damage);
				float maxDamageRange = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref maxDamageRange, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((PluginNetworkBehaviour)(object)target).SpawnExplosionClientRpc(position, damage, maxDamageRange);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "PluginNetworkBehaviour";
		}
	}
	internal class Takey : AdvancedRadioNoisemakerProp
	{
		[Header("Takey")]
		[Space(3f)]
		public ScanNodeProperties scanNodeProperties = null;

		public GameObject jetpackObject = null;

		public GameObject flameEffectsObject = null;

		public AudioSource jetpackAudio = null;

		public AudioSource jetpackThrustAudio = null;

		public AudioSource jetpackBeepAudio = null;

		public AudioSource jetpackWarningBeepAudio = null;

		public AudioClip jetpackThrustStartSFX = null;

		public AudioClip liftOffSFX = null;

		public AudioClip liftOffSFXFar = null;

		public float flySpeed = 0.2f;

		public float maxFlySpeed = 2f;

		public float flySpeedMultiplier = 1.2f;

		public float hoverY = 2f;

		public float hoverSpeed = 5f;

		public float hoverRange = 0.5f;

		[HideInInspector]
		public NetworkVariable<bool> isEvil = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public bool isFlying { get; private set; }

		public bool isHovering { get; private set; }

		public override void OnNetworkSpawn()
		{
			base.OnNetworkSpawn();
			if (Plugin.IsHostOrServer)
			{
				isEvil.Value = GetIsEvilRoll();
			}
		}

		public override void InteractItem()
		{
			((GrabbableObject)this).InteractItem();
			if (isEvil.Value && !isFlying && !((GrabbableObject)this).isHeld)
			{
				StartFlyingServerRpc();
			}
			else if (((GrabbableObject)this).grabbable)
			{
				StopFlyingServerRpc();
			}
		}

		public override void DiscardItem()
		{
			base.DiscardItem();
			RollIsEvilServerRpc();
		}

		[ServerRpc(RequireOwnership = false)]
		public void StartFlyingServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(492595741u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 492595741u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					isEvil.Value = false;
					float flyDuration = Plugin.ConfigManager.FlyDuration;
					StartFlyingClientRpc(flyDuration);
				}
			}
		}

		[ClientRpc]
		public void StartFlyingClientRpc(float flyDuration)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2016010317u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref flyDuration, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2016010317u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					((MonoBehaviour)this).StopAllCoroutines();
					((MonoBehaviour)this).StartCoroutine(StartFlyingOnLocalClient(flyDuration));
					SetScanNodeEvil();
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void StopFlyingServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3000815762u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3000815762u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					StopFlyingClientRpc();
				}
			}
		}

		[ClientRpc]
		public void StopFlyingClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3937760835u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3937760835u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					((MonoBehaviour)this).StopAllCoroutines();
					((GrabbableObject)this).grabbable = true;
					isFlying = false;
					isHovering = false;
					jetpackObject.SetActive(false);
					flameEffectsObject.SetActive(false);
					((NoisemakerProp)this).noiseAudio.Stop();
					((NoisemakerProp)this).noiseAudioFar.Stop();
					jetpackAudio.Stop();
					jetpackThrustAudio.Stop();
					jetpackBeepAudio.Stop();
					jetpackWarningBeepAudio.Stop();
					SetScanNodeDefault();
					((GrabbableObject)this).currentUseCooldown = 0f;
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void RollIsEvilServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(947337054u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 947337054u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && !isEvil.Value)
				{
					isEvil.Value = GetIsEvilRoll();
				}
			}
		}

		private IEnumerator StartFlyingOnLocalClient(float flyDuration)
		{
			isFlying = true;
			isHovering = false;
			((GrabbableObject)this).grabbable = false;
			jetpackObject.SetActive(true);
			PlaySoundOnLocalClient(liftOffSFX, liftOffSFXFar);
			jetpackAudio.PlayOneShot(jetpackThrustStartSFX);
			jetpackBeepAudio.Play();
			yield return (object)new WaitForSeconds(0.3f);
			flameEffectsObject.SetActive(true);
			jetpackThrustAudio.Play();
			float startY = ((Component)this).transform.localPosition.y;
			float hoverPositionY = 0f;
			float speed = flySpeed;
			float timer = 0f;
			float hoverTime = 0f;
			for (; !(timer > flyDuration); timer += Time.deltaTime)
			{
				Vector3 position = ((Component)this).transform.localPosition;
				speed += flySpeedMultiplier * Time.deltaTime;
				if (speed > maxFlySpeed)
				{
					speed = maxFlySpeed;
				}
				if (!isHovering)
				{
					position.y += speed * Time.deltaTime;
				}
				else
				{
					position.y = hoverPositionY + Mathf.Sin(hoverTime * hoverSpeed) * hoverRange;
					hoverTime += Time.deltaTime;
				}
				float yOffset = position.y - startY;
				if (!isHovering && yOffset >= hoverY)
				{
					hoverPositionY = position.y;
					isHovering = true;
					((GrabbableObject)this).grabbable = true;
				}
				if (timer >= flyDuration - 1f && !jetpackWarningBeepAudio.isPlaying)
				{
					jetpackBeepAudio.Stop();
					jetpackWarningBeepAudio.Play();
				}
				((Component)this).transform.localPosition = position;
				yield return null;
			}
			if (!((GrabbableObject)this).isHeld && !((GrabbableObject)this).isPocketed)
			{
				flameEffectsObject.SetActive(false);
				jetpackAudio.Stop();
				jetpackBeepAudio.Stop();
				jetpackWarningBeepAudio.Stop();
				jetpackThrustAudio.Stop();
				if (Plugin.IsHostOrServer)
				{
					int damage = Plugin.ConfigManager.ExplosionDamage;
					float maxDamageRange = Plugin.ConfigManager.MaxExplosionRange;
					PluginNetworkBehaviour.Instance.SpawnExplosionServerRpc(((Component)this).transform.position, damage, maxDamageRange);
					Utils.CreateExplosion(((Component)this).transform.position, spawnExplosionEffect: true, damage, 0f, maxDamageRange, 6, (CauseOfDeath)3);
					((Component)this).GetComponent<NetworkObject>().Despawn(true);
				}
			}
		}

		public override void Update()
		{
			if (isEvil.Value)
			{
				((GrabbableObject)this).grabbable = false;
			}
			if (!isFlying && !isHovering)
			{
				((GrabbableObject)this).Update();
			}
		}

		private bool GetIsEvilRoll()
		{
			return Utils.RandomPercent(Plugin.ConfigManager.EvilTakeyChance);
		}

		private void SetScanNodeDefault()
		{
			scanNodeProperties.headerText = ((GrabbableObject)this).itemProperties.itemName;
			scanNodeProperties.nodeType = 2;
		}

		private void SetScanNodeEvil()
		{
			scanNodeProperties.headerText = "Evil Smol Takey";
			scanNodeProperties.nodeType = 1;
		}

		protected override void __initializeVariables()
		{
			if (isEvil == null)
			{
				throw new Exception("Takey.isEvil cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)isEvil).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)isEvil, "isEvil");
			((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)isEvil);
			base.__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_Takey()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(492595741u, new RpcReceiveHandler(__rpc_handler_492595741));
			NetworkManager.__rpc_func_table.Add(2016010317u, new RpcReceiveHandler(__rpc_handler_2016010317));
			NetworkManager.__rpc_func_table.Add(3000815762u, new RpcReceiveHandler(__rpc_handler_3000815762));
			NetworkManager.__rpc_func_table.Add(3937760835u, new RpcReceiveHandler(__rpc_handler_3937760835));
			NetworkManager.__rpc_func_table.Add(947337054u, new RpcReceiveHandler(__rpc_handler_947337054));
		}

		private static void __rpc_handler_492595741(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Takey)(object)target).StartFlyingServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2016010317(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				float flyDuration = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref flyDuration, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((Takey)(object)target).StartFlyingClientRpc(flyDuration);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3000815762(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Takey)(object)target).StopFlyingServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3937760835(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((Takey)(object)target).StopFlyingClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_947337054(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Takey)(object)target).RollIsEvilServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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