Decompiled source of Lacrimosum v1.4.1

BepInEx\Plugins\Lacrimosum.dll

Decompiled 4 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CSync.Extensions;
using CSync.Lib;
using GameNetcodeStuff;
using Lacrimosum.Assets;
using Lacrimosum.Helpers;
using Lacrimosum.ItemScripts;
using Lacrimosum.NetcodePatcher;
using Lacrimosum.Patching;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using On;
using On.GameNetcodeStuff;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Serialization;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("MMHOOK_Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("FragileDeviations")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.4.1.0")]
[assembly: AssemblyInformationalVersion("1.0.0+0c7a440b4cf25d0f23be4674045cdbd96c3a57bf")]
[assembly: AssemblyProduct("Lacrimosum")]
[assembly: AssemblyTitle("Lacrimosum")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.4.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Lacrimosum
{
	[BepInPlugin("fragiledeviations.lacrimosum", "Lacrimosum", "1.4.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency("com.sigurd.csync", "5.0.1")]
	internal class RoR2Plugin : BaseUnityPlugin
	{
		private const string PluginName = "Lacrimosum";

		private const string PluginVersion = "1.4.1";

		internal const string PluginGuid = "fragiledeviations.lacrimosum";

		internal static readonly string AssemblyLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

		internal static ManualLogSource ModConsole;

		internal static LacrimosumConfig ModConfig;

		private void Awake()
		{
			ModConsole = ((BaseUnityPlugin)this).Logger;
			ModConsole.LogInfo((object)"Loading fragiledeviations.lacrimosum...");
			ModConfig = new LacrimosumConfig(((BaseUnityPlugin)this).Config);
			ModConsole.LogInfo((object)"Config loaded for fragiledeviations.lacrimosum");
			NetcodePatcher();
			ModConsole.LogInfo((object)"Netcode patched for fragiledeviations.lacrimosum");
			ModAssets.Load();
			ModConsole.LogInfo((object)"Assets loaded for fragiledeviations.lacrimosum");
			PlayerEventTracker.Init();
			ModConsole.LogInfo((object)"PlayerEventTracker loaded");
			NetworkPrefabsHelper.Init();
			ModConsole.LogInfo((object)"NetworkPrefabsHelper loaded");
			MenuMusicReplacer.Init();
			ModConsole.LogInfo((object)"MenuMusicReplacer loaded");
			MineReplacement.Init();
			ModConsole.LogInfo((object)"MineReplacement loaded");
			ElevatorMusicReplacer.Init();
			ModConsole.LogInfo((object)"ElevatorMusicReplacer loaded");
			ModConsole.LogInfo((object)"Loaded fragiledeviations.lacrimosum!");
		}

		private static void NetcodePatcher()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			for (int i = 0; i < types.Length; i++)
			{
				MethodInfo[] methods = types[i].GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				foreach (MethodInfo methodInfo in methods)
				{
					if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}
	}
	internal class LacrimosumConfig : SyncedConfig2<LacrimosumConfig>
	{
		private const string GeneralSection = "General";

		private const string ScrapSection = "Scrap";

		private const string ShopSection = "Shop Items";

		public ConfigEntry<bool> AlwaysReplaceMenuMusic { get; set; }

		public SyncedEntry<bool> AlwaysReplaceElevatorMusic { get; set; }

		public SyncedEntry<bool> DontOverrideMineCode { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<int> WilloWispSpawnWeight { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<int> GoatHoofSpawnWeight { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<float> GoatHoofSpeedIncrease { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<int> WhiteScrapSpawnWeight { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<int> GreenScrapSpawnWeight { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<int> RedScrapSpawnWeight { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<int> YellowScrapSpawnWeight { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<int> BungusSpawnWeight { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<int> BungusHealthIncrease { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<float> BungusHealInterval { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<float> BungusActivationTime { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<bool> BungusMode { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<int> RollOfPenniesSpawnWeight { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<int> RollOfPenniesValueIncrease { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<int> RollOfPenniesMaxValue { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<int> UkuleleSpawnWeight { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<int> GooboJrSpawnWeight { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<int> HappiestMaskSpawnWeight { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<bool> EnableShopItems { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<int> SaferSpacesPrice { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<float> SaferSpacesCooldown { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<int> PowerElixirPrice { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<int> PowerElixirHealthThreshold { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<float> PowerElixirHealPercentage { get; set; }

		public LacrimosumConfig(ConfigFile configFile)
			: base("fragiledeviations.lacrimosum")
		{
			AlwaysReplaceMenuMusic = configFile.Bind<bool>("General", "AlwaysReplaceMenuMusic", false, "Always replace the menu music with the RoR2 menu music.");
			AlwaysReplaceElevatorMusic = SyncedBindingExtensions.BindSyncedEntry<bool>(configFile, "General", "AlwaysReplaceElevatorMusic", false, "Always replace the elevator music with the RoR1 final stage theme.");
			DontOverrideMineCode = SyncedBindingExtensions.BindSyncedEntry<bool>(configFile, "General", "DontOverrideMineCode", false, "Don't override the mine explosion code. Having this enabled will make Safer Spaces unable to save you from mines.");
			WilloWispSpawnWeight = SyncedBindingExtensions.BindSyncedEntry<int>(configFile, "Scrap", "WilloWispSpawnWeight", 20, "Explode enemies on death, except you're the enemy");
			GoatHoofSpawnWeight = SyncedBindingExtensions.BindSyncedEntry<int>(configFile, "Scrap", "GoatHoofSpawnWeight", 20, "Increase movement speed.");
			GoatHoofSpeedIncrease = SyncedBindingExtensions.BindSyncedEntry<float>(configFile, "Scrap", "GoatHoofSpeedIncrease", 4.6f, "How much to increase movement speed by. The player's base speed is 4.6, for reference.");
			WhiteScrapSpawnWeight = SyncedBindingExtensions.BindSyncedEntry<int>(configFile, "Scrap", "WhiteScrapSpawnWeight", 40, "Does nothing.");
			GreenScrapSpawnWeight = SyncedBindingExtensions.BindSyncedEntry<int>(configFile, "Scrap", "GreenScrapSpawnWeight", 30, "Does nothing.");
			YellowScrapSpawnWeight = SyncedBindingExtensions.BindSyncedEntry<int>(configFile, "Scrap", "YellowScrapSpawnWeight", 20, "Does nothing.");
			RedScrapSpawnWeight = SyncedBindingExtensions.BindSyncedEntry<int>(configFile, "Scrap", "RedScrapSpawnWeight", 10, "Does nothing.");
			BungusSpawnWeight = SyncedBindingExtensions.BindSyncedEntry<int>(configFile, "Scrap", "BungusSpawnWeight", 20, "Heal when standing still.");
			BungusHealthIncrease = SyncedBindingExtensions.BindSyncedEntry<int>(configFile, "Scrap", "BungusHealthIncrease", 5, "How much health to increase per heal tick.");
			BungusHealInterval = SyncedBindingExtensions.BindSyncedEntry<float>(configFile, "Scrap", "BungusHealInterval", 1f, "How often to heal.");
			BungusActivationTime = SyncedBindingExtensions.BindSyncedEntry<float>(configFile, "Scrap", "BungusActivationTime", 1f, "How long to stand still before healing.");
			BungusMode = SyncedBindingExtensions.BindSyncedEntry<bool>(configFile, "Scrap", "BungusMode", false, "Rename the item to Bungus. If false, it's called Bustling Fungus.");
			RollOfPenniesSpawnWeight = SyncedBindingExtensions.BindSyncedEntry<int>(configFile, "Scrap", "RollOfPenniesSpawnWeight", 40, "Increases item value upon taking damage.");
			RollOfPenniesValueIncrease = SyncedBindingExtensions.BindSyncedEntry<int>(configFile, "Scrap", "RollOfPenniesValueIncrease", 20, "How much to increase item value by.");
			RollOfPenniesMaxValue = SyncedBindingExtensions.BindSyncedEntry<int>(configFile, "Scrap", "RollOfPenniesMaxValue", 100, "The maximum value the item can reach.");
			UkuleleSpawnWeight = SyncedBindingExtensions.BindSyncedEntry<int>(configFile, "Scrap", "UkuleleSpawnWeight", 30, "...and his music was electric.");
			GooboJrSpawnWeight = SyncedBindingExtensions.BindSyncedEntry<int>(configFile, "Scrap", "GooboJrSpawnWeight", 10, "Spawn a gummy clone of yourself. May not be friendly.");
			HappiestMaskSpawnWeight = SyncedBindingExtensions.BindSyncedEntry<int>(configFile, "Scrap", "HappiestMaskSpawnWeight", 10, "I hate this thing.");
			EnableShopItems = SyncedBindingExtensions.BindSyncedEntry<bool>(configFile, "Shop Items", "EnableShopItems", true, "Enable the shop items.");
			SaferSpacesPrice = SyncedBindingExtensions.BindSyncedEntry<int>(configFile, "Shop Items", "SaferSpacesPrice", 800, "Block one incoming hit. Recharges after a short delay.");
			SaferSpacesCooldown = SyncedBindingExtensions.BindSyncedEntry<float>(configFile, "Shop Items", "SaferSpacesCooldown", 3f, "How long to wait before recharging the block.");
			PowerElixirPrice = SyncedBindingExtensions.BindSyncedEntry<int>(configFile, "Shop Items", "PowerElixirPrice", 500, "Heal for a percentage of your health when you reach a certain health threshold.");
			PowerElixirHealthThreshold = SyncedBindingExtensions.BindSyncedEntry<int>(configFile, "Shop Items", "PowerElixirHealthThreshold", 25, "The health threshold to activate the item.");
			PowerElixirHealPercentage = SyncedBindingExtensions.BindSyncedEntry<float>(configFile, "Shop Items", "PowerElixirHealPercentage", 75f, "The percentage of health to heal when activated.");
			ConfigManager.Register<LacrimosumConfig>((SyncedConfig2<LacrimosumConfig>)this);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "Lacrimosum";

		public const string PLUGIN_NAME = "Lacrimosum";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace Lacrimosum.Patching
{
	internal static class ElevatorMusicReplacer
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_OnEnable <0>__OnElevatorEnable;

			public static hook_ShipLeave <1>__OnShipLeave;

			public static hook_Start <2>__OnTerminalStart;
		}

		private static bool _ranOnce;

		private static Terminal _terminal;

		public static void Init()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//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_004a: Expected O, but got Unknown
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			object obj = <>O.<0>__OnElevatorEnable;
			if (obj == null)
			{
				hook_OnEnable val = OnElevatorEnable;
				<>O.<0>__OnElevatorEnable = val;
				obj = (object)val;
			}
			MineshaftElevatorController.OnEnable += (hook_OnEnable)obj;
			RoR2Plugin.ModConsole.LogDebug((object)"ElevatorMusicReplacer: MineshaftElevatorController.OnEnable hooked!");
			object obj2 = <>O.<1>__OnShipLeave;
			if (obj2 == null)
			{
				hook_ShipLeave val2 = OnShipLeave;
				<>O.<1>__OnShipLeave = val2;
				obj2 = (object)val2;
			}
			StartOfRound.ShipLeave += (hook_ShipLeave)obj2;
			RoR2Plugin.ModConsole.LogDebug((object)"ElevatorMusicReplacer: StartOfRound.ShipLeave hooked!");
			object obj3 = <>O.<2>__OnTerminalStart;
			if (obj3 == null)
			{
				hook_Start val3 = OnTerminalStart;
				<>O.<2>__OnTerminalStart = val3;
				obj3 = (object)val3;
			}
			Terminal.Start += (hook_Start)obj3;
		}

		private static void OnTerminalStart(orig_Start orig, Terminal self)
		{
			orig.Invoke(self);
			_terminal = self;
		}

		private static void OnShipLeave(orig_ShipLeave orig, StartOfRound self)
		{
			orig.Invoke(self);
			_ranOnce = false;
		}

		private static void OnElevatorEnable(orig_OnEnable orig, MineshaftElevatorController self)
		{
			orig.Invoke(self);
			if (!_ranOnce)
			{
				if (SyncedEntry<bool>.op_Implicit(RoR2Plugin.ModConfig.AlwaysReplaceElevatorMusic))
				{
					self.elevatorJingleMusic.clip = ModAssets.ElevatorMusic;
					_ranOnce = true;
				}
				else if (new Random(_terminal.groupCredits * StartOfRound.Instance.connectedPlayersAmount).Next(0, 100) <= 2)
				{
					self.elevatorJingleMusic.clip = ModAssets.ElevatorMusic;
					_ranOnce = true;
				}
			}
		}
	}
	internal static class MenuMusicReplacer
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Awake <0>__OnMenuAwake;
		}

		private static readonly Random Rnd = new Random();

		public static void Init()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			object obj = <>O.<0>__OnMenuAwake;
			if (obj == null)
			{
				hook_Awake val = OnMenuAwake;
				<>O.<0>__OnMenuAwake = val;
				obj = (object)val;
			}
			MenuManager.Awake += (hook_Awake)obj;
			RoR2Plugin.ModConsole.LogDebug((object)"MenuMusicReplacer: MenuManager.Awake hooked!");
		}

		private static void OnMenuAwake(orig_Awake orig, MenuManager self)
		{
			if (RoR2Plugin.ModConfig.AlwaysReplaceMenuMusic.Value)
			{
				ReplaceMenuMusic(self);
				ChangeMenuColors(self);
				AddLilGuy(self);
			}
			else if (Rnd.Next(0, 100) < 2)
			{
				ReplaceMenuMusic(self);
				ChangeMenuColors(self);
				AddLilGuy(self);
			}
			orig.Invoke(self);
		}

		private static void ChangeMenuColors(MenuManager menu)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			Color color = default(Color);
			((Color)(ref color))..ctor(0f, 0.9822383f, 1f, 1f);
			GameObject gameObject = ((Component)menu.menuAnimator).gameObject;
			((Graphic)((Component)gameObject.transform.Find("VersionNum")).gameObject.GetComponent<TextMeshProUGUI>()).color = color;
			GameObject gameObject2 = ((Component)gameObject.transform.Find("MainButtons")).gameObject;
			((Graphic)gameObject2.GetComponent<Image>()).color = color;
			((Component)gameObject2.transform.Find("HeaderImage")).gameObject.GetComponent<Image>().sprite = ModAssets.BlueLogo;
		}

		private static void ReplaceMenuMusic(MenuManager menu)
		{
			menu.menuMusic = ModAssets.RoR2MenuMusic;
		}

		private static void AddLilGuy(MenuManager menu)
		{
			//IL_0045: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			GameObject gameObject = ((Component)((Component)menu.menuAnimator).gameObject.transform.Find("MainButtons")).gameObject;
			RectTransform component = Object.Instantiate<GameObject>(ModAssets.LilGuyPrefab, gameObject.transform).GetComponent<RectTransform>();
			((Transform)component).localPosition = new Vector3(207.6f, 106.5756f, 0f);
			component.anchoredPosition = new Vector2(207.6f, -130.3f);
			component.sizeDelta = new Vector2(130f, -130.3f);
		}
	}
	internal static class MineReplacement
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_SpawnExplosion <0>__OnMineSpawnExplosion;
		}

		public static void Init()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			object obj = <>O.<0>__OnMineSpawnExplosion;
			if (obj == null)
			{
				hook_SpawnExplosion val = OnMineSpawnExplosion;
				<>O.<0>__OnMineSpawnExplosion = val;
				obj = (object)val;
			}
			Landmine.SpawnExplosion += (hook_SpawnExplosion)obj;
			RoR2Plugin.ModConsole.LogDebug((object)"MineReplacement: Landmine.SpawnExplosion hooked!");
		}

		private static void OnMineSpawnExplosion(orig_SpawnExplosion orig, Vector3 explosionPosition, bool spawnExplosionEffect, float killRange, float damageRange, int nonLethalDamage, float physicsForce, GameObject overridePrefab, bool goThroughCar)
		{
			//IL_0025: 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)
			if (SyncedEntry<bool>.op_Implicit(RoR2Plugin.ModConfig.DontOverrideMineCode))
			{
				orig.Invoke(explosionPosition, spawnExplosionEffect, killRange, damageRange, nonLethalDamage, physicsForce, overridePrefab, goThroughCar);
			}
			else
			{
				Utilities.CreateExplosion(explosionPosition, spawnExplosionEffect, 100, killRange, damageRange, physicsForce.RoundToInt(), (CauseOfDeath)3);
			}
		}
	}
	internal static class NetworkPrefabsHelper
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Start <0>__OnNetworkManagerStart;
		}

		public static readonly List<GameObject> NetworkPrefabs = new List<GameObject>();

		public static EnemyType MaskedEnemy;

		public static void Init()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			object obj = <>O.<0>__OnNetworkManagerStart;
			if (obj == null)
			{
				hook_Start val = OnNetworkManagerStart;
				<>O.<0>__OnNetworkManagerStart = val;
				obj = (object)val;
			}
			GameNetworkManager.Start += (hook_Start)obj;
		}

		private static void OnNetworkManagerStart(orig_Start orig, GameNetworkManager self)
		{
			orig.Invoke(self);
			foreach (NetworkPrefab prefab in NetworkManager.Singleton.NetworkConfig.Prefabs.Prefabs)
			{
				NetworkPrefabs.Add(prefab.Prefab);
			}
			FindRequiredPrefabs();
		}

		private static void FindRequiredPrefabs()
		{
			MaskedEnemy = NetworkPrefabs.Find((GameObject prefab) => ((Object)prefab).name == "MaskedPlayerEnemy").GetComponent<EnemyAI>().enemyType;
		}
	}
	internal static class PlayerEventTracker
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_SpawnDeadBody <0>__PlayerCorpseSpawned;

			public static hook_DamagePlayer <1>__PlayerDamaged;

			public static hook_Start <2>__PlayerStart;
		}

		public static void Init()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//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_004a: Expected O, but got Unknown
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			object obj = <>O.<0>__PlayerCorpseSpawned;
			if (obj == null)
			{
				hook_SpawnDeadBody val = PlayerCorpseSpawned;
				<>O.<0>__PlayerCorpseSpawned = val;
				obj = (object)val;
			}
			PlayerControllerB.SpawnDeadBody += (hook_SpawnDeadBody)obj;
			RoR2Plugin.ModConsole.LogDebug((object)"PlayerEventTracker: PlayerControllerB.SpawnDeadBody hooked!");
			object obj2 = <>O.<1>__PlayerDamaged;
			if (obj2 == null)
			{
				hook_DamagePlayer val2 = PlayerDamaged;
				<>O.<1>__PlayerDamaged = val2;
				obj2 = (object)val2;
			}
			PlayerControllerB.DamagePlayer += (hook_DamagePlayer)obj2;
			RoR2Plugin.ModConsole.LogDebug((object)"PlayerEventTracker: PlayerControllerB.DamagePlayer hooked!");
			object obj3 = <>O.<2>__PlayerStart;
			if (obj3 == null)
			{
				hook_Start val3 = PlayerStart;
				<>O.<2>__PlayerStart = val3;
				obj3 = (object)val3;
			}
			PlayerControllerB.Start += (hook_Start)obj3;
			RoR2Plugin.ModConsole.LogDebug((object)"PlayerEventTracker: PlayerControllerB.Start hooked!");
		}

		private static void PlayerDamaged(orig_DamagePlayer orig, PlayerControllerB self, int damageNumber, bool hasDamageSfx, bool callRPC, CauseOfDeath causeOfDeath, int deathAnimation, bool fallDamage, Vector3 force)
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			RoR2Plugin.ModConsole.LogDebug((object)(self.playerUsername + " damaged"));
			List<SaferSpaces> activeSpaces = SaferSpaces.ActiveSpaces;
			if (activeSpaces.Count == 0)
			{
				HandlePennies(self);
				RoR2Plugin.ModConsole.LogDebug((object)("HandlePennies for " + self.playerUsername));
				HandlePowerElixir(self, damageNumber);
				RoR2Plugin.ModConsole.LogDebug((object)("HandlePowerElixir for " + self.playerUsername));
				orig.Invoke(self, damageNumber, hasDamageSfx, callRPC, causeOfDeath, deathAnimation, fallDamage, force);
				RoR2Plugin.ModConsole.LogDebug((object)("Player " + self.playerUsername + " will take damage because no one is holding a Safer Spaces."));
			}
			foreach (SaferSpaces item in activeSpaces)
			{
				if (item.IsPlayerHolding(self))
				{
					if (item.CanBlock)
					{
						RoR2Plugin.ModConsole.LogDebug((object)("Player " + self.playerUsername + " will not take damage because " + ((Object)((Component)item).gameObject).name + " is holding a Safer Spaces."));
						item.PlaySound();
						item.StartCooldown();
					}
					else
					{
						HandlePennies(self);
						RoR2Plugin.ModConsole.LogDebug((object)("HandlePennies for " + self.playerUsername));
						HandlePowerElixir(self, damageNumber);
						RoR2Plugin.ModConsole.LogDebug((object)("HandlePowerElixir for " + self.playerUsername));
						orig.Invoke(self, damageNumber, hasDamageSfx, callRPC, causeOfDeath, deathAnimation, fallDamage, force);
						RoR2Plugin.ModConsole.LogDebug((object)("Player " + self.playerUsername + " will take damage because their safer spaces is on cooldown or is out of battery."));
					}
				}
			}
		}

		private static void PlayerCorpseSpawned(orig_SpawnDeadBody orig, PlayerControllerB self, int playerId, Vector3 bodyVelocity, int causeOfDeath, PlayerControllerB deadPlayerController, int deathAnimation, Transform overridePosition, Vector3 positionOffset)
		{
			//IL_001d: 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)
			RoR2Plugin.ModConsole.LogDebug((object)(self.playerUsername + "'s corpse got spawned"));
			orig.Invoke(self, playerId, bodyVelocity, causeOfDeath, deadPlayerController, deathAnimation, overridePosition, positionOffset);
			HandleWillOWisp(self);
			RoR2Plugin.ModConsole.LogDebug((object)("HandleWillOWisp for " + self.playerUsername));
		}

		private static void PlayerStart(orig_Start orig, PlayerControllerB self)
		{
			RoR2Plugin.ModConsole.LogDebug((object)("Player " + self.playerUsername + " started!"));
			orig.Invoke(self);
			SetupBungusWard(self);
			SetupSaferSpacesBubble(self);
		}

		private static void SetupBungusWard(PlayerControllerB player)
		{
			GameObject obj = Object.Instantiate<GameObject>(ModAssets.BungusMushroomWardPrefab, ((Component)player).transform);
			((Object)obj).name = "MushroomWard";
			obj.SetActive(false);
			RoR2Plugin.ModConsole.LogDebug((object)("Set up BungusWard for " + player.playerUsername + "!"));
		}

		private static void SetupSaferSpacesBubble(PlayerControllerB player)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = Object.Instantiate<GameObject>(ModAssets.SaferSpacesBubblePrefab, ((Component)player).transform);
			((Object)obj).name = "SaferSpacesBubble";
			obj.SetActive(false);
			obj.transform.localPosition = new Vector3(0f, 2.299524f, 0f);
			obj.transform.SetParent(player.playerGlobalHead, true);
			RoR2Plugin.ModConsole.LogDebug((object)("Set up SaferSpacesBubble for " + player.playerUsername + "!"));
		}

		private static void HandleWillOWisp(PlayerControllerB player)
		{
			if (WilloWisp.ActiveWisps.Count == 0)
			{
				return;
			}
			foreach (WilloWisp activeWisp in WilloWisp.ActiveWisps)
			{
				activeWisp.CheckPlayerDeath(player);
			}
		}

		private static void HandlePennies(PlayerControllerB player)
		{
			if (RollOfPennies.ActivePennies.Count == 0)
			{
				return;
			}
			foreach (RollOfPennies activePenny in RollOfPennies.ActivePennies)
			{
				activePenny.CheckDamagedPlayer(player);
			}
		}

		private static void HandlePowerElixir(PlayerControllerB player, int damage)
		{
			if (PowerElixir.ActiveElixirs.Count == 0)
			{
				return;
			}
			foreach (PowerElixir activeElixir in PowerElixir.ActiveElixirs)
			{
				activeElixir.CheckHealth(player, damage);
			}
		}
	}
}
namespace Lacrimosum.ItemScripts
{
	[AddComponentMenu("Lacrimosum/Bustling Fungus")]
	public class Bungus : ItemBehaviour
	{
		[Space(10f)]
		[Header("Bustling Fungus Settings")]
		[Tooltip("The amount of health to heal per second when in the zone.")]
		public int addedHealth = 10;

		[Tooltip("The time between each heal.")]
		public float healInterval = 1f;

		[Tooltip("How long the player must be standing for the zone to activate.")]
		public float activationTime = 3f;

		[Tooltip("The sound to play when the zone activates.")]
		public AudioClip activationSound;

		private bool _isHealing;

		private GameObject _mushroomWard;

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			addedHealth = SyncedEntry<int>.op_Implicit(RoR2Plugin.ModConfig.BungusHealthIncrease);
			healInterval = SyncedEntry<float>.op_Implicit(RoR2Plugin.ModConfig.BungusHealInterval);
			activationTime = SyncedEntry<float>.op_Implicit(RoR2Plugin.ModConfig.BungusActivationTime);
			if (SyncedEntry<bool>.op_Implicit(RoR2Plugin.ModConfig.BungusMode))
			{
				base.ScanNodeProperties.headerText = "Bungus";
			}
		}

		public override void GrabItem()
		{
			base.GrabItem();
			_mushroomWard = ((GrabbableObject)this).playerHeldBy.GetMushroomWard();
		}

		public override void Update()
		{
			((GrabbableObject)this).Update();
			if (Object.op_Implicit((Object)(object)((GrabbableObject)this).playerHeldBy))
			{
				if (((GrabbableObject)this).playerHeldBy.timeSincePlayerMoving > activationTime && !_isHealing)
				{
					StartHealServerRpc();
				}
				else if (((GrabbableObject)this).playerHeldBy.timeSincePlayerMoving < activationTime && _isHealing)
				{
					StopHealServerRpc();
				}
			}
		}

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

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

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

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

		private IEnumerator HealRoutine()
		{
			PlayerControllerB val = default(PlayerControllerB);
			while (_isHealing)
			{
				Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, 3f, LayerMask.GetMask(new string[1] { "Player" }));
				Collider[] array2 = array;
				for (int i = 0; i < array2.Length; i++)
				{
					if (!((Component)array2[i]).TryGetComponent<PlayerControllerB>(ref val))
					{
						continue;
					}
					if (val.health != 100)
					{
						PlayerControllerB obj = val;
						obj.health += addedHealth;
						if (val.health > 100)
						{
							val.health = 100;
						}
						((GrabbableObject)this).playerHeldBy.criticallyInjured = false;
						if (Object.op_Implicit((Object)(object)((GrabbableObject)this).playerHeldBy.playerBodyAnimator))
						{
							((GrabbableObject)this).playerHeldBy.playerBodyAnimator.SetBool("Limp", false);
						}
						((GrabbableObject)this).playerHeldBy.bleedingHeavily = false;
					}
					yield return (object)new WaitForSeconds(healInterval);
				}
			}
		}

		public override void DiscardItem()
		{
			((GrabbableObject)this).DiscardItem();
			if (_isHealing)
			{
				StopHealServerRpc();
			}
			_mushroomWard.SetActive(false);
			_mushroomWard = null;
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_Bungus()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3871419403u, new RpcReceiveHandler(__rpc_handler_3871419403));
			NetworkManager.__rpc_func_table.Add(2151538089u, new RpcReceiveHandler(__rpc_handler_2151538089));
			NetworkManager.__rpc_func_table.Add(1926513613u, new RpcReceiveHandler(__rpc_handler_1926513613));
			NetworkManager.__rpc_func_table.Add(4147429621u, new RpcReceiveHandler(__rpc_handler_4147429621));
		}

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

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

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

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

		protected internal override string __getTypeName()
		{
			return "Bungus";
		}
	}
	[AddComponentMenu("Lacrimosum/Paul's Goat Hoof")]
	public class GoatHoof : ItemBehaviour
	{
		[Space(10f)]
		[Header("Paul's Goat Hoof Settings")]
		[Tooltip("The amount of speed to add when held.")]
		public float addedSpeedPercent = 4.6f;

		public override void OnNetworkSpawn()
		{
			addedSpeedPercent = SyncedEntry<float>.op_Implicit(RoR2Plugin.ModConfig.GoatHoofSpeedIncrease);
		}

		public override void GrabItem()
		{
			base.GrabItem();
			if (((NetworkBehaviour)this).IsOwner)
			{
				AddSpeedServerRpc();
			}
		}

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

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

		public override void DiscardItem()
		{
			((GrabbableObject)this).DiscardItem();
			if (((NetworkBehaviour)this).IsOwner)
			{
				RemoveSpeedServerRpc();
			}
		}

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

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

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_GoatHoof()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(2264686608u, new RpcReceiveHandler(__rpc_handler_2264686608));
			NetworkManager.__rpc_func_table.Add(3950335989u, new RpcReceiveHandler(__rpc_handler_3950335989));
			NetworkManager.__rpc_func_table.Add(2013262870u, new RpcReceiveHandler(__rpc_handler_2013262870));
			NetworkManager.__rpc_func_table.Add(2130733099u, new RpcReceiveHandler(__rpc_handler_2130733099));
		}

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

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

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

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

		protected internal override string __getTypeName()
		{
			return "GoatHoof";
		}
	}
	[AddComponentMenu("Lacrimosum/Goobo Jr.")]
	public class GooboJr : ThrowableItemBehaviour
	{
		[Space(10f)]
		[Header("Goobo Jr. Settings")]
		[Tooltip("The material to apply to the masked enemy.")]
		public Material gooboJrMaterial;

		[Tooltip("The sounds to play when a Goobo is spawned.")]
		public AudioClip[] gooboSpawnSounds;

		public override void PlayDropSFX()
		{
			((GrabbableObject)this).PlayDropSFX();
			if (WasThrown && !(StartOfRound.Instance.currentLevel.PlanetName == "71 Gordion"))
			{
				SpawnMaskedEnemyServerRpc();
			}
		}

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

		[ClientRpc]
		private void SpawnMaskedEnemyClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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_00e1: 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_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3195257550u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3195257550u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			RoundManager.Instance.SpawnEnemyGameObject(((Component)this).transform.position, ((Component)this).transform.rotation.y, 0, NetworkPrefabsHelper.MaskedEnemy);
			MaskedPlayerEnemy[] array = Object.FindObjectsOfType<MaskedPlayerEnemy>();
			foreach (MaskedPlayerEnemy val3 in array)
			{
				if (!(Vector3.Distance(((Component)val3).transform.position, ((Component)this).transform.position) > 2f))
				{
					SkinnedMeshRenderer[] componentsInChildren = ((Component)val3).GetComponentsInChildren<SkinnedMeshRenderer>();
					for (int j = 0; j < componentsInChildren.Length; j++)
					{
						((Renderer)componentsInChildren[j]).material = gooboJrMaterial;
					}
				}
			}
			AudioSource.PlayClipAtPoint(gooboSpawnSounds[Random.Range(0, gooboSpawnSounds.Length)], ((Component)this).transform.position);
			base.NetworkObject.Despawn(true);
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_GooboJr()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3896560153u, new RpcReceiveHandler(__rpc_handler_3896560153));
			NetworkManager.__rpc_func_table.Add(3195257550u, new RpcReceiveHandler(__rpc_handler_3195257550));
		}

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

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

		protected internal override string __getTypeName()
		{
			return "GooboJr";
		}
	}
	[AddComponentMenu("Lacrimosum/Happiest Mask")]
	public class HappiestMask : HauntedMaskItem
	{
		public override void OnNetworkSpawn()
		{
			base.mimicEnemy = NetworkPrefabsHelper.MaskedEnemy;
		}

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

		protected internal override string __getTypeName()
		{
			return "HappiestMask";
		}
	}
	[AddComponentMenu("Lacrimosum/Item Behaviour")]
	public class ItemBehaviour : GrabbableObject
	{
		protected PlayerControllerB LastPlayerHeldBy;

		protected NetworkObject NetworkObject => ((Component)this).GetComponent<NetworkObject>();

		protected ScanNodeProperties ScanNodeProperties => ((Component)this).GetComponentInChildren<ScanNodeProperties>();

		protected AudioSource AudioSource => ((Component)this).GetComponent<AudioSource>();

		public override void GrabItem()
		{
			((GrabbableObject)this).GrabItem();
			LastPlayerHeldBy = base.playerHeldBy;
		}

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

		protected internal override string __getTypeName()
		{
			return "ItemBehaviour";
		}
	}
	[AddComponentMenu("Lacrimosum/Power Elixir")]
	public class PowerElixir : ItemBehaviour
	{
		public static readonly List<PowerElixir> ActiveElixirs = new List<PowerElixir>();

		[Space(10f)]
		[Header("Power Elixir Settings")]
		[Tooltip("The amount of health the player must reach to activate.")]
		public int healthThreshold = 25;

		[Tooltip("The percentage of health to heal when activated.")]
		public float healPercentage = 75f;

		[Tooltip("The sounds to play when activated.")]
		public AudioClip[] activationSounds;

		public override void OnNetworkSpawn()
		{
			healthThreshold = SyncedEntry<int>.op_Implicit(RoR2Plugin.ModConfig.PowerElixirHealthThreshold);
			healPercentage = SyncedEntry<float>.op_Implicit(RoR2Plugin.ModConfig.PowerElixirHealPercentage);
		}

		public override void GrabItem()
		{
			base.GrabItem();
			ActiveElixirs.Add(this);
		}

		public override void DiscardItem()
		{
			((GrabbableObject)this).DiscardItem();
			ActiveElixirs.Remove(this);
		}

		public override void OnNetworkDespawn()
		{
			ActiveElixirs.Remove(this);
			((NetworkBehaviour)this).OnNetworkDespawn();
		}

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

		public void CheckHealth(PlayerControllerB player, int damageNumber)
		{
			if (!((Object)(object)player != (Object)(object)((GrabbableObject)this).playerHeldBy) && player.health - damageNumber <= healthThreshold)
			{
				HealPlayerServerRpc();
			}
		}

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

		[ClientRpc]
		private void HealPlayerClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(679042488u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 679042488u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				float num = (float)((GrabbableObject)this).playerHeldBy.health * (healPercentage / 100f);
				if (num > 100f)
				{
					num = 100f;
				}
				int health = num.RoundToInt();
				base.AudioSource.PlayOneShot(activationSounds[Random.Range(0, activationSounds.Length)]);
				((GrabbableObject)this).playerHeldBy.health = health;
				((GrabbableObject)this).playerHeldBy.criticallyInjured = false;
				if (Object.op_Implicit((Object)(object)((GrabbableObject)this).playerHeldBy.playerBodyAnimator))
				{
					((GrabbableObject)this).playerHeldBy.playerBodyAnimator.SetBool("Limp", false);
				}
				((GrabbableObject)this).playerHeldBy.bleedingHeavily = false;
				((MonoBehaviour)this).StartCoroutine(Despawn());
			}
		}

		private IEnumerator Despawn()
		{
			yield return (object)new WaitForSeconds(1f);
			((GrabbableObject)this).DiscardItemServerRpc();
			base.NetworkObject.Despawn(true);
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_PowerElixir()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3543231861u, new RpcReceiveHandler(__rpc_handler_3543231861));
			NetworkManager.__rpc_func_table.Add(679042488u, new RpcReceiveHandler(__rpc_handler_679042488));
		}

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

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

		protected internal override string __getTypeName()
		{
			return "PowerElixir";
		}
	}
	[AddComponentMenu("Lacrimosum/Roll Of Pennies")]
	public class RollOfPennies : ItemBehaviour
	{
		public static readonly List<RollOfPennies> ActivePennies = new List<RollOfPennies>();

		[Space(10f)]
		[Header("Roll Of Pennies Settings")]
		[Tooltip("The amount of credits to add to the item's value upon taking damage.")]
		public int addedCredits = 10;

		[Tooltip("The cap for the item's value.")]
		public int maxCredits = 100;

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			addedCredits = SyncedEntry<int>.op_Implicit(RoR2Plugin.ModConfig.RollOfPenniesValueIncrease);
			maxCredits = SyncedEntry<int>.op_Implicit(RoR2Plugin.ModConfig.RollOfPenniesMaxValue);
		}

		public override void GrabItem()
		{
			base.GrabItem();
			ActivePennies.Add(this);
		}

		public void CheckDamagedPlayer(PlayerControllerB player)
		{
			if (!((Object)(object)player != (Object)(object)((GrabbableObject)this).playerHeldBy) && ((GrabbableObject)this).scrapValue < maxCredits)
			{
				AddCreditsServerRpc();
			}
		}

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

		[ClientRpc]
		private void AddCreditsClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2286663356u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2286663356u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					((GrabbableObject)this).scrapValue = ((GrabbableObject)this).scrapValue + addedCredits;
					base.ScanNodeProperties.scrapValue = ((GrabbableObject)this).scrapValue;
					base.ScanNodeProperties.subText = $"Value: ${((GrabbableObject)this).scrapValue}";
				}
			}
		}

		public override void DiscardItem()
		{
			((GrabbableObject)this).DiscardItem();
			ActivePennies.Remove(this);
		}

		public override void OnNetworkDespawn()
		{
			ActivePennies.Remove(this);
			((NetworkBehaviour)this).OnNetworkDespawn();
		}

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

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_RollOfPennies()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3084010551u, new RpcReceiveHandler(__rpc_handler_3084010551));
			NetworkManager.__rpc_func_table.Add(2286663356u, new RpcReceiveHandler(__rpc_handler_2286663356));
		}

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

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

		protected internal override string __getTypeName()
		{
			return "RollOfPennies";
		}
	}
	[AddComponentMenu("Lacrimosum/Safer Spaces")]
	public class SaferSpaces : ItemBehaviour
	{
		public static readonly List<SaferSpaces> ActiveSpaces = new List<SaferSpaces>();

		[Space(10f)]
		[Header("Safer Spaces Settings")]
		[Tooltip("The cooldown between each activation.")]
		public float cooldown = 3f;

		[Tooltip("A list of sounds to pick from when activated.")]
		public AudioClip[] activationSounds;

		[Tooltip("The sound to play when the cooldown ends.")]
		public AudioClip cooldownEndSound;

		[NonSerialized]
		public bool CanBlock = true;

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			cooldown = SyncedEntry<float>.op_Implicit(RoR2Plugin.ModConfig.SaferSpacesCooldown);
		}

		public override void GrabItem()
		{
			base.GrabItem();
			ActiveSpaces.Add(this);
			StartCooldown();
		}

		public bool IsPlayerHolding(PlayerControllerB player)
		{
			return (Object)(object)player == (Object)(object)((GrabbableObject)this).playerHeldBy;
		}

		public void PlaySound()
		{
			PlaySoundServerRpc();
		}

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

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

		public void StartCooldown()
		{
			CooldownServerRpc();
		}

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

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

		private IEnumerator Cooldown()
		{
			((GrabbableObject)this).playerHeldBy.GetSaferSpacesBubble().SetActive(false);
			CanBlock = false;
			yield return (object)new WaitForSeconds(cooldown);
			((GrabbableObject)this).playerHeldBy.GetSaferSpacesBubble().SetActive(true);
			CanBlock = true;
			base.AudioSource.PlayOneShot(cooldownEndSound);
		}

		public override void DiscardItem()
		{
			((GrabbableObject)this).DiscardItem();
			ActiveSpaces.Remove(this);
			LastPlayerHeldBy.GetSaferSpacesBubble().SetActive(false);
			CanBlock = false;
		}

		public override void OnNetworkDespawn()
		{
			ActiveSpaces.Remove(this);
			LastPlayerHeldBy.GetSaferSpacesBubble().SetActive(false);
			CanBlock = false;
			((NetworkBehaviour)this).OnNetworkDespawn();
		}

		public override void OnDestroy()
		{
			ActiveSpaces.Remove(this);
			LastPlayerHeldBy.GetSaferSpacesBubble().SetActive(false);
			CanBlock = false;
			((NetworkBehaviour)this).OnDestroy();
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_SaferSpaces()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(4256016625u, new RpcReceiveHandler(__rpc_handler_4256016625));
			NetworkManager.__rpc_func_table.Add(1970247913u, new RpcReceiveHandler(__rpc_handler_1970247913));
			NetworkManager.__rpc_func_table.Add(1450211957u, new RpcReceiveHandler(__rpc_handler_1450211957));
			NetworkManager.__rpc_func_table.Add(2238259042u, new RpcReceiveHandler(__rpc_handler_2238259042));
		}

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

		private static void __rpc_handler_1970247913(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int index = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref index);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SaferSpaces)(object)target).PlaySoundClientRpc(index);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

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

		protected internal override string __getTypeName()
		{
			return "SaferSpaces";
		}
	}
	[AddComponentMenu("Lacrimosum/Throwable Item Behaviour")]
	public class ThrowableItemBehaviour : ItemBehaviour
	{
		[Space(10f)]
		[Header("Throw Curve Settings")]
		public AnimationCurve itemFallCurve;

		public AnimationCurve itemVerticalFallCurveNoBounce;

		protected bool WasThrown;

		private RaycastHit _itemHit;

		private Ray _itemThrowRay;

		private const int StunGrenadeMask = 268437761;

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (((NetworkBehaviour)this).IsOwner)
			{
				((GrabbableObject)this).playerHeldBy.DiscardHeldObject(true, (NetworkObject)null, GetGrenadeThrowDestination(), true);
				WasThrown = true;
			}
		}

		public override void FallWithCurve()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: 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_0041: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: 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_0105: 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)
			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 = 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), (magnitude > 5f) ? itemVerticalFallCurveNoBounce.Evaluate(((GrabbableObject)this).fallTime) : itemFallCurve.Evaluate(((GrabbableObject)this).fallTime));
			((GrabbableObject)this).fallTime = ((GrabbableObject)this).fallTime + Mathf.Abs(Time.deltaTime * 12f / magnitude);
		}

		private Vector3 GetGrenadeThrowDestination()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_0069: 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)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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_00bc: 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_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			Debug.DrawRay(((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.position, ((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.forward, Color.yellow, 15f);
			_itemThrowRay = new Ray(((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.position, ((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.forward);
			Vector3 val = ((!Physics.Raycast(_itemThrowRay, ref _itemHit, 12f, 268437761, (QueryTriggerInteraction)1)) ? ((Ray)(ref _itemThrowRay)).GetPoint(10f) : ((Ray)(ref _itemThrowRay)).GetPoint(((RaycastHit)(ref _itemHit)).distance - 0.05f));
			Debug.DrawRay(val, Vector3.down, Color.blue, 15f);
			_itemThrowRay = new Ray(val, Vector3.down);
			if (Physics.Raycast(_itemThrowRay, ref _itemHit, 30f, 268437761, (QueryTriggerInteraction)1))
			{
				return ((RaycastHit)(ref _itemHit)).point + Vector3.up * 0.05f;
			}
			return ((Ray)(ref _itemThrowRay)).GetPoint(30f);
		}

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

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

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

		public override void GrabItem()
		{
			base.GrabItem();
			WasThrown = false;
		}

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

		protected internal override string __getTypeName()
		{
			return "ThrowableItemBehaviour";
		}
	}
	[AddComponentMenu("Lacrimosum/Ukulele")]
	public class Ukulele : ItemBehaviour
	{
		public int shovelHitForce = 1;

		public bool reelingUp;

		public bool isHoldingButton;

		private RaycastHit _rayHit;

		private Coroutine _reelingUpCoroutine;

		private RaycastHit[] _objectsHitByShovel;

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

		public AudioClip reelUp;

		public AudioClip swing;

		[FormerlySerializedAs("hitSFX")]
		public AudioClip[] hitSfx;

		public AudioSource shovelAudio;

		private PlayerControllerB _previousPlayerHeldBy;

		private const int ShovelMask = 1084754248;

		[Header("Ukulele Settings")]
		[Tooltip("The particles to play when the ukulele hits something")]
		public ParticleSystem zapEffect;

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			if ((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null)
			{
				return;
			}
			isHoldingButton = buttonDown;
			if (!reelingUp && buttonDown)
			{
				reelingUp = true;
				_previousPlayerHeldBy = ((GrabbableObject)this).playerHeldBy;
				if (_reelingUpCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(_reelingUpCoroutine);
				}
				_reelingUpCoroutine = ((MonoBehaviour)this).StartCoroutine(ReelUpShovel());
			}
		}

		private IEnumerator ReelUpShovel()
		{
			((GrabbableObject)this).playerHeldBy.activatingItem = true;
			((GrabbableObject)this).playerHeldBy.twoHanded = true;
			((GrabbableObject)this).playerHeldBy.playerBodyAnimator.ResetTrigger("shovelHit");
			((GrabbableObject)this).playerHeldBy.playerBodyAnimator.SetBool("reelingUp", true);
			shovelAudio.PlayOneShot(reelUp);
			ReelUpSfxServerRpc();
			yield return (object)new WaitForSeconds(0.35f);
			yield return (object)new WaitUntil((Func<bool>)(() => !isHoldingButton));
			SwingShovel(!((GrabbableObject)this).isHeld);
			yield return (object)new WaitForSeconds(0.13f);
			yield return (object)new WaitForEndOfFrame();
			HitShovel(!((GrabbableObject)this).isHeld);
			yield return (object)new WaitForSeconds(0.3f);
			reelingUp = false;
			_reelingUpCoroutine = null;
		}

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

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

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

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

		public void HitShovel(bool cancel = false)
		{
			//IL_0050: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: 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_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_previousPlayerHeldBy == (Object)null)
			{
				Debug.LogError((object)"Previousplayerheldby is null on this client when HitShovel is called.");
				return;
			}
			_previousPlayerHeldBy.activatingItem = false;
			bool flag = false;
			bool flag2 = false;
			bool flag3 = false;
			int num = -1;
			if (!cancel)
			{
				_previousPlayerHeldBy.twoHanded = false;
				_objectsHitByShovel = Physics.SphereCastAll(((Component)_previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)_previousPlayerHeldBy.gameplayCamera).transform.right * -0.35f, 0.8f, ((Component)_previousPlayerHeldBy.gameplayCamera).transform.forward, 1.5f, 1084754248, (QueryTriggerInteraction)2);
				_objectsHitByShovelList = _objectsHitByShovel.OrderBy((RaycastHit x) => ((RaycastHit)(ref x)).distance).ToList();
				List<EnemyAI> list = new List<EnemyAI>();
				IHittable val2 = default(IHittable);
				foreach (RaycastHit objectsHitByShovel in _objectsHitByShovelList)
				{
					RaycastHit val = objectsHitByShovel;
					if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 8)
					{
						val = objectsHitByShovel;
						if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 11)
						{
							val = objectsHitByShovel;
							if (!((Component)((RaycastHit)(ref val)).transform).TryGetComponent<IHittable>(ref val2))
							{
								continue;
							}
							val = objectsHitByShovel;
							if ((Object)(object)((RaycastHit)(ref val)).transform == (Object)(object)((Component)_previousPlayerHeldBy).transform)
							{
								continue;
							}
							val = objectsHitByShovel;
							if (!(((RaycastHit)(ref val)).point == Vector3.zero))
							{
								Vector3 position = ((Component)_previousPlayerHeldBy.gameplayCamera).transform.position;
								val = objectsHitByShovel;
								Vector3 point = ((RaycastHit)(ref val)).point;
								RaycastHit val3 = default(RaycastHit);
								int collidersAndRoomMaskAndDefault = StartOfRound.Instance.collidersAndRoomMaskAndDefault;
								if (Physics.Linecast(position, point, ref val3, collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
								{
									continue;
								}
							}
							flag = true;
							Vector3 forward = ((Component)_previousPlayerHeldBy.gameplayCamera).transform.forward;
							try
							{
								val = objectsHitByShovel;
								EnemyAICollisionDetect component = ((Component)((RaycastHit)(ref val)).transform).GetComponent<EnemyAICollisionDetect>();
								if (Object.op_Implicit((Object)(object)component))
								{
									if (Object.op_Implicit((Object)(object)component.mainScript) && !list.Contains(component.mainScript))
									{
										goto IL_0249;
									}
									continue;
								}
								val = objectsHitByShovel;
								if (!Object.op_Implicit((Object)(object)((Component)((RaycastHit)(ref val)).transform).GetComponent<PlayerControllerB>()))
								{
									goto IL_0249;
								}
								if (!flag3)
								{
									flag3 = true;
									goto IL_0249;
								}
								goto end_IL_01e8;
								IL_0249:
								bool flag4 = val2.Hit(shovelHitForce, forward, _previousPlayerHeldBy, true, 1);
								if (flag4 && (Object)(object)component != (Object)null)
								{
									list.Add(component.mainScript);
								}
								if (!flag2)
								{
									flag2 = flag4;
								}
								end_IL_01e8:;
							}
							ca