Decompiled source of Repo Rush v0.5.0

Repo Rush.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using REPOLib;
using REPOLib.Modules;
using RepoRush.BadEvents;
using RepoRush.GoodEvents;
using RepoRush.Match1;
using RepoRush.Match2;
using RepoRush.Match3;
using RepoRush.Match4;
using RepoRush.MiscEvents;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Repo Rush")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.5.0")]
[assembly: AssemblyInformationalVersion("0.5.0+d0e5724f87025a6258fb157f0efd4ca2a2e6a09d")]
[assembly: AssemblyProduct("Repo Rush")]
[assembly: AssemblyTitle("Repo Rush")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.5.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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 RepoRush
{
	[BepInPlugin("dev.redfops.repo.reporush", "Repo Rush", "0.4.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string modGUID = "dev.redfops.repo.reporush";

		public const string modName = "Repo Rush";

		public const string modVersion = "0.4.0";

		internal static ManualLogSource Logger;

		private readonly Harmony harmony = new Harmony("dev.redfops.repo.reporush");

		public static ConfigEntry<bool> match1Enabled;

		public static ConfigEntry<bool> match2Enabled;

		public static ConfigEntry<bool> match3Enabled;

		public static ConfigEntry<bool> match4Enabled;

		public static ConfigEntry<bool> matchFinalEnabled;

		public static ConfigEntry<bool> eventDiscountedShop;

		public static ConfigEntry<bool> mcJannekOnly;

		public static ConfigEntry<bool> easierExtraction;

		public static ConfigEntry<bool> potentUpgrades;

		public static ConfigEntry<bool> eventSneaky;

		public static ConfigEntry<bool> manorOnly;

		public static ConfigEntry<bool> shopless;

		public static ConfigEntry<bool> extraEnemy;

		public static ConfigEntry<bool> extraExtraction;

		public static ConfigEntry<bool> eventSpeedy;

		public static ConfigEntry<bool> stalker;

		public static ConfigEntry<bool> squeakyShoes;

		private void Awake()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Expected O, but got Unknown
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Expected O, but got Unknown
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Expected O, but got Unknown
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Expected O, but got Unknown
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Expected O, but got Unknown
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Expected O, but got Unknown
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Expected O, but got Unknown
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Expected O, but got Unknown
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Expected O, but got Unknown
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Expected O, but got Unknown
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_035f: Expected O, but got Unknown
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_038a: Expected O, but got Unknown
			//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b5: Expected O, but got Unknown
			//IL_0470: Unknown result type (might be due to invalid IL or missing references)
			//IL_047a: Expected O, but got Unknown
			//IL_049b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a5: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			match1Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Matches", "Match 1 enabled", true, new ConfigDescription("Enable custom effects for match 1", (AcceptableValueBase)null, Array.Empty<object>()));
			harmony.PatchAll(typeof(PlayerUpdatePatch));
			harmony.PatchAll(typeof(TumbleUpdatePatch));
			harmony.PatchAll(typeof(TumbleForcePatch));
			harmony.PatchAll(typeof(PhysGrabObjectAwakePatch));
			harmony.PatchAll(typeof(PhysGrabObjectUpdatePatch));
			match2Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Matches", "Match 2 enabled", false, new ConfigDescription("Enable custom effects for match 2", (AcceptableValueBase)null, Array.Empty<object>()));
			RepoRush.Match2.Assets.LoadFanAssets();
			harmony.PatchAll(typeof(ValuableDirectorPatch));
			harmony.PatchAll(typeof(EnemyDirectorPatch));
			match3Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Matches", "Match 3 enabled", false, new ConfigDescription("Enable custom effects for match 3", (AcceptableValueBase)null, Array.Empty<object>()));
			harmony.PatchAll(typeof(PhysGrabObjectImpactDetectorPatch));
			harmony.PatchAll(typeof(ShopManagerPatch));
			match4Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Matches", "Match 4 enabled", false, new ConfigDescription("Enable custom effects for match 4", (AcceptableValueBase)null, Array.Empty<object>()));
			harmony.PatchAll(typeof(ExtractionPointGetNearestPatch));
			harmony.PatchAll(typeof(RepoRush.Match4.RunManagerSetRunLevelPatch));
			eventDiscountedShop = ((BaseUnityPlugin)this).Config.Bind<bool>("Good Events", "Discounted Shop", false, new ConfigDescription("Enable discounted shop event", (AcceptableValueBase)null, Array.Empty<object>()));
			mcJannekOnly = ((BaseUnityPlugin)this).Config.Bind<bool>("Good Events", "McJannek Only", false, new ConfigDescription("Enable McJannek only event", (AcceptableValueBase)null, Array.Empty<object>()));
			easierExtraction = ((BaseUnityPlugin)this).Config.Bind<bool>("Good Events", "Lower Extraction", false, new ConfigDescription("Enable lower extraction event", (AcceptableValueBase)null, Array.Empty<object>()));
			potentUpgrades = ((BaseUnityPlugin)this).Config.Bind<bool>("Good Events", "Potent Upgrades", false, new ConfigDescription("Enable Potent Upgrades event", (AcceptableValueBase)null, Array.Empty<object>()));
			eventSneaky = ((BaseUnityPlugin)this).Config.Bind<bool>("Good Events", "Sneak 100", false, new ConfigDescription("Enable sneak 100 event", (AcceptableValueBase)null, Array.Empty<object>()));
			harmony.PatchAll(typeof(ShopInitializePatch));
			harmony.PatchAll(typeof(RepoRush.GoodEvents.RunManagerSetRunLevelPatch));
			harmony.PatchAll(typeof(HaulGoalSetPatch));
			harmony.PatchAll(typeof(PlayerUpgradePatch));
			harmony.PatchAll(typeof(VisionTriggerPatch));
			manorOnly = ((BaseUnityPlugin)this).Config.Bind<bool>("Bad Events", "Manor Only", false, new ConfigDescription("Enable manor only event", (AcceptableValueBase)null, Array.Empty<object>()));
			shopless = ((BaseUnityPlugin)this).Config.Bind<bool>("Bad Events", "Shopless", false, new ConfigDescription("Enable shopless event", (AcceptableValueBase)null, Array.Empty<object>()));
			extraEnemy = ((BaseUnityPlugin)this).Config.Bind<bool>("Bad Events", "Increased spawns", false, new ConfigDescription("Enable increased spawns event", (AcceptableValueBase)null, Array.Empty<object>()));
			extraExtraction = ((BaseUnityPlugin)this).Config.Bind<bool>("Bad Events", "Extra extraction", false, new ConfigDescription("Enable extra extraction event", (AcceptableValueBase)null, Array.Empty<object>()));
			eventSpeedy = ((BaseUnityPlugin)this).Config.Bind<bool>("Bad Events", "Increased Speed", false, new ConfigDescription("Enable increased speed event", (AcceptableValueBase)null, Array.Empty<object>()));
			eventSpeedy.SettingChanged += delegate
			{
				Time.timeScale = (eventSpeedy.Value ? 1.2f : 1f);
			};
			Time.timeScale = (eventSpeedy.Value ? 1.2f : 1f);
			harmony.PatchAll(typeof(RepoRush.BadEvents.RunManagerSetRunLevelPatch));
			harmony.PatchAll(typeof(ChangeLevelPatch));
			harmony.PatchAll(typeof(RepoRush.BadEvents.EnemyAmountSetupPatch));
			harmony.PatchAll(typeof(TileGenerationPatch));
			stalker = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc Events", "They stalk you", false, new ConfigDescription("Enable they stalk you event", (AcceptableValueBase)null, Array.Empty<object>()));
			squeakyShoes = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc Events", "Squeaky Shoes", false, new ConfigDescription("Enable squeaky shoes event", (AcceptableValueBase)null, Array.Empty<object>()));
			RepoRush.MiscEvents.Assets.LoadAssets();
			harmony.PatchAll(typeof(PlayerSpawnPatch));
			harmony.PatchAll(typeof(RepoRush.MiscEvents.EnemyAmountSetupPatch));
			Logger.LogInfo((object)"Plugin Repo Rush is loaded!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Repo Rush";

		public const string PLUGIN_NAME = "Repo Rush";

		public const string PLUGIN_VERSION = "0.5.0";
	}
}
namespace RepoRush.MiscEvents
{
	internal static class Assets
	{
		internal static GameObject squeakerPrefab;

		internal static AudioClip squeak1;

		internal static AudioClip squeak2;

		internal static AudioClip fart;

		internal static GameObject stalkerPrefab;

		internal static EnemySetup stalkerSetup;

		internal static void LoadAssets()
		{
			string? directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			BundleLoader.LoadBundle(Path.Combine(directoryName, "squeak"), (Action<AssetBundle>)delegate(AssetBundle assetBundle)
			{
				squeakerPrefab = assetBundle.LoadAsset<GameObject>("Squeaker");
				Plugin.Logger.LogMessage((object)squeakerPrefab);
				NetworkPrefabs.RegisterNetworkPrefab("Reporush/squeaker", squeakerPrefab);
				squeak1 = assetBundle.LoadAsset<AudioClip>("clownstep1");
				squeak2 = assetBundle.LoadAsset<AudioClip>("clownstep2");
				fart = assetBundle.LoadAsset<AudioClip>("clowncar_fart");
			}, false);
			BundleLoader.LoadBundle(Path.Combine(directoryName, "misc"), (Action<AssetBundle>)delegate(AssetBundle assetBundle)
			{
				stalkerSetup = assetBundle.LoadAsset<EnemySetup>("Stalker");
				stalkerPrefab = assetBundle.LoadAsset<GameObject>("StalkerPrefab");
				NetworkPrefabs.RegisterNetworkPrefab("Enemies/StalkerPrefab", stalkerPrefab);
			}, false);
		}
	}
	[HarmonyPatch(typeof(EnemyDirector))]
	[HarmonyPatch("AmountSetup")]
	public static class EnemyAmountSetupPatch
	{
		private static void Postfix(ref int ___totalAmount, ref List<EnemySetup> ___enemyList)
		{
			if (Plugin.stalker.Value)
			{
				___totalAmount++;
				___enemyList.Add(Assets.stalkerSetup);
			}
		}
	}
	[HarmonyPatch(typeof(PlayerAvatar))]
	[HarmonyPatch("SpawnRPC")]
	internal static class PlayerSpawnPatch
	{
		private static void Postfix(PlayerAvatar __instance)
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.squeakyShoes.Value)
			{
				return;
			}
			GameObject gameObject = ((Component)__instance).gameObject;
			__instance.tumbleStartSound.Sounds = (AudioClip[])(object)new AudioClip[1] { Assets.fart };
			__instance.tumbleStartSound.Volume = 0.6f;
			if (SemiFunc.IsMultiplayer())
			{
				if (__instance.photonView.IsMine && !((Object)(object)((Component)__instance).gameObject.GetComponentInChildren<Squeaker>() != (Object)null))
				{
					PhotonNetwork.Instantiate("Reporush/squeaker", new Vector3(0f, 0f, 0f), Quaternion.identity, (byte)0, (object[])null);
				}
			}
			else
			{
				((Behaviour)Object.Instantiate<GameObject>(Assets.squeakerPrefab, gameObject.transform).GetComponent<Squeaker>()).enabled = true;
			}
		}
	}
	public class Squeaker : MonoBehaviourPun, IPunInstantiateMagicCallback, IPunObservable
	{
		public Sound squeakSound;

		private PlayerAvatar avatar;

		private float squeakProgress;

		private const float squeakPerSecond = 2.1f;

		public void OnPhotonInstantiate(PhotonMessageInfo info)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
			{
				if (player.photonView.Owner == info.Sender)
				{
					((Component)((Component)this).transform).transform.SetParent(((Component)player).transform, false);
					((Behaviour)this).enabled = true;
				}
			}
		}

		private void Start()
		{
			avatar = ((Component)((Component)this).transform.parent).GetComponent<PlayerAvatar>();
			if ((Object)(object)avatar == (Object)null)
			{
				Plugin.Logger.LogError((object)"Avatar is null");
			}
		}

		private void FixedUpdate()
		{
			if (SemiFunc.IsMultiplayer() && !avatar.photonView.IsMine)
			{
				return;
			}
			Traverse val = Traverse.Create((object)avatar);
			if (!val.Field<bool>("isSliding").Value && !val.Field<bool>("isTumbling").Value && val.Field<bool>("isGrounded").Value)
			{
				float num = (val.Field<bool>("isCrouching").Value ? 0.63f : (val.Field<bool>("isSprinting").Value ? 1.5f : 1f));
				squeakProgress += num * Time.fixedDeltaTime * ((Vector3)(ref PlayerController.instance.InputDirection)).magnitude;
				if (squeakProgress > 0.4761905f)
				{
					squeakProgress = 0f;
					PlaySqueak();
				}
			}
		}

		public void PlaySqueak()
		{
			if (GameManager.Multiplayer())
			{
				((MonoBehaviourPun)this).photonView.RPC("PlaySqueakRPC", (RpcTarget)0, Array.Empty<object>());
			}
			else
			{
				PlaySqueakRPC();
			}
		}

		[PunRPC]
		public void PlaySqueakRPC()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			Traverse obj = Traverse.Create((object)avatar);
			bool value = obj.Field<bool>("isCrouching").Value;
			bool value2 = obj.Field<bool>("isSprinting").Value;
			squeakSound.Play(((Component)this).transform.position, value ? 0.5f : (value2 ? 1.3f : 1f), 1f, 1f, 1f);
		}

		public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
		{
		}
	}
}
namespace RepoRush.Match4
{
	[HarmonyPatch(typeof(SemiFunc))]
	[HarmonyPatch("ExtractionPointGetNearest")]
	internal static class ExtractionPointGetNearestPatch
	{
		private static bool Prefix(ref ExtractionPoint __result, Vector3 position)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.match4Enabled.Value)
			{
				return true;
			}
			__result = null;
			float num = 0f;
			foreach (GameObject item in Traverse.Create((object)RoundDirector.instance).Field<List<GameObject>>("extractionPointList").Value)
			{
				float num2 = Vector3.Distance(position, item.transform.position);
				if (num2 > num)
				{
					num = num2;
					__result = item.GetComponent<ExtractionPoint>();
				}
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(RunManager))]
	[HarmonyPatch("SetRunLevel")]
	internal class RunManagerSetRunLevelPatch
	{
		private static void Prefix(RunManager __instance, out List<Level> __state)
		{
			__state = new List<Level>();
			if (Plugin.match4Enabled == null || !Plugin.match4Enabled.Value)
			{
				return;
			}
			__state = __instance.levels;
			__instance.levels = new List<Level>();
			List<string> list = new List<string>(3) { "Manor", "Wizard", "Arctic" };
			foreach (Level item in __state)
			{
				if (!list.Contains(item.ResourcePath))
				{
					__instance.levels.Add(item);
				}
			}
		}

		private static void Postfix(RunManager __instance, List<Level> __state)
		{
			if (Plugin.match4Enabled != null && Plugin.match4Enabled.Value)
			{
				__instance.levels = __state;
			}
		}
	}
}
namespace RepoRush.Match3
{
	[HarmonyPatch(typeof(PhysGrabObjectImpactDetector))]
	[HarmonyPatch("Start")]
	internal static class PhysGrabObjectImpactDetectorPatch
	{
		private static void Postfix(PhysGrabObjectImpactDetector __instance, ValuableObject ___valuableObject)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected I4, but got Unknown
			if (Plugin.match3Enabled.Value && Object.op_Implicit((Object)(object)___valuableObject))
			{
				Type volumeType = ___valuableObject.volumeType;
				switch ((int)volumeType)
				{
				case 0:
				case 1:
					__instance.durability = 0f;
					__instance.fragility = 100f;
					break;
				case 2:
				case 3:
					__instance.durability = 10f;
					__instance.fragility = 90f;
					break;
				case 4:
				case 5:
				case 6:
					__instance.durability = 80f;
					__instance.fragility = 80f;
					break;
				}
			}
		}
	}
	[HarmonyPatch(typeof(ShopManager))]
	internal class ShopManagerPatch
	{
		[HarmonyPatch("GetAllItemsFromStatsManager")]
		[HarmonyPrefix]
		private static void GetItemsPrefix(out Item __state)
		{
			__state = null;
			if (Plugin.match3Enabled != null && Plugin.match3Enabled.Value && !SemiFunc.IsNotMasterClient())
			{
				if (!StatsManager.instance.itemDictionary.TryGetValue("Item Drone Indestructible", out __state))
				{
					Plugin.Logger.LogError((object)"Could not find Item Drone Indestructible in StatsManager.instance.itemDictionary!");
				}
				else
				{
					StatsManager.instance.itemDictionary.Remove("Item Drone Indestructible");
				}
			}
		}

		[HarmonyPatch("GetAllItemsFromStatsManager")]
		[HarmonyPostfix]
		private static void GetItemsPostfix(Item __state)
		{
			if (Object.op_Implicit((Object)(object)__state))
			{
				StatsManager.instance.itemDictionary.Add("Item Drone Indestructible", __state);
			}
		}
	}
}
namespace RepoRush.Match2
{
	internal static class Assets
	{
		internal static GameObject handfan;

		internal static GameObject handfanTiny;

		internal static GameObject normalfanBig;

		internal static GameObject standingfan;

		internal static GameObject standingfanWide;

		internal static GameObject standingfanVeryTall;

		internal static void LoadFanAssets()
		{
			BundleLoader.LoadBundle(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "fans"), (Action<AssetBundle>)delegate(AssetBundle assetBundle)
			{
				handfan = assetBundle.LoadAsset<GameObject>("handfan");
				standingfan = assetBundle.LoadAsset<GameObject>("standingfan");
				normalfanBig = assetBundle.LoadAsset<GameObject>("FanBig");
				handfanTiny = assetBundle.LoadAsset<GameObject>("handfanTiny");
				standingfanWide = assetBundle.LoadAsset<GameObject>("standingfanWide");
				standingfanVeryTall = assetBundle.LoadAsset<GameObject>("standingfanVeryTall");
				NetworkPrefabs.RegisterNetworkPrefab("Valuables/01 Tiny/handfanTiny", handfanTiny);
				NetworkPrefabs.RegisterNetworkPrefab("Valuables/02 Small/handfan", handfan);
				NetworkPrefabs.RegisterNetworkPrefab("Valuables/04 Big/FanBig", normalfanBig);
				NetworkPrefabs.RegisterNetworkPrefab("Valuables/05 Wide/standingfanWide", standingfanWide);
				NetworkPrefabs.RegisterNetworkPrefab("Valuables/06 Tall/standingfan", standingfan);
				NetworkPrefabs.RegisterNetworkPrefab("Valuables/07 Very Tall/standingfanVeryTall", standingfanVeryTall);
			}, false);
		}
	}
	[HarmonyPatch(typeof(EnemyDirector))]
	[HarmonyPatch("PickEnemies")]
	internal static class EnemyDirectorPatch
	{
		private static void Prefix(ref List<EnemySetup> _enemiesList)
		{
			if (Plugin.match2Enabled.Value && Object.op_Implicit((Object)(object)RunManager.instance) && (Object)(object)RunManager.instance.levelCurrent != (Object)(object)RunManager.instance.levelMainMenu)
			{
				EnemySetup element = EnemyDirector.instance.enemiesDifficulty2.First((EnemySetup x) => ((Object)x.spawnObjects[0]).name == "Enemy - Bowtie");
				_enemiesList = Enumerable.Repeat<EnemySetup>(element, 10).ToList();
			}
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal static class ValuableDirectorPatch
	{
		private static void Prefix(out List<LevelValuables> __state)
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			__state = new List<LevelValuables>();
			if (Plugin.match2Enabled.Value && Object.op_Implicit((Object)(object)RunManager.instance) && (Object)(object)RunManager.instance.levelCurrent != (Object)(object)RunManager.instance.levelMainMenu)
			{
				GameObject item = ((List<GameObject>)Valuables.GetValuables()).First((GameObject x) => ((Object)x).name.Equals("Valuable Fan", StringComparison.OrdinalIgnoreCase));
				LevelValuables val = (LevelValuables)ScriptableObject.CreateInstance(typeof(LevelValuables));
				val.tiny = new List<GameObject>(1) { Assets.handfanTiny };
				val.small = new List<GameObject>(1) { Assets.handfan };
				val.medium = new List<GameObject>(1) { item };
				val.big = new List<GameObject>(1) { Assets.normalfanBig };
				val.wide = new List<GameObject>(1) { Assets.standingfanWide };
				val.tall = new List<GameObject>(1) { Assets.standingfan };
				val.veryTall = new List<GameObject>(1) { Assets.standingfanVeryTall };
				__state = LevelGenerator.Instance.Level.ValuablePresets;
				LevelGenerator.Instance.Level.ValuablePresets = new List<LevelValuables>(1) { val };
			}
		}

		private static void Postfix(List<LevelValuables> __state, ref ValuableDirector __instance)
		{
			if (Plugin.match2Enabled.Value && Object.op_Implicit((Object)(object)RunManager.instance) && (Object)(object)RunManager.instance.levelCurrent != (Object)(object)RunManager.instance.levelMainMenu && __instance.setupComplete)
			{
				LevelGenerator.Instance.Level.ValuablePresets = __state;
			}
		}
	}
}
namespace RepoRush.Match1
{
	[HarmonyPatch(typeof(PhysGrabObject))]
	[HarmonyPatch("Awake")]
	internal static class PhysGrabObjectAwakePatch
	{
		private static void Postfix(PhysGrabObject __instance, ref float ___angularDragOriginal, ref float ___dragOriginal, ref float ___massOriginal, ref float ___alterMassValue)
		{
			PlayerTumble component = ((Component)__instance).GetComponent<PlayerTumble>();
			EnemyRigidbody component2 = ((Component)__instance).GetComponent<EnemyRigidbody>();
			if (Plugin.match1Enabled.Value && !Object.op_Implicit((Object)(object)component) && !Object.op_Implicit((Object)(object)component2))
			{
				__instance.rb.angularDrag = 5f;
				___angularDragOriginal = 5f;
				__instance.rb.drag = 1f;
				___dragOriginal = 1f;
				__instance.rb.mass = 1f;
				___massOriginal = 1f;
				___alterMassValue = 1f;
			}
		}
	}
	[HarmonyPatch(typeof(PhysGrabObject))]
	[HarmonyPatch("FixedUpdate")]
	internal static class PhysGrabObjectUpdatePatch
	{
		private static void Postfix(PhysGrabObject __instance)
		{
			PlayerTumble component = ((Component)__instance).GetComponent<PlayerTumble>();
			EnemyRigidbody component2 = ((Component)__instance).GetComponent<EnemyRigidbody>();
			if (Plugin.match1Enabled.Value && !Object.op_Implicit((Object)(object)component) && !Object.op_Implicit((Object)(object)component2))
			{
				__instance.OverrideDrag(1f, 0.1f);
				__instance.OverrideAngularDrag(5f, 0.1f);
				__instance.OverrideMass(1f, 0.1f);
			}
		}
	}
	[HarmonyPatch(typeof(PlayerAvatar))]
	[HarmonyPatch("Update")]
	internal static class PlayerUpdatePatch
	{
		private static void Prefix(PlayerAvatar __instance)
		{
			if (LevelGenerator.Instance.Generated && Plugin.match1Enabled.Value)
			{
				PlayerController.instance.AntiGravity(1f);
			}
		}
	}
	[HarmonyPatch(typeof(PlayerTumble))]
	[HarmonyPatch("TumbleForce")]
	internal static class TumbleForcePatch
	{
		private static void Prefix(ref Vector3 _force)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			_force *= 2f;
		}
	}
	[HarmonyPatch(typeof(PlayerTumble))]
	[HarmonyPatch("Update")]
	internal static class TumbleUpdatePatch
	{
		private static void Prefix(PhysGrabObject ___physGrabObject)
		{
			if (LevelGenerator.Instance.Generated && Plugin.match1Enabled.Value)
			{
				___physGrabObject.OverrideDrag(0.5f, 0.1f);
				___physGrabObject.OverrideAngularDrag(0.5f, 0.1f);
				___physGrabObject.OverrideZeroGravity(0.1f);
			}
		}
	}
}
namespace RepoRush.GoodEvents
{
	[HarmonyPatch(typeof(ExtractionPoint))]
	[HarmonyPatch("HaulGoalSet")]
	internal class HaulGoalSetPatch
	{
		private static void Prefix(ref int value)
		{
			value = (Plugin.easierExtraction.Value ? ((int)((float)value * 0.7f)) : value);
		}
	}
	[HarmonyPatch(typeof(ItemUpgrade))]
	[HarmonyPatch("PlayerUpgrade")]
	internal class PlayerUpgradePatch
	{
		private static void Prefix(bool ___upgradeDone, UnityEvent ___upgradeEvent)
		{
			if (!(!Plugin.potentUpgrades.Value || ___upgradeDone))
			{
				___upgradeEvent.Invoke();
			}
		}
	}
	[HarmonyPatch(typeof(RunManager))]
	[HarmonyPatch("SetRunLevel")]
	internal class RunManagerSetRunLevelPatch
	{
		private static void Postfix(RunManager __instance)
		{
			if (Plugin.mcJannekOnly.Value)
			{
				__instance.levelCurrent = __instance.levels.First((Level x) => x.ResourcePath == "Arctic");
			}
		}
	}
	[HarmonyPatch(typeof(ShopManager))]
	[HarmonyPatch("ShopInitialize")]
	internal class ShopInitializePatch
	{
		private static void Postfix(ref float ___itemValueMultiplier)
		{
			___itemValueMultiplier = (Plugin.eventDiscountedShop.Value ? 2f : 4f);
		}
	}
	[HarmonyPatch(typeof(EnemyVision))]
	[HarmonyPatch("VisionTrigger")]
	internal class VisionTriggerPatch
	{
		private static bool Prefix(PlayerAvatar player)
		{
			if (!Plugin.eventSneaky.Value)
			{
				return true;
			}
			if (!Traverse.Create((object)player).Field<bool>("isCrouching").Value)
			{
				return true;
			}
			return false;
		}
	}
}
namespace RepoRush.BadEvents
{
	[HarmonyPatch(typeof(RunManager))]
	[HarmonyPatch("ChangeLevel")]
	internal class ChangeLevelPatch
	{
		private static void Prefix(bool _completedLevel, bool _levelFailed, ref ChangeLevelType _changeLevelType, RunManager __instance, bool ___restarting, ref Level ___previousRunLevel)
		{
			if (!((!SemiFunc.MenuLevel() && !SemiFunc.IsMasterClientOrSingleplayer()) || ___restarting || _levelFailed) && Plugin.shopless.Value)
			{
				if ((int)_changeLevelType == 5)
				{
					__instance.levelCurrent = __instance.levelShop;
					_changeLevelType = (ChangeLevelType)0;
				}
				else if ((int)_changeLevelType == 0 && _completedLevel && (Object)(object)__instance.levelCurrent != (Object)(object)__instance.levelLobby && (Object)(object)__instance.levelCurrent != (Object)(object)__instance.levelShop)
				{
					___previousRunLevel = __instance.levelCurrent;
					__instance.levelsCompleted++;
					SemiFunc.StatSetRunLevel(__instance.levelsCompleted);
					SemiFunc.LevelSuccessful();
					__instance.levelCurrent = __instance.levelShop;
					_changeLevelType = (ChangeLevelType)0;
				}
			}
		}
	}
	[HarmonyPatch(typeof(EnemyDirector))]
	[HarmonyPatch("AmountSetup")]
	public static class EnemyAmountSetupPatch
	{
		private static void Postfix(ref int ___totalAmount, EnemyDirector __instance)
		{
			if (Plugin.extraEnemy.Value)
			{
				___totalAmount++;
				List<EnemySetup> list = null;
				switch (Random.RandomRangeInt(0, 3))
				{
				case 0:
					list = __instance.enemiesDifficulty1;
					break;
				case 1:
					list = __instance.enemiesDifficulty2;
					break;
				case 2:
					list = __instance.enemiesDifficulty3;
					break;
				}
				Traverse.Create((object)__instance).Method("PickEnemies", new Type[1] { typeof(List<EnemySetup>) }, (object[])null).GetValue(new object[1] { list });
			}
		}
	}
	[HarmonyPatch(typeof(RunManager))]
	[HarmonyPatch("SetRunLevel")]
	internal class RunManagerSetRunLevelPatch
	{
		private static void Postfix(RunManager __instance)
		{
			if (Plugin.manorOnly.Value)
			{
				__instance.levelCurrent = __instance.levels.First((Level x) => x.ResourcePath == "Manor");
			}
		}
	}
	[HarmonyPatch(typeof(LevelGenerator))]
	public static class TileGenerationPatch
	{
		public static void IncrementExtractions()
		{
			if (Plugin.extraExtraction.Value)
			{
				Traverse val = Traverse.Create((object)LevelGenerator.Instance);
				if (val.Field<int>("ModuleAmount").Value > 4)
				{
					Traverse<int> obj = val.Field<int>("ExtractionAmount");
					int value = obj.Value;
					obj.Value = value + 1;
				}
			}
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Expected O, but got Unknown
			CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null);
			val.MatchStartForward((CodeMatch[])(object)new CodeMatch[4]
			{
				new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction x) => x.opcode == OpCodes.Br), (string)null),
				new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction x) => x.opcode == OpCodes.Ldloc_1), (string)null),
				new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction x) => x.opcode == OpCodes.Ldc_I4_0), (string)null),
				new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction x) => CodeInstructionExtensions.StoresField(x, typeof(LevelGenerator).GetField("ExtractionAmount", BindingFlags.Instance | BindingFlags.NonPublic))), (string)null)
			}).ThrowIfInvalid("Could not find marked spot in ILCode");
			val.Advance(4);
			val.Insert((CodeInstruction[])(object)new CodeInstruction[1] { CodeInstruction.Call((Expression<Action>)(() => IncrementExtractions())) });
			Label label = default(Label);
			val.AddLabels((IEnumerable<Label>)new <>z__ReadOnlySingleElementList<Label>(label));
			val.Advance(1);
			List<Label> oldLabels = val.Labels;
			while (true)
			{
				val.MatchStartBackwards((CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction x) => x.operand is Label item && oldLabels.Contains(item)), (string)null)
				});
				if (val.IsInvalid)
				{
					break;
				}
				val.SetOperandAndAdvance((object)label);
			}
			return val.Instructions();
		}
	}
}
[CompilerGenerated]
internal sealed class <>z__ReadOnlySingleElementList<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
	private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator<T>
	{
		object IEnumerator.Current => _item;

		T IEnumerator<T>.Current => _item;

		public Enumerator(T item)
		{
			_item = item;
		}

		bool IEnumerator.MoveNext()
		{
			if (!_moveNextCalled)
			{
				return _moveNextCalled = true;
			}
			return false;
		}

		void IEnumerator.Reset()
		{
			_moveNextCalled = false;
		}

		void IDisposable.Dispose()
		{
		}
	}

	int ICollection.Count => 1;

	bool ICollection.IsSynchronized => false;

	object ICollection.SyncRoot => this;

	object IList.this[int index]
	{
		get
		{
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	bool IList.IsFixedSize => true;

	bool IList.IsReadOnly => true;

	int IReadOnlyCollection<T>.Count => 1;

	T IReadOnlyList<T>.this[int index]
	{
		get
		{
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
	}

	int ICollection<T>.Count => 1;

	bool ICollection<T>.IsReadOnly => true;

	T IList<T>.this[int index]
	{
		get
		{
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	public <>z__ReadOnlySingleElementList(T item)
	{
		_item = item;
	}

	IEnumerator IEnumerable.GetEnumerator()
	{
		return new Enumerator(_item);
	}

	void ICollection.CopyTo(Array array, int index)
	{
		array.SetValue(_item, index);
	}

	int IList.Add(object value)
	{
		throw new NotSupportedException();
	}

	void IList.Clear()
	{
		throw new NotSupportedException();
	}

	bool IList.Contains(object value)
	{
		return EqualityComparer<T>.Default.Equals(_item, (T)value);
	}

	int IList.IndexOf(object value)
	{
		if (!EqualityComparer<T>.Default.Equals(_item, (T)value))
		{
			return -1;
		}
		return 0;
	}

	void IList.Insert(int index, object value)
	{
		throw new NotSupportedException();
	}

	void IList.Remove(object value)
	{
		throw new NotSupportedException();
	}

	void IList.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}

	IEnumerator<T> IEnumerable<T>.GetEnumerator()
	{
		return new Enumerator(_item);
	}

	void ICollection<T>.Add(T item)
	{
		throw new NotSupportedException();
	}

	void ICollection<T>.Clear()
	{
		throw new NotSupportedException();
	}

	bool ICollection<T>.Contains(T item)
	{
		return EqualityComparer<T>.Default.Equals(_item, item);
	}

	void ICollection<T>.CopyTo(T[] array, int arrayIndex)
	{
		array[arrayIndex] = _item;
	}

	bool ICollection<T>.Remove(T item)
	{
		throw new NotSupportedException();
	}

	int IList<T>.IndexOf(T item)
	{
		if (!EqualityComparer<T>.Default.Equals(_item, item))
		{
			return -1;
		}
		return 0;
	}

	void IList<T>.Insert(int index, T item)
	{
		throw new NotSupportedException();
	}

	void IList<T>.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}
}