Decompiled source of Climbmageddon v1.3.0

plugins/Climbmageddon/Climbmageddon.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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("Climbmageddon")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Climbmageddon")]
[assembly: AssemblyTitle("Climbmageddon")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 Climbmageddon
{
	public class Patches
	{
		private static Dictionary<Rigidbody, float> rigidbodyTimeouts;

		[HarmonyPatch(typeof(CL_Initializer), "Awake")]
		[HarmonyPostfix]
		private static void InitializerAwake()
		{
			//IL_000a: 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)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			Physics.bounceThreshold = 0.1f;
			PhysicsMaterial sharedMaterial = new PhysicsMaterial
			{
				bounciness = 1f,
				bounceCombine = (PhysicsMaterialCombine)3,
				dynamicFriction = 0f,
				staticFriction = 0f,
				frictionCombine = (PhysicsMaterialCombine)2
			};
			Rigidbody[] array = Resources.FindObjectsOfTypeAll<Rigidbody>();
			foreach (Rigidbody val in array)
			{
				Denizen componentInParent = ((Component)val).gameObject.GetComponentInParent<Denizen>(true);
				if (((Object)(object)((Component)val).gameObject.GetComponentInParent<CL_Prop>(true) == (Object)null && (Object)(object)componentInParent == (Object)null && (Object)(object)((Component)val).gameObject.GetComponentInParent<UT_ShatterProp>(true) == (Object)null) || componentInParent is DEN_RatKing)
				{
					continue;
				}
				Item_Object componentInParent2 = ((Component)val).gameObject.GetComponentInParent<Item_Object>(true);
				if (!((Object)(object)componentInParent2 != (Object)null) || (!componentInParent2.itemData.HasTag("flashlight") && !componentInParent2.itemData.HasTag("required") && !componentInParent2.itemData.HasTag("crafting") && ((UnityEventBase)componentInParent2.pickupEvent).GetPersistentEventCount() <= 0))
				{
					val.linearDamping = 0f;
					val.angularDamping = 0f;
					val.maxLinearVelocity = 30f;
					val.maxAngularVelocity = 30f;
					val.collisionDetectionMode = (CollisionDetectionMode)2;
					Collider[] componentsInChildren = ((Component)val).gameObject.GetComponentsInChildren<Collider>();
					for (int j = 0; j < componentsInChildren.Length; j++)
					{
						componentsInChildren[j].sharedMaterial = sharedMaterial;
					}
					if ((Object)(object)((Component)val).gameObject.GetComponent<VelocityLimiter>() == (Object)null)
					{
						((Component)val).gameObject.AddComponent<VelocityLimiter>().rigid = val;
					}
					if (!((Object)(object)componentInParent2 != (Object)null) || !((Object)(object)componentInParent != (Object)null) || componentInParent is DEN_SlugGrub)
					{
						val.isKinematic = false;
					}
				}
			}
			Item_Object[] array2 = Resources.FindObjectsOfTypeAll<Item_Object>();
			foreach (Item_Object val2 in array2)
			{
				if (((Component)val2).gameObject.layer == 10)
				{
					((Component)val2).gameObject.layer = 6;
				}
				ObjectTagger component = ((Component)val2).GetComponent<ObjectTagger>();
				if ((Object)(object)component != (Object)null && !component.HasTag("BarnacleBad"))
				{
					component.AddTag("BarnacleBad");
				}
			}
			UT_RandomTimer[] array3 = Resources.FindObjectsOfTypeAll<UT_RandomTimer>();
			foreach (UT_RandomTimer val3 in array3)
			{
				if (((Object)((Component)val3).transform).name.StartsWith("HAZ_TrashSpawner"))
				{
					val3.randomMin /= 5f;
					val3.randomMax /= 5f;
				}
			}
		}

		[HarmonyPatch(typeof(RoachTradeGroup), "Spawn")]
		[HarmonyPatch(typeof(ENV_ArtifactDevice), "Start")]
		[HarmonyPatch(typeof(DenizenMovement_BasicFlier), "Crawl")]
		[HarmonyPatch(typeof(DEN_Bloodbug), "Crawl")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> MakeNonKinematic(IEnumerable<CodeInstruction> instructions)
		{
			foreach (CodeInstruction instruction in instructions)
			{
				if (CodeInstructionExtensions.Calls(instruction, AccessTools.PropertySetter(typeof(Rigidbody), "isKinematic")))
				{
					yield return new CodeInstruction(OpCodes.Pop, (object)null);
					yield return new CodeInstruction(OpCodes.Ldc_I4_0, (object)null);
				}
				yield return instruction;
			}
		}

		[HarmonyPatch(typeof(CL_Prop), "Start")]
		[HarmonyPrefix]
		private static void CLPropNoStuck(CL_Prop __instance)
		{
			__instance.stuck = false;
			if (!((GameEntity)__instance).entityPrefabID.ToLower().Contains("rebar"))
			{
				return;
			}
			foreach (PropAudioEffect hitSound in __instance.hitSounds)
			{
				if (hitSound.name == "Heavy Hit")
				{
					hitSound.maxVolume = Mathf.Min(0.4f, hitSound.maxVolume);
				}
			}
		}

		[HarmonyPatch(typeof(CL_Prop), "Start")]
		[HarmonyPostfix]
		private static void CLPropStart(ref Rigidbody ___rigid)
		{
			//IL_009f: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)___rigid == (Object)null)
			{
				return;
			}
			Denizen componentInParent = ((Component)___rigid).gameObject.GetComponentInParent<Denizen>(true);
			if ((Object)(object)componentInParent != (Object)null && !(componentInParent is DEN_SlugGrub))
			{
				return;
			}
			Item_Object componentInParent2 = ((Component)___rigid).gameObject.GetComponentInParent<Item_Object>(true);
			if (!((Object)(object)componentInParent2 != (Object)null) || (!componentInParent2.itemData.HasTag("flashlight") && !componentInParent2.itemData.HasTag("required") && !componentInParent2.itemData.HasTag("crafting") && ((UnityEventBase)componentInParent2.pickupEvent).GetPersistentEventCount() <= 0))
			{
				float num = 0.5f;
				Collider componentInChildren = ((Component)___rigid).GetComponentInChildren<Collider>();
				if ((Object)(object)componentInChildren != (Object)null)
				{
					Bounds bounds = componentInChildren.bounds;
					Vector3 extents = ((Bounds)(ref bounds)).extents;
					num = ((Vector3)(ref extents)).magnitude;
				}
				AudioSource val = ((Component)___rigid).gameObject.AddComponent<AudioSource>();
				val.clip = Plugin.swoosh;
				val.playOnAwake = true;
				val.loop = true;
				val.spatialBlend = 1f;
				val.minDistance = 0.5f + num;
				val.maxDistance = 4f + num;
				val.dopplerLevel = 100f;
				val.volume = 0f;
				val.rolloffMode = (AudioRolloffMode)1;
				val.Play();
				PropController propController = ((Component)___rigid).gameObject.AddComponent<PropController>();
				propController.source = val;
				propController.rigid = ___rigid;
				propController.size = num;
			}
		}

		[HarmonyPatch(typeof(CL_Prop), "Stick")]
		[HarmonyPrefix]
		private static bool DontStick(CL_Prop __instance)
		{
			return false;
		}

		[HarmonyPatch(typeof(CL_Prop), "TickUpdate")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> DisablePropDistanceOptimizations(IEnumerable<CodeInstruction> instructions)
		{
			foreach (CodeInstruction instruction in instructions)
			{
				yield return instruction;
				if (CodeInstructionExtensions.Calls(instruction, AccessTools.Method(typeof(DarkMachineFunctions), "GetManhattanDistance", (Type[])null, (Type[])null)))
				{
					yield return new CodeInstruction(OpCodes.Pop, (object)null);
					yield return new CodeInstruction(OpCodes.Ldc_R4, (object)0f);
				}
			}
		}

		[HarmonyPatch(typeof(DEN_Phage), "LateUpdate")]
		[HarmonyPatch(typeof(DEN_BasicDenizen_Flier), "Update")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> MakeZeroDrag(IEnumerable<CodeInstruction> instructions)
		{
			foreach (CodeInstruction instruction in instructions)
			{
				if (CodeInstructionExtensions.Calls(instruction, AccessTools.PropertySetter(typeof(Rigidbody), "linearDamping")))
				{
					yield return new CodeInstruction(OpCodes.Pop, (object)null);
					yield return new CodeInstruction(OpCodes.Ldc_R4, (object)0f);
				}
				yield return instruction;
			}
		}

		[HarmonyPatch(typeof(UT_SpawnEntity), "Start")]
		[HarmonyPrefix]
		private static void SpawnEntityKinematic(UT_SpawnEntity __instance)
		{
			Item_Object component = __instance.spawnObject.GetComponent<Item_Object>();
			if (!((Object)(object)component != (Object)null) || !component.itemData.HasTag("flashlight"))
			{
				__instance.forceKinematicIfRigidbody = false;
			}
		}

		[HarmonyPatch(typeof(UT_SpawnEntityByID), "Start")]
		[HarmonyPrefix]
		private static void SpawnEntityByIDKinematic(UT_SpawnEntityByID __instance)
		{
			if (!(__instance.idToSpawn == "Item_Flashlight"))
			{
				__instance.forceKinematicIfRigidbody = false;
			}
		}

		[HarmonyPatch(typeof(Item), "Initialize")]
		[HarmonyPrefix]
		private static void ItemMakeCollideable(Item __instance)
		{
			__instance.customDropLayer = "Interactable";
		}

		[HarmonyPatch(typeof(DEN_Turret), "Start")]
		[HarmonyPrefix]
		private static void DeathlessTurrets(DEN_Turret __instance)
		{
			__instance.canKnockOver = false;
		}

		[HarmonyPatch(typeof(ENT_Player), "Awake")]
		[HarmonyPostfix]
		private static void InitRigidbodyTimeouts()
		{
			rigidbodyTimeouts = new Dictionary<Rigidbody, float>();
		}

		[HarmonyPatch(typeof(ENT_Player), "FixedUpdate")]
		[HarmonyPostfix]
		private static void ReduceRigidbodyTimeouts()
		{
			List<Rigidbody> list = new List<Rigidbody>();
			foreach (Rigidbody item in rigidbodyTimeouts.Keys.ToList())
			{
				rigidbodyTimeouts[item] -= Time.fixedDeltaTime;
				if (rigidbodyTimeouts[item] <= 0f)
				{
					list.Add(item);
				}
			}
			foreach (Rigidbody item2 in list)
			{
				rigidbodyTimeouts.Remove(item2);
			}
		}

		[HarmonyPatch(typeof(ENT_Player), "OnControllerColliderHit")]
		[HarmonyPostfix]
		private static void CollisionDamage(ENT_Player __instance, ControllerColliderHit hit)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)hit.rigidbody == (Object)null || rigidbodyTimeouts.ContainsKey(hit.rigidbody))
			{
				return;
			}
			Vector3 val = hit.rigidbody.linearVelocity;
			Vector3 val2 = val - __instance.GetVelocity();
			if (((Vector3)(ref val2)).magnitude < ((Vector3)(ref val)).magnitude)
			{
				val = val2;
			}
			float num = hit.rigidbody.mass + 3f;
			Vector3 val3 = val * (hit.rigidbody.mass / num);
			if (!(((Vector3)(ref val3)).magnitude < 1f))
			{
				float num2 = Mathf.Min(3f, ((Vector3)(ref val3)).magnitude);
				hit.rigidbody.AddForce(-val * (3f / num), (ForceMode)2);
				((GameEntity)__instance).Damage(DamageInfo.CreateDamageInfo(num2, "bloodbug"));
				__instance.DropHang(0.1f, 1f, false, "drop", true);
				CL_CameraControl.Shake(num2 / 10f);
				if (__instance.IsGrounded(false) && val3.y < 1f)
				{
					((Vector3)(ref val3))..ctor(val3.x, 1f, val3.z);
				}
				((GameEntity)__instance).AddForce(val3, "projectile");
				rigidbodyTimeouts[hit.rigidbody] = 0.5f;
			}
		}

		[HarmonyPatch(typeof(CL_GameManager), "Awake")]
		[HarmonyPostfix]
		private static void MakeCheated()
		{
			CommandConsole.hasCheated = true;
		}

		[HarmonyPatch(typeof(Item), "CreateDropObject")]
		[HarmonyPostfix]
		private static void ApplyDropObjectMark(ref Item_Object __result)
		{
			CL_Prop componentInChildren = ((Component)__result).GetComponentInChildren<CL_Prop>();
			if (!((Object)(object)componentInChildren == (Object)null))
			{
				((Component)componentInChildren).gameObject.AddComponent<DropObjectMark>();
			}
		}
	}
	public class VelocityLimiter : MonoBehaviour
	{
		public Rigidbody rigid;

		private void FixedUpdate()
		{
			rigid.maxLinearVelocity = 30f;
			rigid.maxAngularVelocity = 30f;
		}
	}
	public class DropObjectMark : MonoBehaviour
	{
	}
	public class PropController : MonoBehaviour
	{
		public AudioSource source;

		public Rigidbody rigid;

		public float size;

		private static int nthInstance;

		private const int checkBoundsInterval = 8;

		private int checkBoundsCountdown;

		private void Start()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			checkBoundsCountdown = nthInstance % 8;
			nthInstance++;
			if (!((Object)(object)((Component)this).GetComponent<DropObjectMark>() != (Object)null))
			{
				rigid.AddForce(Random.onUnitSphere * 15f, (ForceMode)2);
			}
		}

		private void FixedUpdate()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: 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)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: 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_0071: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			Vector3 linearVelocity = rigid.linearVelocity;
			if (((Vector3)(ref linearVelocity)).magnitude < 0.1f)
			{
				Vector3 val = Random.onUnitSphere * 5f;
				rigid.AddForce(val - rigid.linearVelocity, (ForceMode)2);
			}
			else
			{
				linearVelocity = rigid.linearVelocity;
				if (((Vector3)(ref linearVelocity)).magnitude < 5f)
				{
					linearVelocity = rigid.linearVelocity;
					Vector3 val2 = ((Vector3)(ref linearVelocity)).normalized * 5f;
					rigid.AddForce(val2 - rigid.linearVelocity, (ForceMode)2);
				}
			}
			AudioSource obj = source;
			linearVelocity = rigid.linearVelocity;
			obj.volume = Mathf.Clamp01((((Vector3)(ref linearVelocity)).magnitude - 10f) / 20f);
			AudioSource obj2 = source;
			linearVelocity = rigid.linearVelocity;
			obj2.pitch = Mathf.Clamp((2f + Mathf.Clamp01((((Vector3)(ref linearVelocity)).magnitude - 10f) / 20f) * 2f) / size, 0.1f, 15f);
			if (checkBoundsCountdown <= 0)
			{
				CheckBounds();
				checkBoundsCountdown = 8;
			}
			else
			{
				checkBoundsCountdown--;
			}
		}

		private void CheckBounds()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)WorldLoader.instance == (Object)null || !((Behaviour)WorldLoader.instance).isActiveAndEnabled)
			{
				return;
			}
			Bounds localBounds;
			Bounds val = default(Bounds);
			foreach (LevelInfo item in WorldLoader.instance.GetCurrentBranch().levelTracker)
			{
				M_Level level = item.GetLevel();
				localBounds = level.GetLocalBounds();
				Vector3 center = ((Bounds)(ref localBounds)).center;
				localBounds = level.GetLocalBounds();
				((Bounds)(ref val))..ctor(center, ((Bounds)(ref localBounds)).size + new Vector3(20f, 20f, 20f));
				if (((Bounds)(ref val)).Contains(((Component)level).transform.InverseTransformPoint(rigid.position)))
				{
					return;
				}
			}
			M_Level level2 = WorldLoader.GetClosestLevelToPosition(rigid.position).GetLevel();
			if (level2.levelName.StartsWith("M3_Delta_Pier") || level2.levelName.StartsWith("M3_Habitation_Pier") || level2.levelName.StartsWith("M4_Abyss_Transit") || level2.levelName.StartsWith("M4_Abyss_Garden") || !(level2.levelName != "M4_Abyss_Endless_Start_01") || !(level2.levelName != "M4_Abyss_Endless_Breakroom_01"))
			{
				localBounds = level2.GetLocalBounds();
				Vector3 center2 = ((Bounds)(ref localBounds)).center;
				localBounds = level2.GetLocalBounds();
				Bounds val2 = default(Bounds);
				((Bounds)(ref val2))..ctor(center2, ((Bounds)(ref localBounds)).size + new Vector3(20f, 20f, 20f));
				Vector3 val3 = ((Component)level2).transform.InverseTransformPoint(rigid.position);
				Vector3 val4 = ((Component)level2).transform.InverseTransformVector(rigid.linearVelocity);
				if ((val4.x < 0f && val3.x < ((Bounds)(ref val2)).min.x) || (val4.x > 0f && val3.x > ((Bounds)(ref val2)).max.x))
				{
					((Vector3)(ref val4))..ctor(0f - val4.x, val4.y, val4.z);
				}
				if ((val4.y < 0f && val3.y < ((Bounds)(ref val2)).min.y) || (val4.y > 0f && val3.y > ((Bounds)(ref val2)).max.y))
				{
					((Vector3)(ref val4))..ctor(val4.x, 0f - val4.y, val4.z);
				}
				if ((val4.z < 0f && val3.z < ((Bounds)(ref val2)).min.z) || (val4.z > 0f && val3.z > ((Bounds)(ref val2)).max.z))
				{
					((Vector3)(ref val4))..ctor(val4.x, val4.y, 0f - val4.z);
				}
				if (((Vector3)(ref val4)).magnitude < 25f)
				{
					val4 = ((Vector3)(ref val4)).normalized * 25f;
				}
				rigid.linearVelocity = ((Component)level2).transform.TransformVector(val4);
			}
		}
	}
	[BepInPlugin("Climbmageddon", "Climbmageddon", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		public static AudioClip swoosh;

		private void Awake()
		{
			//IL_0063: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			Logger = ((BaseUnityPlugin)this).Logger;
			swoosh = AssetBundle.LoadFromFile(Directory.GetFiles(Paths.PluginPath, "climbmageddon", SearchOption.AllDirectories).First()).LoadAsset<AudioClip>("swoosh");
			Logger.LogInfo((object)"Bundle data loaded");
			Harmony.CreateAndPatchAll(typeof(Patches), (string)null);
			Logger.LogInfo((object)"Patches applied");
			AudioConfiguration configuration = AudioSettings.GetConfiguration();
			configuration.numVirtualVoices = 512;
			configuration.numRealVoices = 255;
			AudioSettings.Reset(configuration);
			Logger.LogInfo((object)"Audio settings changed");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Climbmageddon";

		public const string PLUGIN_NAME = "Climbmageddon";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}