using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Photon.Pun;
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("AnotherTestMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AnotherTestMod")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("63d550f7-2e30-444b-8e75-9061c166f488")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace DiveMod;
[BepInPlugin("Rissoe.DiverMod", "DiverMod", "1.0.0")]
public class DiverMod : BaseUnityPlugin
{
public const string modGUID = "Rissoe.DiverMod";
public const string modName = "DiverMod";
public const string modVersion = "1.0.0";
public static float DiveCharge = 0f;
public static ManualLogSource Logs = Logger.CreateLogSource("Rissoe.DiverMod");
private readonly Harmony harmony = new Harmony("Rissoe.DiverMod");
public static ConfigEntry<KeyCode> ConfigDiveKey;
private void Awake()
{
ConfigDiveKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "Dive Key", (KeyCode)102, "The key you use to Dive");
harmony.PatchAll(typeof(DiveCalled));
Logs.LogMessage((object)"Rissoe.DiverMod dives into the game.");
}
}
internal class DiveCalled
{
[HarmonyPatch(typeof(PerlinShake))]
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void Dive(PerlinShake __instance)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: 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_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
if (UnityInput.Current.GetKeyDown(DiverMod.ConfigDiveKey.Value))
{
DiverMod.DiveCharge = 0f;
}
else if (Player.localPlayer.data.fallTime <= 0f && UnityInput.Current.GetKeyUp(DiverMod.ConfigDiveKey.Value))
{
Player.localPlayer.data.isGrounded = false;
PlayerData data = Player.localPlayer.data;
data.currentStamina -= DiverMod.DiveCharge;
if (Player.localPlayer.data.currentStamina < 0f)
{
DiverMod.DiveCharge += Player.localPlayer.data.currentStamina;
Player.localPlayer.data.currentStamina = 0f;
}
Special.CallTakeDamageAndAddForceAndFall(0f, Vector3.up * DiverMod.DiveCharge + Vector3Extensions.Flat(Player.localPlayer.data.lookDirection) * DiverMod.DiveCharge, DiverMod.DiveCharge / 3f);
}
else if (UnityInput.Current.GetKey(DiverMod.ConfigDiveKey.Value))
{
DiverMod.DiveCharge = Mathf.Lerp(DiverMod.DiveCharge, 8f, Time.deltaTime / 2f);
__instance.AddShake(DiverMod.DiveCharge / 10f, 0.2f, 10f);
}
}
}
public class Special
{
public static void CallTakeDamageAndAddForceAndFall(float damage, Vector3 force, float fall)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
Player.localPlayer.refs.view.RPC("RPCA_TakeDamageAndAddForce", (RpcTarget)0, new object[3] { damage, force, fall });
}
}