Decompiled source of KillBind v2.4.1

plugins/KillBind/KillBind.dll

Decompiled a week ago
using System;
using System.Collections;
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 System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Kill_Bind.Config;
using Kill_Bind.Hooks;
using Kill_Bind.Hooks.DependencyRelated;
using LethalCompanyInputUtils.Api;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LobbyCompatibility.Enums;
using LobbyCompatibility.Features;
using Microsoft.CodeAnalysis;
using MonoMod.RuntimeDetour;
using UnityEngine;
using UnityEngine.InputSystem;
using com.github.zehsteam.ToilHead;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("com.github.zehsteam.ToilHead")]
[assembly: AssemblyCompany("com.Confusified.KillBind")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("2.4.1.0")]
[assembly: AssemblyInformationalVersion("2.4.1+cdad2383c0015c2a22f9935eb9d5541dc364d3b7")]
[assembly: AssemblyProduct("Kill Bind")]
[assembly: AssemblyTitle("com.Confusified.KillBind")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.4.1.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 Kill_Bind
{
	public class KillBind_Inputs : LcInputActions
	{
		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction ActionKillBind { get; set; }
	}
	[SoftDependency("BMX.LobbyCompatibility", typeof(RegisterPlugin_LobbyCompatibility))]
	[SoftDependency("com.github.zehsteam.ToilHead", typeof(ToilHead))]
	[SoftDependency("ainavt.lc.lethalconfig", typeof(SetupConfig_LethalConfig))]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.Confusified.KillBind", "Kill Bind", "2.4.1")]
	public class Main : BaseUnityPlugin
	{
		private static string[] modGUIDSegments = "com.Confusified.KillBind".Split(".");

		private static readonly string configLocation = Utility.CombinePaths(new string[1] { Paths.ConfigPath + "\\" + modGUIDSegments[1] + "\\" + modGUIDSegments[2] });

		internal static ConfigFile killbindConfig = new ConfigFile(configLocation + ".cfg", false);

		public static readonly KillBind_Inputs InputActionInstance = new KillBind_Inputs();

		public static Main Instance { get; private set; } = null;


		internal static ManualLogSource Logger { get; private set; } = null;


		internal static List<IDetour> Hooks { get; set; } = new List<IDetour>();


		public void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			ConfigHandler.InitialiseConfig();
			InitialiseSoftDependencies();
			HookMethods();
			Logger.LogInfo((object)"Kill Bind v2.4.1 has loaded!");
		}

		private static void InitialiseSoftDependencies()
		{
			Logger.LogDebug((object)"Activating Soft Dependencies...");
			SoftDependencyAttribute.Init((BaseUnityPlugin)(object)Instance);
		}

		private static void HookMethods()
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			Logger.LogDebug((object)"Hooking...");
			Hooks.Add((IDetour)new Hook((MethodBase)typeof(StartOfRound).GetMethod("Start", AccessTools.allDeclared), (Delegate)new Action<Action<StartOfRound>, StartOfRound>(StartOfRoundHooks.UpdateRagdollTypeList)));
			Logger.LogDebug((object)"Hooked: StartOfRound, Start");
			Logger.LogDebug((object)"Finished Hooking.");
			InputActionInstance.ActionKillBind.performed += KillBindHandler.OnPressKillBind;
			Logger.LogDebug((object)"Bound KillBind's Keybind.");
		}
	}
	internal class SoftDependencyAttribute : BepInDependency
	{
		public Type Handler;

		public SoftDependencyAttribute(string guid, Type handlerType)
			: base(guid, (DependencyFlags)2)
		{
			Handler = handlerType;
		}

		internal static void Init(BaseUnityPlugin source)
		{
			IEnumerable<SoftDependencyAttribute> customAttributes = ((MemberInfo)((object)source).GetType()).GetCustomAttributes<SoftDependencyAttribute>();
			foreach (SoftDependencyAttribute item in customAttributes)
			{
				if (item != null && Chainloader.PluginInfos.ContainsKey(((BepInDependency)item).DependencyGUID))
				{
					Main.Logger.LogDebug((object)("Found compatible mod: " + ((BepInDependency)item).DependencyGUID));
					item.Handler.GetMethod("Activate", BindingFlags.Static | BindingFlags.NonPublic)?.Invoke(null, null);
					item.Handler = null;
				}
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "com.Confusified.KillBind";

		public const string PLUGIN_NAME = "Kill Bind";

		public const string PLUGIN_VERSION = "2.4.1";
	}
}
namespace Kill_Bind.Hooks
{
	public class KillBindHandler : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass2_0
		{
			public string ragdollTypeValue;

			internal bool <KillAfterYield>b__0(GameObject x)
			{
				return ((Object)x).name.Contains(Regex.Replace(ragdollTypeValue, " ", "", RegexOptions.None));
			}
		}

		[CompilerGenerated]
		private sealed class <KillAfterYield>d__2 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			private <>c__DisplayClass2_0 <>8__1;

			public PlayerControllerB localPlayer;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <KillAfterYield>d__2(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>8__1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
				//IL_010c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0112: Unknown result type (might be due to invalid IL or missing references)
				//IL_0116: Unknown result type (might be due to invalid IL or missing references)
				//IL_011c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass2_0();
					<>2__current = waitForFrameEnd;
					<>1__state = 1;
					return true;
				case 1:
				{
					<>1__state = -1;
					<>8__1.ragdollTypeValue = ConfigSettings.RagdollType.Value;
					GameObject val = StartOfRoundHooks.PlayerRagdollsList.Find((GameObject x) => ((Object)x).name.Contains(Regex.Replace(<>8__1.ragdollTypeValue, " ", "", RegexOptions.None)));
					int num = ((!(<>8__1.ragdollTypeValue == "Normal")) ? 1 : 0);
					num = (((Object)(object)val != (Object)null) ? StartOfRoundHooks.PlayerRagdollsList.IndexOf(val) : num);
					CauseOfDeath val2 = ConfigSettings.DeathCause.Value;
					if (ConfigSettings.DeathCauseMatchesRagdollType.Value)
					{
						val2 = SetAccurateCauseOfDeath(num);
					}
					Main.Logger.LogDebug((object)"Player should have died now");
					Main.Logger.LogDebug((object)$"Ragdoll: {<>8__1.ragdollTypeValue}, Ragdoll Int: {num}, CoD: {val2}");
					localPlayer.KillPlayer(localPlayer.thisController.velocity, true, val2, num, default(Vector3));
					if (ToilHead.ToilHeadMod_Present && <>8__1.ragdollTypeValue == "Spring")
					{
						Main.Logger.LogDebug((object)"Attempting to replace the ragdoll with a ToilHead variant");
						ToilHead.CreateToilheadRagdoll(localPlayer);
					}
					return false;
				}
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		internal static WaitForEndOfFrame waitForFrameEnd = new WaitForEndOfFrame();

		public static void OnPressKillBind(CallbackContext callbackContext)
		{
			if (!((CallbackContext)(ref callbackContext)).performed || !ConfigSettings.ModEnabled.Value)
			{
				return;
			}
			PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController;
			if ((Object)(object)val == (Object)null || val.isPlayerDead)
			{
				return;
			}
			HUDManager instance = HUDManager.Instance;
			bool isTypingChat = val.isTypingChat;
			bool enabled = ((Behaviour)instance.typingIndicator).enabled;
			if ((Object)(object)instance == (Object)null || enabled || isTypingChat)
			{
				return;
			}
			bool inTerminalMenu = val.inTerminalMenu;
			Terminal val2 = Object.FindObjectOfType<Terminal>();
			bool terminalInUse = val2.terminalInUse;
			if (!((Object)(object)val2 == (Object)null) && !(terminalInUse && inTerminalMenu))
			{
				QuickMenuManager quickMenuManager = val.quickMenuManager;
				bool isMenuOpen = quickMenuManager.isMenuOpen;
				if (!((Object)(object)quickMenuManager == (Object)null || isMenuOpen) && !StartOfRoundHooks.StartOfRoundInstance.inShipPhase)
				{
					Main.Logger.LogDebug((object)"Keybind for KillBind has been pressed.");
					((MonoBehaviour)val).StartCoroutine(KillAfterYield(val));
				}
			}
		}

		[IteratorStateMachine(typeof(<KillAfterYield>d__2))]
		public static IEnumerator KillAfterYield(PlayerControllerB localPlayer)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <KillAfterYield>d__2(0)
			{
				localPlayer = localPlayer
			};
		}

		public static CauseOfDeath SetAccurateCauseOfDeath(int ragdollInt)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			return (CauseOfDeath)(ragdollInt switch
			{
				0 => 6, 
				1 => 0, 
				2 => 6, 
				3 => 11, 
				4 => 4, 
				5 => 4, 
				6 => 13, 
				7 => 17, 
				8 => 6, 
				9 => 14, 
				_ => 0, 
			});
		}
	}
	public class StartOfRoundHooks
	{
		public static StartOfRound StartOfRoundInstance;

		private static bool ragdollListCreated;

		public static List<GameObject> PlayerRagdollsList { get; private set; }

		public static void UpdateRagdollTypeConfig()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			ConfigSettings.ListRagdollType = new List<string>(Regex.Split(ConfigSettings.RagdollTypeList.Value, ";"));
			ConfigHandler.RagdollTypeDescription = new ConfigDescription("Determines what ragdoll will be used.", (AcceptableValueBase)(object)new AcceptableValueList<string>(ConfigSettings.ListRagdollType.ToArray()), Array.Empty<object>());
			string value = ConfigSettings.RagdollType.Value;
			Main.killbindConfig.SaveOnConfigSet = false;
			Main.killbindConfig.Remove(((ConfigEntryBase)ConfigSettings.RagdollType).Definition);
			ConfigSettings.RagdollType = Main.killbindConfig.Bind<string>("Mod Settings", "Type of Ragdoll", "HeadBurst", ConfigHandler.RagdollTypeDescription);
			ConfigSettings.RagdollType.Value = value;
			Main.killbindConfig.Save();
			if (SetupConfig_LethalConfig.LethalConfigFound)
			{
				SetupConfig_LethalConfig.UpdateRagdollTypeDropdown();
			}
			Main.killbindConfig.SaveOnConfigSet = true;
		}

		public static void UpdateRagdollTypeList(Action<StartOfRound> orig, StartOfRound self)
		{
			orig(self);
			StartOfRoundInstance = self;
			if (ragdollListCreated)
			{
				return;
			}
			Main.Logger.LogDebug((object)"Creating ragdoll list...");
			ConfigSettings.RagdollTypeList.Value = "";
			PlayerRagdollsList = self.playerRagdolls;
			foreach (GameObject playerRagdolls in PlayerRagdollsList)
			{
				string text = CleanRagdollName(((Object)playerRagdolls).name);
				ConfigSettings.RagdollTypeList.Value = ((PlayerRagdollsList.IndexOf(playerRagdolls) == 0) ? text : (ConfigSettings.RagdollTypeList.Value + ";" + text));
				Main.Logger.LogDebug((object)$"{PlayerRagdollsList.IndexOf(playerRagdolls)}: {text}");
			}
			UpdateRagdollTypeConfig();
			Main.Logger.LogDebug((object)"Finished creating ragdoll list");
			ragdollListCreated = true;
		}

		internal static string CleanRagdollName(string ragdollName)
		{
			if (ragdollName == "PlayerRagdoll")
			{
				return "Normal";
			}
			string pattern = "Player|Ragdoll|With|Variant|Prefab| ";
			ragdollName = Regex.Replace(ragdollName, pattern, "", RegexOptions.IgnoreCase);
			char[] array = ragdollName.ToCharArray();
			foreach (char c in array)
			{
				string text = c.ToString();
				int num = ragdollName.IndexOf(text);
				if (num != 0 && num != -1)
				{
					string text2 = ragdollName.ToUpper().ToCharArray().GetValue(num)
						.ToString();
					if (text2 == text)
					{
						string text3 = ragdollName.Substring(0, num);
						string text4 = ragdollName;
						int num2 = num;
						ragdollName = text3 + " " + text4.Substring(num2, text4.Length - num2);
					}
				}
			}
			return ragdollName;
		}
	}
}
namespace Kill_Bind.Hooks.DependencyRelated
{
	public static class RegisterPlugin_LobbyCompatibility
	{
		private static void Activate()
		{
			PluginHelper.RegisterPlugin("com.Confusified.KillBind", Version.Parse("2.4.1"), (CompatibilityLevel)0, (VersionStrictness)0);
		}
	}
	public static class SetupConfig_LethalConfig
	{
		public static bool LethalConfigFound;

		private static void Activate()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Expected O, but got Unknown
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Expected O, but got Unknown
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Expected O, but got Unknown
			LethalConfigFound = true;
			LethalConfigManager.SkipAutoGen();
			BoolCheckBoxConfigItem val = new BoolCheckBoxConfigItem(ConfigSettings.ModEnabled, new BoolCheckBoxOptions
			{
				Section = "Mod Settings",
				Name = "Mod Enabled",
				Description = "Determines whether the mod is enabled.",
				RequiresRestart = false
			});
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val);
			EnumDropDownConfigItem<CauseOfDeath> val2 = new EnumDropDownConfigItem<CauseOfDeath>(ConfigSettings.DeathCause, new EnumDropDownOptions
			{
				Section = "Mod Settings",
				Name = "Cause of Death",
				Description = "Determines what the cause of death will be for your ragdoll.",
				RequiresRestart = false
			});
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
			BoolCheckBoxConfigItem val3 = new BoolCheckBoxConfigItem(ConfigSettings.DeathCauseMatchesRagdollType, new BoolCheckBoxOptions
			{
				Section = "Mod Settings",
				Name = "Accurate ragdolls",
				Description = "When enabled causes your Cause of Death to match your selected ragdoll type.",
				RequiresRestart = false
			});
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val3);
			LethalConfigManager.SetModDescription("Become a ragdoll with just one button press");
		}

		public static void UpdateRagdollTypeDropdown()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: 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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			TextDropDownConfigItem val = new TextDropDownConfigItem(ConfigSettings.RagdollType, new TextDropDownOptions(Array.Empty<string>())
			{
				Section = "Mod Settings",
				Name = "Type of Ragdoll",
				Description = "Determines what ragdoll will be used.",
				RequiresRestart = false
			});
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val);
		}
	}
	public static class ToilHead
	{
		public static bool ToilHeadMod_Present = false;

		public static float ToilSlayerRagdollChance = 10f;

		internal static ConfigEntry<float> ToilPlayerSlayerChance = null;

		internal static void CreateToilheadRagdoll(PlayerControllerB self)
		{
			bool flag = Utils.RandomPercent(ToilSlayerRagdollChance);
			TurretHeadManager.SetDeadBodyTurretHead(self, flag);
		}

		private static void Activate()
		{
			ToilHeadMod_Present = true;
			ConfigFile config = Chainloader.PluginInfos["com.github.zehsteam.ToilHead"].Instance.Config;
			foreach (ConfigDefinition key in config.Keys)
			{
				if (key.Section == "Toil-Player Settings" && key.Key == "ToilPlayerSlayerChance")
				{
					config.TryGetEntry<float>(key, ref ToilPlayerSlayerChance);
					ToilSlayerRagdollChance = ToilPlayerSlayerChance.Value;
					Main.Logger.LogDebug((object)$"Updated ToilSlayerRagdollChance to {ToilSlayerRagdollChance}");
					ToilPlayerSlayerChance.SettingChanged += UpdateChanceValue;
					return;
				}
			}
			Main.Logger.LogDebug((object)$"Could not find ToilPlayerSlayerChance config setting. ToilSlayerRagdollChance will use the default value set by KillBind ({ToilSlayerRagdollChance})");
		}

		private static void UpdateChanceValue(object sender = null, EventArgs args = null)
		{
			ToilSlayerRagdollChance = ToilPlayerSlayerChance.Value;
			Main.Logger.LogDebug((object)$"Updated ToilSlayerRagdollChance to {ToilSlayerRagdollChance}");
		}
	}
}
namespace Kill_Bind.Config
{
	public class ConfigHandler
	{
		internal static ConfigDescription RagdollTypeDescription;

		public static void InitialiseConfig()
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			ConfigFile killbindConfig = Main.killbindConfig;
			killbindConfig.SaveOnConfigSet = false;
			ConfigSettings.RagdollTypeList = killbindConfig.Bind<string>("z Do Not Touch z", "Ragdoll List String", "Head Burst", "This is used to retain the config setting for the type of ragdoll. Editing this may cause issues");
			ConfigSettings.ListRagdollType = new List<string>(Regex.Split(ConfigSettings.RagdollTypeList.Value, ";"));
			RagdollTypeDescription = new ConfigDescription("Determines what ragdoll will be used.", (AcceptableValueBase)(object)new AcceptableValueList<string>(ConfigSettings.ListRagdollType.ToArray()), Array.Empty<object>());
			ConfigSettings.ModEnabled = killbindConfig.Bind<bool>("Mod Settings", "Mod Enabled", true, "Determines whether the mod is enabled.");
			ConfigSettings.DeathCause = killbindConfig.Bind<CauseOfDeath>("Mod Settings", "Cause of Death", (CauseOfDeath)0, "Determines what the cause of death will be for your ragdoll.");
			ConfigSettings.DeathCauseMatchesRagdollType = killbindConfig.Bind<bool>("Mod Settings", "Accurate ragdolls", false, "When enabled causes your Cause of Death to match your selected ragdoll type.");
			ConfigSettings.RagdollType = killbindConfig.Bind<string>("Mod Settings", "Type of Ragdoll", "Head Burst", RagdollTypeDescription);
			ClearOrphanedEntries(killbindConfig);
			killbindConfig.Save();
			killbindConfig.SaveOnConfigSet = true;
		}

		private static void ClearOrphanedEntries(ConfigFile cfg)
		{
			PropertyInfo propertyInfo = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries");
			Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)propertyInfo.GetValue(cfg);
			dictionary.Clear();
		}
	}
	public class ConfigSettings
	{
		internal const string CONFIG_SECTION = "Mod Settings";

		public const string DEFAULT_RAGDOLL_TYPE = "Head Burst";

		public static ConfigEntry<bool> ModEnabled;

		public static ConfigEntry<string> RagdollType;

		public static ConfigEntry<CauseOfDeath> DeathCause;

		public static ConfigEntry<bool> DeathCauseMatchesRagdollType;

		public static ConfigEntry<string> RagdollTypeList;

		public static List<string> ListRagdollType;
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}