Decompiled source of EternalLights v1.0.0

plugins\TeflonTed.EternalLights.dll

Decompiled 20 hours 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 HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("assembly_guiutils")]
[assembly: IgnoresAccessChecksTo("assembly_utils")]
[assembly: IgnoresAccessChecksTo("assembly_valheim")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("TeflonTed.EternalLights")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Teflon Ted's Eternal Lights — lighting pieces never need refueling")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+39bcedc5efe8a2734ce8d395526710a44cca1e05")]
[assembly: AssemblyProduct("TeflonTed.EternalLights")]
[assembly: AssemblyTitle("TeflonTed.EternalLights")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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 TeflonTed.EternalLights
{
	[BepInPlugin("com.teflonted.valheim.eternallights", "Teflon Ted's Eternal Lights", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "com.teflonted.valheim.eternallights";

		public const string PluginName = "Teflon Ted's Eternal Lights";

		public const string PluginVersion = "1.0.0";

		private void Awake()
		{
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "com.teflonted.valheim.eternallights");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Teflon Ted's Eternal Lights 1.0.0 loaded");
		}
	}
	[HarmonyPatch(typeof(Fireplace), "UpdateFireplace")]
	internal static class Fireplace_UpdateFireplace_Patch
	{
		private static void Postfix(Fireplace __instance, ZNetView ___m_nview)
		{
			if (!((Object)(object)__instance == (Object)null) && !((Object)(object)___m_nview == (Object)null) && ___m_nview.IsValid() && ___m_nview.IsOwner())
			{
				float maxFuel = __instance.m_maxFuel;
				if (!(maxFuel <= 0f) && ___m_nview.GetZDO().GetFloat("fuel", 0f) < maxFuel)
				{
					___m_nview.GetZDO().Set("fuel", maxFuel);
				}
			}
		}
	}
	[HarmonyPatch(typeof(Fireplace), "IsBurning")]
	internal static class Fireplace_IsBurning_Patch
	{
		private static void Postfix(Fireplace __instance, ref bool __result)
		{
			if (!__result && !((Object)(object)__instance == (Object)null) && __instance.m_maxFuel > 0f)
			{
				__result = true;
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}