Decompiled source of SquawkyGoose v1.0.0

Goose.dll

Decompiled 3 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates.Heretic.Weapon;
using HarmonyLib;
using HereticMod.Components;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates.Heretic.Weapon;
using R2API;

[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.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("Goose")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Goose")]
[assembly: AssemblyTitle("Goose")]
[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 Goose
{
	[BepInPlugin("prodzpod.Goose", "Goose", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Main : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_OnEnter <>9__11_0;

			internal void <Awake>b__11_0(orig_OnEnter orig, Squawk self)
			{
				self.soundName = "pxd_goose_honk";
				orig.Invoke(self);
			}
		}

		public const string PluginGUID = "prodzpod.Goose";

		public const string PluginAuthor = "prodzpod";

		public const string PluginName = "Goose";

		public const string PluginVersion = "1.0.0";

		public static ManualLogSource Log;

		internal static PluginInfo pluginInfo;

		public static uint GooseSounds;

		public static ConfigFile Config;

		public static Harmony Harmony;

		public static int pillarCompleted;

		public const string SOUND_NAME = "pxd_goose_honk";

		public void Awake()
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			pluginInfo = ((BaseUnityPlugin)this).Info;
			Log = ((BaseUnityPlugin)this).Logger;
			GooseSounds = SoundBanks.Add(Assembly.GetExecutingAssembly().Location.Replace("Goose.dll", "Goose.bnk"));
			Config = new ConfigFile(Path.Combine(Paths.ConfigPath, "prodzpod.Goose.cfg"), true);
			Harmony = new Harmony("prodzpod.Goose");
			object obj = <>c.<>9__11_0;
			if (obj == null)
			{
				hook_OnEnter val = delegate(orig_OnEnter orig, Squawk self)
				{
					self.soundName = "pxd_goose_honk";
					orig.Invoke(self);
				};
				<>c.<>9__11_0 = val;
				obj = (object)val;
			}
			Squawk.OnEnter += (hook_OnEnter)obj;
			if (Chainloader.PluginInfos.ContainsKey("com.Moffein.Heretic"))
			{
				Harmony.PatchAll(typeof(PatchMoffein));
				Harmony.PatchAll(typeof(PatchMoffein2));
			}
		}
	}
	[HarmonyPatch(typeof(SquawkController), "RpcSquawk")]
	public class PatchMoffein
	{
		public static void ILManipulator(ILContext il, MethodBase original, ILLabel retLabel)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Play_heretic_squawk")
			});
			val.Remove();
			val.Emit(OpCodes.Ldstr, "pxd_goose_honk");
		}
	}
	[HarmonyPatch(typeof(SquawkController), "Update")]
	public class PatchMoffein2
	{
		public static void Postfix(ref SquawkController __instance)
		{
			__instance.cooldownStopwatch = 0f;
		}

		public static void ILManipulator(ILContext il, MethodBase original, ILLabel retLabel)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Play_heretic_squawk")
			});
			val.Remove();
			val.Emit(OpCodes.Ldstr, "pxd_goose_honk");
		}
	}
}