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 Unity.Netcode;
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("Booling2")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Booling2")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7834c120-9a81-4af7-b06d-23faf74a54b2")]
[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 Booling2
{
[BepInPlugin("Virus.Booling2", "Booling2", "1.0.0.0")]
public class Booling2 : BaseUnityPlugin
{
public static class PluginInfo
{
public const string modGUID = "Virus.Booling2";
public const string modName = "Booling2";
public const string modVersion = "1.0.0.0";
}
private readonly Harmony harmony = new Harmony("Virus.Booling2");
private static Booling2 instance;
internal static ManualLogSource Log;
private void Awake()
{
Log = Logger.CreateLogSource("Virus.Booling2");
Log.Log((LogLevel)16, (object)"BOOLING loaded!");
if ((Object)(object)instance == (Object)null)
{
instance = this;
}
harmony.PatchAll(typeof(Booling2).Assembly);
}
}
}
namespace Booling2.Patches
{
[HarmonyPatch(typeof(PlayerControllerB))]
internal class PlayerPatch
{
internal class MovementScript : MonoBehaviour
{
public PlayerControllerB myPlayer;
private bool inAir;
public static Vector3 wantedVelToAdd;
public float jumpTime;
private Vector3 previousForward;
public void Update()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
if (!(((Component)this).transform.position.y > -80f))
{
return;
}
if (myPlayer.playerBodyAnimator.GetBool("Jumping") && jumpTime < 0.1f)
{
myPlayer.fallValue = myPlayer.jumpForce;
jumpTime += Time.deltaTime * 10f;
}
myPlayer.sprintMeter = 100f;
if (!myPlayer.thisController.isGrounded && !myPlayer.isClimbingLadder)
{
if (!inAir)
{
inAir = true;
Vector3 velocity = myPlayer.thisController.velocity;
velocity.y = 0f;
wantedVelToAdd += 0.006f * velocity;
}
wantedVelToAdd.y = 0f;
CharacterController thisController = myPlayer.thisController;
Vector3 forward = ((Component)myPlayer).gameObject.transform.forward;
Vector3 val = wantedVelToAdd;
thisController.Move(forward * ((Vector3)(ref val)).magnitude);
Vector3 forward2 = ((Component)myPlayer).gameObject.transform.forward;
Vector3 val2 = forward2 - previousForward;
float num = 0.01f;
val = val2;
if (((Vector3)(ref val)).magnitude > num)
{
wantedVelToAdd += new Vector3(0.0005f, 0.0005f, 0.0005f);
}
previousForward = forward2;
}
else
{
wantedVelToAdd = Vector3.Lerp(wantedVelToAdd, Vector3.zero, Time.deltaTime * 0.001f);
inAir = false;
jumpTime = 0f;
}
_ = myPlayer.thisController.isGrounded;
}
}
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void InfiniteSprint(ref float ___sprintMeter)
{
}
[HarmonyPatch("ConnectClientToPlayerObject")]
[HarmonyPostfix]
private static void AddMovementScript(PlayerControllerB __instance)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Expected O, but got Unknown
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
if ((Object)__instance != (Object)null && (Object)((Component)__instance).gameObject.GetComponentInChildren<MovementScript>() == (Object)null && ((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled)
{
((Component)__instance).gameObject.AddComponent<MovementScript>().myPlayer = __instance;
Booling2.Log.LogMessage((object)"Gave player the movement script");
}
}
}
}