BepInEx\plugins\Warm.dll

Decompiled a week ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
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.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("Warm")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+f81c75f162755c0879cdf7e9d1ec2fd64cf0c52c")]
[assembly: AssemblyProduct("Warm")]
[assembly: AssemblyTitle("Warm")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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]
	[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 Warm
{
	[HarmonyPatch(typeof(SEMan), "Internal_AddStatusEffect")]
	internal static class BlockColdPatch
	{
		private static bool Prefix(SEMan __instance, int nameHash)
		{
			if (nameHash != SEMan.s_statusEffectCold && nameHash != SEMan.s_statusEffectFreezing)
			{
				return true;
			}
			Player localPlayer = Player.m_localPlayer;
			if (!Object.op_Implicit((Object)(object)localPlayer))
			{
				return true;
			}
			if (__instance != ((Character)localPlayer).GetSEMan())
			{
				return true;
			}
			return false;
		}
	}
	[BepInPlugin("matthb1.warm", "Warm", "1.0.0")]
	public class Warm : BaseUnityPlugin
	{
		public const string GUID = "matthb1.warm";

		public const string NAME = "Warm";

		public const string VERSION = "1.0.0";

		private void Awake()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Warm 1.0.0 loaded - blocking Cold and Freezing on local player.");
			new Harmony("matthb1.warm").PatchAll();
		}

		private void Update()
		{
			Player localPlayer = Player.m_localPlayer;
			if (!Object.op_Implicit((Object)(object)localPlayer))
			{
				return;
			}
			SEMan sEMan = ((Character)localPlayer).GetSEMan();
			if (sEMan != null)
			{
				if (sEMan.HaveStatusEffect(SEMan.s_statusEffectCold))
				{
					sEMan.RemoveStatusEffect(SEMan.s_statusEffectCold, true);
				}
				if (sEMan.HaveStatusEffect(SEMan.s_statusEffectFreezing))
				{
					sEMan.RemoveStatusEffect(SEMan.s_statusEffectFreezing, true);
				}
			}
		}
	}
}