Decompiled source of NoitaPropane v1.0.0

plugins/Propane/Author.Propane.dll

Decompiled 8 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 PluginConfig.API;
using PluginConfig.API.Decorators;
using PluginConfig.API.Fields;
using PluginConfig.API.Functionals;
using Propane;
using TMPro;
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: AssemblyCompany("Author.Propane")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+7ae0e54b60791a308fb2857f7fb4d9c4b7d50756")]
[assembly: AssemblyProduct("PropaneFullName")]
[assembly: AssemblyTitle("Author.Propane")]
[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;
		}
	}
}
internal class SpawnPropane : MonoBehaviour
{
	private GameObject propane;

	private void Start()
	{
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Expected O, but got Unknown
		AssetBundle val = BundleTool.Load("main.bundle");
		string[] allAssetNames = val.GetAllAssetNames();
		foreach (string text in allAssetNames)
		{
			Plugin.Logger.LogInfo((object)text);
		}
		propane = (GameObject)val.LoadAsset("Assets/UKButtercup/Mods/Propane/Projectiles/PropaneTank/PropaneTank.prefab");
		val.Unload(false);
	}

	private void Update()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		if (Input.GetKeyDown(Configurator.key.value))
		{
			GameObject val = Object.Instantiate<GameObject>(propane);
			val.transform.position = ((Component)this).gameObject.transform.position;
			val.transform.rotation = ((Component)this).gameObject.transform.rotation;
		}
	}
}
namespace Propane
{
	public static class Configurator
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static OnClick <0>__OpenDiscord;
		}

		public static KeyCodeField key;

		public static ButtonField joinDC;

		public static PluginConfigurator CreateConfigurator()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Expected O, but got Unknown
			//IL_0096: 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_00a1: Expected O, but got Unknown
			PluginConfigurator val = PluginConfigurator.Create("NoitaPropane", "Author.Propane");
			ConfigSpace val2 = new ConfigSpace(val.rootPanel, 15f);
			key = new KeyCodeField(val.rootPanel, "Key", "key", (KeyCode)118);
			ConfigSpace val3 = new ConfigSpace(val.rootPanel, 15f);
			ConfigHeader val4 = new ConfigHeader(val.rootPanel, "Join my discord for sneak peeks,devlogs,and the possibility to test my mods early !!", 20, (TextAlignmentOptions)513);
			joinDC = new ButtonField(val.rootPanel, "Join my Discord !!¡", "join_dc");
			ButtonField obj = joinDC;
			object obj2 = <>O.<0>__OpenDiscord;
			if (obj2 == null)
			{
				OnClick val5 = OpenDiscord;
				<>O.<0>__OpenDiscord = val5;
				obj2 = (object)val5;
			}
			obj.onClick += (OnClick)obj2;
			return val;
		}

		private static void OpenDiscord()
		{
			Process.Start("http://discord.gg/PjSpcEvuB7");
		}
	}
	public class SimpleExample : MonoBehaviour
	{
		private static void Prefix(Component __instance)
		{
		}

		private static void Postfix(Component __instance)
		{
		}
	}
	public static class TranspilerExample
	{
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			int index = 0;
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].opcode == OpCodes.Call)
				{
					index = i - 3;
					break;
				}
			}
			Plugin.Logger.LogInfo((object)list[index].opcode);
			return list.AsEnumerable();
		}
	}
	[BepInPlugin("Author.Propane", "PropaneFullName", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		public static PluginConfigurator config;

		private void Awake()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin Author.Propane is loaded!");
			Harmony val = new Harmony("Author.Propane");
			val.PatchAll();
			config = Configurator.CreateConfigurator();
			SceneManager.sceneLoaded += OnSceneLoad;
		}

		private void OnSceneLoad(Scene scene, LoadSceneMode mode)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			NewMovement instance = MonoSingleton<NewMovement>.Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				GameObject val = new GameObject("propaneSpawner");
				val.transform.parent = ((Component)instance).transform;
				val.transform.position = ((Component)instance).transform.position;
				val.transform.rotation = ((Component)instance).transform.rotation;
				val.AddComponent<SpawnPropane>();
			}
		}
	}
	internal static class BundleTool
	{
		public static AssetBundle Load(string fileName)
		{
			return AssetBundle.LoadFromMemory(EmbeddedAccess.AccessFile(fileName));
		}
	}
	internal static class EmbeddedAccess
	{
		public static byte[] AccessFile(string fileName)
		{
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			byte[] array;
			using (Stream stream = executingAssembly.GetManifestResourceStream("Propane.resources." + fileName))
			{
				if (stream == null)
				{
					return null;
				}
				array = new byte[stream.Length];
				stream.Read(array, 0, array.Length);
			}
			return array;
		}

		public static Stream AccessFileStream(string fileName)
		{
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			Stream manifestResourceStream = executingAssembly.GetManifestResourceStream("Propane.resources." + fileName);
			if (manifestResourceStream == null)
			{
				return null;
			}
			return manifestResourceStream;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Author.Propane";

		public const string PLUGIN_NAME = "PropaneFullName";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}