Decompiled source of Mandem v1.1.5

plugins/mandem/Mandem.dll

Decompiled 8 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 HarmonyLib;
using Mandem.Patches;
using UnityEngine;
using UnityEngine.Video;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Mandem")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Mandem")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("80a2aa24-685c-4035-bf15-e0972252e0a2")]
[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 Mandem
{
	[BepInPlugin("Othello.Modding", "Mandem", "1.0.0")]
	public class Modders : BaseUnityPlugin
	{
		private const string modGUID = "Othello.Modding";

		private const string modName = "Mandem";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("Othello.Modding");

		internal static Modders Instance;

		internal static List<AudioClip> SoundFX;

		internal static List<AudioClip> extraSFX;

		internal static AssetBundle Bundle;

		internal static AssetBundle ExtraBundle;

		internal static AudioClip[] boomboxSounds;

		internal static AudioClip[] extraSounds;

		internal static VideoClip[] extraMovies;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			harmony.PatchAll(typeof(BoomboxPatch));
			harmony.PatchAll(typeof(DressGirlPatch));
			harmony.PatchAll(typeof(JesterPatch));
			harmony.PatchAll(typeof(TVScriptPatch));
			harmony.PatchAll(typeof(DiscoBall));
			SoundFX = new List<AudioClip>();
			extraSFX = new List<AudioClip>();
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			location = location.TrimEnd("Mandem.dll".ToCharArray());
			Bundle = AssetBundle.LoadFromFile(location + "mandem");
			ExtraBundle = AssetBundle.LoadFromFile(location + "extra");
			if ((Object)(object)Bundle != (Object)null)
			{
				SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
				extraSFX = ExtraBundle.LoadAllAssets<AudioClip>().ToList();
				extraMovies = ExtraBundle.LoadAllAssets<VideoClip>().ToArray();
				boomboxSounds = SoundFX.ToArray();
				extraSounds = extraSFX.ToArray();
			}
		}
	}
	internal class MyModBase
	{
	}
}
namespace Mandem.Patches
{
	[HarmonyPatch(typeof(CozyLights))]
	internal class DiscoBall
	{
		[HarmonyPatch("SetAudio")]
		[HarmonyPostfix]
		private static void OverrideMusic(CozyLights __instance)
		{
			__instance.turnOnAudio.clip = Modders.extraSFX[4];
		}
	}
	[HarmonyPatch(typeof(TVScript))]
	internal class TVScriptPatch
	{
		[HarmonyPatch("TurnTVOnOff")]
		[HarmonyPostfix]
		private static void OverrideTV(TVScript __instance)
		{
			__instance.tvAudioClips = (AudioClip[])(object)new AudioClip[2]
			{
				Modders.extraSounds[5],
				Modders.extraSounds[6]
			};
			__instance.tvClips = (VideoClip[])(object)new VideoClip[2]
			{
				Modders.extraMovies[0],
				Modders.extraMovies[1]
			};
		}
	}
	[HarmonyPatch(typeof(DressGirlAI))]
	internal class DressGirlPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideGirl(DressGirlAI __instance)
		{
			__instance.breathingSFX = Modders.extraSounds[1];
			__instance.appearStaringSFX = (AudioClip[])(object)new AudioClip[2]
			{
				Modders.extraSounds[2],
				Modders.extraSounds[3]
			};
		}
	}
	[HarmonyPatch(typeof(BoomboxItem))]
	internal class BoomboxPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideMusic(BoomboxItem __instance)
		{
			__instance.musicAudios = Modders.boomboxSounds;
		}
	}
	[HarmonyPatch(typeof(JesterAI))]
	internal class JesterPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideJester(JesterAI __instance)
		{
			__instance.popGoesTheWeaselTheme = Modders.extraSFX[5];
		}
	}
}