Decompiled source of ShowMoreLobbyPlayers v1.0.1

ShowMoreLobbyPlayers.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ShowMoreLobbyPlayers")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ShowMoreLobbyPlayers")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("6a8e4e9a-9b59-4cd1-989c-772712e6ecf9")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ShowMoreLobbyPlayers;

[BepInPlugin("com.repo.kr.ShowMoreLobbyPlayers", "ShowMoreLobbyPlayers", "1.0.0")]
public class ModBehaviour : BaseUnityPlugin
{
	[HarmonyPatch(typeof(MenuPlayerListed))]
	public class MenuPlayerListed_path
	{
		[HarmonyPatch("Update")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> Update_Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Expected O, but got Unknown
			List<CodeInstruction> list = instructions.ToList();
			bool flag = true;
			for (int i = 1; i < list.Count; i++)
			{
				if (list[i - 1].opcode == OpCodes.Newobj && list[i].opcode == OpCodes.Callvirt && list[i].operand is MethodInfo methodInfo && methodInfo.Name == "set_localPosition")
				{
					if (!flag)
					{
						Debug.Log((object)"find set_localPosition");
						list.Insert(i, new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(MenuPlayerListed_path), "setVector3", (Type[])null, (Type[])null)));
						break;
					}
					flag = false;
				}
			}
			return list;
		}

		private static Vector3 setVector3(Vector3 dataOriginal)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			int num = (int)(0f - dataOriginal.y) / 32;
			return new Vector3(LineGap.Value * (float)(num / ColumnMax.Value), 6f - (27f + ColumnGap.Value) * (float)(num % ColumnMax.Value), 0f);
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void Update_Postfix(MenuPlayerListed __instance)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			if (SemiFunc.RunIsLobbyMenu())
			{
				((Component)__instance).transform.localScale = new Vector3(Scale.Value, Scale.Value, Scale.Value);
			}
		}
	}

	private Harmony harmony;

	private static ManualLogSource Log;

	private static ConfigEntry<int> ColumnMax;

	private static ConfigEntry<float> ColumnGap;

	private static ConfigEntry<float> LineGap;

	private static ConfigEntry<float> Scale;

	private void Awake()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Expected O, but got Unknown
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Expected O, but got Unknown
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Expected O, but got Unknown
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Expected O, but got Unknown
		harmony = new Harmony("com.repo.kr.ShowMoreLobbyPlayers");
		harmony.PatchAll();
		ColumnMax = ((BaseUnityPlugin)this).Config.Bind<int>("ShowMoreLobbyPlayers", "ColumnMax", 7, new ConfigDescription("Maximum number per row", (AcceptableValueBase)(object)new AcceptableValueRange<int>(6, 10), Array.Empty<object>()));
		ColumnGap = ((BaseUnityPlugin)this).Config.Bind<float>("ShowMoreLobbyPlayers", "ColumnGap", 0f, new ConfigDescription("Column spacing", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-32f, 32f), Array.Empty<object>()));
		LineGap = ((BaseUnityPlugin)this).Config.Bind<float>("ShowMoreLobbyPlayers", "LineGap", 320f, new ConfigDescription("Line spacing", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 640f), Array.Empty<object>()));
		Scale = ((BaseUnityPlugin)this).Config.Bind<float>("ShowMoreLobbyPlayers", "Scale", 1f, new ConfigDescription("Scale player list", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>()));
		Log = ((BaseUnityPlugin)this).Logger;
		Log.LogInfo((object)"ShowMoreLobbyPlayers enble");
	}
}