Decompiled source of PeterSpringerSFX v1.0.5

BepInEx/plugins/PeterCoil/Peter.dll

Decompiled a year 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 LC_API.BundleAPI;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Peter")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+c25405c516fddcff690faa70c67b9176ec8d70ca")]
[assembly: AssemblyProduct("Peter")]
[assembly: AssemblyTitle("Peter")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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;
		}
	}
}
namespace Peter
{
	[BepInPlugin("Peter", "Peter", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public Harmony harmonymain;

		private void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			harmonymain = new Harmony("Peter");
			harmonymain.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"peter loaded.");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "Peter";

		public const string PLUGIN_NAME = "Peter";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace Peter.Patches
{
	[HarmonyPatch]
	internal class EnemyTypes
	{
		[HarmonyPatch(typeof(RoundManager), "BeginEnemySpawning")]
		[HarmonyPostfix]
		public static void SummonPeter(RoundManager __instance)
		{
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			foreach (SpawnableEnemyWithRarity enemy in RoundManager.Instance.currentLevel.Enemies)
			{
				if ((Object)(object)enemy.enemyType != (Object)null && enemy.enemyType.enemyName == "Spring")
				{
					SpringManAI component = enemy.enemyType.enemyPrefab.GetComponent<SpringManAI>();
					if (!((Object)(object)((Component)component).gameObject.transform.Find("SpringManModel") != (Object)null) || !((Object)(object)((Component)component).gameObject.transform.Find("SpringManModel").Find("Body") != (Object)null) || !((Object)(object)((Component)((Component)component).gameObject.transform.Find("SpringManModel").Find("Body")).gameObject != (Object)null) || !((Object)(object)((Component)((Component)component).gameObject.transform.Find("SpringManModel").Find("Body")).gameObject.GetComponent<SkinnedMeshRenderer>() != (Object)null))
					{
						break;
					}
					component.springNoises = (AudioClip[])(object)new AudioClip[1] { BundleLoader.GetLoadedAsset<AudioClip>("assets/peter/peter-hehehe.mp3") };
					Object.Destroy((Object)(object)((Component)((Component)component).gameObject.transform.Find("SpringManModel").Find("Body")).gameObject.GetComponent<SkinnedMeshRenderer>());
					Object.Destroy((Object)(object)((Component)((Component)component).gameObject.transform.Find("SpringManModel").Find("Head")).gameObject.GetComponent<MeshRenderer>());
					GameObject val = Object.Instantiate<GameObject>(BundleLoader.GetLoadedAsset<GameObject>("assets/peter/default.prefab"));
					Debug.Log((object)"SPAWNED PETER AEAEAEE");
					val.transform.SetParent(enemy.enemyType.enemyPrefab.transform, false);
					val.transform.localPosition = new Vector3(0f, 2.2f, 0f);
				}
			}
		}
	}
}