

using System;
using System.Collections;
using System.Collections.Generic;
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 BiggerLobbies;
using BiggerLobbies.Integrations;
using HarmonyLib;
using Il2Cpp;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppScheduleOne.DevUtilities;
using Il2CppScheduleOne.Networking;
using Il2CppScheduleOne.UI.Multiplayer;
using Il2CppSteamworks;
using Il2CppSystem;
using Il2CppTMPro;
using MelonLoader;
using Microsoft.CodeAnalysis;
using UnityEngine;
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: MelonInfo(typeof(Core), "BiggerLobbies", "1.0.0", "Bars", null)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("BiggerLobbies_Il2cpp")]
[assembly: AssemblyConfiguration("Il2cpp")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BiggerLobbies_Il2cpp")]
[assembly: AssemblyTitle("BiggerLobbies_Il2cpp")]
[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]
[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;
}
}
[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;
}
}
}
namespace BiggerLobbies
{
public class Core : MelonMod
{
public static Core? Instance { get; private set; }
public override void OnInitializeMelon()
{
Instance = this;
HarmonyPatches.SetModInstance(this);
}
public override void OnApplicationQuit()
{
Instance = null;
}
}
}
namespace BiggerLobbies.Utils
{
public static class Constants
{
public static class Game
{
public const string GAME_STUDIO = "TVGS";
public const string GAME_NAME = "Schedule I";
}
public const string MOD_NAME = "BiggerLobbies";
public const string MOD_VERSION = "1.0.0";
public const string MOD_AUTHOR = "Bars";
public const int MAX_PLAYERS = 20;
}
}
namespace BiggerLobbies.Integrations
{
[HarmonyPatch]
public static class HarmonyPatches
{
[CompilerGenerated]
private sealed class <WaitForLobby>d__7 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public LobbyInterface lobbyInterface;
private Lobby <lobby>5__1;
private GridLayoutGroup <gridGroup>5__2;
private Transform <entries>5__3;
private int <slotCount>5__4;
private RectTransform[] <newSlots>5__5;
private CSteamID[] <newPlayers>5__6;
private int <copyLength>5__7;
private Transform <template>5__8;
private int <slotsToAdd>5__9;
private int <i>5__10;
private GameObject <newEntry>5__11;
private int <newIndex>5__12;
private int <j>5__13;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <WaitForLobby>d__7(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<lobby>5__1 = null;
<gridGroup>5__2 = null;
<entries>5__3 = null;
<newSlots>5__5 = null;
<newPlayers>5__6 = null;
<template>5__8 = null;
<newEntry>5__11 = null;
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
break;
}
if ((Object)(object)Singleton<Lobby>.Instance == (Object)null)
{
<>2__current = null;
<>1__state = 1;
return true;
}
<lobby>5__1 = Singleton<Lobby>.Instance;
if (((Il2CppArrayBase<CSteamID>)(object)<lobby>5__1.Players).Length != 20)
{
<newPlayers>5__6 = (CSteamID[])(object)new CSteamID[20];
<copyLength>5__7 = Math.Min(((Il2CppArrayBase<CSteamID>)(object)<lobby>5__1.Players).Length, 20);
Array.Copy(Il2CppArrayBase<CSteamID>.op_Implicit((Il2CppArrayBase<CSteamID>)(object)<lobby>5__1.Players), <newPlayers>5__6, <copyLength>5__7);
<lobby>5__1.Players = Il2CppStructArray<CSteamID>.op_Implicit(<newPlayers>5__6);
<newPlayers>5__6 = null;
}
if (!SteamManager.Initialized)
{
((Component)lobbyInterface).gameObject.SetActive(false);
return false;
}
<gridGroup>5__2 = ((Component)lobbyInterface).GetComponentInChildren<GridLayoutGroup>();
if ((Object)(object)<gridGroup>5__2 == (Object)null)
{
MelonLogger.Error("Could not find GridLayoutGroup in LobbyInterface");
return false;
}
<entries>5__3 = ((Component)<gridGroup>5__2).transform;
if (<entries>5__3.childCount > 1)
{
<template>5__8 = <entries>5__3.GetChild(1);
<slotsToAdd>5__9 = 16;
<i>5__10 = 0;
while (<i>5__10 < <slotsToAdd>5__9)
{
<newEntry>5__11 = Object.Instantiate<GameObject>(((Component)<template>5__8).gameObject, <entries>5__3);
<newIndex>5__12 = <entries>5__3.childCount - 1;
((Object)<newEntry>5__11).name = ((Object)((Component)<template>5__8).gameObject).name + " (" + <newIndex>5__12 + ")";
<newEntry>5__11 = null;
<i>5__10++;
}
<template>5__8.SetSiblingIndex(20);
<template>5__8 = null;
}
<slotCount>5__4 = <entries>5__3.childCount - 1;
<newSlots>5__5 = (RectTransform[])(object)new RectTransform[<slotCount>5__4];
<j>5__13 = 1;
while (<j>5__13 < <entries>5__3.childCount)
{
<newSlots>5__5[<j>5__13 - 1] = ((Component)<entries>5__3.GetChild(<j>5__13)).GetComponent<RectTransform>();
<j>5__13++;
}
lobbyInterface.PlayerSlots = Il2CppReferenceArray<RectTransform>.op_Implicit(<newSlots>5__5);
((TMP_Text)lobbyInterface.LobbyTitle).text = "Lobby (" + <lobby>5__1.PlayerCount + "/" + 20 + ")";
((Behaviour)lobbyInterface).enabled = true;
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private static Core? _modInstance;
public static void SetModInstance(Core modInstance)
{
_modInstance = modInstance;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Lobby), "Start")]
private static void Lobby_Start_Postfix(Lobby __instance)
{
try
{
if (((Il2CppArrayBase<CSteamID>)(object)__instance.Players).Length != 20)
{
CSteamID[] array = (CSteamID[])(object)new CSteamID[20];
int length = Math.Min(((Il2CppArrayBase<CSteamID>)(object)__instance.Players).Length, 20);
Array.Copy(Il2CppArrayBase<CSteamID>.op_Implicit((Il2CppArrayBase<CSteamID>)(object)__instance.Players), array, length);
__instance.Players = Il2CppStructArray<CSteamID>.op_Implicit(array);
}
}
catch (Exception arg)
{
MelonLogger.Error($"Failed to resize Lobby.Players array: {arg}");
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(Lobby), "CreateLobby")]
private static bool Lobby_CreateLobby_Prefix(Lobby __instance)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
try
{
SteamMatchmaking.CreateLobby((ELobbyType)1, 20);
return false;
}
catch (Exception arg)
{
MelonLogger.Error($"Failed to patch CreateLobby: {arg}");
return true;
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(Lobby), "TryOpenInviteInterface")]
private static bool Lobby_TryOpenInviteInterface_Prefix(Lobby __instance)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
try
{
if (!__instance.IsInLobby)
{
MelonLogger.Msg("Not currently in a lobby, creating one...");
SteamMatchmaking.CreateLobby((ELobbyType)1, 20);
}
int numLobbyMembers = SteamMatchmaking.GetNumLobbyMembers(__instance.LobbySteamID);
if (numLobbyMembers >= 20)
{
MelonLogger.Warning("Lobby already at max capacity!");
return false;
}
SteamFriends.ActivateGameOverlayInviteDialog(__instance.LobbySteamID);
return false;
}
catch (Exception arg)
{
MelonLogger.Error($"Failed to patch TryOpenInviteInterface: {arg}");
return true;
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Lobby), "OnLobbyCreated")]
private static void Lobby_OnLobbyCreated_Postfix(Lobby __instance, LobbyCreated_t result)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Invalid comparison between Unknown and I4
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
try
{
if ((int)result.m_eResult == 1)
{
CSteamID val = (CSteamID)result.m_ulSteamIDLobby;
string text = 20.ToString();
SteamMatchmaking.SetLobbyData(val, "max_players", text);
SteamMatchmaking.SetLobbyData(val, "num_slots", text);
MelonLogger.Msg($"Set lobby max_players and num_slots to {20}");
}
}
catch (Exception arg)
{
MelonLogger.Error($"Failed to set lobby max_players/num_slots: {arg}");
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(LobbyInterface), "Awake")]
private static void LobbyInterface_Awake_Postfix(LobbyInterface __instance)
{
try
{
if (_modInstance != null)
{
MelonCoroutines.Start(WaitForLobby(__instance));
}
}
catch (Exception arg)
{
MelonLogger.Error($"Failed to start WaitForLobby coroutine: {arg}");
}
}
[IteratorStateMachine(typeof(<WaitForLobby>d__7))]
private static IEnumerator WaitForLobby(LobbyInterface lobbyInterface)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <WaitForLobby>d__7(0)
{
lobbyInterface = lobbyInterface
};
}
[HarmonyPostfix]
[HarmonyPatch(typeof(LobbyInterface), "Awake")]
private static void LobbyInterface_Awake_Postfix_UpdateTitle(LobbyInterface __instance)
{
try
{
if (!((Object)(object)__instance.Lobby != (Object)null))
{
return;
}
Action originalDelegate = __instance.Lobby.onLobbyChange;
__instance.Lobby.onLobbyChange = null;
__instance.Lobby.onLobbyChange = Action.op_Implicit((Action)delegate
{
if ((Delegate)(object)originalDelegate != (Delegate)null)
{
originalDelegate.Invoke();
}
else
{
__instance.UpdateButtons();
__instance.UpdatePlayers();
}
((TMP_Text)__instance.LobbyTitle).text = "Lobby (" + __instance.Lobby.PlayerCount + "/" + 20 + ")";
});
}
catch (Exception arg)
{
MelonLogger.Error($"Failed to patch onLobbyChange delegate: {arg}");
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(LobbyInterface), "UpdateButtons")]
private static void LobbyInterface_UpdateButtons_Postfix(LobbyInterface __instance)
{
try
{
((Component)__instance.InviteButton).gameObject.SetActive(__instance.Lobby.IsHost && __instance.Lobby.PlayerCount < 20);
}
catch (Exception arg)
{
MelonLogger.Error($"Failed to patch UpdateButtons: {arg}");
}
}
}
}using System;
using System.Collections;
using System.Collections.Generic;
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 BiggerLobbies;
using BiggerLobbies.Integrations;
using HarmonyLib;
using MelonLoader;
using Microsoft.CodeAnalysis;
using ScheduleOne.DevUtilities;
using ScheduleOne.Networking;
using ScheduleOne.UI.Multiplayer;
using Steamworks;
using TMPro;
using UnityEngine;
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: MelonInfo(typeof(Core), "BiggerLobbies", "1.0.0", "Bars", null)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("BiggerLobbies_Mono")]
[assembly: AssemblyConfiguration("Mono")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BiggerLobbies_Mono")]
[assembly: AssemblyTitle("BiggerLobbies_Mono")]
[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]
[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;
}
}
[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;
}
}
}
namespace BiggerLobbies
{
public class Core : MelonMod
{
public static Core? Instance { get; private set; }
public override void OnInitializeMelon()
{
Instance = this;
HarmonyPatches.SetModInstance(this);
}
public override void OnApplicationQuit()
{
Instance = null;
}
}
}
namespace BiggerLobbies.Utils
{
public static class Constants
{
public static class Game
{
public const string GAME_STUDIO = "TVGS";
public const string GAME_NAME = "Schedule I";
}
public const string MOD_NAME = "BiggerLobbies";
public const string MOD_VERSION = "1.0.0";
public const string MOD_AUTHOR = "Bars";
public const int MAX_PLAYERS = 20;
}
}
namespace BiggerLobbies.Integrations
{
[HarmonyPatch]
public static class HarmonyPatches
{
[CompilerGenerated]
private sealed class <WaitForLobby>d__7 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public LobbyInterface lobbyInterface;
private Lobby <lobby>5__1;
private GridLayoutGroup <gridGroup>5__2;
private Transform <entries>5__3;
private int <slotCount>5__4;
private RectTransform[] <newSlots>5__5;
private CSteamID[] <newPlayers>5__6;
private int <copyLength>5__7;
private Transform <template>5__8;
private int <slotsToAdd>5__9;
private int <i>5__10;
private GameObject <newEntry>5__11;
private int <newIndex>5__12;
private int <j>5__13;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <WaitForLobby>d__7(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<lobby>5__1 = null;
<gridGroup>5__2 = null;
<entries>5__3 = null;
<newSlots>5__5 = null;
<newPlayers>5__6 = null;
<template>5__8 = null;
<newEntry>5__11 = null;
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
break;
}
if ((Object)(object)Singleton<Lobby>.Instance == (Object)null)
{
<>2__current = null;
<>1__state = 1;
return true;
}
<lobby>5__1 = Singleton<Lobby>.Instance;
if (<lobby>5__1.Players.Length != 20)
{
<newPlayers>5__6 = (CSteamID[])(object)new CSteamID[20];
<copyLength>5__7 = Math.Min(<lobby>5__1.Players.Length, 20);
Array.Copy(<lobby>5__1.Players, <newPlayers>5__6, <copyLength>5__7);
<lobby>5__1.Players = <newPlayers>5__6;
<newPlayers>5__6 = null;
}
if (!SteamManager.Initialized)
{
((Component)lobbyInterface).gameObject.SetActive(false);
return false;
}
<gridGroup>5__2 = ((Component)lobbyInterface).GetComponentInChildren<GridLayoutGroup>();
if ((Object)(object)<gridGroup>5__2 == (Object)null)
{
MelonLogger.Error("Could not find GridLayoutGroup in LobbyInterface");
return false;
}
<entries>5__3 = ((Component)<gridGroup>5__2).transform;
if (<entries>5__3.childCount > 1)
{
<template>5__8 = <entries>5__3.GetChild(1);
<slotsToAdd>5__9 = 16;
<i>5__10 = 0;
while (<i>5__10 < <slotsToAdd>5__9)
{
<newEntry>5__11 = Object.Instantiate<GameObject>(((Component)<template>5__8).gameObject, <entries>5__3);
<newIndex>5__12 = <entries>5__3.childCount - 1;
((Object)<newEntry>5__11).name = ((Object)((Component)<template>5__8).gameObject).name + " (" + <newIndex>5__12 + ")";
<newEntry>5__11 = null;
<i>5__10++;
}
<template>5__8.SetSiblingIndex(20);
<template>5__8 = null;
}
<slotCount>5__4 = <entries>5__3.childCount - 1;
<newSlots>5__5 = (RectTransform[])(object)new RectTransform[<slotCount>5__4];
<j>5__13 = 1;
while (<j>5__13 < <entries>5__3.childCount)
{
<newSlots>5__5[<j>5__13 - 1] = ((Component)<entries>5__3.GetChild(<j>5__13)).GetComponent<RectTransform>();
<j>5__13++;
}
lobbyInterface.PlayerSlots = <newSlots>5__5;
((TMP_Text)lobbyInterface.LobbyTitle).text = "Lobby (" + <lobby>5__1.PlayerCount + "/" + 20 + ")";
((Behaviour)lobbyInterface).enabled = true;
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private static Core? _modInstance;
public static void SetModInstance(Core modInstance)
{
_modInstance = modInstance;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Lobby), "Start")]
private static void Lobby_Start_Postfix(Lobby __instance)
{
try
{
if (__instance.Players.Length != 20)
{
CSteamID[] array = (CSteamID[])(object)new CSteamID[20];
int length = Math.Min(__instance.Players.Length, 20);
Array.Copy(__instance.Players, array, length);
__instance.Players = array;
}
}
catch (Exception arg)
{
MelonLogger.Error($"Failed to resize Lobby.Players array: {arg}");
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(Lobby), "CreateLobby")]
private static bool Lobby_CreateLobby_Prefix(Lobby __instance)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
try
{
SteamMatchmaking.CreateLobby((ELobbyType)1, 20);
return false;
}
catch (Exception arg)
{
MelonLogger.Error($"Failed to patch CreateLobby: {arg}");
return true;
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(Lobby), "TryOpenInviteInterface")]
private static bool Lobby_TryOpenInviteInterface_Prefix(Lobby __instance)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
try
{
if (!__instance.IsInLobby)
{
MelonLogger.Msg("Not currently in a lobby, creating one...");
SteamMatchmaking.CreateLobby((ELobbyType)1, 20);
}
int numLobbyMembers = SteamMatchmaking.GetNumLobbyMembers(__instance.LobbySteamID);
if (numLobbyMembers >= 20)
{
MelonLogger.Warning("Lobby already at max capacity!");
return false;
}
SteamFriends.ActivateGameOverlayInviteDialog(__instance.LobbySteamID);
return false;
}
catch (Exception arg)
{
MelonLogger.Error($"Failed to patch TryOpenInviteInterface: {arg}");
return true;
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Lobby), "OnLobbyCreated")]
private static void Lobby_OnLobbyCreated_Postfix(Lobby __instance, LobbyCreated_t result)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Invalid comparison between Unknown and I4
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
try
{
if ((int)result.m_eResult == 1)
{
CSteamID val = (CSteamID)result.m_ulSteamIDLobby;
string text = 20.ToString();
SteamMatchmaking.SetLobbyData(val, "max_players", text);
SteamMatchmaking.SetLobbyData(val, "num_slots", text);
MelonLogger.Msg($"Set lobby max_players and num_slots to {20}");
}
}
catch (Exception arg)
{
MelonLogger.Error($"Failed to set lobby max_players/num_slots: {arg}");
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(LobbyInterface), "Awake")]
private static void LobbyInterface_Awake_Postfix(LobbyInterface __instance)
{
try
{
if (_modInstance != null)
{
MelonCoroutines.Start(WaitForLobby(__instance));
}
}
catch (Exception arg)
{
MelonLogger.Error($"Failed to start WaitForLobby coroutine: {arg}");
}
}
[IteratorStateMachine(typeof(<WaitForLobby>d__7))]
private static IEnumerator WaitForLobby(LobbyInterface lobbyInterface)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <WaitForLobby>d__7(0)
{
lobbyInterface = lobbyInterface
};
}
[HarmonyPostfix]
[HarmonyPatch(typeof(LobbyInterface), "Awake")]
private static void LobbyInterface_Awake_Postfix_UpdateTitle(LobbyInterface __instance)
{
try
{
if (!((Object)(object)__instance.Lobby != (Object)null))
{
return;
}
Action originalDelegate = __instance.Lobby.onLobbyChange;
__instance.Lobby.onLobbyChange = null;
__instance.Lobby.onLobbyChange = delegate
{
if (originalDelegate != null)
{
originalDelegate();
}
else
{
__instance.UpdateButtons();
__instance.UpdatePlayers();
}
((TMP_Text)__instance.LobbyTitle).text = "Lobby (" + __instance.Lobby.PlayerCount + "/" + 20 + ")";
};
}
catch (Exception arg)
{
MelonLogger.Error($"Failed to patch onLobbyChange delegate: {arg}");
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(LobbyInterface), "UpdateButtons")]
private static void LobbyInterface_UpdateButtons_Postfix(LobbyInterface __instance)
{
try
{
((Component)__instance.InviteButton).gameObject.SetActive(__instance.Lobby.IsHost && __instance.Lobby.PlayerCount < 20);
}
catch (Exception arg)
{
MelonLogger.Error($"Failed to patch UpdateButtons: {arg}");
}
}
}
}