Decompiled source of Eternal Friendly Campfire v1.0.0

MoreScouts.dll

Decompiled a month 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: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("MoreScouts")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Mod for more Players in PEAK")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1")]
[assembly: AssemblyProduct("MoreScouts")]
[assembly: AssemblyTitle("MoreScouts")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
[BepInPlugin("com.Lanx.eternalcampfire", "Eternal Campfire", "1.0.0")]
public class EternalCampfirePlugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(Campfire), "Awake")]
	private class Campfire_Awake_Patch
	{
		private static void Postfix(Campfire __instance)
		{
			__instance.burnsFor = float.PositiveInfinity;
		}
	}

	[HarmonyPatch(typeof(Campfire), "Update")]
	private class Campfire_Update_Patch
	{
		private static void Prefix(Campfire __instance)
		{
			__instance.beenBurningFor = Mathf.Min(__instance.beenBurningFor, 0f);
		}
	}

	private void Awake()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Expected O, but got Unknown
		Harmony val = new Harmony("com.yourname.eternalcampfire");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Eternal Campfire plugin loaded.");
	}
}
[BepInPlugin("com.Lanx.nohungernearcampfire", "No Hunger Near Campfire", "1.0.0")]
public class NoHungerPatchPlugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(CharacterAfflictions), "UpdateNormalStatuses")]
	private class Patch_UpdateNormalStatuses
	{
		private static bool Prefix(CharacterAfflictions __instance)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			Character component = ((Component)__instance).GetComponent<Character>();
			if ((Object)(object)component == (Object)null || !component.IsLocal || component.data.dead)
			{
				return true;
			}
			Campfire[] array = Object.FindObjectsByType<Campfire>((FindObjectsSortMode)0);
			Campfire[] array2 = array;
			foreach (Campfire val in array2)
			{
				if (Vector3.Distance(((Component)val).transform.position, component.Center) <= val.moraleBoostRadius)
				{
					return false;
				}
			}
			return true;
		}
	}

	private void Awake()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Expected O, but got Unknown
		Harmony val = new Harmony("com.yourname.nohungerpatch");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"No Hunger Near Campfire plugin loaded.");
	}
}