Decompiled source of LofPack v1.0.1

LofPack.dll

Decompiled 3 weeks ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LofPack.Patches;
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("LofPack")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LofPack")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5fa4e2b2-dd5c-4442-8270-1097aae42af8")]
[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 LofPack
{
	[BepInPlugin("Lof.LofPack", "LofPack", "1.0.1")]
	public class LofModBase : BaseUnityPlugin
	{
		private const string modGUID = "Lof.LofPack";

		private const string modName = "LofPack";

		private const string modVersion = "1.0.1";

		private readonly Harmony harmony = new Harmony("Lof.LofPack");

		private static LofModBase Instance;

		private ManualLogSource mls;

		internal static List<AudioClip> SoundFX;

		internal static AudioClip[] soundFXArr;

		internal static AssetBundle SoundBundle;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Lof.LofPack");
			mls.LogInfo((object)"The LofPack has awoken :)");
			harmony.PatchAll(typeof(LofModBase));
			harmony.PatchAll(typeof(HoarderBugAIPatch));
			mls = ((BaseUnityPlugin)this).Logger;
			SoundFX = new List<AudioClip>();
			soundFXArr = (AudioClip[])(object)new AudioClip[1];
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			location = location.TrimEnd("LofPack.dll".ToCharArray());
			mls.LogInfo((object)location);
			SoundBundle = AssetBundle.LoadFromFile(location + "lofassetbundle");
			if ((Object)(object)SoundBundle != (Object)null)
			{
				SoundFX = SoundBundle.LoadAllAssets<AudioClip>().ToList();
			}
			else
			{
				mls.LogError((object)"Failed to load asset bundle");
			}
		}
	}
}
namespace LofPack.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void infiniteSprintPatch(ref float ___sprintMeter)
		{
			___sprintMeter = 1f;
		}
	}
	[HarmonyPatch(typeof(HoarderBugAI))]
	internal class HoarderBugAIPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void HoarderBugPatch(HoarderBugAI __instance)
		{
			foreach (AudioClip item in LofModBase.SoundFX)
			{
				if (((Object)item).name.ToUpper() == "FLIEGER")
				{
					__instance.bugFlySFX = item;
				}
			}
		}
	}
}