Decompiled source of AttackOnGiant v1.0.0

AttackOnGiant.dll

Decompiled 6 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using AttackOnGiant.Patches;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("AttackOnGiant")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AttackOnGiant")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("2f4e7db9-a7dc-4331-bef1-a81c3a6ba60f")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace AttackOnGiant
{
	[BepInPlugin("EerieXanthic.AttackOnGiant", "Attack on Giant", "1.0.0.0")]
	public class AttackOnGiantBase : BaseUnityPlugin
	{
		private const string modGUID = "EerieXanthic.AttackOnGiant";

		private const string modName = "Attack on Giant";

		private const string modVersion = "1.0.0.0";

		private readonly Harmony harmony = new Harmony("EerieXanthic.AttackOnGiant");

		private static AttackOnGiantBase I;

		internal ManualLogSource mls;

		internal static AudioClip newSFX;

		private void Awake()
		{
			if ((Object)(object)I == (Object)null)
			{
				I = this;
			}
			mls = Logger.CreateLogSource("EerieXanthic.AttackOnGiant");
			string location = ((BaseUnityPlugin)I).Info.Location;
			string text = "AttackOnGiant.dll";
			string text2 = location.TrimEnd(text.ToCharArray());
			string text3 = text2 + "attackongiantsound";
			mls.LogInfo((object)("Attack on Giant is loading from " + text3));
			AssetBundle val = AssetBundle.LoadFromFile(text3);
			if ((Object)(object)val == (Object)null)
			{
				mls.LogError((object)"Failed to load audio assets!");
				return;
			}
			newSFX = val.LoadAsset<AudioClip>("Assets/tunes to listen to while being eaten.mp3");
			if ((Object)(object)newSFX != (Object)null)
			{
				mls.LogInfo((object)"Attack on Giant is loaded. Run.");
			}
			harmony.PatchAll(typeof(AttackOnGiantBase));
			harmony.PatchAll(typeof(ForestGiantAIPatch));
		}
	}
}
namespace AttackOnGiant.Patches
{
	[HarmonyPatch(typeof(ForestGiantAI))]
	internal class ForestGiantAIPatch
	{
		[HarmonyPatch("EatPlayerAnimation")]
		[HarmonyPostfix]
		public static void hoarderBugAudioPatch(ref AudioSource ___creatureVoice)
		{
			___creatureVoice.PlayOneShot(AttackOnGiantBase.newSFX);
		}
	}
}