Decompiled source of RDD Valuables v0.1.9

RDDValuables.dll

Decompiled a month ago
using System;
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;

[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: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Autodesk.Fbx")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("Klattersynth")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("websocket-sharp")]
[assembly: AssemblyCompany("RedDragonDev")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RDDValuables")]
[assembly: AssemblyTitle("RDDValuables")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 ValuableNZap : Trap
{
	private PhotonView photonView;

	private float laserTimer;

	public SemiLaser semiLaser;

	public Transform laserTransform;

	private Rigidbody rb;

	public float fireCooldown;

	private float cooldownTimer = 0f;

	public int uses = 3;

	private PhysGrabObject physGrabObject;

	private ItemToggle itemToggle;

	private float distanceKeep = 0.75f;

	private PhysGrabObjectImpactDetector pgoid;

	public Sound ReloadSound;

	private bool gunMode = false;

	private float grabVerticalOffset = -0.2f;

	private float aimVerticalOffset = -10f;

	private float torqueMultiplier = 1f;

	private float grabStrengthMultiplier = 1f;

	public override void Start()
	{
		((Trap)this).Start();
		itemToggle = ((Component)this).GetComponent<ItemToggle>();
		physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
		photonView = ((Component)this).GetComponent<PhotonView>();
		rb = ((Component)this).GetComponent<Rigidbody>();
		pgoid = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>();
	}

	public override void Update()
	{
		//IL_011f: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: 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)
		//IL_0139: Unknown result type (might be due to invalid IL or missing references)
		//IL_013e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: 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_0160: Unknown result type (might be due to invalid IL or missing references)
		//IL_018f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0194: 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_017d: 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)
		if (physGrabObject.grabbed && physGrabObject.grabbedLocal)
		{
			PhysGrabber.instance.OverrideGrabDistance(distanceKeep);
		}
		if (itemToggle.toggleState && SemiFunc.IsMasterClientOrSingleplayer() && !gunMode)
		{
			itemToggle.toggleState = false;
			if (!gunMode)
			{
				if (SemiFunc.IsMultiplayer())
				{
					photonView.RPC("GunModeRPC", (RpcTarget)0, Array.Empty<object>());
				}
				else
				{
					GunModeRPC();
				}
			}
		}
		updateMaster();
		if (uses == 0 && laserTimer <= 0f && cooldownTimer <= fireCooldown - 1f)
		{
			pgoid.DestroyObject(true);
			return;
		}
		if (laserTimer > 0f)
		{
			laserTimer -= Time.deltaTime;
			Vector3 val = laserTransform.position + laserTransform.forward * 15f;
			bool flag = false;
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(laserTransform.position, laserTransform.forward, ref val2, 15f, LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct())))
			{
				val = ((RaycastHit)(ref val2)).point;
				flag = true;
			}
			semiLaser.LaserActive(laserTransform.position, val, flag);
		}
		else if (cooldownTimer > 0f)
		{
			cooldownTimer -= Time.deltaTime;
			if (cooldownTimer <= 0f)
			{
				ReloadSound.Play(((Component)physGrabObject).transform.position, 1f, 1f, 1f, 1f);
			}
		}
		if (itemToggle.toggleState && SemiFunc.IsMasterClientOrSingleplayer() && cooldownTimer <= 0f && laserTimer <= 0f)
		{
			float num = Random.Range(0.5f, 1f);
			if (SemiFunc.IsMultiplayer())
			{
				photonView.RPC("NZapLaserRPC", (RpcTarget)0, new object[1] { num });
			}
			else
			{
				NZapLaserRPC(num);
			}
			itemToggle.toggleState = false;
		}
		if (itemToggle.toggleState)
		{
			itemToggle.toggleState = false;
		}
	}

	private void updateMaster()
	{
		//IL_0041: 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_0056: 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_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_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		if (!SemiFunc.IsMasterClientOrSingleplayer() || !physGrabObject.grabbed || !gunMode)
		{
			return;
		}
		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);
		}
	}

	private void FixedUpdate()
	{
		if (SemiFunc.IsMasterClientOrSingleplayer() && !(laserTimer > 0f))
		{
		}
	}

	[PunRPC]
	public void NZapLaserRPC(float _time)
	{
		laserTimer = _time;
		cooldownTimer = fireCooldown;
		uses--;
	}

	[PunRPC]
	public void GunModeRPC()
	{
		gunMode = true;
	}
}
namespace RDDValuables
{
	public class BienfuValuable : Trap
	{
		private ParticleScriptExplosion particleScriptExplosion;

		public Transform Center;

		public PhysGrabObject physgrabobject;

		public Sound PreExplosionSound;

		private bool isExploding = false;

		public override void Start()
		{
			((Trap)this).Start();
			particleScriptExplosion = ((Component)this).GetComponent<ParticleScriptExplosion>();
		}

		public void Explode()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			particleScriptExplosion.Spawn(Center.position, 7f, 1000, 1000, 2f, false, false, 5f);
			physgrabobject.dead = true;
		}

		public void StartCountdown()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if (!isExploding)
			{
				isExploding = true;
				PreExplosionSound.Play(Center.position, 1f, 1f, 1f, 1f);
				((MonoBehaviour)this).Invoke("Explode", 0.95f);
			}
		}
	}
	public class ValuableChickenJockey : Trap
	{
		private enum State
		{
			Idle,
			Active
		}

		public PhysGrabObject physGrabObject;

		private float coolDownUntilNextSentence = 0.5f;

		private State currentState;

		private ParticleScriptExplosion particleScriptExplosion;

		public Transform Center;

		public Sound PreExplosionSound;

		private bool isExploding = false;

		[Range(0f, 100f)]
		public float ExplosionChance = 25f;

		public override void Start()
		{
			((Trap)this).Start();
			particleScriptExplosion = ((Component)this).GetComponent<ParticleScriptExplosion>();
		}

		public override void Update()
		{
			if (SemiFunc.IsMultiplayer())
			{
				switch (currentState)
				{
				case State.Idle:
					StateIdle();
					break;
				case State.Active:
					StateActive();
					break;
				}
			}
		}

		private void StateIdle()
		{
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			if (coolDownUntilNextSentence > 0f && physGrabObject.grabbed)
			{
				coolDownUntilNextSentence -= Time.deltaTime;
			}
			else if (Object.op_Implicit((Object)(object)PhysGrabber.instance) && PhysGrabber.instance.grabbed && Object.op_Implicit((Object)(object)PhysGrabber.instance.grabbedPhysGrabObject) && (Object)(object)PhysGrabber.instance.grabbedPhysGrabObject == (Object)(object)physGrabObject)
			{
				currentState = State.Active;
				Color val = default(Color);
				((Color)(ref val))..ctor(0.0549f, 0.6824f, 0.6824f, 1f);
				ChatManager.instance.PossessChatScheduleStart(10);
				ChatManager.instance.PossessChat((PossessChatID)1, "CHICKEN JOCKEY", 3f, val, 0f, false, 0, (UnityEvent)null);
				ChatManager.instance.PossessChatScheduleEnd();
			}
		}

		private void StateActive()
		{
			if (PhysGrabber.instance.grabbed && Object.op_Implicit((Object)(object)PhysGrabber.instance.grabbedPhysGrabObject) && (Object)(object)PhysGrabber.instance.grabbedPhysGrabObject != (Object)(object)physGrabObject)
			{
				currentState = State.Idle;
				coolDownUntilNextSentence = Random.Range(1f, 3f);
			}
			else if (!ChatManager.instance.StateIsPossessed())
			{
				currentState = State.Idle;
				coolDownUntilNextSentence = Random.Range(1f, 3f);
			}
		}

		public void Explode()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)particleScriptExplosion == (Object)null)
			{
				Debug.LogError((object)"particleScriptExplosion is null. Ensure the ParticleScriptExplosion component is attached.");
				return;
			}
			if ((Object)(object)Center == (Object)null)
			{
				Debug.LogError((object)"Center is null. Assign a valid Transform to the Center field.");
				return;
			}
			particleScriptExplosion.Spawn(Center.position, 3f, 150, 150, 2f, false, false, 5f);
			physGrabObject.dead = true;
		}

		public void TryExplosion()
		{
			if (SemiFunc.IsMasterClient())
			{
				bool flag = Random.Range(0f, 1f) < ExplosionChance / 100f;
				if (!isExploding && flag)
				{
					base.photonView.RPC("startExplosionRpc", (RpcTarget)0, Array.Empty<object>());
				}
			}
		}

		[PunRPC]
		public void startExplosionRpc()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			isExploding = true;
			PreExplosionSound.Play(Center.position, 1f, 1f, 1f, 1f);
			((MonoBehaviour)this).Invoke("Explode", 1.1f);
		}
	}
	public class ValuableFlintNSteel : MonoBehaviour
	{
		private enum State
		{
			Idle,
			Active
		}

		private PhysGrabObject physGrabObject;

		private float coolDownUntilNextSentence = 0.5f;

		private State currentState;

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

		private void Update()
		{
			if (SemiFunc.IsMultiplayer())
			{
				switch (currentState)
				{
				case State.Idle:
					StateIdle();
					break;
				case State.Active:
					StateActive();
					break;
				}
			}
		}

		private void StateIdle()
		{
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			if (coolDownUntilNextSentence > 0f && physGrabObject.grabbed)
			{
				coolDownUntilNextSentence -= Time.deltaTime;
			}
			else if (Object.op_Implicit((Object)(object)PhysGrabber.instance) && PhysGrabber.instance.grabbed && Object.op_Implicit((Object)(object)PhysGrabber.instance.grabbedPhysGrabObject) && (Object)(object)PhysGrabber.instance.grabbedPhysGrabObject == (Object)(object)physGrabObject)
			{
				currentState = State.Active;
				Color val = default(Color);
				((Color)(ref val))..ctor(0f, 0.3f, 1f, 1f);
				ChatManager.instance.PossessChatScheduleStart(10);
				ChatManager.instance.PossessChat((PossessChatID)1, "FLINT AND STEEL", 1f, val, 0f, false, 0, (UnityEvent)null);
				ChatManager.instance.PossessChatScheduleEnd();
			}
		}

		private void StateActive()
		{
			if (PhysGrabber.instance.grabbed && Object.op_Implicit((Object)(object)PhysGrabber.instance.grabbedPhysGrabObject) && (Object)(object)PhysGrabber.instance.grabbedPhysGrabObject != (Object)(object)physGrabObject)
			{
				currentState = State.Idle;
				coolDownUntilNextSentence = Random.Range(0.1f, 1f);
			}
			else if (!ChatManager.instance.StateIsPossessed())
			{
				currentState = State.Idle;
				coolDownUntilNextSentence = Random.Range(0.1f, 1f);
			}
		}
	}
	public class ValuableMeridasBeacon : Trap
	{
		public PhysGrabObject physGrabObject;

		public Transform Center;

		public Sound CommonGrabSound;

		public Sound RareGrabSound;

		[Range(0f, 100f)]
		public float chanceToPlayRare;

		private bool played = false;

		public override void Start()
		{
			((Trap)this).Start();
			physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
		}

		public override void Update()
		{
			if (!SemiFunc.IsMasterClientOrSingleplayer())
			{
				return;
			}
			if (physGrabObject.grabbed && !played)
			{
				played = true;
				float num = Random.Range(0f, 1f);
				if (num > chanceToPlayRare / 100f)
				{
					if (SemiFunc.IsMultiplayer())
					{
						base.photonView.RPC("PlayCommonSound", (RpcTarget)0, Array.Empty<object>());
					}
					else
					{
						PlayCommonSound();
					}
				}
				else if (SemiFunc.IsMultiplayer())
				{
					base.photonView.RPC("PlayRareSound", (RpcTarget)0, Array.Empty<object>());
				}
				else
				{
					PlayRareSound();
				}
			}
			else if (!physGrabObject.grabbed)
			{
				played = false;
			}
		}

		[PunRPC]
		private void PlayCommonSound()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			CommonGrabSound.Play(Center.position, 1f, 1f, 1f, 1f);
		}

		[PunRPC]
		private void PlayRareSound()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			RareGrabSound.Play(Center.position, 1f, 1f, 1f, 1f);
		}
	}
	public class ValuablePrisonRealm : MonoBehaviour
	{
		private PhysGrabObject physGrabObject;

		private PhotonView photonView;

		private PhysGrabObjectImpactDetector pgoid;

		public Sound breakSound;

		private bool activated = false;

		public float delay = 5f;

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

		public void onBreak()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			if (activated)
			{
				return;
			}
			activated = true;
			breakSound.Play(((Component)physGrabObject).transform.position, 1f, 1f, 1f, 1f);
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				List<string> list = new List<string>();
				List<EnemySetup> list2 = new List<EnemySetup>(Enemies.AllEnemies);
				for (int i = 0; i < list2.Count; i++)
				{
					list.Add(((Object)list2[i]).name);
				}
				string text = list[Random.Range(0, list.Count)];
				if (SemiFunc.IsMultiplayer())
				{
					photonView.RPC("spawnEnemy", (RpcTarget)0, new object[1] { text });
				}
				else
				{
					spawnEnemy(text);
				}
				((MonoBehaviour)this).Invoke("selfD", delay);
			}
		}

		private void selfD()
		{
			pgoid.DestroyObject(true);
		}

		[PunRPC]
		public void spawnEnemy(string enemyName)
		{
			//IL_000c: 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)
			List<LevelPoint> levelpoints = SemiFunc.LevelPointGetWithinDistance(((Component)physGrabObject).transform.position, 0f, 250f);
			LevelPoint val = findClosestPoint(((Component)physGrabObject).transform.position, levelpoints);
			if ((Object)(object)val != (Object)null)
			{
				enemySpawn(enemyName, ((Component)val).transform);
			}
			else
			{
				MonoBehaviour.print((object)"No Levelpoint found");
			}
		}

		private LevelPoint findClosestPoint(Vector3 position, List<LevelPoint> levelpoints)
		{
			//IL_001c: 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)
			LevelPoint result = null;
			float num = float.PositiveInfinity;
			foreach (LevelPoint levelpoint in levelpoints)
			{
				float num2 = Vector3.Distance(position, ((Component)levelpoint).transform.position);
				if (num2 < num)
				{
					num = num2;
					result = levelpoint;
				}
			}
			return result;
		}

		public void enemySpawn(string enemyName, Transform transform)
		{
			//IL_001a: 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)
			EnemySetup val = default(EnemySetup);
			if (Enemies.TryGetEnemyByName(enemyName, ref val))
			{
				Enemies.SpawnEnemy(val, ((Component)physGrabObject).transform.position, Quaternion.identity, false);
			}
			else
			{
				MonoBehaviour.print((object)"Enemy not found");
			}
		}
	}
	public class TrappedValuable : Trap
	{
		private string trigger = "";

		private string trap = "";

		private string[] triggers = new string[1] { "damage" };

		private string[] traps = new string[1] { "explodeAll" };

		public override void Start()
		{
			((Trap)this).Start();
			trigger = triggers[Random.Range(0, triggers.Length)];
			trap = traps[Random.Range(0, traps.Length)];
		}

		public void damageTrigger()
		{
		}
	}
	[BepInPlugin("RedDragonDev.RDDValuables", "RDDValuables", "1.0")]
	public class RDDValuables : BaseUnityPlugin
	{
		internal static RDDValuables Instance { get; private set; }

		internal static ManualLogSource Logger => Instance._logger;

		private ManualLogSource _logger => ((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_001a: 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_0021: Expected O, but got Unknown
			//IL_0026: 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()
		{
		}
	}
	public class ThatBoatValuable : Trap
	{
		public Transform Center;

		public Sound ImpactSound;

		private bool playedSound = false;

		public override void Start()
		{
			((Trap)this).Start();
		}

		public void OnImpact()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			if (!playedSound)
			{
				ImpactSound.Play(Center.position, 1f, 1f, 1f, 1f);
			}
		}
	}
	public class ValuableTouchSound : Trap
	{
		private PhysGrabObject physGrabObject;

		public bool playOnce = true;

		public Sound GrabSound;

		public Sound RareGrabSound;

		[Range(0f, 100f)]
		public float chanceToPlayRare;

		private bool played = false;

		public override void Start()
		{
			((Trap)this).Start();
			physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
		}

		public override void Update()
		{
			if (!SemiFunc.IsMasterClientOrSingleplayer())
			{
				return;
			}
			if (physGrabObject.grabbed && !played)
			{
				played = true;
				if (RareGrabSound != null)
				{
					float num = Random.Range(0f, 1f);
					if (num > chanceToPlayRare / 100f)
					{
						if (SemiFunc.IsMultiplayer())
						{
							base.photonView.RPC("PlayCommonSound", (RpcTarget)0, Array.Empty<object>());
						}
						else
						{
							PlayCommonSound();
						}
					}
					else if (SemiFunc.IsMultiplayer())
					{
						base.photonView.RPC("PlayRareSound", (RpcTarget)0, Array.Empty<object>());
					}
					else
					{
						PlayRareSound();
					}
				}
				else if (SemiFunc.IsMultiplayer())
				{
					base.photonView.RPC("PlayCommonSound", (RpcTarget)0, Array.Empty<object>());
				}
				else
				{
					PlayCommonSound();
				}
			}
			else if (!physGrabObject.grabbed && !playOnce)
			{
				played = false;
			}
		}

		[PunRPC]
		private void PlayCommonSound()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			GrabSound.Play(((Component)physGrabObject).transform.position, 1f, 1f, 1f, 1f);
		}

		[PunRPC]
		private void PlayRareSound()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			RareGrabSound.Play(((Component)physGrabObject).transform.position, 1f, 1f, 1f, 1f);
		}
	}
}