Decompiled source of BensJunk v1.3.0

BensScripts.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using REPOLib.Modules;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Serialization;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("Bengimi")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BensScripts")]
[assembly: AssemblyTitle("BensScripts")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BensScripts
{
	public class BensBoogyBox : Trap
	{
		[CompilerGenerated]
		private sealed class <TrackChangeRoutine>d__23 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public BensBoogyBox <>4__this;

			public AudioSource src;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0083: Unknown result type (might be due to invalid IL or missing references)
				//IL_009f: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a9: Expected O, but got Unknown
				int num = <>1__state;
				BensBoogyBox bensBoogyBox = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					bensBoogyBox._isChangingTrack = true;
					if ((Object)(object)src != (Object)null && src.isPlaying)
					{
						src.Stop();
					}
					if (bensBoogyBox.soundBoomboxStop != null)
					{
						AudioClip[] sounds = bensBoogyBox.soundBoomboxStop.Sounds;
						if (sounds != null && sounds.Length != 0)
						{
							AudioClip val = bensBoogyBox.soundBoomboxStop.Sounds[0];
							AudioSource.PlayClipAtPoint(val, ((Component)bensBoogyBox).transform.position, bensBoogyBox.soundBoomboxStop.Volume);
							<>2__current = (object)new WaitForSecondsRealtime(val.length);
							<>1__state = 1;
							return true;
						}
					}
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				Sound boomboxMusicClips = bensBoogyBox.boomboxMusicClips;
				if (boomboxMusicClips != null && boomboxMusicClips.Sounds?.Length > 0 && (Object)(object)src != (Object)null)
				{
					bensBoogyBox.SelectAndPlayRandomClip(src);
				}
				UnityEvent onTrackChange = bensBoogyBox.OnTrackChange;
				if (onTrackChange != null)
				{
					onTrackChange.Invoke();
				}
				bensBoogyBox._isChangingTrack = false;
				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();
			}
		}

		[Header("Headbob Settings")]
		public float cammulti = 100f;

		public float camtime = 15f;

		public float camposweight = 10f;

		public float camstrength = 1f;

		public float holddist = 1f;

		[Header("Sounds")]
		public Sound soundBoomboxStart;

		public Sound soundBoomboxStop;

		public Sound boomboxMusicClips;

		[Space]
		public Transform speaker1;

		public Transform speaker2;

		[Space]
		public Light light1;

		public Light light2;

		[Header("Events")]
		public UnityEvent OnTrackChange;

		private AudioClip _selectedClip;

		private bool _musicSelected;

		private bool _isPlaying;

		private bool _wasGrabbed;

		private bool _isChangingTrack;

		private ValuableToggle _valToggle;

		public override void Start()
		{
			((Trap)this).Start();
			_valToggle = ((Component)this).GetComponent<ValuableToggle>();
			((Behaviour)light1).enabled = false;
			((Behaviour)light2).enabled = false;
		}

		public override void Update()
		{
			((Trap)this).Update();
			if ((Object)(object)_valToggle != (Object)null && _valToggle.toggleImpulse)
			{
				NextTrack();
			}
			bool grabbed = base.physGrabObject.grabbed;
			AudioSource src = boomboxMusicClips?.Source;
			if (grabbed && !_musicSelected)
			{
				Sound obj = boomboxMusicClips;
				if (obj != null && obj.Sounds?.Length > 0)
				{
					SelectAndPlayRandomClip(src);
				}
			}
			if (_wasGrabbed && !grabbed && _isPlaying)
			{
				StopPlayback(src);
			}
			UpdateVisuals(grabbed);
			if (grabbed)
			{
				ApplyCameraBobbing();
			}
			_wasGrabbed = grabbed;
		}

		private void SelectAndPlayRandomClip(AudioSource src)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			if (soundBoomboxStart != null)
			{
				AudioClip[] sounds = soundBoomboxStart.Sounds;
				if (sounds != null && sounds.Length != 0)
				{
					AudioSource.PlayClipAtPoint(soundBoomboxStart.Sounds[0], ((Component)this).transform.position, soundBoomboxStart.Volume);
				}
			}
			int num = Random.Range(0, boomboxMusicClips.Sounds.Length);
			_selectedClip = boomboxMusicClips.Sounds[num];
			if ((Object)(object)src != (Object)null)
			{
				src.Stop();
				src.clip = _selectedClip;
				src.loop = true;
				src.volume = boomboxMusicClips.Volume;
				src.pitch = boomboxMusicClips.Pitch;
				src.Play();
			}
			_musicSelected = true;
			_isPlaying = true;
		}

		private void StopPlayback(AudioSource src)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			if (soundBoomboxStop != null)
			{
				AudioClip[] sounds = soundBoomboxStop.Sounds;
				if (sounds != null && sounds.Length != 0)
				{
					AudioSource.PlayClipAtPoint(soundBoomboxStop.Sounds[0], ((Component)this).transform.position, soundBoomboxStop.Volume);
				}
			}
			if ((Object)(object)src != (Object)null)
			{
				src.Stop();
			}
			_isPlaying = false;
			_musicSelected = false;
			_selectedClip = null;
		}

		[IteratorStateMachine(typeof(<TrackChangeRoutine>d__23))]
		private IEnumerator TrackChangeRoutine(AudioSource src)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <TrackChangeRoutine>d__23(0)
			{
				<>4__this = this,
				src = src
			};
		}

		public void NextTrack()
		{
			if (base.physGrabObject.grabbed && !_isChangingTrack)
			{
				((MonoBehaviour)this).StartCoroutine(TrackChangeRoutine(boomboxMusicClips.Source));
			}
		}

		private void UpdateVisuals(bool isGrabbed)
		{
			//IL_0030: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: 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_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			if (isGrabbed)
			{
				base.enemyInvestigate = true;
				float num = 1f + Mathf.Sin(Time.time * 80f) * 0.005f;
				speaker1.localScale = Vector3.one * num;
				speaker2.localScale = Vector3.one * num;
				Color val = Color.Lerp(((Component)speaker1).GetComponent<Renderer>().material.GetColor("_EmissionColor"), Color.HSVToRGB(Mathf.PingPong(Time.time * 0.5f, 1f), 1f, 1f), Time.deltaTime * 6000f);
				((Component)speaker1).GetComponent<Renderer>().material.SetColor("_EmissionColor", val);
				((Component)speaker2).GetComponent<Renderer>().material.SetColor("_EmissionColor", val);
				Light obj = light1;
				bool enabled = (((Behaviour)light2).enabled = true);
				((Behaviour)obj).enabled = enabled;
				Light obj2 = light1;
				Color color = (light2.color = val);
				obj2.color = color;
				light1.intensity = Mathf.Lerp(light1.intensity, 4f, Time.deltaTime);
				light2.intensity = Mathf.Lerp(light2.intensity, 4f, Time.deltaTime);
			}
			else if (((Behaviour)light1).enabled)
			{
				FadeOutLightsAndSpeakers();
			}
		}

		private void FadeOutLightsAndSpeakers()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			Color val = Color.Lerp(((Component)speaker1).GetComponent<Renderer>().material.GetColor("_EmissionColor"), Color.black, Time.deltaTime);
			((Component)speaker1).GetComponent<Renderer>().material.SetColor("_EmissionColor", val);
			((Component)speaker2).GetComponent<Renderer>().material.SetColor("_EmissionColor", val);
			speaker1.localScale = Vector3.Lerp(speaker1.localScale, Vector3.one, Time.deltaTime);
			speaker2.localScale = Vector3.Lerp(speaker2.localScale, Vector3.one, Time.deltaTime);
			light1.intensity = Mathf.Lerp(light1.intensity, 0f, Time.deltaTime);
			light2.intensity = Mathf.Lerp(light2.intensity, 0f, Time.deltaTime);
			if (light1.intensity < 0.01f)
			{
				((Component)speaker1).GetComponent<Renderer>().material.SetColor("_EmissionColor", Color.black);
				((Component)speaker2).GetComponent<Renderer>().material.SetColor("_EmissionColor", Color.black);
				Light obj = light1;
				bool enabled = (((Behaviour)light2).enabled = false);
				((Behaviour)obj).enabled = enabled;
			}
		}

		private void ApplyCameraBobbing()
		{
			//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_004d: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Sin(Time.time * camtime) * 0.5f;
			float num2 = num * cammulti;
			CameraAim instance = CameraAim.Instance;
			if ((Object)(object)instance != (Object)null)
			{
				Quaternion val = Quaternion.Euler(num2, 0f, 0f);
				((Component)instance).transform.localRotation = ((Component)instance).transform.localRotation * val;
			}
			foreach (PhysGrabber item in base.physGrabObject.playerGrabbing)
			{
				if (item.isLocal)
				{
					item.OverrideGrabDistance(holddist);
					item.OverrideDisableRotationControls();
				}
			}
		}
	}
	public class BensExplosiveValuableTrap : Trap
	{
		[Header("Explosion Settings")]
		[Tooltip("Size multiplier for the explosion prefab")]
		public float explosionSize = 1f;

		[Tooltip("Damage dealt to players/objects")]
		public int explosionDamage = 50;

		[Tooltip("Damage dealt to enemies")]
		public int explosionDamageEnemy = 100;

		[Tooltip("How many hits before this trap explodes")]
		public int maxHitCount = 3;

		[Header("References")]
		[Tooltip("Where the explosion should originate")]
		public Transform center;

		private ParticleScriptExplosion particleScriptExplosion;

		private int hitCount;

		public override void Start()
		{
			((Trap)this).Start();
			particleScriptExplosion = ((Component)this).GetComponent<ParticleScriptExplosion>();
			if ((Object)(object)center == (Object)null)
			{
				Debug.LogWarning((object)(((Object)this).name + ": Center transform is not set!"), (Object)(object)this);
			}
		}

		public void Explode()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)particleScriptExplosion == (Object)null)
			{
				Debug.LogError((object)(((Object)this).name + ": No ParticleScriptExplosion component found!"), (Object)(object)this);
			}
			else
			{
				particleScriptExplosion.Spawn(center.position, explosionSize, explosionDamage, explosionDamageEnemy, 1f, false, false, 1f);
			}
		}

		public void PotentialExplode()
		{
			if (base.isLocal)
			{
				hitCount++;
				if (hitCount >= maxHitCount)
				{
					Explode();
					hitCount = 0;
				}
			}
		}
	}
	[BepInPlugin("Bengimi.BensScripts", "BensScripts", "1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class BensScripts : BaseUnityPlugin
	{
		internal static BensScripts Instance { get; private set; }

		internal static ManualLogSource Logger => Instance.Alogger;

		private ManualLogSource Alogger => ((BaseUnityPlugin)this).Logger;

		internal Harmony Harmony { get; set; }

		private void Awake()
		{
			Instance = this;
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Patch();
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
		}

		internal void Patch()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_0025: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
				Harmony val2 = val;
				Harmony = val;
			}
			Harmony.PatchAll();
		}

		internal void Unpatch()
		{
			Harmony harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}

		private void Update()
		{
		}
	}
	[DisallowMultipleComponent]
	public class BensWordsWordsWords : MonoBehaviour
	{
		[Header("Affection Sayings")]
		[Tooltip("List of strings. One will be spoken at random when the potion is active.")]
		public List<string> sayings = new List<string>();

		[Header("Cooldown Settings")]
		[Tooltip("Minimum time (in seconds) between spoken phrases.")]
		public float minCooldown = 5f;

		[Tooltip("Maximum time (in seconds) between spoken phrases.")]
		public float maxCooldown = 10f;

		private PhysGrabObject physGrabObject;

		private float cooldownTimer;

		private void Start()
		{
			physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
			ResetCooldown();
		}

		private void Update()
		{
			if ((Object)(object)physGrabObject != (Object)null && physGrabObject.grabbed)
			{
				cooldownTimer -= Time.deltaTime;
				if (cooldownTimer <= 0f)
				{
					SpeakRandom();
					ResetCooldown();
				}
			}
			else
			{
				ResetCooldown();
			}
		}

		private void SpeakRandom()
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			if (sayings != null && sayings.Count != 0)
			{
				string text = sayings[Random.Range(0, sayings.Count)];
				ChatManager.instance.PossessChatScheduleStart(5);
				ChatManager.instance.PossessChat((PossessChatID)1, text, 1f, new Color(1f, 0.3f, 0.6f, 1f), 0f, false, 0, (UnityEvent)null);
				ChatManager.instance.PossessChatScheduleEnd();
			}
		}

		private void ResetCooldown()
		{
			cooldownTimer = Random.Range(minCooldown, maxCooldown);
		}
	}
	public class GunValuable : MonoBehaviour
	{
		private PhysGrabObject physGrabObject;

		private ValuableToggle valuableToggle;

		public int numberOfBullets = 1;

		[Range(0f, 65f)]
		public float gunRandomSpread;

		public float gunRange = 50f;

		public float distanceKeep = 0.8f;

		public float gunRecoilForce = 1f;

		public float cameraShakeMultiplier = 1f;

		public float torqueMultiplier = 1f;

		public float grabStrengthMultiplier = 1f;

		public float shootCooldown = 1f;

		[Range(0f, 100f)]
		public float misfirePercentageChange = 50f;

		public AnimationCurve shootLineWidthCurve;

		public float grabVerticalOffset = -0.2f;

		public float aimVerticalOffset = -5f;

		public float investigateRadius = 20f;

		public Transform gunMuzzle;

		public GameObject bulletPrefab;

		public GameObject muzzleFlashPrefab;

		public Transform gunTrigger;

		public Sound soundShoot;

		public Sound soundShootGlobal;

		public Sound soundNoAmmoClick;

		public Sound soundHit;

		private float shootCooldownTimer;

		private PhotonView photonView;

		private PhysGrabObjectImpactDetector impactDetector;

		private bool prevToggleState;

		private AnimationCurve triggerAnimationCurve;

		private float triggerAnimationEval;

		private bool triggerAnimationActive;

		internal HurtCollider hurtCollider;

		private void Start()
		{
			physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
			valuableToggle = ((Component)this).GetComponent<ValuableToggle>();
			photonView = ((Component)this).GetComponent<PhotonView>();
			impactDetector = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>();
			triggerAnimationCurve = AssetManager.instance.animationCurveClickInOut;
		}

		private void Update()
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			if (physGrabObject.grabbed && physGrabObject.grabbedLocal)
			{
				PhysGrabber.instance.OverrideGrabDistance(distanceKeep);
			}
			if (triggerAnimationActive)
			{
				float num = 45f;
				triggerAnimationEval += Time.deltaTime * 4f;
				gunTrigger.localRotation = Quaternion.Euler(num * triggerAnimationCurve.Evaluate(triggerAnimationEval), 0f, 0f);
				if (triggerAnimationEval >= 1f)
				{
					gunTrigger.localRotation = Quaternion.Euler(0f, 0f, 0f);
					triggerAnimationActive = false;
					triggerAnimationEval = 1f;
				}
			}
			UpdateMaster();
		}

		private void UpdateMaster()
		{
			//IL_0028: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			if (!SemiFunc.IsMasterClientOrSingleplayer())
			{
				return;
			}
			if (physGrabObject.grabbed)
			{
				Quaternion val = Quaternion.Euler(aimVerticalOffset, 0f, 0f);
				Quaternion identity = Quaternion.identity;
				Quaternion identity2 = Quaternion.identity;
				bool flag = false;
				bool flag2 = false;
				bool flag3 = false;
				bool flag4 = true;
				foreach (PhysGrabber item in physGrabObject.playerGrabbing)
				{
					if (flag4)
					{
						if (item.playerAvatar.isCrouching)
						{
							flag2 = true;
						}
						if (item.playerAvatar.isCrawling)
						{
							flag3 = true;
						}
						flag4 = false;
					}
					if (item.isRotating)
					{
						flag = true;
					}
				}
				if (!flag)
				{
					physGrabObject.TurnXYZ(val, identity, identity2);
				}
				float num = grabVerticalOffset;
				if (flag2)
				{
					num += 0.5f;
				}
				if (flag3)
				{
					num -= 0.5f;
				}
				physGrabObject.OverrideGrabVerticalPosition(num);
				if (!flag)
				{
					physGrabObject.OverrideGrabStrength((grabStrengthMultiplier != 1f) ? grabStrengthMultiplier : 1f, 0.1f);
					physGrabObject.OverrideTorqueStrength((torqueMultiplier != 1f) ? torqueMultiplier : 1f, 0.1f);
				}
				else
				{
					physGrabObject.OverrideAngularDrag(40f, 0.1f);
					physGrabObject.OverrideTorqueStrength(6f, 0.1f);
				}
			}
			if (valuableToggle.toggleState != prevToggleState)
			{
				if (shootCooldownTimer <= 0f)
				{
					Shoot();
					shootCooldownTimer = shootCooldown;
				}
				prevToggleState = valuableToggle.toggleState;
			}
			if (shootCooldownTimer > 0f)
			{
				shootCooldownTimer -= Time.deltaTime;
			}
		}

		public void Misfire()
		{
			if (!physGrabObject.grabbed && !physGrabObject.hasNeverBeenGrabbed && SemiFunc.IsMasterClientOrSingleplayer() && shootCooldownTimer <= 0f && Random.Range(0f, 100f) < misfirePercentageChange)
			{
				Shoot();
				shootCooldownTimer = shootCooldown;
			}
		}

		public void Shoot()
		{
			bool flag = false;
			if (Random.Range(0, 10000) == 0)
			{
				flag = false;
			}
			if (!flag)
			{
				if (SemiFunc.IsMultiplayer())
				{
					photonView.RPC("ShootRPC", (RpcTarget)0, Array.Empty<object>());
				}
				else
				{
					ShootRPC();
				}
			}
		}

		private void MuzzleFlash()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			Object.Instantiate<GameObject>(muzzleFlashPrefab, gunMuzzle.position, gunMuzzle.rotation, gunMuzzle).GetComponent<ItemGunMuzzleFlash>().ActivateAllEffects();
		}

		private void StartTriggerAnimation()
		{
			triggerAnimationActive = true;
			triggerAnimationEval = 0f;
		}

		[PunRPC]
		public void ShootRPC()
		{
			//IL_0020: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: 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_01c0: 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_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: 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_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: 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_01a5: 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_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: 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_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			float num = 3f * cameraShakeMultiplier;
			float num2 = 16f * cameraShakeMultiplier;
			SemiFunc.CameraShakeImpactDistance(gunMuzzle.position, 5f * cameraShakeMultiplier, 0.1f, num, num2);
			SemiFunc.CameraShakeDistance(gunMuzzle.position, 0.1f * cameraShakeMultiplier, 0.1f * cameraShakeMultiplier, num, num2);
			soundShoot.Play(gunMuzzle.position, 1f, 1f, 1f, 1f);
			soundShootGlobal.Play(gunMuzzle.position, 1f, 1f, 1f, 1f);
			MuzzleFlash();
			StartTriggerAnimation();
			if (!SemiFunc.IsMasterClientOrSingleplayer())
			{
				return;
			}
			if (investigateRadius > 0f)
			{
				EnemyDirector.instance.SetInvestigate(((Component)this).transform.position, investigateRadius);
			}
			physGrabObject.rb.AddForceAtPosition(-gunMuzzle.forward * gunRecoilForce, gunMuzzle.position, (ForceMode)1);
			RaycastHit val3 = default(RaycastHit);
			for (int i = 0; i < numberOfBullets; i++)
			{
				Vector3 val = gunMuzzle.forward;
				if (gunRandomSpread > 0f)
				{
					float num3 = Random.Range(0f, gunRandomSpread / 2f);
					float num4 = Random.Range(0f, 360f);
					Vector3 val2 = Vector3.Cross(val, Random.onUnitSphere);
					Vector3 normalized = ((Vector3)(ref val2)).normalized;
					val2 = Quaternion.AngleAxis(num4, val) * Quaternion.AngleAxis(num3, normalized) * val;
					val = ((Vector3)(ref val2)).normalized;
				}
				bool flag = Physics.Raycast(gunMuzzle.position, val, ref val3, gunRange, LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()) + LayerMask.GetMask(new string[1] { "Enemy" }));
				Vector3 endPos = (flag ? ((RaycastHit)(ref val3)).point : (gunMuzzle.position + val * gunRange));
				ShootBullet(endPos, flag);
			}
		}

		private void ShootBullet(Vector3 endPos, bool hit)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				if (SemiFunc.IsMultiplayer())
				{
					photonView.RPC("ShootBulletRPC", (RpcTarget)0, new object[2] { endPos, hit });
				}
				else
				{
					ShootBulletRPC(endPos, hit);
				}
			}
		}

		[PunRPC]
		public void ShootBulletRPC(Vector3 endPos, bool hit)
		{
			//IL_0059: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			if (physGrabObject.playerGrabbing.Count > 1)
			{
				foreach (PhysGrabber item in physGrabObject.playerGrabbing)
				{
					item.OverrideGrabRelease();
				}
			}
			ItemGunBullet component = Object.Instantiate<GameObject>(bulletPrefab, gunMuzzle.position, gunMuzzle.rotation).GetComponent<ItemGunBullet>();
			component.hitPosition = endPos;
			component.bulletHit = hit;
			component.shootLineWidthCurve = shootLineWidthCurve;
			hurtCollider = ((Component)component).GetComponentInChildren<HurtCollider>();
			component.ActivateAll();
			soundHit.Play(endPos, 1f, 1f, 1f, 1f);
		}
	}
	public class RiotShield : MonoBehaviour
	{
		private const bool hurting = true;

		private PhysGrabObject physGrabObject;

		private ValuableToggle valuableToggle;

		public float distanceKeep = 0.8f;

		public float riotRecoilForce = 1f;

		public Transform riotSheild;

		public float cameraShakeMultiplier = 1f;

		public float torqueMultiplier = 1f;

		public float grabStrengthMultiplier = 1f;

		public float hitCooldown = 1f;

		public float grabVerticalOffset = -0.2f;

		public float aimVerticalOffset = -10f;

		public float investigateRadius = 20f;

		public Sound soundHit;

		public HurtCollider hurtCollider;

		private float hitCooldownTimer;

		private PhotonView photonView;

		private PhysGrabObjectImpactDetector impactDetector;

		private bool prevToggleState;

		private void Start()
		{
			physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
			valuableToggle = ((Component)this).GetComponent<ValuableToggle>();
			photonView = ((Component)this).GetComponent<PhotonView>();
			impactDetector = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>();
		}

		private void Update()
		{
			if (physGrabObject.grabbed && physGrabObject.grabbedLocal)
			{
				PhysGrabber.instance.OverrideGrabDistance(distanceKeep);
			}
			UpdateMaster();
		}

		private void UpdateMaster()
		{
			//IL_0028: 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_003d: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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)
			if (!SemiFunc.IsMasterClientOrSingleplayer())
			{
				return;
			}
			if (physGrabObject.grabbed)
			{
				Quaternion val = Quaternion.Euler(aimVerticalOffset, 0f, 0f);
				Quaternion val2 = Quaternion.Euler(0f, 0f, 0f);
				Quaternion identity = Quaternion.identity;
				bool flag = false;
				bool flag2 = false;
				bool flag3 = true;
				foreach (PhysGrabber item in physGrabObject.playerGrabbing)
				{
					if (flag3)
					{
						if (item.playerAvatar.isCrouching || item.playerAvatar.isCrawling)
						{
							flag2 = true;
						}
						flag3 = false;
					}
					if (item.isRotating)
					{
						flag = true;
					}
				}
				if (!flag)
				{
					physGrabObject.TurnXYZ(val, val2, identity);
				}
				float num = grabVerticalOffset;
				if (flag2)
				{
					num += 0.5f;
				}
				physGrabObject.OverrideGrabVerticalPosition(num);
				if (!flag)
				{
					if (grabStrengthMultiplier != 1f)
					{
						physGrabObject.OverrideGrabStrength(grabStrengthMultiplier, 0.1f);
					}
					if (torqueMultiplier != 1f)
					{
						physGrabObject.OverrideTorqueStrength(torqueMultiplier, 0.1f);
					}
				}
				if (flag)
				{
					physGrabObject.OverrideAngularDrag(40f, 0.1f);
					physGrabObject.OverrideTorqueStrength(6f, 0.1f);
				}
			}
			if (valuableToggle.toggleState != prevToggleState)
			{
				if (hitCooldownTimer <= 0f)
				{
					((Component)hurtCollider).gameObject.SetActive(true);
					Shoot();
				}
				prevToggleState = valuableToggle.toggleState;
			}
			if (hitCooldownTimer > 0f)
			{
				hitCooldownTimer -= Time.deltaTime;
				if (((Component)hurtCollider).gameObject.activeSelf)
				{
					((Component)hurtCollider).gameObject.SetActive(false);
				}
			}
		}

		public void Shoot()
		{
			bool flag = false;
			if (Random.Range(0, 10000) == 0)
			{
				flag = false;
			}
			if (!flag)
			{
				if (SemiFunc.IsMultiplayer())
				{
					photonView.RPC("HitRPC", (RpcTarget)0, Array.Empty<object>());
				}
				else
				{
					HitRPC();
				}
			}
		}

		[PunRPC]
		public void HitRPC()
		{
			//IL_0020: 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_00a8: 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)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: 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)
			float num = 3f * cameraShakeMultiplier;
			float num2 = 16f * cameraShakeMultiplier;
			SemiFunc.CameraShakeImpactDistance(riotSheild.position, 5f * cameraShakeMultiplier, 0.1f, num, num2);
			SemiFunc.CameraShakeDistance(riotSheild.position, 0.1f * cameraShakeMultiplier, 0.1f * cameraShakeMultiplier, num, num2);
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				if (investigateRadius > 0f)
				{
					EnemyDirector.instance.SetInvestigate(((Component)this).transform.position, investigateRadius);
				}
				physGrabObject.rb.AddForceAtPosition(-riotSheild.forward * (0f - riotRecoilForce), riotSheild.position, (ForceMode)1);
				hitCooldownTimer = hitCooldown;
			}
		}
	}
	public class Sleepyfox : MonoBehaviour
	{
		public enum States
		{
			Idle,
			Active
		}

		private PhysGrabObject physGrabObject;

		private PhotonView photonView;

		internal States currentState;

		private bool stateStart;

		public Transform particleSystemTransform;

		public ParticleSystem particleSystemSwirl;

		public ParticleSystem particleSystemGlitter;

		public MeshRenderer timeGlassMaterial;

		[FormerlySerializedAs("light")]
		public Light timeGlassLight;

		public Sound soundTimeGlassLoop;

		[Header("pitch of voice")]
		public float overridePitch = 1.45f;

		[Header("player speed")]
		public float overrideSpeed = 0.5f;

		[Header("player look speed")]
		public float overrideLookSpeed = 0.5f;

		[Header("player animation speed")]
		public float overrideAnimationSpeed = 0.2f;

		[Header("player timescale?")]
		public float overrideTimeScale = 0.1f;

		private float soundPitchLerp;

		private int particleFocus;

		private void StateActive()
		{
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			if (stateStart)
			{
				particleSystemGlitter.Play();
				particleSystemSwirl.Play();
				stateStart = false;
				((Component)timeGlassLight).gameObject.SetActive(true);
			}
			if (!((Component)timeGlassLight).gameObject.activeSelf)
			{
				((Component)timeGlassLight).gameObject.SetActive(true);
			}
			if (((Component)particleSystemTransform).gameObject.activeSelf)
			{
				List<PhysGrabber> playerGrabbing = physGrabObject.playerGrabbing;
				if (playerGrabbing.Count > particleFocus)
				{
					PhysGrabber val = playerGrabbing[particleFocus];
					if (Object.op_Implicit((Object)(object)val))
					{
						Transform headLookAtTransform = val.playerAvatar.playerAvatarVisuals.headLookAtTransform;
						if (Object.op_Implicit((Object)(object)headLookAtTransform))
						{
							particleSystemTransform.LookAt(headLookAtTransform);
						}
						particleFocus++;
					}
					else
					{
						particleFocus = 0;
					}
				}
				else
				{
					particleFocus = 0;
				}
			}
			soundPitchLerp = Mathf.Lerp(soundPitchLerp, 1f, Time.deltaTime * 2f);
			timeGlassLight.intensity = Mathf.Lerp(timeGlassLight.intensity, 4f, Time.deltaTime * 2f);
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0.5f, 0f, 1f);
			((Renderer)timeGlassMaterial).material.SetColor("_EmissionColor", val2 * timeGlassLight.intensity);
			foreach (PhysGrabber item in physGrabObject.playerGrabbing)
			{
				if (Object.op_Implicit((Object)(object)item) && !item.isLocal)
				{
					item.playerAvatar.voiceChat.OverridePitch(overridePitch, 1f, 2f, 0.1f, true);
				}
			}
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				physGrabObject.OverrideDrag(20f, 0.1f);
				physGrabObject.OverrideAngularDrag(40f, 0.1f);
				if (!physGrabObject.grabbed)
				{
					SetState(States.Idle);
				}
			}
			if (physGrabObject.grabbedLocal)
			{
				PlayerAvatar instance = PlayerAvatar.instance;
				if (Object.op_Implicit((Object)(object)instance.voiceChat))
				{
					instance.voiceChat.OverridePitch(overridePitch, 1f, 2f, 0.1f, true);
				}
				instance.OverridePupilSize(3f, 4, 1f, 1f, 5f, 0.5f, 0.1f);
				PlayerController.instance.OverrideSpeed(overrideSpeed, 0.1f);
				PlayerController.instance.OverrideLookSpeed(overrideLookSpeed, 2f, 1f, 0.1f);
				PlayerController.instance.OverrideAnimationSpeed(overrideAnimationSpeed, 1f, 2f, 0.1f);
				PlayerController.instance.OverrideTimeScale(overrideTimeScale, 0.1f);
				physGrabObject.OverrideTorqueStrength(0.6f, 0.1f);
				CameraZoom.Instance.OverrideZoomSet(50f, 0.1f, 0.5f, 1f, ((Component)this).gameObject, 0);
				PostProcessing.Instance.SaturationOverride(50f, 0.1f, 0.5f, 0.1f, ((Component)this).gameObject);
			}
		}

		private void StateIdle()
		{
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			if (stateStart)
			{
				particleSystemGlitter.Stop();
				particleSystemSwirl.Stop();
				stateStart = false;
			}
			if (SemiFunc.IsMasterClientOrSingleplayer() && physGrabObject.grabbed)
			{
				SetState(States.Active);
			}
			timeGlassLight.intensity = Mathf.Lerp(timeGlassLight.intensity, 0f, Time.deltaTime * 10f);
			soundPitchLerp = Mathf.Lerp(soundPitchLerp, 0f, Time.deltaTime * 10f);
			Color val = default(Color);
			((Color)(ref val))..ctor(0.5f, 0f, 1f);
			((Renderer)timeGlassMaterial).material.SetColor("_EmissionColor", val * timeGlassLight.intensity);
			if (timeGlassLight.intensity < 0.01f)
			{
				((Component)timeGlassLight).gameObject.SetActive(false);
			}
		}

		[PunRPC]
		public void SetStateRPC(States state)
		{
			currentState = state;
			stateStart = true;
		}

		private void SetState(States state)
		{
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				if (!SemiFunc.IsMultiplayer())
				{
					SetStateRPC(state);
					return;
				}
				photonView.RPC("SetStateRPC", (RpcTarget)0, new object[1] { state });
			}
		}

		private void Start()
		{
			physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
			photonView = ((Component)this).GetComponent<PhotonView>();
		}

		private void Update()
		{
			float num = Mathf.Lerp(2f, 0.5f, soundPitchLerp);
			soundTimeGlassLoop.PlayLoop(currentState == States.Active, 0.8f, 0.8f, num);
			switch (currentState)
			{
			case States.Active:
				StateActive();
				break;
			case States.Idle:
				StateIdle();
				break;
			}
		}
	}
	[DisallowMultipleComponent]
	public class SlotMachine : MonoBehaviourPun
	{
		[Header("Grab Area Component")]
		public PhysGrabObjectGrabArea grabAreaComponent;

		[Header("Animator & Parameters")]
		public Animator animator;

		public string spinTriggerName = "Spin";

		public string outcomeParamName = "Outcome";

		[Header("Outcome Settings")]
		[Tooltip("Number of distinct outcomes (0 ... outcomeCount-1)")]
		public int outcomeCount = 3;

		[Header("Events")]
		public UnityEvent onSpinStart;

		public UnityEvent onSpinComplete;

		private bool isSpinning;

		private void Start()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			GrabArea val = grabAreaComponent.grabAreas[0];
			val.grabAreaEventOnStart.AddListener(new UnityAction(OnGrabStart));
			val.grabAreaEventOnRelease.AddListener(new UnityAction(OnGrabRelease));
		}

		private void OnGrabStart()
		{
			if (!isSpinning)
			{
				isSpinning = true;
				UnityEvent obj = onSpinStart;
				if (obj != null)
				{
					obj.Invoke();
				}
				int num = Random.Range(0, outcomeCount);
				((MonoBehaviourPun)this).photonView.RPC("RPC_DoSpin", (RpcTarget)3, new object[1] { num });
			}
		}

		[PunRPC]
		private void RPC_DoSpin(int result)
		{
			animator.SetInteger(outcomeParamName, result);
			animator.SetTrigger(spinTriggerName);
		}

		public void OnAnimationComplete()
		{
			isSpinning = false;
			UnityEvent obj = onSpinComplete;
			if (obj != null)
			{
				obj.Invoke();
			}
		}

		private void OnGrabRelease()
		{
		}
	}
	[DisallowMultipleComponent]
	public class MaterialRandomizer : MonoBehaviourPun
	{
		[Header("Renderers to affect (leave empty ⇒ auto-find all)")]
		public Renderer[] targetRenderers;

		[Header("Materials to choose from")]
		public Material[] possibleMaterials;

		[Header("Impact detector (for particle gradient)")]
		public PhysGrabObjectImpactDetector impactDetector;

		[Tooltip("Replace only this material index (0 = first). Use –1 ⇒ replace *all* slots.")]
		public int materialSlot = -1;

		[Header("Sampling Options")]
		[Tooltip("If true, ignore texture sampling and always use a random tint color.")]
		public bool overrideAlbedo;

		private ValuableObject valuableObject;

		private PhotonView pv;

		private int _chosenIndex = -1;

		private void Awake()
		{
			pv = ((Component)this).GetComponent<PhotonView>();
			valuableObject = ((Component)this).GetComponent<ValuableObject>();
			if (pv.IsMine)
			{
				int num = Random.Range(0, possibleMaterials.Length);
				pv.RPC("RPC_SetMaterialIndex", (RpcTarget)3, new object[1] { num });
				Debug.Log((object)$"[MaterialRandomizer] (Local) picked index {num}");
			}
		}

		[PunRPC]
		private void RPC_SetMaterialIndex(int idx)
		{
			_chosenIndex = Mathf.Clamp(idx, 0, possibleMaterials.Length - 1);
			Debug.Log((object)$"[MaterialRandomizer] RPC received index {_chosenIndex}");
			ApplyMaterialAndGradient(_chosenIndex);
		}

		private void ApplyMaterialAndGradient(int idx)
		{
			//IL_0059: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: 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)
			if (possibleMaterials == null || possibleMaterials.Length == 0)
			{
				return;
			}
			Material val = possibleMaterials[idx];
			Renderer[] array = ((targetRenderers != null && targetRenderers.Length != 0) ? targetRenderers : ((Component)this).GetComponentsInChildren<Renderer>());
			Color val2 = (Color)(overrideAlbedo ? new Color(Random.value, Random.value, Random.value) : Color.white);
			Renderer[] array2 = array;
			foreach (Renderer val3 in array2)
			{
				Material val4 = new Material(val);
				if (overrideAlbedo)
				{
					if (val4.HasProperty("_BaseColor"))
					{
						val4.SetColor("_BaseColor", val2);
					}
					else if (val4.HasProperty("_Color"))
					{
						val4.SetColor("_Color", val2);
					}
				}
				if (materialSlot >= 0 && materialSlot < val3.materials.Length)
				{
					Material[] materials = val3.materials;
					materials[materialSlot] = val4;
					val3.materials = materials;
				}
				else
				{
					val3.material = val4;
				}
			}
			if ((Object)(object)valuableObject != (Object)null)
			{
				Color baseColor = (overrideAlbedo ? val2 : SampleAlbedo(val));
				Gradient val5 = BuildGradient(baseColor);
				valuableObject.particleColors = val5;
				Debug.Log((object)("[MaterialRandomizer] Applied gradient to particles on " + ((Object)valuableObject).name));
				ParticleSystem component = ((Component)valuableObject).GetComponent<ParticleSystem>();
				if ((Object)(object)component != (Object)null)
				{
					ColorOverLifetimeModule colorOverLifetime = component.colorOverLifetime;
					((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
					((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val5);
				}
			}
			else
			{
				Debug.LogWarning((object)"[MaterialRandomizer] ValuableObject component not found!");
			}
		}

		private Color SampleAlbedo(Material mat)
		{
			//IL_0017: 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_0062: 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)
			if (overrideAlbedo)
			{
				return new Color(Random.value, Random.value, Random.value);
			}
			Texture mainTexture = mat.mainTexture;
			Texture2D val = (Texture2D)(object)((mainTexture is Texture2D) ? mainTexture : null);
			if (val != null && ((Texture)val).isReadable)
			{
				int num = ((Texture)val).width / 2;
				int num2 = ((Texture)val).height / 2;
				return val.GetPixel(num, num2);
			}
			if (mat.HasProperty("_Color"))
			{
				return mat.GetColor("_Color");
			}
			return Color.white;
		}

		private Gradient BuildGradient(Color baseColor)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			Gradient val = new Gradient();
			val.colorKeys = (GradientColorKey[])(object)new GradientColorKey[2]
			{
				new GradientColorKey(baseColor * 0.8f, 0f),
				new GradientColorKey(baseColor * 1.2f, 1f)
			};
			val.alphaKeys = (GradientAlphaKey[])(object)new GradientAlphaKey[2]
			{
				new GradientAlphaKey(1f, 0f),
				new GradientAlphaKey(0.5f, 1f)
			};
			return val;
		}
	}
	public class ValuableMelee : MonoBehaviour, IPunObservable
	{
		public float hitFreeze = 0.2f;

		public float hitFreezeDelay;

		public float swingDetectSpeedMultiplier = 1f;

		public bool turnWeapon = true;

		public float torqueStrength = 1f;

		public float turnWeaponStrength = 40f;

		public Quaternion customRotation = Quaternion.identity;

		public UnityEvent onHit;

		private Transform hurtCollider;

		private Transform hurtColliderRotation;

		private PhysGrabObjectImpactDetector physGrabObjectImpactDetector;

		private PhysGrabObject physGrabObject;

		private Rigidbody rb;

		private float swingTimer = 0.1f;

		private float hitBoxTimer = 0.1f;

		private TrailRenderer trailRenderer;

		public Sound soundSwingLoop;

		public Sound soundSwing;

		public Sound soundHit;

		private Vector3 prevPosition;

		private float prevPosDistance;

		private float prevPosUpdateTimer;

		private Transform swingPoint;

		private Quaternion swingDirection;

		private PlayerAvatar playerAvatar;

		private float hitSoundDelayTimer;

		private ParticleSystem particleSystem;

		private ParticleSystem particleSystemGroundHit;

		private PhotonView photonView;

		private float swingPitch = 1f;

		private float swingPitchTarget;

		private float swingPitchTargetProgress;

		private float distanceCheckTimer;

		private Vector3 swingStartDirection = Vector3.zero;

		private Transform forceGrabPoint;

		private Quaternion targetYRotation;

		private Quaternion currentYRotation;

		private Transform meshHealthy;

		private Transform meshBroken;

		private bool isSwinging;

		private bool newSwing;

		private float hitTimer;

		private float hitCooldown;

		private float groundHitCooldown;

		private float groundHitSoundTimer;

		private float spawnTimer = 3f;

		private float grabbedTimer;

		private void Start()
		{
			rb = ((Component)this).GetComponent<Rigidbody>();
			HurtCollider componentInChildren = ((Component)this).GetComponentInChildren<HurtCollider>();
			hurtCollider = ((componentInChildren != null) ? ((Component)componentInChildren).transform : null);
			hurtColliderRotation = ((Component)this).transform.Find("Hurt Collider Rotation") ?? ((Component)this).transform.Find("Object/Hurt Collider Rotation");
			physGrabObjectImpactDetector = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>();
			if (Object.op_Implicit((Object)(object)hurtCollider))
			{
				((Component)hurtCollider).gameObject.SetActive(false);
			}
			trailRenderer = ((Component)this).GetComponentInChildren<TrailRenderer>();
			swingPoint = ((Component)this).transform.Find("Swing Point") ?? ((Component)this).transform.Find("Object/Swing Point");
			physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
			Transform obj = ((Component)this).transform.Find("Particles");
			object obj2 = ((obj != null) ? ((Component)obj).GetComponent<ParticleSystem>() : null);
			if (obj2 == null)
			{
				Transform obj3 = ((Component)this).transform.Find("Object/Particles");
				obj2 = ((obj3 != null) ? ((Component)obj3).GetComponent<ParticleSystem>() : null);
			}
			particleSystem = (ParticleSystem)obj2;
			Transform obj4 = ((Component)this).transform.Find("Particles Ground Hit");
			object obj5 = ((obj4 != null) ? ((Component)obj4).GetComponent<ParticleSystem>() : null);
			if (obj5 == null)
			{
				Transform obj6 = ((Component)this).transform.Find("Object/Particles Ground Hit");
				obj5 = ((obj6 != null) ? ((Component)obj6).GetComponent<ParticleSystem>() : null);
			}
			particleSystemGroundHit = (ParticleSystem)obj5;
			photonView = ((Component)this).GetComponent<PhotonView>();
			forceGrabPoint = ((Component)this).transform.Find("Force Grab Point") ?? ((Component)this).transform.Find("Object/Force Grab Point");
			if ((Object)(object)physGrabObject != (Object)null && (Object)(object)forceGrabPoint != (Object)null)
			{
				physGrabObject.isMelee = true;
				physGrabObject.forceGrabPoint = forceGrabPoint;
			}
			if (SemiFunc.RunIsArena())
			{
				HurtCollider component = ((Component)hurtCollider).GetComponent<HurtCollider>();
				component.playerDamage = component.enemyDamage;
			}
		}

		private void FixedUpdate()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: 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_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: 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_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			foreach (PhysGrabber item in physGrabObject.playerGrabbing)
			{
				if (item.isRotating)
				{
					flag = true;
				}
			}
			if (!flag)
			{
				Quaternion val = currentYRotation;
				Quaternion val2 = Quaternion.Euler(45f, 0f, 0f);
				physGrabObject.TurnXYZ(val2, val, Quaternion.identity);
			}
			if (prevPosUpdateTimer > 0.1f)
			{
				prevPosition = swingPoint.position;
				prevPosUpdateTimer = 0f;
			}
			else
			{
				prevPosUpdateTimer += Time.fixedDeltaTime;
			}
			if (!SemiFunc.IsMasterClientOrSingleplayer())
			{
				return;
			}
			if (!flag)
			{
				if (torqueStrength != 1f)
				{
					physGrabObject.OverrideTorqueStrength(torqueStrength, 0.1f);
				}
				if (physGrabObject.grabbed)
				{
					physGrabObject.OverrideMaterial(SemiFunc.PhysicMaterialSlippery(), 0.1f);
				}
			}
			if (flag)
			{
				physGrabObject.OverrideTorqueStrength(4f, 0.1f);
			}
			if (distanceCheckTimer > 0.1f)
			{
				prevPosDistance = Vector3.Distance(prevPosition, swingPoint.position) * 10f * rb.mass;
				distanceCheckTimer = 0f;
			}
			distanceCheckTimer += Time.fixedDeltaTime;
			TurnWeapon();
			Vector3 val3 = prevPosition - swingPoint.position;
			float num = 1f;
			if (!physGrabObject.grabbed)
			{
				num = 0.5f;
			}
			if (((Vector3)(ref val3)).magnitude > num * swingDetectSpeedMultiplier && swingPoint.position - prevPosition != Vector3.zero)
			{
				swingTimer = 0.2f;
				if (!isSwinging)
				{
					newSwing = true;
				}
				swingDirection = Quaternion.LookRotation(swingPoint.position - prevPosition);
			}
		}

		private void TurnWeapon()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: 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_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: 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_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: 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_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: 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_01af: 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_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: 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_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: 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_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			if (!SemiFunc.IsMasterClientOrSingleplayer())
			{
				return;
			}
			if (customRotation != Quaternion.identity && !turnWeapon)
			{
				Quaternion val = Quaternion.Euler(45f, 0f, 0f);
				physGrabObject.TurnXYZ(val, customRotation, Quaternion.identity);
			}
			if (turnWeaponStrength != 1f)
			{
				physGrabObject.OverrideTorqueStrengthY(turnWeaponStrength, 0.1f);
			}
			if (!turnWeapon)
			{
				return;
			}
			physGrabObject.OverrideAngularDrag(0f, 0.1f);
			physGrabObject.OverrideDrag(0f, 0.1f);
			if (physGrabObject.grabbed && !Object.op_Implicit((Object)(object)playerAvatar))
			{
				playerAvatar = ((Component)physGrabObject.playerGrabbing[0]).GetComponent<PlayerAvatar>();
			}
			if (!physGrabObject.grabbed && Object.op_Implicit((Object)(object)playerAvatar))
			{
				playerAvatar = null;
			}
			if (!physGrabObject.grabbed)
			{
				return;
			}
			_ = Vector3.forward;
			_ = Vector3.up;
			_ = ((Component)playerAvatar).transform;
			Vector3 val2 = rb.velocity / Time.fixedDeltaTime;
			if (((Vector3)(ref val2)).magnitude > 200f)
			{
				Vector3 val3 = ((Component)playerAvatar).transform.InverseTransformDirection(val2);
				Vector3 val4 = default(Vector3);
				((Vector3)(ref val4))..ctor(val3.x, 0f, val3.z);
				Quaternion val5 = Quaternion.identity;
				if (val4 != Vector3.zero)
				{
					val5 = Quaternion.LookRotation(val4);
				}
				Quaternion val6 = Quaternion.Euler(0f, ((Quaternion)(ref val5)).eulerAngles.y + 90f, 0f);
				Quaternion val7 = Quaternion.Euler(0f, Mathf.Round(((Quaternion)(ref val6)).eulerAngles.y / 90f) * 90f, 0f);
				if (((Quaternion)(ref val7)).eulerAngles.y == 270f)
				{
					val7 = Quaternion.Euler(0f, 90f, 0f);
				}
				if (((Quaternion)(ref val7)).eulerAngles.y == 180f)
				{
					val7 = Quaternion.Euler(0f, 0f, 0f);
				}
				targetYRotation = val7;
			}
			currentYRotation = Quaternion.Slerp(currentYRotation, targetYRotation, Time.deltaTime * 5f);
		}

		private void Update()
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: 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)
			//IL_028f: 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_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			if (grabbedTimer > 0f)
			{
				grabbedTimer -= Time.deltaTime;
			}
			if (physGrabObject.grabbed)
			{
				grabbedTimer = 1f;
			}
			if (hitFreezeDelay > 0f)
			{
				hitFreezeDelay -= Time.deltaTime;
				if (hitFreezeDelay <= 0f)
				{
					physGrabObject.FreezeForces(hitFreeze, Vector3.zero, Vector3.zero);
				}
			}
			if (!LevelGenerator.Instance.Generated)
			{
				return;
			}
			if (spawnTimer > 0f)
			{
				prevPosition = swingPoint.position;
				swingTimer = 0f;
				spawnTimer -= Time.deltaTime;
				return;
			}
			if (hitCooldown > 0f)
			{
				hitCooldown -= Time.deltaTime;
			}
			if (groundHitCooldown > 0f)
			{
				groundHitCooldown -= Time.deltaTime;
			}
			if (groundHitSoundTimer > 0f)
			{
				groundHitSoundTimer -= Time.deltaTime;
			}
			soundSwingLoop.PlayLoop(((Component)hurtCollider).gameObject.activeSelf, 10f, 10f, 3f);
			if (SemiFunc.IsMultiplayer() && !SemiFunc.IsMasterClient() && isSwinging)
			{
				swingTimer = 0.5f;
			}
			if (hitSoundDelayTimer > 0f)
			{
				hitSoundDelayTimer -= Time.deltaTime;
			}
			if (swingPitch != swingPitchTarget && swingPitchTargetProgress >= 1f)
			{
				swingPitch = swingPitchTarget;
			}
			Vector3 val = prevPosition - swingPoint.position;
			if (((Vector3)(ref val)).magnitude > 0.1f)
			{
				hurtColliderRotation.LookAt(hurtColliderRotation.position - val, Vector3.up);
				hurtColliderRotation.localEulerAngles = new Vector3(0f, hurtColliderRotation.localEulerAngles.y, 0f);
				hurtColliderRotation.localEulerAngles = new Vector3(0f, Mathf.Round(hurtColliderRotation.localEulerAngles.y / 90f) * 90f, 0f);
			}
			Vector3 val2 = prevPosition - swingPoint.position;
			Vector3 normalized = ((Vector3)(ref swingStartDirection)).normalized;
			Vector3 normalized2 = ((Vector3)(ref val2)).normalized;
			float num = Vector3.Dot(normalized, normalized2);
			double num2 = 0.85;
			if (!physGrabObject.grabbed)
			{
				num2 = 0.1;
			}
			if ((double)num > num2)
			{
				swingTimer = 0f;
			}
			if (isSwinging)
			{
				ActivateHitbox();
			}
			if (hitTimer > 0f)
			{
				hitTimer -= Time.deltaTime;
			}
			if (swingTimer <= 0f)
			{
				if (hitBoxTimer <= 0f)
				{
					((Component)hurtCollider).gameObject.SetActive(false);
				}
				else
				{
					hitBoxTimer -= Time.deltaTime;
				}
				trailRenderer.emitting = false;
				if (SemiFunc.IsMasterClientOrSingleplayer())
				{
					isSwinging = false;
				}
			}
			else
			{
				if (SemiFunc.IsMasterClientOrSingleplayer())
				{
					isSwinging = true;
				}
				if (hitTimer <= 0f)
				{
					hitBoxTimer = 0.2f;
				}
				swingTimer -= Time.deltaTime;
			}
		}

		public void SwingHit()
		{
			if (!SemiFunc.IsMultiplayer())
			{
				SwingHitRPC(durabilityLoss: true);
				return;
			}
			photonView.RPC("SwingHitRPC", (RpcTarget)0, new object[1] { true });
		}

		[PunRPC]
		public void SwingHitRPC(bool durabilityLoss)
		{
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			if (durabilityLoss)
			{
				if (hitCooldown > 0f || hitSoundDelayTimer > 0f)
				{
					return;
				}
				hitSoundDelayTimer = 0.1f;
				hitCooldown = 0.3f;
			}
			else
			{
				if (groundHitCooldown > 0f || groundHitSoundTimer > 0f)
				{
					return;
				}
				groundHitCooldown = 0.3f;
				groundHitSoundTimer = 0.1f;
				flag = true;
			}
			if (!flag)
			{
				soundHit.Pitch = 1f;
				soundHit.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
				particleSystem.Play();
			}
			else
			{
				soundHit.Pitch = 2f;
				soundHit.Play(((Component)this).transform.position, 0.5f, 1f, 1f, 1f);
				particleSystemGroundHit.Play();
			}
			if (physGrabObject.grabbed && !rb.isKinematic)
			{
				rb.velocity = Vector3.zero;
				rb.angularVelocity = Vector3.zero;
			}
			if (hitBoxTimer > 0.05f)
			{
				hitBoxTimer = 0.05f;
			}
			hitTimer = 0.5f;
			if (SemiFunc.IsMasterClientOrSingleplayer() && hitFreeze > 0f && !flag)
			{
				hitFreezeDelay = 0.06f;
			}
			if (onHit != null)
			{
				onHit.Invoke();
			}
			GameDirector.instance.CameraImpact.ShakeDistance(5f, 3f, 10f, ((Component)this).transform.position, 0.1f);
		}

		public void GroundHit()
		{
			if (!(hitTimer > 0f) && !(hitBoxTimer <= 0f))
			{
				if (!SemiFunc.IsMultiplayer())
				{
					SwingHitRPC(durabilityLoss: false);
					return;
				}
				photonView.RPC("SwingHitRPC", (RpcTarget)0, new object[1] { false });
			}
		}

		private void MeleeBreak()
		{
			if (!SemiFunc.IsMultiplayer())
			{
				MeleeBreakRPC();
			}
			else if (SemiFunc.IsMasterClient())
			{
				photonView.RPC("MeleeBreakRPC", (RpcTarget)0, Array.Empty<object>());
			}
		}

		[PunRPC]
		public void MeleeBreakRPC()
		{
			if (physGrabObject.isMelee)
			{
				particleSystem.Play();
				physGrabObject.isMelee = false;
				physGrabObject.forceGrabPoint = null;
				((Component)hurtCollider).gameObject.SetActive(false);
				trailRenderer.emitting = false;
				((Component)meshHealthy).gameObject.SetActive(false);
				((Component)meshBroken).gameObject.SetActive(true);
			}
		}

		private void MeleeFix()
		{
			if (!SemiFunc.IsMultiplayer())
			{
				MeleeFixRPC();
			}
			else if (SemiFunc.IsMasterClient())
			{
				photonView.RPC("MeleeFixRPC", (RpcTarget)0, Array.Empty<object>());
			}
		}

		[PunRPC]
		public void MeleeFixRPC()
		{
			if (!physGrabObject.isMelee)
			{
				particleSystem.Play();
				physGrabObject.isMelee = true;
				physGrabObject.forceGrabPoint = forceGrabPoint;
				((Component)meshHealthy).gameObject.SetActive(true);
				((Component)meshBroken).gameObject.SetActive(false);
			}
		}

		public void ActivateHitbox()
		{
			//IL_0025: 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)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			if (hitTimer > 0f)
			{
				return;
			}
			if (newSwing)
			{
				soundSwing.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
				swingPitchTarget = prevPosDistance;
				swingPitchTargetProgress = 0f;
				if (Object.op_Implicit((Object)(object)swingPoint))
				{
					swingStartDirection = swingPoint.position - prevPosition;
				}
				swingTimer = 0.4f;
				hitBoxTimer = 0.4f;
				if (grabbedTimer > 0f)
				{
					float num = 150f;
					if (!physGrabObject.grabbed)
					{
						num *= 0.5f;
					}
					rb.AddForceAtPosition(swingDirection * Vector3.forward * num * rb.mass, swingPoint.position);
				}
				newSwing = false;
			}
			if (Object.op_Implicit((Object)(object)hurtCollider))
			{
				((Component)hurtCollider).gameObject.SetActive(true);
			}
			if (Object.op_Implicit((Object)(object)trailRenderer))
			{
				trailRenderer.emitting = true;
			}
		}

		public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
		{
			if (PhotonNetwork.IsMasterClient)
			{
				stream.SendNext((object)isSwinging);
				return;
			}
			bool flag = isSwinging;
			isSwinging = (bool)stream.ReceiveNext();
			if (!flag && isSwinging)
			{
				newSwing = true;
				ActivateHitbox();
			}
		}
	}
	public class ValuableRubberDuck : MonoBehaviour
	{
		public Sound soundQuack;

		public Sound soundSqueak;

		public Sound soundDuckLoop;

		public Sound soundDuckExplosion;

		public Sound soundDuckExplosionGlobal;

		[Header("PhysOptions")]
		public float DuckForceMulti = 2f;

		public float DuckTorqueMulti = 10f;

		private bool hasQuackedOnDiscover;

		private Rigidbody rb;

		private PhotonView photonView;

		private ParticleScriptExplosion particleScriptExplosion;

		private PhysGrabObject physGrabObject;

		private ValuableObject valuableObject;

		public HurtCollider hurtCollider;

		public Transform hurtTransform;

		private float hurtColliderTime;

		private Vector3 prevPosition;

		private bool playDuckLoop;

		private List<TrailRenderer> trails = new List<TrailRenderer>();

		private float trailTimer;

		private float lilQuacksTimer;

		private PhysGrabObjectImpactDetector impactDetector;

		private void Start()
		{
			rb = ((Component)this).GetComponent<Rigidbody>();
			particleScriptExplosion = ((Component)this).GetComponent<ParticleScriptExplosion>();
			physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
			valuableObject = ((Component)this).GetComponent<ValuableObject>();
			hurtCollider = ((Component)this).GetComponentInChildren<HurtCollider>();
			((Component)hurtCollider).gameObject.SetActive(false);
			photonView = ((Component)this).GetComponent<PhotonView>();
			impactDetector = ((Component)this).GetComponentInParent<PhysGrabObjectImpactDetector>();
			TrailRenderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<TrailRenderer>();
			TrailRenderer[] array = componentsInChildren;
			foreach (TrailRenderer item in array)
			{
				trails.Add(item);
			}
		}

		private void Update()
		{
			//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 ((Object)(object)valuableObject != (Object)null && valuableObject.discovered && !hasQuackedOnDiscover)
			{
				hasQuackedOnDiscover = true;
				LilQuackJump();
			}
			if (!SemiFunc.IsMasterClientOrSingleplayer() || (!SemiFunc.RunIsLevel() && !SemiFunc.RunIsArena()) || !valuableObject.discovered)
			{
				return;
			}
			Vector3 velocity = rb.velocity;
			if (((Vector3)(ref velocity)).magnitude < 0.1f)
			{
				if (lilQuacksTimer > 0f)
				{
					lilQuacksTimer -= Time.deltaTime;
					return;
				}
				lilQuacksTimer = Random.Range(1f, 3f);
				LilQuackJump();
			}
		}

		private void FixedUpdate()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = (rb.position - prevPosition) / Time.fixedDeltaTime;
			Vector3 val2 = rb.position - prevPosition;
			Vector3 normalized = ((Vector3)(ref val2)).normalized;
			prevPosition = rb.position;
			if (!physGrabObject.grabbed)
			{
				if (((Vector3)(ref val)).magnitude > 5f)
				{
					playDuckLoop = true;
					trailTimer = 0.2f;
				}
				else
				{
					playDuckLoop = false;
				}
			}
			else
			{
				playDuckLoop = false;
			}
			if (trailTimer > 0f)
			{
				playDuckLoop = true;
				trailTimer -= Time.fixedDeltaTime;
				foreach (TrailRenderer trail in trails)
				{
					trail.emitting = true;
				}
			}
			else
			{
				playDuckLoop = false;
				foreach (TrailRenderer trail2 in trails)
				{
					trail2.emitting = false;
				}
			}
			soundDuckLoop.PlayLoop(playDuckLoop, 2f, 1f, 1f);
			if (hurtColliderTime > 0f)
			{
				hurtTransform.forward = normalized;
				if (!((Component)hurtCollider).gameObject.activeSelf)
				{
					((Component)hurtCollider).gameObject.SetActive(true);
					float num = ((Vector3)(ref val)).magnitude * 2f;
					if (num > 50f)
					{
						num = 50f;
					}
					hurtCollider.physHitForce = num;
					hurtCollider.physHitTorque = num;
					hurtCollider.enemyHitForce = num;
					hurtCollider.enemyHitTorque = num;
					hurtCollider.playerTumbleForce = num;
					hurtCollider.playerTumbleTorque = num;
				}
				hurtColliderTime -= Time.fixedDeltaTime;
			}
			else if (((Component)hurtCollider).gameObject.activeSelf)
			{
				((Component)hurtCollider).gameObject.SetActive(false);
			}
		}

		private void LilQuackJump()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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)
			if ((!((Object)(object)impactDetector != (Object)null) || !impactDetector.inCart) && !physGrabObject.grabbed && !valuableObject.discovered)
			{
				rb.AddForce(Vector3.up * DuckForceMulti, (ForceMode)1);
				rb.AddTorque(Random.insideUnitSphere * DuckTorqueMulti, (ForceMode)1);
				rb.AddForce(Vector2.op_Implicit(Random.insideUnitCircle * DuckForceMulti), (ForceMode)1);
				if (SemiFunc.IsMultiplayer())
				{
					photonView.RPC("LilQuackJumpRPC", (RpcTarget)0, Array.Empty<object>());
				}
				else
				{
					LilQuackJumpRPC();
				}
			}
		}

		[PunRPC]
		public void LilQuackJumpRPC()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)impactDetector != (Object)null) || !impactDetector.inCart)
			{
				soundQuack.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
			}
		}

		public void Squeak()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			soundSqueak.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
		}

		public void Quack()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			if (((Object)(object)impactDetector != (Object)null && impactDetector.inCart) || physGrabObject.grabbed)
			{
				return;
			}
			soundQuack.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
			hurtColliderTime = 0.2f;
			if (!SemiFunc.IsMasterClientOrSingleplayer())
			{
				return;
			}
			if (Random.Range(0, 50) == 0)
			{
				if (SemiFunc.IsMultiplayer())
				{
					photonView.RPC("QuackRPC", (RpcTarget)0, Array.Empty<object>());
				}
				else
				{
					QuackRPC();
				}
			}
			Vector3 velocity = rb.velocity;
			if (((Vector3)(ref velocity)).magnitude < 20f)
			{
				Rigidbody obj = rb;
				obj.velocity *= 5f;
				rb.AddTorque(Random.insideUnitSphere * 40f);
			}
		}

		[PunRPC]
		public void QuackRPC()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			soundDuckExplosionGlobal.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
			soundDuckExplosion.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
			ParticlePrefabExplosion val = particleScriptExplosion.Spawn(((Component)this).transform.position, 1f, 100, 250, 1f, false, false, 1f);
			val.SkipHurtColliderSetup = true;
			val.HurtCollider.playerDamage = 0;
			val.HurtCollider.enemyDamage = 250;
			val.HurtCollider.physImpact = (BreakImpact)3;
			val.HurtCollider.physHingeDestroy = true;
			val.HurtCollider.playerTumbleForce = 30f;
			val.HurtCollider.playerTumbleTorque = 50f;
		}
	}
	[DisallowMultipleComponent]
	public class EnemyNameAttribute : PropertyAttribute
	{
	}
	public class ValuableToEnemySpawner : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <DelayedSpawn>d__10 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public ValuableToEnemySpawner <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: Expected O, but got Unknown
				int num = <>1__state;
				ValuableToEnemySpawner valuableToEnemySpawner = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(valuableToEnemySpawner.spawnDelay);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					valuableToEnemySpawner.DoSpawn();
					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();
			}
		}

		[Header("Choose Enemy Setups by name")]
		[EnemyName]
		public List<string> enemySetups;

		[Tooltip("If true, picks a single random setup; otherwise spawns every setup in the list.")]
		[SerializeField]
		private bool randomPick = true;

		[Tooltip("Optional delay before spawning.")]
		[SerializeField]
		private float spawnDelay;

		[Header("Spawn Chance")]
		[Tooltip("0 = never spawn, 1 = always spawn. Values in between give probability, 0.2 = 20% spawn chance.")]
		[Range(0f, 1f)]
		[SerializeField]
		private float spawnChance = 1f;

		[Header("Events")]
		[Tooltip("Invoked after the spawn logic completes successfully.")]
		public UnityEvent OnSpawn;

		private bool _hasSpawned;

		private PhysGrabObjectImpactDetector _detector;

		private void Awake()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			_detector = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>();
			if ((Object)(object)_detector == (Object)null)
			{
				Debug.LogError((object)("[BensEnemySpawner] No ImpactDetector on '" + ((Object)this).name + "'"));
			}
			else
			{
				_detector.onDestroy.AddListener(new UnityAction(OnValuableBroken));
			}
		}

		private void OnDestroy()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			if ((Object)(object)_detector != (Object)null)
			{
				_detector.onDestroy.RemoveListener(new UnityAction(OnValuableBroken));
			}
		}

		private void OnValuableBroken()
		{
			if (!_hasSpawned)
			{
				_hasSpawned = true;
				if (Random.value > spawnChance)
				{
					Debug.Log((object)$"[BensEnemySpawner] Roll failed ({spawnChance * 100f:0.#}% chance)");
				}
				else if (spawnDelay > 0f)
				{
					((MonoBehaviour)this).StartCoroutine(DelayedSpawn());
				}
				else
				{
					DoSpawn();
				}
			}
		}

		[IteratorStateMachine(typeof(<DelayedSpawn>d__10))]
		private IEnumerator DelayedSpawn()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DelayedSpawn>d__10(0)
			{
				<>4__this = this
			};
		}

		private void DoSpawn()
		{
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: 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_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: 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_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: 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_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			if (enemySetups == null || enemySetups.Count == 0)
			{
				Debug.LogWarning((object)("[BensEnemySpawner] No EnemySetup names assigned on '" + ((Object)this).name + "'"));
				return;
			}
			List<EnemySetup> list = new List<EnemySetup>();
			if (randomPick)
			{
				string text = enemySetups[Random.Range(0, enemySetups.Count)];
				EnemySetup item = default(EnemySetup);
				if (!Enemies.TryGetEnemyByName(text, ref item))
				{
					Debug.LogError((object)("[BensEnemySpawner] Couldn't find EnemySetup '" + text + "'"));
					return;
				}
				list.Add(item);
			}
			else
			{
				EnemySetup item2 = default(EnemySetup);
				foreach (string enemySetup in enemySetups)
				{
					if (Enemies.TryGetEnemyByName(enemySetup, ref item2))
					{
						list.Add(item2);
					}
					else
					{
						Debug.LogError((object)("[BensEnemySpawner] Couldn't find EnemySetup '" + enemySetup + "'"));
					}
				}
				if (list.Count == 0)
				{
					return;
				}
			}
			Vector3 val = ((Component)this).transform.position;
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(((Component)this).transform.position, Vector3.down, ref val2, 3f, LayerMask.GetMask(new string[1] { "Default" })))
			{
				val = ((RaycastHit)(ref val2)).point + Vector3.up * 0.1f;
			}
			Quaternion val3 = Quaternion.Euler(0f, ((Component)this).transform.eulerAngles.y, 0f);
			Enemy val4 = default(Enemy);
			foreach (EnemySetup item3 in list)
			{
				List<EnemyParent> list2 = Enemies.SpawnEnemy(item3, val, val3, false);
				if (list2 == null || list2.Count == 0)
				{
					Debug.LogError((object)("[BensEnemySpawner] SpawnEnemy returned no instances for '" + ((Object)item3).name + "'"));
					continue;
				}
				foreach (EnemyParent item4 in list2)
				{
					GameObject gameObject = ((Component)item4).gameObject;
					gameObject.SendMessage("ResetStateTimer", (SendMessageOptions)1);
					if (gameObject.TryGetComponent<Enemy>(ref val4))
					{
						val4.CurrentState = (EnemyState)1;
					}
					Debug.Log((object)$"[BensEnemySpawner] Spawned '{((Object)item3).name}' at {gameObject.transform.position}");
				}
			}
			UnityEvent onSpawn = OnSpawn;
			if (onSpawn != null)
			{
				onSpawn.Invoke();
			}
		}
	}
	public class ValuableToggle : MonoBehaviour
	{
		[HideInInspector]
		public bool toggleState;

		public bool playSound;

		private bool fetchSound;

		internal bool toggleStatePrevious;

		private PhotonView photonView;

		private PhysGrabObject physGrabObject;

		private Sound soundOn;

		private Sound soundOff;

		internal int playerTogglePhotonID;

		internal bool toggleImpulse;

		private float toggleImpulseTimer;

		internal bool disabled;

		private void Start()
		{
			photonView = ((Component)this).GetComponent<PhotonView>();
			physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
		}

		private void Update()
		{
			if (playSound && !fetchSound)
			{
				soundOn = AssetManager.instance.soundDeviceTurnOn;
				soundOff = AssetManager.instance.soundDeviceTurnOff;
				fetchSound = true;
			}
			if (physGrabObject.heldByLocalPlayer && !disabled && SemiFunc.InputDown((InputKey)2))
			{
				TutorialDirector.instance.playerUsedToggle = true;
				bool toggle = !toggleState;
				int player = SemiFunc.PhotonViewIDPlayerAvatarLocal();
				ToggleItem(toggle, player);
			}
			if (toggleImpulseTimer > 0f)
			{
				toggleImpulse = true;
				toggleImpulseTimer -= Time.deltaTime;
			}
			else
			{
				toggleImpulse = false;
			}
		}

		private void ToggleItemLogic(bool toggle, int player = -1)
		{
			//IL_0063: 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)
			toggleStatePrevious = toggleState;
			toggleState = toggle;
			playerTogglePhotonID = player;
			if (playSound)
			{
				if (toggleState)
				{
					soundOn.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
				}
				else
				{
					soundOff.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
				}
			}
			toggleImpulseTimer = 0.2f;
		}

		public void ToggleItem(bool toggle, int player = -1)
		{
			if (GameManager.Multiplayer())
			{
				photonView.RPC("ToggleItemRPC", (RpcTarget)0, new object[2] { toggle, player });
			}
			else
			{
				ToggleItemLogic(toggle, player);
			}
		}

		[PunRPC]
		private void ToggleItemRPC(bool toggle, int player = -1)
		{
			ToggleItemLogic(toggle, player);
		}

		public void ToggleDisable(bool _disable)
		{
			if (GameManager.Multiplayer())
			{
				photonView.RPC("ToggleDisableRPC", (RpcTarget)0, new object[1] { _disable });
			}
			else
			{
				ToggleDisableRPC(_disable);
			}
		}

		[PunRPC]
		private void ToggleDisableRPC(bool _disable)
		{
			disabled = _disable;
		}
	}
}