Decompiled source of Climbmageddon v1.1.0

plugins/Climbmageddon/Climbmageddon.dll

Decompiled 18 hours 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;

[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()
		{
			Physics.bounceThreshold = 0.1f;
			Collider[] array = Resources.FindObjectsOfTypeAll<Collider>();
			foreach (Collider obj in array)
			{
				obj.material.bounciness = 1f;
				obj.material.bounceCombine = (PhysicMaterialCombine)3;
				obj.material.dynamicFriction = 0f;
				obj.material.staticFriction = 0f;
				obj.material.frictionCombine = (PhysicMaterialCombine)2;
				obj.sharedMaterial.bounciness = 1f;
				obj.sharedMaterial.bounceCombine = (PhysicMaterialCombine)3;
				obj.sharedMaterial.dynamicFriction = 0f;
				obj.sharedMaterial.staticFriction = 0f;
				obj.sharedMaterial.frictionCombine = (PhysicMaterialCombine)2;
			}
			Rigidbody[] array2 = Resources.FindObjectsOfTypeAll<Rigidbody>();
			foreach (Rigidbody val in array2)
			{
				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))
				{
					val.drag = 0f;
					val.angularDrag = 0f;
					val.maxLinearVelocity = 30f;
					val.maxAngularVelocity = 30f;
					val.collisionDetectionMode = (CollisionDetectionMode)2;
					if ((Object)(object)((Component)val).gameObject.GetComponent<VelocityLimiter>() == (Object)null)
					{
						((Component)val).gameObject.AddComponent<VelocityLimiter>().rigid = val;
					}
					Item_Object componentInParent2 = ((Component)val).gameObject.GetComponentInParent<Item_Object>(true);
					if (!((Object)(object)componentInParent2 != (Object)null) || ((!((Object)(object)componentInParent != (Object)null) || componentInParent is DEN_SlugGrub) && !componentInParent2.itemData.HasTag("flashlight")))
					{
						val.isKinematic = false;
					}
				}
			}
			Item_Object[] array3 = Resources.FindObjectsOfTypeAll<Item_Object>();
			foreach (Item_Object val2 in array3)
			{
				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[] array4 = Resources.FindObjectsOfTypeAll<UT_RandomTimer>();
			foreach (UT_RandomTimer val3 in array4)
			{
				if (((Object)((Component)val3).transform).name.StartsWith("HAZ_TrashSpawner"))
				{
					val3.randomMin /= 6f;
					val3.randomMax /= 6f;
				}
			}
			Projectile obj2 = Resources.FindObjectsOfTypeAll<Projectile>().First((Projectile x) => ((Object)x).name == "HAZ_FallingTrash");
			obj2.bounceAngle = -1f;
			obj2.bounceDampen = 1.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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			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)
			{
				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), "drag")))
				{
					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.velocity;
			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 velocity = rigid.velocity;
			if (((Vector3)(ref velocity)).magnitude < 0.1f)
			{
				Vector3 val = Random.onUnitSphere * 5f;
				rigid.AddForce(val - rigid.velocity, (ForceMode)2);
			}
			else
			{
				velocity = rigid.velocity;
				if (((Vector3)(ref velocity)).magnitude < 5f)
				{
					velocity = rigid.velocity;
					Vector3 val2 = ((Vector3)(ref velocity)).normalized * 5f;
					rigid.AddForce(val2 - rigid.velocity, (ForceMode)2);
				}
			}
			AudioSource obj = source;
			velocity = rigid.velocity;
			obj.volume = Mathf.Clamp01((((Vector3)(ref velocity)).magnitude - 10f) / 20f);
			AudioSource obj2 = source;
			velocity = rigid.velocity;
			obj2.pitch = Mathf.Clamp((2f + Mathf.Clamp01((((Vector3)(ref velocity)).magnitude - 10f) / 20f) * 2f) / size, 0.1f, 15f);
			if (checkBoundsCountdown <= 0)
			{
				CheckBounds();
				checkBoundsCountdown = 8;
			}
			else
			{
				checkBoundsCountdown--;
			}
		}

		private void CheckBounds()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: 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_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: 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_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: 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_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: 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_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)WorldLoader.instance == (Object)null)
			{
				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.velocity);
				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.velocity = ((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";
	}
}