Decompiled source of PingCompany v1.1.1

PingCompany.dll

Decompiled 3 months 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 HarmonyLib;
using PingCompany.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("PingCompany")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PingCompany")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("80e541e1-00c8-4b42-a658-2c7333b59013")]
[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 PingCompany
{
	[BepInPlugin("Deleophantropus.PingCompany", "Ping Company", "1.0.0")]
	public class PingCompanyBase : BaseUnityPlugin
	{
		private const string modGUID = "Deleophantropus.PingCompany";

		private const string modName = "Ping Company";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("Deleophantropus.PingCompany");

		private static PingCompanyBase Instance;

		internal static ManualLogSource mls;

		internal static List<AudioClip> SoundFX;

		internal static AssetBundle Bundle;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = ((BaseUnityPlugin)this).Logger;
			mls.LogInfo((object)"This is working");
			harmony.PatchAll();
			harmony.PatchAll(typeof(PingCompanyBase));
			harmony.PatchAll(typeof(RemotePropPatch));
			harmony.PatchAll(typeof(CrawlerAIPatch));
			SoundFX = new List<AudioClip>();
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			location = location.TrimEnd("PingCompany.dll".ToCharArray());
			Bundle = AssetBundle.LoadFromFile(location + "ping");
			if ((Object)(object)Bundle != (Object)null)
			{
				mls.LogError((object)"Successfully loaded asset bundle");
				SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
			}
			else
			{
				mls.LogError((object)"Failed to load asset bundle");
			}
		}
	}
}
namespace PingCompany.Patches
{
	[HarmonyPatch(typeof(CrawlerAI))]
	internal class CrawlerAIPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideAudio(CrawlerAI __instance)
		{
			__instance.longRoarSFX[0] = PingCompanyBase.SoundFX[0];
		}
	}
	[HarmonyPatch(typeof(GrabbableObject))]
	internal class RemotePropPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideAudio(GrabbableObject __instance)
		{
			RemoteProp val = (RemoteProp)(object)((__instance is RemoteProp) ? __instance : null);
			if (val != null)
			{
				val.remoteAudio.clip = PingCompanyBase.SoundFX[1];
			}
		}
	}
}