Decompiled source of HoarderBugChinazes v1.0.3

BepInEx/plugins/HoarderBugChinazes/HoarderBugChinazes.dll

Decompiled 5 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.Logging;
using HarmonyLib;
using HoarderBugChinazes.NetcodePatcher;
using LCSoundTool;
using Microsoft.CodeAnalysis;
using UnityEngine;
using orekushii.patch;

[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: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("HoarderBugChinazes")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: AssemblyInformationalVersion("1.0.3-alpha.0.2+c245d4d1c02ea360ae5b07542c902466ecb63cab")]
[assembly: AssemblyProduct("HoarderBugChinazes")]
[assembly: AssemblyTitle("HoarderBugChinazes")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
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 orekushii
{
	[BepInPlugin("HoarderBugChinazes", "HoarderBugChinazes", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony _harmony = new Harmony("HoarderBugChinazes");

		public static Plugin Instance { get; set; }

		public static ManualLogSource Log => ((BaseUnityPlugin)Instance).Logger;

		public AudioClip ChinazesSound { get; private set; }

		public Plugin()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			Instance = this;
		}

		private void Awake()
		{
			ChinazesSound = SoundTool.GetAudioClip(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "chinazes.wav");
			Log.LogInfo((object)"Applying patches...");
			ApplyPluginPatch();
			Log.LogInfo((object)"Patches applied");
		}

		private void ApplyPluginPatch()
		{
			_harmony.PatchAll(typeof(HoarderBugAiPatch));
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "HoarderBugChinazes";

		public const string PLUGIN_NAME = "HoarderBugChinazes";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace orekushii.patch
{
	[HarmonyPatch(typeof(HoarderBugAI))]
	public class HoarderBugAiPatch
	{
		[HarmonyPatch("SetGoTowardsTargetObject")]
		[HarmonyPostfix]
		private static void HoarderBugChinazesPatch(ref HoarderBugAI __instance)
		{
			if ((Object)(object)__instance.targetItem != (Object)null)
			{
				((EnemyAI)__instance).creatureVoice.PlayOneShot(Plugin.Instance.ChinazesSound);
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace HoarderBugChinazes.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}