Decompiled source of Longer TZP v1.0.2

BepInEx/plugins/LongerTZP.dll

Decompiled 9 months ago
using System.Diagnostics;
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 LongerTZP.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("LongerTZP")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LongerTZP")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("eb7f05b4-5952-4f82-bdc5-bd69587e6c21")]
[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 LongerTZP
{
	[BepInPlugin("Silver.LongerTZP", "LongerTZP", "1.0.1")]
	public class LongerTZP : BaseUnityPlugin
	{
		private const string modGUID = "Silver.LongerTZP";

		private const string modName = "LongerTZP";

		private const string modVersion = "1.0.1";

		private readonly Harmony harmony = new Harmony("Silver.LongerTZP");

		private static LongerTZP Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Silver.LongerTZP");
			mls.LogInfo((object)"LongerTZP is Awake");
			harmony.PatchAll(typeof(LongerTZP));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
		}
	}
}
namespace LongerTZP.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void LongerDuration(ref float ___drunknessInertia, ref bool ___increasingDrunknessThisFrame, ref float ___drunkness, ref float ___drunknessSpeed)
		{
			if (___increasingDrunknessThisFrame)
			{
				return;
			}
			if (___drunkness > 0f)
			{
				if (___drunkness > 0.3f)
				{
					___drunknessInertia = -0.05f;
				}
			}
			else
			{
				___drunknessInertia = 0f;
			}
		}
	}
}