Decompiled source of LethalThingsReloaded v0.11.0

plugins/LethalThings.dll

Decompiled 3 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Dawn;
using GameNetcodeStuff;
using HatLib.Tools;
using IL;
using IL.GameNetcodeStuff;
using LethalCompanyInputUtils.Api;
using LethalCompanyInputUtils.BindingPathEnums;
using LethalThings.MonoBehaviours;
using LethalThings.NetcodePatcher;
using LethalThings.Patches;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On;
using On.GameNetcodeStuff;
using TMPro;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.InputSystem.Utilities;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[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("LethalThings")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.11.0.0")]
[assembly: AssemblyInformationalVersion("0.11.0")]
[assembly: AssemblyProduct("LethalThings")]
[assembly: AssemblyTitle("LethalThings")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.11.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LethalThings
{
	public static class Content
	{
		public static void Init()
		{
			Item item = ((Registry<DawnItemInfo>)(object)LethalContent.Items)[Keys.RocketLauncher].Item;
			DawnLib.RegisterNetworkPrefab(item.spawnPrefab.GetComponent<RocketLauncher>().MissilePrefab);
			Item item2 = ((Registry<DawnItemInfo>)(object)LethalContent.Items)[Keys.Flaregun].Item;
			DawnLib.RegisterNetworkPrefab(item2.spawnPrefab.GetComponent<ProjectileWeapon>().ProjectilePrefab);
			Item item3 = ((Registry<DawnItemInfo>)(object)LethalContent.Items)[Keys.Dart].Item;
			DawnLib.RegisterNetworkPrefab(item3.spawnPrefab.GetComponent<Dart>().ProjectilePrefab);
		}
	}
	public static class EXPLOOOOOOOOOOOSIONUtilities
	{
		private static readonly Collider[] ExplosionColliders = (Collider[])(object)new Collider[128];

		public static void CreateExplosion(Vector3 explosionPosition, bool spawnExplosionEffect = false, int damage = 20, float minDamageRange = 0f, float maxDamageRange = 1f, int enemyHitForce = 6, CauseOfDeath causeOfDeath = (CauseOfDeath)3, PlayerControllerB attacker = null, string explosionName = null)
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: 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_0042: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: 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_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			if (spawnExplosionEffect)
			{
				RoundManager instance = RoundManager.Instance;
				object obj;
				if (instance == null)
				{
					obj = null;
				}
				else
				{
					GameObject mapPropsContainer = instance.mapPropsContainer;
					obj = ((mapPropsContainer != null) ? mapPropsContainer.transform : null);
				}
				Transform val = (Transform)obj;
				Object.Instantiate<GameObject>(StartOfRound.Instance.explosionPrefab, explosionPosition, Quaternion.Euler(-90f, 0f, 0f), val).SetActive(true);
			}
			float num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, explosionPosition);
			if (num < 14f)
			{
				HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
			}
			else if (num < 25f)
			{
				HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
			}
			bool flag = false;
			int num2 = Physics.OverlapSphereNonAlloc(explosionPosition, maxDamageRange, ExplosionColliders, 2621448, (QueryTriggerInteraction)2);
			RaycastHit val3 = default(RaycastHit);
			for (int i = 0; i < num2; i++)
			{
				Collider val2 = ExplosionColliders[i];
				float num3 = Vector3.Distance(explosionPosition, ((Component)val2).transform.position);
				if (Physics.Linecast(explosionPosition, ((Component)val2).transform.position + Vector3.up * 0.3f, ref val3, 1073742080, (QueryTriggerInteraction)1) && num3 > 4f)
				{
					continue;
				}
				if (((Component)val2).gameObject.layer == 3 && !flag)
				{
					PlayerControllerB component = ((Component)val2).gameObject.GetComponent<PlayerControllerB>();
					if (component != null && ((NetworkBehaviour)component).IsOwner)
					{
						flag = true;
						float num4 = 1f - Mathf.Clamp01((num3 - minDamageRange) / (maxDamageRange - minDamageRange));
						int num5 = (int)((float)damage * num4);
						component.DamagePlayer(num5, true, true, causeOfDeath, 0, false, default(Vector3));
						if (!string.IsNullOrEmpty(explosionName))
						{
							Log.Debug($"{explosionName} dealt {num5} damage to the local player.");
						}
					}
				}
				else if (((Component)val2).gameObject.layer == 21)
				{
					Landmine componentInChildren = ((Component)val2).gameObject.GetComponentInChildren<Landmine>();
					if (componentInChildren != null && !componentInChildren.hasExploded && num3 < 6f)
					{
						((MonoBehaviour)componentInChildren).StartCoroutine(componentInChildren.TriggerOtherMineDelayed(componentInChildren));
					}
				}
				else
				{
					if (((Component)val2).gameObject.layer != 19)
					{
						continue;
					}
					EnemyAICollisionDetect componentInChildren2 = ((Component)val2).gameObject.GetComponentInChildren<EnemyAICollisionDetect>();
					if (componentInChildren2 != null && ((NetworkBehaviour)componentInChildren2.mainScript).IsOwner && (double)num3 < 4.5)
					{
						EnemyAI mainScript = componentInChildren2.mainScript;
						mainScript.HitEnemyOnLocalClient(enemyHitForce, default(Vector3), attacker, false, -1);
						if (!string.IsNullOrEmpty(explosionName))
						{
							Log.Debug($"{explosionName} hit enemy {mainScript.enemyType.enemyName} with force {enemyHitForce}");
						}
					}
				}
			}
			int num6 = ~LayerMask.GetMask(new string[1] { "Colliders" });
			num2 = Physics.OverlapSphereNonAlloc(explosionPosition, 10f, ExplosionColliders, num6);
			Rigidbody val4 = default(Rigidbody);
			for (int j = 0; j < num2; j++)
			{
				if (((Component)ExplosionColliders[j]).TryGetComponent<Rigidbody>(ref val4))
				{
					val4.AddExplosionForce(70f, explosionPosition, 10f);
				}
			}
		}
	}
	public static class InputUtilsCompat
	{
		private static bool itemActionsSubscribed;

		public static InputAction LTUtilityBeltQuick1 => Keybinds.Instance.LTUtilityBeltQuick1;

		public static InputAction LTUtilityBeltQuick2 => Keybinds.Instance.LTUtilityBeltQuick2;

		public static InputAction LTUtilityBeltQuick3 => Keybinds.Instance.LTUtilityBeltQuick3;

		public static InputAction FlaregunReload => ItemKeybinds.Instance.FlaregunReload;

		public static InputAction HackingToolPower => ItemKeybinds.Instance.HackingToolPower;

		public static InputAction HackingToolMode => ItemKeybinds.Instance.HackingToolMode;

		public static InputAction PingerPower => ItemKeybinds.Instance.PingerPower;

		public static InputAction HandheldRadarPower => ItemKeybinds.Instance.HandheldRadarPower;

		public static InputAction RocketLauncherLaser => ItemKeybinds.Instance.RocketLauncherLaser;

		public static InputAction RocketLauncherReload => ItemKeybinds.Instance.RocketLauncherReload;

		public static void Init()
		{
			if (Keybinds.Instance == null)
			{
				Keybinds.Instance = new Keybinds();
			}
			if (ItemKeybinds.Instance == null)
			{
				ItemKeybinds.Instance = new ItemKeybinds();
			}
			if (!itemActionsSubscribed)
			{
				FlaregunReload.performed += ReloadFlaregun;
				HackingToolPower.performed += ToggleHackingToolPower;
				HackingToolMode.performed += ToggleHackingToolMode;
				PingerPower.performed += TogglePingerPower;
				HandheldRadarPower.performed += ToggleHandheldRadarPower;
				RocketLauncherLaser.performed += ToggleRocketLauncherLaser;
				RocketLauncherReload.performed += ReloadRocketLauncher;
				itemActionsSubscribed = true;
			}
		}

		public static string BindingText(InputAction action)
		{
			//IL_0018: 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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			if (action == null)
			{
				return "Unbound";
			}
			string text = null;
			Enumerator<InputBinding> enumerator = action.bindings.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					InputBinding current = enumerator.Current;
					if (((InputBinding)(ref current)).isComposite || ((InputBinding)(ref current)).isPartOfComposite || string.IsNullOrWhiteSpace(((InputBinding)(ref current)).effectivePath))
					{
						continue;
					}
					string text2 = InputControlPath.ToHumanReadableString(((InputBinding)(ref current)).effectivePath, (HumanReadableStringOptions)2, (InputControl)null);
					if (!string.IsNullOrWhiteSpace(text2))
					{
						string text3 = FormatBindingText(text2);
						if (((InputBinding)(ref current)).effectivePath.StartsWith("<Keyboard>", StringComparison.Ordinal) || ((InputBinding)(ref current)).effectivePath.StartsWith("<Mouse>", StringComparison.Ordinal))
						{
							return text3;
						}
						if (text == null)
						{
							text = text3;
						}
					}
				}
			}
			finally
			{
				((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose();
			}
			return text ?? "Unbound";
		}

		private static string FormatBindingText(string bindingText)
		{
			if (1 == 0)
			{
			}
			string result;
			switch (bindingText)
			{
			case "Left Button":
			case "Left Click":
				result = "L.Click";
				break;
			case "Right Button":
			case "Right Click":
				result = "R.Click";
				break;
			case "Middle Button":
			case "Middle Click":
				result = "M.Click";
				break;
			case "Left Arrow":
				result = "L.Arrow";
				break;
			case "Right Arrow":
				result = "R.Arrow";
				break;
			case "Up Arrow":
				result = "U.Arrow";
				break;
			case "Down Arrow":
				result = "D.Arrow";
				break;
			case "Left Shift":
				result = "L.Shift";
				break;
			case "Right Shift":
				result = "R.Shift";
				break;
			case "Left Ctrl":
			case "Left Control":
				result = "L.Ctrl";
				break;
			case "Right Ctrl":
			case "Right Control":
				result = "R.Ctrl";
				break;
			case "Left Alt":
				result = "L.Alt";
				break;
			case "Right Alt":
				result = "R.Alt";
				break;
			case "Escape":
				result = "Esc";
				break;
			default:
				result = bindingText;
				break;
			}
			if (1 == 0)
			{
			}
			return result;
		}

		private static void ReloadFlaregun(CallbackContext _)
		{
			if (GameNetworkManager.Instance?.localPlayerController?.currentlyHeldObjectServer is ProjectileWeapon projectileWeapon)
			{
				((GrabbableObject)projectileWeapon).ItemInteractLeftRight(false);
			}
		}

		private static void ToggleHackingToolPower(CallbackContext _)
		{
			if (GameNetworkManager.Instance?.localPlayerController?.currentlyHeldObjectServer is HackingTool hackingTool)
			{
				hackingTool.TogglePower();
			}
		}

		private static void ToggleHackingToolMode(CallbackContext _)
		{
			if (GameNetworkManager.Instance?.localPlayerController?.currentlyHeldObjectServer is HackingTool hackingTool)
			{
				hackingTool.ToggleHackMode();
			}
		}

		private static void TogglePingerPower(CallbackContext _)
		{
			if (GameNetworkManager.Instance?.localPlayerController?.currentlyHeldObjectServer is Pinger pinger)
			{
				((GrabbableObject)pinger).ItemInteractLeftRight(false);
			}
		}

		private static void ToggleHandheldRadarPower(CallbackContext _)
		{
			if (GameNetworkManager.Instance?.localPlayerController?.currentlyHeldObjectServer is HandheldRadar handheldRadar)
			{
				((GrabbableObject)handheldRadar).ItemInteractLeftRight(false);
			}
		}

		private static void ToggleRocketLauncherLaser(CallbackContext _)
		{
			if (GameNetworkManager.Instance?.localPlayerController?.currentlyHeldObjectServer is RocketLauncher rocketLauncher)
			{
				((GrabbableObject)rocketLauncher).ItemInteractLeftRight(false);
			}
		}

		private static void ReloadRocketLauncher(CallbackContext _)
		{
			if (GameNetworkManager.Instance?.localPlayerController?.currentlyHeldObjectServer is RocketLauncher rocketLauncher)
			{
				rocketLauncher.Reload();
			}
		}
	}
	public class Keybinds : LcInputActions
	{
		public static Keybinds Instance;

		[InputAction("", Name = "[LT] Utility Belt Quick 1")]
		public InputAction LTUtilityBeltQuick1 { get; set; }

		[InputAction("", Name = "[LT] Utility Belt Quick 2")]
		public InputAction LTUtilityBeltQuick2 { get; set; }

		[InputAction("", Name = "[LT] Utility Belt Quick 3")]
		public InputAction LTUtilityBeltQuick3 { get; set; }
	}
	public class ItemKeybinds : LcInputActions
	{
		public static ItemKeybinds Instance;

		public InputAction FlaregunReload => ((LcInputActions)this).Asset["flaregun_reload"];

		public InputAction HackingToolPower => ((LcInputActions)this).Asset["hacking_tool_power_toggle"];

		public InputAction HackingToolMode => ((LcInputActions)this).Asset["hacking_tool_mode_toggle"];

		public InputAction PingerPower => ((LcInputActions)this).Asset["pinger_power"];

		public InputAction HandheldRadarPower => ((LcInputActions)this).Asset["handheld_radar_power"];

		public InputAction RocketLauncherLaser => ((LcInputActions)this).Asset["rocket_launcher_laser"];

		public InputAction RocketLauncherReload => ((LcInputActions)this).Asset["rocket_launcher_reload"];

		public override void CreateInputActions(in InputActionMapBuilder builder)
		{
			builder.NewActionBinding().WithActionId("flaregun_reload").WithActionType((InputActionType)1)
				.WithKeyboardControl((KeyboardControl)37)
				.WithBindingName("Flaregun Reload")
				.Finish();
			builder.NewActionBinding().WithActionId("hacking_tool_power_toggle").WithActionType((InputActionType)1)
				.WithKeyboardControl((KeyboardControl)37)
				.WithBindingName("Hacking Tool Power Toggle")
				.Finish();
			builder.NewActionBinding().WithActionId("hacking_tool_mode_toggle").WithActionType((InputActionType)1)
				.WithKeyboardControl((KeyboardControl)25)
				.WithBindingName("Hacking Tool Mode Toggle")
				.Finish();
			builder.NewActionBinding().WithActionId("pinger_power").WithActionType((InputActionType)1)
				.WithKeyboardControl((KeyboardControl)37)
				.WithBindingName("Pinger Power")
				.Finish();
			builder.NewActionBinding().WithActionId("handheld_radar_power").WithActionType((InputActionType)1)
				.WithKeyboardControl((KeyboardControl)37)
				.WithBindingName("Handheld Radar Power")
				.Finish();
			builder.NewActionBinding().WithActionId("rocket_launcher_laser").WithActionType((InputActionType)1)
				.WithKeyboardControl((KeyboardControl)37)
				.WithBindingName("Rocket Launcher Laser")
				.Finish();
			builder.NewActionBinding().WithActionId("rocket_launcher_reload").WithActionType((InputActionType)1)
				.WithKeyboardControl((KeyboardControl)38)
				.WithBindingName("Rocket Launcher Reload")
				.Finish();
		}
	}
	public static class Keys
	{
		public const string Namespace = "lethalthings";

		public static readonly NamespacedKey<DawnItemInfo> Flaregun = NamespacedKey<DawnItemInfo>.From("lethalthings", "flaregun");

		public static readonly NamespacedKey<DawnItemInfo> RocketLauncher = NamespacedKey<DawnItemInfo>.From("lethalthings", "rocket_launcher");

		public static readonly NamespacedKey<DawnItemInfo> Rocket = NamespacedKey<DawnItemInfo>.From("lethalthings", "rocket");

		public static readonly NamespacedKey<DawnItemInfo> Dart = NamespacedKey<DawnItemInfo>.From("lethalthings", "dart");

		public static readonly NamespacedKey<DawnItemInfo> CrystalCore = NamespacedKey<DawnItemInfo>.From("lethalthings", "crystal_core");

		public static readonly NamespacedKey DaysSinceLastFatality = NamespacedKey.From("lethalthings", "days_since_last_fatality");
	}
	public static class LethalThingsConfig
	{
		private const string DuskGuid = "HQ_Team.LethalThingsReloaded";

		private static readonly DuskConfigInjector DuskConfig = new DuskConfigInjector("HQ_Team.LethalThingsReloaded");

		public static ConfigEntry<float> evilMaxwellChance;

		public static ConfigEntry<bool> maxwellPlayMusicDefault;

		public static ConfigEntry<float> hackingToolConnectionTime;

		public static ConfigEntry<float> hackingToolBattery;

		public static ConfigEntry<int> hackingToolAnswerNumber;

		public static ConfigEntry<float> hackingToolHackDistance;

		public static ConfigEntry<float> hackingToolHackSpreadDistance;

		public static ConfigEntry<float> hackingToolDoorCooldown;

		public static ConfigEntry<float> hackingToolTurretDisableTime;

		public static ConfigEntry<float> hackingToolSpikeDisableTime;

		public static ConfigEntry<bool> hackingToolLandmineExplodeOnHack;

		public static ConfigEntry<float> hackingToolLandmineDisableTime;

		public static ConfigEntry<float> handheldRadarBattery;

		public static ConfigEntry<int> pingerMaxUses;

		public static ConfigEntry<float> pingerDuration;

		public static ConfigEntry<float> pingerRange;

		public static ConfigEntry<bool> preventForestGiantIgnition;

		public static ConfigEntry<int> dartboardStartingDarts;

		public static ConfigEntry<bool> enableItemChargerShortCircuit;

		public static ConfigEntry<int> itemChargerShortCircuitDamage;

		public static void Load()
		{
			evilMaxwellChance = Bind("Scrap", "MaxwellEvilChance", 10f, "Maxwell evil chance in percent. E.g. 10 = 10%");
			maxwellPlayMusicDefault = Bind("Scrap", "MaxwellPlayMusicDefault", defaultValue: true, "Maxwell plays music by default.");
			hackingToolConnectionTime = Bind("Hacking Tool", "ConnectionTime", 8f, "Connect time in seconds.");
			hackingToolBattery = Bind("Hacking Tool", "Battery", 200f, "Battery capacity.");
			hackingToolAnswerNumber = Bind("Hacking Tool", "AnswerNumber", 8, "Numbers in the hack answer.");
			hackingToolHackDistance = Bind("Hacking Tool", "HackDistance", 15f, "Hack range.");
			hackingToolHackSpreadDistance = Bind("Hacking Tool", "HackSpreadDistance", 20f, "Hack area around the target.");
			hackingToolDoorCooldown = Bind("Hacking Tool", "DoorCooldown", 5f, "Door hack cooldown in seconds.");
			hackingToolTurretDisableTime = Bind("Hacking Tool", "TurretDisableTime", 15f, "Turret disable time in seconds.");
			hackingToolSpikeDisableTime = Bind("Hacking Tool", "SpikeDisableTime", 10f, "Spike trap disable time in seconds.");
			hackingToolLandmineExplodeOnHack = Bind("Hacking Tool", "LandmineExplodeOnHack", defaultValue: true, "Landmines explode when hacked.");
			hackingToolLandmineDisableTime = Bind("Hacking Tool", "LandmineDisableTime", 10f, "Landmine disable time in seconds.");
			handheldRadarBattery = Bind("Handheld Radar", "Battery", 200f, "Battery capacity.");
			pingerMaxUses = Bind("Pinger", "MaxUses", 11, "Pings from one full battery.");
			pingerDuration = Bind("Pinger", "PingDuration", 8f, "Ping marker time in seconds.");
			pingerRange = Bind("Pinger", "PingRange", 80f, "Ping range.");
			preventForestGiantIgnition = Bind("Flaregun", "PreventForestGiantIgnition", defaultValue: false, "If true, flares do not set Forest Giants on fire.");
			dartboardStartingDarts = Bind("Dartboard", "StartingDarts", 3, "Darts spawned when a dartboard is created. Maximum 14.");
			enableItemChargerShortCircuit = Bind("Misc", "EnableItemChargerShortCircuit", defaultValue: true, "Conductive items can short circuit the ship.");
			itemChargerShortCircuitDamage = Bind("Misc", "ItemChargerShortCircuitDamage", 20, "Damage from the item charger short circuit.");
		}

		private static ConfigEntry<T> Bind<T>(string section, string settingName, T defaultValue, string description)
		{
			ConfigEntry<T> val = DuskConfig.Bind<T>(section, settingName, defaultValue, description);
			return val ?? throw new InvalidOperationException("Dusk config entry '" + section + "/" + settingName + "' could not be created.");
		}
	}
	internal static class Log
	{
		internal static void Debug(string message)
		{
			Write((LogLevel)32, message);
		}

		internal static void Info(string message)
		{
			Write((LogLevel)16, message);
		}

		internal static void Warn(string message)
		{
			Write((LogLevel)4, message);
		}

		internal static void Error(string message)
		{
			Write((LogLevel)2, message);
		}

		internal static void Fatal(string message)
		{
			Write((LogLevel)1, message);
		}

		private static void Write(LogLevel logLevel, string message)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Plugin.mls.Log(logLevel, (object)message);
		}
	}
	[BepInPlugin("HQ_Team.LethalThingsReloaded.Internals", "LethalThingsReloaded", "0.11.0")]
	[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 Plugin : BaseUnityPlugin
	{
		public const string ModGUID = "HQ_Team.LethalThingsReloaded.Internals";

		public const string ModName = "LethalThingsReloaded";

		public const string ModVersion = "0.11.0";

		internal static ManualLogSource mls;

		private void Awake()
		{
			mls = ((BaseUnityPlugin)this).Logger;
			InitialiseNetworkSerialisation();
			LethalThingsConfig.Load();
			Content.Init();
			LethalThings.Patches.Patches.Load();
			InputUtilsCompat.Init();
			Log.Info("LethalThingsReloaded loaded");
		}

		private static void InitialiseNetworkSerialisation()
		{
			MethodInfo methodInfo = typeof(Plugin).Assembly.GetType("__GEN.NetworkVariableSerializationHelper")?.GetMethod("InitializeSerialization", BindingFlags.Static | BindingFlags.NonPublic);
			if (methodInfo == null)
			{
				Log.Fatal("Netcode serialization method was not found");
			}
			else
			{
				methodInfo.Invoke(null, null);
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "LethalThings";

		public const string PLUGIN_NAME = "LethalThings";

		public const string PLUGIN_VERSION = "0.11.0";
	}
}
namespace LethalThings.Patches
{
	public static class Patches
	{
		public static void Load()
		{
			PowerOutletStun.Load();
			PouchyBeltPatch.Load();
			ToyHammerPatch.Load();
			HandheldRadar.Load();
			HackingTool.Load();
			FlareController.Init();
			FatalitiesSign.Init();
			Arson.Init();
			ForcedPing.Init();
			Cookie.Init();
			RocketLauncherAmmo.Init();
		}
	}
	public static class PouchyBeltPatch
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Manipulator <0>__PlayerControllerB_SwitchToItemSlotIL;

			public static hook_SetSpecialGrabAnimationBool <1>__PlayerControllerB_SetSpecialGrabAnimationBool;

			public static hook_SwitchToItemSlot <2>__PlayerControllerB_SwitchToItemSlot;

			public static Func<PlayerControllerB, int, bool> <3>__SkipRemoteHudSlot;
		}

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

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

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

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

		public static void Load()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_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_003d: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			object obj = <>O.<0>__PlayerControllerB_SwitchToItemSlotIL;
			if (obj == null)
			{
				Manipulator val = PlayerControllerB_SwitchToItemSlotIL;
				<>O.<0>__PlayerControllerB_SwitchToItemSlotIL = val;
				obj = (object)val;
			}
			PlayerControllerB.SwitchToItemSlot += (Manipulator)obj;
			object obj2 = <>O.<1>__PlayerControllerB_SetSpecialGrabAnimationBool;
			if (obj2 == null)
			{
				hook_SetSpecialGrabAnimationBool val2 = PlayerControllerB_SetSpecialGrabAnimationBool;
				<>O.<1>__PlayerControllerB_SetSpecialGrabAnimationBool = val2;
				obj2 = (object)val2;
			}
			PlayerControllerB.SetSpecialGrabAnimationBool += (hook_SetSpecialGrabAnimationBool)obj2;
			object obj3 = <>O.<2>__PlayerControllerB_SwitchToItemSlot;
			if (obj3 == null)
			{
				hook_SwitchToItemSlot val3 = PlayerControllerB_SwitchToItemSlot;
				<>O.<2>__PlayerControllerB_SwitchToItemSlot = val3;
				obj3 = (object)val3;
			}
			PlayerControllerB.SwitchToItemSlot += (hook_SwitchToItemSlot)obj3;
		}

		private static void PlayerControllerB_SwitchToItemSlotIL(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0084: 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_0092: Expected O, but got Unknown
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.GotoNext((MoveType)0, new Func<Instruction, bool>[3]
			{
				(Instruction instruction) => ILPatternMatchingExt.MatchLdarg(instruction, 0),
				(Instruction instruction) => ILPatternMatchingExt.MatchLdarg(instruction, 1),
				(Instruction instruction) => ILPatternMatchingExt.MatchStfld<PlayerControllerB>(instruction, "currentItemSlot")
			});
			ILLabel val2 = val.MarkLabel();
			ILCursor val3 = new ILCursor(il)
			{
				Index = 0
			};
			val3.Emit(OpCodes.Ldarg_0);
			val3.Emit(OpCodes.Ldarg_1);
			val3.EmitDelegate<Func<PlayerControllerB, int, bool>>((Func<PlayerControllerB, int, bool>)SkipRemoteHudSlot);
			val3.Emit(OpCodes.Brtrue, (object)val2);
		}

		private static bool SkipRemoteHudSlot(PlayerControllerB player, int slot)
		{
			return !((NetworkBehaviour)player).IsOwner && slot != 50 && (slot >= HUDManager.Instance.itemSlotIconFrames.Length || slot >= HUDManager.Instance.itemSlotIcons.Length);
		}

		private static void PlayerControllerB_SetSpecialGrabAnimationBool(orig_SetSpecialGrabAnimationBool orig, PlayerControllerB self, bool setTrue, GrabbableObject currentItem)
		{
			if ((Object)(object)currentItem == (Object)null)
			{
				currentItem = self.currentlyGrabbingObject;
			}
			if (!(currentItem?.itemProperties.grabAnim == "none"))
			{
				orig.Invoke(self, setTrue, currentItem);
			}
		}

		private static void PlayerControllerB_SwitchToItemSlot(orig_SwitchToItemSlot orig, PlayerControllerB self, int slot, GrabbableObject fillSlotWithItem)
		{
			orig.Invoke(self, slot, fillSlotWithItem);
			if (self.currentlyHeldObjectServer is PouchyBelt pouchyBelt)
			{
				((GrabbableObject)pouchyBelt).isPocketed = true;
				((GrabbableObject)pouchyBelt).EnableItemMeshes(false);
				self.playerBodyAnimator.SetBool(GrabHash, false);
				self.playerBodyAnimator.SetBool(GrabValidatedHash, false);
				self.playerBodyAnimator.SetBool(CancelHoldingHash, true);
				self.playerBodyAnimator.ResetTrigger(ThrowHash);
				self.playerBodyAnimator.SetTrigger(ThrowHash);
			}
		}
	}
	public static class PowerOutletStun
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_ChargeItem <0>__ItemCharger_ChargeItem;

			public static hook_Update <1>__ItemCharger_Update;

			public static hook_Start <2>__StartOfRound_Start;

			public static hook_SetInstanceValuesBackToDefault <3>__GameNetworkManager_SetInstanceValuesBackToDefault;

			public static HandleNamedMessageDelegate <4>__ConductiveChargeRequested;

			public static HandleNamedMessageDelegate <5>__ConductiveChargeApproved;
		}

		private const string ChargeRequestMessage = "HQ_Team.LethalThingsReloaded.Internals.ConductiveChargeRequest";

		private const string ShortCircuitMessage = "HQ_Team.LethalThingsReloaded.Internals.ConductiveShortCircuit";

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

		private static readonly WaitForSeconds ShortCircuitDelay = new WaitForSeconds(0.75f);

		private static readonly Dictionary<ulong, Coroutine> chargerCoroutines = new Dictionary<ulong, Coroutine>();

		public static void Load()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_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_003d: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			object obj = <>O.<0>__ItemCharger_ChargeItem;
			if (obj == null)
			{
				hook_ChargeItem val = ItemCharger_ChargeItem;
				<>O.<0>__ItemCharger_ChargeItem = val;
				obj = (object)val;
			}
			ItemCharger.ChargeItem += (hook_ChargeItem)obj;
			object obj2 = <>O.<1>__ItemCharger_Update;
			if (obj2 == null)
			{
				hook_Update val2 = ItemCharger_Update;
				<>O.<1>__ItemCharger_Update = val2;
				obj2 = (object)val2;
			}
			ItemCharger.Update += (hook_Update)obj2;
			object obj3 = <>O.<2>__StartOfRound_Start;
			if (obj3 == null)
			{
				hook_Start val3 = StartOfRound_Start;
				<>O.<2>__StartOfRound_Start = val3;
				obj3 = (object)val3;
			}
			StartOfRound.Start += (hook_Start)obj3;
			object obj4 = <>O.<3>__GameNetworkManager_SetInstanceValuesBackToDefault;
			if (obj4 == null)
			{
				hook_SetInstanceValuesBackToDefault val4 = GameNetworkManager_SetInstanceValuesBackToDefault;
				<>O.<3>__GameNetworkManager_SetInstanceValuesBackToDefault = val4;
				obj4 = (object)val4;
			}
			GameNetworkManager.SetInstanceValuesBackToDefault += (hook_SetInstanceValuesBackToDefault)obj4;
		}

		private static void StartOfRound_Start(orig_Start orig, StartOfRound self)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			orig.Invoke(self);
			NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler("HQ_Team.LethalThingsReloaded.Internals.ConductiveChargeRequest");
			NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler("HQ_Team.LethalThingsReloaded.Internals.ConductiveShortCircuit");
			CustomMessagingManager customMessagingManager = NetworkManager.Singleton.CustomMessagingManager;
			object obj = <>O.<4>__ConductiveChargeRequested;
			if (obj == null)
			{
				HandleNamedMessageDelegate val = ConductiveChargeRequested;
				<>O.<4>__ConductiveChargeRequested = val;
				obj = (object)val;
			}
			customMessagingManager.RegisterNamedMessageHandler("HQ_Team.LethalThingsReloaded.Internals.ConductiveChargeRequest", (HandleNamedMessageDelegate)obj);
			CustomMessagingManager customMessagingManager2 = NetworkManager.Singleton.CustomMessagingManager;
			object obj2 = <>O.<5>__ConductiveChargeApproved;
			if (obj2 == null)
			{
				HandleNamedMessageDelegate val2 = ConductiveChargeApproved;
				<>O.<5>__ConductiveChargeApproved = val2;
				obj2 = (object)val2;
			}
			customMessagingManager2.RegisterNamedMessageHandler("HQ_Team.LethalThingsReloaded.Internals.ConductiveShortCircuit", (HandleNamedMessageDelegate)obj2);
			Log.Info("Conductive charger messages registered");
		}

		private static void GameNetworkManager_SetInstanceValuesBackToDefault(orig_SetInstanceValuesBackToDefault orig, GameNetworkManager self)
		{
			orig.Invoke(self);
			NetworkManager singleton = NetworkManager.Singleton;
			CustomMessagingManager val = ((singleton != null) ? singleton.CustomMessagingManager : null);
			if (val != null)
			{
				val.UnregisterNamedMessageHandler("HQ_Team.LethalThingsReloaded.Internals.ConductiveChargeRequest");
				val.UnregisterNamedMessageHandler("HQ_Team.LethalThingsReloaded.Internals.ConductiveShortCircuit");
				Log.Info("Conductive charger messages unregistered");
			}
			chargerCoroutines.Clear();
		}

		private unsafe static void ConductiveChargeRequested(ulong senderClientId, FastBufferReader reader)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			if (!LethalThingsConfig.enableItemChargerShortCircuit.Value)
			{
				Log.Debug("Conductive charger request was rejected because short circuits are disabled");
				return;
			}
			ulong num = default(ulong);
			((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref num, default(ForPrimitives));
			ulong key = default(ulong);
			((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref key, default(ForPrimitives));
			if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value))
			{
				Log.Warn("Conductive charger request was rejected because the sender was not holding the item");
				return;
			}
			PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[value];
			GrabbableObject currentlyHeldObjectServer = val.currentlyHeldObjectServer;
			if (!((Object)(object)((currentlyHeldObjectServer != null) ? ((NetworkBehaviour)currentlyHeldObjectServer).NetworkObject : null) == (Object)null) && ((NetworkBehaviour)currentlyHeldObjectServer).NetworkObject.NetworkObjectId == num)
			{
				Item itemProperties = currentlyHeldObjectServer.itemProperties;
				if (itemProperties != null && itemProperties.isConductiveMetal && !currentlyHeldObjectServer.itemProperties.requiresBattery)
				{
					if (!NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(key, out var value2))
					{
						Log.Warn("Conductive charger request was rejected because the charger was unavailable");
						return;
					}
					ItemCharger componentInChildren = ((Component)value2).GetComponentInChildren<ItemCharger>();
					int value3 = LethalThingsConfig.itemChargerShortCircuitDamage.Value;
					FastBufferWriter val2 = default(FastBufferWriter);
					((FastBufferWriter)(ref val2))..ctor(16, (Allocator)2, -1);
					try
					{
						((FastBufferWriter)(ref val2)).WriteValueSafe<ulong>(ref key, default(ForPrimitives));
						((FastBufferWriter)(ref val2)).WriteValueSafe<int>(ref value3, default(ForPrimitives));
						NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("HQ_Team.LethalThingsReloaded.Internals.ConductiveShortCircuit", val2, (NetworkDelivery)2);
						if (NetworkManager.Singleton.IsHost)
						{
							ShortCircuit(componentInChildren, value3);
						}
						Log.Debug("Conductive charger short circuit approved");
						return;
					}
					finally
					{
						((IDisposable)(*(FastBufferWriter*)(&val2))/*cast due to .constrained prefix*/).Dispose();
					}
				}
			}
			Log.Warn("Conductive charger request was rejected because the sender was not holding the item");
		}

		private static void ItemCharger_Update(orig_Update orig, ItemCharger self)
		{
			orig.Invoke(self);
			if (self.updateInterval == 0f)
			{
				GrabbableObject val = GameNetworkManager.Instance?.localPlayerController?.currentlyHeldObjectServer;
				if ((Object)(object)val != (Object)null && (val.itemProperties.requiresBattery || val.itemProperties.isConductiveMetal))
				{
					self.triggerScript.interactable = true;
				}
			}
		}

		private unsafe static void ItemCharger_ChargeItem(orig_ChargeItem orig, ItemCharger self)
		{
			//IL_00df: 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_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			GrabbableObject currentlyHeldObjectServer = GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer;
			if (LethalThingsConfig.enableItemChargerShortCircuit.Value && currentlyHeldObjectServer != null && currentlyHeldObjectServer.itemProperties?.isConductiveMetal == true && !currentlyHeldObjectServer.itemProperties.requiresBattery)
			{
				NetworkManager singleton = NetworkManager.Singleton;
				CustomMessagingManager val = ((singleton != null) ? singleton.CustomMessagingManager : null);
				NetworkManager singleton2 = NetworkManager.Singleton;
				if (singleton2 != null && singleton2.IsListening && val != null && !((Object)(object)((NetworkBehaviour)currentlyHeldObjectServer).NetworkObject == (Object)null) && !((Object)(object)((NetworkBehaviour)self).NetworkObject == (Object)null))
				{
					FastBufferWriter val2 = default(FastBufferWriter);
					((FastBufferWriter)(ref val2))..ctor(16, (Allocator)2, -1);
					try
					{
						ulong networkObjectId = ((NetworkBehaviour)currentlyHeldObjectServer).NetworkObject.NetworkObjectId;
						((FastBufferWriter)(ref val2)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives));
						networkObjectId = ((NetworkBehaviour)self).NetworkObject.NetworkObjectId;
						((FastBufferWriter)(ref val2)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives));
						val.SendNamedMessage("HQ_Team.LethalThingsReloaded.Internals.ConductiveChargeRequest", 0uL, val2, (NetworkDelivery)2);
						Log.Debug("Conductive charger request sent");
						return;
					}
					finally
					{
						((IDisposable)(*(FastBufferWriter*)(&val2))/*cast due to .constrained prefix*/).Dispose();
					}
				}
				Log.Warn("Conductive charger short circuit could not send its request");
			}
			else
			{
				orig.Invoke(self);
			}
		}

		private static void ConductiveChargeApproved(ulong senderClientId, FastBufferReader reader)
		{
			//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_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			ulong key = default(ulong);
			((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref key, default(ForPrimitives));
			int damage = default(int);
			((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref damage, default(ForPrimitives));
			NetworkManager singleton = NetworkManager.Singleton;
			if (((singleton != null) ? singleton.SpawnManager : null) == null || !NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(key, out var value))
			{
				Log.Warn("Conductive charger short circuit could not find the charger");
				return;
			}
			ItemCharger componentInChildren = ((Component)value).GetComponentInChildren<ItemCharger>();
			ShortCircuit(componentInChildren, damage);
		}

		private static void ShortCircuit(ItemCharger charger, int damage)
		{
			ulong networkObjectId = ((NetworkBehaviour)charger).NetworkObject.NetworkObjectId;
			if (chargerCoroutines.TryGetValue(networkObjectId, out var value))
			{
				((MonoBehaviour)charger).StopCoroutine(value);
			}
			chargerCoroutines[networkObjectId] = ((MonoBehaviour)charger).StartCoroutine(ShortCircuitDelayed(charger, damage));
		}

		private static IEnumerator ShortCircuitDelayed(ItemCharger charger, int damage)
		{
			charger.zapAudio.Play();
			yield return ShortCircuitDelay;
			charger.chargeStationAnimator.SetTrigger(ZapHash);
			Vector3 position = ((Component)charger.triggerScript).transform.position;
			EXPLOOOOOOOOOOOSIONUtilities.CreateExplosion(position, spawnExplosionEffect: false, damage, 0f, 5f, 3, (CauseOfDeath)11);
			StormyWeather stormyWeather = Object.FindFirstObjectByType<StormyWeather>((FindObjectsInactive)1);
			if ((Object)(object)stormyWeather == (Object)null)
			{
				Log.Error("Conductive charger short circuit could not find storm effects");
				chargerCoroutines.Remove(((NetworkBehaviour)charger).NetworkObject.NetworkObjectId);
				yield break;
			}
			ParticleSystem particle = Object.Instantiate<ParticleSystem>(stormyWeather.explosionEffectParticle, position + Vector3.up * 0.25f, Quaternion.identity);
			AudioSource audio = Object.Instantiate<AudioSource>(stormyWeather.targetedStrikeAudio, position + Vector3.up * 0.5f, Quaternion.identity);
			particle.Play();
			stormyWeather.PlayThunderEffects(position, audio);
			Object.Destroy((Object)(object)((Component)particle).gameObject, 5f);
			Object.Destroy((Object)(object)((Component)audio).gameObject, 5f);
			chargerCoroutines.Remove(((NetworkBehaviour)charger).NetworkObject.NetworkObjectId);
		}
	}
	internal static class ToyHammerPatch
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Manipulator <0>__Shovel_HitShovel;

			public static Func<IHittable, int, Vector3, PlayerControllerB, bool, int, Shovel, bool> <1>__HitWithToyHammer;
		}

		public static void Load()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			object obj = <>O.<0>__Shovel_HitShovel;
			if (obj == null)
			{
				Manipulator val = Shovel_HitShovel;
				<>O.<0>__Shovel_HitShovel = val;
				obj = (object)val;
			}
			Shovel.HitShovel += (Manipulator)obj;
		}

		private static void Shovel_HitShovel(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0039: 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)
			ILCursor val = new ILCursor(il);
			val.GotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction instruction) => ILPatternMatchingExt.MatchCallOrCallvirt<IHittable>(instruction, "Hit")
			});
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Func<IHittable, int, Vector3, PlayerControllerB, bool, int, Shovel, bool>>((Func<IHittable, int, Vector3, PlayerControllerB, bool, int, Shovel, bool>)HitWithToyHammer);
			val.Next.OpCode = OpCodes.Nop;
			val.Next.Operand = null;
		}

		private static bool HitWithToyHammer(IHittable hittable, int shovelHitForce, Vector3 hitDirection, PlayerControllerB playerWhoHit, bool playHitSFX, int hitID, Shovel shovel)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			if (!(shovel is ToyHammer toyHammer))
			{
				return hittable.Hit(shovelHitForce, hitDirection, playerWhoHit, playHitSFX, hitID);
			}
			int num = ((Random.Range(0f, 100f) < toyHammer.hammerHitPercentage) ? toyHammer.hammerHitForce : shovelHitForce);
			return hittable.Hit(num, hitDirection, playerWhoHit, playHitSFX, hitID);
		}
	}
}
namespace LethalThings.MonoBehaviours
{
	public class Arson : NoisemakerProp
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_CheckBoundsForPlayers <0>__ShowerTrigger_CheckBoundsForPlayers;
		}

		public bool isCleanable;

		public Item cleanArson;

		public float totalShowerTime = 5f;

		private static readonly List<Arson> allArson = new List<Arson>();

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

		private readonly NetworkVariable<bool> cleanedInElevator = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		private readonly NetworkVariable<bool> cleanedInShipRoom = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		private Random chompRandom;

		private BoxCollider itemCollider;

		private ShowerTrigger currentShower;

		private bool beingShowered;

		private bool cleaningComplete;

		private float showerTime;

		public static void Init()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			object obj = <>O.<0>__ShowerTrigger_CheckBoundsForPlayers;
			if (obj == null)
			{
				hook_CheckBoundsForPlayers val = ShowerTrigger_CheckBoundsForPlayers;
				<>O.<0>__ShowerTrigger_CheckBoundsForPlayers = val;
				obj = (object)val;
			}
			ShowerTrigger.CheckBoundsForPlayers += (hook_CheckBoundsForPlayers)obj;
		}

		private static void ShowerTrigger_CheckBoundsForPlayers(orig_CheckBoundsForPlayers orig, ShowerTrigger self)
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			bool flag = Time.realtimeSinceStartup - self.cleanInterval >= 1.5f;
			orig.Invoke(self);
			if (!flag)
			{
				return;
			}
			NetworkManager singleton = NetworkManager.Singleton;
			if (singleton == null || !singleton.IsServer)
			{
				return;
			}
			Bounds bounds = self.showerCollider.bounds;
			for (int i = 0; i < allArson.Count; i++)
			{
				Arson arson = allArson[i];
				if (arson.isCleanable)
				{
					bool flag2 = (arson.beingShowered = !((GrabbableObject)arson).isHeld && ((Bounds)(ref bounds)).Intersects(((Collider)arson.itemCollider).bounds));
					arson.currentShower = (flag2 ? self : null);
					if (!flag2)
					{
						arson.showerTime = 0f;
					}
				}
			}
		}

		public void Awake()
		{
			itemCollider = ((Component)this).GetComponent<BoxCollider>();
			allArson.Add(this);
		}

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			NetworkVariable<int> obj = cleanedScrapValue;
			obj.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(CleanedScrapValueChanged));
			NetworkVariable<bool> obj2 = cleanedInElevator;
			obj2.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Combine((Delegate?)(object)obj2.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(CleanedLocationChanged));
			NetworkVariable<bool> obj3 = cleanedInShipRoom;
			obj3.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Combine((Delegate?)(object)obj3.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(CleanedLocationChanged));
			RefreshCleanedItem();
		}

		public override void OnNetworkDespawn()
		{
			NetworkVariable<int> obj = cleanedScrapValue;
			obj.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Remove((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(CleanedScrapValueChanged));
			NetworkVariable<bool> obj2 = cleanedInElevator;
			obj2.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Remove((Delegate?)(object)obj2.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(CleanedLocationChanged));
			NetworkVariable<bool> obj3 = cleanedInShipRoom;
			obj3.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Remove((Delegate?)(object)obj3.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(CleanedLocationChanged));
			((NetworkBehaviour)this).OnNetworkDespawn();
		}

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

		public override void Update()
		{
			((GrabbableObject)this).Update();
			if (!((NetworkBehaviour)this).IsServer || !isCleanable || cleaningComplete)
			{
				return;
			}
			if (beingShowered && !((GrabbableObject)this).isHeld)
			{
				ShowerTrigger obj = currentShower;
				if (obj != null && obj.showerOn)
				{
					showerTime += Time.deltaTime;
					if (!(showerTime < totalShowerTime))
					{
						cleaningComplete = true;
						((MonoBehaviour)this).StartCoroutine(ReplaceAfterShower());
					}
					return;
				}
			}
			beingShowered = false;
			currentShower = null;
			showerTime = 0f;
		}

		private IEnumerator ReplaceAfterShower()
		{
			GameObject cleanedObject = Object.Instantiate<GameObject>(cleanArson.spawnPrefab, ((Component)this).transform.position, ((Component)this).transform.rotation);
			Arson cleanedArson = cleanedObject.GetComponent<Arson>();
			int price = (int)((float)Random.Range(((GrabbableObject)cleanedArson).itemProperties.minValue, ((GrabbableObject)cleanedArson).itemProperties.maxValue) * RoundManager.Instance.scrapValueMultiplier);
			cleanedArson.cleanedInElevator.Value = ((GrabbableObject)this).isInElevator;
			cleanedArson.cleanedInShipRoom.Value = ((GrabbableObject)this).isInShipRoom;
			cleanedArson.cleanedScrapValue.Value = price;
			((NetworkBehaviour)cleanedArson).NetworkObject.Spawn(false);
			Log.Debug("Dirty Arson replaced with Clean Arson");
			yield return null;
			((NetworkBehaviour)this).NetworkObject.Despawn(true);
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//IL_00ba: 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_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			((NoisemakerProp)this).ItemActivate(used, buttonDown);
			if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null))
			{
				int num = chompRandom.Next(0, base.noiseSFX.Length);
				chompRandom.Next((int)(base.minLoudness * 100f), (int)(base.maxLoudness * 100f));
				chompRandom.Next((int)(base.minPitch * 100f), (int)(base.maxPitch * 100f));
				if (((Object)base.noiseSFX[num]).name.Contains("chomp") && ((NetworkBehaviour)this).IsOwner)
				{
					((GrabbableObject)this).playerHeldBy.DamagePlayer(30, true, true, (CauseOfDeath)6, 0, false, default(Vector3));
					((GrabbableObject)this).playerHeldBy.DiscardHeldObject(false, (NetworkObject)null, default(Vector3), true);
				}
			}
		}

		public override void OnDestroy()
		{
			allArson.Remove(this);
			((GrabbableObject)this).OnDestroy();
		}

		private void CleanedScrapValueChanged(int _, int __)
		{
			RefreshCleanedItem();
		}

		private void CleanedLocationChanged(bool _, bool __)
		{
			RefreshCleanedItem();
		}

		private void RefreshCleanedItem()
		{
			int value = cleanedScrapValue.Value;
			if (value >= 0)
			{
				((GrabbableObject)this).SetScrapValue(value);
				((GrabbableObject)this).isInElevator = cleanedInElevator.Value;
				((GrabbableObject)this).isInShipRoom = cleanedInShipRoom.Value;
				Transform val = (((GrabbableObject)this).isInElevator ? StartOfRound.Instance.elevatorTransform : StartOfRound.Instance.propsContainer);
				((Component)this).transform.SetParent(val, true);
			}
		}

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

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

		protected internal override string __getTypeName()
		{
			return "Arson";
		}
	}
	public class Cookie : NoisemakerProp
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_RequireCooldown <0>__GrabbableObject_RequireCooldown;

			public static hook_ItemInteractLeftRightOnClient <1>__GrabbableObject_ItemInteractLeftRightOnClient;

			public static hook_UseItemBatteries <2>__GrabbableObject_UseItemBatteries;
		}

		private const float ExplodePercentage = 0.04f;

		private const float OooPennyPercentage = 0.2f;

		[SerializeField]
		private AudioClip[] cookieSpecialAudio;

		[SerializeField]
		private AnimationCurve itemFallCurve;

		[SerializeField]
		private AnimationCurve itemVerticalFallCurve;

		[SerializeField]
		private AnimationCurve itemVerticalFallCurveNoBounce;

		private bool beingThrown;

		private bool wasThrown;

		private bool waitingForLanding;

		private ulong throwingClientId;

		public static void Init()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_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_003d: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			object obj = <>O.<0>__GrabbableObject_RequireCooldown;
			if (obj == null)
			{
				hook_RequireCooldown val = GrabbableObject_RequireCooldown;
				<>O.<0>__GrabbableObject_RequireCooldown = val;
				obj = (object)val;
			}
			GrabbableObject.RequireCooldown += (hook_RequireCooldown)obj;
			object obj2 = <>O.<1>__GrabbableObject_ItemInteractLeftRightOnClient;
			if (obj2 == null)
			{
				hook_ItemInteractLeftRightOnClient val2 = GrabbableObject_ItemInteractLeftRightOnClient;
				<>O.<1>__GrabbableObject_ItemInteractLeftRightOnClient = val2;
				obj2 = (object)val2;
			}
			GrabbableObject.ItemInteractLeftRightOnClient += (hook_ItemInteractLeftRightOnClient)obj2;
			object obj3 = <>O.<2>__GrabbableObject_UseItemBatteries;
			if (obj3 == null)
			{
				hook_UseItemBatteries val3 = GrabbableObject_UseItemBatteries;
				<>O.<2>__GrabbableObject_UseItemBatteries = val3;
				obj3 = (object)val3;
			}
			GrabbableObject.UseItemBatteries += (hook_UseItemBatteries)obj3;
		}

		private static bool GrabbableObject_UseItemBatteries(orig_UseItemBatteries orig, GrabbableObject self, bool isToggle, bool buttonDown)
		{
			if (self is Cookie { beingThrown: not false })
			{
				return true;
			}
			return orig.Invoke(self, isToggle, buttonDown);
		}

		private static void GrabbableObject_ItemInteractLeftRightOnClient(orig_ItemInteractLeftRightOnClient orig, GrabbableObject self, bool right)
		{
			Cookie cookie = self as Cookie;
			if (cookie == null || right)
			{
				orig.Invoke(self, right);
				return;
			}
			cookie.beingThrown = true;
			orig.Invoke(self, right);
			cookie.beingThrown = false;
		}

		private static bool GrabbableObject_RequireCooldown(orig_RequireCooldown orig, GrabbableObject self)
		{
			if (self is Cookie { beingThrown: not false })
			{
				return false;
			}
			return orig.Invoke(self);
		}

		public override void ItemInteractLeftRight(bool right)
		{
			//IL_002a: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).ItemInteractLeftRight(right);
			if (!right)
			{
				PlayCookieAudio(0);
				if (((NetworkBehaviour)this).IsOwner)
				{
					CookieThrownRpc();
					wasThrown = true;
					((GrabbableObject)this).playerHeldBy.DiscardHeldObject(true, (NetworkObject)null, CookieThrowDestination(), true);
				}
			}
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EnableItemMeshes(true);
			((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = true;
			((GrabbableObject)this).isPocketed = false;
		}

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

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

		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_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: 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 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, itemFallCurve.Evaluate(((GrabbableObject)this).fallTime));
			((Component)this).transform.localPosition = ((magnitude > 5f) ? 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), itemVerticalFallCurveNoBounce.Evaluate(((GrabbableObject)this).fallTime)) : 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), itemVerticalFallCurve.Evaluate(((GrabbableObject)this).fallTime)));
			((GrabbableObject)this).fallTime = ((GrabbableObject)this).fallTime + Mathf.Abs(Time.deltaTime * 12f / magnitude);
		}

		public override void OnHitGround()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			if (wasThrown && ((NetworkBehaviour)this).IsOwner)
			{
				wasThrown = false;
				CookieLandedRpc();
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void CookieThrownRpc(RpcParams rpcParams = default(RpcParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Invalid comparison between Unknown and I4
			//IL_0043: 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_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_007b: 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_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false,
					Delivery = (RpcDelivery)0
				};
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(138173801u, rpcParams, val, (SendTo)2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 138173801u, rpcParams, val, (SendTo)2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				ulong senderClientId = rpcParams.Receive.SenderClientId;
				if (StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value) && !((Object)(object)StartOfRound.Instance.allPlayerScripts[value].currentlyHeldObjectServer != (Object)(object)this))
				{
					throwingClientId = senderClientId;
					waitingForLanding = true;
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void CookieLandedRpc(RpcParams rpcParams = default(RpcParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Invalid comparison between Unknown and I4
			//IL_0043: 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_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_007b: 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_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: 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_00cf: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false,
					Delivery = (RpcDelivery)0
				};
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(186710038u, rpcParams, val, (SendTo)2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 186710038u, rpcParams, val, (SendTo)2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (waitingForLanding && rpcParams.Receive.SenderClientId == throwingClientId)
			{
				waitingForLanding = false;
				if (Random.Range(0f, 1000f) / 1000f <= 0.04f)
				{
					Log.Debug("Cookie boom boom");
					CookieResultRpc(exploded: true, throwingClientId);
					((NetworkBehaviour)this).NetworkObject.Despawn(true);
				}
				else if (Random.Range(0f, 1000f) / 1000f <= 0.2f)
				{
					Log.Debug("Cookie played penny sound");
					CookieResultRpc(exploded: false, throwingClientId);
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void CookieResultRpc(bool exploded, ulong throwerClientId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Invalid comparison between Unknown and I4
			//IL_0043: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					Delivery = (RpcDelivery)0
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(840131743u, val3, val, (SendTo)7, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref exploded, default(ForPrimitives));
				BytePacker.WriteValueBitPacked(val2, throwerClientId);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 840131743u, val3, val, (SendTo)7, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (!exploded)
			{
				base.noiseAudio.Stop();
				AudioSource noiseAudioFar = base.noiseAudioFar;
				if (noiseAudioFar != null)
				{
					noiseAudioFar.Stop();
				}
				PlayCookieAudio(1);
			}
			else
			{
				int num = StartOfRound.Instance.ClientPlayerList[throwerClientId];
				PlayerControllerB attacker = StartOfRound.Instance.allPlayerScripts[num];
				EXPLOOOOOOOOOOOSIONUtilities.CreateExplosion(((Component)this).transform.position, spawnExplosionEffect: true, 20, 0f, 4f, 10, (CauseOfDeath)3, attacker);
			}
		}

		private void PlayCookieAudio(int index)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			AudioClip val = cookieSpecialAudio[index];
			base.noiseAudio.PlayOneShot(val);
			AudioSource noiseAudioFar = base.noiseAudioFar;
			if (noiseAudioFar != null)
			{
				noiseAudioFar.PlayOneShot(val);
			}
			WalkieTalkie.TransmitOneShotAudio(base.noiseAudio, val, 0.5f);
			RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, base.noiseRange, 0.5f, 0, ((GrabbableObject)this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
		}

		private Vector3 CookieThrowDestination()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_007c: 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_00ab: 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_00ba: 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_00bf: 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)
			Ray val = default(Ray);
			((Ray)(ref val))..ctor(((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.position, ((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.forward);
			RaycastHit val3 = default(RaycastHit);
			Vector3 val2 = ((!Physics.Raycast(val, ref val3, 12f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) ? ((Ray)(ref val)).GetPoint(10f) : ((Ray)(ref val)).GetPoint(((RaycastHit)(ref val3)).distance - 0.05f));
			((Ray)(ref val))..ctor(val2, Vector3.down);
			return Physics.Raycast(val, ref val3, 30f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1) ? (((RaycastHit)(ref val3)).point + Vector3.up * 0.05f) : ((Ray)(ref val)).GetPoint(30f);
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(138173801u, new RpcReceiveHandler(__rpc_handler_138173801), "CookieThrownRpc");
			((NetworkBehaviour)this).__registerRpc(186710038u, new RpcReceiveHandler(__rpc_handler_186710038), "CookieLandedRpc");
			((NetworkBehaviour)this).__registerRpc(840131743u, new RpcReceiveHandler(__rpc_handler_840131743), "CookieResultRpc");
			((NoisemakerProp)this).__initializeRpcs();
		}

		private static void __rpc_handler_138173801(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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				RpcParams ext = rpcParams.Ext;
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Cookie)(object)target).CookieThrownRpc(ext);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_186710038(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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				RpcParams ext = rpcParams.Ext;
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Cookie)(object)target).CookieLandedRpc(ext);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_840131743(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool exploded = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref exploded, default(ForPrimitives));
				ulong throwerClientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref throwerClientId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Cookie)(object)target).CookieResultRpc(exploded, throwerClientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "Cookie";
		}
	}
	public class Dart : GrabbableObject
	{
		[SerializeField]
		private GameObject projectilePrefab;

		[SerializeField]
		private float throwForce = 10f;

		internal GameObject ProjectilePrefab => projectilePrefab;

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (buttonDown && ((NetworkBehaviour)this).IsOwner && !((Object)(object)base.playerHeldBy == (Object)null))
			{
				PlayerControllerB playerHeldBy = base.playerHeldBy;
				Vector3 forward = ((Component)playerHeldBy.gameplayCamera).transform.forward;
				Vector3 normalized = ((Vector3)(ref forward)).normalized;
				ThrowDartServerRpc(((Component)this).transform.position, ((Component)this).transform.rotation, normalized);
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void ThrowDartServerRpc(Vector3 launchPosition, Quaternion launchRotation, Vector3 direction, RpcParams rpcParams = default(RpcParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Invalid comparison between Unknown and I4
			//IL_0043: 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_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_007b: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: 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)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false,
					Delivery = (RpcDelivery)0
				};
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3493494647u, rpcParams, val, (SendTo)2, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref launchPosition);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref launchRotation);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref direction);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 3493494647u, rpcParams, val, (SendTo)2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			ulong senderClientId = rpcParams.Receive.SenderClientId;
			if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(senderClientId, out var value))
			{
				Log.Warn("Dart throw was rejected");
				return;
			}
			PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[value];
			int currentItemSlot = val3.currentItemSlot;
			if (val3 != null && !val3.isPlayerDead && !((Object)(object)val3.currentlyHeldObjectServer != (Object)(object)this) && currentItemSlot >= 0 && currentItemSlot < val3.ItemSlots.Length && !((Object)(object)val3.ItemSlots[currentItemSlot] != (Object)(object)this) && !(((Vector3)(ref direction)).sqrMagnitude < 0.99f))
			{
				Vector3 val4 = launchPosition - ((Component)val3).transform.position;
				if (!(((Vector3)(ref val4)).sqrMagnitude > 16f))
				{
					GameObject val5 = Object.Instantiate<GameObject>(projectilePrefab, launchPosition, launchRotation);
					NetworkObject component = val5.GetComponent<NetworkObject>();
					component.SpawnWithOwnership(senderClientId, false);
					val5.GetComponent<DartProjectile>().Launch(launchPosition, launchRotation, ((Vector3)(ref direction)).normalized * throwForce, senderClientId, currentItemSlot);
					Log.Debug("Dart projectile spawned");
					return;
				}
			}
			Log.Warn("Dart throw was rejected");
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(3493494647u, new RpcReceiveHandler(__rpc_handler_3493494647), "ThrowDartServerRpc");
			((GrabbableObject)this).__initializeRpcs();
		}

		private static void __rpc_handler_3493494647(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_004a: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0080: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 launchPosition = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref launchPosition);
				Quaternion launchRotation = default(Quaternion);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref launchRotation);
				Vector3 direction = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref direction);
				RpcParams ext = rpcParams.Ext;
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Dart)(object)target).ThrowDartServerRpc(launchPosition, launchRotation, direction, ext);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "Dart";
		}
	}
	public class DartboardInit : NetworkBehaviour
	{
		public Transform[] dartSpawns;

		private GameObject dartProjectilePrefab;

		private void Awake()
		{
			GameObject spawnPrefab = ((Registry<DawnItemInfo>)(object)LethalContent.Items)[Keys.Dart].Item.spawnPrefab;
			dartProjectilePrefab = spawnPrefab.GetComponent<Dart>().ProjectilePrefab;
			if (!Object.op_Implicit((Object)(object)dartProjectilePrefab))
			{
				Log.Error("Dartboard projectile prefab could not be found");
			}
		}

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			if (((NetworkBehaviour)this).IsServer)
			{
				((MonoBehaviour)this).StartCoroutine(SpawnStartingDarts());
			}
		}

		private IEnumerator SpawnStartingDarts()
		{
			yield return null;
			List<int> unusedSpawns = new List<int>();
			for (int i = 0; i < dartSpawns.Length; i++)
			{
				unusedSpawns.Add(i);
			}
			int existingDarts = Object.FindObjectsByType<Dart>((FindObjectsInactive)0, (FindObjectsSortMode)0).Length;
			int spawnCount = Mathf.Clamp(LethalThingsConfig.dartboardStartingDarts.Value - existingDarts, 0, Mathf.Min(14, unusedSpawns.Count));
			for (int j = 0; j < spawnCount; j++)
			{
				int choice = Random.Range(0, unusedSpawns.Count);
				int spawnIndex = unusedSpawns[choice];
				unusedSpawns.RemoveAt(choice);
				Transform dartSpawn = dartSpawns[spawnIndex];
				GameObject dartObject = Object.Instantiate<GameObject>(dartProjectilePrefab, dartSpawn.position, dartSpawn.rotation);
				NetworkObject dartNetworkObject = dartObject.GetComponent<NetworkObject>();
				dartNetworkObject.Spawn(false);
				dartObject.GetComponent<DartProjectile>().SeatInDartboard(NetworkObjectReference.op_Implicit(((NetworkBehaviour)this).NetworkObject), spawnIndex);
			}
			Log.Debug($"Dartboard spawned {spawnCount} darts");
		}

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

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

		protected internal override string __getTypeName()
		{
			return "DartboardInit";
		}
	}
	public class DartProjectile : NetworkBehaviour
	{
		[SerializeField]
		private Transform dartTip;

		[SerializeField]
		private InteractTrigger pickupTrigger;

		[SerializeField]
		private AudioSource audioSource;

		[SerializeField]
		private AudioClip dartHitSound;

		[SerializeField]
		private float gravity = 9.8f;

		[SerializeField]
		private float hitRadius = 0.04f;

		[SerializeField]
		private float maximumFlightTime = 5f;

		private Collider pickupCollider;

		private readonly RaycastHit[] flightHits = (RaycastHit[])(object)new RaycastHit[16];

		private readonly Collider[] surfaceHits = (Collider[])(object)new Collider[16];

		private readonly NetworkVariable<bool> landedForClients = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		private GameObject dartItemPrefab;

		private AudioClip dartGrabSound;

		private Vector3 velocity;

		private float flightEndsAt;

		private int stickMask;

		private int interactableObjectLayer;

		private int grabHash;

		private int grabInvalidatedHash;

		private int grabValidatedHash;

		private int cancelHoldingHash;

		private int getItemHash;

		private int throwHash;

		private bool flying;

		private bool launched;

		private bool landed;

		private bool claimed;

		private void Awake()
		{
			Item item = ((Registry<DawnItemInfo>)(object)LethalContent.Items)[Keys.Dart].Item;
			dartItemPrefab = item.spawnPrefab;
			dartGrabSound = item.grabSFX;
			stickMask = LayerMask.GetMask(new string[3] { "Default", "Room", "InteractableObject" });
			interactableObjectLayer = LayerMask.NameToLayer("InteractableObject");
			grabHash = Animator.StringToHash("Grab");
			grabInvalidatedHash = Animator.StringToHash("GrabInvalidated");
			grabValidatedHash = Animator.StringToHash("GrabValidated");
			cancelHoldingHash = Animator.StringToHash("cancelHolding");
			getItemHash = Animator.StringToHash("GetItem");
			throwHash = Animator.StringToHash("Throw");
			pickupCollider = ((Component)pickupTrigger).GetComponent<Collider>();
			((UnityEvent<PlayerControllerB>)(object)pickupTrigger.onInteract).AddListener((UnityAction<PlayerControllerB>)PickUpDart);
			SetPickup(enabled: false);
		}

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			if (landedForClients.Value)
			{
				flying = false;
				landed = true;
				SetPickup(enabled: true);
			}
		}

		public void Launch(Vector3 position, Quaternion rotation, Vector3 launchVelocity, ulong playerClientId, int itemSlot)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if (((NetworkBehaviour)this).IsServer && !launched)
			{
				launched = true;
				LaunchClientRpc(position, rotation, launchVelocity, playerClientId, itemSlot);
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void LaunchClientRpc(Vector3 position, Quaternion rotation, Vector3 launchVelocity, ulong playerClientId, int itemSlot)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Invalid comparison between Unknown and I4
			//IL_0043: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: 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)
				{
					RpcAttributeParams val = new RpcAttributeParams
					{
						Delivery = (RpcDelivery)0
					};
					RpcParams val3 = default(RpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3021509621u, val3, val, (SendTo)7, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref rotation);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref launchVelocity);
					BytePacker.WriteValueBitPacked(val2, playerClientId);
					BytePacker.WriteValueBitPacked(val2, itemSlot);
					((NetworkBehaviour)this).__endSendRpc(ref val2, 3021509621u, val3, val, (SendTo)7, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1)
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					int num = StartOfRound.Instance.ClientPlayerList[playerClientId];
					StartOfRound.Instance.allPlayerScripts[num].DestroyItemInSlot(itemSlot);
					((Component)this).transform.SetParent((Transform)null, true);
					((Component)this).transform.SetPositionAndRotation(position, rotation);
					velocity = launchVelocity;
					flightEndsAt = Time.time + maximumFlightTime;
					flying = true;
					landed = false;
					SetPickup(enabled: false);
				}
			}
		}

		private void Update()
		{
			//IL_001d: 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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: 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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			if (!flying)
			{
				return;
			}
			float deltaTime = Time.deltaTime;
			velocity += gravity * deltaTime * Vector3.down;
			Quaternion rotation = Quaternion.LookRotation(velocity);
			Vector3 val = velocity * deltaTime;
			((Component)this).transform.rotation = rotation;
			RaycastHit val2 = default(RaycastHit);
			float num = float.MaxValue;
			if (((NetworkBehaviour)this).IsOwner)
			{
				int num2 = Physics.SphereCastNonAlloc(dartTip.position, hitRadius, ((Vector3)(ref val)).normalized, flightHits, ((Vector3)(ref val)).magnitude, stickMask, (QueryTriggerInteraction)2);
				for (int i = 0; i < num2; i++)
				{
					RaycastHit val3 = flightHits[i];
					Collider collider = ((RaycastHit)(ref val3)).collider;
					if (Object.op_Implicit((Object)(object)collider) && !((Component)collider).transform.IsChildOf(((Component)this).transform) && !((Object)(object)((Component)collider).GetComponentInParent<PlayerControllerB>() != (Object)null) && !((Object)(object)((Component)collider).GetComponentInParent<DartProjectile>() != (Object)null) && (!collider.isTrigger || ((Component)collider).gameObject.layer == interactableObjectLayer) && !(((RaycastHit)(ref val3)).distance >= num))
					{
						val2 = val3;
						num = ((RaycastHit)(ref val3)).distance;
					}
				}
			}
			if (Object.op_Implicit((Object)(object)((RaycastHit)(ref val2)).collider))
			{
				Transform transform = ((Component)this).transform;
				transform.position += ((RaycastHit)(ref val2)).point - dartTip.position;
				flying = false;
				LandDartServerRpc(((Component)this).transform.position, ((Component)this).transform.rotation);
				return;
			}
			Transform transform2 = ((Component)this).transform;
			transform2.position += val;
			if (((NetworkBehaviour)this).IsOwner && Time.time >= flightEndsAt)
			{
				flying = false;
				LandDartServerRpc(((Component)this).transform.position, ((Component)this).transform.rotation);
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void LandDartServerRpc(Vector3 position, Quaternion rotation, RpcParams rpcParams = default(RpcParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c2: Unknown result type (might be due to