Decompiled source of GlitchRestore v0.1.0

GlitchRestore.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
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("GlitchRestore")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Patch speedrun glitches from the speedrun branch back into the main branch game.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+75c78c5645975a9d55024f4204b60d2e90af479b")]
[assembly: AssemblyProduct("GlitchRestore")]
[assembly: AssemblyTitle("GlitchRestore")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 GlitchRestore
{
	internal static class Log
	{
		private static ManualLogSource? logSource;

		internal static void Init(ManualLogSource logSource)
		{
			Log.logSource = logSource;
		}

		internal static void Debug(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogDebug(data);
			}
		}

		internal static void Error(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogError(data);
			}
		}

		internal static void Fatal(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogFatal(data);
			}
		}

		internal static void Info(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogInfo(data);
			}
		}

		internal static void Message(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogMessage(data);
			}
		}

		internal static void Warning(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogWarning(data);
			}
		}
	}
	[BepInPlugin("com.kobold60.glitchrestore", "Glitch Restore", "0.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(PlayerHurtState), "OnStateEnter")]
		internal static class RopeRestore
		{
			private static void Prefix(Player ___player, out ClimbableRope __state)
			{
				__state = ___player.touchingRope;
			}

			private static void Postfix(ClimbableRope __state, ref Player ___player)
			{
				if ((Object)(object)__state != (Object)null)
				{
					___player.touchingRope = __state;
				}
			}
		}

		[HarmonyPatch(typeof(Player), "OnTakeInvincibleHit")]
		internal static class DamageRespawnRestore
		{
			private static bool Prefix(DamageDealer damageDealer, Player __instance)
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				if (__instance.IsCurrentState((PlayerStateType)30) && !damageDealer.parriable)
				{
					_ = damageDealer.type;
				}
				return false;
			}
		}

		private Harmony harmony;

		private void Awake()
		{
			Log.Init(((BaseUnityPlugin)this).Logger);
			RCGLifeCycle.DontDestroyForever(((Component)this).gameObject);
			harmony = Harmony.CreateAndPatchAll(typeof(Plugin).Assembly, (string)null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin com.kobold60.glitchrestore is loaded!");
		}

		private void OnDestroy()
		{
			harmony.UnpatchSelf();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "GlitchRestore";

		public const string PLUGIN_NAME = "GlitchRestore";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}