using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using LethalModUtils;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.InputSystem;
[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("baer1.KillBind")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("2.0.6.0")]
[assembly: AssemblyInformationalVersion("2.0.6+0b59631426b24aab1967f8c065a486caf591684c")]
[assembly: AssemblyProduct("KillBind")]
[assembly: AssemblyTitle("baer1.KillBind")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.0.6.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 KillBind
{
public class ModKeyBindings : LcInputActions
{
[InputAction(/*Could not decode attribute arguments.*/)]
public InputAction KillKey { get; set; } = null;
}
[BepInPlugin("baer1.KillBind", "KillBind", "2.0.6")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class KillBind : BaseUnityPlugin
{
public enum DeathAnimationOptions
{
CauseOfDeath = -2,
None,
Normal,
HeadBurst,
Spring,
Electrocuted,
ComedyMask,
TragedyMask,
Burnt,
Sliced,
HeadGone,
Pieces,
Scratched,
Flowers
}
[HarmonyPatch(typeof(PlayerControllerB), "Update")]
internal class UpdatePatch
{
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_003b: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Expected O, but got Unknown
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Expected O, but got Unknown
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Expected O, but got Unknown
return CodeMatcherExtensions.MatchBack(CodeMatcherExtensions.MatchForward(new CodeMatcher(instructions, (ILGenerator)null), (CodeMatch[])(object)new CodeMatch[1]
{
new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(CharacterController), "Move", (Type[])null, (Type[])null), (string)null)
}), (CodeMatch[])(object)new CodeMatch[1]
{
new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.PropertyGetter(typeof(Time), "deltaTime"), (string)null)
}).Insert((CodeInstruction[])(object)new CodeInstruction[2]
{
new CodeInstruction(OpCodes.Dup, (object)null),
new CodeInstruction(OpCodes.Call, (object)AccessTools.PropertySetter(typeof(KillBind), "BodyVelocity"))
}).InstructionEnumeration();
}
}
private static readonly ModKeyBindings modKeyBindings = new ModKeyBindings();
private ConfigEntry<CauseOfDeath>? causeOfDeath;
private ConfigEntry<DeathAnimationOptions>? deathAnimation;
public static KillBind Instance { get; private set; } = null;
internal static ManualLogSource Logger { get; private set; } = null;
internal static Harmony? Harmony { get; set; }
public CauseOfDeath CauseOfDeathValue
{
get
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
ConfigEntry<CauseOfDeath>? obj = causeOfDeath;
return (CauseOfDeath)((obj != null) ? ((int)obj.Value) : 0);
}
}
public DeathAnimationOptions? DeathAnimationValue
{
get
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: 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_0081: Expected I4, but got Unknown
DeathAnimationOptions? deathAnimationOptions = deathAnimation?.Value;
if (1 == 0)
{
}
DeathAnimationOptions? result;
switch (deathAnimationOptions)
{
case DeathAnimationOptions.CauseOfDeath:
{
CauseOfDeath causeOfDeathValue = CauseOfDeathValue;
if (1 == 0)
{
}
DeathAnimationOptions value = (((int)causeOfDeathValue == 0) ? DeathAnimationOptions.HeadBurst : ((causeOfDeathValue - 11) switch
{
0 => DeathAnimationOptions.Electrocuted,
2 => DeathAnimationOptions.Burnt,
4 => DeathAnimationOptions.HeadBurst,
6 => DeathAnimationOptions.Sliced,
7 => DeathAnimationOptions.Scratched,
_ => DeathAnimationOptions.Normal,
}));
if (1 == 0)
{
}
result = value;
break;
}
case DeathAnimationOptions.None:
result = null;
break;
default:
result = deathAnimation?.Value ?? DeathAnimationOptions.Normal;
break;
}
if (1 == 0)
{
}
return result;
}
}
internal static Vector3 BodyVelocity { get; set; } = default(Vector3);
private void Awake()
{
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
Instance = this;
causeOfDeath = ((BaseUnityPlugin)this).Config.Bind<CauseOfDeath>("General", "CauseOfDeath", (CauseOfDeath)0, "What cause of death to display for your corpse");
deathAnimation = ((BaseUnityPlugin)this).Config.Bind<DeathAnimationOptions>("General", "DeathAnimation", DeathAnimationOptions.CauseOfDeath, "What ragdoll to spawn (CauseOfDeath chooses automatically based on cause of death)");
if (Harmony == null)
{
Harmony = new Harmony("baer1.KillBind");
}
Logger.LogDebug((object)"Patching...");
Harmony.PatchAll();
Logger.LogDebug((object)"Finished patching!");
modKeyBindings.KillKey.performed += KillBind_performed;
Logger.LogInfo((object)"baer1.KillBind v2.0.6 has loaded!");
}
private static void KillBind_performed(CallbackContext ctx)
{
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
if (((CallbackContext)(ref ctx)).performed && !((Object)(object)GameNetworkManager.Instance?.localPlayerController == (Object)null) && !GameNetworkManager.Instance.localPlayerController.isPlayerDead && !GameNetworkManager.Instance.localPlayerController.isTypingChat && !GameNetworkManager.Instance.localPlayerController.quickMenuManager.isMenuOpen && !GameNetworkManager.Instance.localPlayerController.inTerminalMenu)
{
DeathAnimationOptions? deathAnimationValue = Instance.DeathAnimationValue;
GameNetworkManager.Instance.localPlayerController.KillPlayer(BodyVelocity, deathAnimationValue.HasValue, Instance.CauseOfDeathValue, Math.Clamp((int)deathAnimationValue.GetValueOrDefault(), 0, GameNetworkManager.Instance.localPlayerController.playersManager.playerRagdolls.Count - 1), default(Vector3), false);
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "baer1.KillBind";
public const string PLUGIN_NAME = "KillBind";
public const string PLUGIN_VERSION = "2.0.6";
}
}