Decompiled source of LanternKeeper v1.0.2

LanternKeeper.dll

Decompiled 3 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.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LanternKeeper.Behaviours;
using LanternKeeper.Managers;
using LanternKeeper.NetcodePatcher;
using LanternKeeper.Patches;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Rendering.HighDefinition;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("LanternKeeper")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LanternKeeper")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a49f9ee5-8230-433e-bb8a-2f35686646db")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[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: 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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LanternKeeper
{
	public class Constants
	{
		public const string INFORMATION = "Information";

		public const string MESSAGE_INFO_LANTERN_ALREADY_ON = "The lantern has already been lit";

		public const string MESSAGE_INFO_LANTERN_ON = " lantern have been lit!";

		public const string MESSAGE_INFO_ALL_LANTERN_ON = "All the lanterns have been lit!";

		public const string MESSAGE_INFO_ALL_LANTERN_OFF = "All lanterns have been extinguished";

		public const string MESSAGE_INFO_LANTERN_HELP1 = " is the player closest to the lantern to be lit, with a distance of ";

		public const string MESSAGE_INFO_LANTERN_HELP2 = "Look around, you might just spot the lantern you're looking for";

		public const string MESSAGE_INFO_LANTERN_HELP3 = "The lantern to be lit is ";

		public const string GLOBAL = "_Global_";

		public const string LANTERN_KEEPER_ENEMY = "Lantern Keeper (Enemy)";

		public const string POISON_DAGGER = "Poison Dagger";

		public const string FORTUNE_COOKIE = "Fortune Cookie";

		public const string LANTERN_KEEPER = "Lantern Keeper";
	}
	public class LKUtilities
	{
		public static void Shuffle<T>(IList<T> collection)
		{
			for (int num = collection.Count - 1; num > 0; num--)
			{
				int num2 = Random.Range(0, num + 1);
				int index = num2;
				int index2 = num;
				T value = collection[num];
				T value2 = collection[num2];
				collection[index] = value;
				collection[index2] = value2;
			}
		}

		public static string GetLanternColor(int index)
		{
			return index switch
			{
				0 => "Red", 
				1 => "Blue", 
				2 => "Green", 
				3 => "White", 
				_ => null, 
			};
		}

		public static GrabbableObject SpawnObject(GameObject spawnPrefab, Vector3 position, bool isInFactory = true)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(spawnPrefab, position, Quaternion.identity, StartOfRound.Instance.propsContainer);
			GrabbableObject component = val.GetComponent<GrabbableObject>();
			component.fallTime = 0f;
			component.isInFactory = isInFactory;
			val.GetComponent<NetworkObject>().Spawn(false);
			return component;
		}

		public static ParticleSystem SpawnPoisonParticle(Transform transform)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: 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_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_0069: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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)
			Vector3 val = transform.position;
			Vector3 scale = transform.localScale;
			EnemyAICollisionDetect componentInChildren = ((Component)transform).GetComponentInChildren<EnemyAICollisionDetect>();
			BoxCollider val2 = ((componentInChildren != null) ? ((Component)componentInChildren).GetComponent<BoxCollider>() : null) ?? ((Component)transform).GetComponent<BoxCollider>();
			if ((Object)(object)val2 != (Object)null)
			{
				val = ((Component)val2).transform.TransformPoint(val2.center);
				scale = val2.size;
			}
			GameObject val3 = Object.Instantiate<GameObject>(LanternKeeper.poisonParticle, val, Quaternion.identity, transform);
			ParticleSystem component = val3.GetComponent<ParticleSystem>();
			ShapeModule shape = component.shape;
			((ShapeModule)(ref shape)).scale = scale;
			return component;
		}
	}
	[BepInPlugin("Lega.LanternKeeper", "Lantern Keeper", "1.0.2")]
	public class LanternKeeper : BaseUnityPlugin
	{
		public enum ControlTip
		{
			RED,
			BLUE,
			GREEN,
			WHITE
		}

		private const string modGUID = "Lega.LanternKeeper";

		private const string modName = "Lantern Keeper";

		private const string modVersion = "1.0.2";

		private readonly Harmony harmony = new Harmony("Lega.LanternKeeper");

		private static readonly AssetBundle bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "lanternkeeper"));

		internal static ManualLogSource mls;

		public static ConfigFile configFile;

		public static EnemyType lanternKeeperEnemy;

		public static GameObject fortuneCookieObj;

		public static GameObject daggerObj;

		public static GameObject lanternObj;

		public static List<Lantern> spawnedLanterns = new List<Lantern>();

		public static GameObject poisonParticle;

		public static Material wallhackShader;

		public static GameObject redLight;

		public static GameObject blueLight;

		public static GameObject greenLight;

		public static GameObject whiteLight;

		public static List<int> shuffledLights = new List<int> { 0, 1, 2, 3 };

		public static int currentLanternToLightIndex;

		public void Awake()
		{
			mls = Logger.CreateLogSource("LanternKeeper");
			configFile = ((BaseUnityPlugin)this).Config;
			ConfigManager.Load();
			NetcodePatcher();
			LoadItems();
			LoadLantern();
			LoadLights();
			LoadEnemies();
			LoadParticles();
			LoadShaders();
			harmony.PatchAll(typeof(RoundManagerPatch));
		}

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

		public void LoadItems()
		{
			fortuneCookieObj = RegisterItem(typeof(FortuneCookie), bundle.LoadAsset<Item>("Assets/FortuneCookie/FortuneCookieItem.asset")).spawnPrefab;
			daggerObj = RegisterItem(typeof(PoisonDagger), bundle.LoadAsset<Item>("Assets/PoisonDagger/PoisonDaggerItem.asset")).spawnPrefab;
		}

		public Item RegisterItem(Type type, Item item)
		{
			if ((Object)(object)item.spawnPrefab.GetComponent<PhysicsProp>() == (Object)null)
			{
				Component obj = item.spawnPrefab.AddComponent(type);
				PhysicsProp val = (PhysicsProp)(object)((obj is PhysicsProp) ? obj : null);
				((GrabbableObject)val).grabbable = true;
				((GrabbableObject)val).grabbableToEnemies = true;
				((GrabbableObject)val).itemProperties = item;
			}
			NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab);
			Utilities.FixMixerGroups(item.spawnPrefab);
			Items.RegisterItem(item);
			return item;
		}

		public void LoadLantern()
		{
			lanternObj = bundle.LoadAsset<GameObject>("Assets/Lantern/LK_Lantern.prefab");
			NetworkPrefabs.RegisterNetworkPrefab(lanternObj);
			Utilities.FixMixerGroups(lanternObj);
		}

		public static void LoadLights()
		{
			redLight = bundle.LoadAsset<GameObject>("Assets/Lantern/RedLight.prefab");
			blueLight = bundle.LoadAsset<GameObject>("Assets/Lantern/BlueLight.prefab");
			greenLight = bundle.LoadAsset<GameObject>("Assets/Lantern/GreenLight.prefab");
			whiteLight = bundle.LoadAsset<GameObject>("Assets/Lantern/WhiteLight.prefab");
		}

		public static void LoadEnemies()
		{
			lanternKeeperEnemy = bundle.LoadAsset<EnemyType>("Assets/LanternKeeper/LanternKeeperEnemy.asset");
			NetworkPrefabs.RegisterNetworkPrefab(lanternKeeperEnemy.enemyPrefab);
			Enemies.RegisterEnemy(lanternKeeperEnemy, 0, (LevelTypes)1, (TerminalNode)null, (TerminalKeyword)null);
		}

		public void LoadParticles()
		{
			HashSet<GameObject> hashSet = new HashSet<GameObject> { poisonParticle = bundle.LoadAsset<GameObject>("Assets/Particles/PoisonParticle.prefab") };
			foreach (GameObject item in hashSet)
			{
				NetworkPrefabs.RegisterNetworkPrefab(item);
				Utilities.FixMixerGroups(item);
			}
		}

		public static void LoadShaders()
		{
			wallhackShader = bundle.LoadAsset<Material>("Assets/Shaders/WallhackMaterial.mat");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "LanternKeeper";

		public const string PLUGIN_NAME = "LanternKeeper";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace LanternKeeper.Patches
{
	internal class RoundManagerPatch
	{
		public static bool isLanternKeeperSpawned;

		[HarmonyPatch(typeof(RoundManager), "SpawnOutsideHazards")]
		[HarmonyPostfix]
		private static void SpawnOutsideHazards(ref RoundManager __instance)
		{
			LanternKeeper.spawnedLanterns.Clear();
			if (((NetworkBehaviour)__instance).IsHost && new Random().Next(1, 100) <= ConfigManager.rarity.Value)
			{
				isLanternKeeperSpawned = true;
				NetworkObject enemyObject = SpawnLanternKeeper(__instance);
				LKUtilities.Shuffle(LanternKeeper.shuffledLights);
				SpawnLantern(__instance, enemyObject);
			}
		}

		public static NetworkObject SpawnLanternKeeper(RoundManager roundManager)
		{
			//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_0021: 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_002f: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = roundManager.outsideAINodes[Random.Range(0, roundManager.outsideAINodes.Length)].transform.position;
			position = roundManager.GetRandomNavMeshPositionInRadiusSpherical(position, 10f, default(NavMeshHit));
			GameObject val = Object.Instantiate<GameObject>(LanternKeeper.lanternKeeperEnemy.enemyPrefab, position, Quaternion.identity);
			NetworkObject componentInChildren = val.GetComponentInChildren<NetworkObject>();
			componentInChildren.Spawn(true);
			return componentInChildren;
		}

		public static void SpawnLantern(RoundManager roundManager, NetworkObject enemyObject)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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_00f6: 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_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: 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_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			Random random = new Random();
			List<Vector3> list = new List<Vector3>
			{
				StartOfRound.Instance.shipLandingPosition.position,
				RoundManager.FindMainEntrancePosition(false, false)
			};
			LKUtilities.Shuffle(roundManager.outsideAINodes);
			LKUtilities.Shuffle(roundManager.insideAINodes);
			List<bool> list2 = new List<bool> { true, true, false, false };
			LKUtilities.Shuffle(list2);
			RaycastHit val4 = default(RaycastHit);
			for (int i = 0; i < list2.Count; i++)
			{
				Vector3 val = Vector3.zero;
				float num = float.MinValue;
				bool flag = list2[i];
				GameObject[] array = (flag ? roundManager.outsideAINodes : roundManager.insideAINodes);
				float num2 = (flag ? 10f : 2f);
				GameObject[] array2 = array;
				foreach (GameObject val2 in array2)
				{
					Vector3 val3 = roundManager.GetRandomNavMeshPositionInBoxPredictable(val2.transform.position, num2, default(NavMeshHit), random, -1) + Vector3.up;
					if (!Physics.Raycast(val3, Vector3.down, ref val4, 5f, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
					{
						continue;
					}
					Vector3 validPosition = ((RaycastHit)(ref val4)).point;
					float num3 = ((list.Count > 0) ? list.Min((Vector3 p) => Vector3.Distance(p, validPosition)) : float.MaxValue);
					if (num3 > 100f || num3 > num)
					{
						num = num3;
						val = validPosition;
						if (num3 > 100f)
						{
							break;
						}
					}
				}
				if (val != Vector3.zero)
				{
					list.Add(val);
					GameObject val5 = Object.Instantiate<GameObject>(LanternKeeper.lanternObj, val + Vector3.down * 0.5f, Quaternion.identity, roundManager.mapPropsContainer.transform);
					Lantern component = val5.GetComponent<Lantern>();
					if (flag)
					{
						Transform transform = ((Component)component).transform;
						transform.localScale *= 2f;
					}
					val5.GetComponent<NetworkObject>().Spawn(true);
					component.InitializeLanternClientRpc(NetworkObjectReference.op_Implicit(enemyObject), LanternKeeper.shuffledLights[i], flag);
				}
			}
		}

		[HarmonyPatch(typeof(RoundManager), "CollectNewScrapForThisRound")]
		[HarmonyPostfix]
		private static void SpawnFortuneCookie(ref GrabbableObject scrapObject)
		{
			//IL_003f: 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)
			//IL_005f: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			if (isLanternKeeperSpawned && scrapObject.itemProperties.isScrap && scrapObject.scrapValue > 0)
			{
				GameObject obj = GameObject.Find("CatwalkShip");
				Vector3? val = ((obj != null) ? new Vector3?(obj.transform.position) : null);
				if (val.HasValue)
				{
					LKUtilities.SpawnObject(LanternKeeper.fortuneCookieObj, val.Value + Vector3.up * 0.5f, isInFactory: false);
				}
			}
		}

		[HarmonyPatch(typeof(RoundManager), "DetectElevatorIsRunning")]
		[HarmonyPostfix]
		private static void EndGame()
		{
			foreach (Lantern spawnedLantern in LanternKeeper.spawnedLanterns)
			{
				((Component)spawnedLantern).GetComponent<NetworkObject>().Despawn(true);
			}
			LanternKeeper.spawnedLanterns.Clear();
			FortuneCookie[] array = Object.FindObjectsOfType<FortuneCookie>();
			foreach (FortuneCookie fortuneCookie in array)
			{
				fortuneCookie.DestroyObjectServerRpc();
			}
		}
	}
}
namespace LanternKeeper.Managers
{
	public class ConfigManager
	{
		public static ConfigEntry<int> rarity;

		public static ConfigEntry<float> angerIncrement;

		public static ConfigEntry<float> angerIncrementLast;

		public static ConfigEntry<int> enemyPoisonDamage;

		public static ConfigEntry<int> enemyPoisonDuration;

		public static ConfigEntry<float> enemyPoisonIntensity;

		public static ConfigEntry<int> daggerPoisonDamage;

		public static ConfigEntry<int> daggerPoisonDuration;

		public static ConfigEntry<float> daggerPoisonStunDuration;

		public static ConfigEntry<float> auraDuration;

		public static void Load()
		{
			rarity = LanternKeeper.configFile.Bind<int>("_Global_", "Rarity", 50, "Lantern Keeper rarity");
			angerIncrement = LanternKeeper.configFile.Bind<float>("Lantern Keeper (Enemy)", "Anger Increment", 0.2f, "Anger increment - this value starts at 1 and is used as a multiplier for the enemy's speed and the (direct) damage they inflict");
			angerIncrementLast = LanternKeeper.configFile.Bind<float>("Lantern Keeper (Enemy)", "Anger Increment Last", 0.4f, "Anger increment when the last lantern is lit");
			enemyPoisonDamage = LanternKeeper.configFile.Bind<int>("Lantern Keeper (Enemy)", "Poison Damage", 1, "Damage dealt by the poison to the player every second");
			enemyPoisonDuration = LanternKeeper.configFile.Bind<int>("Lantern Keeper (Enemy)", "Poison Duration", 10, "Poison duration");
			enemyPoisonIntensity = LanternKeeper.configFile.Bind<float>("Lantern Keeper (Enemy)", "Poison Intensity", 0.2f, "Intensity of the poison filter");
			daggerPoisonDamage = LanternKeeper.configFile.Bind<int>("Poison Dagger", "Poison Damage", 1, "Damage dealt to the enemy at the end of the poisoning (when the 'poison duration' is over)");
			daggerPoisonDuration = LanternKeeper.configFile.Bind<int>("Poison Dagger", "Poison Duration", 10, "Poison duration");
			daggerPoisonStunDuration = LanternKeeper.configFile.Bind<float>("Poison Dagger", "Poison Stun Duration", 0.02f, "Stun duration applied to the enemy for each second of poisoning");
			auraDuration = LanternKeeper.configFile.Bind<float>("Poison Dagger", "Aura Duration", 30f, "Duration of aura to see the lanterns");
		}
	}
	public class CustomPassManager : MonoBehaviour
	{
		public static WallhackCustomPass wallhackPass;

		public static CustomPassVolume customPassVolume;

		public static CustomPassVolume CustomPassVolume
		{
			get
			{
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)customPassVolume == (Object)null)
				{
					customPassVolume = ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).gameObject.AddComponent<CustomPassVolume>();
					if ((Object)(object)customPassVolume != (Object)null)
					{
						customPassVolume.targetCamera = GameNetworkManager.Instance.localPlayerController.gameplayCamera;
						customPassVolume.injectionPoint = (CustomPassInjectionPoint)1;
						customPassVolume.isGlobal = true;
						wallhackPass = new WallhackCustomPass();
						customPassVolume.customPasses.Add((CustomPass)(object)wallhackPass);
					}
				}
				return customPassVolume;
			}
		}

		public static void SetupCustomPassForGameObjects(GameObject obj)
		{
			List<Renderer> list = obj.GetComponentsInChildren<Renderer>().ToList();
			if (list == null || list.Count == 0)
			{
				LanternKeeper.mls.LogError((object)("No renderer could be found on " + ((Object)obj).name + "."));
			}
			else
			{
				SetupCustomPass(list.ToArray());
			}
		}

		public static void SetupCustomPass(Renderer[] renderers)
		{
			if ((Object)(object)CustomPassVolume == (Object)null)
			{
				LanternKeeper.mls.LogError((object)"CustomPassVolume is not assigned.");
				return;
			}
			wallhackPass = CustomPassVolume.customPasses.Find((CustomPass pass) => pass is WallhackCustomPass) as WallhackCustomPass;
			if (wallhackPass == null)
			{
				LanternKeeper.mls.LogError((object)"WallhackCustomPass could not be found in CustomPassVolume.");
			}
			else
			{
				wallhackPass.SetTargetRenderers(renderers, LanternKeeper.wallhackShader);
			}
		}

		public static void RemoveAura()
		{
			wallhackPass?.ClearTargetRenderers();
		}
	}
}
namespace LanternKeeper.Behaviours
{
	public class FortuneCookie : PhysicsProp
	{
		public static Coroutine showLanternCoroutine;

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (!buttonDown || !((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null))
			{
				return;
			}
			if (!LanternKeeper.spawnedLanterns.Any())
			{
				return;
			}
			Lantern currentLantern = LanternKeeper.spawnedLanterns[LanternKeeper.currentLanternToLightIndex];
			if ((Object)(object)currentLantern == (Object)null)
			{
				return;
			}
			switch (new Random().Next(0, 3))
			{
			case 0:
			{
				PlayerControllerB val = (from p in StartOfRound.Instance.allPlayerScripts
					where p.isPlayerControlled && !p.isPlayerDead
					orderby Vector3.Distance(((Component)p).transform.position, ((Component)currentLantern).transform.position)
					select p).FirstOrDefault();
				HUDManager.Instance.DisplayTip("Information", val.playerUsername + " is the player closest to the lantern to be lit, with a distance of " + Vector3.Distance(((Component)val).transform.position, ((Component)currentLantern).transform.position), false, false, "LC_Tip1");
				break;
			}
			case 1:
				if (showLanternCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(showLanternCoroutine);
				}
				showLanternCoroutine = ((MonoBehaviour)this).StartCoroutine(ShowLanternCoroutine(currentLantern));
				HUDManager.Instance.DisplayTip("Information", "Look around, you might just spot the lantern you're looking for", false, false, "LC_Tip1");
				break;
			case 2:
				HUDManager.Instance.DisplayTip("Information", "The lantern to be lit is " + LKUtilities.GetLanternColor(currentLantern.currentColorIndex), false, false, "LC_Tip1");
				break;
			}
			DestroyObjectServerRpc();
		}

		public static IEnumerator ShowLanternCoroutine(Lantern currentLantern)
		{
			CustomPassManager.RemoveAura();
			CustomPassManager.SetupCustomPassForGameObjects(((Component)currentLantern).gameObject);
			yield return (object)new WaitForSeconds(ConfigManager.auraDuration.Value);
			CustomPassManager.RemoveAura();
			showLanternCoroutine = null;
		}

		[ServerRpc(RequireOwnership = false)]
		public void DestroyObjectServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1814758473u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1814758473u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					DestroyObjectClientRpc();
				}
			}
		}

		[ClientRpc]
		public void DestroyObjectClientRpc()
		{
			//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(2408313568u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2408313568u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					((GrabbableObject)this).DestroyObjectInHand(((GrabbableObject)this).playerHeldBy);
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_FortuneCookie()
		{
			//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(1814758473u, new RpcReceiveHandler(__rpc_handler_1814758473));
			NetworkManager.__rpc_func_table.Add(2408313568u, new RpcReceiveHandler(__rpc_handler_2408313568));
		}

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

		private static void __rpc_handler_2408313568(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;
				((FortuneCookie)(object)target).DestroyObjectClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "FortuneCookie";
		}
	}
	public class Lantern : NetworkBehaviour
	{
		public bool isLightOn;

		public bool isOutside;

		public int currentColorIndex;

		public LanternKeeperAI lanternKeeper;

		public InteractTrigger interactTrigger;

		public GameObject light1;

		public GameObject light2;

		public Quaternion lightRotation;

		public Vector3 light1Position;

		public Vector3 light2Position;

		[ClientRpc]
		public void InitializeLanternClientRpc(NetworkObjectReference enemyObject, int index, bool isOutside)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: 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_016e: 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(2092605655u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref enemyObject, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val2, index);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isOutside, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2092605655u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				NetworkObject val3 = default(NetworkObject);
				if (((NetworkObjectReference)(ref enemyObject)).TryGet(ref val3, (NetworkManager)null))
				{
					lanternKeeper = ((Component)val3).gameObject.GetComponentInChildren<EnemyAI>() as LanternKeeperAI;
				}
				LanternKeeper.spawnedLanterns.Add(this);
				LanternKeeper.currentLanternToLightIndex = 0;
				lightRotation = light1.transform.rotation;
				light1Position = light1.transform.position;
				light2Position = light2.transform.position;
				light1 = null;
				light2 = null;
				currentColorIndex = index;
				this.isOutside = isOutside;
				RefreshHoverTip();
			}
		}

		public void LanternInteraction()
		{
			if (isLightOn)
			{
				HUDManager.Instance.DisplayTip("Information", "The lantern has already been lit", false, false, "LC_Tip1");
			}
			else if ((Object)(object)this != (Object)(object)LanternKeeper.spawnedLanterns[LanternKeeper.currentLanternToLightIndex])
			{
				SwitchOffAllLanternsServerRpc();
			}
			else
			{
				LanternInteractionServerRpc();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SwitchOffAllLanternsServerRpc()
		{
			//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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3914372781u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3914372781u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					LanternKeeper.currentLanternToLightIndex = 0;
					SwitchOffAllLanternsClientRpc();
				}
			}
		}

		[ClientRpc]
		public void SwitchOffAllLanternsClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1677815637u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1677815637u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			foreach (Lantern item in LanternKeeper.spawnedLanterns.Where((Lantern l) => l.isLightOn))
			{
				item.SwitchOffLantern();
			}
			lanternKeeper.angerMeter = 1f;
			HUDManager.Instance.DisplayTip("Information", "All lanterns have been extinguished", false, false, "LC_Tip1");
		}

		public void SwitchOffLantern()
		{
			isLightOn = false;
			if ((Object)(object)light1 != (Object)null)
			{
				Object.Destroy((Object)(object)light1.gameObject);
				light1 = null;
			}
			if ((Object)(object)light2 != (Object)null)
			{
				Object.Destroy((Object)(object)light2.gameObject);
				light2 = null;
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void LanternInteractionServerRpc()
		{
			//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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3263778136u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3263778136u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					LanternInteractionClientRpc();
				}
			}
		}

		[ClientRpc]
		public void LanternInteractionClientRpc()
		{
			//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)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			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(2837136169u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2837136169u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				isLightOn = true;
				InstantiateLight(ref light1, light1Position);
				InstantiateLight(ref light2, light2Position);
				lanternKeeper.lastLanternLit = this;
				if (LanternKeeper.currentLanternToLightIndex == 3)
				{
					HUDManager.Instance.DisplayTip("Information", "All the lanterns have been lit!", false, false, "LC_Tip1");
					SetLanternKeeperVulnerable();
				}
				else
				{
					HUDManager.Instance.DisplayTip("Information", LKUtilities.GetLanternColor(currentColorIndex) + " lantern have been lit!", false, false, "LC_Tip1");
					lanternKeeper.angerMeter += ConfigManager.angerIncrement.Value;
					LanternKeeper.currentLanternToLightIndex++;
				}
			}
		}

		public void InstantiateLight(ref GameObject lightObject, Vector3 lightPosition)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			GameObject val;
			switch (currentColorIndex)
			{
			default:
				return;
			case 0:
				val = LanternKeeper.redLight;
				break;
			case 1:
				val = LanternKeeper.blueLight;
				break;
			case 2:
				val = LanternKeeper.greenLight;
				break;
			case 3:
				val = LanternKeeper.whiteLight;
				break;
			}
			if ((Object)(object)lightObject == (Object)null)
			{
				lightObject = Object.Instantiate<GameObject>(val, lightPosition, lightRotation);
				if (isOutside)
				{
					Light component = lightObject.GetComponent<Light>();
					component.range *= 2f;
				}
			}
		}

		public void SetLanternKeeperVulnerable()
		{
			((EnemyAI)lanternKeeper).enemyType.canDie = true;
			lanternKeeper.angerMeter += ConfigManager.angerIncrementLast.Value;
		}

		public void RefreshHoverTip()
		{
			interactTrigger.hoverTip = "Light up : [LMB] - " + LKUtilities.GetLanternColor(currentColorIndex);
		}

		public override void OnDestroy()
		{
			SwitchOffLantern();
			((NetworkBehaviour)this).OnDestroy();
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_Lantern()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(2092605655u, new RpcReceiveHandler(__rpc_handler_2092605655));
			NetworkManager.__rpc_func_table.Add(3914372781u, new RpcReceiveHandler(__rpc_handler_3914372781));
			NetworkManager.__rpc_func_table.Add(1677815637u, new RpcReceiveHandler(__rpc_handler_1677815637));
			NetworkManager.__rpc_func_table.Add(3263778136u, new RpcReceiveHandler(__rpc_handler_3263778136));
			NetworkManager.__rpc_func_table.Add(2837136169u, new RpcReceiveHandler(__rpc_handler_2837136169));
		}

		private static void __rpc_handler_2092605655(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference enemyObject = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref enemyObject, default(ForNetworkSerializable));
				int index = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref index);
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((Lantern)(object)target).InitializeLanternClientRpc(enemyObject, index, flag);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		private static void __rpc_handler_1677815637(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;
				((Lantern)(object)target).SwitchOffAllLanternsClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		private static void __rpc_handler_2837136169(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;
				((Lantern)(object)target).LanternInteractionClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "Lantern";
		}
	}
	public class LanternKeeperAI : EnemyAI
	{
		public enum State
		{
			WANDERING,
			CHASING,
			ATTACKING
		}

		public float angerMeter = 1f;

		public Lantern lastLanternLit;

		public Transform TurnCompass;

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

		public AudioClip BiteSound;

		public float crawlTimer;

		public List<EntranceTeleport> entrances;

		public Coroutine getUpCoroutine;

		public Coroutine damagePlayerCoroutine;

		public Coroutine poisonPlayerCoroutine;

		public ParticleSystem poisonParticle;

		public override void Start()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Start();
			base.currentBehaviourStateIndex = 0;
			base.creatureAnimator.SetTrigger("startMove");
			((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
		}

		public override void Update()
		{
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: 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_0107: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
			{
				return;
			}
			base.creatureAnimator.SetBool("stunned", base.stunNormalizedTimer > 0f);
			if (base.stunNormalizedTimer > 0f)
			{
				base.agent.speed = 0f;
				if ((Object)(object)base.stunnedByPlayer != (Object)null)
				{
					base.targetPlayer = base.stunnedByPlayer;
					((EnemyAI)this).StopSearch(base.currentSearch, true);
					((EnemyAI)this).SwitchToBehaviourClientRpc(1);
				}
			}
			else
			{
				PlayCrawlSound();
				int currentBehaviourStateIndex = base.currentBehaviourStateIndex;
				if ((Object)(object)base.targetPlayer != (Object)null && (currentBehaviourStateIndex == 1 || currentBehaviourStateIndex == 2))
				{
					TurnCompass.LookAt(((Component)base.targetPlayer.gameplayCamera).transform.position);
					((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, TurnCompass.eulerAngles.y, 0f)), 4f * Time.deltaTime);
				}
			}
		}

		public void PlayCrawlSound()
		{
			if (base.currentBehaviourStateIndex != 2)
			{
				crawlTimer -= Time.deltaTime;
				if (CrawlSounds.Length != 0 && crawlTimer <= 0f)
				{
					base.creatureSFX.PlayOneShot(CrawlSounds[Random.Range(0, CrawlSounds.Length)]);
					crawlTimer = ((base.currentBehaviourStateIndex == 0) ? 1.3f : 1.1f);
				}
			}
		}

		public override void DoAIInterval()
		{
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
			{
				return;
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				base.agent.speed = 1.5f * angerMeter;
				if (FoundClosestPlayerInRange(25, 10))
				{
					((EnemyAI)this).StopSearch(base.currentSearch, true);
					DoAnimationClientRpc("startChase");
					((EnemyAI)this).SwitchToBehaviourClientRpc(1);
				}
				else if ((Object)(object)lastLanternLit != (Object)null)
				{
					if (Vector3.Distance(((Component)lastLanternLit).transform.position, ((Component)this).transform.position) > 5f)
					{
						((EnemyAI)this).StopSearch(base.currentSearch, true);
						GoToLastLanternLit();
					}
					else
					{
						lastLanternLit = null;
						((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
					}
				}
				break;
			case 1:
				base.agent.speed = 3f * angerMeter;
				if (!TargetOutsideChasedPlayer())
				{
					if (!TargetClosestPlayerInAnyCase() || (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > 20f && !((EnemyAI)this).CheckLineOfSightForPosition(((Component)base.targetPlayer).transform.position, 45f, 60, -1f, (Transform)null)))
					{
						((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
						DoAnimationClientRpc("startMove");
						((EnemyAI)this).SwitchToBehaviourClientRpc(0);
					}
					else
					{
						((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer);
					}
				}
				break;
			case 2:
				base.agent.speed = (CollidesWithEnemy(((Component)base.targetPlayer.gameplayCamera).transform.position) ? 0f : (1f * angerMeter));
				if (damagePlayerCoroutine == null)
				{
					if ((Object)(object)base.targetPlayer == (Object)null || Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > 5f)
					{
						((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
						DoAnimationClientRpc("startGetDown");
						DoAnimationClientRpc("startChase");
						((EnemyAI)this).SwitchToBehaviourClientRpc(1);
						break;
					}
					damagePlayerCoroutine = ((MonoBehaviour)this).StartCoroutine(DamagePlayerCoroutine(base.targetPlayer));
				}
				((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer);
				break;
			}
		}

		private bool FoundClosestPlayerInRange(int range, int senseRange)
		{
			PlayerControllerB val = ((EnemyAI)this).CheckLineOfSightForPlayer(60f, range, senseRange);
			if ((Object)(object)val == (Object)null || !((EnemyAI)this).PlayerIsTargetable(val, false, false))
			{
				return false;
			}
			return Object.op_Implicit((Object)(object)(base.targetPlayer = val));
		}

		public void GoToLastLanternLit()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			if (lastLanternLit.isOutside != base.isOutside)
			{
				GoTowardsEntrance();
			}
			else
			{
				((EnemyAI)this).SetDestinationToPosition(((Component)lastLanternLit).transform.position, false);
			}
		}

		public bool TargetOutsideChasedPlayer()
		{
			if (base.targetPlayer.isInsideFactory == base.isOutside)
			{
				GoTowardsEntrance();
				return true;
			}
			return false;
		}

		public bool TargetClosestPlayerInAnyCase()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			base.mostOptimalDistance = 2000f;
			base.targetPlayer = null;
			for (int i = 0; i < StartOfRound.Instance.connectedPlayersAmount + 1; i++)
			{
				base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position);
				if (base.tempDist < base.mostOptimalDistance)
				{
					base.mostOptimalDistance = base.tempDist;
					base.targetPlayer = StartOfRound.Instance.allPlayerScripts[i];
				}
			}
			return (Object)(object)base.targetPlayer != (Object)null;
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			((EnemyAI)this).OnCollideWithPlayer(other);
			if (base.currentBehaviourStateIndex == 1)
			{
				PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
				if (!((Object)(object)val == (Object)null) && getUpCoroutine == null)
				{
					getUpCoroutine = ((MonoBehaviour)this).StartCoroutine(GetUpCoroutine());
				}
			}
		}

		public IEnumerator GetUpCoroutine()
		{
			DoAnimationServerRpc("startGetUp");
			DoAnimationServerRpc("startIdle");
			yield return (object)new WaitForSeconds(0.75f);
			((EnemyAI)this).SwitchToBehaviourServerRpc(2);
			getUpCoroutine = null;
		}

		public IEnumerator DamagePlayerCoroutine(PlayerControllerB player)
		{
			DoAnimationClientRpc("startBite");
			PlayBiteClientRpc();
			yield return (object)new WaitForSeconds(1f);
			if (((EnemyAI)this).CheckLineOfSightForPosition(((Component)player.gameplayCamera).transform.position, 70f, 20, 1f, (Transform)null) || CollidesWithEnemy(((Component)player.gameplayCamera).transform.position))
			{
				DamagePlayerClientRpc((int)player.playerClientId);
			}
			DoAnimationClientRpc("startIdle");
			yield return (object)new WaitForSeconds(2f);
			damagePlayerCoroutine = null;
		}

		[ClientRpc]
		public void PlayBiteClientRpc()
		{
			//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(1173540290u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1173540290u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					base.creatureSFX.PlayOneShot(BiteSound);
				}
			}
		}

		public bool CollidesWithEnemy(Vector3 position)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			Collider[] array = Physics.OverlapSphere(position, 1f, 524288, (QueryTriggerInteraction)2);
			Collider[] array2 = array;
			foreach (Collider val in array2)
			{
				EnemyAI val2 = ((Component)val).GetComponent<EnemyAICollisionDetect>()?.mainScript;
				if ((Object)(object)val2 != (Object)null && (Object)(object)val2 == (Object)(object)this)
				{
					return true;
				}
			}
			return false;
		}

		[ClientRpc]
		public void DamagePlayerClientRpc(int 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)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: 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(4012134687u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4012134687u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>();
				if ((Object)(object)component == (Object)(object)GameNetworkManager.Instance.localPlayerController)
				{
					component.DamagePlayer((int)(20f * angerMeter), true, true, (CauseOfDeath)6, 0, false, default(Vector3));
					StopPoisonParticlePlayer();
					poisonPlayerCoroutine = ((MonoBehaviour)this).StartCoroutine(PoisonPlayerCoroutine(component));
				}
			}
		}

		public IEnumerator PoisonPlayerCoroutine(PlayerControllerB player)
		{
			poisonParticle = LKUtilities.SpawnPoisonParticle(((Component)player).transform);
			float timePassed = 0f;
			while (timePassed < (float)ConfigManager.enemyPoisonDuration.Value)
			{
				HUDManager.Instance.drunknessFilter.weight = Mathf.Max(ConfigManager.enemyPoisonIntensity.Value, HUDManager.Instance.drunknessFilter.weight);
				if (Mathf.FloorToInt(timePassed * 10f) % 10 == 0)
				{
					player.DamagePlayer(ConfigManager.enemyPoisonDamage.Value, true, true, (CauseOfDeath)5, 0, false, default(Vector3));
				}
				timePassed += Time.deltaTime;
				yield return null;
			}
			Object.Destroy((Object)(object)((Component)poisonParticle).gameObject);
			poisonPlayerCoroutine = null;
		}

		public void StopPoisonParticlePlayer()
		{
			if (poisonPlayerCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(poisonPlayerCoroutine);
			}
			if ((Object)(object)poisonParticle != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)poisonParticle).gameObject);
			}
			poisonPlayerCoroutine = null;
		}

		public void GoTowardsEntrance()
		{
			//IL_006b: 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)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			if (entrances != null || entrances.Count == 0)
			{
				entrances = Object.FindObjectsOfType<EntranceTeleport>().ToList();
			}
			EntranceTeleport entranceTeleport = (from e in entrances
				where e.isEntranceToBuilding == base.isOutside
				orderby Vector3.Distance(((Component)this).transform.position, e.entrancePoint.position)
				select e).FirstOrDefault();
			if (Vector3.Distance(((Component)this).transform.position, entranceTeleport.entrancePoint.position) < 1f)
			{
				Vector3 position = ((IEnumerable<EntranceTeleport>)entrances).FirstOrDefault((Func<EntranceTeleport, bool>)((EntranceTeleport e) => e.isEntranceToBuilding != entranceTeleport.isEntranceToBuilding && e.entranceId == entranceTeleport.entranceId)).entrancePoint.position;
				((MonoBehaviour)this).StartCoroutine(TeleportEnemyCoroutine(position));
			}
			else
			{
				((EnemyAI)this).SetDestinationToPosition(entranceTeleport.entrancePoint.position, false);
			}
		}

		public IEnumerator TeleportEnemyCoroutine(Vector3 position)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			yield return (object)new WaitForSeconds(1f);
			TeleportEnemyClientRpc(position, !base.isOutside);
		}

		[ClientRpc]
		public void TeleportEnemyClientRpc(Vector3 teleportPosition, bool isOutside)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: 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(3919746712u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref teleportPosition);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isOutside, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3919746712u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					((EnemyAI)this).SetEnemyOutside(isOutside);
					base.serverPosition = teleportPosition;
					((Component)this).transform.position = teleportPosition;
					base.agent.Warp(teleportPosition);
					((EnemyAI)this).SyncPositionToClients();
				}
			}
		}

		public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			if (base.enemyType.canDie && !base.isEnemyDead)
			{
				((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
				((EnemyAI)this).SetEnemyStunned(true, 0.2f, playerWhoHit);
				base.enemyHP -= force;
				if (base.enemyHP <= 0 && ((NetworkBehaviour)this).IsOwner)
				{
					((EnemyAI)this).KillEnemyOnOwnerClient(false);
				}
			}
		}

		public override void KillEnemy(bool destroy = false)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			((EnemyAI)this).KillEnemy(false);
			if (damagePlayerCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(damagePlayerCoroutine);
			}
			if (((NetworkBehaviour)this).IsServer || ((NetworkBehaviour)this).IsHost)
			{
				for (int i = 0; i < StartOfRound.Instance.connectedPlayersAmount + 1; i++)
				{
					LKUtilities.SpawnObject(LanternKeeper.daggerObj, ((Component)this).transform.position + Vector3.up * 0.5f, !base.isOutside);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void DoAnimationServerRpc(string animationState)
		{
			//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 != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2427062469u, val, (RpcDelivery)0);
				bool flag = animationState != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(animationState, false);
				}
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2427062469u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				DoAnimationClientRpc(animationState);
			}
		}

		[ClientRpc]
		public void DoAnimationClientRpc(string animationState)
		{
			//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(1414811016u, val, (RpcDelivery)0);
				bool flag = animationState != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(animationState, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1414811016u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				base.creatureAnimator.SetTrigger(animationState);
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_LanternKeeperAI()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(1173540290u, new RpcReceiveHandler(__rpc_handler_1173540290));
			NetworkManager.__rpc_func_table.Add(4012134687u, new RpcReceiveHandler(__rpc_handler_4012134687));
			NetworkManager.__rpc_func_table.Add(3919746712u, new RpcReceiveHandler(__rpc_handler_3919746712));
			NetworkManager.__rpc_func_table.Add(2427062469u, new RpcReceiveHandler(__rpc_handler_2427062469));
			NetworkManager.__rpc_func_table.Add(1414811016u, new RpcReceiveHandler(__rpc_handler_1414811016));
		}

		private static void __rpc_handler_1173540290(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;
				((LanternKeeperAI)(object)target).PlayBiteClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4012134687(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 playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((LanternKeeperAI)(object)target).DamagePlayerClientRpc(playerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3919746712(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_003c: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 teleportPosition = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref teleportPosition);
				bool isOutside = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isOutside, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((LanternKeeperAI)(object)target).TeleportEnemyClientRpc(teleportPosition, isOutside);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2427062469(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 animationState = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref animationState, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((LanternKeeperAI)(object)target).DoAnimationServerRpc(animationState);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1414811016(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 animationState = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref animationState, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((LanternKeeperAI)(object)target).DoAnimationClientRpc(animationState);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "LanternKeeperAI";
		}
	}
	public class PoisonDagger : PhysicsProp
	{
		public AudioSource daggerAudio;

		public List<RaycastHit> objectsHitByDaggerList = new List<RaycastHit>();

		public PlayerControllerB previousPlayerHeldBy;

		public RaycastHit[] objectsHitByDagger;

		public int daggerHitForce = 1;

		public AudioClip[] hitSFX;

		public AudioClip[] swingSFX;

		public int daggerMask = 1084754248;

		public float timeAtLastDamageDealt;

		public Coroutine poisonEnemyCoroutine;

		public ParticleSystem poisonParticle;

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			RoundManager.PlayRandomClip(daggerAudio, swingSFX, true, 1f, 0, 1000);
			if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
			{
				previousPlayerHeldBy = ((GrabbableObject)this).playerHeldBy;
				if (((NetworkBehaviour)((GrabbableObject)this).playerHeldBy).IsOwner)
				{
					((GrabbableObject)this).playerHeldBy.playerBodyAnimator.SetTrigger("UseHeldItem1");
				}
			}
			if (((NetworkBehaviour)this).IsOwner)
			{
				HitDagger();
			}
		}

		public void HitDagger(bool cancel = false)
		{
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: 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_007e: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)previousPlayerHeldBy == (Object)null)
			{
				LanternKeeper.mls.LogError((object)"Previousplayerheldby is null on this client when HitDagger is called.");
				return;
			}
			previousPlayerHeldBy.activatingItem = false;
			bool flag = false;
			bool flag2 = false;
			int num = -1;
			if (!cancel && Time.realtimeSinceStartup - timeAtLastDamageDealt > 0.43f)
			{
				previousPlayerHeldBy.twoHanded = false;
				objectsHitByDagger = Physics.SphereCastAll(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * 0.1f, 0.3f, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward, 0.75f, daggerMask, (QueryTriggerInteraction)2);
				objectsHitByDaggerList = objectsHitByDagger.OrderBy((RaycastHit x) => ((RaycastHit)(ref x)).distance).ToList();
				IHittable val = default(IHittable);
				RaycastHit val2 = default(RaycastHit);
				foreach (RaycastHit objectsHitByDagger in objectsHitByDaggerList)
				{
					RaycastHit current = objectsHitByDagger;
					if (((Component)((RaycastHit)(ref current)).transform).gameObject.layer == 8 || ((Component)((RaycastHit)(ref current)).transform).gameObject.layer == 11)
					{
						flag = true;
						for (int i = 0; i < StartOfRound.Instance.footstepSurfaces.Length; i++)
						{
							if (StartOfRound.Instance.footstepSurfaces[i].surfaceTag == ((Component)((RaycastHit)(ref current)).collider).gameObject.tag)
							{
								num = i;
								break;
							}
						}
					}
					else
					{
						if (!((Component)((RaycastHit)(ref current)).transform).TryGetComponent<IHittable>(ref val) || (Object)(object)((RaycastHit)(ref current)).transform == (Object)(object)((Component)previousPlayerHeldBy).transform || (!(((RaycastHit)(ref current)).point == Vector3.zero) && Physics.Linecast(((Component)previousPlayerHeldBy.gameplayCamera).transform.position, ((RaycastHit)(ref current)).point, ref val2, StartOfRound.Instance.collidersAndRoomMaskAndDefault)))
						{
							continue;
						}
						flag = true;
						try
						{
							if (Time.realtimeSinceStartup - timeAtLastDamageDealt > 0.43f)
							{
								timeAtLastDamageDealt = Time.realtimeSinceStartup;
								val.Hit(daggerHitForce, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward, previousPlayerHeldBy, true, 5);
								EnemyAICollisionDetect val3 = (EnemyAICollisionDetect)(object)((val is EnemyAICollisionDetect) ? val : null);
								if (val3 != null && poisonEnemyCoroutine == null)
								{
									PoisonEnemyServerRpc(NetworkObjectReference.op_Implicit(val3.mainScript.thisNetworkObject));
								}
							}
							flag2 = true;
						}
						catch (Exception arg)
						{
							LanternKeeper.mls.LogError((object)$"Exception caught when hitting object with dagger from player #{previousPlayerHeldBy.playerClientId}: {arg}");
						}
					}
				}
			}
			if (flag)
			{
				RoundManager.PlayRandomClip(daggerAudio, hitSFX, true, 1f, 0, 1000);
				Object.FindObjectOfType<RoundManager>().PlayAudibleNoise(((Component)this).transform.position, 17f, 0.8f, 0, false, 0);
				if (!flag2 && num != -1)
				{
					daggerAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX);
					WalkieTalkie.TransmitOneShotAudio(daggerAudio, StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX, 1f);
				}
				HitDaggerServerRpc(num);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void PoisonEnemyServerRpc(NetworkObjectReference enemyObject)
		{
			//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)
			//IL_00d7: 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(1645231312u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref enemyObject, default(ForNetworkSerializable));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1645231312u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					PoisonEnemyClientRpc(enemyObject);
				}
			}
		}

		[ClientRpc]
		public void PoisonEnemyClientRpc(NetworkObjectReference enemyObject)
		{
			//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(428165556u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref enemyObject, default(ForNetworkSerializable));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 428165556u, val, (RpcDelivery)0);
				}
				NetworkObject val3 = default(NetworkObject);
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref enemyObject)).TryGet(ref val3, (NetworkManager)null))
				{
					EnemyAI componentInChildren = ((Component)val3).gameObject.GetComponentInChildren<EnemyAI>();
					StopPoisonParticleEnemy();
					poisonEnemyCoroutine = ((MonoBehaviour)this).StartCoroutine(PoisonEnemyCoroutine(componentInChildren));
				}
			}
		}

		public IEnumerator PoisonEnemyCoroutine(EnemyAI enemy)
		{
			poisonParticle = LKUtilities.SpawnPoisonParticle(((Component)enemy).transform);
			float timePassed = 0f;
			while (timePassed < (float)ConfigManager.daggerPoisonDuration.Value)
			{
				if (Mathf.FloorToInt(timePassed * 10f) % 10 == 0)
				{
					enemy.SetEnemyStunned(true, ConfigManager.daggerPoisonStunDuration.Value, ((GrabbableObject)this).playerHeldBy);
				}
				timePassed += Time.deltaTime;
				yield return null;
			}
			enemy.HitEnemy(ConfigManager.daggerPoisonDamage.Value, ((GrabbableObject)this).playerHeldBy, true, -1);
			Object.Destroy((Object)(object)((Component)poisonParticle).gameObject);
			poisonEnemyCoroutine = null;
		}

		public void StopPoisonParticleEnemy()
		{
			if (poisonEnemyCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(poisonEnemyCoroutine);
			}
			if ((Object)(object)poisonParticle != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)poisonParticle).gameObject);
			}
			poisonEnemyCoroutine = null;
		}

		[ServerRpc(RequireOwnership = false)]
		public void HitDaggerServerRpc(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 != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3558281448u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, hitSurfaceID);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3558281448u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					HitDaggerClientRpc(hitSurfaceID);
				}
			}
		}

		[ClientRpc]
		public void HitDaggerClientRpc(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(168960481u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, hitSurfaceID);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 168960481u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((NetworkBehaviour)this).IsOwner)
			{
				RoundManager.PlayRandomClip(daggerAudio, hitSFX, true, 1f, 0, 1000);
				if (hitSurfaceID != -1)
				{
					HitSurfaceWithDagger(hitSurfaceID);
				}
			}
		}

		public void HitSurfaceWithDagger(int hitSurfaceID)
		{
			daggerAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX);
			WalkieTalkie.TransmitOneShotAudio(daggerAudio, StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX, 1f);
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_PoisonDagger()
		{
			//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(1645231312u, new RpcReceiveHandler(__rpc_handler_1645231312));
			NetworkManager.__rpc_func_table.Add(428165556u, new RpcReceiveHandler(__rpc_handler_428165556));
			NetworkManager.__rpc_func_table.Add(3558281448u, new RpcReceiveHandler(__rpc_handler_3558281448));
			NetworkManager.__rpc_func_table.Add(168960481u, new RpcReceiveHandler(__rpc_handler_168960481));
		}

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

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

		private static void __rpc_handler_3558281448(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)1;
				((PoisonDagger)(object)target).HitDaggerServerRpc(hitSurfaceID);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_168960481(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;
				((PoisonDagger)(object)target).HitDaggerClientRpc(hitSurfaceID);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "PoisonDagger";
		}
	}
	public class WallhackCustomPass : CustomPass
	{
		public Material wallhackMaterial;

		public List<Renderer> targetRenderers = new List<Renderer>();

		public void SetTargetRenderers(Renderer[] renderers, Material material)
		{
			targetRenderers.Clear();
			targetRenderers.AddRange(renderers);
			wallhackMaterial = material;
		}

		public void ClearTargetRenderers()
		{
			targetRenderers.Clear();
		}

		public override void Execute(CustomPassContext ctx)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			if (targetRenderers == null || (Object)(object)wallhackMaterial == (Object)null)
			{
				return;
			}
			foreach (Renderer targetRenderer in targetRenderers)
			{
				if (!((Object)(object)targetRenderer == (Object)null) && targetRenderer.sharedMaterials != null)
				{
					for (int i = 0; i < targetRenderer.sharedMaterials.Length; i++)
					{
						ctx.cmd.DrawRenderer(targetRenderer, wallhackMaterial);
					}
				}
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace LanternKeeper.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}