Decompiled source of FuelBurnModifier v1.0.2

FuelBurnModifier.dll

Decompiled 2 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 BepInEx.Configuration;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using SSSGame;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("blacks7ar")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.2")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("FuelBurnModifier")]
[assembly: AssemblyTitle("FuelBurnModifier")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 FuelBurnModifier
{
	[BepInPlugin("blacks7ar.FuelBurnModifier", "FuelBurnModifier", "1.0.2")]
	public class Plugin : BasePlugin
	{
		[HarmonyPatch]
		private static class Patch
		{
			[HarmonyPriority(0)]
			[HarmonyPrefix]
			[HarmonyPatch(typeof(FireStructure), "Initialize")]
			private static void Initialize_Prefix(FireStructure __instance)
			{
				if (!((Object)(object)__instance == (Object)null) && !((Object)((Component)__instance).gameObject).name.Contains("Pyre"))
				{
					float fuelBurnVolumePerSecond = __instance.fuelBurnVolumePerSecond * _fuelBurnMultiplier.Value;
					__instance.fuelBurnVolumePerSecond = fuelBurnVolumePerSecond;
					float windToBurnRateFactor = __instance.windToBurnRateFactor;
					int num = ((!(_fuelBurnMultiplier.Value <= 0f)) ? 1 : 0);
					__instance.windToBurnRateFactor = windToBurnRateFactor * (float)num;
				}
			}
		}

		private const string modGUID = "blacks7ar.FuelBurnModifier";

		public const string modName = "FuelBurnModifier";

		public const string modAuthor = "blacks7ar";

		public const string modVersion = "1.0.2";

		private static ManualLogSource FLogger;

		private static ConfigEntry<float> _fuelBurnMultiplier;

		public override void Load()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			FLogger = ((BasePlugin)this).Log;
			FLogger.LogInfo((object)"Mod loaded!");
			_fuelBurnMultiplier = ((BasePlugin)this).Config.Bind<float>("General", "Multiplier", 0.5f, "Fuel burn multiplier. (1 = normal rate, 0.5 = 50% less burn rate, 2 = double burn rate, 0 = infinite fuel)");
			new Harmony("blacks7ar.FuelBurnModifier").PatchAll();
		}
	}
}