Due to update 2.4.3, some mods may no longer function. FixedConfig may be necessary.
Decompiled source of PublicSteamProfiles v1.0.1
BepInEx/plugins/PMod.PublicSteamProfiles.dll
Decompiled 5 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Steamworks; using Steamworks.Data; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("0.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 PMod.PublicSteamProfiles { [BepInPlugin("com.pmod.public.steamprofiles", "PMod Public Steam Profiles", "1.0.1.0")] [BepInProcess("BoplBattle.exe")] public sealed class PublicSteamProfilesPlugin : BaseUnityPlugin { internal static bool showWindow; internal static ManualLogSource Log; private void Awake() { //IL_003c: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; ((BaseUnityPlugin)this).Logger.LogInfo((object)"loaded"); CharacterSelectHandler_online.clientSideMods_you_can_increment_this_to_enable_matchmaking_for_your_mods__please_dont_use_it_to_cheat_thats_really_cringe_especially_if_its_desyncing_others___you_didnt_even_win_on_your_opponents_screen___I_cannot_imagine_a_sadder_existence++; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Registered as client-side mod, matchmaking stays enabled"); Harmony val = new Harmony("com.pmod.public.steamprofiles"); val.Patch((MethodBase)AccessTools.Method(typeof(SteamManager), "Awake", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(Patches), "SteamManagerAwakePostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.Method(typeof(SteamManager), "Update", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(Patches), "SteamManagerUpdatePostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Harmony patches applied"); } } public static class Patches { private static bool _prevP; public static void SteamManagerAwakePostfix(SteamManager __instance) { GameObject gameObject = ((Component)__instance).gameObject; if ((Object)(object)gameObject.GetComponent<SteamOverlayGUI>() == (Object)null) { gameObject.AddComponent<SteamOverlayGUI>(); PublicSteamProfilesPlugin.Log.LogInfo((object)"SteamOverlayGUI added to SteamManager"); } } public static void SteamManagerUpdatePostfix() { Keyboard current = Keyboard.current; if (current != null) { bool isPressed = ((ButtonControl)current.pKey).isPressed; if (isPressed && !_prevP) { PublicSteamProfilesPlugin.showWindow = !PublicSteamProfilesPlugin.showWindow; PublicSteamProfilesPlugin.Log.LogInfo((object)("P pressed, showWindow=" + PublicSteamProfilesPlugin.showWindow)); } _prevP = isPressed; } } } public sealed class SteamOverlayGUI : MonoBehaviour { private sealed class LobbyPlayerEntry { public string DisplayName; public ulong SteamId; public bool IsLocal; public bool IsHost; } private readonly List<LobbyPlayerEntry> _players = new List<LobbyPlayerEntry>(8); private readonly HashSet<ulong> _seenIds = new HashSet<ulong>(); private Rect _windowRect = new Rect(1055f, 8f, 420f, 320f); private Vector2 _scrollPos; private GUIStyle _windowStyle; private GUIStyle _panelBgStyle; private GUIStyle _captionStyle; private GUIStyle _rowLabelStyle; private GUIStyle _rowContainerStyle; private GUIStyle _linkButtonStyle; private Texture2D _windowBgTex; private Texture2D _panelBgTex; private Texture2D _rowBgTex; private void Awake() { PublicSteamProfilesPlugin.Log.LogInfo((object)"SteamOverlayGUI.Awake"); } private void OnGUI() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0043: 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) if (PublicSteamProfilesPlugin.showWindow) { EnsureStyles(); _windowRect = GUI.Window(902102, _windowRect, new WindowFunction(DrawWindow), "Steam Profiles Hotkey: [P]", _windowStyle); _windowRect = ClampToScreen(_windowRect); } } private void DrawWindow(int id) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) Rect val = default(Rect); ((Rect)(ref val))..ctor(8f, 26f, ((Rect)(ref _windowRect)).width - 16f, ((Rect)(ref _windowRect)).height - 34f); GUI.Box(val, GUIContent.none, _panelBgStyle); GUILayout.BeginArea(new Rect(((Rect)(ref val)).x + 6f, ((Rect)(ref val)).y + 6f, ((Rect)(ref val)).width - 12f, ((Rect)(ref val)).height - 12f)); GUILayout.Label("Players currently in your Steam lobby", _captionStyle, Array.Empty<GUILayoutOption>()); RefreshPlayers(); if (!SteamClient.IsValid) { GUILayout.Label("Steam is not available.", _rowLabelStyle, Array.Empty<GUILayoutOption>()); } else if (_players.Count == 0) { GUILayout.Label("No lobby players found.", _rowLabelStyle, Array.Empty<GUILayoutOption>()); } else { _scrollPos = GUILayout.BeginScrollView(_scrollPos, Array.Empty<GUILayoutOption>()); foreach (LobbyPlayerEntry player in _players) { string text = (player.IsHost ? "[Host] " : "") + (player.IsLocal ? "[You] " : ""); string text2 = "https://steamcommunity.com/profiles/" + player.SteamId; GUILayout.BeginHorizontal(_rowContainerStyle, Array.Empty<GUILayoutOption>()); GUILayout.Label(text + player.DisplayName, _rowLabelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) }); if (GUILayout.Button("<color=#7CB7FF><u>" + text2 + "</u></color>", _linkButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(230f) })) { OpenProfile(player.SteamId); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); } GUILayout.EndArea(); GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _windowRect)).width, 24f)); } private void RefreshPlayers() { //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_004f: Unknown result type (might be due to invalid IL or missing references) _players.Clear(); _seenIds.Clear(); if (!SteamClient.IsValid) { return; } ulong ownerId = (((Object)(object)SteamManager.instance != (Object)null) ? SteamId.op_Implicit(((Lobby)(ref SteamManager.instance.currentLobby)).Owner.Id) : 0); AddPlayer(SteamClient.Name, SteamClient.SteamId.Value, local: true, ownerId); SteamManager instance = SteamManager.instance; if (instance?.connectedPlayers == null) { return; } for (int i = 0; i < instance.connectedPlayers.Count; i++) { SteamConnection val = instance.connectedPlayers[i]; if (val != null) { AddPlayer(val.steamName, val.id.Value, local: false, ownerId); } } } private void AddPlayer(string name, ulong sid, bool local, ulong ownerId) { if (sid != 0L && !_seenIds.Contains(sid)) { _seenIds.Add(sid); _players.Add(new LobbyPlayerEntry { DisplayName = (string.IsNullOrEmpty(name) ? ("Player " + _players.Count) : name), SteamId = sid, IsLocal = local, IsHost = (sid == ownerId) }); } } private static void OpenProfile(ulong sid) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (sid != 0L) { if (SteamClient.IsValid) { SteamFriends.OpenUserOverlay(SteamId.op_Implicit(sid), "steamid"); } else { Application.OpenURL("steam://openurl/https://steamcommunity.com/profiles/" + sid); } } } private void EnsureStyles() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Expected O, but got Unknown //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Expected O, but got Unknown //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Expected O, but got Unknown //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Expected O, but got Unknown //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Expected O, but got Unknown //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Expected O, but got Unknown //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Expected O, but got Unknown //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Expected O, but got Unknown //IL_031d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_windowBgTex == (Object)null) { _windowBgTex = MakeTex(new Color(0.11f, 0.12f, 0.14f, 0.97f)); _panelBgTex = MakeTex(new Color(0.16f, 0.17f, 0.2f, 0.92f)); _rowBgTex = MakeTex(new Color(0.2f, 0.21f, 0.25f, 0.9f)); } if (_windowStyle == null) { _windowStyle = new GUIStyle(GUI.skin.window); _windowStyle.fontSize = 14; _windowStyle.normal.background = _windowBgTex; _windowStyle.normal.textColor = new Color(0.94f, 0.95f, 0.97f, 1f); GUIStyleState[] array = (GUIStyleState[])(object)new GUIStyleState[7] { _windowStyle.hover, _windowStyle.active, _windowStyle.focused, _windowStyle.onNormal, _windowStyle.onHover, _windowStyle.onActive, _windowStyle.onFocused }; foreach (GUIStyleState obj in array) { obj.background = _windowBgTex; obj.textColor = _windowStyle.normal.textColor; } _windowStyle.padding = new RectOffset(8, 8, 24, 8); } if (_panelBgStyle == null) { _panelBgStyle = new GUIStyle(GUI.skin.box); _panelBgStyle.normal.background = _panelBgTex; } if (_captionStyle == null) { _captionStyle = new GUIStyle(GUI.skin.label); _captionStyle.fontSize = 12; _captionStyle.normal.textColor = new Color(0.74f, 0.79f, 0.87f, 1f); } if (_rowLabelStyle == null) { _rowLabelStyle = new GUIStyle(GUI.skin.label); _rowLabelStyle.alignment = (TextAnchor)3; _rowLabelStyle.normal.textColor = new Color(0.92f, 0.93f, 0.96f, 1f); } if (_rowContainerStyle == null) { _rowContainerStyle = new GUIStyle(GUI.skin.box); _rowContainerStyle.normal.background = _rowBgTex; _rowContainerStyle.padding = new RectOffset(6, 6, 4, 4); _rowContainerStyle.margin = new RectOffset(0, 0, 3, 3); } if (_linkButtonStyle == null) { _linkButtonStyle = new GUIStyle(GUI.skin.button); _linkButtonStyle.richText = true; _linkButtonStyle.alignment = (TextAnchor)3; _linkButtonStyle.normal.textColor = new Color(0.92f, 0.93f, 0.96f, 1f); } } private static Texture2D MakeTex(Color c) { //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) //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) //IL_0017: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1); val.SetPixel(0, 0, c); val.Apply(); return val; } private Rect ClampToScreen(Rect r) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) ((Rect)(ref r)).x = Mathf.Clamp(((Rect)(ref r)).x, 0f, Mathf.Max(0f, (float)Screen.width - ((Rect)(ref r)).width)); ((Rect)(ref r)).y = Mathf.Clamp(((Rect)(ref r)).y, 0f, Mathf.Max(0f, (float)Screen.height - ((Rect)(ref r)).height)); return r; } } }