Decompiled source of DynamicSpeedup v1.0.2

DynamicSpeedup.dll

Decompiled 2 weeks 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 Battle;
using BepInEx;
using Microsoft.CodeAnalysis;
using On;
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("DynamicSpeedup")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Speeds up enemy turns")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2")]
[assembly: AssemblyProduct("DynamicSpeedup")]
[assembly: AssemblyTitle("DynamicSpeedup")]
[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 DynamicSpeedup
{
	[BepInPlugin("DynamicSpeedup", "DynamicSpeedup", "1.0.2")]
	public class Plugin : BaseUnityPlugin
	{
		private float _userSpeedupMultiplier = 2.5f;

		private void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			TimescaleManager.Update += new hook_Update(TimescaleManagerOnUpdate);
			_userSpeedupMultiplier = Mathf.Max(((BaseUnityPlugin)this).Config.Bind<float>("General", "Speedup Multiplier", 2.5f, "Enemy turn speedup multiplier on top of base speedup amount. 2.5 multiplier with 2x speedup means enemy turns run at 5x speed").Value, 1f);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin DynamicSpeedup is loaded!");
		}

		private void OnDestroy()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			TimescaleManager.Update -= new hook_Update(TimescaleManagerOnUpdate);
		}

		private void TimescaleManagerOnUpdate(orig_Update orig, TimescaleManager self)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Invalid comparison between Unknown and I4
			orig.Invoke(self);
			if ((self._isSpedUp || self._isSpedUpManualToggle) && !(_userSpeedupMultiplier < 1f) && !self._speedupToggleBlocked && !PauseMenu.Paused)
			{
				BattleState currentBattleState = BattleController.CurrentBattleState;
				float speedupLevel = SettingsManager.Instance.SpeedupLevel;
				if ((int)currentBattleState == 6)
				{
					Time.timeScale = _userSpeedupMultiplier * speedupLevel;
				}
				else
				{
					Time.timeScale = speedupLevel;
				}
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "DynamicSpeedup";

		public const string PLUGIN_NAME = "DynamicSpeedup";

		public const string PLUGIN_VERSION = "1.0.2";
	}
}