Decompiled source of ShieldInfo v1.0.0

ShieldInfo.dll

Decompiled 7 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("ShieldInfo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ShieldInfo")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("92D30F94-D8D3-412E-9BEE-3227EB1B1FBE")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ShieldInfo;

[BepInPlugin("org.ssmvc.shieldinfo", "ShieldInfo", "1.0.0")]
public class ShieldInfo : BaseUnityPlugin
{
	[HarmonyPatch(typeof(ShieldGenerator), "GetHoverText")]
	private static class ShieldShowTimer
	{
		public static void Postfix(ShieldGenerator __instance, ref string __result, ref float ___m_lastFuel)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Color domeColor = ShieldDomeImageEffect.GetDomeColor(___m_lastFuel);
			__result += $"Power Remaining: <color=#{ColorUtility.ToHtmlStringRGB(domeColor)}><b>{__instance.GetFuelRatio() * 100f:0.00}%</b></color>";
		}
	}

	public const string PluginGUID = "org.ssmvc.shieldinfo";

	public const string PluginName = "ShieldInfo";

	public const string PluginVersion = "1.0.0";

	private static ManualLogSource _logger;

	private Harmony _harmony;

	private void Awake()
	{
		_logger = ((BaseUnityPlugin)this).Logger;
		_harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "org.ssmvc.shieldinfo");
	}

	private void OnDestroy()
	{
		Harmony harmony = _harmony;
		if (harmony != null)
		{
			harmony.UnpatchSelf();
		}
	}
}