Decompiled source of FrostBeGone v1.0.0

FrostBeGone.dll

Decompiled 2 weeks ago
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("FrostBeGone")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FrostBeGone")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("bf060bdf-c5fa-43c8-8cdf-0ecc83b91da7")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace FrostBeGone;

[BepInPlugin("org.ssmvc.frostbegone", "FrostBeGone", "1.0.0")]
[BepInProcess("valheim.exe")]
public class FrostBeGone : BaseUnityPlugin
{
	[HarmonyPatch(typeof(EffectList))]
	private static class EffectListPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Create")]
		public static void CreatePostfix(EffectList __instance, Vector3 basePos, Quaternion baseRot, Transform baseParent, float scale, int variant, GameObject[] __result)
		{
			if (!Enabled.Value)
			{
				return;
			}
			foreach (GameObject item in __result.Where((GameObject e) => ((Object)e).name.StartsWith("vfx_Frost")))
			{
				if (baseParent != ((Component)Player.m_localPlayer).transform)
				{
					item.SetActive(false);
				}
			}
		}
	}

	public const string PluginGUID = "org.ssmvc.frostbegone";

	public const string PluginName = "FrostBeGone";

	public const string PluginVersion = "1.0.0";

	private static Harmony _harmony;

	public static ConfigEntry<bool> Enabled { get; set; }

	public void Awake()
	{
		_harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "org.ssmvc.frostbegone");
		Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("_Global", "isModEnabled", true, "Globally enable or disable this mod.");
	}

	public void OnDestroy()
	{
		Harmony harmony = _harmony;
		if (harmony != null)
		{
			harmony.UnpatchSelf();
		}
	}
}