Decompiled source of TheDavidMod v1.0.1

The David Mod.dll

Decompiled 8 months ago
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LCSoundTool;
using The_David_Mod.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("The David Mod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("The David Mod")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("dabacce3-467e-4864-8f6e-78c4fdf61bbd")]
[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 The_David_Mod
{
	[HarmonyPatch(typeof(HoarderBugAI))]
	internal class HoarderBugAIPatch
	{
		public static AudioClip[] chineseAngryClips = (AudioClip[])(object)new AudioClip[5];

		public static AudioSource deathAudioSource;

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void soundChange(ref HoarderBugAI __instance)
		{
			chineseAngryClips[0] = TheDavidMod.chineseAngry1;
			chineseAngryClips[1] = TheDavidMod.chineseAngry2;
			chineseAngryClips[2] = TheDavidMod.chineseAngry3;
			chineseAngryClips[3] = TheDavidMod.chineseAngry4;
			chineseAngryClips[4] = TheDavidMod.chineseAngry5;
			deathAudioSource = ((Component)__instance).gameObject.AddComponent<AudioSource>();
			__instance.chitterSFX = chineseAngryClips;
			__instance.angryScreechSFX = chineseAngryClips;
			__instance.bugFlySFX = TheDavidMod.chinaNumberOne;
		}

		[HarmonyPatch("KillEnemy")]
		[HarmonyPostfix]
		private static void deathSound()
		{
			deathAudioSource.PlayOneShot(TheDavidMod.death);
		}
	}
	[HarmonyPatch(typeof(ItemDropship))]
	internal class ItemDropShipPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void thePatch(ItemDropship __instance)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			AudioClip stickTalk = TheDavidMod.stickTalk;
			AudioClip stickTalkFarAway = TheDavidMod.stickTalkFarAway;
			AudioSource component = ((Component)((Component)__instance).transform.Find("Music")).gameObject.GetComponent<AudioSource>();
			AudioSource component2 = ((Component)((Component)((Component)__instance).transform.Find("Music")).transform.Find("Music (1)")).gameObject.GetComponent<AudioSource>();
			component.clip = stickTalk;
			component2.clip = stickTalkFarAway;
		}
	}
	[HarmonyPatch(typeof(ShipTeleporter))]
	internal class ShipTeleporterPatch
	{
		[HarmonyPatch("PressTeleportButtonOnLocalClient")]
		[HarmonyPrefix]
		private static void soundChange(ref ShipTeleporter __instance)
		{
			if (TheDavidMod.player.playerSteamId == 76561198073606307L)
			{
				__instance.teleporterSpinSFX = TheDavidMod.rapGod;
			}
		}
	}
	[HarmonyPatch(typeof(Shovel))]
	internal class ShovelPatch
	{
		public static AudioClip[] hitClips = (AudioClip[])(object)new AudioClip[1] { TheDavidMod.davidHit3 };

		[HarmonyPatch("__initializeVariables")]
		[HarmonyPrefix]
		private static void soundPatch(ref Shovel __instance)
		{
			__instance.hitSFX = hitClips;
		}
	}
	[HarmonyPatch(typeof(SpringManAI))]
	internal class SpringManAIPatch
	{
		[HarmonyPatch("SetAnimationStopClientRpc")]
		[HarmonyPostfix]
		private static void soundAddition(ref SpringManAI __instance)
		{
			((EnemyAI)__instance).creatureSFX.PlayOneShot(TheDavidMod.fnafSpook);
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void LoadSound(ref StartOfRound __instance)
		{
		}
	}
	[BepInPlugin("GUID", "Name", "1.0")]
	public class TheDavidMod : BaseUnityPlugin
	{
		private const string modGUID = "WoodenTree-TheDavidMod";

		private const string modName = "The David Mod";

		private const string modVersion = "1.0.0.0";

		private readonly Harmony harmony = new Harmony("WoodenTree-TheDavidMod");

		public static TheDavidMod Instance;

		internal ManualLogSource mls;

		public static PlayerControllerB player;

		public static StartOfRound startOfRound;

		public static AudioClip davidRage;

		public static AudioClip davidGetHit;

		public static AudioClip stickTalk;

		public static AudioClip stickTalkFarAway;

		public static AudioClip chineseAngry;

		public static AudioClip davidWindup;

		public static AudioClip davidHit1;

		public static AudioClip davidHit2;

		public static AudioClip davidHit3;

		public static AudioClip chineseAngry1;

		public static AudioClip chineseAngry2;

		public static AudioClip chineseAngry3;

		public static AudioClip chineseAngry4;

		public static AudioClip chineseAngry5;

		public static AudioClip chinaNumberOne;

		public static AudioClip rapGod;

		public static AudioClip death;

		public static AudioClip fnafSpook;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("WoodenTree-TheDavidMod");
			mls.LogInfo((object)"THE DAVID MOD HAS AWOKEN");
			harmony.PatchAll(typeof(TheDavidMod));
			harmony.PatchAll(typeof(StartOfRoundPatch));
			harmony.PatchAll(typeof(ItemDropShipPatch));
			harmony.PatchAll(typeof(HoarderBugAIPatch));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
			harmony.PatchAll(typeof(SpringManAIPatch));
			harmony.PatchAll(typeof(ShovelPatch));
			harmony.PatchAll(typeof(ShipTeleporterPatch));
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "The David Mod";

		public const string PLUGIN_NAME = "";

		public const string PLUGIN_VERSION = "1.0.0.0";
	}
}
namespace The_David_Mod.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void loadSounds(ref PlayerControllerB __instance)
		{
			string text = Path.Combine(Paths.PluginPath, "WoodenTree-TheDavidMod");
			TheDavidMod.player = __instance;
			TheDavidMod.davidRage = SoundTool.GetAudioClip(text, "Sounds", "davidNoWay.ogg");
			TheDavidMod.davidGetHit = SoundTool.GetAudioClip(text, "Sounds", "davidGetHit.ogg");
			TheDavidMod.chineseAngry = SoundTool.GetAudioClip(text, "Sounds", "chineseAngry.ogg");
			TheDavidMod.davidWindup = SoundTool.GetAudioClip(text, "Sounds", "davidWindup.ogg");
			TheDavidMod.davidHit1 = SoundTool.GetAudioClip(text, "Sounds", "davidHit1.ogg");
			TheDavidMod.davidHit2 = SoundTool.GetAudioClip(text, "Sounds", "davidHit2.ogg");
			TheDavidMod.davidHit3 = SoundTool.GetAudioClip(text, "Sounds", "davidHit3.ogg");
			TheDavidMod.chineseAngry1 = SoundTool.GetAudioClip(text, "Sounds", "chineseAngry1.ogg");
			TheDavidMod.chineseAngry2 = SoundTool.GetAudioClip(text, "Sounds", "chineseAngry2.ogg");
			TheDavidMod.chineseAngry3 = SoundTool.GetAudioClip(text, "Sounds", "chineseAngry3.ogg");
			TheDavidMod.chineseAngry4 = SoundTool.GetAudioClip(text, "Sounds", "chineseAngry4.ogg");
			TheDavidMod.chineseAngry5 = SoundTool.GetAudioClip(text, "Sounds", "chineseAngry5.ogg");
			TheDavidMod.chinaNumberOne = SoundTool.GetAudioClip(text, "Sounds", "chinaNumberOne.ogg");
			TheDavidMod.rapGod = SoundTool.GetAudioClip(text, "Sounds", "rapGod.ogg");
			TheDavidMod.death = SoundTool.GetAudioClip(text, "Sounds", "death.ogg");
			TheDavidMod.fnafSpook = SoundTool.GetAudioClip(text, "Sounds", "fnafSpook.ogg");
			SoundTool.SendNetworkedAudioClip(TheDavidMod.death);
			SoundTool.SendNetworkedAudioClip(TheDavidMod.fnafSpook);
			SoundTool.SyncNetworkedAudioClips();
			TheDavidMod.stickTalk = SoundTool.GetAudioClip(text, "Sounds", "stickTalk.ogg");
			TheDavidMod.stickTalkFarAway = SoundTool.GetAudioClip(text, "Sounds", "stickTalkFarAway.ogg");
			TheDavidMod.Instance.mls.LogInfo((object)"David sounds loaded!");
			__instance.playersManager.hitPlayerSFX = TheDavidMod.davidGetHit;
		}

		[HarmonyPatch("Jump_performed")]
		[HarmonyPostfix]
		private static void jumpPatch(ref PlayerControllerB __instance)
		{
		}
	}
}