Decompiled source of Explosive Diamond v1.2.1

Tutorial.dll

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

[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: AssemblyCompany("LLL")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Tutorial")]
[assembly: AssemblyTitle("Tutorial")]
[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 Zealot : MonoBehaviour
{
	public Sound bounceSound;

	private Vector2 bigForceRange = new Vector2(2f, 10f);

	private Vector2 smallForceRange = new Vector2(1f, 3f);

	private Vector2 mediumForceRange = new Vector2(1f, 5f);

	private Vector2 bigTorqueRange = new Vector2(0.1f, 0.9f);

	private Vector2 smallTorqueRange = new Vector2(0f, 0.2f);

	private Vector2 mediumTorqueRange = new Vector2(0.05f, 0.5f);

	private float torqueMultiplier = 0.1f;

	private int bounceAmount = 67;

	private int bounces;

	private Rigidbody rb;

	private PhotonView photonView;

	private PhysGrabObject physGrabObject;

	private void Start()
	{
		rb = ((Component)this).GetComponent<Rigidbody>();
		photonView = ((Component)this).GetComponent<PhotonView>();
		physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
		bounceAmount = Random.Range(2, 6);
	}

	public void BigBounce()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		bounceSound.Play(physGrabObject.centerPoint, 1f, 1f, 1f, 1f);
		if (!SemiFunc.IsMasterClientOrSingleplayer())
		{
			return;
		}
		torqueMultiplier = Random.Range(bigTorqueRange.x, bigTorqueRange.y);
		if (bounces < bounceAmount && !physGrabObject.grabbed)
		{
			bounces++;
			rb.AddForce(Vector3.up * Random.Range(bigForceRange.x, bigForceRange.y), (ForceMode)1);
			rb.AddTorque(Random.insideUnitSphere * torqueMultiplier, (ForceMode)1);
			return;
		}
		Vector3 velocity = rb.velocity;
		if (((Vector3)(ref velocity)).magnitude < 0.1f || physGrabObject.grabbed)
		{
			bounces = 0;
			bounceAmount = Random.Range(2, 6);
		}
	}

	public void SmallBounce()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		bounceSound.Play(physGrabObject.centerPoint, 1f, 1f, 1f, 1f);
		if (!SemiFunc.IsMasterClientOrSingleplayer())
		{
			return;
		}
		torqueMultiplier = Random.Range(smallTorqueRange.x, smallTorqueRange.y);
		Vector3 velocity;
		if (bounces < bounceAmount && !physGrabObject.grabbed)
		{
			velocity = rb.velocity;
			if (((Vector3)(ref velocity)).magnitude > 0.2f)
			{
				bounces++;
				rb.AddForce(Vector3.up * Random.Range(smallForceRange.x, smallForceRange.y), (ForceMode)1);
				rb.AddTorque(Random.insideUnitSphere * torqueMultiplier, (ForceMode)1);
				bounces = bounceAmount;
				return;
			}
		}
		velocity = rb.velocity;
		if (((Vector3)(ref velocity)).magnitude <= 0.2f || physGrabObject.grabbed)
		{
			bounces = 0;
			bounceAmount = Random.Range(2, 6);
		}
	}

	public void MediumBounce()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		bounceSound.Play(physGrabObject.centerPoint, 1f, 1f, 1f, 1f);
		if (!SemiFunc.IsMasterClientOrSingleplayer())
		{
			return;
		}
		torqueMultiplier = Random.Range(mediumTorqueRange.x, mediumTorqueRange.y);
		if (bounces < bounceAmount && !physGrabObject.grabbed)
		{
			bounces++;
			rb.AddForce(Vector3.up * Random.Range(mediumForceRange.x, mediumForceRange.y), (ForceMode)1);
			rb.AddTorque(Random.insideUnitSphere * torqueMultiplier, (ForceMode)1);
			return;
		}
		Vector3 velocity = rb.velocity;
		if (((Vector3)(ref velocity)).magnitude < 0.1f || physGrabObject.grabbed)
		{
			bounces = 0;
			bounceAmount = Random.Range(2, 6);
		}
	}
}
namespace Tutorial
{
	[BepInPlugin("LLL.Tutorial", "Tutorial", "1.0")]
	public class Tutorial : BaseUnityPlugin
	{
		internal static Tutorial 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()
		{
		}
	}
}
namespace repohelp
{
	public class DiamondExplosion : Trap
	{
		private ParticleScriptExplosion particleScriptExplosion;

		private int HitCount;

		private int MaxHitCount = 3;

		public Transform Center;

		protected override void Start()
		{
			base.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, 5f, 350, 350, 1f, false, false, 1f);
		}

		public void PotentialExplode()
		{
			if (isLocal)
			{
				if (HitCount >= MaxHitCount - 1)
				{
					Explode();
				}
				else
				{
					HitCount++;
				}
			}
		}
	}
	public class Trap : MonoBehaviour
	{
		public enum TrapActivateRarityLevel
		{
			no_rarity,
			level1,
			level2,
			level3
		}

		protected PhotonView photonView;

		[HideInInspector]
		public bool enemyInvestigate;

		private bool enemyInvestigatePrev;

		protected float enemyInvestigateRange = 35f;

		private float enemyInvestigateTimer = 1f;

		private float enemyInvestigateTimerMax = 1f;

		[HideInInspector]
		public bool isLocal;

		[HideInInspector]
		public bool trapTriggered;

		[HideInInspector]
		public bool trapActive;

		[HideInInspector]
		public bool trapStart;

		private float trapActivateTimer = 10f;

		protected PhysGrabObject physGrabObject;

		public bool triggerOnTimer;

		public TrapActivateRarityLevel trapActivateRarityLevel;

		protected virtual void Start()
		{
			enemyInvestigateTimer = enemyInvestigateTimerMax;
			photonView = ((Component)this).GetComponent<PhotonView>();
			if (GameManager.instance.gameMode == 0 || PhotonNetwork.IsMasterClient)
			{
				isLocal = true;
			}
			physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
		}

		protected virtual void Update()
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			if (!isLocal)
			{
				return;
			}
			if (enemyInvestigate)
			{
				if (!enemyInvestigatePrev)
				{
					enemyInvestigateTimer = enemyInvestigateTimerMax;
				}
				enemyInvestigateTimer += Time.deltaTime;
				if (enemyInvestigateTimer > enemyInvestigateTimerMax)
				{
					EnemyDirector.instance.SetInvestigate(((Component)this).transform.position, enemyInvestigateRange, false);
					enemyInvestigateTimer = 0f;
				}
			}
			enemyInvestigatePrev = enemyInvestigate;
			enemyInvestigate = false;
			if (!triggerOnTimer)
			{
				return;
			}
			if (physGrabObject.grabbed)
			{
				if (Application.isEditor && (!GameManager.Multiplayer() || GameManager.instance.localTest) && Input.GetKeyDown((KeyCode)98))
				{
					TrapActivateSync();
				}
				if (!(trapActivateTimer > 0f))
				{
					return;
				}
				trapActivateTimer -= Time.deltaTime;
				if (trapActivateTimer <= 0f)
				{
					trapActivateTimer = Random.Range(5f, 15f);
					if (SemiFunc.ValuableTrapActivatedDiceRoll((int)trapActivateRarityLevel))
					{
						TrapActivateSync();
					}
				}
			}
			else
			{
				trapActivateTimer = Random.Range(0f, 15f);
			}
		}

		private void TrapActivateSync()
		{
			//IL_0041: 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)
			if (trapTriggered)
			{
				return;
			}
			if (SemiFunc.IsMultiplayer())
			{
				if (SemiFunc.IsMasterClientOrSingleplayer())
				{
					photonView.RPC("TrapActivateSyncRPC", (RpcTarget)0, Array.Empty<object>());
				}
			}
			else
			{
				TrapActivateSyncRPC();
			}
		}

		[PunRPC]
		public void TrapActivateSyncRPC(PhotonMessageInfo _info = default(PhotonMessageInfo))
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if (SemiFunc.MasterOnlyRPC(_info))
			{
				if (physGrabObject.grabbedLocal)
				{
					CameraGlitch.Instance.PlayLong();
				}
				trapStart = true;
			}
		}

		public void TrapStart()
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			if (trapTriggered)
			{
				return;
			}
			if (SemiFunc.IsMultiplayer())
			{
				if (SemiFunc.IsMasterClientOrSingleplayer() && SemiFunc.ValuableTrapActivatedDiceRoll((int)trapActivateRarityLevel))
				{
					photonView.RPC("TrapStartRPC", (RpcTarget)0, Array.Empty<object>());
				}
			}
			else if (SemiFunc.ValuableTrapActivatedDiceRoll((int)trapActivateRarityLevel))
			{
				TrapStartRPC();
			}
		}

		[PunRPC]
		public void TrapStartRPC(PhotonMessageInfo _info = default(PhotonMessageInfo))
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if (SemiFunc.MasterOnlyRPC(_info))
			{
				if (physGrabObject.grabbedLocal)
				{
					CameraGlitch.Instance.PlayLong();
				}
				trapStart = true;
			}
		}
	}
}