using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using Zorro.Settings;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("RagdollAnywhere")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Allow you to ragdoll anywhere")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+f10afb4f1f4363e8fb6646330f84ec60d0ccc595")]
[assembly: AssemblyProduct("RagdollAnywhere")]
[assembly: AssemblyTitle("RagdollAnywhere")]
[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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace RagdollAnywhere
{
[BepInPlugin("RagdollAnywhere", "RagdollAnywhere", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
public static PlayerRagdoll localPLayer;
public static KeyCodeSetting ragdollKeySetting;
public static MethodInfo ragdollMethod;
public bool isRagdoll;
public float ragdollTimer;
private void Awake()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
PluginConfig.InitConfig(((BaseUnityPlugin)this).Config);
Harmony val = new Harmony("RagdollAnywhere.patch");
val.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin RagdollAnywhere is loaded!");
}
private void Update()
{
if (ragdollMethod == null)
{
return;
}
if (ragdollKeySetting != null)
{
if (Input.GetKeyDown((KeyCode)((IntSetting)ragdollKeySetting).Value))
{
isRagdoll = true;
ragdollTimer = 0.75f;
ragdollMethod.Invoke(localPLayer, new object[1] { 1f });
}
else if (Input.GetKeyUp((KeyCode)((IntSetting)ragdollKeySetting).Value))
{
isRagdoll = false;
}
}
ragdollTimer -= Time.deltaTime;
if (isRagdoll && ragdollTimer <= 0f)
{
ragdollTimer = 0.75f;
ragdollMethod.Invoke(localPLayer, new object[1] { 1f });
}
}
}
[HarmonyPatch(typeof(Player), "Awake")]
internal class PatchPlayerRagdoll
{
public static void Postfix(Player __instance)
{
if (__instance.IsLocal)
{
Plugin.localPLayer = ((Component)__instance).gameObject.GetComponent<PlayerRagdoll>();
Plugin.ragdollMethod = ((object)Plugin.localPLayer).GetType().GetMethod("CallFall", BindingFlags.Instance | BindingFlags.NonPublic);
}
}
}
[HarmonyPatch(typeof(SettingsHandler))]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal class PatchSettingsHandlerCtor
{
public static void Postfix(ref List<Setting> ___settings, ref ISettingsSaveLoad ____settingsSaveLoad)
{
if (___settings != null)
{
RagdollKeybindSetting ragdollKeybindSetting = new RagdollKeybindSetting();
((Setting)ragdollKeybindSetting).Load(____settingsSaveLoad);
((Setting)ragdollKeybindSetting).ApplyValue();
___settings.Add((Setting)(object)ragdollKeybindSetting);
Plugin.ragdollKeySetting = (KeyCodeSetting)(object)ragdollKeybindSetting;
}
}
}
internal static class PluginConfig
{
public static ConfigFile config;
public static void InitConfig(ConfigFile _config)
{
config = _config;
}
}
public class RagdollKeybindSetting : KeyCodeSetting, IExposedSetting
{
protected override KeyCode GetDefaultKey()
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
return (KeyCode)120;
}
public SettingCategory GetSettingCategory()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return (SettingCategory)2;
}
public string GetDisplayName()
{
return "Ragdoll";
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "RagdollAnywhere";
public const string PLUGIN_NAME = "RagdollAnywhere";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace RagdollAnywhere.Properties
{
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[DebuggerNonUserCode]
[CompilerGenerated]
internal class Resources
{
private static ResourceManager resourceMan;
private static CultureInfo resourceCulture;
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager
{
get
{
if (resourceMan == null)
{
ResourceManager resourceManager = new ResourceManager("RagdollAnywhere.Properties.Resources", typeof(Resources).Assembly);
resourceMan = resourceManager;
}
return resourceMan;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
internal Resources()
{
}
}
}