Decompiled source of VehicleOverloader v1.0.1

Mods/LimitlessVelocity.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BoneLib.BoneMenu;
using BoneLib.Notifications;
using HarmonyLib;
using Il2CppSLZ.Marrow;
using LimitlessVelocity;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Core), "Vehicle Overloader", "1.0.0", "Cirket", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("LimitlessVelocity")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+cc15ac8259271766f18361c96751452231e66abf")]
[assembly: AssemblyProduct("LimitlessVelocity")]
[assembly: AssemblyTitle("LimitlessVelocity")]
[assembly: NeutralResourcesLanguage("en-US")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LimitlessVelocity
{
	public class Core : MelonMod
	{
		[HarmonyPatch(typeof(Atv), "Start")]
		public static class AtvGoFastAsFuckBoiii
		{
			public static void Postfix(Atv __instance)
			{
				__instance.maxSpeed *= vehicleSpeedMultiplier;
				Melon<Core>.Logger.Msg("Overloaded " + ((Object)((Component)__instance).gameObject).name + "'s max speed.");
			}
		}

		public static float vehicleSpeedMultiplier = 2f;

		public static bool isEnabled;

		private static bool _preferencesSetup = false;

		public static MelonPreferences_Category MelonPrefCategory;

		public static MelonPreferences_Entry<bool> MelonPrefEnabled;

		public static MelonPreferences_Entry<float> VehicleSpeedSetting;

		public static Page mainPage;

		public static BoolElement enabledElement;

		public static FloatElement strengthElement;

		public override void OnInitializeMelon()
		{
			((MelonBase)this).LoggerInstance.Msg("LimitlessVelocity Initialized.");
			SetupMelonPrefs();
			SetupBoneMenu();
		}

		public static void SetupMelonPrefs()
		{
			MelonPrefCategory = MelonPreferences.CreateCategory("VehicleOverloader");
			MelonPrefEnabled = MelonPrefCategory.CreateEntry<bool>("isEnabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			VehicleSpeedSetting = MelonPrefCategory.CreateEntry<float>("Vehicle Speed Multiplier", vehicleSpeedMultiplier, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			isEnabled = MelonPrefEnabled.Value;
			vehicleSpeedMultiplier = VehicleSpeedSetting.Value;
			_preferencesSetup = true;
		}

		public override void OnPreferencesLoaded()
		{
			if (_preferencesSetup)
			{
				isEnabled = MelonPrefEnabled.Value;
				vehicleSpeedMultiplier = VehicleSpeedSetting.Value;
				enabledElement.Value = isEnabled;
				strengthElement.Value = vehicleSpeedMultiplier;
			}
		}

		public static void SetupBoneMenu()
		{
			//IL_000a: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			mainPage = Page.Root.CreatePage("Vehicle Overloader", Color.red, 0, true);
			enabledElement = mainPage.CreateBool("Enabled", Color.white, isEnabled, (Action<bool>)OnSetEnabled);
			strengthElement = mainPage.CreateFloat("Vehicle Speed Multiplier", Color.red, vehicleSpeedMultiplier, 0.5f, 0.5f, 100f, (Action<float>)OnSetStrength);
			mainPage.CreateFunction("Reset Preferences", Color.red, (Action)OnResetPreferences);
		}

		public static void OnSetStrength(float value)
		{
			vehicleSpeedMultiplier = value;
			VehicleSpeedSetting.Value = vehicleSpeedMultiplier;
			MelonPrefCategory.SaveToFile(false);
		}

		public static void OnSetEnabled(bool value)
		{
			isEnabled = value;
			MelonPrefEnabled.Value = isEnabled;
			MelonPrefCategory.SaveToFile(false);
		}

		public static void OnResetPreferences()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			vehicleSpeedMultiplier = 2f;
			VehicleSpeedSetting.Value = vehicleSpeedMultiplier;
			strengthElement.Value = vehicleSpeedMultiplier;
			MelonPrefCategory.SaveToFile(false);
			Notifier.Send(new Notification
			{
				PopupLength = 4f,
				Type = (NotificationType)0,
				ShowTitleOnPopup = true,
				Title = NotificationText.op_Implicit("Vehicle Overloader"),
				Message = NotificationText.op_Implicit("Preferences have been reset.")
			});
		}
	}
}