Decompiled source of DisplayRealCooldowns v0.0.1

DisplayRealCooldowns.dll

Decompiled 7 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 Characters.Cooldowns;
using Characters.Gear.Quintessences;
using Characters.Gear.Weapons;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UI.Inventory;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Plugins.Singletons")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: AssemblyCompany("DisplayRealCooldowns")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Displays the real cooldown time for skills and quintessences")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1")]
[assembly: AssemblyProduct("DisplayRealCooldowns")]
[assembly: AssemblyTitle("DisplayRealCooldowns")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.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 DisplayRealCooldowns
{
	[HarmonyPatch]
	public class DisplayRealCooldownsPatch
	{
		private static Color RGBColor(int r, int g, int b)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			return new Color((float)r / 255f, (float)g / 255f, (float)b / 255f);
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(QuintessenceOption), "Set")]
		private static void DisplayRealQuintCooldown(ref QuintessenceOption __instance, ref Quintessence essence)
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			Time time = essence.cooldown.time;
			float num = time.cooldownTime / time.GetCooldownSpeed();
			__instance._cooldown.text = num.ToString(((double)num > 9.9) ? "0" : "0.#");
			if (((object)time).ToString() == __instance._cooldown.text)
			{
				__instance._cooldown.color = RGBColor(134, 97, 90);
				return;
			}
			TMP_Text cooldown = __instance._cooldown;
			float num2 = time.GetCooldownSpeed();
			Color color = ((num2 > 1f) ? RGBColor(82, 143, 67) : ((!(num2 < 1f)) ? RGBColor(134, 97, 90) : RGBColor(186, 51, 44)));
			cooldown.color = color;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(SkillOption), "Set")]
		private static void DisplayRealSkillCooldown(ref SkillOption __instance, ref SkillInfo skillDescInfo)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Invalid comparison between Unknown and I4
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance._cooldown == (Object)null)
			{
				return;
			}
			CooldownSerializer cooldown = skillDescInfo.action.cooldown;
			if ((int)cooldown.type == 1)
			{
				Time time = cooldown.time;
				float num = time.cooldownTime / time.GetCooldownSpeed();
				((TMP_Text)__instance._cooldown._text).text = num.ToString(((double)num > 9.9) ? "0" : "0.#");
				if (((object)time).ToString() == ((TMP_Text)__instance._cooldown._text).text)
				{
					((TMP_Text)__instance._cooldown._text).color = RGBColor(68, 51, 68);
					return;
				}
				TextMeshProUGUI text = __instance._cooldown._text;
				float num2 = time.GetCooldownSpeed();
				Color color = ((num2 > 1f) ? RGBColor(37, 149, 33) : ((!(num2 < 1f)) ? RGBColor(68, 51, 68) : RGBColor(186, 24, 33)));
				((TMP_Text)text).color = color;
			}
		}
	}
	[BepInPlugin("DisplayRealCooldowns", "DisplayRealCooldowns", "0.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		private void Awake()
		{
			Harmony.CreateAndPatchAll(typeof(DisplayRealCooldownsPatch), (string)null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Mod DisplayRealCooldowns is loaded!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "DisplayRealCooldowns";

		public const string PLUGIN_NAME = "DisplayRealCooldowns";

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