Decompiled source of SteampunkItems v1.1.3

plugins/Steampunk_Items/SteampunkItems.dll

Decompiled a week ago
using System;
using System.Collections;
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 BepInEx;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using REPOLib.Modules;
using TMPro;
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: AssemblyCompany("s1ckboy")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyCopyright("Copyright © 2025 s1ckboy")]
[assembly: AssemblyFileVersion("1.1.3.0")]
[assembly: AssemblyInformationalVersion("1.1.3+1bf094100abd356d7b8e099ae319a17e89a7812a")]
[assembly: AssemblyProduct("SteampunkItems")]
[assembly: AssemblyTitle("SteampunkItems")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.3.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 Pickaxe : 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 (SemiFunc.IsMultiplayer())
		{
			if (isGrabbed != wasGrabbedOnPreviousUpdate)
			{
				_photonView.RPC("SetAnimationState", (RpcTarget)0, new object[1] { isGrabbed });
			}
		}
		else if (isGrabbed != wasGrabbedOnPreviousUpdate)
		{
			SetAnimationState(isGrabbed);
		}
		wasGrabbedOnPreviousUpdate = isGrabbed;
	}

	[PunRPC]
	public void SetAnimationState(bool grab)
	{
		if (grab)
		{
			animator.SetBool("Grab", true);
			animator.SetBool("Release", false);
		}
		else
		{
			animator.SetBool("Release", true);
			animator.SetBool("Grab", false);
		}
	}
}
namespace SteampunkItems
{
	[BepInPlugin("SteampunkItems", "SteampunkItems", "1.1.3")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugins : BaseUnityPlugin
	{
		private void Awake()
		{
			string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			string text = Path.Combine(directoryName, "steampunkitems");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			if ((Object)(object)val == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load SteampunkItems assetbundle.");
				return;
			}
			List<string> list = new List<string>(6) { "Valuable MagniGlass_SP", "Valuable Telescope_SP", "Valuable Stopwatch_SP", "Valuable HeadSet_SP", "Valuable Chronometer_SP", "Valuable Logpose_SP" };
			List<string> valuableAssetNames = new List<string>(1) { "Valuables - Generic" };
			foreach (string item in list)
			{
				RegisterValuable(val, item, valuableAssetNames);
			}
			List<string> list2 = new List<string>(1) { "Item Melee Pickaxe_SP" };
			foreach (string item2 in list2)
			{
				RegisterItem(val, item2);
			}
		}

		private void RegisterValuable(AssetBundle assetBundle, string valuableName, List<string> valuableAssetNames)
		{
			GameObject val = assetBundle.LoadAsset<GameObject>(valuableName);
			Valuables.RegisterValuable(val, valuableAssetNames);
		}

		private void RegisterItem(AssetBundle assetBundle, string itemName)
		{
			Item val = assetBundle.LoadAsset<Item>(itemName);
			Items.RegisterItem(val);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "SteampunkItems";

		public const string PLUGIN_NAME = "SteampunkItems";

		public const string PLUGIN_VERSION = "1.1.3";
	}
}
namespace SteampunkItems.Valuables_SP
{
	public class Headset : MonoBehaviour
	{
		public AudioSource audioSource;

		public List<ParticleSystem> particles = new List<ParticleSystem>();

		public List<AudioClip> songs = new List<AudioClip>();

		public AnimationCurve curveIntro;

		public AnimationCurve curveOutro;

		public Gradient topLeft;

		public Gradient topRight;

		public Gradient bottomLeft;

		public Gradient bottomRight;

		private PhotonView photonView;

		private PhysGrabObject physGrabObject;

		private ItemToggle toggle;

		private TextMeshPro prompt;

		private Vector3 dir;

		private Vector3 scale;

		private VertexGradient vg;

		private readonly float speed = 0.2f;

		private float gradientTime;

		private float showTimer;

		private float curveLerp;

		private int _currentSongIndex;

		private bool isPlaying;

		private bool isFirstGrab = true;

		private string promptInteract;

		private void Awake()
		{
			//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_002a: 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)
			prompt = ((Component)this).GetComponentInChildren<TextMeshPro>();
			vg = ((TMP_Text)prompt).colorGradient;
			scale = prompt.transform.localScale;
			promptInteract = InputManager.instance.InputDisplayReplaceTags("[interact]");
			toggle = ((Component)this).GetComponent<ItemToggle>();
			photonView = ((Component)this).GetComponent<PhotonView>();
			physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
		}

		private void Update()
		{
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: 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)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			if (physGrabObject.grabbed)
			{
				showTimer = 0.1f;
				if (physGrabObject.grabbedLocal)
				{
					audioSource.volume = 0.5f;
				}
				if (isFirstGrab)
				{
					toggle.toggleState = true;
					isFirstGrab = false;
				}
				ToggleAudio();
			}
			else
			{
				AudioSource obj = audioSource;
				obj.volume -= Time.deltaTime * 0.25f;
				audioSource.volume = Mathf.Max(audioSource.volume, 0.1f);
			}
			prompt.transform.forward = dir;
			dir = ((Component)PhysGrabber.instance).transform.forward;
			if (showTimer > 0f)
			{
				showTimer -= Time.deltaTime;
				curveLerp += 10f * Time.deltaTime;
				curveLerp = Mathf.Clamp01(curveLerp);
				prompt.transform.localScale = scale * curveIntro.Evaluate(curveLerp);
			}
			else
			{
				curveLerp -= 10f * Time.deltaTime;
				curveLerp = Mathf.Clamp01(curveLerp);
				prompt.transform.localScale = scale * curveOutro.Evaluate(curveLerp);
			}
		}

		private void SetRandomGradientCorners()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_00be: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)prompt == (Object)null))
			{
				vg.topLeft = topLeft.Evaluate((gradientTime + 0f) % 1f);
				vg.topRight = topRight.Evaluate((gradientTime + 0.25f) % 1f);
				vg.bottomLeft = bottomLeft.Evaluate((gradientTime + 0.5f) % 1f);
				vg.bottomRight = bottomRight.Evaluate((gradientTime + 0.75f) % 1f);
				((TMP_Text)prompt).colorGradient = vg;
			}
		}

		private void AnimateGlowHeartbeat()
		{
			//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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)prompt == (Object)null))
			{
				Material fontMaterial = ((TMP_Text)prompt).fontMaterial;
				fontMaterial.EnableKeyword("GLOW_ON");
				float num = 0.02f;
				float num2 = 0.2f;
				float num3 = num + (num2 - num) * (0.5f + 0.5f * Mathf.Sin(Time.time * 15f));
				fontMaterial.SetFloat("_GlowPower", num3);
				Color green = Color.green;
				Color val = green * num3;
				val.a = 1f;
				fontMaterial.SetColor("_GlowColor", val);
			}
		}

		private void ToggleAudio()
		{
			if (toggle.toggleState)
			{
				gradientTime += Time.deltaTime * speed;
				if (gradientTime > 1f)
				{
					gradientTime -= 1f;
				}
				SetRandomGradientCorners();
				AnimateGlowHeartbeat();
				((TMP_Text)prompt).enableVertexGradient = true;
				((TMP_Text)prompt).text = "Toggle music OFF [" + promptInteract + "]";
				int num = Random.Range(0, songs.Count);
				if (SemiFunc.IsMultiplayer())
				{
					photonView.RPC("PlaySongRPC", (RpcTarget)0, new object[1] { num });
				}
				else
				{
					PlaySongRPC(num);
				}
			}
			else if (!toggle.toggleState)
			{
				((TMP_Text)prompt).enableVertexGradient = false;
				((TMP_Text)prompt).text = "Toggle music ON [" + promptInteract + "]";
				isPlaying = false;
				StopParticles();
				audioSource.Stop();
			}
		}

		private void PlayParticles(int songIndex)
		{
			StopParticles();
			if (songIndex < particles.Count)
			{
				particles[songIndex].Play();
			}
		}

		private void StopParticles()
		{
			foreach (ParticleSystem particle in particles)
			{
				particle.Stop(true, (ParticleSystemStopBehavior)0);
			}
		}

		[PunRPC]
		private void PlaySongRPC(int songIndex)
		{
			if (!isPlaying)
			{
				isPlaying = true;
				audioSource.clip = songs[songIndex];
				audioSource.Play();
				_currentSongIndex = songIndex;
				PlayParticles(songIndex);
			}
		}
	}
	public class LogPose : MonoBehaviour
	{
		private PhotonView _photonView;

		private PhysGrabObject _physGrabObject;

		private Transform currentTarget;

		public Transform needle;

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

		private void Update()
		{
		}

		private void SetAndResetPos()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			if (_physGrabObject.grabbed)
			{
				ExtractionPoint val = SemiFunc.ExtractionPointGetNearest(needle.position);
				if (Object.op_Implicit((Object)(object)val))
				{
					currentTarget = ((Component)val).transform;
					SetTarget();
				}
			}
		}

		private void SetTarget()
		{
		}
	}
	public class MagniGlass : MonoBehaviour
	{
		public enum States
		{
			Idle,
			Active
		}

		[CompilerGenerated]
		private sealed class <ResetIndestructibleAfterDelay>d__15 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public float delay;

			public MagniGlass <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(delay);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>4__this._physGrabObject.OverrideIndestructible(0f);
					<>4__this._resetIndestructibleCoroutine = null;
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private PhotonView _photonView;

		private PhysGrabObject _physGrabObject;

		private Transform _forceGrabPoint;

		private bool _stateStart;

		private bool _wasGrabbedLastFrame = false;

		private int _ownerActorNumber = -1;

		private Coroutine _resetIndestructibleCoroutine;

		public States _currentState;

		private void Awake()
		{
			_photonView = ((Component)this).GetComponent<PhotonView>();
			_physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
			_forceGrabPoint = ((Component)this).transform.Find("Force Grab Point");
		}

		private void Update()
		{
			switch (_currentState)
			{
			case States.Idle:
				StateIdle();
				break;
			case States.Active:
				StateActive();
				break;
			}
		}

		private void StateIdle()
		{
			if (_stateStart)
			{
				_stateStart = false;
			}
			if (_physGrabObject.grabbedLocal)
			{
				SetState(States.Active);
			}
		}

		private void StateActive()
		{
			if (_stateStart)
			{
				_stateStart = false;
			}
			bool grabbedLocal = _physGrabObject.grabbedLocal;
			int actorNumber = PhotonNetwork.LocalPlayer.ActorNumber;
			if (grabbedLocal)
			{
				if (_ownerActorNumber != actorNumber)
				{
					_ownerActorNumber = actorNumber;
				}
				if (_resetIndestructibleCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(_resetIndestructibleCoroutine);
				}
				_physGrabObject.OverrideIndestructible(0.5f);
				_resetIndestructibleCoroutine = ((MonoBehaviour)this).StartCoroutine(ResetIndestructibleAfterDelay(0.5f));
			}
			if (grabbedLocal && _ownerActorNumber == actorNumber)
			{
				_physGrabObject.forceGrabPoint = _forceGrabPoint;
				if (SemiFunc.IsMultiplayer())
				{
					_photonView.RPC("ForcePosition", (RpcTarget)0, Array.Empty<object>());
				}
				else
				{
					ForcePosition();
				}
				PhysGrabber.instance.OverrideGrabDistance(0.5f);
				PlayerAvatar.instance.OverridePupilSize(3f, 4, 1f, 1f, 5f, 0.5f, 0.1f);
				CameraZoom.Instance.OverrideZoomSet(40f, 0.1f, 0.5f, 1f, ((Component)this).gameObject, 0);
			}
			if (!grabbedLocal && _wasGrabbedLastFrame && _ownerActorNumber == actorNumber)
			{
				_ownerActorNumber = -1;
			}
			if (!grabbedLocal)
			{
				SetState(States.Idle);
			}
			_wasGrabbedLastFrame = grabbedLocal;
		}

		private void SetState(States newState)
		{
			_currentState = newState;
			_stateStart = true;
		}

		[PunRPC]
		public void ForcePosition()
		{
			//IL_0010: 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_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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)
			Quaternion val = Quaternion.Euler(-30f, 0f, 10f);
			Quaternion val2 = Quaternion.Euler(50f, 180f, 0f);
			Quaternion identity = Quaternion.identity;
			if (0 == 0)
			{
				_physGrabObject.TurnXYZ(val, val2, identity);
			}
			_physGrabObject.OverrideGrabVerticalPosition(-0.24f);
		}

		[IteratorStateMachine(typeof(<ResetIndestructibleAfterDelay>d__15))]
		private IEnumerator ResetIndestructibleAfterDelay(float delay)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ResetIndestructibleAfterDelay>d__15(0)
			{
				<>4__this = this,
				delay = delay
			};
		}
	}
}
namespace SteampunkItems.Items_SP
{
	internal class Bombolver : MonoBehaviour
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}