Decompiled source of AouldsTweaks v1.0.1

AouldsTweaks.dll

Decompiled 9 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using AouldsTweaks.Patches;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
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("AouldsTweaks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AouldsTweaks")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("bf41b0dc-196a-44fc-9dc9-c6fce1049972")]
[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 AouldsTweaks
{
	[BepInPlugin("Aouldrain.AouldsTweaks", "AouldsTweaks", "0.1.1")]
	public class AouldsTweaksBase : BaseUnityPlugin
	{
		private const string modGUID = "Aouldrain.AouldsTweaks";

		private const string modName = "AouldsTweaks";

		private const string modVersion = "0.1.1";

		private readonly Harmony harmony = new Harmony("Aouldrain.AouldsTweaks");

		private static AouldsTweaksBase Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Aouldrain.AouldsTweaks");
			mls.LogInfo((object)"Big Booty Bitches be like");
			mls.LogInfo((object)".▄▄▄·.......▄•.▄▌▄▄▌..·▄▄▄▄..▄▄▄...▄▄▄·.▪...▐.▄.");
			mls.LogInfo((object)"▐█.▀█.▪.....█▪██▌██•..██▪.██.▀▄.█·▐█.▀█.██.•█▌▐█");
			mls.LogInfo((object)"▄█▀▀█..▄█▀▄.█▌▐█▌██▪..▐█·.▐█▌▐▀▀▄.▄█▀▀█.▐█·▐█▐▐▌");
			mls.LogInfo((object)"▐█.▪▐▌▐█▌.▐▌▐█▄█▌▐█▌▐▌██..██.▐█•█▌▐█.▪▐▌▐█▌██▐█");
			mls.LogInfo((object)".▀..▀..▀█▄▀▪.▀▀▀..▀▀▀.▀▀▀▀▀•..▀..▀.▀..▀.▀▀▀▀▀.█▪");
			mls.LogInfo((object)"AouldsTweaks Version [0.1.1] has successfully loaded.");
			harmony.PatchAll(typeof(AouldsTweaksBase));
			harmony.PatchAll(typeof(PlayerControllerPatch));
			harmony.PatchAll(typeof(Minefix));
		}
	}
}
namespace AouldsTweaks.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void weightSprintPatch(ref float ___carryWeight, ref float ___sprintMeter)
		{
			if (___carryWeight == 1f)
			{
				___sprintMeter += 0.001f;
			}
		}

		public override bool Equals(object obj)
		{
			return base.Equals(obj);
		}

		public override int GetHashCode()
		{
			return base.GetHashCode();
		}

		public override string ToString()
		{
			return base.ToString();
		}
	}
	[HarmonyPatch(typeof(Landmine))]
	internal class Minefix
	{
		[HarmonyPatch("OnTriggerEnter")]
		[HarmonyPrefix]
		private static bool TriggerEnterPrefix(ref Collider other, ref bool ___localPlayerOnMine, Landmine __instance)
		{
			if (((Component)other).CompareTag("Player"))
			{
				__instance.mineAudio.PlayOneShot(__instance.minePress);
				WalkieTalkie.TransmitOneShotAudio(__instance.mineAudio, __instance.minePress, 1f);
				PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
				if ((Object)(object)component == (Object)(object)GameNetworkManager.Instance.localPlayerController)
				{
					___localPlayerOnMine = false;
					return false;
				}
				return true;
			}
			return true;
		}

		[HarmonyPatch("TriggerMineOnLocalClientByExiting")]
		[HarmonyPrefix]
		private static void MineExitPrefix(Landmine __instance, ref bool ___hasExploded, ref bool ___sendingExplosionRPC, ref bool ___localPlayerOnMine)
		{
			if (!___hasExploded && !___localPlayerOnMine)
			{
				__instance.SetOffMineAnimation();
				___sendingExplosionRPC = true;
				__instance.ExplodeMineServerRpc();
			}
		}
	}
}