using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Net; using System.Net.Sockets; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UKSRR.Game; using UKSRR.Integrity; using UKSRR.Match; using UKSRR.Network; using UKSRR.Timing; using UKSRR.UI; using UnityEngine; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("pink404")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("UKSRR")] [assembly: AssemblyTitle("UKSRR")] [assembly: AssemblyVersion("1.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 UKSRR { [BepInPlugin("com.uksrr.client", "UKSR Ranked", "1.0.21")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { public const string Guid = "com.uksrr.client"; public const string Name = "UKSR Ranked"; public const string Version = "1.0.21"; private Harmony _harmony; internal static Plugin Instance { get; private set; } internal MatchManager Matches { get; private set; } internal RankedNotificationManager Notifications { get; private set; } internal SteamRankedBridge Network { get; private set; } private void Awake() { //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Expected O, but got Unknown Instance = this; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); RankedSettings.Initialize(((BaseUnityPlugin)this).Config); ThumbnailCatalog.Initialize(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), ((BaseUnityPlugin)this).Logger); Matches = new MatchManager(((BaseUnityPlugin)this).Logger); RankedFinalRankHook.Initialize(Matches, ((BaseUnityPlugin)this).Logger); Notifications = ((Component)this).gameObject.AddComponent(); Notifications.Initialize(Matches, ((BaseUnityPlugin)this).Logger); Matches.InitializeNotifications(Notifications); Network = ((Component)this).gameObject.AddComponent(); Network.Initialize(Matches, Notifications, ((BaseUnityPlugin)this).Logger); _harmony = new Harmony("com.uksrr.client"); _harmony.PatchAll(); ((Component)this).gameObject.AddComponent().Initialize(Matches, ((BaseUnityPlugin)this).Logger); ((Component)this).gameObject.AddComponent().Initialize(Matches, ((BaseUnityPlugin)this).Logger); ((Component)this).gameObject.AddComponent().Initialize(Matches, ((BaseUnityPlugin)this).Logger); RankedSpectatorOverlay rankedSpectatorOverlay = ((Component)this).gameObject.AddComponent(); MainMenuInjector mainMenuInjector = ((Component)this).gameObject.AddComponent(); rankedSpectatorOverlay.Initialize(Matches, Network, ((BaseUnityPlugin)this).Logger, null); mainMenuInjector.Initialize(Matches, Network, rankedSpectatorOverlay, ((BaseUnityPlugin)this).Logger); ((Component)this).gameObject.AddComponent().Initialize(Matches, ((BaseUnityPlugin)this).Logger); ((Component)this).gameObject.AddComponent().Initialize(Matches, Network, Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "icon.png")); IntegrityScanner.LogLoadedPlugins(((BaseUnityPlugin)this).Logger); ((BaseUnityPlugin)this).Logger.LogInfo((object)"UKSR Ranked v1.0.21 loaded. authoritative vanilla-timer IGT, one-step hybrid joins, Steam friend invites, in-level spectating, responsive UI, and shared results."); } private void Update() { Matches.Tick(); } private void OnDestroy() { if (_harmony != null) { _harmony.UnpatchSelf(); } } } } namespace UKSRR.UI { public sealed class MainMenuInjector : MonoBehaviour { private enum SelectionContext { None, PrivateLobby, PublicMatch } private MatchManager _matches; private SteamRankedBridge _network; private RankedSpectatorOverlay _spectator; private ManualLogSource _log; private GameObject _rankedButton; private RankedPanel _panel; private Button _styleTemplate; private Button _vanillaPlay; private VanillaMenuBridge _vanillaMenus; private float _nextScan; private int _scanAttemptsRemaining; private SelectionContext _selectionContext; private int _publicBrowserPage; private int _lastLobbyUiRevision = -1; private float _nextUiAutoRefresh; private bool _spectatorResultsActive; private bool _pendingLevelPRank; private string _browseLayer = "OVERTURE"; public void Initialize(MatchManager matches, SteamRankedBridge network, RankedSpectatorOverlay spectator, ManualLogSource log) { _matches = matches; _network = network; _spectator = spectator; _log = log; _vanillaMenus = new VanillaMenuBridge((MonoBehaviour)(object)this, _matches, _log, GetVanillaPlay, OpenRankedHome, OnLevelSelected); _scanAttemptsRemaining = 120; SceneManager.activeSceneChanged += OnActiveSceneChanged; _log.LogInfo((object)"UKSR Ranked injector initialized. Exact 0.3.1 discovery + scene-aware reinjection."); } private void OnDestroy() { SceneManager.activeSceneChanged -= OnActiveSceneChanged; if (_vanillaMenus != null) { _vanillaMenus.RestoreDifficultyButtonsPublic(); _vanillaMenus.RestoreLevelButtons(); } } private void OnActiveSceneChanged(Scene previous, Scene next) { _rankedButton = null; _vanillaPlay = null; _scanAttemptsRemaining = 8; _nextScan = Time.unscaledTime + 0.35f; } private void Update() { if ((Object)(object)_network != (Object)null && Time.unscaledTime >= _nextUiAutoRefresh) { _nextUiAutoRefresh = Time.unscaledTime + 0.2f; if (_network.LobbyUiRevision != _lastLobbyUiRevision) { _lastLobbyUiRevision = _network.LobbyUiRevision; if (_panel != null && _network.InLobby) { OpenNetworkPrivateLobby(); } } } if (_panel != null && !_panel.Alive) { _panel = null; } if ((Object)(object)_network != (Object)null && _network.AlternativeOfferPending && _network.IsSearching) { OpenAlternativeQueueOffer(); return; } if (_matches.ReturnToLobbyOnMenuRequested) { Button val = FindButton("PLAY"); if ((Object)(object)val != (Object)null) { _vanillaPlay = val; Button val2 = FindButton("OPTIONS"); _styleTemplate = (((Object)(object)val2 != (Object)null) ? val2 : val); bool num = _matches.State == MatchState.Finished; _matches.ConsumeReturnToLobbyRequest(); if (num) { OpenMatchResults(); } else if ((Object)(object)_network != (Object)null && !string.IsNullOrEmpty(_network.LobbyId)) { if (_network.CurrentLobbyIsPrivate) { OpenNetworkPrivateLobby(); } else { OpenPublicQueue(); } } else { OpenRankedHome(); } return; } } if (!((Object)(object)_rankedButton != (Object)null) && _scanAttemptsRemaining > 0 && !(Time.unscaledTime < _nextScan)) { _scanAttemptsRemaining--; _nextScan = Time.unscaledTime + ((_scanAttemptsRemaining > 8) ? 0.1f : 0.5f); TryInjectMainMenuButton(); } } private void TryInjectMainMenuButton() { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown Button val = FindButton("PLAY"); if ((Object)(object)val == (Object)null) { return; } _vanillaPlay = val; if (!((Object)(object)GameObject.Find("UKSRR_RankedPlay") != (Object)null)) { Button val2 = FindButton("OPTIONS"); _styleTemplate = (((Object)(object)val2 != (Object)null) ? val2 : val); Button val3 = Object.Instantiate