Decompiled source of Campfire Refuel v1.0.0

CampfireRefuel.dll

Decompiled 2 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("CampfireRefuel")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CampfireRefuel")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1C6F139B-D451-4327-BCEA-A82A0E66DE5C")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 CampfireRefuel
{
	[BepInPlugin("HnskNoah.CampfireRefuel", "Campfire Refuel", "1.0.0")]
	public class CampfireRefuel : BaseUnityPlugin
	{
		public static bool Signal;

		public static ConfigEntry<bool> ConfigEnabled;

		private void Awake()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			ConfigEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable Refuel", true, "是否启用篝火点燃时回满提灯燃料的功能");
			new Harmony("HnskNoah.CampfireRefuel").PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Campfire Refuel Loaded with Toggle Support!");
		}

		private void LateUpdate()
		{
			Signal = false;
		}
	}
	[HarmonyPatch(typeof(Campfire), "Light_Rpc")]
	public static class Patch_Campfire
	{
		private static void Postfix()
		{
			CampfireRefuel.Signal = true;
		}
	}
	[HarmonyPatch(typeof(Lantern), "Update")]
	public static class Patch_Lantern
	{
		private static void Postfix(Lantern __instance, ref float ___fuel)
		{
			if (CampfireRefuel.Signal)
			{
				___fuel = __instance.startingFuel;
				if ((Object)(object)((ItemComponent)__instance).item != (Object)null)
				{
					((ItemComponent)__instance).item.SetUseRemainingPercentage(1f);
				}
				((ItemComponent)__instance).item.GetData<FloatItemData>((DataEntryKey)10).Value = __instance.startingFuel;
			}
		}
	}
}