Decompiled source of Seichi v0.9.2

BepInEx/plugins/seichi/LethalCompanySeichiItems.dll

Decompiled 6 days 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.Serialization.Formatters.Binary;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanySeichiItems.Kanabo;
using LethalCompanySeichiItems.NetcodePatcher;
using LethalCompanySeichiItems.Uchiwa;
using Microsoft.CodeAnalysis;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("Louis")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Lethal Company Seichi Items")]
[assembly: AssemblyFileVersion("3.0.3.0")]
[assembly: AssemblyInformationalVersion("3.0.3+99f480677952b7fb6502e86ac2e6a2e63ce9defa")]
[assembly: AssemblyProduct("LethalCompanySeichiItems")]
[assembly: AssemblyTitle("LethalCompanySeichiItems")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.0.3.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 LethalCompanySeichiItems
{
	[BepInPlugin("LethalCompanySeichiItems", "LethalCompanySeichiItems", "3.0.3")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class SeichiItemsPlugin : BaseUnityPlugin
	{
		public const string ModGuid = "LCM_SeichiItems|3.1.0";

		private const string ModName = "Lethal Company Seichi Items Mod";

		private const string ModVersion = "3.1.0";

		private readonly Harmony _harmony = new Harmony("LCM_SeichiItems|3.1.0");

		private static SeichiItemsPlugin _instance;

		public static UchiwaConfig UchiwaConfigInstance { get; internal set; }

		public static KanaboConfig KanaboConfigInstance { get; internal set; }

		private void Awake()
		{
			if ((Object)(object)_instance == (Object)null)
			{
				_instance = this;
			}
			_harmony.PatchAll();
			UchiwaConfigInstance = new UchiwaConfig(((BaseUnityPlugin)this).Config);
			KanaboConfigInstance = new KanaboConfig(((BaseUnityPlugin)this).Config);
			_harmony.PatchAll();
			_harmony.PatchAll(typeof(SeichiItemsPlugin));
			InitializeNetworkStuff();
		}

		private static void InitializeNetworkStuff()
		{
			IEnumerable<Type> enumerable;
			try
			{
				enumerable = Assembly.GetExecutingAssembly().GetTypes();
			}
			catch (ReflectionTypeLoadException ex)
			{
				enumerable = ex.Types.Where((Type t) => t != null);
			}
			foreach (Type item in enumerable)
			{
				MethodInfo[] methods = item.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				foreach (MethodInfo methodInfo in methods)
				{
					if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}
	}
	[Serializable]
	public class SyncedInstance<T>
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static HandleNamedMessageDelegate <0>__OnRequestSync;

			public static HandleNamedMessageDelegate <1>__OnReceiveSync;
		}

		[NonSerialized]
		protected static int IntSize = 4;

		internal static CustomMessagingManager MessageManager => NetworkManager.Singleton.CustomMessagingManager;

		internal static bool IsClient => NetworkManager.Singleton.IsClient;

		internal static bool IsHost => NetworkManager.Singleton.IsHost;

		public static T Default { get; private set; }

		public static T Instance { get; private set; }

		public static bool Synced { get; internal set; }

		protected void InitInstance(T instance)
		{
			Default = instance;
			Instance = instance;
			IntSize = 4;
		}

		internal static void SyncInstance(byte[] data)
		{
			Instance = DeserializeFromBytes(data);
			Synced = true;
		}

		internal static void RevertSync()
		{
			Instance = Default;
			Synced = false;
		}

		public static byte[] SerializeToBytes(T val)
		{
			BinaryFormatter binaryFormatter = new BinaryFormatter();
			using MemoryStream memoryStream = new MemoryStream();
			try
			{
				binaryFormatter.Serialize(memoryStream, val);
				return memoryStream.ToArray();
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"Error serializing instance: {arg}");
				return null;
			}
		}

		public static T DeserializeFromBytes(byte[] data)
		{
			BinaryFormatter binaryFormatter = new BinaryFormatter();
			using MemoryStream serializationStream = new MemoryStream(data);
			try
			{
				return (T)binaryFormatter.Deserialize(serializationStream);
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"Error deserializing instance: {arg}");
				return default(T);
			}
		}

		private static void RequestSync()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if (!IsClient)
			{
				return;
			}
			FastBufferWriter val = default(FastBufferWriter);
			((FastBufferWriter)(ref val))..ctor(IntSize, (Allocator)2, -1);
			try
			{
				MessageManager.SendNamedMessage("LCM_SeichiItems|3.1.0_OnRequestConfigSync", 0uL, val, (NetworkDelivery)3);
			}
			finally
			{
				((IDisposable)(FastBufferWriter)(ref val)).Dispose();
			}
		}

		private static void OnRequestSync(ulong clientId, FastBufferReader _)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			if (!IsHost)
			{
				return;
			}
			Debug.Log((object)$"Config sync request received from client: {clientId}");
			byte[] array = SerializeToBytes(Instance);
			int num = array.Length;
			FastBufferWriter val = default(FastBufferWriter);
			((FastBufferWriter)(ref val))..ctor(num + IntSize, (Allocator)2, -1);
			try
			{
				((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteBytesSafe(array, -1, 0);
				MessageManager.SendNamedMessage("LCM_SeichiItems|3.1.0_OnReceiveConfigSync", clientId, val, (NetworkDelivery)3);
			}
			catch (Exception arg)
			{
				Debug.Log((object)$"Error occurred syncing config with client: {clientId}\n{arg}");
			}
			finally
			{
				((IDisposable)(FastBufferWriter)(ref val)).Dispose();
			}
		}

		private static void OnReceiveSync(ulong _, FastBufferReader reader)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if (!((FastBufferReader)(ref reader)).TryBeginRead(IntSize))
			{
				Debug.LogError((object)"Config sync error: Could not begin reading buffer.");
				return;
			}
			int num = default(int);
			((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives));
			if (!((FastBufferReader)(ref reader)).TryBeginRead(num))
			{
				Debug.LogError((object)"Config sync error: Host could not sync.");
				return;
			}
			byte[] data = new byte[num];
			((FastBufferReader)(ref reader)).ReadBytesSafe(ref data, num, 0);
			SyncInstance(data);
			Debug.Log((object)"Successfully synced config with host.");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
		public static void InitializeLocalPlayer()
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_0021: 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)
			//IL_002c: Expected O, but got Unknown
			if (IsHost)
			{
				CustomMessagingManager messageManager = MessageManager;
				object obj = <>O.<0>__OnRequestSync;
				if (obj == null)
				{
					HandleNamedMessageDelegate val = OnRequestSync;
					<>O.<0>__OnRequestSync = val;
					obj = (object)val;
				}
				messageManager.RegisterNamedMessageHandler("LCM_SeichiItems|3.1.0_OnRequestConfigSync", (HandleNamedMessageDelegate)obj);
				Synced = true;
				return;
			}
			Synced = false;
			CustomMessagingManager messageManager2 = MessageManager;
			object obj2 = <>O.<1>__OnReceiveSync;
			if (obj2 == null)
			{
				HandleNamedMessageDelegate val2 = OnReceiveSync;
				<>O.<1>__OnReceiveSync = val2;
				obj2 = (object)val2;
			}
			messageManager2.RegisterNamedMessageHandler("LCM_SeichiItems|3.1.0_OnReceiveConfigSync", (HandleNamedMessageDelegate)obj2);
			RequestSync();
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")]
		public static void PlayerLeave()
		{
			RevertSync();
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "LethalCompanySeichiItems";

		public const string PLUGIN_NAME = "LethalCompanySeichiItems";

		public const string PLUGIN_VERSION = "3.0.3";
	}
}
namespace LethalCompanySeichiItems.Uchiwa
{
	public class UchiwaConfig : SyncedInstance<UchiwaConfig>
	{
		public readonly ConfigEntry<int> UchiwaHealAmount;

		public UchiwaConfig(ConfigFile cfg)
		{
			InitInstance(this);
			UchiwaHealAmount = cfg.Bind<int>("Uchiwa", "Player Heal Amount", 5, "The amount of health a player receives when hit with the Uchiwa.");
		}
	}
	public class UchiwaItem : GrabbableObject
	{
		private enum AudioClipTypes
		{
			Hit,
			Swing,
			HitSurface
		}

		private ManualLogSource _mls;

		private string _uchiwaId;

		[Tooltip("The amount of healing the Uchiwa does per swing.")]
		[SerializeField]
		private int healAmount = 5;

		[Header("Audio")]
		[Space(5f)]
		[SerializeField]
		private AudioSource uchiwaAudio;

		public AudioClip[] hitSfx;

		public AudioClip[] swingSfx;

		private PlayerControllerB _previousPlayerHeldBy;

		private List<RaycastHit> _objectsHitByUchiwaList = new List<RaycastHit>();

		private RaycastHit[] _objectsHitByUchiwa;

		private static readonly int UseHeldItem1 = Animator.StringToHash("UseHeldItem1");

		private const int KnifeMask = 11012424;

		private float _timeAtLastDamageDealt;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			_uchiwaId = Guid.NewGuid().ToString();
			_mls = Logger.CreateLogSource("LCM_SeichiItems|3.1.0 | Uchiwa " + _uchiwaId);
			healAmount = Mathf.Clamp(SyncedInstance<UchiwaConfig>.Instance.UchiwaHealAmount.Value, 0, int.MaxValue);
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			if (!((Object)(object)base.playerHeldBy == (Object)null))
			{
				_previousPlayerHeldBy = base.playerHeldBy;
				if (((NetworkBehaviour)base.playerHeldBy).IsOwner)
				{
					base.playerHeldBy.playerBodyAnimator.SetTrigger(UseHeldItem1);
				}
				if (((NetworkBehaviour)this).IsOwner)
				{
					PlayAudioClipTypeServerRpc(_uchiwaId, AudioClipTypes.Swing);
					HitUchiwa();
				}
			}
		}

		private void HitUchiwa(bool cancel = false)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: 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_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_previousPlayerHeldBy == (Object)null)
			{
				_mls.LogError((object)"Variable '_previousPlayerHeldBy' is null on this client when HitUchiwa is called.");
				return;
			}
			_previousPlayerHeldBy.activatingItem = false;
			bool flag = false;
			int hitSurfaceID = -1;
			if (!cancel)
			{
				_previousPlayerHeldBy.twoHanded = false;
				_objectsHitByUchiwa = Physics.SphereCastAll(((Component)_previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)_previousPlayerHeldBy.gameplayCamera).transform.right * 0.1f, 0.3f, ((Component)_previousPlayerHeldBy.gameplayCamera).transform.forward, 0.75f, 11012424, (QueryTriggerInteraction)2);
				_objectsHitByUchiwaList = _objectsHitByUchiwa.OrderBy((RaycastHit x) => ((RaycastHit)(ref x)).distance).ToList();
				IHittable val2 = default(IHittable);
				foreach (RaycastHit objectsHitByUchiwa in _objectsHitByUchiwaList)
				{
					RaycastHit val = objectsHitByUchiwa;
					if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 8 && ((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 11)
					{
						val = objectsHitByUchiwa;
						if (!((Component)((RaycastHit)(ref val)).transform).TryGetComponent<IHittable>(ref val2))
						{
							continue;
						}
						val = objectsHitByUchiwa;
						if ((Object)(object)((RaycastHit)(ref val)).transform == (Object)(object)((Component)_previousPlayerHeldBy).transform)
						{
							continue;
						}
						val = objectsHitByUchiwa;
						if (!(((RaycastHit)(ref val)).point == Vector3.zero))
						{
							Vector3 position = ((Component)_previousPlayerHeldBy.gameplayCamera).transform.position;
							val = objectsHitByUchiwa;
							Vector3 point = ((RaycastHit)(ref val)).point;
							RaycastHit val3 = default(RaycastHit);
							int collidersAndRoomMaskAndDefault = StartOfRound.Instance.collidersAndRoomMaskAndDefault;
							if (Physics.Linecast(position, point, ref val3, collidersAndRoomMaskAndDefault))
							{
								continue;
							}
						}
						flag = true;
						Vector3 forward = ((Component)_previousPlayerHeldBy.gameplayCamera).transform.forward;
						try
						{
							if ((double)Time.realtimeSinceStartup - (double)_timeAtLastDamageDealt > 0.4300000071525574)
							{
								_timeAtLastDamageDealt = Time.realtimeSinceStartup;
								PlayerControllerB val4 = (PlayerControllerB)(object)((val2 is PlayerControllerB) ? val2 : null);
								if (val4 != null)
								{
									HealPlayerServerRpc(val4.actualClientId);
								}
								else
								{
									val2.Hit(0, forward, _previousPlayerHeldBy, true, 5);
								}
							}
						}
						catch (Exception arg)
						{
							_mls.LogError((object)$"Exception when hitting object with uchiwa from player #{_previousPlayerHeldBy.playerClientId}: {arg}");
						}
						continue;
					}
					flag = true;
					val = objectsHitByUchiwa;
					for (int i = 0; i < StartOfRound.Instance.footstepSurfaces.Length; i++)
					{
						if (!(StartOfRound.Instance.footstepSurfaces[i].surfaceTag != ((Component)((RaycastHit)(ref val)).collider).gameObject.tag))
						{
							hitSurfaceID = i;
							break;
						}
					}
				}
			}
			if (flag)
			{
				PlayAudioClipTypeServerRpc(_uchiwaId, AudioClipTypes.Hit);
				HitUchiwaServerRpc(hitSurfaceID);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void HealPlayerServerRpc(ulong playerId)
		{
			//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)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2944637045u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2944637045u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				PlayerControllerB val3;
				try
				{
					val3 = StartOfRound.Instance.allPlayerScripts[playerId];
				}
				catch (IndexOutOfRangeException)
				{
					_mls.LogError((object)$"Tried to heal player with ID: {playerId}, but such player does not exist.");
					return;
				}
				if ((Object)(object)val3 == (Object)null)
				{
					_mls.LogError((object)$"Tried to heal player with ID: {playerId}, but the player object is null.");
				}
				int playerMaxHealth = GetPlayerMaxHealth(val3);
				int playerNewHealth = ((playerMaxHealth != -1) ? Mathf.Min(val3.health + healAmount, playerMaxHealth) : val3.health);
				HealPlayerClientRpc(playerId, playerNewHealth);
			}
		}

		[ClientRpc]
		private void HealPlayerClientRpc(ulong playerId, int playerNewHealth)
		{
			//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)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3245975384u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				BytePacker.WriteValueBitPacked(val2, playerNewHealth);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3245975384u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[playerId];
				val3.health = playerNewHealth;
				if ((Object)(object)HUDManager.Instance.localPlayer == (Object)(object)val3)
				{
					HUDManager.Instance.UpdateHealthUI(val3.health, false);
				}
			}
		}

		[ServerRpc]
		private void HitUchiwaServerRpc(int hitSurfaceID)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: 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)((NetworkBehaviour)this).__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(537189385u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, hitSurfaceID);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 537189385u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				HitUchiwaClientRpc(hitSurfaceID);
			}
		}

		[ClientRpc]
		private void HitUchiwaClientRpc(int hitSurfaceID)
		{
			//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(3185967530u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, hitSurfaceID);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3185967530u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					HitSurfaceWithUchiwa(hitSurfaceID);
				}
			}
		}

		private void HitSurfaceWithUchiwa(int hitSurfaceID)
		{
			if (StartOfRound.Instance.footstepSurfaces != null && hitSurfaceID >= 0 && hitSurfaceID < StartOfRound.Instance.footstepSurfaces.Length)
			{
				FootstepSurface val = StartOfRound.Instance.footstepSurfaces[hitSurfaceID];
				if (val != null && !((Object)(object)val.hitSurfaceSFX == (Object)null) && ((NetworkBehaviour)this).IsOwner)
				{
					PlaySurfaceHitAudioClipServerRpc(_uchiwaId, hitSurfaceID);
				}
			}
		}

		private int GetPlayerMaxHealth(PlayerControllerB player)
		{
			if (UchiwaSharedData.Instance.PlayersMaxHealth.ContainsKey(player))
			{
				return UchiwaSharedData.Instance.PlayersMaxHealth[player];
			}
			_mls.LogError((object)("Could not get the health of player " + player.playerUsername + ". This should not happen."));
			return -1;
		}

		[ServerRpc(RequireOwnership = false)]
		private void PlaySurfaceHitAudioClipServerRpc(string receivedUchiwaId, int hitSurfaceId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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_00c7: 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(2549317139u, val, (RpcDelivery)0);
				bool flag = receivedUchiwaId != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(receivedUchiwaId, false);
				}
				BytePacker.WriteValueBitPacked(val2, hitSurfaceId);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2549317139u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && !(_uchiwaId != receivedUchiwaId))
			{
				PlayAudioClipTypeClientRpc(receivedUchiwaId, AudioClipTypes.HitSurface, hitSurfaceId);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void PlayAudioClipTypeServerRpc(string receivedUchiwaId, AudioClipTypes audioClipType, bool interrupt = false)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: 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_00f0: 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(637447325u, val, (RpcDelivery)0);
				bool flag = receivedUchiwaId != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(receivedUchiwaId, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe<AudioClipTypes>(ref audioClipType, default(ForEnums));
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref interrupt, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 637447325u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && !(_uchiwaId != receivedUchiwaId))
			{
				int num = audioClipType switch
				{
					AudioClipTypes.Hit => hitSfx.Length, 
					AudioClipTypes.Swing => swingSfx.Length, 
					_ => -1, 
				};
				switch (num)
				{
				case 0:
					_mls.LogError((object)$"There are no audio clips for audio clip type {audioClipType}.");
					break;
				case -1:
					_mls.LogError((object)$"Audio Clip Type was not listed, cannot play audio clip. Number of audio clips: {num}.");
					break;
				default:
				{
					int clipIndex = Random.Range(0, num);
					PlayAudioClipTypeClientRpc(receivedUchiwaId, audioClipType, clipIndex, interrupt);
					break;
				}
				}
			}
		}

		[ClientRpc]
		private void PlayAudioClipTypeClientRpc(string receivedUchiwaId, AudioClipTypes audioClipType, int clipIndex, bool interrupt = false)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: 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(1414388730u, val, (RpcDelivery)0);
				bool flag = receivedUchiwaId != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(receivedUchiwaId, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe<AudioClipTypes>(ref audioClipType, default(ForEnums));
				BytePacker.WriteValueBitPacked(val2, clipIndex);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref interrupt, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1414388730u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost) || _uchiwaId != receivedUchiwaId)
			{
				return;
			}
			AudioClip val3 = (AudioClip)(audioClipType switch
			{
				AudioClipTypes.Hit => hitSfx[clipIndex], 
				AudioClipTypes.Swing => swingSfx[clipIndex], 
				AudioClipTypes.HitSurface => StartOfRound.Instance.footstepSurfaces[clipIndex].hitSurfaceSFX, 
				_ => null, 
			});
			if ((Object)(object)val3 == (Object)null)
			{
				_mls.LogError((object)$"Invalid audio clip with type: {audioClipType} and index: {clipIndex}");
				return;
			}
			if (interrupt)
			{
				uchiwaAudio.Stop(true);
			}
			uchiwaAudio.PlayOneShot(val3);
			WalkieTalkie.TransmitOneShotAudio(uchiwaAudio, val3, uchiwaAudio.volume);
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_UchiwaItem()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(2944637045u, new RpcReceiveHandler(__rpc_handler_2944637045));
			NetworkManager.__rpc_func_table.Add(3245975384u, new RpcReceiveHandler(__rpc_handler_3245975384));
			NetworkManager.__rpc_func_table.Add(537189385u, new RpcReceiveHandler(__rpc_handler_537189385));
			NetworkManager.__rpc_func_table.Add(3185967530u, new RpcReceiveHandler(__rpc_handler_3185967530));
			NetworkManager.__rpc_func_table.Add(2549317139u, new RpcReceiveHandler(__rpc_handler_2549317139));
			NetworkManager.__rpc_func_table.Add(637447325u, new RpcReceiveHandler(__rpc_handler_637447325));
			NetworkManager.__rpc_func_table.Add(1414388730u, new RpcReceiveHandler(__rpc_handler_1414388730));
		}

		private static void __rpc_handler_2944637045(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)
			{
				ulong playerId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((UchiwaItem)(object)target).HealPlayerServerRpc(playerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3245975384(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)
			{
				ulong playerId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				int playerNewHealth = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerNewHealth);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((UchiwaItem)(object)target).HealPlayerClientRpc(playerId, playerNewHealth);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_537189385(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_0070: 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_009d: 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
			{
				int hitSurfaceID = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref hitSurfaceID);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((UchiwaItem)(object)target).HitUchiwaServerRpc(hitSurfaceID);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3185967530(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 hitSurfaceID = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref hitSurfaceID);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((UchiwaItem)(object)target).HitUchiwaClientRpc(hitSurfaceID);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2549317139(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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string receivedUchiwaId = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref receivedUchiwaId, false);
				}
				int hitSurfaceId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref hitSurfaceId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((UchiwaItem)(object)target).PlaySurfaceHitAudioClipServerRpc(receivedUchiwaId, hitSurfaceId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_637447325(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_0067: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string receivedUchiwaId = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref receivedUchiwaId, false);
				}
				AudioClipTypes audioClipType = default(AudioClipTypes);
				((FastBufferReader)(ref reader)).ReadValueSafe<AudioClipTypes>(ref audioClipType, default(ForEnums));
				bool interrupt = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref interrupt, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((UchiwaItem)(object)target).PlayAudioClipTypeServerRpc(receivedUchiwaId, audioClipType, interrupt);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1414388730(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_0067: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string receivedUchiwaId = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref receivedUchiwaId, false);
				}
				AudioClipTypes audioClipType = default(AudioClipTypes);
				((FastBufferReader)(ref reader)).ReadValueSafe<AudioClipTypes>(ref audioClipType, default(ForEnums));
				int clipIndex = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref clipIndex);
				bool interrupt = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref interrupt, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((UchiwaItem)(object)target).PlayAudioClipTypeClientRpc(receivedUchiwaId, audioClipType, clipIndex, interrupt);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "UchiwaItem";
		}
	}
	public class UchiwaSharedData
	{
		private static UchiwaSharedData _instance;

		public static UchiwaSharedData Instance => _instance ?? (_instance = new UchiwaSharedData());

		public Dictionary<PlayerControllerB, int> PlayersMaxHealth { get; } = new Dictionary<PlayerControllerB, int>();


		public static void FlushDictionaries()
		{
			Instance.PlayersMaxHealth.Clear();
		}
	}
}
namespace LethalCompanySeichiItems.Uchiwa.Patches
{
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatches
	{
		[HarmonyPatch("ShipLeave")]
		[HarmonyPostfix]
		private static void ResetData(StartOfRound __instance)
		{
			UchiwaSharedData.FlushDictionaries();
		}

		[HarmonyPatch("StartGame")]
		[HarmonyPostfix]
		private static void GetAllPlayersMaxHealth(StartOfRound __instance)
		{
			PlayerControllerB[] allPlayerScripts = __instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (UchiwaSharedData.Instance.PlayersMaxHealth.ContainsKey(val))
				{
					UchiwaSharedData.Instance.PlayersMaxHealth.Remove(val);
				}
				UchiwaSharedData.Instance.PlayersMaxHealth.Add(val, val.health);
			}
		}
	}
}
namespace LethalCompanySeichiItems.Lantern
{
	public class LanternItem : GrabbableObject
	{
		private ManualLogSource _mls;

		private string _lanternId;

		[Space(15f)]
		[SerializeField]
		private Light bulbLightSource;

		[SerializeField]
		private Light bulbGlowLightSource;

		[SerializeField]
		private AudioSource audioSource;

		[SerializeField]
		private AudioClip[] audioClips;

		[SerializeField]
		private Material bulbLightMaterial;

		[SerializeField]
		private Material bulbDarkMaterial;

		[SerializeField]
		private MeshRenderer meshRenderer;

		[SerializeField]
		private GameObject lanternHelmetLight;

		private bool _isTurnedOn;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			_lanternId = Guid.NewGuid().ToString();
			_mls = Logger.CreateLogSource("LCM_SeichiItems|3.1.0 | Lantern " + _lanternId);
			Random.InitState(StartOfRound.Instance.randomMapSeed + _lanternId.GetHashCode());
			if ((Object)(object)meshRenderer == (Object)null)
			{
				meshRenderer = ((Component)this).GetComponent<MeshRenderer>();
			}
			if ((Object)(object)meshRenderer == (Object)null)
			{
				_mls.LogError((object)"The mesh renderer component on the lantern is null.");
			}
			if ((Object)(object)bulbLightSource == (Object)null)
			{
				_mls.LogError((object)"The bulbLightSource on the lantern is null.");
			}
			if ((Object)(object)bulbGlowLightSource == (Object)null)
			{
				_mls.LogError((object)"The bulbGlowLightSource on the lantern is null.");
			}
			if ((Object)(object)lanternHelmetLight == (Object)null)
			{
				_mls.LogError((object)"The lanternHelmetLight gameobject on this lantern is null.");
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			base.isBeingUsed = used;
			if (audioClips.Length != 0)
			{
				audioSource.PlayOneShot(audioClips[Random.Range(0, audioClips.Length)]);
				RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 7f, 0.4f, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
			}
			if (((NetworkBehaviour)this).IsOwner)
			{
				SwitchLanternStateServerRpc(!_isTurnedOn);
			}
		}

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

		[ClientRpc]
		private void SwitchLanternStateClientRpc(bool on)
		{
			//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(2426285803u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref on, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2426285803u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					LogDebug($"Turned on?: {on}");
					_isTurnedOn = on;
					((Behaviour)bulbLightSource).enabled = on;
					((Behaviour)bulbGlowLightSource).enabled = on;
					Material[] sharedMaterials = ((Renderer)meshRenderer).sharedMaterials;
					sharedMaterials[0] = (on ? bulbLightMaterial : bulbDarkMaterial);
					((Renderer)meshRenderer).sharedMaterials = sharedMaterials;
				}
			}
		}

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
			if (((NetworkBehaviour)this).IsOwner)
			{
				SwitchLanternStateServerRpc(on: false);
			}
		}

		public override void DiscardItem()
		{
			((GrabbableObject)this).DiscardItem();
			if (((NetworkBehaviour)this).IsOwner)
			{
				SwitchLanternStateServerRpc(on: false);
			}
		}

		private void LogDebug(string msg)
		{
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_LanternItem()
		{
			//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(3427429008u, new RpcReceiveHandler(__rpc_handler_3427429008));
			NetworkManager.__rpc_func_table.Add(2426285803u, new RpcReceiveHandler(__rpc_handler_2426285803));
		}

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

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "LanternItem";
		}
	}
	public class LanternSharedData
	{
		private static LanternSharedData _instance;

		public static LanternSharedData Instance => _instance ?? (_instance = new LanternSharedData());

		public Dictionary<ulong, Light> LanternHelmetLightMap { get; } = new Dictionary<ulong, Light>();

	}
}
namespace LethalCompanySeichiItems.Kanabo
{
	public class KanaboConfig : SyncedInstance<KanaboConfig>
	{
		public readonly ConfigEntry<int> KanaboDamage;

		public readonly ConfigEntry<float> KanaboReelUpTime;

		public KanaboConfig(ConfigFile cfg)
		{
			InitInstance(this);
			KanaboDamage = cfg.Bind<int>("Kanabo", "Damage", 2, "The amount of damage the Kanabo does per hit.");
			KanaboReelUpTime = cfg.Bind<float>("Kanabo", "Reel Up Time", 0.7f, "The time it takes in seconds for the player to reel up the Kanabo.");
		}
	}
	public class KanaboItem : GrabbableObject
	{
		private ManualLogSource _mls;

		private string _kanaboId;

		[Tooltip("The amount of damage the Kanabo does on a single hit.")]
		[SerializeField]
		private int hitForce = 2;

		[Tooltip("The reel up time in seconds for the Kanabo.")]
		[SerializeField]
		private float reelUpTime = 0.7f;

		[Header("Audio")]
		[Space(5f)]
		[SerializeField]
		private AudioSource kanaboAudio;

		public AudioClip reelUp;

		public AudioClip swing;

		public AudioClip[] hitSfx;

		private const int ShovelMask = 11012424;

		private static readonly int ShovelHit = Animator.StringToHash("shovelHit");

		private static readonly int ReelingUp = Animator.StringToHash("reelingUp");

		private bool _reelingUp;

		private bool _isHoldingButton;

		private bool _animatorSpeedCurrentlyModified;

		private float _origionalPlayerAnimatorSpeed;

		private List<RaycastHit> _objectsHitByKanaboList = new List<RaycastHit>();

		private RaycastHit[] _objectsHitByKanabo;

		private Coroutine _reelingUpCoroutine;

		private PlayerControllerB _previousPlayerHeldBy;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			_kanaboId = Guid.NewGuid().ToString();
			_mls = Logger.CreateLogSource("LCM_SeichiItems|3.1.0 | Kanabo " + _kanaboId);
			hitForce = Mathf.Clamp(SyncedInstance<KanaboConfig>.Instance.KanaboDamage.Value, 0, int.MaxValue);
			reelUpTime = Mathf.Clamp(SyncedInstance<KanaboConfig>.Instance.KanaboReelUpTime.Value, 0.05f, 2.1474836E+09f);
		}

		private void OnDisable()
		{
			if (_animatorSpeedCurrentlyModified)
			{
				base.playerHeldBy.playerBodyAnimator.speed = _origionalPlayerAnimatorSpeed;
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			if ((Object)(object)base.playerHeldBy == (Object)null)
			{
				return;
			}
			_isHoldingButton = buttonDown;
			if (!_reelingUp && buttonDown)
			{
				_reelingUp = true;
				_previousPlayerHeldBy = base.playerHeldBy;
				if (_reelingUpCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(_reelingUpCoroutine);
				}
				_reelingUpCoroutine = ((MonoBehaviour)this).StartCoroutine(ReelUpKanabo());
			}
		}

		private IEnumerator ReelUpKanabo()
		{
			base.playerHeldBy.activatingItem = true;
			base.playerHeldBy.twoHanded = true;
			base.playerHeldBy.playerBodyAnimator.ResetTrigger(ShovelHit);
			base.playerHeldBy.playerBodyAnimator.SetBool(ReelingUp, true);
			yield return null;
			AnimationClip val = ((IEnumerable<AnimationClip>)base.playerHeldBy.playerBodyAnimator.runtimeAnimatorController.animationClips).FirstOrDefault((Func<AnimationClip, bool>)((AnimationClip clip) => ((Object)clip).name == "ShovelReelUp"));
			if ((Object)(object)val != (Object)null)
			{
				_origionalPlayerAnimatorSpeed = base.playerHeldBy.playerBodyAnimator.speed;
				float speed = val.length / reelUpTime;
				_animatorSpeedCurrentlyModified = true;
				base.playerHeldBy.playerBodyAnimator.speed = speed;
				kanaboAudio.PlayOneShot(reelUp);
				ReelUpSfxServerRpc();
				yield return (object)new WaitForSeconds(reelUpTime);
				base.playerHeldBy.playerBodyAnimator.speed = _origionalPlayerAnimatorSpeed;
				_animatorSpeedCurrentlyModified = false;
			}
			else
			{
				_mls.LogWarning((object)"The ShovelReelUp clip was null.");
			}
			yield return (object)new WaitUntil((Func<bool>)(() => !_isHoldingButton || !base.isHeld));
			SwingKanabo(!base.isHeld);
			yield return (object)new WaitForSeconds(0.13f);
			yield return (object)new WaitForEndOfFrame();
			HitKanabo(!base.isHeld);
			yield return (object)new WaitForSeconds(0.3f);
			_reelingUp = false;
			_reelingUpCoroutine = null;
		}

		public void SwingKanabo(bool cancel = false)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			_previousPlayerHeldBy.playerBodyAnimator.SetBool(ReelingUp, false);
			if (!cancel)
			{
				kanaboAudio.PlayOneShot(swing);
				_previousPlayerHeldBy.UpdateSpecialAnimationValue(true, (short)((Component)_previousPlayerHeldBy).transform.localEulerAngles.y, 0.4f, false);
			}
		}

		public void HitKanabo(bool cancel = false)
		{
			//IL_0054: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: 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)
			if ((Object)(object)_previousPlayerHeldBy == (Object)null)
			{
				_mls.LogError((object)"Variable '_previousPlayerHeldBy' is null on this client when HitKanabo is called.");
				return;
			}
			_previousPlayerHeldBy.activatingItem = false;
			bool flag = false;
			bool flag2 = false;
			int num = -1;
			if (!cancel)
			{
				_previousPlayerHeldBy.twoHanded = false;
				_objectsHitByKanabo = Physics.SphereCastAll(((Component)_previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)_previousPlayerHeldBy.gameplayCamera).transform.right * -0.35f, 0.8f, ((Component)_previousPlayerHeldBy.gameplayCamera).transform.forward, 1.5f, 11012424, (QueryTriggerInteraction)2);
				_objectsHitByKanaboList = _objectsHitByKanabo.OrderBy((RaycastHit x) => ((RaycastHit)(ref x)).distance).ToList();
				IHittable val2 = default(IHittable);
				foreach (RaycastHit objectsHitByKanabo in _objectsHitByKanaboList)
				{
					RaycastHit val = objectsHitByKanabo;
					if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 8 && ((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 11)
					{
						val = objectsHitByKanabo;
						if (!((Component)((RaycastHit)(ref val)).transform).TryGetComponent<IHittable>(ref val2))
						{
							continue;
						}
						val = objectsHitByKanabo;
						if ((Object)(object)((RaycastHit)(ref val)).transform == (Object)(object)((Component)_previousPlayerHeldBy).transform)
						{
							continue;
						}
						val = objectsHitByKanabo;
						if (!(((RaycastHit)(ref val)).point == Vector3.zero))
						{
							Vector3 position = ((Component)_previousPlayerHeldBy.gameplayCamera).transform.position;
							val = objectsHitByKanabo;
							Vector3 point = ((RaycastHit)(ref val)).point;
							RaycastHit val3 = default(RaycastHit);
							int collidersAndRoomMaskAndDefault = StartOfRound.Instance.collidersAndRoomMaskAndDefault;
							if (Physics.Linecast(position, point, ref val3, collidersAndRoomMaskAndDefault))
							{
								continue;
							}
						}
						flag = true;
						Vector3 forward = ((Component)_previousPlayerHeldBy.gameplayCamera).transform.forward;
						try
						{
							val2.Hit(hitForce, forward, _previousPlayerHeldBy, true, 1);
							flag2 = true;
						}
						catch (Exception arg)
						{
							_mls.LogInfo((object)$"Exception caught when hitting object with Kanabo from player #{_previousPlayerHeldBy.playerClientId}: {arg}");
						}
						continue;
					}
					flag = true;
					val = objectsHitByKanabo;
					for (int i = 0; i < StartOfRound.Instance.footstepSurfaces.Length; i++)
					{
						if (!(StartOfRound.Instance.footstepSurfaces[i].surfaceTag != ((Component)((RaycastHit)(ref val)).collider).gameObject.tag))
						{
							num = i;
							break;
						}
					}
				}
			}
			if (flag)
			{
				RoundManager.PlayRandomClip(kanaboAudio, hitSfx, true, 1f, 0, 1000);
				Object.FindObjectOfType<RoundManager>().PlayAudibleNoise(((Component)this).transform.position, 17f, 0.8f, 0, false, 0);
				if (!flag2 && num != -1)
				{
					kanaboAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX);
					WalkieTalkie.TransmitOneShotAudio(kanaboAudio, StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX, 1f);
				}
				base.playerHeldBy.playerBodyAnimator.SetTrigger(ShovelHit);
				HitKanaboServerRpc(num);
			}
		}

		[ServerRpc]
		public void ReelUpSfxServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: 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_00c2: 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)((NetworkBehaviour)this).__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(715459370u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 715459370u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ReelUpSfxClientRpc();
			}
		}

		[ClientRpc]
		public void ReelUpSfxClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3996815479u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3996815479u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					kanaboAudio.PlayOneShot(reelUp);
				}
			}
		}

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

		[ServerRpc]
		private void HitKanaboServerRpc(int hitSurfaceID)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: 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)((NetworkBehaviour)this).__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(2254645974u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, hitSurfaceID);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2254645974u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				HitKanaboClientRpc(hitSurfaceID);
			}
		}

		[ClientRpc]
		private void HitKanaboClientRpc(int hitSurfaceID)
		{
			//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)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2180758394u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, hitSurfaceID);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2180758394u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				RoundManager.PlayRandomClip(kanaboAudio, hitSfx, true, 1f, 0, 1000);
				if (hitSurfaceID != -1)
				{
					HitSurfaceWithKanabo(hitSurfaceID);
				}
			}
		}

		private void HitSurfaceWithKanabo(int hitSurfaceID)
		{
			kanaboAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX);
			WalkieTalkie.TransmitOneShotAudio(kanaboAudio, StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX, 1f);
		}

		private void LogDebug(string msg)
		{
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_KanaboItem()
		{
			//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(715459370u, new RpcReceiveHandler(__rpc_handler_715459370));
			NetworkManager.__rpc_func_table.Add(3996815479u, new RpcReceiveHandler(__rpc_handler_3996815479));
			NetworkManager.__rpc_func_table.Add(2254645974u, new RpcReceiveHandler(__rpc_handler_2254645974));
			NetworkManager.__rpc_func_table.Add(2180758394u, new RpcReceiveHandler(__rpc_handler_2180758394));
		}

		private static void __rpc_handler_715459370(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_0076: 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_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
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((KanaboItem)(object)target).ReelUpSfxServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3996815479(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((KanaboItem)(object)target).ReelUpSfxClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2254645974(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_0070: 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_009d: 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
			{
				int hitSurfaceID = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref hitSurfaceID);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((KanaboItem)(object)target).HitKanaboServerRpc(hitSurfaceID);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2180758394(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 hitSurfaceID = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref hitSurfaceID);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((KanaboItem)(object)target).HitKanaboClientRpc(hitSurfaceID);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "KanaboItem";
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace LethalCompanySeichiItems.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}

BepInEx/plugins/seichi/LethalCompanyShisha.dll

Decompiled 6 days 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.Serialization.Formatters.Binary;
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 LethalCompanyShisha.CustomStateMachineBehaviours;
using LethalCompanyShisha.NetcodePatcher;
using LethalCompanyShisha.Types;
using LethalLib.Modules;
using LobbyCompatibility.Enums;
using LobbyCompatibility.Features;
using Microsoft.CodeAnalysis;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("LethalLib")]
[assembly: AssemblyCompany("Louis")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Lethal Company Shisha")]
[assembly: AssemblyFileVersion("1.1.4.0")]
[assembly: AssemblyInformationalVersion("1.1.4+ff875b84d611e1a8d9c289db4712bb8d86721156")]
[assembly: AssemblyProduct("LethalCompanyShisha")]
[assembly: AssemblyTitle("LethalCompanyShisha")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.4.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>();
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LethalCompanyShisha
{
	[BepInPlugin("LethalCompanyShisha", "LethalCompanyShisha", "1.1.4")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class ShishaPlugin : BaseUnityPlugin
	{
		public const string ModGuid = "LCM_Shisha|1.1.4";

		private const string ModName = "Lethal Company Shisha Mod";

		private const string ModVersion = "1.1.4";

		private readonly Harmony _harmony = new Harmony("LCM_Shisha|1.1.4");

		public static readonly ManualLogSource Mls = Logger.CreateLogSource("LCM_Shisha|1.1.4");

		private static ShishaPlugin _instance;

		private static EnemyType _shishaEnemyType;

		public static Item ShishaPoopItem;

		public static ShishaConfig ShishaConfigInstance { get; internal set; }

		private void Awake()
		{
			if ((Object)(object)_instance == (Object)null)
			{
				_instance = this;
			}
			if (LobbyCompatibilityChecker.Enabled)
			{
				LobbyCompatibilityChecker.Init();
			}
			InitializeNetworkStuff();
			Assets.PopulateAssetsFromFile();
			if ((Object)(object)Assets.MainAssetBundle == (Object)null)
			{
				Mls.LogError((object)"MainAssetBundle is null");
				return;
			}
			_harmony.PatchAll();
			ShishaConfigInstance = new ShishaConfig(((BaseUnityPlugin)this).Config);
			SetupShisha();
			SetupShishaPoop();
			_harmony.PatchAll();
			_harmony.PatchAll(typeof(ShishaPlugin));
			_harmony.PatchAll(typeof(ShishaPoopBehaviour));
			Mls.LogInfo((object)"Plugin Lethal Company Shisha Mod is loaded!");
		}

		private void SetupShisha()
		{
			_shishaEnemyType = Assets.MainAssetBundle.LoadAsset<EnemyType>("ShishaEnemyType");
			_shishaEnemyType.MaxCount = Mathf.Max(0, SyncedInstance<ShishaConfig>.Instance.ShishaMaxAmount.Value);
			_shishaEnemyType.PowerLevel = Mathf.Max(0f, SyncedInstance<ShishaConfig>.Instance.ShishaPowerLevel.Value);
			_shishaEnemyType.normalizedTimeInDayToLeave = (SyncedInstance<ShishaConfig>.Instance.TimeInDayLeaveEnabled.Value ? 0.6f : 1f);
			_shishaEnemyType.canDie = SyncedInstance<ShishaConfig>.Instance.Killable.Value;
			TerminalNode terminalNode = Assets.MainAssetBundle.LoadAsset<TerminalNode>("ShishaTerminalNode");
			TerminalKeyword terminalKeyword = Assets.MainAssetBundle.LoadAsset<TerminalKeyword>("ShishaTerminalKeyword");
			NetworkPrefabs.RegisterNetworkPrefab(_shishaEnemyType.enemyPrefab);
			Utilities.FixMixerGroups(_shishaEnemyType.enemyPrefab);
			RegisterEnemyWithConfig(SyncedInstance<ShishaConfig>.Instance.ShishaEnabled.Value, SyncedInstance<ShishaConfig>.Instance.ShishaSpawnRarity.Value, _shishaEnemyType, terminalNode, terminalKeyword);
		}

		private void SetupShishaPoop()
		{
			ShishaPoopItem = Assets.MainAssetBundle.LoadAsset<Item>("ShishaPoopItemData");
			NetworkPrefabs.RegisterNetworkPrefab(ShishaPoopItem.spawnPrefab);
			Utilities.FixMixerGroups(ShishaPoopItem.spawnPrefab);
			Items.RegisterScrap(ShishaPoopItem, 0, (LevelTypes)(-1));
		}

		private static void RegisterEnemyWithConfig(bool enemyEnabled, string configMoonRarity, EnemyType enemy, TerminalNode terminalNode, TerminalKeyword terminalKeyword)
		{
			if (enemyEnabled)
			{
				var (dictionary, dictionary2) = ConfigParsing(configMoonRarity);
				Enemies.RegisterEnemy(enemy, dictionary, dictionary2, terminalNode, terminalKeyword);
			}
			else
			{
				Enemies.RegisterEnemy(enemy, 0, (LevelTypes)(-1), terminalNode, terminalKeyword);
			}
		}

		private static (Dictionary<LevelTypes, int> spawnRateByLevelType, Dictionary<string, int> spawnRateByCustomLevelType) ConfigParsing(string configMoonRarity)
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int>();
			Dictionary<string, int> dictionary2 = new Dictionary<string, int>();
			foreach (string item in from s in configMoonRarity.Split(',')
				select s.Trim())
			{
				string[] array = item.Split(':');
				if (array.Length != 2)
				{
					continue;
				}
				string text = array[0];
				if (int.TryParse(array[1], out var result))
				{
					if (Enum.TryParse<LevelTypes>(text, ignoreCase: true, out LevelTypes result2))
					{
						dictionary[result2] = result;
						Mls.LogDebug((object)$"Registered spawn rate for level type {result2} to {result}");
					}
					else if (Enum.TryParse<LevelTypes>(text + "Level", ignoreCase: true, out result2))
					{
						dictionary[result2] = result;
						Mls.LogDebug((object)$"Registered spawn rate for level type {result2} to {result}");
					}
					else
					{
						dictionary2[text] = result;
						Mls.LogDebug((object)$"Registered spawn rate for custom level type {text} to {result}");
					}
				}
			}
			return (dictionary, dictionary2);
		}

		private static void InitializeNetworkStuff()
		{
			IEnumerable<Type> enumerable;
			try
			{
				enumerable = Assembly.GetExecutingAssembly().GetTypes();
			}
			catch (ReflectionTypeLoadException ex)
			{
				enumerable = ex.Types.Where((Type t) => t != null);
			}
			foreach (Type item in enumerable)
			{
				MethodInfo[] methods = item.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				foreach (MethodInfo methodInfo in methods)
				{
					if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}
	}
	internal static class Assets
	{
		private const string MainAssetBundleName = "shishabundle";

		public static AssetBundle MainAssetBundle;

		public static void PopulateAssetsFromFile()
		{
			if ((Object)(object)MainAssetBundle != (Object)null)
			{
				return;
			}
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			if (directoryName != null)
			{
				MainAssetBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "shishabundle"));
				if ((Object)(object)MainAssetBundle != (Object)null)
				{
					return;
				}
				MainAssetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.Combine(directoryName, "Assets"), "shishabundle"));
			}
			if ((Object)(object)MainAssetBundle == (Object)null)
			{
				ShishaPlugin.Mls.LogWarning((object)"Failed to load shishabundle bundle");
			}
		}
	}
	[Serializable]
	public class SyncedInstance<T>
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static HandleNamedMessageDelegate <0>__OnRequestSync;

			public static HandleNamedMessageDelegate <1>__OnReceiveSync;
		}

		[NonSerialized]
		protected static int IntSize = 4;

		internal static CustomMessagingManager MessageManager => NetworkManager.Singleton.CustomMessagingManager;

		internal static bool IsClient => NetworkManager.Singleton.IsClient;

		internal static bool IsHost => NetworkManager.Singleton.IsHost;

		public static T Default { get; private set; }

		public static T Instance { get; private set; }

		public static bool Synced { get; internal set; }

		protected void InitInstance(T instance)
		{
			Default = instance;
			Instance = instance;
			IntSize = 4;
		}

		internal static void SyncInstance(byte[] data)
		{
			Instance = DeserializeFromBytes(data);
			Synced = true;
		}

		internal static void RevertSync()
		{
			Instance = Default;
			Synced = false;
		}

		public static byte[] SerializeToBytes(T val)
		{
			BinaryFormatter binaryFormatter = new BinaryFormatter();
			using MemoryStream memoryStream = new MemoryStream();
			try
			{
				binaryFormatter.Serialize(memoryStream, val);
				return memoryStream.ToArray();
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"Error serializing instance: {arg}");
				return null;
			}
		}

		public static T DeserializeFromBytes(byte[] data)
		{
			BinaryFormatter binaryFormatter = new BinaryFormatter();
			using MemoryStream serializationStream = new MemoryStream(data);
			try
			{
				return (T)binaryFormatter.Deserialize(serializationStream);
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"Error deserializing instance: {arg}");
				return default(T);
			}
		}

		private static void RequestSync()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if (!IsClient)
			{
				return;
			}
			FastBufferWriter val = default(FastBufferWriter);
			((FastBufferWriter)(ref val))..ctor(IntSize, (Allocator)2, -1);
			try
			{
				MessageManager.SendNamedMessage("LCM_Shisha|1.1.4_OnRequestConfigSync", 0uL, val, (NetworkDelivery)3);
			}
			finally
			{
				((IDisposable)(FastBufferWriter)(ref val)).Dispose();
			}
		}

		private static void OnRequestSync(ulong clientId, FastBufferReader _)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			if (!IsHost)
			{
				return;
			}
			Debug.Log((object)$"Config sync request received from client: {clientId}");
			byte[] array = SerializeToBytes(Instance);
			int num = array.Length;
			FastBufferWriter val = default(FastBufferWriter);
			((FastBufferWriter)(ref val))..ctor(num + IntSize, (Allocator)2, -1);
			try
			{
				((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteBytesSafe(array, -1, 0);
				MessageManager.SendNamedMessage("LCM_Shisha|1.1.4_OnReceiveConfigSync", clientId, val, (NetworkDelivery)3);
			}
			catch (Exception arg)
			{
				Debug.Log((object)$"Error occurred syncing config with client: {clientId}\n{arg}");
			}
			finally
			{
				((IDisposable)(FastBufferWriter)(ref val)).Dispose();
			}
		}

		private static void OnReceiveSync(ulong _, FastBufferReader reader)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if (!((FastBufferReader)(ref reader)).TryBeginRead(IntSize))
			{
				Debug.LogError((object)"Config sync error: Could not begin reading buffer.");
				return;
			}
			int num = default(int);
			((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives));
			if (!((FastBufferReader)(ref reader)).TryBeginRead(num))
			{
				Debug.LogError((object)"Config sync error: Host could not sync.");
				return;
			}
			byte[] data = new byte[num];
			((FastBufferReader)(ref reader)).ReadBytesSafe(ref data, num, 0);
			SyncInstance(data);
			Debug.Log((object)"Successfully synced config with host.");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
		public static void InitializeLocalPlayer()
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_0021: 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)
			//IL_002c: Expected O, but got Unknown
			if (IsHost)
			{
				CustomMessagingManager messageManager = MessageManager;
				object obj = <>O.<0>__OnRequestSync;
				if (obj == null)
				{
					HandleNamedMessageDelegate val = OnRequestSync;
					<>O.<0>__OnRequestSync = val;
					obj = (object)val;
				}
				messageManager.RegisterNamedMessageHandler("LCM_Shisha|1.1.4_OnRequestConfigSync", (HandleNamedMessageDelegate)obj);
				Synced = true;
				return;
			}
			Synced = false;
			CustomMessagingManager messageManager2 = MessageManager;
			object obj2 = <>O.<1>__OnReceiveSync;
			if (obj2 == null)
			{
				HandleNamedMessageDelegate val2 = OnReceiveSync;
				<>O.<1>__OnReceiveSync = val2;
				obj2 = (object)val2;
			}
			messageManager2.RegisterNamedMessageHandler("LCM_Shisha|1.1.4_OnReceiveConfigSync", (HandleNamedMessageDelegate)obj2);
			RequestSync();
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")]
		public static void PlayerLeave()
		{
			RevertSync();
		}
	}
	public static class LobbyCompatibilityChecker
	{
		public static bool Enabled => Chainloader.PluginInfos.ContainsKey("BMX.LobbyCompatibility");

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void Init()
		{
			PluginHelper.RegisterPlugin("LethalCompanyShisha", Version.Parse("1.1.4"), (CompatibilityLevel)2, (VersionStrictness)3);
		}
	}
	public class ShishaClient : MonoBehaviour
	{
		private ManualLogSource _mls;

		private string _shishaId;

		private static readonly int IsRunning = Animator.StringToHash("Run");

		private static readonly int IsWalking = Animator.StringToHash("Walk");

		public static readonly int IsDead = Animator.StringToHash("Dead");

		public static readonly int ForceWalk = Animator.StringToHash("ForceWalk");

		private static readonly int WalkSpeed = Animator.StringToHash("WalkSpeed");

		private static readonly int RunSpeed = Animator.StringToHash("RunSpeed");

		public static readonly int Idle1 = Animator.StringToHash("Idle1");

		public static readonly int Idle2 = Animator.StringToHash("Idle2");

		public static readonly int Poo = Animator.StringToHash("Poo");

		[SerializeField]
		private AudioSource creatureVoice;

		[SerializeField]
		private AudioSource creatureSfx;

		[SerializeField]
		private Renderer renderer;

		[SerializeField]
		private Transform poopPlaceholder;

		[SerializeField]
		private ParticleSystem poofParticleSystem;

		[SerializeField]
		private GameObject scanNode;

		[Header("Movement")]
		[Tooltip("The maximum speed that the creature can maintain while still walking")]
		public float walkSpeedThreshold = 2f;

		[Header("Audio")]
		[Tooltip("An array of audio clips that can be played randomly at intervals while the creature is wandering.")]
		public AudioClip[] ambientAudioClips;

		[Tooltip("The volume for ambient audio.")]
		[Range(0f, 2f)]
		public float ambientAudioVolume = 1f;

		[Space]
		[Tooltip("An array of audio clips that can be played randomly at intervals while the creature is moving.")]
		public AudioClip[] walkingAudioClips;

		[Tooltip("The interval between playing walking audio clips.")]
		public float walkingAudioInterval = 0.5f;

		private Animator _animator;

		private readonly NullableObject<ShishaNetcodeController> _netcodeController = new NullableObject<ShishaNetcodeController>();

		private readonly NullableObject<PlayerControllerB> _targetPlayer = new NullableObject<PlayerControllerB>();

		private ShishaPoopBehaviour _currentPoop;

		private Vector3 _agentLastPosition;

		private bool _networkEventsSubscribed;

		private const float MaxWalkAnimationSpeedMultiplier = 2f;

		private float _agentCurrentSpeed;

		private float _walkingAudioTimer;

		private int _currentBehaviourStateIndex;

		private static readonly int GotHit = Animator.StringToHash("GotHit");

		private void OnEnable()
		{
			SubscribeToNetworkEvents();
		}

		private void OnDisable()
		{
			UnsubscribeFromNetworkEvents();
		}

		private void Start()
		{
			_mls = Logger.CreateLogSource("LCM_Shisha|1.1.4 | Shisha Client " + _shishaId);
			_animator = ((Component)this).GetComponent<Animator>();
			_netcodeController.Value = ((Component)this).GetComponent<ShishaNetcodeController>();
			if (_netcodeController != null)
			{
				SubscribeToNetworkEvents();
				InitializeConfigValues();
				AddStateMachineBehaviours(_animator);
			}
			else
			{
				_mls.LogError((object)"Netcode controller is null, this is very bad.");
			}
		}

		private void Update()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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)
			Vector3 position = ((Component)this).transform.position;
			float agentCurrentSpeed = _agentCurrentSpeed;
			Vector3 val = position - _agentLastPosition;
			_agentCurrentSpeed = Mathf.Lerp(agentCurrentSpeed, ((Vector3)(ref val)).magnitude / Time.deltaTime, 0.75f);
			_agentLastPosition = position;
			int currentBehaviourStateIndex = _currentBehaviourStateIndex;
			if (currentBehaviourStateIndex == 0 || currentBehaviourStateIndex == 2)
			{
				if (_agentCurrentSpeed <= walkSpeedThreshold && _agentCurrentSpeed > 0f)
				{
					_animator.SetBool(IsWalking, true);
					_animator.SetBool(IsRunning, false);
					float num = Mathf.Clamp(_agentCurrentSpeed / walkSpeedThreshold, 0f, 2f);
					_animator.SetFloat(WalkSpeed, num);
				}
				else if (_agentCurrentSpeed > walkSpeedThreshold)
				{
					_animator.SetBool(IsWalking, true);
					_animator.SetBool(IsRunning, true);
					float num2 = Mathf.Clamp(_agentCurrentSpeed / 4f, 0f, 5f);
					_animator.SetFloat(RunSpeed, num2);
				}
				else
				{
					_animator.SetBool(IsWalking, false);
					_animator.SetBool(IsRunning, false);
				}
				_walkingAudioTimer -= Time.deltaTime;
				if (walkingAudioClips != null && _walkingAudioTimer <= 0f)
				{
					AudioClip val2 = walkingAudioClips[Random.Range(0, walkingAudioClips.Length)];
					creatureSfx.Stop(true);
					creatureSfx.PlayOneShot(val2);
					WalkieTalkie.TransmitOneShotAudio(creatureSfx, val2, creatureSfx.volume);
					_walkingAudioTimer = walkingAudioInterval;
				}
			}
		}

		private void HandlePlayAmbientSfx(string receivedShishaId, int clipIndex)
		{
			if (!(_shishaId != receivedShishaId))
			{
				AudioClip val = ambientAudioClips[clipIndex];
				creatureVoice.PlayOneShot(val);
				WalkieTalkie.TransmitOneShotAudio(creatureVoice, val, ambientAudioVolume);
			}
		}

		private void HandleSpawnShishaPoop(string receivedShishaId, NetworkObjectReference poopNetworkObjectReference)
		{
			//IL_0049: 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)
			NetworkObject val = default(NetworkObject);
			if (!(_shishaId != receivedShishaId) && ((NetworkObjectReference)(ref poopNetworkObjectReference)).TryGet(ref val, (NetworkManager)null))
			{
				LogDebug("Poop network object was not null!");
				_currentPoop = ((Component)val).GetComponent<ShishaPoopBehaviour>();
				((Component)_currentPoop).transform.position = ((Component)poopPlaceholder).transform.position;
				((Component)_currentPoop).transform.rotation = ((Component)poopPlaceholder).transform.rotation;
				((Component)_currentPoop).transform.SetParent(poopPlaceholder, false);
				LogDebug("Shisha poop spawned");
			}
		}

		public void OnAnimationEventDropShishaPoop()
		{
			if (!((Object)(object)_currentPoop == (Object)null))
			{
				((GrabbableObject)_currentPoop).parentObject = null;
				((Component)_currentPoop).transform.SetParent(StartOfRound.Instance.propsContainer, true);
				((GrabbableObject)_currentPoop).EnablePhysics(true);
				((GrabbableObject)_currentPoop).FallToGround(true);
				((Component)_currentPoop).transform.SetParent(RoundManager.Instance.spawnedScrapContainer, true);
				((GrabbableObject)_currentPoop).isHeld = false;
				((GrabbableObject)_currentPoop).grabbable = true;
				((GrabbableObject)_currentPoop).grabbableToEnemies = true;
			}
		}

		public void OnAnimationEventDeathAnimationComplete()
		{
			((MonoBehaviour)this).StartCoroutine(CompleteDeathSequence());
		}

		private IEnumerator CompleteDeathSequence()
		{
			LogDebug("In CompleteDeathSequence");
			yield return (object)new WaitForSeconds(1f);
			poofParticleSystem.Play();
			renderer.enabled = false;
			creatureSfx.Stop(true);
			Object.Destroy((Object)(object)scanNode.gameObject);
			yield return (object)new WaitForSeconds(0.1f);
			Object.Destroy((Object)(object)((Component)renderer).gameObject);
			if (((NetworkBehaviour)_netcodeController.Value).IsServer)
			{
				SpawnDeathPoopsServerRpc();
				yield return (object)new WaitForSeconds(0.5f);
				ShishaServer component = ((Component)this).GetComponent<ShishaServer>();
				if ((Object)(object)component != (Object)null)
				{
					Object.Destroy((Object)(object)component);
				}
				Object.Destroy((Object)(object)this);
			}
		}

		[ServerRpc]
		private void SpawnDeathPoopsServerRpc()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			foreach (int item in new List<int>(3) { 0, 1, 2 })
			{
				_ = item;
				Vector3 randomNavMeshPositionInRadiusSpherical = RoundManager.Instance.GetRandomNavMeshPositionInRadiusSpherical(((Component)this).transform.position, 2f, default(NavMeshHit));
				GameObject obj = Object.Instantiate<GameObject>(ShishaPlugin.ShishaPoopItem.spawnPrefab, randomNavMeshPositionInRadiusSpherical, Quaternion.identity, StartOfRound.Instance.propsContainer);
				ShishaPoopBehaviour component = obj.GetComponent<ShishaPoopBehaviour>();
				((GrabbableObject)component).EnablePhysics(true);
				((GrabbableObject)component).FallToGround(true);
				((Component)component).transform.SetParent(RoundManager.Instance.spawnedScrapContainer, true);
				obj.GetComponent<NetworkObject>().Spawn(false);
			}
		}

		private void InitializeConfigValues()
		{
			creatureVoice.volume = Mathf.Clamp(SyncedInstance<ShishaConfig>.Default.AmbientSoundEffectsVolume.Value, 0f, 1f) * 2f;
			creatureSfx.volume = Mathf.Clamp(SyncedInstance<ShishaConfig>.Default.FootstepSoundEffectsVolume.Value, 0f, 1f) * 2f;
		}

		private void AddStateMachineBehaviours(Animator receivedAnimator)
		{
			StateMachineBehaviour[] behaviours = receivedAnimator.GetBehaviours<StateMachineBehaviour>();
			for (int i = 0; i < behaviours.Length; i++)
			{
				if (behaviours[i] is BaseStateMachineBehaviour baseStateMachineBehaviour)
				{
					baseStateMachineBehaviour.Initialize(_netcodeController.Value);
				}
			}
		}

		private void HandleBehaviourStateChanged(int oldValue, int newValue)
		{
			_currentBehaviourStateIndex = newValue;
			LogDebug($"Changed behaviour state to {newValue}");
			switch ((ShishaServer.States)newValue)
			{
			case ShishaServer.States.Roaming:
				_animator.SetBool(IsWalking, true);
				break;
			case ShishaServer.States.Idle:
				_animator.SetBool(IsWalking, false);
				_animator.SetBool(IsRunning, false);
				break;
			case ShishaServer.States.RunningAway:
				_animator.SetBool(IsWalking, true);
				_animator.SetTrigger(GotHit);
				break;
			case ShishaServer.States.Dead:
				_animator.SetBool(IsWalking, false);
				_animator.SetBool(IsRunning, false);
				_animator.SetBool(IsDead, true);
				break;
			}
		}

		private void HandleSetAnimationTrigger(string receivedShishaId, int animationId)
		{
			if (!(_shishaId != receivedShishaId))
			{
				_animator.SetTrigger(animationId);
			}
		}

		private void HandleSetAnimationBool(string receivedShishaId, int animationId, bool value)
		{
			if (!(_shishaId != receivedShishaId))
			{
				_animator.SetBool(animationId, value);
			}
		}

		private void HandleSyncShishaIdentifier(string receivedShishaId)
		{
			_shishaId = receivedShishaId;
			ManualLogSource mls = _mls;
			if (mls != null)
			{
				mls.Dispose();
			}
			_mls = Logger.CreateLogSource("LCM_Shisha|1.1.4 | Shisha Client " + _shishaId);
			LogDebug("Successfully synced shisha identifier");
		}

		private void HandleTargetPlayerChanged(ulong oldValue, ulong newValue)
		{
			_targetPlayer.Value = ((newValue == 69420) ? null : StartOfRound.Instance.allPlayerScripts[newValue]);
			LogDebug(_targetPlayer.IsNotNull ? ("Changed target player to " + _targetPlayer.Value?.playerUsername + ".") : "Changed target player to null.");
		}

		private void SubscribeToNetworkEvents()
		{
			if (!_networkEventsSubscribed && _netcodeController.IsNotNull)
			{
				_netcodeController.Value.OnSyncShishaIdentifier += HandleSyncShishaIdentifier;
				_netcodeController.Value.OnSetAnimationTrigger += HandleSetAnimationTrigger;
				_netcodeController.Value.OnSpawnShishaPoop += HandleSpawnShishaPoop;
				_netcodeController.Value.OnPlayAmbientSfx += HandlePlayAmbientSfx;
				_netcodeController.Value.OnSetAnimationBool += HandleSetAnimationBool;
				NetworkVariable<int> currentBehaviourStateIndex = _netcodeController.Value.CurrentBehaviourStateIndex;
				currentBehaviourStateIndex.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Combine((Delegate?)(object)currentBehaviourStateIndex.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(HandleBehaviourStateChanged));
				NetworkVariable<ulong> targetPlayerClientId = _netcodeController.Value.TargetPlayerClientId;
				targetPlayerClientId.OnValueChanged = (OnValueChangedDelegate<ulong>)(object)Delegate.Combine((Delegate?)(object)targetPlayerClientId.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<ulong>(HandleTargetPlayerChanged));
				_networkEventsSubscribed = true;
			}
		}

		private void UnsubscribeFromNetworkEvents()
		{
			if (_networkEventsSubscribed && _netcodeController.IsNotNull)
			{
				_netcodeController.Value.OnSyncShishaIdentifier -= HandleSyncShishaIdentifier;
				_netcodeController.Value.OnSetAnimationTrigger -= HandleSetAnimationTrigger;
				_netcodeController.Value.OnSpawnShishaPoop -= HandleSpawnShishaPoop;
				_netcodeController.Value.OnPlayAmbientSfx -= HandlePlayAmbientSfx;
				_netcodeController.Value.OnSetAnimationBool -= HandleSetAnimationBool;
				NetworkVariable<int> currentBehaviourStateIndex = _netcodeController.Value.CurrentBehaviourStateIndex;
				currentBehaviourStateIndex.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Remove((Delegate?)(object)currentBehaviourStateIndex.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(HandleBehaviourStateChanged));
				NetworkVariable<ulong> targetPlayerClientId = _netcodeController.Value.TargetPlayerClientId;
				targetPlayerClientId.OnValueChanged = (OnValueChangedDelegate<ulong>)(object)Delegate.Remove((Delegate?)(object)targetPlayerClientId.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<ulong>(HandleTargetPlayerChanged));
				_networkEventsSubscribed = false;
			}
		}

		private void LogDebug(string msg)
		{
		}
	}
	public class ShishaConfig : SyncedInstance<ShishaConfig>
	{
		public readonly ConfigEntry<bool> ShishaEnabled;

		public readonly ConfigEntry<string> ShishaSpawnRarity;

		public readonly ConfigEntry<int> ShishaMaxAmount;

		public readonly ConfigEntry<float> ShishaPowerLevel;

		public readonly ConfigEntry<int> CommonCrystalChance;

		public readonly ConfigEntry<int> UncommonCrystalChance;

		public readonly ConfigEntry<int> RareCrystalChance;

		public readonly ConfigEntry<int> CommonCrystalMinValue;

		public readonly ConfigEntry<int> CommonCrystalMaxValue;

		public readonly ConfigEntry<int> UncommonCrystalMinValue;

		public readonly ConfigEntry<int> UncommonCrystalMaxValue;

		public readonly ConfigEntry<int> RareCrystalMinValue;

		public readonly ConfigEntry<int> RareCrystalMaxValue;

		public readonly ConfigEntry<float> AmbientSoundEffectsVolume;

		public readonly ConfigEntry<float> FootstepSoundEffectsVolume;

		public readonly ConfigEntry<float> WanderRadius;

		public readonly ConfigEntry<bool> AnchoredWandering;

		public readonly ConfigEntry<float> MaxSpeed;

		public readonly ConfigEntry<float> MaxAcceleration;

		public readonly ConfigEntry<float> RunningAwayMaxSpeed;

		public readonly ConfigEntry<float> RunningAwayMaxAcceleration;

		public readonly ConfigEntry<float> WanderTimeMin;

		public readonly ConfigEntry<float> WanderTimeMax;

		public readonly ConfigEntry<float> AmbientSfxTimerMin;

		public readonly ConfigEntry<float> AmbientSfxTimerMax;

		public readonly ConfigEntry<bool> TimeInDayLeaveEnabled;

		public readonly ConfigEntry<bool> PoopBehaviourEnabled;

		public readonly ConfigEntry<float> PoopChance;

		public readonly ConfigEntry<bool> Killable;

		public readonly ConfigEntry<int> Health;

		public ShishaConfig(ConfigFile cfg)
		{
			InitInstance(this);
			WanderRadius = cfg.Bind<float>("General", "Wander Radius", 50f, "The maximum distance from the Shisha's current position within which it can wander.");
			AnchoredWandering = cfg.Bind<bool>("General", "Anchored Wandering", true, "When enabled, the Shisha will only wander around its spawn point within a radius defined by the Wander Radius. If disabled, the Shisha can wander from any point within the Wander Radius.");
			Killable = cfg.Bind<bool>("General", "Killable", true, "Whether the Shisha can be killed.");
			Health = cfg.Bind<int>("General", "Health", 3, "The amount of health the Shisha has.");
			MaxSpeed = cfg.Bind<float>("General", "Max Speed", 4f, "The maximum speed of the Shisha.");
			MaxAcceleration = cfg.Bind<float>("General", "Max Acceleration", 5f, "The maximum acceleration of the Shisha.");
			RunningAwayMaxSpeed = cfg.Bind<float>("General", "Running Away Max Speed", 7f, "The maximum speed of the Shisha when running away from someone.");
			RunningAwayMaxAcceleration = cfg.Bind<float>("General", "Running Away Max Acceleration", 8f, "The maximum acceleration of the Shisha when running away from someone.");
			WanderTimeMin = cfg.Bind<float>("General", "Wander Time Minimum", 5f, "The minimum time that the Shisha will wander for.");
			WanderTimeMax = cfg.Bind<float>("General", "Wander Time Maximum", 45f, "The maximum time that the Shisha will wander for.");
			AmbientSfxTimerMin = cfg.Bind<float>("General", "Ambient Sfx Time Interval Minimum", 7.5f, "The minimum time gap between any given ambient sound effect.");
			AmbientSfxTimerMax = cfg.Bind<float>("General", "Ambient Sfx Time Interval Maximum", 30f, "The maximum time gap between any given ambient sound effect.");
			TimeInDayLeaveEnabled = cfg.Bind<bool>("General", "Leave At Night Time Enabled", true, "Toggles whether the Shisha will leave the map when it gets dark like other vanilla daytime entities.");
			PoopBehaviourEnabled = cfg.Bind<bool>("General", "Poop Behaviour Enabled", true, "Toggles whether the Shisha can poop when idle.");
			PoopChance = cfg.Bind<float>("General", "Poop Chance", 0.05f, "The chance from 0 to 1, of the Shisha pooping while idle.");
			ShishaEnabled = cfg.Bind<bool>("Spawn Values", "Shisha Enabled", true, "Whether the Shisha is enabled (will spawn in games).");
			ShishaSpawnRarity = cfg.Bind<string>("Spawn Values", "Shisha Spawn Rarity", "All:30", "Spawn weight of the Shisha on all moons. You can to add to it any moon, just follow the format (also needs LLL installed for LE moons to work with this config).");
			ShishaMaxAmount = cfg.Bind<int>("Spawn Values", "Max Amount", 4, "The max amount of Shisha's that can spawn.");
			ShishaPowerLevel = cfg.Bind<float>("Spawn Values", "Power Level", 0.1f, "The power level of the Shisha.");
			CommonCrystalChance = cfg.Bind<int>("Spawn Values", "Common Crystal Spawn Chance", 65, "The percentage chance of the Shisha pooping a common sized crystal. Make sure the values of all the crystals add up to 100.");
			UncommonCrystalChance = cfg.Bind<int>("Spawn Values", "Uncommon Crystal Spawn Chance", 25, "The percentage chance of the Shisha pooping a uncommon sized crystal. Make sure the values of all the crystals add up to 100.");
			RareCrystalChance = cfg.Bind<int>("Spawn Values", "Rare Crystal Spawn Chance", 10, "The percentage chance of the Shisha pooping a rare sized crystal. Make sure the values of all the crystals add up to 100.");
			CommonCrystalMinValue = cfg.Bind<int>("Spawn Values", "Common Crystal Minimum Value", 20, "The minimum value that the common crystal can spawn with.");
			CommonCrystalMaxValue = cfg.Bind<int>("Spawn Values", "Common Crystal Maximum Value", 35, "The maximum value that the common crystal can spawn with.");
			UncommonCrystalMinValue = cfg.Bind<int>("Spawn Values", "Uncommon Crystal Minimum Value", 40, "The minimum value that the uncommon crystal can spawn with.");
			UncommonCrystalMaxValue = cfg.Bind<int>("Spawn Values", "Uncommon Crystal Maximum Value", 75, "The maximum value that the uncommon crystal can spawn with.");
			RareCrystalMinValue = cfg.Bind<int>("Spawn Values", "Rare Crystal Minimum Value", 80, "The minimum value that the rare crystal can spawn with.");
			RareCrystalMaxValue = cfg.Bind<int>("Spawn Values", "Rare Crystal Maximum Value", 100, "The maximum value that the rare crystal can spawn with.");
			AmbientSoundEffectsVolume = cfg.Bind<float>("Audio", "Ambient Sound Effects Volume", 0.4f, "The volume of the ambient sounds of the Shisha from 0 to 1.");
			FootstepSoundEffectsVolume = cfg.Bind<float>("Audio", "Footstep Sound Effects Volume", 0.7f, "The volume of the footstep sounds of the Shisha from 0 to 1.");
		}
	}
	public class ShishaNetcodeController : NetworkBehaviour
	{
		[HideInInspector]
		public readonly NetworkVariable<int> CurrentBehaviourStateIndex = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		[HideInInspector]
		public readonly NetworkVariable<ulong> TargetPlayerClientId = new NetworkVariable<ulong>(0uL, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public event Action<string> OnSyncShishaIdentifier;

		public event Action<string> OnIdleCompleteStateBehaviourCallback;

		public event Action<string, int> OnSetAnimationTrigger;

		public event Action<string, NetworkObjectReference> OnSpawnShishaPoop;

		public event Action<string, int> OnPlayAmbientSfx;

		public event Action<string, int, bool> OnSetAnimationBool;

		[ClientRpc]
		public void PlayAmbientSfxClientRpc(string receivedShishaId, 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_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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_00c7: 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(787179278u, val, (RpcDelivery)0);
				bool flag = receivedShishaId != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(receivedShishaId, false);
				}
				BytePacker.WriteValueBitPacked(val2, clipIndex);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 787179278u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				this.OnPlayAmbientSfx?.Invoke(receivedShishaId, clipIndex);
			}
		}

		[ClientRpc]
		public void SpawnShishaPoopClientRpc(string receivedShishaId, NetworkObjectReference poopNetworkObjectReference)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			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(3512806445u, val, (RpcDelivery)0);
				bool flag = receivedShishaId != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(receivedShishaId, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref poopNetworkObjectReference, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3512806445u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				this.OnSpawnShishaPoop?.Invoke(receivedShishaId, poopNetworkObjectReference);
			}
		}

		[ClientRpc]
		public void SetAnimationTriggerClientRpc(string receivedShishaId, int animationId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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_00c7: 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(1082093719u, val, (RpcDelivery)0);
				bool flag = receivedShishaId != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(receivedShishaId, false);
				}
				BytePacker.WriteValueBitPacked(val2, animationId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1082093719u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				this.OnSetAnimationTrigger?.Invoke(receivedShishaId, animationId);
			}
		}

		[ClientRpc]
		public void SetAnimationBoolClientRpc(string receivedShishaId, int animationId, 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_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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)
			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(502806586u, val, (RpcDelivery)0);
				bool flag = receivedShishaId != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(receivedShishaId, false);
				}
				BytePacker.WriteValueBitPacked(val2, animationId);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref value, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 502806586u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				this.OnSetAnimationBool?.Invoke(receivedShishaId, animationId, value);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void IdleCompleteStateBehaviourCallbackServerRpc(string receivedShishaId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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 != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(284395386u, val, (RpcDelivery)0);
				bool flag = receivedShishaId != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(receivedShishaId, false);
				}
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 284395386u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				this.OnIdleCompleteStateBehaviourCallback?.Invoke(receivedShishaId);
			}
		}

		[ClientRpc]
		public void SyncShishaIdentifierClientRpc(string receivedShishaId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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(2029305066u, val, (RpcDelivery)0);
				bool flag = receivedShishaId != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(receivedShishaId, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2029305066u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				this.OnSyncShishaIdentifier?.Invoke(receivedShishaId);
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_ShishaNetcodeController()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(787179278u, new RpcReceiveHandler(__rpc_handler_787179278));
			NetworkManager.__rpc_func_table.Add(3512806445u, new RpcReceiveHandler(__rpc_handler_3512806445));
			NetworkManager.__rpc_func_table.Add(1082093719u, new RpcReceiveHandler(__rpc_handler_1082093719));
			NetworkManager.__rpc_func_table.Add(502806586u, new RpcReceiveHandler(__rpc_handler_502806586));
			NetworkManager.__rpc_func_table.Add(284395386u, new RpcReceiveHandler(__rpc_handler_284395386));
			NetworkManager.__rpc_func_table.Add(2029305066u, new RpcReceiveHandler(__rpc_handler_2029305066));
		}

		private static void __rpc_handler_787179278(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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string receivedShishaId = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref receivedShishaId, false);
				}
				int clipIndex = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref clipIndex);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ShishaNetcodeController)(object)target).PlayAmbientSfxClientRpc(receivedShishaId, clipIndex);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3512806445(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_0067: 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)
			//IL_008b: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string receivedShishaId = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref receivedShishaId, false);
				}
				NetworkObjectReference poopNetworkObjectReference = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref poopNetworkObjectReference, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ShishaNetcodeController)(object)target).SpawnShishaPoopClientRpc(receivedShishaId, poopNetworkObjectReference);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1082093719(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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string receivedShishaId = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref receivedShishaId, false);
				}
				int animationId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref animationId);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ShishaNetcodeController)(object)target).SetAnimationTriggerClientRpc(receivedShishaId, animationId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_502806586(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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: 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_0089: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string receivedShishaId = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref receivedShishaId, false);
				}
				int animationId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref animationId);
				bool value = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref value, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ShishaNetcodeController)(object)target).SetAnimationBoolClientRpc(receivedShishaId, animationId, value);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_284395386(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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string receivedShishaId = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref receivedShishaId, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ShishaNetcodeController)(object)target).IdleCompleteStateBehaviourCallbackServerRpc(receivedShishaId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2029305066(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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string receivedShishaId = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref receivedShishaId, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ShishaNetcodeController)(object)target).SyncShishaIdentifierClientRpc(receivedShishaId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "ShishaNetcodeController";
		}
	}
	public class ShishaPoopBehaviour : PhysicsProp
	{
		private ManualLogSource _mls;

		private string _poopId;

		public MeshFilter meshFilter;

		public Mesh[] poopMeshVariants;

		public Material[] poopMaterialVariants;

		private bool _networkEventsSubscribed;

		private bool _loadedVariantFromSave;

		private CachedValue<ScanNodeProperties> _scanNode;

		private CachedValue<NetworkObject> _networkObject;

		private readonly NetworkVariable<int> _variantIndex = new NetworkVariable<int>(-1, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		private readonly NetworkVariable<bool> _isPartOfShisha = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		private readonly NetworkVariable<int> _scrapValue = new NetworkVariable<int>(69420, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		private const int ScrapValuePlaceholder = 69420;

		private void Awake()
		{
			_networkObject = new CachedValue<NetworkObject>((Func<NetworkObject>)((Component)this).GetComponent<NetworkObject>, eager: true);
		}

		private void OnEnable()
		{
			SubscribeToNetworkEvents();
		}

		private void OnDisable()
		{
			UnsubscribeFromNetworkEvents();
		}

		public override void Start()
		{
			((GrabbableObject)this).Start();
			_scanNode = new CachedValue<ScanNodeProperties>((Func<ScanNodeProperties>)((Component)this).GetComponentInChildren<ScanNodeProperties>, eager: true);
			SubscribeToNetworkEvents();
			if (((NetworkBehaviour)this).IsServer)
			{
				_poopId = Guid.NewGuid().ToString();
				_mls = Logger.CreateLogSource("LCM_Shisha|1.1.4 | Shisha Poop " + _poopId);
				Random.InitState(StartOfRound.Instance.randomMapSeed + _poopId.GetHashCode());
				SyncPoopIdClientRpc(_poopId);
				if (!_loadedVariantFromSave)
				{
					_variantIndex.Value = GetRandomVariantIndex();
					_scrapValue.Value = CalculateScrapValue(_variantIndex.Value);
					_isPartOfShisha.Value = true;
				}
			}
		}

		public override void Update()
		{
			if (((GrabbableObject)this).isHeld && _isPartOfShisha.Value)
			{
				if (((NetworkBehaviour)this).IsServer)
				{
					_isPartOfShisha.Value = false;
				}
				else
				{
					SetIsPartOfShishaServerRpc(value: false);
				}
			}
			if (!_isPartOfShisha.Value)
			{
				((GrabbableObject)this).Update();
			}
		}

		public override void LateUpdate()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			if (_isPartOfShisha.Value)
			{
				if ((Object)(object)((Component)this).transform.parent != (Object)null)
				{
					((Component)this).transform.position = ((Component)this).transform.parent.position;
					((Component)this).transform.rotation = ((Component)this).transform.parent.rotation;
				}
			}
			else
			{
				((GrabbableObject)this).LateUpdate();
			}
		}

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

		public override void EquipItem()
		{
			((PhysicsProp)this).EquipItem();
			EvaluateIsPartOfShisha();
		}

		public override void GrabItem()
		{
			((GrabbableObject)this).GrabItem();
			EvaluateIsPartOfShisha();
		}

		private void EvaluateIsPartOfShisha()
		{
			if (_isPartOfShisha.Value)
			{
				if (((NetworkBehaviour)this).IsServer)
				{
					_isPartOfShisha.Value = false;
				}
				else
				{
					SetIsPartOfShishaServerRpc(value: false);
				}
			}
		}

		[HarmonyPatch(typeof(BeltBagItem), "PutObjectInBagLocalClient")]
		[HarmonyPostfix]
		private static void TriggerHeldActions(BeltBagItem __instance, GrabbableObject gObject)
		{
			if (gObject is ShishaPoopBehaviour shishaPoopBehaviour)
			{
				((GrabbableObject)shishaPoopBehaviour).EquipItem();
			}
		}

		private static int CalculateScrapValue(int variant)
		{
			return variant switch
			{
				0 => Random.Range(SyncedInstance<ShishaConfig>.Instance.CommonCrystalMinValue.Value, SyncedInstance<ShishaConfig>.Instance.CommonCrystalMaxValue.Value + 1), 
				1 => Random.Range(SyncedInstance<ShishaConfig>.Instance.UncommonCrystalMinValue.Value, SyncedInstance<ShishaConfig>.Instance.UncommonCrystalMaxValue.Value + 1), 
				2 => Random.Range(SyncedInstance<ShishaConfig>.Instance.RareCrystalMinValue.Value, SyncedInstance<ShishaConfig>.Instance.RareCrystalMaxValue.Value + 1), 
				_ => 1, 
			};
		}

		private void ApplyVariant(int chosenVariantIndex)
		{
			if (poopMaterialVariants.Length != 0 && poopMeshVariants.Length != 0 && poopMaterialVariants.Length == poopMeshVariants.Length)
			{
				((Renderer)((GrabbableObject)this).mainObjectRenderer).material = poopMaterialVariants[chosenVariantIndex];
				meshFilter.mesh = poopMeshVariants[chosenVariantIndex];
				LogDebug($"New random variant applied with index: {chosenVariantIndex}");
			}
			else
			{
				_mls.LogError((object)$"No material variants available with index: {chosenVariantIndex}.");
			}
		}

		private static int GetRandomVariantIndex()
		{
			int num = SyncedInstance<ShishaConfig>.Instance.CommonCrystalChance.Value;
			int num2 = SyncedInstance<ShishaConfig>.Instance.UncommonCrystalChance.Value;
			int value = SyncedInstance<ShishaConfig>.Instance.RareCrystalChance.Value;
			if (num + num2 + value != 100)
			{
				num = 65;
				num2 = 25;
				value = 10;
			}
			int num3 = Random.Range(1, 101);
			if (num3 <= num)
			{
				return 0;
			}
			if (num3 <= num + num2)
			{
				return 1;
			}
			return 2;
		}

		private void OnScrapValueChanged(int oldValue, int newValue)
		{
			((GrabbableObject)this).scrapValue = newValue;
			_scanNode.Value.scrapValue = newValue;
			_scanNode.Value.subText = $"Value: ${newValue}";
		}

		private void OnVariantIndexChanged(int oldValue, int newValue)
		{
			ApplyVariant(newValue);
		}

		private void OnIsPartOfShishaChanged(bool oldValue, bool newValue)
		{
			((GrabbableObject)this).grabbableToEnemies = !newValue;
			((GrabbableObject)this).grabbable = !newValue;
			((GrabbableObject)this).fallTime = ((!newValue) ? 1f : 0f);
		}

		public override int GetItemDataToSave()
		{
			return int.Parse($"{_variantIndex.Value + 1}{Mathf.Max(_scrapValue.Value, 0)}");
		}

		public override void LoadItemSaveData(int saveData)
		{
			_loadedVariantFromSave = true;
			string text = $"{saveData}";
			int loadedVariantIndex = int.Parse($"{text[0]}") - 1;
			string text2 = text;
			int loadedScrapValue = int.Parse(text2.Substring(1, text2.Length - 1) ?? "");
			((MonoBehaviour)this).StartCoroutine(ApplyItemSaveData(loadedVariantIndex, loadedScrapValue));
		}

		private IEnumerator ApplyItemSaveData(int loadedVariantIndex, int loadedScrapValue)
		{
			while (!_networkObject.Value.IsSpawned)
			{
				yield return null;
			}
			_variantIndex.Value = loadedVariantIndex;
			_scrapValue.Value = loadedScrapValue;
			_isPartOfShisha.Value = false;
		}

		[ClientRpc]
		public void SyncPoopIdClientRpc(string poopId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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(32545544u, val, (RpcDelivery)0);
				bool flag = poopId != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(poopId, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 32545544u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((NetworkBehaviour)this).IsServer)
			{
				_poopId = poopId;
				ManualLogSource mls = _mls;
				if (mls != null)
				{
					mls.Dispose();
				}
				_mls = Logger.CreateLogSource("LCM_Shisha|1.1.4 | Shisha Poop " + _poopId);
			}
		}

		private void SubscribeToNetworkEvents()
		{
			if (!_networkEventsSubscribed)
			{
				NetworkVariable<int> variantIndex = _variantIndex;
				variantIndex.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Combine((Delegate?)(object)variantIndex.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(OnVariantIndexChanged));
				NetworkVariable<bool> isPartOfShisha = _isPartOfShisha;
				isPartOfShisha.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Combine((Delegate?)(object)isPartOfShisha.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(OnIsPartOfShishaChanged));
				NetworkVariable<int> scrapValue = _scrapValue;
				scrapValue.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Combine((Delegate?)(object)scrapValue.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(OnScrapValueChanged));
				_networkEventsSubscribed = true;
			}
		}

		private void UnsubscribeFromNetworkEvents()
		{
			if (_networkEventsSubscribed)
			{
				NetworkVariable<int> variantIndex = _variantIndex;
				variantIndex.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Remove((Delegate?)(object)variantIndex.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(OnVariantIndexChanged));
				NetworkVariable<bool> isPartOfShisha = _isPartOfShisha;
				isPartOfShisha.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Remove((Delegate?)(object)isPartOfShisha.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(OnIsPartOfShishaChanged));
				NetworkVariable<int> scrapValue = _scrapValue;
				scrapValue.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Remove((Delegate?)(object)scrapValue.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(OnScrapValueChanged));
				_networkEventsSubscribed = false;
			}
		}

		private void LogDebug(string msg)
		{
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_ShishaPoopBehaviour()
		{
			//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(4263262004u, new RpcReceiveHandler(__rpc_handler_4263262004));
			NetworkManager.__rpc_func_table.Add(32545544u, new RpcReceiveHandler(__rpc_handler_32545544));
		}

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

		private static void __rpc_handler_32545544(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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string poopId = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref poopId, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ShishaPoopBehaviour)(object)target).SyncPoopIdClientRpc(poopId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "ShishaPoopBehaviour";
		}
	}
	public class ShishaServer : EnemyAI
	{
		private enum PathStatus
		{
			Invalid,
			ValidButInLos,
			Valid,
			Unknown
		}

		public enum States
		{
			Roaming,
			Idle,
			RunningAway,
			Dead
		}

		private ManualLogSource _mls;

		private string _shishaId;

		[SerializeField]
		private AISearchRoutine roamSearchRoutine;

		[SerializeField]
		private Transform poopPlaceholder;

		[Header("Movement")]
		[Tooltip("Toggle whether the creature is allowed to wander or not.")]
		public bool wanderEnabled = true;

		[Tooltip("When enabled, the creature will only wander around its spawn point within a radius defined by the Wander Radius. If disabled, the creature can wander from any point within the Wander Radius.")]
		public bool anchoredWandering = true;

		[Tooltip("The maximum speed of the creature.")]
		public float maxSpeed = 4f;

		[Tooltip("The maximum acceleration of the creature.")]
		public float maxAcceleration = 5f;

		[Tooltip("The creature will wander for a random duration within this range before going to an idle state.")]
		public Vector2 wanderTimeRange = new Vector2(5f, 45f);

		public Vector2 ambientSfxTimerRange = new Vector2(7.5f, 40f);

		public float poopChance = 0.05f;

		public float runningAwayMaxSpeed = 4f;

		public float runningAwayMaxAcceleration = 8f;

		public const ulong NullPlayerId = 69420uL;

		private ShishaNetcodeController _netcodeController;

		private float _wanderTimer;

		private float _agentMaxSpeed;

		private float _agentMaxAcceleration;

		private float _ambientAudioTimer;

		private float _takeDamageCooldown;

		private int _numberOfAmbientAudioClips;

		private bool _poopBehaviourEnabled;

		private bool _killable;

		private bool _networkEventsSubscribed;

		private Vector3 _idlePosition;

		private Vector3 _spawnPosition;

		private Transform _runAwayTransform;

		private readonly NullableObject<PlayerControllerB> _actualTargetPlayer = new NullableObject<PlayerControllerB>();

		private void OnEnable()
		{
			SubscribeToNetworkEvents();
		}

		private void OnDisable()
		{
			UnsubscribeFromNetworkEvents();
		}

		public override void Start()
		{
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Start();
			if (!((NetworkBehaviour)this).IsServer)
			{
				return;
			}
			_shishaId = Guid.NewGuid().ToString();
			_mls = Logger.CreateLogSource("LCM_Shisha|1.1.4 | Shisha Server " + _shishaId);
			if ((Object)(object)base.agent == (Object)null)
			{
				base.agent = ((Component)this).GetComponent<NavMeshAgent>();
			}
			if ((Object)(object)base.creatureAnimator == (Object)null)
			{
				base.creatureAnimator = ((Component)this).GetComponent<Animator>();
			}
			_netcodeController = ((Component)this).GetComponent<ShishaNetcodeController>();
			if ((Object)(object)_netcodeController != (Object)null)
			{
				SubscribeToNetworkEvents();
				Random.InitState(StartOfRound.Instance.randomMapSeed + _shishaId.GetHashCode() - base.thisEnemyIndex);
				_netcodeController.SyncShishaIdentifierClientRpc(_shishaId);
				InitializeConfigValues();
				base.allAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode");
				_spawnPosition = ((Component)this).transform.position;
				_numberOfAmbientAudioClips = ((Component)this).GetComponent<ShishaClient>().ambientAudioClips.Length;
				if (wanderEnabled)
				{
					InitializeState(0);
				}
				LogDebug("Shisha spawned!");
			}
			else
			{
				_mls.LogError((object)"Netcode controller is null, aborting spawn.");
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		public override void Update()
		{
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			if (base.isEnemyDead)
			{
				return;
			}
			((EnemyAI)this).Update();
			if (!((NetworkBehaviour)this).IsServer)
			{
				return;
			}
			_takeDamageCooldown -= Time.deltaTime;
			if (!wanderEnabled)
			{
				return;
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				_wanderTimer -= Time.deltaTime;
				if (_wanderTimer <= 0f)
				{
					SwitchBehaviourState(1);
				}
				else
				{
					MoveWithAcceleration();
				}
				break;
			case 1:
				base.agent.speed = 0f;
				((Component)this).transform.position = _idlePosition;
				break;
			case 2:
				MoveWithAcceleration();
				break;
			}
			_ambientAudioTimer -= Time.deltaTime;
			if (_ambientAudioTimer <= 0f)
			{
				_ambientAudioTimer = Random.Range(ambientSfxTimerRange.x, ambientSfxTimerRange.y);
				if (_numberOfAmbientAudioClips != 0)
				{
					_netcodeController.PlayAmbientSfxClientRpc(_shishaId, Random.Range(0, _numberOfAmbientAudioClips));
				}
			}
		}

		public override void DoAIInterval()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			if (((NetworkBehaviour)this).IsServer && !base.isEnemyDead && base.currentBehaviourStateIndex == 2 && Vector3.Distance(((Component)this).transform.position, _runAwayTransform.position) <= 3f)
			{
				SwitchBehaviourState((!wanderEnabled) ? 1 : 0);
			}
		}

		public override void DaytimeEnemyLeave()
		{
			if (((NetworkBehaviour)this).IsServer && SyncedInstance<ShishaConfig>.Instance.TimeInDayLeaveEnabled.Value)
			{
				((MonoBehaviour)this).StartCoroutine(LeaveWhenNoOneIsLooking(Random.Range(5f, 12f)));
				((EnemyAI)this).DaytimeEnemyLeave();
			}
		}

		private IEnumerator LeaveWhenNoOneIsLooking(float checkIntervalTimer)
		{
			while (IsPlayerLookingAtShisha(120f, 80))
			{
				yield return (object)new WaitForSeconds(checkIntervalTimer);
			}
			((EnemyAI)this).KillEnemyServerRpc(false);
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}

		private bool IsPlayerLookingAtShisha(float playerViewWidth = 30f, int playerViewRange = 60, float playerProximityAwareness = 3f)
		{
			return StartOfRound.Instance.allPlayerScripts.Where((PlayerControllerB player) => !player.isPlayerDead).Any((PlayerControllerB player) => player.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 0.5f, playerViewWidth, playerViewRange, playerProximityAwareness));
		}

		private void MoveWithAcceleration()
		{
			float num = Time.deltaTime / 2f;
			base.agent.speed = Mathf.Lerp(base.agent.speed, _agentMaxSpeed, num);
			float deltaTime = Time.deltaTime;
			base.agent.acceleration = Mathf.Lerp(base.agent.acceleration, _agentMaxAcceleration, deltaTime);
		}

		private void InitializeState(int state)
		{
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			LogDebug($"Initializing state: {state}");
			switch (state)
			{
			case 0:
				_agentMaxSpeed = maxSpeed;
				_agentMaxAcceleration = maxAcceleration;
				_wanderTimer = Random.Range(wanderTimeRange.x, wanderTimeRange.y);
				((EnemyAI)this).StartSearch(anchoredWandering ? _spawnPosition : ((Component)this).transform.position, roamSearchRoutine);
				break;
			case 1:
				base.agent.speed = 0f;
				base.agent.acceleration = 40f;
				_agentMaxSpeed = 0f;
				_agentMaxAcceleration = maxAcceleration;
				base.moveTowardsDestination = false;
				_idlePosition = ((Component)this).transform.position;
				if (roamSearchRoutine.inProgress)
				{
					((EnemyAI)this).StopSearch(roamSearchRoutine, true);
				}
				PickRandomIdleAnimation();
				break;
			case 2:
			{
				if (roamSearchRoutine.inProgress)
				{
					((EnemyAI)this).StopSearch(roamSearchRoutine, true);
				}
				NavMeshAgent agent = base.agent;
				agent.speed *= 1.25f;
				NavMeshAgent agent2 = base.agent;
				agent2.acceleration *= 1.25f;
				_agentMaxSpeed = runningAwayMaxSpeed;
				_agentMaxAcceleration = runningAwayMaxAcceleration;
				break;
			}
			case 3:
				_netcodeController.SetAnimationBoolClientRpc(_shishaId, ShishaClient.IsDead, value: true);
				if (roamSearchRoutine.inProgress)
				{
					((EnemyAI)this).StopSearch(roamSearchRoutine, true);
				}
				base.agent.speed = 0f;
				base.agent.acceleration = 100f;
				_agentMaxSpeed = 0f;
				_agentMaxAcceleration = 100f;
				base.moveTowardsDestination = false;
				((EnemyAI)this).KillEnemyServerRpc(false);
				break;
			}
		}

		public void HandleIdleCompleteStateBehaviourCallback(string receivedShishaId)
		{
			if (((NetworkBehaviour)this).IsServer && !(_shishaId != receivedShishaId))
			{
				SwitchBehaviourState(0);
				_netcodeController.SetAnimationTriggerClientRpc(_shishaId, ShishaClient.ForceWalk);
			}
		}

		private void PickRandomIdleAnimation()
		{
			if (!((NetworkBehaviour)this).IsServer)
			{
				return;
			}
			float value = Random.value;
			LogDebug($"Random value to determine chance of pooping: {value}");
			if (value < poopChance && _poopBehaviourEnabled)
			{
				SpawnShishaPoop();
				_netcodeController.SetAnimationTriggerClientRpc(_shishaId, ShishaClient.Poo);
				return;
			}
			int num = Random.Range(1, 3);
			int num2 = num switch
			{
				1 => ShishaClient.Idle1, 
				2 => ShishaClient.Idle2, 
				_ => 0, 
			};
			if (num2 == 0)
			{
				LogDebug($"Unable to play animation with random number: {num}");
				return;
			}
			LogDebug($"Playing animation with id: ({num}, {num2})");
			_netcodeController.SetAnimationTriggerClientRpc(_shishaId, num2);
		}

		private void SpawnShishaPoop()
		{
			//IL_0038: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			if (((NetworkBehaviour)this).IsServer)
			{
				if ((Object)(object)poopPlaceholder == (Object)null)
				{
					_mls.LogError((object)"PoopBehaviour is null, this should not happen.");
					return;
				}
				GameObject val = Object.Instantiate<GameObject>(ShishaPlugin.ShishaPoopItem.spawnPrefab, poopPlaceholder.position, poopPlaceholder.rotation, poopPlaceholder);
				val.GetComponent<ShishaPoopBehaviour>();
				val.GetComponent<NetworkObject>().Spawn(false);
				_netcodeController.SpawnShishaPoopClientRpc(_shishaId, NetworkObjectReference.op_Implicit(val));
			}
		}

		public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitId = -1)
		{
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: 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)
			((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitId);
			if (!((NetworkBehaviour)this).IsServer || base.isEnemyDead || base.currentBehaviourStateIndex == 3 || !_killable || _takeDamageCooldown > 0f)
			{
				return;
			}
			base.enemyHP -= force;
			_takeDamageCooldown = 0.03f;
			if (base.enemyHP > 0)
			{
				_runAwayTransform = GetFarthestValidNodeFromPosition(out var pathStatus, base.agent, ((Object)(object)playerWhoHit == (Object)null) ? ((Component)this).transform.position : ((Component)playerWhoHit).transform.position, base.allAINodes);
				if (pathStatus == PathStatus.Invalid)
				{
					SwitchBehaviourState(0);
					return;
				}
				((EnemyAI)this).SetDestinationToPosition(_runAwayTransform.position, false);
				SwitchBehaviourState(2);
			}
			else
			{
				_netcodeController.TargetPlayerClientId.Value = (((Object)(object)playerWhoHit == (Object)null) ? 69420 : playerWhoHit.actualClientId);
				SwitchBehaviourState(3);
			}
		}

		private static Transform GetFarthestValidNodeFromPosition(out PathStatus pathStatus, NavMeshAgent agent, Vector3 position, IEnumerable<GameObject> allAINodes, IEnumerable<GameObject> ignoredAINodes = null, bool checkLineOfSight = false, bool allowFallbackIfBlocked = false, float bufferDistance = 1f, ManualLogSource logSource = null)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return GetValidNodeFromPosition(findClosest: false, out pathStatus, agent, position, allAINodes, ignoredAINodes, checkLineOfSight, allowFallbackIfBlocked, bufferDistance, logSource);
		}

		private static Transform GetValidNodeFromPosition(bool findClosest, out PathStatus pathStatus, NavMeshAgent agent, Vector3 position, IEnumerable<GameObject> allAINodes, IEnumerable<GameObject> ignoredAINodes, bool checkLineOfSight, bool allowFallbackIfBlocked, float bufferDistance, ManualLogSource logSource)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: 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)
			HashSet<GameObject> hashSet;
			if (ignoredAINodes == null)
			{
				hashSet = new HashSet<GameObject>();
			}
			else
			{
				HashSet<GameObject> hashSet2 = new HashSet<GameObject>();
				foreach (GameObject ignoredAINode in ignoredAINodes)
				{
					hashSet2.Add(ignoredAINode);
				}
				hashSet = hashSet2;
			}
			HashSet<GameObject> ignoredNodesSet = hashSet;
			List<GameObject> list = allAINodes.Where((GameObject node) => !ignoredNodesSet.Contains(node) && Vector3.Distance(position, node.transform.position) > bufferDistance).ToList();
			list.Sort(delegate(GameObject a, GameObject b)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: 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_0023: Unknown result type (might be due to invalid IL or missing references)
				float value = Vector3.Distance(position, a.transform.position);
				float value2 = Vector3.Distance(position, b.transform.position);
				return (!findClosest) ? value2.CompareTo(value) : value.CompareTo(value2);
			});
			foreach (GameObject item in list)
			{
				pathStatus = IsPathValid(agent, item.transform.position, checkLineOfSight, 0f, logSource);
				if (pathStatus == PathStatus.Valid)
				{
					return item.transform;
				}
				if (!(pathStatus == PathStatus.ValidButInLos && allowFallbackIfBlocked))
				{
					continue;
				}
				foreach (GameObject item2 in list)
				{
					if (!((Object)(object)item2 == (Object)(object)item) && IsPathValid(agent, item2.transform.position, checkLineOfSight: false, 0f, logSource) == PathStatus.Valid)
					{
						pathStatus = PathStatus.ValidButInLos;
						return item2.transform;
					}
				}
			}
			pathStatus = PathStatus.Invalid;
			return null;
		}

		private static PathStatus IsPathValid(NavMeshAgent agent, Vector3 position, bool checkLineOfSight = false, float bufferDistance = 0f, ManualLogSource logSource = null)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//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_001c: Expected O, but got Unknown
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			if (Vector3.Distance(((Component)agent).transform.position, position) <= bufferDistance)
			{
				return PathStatus.Valid;
			}
			NavMeshPath val = new NavMeshPath();
			if (!agent.CalculatePath(position, val) || val.corners.Length == 0)
			{
				return PathStatus.Invalid;
			}
			if ((int)val.status != 0)
			{
				return PathStatus.Invalid;
			}
			if (checkLineOfSight)
			{
				if ((double)Vector3.Distance(val.corners[^1], RoundManager.Instance.GetNavMeshPosition(position, RoundManager.Instance.navHit, 2.7f, -1)) > 1.5)
				{
					return PathStatus.ValidButInLos;
				}
				for (int i = 1; i < val.corners.Length; i++)
				{
					if (Physics.Linecast(val.corners[i - 1], val.corners[i], 262144))
					{
						return PathStatus.ValidButInLos;
					}
				}
			}
			return PathStatus.Valid;
		}

		private void InitializeConfigValues()
		{
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			if (((NetworkBehaviour)this).IsServer)
			{
				float num = Mathf.Clamp(SyncedInstance<ShishaConfig>.Instance.WanderTimeMin.Value, 0f, 500f);
				float num2 = Mathf.Clamp(SyncedInstance<ShishaConfig>.Instance.AmbientSfxTimerMin.Value, 0f, 500f);
				roamSearchRoutine.loopSearch = true;
				roamSearchRoutine.searchWidth = Mathf.Clamp(SyncedInstance<ShishaConfig>.Instance.WanderRadius.Value, 50f, 500f);
				base.creatureVoice.volume = Mathf.Clamp(SyncedInstance<ShishaConfig>.Default.AmbientSoundEffectsVolume.Value, 0f, 1f) * 2f;
				base.creatureSFX.volume = Mathf.Clamp(SyncedInstance<ShishaConfig>.Default.FootstepSoundEffectsVolume.Value, 0f, 1f) * 2f;
				anchoredWandering = SyncedInstance<ShishaConfig>.Instance.AnchoredWandering.Value;
				maxSpeed = Mathf.Clamp(SyncedInstance<ShishaConfig>.Instance.MaxSpeed.Value, 0.1f, 100f);
				maxAcceleration = Mathf.Clamp(SyncedInstance<ShishaConfig>.Instance.MaxAcceleration.Value, 0.1f, 100f);
				runningAwayMaxSpeed = Mathf.Clamp(SyncedInstance<ShishaConfig>.Instance.RunningAwayMaxSpeed.Value, 0.1f, 100f);
				runningAwayMaxAcceleration = Mathf.Clamp(SyncedInstance<ShishaConfig>.Instance.RunningAwayMaxAcceleration.Value, 0.1f, 100f);
				_poopBehaviourEnabled = SyncedInstance<ShishaConfig>.Instance.PoopBehaviourEnabled.Value;
				poopChance = Mathf.Clamp(SyncedInstance<ShishaConfig>.Instance.PoopChance.Value, 0f, 1f);
				_killable = SyncedInstance<ShishaConfig>.Instance.Killable.Value;
				base.enemyHP = Mathf.Max(SyncedInstance<ShishaConfig>.Instance.Health.Value, 1);
				wanderTimeRange = new Vector2(num, Mathf.Clamp(SyncedInstance<ShishaConfig>.Instance.WanderTimeMax.Value, num, 1000f));
				ambientSfxTimerRange = new Vector2(num2, Mathf.Clamp(SyncedInstance<ShishaConfig>.Instance.AmbientSfxTimerMax.Value, num2, 1000f));
			}
		}

		private void SwitchBehaviourState(int state)
		{
			if (base.currentBehaviourStateIndex != state)
			{
				LogDebug($"Switching to behaviour state {state}.");
				base.previousBehaviourStateIndex = base.currentBehaviourStateIndex;
				base.currentBehaviourStateIndex = state;
				_netcodeController.CurrentBehaviourStateIndex.Value = base.currentBehaviourStateIndex;
				InitializeState(state);
				LogDebug($"Switch to behaviour state {state} complete!");
			}
		}

		private void HandleTargetPlayerChanged(ulong oldValue, ulong newValue)
		{
			_actualTargetPlayer.Value = ((newValue == 69420) ? null : StartOfRound.Instance.allPlayerScripts[newValue]);
			base.targetPlayer = _actualTargetPlayer.Value;
			LogDebug(_actualTargetPlayer.IsNotNull ? ("Changed target player to " + _actualTargetPlayer.Value?.playerUsername + ".") : "Changed target player to null.");
		}

		private void SubscribeToNetworkEvents()
		{
			if (((NetworkBehaviour)this).IsServer && !_networkEventsSubscribed)
			{
				_netcodeController.OnIdleCompleteStateBehaviourCallback += HandleIdleCompleteStateBehaviourCallback;
				NetworkVariable<ulong> targetPlayerClientId = _netcodeController.TargetPlayerClientId;
				targetPlayerClientId.OnValueChanged = (OnValueChangedDelegate<ulong>)(object)Delegate.Combine((Delegate?)(object)targetPlayerClientId.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<ulong>(HandleTargetPlayerChanged));
				_networkEventsSubscribed = true;
			}
		}

		private void UnsubscribeFromNetworkEvents()
		{
			if (((NetworkBehaviour)this).IsServer && _networkEventsSubscribed)
			{
				_netcodeController.OnIdleCompleteStateBehaviourCallback -= HandleIdleCompleteStateBehaviourCallback;
				NetworkVariable<ulong> targetPlayerClientId = _netcodeController.TargetPlayerClientId;
				targetPlayerClientId.OnValueChanged = (OnValueChangedDelegate<ulong>)(object)Delegate.Remove((Delegate?)(object)targetPlayerClientId.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<ulong>(HandleTargetPlayerChanged));
				_networkEventsSubscribed = false;
			}
		}

		private void LogDebug(string msg)
		{
		}

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

		protected internal override string __getTypeName()
		{
			return "ShishaServer";
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "LethalCompanyShisha";

		public const string PLUGIN_NAME = "LethalCompanyShisha";

		public const string PLUGIN_VERSION = "1.1.4";
	}
}
namespace LethalCompanyShisha.Types
{
	public class CachedValue<T>
	{
		private readonly NullableObject<T> _cachedValue = new NullableObject<T>();

		private readonly Func<T> _computeValueFunction;

		public T Value
		{
			get
			{
				if (!_cachedValue.IsNotNull)
				{
					_cachedValue.Value = _computeValueFunction();
				}
				return _cachedValue.Value;
			}
		}

		public CachedValue(Func<T> computeValueFunction, bool eager = false)
		{
			_computeValueFunction = computeValueFunction ?? throw new ArgumentNullException("computeValueFunction");
			if (eager)
			{
				_cachedValue.Value = _computeValueFunction();
			}
		}

		public void Reset()
		{
			_cachedValue.Value = default(T);
		}
	}
	public class NullableObject<T>
	{
		private T _value;

		public bool IsNotNull { get; private set; }

		public T Value
		{
			get
			{
				return _value;
			}
			set
			{
				_value = value;
				IsNotNull = !EqualityComparer<T>.Default.Equals(_value, default(T));
			}
		}

		public NullableObject(T value = default(T))
		{
			Value = value;
		}
	}
}
namespace LethalCompanyShisha.CustomStateMachineBehaviours
{
	public class BaseStateMachineBehaviour : StateMachineBehaviour
	{
		private ManualLogSource _mls;

		protected string ShishaId;

		protected readonly NullableObject<ShishaNetcodeController> NetcodeController = new NullableObject<ShishaNetcodeController>();

		private bool _networkEventsSubscribed;

		private void OnEnable()
		{
			SubscribeToNetworkEvents();
		}

		private void OnDisable()
		{
			UnsubscribeFromNetworkEvents();
		}

		public void Initialize(ShishaNetcodeController receivedNetcodeController)
		{
			NetcodeController.Value = receivedNetcodeController;
			SubscribeToNetworkEvents();
		}

		private void HandleSyncShishaIdentifier(string receivedShishaId)
		{
			ShishaId = receivedShishaId;
			ManualLogSource mls = _mls;
			if (mls != null)
			{
				mls.Dispose();
			}
			_mls = Logger.CreateLogSource("Shisha Animation State Behaviour " + ShishaId);
			LogDebug("Successfully synced shisha identifier.");
		}

		private void SubscribeToNetworkEvents()
		{
			if (!_networkEventsSubscribed && NetcodeController.IsNotNull)
			{
				NetcodeController.Value.OnSyncShishaIdentifier += HandleSyncShishaIdentifier;
				_networkEventsSubscribed = true;
			}
		}

		private void UnsubscribeFromNetworkEvents()
		{
			if (_networkEventsSubscribed && NetcodeController.IsNotNull)
			{
				NetcodeController.Value.OnSyncShishaIdentifier -= HandleSyncShishaIdentifier;
				_networkEventsSubscribed = false;
			}
		}

		protected void LogDebug(string msg)
		{
		}
	}
	public class IdleCompleteStateBehaviour : BaseStateMachineBehaviour
	{
		public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
		{
			if (!NetcodeController.IsNotNull)
			{
				LogDebug("Netcode Controller is null");
			}
			else if (NetworkManager.Singleton.IsServer && ((NetworkBehaviour)NetcodeController.Value).IsOwner)
			{
				LogDebug("Idle cycle complete");
				NetcodeController.Value.IdleCompleteStateBehaviourCallbackServerRpc(ShishaId);
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace LethalCompanyShisha.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}

BepInEx/plugins/seichi/ScarletMansionSeichiPatch.dll

Decompiled 6 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using HarmonyLib;
using ScarletMansion.DunGenPatch;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ScarletMansionSeichiPatch")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ScarletMansionSeichiPatch")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3fb44756-2543-4ee4-ace4-da3fdb995192")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ScarletMansionSeichiPatch;

public class Patch
{
	public static void Activate()
	{
		Plugin.Instance.harmony.PatchAll(typeof(Patch));
	}

	public static Volume GetVolume()
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		GameObject[] array = null;
		for (int i = 0; i < SceneManager.sceneCount; i++)
		{
			Scene sceneAt = SceneManager.GetSceneAt(i);
			if (((Scene)(ref sceneAt)).name.ToLowerInvariant() == "seichi")
			{
				array = ((Scene)(ref sceneAt)).GetRootGameObjects();
				Plugin.logger.LogInfo((object)"Found Seichi scene");
				break;
			}
		}
		if (array == null)
		{
			return null;
		}
		GameObject[] array2 = array;
		foreach (GameObject val in array2)
		{
			if (((Object)val).name.ToLowerInvariant() == "environment")
			{
				Transform val2 = val.transform.Find("RaphtaliaVolume");
				if ((Object)(object)val2 != (Object)null)
				{
					return ((Component)val2).GetComponentInChildren<Volume>(true);
				}
			}
		}
		return null;
	}

	[HarmonyPatch(typeof(RoundManager), "SetPowerOffAtStart")]
	[HarmonyPostfix]
	public static void ShipLandedPatch(ref RoundManager __instance)
	{
		if (Patch.active)
		{
			Volume volume = GetVolume();
			if ((Object)(object)volume == (Object)null)
			{
				Plugin.logger.LogWarning((object)"Couldn't setup SDM/Seichi compatibility feature");
			}
			else
			{
				((Behaviour)volume).enabled = true;
			}
		}
	}
}
[BepInPlugin("dev.ladyalice.scarletmansion.seichipatch", "Scarlet Mansion Seichi Patch", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
	public const string modGUID = "dev.ladyalice.scarletmansion.seichipatch";

	private const string modName = "Scarlet Mansion Seichi Patch";

	private const string modVersion = "1.0.0";

	public const string targetModGUID = "dev.ladyalice.scarletmansion";

	public const string targetModVersion = "1.3.27";

	public readonly Harmony harmony = new Harmony("dev.ladyalice.scarletmansion.seichipatch");

	public static Plugin Instance { get; private set; }

	public static ManualLogSource logger { get; internal set; }

	private void Awake()
	{
		if ((Object)(object)Instance == (Object)null)
		{
			Instance = this;
		}
		logger = Logger.CreateLogSource("dev.ladyalice.scarletmansion.seichipatch");
		if (Chainloader.PluginInfos.ContainsKey("dev.ladyalice.scarletmansion"))
		{
			PluginInfo val = Chainloader.PluginInfos["dev.ladyalice.scarletmansion"];
			Version version = val.Metadata.Version;
			bool flag;
			if (string.IsNullOrWhiteSpace("1.3.27"))
			{
				flag = true;
			}
			else
			{
				Version version2 = new Version("1.3.27");
				flag = version >= version2;
			}
			if (flag)
			{
				logger.LogInfo((object)"Plugin Scarlet Mansion Seichi Patch has been added!");
				Patch.Activate();
			}
		}
	}
}

BepInEx/plugins/seichi/TestAccount666.StatueThingy.dll

Decompiled 6 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TestAccount666.StatueThingy.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("TestAccount666.StatueThingy")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("StatueThingy")]
[assembly: AssemblyTitle("TestAccount666.StatueThingy")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 StatueThingy
{
	[BepInPlugin("TestAccount666.StatueThingy", "StatueThingy", "1.0.0")]
	public class StatueThingy : BaseUnityPlugin
	{
		public static StatueThingy Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		internal static Harmony? Harmony { get; set; }

		internal static void Patch()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony("TestAccount666.StatueThingy");
			}
			Logger.LogDebug((object)"Patching...");
			Harmony.PatchAll();
			Logger.LogDebug((object)"Finished patching!");
		}

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			Patch();
			ExecuteNetcodePatcher();
			Logger.LogInfo((object)"TestAccount666.StatueThingy v1.0.0 has loaded!");
		}

		internal static void Unpatch()
		{
			Logger.LogDebug((object)"Unpatching...");
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			Logger.LogDebug((object)"Finished unpatching!");
		}

		private static void ExecuteNetcodePatcher()
		{
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			Type[] types = executingAssembly.GetTypes();
			foreach (Type type in types)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				foreach (MethodInfo methodInfo in methods)
				{
					if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}
	}
	[AddComponentMenu("TestAccount666/StatueThingy/StatueThingySync")]
	public class StatueThingySync : NetworkBehaviour
	{
		[SerializeField]
		private string[] poseTriggers = Array.Empty<string>();

		[SerializeField]
		private Animator? animator;

		private readonly LinkedList<int> _poseTriggersHash = new LinkedList<int>();

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

		private void Start()
		{
			if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer)
			{
				NetworkObject component = ((Component)this).GetComponent<NetworkObject>();
				if (!component.IsSpawned)
				{
					component.Spawn(true);
				}
			}
		}

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			((MonoBehaviour)this).StartCoroutine(WaitUntilInitializationAndSync());
		}

		private IEnumerator WaitUntilInitializationAndApply(int index)
		{
			yield return (object)new WaitUntil((Func<bool>)delegate
			{
				int result;
				if (this != null && animator != null)
				{
					string[] array2 = poseTriggers;
					if (array2 != null)
					{
						result = ((array2.Length > 0) ? 1 : 0);
						goto IL_0020;
					}
				}
				result = 0;
				goto IL_0020;
				IL_0020:
				return (byte)result != 0;
			});
			if (_poseTriggersHash.Count <= 0)
			{
				string[] array = poseTriggers;
				foreach (string triggerName in array)
				{
					_poseTriggersHash.AddLast(Animator.StringToHash(triggerName));
				}
			}
			ApplyMeshAndMaterial(index);
		}

		private IEnumerator WaitUntilInitializationAndSync()
		{
			yield return (object)new WaitUntil((Func<bool>)delegate
			{
				int result;
				if (this != null && animator != null)
				{
					string[] array2 = poseTriggers;
					if (array2 != null)
					{
						result = ((array2.Length > 0) ? 1 : 0);
						goto IL_0020;
					}
				}
				result = 0;
				goto IL_0020;
				IL_0020:
				return (byte)result != 0;
			});
			if (!((NetworkBehaviour)this).IsHost && !((NetworkBehaviour)this).IsServer)
			{
				yield break;
			}
			if (_poseTriggersHash.Count <= 0)
			{
				string[] array = poseTriggers;
				foreach (string triggerName in array)
				{
					_poseTriggersHash.AddLast(Animator.StringToHash(triggerName));
				}
			}
			Random seededRandom = new Random(StartOfRound.Instance.randomMapSeed);
			int index = seededRandom.Next(0, poseTriggers.Length);
			SyncPoseClientRpc(index);
		}

		private void ApplyMeshAndMaterial(int index)
		{
			Animator? obj = animator;
			if (obj != null)
			{
				obj.SetTrigger(_poseTriggersHash.ElementAt(index));
			}
		}

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

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

		private static void __rpc_handler_3043677422(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 index = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref index);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((StatueThingySync)(object)target).SyncPoseClientRpc(index);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "StatueThingySync";
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "TestAccount666.StatueThingy";

		public const string PLUGIN_NAME = "StatueThingy";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace TestAccount666.StatueThingy.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}