Decompiled source of PremiumScraps v2.3.3

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 IL.GameNetcodeStuff;
using LethalLib.Modules;
using LethalThings.Patches;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MysteryDice;
using MysteryDice.Effects;
using Newtonsoft.Json.Linq;
using OpenBodyCams;
using OpenBodyCams.API;
using PremiumScraps.CustomEffects;
using PremiumScraps.NetcodePatcher;
using PremiumScraps.Utils;
using SelfSortingStorage.Cupboard;
using ShipInventory.Helpers;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.UI;
using WeatherRegistry;
using WeatherRegistry.Patches;

[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: IgnoresAccessChecksTo("WeatherRegistry")]
[assembly: AssemblyCompany("PremiumScraps")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+0fb003562c14db28506406ceb3bf79f2a5dbbfe9")]
[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 bool StarlancerAIFix = false;

		public bool WeatherRegistery = false;

		public bool OpenBodyCams = false;

		public readonly List<ulong> unluckyPlayersID = new List<ulong>();

		public readonly List<(int, int)> scrapValues = new List<(int, int)>();

		public readonly ConfigEntry<bool> diceEvents;

		public readonly ConfigEntry<string> languageMode;

		public readonly ConfigEntry<string> unluckyPlayersStr;

		public readonly ConfigEntry<bool> gazpachoMemeSfx;

		public readonly ConfigEntry<bool> squareSteelWeapon;

		public readonly ConfigEntry<bool> controllerBodyCams;

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

		public readonly List<ConfigEntry<string>> values = new List<ConfigEntry<string>>();

		public Config(ConfigFile cfg, List<Scrap> scraps)
		{
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			cfg.SaveOnConfigSet = false;
			diceEvents = cfg.Bind<bool>("General", "Dice events", true, "Adds some custom dice rolls to Emergency Dice items.\nRequires 'Emergency Dice Updated' 1.7.4+ to work, or else it will be automatically false.");
			languageMode = cfg.Bind<string>("General", "Language mode", "default", new ConfigDescription("Change the language of this mod (translate text, tool tips and change some sounds). The 'default' value is automatically assigned to your system language.", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[3] { "default", "english", "french" }), Array.Empty<object>()));
			unluckyPlayersStr = cfg.Bind<string>("General", "Unlucky players", "76561198984467725,76561199094139351,76561198198881967", "Comma separated list of players Steam ID that you want them to be unlucky.\nBad things will happen to unlucky players, use this config to take a sweet revenge on your friends...");
			gazpachoMemeSfx = cfg.Bind<bool>("Items", "Gazpacho meme sfx", true, "Turns El Gazpacho's grab and drop sfx to memes sounds.\nWill be automatically false if the chosen language is not french.");
			squareSteelWeapon = cfg.Bind<bool>("Items", "Square Steel weapon", true, "Turns Galvanized Square Steel into a usable weapon.");
			controllerBodyCams = cfg.Bind<bool>("Items", "Controller Body Cams", true, "Upgrade the Controller screen with a camera from OpenBodyCams mod.\nWill be automatically false if OpenBodyCams is not installed.");
			foreach (Scrap scrap in scraps)
			{
				entries.Add(cfg.Bind<int>("Spawn chance", scrap.asset.Split("/")[0], scrap.rarity, "Rarity of the item."));
				values.Add(cfg.Bind<string>("Values", scrap.asset.Split("/")[0], "", "Min,max value of the item, follow the format 200,300 or empty for default.\nIn-game value will be randomized between these numbers and divided by 2.5."));
			}
			cfg.Save();
			cfg.SaveOnConfigSet = true;
		}

		public void SetupCustomConfigs()
		{
			if (Chainloader.PluginInfos.ContainsKey("AudioKnight.StarlancerAIFix"))
			{
				StarlancerAIFix = true;
			}
			if (Chainloader.PluginInfos.ContainsKey("mrov.WeatherRegistry"))
			{
				WeatherRegistery = true;
			}
			if (Chainloader.PluginInfos.ContainsKey("Zaggy1024.OpenBodyCams"))
			{
				OpenBodyCams = true;
			}
			foreach (string item in from s in unluckyPlayersStr.Value.Split(',')
				select s.Trim())
			{
				if (ulong.TryParse(item, out var result))
				{
					unluckyPlayersID.Add(result);
				}
			}
			foreach (ConfigEntry<string> value in values)
			{
				if (value.Value == "")
				{
					scrapValues.Add((-1, -1));
					continue;
				}
				string[] array = (from s in value.Value.Split(',')
					select s.Trim()).ToArray();
				int result2;
				int result3;
				if (array.Count() != 2)
				{
					scrapValues.Add((-1, -1));
				}
				else if (!int.TryParse(array[0], out result2) || !int.TryParse(array[1], out result3))
				{
					scrapValues.Add((-1, -1));
				}
				else if (result2 > result3)
				{
					scrapValues.Add((-1, -1));
				}
				else
				{
					scrapValues.Add((result2, result3));
				}
			}
		}
	}
	[BepInPlugin("zigzag.premiumscraps", "PremiumScraps", "2.3.3")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private const string GUID = "zigzag.premiumscraps";

		private const string NAME = "PremiumScraps";

		private const string VERSION = "2.3.3";

		public static Plugin instance;

		public static List<AudioClip> audioClips = new List<AudioClip>();

		public static List<GameObject> gameObjects = new List<GameObject>();

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

		internal static Config config { get; private set; } = null;


		private void HarmonyPatchAll()
		{
			PremiumScrapsMonoModPatches.Load();
			harmony.CreateClassProcessor(typeof(GetEnemies), true).Patch();
			harmony.CreateClassProcessor(typeof(SteelBarPatch), true).Patch();
			harmony.CreateClassProcessor(typeof(ControllerTerminalPatch), true).Patch();
			harmony.CreateClassProcessor(typeof(ControllerHUDManagerPatch), true).Patch();
			harmony.CreateClassProcessor(typeof(ControllerPlayerControllerBPatch), true).Patch();
			harmony.CreateClassProcessor(typeof(ControllerVehicleControllerPatch), true).Patch();
			if (Lang.ACTUAL_LANG == "fr")
			{
				harmony.CreateClassProcessor(typeof(FrenchModeItemTooltipsPatch), 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 (Chainloader.PluginInfos.ContainsKey("ShipInventoryUpdated"))
			{
				ShipInventoryConditions.Setup(Chainloader.PluginInfos.GetValueOrDefault("ShipInventoryUpdated").Metadata);
			}
			if (Chainloader.PluginInfos.ContainsKey("zigzag.SelfSortingStorage"))
			{
				SSSConditions.Setup(Chainloader.PluginInfos.GetValueOrDefault("zigzag.SelfSortingStorage").Metadata);
			}
			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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Expected O, but got Unknown
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Expected O, but got Unknown
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: 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;
			case 12:
				val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<Controller>();
				break;
			case 13:
				val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<SteelBar>();
				SetupScript.Copy((Shovel)val, item);
				break;
			case 14:
				val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<CDI_King>();
				SetupScript.Copy((NoisemakerProp)val, item);
				break;
			case 15:
				val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<GreatRonka>();
				break;
			case 16:
				val = (GrabbableObject)(object)item.spawnPrefab.AddComponent<EvilCard>();
				break;
			}
			val.grabbable = true;
			val.isInFactory = true;
			val.grabbableToEnemies = true;
			val.itemProperties = item;
		}

		private void Awake()
		{
			//IL_04ca: Unknown result type (might be due to invalid IL or missing references)
			instance = this;
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "premiumscraps");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			string text2 = "Assets/Data/";
			string[] array = new string[2] { "Controller/ControlledAntena.prefab", "Controller/ControlledUI.prefab" };
			string[] array2 = new string[48]
			{
				"AirHorn1.ogg", "friendship_ends_here.wav", "scroll_tp.wav", "ShovelReelUp.ogg", "ShovelSwing.ogg", "wooden-staff-hit.wav", "MineTrigger.ogg", "book_page.wav", "CVuse1.wav", "CVuse2.wav",
				"CVuse3.wav", "CVuse4.wav", "TerminalAlarm.ogg", "Breathing.wav", "huh.wav", "book_use_redesign.wav", "uwu.wav", "uwu-rot.wav", "drink.wav", "spanishsound.wav",
				"arthas.wav", "glass-grab.wav", "glass-drop.wav", "beam.wav", "ControlModeStart.wav", "ControlModeStop.wav", "FlashlightOutOfBatteries.ogg", "ControlledOn.wav", "ControlledOff.wav", "controller-alert.wav",
				"LightningStrike2.ogg", "KingAAAAAAHHH.wav", "card-evil.wav", "card-evil2.wav", "card-boo.wav", "card-common-fr.wav", "card-evil-fr.wav", "card-evil2-fr.wav", "book_open_square_steel-fr.wav", "book_close_eco_friendly-fr.wav",
				"book_use_redesign-fr.wav", "KingBoyFR.wav", "KingHmmFR.wav", "KingDinnerFR.wav", "KingHelpFR.wav", "KingPeaceFR.wav", "KingSaveFR.wav", "KingShipFR.wav"
			};
			string[] array3 = array;
			foreach (string text3 in array3)
			{
				gameObjects.Add(val.LoadAsset<GameObject>(text2 + text3));
			}
			string[] array4 = array2;
			foreach (string text4 in array4)
			{
				audioClips.Add(val.LoadAsset<AudioClip>(text2 + "_audio/" + text4));
			}
			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, 14),
				new Scrap("HarryMason/HarryMasonItem.asset", 10, 9),
				new Scrap("Cristal/CristalItem.asset", 10),
				new Scrap("PuppyShark/PuppySharkItem.asset", 10),
				new Scrap("Rupee/RupeeItem.asset", 15),
				new Scrap("EaNasir/EaNasirItem.asset", 9),
				new Scrap("HScard/HSCardItem.asset", 9, 16),
				new Scrap("SODA/SODAItem.asset", 8),
				new Scrap("Spoon/SpoonItem.asset", 13),
				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", 7, 13),
				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", 12, 10),
				new Scrap("Controller/ControllerItem.asset", 8, 12),
				new Scrap("Ronka/RonkaItem.asset", 10, 15)
			};
			int index = 0;
			config = new Config(((BaseUnityPlugin)this).Config, list);
			config.SetupCustomConfigs();
			Lang.Load(((BaseUnityPlugin)this).Logger, Application.systemLanguage, config.languageMode.Value);
			SetupScript.Network();
			foreach (Scrap item in list)
			{
				Item val2 = val.LoadAsset<Item>(text2 + item.asset);
				if (config.scrapValues[index].Item1 != -1)
				{
					val2.minValue = config.scrapValues[index].Item1;
					val2.maxValue = config.scrapValues[index].Item2;
				}
				if (item.behaviourId != 0)
				{
					LoadItemBehaviour(val2, item.behaviourId);
				}
				SpecialEvent.LoadSpecialEvent(val2.spawnPrefab);
				NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
				Utilities.FixMixerGroups(val2.spawnPrefab);
				Items.RegisterScrap(val2, config.entries[index++].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 SpecialEvent
	{
		public static int todayMonth = DateTime.Today.Month;

		public static void LoadSpecialEvent(GameObject itemPrefab)
		{
			if (todayMonth == 12)
			{
				Transform val = itemPrefab.transform.Find("Christmas");
				if (val != null)
				{
					((Component)val).gameObject.SetActive(true);
				}
			}
		}
	}
	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(Shovel target, Item item)
		{
			Shovel component = item.spawnPrefab.GetComponent<Shovel>();
			target.shovelHitForce = component.shovelHitForce;
			target.reelUp = component.reelUp;
			target.swing = component.swing;
			target.hitSFX = (AudioClip[])(object)new AudioClip[component.hitSFX.Length];
			for (int i = 0; i < component.hitSFX.Length; i++)
			{
				target.hitSFX[i] = component.hitSFX[i];
			}
			target.shovelAudio = component.shovelAudio;
			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.7.3").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);
				MysteryDice.RegisterNewEffect((IEffect)(object)new Hazards(), false, false);
				MysteryDice.RegisterNewEffect((IEffect)(object)new Music(), false, false);
				MysteryDice.RegisterNewEffect((IEffect)(object)new Academy(), false, false);
				MysteryDice.RegisterNewEffect((IEffect)(object)new Bombs(), false, false);
				MysteryDice.RegisterNewEffect((IEffect)(object)new Crouton(), false, false);
				MysteryDice.RegisterNewEffect((IEffect)(object)new Abi(), false, false);
				MysteryDice.RegisterNewEffect((IEffect)(object)new HarryMason(), false, false);
				if (Chainloader.PluginInfos.ContainsKey("Zeldahu.LethalAnomalies"))
				{
					MysteryDice.RegisterNewEffect((IEffect)(object)new SparkTowers(), false, false);
				}
			}
			else
			{
				logger.LogWarning((object)"Compatibility with 'Emergency Dice Updated' was enabled but you are not using the targeted 1.7.4+ version. Custom events will not be loaded.");
			}
		}
	}
	public static class NetworkerExtensions
	{
		public static IEnumerator StartHallucination(this Networker networker, ulong playerId, int hallucinationID)
		{
			bool stopFlag = false;
			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 || stopFlag)
				{
					break;
				}
				switch (hallucinationID)
				{
				case 0:
					yield return networker.HazardEffect(player);
					break;
				case 2:
					yield return networker.HauntedEffect(player);
					break;
				case 3:
					yield return networker.DeathEffect(player);
					stopFlag = true;
					break;
				}
			}
		}

		public static IEnumerator HazardEffect(this Networker networker, PlayerControllerB player)
		{
			yield return JobDark.HazardHallucination(player, null);
		}

		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, Lang.Get("HEART_ATTACK"));
		}

		public static IEnumerator HarryMasonCurse(this Networker networker)
		{
			yield return (object)new WaitForSeconds(10f);
			Vector3 position = RoundManager.Instance.insideAINodes[Random.Range(0, RoundManager.Instance.insideAINodes.Length - 1)].transform.position;
			networker.TeleportInsideServerRPC(GameNetworkManager.Instance.localPlayerController.playerClientId, position);
			networker.TurnOffAllLightsServerRPC();
			Effects.Audio3D(1, position, 1.5f);
			networker.SameScrapServerRPC(GameNetworkManager.Instance.localPlayerController.playerClientId, 8, "Harry Mason", true, position);
		}

		public static IEnumerator StartNoise(this Networker networker)
		{
			Vector3 position = RoundManager.Instance.insideAINodes[Random.Range(0, RoundManager.Instance.insideAINodes.Length - 1)].transform.position;
			networker.SameScrapServerRPC(GameNetworkManager.Instance.localPlayerController.playerClientId, 3, "crouton", true, position);
			for (int i = 0; i < 5; i++)
			{
				yield return (object)new WaitForSeconds(5f * (float)i);
				networker.SpawnEnemyAtPosServerRPC("Hoarding bug", position);
			}
		}

		public static IEnumerator TheAcademyIsNowOpen(this Networker networker)
		{
			int nb = 0;
			bool surrounded = true;
			float waitTimeMultiplicator = 1f;
			while (!StartOfRound.Instance.shipIsLeaving && !StartOfRound.Instance.inShipPhase)
			{
				if (Plugin.config.StarlancerAIFix && surrounded && !GameNetworkManager.Instance.localPlayerController.isPlayerDead && !GameNetworkManager.Instance.localPlayerController.isInsideFactory)
				{
					networker.MessageToEveryoneServerRPC(Lang.Get("DICE_INFO"), Lang.Get("DICE_INFO2"));
					networker.SpawnSurroundedServerRPC("Flowerman", 5, 3, true, Vector3.one * Random.Range(1.5f, 2.3f));
					surrounded = false;
				}
				else if (!Plugin.config.StarlancerAIFix || nb >= 5)
				{
					networker.SpawnEnemyAtPosServerRPC("Flowerman", RoundManager.Instance.insideAINodes[Random.Range(0, RoundManager.Instance.insideAINodes.Length - 1)].transform.position);
					waitTimeMultiplicator += 2f;
				}
				else if (nb <= 4)
				{
					networker.SpawnEnemyAtPosServerRPC("Flowerman", RoundManager.Instance.outsideAINodes[Random.Range(0, RoundManager.Instance.outsideAINodes.Length - 1)].transform.position);
				}
				nb++;
				yield return (object)new WaitForSeconds(waitTimeMultiplicator * (float)nb);
			}
		}

		public static IEnumerator SparkWarning(this Networker networker)
		{
			yield return (object)new WaitForSeconds(10f);
			if (GetEnemies.SparkTower != null && !StartOfRound.Instance.shipIsLeaving)
			{
				networker.MessageToEveryoneServerRPC(Lang.Get("DICE_INFO3"), "");
				for (int i = 0; i < Random.Range(10, 14); i++)
				{
					networker.SpawnEnemyAtPosServerRPC("SparkTower", RoundManager.Instance.outsideAINodes[Random.Range(0, RoundManager.Instance.outsideAINodes.Length - 1)].transform.position);
				}
			}
		}
	}
	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()
		{
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			int num = Random.Range(0, 3);
			if (1 == 0)
			{
			}
			string text = num switch
			{
				0 => "FunItemPack", 
				1 => "CuteItempack", 
				_ => "DangerousItempack", 
			};
			if (1 == 0)
			{
			}
			string text2 = text;
			string[] array = new string[4];
			switch (text2)
			{
			case "FunItemPack":
				array = new string[4] { "The King", "Harry Mason", "Balan Statue", "SODA" };
				break;
			case "CuteItempack":
				array = new string[4] { "Frieren", "Chocobo", "Puppy Shark", "Moogle" };
				break;
			case "DangerousItempack":
				array = new string[4] { "Controller", "Friendship ender", "Scroll of Town Portal", "Job application" };
				break;
			}
			for (int i = 0; i < array.Length; i++)
			{
				Networker.Instance.SameScrapServerRPC(GameNetworkManager.Instance.localPlayerController.playerClientId, 1, array[i], false, default(Vector3));
			}
		}
	}
	internal class Music : IEffect
	{
		public string Name => "Instrument of legends";

		public EffectType Outcome => (EffectType)4;

		public bool ShowDefaultTooltip => true;

		public string Tooltip => "Play a tune !";

		public void Use()
		{
			//IL_0061: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			if (Effects.GetScrap("OcarinaItem") != null)
			{
				Networker.Instance.SameScrapServerRPC(GameNetworkManager.Instance.localPlayerController.playerClientId, Random.Range(2, 6), "Ocarina", false, default(Vector3));
			}
			else
			{
				Networker.Instance.SameScrapServerRPC(GameNetworkManager.Instance.localPlayerController.playerClientId, 6, "Clown horn", false, default(Vector3));
			}
		}
	}
	internal class Abi : IEffect
	{
		public string Name => "Abibaland";

		public EffectType Outcome => (EffectType)4;

		public bool ShowDefaultTooltip => true;

		public string Tooltip => "Are you pondering the orb?";

		public void Use()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < 12; i++)
			{
				Networker.Instance.SameScrapServerRPC(GameNetworkManager.Instance.localPlayerController.playerClientId, 1, "The talking orb", true, RoundManager.Instance.outsideAINodes[Random.Range(0, RoundManager.Instance.outsideAINodes.Length - 1)].transform.position);
			}
		}
	}
	internal class Bombs : IEffect
	{
		public string Name => "Bombs infestation";

		public EffectType Outcome => (EffectType)1;

		public bool ShowDefaultTooltip => false;

		public string Tooltip => "Quite unstable";

		public void Use()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < 30; i++)
			{
				Networker.Instance.SameScrapServerRPC(GameNetworkManager.Instance.localPlayerController.playerClientId, 1, "Bomb", true, RoundManager.Instance.insideAINodes[Random.Range(0, RoundManager.Instance.insideAINodes.Length - 1)].transform.position);
			}
		}
	}
	internal class HarryMason : IEffect
	{
		public string Name => "Where is everybody?";

		public EffectType Outcome => (EffectType)2;

		public bool ShowDefaultTooltip => true;

		public string Tooltip => "Where is everybody?";

		public void Use()
		{
			((MonoBehaviour)Networker.Instance).StartCoroutine(Networker.Instance.HarryMasonCurse());
		}
	}
	internal class Crouton : IEffect
	{
		public string Name => "Disturbing noise";

		public EffectType Outcome => (EffectType)3;

		public bool ShowDefaultTooltip => true;

		public string Tooltip => "https://crouton.net";

		public void Use()
		{
			((MonoBehaviour)Networker.Instance).StartCoroutine(Networker.Instance.StartNoise());
		}
	}
	internal class Hazards : IEffect
	{
		public string Name => "Hazard hallucination";

		public EffectType Outcome => (EffectType)1;

		public bool ShowDefaultTooltip => true;

		public string Tooltip => "This is not real";

		public void Use()
		{
			Effects.SpawnQuicksand(30);
			((MonoBehaviour)Networker.Instance).StartCoroutine(Networker.Instance.StartHallucination(GameNetworkManager.Instance.localPlayerController.playerClientId, 0));
		}
	}
	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 Academy : IEffect
	{
		public string Name => "Flowerman Academy";

		public EffectType Outcome => (EffectType)0;

		public bool ShowDefaultTooltip => false;

		public string Tooltip => "Y\u0339\u0350\u034do\u0363\u036c\u0334ur c\u0316\u0364\u036fl\u035c\u0333\u0324as\u0361\u0308\u0300s\u0358\u0360\u036cm\u036f\u0316ates are e\u036e\u0322\u0365x\u0315\u030c\u0317cit\u0312\u0317\u0318e\u0345\u0369d to meet\u0333\u036d\u0366 y\u032a\u0338\u0324ou\u0314\u035a\u0312";

		public void Use()
		{
			((MonoBehaviour)Networker.Instance).StartCoroutine(Networker.Instance.TheAcademyIsNowOpen());
		}
	}
	internal class SparkTowers : IEffect
	{
		public string Name => "Towers";

		public EffectType Outcome => (EffectType)0;

		public bool ShowDefaultTooltip => false;

		public string Tooltip => "Plasma-powered radio transmitter online!";

		public void Use()
		{
			((MonoBehaviour)Networker.Instance).StartCoroutine(Networker.Instance.SparkWarning());
		}
	}
	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 void FillMessagesFromLang(List<string> messages, string[] ids)
		{
			foreach (string id in ids)
			{
				messages.Add(Lang.Get(id));
			}
		}

		public static List<PlayerControllerB> GetPlayers(bool includeDead = false, bool excludeOutsideFactory = false)
		{
			List<PlayerControllerB> list = StartOfRound.Instance.allPlayerScripts.ToList();
			List<PlayerControllerB> list2 = new List<PlayerControllerB>(list);
			foreach (PlayerControllerB item in list)
			{
				if (!((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)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			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 SetPosFlags(ulong playerID, bool ship = false, bool exterior = false, bool interior = false)
		{
			PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerID];
			if (ship)
			{
				val.isInElevator = true;
				val.isInHangarShipRoom = true;
				val.isInsideFactory = false;
			}
			if (exterior)
			{
				val.isInElevator = false;
				val.isInHangarShipRoom = false;
				val.isInsideFactory = false;
			}
			if (interior)
			{
				val.isInElevator = false;
				val.isInHangarShipRoom = false;
				val.isInsideFactory = true;
			}
			GrabbableObject[] itemSlots = val.ItemSlots;
			foreach (GrabbableObject val2 in itemSlots)
			{
				if ((Object)(object)val2 != (Object)null)
				{
					val2.isInFactory = val.isInsideFactory;
					val2.isInElevator = val.isInElevator;
					val2.isInShipRoom = val.isInHangarShipRoom;
				}
			}
			if (GameNetworkManager.Instance.localPlayerController.playerClientId == val.playerClientId)
			{
				if (val.isInsideFactory)
				{
					TimeOfDay.Instance.DisableAllWeather(false);
				}
				else
				{
					ActivateWeatherEffect((LevelWeatherType)0);
				}
			}
		}

		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 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 startPosition, float localVolume, float clientVolume, PlayerControllerB player)
		{
			//IL_0066: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)player != (Object)null && GameNetworkManager.Instance.localPlayerController.playerClientId == player.playerClientId)
			{
				Audio(audioID, localVolume);
			}
			else if ((Object)(object)player != (Object)null)
			{
				player.itemAudio.PlayOneShot(Plugin.audioClips[audioID], clientVolume);
			}
			else
			{
				AudioSource.PlayClipAtPoint(Plugin.audioClips[audioID], startPosition + Vector3.up * 2f, clientVolume);
			}
		}

		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.rolloffMode = (AudioRolloffMode)1;
			val3.minDistance = 0f;
			val3.maxDistance = 20f;
			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 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, bool specialStop = false)
		{
			yield return (object)new WaitForEndOfFrame();
			float volume = source.volume;
			while (source.volume > 0f)
			{
				source.volume -= volume * Time.deltaTime / time;
				if (specialStop && source.volume <= 0.01f)
				{
					break;
				}
				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_0030: 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)
			LevelWeatherType currentWeather = StartOfRound.Instance.currentLevel.currentWeather;
			StartOfRound.Instance.currentLevel.currentWeather = weather;
			if (Plugin.config.WeatherRegistery)
			{
				ChangeWeatherWR(weather);
				return;
			}
			RoundManager.Instance.SetToCurrentLevelWeather();
			TimeOfDay.Instance.SetWeatherBasedOnVariables();
			if (!GameNetworkManager.Instance.localPlayerController.isInsideFactory)
			{
				ActivateWeatherEffect(currentWeather);
			}
		}

		public static void ActivateWeatherEffect(LevelWeatherType originalWeather = 0)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Invalid comparison between Unknown and I4
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Invalid comparison between Unknown and I4
			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)originalWeather == 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 ChangeWeatherWR(LevelWeatherType weather)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			if (((NetworkBehaviour)GameNetworkManager.Instance.localPlayerController).IsHost)
			{
				WeatherController.SetWeatherEffects(weather);
			}
		}

		public static void AddCombinedWeather(LevelWeatherType weather)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.config.WeatherRegistery)
			{
				AddCombinedWeatherWR(weather);
			}
		}

		public static void AddCombinedWeatherWR(LevelWeatherType weather)
		{
			//IL_0001: 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)
			WeatherManager.GetWeather(weather).Effect.EffectEnabled = true;
			SunAnimator.OverrideSunAnimator(weather);
		}

		public static void CreateCameraOBC(PlayerControllerB? targetPlayer, MeshRenderer? renderer, GameObject gameObject, Controller controller)
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			MeshRenderer renderer2 = renderer;
			if ((Object)(object)targetPlayer == (Object)null || (Object)(object)renderer2 == (Object)null)
			{
				return;
			}
			BodyCamComponent bodyCam = gameObject.GetComponent<BodyCamComponent>();
			if ((Object)(object)bodyCam == (Object)null)
			{
				bodyCam = BodyCam.CreateBodyCam(gameObject, (Renderer)null, 0, (ManualCameraRenderer)null);
				bodyCam.Resolution = new Vector2Int(860, 520);
				bodyCam.OnCameraCreated += delegate(Camera cam)
				{
					SetRenderDistanceOBC(cam);
				};
				bodyCam.OnRenderTextureCreated += delegate
				{
					SetTextureOBC(bodyCam.IsBlanked, renderer2, bodyCam.GetCamera());
				};
				bodyCam.OnBlankedSet += delegate
				{
					SetTextureOBC(bodyCam.IsBlanked, renderer2, bodyCam.GetCamera());
				};
				SetTextureOBC(bodyCam.IsBlanked, renderer2, bodyCam.GetCamera());
				SetRenderDistanceOBC(bodyCam.GetCamera());
			}
			bodyCam.SetTargetToPlayer(targetPlayer);
			bodyCam.ForceEnableCamera = true;
			controller.cameraReady = true;
		}

		public static void DestroyCameraOBC(MeshRenderer? renderer, GameObject gameObject)
		{
			BodyCamComponent component = gameObject.GetComponent<BodyCamComponent>();
			if ((Object)(object)component != (Object)null)
			{
				component.SetTargetToNone();
				component.ForceEnableCamera = false;
			}
			if (renderer != null)
			{
				((Renderer)renderer).materials[3].SetTexture("_ScreenTexture", (Texture)null);
			}
		}

		private static void SetTextureOBC(bool isBlanked, MeshRenderer? renderer, Camera? cam)
		{
			if (isBlanked)
			{
				if (renderer != null)
				{
					((Renderer)renderer).materials[3].SetTexture("_ScreenTexture", (Texture)null);
				}
			}
			else if (renderer != null)
			{
				((Renderer)renderer).materials[3].SetTexture("_ScreenTexture", (Texture)(object)((cam != null) ? cam.targetTexture : null));
			}
		}

		private static void SetRenderDistanceOBC(Camera? cam)
		{
			if ((Object)(object)cam != (Object)null)
			{
				cam.nearClipPlane = 0.01f;
				cam.farClipPlane = 100f;
			}
		}

		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 NetworkObjectReference Spawn(SpawnableEnemyWithRarity enemy, Vector3 position, float yRot = 0f)
		{
			//IL_000c: 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)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: 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, yRot, 0f)));
			val.GetComponentInChildren<NetworkObject>().Spawn(true);
			RoundManager.Instance.SpawnedEnemies.Add(val.GetComponent<EnemyAI>());
			return new NetworkObjectReference(val);
		}

		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, float yRot = 0f)
		{
			//IL_0007: 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)
			GameObject val = Object.Instantiate<GameObject>(trap.prefabToSpawn, position, Quaternion.Euler(new Vector3(0f, yRot, 0f)), 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, bool redirectInside = 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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: 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 val = strikePosition + Vector3.up * 160f + new Vector3((float)random.Next(-32, 32), 0f, (float)random.Next(-32, 32));
			RaycastHit val2 = default(RaycastHit);
			if (redirectInside && Physics.Linecast(val, strikePosition + Vector3.up * 0.5f, ref val2, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
			{
				RaycastHit val3 = default(RaycastHit);
				if (!Physics.Raycast(val, strikePosition - val, ref val3, 100f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
				{
					return;
				}
				strikePosition = ((RaycastHit)(ref val3)).point;
			}
			StormyWeather val4 = Object.FindObjectOfType<StormyWeather>(true);
			LightningBoltPrefabScript val5 = Object.Instantiate<LightningBoltPrefabScript>(val4.targetedThunder);
			((Behaviour)val5).enabled = true;
			((LightningBoltScript)val5).Camera = GameNetworkManager.Instance.localPlayerController.gameplayCamera;
			((LightningBoltPrefabScriptBase)val5).AutomaticModeSeconds = 0.2f;
			val5.Source.transform.position = val;
			val5.Destination.transform.position = strikePosition;
			((LightningBoltPrefabScriptBase)val5).CreateLightningBoltsNow();
			AudioSource val6 = Object.Instantiate<AudioSource>(val4.targetedStrikeAudio);
			((Component)val6).transform.position = strikePosition + Vector3.up * 0.5f;
			((Behaviour)val6).enabled = true;
			if (damage)
			{
				Landmine.SpawnExplosion(strikePosition + Vector3.up * 0.25f, false, 2.4f, 5f, 50, 0f, (GameObject)null, false);
			}
			val4.PlayThunderEffects(strikePosition, val6);
		}
	}
	[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 SpawnableEnemyWithRarity BaboonHawk;

		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 == "Baboon hawk" && BaboonHawk == null)
					{
						BaboonHawk = 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;
					}
				}
			}
		}
	}
	internal static class Lang
	{
		public static string ACTUAL_LANG = "en";

		private static readonly Dictionary<string, string> langValues = new Dictionary<string, string>();

		public static string Get(string id)
		{
			return langValues.GetValueOrDefault(id, id);
		}

		public static void Load(ManualLogSource logger, SystemLanguage systemLanguage, string languageMode)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			ChooseLanguage(systemLanguage, languageMode);
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Lang/lang-" + ACTUAL_LANG + ".json");
			if (!File.Exists(text))
			{
				logger.LogError((object)("Languade file (" + text + ") was not found. Please re-download the mod properly."));
				return;
			}
			JObject val = JObject.Parse(File.ReadAllText(text));
			langValues.Clear();
			foreach (var (text3, val3) in val)
			{
				langValues[text3] = ((object)val3)?.ToString() ?? text3;
			}
		}

		private static void ChooseLanguage(SystemLanguage systemLanguage, string languageMode)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Invalid comparison between Unknown and I4
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			if (1 == 0)
			{
			}
			string aCTUAL_LANG = languageMode switch
			{
				"default" => ((int)systemLanguage == 14) ? "fr" : "en", 
				"english" => "en", 
				"french" => "fr", 
				_ => ((int)systemLanguage == 14) ? "fr" : "en", 
			};
			if (1 == 0)
			{
			}
			ACTUAL_LANG = aCTUAL_LANG;
		}
	}
	[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;
			}
		}
	}
	[HarmonyPatch(typeof(Shovel))]
	internal class SteelBarPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("HitShovel")]
		public static void HitShovelPatch(Shovel __instance, bool cancel)
		{
			SteelBar.TwoHandedFix(__instance, cancel);
		}
	}
	[HarmonyPatch(typeof(HUDManager))]
	internal class FrenchModeItemTooltipsPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("ChangeControlTip")]
		public static void ChangeControlTipPatch(HUDManager __instance, string changeTo)
		{
			if (!StartOfRound.Instance.localPlayerUsingController)
			{
				changeTo = changeTo.Replace("[Z]", "[W]");
				changeTo = changeTo.Replace("[Q]", "[A]");
				changeTo = changeTo.Replace("[Q/E]", "[A/E]");
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("ChangeControlTipMultiple")]
		public static void ChangeControlTipMultiplePatch(HUDManager __instance, string[] allLines, bool holdingItem)
		{
			if (allLines != null && !StartOfRound.Instance.localPlayerUsingController)
			{
				for (int i = 0; i < allLines.Length && i + (holdingItem ? 1 : 0) < __instance.controlTipLines.Length; i++)
				{
					allLines[i] = allLines[i].Replace("[Z]", "[W]");
					allLines[i] = allLines[i].Replace("[Q]", "[A]");
					allLines[i] = allLines[i].Replace("[Q/E]", "[A/E]");
				}
			}
		}
	}
	[HarmonyPatch(typeof(Terminal))]
	internal class ControllerTerminalPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("QuitTerminal")]
		public static void QuitTerminalPatch()
		{
			ControllerMovement.FlagsFix();
		}
	}
	[HarmonyPatch(typeof(HUDManager))]
	internal class ControllerHUDManagerPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("EnableChat_performed")]
		public static bool EnableChatControllerPatch(HUDManager __instance)
		{
			return ControllerMovement.ChatPatch(__instance);
		}

		[HarmonyPrefix]
		[HarmonyPatch("SubmitChat_performed")]
		public static bool SubmitChatControllerPatch(HUDManager __instance)
		{
			return ControllerMovement.ChatPatch(__instance);
		}

		[HarmonyPrefix]
		[HarmonyPatch("OpenMenu_performed")]
		public static bool OpenMenuControllerPatch(HUDManager __instance)
		{
			return ControllerMovement.ChatPatch(__instance);
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class ControllerPlayerControllerBPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("Jump_performed")]
		public static bool JumpControllerPatch(PlayerControllerB __instance)
		{
			return ControllerMovement.PlayerPatch(__instance, ControllerMovement.ControllerActions.Jump);
		}

		[HarmonyPrefix]
		[HarmonyPatch("Crouch_performed")]
		public static bool CrouchControllerPatch(PlayerControllerB __instance)
		{
			return ControllerMovement.PlayerPatch(__instance, ControllerMovement.ControllerActions.Crouch);
		}

		[HarmonyPrefix]
		[HarmonyPatch("Interact_performed")]
		public static bool InteractControllerPatch(PlayerControllerB __instance)
		{
			return ControllerMovement.PlayerPatch(__instance, ControllerMovement.ControllerActions.Interact);
		}

		[HarmonyPrefix]
		[HarmonyPatch("ActivateItem_performed")]
		public static bool ActivateItemControllerPatch(PlayerControllerB __instance)
		{
			return ControllerMovement.PlayerPatch(__instance, ControllerMovement.ControllerActions.ActivateItem);
		}

		[HarmonyPrefix]
		[HarmonyPatch("ActivateItem_canceled")]
		public static bool CancelItemControllerPatch(PlayerControllerB __instance)
		{
			return ControllerMovement.PlayerPatch(__instance, ControllerMovement.ControllerActions.CancelItem);
		}

		[HarmonyPrefix]
		[HarmonyPatch("Discard_performed")]
		public static bool DiscardControllerPatch(PlayerControllerB __instance)
		{
			return ControllerMovement.PlayerPatch(__instance, ControllerMovement.ControllerActions.DropItem, canBeCanceled: true);
		}

		[HarmonyPrefix]
		[HarmonyPatch("ScrollMouse_performed")]
		public static bool ScrollControllerPatch(PlayerControllerB __instance, CallbackContext context)
		{
			return ControllerMovement.PlayerDataPatch(__instance, ControllerMovement.ControllerActions.SwitchItem, ((CallbackContext)(ref context)).ReadValue<float>());
		}

		[HarmonyPrefix]
		[HarmonyPatch("Emote1_performed")]
		public static bool Emote1ControllerPatch(PlayerControllerB __instance)
		{
			return ControllerMovement.PlayerDataPatch(__instance, ControllerMovement.ControllerActions.Emote, 1f);
		}

		[HarmonyPrefix]
		[HarmonyPatch("Emote2_performed")]
		public static bool Emote2ControllerPatch(PlayerControllerB __instance)
		{
			return ControllerMovement.PlayerDataPatch(__instance, ControllerMovement.ControllerActions.Emote, 2f);
		}

		[HarmonyPrefix]
		[HarmonyPatch("CheckConditionsForEmote")]
		public static bool EmoteConditionControllerPatch(PlayerControllerB __instance, ref bool __result)
		{
			bool flag = ControllerMovement.EmoteConditionPatch(__instance);
			if (!flag)
			{
				__result = true;
			}
			return flag;
		}

		[HarmonyPrefix]
		[HarmonyPatch("Update")]
		public static void UpdateControllerPrePatch(PlayerControllerB __instance)
		{
			ControllerMovement.PlayerVectorPatch(__instance, ControllerMovement.ControllerActions.Move);
		}

		[HarmonyPostfix]
		[HarmonyPatch("Update")]
		public static void UpdateControllerPostPatch()
		{
			ControllerMovement.InvertFlagsFix();
		}

		[HarmonyPrefix]
		[HarmonyPatch("PlayerLookInput")]
		public static void PlayerLookInputControllerPrePatch(PlayerControllerB __instance)
		{
			ControllerMovement.PlayerVectorPatch(__instance, ControllerMovement.ControllerActions.Look);
		}

		[HarmonyPostfix]
		[HarmonyPatch("PlayerLookInput")]
		public static void PlayerLookInputControllerPostPatch()
		{
			ControllerMovement.InvertFlagsFix();
		}
	}
	[HarmonyPatch(typeof(VehicleController))]
	internal class ControllerVehicleControllerPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("GetVehicleInput")]
		public static void GetVehicleInputControllerPrePatch(VehicleController __instance)
		{
			ControllerMovement.ControlledCruiserSaveValuesPatch(__instance);
		}

		[HarmonyPostfix]
		[HarmonyPatch("GetVehicleInput")]
		public static void GetVehicleInputControllerPostPatch(VehicleController __instance)
		{
			ControllerMovement.ControlledCruiserMovePatch(__instance);
		}

		[HarmonyPrefix]
		[HarmonyPatch("DoTurboBoost")]
		public static bool DoTurboBoostControllerPatch(VehicleController __instance)
		{
			return !ControllerMovement.ControlledCruiserJumpPatch(__instance);
		}
	}
	internal static class PremiumScrapsMonoModPatches
	{
		public static void Load()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			PlayerControllerB.Update += new Manipulator(IsBeingControlledMove);
		}

		private static void IsBeingControlledMove(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			for (int i = 0; i < 3; i++)
			{
				val.GotoNext((MoveType)2, new Func<Instruction, bool>[3]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchCall<Vector2>(x, "get_zero"),
					(Instruction x) => ILPatternMatchingExt.MatchStfld<PlayerControllerB>(x, "moveInputVector")
				});
				if (i == 1)
				{
					continue;
				}
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Action<PlayerControllerB>>((Action<PlayerControllerB>)delegate(PlayerControllerB self)
				{
					ControllerMovement.ControlledMovePatch(self);
				});
				if (i == 0)
				{
					val.Emit(OpCodes.Ldarg_0);
					val.EmitDelegate<Func<PlayerControllerB, float>>((Func<PlayerControllerB, float>)((PlayerControllerB self) => ControllerMovement.ControlledSprintPatch(self)));
					val.Emit(OpCodes.Stloc_0);
				}
			}
		}
	}
	internal class ShipInventoryConditions
	{
		public static void Setup(BepInPlugin inventoryMetadata)
		{
			if (new Version("1.2.2").CompareTo(inventoryMetadata.Version) <= 0)
			{
				InteractionHelper.AddCondition((Func<PlayerControllerB, bool>)PremiumScrapsCondition, "[Item not allowed]", false);
			}
		}

		private static bool PremiumScrapsCondition(PlayerControllerB player)
		{
			GrabbableObject currentlyHeldObjectServer = player.currentlyHeldObjectServer;
			if ((((Object)currentlyHeldObjectServer.itemProperties).name == "BombItem" && currentlyHeldObjectServer is Bomb) || (((Object)currentlyHeldObjectServer.itemProperties).name == "ControllerItem" && currentlyHeldObjectServer is Controller) || (((Object)currentlyHeldObjectServer.itemProperties).name == "JobApplicationItem" && currentlyHeldObjectServer is JobDark) || (((Object)currentlyHeldObjectServer.itemProperties).name == "GazpachoItem" && currentlyHeldObjectServer is SpanishDrink) || (((Object)currentlyHeldObjectServer.itemProperties).name == "ScrollItem" && currentlyHeldObjectServer is ScrollTP) || (((Object)currentlyHeldObjectServer.itemProperties).name == "AbiItem" && currentlyHeldObjectServer is TalkingBall) || (((Object)currentlyHeldObjectServer.itemProperties).name == "CustomFaceItem" && currentlyHeldObjectServer is TrollFace))
			{
				return false;
			}
			return true;
		}
	}
	internal class SSSConditions
	{
		public static void Setup(BepInPlugin sssMetaData)
		{
			if (new Version("1.0.0").CompareTo(sssMetaData.Version) <= 0)
			{
				SmartCupboard.AddTriggerValidation((Func<PlayerControllerB, bool>)PremiumScrapsCondition, "[Item not allowed]");
			}
		}

		private static bool PremiumScrapsCondition(PlayerControllerB player)
		{
			GrabbableObject currentlyHeldObjectServer = player.currentlyHeldObjectServer;
			if ((((Object)currentlyHeldObjectServer.itemProperties).name == "BombItem" && currentlyHeldObjectServer is Bomb bomb && bomb.activated) || (((Object)currentlyHeldObjectServer.itemProperties).name == "ControllerItem" && currentlyHeldObjectServer is Controller controller && controller.isInControlMode) || (((Object)currentlyHeldObjectServer.itemProperties).name == "JobApplicationItem" && currentlyHeldObjectServer is JobDark) || (((Object)currentlyHeldObjectServer.itemProperties).name == "GazpachoItem" && currentlyHeldObjectServer is SpanishDrink))
			{
				return false;
			}
			return true;
		}
	}
}
namespace PremiumScraps.CustomEffects
{
	internal class Bomb : ThrowableItem
	{
		public bool isBeeingActivated = false;

		public bool activated = false;

		public AudioSource? alarm;

		public ParticleSystem? bombParticle;

		public ParticleSystem? smokeParticle;

		public Animator? bombAnimator;

		private Coroutine? activateCoroutine;

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			alarm = ((Component)((Component)this).transform.GetChild(5)).GetComponent<AudioSource>();
			bombParticle = ((Component)((Component)this).transform.GetChild(1)).GetComponent<ParticleSystem>();
			smokeParticle = ((Component)((Component)this).transform.GetChild(4)).GetComponent<ParticleSystem>();
			bombAnimator = ((Component)((Component)this).transform.GetChild(0)).GetComponent<Animator>();
		}

		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.ClearControlTips();
				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()
		{
			AudioSource? obj = alarm;
			if (obj != null)
			{
				obj.Play();
			}
			ParticleSystem? obj2 = bombParticle;
			if (obj2 != null)
			{
				obj2.Play();
			}
			ParticleSystem? obj3 = smokeParticle;
			if (obj3 != null)
			{
				obj3.Play();
			}
			Animator? obj4 = bombAnimator;
			if (obj4 != null)
			{
				obj4.SetTrigger("CaVaPeter");
			}
			yield return (object)new WaitForSeconds(2f);
			Animator? obj5 = bombAnimator;
			if (obj5 != null)
			{
				obj5.SetFloat("SpeedMult", 4f);
			}
			yield return (object)new WaitForSeconds(1f);
			Animator? obj6 = bombAnimator;
			if (obj6 != null)
			{
				obj6.SetFloat("SpeedMult", 8f);
			}
			yield return (object)new WaitForSeconds(1.2f);
			ParticleSystem? obj7 = bombParticle;
			if (obj7 != null)
			{
				obj7.Stop();
			}
			ParticleSystem? obj8 = smokeParticle;
			if (obj8 != null)
			{
				obj8.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;
					((GrabbableObject)this).grabbableToEnemies = false;
					((MonoBehaviour)this).StartCoroutine(BombExplosionUnstable(this));
				}
			}
		}

		private IEnumerator BombExplosionUnstable(Bomb bomb)
		{
			if ((Object)(object)bomb.alarm != (Object)null)
			{
				bomb.alarm.clip = Plugin.audioClips[6];
				bomb.alarm.volume = 2f;
				bomb.alarm.Play();
			}
			Animator? obj = bombAnimator;
			if (obj != null)
			{
				obj.SetTrigger("CaVaPeterMaintenant");
			}
			yield return (object)new WaitForSeconds(0.8f);
			if ((Object)(object)((GrabbableObject)bomb).playerHeldBy != (Object)null && !((GrabbableObject)bomb).playerHeldBy.isPlayerDead && ((GrabbableObject)bomb).isPocketed)
			{
				((GrabbableObject)bomb).playerHeldBy.DropAllHeldItems(true, false);
			}
			Vector3 position = ((Component)bomb).transform.position;
			((GrabbableObject)bomb).DestroyObjectInHand(((Object)(object)((GrabbableObject)bomb).playerHeldBy != (Object)null && ((GrabbableObject)bomb).isHeld) ? ((GrabbableObject)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 CDI_King : NoisemakerProp
	{
		public Animator? kingAnimator;

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			kingAnimator = ((Component)((Component)this).transform.GetChild(0)).GetComponent<Animator>();
			if (((GrabbableObject)this).insertedBattery != null)
			{
				((GrabbableObject)this).insertedBattery.charge = 1f;
			}
			((GrabbableObject)this).itemProperties.toolTips[0] = Lang.Get("KING_USAGE");
			((GrabbableObject)this).itemProperties.toolTips[1] = Lang.Get("KING_USAGE2");
			if (Lang.ACTUAL_LANG == "fr")
			{
				((GrabbableObject)this).itemProperties.grabSFX = Plugin.audioClips[41];
				((GrabbableObject)this).itemProperties.dropSFX = Plugin.audioClips[42];
				base.noiseSFX[0] = Plugin.audioClips[43];
				base.noiseSFX[1] = Plugin.audioClips[44];
				base.noiseSFX[2] = Plugin.audioClips[45];
				base.noiseSFX[3] = Plugin.audioClips[46];
				base.noiseSFX[4] = Plugin.audioClips[47];
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			if (buttonDown && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null && !base.noiseAudio.isPlaying)
			{
				if (((!Effects.IsUnlucky(((GrabbableObject)this).playerHeldBy.playerSteamId) || Random.Range(0, 10) > 4) && Random.Range(0, 100) > 2) || StartOfRound.Instance.inShipPhase || !StartOfRound.Instance.shipHasLanded || StartOfRound.Instance.shipIsLeaving)
				{
					KingAudioServerRpc();
				}
				else
				{
					KingBadEffectServerRpc();
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void KingAudioServerRpc()
		{
			//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(3936761375u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3936761375u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					KingAudioClientRpc(Random.Range(0, base.noiseSFX.Length));
				}
			}
		}

		[ClientRpc]
		private void KingAudioClientRpc(int selectedNoise)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: 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(316515062u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, selectedNoise);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 316515062u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null))
			{
				float num = (float)base.noisemakerRandom.Next((int)(base.minLoudness * 100f), (int)(base.maxLoudness * 100f)) / 100f;
				base.noiseAudio.PlayOneShot(base.noiseSFX[selectedNoise], num);
				Animator? obj = kingAnimator;
				if (obj != null)
				{
					obj.SetTrigger("Noise" + (selectedNoise + 1));
				}
				WalkieTalkie.TransmitOneShotAudio(base.noiseAudio, base.noiseSFX[selectedN