Decompiled source of MeFiuValuables v1.2.1

MeFiuValuables.dll

Decompiled 9 hours 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;
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: AssemblyCompany("MeFiu Dywan")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MeFiuValuables")]
[assembly: AssemblyTitle("MeFiuValuables")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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]
	[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 FarelkaTrap : Trap
{
	public enum States
	{
		Idle,
		Active
	}

	public UnityEvent fanTimer;

	public Transform fanButton;

	public HurtCollider hurtCollider;

	public MeshRenderer buttonMesh;

	private float initialPlayerHitForce;

	private float initialPhysHitForce;

	private float initialEnemyHitForce;

	[Header("Fan Blade")]
	public Transform fanBlades;

	public AnimationCurve fanBladeSpeedCurve;

	private PhysGrabObject physgrabobject;

	private float fanBladeSpeed;

	private float fanBladeMaxSpeed = 1500f;

	private float fanBladeLerp;

	private float secondsToStart = 2f;

	private float secondsToStop = 4f;

	internal States currentState;

	private bool stateStart;

	[Header("Sounds")]
	public Sound sfxButtonOn;

	public Sound sfxButtonOff;

	public Sound sfxFanLoop;

	[Header("Particles")]
	public ParticleSystem windParticles;

	public ParticleSystem windSmallParticles;

	public override void Start()
	{
		((Trap)this).Start();
		((Component)hurtCollider).gameObject.SetActive(false);
		physgrabobject = ((Component)this).GetComponent<PhysGrabObject>();
		base.photonView = ((Component)this).GetComponent<PhotonView>();
		initialPlayerHitForce = hurtCollider.playerHitForce;
		initialPhysHitForce = hurtCollider.physHitForce;
		initialEnemyHitForce = hurtCollider.enemyHitForce;
	}

	private void FixedUpdate()
	{
	}

	public override void Update()
	{
		((Trap)this).Update();
		switch (currentState)
		{
		case States.Active:
			StateActive();
			break;
		case States.Idle:
			StateIdle();
			break;
		}
		((Component)hurtCollider).gameObject.SetActive(currentState == States.Active);
		sfxFanLoop.PlayLoop(currentState == States.Active, 0.1f, 0.025f, 1f, 1f);
		sfxFanLoop.LoopPitch = Mathf.Lerp(0.1f, 1f, fanBladeSpeedCurve.Evaluate(fanBladeLerp));
		hurtCollider.playerHitForce = Mathf.Lerp(0f, initialPlayerHitForce, fanBladeSpeedCurve.Evaluate(fanBladeLerp));
		hurtCollider.physHitForce = Mathf.Lerp(0f, initialPhysHitForce, fanBladeSpeedCurve.Evaluate(fanBladeLerp));
		hurtCollider.enemyHitForce = Mathf.Lerp(0f, initialEnemyHitForce, fanBladeSpeedCurve.Evaluate(fanBladeLerp));
		fanBladeSpeed = Mathf.Lerp(0f, fanBladeMaxSpeed, fanBladeSpeedCurve.Evaluate(fanBladeLerp));
	}

	private void StateActive()
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		if (stateStart)
		{
			sfxButtonOn.Play(physgrabobject.centerPoint, 1f, 1f, 1f, 1f);
			windParticles.Play();
			windSmallParticles.Play();
			((Renderer)buttonMesh).material.EnableKeyword("_EMISSION");
			fanTimer.Invoke();
			stateStart = false;
		}
		base.enemyInvestigate = true;
		if (SemiFunc.IsMasterClientOrSingleplayer() && !physgrabobject.grabbed)
		{
			SetState(States.Idle);
		}
		fanButton.localEulerAngles = new Vector3(21f, 0f, 0f);
		if (fanBladeLerp < 1f)
		{
			fanBladeLerp += Time.deltaTime / secondsToStart;
		}
	}

	private void StateIdle()
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		if (stateStart)
		{
			sfxButtonOff.Play(physgrabobject.centerPoint, 1f, 1f, 1f, 1f);
			windParticles.Stop();
			windSmallParticles.Stop();
			((Renderer)buttonMesh).material.DisableKeyword("_EMISSION");
			stateStart = false;
		}
		if (SemiFunc.IsMasterClientOrSingleplayer() && physgrabobject.grabbed)
		{
			SetState(States.Active);
		}
		fanButton.localEulerAngles = new Vector3(0f, 0f, 0f);
		if (fanBladeLerp > 0f)
		{
			fanBladeLerp -= Time.deltaTime / secondsToStop;
		}
	}

	[PunRPC]
	public void SetStateRPC(States state, PhotonMessageInfo _info = default(PhotonMessageInfo))
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		if (SemiFunc.MasterOnlyRPC(_info))
		{
			currentState = state;
			stateStart = true;
		}
	}

	private void SetState(States state)
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		if (SemiFunc.IsMasterClientOrSingleplayer())
		{
			if (!SemiFunc.IsMultiplayer())
			{
				SetStateRPC(state);
				return;
			}
			base.photonView.RPC("SetStateRPC", (RpcTarget)0, new object[1] { state });
		}
	}
}
public class MefiuModLightScript : MonoBehaviour
{
	private Light myLight;

	private int powerOfLight = 0;

	private bool goUp = true;

	private void Start()
	{
		myLight = ((Component)this).GetComponent<Light>();
	}

	private void Update()
	{
		if (goUp)
		{
			if (powerOfLight > 59)
			{
				goUp = false;
			}
			else
			{
				powerOfLight++;
			}
		}
		else if (powerOfLight < 1)
		{
			goUp = true;
		}
		else
		{
			powerOfLight--;
		}
		if ((Object)(object)myLight != (Object)null)
		{
			myLight.intensity = (float)((double)powerOfLight / 6.0);
		}
	}
}
namespace MeFiuValuables
{
	[HarmonyPatch(typeof(PlayerController))]
	internal static class ExamplePlayerControllerPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("Start")]
		private static void Start_Prefix(PlayerController __instance)
		{
			MeFiuValuables.Logger.LogDebug((object)$"{__instance} Start Prefix");
		}

		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		private static void Start_Postfix(PlayerController __instance)
		{
			MeFiuValuables.Logger.LogDebug((object)$"{__instance} Start Postfix");
		}
	}
	internal class Farelka
	{
		private void Awake()
		{
			BundleLoader.LoadBundle("your_assetbundle_file_path", (Action<AssetBundle>)delegate(AssetBundle assetBundle)
			{
				GameObject val = assetBundle.LoadAsset<GameObject>("Valuable Farelka");
				List<string> list = new List<string> { "Valuables - Arctic" };
				Valuables.RegisterValuable(val, list);
			}, false);
		}
	}
	[BepInPlugin("MeFiuDywan.MeFiuValuables", "MeFiuValuables", "1.1.3")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class MeFiuValuables : BaseUnityPlugin
	{
		internal static MeFiuValuables 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)"MeFiuValuables test code 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()
		{
		}
	}
	internal class TrappedMonster
	{
		private void Awake()
		{
			BundleLoader.LoadBundle("your_assetbundle_file_path", (Action<AssetBundle>)delegate(AssetBundle assetBundle)
			{
				GameObject val = assetBundle.LoadAsset<GameObject>("Valuable Trapped Monster");
				List<string> list = new List<string> { "Valuables - Wizard" };
				Valuables.RegisterValuable(val, list);
			}, false);
		}
	}
	internal class Volcano
	{
		private void Awake()
		{
			BundleLoader.LoadBundle("your_assetbundle_file_path", (Action<AssetBundle>)delegate(AssetBundle assetBundle)
			{
				GameObject val = assetBundle.LoadAsset<GameObject>("Valuable Farelka");
				List<string> list = new List<string> { "Valuables - Museum", "Valuables - Wizard" };
				Valuables.RegisterValuable(val, list);
			}, false);
		}
	}
	public class VolcanoPukeScript : MonoBehaviour
	{
		private SemiPuke Puke { get; set; }

		private void Start()
		{
		}

		private void Update()
		{
			if ((Object)(object)Puke != (Object)null)
			{
				Puke.StatePukeStart();
			}
		}
	}
}