Decompiled source of MonsterInc v1.1.1

Monsters Inc.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 Monsters_Inc.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("Monsters Inc")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Monsters Inc")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("72163b1a-64a0-4056-b7f5-c33c913b5696")]
[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 Monsters_Inc
{
	[BepInPlugin("posidon.MonstersInc", "Monsters Inc", "1.1.1")]
	public class MonstersIncBase : BaseUnityPlugin
	{
		private const string modGUID = "posidon.MonstersInc";

		private const string modName = "Monsters Inc";

		private const string modVersion = "1.1.1";

		private readonly Harmony harmony = new Harmony("posidon.MonstersInc");

		internal ManualLogSource mls;

		internal static MonstersIncBase Instance;

		internal static List<AudioClip> sounds;

		internal static AssetBundle Bundle;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("posidon.MonstersInc");
			mls.LogInfo((object)"mod is working");
			harmony.PatchAll(typeof(Sound1));
			harmony.PatchAll(typeof(Sound2));
			harmony.PatchAll(typeof(Sound3));
			harmony.PatchAll(typeof(CoilHeadPatch));
			harmony.PatchAll(typeof(ThumperPatch));
			harmony.PatchAll(typeof(ManEaterPatch));
			harmony.PatchAll(typeof(GhostGirlPatch));
			harmony.PatchAll(typeof(JesterPatch));
			sounds = new List<AudioClip>();
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			location = location.TrimEnd("Monsters Inc.dll".ToCharArray());
			Bundle = AssetBundle.LoadFromFile(location + "monsterincsounds");
			if ((Object)(object)Bundle != (Object)null)
			{
				sounds = Bundle.LoadAllAssets<AudioClip>().ToList();
				mls.LogInfo((object)"asset bundle is loaded");
			}
			else
			{
				mls.LogError((object)"asset bundle didn't load");
			}
		}

		public static List<AudioClip> getSounds()
		{
			return sounds;
		}
	}
}
namespace Monsters_Inc.patches
{
	[HarmonyPatch(typeof(DressGirlAI))]
	internal class GhostGirlPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void GhostGorlAIPatch(ref float ___staringTimer, ref float ___chaseTimer)
		{
			___staringTimer = 20f;
			___chaseTimer = 25f;
		}
	}
	[HarmonyPatch(typeof(JesterAI))]
	internal class JesterPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void JesterSpeedPatch(ref float ___popUpTimer, ref float ___beginCrankingTimer)
		{
			___popUpTimer = Random.Range(1f, 2f);
			___beginCrankingTimer = Random.Range(1f, 2f);
		}
	}
	[HarmonyPatch(typeof(SpringManAI))]
	internal class CoilHeadPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void CoilHeadSpeedPatch(ref float ___currentChaseSpeed)
		{
			___currentChaseSpeed = 100f;
		}
	}
	[HarmonyPatch(typeof(CaveDwellerAI))]
	internal class ManEaterPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void ManEaterAIPatch(ref float ___sneakSpeed, ref float ___attackDistance, ref float ___leapSpeed, ref float ___chaseSpeed, ref float ___growthSpeedMultiplier)
		{
			___sneakSpeed = 25f;
			___attackDistance = 8f;
			___leapSpeed = 50f;
			___chaseSpeed = 50f;
			___growthSpeedMultiplier = 100f;
		}
	}
	[HarmonyPatch(typeof(CentipedeAI))]
	internal class Sound1
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void SnareFleaSoundPatch(ref AudioClip ___clingToPlayer3D)
		{
			AudioClip val = MonstersIncBase.getSounds()[1];
			___clingToPlayer3D = val;
		}
	}
	[HarmonyPatch(typeof(DressGirlAI))]
	internal class Sound2
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void GhostGirlSoundPatch(ref AudioClip ___breathingSFX)
		{
			AudioClip val = MonstersIncBase.getSounds()[2];
			___breathingSFX = val;
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class Sound3
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void ShipSoundPatch(ref AudioClip ___shipIntroSpeechSFX, ref AudioClip ___zeroDaysLeftAlertSFX)
		{
			___shipIntroSpeechSFX = (___zeroDaysLeftAlertSFX = MonstersIncBase.getSounds()[4]);
		}
	}
	[HarmonyPatch(typeof(CrawlerAI))]
	internal class ThumperPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void SpeedPatch(ref float ___SpeedIncreaseRate)
		{
			___SpeedIncreaseRate = 100f;
		}
	}
}