using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
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("OldFallDamageMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldFallDamageMod")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("30667208-0a0f-493a-b3df-17c33f658d78")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace OldFallDamageMod
{
[BepInPlugin("Confusified.v40FallDamageStandalone", "v40 Fall Damage (Standalone version)", "1.0.1")]
public class FallDamagePatchBase : BaseUnityPlugin
{
private const string modGUID = "Confusified.v40FallDamageStandalone";
private const string modName = "v40 Fall Damage (Standalone version)";
private const string modVersion = "1.0.1";
private readonly Harmony _harmony = new Harmony("Confusified.v40FallDamageStandalone");
public ConfigFile Configuration = new ConfigFile(Utility.CombinePaths(new string[2]
{
Paths.ConfigPath + "\\Confusified\\",
"Confusified.v40FallDamageStandalone".Substring(12) + ".cfg"
}), false);
public static ConfigEntry<bool> ModEnabled;
private void Awake()
{
SetModConfig();
_harmony.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"v40 Fall Damage (Standalone version) 1.0.1 has loaded");
}
private void SetModConfig()
{
ModEnabled = Configuration.Bind<bool>("Mod Settings", "Enabled", true, "Toggle the mod");
}
}
}
namespace OldFallDamageMod.Patch
{
[HarmonyPatch(typeof(PlayerControllerB))]
internal class PatchFallDamage
{
[HarmonyPatch("PlayerHitGroundEffects")]
[HarmonyPrefix]
private static void PatchedFallDamage(PlayerControllerB __instance)
{
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
__instance.GetCurrentMaterialStandingOn();
if (__instance.fallValue < -9f)
{
if (__instance.fallValue < -16f)
{
__instance.movementAudio.PlayOneShot(StartOfRound.Instance.playerHitGroundHard, 1f);
WalkieTalkie.TransmitOneShotAudio(__instance.movementAudio, StartOfRound.Instance.playerHitGroundHard, 1f);
}
else if (__instance.fallValue < -2f)
{
__instance.movementAudio.PlayOneShot(StartOfRound.Instance.playerHitGroundSoft, 1f);
}
__instance.LandFromJumpServerRpc(__instance.fallValue < -16f);
}
if (__instance.fallValueUncapped < -30f && FallDamagePatchBase.ModEnabled.Value)
{
__instance.takingFallDamage = true;
}
if (__instance.takingFallDamage && !__instance.jetpackControls && !__instance.disablingJetpackControls && !__instance.isSpeedCheating)
{
if (__instance.fallValueUncapped < -50f)
{
__instance.DamagePlayer(100, true, true, (CauseOfDeath)2, 0, false, default(Vector3));
}
else
{
int num = 40;
if (FallDamagePatchBase.ModEnabled.Value)
{
num = 20;
}
__instance.DamagePlayer(num, true, true, (CauseOfDeath)2, 0, false, default(Vector3));
}
}
if (__instance.fallValue < -16f)
{
RoundManager.Instance.PlayAudibleNoise(((Component)__instance).transform.position, 7f, 0.5f, 0, false, 0);
}
}
}
}