Decompiled source of SBG EZLobbyLink v1.0.0

SBG-EZLobbyLink.dll

Decompiled a day 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 Microsoft.CodeAnalysis;
using Steamworks;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("GameAssembly")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SBG-EZLobbyLink")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0")]
[assembly: AssemblyProduct("EZ Lobby Link")]
[assembly: AssemblyTitle("SBG-EZLobbyLink")]
[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;
		}
	}
}
[BepInPlugin("com.kingcox.sbg.ezlobbylink", "SBG EZ Lobby Link", "1.0.2")]
public class LobbyCopierMod : BaseUnityPlugin
{
	private const string AppId = "4069520";

	private string _statusMessage = "";

	private float _messageTimer = 0f;

	private void OnGUI()
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Expected O, but got Unknown
		//IL_0024: 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_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Expected O, but got Unknown
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		if (PauseMenu.IsPaused)
		{
			GUIStyle val = new GUIStyle(GUI.skin.button);
			val.normal.textColor = Color.black;
			val.hover.textColor = Color.black;
			val.fontSize = 16;
			val.fontStyle = (FontStyle)1;
			Rect val2 = default(Rect);
			((Rect)(ref val2))..ctor(20f, (float)(Screen.height - 100), 240f, 40f);
			if (GUI.Button(val2, "Copy Steam Invite Link", val))
			{
				ExecuteCopy();
			}
			if (_messageTimer > Time.time)
			{
				GUIStyle val3 = new GUIStyle(GUI.skin.label)
				{
					fontSize = 16,
					fontStyle = (FontStyle)1
				};
				val3.normal.textColor = Color.yellow;
				GUI.Label(new Rect(25f, (float)(Screen.height - 150), 400f, 30f), _statusMessage, val3);
			}
		}
	}

	private void ExecuteCopy()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			SteamId steamId = SteamClient.SteamId;
			string arg = ((object)(SteamId)(ref steamId)).ToString();
			ulong num = 0uL;
			FieldInfo field = typeof(BNetworkManager).GetField("steamLobby", BindingFlags.Static | BindingFlags.NonPublic);
			if (field != null)
			{
				object value = field.GetValue(null);
				if (value != null)
				{
					PropertyInfo property = value.GetType().GetProperty("Value");
					object obj = ((property != null) ? property.GetValue(value) : value);
					if (obj != null)
					{
						PropertyInfo property2 = obj.GetType().GetProperty("Id");
						if (property2 != null)
						{
							object value2 = property2.GetValue(obj);
							PropertyInfo property3 = value2.GetType().GetProperty("Value");
							num = ((!(property3 != null)) ? ulong.Parse(value2.ToString()) : ((ulong)property3.GetValue(value2)));
						}
					}
				}
			}
			if (num != 0)
			{
				string text2 = (GUIUtility.systemCopyBuffer = string.Format("steam://joinlobby/{0}/{1}/{2}", "4069520", num, arg));
				_statusMessage = "Link Copied! ID: " + num;
				_messageTimer = Time.time + 4f;
				Debug.Log((object)("[LobbyCopier] Success! Copied: " + text2));
			}
			else
			{
				_statusMessage = "No Active Lobby Found (ID 0)";
				_messageTimer = Time.time + 4f;
			}
		}
		catch (Exception ex)
		{
			_statusMessage = "Reflection Error - Check Log";
			Debug.LogError((object)("[LobbyCopier] Error: " + ex.GetType().Name + " - " + ex.Message + "\n" + ex.StackTrace));
		}
	}
}
namespace EZLobbyLink
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "SBG-EZLobbyLink";

		public const string PLUGIN_NAME = "EZ Lobby Link";

		public const string PLUGIN_VERSION = "1.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}