Decompiled source of ZAModdingTools v2.1.1

BepInEx/plugins/ZAModdingTools.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
using UnityEngine.Audio;
using ZAModdingTools.Patches;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ZAModdingTools")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ZAModdingTools")]
[assembly: AssemblyCopyright("Copyright © mariusHSK05, 2023-2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c109e276-2d21-4b93-a814-23983c802417")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ZAModdingTools
{
	[BepInPlugin("mariusHSK05.ZAMT", "ZA Modding Tools", "2.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class ZAModdingToolsBase : BaseUnityPlugin
	{
		private const string modGUID = "mariusHSK05.ZAMT";

		private const string modName = "ZA Modding Tools";

		private const string modVersion = "2.1.0";

		private readonly Harmony harmony = new Harmony("mariusHSK05.ZAMT");

		private static ZAModdingToolsBase Instance;

		internal static ManualLogSource mls;

		internal static AssetBundle assetFile;

		internal static AssetBundle musicFile;

		internal static Dictionary<string, bool> enabledSettings = new Dictionary<string, bool>();

		internal static Dictionary<string, float> volumesSettings = new Dictionary<string, float>();

		internal static void LogDisabledViaConfig(string patchId)
		{
			mls.LogInfo((object)("Not patching asset " + patchId + " - disabled in config"));
		}

		internal static void LogDisabledError(string patchId)
		{
			mls.LogError((object)("Not patching asset " + patchId + " - an error occurred while loading file"));
		}

		internal static void LogSuccess(string patchId)
		{
			mls.LogInfo((object)("Patched asset " + patchId + " successfully"));
		}

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("mariusHSK05.ZAMT");
			mls.LogInfo((object)"ZA Modding Tools coming right up :>");
			harmony.PatchAll(typeof(ZAModdingToolsBase));
			string text = "ZAModdingTools.dll";
			string text2 = ((BaseUnityPlugin)Instance).Info.Location.TrimEnd(text.ToCharArray()) + "zamoddingassets";
			string text3 = ((BaseUnityPlugin)Instance).Info.Location.TrimEnd(text.ToCharArray()) + "zamoddingmusics";
			if (File.Exists(text2))
			{
				assetFile = AssetBundle.LoadFromFile(text2);
			}
			if (File.Exists(text3))
			{
				musicFile = AssetBundle.LoadFromFile(text3);
			}
			if ((Object)(object)assetFile == (Object)null)
			{
				mls.LogFatal((object)"Modding assets couldn't be loaded! Mod exiting.");
				return;
			}
			mls.LogInfo((object)"Modding assets locked and loaded!");
			if ((Object)(object)musicFile == (Object)null)
			{
				mls.LogInfo((object)"Music bundle does not exist, ignoring settings.");
			}
			else
			{
				mls.LogInfo((object)"Music bundle locked and loaded!");
			}
			ReadConfig();
			harmony.PatchAll(typeof(EntranceTeleportPatch));
			harmony.PatchAll(typeof(FlowermanAIPatch));
			harmony.PatchAll(typeof(JesterAIPatch));
			harmony.PatchAll(typeof(LandminePatch));
			harmony.PatchAll(typeof(NoisemakerPropPatch));
			harmony.PatchAll(typeof(PhysicsPropPatch));
			harmony.PatchAll(typeof(ShovelPatch));
			harmony.PatchAll(typeof(StartOfRoundPatch));
			harmony.PatchAll(typeof(TimeOfDayPatch));
			harmony.PatchAll(typeof(TurretPatch));
			harmony.PatchAll(typeof(InteractTriggerPatch));
		}

		private void ReadConfig()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_0044: Expected O, but got Unknown
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			//IL_0092: Expected O, but got Unknown
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			//IL_00e0: Expected O, but got Unknown
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Expected O, but got Unknown
			//IL_012e: Expected O, but got Unknown
			//IL_0153: 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)
			//IL_017c: Expected O, but got Unknown
			//IL_017c: Expected O, but got Unknown
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Expected O, but got Unknown
			//IL_01ce: Expected O, but got Unknown
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Expected O, but got Unknown
			//IL_021c: Expected O, but got Unknown
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Expected O, but got Unknown
			//IL_026a: Expected O, but got Unknown
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Expected O, but got Unknown
			//IL_02b8: Expected O, but got Unknown
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Expected O, but got Unknown
			//IL_030a: Expected O, but got Unknown
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Expected O, but got Unknown
			//IL_0358: Expected O, but got Unknown
			//IL_037d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03aa: Expected O, but got Unknown
			//IL_03aa: Expected O, but got Unknown
			//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fc: Expected O, but got Unknown
			//IL_03fc: Expected O, but got Unknown
			//IL_0421: Unknown result type (might be due to invalid IL or missing references)
			//IL_0440: Unknown result type (might be due to invalid IL or missing references)
			//IL_044a: Expected O, but got Unknown
			//IL_044a: Expected O, but got Unknown
			//IL_046f: Unknown result type (might be due to invalid IL or missing references)
			//IL_048e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0498: Expected O, but got Unknown
			//IL_0498: Expected O, but got Unknown
			//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e6: Expected O, but got Unknown
			//IL_04e6: Expected O, but got Unknown
			//IL_050b: Unknown result type (might be due to invalid IL or missing references)
			//IL_052a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0534: Expected O, but got Unknown
			//IL_0534: Expected O, but got Unknown
			//IL_0559: Unknown result type (might be due to invalid IL or missing references)
			//IL_057c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0586: Expected O, but got Unknown
			//IL_0586: Expected O, but got Unknown
			//IL_05ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d4: Expected O, but got Unknown
			//IL_05d4: Expected O, but got Unknown
			//IL_05f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_061c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0626: Expected O, but got Unknown
			//IL_0626: Expected O, but got Unknown
			//IL_064b: Unknown result type (might be due to invalid IL or missing references)
			//IL_066a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0674: Expected O, but got Unknown
			//IL_0674: Expected O, but got Unknown
			//IL_0699: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c6: Expected O, but got Unknown
			//IL_06c6: Expected O, but got Unknown
			//IL_06eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_070a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0714: Expected O, but got Unknown
			//IL_0714: Expected O, but got Unknown
			//IL_0739: Unknown result type (might be due to invalid IL or missing references)
			//IL_075c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0766: Expected O, but got Unknown
			//IL_0766: Expected O, but got Unknown
			//IL_078b: Unknown result type (might be due to invalid IL or missing references)
			//IL_07aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b4: Expected O, but got Unknown
			//IL_07b4: Expected O, but got Unknown
			//IL_07d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0802: Expected O, but got Unknown
			//IL_0802: Expected O, but got Unknown
			//IL_0827: Unknown result type (might be due to invalid IL or missing references)
			//IL_0846: Unknown result type (might be due to invalid IL or missing references)
			//IL_0850: Expected O, but got Unknown
			//IL_0850: Expected O, but got Unknown
			enabledSettings.Add("Master.enableSounds", ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("00MASTER", "Enable Sounds"), true, new ConfigDescription("Main switch for all audio patches in this mod", (AcceptableValueBase)(object)new AcceptableValueList<bool>(new bool[2] { true, false }), Array.Empty<object>())).Value);
			enabledSettings.Add("Master.enableSuits", ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("00MASTER", "Enable Suits"), true, new ConfigDescription("Main switch for all suits in this mod", (AcceptableValueBase)(object)new AcceptableValueList<bool>(new bool[2] { true, false }), Array.Empty<object>())).Value);
			enabledSettings.Add("Master.fixCruiserPosition", ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("00MASTER", "Fix Cruiser Driver POV"), true, new ConfigDescription("Lowers the POV of the Driver a bit so they can access all of the buttons", (AcceptableValueBase)(object)new AcceptableValueList<bool>(new bool[2] { true, false }), Array.Empty<object>())).Value);
			enabledSettings.Add("Master.fixSuitRack", ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("00MASTER", "Fix Suit Rack"), true, new ConfigDescription("This will patch the suit rack to fit more suits onto it, unless this was already taken care of by another mod (currently only More Suits by x753 supported)", (AcceptableValueBase)(object)new AcceptableValueList<bool>(new bool[2] { true, false }), Array.Empty<object>())).Value);
			enabledSettings.Add("Master.uncensorSuits", ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("00MASTER", "Uncensor Suits"), false, new ConfigDescription("The suits in this package are partially offensive. These skins have been blurred by default since they cannot be removed without de-syncing all suits. Toggle this switch if you want to unblur these skins.", (AcceptableValueBase)(object)new AcceptableValueList<bool>(new bool[2] { true, false }), Array.Empty<object>())).Value);
			volumesSettings.Add("Turret", ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("TURRET", "Volume"), 1f, new ConfigDescription("The volume of all Turret sounds", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())).Value);
			enabledSettings.Add("Turret.detectPlayerSFX", ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("TURRET", "Detect Player"), true, new ConfigDescription("Sets the audio of the Turret detecting a player to the 'I need more Boulets' meme", (AcceptableValueBase)(object)new AcceptableValueList<bool>(new bool[2] { true, false }), Array.Empty<object>())).Value);
			enabledSettings.Add("Turret.firingSFX", ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("TURRET", "Firing"), true, new ConfigDescription("Sets the audio of the Turret shooting at a player to the gun noises of the 'I need more Boulets' meme", (AcceptableValueBase)(object)new AcceptableValueList<bool>(new bool[2] { true, false }), Array.Empty<object>())).Value);
			enabledSettings.Add("Turret.firingFarSFX", ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("TURRET", "FiringFar"), true, new ConfigDescription("Sets the audio of the Turret shooting at a player in the distance to fast gun noises of the 'I need more Boulets' meme", (AcceptableValueBase)(object)new AcceptableValueList<bool>(new bool[2] { true, false }), Array.Empty<object>())).Value);
			volumesSettings.Add("Flowerman", ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("FLOWERMAN", "Volume"), 1f, new ConfigDescription("The volume of all Flowerman/Bracken sounds", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())).Value);
			enabledSettings.Add("Flowerman.creatureAngerVoice", ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("FLOWERMAN", "Anger Voice"), true, new ConfigDescription("Sets the Flowerman/Bracken's voice to Angry British Man and the Scotland Forever meme", (AcceptableValueBase)(object)new AcceptableValueList<bool>(new bool[2] { true, false }), Array.Empty<object>())).Value);
			volumesSettings.Add("Airhorn", ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("AIRHORN", "Volume"), 1f, new ConfigDescription("The volume of all Airhorn sounds", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())).Value);
			volumesSettings.Add("Clownhorn", ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("CLOWNHORN", "Volume"), 1f, new ConfigDescription("The volume of all Clownhorn sounds", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())).Value);
			enabledSettings.Add("NoisemakerProp.AirhornSFX", ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("AIRHORN", "Augh"), true, new ConfigDescription("Sets the Airhorn's noises to different versions of the Aughhhh meme", (AcceptableValueBase)(object)new AcceptableValueList<bool>(new bool[2] { true, false }), Array.Empty<object>())).Value);
			enabledSettings.Add("NoisemakerProp.ClownhornSFX", ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("CLOWNHORN", "Moan"), true, new ConfigDescription("Sets the Clownhorn's noises to different versions of the Michael Myers moaning sound from Dead by Daylight", (AcceptableValueBase)(object)new AcceptableValueList<bool>(new bool[2] { true, false }), Array.Empty<object>())).Value);
			enabledSettings.Add("TimeOfDay.companyWindowSFX", ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("COMPANY", "Caramelldansen"), true, new ConfigDescription("Sets the music playing behind the company's counter to Caramelldansen", (AcceptableValueBase)(object)new AcceptableValueList<bool>(new bool[2] { true, false }), Array.Empty<object>())).Value);
			enabledSettings.Add("TimeOfDay.companyAttackSFX", ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("COMPANY", "Andreas"), true, new ConfigDescription("Sets the attack noises of the company Monster to Andreas from German Frauentausch", (AcceptableValueBase)(object)new AcceptableValueList<bool>(new bool[2] { true, false }), Array.Empty<object>())).Value);
			volumesSettings.Add("Jester", ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("JESTER", "Volume"), 1f, new ConfigDescription("The volume of all Jester sounds", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())).Value);
			enabledSettings.Add("Jester.WindUpAndScream", ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("JESTER", "Wind up and scream"), true, new ConfigDescription("Sets the wind-up music and the scream of the Jester to Free Bird", (AcceptableValueBase)(object)new AcceptableValueList<bool>(new bool[2] { true, false }), Array.Empty<object>())).Value);
			volumesSettings.Add("TimeOfDayMusic", ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("MUSIC", "Volume"), 1f, new ConfigDescription("The volume of all time-based audio cues playing on the planets", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())).Value);
			enabledSettings.Add("TimeOfDay.timeOfDayMusic", ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("MUSIC", "Patch Daytime Music"), false, new ConfigDescription("Sets the time-based audio cues playing on the planets to be music clips of OneShot. This is a modification I've created for myself and that I cannot share due to copyright. The music clips are contained in an additional asset file.", (AcceptableValueBase)(object)new AcceptableValueList<bool>(new bool[2] { true, false }), Array.Empty<object>())).Value);
			volumesSettings.Add("Landmine", ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("LANDMINE", "Volume"), 1f, new ConfigDescription("The volume of all Landmine sounds", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())).Value);
			enabledSettings.Add("Landmine.mineDetonate", ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("LANDMINE", "Detonate"), true, new ConfigDescription("Sets the Landmine's explosion sound to the reverb fart audio", (AcceptableValueBase)(object)new AcceptableValueList<bool>(new bool[2] { true, false }), Array.Empty<object>())).Value);
			volumesSettings.Add("Entrance", ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("ENTRANCE", "Volume"), 1f, new ConfigDescription("The volume of the entrance audio noises", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())).Value);
			enabledSettings.Add("EntranceTeleport.firstEntranceAudio", ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("ENTRANCE", "First entrance"), true, new ConfigDescription("Sets the sound playing when you enter the factory/mansion for the first time to the 'Welcome To The Rice Fields' meme", (AcceptableValueBase)(object)new AcceptableValueList<bool>(new bool[2] { true, false }), Array.Empty<object>())).Value);
			enabledSettings.Add("Item.axleMetalPipeFalling", ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("ITEMS", "Metal pipe falling"), true, new ConfigDescription("Sets the Large Axle's falling sound to the Metal Pipe falling audio", (AcceptableValueBase)(object)new AcceptableValueList<bool>(new bool[2] { true, false }), Array.Empty<object>())).Value);
			enabledSettings.Add("Item.shovelHitBonk", ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("ITEMS", "Shovel hit bonk"), true, new ConfigDescription("Sets the sound playing when you hit something with a shovel (or sign) to the Bonk audio", (AcceptableValueBase)(object)new AcceptableValueList<bool>(new bool[2] { true, false }), Array.Empty<object>())).Value);
			mls.LogInfo((object)"Config file loaded successfully!");
		}
	}
}
namespace ZAModdingTools.Patches
{
	[HarmonyPatch(typeof(AudioMixer))]
	internal class AudioMixerPatch
	{
	}
	[HarmonyPatch(typeof(EntranceTeleport))]
	internal class EntranceTeleportPatch
	{
		private static bool hasEnteredOnce;

		private static bool playNow;

		private static AudioClip riceFields;

		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		public static void LoadAndResetPatch()
		{
			string text = "EntranceTeleport.firstEntranceAudio";
			if (!ZAModdingToolsBase.enabledSettings["Master.enableSounds"] || !ZAModdingToolsBase.enabledSettings[text])
			{
				ZAModdingToolsBase.LogDisabledViaConfig(text);
				return;
			}
			hasEnteredOnce = false;
			if ((Object)(object)riceFields == (Object)null)
			{
				riceFields = ZAModdingToolsBase.assetFile.LoadAsset<AudioClip>("Assets/EntranceTeleport/welcomeToTheRiceFields.ogg");
			}
			if ((Object)(object)riceFields == (Object)null)
			{
				ZAModdingToolsBase.LogDisabledError(text);
			}
			else
			{
				ZAModdingToolsBase.LogSuccess(text);
			}
		}

		[HarmonyPatch("TeleportPlayer")]
		[HarmonyPrefix]
		public static void TeleportPatch()
		{
			if (!hasEnteredOnce)
			{
				playNow = true;
			}
		}

		[HarmonyPatch("PlayAudioAtTeleportPositions")]
		[HarmonyPrefix]
		public static void firstTimeAudioPatch(ref AudioSource ___entrancePointAudio, ref AudioSource ___exitPointAudio)
		{
			string key = "EntranceTeleport.firstEntranceAudio";
			if (!hasEnteredOnce && playNow && ZAModdingToolsBase.enabledSettings["Master.enableSounds"] && ZAModdingToolsBase.enabledSettings[key])
			{
				float num = ZAModdingToolsBase.volumesSettings["Entrance"];
				AudioSource obj = ___entrancePointAudio;
				obj.volume *= num;
				AudioSource obj2 = ___exitPointAudio;
				obj2.volume *= num;
				___entrancePointAudio.PlayOneShot(riceFields);
				___exitPointAudio.PlayOneShot(riceFields);
				hasEnteredOnce = true;
				playNow = false;
			}
		}
	}
	[HarmonyPatch(typeof(PhysicsProp))]
	internal class PhysicsPropPatch
	{
		private static AudioClip metalPipe;

		[HarmonyPatch("EquipItem")]
		[HarmonyPostfix]
		public static void AxleMetalPipeFallingPatch(ref Item ___itemProperties)
		{
			if (!(___itemProperties.itemName == "Large axle"))
			{
				return;
			}
			string text = "Item.axleMetalPipeFalling";
			if (!ZAModdingToolsBase.enabledSettings["Master.enableSounds"] || !ZAModdingToolsBase.enabledSettings[text])
			{
				ZAModdingToolsBase.LogDisabledViaConfig(text);
				return;
			}
			if ((Object)(object)metalPipe == (Object)null)
			{
				metalPipe = ZAModdingToolsBase.assetFile.LoadAsset<AudioClip>("Assets/Item/MetalPipeFallingSound.ogg");
			}
			if ((Object)(object)metalPipe == (Object)null)
			{
				ZAModdingToolsBase.LogDisabledError(text);
				return;
			}
			ZAModdingToolsBase.LogSuccess(text);
			if ((Object)(object)___itemProperties.dropSFX != (Object)(object)metalPipe)
			{
				___itemProperties.dropSFX = metalPipe;
			}
		}
	}
	[HarmonyPatch(typeof(JesterAI))]
	internal class JesterAIPatch
	{
		private static bool volumeWarningGiven;

		private static bool jesterWindingUp;

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void JesterVolumePatch(ref JesterAI __instance)
		{
			if (ZAModdingToolsBase.enabledSettings["Master.enableSounds"])
			{
				float num = ZAModdingToolsBase.volumesSettings["Jester"];
				if ((num < 0f || num > 1f) && !volumeWarningGiven)
				{
					ZAModdingToolsBase.mls.LogError((object)"Volume für Jester wurde nicht verändert, ungültiger Wert eingestellt.");
					volumeWarningGiven = true;
					return;
				}
				AudioSource creatureSFX = ((EnemyAI)__instance).creatureSFX;
				creatureSFX.volume *= num;
				AudioSource creatureVoice = ((EnemyAI)__instance).creatureVoice;
				creatureVoice.volume *= num;
			}
		}

		[HarmonyPatch("SetJesterInitialValues")]
		[HarmonyPostfix]
		public static void JesterAudioPatch(ref AudioClip ___popGoesTheWeaselTheme, ref AudioClip ___popUpSFX, ref AudioClip ___screamingSFX)
		{
			string text = "Jester.WindUpAndScream";
			if (!ZAModdingToolsBase.enabledSettings["Master.enableSounds"] || !ZAModdingToolsBase.enabledSettings[text])
			{
				ZAModdingToolsBase.LogDisabledViaConfig(text);
				return;
			}
			AudioClip val = ZAModdingToolsBase.assetFile.LoadAsset<AudioClip>("Assets/JesterAI/FreeBirdIntro.ogg");
			AudioClip val2 = ZAModdingToolsBase.assetFile.LoadAsset<AudioClip>("Assets/JesterAI/FreeBirdSolo.ogg");
			AudioClip val3 = ZAModdingToolsBase.assetFile.LoadAsset<AudioClip>("Assets/JesterAI/Silence.ogg");
			if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null || (Object)(object)val3 == (Object)null)
			{
				ZAModdingToolsBase.LogDisabledError(text);
				return;
			}
			ZAModdingToolsBase.LogSuccess(text);
			___popGoesTheWeaselTheme = val;
			___screamingSFX = val2;
			___popUpSFX = val3;
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void SetCorrectAudioStartPosition(ref JesterAI __instance)
		{
			if (ZAModdingToolsBase.enabledSettings["Master.enableSounds"] && ZAModdingToolsBase.enabledSettings["Jester.WindUpAndScream"])
			{
				if (((EnemyAI)__instance).currentBehaviourStateIndex == 1 && !jesterWindingUp)
				{
					__instance.farAudio.time = 40f - __instance.popUpTimer;
					jesterWindingUp = true;
				}
				else if (((EnemyAI)__instance).currentBehaviourStateIndex != 1 && jesterWindingUp)
				{
					jesterWindingUp = false;
				}
			}
		}
	}
	[HarmonyPatch(typeof(Landmine))]
	internal class LandminePatch
	{
		private static bool volumeWarningGiven;

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void UpdateVolume(ref AudioSource ___mineAudio)
		{
			if (ZAModdingToolsBase.enabledSettings["Master.enableSounds"])
			{
				float num = ZAModdingToolsBase.volumesSettings["Landmine"];
				if ((num < 0f || num > 1f) && !volumeWarningGiven)
				{
					ZAModdingToolsBase.mls.LogError((object)"Volume für Turret wurde nicht verändert, ungültiger Wert eingestellt.");
					volumeWarningGiven = true;
				}
				else
				{
					AudioSource obj = ___mineAudio;
					obj.volume *= num;
				}
			}
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void PatchMineExplosionAudio(ref AudioClip ___mineDetonate, ref AudioClip ___mineDetonateFar)
		{
			string text = "Landmine.mineDetonate";
			if (!ZAModdingToolsBase.enabledSettings["Master.enableSounds"] || !ZAModdingToolsBase.enabledSettings[text])
			{
				ZAModdingToolsBase.LogDisabledViaConfig(text);
				return;
			}
			AudioClip val = ZAModdingToolsBase.assetFile.LoadAsset<AudioClip>("Assets/Landmine/fartReverb.ogg");
			AudioClip val2 = ZAModdingToolsBase.assetFile.LoadAsset<AudioClip>("Assets/Landmine/fartReverbFar.ogg");
			if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null)
			{
				ZAModdingToolsBase.LogDisabledError(text);
				return;
			}
			ZAModdingToolsBase.LogSuccess(text);
			___mineDetonate = val;
			___mineDetonateFar = val2;
		}
	}
	[HarmonyPatch(typeof(InteractTrigger))]
	internal class InteractTriggerPatch
	{
		private static bool hasBeenPatched;

		[HarmonyPatch("Interact")]
		[HarmonyPostfix]
		public static void InteractPatch(ref string ___animationString, ref Transform ___playerPositionNode)
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			string text = "Master.fixCruiserPosition";
			if (!ZAModdingToolsBase.enabledSettings[text])
			{
				ZAModdingToolsBase.LogDisabledViaConfig(text);
			}
			else if (___animationString == "SA_Truck" && !hasBeenPatched)
			{
				Transform obj = ___playerPositionNode;
				obj.localPosition += new Vector3(0f, -0.8f, 0f);
				hasBeenPatched = true;
				ZAModdingToolsBase.LogSuccess(text);
			}
		}
	}
	[HarmonyPatch(typeof(Shovel))]
	internal class ShovelPatch
	{
		private static AudioClip[] bonkAudio;

		[HarmonyPatch("HitShovelClientRpc")]
		[HarmonyPatch("HitShovel")]
		[HarmonyPrefix]
		public static void HitSFXPatch(ref AudioClip[] ___hitSFX)
		{
			string text = "Item.shovelHitBonk";
			if (!ZAModdingToolsBase.enabledSettings["Master.enableSounds"] || !ZAModdingToolsBase.enabledSettings[text])
			{
				ZAModdingToolsBase.LogDisabledViaConfig(text);
				return;
			}
			if (bonkAudio == null)
			{
				bonkAudio = (AudioClip[])(object)new AudioClip[1] { ZAModdingToolsBase.assetFile.LoadAsset<AudioClip>("Assets/Item/BonkSFX.ogg") };
			}
			if (bonkAudio == null)
			{
				ZAModdingToolsBase.LogDisabledError(text);
				return;
			}
			ZAModdingToolsBase.LogSuccess(text);
			if (___hitSFX != bonkAudio)
			{
				___hitSFX = bonkAudio;
			}
		}
	}
	[HarmonyPatch(typeof(SoundManager))]
	internal class SoundManagerPatch
	{
		[HarmonyPatch("SetPlayerVoiceFilters")]
		[HarmonyPostfix]
		public static void SetPlayerVoiceFiltersPatch()
		{
			float num = default(float);
			for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
			{
				if (SoundManager.Instance.diageticMixer.GetFloat($"PlayerPitch{i}", ref num))
				{
					ZAModdingToolsBase.mls.LogError((object)("Player " + i + ": Patched Pitch to " + num));
				}
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		private static bool suitsHaveBeenAdded = false;

		private static readonly string[] skinCollectionStrings = new string[4] { "Daler", "LonkiDonkiMeinKleinerSchnuggel", "Hitler", "Waluigi" };

		private static readonly string[] skinsCensoredStrings = new string[1] { "Hitler" };

		[HarmonyPatch("Start")]
		[HarmonyPrefix]
		public static void AddSuitsPatch(ref StartOfRound __instance)
		{
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Expected O, but got Unknown
			string text = "Master.enableSuits";
			if (!ZAModdingToolsBase.enabledSettings[text])
			{
				ZAModdingToolsBase.LogDisabledViaConfig(text);
			}
			else if ((Object)(object)__instance == (Object)null)
			{
				ZAModdingToolsBase.LogDisabledError(text);
			}
			else
			{
				if (suitsHaveBeenAdded)
				{
					return;
				}
				string[] array = skinCollectionStrings;
				foreach (string text2 in array)
				{
					Texture2D val = ((!skinsCensoredStrings.Contains(text2) || ZAModdingToolsBase.enabledSettings["Master.uncensorSuits"]) ? ZAModdingToolsBase.assetFile.LoadAsset<Texture2D>("Assets/Suits/" + text2 + ".png") : ZAModdingToolsBase.assetFile.LoadAsset<Texture2D>("Assets/Suits/" + text2 + " (censored).png"));
					if ((Object)(object)val == (Object)null)
					{
						ZAModdingToolsBase.mls.LogError((object)("Error when loading suitTexture: " + text2));
						break;
					}
					Material val2 = Object.Instantiate<Material>(__instance.unlockablesList.unlockables.Find((UnlockableItem item) => item.unlockableName == "Default").suitMaterial);
					val2.mainTexture = (Texture)(object)val;
					if ((Object)(object)val2 == (Object)null)
					{
						ZAModdingToolsBase.mls.LogError((object)("Error when loading suitMaterial: " + text2));
						break;
					}
					UnlockableItem item2 = new UnlockableItem
					{
						unlockableName = ((skinsCensoredStrings.Contains(text2) && !ZAModdingToolsBase.enabledSettings["Master.uncensorSuits"]) ? (text2 + " (censored)") : text2),
						unlockableType = 0,
						alreadyUnlocked = true,
						suitMaterial = val2,
						placedPosition = new Vector3(10.14f, 1.88f, -13.13f),
						placedRotation = new Vector3(270f, 0f, 0f)
					};
					__instance.unlockablesList.unlockables.Add(item2);
				}
				suitsHaveBeenAdded = true;
			}
		}

		[HarmonyPatch("PositionSuitsOnRack")]
		[HarmonyPrefix]
		public static void PositionSuitsOnRackPatch(ref Transform ___rightmostSuitPosition)
		{
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			string text = "Master.fixSuitRack";
			if (!ZAModdingToolsBase.enabledSettings[text])
			{
				ZAModdingToolsBase.LogDisabledViaConfig(text);
				return;
			}
			if (Chainloader.PluginInfos.SingleOrDefault((KeyValuePair<string, PluginInfo> suitsPlugin) => suitsPlugin.Value.Metadata.GUID.Equals("x753.More_Suits")).Value.Metadata.GUID.Equals("x753.More_Suits"))
			{
				ZAModdingToolsBase.mls.LogInfo((object)"Not patching asset Master.fixSuitRack - another mod has already patched this method");
				return;
			}
			UnlockableSuit[] source = Object.FindObjectsOfType<UnlockableSuit>();
			source = source.OrderBy((UnlockableSuit suit) => suit.syncedSuitID.Value).ToArray();
			for (int i = 0; i < source.Length; i++)
			{
				AutoParentToShip component = ((Component)source[i]).gameObject.GetComponent<AutoParentToShip>();
				component.overrideOffset = true;
				component.rotationOffset = new Vector3(0f, 90f, 0f);
				float num = 0.18f;
				if (source.Count() > 13)
				{
					num /= (float)Math.Min(source.Count(), 20) / 12f;
				}
				component.positionOffset = new Vector3(-2.45f, 2.75f, -8.41f) + ___rightmostSuitPosition.forward * num * (float)i;
			}
		}
	}
	[HarmonyPatch(typeof(TimeOfDay))]
	internal class TimeOfDayPatch
	{
		[HarmonyPatch("SetCompanyMood")]
		[HarmonyPostfix]
		public static void BackgroundNoisePatch(ref TimeOfDay __instance)
		{
			string text = "TimeOfDay.companyWindowSFX";
			if (!((Object)(object)__instance != (Object)null))
			{
				return;
			}
			if (!ZAModdingToolsBase.enabledSettings["Master.enableSounds"] || !ZAModdingToolsBase.enabledSettings[text])
			{
				ZAModdingToolsBase.LogDisabledViaConfig(text);
				return;
			}
			AudioClip val = ZAModdingToolsBase.assetFile.LoadAsset<AudioClip>("Assets/TimeOfDay/CompanyMood/caramelldansen.ogg");
			if ((Object)(object)val == (Object)null)
			{
				ZAModdingToolsBase.LogDisabledError(text);
				return;
			}
			__instance.currentCompanyMood.insideWindowSFX = val;
			ZAModdingToolsBase.LogSuccess(text);
		}

		[HarmonyPatch("SetCompanyMood")]
		[HarmonyPostfix]
		public static void AttackNoisePatch(ref TimeOfDay __instance)
		{
			string text = "TimeOfDay.companyAttackSFX";
			if (!((Object)(object)__instance != (Object)null))
			{
				return;
			}
			if (!ZAModdingToolsBase.enabledSettings["Master.enableSounds"] || !ZAModdingToolsBase.enabledSettings[text])
			{
				ZAModdingToolsBase.LogDisabledViaConfig(text);
				return;
			}
			AudioClip[] array = (AudioClip[])(object)new AudioClip[7];
			for (int i = 0; i <= 6; i++)
			{
				AudioClip val = ZAModdingToolsBase.assetFile.LoadAsset<AudioClip>("Assets/TimeOfDay/CompanyMood/Andreas" + (i + 1) + ".ogg");
				if ((Object)(object)val == (Object)null)
				{
					ZAModdingToolsBase.LogDisabledError(text);
				}
				else
				{
					array[i] = val;
				}
			}
			if ((Object)(object)array[0] != (Object)null)
			{
				__instance.currentCompanyMood.attackSFX = array;
				ZAModdingToolsBase.LogSuccess(text);
			}
			else
			{
				ZAModdingToolsBase.mls.LogError((object)"The Company Attack Clips were not loaded successfully!");
			}
		}

		[HarmonyPatch("playSoundDelayed")]
		[HarmonyPostfix]
		public static void TimeOfDayMusicVolumePatch(ref AudioSource ___TimeOfDayMusic)
		{
			if (ZAModdingToolsBase.enabledSettings["Master.enableSounds"])
			{
				float num = ZAModdingToolsBase.volumesSettings["TimeOfDayMusic"];
				if (num < 0f || num > 1f)
				{
					ZAModdingToolsBase.mls.LogError((object)"Volume für TimeOfDayMusic wurde nicht verändert, ungültiger Wert eingestellt.");
					return;
				}
				AudioSource obj = ___TimeOfDayMusic;
				obj.volume *= num;
			}
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void TimeOfDayMusicPatch(ref TimeOfDay __instance)
		{
			string text = "TimeOfDay.timeOfDayMusic";
			if ((Object)(object)__instance != (Object)null && (Object)(object)ZAModdingToolsBase.musicFile != (Object)null && ZAModdingToolsBase.enabledSettings["Master.enableSounds"] && ZAModdingToolsBase.enabledSettings[text])
			{
				AudioClip val = ZAModdingToolsBase.musicFile.LoadAsset<AudioClip>("Assets/TimeOfDay/TimeOfDaySFX/dawnMusic.mp3");
				AudioClip val2 = ZAModdingToolsBase.musicFile.LoadAsset<AudioClip>("Assets/TimeOfDay/TimeOfDaySFX/noonMusic.mp3");
				AudioClip val3 = ZAModdingToolsBase.musicFile.LoadAsset<AudioClip>("Assets/TimeOfDay/TimeOfDaySFX/sundownMusic.mp3");
				AudioClip val4 = ZAModdingToolsBase.musicFile.LoadAsset<AudioClip>("Assets/TimeOfDay/TimeOfDaySFX/midnightMusic.mp3");
				if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null || (Object)(object)val3 == (Object)null || (Object)(object)val4 == (Object)null)
				{
					ZAModdingToolsBase.LogDisabledError(text);
					return;
				}
				__instance.timeOfDayCues = (AudioClip[])(object)new AudioClip[4] { val, val2, val3, val4 };
				ZAModdingToolsBase.LogSuccess(text);
			}
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void TerminalShotgunAmmoPatch(ref TimeOfDay __instance)
		{
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Expected O, but got Unknown
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Expected O, but got Unknown
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Expected O, but got Unknown
			if ((Object)(object)__instance != (Object)null)
			{
				Terminal val = Object.FindObjectOfType<Terminal>();
				Item val2 = __instance.playersManager.allItemsList.itemsList.Find((Item item) => item.itemName == "Ammo");
				val2.creditsWorth = 400;
				val2.minValue = 5;
				val2.maxValue = 5;
				val.buyableItemsList = CollectionExtensions.AddToArray<Item>(val.buyableItemsList, val2);
				val.itemSalesPercentages = CollectionExtensions.AddToArray<int>(val.itemSalesPercentages, 100);
				TerminalKeyword val3 = ScriptableObject.CreateInstance<TerminalKeyword>();
				val3.word = "ammo";
				((Object)val3).name = "Ammo";
				val3.isVerb = false;
				val3.defaultVerb = ((IEnumerable<TerminalKeyword>)val.terminalNodes.allKeywords).SingleOrDefault((Func<TerminalKeyword, bool>)((TerminalKeyword buy) => buy.word == "buy"));
				val.terminalNodes.allKeywords = CollectionExtensions.AddToArray<TerminalKeyword>(val.terminalNodes.allKeywords, val3);
				TerminalNode val4 = ScriptableObject.CreateInstance<TerminalNode>();
				((Object)val4).name = "buyAmmo";
				val4.displayText = "Sie haben Kriegsgüter für die Ukraine bestellt (aka Shotgut Ammo). Insgesamt bestellen Sie [variableAmount] Stück.\nGesamtpreis Ihrer Bestellung: [totalCost].\n\nBitte CONFIRMen oder DENYen Sie diese Bestellung.\n\n";
				val4.terminalEvent = "";
				val4.clearPreviousText = true;
				val4.maxCharactersToType = 15;
				val4.buyItemIndex = val.buyableItemsList.Length - 1;
				val4.isConfirmationNode = true;
				val4.itemCost = 400;
				val4.overrideOptions = true;
				TerminalNode val5 = ScriptableObject.CreateInstance<TerminalNode>();
				val5.displayText = "Sie haben erfolgreich [variableAmount] Kriegsgüter bestellt. Ihr neuer Kontostand ist [playerCredits].\n\nDie Lieferung erfolgt nach den üblichen Bedingungen und dem ganzen Schnick Schnack. Die Items kommen wie gewohnt stündlich an Ihrer Position an.\n\nSchätzen Sie sich glücklich, denn Sie haben einen schnelleren Weg zum Tod gefunden ;)";
				val5.terminalEvent = "";
				val5.clearPreviousText = true;
				val5.maxCharactersToType = 35;
				val5.buyItemIndex = val.buyableItemsList.Length - 1;
				val5.isConfirmationNode = false;
				val5.itemCost = 400;
				val5.overrideOptions = false;
				val5.terminalOptions = (CompatibleNoun[])(object)new CompatibleNoun[0];
				val5.playSyncedClip = 0;
				TerminalNode val6 = ScriptableObject.CreateInstance<TerminalNode>();
				val6.displayText = "Figg dich du Nicker qwq";
				val6.terminalEvent = "";
				val6.clearPreviousText = true;
				val6.maxCharactersToType = 35;
				val6.buyItemIndex = -1;
				val6.isConfirmationNode = false;
				val6.itemCost = 0;
				val6.overrideOptions = false;
				val6.terminalOptions = (CompatibleNoun[])(object)new CompatibleNoun[0];
				val6.playClip = ZAModdingToolsBase.assetFile.LoadAsset<AudioClip>("Assets/TimeOfDay/Terminal/FiggDich.ogg");
				val4.terminalOptions = (CompatibleNoun[])(object)new CompatibleNoun[2]
				{
					new CompatibleNoun
					{
						noun = ((IEnumerable<TerminalKeyword>)val.terminalNodes.allKeywords).SingleOrDefault((Func<TerminalKeyword, bool>)((TerminalKeyword confirm) => confirm.word == "confirm" && ((Object)confirm).name == "Confirm")),
						result = val5
					},
					new CompatibleNoun
					{
						noun = ((IEnumerable<TerminalKeyword>)val.terminalNodes.allKeywords).SingleOrDefault((Func<TerminalKeyword, bool>)((TerminalKeyword deny) => deny.word == "deny" && ((Object)deny).name == "Deny")),
						result = val6
					}
				};
				val.terminalNodes.terminalNodes.Add(val4);
				CompatibleNoun val7 = new CompatibleNoun
				{
					noun = val3,
					result = val4
				};
				((IEnumerable<TerminalKeyword>)val.terminalNodes.allKeywords).SingleOrDefault((Func<TerminalKeyword, bool>)((TerminalKeyword buy) => buy.word == "buy")).compatibleNouns = CollectionExtensions.AddToArray<CompatibleNoun>(((IEnumerable<TerminalKeyword>)val.terminalNodes.allKeywords).SingleOrDefault((Func<TerminalKeyword, bool>)((TerminalKeyword buy) => buy.word == "buy")).compatibleNouns, val7);
			}
		}
	}
	[HarmonyPatch(typeof(FlowermanAI))]
	internal class FlowermanAIPatch
	{
		private static bool volumeWarningGiven;

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void PatchAudioVolume(ref FlowermanAI __instance)
		{
			if (ZAModdingToolsBase.enabledSettings["Master.enableSounds"])
			{
				float num = ZAModdingToolsBase.volumesSettings["Flowerman"];
				if ((num < 0f || num > 1f) && !volumeWarningGiven)
				{
					ZAModdingToolsBase.mls.LogError((object)"Volume für Flowerman wurde nicht verändert, ungültiger Wert eingestellt.");
					volumeWarningGiven = true;
					return;
				}
				AudioSource creatureVoice = ((EnemyAI)__instance).creatureVoice;
				creatureVoice.volume *= num;
				AudioSource creatureSFX = ((EnemyAI)__instance).creatureSFX;
				creatureSFX.volume *= num;
				AudioSource creatureAngerVoice = __instance.creatureAngerVoice;
				creatureAngerVoice.volume *= num;
			}
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void FlowermanCreatureAngerVoicePatch(ref EnemyBehaviourState[] ___enemyBehaviourStates)
		{
			string text = "Flowerman.creatureAngerVoice";
			if (!ZAModdingToolsBase.enabledSettings["Master.enableSounds"] || !ZAModdingToolsBase.enabledSettings[text])
			{
				ZAModdingToolsBase.LogDisabledViaConfig(text);
				return;
			}
			AudioClip val = ZAModdingToolsBase.assetFile.LoadAsset<AudioClip>("Assets/FlowermanAI/angryBritishMan.ogg");
			AudioClip val2 = ZAModdingToolsBase.assetFile.LoadAsset<AudioClip>("Assets/FlowermanAI/scotlandForever.ogg");
			if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null)
			{
				ZAModdingToolsBase.LogDisabledError(text);
				return;
			}
			ZAModdingToolsBase.LogSuccess(text);
			___enemyBehaviourStates[1].VoiceClip = val;
			___enemyBehaviourStates[1].SFXClip = val;
			___enemyBehaviourStates[2].VoiceClip = val2;
			___enemyBehaviourStates[2].SFXClip = val2;
		}
	}
	[HarmonyPatch(typeof(NoisemakerProp))]
	internal class NoisemakerPropPatch
	{
		private static bool volumeWarningGivenA;

		private static bool volumeWarningGivenC;

		[HarmonyPatch("ItemActivate")]
		[HarmonyPostfix]
		public static void UpdateVolume(ref NoisemakerProp __instance)
		{
			if (ZAModdingToolsBase.enabledSettings["Master.enableSounds"])
			{
				float num = ZAModdingToolsBase.volumesSettings["Airhorn"];
				float num2 = ZAModdingToolsBase.volumesSettings["Clownhorn"];
				if ((num < 0f || num > 1f) && !volumeWarningGivenA)
				{
					ZAModdingToolsBase.mls.LogError((object)"Volume für Airhorn wurde nicht verändert, ungültiger Wert eingestellt.");
					volumeWarningGivenA = true;
				}
				else if ((num2 < 0f || num2 > 1f) && !volumeWarningGivenC)
				{
					ZAModdingToolsBase.mls.LogError((object)"Volume für Clownhorn wurde nicht verändert, ungültiger Wert eingestellt.");
					volumeWarningGivenC = true;
				}
				else if (((GrabbableObject)__instance).itemProperties.itemName == "Airhorn")
				{
					AudioSource noiseAudio = __instance.noiseAudio;
					noiseAudio.volume *= num;
				}
				else if (((GrabbableObject)__instance).itemProperties.itemName == "Clown horn")
				{
					AudioSource noiseAudio2 = __instance.noiseAudio;
					noiseAudio2.volume *= num2;
				}
			}
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void NoisemakerAudioPatch(ref NoisemakerProp __instance)
		{
			string text = "NoisemakerProp.AirhornSFX";
			if ((Object)(object)__instance != (Object)null && ((GrabbableObject)__instance).itemProperties.itemName == "Airhorn")
			{
				if (!ZAModdingToolsBase.enabledSettings["Master.enableSounds"] || !ZAModdingToolsBase.enabledSettings[text])
				{
					ZAModdingToolsBase.LogDisabledViaConfig(text);
					return;
				}
				AudioClip[] array = (AudioClip[])(object)new AudioClip[5];
				AudioClip[] array2 = (AudioClip[])(object)new AudioClip[5];
				for (int i = 0; i <= 4; i++)
				{
					AudioClip val = ZAModdingToolsBase.assetFile.LoadAsset<AudioClip>("Assets/NoisemakerProp/Airhorn/augh" + (i + 1) + ".ogg");
					AudioClip val2 = ZAModdingToolsBase.assetFile.LoadAsset<AudioClip>("Assets/NoisemakerProp/Airhorn/augh" + (i + 1) + "reverb.ogg");
					if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null)
					{
						ZAModdingToolsBase.LogDisabledError(text);
						continue;
					}
					array[i] = val;
					array2[i] = val2;
				}
				if ((Object)(object)array[0] != (Object)null && (Object)(object)array2[0] != (Object)null)
				{
					__instance.noiseSFX = (AudioClip[])(object)new AudioClip[10]
					{
						array[0],
						array[0],
						array[0],
						array[1],
						array[1],
						array[2],
						array[2],
						array[3],
						array[3],
						array[4]
					};
					__instance.noiseSFXFar = (AudioClip[])(object)new AudioClip[10]
					{
						array2[0],
						array2[0],
						array2[0],
						array2[1],
						array2[1],
						array2[2],
						array2[2],
						array2[3],
						array2[3],
						array2[4]
					};
					__instance.minPitch = 1f;
					__instance.maxPitch = 1f;
					ZAModdingToolsBase.LogSuccess(text);
				}
				else
				{
					ZAModdingToolsBase.mls.LogError((object)"The Airhorn Clips were not loaded successfully!");
				}
			}
			text = "NoisemakerProp.ClownhornSFX";
			if (!((Object)(object)__instance != (Object)null) || !(((GrabbableObject)__instance).itemProperties.itemName == "Clown horn"))
			{
				return;
			}
			if (!ZAModdingToolsBase.enabledSettings["Master.enableSounds"] || !ZAModdingToolsBase.enabledSettings[text])
			{
				ZAModdingToolsBase.LogDisabledViaConfig(text);
				return;
			}
			AudioClip[] array3 = (AudioClip[])(object)new AudioClip[5];
			AudioClip[] array4 = (AudioClip[])(object)new AudioClip[5];
			for (int j = 0; j <= 4; j++)
			{
				AudioClip val3 = ZAModdingToolsBase.assetFile.LoadAsset<AudioClip>("Assets/NoisemakerProp/Clownhorn/moan" + (j + 1) + ".ogg");
				AudioClip val4 = ZAModdingToolsBase.assetFile.LoadAsset<AudioClip>("Assets/NoisemakerProp/Clownhorn/moan" + (j + 1) + "reverb.ogg");
				if ((Object)(object)val3 == (Object)null || (Object)(object)val4 == (Object)null)
				{
					ZAModdingToolsBase.LogDisabledError(text);
					continue;
				}
				array3[j] = val3;
				array4[j] = val4;
			}
			if ((Object)(object)array3[0] != (Object)null && (Object)(object)array4[0] != (Object)null)
			{
				__instance.noiseSFX = (AudioClip[])(object)new AudioClip[10]
				{
					array3[0],
					array3[0],
					array3[1],
					array3[1],
					array3[2],
					array3[2],
					array3[3],
					array3[3],
					array3[4],
					array3[4]
				};
				__instance.noiseSFXFar = (AudioClip[])(object)new AudioClip[10]
				{
					array4[0],
					array4[0],
					array4[1],
					array4[1],
					array4[2],
					array4[2],
					array4[3],
					array4[3],
					array4[4],
					array4[4]
				};
				__instance.minPitch = 1f;
				__instance.maxPitch = 1f;
				ZAModdingToolsBase.LogSuccess(text);
			}
			else
			{
				ZAModdingToolsBase.mls.LogError((object)"The Clownhorn Clips were not loaded successfully!");
			}
		}
	}
	[HarmonyPatch(typeof(Turret))]
	internal class TurretPatch
	{
		private static bool volumeWarningGiven;

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void UpdateVolume(ref AudioSource ___mainAudio)
		{
			if (ZAModdingToolsBase.enabledSettings["Master.enableSounds"])
			{
				float num = ZAModdingToolsBase.volumesSettings["Turret"];
				if ((num < 0f || num > 1f) && !volumeWarningGiven)
				{
					ZAModdingToolsBase.mls.LogError((object)"Volume für Turret wurde nicht verändert, ungültiger Wert eingestellt.");
					volumeWarningGiven = true;
				}
				else
				{
					AudioSource obj = ___mainAudio;
					obj.volume *= num;
				}
			}
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void TurretDetectPlayerAudioPatch(ref AudioClip ___detectPlayerSFX)
		{
			string text = "Turret.detectPlayerSFX";
			if (!ZAModdingToolsBase.enabledSettings["Master.enableSounds"] || !ZAModdingToolsBase.enabledSettings[text])
			{
				ZAModdingToolsBase.LogDisabledViaConfig(text);
				return;
			}
			AudioClip val = ZAModdingToolsBase.assetFile.LoadAsset<AudioClip>("Assets/Turret/INeedMoreBoulets.ogg");
			if ((Object)(object)val == (Object)null)
			{
				ZAModdingToolsBase.LogDisabledError(text);
				return;
			}
			ZAModdingToolsBase.LogSuccess(text);
			___detectPlayerSFX = val;
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void TurretFiringNearAudioPatch(ref AudioClip ___firingSFX)
		{
			string text = "Turret.firingSFX";
			if (!ZAModdingToolsBase.enabledSettings["Master.enableSounds"] || !ZAModdingToolsBase.enabledSettings[text])
			{
				ZAModdingToolsBase.LogDisabledViaConfig(text);
				return;
			}
			AudioClip val = ZAModdingToolsBase.assetFile.LoadAsset<AudioClip>("Assets/Turret/dubidubidu.ogg");
			if ((Object)(object)val == (Object)null)
			{
				ZAModdingToolsBase.LogDisabledError(text);
				return;
			}
			ZAModdingToolsBase.LogSuccess(text);
			___firingSFX = val;
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void TurretFiringFarAudioPatch(ref AudioClip ___firingFarSFX)
		{
			string text = "Turret.firingFarSFX";
			if (!ZAModdingToolsBase.enabledSettings["Master.enableSounds"] || !ZAModdingToolsBase.enabledSettings[text])
			{
				ZAModdingToolsBase.LogDisabledViaConfig(text);
				return;
			}
			AudioClip val = ZAModdingToolsBase.assetFile.LoadAsset<AudioClip>("Assets/Turret/drrrrr.ogg");
			if ((Object)(object)val == (Object)null)
			{
				ZAModdingToolsBase.LogDisabledError(text);
				return;
			}
			ZAModdingToolsBase.LogSuccess(text);
			___firingFarSFX = val;
		}
	}
}