Decompiled source of SuspiciousCompany v1.0.2

plugins/SuspiciousCompany/SuspiciousCompany.dll

Decompiled 6 hours ago
using System;
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 SuspiciousCompany.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("SuspiciousCompany")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SuspiciousCompany")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7b5c2111-1ae0-4956-af84-50e4ab5988ff")]
[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 SuspiciousCompany
{
	[BepInPlugin("Poseidon.SuspiciousCompany", "Suspicious Company", "1.0.0.0")]
	public class SuspiciousCompanyBase : BaseUnityPlugin
	{
		private const string modGUID = "Poseidon.SuspiciousCompany";

		private const string modName = "Suspicious Company";

		private const string modVersion = "1.0.0.0";

		private readonly Harmony harmony = new Harmony("Poseidon.SuspiciousCompany");

		private static SuspiciousCompanyBase Instance;

		internal ManualLogSource mls;

		internal static AudioClip[] SoundFX;

		internal static AssetBundle Bundle;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Poseidon.SuspiciousCompany");
			mls.LogInfo((object)"Suspicious Company mod enabled.");
			harmony.PatchAll(typeof(SuspiciousCompanyBase));
			harmony.PatchAll(typeof(BoomboxItemPatch));
			harmony.PatchAll(typeof(BaboonBirdAIPatch));
			harmony.PatchAll(typeof(RadMechAIPatch));
			harmony.PatchAll(typeof(JesterAIPatch));
			mls = ((BaseUnityPlugin)this).Logger;
			string text = ((BaseUnityPlugin)Instance).Info.Location.TrimEnd("SuspiciousCompany.dll".ToCharArray());
			Bundle = AssetBundle.LoadFromFile(text + "susbundle");
			if ((Object)(object)Bundle != (Object)null)
			{
				mls.LogInfo((object)"Successfully loaded asset bundle");
				SoundFX = Bundle.LoadAllAssets<AudioClip>();
			}
			else
			{
				mls.LogError((object)"Failed to load asset bundle");
			}
		}
	}
}
namespace SuspiciousCompany.Patches
{
	[HarmonyPatch(typeof(BaboonBirdAI))]
	internal class BaboonBirdAIPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideAudio(BaboonBirdAI __instance)
		{
			__instance.cawScreamSFX = SuspiciousCompanyBase.SoundFX.Where((AudioClip clip) => ((Object)clip).name.StartsWith("sfx_hblb")).ToArray();
		}
	}
	[HarmonyPatch(typeof(BoomboxItem))]
	internal class BoomboxItemPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideAudio(BoomboxItem __instance)
		{
			__instance.musicAudios = SuspiciousCompanyBase.SoundFX.Where((AudioClip clip) => ((Object)clip).name.StartsWith("track_")).ToArray();
		}
	}
	[HarmonyPatch(typeof(RadMechAI))]
	internal class JesterAIPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideAudio(JesterAI __instance)
		{
			__instance.popGoesTheWeaselTheme = ((IEnumerable<AudioClip>)SuspiciousCompanyBase.SoundFX).FirstOrDefault((Func<AudioClip, bool>)((AudioClip clip) => ((Object)clip).name == "jestersong"));
		}
	}
	[HarmonyPatch(typeof(RadMechAI))]
	internal class RadMechAIPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideAudio(RadMechAI __instance)
		{
			__instance.chargeForwardAudio.clip = ((IEnumerable<AudioClip>)SuspiciousCompanyBase.SoundFX).FirstOrDefault((Func<AudioClip, bool>)((AudioClip clip) => ((Object)clip).name == "sfx_badtothebone"));
		}
	}
	[HarmonyPatch(typeof(SpringManAI))]
	internal class SpringManAIPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideAudio(SpringManAI __instance)
		{
			AudioClip[] array = (AudioClip[])(object)new AudioClip[1];
			CollectionExtensions.AddItem<AudioClip>((IEnumerable<AudioClip>)array, ((IEnumerable<AudioClip>)SuspiciousCompanyBase.SoundFX).FirstOrDefault((Func<AudioClip, bool>)((AudioClip clip) => ((Object)clip).name == "sfx_spring")));
			__instance.springNoises = array;
		}
	}
}