Decompiled source of ContentBoinging v1.0.0

ContentBoinging.dll

Decompiled 8 months ago
using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
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("ContentBoinging")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Boing")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ContentBoinging")]
[assembly: AssemblyTitle("ContentBoinging")]
[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 ContentBoinging
{
	[BepInPlugin("ContentBoinging", "ContentBoinging", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal class Patches
		{
			[HarmonyPatch(typeof(PlayerController), "RPCA_Jump")]
			[HarmonyPostfix]
			public static void BoingJump(Player ___player)
			{
				BoingPlayer(___player);
			}

			[HarmonyPatch(typeof(Player), "RPCA_TakeDamageAndAddForce")]
			[HarmonyPostfix]
			public static void BoingTakeDamageAndAddForce(Player __instance)
			{
				BoingPlayer(__instance);
			}

			private static void BoingPlayer(Player player)
			{
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				SFX_Instance val = Object.Instantiate<SFX_Instance>(player.sfx_0_Impact);
				val.clips = (AudioClip[])(object)new AudioClip[1] { _boing };
				SFX_Player.instance.PlaySFX(val, player.refs.headPos.position, (Transform)null, (SFX_Settings)null, 1f, false, false, true, 0f, 0);
			}
		}

		private static AudioClip _boing;

		private static ManualLogSource _logger;

		private void Awake()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			_logger = ((BaseUnityPlugin)this).Logger;
			Log("Plugin ContentBoinging is loaded!");
			_boing = AssetBundle.LoadFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("ContentBoinging.boing")).LoadAsset<AudioClip>("boing");
			Log(_boing);
			Harmony val = new Harmony("ContentBoinging");
			val.PatchAll(typeof(Patches));
			Log(val.GetPatchedMethods().Count());
		}

		internal static void Log(object msg)
		{
			_logger.LogInfo(msg);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "ContentBoinging";

		public const string PLUGIN_NAME = "ContentBoinging";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}