Decompiled source of ReversePeak v1.0.0

com.github.CoddingCat.ReversePeak.dll

Decompiled 4 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
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.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.github.CoddingCat.ReversePeak")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("com.github.CoddingCat.ReversePeak")]
[assembly: AssemblyTitle("ReversePeak")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.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 BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace ReversePeak
{
	[BepInPlugin("com.github.CoddingCat.ReversePeak", "ReversePeak", "0.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string Id = "com.github.CoddingCat.ReversePeak";

		internal static ManualLogSource Log { get; private set; }

		public static string Name => "ReversePeak";

		public static string Version => "0.1.0";

		private void Awake()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)("Plugin " + Name + " is loaded!"));
			Harmony val = new Harmony("com.reversepeak.spawnpatch");
			val.PatchAll();
		}
	}
	[HarmonyPatch]
	public static class SpawnPoint_Awake_Patch
	{
		[HarmonyPatch(typeof(SpawnPoint), "Awake")]
		[HarmonyPostfix]
		public static void Postfix(SpawnPoint __instance)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			Transform parent = ((Component)__instance).transform.parent;
			if ((Object)(object)parent != (Object)null && ((Object)parent).name == "SpawnPoints")
			{
				parent.position = new Vector3(0.2466f, 1234.4f, 2614.4f);
				Plugin.Log.LogInfo((object)"Moved SpawnPoints via SpawnPoint.Awake()");
			}
		}
	}
	[HarmonyPatch(typeof(RunManager), "StartRun")]
	internal class Patch_StartRun
	{
		private static void Postfix()
		{
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = GameObject.Find("crashed plane");
			Transform val = ((obj != null) ? obj.transform : null);
			if ((Object)(object)val == (Object)null)
			{
				Plugin.Log.LogError((object)"Could not find 'crashed plane' object.");
				return;
			}
			List<string> list = new List<string> { "Bugle_Spawner", "Lantern_Spawner", "Backpack_Spawner", "Flare_Spawner", "Frisbee_Spawner", "Binocular_Spawner", "Compass_Spawner", "BingBong_Spawner", "Guidebook_Spawner" };
			Transform val2 = val.Find("BingBong_Spawner");
			if ((Object)(object)val2 == (Object)null)
			{
				Plugin.Log.LogError((object)"Could not find 'BingBong_Spawner' on plane.");
				return;
			}
			Vector3 position = val2.position;
			Quaternion rotation = val2.rotation;
			foreach (string item in list)
			{
				Transform val3 = val.Find(item);
				if ((Object)(object)val3 == (Object)null)
				{
					Plugin.Log.LogWarning((object)("Spawner '" + item + "' not found under plane."));
					continue;
				}
				val3.position = position + new Vector3(1f, 0f, 0f);
				val3.rotation = rotation;
				SingleItemSpawner component = ((Component)val3).GetComponent<SingleItemSpawner>();
				if ((Object)(object)component == (Object)null)
				{
					Plugin.Log.LogWarning((object)("Spawner '" + item + "' found but has no SingleItemSpawner component."));
					continue;
				}
				component.TrySpawnItems();
				Plugin.Log.LogInfo((object)("Spawner '" + item + "' moved and triggered successfully."));
			}
		}
	}
	[HarmonyPatch(typeof(MapHandler), "Start")]
	internal class Patch_MapHandler_Start
	{
		private static void Prefix(MapHandler __instance)
		{
			//IL_0044: 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_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: 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_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = GameObject.Find("Map/Biome_1/Beach/Beach_Segment/crashed plane");
			Transform val = ((obj != null) ? obj.transform : null);
			if ((Object)(object)val != (Object)null)
			{
				((Component)val).gameObject.SetActive(true);
				val.position = new Vector3(18.4318f, 1228.185f, 2243.31f);
				val.rotation = Quaternion.Euler(350.6465f, 292.1136f, 17.6748f);
				val.localScale = Vector3.one;
				Transform val2 = val.Find("front half");
				if ((Object)(object)val2 != (Object)null)
				{
					val2.localPosition = new Vector3(-6.04102f, -0.7368f, -13.1928f);
					val2.localRotation = Quaternion.Euler(-133.955f, -135.659f, 103.681f);
				}
				Transform val3 = val.Find("LuggageSmall");
				Transform val4 = val.Find("LuggageSmall (1)");
				Transform val5 = val.Find("LuggageSmall (2)");
				Transform val6 = val.Find("LuggageBig");
				if ((Object)(object)val3 != (Object)null)
				{
					val3.localPosition = new Vector3(-5.10147f, 1.244684f, 1.068615f);
					val3.localRotation = Quaternion.Euler(-10.378f, -47.631f, -2.4f);
				}
				if ((Object)(object)val4 != (Object)null)
				{
					val4.localPosition = new Vector3(-1.52f, 0.72f, 0.3f);
					val4.localRotation = Quaternion.Euler(11.27f, 40.564f, -8.48f);
				}
				if ((Object)(object)val5 != (Object)null)
				{
					val5.localPosition = new Vector3(-13.11712f, -2.00155f, -8.97529f);
					val5.localRotation = Quaternion.Euler(14.69f, 35.43f, -22.053f);
				}
				if ((Object)(object)val6 != (Object)null)
				{
					val6.localPosition = new Vector3(0.04339f, -0.82046f, -7.45413f);
					val6.localRotation = Quaternion.Euler(32.705f, 126.028f, 17.405f);
				}
				val.SetParent((Transform)null, true);
				Plugin.Log.LogInfo((object)"[Mod] Plane moved and unparented successfully.");
			}
			else
			{
				Plugin.Log.LogError((object)"[Mod] Could not find the crashed plane at the expected path.");
			}
		}
	}
	[HarmonyPatch(typeof(CharacterClimbing), "GetRequestedPostition")]
	internal class Patch_GetRequestedPostition
	{
		private static bool Prefix(CharacterClimbing __instance, ref Vector3 __result)
		{
			//IL_002b: 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_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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: 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_00a5: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: 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)
			//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_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: 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_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: 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)
			FieldInfo field = typeof(CharacterClimbing).GetField("character", BindingFlags.Instance | BindingFlags.NonPublic);
			object? value = field.GetValue(__instance);
			Character val = (Character)((value is Character) ? value : null);
			Vector3 climbNormal = val.data.climbNormal;
			Vector3 climbPos = val.data.climbPos;
			Vector2 movementInput = val.input.movementInput;
			float staminaMod = val.data.staminaMod;
			Vector3 val2 = Vector3.ProjectOnPlane(Vector3.up, climbNormal);
			Vector3 normalized = ((Vector3)(ref val2)).normalized;
			val2 = Vector3.Cross(normalized, climbNormal);
			Vector3 normalized2 = ((Vector3)(ref val2)).normalized;
			float num = movementInput.y * staminaMod;
			float num2 = movementInput.x * staminaMod;
			Vector3 val3 = normalized * num - normalized2 * num2;
			__instance.playerSlide *= 0.97f;
			__instance.playerSlide = Vector2.MoveTowards(__instance.playerSlide, Vector2.zero, Time.fixedDeltaTime * 15f);
			Vector3 val4 = __instance.playerSlide.y * normalized + __instance.playerSlide.x * -normalized2;
			Vector3 val5 = val3 + val4;
			__result = climbPos + val5 * (__instance.climbSpeed * Time.fixedDeltaTime * __instance.climbSpeedMod);
			return false;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}