Decompiled source of PartyPooper v1.0.0

plugins/PartyPooper.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PartyPooper.Patches;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("LethalCompanyModding")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A lethal company mod to remove the party hat. Good for people using custom models\r\n      or party poopers that hate fun")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+138fde5140dfd114567b0fdaf45fb3e6506adbbe")]
[assembly: AssemblyProduct("PartyPooper")]
[assembly: AssemblyTitle("dev.mamallama.lcm.partypooper")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/RobynLlama/PartyPooper")]
[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.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]
	[Microsoft.CodeAnalysis.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]
	[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;
		}
	}
}
public static class PlayerControllerB_Ext
{
	public static void RemovePartyHat(this PlayerControllerB target)
	{
		Transform val = ((Component)target).transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/spine.004/HatContainer/PartyHatContainer(Clone)/BirthdayHat");
		Transform val2 = ((Component)target).transform.Find("ScavengerModel/metarig/CameraContainer/MainCamera/HatContainerLocal/PartyHatContainer(Clone)/BirthdayHat");
		if ((Object)(object)val != (Object)null)
		{
			Plugin.Log.LogMessage((object)("Removing hat root from player " + ((Object)target).name));
			((Component)val).gameObject.SetActive(false);
		}
		if ((Object)(object)val2 != (Object)null)
		{
			Plugin.Log.LogMessage((object)("Removing local hat root from player " + ((Object)target).name));
			((Component)val2).gameObject.SetActive(false);
		}
	}
}
[BepInPlugin("dev.mamallama.lcm.partypooper", "PartyPooper", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public static ManualLogSource Log;

	private void Awake()
	{
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Expected O, but got Unknown
		Log = ((BaseUnityPlugin)this).Logger;
		Harmony val = new Harmony("dev.mamallama.lcm.partypooper");
		val.PatchAll(typeof(UnlockableSuit_Patches));
		Log.LogInfo((object)"Plugin PartyPooper is loaded!");
	}
}
internal static class LCMPluginInfo
{
	public const string PLUGIN_GUID = "dev.mamallama.lcm.partypooper";

	public const string PLUGIN_NAME = "PartyPooper";

	public const string PLUGIN_VERSION = "1.0.0";
}
namespace PartyPooper.Patches
{
	public class UnlockableSuit_Patches
	{
		[HarmonyPatch(typeof(UnlockableSuit), "SwitchSuitForPlayer")]
		[HarmonyPostfix]
		public static void Postfix(PlayerControllerB player)
		{
			Plugin.Log.LogInfo((object)("Player costume is being changed: " + ((Object)player).name));
			player.RemovePartyHat();
		}
	}
}