Decompiled source of FrankysAircraftDamageRemover v1.1.0

FrankysAircraftDamageRemover.dll

Decompiled 20 hours ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Configuration;
using BepInExPlugin;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("FrankysAircraftDamageRemover (FrankysAircraftDamageRemover)")]
[assembly: AssemblyProduct("FrankysAircraftDamageRemover")]
[assembly: AssemblyVersion("1.0.0.0")]
[HarmonyPatch(typeof(Health), "Awake")]
public static class HealthOverride
{
	private static void Prefix(Health __instance)
	{
		FieldInfo fieldInfo = AccessTools.Field(typeof(Health), "_maxHealth");
		if ((object)fieldInfo == null)
		{
			Debug.LogError((object)"maxHealthField not valid yet");
			return;
		}
		float value = Plugin.ConfigValue.Value;
		fieldInfo.SetValue(__instance, value);
		Debug.Log((object)$"Aircraft Health Modified to {Plugin.ConfigValue.Value}");
	}
}
namespace BepInExPlugin;

[BepInPlugin("FrankysAircraftDamageRemover", "FrankysAircraftDamageRemover", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public static ConfigEntry<float> ConfigValue;

	private void Awake()
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Expected O, but got Unknown
		ConfigValue = ((BaseUnityPlugin)this).Config.Bind<float>("Aircraft", "Health", 100f, "Sets the aircraft health. Try to keep it whole numbers (Ex. 100, 400, 10000)");
		Harmony val = new Harmony("FrankysAircraftDamageRemover");
		val.PatchAll();
		Debug.Log((object)"FrankysAircraftDamageRemover loaded");
	}
}
internal static class PluginInfo
{
	public const string PLUGIN_NAME = "FrankysAircraftDamageRemover";

	public const string PLUGIN_ID = "FrankysAircraftDamageRemover";

	public const string PLUGIN_VERSION = "1.0.0";
}