Decompiled source of FordsGreetings v2.0.0

Mods/FordsGreetings.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AudioImportLib;
using FordsGreetings;
using HarmonyLib;
using MelonLoader;
using MelonLoader.Utils;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Core), "FordsGreetings", "1.0.0", "Duplex", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("FordsGreetings")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+75afdf98a908a2a3dfcfd2df8b99cc8c5cfae759")]
[assembly: AssemblyProduct("FordsGreetings")]
[assembly: AssemblyTitle("FordsGreetings")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace FordsGreetings
{
	public class Core : MelonMod
	{
		private static readonly string fordAudioPath = Path.Combine(MelonEnvironment.UserDataDirectory, "CustomAudio/FordAudio");

		public static AudioClip walk = API.LoadAudioClip(Path.Combine(fordAudioPath, "brett_you_walk_good1.wav"), true);

		public static AudioClip walk2 = API.LoadAudioClip(Path.Combine(fordAudioPath, "brett_you_walk_good2.wav"), true);

		public static AudioClip friendship = API.LoadAudioClip(Path.Combine(fordAudioPath, "brett_friendship2.wav"), true);

		public static AudioClip looking = API.LoadAudioClip(Path.Combine(fordAudioPath, "brett_you_again3.wav"), true);

		public static AudioClip looking2 = API.LoadAudioClip(Path.Combine(fordAudioPath, "brett_you_again2.wav"), true);

		public static AudioClip looking3 = API.LoadAudioClip(Path.Combine(fordAudioPath, "brett_you_again1.wav"), true);

		public static AudioClip leadIntoTheVoid = API.LoadAudioClip(Path.Combine(fordAudioPath, "FantasyFord_VO_leadUsIntoVoid_01.wav"), true);

		public static AudioClip gameOver = API.LoadAudioClip(Path.Combine(fordAudioPath, "brett_game_over1.wav"), true);

		public static AudioClip laugh1 = API.LoadAudioClip(Path.Combine(fordAudioPath, "brett_laugh1.wav"), true);

		public static AudioClip monkeyBunked = API.LoadAudioClip(Path.Combine(fordAudioPath, "brett_monkeybunked.wav"), true);

		public static AudioClip monkeyBunked2 = API.LoadAudioClip(Path.Combine(fordAudioPath, "FantasyFord_VO_arenaNegative_01.wav"), true);

		public static AudioClip monkeyBunked3 = API.LoadAudioClip(Path.Combine(fordAudioPath, "FantasyFord_VO_arenaNegative_02.wav"), true);

		public static AudioClip monkeyBunked4 = API.LoadAudioClip(Path.Combine(fordAudioPath, "FantasyFord_VO_arenaNegative_03.wav"), true);

		public static AudioClip yeah = API.LoadAudioClip(Path.Combine(fordAudioPath, "brett_yell_yeah1.wav"), true);

		public static AudioClip yeah2 = API.LoadAudioClip(Path.Combine(fordAudioPath, "brett_yell_yeah2.wav"), true);

		public static AudioClip yeah3 = API.LoadAudioClip(Path.Combine(fordAudioPath, "brett_yell_yeah3.wav"), true);

		public static AudioClip yeah4 = API.LoadAudioClip(Path.Combine(fordAudioPath, "brett_yell_yeah4.wav"), true);

		public static AudioClip yeah5 = API.LoadAudioClip(Path.Combine(fordAudioPath, "brett_excitement1.wav"), true);

		public static AudioClip key = API.LoadAudioClip(Path.Combine(fordAudioPath, "FantasyFord_VO_dungeonKey_01.wav"), true);

		public static AudioClip son1 = API.LoadAudioClip(Path.Combine(fordAudioPath, "FantasyFord_VO_arenaPositive_02.wav"), true);

		public static AudioClip son2 = API.LoadAudioClip(Path.Combine(fordAudioPath, "FantasyFord_VO_arenaPositive_01.wav"), true);

		public static AudioClip written = API.LoadAudioClip(Path.Combine(fordAudioPath, "FantasyFord_VO_itWasWritten_01.wav"), true);

		public static AudioClip newKing = API.LoadAudioClip(Path.Combine(fordAudioPath, "FantasyFord_VO_newKing_01.wav"), true);

		public override void OnInitializeMelon()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			((MelonBase)this).HarmonyInstance.Patch((MethodBase)AccessTools.Method(typeof(AudioSource), "Play", Array.Empty<Type>(), (Type[])null), new HarmonyMethod(typeof(Core).GetMethod("setAudio")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			((MelonBase)this).HarmonyInstance.Patch((MethodBase)AccessTools.Method(typeof(AudioSource), "Play", new Type[1] { typeof(ulong) }, (Type[])null), new HarmonyMethod(typeof(Core).GetMethod("setAudio")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}

		public static void setAudio(AudioSource __instance)
		{
			if ((Object)(object)__instance.clip == (Object)null)
			{
				return;
			}
			if (new Random().Next(2) == 1 && ((Object)__instance.clip).name == "brett_greetings0")
			{
				if (new Random().Next(2) == 0)
				{
					__instance.clip = son1;
				}
				if (new Random().Next(2) == 1)
				{
					__instance.clip = son2;
				}
			}
			if (new Random().Next(2) == 1 && ((Object)__instance.clip).name == "brett_greetings3")
			{
				__instance.clip = friendship;
			}
			if (new Random().Next(2) == 1 && ((Object)__instance.clip).name == "brett_greetings4")
			{
				__instance.clip = key;
			}
			if (new Random().Next(2) == 1 && ((Object)__instance.clip).name == "brett_greetings5")
			{
				if (new Random().Next(5) == 0)
				{
					__instance.clip = yeah;
				}
				if (new Random().Next(5) == 1)
				{
					__instance.clip = yeah2;
				}
				if (new Random().Next(5) == 2)
				{
					__instance.clip = yeah3;
				}
				if (new Random().Next(5) == 3)
				{
					__instance.clip = yeah4;
				}
				if (new Random().Next(5) == 4)
				{
					__instance.clip = yeah5;
				}
			}
			if (new Random().Next(2) == 1 && ((Object)__instance.clip).name == "brett_greetings6")
			{
				if (new Random().Next(2) == 0)
				{
					__instance.clip = walk;
				}
				if (new Random().Next(2) == 1)
				{
					__instance.clip = walk2;
				}
			}
			if (new Random().Next(2) == 1 && ((Object)__instance.clip).name == "brett_greetings7")
			{
				if (new Random().Next(3) == 0)
				{
					__instance.clip = looking;
				}
				if (new Random().Next(3) == 1)
				{
					__instance.clip = looking2;
				}
				if (new Random().Next(3) == 2)
				{
					__instance.clip = looking3;
				}
			}
			if (new Random().Next(2) == 1 && ((Object)__instance.clip).name == "brett_greetings7")
			{
				if (new Random().Next(3) == 0)
				{
					__instance.clip = leadIntoTheVoid;
				}
				if (new Random().Next(3) == 1)
				{
					__instance.clip = written;
				}
				if (new Random().Next(3) == 2)
				{
					__instance.clip = newKing;
				}
			}
			if (new Random().Next(2) == 1 && ((Object)__instance.clip).name == "brett_unaggro2")
			{
				if (new Random().Next(2) == 0)
				{
					__instance.clip = laugh1;
				}
				if (new Random().Next(2) == 1)
				{
					__instance.clip = gameOver;
				}
			}
			if (new Random().Next(2) == 1 && ((Object)__instance.clip).name == "brett_laugh3")
			{
				if (new Random().Next(6) == 0)
				{
					__instance.clip = laugh1;
				}
				if (new Random().Next(6) == 1)
				{
					__instance.clip = monkeyBunked;
				}
				if (new Random().Next(6) == 2)
				{
					__instance.clip = monkeyBunked2;
				}
				if (new Random().Next(6) == 3)
				{
					__instance.clip = monkeyBunked3;
				}
				if (new Random().Next(6) == 4)
				{
					__instance.clip = monkeyBunked4;
				}
			}
		}
	}
}