Decompiled source of AbioticFactorValuables v1.1.2

AbioticFactorValuables.dll

Decompiled 3 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AbioticFactorValuables.MiscScripts;
using BepInEx;
using BepInEx.Configuration;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using REPOLib.Modules;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Serialization;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Nikki")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyCopyright("Copyright © 2025 Nikki")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+4fefe5c3de92fde71f4097e86c53ca077ae4598d")]
[assembly: AssemblyProduct("AbioticFactorValuables")]
[assembly: AssemblyTitle("AbioticFactorValuables")]
[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;
		}
	}
}
public class ItemCrossbow : MonoBehaviour
{
	private PhysGrabObject physGrabObject;

	private ItemToggle itemToggle;

	public int numberOfBolts = 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;

	public float batteryDrain = 0.1f;

	public bool batteryDrainFullBar;

	public int batteryDrainFullBars = 1;

	public Animator crossbowAnim;

	public LineRenderer lineRenderer;

	public Transform midPoint;

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

	public AnimationCurve shootLineWidthCurve;

	public float grabVerticalOffset = -0.2f;

	public float aimVerticalOffset = -10f;

	public float investigateRadius = 20f;

	public Transform gunMuzzle;

	public GameObject boltPrefab;

	public Transform gunTrigger;

	public Sound soundShoot;

	public Sound soundShootGlobal;

	public Sound soundReload;

	public Sound soundNoAmmoClick;

	public Sound soundHit;

	private float shootCooldownTimer;

	private ItemBattery itemBattery;

	private PhotonView photonView;

	private PhysGrabObjectImpactDetector impactDetector;

	private bool prevToggleState;

	private AnimationCurve triggerAnimationCurve;

	private float triggerAnimationEval;

	private bool triggerAnimationActive;

	private ItemEquippable itemEquippable;

	private void Start()
	{
		physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
		itemEquippable = ((Component)this).GetComponent<ItemEquippable>();
		itemToggle = ((Component)this).GetComponent<ItemToggle>();
		itemBattery = ((Component)this).GetComponent<ItemBattery>();
		photonView = ((Component)this).GetComponent<PhotonView>();
		impactDetector = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>();
		triggerAnimationCurve = AssetManager.instance.animationCurveClickInOut;
	}

	private void FixedUpdate()
	{
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		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 LateUpdate()
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		lineRenderer.SetPosition(1, midPoint.localPosition);
	}

	private void UpdateMaster()
	{
		//IL_0036: 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_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_0277: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
		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 (itemBattery.batteryLife <= 0f)
				{
					physGrabObject.OverrideTorqueStrength(0.1f, 0.1f);
				}
			}
			if (flag)
			{
				physGrabObject.OverrideAngularDrag(40f, 0.1f);
				physGrabObject.OverrideTorqueStrength(6f, 0.1f);
			}
		}
		if (itemToggle.toggleState != prevToggleState)
		{
			if (shootCooldownTimer <= 0f)
			{
				Shoot();
				shootCooldownTimer = shootCooldown;
			}
			if (itemBattery.batteryLife <= 0f)
			{
				soundNoAmmoClick.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
				SemiFunc.CameraShakeImpact(1f, 0.1f);
				physGrabObject.rb.AddForceAtPosition(-gunMuzzle.forward * 1f, gunMuzzle.position, (ForceMode)1);
				if (itemBattery.batteryLife >= 0f)
				{
					if (!((Component)this).gameObject.activeSelf || itemEquippable.isEquipped)
					{
						return;
					}
					if (SemiFunc.IsMultiplayer())
					{
						photonView.RPC("ChargeReloadRPC", (RpcTarget)0, Array.Empty<object>());
					}
					else
					{
						ChargeReloadRPC();
					}
				}
			}
			prevToggleState = itemToggle.toggleState;
		}
		if (shootCooldownTimer > 0f)
		{
			shootCooldownTimer -= Time.deltaTime;
		}
	}

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

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

	[PunRPC]
	public void ShootRPC()
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_019a: Unknown result type (might be due to invalid IL or missing references)
		//IL_019f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0229: Unknown result type (might be due to invalid IL or missing references)
		//IL_022e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0238: Unknown result type (might be due to invalid IL or missing references)
		//IL_01de: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ea: 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_01f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f9: 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_0202: 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_020b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0210: 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_0217: Unknown result type (might be due to invalid IL or missing references)
		//IL_021b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0220: 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_0269: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ac: 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_0290: Unknown result type (might be due to invalid IL or missing references)
		//IL_029b: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a5: 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);
		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);
		if (!batteryDrainFullBar)
		{
			ItemBattery obj = itemBattery;
			obj.batteryLife -= batteryDrain;
		}
		else
		{
			itemBattery.RemoveFullBar(batteryDrainFullBars);
		}
		RaycastHit val4 = default(RaycastHit);
		for (int i = 0; i < numberOfBolts; i++)
		{
			Vector3 endPosition = gunMuzzle.position;
			bool hit = false;
			bool flag = false;
			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;
				Quaternion val3 = Quaternion.AngleAxis(num3, normalized);
				val2 = Quaternion.AngleAxis(num4, val) * val3 * val;
				val = ((Vector3)(ref val2)).normalized;
			}
			if (Physics.Raycast(gunMuzzle.position, val, ref val4, gunRange, LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()) + LayerMask.GetMask(new string[1] { "Enemy" })))
			{
				endPosition = ((RaycastHit)(ref val4)).point;
				hit = true;
			}
			else
			{
				flag = true;
			}
			if (flag)
			{
				endPosition = gunMuzzle.position + gunMuzzle.forward * gunRange;
				hit = false;
			}
			ShootBolt(endPosition, hit);
		}
	}

	private void ShootBolt(Vector3 _endPosition, bool _hit)
	{
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		if (SemiFunc.IsMasterClientOrSingleplayer())
		{
			if (SemiFunc.IsMultiplayer())
			{
				photonView.RPC("ShootBoltRPC", (RpcTarget)0, new object[2] { _endPosition, _hit });
			}
			else
			{
				ShootBoltRPC(_endPosition, _hit);
			}
		}
	}

	private void ChargeReload()
	{
		if (((Component)this).gameObject.activeSelf && SemiFunc.IsMasterClientOrSingleplayer())
		{
			if (SemiFunc.IsMultiplayer())
			{
				photonView.RPC("ChargeReloadRPC", (RpcTarget)0, Array.Empty<object>());
			}
			else
			{
				ChargeReloadRPC();
			}
		}
	}

	[PunRPC]
	public void ShootBoltRPC(Vector3 _endPosition, bool _hit)
	{
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0105: Unknown result type (might be due to invalid IL or missing references)
		//IL_0110: 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_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0134: Unknown result type (might be due to invalid IL or missing references)
		crossbowAnim.SetBool("shoot", true);
		if (itemBattery.batteryLife <= 0f || batteryDrainFullBars <= 0)
		{
			crossbowAnim.SetBool("outofammo", true);
		}
		else
		{
			crossbowAnim.SetBool("outofammo", false);
			crossbowAnim.SetBool("shoot", false);
			soundReload.Play(gunMuzzle.position, 1f, 1f, 1f, 1f);
		}
		if (physGrabObject.playerGrabbing.Count > 1)
		{
			foreach (PhysGrabber item in physGrabObject.playerGrabbing)
			{
				item.OverrideGrabRelease();
			}
		}
		ItemGunBullet component = Object.Instantiate<GameObject>(boltPrefab, gunMuzzle.position, gunMuzzle.rotation).GetComponent<ItemGunBullet>();
		component.hitPosition = _endPosition;
		component.bulletHit = _hit;
		soundHit.Play(_endPosition, 1f, 1f, 1f, 1f);
		component.shootLineWidthCurve = shootLineWidthCurve;
		component.ActivateAll();
	}

	[PunRPC]
	public void ChargeReloadRPC()
	{
		crossbowAnim.SetBool("shoot", false);
		crossbowAnim.SetBool("outofammo", false);
	}
}
namespace AbioticFactorValuables
{
	[BepInPlugin("AbioticFactorValuables", "AbioticFactorValuables", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class AbioticFactorValuables : BaseUnityPlugin
	{
		public static ConfigEntry<bool> enableCrowbar;

		public static ConfigEntry<bool> enableEnergyPistol;

		public static ConfigEntry<bool> enableLodestoneCrossbow;

		public static ConfigEntry<bool> enableSlushieBomb;

		public static ConfigEntry<bool> enableTechScepter;

		public static GameObject freezeExplosionPublic;

		private void Awake()
		{
			string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			string text = Path.Combine(directoryName, "abioticfactorvaluables_assets");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			enableCrowbar = ((BaseUnityPlugin)this).Config.Bind<bool>("Items", "Enable Crowbar", true, "Should the Crowbar be enabled in the shop?");
			enableEnergyPistol = ((BaseUnityPlugin)this).Config.Bind<bool>("Items", "Enable Energy Pistol", true, "Should the Energy Pistol be enabled in the shop?");
			enableLodestoneCrossbow = ((BaseUnityPlugin)this).Config.Bind<bool>("Items", "Enable Lodestone Crossbow", true, "Should the Lodestone Crossbow be enabled in the shop?");
			enableSlushieBomb = ((BaseUnityPlugin)this).Config.Bind<bool>("Items", "Enable Slushie Bomb", true, "Should the Slushie Bomb be enabled in the shop?");
			enableTechScepter = ((BaseUnityPlugin)this).Config.Bind<bool>("Items", "Enable Tech Scepter", true, "Should the Tech Scepter be enabled in the shop?");
			List<string> list = new List<string>(1) { "Valuables - Arctic" };
			List<string> list2 = new List<string>(1) { "Valuables - Manor" };
			List<string> list3 = new List<string>(1) { "Valuables - Wizard" };
			List<string> list4 = new List<string>(1) { "Valuables - Generic" };
			List<string> list5 = new List<string>(2) { "Valuables - Manor", "Valuables - Wizard" };
			List<string> list6 = new List<string>(2) { "Valuables - Arctic", "Valuables - Wizard" };
			List<string> list7 = new List<string>(2) { "Valuables - Arctic", "Valuables - Manor" };
			if (enableCrowbar.Value)
			{
				Item val2 = val.LoadAsset<Item>("Item Melee Crowbar");
				Items.RegisterItem(val2);
			}
			if (enableEnergyPistol.Value)
			{
				Item val3 = val.LoadAsset<Item>("Item Gun Energy Pistol");
				Items.RegisterItem(val3);
			}
			if (enableLodestoneCrossbow.Value)
			{
				Item val4 = val.LoadAsset<Item>("Item Crossbow Lodestone");
				Items.RegisterItem(val4);
			}
			if (enableSlushieBomb.Value)
			{
				Item val5 = val.LoadAsset<Item>("Item Slushie Bomb");
				Items.RegisterItem(val5);
				GameObject val6 = val.LoadAsset<GameObject>("Freeze Explosion");
				NetworkPrefabs.RegisterNetworkPrefab(val6);
				freezeExplosionPublic = val6;
			}
			if (enableTechScepter.Value)
			{
				Item val7 = val.LoadAsset<Item>("Item Melee Tech Scepter");
				Items.RegisterItem(val7);
			}
			GameObject val8 = val.LoadAsset<GameObject>("Valuable Anteverse Gem");
			GameObject val9 = val.LoadAsset<GameObject>("Valuable Box of Screws");
			GameObject val10 = val.LoadAsset<GameObject>("Valuable Briefcase");
			GameObject val11 = val.LoadAsset<GameObject>("Valuable Desk Phone");
			GameObject val12 = val.LoadAsset<GameObject>("Valuable GATE Security Crate");
			GameObject val13 = val.LoadAsset<GameObject>("Valuable Tesla Coil");
			GameObject val14 = val.LoadAsset<GameObject>("Valuable TV Forklift Certification");
			GameObject val15 = val.LoadAsset<GameObject>("Valuable Unfortunate Spacemen Arcade Machine");
			GameObject val16 = val.LoadAsset<GameObject>("Valuable Snacks Vending Machine");
			GameObject val17 = val.LoadAsset<GameObject>("Valuable Water Cooler");
			Valuables.RegisterValuable(val8, list6);
			Valuables.RegisterValuable(val9, list7);
			Valuables.RegisterValuable(val10, list7);
			Valuables.RegisterValuable(val11, list);
			Valuables.RegisterValuable(val12, list);
			Valuables.RegisterValuable(val13, list);
			Valuables.RegisterValuable(val14, list);
			Valuables.RegisterValuable(val15, list);
			Valuables.RegisterValuable(val16, list);
			Valuables.RegisterValuable(val17, list);
			GameObject val18 = val.LoadAsset<GameObject>("Valuable Can of Peas");
			GameObject val19 = val.LoadAsset<GameObject>("Valuable Creepy Pumpkin Painting");
			GameObject val20 = val.LoadAsset<GameObject>("Valuable Desk Leg");
			GameObject val21 = val.LoadAsset<GameObject>("Valuable Diamond Pest Statue");
			GameObject val22 = val.LoadAsset<GameObject>("Valuable Dog Photo Frame");
			GameObject val23 = val.LoadAsset<GameObject>("Valuable Human Brain");
			GameObject val24 = val.LoadAsset<GameObject>("Valuable Lodestone");
			GameObject val25 = val.LoadAsset<GameObject>("Valuable The Red Chair");
			GameObject val26 = val.LoadAsset<GameObject>("Valuable TV Channel 5");
			Valuables.RegisterValuable(val18, list7);
			Valuables.RegisterValuable(val19, list5);
			Valuables.RegisterValuable(val20, list7);
			Valuables.RegisterValuable(val21, list2);
			Valuables.RegisterValuable(val22, list7);
			Valuables.RegisterValuable(val23, list5);
			Valuables.RegisterValuable(val24, list5);
			Valuables.RegisterValuable(val25, list2);
			Valuables.RegisterValuable(val26, list2);
			GameObject val27 = val.LoadAsset<GameObject>("Valuable Antelight");
			GameObject val28 = val.LoadAsset<GameObject>("Valuable Armor Stand");
			GameObject val29 = val.LoadAsset<GameObject>("Valuable Corn Husk Doll");
			GameObject val30 = val.LoadAsset<GameObject>("Valuable Crystalline Vial");
			GameObject val31 = val.LoadAsset<GameObject>("Valuable Fog Lantern");
			GameObject val32 = val.LoadAsset<GameObject>("Valuable Glow Tulip");
			GameObject val33 = val.LoadAsset<GameObject>("Valuable Greyeb");
			GameObject val34 = val.LoadAsset<GameObject>("Valuable Pitchfork");
			GameObject val35 = val.LoadAsset<GameObject>("Valuable Reservoir Growth");
			Valuables.RegisterValuable(val27, list3);
			Valuables.RegisterValuable(val28, list3);
			Valuables.RegisterValuable(val29, list5);
			Valuables.RegisterValuable(val30, list3);
			Valuables.RegisterValuable(val31, list3);
			Valuables.RegisterValuable(val32, list3);
			Valuables.RegisterValuable(val33, list3);
			Valuables.RegisterValuable(val34, list5);
			Valuables.RegisterValuable(val35, list6);
			GameObject val36 = val.LoadAsset<GameObject>("Valuable Anvil");
			GameObject val37 = val.LoadAsset<GameObject>("Valuable Unassuming Bell");
			GameObject val38 = val.LoadAsset<GameObject>("Valuable Gravity Cube");
			GameObject val39 = val.LoadAsset<GameObject>("Valuable Nachos");
			GameObject val40 = val.LoadAsset<GameObject>("Valuable Rubber Band Ball");
			GameObject val41 = val.LoadAsset<GameObject>("Valuable Saltz");
			GameObject val42 = val.LoadAsset<GameObject>("Valuable Slushie");
			Valuables.RegisterValuable(val36, list4);
			Valuables.RegisterValuable(val37, list4);
			Valuables.RegisterValuable(val38, list4);
			Valuables.RegisterValuable(val39, list4);
			Valuables.RegisterValuable(val40, list4);
			Valuables.RegisterValuable(val41, list4);
			Valuables.RegisterValuable(val42, list4);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "AbioticFactorValuables";

		public const string PLUGIN_NAME = "AbioticFactorValuables";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace AbioticFactorValuables.MiscScripts
{
	public class FreezeController : MonoBehaviour
	{
		[HideInInspector]
		public float duration = 1f;

		[HideInInspector]
		public float initialDuration = 1f;

		[HideInInspector]
		public Color newColor = Color.cyan;

		[HideInInspector]
		public Color oldColor = Color.white;

		[HideInInspector]
		public MeshRenderer[] renderers = null;

		[HideInInspector]
		public Animator animator = null;

		[HideInInspector]
		public Dictionary<Material, Color> matsAndColors = new Dictionary<Material, Color>();

		[HideInInspector]
		public GameObject particles;

		private static readonly int AlbedoColor = Shader.PropertyToID("_AlbedoColor");

		public void SetFreezeDuration(float newDuration, bool addToCurrentDuration)
		{
			if (addToCurrentDuration)
			{
				duration += newDuration;
				initialDuration += newDuration;
			}
			else
			{
				duration = newDuration;
				initialDuration = newDuration;
			}
		}

		public void SetChildMaterialColors(Color color)
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			renderers = ((Component)this).GetComponentsInChildren<MeshRenderer>(true);
			if (renderers == null)
			{
				return;
			}
			MeshRenderer[] array = renderers;
			foreach (MeshRenderer val in array)
			{
				Material[] sharedMaterials = ((Renderer)val).sharedMaterials;
				foreach (Material val2 in sharedMaterials)
				{
					if (!((Object)(object)val2 == (Object)null) && val2.HasProperty(AlbedoColor) && !(val2.GetColor(AlbedoColor) == color))
					{
						if (((Object)val2).name.StartsWith("Player Avatar"))
						{
							val2.enableInstancing = false;
						}
						Color color2 = val2.GetColor(AlbedoColor);
						newColor = color;
						matsAndColors.Add(val2, color2);
						val2.SetColor(AlbedoColor, newColor);
					}
				}
			}
		}

		public void SetAnimatorDisabled(Animator animatorToAffect)
		{
			animator = animatorToAffect;
			if (!((Object)(object)animator == (Object)null))
			{
			}
		}

		public void Update()
		{
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			duration -= Time.deltaTime;
			if (duration < initialDuration - 0.15f && (Object)(object)animator != (Object)null && ((Behaviour)animator).enabled)
			{
				((Behaviour)animator).enabled = false;
			}
			if (duration > 0f)
			{
				return;
			}
			if ((Object)(object)animator != (Object)null)
			{
				((Behaviour)animator).enabled = true;
			}
			if (renderers == null || renderers.Length == 0)
			{
				Object.Destroy((Object)(object)this);
				return;
			}
			MeshRenderer[] array = renderers;
			foreach (MeshRenderer val in array)
			{
				Material[] materials = ((Renderer)val).materials;
				foreach (Material val2 in materials)
				{
					if ((Object)(object)val2 == (Object)null || !val2.HasProperty(AlbedoColor))
					{
						continue;
					}
					foreach (KeyValuePair<Material, Color> matsAndColor in matsAndColors)
					{
						if (((Object)val2).name.StartsWith(((Object)matsAndColor.Key).name))
						{
							val2.SetColor(AlbedoColor, matsAndColor.Value);
							val2.enableInstancing = true;
						}
					}
				}
			}
			Object.Destroy((Object)(object)this);
		}
	}
}
namespace AbioticFactorValuables.ItemScripts
{
	public class ValuableAnvil : MonoBehaviour
	{
		public GameObject hurtCollider;

		public Sound anvilHitSound;

		private Rigidbody rb;

		private PhysGrabObject physGrabObject;

		private PhotonView photonView;

		private void Start()
		{
			rb = ((Component)this).GetComponent<Rigidbody>();
			physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
			photonView = ((Component)this).GetComponent<PhotonView>();
			hurtCollider.SetActive(false);
		}

		private void Update()
		{
			//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)
			if ((Object)(object)rb != (Object)null)
			{
				Vector3 velocity = rb.velocity;
				float magnitude = ((Vector3)(ref velocity)).magnitude;
				if (physGrabObject.grabbed)
				{
					hurtCollider.SetActive(false);
				}
				if (physGrabObject.impactDetector.inCart)
				{
					hurtCollider.SetActive(false);
				}
				if (magnitude >= 3.5f && !physGrabObject.grabbed && !physGrabObject.impactDetector.inCart)
				{
					hurtCollider.SetActive(true);
				}
			}
		}

		public void OnAnvilHit()
		{
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				if (SemiFunc.IsMultiplayer())
				{
					photonView.RPC("AnvilPlaySoundRPC", (RpcTarget)0, Array.Empty<object>());
				}
				else
				{
					AnvilPlaySoundRPC();
				}
			}
		}

		[PunRPC]
		public void AnvilPlaySoundRPC()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)rb != (Object)null)
			{
				anvilHitSound.Play(rb.position, 0.9f, 0.9f, 1f, 1f);
			}
			MonoBehaviour.print((object)"Anvil hit!");
		}
	}
	public class ValuableGravityCube : MonoBehaviour
	{
		private PhysGrabObject physGrabObject;

		private PhotonView photonView;

		private void Update()
		{
			foreach (PhysGrabber item in physGrabObject.playerGrabbing)
			{
				if (physGrabObject.grabbedLocal)
				{
					PlayerController.instance.AntiGravity(0.1f);
					continue;
				}
				break;
			}
		}

		private void Start()
		{
			physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
			photonView = ((Component)this).GetComponent<PhotonView>();
			List<PhysGrabber> playerGrabbing = physGrabObject.playerGrabbing;
		}
	}
	public class ValuableGreyeb : MonoBehaviour
	{
		public GreyebDetectionCone cone;

		public Transform greyebEye;

		private PhysGrabObject physGrabObject;

		private PhotonView photonView;

		public bool visionOverride = false;

		public float visionOverrideTimer = 120f;

		private float visionTimer = 0.5f;

		private void Start()
		{
			physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
			photonView = ((Component)this).GetComponent<PhotonView>();
			cone = ((Component)this).GetComponentInChildren<GreyebDetectionCone>();
			((Component)cone).gameObject.SetActive(true);
		}

		private void Update()
		{
			visionTimer -= Time.deltaTime;
			if (visionOverride && visionOverrideTimer > 0f)
			{
				visionOverrideTimer -= Time.deltaTime;
				((Component)cone).gameObject.SetActive(false);
			}
			if (visionTimer <= 0f && !visionOverride)
			{
				if (cone.playerList.Count > 0)
				{
					CheckForVision();
				}
				visionTimer = 0.5f;
			}
			if (visionOverride && visionOverrideTimer <= 0f)
			{
				visionOverride = false;
				visionOverrideTimer = 120f;
				((Component)cone).gameObject.SetActive(true);
			}
		}

		public void CheckForVision()
		{
			//IL_0079: 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_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: 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)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			visionTimer = 0.5f;
			if (!((Object)(object)physGrabObject != (Object)null) || !physGrabObject.hasNeverBeenGrabbed || cone.playerList.Count <= 0)
			{
				return;
			}
			RaycastHit val2 = default(RaycastHit);
			foreach (PlayerAvatar player in cone.playerList)
			{
				if ((Object)(object)greyebEye != (Object)null)
				{
					_ = ((Component)player).transform.position;
					Vector3 position = ((Component)greyebEye).transform.position;
					Vector3 val = ((Component)player).transform.position - ((Component)greyebEye).transform.position;
					if (Physics.Raycast(position, ((Vector3)(ref val)).normalized, ref val2, 20f, LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct())) && (((Component)((RaycastHit)(ref val2)).collider).tag == "Player" || ((Component)((RaycastHit)(ref val2)).collider).gameObject.layer == 26))
					{
						OverrideVision();
					}
				}
			}
			if (visionOverride)
			{
				cone.playerList.Clear();
			}
		}

		public void OverrideVision()
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
			if (!physGrabObject.hasNeverBeenGrabbed || cone.playerList.Count <= 0)
			{
				return;
			}
			foreach (PlayerAvatar player in cone.playerList)
			{
				SemiFunc.PlayerEyesOverride(player, ((Component)greyebEye).transform.position, 0.1f, ((Component)this).gameObject);
				if (player.isLocal)
				{
					Vector3 val = player.localCameraPosition - ((Component)greyebEye).transform.position;
					float num = Vector3.Dot(Vector3.down, val);
					float num2 = 10f;
					if (num > 0.9f)
					{
						num2 = 5f;
					}
					CameraAim.Instance.AimTargetSoftSet(((Component)greyebEye).transform.position, 0.5f, 3f, num2, ((Component)this).gameObject, 90);
					CameraGlitch.Instance.PlayLong();
				}
			}
			visionOverride = true;
			visionOverrideTimer = 120f;
		}
	}
	public class GreyebDetectionCone : MonoBehaviour
	{
		public ValuableGreyeb greyeb;

		public List<PlayerAvatar> playerList = new List<PlayerAvatar>();

		private void Start()
		{
			greyeb = ((Component)this).GetComponentInParent<ValuableGreyeb>();
		}

		private void Update()
		{
			if ((Object)(object)greyeb != (Object)null && playerList.Count <= 0)
			{
			}
		}

		public void OnTriggerEnter(Collider other)
		{
			if (((Component)other).CompareTag("Player"))
			{
				if (!playerList.Equals(((Component)other).GetComponentInParent<PlayerAvatar>()))
				{
					playerList.Add(((Component)other).GetComponentInParent<PlayerAvatar>());
				}
				if ((Object)(object)greyeb != (Object)null && playerList.Count > 0 && !greyeb.visionOverride)
				{
					greyeb.CheckForVision();
				}
			}
		}

		public void OnTriggerExit(Collider other)
		{
			if (((Component)other).CompareTag("Player") && playerList.Count > 0)
			{
				playerList.Remove(((Component)other).GetComponentInParent<PlayerAvatar>());
			}
		}
	}
	public class ItemMeleeValuable : 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 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 ValuableObject valuableObject;

		private void Start()
		{
			rb = ((Component)this).GetComponent<Rigidbody>();
			hurtCollider = ((Component)((Component)this).GetComponentInChildren<HurtCollider>()).transform;
			hurtColliderRotation = ((Component)this).transform.Find("Hurt Collider Rotation");
			physGrabObjectImpactDetector = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>();
			((Component)hurtCollider).gameObject.SetActive(false);
			trailRenderer = ((Component)this).GetComponentInChildren<TrailRenderer>();
			swingPoint = ((Component)this).transform.Find("Swing Point");
			physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
			particleSystem = ((Component)((Component)this).transform.Find("Particles")).GetComponent<ParticleSystem>();
			particleSystemGroundHit = ((Component)((Component)this).transform.Find("Particles Ground Hit")).GetComponent<ParticleSystem>();
			photonView = ((Component)this).GetComponent<PhotonView>();
			forceGrabPoint = ((Component)this).transform.Find("Force Grab Point");
			valuableObject = ((Component)this).GetComponent<ValuableObject>();
			if (SemiFunc.RunIsArena())
			{
				HurtCollider component = ((Component)hurtCollider).GetComponent<HurtCollider>();
				component.playerDamage = component.enemyDamage;
			}
		}

		private void FixedUpdate()
		{
			//IL_0059: 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_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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: 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_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: 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_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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_0051: 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)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: 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_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: 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_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: 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_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: 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_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: 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_0212: 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_021b: 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_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: 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_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			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_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: 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_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: 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_00fc: 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_0153: 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)
			//IL_0205: 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 });
			}
		}

		public void ActivateHitbox()
		{
			//IL_0032: 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_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: 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 void OnHitBreakLevel(int level)
		{
			//IL_0015: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			if (level == 1)
			{
				physGrabObjectImpactDetector.BreakLight(((Component)this).transform.position);
			}
			if (level == 2)
			{
				physGrabObjectImpactDetector.BreakMedium(((Component)this).transform.position);
			}
			if (level == 3)
			{
				physGrabObjectImpactDetector.BreakHeavy(((Component)this).transform.position);
			}
		}
	}
	public class ItemWithScreenScript : Trap
	{
		public GameObject ScreenScreen;

		public UnityEvent ScreenTimer;

		public float runTime = 10f;

		private float speedMulti = 1f;

		public MeshRenderer ScreenStatic;

		public Light ScreenLight;

		public AnimationCurve ScreenStaticCurve;

		public float ScreenStaticTime = 0.5f;

		public float ScreenStaticTimer;

		[Space]
		[Header("___________________ Screen Sounds ___________________")]
		public Sound LoopSound;

		public bool LoopSoundRandomStart = true;

		public Sound StartSound;

		public Sound StopSound;

		[HideInInspector]
		public bool TrapDone;

		private bool ScreenStart = true;

		public override void Start()
		{
			((Trap)this).Start();
			if ((Object)(object)ScreenStatic != (Object)null)
			{
				((Renderer)ScreenStatic).enabled = false;
			}
			((Behaviour)ScreenLight).enabled = false;
			ScreenScreen.SetActive(false);
			base.photonView = ((Component)this).GetComponent<PhotonView>();
			if (GameManager.instance.gameMode == 0)
			{
				base.isLocal = true;
			}
		}

		public void TrapActivate()
		{
			if (!base.trapTriggered)
			{
				base.trapActive = true;
				base.trapTriggered = true;
				ScreenStart = true;
				ScreenTimer.Invoke();
				if (!LoopSoundRandomStart)
				{
					RestartSound();
				}
			}
		}

		public void TrapStop()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			if (base.trapActive)
			{
				if ((Object)(object)ScreenStatic != (Object)null)
				{
					ScreenStaticTimer = 0f;
				}
				ScreenScreen.SetActive(false);
				StopSound.Play(base.physGrabObject.centerPoint, 1f, 1f, 1f, 1f);
				base.trapActive = false;
				LoopSound.Stop();
				if (!LoopSoundRandomStart)
				{
					RestartSound();
				}
			}
		}

		public override void Update()
		{
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			((Trap)this).Update();
			LoopSound.PlayLoop(base.trapActive, 0.9f, 0.9f, 1f);
			if (base.trapStart)
			{
				TrapActivate();
			}
			if (!base.trapActive)
			{
				return;
			}
			base.enemyInvestigate = true;
			if (ScreenStart)
			{
				((Behaviour)ScreenLight).enabled = true;
				ScreenScreen.SetActive(true);
				ScreenStart = false;
				StartSound.Play(base.physGrabObject.centerPoint, 1f, 1f, 1f, 1f);
			}
			if ((Object)(object)ScreenStatic != (Object)null)
			{
				float num = ScreenStaticCurve.Evaluate(ScreenStaticTimer / ScreenStaticTime);
				ScreenStaticTimer += 1f * Time.deltaTime * speedMulti;
				if (num > 0.5f)
				{
					((Renderer)ScreenStatic).enabled = true;
				}
				else
				{
					((Renderer)ScreenStatic).enabled = false;
				}
				if (ScreenStaticTimer > ScreenStaticTime)
				{
					ScreenStaticTimer = 0f;
					((Renderer)ScreenStatic).enabled = false;
				}
			}
		}

		private void RestartSound()
		{
			if (SemiFunc.IsMultiplayer())
			{
				base.photonView.RPC("RestartSoundRPC", (RpcTarget)0, Array.Empty<object>());
			}
			else
			{
				RestartSoundRPC();
			}
		}

		[PunRPC]
		private void RestartSoundRPC()
		{
			LoopSound.Stop();
			LoopSound.PlayLoop(base.trapActive, 0.9f, 0.9f, 1f);
		}
	}
	public class ValuablePitchfork : MonoBehaviour
	{
		public GameObject hurtCollider;

		private PhysGrabObjectImpactDetector impactDetector;

		private Rigidbody rb;

		private PhysGrabObject physGrabObject;

		private PhotonView photonView;

		internal int breakLevelHeavy = 0;

		private void Start()
		{
			rb = ((Component)this).GetComponent<Rigidbody>();
			physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
			photonView = ((Component)this).GetComponent<PhotonView>();
			impactDetector = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>();
			hurtCollider.SetActive(false);
		}

		private void Update()
		{
			//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)
			if ((Object)(object)rb != (Object)null)
			{
				Vector3 velocity = rb.velocity;
				float magnitude = ((Vector3)(ref velocity)).magnitude;
				if (!physGrabObject.impactDetector.inCart && (magnitude >= 0.75f || (physGrabObject.grabbed && magnitude >= 0.25f)))
				{
					hurtCollider.SetActive(true);
				}
				if (physGrabObject.impactDetector.inCart)
				{
					hurtCollider.SetActive(false);
				}
				else
				{
					hurtCollider.SetActive(false);
				}
			}
		}

		public void OnHitEnemy()
		{
			//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_0018: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = hurtCollider.transform.position;
			impactDetector.BreakMedium(position);
		}
	}
	public class RubberBallScript : MonoBehaviour
	{
		public Sound soundBoing;

		private Rigidbody rb;

		private PhotonView photonView;

		private PhysGrabObject physGrabObject;

		public HurtCollider hurtCollider;

		public Transform hurtTransform;

		private float hurtColliderTime;

		private Vector3 prevPosition;

		private float bounceTimer;

		private void Start()
		{
			rb = ((Component)this).GetComponent<Rigidbody>();
			physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
			hurtCollider = ((Component)this).GetComponentInChildren<HurtCollider>();
			((Component)hurtCollider).gameObject.SetActive(false);
			photonView = ((Component)this).GetComponent<PhotonView>();
		}

		private void Update()
		{
			if (bounceTimer >= 0f)
			{
				bounceTimer -= Time.deltaTime;
			}
		}

		private void FixedUpdate()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: 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_0038: 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_0048: 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_006d: 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 (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 / 2f;
					hurtCollider.physHitTorque = num / 2f;
					hurtCollider.enemyHitForce = num / 2f;
					hurtCollider.enemyHitTorque = num / 2f;
					hurtCollider.playerTumbleForce = num;
					hurtCollider.playerTumbleTorque = num;
				}
				hurtColliderTime -= Time.fixedDeltaTime;
			}
			else if (((Component)hurtCollider).gameObject.activeSelf)
			{
				((Component)hurtCollider).gameObject.SetActive(false);
			}
		}

		private void BallBounce()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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_007f: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			if (!physGrabObject.hasNeverBeenGrabbed && !physGrabObject.grabbed && bounceTimer <= 0f)
			{
				rb.AddForce(Vector3.up * Random.Range(1f, 3f), (ForceMode)1);
				rb.AddTorque(Random.insideUnitSphere * Random.Range(1f, 3f), (ForceMode)1);
				rb.AddForce(Vector2.op_Implicit(Random.insideUnitCircle * Random.Range(1f, 3f)), (ForceMode)1);
				bounceTimer = Random.Range(0.5f, 1.5f);
			}
		}

		public void Boing()
		{
			BallBounce();
			if (SemiFunc.IsMultiplayer())
			{
				photonView.RPC("BoingRPC", (RpcTarget)0, Array.Empty<object>());
			}
			else
			{
				BoingRPC();
			}
		}

		[PunRPC]
		public void BoingRPC()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			soundBoing.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
		}
	}
	public class ItemSlushieBomb : MonoBehaviour
	{
		public Color blinkColor;

		public UnityEvent onDetonate;

		private ItemToggle itemToggle;

		private ItemAttributes itemAttributes;

		internal bool isActive;

		private PhotonView photonView;

		private PhysGrabObjectImpactDetector physGrabObjectImpactDetector;

		private ItemEquippable itemEquippable;

		private Vector3 grenadeStartPosition;

		private Quaternion grenadeStartRotation;

		private PhysGrabObject physGrabObject;

		[FormerlySerializedAs("isThiefGrenade")]
		[HideInInspector]
		public bool isSpawnedGrenade;

		public GameObject throwLine;

		private GameObject obj;

		private Rigidbody rb;

		private TrailRenderer throwLineTrail;

		public Transform freezeExplosion;

		public GameObject primeParticle;

		public Sound primeSound;

		public Sound bombExplosion;

		public Sound bombFreeze;

		private void Start()
		{
			//IL_0044: 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)
			//IL_0055: 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)
			itemEquippable = ((Component)this).GetComponent<ItemEquippable>();
			itemToggle = ((Component)this).GetComponent<ItemToggle>();
			itemAttributes = ((Component)this).GetComponent<ItemAttributes>();
			photonView = ((Component)this).GetComponent<PhotonView>();
			physGrabObjectImpactDetector = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>();
			grenadeStartPosition = ((Component)this).transform.position;
			grenadeStartRotation = ((Component)this).transform.rotation;
			physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
			rb = ((Component)this).GetComponent<Rigidbody>();
			freezeExplosion = ((Component)((Component)this).GetComponentInChildren<FreezeExplosion>()).transform;
			((Component)freezeExplosion).gameObject.SetActive(false);
			primeParticle.gameObject.SetActive(false);
			throwLineTrail = throwLine.GetComponent<TrailRenderer>();
		}

		private void Update()
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			if (itemEquippable.isEquipped)
			{
				if (isActive)
				{
					isActive = false;
					itemToggle.ToggleItem(false, -1);
					throwLineTrail.emitting = false;
					primeParticle.SetActive(false);
				}
				return;
			}
			if (isActive)
			{
				float num = Mathf.PingPong(Time.time * 8f, 1f);
				Color val = blinkColor * Mathf.LinearToGammaSpace(num);
			}
			Vector3 velocity;
			if (isActive)
			{
				velocity = rb.velocity;
				if (((Vector3)(ref velocity)).magnitude >= 0.1f)
				{
					throwLineTrail.emitting = true;
				}
			}
			if (isActive)
			{
				velocity = rb.velocity;
				if (!(((Vector3)(ref velocity)).magnitude < 0.1f))
				{
					goto IL_00ff;
				}
			}
			throwLineTrail.emitting = false;
			goto IL_00ff;
			IL_00ff:
			if (SemiFunc.IsMasterClientOrSingleplayer() && itemToggle.toggleState && !isActive)
			{
				isActive = true;
				BombPrimed();
			}
		}

		private void BombPrimed()
		{
			if (SemiFunc.IsMasterClient())
			{
				photonView.RPC("BombPrimedRPC", (RpcTarget)0, Array.Empty<object>());
			}
			else
			{
				BombPrimedRPC();
			}
		}

		public void BombExplode()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			if (isActive)
			{
				bombExplosion.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
				if (SemiFunc.IsMultiplayer())
				{
					obj = PhotonNetwork.Instantiate("Freeze Explosion", ((Component)this).transform.position, ((Component)this).transform.rotation, (byte)0, (object[])null);
				}
				else
				{
					obj = Object.Instantiate<GameObject>(AbioticFactorValuables.freezeExplosionPublic, ((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null);
				}
				obj.transform.parent = null;
				obj.SetActive(true);
				physGrabObjectImpactDetector.DestroyObject(Object.op_Implicit((Object)(object)obj));
				if (SemiFunc.IsMasterClient())
				{
					photonView.RPC("BombExplodeRPC", (RpcTarget)0, Array.Empty<object>());
				}
				else
				{
					BombExplodeRPC();
				}
			}
		}

		private void BombReset()
		{
			//IL_0033: 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)
			isActive = false;
			throwLine.SetActive(false);
			itemToggle.ToggleItem(false, -1);
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				rb.velocity = Vector3.zero;
				rb.angularVelocity = Vector3.zero;
			}
		}

		[PunRPC]
		private void BombExplodeRPC()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			if (itemEquippable.isEquipped)
			{
				return;
			}
			primeParticle.gameObject.SetActive(false);
			if (!SemiFunc.IsMasterClientOrSingleplayer())
			{
				return;
			}
			if (!SemiFunc.RunIsShop() || isSpawnedGrenade)
			{
				if (!isSpawnedGrenade)
				{
					StatsManager.instance.ItemRemove(itemAttributes.instanceName);
				}
			}
			else
			{
				physGrabObject.Teleport(grenadeStartPosition, grenadeStartRotation);
			}
			if (SemiFunc.RunIsShop() && !isSpawnedGrenade)
			{
				BombReset();
			}
		}

		[PunRPC]
		private void BombPrimedRPC()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			primeParticle.SetActive(true);
			primeSound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
			isActive = true;
		}
	}
	public class FreezeExplosion : MonoBehaviour
	{
		private HurtCollider hurtCollider;

		private PhotonView photonView;

		private PhotonTransformView photonTransformView;

		public ItemSlushieBomb itemSlushieBomb;

		public GameObject freezeParticles;

		public GameObject freezeParticlesAttached;

		private Color colorIce = Color.Lerp(Color.cyan, Color.white, 0.3f);

		private float removeTimer = 0.1f;

		private float freezeTime = 5f;

		private static Collider[] hitObjects = (Collider[])(object)new Collider[40];

		private void Start()
		{
			hurtCollider = ((Component)this).GetComponentInChildren<HurtCollider>();
			photonView = ((Component)this).GetComponent<PhotonView>();
			photonTransformView = ((Component)this).GetComponent<PhotonTransformView>();
			freezeTime = 5f;
			freezeParticlesAttached.gameObject.SetActive(false);
		}

		private void Update()
		{
			if (((Behaviour)hurtCollider).enabled)
			{
				removeTimer -= Time.deltaTime;
			}
			if (removeTimer <= 0f)
			{
				FreezeExplosionReset();
			}
		}

		public void FreezeExplosionReset()
		{
			removeTimer = 0f;
			((Behaviour)hurtCollider).enabled = false;
		}

		private void FreezeExplode()
		{
			if (SemiFunc.IsMultiplayer())
			{
				photonView.RPC("FreezeExplodeLogic", (RpcTarget)0, Array.Empty<object>());
			}
			else
			{
				FreezeExplodeLogic();
			}
		}

		[PunRPC]
		public void FreezeExplodeLogic()
		{
			//IL_000c: 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_013a: 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_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			int num = Physics.OverlapSphereNonAlloc(((Component)this).gameObject.transform.position, 2.5f, hitObjects, LayerMask.op_Implicit(SemiFunc.LayerMaskGetShouldHits()), (QueryTriggerInteraction)1);
			for (int i = 0; i < num; i++)
			{
				Collider val = hitObjects[i];
				if (!((Component)val).gameObject.CompareTag("Phys Grab Object") && !((Component)val).gameObject.CompareTag("Enemy"))
				{
					continue;
				}
				EnemyParent componentInParent = ((Component)val).gameObject.GetComponentInParent<EnemyParent>();
				if ((Object)(object)componentInParent == (Object)null)
				{
					continue;
				}
				Enemy enemy = componentInParent.Enemy;
				if (enemy.HasStateStunned)
				{
					Animator componentInChildren = ((Component)componentInParent).GetComponentInChildren<Animator>();
					if ((Object)(object)componentInChildren != (Object)null)
					{
						FreezeController orAddComponent = ComponentHolderProtocol.GetOrAddComponent<FreezeController>((Object)(object)((Component)componentInChildren).gameObject);
						orAddComponent.SetFreezeDuration(freezeTime, addToCurrentDuration: false);
						orAddComponent.SetAnimatorDisabled(componentInChildren);
					}
					FreezeController orAddComponent2 = ComponentHolderProtocol.GetOrAddComponent<FreezeController>((Object)(object)((Component)componentInParent).gameObject);
					orAddComponent2.SetFreezeDuration(freezeTime, addToCurrentDuration: false);
					orAddComponent2.SetChildMaterialColors(colorIce);
				}
			}
			List<PlayerAvatar> list = SemiFunc.PlayerGetAllPlayerAvatarWithinRange(2.5f, ((Component)this).gameObject.transform.position, false, default(LayerMask));
			foreach (PlayerAvatar item in list)
			{
				Animator animator = item.playerAvatarVisuals.animator;
				if (!((Object)(object)animator == (Object)null))
				{
					FreezeController orAddComponent3 = ComponentHolderProtocol.GetOrAddComponent<FreezeController>((Object)(object)((Component)animator).gameObject);
					orAddComponent3.SetFreezeDuration(freezeTime, addToCurrentDuration: false);
					orAddComponent3.SetAnimatorDisabled(animator);
					orAddComponent3.SetChildMaterialColors(colorIce);
					if (item.isLocal)
					{
						PlayerController instance = PlayerController.instance;
						instance.MoveMult(0f, freezeTime);
						instance.OverrideLookSpeed(0f, 0.1f, 1f, freezeTime);
						CameraZoom.Instance.OverrideZoomSet(30f, freezeTime, 0.5f, 1f, ((Component)this).gameObject, 0);
						PostProcessing.Instance.VignetteOverride(colorIce, 10f, 0.5f, 0.5f, 1f, freezeTime, ((Component)this).gameObject);
					}
				}
			}
		}
	}
	public class TechScepterScript : MonoBehaviour
	{
		public Animator animator;

		private PhysGrabObject physGrabObject;

		private PhotonView photonView;

		private bool isGrabbed = false;

		private bool wasGrabbedOnPreviousUpdate;

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

		private void Update()
		{
			if ((Object)(object)physGrabObject != (Object)null)
			{
				isGrabbed = physGrabObject.grabbed;
			}
			if (isGrabbed != wasGrabbedOnPreviousUpdate)
			{
				photonView.RPC("SetAnimationState", (RpcTarget)0, new object[1] { isGrabbed });
			}
			wasGrabbedOnPreviousUpdate = isGrabbed;
		}

		[PunRPC]
		public void SetAnimationState(bool grab)
		{
			if (grab)
			{
				animator.SetBool("grabbed", true);
			}
			else
			{
				animator.SetBool("grabbed", false);
			}
		}
	}
	public class TeslaCoilScript : Trap
	{
		public Material material;

		public Sound teslaActiveSound;

		public Sound teslaShockSound;

		public ParticleSystem teslaActiveParticles;

		public ParticleSystem teslaShockParticles;

		public Transform shockStartTransform;

		private Color emission;

		private float emissionValue = 0f;

		public override void Start()
		{
			((Trap)this).Start();
			base.photonView = ((Component)this).GetComponent<PhotonView>();
			base.physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
			material.enableInstancing = true;
			((Component)teslaActiveParticles).gameObject.SetActive(false);
		}

		public override void Update()
		{
			//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_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_002f: Unknown result type (might be due to invalid IL or missing references)
			((Trap)this).Update();
			emission = Color.Lerp(Color.black, Color.white, emissionValue);
			material.SetColor("_EmissionColor", emission);
			teslaActiveSound.PlayLoop(base.physGrabObject.grabbed, 0.2f, 1f, 1f);
			if (base.physGrabObject.grabbed)
			{
				((Component)teslaActiveParticles).gameObject.SetActive(true);
				emissionValue += Time.deltaTime * 5f;
			}
			if (!base.physGrabObject.grabbed)
			{
				((Component)teslaActiveParticles).gameObject.SetActive(false);
				emissionValue -= Time.deltaTime;
			}
			emissionValue = Mathf.Clamp01(emissionValue);
		}

		public void TrapActivate()
		{
			if (SemiFunc.IsMultiplayer())
			{
				base.photonView.RPC("TrapActivateRPC", (RpcTarget)0, Array.Empty<object>());
			}
			else
			{
				TrapActivateRPC();
			}
		}

		[PunRPC]
		public void TrapActivateRPC()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: 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_006e: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: 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_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: 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_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: 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)
			if (base.physGrabObject.hasNeverBeenGrabbed)
			{
				return;
			}
			RaycastHit val2 = default(RaycastHit);
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAllPlayerAvatarWithinRange(10f, ((Component)this).gameObject.transform.position, Object.op_Implicit((Object)(object)base.physGrabObject), default(LayerMask)))
			{
				Vector3 val = ((Component)item).transform.position - shockStartTransform.position;
				Vector3 normalized = ((Vector3)(ref val)).normalized;
				if (!Physics.Raycast(shockStartTransform.position, normalized, ref val2, 15f, LayerMask.op_Implicit(SemiFunc.LayerMaskGetShouldHits()) - LayerMask.GetMask(new string[1] { "PhysGrabObject" }), (QueryTriggerInteraction)1))
				{
					continue;
				}
				teslaShockSound.Play(((Component)this).gameObject.transform.position, 1f, 1f, 1f, 1f);
				Debug.Log((object)("Raycast hit object: " + ((Object)((Component)((RaycastHit)(ref val2)).collider).gameObject).name + " in " + ((Object)((Component)((RaycastHit)(ref val2)).collider).gameObject.transform.parent).name));
				val = ((RaycastHit)(ref val2)).point;
				Debug.Log((object)$"Hit point at {((Vector3)(ref val)).normalized}");
				Transform transform = ((Component)teslaShockParticles).gameObject.transform;
				val = ((RaycastHit)(ref val2)).point;
				transform.rotation = Quaternion.LookRotation(((Vector3)(ref val)).normalized);
				teslaShockParticles.Play();
				if (((Component)((RaycastHit)(ref val2)).collider).gameObject.layer != LayerMask.NameToLayer("Player"))
				{
					continue;
				}
				item.playerHealth.Hurt(30, true, -1);
				if (item.playerHealth.health > 0)
				{
					if (!item.isTumbling)
					{
						item.tumble.TumbleRequest(true, false);
						item.tumble.TumbleOverrideTime(2f);
					}
					item.tumble.ImpactHurtSet(2f, 0);
					item.tumble.TumbleForce(normalized * 20f);
					PlayerTumble tumble = item.tumble;
					val = shockStartTransform.position;
					tumble.TumbleTorque(((Vector3)(ref val)).normalized);
					if (item.isLocal)
					{
						PlayerController instance = PlayerController.instance;
						instance.ForceImpulse(normalized * 20f);
					}
				}
			}
		}
	}
	internal class VendingMachineScript : MonoBehaviour
	{
		private PhysGrabObject physGrabObject;

		private PhotonView photonView;

		public Animator VendingMachineAnim;

		public GameObject saltzItem;

		public Transform spawnPosTransform;

		public Sound itemDispense;

		public Sound itemDispenseFail;

		private bool hasDispensed = false;

		private bool buttonPressed = false;

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

		public void VendItemPlay()
		{
			if (physGrabObject.grabbedLocal || physGrabObject.grabbed)
			{
				if (!hasDispensed && !buttonPressed)
				{
					photonView.RPC("SetAnimationState", (RpcTarget)0, new object[1] { true });
					((Behaviour)VendingMachineAnim).enabled = true;
				}
				if (hasDispensed || buttonPressed)
				{
					photonView.RPC("PlaySoundRPC", (RpcTarget)0, new object[1] { true });
				}
			}
		}

		public void SpawnItem()
		{
			//IL_0007: 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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_0059: 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)
			Vector3 position = spawnPosTransform.position;
			if (SemiFunc.IsMultiplayer())
			{
				string valuablePrefabPath = ResourcesHelper.GetValuablePrefabPath(saltzItem);
				if (valuablePrefabPath == string.Empty)
				{
					MonoBehaviour.print((object)"Failed to spawn Saltz.");
					return;
				}
				MonoBehaviour.print((object)$"Network spawning \"{valuablePrefabPath}\" at {position}.");
				PhotonNetwork.InstantiateRoomObject(valuablePrefabPath, position, Quaternion.identity, (byte)0, (object[])null);
			}
			else
			{
				MonoBehaviour.print((object)$"Locally spawning Saltz at {position}.");
				Object.Instantiate<GameObject>(saltzItem, position, Quaternion.identity);
			}
			hasDispensed = true;
		}

		public void OutOfStockItem()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			itemDispenseFail.Play(physGrabObject.centerPoint, 1f, 1f, 1f, 1f);
		}

		[PunRPC]
		public void SetAnimationState(bool vendanim)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			VendingMachineAnim.SetBool("active", vendanim);
			buttonPressed = true;
			itemDispense.Play(physGrabObject.centerPoint, 1f, 1f, 1f, 1f);
		}

		[PunRPC]
		public void PlaySoundRPC(bool playsound)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			itemDispenseFail.Play(physGrabObject.centerPoint, 1f, 1f, 1f, 1f);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}