Decompiled source of LTG Jester v1.0.2

LTG_Jester.dll

Decompiled 6 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using LTG_Jester;
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("LTG_Jester")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LTG_Jester")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d15d7c33-deab-4a5a-b26f-09ff638477d0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
[HarmonyPatch(typeof(JesterAI))]
internal class JesterAIPatch
{
	[HarmonyPatch("Start")]
	[HarmonyPostfix]
	public static void jesterSoundPatch(JesterAI __instance)
	{
		AudioClip[] songReplace = LTG_Jester_Base.SongReplace;
		__instance.popGoesTheWeaselTheme = songReplace[0];
		__instance.popUpSFX = songReplace[1];
	}

	[HarmonyPatch("SetJesterInitialValues")]
	[HarmonyPostfix]
	public static void timerPatch(JesterAI __instance)
	{
		__instance.popUpTimer = 38.1f;
	}
}
namespace LTG_Jester;

[BepInPlugin("qenze.LTGJester", "LowTierGod Jester", "1.0.0")]
public class LTG_Jester_Base : BaseUnityPlugin
{
	private const string modGUID = "qenze.LTGJester";

	private const string modName = "LowTierGod Jester";

	private const string modVersion = "1.0.0";

	private readonly Harmony harmony = new Harmony("qenze.LTGJester");

	private static LTG_Jester_Base Instance;

	internal ManualLogSource mls;

	internal static AudioClip[] SongReplace;

	internal static AssetBundle Bundle;

	private void Awake()
	{
		if ((Object)(object)Instance == (Object)null)
		{
			Instance = this;
		}
		mls = Logger.CreateLogSource("qenze.LTGJester");
		mls.LogInfo((object)"KYS");
		harmony.PatchAll(typeof(LTG_Jester_Base));
		harmony.PatchAll(typeof(JesterAIPatch));
		mls = ((BaseUnityPlugin)this).Logger;
		SongReplace = (AudioClip[])(object)new AudioClip[2];
		string location = ((BaseUnityPlugin)Instance).Info.Location;
		location = location.TrimEnd("LTG_Jester.dll".ToCharArray());
		Bundle = AssetBundle.LoadFromFile(location + "ltg");
		if ((Object)(object)Bundle != (Object)null)
		{
			mls.LogInfo((object)"KYS speech loaded");
			SongReplace = Bundle.LoadAllAssets<AudioClip>();
		}
		else
		{
			mls.LogInfo((object)"Failed to load KYS speech");
		}
	}
}