Decompiled source of FasterRewardWheel v1.0.1

MycoWheelMod.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MycoWheelMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MycoWheelMod")]
[assembly: AssemblyTitle("MycoWheelMod")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 MycoWheelMod
{
	[BepInPlugin("fynthedeer.fasterwheel", "Faster Reward Wheel", "1.3.0")]
	public class FasterWheelPlugin : BaseUnityPlugin
	{
		public static ConfigEntry<float> SpeedMultiplier;

		private void Awake()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			SpeedMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Speed", "SpeedMultiplier", 0.5f, new ConfigDescription("changes the speed of the wheel, lower makes it faster, but you can also use higher values to make it funny lol ranges from 0.2 to 20, recommended to be only 0.2 to 0.3 if you want faster.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.2f, 20f), (object[])null));
			new Harmony("fynthedeer.fasterwheel").PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Faster Reward Wheel loaded.");
		}
	}
	[HarmonyPatch(typeof(RewardSpinner))]
	[HarmonyPatch("StartSpin")]
	public static class RewardSpinner_StartSpin_Patch
	{
		private static void Prefix(object __instance)
		{
			try
			{
				FieldInfo fieldInfo = AccessTools.Field(__instance.GetType(), "spinDuration");
				if (!(fieldInfo == null))
				{
					float num = (float)fieldInfo.GetValue(__instance);
					float num2 = Mathf.Clamp(FasterWheelPlugin.SpeedMultiplier.Value, 0.3f, 1.5f);
					float num3 = Mathf.Max(0.25f, num * num2);
					fieldInfo.SetValue(__instance, num3);
				}
			}
			catch (Exception ex)
			{
				Logger.CreateLogSource("FasterWheel").LogError((object)ex);
			}
		}
	}
}