using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
using Zorro.Core;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("NoFallCancel")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("NoFallCancel")]
[assembly: AssemblyTitle("NoFallCancel")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace NoFDCancel
{
[HarmonyPatch(typeof(Character), "RPCA_Revive")]
internal static class RespawnPatch
{
internal static void Prefix(Character __instance)
{
if (!__instance.IsLocal)
{
__instance.data.sinceGrounded = -30f;
__instance.data.sinceJump = -30f;
}
}
}
[HarmonyPatch(typeof(CharacterMovement), "CheckFallDamage")]
internal static class NonRagdollFDRemoval
{
internal static bool Prefix(CharacterMovement __instance)
{
if (__instance.FallTime() > __instance.fallDamageTime)
{
float num = Mathf.Max(__instance.FallFactor(3f, 1.5f), 0.05f);
float num2 = num;
num = Mathf.Min(num, __instance.MaxVelDmg());
float num3 = num / num2;
if (num >= 0.025f)
{
num *= Ascents.fallDamageMultiplier;
if (__instance.character.data.fallSeconds <= 0f && Plugin.removeNonRagdollFallCancel.Value && PhotonNetwork.IsMasterClient && Plugin.enabled.Value)
{
float[] array = new float[CharacterAfflictions.NumStatusTypes];
array[0] = num;
__instance.character.refs.view.RPC("RPC_ApplyStatusesFromFloatArray", (RpcTarget)0, new object[1] { array });
}
if (num > 0.3f && __instance.character.IsLocal)
{
__instance.character.Fall(num * 5f, 0f);
}
if (__instance.character.refs.afflictions.AddStatus((STATUSTYPE)0, num, false, true, true))
{
Singleton<AchievementManager>.Instance.AddToRunBasedFloat((RUNBASEDVALUETYPE)3, num);
}
}
}
return false;
}
}
[HarmonyPatch(typeof(Bodypart), "SnapToAnim")]
internal static class ClientSideChange
{
internal static bool Prefix(Bodypart __instance)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: 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_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = __instance.rig.linearVelocity * 2f;
__instance.Start();
Vector3 val2 = __instance.WorldTargetPos() - __instance.WorldCenterOfMass();
Transform transform = ((Component)__instance).transform;
transform.position += val2;
if (__instance.targetForward != Vector3.zero && __instance.targetUp != Vector3.zero)
{
((Component)__instance).transform.rotation = Quaternion.LookRotation(__instance.targetForward, __instance.targetUp);
}
bool isKinematic = __instance.rig.isKinematic;
if (PhotonNetwork.IsMasterClient && Plugin.enabled.Value && !Plugin.charsToExclude.Contains(__instance.character.refs.view.ViewID) && __instance.character.data.fallSeconds > 0f && Plugin.removeRagdollFallCancel.Value)
{
Rigidbody rig = __instance.rig;
rig.linearVelocity *= 0f;
Rigidbody rig2 = __instance.rig;
rig2.angularVelocity *= 0f;
__instance.character.AddForceToBodyPart(__instance.rig, val, val);
}
return false;
}
}
[HarmonyPatch(typeof(Character), "Awake")]
internal static class PingCharPatch
{
internal static void Postfix(Character __instance)
{
((Component)__instance).gameObject.AddComponent<PingPong>();
if (__instance.IsLocal)
{
((MonoBehaviourPun)__instance).photonView.RPC("RPC_Ping", (RpcTarget)2, new object[1] { __instance.refs.view.ViewID });
}
}
}
internal class PingPong : MonoBehaviour
{
[PunRPC]
public void RPC_Ping(int viewIdOfCharToExclude)
{
Plugin.charsToExclude.Add(viewIdOfCharToExclude);
}
}
[BepInPlugin("nofdcancel", "No_Fall_Damage_Cancel", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
internal static List<int> charsToExclude = new List<int>();
internal static ConfigEntry<bool> removeRagdollFallCancel;
internal static ConfigEntry<bool> removeNonRagdollFallCancel;
internal static ConfigEntry<bool> enabled;
internal static ManualLogSource Log { get; private set; } = null;
private void Awake()
{
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Expected O, but got Unknown
enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Host Options", "Enabled", true, (ConfigDescription)null);
removeRagdollFallCancel = ((BaseUnityPlugin)this).Config.Bind<bool>("Host Options", "Remove Ragdoll Fall Cancel", true, (ConfigDescription)null);
removeNonRagdollFallCancel = ((BaseUnityPlugin)this).Config.Bind<bool>("Host Options", "Remove Non Ragdoll Fall Cancel", true, (ConfigDescription)null);
Log = ((BaseUnityPlugin)this).Logger;
Log.LogInfo((object)"Plugin No Fall Damage Cancel is loaded!");
Harmony val = new Harmony("nofdcancel");
val.PatchAll();
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}