using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem.Collections.Generic;
using Mirror;
using Steamworks;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("BigWalk.MoreLobbyInfo")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.4.0")]
[assembly: AssemblyInformationalVersion("0.1.4")]
[assembly: AssemblyProduct("Big Walk More Lobby Info")]
[assembly: AssemblyTitle("BigWalk.MoreLobbyInfo")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.4.0")]
[module: UnverifiableCode]
namespace BigWalk.MoreLobbyInfo;
public class LobbyInfoController : MonoBehaviour
{
private readonly Dictionary<int, string> _known = new Dictionary<int, string>();
private bool _seeded;
private float _nextRefresh;
private readonly List<TrackedPlayer> _board = new List<TrackedPlayer>();
private static readonly Color JoinAccent = new Color(0.22f, 0.48f, 0.28f);
private static readonly Color LeaveAccent = new Color(0.62f, 0.22f, 0.18f);
private void Update()
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
try
{
if (Time.unscaledTime >= _nextRefresh)
{
_nextRefresh = Time.unscaledTime + 0.35f;
RefreshPlayers();
}
}
catch (Exception ex)
{
ManualLogSource log = Plugin.Log;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(29, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("MoreLobbyInfo Update failed: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
}
log.LogError(val);
}
}
private void OnGUI()
{
//IL_000a: 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_0034: Expected O, but got Unknown
try
{
ToastHud.Draw();
if (Input.GetKey(Plugin.ScoreboardKey.Value))
{
ScoreboardHud.Draw(_board);
}
}
catch (Exception ex)
{
ManualLogSource log = Plugin.Log;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(28, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("MoreLobbyInfo OnGUI failed: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
}
log.LogError(val);
}
}
private void RefreshPlayers()
{
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
List<PlayerCharacter> players = PlayerUtil.GetPlayers();
HashSet<int> hashSet = new HashSet<int>();
_board.Clear();
foreach (PlayerCharacter item in players)
{
if (!((Object)(object)item == (Object)null))
{
int instanceID;
try
{
instanceID = ((Object)item).GetInstanceID();
}
catch
{
continue;
}
hashSet.Add(instanceID);
TrackedPlayer trackedPlayer = PlayerUtil.BuildTracked(item);
_board.Add(trackedPlayer);
if (!_seeded)
{
_known[instanceID] = trackedPlayer.Name;
}
else if (!_known.ContainsKey(instanceID))
{
_known[instanceID] = trackedPlayer.Name;
ToastHud.Push(trackedPlayer.Name + " joined", JoinAccent);
}
else if (_known[instanceID] != trackedPlayer.Name && !string.IsNullOrEmpty(trackedPlayer.Name))
{
_known[instanceID] = trackedPlayer.Name;
}
}
}
if (!_seeded)
{
_seeded = true;
return;
}
List<int> list = new List<int>();
foreach (KeyValuePair<int, string> item2 in _known)
{
if (!hashSet.Contains(item2.Key))
{
list.Add(item2.Key);
}
}
foreach (int item3 in list)
{
string text = _known[item3];
_known.Remove(item3);
ToastHud.Push(text + " left", LeaveAccent);
}
_board.Sort(delegate(TrackedPlayer a, TrackedPlayer b)
{
if (a.IsHost != b.IsHost)
{
if (!a.IsHost)
{
return 1;
}
return -1;
}
return (a.IsLocal != b.IsLocal) ? ((!a.IsLocal) ? 1 : (-1)) : string.CompareOrdinal(a.Name, b.Name);
});
}
}
internal static class PaperTheme
{
private static readonly Color LightPaper = new Color(0.96f, 0.93f, 0.88f, 0.98f);
private static readonly Color LightPaperEdge = new Color(0.9f, 0.86f, 0.78f, 1f);
private static readonly Color LightInk = new Color(0.08f, 0.08f, 0.08f, 1f);
private static readonly Color LightInkMuted = new Color(0.28f, 0.26f, 0.24f, 1f);
private static readonly Color LightInkFaint = new Color(0.55f, 0.5f, 0.44f, 1f);
private static readonly Color DarkPaper = new Color(0.14f, 0.14f, 0.15f, 0.96f);
private static readonly Color DarkPaperEdge = new Color(0.22f, 0.21f, 0.2f, 1f);
private static readonly Color DarkInk = new Color(0.93f, 0.91f, 0.87f, 1f);
private static readonly Color DarkInkMuted = new Color(0.7f, 0.68f, 0.64f, 1f);
private static readonly Color DarkInkFaint = new Color(0.5f, 0.48f, 0.44f, 1f);
private static bool _ready;
private static bool _builtDark;
private static Font _font;
private static Texture2D _pixel;
private static Texture2D _paperTexLight;
private static Texture2D _paperTexDark;
public static Color Paper
{
get
{
//IL_000d: 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)
if (!ThemeDetect.IsDark)
{
return LightPaper;
}
return DarkPaper;
}
}
public static Color PaperEdge
{
get
{
//IL_000d: 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)
if (!ThemeDetect.IsDark)
{
return LightPaperEdge;
}
return DarkPaperEdge;
}
}
public static Color Ink
{
get
{
//IL_000d: 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)
if (!ThemeDetect.IsDark)
{
return LightInk;
}
return DarkInk;
}
}
public static Color InkMuted
{
get
{
//IL_000d: 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)
if (!ThemeDetect.IsDark)
{
return LightInkMuted;
}
return DarkInkMuted;
}
}
public static Color InkFaint
{
get
{
//IL_000d: 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)
if (!ThemeDetect.IsDark)
{
return LightInkFaint;
}
return DarkInkFaint;
}
}
public static Color Shadow => new Color(0f, 0f, 0f, ThemeDetect.IsDark ? 0.45f : 0.28f);
public static Color PingGood
{
get
{
//IL_0035: 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)
if (!ThemeDetect.IsDark)
{
return new Color(0.18f, 0.48f, 0.22f, 1f);
}
return new Color(0.45f, 0.82f, 0.5f, 1f);
}
}
public static Color PingOk
{
get
{
//IL_0035: 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)
if (!ThemeDetect.IsDark)
{
return new Color(0.55f, 0.38f, 0.1f, 1f);
}
return new Color(0.95f, 0.78f, 0.35f, 1f);
}
}
public static Color PingBad
{
get
{
//IL_0035: 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)
if (!ThemeDetect.IsDark)
{
return new Color(0.62f, 0.16f, 0.12f, 1f);
}
return new Color(0.95f, 0.45f, 0.4f, 1f);
}
}
public static GUIStyle TitleStyle { get; private set; }
public static GUIStyle HeaderStyle { get; private set; }
public static GUIStyle RowStyle { get; private set; }
public static GUIStyle MutedStyle { get; private set; }
public static void Ensure()
{
bool isDark = ThemeDetect.IsDark;
if (_ready && _builtDark == isDark)
{
ApplyStyleColors();
}
else
{
Build(isDark);
}
}
private static void Build(bool dark)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Expected O, but got Unknown
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Expected O, but got Unknown
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Expected O, but got Unknown
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Expected O, but got Unknown
if (_font == null)
{
_font = LoadFont();
}
if (_pixel == null)
{
_pixel = MakeSolid(Color.white);
}
if (_paperTexLight == null)
{
_paperTexLight = MakePaperTexture(256, 192, light: true);
}
if (_paperTexDark == null)
{
_paperTexDark = MakePaperTexture(256, 192, light: false);
}
TitleStyle = new GUIStyle(GUI.skin.label)
{
font = _font,
fontSize = 24,
fontStyle = (FontStyle)1,
alignment = (TextAnchor)4,
wordWrap = false
};
HeaderStyle = new GUIStyle(GUI.skin.label)
{
font = _font,
fontSize = 12,
fontStyle = (FontStyle)1,
alignment = (TextAnchor)3
};
RowStyle = new GUIStyle(GUI.skin.label)
{
font = _font,
fontSize = 16,
fontStyle = (FontStyle)1,
alignment = (TextAnchor)3
};
MutedStyle = new GUIStyle(RowStyle)
{
fontSize = 14,
fontStyle = (FontStyle)2
};
ApplyStyleColors();
_builtDark = dark;
_ready = true;
}
private static void ApplyStyleColors()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: 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)
if (TitleStyle != null)
{
TitleStyle.normal.textColor = Ink;
HeaderStyle.normal.textColor = InkFaint;
RowStyle.normal.textColor = Ink;
MutedStyle.normal.textColor = InkMuted;
}
}
public static void DrawPaperSheet(Rect rect)
{
//IL_0005: 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_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
Ensure();
Color color = GUI.color;
Texture2D val = (ThemeDetect.IsDark ? _paperTexDark : _paperTexLight);
GUI.color = Shadow;
GUI.DrawTexture(new Rect(((Rect)(ref rect)).x + 4f, ((Rect)(ref rect)).y + 5f, ((Rect)(ref rect)).width, ((Rect)(ref rect)).height), (Texture)(object)_pixel);
GUI.color = Paper;
GUI.DrawTexture(rect, (Texture)(object)_pixel);
GUI.color = Color.white;
GUI.DrawTexture(rect, (Texture)(object)val, (ScaleMode)0, true);
GUI.color = Ink;
GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width, 2f), (Texture)(object)_pixel);
GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).yMax - 2f, ((Rect)(ref rect)).width, 2f), (Texture)(object)_pixel);
GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, 2f, ((Rect)(ref rect)).height), (Texture)(object)_pixel);
GUI.DrawTexture(new Rect(((Rect)(ref rect)).xMax - 2f, ((Rect)(ref rect)).y, 2f, ((Rect)(ref rect)).height), (Texture)(object)_pixel);
GUI.color = color;
}
public static void DrawRect(Rect rect, Color color)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
Ensure();
Color color2 = GUI.color;
GUI.color = color;
GUI.DrawTexture(rect, (Texture)(object)_pixel);
GUI.color = color2;
}
public static void DrawTitleUnderline(Rect titleRect)
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
float num = ((Rect)(ref titleRect)).x + ((Rect)(ref titleRect)).width * 0.5f;
float num2 = Mathf.Min(((Rect)(ref titleRect)).width * 0.55f, 220f);
DrawRect(new Rect(num - num2 * 0.5f, ((Rect)(ref titleRect)).yMax - 4f, num2, 2f), Ink);
}
public static Color PingColor(int pingMs)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
if (pingMs < 0)
{
return InkFaint;
}
if (pingMs < 80)
{
return PingGood;
}
if (pingMs < 160)
{
return PingOk;
}
return PingBad;
}
private static Font LoadFont()
{
try
{
Font val = Font.CreateDynamicFontFromOSFont(Il2CppStringArray.op_Implicit(new string[4] { "Georgia", "Times New Roman", "Cambria", "Palatino Linotype" }), 32);
if ((Object)(object)val != (Object)null)
{
return val;
}
}
catch
{
}
try
{
return Resources.GetBuiltinResource<Font>("LegacyRuntime.ttf");
}
catch
{
return null;
}
}
private static Texture2D MakeSolid(Color color)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false)
{
wrapMode = (TextureWrapMode)1,
filterMode = (FilterMode)0,
hideFlags = (HideFlags)61
};
val.SetPixels(Il2CppStructArray<Color>.op_Implicit((Color[])(object)new Color[4] { color, color, color, color }));
val.Apply(false, true);
return val;
}
private static Texture2D MakePaperTexture(int width, int height, bool light)
{
//IL_000a: 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_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: 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_0030: Expected O, but got Unknown
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
Color val = (light ? LightPaper : DarkPaper);
Texture2D val2 = new Texture2D(width, height, (TextureFormat)4, false)
{
wrapMode = (TextureWrapMode)1,
filterMode = (FilterMode)1,
hideFlags = (HideFlags)61
};
Color[] array = (Color[])(object)new Color[width * height];
Random random = new Random(light ? 1478501 : 1478502);
float num = (light ? 0.04f : 0.03f);
for (int i = 0; i < height; i++)
{
for (int j = 0; j < width; j++)
{
float num2 = (float)j / (float)(width - 1);
float num3 = (float)i / (float)(height - 1);
float num4 = ((float)random.NextDouble() - 0.5f) * num;
float num5 = 0.015f * Mathf.Sin(num2 * 31f + num3 * 17f) + num4;
array[i * width + j] = new Color(Mathf.Clamp01(val.r + num5), Mathf.Clamp01(val.g + num5 * 0.9f), Mathf.Clamp01(val.b + num5 * 0.7f), light ? 0.55f : 0.4f);
}
}
val2.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
val2.Apply(false, true);
return val2;
}
}
internal sealed class TrackedPlayer
{
public int InstanceId;
public string Name;
public bool IsLocal;
public bool IsHost;
public bool IsReady;
public int PingMs;
public string Status;
public Color HeadColor;
public PlayerCharacter Character;
}
internal static class PlayerUtil
{
private static readonly Color[] FallbackPalette = (Color[])(object)new Color[6]
{
new Color(0.92f, 0.45f, 0.28f),
new Color(0.35f, 0.62f, 0.95f),
new Color(0.45f, 0.78f, 0.42f),
new Color(0.9f, 0.75f, 0.3f),
new Color(0.72f, 0.45f, 0.88f),
new Color(0.95f, 0.55f, 0.7f)
};
public static List<PlayerCharacter> GetPlayers()
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Expected O, but got Unknown
List<PlayerCharacter> list = new List<PlayerCharacter>();
try
{
List<PlayerCharacter> allPlayerCharacters = PlayerCharacter.allPlayerCharacters;
if (allPlayerCharacters != null)
{
for (int i = 0; i < allPlayerCharacters.Count; i++)
{
if ((Object)(object)allPlayerCharacters[i] != (Object)null)
{
list.Add(allPlayerCharacters[i]);
}
}
}
}
catch (Exception ex)
{
ManualLogSource log = Plugin.Log;
bool flag = default(bool);
BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(19, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("GetPlayers failed: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
log.LogDebug(val);
}
return list;
}
public static string GetDisplayName(PlayerCharacter pc)
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
try
{
if (((NetworkBehaviour)pc).isLocalPlayer)
{
string personaName = SteamFriends.GetPersonaName();
if (!string.IsNullOrEmpty(personaName))
{
return personaName;
}
}
else
{
PlayerNetworking playerNetworking = pc.playerNetworking;
if ((Object)(object)playerNetworking != (Object)null && playerNetworking.userPlatformId != 0L)
{
string friendPersonaName = SteamFriends.GetFriendPersonaName(new CSteamID(playerNetworking.userPlatformId));
if (!string.IsNullOrEmpty(friendPersonaName) && !LooksLikeSteamId(friendPersonaName))
{
return friendPersonaName;
}
string playerNickname = SteamFriends.GetPlayerNickname(new CSteamID(playerNetworking.userPlatformId));
if (!string.IsNullOrEmpty(playerNickname))
{
return playerNickname;
}
}
}
}
catch
{
}
try
{
PlayerNetworking playerNetworking2 = pc.playerNetworking;
if ((Object)(object)playerNetworking2 != (Object)null)
{
if (!string.IsNullOrEmpty(playerNetworking2.moderationNameSanitized) && !LooksLikeSteamId(playerNetworking2.moderationNameSanitized))
{
return playerNetworking2.moderationNameSanitized;
}
if (!string.IsNullOrEmpty(playerNetworking2.moderationName) && !LooksLikeSteamId(playerNetworking2.moderationName))
{
return playerNetworking2.moderationName;
}
if (!string.IsNullOrEmpty(playerNetworking2.username) && !LooksLikeSteamId(playerNetworking2.username))
{
return playerNetworking2.username;
}
}
}
catch
{
}
return "Player";
}
public static TrackedPlayer BuildTracked(PlayerCharacter pc)
{
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
bool flag = false;
bool flag2 = false;
try
{
flag = ((NetworkBehaviour)pc).isLocalPlayer;
}
catch
{
}
try
{
if ((Object)(object)pc.playerNetworking != (Object)null)
{
flag2 = pc.playerNetworking.isHost;
}
}
catch
{
}
int pingMs = GetPingMs(pc, flag);
bool flag3 = true;
try
{
NetworkConnectionToClient connection = GetConnection(pc);
if (connection != null)
{
flag3 = ((NetworkConnection)connection).isReady;
}
}
catch
{
}
string status = ((flag && flag2) ? "Host (you)" : (flag2 ? "Host" : (flag ? "You" : (flag3 ? "Connected" : "Joining…"))));
return new TrackedPlayer
{
InstanceId = ((Object)pc).GetInstanceID(),
Name = GetDisplayName(pc),
IsLocal = flag,
IsHost = flag2,
IsReady = flag3,
PingMs = pingMs,
Status = status,
HeadColor = SampleHeadColor(pc),
Character = pc
};
}
public static int GetPingMs(PlayerCharacter pc, bool isLocal)
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
try
{
if (isLocal && (NetworkClient.active || NetworkServer.active))
{
return Mathf.Max(0, Mathf.RoundToInt((float)(NetworkTime.rtt * 1000.0)));
}
if (NetworkServer.active)
{
NetworkConnectionToClient connection = GetConnection(pc);
if (connection != null)
{
double value = connection.deliveryTimeEma.Value;
if (value > 0.0 && value < 5.0)
{
return Mathf.Max(1, Mathf.RoundToInt((float)(value * 1000.0)));
}
}
}
}
catch
{
}
return -1;
}
public static NetworkConnectionToClient GetConnection(PlayerCharacter pc)
{
try
{
NetworkIdentity netIdentity = ((NetworkBehaviour)pc).netIdentity;
if ((Object)(object)netIdentity != (Object)null)
{
return netIdentity.connectionToClient;
}
}
catch
{
}
return null;
}
public static Color SampleHeadColor(PlayerCharacter pc)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
try
{
if ((Object)(object)pc == (Object)null)
{
return FallbackPalette[0];
}
Il2CppArrayBase<Renderer> componentsInChildren = ((Component)pc).GetComponentsInChildren<Renderer>();
if (componentsInChildren != null)
{
foreach (Renderer item in componentsInChildren)
{
if ((Object)(object)item == (Object)null || !item.enabled)
{
continue;
}
string text = ((Object)((Component)item).gameObject).name ?? "";
if (text.IndexOf("head", StringComparison.OrdinalIgnoreCase) < 0 && text.IndexOf("face", StringComparison.OrdinalIgnoreCase) < 0 && componentsInChildren.Length > 3)
{
continue;
}
Il2CppReferenceArray<Material> sharedMaterials = item.sharedMaterials;
if (sharedMaterials == null)
{
continue;
}
foreach (Material item2 in (Il2CppArrayBase<Material>)(object)sharedMaterials)
{
if (!((Object)(object)item2 == (Object)null))
{
if (item2.HasProperty("_BaseColor"))
{
return item2.GetColor("_BaseColor");
}
if (item2.HasProperty("_Color"))
{
return item2.color;
}
}
}
}
}
}
catch
{
}
int num = 0;
try
{
num = Mathf.Abs(((Object)pc).GetInstanceID());
}
catch
{
}
return FallbackPalette[num % FallbackPalette.Length];
}
public static string FormatPing(int pingMs)
{
if (pingMs < 0)
{
return "—";
}
return $"{pingMs} ms";
}
public static Color PingColor(int pingMs)
{
//IL_0013: 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_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
if (pingMs < 0)
{
return new Color(0.7f, 0.7f, 0.7f);
}
if (pingMs < 80)
{
return new Color(0.45f, 0.85f, 0.45f);
}
if (pingMs < 160)
{
return new Color(0.95f, 0.85f, 0.35f);
}
return new Color(0.95f, 0.4f, 0.35f);
}
private static bool LooksLikeSteamId(string value)
{
if (string.IsNullOrEmpty(value))
{
return false;
}
if (value.Length >= 15)
{
return char.IsDigit(value[0]);
}
return false;
}
}
[BepInPlugin("BigWalk.MoreLobbyInfo", "Big Walk More Lobby Info", "0.1.4")]
[BepInProcess("Big Walk.exe")]
public class Plugin : BasePlugin
{
internal static Plugin Instance;
internal static ManualLogSource Log;
public static ConfigEntry<bool> JoinLeaveToasts;
public static ConfigEntry<float> ToastSeconds;
public static ConfigEntry<KeyCode> ScoreboardKey;
public static ConfigEntry<bool> ShowHeadPreviews;
public static ConfigEntry<bool> ShowPing;
public override void Load()
{
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Expected O, but got Unknown
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Expected O, but got Unknown
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
Instance = this;
Log = ((BasePlugin)this).Log;
JoinLeaveToasts = ((BasePlugin)this).Config.Bind<bool>("Lobby", "JoinLeaveToasts", true, "Show top-right join/leave notifications.");
ToastSeconds = ((BasePlugin)this).Config.Bind<float>("Lobby", "ToastSeconds", 4.5f, new ConfigDescription("How long join/leave toasts stay on screen.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1.5f, 12f), Array.Empty<object>()));
ScoreboardKey = ((BasePlugin)this).Config.Bind<KeyCode>("Lobby", "ScoreboardKey", (KeyCode)9, "Hold this key to show the lobby player board.");
ShowHeadPreviews = ((BasePlugin)this).Config.Bind<bool>("Lobby", "ShowHeadPreviews", true, "Show a small head-color preview next to each player on the Tab board.");
ShowPing = ((BasePlugin)this).Config.Bind<bool>("Lobby", "ShowPing", true, "Show ping / connection timing on the Tab board.");
((BasePlugin)this).AddComponent<LobbyInfoController>();
ManualLogSource log = Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(33, 3, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("Big Walk More Lobby Info");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" v");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("0.1.4");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" loaded. Hold ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<KeyCode>(ScoreboardKey.Value);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" for lobby board.");
}
log.LogInfo(val);
}
}
internal static class ScoreboardHud
{
public static void Draw(IReadOnlyList<TrackedPlayer> players)
{
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_0238: Unknown result type (might be due to invalid IL or missing references)
//IL_0264: Unknown result type (might be due to invalid IL or missing references)
//IL_0269: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_0289: Unknown result type (might be due to invalid IL or missing references)
//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
//IL_030e: Unknown result type (might be due to invalid IL or missing references)
//IL_037e: Unknown result type (might be due to invalid IL or missing references)
//IL_033b: Unknown result type (might be due to invalid IL or missing references)
//IL_0340: Unknown result type (might be due to invalid IL or missing references)
//IL_034d: Unknown result type (might be due to invalid IL or missing references)
//IL_0359: Expected O, but got Unknown
//IL_0361: Unknown result type (might be due to invalid IL or missing references)
PaperTheme.Ensure();
bool value = Plugin.ShowHeadPreviews.Value;
bool value2 = Plugin.ShowPing.Value;
float num = (value ? 44f : 0f);
float num2 = 220f;
float num3 = (value2 ? 90f : 0f);
float num4 = 130f;
float num5 = 22f;
float num6 = 40f;
float num7 = 30f;
float num8 = 44f;
float num9 = num5 * 2f + num + num2 + num3 + num4 + 18f;
float num10 = num5 * 2f + num8 + 12f + num7 + (float)Mathf.Max(1, players.Count) * num6 + 8f;
num9 = Mathf.Min(num9, (float)Screen.width - 40f);
num10 = Mathf.Min(num10, (float)Screen.height - 40f);
float num11 = ((float)Screen.width - num9) * 0.5f;
float num12 = Mathf.Max(28f, (float)Screen.height * 0.06f);
Rect rect = default(Rect);
((Rect)(ref rect))..ctor(num11, num12, num9, num10);
PaperTheme.DrawPaperSheet(rect);
float num13 = ((Rect)(ref rect)).x + num5;
float num14 = ((Rect)(ref rect)).y + num5 - 2f;
float num15 = ((Rect)(ref rect)).width - num5 * 2f;
Rect val = new Rect(num13, num14, num15, num8);
GUI.Label(val, $"LOBBY · {players.Count} player{((players.Count == 1) ? "" : "s")}", PaperTheme.TitleStyle);
PaperTheme.DrawTitleUnderline(val);
num14 += num8 + 10f;
float num16 = num13;
if (value)
{
GUI.Label(new Rect(num16, num14, num, num7), "", PaperTheme.HeaderStyle);
num16 += num;
}
GUI.Label(new Rect(num16, num14, num2, num7), "PLAYER", PaperTheme.HeaderStyle);
num16 += num2;
if (value2)
{
GUI.Label(new Rect(num16, num14, num3, num7), "PING", PaperTheme.HeaderStyle);
num16 += num3;
}
GUI.Label(new Rect(num16, num14, num4, num7), "STATUS", PaperTheme.HeaderStyle);
num14 += num7;
PaperTheme.DrawRect(new Rect(num13, num14 - 2f, num15, 1f), PaperTheme.InkFaint);
if (players.Count == 0)
{
GUI.Label(new Rect(num13, num14 + 8f, num15, num6), "No players in lobby yet.", PaperTheme.MutedStyle);
return;
}
foreach (TrackedPlayer player in players)
{
float num17 = num13;
if (value)
{
DrawHead(new Rect(num17 + 4f, num14 + 5f, 30f, 30f), player);
num17 += num;
}
string text = player.Name;
if (player.IsLocal)
{
text += " (you)";
}
GUI.Label(new Rect(num17, num14, num2, num6), text, PaperTheme.RowStyle);
num17 += num2;
if (value2)
{
string text2 = PlayerUtil.FormatPing(player.PingMs);
GUIStyle val2 = new GUIStyle(PaperTheme.RowStyle);
val2.normal.textColor = PaperTheme.PingColor(player.PingMs);
GUIStyle val3 = val2;
GUI.Label(new Rect(num17, num14, num3, num6), text2, val3);
num17 += num3;
}
GUI.Label(new Rect(num17, num14, num4, num6), player.Status, PaperTheme.MutedStyle);
num14 += num6;
}
}
private static void DrawHead(Rect rect, TrackedPlayer player)
{
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Expected O, but got Unknown
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
PaperTheme.Ensure();
PaperTheme.DrawRect(new Rect(((Rect)(ref rect)).x - 1f, ((Rect)(ref rect)).y - 1f, ((Rect)(ref rect)).width + 2f, ((Rect)(ref rect)).height + 2f), PaperTheme.Ink);
PaperTheme.DrawRect(rect, player.HeadColor);
Color color = Color.Lerp(player.HeadColor, PaperTheme.Paper, 0.28f);
PaperTheme.DrawRect(new Rect(((Rect)(ref rect)).x + 5f, ((Rect)(ref rect)).y + 5f, ((Rect)(ref rect)).width - 10f, ((Rect)(ref rect)).height - 12f), color);
string text = (string.IsNullOrEmpty(player.Name) ? "?" : player.Name.Substring(0, 1).ToUpperInvariant());
GUIStyle val = new GUIStyle(PaperTheme.RowStyle)
{
alignment = (TextAnchor)4,
fontSize = 14,
fontStyle = (FontStyle)1
};
val.normal.textColor = PaperTheme.Ink;
GUI.Label(rect, text, val);
}
}
internal static class ThemeDetect
{
public const string DarkModeAssembly = "BigWalk.DarkMode";
private static bool? _cached;
private static float _cachedAt = -999f;
public static bool IsDark
{
get
{
if (_cached.HasValue && Time.unscaledTime - _cachedAt < 1f)
{
return _cached.Value;
}
_cached = Resolve();
_cachedAt = Time.unscaledTime;
return _cached.Value;
}
}
private static bool Resolve()
{
try
{
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (Assembly assembly in assemblies)
{
if (!(assembly == null) && string.Equals(assembly.GetName().Name, "BigWalk.DarkMode", StringComparison.OrdinalIgnoreCase))
{
PropertyInfo propertyInfo = assembly.GetType("BigWalk.DarkMode.Theme", throwOnError: false)?.GetProperty("Active", BindingFlags.Static | BindingFlags.Public);
if (propertyInfo != null)
{
object value = propertyInfo.GetValue(null);
return value is bool && (bool)value;
}
return true;
}
}
}
catch
{
}
return false;
}
}
internal static class ToastHud
{
private struct Toast
{
public string Text;
public Color Accent;
public float ExpiresAt;
}
private static readonly List<Toast> Toasts = new List<Toast>();
public static void Push(string text, Color accent)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
if (Plugin.JoinLeaveToasts.Value)
{
Toasts.Add(new Toast
{
Text = text,
Accent = accent,
ExpiresAt = Time.unscaledTime + Plugin.ToastSeconds.Value
});
Plugin.Log.LogInfo((object)text);
}
}
public static void Draw()
{
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Expected O, but got Unknown
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
PaperTheme.Ensure();
float unscaledTime = Time.unscaledTime;
for (int num = Toasts.Count - 1; num >= 0; num--)
{
if (Toasts[num].ExpiresAt <= unscaledTime)
{
Toasts.RemoveAt(num);
}
}
if (Toasts.Count != 0)
{
float num2 = (float)Screen.width - 300f - 20f;
float num3 = 18f;
Rect rect = default(Rect);
for (int num4 = Toasts.Count - 1; num4 >= 0; num4--)
{
Toast toast = Toasts[num4];
float num5 = Mathf.Clamp01((toast.ExpiresAt - unscaledTime) / Mathf.Max(0.1f, Plugin.ToastSeconds.Value));
float num6 = ((num5 < 0.2f) ? (num5 / 0.2f) : 1f);
((Rect)(ref rect))..ctor(num2, num3, 300f, 38f);
Color color = GUI.color;
GUI.color = new Color(1f, 1f, 1f, num6);
PaperTheme.DrawPaperSheet(rect);
PaperTheme.DrawRect(new Rect(((Rect)(ref rect)).x + 3f, ((Rect)(ref rect)).y + 4f, 4f, ((Rect)(ref rect)).height - 8f), new Color(toast.Accent.r, toast.Accent.g, toast.Accent.b, num6));
GUIStyle val = new GUIStyle(PaperTheme.RowStyle)
{
fontSize = 15,
alignment = (TextAnchor)3
};
val.normal.textColor = new Color(PaperTheme.Ink.r, PaperTheme.Ink.g, PaperTheme.Ink.b, num6);
GUI.Label(new Rect(((Rect)(ref rect)).x + 16f, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width - 24f, ((Rect)(ref rect)).height), toast.Text, val);
GUI.color = color;
num3 += 46f;
}
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "BigWalk.MoreLobbyInfo";
public const string PLUGIN_NAME = "Big Walk More Lobby Info";
public const string PLUGIN_VERSION = "0.1.4";
}