Decompiled source of InfiniteEnergy v1.0.0

RepoInfiniteEnergy.dll

Decompiled 18 minutes ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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("RepoInfiniteEnergy")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RepoInfiniteEnergy")]
[assembly: AssemblyTitle("RepoInfiniteEnergy")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 RepoInfiniteEnergy
{
	public sealed class InfiniteEnergyRunner : MonoBehaviour
	{
		private void LateUpdate()
		{
			if (Plugin.Enabled.Value)
			{
				PlayerController instance = PlayerController.instance;
				if (!((Object)(object)instance == (Object)null))
				{
					instance.DebugEnergy = true;
					instance.EnergyCurrent = instance.EnergyStart;
				}
			}
		}
	}
	[BepInPlugin("com.sangbigye.repoinfiniteenergy", "REPO Infinite Energy", "1.0.0")]
	public sealed class Plugin : BaseUnityPlugin
	{
		public const string Guid = "com.sangbigye.repoinfiniteenergy";

		public const string Name = "REPO Infinite Energy";

		public const string Version = "1.0.0";

		internal static ManualLogSource Log;

		internal static ConfigEntry<bool> Enabled;

		private void Awake()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Local client only: sprinting, sliding and climbing never consume energy. Installing on the host affects only the host player; no RPC and no host requirement.");
			if (!Enabled.Value)
			{
				Log.LogInfo((object)"REPO Infinite Energy 1.0.0 loaded but disabled; edit cfg and restart to enable.");
				return;
			}
			new Harmony("com.sangbigye.repoinfiniteenergy").PatchAll(typeof(Plugin).Assembly);
			GameObject val = new GameObject("RepoInfiniteEnergy.Runner");
			Object.DontDestroyOnLoad((Object)val);
			((Object)val).hideFlags = (HideFlags)61;
			val.AddComponent<InfiniteEnergyRunner>();
			Log.LogInfo((object)"REPO Infinite Energy 1.0.0 loaded (local client only).");
		}
	}
	[HarmonyPatch(typeof(PlayerController), "Start")]
	internal static class PlayerControllerStartPatch
	{
		private static void Postfix(PlayerController __instance)
		{
			if (Plugin.Enabled.Value)
			{
				__instance.DebugEnergy = true;
			}
		}
	}
	[HarmonyPatch(typeof(EnergyUI), "Update")]
	internal static class EnergyUIUpdatePatch
	{
		private static void Prefix()
		{
			if (Plugin.Enabled.Value)
			{
				PlayerController instance = PlayerController.instance;
				if (!((Object)(object)instance == (Object)null))
				{
					instance.DebugEnergy = true;
					instance.EnergyCurrent = instance.EnergyStart;
				}
			}
		}
	}
}