Decompiled source of Bozoros v2.4.1

BepInEx/plugins/Bozoros.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AntlerShed.SkinRegistry;
using AntlerShed.SkinRegistry.Events;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using Bozoros.Behaviours;
using Bozoros.Compatibility;
using Bozoros.Compatibility.Moons;
using Bozoros.NetcodePatcher;
using Bozoros.Patches;
using Bozoros.Skins;
using DunGen;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyTestMod;
using LethalLevelLoader;
using Microsoft.CodeAnalysis;
using Mimics;
using Mimics.API;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.VFX;
using VoxxWeatherPlugin.Behaviours;
using WeatherRegistry;
using WeatherRegistry.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("CrowdControl")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("voxx.LethalElementsPlugin")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Bozoros")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Plugin for LethalMatt's Bozoros, adds configuration and some additional stuff.")]
[assembly: AssemblyFileVersion("2.4.1.0")]
[assembly: AssemblyInformationalVersion("2.4.1+21391900de2dc7e254a332391b89df6e1a8d25f7")]
[assembly: AssemblyProduct("Bozoros")]
[assembly: AssemblyTitle("Bozoros")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.4.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<float>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<float>();
	}
}
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;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Bozoros
{
	public enum BananaPeelDropLevel
	{
		AllItems = -1,
		HeldItem,
		NoItems
	}
	public class Config
	{
		public ConfigEntry<bool> STREAMER_FRIENDLY { get; private set; }

		public ConfigEntry<float> FIREWORK_PARTICLES { get; private set; }

		public ConfigEntry<float> CONFETTI_PARTICLES { get; private set; }

		public ConfigEntry<float> BALLOON_PARTICLES { get; private set; }

		public ConfigEntry<float> FIREWORK_MUSIC_VOLUME { get; private set; }

		public ConfigEntry<float> FIREWORK_EXPLOSION_VOLUME { get; private set; }

		public ConfigEntry<float> ANNOUNCER_VOLUME { get; private set; }

		public ConfigEntry<float> TENT_MUSIC_VOLUME { get; private set; }

		public ConfigEntry<float> DROPSHIP_VOLUME { get; private set; }

		public ConfigEntry<string> GOOFY_PUFFER_NAMES { get; private set; }

		public ConfigEntry<string> CLOWN_GIANT_NAMES { get; private set; }

		public ConfigEntry<string> SANTA_BUTLER_NAMES { get; private set; }

		public ConfigEntry<bool> BALLOON_INSTRUCTIONS { get; private set; }

		public ConfigEntry<int> BALLOON_PRICE { get; private set; }

		public ConfigEntry<bool> FERRIS_WHEEL_EXIT { get; private set; }

		public ConfigEntry<float> BANANA_MULTIPLIER_INSIDE { get; private set; }

		public ConfigEntry<float> BANANA_MULTIPLIER_OUTSIDE { get; private set; }

		public ConfigEntry<BananaPeelDropLevel> BANANA_DROPS_ITEMS { get; private set; }

		public ConfigEntry<bool> MODIFY_SHIP_NODE { get; private set; }

		public ConfigEntry<bool> ADD_DROPSHIP_NODE { get; private set; }

		public ConfigEntry<bool> REDUCE_MOTION_SICKNESS { get; private set; }

		public ConfigEntry<bool> CIRCUS_FACILITY_MIMICS { get; private set; }

		public ConfigEntry<bool> CIRCUS_PANDORAMUS_PORTAL { get; private set; }

		public ConfigEntry<bool> CIRCUS_STARLANCERZERO_DOOR { get; private set; }

		public Config(ConfigFile cfg)
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Expected O, but got Unknown
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Expected O, but got Unknown
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Expected O, but got Unknown
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Expected O, but got Unknown
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Expected O, but got Unknown
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Expected O, but got Unknown
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Expected O, but got Unknown
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Expected O, but got Unknown
			//IL_0331: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Expected O, but got Unknown
			cfg.SaveOnConfigSet = false;
			STREAMER_FRIENDLY = cfg.Bind<bool>("General", "StreamerFriendly", true, "Whether the music is streamer-friendly or not.");
			FIREWORK_PARTICLES = cfg.Bind<float>("Particles", "FireworkParticles", 1f, new ConfigDescription("Intensity of firework particles at the end of a clear day.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			CONFETTI_PARTICLES = cfg.Bind<float>("Particles", "ConfettiParticles", 1f, new ConfigDescription("Intensity of confetti particles during eclipsed weather.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			BALLOON_PARTICLES = cfg.Bind<float>("Particles", "BalloonParticles", 1f, new ConfigDescription("Intensity of balloon particles during stormy weather.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			FIREWORK_MUSIC_VOLUME = cfg.Bind<float>("Audio", "FireworkMusicVolume", 1f, new ConfigDescription("Volume level for the firework music at the end of a clear day.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>()));
			FIREWORK_EXPLOSION_VOLUME = cfg.Bind<float>("Audio", "FireworkExplosionVolume", 1f, new ConfigDescription("Volume level for the firework explosion sound effects at the end of a clear day.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>()));
			ANNOUNCER_VOLUME = cfg.Bind<float>("Audio", "AnnouncerVolume", 2f, new ConfigDescription("Volume level for the announcer voice at the end of each day.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>()));
			TENT_MUSIC_VOLUME = cfg.Bind<float>("Audio", "TentMusicVolume", 1f, new ConfigDescription("Volume level for the circus tent music near every entrance.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>()));
			DROPSHIP_VOLUME = cfg.Bind<float>("Audio", "DropshipVolume", 1f, new ConfigDescription("Volume level for the dropship's music when delivering items.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>()));
			GOOFY_PUFFER_NAMES = cfg.Bind<string>("Enemies", "GoofyPufferNames", "Steve,Krusty,Ronald,Arthur,Toodles,Jingles,Dusty,Dumbo,Bingo,Whistle,Mittens,Pancake,Freckles,Chester,Oddball,Snuggles,Charlie,Bashful,Flower,Jumbo,Jimbo,Snickers,Pogo,Giggles,Loofy,Blinky,Ruffles,Dinky,Beebo,Chuckles", "A comma-separated list of names for Spore Lizard enemy variants to show in their scan node. Requires restart.");
			CLOWN_GIANT_NAMES = cfg.Bind<string>("Enemies", "ClownGiantNames", "Penn,Teller,Houdini,Dante,Copperfield,Blaine,Angel,Borden,Angier,Merlin,Kaito,Oz,Zatara,Mysterio,Riddler,Eisenheim,Gallico,Splendini", "A comma-separated list of names for Forest Giant enemy variants to show in their scan node. Requires restart.");
			SANTA_BUTLER_NAMES = cfg.Bind<string>("Enemies", "SantaButlerNames", "Santa Claus,St. Nicholas,Joulupukki,Sinterklaas,Ded Moroz,Julenisse,Mikulás,Shengdan Laoren,Père Noël,Krampus,Knecht Ruprecht,Kriss Kringle", "A comma-separated list of names for Santa Butler enemy variants to show in their scan node. Requires restart.");
			BALLOON_INSTRUCTIONS = cfg.Bind<bool>("Mechanics", "BalloonInstructions", true, "Show a one-time notification with instructions on how to operate balloons. Shows once per session, until the game is reopened.");
			BALLOON_PRICE = cfg.Bind<int>("Mechanics", "BalloonPrice", 15, new ConfigDescription("Credits required to purchase a one-time balloon shortcut from one of the balloon stands around the map. Can be set to -1 to disable (if you HATE fun).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 200), Array.Empty<object>()));
			FERRIS_WHEEL_EXIT = cfg.Bind<bool>("Mechanics", "FerrisWheelExit", true, "Whether the Fire Exit inside the Ferris Wheel should spawn or not — wormholes may not be immersive!");
			BANANA_MULTIPLIER_INSIDE = cfg.Bind<float>("Mechanics", "BananaMultiplierInside", 1f, new ConfigDescription("Multiply inside banana peel hazard spawning curve across the board (minimum and maximum) by this value. Set to 0 to disable banana peels inside.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f), Array.Empty<object>()));
			BANANA_MULTIPLIER_OUTSIDE = cfg.Bind<float>("Mechanics", "BananaMultiplierOutside", 1f, new ConfigDescription("Multiply outside banana peel hazard spawning curve across the board (minimum and maximum) by this value. Set to 0 to disable banana peels outside.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f), Array.Empty<object>()));
			BANANA_DROPS_ITEMS = cfg.Bind<BananaPeelDropLevel>("Mechanics", "BananaDropsItems", BananaPeelDropLevel.HeldItem, "Whether slipping on a banana peel causes players to drop items.");
			MODIFY_SHIP_NODE = cfg.Bind<bool>("Other", "ModifyShipNode", false, "Increase (subjective) accuracy of the ship's scan node.");
			ADD_DROPSHIP_NODE = cfg.Bind<bool>("Other", "AddDropshipNode", true, "Add a scan node to the dropship and allow it to be scanned.");
			REDUCE_MOTION_SICKNESS = cfg.Bind<bool>("Other", "ReduceMotionSickness", false, "Attempts to reduce motion sickness a bit. Currently only stops the camera turning when going through the twisted hallway. ");
			CIRCUS_FACILITY_MIMICS = cfg.Bind<bool>("Compatibility", "CircusFacilityMimics", true, "Allow x753's Mimics to spawn in Circus Facility.");
			CIRCUS_PANDORAMUS_PORTAL = cfg.Bind<bool>("Compatibility", "CircusPandoramusPortal", true, "Enable Circus Facility's special portal for DemonMae's Pandoramus; otherwise it'll just be the same as regular facility. Requires restart.");
			CIRCUS_STARLANCERZERO_DOOR = cfg.Bind<bool>("Compatibility", "CircusStarlancerZeroDoor", true, "Enable Circus Facility swapping StarlancerZero's main entrance door. Requires restart.");
			BANANA_DROPS_ITEMS.SettingChanged += delegate(object setting, EventArgs _)
			{
				if (setting is ConfigEntry<BananaPeelDropLevel> val)
				{
					SpawnableMapObject? bananaPeelInside = Plugin.BananaPeelInside;
					if (bananaPeelInside != null)
					{
						Transform obj = bananaPeelInside.prefabToSpawn.transform.Find("BananaLauncher");
						PlayerLauncher playerLauncher = default(PlayerLauncher);
						if (((obj != null) ? new bool?(((Component)obj).TryGetComponent<PlayerLauncher>(ref playerLauncher)) : null).GetValueOrDefault())
						{
							playerLauncher.dropHeldItemAtStart = val.Value < BananaPeelDropLevel.NoItems;
							playerLauncher.dropPlayerItemsAtEnd = val.Value < BananaPeelDropLevel.HeldItem;
						}
					}
				}
			};
			ClearOrphanedEntries(cfg);
			cfg.SaveOnConfigSet = true;
			cfg.Save();
		}

		private void ClearOrphanedEntries(ConfigFile config)
		{
			PropertyInfo propertyInfo = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries");
			((Dictionary<ConfigDefinition, string>)propertyInfo.GetValue(config))?.Clear();
		}
	}
	[BepInDependency("imabatby.lethallevelloader", "1.4.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("LethalMatt.Bozoros", "BozorosPlugin", "2.4.1")]
	public class Plugin : BaseUnityPlugin
	{
		internal const string GUID = "LethalMatt.Bozoros";

		internal const string PLUGIN_NAME = "BozorosPlugin";

		internal const string VERSION = "2.4.1";

		internal static ManualLogSource StaticLogger { get; private set; }

		internal static Harmony Harmony { get; private set; }

		public static Config Settings { get; private set; }

		public static AssetBundle? BozorosBundle { get; private set; }

		public static ExtendedLevel? BozorosExtendedLevel { get; private set; }

		public static ExtendedDungeonFlow? CircusFacilityExtendedDungeon { get; private set; }

		public static GameObject? GrabbableBalloon { get; private set; }

		public static SpawnableMapObject? BananaPeelInside { get; private set; }

		public static SpawnableOutsideObjectWithRarity? BananaPeelOutside { get; private set; }

		private void Awake()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			StaticLogger = ((BaseUnityPlugin)this).Logger;
			try
			{
				Settings = new Config(((BaseUnityPlugin)this).Config);
				Harmony = new Harmony("LethalMatt.Bozoros");
				NetcodePatcher();
				LoadAssets();
				Harmony.PatchAll(typeof(LoadPatch));
				Harmony.PatchAll(typeof(PopcornNestPatch));
				Harmony.PatchAll(typeof(BananaPeelInsidePatch));
				if (WeatherRegistryCompatibility.Enabled)
				{
					Harmony.PatchAll(typeof(WeatherRegistryCompatibility));
				}
				StaticLogger.LogInfo((object)"'BozorosPlugin' loaded!");
			}
			catch (Exception arg)
			{
				StaticLogger.LogError((object)string.Format("Error while initializing '{0}': {1}", "BozorosPlugin", arg));
			}
		}

		private void LoadAssets()
		{
			AssetBundleLoader.AddOnExtendedModLoadedListener((Action<ExtendedMod>)delegate(ExtendedMod bozorosExtended)
			{
				if (bozorosExtended.ExtendedLevels.Count > 0 && (Object)(object)bozorosExtended.ExtendedLevels[0] != (Object)null)
				{
					BozorosExtendedLevel = bozorosExtended.ExtendedLevels[0];
					BananaPeelOutside = ((IEnumerable<SpawnableOutsideObjectWithRarity>)BozorosExtendedLevel.SelectableLevel.spawnableOutsideObjects).FirstOrDefault((Func<SpawnableOutsideObjectWithRarity, bool>)delegate(SpawnableOutsideObjectWithRarity outsideObject)
					{
						SpawnableOutsideObject spawnableObject = outsideObject.spawnableObject;
						object strA;
						if (spawnableObject == null)
						{
							strA = null;
						}
						else
						{
							GameObject prefabToSpawn2 = spawnableObject.prefabToSpawn;
							strA = ((prefabToSpawn2 != null) ? ((Object)prefabToSpawn2).name : null);
						}
						return string.CompareOrdinal((string?)strA, "BananaPeelSpawn") == 0;
					});
				}
				else if ((Object)(object)BozorosExtendedLevel == (Object)null)
				{
					StaticLogger.LogError((object)"Could not load Bozoros... ExtendedLevel not found!");
				}
				if (bozorosExtended.ExtendedDungeonFlows.Count > 0 && (Object)(object)bozorosExtended.ExtendedDungeonFlows[0] != (Object)null)
				{
					CircusFacilityExtendedDungeon = bozorosExtended.ExtendedDungeonFlows[0];
					BananaPeelInside = ((IEnumerable<SpawnableMapObject>)CircusFacilityExtendedDungeon.SpawnableMapObjects).FirstOrDefault((Func<SpawnableMapObject, bool>)delegate(SpawnableMapObject hazard)
					{
						GameObject prefabToSpawn = hazard.prefabToSpawn;
						return string.CompareOrdinal((prefabToSpawn != null) ? ((Object)prefabToSpawn).name : null, "BananaPeel") == 0;
					});
					SpawnableMapObject? bananaPeelInside = BananaPeelInside;
					if (bananaPeelInside != null)
					{
						Transform obj = bananaPeelInside.prefabToSpawn.transform.Find("BananaLauncher");
						PlayerLauncher playerLauncher = default(PlayerLauncher);
						if (((obj != null) ? new bool?(((Component)obj).TryGetComponent<PlayerLauncher>(ref playerLauncher)) : null).GetValueOrDefault())
						{
							playerLauncher.dropHeldItemAtStart = Settings.BANANA_DROPS_ITEMS.Value < BananaPeelDropLevel.NoItems;
							playerLauncher.dropPlayerItemsAtEnd = Settings.BANANA_DROPS_ITEMS.Value < BananaPeelDropLevel.HeldItem;
							LethalLevelLoaderNetworkManager.RegisterNetworkPrefab(BananaPeelInside.prefabToSpawn);
						}
					}
					SpawnableOutsideObjectWithRarity? bananaPeelOutside = BananaPeelOutside;
					SummoningJutsu summoningJutsu = default(SummoningJutsu);
					if (bananaPeelOutside != null && bananaPeelOutside.spawnableObject.prefabToSpawn.TryGetComponent<SummoningJutsu>(ref summoningJutsu))
					{
						SpawnableMapObject? bananaPeelInside2 = BananaPeelInside;
						NetworkObject spawnPrefab = default(NetworkObject);
						if (bananaPeelInside2 != null && bananaPeelInside2.prefabToSpawn.TryGetComponent<NetworkObject>(ref spawnPrefab))
						{
							summoningJutsu.spawnPrefab = spawnPrefab;
						}
					}
				}
				else if ((Object)(object)CircusFacilityExtendedDungeon == (Object)null)
				{
					StaticLogger.LogError((object)"Could not load CircusFacility... ExtendedDungeonFlow not found!");
				}
			}, "LethalMatt", "Bozoros");
			AssetBundleLoader.AddOnLethalBundleLoadedListener((Action<AssetBundle>)delegate(AssetBundle assetBundle)
			{
				BozorosBundle = assetBundle;
				GrabbableBalloon = assetBundle.LoadAsset<GameObject>("GrabbableBalloon.prefab");
				if ((Object)(object)GrabbableBalloon != (Object)null)
				{
					LethalLevelLoaderNetworkManager.RegisterNetworkPrefab(GrabbableBalloon);
				}
				SnozorosEnabler.IcyLakePrefab = assetBundle.LoadAsset<GameObject>("Ice_Pond.prefab");
				if ((Object)(object)SnozorosEnabler.IcyLakePrefab != (Object)null)
				{
					LethalLevelLoaderNetworkManager.RegisterNetworkPrefab(SnozorosEnabler.IcyLakePrefab);
				}
			}, "bozoros.lethalbundle");
			if (EnemySkinRegistryCompatibility.Enabled)
			{
				EnemySkinRegistryCompatibility.LoadSkins();
				EnemySkinRegistryCompatibility.RegisterSkins();
			}
			if (MimicsCompatibility.Enabled)
			{
				MimicsCompatibility.RegisterCircusMimic();
			}
			if (Settings.CIRCUS_PANDORAMUS_PORTAL.Value)
			{
				PandoramusCompatibility.RegisterCompat();
			}
			if (Settings.CIRCUS_STARLANCERZERO_DOOR.Value)
			{
				StarlancerZeroCompatibility.RegisterCompat();
			}
		}

		private static void NetcodePatcher()
		{
			Type[] array;
			try
			{
				array = Assembly.GetExecutingAssembly().GetTypes();
			}
			catch (ReflectionTypeLoadException ex)
			{
				array = ex.Types.Where((Type type) => type != null).ToArray();
			}
			Type[] array2 = array;
			foreach (Type type2 in array2)
			{
				MethodInfo[] methods = type2.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				foreach (MethodInfo methodInfo in methods)
				{
					if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}
	}
}
namespace Bozoros.Skins
{
	internal class CircusMimic : MimicEventHandler
	{
		public static GameObject? CircusMimicPrefab { get; internal set; }

		public override string ModGUID => "LethalMatt.Bozoros";

		public override bool IsMyInteriorLoaded
		{
			get
			{
				ExtendedDungeonFlow? circusFacilityExtendedDungeon = Plugin.CircusFacilityExtendedDungeon;
				return circusFacilityExtendedDungeon != null && circusFacilityExtendedDungeon.IsCurrentDungeon;
			}
		}

		public override int Priority => 100;

		public override bool OverrideDefaultImperfectionCreation(MimicDoor mimicDoor, Doorway doorway)
		{
			return false;
		}

		public override void OnMimicCreated(MimicDoor mimicDoor, Doorway doorway)
		{
			//IL_0067: 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_0091: 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)
			((MimicEventHandler)this).OnMimicCreated(mimicDoor, doorway);
			if (!((Object)(object)CircusMimicPrefab == (Object)null))
			{
				Object.Instantiate<GameObject>(CircusMimicPrefab, ((Component)mimicDoor).transform);
				Transform obj = ((Component)mimicDoor).transform.Find("Armature/Frame");
				GameObject val = ((obj != null) ? ((Component)obj).gameObject : null);
				if (val != null)
				{
					val.transform.SetLocalPositionAndRotation(new Vector3(0f, -0.65f, 0f), Quaternion.Euler(new Vector3(90f, 0f, 0f)));
				}
				((Component)mimicDoor).transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity);
				Transform obj2 = ((Component)mimicDoor).transform.Find("Armature/Door");
				if (obj2 != null)
				{
					((Component)obj2).gameObject.SetActive(false);
				}
				Transform obj3 = ((Component)mimicDoor).transform.Find("Light");
				if (obj3 != null)
				{
					((Component)obj3).gameObject.SetActive(false);
				}
			}
		}

		public override void OnMimicCreateImperfections(MimicDoor mimicDoor)
		{
			((MimicEventHandler)this).OnMimicCreateImperfections(mimicDoor);
		}

		public override void OnMimicAttackStart(MimicDoor mimicDoor, PlayerControllerB playerToAttack)
		{
			((MimicEventHandler)this).OnMimicAttackStart(mimicDoor, playerToAttack);
			Transform obj = ((Component)mimicDoor).transform.Find("CircusWallDoorMimic(Clone)");
			if (obj != null)
			{
				Transform child = obj.GetChild(0);
				Animator val = default(Animator);
				if (((child != null) ? new bool?(((Component)child.GetChild(1)).TryGetComponent<Animator>(ref val)) : null).GetValueOrDefault())
				{
					val.SetTrigger("Attack");
				}
			}
		}

		public override void OnMimicAttackEnd(MimicDoor mimicDoor)
		{
			((MimicEventHandler)this).OnMimicAttackEnd(mimicDoor);
		}
	}
	internal class ClownGiant : Skin, Skinner
	{
		public string Label => "Clown Giant";

		public string Id => "LethalMatt.Bozoros.ClownGiant";

		public string EnemyId => "LethalCompany.ForestKeeper";

		public Texture2D Icon => EnemySkinRegistryCompatibility.BozorosIcon ?? Texture2D.blackTexture;

		public static Material? ClownGiantMaterial { get; internal set; }

		public static GameObject? ClownHair { get; internal set; }

		public static GameObject? ClownNose { get; internal set; }

		public static List<string> ClownGiantNames { get; internal set; } = new List<string>();


		public static Random? Random { get; internal set; }

		public Skinner CreateSkinner()
		{
			return (Skinner)(object)new ClownGiant();
		}

		public void Apply(GameObject enemy)
		{
			if (Random != null && ClownGiantNames.Count > 0)
			{
				Transform child = enemy.transform.GetChild(1);
				ScanNodeProperties val = default(ScanNodeProperties);
				if (child != null && ((Component)child).TryGetComponent<ScanNodeProperties>(ref val))
				{
					val.headerText = ClownGiantNames[Random.Next(0, ClownGiantNames.Count)] ?? "";
					val.subText = "Clown Giant";
				}
			}
			Transform val2 = enemy.transform.Find("FGiantModelContainer");
			SkinnedMeshRenderer val3 = default(SkinnedMeshRenderer);
			for (int i = 0; i < 3; i++)
			{
				if (val2 != null)
				{
					Transform child2 = val2.GetChild(i);
					if (((child2 != null) ? new bool?(((Component)child2).TryGetComponent<SkinnedMeshRenderer>(ref val3)) : null).GetValueOrDefault())
					{
						((Renderer)val3).sharedMaterial = ClownGiantMaterial;
					}
				}
			}
			Transform val4 = ((val2 != null) ? val2.Find("AnimContainer/metarig/spine/spine.003") : null);
			Object.Instantiate<GameObject>(ClownHair, val4);
			Object.Instantiate<GameObject>(ClownNose, val4);
		}

		public void Remove(GameObject enemy)
		{
		}
	}
	internal class GoofyPuffer : Skin, Skinner
	{
		public string Label => "Goofy Puffer";

		public string Id => "LethalMatt.Bozoros.GoofyPuffer";

		public string EnemyId => "LethalCompany.SporeLizard";

		public Texture2D Icon => EnemySkinRegistryCompatibility.BozorosIcon ?? Texture2D.blackTexture;

		public static Material? GoofyPufferMaterial { get; internal set; }

		public static List<string> GoofyPufferNames { get; internal set; } = new List<string>();


		public static Random? Random { get; internal set; }

		public Skinner CreateSkinner()
		{
			return (Skinner)(object)new GoofyPuffer();
		}

		public void Apply(GameObject enemy)
		{
			if (Random != null && GoofyPufferNames.Count > 0)
			{
				Transform child = enemy.transform.GetChild(1);
				ScanNodeProperties val = default(ScanNodeProperties);
				if (child != null && ((Component)child).TryGetComponent<ScanNodeProperties>(ref val))
				{
					val.headerText = GoofyPufferNames[Random.Next(0, GoofyPufferNames.Count)] ?? "";
					val.subText = "Goofy Puffer";
				}
			}
			Transform obj = enemy.transform.Find("PufferModel/BezierCurve");
			SkinnedMeshRenderer val2 = default(SkinnedMeshRenderer);
			if (obj != null && ((Component)obj).TryGetComponent<SkinnedMeshRenderer>(ref val2))
			{
				((Renderer)val2).sharedMaterial = GoofyPufferMaterial;
			}
		}

		public void Remove(GameObject enemy)
		{
		}
	}
	internal class SantaButler : Skin, Skinner, ButlerEventHandler, EnemyEventHandler
	{
		public string Label => "Santa Butler";

		public string Id => "LethalMatt.Bozoros.SantaButler";

		public string EnemyId => "LethalCompany.Butler";

		public Texture2D Icon => EnemySkinRegistryCompatibility.BozorosIcon ?? Texture2D.blackTexture;

		public static Mesh? CandyCaneMesh { get; internal set; }

		public static Material? CandyCaneMaterial { get; internal set; }

		public static GameObject? CandyCaneKnife { get; internal set; }

		public static Material? SantaMaterial { get; internal set; }

		public static GameObject? SantaHat { get; internal set; }

		public static Texture2D? GrinchHornetsTexture { get; internal set; }

		public static List<string> SantaButlerNames { get; internal set; } = new List<string>();


		public static Random? Random { get; internal set; }

		public Skinner CreateSkinner()
		{
			return (Skinner)(object)new SantaButler();
		}

		public void Apply(GameObject enemy)
		{
			ButlerEnemyAI val = default(ButlerEnemyAI);
			if (!enemy.TryGetComponent<ButlerEnemyAI>(ref val) || string.CompareOrdinal(((Object)val).name.Substring(0, 4), "Ross") == 0)
			{
				return;
			}
			ScanNodeProperties val2 = default(ScanNodeProperties);
			if (Random != null && SantaButlerNames.Count > 0 && ((Component)((Component)val).transform.Find("ScanNode")).TryGetComponent<ScanNodeProperties>(ref val2))
			{
				val2.headerText = SantaButlerNames[Random.Next(0, SantaButlerNames.Count)] ?? "";
				val2.subText = "Santa Butler";
			}
			Transform val3 = ((Component)val).transform.Find("MeshContainer");
			SkinnedMeshRenderer val4 = default(SkinnedMeshRenderer);
			for (int i = 0; i < 3; i++)
			{
				if (val3 != null)
				{
					Transform child = val3.GetChild(i);
					if (((child != null) ? new bool?(((Component)child).TryGetComponent<SkinnedMeshRenderer>(ref val4)) : null).GetValueOrDefault())
					{
						((Renderer)val4).sharedMaterial = SantaMaterial;
					}
				}
			}
			Transform val5 = ((val3 != null) ? val3.Find("Rig 1/Arms/RightArm/upperRightArmContainer/upper_arm.R_target/Knife") : null);
			MeshFilter val6 = default(MeshFilter);
			MeshRenderer val7 = default(MeshRenderer);
			if (val5 != null && ((Component)val5).TryGetComponent<MeshFilter>(ref val6) && ((Component)val5).TryGetComponent<MeshRenderer>(ref val7))
			{
				val6.sharedMesh = CandyCaneMesh;
				((Renderer)val7).sharedMaterial = CandyCaneMaterial;
			}
			if ((Object)(object)CandyCaneKnife != (Object)null)
			{
				Transform obj = ((Component)val).transform.Find("BloodStabParticle");
				Object.Destroy((Object)(object)((obj != null) ? ((Component)obj).gameObject : null));
				GameObject val8 = Object.Instantiate<GameObject>(((Component)CandyCaneKnife.transform.GetChild(2)).gameObject, ((Component)val).transform, false);
				val.stabBloodParticle = val8.GetComponent<ParticleSystem>();
				val.knifePrefab = CandyCaneKnife;
			}
			Transform val9 = ((val3 != null) ? val3.Find("metarig/spine/spine.001/NeckContainer/spine.004/face") : null);
			if ((Object)(object)val9 != (Object)null)
			{
				Object.Instantiate<GameObject>(SantaHat, val9);
			}
			EnemySkinRegistry.RegisterEnemyEventHandler((EnemyAI)(object)val, (EnemyEventHandler)(object)this);
		}

		public void OnSpawnHornets(ButlerEnemyAI instance, ButlerBeesEnemyAI hornets)
		{
			if (string.CompareOrdinal(((Object)instance).name.Substring(0, 4), "Ross") != 0)
			{
				Transform child = ((Component)hornets).transform.GetChild(0);
				ScanNodeProperties val = default(ScanNodeProperties);
				if (child != null && ((Component)child).TryGetComponent<ScanNodeProperties>(ref val))
				{
					val.headerText = "Grinch Particles";
				}
				VisualEffect val2 = default(VisualEffect);
				if ((Object)(object)GrinchHornetsTexture != (Object)null && ((Component)((Component)hornets).transform.Find("BugSwarmParticle")).TryGetComponent<VisualEffect>(ref val2))
				{
					val2.SetTexture("BugTexture", (Texture)(object)GrinchHornetsTexture);
				}
			}
		}

		public void Remove(GameObject enemy)
		{
		}
	}
}
namespace Bozoros.Patches
{
	[HarmonyPatch(typeof(RoundManager), "SpawnMapObjects")]
	[HarmonyPriority(100)]
	internal class BananaPeelInsidePatch
	{
		[HarmonyPrefix]
		private static void SpawnMapObjectsPre(RoundManager __instance, out Keyframe[] __state)
		{
			__state = Array.Empty<Keyframe>();
			float value = Plugin.Settings.BANANA_MULTIPLIER_INSIDE.Value;
			if (!((NetworkBehaviour)__instance).IsHost || Plugin.BananaPeelInside == null)
			{
				return;
			}
			__state = Plugin.BananaPeelInside.numberToSpawn.keys;
			ExtendedDungeonFlow? circusFacilityExtendedDungeon = Plugin.CircusFacilityExtendedDungeon;
			if (circusFacilityExtendedDungeon != null && circusFacilityExtendedDungeon.IsCurrentDungeon)
			{
				if (value != 1f)
				{
					Keyframe[] keys = Plugin.BananaPeelInside.numberToSpawn.keys;
					for (int i = 0; i < keys.Length; i++)
					{
						ref Keyframe reference = ref keys[i];
						((Keyframe)(ref reference)).value = ((Keyframe)(ref reference)).value * value;
					}
					Plugin.BananaPeelInside.numberToSpawn.keys = keys;
				}
				return;
			}
			ExtendedLevel? bozorosExtendedLevel = Plugin.BozorosExtendedLevel;
			if (bozorosExtendedLevel == null || !bozorosExtendedLevel.IsCurrentLevel)
			{
				return;
			}
			List<SpawnableMapObject> list = __instance.currentLevel.spawnableMapObjects.ToList();
			if (list.Contains(Plugin.BananaPeelInside))
			{
				return;
			}
			SelectableLevel currentLevel = __instance.currentLevel;
			List<SpawnableMapObject> list2 = list;
			int num = 0;
			SpawnableMapObject[] array = (SpawnableMapObject[])(object)new SpawnableMapObject[1 + list2.Count];
			foreach (SpawnableMapObject item in list2)
			{
				array[num] = item;
				num++;
			}
			array[num] = Plugin.BananaPeelInside;
			currentLevel.spawnableMapObjects = array;
			if ((Object)(object)__instance.dungeonGenerator?.Root != (Object)null)
			{
				RandomMapObject[] componentsInChildren = __instance.dungeonGenerator.Root.GetComponentsInChildren<RandomMapObject>();
				RandomMapObject[] array2 = componentsInChildren;
				foreach (RandomMapObject val in array2)
				{
					val.spawnablePrefabs.Add(Plugin.BananaPeelInside.prefabToSpawn);
				}
			}
		}

		[HarmonyPostfix]
		private static void SpawnMapObjectsPost(RoundManager __instance, Keyframe[] __state)
		{
			if (!((NetworkBehaviour)__instance).IsHost || Plugin.BananaPeelInside == null)
			{
				return;
			}
			ExtendedDungeonFlow? circusFacilityExtendedDungeon = Plugin.CircusFacilityExtendedDungeon;
			if (circusFacilityExtendedDungeon != null && circusFacilityExtendedDungeon.IsCurrentDungeon)
			{
				if (Plugin.Settings.BANANA_MULTIPLIER_INSIDE.Value != 1f)
				{
					Plugin.BananaPeelInside.numberToSpawn.keys = __state;
				}
				return;
			}
			ExtendedLevel? bozorosExtendedLevel = Plugin.BozorosExtendedLevel;
			if (bozorosExtendedLevel != null && bozorosExtendedLevel.IsCurrentLevel)
			{
				List<SpawnableMapObject> list = __instance.currentLevel.spawnableMapObjects.ToList();
				if (list.Remove(Plugin.BananaPeelInside))
				{
					__instance.currentLevel.spawnableMapObjects = list.ToArray();
				}
			}
		}
	}
	[HarmonyPatch]
	internal class LoadPatch
	{
		public static bool FirstLoad { get; private set; } = true;


		public static event Action? OnFinishGeneratingLevelPost;

		public static event Action? OnFinishGeneratingNewLevelClientRpcPost;

		[HarmonyPatch(typeof(RoundManager), "FinishGeneratingLevel")]
		[HarmonyPostfix]
		private static void FinishGeneratingLevelPost()
		{
			LoadPatch.OnFinishGeneratingLevelPost?.Invoke();
		}

		[HarmonyPatch(typeof(RoundManager), "FinishGeneratingNewLevelClientRpc")]
		[HarmonyPostfix]
		private static void FinishGeneratingNewLevelClientRpcPost()
		{
			LoadPatch.OnFinishGeneratingNewLevelClientRpcPost?.Invoke();
		}

		[HarmonyPatch(typeof(MenuManager), "Start")]
		[HarmonyPrefix]
		private static void MenuManagerStartPre()
		{
			if (FirstLoad)
			{
				FirstLoad = false;
				if (CrowdControlCompatibility.Enabled)
				{
					Plugin.Harmony.PatchAll(typeof(CrowdControlCompatibility));
				}
				if (LethalElementsCompatibility.Enabled)
				{
					LethalElementsCompatibility.RegisterSnozoros();
				}
			}
		}
	}
	[HarmonyPatch]
	internal class PopcornNestPatch
	{
		public static List<Nest> AvailableNestLocations { get; internal set; } = new List<Nest>();


		public static PopcornNests? PopcornNestsInstance { get; internal set; } = null;


		[HarmonyPatch(typeof(RedLocustBees), "Start")]
		[HarmonyPostfix]
		private static void RelocateNest(RedLocustBees __instance, GrabbableObject ___hive)
		{
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			ExtendedLevel? bozorosExtendedLevel = Plugin.BozorosExtendedLevel;
			if (bozorosExtendedLevel == null || !bozorosExtendedLevel.IsCurrentLevel)
			{
				return;
			}
			Transform child = ((Component)__instance).transform.GetChild(0);
			ScanNodeProperties val = default(ScanNodeProperties);
			if (child != null && ((Component)child).TryGetComponent<ScanNodeProperties>(ref val))
			{
				val.headerText = "Kernel Guardians";
			}
			if (___hive != null)
			{
				Transform child2 = ((Component)___hive).transform.GetChild(0);
				ScanNodeProperties val2 = default(ScanNodeProperties);
				if (((child2 != null) ? new bool?(((Component)child2).TryGetComponent<ScanNodeProperties>(ref val2)) : null).GetValueOrDefault())
				{
					val2.headerText = "...Popcorn?";
				}
			}
			NetworkObject val3 = default(NetworkObject);
			NetworkObject val4 = default(NetworkObject);
			if (((NetworkBehaviour)__instance).IsHost && !((Object)(object)___hive == (Object)null) && ((Component)___hive).TryGetComponent<NetworkObject>(ref val3) && ((Component)__instance).TryGetComponent<NetworkObject>(ref val4))
			{
				PopcornNestsInstance?.RelocateNestServerRpc(NetworkObjectReference.op_Implicit(val3), NetworkObjectReference.op_Implicit(val4));
			}
		}
	}
}
namespace Bozoros.Compatibility
{
	[HarmonyPatch]
	internal class CrowdControlCompatibility
	{
		private static bool? _enabled;

		public static bool Enabled
		{
			get
			{
				bool valueOrDefault = _enabled.GetValueOrDefault();
				if (!_enabled.HasValue)
				{
					valueOrDefault = Chainloader.PluginInfos.ContainsKey("WarpWorld.CrowdControl");
					_enabled = valueOrDefault;
				}
				return _enabled.Value;
			}
		}

		public static LevelWeatherType CurrentWeather { get; internal set; }

		public static event Action<string, string>? OnCCWeatherChanged;

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		[HarmonyPatch(typeof(TestMod), "CrowdControlCommands")]
		[HarmonyPostfix]
		internal static void CCWeatherCheck()
		{
			//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_002f: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			if (TimeOfDay.Instance.currentLevel.currentWeather != CurrentWeather)
			{
				CrowdControlCompatibility.OnCCWeatherChanged?.Invoke($"{CurrentWeather}", $"{TimeOfDay.Instance.currentLevel.currentWeather}");
				CurrentWeather = TimeOfDay.Instance.currentLevelWeather;
			}
		}
	}
	internal class EnemySkinRegistryCompatibility
	{
		private static bool? _enabled;

		public static Texture2D? BozorosIcon { get; private set; }

		public static bool Enabled
		{
			get
			{
				bool valueOrDefault = _enabled.GetValueOrDefault();
				if (!_enabled.HasValue)
				{
					valueOrDefault = Chainloader.PluginInfos.ContainsKey("antlershed.lethalcompany.enemyskinregistry");
					_enabled = valueOrDefault;
				}
				return _enabled.Value;
			}
		}

		internal static void LoadSkins()
		{
			AssetBundleLoader.AddOnLethalBundleLoadedListener((Action<AssetBundle>)delegate(AssetBundle assetBundle)
			{
				BozorosIcon = assetBundle.LoadAsset<Texture2D>("BozorosIcon.png");
				GoofyPuffer.GoofyPufferMaterial = assetBundle.LoadAsset<Material>("GoofyPufferMat.mat");
				ClownGiant.ClownGiantMaterial = assetBundle.LoadAsset<Material>("ClownGiantMat.mat");
				ClownGiant.ClownHair = assetBundle.LoadAsset<GameObject>("ClownHair.prefab");
				ClownGiant.ClownNose = assetBundle.LoadAsset<GameObject>("ClownNose.prefab");
				SantaButler.CandyCaneMesh = assetBundle.LoadAsset<Mesh>("Xmas_CandyCane_Knife.fbx");
				SantaButler.CandyCaneMaterial = assetBundle.LoadAsset<Material>("CandyCaneMat.mat");
				SantaButler.CandyCaneKnife = assetBundle.LoadAsset<GameObject>("CandyCaneKnife.prefab");
				SantaButler.SantaMaterial = assetBundle.LoadAsset<Material>("Xmas_SantaMat.mat");
				SantaButler.SantaHat = assetBundle.LoadAsset<GameObject>("Xmas_SantaHat.prefab");
				SantaButler.GrinchHornetsTexture = assetBundle.LoadAsset<Texture2D>("Xmas_GrinchHornets.png");
			}, "bozoros.lethalbundle");
			if (Plugin.Settings.GOOFY_PUFFER_NAMES.Value.Length > 0)
			{
				GoofyPuffer.GoofyPufferNames = Plugin.Settings.GOOFY_PUFFER_NAMES.Value.Split(',').ToList();
				LoadPatch.OnFinishGeneratingLevelPost += delegate
				{
					GoofyPuffer.Random = new Random(StartOfRound.Instance.randomMapSeed + 1);
				};
			}
			if (Plugin.Settings.CLOWN_GIANT_NAMES.Value.Length > 0)
			{
				ClownGiant.ClownGiantNames = Plugin.Settings.CLOWN_GIANT_NAMES.Value.Split(',').ToList();
				LoadPatch.OnFinishGeneratingLevelPost += delegate
				{
					ClownGiant.Random = new Random(StartOfRound.Instance.randomMapSeed + 2);
				};
			}
			if (Plugin.Settings.SANTA_BUTLER_NAMES.Value.Length > 0)
			{
				SantaButler.SantaButlerNames = Plugin.Settings.SANTA_BUTLER_NAMES.Value.Split(',').ToList();
				LoadPatch.OnFinishGeneratingLevelPost += delegate
				{
					SantaButler.Random = new Random(StartOfRound.Instance.randomMapSeed + 3);
				};
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		internal static void RegisterSkins()
		{
			//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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			EnemySkinRegistry.RegisterSkin((Skin)(object)new GoofyPuffer(), (DefaultSkinConfigData?)new DefaultSkinConfigData((DefaultSkinConfigEntry[])(object)new DefaultSkinConfigEntry[2]
			{
				new DefaultSkinConfigEntry("circus", 1f),
				new DefaultSkinConfigEntry("fun", 1f)
			}, 0f, 0f));
			EnemySkinRegistry.RegisterSkin((Skin)(object)new ClownGiant(), (DefaultSkinConfigData?)new DefaultSkinConfigData((DefaultSkinConfigEntry[])(object)new DefaultSkinConfigEntry[2]
			{
				new DefaultSkinConfigEntry("circus", 1f),
				new DefaultSkinConfigEntry("fun", 1f)
			}, 0f, 0f));
			EnemySkinRegistry.RegisterSkin((Skin)(object)new SantaButler(), (DefaultSkinConfigData?)new DefaultSkinConfigData((DefaultSkinConfigEntry[])(object)new DefaultSkinConfigEntry[1]
			{
				new DefaultSkinConfigEntry("jolly", 1f)
			}, 0f, 0f));
		}
	}
	internal class LethalElementsCompatibility
	{
		private static bool? _enabled;

		public static bool Enabled
		{
			get
			{
				bool valueOrDefault = _enabled.GetValueOrDefault();
				if (!_enabled.HasValue)
				{
					valueOrDefault = Chainloader.PluginInfos.ContainsKey("voxx.LethalElementsPlugin");
					_enabled = valueOrDefault;
				}
				return _enabled.Value;
			}
		}

		internal static void RegisterSnozoros()
		{
			ExtendedLevel? bozorosExtendedLevel = Plugin.BozorosExtendedLevel;
			if (bozorosExtendedLevel == null)
			{
				return;
			}
			bozorosExtendedLevel.LevelEvents.onLevelLoaded.AddListener((Action)delegate
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				SelectableLevel selectableLevel = Plugin.BozorosExtendedLevel.SelectableLevel;
				string text = $"{selectableLevel.currentWeather}";
				if (text.Contains("Snowfall") || text.Contains("Blizzard"))
				{
					SpawnableOutsideObjectWithRarity[] spawnableOutsideObjects = selectableLevel.spawnableOutsideObjects;
					foreach (SpawnableOutsideObjectWithRarity val in spawnableOutsideObjects)
					{
						SpawnableOutsideObject spawnableObject = val.spawnableObject;
						if (spawnableObject != null && ((Object)spawnableObject).name.Contains("Snowman"))
						{
							val.randomAmount = AnimationCurve.Linear(0f, 1f, 1f, 5f);
						}
					}
					selectableLevel.levelIncludesSnowFootprints = true;
				}
			});
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		internal static void PoisonLake(QuicksandTrigger waterTrigger)
		{
			((Component)waterTrigger).gameObject.AddComponent<ToxicFumes>();
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		internal static void SubscribeToSnow(Action<bool> snowAction, bool unsubscribe = false)
		{
			if ((Object)(object)LevelManipulator.Instance != (Object)null)
			{
				if (!unsubscribe)
				{
					LevelManipulator.Instance.OnSnowReady += snowAction;
				}
				else
				{
					LevelManipulator.Instance.OnSnowReady -= snowAction;
				}
			}
		}
	}
	internal class MimicsCompatibility
	{
		private static bool? _enabled;

		public static bool Enabled
		{
			get
			{
				bool valueOrDefault = _enabled.GetValueOrDefault();
				if (!_enabled.HasValue)
				{
					valueOrDefault = Chainloader.PluginInfos.ContainsKey("x753.Mimics");
					_enabled = valueOrDefault;
				}
				return _enabled.Value;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		internal static void RegisterCircusMimic()
		{
			AssetBundleLoader.AddOnLethalBundleLoadedListener((Action<AssetBundle>)delegate(AssetBundle assetBundle)
			{
				CircusMimic.CircusMimicPrefab = assetBundle.LoadAsset<GameObject>("CircusWallDoorMimic.prefab");
			}, "bozoros.lethalbundle");
			if (Plugin.Settings.CIRCUS_FACILITY_MIMICS.Value && !Mimics.InteriorWhitelist.Contains("circusfacilityflow"))
			{
				Mimics.InteriorWhitelist.Add("circusfacilityflow");
			}
			MimicsAPI.GetAPI().RegisterMimicEventHandler((MimicEventHandler)(object)new CircusMimic());
		}
	}
	[HarmonyPatch]
	internal class WeatherRegistryCompatibility
	{
		private static bool? _enabled;

		public static bool Enabled
		{
			get
			{
				bool valueOrDefault = _enabled.GetValueOrDefault();
				if (!_enabled.HasValue)
				{
					valueOrDefault = Chainloader.PluginInfos.ContainsKey("mrov.WeatherRegistry");
					_enabled = valueOrDefault;
				}
				return _enabled.Value;
			}
		}

		public static event Action<LevelWeatherType[]>? OnWeatherEffectsApply;

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		[HarmonyPatch(typeof(WeatherEffectData), "ApplyWeatherEffects")]
		[HarmonyPostfix]
		internal static void ApplyWeatherEffectsPost(LevelWeatherType[] weatherType)
		{
			WeatherRegistryCompatibility.OnWeatherEffectsApply?.Invoke(weatherType);
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		internal static bool ApplyWeatherOverrides(Action<LevelWeatherType[]> weatherAction)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			if ((int)WeatherManager.GetCurrentLevelWeather().Type == 0)
			{
				return false;
			}
			OnWeatherEffectsApply += weatherAction;
			return true;
		}
	}
}
namespace Bozoros.Compatibility.Moons
{
	public class PandoramusCompatibility
	{
		public static bool Registered { get; private set; }

		public static ExtendedLevel? PandoramusLevel { get; internal set; }

		public static Material? PortalCircusFacility { get; internal set; }

		internal static void RegisterCompat()
		{
			AssetBundleLoader.AddOnExtendedModLoadedListener((Action<ExtendedMod>)delegate(ExtendedMod pandoramusExtended)
			{
				if (!Registered)
				{
					AssetBundle? bozorosBundle = Plugin.BozorosBundle;
					PortalCircusFacility = ((bozorosBundle != null) ? bozorosBundle.LoadAsset<Material>("Portal_CircusFacilityMat.mat") : null);
					if (pandoramusExtended.ExtendedLevels.Count > 1 && (Object)(object)pandoramusExtended.ExtendedLevels[1] != (Object)null)
					{
						PandoramusLevel = pandoramusExtended.ExtendedLevels[1];
						LoadPatch.OnFinishGeneratingNewLevelClientRpcPost += PortalSwitch;
						Registered = true;
					}
				}
			}, "DemonMae_PAN", "Pandoramus");
		}

		private static void PortalSwitch()
		{
			ExtendedLevel? pandoramusLevel = PandoramusLevel;
			if (pandoramusLevel == null || !pandoramusLevel.IsCurrentLevel)
			{
				return;
			}
			ExtendedDungeonFlow? circusFacilityExtendedDungeon = Plugin.CircusFacilityExtendedDungeon;
			if (circusFacilityExtendedDungeon == null || !circusFacilityExtendedDungeon.IsCurrentDungeon || !((Object)(object)PortalCircusFacility != (Object)null))
			{
				return;
			}
			GameObject mapPropsContainer = RoundManager.Instance.mapPropsContainer;
			if (mapPropsContainer != null)
			{
				Transform parent = mapPropsContainer.transform.GetParent();
				bool? obj;
				MeshRenderer val = default(MeshRenderer);
				if (parent == null)
				{
					obj = null;
				}
				else
				{
					Transform obj2 = parent.Find("PortalRing/PortalTexture");
					obj = ((obj2 != null) ? new bool?(((Component)obj2).TryGetComponent<MeshRenderer>(ref val)) : null);
				}
				bool? flag = obj;
				MaterialScroller materialScroller = default(MaterialScroller);
				if (flag.GetValueOrDefault() && !((Component)val).gameObject.TryGetComponent<MaterialScroller>(ref materialScroller))
				{
					MaterialScroller materialScroller2 = ((Component)val).gameObject.AddComponent<MaterialScroller>();
					materialScroller2.ScrollingMat = PortalCircusFacility;
					((Renderer)val).sharedMaterial = PortalCircusFacility;
				}
			}
		}
	}
	public class StarlancerZeroCompatibility
	{
		public static bool Registered { get; private set; }

		public static ExtendedLevel? StarlancerZeroLevel { get; internal set; }

		public static GameObject? CircusDoors { get; internal set; }

		internal static void RegisterCompat()
		{
			AssetBundleLoader.AddOnExtendedModLoadedListener((Action<ExtendedMod>)delegate(ExtendedMod starlancerExtended)
			{
				if (!Registered)
				{
					AssetBundle? bozorosBundle = Plugin.BozorosBundle;
					CircusDoors = ((bozorosBundle != null) ? bozorosBundle.LoadAsset<GameObject>("MainEntranceOnlyDoor.prefab") : null);
					if (starlancerExtended.ExtendedLevels.Count > 2 && (Object)(object)starlancerExtended.ExtendedLevels[2] != (Object)null)
					{
						StarlancerZeroLevel = starlancerExtended.ExtendedLevels[2];
						LoadPatch.OnFinishGeneratingLevelPost += DoorSwitch;
						Registered = true;
					}
				}
			}, "AudioKnight", "StarlancerMoons");
		}

		private static void DoorSwitch()
		{
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			ExtendedLevel? starlancerZeroLevel = StarlancerZeroLevel;
			if (starlancerZeroLevel == null || !starlancerZeroLevel.IsCurrentLevel)
			{
				return;
			}
			ExtendedDungeonFlow? circusFacilityExtendedDungeon = Plugin.CircusFacilityExtendedDungeon;
			if (circusFacilityExtendedDungeon == null || !circusFacilityExtendedDungeon.IsCurrentDungeon || !((Object)(object)CircusDoors != (Object)null))
			{
				return;
			}
			GameObject mapPropsContainer = RoundManager.Instance.mapPropsContainer;
			object obj;
			if (mapPropsContainer == null)
			{
				obj = null;
			}
			else
			{
				Transform parent = mapPropsContainer.transform.GetParent();
				if (parent == null)
				{
					obj = null;
				}
				else
				{
					Transform obj2 = parent.Find("Pyramid/Pyramid_Thin_Base/Desert_Pyramid_Medium/DoubleDoors");
					obj = ((obj2 != null) ? ((Component)obj2).gameObject : null);
				}
			}
			GameObject val = (GameObject)obj;
			if ((Object)(object)val != (Object)null)
			{
				GameObject val2 = Object.Instantiate<GameObject>(CircusDoors, val.transform.GetParent());
				Transform transform = val2.transform;
				transform.localPosition += new Vector3(0f, 3f, -0.1f);
				val2.transform.localScale = new Vector3(0.1323f, 2.9661f, 3.0816f);
				val.SetActive(false);
			}
		}
	}
}
namespace Bozoros.Behaviours
{
	public class ActivateApparatus : NetworkBehaviour
	{
		[CompilerGenerated]
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private static EnemyType? <OldBirdEnemyType>k__BackingField;

		public static EnemyType? OldBirdEnemyType
		{
			get
			{
				if ((Object)(object)<OldBirdEnemyType>k__BackingField == (Object)null)
				{
					OldBirdEnemyType = OriginalContent.Enemies.Find((EnemyType enemy) => string.CompareOrdinal(enemy.enemyName, "RadMech") == 0);
				}
				return <OldBirdEnemyType>k__BackingField;
			}
			[CompilerGenerated]
			private set
			{
				<OldBirdEnemyType>k__BackingField = value;
			}
		}

		private void Start()
		{
			if (((NetworkBehaviour)this).IsHost)
			{
				Activate();
			}
		}

		public override void OnNetworkSpawn()
		{
			if (!((NetworkBehaviour)this).IsHost)
			{
				Activate();
			}
			((NetworkBehaviour)this).OnNetworkSpawn();
		}

		public void Activate()
		{
			LungProp val = default(LungProp);
			AudioSource val2 = default(AudioSource);
			if (((Component)this).TryGetComponent<LungProp>(ref val) && !((GrabbableObject)val).isInShipRoom && ((Component)this).TryGetComponent<AudioSource>(ref val2))
			{
				val.isLungDocked = true;
				val.isLungPowered = true;
				val.radMechEnemyType = OldBirdEnemyType;
				val2.loop = true;
				val2.Play();
			}
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string? __getTypeName()
		{
			return "ActivateApparatus";
		}
	}
	public class AnimationVelocity : NetworkBehaviour
	{
		[Header("Animation Velocity")]
		[Tooltip("")]
		public Animator? animator;

		[Tooltip("")]
		public string initialState = "";

		[Tooltip("")]
		public string speedParameter = "";

		[Tooltip("")]
		public float minStartingSpeed = 1f;

		[Tooltip("")]
		public float maxStartingSpeed = 1f;

		[Tooltip("")]
		public float stoppingSpeed = 1f;

		public static Random? Random { get; internal set; }

		public float TransitionTimer { get; private set; } = 0f;


		public float PreviousTarget { get; private set; } = 0f;


		public float CurrentTarget { get; private set; } = 0f;


		public bool TargetReached { get; private set; } = true;


		public override void OnNetworkSpawn()
		{
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			((NetworkBehaviour)this).OnNetworkSpawn();
			if (((NetworkBehaviour)this).IsHost)
			{
				if (Random == null)
				{
					Random = new Random(StartOfRound.Instance.randomMapSeed + 33);
				}
				CurrentTarget = ((minStartingSpeed != maxStartingSpeed) ? ((float)Random.NextDouble() * (maxStartingSpeed - minStartingSpeed) + minStartingSpeed) : minStartingSpeed);
			}
			((UnityEvent)StartOfRound.Instance.StartNewRoundEvent).AddListener(new UnityAction(SyncSpeedServerRpc));
		}

		private void FixedUpdate()
		{
			if (!TargetReached)
			{
				TransitionTimer += Time.fixedDeltaTime;
				float num = Mathf.Lerp(PreviousTarget, CurrentTarget, TransitionTimer * stoppingSpeed);
				Animator? obj = animator;
				if (obj != null)
				{
					obj.SetFloat(speedParameter, num);
				}
				if (num == CurrentTarget)
				{
					TransitionTimer = 0f;
					TargetReached = true;
				}
			}
		}

		public override void OnDestroy()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			((UnityEvent)StartOfRound.Instance.StartNewRoundEvent).RemoveListener(new UnityAction(SyncSpeedServerRpc));
			Random = null;
			((NetworkBehaviour)this).OnDestroy();
		}

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

		[ServerRpc(RequireOwnership = false)]
		public void ChangeSpeedServerRpc(float targetSpeed)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1697518824u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref targetSpeed, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1697518824u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ChangeSpeedClientRpc(targetSpeed);
				}
			}
		}

		[ClientRpc]
		public void ChangeSpeedClientRpc(float targetSpeed)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(109528210u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref targetSpeed, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 109528210u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					PreviousTarget = CurrentTarget;
					CurrentTarget = targetSpeed;
					TransitionTimer = 0f;
					TargetReached = false;
				}
			}
		}

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

		[ClientRpc]
		public void SyncSpeedClientRpc(float currentSpeed)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1764847052u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref currentSpeed, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1764847052u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				PreviousTarget = currentSpeed;
				CurrentTarget = currentSpeed;
				TransitionTimer = 0f;
				TargetReached = true;
				Animator? obj = animator;
				if (obj != null)
				{
					obj.SetFloat(speedParameter, currentSpeed);
				}
				Animator? obj2 = animator;
				if (obj2 != null)
				{
					obj2.Play(initialState);
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_AnimationVelocity()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(1156739841u, new RpcReceiveHandler(__rpc_handler_1156739841));
			NetworkManager.__rpc_func_table.Add(1697518824u, new RpcReceiveHandler(__rpc_handler_1697518824));
			NetworkManager.__rpc_func_table.Add(109528210u, new RpcReceiveHandler(__rpc_handler_109528210));
			NetworkManager.__rpc_func_table.Add(4217936001u, new RpcReceiveHandler(__rpc_handler_4217936001));
			NetworkManager.__rpc_func_table.Add(1764847052u, new RpcReceiveHandler(__rpc_handler_1764847052));
		}

		private static void __rpc_handler_1156739841(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;
				((AnimationVelocity)(object)target).ResetSpeedServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1697518824(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				float targetSpeed = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref targetSpeed, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((AnimationVelocity)(object)target).ChangeSpeedServerRpc(targetSpeed);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_109528210(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				float targetSpeed = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref targetSpeed, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((AnimationVelocity)(object)target).ChangeSpeedClientRpc(targetSpeed);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4217936001(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;
				((AnimationVelocity)(object)target).SyncSpeedServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1764847052(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				float currentSpeed = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref currentSpeed, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((AnimationVelocity)(object)target).SyncSpeedClientRpc(currentSpeed);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string? __getTypeName()
		{
			return "AnimationVelocity";
		}
	}
	[Serializable]
	public struct BalloonStand
	{
		public InteractPurchasable? purchaseScript;

		public int variant;
	}
	public class ChangeSettings : NetworkBehaviour
	{
		public List<AudioSource> fireworkMusicVolume = new List<AudioSource>();

		public List<AudioSource> fireworkExplosionVolume = new List<AudioSource>();

		public List<AudioSource> announcerVolume = new List<AudioSource>();

		public List<AudioSource> tentMusicVolume = new List<AudioSource>();

		public List<AudioSource> dropshipVolume = new List<AudioSource>();

		public List<ParticleSystem> fireworkParticles = new List<ParticleSystem>();

		public List<ParticleSystem> confettiParticles = new List<ParticleSystem>();

		public List<ParticleSystem> balloonParticles = new List<ParticleSystem>();

		public AudioClip? fireworkMusicCopyrighted;

		public List<BalloonStand> balloonStands = new List<BalloonStand>();

		public EntranceTeleport? ferrisWheelExit;

		public ScanNodeProperties? shipScanNode;

		public ItemDropship? dropship;

		public ScanNodeProperties? dropshipScanNode;

		public static bool SeenBalloonInstructions { get; private set; }

		public Keyframe[]? BananaKeysOutside { get; internal set; }

		private void Awake()
		{
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Expected O, but got Unknown
			if (fireworkMusicVolume.Count > 0 && (Object)(object)fireworkMusicVolume[0] != (Object)null && !Plugin.Settings.STREAMER_FRIENDLY.Value)
			{
				fireworkMusicVolume[0].clip = fireworkMusicCopyrighted;
				fireworkMusicVolume[0].volume = 0.15f;
			}
			ApplyVolume(Plugin.Settings.FIREWORK_MUSIC_VOLUME.Value, fireworkMusicVolume);
			ApplyVolume(Plugin.Settings.FIREWORK_EXPLOSION_VOLUME.Value, fireworkExplosionVolume);
			ApplyVolume(Plugin.Settings.ANNOUNCER_VOLUME.Value, announcerVolume);
			ApplyVolume(Plugin.Settings.TENT_MUSIC_VOLUME.Value, tentMusicVolume);
			ApplyVolume(Plugin.Settings.DROPSHIP_VOLUME.Value, dropshipVolume);
			ApplyParticleIntensity(Plugin.Settings.FIREWORK_PARTICLES.Value, fireworkParticles, firework: true);
			ApplyParticleIntensity(Plugin.Settings.CONFETTI_PARTICLES.Value, confettiParticles);
			ApplyParticleIntensity(Plugin.Settings.BALLOON_PARTICLES.Value, balloonParticles);
			for (int i = 0; i < balloonStands.Count; i++)
			{
				InteractPurchasable stand = balloonStands[i].purchaseScript;
				int variant = balloonStands[i].variant;
				if ((Object)(object)stand == (Object)null)
				{
					continue;
				}
				stand.spawnPrefab = Plugin.GrabbableBalloon;
				UnityEvent? onPurchase = stand.onPurchase;
				if (onPurchase != null)
				{
					onPurchase.AddListener((UnityAction)delegate
					{
						GameObject? spawnPrefab = stand.spawnPrefab;
						GrabbablePlatform grabbablePlatform = default(GrabbablePlatform);
						if (spawnPrefab != null && spawnPrefab.TryGetComponent<GrabbablePlatform>(ref grabbablePlatform))
						{
							grabbablePlatform.SwitchVariant(variant);
						}
					});
				}
				stand.price = Plugin.Settings.BALLOON_PRICE.Value;
				((InteractTrigger)stand).hoverTip = ((InteractTrigger)stand).hoverTip.Replace("PRICE", $"{stand.price}");
				stand.purchaseNotification.AlreadySeen = SeenBalloonInstructions || !Plugin.Settings.BALLOON_INSTRUCTIONS.Value;
			}
			if ((Object)(object)shipScanNode != (Object)null)
			{
				shipScanNode.headerText = (Plugin.Settings.MODIFY_SHIP_NODE.Value ? "Clown Car" : "Ship");
			}
			if ((Object)(object)dropship != (Object)null && (Object)(object)dropshipScanNode != (Object)null)
			{
				((Component)dropshipScanNode).transform.SetParent(((Component)dropship).transform, false);
				((Component)dropshipScanNode).gameObject.SetActive(true);
			}
		}

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			if (!((NetworkBehaviour)this).IsHost)
			{
				return;
			}
			if (!Plugin.Settings.FERRIS_WHEEL_EXIT.Value)
			{
				DisableFerrisFireExitClientRpc();
			}
			float value = Plugin.Settings.BANANA_MULTIPLIER_OUTSIDE.Value;
			if (value != 1f && Plugin.BananaPeelOutside != null)
			{
				BananaKeysOutside = Plugin.BananaPeelOutside.randomAmount.keys;
				Keyframe[] keys = Plugin.BananaPeelOutside.randomAmount.keys;
				for (int i = 0; i < keys.Length; i++)
				{
					ref Keyframe reference = ref keys[i];
					((Keyframe)(ref reference)).value = ((Keyframe)(ref reference)).value * value;
				}
				Plugin.BananaPeelOutside.randomAmount.keys = keys;
			}
		}

		private void OnDisable()
		{
			if (BananaKeysOutside != null && Plugin.BananaPeelOutside != null)
			{
				Plugin.BananaPeelOutside.randomAmount.keys = BananaKeysOutside;
			}
			SoundManager.Instance.currentLevelAmbience = null;
		}

		[ClientRpc]
		private void DisableFerrisFireExitClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2846474551u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2846474551u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				EntranceTeleport? obj = ferrisWheelExit;
				if (obj != null)
				{
					((Component)((Component)obj).transform.GetParent()).gameObject.SetActive(false);
				}
			}
		}

		private void ApplyVolume(float value, List<AudioSource> audioSources)
		{
			foreach (AudioSource audioSource in audioSources)
			{
				audioSource.volume *= value;
			}
		}

		private void ApplyParticleIntensity(float multiplier, List<ParticleSystem> particleSystems, bool firework = false)
		{
			//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_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			foreach (ParticleSystem particleSystem in particleSystems)
			{
				EmissionModule emission = particleSystem.emission;
				((EmissionModule)(ref emission)).rateOverTimeMultiplier = ((EmissionModule)(ref emission)).rateOverTimeMultiplier * multiplier;
				particleSystem.Emit(0);
				if (!firework)
				{
					break;
				}
				ParticleSystem[] componentsInChildren = ((Component)((Component)particleSystem).transform).GetComponentsInChildren<ParticleSystem>();
				foreach (ParticleSystem val in componentsInChildren)
				{
					MainModule main = val.main;
					((MainModule)(ref main)).maxParticles = (int)((float)((MainModule)(ref main)).maxParticles * multiplier);
					EmissionModule emission2 = val.emission;
					((EmissionModule)(ref emission2)).rateOverTimeMultiplier = ((EmissionModule)(ref emission2)).rateOverTimeMultiplier * multiplier;
					for (int j = 0; j < ((EmissionModule)(ref emission2)).burstCount; j++)
					{
						Burst burst = ((EmissionModule)(ref emission2)).GetBurst(j);
						((Burst)(ref burst)).minCount = (short)((float)((Burst)(ref burst)).minCount * multiplier);
						((Burst)(ref burst)).maxCount = (short)((float)((Burst)(ref burst)).maxCount * multiplier);
					}
					val.Emit(0);
				}
			}
		}

		public void ToggleBalloonInstructions()
		{
			if (SeenBalloonInstructions)
			{
				return;
			}
			SeenBalloonInstructions = true;
			foreach (BalloonStand balloonStand in balloonStands)
			{
				balloonStand.purchaseScript?.purchaseNotification.SetNotificationSeen();
			}
		}

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

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

		private static void __rpc_handler_2846474551(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;
				((ChangeSettings)(object)target).DisableFerrisFireExitClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "ChangeSettings";
		}
	}
	public class GiftSpawner : NetworkBehaviour
	{
		[CompilerGenerated]
		private sealed class <ReplaceGiftOnSpawn>d__19 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public NetworkObjectReference giftReference;

			public int variant;

			public GiftSpawner <>4__this;

			private NetworkObject <giftNetworkObject>5__1;

			private float <startTime>5__2;

			private GiftBoxItem <gift>5__3;

			private MeshRenderer <giftRenderer>5__4;

			private ScanNodeProperties <scanNode>5__5;

			private int <randomScrap>5__6;

			private SpawnableItemWithRarity <item>5__7;

			object? IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object? IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <ReplaceGiftOnSpawn>d__19(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<giftNetworkObject>5__1 = null;
				<gift>5__3 = null;
				<giftRenderer>5__4 = null;
				<scanNode>5__5 = null;
				<item>5__7 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: Expected O, but got Unknown
				//IL_0089: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<startTime>5__2 = Time.realtimeSinceStartup;
					goto IL_005a;
				case 1:
					<>1__state = -1;
					goto IL_005a;
				case 2:
					{
						<>1__state = -1;
						if (((Component)<giftNetworkObject>5__1).TryGetComponent<GiftBoxItem>(ref <gift>5__3))
						{
							if (((Component)<gift>5__3).TryGetComponent<MeshRenderer>(ref <giftRenderer>5__4) && variant > -1)
							{
								((Renderer)<giftRenderer>5__4).sharedMaterial = <>4__this.giftMaterials[variant];
							}
							if (((Component)((Component)<gift>5__3).transform.GetChild(0)).TryGetComponent<ScanNodeProperties>(ref <scanNode>5__5))
							{
								<scanNode>5__5.nodeType = 0;
								<scanNode>5__5.headerText = "Gift from Santa";
								<scanNode>5__5.subText = "Value: ???";
								<scanNode>5__5.minRange = 0;
								<scanNode>5__5.maxRange = 40;
								<scanNode>5__5.requiresLineOfSight = false;
							}
							if (!((NetworkBehaviour)<>4__this).IsHost || Random == null)
							{
								return false;
							}
							if ((Object)(object)<>4__this.coalItem != (Object)null && (float)Random.Next(0, 100) < <>4__this.chanceForCoal * 100f)
							{
								<gift>5__3.objectInPresentItem = <>4__this.coalItem;
								<gift>5__3.objectInPresent = <>4__this.coalItem.spawnPrefab;
								<gift>5__3.objectInPresentValue = 1;
							}
							else
							{
								<randomScrap>5__6 = RoundManager.Instance.GetRandomWeightedIndexList(ScrapWeights, Random);
								<item>5__7 = RoundManager.Instance.currentLevel.spawnableScrap[<randomScrap>5__6];
								if ((Object)(object)<item>5__7?.spawnableItem != (Object)null)
								{
									<gift>5__3.objectInPresentItem = <item>5__7.spawnableItem;
								}
								else
								{
									Plugin.StaticLogger.LogWarning((object)$"Item at index {<randomScrap>5__6} has no spawn prefab. Spawning default gift item instead.");
								}
								<gift>5__3.objectInPresent = <gift>5__3.objectInPresentItem.spawnPrefab;
								<gift>5__3.objectInPresentValue = Math.Clamp((int)((float)Random.Next(<gift>5__3.objectInPresentItem.minValue, <gift>5__3.objectInPresentItem.maxValue) * RoundManager.Instance.scrapValueMultiplier), 0, 65);
								<item>5__7 = null;
							}
							<giftRenderer>5__4 = null;
							<scanNode>5__5 = null;
						}
						return false;
					}
					IL_005a:
					if (!((NetworkObjectReference)(ref giftReference)).TryGet(ref <giftNetworkObject>5__1, (NetworkManager)null) && Time.realtimeSinceStartup - <startTime>5__2 < 8f)
					{
						<>2__current = (object)new WaitForSeconds(0.03f);
						<>1__state = 1;
						return true;
					}
					<>2__current = (object)new WaitForEndOfFrame();
					<>1__state = 2;
					return true;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private static GameObject? <VanillaGiftbox>k__BackingField;

		public List<Transform> spawnLocations = new List<Transform>();

		public List<Material> giftMaterials = new List<Material>();

		public Item? coalItem;

		[Range(0f, 1f)]
		public float chanceForCoal = 0f;

		public static Random? Random { get; private set; }

		public static List<int> ScrapWeights { get; private set; } = new List<int>();


		public static GameObject? VanillaGiftbox
		{
			get
			{
				if ((Object)(object)<VanillaGiftbox>k__BackingField == (Object)null)
				{
					VanillaGiftbox = OriginalContent.Items.Find((Item item) => item.itemId == 152767)?.spawnPrefab;
				}
				return <VanillaGiftbox>k__BackingField;
			}
			[CompilerGenerated]
			private set
			{
				<VanillaGiftbox>k__BackingField = value;
			}
		}

		private void Awake()
		{
			Random = new Random(StartOfRound.Instance.randomMapSeed + 28);
			ScrapWeights = RoundManager.Instance.currentLevel.spawnableScrap.Select((SpawnableItemWithRarity item) => item.rarity).ToList();
		}

		public void SpawnGifts()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			if (!((NetworkBehaviour)this).IsHost || (Object)(object)VanillaGiftbox == (Object)null)
			{
				return;
			}
			GiftBoxItem val2 = default(GiftBoxItem);
			NetworkObject val3 = default(NetworkObject);
			foreach (Transform spawnLocation in spawnLocations)
			{
				GameObject val = Object.Instantiate<GameObject>(VanillaGiftbox, spawnLocation.position, spawnLocation.rotation, RoundManager.Instance.spawnedScrapContainer);
				if (val.TryGetComponent<GiftBoxItem>(ref val2) && ((Component)val2).TryGetComponent<NetworkObject>(ref val3))
				{
					val3.Spawn(false);
					ReplaceGiftClientRpc(NetworkObjectReference.op_Implicit(val3), Random?.Next(0, giftMaterials.Count) ?? (-1));
				}
			}
		}

		[ClientRpc]
		public void ReplaceGiftClientRpc(NetworkObjectReference giftReference, int variant)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1353726552u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref giftReference, default(ForNetworkSerializable));
					BytePacker.WriteValueBitPacked(val2, variant);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1353726552u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					((MonoBehaviour)this).StartCoroutine(ReplaceGiftOnSpawn(giftReference, variant));
				}
			}
		}

		[IteratorStateMachine(typeof(<ReplaceGiftOnSpawn>d__19))]
		private IEnumerator ReplaceGiftOnSpawn(NetworkObjectReference giftReference, int variant)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ReplaceGiftOnSpawn>d__19(0)
			{
				<>4__this = this,
				giftReference = giftReference,
				variant = variant
			};
		}

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

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

		private static void __rpc_handler_1353726552(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference giftReference = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref giftReference, default(ForNetworkSerializable));
				int variant = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref variant);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((GiftSpawner)(object)target).ReplaceGiftClientRpc(giftReference, variant);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string? __getTypeName()
		{
			return "GiftSpawner";
		}
	}
	public class GrabbablePlatform : PlayerAttachable
	{
		[Space(10f)]
		[Header("Grabbable Platform")]
		[Tooltip("Animator instance of the platform, used to play an animation once a player grabs the platform. Optional if already playing an animation, or the platform is stationary.")]
		public Animator? platformAnimator;

		[Tooltip("Name of the animation state to play once a player grabs the platform. Make sure to leave out any numbers at the end if using animation variants. Optional if already playing an animation, or the platform is stationary.")]
		public string stateName = "";

		[Tooltip("Value for the animation variant to play when the player attaches, which is appended to 'stateName'. Should only be updated in the editor, or in-game before spawning the platform. Leaving it at '-1' disables animation variants.")]
		public int stateVariant = -1;

		[Tooltip("An offset to apply to the player's position while grabbing on to the platform.")]
		public Vector3 playerOffset = Vector3.zero;

		[Header("Controls")]
		[Tooltip("Key required to be held for the player to hang on to the platform. See 'UnityEngine.InputSystem.Key' for number values. Leaving it at '-1' allows players to remain attached without holding anything, until being detached through other means (e.g. 'detachTimer').")]
		public string actionToHold = "";

		[Tooltip("Allow players to carry two-handed items while grabbing on to the platform.")]
		public bool allowTwoHanded = false;

		[Header("Detach")]
		[Tooltip("Detach the player if an enemy collides with the platform.")]
		public bool detachOnEnemyCollision = false;

		[Tooltip("Detach the player if the platform collides with a wall.")]
		public bool detachOnWallCollision = false;

		[Header("Audio")]
		[Tooltip("AudioSource instance of the platform, used to play sound effects at various points. Optional.")]
		public AudioSource? platformSource;

		[Tooltip("Sound effect to play when the platform spawns. Optional if not playing a spawning sound effect.")]
		public AudioClip? spawnSFX;

		[Tooltip("Sound effect to play when a player grabs on to the platform. Optional if not playing an attaching sound effect.")]
		public AudioClip? attachSFX;

		[Tooltip("Sound effect to play when the platform despawns and is destroyed. Optional if not playing a despawn sound effect.")]
		public AudioClip? destroySFX;

		[Tooltip("Lowest pitch that platform sound effects can have. Both can be set to the same value to disable pitch variation.")]
		[Range(-3f, 3f)]
		public float minPitch = 1f;

		[Tooltip("Highest pitch that platform sound effects can have. Both can be set to the same value to disable pitch variation.")]
		[Range(-3f, 3f)]
		public float maxPitch = 1f;

		public static Random Random { get; private set; } = new Random();


		public Transform PlatformTransform { get; private set; } = null;


		public NetworkVariable<int> SyncedStateVariant { get; private set; } = new NetworkVariable<int>(-1, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);


		public NetworkVariable<float> SyncedPitch { get; private set; } = new NetworkVariable<float>(1f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);


		public InputAction? ActionToHold { get; private set; }

		private void Awake()
		{
			if ((Object)(object)platformAnimator != (Object)null)
			{
				((Behaviour)platformAnimator).enabled = true;
				platformAnimator.updateMode = (AnimatorUpdateMode)1;
			}
			PlatformTransform = ((Component)this).transform;
			base.AttachCondition = (PlayerControllerB player) => !player.isPlayerDead && (allowTwoHanded || !player.twoHanded) && (ActionToHold == null || ActionToHold.IsPressed());
			base.DetachCondition = (PlayerControllerB player) => player.isPlayerDead || Object.op_Implicit((Object)(object)player.inAnimationWithEnemy) || player.inSpecialInteractAnimation || (ActionToHold != null && !ActionToHold.IsPressed());
			if (actionToHold.Length > 0)
			{
				ActionToHold = GameNetworkManager.Instance.localPlayerController.playerActions.FindAction(actionToHold, false);
			}
		}

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			if ((Object)(object)platformSource != (Object)null && ((Behaviour)platformSource).enabled)
			{
				platformSource.pitch = SyncedPitch.Value;
				NetworkVariable<float> syncedPitch = SyncedPitch;
				syncedPitch.OnValueChanged = (OnValueChangedDelegate<float>)(object)Delegate.Combine((Delegate?)(object)syncedPitch.OnValueChanged, (Delegate?)(object)(OnValueChangedDelegate<float>)delegate(float _, float current)
				{
					platformSource.pitch = current;
				});
			}
			if (((NetworkBehaviour)this).IsHost)
			{
				if (minPitch < maxPitch)
				{
					SyncedPitch.Value = (float)Random.NextDouble() * (maxPitch - minPitch) + minPitch;
				}
				if (stateVariant >= 0)
				{
					SyncedStateVariant.Value = stateVariant;
				}
			}
			if ((Object)(object)spawnSFX != (Object)null)
			{
				AudioSource? obj = platformSource;
				if (obj != null)
				{
					obj.PlayOneShot(spawnSFX, 1f);
				}
			}
		}

		public override void OnTriggerEnter(Collider collider)
		{
			EnemyAI val = default(EnemyAI);
			if (detachOnEnemyCollision && base.LocalPlayerAttached && ((Component)collider).TryGetComponent<EnemyAI>(ref val))
			{
				DetachPlayerLocal();
				if (!isLocalEffect)
				{
					DetachPlayerServerRpc();
				}
			}
			else if (detachOnWallCollision && base.LocalPlayerAttached && (((Component)collider).gameObject.layer == LayerMask.NameToLayer("Room") || ((Component)collider).gameObject.layer == LayerMask.NameToLayer("MiscLevelGeometry")))
			{
				DetachPlayerLocal();
				if (!isLocalEffect)
				{
					DetachPlayerServerRpc();
				}
			}
			else
			{
				base.OnTriggerEnter(collider);
			}
		}

		public override void Update()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)base.AttachedPlayer != (Object)null)
			{
				base.AttachedPlayerTransform.position = PlatformTransform.position + playerOffset;
				base.AttachedPlayer.ResetFallGravity();
			}
			base.Update();
		}

		public override void AttachPlayerLocal(PlayerControllerB player)
		{
			if ((Object)(object)attachSFX != (Object)null && (Object)(object)platformSource != (Object)null)
			{
				platformSource.PlayOneShot(attachSFX, 1f);
			}
			if (stateName.Length > 0 && (Object)(object)platformAnimator != (Object)null)
			{
				platformAnimator.Play(string.Format("{0}{1}", stateName, (SyncedStateVariant.Value >= 0) ? ((object)SyncedStateVariant.Value) : ""));
			}
			base.AttachPlayerLocal(player);
		}

		public override void DetachPlayerLocal()
		{
			if ((Object)(object)destroySFX != (Object)null && (Object)(object)platformSource != (Object)null)
			{
				platformSource.Stop();
				platformSource.PlayOneShot(destroySFX, 1f);
			}
			base.DetachPlayerLocal();
		}

		public void SwitchVariant(int vari