using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.IL2CPP;
using BepInEx.Logging;
using CrabDevKit.Utilities;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using SteamworksNative;
using TMPro;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("Antro.FakePlayers")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Antro.FakePlayers")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Antro.FakePlayers")]
[assembly: AssemblyTitle("Antro.FakePlayers")]
[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;
}
}
}
namespace FakePlayersMod
{
[HarmonyPatch(typeof(PlayerInput), "Update")]
internal class FakePlayersPatch
{
internal static List<FakeClient> fakeClients = new List<FakeClient>();
private static void Postfix()
{
if (!MonoBehaviourPublicObInUIgaStCSBoStcuCSUnique.Instance.IsLobbyOwner())
{
return;
}
bool key = Input.GetKey((KeyCode)308);
bool key2 = Input.GetKey((KeyCode)304);
bool keyDown = Input.GetKeyDown((KeyCode)273);
bool keyDown2 = Input.GetKeyDown((KeyCode)274);
if (key && keyDown && !key2)
{
CreateFake();
}
else if (key && key2 && keyDown)
{
for (int i = 0; i < 20; i++)
{
CreateFake();
}
}
else if (key && keyDown2 && !key2)
{
RemoveLastFake();
}
else if (key && key2 && keyDown2)
{
for (int j = 0; j < 20; j++)
{
RemoveLastFake();
}
}
}
private static void CreateFake()
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
FakeClient val = FakeClients.Create((string)null, false, false);
if (val != null)
{
fakeClients.Add(val);
ManualLogSource log = ((BasePlugin)Plugin.Instance).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(13, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Created fake ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<ulong>(val.clientId);
}
log.LogInfo(val2);
}
}
private static void RemoveLastFake()
{
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Expected O, but got Unknown
FakeClient val = fakeClients.LastOrDefault();
if (val != null)
{
FakeClients.Remove(val);
fakeClients.Remove(val);
ManualLogSource log = ((BasePlugin)Plugin.Instance).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(13, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Removed fake ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<ulong>(val.clientId);
}
log.LogInfo(val2);
}
}
}
[HarmonyPatch(typeof(SteamMatchmaking), "LeaveLobby")]
internal class LeaveLobbyPatch
{
[HarmonyPostfix]
private static void Postfix()
{
FakePlayersPatch.fakeClients.Clear();
((BasePlugin)Plugin.Instance).Log.LogInfo((object)"Cleared local fake players list on LeaveLobby");
}
}
[HarmonyPatch(typeof(MonoBehaviourPublicTeplUnique), "UpdatePlayerCount")]
internal class PlayersInLobbyPatch
{
private static bool Prefix(MonoBehaviourPublicTeplUnique __instance)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: 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)
if (!Object.op_Implicit((Object)(object)MonoBehaviourPublicObInUIgaStCSBoStcuCSUnique.Instance))
{
return false;
}
CSteamID val = (CSteamID)MonoBehaviourPublicObInUIgaStCSBoStcuCSUnique.Instance.currentLobby.m_SteamID;
int numLobbyMembers = SteamMatchmaking.GetNumLobbyMembers(val);
int lobbyMemberLimit = SteamMatchmaking.GetLobbyMemberLimit(val);
int count = FakePlayersPatch.fakeClients.Count;
TextMeshProUGUI playerText = __instance.playerText;
if ((Object)(object)playerText != (Object)null)
{
((TMP_Text)playerText).text = $"({numLobbyMembers + count} / {lobbyMemberLimit})";
}
return false;
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Antro.FakePlayers", "Add Fake Players", "1.0.0")]
public sealed class Plugin : BasePlugin
{
internal static Plugin Instance { get; private set; }
public override void Load()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Expected O, but got Unknown
Instance = this;
Harmony val = new Harmony("Antro.FakePlayers");
val.PatchAll();
((BasePlugin)this).Log.LogInfo((object)"Loaded");
}
}
}