Decompiled source of ShorterInverseTeleporterCooldown v1.0.0

ShorterInverseTeleporterCooldown.dll

Decompiled 7 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.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using ShorterInverseTeleporterCooldown.NetcodePatcher;
using ShorterInverseTeleporterCooldown.patch;

[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("ShorterInverseTeleporterCooldown")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.0.0.0")]
[assembly: AssemblyInformationalVersion("0.0.0-alpha.0")]
[assembly: AssemblyProduct("ShorterInverseTeleporterCooldown")]
[assembly: AssemblyTitle("ShorterInverseTeleporterCooldown")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[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 ShorterInverseTeleporterCooldown
{
	public class Config
	{
		public ConfigEntry<int> InverseTeleportCooldown;

		public Config(BaseUnityPlugin plugin)
		{
			InverseTeleportCooldown = plugin.Config.Bind<int>("Inverse Teleporter Cooldown", "Cooldown Length", 20, "The time (in SECONDS) it takes for the inverse teleporter to recharge.");
			ClearUnusedEntries(plugin);
		}

		private void ClearUnusedEntries(BaseUnityPlugin plugin)
		{
			PropertyInfo property = ((object)plugin.Config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic);
			Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(plugin.Config, null);
			dictionary.Clear();
			plugin.Config.Save();
		}
	}
	[BepInPlugin("Arvem.ShorterInverseTeleporterCooldown", "ShorterInverseTeleporterCooldown", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony _harmony = new Harmony("Arvem.ShorterInverseTeleporterCooldown");

		public static Plugin Instance { get; set; }

		internal static Config BoundConfig { get; private set; }

		public static ManualLogSource Log => ((BaseUnityPlugin)Instance).Logger;

		public Plugin()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			Instance = this;
		}

		private void Awake()
		{
			BoundConfig = new Config((BaseUnityPlugin)(object)this);
			Log.LogInfo((object)"Applying patches...");
			ApplyPluginPatch();
			Log.LogInfo((object)"Patches applied");
		}

		private void ApplyPluginPatch()
		{
			_harmony.PatchAll(typeof(CooldownPatch));
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "ShorterInverseTeleporterCooldown";

		public const string PLUGIN_NAME = "ShorterInverseTeleporterCooldown";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace ShorterInverseTeleporterCooldown.patch
{
	[HarmonyPatch(typeof(ShipTeleporter))]
	public class CooldownPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void ChangeCooldown(bool ___isInverseTeleporter, ref float ___cooldownAmount)
		{
			if (___isInverseTeleporter)
			{
				___cooldownAmount = Plugin.BoundConfig.InverseTeleportCooldown.Value;
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace ShorterInverseTeleporterCooldown.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}