Decompiled source of StarTrekValuables v1.1.6

StarTrekValuables.dll

Decompiled 2 weeks ago
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using REPOLib;
using StarTrekValuables.Scripts;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
public class TrapTasha : Trap
{
	public GameObject Hologram;

	public Animator HologramAnimator;

	public Light HologramLight;

	private bool HologramPlaying;

	protected override void Start()
	{
		((Trap)this).Start();
		base.physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
		Hologram.gameObject.SetActive(false);
		((Behaviour)HologramLight).enabled = false;
		if (GameManager.instance.gameMode == 0)
		{
			base.isLocal = true;
		}
	}

	public void StartHologram()
	{
		base.trapActive = true;
		base.trapTriggered = true;
		HologramPlaying = true;
		Hologram.gameObject.SetActive(true);
		((Behaviour)HologramLight).enabled = true;
		HologramAnimator.Play("hologram_turnon");
	}

	public void StopHologram()
	{
		if (HologramPlaying)
		{
			HologramAnimator.Play("hologram_turnoff");
		}
		base.trapActive = false;
		base.trapStart = false;
		HologramPlaying = false;
	}

	public void HologramShutOff()
	{
		Hologram.gameObject.SetActive(false);
		((Behaviour)HologramLight).enabled = false;
	}

	protected override void Update()
	{
		((Trap)this).Update();
		if (base.physGrabObject.grabbed)
		{
			base.trapStart = true;
		}
		else
		{
			StopHologram();
		}
		if (base.trapStart && !HologramPlaying)
		{
			StartHologram();
		}
		if (base.trapActive)
		{
			base.enemyInvestigate = true;
		}
	}
}
[CompilerGenerated]
[EditorBrowsable(EditorBrowsableState.Never)]
[GeneratedCode("Unity.MonoScriptGenerator.MonoScriptInfoGenerator", null)]
internal class UnitySourceGeneratedAssemblyMonoScriptTypes_v1
{
	private struct MonoScriptData
	{
		public byte[] FilePathsData;

		public byte[] TypesData;

		public int TotalTypes;

		public int TotalFiles;

		public bool IsEditorOnly;
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	private static MonoScriptData Get()
	{
		MonoScriptData result = default(MonoScriptData);
		result.FilePathsData = new byte[695]
		{
			0, 0, 0, 1, 0, 0, 0, 54, 92, 65,
			115, 115, 101, 116, 115, 92, 77, 111, 100, 115,
			92, 83, 116, 97, 114, 84, 114, 101, 107, 86,
			97, 108, 117, 97, 98, 108, 101, 115, 92, 66,
			101, 112, 105, 110, 101, 120, 80, 108, 117, 103,
			105, 110, 92, 65, 115, 115, 101, 116, 115, 46,
			99, 115, 0, 0, 0, 1, 0, 0, 0, 61,
			92, 65, 115, 115, 101, 116, 115, 92, 77, 111,
			100, 115, 92, 83, 116, 97, 114, 84, 114, 101,
			107, 86, 97, 108, 117, 97, 98, 108, 101, 115,
			92, 66, 101, 112, 105, 110, 101, 120, 80, 108,
			117, 103, 105, 110, 92, 67, 111, 110, 102, 105,
			103, 77, 97, 110, 97, 103, 101, 114, 46, 99,
			115, 0, 0, 0, 1, 0, 0, 0, 60, 92,
			65, 115, 115, 101, 116, 115, 92, 77, 111, 100,
			115, 92, 83, 116, 97, 114, 84, 114, 101, 107,
			86, 97, 108, 117, 97, 98, 108, 101, 115, 92,
			66, 101, 112, 105, 110, 101, 120, 80, 108, 117,
			103, 105, 110, 92, 77, 121, 80, 108, 117, 103,
			105, 110, 73, 110, 102, 111, 46, 99, 115, 0,
			0, 0, 1, 0, 0, 0, 83, 92, 65, 115,
			115, 101, 116, 115, 92, 77, 111, 100, 115, 92,
			83, 116, 97, 114, 84, 114, 101, 107, 86, 97,
			108, 117, 97, 98, 108, 101, 115, 92, 66, 101,
			112, 105, 110, 101, 120, 80, 108, 117, 103, 105,
			110, 92, 80, 97, 116, 99, 104, 101, 115, 92,
			86, 97, 108, 117, 97, 98, 108, 101, 79, 98,
			106, 101, 99, 116, 68, 105, 115, 99, 111, 118,
			101, 114, 80, 97, 116, 99, 104, 46, 99, 115,
			0, 0, 0, 1, 0, 0, 0, 54, 92, 65,
			115, 115, 101, 116, 115, 92, 77, 111, 100, 115,
			92, 83, 116, 97, 114, 84, 114, 101, 107, 86,
			97, 108, 117, 97, 98, 108, 101, 115, 92, 66,
			101, 112, 105, 110, 101, 120, 80, 108, 117, 103,
			105, 110, 92, 80, 108, 117, 103, 105, 110, 46,
			99, 115, 0, 0, 0, 1, 0, 0, 0, 61,
			92, 65, 115, 115, 101, 116, 115, 92, 77, 111,
			100, 115, 92, 83, 116, 97, 114, 84, 114, 101,
			107, 86, 97, 108, 117, 97, 98, 108, 101, 115,
			92, 77, 111, 110, 111, 66, 101, 104, 97, 118,
			105, 111, 117, 114, 115, 92, 67, 97, 109, 101,
			114, 97, 70, 97, 99, 105, 110, 103, 46, 99,
			115, 0, 0, 0, 1, 0, 0, 0, 55, 92,
			65, 115, 115, 101, 116, 115, 92, 77, 111, 100,
			115, 92, 83, 116, 97, 114, 84, 114, 101, 107,
			86, 97, 108, 117, 97, 98, 108, 101, 115, 92,
			77, 111, 110, 111, 66, 101, 104, 97, 118, 105,
			111, 117, 114, 115, 92, 68, 97, 120, 77, 117,
			103, 46, 99, 115, 0, 0, 0, 1, 0, 0,
			0, 59, 92, 65, 115, 115, 101, 116, 115, 92,
			77, 111, 100, 115, 92, 83, 116, 97, 114, 84,
			114, 101, 107, 86, 97, 108, 117, 97, 98, 108,
			101, 115, 92, 77, 111, 110, 111, 66, 101, 104,
			97, 118, 105, 111, 117, 114, 115, 92, 77, 97,
			115, 97, 107, 97, 77, 97, 115, 107, 46, 99,
			115, 0, 0, 0, 1, 0, 0, 0, 70, 92,
			65, 115, 115, 101, 116, 115, 92, 77, 111, 100,
			115, 92, 83, 116, 97, 114, 84, 114, 101, 107,
			86, 97, 108, 117, 97, 98, 108, 101, 115, 92,
			77, 111, 110, 111, 66, 101, 104, 97, 118, 105,
			111, 117, 114, 115, 92, 80, 104, 111, 116, 111,
			110, 84, 111, 114, 112, 101, 100, 111, 86, 97,
			108, 117, 97, 98, 108, 101, 46, 99, 115, 0,
			0, 0, 1, 0, 0, 0, 58, 92, 65, 115,
			115, 101, 116, 115, 92, 77, 111, 100, 115, 92,
			83, 116, 97, 114, 84, 114, 101, 107, 86, 97,
			108, 117, 97, 98, 108, 101, 115, 92, 77, 111,
			110, 111, 66, 101, 104, 97, 118, 105, 111, 117,
			114, 115, 92, 84, 114, 97, 112, 84, 97, 115,
			104, 97, 46, 99, 115
		};
		result.TypesData = new byte[343]
		{
			0, 0, 0, 0, 24, 83, 116, 97, 114, 84,
			114, 101, 107, 86, 97, 108, 117, 97, 98, 108,
			101, 115, 124, 65, 115, 115, 101, 116, 115, 0,
			0, 0, 0, 31, 83, 116, 97, 114, 84, 114,
			101, 107, 86, 97, 108, 117, 97, 98, 108, 101,
			115, 124, 67, 111, 110, 102, 105, 103, 77, 97,
			110, 97, 103, 101, 114, 0, 0, 0, 0, 30,
			83, 116, 97, 114, 84, 114, 101, 107, 86, 97,
			108, 117, 97, 98, 108, 101, 115, 124, 77, 121,
			80, 108, 117, 103, 105, 110, 73, 110, 102, 111,
			0, 0, 0, 0, 45, 83, 116, 97, 114, 84,
			114, 101, 107, 86, 97, 108, 117, 97, 98, 108,
			101, 115, 124, 86, 97, 108, 117, 97, 98, 108,
			101, 79, 98, 106, 101, 99, 116, 68, 105, 115,
			99, 111, 118, 101, 114, 80, 97, 116, 99, 104,
			0, 0, 0, 0, 24, 83, 116, 97, 114, 84,
			114, 101, 107, 86, 97, 108, 117, 97, 98, 108,
			101, 115, 124, 80, 108, 117, 103, 105, 110, 0,
			0, 0, 0, 30, 83, 116, 97, 114, 84, 114,
			101, 107, 86, 97, 108, 117, 97, 98, 108, 101,
			115, 124, 67, 97, 109, 101, 114, 97, 70, 97,
			99, 105, 110, 103, 0, 0, 0, 0, 32, 83,
			116, 97, 114, 84, 114, 101, 107, 86, 97, 108,
			117, 97, 98, 108, 101, 115, 46, 83, 99, 114,
			105, 112, 116, 115, 124, 68, 97, 120, 77, 117,
			103, 0, 0, 0, 0, 28, 83, 116, 97, 114,
			84, 114, 101, 107, 86, 97, 108, 117, 97, 98,
			108, 101, 115, 124, 77, 97, 115, 97, 107, 97,
			77, 97, 115, 107, 0, 0, 0, 0, 39, 83,
			116, 97, 114, 84, 114, 101, 107, 86, 97, 108,
			117, 97, 98, 108, 101, 115, 124, 80, 104, 111,
			116, 111, 110, 84, 111, 114, 112, 101, 100, 111,
			86, 97, 108, 117, 97, 98, 108, 101, 0, 0,
			0, 0, 10, 124, 84, 114, 97, 112, 84, 97,
			115, 104, 97
		};
		result.TotalFiles = 10;
		result.TotalTypes = 10;
		result.IsEditorOnly = false;
		return result;
	}
}
namespace StarTrekValuables
{
	internal static class Assets
	{
	}
	internal static class ConfigManager
	{
		public static ConfigFile ConfigFile { get; private set; }

		public static void Initialize(ConfigFile configFile)
		{
			ConfigFile = configFile;
			BindConfigs();
		}

		private static void BindConfigs()
		{
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "StarTrekValuables";

		public const string PLUGIN_NAME = "StarTrekValuables";

		public const string PLUGIN_VERSION = "1.0.4";
	}
	[HarmonyPatch(typeof(ValuableObject), "Discover")]
	internal static class ValuableObjectDiscoverPatch
	{
		private static bool Prefix(ValuableObject __instance, State _state)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			if ((int)_state == 2)
			{
				return true;
			}
			DaxMug daxMug = default(DaxMug);
			if (((Component)__instance).TryGetComponent<DaxMug>(ref daxMug))
			{
				daxMug.DiscoverScare();
				__instance.Discover((State)2);
				return false;
			}
			return true;
		}
	}
	[BepInPlugin("StarTrekValuables", "StarTrekValuables", "1.0.4")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal static Harmony harmony;

		internal static Plugin Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		private void Awake()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			Logger = Logger.CreateLogSource("StarTrekValuables");
			Logger.LogInfo((object)"Plugin StarTrekValuables awake!");
			harmony = new Harmony("StarTrekValuables");
			harmony.PatchAll();
			BundleLoader.LoadBundle(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location), "StarTrekValuables_assets"), "");
			ConfigManager.Initialize(((BaseUnityPlugin)this).Config);
		}
	}
	public class CameraFacing : MonoBehaviour
	{
		public Transform RootTransform;

		public MeshRenderer Hologram;

		private Material hologramMaterial;

		private void Start()
		{
			if ((Object)(object)RootTransform == (Object)null)
			{
				RootTransform = ((Component)this).gameObject.transform.parent.parent;
			}
			hologramMaterial = ((Renderer)Hologram).material;
		}

		private void Update()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0020: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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_00b7: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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)
			Vector3 val = PlayerAvatar.instance.localCameraTransform.position - ((Component)this).transform.position;
			val -= Vector3.Project(val, RootTransform.up);
			if (((Vector3)(ref val)).sqrMagnitude > 0.001f)
			{
				Quaternion rotation = Quaternion.LookRotation(val, RootTransform.up);
				((Component)this).transform.rotation = rotation;
			}
			float num = Mathf.Abs(Vector3.Dot(val, ((Component)Hologram).transform.up));
			num = Mathf.Clamp(Mathf.Pow(num, 0.7f) + 0.05f, 0f, 1f);
			hologramMaterial.color = new Color(1f, 1f, 1f, num);
		}
	}
	public class MasakaMask : MonoBehaviour
	{
		private enum State
		{
			Idle,
			Active
		}

		private PhysGrabObject physGrabObject;

		private State currentState;

		private float coolDownUntilNextSentence = 3f;

		[SerializeField]
		private List<string> phrases = new List<string>();

		private int lastPhraseIndex = -1;

		private FieldInfo grabbedPhysGrabObjectField;

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

		private void Update()
		{
			if (grabbedPhysGrabObjectField == null)
			{
				grabbedPhysGrabObjectField = AccessTools.Field(typeof(PhysGrabber), "grabbedPhysGrabObject");
			}
			if (currentState == State.Idle)
			{
				StateIdle();
			}
			if (currentState == State.Active)
			{
				StateActive();
			}
		}

		private void StateIdle()
		{
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			if (coolDownUntilNextSentence > 0f && physGrabObject.grabbed)
			{
				coolDownUntilNextSentence -= Time.deltaTime;
			}
			else if (!((Object)(object)PhysGrabber.instance == (Object)null) && !(grabbedPhysGrabObjectField == null))
			{
				object? value = grabbedPhysGrabObjectField.GetValue(PhysGrabber.instance);
				PhysGrabObject val = (PhysGrabObject)((value is PhysGrabObject) ? value : null);
				if (PhysGrabber.instance.grabbed && (Object)(object)val != (Object)null && (Object)(object)val == (Object)(object)physGrabObject)
				{
					string text = PickMessage();
					currentState = State.Active;
					Color val2 = default(Color);
					((Color)(ref val2))..ctor(1f, 1f, 1f, 1f);
					ChatManager.instance.PossessChatScheduleStart(10);
					ChatManager.instance.PossessChat((PossessChatID)1, text, 1f, val2, 0f, false, 0, (UnityEvent)null);
					ChatManager.instance.PossessChatScheduleEnd();
				}
			}
		}

		private void StateActive()
		{
			if (!(grabbedPhysGrabObjectField == null))
			{
				object? value = grabbedPhysGrabObjectField.GetValue(PhysGrabber.instance);
				PhysGrabObject val = (PhysGrabObject)((value is PhysGrabObject) ? value : null);
				if (PhysGrabber.instance.grabbed && Object.op_Implicit((Object)(object)val) && (Object)(object)val != (Object)(object)physGrabObject)
				{
					currentState = State.Idle;
					coolDownUntilNextSentence = Random.Range(5f, 15f);
				}
				else if (!ChatManager.instance.StateIsPossessed())
				{
					currentState = State.Idle;
					coolDownUntilNextSentence = Random.Range(5f, 15f);
				}
			}
		}

		private string PickMessage()
		{
			int num;
			for (num = Random.Range(0, phrases.Count); num == lastPhraseIndex; num = Random.Range(0, phrases.Count))
			{
			}
			lastPhraseIndex = num;
			return phrases[num];
		}
	}
	public class PhotonTorpedoValuable : MonoBehaviour
	{
		private ParticleScriptExplosion particleScriptExplosion;

		private PhysGrabObjectImpactDetector physGrabObjectImpactDetector;

		private ValuableObject valuableObject;

		public Sound AlarmSound;

		private bool triggered;

		public Transform Center;

		private void Start()
		{
			particleScriptExplosion = ((Component)this).GetComponent<ParticleScriptExplosion>();
			physGrabObjectImpactDetector = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>();
			valuableObject = ((Component)this).GetComponent<ValuableObject>();
		}

		private void Update()
		{
			if (!triggered)
			{
				CheckIfHealthLow();
			}
		}

		public void CheckIfHealthLow()
		{
			if (!triggered && Object.op_Implicit((Object)(object)valuableObject) && valuableObject.dollarValueCurrent < valuableObject.dollarValueOriginal * 0.4f && (!Object.op_Implicit((Object)(object)valuableObject) || valuableObject.dollarValueCurrent != 100f))
			{
				triggered = true;
				((MonoBehaviour)this).StartCoroutine(Countdown());
			}
		}

		private IEnumerator Countdown()
		{
			yield return (object)new WaitForSeconds(1f);
			AlarmSound.Play(Center.position, 1f, 1f, 1f, 1f);
			yield return (object)new WaitForSeconds(1f);
			AlarmSound.Play(Center.position, 1f, 1f, 1f, 1f);
			yield return (object)new WaitForSeconds(1f);
			AlarmSound.Play(Center.position, 1f, 1f, 1f, 1f);
			yield return (object)new WaitForSeconds(1f);
			AlarmSound.Play(Center.position, 1f, 1f, 1f, 1f);
			yield return (object)new WaitForSeconds(1f);
			physGrabObjectImpactDetector.DestroyObject(true);
		}

		public void Explode()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			particleScriptExplosion.Spawn(Center.position, 5f, 80, 50, 3f, false, false, 4f);
		}
	}
}
namespace StarTrekValuables.Scripts
{
	public class DaxMug : MonoBehaviour
	{
		private bool localSeen;

		private bool localSeenEffect;

		private float localSeenEffectTimer = 2f;

		public AudioClip seenSound;

		private PhysGrabObject physGrabObject;

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

		private void Update()
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			if (localSeenEffect)
			{
				localSeenEffectTimer -= Time.deltaTime;
				CameraZoom.Instance.OverrideZoomSet(75f, 0.1f, 0.25f, 0.25f, ((Component)this).gameObject, 150);
				PostProcessing.Instance.VignetteOverride(Color.black, 0.4f, 1f, 1f, 0.5f, 0.1f, ((Component)this).gameObject);
				PostProcessing.Instance.SaturationOverride(-50f, 1f, 0.5f, 0.1f, ((Component)this).gameObject);
				PostProcessing.Instance.ContrastOverride(5f, 1f, 0.5f, 0.1f, ((Component)this).gameObject);
				GameDirector.instance.CameraImpact.Shake(10f * Time.deltaTime, 0.1f);
				GameDirector.instance.CameraShake.Shake(10f * Time.deltaTime, 1f);
				if (localSeenEffectTimer <= 0f)
				{
					localSeenEffect = false;
				}
			}
		}

		public void DiscoverScare()
		{
			localSeenEffect = true;
			CameraGlitch.Instance.PlayLong();
			GameDirector.instance.CameraImpact.Shake(2f, 0.5f);
			GameDirector.instance.CameraShake.Shake(2f, 1f);
			localSeen = true;
			AudioScare.instance.PlayCustom(seenSound, 0.3f, 60f);
		}
	}
}