Decompiled source of ShowPromoteButton v1.0.1

ShowPromoteButtonNew.dll

Decompiled 2 days ago
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using RoR2;
using RoR2.UI;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[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: AssemblyCompany("ShowPromoteButtonNew")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ShowPromoteButtonNew")]
[assembly: AssemblyTitle("ShowPromoteButtonNew")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ShowPromoteButtonNew;

[BepInPlugin("dazechr.showpromotebutton", "Show Promote Button Mod", "1.0.0")]
public class ShowPromoteButtonMod : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("dazechr.showpromotebutton");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"ShowPromoteButtonMod loaded correctly!");
	}
}
[HarmonyPatch(typeof(LobbyUserListElement), "RefreshCrownAndPromoteButton")]
public static class RefreshCrownAndPromoteButtonPatch
{
	public static void Postfix(LobbyUserListElement __instance)
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: Expected O, but got Unknown
		if (!PlatformSystems.lobbyManager.ownsLobby)
		{
			return;
		}
		bool flag = PlatformSystems.lobbyManager.IsLobbyOwner(__instance.id);
		Transform obj = __instance.elementChildLocator.FindChild("PromoteButton");
		GameObject val = ((obj != null) ? ((Component)obj).gameObject : null);
		if (__instance.id == default(PlatformID) || !Object.op_Implicit((Object)(object)val))
		{
			return;
		}
		val.SetActive(!flag);
		if (flag)
		{
			return;
		}
		MPButton component = val.GetComponent<MPButton>();
		if (Object.op_Implicit((Object)(object)component))
		{
			((UnityEventBase)((Button)component).onClick).RemoveAllListeners();
			((UnityEvent)((Button)component).onClick).AddListener((UnityAction)delegate
			{
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				Console.instance.SubmitCmd((NetworkUser)null, string.Format(CultureInfo.InvariantCulture, "steam_lobby_assign_owner {0}", __instance.id), false);
			});
		}
	}
}