BepInEx/plugins/JLL/JLL.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using DunGen.Graph;
using GameNetcodeStuff;
using HarmonyLib;
using JLL.API;
using JLL.API.Compatability;
using JLL.API.Events;
using JLL.API.JSON.Objects;
using JLL.API.LevelProperties;
using JLL.Components;
using JLL.Components.Filters;
using JLL.NetcodePatcher;
using JLL.Patches;
using JLL.ScriptableObjects;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalLevelLoader;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using Unity.AI.Navigation;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Events;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.Serialization;
using WeatherRegistry;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("JLL")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("JLL")]
[assembly: AssemblyTitle("JLL")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace JLL
{
	[BepInPlugin("JacobG5.JLL", "JLL", "1.7.7")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class JLL : BaseUnityPlugin
	{
		private const string modGUID = "JacobG5.JLL";

		private const string modName = "JLL";

		private const string modVersion = "1.7.7";

		private readonly Harmony harmony = new Harmony("JacobG5.JLL");

		public static JLL Instance;

		internal ManualLogSource mls;

		internal ManualLogSource wesley;

		public GameObject networkObject;

		public static ConfigEntry<JLogLevel> loggingLevel;

		public static ConfigEntry<bool> purgeWesley;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("JacobG5.JLL");
			wesley = Logger.CreateLogSource("Wesley");
			loggingLevel = ((BaseUnityPlugin)this).Config.Bind<JLogLevel>("Logging", "LoggingLevel", JLogLevel.User, "Changes the amount of logging JLL performs in it's scripts.");
			loggingLevel.SettingChanged += delegate
			{
				JLogHelper.UpdateLogLevel();
			};
			purgeWesley = ((BaseUnityPlugin)this).Config.Bind<bool>("Logging", "PurgeWesley", false, "Destroys him.");
			JLogHelper.UpdateLogLevel();
			NetcodePatch(mls, Assembly.GetExecutingAssembly().GetTypes());
			networkObject = NetworkPrefabs.CreateNetworkPrefab("JLL");
			networkObject.AddComponent<JLLNetworkManager>();
			((Object)networkObject).name = "JLL";
			JNetworkPrefabSet.EmptyNetworkObject = NetworkPrefabs.CreateNetworkPrefab("EmptyPrefab");
			JCompatabilityHelper.Init();
			if (JCompatabilityHelper.IsModLoaded.LethalConfig)
			{
				LethalConfigHelper.CreateJLLModConfig();
			}
			HarmonyPatch(harmony, mls, typeof(ItemChargerPatch), typeof(TimeOfDayPatch), typeof(HudManagerPatch), typeof(StartOfRoundPatch), typeof(RoundManagerPatch), typeof(LungPropPatch), typeof(VehicleControllerPatch), typeof(MenuManagerPatch), typeof(BreakerBoxPatch), typeof(ItemDropshipPatch), typeof(GameNetworkManagerPatch));
			JFileHelper.LoadFilesInPlugins();
		}

		public static void HarmonyPatch(Harmony harmony, ManualLogSource logSource, params Type[] patches)
		{
			foreach (Type type in patches)
			{
				try
				{
					harmony.PatchAll(type);
				}
				catch (Exception arg)
				{
					logSource.LogError((object)$"Caught Error while trying to patch {type.Name}\n{arg}");
				}
			}
		}

		public static void NetcodePatch(ManualLogSource logSource, params Type[] types)
		{
			foreach (Type type in types)
			{
				try
				{
					MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
					MethodInfo[] array = methods;
					foreach (MethodInfo methodInfo in array)
					{
						object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
						if (customAttributes.Length != 0)
						{
							methodInfo.Invoke(null, null);
						}
					}
				}
				catch
				{
					logSource.LogInfo((object)"Skipping Netcode Class");
				}
			}
			logSource.LogInfo((object)"Netcode Successfully Patched!");
		}
	}
}
namespace JLL.ScriptableObjects
{
	[CreateAssetMenu(menuName = "JLL/JLevelProperties")]
	public class JLevelProperties : ScriptableObject
	{
		[Header("-=-EXPERIMENTAL-=-")]
		public JLevelPropertyEntry Properties = new JLevelPropertyEntry();
	}
	public abstract class JLLAddon : ScriptableObject
	{
		public abstract void Init(JLLMod parent);
	}
	[CreateAssetMenu(menuName = "JLL/JLLMod")]
	public class JLLMod : ScriptableObject
	{
		[Serializable]
		public class ConfigValue<T>
		{
			public string configName = "Example";

			public string configCategory = "Main";

			public string configDescription = "";

			public T defaultValue;
		}

		private static readonly List<JLLMod> m_ModList = new List<JLLMod>();

		public string modAuthor = "";

		public string modName = "";

		[Header("Network Prefabs")]
		public JNetworkPrefabSet[] prefabSets = new JNetworkPrefabSet[0];

		[Header("Config Values")]
		public List<ConfigValue<bool>> Booleans = new List<ConfigValue<bool>>();

		public List<ConfigValue<string>> Strings = new List<ConfigValue<string>>();

		public List<ConfigValue<int>> Integers = new List<ConfigValue<int>>();

		public List<ConfigValue<float>> Floats = new List<ConfigValue<float>>();

		[Header("JLL Addons")]
		public JLLAddon[] jllAddons = new JLLAddon[0];

		public static JLLMod? GetMod(string name, string author)
		{
			return GetMod(author + "." + name);
		}

		public static JLLMod? GetMod(string guid)
		{
			for (int i = 0; i < m_ModList.Count; i++)
			{
				if (m_ModList[i].GUID() == guid)
				{
					return m_ModList[i];
				}
			}
			return null;
		}

		public static JLLMod[] GetModsFromAuthor(string author)
		{
			List<JLLMod> list = new List<JLLMod>();
			for (int i = 0; i < m_ModList.Count; i++)
			{
				if (m_ModList[i].modAuthor == author)
				{
					list.Add(m_ModList[i]);
				}
			}
			return list.ToArray();
		}

		public string GUID()
		{
			return modAuthor + "." + modName;
		}

		internal void Init()
		{
			if (!m_ModList.Contains(this))
			{
				m_ModList.Add(this);
			}
			for (int i = 0; i < prefabSets.Length; i++)
			{
				if (!JNetworkPrefabSet.NetworkPrefabSets.Contains(prefabSets[i]))
				{
					JNetworkPrefabSet.NetworkPrefabSets.Add(prefabSets[i]);
				}
			}
			for (int j = 0; j < jllAddons.Length; j++)
			{
				try
				{
					jllAddons[j].Init(this);
				}
				catch (Exception arg)
				{
					JLogHelper.LogError($"JLL Addon failed to initialize from {GUID()}: {arg}");
				}
			}
		}

		public JNetworkPrefabSet? GetNetworkPrefabSet(string name)
		{
			for (int i = 0; i < prefabSets.Length; i++)
			{
				if (prefabSets[i].SetName == name)
				{
					return prefabSets[i];
				}
			}
			return null;
		}
	}
	[CreateAssetMenu(menuName = "JLL/Collections/JLLModCollection", order = 20)]
	public class JLLModCollection : ScriptableObject
	{
		public JLLMod[] Mods = new JLLMod[0];
	}
	[CreateAssetMenu(menuName = "JLL/JNetworkPrefabSet")]
	public class JNetworkPrefabSet : ScriptableObject
	{
		[Serializable]
		public class JIdentifiablePrefab : IWeightedItem
		{
			public string name;

			public GameObject prefab;

			[Range(0f, 100f)]
			public int Weight = 20;

			public int GetWeight()
			{
				return Weight;
			}
		}

		public static readonly List<JNetworkPrefabSet> NetworkPrefabSets = new List<JNetworkPrefabSet>();

		public string SetName;

		public JIdentifiablePrefab[] prefabList = new JIdentifiablePrefab[1]
		{
			new JIdentifiablePrefab()
		};

		public static GameObject EmptyNetworkObject { get; internal set; }

		internal static void RegisterPrefabs()
		{
			NetworkManager component = ((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>();
			List<GameObject> list = new List<GameObject>();
			foreach (NetworkPrefab prefab in component.NetworkConfig.Prefabs.Prefabs)
			{
				list.Add(prefab.Prefab);
			}
			int num = 0;
			foreach (JNetworkPrefabSet networkPrefabSet in NetworkPrefabSets)
			{
				for (int i = 0; i < networkPrefabSet.prefabList.Length; i++)
				{
					if (!((Object)(object)networkPrefabSet.prefabList[i].prefab == (Object)null) && !list.Contains(networkPrefabSet.prefabList[i].prefab))
					{
						component.AddNetworkPrefab(networkPrefabSet.prefabList[i].prefab);
						num++;
						JLogHelper.LogInfo("Registered Network Object: " + networkPrefabSet.prefabList[i].name + " (" + ((Object)networkPrefabSet.prefabList[i].prefab).name + ")", JLogLevel.Wesley);
					}
				}
			}
			JLogHelper.LogInfo($"Registered {num} Network Objects");
		}

		public GameObject GetPrefab(string name)
		{
			for (int i = 0; i < prefabList.Length; i++)
			{
				if (prefabList[i].name == name)
				{
					return prefabList[i].prefab;
				}
			}
			return EmptyNetworkObject;
		}

		public bool GetPrefab(string name, out GameObject prefab)
		{
			for (int i = 0; i < prefabList.Length; i++)
			{
				if (prefabList[i].name == name)
				{
					prefab = prefabList[i].prefab;
					return true;
				}
			}
			prefab = EmptyNetworkObject;
			return false;
		}

		public GameObject GetRandomPrefab()
		{
			JIdentifiablePrefab[] array = prefabList;
			IWeightedItem[] weightedItems = prefabList;
			return array[IWeightedItem.GetRandomIndex(weightedItems)].prefab;
		}
	}
}
namespace JLL.Patches
{
	[HarmonyPatch(typeof(BreakerBox))]
	internal class BreakerBoxPatch
	{
		[HarmonyPatch("SwitchBreaker")]
		[HarmonyPostfix]
		public static void patchSwitchBreaker(bool on)
		{
			for (int i = 0; i < JLevelEventTriggers.EventTriggers.Count; i++)
			{
				JLevelEventTriggers.EventTriggers[i].ToggleBreakerBox(on);
			}
		}

		[HarmonyPatch("SetSwitchesOff")]
		[HarmonyPostfix]
		public static void patchSetSwitchesOff()
		{
			for (int i = 0; i < JLevelEventTriggers.EventTriggers.Count; i++)
			{
				JLevelEventTriggers.EventTriggers[i].ToggleBreakerBox(active: false);
			}
		}
	}
	[HarmonyPatch(typeof(GameNetworkManager))]
	public class GameNetworkManagerPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void patchStart(GameNetworkManager __instance)
		{
			((MonoBehaviour)__instance).StartCoroutine(RegisterNetworkPrefabs());
		}

		private static IEnumerator RegisterNetworkPrefabs()
		{
			yield return (object)new WaitUntil((Func<bool>)(() => JFileHelper.HaveJLLBundlesLoaded));
			JNetworkPrefabSet.RegisterPrefabs();
		}
	}
	[HarmonyPatch(typeof(HUDManager))]
	public class HudManagerPatch
	{
		public static JWaterFilter? customFilter;

		[HarmonyPatch("UnderwaterScreenFilters")]
		[HarmonyPrefix]
		public static bool patchUnderwaterScreenFilters(HUDManager __instance)
		{
			//IL_004a: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB localPlayer = __instance.localPlayer;
			if ((Object)(object)__instance.localPlayer != (Object)null)
			{
				bool flag = false;
				PlayerControllerB spectatedPlayerScript = localPlayer.spectatedPlayerScript;
				if (localPlayer.isPlayerDead && (Object)(object)spectatedPlayerScript != (Object)null && (Object)(object)spectatedPlayerScript.underwaterCollider != (Object)null)
				{
					Bounds bounds = spectatedPlayerScript.underwaterCollider.bounds;
					if (((Bounds)(ref bounds)).Contains(((Component)StartOfRound.Instance.spectateCamera).transform.position))
					{
						flag = true;
						((Component)spectatedPlayerScript.underwaterCollider).TryGetComponent<JWaterFilter>(ref customFilter);
					}
				}
				if ((Object)(object)customFilter == (Object)null && !localPlayer.isPlayerDead && (Object)(object)localPlayer.underwaterCollider != (Object)null)
				{
					((Component)localPlayer.underwaterCollider).TryGetComponent<JWaterFilter>(ref customFilter);
				}
				if ((Object)(object)customFilter != (Object)null)
				{
					if (__instance.setUnderwaterFilter || flag)
					{
						customFilter.UnderwaterFilters(__instance, flag);
						__instance.breathingUnderwaterAudio.volume = Mathf.Lerp(__instance.breathingUnderwaterAudio.volume, 1f, 10f * Time.deltaTime);
						if ((Object)(object)customFilter.customUnderwaterSounds != (Object)null)
						{
							customFilter.customUnderwaterSounds.volume = __instance.breathingUnderwaterAudio.volume;
						}
					}
					else
					{
						if (__instance.audioListenerLowPass.cutoffFrequency >= 19000f)
						{
							((Behaviour)__instance.audioListenerLowPass).enabled = false;
						}
						else
						{
							__instance.audioListenerLowPass.cutoffFrequency = Mathf.Lerp(__instance.audioListenerLowPass.cutoffFrequency, 20000f, 10f * Time.deltaTime);
						}
						if (customFilter.underwaterFilter.weight < 0.05f)
						{
							customFilter.underwaterFilter.weight = 0f;
							__instance.breathingUnderwaterAudio.Stop();
							if ((Object)(object)customFilter.customUnderwaterSounds != (Object)null)
							{
								customFilter.customUnderwaterSounds.Stop();
							}
							customFilter = null;
						}
						else
						{
							__instance.breathingUnderwaterAudio.volume = Mathf.Lerp(__instance.breathingUnderwaterAudio.volume, 0f, 10f * Time.deltaTime);
							if ((Object)(object)customFilter.customUnderwaterSounds != (Object)null)
							{
								customFilter.customUnderwaterSounds.volume = __instance.breathingUnderwaterAudio.volume;
							}
							customFilter.underwaterFilter.weight = Mathf.Lerp(customFilter.underwaterFilter.weight, 0f, 10f * Time.deltaTime);
						}
					}
					return false;
				}
			}
			return true;
		}

		[HarmonyPatch("DisplayTip")]
		[HarmonyPrefix]
		public static void patchDisplayTip(HUDManager __instance)
		{
			JHudHelper.isTipActive = true;
			((MonoBehaviour)__instance).StartCoroutine(TipQueueCheck());
		}

		private static IEnumerator TipQueueCheck()
		{
			yield return (object)new WaitForSeconds(5f);
			JHudHelper.isTipActive = false;
			JHudHelper.DisplayNextTip();
		}
	}
	[HarmonyPatch(typeof(ItemCharger))]
	internal class ItemChargerPatch
	{
		[HarmonyPatch("chargeItemDelayed")]
		[HarmonyPrefix]
		public static void patchChargeItemDelayed(ItemCharger __instance)
		{
			ChargeLimiter chargeLimiter = default(ChargeLimiter);
			if (((Component)__instance).TryGetComponent<ChargeLimiter>(ref chargeLimiter))
			{
				JLogHelper.LogInfo("Found Limiter");
				chargeLimiter.Charge();
			}
		}
	}
	[HarmonyPatch(typeof(ItemDropship))]
	internal class ItemDropshipPatch
	{
		[HarmonyPatch("OpenShipDoorsOnServer")]
		[HarmonyPostfix]
		public static void patchOpenShipDoorsOnServer(ItemDropship __instance)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			JItemDropshipModifier jItemDropshipModifier = default(JItemDropshipModifier);
			if (!((Component)__instance).TryGetComponent<JItemDropshipModifier>(ref jItemDropshipModifier))
			{
				return;
			}
			GrabbableObject val = default(GrabbableObject);
			for (int i = 0; i < __instance.itemSpawnPositions.Length; i++)
			{
				Collider[] array = Physics.OverlapSphere(__instance.itemSpawnPositions[i].position, 0.5f, 64);
				for (int j = 0; j < array.Length; j++)
				{
					if (((Component)array[j]).gameObject.TryGetComponent<GrabbableObject>(ref val))
					{
						JLogHelper.LogInfo("Found dropship item! " + val.itemProperties.itemName, JLogLevel.Wesley);
						jItemDropshipModifier.ModifyDroppedItems(val);
					}
				}
			}
		}
	}
	[HarmonyPatch(typeof(LungProp))]
	internal class LungPropPatch
	{
		[HarmonyPatch("EquipItem")]
		[HarmonyPrefix]
		public static void patchEquipItem(LungProp __instance)
		{
			if (__instance.isLungDocked)
			{
				for (int i = 0; i < JLevelEventTriggers.EventTriggers.Count; i++)
				{
					JLevelEventTriggers.EventTriggers[i].InvokeApparatus();
				}
			}
		}
	}
	[HarmonyPatch(typeof(MenuManager))]
	internal class MenuManagerPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPrefix]
		public static void patchStart()
		{
			JLevelPropertyRegistry.RemoveLevelOverrides();
		}
	}
	[HarmonyPatch(typeof(RoundManager))]
	internal class RoundManagerPatch
	{
		[HarmonyPatch("FinishGeneratingLevel")]
		[HarmonyPrefix]
		public static void spawnFinishGeneratingLevel()
		{
			JMaterialReplacer[] array = Object.FindObjectsOfType<JMaterialReplacer>();
			for (int i = 0; i < array.Length; i++)
			{
				if (array[i].triggerPostDunGen)
				{
					array[i].SearchAndReplace();
				}
			}
		}

		[HarmonyPatch("FinishGeneratingNewLevelClientRpc")]
		[HarmonyPrefix]
		public static void patchPostLevelGeneration()
		{
			if (JLevelPropertyRegistry.IsLevelGenerated)
			{
				return;
			}
			JLevelPropertyRegistry.ApplyLevelOverrides();
			IDungeonLoadListener[] array = Object.FindObjectsOfType<MonoBehaviour>().OfType<IDungeonLoadListener>().ToArray();
			if (array.Length != 0)
			{
				for (int i = 0; i < array.Length; i++)
				{
					array[i].PostDungeonGeneration();
				}
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void spawnNetworkManager(StartOfRound __instance)
		{
			if (((NetworkBehaviour)__instance).IsHost || ((NetworkBehaviour)__instance).IsServer)
			{
				GameObject val = Object.Instantiate<GameObject>(JLL.Instance.networkObject);
				val.GetComponent<NetworkObject>().Spawn(false);
				JLogHelper.LogInfo("JLL Network Manager Initialized.", JLogLevel.User);
			}
		}

		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		public static void FindAllEnemyTypes()
		{
			List<EnemyType> enemyTypes = new List<EnemyType>();
			SelectableLevel testAllEnemiesLevel = Object.FindObjectOfType<QuickMenuManager>().testAllEnemiesLevel;
			FindEnemyTypes(testAllEnemiesLevel.Enemies, ref enemyTypes);
			FindEnemyTypes(testAllEnemiesLevel.OutsideEnemies, ref enemyTypes);
			FindEnemyTypes(testAllEnemiesLevel.DaytimeEnemies, ref enemyTypes);
			JLevelPropertyRegistry.AllSortedEnemies.Clear();
			JLevelPropertyRegistry.AllSortedEnemies.AddRange(enemyTypes);
		}

		private static void FindEnemyTypes(List<SpawnableEnemyWithRarity> spawnableEnemies, ref List<EnemyType> enemyTypes)
		{
			for (int i = 0; i < spawnableEnemies.Count; i++)
			{
				if ((Object)(object)spawnableEnemies[i].enemyType != (Object)null && !enemyTypes.Contains(spawnableEnemies[i].enemyType))
				{
					enemyTypes.Add(spawnableEnemies[i].enemyType);
				}
			}
		}

		[HarmonyPatch("EndOfGame")]
		[HarmonyPrefix]
		public static void patchEndOfGame()
		{
			JWeatherOverride.Instance = null;
			if ((Object)(object)HudManagerPatch.customFilter != (Object)null)
			{
				HudManagerPatch.customFilter.underwaterFilter.weight = 0f;
				HudManagerPatch.customFilter = null;
			}
			JLevelEventTriggers.EventTriggers = new List<JLevelEventTriggers>();
			JLevelPropertyRegistry.RemoveLevelOverrides();
		}

		[HarmonyPatch("OnShipLandedMiscEvents")]
		[HarmonyPrefix]
		public static void patchOnShipLandedMiscEvents()
		{
			for (int i = 0; i < JLevelEventTriggers.EventTriggers.Count; i++)
			{
				JLevelEventTriggers.EventTriggers[i].ShipLanded.Invoke();
			}
		}

		[HarmonyPatch("ShipLeave")]
		[HarmonyPrefix]
		public static void patchShipLeave()
		{
			for (int i = 0; i < JLevelEventTriggers.EventTriggers.Count; i++)
			{
				JLevelEventTriggers.EventTriggers[i].ShipLeaving.Invoke();
			}
		}
	}
	[HarmonyPatch(typeof(TimeOfDay))]
	internal class TimeOfDayPatch
	{
		[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPatch(typeof(TimeOfDay), "DisableWeatherEffect")]
		public static void DisableWeatherEffect(object instance, WeatherEffect effect)
		{
			throw new NotImplementedException("It's a stub");
		}

		[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPatch(typeof(TimeOfDay), "fadeOutEffect")]
		public static IEnumerator fadeOutEffect(object instance, WeatherEffect effect, Vector3 moveFromPosition)
		{
			throw new NotImplementedException("It's a stub");
		}

		[HarmonyPatch("DisableWeatherEffect")]
		[HarmonyPrefix]
		public static void DisableWeatherEffect(WeatherEffect effect)
		{
			JWeatherOverride instance = JWeatherOverride.Instance;
			if ((Object)(object)instance != (Object)null)
			{
				WeatherEffect overrideEffect = instance.getOverrideEffect(effect.name);
				if (overrideEffect != null && (Object)(object)overrideEffect.effectObject != (Object)null)
				{
					overrideEffect.effectObject.SetActive(false);
				}
			}
		}

		[HarmonyPatch("DisableAllWeather")]
		[HarmonyPrefix]
		public static void DisableAllWeather(bool deactivateObjects)
		{
			JWeatherOverride instance = JWeatherOverride.Instance;
			if (!((Object)(object)instance != (Object)null))
			{
				return;
			}
			for (int i = 0; i < instance.overrideEffects.Length; i++)
			{
				WeatherEffect val = instance.overrideEffects[i];
				val.effectEnabled = false;
				if (deactivateObjects && (Object)(object)val.effectObject != (Object)null)
				{
					val.effectObject.SetActive(false);
				}
			}
		}
	}
	[HarmonyPatch(typeof(VehicleController))]
	public class VehicleControllerPatch
	{
		[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPatch(typeof(VehicleController), "DealPermanentDamage")]
		public static void DealPermanentDamage(object instance, int damageAmount, Vector3 damagePosition = default(Vector3))
		{
			throw new NotImplementedException("It's a stub");
		}
	}
}
namespace JLL.Components
{
	public class AttatchToObject : MonoBehaviour
	{
		public Transform parent;

		public bool attatchPos = true;

		public bool attatchRot = true;

		private void Update()
		{
			UpdatePosition();
		}

		private void LateUpdate()
		{
			UpdatePosition();
		}

		public void UpdatePosition()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)parent == (Object)null) && Object.op_Implicit((Object)(object)parent))
			{
				if (attatchPos)
				{
					((Component)this).transform.position = parent.position;
				}
				if (attatchRot)
				{
					((Component)this).transform.rotation = parent.rotation;
				}
			}
		}
	}
	public class ChargeLimiter : MonoBehaviour
	{
		public int charges = 1;

		public InteractTrigger trigger;

		public GameObject disableObject;

		public void Charge()
		{
			charges--;
			if (charges <= 0)
			{
				SetHasCharge(value: false);
			}
		}

		public void SetHasCharge(bool value)
		{
			BoxCollider val = default(BoxCollider);
			if ((Object)(object)trigger != (Object)null && ((Component)trigger).TryGetComponent<BoxCollider>(ref val))
			{
				((Collider)val).enabled = value;
			}
			if ((Object)(object)disableObject != (Object)null)
			{
				disableObject.SetActive(value);
			}
		}

		public void AddCharges(int amount)
		{
			charges += amount;
		}
	}
	public class ClientSeperator : MonoBehaviour
	{
		[Tooltip("Event run for the given client.")]
		public InteractEvent eventsForClient = new InteractEvent();

		[Tooltip("Event run for every client except the given one.")]
		public UnityEvent eventsForEveryoneElse = new UnityEvent();

		public void SeperateClientEvents(PlayerControllerB player)
		{
			if (player.actualClientId == HUDManager.Instance.localPlayer.actualClientId)
			{
				((UnityEvent<PlayerControllerB>)(object)eventsForClient).Invoke(player);
			}
			else
			{
				eventsForEveryoneElse.Invoke();
			}
		}
	}
	public class DamageTrigger : MonoBehaviour
	{
		[Serializable]
		public class DamageTarget<T>
		{
			public bool enabled = false;

			public int damage = 1;

			public bool applyDamageMultiplier = true;

			public bool playCustomSounds = true;

			public UnityEvent<T> hitEvent = new UnityEvent<T>();

			public int GetTotalDamage(float multiplier = 1f)
			{
				if (applyDamageMultiplier)
				{
					return Mathf.RoundToInt((float)damage * multiplier);
				}
				return damage;
			}
		}

		public enum ColliderType
		{
			Unknown = -1,
			Player,
			Enemy,
			Vehicle,
			Object
		}

		public enum PlayerBone
		{
			Base = 6,
			Neck = 0,
			Spine = 5,
			RightArmUpper = 9,
			LeftArmUpper = 10,
			RightArmLower = 1,
			LeftArmLower = 2,
			RightThigh = 7,
			LeftThigh = 8,
			RightShin = 3,
			LeftShin = 4
		}

		[SerializeField]
		public CauseOfDeath damageSource = (CauseOfDeath)0;

		public Vector3 hitDir = Vector3.zero;

		public EnemySpawner.RotationType hitRotation = EnemySpawner.RotationType.ObjectRotation;

		[Tooltip("Check RoundManager in the Ship Scene for corpse IDs\nA negative copseType will result in no corpse spawning.")]
		public int corpseType = 0;

		public Mesh OverrideCorpseMesh;

		public bool attachCorpseToPoint = false;

		public Transform corpseAttachPoint;

		public PlayerBone connectedBone = PlayerBone.Base;

		public bool matchPointExactly = false;

		[Tooltip("Negative number will stay stuck to a point indefinately.")]
		public float corpseStickTime = 2f;

		[Header("NetworkHelper")]
		[Tooltip("This is only required to trigger some network related events.")]
		public DamageTriggerNetworking? DamageTriggerNetworking;

		[Header("Conditions")]
		[Tooltip("Damage when something enters a trigger collider")]
		public bool damageOnEnter = true;

		[Tooltip("Damage when something exits a trigger collider")]
		public bool damageOnExit = false;

		[Tooltip("Damage when something collides with a non trigger collider")]
		public bool damageOnCollision = true;

		[Header("Continuous Damage")]
		[Tooltip("Continuously damages anything inside of it's trigger collider")]
		public bool continuousDamage = true;

		[Tooltip("Continuously calculates a raycast and attempts to damage the whatever the ray hits")]
		public bool continuousRaycastDamage = false;

		public float hitInterval = 0.5f;

		private float timer = 0f;

		[Header("Raycast")]
		public float raycastLength = 6f;

		public Transform[] raycastDirections = (Transform[])(object)new Transform[0];

		public LayerMask raycastMask = LayerMask.op_Implicit(1202194760);

		[Header("Targets")]
		public float damageMultiplier = 1f;

		[Tooltip("Players have 100 HP")]
		public DamageTarget<PlayerControllerB> playerTargets = new DamageTarget<PlayerControllerB>();

		[Tooltip("Any instance of EnemyAICollisionDetect converted to EnemyAI")]
		public DamageTarget<EnemyAI> enemyTargets = new DamageTarget<EnemyAI>();

		[Tooltip("The Company Cruiser has 30 HP")]
		public DamageTarget<VehicleController> vehicleTargets = new DamageTarget<VehicleController>();

		[Tooltip("Anything that is damageable by shovels but not one of the things above")]
		public DamageTarget<IHittable> objectTargets = new DamageTarget<IHittable>();

		[Header("SFX")]
		public bool playNormalDamageSFX = true;

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

		public AudioSource[] sources = (AudioSource[])(object)new AudioSource[0];

		private readonly Dictionary<GameObject, int> collidersInside = new Dictionary<GameObject, int>();

		private readonly List<GameObject> markedForRemoval = new List<GameObject>();

		private readonly List<GameObject> foundInside = new List<GameObject>();

		private void Start()
		{
			if ((Object)(object)DamageTriggerNetworking != (Object)null && (Object)(object)DamageTriggerNetworking.DamageTrigger == (Object)null)
			{
				DamageTriggerNetworking.DamageTrigger = this;
			}
		}

		public void OnTriggerStay(Collider collider)
		{
			foundInside.Add(((Component)collider).gameObject);
			if (collidersInside.ContainsKey(((Component)collider).gameObject))
			{
				return;
			}
			int num = IdentifyCollider(((Component)collider).gameObject);
			if (!IsTargetDead(((Component)collider).gameObject, num))
			{
				collidersInside.Add(((Component)collider).gameObject, num);
				if (damageOnEnter)
				{
					DamageType(((Component)collider).gameObject, num);
				}
			}
		}

		public void FixedUpdate()
		{
			foreach (KeyValuePair<GameObject, int> item in collidersInside)
			{
				if (!foundInside.Contains(item.Key))
				{
					if (damageOnExit)
					{
						DamageType(item.Key, item.Value);
					}
					markedForRemoval.Add(item.Key);
				}
			}
			foundInside.Clear();
		}

		public void OnDisable()
		{
			collidersInside.Clear();
		}

		public void OnCollisionEnter(Collision collision)
		{
			if (damageOnCollision)
			{
				int num = IdentifyCollider(collision.gameObject);
				if (num != -1)
				{
					DamageType(collision.gameObject, num);
				}
			}
		}

		private void OnDrawGizmos()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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)
			if (raycastLength > 0f)
			{
				for (int i = 0; i < raycastDirections.Length; i++)
				{
					Gizmos.color = Color.red;
					Gizmos.DrawRay(((Component)this).transform.position, GetRayDirection(raycastDirections[i]) * raycastLength);
				}
			}
		}

		public void Update()
		{
			for (int i = 0; i < markedForRemoval.Count; i++)
			{
				collidersInside.Remove(markedForRemoval[i]);
			}
			markedForRemoval.Clear();
			if (!continuousDamage && !continuousRaycastDamage)
			{
				return;
			}
			timer -= Time.deltaTime;
			if (timer <= 0f)
			{
				timer = hitInterval;
				if (continuousDamage)
				{
					DamageAllInside();
				}
				if (continuousRaycastDamage)
				{
					DamageRaycast();
				}
			}
		}

		public void DamageAllInside()
		{
			foreach (KeyValuePair<GameObject, int> item in collidersInside)
			{
				DamageType(item.Key, item.Value);
			}
		}

		private void DamageType(GameObject target, int type)
		{
			switch (type)
			{
			case 0:
				if (playerTargets.enabled)
				{
					DamagePlayer(target.GetComponent<PlayerControllerB>());
				}
				break;
			case 1:
				if (enemyTargets.enabled)
				{
					DamageEnemy(target.GetComponent<EnemyAICollisionDetect>().mainScript);
				}
				break;
			case 2:
				if (vehicleTargets.enabled)
				{
					DamageVehicle(target.GetComponent<VehicleController>());
				}
				break;
			case 3:
				if (objectTargets.enabled)
				{
					DamageObject(target.GetComponent<IHittable>());
				}
				break;
			}
		}

		public static bool IsTargetDead(GameObject target, int type)
		{
			if (1 == 0)
			{
			}
			bool result = type switch
			{
				0 => target.GetComponent<PlayerControllerB>().isPlayerDead, 
				1 => target.GetComponent<EnemyAICollisionDetect>().mainScript.isEnemyDead, 
				2 => target.GetComponent<VehicleController>().carDestroyed, 
				_ => false, 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		public void DamageRaycast()
		{
			//IL_0021: 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_003d: Unknown result type (might be due to invalid IL or missing references)
			if (!(raycastLength > 0f))
			{
				return;
			}
			RaycastHit val = default(RaycastHit);
			for (int i = 0; i < raycastDirections.Length; i++)
			{
				if (Physics.Raycast(((Component)this).transform.position, GetRayDirection(raycastDirections[i]), ref val, raycastLength, LayerMask.op_Implicit(raycastMask)))
				{
					int num = IdentifyCollider(((Component)((RaycastHit)(ref val)).collider).gameObject);
					if (num != -1)
					{
						DamageType(((Component)((RaycastHit)(ref val)).collider).gameObject, num);
					}
				}
			}
		}

		private Vector3 GetRayDirection(Transform target)
		{
			//IL_0002: 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_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = target.position - ((Component)this).transform.position;
			return ((Vector3)(ref val)).normalized;
		}

		public static int IdentifyCollider(GameObject target)
		{
			if (target.CompareTag("Player"))
			{
				PlayerControllerB val = default(PlayerControllerB);
				if (target.TryGetComponent<PlayerControllerB>(ref val))
				{
					return 0;
				}
			}
			else if (target.CompareTag("Enemy"))
			{
				EnemyAICollisionDetect val2 = default(EnemyAICollisionDetect);
				if (target.TryGetComponent<EnemyAICollisionDetect>(ref val2))
				{
					return 1;
				}
			}
			else
			{
				VehicleController val3 = default(VehicleController);
				if (target.TryGetComponent<VehicleController>(ref val3))
				{
					return 2;
				}
				IHittable val4 = default(IHittable);
				if (target.TryGetComponent<IHittable>(ref val4))
				{
					return 3;
				}
			}
			return -1;
		}

		private Vector3 CalcHitDir(Transform target)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			EnemySpawner.RotationType rotationType = hitRotation;
			if (1 == 0)
			{
			}
			Vector3 result = (Vector3)(rotationType switch
			{
				EnemySpawner.RotationType.ObjectRotation => Quaternion.AngleAxis(((Component)this).transform.rotation.y, Vector3.up) * hitDir, 
				EnemySpawner.RotationType.RandomRotation => Quaternion.AngleAxis(Random.Range(0f, 360f), Vector3.up) * hitDir, 
				_ => hitDir, 
			});
			if (1 == 0)
			{
			}
			return result;
		}

		public void SetDamageMultiplier(float multiplier)
		{
			damageMultiplier = multiplier;
		}

		public void DamagePlayer(PlayerControllerB player)
		{
			//IL_0036: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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)
			if (player.isPlayerDead)
			{
				markedForRemoval.Add(((Component)player).gameObject);
				return;
			}
			int totalDamage = playerTargets.GetTotalDamage(damageMultiplier);
			CauseOfDeath val = damageSource;
			Vector3 val2 = CalcHitDir(((Component)player).transform);
			player.DamagePlayer(totalDamage, playNormalDamageSFX, true, val, Mathf.Clamp(corpseType, 0, StartOfRound.Instance.playerRagdolls.Count - 1), false, val2);
			playerTargets.hitEvent.Invoke(player);
			if (player.isPlayerDead)
			{
				if ((Object)(object)DamageTriggerNetworking != (Object)null)
				{
					DamageTriggerNetworking.DamageTriggerKilledPlayerServerRpc((int)player.actualClientId);
				}
				else if (corpseType < 0)
				{
					JLLNetworkManager.Instance.DestroyPlayerCorpse(player);
				}
			}
			if (playerTargets.playCustomSounds)
			{
				PlayCustomAudio();
			}
		}

		public void SetPlayerDamage(int damage)
		{
			playerTargets.damage = damage;
		}

		public void DamageEnemy(EnemyAI enemy)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			if (enemy.isEnemyDead)
			{
				markedForRemoval.Add(((Component)enemy).gameObject);
				return;
			}
			enemy.HitEnemyOnLocalClient(enemyTargets.GetTotalDamage(damageMultiplier), CalcHitDir(((Component)enemy).transform), (PlayerControllerB)null, playNormalDamageSFX, -1);
			enemyTargets.hitEvent.Invoke(enemy);
			if ((((NetworkBehaviour)RoundManager.Instance).IsHost || ((NetworkBehaviour)RoundManager.Instance).IsServer) && enemy.isEnemyDead && (Object)(object)DamageTriggerNetworking != (Object)null)
			{
				DamageTriggerNetworking.DamageTriggerKilledServerRpc(1);
			}
			if (enemyTargets.playCustomSounds)
			{
				PlayCustomAudio();
			}
		}

		public void SetEnemyDamage(int damage)
		{
			enemyTargets.damage = damage;
		}

		public void DamageVehicle(VehicleController vehicle)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			if (vehicle.carDestroyed)
			{
				markedForRemoval.Add(((Component)vehicle).gameObject);
				return;
			}
			VehicleControllerPatch.DealPermanentDamage(vehicle, vehicleTargets.GetTotalDamage(damageMultiplier), CalcHitDir(((Component)vehicle).transform));
			vehicleTargets.hitEvent.Invoke(vehicle);
			if (((NetworkBehaviour)vehicle).IsOwner && vehicle.carDestroyed && (Object)(object)DamageTriggerNetworking != (Object)null)
			{
				DamageTriggerNetworking.DamageTriggerKilledServerRpc(2);
			}
			if (vehicleTargets.playCustomSounds)
			{
				PlayCustomAudio();
			}
		}

		public void SetVehicleDamage(int damage)
		{
			vehicleTargets.damage = damage;
		}

		public void DamageObject(IHittable obj)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			int totalDamage = objectTargets.GetTotalDamage(damageMultiplier);
			MonoBehaviour val = (MonoBehaviour)(object)((obj is MonoBehaviour) ? obj : null);
			obj.Hit(totalDamage, CalcHitDir((val != null) ? ((Component)val).transform : ((Component)this).transform), (PlayerControllerB)null, playNormalDamageSFX, -1);
			objectTargets.hitEvent.Invoke(obj);
			if (objectTargets.playCustomSounds)
			{
				PlayCustomAudio();
			}
		}

		public void SetObjectDamage(int damage)
		{
			objectTargets.damage = damage;
		}

		private void PlayCustomAudio()
		{
			if (clips.Length != 0 && sources.Length != 0)
			{
				AudioClip clip = clips[Random.Range(0, clips.Length)];
				AudioSource[] array = sources;
				foreach (AudioSource val in array)
				{
					val.clip = clip;
					val.Play();
				}
			}
		}
	}
	public class DamageTriggerNetworking : NetworkBehaviour
	{
		private class PlayerCorpse
		{
			public PlayerControllerB player;

			public float startTime;

			public float stickTime = 0f;

			private bool stuck = false;

			public bool Update(DamageTrigger trigger)
			{
				if ((Object)(object)player.deadBody != (Object)null)
				{
					if (trigger.corpseType < 0)
					{
						Object.Destroy((Object)(object)((Component)player.deadBody).gameObject);
						player.deadBody = null;
						return false;
					}
					if (!(stickTime > 0f))
					{
						if ((Object)(object)trigger.OverrideCorpseMesh != (Object)null)
						{
							player.deadBody.ChangeMesh(trigger.OverrideCorpseMesh, (Material)null);
						}
						return false;
					}
					if (stuck)
					{
						stickTime -= Time.deltaTime;
					}
					else if (trigger.attachCorpseToPoint && (Object)(object)trigger.corpseAttachPoint != (Object)null)
					{
						JLogHelper.LogInfo("Attatching " + player.playerUsername + "'s corpse to " + ((Object)trigger.corpseAttachPoint).name);
						player.deadBody.matchPositionExactly = trigger.matchPointExactly;
						player.deadBody.attachedTo = trigger.corpseAttachPoint;
						player.deadBody.attachedLimb = player.deadBody.bodyParts[(int)trigger.connectedBone];
						stuck = true;
					}
					if (stickTime <= 0f)
					{
						JLogHelper.LogInfo("Releasing " + player.playerUsername + "'s corpse");
						player.deadBody.matchPositionExactly = false;
						player.deadBody.attachedTo = null;
						player.deadBody.attachedLimb = null;
						stuck = false;
					}
				}
				else if (Time.realtimeSinceStartup - startTime > 2f)
				{
					JLogHelper.LogInfo("Player Corpse could not be found after two seconds!");
					return false;
				}
				return true;
			}
		}

		public DamageTrigger DamageTrigger;

		public UnityEvent PlayerKilled = new UnityEvent();

		public UnityEvent EnemyKilled = new UnityEvent();

		public UnityEvent VehicleKilled = new UnityEvent();

		private readonly List<PlayerCorpse> playerCorpses = new List<PlayerCorpse>();

		private readonly List<PlayerCorpse> removeCorpses = new List<PlayerCorpse>();

		private void Update()
		{
			if ((Object)(object)DamageTrigger == (Object)null || playerCorpses.Count <= 0)
			{
				return;
			}
			for (int i = 0; i < playerCorpses.Count; i++)
			{
				if (!playerCorpses[i].Update(DamageTrigger))
				{
					removeCorpses.Add(playerCorpses[i]);
				}
			}
			for (int j = 0; j < removeCorpses.Count; j++)
			{
				playerCorpses.Remove(removeCorpses[j]);
			}
			removeCorpses.Clear();
		}

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

		[ServerRpc(RequireOwnership = true)]
		public void DamageTriggerKilledServerRpc(int type)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3711696475u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, type);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3711696475u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				DamageTriggerKilledClientRpc(type);
			}
		}

		[ClientRpc]
		private void DamageTriggerKilledClientRpc(int type, int playerTarget = -1)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3159405848u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, type);
				BytePacker.WriteValueBitPacked(val2, playerTarget);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3159405848u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			if ((Object)(object)DamageTrigger != (Object)null)
			{
				switch (type)
				{
				case 0:
					if (playerTarget >= 0 && playerTarget < RoundManager.Instance.playersManager.allPlayerScripts.Length && RoundManager.Instance.playersManager.allPlayerScripts[playerTarget].isPlayerDead)
					{
						playerCorpses.Add(new PlayerCorpse
						{
							player = StartOfRound.Instance.allPlayerScripts[playerTarget],
							startTime = Time.realtimeSinceStartup,
							stickTime = DamageTrigger.corpseStickTime
						});
						PlayerKilled.Invoke();
					}
					break;
				case 1:
					EnemyKilled.Invoke();
					break;
				case 2:
					VehicleKilled.Invoke();
					break;
				}
			}
			else
			{
				JLogHelper.LogWarning(((Object)this).name + " DamageTriggerNetworking is missing a linked DamageTrigger!");
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_DamageTriggerNetworking()
		{
			//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
			NetworkManager.__rpc_func_table.Add(1067576157u, new RpcReceiveHandler(__rpc_handler_1067576157));
			NetworkManager.__rpc_func_table.Add(3711696475u, new RpcReceiveHandler(__rpc_handler_3711696475));
			NetworkManager.__rpc_func_table.Add(3159405848u, new RpcReceiveHandler(__rpc_handler_3159405848));
		}

		private static void __rpc_handler_1067576157(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 playerTarget = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerTarget);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DamageTriggerNetworking)(object)target).DamageTriggerKilledPlayerServerRpc(playerTarget);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3711696475(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				int type = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref type);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DamageTriggerNetworking)(object)target).DamageTriggerKilledServerRpc(type);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		protected internal override string __getTypeName()
		{
			return "DamageTriggerNetworking";
		}
	}
	public class DamageZoneTrigger : MonoBehaviour
	{
		[Header("-=-DEPRICATED-=-")]
		[SerializeField]
		public CauseOfDeath damageSource = (CauseOfDeath)0;

		public Vector3 hitDir = Vector3.zero;

		public int corpseType = 0;

		[Header("Conditions")]
		public bool damageOnEnter = true;

		public bool damageOnExit = false;

		public bool damageOnCollision = true;

		[Header("Damage")]
		public bool damagePlayers = true;

		public int damageForPlayers = 1;

		public bool damageEnemies = true;

		public int damageForEnemies = 1;

		public bool damageVehicles = false;

		public int damageForVehicles = 1;

		public bool damageObjects = false;

		public int damageForObjects = 1;

		[Header("Continuous Damage")]
		public bool continuousDamage = true;

		public float hitInterval = 0.5f;

		private float timer = 0f;

		[Header("SFX")]
		public bool playNormalDamageSFX = true;

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

		public AudioSource[] sources = (AudioSource[])(object)new AudioSource[0];

		[Header("Player")]
		public InteractEvent OnPlayerDamaged = new InteractEvent();

		private List<PlayerControllerB> playersInside = new List<PlayerControllerB>();

		private List<EnemyAI> creaturesInside = new List<EnemyAI>();

		private List<VehicleController> vehiclesInside = new List<VehicleController>();

		private List<IHittable> objectsInside = new List<IHittable>();

		public void OnTriggerEnter(Collider collider)
		{
			switch (DamageTarget(((Component)collider).gameObject, damageOnEnter))
			{
			case 0:
				playersInside.Add(((Component)collider).GetComponent<PlayerControllerB>());
				break;
			case 1:
				creaturesInside.Add(((Component)collider).GetComponent<EnemyAICollisionDetect>().mainScript);
				break;
			case 2:
				vehiclesInside.Add(((Component)collider).GetComponent<VehicleController>());
				break;
			case 3:
				objectsInside.Add(((Component)collider).GetComponent<IHittable>());
				break;
			}
		}

		public void OnTriggerExit(Collider collider)
		{
			switch (DamageTarget(((Component)collider).gameObject, damageOnExit))
			{
			case 0:
				playersInside.Remove(((Component)collider).GetComponent<PlayerControllerB>());
				break;
			case 1:
				creaturesInside.Remove(((Component)collider).GetComponent<EnemyAICollisionDetect>().mainScript);
				break;
			case 2:
				vehiclesInside.Remove(((Component)collider).GetComponent<VehicleController>());
				break;
			case 3:
				objectsInside.Remove(((Component)collider).GetComponent<IHittable>());
				break;
			}
		}

		public void OnCollisionEnter(Collision collision)
		{
			DamageTarget(collision.gameObject, damageOnCollision);
		}

		public void Update()
		{
			if (continuousDamage)
			{
				timer -= Time.deltaTime;
				if (timer <= 0f)
				{
					timer = hitInterval;
					DamageAllInside();
				}
			}
		}

		public void DamageAllInside()
		{
			if (damagePlayers)
			{
				for (int i = 0; i < playersInside.Count; i++)
				{
					if (!playersInside[i].isPlayerDead)
					{
						DamagePlayer(playersInside[i]);
					}
				}
			}
			if (damageEnemies)
			{
				for (int j = 0; j < creaturesInside.Count; j++)
				{
					if (!creaturesInside[j].isEnemyDead)
					{
						DamageEnemy(creaturesInside[j]);
					}
				}
			}
			if (damageVehicles)
			{
				for (int k = 0; k < vehiclesInside.Count; k++)
				{
					DamageVehicle(vehiclesInside[k]);
				}
			}
			if (damageObjects)
			{
				for (int l = 0; l < objectsInside.Count; l++)
				{
					DamageObject(objectsInside[l]);
				}
			}
		}

		private int DamageTarget(GameObject target, bool condition = true)
		{
			if (target.CompareTag("Player"))
			{
				PlayerControllerB val = default(PlayerControllerB);
				if (target.TryGetComponent<PlayerControllerB>(ref val))
				{
					if (condition && damagePlayers && !val.isPlayerDead)
					{
						DamagePlayer(val);
					}
					return 0;
				}
			}
			else if (target.CompareTag("Enemy"))
			{
				EnemyAICollisionDetect val2 = default(EnemyAICollisionDetect);
				if (target.TryGetComponent<EnemyAICollisionDetect>(ref val2))
				{
					if (condition && damageEnemies && !val2.mainScript.isEnemyDead)
					{
						DamageEnemy(val2.mainScript);
					}
					return 1;
				}
			}
			else
			{
				VehicleController val3 = default(VehicleController);
				if (target.TryGetComponent<VehicleController>(ref val3))
				{
					if (condition && damageVehicles && !val3.carDestroyed)
					{
						DamageVehicle(val3);
					}
					return 2;
				}
				IHittable obj = default(IHittable);
				if (target.TryGetComponent<IHittable>(ref obj))
				{
					if (condition && damageObjects)
					{
						DamageObject(obj);
					}
					return 3;
				}
			}
			return -1;
		}

		public void DamagePlayer(PlayerControllerB player, bool playCustomAudio = true)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			int num = damageForPlayers;
			CauseOfDeath val = damageSource;
			Vector3 val2 = hitDir;
			player.DamagePlayer(num, playNormalDamageSFX, true, val, Mathf.Clamp(corpseType, 0, StartOfRound.Instance.playerRagdolls.Count), false, val2);
			if (playCustomAudio)
			{
				PlayCustomAudio();
			}
			((UnityEvent<PlayerControllerB>)(object)OnPlayerDamaged).Invoke(player);
		}

		public void DamageEnemy(EnemyAI enemy, bool playCustomAudio = true)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			enemy.HitEnemyOnLocalClient(damageForEnemies, hitDir, (PlayerControllerB)null, playNormalDamageSFX, -1);
			if (playCustomAudio)
			{
				PlayCustomAudio();
			}
		}

		public void DamageVehicle(VehicleController vehicle, bool playCustomAudio = true)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			VehicleControllerPatch.DealPermanentDamage(vehicle, damageForVehicles, hitDir);
			if (playCustomAudio)
			{
				PlayCustomAudio();
			}
		}

		public void DamageObject(IHittable obj, bool playCustomAudio = true)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			obj.Hit(damageForObjects, hitDir, (PlayerControllerB)null, playNormalDamageSFX, -1);
			if (playCustomAudio)
			{
				PlayCustomAudio();
			}
		}

		private void PlayCustomAudio()
		{
			if (clips.Length != 0 && sources.Length != 0)
			{
				AudioClip clip = clips[Random.Range(0, clips.Length)];
				AudioSource[] array = sources;
				foreach (AudioSource val in array)
				{
					val.clip = clip;
					val.Play();
				}
			}
		}
	}
	[RequireComponent(typeof(Animator))]
	public class DayCycleAnimator : MonoBehaviour
	{
		private Animator anim;

		[Tooltip("Scale of time the animation synced to the day progression will use. A value of 1 plays the animation from beginning to end once. Numbers larger than 1 requires the animation to have looping enabled otherwise it will stop on the final frame.")]
		[FormerlySerializedAs("timeScale")]
		public float fixedAnimEndTime = 1f;

		public void Start()
		{
			anim = ((Component)this).GetComponent<Animator>();
		}

		public void FixedUpdate()
		{
			float num = Mathf.Max(0f, TimeOfDay.Instance.currentDayTime - 100f);
			float num2 = num / TimeOfDay.Instance.totalTime;
			anim.SetFloat("time", num2 * fixedAnimEndTime);
		}
	}
	public class DelayScript : MonoBehaviour
	{
		public class QueuedEvent
		{
			public PlayerControllerB? target = null;

			public float timer;
		}

		[FormerlySerializedAs("waitOnAwake")]
		public bool waitOnEnabled = false;

		public bool clearOnDisable = false;

		public float delaySeconds = 2f;

		[Tooltip("Event run after StartWaiting() is called by another event.")]
		public UnityEvent events = new UnityEvent();

		[Tooltip("Only gets triggered if a player is given on the StartWaiting() call.")]
		public InteractEvent playerEvents = new InteractEvent();

		private readonly List<QueuedEvent> queuedEvents = new List<QueuedEvent>();

		private readonly List<QueuedEvent> expiredEvents = new List<QueuedEvent>();

		public void OnEnable()
		{
			if (waitOnEnabled)
			{
				StartWaiting();
			}
		}

		public void OnDisable()
		{
			if (clearOnDisable)
			{
				ClearEventQueue();
			}
		}

		public void Update()
		{
			for (int i = 0; i < queuedEvents.Count; i++)
			{
				queuedEvents[i].timer -= Time.deltaTime;
				if (queuedEvents[i].timer <= 0f)
				{
					expiredEvents.Add(queuedEvents[i]);
				}
			}
			if (expiredEvents.Count <= 0)
			{
				return;
			}
			for (int j = 0; j < expiredEvents.Count; j++)
			{
				events.Invoke();
				if ((Object)(object)expiredEvents[j].target != (Object)null)
				{
					((UnityEvent<PlayerControllerB>)(object)playerEvents).Invoke(expiredEvents[j].target);
				}
				queuedEvents.Remove(expiredEvents[j]);
			}
			expiredEvents.Clear();
		}

		public void StartWaiting(PlayerControllerB player)
		{
			queuedEvents.Add(new QueuedEvent
			{
				timer = delaySeconds,
				target = player
			});
		}

		public void StartWaiting()
		{
			JLogHelper.LogInfo($"{((Object)this).name} started waiting {delaySeconds}");
			queuedEvents.Add(new QueuedEvent
			{
				timer = delaySeconds
			});
		}

		public void ClearEventQueue()
		{
			queuedEvents.Clear();
		}
	}
	public class EnemySpawner : MonoBehaviour
	{
		[Serializable]
		public enum RotationType
		{
			ObjectRotation,
			RandomRotation,
			NoRotation
		}

		[Tooltip("Determines weather to spawn a random enemy from the pool or to spawn the specified type")]
		public bool spawnRandom = false;

		public RotationType spawnRotation = RotationType.ObjectRotation;

		public List<SpawnableEnemyWithRarity> randomPool = new List<SpawnableEnemyWithRarity>();

		public EnemyType type;

		[Tooltip("Ran after an enemy spawns. Enemy provided is the one that was just spawned.")]
		public EnemyEvent SpawnedEvent = new EnemyEvent();

		[Header("NavMesh")]
		[Tooltip("The max distance from this transform that a navmesh will be found")]
		public float navMeshRange = 10f;

		[Header("Misc")]
		[FormerlySerializedAs("spawnOnAwake")]
		public bool spawnOnEnable = false;

		public bool checkRegistry = true;

		public static float GetRot(RotationType rotation, Transform refrence)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (1 == 0)
			{
			}
			float result = rotation switch
			{
				RotationType.ObjectRotation => refrence.rotation.y, 
				RotationType.RandomRotation => Random.Range(0f, 360f), 
				_ => 0f, 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		public void Awake()
		{
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Expected O, but got Unknown
			if (!checkRegistry)
			{
				return;
			}
			if ((Object)(object)type != (Object)null)
			{
				type = JLevelPropertyRegistry.GetRegisteredEnemy(type);
			}
			if (randomPool.Count > 0)
			{
				for (int i = 0; i < randomPool.Count; i++)
				{
					if ((Object)(object)randomPool[i].enemyType != (Object)null)
					{
						randomPool[i].enemyType = JLevelPropertyRegistry.GetRegisteredEnemy(randomPool[i].enemyType);
					}
					else
					{
						JLogHelper.LogWarning($"({((Object)this).name}) Enemy spawner is missing enemy at {i}", JLogLevel.Debuging);
					}
				}
			}
			else
			{
				for (int j = 0; j < JLevelPropertyRegistry.AllSortedEnemies.Count; j++)
				{
					SpawnableEnemyWithRarity item = new SpawnableEnemyWithRarity
					{
						enemyType = JLevelPropertyRegistry.AllSortedEnemies[j],
						rarity = 10
					};
					randomPool.Add(item);
				}
			}
			checkRegistry = false;
		}

		public void OnEnable()
		{
			if (spawnOnEnable)
			{
				((MonoBehaviour)this).StartCoroutine(SpawnNextFixedUpdate());
			}
		}

		private IEnumerator SpawnNextFixedUpdate()
		{
			yield return (object)new WaitForFixedUpdate();
			SpawnEnemy();
		}

		public void SpawnEnemy()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			SpawnEnemy(((Component)this).transform.position);
		}

		public void SpawnEnemy(GameObject target)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			SpawnEnemy(target.transform.position);
		}

		public void SpawnEnemy(MonoBehaviour target)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			SpawnEnemy(((Component)target).transform.position);
		}

		public void SpawnEnemy(Vector3 pos)
		{
			//IL_0096: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			if (!((NetworkBehaviour)RoundManager.Instance).IsHost && !((NetworkBehaviour)RoundManager.Instance).IsServer)
			{
				return;
			}
			EnemyType enemyType;
			if (spawnRandom)
			{
				int weightedIndex = GetWeightedIndex();
				JLogHelper.LogInfo($"({((Object)this).name}) Attempting to spawn enemy at index {weightedIndex}");
				enemyType = randomPool[weightedIndex].enemyType;
			}
			else
			{
				enemyType = type;
			}
			if ((Object)(object)enemyType != (Object)null)
			{
				if (!((Object)(object)enemyType.enemyPrefab != (Object)null))
				{
					return;
				}
				bool flag;
				NavMeshHit val = default(NavMeshHit);
				if ((flag = NavMesh.SamplePosition(pos, ref val, navMeshRange, -1)) || navMeshRange < 0f)
				{
					JLogHelper.LogInfo($"({((Object)this).name}) Spawning: {enemyType.enemyName} at {pos}");
					GameObject val2 = NetworkObjectReference.op_Implicit(RoundManager.Instance.SpawnEnemyGameObject(flag ? ((NavMeshHit)(ref val)).position : pos, GetRot(spawnRotation, ((Component)this).transform), 0, enemyType));
					EnemyAI val3 = default(EnemyAI);
					if (val2.TryGetComponent<EnemyAI>(ref val3))
					{
						((UnityEvent<EnemyAI>)(object)SpawnedEvent).Invoke(val3);
					}
				}
				else
				{
					JLogHelper.LogInfo("(" + ((Object)this).name + ") Failed to spawn. (Couldn't Find NavMesh. If try increasing the EnemySpawner's navMeshDistance if you're having an issue.)");
				}
			}
			else
			{
				JLogHelper.LogWarning("(" + ((Object)this).name + ") Enemy Spawner tried to spawn a null EnemyType!");
			}
		}

		private int GetWeightedIndex()
		{
			int num = 0;
			for (int i = 0; i < randomPool.Count; i++)
			{
				num += randomPool[i].rarity;
			}
			int num2 = Random.Range(0, num);
			for (int j = 0; j < randomPool.Count; j++)
			{
				num2 -= randomPool[j].rarity;
				if (num2 <= 0)
				{
					return j;
				}
			}
			return Random.Range(0, randomPool.Count);
		}
	}
	public class EventLimiter : MonoBehaviour
	{
		public int maxTriggers = 1;

		public UnityEvent Event = new UnityEvent();

		public InteractEvent PlayerEvent = new InteractEvent();

		public void Trigger()
		{
			Trigger(null);
		}

		public void Trigger(PlayerControllerB? player)
		{
			if (maxTriggers > 0)
			{
				maxTriggers--;
				Event.Invoke();
				if ((Object)(object)player != (Object)null)
				{
					((UnityEvent<PlayerControllerB>)(object)PlayerEvent).Invoke(player);
				}
			}
		}
	}
	public class ExplosiveEmitter : MonoBehaviour
	{
		[Header("Explosion Size")]
		[FormerlySerializedAs("explodeOnAwake")]
		public bool explodeOnEnabled = false;

		public float killDistance = 5.7f;

		public float damageRange = 6f;

		[Header("Damage Properties")]
		public int nonLethalDamage = 50;

		public float pushForce = 0f;

		public bool goThroughCar = false;

		public GameObject? overrideEffect = null;

		public bool spawnParticles = true;

		[Header("Screen Shake Emmision")]
		[FormerlySerializedAs("shakeOnAwake")]
		public bool shakeOnEnabled = false;

		[Tooltip("Bridge Destroyed Default: 30")]
		public float strongDistance = -1f;

		[Tooltip("Bridge Destroyed Default: 50")]
		public float longDistance = -1f;

		[Tooltip("Landmine Default: 14")]
		public float bigDistance = 14f;

		[Tooltip("Landmine Default = 25")]
		public float smallDistance = 25f;

		[Header("Stun Explosion")]
		[FormerlySerializedAs("stunOnAwake")]
		public bool stunOnEnabled = false;

		public bool affectAudio = true;

		public float flashSeverityMultiplier = 1f;

		public float enemyStunTime = 7.5f;

		public float flashSeverityDistanceRolloff = 1f;

		public void OnEnabled()
		{
			if (explodeOnEnabled)
			{
				Explode();
			}
			if (shakeOnEnabled)
			{
				DistanceShakeScreen();
			}
			if (stunOnEnabled)
			{
				StunFlash();
			}
		}

		public void Explode()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			Explode(((Component)this).transform.position);
		}

		public void Explode(MonoBehaviour target)
		{
			Explode(((Component)target).gameObject);
		}

		public void Explode(GameObject target)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			Explode(target.transform.position);
		}

		public void Explode(Vector3 position)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			Landmine.SpawnExplosion(position, spawnParticles, killDistance, damageRange, nonLethalDamage, pushForce, overrideEffect, goThroughCar);
		}

		private void OnDrawGizmosSelected()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			if (killDistance > 0f)
			{
				Gizmos.color = Color.red;
				Gizmos.DrawWireSphere(((Component)this).transform.position, killDistance);
			}
			if (damageRange > 0f)
			{
				Gizmos.color = Color.yellow;
				Gizmos.DrawWireSphere(((Component)this).transform.position, damageRange);
			}
			if (strongDistance > 0f)
			{
				Gizmos.color = Color.black;
				Gizmos.DrawWireSphere(((Component)this).transform.position, strongDistance);
			}
			if (longDistance > 0f)
			{
				Gizmos.color = Color.Lerp(Color.black, Color.gray, 0.5f);
				Gizmos.DrawWireSphere(((Component)this).transform.position, longDistance);
			}
			if (bigDistance > 0f)
			{
				Gizmos.color = Color.gray;
				Gizmos.DrawWireSphere(((Component)this).transform.position, bigDistance);
			}
			if (smallDistance > 0f)
			{
				Gizmos.color = Color.Lerp(Color.gray, Color.white, 0.5f);
				Gizmos.DrawWireSphere(((Component)this).transform.position, smallDistance);
			}
		}

		private float GetLocalPlayerDistance()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			return Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)this).transform.position);
		}

		public void DistanceShakeScreen()
		{
			float localPlayerDistance = GetLocalPlayerDistance();
			if (strongDistance > 0f && localPlayerDistance < strongDistance)
			{
				HUDManager.Instance.ShakeCamera((ScreenShakeType)3);
			}
			else if (longDistance > 0f && localPlayerDistance < longDistance)
			{
				HUDManager.Instance.ShakeCamera((ScreenShakeType)2);
			}
			else if (bigDistance > 0f && localPlayerDistance < bigDistance)
			{
				HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
			}
			else if (smallDistance > 0f && localPlayerDistance < smallDistance)
			{
				HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
			}
		}

		public void ShakeLocalClient(int intensity)
		{
			if (Enum.IsDefined(typeof(ScreenShakeType), intensity))
			{
				HUDManager.Instance.ShakeCamera((ScreenShakeType)intensity);
			}
		}

		public void StunFlash()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			StunFlash(((Component)this).transform.position);
		}

		public void StunFlash(MonoBehaviour target)
		{
			StunFlash(((Component)target).gameObject);
		}

		public void StunFlash(GameObject target)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			StunFlash(target.transform.position);
		}

		public void StunFlash(Vector3 position)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			StunGrenadeItem.StunExplosion(position, affectAudio, flashSeverityMultiplier, enemyStunTime, flashSeverityDistanceRolloff, false, (PlayerControllerB)null, (PlayerControllerB)null, 0f);
		}
	}
	public class ExtendedLevelLocker : MonoBehaviour
	{
		public string sceneName;

		[Header("OnTriggerEnter")]
		public bool isTriggerActivated = false;

		public bool shouldUnlock = true;

		public void SetLevelLocked(bool locked)
		{
			if (JCompatabilityHelper.IsModLoaded.LLL)
			{
				LLLHelper.LockExtendedLevel(sceneName, locked);
			}
		}

		public void SetLevelHidden(bool hidden)
		{
			if (JCompatabilityHelper.IsModLoaded.LLL)
			{
				LLLHelper.HideExtendedLevel(sceneName, hidden);
			}
		}

		public void LockLevel(string sceneName)
		{
			if (JCompatabilityHelper.IsModLoaded.LLL)
			{
				LLLHelper.LockExtendedLevel(sceneName, shouldUnlock);
			}
		}

		public void HideLevel(string sceneName)
		{
			if (JCompatabilityHelper.IsModLoaded.LLL)
			{
				LLLHelper.HideExtendedLevel(sceneName, shouldUnlock);
			}
		}

		public void OnTriggerEnter(Collider other)
		{
			if (isTriggerActivated && ((Component)other).CompareTag("Player"))
			{
				SetLevelLocked(!shouldUnlock);
			}
		}
	}
	public class InventoryRemover : MonoBehaviour
	{
		public string[] itemsToRemove;

		public ItemFilter.Properties[] removeByFilter = new ItemFilter.Properties[0];

		public bool removeAllInstances = false;

		public void RemoveItems(PlayerControllerB player)
		{
			for (int i = 0; i < player.ItemSlots.Length && ((Object)(object)player.ItemSlots[i] == (Object)null || !CheckSlot(player, i) || removeAllInstances); i++)
			{
			}
		}

		public void ClearInventory(PlayerControllerB player)
		{
			for (int i = 0; i < player.ItemSlots.Length; i++)
			{
				if (!((Object)(object)player.ItemSlots[i] == (Object)null))
				{
					player.DestroyItemInSlotAndSync(i);
				}
			}
		}

		public void RemoveHeld(PlayerControllerB player)
		{
			if ((Object)(object)player.currentlyHeldObjectServer != (Object)null)
			{
				CheckSlot(player, player.currentItemSlot);
			}
		}

		private bool CheckSlot(PlayerControllerB player, int slot)
		{
			for (int i = 0; i < itemsToRemove.Length; i++)
			{
				if (player.ItemSlots[slot].itemProperties.itemName.ToLower() == itemsToRemove[i].ToLower())
				{
					player.DestroyItemInSlotAndSync(slot);
					return true;
				}
			}
			for (int j = 0; j < removeByFilter.Length; j++)
			{
				if (removeByFilter[j].Check(player.ItemSlots[slot]))
				{
					player.DestroyItemInSlotAndSync(slot);
					return true;
				}
			}
			return false;
		}
	}
	public class ItemConsumer : NetworkBehaviour
	{
		public Item[] validItems = (Item[])(object)new Item[0];

		public bool checkExact = false;

		public ItemFilter.Properties[] validItemFilters = new ItemFilter.Properties[0];

		public InteractEvent OnSuccess = new InteractEvent();

		public bool runEventOnAllClients = true;

		public void CheckHeldItem(PlayerControllerB player)
		{
			CheckItemServerRpc((int)player.actualClientId);
		}

		[ServerRpc(RequireOwnership = false)]
		private void CheckItemServerRpc(int playerWhoSent)
		{
			//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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2913302232u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerWhoSent);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2913302232u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			PlayerControllerB val3 = RoundManager.Instance.playersManager.allPlayerScripts[playerWhoSent];
			if ((Object)(object)val3.currentlyHeldObjectServer == (Object)null)
			{
				return;
			}
			GrabbableObject currentlyHeldObjectServer = val3.currentlyHeldObjectServer;
			int num = 0;
			while (true)
			{
				if (num < validItems.Length)
				{
					if (checkExact ? ((Object)(object)currentlyHeldObjectServer.itemProperties == (Object)(object)validItems[num]) : (currentlyHeldObjectServer.itemProperties.itemName == validItems[num].itemName))
					{
						break;
					}
					num++;
					continue;
				}
				int num2 = 0;
				while (true)
				{
					if (num2 < validItemFilters.Length)
					{
						if (validItemFilters[num2].Check(currentlyHeldObjectServer))
						{
							break;
						}
						num2++;
						continue;
					}
					return;
				}
				break;
			}
			RemoveItemFromClientRpc(playerWhoSent);
		}

		[ClientRpc]
		private void RemoveItemFromClientRpc(int playerWhoSent)
		{
			//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)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2753840628u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerWhoSent);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2753840628u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				PlayerControllerB val3 = RoundManager.Instance.playersManager.allPlayerScripts[playerWhoSent];
				if (((NetworkBehaviour)val3).IsOwner)
				{
					val3.DestroyItemInSlotAndSync(val3.currentItemSlot);
				}
				if (runEventOnAllClients || ((NetworkBehaviour)val3).IsOwner)
				{
					((UnityEvent<PlayerControllerB>)(object)OnSuccess).Invoke(val3);
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_ItemConsumer()
		{
			//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(2913302232u, new RpcReceiveHandler(__rpc_handler_2913302232));
			NetworkManager.__rpc_func_table.Add(2753840628u, new RpcReceiveHandler(__rpc_handler_2753840628));
		}

		private static void __rpc_handler_2913302232(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 playerWhoSent = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerWhoSent);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ItemConsumer)(object)target).CheckItemServerRpc(playerWhoSent);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2753840628(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 playerWhoSent = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerWhoSent);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ItemConsumer)(object)target).RemoveItemFromClientRpc(playerWhoSent);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "ItemConsumer";
		}
	}
	public class ItemSpawner : MonoBehaviour
	{
		[Serializable]
		public class WeightedItemRefrence : IWeightedItem
		{
			[Range(0f, 100f)]
			public int Weight = 20;

			public Item Item;

			public bool FindRegisteredItem = true;

			public bool OverrideValue = false;

			public int ScrapValue = 0;

			public Vector3 SpawnOffset = Vector3.zero;

			public int GetWeight()
			{
				return Weight;
			}

			public void FindRegistered()
			{
				if (!FindRegisteredItem || !((Object)(object)Item != (Object)null))
				{
					return;
				}
				foreach (Item items in RoundManager.Instance.playersManager.allItemsList.itemsList)
				{
					if (Item.itemName == items.itemName)
					{
						Item = items;
						break;
					}
				}
			}
		}

		[Serializable]
		public enum SpawnPoolSource
		{
			CustomList,
			AllItems,
			LevelItems,
			StoreItems
		}

		[FormerlySerializedAs("spawnOnAwake")]
		public bool spawnOnEnabled = true;

		public EnemySpawner.RotationType spawnRotation = EnemySpawner.RotationType.NoRotation;

		public SpawnPoolSource SourcePool = SpawnPoolSource.CustomList;

		public WeightedItemRefrence[] CustomList = new WeightedItemRefrence[1]
		{
			new WeightedItemRefrence()
		};

		private bool checkRegistry = true;

		public void Awake()
		{
			if (checkRegistry)
			{
				WeightedItemRefrence[] customList = CustomList;
				foreach (WeightedItemRefrence weightedItemRefrence in customList)
				{
					weightedItemRefrence.FindRegistered();
				}
				checkRegistry = false;
			}
		}

		public void OnEnable()
		{
			if (spawnOnEnabled)
			{
				SpawnRandom();
			}
		}

		public static Item? GetRandomItem(SpawnPoolSource source, out int overrideValue, out Vector3 offset, WeightedItemRefrence[]? weightedItems = null)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: 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)
			Item result = null;
			overrideValue = -1;
			offset = Vector3.zero;
			switch (source)
			{
			case SpawnPoolSource.CustomList:
				if (weightedItems != null && weightedItems.Length != 0)
				{
					IWeightedItem[] weightedItems2 = weightedItems;
					WeightedItemRefrence weightedItemRefrence = weightedItems[IWeightedItem.GetRandomIndex(weightedItems2)];
					result = weightedItemRefrence.Item;
					if (weightedItemRefrence.OverrideValue)
					{
						overrideValue = weightedItemRefrence.ScrapValue;
					}
					offset = weightedItemRefrence.SpawnOffset;
				}
				break;
			case SpawnPoolSource.AllItems:
				result = StartOfRound.Instance.allItemsList.itemsList[Random.Range(0, StartOfRound.Instance.allItemsList.itemsList.Count)];
				break;
			case SpawnPoolSource.LevelItems:
			{
				List<WeightedItemRefrence> list = new List<WeightedItemRefrence>();
				foreach (SpawnableItemWithRarity item in RoundManager.Instance.currentLevel.spawnableScrap)
				{
					list.Add(new WeightedItemRefrence
					{
						Item = item.spawnableItem,
						Weight = item.rarity
					});
				}
				IWeightedItem[] weightedItems2 = list.ToArray();
				result = list[IWeightedItem.GetRandomIndex(weightedItems2)].Item;
				break;
			}
			case SpawnPoolSource.StoreItems:
			{
				Terminal terminal = JLevelPropertyRegistry.GetTerminal();
				if ((Object)(object)terminal != (Object)null)
				{
					result = terminal.buyableItemsList[Random.Range(0, terminal.buyableItemsList.Length)];
				}
				break;
			}
			}
			return result;
		}

		public void SpawnRandom(int count = 1)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			SpawnRandomItems(SourcePool, ((Component)this).transform.position, RoundManager.Instance.spawnedScrapContainer, CustomList, null, count, spawnOnNetwork: true, spawnRotation);
		}

		public void SpawnRandom(MonoBehaviour target)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			SpawnRandom(((Component)target).transform.position);
		}

		public void SpawnRandom(GameObject target)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			SpawnRandom(target.transform.position);
		}

		public void SpawnRandom(Vector3 pos)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			SpawnRandomItems(SourcePool, pos, RoundManager.Instance.spawnedScrapContainer, CustomList, null, 1, spawnOnNetwork: true, spawnRotation);
		}

		public static List<KeyValuePair<GrabbableObject, int>> SpawnRandomItems(SpawnPoolSource sourcePool, Vector3 position, Transform parent, WeightedItemRefrence[]? customList = null, Vector3[]? offsets = null, int count = 1, bool spawnOnNetwork = true, EnemySpawner.RotationType rotation = EnemySpawner.RotationType.NoRotation)
		{
			//IL_0093: 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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: 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_008f: Unknown result type (might be due to invalid IL or missing references)
			List<KeyValuePair<GrabbableObject, int>> list = new List<KeyValuePair<GrabbableObject, int>>();
			if (((NetworkBehaviour)RoundManager.Instance).IsServer || ((NetworkBehaviour)RoundManager.Instance).IsHost)
			{
				if (customList == null)
				{
					customList = new WeightedItemRefrence[0];
				}
				if (offsets == null)
				{
					offsets = (Vector3[]?)(object)new Vector3[0];
				}
				for (int i = 0; i < count; i++)
				{
					int overrideValue;
					Vector3 offset;
					Item randomItem = GetRandomItem(sourcePool, out overrideValue, out offset, customList);
					if ((Object)(object)randomItem != (Object)null && (Object)(object)randomItem.spawnPrefab != (Object)null)
					{
						if (offsets.Length > i)
						{
							offset += offsets[i];
						}
						GrabbableObject val = SpawnItem(randomItem, position + offset, parent, overrideValue, spawnOnNetwork, rotation);
						if ((Object)(object)val != (Object)null)
						{
							list.Add(new KeyValuePair<GrabbableObject, int>(val, overrideValue));
						}
					}
				}
			}
			return list;
		}

		public static GrabbableObject? SpawnItem(Item item, Vector3 pos, Transform? parent, int overrideValue = -1, bool spawnOnNetwork = true, EnemySpawner.RotationType rotation = EnemySpawner.RotationType.NoRotation)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			JLogHelper.LogInfo($"Spawn on network: {spawnOnNetwork}", JLogLevel.Wesley);
			if (((NetworkBehaviour)RoundManager.Instance).IsServer || ((NetworkBehaviour)RoundManager.Instance).IsHost)
			{
				GrabbableObject component = Object.Instantiate<GameObject>(item.spawnPrefab, pos, Quaternion.Euler(new Vector3(0f, ((Object)(object)parent == (Object)null) ? 0f : EnemySpawner.GetRot(rotation, parent), 0f)), parent).GetComponent<GrabbableObject>();
				component.fallTime = 0f;
				if (spawnOnNetwork)
				{
					JLogHelper.LogInfo("Spawning item on network.", JLogLevel.Wesley);
					((NetworkBehaviour)component).NetworkObject.Spawn(false);
					OverrideScrapValue(component, overrideValue);
				}
				return component;
			}
			return null;
		}

		public static void OverrideScrapValue(GrabbableObject grabbable, int overrideValue = -1)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			if (overrideValue >= 0)
			{
				JLLNetworkManager.Instance.UpdateScanNodeServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)grabbable).NetworkObject), overrideValue);
			}
			else
			{
				JLLNetworkManager.Instance.UpdateScanNodeServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)grabbable).NetworkObject), Mathf.RoundToInt((float)Random.Range(grabbable.itemProperties.minValue, grabbable.itemProperties.maxValue) * RoundManager.Instance.scrapValueMultiplier));
			}
		}
	}
	public class JActionEvents : NetworkBehaviour, IHittable, IShockableWithGun, INoiseListener
	{
		[Header("Hittable")]
		public bool canBeHit = true;

		public IntEvent OnHit = new IntEvent();

		public InteractEvent OnPlayerHit = new InteractEvent();

		[Header("Shockable")]
		public bool canBeShocked = false;

		public float shockDifficulty = 1f;

		public Vector3 shockPositionOffset = Vector3.zero;

		public InteractEvent OnShock = new InteractEvent();

		public UnityEvent OnStopShocking = new UnityEvent();

		[Header("NoiseListener")]
		public bool isListening = false;

		public float minLoudness = 0.25f;

		public int minTimesInOneSpot = 0;

		public UnityEvent SoundListenedEvent = new UnityEvent();

		public bool Hit(int force, Vector3 hitDirection, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			if (!canBeHit)
			{
				return false;
			}
			((UnityEvent<int>)OnHit).Invoke(force);
			if ((Object)(object)playerWhoHit != (Object)null)
			{
				((UnityEvent<PlayerControllerB>)(object)OnPlayerHit).Invoke(playerWhoHit);
			}
			return true;
		}

		public bool CanBeShocked()
		{
			return canBeShocked;
		}

		public float GetDifficultyMultiplier()
		{
			return shockDifficulty;
		}

		public NetworkObject GetNetworkObject()
		{
			return ((NetworkBehaviour)this).NetworkObject;
		}

		public Vector3 GetShockablePosition()
		{
			//IL_0007: 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_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			return ((Component)this).transform.position + shockPositionOffset;
		}

		public Transform GetShockableTransform()
		{
			return ((Component)this).transform;
		}

		public void ShockWithGun(PlayerControllerB shockedByPlayer)
		{
			((UnityEvent<PlayerControllerB>)(object)OnShock).Invoke(shockedByPlayer);
		}

		public void StopShockingWithGun()
		{
			OnStopShocking.Invoke();
		}

		public void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot, int noiseID)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			if (isListening)
			{
				if (Physics.Linecast(((Component)this).transform.position, noisePosition, 256))
				{
					noiseLoudness /= 2f;
				}
				if (!(noiseLoudness < minLoudness) && timesPlayedInOneSpot >= minTimesInOneSpot)
				{
					SoundListenedEvent.Invoke();
				}
			}
		}

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

		protected internal override string __getTypeName()
		{
			return "JActionEvents";
		}
	}
	public class JClientAttatchedObject : MonoBehaviour
	{
		public enum ActiveCondition
		{
			None,
			ActiveOutdoors,
			ActiveIndoors,
			ActiveOutdoorsOutsideShip
		}

		public GameObject target;

		public ActiveCondition enableCondition = ActiveCondition.ActiveOutdoors;

		[Header("Player Attatchment")]
		public bool attachToLocalPlayer = false;

		public bool lerpPosition = false;

		public void Update()
		{
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)target == (Object)null)
			{
				return;
			}
			switch (enableCondition)
			{
			case ActiveCondition.ActiveOutdoors:
				target.SetActive(!RoundManager.Instance.playersManager.localPlayerController.isInsideFactory);
				break;
			case ActiveCondition.ActiveIndoors:
				target.SetActive(RoundManager.Instance.playersManager.localPlayerController.isInsideFactory);
				break;
			case ActiveCondition.ActiveOutdoorsOutsideShip:
				target.SetActive(!RoundManager.Instance.playersManager.localPlayerController.isInsideFactory && !RoundManager.Instance.playersManager.localPlayerController.isInHangarShipRoom);
				break;
			}
			if (target.activeSelf && attachToLocalPlayer)
			{
				Vector3 position = ((Component)RoundManager.Instance.playersManager.localPlayerController).transform.position;
				if (lerpPosition)
				{
					target.transform.position = Vector3.Lerp(target.transform.position, position, Time.deltaTime);
				}
				else
				{
					target.transform.position = position;
				}
			}
		}
	}
	public class JClientSync : NetworkBehaviour
	{
		[Header("Synced Filter")]
		[SerializeField]
		public JFilter hostFilter;

		public bool runFilterOnStart = false;

		public UnityEvent SyncedFilterSuccess = new UnityEvent();

		public UnityEvent SyncedFilterFailure = new UnityEvent();

		[Header("Host Only")]
		public bool runHostEventOnStart = false;

		public UnityEvent hostEvent = new UnityEvent();

		public InteractEvent hostPlayerEvent = new InteractEvent();

		[Header("Synced")]
		public bool runSyncedEventOnStart = false;

		public UnityEvent syncedEvent = new UnityEvent();

		public InteractEvent syncedPlayerEvent = new InteractEvent();

		private void Start()
		{
			if (!((NetworkBehaviour)this).IsHost && !((NetworkBehaviour)this).IsServer)
			{
				return;
			}
			if ((Object)(object)hostFilter != (Object)null)
			{
				hostFilter.FilteredResult.AddListener((UnityAction<bool>)FilterResultServerRpc);
				if (runFilterOnStart)
				{
					hostFilter.FilterDefault();
				}
			}
			if (runHostEventOnStart)
			{
				TriggerOnHost();
			}
			if (runSyncedEventOnStart)
			{
				TriggerSyncedEvent();
			}
		}

		public void FilterOnHost()
		{
			RunFilterOnHostServerRpc();
		}

		[ServerRpc(RequireOwnership = false)]
		private void RunFilterOnHostServerRpc()
		{
			//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(402539773u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 402539773u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					hostFilter?.FilterDefault();
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void FilterResultServerRpc(bool success)
		{
			//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)
	

BepInEx/plugins/JLL/JLLEditorModule.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using JLL.Components;
using JLLItemsModule.Components;
using Unity.Netcode;
using UnityEditor;
using UnityEditorInternal;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("JLLEditorModule")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("JLLEditorModule")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("820f0e1c-80f5-436f-8641-0f048baeb385")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace JLLEditorModule
{
	public class JLLEditor
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static ElementHeightCallbackDelegate <>9__5_1;

			public static HeaderCallbackDelegate <>9__5_2;

			internal float <CreateWeightedItemSpawnProperties>b__5_1(int index)
			{
				return GetElementRectHeight(5) + 5f;
			}

			internal void <CreateWeightedItemSpawnProperties>b__5_2(Rect rect)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				EditorGUI.LabelField(rect, new GUIContent("Custom Item List"));
			}
		}

		public static void HelpMessage(params string[] messages)
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			if (messages.Length > 1)
			{
				StringBuilder stringBuilder = new StringBuilder();
				for (int i = 0; i < messages.Length; i++)
				{
					stringBuilder.Append(messages[i]);
					if (i < messages.Length - 1)
					{
						stringBuilder.Append("\n\n");
					}
				}
				EditorGUILayout.HelpBox(new GUIContent(stringBuilder.ToString()), true);
			}
			else if (messages.Length == 1)
			{
				EditorGUILayout.HelpBox(new GUIContent(messages[0]), true);
			}
		}

		public static void WeightedItemProperty(SerializedProperty item, Rect rect)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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_0045: 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)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: 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_009b: 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)
			int num = 0;
			EditorGUI.PropertyField(GetElementRect(rect, num++), item.FindPropertyRelative("Item"));
			EditorGUI.PropertyField(GetElementRect(rect, num++), item.FindPropertyRelative("Weight"));
			EditorGUI.PropertyField(GetElementRect(rect, num++), item.FindPropertyRelative("FindRegisteredItem"));
			SerializedProperty val = item.FindPropertyRelative("OverrideValue");
			EditorGUI.PropertyField(GetElementRect(rect, 2, new Vector2Int(0, num)), val);
			if (val.boolValue)
			{
				EditorGUI.PropertyField(GetElementRect(rect, 2, new Vector2Int(1, num)), item.FindPropertyRelative("ScrapValue"), GUIContent.none);
			}
			num++;
			EditorGUI.PropertyField(GetElementRect(rect, num++), item.FindPropertyRelative("SpawnOffset"));
		}

		public static Rect GetElementRect(Rect rect, int index, float seperation = 5f)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			return new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y + GetElementRectHeight(index, seperation) + seperation, ((Rect)(ref rect)).width, EditorGUIUtility.singleLineHeight);
		}

		public static Rect GetElementRect(Rect rect, int columns, Vector2Int location, float seperation = 5f)
		{
			//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_0048: Unknown result type (might be due to invalid IL or missing references)
			return new Rect(((Rect)(ref rect)).x + ((Rect)(ref rect)).width / (float)columns * (float)((Vector2Int)(ref location)).x, ((Rect)(ref rect)).y + GetElementRectHeight(((Vector2Int)(ref location)).y, seperation), ((Rect)(ref rect)).width / (float)columns, EditorGUIUtility.singleLineHeight);
		}

		public static float GetElementRectHeight(int index, float seperation = 5f)
		{
			return (EditorGUIUtility.singleLineHeight + seperation) * (float)index;
		}

		public static ReorderableList CreateWeightedItemSpawnProperties(SerializedObject obj, SerializedProperty CustomList)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0045: 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)
			//IL_0050: Expected O, but got Unknown
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			ReorderableList weightedProperties = new ReorderableList(obj, CustomList);
			weightedProperties.drawElementCallback = (ElementCallbackDelegate)delegate(Rect rect, int index, bool isActive, bool isFocused)
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				WeightedItemProperty(weightedProperties.serializedProperty.GetArrayElementAtIndex(index), rect);
			};
			ReorderableList obj2 = weightedProperties;
			object obj3 = <>c.<>9__5_1;
			if (obj3 == null)
			{
				ElementHeightCallbackDelegate val = (int index) => GetElementRectHeight(5) + 5f;
				<>c.<>9__5_1 = val;
				obj3 = (object)val;
			}
			obj2.elementHeightCallback = (ElementHeightCallbackDelegate)obj3;
			ReorderableList obj4 = weightedProperties;
			object obj5 = <>c.<>9__5_2;
			if (obj5 == null)
			{
				HeaderCallbackDelegate val2 = delegate(Rect rect)
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					//IL_0007: Unknown result type (might be due to invalid IL or missing references)
					//IL_0011: Expected O, but got Unknown
					EditorGUI.LabelField(rect, new GUIContent("Custom Item List"));
				};
				<>c.<>9__5_2 = val2;
				obj5 = (object)val2;
			}
			obj4.drawHeaderCallback = (HeaderCallbackDelegate)obj5;
			return weightedProperties;
		}

		public static bool ObjectIsParent(GameObject target, Transform search)
		{
			if ((Object)(object)((Component)search).transform.parent != (Object)null)
			{
				if ((Object)(object)((Component)((Component)search).transform.parent).gameObject == (Object)(object)target)
				{
					return true;
				}
				return ObjectIsParent(target, ((Component)search).transform.parent);
			}
			return false;
		}
	}
}
namespace JLLEditorModule.EditorScripts
{
	[CustomEditor(typeof(DamageTrigger))]
	[CanEditMultipleObjects]
	public class DamageTriggerEditor : JLLCustomEditor<DamageTrigger>
	{
		private bool hasTriggerCollider = false;

		private bool hasCollider = false;

		private int indent = 0;

		public override void AtHeader()
		{
			base.AtHeader();
			hasTriggerCollider = false;
			hasCollider = false;
			Collider[] components = ((Component)Component).gameObject.GetComponents<Collider>();
			foreach (Collider val in components)
			{
				if (val.isTrigger)
				{
					hasTriggerCollider = true;
				}
				else
				{
					hasCollider = true;
				}
				if (hasTriggerCollider && hasCollider)
				{
					break;
				}
			}
		}

		public override bool DisplayProperty(SerializedProperty property)
		{
			if ((Object)(object)Component.DamageTriggerNetworking == (Object)null && (property.name == "attachCorpseToPoint" || property.name == "OverrideCorpseMesh"))
			{
				return false;
			}
			if (!Component.attachCorpseToPoint || (Object)(object)Component.DamageTriggerNetworking == (Object)null)
			{
				if (property.name == "corpseAttachPoint" || property.name == "matchPointExactly" || property.name == "corpseStickTime" || property.name == "connectedBone")
				{
					return false;
				}
			}
			else if (indent == 0)
			{
				if (property.name == "attachCorpseToPoint")
				{
					indent++;
				}
				else if (property.name == "corpseStickTime")
				{
					indent--;
				}
			}
			else
			{
				EditorGUI.indentLevel += indent;
				indent = 0;
			}
			return true;
		}

		public override void DisplayWarnings(SerializedProperty property)
		{
			if (property.name == "vehicleTargets" && Component.vehicleTargets.enabled && Physics.GetIgnoreLayerCollision(((Component)Component).gameObject.layer, 30))
			{
				JLLEditor.HelpMessage(LayerMask.LayerToName(((Component)Component).gameObject.layer) + " Layer does not interact with the Vehicle Layer.", "In order to damage Vehicles you will need to make sure your colliders / Layermasks can interact with the vehicle layer.", "The Collision Matrix can be found at: ProjectSettings/Physics/LayerCollisionMatrix");
			}
			if (!hasCollider && property.name == "damageOnCollision" && Component.damageOnCollision)
			{
				JLLEditor.HelpMessage("'damageOnCollision' requires a collider on the same object that has 'isTrigger' disabled.");
			}
			if (!hasTriggerCollider)
			{
				if (property.name == "damageOnEnter" && Component.damageOnEnter)
				{
					JLLEditor.HelpMessage("'damageOnEnter' requires a collider on the same object that has 'isTrigger' enabled.");
				}
				else if (property.name == "damageOnExit" && Component.damageOnExit)
				{
					JLLEditor.HelpMessage("'damageOnExit' requires a collider on the same object that has 'isTrigger' enabled.");
				}
				else if (property.name == "continuousDamage" && Component.continuousDamage)
				{
					JLLEditor.HelpMessage("'continuousDamage' requires a collider on the same object that has 'isTrigger' enabled.");
				}
			}
			if (property.name == "continuousRaycastDamage" && Component.continuousRaycastDamage && Component.raycastDirections.Length == 0)
			{
				JLLEditor.HelpMessage("'continuousRaycastDamage' requires at least one raycast direction to be defined in 'raycastDirections'.");
			}
		}
	}
	[CustomEditor(typeof(JClientAttatchedObject))]
	[CanEditMultipleObjects]
	public class JClientAttatchedObjectEditor : JLLCustomEditor<JClientAttatchedObject>
	{
		public override bool DisplayProperty(SerializedProperty property)
		{
			if (property.name == "lerpPosition" && !Component.attachToLocalPlayer)
			{
				return false;
			}
			return true;
		}

		public override void DisplayWarnings(SerializedProperty property)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			if (property.name == "target" && (int)Component.enableCondition != 0 && ((Object)(object)((Component)Component).gameObject == (Object)(object)Component.target || JLLEditor.ObjectIsParent(Component.target, ((Component)Component).transform)))
			{
				JLLEditor.HelpMessage("Target should not be self or parent when an Enable Condition is set.", "Disabling the object containing this script will stop it from working.");
			}
		}
	}
	public abstract class JLLCustomEditor<T> : Editor where T : Object
	{
		public T Component;

		public virtual void OnEnable()
		{
			Component = (T)(object)((Editor)this).target;
		}

		public override void OnInspectorGUI()
		{
			((Editor)this).serializedObject.Update();
			AtHeader();
			SerializedProperty iterator = ((Editor)this).serializedObject.GetIterator();
			bool flag = true;
			int num = 0;
			while (iterator.NextVisible(flag))
			{
				if (flag)
				{
					flag = false;
				}
				else if (DisplayProperty(iterator))
				{
					EditorGUILayout.PropertyField(iterator, Array.Empty<GUILayoutOption>());
					DisplayWarnings(iterator);
				}
				num++;
			}
			AtFooter();
			((Editor)this).serializedObject.ApplyModifiedProperties();
		}

		public virtual void AtHeader()
		{
			object obj = Component;
			NetworkBehaviour val = (NetworkBehaviour)((obj is NetworkBehaviour) ? obj : null);
			if (val != null && (Object)(object)((Component)val).GetComponent<NetworkObject>() == (Object)null)
			{
				JLLEditor.HelpMessage("Network Behaviours require a Network Object to run some of their code. Ensure you have a Network Object attatched to this script in some way.");
			}
		}

		public abstract bool DisplayProperty(SerializedProperty property);

		public virtual void DisplayWarnings(SerializedProperty property)
		{
		}

		public virtual void AtFooter()
		{
		}
	}
	[CustomEditor(typeof(JNetworkPrefabSpawner))]
	[CanEditMultipleObjects]
	public class JNetworkPrefabSpawnerEditor : JLLCustomEditor<JNetworkPrefabSpawner>
	{
		public override bool DisplayProperty(SerializedProperty property)
		{
			if (Component.spawnRandom && property.name == "spawnPrefabName")
			{
				return false;
			}
			return true;
		}
	}
	[CustomEditor(typeof(JPlayerInsideRegion))]
	[CanEditMultipleObjects]
	public class JPlayerInsideRegionEditor : JLLCustomEditor<JPlayerInsideRegion>
	{
		public override bool DisplayProperty(SerializedProperty property)
		{
			if (!Component.limitEventTriggers && property.name == "maxEventTriggers")
			{
				return false;
			}
			return true;
		}
	}
	[CustomEditor(typeof(JMeleeWeapon))]
	[CanEditMultipleObjects]
	public class JMeleeWeaponEditor : JLLCustomEditor<JMeleeWeapon>
	{
		public override bool DisplayProperty(SerializedProperty property)
		{
			if (!Component.isHeavyWeapon && (property.name == "reelingTime" || property.name == "swingTime" || property.name == "reelUpSFX"))
			{
				return false;
			}
			if (property.name == "OnPlayerHit" && !Component.damagePlayers)
			{
				return false;
			}
			if (property.name == "OnEnemyHit" && !Component.damageEnemies)
			{
				return false;
			}
			if (property.name == "OnVehicleHit" && !Component.damageVehicles)
			{
				return false;
			}
			if (property.name == "OnObjectHit" && !Component.damageObjects)
			{
				return false;
			}
			return true;
		}
	}
	[CustomEditor(typeof(JEventBoxItem))]
	[CanEditMultipleObjects]
	public class JEventBoxItemEditor : JLLCustomEditor<JEventBoxItem>
	{
		private SerializedProperty CustomList;

		private ReorderableList weightedProperties;

		public override void OnEnable()
		{
			base.OnEnable();
			CustomList = ((Editor)this).serializedObject.FindProperty("CustomList");
			weightedProperties = JLLEditor.CreateWeightedItemSpawnProperties(((Editor)this).serializedObject, CustomList);
		}

		public override bool DisplayProperty(SerializedProperty property)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Invalid comparison between Unknown and I4
			if (property.name == "CustomList")
			{
				if ((int)Component.SourcePool == 0)
				{
					weightedProperties.DoLayoutList();
				}
				return false;
			}
			return true;
		}
	}
	[CustomEditor(typeof(JRandomPropPlacer))]
	[CanEditMultipleObjects]
	public class JRandomPropPlacerEditor : JLLCustomEditor<JRandomPropPlacer>
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static HeaderCallbackDelegate <>9__4_2;

			internal void <CreateSpawnablePropProperties>b__4_2(Rect rect)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				EditorGUI.LabelField(rect, new GUIContent("Spawnable Props"));
			}
		}

		private SerializedProperty SpawnablePropsList;

		private ReorderableList spawnablePropProperties;

		public override void OnEnable()
		{
			base.OnEnable();
			SpawnablePropsList = ((Editor)this).serializedObject.FindProperty("spawnableProps");
			spawnablePropProperties = CreateSpawnablePropProperties(((Editor)this).serializedObject, SpawnablePropsList);
		}

		public override bool DisplayProperty(SerializedProperty property)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Invalid comparison between Unknown and I4
			if (property.name == "rebakeSurfaces" && (int)Component.rebakeNavMesh != -1)
			{
				return false;
			}
			if (property.name == "spawnableProps")
			{
				spawnablePropProperties.DoLayoutList();
				return false;
			}
			return true;
		}

		public ReorderableList CreateSpawnablePropProperties(SerializedObject obj, SerializedProperty CustomList)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_0063: 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_006e: Expected O, but got Unknown
			ReorderableList weightedProperties = new ReorderableList(obj, CustomList);
			weightedProperties.drawElementCallback = (ElementCallbackDelegate)delegate(Rect rect, int index, bool isActive, bool isFocused)
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				SpawnablePropProperty(weightedProperties.serializedProperty.GetArrayElementAtIndex(index), rect);
			};
			weightedProperties.elementHeightCallback = (ElementHeightCallbackDelegate)((int index) => JLLEditor.GetElementRectHeight(((int)Component.spawnableProps[index].spawnRotation == 3) ? 7 : 6) + 5f);
			ReorderableList obj2 = weightedProperties;
			object obj3 = <>c.<>9__4_2;
			if (obj3 == null)
			{
				HeaderCallbackDelegate val = delegate(Rect rect)
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					//IL_0007: Unknown result type (might be due to invalid IL or missing references)
					//IL_0011: Expected O, but got Unknown
					EditorGUI.LabelField(rect, new GUIContent("Spawnable Props"));
				};
				<>c.<>9__4_2 = val;
				obj3 = (object)val;
			}
			obj2.drawHeaderCallback = (HeaderCallbackDelegate)obj3;
			return weightedProperties;
		}

		public static void SpawnablePropProperty(SerializedProperty item, Rect rect)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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_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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			EditorGUI.PropertyField(JLLEditor.GetElementRect(rect, num++), item.FindPropertyRelative("prefabToSpawn"));
			EditorGUI.PropertyField(JLLEditor.GetElementRect(rect, num++), item.FindPropertyRelative("randomAmount"));
			SerializedProperty val = item.FindPropertyRelative("spawnRotation");
			EditorGUI.PropertyField(JLLEditor.GetElementRect(rect, num++), val);
			if (val.enumValueFlag == 3)
			{
				EditorGUI.PropertyField(JLLEditor.GetElementRect(rect, num++), item.FindPropertyRelative("spawnFlushAgainstWall"));
			}
			EditorGUI.PropertyField(JLLEditor.GetElementRect(rect, num++), item.FindPropertyRelative("distanceFromEntrances"));
			EditorGUI.PropertyField(JLLEditor.GetElementRect(rect, num++), item.FindPropertyRelative("distanceBetweenSpawns"));
			EditorGUI.PropertyField(JLLEditor.GetElementRect(rect, num++), item.FindPropertyRelative("randomSpawnRange"));
		}
	}
	[CustomEditor(typeof(ModLoadedCheck))]
	[CanEditMultipleObjects]
	public class ModLoadedCheckEditor : JLLCustomEditor<ModLoadedCheck>
	{
		public override bool DisplayProperty(SerializedProperty property)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Invalid comparison between Unknown and I4
			if (property.name == "modGUID" && (int)Component.checkedMod != -1)
			{
				return false;
			}
			return true;
		}
	}
	[CustomEditor(typeof(RandomizedEvent))]
	[CanEditMultipleObjects]
	public class RandomizedEventEditor : JLLCustomEditor<RandomizedEvent>
	{
		public override bool DisplayProperty(SerializedProperty property)
		{
			return true;
		}
	}
	[CustomEditor(typeof(RandomClipPlayer))]
	[CanEditMultipleObjects]
	public class RandomClipPlayerEditor : JLLCustomEditor<RandomClipPlayer>
	{
		public override bool DisplayProperty(SerializedProperty property)
		{
			if (!Component.walkieCanHear && property.name == "walkieVolumeMultiplier")
			{
				return false;
			}
			if (!Component.creaturesCanHear && (property.name == "creatureVolumeMultiplier" || property.name == "creatureRangeMultiplier"))
			{
				return false;
			}
			return true;
		}
	}
	[CustomEditor(typeof(TerrainObstacle))]
	[CanEditMultipleObjects]
	public class TerrainObstacleEditor : JLLCustomEditor<TerrainObstacle>
	{
		public override void AtHeader()
		{
			base.AtHeader();
			if (Physics.GetIgnoreLayerCollision(((Component)Component).gameObject.layer, 30))
			{
				JLLEditor.HelpMessage(LayerMask.LayerToName(((Component)Component).gameObject.layer) + " Layer does not interact with the Vehicle Layer.", "In order for this script to work you will need to make sure your colliders / Layermasks can interact with the vehicle layer.", "The Collision Matrix can be found at: ProjectSettings/Physics/LayerCollisionMatrix");
			}
			MeshCollider val = default(MeshCollider);
			if (((Component)Component).TryGetComponent<MeshCollider>(ref val))
			{
				JLLEditor.HelpMessage("Mesh Colliders may cause problems being detected by other scripts.", "Please consider using a different type of collider for use with TerrainObstacles.");
			}
		}

		public override bool DisplayProperty(SerializedProperty property)
		{
			return true;
		}
	}
	[CustomEditor(typeof(JThrowableItem))]
	[CanEditMultipleObjects]
	public class JThrowableItemEditor : JLLCustomEditor<JThrowableItem>
	{
		private SerializedProperty CustomList;

		private ReorderableList weightedProperties;

		public override void OnEnable()
		{
			base.OnEnable();
			CustomList = ((Editor)this).serializedObject.FindProperty("CustomList");
			weightedProperties = JLLEditor.CreateWeightedItemSpawnProperties(((Editor)this).serializedObject, CustomList);
		}

		public override bool DisplayProperty(SerializedProperty property)
		{
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Invalid comparison between Unknown and I4
			if (!Component.damageOnExplode && (property.name == "killDistance" || property.name == "damageRange" || property.name == "nonLethalDamage" || property.name == "pushForce" || property.name == "goThroughCar"))
			{
				return false;
			}
			if (!Component.stunOnExplode && (property.name == "affectAudio" || property.name == "flashSeverityMultiplier" || property.name == "enemyStunTime" || property.name == "flashSeverityDistanceRolloff"))
			{
				return false;
			}
			if (!Component.spawnItemsOnExplode && (property.name == "numberToSpawn" || property.name == "SourcePool" || property.name == "SpawnOffsets"))
			{
				return false;
			}
			if (property.name == "CustomList")
			{
				if (Component.spawnItemsOnExplode && (int)Component.SourcePool == 0)
				{
					weightedProperties.DoLayoutList();
				}
				return false;
			}
			return true;
		}
	}
	[CustomEditor(typeof(JWeatherObject))]
	[CanEditMultipleObjects]
	public class JWeatherObjectEditor : JLLCustomEditor<JWeatherObject>
	{
		public override bool DisplayProperty(SerializedProperty property)
		{
			if (property.name == "defaultToSelf" && (Object)(object)Component.activeObject != (Object)null)
			{
				return false;
			}
			return true;
		}
	}
	[CustomEditor(typeof(ItemSpawner))]
	[CanEditMultipleObjects]
	public class ItemSpawnerEditor : JLLCustomEditor<ItemSpawner>
	{
		private SerializedProperty CustomList;

		private ReorderableList weightedProperties;

		public override void OnEnable()
		{
			base.OnEnable();
			CustomList = ((Editor)this).serializedObject.FindProperty("CustomList");
			weightedProperties = JLLEditor.CreateWeightedItemSpawnProperties(((Editor)this).serializedObject, CustomList);
		}

		public override bool DisplayProperty(SerializedProperty property)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Invalid comparison between Unknown and I4
			if (property.name == "CustomList")
			{
				if ((int)Component.SourcePool == 0)
				{
					weightedProperties.DoLayoutList();
				}
				return false;
			}
			return true;
		}
	}
	[CustomEditor(typeof(EnemySpawner))]
	[CanEditMultipleObjects]
	public class EnemySpawnerEditor : JLLCustomEditor<EnemySpawner>
	{
		public override bool DisplayProperty(SerializedProperty property)
		{
			if (Component.spawnRandom)
			{
				if (property.name == "type")
				{
					return false;
				}
			}
			else if (property.name == "randomPool")
			{
				return false;
			}
			return true;
		}
	}
}

BepInEx/plugins/JLL/JLLItemsModule.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using GameNetcodeStuff;
using HarmonyLib;
using JLL;
using JLL.API;
using JLL.API.Events;
using JLL.Components;
using JLL.Patches;
using JLLItemsModule.Components;
using JLLItemsModule.NetcodePatcher;
using JLLItemsModule.Patches;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Serialization;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("JLLItemsModule")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("JLLItemsModule")]
[assembly: AssemblyTitle("JLLItemsModule")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace JLLItemsModule
{
	[BepInPlugin("JacobG5.JLLItemModule", "JLLItemModule", "1.2.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class JLLItemsCore : BaseUnityPlugin
	{
		private const string modGUID = "JacobG5.JLLItemModule";

		private const string modName = "JLLItemModule";

		private const string modVersion = "1.2.2";

		private readonly Harmony harmony = new Harmony("JacobG5.JLLItemModule");

		public void Awake()
		{
			JLL.NetcodePatch(JLogHelper.GetSource(), Assembly.GetExecutingAssembly().GetTypes());
			JLL.HarmonyPatch(harmony, JLogHelper.GetSource(), new Type[2]
			{
				typeof(PlayerPatch),
				typeof(DepositItemsDeskPatch)
			});
		}

		private void RegisterTestItems()
		{
			AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "testitems"));
			Items.RegisterItem(val.LoadAsset<Item>("Assets/LethalCompany/Mods/ItemTests/TestStunGrenade_0.asset"));
			Items.RegisterItem(val.LoadAsset<Item>("Assets/LethalCompany/Mods/ItemTests/TestShovel.asset"));
			Items.RegisterItem(val.LoadAsset<Item>("Assets/LethalCompany/Mods/ItemTests/TestKnife.asset"));
			Items.RegisterItem(val.LoadAsset<Item>("Assets/LethalCompany/Mods/ItemTests/TestGiftBox.asset"));
			Items.RegisterItem(val.LoadAsset<Item>("Assets/LethalCompany/Mods/ItemTests/TestEasterEgg.asset"));
		}
	}
}
namespace JLLItemsModule.Patches
{
	[HarmonyPatch(typeof(DepositItemsDesk))]
	internal class DepositItemsDeskPatch
	{
		[HarmonyPatch("AddObjectToDeskClientRpc")]
		[HarmonyPostfix]
		public static void patchAddObjectToDeskClientRpc(NetworkObjectReference grabbableObjectNetObject)
		{
			NetworkObject val = default(NetworkObject);
			JGrabbableObject jGrabbableObject = default(JGrabbableObject);
			if (((NetworkObjectReference)(ref grabbableObjectNetObject)).TryGet(ref val, (NetworkManager)null) && ((Component)val).TryGetComponent<JGrabbableObject>(ref jGrabbableObject))
			{
				jGrabbableObject.PlacedOnDepositDesk();
				jGrabbableObject.OnPlacedOnDepositDesk.Invoke();
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerPatch
	{
		[HarmonyPatch("SetItemInElevator")]
		[HarmonyPrefix]
		public static void patchSetItemInElevator(bool droppedInShipRoom, bool droppedInElevator, GrabbableObject gObject)
		{
			if (gObject.isInShipRoom != droppedInShipRoom && gObject is JGrabbableObject jGrabbableObject)
			{
				jGrabbableObject.OnSetInsideShip(droppedInShipRoom);
				((UnityEvent<bool>)(object)jGrabbableObject.OnSetInShip).Invoke(droppedInShipRoom);
			}
		}
	}
}
namespace JLLItemsModule.Components
{
	public class JEventBoxItem : JGrabbableObject
	{
		[Header("Event Box")]
		public bool canOpenInOrbit = true;

		public int boxUses = 1;

		public bool destroyWhenEmpty = true;

		private float lastUsedTime = 0f;

		public float openCooldown = 0.4f;

		public PlayerEvent OpenEvent = new PlayerEvent();

		public WeightedEvent[] RandomOpenEvent = (WeightedEvent[])(object)new WeightedEvent[1]
		{
			new WeightedEvent
			{
				Weight = 20
			}
		};

		[Header("Item Spawner")]
		public bool spawnItemsOnOpen = true;

		public int numberToSpawn = 1;

		public SpawnPoolSource SourcePool = (SpawnPoolSource)0;

		public WeightedItemRefrence[] CustomList = (WeightedItemRefrence[])(object)new WeightedItemRefrence[1]
		{
			new WeightedItemRefrence()
		};

		[Header("Audio & FX")]
		public ParticleSystem? PoofParticle;

		public AudioSource? BoxAudio;

		public AudioClip? OpenBoxClip;

		private PlayerControllerB previousPlayerHeldBy;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			WeightedItemRefrence[] customList = CustomList;
			foreach (WeightedItemRefrence val in customList)
			{
				val.FindRegistered();
			}
		}

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

		public override int GetItemDataToSave()
		{
			((GrabbableObject)this).GetItemDataToSave();
			return boxUses;
		}

		public override void EquipItem()
		{
			base.EquipItem();
			previousPlayerHeldBy = ((GrabbableObject)this).playerHeldBy;
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if ((canOpenInOrbit || !StartOfRound.Instance.inShipPhase) && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null && boxUses > 0 && Time.realtimeSinceStartup - lastUsedTime > openCooldown)
			{
				lastUsedTime = Time.realtimeSinceStartup;
				((GrabbableObject)this).playerHeldBy.activatingItem = true;
				if (((NetworkBehaviour)this).IsOwner)
				{
					OpenGiftBoxServerRpc();
				}
			}
		}

		public override void PocketItem()
		{
			base.PocketItem();
			((GrabbableObject)this).playerHeldBy.activatingItem = false;
		}

		[ServerRpc(RequireOwnership = false)]
		public void OpenGiftBoxServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1900567855u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1900567855u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			boxUses--;
			int num = -1;
			if (RandomOpenEvent.Length != 0)
			{
				IWeightedItem[] randomOpenEvent = (IWeightedItem[])(object)RandomOpenEvent;
				num = IWeightedItem.GetRandomIndex(randomOpenEvent);
				if (!RandomOpenEvent[num].SendClientRPC)
				{
					InvokeRandomEvent(num);
					num = -1;
				}
			}
			if (spawnItemsOnOpen)
			{
				SpawnItemsOnServer(numberToSpawn);
			}
			OpenBoxClientRpc(num, boxUses);
		}

		public virtual void SpawnItemsOnServer(int amount)
		{
			SpawnItemsServerRpc(amount);
		}

		[ServerRpc(RequireOwnership = false)]
		private void SpawnItemsServerRpc(int amount)
		{
			//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_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: 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(2647915572u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, amount);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2647915572u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			Vector3 val3 = ((Component)this).transform.position + Vector3.up * 0.25f;
			Transform val4 = ((((!((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null) || !((GrabbableObject)this).playerHeldBy.isInElevator) && !StartOfRound.Instance.inShipPhase) || !((Object)(object)RoundManager.Instance.spawnedScrapContainer != (Object)null)) ? StartOfRound.Instance.elevatorTransform : RoundManager.Instance.spawnedScrapContainer);
			List<KeyValuePair<GrabbableObject, int>> list = ItemSpawner.SpawnRandomItems(SourcePool, val3, val4, CustomList, (Vector3[])null, amount, false, (RotationType)2);
			foreach (KeyValuePair<GrabbableObject, int> item in list)
			{
				item.Key.startFallingPosition = val3;
				((MonoBehaviour)this).StartCoroutine(SetObjectToHitGroundSFX(item.Key));
				item.Key.targetFloorPosition = item.Key.GetItemFloorPosition(((Component)this).transform.position);
				if ((Object)(object)previousPlayerHeldBy != (Object)null && previousPlayerHeldBy.isInHangarShipRoom)
				{
					previousPlayerHeldBy.SetItemInElevator(true, true, item.Key);
				}
				((NetworkBehaviour)item.Key).NetworkObject.Spawn(false);
				ItemSpawner.OverrideScrapValue(item.Key, item.Value);
			}
		}

		private IEnumerator SetObjectToHitGroundSFX(GrabbableObject gObject)
		{
			yield return (object)new WaitForEndOfFrame();
			Debug.Log((object)("Setting " + gObject.itemProperties.itemName + " hit ground to false"));
			gObject.reachedFloorTarget = false;
			gObject.hasHitGround = false;
			gObject.fallTime = 0f;
		}

		[ClientRpc]
		private void OpenBoxClientRpc(int weightedEvent, int usesLeft)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: 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(1016085238u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, weightedEvent);
				BytePacker.WriteValueBitPacked(val2, usesLeft);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1016085238u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			if ((Object)(object)PoofParticle != (Object)null)
			{
				PoofParticle.Play();
			}
			if ((Object)(object)BoxAudio != (Object)null && (Object)(object)OpenBoxClip != (Object)null)
			{
				BoxAudio.PlayOneShot(OpenBoxClip);
				WalkieTalkie.TransmitOneShotAudio(BoxAudio, OpenBoxClip, 1f);
				RoundManager.Instance.PlayAudibleNoise(((Component)BoxAudio).transform.position, 8f, 0.5f, 0, ((GrabbableObject)this).isInShipRoom && StartOfRound.Instance.hangarDoorsClosed, 0);
			}
			boxUses = usesLeft;
			OnBoxOpen();
			InvokeRandomEvent(weightedEvent);
			if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
			{
				((UnityEvent<PlayerControllerB>)(object)OpenEvent).Invoke(((GrabbableObject)this).playerHeldBy);
				((GrabbableObject)this).playerHeldBy.activatingItem = false;
				if (destroyWhenEmpty && boxUses <= 0)
				{
					((GrabbableObject)this).DestroyObjectInHand(((GrabbableObject)this).playerHeldBy);
				}
			}
		}

		private void InvokeRandomEvent(int weightedEvent)
		{
			if (weightedEvent >= 0 && weightedEvent < RandomOpenEvent.Length)
			{
				RandomOpenEvent[weightedEvent].Event.Invoke();
				if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
				{
					((UnityEvent<PlayerControllerB>)(object)RandomOpenEvent[weightedEvent].PlayerEvent).Invoke(((GrabbableObject)this).playerHeldBy);
				}
			}
		}

		public virtual void OnBoxOpen()
		{
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_JEventBoxItem()
		{
			//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
			NetworkManager.__rpc_func_table.Add(1900567855u, new RpcReceiveHandler(__rpc_handler_1900567855));
			NetworkManager.__rpc_func_table.Add(2647915572u, new RpcReceiveHandler(__rpc_handler_2647915572));
			NetworkManager.__rpc_func_table.Add(1016085238u, new RpcReceiveHandler(__rpc_handler_1016085238));
		}

		private static void __rpc_handler_1900567855(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;
				((JEventBoxItem)(object)target).OpenGiftBoxServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2647915572(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 amount = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref amount);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((JEventBoxItem)(object)target).SpawnItemsServerRpc(amount);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		protected internal override string __getTypeName()
		{
			return "JEventBoxItem";
		}
	}
	public class JGrabbableObject : GrabbableObject
	{
		[Header("JGrabbableObject")]
		public GameObject chargedEffects;

		public GameObject[] hideWhenPocketed = (GameObject[])(object)new GameObject[0];

		public UnityEvent OnEquip = new UnityEvent();

		public UnityEvent OnPocketed = new UnityEvent();

		public BoolEvent OnSetInShip = new BoolEvent();

		public UnityEvent OnPlacedOnDepositDesk = new UnityEvent();

		public override void ItemInteractLeftRight(bool right)
		{
			((GrabbableObject)this).ItemInteractLeftRight(right);
			if ((Object)(object)base.playerHeldBy != (Object)null && base.isHeld)
			{
				HeldUpdate();
			}
			if (base.itemProperties.requiresBattery && base.insertedBattery != null)
			{
				GameObject obj = chargedEffects;
				if (obj != null)
				{
					obj.SetActive(!base.insertedBattery.empty);
				}
			}
		}

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

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
			GameObject[] array = hideWhenPocketed;
			foreach (GameObject val in array)
			{
				val.SetActive(!base.isPocketed);
			}
			OnPocketed.Invoke();
		}

		public virtual void HeldUpdate()
		{
		}

		public virtual void OnSetInsideShip(bool isEntering)
		{
		}

		public virtual void PlacedOnDepositDesk()
		{
		}

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

		protected internal override string __getTypeName()
		{
			return "JGrabbableObject";
		}
	}
	public class JMeleeWeapon : JGrabbableObject
	{
		[Header("Melee Weapon")]
		public int HitForce = 1;

		[Tooltip("Shovel Default: 1.5\nKnife Default: 0.3")]
		public float weaponRange = 1.5f;

		[Tooltip("Shovel Default: 0.3\nKnife Default: 0.43")]
		public float weaponCooldown = 0.3f;

		[Tooltip("Leave blank for no blood particle on hit")]
		public ParticleSystem bloodParticle;

		private float timeAtLastDamageDealt;

		[Tooltip("Player is the player who swung the weapon")]
		public UnityEvent<PlayerControllerB> OnHitSuccess = new UnityEvent<PlayerControllerB>();

		public LayerMask hitMask = LayerMask.op_Implicit(1084754248);

		[Header("Heavy Weapons")]
		[Tooltip("Heavy Weapons are similar to the shovel or signs.\nNon Heavy Weapons are similar to the Kitchen Knife")]
		public bool isHeavyWeapon = true;

		[Tooltip("Shovel Default: 0.35")]
		public float reelingTime = 0.35f;

		private float reelingAnimSpeed = 1f;

		[Tooltip("Shovel Default: 0.13")]
		public float swingTime = 0.13f;

		private bool reelingUp;

		private bool isHoldingButton;

		private Coroutine? reelingUpCoroutine;

		[Header("Damage Targets")]
		public bool damagePlayers = true;

		[Tooltip("Passes a Player that has been damaged by the weapon")]
		public UnityEvent<PlayerControllerB> OnPlayerHit = new UnityEvent<PlayerControllerB>();

		public bool damageEnemies = true;

		[Tooltip("Passes an Enemy that has been damaged by the weapon")]
		public UnityEvent<EnemyAI> OnEnemyHit = new UnityEvent<EnemyAI>();

		public bool damageVehicles = false;

		[Tooltip("Passes a Vehicle that has been damaged by the weapon")]
		public UnityEvent<VehicleController> OnVehicleHit = new UnityEvent<VehicleController>();

		public bool damageObjects = true;

		[Tooltip("Passes an Object that has been damaged by the weapon")]
		public UnityEvent<IHittable> OnObjectHit = new UnityEvent<IHittable>();

		[Header("Audio")]
		public AudioClip[] hitSFX;

		[Tooltip("Only used for Heavy Weapons")]
		public AudioClip[] reelUpSFX;

		public AudioClip[] swingSFX;

		public AudioSource weaponAudio;

		private PlayerControllerB previousPlayerHeldBy;

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			if ((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null)
			{
				return;
			}
			previousPlayerHeldBy = ((GrabbableObject)this).playerHeldBy;
			if (((GrabbableObject)this).itemProperties.requiresBattery && ((GrabbableObject)this).insertedBattery.empty)
			{
				return;
			}
			if (isHeavyWeapon)
			{
				isHoldingButton = buttonDown;
				if (!(!reelingUp && buttonDown))
				{
					return;
				}
				reelingUp = true;
				previousPlayerHeldBy = ((GrabbableObject)this).playerHeldBy;
				if (reelingUpCoroutine != null)
				{
					if (((NetworkBehaviour)((GrabbableObject)this).playerHeldBy).IsOwner)
					{
						((GrabbableObject)this).playerHeldBy.playerBodyAnimator.speed = 1f;
					}
					((MonoBehaviour)this).StopCoroutine(reelingUpCoroutine);
				}
				reelingUpCoroutine = ((MonoBehaviour)this).StartCoroutine(ReelBackWeapon());
				return;
			}
			PlayRandomSFX(swingSFX);
			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 && Time.realtimeSinceStartup - timeAtLastDamageDealt > weaponCooldown)
			{
				HitWeapon();
			}
		}

		private IEnumerator ReelBackWeapon()
		{
			((GrabbableObject)this).playerHeldBy.activatingItem = true;
			((GrabbableObject)this).playerHeldBy.twoHanded = true;
			((GrabbableObject)this).playerHeldBy.playerBodyAnimator.ResetTrigger("shovelHit");
			((GrabbableObject)this).playerHeldBy.playerBodyAnimator.SetBool("reelingUp", true);
			if (((NetworkBehaviour)((GrabbableObject)this).playerHeldBy).IsOwner)
			{
				reelingAnimSpeed = 0.35f / reelingTime;
				((GrabbableObject)this).playerHeldBy.playerBodyAnimator.speed = reelingAnimSpeed;
			}
			PlayRandomSFX(reelUpSFX);
			ReelUpSFXServerRpc();
			yield return (object)new WaitForSeconds(reelingTime);
			yield return (object)new WaitUntil((Func<bool>)(() => !isHoldingButton || !((GrabbableObject)this).isHeld));
			if (((NetworkBehaviour)((GrabbableObject)this).playerHeldBy).IsOwner)
			{
				((GrabbableObject)this).playerHeldBy.playerBodyAnimator.speed = 1f;
			}
			SwingHeavyWeapon(!((GrabbableObject)this).isHeld);
			yield return (object)new WaitForSeconds(swingTime);
			yield return (object)new WaitForEndOfFrame();
			HitWeapon(!((GrabbableObject)this).isHeld);
			yield return (object)new WaitForSeconds(weaponCooldown);
			reelingUp = false;
			reelingUpCoroutine = null;
		}

		[ServerRpc]
		public void ReelUpSFXServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3259025159u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3259025159u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ReelUpSFXClientRpc();
			}
		}

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

		public override void DiscardItem()
		{
			if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
			{
				((GrabbableObject)this).playerHeldBy.activatingItem = false;
				if (((NetworkBehaviour)((GrabbableObject)this).playerHeldBy).IsOwner)
				{
					((GrabbableObject)this).playerHeldBy.playerBodyAnimator.speed = 1f;
				}
			}
			((GrabbableObject)this).DiscardItem();
		}

		public virtual void SwingHeavyWeapon(bool cancel = false)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			previousPlayerHeldBy.playerBodyAnimator.SetBool("reelingUp", false);
			if (!cancel)
			{
				PlayRandomSFX(swingSFX);
				previousPlayerHeldBy.UpdateSpecialAnimationValue(true, (short)((Component)previousPlayerHeldBy).transform.localEulerAngles.y, 0.4f, false);
			}
		}

		public bool HitWeapon(bool cancel = false)
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_047b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0412: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: Expected I4, but got Unknown
			if ((Object)(object)previousPlayerHeldBy == (Object)null)
			{
				Debug.LogError((object)"Previousplayerheldby is null on this client when HitShovel is called.");
				return false;
			}
			previousPlayerHeldBy.activatingItem = false;
			int num = -1;
			bool flag = false;
			bool flag2 = false;
			if (!cancel)
			{
				previousPlayerHeldBy.twoHanded = false;
				RaycastHit[] source = Physics.SphereCastAll(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * -0.35f, weaponRange / 1.5f, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward, weaponRange, LayerMask.op_Implicit(hitMask), (QueryTriggerInteraction)2);
				List<RaycastHit> list = source.OrderBy((RaycastHit x) => ((RaycastHit)(ref x)).distance).ToList();
				List<GameObject> list2 = new List<GameObject>();
				Vector3 forward = ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward;
				IHittable val = default(IHittable);
				VehicleController val8 = default(VehicleController);
				foreach (RaycastHit item in list)
				{
					RaycastHit current = item;
					if (((Component)((RaycastHit)(ref current)).collider).gameObject.layer == 8 || ((Component)((RaycastHit)(ref current)).collider).gameObject.layer == 11)
					{
						if (((RaycastHit)(ref current)).collider.isTrigger)
						{
							continue;
						}
						for (int i = 0; i < StartOfRound.Instance.footstepSurfaces.Length; i++)
						{
							if (((Component)((RaycastHit)(ref current)).collider).gameObject.tag == StartOfRound.Instance.footstepSurfaces[i].surfaceTag)
							{
								num = i;
								flag = true;
								break;
							}
						}
						continue;
					}
					if (((Component)((RaycastHit)(ref current)).collider).TryGetComponent<IHittable>(ref val))
					{
						GameObject val2 = null;
						ColliderType val3 = (ColliderType)3;
						bool flag3 = true;
						EnemyAICollisionDetect val4 = (EnemyAICollisionDetect)(object)((val is EnemyAICollisionDetect) ? val : null);
						if (val4 != null)
						{
							flag3 = damageEnemies;
							val2 = ((Component)val4.mainScript).gameObject;
							val3 = (ColliderType)1;
						}
						else
						{
							PlayerControllerB val5 = (PlayerControllerB)(object)((val is PlayerControllerB) ? val : null);
							if (val5 != null)
							{
								if (val5.actualClientId == previousPlayerHeldBy.actualClientId)
								{
									continue;
								}
								flag3 = damagePlayers;
								val2 = ((Component)val5).gameObject;
								val3 = (ColliderType)0;
							}
							else
							{
								flag3 = damageObjects;
								val2 = ((Component)((RaycastHit)(ref current)).collider).gameObject;
							}
						}
						JLogHelper.LogInfo($"{((Object)((RaycastHit)(ref current)).transform).name} {flag3}", (JLogLevel)2);
						if (flag3 && (Object)(object)val2 != (Object)null && !list2.Contains(val2) && OnWeaponHit(val, forward))
						{
							list2.Add(val2);
							if (!flag)
							{
								flag = true;
							}
							if (!flag2)
							{
								flag2 = true;
							}
							ColliderType val6 = val3;
							ColliderType val7 = val6;
							switch ((int)val7)
							{
							case 0:
							{
								OnPlayerHit.Invoke(((Component)((RaycastHit)(ref current)).collider).GetComponent<PlayerControllerB>());
								ParticleSystem obj2 = bloodParticle;
								if (obj2 != null)
								{
									obj2.Play(true);
								}
								break;
							}
							case 1:
							{
								OnEnemyHit.Invoke(((Component)((RaycastHit)(ref current)).collider).GetComponent<EnemyAICollisionDetect>().mainScript);
								ParticleSystem obj = bloodParticle;
								if (obj != null)
								{
									obj.Play(true);
								}
								break;
							}
							case 3:
								OnObjectHit.Invoke(val);
								break;
							}
						}
					}
					if (damageVehicles && ((Component)((RaycastHit)(ref current)).collider).TryGetComponent<VehicleController>(ref val8) && !list2.Contains(((Component)val8).gameObject))
					{
						list2.Add(((Component)val8).gameObject);
						flag = true;
						val8.PushTruckServerRpc(((Component)previousPlayerHeldBy).transform.position, forward);
						VehicleControllerPatch.DealPermanentDamage((object)val8, HitForce, ((Component)previousPlayerHeldBy).transform.position);
						OnVehicleHit.Invoke(val8);
					}
				}
			}
			if (flag)
			{
				timeAtLastDamageDealt = Time.realtimeSinceStartup;
				PlayRandomSFX(hitSFX);
				RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 17f, 0.8f, 0, false, 0);
				if (!flag2 && num != -1)
				{
					weaponAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX);
					WalkieTalkie.TransmitOneShotAudio(weaponAudio, StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX, 1f);
				}
				if (isHeavyWeapon)
				{
					((GrabbableObject)this).playerHeldBy.playerBodyAnimator.SetTrigger("shovelHit");
				}
				HitWeaponServerRpc(num);
			}
			return flag;
		}

		public virtual bool OnWeaponHit(IHittable target, Vector3 hitDir)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			return target.Hit(HitForce, hitDir, previousPlayerHeldBy, true, 1);
		}

		[ServerRpc]
		public void HitWeaponServerRpc(int hitSurfaceID)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1250179881u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, hitSurfaceID);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1250179881u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				HitWeaponClientRpc(hitSurfaceID);
			}
		}

		[ClientRpc]
		public void HitWeaponClientRpc(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(209898509u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, hitSurfaceID);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 209898509u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				PlayRandomSFX(hitSFX);
				OnHitSuccess.Invoke(previousPlayerHeldBy);
				if (hitSurfaceID != -1)
				{
					HitSurface(hitSurfaceID);
				}
			}
		}

		private void PlayRandomSFX(AudioClip[] clips)
		{
			if (clips.Length > 1)
			{
				RoundManager.PlayRandomClip(weaponAudio, clips, true, 1f, 0, 1000);
			}
			else if (clips.Length == 1)
			{
				weaponAudio.PlayOneShot(clips[0], Random.Range(0.82f, 1f));
			}
		}

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

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_JMeleeWeapon()
		{
			//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(3259025159u, new RpcReceiveHandler(__rpc_handler_3259025159));
			NetworkManager.__rpc_func_table.Add(2764645124u, new RpcReceiveHandler(__rpc_handler_2764645124));
			NetworkManager.__rpc_func_table.Add(1250179881u, new RpcReceiveHandler(__rpc_handler_1250179881));
			NetworkManager.__rpc_func_table.Add(209898509u, new RpcReceiveHandler(__rpc_handler_209898509));
		}

		private static void __rpc_handler_3259025159(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((JMeleeWeapon)(object)target).ReelUpSFXServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2764645124(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;
				((JMeleeWeapon)(object)target).ReelUpSFXClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1250179881(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				int hitSurfaceID = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref hitSurfaceID);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((JMeleeWeapon)(object)target).HitWeaponServerRpc(hitSurfaceID);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_209898509(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;
				((JMeleeWeapon)(object)target).HitWeaponClientRpc(hitSurfaceID);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "JMeleeWeapon";
		}
	}
	public class JNoisemakerProp : JGrabbableObject
	{
		[Header("Noisemaker")]
		public bool isToggle = false;

		public bool waitForCompletion = false;

		private float activeClipLength = 0f;

		private float lastUsedTime = 0f;

		[Space(5f)]
		public AudioClip[] noiseSFX = (AudioClip[])(object)new AudioClip[0];

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

		public AudioSource noiseAudio;

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

		public AudioSource noiseAudioFar;

		[Space(3f)]
		[Tooltip("Airhorn: 65\nCash Register: 25\nClown Horn: 60\nHair Dryer: 30")]
		public float noiseRange = 60f;

		[Tooltip("Airhorn: 1\nCash Register: 1\nClown Horn: 1\nHair Dryer: 0.9")]
		public float maxLoudness = 1f;

		[Tooltip("Airhorn: 0.95\nCash Register: 0.9\nClown Horn: 0.6\nHair Dryer: 0.8")]
		public float minLoudness = 0.6f;

		[Tooltip("Airhorn: 1\nCash Register: 1\nClown Horn: 1\nHair Dryer: 1")]
		public float maxPitch = 1f;

		[Tooltip("Airhorn: 0.8\nCash Register: 0.95\nClown Horn: 0.93\nHair Dryer: 0.96")]
		public float minPitch = 0.93f;

		private Random noisemakerRandom;

		public Animator? triggerAnimator;

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

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (Time.realtimeSinceStartup - lastUsedTime < activeClipLength)
			{
				if (isToggle)
				{
					if ((Object)(object)noiseAudio != (Object)null)
					{
						noiseAudio.Stop();
						if (disableSFX.Length != 0)
						{
							int num = noisemakerRandom.Next(0, disableSFX.Length);
							float num2 = (float)noisemakerRandom.Next((int)(minLoudness * 100f), (int)(maxLoudness * 100f)) / 100f;
							float pitch = (float)noisemakerRandom.Next((int)(minPitch * 100f), (int)(maxPitch * 100f)) / 100f;
							noiseAudio.pitch = pitch;
							noiseAudio.PlayOneShot(disableSFX[num], num2);
						}
					}
					AudioSource obj = noiseAudioFar;
					if (obj != null)
					{
						obj.Stop();
					}
					activeClipLength = 0f;
					return;
				}
				if (waitForCompletion)
				{
					return;
				}
			}
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
			{
				int num3 = noisemakerRandom.Next(0, noiseSFX.Length);
				float num4 = (float)noisemakerRandom.Next((int)(minLoudness * 100f), (int)(maxLoudness * 100f)) / 100f;
				float pitch2 = (float)noisemakerRandom.Next((int)(minPitch * 100f), (int)(maxPitch * 100f)) / 100f;
				activeClipLength = noiseSFX[num3].length;
				lastUsedTime = Time.realtimeSinceStartup;
				if ((Object)(object)noiseAudio != (Object)null)
				{
					noiseAudio.pitch = pitch2;
					noiseAudio.PlayOneShot(noiseSFX[num3], num4);
				}
				if ((Object)(object)noiseAudioFar != (Object)null && num3 < noiseSFXFar.Length)
				{
					noiseAudioFar.pitch = pitch2;
					noiseAudioFar.PlayOneShot(noiseSFXFar[num3], num4);
				}
				Animator? obj2 = triggerAnimator;
				if (obj2 != null)
				{
					obj2.SetTrigger("playAnim");
				}
				WalkieTalkie.TransmitOneShotAudio(noiseAudio, noiseSFX[num3], num4);
				RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, noiseRange, num4, 0, ((GrabbableObject)this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
				if (minLoudness >= 0.6f && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
				{
					((GrabbableObject)this).playerHeldBy.timeSinceMakingLoudNoise = 0f;
				}
			}
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "JNoisemakerProp";
		}
	}
	public class JThrowableItem : JGrabbableObject
	{
		[Header("Throwable Item")]
		public bool throwable = true;

		public string throwString = "Throw grenade: [RMB]";

		private LayerMask projectileMask = LayerMask.op_Implicit(268437761);

		public AnimationCurve projectileFallCurve;

		public AnimationCurve projectileVerticalFallCurve;

		public AnimationCurve projectileVerticalFallCurveNoBounce;

		[Header("Explosion Settings")]
		public bool damageOnExplode = false;

		public bool stunOnExplode = false;

		public bool spawnItemsOnExplode = false;

		public GameObject? explosionPrefab;

		public bool hasExploded = false;

		[Tooltip("Random chance is rolled on impact. If interaction is required then explosion chance will only be rolled on collisions after the interaction has been performed")]
		public float chanceToExplodeOnThrow = 100f;

		[Tooltip("Random chance is rolled on impact. If interaction is required then explosion chance will only be rolled on collisions after the interaction has been performed")]
		public float chanceToExplodeOnDropped = 100f;

		public bool destroyOnExplode = false;

		[Header("Interact Before Throw")]
		public bool hasInteraction = false;

		public string interactString = "Pull pin: [RMB]";

		public string playerAnimation = "PullGrenadePin";

		public bool interactedWith = false;

		private bool inInteractAnimation = false;

		private Coroutine? interactCoroutine;

		public bool interactionStartsTimer = false;

		[Tooltip("Waits timeToExplode before exploding. If interactionStartsTimer is checked the timer will have to run twice for the explosion to occur.")]
		[FormerlySerializedAs("explodeOnTimer")]
		public bool explosionStartsTimer = false;

		private bool markedToExplode = false;

		public float timeToExplode = 2.25f;

		private float explodeTimer = 0f;

		[Header("Explosion Properties")]
		public float killDistance = 0.5f;

		public float damageRange = 3f;

		public int nonLethalDamage = 40;

		public float pushForce = 45f;

		public bool goThroughCar = false;

		[Header("Stun Explosion Properties")]
		public bool affectAudio = true;

		public float flashSeverityMultiplier = 1f;

		public float enemyStunTime = 7.5f;

		public float flashSeverityDistanceRolloff = 1f;

		[Header("Item Spawner")]
		[Tooltip("How many items get spawned in")]
		public int numberToSpawn = 1;

		public SpawnPoolSource SourcePool = (SpawnPoolSource)0;

		public WeightedItemRefrence[] CustomList = (WeightedItemRefrence[])(object)new WeightedItemRefrence[1]
		{
			new WeightedItemRefrence()
		};

		[Tooltip("Spawn offsets. Index is the number spawned")]
		public Vector3[] SpawnOffsets = (Vector3[])(object)new Vector3[0];

		[Header("Events")]
		public UnityEvent ExplodeEvent = new UnityEvent();

		public InteractEvent ThrowEvent = new InteractEvent();

		public InteractEvent InteractionEvent = new InteractEvent();

		public InteractEvent CollisionEvent = new InteractEvent();

		[Header("FX")]
		[Tooltip("Trigger: \"pullPin\"\nTrigger: \"explode\"")]
		public Animator? itemAnimator;

		public AudioSource itemAudio;

		public AudioClip? interactSFX;

		public AudioClip? explodeSFX;

		private bool explodeOnThrow = false;

		private bool explodeOnDrop = false;

		private bool wasThrown = false;

		private PlayerControllerB? playerThrownBy;

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (inInteractAnimation)
			{
				return;
			}
			if (hasInteraction && !interactedWith)
			{
				if (interactCoroutine == null)
				{
					((GrabbableObject)this).playerHeldBy.activatingItem = true;
					interactCoroutine = ((MonoBehaviour)this).StartCoroutine(interactAnimation());
				}
			}
			else if (((NetworkBehaviour)this).IsOwner && throwable)
			{
				ThrowItem();
			}
		}

		public virtual void ThrowItem()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			wasThrown = true;
			((UnityEvent<PlayerControllerB>)(object)ThrowEvent).Invoke(((GrabbableObject)this).playerHeldBy);
			((GrabbableObject)this).playerHeldBy.DiscardHeldObject(true, (NetworkObject)null, GetThrowDestination(), true);
		}

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

		public override void EquipItem()
		{
			base.EquipItem();
			playerThrownBy = ((GrabbableObject)this).playerHeldBy;
			explodeOnThrow = false;
			explodeOnDrop = false;
			wasThrown = false;
			SetExplodeOnThrowServerRpc();
		}

		[ServerRpc(RequireOwnership = false)]
		public void SetExplodeOnThrowServerRpc()
		{
			//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_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4058280918u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4058280918u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					SetExplodeOnThrowClientRpc(new Random(StartOfRound.Instance.randomMapSeed + 10 + (int)((Component)this).transform.position.x + (int)((Component)this).transform.position.z).Next(0, 100));
				}
			}
		}

		[ClientRpc]
		public void SetExplodeOnThrowClientRpc(int random)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(217367956u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, random);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 217367956u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					explodeOnThrow = (float)random <= chanceToExplodeOnThrow;
					explodeOnDrop = (float)random <= chanceToExplodeOnDropped;
				}
			}
		}

		public override void SetControlTipsForItem()
		{
			List<string> list = new List<string>();
			list.AddRange(((GrabbableObject)this).itemProperties.toolTips);
			if (hasInteraction && !interactedWith)
			{
				list.Add(interactString);
			}
			else if (throwable)
			{
				list.Add(throwString);
			}
			HUDManager.Instance.ChangeControlTipMultiple(list.ToArray(), true, ((GrabbableObject)this).itemProperties);
		}

		public override void FallWithCurve()
		{
			//IL_0002: 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_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_005c: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((GrabbableObject)this).startFallingPosition - ((GrabbableObject)this).targetFloorPosition;
			float magnitude = ((Vector3)(ref val)).magnitude;
			((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(((GrabbableObject)this).itemProperties.restingRotation.x, ((Component)this).transform.eulerAngles.y, ((GrabbableObject)this).itemProperties.restingRotation.z), 14f * Time.deltaTime / magnitude);
			((Component)this).transform.localPosition = Vector3.Lerp(((GrabbableObject)this).startFallingPosition, ((GrabbableObject)this).targetFloorPosition, projectileFallCurve.Evaluate(((GrabbableObject)this).fallTime));
			if (magnitude > 5f)
			{
				((Component)this).transform.localPosition = Vector3.Lerp(new Vector3(((Component)this).transform.localPosition.x, ((GrabbableObject)this).startFallingPosition.y, ((Component)this).transform.localPosition.z), new Vector3(((Component)this).transform.localPosition.x, ((GrabbableObject)this).targetFloorPosition.y, ((Component)this).transform.localPosition.z), projectileVerticalFallCurveNoBounce.Evaluate(((GrabbableObject)this).fallTime));
			}
			else
			{
				((Component)this).transform.localPosition = Vector3.Lerp(new Vector3(((Component)this).transform.localPosition.x, ((GrabbableObject)this).startFallingPosition.y, ((Component)this).transform.localPosition.z), new Vector3(((Component)this).transform.localPosition.x, ((GrabbableObject)this).targetFloorPosition.y, ((Component)this).transform.localPosition.z), projectileVerticalFallCurve.Evaluate(((GrabbableObject)this).fallTime));
			}
			((GrabbableObject)this).fallTime = ((GrabbableObject)this).fallTime + Mathf.Abs(Time.deltaTime * 12f / magnitude);
		}

		private IEnumerator interactAnimation()
		{
			inInteractAnimation = true;
			((GrabbableObject)this).playerHeldBy.activatingItem = true;
			((GrabbableObject)this).playerHeldBy.doingUpperBodyEmote = 1.16f;
			((GrabbableObject)this).playerHeldBy.playerBodyAnimator.SetTrigger(playerAnimation);
			Animator? obj = itemAnimator;
			if (obj != null)
			{
				obj.SetTrigger("pullPin");
			}
			if (Object.op_Implicit((Object)(object)itemAudio) && (Object)(object)interactSFX != (Object)null)
			{
				itemAudio.PlayOneShot(interactSFX);
				WalkieTalkie.TransmitOneShotAudio(itemAudio, interactSFX, 0.8f);
			}
			((UnityEvent<PlayerControllerB>)(object)InteractionEvent).Invoke(((GrabbableObject)this).playerHeldBy);
			yield return (object)new WaitForSeconds(1f);
			if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
			{
				if (!destroyOnExplode)
				{
					((GrabbableObject)this).playerHeldBy.activatingItem = false;
				}
				playerThrownBy = ((GrabbableObject)this).playerHeldBy;
			}
			inInteractAnimation = false;
			interactedWith = true;
			((GrabbableObject)this).itemUsedUp = true;
			if (((NetworkBehaviour)this).IsOwner && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
			{
				((GrabbableObject)this).SetControlTipsForItem();
			}
		}

		public override void Update()
		{
			((GrabbableObject)this).Update();
			if (((!interactionStartsTimer || !interactedWith) && (!explosionStartsTimer || !markedToExplode)) || hasExploded)
			{
				return;
			}
			explodeTimer += Time.deltaTime;
			if (explodeTimer > timeToExplode)
			{
				if (interactionStartsTimer && explosionStartsTimer && !markedToExplode)
				{
					markedToExplode = true;
					explodeTimer = 0f;
				}
				else
				{
					ExplodeProjectile(destroyOnExplode);
				}
			}
		}

		public override void Start()
		{
			((GrabbableObject)this).Start();
			if (!hasInteraction)
			{
				interactedWith = true;
			}
		}

		public override void OnHitGround()
		{
			((GrabbableObject)this).OnHitGround();
			if ((Object)(object)playerThrownBy != (Object)null && (!hasInteraction || interactedWith))
			{
				((UnityEvent<PlayerControllerB>)(object)CollisionEvent).Invoke(playerThrownBy);
				OnItemCollision(wasThrown);
			}
		}

		public virtual void OnItemCollision(bool thrown)
		{
			if ((thrown && explodeOnThrow) || (!thrown && explodeOnDrop))
			{
				ExplodeProjectile(destroyOnExplode);
			}
		}

		public void ExplodeProjectile(bool destroy = false)
		{
			if (hasExploded)
			{
				return;
			}
			if (!StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap && (Object)(object)((GrabbableObject)this).parentObject == (Object)(object)Object.FindObjectOfType<DepositItemsDesk>().deskObjectsContainer)
			{
				if ((Object)(object)playerThrownBy != (Object)null)
				{
					playerThrownBy.activatingItem = false;
				}
				return;
			}
			Animator? obj = itemAnimator;
			if (obj != null)
			{
				obj.SetTrigger("explode");
			}
			if (explosionStartsTimer && !markedToExplode)
			{
				markedToExplode = true;
				return;
			}
			hasExploded = true;
			ExplodeEvent.Invoke();
			Transform parent = ((!((GrabbableObject)this).isInElevator) ? RoundManager.Instance.mapPropsContainer.transform : StartOfRound.Instance.elevatorTransform);
			CreateExplosion(parent);
			if (destroy)
			{
				((GrabbableObject)this).DestroyObjectInHand(playerThrownBy);
			}
		}

		public virtual void CreateExplosion(Transform parent)
		{
			//IL_0012: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			if (damageOnExplode)
			{
				Landmine.SpawnExplosion(((Component)this).transform.position, false, killDistance, damageRange, nonLethalDamage, pushForce, (GameObject)null, goThroughCar);
			}
			if (stunOnExplode)
			{
				StunGrenadeItem.StunExplosion(((Component)this).transform.position, affectAudio, flashSeverityMultiplier, enemyStunTime, flashSeverityDistanceRolloff, ((GrabbableObject)this).isHeld, ((GrabbableObject)this).playerHeldBy, playerThrownBy, 0f);
			}
			if (spawnItemsOnExplode)
			{
				SpawnItemsOnServer(numberToSpawn);
			}
			if ((Object)(object)explosionPrefab != (Object)null)
			{
				Object.Instantiate<GameObject>(explosionPrefab, ((Component)this).transform.position, Quaternion.identity, parent);
			}
			if (Object.op_Implicit((Object)(object)itemAudio) && (Object)(object)explodeSFX != (Object)null)
			{
				itemAudio.PlayOneShot(explodeSFX);
				WalkieTalkie.TransmitOneShotAudio(itemAudio, explodeSFX, 1f);
			}
		}

		public void ResetExplosionTimer()
		{
			explodeTimer = 0f;
		}

		public void SpawnItemsOnServer(int amount)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((Component)this).transform.position + Vector3.up * 0.25f;
			Transform val2 = ((!((GrabbableObject)this).isInElevator) ? RoundManager.Instance.mapPropsContainer.transform : StartOfRound.Instance.elevatorTransform);
			ItemSpawner.SpawnRandomItems(SourcePool, val, val2, CustomList, SpawnOffsets, amount, true, (RotationType)2);
		}

		public Vector3 GetThrowDestination()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: 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_0081: 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)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = ((Component)this).transform.position;
			Debug.DrawRay(((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.position, ((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.forward, Color.yellow, 15f);
			Ray val = default(Ray);
			((Ray)(ref val))..ctor(((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.position, ((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.forward);
			RaycastHit val2 = default(RaycastHit);
			position = ((!Physics.Raycast(val, ref val2, 12f, LayerMask.op_Implicit(projectileMask), (QueryTriggerInteraction)1)) ? ((Ray)(ref val)).GetPoint(10f) : ((Ray)(ref val)).GetPoint(((RaycastHit)(ref val2)).distance - 0.05f));
			Debug.DrawRay(position, Vector3.down, Color.blue, 15f);
			((Ray)(ref val))..ctor(position, Vector3.down);
			if (Physics.Raycast(val, ref val2, 30f, LayerMask.op_Implicit(projectileMask), (QueryTriggerInteraction)1))
			{
				return ((RaycastHit)(ref val2)).point + Vector3.up * 0.05f;
			}
			return ((Ray)(ref val)).GetPoint(30f);
		}

		private void OnDrawGizmosSelected()
		{
			//IL_001e: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			if (damageOnExplode)
			{
				if (killDistance > 0f)
				{
					Gizmos.color = Color.red;
					Gizmos.DrawWireSphere(((Component)this).transform.position, killDistance);
				}
				if (damageRange > 0f)
				{
					Gizmos.color = Color.yellow;
					Gizmos.DrawWireSphere(((Component)this).transform.position, damageRange);
				}
			}
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_JThrowableItem()
		{
			//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(4058280918u, new RpcReceiveHandler(__rpc_handler_4058280918));
			NetworkManager.__rpc_func_table.Add(217367956u, new RpcReceiveHandler(__rpc_handler_217367956));
		}

		private static void __rpc_handler_4058280918(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;
				((JThrowableItem)(object)target).SetExplodeOnThrowServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_217367956(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 explodeOnThrowClientRpc = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref explodeOnThrowClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((JThrowableItem)(object)target).SetExplodeOnThrowClientRpc(explodeOnThrowClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "JThrowableItem";
		}
	}
}
namespace JLLItemsModule.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}