Decompiled source of ZombiesPlush v1.0.5

com.github.zehsteam.ZombiesPlush.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 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.ZombiesPlush.Compatibility;
using com.github.zehsteam.ZombiesPlush.MonoBehaviours;
using com.github.zehsteam.ZombiesPlush.NetcodePatcher;
using com.github.zehsteam.ZombiesPlush.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.ZombiesPlush")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Adds a customizable Zombies plushie scrap item with complex interactions/behaviors and other secrets. \ud83d\ude08")]
[assembly: AssemblyFileVersion("1.0.5.0")]
[assembly: AssemblyInformationalVersion("1.0.5+83040b00504ba6b7e62f20744b238a56c911e1c7")]
[assembly: AssemblyProduct("ZombiesPlush")]
[assembly: AssemblyTitle("com.github.zehsteam.ZombiesPlush")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.5.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.ZombiesPlush
{
	public class Api
	{
		public static bool ForceMaskedZombiesSpawns
		{
			get
			{
				return MaskedPlayerEnemyPatch.ForceMaskedZombiesSpawns;
			}
			set
			{
				MaskedPlayerEnemyPatch.ForceMaskedZombiesSpawns = value;
			}
		}

		[Obsolete("forceMaskedZombiesSpawns is deprecated, please use ForceMaskedZombiesSpawns instead.", true)]
		public static bool forceMaskedZombiesSpawns
		{
			get
			{
				return MaskedPlayerEnemyPatch.ForceMaskedZombiesSpawns;
			}
			set
			{
				MaskedPlayerEnemyPatch.ForceMaskedZombiesSpawns = value;
			}
		}

		public static bool SetMaskedZombiesOnServer(MaskedPlayerEnemy maskedPlayerEnemy)
		{
			return MaskedPlayerEnemyPatch.SetMaskedZombiesOnServer(maskedPlayerEnemy);
		}
	}
	internal class ConfigManager
	{
		private ConfigEntry<bool> ExtendedLoggingCfg;

		private ConfigEntry<int> SpawnWeightCfg;

		private ConfigEntry<bool> TwoHandedCfg;

		private ConfigEntry<int> CarryWeightCfg;

		private ConfigEntry<int> MinValueCfg;

		private ConfigEntry<int> MaxValueCfg;

		private ConfigEntry<float> VoiceLineVolumeCfg;

		private ConfigEntry<float> SingingVolumeCfg;

		private ConfigEntry<int> MaskedZombiesSpawnChanceCfg;

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

		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 VoiceLineVolume
		{
			get
			{
				return VoiceLineVolumeCfg.Value;
			}
			set
			{
				VoiceLineVolumeCfg.Value = value;
			}
		}

		internal float SingingVolume
		{
			get
			{
				return SingingVolumeCfg.Value;
			}
			set
			{
				SingingVolumeCfg.Value = value;
			}
		}

		internal int MaskedZombiesSpawnChance
		{
			get
			{
				return MaskedZombiesSpawnChanceCfg.Value;
			}
			set
			{
				MaskedZombiesSpawnChanceCfg.Value = value;
			}
		}

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

		private void BindConfigs()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0033: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			//IL_0060: Expected O, but got Unknown
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_008c: Expected O, but got Unknown
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Expected O, but got Unknown
			//IL_00b9: Expected O, but got Unknown
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Expected O, but got Unknown
			//IL_00e6: Expected O, but got Unknown
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Expected O, but got Unknown
			//IL_0116: Expected O, but got Unknown
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Expected O, but got Unknown
			//IL_0154: Expected O, but got Unknown
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Expected O, but got Unknown
			//IL_0192: Expected O, but got Unknown
			//IL_01a3: 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_01c6: Expected O, but got Unknown
			//IL_01c6: Expected O, but got Unknown
			ConfigFile config = ((BaseUnityPlugin)Plugin.Instance).Config;
			ExtendedLoggingCfg = config.Bind<bool>(new ConfigDefinition("General Settings", "ExtendedLogging"), false, new ConfigDescription("Enable extended logging.", (AcceptableValueBase)null, Array.Empty<object>()));
			SpawnWeightCfg = config.Bind<int>(new ConfigDefinition("Plushie Settings", "SpawnWeight"), 10, new ConfigDescription("Zombies plush spawn chance weight.", (AcceptableValueBase)null, Array.Empty<object>()));
			TwoHandedCfg = config.Bind<bool>(new ConfigDefinition("Plushie Settings", "TwoHanded"), false, new ConfigDescription("If enabled, the Zombies plush will be two-handed.", (AcceptableValueBase)null, Array.Empty<object>()));
			CarryWeightCfg = config.Bind<int>(new ConfigDefinition("Plushie Settings", "CarryWeight"), 12, new ConfigDescription("Zombies plush carry weight in pounds.", (AcceptableValueBase)null, Array.Empty<object>()));
			MinValueCfg = config.Bind<int>(new ConfigDefinition("Plushie Settings", "MinValue"), 80, new ConfigDescription("Zombies plush min scrap value.", (AcceptableValueBase)null, Array.Empty<object>()));
			MaxValueCfg = config.Bind<int>(new ConfigDefinition("Plushie Settings", "MaxValue"), 250, new ConfigDescription("Zombies plush max scrap value.", (AcceptableValueBase)null, Array.Empty<object>()));
			VoiceLineVolumeCfg = config.Bind<float>(new ConfigDefinition("Plushie Settings", "VoiceLineVolume"), 80f, new ConfigDescription("Zombies plush voice line volume percent. (0 to 100)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
			SingingVolumeCfg = config.Bind<float>(new ConfigDefinition("Plushie Settings", "SingingVolume"), 80f, new ConfigDescription("Zombies plush singing volume percent. (0 to 100)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
			MaskedZombiesSpawnChanceCfg = config.Bind<int>(new ConfigDefinition("Masked Settings", "MaskedZombiesSpawnChance"), 25, new ConfigDescription("The percent chance a Masked enemy will turn into a Masked Zombies enemy. (0 to 100)", (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 Item ZombiesPlush;

		public static Item Poop;

		public static Item GoldenPoop;

		public static GameObject MaskedZombiesControllerPrefab;

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

		private static void LoadAssetsFromAssetBundle()
		{
			try
			{
				string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)Plugin.Instance).Info.Location);
				string text = Path.Combine(directoryName, "zombiesplush_assets");
				AssetBundle val = AssetBundle.LoadFromFile(text);
				NetworkHandlerPrefab = val.LoadAsset<GameObject>("NetworkHandler");
				NetworkHandlerPrefab.AddComponent<PluginNetworkBehaviour>();
				ZombiesPlush = val.LoadAsset<Item>("ZombiesPlush");
				Poop = val.LoadAsset<Item>("Poop");
				GoldenPoop = val.LoadAsset<Item>("GoldenPoop");
				MaskedZombiesControllerPrefab = val.LoadAsset<GameObject>("MaskedZombiesController");
				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}");
			}
		}
	}
	[Serializable]
	public struct AudioClipGroup
	{
		public AudioClip normalAudioClip;

		public AudioClip farAudioClip;
	}
	[Serializable]
	public class AudioSourceGroup
	{
		public AudioSource normalAudioSource;

		public AudioSource farAudioSource;

		public float volume
		{
			get
			{
				return normalAudioSource.volume;
			}
			set
			{
				normalAudioSource.volume = value;
				farAudioSource.volume = value;
			}
		}

		public bool isPlaying => normalAudioSource.isPlaying && farAudioSource.isPlaying;

		public void Play()
		{
			normalAudioSource.Play();
			farAudioSource.Play();
		}

		public void Stop()
		{
			normalAudioSource.Stop();
			farAudioSource.Stop();
		}
	}
	internal class PlayerUtils
	{
		public static ulong GetLocalClientId()
		{
			return NetworkManager.Singleton.LocalClientId;
		}

		public static bool IsLocalClientId(ulong clientId)
		{
			return clientId == GetLocalClientId();
		}

		public static ulong GetPlayerId(PlayerControllerB playerScript)
		{
			return playerScript.playerClientId;
		}

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

		public static bool IsLocalPlayerId(ulong playerId)
		{
			return playerId == GetLocalPlayerId();
		}

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

		public static List<ZombiesBehaviour> GetZombiesPlushiesFromLocalPlayer()
		{
			List<ZombiesBehaviour> list = new List<ZombiesBehaviour>();
			GrabbableObject[] itemSlots = GetLocalPlayerScript().ItemSlots;
			ZombiesBehaviour item = default(ZombiesBehaviour);
			foreach (GrabbableObject val in itemSlots)
			{
				if (!((Object)(object)val == (Object)null) && ((Component)val).gameObject.TryGetComponent<ZombiesBehaviour>(ref item))
				{
					list.Add(item);
				}
			}
			return list;
		}
	}
	[BepInPlugin("com.github.zehsteam.ZombiesPlush", "ZombiesPlush", "1.0.5")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[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.ZombiesPlush");

		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.ZombiesPlush");
			logger.LogInfo((object)"ZombiesPlush has awoken!");
			harmony.PatchAll(typeof(GameNetworkManagerPatch));
			harmony.PatchAll(typeof(StartOfRoundPatch));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
			harmony.PatchAll(typeof(MaskedPlayerEnemyPatch));
			ConfigManager = new ConfigManager();
			Content.Load();
			TakeyPlushCompat.Initialize();
			EmergencyDiceCompat.Initialize();
			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);
					}
				}
			}
		}

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

		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.ZombiesPlush, spawnWeight, twoHanded, carryWeight, minValue, maxValue);
			ScrapHelper.RegisterScrap(Content.Poop, 0);
			ScrapHelper.RegisterScrap(Content.GoldenPoop, 24);
		}

		public void LogInfoExtended(object data)
		{
			if (ConfigManager.ExtendedLogging)
			{
				logger.LogInfo(data);
			}
		}
	}
	internal class ScrapHelper
	{
		public static void RegisterScrap(Item item, int carryWeight)
		{
			item.weight = (float)carryWeight / 105f + 1f;
			NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab);
			Items.RegisterScrap(item, 0, (LevelTypes)1);
			Plugin.logger.LogInfo((object)$"Registered \"{item.itemName}\" scrap item with {0} rarity.");
		}

		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 NetworkObject SpawnGiftBoxOnServer(Vector3 position, int scrapValue)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.IsHostOrServer)
			{
				return null;
			}
			return SpawnItemOnServer("Gift", position, scrapValue);
		}

		public static NetworkObject SpawnEasterEggOnServer(Vector3 position, int scrapValue)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.IsHostOrServer)
			{
				return null;
			}
			return SpawnItemOnServer("Easter egg", position, scrapValue);
		}

		public static NetworkObject SpawnPoopOnServer(Vector3 position, int scrapValue, bool isGolden = false)
		{
			//IL_002c: 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 (!Plugin.IsHostOrServer)
			{
				return null;
			}
			if (isGolden)
			{
				return SpawnItemOnServer("Golden Poop", position, scrapValue);
			}
			return SpawnItemOnServer("Poop", position, scrapValue);
		}

		public static NetworkObject SpawnItemOnServer(string itemName, Vector3 position, int scrapValue)
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: 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_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.IsHostOrServer)
			{
				return null;
			}
			Item itemByName = GetItemByName(itemName);
			if ((Object)(object)itemByName == (Object)null)
			{
				Plugin.logger.LogError((object)$"Error: Failed to spawn \"{itemName}\" item at position: ({position.x}, {position.y}, {position.z}). Could not find item \"{itemName}\".");
				return null;
			}
			GameObject val = Object.Instantiate<GameObject>(itemByName.spawnPrefab, position, Quaternion.identity);
			GrabbableObject val2 = default(GrabbableObject);
			if (val.TryGetComponent<GrabbableObject>(ref val2))
			{
				((Component)val2).transform.rotation = Quaternion.Euler(val2.itemProperties.restingRotation);
				val2.fallTime = 0f;
				val2.SetScrapValue(scrapValue);
				NetworkObject component = val.GetComponent<NetworkObject>();
				component.Spawn(false);
				PluginNetworkBehaviour.Instance.SetScrapValueClientRpc(NetworkObjectReference.op_Implicit(component), scrapValue);
				Plugin.Instance.LogInfoExtended($"Successfully spawned \"{itemByName.itemName}\" at position: ({position.x}, {position.y}, {position.z})");
				return component;
			}
			Object.Destroy((Object)(object)val);
			Plugin.logger.LogError((object)$"Error: Failed to spawn \"{itemName}\" item at position: ({position.x}, {position.y}, {position.z}). Could not find GrabbableObject.");
			return null;
		}

		public static Item GetItemByName(string itemName)
		{
			foreach (Item items in StartOfRound.Instance.allItemsList.itemsList)
			{
				if (items.itemName == itemName)
				{
					return items;
				}
			}
			return null;
		}
	}
	internal class Utils
	{
		public static string GetEnumName(object e)
		{
			try
			{
				return Enum.GetName(e.GetType(), e);
			}
			catch
			{
				return string.Empty;
			}
		}

		public static bool RandomPercent(float percent)
		{
			if (percent <= 0f)
			{
				return false;
			}
			if (percent >= 100f)
			{
				return true;
			}
			return Random.value <= percent * 0.01f;
		}

		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_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0331: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			Plugin.logger.LogInfo((object)$"Spawning explosion at position: (x: {explosionPosition.x}, y: {explosionPosition.y}, z: {explosionPosition.z})");
			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)
					{
						Plugin.logger.LogInfo((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 bool IsNearbyEnemy(Vector3 position, float radius = 15f, bool dangerousEnemiesOnly = true)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies)
			{
				if (spawnedEnemy.isEnemyDead || (dangerousEnemiesOnly && !IsDangerousEnemy(spawnedEnemy)) || !(Vector3.Distance(position, ((Component)spawnedEnemy).transform.position) <= radius))
				{
					continue;
				}
				return true;
			}
			return false;
		}

		public static bool IsDangerousEnemy(EnemyAI enemyAI)
		{
			string enemyName = enemyAI.enemyType.enemyName;
			if (enemyName == "Docile Locust Bees")
			{
				return false;
			}
			if (enemyName == "Manticoil")
			{
				return false;
			}
			return true;
		}

		public static AudioClip[] GetNormalAudioClipsArray(AudioClipGroup[] audioClipGroup)
		{
			return audioClipGroup.Select((AudioClipGroup _) => _.normalAudioClip).ToArray();
		}

		public static AudioClip[] GetFarAudioClipsArray(AudioClipGroup[] audioClipGroup)
		{
			return audioClipGroup.Select((AudioClipGroup _) => _.farAudioClip).ToArray();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "com.github.zehsteam.ZombiesPlush";

		public const string PLUGIN_NAME = "ZombiesPlush";

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

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

		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(MaskedPlayerEnemy))]
	internal class MaskedPlayerEnemyPatch
	{
		private static Dictionary<MaskedPlayerEnemy, MaskedZombiesBehaviour> MaskedZombiesPairs = new Dictionary<MaskedPlayerEnemy, MaskedZombiesBehaviour>();

		public static bool ForceMaskedZombiesSpawns = false;

		public static void Reset()
		{
			if (!Plugin.IsHostOrServer)
			{
				return;
			}
			int num = 0;
			NetworkObject val = default(NetworkObject);
			foreach (MaskedZombiesBehaviour value in MaskedZombiesPairs.Values)
			{
				if (!((Object)(object)value == (Object)null) && ((NetworkBehaviour)value).IsSpawned && ((Component)value).TryGetComponent<NetworkObject>(ref val))
				{
					val.Despawn(true);
					num++;
					Plugin.Instance.LogInfoExtended("Despawned MaskedZombiesController.");
				}
			}
			Plugin.Instance.LogInfoExtended($"Finished despawning {num}/{MaskedZombiesPairs.Count} MaskedZombiesController(s).");
			MaskedZombiesPairs.Clear();
			ForceMaskedZombiesSpawns = false;
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void StartPatch(ref MaskedPlayerEnemy __instance)
		{
			if (Plugin.IsHostOrServer && (Utils.RandomPercent(Plugin.ConfigManager.MaskedZombiesSpawnChance) || ForceMaskedZombiesSpawns))
			{
				SetMaskedZombiesOnServer(__instance);
			}
		}

		public static bool SetMaskedZombiesOnServer(MaskedPlayerEnemy maskedPlayerEnemy)
		{
			if (!Plugin.IsHostOrServer)
			{
				return false;
			}
			if (MaskedZombiesPairs.ContainsKey(maskedPlayerEnemy))
			{
				Plugin.logger.LogError((object)"Error: Failed to set masked zombies on server. MaskedPlayerEnemy is already a masked zombies.");
				return false;
			}
			try
			{
				GameObject val = Object.Instantiate<GameObject>(Content.MaskedZombiesControllerPrefab, ((Component)maskedPlayerEnemy).transform);
				val.GetComponent<NetworkObject>().Spawn(false);
				val.transform.SetParent(((Component)maskedPlayerEnemy).transform);
				MaskedZombiesPairs.Add(maskedPlayerEnemy, val.GetComponent<MaskedZombiesBehaviour>());
				Plugin.Instance.LogInfoExtended("Spawned masked zombies.");
				return true;
			}
			catch (Exception arg)
			{
				Plugin.logger.LogError((object)$"Error: Failed to set masked zombies on server.\n\n{arg}");
			}
			return false;
		}

		[HarmonyPatch("killAnimation")]
		[HarmonyPrefix]
		private static void KillAnimationPatch(ref MaskedPlayerEnemy __instance)
		{
			SetZombiesHeadOnServer(__instance, ZombieState.Heart);
		}

		[HarmonyPatch("FinishKillAnimation")]
		[HarmonyPrefix]
		private static void FinishKillAnimationPatch(ref MaskedPlayerEnemy __instance)
		{
			SetZombiesHeadOnServer(__instance, ZombieState.Angry);
		}

		private static void SetZombiesHeadOnServer(MaskedPlayerEnemy maskedPlayerEnemy, ZombieState state)
		{
			if (Plugin.IsHostOrServer && MaskedZombiesPairs.TryGetValue(maskedPlayerEnemy, out var value))
			{
				value.SetZombiesHeadServerRpc(state);
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		private static float DrunkCheckCooldown = 1f;

		private static float DrunkCheckTimer = 0f;

		[HarmonyPatch("DamagePlayer")]
		[HarmonyPrefix]
		private static void DamagePlayerPatch(ref PlayerControllerB __instance, int damageNumber)
		{
			if (!Object.op_Implicit((Object)(object)__instance) == Object.op_Implicit((Object)(object)PlayerUtils.GetLocalPlayerScript()) || __instance.isPlayerDead || !__instance.AllowPlayerDeath() || damageNumber <= 0)
			{
				return;
			}
			List<ZombiesBehaviour> zombiesPlushiesFromLocalPlayer = PlayerUtils.GetZombiesPlushiesFromLocalPlayer();
			if (zombiesPlushiesFromLocalPlayer.Count == 0)
			{
				return;
			}
			foreach (ZombiesBehaviour item in zombiesPlushiesFromLocalPlayer)
			{
				item.OnLocalPlayerHoldingPlushieTookDamage();
			}
		}

		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void UpdatePatch(ref PlayerControllerB __instance)
		{
			if (!Object.op_Implicit((Object)(object)__instance) == Object.op_Implicit((Object)(object)PlayerUtils.GetLocalPlayerScript()) || __instance.isPlayerDead)
			{
				return;
			}
			if (__instance.drunkness > 0f)
			{
				if (DrunkCheckTimer <= 0f)
				{
					List<ZombiesBehaviour> zombiesPlushiesFromLocalPlayer = PlayerUtils.GetZombiesPlushiesFromLocalPlayer();
					if (zombiesPlushiesFromLocalPlayer.Count == 0)
					{
						return;
					}
					foreach (ZombiesBehaviour item in zombiesPlushiesFromLocalPlayer)
					{
						if (Plugin.IsHostOrServer)
						{
							item.SetDrunkOnServer();
						}
						else
						{
							item.SetDrunkServerRpc();
						}
					}
					DrunkCheckTimer = DrunkCheckCooldown;
				}
				DrunkCheckTimer -= Time.deltaTime;
			}
			else
			{
				DrunkCheckTimer = 0f;
			}
		}
	}
	[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("ShipHasLeft")]
		[HarmonyPostfix]
		private static void ShipHasLeftPatch()
		{
			Plugin.Instance.OnShipHasLeft();
		}
	}
}
namespace com.github.zehsteam.ZombiesPlush.MonoBehaviours
{
	public class AdvancedNoisemakerProp : NoisemakerProp
	{
		[Space(20f)]
		[Header("Advanced")]
		[Space(3f)]
		public bool useDynamicCooldown = false;

		public bool cancelActiveSFXOnItemActivate = false;

		public bool IsHostOrServer => Plugin.IsHostOrServer;

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

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

		public int uniqueId { get; private set; }

		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 ItemActivate(bool used, bool buttonDown = true)
		{
			if (canActivateItem)
			{
				int index = Random.Range(0, base.noiseSFX.Length);
				PlaySound(index);
			}
		}

		public void PlaySound(int index)
		{
			ulong fromClientId = (isHeldByLocalPlayer ? PlayerUtils.GetLocalClientId() : 10000);
			if (IsHostOrServer)
			{
				PlaySoundClientRpc(index, fromClientId);
			}
			else
			{
				PlaySoundServerRpc(index, fromClientId);
			}
			PlaySoundOnLocalClient(index, cancelActiveSFXOnItemActivate);
		}

		[ServerRpc(RequireOwnership = false)]
		protected void PlaySoundServerRpc(int index, ulong fromClientId)
		{
			//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(4192915908u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, index);
					BytePacker.WriteValueBitPacked(val2, fromClientId);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4192915908u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					PlaySoundClientRpc(index, fromClientId);
				}
			}
		}

		[ClientRpc]
		protected void PlaySoundClientRpc(int index, ulong fromClientId)
		{
			//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(4191135864u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, index);
					BytePacker.WriteValueBitPacked(val2, fromClientId);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4191135864u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !PlayerUtils.IsLocalClientId(fromClientId))
				{
					PlaySoundOnLocalClient(index, cancelActiveSFXOnItemActivate);
				}
			}
		}

		public void PlaySoundOnLocalClient(int index, bool stopCurrentSFX = false)
		{
			AudioClip audioClip = ((index < base.noiseSFX.Length) ? base.noiseSFX[index] : null);
			AudioClip audioClipFar = ((index < base.noiseSFXFar.Length) ? base.noiseSFXFar[index] : null);
			PlaySoundOnLocalClient(audioClip, audioClipFar, stopCurrentSFX);
		}

		public void PlaySoundOnLocalClient(AudioClipGroup[] audioClipGroups, int index, bool stopCurrentSFX = false)
		{
			if (audioClipGroups.Length != 0)
			{
				PlaySoundOnLocalClient(audioClipGroups[index], stopCurrentSFX);
			}
		}

		public void PlaySoundOnLocalClient(AudioClipGroup audioClipGroup, bool stopCurrentSFX = false)
		{
			PlaySoundOnLocalClient(audioClipGroup.normalAudioClip, audioClipGroup.farAudioClip, stopCurrentSFX);
		}

		public void PlaySoundOnLocalClient(AudioClip audioClip, AudioClip audioClipFar, bool stopCurrentSFX = false)
		{
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)audioClip == (Object)null)
			{
				return;
			}
			float num = (float)Random.Range((int)(base.minLoudness * 100f), (int)(base.maxLoudness * 100f)) / 100f;
			float pitch = (float)Random.Range((int)(base.minPitch * 100f), (int)(base.maxPitch * 100f)) / 100f;
			if (stopCurrentSFX)
			{
				base.noiseAudio.Stop();
				base.noiseAudioFar.Stop();
			}
			if (useDynamicCooldown)
			{
				float num2 = audioClip.length - 0.3f;
				if (num2 > ((GrabbableObject)this).currentUseCooldown)
				{
					((GrabbableObject)this).currentUseCooldown = num2;
				}
			}
			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(4192915908u, new RpcReceiveHandler(__rpc_handler_4192915908));
			NetworkManager.__rpc_func_table.Add(4191135864u, new RpcReceiveHandler(__rpc_handler_4191135864));
		}

		private static void __rpc_handler_4192915908(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);
				ulong fromClientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref fromClientId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((AdvancedNoisemakerProp)(object)target).PlaySoundServerRpc(index, fromClientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4191135864(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);
				ulong fromClientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref fromClientId);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((AdvancedNoisemakerProp)(object)target).PlaySoundClientRpc(index, fromClientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "AdvancedNoisemakerProp";
		}
	}
	public class EnemyRandomPeriodicAudioPlayer : NetworkBehaviour
	{
		public bool onlyPlayWhenEnemyIsAlive = true;

		public AudioClip[] randomClips = Array.Empty<AudioClip>();

		public AudioSource thisAudio = null;

		public float audioMinInterval = 6f;

		public float audioMaxInterval = 16f;

		public float audioChancePercent = 40f;

		private EnemyAI _enemyAI;

		private float _timer = 0f;

		private float _interval = 0f;

		private void Start()
		{
			_enemyAI = ((Component)((Component)this).transform.parent).GetComponent<EnemyAI>();
		}

		private void Update()
		{
			if (!Plugin.IsHostOrServer || (onlyPlayWhenEnemyIsAlive && (Object)(object)_enemyAI == (Object)null) || (onlyPlayWhenEnemyIsAlive && _enemyAI.isEnemyDead))
			{
				return;
			}
			if (_timer >= _interval)
			{
				if (Utils.RandomPercent(audioChancePercent))
				{
					PlayRandomAudioClientRpc(Random.Range(0, randomClips.Length));
				}
				_timer = 0f;
				_interval = Random.Range(audioChancePercent, audioMaxInterval);
			}
			else
			{
				_timer += Time.deltaTime;
			}
		}

		[ClientRpc]
		public void PlayRandomAudioClientRpc(int clipIndex)
		{
			//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(3922081718u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, clipIndex);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3922081718u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					PlayAudio(clipIndex);
				}
			}
		}

		private void PlayAudio(int clipIndex)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			AudioClip val = randomClips[clipIndex];
			thisAudio.PlayOneShot(val, 1f);
			WalkieTalkie.TransmitOneShotAudio(thisAudio, val, 1f);
			RoundManager.Instance.PlayAudibleNoise(((Component)thisAudio).transform.position, 7f, 0.6f, 0, false, 0);
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_EnemyRandomPeriodicAudioPlayer()
		{
			//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(3922081718u, new RpcReceiveHandler(__rpc_handler_3922081718));
		}

		private static void __rpc_handler_3922081718(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 clipIndex = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref clipIndex);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((EnemyRandomPeriodicAudioPlayer)(object)target).PlayRandomAudioClientRpc(clipIndex);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "EnemyRandomPeriodicAudioPlayer";
		}
	}
	public class MaskedZombiesBehaviour : NetworkBehaviour
	{
		public GameObject angryHeadPrefab = null;

		public GameObject heartHeadPrefab = null;

		public AudioClip elloSFX = null;

		public Material suitMaterial = null;

		private MaskedPlayerEnemy _maskedPlayerEnemy;

		private GameObject _angryHeadObject;

		private GameObject _heartHeadObject;

		private AudioSource _voiceAudio;

		private void Start()
		{
			_maskedPlayerEnemy = ((Component)((Component)this).transform.parent).GetComponent<MaskedPlayerEnemy>();
			SetupRandomPeriodicAudioPlayer();
			SetSuitMaterial();
			DisableMaskObjects();
			MoveMaskFloodParticleObject();
			SpawnZombiesHeadObjects();
			SetZombiesHeadOnLocalClient(ZombieState.Angry);
		}

		private void SetupRandomPeriodicAudioPlayer()
		{
			_voiceAudio = ((Component)((Component)this).transform.parent.Find("VoiceSFX")).GetComponent<AudioSource>();
			((Component)this).GetComponent<EnemyRandomPeriodicAudioPlayer>().thisAudio = _voiceAudio;
		}

		private void SetSuitMaterial()
		{
			if (!((Object)(object)suitMaterial == (Object)null))
			{
				Material[] materials = (Material[])(object)new Material[1] { suitMaterial };
				((Renderer)_maskedPlayerEnemy.rendererLOD0).materials = materials;
				((Renderer)_maskedPlayerEnemy.rendererLOD1).materials = materials;
				((Renderer)_maskedPlayerEnemy.rendererLOD2).materials = materials;
			}
		}

		private void DisableMaskObjects()
		{
			Transform maskedHeadTransform = GetMaskedHeadTransform();
			((Component)maskedHeadTransform.Find("HeadMaskComedy")).gameObject.SetActive(false);
			((Component)maskedHeadTransform.Find("HeadMaskTragedy")).gameObject.SetActive(false);
		}

		private void MoveMaskFloodParticleObject()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			Transform val = GetMaskedHeadTransform().Find("MaskFloodParticle");
			Vector3 localPosition = val.localPosition;
			localPosition.y = 0f;
			val.localPosition = localPosition;
		}

		private void SpawnZombiesHeadObjects()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			Transform maskedHeadTransform = GetMaskedHeadTransform();
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(0f, 0.184f, 0.019f);
			_angryHeadObject = Object.Instantiate<GameObject>(angryHeadPrefab, maskedHeadTransform);
			_angryHeadObject.transform.SetLocalPositionAndRotation(val, Quaternion.identity);
			_heartHeadObject = Object.Instantiate<GameObject>(heartHeadPrefab, maskedHeadTransform);
			_heartHeadObject.transform.SetLocalPositionAndRotation(val, Quaternion.identity);
		}

		[ServerRpc]
		public void SetZombiesHeadServerRpc(ZombieState state)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Invalid comparison between Unknown and I4
			//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_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: 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_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(3215858542u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<ZombieState>(ref state, default(ForEnums));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3215858542u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				SetZombiesHeadClientRpc(state);
				SetZombiesHeadOnLocalClient(state);
			}
		}

		[ClientRpc]
		public void SetZombiesHeadClientRpc(ZombieState state)
		{
			//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)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2781412922u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<ZombieState>(ref state, default(ForEnums));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2781412922u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !Plugin.IsHostOrServer)
				{
					SetZombiesHeadOnLocalClient(state);
				}
			}
		}

		public void SetZombiesHeadOnLocalClient(ZombieState state)
		{
			_angryHeadObject.SetActive(state == ZombieState.Angry);
			_heartHeadObject.SetActive(state == ZombieState.Heart);
			if (state == ZombieState.Heart)
			{
				PlayOneShotVoiceAudio(elloSFX);
			}
		}

		private void PlayOneShotVoiceAudio(AudioClip audioClip)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)audioClip == (Object)null))
			{
				_voiceAudio.PlayOneShot(audioClip);
				WalkieTalkie.TransmitOneShotAudio(_voiceAudio, audioClip, 1f);
				RoundManager.Instance.PlayAudibleNoise(((Component)_voiceAudio).transform.position, 7f, 0.6f, 0, false, 0);
			}
		}

		private Transform GetMaskedHeadTransform()
		{
			return ((Component)this).transform.parent.GetChild(0).GetChild(3).GetChild(0)
				.GetChild(0)
				.GetChild(0)
				.GetChild(0)
				.GetChild(2);
		}

		public override void OnNetworkDespawn()
		{
			Object.Destroy((Object)(object)_angryHeadObject);
			Object.Destroy((Object)(object)_heartHeadObject);
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_MaskedZombiesBehaviour()
		{
			//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(3215858542u, new RpcReceiveHandler(__rpc_handler_3215858542));
			NetworkManager.__rpc_func_table.Add(2781412922u, new RpcReceiveHandler(__rpc_handler_2781412922));
		}

		private static void __rpc_handler_3215858542(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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: 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_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!");
				}
			}
			else
			{
				ZombieState zombiesHeadServerRpc = default(ZombieState);
				((FastBufferReader)(ref reader)).ReadValueSafe<ZombieState>(ref zombiesHeadServerRpc, default(ForEnums));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((MaskedZombiesBehaviour)(object)target).SetZombiesHeadServerRpc(zombiesHeadServerRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2781412922(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)
			{
				ZombieState zombiesHeadClientRpc = default(ZombieState);
				((FastBufferReader)(ref reader)).ReadValueSafe<ZombieState>(ref zombiesHeadClientRpc, default(ForEnums));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((MaskedZombiesBehaviour)(object)target).SetZombiesHeadClientRpc(zombiesHeadClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

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

		[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_00f1: 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(627078499u, 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, 627078499u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					Utils.CreateExplosion(position, spawnExplosionEffect: true, damage, 0f, maxDamageRange, 6, (CauseOfDeath)3);
				}
			}
		}

		[ClientRpc]
		public void SetScrapValueClientRpc(NetworkObjectReference networkObjectReference, int scrapValue)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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(3390986894u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref networkObjectReference, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val2, scrapValue);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3390986894u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost) || Plugin.IsHostOrServer)
			{
				return;
			}
			NetworkObject val3 = default(NetworkObject);
			if (((NetworkObjectReference)(ref networkObjectReference)).TryGet(ref val3, (NetworkManager)null))
			{
				GrabbableObject val4 = default(GrabbableObject);
				if (((Component)val3).TryGetComponent<GrabbableObject>(ref val4))
				{
					val4.SetScrapValue(scrapValue);
				}
				else
				{
					Plugin.logger.LogError((object)"Error: Failed to set scrapValue on item. Could not find GrabbableObject.");
				}
			}
			else
			{
				Plugin.logger.LogError((object)"Error: Failed to set scrapValue on item. Could not find NetworkObject.");
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void DamagePlayerServerRpc(ulong targetPlayerId, int damage, CauseOfDeath causeOfDeath)
		{
			//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_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_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_00f4: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2617461259u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, targetPlayerId);
					BytePacker.WriteValueBitPacked(val2, damage);
					((FastBufferWriter)(ref val2)).WriteValueSafe<CauseOfDeath>(ref causeOfDeath, default(ForEnums));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2617461259u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					DamagePlayerClientRpc(targetPlayerId, damage, causeOfDeath);
				}
			}
		}

		[ClientRpc]
		public void DamagePlayerClientRpc(ulong targetPlayerId, int damage, CauseOfDeath causeOfDeath)
		{
			//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_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_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_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: 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(2134151679u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, targetPlayerId);
					BytePacker.WriteValueBitPacked(val2, damage);
					((FastBufferWriter)(ref val2)).WriteValueSafe<CauseOfDeath>(ref causeOfDeath, default(ForEnums));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2134151679u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && PlayerUtils.IsLocalPlayerId(targetPlayerId))
				{
					PlayerUtils.GetLocalPlayerScript().DamagePlayer(damage, true, true, causeOfDeath, 0, false, default(Vector3));
				}
			}
		}

		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
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(627078499u, new RpcReceiveHandler(__rpc_handler_627078499));
			NetworkManager.__rpc_func_table.Add(3390986894u, new RpcReceiveHandler(__rpc_handler_3390986894));
			NetworkManager.__rpc_func_table.Add(2617461259u, new RpcReceiveHandler(__rpc_handler_2617461259));
			NetworkManager.__rpc_func_table.Add(2134151679u, new RpcReceiveHandler(__rpc_handler_2134151679));
		}

		private static void __rpc_handler_627078499(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;
			}
		}

		private static void __rpc_handler_3390986894(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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference networkObjectReference = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref networkObjectReference, default(ForNetworkSerializable));
				int scrapValue = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref scrapValue);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((PluginNetworkBehaviour)(object)target).SetScrapValueClientRpc(networkObjectReference, scrapValue);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2617461259(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_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_0071: 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)
			{
				ulong targetPlayerId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref targetPlayerId);
				int damage = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref damage);
				CauseOfDeath causeOfDeath = default(CauseOfDeath);
				((FastBufferReader)(ref reader)).ReadValueSafe<CauseOfDeath>(ref causeOfDeath, default(ForEnums));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PluginNetworkBehaviour)(object)target).DamagePlayerServerRpc(targetPlayerId, damage, causeOfDeath);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2134151679(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_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_0071: 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)
			{
				ulong targetPlayerId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref targetPlayerId);
				int damage = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref damage);
				CauseOfDeath causeOfDeath = default(CauseOfDeath);
				((FastBufferReader)(ref reader)).ReadValueSafe<CauseOfDeath>(ref causeOfDeath, default(ForEnums));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((PluginNetworkBehaviour)(object)target).DamagePlayerClientRpc(targetPlayerId, damage, causeOfDeath);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "PluginNetworkBehaviour";
		}
	}
	public class PoopBehaviour : StunGrenadeItem
	{
		[Space(20f)]
		[Header("Poop")]
		[Space(5f)]
		public StunGrenadeItemDamageTrigger damageTrigger;

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			PlayerControllerB playerHeldBy = ((GrabbableObject)this).playerHeldBy;
			((StunGrenadeItem)this).ItemActivate(used, buttonDown);
			damageTrigger.WasThrown(playerHeldBy);
		}

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

		protected internal override string __getTypeName()
		{
			return "PoopBehaviour";
		}
	}
	[RequireComponent(typeof(BoxCollider))]
	public class StunGrenadeItemDamageTrigger : MonoBehaviour
	{
		public StunGrenadeItem stunGrenadeItem;

		public int playerDamage = 10;

		public int enemyDamage = 1;

		public float collisionCheckDuration = 3f;

		private PlayerControllerB _playerThrownBy = null;

		private bool _checkForCollision = false;

		private float _collisionCheckTimer = 0f;

		private void Start()
		{
			((Collider)((Component)this).GetComponent<BoxCollider>()).isTrigger = true;
		}

		public void WasThrown(PlayerControllerB playerThrownBy)
		{
			_checkForCollision = true;
			_playerThrownBy = playerThrownBy;
		}

		private void Update()
		{
			if (_checkForCollision)
			{
				if (_collisionCheckTimer >= collisionCheckDuration)
				{
					_collisionCheckTimer = 0f;
					_checkForCollision = false;
				}
				else
				{
					_collisionCheckTimer += Time.deltaTime;
				}
			}
		}

		private void OnTriggerEnter(Collider other)
		{
			if (!((GrabbableObject)stunGrenadeItem).isHeld && _checkForCollision)
			{
				CheckIfHitPlayer(other);
				CheckIfHitEnemy(other);
			}
		}

		private void CheckIfHitPlayer(Collider other)
		{
			GameObject gameObject = ((Component)other).gameObject;
			bool flag = false;
			if (((Object)gameObject).name == "PlayerPhysicsBox")
			{
				gameObject = ((Component)gameObject.transform.parent).gameObject;
				flag = true;
			}
			PlayerControllerB val = default(PlayerControllerB);
			if (gameObject.TryGetComponent<PlayerControllerB>(ref val) && !val.isPlayerDead && !((Object)(object)val == (Object)(object)_playerThrownBy) && (!flag || val.isHostPlayerObject) && (!flag || !Plugin.IsHostOrServer))
			{
				PluginNetworkBehaviour.Instance.DamagePlayerServerRpc(PlayerUtils.GetPlayerId(val), playerDamage, (CauseOfDeath)0);
				Plugin.Instance.LogInfoExtended($"[{((Object)stunGrenadeItem).name}] Hit player \"{val.playerUsername}\" for {playerDamage} damage.");
			}
		}

		private void CheckIfHitEnemy(Collider other)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			IHittable val = default(IHittable);
			if (!((Component)other).gameObject.CompareTag("Player") && ((Component)other).TryGetComponent<IHittable>(ref val))
			{
				PlayerControllerB localPlayerScript = PlayerUtils.GetLocalPlayerScript();
				val.Hit(enemyDamage, ((Component)localPlayerScript.gameplayCamera).transform.forward, localPlayerScript, true, 1);
				EnemyAICollisionDetect val2 = default(EnemyAICollisionDetect);
				if (((Component)other).TryGetComponent<EnemyAICollisionDetect>(ref val2))
				{
					LogInfoExtended($"Hit enemy \"{val2.mainScript.enemyType.enemyName}\" for {enemyDamage} damage.");
				}
				else
				{
					LogInfoExtended($"Hit \"{((Object)((Component)other).gameObject).name}\" for {enemyDamage} damage.");
				}
			}
		}

		private void LogInfoExtended(object data)
		{
			Plugin.Instance.LogInfoExtended($"[{((Object)stunGrenadeItem).name}] {data}");
		}
	}
	public enum ZombieState
	{
		Happy,
		Scared,
		Angry,
		Drunk,
		Heart
	}
	public enum ZombieOtherSFX
	{
		RescuedSFX,
		PrizeSFX,
		ElloTakeySFX,
		StinkyZombiesSFX,
		FartSFX,
		AfterPoopSFX
	}
	public class ZombiesBehaviour : AdvancedNoisemakerProp
	{
		[Space(20f)]
		[Header("Zombies")]
		[Space(5f)]
		[Header("Properties")]
		[Space(3f)]
		public float happinessDrainAmount = 20f;

		public float forceAngryStateDuration = 1.75f;

		public float angryCooldownDuration = 10f;

		public float angryDamageInterval = 3f;

		public int angryDamageAmount = 5;

		public int angryExplosionDamage = 90;

		public float angryExplosionMaxDamageRange = 6.5f;

		public float scaredInterval = 0.5f;

		public float scaredRaduis = 15f;

		public float scaredDuration = 5f;

		public float drunkDuration = 5f;

		public float otherPlushieInteractionRadius = 2.5f;

		public Transform poopSpawnPosTransform = null;

		public float poopSpawnDuration = 30f;

		public int poopValue = 3;

		public int goldenPoopValue = 69;

		public int goldenPoopSpawnPercentChance = 5;

		[Header("Models")]
		[Space(3f)]
		public GameObject happyObject;

		public GameObject scaredObject;

		public GameObject angryObject;

		public GameObject drunkObject;

		public GameObject heartObject;

		[Header("Audio Sources")]
		[Space(3f)]
		public AudioSourceGroup musicAudioGroup;

		[Header("Pickup SFX")]
		[Space(3f)]
		public AudioClipGroup[] happyPickupSFX;

		public AudioClipGroup[] scaredPickupSFX;

		public AudioClipGroup[] angryPickupSFX;

		public AudioClipGroup[] drunkPickupSFX;

		public AudioClipGroup[] heartPickupSFX;

		[Header("Squeeze SFX")]
		[Space(3f)]
		public AudioClipGroup[] happySqueezeSFX;

		public AudioClipGroup[] scaredSqueezeSFX;

		public AudioClipGroup[] angrySqueezeSFX;

		public AudioClipGroup[] drunkSqueezeSFX;

		public AudioClipGroup[] heartSqueezeSFX;

		[Header("Other SFX")]
		[Space(3f)]
		public AudioClipGroup rescuedSFX;

		public AudioClipGroup prizeSFX;

		public AudioClipGroup elloTakeySFX;

		public AudioClipGroup stinkyZombiesSFX;

		public AudioClipGroup fartSFX;

		public AudioClipGroup afterPoopSFX;

		private float _happiness = 100f;

		private bool _isScared = false;

		private bool _isDrunk = false;

		private bool _isHeart = false;

		private bool _isPlayingMusic = true;

		private bool _ignoreDamageEvent = false;

		private float _angryDamageTimer = 0f;

		private bool _forceAngryState = false;

		private float _forceAngryStateTimer = 0f;

		private bool _isCoolFromAngry = true;

		private float _scaredIntervalTimer = 0f;

		private float _scaredHeldTimer = 0f;

		private bool _spawnedPoop = false;

		private float _drunkTimer = 0f;

		private bool _isCoolFromDrunk = true;

		private bool _wasHeldByEnemy = false;

		private bool _isExploding = false;

		private bool _isDoingSmolTakeyInteration = false;

		private bool _isGivingPrize = false;

		private bool _isPooping = false;

		private bool _keepScaredState = false;

		public ZombieState ZombieState { get; private set; } = ZombieState.Happy;


		public override void Start()
		{
			((NoisemakerProp)this).Start();
			((NoisemakerProp)this).noiseAudio.volume = Plugin.ConfigManager.VoiceLineVolume * 0.01f;
			((NoisemakerProp)this).noiseAudioFar.volume = Plugin.ConfigManager.VoiceLineVolume * 0.01f;
			musicAudioGroup.volume = Plugin.ConfigManager.SingingVolume * 0.01f;
		}

		public override void Update()
		{
			((GrabbableObject)this).Update();
			if (base.IsHostOrServer)
			{
				ServerUpdate();
			}
			ClientUpdate();
		}

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

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			if (!_isDoingSmolTakeyInteration && !_isGivingPrize && !_isPooping)
			{
				base.ItemActivate(used, buttonDown);
			}
		}

		public override void GrabItem()
		{
			((GrabbableObject)this).GrabItem();
			LogInfoExtended($"GrabItem() wasHeldByEnemy: {_wasHeldByEnemy}");
			if (!base.IsHostOrServer)
			{
				return;
			}
			bool wasHeldByEnemy = _wasHeldByEnemy;
			if (wasHeldByEnemy)
			{
				SetIsHeartOnServer(value: true, updateZombieState: false);
				_wasHeldByEnemy = false;
			}
			if (_isCoolFromAngry)
			{
				SetHappinessOnServer(100f, updateZombieState: false);
			}
			if (_isCoolFromDrunk)
			{
				SetIsDrunkOnServer(value: false, updateZombieState: false);
			}
			if (!IsEnemyNearby())
			{
				SetIsScaredOnServer(value: false, updateZombieState: false);
				_keepScaredState = false;
			}
			SetIsPlayingMusicOnServer(value: false, updateZombieState: false);
			UpdateZombieStateOnServer();
			if (!_isDoingSmolTakeyInteration && !_isGivingPrize && !_isPooping)
			{
				if (wasHeldByEnemy)
				{
					PlayOtherSFXOnServer(ZombieOtherSFX.RescuedSFX);
				}
				else
				{
					PlayPickupSFXOnServer();
				}
			}
		}

		public override void GrabItemFromEnemy(EnemyAI enemy)
		{
			((GrabbableObject)this).GrabItemFromEnemy(enemy);
			LogInfoExtended("GrabItemFromEnemy() \"" + enemy.enemyType.enemyName + "\"");
			_wasHeldByEnemy = true;
			SetIsScaredOnServer(value: true);
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			UpdateModel();
		}

		public override void DiscardItem()
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).DiscardItem();
			_angryDamageTimer = 0f;
			_forceAngryStateTimer = 0f;
			if (!base.IsHostOrServer)
			{
				return;
			}
			if (_happiness < 100f)
			{
				((MonoBehaviour)this).StartCoroutine(CooldownFromAngryAfterTimeOnServer(angryCooldownDuration));
			}
			if (_isPooping)
			{
				return;
			}
			try
			{
				if (TakeyPlushCompat.HasMod && TakeyPlushCompat.HasSmolTakeyNearby(((Component)this).transform.position, otherPlushieInteractionRadius) && !_isDoingSmolTakeyInteration)
				{
					((MonoBehaviour)this).StartCoroutine(StartSmolTakeyInterationOnServer());
				}
				else if (CanGivePrize() && !_isGivingPrize)
				{
					((MonoBehaviour)this).StartCoroutine(StartGivePrizeInteraction());
				}
			}
			catch (Exception data)
			{
				LogError(data);
			}
		}

		public override void OnNetworkSpawn()
		{
			LoadItemDataOnServer();
			if (!base.IsHostOrServer)
			{
				RequestZombieStateServerRpc(PlayerUtils.GetLocalClientId());
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void SetZombieStateServerRpc(ZombieState state)
		{
			//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(1984765284u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<ZombieState>(ref state, default(ForEnums));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1984765284u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					SetZombieStateClientRpc(state);
				}
			}
		}

		[ClientRpc]
		private void SetZombieStateClientRpc(ZombieState state)
		{
			//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(4235168396u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<ZombieState>(ref state, default(ForEnums));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4235168396u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !base.IsHostOrServer)
				{
					SetZombieStateOnLocalClient(state);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void PlayerHoldingTookDamageServerRpc()
		{
			//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)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1719220470u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1719220470u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				float num = (_happiness -= happinessDrainAmount);
				if (num < 0f)
				{
					num = 0f;
				}
				_forceAngryState = true;
				SetHappinessOnServer(num);
				if (ZombieState == ZombieState.Angry)
				{
					PlayPickupSFXOnServer();
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void RequestZombieStateServerRpc(ulong fromClientId)
		{
			//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)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: 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(3500654169u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, fromClientId);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3500654169u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					LogInfoExtended($"RequestZombieStateServerRpc() fromClientId: {fromClientId}");
					ClientRpcParams val3 = default(ClientRpcParams);
					val3.Send = new ClientRpcSendParams
					{
						TargetClientIds = new <>z__ReadOnlyArray<ulong>(new ulong[1] { fromClientId })
					};
					ClientRpcParams clientRpcParams = val3;
					RequestZombieStateClientRpc(ZombieState, clientRpcParams);
					SetIsPlayingMusicClientRpc(_isPlayingMusic);
				}
			}
		}

		[ClientRpc]
		private void RequestZombieStateClientRpc(ZombieState state, ClientRpcParams clientRpcParams = default(ClientRpcParams))
		{
			//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))
				{
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(4262004849u, clientRpcParams, (RpcDelivery)0);
					((FastBufferWriter)(ref val)).WriteValueSafe<ZombieState>(ref state, default(ForEnums));
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 4262004849u, clientRpcParams, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					LogInfoExtended($"RequestZombieStateClientRpc() zombieState: {state}");
					SetZombieStateOnLocalClient(state);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void SetIsPlayingMusicServerRpc(bool value)
		{
			//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(2237766244u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref value, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2237766244u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					SetIsPlayingMusicClientRpc(value);
				}
			}
		}

		[ClientRpc]
		private void SetIsPlayingMusicClientRpc(bool value)
		{
			//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(1270711807u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref value, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1270711807u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !base.IsHostOrServer)
			{
				if (value)
				{
					musicAudioGroup.Play();
				}
				else
				{
					musicAudioGroup.Stop();
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void PlayPickupSFXServerRpc(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(1790335037u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, index);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1790335037u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					PlayPickupSFXClientRpc(index);
				}
			}
		}

		[ClientRpc]
		private void PlayPickupSFXClientRpc(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 != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2433464458u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, index);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2433464458u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !base.IsHostOrServer)
				{
					LogInfoExtended($"PlayPickupSFXClientRpc() index: {index}");
					PlayPickupSFX(index);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void PlayOtherSFXServerRpc(ZombieOtherSFX otherSFX)
		{
			//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 (mi