Decompiled source of LC Plan de Resurrection v1.0.0

LePlanDeResurection.dll

Decompiled 3 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LePlanDeResurection.Assets;
using LePlanDeResurection.Item;
using LePlanDeResurection.NetcodePatcher;
using LePlanDeResurection.Util;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LePlanDeResurection")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LePlanDeResurection")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4BB4F307-9517-4301-ACD8-E3586F60815B")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace LePlanDeResurection
{
	[BepInPlugin("LePlanDeResurection", "Le Plan De Resurection", "1.0.0")]
	public class ModMain : BaseUnityPlugin
	{
		public static ModMain Instance;

		public ManualLogSource logger;

		internal Harmony harmony;

		internal static KeyboardShortcut testkey = new KeyboardShortcut((KeyCode)107, Array.Empty<KeyCode>());

		private void Awake()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			if (!((Object)(object)Instance == (Object)null))
			{
				return;
			}
			Instance = this;
			harmony = new Harmony("LePlanDeResurection");
			logger = Logger.CreateLogSource("LePlanDeResurection");
			harmony.PatchAll();
			logger.LogMessage((object)"el caca coulante");
			LePlanDeResurection.Assets.Assets.Init();
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			foreach (Type type in types)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				foreach (MethodInfo methodInfo in methods)
				{
					if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class Test
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void TestPatch(PlayerControllerB __instance)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			if ((!((NetworkBehaviour)__instance).IsOwner || !((KeyboardShortcut)(ref ModMain.testkey)).IsDown()) && 1 == 0)
			{
				GameObject val = Object.Instantiate<GameObject>(LePlanDeResurection.Assets.Assets.Planderesurrection.spawnPrefab, ((Component)__instance).transform.position, ((Component)__instance).transform.rotation);
				GrabbableObject component = val.GetComponent<GrabbableObject>();
				((Component)component).transform.rotation = Quaternion.Euler(component.itemProperties.restingRotation);
				component.fallTime = 0f;
				component.scrapValue = 1;
				NetworkObject component2 = val.GetComponent<NetworkObject>();
				component2.Spawn(false);
			}
		}
	}
}
namespace LePlanDeResurection.Util
{
	public class SpawnRarity
	{
		private readonly Dictionary<Planet, int> rarities = new Dictionary<Planet, int>();

		private readonly Item item;

		private int defaultValue;

		public SpawnRarity(int baseValue, Item itemIn)
		{
			item = itemIn;
			defaultValue = baseValue;
			foreach (Planet value in Enum.GetValues(typeof(Planet)))
			{
				rarities.Add(value, baseValue);
			}
		}

		public int GetRarityFor(Planet planet)
		{
			return rarities[planet];
		}

		public int GetRarityFor(int planet)
		{
			return rarities.Values.ToList()[planet];
		}

		public void SetValues(int experimentation = -1, int assurance = -1, int vow = -1, int march = -1, int offense = -1, int adamance = -1, int rend = -1, int dine = -1, int titan = -1, int artifice = -1, int embrion = -1)
		{
			rarities[Planet.EXPERIMENTATION] = experimentation;
			rarities[Planet.ASSURANCE] = assurance;
			rarities[Planet.VOW] = vow;
			rarities[Planet.MARCH] = march;
			rarities[Planet.OFFENSE] = offense;
			rarities[Planet.ADAMANCE] = adamance;
			rarities[Planet.REND] = rend;
			rarities[Planet.DINE] = dine;
			rarities[Planet.TITAN] = titan;
			rarities[Planet.ARTIFICE] = artifice;
			rarities[Planet.EMBRION] = embrion;
		}

		public void CopyRaritiesFrom(SpawnRarity other)
		{
			rarities[Planet.EXPERIMENTATION] = other.rarities[Planet.EXPERIMENTATION];
			rarities[Planet.ASSURANCE] = other.rarities[Planet.ASSURANCE];
			rarities[Planet.VOW] = other.rarities[Planet.VOW];
			rarities[Planet.MARCH] = other.rarities[Planet.MARCH];
			rarities[Planet.OFFENSE] = other.rarities[Planet.OFFENSE];
			rarities[Planet.ADAMANCE] = other.rarities[Planet.ADAMANCE];
			rarities[Planet.REND] = other.rarities[Planet.REND];
			rarities[Planet.DINE] = other.rarities[Planet.DINE];
			rarities[Planet.TITAN] = other.rarities[Planet.TITAN];
			rarities[Planet.ARTIFICE] = other.rarities[Planet.ARTIFICE];
			rarities[Planet.EMBRION] = other.rarities[Planet.EMBRION];
		}

		public SpawnableItemWithRarity GetSpawnableItemForPlanet(Planet planet)
		{
			//IL_0001: 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)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			return new SpawnableItemWithRarity
			{
				spawnableItem = item,
				rarity = AccessRaritySafe((int)planet)
			};
		}

		public SpawnableItemWithRarity GetSpawnableItemForPlanet(int planet)
		{
			//IL_0001: 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)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			return new SpawnableItemWithRarity
			{
				spawnableItem = item,
				rarity = AccessRaritySafe(planet)
			};
		}

		private int AccessRaritySafe(int planet)
		{
			try
			{
				return rarities.Values.ToList()[planet];
			}
			catch (Exception)
			{
			}
			return defaultValue;
		}

		public void ApplySpawnRarity(SelectableLevel level)
		{
			level.spawnableScrap.Add(GetSpawnableItemForPlanet(level.levelID));
		}
	}
	public enum Planet
	{
		EXPERIMENTATION,
		ASSURANCE,
		VOW,
		GORDION,
		MARCH,
		ADAMANCE,
		REND,
		DINE,
		OFFENSE,
		TITAN,
		ARTIFICE,
		LIQUIDATION,
		EMBRION
	}
}
namespace LePlanDeResurection.Item
{
	public class LePlanderesurrection : GrabbableObject
	{
		[CompilerGenerated]
		private sealed class <SetPlayerUI>d__9 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public PlayerControllerB player;

			public bool critical;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForFixedUpdate();
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					HUDManager.Instance.UpdateHealthUI(player.health, false);
					player.MakeCriticallyInjured(critical);
					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();
			}
		}

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

			private object <>2__current;

			public Vector3 revivePosition;

			public LePlanderesurrection <>4__this;

			private PlayerControllerB <localPlayer>5__1;

			private int <i>5__2;

			private PlayerControllerB <p>5__3;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Expected O, but got Unknown
				//IL_0101: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = null;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>2__current = (object)new WaitForFixedUpdate();
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					<localPlayer>5__1 = null;
					<i>5__2 = 0;
					while (<i>5__2 < StartOfRound.Instance.allPlayerScripts.Length)
					{
						<p>5__3 = StartOfRound.Instance.allPlayerScripts[<i>5__2];
						if (!((Object)(object)<p>5__3 == (Object)null))
						{
							if (((NetworkBehaviour)<p>5__3).IsOwner)
							{
								<localPlayer>5__1 = <p>5__3;
								break;
							}
							<p>5__3 = null;
						}
						<i>5__2++;
					}
					if ((Object)(object)<localPlayer>5__1 != (Object)null)
					{
						<localPlayer>5__1.TeleportPlayer(revivePosition, false, 0f, false, true);
					}
					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();
			}
		}

		private AudioSource _audioSource;

		private static readonly int Limp = Animator.StringToHash("Limp");

		public float reviveRange = 5f;

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (!((NetworkBehaviour)this).IsOwner || !buttonDown)
			{
				return;
			}
			PlayerControllerB val = FindClosestDeadPlayer();
			if ((Object)(object)val != (Object)null)
			{
				RevivePlayerServerRpc((int)val.playerClientId);
				Debug.Log((object)(">> Joueur " + val.playerUsername + " a été ressuscité ce fdp"));
				if ((Object)(object)base.playerHeldBy != (Object)null)
				{
					((GrabbableObject)this).DestroyObjectInHand(base.playerHeldBy);
				}
			}
			else
			{
				Debug.Log((object)">> chef ya rien par ici");
			}
		}

		public override void Start()
		{
			((GrabbableObject)this).Start();
			_audioSource = ((Component)this).gameObject.GetComponent<AudioSource>();
		}

		private PlayerControllerB FindClosestDeadPlayer()
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB result = null;
			float num = float.PositiveInfinity;
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			RaycastHit val2 = default(RaycastHit);
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (!((Object)(object)val == (Object)null) && val.isPlayerDead && !((Object)(object)val.deadBody == (Object)null))
				{
					float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val.deadBody).transform.position);
					if (num2 < reviveRange && num2 < num && !Physics.Linecast(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((Component)val.deadBody).transform.position, ref val2, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
					{
						num = num2;
						result = val;
					}
				}
			}
			return result;
		}

		[ServerRpc(RequireOwnership = false)]
		private void TeleportRevivedPlayerServerRpc(int targetPlayerId, Vector3 revivePosition)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3562382500u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, targetPlayerId);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref revivePosition);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3562382500u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val3 = default(ClientRpcParams);
					val3.Send = new ClientRpcSendParams
					{
						TargetClientIds = new ulong[1] { (ulong)targetPlayerId }
					};
					ClientRpcParams clientRpcParams = val3;
					TeleportRevivedPlayerClientRpc(targetPlayerId, revivePosition, clientRpcParams);
				}
			}
		}

		[ClientRpc]
		private void TeleportRevivedPlayerClientRpc(int targetPlayerId, Vector3 revivePosition, ClientRpcParams clientRpcParams = default(ClientRpcParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1640985540u, clientRpcParams, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val, targetPlayerId);
					((FastBufferWriter)(ref val)).WriteValueSafe(ref revivePosition);
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 1640985540u, clientRpcParams, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					((MonoBehaviour)this).StartCoroutine(WaitAndTeleportClient(revivePosition));
				}
			}
		}

		[IteratorStateMachine(typeof(<WaitAndTeleportClient>d__8))]
		private IEnumerator WaitAndTeleportClient(Vector3 revivePosition)
		{
			//IL_000e: 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)
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <WaitAndTeleportClient>d__8(0)
			{
				<>4__this = this,
				revivePosition = revivePosition
			};
		}

		[IteratorStateMachine(typeof(<SetPlayerUI>d__9))]
		private static IEnumerator SetPlayerUI(PlayerControllerB player, bool critical = false)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <SetPlayerUI>d__9(0)
			{
				player = player,
				critical = critical
			};
		}

		[ServerRpc(RequireOwnership = false)]
		public void RevivePlayerServerRpc(int playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(129188314u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerId);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 129188314u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					RevivePlayerClientRpc(playerId);
				}
			}
		}

		[ClientRpc]
		public void RevivePlayerClientRpc(int playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1212640718u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1212640718u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[playerId];
			if (!val3.isPlayerDead && !val3.isPlayerControlled)
			{
				return;
			}
			val3.ResetPlayerBloodObjects(true);
			val3.isClimbingLadder = false;
			val3.clampLooking = false;
			val3.inVehicleAnimation = false;
			val3.disableMoveInput = false;
			val3.ResetZAndXRotation();
			((Collider)val3.thisController).enabled = true;
			val3.health = 100;
			val3.hasBeenCriticallyInjured = false;
			val3.disableLookInput = false;
			val3.disableInteract = false;
			if (val3.isPlayerDead)
			{
				val3.isPlayerDead = false;
				val3.isPlayerControlled = true;
				val3.isInElevator = true;
				val3.isInHangarShipRoom = true;
				val3.isInsideFactory = false;
				val3.parentedToElevatorLastFrame = false;
				val3.overrideGameOverSpectatePivot = null;
				StartOfRound.Instance.SetPlayerObjectExtrapolate(false);
				val3.TeleportPlayer(((Component)val3.deadBody).transform.position, false, 0f, false, true);
				val3.setPositionOfDeadPlayer = false;
				val3.DisablePlayerModel(StartOfRound.Instance.allPlayerObjects[playerId], true, true);
				((Behaviour)val3.helmetLight).enabled = false;
				val3.Crouch(false);
				val3.criticallyInjured = false;
				if (Object.op_Implicit((Object)(object)val3.playerBodyAnimator))
				{
					val3.playerBodyAnimator.SetBool(Limp, false);
				}
				val3.bleedingHeavily = false;
				val3.activatingItem = false;
				val3.twoHanded = false;
				val3.inShockingMinigame = false;
				val3.inSpecialInteractAnimation = false;
				val3.freeRotationInInteractAnimation = false;
				val3.disableSyncInAnimation = false;
				val3.inAnimationWithEnemy = null;
				val3.holdingWalkieTalkie = false;
				val3.speakingToWalkieTalkie = false;
				val3.isSinking = false;
				val3.isUnderwater = false;
				val3.sinkingValue = 0f;
				val3.statusEffectAudio.Stop();
				val3.DisableJetpackControlsLocally();
				val3.health = 100;
				val3.mapRadarDotAnimator.SetBool("dead", false);
				val3.externalForceAutoFade = Vector3.zero;
				if (((NetworkBehaviour)val3).IsOwner)
				{
					HUDManager.Instance.gasHelmetAnimator.SetBool("gasEmitting", false);
					val3.hasBegunSpectating = false;
					HUDManager.Instance.RemoveSpectateUI();
					HUDManager.Instance.gameOverAnimator.SetTrigger("revive");
					val3.hinderedMultiplier = 1f;
					val3.isMovementHindered = 0;
					val3.sourcesCausingSinking = 0;
					val3.reverbPreset = StartOfRound.Instance.shipReverb;
				}
			}
			if (((NetworkBehaviour)val3).IsOwner)
			{
				SoundManager.Instance.earsRingingTimer = 0f;
				val3.bleedingHeavily = false;
				val3.criticallyInjured = false;
				val3.playerBodyAnimator.SetBool(Limp, false);
				val3.health = 100;
				HUDManager.Instance.UpdateHealthUI(100, false);
				val3.spectatedPlayerScript = null;
				((Behaviour)HUDManager.Instance.audioListenerLowPass).enabled = false;
				StartOfRound.Instance.SetSpectateCameraToGameOverMode(false, val3);
				((MonoBehaviour)this).StartCoroutine(SetPlayerUI(val3));
			}
			val3.voiceMuffledByEnemy = false;
			SoundManager.Instance.playerVoicePitchTargets[playerId] = 1f;
			SoundManager.Instance.SetPlayerPitch(1f, playerId);
			if (Object.op_Implicit((Object)(object)val3.currentVoiceChatIngameSettings))
			{
				if (!Object.op_Implicit((Object)(object)val3.currentVoiceChatIngameSettings.voiceAudio))
				{
					val3.currentVoiceChatIngameSettings.InitializeComponents();
				}
				if (!Object.op_Implicit((Object)(object)val3.currentVoiceChatIngameSettings.voiceAudio))
				{
					return;
				}
				((Component)val3.currentVoiceChatIngameSettings.voiceAudio).GetComponent<OccludeAudio>().overridingLowPass = false;
			}
			RagdollGrabbableObject[] array = Object.FindObjectsOfType<RagdollGrabbableObject>();
			RagdollGrabbableObject[] array2 = array;
			foreach (RagdollGrabbableObject val4 in array2)
			{
				if (val4.ragdoll.playerObjectId != playerId)
				{
					continue;
				}
				if (!((GrabbableObject)val4).isHeld)
				{
					if (((NetworkBehaviour)this).IsServer)
					{
						if (((NetworkBehaviour)val4).NetworkObject.IsSpawned)
						{
							((NetworkBehaviour)val4).NetworkObject.Despawn(true);
						}
						else
						{
							Object.Destroy((Object)(object)((Component)val4).gameObject);
						}
					}
				}
				else if (Object.op_Implicit((Object)(object)((GrabbableObject)val4).playerHeldBy))
				{
					((GrabbableObject)val4).playerHeldBy.DropAllHeldItems(true, false);
				}
			}
			DeadBodyInfo[] array3 = Object.FindObjectsOfType<DeadBodyInfo>();
			DeadBodyInfo[] array4 = array3;
			foreach (DeadBodyInfo val5 in array4)
			{
				if (val5.playerObjectId == playerId)
				{
					Object.Destroy((Object)(object)((Component)val5).gameObject);
				}
			}
			StartOfRound instance = StartOfRound.Instance;
			instance.livingPlayers++;
			StartOfRound.Instance.allPlayersDead = false;
			StartOfRound.Instance.UpdatePlayerVoiceEffects();
		}

		protected override void __initializeVariables()
		{
			((GrabbableObject)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_LePlanderesurrection()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3562382500u, new RpcReceiveHandler(__rpc_handler_3562382500));
			NetworkManager.__rpc_func_table.Add(1640985540u, new RpcReceiveHandler(__rpc_handler_1640985540));
			NetworkManager.__rpc_func_table.Add(129188314u, new RpcReceiveHandler(__rpc_handler_129188314));
			NetworkManager.__rpc_func_table.Add(1212640718u, new RpcReceiveHandler(__rpc_handler_1212640718));
		}

		private static void __rpc_handler_3562382500(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int targetPlayerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref targetPlayerId);
				Vector3 revivePosition = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref revivePosition);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((LePlanderesurrection)(object)target).TeleportRevivedPlayerServerRpc(targetPlayerId, revivePosition);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1640985540(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int targetPlayerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref targetPlayerId);
				Vector3 revivePosition = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref revivePosition);
				ClientRpcParams client = rpcParams.Client;
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((LePlanderesurrection)(object)target).TeleportRevivedPlayerClientRpc(targetPlayerId, revivePosition, client);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_129188314(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((LePlanderesurrection)(object)target).RevivePlayerServerRpc(playerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1212640718(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((LePlanderesurrection)(object)target).RevivePlayerClientRpc(playerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "LePlanderesurrection";
		}
	}
}
namespace LePlanDeResurection.Assets
{
	public static class Assets
	{
		internal static AssetBundle _assetBundle;

		public static Item Planderesurrection;

		public static SpawnRarity zizipipicaca;

		public static AudioClip cleplanderesurrection;

		internal static void Init()
		{
			Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("LePlanDeResurection.Assets.cacamoisi");
			if (manifestResourceStream != null)
			{
				_assetBundle = AssetBundle.LoadFromStream(manifestResourceStream);
				Planderesurrection = _assetBundle.LoadAsset<Item>("Assets/LePlanDeResurection/LePlanDeResurection/plan.asset");
				cleplanderesurrection = _assetBundle.LoadAsset<AudioClip>("Assets/LePlanDeResurection/LePlanDeResurection/plaaannn.ogg");
				LePlanderesurrection lePlanderesurrection = Planderesurrection.spawnPrefab.AddComponent<LePlanderesurrection>();
				((GrabbableObject)lePlanderesurrection).grabbable = true;
				((GrabbableObject)lePlanderesurrection).grabbableToEnemies = false;
				((GrabbableObject)lePlanderesurrection).itemProperties = Planderesurrection;
				zizipipicaca = new SpawnRarity(10, Planderesurrection);
				zizipipicaca.SetValues(-1, -1, 15, 35, 20, -1, 30, 30, 69, 50, 25);
			}
		}
	}
	[HarmonyPatch(typeof(GameNetworkManager))]
	public class GameNetworkPatcher
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void Postfix()
		{
			NetworkManager component = ((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>();
			component.AddNetworkPrefab(Assets.Planderesurrection.spawnPrefab);
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	public class StartOfRoundPatcher
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		public static void Postfix(StartOfRound __instance)
		{
			SelectableLevel[] levels = __instance.levels;
			foreach (SelectableLevel level in levels)
			{
				Assets.zizipipicaca.ApplySpawnRarity(level);
				RegisterItem(Assets.Planderesurrection, __instance);
			}
		}

		private static void RegisterItem(Item item, StartOfRound manager)
		{
			if (!manager.allItemsList.itemsList.Contains(item))
			{
				manager.allItemsList.itemsList.Add(item);
			}
		}
	}
}
namespace LePlanDeResurection.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}