Decompiled source of WeakAreFucked v0.3.7

WeakAreFucked.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LCSoundTool;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using UnityEngine;
using WeakAreFucked.Patches;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("WeakAreFucked")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WeakAreFucked")]
[assembly: AssemblyCopyright("Copyright ©Scogur 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e0355a7e-34a3-45b1-bed7-a4d25b27c425")]
[assembly: AssemblyFileVersion("0.3.7")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("0.3.7.0")]
namespace WeakAreFucked
{
	[BepInPlugin("scogur.waf", "WeakAreFucked by Scogur", "0.3.7")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class ModBase : BaseUnityPlugin
	{
		private const string modGUID = "scogur.waf";

		private const string modName = "WeakAreFucked by Scogur";

		public const string modVersion = "0.3.7";

		private readonly Harmony harmony = new Harmony("scogur.waf");

		private static ModBase Instance;

		internal ManualLogSource mls;

		internal static AudioClip aimSFX;

		internal static AudioClip dieSFX;

		internal static AudioClip frienSFX;

		internal static AudioClip vileSFX;

		internal static AudioClip nomnomSFX;

		internal static AudioClip saSFX;

		internal static AudioClip bydloSFX;

		internal static AudioClip ratSFX;

		internal static AudioClip woopSFX;

		internal static AudioClip circusSFX;

		internal static AudioClip circusFarSFX;

		internal static AudioClip fallDmgSfx;

		internal static AudioClip[] buttlerBrumSFX;

		internal static AudioClip[] introSFX;

		private void Awake()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Expected O, but got Unknown
			ConfigEntry<bool> val = ((BaseUnityPlugin)this).Config.Bind<bool>("Weak are fucked v0.3.7", "Слабым пизда?", true, "Слабым пизда");
			BoolCheckBoxConfigItem val2 = new BoolCheckBoxConfigItem(val, new BoolCheckBoxOptions());
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
			val.SettingChanged += delegate
			{
			};
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("scogur.waf");
			mls.LogInfo((object)"WAF has awaken");
			mls.LogInfo((object)"WAF is loading");
			aimSFX = SoundTool.GetAudioClip("Scogur-WeakAreFucked", "weak.mp3");
			dieSFX = SoundTool.GetAudioClip("Scogur-WeakAreFucked", "death.mp3");
			frienSFX = SoundTool.GetAudioClip("Scogur-WeakAreFucked", "frien.mp3");
			vileSFX = SoundTool.GetAudioClip("Scogur-WeakAreFucked", "jiggle.mp3");
			nomnomSFX = SoundTool.GetAudioClip("Scogur-WeakAreFucked", "nomnom.mp3");
			saSFX = SoundTool.GetAudioClip("Scogur-WeakAreFucked", "sa.mp3");
			bydloSFX = SoundTool.GetAudioClip("Scogur-WeakAreFucked", "bydlo.mp3");
			ratSFX = SoundTool.GetAudioClip("Scogur-WeakAreFucked", "rat.mp3");
			woopSFX = SoundTool.GetAudioClip("Scogur-WeakAreFucked", "woop.mp3");
			circusSFX = SoundTool.GetAudioClip("Scogur-WeakAreFucked", "circus.mp3");
			circusFarSFX = SoundTool.GetAudioClip("Scogur-WeakAreFucked", "circus_far.mp3");
			fallDmgSfx = SoundTool.GetAudioClip("Scogur-WeakAreFucked", "fall.mp3");
			SoundTool.ReplaceAudioClip("IcecreamTruckV2Christmas.wav", circusSFX);
			SoundTool.ReplaceAudioClip("IcecreamTruckV2ChristmasFar.wav", circusFarSFX);
			buttlerBrumSFX = (AudioClip[])(object)new AudioClip[4]
			{
				SoundTool.GetAudioClip("Scogur-WeakAreFucked", "bb1.mp3"),
				SoundTool.GetAudioClip("Scogur-WeakAreFucked", "bb2.mp3"),
				SoundTool.GetAudioClip("Scogur-WeakAreFucked", "bb3.mp3"),
				SoundTool.GetAudioClip("Scogur-WeakAreFucked", "bb4.mp3")
			};
			introSFX = (AudioClip[])(object)new AudioClip[4]
			{
				SoundTool.GetAudioClip("Scogur-WeakAreFucked", "announcer1.mp3"),
				SoundTool.GetAudioClip("Scogur-WeakAreFucked", "announcer2.mp3"),
				SoundTool.GetAudioClip("Scogur-WeakAreFucked", "announcer3.mp3"),
				SoundTool.GetAudioClip("Scogur-WeakAreFucked", "announcer4.mp3")
			};
			if (((Object)(object)aimSFX == (Object)null) | ((Object)(object)dieSFX == (Object)null) | ((Object)(object)frienSFX == (Object)null) | ((Object)(object)vileSFX == (Object)null) | ((Object)(object)nomnomSFX == (Object)null) | ((Object)(object)bydloSFX == (Object)null) | (buttlerBrumSFX == null) | ((Object)(object)fallDmgSfx == (Object)null) | (introSFX == null))
			{
				mls.LogError((object)"Failed to load asset");
				return;
			}
			MethodInfo methodInfo = AccessTools.Method(typeof(HoarderBugAI), "GrabTargetItemIfClose", (Type[])null, (Type[])null);
			MethodInfo methodInfo2 = AccessTools.Method(typeof(HoarderBugPatch), "GrabTargetItemIfClose_MyPatch", (Type[])null, (Type[])null);
			harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			harmony.PatchAll(typeof(ModBase));
			harmony.PatchAll(typeof(NutcrackerPatch));
			harmony.PatchAll(typeof(HoarderBugPatch));
			harmony.PatchAll(typeof(BlobPatch));
			harmony.PatchAll(typeof(MouthDogPatch));
			harmony.PatchAll(typeof(ButlerPatch));
			harmony.PatchAll(typeof(EnemyAIPatch));
			harmony.PatchAll(typeof(CentipedePatch));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
			harmony.PatchAll(typeof(StartOfRoundPatch));
			mls.LogError((object)SoundTool.replacedClips);
		}
	}
}
namespace WeakAreFucked.Patches
{
	[HarmonyPatch(typeof(BlobAI))]
	internal class BlobPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void NutcrackerAudioPatch(ref AudioClip ___idleSFX, ref AudioClip ___killPlayerSFX)
		{
			___idleSFX = ModBase.vileSFX;
			___killPlayerSFX = ModBase.frienSFX;
		}
	}
	[HarmonyPatch(typeof(ButlerEnemyAI))]
	internal class ButlerPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void ButlerAudioPatch(ref AudioClip[] ___broomSweepSFX)
		{
			AudioClip[] buttlerBrumSFX = ModBase.buttlerBrumSFX;
			___broomSweepSFX = buttlerBrumSFX;
		}
	}
	[HarmonyPatch(typeof(CentipedeAI))]
	internal class CentipedePatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void CentipedeAudioPatch(ref AudioClip ___fallShriek, ref AudioClip[] ___shriekClips)
		{
			AudioClip ratSFX = ModBase.ratSFX;
			AudioClip[] array = (AudioClip[])(object)new AudioClip[1] { ModBase.woopSFX };
			___fallShriek = ratSFX;
			___shriekClips = array;
		}
	}
	[HarmonyPatch(typeof(EnemyAI))]
	internal class EnemyAIPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void EnemyAIAudioPatch(ref AudioClip ___dieSFX)
		{
			AudioClip dieSFX = ModBase.dieSFX;
			___dieSFX = dieSFX;
		}
	}
	[HarmonyPatch(typeof(HoarderBugAI))]
	internal class HoarderBugPatch
	{
		public static void GrabTargetItemIfClose_MyPatch(HoarderBugAI __instance, ref bool __result)
		{
			if (__result)
			{
				AudioClip frienSFX = ModBase.frienSFX;
				((EnemyAI)__instance).creatureSFX.PlayOneShot(frienSFX);
			}
		}
	}
	[HarmonyPatch(typeof(MouthDogAI))]
	internal class MouthDogPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void MDogAudioPatch(ref AudioClip ___killPlayerSFX)
		{
			AudioClip nomnomSFX = ModBase.nomnomSFX;
			___killPlayerSFX = nomnomSFX;
		}
	}
	[HarmonyPatch(typeof(NutcrackerEnemyAI))]
	internal class NutcrackerPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void NutcrackerAudioPatch(ref AudioClip ___aimSFX)
		{
			AudioClip aimSFX = ModBase.aimSFX;
			___aimSFX = aimSFX;
		}
	}
	internal class Phone
	{
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void infiniteSprintPatch(ref float ___sprintMeter)
		{
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void ShipIntro(ref AudioClip ___shipIntroSpeechSFX)
		{
			Random random = new Random();
			___shipIntroSpeechSFX = ModBase.introSFX[random.Next(0, ModBase.introSFX.Length - 1)];
		}
	}
}