Decompiled source of SteampunkItems v1.1.1

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 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.1.0")]
[assembly: AssemblyInformationalVersion("1.1.1+6ed05521481336766375aff9bc053e50415ffd3e")]
[assembly: AssemblyProduct("SteampunkItems")]
[assembly: AssemblyTitle("SteampunkItems")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.1.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.1")]
	[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>(5) { "Valuable MagniGlass_SP", "Valuable Telescope_SP", "Valuable Stopwatch_SP", "Valuable HeadSet_SP", "Valuable Chronometer_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.1";
	}
}
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>();

		private PhotonView _photonView;

		private PhysGrabObject _physGrabObject;

		private int _currentSongIndex;

		private ItemToggle _toggle;

		private bool _isPlaying;

		private bool _isFirstGrab = true;

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

		private void Update()
		{
			if (_physGrabObject.grabbed)
			{
				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);
			}
		}

		private void ToggleAudio()
		{
			if (_toggle.toggleState)
			{
				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)
			{
				_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 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;

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

		public 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();
				}
				PlayerAvatar.instance.OverridePupilSize(3f, 4, 1f, 1f, 5f, 0.5f, 0.1f);
				CameraZoom.Instance.OverrideZoomSet(20f, 0.1f, 0.5f, 1f, ((Component)this).gameObject, 0);
			}
			if (!grabbedLocal && _wasGrabbedLastFrame && _ownerActorNumber == actorNumber)
			{
				_ownerActorNumber = -1;
			}
			if (!grabbedLocal)
			{
				SetState(States.Idle);
			}
			_wasGrabbedLastFrame = grabbedLocal;
		}

		public 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);
			PhysGrabber.instance.OverrideGrabDistance(0.5f);
		}

		[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
			};
		}
	}
	public class Mirror : MonoBehaviour
	{
		public Transform _mirrorPlane;

		public Material _mirrorMaterial;

		public MeshRenderer _mirrorRenderer;

		public Camera _mirrorCam;

		private Camera _playerCam;

		private RenderTexture _mirrorTexture;

		private Transform _rendererTransform;

		private Vector3 _originalRendererPos;

		private bool _rendererMoved = false;

		public void Start()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			_mirrorTexture = new RenderTexture(256, 256, 16, (RenderTextureFormat)0);
			_mirrorTexture.useMipMap = false;
			_mirrorTexture.antiAliasing = 2;
			((Texture)_mirrorTexture).wrapMode = (TextureWrapMode)1;
			((Texture)_mirrorTexture).filterMode = (FilterMode)1;
			((Object)_mirrorTexture).name = "MirrorRT_" + ((Object)((Component)this).gameObject).name;
			_mirrorTexture.Create();
			_playerCam = GameDirector.instance.MainCamera;
			_mirrorMaterial.SetTexture("_ReflectionTex", (Texture)(object)_mirrorTexture);
			_mirrorMaterial.SetFloat("_ReflectIntensity", 1f);
			_mirrorCam.targetTexture = _mirrorTexture;
			_mirrorCam.nearClipPlane = 0.05f;
			_mirrorCam.farClipPlane = 100f;
			_rendererTransform = ((Component)_mirrorRenderer).transform;
		}

		public void LateUpdate()
		{
			//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_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: 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_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_0046: 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)
			if (IsVisibleToCamera((Renderer)(object)_mirrorRenderer, _playerCam))
			{
				if (!_rendererMoved)
				{
					_originalRendererPos = _rendererTransform.position;
					_rendererTransform.position = Vector3.one * 9999f;
					_rendererMoved = true;
				}
				Vector3 val = ReflectPos(((Component)_playerCam).transform.position);
				Vector3 val2 = ReflectDir(((Component)_playerCam).transform.forward);
				Vector3 val3 = ReflectDir(((Component)_playerCam).transform.up);
				((Component)_mirrorCam).transform.SetPositionAndRotation(val, Quaternion.LookRotation(val2, val3));
				GL.invertCulling = true;
				_mirrorCam.Render();
				GL.invertCulling = false;
			}
		}

		public void OnPostRender()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			if (_rendererMoved)
			{
				_rendererTransform.position = _originalRendererPos;
				_rendererMoved = false;
			}
		}

		public Vector3 ReflectPos(Vector3 pos)
		{
			//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_000d: Unknown result type (might be due to invalid IL or missing references)
			//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_001e: 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_0026: 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)
			Vector3 forward = _mirrorPlane.forward;
			Vector3 val = pos - _mirrorPlane.position;
			return Vector3.Reflect(val, forward);
		}

		public Vector3 ReflectDir(Vector3 dir)
		{
			//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_000d: 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_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			Vector3 forward = _mirrorPlane.forward;
			return Vector3.Reflect(dir, forward);
		}

		public bool IsVisibleToCamera(Renderer rend, Camera cam)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			Plane[] array = GeometryUtility.CalculateFrustumPlanes(cam);
			return GeometryUtility.TestPlanesAABB(array, rend.bounds);
		}

		public void OnDestroy()
		{
			if ((Object)(object)_mirrorTexture != (Object)null)
			{
				_mirrorTexture.Release();
				Object.Destroy((Object)(object)_mirrorTexture);
			}
		}
	}
}
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)
		{
		}
	}
}