Decompiled source of BrokenLegMod v1.0.0

BepInEx\plugins\BrokenLegMod\BrokenLegMod.dll

Decompiled 2 days ago
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 GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("BrokenLegMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Lethal Company Mod: Beinbruch bei schwerem Fallschaden. Spieler muss kriechen, andere koennen ihn tragen.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BrokenLegMod")]
[assembly: AssemblyTitle("BrokenLegMod")]
[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 BrokenLegMod
{
	internal static class BrokenLegNetwork
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static HandleNamedMessageDelegate <0>__OnBreakReceived;

			public static HandleNamedMessageDelegate <1>__OnCarryReceived;

			public static HandleNamedMessageDelegate <2>__OnDropReceived;

			public static HandleNamedMessageDelegate <3>__OnCleanReceived;

			public static HandleNamedMessageDelegate <4>__OnReqBreakReceived;

			public static HandleNamedMessageDelegate <5>__OnReqCarryReceived;

			public static HandleNamedMessageDelegate <6>__OnReqDropReceived;
		}

		private const string MSG_BREAK = "BL_Break";

		private const string MSG_CARRY = "BL_Carry";

		private const string MSG_DROP = "BL_Drop";

		private const string MSG_CLEAN = "BL_Clean";

		private const string MSG_REQ_BREAK = "BL_ReqBreak";

		private const string MSG_REQ_CARRY = "BL_ReqCarry";

		private const string MSG_REQ_DROP = "BL_ReqDrop";

		private static bool _registered;

		internal static bool IsHost
		{
			get
			{
				try
				{
					return (Object)(object)NetworkManager.Singleton != (Object)null && (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer);
				}
				catch
				{
					return true;
				}
			}
		}

		internal static void Register()
		{
			//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_0044: Expected O, but got Unknown
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Expected O, but got Unknown
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Expected O, but got Unknown
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Expected O, but got Unknown
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Expected O, but got Unknown
			if (_registered)
			{
				return;
			}
			try
			{
				NetworkManager singleton = NetworkManager.Singleton;
				CustomMessagingManager val = ((singleton != null) ? singleton.CustomMessagingManager : null);
				if (val != null)
				{
					object obj = <>O.<0>__OnBreakReceived;
					if (obj == null)
					{
						HandleNamedMessageDelegate val2 = OnBreakReceived;
						<>O.<0>__OnBreakReceived = val2;
						obj = (object)val2;
					}
					val.RegisterNamedMessageHandler("BL_Break", (HandleNamedMessageDelegate)obj);
					object obj2 = <>O.<1>__OnCarryReceived;
					if (obj2 == null)
					{
						HandleNamedMessageDelegate val3 = OnCarryReceived;
						<>O.<1>__OnCarryReceived = val3;
						obj2 = (object)val3;
					}
					val.RegisterNamedMessageHandler("BL_Carry", (HandleNamedMessageDelegate)obj2);
					object obj3 = <>O.<2>__OnDropReceived;
					if (obj3 == null)
					{
						HandleNamedMessageDelegate val4 = OnDropReceived;
						<>O.<2>__OnDropReceived = val4;
						obj3 = (object)val4;
					}
					val.RegisterNamedMessageHandler("BL_Drop", (HandleNamedMessageDelegate)obj3);
					object obj4 = <>O.<3>__OnCleanReceived;
					if (obj4 == null)
					{
						HandleNamedMessageDelegate val5 = OnCleanReceived;
						<>O.<3>__OnCleanReceived = val5;
						obj4 = (object)val5;
					}
					val.RegisterNamedMessageHandler("BL_Clean", (HandleNamedMessageDelegate)obj4);
					object obj5 = <>O.<4>__OnReqBreakReceived;
					if (obj5 == null)
					{
						HandleNamedMessageDelegate val6 = OnReqBreakReceived;
						<>O.<4>__OnReqBreakReceived = val6;
						obj5 = (object)val6;
					}
					val.RegisterNamedMessageHandler("BL_ReqBreak", (HandleNamedMessageDelegate)obj5);
					object obj6 = <>O.<5>__OnReqCarryReceived;
					if (obj6 == null)
					{
						HandleNamedMessageDelegate val7 = OnReqCarryReceived;
						<>O.<5>__OnReqCarryReceived = val7;
						obj6 = (object)val7;
					}
					val.RegisterNamedMessageHandler("BL_ReqCarry", (HandleNamedMessageDelegate)obj6);
					object obj7 = <>O.<6>__OnReqDropReceived;
					if (obj7 == null)
					{
						HandleNamedMessageDelegate val8 = OnReqDropReceived;
						<>O.<6>__OnReqDropReceived = val8;
						obj7 = (object)val8;
					}
					val.RegisterNamedMessageHandler("BL_ReqDrop", (HandleNamedMessageDelegate)obj7);
					_registered = true;
					Plugin.Logger.LogInfo((object)"[BrokenLegNet] Netzwerk-Handler registriert!");
				}
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("[BrokenLegNet] Register Fehler: " + ex.Message));
			}
		}

		internal static void Unregister()
		{
			if (!_registered)
			{
				return;
			}
			try
			{
				NetworkManager singleton = NetworkManager.Singleton;
				CustomMessagingManager val = ((singleton != null) ? singleton.CustomMessagingManager : null);
				if (val != null)
				{
					val.UnregisterNamedMessageHandler("BL_Break");
					val.UnregisterNamedMessageHandler("BL_Carry");
					val.UnregisterNamedMessageHandler("BL_Drop");
					val.UnregisterNamedMessageHandler("BL_Clean");
					val.UnregisterNamedMessageHandler("BL_ReqBreak");
					val.UnregisterNamedMessageHandler("BL_ReqCarry");
					val.UnregisterNamedMessageHandler("BL_ReqDrop");
				}
			}
			catch
			{
			}
			_registered = false;
			Plugin.Logger.LogInfo((object)"[BrokenLegNet] Netzwerk-Handler entfernt.");
		}

		internal static void ClientNotifyBreak(ulong clientId)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			if (IsHost)
			{
				HostBroadcastBreak(clientId);
			}
			else if (_registered)
			{
				try
				{
					FastBufferWriter val = default(FastBufferWriter);
					((FastBufferWriter)(ref val))..ctor(8, (Allocator)2, -1);
					((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref clientId, default(ForPrimitives));
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("BL_ReqBreak", 0uL, val, (NetworkDelivery)3);
					((FastBufferWriter)(ref val)).Dispose();
					Debug.Log((object)$"[BrokenLegNet] Break-Request an Host: Spieler {clientId}");
				}
				catch (Exception ex)
				{
					Debug.LogError((object)("[BrokenLegNet] ClientNotifyBreak Fehler: " + ex.Message));
				}
			}
		}

		internal static void ClientNotifyCarry(ulong carrierId, ulong carriedId)
		{
			//IL_0029: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			if (IsHost)
			{
				HostBroadcastCarry(carrierId, carriedId);
			}
			else if (_registered)
			{
				try
				{
					FastBufferWriter val = default(FastBufferWriter);
					((FastBufferWriter)(ref val))..ctor(16, (Allocator)2, -1);
					((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref carrierId, default(ForPrimitives));
					((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref carriedId, default(ForPrimitives));
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("BL_ReqCarry", 0uL, val, (NetworkDelivery)3);
					((FastBufferWriter)(ref val)).Dispose();
					Debug.Log((object)$"[BrokenLegNet] Carry-Request an Host: {carrierId} → {carriedId}");
				}
				catch (Exception ex)
				{
					Debug.LogError((object)("[BrokenLegNet] ClientNotifyCarry Fehler: " + ex.Message));
				}
			}
		}

		internal static void ClientNotifyDrop(ulong carrierId, ulong carriedId)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			if (IsHost)
			{
				HostBroadcastDrop(carriedId);
			}
			else if (_registered)
			{
				try
				{
					FastBufferWriter val = default(FastBufferWriter);
					((FastBufferWriter)(ref val))..ctor(8, (Allocator)2, -1);
					((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref carriedId, default(ForPrimitives));
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("BL_ReqDrop", 0uL, val, (NetworkDelivery)3);
					((FastBufferWriter)(ref val)).Dispose();
					Debug.Log((object)$"[BrokenLegNet] Drop-Request an Host: Spieler {carriedId}");
				}
				catch (Exception ex)
				{
					Debug.LogError((object)("[BrokenLegNet] ClientNotifyDrop Fehler: " + ex.Message));
				}
			}
		}

		internal static void HostBroadcastBreak(ulong clientId)
		{
			if (IsHost)
			{
				SendToAll("BL_Break", delegate(FastBufferWriter w)
				{
					//IL_000a: Unknown result type (might be due to invalid IL or missing references)
					//IL_0010: Unknown result type (might be due to invalid IL or missing references)
					((FastBufferWriter)(ref w)).WriteValueSafe<ulong>(ref clientId, default(ForPrimitives));
				});
				Plugin.BreakPlayerLeg(clientId);
			}
		}

		internal static void HostBroadcastCarry(ulong carrierId, ulong carriedId)
		{
			if (IsHost)
			{
				SendToAll("BL_Carry", delegate(FastBufferWriter w)
				{
					//IL_000a: Unknown result type (might be due to invalid IL or missing references)
					//IL_0010: 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_0026: Unknown result type (might be due to invalid IL or missing references)
					((FastBufferWriter)(ref w)).WriteValueSafe<ulong>(ref carrierId, default(ForPrimitives));
					((FastBufferWriter)(ref w)).WriteValueSafe<ulong>(ref carriedId, default(ForPrimitives));
				});
				Plugin.StartCarry(carriedId, carrierId);
			}
		}

		internal static void HostBroadcastDrop(ulong carriedId)
		{
			if (IsHost)
			{
				SendToAll("BL_Drop", delegate(FastBufferWriter w)
				{
					//IL_000a: Unknown result type (might be due to invalid IL or missing references)
					//IL_0010: Unknown result type (might be due to invalid IL or missing references)
					((FastBufferWriter)(ref w)).WriteValueSafe<ulong>(ref carriedId, default(ForPrimitives));
				});
				Plugin.StopCarry(carriedId);
			}
		}

		internal static void HostBroadcastCleanup()
		{
			if (IsHost)
			{
				SendToAll("BL_Clean", delegate(FastBufferWriter w)
				{
					//IL_0008: Unknown result type (might be due to invalid IL or missing references)
					//IL_000e: Unknown result type (might be due to invalid IL or missing references)
					byte b = 0;
					((FastBufferWriter)(ref w)).WriteValueSafe<byte>(ref b, default(ForPrimitives));
				});
			}
		}

		private static void OnBreakReceived(ulong senderId, FastBufferReader reader)
		{
			//IL_000f: 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)
			if (IsHost)
			{
				return;
			}
			try
			{
				ulong num = default(ulong);
				((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref num, default(ForPrimitives));
				Plugin.BreakPlayerLeg(num);
				Debug.Log((object)$"[BrokenLegNet] Break empfangen: Spieler {num}");
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("[BrokenLegNet] OnBreak Fehler: " + ex.Message));
			}
		}

		private static void OnCarryReceived(ulong senderId, FastBufferReader reader)
		{
			//IL_000f: 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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			if (IsHost)
			{
				return;
			}
			try
			{
				ulong num = default(ulong);
				((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref num, default(ForPrimitives));
				ulong num2 = default(ulong);
				((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref num2, default(ForPrimitives));
				Plugin.StartCarry(num2, num);
				Debug.Log((object)$"[BrokenLegNet] Carry empfangen: {num} → {num2}");
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("[BrokenLegNet] OnCarry Fehler: " + ex.Message));
			}
		}

		private static void OnDropReceived(ulong senderId, FastBufferReader reader)
		{
			//IL_000f: 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)
			if (IsHost)
			{
				return;
			}
			try
			{
				ulong num = default(ulong);
				((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref num, default(ForPrimitives));
				Plugin.StopCarry(num);
				Debug.Log((object)$"[BrokenLegNet] Drop empfangen: Spieler {num}");
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("[BrokenLegNet] OnDrop Fehler: " + ex.Message));
			}
		}

		private static void OnCleanReceived(ulong senderId, FastBufferReader reader)
		{
			if (IsHost)
			{
				return;
			}
			try
			{
				Plugin.CleanupAll();
				Debug.Log((object)"[BrokenLegNet] Cleanup empfangen");
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("[BrokenLegNet] OnClean Fehler: " + ex.Message));
			}
		}

		private static void OnReqBreakReceived(ulong senderId, FastBufferReader reader)
		{
			//IL_000f: 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)
			if (!IsHost)
			{
				return;
			}
			try
			{
				ulong num = default(ulong);
				((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref num, default(ForPrimitives));
				Debug.Log((object)$"[BrokenLegNet] Break-Request von Client: Spieler {num}");
				HostBroadcastBreak(num);
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("[BrokenLegNet] OnReqBreak Fehler: " + ex.Message));
			}
		}

		private static void OnReqCarryReceived(ulong senderId, FastBufferReader reader)
		{
			//IL_000f: 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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			if (!IsHost)
			{
				return;
			}
			try
			{
				ulong num = default(ulong);
				((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref num, default(ForPrimitives));
				ulong num2 = default(ulong);
				((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref num2, default(ForPrimitives));
				Debug.Log((object)$"[BrokenLegNet] Carry-Request: {num} → {num2}");
				HostBroadcastCarry(num, num2);
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("[BrokenLegNet] OnReqCarry Fehler: " + ex.Message));
			}
		}

		private static void OnReqDropReceived(ulong senderId, FastBufferReader reader)
		{
			//IL_000f: 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)
			if (!IsHost)
			{
				return;
			}
			try
			{
				ulong num = default(ulong);
				((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref num, default(ForPrimitives));
				Debug.Log((object)$"[BrokenLegNet] Drop-Request: Spieler {num}");
				HostBroadcastDrop(num);
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("[BrokenLegNet] OnReqDrop Fehler: " + ex.Message));
			}
		}

		internal static PlayerControllerB GetPlayerByClientId(ulong clientId)
		{
			try
			{
				if (StartOfRound.Instance?.allPlayerScripts == null)
				{
					return null;
				}
				PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
				foreach (PlayerControllerB val in allPlayerScripts)
				{
					if ((Object)(object)val != (Object)null && val.actualClientId == clientId)
					{
						return val;
					}
				}
			}
			catch
			{
			}
			return null;
		}

		private static void SendToAll(string msgName, Action<FastBufferWriter> write)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			if (!_registered)
			{
				return;
			}
			try
			{
				FastBufferWriter val = default(FastBufferWriter);
				((FastBufferWriter)(ref val))..ctor(256, (Allocator)2, -1);
				write(val);
				NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll(msgName, val, (NetworkDelivery)3);
				((FastBufferWriter)(ref val)).Dispose();
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("[BrokenLegNet] SendToAll(" + msgName + ") Fehler: " + ex.Message));
			}
		}
	}
	[BepInPlugin("BrokenLegMod", "BrokenLegMod", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		private Harmony _harmony;

		internal static ConfigEntry<float> cfgLimpSpeed;

		internal static ConfigEntry<float> cfgCarrierSpeedMult;

		internal static ConfigEntry<bool> cfgBlockJump;

		internal static ConfigEntry<bool> cfgBlockSprint;

		internal static ConfigEntry<float> cfgCarryForward;

		internal static ConfigEntry<float> cfgCarryDown;

		internal static ConfigEntry<float> cfgCarryRight;

		internal static ConfigEntry<float> cfgCarryWeight;

		internal static ConfigEntry<KeyCode> cfgDropKey;

		internal static HashSet<ulong> BrokenLegPlayers = new HashSet<ulong>();

		internal static Dictionary<ulong, ulong> CarryState = new Dictionary<ulong, ulong>();

		internal static float CleanupCooldown = 0f;

		private void Awake()
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Expected O, but got Unknown
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Expected O, but got Unknown
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Expected O, but got Unknown
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Expected O, but got Unknown
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"BrokenLegMod v1.0.0 geladen!");
			cfgLimpSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Gameplay", "Humpel-Geschwindigkeit", 0.8f, new ConfigDescription("Wie schnell der verletzte Spieler humpelt. Niedriger = langsamer. Normal = 1.0", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 1.5f), Array.Empty<object>()));
			cfgCarrierSpeedMult = ((BaseUnityPlugin)this).Config.Bind<float>("Gameplay", "Traeger-Geschwindigkeit", 0.6f, new ConfigDescription("Speed-Multiplikator fuer den Spieler der jemanden traegt. 1.0 = volle Geschwindigkeit", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.2f, 1f), Array.Empty<object>()));
			cfgBlockJump = ((BaseUnityPlugin)this).Config.Bind<bool>("Gameplay", "Springen blockieren", true, "Spieler mit gebrochenem Bein kann nicht springen");
			cfgBlockSprint = ((BaseUnityPlugin)this).Config.Bind<bool>("Gameplay", "Sprinten blockieren", true, "Spieler mit gebrochenem Bein kann nicht sprinten");
			cfgCarryForward = ((BaseUnityPlugin)this).Config.Bind<float>("Tragen", "Position Vorwaerts", 1.2f, new ConfigDescription("Wie weit vor dem Traeger der getragene Spieler ist (in Metern)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.3f, 2.5f), Array.Empty<object>()));
			cfgCarryDown = ((BaseUnityPlugin)this).Config.Bind<float>("Tragen", "Position Runter", 0.6f, new ConfigDescription("Wie weit nach unten der getragene Spieler haengt (in Metern)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1.5f), Array.Empty<object>()));
			cfgCarryRight = ((BaseUnityPlugin)this).Config.Bind<float>("Tragen", "Position Rechts", 0.3f, new ConfigDescription("Seitlicher Versatz nach rechts (damit Sicht nicht blockiert). 0 = mittig", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1f, 1f), Array.Empty<object>()));
			cfgCarryWeight = ((BaseUnityPlugin)this).Config.Bind<float>("Tragen", "Trage-Gewicht", 1.5f, new ConfigDescription("Zusaetzliches Gewicht beim Tragen. Hoeher = langsamer + schwerer", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f), Array.Empty<object>()));
			cfgDropKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "Ablegen-Taste", (KeyCode)103, "Taste zum Ablegen des getragenen Spielers (Standard: G)");
			_harmony = new Harmony("BrokenLegMod");
			_harmony.PatchAll(typeof(MakeCriticallyInjured_Patch));
			_harmony.PatchAll(typeof(PlayerUpdate_Patch));
			_harmony.PatchAll(typeof(PlayerJump_Patch));
			_harmony.PatchAll(typeof(PlayerInteract_Patch));
			_harmony.PatchAll(typeof(PlayerDiscard_Patch));
			_harmony.PatchAll(typeof(Player_KillPlayer_Patch));
			_harmony.PatchAll(typeof(StartOfRound_Start_Patch));
			_harmony.PatchAll(typeof(GameNetworkManager_Disconnect_Patch));
			_harmony.PatchAll(typeof(StartOfRound_ReviveDeadPlayers_Patch));
			_harmony.PatchAll(typeof(StartOfRound_ShipLeave_Patch));
			_harmony.PatchAll(typeof(StartOfRound_ResetShip_Patch));
			Logger.LogInfo((object)"Alle Harmony-Patches angewendet!");
		}

		internal static bool IsLegBroken(PlayerControllerB player)
		{
			if ((Object)(object)player != (Object)null)
			{
				return BrokenLegPlayers.Contains(player.actualClientId);
			}
			return false;
		}

		internal static bool IsBeingCarried(PlayerControllerB player)
		{
			if ((Object)(object)player != (Object)null)
			{
				return CarryState.ContainsKey(player.actualClientId);
			}
			return false;
		}

		internal static bool IsCarrying(PlayerControllerB player)
		{
			if ((Object)(object)player == (Object)null)
			{
				return false;
			}
			foreach (KeyValuePair<ulong, ulong> item in CarryState)
			{
				if (item.Value == player.actualClientId)
				{
					return true;
				}
			}
			return false;
		}

		internal static PlayerControllerB GetCarriedPlayer(PlayerControllerB carrier)
		{
			if ((Object)(object)carrier == (Object)null)
			{
				return null;
			}
			foreach (KeyValuePair<ulong, ulong> item in CarryState)
			{
				if (item.Value == carrier.actualClientId)
				{
					return BrokenLegNetwork.GetPlayerByClientId(item.Key);
				}
			}
			return null;
		}

		internal static PlayerControllerB GetCarrier(PlayerControllerB carried)
		{
			if ((Object)(object)carried == (Object)null || !CarryState.ContainsKey(carried.actualClientId))
			{
				return null;
			}
			return BrokenLegNetwork.GetPlayerByClientId(CarryState[carried.actualClientId]);
		}

		internal static PlayerControllerB GetNearbyBrokenPlayer(PlayerControllerB viewer)
		{
			//IL_008d: 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_00b5: 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)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: 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)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			if (StartOfRound.Instance?.allPlayerScripts == null)
			{
				return null;
			}
			Camera gameplayCamera = viewer.gameplayCamera;
			if ((Object)(object)gameplayCamera == (Object)null)
			{
				return null;
			}
			PlayerControllerB result = null;
			float num = float.MaxValue;
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if ((Object)(object)val == (Object)null || !val.isPlayerControlled || val.isPlayerDead || val == viewer || !IsLegBroken(val) || IsBeingCarried(val))
				{
					continue;
				}
				float num2 = Vector3.Distance(((Component)gameplayCamera).transform.position, ((Component)val).transform.position);
				if (!(num2 > 5f))
				{
					Vector3 val2 = ((Component)val).transform.position - ((Component)gameplayCamera).transform.position;
					Vector3 normalized = ((Vector3)(ref val2)).normalized;
					if (!(Vector3.Dot(((Component)gameplayCamera).transform.forward, normalized) < 0.5f) && num2 < num)
					{
						result = val;
						num = num2;
					}
				}
			}
			return result;
		}

		internal static void BreakPlayerLeg(ulong clientId)
		{
			if (BrokenLegPlayers.Contains(clientId))
			{
				return;
			}
			BrokenLegPlayers.Add(clientId);
			Logger.LogInfo((object)$"[BrokenLeg] Spieler {clientId}: Bein gebrochen! Dauerhaftes Humpeln!");
			PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController;
			if (!((Object)(object)val != (Object)null) || val.actualClientId != clientId)
			{
				return;
			}
			try
			{
				HUDManager instance = HUDManager.Instance;
				if (instance != null)
				{
					instance.DisplayTip("Bein gebrochen!", "Du humpelst jetzt dauerhaft.\nAndere Spieler koennen dich mit [E] aufheben.", true, false, "BL_Break");
				}
			}
			catch
			{
			}
		}

		internal static void StartCarry(ulong carriedId, ulong carrierId)
		{
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			if (CarryState.ContainsKey(carriedId))
			{
				return;
			}
			CarryState[carriedId] = carrierId;
			Logger.LogInfo((object)$"[BrokenLeg] Spieler {carrierId} traegt Spieler {carriedId}!");
			PlayerControllerB playerByClientId = BrokenLegNetwork.GetPlayerByClientId(carrierId);
			if ((Object)(object)playerByClientId != (Object)null)
			{
				SetCarryAnimation(playerByClientId, enable: true);
			}
			PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController;
			if (!((Object)(object)val != (Object)null))
			{
				return;
			}
			if (val.actualClientId == carrierId)
			{
				try
				{
					HUDManager instance = HUDManager.Instance;
					if (instance != null)
					{
						instance.DisplayTip("Spieler aufgehoben", $"Druecke [{cfgDropKey.Value}] zum Ablegen.", false, false, "BL_Carry");
					}
					return;
				}
				catch
				{
					return;
				}
			}
			if (val.actualClientId != carriedId)
			{
				return;
			}
			try
			{
				HUDManager instance2 = HUDManager.Instance;
				if (instance2 != null)
				{
					instance2.DisplayTip("Du wirst getragen!", "Warte bis du abgelegt wirst.", false, false, "BL_Carried");
				}
			}
			catch
			{
			}
		}

		internal static void StopCarry(ulong carriedId)
		{
			if (CarryState.ContainsKey(carriedId))
			{
				PlayerControllerB playerByClientId = BrokenLegNetwork.GetPlayerByClientId(CarryState[carriedId]);
				if ((Object)(object)playerByClientId != (Object)null)
				{
					SetCarryAnimation(playerByClientId, enable: false);
				}
				CarryState.Remove(carriedId);
				Logger.LogInfo((object)$"[BrokenLeg] Spieler {carriedId} wurde abgelegt!");
			}
		}

		internal static void SetCarryAnimation(PlayerControllerB carrier, bool enable)
		{
			try
			{
				carrier.twoHanded = enable;
				carrier.twoHandedAnimation = enable;
				float value = cfgCarryWeight.Value;
				if (enable)
				{
					carrier.carryWeight = Mathf.Clamp(carrier.carryWeight + value, 1f, 4f);
				}
				else
				{
					carrier.carryWeight = Mathf.Max(carrier.carryWeight - value, 1f);
				}
				if ((Object)(object)carrier.playerBodyAnimator != (Object)null)
				{
					carrier.playerBodyAnimator.SetBool("Grab", enable);
					carrier.playerBodyAnimator.SetBool("GrabValidated", enable);
					carrier.playerBodyAnimator.SetBool("cancelHolding", !enable);
					carrier.playerBodyAnimator.SetBool("GrabInvalidated", false);
					try
					{
						carrier.playerBodyAnimator.SetBool("holdingTwoHandItem", enable);
					}
					catch
					{
					}
				}
				Logger.LogInfo((object)("[BrokenLeg] Trage-Animation " + (enable ? "AN" : "AUS") + " fuer " + carrier.playerUsername));
			}
			catch (Exception ex)
			{
				Logger.LogError((object)("[BrokenLeg] SetCarryAnimation Fehler: " + ex.Message));
			}
		}

		internal static void HealPlayer(ulong clientId)
		{
			BrokenLegPlayers.Remove(clientId);
			if (CarryState.ContainsKey(clientId))
			{
				CarryState.Remove(clientId);
			}
		}

		internal static void CleanupAll()
		{
			try
			{
				foreach (KeyValuePair<ulong, ulong> item in CarryState)
				{
					PlayerControllerB playerByClientId = BrokenLegNetwork.GetPlayerByClientId(item.Value);
					if ((Object)(object)playerByClientId != (Object)null)
					{
						SetCarryAnimation(playerByClientId, enable: false);
					}
				}
			}
			catch
			{
			}
			BrokenLegPlayers.Clear();
			CarryState.Clear();
			CleanupCooldown = 5f;
			try
			{
				if (StartOfRound.Instance?.allPlayerScripts != null)
				{
					PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
					foreach (PlayerControllerB val in allPlayerScripts)
					{
						if ((Object)(object)val != (Object)null)
						{
							val.criticallyInjured = false;
						}
					}
				}
			}
			catch
			{
			}
			Logger.LogInfo((object)"[BrokenLeg] Alle Zustaende zurueckgesetzt.");
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB), "MakeCriticallyInjured")]
	internal static class MakeCriticallyInjured_Patch
	{
		[HarmonyPostfix]
		private static void Postfix(PlayerControllerB __instance, bool enable)
		{
			if (!enable && Plugin.IsLegBroken(__instance))
			{
				__instance.criticallyInjured = true;
				Plugin.Logger.LogInfo((object)("[BrokenLeg] Heilung blockiert fuer " + __instance.playerUsername + "!"));
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB), "Update")]
	internal static class PlayerUpdate_Patch
	{
		private const float NORMAL_SPEED = 4.6f;

		private static FieldInfo _cursorTipField;

		private static PropertyInfo _cursorTipTextProp;

		private static bool _cursorTipResolved;

		private static void SetCursorTip(string text)
		{
			try
			{
				if ((Object)(object)HUDManager.Instance == (Object)null)
				{
					return;
				}
				if (!_cursorTipResolved)
				{
					_cursorTipResolved = true;
					BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
					string[] array = new string[5] { "cursorTip", "tipText", "cursorTooltip", "interactionText", "hoverTip" };
					foreach (string name in array)
					{
						_cursorTipField = typeof(HUDManager).GetField(name, bindingAttr);
						if (_cursorTipField != null)
						{
							break;
						}
					}
					if (_cursorTipField == null)
					{
						FieldInfo[] fields = typeof(HUDManager).GetFields(bindingAttr);
						foreach (FieldInfo fieldInfo in fields)
						{
							if (fieldInfo.Name.ToLower().Contains("tip") || fieldInfo.Name.ToLower().Contains("cursor"))
							{
								object value = fieldInfo.GetValue(HUDManager.Instance);
								if (value != null && value.GetType().GetProperty("text") != null)
								{
									_cursorTipField = fieldInfo;
									break;
								}
							}
						}
					}
					if (_cursorTipField != null)
					{
						object value2 = _cursorTipField.GetValue(HUDManager.Instance);
						if (value2 != null)
						{
							_cursorTipTextProp = value2.GetType().GetProperty("text");
						}
					}
				}
				if (_cursorTipField != null && _cursorTipTextProp != null)
				{
					object value3 = _cursorTipField.GetValue(HUDManager.Instance);
					if (value3 != null)
					{
						_cursorTipTextProp.SetValue(value3, text);
					}
				}
			}
			catch
			{
			}
		}

		[HarmonyPostfix]
		private static void Postfix(PlayerControllerB __instance)
		{
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (__instance.isPlayerDead)
				{
					return;
				}
				if (Plugin.CleanupCooldown > 0f)
				{
					Plugin.CleanupCooldown -= Time.deltaTime;
					return;
				}
				if (__instance.criticallyInjured && !Plugin.IsLegBroken(__instance))
				{
					PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController;
					if ((Object)(object)val != (Object)null && val == __instance)
					{
						Plugin.Logger.LogInfo((object)("[BrokenLeg] " + __instance.playerUsername + " ist kritisch verletzt → Bein bricht!"));
						BrokenLegNetwork.ClientNotifyBreak(__instance.actualClientId);
					}
				}
				if (Plugin.IsLegBroken(__instance))
				{
					__instance.criticallyInjured = true;
					try
					{
						FieldInfo field = typeof(PlayerControllerB).GetField("limpMultiplier", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
						if (field != null)
						{
							field.SetValue(__instance, Plugin.cfgLimpSpeed.Value);
						}
					}
					catch
					{
					}
					if (Plugin.cfgBlockSprint.Value)
					{
						__instance.isSprinting = false;
						__instance.sprintMeter = 0f;
					}
					if (Plugin.IsBeingCarried(__instance))
					{
						__instance.movementSpeed = 0f;
					}
				}
				if (Plugin.IsCarrying(__instance))
				{
					float num = 4.6f * Plugin.cfgCarrierSpeedMult.Value;
					if (__instance.movementSpeed > num)
					{
						__instance.movementSpeed = num;
					}
				}
				PlayerControllerB val2 = GameNetworkManager.Instance?.localPlayerController;
				if ((Object)(object)val2 == (Object)null || __instance != val2)
				{
					return;
				}
				if (Plugin.IsCarrying(__instance) && Input.GetKeyDown(Plugin.cfgDropKey.Value))
				{
					PlayerControllerB carriedPlayer = Plugin.GetCarriedPlayer(__instance);
					if ((Object)(object)carriedPlayer != (Object)null)
					{
						Plugin.Logger.LogInfo((object)"[BrokenLeg] Spieler abgelegt (Taste)!");
						BrokenLegNetwork.ClientNotifyDrop(__instance.actualClientId, carriedPlayer.actualClientId);
					}
				}
				if (!Plugin.IsLegBroken(__instance) && !Plugin.IsCarrying(__instance))
				{
					PlayerControllerB nearbyBrokenPlayer = Plugin.GetNearbyBrokenPlayer(__instance);
					if ((Object)(object)nearbyBrokenPlayer != (Object)null)
					{
						SetCursorTip("Aufheben (" + nearbyBrokenPlayer.playerUsername + ") : [E]");
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("[BrokenLeg] Update-Patch Fehler: " + ex.Message));
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB), "Jump_performed")]
	internal static class PlayerJump_Patch
	{
		[HarmonyPrefix]
		private static bool Prefix(PlayerControllerB __instance)
		{
			if (Plugin.IsBeingCarried(__instance))
			{
				return false;
			}
			if (Plugin.IsLegBroken(__instance) && Plugin.cfgBlockJump.Value)
			{
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB), "Interact_performed")]
	internal static class PlayerInteract_Patch
	{
		[HarmonyPrefix]
		private static bool Prefix(PlayerControllerB __instance)
		{
			try
			{
				PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController;
				if ((Object)(object)val == (Object)null || __instance != val)
				{
					return true;
				}
				if (__instance.isPlayerDead)
				{
					return true;
				}
				if (Plugin.IsLegBroken(__instance))
				{
					return true;
				}
				if (Plugin.IsCarrying(__instance))
				{
					return true;
				}
				PlayerControllerB nearbyBrokenPlayer = Plugin.GetNearbyBrokenPlayer(__instance);
				if ((Object)(object)nearbyBrokenPlayer == (Object)null)
				{
					return true;
				}
				Plugin.Logger.LogInfo((object)("[BrokenLeg] " + __instance.playerUsername + " hebt " + nearbyBrokenPlayer.playerUsername + " auf!"));
				BrokenLegNetwork.ClientNotifyCarry(__instance.actualClientId, nearbyBrokenPlayer.actualClientId);
				return false;
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("[BrokenLeg] Interact-Patch Fehler: " + ex.Message));
				return true;
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB), "Discard_performed")]
	internal static class PlayerDiscard_Patch
	{
		[HarmonyPrefix]
		private static bool Prefix(PlayerControllerB __instance)
		{
			try
			{
				PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController;
				if ((Object)(object)val == (Object)null || __instance != val)
				{
					return true;
				}
				if (__instance.isPlayerDead)
				{
					return true;
				}
				if (Plugin.IsCarrying(__instance))
				{
					PlayerControllerB carriedPlayer = Plugin.GetCarriedPlayer(__instance);
					if ((Object)(object)carriedPlayer != (Object)null)
					{
						Plugin.Logger.LogInfo((object)"[BrokenLeg] Spieler abgelegt (Discard-Taste)!");
						BrokenLegNetwork.ClientNotifyDrop(__instance.actualClientId, carriedPlayer.actualClientId);
						return false;
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("[BrokenLeg] Discard-Patch Fehler: " + ex.Message));
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB), "KillPlayer")]
	internal static class Player_KillPlayer_Patch
	{
		[HarmonyPostfix]
		private static void Postfix(PlayerControllerB __instance)
		{
			try
			{
				ulong actualClientId = __instance.actualClientId;
				if (Plugin.IsBeingCarried(__instance))
				{
					Plugin.StopCarry(actualClientId);
				}
				PlayerControllerB carriedPlayer = Plugin.GetCarriedPlayer(__instance);
				if ((Object)(object)carriedPlayer != (Object)null)
				{
					Plugin.StopCarry(carriedPlayer.actualClientId);
				}
				Plugin.HealPlayer(actualClientId);
			}
			catch
			{
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound), "Start")]
	internal static class StartOfRound_Start_Patch
	{
		[HarmonyPostfix]
		private static void Postfix()
		{
			BrokenLegNetwork.Register();
			BrokenLegUpdater.EnsureExists();
			Plugin.Logger.LogInfo((object)"[BrokenLeg] Netzwerk + Updater initialisiert!");
		}
	}
	[HarmonyPatch(typeof(GameNetworkManager), "Disconnect")]
	internal static class GameNetworkManager_Disconnect_Patch
	{
		[HarmonyPrefix]
		private static void Prefix()
		{
			try
			{
				BrokenLegNetwork.Unregister();
				Plugin.CleanupAll();
			}
			catch
			{
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound), "ReviveDeadPlayers")]
	internal static class StartOfRound_ReviveDeadPlayers_Patch
	{
		[HarmonyPostfix]
		private static void Postfix()
		{
			Plugin.Logger.LogInfo((object)"[BrokenLeg] Spieler wiederbelebt → Aufraumen!");
			Plugin.CleanupAll();
			BrokenLegNetwork.HostBroadcastCleanup();
		}
	}
	[HarmonyPatch(typeof(StartOfRound), "ShipLeave")]
	internal static class StartOfRound_ShipLeave_Patch
	{
		[HarmonyPostfix]
		private static void Postfix()
		{
			Plugin.Logger.LogInfo((object)"[BrokenLeg] Schiff fliegt ab → Aufraumen!");
			Plugin.CleanupAll();
			BrokenLegNetwork.HostBroadcastCleanup();
		}
	}
	[HarmonyPatch(typeof(StartOfRound), "ResetShip")]
	internal static class StartOfRound_ResetShip_Patch
	{
		[HarmonyPostfix]
		private static void Postfix()
		{
			Plugin.Logger.LogInfo((object)"[BrokenLeg] Ship Reset → Aufraumen!");
			Plugin.CleanupAll();
			BrokenLegNetwork.HostBroadcastCleanup();
		}
	}
	internal class BrokenLegUpdater : MonoBehaviour
	{
		private static BrokenLegUpdater _instance;

		internal static void EnsureExists()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			if (!((Object)(object)_instance != (Object)null))
			{
				GameObject val = new GameObject("BrokenLegUpdater");
				Object.DontDestroyOnLoad((Object)val);
				_instance = val.AddComponent<BrokenLegUpdater>();
			}
		}

		private void LateUpdate()
		{
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: 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_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.CarryState.Count == 0)
			{
				return;
			}
			try
			{
				foreach (ulong item in new List<ulong>(Plugin.CarryState.Keys))
				{
					if (!Plugin.CarryState.ContainsKey(item))
					{
						continue;
					}
					ulong clientId = Plugin.CarryState[item];
					PlayerControllerB playerByClientId = BrokenLegNetwork.GetPlayerByClientId(item);
					PlayerControllerB playerByClientId2 = BrokenLegNetwork.GetPlayerByClientId(clientId);
					if ((Object)(object)playerByClientId == (Object)null || (Object)(object)playerByClientId2 == (Object)null)
					{
						continue;
					}
					if (playerByClientId2.isPlayerDead || playerByClientId.isPlayerDead)
					{
						Plugin.StopCarry(item);
						continue;
					}
					if (!playerByClientId2.twoHandedAnimation)
					{
						Plugin.SetCarryAnimation(playerByClientId2, enable: true);
					}
					Vector3 val = ((Component)playerByClientId2).transform.forward * Plugin.cfgCarryForward.Value - ((Component)playerByClientId2).transform.up * Plugin.cfgCarryDown.Value + ((Component)playerByClientId2).transform.right * Plugin.cfgCarryRight.Value;
					((Component)playerByClientId).transform.position = ((Component)playerByClientId2).transform.position + val;
					Vector3 eulerAngles = ((Component)playerByClientId2).transform.eulerAngles;
					((Component)playerByClientId).transform.eulerAngles = new Vector3(0f, eulerAngles.y, 0f);
				}
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("[BrokenLeg] Updater Fehler: " + ex.Message));
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "BrokenLegMod";

		public const string PLUGIN_NAME = "BrokenLegMod";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}