Decompiled source of AutomaticRematch v1.0.0

Mods/AutomaticRematch.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using AutomaticRematch;
using Il2CppRUMBLE.Interactions.InteractionBase;
using Il2CppRUMBLE.Networking.MatchFlow;
using MelonLoader;
using Microsoft.CodeAnalysis;
using RumbleModUI;
using RumbleModdingAPI;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Main), "AutomaticRematch", "1.0.0", "UlvakSkillz", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 195, 0, 255)]
[assembly: MelonAuthorColor(255, 195, 0, 255)]
[assembly: VerifyLoaderVersion(0, 6, 6, true)]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("AutomaticRematch")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AutomaticRematch")]
[assembly: AssemblyTitle("AutomaticRematch")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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]
	[Microsoft.CodeAnalysis.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;
		}
	}
}
namespace AutomaticRematch
{
	public class Main : MelonMod
	{
		public static class BuildInfo
		{
			public const string ModName = "AutomaticRematch";

			public const string ModVersion = "1.0.0";

			public const string Description = "Automatically Presses Rematch Button if On";

			public const string Author = "UlvakSkillz";

			public const string Company = "";
		}

		private string currentScene = "Loader";

		private Mod AutomaticRematch = new Mod();

		private bool enabled = true;

		private float timeToWait = 0f;

		private void Log(string msg)
		{
			MelonLogger.Msg(msg);
		}

		public override void OnLateInitializeMelon()
		{
			Calls.onMatchEnded += matchEnded;
			UI.instance.UI_Initialized += UIInit;
		}

		private void UIInit()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			AutomaticRematch.ModName = "AutomaticRematch";
			AutomaticRematch.ModVersion = "1.0.0";
			AutomaticRematch.SetFolder("AutomaticRematch");
			AutomaticRematch.AddToList("Auto Rematch", true, 0, "Automatically Presses Rematch Button if On", new Tags());
			AutomaticRematch.AddToList("Time before Pressing", 0f, "Time to wait before it Presses Rematch", new Tags());
			AutomaticRematch.ModSaved += Save;
			UI.instance.AddMod(AutomaticRematch);
		}

		public override void OnSceneWasLoaded(int buildIndex, string sceneName)
		{
			currentScene = sceneName;
		}

		private void Save()
		{
			enabled = (bool)AutomaticRematch.Settings[0].SavedValue;
			timeToWait = (float)AutomaticRematch.Settings[1].SavedValue;
		}

		private void matchEnded()
		{
			if (enabled)
			{
				MelonCoroutines.Start(MatchEnded());
			}
		}

		private IEnumerator MatchEnded()
		{
			GameObject myButton = (Players.IsHost() ? ((!(currentScene == "Map0")) ? Button.GetGameObject() : Button.GetGameObject()) : ((!(currentScene == "Map0")) ? Button.GetGameObject() : Button.GetGameObject()));
			yield return (object)new WaitForSeconds(timeToWait);
			((InteractionButton)myButton.GetComponent<RematchButton>()).RPC_OnToggleStateChanged(true);
		}
	}
}