Decompiled source of LethalEnhanced v1.2.1

Lethal Enhanced.dll

Decompiled 6 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 GameNetcodeStuff;
using HarmonyLib;
using Lethal_Enhance;
using Lethal_Enhanced.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("Lethal Enhanced")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Lethal Enhanced")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("6b777bb9-ad73-4418-b39b-e5188fd56d44")]
[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 Lethal_Enhance
{
	[BepInPlugin("Poseidon.Lethal_Enhance", "Lethal Enhance", "1.2.1")]
	public class TutorialModBase : BaseUnityPlugin
	{
		private const string modGUID = "Poseidon.Lethal_Enhance";

		private const string modName = "Lethal Enhance";

		private const string modVersion = "1.2.1";

		private readonly Harmony harmony = new Harmony("Poseidon.Lethal_Enhance");

		private static TutorialModBase Instance;

		internal ManualLogSource mls;

		internal static List<AudioClip> SoundFX;

		internal static AssetBundle Bundle;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Poseidon.Lethal_Enhance");
			harmony.PatchAll(typeof(TutorialModBase));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
			harmony.PatchAll(typeof(JesterAudioPatch));
			harmony.PatchAll(typeof(StartOfRoundPatch));
			mls = ((BaseUnityPlugin)this).Logger;
			SoundFX = new List<AudioClip>();
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			location = location.TrimEnd("Lethal Enhanced.dll".ToCharArray());
			Bundle = AssetBundle.LoadFromFile(location + "audio");
			if ((Object)(object)Bundle != (Object)null)
			{
				mls.LogInfo((object)"All Sound Effects Have Been Loaded.");
				SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
			}
			else
			{
				mls.LogError((object)"Oh noes the sound no work.");
			}
		}
	}
}
namespace Lethal_Enhanced.Patches
{
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideAudio(StartOfRound __instance)
		{
			__instance.shipIntroSpeechSFX = TutorialModBase.SoundFX[1];
		}
	}
	[HarmonyPatch(typeof(JesterAI))]
	internal class JesterAudioPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideAudio(JesterAI __instance)
		{
			__instance.popUpSFX = TutorialModBase.SoundFX[0];
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void patchUpdate(ref bool ___isFallingFromJump, ref float ___sprintMeter, ref bool ___isFallingNoJump, ref float ___playerSlidingTimer, ref float ___slideFriction, ref bool ___isJumping, ref bool ___isSprinting, ref float ___movementSpeed)
		{
			___sprintMeter = 1f;
			___isFallingNoJump = false;
			___playerSlidingTimer = 0f;
			___slideFriction = 0f;
			if (___isFallingFromJump | ___isJumping)
			{
				if (___isSprinting)
				{
					___movementSpeed = 10f;
				}
				else
				{
					___movementSpeed = 5f;
				}
			}
			else
			{
				___movementSpeed = 5f;
			}
		}
	}
}