Decompiled source of SquawkyGoose v1.0.2

Goose.dll

Decompiled 2 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;

[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("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.2")]
	[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.2";

		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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			pluginInfo = ((BaseUnityPlugin)this).Info;
			Log = ((BaseUnityPlugin)this).Logger;
			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");
		}
	}
}