Decompiled source of PremiumScraps v2.0.11

plugins/PremiumScraps.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using DigitalRuby.ThunderAndLightning;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using LethalThings.Patches;
using Microsoft.CodeAnalysis;
using MysteryDice;
using MysteryDice.Effects;
using PremiumScraps.CustomEffects;
using PremiumScraps.NetcodePatcher;
using PremiumScraps.Utils;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;

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

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace PremiumScraps
{
	internal class Config
	{
		public readonly List<ulong> unluckyPlayersID = new List<ulong>();

		public readonly ConfigEntry<bool> diceEvents;

		public readonly ConfigEntry<string> unluckyPlayersStr;

		public readonly List<ConfigEntry<int>> entries = new List<ConfigEntry<int>>();

		public Config(ConfigFile cfg, List<Scrap> scraps)
		{
			cfg.SaveOnConfigSet = false;
			diceEvents = cfg.Bind<bool>("General", "Dice events", true, "Adds some custom dice rolls to Emergency Dice items. Requires 'Emergency Dice Updated' 1.6.5+ to work, or else it will be automatically false.");
			unluckyPlayersStr = cfg.Bind<string>("General", "Unlucky players", "76561198984467725,76561199094139351,76561198198881967", "Comma separated list of players Steam ID that you want them to be unlucky. Bad things will happen to unlucky players, use this config to take a sweet revenge on your friends...");
			foreach (Scrap scrap in scraps)
			{
				entries.Add(cfg.Bind<int>("Spawn chance", scrap.asset.Split("/")[0], scrap.rarity, (ConfigDescription)null));
			}
			cfg.Save();
			cfg.SaveOnConfigSet = true;
		}

		public void SetupCustomConfigs()
		{
			foreach (string item in from s in unluckyPlayersStr.Value.Split(',')
				select s.Trim())
			{
				if (ulong.TryParse(item, out var result))
				{
					unluckyPlayersID.Add(result);
				}
			}
		}
	}
	[BepInPlugin("zigzag.premiumscraps", "PremiumScraps", "2.0.11")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private const string GUID = "zigzag.premiumscraps";

		private const string NAME = "PremiumScraps";

		private const string VERSION = "2.0.11";

		public static Plugin instance;

		public static List<AudioClip> audioClips;

		private readonly Harmony harmony = new Harmony("zigzag.premiumscraps");

		internal static Config config { get; private set; }

		private void HarmonyPatchAll()
		{
			harmony.CreateClassProcessor(typeof(GetEnemies), true).Patch();
			if (Chainloader.PluginInfos.ContainsKey("evaisa.lethalthings"))
			{
				harmony.CreateClassProcessor(typeof(LethalThingsBombItemChargerPatch), true).Patch();
			}
			else
			{
				harmony.CreateClassProcessor(typeof(BombItemChargerPatch), true).Patch();
			}
			if (Chainloader.PluginInfos.ContainsKey("mattymatty.MattyFixes"))
			{
				harmony.CreateClassProcessor(typeof(MattyFixesAirhornPositionPatch), true).Patch();
			}
			if (config.diceEvents.Value && Chainloader.PluginInfos.ContainsKey("Theronguard.EmergencyDice"))
			{
				DiceEvents.RegisterDiceEvents(((BaseUnityPlugin)this).Logger, Chainloader.PluginInfos.GetValueOrDefault("Theronguard.EmergencyDice").Metadata);
			}
		}

		private void LoadItemBehaviour(Item item, int behaviourId)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Expected O, but got Unknown
			GrabbableObject val;
			switch (behaviourId)
			{
			default:
				return;
			case 1:
				val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<FakeAirhorn>();
				SetupScript.Copy((NoisemakerProp)val, item);
				break;
			case 2:
				val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<TrollFace>();
				break;
			case 3:
				val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<ScrollTP>();
				break;
			case 4:
				val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<LegendaryStick>();
				break;
			case 5:
				val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<StupidBook>();
				break;
			case 6:
				val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<JobDark>();
				break;
			case 7:
				val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<SpanishDrink>();
				break;
			case 8:
				val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<TalkingBall>();
				SetupScript.Copy((SoccerBallProp)val, item);
				break;
			case 9:
				val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<HarryDoll>();
				break;
			case 10:
				val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<Bomb>();
				SetupScript.Copy((ThrowableItem)(object)val, item);
				break;
			case 11:
				val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<LichKingHelm>();
				break;
			}
			val.grabbable = true;
			val.isInFactory = true;
			val.grabbableToEnemies = true;
			val.itemProperties = item;
		}

		private void Awake()
		{
			instance = this;
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "premiumscraps");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			string text2 = "Assets/Data/";
			audioClips = new List<AudioClip>
			{
				val.LoadAsset<AudioClip>(text2 + "_audio/AirHorn1.ogg"),
				val.LoadAsset<AudioClip>(text2 + "_audio/friendship_ends_here.wav"),
				val.LoadAsset<AudioClip>(text2 + "_audio/scroll_tp.wav"),
				val.LoadAsset<AudioClip>(text2 + "_audio/ShovelReelUp.ogg"),
				val.LoadAsset<AudioClip>(text2 + "_audio/ShovelSwing.ogg"),
				val.LoadAsset<AudioClip>(text2 + "_audio/wooden-staff-hit.wav"),
				val.LoadAsset<AudioClip>(text2 + "_audio/MineTrigger.ogg"),
				val.LoadAsset<AudioClip>(text2 + "_audio/book_page.wav"),
				val.LoadAsset<AudioClip>(text2 + "_audio/CVuse1.wav"),
				val.LoadAsset<AudioClip>(text2 + "_audio/CVuse2.wav"),
				val.LoadAsset<AudioClip>(text2 + "_audio/CVuse3.wav"),
				val.LoadAsset<AudioClip>(text2 + "_audio/CVuse4.wav"),
				val.LoadAsset<AudioClip>(text2 + "_audio/TerminalAlarm.ogg"),
				val.LoadAsset<AudioClip>(text2 + "_audio/Breathing.wav"),
				val.LoadAsset<AudioClip>(text2 + "_audio/huh.wav"),
				val.LoadAsset<AudioClip>(text2 + "_audio/book_use_redesign.wav"),
				val.LoadAsset<AudioClip>(text2 + "_audio/uwu.wav"),
				val.LoadAsset<AudioClip>(text2 + "_audio/uwu-rot.wav"),
				val.LoadAsset<AudioClip>(text2 + "_audio/drink.wav"),
				val.LoadAsset<AudioClip>(text2 + "_audio/spanishsound.wav"),
				val.LoadAsset<AudioClip>(text2 + "_audio/arthas.wav")
			};
			List<Scrap> list = new List<Scrap>
			{
				new Scrap("Frieren/FrierenItem.asset", 10),
				new Scrap("Chocobo/ChocoboItem.asset", 10),
				new Scrap("AinzOoalGown/AinzOoalGownItem.asset", 5),
				new Scrap("HelmDomination/HelmDominationItem.asset", 11, 11),
				new Scrap("TheKing/TheKingItem.asset", 13),
				new Scrap("HarryMason/HarryMasonItem.asset", 10, 9),
				new Scrap("Cristal/CristalItem.asset", 9),
				new Scrap("PuppyShark/PuppySharkItem.asset", 10),
				new Scrap("Rupee/RupeeItem.asset", 15),
				new Scrap("EaNasir/EaNasirItem.asset", 9),
				new Scrap("HScard/HSCardItem.asset", 10),
				new Scrap("SODA/SODAItem.asset", 8),
				new Scrap("Spoon/SpoonItem.asset", 12),
				new Scrap("Crouton/CroutonItem.asset", 6),
				new Scrap("AirHornCustom/AirHornCustomItem.asset", 11, 1),
				new Scrap("Balan/BalanItem.asset", 10),
				new Scrap("CustomFace/CustomFaceItem.asset", 8, 2),
				new Scrap("Scroll/ScrollItem.asset", 7, 3),
				new Scrap("Stick/StickItem.asset", 9, 4),
				new Scrap("BookCustom/BookCustomItem.asset", 11, 5),
				new Scrap("SquareSteel/SquareSteelItem.asset", 10),
				new Scrap("DarkJobApplication/JobApplicationItem.asset", 8, 6),
				new Scrap("Moogle/MoogleItem.asset", 10),
				new Scrap("Gazpacho/GazpachoItem.asset", 9, 7),
				new Scrap("Abi/AbiItem.asset", 4, 8),
				new Scrap("Bomb/BombItem.asset", 10, 10)
			};
			int num = 0;
			config = new Config(((BaseUnityPlugin)this).Config, list);
			config.SetupCustomConfigs();
			SetupScript.Network();
			foreach (Scrap item in list)
			{
				Item val2 = val.LoadAsset<Item>(text2 + item.asset);
				if (item.behaviourId != 0)
				{
					LoadItemBehaviour(val2, item.behaviourId);
				}
				NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
				Utilities.FixMixerGroups(val2.spawnPrefab);
				Items.RegisterScrap(val2, config.entries[num++].Value, (LevelTypes)(-1));
			}
			HarmonyPatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"PremiumScraps is loaded !");
		}
	}
}
namespace PremiumScraps.Utils
{
	public class Scrap
	{
		public string asset;

		public int rarity;

		public int behaviourId;

		public Scrap(string asset, int rarity, int behaviourId = 0)
		{
			this.asset = asset;
			this.rarity = rarity;
			this.behaviourId = behaviourId;
		}
	}
	public class NetworkReference
	{
		public NetworkObjectReference netObjectRef;

		public int value;

		public NetworkReference(NetworkObjectReference netObjectRef, int value)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			this.netObjectRef = netObjectRef;
			this.value = value;
		}
	}
	public class SetupScript
	{
		public static void Network()
		{
			IEnumerable<Type> enumerable;
			try
			{
				enumerable = Assembly.GetExecutingAssembly().GetTypes();
			}
			catch (ReflectionTypeLoadException ex)
			{
				enumerable = ex.Types.Where((Type t) => t != null);
			}
			foreach (Type item in enumerable)
			{
				MethodInfo[] methods = item.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array = methods;
				foreach (MethodInfo methodInfo in array)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}

		public static void Copy(ThrowableItem target, Item item)
		{
			ThrowableItem component = item.spawnPrefab.GetComponent<ThrowableItem>();
			target.itemFallCurve = component.itemFallCurve;
			target.itemVerticalFallCurve = component.itemVerticalFallCurve;
			target.itemVerticalFallCurveNoBounce = component.itemVerticalFallCurveNoBounce;
			GrabbableObjectPhysicsTrigger componentInChildren = item.spawnPrefab.GetComponentInChildren<GrabbableObjectPhysicsTrigger>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				componentInChildren.itemScript = (GrabbableObject)(object)target;
			}
			Object.Destroy((Object)(object)component);
		}

		public static void Copy(NoisemakerProp target, Item item)
		{
			NoisemakerProp component = item.spawnPrefab.GetComponent<NoisemakerProp>();
			((GrabbableObject)target).useCooldown = ((GrabbableObject)component).useCooldown;
			target.noiseAudio = component.noiseAudio;
			target.noiseAudioFar = component.noiseAudioFar;
			target.noiseSFX = (AudioClip[])(object)new AudioClip[component.noiseSFX.Length];
			for (int i = 0; i < component.noiseSFX.Length; i++)
			{
				target.noiseSFX[i] = component.noiseSFX[i];
			}
			target.noiseSFXFar = (AudioClip[])(object)new AudioClip[component.noiseSFXFar.Length];
			for (int j = 0; j < component.noiseSFXFar.Length; j++)
			{
				target.noiseSFXFar[j] = component.noiseSFXFar[j];
			}
			target.noiseRange = component.noiseRange;
			target.maxLoudness = component.maxLoudness;
			target.minLoudness = component.minLoudness;
			target.minPitch = component.minPitch;
			target.maxPitch = component.maxPitch;
			target.triggerAnimator = component.triggerAnimator;
			Object.Destroy((Object)(object)component);
		}

		public static void Copy(SoccerBallProp target, Item item)
		{
			SoccerBallProp component = item.spawnPrefab.GetComponent<SoccerBallProp>();
			target.ballHitUpwardAmount = component.ballHitUpwardAmount;
			target.grenadeFallCurve = component.grenadeFallCurve;
			target.grenadeVerticalFallCurve = component.grenadeVerticalFallCurve;
			target.soccerBallVerticalOffset = component.soccerBallVerticalOffset;
			target.grenadeVerticalFallCurveNoBounce = component.grenadeVerticalFallCurveNoBounce;
			target.hitBallSFX = (AudioClip[])(object)new AudioClip[component.hitBallSFX.Length];
			for (int i = 0; i < component.hitBallSFX.Length; i++)
			{
				target.hitBallSFX[i] = component.hitBallSFX[i];
			}
			target.ballHitFloorSFX = (AudioClip[])(object)new AudioClip[component.ballHitFloorSFX.Length];
			for (int j = 0; j < component.ballHitFloorSFX.Length; j++)
			{
				target.ballHitFloorSFX[j] = component.ballHitFloorSFX[j];
			}
			target.soccerBallAudio = component.soccerBallAudio;
			target.ballCollider = component.ballCollider;
			GrabbableObjectPhysicsTrigger componentInChildren = item.spawnPrefab.GetComponentInChildren<GrabbableObjectPhysicsTrigger>();
			componentInChildren.itemScript = (GrabbableObject)(object)target;
			Object.Destroy((Object)(object)component);
		}
	}
	internal class DiceEvents
	{
		public static void RegisterDiceEvents(ManualLogSource logger, BepInPlugin diceMetadata)
		{
			if (diceMetadata.Name == "Emergency Dice Updated" && new Version("1.6.4").CompareTo(diceMetadata.Version) <= 0)
			{
				MysteryDice.RegisterNewEffect((IEffect)(object)new Premium(), false, false);
				MysteryDice.RegisterNewEffect((IEffect)(object)new Haunted(), false, false);
				MysteryDice.RegisterNewEffect((IEffect)(object)new Death(), false, false);
			}
			else
			{
				logger.LogWarning((object)"Compatibility with 'Emergency Dice Updated' was enabled but you are not using the targeted 1.6.5+ version. Custom events will not be loaded.");
			}
		}
	}
	public static class NetworkerExtensions
	{
		public static IEnumerator StartHallucination(this Networker networker, ulong playerId, int hallucinationID)
		{
			PlayerControllerB player = StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>();
			while (true)
			{
				yield return (object)new WaitForSeconds(1f);
				if (StartOfRound.Instance.shipIsLeaving || StartOfRound.Instance.inShipPhase || (Object)(object)player == (Object)null || player.isPlayerDead)
				{
					break;
				}
				switch (hallucinationID)
				{
				case 2:
					yield return networker.HauntedEffect(player);
					break;
				case 3:
					yield return networker.DeathEffect(player);
					break;
				}
			}
		}

		public static IEnumerator HauntedEffect(this Networker networker, PlayerControllerB player)
		{
			yield return JobDark.HauntedHallucination(player);
		}

		public static IEnumerator DeathEffect(this Networker networker, PlayerControllerB player)
		{
			yield return JobDark.DeathHallucination(player, null, (MonoBehaviour?)(object)networker);
		}
	}
	internal class Premium : IEffect
	{
		public string Name => "Premium Scraps";

		public EffectType Outcome => (EffectType)3;

		public bool ShowDefaultTooltip => true;

		public string Tooltip => "Spawning some nice scraps !";

		public void Use()
		{
			int num = Random.Range(0, 11);
			if (1 == 0)
			{
			}
			string text = num switch
			{
				0 => "The King", 
				1 => "Harry Mason", 
				2 => "Rupee", 
				3 => "Comically Large Spoon", 
				4 => "crouton", 
				5 => "Balan Statue", 
				6 => "Stick", 
				7 => "The talking orb", 
				8 => "Bomb", 
				9 => "CuteItempack", 
				_ => "DangerousItempack", 
			};
			if (1 == 0)
			{
			}
			string text2 = text;
			if (text2 == "CuteItempack" || text2 == "DangerousItempack")
			{
				string[] array = new string[4];
				if (text2 == "CuteItempack")
				{
					array = new string[4] { "Frieren", "Chocobo", "Puppy Shark", "Moogle" };
				}
				else if (text2 == "DangerousItempack")
				{
					array = new string[4] { "El Gazpacho", "Friendship ender", "Scroll of Town Portal", "Job application" };
				}
				for (int i = 0; i < array.Length; i++)
				{
					Networker.Instance.SameScrapServerRPC(GameNetworkManager.Instance.localPlayerController.playerClientId, 1, array[i], false);
				}
			}
			else
			{
				Networker.Instance.SameScrapServerRPC(GameNetworkManager.Instance.localPlayerController.playerClientId, Random.Range(2, 5), text2, false);
			}
		}
	}
	internal class Haunted : IEffect
	{
		public string Name => "Haunted hallucination";

		public EffectType Outcome => (EffectType)1;

		public bool ShowDefaultTooltip => true;

		public string Tooltip => "You are now cursed";

		public void Use()
		{
			((MonoBehaviour)Networker.Instance).StartCoroutine(Networker.Instance.StartHallucination(GameNetworkManager.Instance.localPlayerController.playerClientId, 2));
		}
	}
	internal class Death : IEffect
	{
		public string Name => "Death hallucination";

		public EffectType Outcome => (EffectType)0;

		public bool ShowDefaultTooltip => true;

		public string Tooltip => "The air feels different...";

		public void Use()
		{
			((MonoBehaviour)Networker.Instance).StartCoroutine(Networker.Instance.StartHallucination(GameNetworkManager.Instance.localPlayerController.playerClientId, 3));
		}
	}
	internal class Effects
	{
		public enum DeathAnimation
		{
			Normal,
			NoHead1,
			Spring,
			Haunted,
			Mask1,
			Mask2,
			Fire,
			CutInHalf,
			NoHead2
		}

		public static int NbOfPlayers()
		{
			return StartOfRound.Instance.connectedPlayersAmount + 1;
		}

		public static bool IsUnlucky(ulong playerId)
		{
			if (Plugin.config.unluckyPlayersID.Count == 0)
			{
				return false;
			}
			return Plugin.config.unluckyPlayersID.Find((ulong id) => id == playerId) != 0;
		}

		public static List<PlayerControllerB> GetPlayers(bool includeDead = false, bool excludeOutsideFactory = false)
		{
			List<PlayerControllerB> list = Object.FindObjectsOfType<PlayerControllerB>().ToList();
			List<PlayerControllerB> list2 = new List<PlayerControllerB>(list);
			foreach (PlayerControllerB item in list)
			{
				if (item.playerSteamId == 0 || !((NetworkBehaviour)item).IsSpawned || !item.isPlayerControlled || (!includeDead && item.isPlayerDead) || (excludeOutsideFactory && !item.isInsideFactory))
				{
					list2.Remove(item);
				}
			}
			return list2;
		}

		public static List<EnemyAI> GetEnemies(bool includeDead = false, bool includeCanDie = false, bool excludeDaytime = false)
		{
			List<EnemyAI> list = Object.FindObjectsOfType<EnemyAI>().ToList();
			List<EnemyAI> list2 = new List<EnemyAI>(list);
			if (includeDead)
			{
				return list2;
			}
			foreach (EnemyAI item in list)
			{
				if (!((NetworkBehaviour)item).IsSpawned || item.isEnemyDead || (!includeCanDie && !item.enemyType.canDie) || (excludeDaytime && item.enemyType.isDaytimeEnemy))
				{
					list2.Remove(item);
				}
			}
			return list2;
		}

		public static void Damage(PlayerControllerB player, int damageNb, CauseOfDeath cause = 0, int animation = 0, bool criticalBlood = true)
		{
			//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: Unknown result type (might be due to invalid IL or missing references)
			damageNb = ((player.health > 100 && damageNb == 100) ? 900 : damageNb);
			if (criticalBlood && player.health - damageNb <= 20)
			{
				player.bleedingHeavily = true;
			}
			player.DamagePlayer(damageNb, true, true, cause, animation, false, default(Vector3));
		}

		public static IEnumerator DamageHost(PlayerControllerB player, int damageNb, CauseOfDeath cause = 0, int animation = 0, bool criticalBlood = true)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			yield return (object)new WaitForEndOfFrame();
			Damage(player, damageNb, cause, animation, criticalBlood);
		}

		public static void Heal(ulong playerID, int health)
		{
			PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerID];
			val.health = ((val.health > 100) ? val.health : health);
			val.criticallyInjured = false;
			val.bleedingHeavily = false;
			val.playerBodyAnimator.SetBool("Limp", false);
		}

		public static void Teleportation(PlayerControllerB player, Vector3 position, bool ship = false, bool exterior = false, bool interior = false)
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			if (ship)
			{
				player.isInElevator = true;
				player.isInHangarShipRoom = true;
				player.isInsideFactory = false;
			}
			if (exterior)
			{
				player.isInElevator = false;
				player.isInHangarShipRoom = false;
				player.isInsideFactory = false;
			}
			if (interior)
			{
				player.isInElevator = false;
				player.isInHangarShipRoom = false;
				player.isInsideFactory = true;
			}
			player.averageVelocity = 0f;
			player.velocityLastFrame = Vector3.zero;
			player.TeleportPlayer(position, true, 0f, false, true);
			player.beamOutParticle.Play();
			HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
		}

		public static void Explosion(Vector3 position, float range, int damage = 50, float physicsForce = 1f)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			Landmine.SpawnExplosion(position, true, range, range * 2.5f, damage, physicsForce, (GameObject)null, false);
		}

		public static void ExplosionLight(Vector3 position, float range, int damage = 10, float physicsForce = 1f)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			Landmine.SpawnExplosion(position, true, 0f, range, damage, physicsForce, (GameObject)null, false);
		}

		public static IEnumerator ExplosionHostDeath(Vector3 position, float range, int damage = 50, float physicsForce = 1f)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			yield return (object)new WaitForEndOfFrame();
			Explosion(position, range, damage, physicsForce);
		}

		public static bool IsPlayerFacingObject<T>(PlayerControllerB player, out T obj, float distance)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(new Ray(((Component)player.gameplayCamera).transform.position, ((Component)player.gameplayCamera).transform.forward), ref val, distance, 2816))
			{
				obj = ((Component)((RaycastHit)(ref val)).transform).GetComponent<T>();
				if (obj != null)
				{
					return true;
				}
			}
			obj = default(T);
			return false;
		}

		public static bool IsPlayerNearObject<T>(PlayerControllerB player, out T obj, float distance) where T : Component
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			T[] array = Object.FindObjectsByType<T>((FindObjectsSortMode)0);
			for (int i = 0; i < array.Length; i++)
			{
				if (Vector3.Distance(((Component)player).transform.position, ((Component)array[i]).transform.position) <= distance)
				{
					obj = array[i];
					return true;
				}
			}
			obj = default(T);
			return false;
		}

		public static Vector3 GetClosestAINodePosition(GameObject[] nodes, Vector3 position)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			return nodes.OrderBy((GameObject x) => Vector3.Distance(position, x.transform.position)).ToArray()[0].transform.position;
		}

		public static void Knockback(Vector3 position, float range, int damage = 0, float physicsForce = 30f)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			Landmine.SpawnExplosion(position, false, 0f, range, damage, physicsForce, (GameObject)null, false);
		}

		public static void DropItem(Vector3 placingPosition = default(Vector3))
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			GameNetworkManager.Instance.localPlayerController.DiscardHeldObject(true, (NetworkObject)null, placingPosition, true);
		}

		public static void Audio(int audioID, float volume)
		{
			RoundManager.PlayRandomClip(HUDManager.Instance.UIAudio, (AudioClip[])(object)new AudioClip[1] { Plugin.audioClips[audioID] }, false, volume, 0, 1000);
		}

		public static void Audio(int audioID, Vector3 position, float volume, bool adjust = true)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = position;
			if (adjust)
			{
				val += Vector3.up * 2f;
			}
			AudioSource.PlayClipAtPoint(Plugin.audioClips[audioID], val, volume);
		}

		public static void Audio(int audioID, Vector3 clientPosition, float localVolume, float clientVolume, PlayerControllerB player)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)player != (Object)null && GameNetworkManager.Instance.localPlayerController.playerClientId == player.playerClientId)
			{
				Audio(audioID, localVolume);
			}
			else
			{
				Audio(audioID, clientPosition, clientVolume);
			}
		}

		public static void Audio(int audioID, Vector3 position, float volume, float pitch, bool adjust = true)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			AudioClip val = Plugin.audioClips[audioID];
			Vector3 val2 = position;
			if (adjust)
			{
				val2 += Vector3.up * 2f;
			}
			GameObject val3 = new GameObject("One shot audio");
			val3.transform.position = val2;
			AudioSource val4 = (AudioSource)val3.AddComponent(typeof(AudioSource));
			val4.clip = val;
			val4.spatialBlend = 1f;
			val4.volume = volume;
			val4.pitch = pitch;
			val4.Play();
			Object.Destroy((Object)(object)val3, val.length * ((Time.timeScale < 0.01f) ? 0.01f : Time.timeScale));
		}

		public static void Audio(int[] audioIDs, Vector3 position, float volume, bool adjust = true)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			//IL_005c: 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
			//IL_0035: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			AudioClip[] array = audioIDs.Select((int id) => Plugin.audioClips[id]).ToArray();
			Vector3 val = position;
			if (adjust)
			{
				val += Vector3.up * 2f;
			}
			GameObject val2 = new GameObject("One shot audio");
			val2.transform.position = val;
			AudioSource val3 = (AudioSource)val2.AddComponent(typeof(AudioSource));
			val3.spatialBlend = 1f;
			val3.volume = volume;
			RoundManager.PlayRandomClip(val3, array, true, volume, 0, 1000);
			Object.Destroy((Object)(object)val2, array[^1].length * ((Time.timeScale < 0.01f) ? 0.01f : Time.timeScale));
		}

		public static void Audio3D(int audioID, Vector3 otherPosition, float localVolume, float otherVolume, PlayerControllerB player, float otherDistance = 20f)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)player != (Object)null && GameNetworkManager.Instance.localPlayerController.playerClientId == player.playerClientId)
			{
				Audio(audioID, localVolume);
			}
			else
			{
				Audio3D(audioID, otherPosition, otherVolume, otherDistance);
			}
		}

		public static void Audio3D(int audioID, Vector3 position, float volume = 1f, float distance = 20f)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			GameObject val = new GameObject("One shot audio");
			val.transform.position = position;
			AudioSource val2 = (AudioSource)val.AddComponent(typeof(AudioSource));
			val2.spatialBlend = 1f;
			val2.rolloffMode = (AudioRolloffMode)1;
			val2.minDistance = 0f;
			val2.maxDistance = distance;
			val2.PlayOneShot(Plugin.audioClips[audioID], volume);
			Object.Destroy((Object)(object)val, Plugin.audioClips[audioID].length * ((Time.timeScale < 0.01f) ? 0.01f : Time.timeScale));
		}

		public static IEnumerator FadeOutAudio(AudioSource source, float time)
		{
			yield return (object)new WaitForEndOfFrame();
			float volume = source.volume;
			while (source.volume > 0f)
			{
				source.volume -= volume * Time.deltaTime / time;
				yield return null;
			}
			source.Stop();
			source.volume = volume;
		}

		public static void ChangeWeather(LevelWeatherType weather)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Invalid comparison between Unknown and I4
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Invalid comparison between Unknown and I4
			LevelWeatherType currentWeather = StartOfRound.Instance.currentLevel.currentWeather;
			StartOfRound.Instance.currentLevel.currentWeather = weather;
			RoundManager.Instance.SetToCurrentLevelWeather();
			TimeOfDay.Instance.SetWeatherBasedOnVariables();
			for (int i = 0; i < TimeOfDay.Instance.effects.Length; i++)
			{
				WeatherEffect val = TimeOfDay.Instance.effects[i];
				bool flag = (val.effectEnabled = (int)StartOfRound.Instance.currentLevel.currentWeather == i);
				if ((Object)(object)val.effectPermanentObject != (Object)null)
				{
					val.effectPermanentObject.SetActive(flag);
				}
				if ((Object)(object)val.effectObject != (Object)null)
				{
					val.effectObject.SetActive(flag);
				}
				if ((Object)(object)TimeOfDay.Instance.sunAnimator != (Object)null)
				{
					if (flag && !string.IsNullOrEmpty(val.sunAnimatorBool))
					{
						TimeOfDay.Instance.sunAnimator.SetBool(val.sunAnimatorBool, true);
						continue;
					}
					TimeOfDay.Instance.sunAnimator.Rebind();
					TimeOfDay.Instance.sunAnimator.Update(0f);
				}
			}
			if ((int)currentWeather == 4)
			{
				PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
				localPlayerController.isUnderwater = false;
				localPlayerController.sourcesCausingSinking = Mathf.Clamp(localPlayerController.sourcesCausingSinking - 1, 0, 100);
				localPlayerController.isMovementHindered = Mathf.Clamp(localPlayerController.isMovementHindered - 1, 0, 100);
				localPlayerController.hinderedMultiplier = 1f;
			}
		}

		public static void Message(string title, string bottom, bool warning = false)
		{
			HUDManager.Instance.DisplayTip(title, bottom, warning, false, "LC_Tip1");
		}

		public static IEnumerator Status(string text)
		{
			while (true)
			{
				HUDManager.Instance.DisplayStatusEffect(text);
				yield return (object)new WaitForSeconds(1f);
			}
		}

		public static NetworkReference Spawn(SpawnableEnemyWithRarity enemy, Vector3 position)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(enemy.enemyType.enemyPrefab, position, Quaternion.Euler(new Vector3(0f, 0f, 0f)));
			val.GetComponentInChildren<NetworkObject>().Spawn(true);
			RoundManager.Instance.SpawnedEnemies.Add(val.GetComponent<EnemyAI>());
			return new NetworkReference(NetworkObjectReference.op_Implicit(val.GetComponentInChildren<NetworkObject>()), 0);
		}

		public static void SpawnMaskedOfPlayer(ulong playerId, Vector3 position)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>();
			bool flag = ((Component)component).transform.position.y < -80f;
			NetworkObjectReference val = RoundManager.Instance.SpawnEnemyGameObject(position, ((Component)component).transform.eulerAngles.y, -1, PremiumScraps.Utils.GetEnemies.Masked.enemyType);
			NetworkObject val2 = default(NetworkObject);
			if (((NetworkObjectReference)(ref val)).TryGet(ref val2, (NetworkManager)null))
			{
				MaskedPlayerEnemy component2 = ((Component)val2).GetComponent<MaskedPlayerEnemy>();
				component2.SetSuit(component.currentSuitID);
				component2.mimickingPlayer = component;
				((EnemyAI)component2).SetEnemyOutside(!flag);
				component2.CreateMimicClientRpc(val, flag, (int)playerId);
			}
		}

		public static void Spawn(SpawnableMapObject trap, Vector3 position)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(trap.prefabToSpawn, position, Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform);
			val.GetComponent<NetworkObject>().Spawn(true);
		}

		public static SpawnableItemWithRarity GetScrap(string scrapName)
		{
			string scrapName2 = scrapName;
			return ((IEnumerable<SpawnableItemWithRarity>)RoundManager.Instance.currentLevel.spawnableScrap).FirstOrDefault((Func<SpawnableItemWithRarity, bool>)((SpawnableItemWithRarity i) => ((Object)i.spawnableItem).name.Equals(scrapName2)));
		}

		public static NetworkReference Spawn(SpawnableItemWithRarity scrap, Vector3 position)
		{
			//IL_0035: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			Transform val = (((Object)(object)RoundManager.Instance.spawnedScrapContainer == (Object)null) ? StartOfRound.Instance.elevatorTransform : RoundManager.Instance.spawnedScrapContainer);
			GameObject val2 = Object.Instantiate<GameObject>(scrap.spawnableItem.spawnPrefab, position + Vector3.up * 0.25f, Quaternion.identity, val);
			GrabbableObject component = val2.GetComponent<GrabbableObject>();
			((Component)component).transform.rotation = Quaternion.Euler(component.itemProperties.restingRotation);
			component.fallTime = 0f;
			component.scrapValue = (int)((float)Random.Range(scrap.spawnableItem.minValue, scrap.spawnableItem.maxValue) * RoundManager.Instance.scrapValueMultiplier);
			((NetworkBehaviour)component).NetworkObject.Spawn(false);
			component.FallToGround(true);
			return new NetworkReference(NetworkObjectReference.op_Implicit(val2.GetComponent<NetworkObject>()), component.scrapValue);
		}

		public static IEnumerator SyncScrap(NetworkReference reference)
		{
			yield return (object)new WaitForSeconds(3f);
			RoundManager.Instance.SyncScrapValuesClientRpc((NetworkObjectReference[])(object)new NetworkObjectReference[1] { reference.netObjectRef }, new int[1] { reference.value });
		}

		public static void SpawnQuicksand(int nb)
		{
			//IL_0049: 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_006a: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			Random random = new Random(StartOfRound.Instance.randomMapSeed + 2);
			GameObject[] array = (from x in GameObject.FindGameObjectsWithTag("OutsideAINode")
				orderby Vector3.Distance(x.transform.position, Vector3.zero)
				select x).ToArray();
			NavMeshHit val = default(NavMeshHit);
			for (int i = 0; i < nb; i++)
			{
				Vector3 position = array[random.Next(0, array.Length)].transform.position;
				Vector3 val2 = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(position, 30f, val, random, -1) + Vector3.up;
				GameObject val3 = Object.Instantiate<GameObject>(RoundManager.Instance.quicksandPrefab, val2, Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform);
			}
		}

		public static void SpawnLightningBolt(Vector3 strikePosition, bool damage = true)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: 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_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			Random random = new Random(StartOfRound.Instance.randomMapSeed);
			random.Next(-32, 32);
			random.Next(-32, 32);
			Vector3 position = strikePosition + Vector3.up * 160f + new Vector3((float)random.Next(-32, 32), 0f, (float)random.Next(-32, 32));
			StormyWeather val = Object.FindObjectOfType<StormyWeather>(true);
			LightningBoltPrefabScript val2 = Object.Instantiate<LightningBoltPrefabScript>(val.targetedThunder);
			((Behaviour)val2).enabled = true;
			((LightningBoltScript)val2).Camera = GameNetworkManager.Instance.localPlayerController.gameplayCamera;
			((LightningBoltPrefabScriptBase)val2).AutomaticModeSeconds = 0.2f;
			val2.Source.transform.position = position;
			val2.Destination.transform.position = strikePosition;
			((LightningBoltPrefabScriptBase)val2).CreateLightningBoltsNow();
			AudioSource val3 = Object.Instantiate<AudioSource>(val.targetedStrikeAudio);
			((Component)val3).transform.position = strikePosition + Vector3.up * 0.5f;
			((Behaviour)val3).enabled = true;
			if (damage)
			{
				Landmine.SpawnExplosion(strikePosition + Vector3.up * 0.25f, false, 2.4f, 5f, 50, 0f, (GameObject)null, false);
			}
			val.PlayThunderEffects(strikePosition, val3);
		}
	}
	[HarmonyPatch(typeof(Terminal))]
	internal class GetEnemies
	{
		public static SpawnableEnemyWithRarity Masked;

		public static SpawnableEnemyWithRarity HoardingBug;

		public static SpawnableEnemyWithRarity SnareFlea;

		public static SpawnableEnemyWithRarity Jester;

		public static SpawnableEnemyWithRarity Bracken;

		public static SpawnableEnemyWithRarity Thumper;

		public static SpawnableEnemyWithRarity CoilHead;

		public static SpawnableEnemyWithRarity CircuitBees;

		public static SpawnableEnemyWithRarity EarthLeviathan;

		public static SpawnableEnemyWithRarity BunkerSpider;

		public static SpawnableEnemyWithRarity ForestKeeper;

		public static SpawnableEnemyWithRarity GhostGirl;

		public static SpawnableEnemyWithRarity TulipSnake;

		public static SpawnableEnemyWithRarity EyelessDog;

		public static SpawnableEnemyWithRarity Maneater;

		public static SpawnableEnemyWithRarity Nutcracker;

		public static SpawnableEnemyWithRarity Barber;

		public static SpawnableEnemyWithRarity Butler;

		public static SpawnableEnemyWithRarity OldBird;

		public static SpawnableEnemyWithRarity ShyGuy;

		public static SpawnableEnemyWithRarity RedwoodTitan;

		public static SpawnableEnemyWithRarity RedwoodGiant;

		public static SpawnableEnemyWithRarity Locker;

		public static SpawnableEnemyWithRarity Bruce;

		public static SpawnableEnemyWithRarity SparkTower;

		public static SpawnableMapObject Landmine;

		public static SpawnableMapObject Turret;

		public static SpawnableMapObject SpikeTrap;

		public static SpawnableMapObject Seamine;

		public static SpawnableMapObject BigBertha;

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void GetEnemy(Terminal __instance)
		{
			SelectableLevel[] moonsCatalogueList = __instance.moonsCatalogueList;
			foreach (SelectableLevel val in moonsCatalogueList)
			{
				foreach (SpawnableEnemyWithRarity enemy in val.Enemies)
				{
					if (enemy.enemyType.enemyName == "Masked" && Masked == null)
					{
						Masked = enemy;
					}
					else if (enemy.enemyType.enemyName == "Hoarding bug" && HoardingBug == null)
					{
						HoardingBug = enemy;
					}
					else if (enemy.enemyType.enemyName == "Centipede" && SnareFlea == null)
					{
						SnareFlea = enemy;
					}
					else if (enemy.enemyType.enemyName == "Jester" && Jester == null)
					{
						Jester = enemy;
					}
					else if (enemy.enemyType.enemyName == "Flowerman" && Bracken == null)
					{
						Bracken = enemy;
					}
					else if (enemy.enemyType.enemyName == "Crawler" && Thumper == null)
					{
						Thumper = enemy;
					}
					else if (enemy.enemyType.enemyName == "Spring" && CoilHead == null)
					{
						CoilHead = enemy;
					}
					else if (enemy.enemyType.enemyName == "Bunker Spider" && BunkerSpider == null)
					{
						BunkerSpider = enemy;
					}
					else if (enemy.enemyType.enemyName == "Girl" && GhostGirl == null)
					{
						GhostGirl = enemy;
					}
					else if (enemy.enemyType.enemyName == "Maneater" && Maneater == null)
					{
						Maneater = enemy;
					}
					else if (enemy.enemyType.enemyName == "Nutcracker" && Nutcracker == null)
					{
						Nutcracker = enemy;
					}
					else if (enemy.enemyType.enemyName == "Clay Surgeon" && Barber == null)
					{
						Barber = enemy;
					}
					else if (enemy.enemyType.enemyName == "Butler" && Butler == null)
					{
						Butler = enemy;
					}
					else if (enemy.enemyType.enemyName == "Shy guy" && ShyGuy == null)
					{
						ShyGuy = enemy;
					}
					else if (enemy.enemyType.enemyName == "Locker" && Locker == null)
					{
						Locker = enemy;
					}
				}
				foreach (SpawnableEnemyWithRarity daytimeEnemy in val.DaytimeEnemies)
				{
					if (daytimeEnemy.enemyType.enemyName == "Red Locust Bees" && CircuitBees == null)
					{
						CircuitBees = daytimeEnemy;
					}
					else if (daytimeEnemy.enemyType.enemyName == "Tulip Snake" && TulipSnake == null)
					{
						TulipSnake = daytimeEnemy;
					}
				}
				foreach (SpawnableEnemyWithRarity outsideEnemy in val.OutsideEnemies)
				{
					if (outsideEnemy.enemyType.enemyName == "Earth Leviathan" && EarthLeviathan == null)
					{
						EarthLeviathan = outsideEnemy;
					}
					else if (outsideEnemy.enemyType.enemyName == "ForestGiant" && ForestKeeper == null)
					{
						ForestKeeper = outsideEnemy;
					}
					else if (outsideEnemy.enemyType.enemyName == "MouthDog" && EyelessDog == null)
					{
						EyelessDog = outsideEnemy;
					}
					else if (outsideEnemy.enemyType.enemyName == "RadMech" && OldBird == null)
					{
						OldBird = outsideEnemy;
					}
					else if (outsideEnemy.enemyType.enemyName == "Redwood Titan" && RedwoodTitan == null)
					{
						RedwoodTitan = outsideEnemy;
					}
					else if (outsideEnemy.enemyType.enemyName == "RedWoodGiant" && RedwoodGiant == null)
					{
						RedwoodGiant = outsideEnemy;
					}
					else if (outsideEnemy.enemyType.enemyName == "Bruce" && Bruce == null)
					{
						Bruce = outsideEnemy;
					}
					else if (outsideEnemy.enemyType.enemyName == "SparkTower" && SparkTower == null)
					{
						SparkTower = outsideEnemy;
					}
				}
				SpawnableMapObject[] spawnableMapObjects = val.spawnableMapObjects;
				foreach (SpawnableMapObject val2 in spawnableMapObjects)
				{
					if (((Object)val2.prefabToSpawn).name == "Landmine" && Landmine == null)
					{
						Landmine = val2;
					}
					else if (((Object)val2.prefabToSpawn).name == "TurretContainer" && Turret == null)
					{
						Turret = val2;
					}
					else if (((Object)val2.prefabToSpawn).name == "SpikeRoofTrapHazard" && SpikeTrap == null)
					{
						SpikeTrap = val2;
					}
					else if (((Object)val2.prefabToSpawn).name == "Seamine" && Seamine == null)
					{
						Seamine = val2;
					}
					else if (((Object)val2.prefabToSpawn).name == "Bertha" && BigBertha == null)
					{
						BigBertha = val2;
					}
				}
			}
		}
	}
	[HarmonyPatch(typeof(ItemCharger))]
	internal class BombItemChargerPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Update")]
		public static void UpdatePatch(ref ItemCharger __instance)
		{
			if ((float)Traverse.Create((object)__instance).Field("updateInterval").GetValue() == 0f && (Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
			{
				__instance.triggerScript.interactable = (Object)(object)GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer != (Object)null && (GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer.itemProperties.requiresBattery || (((Object)GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer.itemProperties).name == "BombItem" && GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer is Bomb bomb && !bomb.activated));
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("ChargeItem")]
		public static bool ChargeItemPatch()
		{
			return Bomb.ChargeItemUnstable();
		}
	}
	[HarmonyPatch(typeof(PowerOutletStun))]
	internal class LethalThingsBombItemChargerPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("ItemCharger_Update")]
		public static bool UpdatePatch(ItemCharger self)
		{
			bool flag = false;
			if ((float)Traverse.Create((object)self).Field("updateInterval").GetValue() == 0f && (Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
			{
				self.triggerScript.interactable = (Object)(object)GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer != (Object)null && (GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer.itemProperties.requiresBattery || (((Object)GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer.itemProperties).name == "BombItem" && GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer is Bomb bomb && !bomb.activated));
				flag = self.triggerScript.interactable;
			}
			return !flag;
		}

		[HarmonyPrefix]
		[HarmonyPatch("ItemCharger_ChargeItem")]
		public static bool ChargeItemPatch()
		{
			return Bomb.ChargeItemUnstable();
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class MattyFixesAirhornPositionPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Awake")]
		[HarmonyPriority(400)]
		public static void AwakePatch()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			ScrapItem val = Items.scrapItems.Find((ScrapItem i) => i.modName == "PremiumScraps" && i.item.itemName == "Airhorn");
			if (val != null && val != null)
			{
				val.item.restingRotation = new Vector3(0f, -180f, 270f);
				val.item.floorYOffset = -180;
			}
		}
	}
}
namespace PremiumScraps.CustomEffects
{
	internal class Bomb : ThrowableItem
	{
		public bool isBeeingActivated = false;

		public bool activated = false;

		private Coroutine? activateCoroutine;

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			if (!isBeeingActivated)
			{
				if (!activated && activateCoroutine == null)
				{
					activateCoroutine = ((MonoBehaviour)this).StartCoroutine(ActivatingBomb());
				}
				else if (((NetworkBehaviour)this).IsOwner)
				{
					base.ItemActivate(used, buttonDown);
				}
			}
		}

		public override void DiscardItem()
		{
			if (!isBeeingActivated)
			{
				bool flag = Effects.IsUnlucky(((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null) ? ((GrabbableObject)this).playerHeldBy.playerSteamId : 0);
				((GrabbableObject)this).DiscardItem();
				if (!activated && (Random.Range(0, 100) >= 95 || (flag && Random.Range(0, 100) >= 20)))
				{
					BombExplosionUnstableServerRpc();
				}
			}
		}

		public override void ActivatePhysicsTrigger(Collider other)
		{
			((GrabbableObject)this).ActivatePhysicsTrigger(other);
			bool flag = false;
			if (((Component)other).tag == "Player")
			{
				PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
				flag = Effects.IsUnlucky(((Object)(object)component != (Object)null) ? component.playerSteamId : 0);
			}
			if (!activated && (Random.Range(0, 100) >= 97 || (flag && Random.Range(0, 100) >= 30)))
			{
				BombExplosionUnstableServerRpc();
			}
		}

		public static bool ChargeItemUnstable()
		{
			GrabbableObject currentlyHeldObjectServer = GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer;
			if ((Object)(object)currentlyHeldObjectServer == (Object)null)
			{
				return false;
			}
			if (((Object)currentlyHeldObjectServer.itemProperties).name == "BombItem" && currentlyHeldObjectServer is Bomb bomb && !bomb.activated)
			{
				bomb.BombExplosionUnstableServerRpc();
				return false;
			}
			return true;
		}

		public override void EquipItem()
		{
			SetControlTips();
			((GrabbableObject)this).EnableItemMeshes(true);
			((GrabbableObject)this).isPocketed = false;
			if (!((GrabbableObject)this).hasBeenHeld)
			{
				((GrabbableObject)this).hasBeenHeld = true;
				if (!((GrabbableObject)this).isInShipRoom && !StartOfRound.Instance.inShipPhase && StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap)
				{
					RoundManager instance = RoundManager.Instance;
					instance.valueOfFoundScrapItems += ((GrabbableObject)this).scrapValue;
				}
			}
		}

		public override void SetControlTipsForItem()
		{
			SetControlTips();
		}

		private void SetControlTips()
		{
			string[] array = (activated ? new string[1] { "Throw bomb : [RMB]" } : new string[1] { "Activate bomb : [RMB]" });
			if (((NetworkBehaviour)this).IsOwner)
			{
				HUDManager.Instance.ChangeControlTipMultiple(array, true, ((GrabbableObject)this).itemProperties);
			}
		}

		private IEnumerator ActivatingBomb()
		{
			isBeeingActivated = true;
			((GrabbableObject)this).playerHeldBy.activatingItem = true;
			((GrabbableObject)this).playerHeldBy.doingUpperBodyEmote = 1.16f;
			((GrabbableObject)this).playerHeldBy.playerBodyAnimator.SetTrigger("PullGrenadePin");
			yield return (object)new WaitForSeconds(1f);
			if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
			{
				((GrabbableObject)this).playerHeldBy.activatingItem = false;
			}
			isBeeingActivated = false;
			activated = true;
			((GrabbableObject)this).itemUsedUp = true;
			if (((NetworkBehaviour)this).IsOwner && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
			{
				SetControlTips();
			}
			((MonoBehaviour)this).StartCoroutine(BombExplosion());
		}

		private IEnumerator BombExplosion()
		{
			((Component)((Component)this).transform.GetChild(1)).GetComponent<ParticleSystem>().Play();
			((Component)this).GetComponent<AudioSource>().Play();
			yield return (object)new WaitForSeconds(4.2f);
			((Component)((Component)this).transform.GetChild(1)).GetComponent<ParticleSystem>().Stop();
			if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null && !((GrabbableObject)this).playerHeldBy.isPlayerDead && ((GrabbableObject)this).isPocketed)
			{
				((GrabbableObject)this).playerHeldBy.DropAllHeldItems(true, false);
			}
			Vector3 position = ((Component)this).transform.position;
			((GrabbableObject)this).DestroyObjectInHand(((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null && ((GrabbableObject)this).isHeld) ? ((GrabbableObject)this).playerHeldBy : null);
			Effects.Explosion(position, 2f, 90, 5f);
			yield return (object)new WaitForSeconds(0.15f);
			Effects.Explosion(position, 4f, 100, 20f);
		}

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

		[ClientRpc]
		private void BombExplosionUnstableClientRpc()
		{
			//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(68300830u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 68300830u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					activated = true;
					((GrabbableObject)this).itemUsedUp = true;
					((GrabbableObject)this).grabbable = false;
					((MonoBehaviour)this).StartCoroutine(BombExplosionUnstable((GrabbableObject)(object)this));
				}
			}
		}

		private IEnumerator BombExplosionUnstable(GrabbableObject bomb)
		{
			AudioSource audio = ((Component)bomb).GetComponent<AudioSource>();
			audio.clip = Plugin.audioClips[6];
			audio.volume = 2f;
			audio.Play();
			yield return (object)new WaitForSeconds(0.8f);
			if ((Object)(object)bomb.playerHeldBy != (Object)null && !bomb.playerHeldBy.isPlayerDead && bomb.isPocketed)
			{
				bomb.playerHeldBy.DropAllHeldItems(true, false);
			}
			Vector3 position = ((Component)bomb).transform.position;
			bomb.DestroyObjectInHand(((Object)(object)bomb.playerHeldBy != (Object)null && bomb.isHeld) ? bomb.playerHeldBy : null);
			Effects.Explosion(position, 2f, 90, 5f);
			yield return (object)new WaitForSeconds(0.15f);
			Effects.Explosion(position, 4f, 100, 20f);
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_Bomb()
		{
			//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(1528738603u, new RpcReceiveHandler(__rpc_handler_1528738603));
			NetworkManager.__rpc_func_table.Add(68300830u, new RpcReceiveHandler(__rpc_handler_68300830));
		}

		private static void __rpc_handler_1528738603(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;
				((Bomb)(object)target).BombExplosionUnstableServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_68300830(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;
				((Bomb)(object)target).BombExplosionUnstableClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "Bomb";
		}
	}
	internal class FakeAirhorn : NoisemakerProp
	{
		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//IL_00cd: 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)
			if (!buttonDown || !((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null))
			{
				return;
			}
			if (StartOfRound.Instance.inShipPhase || Random.Range(1, 11) >= 4)
			{
				BaseItemActivateServerRpc(used, buttonDown);
			}
			else if (Random.Range(1, 11) >= 6)
			{
				AudioServerRpc(6, ((Component)((GrabbableObject)this).playerHeldBy).transform.position, 1.5f, 4f);
				if (((NetworkBehaviour)((GrabbableObject)this).playerHeldBy).IsHost)
				{
					((MonoBehaviour)this).StartCoroutine(Effects.DamageHost(((GrabbableObject)this).playerHeldBy, 100, (CauseOfDeath)13, 6));
				}
				else
				{
					Effects.Damage(((GrabbableObject)this).playerHeldBy, 100, (CauseOfDeath)13, 6);
				}
			}
			else
			{
				ExplosionServerRpc(((Component)((GrabbableObject)this).playerHeldBy).transform.position);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void BaseItemActivateServerRpc(bool used, bool buttonDown)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			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(3982777022u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref used, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref buttonDown, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3982777022u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					BaseItemActivateClientRpc(used, buttonDown);
				}
			}
		}

		[ClientRpc]
		private void BaseItemActivateClientRpc(bool used, bool buttonDown)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			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(3670730104u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref used, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref buttonDown, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3670730104u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NoisemakerProp)this).ItemActivate(used, buttonDown);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void AudioServerRpc(int audioID, Vector3 clientPosition, float localVolume, float clientVolume = 0f)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: 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(1384281288u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, audioID);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref clientPosition);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref localVolume, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref clientVolume, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1384281288u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					AudioClientRpc(audioID, clientPosition, localVolume, (clientVolume == 0f) ? localVolume : clientVolume);
				}
			}
		}

		[ClientRpc]
		private void AudioClientRpc(int audioID, Vector3 clientPosition, float localVolume, float clientVolume)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: 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(950156766u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, audioID);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref clientPosition);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref localVolume, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref clientVolume, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 950156766u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					Effects.Audio(audioID, clientPosition, localVolume, clientVolume, ((GrabbableObject)this).playerHeldBy);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void ExplosionServerRpc(Vector3 position)
		{
			//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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((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(2548337919u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2548337919u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ExplosionClientRpc(position);
				}
			}
		}

		[ClientRpc]
		private void ExplosionClientRpc(Vector3 position)
		{
			//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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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(3979654908u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3979654908u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).IsHost)
				{
					((MonoBehaviour)this).StartCoroutine(Effects.ExplosionHostDeath(position, 4f, 50, 2f));
				}
				else
				{
					Effects.Explosion(position, 4f, 50, 2f);
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_FakeAirhorn()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3982777022u, new RpcReceiveHandler(__rpc_handler_3982777022));
			NetworkManager.__rpc_func_table.Add(3670730104u, new RpcReceiveHandler(__rpc_handler_3670730104));
			NetworkManager.__rpc_func_table.Add(1384281288u, new RpcReceiveHandler(__rpc_handler_1384281288));
			NetworkManager.__rpc_func_table.Add(950156766u, new RpcReceiveHandler(__rpc_handler_950156766));
			NetworkManager.__rpc_func_table.Add(2548337919u, new RpcReceiveHandler(__rpc_handler_2548337919));
			NetworkManager.__rpc_func_table.Add(3979654908u, new RpcReceiveHandler(__rpc_handler_3979654908));
		}

		private static void __rpc_handler_3982777022(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool used = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref used, default(ForPrimitives));
				bool buttonDown = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref buttonDown, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((FakeAirhorn)(object)target).BaseItemActivateServerRpc(used, buttonDown);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3670730104(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool used = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref used, default(ForPrimitives));
				bool buttonDown = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref buttonDown, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((FakeAirhorn)(object)target).BaseItemActivateClientRpc(used, buttonDown);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1384281288(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int audioID = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref audioID);
				Vector3 clientPosition = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref clientPosition);
				float localVolume = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref localVolume, default(ForPrimitives));
				float clientVolume = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref clientVolume, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((FakeAirhorn)(object)target).AudioServerRpc(audioID, clientPosition, localVolume, clientVolume);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_950156766(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int audioID = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref audioID);
				Vector3 clientPosition = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref clientPosition);
				float localVolume = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref localVolume, default(ForPrimitives));
				float clientVolume = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref clientVolume, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((FakeAirhorn)(object)target).AudioClientRpc(audioID, clientPosition, localVolume, clientVolume);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2548337919(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0036: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((FakeAirhorn)(object)target).ExplosionServerRpc(position);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3979654908(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0036: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((FakeAirhorn)(object)target).ExplosionClientRpc(position);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "FakeAirhorn";
		}
	}
	internal class HarryDoll : PhysicsProp
	{
		public override void DiscardItem()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			if (!StartOfRound.Instance.inShipPhase && StartOfRound.Instance.shipHasLanded && Random.Range(0, 100) >= 92)
			{
				SpawnEnemyServerRpc(((Component)((GrabbableObject)this).playerHeldBy).transform.position);
			}
			((GrabbableObject)this).DiscardItem();
		}

		[ServerRpc(RequireOwnership = false)]
		private void SpawnEnemyServerRpc(Vector3 position)
		{
			//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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			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(3662913227u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3662913227u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					Effects.Spawn(GetEnemies.GhostGirl, position);
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_HarryDoll()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3662913227u, new RpcReceiveHandler(__rpc_handler_3662913227));
		}

		private static void __rpc_handler_3662913227(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0036: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((HarryDoll)(object)target).SpawnEnemyServerRpc(position);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "HarryDoll";
		}
	}
	internal class JobDark : PhysicsProp
	{
		public int hallucinationID = 0;

		public int summonFriends = 0;

		public bool canInspectPaper = true;

		public bool itsTooLate = false;

		public float timeUntilItsTooLate = 8f;

		private Coroutine? darkEffectCoroutine;

		private bool OneTimeUse = false;

		private bool OneTimeActionSp = false;

		private readonly int debug = -1;

		public JobDark()
		{
			SelectHallucination();
		}

		public override void EquipItem()
		{
			SetControlTips();
			((GrabbableObject)this).EnableItemMeshes(true);
			((GrabbableObject)this).isPocketed = false;
			if (!((GrabbableObject)this).hasBeenHeld)
			{
				((GrabbableObject)this).hasBeenHeld = true;
				if (!((GrabbableObject)this).isInShipRoom && !StartOfRound.Instance.inShipPhase && StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap)
				{
					RoundManager instance = RoundManager.Instance;
					instance.valueOfFoundScrapItems += ((GrabbableObject)this).scrapValue;
				}
			}
		}

		public override void SetControlTipsForItem()
		{
			SetControlTips();
		}

		private void SetControlTips()
		{
			string[] array = ((summonFriends == -1) ? new string[1] { "" } : ((summonFriends < 1) ? new string[1] { "Read: [Z]" } : new string[1] { "Summon friends : [RMB]" }));
			if (((NetworkBehaviour)this).IsOwner)
			{
				HUDManager.Instance.ChangeControlTipMultiple(array, true, ((GrabbableObject)this).itemProperties);
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (buttonDown && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null && summonFriends >= 1 && !StartOfRound.Instance.inShipPhase && StartOfRound.Instance.shipHasLanded)
			{
				((MonoBehaviour)this).StartCoroutine(SummonFriends(((GrabbableObject)this).playerHeldBy));
			}
		}

		private IEnumerator SummonFriends(PlayerControllerB player)
		{
			DarkJobEffectServerRpc(2, Vector3.up);
			summonFriends = -1;
			SetControlTips();
			yield return (object)new WaitForEndOfFrame();
			Vector3 position;
			if (StartOfRound.Instance.currentLevel.PlanetName != "71 Gordion")
			{
				position = RoundManager.Instance.insideAINodes[Random.Range(0, RoundManager.Instance.insideAINodes.Length - 1)].transform.position;
			}
			else
			{
				position = ((Component)player).transform.position;
				for (int i = 0; i < 6; i++)
				{
					if (StartOfRound.Instance.inShipPhase)
					{
						break;
					}
					yield return (object)new WaitForSeconds(5f);
				}
			}
			if (!StartOfRound.Instance.inShipPhase)
			{
				DarkJobEffectServerRpc(0, position);
			}
		}

		private void SelectHallucination()
		{
			if (debug == -1)
			{
				hallucinationID = Random.Range(0, 4);
			}
			else
			{
				hallucinationID = debug;
			}
		}

		public static IEnumerator HazardHallucination(PlayerControllerB player, JobDark jobDark)
		{
			if ((Object)(object)jobDark != (Object)null && !jobDark.OneTimeActionSp)
			{
				yield return (object)new WaitForSeconds(1f);
				Effects.SpawnQuicksand(30);
				jobDark.OneTimeActionSp = true;
			}
			else
			{
				yield return (object)new WaitForSeconds(0.5f);
				Vector3 position = ((!player.isInsideFactory) ? RoundManager.Instance.outsideAINodes[Random.Range(0, RoundManager.Instance.outsideAINodes.Length - 1)].transform.position : RoundManager.Instance.insideAINodes[Random.Range(0, RoundManager.Instance.insideAINodes.Length - 1)].transform.position);
				Effects.ExplosionLight(position, 4f, 20);
			}
		}

		public static IEnumerator GirlsHallucination(PlayerControllerB player, JobDark jobDark)
		{
			PlayerControllerB player2 = player;
			if (!((Object)(object)jobDark != (Object)null))
			{
				yield break;
			}
			jobDark.OneTimeUse = true;
			if (!player2.isInsideFactory)
			{
				yield return (object)new WaitUntil((Func<bool>)(() => player2.isInsideFactory || StartOfRound.Instance.shipIsLeaving));
			}
			if (!StartOfRound.Instance.shipIsLeaving && !player2.isPlayerDead)
			{
				yield return (object)new WaitForSeconds(5f);
				if (!StartOfRound.Instance.shipIsLeaving && !StartOfRound.Instance.inShipPhase && !player2.isPlayerDead)
				{
					jobDark.DarkJobEffectServerRpc(1, ((Component)player2).transform.position);
				}
			}
		}

		public static IEnumerator HauntedHallucination(PlayerControllerB player)
		{
			PlayerControllerB player2 = player;
			yield return (object)new WaitForSeconds(0.2f);
			if (player2.isPlayerDead)
			{
				yield return (object)new WaitForSeconds(1f);
				yield break;
			}
			if (player2.isInHangarShipRoom || player2.isInsideFactory)
			{
				yield return (object)new WaitUntil((Func<bool>)(() => !player2.isInHangarShipRoom || !player2.isInsideFactory || StartOfRound.Instance.shipIsLeaving));
				for (int i = 0; i < 3; i++)
				{
					if (StartOfRound.Instance.shipIsLeaving)
					{
						break;
					}
					if (StartOfRound.Instance.inShipPhase)
					{
						break;
					}
					yield return (object)new WaitForSeconds(5f);
				}
				yield break;
			}
			switch (Random.Range(0, 8))
			{
			case 0:
				HUDManager.Instance.RadiationWarningHUD();
				yield return (object)new WaitForSeconds(3f);
				player2.beamUpParticle.Play();
				yield return (object)new WaitForSeconds(5f);
				break;
			case 1:
				Effects.Audio(new int[4] { 8, 9, 10, 11 }, ((Component)player2).transform.position, 8f);
				player2.JumpToFearLevel(0.1f, true);
				yield return (object)new WaitForSeconds(2f);
				Effects.Audio(new int[4] { 8, 9, 10, 11 }, ((Component)player2).transform.position, 9f);
				player2.JumpToFearLevel(2f, true);
				player2.playersManager.fearLevelIncreasing = false;
				yield return (object)new WaitForSeconds(15f);
				break;
			case 2:
				Effects.Explosion(((Component)player2).transform.position, 0f, 0);
				yield return (object)new WaitForSeconds(5f);
				break;
			case 3:
				Effects.Knockback(((Component)player2).transform.position + Vector3.forward, 1f);
				yield return (object)new WaitForSeconds(10f);
				Effects.Knockback(((Component)player2).transform.position + Vector3.right, 1f, 0, 40f);
				yield return (object)new WaitForSeconds(10f);
				break;
			case 4:
				Effects.Audio(13, 2f);
				player2.drunkness = 1f;
				player2.drunknessInertia = 1f;
				player2.drunknessSpeed = 1f;
				player2.JumpToFearLevel(1f, true);
				player2.playersManager.fearLevelIncreasing = false;
				yield return (object)new WaitForSeconds(15f);
				break;
			case 5:
			{
				float original = player2.movementSpeed;
				player2.movementSpeed = 0.2f;
				yield return (object)new WaitForSeconds(20f);
				player2.movementSpeed = original;
				yield return (object)new WaitForSeconds(5f);
				break;
			}
			case 6:
				Effects.Audio(11, 2f);
				Effects.Teleportation(player2, RoundManager.Instance.outsideAINodes[Random.Range(0, RoundManager.Instance.outsideAINodes.Length - 1)].transform.position, ship: true);
				yield return (object)new WaitForSeconds(5f);
				break;
			case 7:
				Effects.Audio(9, 2f);
				Effects.Teleportation(player2, RoundManager.Instance.outsideAINodes[Random.Range(0, RoundManager.Instance.outsideAINodes.Length - 1)].transform.position, ship: true);
				yield return (object)new WaitForSeconds(5f);
				break;
			default:
				yield return (object)new WaitForSeconds(5f);
				break;
			}
		}

		public static IEnumerator DeathHallucination(PlayerControllerB player, JobDark? jobDark, MonoBehaviour? monoBehaviour = null)
		{
			PlayerControllerB player2 = player;
			if ((Object)(object)jobDark != (Object)null)
			{
				jobDark.OneTimeUse = true;
			}
			else if ((Object)(object)monoBehaviour == (Object)null)
			{
				yield break;
			}
			if (!player2.isInsideFactory)
			{
				yield return (object)new WaitUntil((Func<bool>)(() => player2.isInsideFactory || StartOfRound.Instance.shipIsLeaving));
			}
			if (StartOfRound.Instance.shipIsLeaving || player2.isPlayerDead)
			{
				yield break;
			}
			yield return (object)new WaitForSeconds(15f);
			if (StartOfRound.Instance.shipIsLeaving || StartOfRound.Instance.inShipPhase || player2.isPlayerDead)
			{
				yield break;
			}
			player2.JumpToFearLevel(1f, true);
			player2.playersManager.fearLevelIncreasing = false;
			yield return (object)new WaitForSeconds(25f);
			if (StartOfRound.Instance.shipIsLeaving || StartOfRound.Instance.inShipPhase || player2.isPlayerDead)
			{
				yield break;
			}
			Effects.Audio(new int[4] { 8, 9, 10, 11 }, ((Component)player2).transform.position, 6f);
			player2.JumpToFearLevel(1.5f, true);
			player2.playersManager.fearLevelIncreasing = false;
			yield return (object)new WaitForSeconds(25f);
			if (StartOfRound.Instance.shipIsLeaving || StartOfRound.Instance.inShipPhase || player2.isPlayerDead)
			{
				yield break;
			}
			MonoBehaviour instance = (MonoBehaviour)(object)(((Object)(object)jobDark != (Object)null) ? jobDark : ((JobDark?)(object)monoBehaviour));
			Coroutine statusCoroutine = instance.StartCoroutine(Effects.Status("WARNING ! UNSTABLE HEART RATE DETECTED. RETURN TO YOUR ASSIGNED SHIP IMMEDIATELY !"));
			player2.JumpToFearLevel(4f, true);
			player2.playersManager.fearLevelIncreasing = true;
			int i;
			for (i = 0; i < 5; i++)
			{
				if (i == 4)
				{
					for (int j = 0; j < 5; j++)
					{
						Effects.Audio(12, 10f);
						yield return (object)new WaitForSeconds(3f);
						if (StartOfRound.Instance.inShipPhase || player2.isPlayerDead)
						{
							i = 0;
							break;
						}
						if (player2.isInHangarShipRoom)
						{
							break;
						}
					}
				}
				else
				{
					Effects.Audio(12, 10f);
					yield return (object)new WaitForSeconds(10f);
				}
				if (StartOfRound.Instance.inShipPhase || player2.isPlayerDead)
				{
					i = 0;
					break;
				}
				if (player2.isInHangarShipRoom)
				{
					break;
				}
			}
			instance.StopCoroutine(statusCoroutine);
			player2.playersManager.fearLevelIncreasing = false;
			yield return null;
			if (i == 5 && !player2.isInHangarShipRoom)
			{
				player2.playersManager.fearLevel = 0f;
				if (((NetworkBehaviour)player2).IsHost)
				{
					instance.StartCoroutine(Effects.DamageHost(player2, 100, (CauseOfDeath)16, 3));
				}
				else
				{
					Effects.Damage(player2, 100, (CauseOfDeath)16, 3);
				}
			}
		}

		private IEnumerator DarkEffect()
		{
			yield return (object)new WaitForSeconds(timeUntilItsTooLate);
			((GrabbableObject)this).playerHeldBy.JumpToFearLevel(1.5f, true);
			yield return (object)new WaitForSeconds(timeUntilItsTooLate);
			itsTooLate = true;
			((GrabbableObject)this).playerHeldBy.playersManager.fearLevelIncreasing = false;
			Effects.Message("The air feels different...", "Something terrible has been done to you", warning: true);
			PlayerControllerB player = ((GrabbableObject)this).playerHeldBy;
			Effects.DropItem(((Component)player).transform.position);
			((GrabbableObject)this).grabbable = false;
			if (StartOfRound.Instance.inShipPhase)
			{
				summonFriends = -1;
			}
			yield return (object)new WaitForSeconds(0.2f);
			while (true)
			{
				yield return (object)new WaitForSeconds(1f);
				if (StartOfRound.Instance.shipIsLeaving || player.isPlayerDead)
				{
					yield return (object)new WaitUntil((Func<bool>)(() => StartOfRound.Instance.inShipPhase));
				}
				if (StartOfRound.Instance.inShipPhase)
				{
					OneTimeUse = false;
					OneTimeActionSp = false;
					summonFriends++;
					SelectHallucination();
					if (summonFriends >= 1)
					{
						((GrabbableObject)this).grabbable = true;
						canInspectPaper = false;
						if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null && !((GrabbableObject)this).isPocketed)
						{
							SetControlTips();
						}
						Effects.Message("You can finally meet your c\u0337\u033f\u0302o-\u0336\u0314\u0346w\u0334\u033f\u035cor\u0335\u033e\u0347k\u0334\u0302\u0339er\u0338\u034b\u033as !", "                                You shoul