JMod.dll

Decompiled 10 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 GameNetcodeStuff;
using HarmonyLib;
using JMod.Patches;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("JMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("JMod")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4fdc0f8e-d479-44a0-9178-6410cd51e61a")]
[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 JMod
{
	[BepInPlugin("Poseidon.JMod", "JMod", "1.0.0.0")]
	public class JModBase : BaseUnityPlugin
	{
		private const string modGUID = "Poseidon.JMod";

		private const string modName = "JMod";

		private const string modVersion = "1.0.0.0";

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

		private static JModBase Instance;

		internal ManualLogSource mls;

		internal static bool isWalking1;

		internal static List<AudioClip> SoundFX;

		internal static List<AudioClip[]> SoundFXb;

		internal static AssetBundle Bundle;

		internal static AudioClip testnoise;

		internal static Vector3 place;

		internal static string thing = "Debug!!!";

		internal object stuff;

		private void Awake()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Instance == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"JMOD LOADED!");
				Instance = this;
			}
			place = ((Component)this).transform.position;
			mls = Logger.CreateLogSource("Poseidon.JMod");
			mls.LogInfo((object)"JMOD HAS BEEN LOADED!");
			harmony.PatchAll(typeof(StartOfRoundPatch));
			harmony.PatchAll(typeof(LandminePatch));
			harmony.PatchAll(typeof(TermainalPatch));
			harmony.PatchAll(typeof(HoarderBugAIPatch));
			harmony.PatchAll(typeof(TestScript));
			mls = ((BaseUnityPlugin)this).Logger;
			isWalking1 = false;
			SoundFX = new List<AudioClip>();
			SoundFXb = new List<AudioClip[]>();
			Bundle = AssetBundle.LoadFromFile(((BaseUnityPlugin)Instance).Info.Location.TrimEnd("JMod.dll".ToCharArray()) + "jassets");
			if ((Object)(object)Bundle != (Object)null)
			{
				mls.LogInfo((object)"Successfully loaded asset bundle!");
				SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
			}
			else
			{
				mls.LogError((object)"Failed to load asset bundle!");
			}
			testnoise = SoundFX[0];
			AudioSource.PlayClipAtPoint(testnoise, ((Component)this).transform.position);
		}
	}
}
namespace JMod.Patches
{
	[HarmonyPatch(typeof(HoarderBugAI))]
	internal class HoarderBugAIPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideAudio(HoarderBugAI __instance)
		{
			__instance.chitterSFX = JModBase.SoundFXb[6];
		}
	}
	[HarmonyPatch(typeof(KillLocalPlayer))]
	internal class KillLocalPlayerPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideAudio(KillLocalPlayer __instance)
		{
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	[HarmonyPatch("Update")]
	internal class TestScript
	{
		[HarmonyPostfix]
		private static void AddAudio(ref bool __isWalking, ref float ___sprintMeter)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			JModBase.isWalking1 = __isWalking;
			if (!__isWalking)
			{
				___sprintMeter = 1f;
				AudioSource.PlayClipAtPoint(JModBase.testnoise, JModBase.place);
				_ = JModBase.thing == "True";
			}
		}
	}
	[HarmonyPatch(typeof(Terminal))]
	internal class TermainalPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideAudio(Terminal __instance)
		{
			__instance.enterTerminalSFX = JModBase.SoundFX[4];
			__instance.leaveTerminalSFX = JModBase.SoundFX[5];
		}
	}
	[HarmonyPatch(typeof(Landmine))]
	internal class LandminePatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideAudio(Landmine __instance)
		{
			__instance.mineDetonate = JModBase.SoundFX[0];
			__instance.mineDetonateFar = JModBase.SoundFX[1];
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideAudio(StartOfRound __instance)
		{
			__instance.shipIntroSpeechSFX = JModBase.SoundFX[3];
			__instance.firedVoiceSFX = JModBase.SoundFX[2];
		}
	}
}