Spin.dll

Decompiled a year 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.Configuration;
using Microsoft.CodeAnalysis;
using On.RoR2;
using RoR2;
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.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("Spin")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Spin")]
[assembly: AssemblyTitle("Spin")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Spin
{
	[BepInPlugin("HIFU.Spin", "Spin", "1.0.2")]
	public class Main : BaseUnityPlugin
	{
		public const string PluginGUID = "HIFU.Spin";

		public const string PluginAuthor = "HIFU";

		public const string PluginName = "Spin";

		public const string PluginVersion = "1.0.2";

		public static ConfigEntry<float> xSpinScale { get; private set; }

		public static ConfigEntry<float> ySpinSpeedMin { get; private set; }

		public static ConfigEntry<float> ySpinSpeedMax { get; private set; }

		public static ConfigEntry<float> zSpinScale { get; private set; }

		public static ConfigEntry<float> waveAmplitudeMin { get; private set; }

		public static ConfigEntry<float> waveAmplitudeMax { get; private set; }

		public static ConfigEntry<float> waveFrequencyMin { get; private set; }

		public static ConfigEntry<float> waveFrequencyMax { get; private set; }

		public void Awake()
		{
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Expected O, but got Unknown
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Expected O, but got Unknown
			xSpinScale = ((BaseUnityPlugin)this).Config.Bind<float>("Speeeen", "X Axis Spin Multiplier", 0.25f, "Multiplied from Y Axis Minimum Spin Speed and Y Axis Maximum Spin Speed. Vanilla is 0");
			ySpinSpeedMin = ((BaseUnityPlugin)this).Config.Bind<float>("Speeeen", "Y Axis Minimum Spin Speed", 300f, "Degrees Per Second. Random value between Min and Max. Vanilla is 75");
			ySpinSpeedMax = ((BaseUnityPlugin)this).Config.Bind<float>("Speeeen", "Y Axis Maximum Spin Speed", 600f, "Degrees Per Second. Random value between Min and Max. Vanilla is 75");
			zSpinScale = ((BaseUnityPlugin)this).Config.Bind<float>("Speeeen", "Z Axis Spin Multiplier", 0.25f, "Multiplied from Y Axis Minimum Spin Speed and Y Axis Maximum Spin Speed. Vanilla is 0");
			waveAmplitudeMin = ((BaseUnityPlugin)this).Config.Bind<float>("Waaaave", "Wave Amplitude Minimum", 0.7f, "Random value between Min and Max. Vanilla is 0.2");
			waveAmplitudeMax = ((BaseUnityPlugin)this).Config.Bind<float>("Waaaave", "Wave Amplitude Maximum", 1.5f, "Random value between Min and Max. Vanilla is 0.2");
			waveFrequencyMin = ((BaseUnityPlugin)this).Config.Bind<float>("Waaaave", "Wave Frequency Minimum", 0.4f, "Random value between Min and Max. Vanilla is 0.25");
			waveFrequencyMax = ((BaseUnityPlugin)this).Config.Bind<float>("Waaaave", "Wave Frequency Maximum", 0.8f, "Random value between Min and Max. Vanilla is 0.25");
			PickupDisplay.RebuildModel += new hook_RebuildModel(PickupDisplay_RebuildModel);
			PickupDisplay.Update += new hook_Update(PickupDisplay_Update);
		}

		private void PickupDisplay_Update(orig_Update orig, PickupDisplay self)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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)
			self.localTime += Time.deltaTime;
			if (Object.op_Implicit((Object)(object)self.modelObject))
			{
				Transform transform = self.modelObject.transform;
				Vector3 localEulerAngles = transform.localEulerAngles;
				localEulerAngles.y = self.spinSpeed * self.localTime;
				localEulerAngles.x = self.spinSpeed * xSpinScale.Value * self.localTime;
				localEulerAngles.z = self.spinSpeed * zSpinScale.Value * self.localTime;
				transform.localEulerAngles = localEulerAngles;
				transform.localPosition = self.localModelPivotPosition;
			}
		}

		private void PickupDisplay_RebuildModel(orig_RebuildModel orig, PickupDisplay self)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: 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)
			orig.Invoke(self);
			if (Object.op_Implicit((Object)(object)Run.instance))
			{
				self.spinSpeed = Run.instance.treasureRng.RangeFloat(ySpinSpeedMin.Value, ySpinSpeedMax.Value);
				self.verticalWave = new Wave
				{
					amplitude = Run.instance.treasureRng.RangeFloat(waveAmplitudeMin.Value, waveAmplitudeMax.Value),
					frequency = Run.instance.treasureRng.RangeFloat(waveFrequencyMin.Value, waveFrequencyMax.Value)
				};
			}
		}
	}
}