JBLM.dll

Decompiled 8 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using GameNetcodeStuff;
using JBLM.NetcodePatcher;
using LethalCompanyTemplate.Behaviours;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("JBLM")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("JB Lethal Mod")]
[assembly: AssemblyFileVersion("2.3.0.0")]
[assembly: AssemblyInformationalVersion("2.3.0+96b67800dfc884c5fa84388de7e0637cf35b75ab")]
[assembly: AssemblyProduct("JBLM")]
[assembly: AssemblyTitle("JBLM")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.3.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
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;
		}
	}
}
public class CrolardBehaviour : PhysicsProp
{
	private InteractTrigger[] triggers;

	private BoxCollider container;

	private AudioSource ganjaSource;

	public AudioClip ganjaCrolard;

	public AudioClip ganjaNoiseLow;

	public AudioClip ganjaNoiseMedium;

	public AudioClip ganjaNoiseHigh;

	public AudioClip ganjaExplosion;

	private float w1 = 1f;

	private float w2 = 3f;

	private float chanceMin = 0.005f;

	private float chanceMax = 0.2f;

	private float addedWeight = 0f;

	public override void Start()
	{
		((GrabbableObject)this).Start();
		triggers = ((Component)this).GetComponentsInChildren<InteractTrigger>();
		ganjaSource = ((Component)this).GetComponentInChildren<AudioSource>();
		BoxCollider[] componentsInChildren = ((Component)this).GetComponentsInChildren<BoxCollider>();
		foreach (BoxCollider val in componentsInChildren)
		{
			Debug.LogError((object)("Box collider found : " + ((Object)val).name + " !"));
			if (!(((Object)val).name != "PlaceableBounds"))
			{
				container = val;
				break;
			}
		}
		if ((Object)(object)container == (Object)null)
		{
			Debug.LogError((object)"Couldn't find BoxCollider component in the prefab...");
		}
		if (triggers == null)
		{
			Debug.LogError((object)"Couldn't find InteractTrigger components in the prefab...");
		}
		InteractTrigger[] array = triggers;
		foreach (InteractTrigger val2 in array)
		{
			((UnityEvent<PlayerControllerB>)(object)val2.onInteract).AddListener((UnityAction<PlayerControllerB>)InteractCrolard);
			((Component)val2).tag = "InteractTrigger";
			Debug.Log((object)"The tag is InteractTrigger");
			val2.interactCooldown = false;
			val2.cooldownTime = 0f;
			val2.timeToHold = 1.2f;
			val2.oneHandedItemAllowed = true;
			val2.twoHandedItemAllowed = true;
			val2.disableTriggerMesh = true;
			val2.holdInteraction = true;
		}
	}

	public override void ItemActivate(bool used, bool buttonDown = true)
	{
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		((GrabbableObject)this).ItemActivate(used, buttonDown);
		if (buttonDown && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
		{
			if (w1 < addedWeight && addedWeight <= w2)
			{
				ganjaSource.PlayOneShot(ganjaNoiseMedium, 0.8f);
			}
			else if (addedWeight <= w1)
			{
				ganjaSource.PlayOneShot(ganjaNoiseLow, 0.6f);
			}
			else
			{
				ganjaSource.PlayOneShot(ganjaNoiseHigh, 1f);
			}
			RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 60f, 1f, 0, ((GrabbableObject)this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
		}
	}

	public override void Update()
	{
		((GrabbableObject)this).Update();
		UpdateInteractTriggers();
	}

	private void UpdateInteractTriggers()
	{
		PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
		if ((Object)(object)localPlayerController == (Object)null)
		{
			return;
		}
		if (!localPlayerController.isHoldingObject)
		{
			SetInteractTriggers(interactable: false, "No item to feed");
			return;
		}
		GrabbableObject currentlyHeldObjectServer = localPlayerController.currentlyHeldObjectServer;
		if (!((Object)(object)((Component)currentlyHeldObjectServer).GetComponent<CrolardBehaviour>() != (Object)null))
		{
			if (!currentlyHeldObjectServer.itemProperties.isScrap)
			{
				SetInteractTriggers(interactable: false, "You can only feed scrap to Crolard");
			}
			else if ((Object)(object)RoundManager.Instance == (Object)null || (Object)(object)RoundManager.Instance.dungeonGenerator == (Object)null || !RoundManager.Instance.dungeonCompletedGenerating)
			{
				SetInteractTriggers(interactable: false, "You're not on a planet");
			}
			else
			{
				SetInteractTriggers(interactable: true, "Feed Crolard [LMB]");
			}
		}
	}

	private void SetInteractTriggers(bool interactable = false, string hoverTip = "Default text")
	{
		InteractTrigger[] array = triggers;
		foreach (InteractTrigger val in array)
		{
			val.interactable = interactable;
			if (interactable)
			{
				val.hoverTip = hoverTip;
			}
			else
			{
				val.disabledHoverTip = hoverTip;
			}
		}
	}

	[ServerRpc(RequireOwnership = false)]
	public void UpdateInternalWeightServerRpc(float newWeight)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: 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_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: 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(2671713532u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref newWeight, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2671713532u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				UpdateInternalWeightClientRpc(newWeight);
			}
		}
	}

	[ClientRpc]
	public void UpdateInternalWeightClientRpc(float newWeight)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: 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_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: 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))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2516328432u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref newWeight, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2516328432u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				addedWeight = newWeight;
			}
		}
	}

	[ServerRpc(RequireOwnership = false)]
	public void UpdateValueServerRpc(int newValue)
	{
		//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(811550316u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, newValue);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 811550316u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				UpdateValueClientRpc(newValue);
			}
		}
	}

	[ClientRpc]
	public void UpdateValueClientRpc(int newValue)
	{
		//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 != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4289962534u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, newValue);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4289962534u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				((GrabbableObject)this).scrapValue = newValue;
				((GrabbableObject)this).SetScrapValue(((GrabbableObject)this).scrapValue);
			}
		}
	}

	[ServerRpc(RequireOwnership = false)]
	public void ExplodeServerRpc(Vector3 location)
	{
		//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_0089: 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)
		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(3046441327u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref location);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3046441327u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ExplodeClientRpc(location);
			}
		}
	}

	[ClientRpc]
	public void ExplodeClientRpc(Vector3 location)
	{
		//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_0089: 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)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4123934730u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref location);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4123934730u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				ganjaSource.pitch = Random.Range(0.93f, 1.07f);
				ganjaSource.PlayOneShot(ganjaExplosion, 1.2f);
				SpawnExplosion(location, spawnExplosionEffect: false, 5.7f, 6.4f);
			}
		}
	}

	private void InteractCrolard(PlayerControllerB playerInteractor)
	{
		//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
		if (!playerInteractor.isHoldingObject)
		{
			return;
		}
		if ((Object)(object)playerInteractor.currentlyHeldObjectServer == (Object)null)
		{
			Debug.LogError((object)"Item is null");
			return;
		}
		if (!playerInteractor.currentlyHeldObjectServer.itemProperties.isScrap)
		{
			Debug.LogError((object)"This is not scrap");
			return;
		}
		int num = (int)((double)playerInteractor.currentlyHeldObjectServer.scrapValue * 1.3);
		float num2 = (playerInteractor.currentlyHeldObjectServer.itemProperties.weight - 1f) * 1.25f;
		if ((Object)(object)((Component)playerInteractor.currentlyHeldObjectServer).GetComponent<SaucisseBehaviour>() != (Object)null)
		{
			ganjaSource.PlayOneShot(ganjaCrolard, 0.8f);
			RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 800f, 1f, 0, ((GrabbableObject)this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
			UpdateValueServerRpc(((GrabbableObject)this).scrapValue + 70);
			playerInteractor.DespawnHeldObject();
			return;
		}
		playerInteractor.DespawnHeldObject();
		UpdateInternalWeightServerRpc(addedWeight + num2);
		UpdateValueServerRpc(((GrabbableObject)this).scrapValue + num);
		float num3 = ((w1 < addedWeight && addedWeight <= w2) ? (chanceMin + (addedWeight - w1) * (chanceMax - chanceMin) / (w2 - w1)) : ((!(addedWeight <= w1)) ? chanceMax : chanceMin));
		if (Random.Range(0f, 1f) < num3)
		{
			ExplodeServerRpc(((Component)this).transform.position + Vector3.up);
			UpdateInternalWeightServerRpc(0f);
			UpdateValueServerRpc((((GrabbableObject)this).scrapValue - num) / 2);
		}
	}

	public static void SpawnExplosion(Vector3 explosionPosition, bool spawnExplosionEffect = false, float killRange = 1f, float damageRange = 1f)
	{
		//IL_005c: 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)
		//IL_001d: 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_00a8: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f6: 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_0105: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0257: Unknown result type (might be due to invalid IL or missing references)
		//IL_025d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: Unknown result type (might be due to invalid IL or missing references)
		//IL_018e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0198: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
		Debug.Log((object)"Spawning explosion at pos: {explosionPosition}");
		if (spawnExplosionEffect)
		{
			Object.Instantiate<GameObject>(StartOfRound.Instance.explosionPrefab, explosionPosition, Quaternion.Euler(-90f, 0f, 0f), RoundManager.Instance.mapPropsContainer.transform).SetActive(true);
		}
		float num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, explosionPosition);
		if ((double)num < 14.0)
		{
			HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
		}
		else if ((double)num < 25.0)
		{
			HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
		}
		Collider[] array = Physics.OverlapSphere(explosionPosition, 6f, 2621448, (QueryTriggerInteraction)2);
		for (int i = 0; i < array.Length; i++)
		{
			float num2 = Vector3.Distance(explosionPosition, ((Component)array[i]).transform.position);
			if (!((double)num2 <= 4.0) && Physics.Linecast(explosionPosition, ((Component)array[i]).transform.position + Vector3.up * 0.3f, 256, (QueryTriggerInteraction)1))
			{
				continue;
			}
			if (((Component)array[i]).gameObject.layer == 3)
			{
				PlayerControllerB component = ((Component)array[i]).gameObject.GetComponent<PlayerControllerB>();
				if ((Object)(object)component != (Object)null && ((NetworkBehaviour)component).IsOwner)
				{
					if ((double)num2 < (double)killRange)
					{
						Vector3 val = (((Component)component.gameplayCamera).transform.position - explosionPosition) * 80f / Vector3.Distance(((Component)component.gameplayCamera).transform.position, explosionPosition);
						component.KillPlayer(val, true, (CauseOfDeath)3, 0);
					}
					else if ((double)num2 < (double)damageRange)
					{
						component.DamagePlayer(50, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
					}
				}
			}
			else if (((Component)array[i]).gameObject.layer == 19)
			{
				EnemyAICollisionDetect componentInChildren = ((Component)array[i]).gameObject.GetComponentInChildren<EnemyAICollisionDetect>();
				if ((Object)(object)componentInChildren != (Object)null && ((NetworkBehaviour)componentInChildren.mainScript).IsOwner && (double)num2 < 4.5)
				{
					componentInChildren.mainScript.HitEnemyOnLocalClient(6, default(Vector3), (PlayerControllerB)null, false);
				}
			}
		}
		int num3 = ~LayerMask.GetMask(new string[1] { "Room" });
		int num4 = ~LayerMask.GetMask(new string[1] { "Colliders" });
		Collider[] array2 = Physics.OverlapSphere(explosionPosition, 10f, num4);
		for (int j = 0; j < array2.Length; j++)
		{
			Component val2 = (Component)(object)array2[j];
			Rigidbody component2 = val2.GetComponent<Rigidbody>();
			if ((Object)(object)component2 != (Object)null)
			{
				component2.AddExplosionForce(70f, explosionPosition, 10f);
			}
		}
	}

	public override void GrabItem()
	{
		((GrabbableObject)this).GrabItem();
		if (Object.op_Implicit((Object)(object)((GrabbableObject)this).playerHeldBy) && (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)((GrabbableObject)this).playerHeldBy)
		{
			PlayerControllerB playerHeldBy = ((GrabbableObject)this).playerHeldBy;
			playerHeldBy.carryWeight += Mathf.Clamp(addedWeight, 0f, 10f);
		}
	}

	public override void DiscardItem()
	{
		if (Object.op_Implicit((Object)(object)((GrabbableObject)this).playerHeldBy) && (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)((GrabbableObject)this).playerHeldBy)
		{
			PlayerControllerB playerHeldBy = ((GrabbableObject)this).playerHeldBy;
			playerHeldBy.carryWeight -= Mathf.Clamp(addedWeight, 0f, 10f);
		}
		((GrabbableObject)this).DiscardItem();
	}

	public override void OnBroughtToShip()
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		((GrabbableObject)this).OnBroughtToShip();
		ganjaSource.PlayOneShot(ganjaCrolard, 1f);
		RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 300f, 1f, 0, ((GrabbableObject)this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
	}

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

	[RuntimeInitializeOnLoadMethod]
	internal static void InitializeRPCS_CrolardBehaviour()
	{
		//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
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Expected O, but got Unknown
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Expected O, but got Unknown
		NetworkManager.__rpc_func_table.Add(2671713532u, new RpcReceiveHandler(__rpc_handler_2671713532));
		NetworkManager.__rpc_func_table.Add(2516328432u, new RpcReceiveHandler(__rpc_handler_2516328432));
		NetworkManager.__rpc_func_table.Add(811550316u, new RpcReceiveHandler(__rpc_handler_811550316));
		NetworkManager.__rpc_func_table.Add(4289962534u, new RpcReceiveHandler(__rpc_handler_4289962534));
		NetworkManager.__rpc_func_table.Add(3046441327u, new RpcReceiveHandler(__rpc_handler_3046441327));
		NetworkManager.__rpc_func_table.Add(4123934730u, new RpcReceiveHandler(__rpc_handler_4123934730));
	}

	private static void __rpc_handler_2671713532(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_002f: 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_0044: 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)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			float newWeight = default(float);
			((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref newWeight, default(ForPrimitives));
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((CrolardBehaviour)(object)target).UpdateInternalWeightServerRpc(newWeight);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_2516328432(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_002f: 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_0044: 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)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			float newWeight = default(float);
			((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref newWeight, default(ForPrimitives));
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((CrolardBehaviour)(object)target).UpdateInternalWeightClientRpc(newWeight);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_811550316(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 newValue = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref newValue);
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((CrolardBehaviour)(object)target).UpdateValueServerRpc(newValue);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_4289962534(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 newValue = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref newValue);
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((CrolardBehaviour)(object)target).UpdateValueClientRpc(newValue);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_3046441327(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0036: 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_0050: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			Vector3 location = default(Vector3);
			((FastBufferReader)(ref reader)).ReadValueSafe(ref location);
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((CrolardBehaviour)(object)target).ExplodeServerRpc(location);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_4123934730(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0036: 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_0050: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			Vector3 location = default(Vector3);
			((FastBufferReader)(ref reader)).ReadValueSafe(ref location);
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((CrolardBehaviour)(object)target).ExplodeClientRpc(location);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	protected internal override string __getTypeName()
	{
		return "CrolardBehaviour";
	}
}
namespace LethalCompanyTemplate
{
	[BepInPlugin("JBLM", "JBLM", "2.3.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public static AssetBundle crolard_bundle;

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin JBLM start loading!");
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin JBLM loaded netcode patcher !");
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			crolard_bundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "crolard"));
			if ((Object)(object)crolard_bundle == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load custom assets.");
				return;
			}
			int num = 3;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading Crolard Item");
			Item val = crolard_bundle.LoadAsset<Item>("Assets/CrolardMod/Items/Scraps/crolard/CrolardItem.asset");
			CrolardBehaviour crolardBehaviour = val.spawnPrefab.AddComponent<CrolardBehaviour>();
			((GrabbableObject)crolardBehaviour).grabbable = true;
			((GrabbableObject)crolardBehaviour).grabbableToEnemies = true;
			((GrabbableObject)crolardBehaviour).itemProperties = val;
			crolardBehaviour.ganjaCrolard = crolard_bundle.LoadAsset<AudioClip>("Assets/CrolardMod/Items/Scraps/crolard/MoaningFar.mp3");
			crolardBehaviour.ganjaNoiseLow = crolard_bundle.LoadAsset<AudioClip>("Assets/CrolardMod/Items/Scraps/crolard/crilow.mp3");
			crolardBehaviour.ganjaNoiseMedium = crolard_bundle.LoadAsset<AudioClip>("Assets/CrolardMod/Items/Scraps/crolard/crimid.mp3");
			crolardBehaviour.ganjaNoiseHigh = crolard_bundle.LoadAsset<AudioClip>("Assets/CrolardMod/Items/Scraps/crolard/crihigh.mp3");
			crolardBehaviour.ganjaExplosion = crolard_bundle.LoadAsset<AudioClip>("Assets/CrolardMod/Items/Scraps/crolard/explosion.mp3");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Registering Crolard as scrap");
			Utilities.FixMixerGroups(val.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			Items.RegisterScrap(val, num, (LevelTypes)(-1));
			int num2 = 20;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading Saucisse Item");
			Item val2 = crolard_bundle.LoadAsset<Item>("Assets/CrolardMod/Items/Scraps/saucisse/SaucisseItem.asset");
			SaucisseBehaviour saucisseBehaviour = val2.spawnPrefab.AddComponent<SaucisseBehaviour>();
			((GrabbableObject)saucisseBehaviour).grabbable = true;
			((GrabbableObject)saucisseBehaviour).grabbableToEnemies = true;
			((GrabbableObject)saucisseBehaviour).itemProperties = val2;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Registering Saucisse as scrap");
			Utilities.FixMixerGroups(val2.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Items.RegisterScrap(val2, num2, (LevelTypes)(-1));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin JBLM is loaded!");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "JBLM";

		public const string PLUGIN_NAME = "JBLM";

		public const string PLUGIN_VERSION = "2.3.0";
	}
}
namespace LethalCompanyTemplate.Behaviours
{
	public class SaucisseBehaviour : PhysicsProp
	{
		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
		}

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

		protected internal override string __getTypeName()
		{
			return "SaucisseBehaviour";
		}
	}
}
namespace JBLM.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}