Decompiled source of Bridgebreaker v1.0.0

Bridgebreaker.dll

Decompiled 2 days ago
using System;
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;
using UnityEngine.SceneManagement;

[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: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("Bridgebreaker")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Makes the collapsing bridge in 2-1 breakable by explosions again.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Bridgebreaker")]
[assembly: AssemblyTitle("Bridgebreaker")]
[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 Bridgebreaker
{
	[BepInPlugin("com.earthlingOnFire.Bridgebreaker", "Bridgebreaker", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string PLUGIN_GUID = "com.earthlingOnFire.Bridgebreaker";

		public const string PLUGIN_NAME = "Bridgebreaker";

		public const string PLUGIN_VERSION = "1.0.0";

		public static ManualLogSource logger;

		private void Awake()
		{
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			logger = ((BaseUnityPlugin)this).Logger;
			SceneManager.sceneLoaded += OnSceneLoaded;
		}

		private void Start()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			new Harmony("com.earthlingOnFire.Bridgebreaker").PatchAll();
			logger.LogInfo((object)"Plugin com.earthlingOnFire.Bridgebreaker is loaded!");
		}

		public static void Log(string msg)
		{
			logger.LogInfo((object)msg);
		}

		public static GameObject FindGameObject(string gameObjectPath)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find(gameObjectPath);
			if ((Object)(object)val != (Object)null)
			{
				return val;
			}
			Scene activeScene = SceneManager.GetActiveScene();
			GameObject[] rootGameObjects = ((Scene)(ref activeScene)).GetRootGameObjects();
			string[] parts = gameObjectPath.Split(new char[1] { '/' }, StringSplitOptions.RemoveEmptyEntries);
			for (int i = 0; i < parts.Length; i++)
			{
				parts[i] = parts[i].Replace("%", "/");
			}
			int num = Array.FindIndex(rootGameObjects, (GameObject o) => ((Object)o).name == parts[0]);
			if (num == -1)
			{
				return null;
			}
			GameObject val2 = rootGameObjects[num];
			if (parts.Length == 1)
			{
				return val2;
			}
			string[] array = new string[parts.Length - 1];
			Array.Copy(parts, 1, array, 0, array.Length);
			string text = string.Join("/", array);
			Transform obj = val2.transform.Find(text);
			return (obj != null) ? ((Component)obj).gameObject : null;
		}

		public static T[] AppendToArray<T>(T[] array, T element)
		{
			if (array == null || array.Length == 0)
			{
				return new T[1] { element };
			}
			T[] array2 = new T[array.Length + 1];
			for (int i = 0; i < array.Length; i++)
			{
				array2[i] = array[i];
			}
			array2[array.Length] = element;
			return array2;
		}

		public void OnSceneLoaded(Scene s, LoadSceneMode _)
		{
			if (!(SceneHelper.CurrentScene != "Level 2-1"))
			{
				Breakable component = FindGameObject("3-4 - Outdoors Arenas/3-4 Stuff/Droppable/").GetComponent<Breakable>();
				component.unbreakable = false;
				component.activateOnBreak = AppendToArray(component.activateOnBreak, FindGameObject("3-4 - Outdoors Arenas/3-4 Stuff/Drop Droppable/RopeSnap"));
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "Bridgebreaker";

		public const string PLUGIN_NAME = "Bridgebreaker";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		internal IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}