Decompiled source of LCPogMod v0.0.1

LCPogMod.dll

Decompiled 7 months ago
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
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("LCPogMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LCPogMod")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b37a602d-75dc-4e65-9f4b-c32a17e64687")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LCPogMod
{
	[BepInPlugin("LCPogMod", "LC Pog Mod", "0.0.1")]
	public class PogMod : BaseUnityPlugin
	{
		private const string modGUID = "LCPogMod";

		private const string modName = "LC Pog Mod";

		private const string modVersion = "0.0.1";

		private readonly Harmony harmony = new Harmony("LCPogMod");

		private static PogMod instance;

		private void Awake()
		{
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"LC Pog Mod loaded. Poggers.");
			harmony.PatchAll();
		}
	}
}
namespace LCPogMod.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyTranspiler]
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].opcode == OpCodes.Ldc_R4 && ((float)list[i].operand == 0.15f || (float)list[i].operand == 0.1f))
				{
					list[i].operand = 0f;
				}
			}
			return list.AsEnumerable();
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void BigJumpForce(ref float ___jumpForce)
		{
			___jumpForce = 25f;
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void NoFallDamage(ref bool ___takingFallDamage)
		{
			___takingFallDamage = false;
		}

		[HarmonyPatch("Jump_performed")]
		[HarmonyPrefix]
		private static void VeryJumpable(PlayerControllerB __instance, ref bool ___isPlayerSliding, ref float ___playerSlidingTimer, ref bool ___isExhausted, ref bool ___isCrouching, ref Coroutine ___jumpCoroutine)
		{
			___isPlayerSliding = false;
			___playerSlidingTimer = 0f;
			___isExhausted = false;
			___isCrouching = false;
			MethodInfo method = typeof(PlayerControllerB).GetMethod("PlayerJump", BindingFlags.NonPublic);
			if (method != null)
			{
				___jumpCoroutine = ((MonoBehaviour)__instance).StartCoroutine((IEnumerator)method.Invoke(__instance, new object[0]));
			}
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void SprintSoFast(ref bool ___isSprinting, ref float ___sprintMultiplier, ref float ___sprintMeter, ref bool ___isExhausted)
		{
			___sprintMultiplier = (___isSprinting ? Mathf.Lerp(___sprintMultiplier, 8f, Time.deltaTime) : Mathf.Lerp(___sprintMultiplier, 1f, Time.deltaTime));
			if (___isExhausted)
			{
				___sprintMeter = Mathf.Clamp(___sprintMeter + Time.deltaTime / 12f, 0f, 1f);
			}
			else
			{
				___sprintMeter = Mathf.Clamp(___sprintMeter + Time.deltaTime / 48f, 0f, 1f);
			}
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void AintGonnaDrown(ref int ___sourcesCausingSinking, ref bool ___isSinking, ref bool ___isUnderwater, ref float ___sinkingValue)
		{
			StartOfRound.Instance.drowningTimer = 1f;
			___sourcesCausingSinking = 0;
			___isSinking = false;
			___isUnderwater = false;
			___sinkingValue = 0f;
		}
	}
}