Decompiled source of TimeStopEnhanced v1.0.2

TimeStopEnhanced.DLL

Decompiled 5 months 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.Configuration;
using BepInEx.Logging;
using BoplFixedMath;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("TimeStopEnhanced")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Adds configurations for the Time Stop ability")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2")]
[assembly: AssemblyProduct("TimeStopEnhanced")]
[assembly: AssemblyTitle("TimeStopEnhanced")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace TimeStopEnhanced
{
	[BepInPlugin("me.antimality.TimeStopEnhanced", "TimeStopEnhanced", "1.0.2")]
	public class Plugin : BaseUnityPlugin
	{
		private static ManualLogSource logger;

		private static Harmony harmony;

		internal static ConfigEntry<float> cooldown;

		internal static ConfigEntry<float> castDuration;

		internal static ConfigEntry<float> freezeDuration;

		private void Awake()
		{
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			logger = ((BaseUnityPlugin)this).Logger;
			logger.LogInfo((object)"Plugin TimeStopEnhanced is loaded!");
			cooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Durations", "Cooldown", 8f, "The cooldown time of Time Stop. Default is 8");
			castDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Durations", "CastingDuration", 9f, "The casting duration of Time Stop. Default is 9");
			freezeDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Durations", "FreezeDuration", 10f, "The freeze duration of Time Stop. Default is 10");
			harmony = new Harmony("me.antimality.TimeStopEnhanced");
			harmony.PatchAll(typeof(Patch));
		}

		internal static void Log(object message, bool err = false)
		{
			if (err)
			{
				logger.LogError(message);
			}
			else
			{
				logger.LogInfo(message);
			}
		}

		private void OnDestroy()
		{
			harmony.UnpatchSelf();
		}
	}
	[HarmonyPatch]
	public static class Patch
	{
		[HarmonyPatch(typeof(CastSpell), "Init")]
		[HarmonyPostfix]
		public static void ModifyAbility(ref GameObject ___spell, ref Fix ___castTime, ref Ability ___ability)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			if (((Object)___spell).name == "TimeStopSphere")
			{
				___castTime = (Fix)Plugin.castDuration.Value;
				___ability.Cooldown = (Fix)Plugin.cooldown.Value;
			}
		}

		[HarmonyPatch(typeof(TimeStop), "Init")]
		[HarmonyPostfix]
		public static void FreezeDuration(ref float ___duration)
		{
			___duration = Plugin.freezeDuration.Value;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "TimeStopEnhanced";

		public const string PLUGIN_NAME = "TimeStopEnhanced";

		public const string PLUGIN_VERSION = "1.0.2";
	}
}