Decompiled source of CouncilGear v0.0.4

CouncilGear.dll

Decompiled 6 months 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.Versioning;
using BepInEx;
using CouncilGear.Patches;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
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("CouncilGear")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CouncilGear")]
[assembly: AssemblyTitle("CouncilGear")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
public class Shovel : GrabbableObject
{
	public int shovelHitForce = 1;

	public bool reelingUp;

	public bool isHoldingButton;

	private RaycastHit rayHit;

	private Coroutine reelingUpCoroutine;

	private RaycastHit[] objectsHitByShovel;

	private List<RaycastHit> objectsHitByShovelList = new List<RaycastHit>();

	public AudioClip reelUp;

	public AudioClip swing;

	public AudioClip[] hitSFX;

	public AudioSource shovelAudio;

	private PlayerControllerB previousPlayerHeldBy;

	private int shovelMask = 11012424;

	public override void ItemActivate(bool used, bool buttonDown = true)
	{
		if ((Object)(object)base.playerHeldBy == (Object)null)
		{
			return;
		}
		Debug.Log((object)$"Is player pressing down button?: {buttonDown}");
		isHoldingButton = buttonDown;
		Debug.Log((object)("PLAYER ACTIVATED ITEM TO HIT WITH SHOVEL. Who sent this log: " + ((Object)((Component)GameNetworkManager.Instance.localPlayerController).gameObject).name));
		if (!reelingUp && buttonDown)
		{
			reelingUp = true;
			previousPlayerHeldBy = base.playerHeldBy;
			Debug.Log((object)$"Set previousPlayerHeldBy: {previousPlayerHeldBy}");
			if (reelingUpCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(reelingUpCoroutine);
			}
			reelingUpCoroutine = ((MonoBehaviour)this).StartCoroutine(reelUpShovel());
		}
	}

	private IEnumerator reelUpShovel()
	{
		base.playerHeldBy.activatingItem = true;
		base.playerHeldBy.twoHanded = true;
		base.playerHeldBy.playerBodyAnimator.ResetTrigger("shovelHit");
		base.playerHeldBy.playerBodyAnimator.SetBool("reelingUp", true);
		shovelAudio.PlayOneShot(reelUp);
		ReelUpSFXServerRpc();
		yield return (object)new WaitForSeconds(0.35f);
		yield return (object)new WaitUntil((Func<bool>)(() => !isHoldingButton || !base.isHeld));
		SwingShovel(!base.isHeld);
		yield return (object)new WaitForSeconds(0.13f);
		yield return (object)new WaitForEndOfFrame();
		HitShovel(!base.isHeld);
		yield return (object)new WaitForSeconds(0.3f);
		reelingUp = false;
		reelingUpCoroutine = null;
	}

	[ServerRpc]
	public void ReelUpSFXServerRpc()
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Invalid comparison between Unknown and I4
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Invalid comparison between Unknown and I4
		//IL_0050: 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_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: 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: Invalid comparison between Unknown and I4
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
				return;
			}
			ServerRpcParams val = default(ServerRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4113335123u, val, (RpcDelivery)0);
			((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4113335123u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			ReelUpSFXClientRpc();
		}
	}

	[ClientRpc]
	public void ReelUpSFXClientRpc()
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Invalid comparison between Unknown and I4
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Invalid comparison between Unknown and I4
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: 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(2042054613u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2042054613u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((NetworkBehaviour)this).IsOwner)
			{
				shovelAudio.PlayOneShot(reelUp);
			}
		}
	}

	public override void DiscardItem()
	{
		if ((Object)(object)base.playerHeldBy != (Object)null)
		{
			base.playerHeldBy.activatingItem = false;
		}
		((GrabbableObject)this).DiscardItem();
	}

	public void SwingShovel(bool cancel = false)
	{
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		previousPlayerHeldBy.playerBodyAnimator.SetBool("reelingUp", false);
		if (!cancel)
		{
			shovelAudio.PlayOneShot(swing);
			previousPlayerHeldBy.UpdateSpecialAnimationValue(true, (short)((Component)previousPlayerHeldBy).transform.localEulerAngles.y, 0.4f, false);
		}
	}

	public void HitShovel(bool cancel = false)
	{
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: 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_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0305: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_0131: Unknown result type (might be due to invalid IL or missing references)
		//IL_0136: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_019a: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e5: 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)
		//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_024c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0251: Unknown result type (might be due to invalid IL or missing references)
		//IL_025a: Unknown result type (might be due to invalid IL or missing references)
		//IL_025f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0263: Unknown result type (might be due to invalid IL or missing references)
		//IL_0268: Unknown result type (might be due to invalid IL or missing references)
		//IL_0272: Unknown result type (might be due to invalid IL or missing references)
		//IL_0277: Unknown result type (might be due to invalid IL or missing references)
		//IL_020a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0216: Unknown result type (might be due to invalid IL or missing references)
		//IL_021b: Unknown result type (might be due to invalid IL or missing references)
		//IL_021f: Unknown result type (might be due to invalid IL or missing references)
		//IL_028e: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)previousPlayerHeldBy == (Object)null)
		{
			Debug.LogError((object)"Previousplayerheldby is null on this client when HitShovel is called.");
			return;
		}
		previousPlayerHeldBy.activatingItem = false;
		bool flag = false;
		bool flag2 = false;
		int num = -1;
		if (!cancel)
		{
			previousPlayerHeldBy.twoHanded = false;
			objectsHitByShovel = Physics.SphereCastAll(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * -0.35f, 0.8f, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward, 1.5f, shovelMask, (QueryTriggerInteraction)2);
			objectsHitByShovelList = objectsHitByShovel.OrderBy((RaycastHit x) => ((RaycastHit)(ref x)).distance).ToList();
			IHittable val2 = default(IHittable);
			RaycastHit val3 = default(RaycastHit);
			for (int i = 0; i < objectsHitByShovelList.Count; i++)
			{
				RaycastHit val = objectsHitByShovelList[i];
				if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 8)
				{
					val = objectsHitByShovelList[i];
					if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 11)
					{
						val = objectsHitByShovelList[i];
						if (!((Component)((RaycastHit)(ref val)).transform).TryGetComponent<IHittable>(ref val2))
						{
							continue;
						}
						val = objectsHitByShovelList[i];
						if ((Object)(object)((RaycastHit)(ref val)).transform == (Object)(object)((Component)previousPlayerHeldBy).transform)
						{
							continue;
						}
						val = objectsHitByShovelList[i];
						if (!(((RaycastHit)(ref val)).point == Vector3.zero))
						{
							Vector3 position = ((Component)previousPlayerHeldBy.gameplayCamera).transform.position;
							val = objectsHitByShovelList[i];
							if (Physics.Linecast(position, ((RaycastHit)(ref val)).point, ref val3, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
							{
								continue;
							}
						}
						flag = true;
						Vector3 forward = ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward;
						val = objectsHitByShovelList[i];
						Debug.DrawRay(((RaycastHit)(ref val)).point, Vector3.up * 0.25f, Color.green, 5f);
						try
						{
							val2.Hit(shovelHitForce, forward, previousPlayerHeldBy, true);
							flag2 = true;
						}
						catch (Exception arg)
						{
							Debug.Log((object)$"Exception caught when hitting object with shovel from player #{previousPlayerHeldBy.playerClientId}: {arg}");
						}
						continue;
					}
				}
				flag = true;
				val = objectsHitByShovelList[i];
				string tag = ((Component)((RaycastHit)(ref val)).collider).gameObject.tag;
				for (int j = 0; j < StartOfRound.Instance.footstepSurfaces.Length; j++)
				{
					if (StartOfRound.Instance.footstepSurfaces[j].surfaceTag == tag)
					{
						num = j;
						break;
					}
				}
			}
		}
		if (flag)
		{
			RoundManager.PlayRandomClip(shovelAudio, hitSFX, true, 1f, 0);
			Object.FindObjectOfType<RoundManager>().PlayAudibleNoise(((Component)this).transform.position, 17f, 0.8f, 0, false, 0);
			if (!flag2 && num != -1)
			{
				shovelAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX);
				WalkieTalkie.TransmitOneShotAudio(shovelAudio, StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX, 1f);
			}
			base.playerHeldBy.playerBodyAnimator.SetTrigger("shovelHit");
			HitShovelServerRpc(num);
		}
	}

	[ServerRpc]
	public void HitShovelServerRpc(int hitSurfaceID)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Invalid comparison between Unknown and I4
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Invalid comparison between Unknown and I4
		//IL_0050: 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_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: 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_0073: 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: Invalid comparison between Unknown and I4
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
				return;
			}
			ServerRpcParams val = default(ServerRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2096026133u, val, (RpcDelivery)0);
			BytePacker.WriteValueBitPacked(val2, hitSurfaceID);
			((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2096026133u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			HitShovelClientRpc(hitSurfaceID);
		}
	}

	[ClientRpc]
	public void HitShovelClientRpc(int hitSurfaceID)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Invalid comparison between Unknown and I4
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Invalid comparison between Unknown and I4
		//IL_002e: 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_003c: 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_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		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(275435223u, val, (RpcDelivery)0);
			BytePacker.WriteValueBitPacked(val2, hitSurfaceID);
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 275435223u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((NetworkBehaviour)this).IsOwner)
		{
			RoundManager.PlayRandomClip(shovelAudio, hitSFX, true, 1f, 0);
			if (hitSurfaceID != -1)
			{
				HitSurfaceWithShovel(hitSurfaceID);
			}
		}
	}

	private void HitSurfaceWithShovel(int hitSurfaceID)
	{
		shovelAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX);
		WalkieTalkie.TransmitOneShotAudio(shovelAudio, StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX, 1f);
	}

	protected override void __initializeVariables()
	{
		((GrabbableObject)this).__initializeVariables();
	}
}
namespace CouncilGear
{
	internal class BatTest : FlashlightItem
	{
		public int hammerHitForce = 1;

		public float hammerHitPercentage = 10f;

		public bool reelingUp;

		public bool isHoldingButton;

		private RaycastHit rayHit;

		private Coroutine reelingUpCoroutine;

		private RaycastHit[] objectsHitByHammer;

		private List<RaycastHit> objectsHitByHammerList = new List<RaycastHit>();

		public AudioClip reelUp;

		public AudioClip swing;

		public AudioClip[] hitSFX;

		public AudioSource hammerAudio;

		private PlayerControllerB previousPlayerHeldBy;

		private int hammerMask = 11012424;

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			if ((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null)
			{
				return;
			}
			isHoldingButton = buttonDown;
			if (!reelingUp && buttonDown)
			{
				reelingUp = true;
				previousPlayerHeldBy = ((GrabbableObject)this).playerHeldBy;
				if (reelingUpCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(reelingUpCoroutine);
				}
				reelingUpCoroutine = ((MonoBehaviour)this).StartCoroutine(reelUpHammer());
			}
		}

		private IEnumerator reelUpHammer()
		{
			((GrabbableObject)this).playerHeldBy.activatingItem = true;
			((GrabbableObject)this).playerHeldBy.twoHanded = true;
			((GrabbableObject)this).playerHeldBy.playerBodyAnimator.ResetTrigger("hammerHit");
			((GrabbableObject)this).playerHeldBy.playerBodyAnimator.SetBool("reelingUp", true);
			hammerAudio.PlayOneShot(reelUp);
			ReelUpSFXServerRpc();
			yield return (object)new WaitForSeconds(0.35f);
			yield return (object)new WaitUntil((Func<bool>)(() => !isHoldingButton || !((GrabbableObject)this).isHeld));
			SwingHammer(!((GrabbableObject)this).isHeld);
			yield return (object)new WaitForSeconds(0.13f);
			HitHammer(!((GrabbableObject)this).isHeld);
			yield return (object)new WaitForSeconds(0.3f);
			reelingUp = false;
			reelingUpCoroutine = null;
		}

		[ServerRpc]
		public void ReelUpSFXServerRpc()
		{
			ReelUpSFXClientRpc();
		}

		[ClientRpc]
		public void ReelUpSFXClientRpc()
		{
			hammerAudio.PlayOneShot(reelUp);
		}

		public override void DiscardItem()
		{
			((GrabbableObject)this).playerHeldBy.activatingItem = false;
			((FlashlightItem)this).DiscardItem();
		}

		public void SwingHammer(bool cancel = false)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			previousPlayerHeldBy.playerBodyAnimator.SetBool("reelingUp", false);
			if (!cancel)
			{
				hammerAudio.PlayOneShot(swing);
				previousPlayerHeldBy.UpdateSpecialAnimationValue(true, (short)((Component)previousPlayerHeldBy).transform.localEulerAngles.y, 0.4f, false);
			}
		}

		public void HitHammer(bool cancel = false)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: 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_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)previousPlayerHeldBy == (Object)null)
			{
				return;
			}
			previousPlayerHeldBy.activatingItem = false;
			bool flag = false;
			if (!cancel)
			{
				previousPlayerHeldBy.twoHanded = false;
				Debug.DrawRay(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * -0.35f, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward * 1.85f, Color.blue, 5f);
				objectsHitByHammer = Physics.SphereCastAll(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * -0.35f, 0.75f, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward, 1.85f, hammerMask, (QueryTriggerInteraction)2);
				objectsHitByHammerList = objectsHitByHammer.OrderBy((RaycastHit x) => ((RaycastHit)(ref x)).distance).ToList();
				Vector3 val = ((Component)previousPlayerHeldBy.gameplayCamera).transform.position;
				IHittable val3 = default(IHittable);
				RaycastHit val5 = default(RaycastHit);
				for (int i = 0; i < objectsHitByHammerList.Count; i++)
				{
					RaycastHit val2 = objectsHitByHammerList[i];
					if (((Component)((RaycastHit)(ref val2)).transform).gameObject.layer != 8)
					{
						val2 = objectsHitByHammerList[i];
						if (((Component)((RaycastHit)(ref val2)).transform).gameObject.layer != 11)
						{
							val2 = objectsHitByHammerList[i];
							if (!((Component)((RaycastHit)(ref val2)).transform).TryGetComponent<IHittable>(ref val3))
							{
								continue;
							}
							val2 = objectsHitByHammerList[i];
							if ((Object)(object)((RaycastHit)(ref val2)).transform == (Object)(object)((Component)previousPlayerHeldBy).transform)
							{
								continue;
							}
							val2 = objectsHitByHammerList[i];
							if (!(((RaycastHit)(ref val2)).point == Vector3.zero))
							{
								Vector3 val4 = val;
								val2 = objectsHitByHammerList[i];
								if (Physics.Linecast(val4, ((RaycastHit)(ref val2)).point, ref val5, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
								{
									continue;
								}
							}
							flag = true;
							Vector3 forward = ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward;
							if (Random.Range(0f, 100f) < hammerHitPercentage)
							{
								val3.Hit(hammerHitForce, forward, previousPlayerHeldBy, true);
							}
							continue;
						}
					}
					val2 = objectsHitByHammerList[i];
					Vector3 point = ((RaycastHit)(ref val2)).point;
					val2 = objectsHitByHammerList[i];
					val = point + ((RaycastHit)(ref val2)).normal * 0.01f;
					flag = true;
					val2 = objectsHitByHammerList[i];
					string tag = ((Component)((RaycastHit)(ref val2)).collider).gameObject.tag;
					for (int j = 0; j < StartOfRound.Instance.footstepSurfaces.Length; j++)
					{
						if (StartOfRound.Instance.footstepSurfaces[j].surfaceTag == tag)
						{
							hammerAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[j].hitSurfaceSFX);
							WalkieTalkie.TransmitOneShotAudio(hammerAudio, StartOfRound.Instance.footstepSurfaces[j].hitSurfaceSFX, 1f);
							break;
						}
					}
				}
			}
			if (flag)
			{
				int soundID = RoundManager.PlayRandomClip(hammerAudio, hitSFX, true, 1f, 0);
				Object.FindObjectOfType<RoundManager>().PlayAudibleNoise(((Component)this).transform.position, 17f, 0.8f, 0, false, 0);
				((GrabbableObject)this).playerHeldBy.playerBodyAnimator.SetTrigger("hammerHit");
				HitHammerServerRpc(soundID);
			}
		}

		[ServerRpc]
		public void HitHammerServerRpc(int soundID)
		{
			HitHammerClientRpc(soundID);
		}

		[ClientRpc]
		public void HitHammerClientRpc(int soundID)
		{
			HitSurfaceWithHammer(soundID);
		}

		private void HitSurfaceWithHammer(int soundID)
		{
			if (!((NetworkBehaviour)this).IsOwner)
			{
				hammerAudio.PlayOneShot(hitSFX[soundID]);
			}
			WalkieTalkie.TransmitOneShotAudio(hammerAudio, hitSFX[soundID], 1f);
		}
	}
	[BepInPlugin("soupsylive.councilgear", "CouncilGear", "0.0.4")]
	public class Plugin : BaseUnityPlugin
	{
		private const string GUID = "soupsylive.councilgear";

		private const string NAME = "CouncilGear";

		private const string VERSION = "0.0.4";

		private readonly Harmony harmony = new Harmony("soupsylive.councilgear");

		public static Plugin instance;

		private void Awake()
		{
			instance = this;
			AssetBundle obj = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "councilgearmod"));
			Item item = obj.LoadAsset<Item>("Assets/Custom/Retro/Totem/RetTotemItem.asset");
			Item item2 = obj.LoadAsset<Item>("Assets/Custom/Retro/Bat/RetBatItem.asset");
			registerItem(item, 70);
			registerItem(item2, 10);
			harmony.PatchAll(typeof(NoiseMakerMatch));
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "soupsylive.councilgear");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded CouncilGear!");
		}

		public static void putShopItem(Item item)
		{
			TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>();
			val.clearPreviousText = true;
			val.displayText = "Testing your item!\n\n";
			Items.RegisterShopItem(item, (TerminalNode)null, (TerminalNode)null, val, 0);
		}

		public static void registerItem(Item item, int spawnChance)
		{
			NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab);
			Utilities.FixMixerGroups(item.spawnPrefab);
			Items.RegisterScrap(item, spawnChance, (LevelTypes)(-1));
		}

		public static void registerItem(Item item, int spawnChance, bool shopIt)
		{
			registerItem(item, spawnChance);
			if (shopIt)
			{
				putShopItem(item);
			}
		}
	}
}
namespace CouncilGear.Patches
{
	[HarmonyPatch(typeof(NoisemakerProp), "ItemActivate")]
	internal class NoiseMakerMatch
	{
		[HarmonyPrefix]
		private static bool Prefix(ref bool used, ref bool buttonDown, AudioClip[] ___noiseSFX, PlayerControllerB ___playerHeldBy, Random ___noisemakerRandom, float ___minLoudness, float ___maxLoudness, float ___minPitch, float ___maxPitch, AudioSource ___noiseAudio, AudioSource ___noiseAudioFar, AudioClip[] ___noiseSFXFar, Animator ___triggerAnimator, float ___noiseRange, bool ___isInElevator, NoisemakerProp __instance)
		{
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null))
			{
				int num = ___noisemakerRandom.Next(0, ___noiseSFX.Length);
				float num2 = (float)___noisemakerRandom.Next((int)(___minLoudness * 100f), (int)(___maxLoudness * 100f)) / 100f;
				float pitch = (___noiseAudio.pitch = (float)___noisemakerRandom.Next((int)(___minPitch * 100f), (int)(___maxPitch * 100f)) / 100f);
				___noiseAudio.PlayOneShot(___noiseSFX[num], num2);
				if ((Object)(object)___noiseAudioFar != (Object)null)
				{
					___noiseAudioFar.pitch = pitch;
					___noiseAudioFar.PlayOneShot(___noiseSFXFar[num], num2);
				}
				if ((Object)(object)___triggerAnimator != (Object)null)
				{
					___triggerAnimator.SetTrigger("playAnim");
				}
				WalkieTalkie.TransmitOneShotAudio(___noiseAudio, ___noiseSFX[num], num2);
				RoundManager.Instance.PlayAudibleNoise(((Component)___playerHeldBy).transform.position, ___noiseRange, num2, 0, ___isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
				if (___minLoudness >= 0.6f && (Object)(object)___playerHeldBy != (Object)null)
				{
					___playerHeldBy.timeSinceMakingLoudNoise = 0f;
				}
				if (___noiseSFX.Length > 20)
				{
					Debug.Log((object)("Squish! " + num2));
					if (((Object)___noiseSFX[21]).name.Contains("Munch") && num == 21)
					{
						Debug.Log((object)"GotMunch!");
						___playerHeldBy.DamagePlayer(10, true, true, (CauseOfDeath)6, 0, false, default(Vector3));
					}
				}
			}
			return false;
		}
	}
}
namespace CouncilGear.Behaviors
{
	internal class RetroTotemSquish : PhysicsProp
	{
		public AudioSource noiseAudio;

		public AudioSource noiseAudioFar;

		[Space(3f)]
		public AudioClip[] noiseSFX;

		public AudioClip[] noiseSFXFar;

		[Space(3f)]
		public float noiseRange;

		public float maxLoudness;

		public float minLoudness;

		public float minPitch;

		public float maxPitch;

		private Random noisemakerRandom;

		public Animator triggerAnimator;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			noisemakerRandom = new Random(StartOfRound.Instance.randomMapSeed + 85);
			noiseSFX = (AudioClip[])(object)new AudioClip[2];
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null))
			{
				int num = noisemakerRandom.Next(0, noiseSFX.Length);
				float num2 = (float)noisemakerRandom.Next((int)(minLoudness * 100f), (int)(maxLoudness * 100f)) / 100f;
				float pitch = (float)noisemakerRandom.Next((int)(minPitch * 100f), (int)(maxPitch * 100f)) / 100f;
				noiseAudio.pitch = pitch;
				noiseAudio.PlayOneShot(noiseSFX[num], num2);
				if ((Object)(object)noiseAudioFar != (Object)null)
				{
					noiseAudioFar.pitch = pitch;
					noiseAudioFar.PlayOneShot(noiseSFXFar[num], num2);
				}
				if ((Object)(object)triggerAnimator != (Object)null)
				{
					triggerAnimator.SetTrigger("playAnim");
				}
				WalkieTalkie.TransmitOneShotAudio(noiseAudio, noiseSFX[num], num2);
				RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, noiseRange, num2, 0, ((GrabbableObject)this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
				if (minLoudness >= 0.6f && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
				{
					((GrabbableObject)this).playerHeldBy.timeSinceMakingLoudNoise = 0f;
				}
				if (((Object)noiseSFX[num]).name.Contains("Munch") && ((NetworkBehaviour)this).IsOwner)
				{
					((GrabbableObject)this).playerHeldBy.DamagePlayer(10, true, true, (CauseOfDeath)6, 0, false, default(Vector3));
					((GrabbableObject)this).playerHeldBy.DiscardHeldObject(false, (NetworkObject)null, default(Vector3), true);
				}
			}
		}

		public void setNoise(AudioClip sqush, AudioClip munch)
		{
			noiseSFX[0] = sqush;
			noiseSFX[1] = munch;
		}
	}
}