using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using FMODUnity; using HarmonyLib; using Microsoft.CodeAnalysis; using Mirror; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using SBGL.UnifiedMod.Core; using SBGL.UnifiedMod.Features; using SBGL.UnifiedMod.Features.CompetitivePluginCheck; using SBGL.UnifiedMod.Patches; using SBGL.UnifiedMod.Utils; using SBGLLiveLeaderboard; using SBGLeagueAutomation; using Steamworks; using Steamworks.Data; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Networking; using UnityEngine.SceneManagement; 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: IgnoresAccessChecksTo("GameAssembly")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SBGL.UnifiedMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.0.1.0")] [assembly: AssemblyInformationalVersion("0.0.1+c3f052b0dea59e1a22071a28f40a279b9dc1c3e3")] [assembly: AssemblyProduct("Super Battle Golf League Unified Mod")] [assembly: AssemblyTitle("SBGL.UnifiedMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.1.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 SBGLeagueAutomation { public class SBGLPlugin : MonoBehaviour { [HarmonyPatch] private static class CourseManager_RpcInformEndingCourse_Patch { private static MethodBase TargetMethod() { Type type = AccessTools.TypeByName("CourseManager"); if (type == null) { return null; } return AccessTools.Method(type, "UserCode_RpcInformEndingCourse", (Type[])null, (Type[])null); } private static void Postfix() { try { SBGLPlugin sBGLPlugin = Object.FindAnyObjectByType((FindObjectsInactive)1); if ((Object)(object)sBGLPlugin != (Object)null) { sBGLPlugin.OnCourseRpcInformEndingCourse(); } } catch (Exception arg) { Debug.Log((object)$"[SBGL.Matchmaking] CourseManager.RpcInformEndingCourse postfix error: {arg}"); } } } public class PlayerProfile { public string id; public string display_name; public string region; public string state_province; public float current_mmr; } public class MatchmakingSession { public string id; public string lobby_name; public string lobby_password; public string host_player_id; public string status; public string match_id; public string lobby_id; public string host_steam_id; public string steam_lobby_link; public List player_ids; public List accepted_player_ids; public string match_type; public string selected_course; public int season; } public class MatchStats { public string matchmaking_session_id; public string match_id; public string player_id; public string player_name; public string match_date; public int duration_seconds; public bool is_host; public string status; public string course_name; public string match_type; public int season; } private class CachedLeaderboardPlayer { public string Name; public int BaseScore; public string RawStrokes; public string MMR; public int ProjectedDelta; } public struct PlayerData { public string name; public string mmr; } [CompilerGenerated] private sealed class <>c__DisplayClass132_0 { public string playerId; public string resolvedDisplayName; public int casualMatchesPlayed; public bool updated; public SBGLPlugin <>4__this; internal void b__2(string id) { playerId = id; } internal void b__3(string res) { JObject val = <>4__this.ParseApiSingleObject(res); if (val != null) { resolvedDisplayName = ((string)val["display_name"]) ?? resolvedDisplayName; int.TryParse(((object)val["casual_matches_played"])?.ToString() ?? "0", out casualMatchesPlayed); } } internal void b__4(string res) { if (<>4__this.ParseApiSingleObject(res) != null) { updated = true; } } } [CompilerGenerated] private sealed class <>c__DisplayClass148_0 { public bool readSucceeded; public string existingScreenshotUrl; public bool uploadSucceeded; public SBGLPlugin <>4__this; internal void b__0(string res) { readSucceeded = true; JObject val = <>4__this.ParseApiSingleObject(res); existingScreenshotUrl = (string)((val != null) ? val["screenshot_url"] : null); } internal void b__1(string res) { JObject val = <>4__this.ParseApiSingleObject(res); uploadSucceeded = val != null; } } [CompilerGenerated] private sealed class <>c__DisplayClass148_1 { public string uploadedFileUrl; internal void b__2(string url) { uploadedFileUrl = url; } } [CompilerGenerated] private sealed class <>c__DisplayClass165_0 { public string existingMatchId; internal void b__0(string id) { existingMatchId = id; } } [CompilerGenerated] private sealed class <>c__DisplayClass167_0 { public SBGLPlugin <>4__this; public string resolvedId; internal void b__0(string res) { JObject val = <>4__this.ParseApiObjectList(res).FirstOrDefault(); if (val != null) { resolvedId = (string)val["id"]; } } } [CompilerGenerated] private sealed class <>c__DisplayClass169_0 { public SBGLPlugin <>4__this; public string sourceTag; } [CompilerGenerated] private sealed class <>c__DisplayClass169_1 { public string existingEntryId; public string createdEntryId; public <>c__DisplayClass169_0 CS$<>8__locals1; internal void b__0(string id) { existingEntryId = id; } internal void b__1(string res) { try { JObject val = CS$<>8__locals1.<>4__this.ParseApiSingleObject(res); if (val != null) { createdEntryId = (string)val["id"]; } } catch (Exception ex) { CS$<>8__locals1.<>4__this.Log("[" + CS$<>8__locals1.sourceTag + "] Could not parse MatchEntry response: " + ex.Message + ""); } } } [CompilerGenerated] private sealed class <>c__DisplayClass182_0 { public SBGLPlugin <>4__this; public string existingId; internal void b__0(string res) { JObject val = <>4__this.ParseApiSingleObject(res); if (val != null) { <>4__this._currentQueueId = existingId; <>4__this._webStatus = "QUEUED"; <>4__this.Log("[Queue] ✓ Updated existing entry " + existingId + " with has_mod:true."); } else { <>4__this.Log("[Queue] Failed to update existing entry " + existingId + "."); } } internal void b__1(string res) { JObject val = <>4__this.ParseApiSingleObject(res); <>4__this._currentQueueId = ((string)((val != null) ? val["id"] : null)) ?? <>4__this._currentQueueId; <>4__this._webStatus = "QUEUED"; <>4__this.Log("[Queue] ✓ Created new entry " + <>4__this._currentQueueId + " with has_mod:true."); } } [CompilerGenerated] private sealed class <>c__DisplayClass183_0 { public SBGLPlugin <>4__this; public bool leaveSuccess; internal void b__0(string res) { if (<>4__this.ParseApiSingleObject(res) != null) { <>4__this.ResetPluginState(); <>4__this.Log("✓ Left Queue."); leaveSuccess = true; } } } [CompilerGenerated] private sealed class <>c__DisplayClass195_0 { public string existingMatchId; internal void b__0(string id) { existingMatchId = id; } } [CompilerGenerated] private sealed class <>c__DisplayClass195_1 { public string apiMatchId; internal void b__1(string id) { apiMatchId = id; } } [CompilerGenerated] private sealed class <>c__DisplayClass195_2 { public string fallbackFoundId; internal void b__2(string id) { fallbackFoundId = id; } internal void b__3(string id) { fallbackFoundId = id; } } [CompilerGenerated] private sealed class <>c__DisplayClass195_3 { public string finalCheckId; public SBGLPlugin <>4__this; internal void b__4(string res) { JObject obj = <>4__this.SelectNewestReusableMatch(<>4__this.ParseApiObjectList(res)); finalCheckId = (string)((obj != null) ? obj["id"] : null); } } [CompilerGenerated] private sealed class <>c__DisplayClass195_4 { public string newMatchId; internal void b__5(string id) { newMatchId = id; } } [CompilerGenerated] private sealed class <>c__DisplayClass195_5 { public string linkMatchId; public SBGLPlugin <>4__this; internal void b__6(string res) { JObject val = <>4__this.ParseApiSingleObject(res); if (val != null) { <>4__this._currentSession.match_id = linkMatchId; <>4__this.Log("[Match Creation] ✓ MatchmakingSession " + <>4__this._currentSession.id + " linked to match: " + linkMatchId + ""); } else { <>4__this.Log("[Match Creation] Could not confirm MatchmakingSession update"); } } } [CompilerGenerated] private sealed class <>c__DisplayClass195_6 { public string playerId; public SBGLPlugin <>4__this; } [CompilerGenerated] private sealed class <>c__DisplayClass195_7 { public string playerName; public string preMatchMmr; public string entryId; public <>c__DisplayClass195_6 CS$<>8__locals1; internal void b__7(string res) { try { JObject val = CS$<>8__locals1.<>4__this.ParseApiSingleObject(res); if (val != null) { playerName = (string)val["display_name"]; if (string.IsNullOrEmpty(playerName)) { CS$<>8__locals1.<>4__this.Log("[Match Creation] Player " + CS$<>8__locals1.playerId + " has no display_name, using ID"); playerName = CS$<>8__locals1.playerId; } object obj = val["current_mmr"]; if (obj != null) { preMatchMmr = obj.ToString(); } CS$<>8__locals1.<>4__this.Log("[Match Creation] Fetched player: " + playerName + " (MMR: " + preMatchMmr + ")"); } else { CS$<>8__locals1.<>4__this.Log("[Match Creation] Failed to fetch Player " + CS$<>8__locals1.playerId + " - response null"); playerName = CS$<>8__locals1.playerId; } } catch (Exception ex) { CS$<>8__locals1.<>4__this.Log("[Match Creation] Error fetching Player " + CS$<>8__locals1.playerId + ": " + ex.Message + ""); playerName = CS$<>8__locals1.playerId; } } internal void b__8(string id) { entryId = id; } } [CompilerGenerated] private sealed class <>c__DisplayClass197_0 { public bool shouldUpload; internal void b__3(bool ok) { shouldUpload = ok; } } [CompilerGenerated] private sealed class <>c__DisplayClass197_1 { public string playerId; public string entryId; public SBGLPlugin <>4__this; internal void b__4(string id) { playerId = id; } internal void b__6(string id) { entryId = id; } } [CompilerGenerated] private sealed class <>c__DisplayClass197_2 { public string preMatchMmr; public <>c__DisplayClass197_1 CS$<>8__locals1; internal void b__5(string res) { JObject val = CS$<>8__locals1.<>4__this.ParseApiSingleObject(res); object obj = ((val != null) ? val["current_mmr"] : null); if (obj != null) { preMatchMmr = obj.ToString(); } } } [CompilerGenerated] private sealed class <>c__DisplayClass198_0 { public SBGLPlugin <>4__this; public string playerName; internal void b__0(string res) { try { JObject val = <>4__this.ParseApiSingleObject(res); if (val != null) { <>4__this.Log("[Score Update] ✓ MatchEntry updated for " + playerName + ""); } } catch (Exception ex) { <>4__this.Log("[Score Update] Could not update MatchEntry: " + ex.Message + ""); } } } [CompilerGenerated] private sealed class <>c__DisplayClass202_0 { public SBGLPlugin <>4__this; public string resolvedId; public string normalizedName; public Func <>9__3; internal void b__0(string res) { JObject val = <>4__this.ParseApiObjectList(res)?.FirstOrDefault(); if (val != null) { resolvedId = (string)val["id"]; } } internal void b__1(string res) { JObject val = <>4__this.ParseApiObjectList(res)?.FirstOrDefault(); if (val != null) { resolvedId = (string)val["id"]; } } internal void b__2(string res) { List list = <>4__this.ParseApiObjectList(res); if (list != null && list.Count != 0) { JObject val = ((IEnumerable)list).FirstOrDefault((Func)((JObject r) => string.Equals((string)((r != null) ? r["display_name"] : null), normalizedName, StringComparison.OrdinalIgnoreCase) || string.Equals((string)((r != null) ? r["ign"] : null), normalizedName, StringComparison.OrdinalIgnoreCase))); JObject val2 = val ?? list.FirstOrDefault(); if (val2 != null) { resolvedId = (string)val2["id"]; } } } internal bool b__3(JObject r) { return string.Equals((string)((r != null) ? r["display_name"] : null), normalizedName, StringComparison.OrdinalIgnoreCase) || string.Equals((string)((r != null) ? r["ign"] : null), normalizedName, StringComparison.OrdinalIgnoreCase); } } [CompilerGenerated] private sealed class <>c__DisplayClass203_0 { public SBGLPlugin <>4__this; public int actualPlayerCount; public string source; internal void b__0(string res) { JObject val = <>4__this.ParseApiSingleObject(res); if (val != null) { <>4__this._lastUploadedPlayerCount = actualPlayerCount; <>4__this.Log($"[Match Count] ✓ Updated match player_count to {actualPlayerCount} ({source})"); } else { <>4__this.Log($"[Match Count] Could not confirm player_count update to {actualPlayerCount} ({source})"); } } } [CompilerGenerated] private sealed class <>c__DisplayClass210_0 { public SBGLPlugin <>4__this; public HashSet knownNames; public Action <>9__3; internal void b__3(string res) { JObject val = <>4__this.ParseApiSingleObject(res); string text = (string)((val != null) ? val["display_name"] : null); if (!string.IsNullOrWhiteSpace(text)) { knownNames.Add(text); } } } [CompilerGenerated] private sealed class <>c__DisplayClass210_1 { public string playerIdFromName; internal void b__4(string id) { playerIdFromName = id; } } [CompilerGenerated] private sealed class <>c__DisplayClass211_0 { public SBGLPlugin <>4__this; public Dictionary finalPreMmrByName; } [CompilerGenerated] private sealed class <>c__DisplayClass211_1 { public CachedLeaderboardPlayer p; public <>c__DisplayClass211_0 CS$<>8__locals1; internal void b__3(string res) { JObject val = CS$<>8__locals1.<>4__this.ParseApiSingleObject(res); object obj = ((val != null) ? val["current_mmr"] : null); if (obj != null && float.TryParse(obj.ToString(), NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { CS$<>8__locals1.finalPreMmrByName[p.Name] = result; CS$<>8__locals1.<>4__this.Log($"[Match Finalize] MMR for {p.Name} resolved from API: {result}"); } } } [CompilerGenerated] private sealed class <>c__DisplayClass211_2 { public string playerId; public string entryId; public <>c__DisplayClass211_0 CS$<>8__locals2; internal void b__6(string id) { playerId = id; } internal void b__5(string id) { entryId = id; } } [CompilerGenerated] private sealed class <>c__DisplayClass211_3 { public string preMatchMmr; public <>c__DisplayClass211_2 CS$<>8__locals3; internal void b__4(string res) { JObject val = CS$<>8__locals3.CS$<>8__locals2.<>4__this.ParseApiSingleObject(res); object obj = ((val != null) ? val["current_mmr"] : null); if (obj != null) { preMatchMmr = obj.ToString(); } } } [CompilerGenerated] private sealed class <>c__DisplayClass212_0 { public SBGLPlugin <>4__this; public string playerName; public string preMatchMmr; public string entryId; internal void b__0(string res) { JObject val = <>4__this.ParseApiSingleObject(res); if (val != null) { playerName = (string)val["display_name"]; object obj = val["current_mmr"]; if (obj != null) { preMatchMmr = obj.ToString(); } } } internal void b__1(string id) { entryId = id; } } [CompilerGenerated] private sealed class <>c__DisplayClass213_0 { public string matchId; public SBGLPlugin <>4__this; internal void b__0(string id) { matchId = id; } internal void b__1(string res) { JObject val = <>4__this.ParseApiSingleObject(res); if (val != null) { <>4__this._currentSession.match_id = matchId; <>4__this.Log("[Match Stats] ✓ MatchmakingSession " + <>4__this._currentSession.id + " linked to match: " + matchId + ""); } else { <>4__this.Log("[Match Stats] Could not confirm MatchmakingSession update"); } } } [CompilerGenerated] private sealed class <>c__DisplayClass216_0 { public SBGLPlugin <>4__this; public Action onMatchIdReceived; internal void b__0(string res) { JObject val = <>4__this.ParseApiSingleObject(res); if (val != null) { string text = ((string)val["id"]) ?? "unknown"; <>4__this._lastUploadedPlayerCount = Mathf.Max(0, <>4__this._matchExpectedPlayerCount); <>4__this.Log("[Match Stats] ✓ Match entry created (ID: " + text + ")"); <>4__this.ShowUploadNotification("Upload success: match ID " + text + ".", "success"); onMatchIdReceived?.Invoke(text); } else { <>4__this.Log("[Match Stats] Response received but could not parse ID"); <>4__this.ShowUploadNotification("Upload failed: invalid API response.", "failure"); } } } [CompilerGenerated] private sealed class <>c__DisplayClass217_0 { public SBGLPlugin <>4__this; public string playerDisplayName; public string playerId; public Func <>9__2; internal void b__0(string res) { try { JObject val = <>4__this.ParseApiSingleObject(res); if (val != null) { playerDisplayName = (string)val["display_name"]; <>4__this.Log("[Match Stats] Opponent display name (API): " + playerDisplayName + ""); } } catch (Exception ex) { <>4__this.Log("[Match Stats] Error parsing opponent profile: " + ex.Message + ""); } } internal bool b__2(string k) { return string.Equals(k?.Trim(), playerDisplayName?.Trim(), StringComparison.OrdinalIgnoreCase); } internal void b__1(string res) { JObject val = <>4__this.ParseApiSingleObject(res); if (val != null) { string text = ((string)val["id"]) ?? "unknown"; <>4__this.Log("[Match Stats] ✓ MatchEntry created (ID: " + text + ") for player " + (playerDisplayName ?? playerId) + ""); } else { <>4__this.Log("[Match Stats] Could not parse MatchEntry response for player " + (playerDisplayName ?? playerId) + ""); } } } [CompilerGenerated] private sealed class d__186 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SBGLPlugin <>4__this; private List 5__1; private string 5__2; private string 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__186(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__2 = null; 5__3 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (<>4__this._currentSession == null) { return false; } <>4__this._hasAccepted = true; <>4__this.Log("[Accept] Refreshing session data before accepting..."); <>2__current = <>4__this.PollSessionStatus(); <>1__state = 1; return true; case 1: <>1__state = -1; 5__1 = new List(); if (<>4__this._currentSession.accepted_player_ids != null) { 5__1.AddRange(<>4__this._currentSession.accepted_player_ids); } if (!5__1.Contains(<>4__this._userProfile.id)) { 5__1.Add(<>4__this._userProfile.id); } 5__2 = string.Join("\",\"", 5__1); 5__3 = "{\"accepted_player_ids\":[\"" + 5__2 + "\"]}"; <>4__this.Log("[Accept] Current player accepting: " + <>4__this._userProfile.id + ""); <>4__this.Log($"[Accept] Total accepted players: {5__1.Count}"); <>4__this.Log("[Accept] JSON payload: " + 5__3 + ""); <>4__this._currentSession.accepted_player_ids = new List(5__1); <>2__current = <>4__this.CallAPI("/MatchmakingSession/" + <>4__this._currentSession.id, "PUT", 5__3, delegate { <>4__this.Log("✓ Match Accepted. Waiting for all players to accept before transitioning to ready..."); }); <>1__state = 2; return true; case 2: <>1__state = -1; 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(); } } [CompilerGenerated] private sealed class d__187 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SBGLPlugin <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__187(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; if (<>4__this._currentSession == null || string.IsNullOrEmpty(<>4__this._currentSession.steam_lobby_link)) { return false; } <>4__this._autoJoinAttempts++; <>4__this._lastAutoJoinAttemptAt = DateTime.Now; <>4__this._lastAutoJoinSteamLink = <>4__this._currentSession.steam_lobby_link; <>4__this._hasAccepted = true; <>4__this.Log("Attempting automatic join with link: " + <>4__this._currentSession.steam_lobby_link); <>4__this.JoinBySteamLink(<>4__this._currentSession.steam_lobby_link, <>4__this._currentSession.lobby_password); 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(); } } [CompilerGenerated] private sealed class d__179 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SBGLPlugin <>4__this; private int 5__1; private bool 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__179(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) Scene activeScene; switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = 0; goto IL_04f6; case 1: <>1__state = -1; if (<>4__this._userProfile != null) { 5__1 = 0; } else { 5__1++; if (5__1 == 1) { <>4__this.Log($"Waiting for player profile resolution... (Attempt {5__1}/{10})"); } if (5__1 % 3 == 0) { <>4__this.Log($"Still waiting for player profile... (Attempt {5__1}/{10})"); } if (5__1 >= 10) { <>4__this.Log("Player profile resolution timed out. Background sync will stop until the next reload."); return false; } } goto IL_01a0; case 2: <>1__state = -1; goto IL_01ef; case 3: <>1__state = -1; goto IL_0266; case 4: <>1__state = -1; goto IL_02af; case 5: <>1__state = -1; goto IL_0326; case 6: <>1__state = -1; goto IL_0379; case 7: <>1__state = -1; goto IL_0440; case 8: <>1__state = -1; break; case 9: { <>1__state = -1; goto IL_04f6; } IL_01a0: if (<>4__this._userProfile == null) { break; } if (!<>4__this._activeSeasonFetched) { <>2__current = <>4__this.FetchActiveSeasonId(); <>1__state = 2; return true; } goto IL_01ef; IL_0326: if (<>4__this._currentSession != null && <>4__this._currentSession.status == "pending_accept") { <>2__current = <>4__this.PollSessionStatus(); <>1__state = 6; return true; } goto IL_0379; IL_01ef: activeScene = SceneManager.GetActiveScene(); 5__2 = ((Scene)(ref activeScene)).name.ToLower().Contains("menu"); if (!<>4__this._isQueueing && <>4__this._currentSession == null && !<>4__this._isInGameplay) { <>2__current = <>4__this.CheckExistingQueueEntry(); <>1__state = 3; return true; } goto IL_0266; IL_02af: if (<>4__this._isInitializing) { <>4__this._isInitializing = false; <>4__this.Log("Initialization Complete: Queue Unlocked."); } if (<>4__this._isQueueing && <>4__this._currentSession == null) { <>2__current = <>4__this.CheckForMatch(); <>1__state = 5; return true; } goto IL_0326; IL_0379: if (<>4__this._isHost && <>4__this._hostLobbyStarted && <>4__this._currentSession != null && !<>4__this._hostCancelSent) { if (NetworkServer.active) { <>4__this._hostServerWasActive = true; } else if (<>4__this._hostServerWasActive && <>4__this._currentSession.status != "completed") { <>4__this.Log("Host lobby appears closed. Marking MatchmakingSession as completed..."); <>2__current = <>4__this.CancelSessionAsHost("host_left_lobby"); <>1__state = 7; return true; } } goto IL_0440; IL_0440: if (<>4__this._currentSession != null && !<>4__this._isHost && <>4__this._currentSession.status == "ready" && !string.IsNullOrEmpty(<>4__this._currentSession.steam_lobby_link) && !<>4__this._hasAccepted) { <>4__this.Log("Auto-joining match as non-host..."); <>2__current = <>4__this.AutoJoinMatch(); <>1__state = 8; return true; } break; IL_04f6: <>4__this._syncTickCount++; if (<>4__this._userProfile == null) { <>2__current = <>4__this.EnsureUserProfileResolved("Sync"); <>1__state = 1; return true; } goto IL_01a0; IL_0266: if (5__2 && !IsRankedTriggered && !<>4__this._isInGameplay) { <>2__current = <>4__this.RefreshPlayerList(); <>1__state = 4; return true; } goto IL_02af; } <>2__current = _syncLoopDelay; <>1__state = 9; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__223 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string endpoint; public string method; public string json; public Action onSuccess; public SBGLPlugin <>4__this; private string 5__1; private UnityWebRequest 5__2; private string 5__3; private int 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__223(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__1 = null; 5__2 = null; 5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Invalid comparison between Unknown and I4 //IL_01da: Unknown result type (might be due to invalid IL or missing references) try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = <>4__this.GetBaseApiUrl() + endpoint; <>4__this.Log("[API] " + method + " " + endpoint + ""); <>4__this.Log("[API] Full URL: " + 5__1 + ""); 5__2 = new UnityWebRequest(5__1, method); <>1__state = -3; if (!string.IsNullOrEmpty(json)) { 5__2.uploadHandler = (UploadHandler)new UploadHandlerRaw(Encoding.UTF8.GetBytes(json)); } 5__2.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer(); <>4__this.ApplyApiHeaders(5__2); <>2__current = 5__2.SendWebRequest(); <>1__state = 1; return true; case 1: <>1__state = -3; if ((int)5__2.result == 1) { <>4__this.Log("[API] " + method + " " + endpoint + " - Success"); onSuccess?.Invoke(5__2.downloadHandler.text); } else { 5__3 = $"[API] {method} {endpoint} failed: {5__2.result}"; if (!string.IsNullOrEmpty(5__2.error)) { 5__3 = 5__3 + " - " + 5__2.error; } if (5__2.responseCode > 0) { 5__3 += $" (HTTP {5__2.responseCode})"; } DownloadHandler downloadHandler = 5__2.downloadHandler; if (!string.IsNullOrEmpty((downloadHandler != null) ? downloadHandler.text : null)) { 5__4 = Math.Min(200, 5__2.downloadHandler.text.Length); 5__3 = 5__3 + " - Response: " + 5__2.downloadHandler.text.Substring(0, 5__4); } <>4__this.Log("" + 5__3 + ""); 5__3 = null; } <>m__Finally1(); 5__2 = null; return false; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__2 != null) { ((IDisposable)5__2).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__192 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string reason; public SBGLPlugin <>4__this; private string 5__1; private string 5__2; private UnityWebRequest 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__192(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__1 = null; 5__2 = null; 5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Invalid comparison between Unknown and I4 //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected O, but got Unknown //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (<>4__this._hostCancelSent) { return false; } if (!<>4__this._isHost || <>4__this._currentSession == null || string.IsNullOrEmpty(<>4__this._currentSession.id)) { return false; } if (<>4__this._currentSession.id == "DEBUG") { return false; } <>4__this._hostCancelSent = true; 5__1 = <>4__this._currentSession.id; 5__2 = "{\"status\":\"completed\"}"; 5__3 = new UnityWebRequest(<>4__this.GetBaseApiUrl() + "/MatchmakingSession/" + 5__1, "PUT"); <>1__state = -3; 5__3.uploadHandler = (UploadHandler)new UploadHandlerRaw(Encoding.UTF8.GetBytes(5__2)); 5__3.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer(); <>4__this.ApplyApiHeaders(5__3); <>2__current = 5__3.SendWebRequest(); <>1__state = 1; return true; case 1: <>1__state = -3; if ((int)5__3.result == 1) { if (<>4__this._currentSession != null && <>4__this._currentSession.id == 5__1) { <>4__this._currentSession.status = "completed"; } <>4__this.Log("Host leave update sent (" + reason + "): session marked completed."); } else { <>4__this._hostCancelSent = false; <>4__this.Log($"Host cancel failed ({reason}): {5__3.result} {5__3.error}"); } <>m__Finally1(); 5__3 = null; return false; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__3 != null) { ((IDisposable)5__3).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__141 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string source; public SBGLPlugin <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__141(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>1__state = -3; <>2__current = <>4__this.CaptureMatchScreenshotForReview(source + " (per-hole immediate)"); <>1__state = 1; return true; case 1: <>1__state = -3; <>m__Finally1(); return false; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; <>4__this._matchScreenshotSignalCoroutine = null; } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__142 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string source; public SBGLPlugin <>4__this; private float 5__1; private float 5__2; private bool 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__142(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 1) <= 3u) { try { } finally { <>m__Finally1(); } } <>1__state = -2; } private bool MoveNext() { //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown bool result; try { switch (<>1__state) { default: result = false; break; case 0: <>1__state = -1; <>1__state = -3; <>2__current = (object)new WaitForSeconds(2f); <>1__state = 1; result = true; break; case 1: <>1__state = -3; 5__1 = 0f; 5__2 = 6f; 5__3 = false; goto IL_011f; case 2: <>1__state = -3; 5__1 += 0.25f; goto IL_011f; case 3: <>1__state = -3; <>2__current = <>4__this.UploadCapturedMatchScreenshotIfNeeded(source); <>1__state = 4; result = true; break; case 4: { <>1__state = -3; <>m__Finally1(); result = false; break; } IL_011f: if (5__1 < 5__2) { if (!<>4__this._matchEndedReceived) { try { if (<>4__this.TryCaptureFinalLeaderboardSnapshot(source + " (screenshot-wait)")) { 5__3 = true; goto IL_0136; } } catch { } <>2__current = (object)new WaitForSeconds(0.25f); <>1__state = 2; result = true; break; } 5__3 = true; } goto IL_0136; IL_0136: if (!5__3) { <>4__this.Log($"[Match Screenshot] Final leaderboard snapshot not available within {5__2}s - skipping forced-scoreboard capture ({source})"); result = false; <>m__Finally1(); } else { <>2__current = <>4__this.CaptureMatchScreenshotForReview(source); <>1__state = 3; result = true; } break; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } return result; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; <>4__this._matchScreenshotSignalCoroutine = null; } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__147 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string source; public SBGLPlugin <>4__this; private float 5__1; private int 5__2; private int 5__3; private Texture2D 5__4; private Texture2D 5__5; private byte[] 5__6; private Exception 5__7; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__147(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__4 = null; 5__5 = null; 5__6 = null; 5__7 = null; <>1__state = -2; } private bool MoveNext() { //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Expected O, but got Unknown //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (<>4__this._matchScreenshotUploadCompleted || <>4__this._matchScreenshotUploadInProgress) { return false; } if (<>4__this._pendingMatchScreenshotBytes != null && <>4__this._pendingMatchScreenshotBytes.Length != 0) { <>4__this.Log("[Match Screenshot] Replacing previous pending screenshot with a newer capture (" + source + ")"); } 5__1 = 0f; goto IL_00db; case 1: <>1__state = -1; 5__1 += Mathf.Max(Time.unscaledDeltaTime, 0.016f); goto IL_00db; case 2: { <>1__state = -1; 5__2 = Screen.width; 5__3 = Screen.height; if (5__2 <= 0 || 5__3 <= 0) { <>4__this.Log("[Match Screenshot] Screen dimensions were invalid - skipping capture"); return false; } 5__4 = null; 5__5 = null; try { 5__4 = new Texture2D(5__2, 5__3, (TextureFormat)3, false); 5__4.ReadPixels(new Rect(0f, 0f, (float)5__2, (float)5__3), 0, 0, false); 5__4.Apply(false, false); 5__5 = <>4__this.ResizeTextureToFit(5__4, 1920, 1080); 5__6 = <>4__this.EncodeScreenshotBytes(5__5); if (5__6 == null || 5__6.Length == 0) { <>4__this.Log("[Match Screenshot] JPEG encoding returned no data - skipping capture"); return false; } <>4__this._pendingMatchScreenshotBytes = 5__6; <>4__this._pendingMatchScreenshotFileName = <>4__this.BuildMatchScreenshotFileName(); <>4__this._pendingUploadedScreenshotUrl = null; <>4__this.Log($"[Match Screenshot] ✓ Captured final scoreboard screenshot from {source} ({((Texture)5__5).width}x{((Texture)5__5).height}, {(float)5__6.Length / 1024f:0.#} KB)"); 5__6 = null; } catch (Exception ex) { 5__7 = ex; <>4__this.Log("[Match Screenshot] Could not capture screenshot from " + source + ": " + 5__7.Message + ""); } finally { if ((Object)(object)5__5 != (Object)null && 5__5 != 5__4) { Object.Destroy((Object)(object)5__5); } if ((Object)(object)5__4 != (Object)null) { Object.Destroy((Object)(object)5__4); } } return false; } IL_00db: if (!CourseManager.ForceDisplayScoreboard && 5__1 < 4f) { <>2__current = null; <>1__state = 1; return true; } if (!CourseManager.ForceDisplayScoreboard) { <>4__this.Log("[Match Screenshot] Forced scoreboard was not visible in time for " + source + " - skipping capture for now"); return false; } <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__160 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SBGLPlugin <>4__this; private string 5__1; private string 5__2; private UnityWebRequest 5__3; private List 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__160(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 2) { try { } finally { <>m__Finally1(); } } 5__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Invalid comparison between Unknown and I4 //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown bool result; try { switch (<>1__state) { default: result = false; break; case 0: <>1__state = -1; if (<>4__this._userProfile == null || <>4__this._currentSession == null) { <>4__this.Log("[Match Stats] Failed: Missing profile or session"); result = false; break; } <>4__this.Log("[Match Stats] Waiting for leaderboard to populate..."); <>2__current = (object)new WaitForSeconds(1.5f); <>1__state = 1; result = true; break; case 1: <>1__state = -1; 5__1 = "{\"matchmaking_session_id\":\"" + <>4__this._currentSession.id + "\"}"; 5__2 = <>4__this.GetBaseApiUrl() + "/Match?q=" + UnityWebRequest.EscapeURL(5__1); <>4__this.Log("[Match Stats] Checking for existing match entry..."); <>4__this.Log("[Match Stats] Query URL: " + 5__2.Substring(0, Math.Min(150, 5__2.Length)) + "..."); 5__3 = UnityWebRequest.Get(5__2); <>1__state = -3; <>4__this.ApplyApiHeaders(5__3); <>2__current = 5__3.SendWebRequest(); <>1__state = 2; result = true; break; case 2: <>1__state = -3; if ((int)5__3.result == 1) { 5__4 = <>4__this.ParseApiObjectList(5__3.downloadHandler.text); if (5__4.Count > 0) { <>4__this.Log($"[Match Stats] Match already exists for this session (found {5__4.Count} entries)"); <>4__this._matchStatsSubmitted = true; result = false; <>m__Finally1(); break; } <>4__this.Log("[Match Stats] No existing match found - proceeding with submission"); 5__4 = null; } else { <>4__this.Log($"[Match Stats] Could not query existing matches: {5__3.result} - proceeding anyway"); } <>m__Finally1(); 5__3 = null; <>2__current = <>4__this.SubmitMatchStats(); <>1__state = 3; result = true; break; case 3: <>1__state = -1; result = false; break; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } return result; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__3 != null) { ((IDisposable)5__3).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__181 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SBGLPlugin <>4__this; private string 5__1; private string 5__2; private UnityWebRequest 5__3; private List 5__4; private string 5__5; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__181(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 1) <= 1u) { try { } finally { <>m__Finally1(); } } 5__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; 5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Invalid comparison between Unknown and I4 try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = "{\"player_id\":\"" + <>4__this._userProfile.id + "\",\"status\":\"queued\"}"; 5__2 = <>4__this.GetBaseApiUrl() + "/MatchmakingQueue?q=" + UnityWebRequest.EscapeURL(5__1); 5__3 = UnityWebRequest.Get(5__2); <>1__state = -3; <>4__this.ApplyApiHeaders(5__3); <>2__current = 5__3.SendWebRequest(); <>1__state = 1; return true; case 1: <>1__state = -3; if ((int)5__3.result != 1) { break; } 5__4 = <>4__this.ParseApiObjectList(5__3.downloadHandler.text); if (5__4 != null && 5__4.Count > 0) { <>4__this._currentQueueId = (string)5__4[0]["id"]; <>4__this._isQueueing = true; <>4__this._webStatus = "QUEUED"; <>4__this._queueStartTime = DateTime.Now; <>4__this.Log("[Queue] Detected existing queue entry " + <>4__this._currentQueueId + " from website — rejoining."); 5__5 = "{\"has_mod\":true,\"created_by\":\"SBGL_UnifiedMod\",\"match_type\":\"" + <>4__this.GetQueueMatchTypePayload() + "\"}"; <>2__current = <>4__this.CallAPI("/MatchmakingQueue/" + <>4__this._currentQueueId, "PUT", 5__5, delegate(string res) { if (<>4__this.ParseApiSingleObject(res) != null) { <>4__this.Log("[Queue] ✓ Patched has_mod:true onto existing entry " + <>4__this._currentQueueId + "."); } }); <>1__state = 2; return true; } goto IL_0226; case 2: { <>1__state = -3; 5__5 = null; goto IL_0226; } IL_0226: 5__4 = null; break; } <>m__Finally1(); 5__3 = null; return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__3 != null) { ((IDisposable)5__3).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__184 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SBGLPlugin <>4__this; private string 5__1; private string 5__2; private UnityWebRequest 5__3; private List 5__4; private JObject 5__5; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__184(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; 5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Invalid comparison between Unknown and I4 //IL_01f7: Unknown result type (might be due to invalid IL or missing references) try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = "{\"$or\":[{\"host_player_id\":\"" + <>4__this._userProfile.id + "\"},{\"player_ids\":{\"$in\":[\"" + <>4__this._userProfile.id + "\"]}}],\"status\":\"pending_accept\"}"; 5__2 = <>4__this.GetBaseApiUrl() + "/MatchmakingSession?q=" + UnityWebRequest.EscapeURL(5__1); <>4__this.Log("[Sync] GET /MatchmakingSession (checking for pending matches)"); <>4__this.Log("[Sync] Full URL: " + 5__2.Substring(0, Math.Min(150, 5__2.Length)) + "..."); 5__3 = UnityWebRequest.Get(5__2); <>1__state = -3; <>4__this.ApplyApiHeaders(5__3); <>2__current = 5__3.SendWebRequest(); <>1__state = 1; return true; case 1: <>1__state = -3; if ((int)5__3.result == 1) { 5__4 = <>4__this.ParseApiObjectList(5__3.downloadHandler.text); 5__5 = ((IEnumerable)5__4).FirstOrDefault((Func)((JObject session) => !string.IsNullOrEmpty((string)session["lobby_name"]))); if (5__5 != null) { <>4__this._webStatus = "MATCH FOUND: PENDING"; <>4__this.Log("Match Found! Accept needed."); } 5__4 = null; 5__5 = null; } else { <>4__this.Log($"[Sync] CheckForMatch failed: {5__3.result} - {5__3.error}"); } <>m__Finally1(); 5__3 = null; return false; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__3 != null) { ((IDisposable)5__3).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__107 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SBGLPlugin <>4__this; private string 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__107(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (<>4__this._currentSession == null || <>4__this._userProfile == null) { return false; } if (<>4__this._isHost) { return false; } <>4__this.Log("[PDS] Claiming host role for session " + <>4__this._currentSession.id + "..."); 5__1 = "{\"host_player_id\":\"" + <>4__this._userProfile.id + "\"}"; <>2__current = <>4__this.CallAPI("/MatchmakingSession/" + <>4__this._currentSession.id, "PUT", 5__1, delegate(string res) { JObject val = <>4__this.ParseApiSingleObject(res); if (val != null) { <>4__this._currentSession.host_player_id = <>4__this._userProfile.id; <>4__this._isHost = true; <>4__this.Log("[PDS] ✓ Host role claimed — session host_player_id set to our player ID."); } else { <>4__this.Log("[PDS] Failed to claim host role — API response was null."); } }); <>1__state = 1; return true; case 1: <>1__state = -1; 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(); } } [CompilerGenerated] private sealed class d__194 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SBGLPlugin <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__194(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (<>4__this._matchCreationInProgress) { <>4__this.Log("[Match Creation] Already in progress - skipping duplicate call"); return false; } <>4__this._matchCreationInProgress = true; <>2__current = <>4__this.CreateMatchAndEntriesInternal(); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this._matchCreationInProgress = false; 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(); } } [CompilerGenerated] private sealed class d__195 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SBGLPlugin <>4__this; private bool 5__1; private string 5__2; private bool 5__3; private string 5__4; private Dictionary 5__5; private Dictionary 5__6; private List 5__7; private Dictionary 5__8; private bool 5__9; private List 5__10; private LiveLeaderboardPlugin 5__11; private List 5__12; private List.Enumerator <>s__13; private LiveLeaderboardPlugin.SBGLPlayer 5__14; private string 5__15; private int 5__16; private Exception 5__17; private <>c__DisplayClass195_0 <>8__18; private float 5__19; private float 5__20; private string 5__21; private <>c__DisplayClass195_1 <>8__22; private <>c__DisplayClass195_2 <>8__23; private float 5__24; private string 5__25; private <>c__DisplayClass195_3 <>8__26; private string 5__27; private <>c__DisplayClass195_4 <>8__28; private IEnumerable 5__29; private <>c__DisplayClass195_5 <>8__30; private List.Enumerator <>s__31; private <>c__DisplayClass195_6 <>8__32; private <>c__DisplayClass195_7 <>8__33; private int 5__34; private int 5__35; private int 5__36; private int 5__37; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__195(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 11) <= 1u) { try { } finally { <>m__Finally1(); } } 5__2 = null; 5__4 = null; 5__5 = null; 5__6 = null; 5__7 = null; 5__8 = null; 5__10 = null; 5__11 = null; 5__12 = null; <>s__13 = default(List.Enumerator); 5__14 = null; 5__15 = null; 5__17 = null; <>8__18 = null; 5__21 = null; <>8__22 = null; <>8__23 = null; 5__25 = null; <>8__26 = null; 5__27 = null; <>8__28 = null; 5__29 = null; <>8__30 = null; <>s__31 = default(List.Enumerator); <>8__32 = null; <>8__33 = null; <>1__state = -2; } private bool MoveNext() { //IL_0864: Unknown result type (might be due to invalid IL or missing references) //IL_086e: Expected O, but got Unknown try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (<>4__this._userProfile == null) { <>4__this.Log("[Match Creation] Failed: Missing player profile"); return false; } 5__1 = <>4__this._currentSession == null; if (5__1) { if (string.IsNullOrWhiteSpace(<>4__this._localManualSessionId)) { <>4__this._localManualSessionId = <>4__this.BuildStableManualLocalSessionId(); } <>4__this.Log("[Match Creation] Manual local lobby detected. Session surrogate: " + <>4__this._localManualSessionId + ""); } 5__2 = <>4__this._currentSession?.match_type ?? PlayerPrefs.GetString("MatchType", ""); 5__3 = <>4__this.IsCurrentMatchCasual(); if (IsProSeriesMatchType(5__2) || IsProSeriesMatchType(PlayerPrefs.GetString("MatchType", ""))) { if (!<>4__this._proSeriesSkipLogged) { <>4__this.Log("[Match] Pro Series match — automated upload skipped"); <>4__this._proSeriesSkipLogged = true; } <>4__this._matchEntriesCreated = true; return false; } 5__4 = ((<>4__this._currentSession != null) ? <>4__this._currentSession.id : <>4__this._localManualSessionId); <>4__this.Log("[Match Creation] Starting new match for session " + 5__4 + ""); <>4__this._matchStartTime = DateTime.UtcNow; 5__5 = new Dictionary(); 5__6 = new Dictionary(); 5__7 = null; try { 5__11 = Object.FindAnyObjectByType((FindObjectsInactive)1); if ((Object)(object)5__11 != (Object)null) { 5__12 = 5__11.GetCurrentLeaderboard(); 5__7 = new List(5__12); <>4__this.Log($"[Match Creation] Found {5__12.Count} players on leaderboard"); <>s__13 = 5__12.GetEnumerator(); try { while (<>s__13.MoveNext()) { 5__14 = <>s__13.Current; if (5__14 != null) { 5__5[5__14.Name] = 5__14.BaseScore; if (!string.IsNullOrEmpty(5__14.RawStrokes)) { 5__15 = 5__14.RawStrokes.Replace("±", "").Trim(); int.TryParse(5__15, out 5__16); 5__6[5__14.Name] = 5__16; 5__15 = null; } 5__14 = null; } } } finally { ((IDisposable)<>s__13).Dispose(); } <>s__13 = default(List.Enumerator); 5__12 = null; } 5__11 = null; } catch (Exception ex) { 5__17 = ex; <>4__this.Log("[Match Creation] Error prefetching leaderboard: " + 5__17.Message + ""); } <>4__this._cachedLeaderboardScores = 5__5; <>4__this._cachedLeaderboardScoresVsPar = 5__6; <>4__this._matchExpectedPlayerCount = 5__7?.Count ?? 0; 5__8 = ((5__7 != null) ? <>4__this.BuildFinishPositionMap(5__7) : new Dictionary(StringComparer.OrdinalIgnoreCase)); if (5__3) { if (5__7 == null || 5__7.Count == 0) { <>4__this.Log("[Casual] Leaderboard is empty - deferring casual stat update until players appear"); if (<>4__this._monitorCoroutine == null) { <>4__this._monitorCoroutine = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.MonitorAndUpdateScores()); } return false; } <>4__this.Log("[Casual] Casual match detected - skipping Match/MatchEntry upload and incrementing player stats instead"); <>2__current = <>4__this.IncrementCasualMatchesPlayedForActivePlayers(5__7); <>1__state = 1; return true; } 5__9 = <>4__this._isHost || NetworkServer.active; if (5__9) { <>4__this.Log("[Match Creation] We are the host — creating Match record with priority"); if (<>4__this._currentSession != null) { <>8__18 = new <>c__DisplayClass195_0(); <>8__18.existingMatchId = null; <>2__current = <>4__this.ResolveExistingMatchIdForCurrentSession(delegate(string id) { <>8__18.existingMatchId = id; }); <>1__state = 2; return true; } goto IL_0a1e; } MatchResultSubmissionService.ReceivedP2PMatchId = null; <>4__this.Log("[Match Creation] We are a client — waiting up to 12s for host to upload the match..."); 5__19 = 0f; 5__20 = 2f; goto IL_089d; case 1: <>1__state = -1; if (<>4__this._monitorCoroutine != null) { ((MonoBehaviour)<>4__this).StopCoroutine(<>4__this._monitorCoroutine); <>4__this._monitorCoroutine = null; } return false; case 2: <>1__state = -1; if (!string.IsNullOrEmpty(<>8__18.existingMatchId)) { <>4__this._currentMatchId = <>8__18.existingMatchId; <>4__this.ShowUploadNotification("Match record already exists; reusing existing upload."); goto IL_0cf9; } <>8__18 = null; goto IL_0a1e; case 3: <>1__state = -1; if (!string.IsNullOrEmpty(<>8__22.apiMatchId)) { <>4__this.Log($"[Match Creation] ✓ Found host match via API at {5__19:0.#}s: {<>8__22.apiMatchId}"); <>4__this._currentMatchId = <>8__22.apiMatchId; <>4__this.ShowUploadNotification("Match record adopted from host."); goto IL_0cf9; } <>8__22 = null; goto IL_085e; case 4: <>1__state = -1; 5__19 += 0.5f; 5__21 = null; goto IL_089d; case 5: <>1__state = -1; goto IL_0992; case 6: <>1__state = -1; goto IL_0992; case 7: <>1__state = -1; if (!string.IsNullOrWhiteSpace(<>8__26.finalCheckId)) { <>4__this.Log("[Match Creation] ✓ Final pre-POST check found existing active match: " + <>8__26.finalCheckId + " — skipping duplicate POST"); <>4__this._currentMatchId = <>8__26.finalCheckId; if (<>4__this._currentSession != null) { <>4__this._currentSession.match_id = <>8__26.finalCheckId; } <>4__this.ShowUploadNotification("Match record already exists; reusing existing upload."); goto IL_0cf9; } <>8__26 = null; 5__27 = null; goto IL_0bc9; case 8: <>1__state = -1; if (string.IsNullOrEmpty(<>8__28.newMatchId)) { <>4__this.Log("[Match Creation] Failed to create Match record"); <>4__this.ShowUploadNotification("Upload failed: could not create match record.", "failure"); return false; } <>4__this._currentMatchId = <>8__28.newMatchId; <>4__this.Log("[Match Creation] ✓ Match created: " + <>8__28.newMatchId + ""); <>4__this.ShowUploadNotification("Upload success: match record created.", "success"); 5__29 = CompetitivePluginCheck.GetKnownPeers(); MatchResultSubmissionService.BroadcastMatchId(<>8__28.newMatchId, 5__29); <>8__28 = null; 5__29 = null; goto IL_0cf9; case 9: <>1__state = -1; <>8__30 = null; goto IL_0dd2; case 10: <>1__state = -1; <>4__this._matchExpectedPlayerCount = 5__10.Count; <>s__31 = 5__10.GetEnumerator(); <>1__state = -3; goto IL_12ef; case 11: <>1__state = -3; goto IL_10e4; case 12: { <>1__state = -3; if (string.IsNullOrWhiteSpace(<>8__33.entryId)) { <>4__this.Log("[Match Creation] MatchEntry not ready yet for " + (<>8__33.playerName ?? <>8__33.CS$<>8__locals1.playerId) + "; gameplay monitor will retry if needed"); } <>8__33 = null; <>8__32 = null; goto IL_12ef; } IL_0cf9: if (<>4__this._currentSession != null) { <>8__30 = new <>c__DisplayClass195_5(); <>8__30.<>4__this = <>4__this; <>8__30.linkMatchId = <>4__this._currentMatchId; <>2__current = <>4__this.CallAPI("/MatchmakingSession/" + <>4__this._currentSession.id, "PUT", "{\"match_id\":\"" + <>8__30.linkMatchId + "\"}", delegate(string res) { JObject val2 = <>8__30.<>4__this.ParseApiSingleObject(res); if (val2 != null) { <>8__30.<>4__this._currentSession.match_id = <>8__30.linkMatchId; <>8__30.<>4__this.Log("[Match Creation] ✓ MatchmakingSession " + <>8__30.<>4__this._currentSession.id + " linked to match: " + <>8__30.linkMatchId + ""); } else { <>8__30.<>4__this.Log("[Match Creation] Could not confirm MatchmakingSession update"); } }); <>1__state = 9; return true; } <>4__this.Log("[Match Creation] Local lobby mode: skipping MatchmakingSession link"); goto IL_0dd2; IL_12ef: if (<>s__31.MoveNext()) { <>8__32 = new <>c__DisplayClass195_6(); <>8__32.<>4__this = <>4__this; <>8__32.playerId = <>s__31.Current; <>8__33 = new <>c__DisplayClass195_7(); <>8__33.CS$<>8__locals1 = <>8__32; <>8__33.playerName = null; <>8__33.preMatchMmr = null; 5__34 = 0; 5__35 = 0; if (<>8__33.CS$<>8__locals1.playerId == <>4__this._userProfile.id) { <>8__33.playerName = <>4__this._userProfile.display_name; <>8__33.preMatchMmr = <>4__this._userProfile.current_mmr.ToString(); <>4__this.Log("[Match Creation] Current player: " + <>8__33.playerName + " (MMR: " + <>8__33.preMatchMmr + ")"); goto IL_10e4; } <>2__current = <>4__this.CallAPI("/Player/" + <>8__33.CS$<>8__locals1.playerId, "GET", "", delegate(string res) { try { JObject val = <>8__33.CS$<>8__locals1.<>4__this.ParseApiSingleObject(res); if (val != null) { <>8__33.playerName = (string)val["display_name"]; if (string.IsNullOrEmpty(<>8__33.playerName)) { <>8__33.CS$<>8__locals1.<>4__this.Log("[Match Creation] Player " + <>8__33.CS$<>8__locals1.playerId + " has no display_name, using ID"); <>8__33.playerName = <>8__33.CS$<>8__locals1.playerId; } object obj2 = val["current_mmr"]; if (obj2 != null) { <>8__33.preMatchMmr = obj2.ToString(); } <>8__33.CS$<>8__locals1.<>4__this.Log("[Match Creation] Fetched player: " + <>8__33.playerName + " (MMR: " + <>8__33.preMatchMmr + ")"); } else { <>8__33.CS$<>8__locals1.<>4__this.Log("[Match Creation] Failed to fetch Player " + <>8__33.CS$<>8__locals1.playerId + " - response null"); <>8__33.playerName = <>8__33.CS$<>8__locals1.playerId; } } catch (Exception ex2) { <>8__33.CS$<>8__locals1.<>4__this.Log("[Match Creation] Error fetching Player " + <>8__33.CS$<>8__locals1.playerId + ": " + ex2.Message + ""); <>8__33.playerName = <>8__33.CS$<>8__locals1.playerId; } }); <>1__state = 11; return true; } <>m__Finally1(); <>s__31 = default(List.Enumerator); <>4__this._matchEntriesCreated = true; <>4__this.Log("[Match Creation] ✓ Match and entries initialized. Starting score monitoring..."); if (<>4__this._monitorCoroutine == null) { <>4__this._monitorCoroutine = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.MonitorAndUpdateScores()); } return false; IL_0a1e: <>4__this.Log("[Match Creation] No existing Match found — proceeding with POST"); 5__25 = ((<>4__this._currentSession != null) ? <>4__this._currentSession.id : <>4__this._localManualSessionId); if (!string.IsNullOrWhiteSpace(5__25)) { <>8__26 = new <>c__DisplayClass195_3(); <>8__26.<>4__this = <>4__this; <>8__26.finalCheckId = null; 5__27 = UnityWebRequest.EscapeURL("{\"matchmaking_session_id\":\"" + 5__25 + "\"}"); <>2__current = <>4__this.CallAPI("/Match?q=" + 5__27 + "&sort_by=created_date", "GET", "", delegate(string res) { JObject obj = <>8__26.<>4__this.SelectNewestReusableMatch(<>8__26.<>4__this.ParseApiObjectList(res)); <>8__26.finalCheckId = (string)((obj != null) ? obj["id"] : null); }); <>1__state = 7; return true; } goto IL_0bc9; IL_089d: if (5__19 < 12f) { 5__21 = MatchResultSubmissionService.ReceivedP2PMatchId; if (!string.IsNullOrEmpty(5__21)) { <>4__this.Log("[Match Creation] ✓ Received P2P Match ID from host: " + 5__21 + ""); <>4__this._currentMatchId = 5__21; if (<>4__this._currentSession != null) { <>4__this._currentSession.match_id = 5__21; } <>4__this.ShowUploadNotification("Match record adopted from host via P2P."); goto IL_0cf9; } if (<>4__this._currentSession != null && 5__19 >= 5__20) { <>8__22 = new <>c__DisplayClass195_1(); 5__20 += 2f; <>8__22.apiMatchId = null; <>2__current = <>4__this.ResolveExistingMatchIdForCurrentSession(delegate(string id) { <>8__22.apiMatchId = id; }, logMisses: false); <>1__state = 3; return true; } goto IL_085e; } <>4__this.Log("[Match Creation] Host did not upload within 12s — non-host fallback slot ordering..."); if (<>4__this._currentSession != null) { <>8__23 = new <>c__DisplayClass195_2(); 5__24 = <>4__this.GetCurrentPlayerMatchUploadDelaySeconds(); <>8__23.fallbackFoundId = null; if (5__24 > 0f) { <>2__current = <>4__this.WaitForExistingMatchBeforeFallback(5__24, delegate(string id) { <>8__23.fallbackFoundId = id; }); <>1__state = 5; return true; } <>2__current = <>4__this.ResolveExistingMatchIdForCurrentSession(delegate(string id) { <>8__23.fallbackFoundId = id; }, logMisses: false); <>1__state = 6; return true; } goto IL_0a0c; IL_0992: if (!string.IsNullOrEmpty(<>8__23.fallbackFoundId)) { <>4__this.Log("[Match Creation] ✓ Match adopted in non-host fallback: " + <>8__23.fallbackFoundId + ""); <>4__this._currentMatchId = <>8__23.fallbackFoundId; <>4__this.ShowUploadNotification("Match record adopted from another player."); goto IL_0cf9; } <>8__23 = null; goto IL_0a0c; IL_10e4: if (!string.IsNullOrEmpty(<>8__33.playerName)) { <>4__this._playerIdsByName[<>8__33.playerName] = <>8__33.CS$<>8__locals1.playerId; if (<>4__this._cachedLeaderboardScores.TryGetValue(<>8__33.playerName, out 5__37)) { 5__34 = 5__37; <>4__this._cachedLeaderboardScoresVsPar.TryGetValue(<>8__33.playerName, out 5__35); } <>4__this._lastSubmittedScores[<>8__33.playerName] = 5__34; <>4__this._lastSubmittedScoresVsPar[<>8__33.playerName] = 5__35; } 5__36 = 0; if (!string.IsNullOrWhiteSpace(<>8__33.playerName)) { 5__8.TryGetValue(<>8__33.playerName, out 5__36); } <>8__33.entryId = null; <>2__current = <>4__this.EnsureMatchEntryForPlayer("Match Creation", <>8__33.CS$<>8__locals1.playerId, <>8__33.playerName, <>8__33.preMatchMmr, null, 5__34, 5__35, 5__36, "Progressive match tracking - created at round start", delegate(string id) { <>8__33.entryId = id; }); <>1__state = 12; return true; IL_0bc9: 5__25 = null; <>8__28 = new <>c__DisplayClass195_4(); <>8__28.newMatchId = null; <>2__current = <>4__this.SubmitMatchEntry(<>4__this.CollectMatchStats(0f), delegate(string id) { <>8__28.newMatchId = id; }); <>1__state = 8; return true; IL_0dd2: <>4__this._playerMatchEntryIds.Clear(); <>4__this._playerIdsByName.Clear(); <>4__this._lastSubmittedScores.Clear(); <>4__this._lastSubmittedScoresVsPar.Clear(); if (5__7 == null || 5__7.Count == 0) { <>4__this.Log("[Match Creation] Leaderboard empty at round start — deferring MatchEntry creation until the gameplay monitor sees players"); if (<>4__this._monitorCoroutine == null) { <>4__this._monitorCoroutine = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.MonitorAndUpdateScores()); } return false; } 5__10 = ((<>4__this._currentSession != null && <>4__this._currentSession.player_ids != null && <>4__this._currentSession.player_ids.Count > 0) ? <>4__this._currentSession.player_ids : new List { <>4__this._userProfile.id }); <>2__current = <>4__this.EnrichPlayerIdsFromLeaderboard(5__7, 5__10); <>1__state = 10; return true; IL_085e: <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 4; return true; IL_0a0c: <>4__this.Log("[Match Creation] No match found in non-host fallback — posting as fallback creator"); goto IL_0a1e; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>s__31).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__212 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string playerId; public SBGLPlugin <>4__this; private <>c__DisplayClass212_0 <>8__1; private int 5__2; private int 5__3; private int 5__4; private int 5__5; private int 5__6; private int 5__7; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__212(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass212_0(); <>8__1.<>4__this = <>4__this; if (string.IsNullOrWhiteSpace(playerId) || string.IsNullOrWhiteSpace(<>4__this._currentMatchId)) { return false; } <>8__1.playerName = null; <>8__1.preMatchMmr = null; if (<>4__this._userProfile != null && string.Equals(playerId, <>4__this._userProfile.id, StringComparison.OrdinalIgnoreCase)) { <>8__1.playerName = <>4__this._userProfile.display_name; <>8__1.preMatchMmr = <>4__this._userProfile.current_mmr.ToString(); goto IL_0149; } <>2__current = <>4__this.CallAPI("/Player/" + playerId, "GET", "", delegate(string res) { JObject val = <>8__1.<>4__this.ParseApiSingleObject(res); if (val != null) { <>8__1.playerName = (string)val["display_name"]; object obj = val["current_mmr"]; if (obj != null) { <>8__1.preMatchMmr = obj.ToString(); } } }); <>1__state = 1; return true; case 1: <>1__state = -1; goto IL_0149; case 2: { <>1__state = -1; if (!string.IsNullOrEmpty(<>8__1.entryId)) { <>4__this._playerMatchEntryIds[playerId] = <>8__1.entryId; <>4__this._playerIdsByName[<>8__1.playerName.Trim()] = playerId; <>4__this._lastSubmittedScores[<>8__1.playerName] = 5__2; <>4__this._lastSubmittedScoresVsPar[<>8__1.playerName] = 5__3; } else { <>4__this.Log("[Match Finalize] Could not create placeholder MatchEntry for missing session player " + <>8__1.playerName + ""); } return false; } IL_0149: if (string.IsNullOrWhiteSpace(<>8__1.playerName)) { <>8__1.playerName = playerId; } 5__2 = 0; 5__3 = 0; if (<>4__this._lastSubmittedScores.TryGetValue(<>8__1.playerName, out 5__4)) { 5__2 = 5__4; } else if (<>4__this._cachedLeaderboardScores.TryGetValue(<>8__1.playerName, out 5__6)) { 5__2 = 5__6; } if (<>4__this._lastSubmittedScoresVsPar.TryGetValue(<>8__1.playerName, out 5__5)) { 5__3 = 5__5; } else if (<>4__this._cachedLeaderboardScoresVsPar.TryGetValue(<>8__1.playerName, out 5__7)) { 5__3 = 5__7; } if (5__2 == 0) { <>4__this.Log("[Match Finalize] Skipping placeholder for session player " + <>8__1.playerName + " — game points is 0"); return false; } <>8__1.entryId = null; <>2__current = <>4__this.EnsureMatchEntryForPlayer("Match Finalize", playerId, <>8__1.playerName, <>8__1.preMatchMmr, null, 5__2, 5__3, 0, "Placeholder entry created because player was in the session but missing from the final leaderboard snapshot", delegate(string id) { <>8__1.entryId = id; }); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__228 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string url; public SBGLPlugin <>4__this; private UnityWebRequest 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__228(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Invalid comparison between Unknown and I4 try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = UnityWebRequestTexture.GetTexture(url.Replace("http://", "https://")); <>1__state = -3; <>2__current = 5__1.SendWebRequest(); <>1__state = 1; return true; case 1: <>1__state = -3; if ((int)5__1.result == 1) { <>4__this._profileTexture = DownloadHandlerTexture.GetContent(5__1); } <>4__this._hasFetchedProfilePic = true; <>m__Finally1(); 5__1 = null; return false; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__1 != null) { ((IDisposable)5__1).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__210 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public List startingLeaderboard; public List playerIds; public SBGLPlugin <>4__this; private <>c__DisplayClass210_0 <>8__1; private List 5__2; private Dictionary 5__3; private HashSet 5__4; private List.Enumerator <>s__5; private string 5__6; private List.Enumerator <>s__7; private LiveLeaderboardPlugin.SBGLPlayer 5__8; private <>c__DisplayClass210_1 <>8__9; private string 5__10; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__210(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { switch (<>1__state) { case -3: case 1: try { } finally { <>m__Finally1(); } break; case -4: case 2: try { } finally { <>m__Finally2(); } break; } <>8__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; <>s__5 = default(List.Enumerator); 5__6 = null; <>s__7 = default(List.Enumerator); 5__8 = null; <>8__9 = null; 5__10 = null; <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass210_0(); <>8__1.<>4__this = <>4__this; if (startingLeaderboard == null || startingLeaderboard.Count == 0 || playerIds == null) { return false; } 5__2 = (from p in startingLeaderboard?.Where((LiveLeaderboardPlugin.SBGLPlayer p) => p != null && !string.IsNullOrWhiteSpace(p.Name)) select p.Name).ToList() ?? new List(); 5__3 = <>4__this.GetTestPlayerOverrides(5__2); if (5__3.Count > 0) { <>4__this.Log($"[Test Override] {5__3.Count} player override(s) active for this match"); } 5__4 = new HashSet(playerIds.Where((string id) => !string.IsNullOrWhiteSpace(id)), StringComparer.OrdinalIgnoreCase); <>8__1.knownNames = new HashSet(StringComparer.OrdinalIgnoreCase); if (<>4__this._userProfile != null && !string.IsNullOrWhiteSpace(<>4__this._userProfile.display_name) && !string.IsNullOrWhiteSpace(<>4__this._userProfile.id)) { <>8__1.knownNames.Add(<>4__this._userProfile.display_name); 5__4.Add(<>4__this._userProfile.id); if (!playerIds.Contains(<>4__this._userProfile.id)) { playerIds.Add(<>4__this._userProfile.id); } } <>s__5 = 5__4.ToList().GetEnumerator(); <>1__state = -3; goto IL_032e; case 1: <>1__state = -3; 5__6 = null; goto IL_032e; case 2: { <>1__state = -4; if (!string.IsNullOrWhiteSpace(<>8__9.playerIdFromName)) { <>8__1.knownNames.Add(5__8.Name); if (5__4.Add(<>8__9.playerIdFromName)) { playerIds.Add(<>8__9.playerIdFromName); <>4__this.Log("[Match Creation] Resolved leaderboard player " + 5__8.Name + " -> " + <>8__9.playerIdFromName + ""); } } else { <>4__this.Log("[Match Creation] Could not resolve leaderboard player '" + 5__8.Name + "' to a Player ID"); } <>8__9 = null; 5__10 = null; 5__8 = null; break; } IL_032e: while (<>s__5.MoveNext()) { 5__6 = <>s__5.Current; if (<>4__this._userProfile != null && string.Equals(5__6, <>4__this._userProfile.id, StringComparison.OrdinalIgnoreCase)) { continue; } <>2__current = <>4__this.CallAPI("/Player/" + 5__6, "GET", "", delegate(string res) { JObject val = <>8__1.<>4__this.ParseApiSingleObject(res); string text = (string)((val != null) ? val["display_name"] : null); if (!string.IsNullOrWhiteSpace(text)) { <>8__1.knownNames.Add(text); } }); <>1__state = 1; return true; } <>m__Finally1(); <>s__5 = default(List.Enumerator); <>s__7 = startingLeaderboard.GetEnumerator(); <>1__state = -4; break; } while (<>s__7.MoveNext()) { 5__8 = <>s__7.Current; <>8__9 = new <>c__DisplayClass210_1(); if (5__8 == null || string.IsNullOrWhiteSpace(5__8.Name) || <>8__1.knownNames.Contains(5__8.Name)) { continue; } 5__10 = <>4__this.ApplyTestPlayerOverride(5__8.Name, 5__3); <>8__9.playerIdFromName = null; <>2__current = <>4__this.ResolvePlayerIdByNameFromApi(5__10, delegate(string id) { <>8__9.playerIdFromName = id; }); <>1__state = 2; return true; } <>m__Finally2(); <>s__7 = default(List.Enumerator); return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>s__5).Dispose(); } private void <>m__Finally2() { <>1__state = -1; ((IDisposable)<>s__7).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__169 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string sourceTag; public string playerId; public string playerName; public string preMatchMmr; public string postMatchMmr; public int gamePoints; public int scoreVsPar; public int finishPosition; public string notes; public Action onResolved; public SBGLPlugin <>4__this; private <>c__DisplayClass169_0 <>8__1; private string 5__2; private <>c__DisplayClass169_1 <>8__3; private string 5__4; private int 5__5; private JObject 5__6; private float 5__7; private float 5__8; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__169(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 2) <= 1u) { try { } finally { <>m__Finally1(); } } <>8__1 = null; 5__2 = null; <>8__3 = null; 5__4 = null; 5__6 = null; <>1__state = -2; } private bool MoveNext() { //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Expected O, but got Unknown bool result; try { switch (<>1__state) { default: result = false; break; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass169_0(); <>8__1.<>4__this = <>4__this; <>8__1.sourceTag = sourceTag; if (string.IsNullOrWhiteSpace(<>4__this._currentMatchId) || string.IsNullOrWhiteSpace(playerId)) { onResolved?.Invoke(null); result = false; break; } if (<>4__this._playerMatchEntryIds.TryGetValue(playerId, out 5__2) && !string.IsNullOrWhiteSpace(5__2)) { onResolved?.Invoke(5__2); result = false; break; } if (<>4__this._matchEntryCreationInProgress.Contains(playerId)) { <>2__current = <>4__this.WaitForPendingMatchEntryCreation(playerId, onResolved); <>1__state = 1; result = true; break; } <>4__this._matchEntryCreationInProgress.Add(playerId); <>1__state = -3; <>8__3 = new <>c__DisplayClass169_1(); <>8__3.CS$<>8__locals1 = <>8__1; <>8__3.existingEntryId = null; <>2__current = <>4__this.ResolveExistingMatchEntryId(<>4__this._currentMatchId, playerId, delegate(string id) { <>8__3.existingEntryId = id; }); <>1__state = 2; result = true; break; case 1: <>1__state = -1; result = false; break; case 2: <>1__state = -3; 5__4 = (string.IsNullOrWhiteSpace(playerName) ? playerId : playerName.Trim()); if (!string.IsNullOrWhiteSpace(<>8__3.existingEntryId)) { <>4__this._playerMatchEntryIds[playerId] = <>8__3.existingEntryId; if (!string.IsNullOrWhiteSpace(5__4)) { <>4__this._playerIdsByName[5__4] = playerId; } <>4__this.Log("[" + <>8__3.CS$<>8__locals1.sourceTag + "] ✓ Adopted existing MatchEntry for " + 5__4 + ": " + <>8__3.existingEntryId + ""); onResolved?.Invoke(<>8__3.existingEntryId); result = false; } else { 5__5 = gamePoints + scoreVsPar * -10; if (gamePoints != 0) { 5__6 = new JObject { ["match_id"] = JToken.op_Implicit(<>4__this._currentMatchId), ["player_id"] = JToken.op_Implicit(playerId), ["player_name"] = JToken.op_Implicit(5__4), ["game_points"] = JToken.op_Implicit(gamePoints), ["over_under"] = JToken.op_Implicit(scoreVsPar), ["score_vs_par"] = JToken.op_Implicit(scoreVsPar), ["adjusted_match_score"] = JToken.op_Implicit(5__5), ["notes"] = JToken.op_Implicit(notes ?? string.Empty) }; 5__7 = 0f; 5__8 = 0f; if (!string.IsNullOrWhiteSpace(preMatchMmr) && float.TryParse(preMatchMmr, NumberStyles.Float, CultureInfo.InvariantCulture, out 5__7)) { 5__6["pre_match_mmr"] = JToken.op_Implicit(5__7); } if (!string.IsNullOrWhiteSpace(postMatchMmr) && float.TryParse(postMatchMmr, NumberStyles.Float, CultureInfo.InvariantCulture, out 5__8)) { 5__6["post_match_mmr"] = JToken.op_Implicit(5__8); 5__6["mmr_change"] = JToken.op_Implicit(5__8 - 5__7); } if (finishPosition > 0) { 5__6["finish_position"] = JToken.op_Implicit(finishPosition); } <>8__3.createdEntryId = null; <>2__current = <>4__this.CallAPI("/MatchEntry", "POST", ((JToken)5__6).ToString((Formatting)0, Array.Empty()), delegate(string res) { try { JObject val = <>8__3.CS$<>8__locals1.<>4__this.ParseApiSingleObject(res); if (val != null) { <>8__3.createdEntryId = (string)val["id"]; } } catch (Exception ex) { <>8__3.CS$<>8__locals1.<>4__this.Log("[" + <>8__3.CS$<>8__locals1.sourceTag + "] Could not parse MatchEntry response: " + ex.Message + ""); } }); <>1__state = 3; result = true; break; } <>4__this.Log("[" + <>8__3.CS$<>8__locals1.sourceTag + "] Skipping MatchEntry POST for " + 5__4 + " — score is 0"); onResolved?.Invoke(null); result = false; } <>m__Finally1(); break; case 3: <>1__state = -3; if (!string.IsNullOrWhiteSpace(<>8__3.createdEntryId)) { <>4__this._playerMatchEntryIds[playerId] = <>8__3.createdEntryId; if (!string.IsNullOrWhiteSpace(5__4)) { <>4__this._playerIdsByName[5__4] = playerId; } <>4__this.Log("[" + <>8__3.CS$<>8__locals1.sourceTag + "] ✓ MatchEntry created for " + 5__4 + ": " + <>8__3.createdEntryId + ""); } onResolved?.Invoke(<>8__3.createdEntryId); <>8__3 = null; 5__4 = null; 5__6 = null; <>m__Finally1(); result = false; break; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } return result; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; <>4__this._matchEntryCreationInProgress.Remove(playerId); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__178 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string logContext; public float maxWaitSeconds; public SBGLPlugin <>4__this; private bool 5__1; private float 5__2; private string 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__178(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (<>4__this._userProfile != null) { return false; } 5__1 = false; 5__2 = 0f; goto IL_01b1; case 1: <>1__state = -1; if (<>4__this._userProfile != null || <>4__this.TryUseSharedProfile(logContext)) { return false; } goto IL_015c; case 2: { <>1__state = -1; 5__2 += 0.5f; goto IL_01b1; } IL_01b1: if (<>4__this._userProfile == null) { if (<>4__this.TryUseSharedProfile(logContext)) { return false; } if (!5__1) { 5__3 = <>4__this.TryGetSteamPlayerName(); if (!string.IsNullOrWhiteSpace(5__3) && 5__3 != "Player") { 5__1 = true; <>4__this.Log("[" + logContext + "] Attempting local profile resolution for '" + 5__3 + "'"); <>2__current = <>4__this.ResolveProfile(5__3); <>1__state = 1; return true; } goto IL_015c; } goto IL_0164; } return false; IL_015c: 5__3 = null; goto IL_0164; IL_0164: if (5__2 >= maxWaitSeconds) { return false; } <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__215 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SBGLPlugin <>4__this; private string 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__215(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this._activeSeasonFetched = true; 5__1 = UnityWebRequest.EscapeURL("{\"status\":\"Active\"}"); <>2__current = <>4__this.CallAPI("/Season?q=" + 5__1 + "&limit=1", "GET", "", delegate(string res) { if (string.IsNullOrEmpty(res)) { return; } try { JToken val = JToken.Parse(res); JArray val2 = (JArray)(object)((val is JArray) ? val : null); JObject val3 = (JObject)((val2 != null) ? ((object)((IEnumerable)val2).OfType().FirstOrDefault()) : ((object)((val is JObject) ? val : null))); string text = ((val3 == null) ? null : ((object)val3["id"])?.ToString()); if (!string.IsNullOrEmpty(text)) { <>4__this._activeSeasonId = text; <>4__this.Log("[Season] Active season resolved: " + text + ""); } else { <>4__this.Log("[Season] No active season found in API — falling back to hardcoded ID"); } } catch (Exception ex) { <>4__this.Log("[Season] Error parsing season response: " + ex.Message + ""); } }); <>1__state = 1; return true; case 1: <>1__state = -1; 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(); } } [CompilerGenerated] private sealed class d__170 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SBGLPlugin <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__170(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (!<>4__this._matchStatsSubmitted && !string.IsNullOrEmpty(<>4__this._currentMatchId)) { <>2__current = <>4__this.FinalizeMatchStats(); <>1__state = 1; return true; } goto IL_007e; case 1: <>1__state = -1; goto IL_007e; case 2: <>1__state = -1; if (IsRankedTriggered && <>4__this._currentSession != null) { <>2__current = <>4__this.UpdateSessionStatus("completed"); <>1__state = 3; return true; } break; case 3: { <>1__state = -1; break; } IL_007e: <>2__current = <>4__this.UploadCapturedMatchScreenshotIfNeeded("Driving Range fallback"); <>1__state = 2; return true; } if (!string.IsNullOrWhiteSpace(<>4__this._currentMatchId)) { <>4__this._finalizedMatchIds.Add(<>4__this._currentMatchId); } <>4__this.ResetPerMatchState(); 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(); } } [CompilerGenerated] private sealed class d__144 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string source; public SBGLPlugin <>4__this; private int 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__144(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.Log("[Match Signal] " + source + " detected - attempting early end-of-match finalization..."); <>4__this.StopGameplayCoroutinesForMatchEnd(source); <>2__current = <>4__this.CaptureMatchScreenshotForReview(source); <>1__state = 1; return true; case 1: <>1__state = -1; 5__1 = 0; goto IL_00ff; case 2: <>1__state = -1; 5__1++; goto IL_00ff; case 3: <>1__state = -1; <>4__this.Log("[Match Signal] " + source + " did not yield a final snapshot yet - falling back to Driving Range finalization"); <>4__this._endOfMatchSignalCoroutine = null; return false; case 4: <>1__state = -1; if (IsRankedTriggered && <>4__this._currentSession != null) { <>2__current = <>4__this.UpdateSessionStatus("completed"); <>1__state = 5; return true; } goto IL_0229; case 5: <>1__state = -1; goto IL_0229; case 6: { <>1__state = -1; <>4__this._endOfMatchSignalCoroutine = null; return false; } IL_0229: <>2__current = <>4__this.UploadCapturedMatchScreenshotIfNeeded(source); <>1__state = 6; return true; IL_00ff: if (5__1 < 12 && !<>4__this.TryCaptureFinalLeaderboardSnapshot(source)) { <>2__current = (object)new WaitForSeconds(0.25f); <>1__state = 2; return true; } if (<>4__this._finalLeaderboardSnapshot == null || <>4__this._finalLeaderboardSnapshot.Count == 0) { <>2__current = <>4__this.UploadCapturedMatchScreenshotIfNeeded(source + " (no final snapshot yet)"); <>1__state = 3; return true; } if (!<>4__this._matchStatsSubmitted && !string.IsNullOrWhiteSpace(<>4__this._currentMatchId)) { <>2__current = <>4__this.FinalizeMatchStats(); <>1__state = 4; return true; } goto IL_0229; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__211 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SBGLPlugin <>4__this; private <>c__DisplayClass211_0 <>8__1; private int 5__2; private List 5__3; private Dictionary 5__4; private Dictionary 5__5; private List.Enumerator <>s__6; private <>c__DisplayClass211_1 <>8__7; private float 5__8; private string 5__9; private List.Enumerator <>s__10; private CachedLeaderboardPlayer 5__11; private <>c__DisplayClass211_2 <>8__12; private int 5__13; private int 5__14; private int 5__15; private string 5__16; private string 5__17; private float 5__18; private <>c__DisplayClass211_3 <>8__19; private string 5__20; private int 5__21; private IEnumerator <>s__22; private string 5__23; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__211(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { switch (<>1__state) { case -3: case 2: try { } finally { <>m__Finally1(); } break; case -4: case 3: case 4: case 5: case 6: case 7: try { } finally { <>m__Finally2(); } break; case -5: case 8: try { } finally { <>m__Finally3(); } break; } <>8__1 = null; 5__3 = null; 5__4 = null; 5__5 = null; <>s__6 = default(List.Enumerator); <>8__7 = null; 5__9 = null; <>s__10 = default(List.Enumerator); 5__11 = null; <>8__12 = null; 5__16 = null; 5__17 = null; <>8__19 = null; 5__20 = null; <>s__22 = null; 5__23 = null; <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass211_0(); <>8__1.<>4__this = <>4__this; if (IsProSeriesMatchType(PlayerPrefs.GetString("MatchType", "")) || <>4__this.IsCurrentMatchCasual()) { <>4__this._matchStatsSubmitted = true; return false; } <>4__this.Log("[Match Finalize] Performing final score update..."); if (<>4__this._finalLeaderboardSnapshot == null || <>4__this._finalLeaderboardSnapshot.Count == 0) { <>4__this.Log("[Match Finalize] No cached end-of-match leaderboard snapshot available — skipping final upload to avoid driving range zeros"); <>4__this._matchStatsSubmitted = true; return false; } 5__2 = <>4__this._finalLeaderboardSnapshot.Count((CachedLeaderboardPlayer p) => p != null && !string.IsNullOrWhiteSpace(p.Name) && p.BaseScore != 0); if (5__2 > 0) { <>4__this._matchExpectedPlayerCount = 5__2; <>2__current = <>4__this.UpdateMatchPlayerCountIfNeeded(5__2, "cached final leaderboard"); <>1__state = 1; return true; } goto IL_01b2; case 1: <>1__state = -1; goto IL_01b2; case 2: <>1__state = -3; goto IL_04e3; case 3: <>1__state = -4; goto IL_0a94; case 4: <>1__state = -4; 5__20 = null; goto IL_08a6; case 5: <>1__state = -4; goto IL_0972; case 6: <>1__state = -4; if (!string.IsNullOrEmpty(<>8__19.CS$<>8__locals3.entryId)) { <>2__current = <>4__this.UpdateMatchEntry(<>8__19.CS$<>8__locals3.entryId, <>8__19.CS$<>8__locals3.playerId, 5__11.Name, 5__13, 5__14, 5__15, 5__17, <>8__19.preMatchMmr); <>1__state = 7; return true; } goto IL_0a8c; case 7: <>1__state = -4; goto IL_0a8c; case 8: <>1__state = -5; 5__23 = null; goto IL_0bcc; case 9: { <>1__state = -1; break; } IL_04e3: 5__9 = null; <>8__7 = null; goto IL_04f2; IL_0a8c: <>8__19 = null; goto IL_0a94; IL_0a94: <>8__12 = null; 5__16 = null; 5__17 = null; 5__11 = null; goto IL_0ab1; IL_05e3: 5__15 = 0; if (!string.IsNullOrWhiteSpace(5__11.Name)) { 5__5.TryGetValue(5__11.Name, out 5__15); } <>4__this.TryGetPlayerIdForName(5__11.Name, out <>8__12.playerId); <>4__this._playerMatchEntryIds.TryGetValue(<>8__12.playerId ?? "", out <>8__12.entryId); 5__16 = null; 5__17 = null; if (<>8__12.CS$<>8__locals2.finalPreMmrByName.TryGetValue(5__11.Name, out 5__18)) { 5__16 = 5__18.ToString(CultureInfo.InvariantCulture); 5__17 = (5__18 + (float)5__11.ProjectedDelta).ToString(CultureInfo.InvariantCulture); } if (!string.IsNullOrEmpty(<>8__12.entryId)) { <>4__this.Log(string.Format("[Match Finalize] Final update for {0}: {1} pts, {2} vs par, pos {3}, postMMR {4}", 5__11.Name, 5__13, 5__14, 5__15, 5__17 ?? "n/a")); <>2__current = <>4__this.UpdateMatchEntry(<>8__12.entryId, <>8__12.playerId, 5__11.Name, 5__13, 5__14, 5__15, 5__17, 5__16); <>1__state = 3; return true; } <>8__19 = new <>c__DisplayClass211_3(); <>8__19.CS$<>8__locals3 = <>8__12; <>4__this.Log("[Match Finalize] " + 5__11.Name + " has no entry — creating late entry..."); if (string.IsNullOrEmpty(<>8__19.CS$<>8__locals3.playerId)) { 5__20 = <>4__this.ApplyTestPlayerOverride(5__11.Name, 5__4); <>2__current = <>4__this.ResolvePlayerIdByNameFromApi(5__20, delegate(string id) { <>8__19.CS$<>8__locals3.playerId = id; }); <>1__state = 4; return true; } goto IL_08a6; IL_08a6: if (string.IsNullOrEmpty(<>8__19.CS$<>8__locals3.playerId)) { <>4__this.Log("[Match Finalize] Cannot resolve player ID for " + 5__11.Name + " — skipping late entry"); goto IL_0ab1; } <>8__19.preMatchMmr = 5__16; if (string.IsNullOrWhiteSpace(<>8__19.preMatchMmr)) { <>2__current = <>4__this.CallAPI("/Player/" + <>8__19.CS$<>8__locals3.playerId, "GET", "", delegate(string res) { JObject val2 = <>8__19.CS$<>8__locals3.CS$<>8__locals2.<>4__this.ParseApiSingleObject(res); object obj2 = ((val2 != null) ? val2["current_mmr"] : null); if (obj2 != null) { <>8__19.preMatchMmr = obj2.ToString(); } }); <>1__state = 5; return true; } goto IL_0972; IL_0ab1: while (<>s__10.MoveNext()) { 5__11 = <>s__10.Current; <>8__12 = new <>c__DisplayClass211_2(); <>8__12.CS$<>8__locals2 = <>8__1; if (5__11 == null) { continue; } 5__13 = 5__11.BaseScore; 5__14 = <>4__this.ParseScoreVsPar(5__11.RawStrokes); if (5__13 == 0) { <>4__this.Log("[Match Finalize] Skipping " + 5__11.Name + " — game points is 0 (spectator/no score)"); continue; } goto IL_05e3; } <>m__Finally2(); <>s__10 = default(List.Enumerator); if (<>4__this._currentSession?.player_ids == null || <>4__this._currentSession.player_ids.Count <= 0) { break; } <>s__22 = <>4__this._currentSession.player_ids.Where((string id) => !string.IsNullOrWhiteSpace(id)).Distinct(StringComparer.Ordinal).GetEnumerator(); <>1__state = -5; goto IL_0bcc; IL_0459: <>4__this.TryGetPlayerIdForName(<>8__7.p.Name, out 5__9); if (!string.IsNullOrWhiteSpace(5__9)) { <>2__current = <>4__this.CallAPI("/Player/" + 5__9, "GET", "", delegate(string res) { JObject val = <>8__7.CS$<>8__locals1.<>4__this.ParseApiSingleObject(res); object obj = ((val != null) ? val["current_mmr"] : null); if (obj != null && float.TryParse(obj.ToString(), NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { <>8__7.CS$<>8__locals1.finalPreMmrByName[<>8__7.p.Name] = result; <>8__7.CS$<>8__locals1.<>4__this.Log($"[Match Finalize] MMR for {<>8__7.p.Name} resolved from API: {result}"); } }); <>1__state = 2; return true; } goto IL_04e3; IL_04f2: while (<>s__6.MoveNext()) { <>8__7 = new <>c__DisplayClass211_1(); <>8__7.CS$<>8__locals1 = <>8__1; <>8__7.p = <>s__6.Current; if (<>8__7.p == null || string.IsNullOrWhiteSpace(<>8__7.p.Name) || <>8__7.p.BaseScore == 0) { continue; } if (!string.IsNullOrWhiteSpace(<>8__7.p.MMR) && float.TryParse(<>8__7.p.MMR, NumberStyles.Float, CultureInfo.InvariantCulture, out 5__8)) { <>8__7.CS$<>8__locals1.finalPreMmrByName[<>8__7.p.Name] = 5__8; continue; } if (<>4__this._userProfile != null && string.Equals(<>8__7.p.Name, <>4__this._userProfile.display_name, StringComparison.OrdinalIgnoreCase)) { <>8__7.CS$<>8__locals1.finalPreMmrByName[<>8__7.p.Name] = <>4__this._userProfile.current_mmr; <>4__this.Log($"[Match Finalize] MMR for local player {<>8__7.p.Name} resolved from profile: {<>4__this._userProfile.current_mmr}"); continue; } goto IL_0459; } <>m__Finally1(); <>s__6 = default(List.Enumerator); <>s__10 = <>4__this._finalLeaderboardSnapshot.GetEnumerator(); <>1__state = -4; goto IL_0ab1; IL_0bcc: while (<>s__22.MoveNext()) { 5__23 = <>s__22.Current; if (<>4__this._playerMatchEntryIds.ContainsKey(5__23)) { continue; } <>2__current = <>4__this.CreatePlaceholderMatchEntryForMissingSessionPlayer(5__23); <>1__state = 8; return true; } <>m__Finally3(); <>s__22 = null; 5__21 = <>4__this._currentSession.player_ids.Count((string id) => !string.IsNullOrWhiteSpace(id)); if (5__21 > <>4__this._matchExpectedPlayerCount) { <>4__this._matchExpectedPlayerCount = 5__21; <>2__current = <>4__this.UpdateMatchPlayerCountIfNeeded(5__21, "session player_ids fallback"); <>1__state = 9; return true; } break; IL_01b2: <>4__this.Log($"[Match Finalize] Using cached final snapshot with {<>4__this._finalLeaderboardSnapshot.Count} players"); 5__3 = (from p in <>4__this._finalLeaderboardSnapshot?.Where((CachedLeaderboardPlayer p) => p != null && !string.IsNullOrWhiteSpace(p.Name)) select p.Name).ToList() ?? new List(); 5__4 = <>4__this.GetTestPlayerOverrides(5__3); 5__5 = <>4__this.BuildFinishPositionMap(<>4__this._finalLeaderboardSnapshot); <>8__1.finalPreMmrByName = new Dictionary(StringComparer.OrdinalIgnoreCase); <>s__6 = <>4__this._finalLeaderboardSnapshot.GetEnumerator(); <>1__state = -3; goto IL_04f2; IL_0972: <>2__current = <>4__this.EnsureMatchEntryForPlayer("Match Finalize", <>8__19.CS$<>8__locals3.playerId, 5__11.Name, <>8__19.preMatchMmr, 5__17, 5__13, 5__14, 5__15, "Late entry - joined after match start", delegate(string id) { <>8__19.CS$<>8__locals3.entryId = id; }); <>1__state = 6; return true; } <>4__this._matchStatsSubmitted = true; <>4__this.Log("[Match Finalize] ✓ Match stats finalized"); return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>s__6).Dispose(); } private void <>m__Finally2() { <>1__state = -1; ((IDisposable)<>s__10).Dispose(); } private void <>m__Finally3() { <>1__state = -1; if (<>s__22 != null) { <>s__22.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__155 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SBGLPlugin <>4__this; private float 5__1; private int 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__155(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 1) <= 3u) { try { } finally { <>m__Finally1(); } } <>1__state = -2; } private bool MoveNext() { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>1__state = -3; <>4__this.Log("[Match Signal] CourseManager client RPC InformEndingCourse received — preparing final upload"); 5__2 = 0; goto IL_00bf; case 1: <>1__state = -3; 5__2++; goto IL_00bf; case 2: <>1__state = -3; 5__1 = 0f; goto IL_0141; case 3: <>1__state = -3; 5__1 += 0.25f; goto IL_0141; case 4: { <>1__state = -3; <>m__Finally1(); return false; } IL_0141: if (string.IsNullOrWhiteSpace(<>4__this._currentMatchId) && 5__1 < 6f) { <>2__current = (object)new WaitForSeconds(0.25f); <>1__state = 3; return true; } <>2__current = <>4__this.UploadCapturedMatchScreenshotIfNeeded("CourseManager.RpcInformEndingCourse"); <>1__state = 4; return true; IL_00ce: <>2__current = <>4__this.CaptureMatchScreenshotForReview("CourseManager.RpcInformEndingCourse (forced)"); <>1__state = 2; return true; IL_00bf: if (5__2 < 8) { try { if (<>4__this.TryCaptureFinalLeaderboardSnapshot("CourseManager.RpcInformEndingCourse")) { goto IL_00ce; } } catch { } <>2__current = (object)new WaitForSeconds(0.125f); <>1__state = 1; return true; } goto IL_00ce; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; <>4__this._courseEndRpcCoroutine = null; } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__132 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public List leaderboardPlayers; public SBGLPlugin <>4__this; private List 5__1; private Dictionary 5__2; private int 5__3; private List.Enumerator <>s__4; private string 5__5; private <>c__DisplayClass132_0 <>8__6; private string 5__7; private int 5__8; private string 5__9; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__132(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 1) <= 2u) { try { } finally { <>m__Finally1(); } } 5__1 = null; 5__2 = null; <>s__4 = default(List.Enumerator); 5__5 = null; <>8__6 = null; 5__7 = null; 5__9 = null; <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = (from player in leaderboardPlayers?.Where((LiveLeaderboardPlugin.SBGLPlayer player) => player != null && !string.IsNullOrWhiteSpace(player.Name)) select player.Name.Trim()).Distinct(StringComparer.OrdinalIgnoreCase).ToList() ?? new List(); if (5__1.Count == 0) { <>4__this.Log("[Casual] No active leaderboard names found - skipping casual stat increment"); return false; } 5__2 = <>4__this.GetTestPlayerOverrides(5__1); 5__3 = 0; <>s__4 = 5__1.GetEnumerator(); <>1__state = -3; goto IL_0527; case 1: <>1__state = -3; goto IL_02a9; case 2: <>1__state = -3; 5__8 = <>8__6.casualMatchesPlayed + 1; 5__9 = "{" + $"\"casual_matches_played\":{5__8}" + "}"; <>8__6.updated = false; <>2__current = <>4__this.CallAPI("/Player/" + <>8__6.playerId, "PUT", 5__9, delegate(string res) { if (<>8__6.<>4__this.ParseApiSingleObject(res) != null) { <>8__6.updated = true; } }); <>1__state = 3; return true; case 3: { <>1__state = -3; if (!<>8__6.updated) { <>4__this.Log("[Casual] Failed to update casual_matches_played for " + 5__5 + ""); } else { 5__3++; <>4__this._playerIdsByName[5__5] = <>8__6.playerId; if (!string.IsNullOrWhiteSpace(<>8__6.resolvedDisplayName)) { <>4__this._playerIdsByName[<>8__6.resolvedDisplayName.Trim()] = <>8__6.playerId; } <>4__this.Log($"[Casual] ✓ Updated {<>8__6.resolvedDisplayName} ({<>8__6.playerId}) casual_matches_played: {<>8__6.casualMatchesPlayed} -> {5__8}"); <>8__6 = null; 5__7 = null; 5__9 = null; 5__5 = null; } goto IL_0527; } IL_0527: if (<>s__4.MoveNext()) { 5__5 = <>s__4.Current; <>8__6 = new <>c__DisplayClass132_0(); <>8__6.<>4__this = <>4__this; 5__7 = <>4__this.ApplyTestPlayerOverride(5__5, 5__2); <>8__6.playerId = null; if (!string.IsNullOrWhiteSpace(<>4__this._userProfile?.id) && string.Equals(5__5, <>4__this._userProfile.display_name, StringComparison.OrdinalIgnoreCase)) { <>8__6.playerId = <>4__this._userProfile.id; } if (string.IsNullOrWhiteSpace(<>8__6.playerId)) { <>4__this.TryGetPlayerIdForName(5__5, out <>8__6.playerId); } if (string.IsNullOrWhiteSpace(<>8__6.playerId) && !string.Equals(5__7, 5__5, StringComparison.OrdinalIgnoreCase)) { <>4__this.TryGetPlayerIdForName(5__7, out <>8__6.playerId); } if (string.IsNullOrWhiteSpace(<>8__6.playerId)) { <>2__current = <>4__this.ResolvePlayerIdByNameFromApi(5__7, delegate(string id) { <>8__6.playerId = id; }); <>1__state = 1; return true; } goto IL_02a9; } <>m__Finally1(); <>s__4 = default(List.Enumerator); <>4__this._matchEntriesCreated = true; <>4__this._matchStatsSubmitted = true; if (5__3 > 0) { <>4__this.ShowUploadNotification($"Casual stats updated for {5__3} player(s).", "success"); } else { <>4__this.ShowUploadNotification("Casual match detected, but no player stats were updated.", "warning"); } <>4__this.Log($"[Casual] Casual match handling complete - updated {5__3}/{5__1.Count} players"); return false; IL_02a9: if (string.IsNullOrWhiteSpace(<>8__6.playerId)) { <>4__this.Log("[Casual] Could not resolve player ID for '" + 5__5 + "' - skipping casual stat update"); goto IL_0527; } <>8__6.casualMatchesPlayed = 0; <>8__6.resolvedDisplayName = 5__5; <>2__current = <>4__this.CallAPI("/Player/" + <>8__6.playerId, "GET", "", delegate(string res) { JObject val = <>8__6.<>4__this.ParseApiSingleObject(res); if (val != null) { <>8__6.resolvedDisplayName = ((string)val["display_name"]) ?? <>8__6.resolvedDisplayName; int.TryParse(((object)val["casual_matches_played"])?.ToString() ?? "0", out <>8__6.casualMatchesPlayed); } }); <>1__state = 2; return true; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>s__4).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__183 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SBGLPlugin <>4__this; private <>c__DisplayClass183_0 <>8__1; private string 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__183(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; 5__2 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass183_0(); <>8__1.<>4__this = <>4__this; if (string.IsNullOrEmpty(<>4__this._currentQueueId)) { <>4__this.ResetPluginState(); return false; } <>4__this._webStatus = "LEAVING..."; 5__2 = "{\"player_id\":\"" + <>4__this._userProfile.id + "\",\"status\":\"cancelled\"}"; <>8__1.leaveSuccess = false; <>2__current = <>4__this.CallAPI("/MatchmakingQueue/" + <>4__this._currentQueueId, "PUT", 5__2, delegate(string res) { if (<>8__1.<>4__this.ParseApiSingleObject(res) != null) { <>8__1.<>4__this.ResetPluginState(); <>8__1.<>4__this.Log("✓ Left Queue."); <>8__1.leaveSuccess = true; } }); <>1__state = 1; return true; case 1: <>1__state = -1; if (!<>8__1.leaveSuccess) { <>4__this.Log("Leave queue request failed. Check logs above for details."); <>4__this.ResetPluginState(); } 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(); } } [CompilerGenerated] private sealed class d__182 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SBGLPlugin <>4__this; private <>c__DisplayClass182_0 <>8__1; private string 5__2; private string 5__3; private UnityWebRequest 5__4; private List 5__5; private string 5__6; private string 5__7; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__182(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } <>8__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; 5__5 = null; 5__6 = null; 5__7 = null; <>1__state = -2; } private bool MoveNext() { //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Invalid comparison between Unknown and I4 //IL_0261: Unknown result type (might be due to invalid IL or missing references) try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass182_0(); <>8__1.<>4__this = <>4__this; if (<>4__this._userProfile == null) { <>4__this.Log("No profile loaded."); return false; } <>4__this._isQueueing = true; <>4__this._webStatus = "JOINING..."; <>4__this._queueStartTime = DateTime.Now; <>8__1.existingId = null; 5__2 = "{\"player_id\":\"" + <>4__this._userProfile.id + "\",\"status\":\"queued\"}"; 5__3 = <>4__this.GetBaseApiUrl() + "/MatchmakingQueue?q=" + UnityWebRequest.EscapeURL(5__2); <>4__this.Log("[Queue] Checking for existing entry for player " + <>4__this._userProfile.id + "..."); 5__4 = UnityWebRequest.Get(5__3); <>1__state = -3; <>4__this.ApplyApiHeaders(5__4); <>2__current = 5__4.SendWebRequest(); <>1__state = 1; return true; case 1: <>1__state = -3; if ((int)5__4.result == 1) { 5__5 = <>4__this.ParseApiObjectList(5__4.downloadHandler.text); if (5__5 != null && 5__5.Count > 0) { <>8__1.existingId = (string)5__5[0]["id"]; <>4__this.Log("[Queue] Found existing entry " + <>8__1.existingId + " — patching has_mod:true"); } else { <>4__this.Log("[Queue] No existing entry found — will create new."); } 5__5 = null; } else { <>4__this.Log($"[Queue] Could not check existing entries: {5__4.result} — will attempt POST anyway."); } <>m__Finally1(); 5__4 = null; if (<>8__1.existingId != null) { 5__6 = "{\"has_mod\":true,\"created_by\":\"SBGL_UnifiedMod\",\"match_type\":\"" + <>4__this.GetQueueMatchTypePayload() + "\"," + $"\"queued_at\":\"{DateTime.UtcNow:yyyy-MM-ddTHH:mm:ss.fffZ}\"" + "}"; <>2__current = <>4__this.CallAPI("/MatchmakingQueue/" + <>8__1.existingId, "PUT", 5__6, delegate(string res) { JObject val2 = <>8__1.<>4__this.ParseApiSingleObject(res); if (val2 != null) { <>8__1.<>4__this._currentQueueId = <>8__1.existingId; <>8__1.<>4__this._webStatus = "QUEUED"; <>8__1.<>4__this.Log("[Queue] ✓ Updated existing entry " + <>8__1.existingId + " with has_mod:true."); } else { <>8__1.<>4__this.Log("[Queue] Failed to update existing entry " + <>8__1.existingId + "."); } }); <>1__state = 2; return true; } 5__7 = "{\"player_id\":\"" + <>4__this._userProfile.id + "\",\"user_id\":\"" + <>4__this._userProfile.id + "\",\"display_name\":\"" + <>4__this._userProfile.display_name + "\"," + $"\"mmr_snapshot\":{<>4__this._userProfile.current_mmr}," + "\"region\":\"" + <>4__this._userProfile.region + "\",\"state_province\":\"" + <>4__this._userProfile.state_province + "\",\"match_type\":\"" + <>4__this.GetQueueMatchTypePayload() + "\",\"has_mod\":true,\"created_by\":\"SBGL_UnifiedMod\",\"status\":\"queued\"," + $"\"queued_at\":\"{DateTime.UtcNow:yyyy-MM-ddTHH:mm:ss.fffZ}\"" + "}"; <>2__current = <>4__this.CallAPI("/MatchmakingQueue", "POST", 5__7, delegate(string res) { JObject val = <>8__1.<>4__this.ParseApiSingleObject(res); <>8__1.<>4__this._currentQueueId = ((string)((val != null) ? val["id"] : null)) ?? <>8__1.<>4__this._currentQueueId; <>8__1.<>4__this._webStatus = "QUEUED"; <>8__1.<>4__this.Log("[Queue] ✓ Created new entry " + <>8__1.<>4__this._currentQueueId + " with has_mod:true."); }); <>1__state = 3; return true; case 2: <>1__state = -1; 5__6 = null; break; case 3: <>1__state = -1; 5__7 = null; break; } return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__4 != null) { ((IDisposable)5__4).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__197 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SBGLPlugin <>4__this; private LiveLeaderboardPlugin 5__1; private List 5__2; private Dictionary 5__3; private int 5__4; private List 5__5; private Dictionary 5__6; private <>c__DisplayClass197_0 <>8__7; private List.Enumerator <>s__8; private LiveLeaderboardPlugin.SBGLPlayer 5__9; private int 5__10; private int 5__11; private bool 5__12; private int 5__13; private string 5__14; private int 5__15; private <>c__DisplayClass197_1 <>8__16; private string 5__17; private <>c__DisplayClass197_2 <>8__18; private int 5__19; private int 5__20; private string 5__21; private string 5__22; private float 5__23; private int 5__24; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__197(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 5) <= 3u) { try { } finally { <>m__Finally1(); } } 5__1 = null; 5__2 = null; 5__3 = null; 5__5 = null; 5__6 = null; <>8__7 = null; <>s__8 = default(List.Enumerator); 5__9 = null; 5__14 = null; <>8__16 = null; 5__17 = null; <>8__18 = null; 5__21 = null; 5__22 = null; <>1__state = -2; } private bool MoveNext() { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.Log("[Match Monitor] Starting score monitoring for gameplay"); break; case 1: <>1__state = -1; if (!<>4__this._matchEntriesCreated && string.IsNullOrWhiteSpace(<>4__this._currentMatchId) && !<>4__this._matchCreationInProgress && Time.realtimeSinceStartup >= <>4__this._nextEnsureMatchCreateAttemptAt) { <>8__7 = new <>c__DisplayClass197_0(); <>4__this._nextEnsureMatchCreateAttemptAt = Time.realtimeSinceStartup + 6f; <>8__7.shouldUpload = false; <>2__current = <>4__this.ValidateMatchUpload(delegate(bool ok) { <>8__7.shouldUpload = ok; }); <>1__state = 2; return true; } goto IL_01a5; case 2: <>1__state = -1; if (<>8__7.shouldUpload) { <>4__this.Log("[Match Monitor] Missing match records mid-round - attempting creation/adoption..."); <>2__current = <>4__this.CreateMatchAndEntries(); <>1__state = 3; return true; } goto IL_019d; case 3: <>1__state = -1; goto IL_019d; case 4: <>1__state = -1; goto IL_02c7; case 5: <>1__state = -3; if (!string.IsNullOrEmpty(<>8__16.playerId)) { <>4__this._playerIdsByName[5__9.Name.Trim()] = <>8__16.playerId; } 5__17 = null; goto IL_05c4; case 6: <>1__state = -3; 5__19 = 0; if (!string.IsNullOrWhiteSpace(5__9.Name)) { 5__3.TryGetValue(5__9.Name, out 5__19); } <>2__current = <>4__this.EnsureMatchEntryForPlayer("Match Monitor", <>8__18.CS$<>8__locals1.playerId, 5__9.Name, <>8__18.preMatchMmr, null, 5__10, 5__11, 5__19, "Live leaderboard backfill during round", delegate(string id) { <>8__18.CS$<>8__locals1.entryId = id; }); <>1__state = 7; return true; case 7: <>1__state = -3; <>8__18 = null; goto IL_077e; case 8: { <>1__state = -3; <>4__this._lastSubmittedScores[5__9.Name] = 5__10; <>4__this._lastSubmittedScoresVsPar[5__9.Name] = 5__11; 5__21 = null; 5__22 = null; goto IL_0974; } IL_077e: if (!string.IsNullOrEmpty(<>8__16.entryId) && !string.IsNullOrEmpty(<>8__16.playerId)) { <>4__this._matchEntriesCreated = true; 5__20 = 0; if (!string.IsNullOrWhiteSpace(5__9.Name)) { 5__3.TryGetValue(5__9.Name, out 5__20); } 5__21 = ((!string.IsNullOrWhiteSpace(5__9.MMR) && 5__9.MMR != "..." && 5__9.MMR != "--") ? 5__9.MMR : null); 5__22 = null; if (5__21 != null && float.TryParse(5__21, NumberStyles.Float, CultureInfo.InvariantCulture, out 5__23)) { 5__24 = <>4__this.ParseProjectedMmrDelta(5__9.ProjectedDisplay); 5__22 = (5__23 + (float)5__24).ToString(CultureInfo.InvariantCulture); } <>2__current = <>4__this.UpdateMatchEntry(<>8__16.entryId, <>8__16.playerId, 5__9.Name, 5__10, 5__11, 0, 5__22, 5__21); <>1__state = 8; return true; } goto IL_0974; IL_0974: <>8__16 = null; goto IL_097c; IL_0411: 5__12 = false; if (<>4__this._lastSubmittedScores.TryGetValue(5__9.Name, out 5__13)) { if (5__13 != 5__10 || !<>4__this._lastSubmittedScoresVsPar.TryGetValue(5__9.Name, out 5__15) || 5__15 != 5__11) { 5__12 = true; } } else { 5__12 = true; } if (5__12) { <>8__16 = new <>c__DisplayClass197_1(); <>8__16.<>4__this = <>4__this; <>8__16.playerId = null; <>8__16.entryId = null; if (!<>4__this.TryGetPlayerIdForName(5__9.Name, out <>8__16.playerId)) { 5__17 = <>4__this.ApplyTestPlayerOverride(5__9.Name, 5__6); <>2__current = <>4__this.ResolvePlayerIdByNameFromApi(5__17, delegate(string id) { <>8__16.playerId = id; }); <>1__state = 5; return true; } goto IL_05c4; } goto IL_097c; IL_097c: 5__9 = null; goto IL_0984; IL_019d: <>8__7 = null; goto IL_01a5; IL_05c4: if (!string.IsNullOrEmpty(<>8__16.playerId)) { <>4__this._playerMatchEntryIds.TryGetValue(<>8__16.playerId, out <>8__16.entryId); } if (!string.IsNullOrEmpty(<>8__16.playerId) && string.IsNullOrEmpty(<>8__16.entryId)) { <>8__18 = new <>c__DisplayClass197_2(); <>8__18.CS$<>8__locals1 = <>8__16; <>8__18.preMatchMmr = null; <>2__current = <>4__this.CallAPI("/Player/" + <>8__18.CS$<>8__locals1.playerId, "GET", "", delegate(string res) { JObject val = <>8__18.CS$<>8__locals1.<>4__this.ParseApiSingleObject(res); object obj = ((val != null) ? val["current_mmr"] : null); if (obj != null) { <>8__18.preMatchMmr = obj.ToString(); } }); <>1__state = 6; return true; } goto IL_077e; IL_02c7: 5__5 = (from p in 5__2?.Where((LiveLeaderboardPlugin.SBGLPlayer p) => p != null && !string.IsNullOrWhiteSpace(p.Name)) select p.Name).ToList() ?? new List(); 5__6 = <>4__this.GetTestPlayerOverrides(5__5); <>s__8 = 5__2.GetEnumerator(); <>1__state = -3; goto IL_0984; IL_0984: while (<>s__8.MoveNext()) { 5__9 = <>s__8.Current; if (5__9 == null) { continue; } 5__10 = 5__9.BaseScore; 5__11 = 0; if (!string.IsNullOrEmpty(5__9.RawStrokes)) { 5__14 = 5__9.RawStrokes.Replace("±", "").Trim(); int.TryParse(5__14, out 5__11); 5__14 = null; } if (5__10 == 0) { continue; } goto IL_0411; } <>m__Finally1(); <>s__8 = default(List.Enumerator); 5__1 = null; 5__2 = null; 5__3 = null; 5__5 = null; 5__6 = null; break; IL_01a5: if (<>4__this._currentMatchId == null) { break; } 5__1 = Object.FindAnyObjectByType((FindObjectsInactive)1); if ((Object)(object)5__1 == (Object)null) { break; } 5__2 = 5__1.GetCurrentLeaderboard(); if (5__2 == null || 5__2.Count == 0) { break; } <>4__this.CacheLeaderboardSnapshot(5__2, "live gameplay"); 5__3 = <>4__this.BuildFinishPositionMap(5__2); 5__4 = 5__2.Count((LiveLeaderboardPlugin.SBGLPlayer p) => p != null && !string.IsNullOrWhiteSpace(p.Name) && p.BaseScore != 0); if (5__4 > 0) { <>4__this._matchExpectedPlayerCount = 5__4; <>2__current = <>4__this.UpdateMatchPlayerCountIfNeeded(5__4, "live leaderboard"); <>1__state = 4; return true; } goto IL_02c7; } if (<>4__this._isInGameplay) { <>2__current = (object)new WaitForSeconds(2f); <>1__state = 1; return true; } <>4__this.Log("[Match Monitor] Score monitoring ended"); <>4__this._monitorCoroutine = null; return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>s__8).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__196 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SBGLPlugin <>4__this; private WaitForSeconds 5__1; private string 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__196(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; if (<>4__this._isInGameplay && !<>4__this._matchEntriesCreated) { 5__2 = CompetitivePluginCheck._currentLobbyName; if (string.IsNullOrEmpty(5__2) || !5__2.StartsWith("SBGL-", StringComparison.OrdinalIgnoreCase)) { 5__2 = null; goto IL_010b; } <>4__this.Log("[LobbyMonitor] Lobby renamed to '" + 5__2 + "' mid-round - triggering upload..."); ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.ValidateMatchUpload(delegate(bool shouldUpload) { if (shouldUpload) { <>4__this.Log("[LobbyMonitor] Eligibility confirmed - creating match records..."); ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.CreateMatchAndEntries()); } else { <>4__this.Log("[LobbyMonitor] Lobby is SBGL-* but failed eligibility check - skipping upload"); <>4__this._matchEntriesCreated = true; } })); } goto IL_0130; } <>1__state = -1; <>4__this.Log("[LobbyMonitor] Starting mid-round lobby rename monitor"); 5__1 = new WaitForSeconds(3f); goto IL_010b; IL_010b: if (<>4__this._isInGameplay && !<>4__this._matchEntriesCreated) { <>2__current = 5__1; <>1__state = 1; return true; } goto IL_0130; IL_0130: <>4__this.Log("[LobbyMonitor] Lobby rename monitor stopped"); 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(); } } [CompilerGenerated] private sealed class d__185 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SBGLPlugin <>4__this; private string 5__1; private UnityWebRequest 5__2; private string 5__3; private JObject 5__4; private string 5__5; private List 5__6; private string 5__7; private string 5__8; private string 5__9; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__185(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 1) <= 1u) { try { } finally { <>m__Finally1(); } } 5__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; 5__5 = null; 5__6 = null; 5__7 = null; 5__8 = null; 5__9 = null; <>1__state = -2; } private bool MoveNext() { //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Invalid comparison between Unknown and I4 //IL_0563: Unknown result type (might be due to invalid IL or missing references) bool result; try { switch (<>1__state) { default: result = false; goto end_IL_0000; case 0: <>1__state = -1; 5__1 = <>4__this.GetBaseApiUrl() + "/MatchmakingSession/" + <>4__this._currentSession.id; <>4__this.Log("[Sync] GET /MatchmakingSession/" + <>4__this._currentSession.id + " (polling status)"); <>4__this.Log("[Sync] Full URL: " + 5__1 + ""); 5__2 = UnityWebRequest.Get(5__1); <>1__state = -3; <>4__this.ApplyApiHeaders(5__2); <>2__current = 5__2.SendWebRequest(); <>1__state = 1; result = true; goto end_IL_0000; case 1: <>1__state = -3; if ((int)5__2.result != 1) { <>4__this.Log($"[Sync] PollSessionStatus failed: {5__2.result} - {5__2.error}"); break; } 5__3 = 5__2.downloadHandler.text; 5__4 = <>4__this.ParseApiSingleObject(5__3); if (5__4 == null) { result = false; <>m__Finally1(); } else { 5__5 = (string)5__4["status"]; <>4__this._currentSession.status = 5__5 ?? <>4__this._currentSession.status; <>4__this.Log("[Sync] Status from API: " + 5__5 + ""); JToken obj = 5__4["accepted_player_ids"]; 5__6 = ((obj != null) ? obj.ToObject>() : null); if (5__6 == null) { goto IL_035e; } <>4__this._currentSession.accepted_player_ids = 5__6; <>4__this.Log($"[Sync] Updated accepted_player_ids: {5__6.Count} players have accepted"); if (!(<>4__this._currentSession.status == "pending_accept") || <>4__this._currentSession.accepted_player_ids.Count != <>4__this._currentSession.player_ids.Count) { goto IL_035e; } <>4__this.Log($"[Sync] All {<>4__this._currentSession.player_ids.Count} players have accepted! Transitioning to ready..."); <>4__this._currentSession.status = "ready"; <>4__this._webStatus = (<>4__this._isHost ? "READY: HOST" : "READY: JOIN"); 5__9 = "{\"status\":\"ready\"}"; <>2__current = <>4__this.CallAPI("/MatchmakingSession/" + <>4__this._currentSession.id, "PUT", 5__9, delegate { <>4__this.Log("[Sync] ✓ Session transitioned to READY"); }); <>1__state = 2; result = true; } goto end_IL_0000; case 2: { <>1__state = -3; 5__9 = null; goto IL_035e; } IL_035e: 5__7 = (string)5__4["steam_lobby_link"]; if (!string.IsNullOrEmpty(5__7) && 5__7 != <>4__this._currentSession.steam_lobby_link) { <>4__this._currentSession.steam_lobby_link = 5__7; <>4__this.Log("Sync: steam_lobby_link received/updated from API."); } 5__8 = (string)5__4["match_id"]; if (!string.IsNullOrEmpty(5__8) && 5__8 != <>4__this._currentSession.match_id) { <>4__this._currentSession.match_id = 5__8; <>4__this.Log("Sync: match_id received/updated from API: " + 5__8); } if (<>4__this._currentSession.status == "ready") { <>4__this._webStatus = (<>4__this._isHost ? "READY: HOST" : "READY: JOIN"); <>4__this.Log("[Sync] Session is READY - Host should start game"); } else if (<>4__this._currentSession.status == "cancelled" || <>4__this._currentSession.status == "completed") { <>4__this.Log("Match ended with status: " + <>4__this._currentSession.status + "."); <>4__this.ResetPluginState(); } 5__3 = null; 5__4 = null; 5__5 = null; 5__6 = null; 5__7 = null; 5__8 = null; break; } <>m__Finally1(); 5__2 = null; result = false; end_IL_0000:; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } return result; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__2 != null) { ((IDisposable)5__2).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__180 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SBGLPlugin <>4__this; private string 5__1; private string 5__2; private UnityWebRequest 5__3; private string 5__4; private List 5__5; private List 5__6; private JObject 5__7; private string 5__8; private int 5__9; private int 5__10; private List.Enumerator <>s__11; private JObject 5__12; private string 5__13; private string 5__14; private string 5__15; private DateTime 5__16; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__180(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 1) <= 1u) { try { } finally { <>m__Finally1(); } } 5__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; 5__5 = null; 5__6 = null; 5__7 = null; 5__8 = null; <>s__11 = default(List.Enumerator); 5__12 = null; 5__13 = null; 5__14 = null; 5__15 = null; <>1__state = -2; } private bool MoveNext() { //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Invalid comparison between Unknown and I4 //IL_0549: Unknown result type (might be due to invalid IL or missing references) try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = "{\"$or\":[{\"status\":\"queued\"},{\"status\":\"matched\"}]}"; 5__2 = <>4__this.GetBaseApiUrl() + "/MatchmakingQueue?q=" + UnityWebRequest.EscapeURL(5__1); <>4__this.Log("[Sync] GET /MatchmakingQueue (fetching queued players)"); <>4__this.Log("[Sync] Full URL: " + 5__2.Substring(0, Math.Min(150, 5__2.Length)) + "..."); 5__3 = UnityWebRequest.Get(5__2); <>1__state = -3; <>4__this.ApplyApiHeaders(5__3); <>2__current = 5__3.SendWebRequest(); <>1__state = 1; return true; case 1: <>1__state = -3; if ((int)5__3.result == 1) { 5__4 = 5__3.downloadHandler.text; 5__5 = <>4__this.ParseApiObjectList(5__4); 5__6 = new List(5__5.Count); 5__7 = null; 5__8 = null; 5__9 = 0; 5__10 = 0; <>s__11 = 5__5.GetEnumerator(); try { while (<>s__11.MoveNext()) { 5__12 = <>s__11.Current; 5__13 = (string)5__12["status"]; if (string.Equals(5__13, "queued", StringComparison.OrdinalIgnoreCase)) { 5__9++; 5__6.Add(new PlayerData { name = (((string)5__12["display_name"]) ?? ((string)5__12["user_id"]) ?? "Unknown"), mmr = (((object)5__12["mmr_snapshot"])?.ToString() ?? "0") }); } else if (string.Equals(5__13, "matched", StringComparison.OrdinalIgnoreCase)) { 5__10++; } if (<>4__this._userProfile != null && 5__7 == null && string.Equals((string)5__12["player_id"], <>4__this._userProfile.id, StringComparison.Ordinal)) { 5__7 = 5__12; 5__8 = 5__13; } 5__13 = null; 5__12 = null; } } finally { ((IDisposable)<>s__11).Dispose(); } <>s__11 = default(List.Enumerator); <>4__this._queuedPlayers = 5__6; <>4__this._onlineCount = 5__9 + 5__10; <>4__this._queuedCount = 5__9; <>4__this._matchedCount = 5__10; if (<>4__this._userProfile != null && 5__7 != null) { 5__14 = 5__8; if (5__14 == "queued" && !<>4__this._isQueueing) { <>4__this._isQueueing = true; <>4__this._currentQueueId = ((string)5__7["id"]) ?? <>4__this._currentQueueId; <>4__this._webStatus = "QUEUED (SYNCED)"; 5__15 = (string)5__7["queued_at"]; if (DateTime.TryParse(5__15, null, DateTimeStyles.RoundtripKind, out 5__16)) { <>4__this._queueStartTime = 5__16.ToUniversalTime(); } <>4__this.Log("Sync: Found active session on server. Reconnecting UI..."); 5__15 = null; } else if (5__14 == "matched" && <>4__this._currentSession == null) { <>4__this._webStatus = "MATCH FOUND (SYNCED)"; <>2__current = <>4__this.CheckForMatch(); <>1__state = 2; return true; } goto IL_0508; } goto IL_0511; } <>4__this.Log($"[Sync] RefreshPlayerList failed: {5__3.result} - {5__3.error}"); break; case 2: { <>1__state = -3; goto IL_0508; } IL_0511: 5__4 = null; 5__5 = null; 5__6 = null; 5__7 = null; 5__8 = null; break; IL_0508: 5__14 = null; goto IL_0511; } <>m__Finally1(); 5__3 = null; return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__3 != null) { ((IDisposable)5__3).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__167 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string matchId; public string playerId; public Action onResolved; public bool logMisses; public SBGLPlugin <>4__this; private <>c__DisplayClass167_0 <>8__1; private string 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__167(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; 5__2 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass167_0(); <>8__1.<>4__this = <>4__this; <>8__1.resolvedId = null; if (string.IsNullOrWhiteSpace(matchId) || string.IsNullOrWhiteSpace(playerId)) { onResolved?.Invoke(null); return false; } 5__2 = "{\"match_id\":\"" + matchId + "\",\"player_id\":\"" + playerId + "\"}"; <>2__current = <>4__this.CallAPI("/MatchEntry?q=" + UnityWebRequest.EscapeURL(5__2) + "&limit=1&sort_by=created_date", "GET", "", delegate(string res) { JObject val = <>8__1.<>4__this.ParseApiObjectList(res).FirstOrDefault(); if (val != null) { <>8__1.resolvedId = (string)val["id"]; } }); <>1__state = 1; return true; case 1: <>1__state = -1; if (logMisses && string.IsNullOrWhiteSpace(<>8__1.resolvedId)) { <>4__this.Log("[Match Entry] No existing MatchEntry found yet for player " + playerId + ""); } onResolved?.Invoke(<>8__1.resolvedId); 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(); } } [CompilerGenerated] private sealed class d__161 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Action onResolved; public bool logMisses; public SBGLPlugin <>4__this; private string 5__1; private string 5__2; private string 5__3; private string 5__4; private UnityWebRequest 5__5; private JObject 5__6; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__161(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; 5__5 = null; 5__6 = null; <>1__state = -2; } private bool MoveNext() { //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Invalid comparison between Unknown and I4 //IL_0330: Unknown result type (might be due to invalid IL or missing references) try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = null; 5__2 = ((<>4__this._currentSession != null) ? <>4__this._currentSession.id : <>4__this._localManualSessionId); if (string.IsNullOrWhiteSpace(5__2)) { onResolved?.Invoke(null); return false; } if (!string.IsNullOrWhiteSpace(<>4__this._currentSession?.match_id)) { 5__1 = <>4__this._currentSession.match_id; if (!<>4__this._finalizedMatchIds.Contains(5__1)) { <>4__this.Log("[Match Creation] Session already linked to Match ID " + 5__1 + ""); onResolved?.Invoke(5__1); return false; } <>4__this.Log("[Match Creation] Session match_id " + 5__1 + " was already finalized — clearing link and forcing new match"); <>4__this._currentSession.match_id = null; 5__1 = null; } 5__3 = "{\"matchmaking_session_id\":\"" + 5__2 + "\"}"; 5__4 = <>4__this.GetBaseApiUrl() + "/Match?q=" + UnityWebRequest.EscapeURL(5__3) + "&sort_by=created_date"; 5__5 = UnityWebRequest.Get(5__4); <>1__state = -3; <>4__this.ApplyApiHeaders(5__5); <>2__current = 5__5.SendWebRequest(); <>1__state = 1; return true; case 1: <>1__state = -3; if ((int)5__5.result == 1) { 5__6 = <>4__this.SelectNewestReusableMatch(<>4__this.ParseApiObjectList(5__5.downloadHandler.text)); JObject obj = 5__6; 5__1 = (string)((obj != null) ? obj["id"] : null); if (!string.IsNullOrWhiteSpace(5__1)) { if (<>4__this._currentSession != null) { <>4__this._currentSession.match_id = 5__1; } <>4__this.Log("[Match Creation] ✓ Reusing newest active Match ID from API for session " + 5__2 + ": " + 5__1 + ""); } else if (logMisses) { <>4__this.Log("[Match Creation] No existing Match found yet for session " + 5__2 + ""); } 5__6 = null; } else { <>4__this.Log($"[Match Creation] Existing Match lookup failed: {5__5.result} - {5__5.error}"); } <>m__Finally1(); 5__5 = null; onResolved?.Invoke(5__1); return false; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__5 != null) { ((IDisposable)5__5).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__202 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string playerName; public Action onResolved; public SBGLPlugin <>4__this; private <>c__DisplayClass202_0 <>8__1; private string 5__2; private string 5__3; private string 5__4; private string 5__5; private string 5__6; private string 5__7; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__202(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; 5__5 = null; 5__6 = null; 5__7 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass202_0(); <>8__1.<>4__this = <>4__this; if (onResolved == null) { return false; } if (string.IsNullOrWhiteSpace(playerName)) { onResolved(null); return false; } <>8__1.normalizedName = playerName.Trim(); <>8__1.resolvedId = null; 5__2 = <>8__1.normalizedName.Replace("\\", "\\\\").Replace("\"", "\\\""); 5__3 = "{\"$or\":[{\"display_name\":\"" + 5__2 + "\"},{\"ign\":\"" + 5__2 + "\"}]}"; <>2__current = <>4__this.CallAPI("/Player?q=" + UnityWebRequest.EscapeURL(5__3) + "&limit=1", "GET", "", delegate(string res) { JObject val3 = <>8__1.<>4__this.ParseApiObjectList(res)?.FirstOrDefault(); if (val3 != null) { <>8__1.resolvedId = (string)val3["id"]; } }); <>1__state = 1; return true; case 1: <>1__state = -1; if (string.IsNullOrWhiteSpace(<>8__1.resolvedId)) { 5__4 = Regex.Escape(<>8__1.normalizedName).Replace("\\ ", " "); 5__5 = "{\"$or\":[{\"display_name\":{\"$regex\":\"^" + 5__4 + "$\",\"$options\":\"i\"}},{\"ign\":{\"$regex\":\"^" + 5__4 + "$\",\"$options\":\"i\"}}]}"; <>2__current = <>4__this.CallAPI("/Player?q=" + UnityWebRequest.EscapeURL(5__5) + "&limit=1", "GET", "", delegate(string res) { JObject val4 = <>8__1.<>4__this.ParseApiObjectList(res)?.FirstOrDefault(); if (val4 != null) { <>8__1.resolvedId = (string)val4["id"]; } }); <>1__state = 2; return true; } goto IL_0243; case 2: <>1__state = -1; 5__4 = null; 5__5 = null; goto IL_0243; case 3: { <>1__state = -1; 5__6 = null; 5__7 = null; break; } IL_0243: if (!string.IsNullOrWhiteSpace(<>8__1.resolvedId)) { break; } 5__6 = <>8__1.normalizedName.Replace("\\", "\\\\").Replace("\"", "\\\""); 5__7 = "{\"$or\":[{\"display_name\":{\"$regex\":\"" + 5__6 + "\",\"$options\":\"i\"}},{\"ign\":{\"$regex\":\"" + 5__6 + "\",\"$options\":\"i\"}}]}"; <>2__current = <>4__this.CallAPI("/Player?q=" + UnityWebRequest.EscapeURL(5__7), "GET", "", delegate(string res) { List list = <>8__1.<>4__this.ParseApiObjectList(res); if (list != null && list.Count != 0) { JObject val = ((IEnumerable)list).FirstOrDefault((Func)((JObject r) => string.Equals((string)((r != null) ? r["display_name"] : null), <>8__1.normalizedName, StringComparison.OrdinalIgnoreCase) || string.Equals((string)((r != null) ? r["ign"] : null), <>8__1.normalizedName, StringComparison.OrdinalIgnoreCase))); JObject val2 = val ?? list.FirstOrDefault(); if (val2 != null) { <>8__1.resolvedId = (string)val2["id"]; } } }); <>1__state = 3; return true; } onResolved(<>8__1.resolvedId); 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(); } } [CompilerGenerated] private sealed class d__225 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string steamName; public SBGLPlugin <>4__this; private string 5__1; private UnityWebRequest 5__2; private string 5__3; private JObject 5__4; private string 5__5; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__225(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; 5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Invalid comparison between Unknown and I4 //IL_02ee: Unknown result type (might be due to invalid IL or missing references) bool result; try { switch (<>1__state) { default: result = false; break; case 0: <>1__state = -1; 5__1 = <>4__this.GetBaseApiUrl() + "/Player?q=" + UnityWebRequest.EscapeURL("{\"display_name\":\"" + steamName + "\"}"); <>4__this.Log("[Init] GET /Player (resolving profile for " + steamName + ")"); <>4__this.Log("[Init] Full URL: " + 5__1.Substring(0, Math.Min(150, 5__1.Length)) + "..."); 5__2 = UnityWebRequest.Get(5__1); <>1__state = -3; <>4__this.ApplyApiHeaders(5__2); <>2__current = 5__2.SendWebRequest(); <>1__state = 1; result = true; break; case 1: <>1__state = -3; if ((int)5__2.result == 1) { 5__3 = 5__2.downloadHandler.text; 5__4 = <>4__this.ParseApiSingleObject(5__3); if (5__4 == null) { <>4__this.Log("Profile sync failed: response was not valid JSON object."); result = false; <>m__Finally1(); break; } <>4__this._userProfile = new PlayerProfile { id = (string)5__4["id"], display_name = (string)5__4["display_name"], region = (((string)5__4["region"]) ?? "US"), state_province = (string)5__4["state_province"] }; float.TryParse(((object)5__4["current_mmr"])?.ToString(), out <>4__this._userProfile.current_mmr); <>4__this.Log("Profile Sync: " + <>4__this._userProfile.display_name + " from " + <>4__this._userProfile.state_province); 5__5 = (string)5__4["profile_pic_url"]; if (!string.IsNullOrEmpty(5__5) && !<>4__this._hasFetchedProfilePic) { ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.DownloadProfilePic(5__5)); } 5__3 = null; 5__4 = null; 5__5 = null; } else { <>4__this.Log($"[Init] ResolveProfile failed: {5__2.result} - {5__2.error}"); } <>m__Finally1(); 5__2 = null; result = false; break; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } return result; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__2 != null) { ((IDisposable)5__2).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__216 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MatchStats stats; public Action onMatchIdReceived; public SBGLPlugin <>4__this; private <>c__DisplayClass216_0 <>8__1; private string 5__2; private string 5__3; private string 5__4; private bool 5__5; private JObject 5__6; private string 5__7; private int 5__8; private string 5__9; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__216(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; 5__6 = null; 5__7 = null; 5__9 = null; <>1__state = -2; } private bool MoveNext() { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass216_0(); <>8__1.<>4__this = <>4__this; <>8__1.onMatchIdReceived = onMatchIdReceived; if (stats == null) { return false; } 5__2 = <>4__this._activeSeasonId ?? "69de6bf4fb103cb0d5eb00c5"; 5__3 = PlayerPrefs.GetString("MatchType", "ranked_season_1"); 5__4 = (IsProSeriesMatchType(5__3) ? "pro_series" : "mmr"); 5__5 = 5__4 == "pro_series"; 5__6 = new JObject { ["matchmaking_session_id"] = JToken.op_Implicit(stats.matchmaking_session_id), ["season_id"] = JToken.op_Implicit(5__2), ["match_date"] = JToken.op_Implicit(stats.match_date), ["match_type"] = JToken.op_Implicit(5__4), ["player_count"] = JToken.op_Implicit(Mathf.Max(0, <>4__this._matchExpectedPlayerCount)), ["status"] = JToken.op_Implicit("Pending"), ["submitted_by_name"] = JToken.op_Implicit(stats.player_name), ["mode"] = JToken.op_Implicit(""), ["notes"] = JToken.op_Implicit("Auto-submitted via SBGL Unified Mod") }; if (5__5) { 5__6["pro_series_season_id"] = JToken.op_Implicit("69b59af135403a1cb7b113c8"); 5__8 = PlayerPrefs.GetInt("ProSeriesWeek", 0); if (5__8 > 0) { 5__6["pro_series_week"] = JToken.op_Implicit(5__8); } 5__9 = PlayerPrefs.GetString("ProSeriesEventName", ""); if (!string.IsNullOrWhiteSpace(5__9)) { 5__6["pro_series_event_name"] = JToken.op_Implicit(5__9); } 5__9 = null; } 5__7 = ((JToken)5__6).ToString((Formatting)0, Array.Empty()); <>4__this.Log("[Match Stats] Submitting Match entry to API"); <>4__this.Log("[Match Stats] Full URL: " + <>4__this.GetBaseApiUrl() + "/Match"); <>4__this.Log("[Match Stats] Payload: " + 5__7 + ""); <>2__current = <>4__this.CallAPI("/Match", "POST", 5__7, delegate(string res) { JObject val = <>8__1.<>4__this.ParseApiSingleObject(res); if (val != null) { string text = ((string)val["id"]) ?? "unknown"; <>8__1.<>4__this._lastUploadedPlayerCount = Mathf.Max(0, <>8__1.<>4__this._matchExpectedPlayerCount); <>8__1.<>4__this.Log("[Match Stats] ✓ Match entry created (ID: " + text + ")"); <>8__1.<>4__this.ShowUploadNotification("Upload success: match ID " + text + ".", "success"); <>8__1.onMatchIdReceived?.Invoke(text); } else { <>8__1.<>4__this.Log("[Match Stats] Response received but could not parse ID"); <>8__1.<>4__this.ShowUploadNotification("Upload failed: invalid API response.", "failure"); } }); <>1__state = 1; return true; case 1: <>1__state = -1; 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(); } } [CompilerGenerated] private sealed class d__217 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string matchId; public string playerId; public SBGLPlugin <>4__this; private <>c__DisplayClass217_0 <>8__1; private int 5__2; private int 5__3; private string 5__4; private bool 5__5; private int 5__6; private string 5__7; private Dictionary.Enumerator <>s__8; private KeyValuePair 5__9; private int 5__10; private string 5__11; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__217(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; 5__4 = null; 5__7 = null; <>s__8 = default(Dictionary.Enumerator); 5__9 = default(KeyValuePair); 5__11 = null; <>1__state = -2; } private bool MoveNext() { //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass217_0(); <>8__1.<>4__this = <>4__this; <>8__1.playerId = playerId; 5__2 = 0; 5__3 = 0; <>8__1.playerDisplayName = null; 5__4 = null; <>s__8 = <>4__this._playerIdsByName.GetEnumerator(); try { while (<>s__8.MoveNext()) { 5__9 = <>s__8.Current; if (!string.IsNullOrWhiteSpace(5__9.Value) && string.Equals(5__9.Value, <>8__1.playerId, StringComparison.OrdinalIgnoreCase)) { 5__4 = 5__9.Key?.Trim(); break; } 5__9 = default(KeyValuePair); } } finally { ((IDisposable)<>s__8).Dispose(); } <>s__8 = default(Dictionary.Enumerator); if (!string.IsNullOrEmpty(5__4)) { <>8__1.playerDisplayName = 5__4; <>4__this.Log("[Match Stats] Using leaderboard name mapping for " + <>8__1.playerId + ": " + <>8__1.playerDisplayName + ""); } if (string.IsNullOrEmpty(<>8__1.playerDisplayName) && <>8__1.playerId == <>4__this._userProfile.id) { <>8__1.playerDisplayName = <>4__this._userProfile.display_name; <>4__this.Log("[Match Stats] Current user: " + <>8__1.playerDisplayName + ""); } if (string.IsNullOrEmpty(<>8__1.playerDisplayName)) { <>4__this.Log("[Match Stats] Fetching profile for opponent " + <>8__1.playerId + " (fallback)"); <>2__current = <>4__this.CallAPI("/Player/" + <>8__1.playerId, "GET", "", delegate(string res) { try { JObject val2 = <>8__1.<>4__this.ParseApiSingleObject(res); if (val2 != null) { <>8__1.playerDisplayName = (string)val2["display_name"]; <>8__1.<>4__this.Log("[Match Stats] Opponent display name (API): " + <>8__1.playerDisplayName + ""); } } catch (Exception ex) { <>8__1.<>4__this.Log("[Match Stats] Error parsing opponent profile: " + ex.Message + ""); } }); <>1__state = 1; return true; } goto IL_02c1; case 1: <>1__state = -1; goto IL_02c1; case 2: <>1__state = -1; goto IL_0514; case 3: { <>1__state = -1; return false; } IL_02c1: 5__5 = false; 5__6 = 0; goto IL_0514; IL_0514: while (!5__5 && 5__6 < 5) { if (!string.IsNullOrEmpty(<>8__1.playerDisplayName)) { if (<>4__this._cachedLeaderboardScores.TryGetValue(<>8__1.playerDisplayName, out 5__10)) { 5__2 = 5__10; <>4__this._cachedLeaderboardScoresVsPar.TryGetValue(<>8__1.playerDisplayName, out 5__3); 5__5 = true; <>4__this.Log($"[Match Stats] ✓ Found cached scores for {<>8__1.playerDisplayName}: {5__2} pts, {5__3} vs par"); break; } 5__11 = <>4__this._cachedLeaderboardScores.Keys.FirstOrDefault((string k) => string.Equals(k?.Trim(), <>8__1.playerDisplayName?.Trim(), StringComparison.OrdinalIgnoreCase)); if (!string.IsNullOrEmpty(5__11)) { 5__2 = <>4__this._cachedLeaderboardScores[5__11]; <>4__this._cachedLeaderboardScoresVsPar.TryGetValue(5__11, out 5__3); 5__5 = true; <>4__this.Log($"[Match Stats] ✓ Found cached scores via fallback key '{5__11}' for {<>8__1.playerDisplayName}: {5__2} pts, {5__3} vs par"); break; } 5__11 = null; } 5__6++; if (!5__5 && 5__6 < 5) { <>4__this.Log($"[Match Stats] Scores not cached yet for {<>8__1.playerDisplayName ?? <>8__1.playerId}, retry {5__6}/5..."); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 2; return true; } } if (!5__5) { <>4__this.Log("[Match Stats] ⚠ No leaderboard data found for " + (<>8__1.playerDisplayName ?? <>8__1.playerId) + " after retries"); } 5__7 = "{\"match_id\":\"" + matchId + "\",\"player_id\":\"" + <>8__1.playerId + "\",\"player_name\":\"" + (<>8__1.playerDisplayName ?? "Unknown") + "\"," + $"\"game_points\":{5__2}," + $"\"score_vs_par\":{5__3}," + "\"notes\":\"Auto-submitted player entry via SBGL Unified Mod\"}"; <>4__this.Log($"[Match Stats] Submitting MatchEntry for {<>8__1.playerDisplayName ?? <>8__1.playerId}: {5__2} pts, {5__3} vs par"); <>2__current = <>4__this.CallAPI("/MatchEntry", "POST", 5__7, delegate(string res) { JObject val = <>8__1.<>4__this.ParseApiSingleObject(res); if (val != null) { string text = ((string)val["id"]) ?? "unknown"; <>8__1.<>4__this.Log("[Match Stats] ✓ MatchEntry created (ID: " + text + ") for player " + (<>8__1.playerDisplayName ?? <>8__1.playerId) + ""); } else { <>8__1.<>4__this.Log("[Match Stats] Could not parse MatchEntry response for player " + (<>8__1.playerDisplayName ?? <>8__1.playerId) + ""); } }); <>1__state = 3; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__213 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SBGLPlugin <>4__this; private <>c__DisplayClass213_0 <>8__1; private float 5__2; private MatchStats 5__3; private Dictionary 5__4; private Dictionary 5__5; private LiveLeaderboardPlugin 5__6; private List 5__7; private List.Enumerator <>s__8; private LiveLeaderboardPlugin.SBGLPlayer 5__9; private int 5__10; private int 5__11; private string 5__12; private Exception 5__13; private List.Enumerator <>s__14; private string 5__15; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__213(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 3) { try { } finally { <>m__Finally1(); } } <>8__1 = null; 5__3 = null; 5__4 = null; 5__5 = null; 5__6 = null; 5__7 = null; <>s__8 = default(List.Enumerator); 5__9 = null; 5__12 = null; 5__13 = null; <>s__14 = default(List.Enumerator); 5__15 = null; <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass213_0(); <>8__1.<>4__this = <>4__this; if (<>4__this._userProfile == null || <>4__this._currentSession == null) { <>4__this.Log("[Match Stats] Failed: Missing profile or session"); return false; } if (IsProSeriesMatchType(PlayerPrefs.GetString("MatchType", "")) || <>4__this.IsCurrentMatchCasual()) { <>4__this._matchStatsSubmitted = true; return false; } <>4__this.Log("[Match Stats] Collecting data for session: " + <>4__this._currentSession.id + ""); 5__2 = 0f; if (<>4__this._matchStartTime.HasValue) { 5__2 = (float)(DateTime.UtcNow - <>4__this._matchStartTime.Value).TotalSeconds; } 5__3 = <>4__this.CollectMatchStats(5__2); if (5__3 == null) { <>4__this.Log("[Match Stats] Failed to collect stats"); return false; } <>4__this.Log($"[Match Stats] Duration: {5__2}s | Host: {5__3.is_host} | Player: {5__3.player_name}"); <>8__1.matchId = null; <>2__current = <>4__this.SubmitMatchEntry(5__3, delegate(string id) { <>8__1.matchId = id; }); <>1__state = 1; return true; case 1: <>1__state = -1; if (string.IsNullOrEmpty(<>8__1.matchId)) { <>4__this.Log("[Match Stats] Failed to get Match ID from submission"); return false; } <>2__current = <>4__this.CallAPI("/MatchmakingSession/" + <>4__this._currentSession.id, "PUT", "{\"match_id\":\"" + <>8__1.matchId + "\"}", delegate(string res) { JObject val = <>8__1.<>4__this.ParseApiSingleObject(res); if (val != null) { <>8__1.<>4__this._currentSession.match_id = <>8__1.matchId; <>8__1.<>4__this.Log("[Match Stats] ✓ MatchmakingSession " + <>8__1.<>4__this._currentSession.id + " linked to match: " + <>8__1.matchId + ""); } else { <>8__1.<>4__this.Log("[Match Stats] Could not confirm MatchmakingSession update"); } }); <>1__state = 2; return true; case 2: <>1__state = -1; 5__4 = new Dictionary(); 5__5 = new Dictionary(); try { 5__6 = Object.FindAnyObjectByType((FindObjectsInactive)1); if ((Object)(object)5__6 != (Object)null) { 5__7 = 5__6.GetCurrentLeaderboard(); <>4__this.Log($"[Match Stats] Leaderboard has {5__7.Count} visible players"); <>s__8 = 5__7.GetEnumerator(); try { while (<>s__8.MoveNext()) { 5__9 = <>s__8.Current; if (5__9 != null) { 5__10 = 5__9.BaseScore; 5__11 = 0; if (!string.IsNullOrEmpty(5__9.RawStrokes)) { 5__12 = 5__9.RawStrokes.Replace("±", "").Trim(); int.TryParse(5__12, out 5__11); 5__12 = null; } 5__4[5__9.Name] = 5__10; 5__5[5__9.Name] = 5__11; <>4__this.Log($"[Match Stats] Cached: {5__9.Name} = {5__10} pts, {5__11} vs par"); 5__9 = null; } } } finally { ((IDisposable)<>s__8).Dispose(); } <>s__8 = default(List.Enumerator); 5__7 = null; } else { <>4__this.Log("[Match Stats] LiveLeaderboard not found - will use placeholder scores"); } 5__6 = null; } catch (Exception ex) { 5__13 = ex; <>4__this.Log("[Match Stats] Error fetching leaderboard data: " + 5__13.Message + ""); } <>4__this._cachedLeaderboardScores = 5__4; <>4__this._cachedLeaderboardScoresVsPar = 5__5; if (<>4__this._currentSession.player_ids == null || <>4__this._currentSession.player_ids.Count <= 0) { break; } <>4__this.Log($"[Match Stats] Creating MatchEntry records for {<>4__this._currentSession.player_ids.Count} players"); <>s__14 = <>4__this._currentSession.player_ids.GetEnumerator(); <>1__state = -3; goto IL_05ce; case 3: { <>1__state = -3; 5__15 = null; goto IL_05ce; } IL_05ce: if (<>s__14.MoveNext()) { 5__15 = <>s__14.Current; <>2__current = <>4__this.SubmitMatchEntryForPlayer(<>8__1.matchId, 5__15); <>1__state = 3; return true; } <>m__Finally1(); <>s__14 = default(List.Enumerator); break; } <>4__this._matchStatsSubmitted = true; <>4__this.Log("[Match Stats] ✓ Match and player entries submitted successfully"); return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>s__14).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__188 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SBGLPlugin <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__188(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = _readyTransitionDelay; <>1__state = 1; return true; case 1: <>1__state = -1; 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(); } } [CompilerGenerated] private sealed class d__198 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string entryId; public string playerId; public string playerName; public int gamePoints; public int scoreVsPar; public int finishPosition; public string postMatchMmr; public string preMatchMmr; public SBGLPlugin <>4__this; private <>c__DisplayClass198_0 <>8__1; private int 5__2; private JObject 5__3; private float 5__4; private string 5__5; private float 5__6; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__198(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; 5__3 = null; 5__5 = null; <>1__state = -2; } private bool MoveNext() { //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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass198_0(); <>8__1.<>4__this = <>4__this; <>8__1.playerName = playerName; <>4__this.Log($"[Score Update] Hole completed for {<>8__1.playerName}: {gamePoints} pts, {scoreVsPar} vs par"); 5__2 = gamePoints + scoreVsPar * -10; 5__3 = new JObject { ["game_points"] = JToken.op_Implicit(gamePoints), ["over_under"] = JToken.op_Implicit(scoreVsPar), ["score_vs_par"] = JToken.op_Implicit(scoreVsPar), ["adjusted_match_score"] = JToken.op_Implicit(5__2), ["notes"] = JToken.op_Implicit("Updated after hole completion") }; if (finishPosition > 0) { 5__3["finish_position"] = JToken.op_Implicit(finishPosition); } if (!string.IsNullOrWhiteSpace(postMatchMmr) && float.TryParse(postMatchMmr, NumberStyles.Float, CultureInfo.InvariantCulture, out 5__4)) { 5__3["post_match_mmr"] = JToken.op_Implicit(5__4); if (!string.IsNullOrWhiteSpace(preMatchMmr) && float.TryParse(preMatchMmr, NumberStyles.Float, CultureInfo.InvariantCulture, out 5__6)) { 5__3["mmr_change"] = JToken.op_Implicit(5__4 - 5__6); } } 5__5 = ((JToken)5__3).ToString((Formatting)0, Array.Empty()); <>2__current = <>4__this.CallAPI("/MatchEntry/" + entryId, "PUT", 5__5, delegate(string res) { try { JObject val = <>8__1.<>4__this.ParseApiSingleObject(res); if (val != null) { <>8__1.<>4__this.Log("[Score Update] ✓ MatchEntry updated for " + <>8__1.playerName + ""); } } catch (Exception ex) { <>8__1.<>4__this.Log("[Score Update] Could not update MatchEntry: " + ex.Message + ""); } }); <>1__state = 1; return true; case 1: <>1__state = -1; 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(); } } [CompilerGenerated] private sealed class d__203 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public int actualPlayerCount; public string source; public SBGLPlugin <>4__this; private <>c__DisplayClass203_0 <>8__1; private string 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__203(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; 5__2 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass203_0(); <>8__1.<>4__this = <>4__this; <>8__1.actualPlayerCount = actualPlayerCount; <>8__1.source = source; if (<>8__1.actualPlayerCount <= 0 || string.IsNullOrEmpty(<>4__this._currentMatchId)) { return false; } if (<>4__this._lastUploadedPlayerCount == <>8__1.actualPlayerCount) { return false; } 5__2 = "{" + $"\"player_count\":{<>8__1.actualPlayerCount}" + "}"; <>2__current = <>4__this.CallAPI("/Match/" + <>4__this._currentMatchId, "PUT", 5__2, delegate(string res) { JObject val = <>8__1.<>4__this.ParseApiSingleObject(res); if (val != null) { <>8__1.<>4__this._lastUploadedPlayerCount = <>8__1.actualPlayerCount; <>8__1.<>4__this.Log($"[Match Count] ✓ Updated match player_count to {<>8__1.actualPlayerCount} ({<>8__1.source})"); } else { <>8__1.<>4__this.Log($"[Match Count] Could not confirm player_count update to {<>8__1.actualPlayerCount} ({<>8__1.source})"); } }); <>1__state = 1; return true; case 1: <>1__state = -1; 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(); } } [CompilerGenerated] private sealed class d__222 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string status; public SBGLPlugin <>4__this; private string 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__222(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (<>4__this._currentSession == null || <>4__this._currentSession.id == "DEBUG") { return false; } 5__1 = "{\"status\":\"" + status + "\"}"; <>2__current = <>4__this.CallAPI("/MatchmakingSession/" + <>4__this._currentSession.id, "PUT", 5__1, null); <>1__state = 1; return true; case 1: <>1__state = -1; 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(); } } [CompilerGenerated] private sealed class d__148 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string source; public SBGLPlugin <>4__this; private <>c__DisplayClass148_0 <>8__1; private float 5__2; private JObject 5__3; private <>c__DisplayClass148_1 <>8__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__148(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 1) <= 3u) { try { } finally { <>m__Finally1(); } } <>8__1 = null; 5__3 = null; <>8__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Expected O, but got Unknown bool result; try { switch (<>1__state) { default: result = false; goto end_IL_0000; case 0: <>1__state = -1; if (<>4__this._matchScreenshotUploadCompleted || <>4__this._matchScreenshotUploadInProgress) { result = false; } else if ((string.IsNullOrWhiteSpace(<>4__this._pendingUploadedScreenshotUrl) && (<>4__this._pendingMatchScreenshotBytes == null || <>4__this._pendingMatchScreenshotBytes.Length == 0)) || string.IsNullOrWhiteSpace(<>4__this._currentMatchId)) { result = false; } else { <>4__this._matchScreenshotUploadInProgress = true; <>1__state = -3; <>8__1 = new <>c__DisplayClass148_0(); <>8__1.<>4__this = <>4__this; 5__2 = <>4__this.GetCurrentPlayerScreenshotUploadDelaySeconds(); if (!(5__2 > 0f)) { goto IL_0139; } <>2__current = (object)new WaitForSeconds(5__2); <>1__state = 1; result = true; } goto end_IL_0000; case 1: <>1__state = -3; goto IL_0139; case 2: <>1__state = -3; if (<>8__1.readSucceeded && !string.IsNullOrWhiteSpace(<>8__1.existingScreenshotUrl)) { <>4__this._matchScreenshotUploadCompleted = true; <>4__this.ClearPendingMatchScreenshot(); <>4__this.Log("[Match Screenshot] Match " + <>4__this._currentMatchId + " already has a screenshot - skipping duplicate upload (" + source + ")"); result = false; break; } if (!string.IsNullOrWhiteSpace(<>4__this._pendingUploadedScreenshotUrl)) { goto IL_02fd; } <>8__4 = new <>c__DisplayClass148_1(); <>8__4.uploadedFileUrl = null; <>2__current = <>4__this.UploadMatchScreenshotFile(delegate(string url) { <>8__4.uploadedFileUrl = url; }); <>1__state = 3; result = true; goto end_IL_0000; case 3: <>1__state = -3; if (string.IsNullOrWhiteSpace(<>8__4.uploadedFileUrl)) { <>4__this.Log("[Match Screenshot] UploadFile did not return a file URL (" + source + ") - keeping screenshot for retry"); result = false; break; } <>4__this._pendingUploadedScreenshotUrl = <>8__4.uploadedFileUrl; <>8__4 = null; goto IL_02fd; case 4: { <>1__state = -3; if (<>8__1.uploadSucceeded) { <>4__this._matchScreenshotUploadCompleted = true; <>4__this.ClearPendingMatchScreenshot(); <>4__this.Log("[Match Screenshot] ✓ Attached scoreboard screenshot to Match " + <>4__this._currentMatchId + ""); <>4__this.ShowUploadNotification("Attached end-of-match screenshot for review."); } else { <>4__this.Log("[Match Screenshot] Screenshot upload did not succeed yet (" + source + ") - will keep the screenshot for fallback retry"); } <>8__1 = null; 5__3 = null; <>m__Finally1(); result = false; goto end_IL_0000; } IL_0139: <>8__1.existingScreenshotUrl = null; <>8__1.readSucceeded = false; <>2__current = <>4__this.CallAPI("/Match/" + <>4__this._currentMatchId, "GET", "", delegate(string res) { <>8__1.readSucceeded = true; JObject val2 = <>8__1.<>4__this.ParseApiSingleObject(res); <>8__1.existingScreenshotUrl = (string)((val2 != null) ? val2["screenshot_url"] : null); }); <>1__state = 2; result = true; goto end_IL_0000; IL_02fd: 5__3 = new JObject { ["screenshot_url"] = JToken.op_Implicit(<>4__this._pendingUploadedScreenshotUrl) }; <>8__1.uploadSucceeded = false; <>2__current = <>4__this.CallAPI("/Match/" + <>4__this._currentMatchId, "PUT", ((JToken)5__3).ToString((Formatting)0, Array.Empty()), delegate(string res) { JObject val = <>8__1.<>4__this.ParseApiSingleObject(res); <>8__1.uploadSucceeded = val != null; }); <>1__state = 4; result = true; goto end_IL_0000; } <>m__Finally1(); end_IL_0000:; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } return result; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; <>4__this._matchScreenshotUploadInProgress = false; } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__149 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Action onUploaded; public SBGLPlugin <>4__this; private string 5__1; private WWWForm
5__2; private UnityWebRequest 5__3; private JObject 5__4; private string 5__5; private string 5__6; private int 5__7; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__149(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; 5__5 = null; 5__6 = null; <>1__state = -2; } private bool MoveNext() { //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Invalid comparison between Unknown and I4 //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0261: Unknown result type (might be due to invalid IL or missing references) try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (<>4__this._pendingMatchScreenshotBytes == null || <>4__this._pendingMatchScreenshotBytes.Length == 0) { onUploaded?.Invoke(null); return false; } 5__1 = <>4__this.GetCoreIntegrationEndpointUrl("UploadFile"); 5__2 = new WWWForm(); 5__2.AddBinaryData("file", <>4__this._pendingMatchScreenshotBytes, <>4__this._pendingMatchScreenshotFileName ?? <>4__this.BuildMatchScreenshotFileName(), "image/jpeg"); <>4__this.Log($"[Match Screenshot] Uploading screenshot file via Core/UploadFile ({(float)<>4__this._pendingMatchScreenshotBytes.Length / 1024f:0.#} KB)"); 5__3 = UnityWebRequest.Post(5__1, 5__2); <>1__state = -3; <>4__this.ApplyIntegrationHeaders(5__3); 5__3.SetRequestHeader("Accept", "application/json"); <>2__current = 5__3.SendWebRequest(); <>1__state = 1; return true; case 1: <>1__state = -3; if ((int)5__3.result == 1) { 5__4 = <>4__this.ParseApiSingleObject(5__3.downloadHandler.text); JObject obj = 5__4; string text = (string)((obj != null) ? obj["file_url"] : null); if (text == null) { JObject obj2 = 5__4; text = (string)((obj2 != null) ? obj2["url"] : null); } 5__5 = text; if (!string.IsNullOrWhiteSpace(5__5)) { <>4__this.Log("[Match Screenshot] ✓ Screenshot uploaded to file storage"); onUploaded?.Invoke(5__5); } else { <>4__this.Log("[Match Screenshot] UploadFile succeeded but response did not contain file_url"); onUploaded?.Invoke(null); } 5__4 = null; 5__5 = null; } else { 5__6 = $"[Match Screenshot] UploadFile failed: {5__3.result}"; if (!string.IsNullOrEmpty(5__3.error)) { 5__6 = 5__6 + " - " + 5__3.error; } if (5__3.responseCode > 0) { 5__6 += $" (HTTP {5__3.responseCode})"; } DownloadHandler downloadHandler = 5__3.downloadHandler; if (!string.IsNullOrEmpty((downloadHandler != null) ? downloadHandler.text : null)) { 5__7 = Math.Min(240, 5__3.downloadHandler.text.Length); 5__6 = 5__6 + " - Response: " + 5__3.downloadHandler.text.Substring(0, 5__7); } <>4__this.Log("" + 5__6 + ""); onUploaded?.Invoke(null); 5__6 = null; } <>m__Finally1(); 5__3 = null; return false; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__3 != null) { ((IDisposable)5__3).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__193 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string steamLink; public SBGLPlugin <>4__this; private string 5__1; private UnityWebRequest 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__193(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__1 = null; 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Invalid comparison between Unknown and I4 //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Expected O, but got Unknown //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Expected O, but got Unknown //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Expected O, but got Unknown try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (<>4__this._currentSession == null || string.IsNullOrEmpty(steamLink)) { return false; } if (string.Equals(<>4__this._currentSession.steam_lobby_link, steamLink, StringComparison.Ordinal)) { <>4__this.Log("Steam Lobby Link already synced. Skipping redundant upload."); return false; } <>4__this._steamLinkUploadAttempts++; <>4__this._lastUploadAttemptAt = DateTime.Now; <>4__this._lastGeneratedSteamLink = steamLink; <>4__this.Log("Uploading Steam Lobby Link to API..."); 5__1 = "{\"steam_lobby_link\":\"" + steamLink + "\"}"; 5__2 = new UnityWebRequest(<>4__this.GetBaseApiUrl() + "/MatchmakingSession/" + <>4__this._currentSession.id, "PUT"); <>1__state = -3; 5__2.uploadHandler = (UploadHandler)new UploadHandlerRaw(Encoding.UTF8.GetBytes(5__1)); 5__2.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer(); <>4__this.ApplyApiHeaders(5__2); <>2__current = 5__2.SendWebRequest(); <>1__state = 1; return true; case 1: <>1__state = -3; if ((int)5__2.result == 1) { <>4__this._steamLinkUploadSuccesses++; <>4__this._lastUploadSuccessAt = DateTime.Now; <>4__this._lastUploadedSteamLink = steamLink; <>4__this._currentSession.steam_lobby_link = steamLink; <>4__this._lastUploadError = "-"; <>4__this.Log("Steam Lobby Link uploaded successfully."); } else { <>4__this._steamLinkUploadFailures++; <>4__this._lastUploadError = $"{5__2.result}: {5__2.error}"; <>4__this.Log("Steam Lobby Link upload failed: " + <>4__this._lastUploadError + ""); } <>m__Finally1(); 5__2 = null; return false; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__2 != null) { ((IDisposable)5__2).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__231 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Action callback; public SBGLPlugin <>4__this; private string 5__1; private bool 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__231(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (PlayerPrefs.GetString("MatchType", "").Contains("pro_series")) { if (!<>4__this._proSeriesSkipLogged) { <>4__this.Log("[Match] Pro Series match — automated upload skipped"); <>4__this._proSeriesSkipLogged = true; } callback?.Invoke(obj: false); return false; } if (<>4__this._userProfile == null) { <>2__current = <>4__this.EnsureUserProfileResolved("Match Upload Validation", 6f); <>1__state = 1; return true; } break; case 1: <>1__state = -1; break; } if (<>4__this._userProfile == null) { <>4__this.Log("[Match Upload Validation] Profile is still null after waiting for resolution"); <>4__this.ShowUploadNotification("Upload validation failed: missing profile", "failure"); callback?.Invoke(obj: false); return false; } 5__1 = <>4__this.ResolveCurrentLobbyName(); if (<>4__this.IgnoreSbglLobbyRequirementEnabled) { <>4__this.Log("[Match Upload Validation] Upload All Matches enabled. Bypassing SBGL-* lobby requirement for '" + 5__1 + "'."); <>4__this.ShowUploadNotification("Uploading match results (Upload All Matches enabled)..."); callback?.Invoke(obj: true); return false; } if (string.IsNullOrEmpty(5__1)) { 5__2 = <>4__this._isInGameplay || IsRankedTriggered || <>4__this._currentSession != null; if (5__2) { <>4__this.Log("[Match Upload Validation] Lobby name unresolved (blank). Allowing upload due to active ranked/session context."); <>4__this.ShowUploadNotification("Uploading match results (lobby name unresolved)..."); callback?.Invoke(obj: true); return false; } } if (!IsSbglLobbyName(5__1)) { <>4__this.Log("[Match Upload Validation] Lobby name '" + 5__1 + "' does not match 'SBGL-*' pattern"); <>4__this.ShowUploadNotification("Upload blocked: Lobby '" + 5__1 + "' is not SBGL-*", "warning"); callback?.Invoke(obj: false); return false; } <>4__this.Log("[Match Upload Validation] ✓ Lobby name matches pattern: " + 5__1 + ""); <>4__this.ShowUploadNotification("Uploading match results for " + 5__1 + "..."); <>4__this.Log("[Match Upload Validation] ✓ Validation passed - proceeding with upload"); callback?.Invoke(obj: 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(); } } [CompilerGenerated] private sealed class d__165 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float delaySeconds; public Action onResolved; public SBGLPlugin <>4__this; private float 5__1; private <>c__DisplayClass165_0 <>8__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__165(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (<>4__this._currentSession == null || delaySeconds <= 0f) { onResolved?.Invoke(null); return false; } 5__1 = 0f; break; case 1: <>1__state = -1; if (!string.IsNullOrEmpty(<>8__2.existingMatchId)) { onResolved?.Invoke(<>8__2.existingMatchId); return false; } <>2__current = (object)new WaitForSeconds(1f); <>1__state = 2; return true; case 2: <>1__state = -1; 5__1 += 1f; <>8__2 = null; break; } if (5__1 < delaySeconds) { <>8__2 = new <>c__DisplayClass165_0(); <>8__2.existingMatchId = null; <>2__current = <>4__this.ResolveExistingMatchIdForCurrentSession(delegate(string id) { <>8__2.existingMatchId = id; }, logMisses: false); <>1__state = 1; return true; } onResolved?.Invoke(null); 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(); } } [CompilerGenerated] private sealed class d__168 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string playerId; public Action onResolved; public SBGLPlugin <>4__this; private float 5__1; private string 5__2; private string 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__168(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; 5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = 0f; break; case 1: <>1__state = -1; 5__1 += 0.25f; 5__3 = null; break; } if (!string.IsNullOrWhiteSpace(playerId) && <>4__this._matchEntryCreationInProgress.Contains(playerId) && 5__1 < 3f) { if (<>4__this._playerMatchEntryIds.TryGetValue(playerId, out 5__3) && !string.IsNullOrWhiteSpace(5__3)) { onResolved?.Invoke(5__3); return false; } <>2__current = (object)new WaitForSeconds(0.25f); <>1__state = 1; return true; } if (!string.IsNullOrWhiteSpace(playerId) && <>4__this._playerMatchEntryIds.TryGetValue(playerId, out 5__2) && !string.IsNullOrWhiteSpace(5__2)) { onResolved?.Invoke(5__2); } else { onResolved?.Invoke(null); } 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 Dictionary _randomizedPlayerMap = null; private static readonly List _sbglTestNames = new List { "TrashxCat", "KingCire03", "FucklTheIRS", "Jackie", "TikTok Z4C_FN", "adthykrshnn", "mrguy7608", "Noah_Boatt", "YoMaMMeJr", "TheMrEStudio", "Odius9064", "Jake paul", "f19chy", "Kodakblackarack", "ArrowTheFighter", "limbo", "Marcus_Pipes", "That Traynor", "Blinkerfluid", "TaxiCAB", "Achunl2", "Cinereous", "Liafeon", "Peter", "Inkie", "LLENN", "Nanainasuit", "Midnight", "PattyTits", "Bekuh", "Lunwik", "yackback", "AlpineMilk", "HandsomeSkippy", "TheOneKP", "RealJosher", "Ooshida", "Moto", "Jozza", "Patrick Swayze", "ryan.scibetta", "Zaikr", "Thalosii", "paradiorevey", "Ricee", "Slacker87", "MRGoldberg", "trusted", "designedsilence", "The Oreo Orgy", "Zoboomafoo", "Yoda Cage", "Black Dolphin", "Pengini", "antyde", "Glider", "lyth", "Jabobus.o7", "dkgaming219", "Cody", "Sidimmu", "снусмумрик", "Skydown26", "Jeb", "Vac", "Slem Dogg", "Batto", "Broj0e" }; private ConfigEntry _showLogsConfig; private ConfigEntry _showFlowDebugConfig; private ConfigEntry _showUploadNoticesConfig; private ConfigEntry _ignoreSbglLobbyRequirementConfig; private ConfigEntry _testPlayerOverridesConfig; private ConfigEntry _testRandomizeAllPlayersConfig; private ManualLogSource _bepinexLogger; private bool _isInitializing = true; private int _onlineCount = 0; private int _queuedCount = 0; private int _matchedCount = 0; public static bool IsRankedTriggered = false; public static string CurrentMatchId = null; private bool _isQueueing = false; private string _webStatus = "IDLE"; private string _currentQueueId = ""; private PlayerProfile _userProfile = null; private MatchmakingSession _currentSession = null; private bool _isHost = false; private bool _hasAccepted = false; private string _hostRulesetSelection = "ranked"; private string _queueTypeSelection = "ranked"; private DateTime? _queueStartTime = null; private bool _hostLobbyStarted = false; private bool _hostServerWasActive = false; private bool _hostCancelSent = false; private bool _matchStatsSubmitted = false; private bool _proSeriesSkipLogged = false; private DateTime? _matchStartTime = null; private Dictionary _cachedLeaderboardScores = new Dictionary(); private Dictionary _cachedLeaderboardScoresVsPar = new Dictionary(); private string __currentMatchId = null; private HashSet _finalizedMatchIds = new HashSet(StringComparer.OrdinalIgnoreCase); private Dictionary _playerMatchEntryIds = new Dictionary(); private HashSet _matchEntryCreationInProgress = new HashSet(StringComparer.OrdinalIgnoreCase); private Dictionary _playerIdsByName = new Dictionary(StringComparer.OrdinalIgnoreCase); private Dictionary _lastSubmittedScores = new Dictionary(); private Dictionary _lastSubmittedScoresVsPar = new Dictionary(); private int _matchExpectedPlayerCount = 2; private int _lastUploadedPlayerCount = -1; private List _finalLeaderboardSnapshot = new List(); private byte[] _pendingMatchScreenshotBytes = null; private string _pendingMatchScreenshotFileName = null; private string _pendingUploadedScreenshotUrl = null; private bool _matchScreenshotUploadInProgress = false; private bool _matchScreenshotUploadCompleted = false; private bool _matchEntriesCreated = false; private bool _matchCreationInProgress = false; private bool _isInGameplay = false; private bool _matchEndedReceived = false; private Coroutine _monitorCoroutine = null; private Coroutine _lobbyMonitorCoroutine = null; private Coroutine _endOfMatchSignalCoroutine = null; private Coroutine _matchScreenshotSignalCoroutine = null; private Coroutine _courseEndRpcCoroutine = null; private float _nextEnsureMatchCreateAttemptAt = 0f; private string _localManualSessionId = null; private const int MatchScreenshotMaxWidth = 1920; private const int MatchScreenshotMaxHeight = 1080; private const int MatchScreenshotTargetMaxBytes = 819200; private const int MatchScreenshotHardMaxBytes = 1048576; private string _activeSeasonId = null; private bool _activeSeasonFetched = false; private List _debugLogs = new List(); private List _queuedPlayers = new List(); private Vector2 _logScroll; private Texture2D _profileTexture = null; private Texture2D _solidBgTex = null; private bool _hasFetchedProfilePic = false; private GUIStyle _centerLabelStyle = null; private GUIStyle _debugLineStyle = null; private string _uploadNotification = ""; private DateTime _uploadNotificationTime = DateTime.MinValue; private const float _uploadNotificationDuration = 4f; private Color _uploadNotificationColor = new Color(0.2f, 0.85f, 1f); private string _debugLobbySessionSource = ""; private string _debugLobbyPrefsSource = ""; private string _debugLobbyCapturedSource = ""; private string _debugLobbyResolved = ""; private string _debugLobbyResolvedBy = "none"; private MatchResultSubmissionService _matchResultSubmission; private static readonly WaitForSeconds _syncLoopDelay = new WaitForSeconds(5f); private static readonly WaitForSeconds _readyTransitionDelay = new WaitForSeconds(0.5f); private int _syncTickCount = 0; private int _lobbyCreatedEventCount = 0; private int _steamLinkUploadAttempts = 0; private int _steamLinkUploadSuccesses = 0; private int _steamLinkUploadFailures = 0; private int _autoJoinAttempts = 0; private int _autoJoinSuccesses = 0; private int _autoJoinFailures = 0; private DateTime? _lastLobbyCreatedAt = null; private DateTime? _lastUploadAttemptAt = null; private DateTime? _lastUploadSuccessAt = null; private DateTime? _lastAutoJoinAttemptAt = null; private DateTime? _lastAutoJoinSuccessAt = null; private string _lastGeneratedSteamLink = "-"; private string _lastUploadedSteamLink = "-"; private string _lastAutoJoinSteamLink = "-"; private string _lastUploadError = "-"; private string _lastAutoJoinError = "-"; private bool IgnoreSbglLobbyRequirementEnabled => _ignoreSbglLobbyRequirementConfig?.Value ?? false; private string _currentMatchId { get { return __currentMatchId; } set { __currentMatchId = value; CurrentMatchId = value; } } public bool IsQueueing => _isQueueing; public bool IsHost => _isHost; public bool HasAccepted => _hasAccepted; public PlayerProfile UserProfile => _userProfile; public MatchmakingSession CurrentSession => _currentSession; private string GetBaseApiUrl() { return UnifiedPlugin.GetCurrentPlayerApi().Replace("/Player", ""); } private string GetAppId() { return UnifiedPlugin.GetCurrentAppId(); } private string GetAuthToken() { return UnifiedPlugin.GetCurrentAuthToken(); } public void SetConfig(ConfigEntry showLogs, ConfigEntry showFlowDebug, ConfigEntry showUploadNotices, ConfigEntry ignoreSbglLobbyRequirement, ConfigEntry testPlayerOverrides, ConfigEntry testRandomizeAllPlayers, ManualLogSource bepinexLogger) { _showLogsConfig = showLogs; _showFlowDebugConfig = showFlowDebug; _showUploadNoticesConfig = showUploadNotices; _ignoreSbglLobbyRequirementConfig = ignoreSbglLobbyRequirement; _testPlayerOverridesConfig = testPlayerOverrides; _testRandomizeAllPlayersConfig = testRandomizeAllPlayers; _bepinexLogger = bepinexLogger; } private Dictionary GetTestPlayerOverrides(List currentPlayerNames = null) { if (_testRandomizeAllPlayersConfig != null && _testRandomizeAllPlayersConfig.Value && currentPlayerNames != null) { if (_randomizedPlayerMap == null || _randomizedPlayerMap.Count != currentPlayerNames.Count || !_randomizedPlayerMap.Keys.SequenceEqual(currentPlayerNames)) { List source = new List(_sbglTestNames); Random rand = new Random(); Dictionary dictionary = new Dictionary(StringComparer.OrdinalIgnoreCase); List list = source.OrderBy((string x) => rand.Next()).ToList(); int num = 0; foreach (string currentPlayerName in currentPlayerNames) { if (string.IsNullOrWhiteSpace(currentPlayerName)) { continue; } if (_userProfile != null && string.Equals(currentPlayerName, _userProfile.display_name, StringComparison.OrdinalIgnoreCase)) { dictionary[currentPlayerName] = currentPlayerName; continue; } if (num >= list.Count) { num = 0; } dictionary[currentPlayerName] = list[num++]; } _randomizedPlayerMap = dictionary; } return _randomizedPlayerMap; } Dictionary dictionary2 = new Dictionary(StringComparer.OrdinalIgnoreCase); string text = _testPlayerOverridesConfig?.Value; if (string.IsNullOrWhiteSpace(text)) { return dictionary2; } string[] array = text.Split(','); foreach (string text2 in array) { int num2 = text2.IndexOf('='); if (num2 > 0 && num2 < text2.Length - 1) { string text3 = text2.Substring(0, num2).Trim(); string value = text2.Substring(num2 + 1).Trim(); if (!string.IsNullOrWhiteSpace(text3) && !string.IsNullOrWhiteSpace(value)) { dictionary2[text3] = value; } } } return dictionary2; } private string ApplyTestPlayerOverride(string displayName, Dictionary overrides) { if (overrides != null && overrides.TryGetValue(displayName, out var value)) { Log("[Test Override] '" + displayName + "' → '" + value + "'"); return value; } return displayName; } public IEnumerator MatchmakingLoopCoroutine() { return MatchmakingLoop(); } public IEnumerator AcceptMatchCoroutine() { return AcceptMatch(); } public void InitiateHostSequencePublic() { InitiateHostSequence(); } [IteratorStateMachine(typeof(d__107))] public IEnumerator ClaimHostRoleCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__107(0) { <>4__this = this }; } private static bool IsProSeriesMatchType(string matchType) { return !string.IsNullOrWhiteSpace(matchType) && matchType.IndexOf("pro_series", StringComparison.OrdinalIgnoreCase) >= 0; } private static bool IsCasualMatchType(string matchType) { return !string.IsNullOrWhiteSpace(matchType) && matchType.IndexOf("casual", StringComparison.OrdinalIgnoreCase) >= 0; } private bool IsCurrentMatchCasual() { if (IsCasualMatchType(_currentSession?.match_type)) { return true; } return IsCasualMatchType(PlayerPrefs.GetString("MatchType", "")); } private string GetQueueMatchTypePayload() { string @string = PlayerPrefs.GetString("MatchType", "ranked_season_1"); return IsCasualMatchType(@string) ? "casual" : "ranked"; } [IteratorStateMachine(typeof(d__132))] private IEnumerator IncrementCasualMatchesPlayedForActivePlayers(List leaderboardPlayers) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__132(0) { <>4__this = this, leaderboardPlayers = leaderboardPlayers }; } private void Awake() { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) _solidBgTex = new Texture2D(1, 1); _solidBgTex.SetPixel(0, 0, new Color(0.02f, 0.02f, 0.02f, 1f)); _solidBgTex.Apply(); SceneManager.sceneLoaded += OnSceneLoaded; CourseManager.MatchStateChanged += OnCourseManagerMatchStateChanged; CourseManager.ForceDisplayScoreboardChanged += OnCourseManagerForceDisplayScoreboardChanged; new Harmony("com.sbgl.matchmaking").PatchAll(); Log("Plugin Loaded v6.2.1. Self-Sync Reconciliation Active."); _matchResultSubmission = new MatchResultSubmissionService(GetBaseApiUrl, Log, CallAPI, ParseApiSingleObject, delegate(IEnumerator coro) { ((MonoBehaviour)this).StartCoroutine(coro); }); UnifiedPlugin.ApiConfigChanged += OnApiConfigChanged; ((MonoBehaviour)this).StartCoroutine(BackgroundSyncLoop()); } private void OnApiConfigChanged() { Log("⚡ API Configuration changed - Switching environments and refreshing profile"); _userProfile = null; _isInitializing = true; _webStatus = "ENVIRONMENT SWITCHING..."; ResetPluginState(); } private void OnEnable() { try { SteamMatchmaking.OnLobbyCreated += OnLobbyCreatedCallback; } catch (Exception ex) { Log("Warning: Could not hook LobbyCreated event: " + ex.Message); } } private void OnDisable() { try { SteamMatchmaking.OnLobbyCreated -= OnLobbyCreatedCallback; } catch { } } private void OnLobbyCreatedCallback(Result result, Lobby lobby) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) if ((int)result != 1) { _lastUploadError = $"Lobby create callback failed: {result}"; Log($"Lobby creation failed: {result}"); return; } SteamId id = ((Lobby)(ref lobby)).Id; if (!((SteamId)(ref id)).IsValid) { _lastUploadError = "Lobby created callback had invalid lobby id."; Log("Lobby ID is invalid!"); } else { if (!_isHost || _currentSession == null) { return; } ulong value = ((Lobby)(ref lobby)).Id.Value; ulong num = 0uL; try { if (SteamClient.IsValid) { num = SteamClient.SteamId.Value; } } catch { } if (num != 0) { string text = $"steam://joinlobby/4069520/{value}/{num}"; _lobbyCreatedEventCount++; _lastLobbyCreatedAt = DateTime.Now; _lastGeneratedSteamLink = text; Log($"Lobby created! ID: {value}, uploading link..."); ((MonoBehaviour)this).StartCoroutine(UploadSteamLobbyLink(text)); } else { _lastUploadError = "Steam client invalid while trying to build host steam link."; Log("Lobby created but Steam ID could not be resolved."); } } } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { string text = ((Scene)(ref scene)).name.ToLower(); Log("[Scene] Loaded: " + ((Scene)(ref scene)).name + ""); string text2 = ResolveCurrentLobbyName(); bool flag = !string.IsNullOrEmpty(text2) && text2.StartsWith("SBGL-", StringComparison.OrdinalIgnoreCase); bool flag2 = IgnoreSbglLobbyRequirementEnabled || IsRankedTriggered || flag; if (!text.Contains("menu") && !text.Contains("drivingrange") && !text.Contains("driving range") && !text.Contains("lobby")) { _isInGameplay = true; if (_currentSession != null && string.Equals(_currentSession.status, "completed", StringComparison.OrdinalIgnoreCase)) { Log("[Match] Previous MatchmakingSession status was 'completed' — clearing session so new match can be created"); _currentSession = null; } if (flag2 && ((_currentSession != null && (_currentSession.status == "ready" || _currentSession.status == "in_progress")) || _currentSession == null) && !_matchEntriesCreated) { Log("[Match] Entering gameplay - validating match eligibility..."); ((MonoBehaviour)this).StartCoroutine(ValidateMatchUpload(delegate(bool shouldUpload) { if (shouldUpload) { Log("[Match] Creating match records..."); ((MonoBehaviour)this).StartCoroutine(CreateMatchAndEntries()); } else { Log("[Match] Match does not meet upload criteria at load - starting lobby rename monitor"); } })); } if (_monitorCoroutine == null) { _monitorCoroutine = ((MonoBehaviour)this).StartCoroutine(MonitorAndUpdateScores()); } if (_lobbyMonitorCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_lobbyMonitorCoroutine); } _lobbyMonitorCoroutine = ((MonoBehaviour)this).StartCoroutine(MonitorLobbyNameForUpload()); } if (_isInGameplay && (text.Contains("drivingrange") || text.Contains("driving range"))) { _isInGameplay = false; StopGameplayCoroutinesForMatchEnd("scene transition to driving range"); TryCaptureFinalLeaderboardSnapshot("scene transition"); } if (text.Contains("drivingrange") || text.Contains("driving range")) { if (!_matchStatsSubmitted && !string.IsNullOrEmpty(_currentMatchId)) { Log("[Match Stats] Returned to Driving Range - running final match finalization before reset..."); ((MonoBehaviour)this).StartCoroutine(FinalizeAndResetAfterDrivingRange()); } else { if (_matchStatsSubmitted && !string.IsNullOrWhiteSpace(_currentMatchId)) { _finalizedMatchIds.Add(_currentMatchId); } ResetPerMatchState(); } if (_isQueueing && !_hasAccepted) { Log("[Queue] Player entered Driving Range while queued - cancelling queue entry..."); ((MonoBehaviour)this).StartCoroutine(LeaveQueue()); } } if (text.Contains("menu")) { if (_isHost && _hostLobbyStarted && _hostServerWasActive && _currentSession != null) { ((MonoBehaviour)this).StartCoroutine(CancelSessionAsHost("host_returned_to_menu")); } ResetPluginState(); Log("Returned to Menu: State Reset."); } } private void OnCourseManagerMatchStateChanged(MatchState previousState, MatchState currentState) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (_isInGameplay) { Log($"[Match Signal] CourseManager.MatchStateChanged: {previousState} -> {currentState} (ignored for course-end)"); } } private void OnCourseManagerForceDisplayScoreboardChanged() { if (_isInGameplay && CourseManager.ForceDisplayScoreboard) { Log("[Match Signal] CourseManager forced the scoreboard (capture-only)"); if (_matchScreenshotSignalCoroutine == null && !_matchScreenshotUploadCompleted) { _matchScreenshotSignalCoroutine = ((MonoBehaviour)this).StartCoroutine(CaptureAndStorePerHoleScreenshot("CourseManager.ForceDisplayScoreboardChanged")); } } } [IteratorStateMachine(typeof(d__141))] private IEnumerator CaptureAndStorePerHoleScreenshot(string source) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__141(0) { <>4__this = this, source = source }; } [IteratorStateMachine(typeof(d__142))] private IEnumerator CaptureAndUploadScreenshotFromForcedScoreboard(string source) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__142(0) { <>4__this = this, source = source }; } private void TryBeginAssemblyDrivenFinalization(string source) { if (_endOfMatchSignalCoroutine == null && !_matchStatsSubmitted && !string.IsNullOrWhiteSpace(_currentMatchId)) { _endOfMatchSignalCoroutine = ((MonoBehaviour)this).StartCoroutine(FinalizeFromGameplaySignal(source)); } } [IteratorStateMachine(typeof(d__144))] private IEnumerator FinalizeFromGameplaySignal(string source) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__144(0) { <>4__this = this, source = source }; } private void StopGameplayCoroutinesForMatchEnd(string source) { if (_monitorCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_monitorCoroutine); _monitorCoroutine = null; Log("[Match] Score monitoring stopped (" + source + ")"); } if (_lobbyMonitorCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_lobbyMonitorCoroutine); _lobbyMonitorCoroutine = null; } } private bool TryCaptureFinalLeaderboardSnapshot(string source) { try { LiveLeaderboardPlugin liveLeaderboardPlugin = Object.FindAnyObjectByType((FindObjectsInactive)1); if ((Object)(object)liveLeaderboardPlugin == (Object)null) { return _finalLeaderboardSnapshot != null && _finalLeaderboardSnapshot.Count > 0; } liveLeaderboardPlugin.CaptureLeaderboardSnapshot(); CacheLeaderboardSnapshot(liveLeaderboardPlugin.GetFinalLeaderboardSnapshot(), source); if (_finalLeaderboardSnapshot != null && _finalLeaderboardSnapshot.Count > 0) { Log("[Match] ✓ Leaderboard snapshot captured from " + source + ""); return true; } } catch (Exception ex) { Log("[Match] Could not capture " + source + " snapshot: " + ex.Message + ""); } return _finalLeaderboardSnapshot != null && _finalLeaderboardSnapshot.Count > 0; } [IteratorStateMachine(typeof(d__147))] private IEnumerator CaptureMatchScreenshotForReview(string source) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__147(0) { <>4__this = this, source = source }; } [IteratorStateMachine(typeof(d__148))] private IEnumerator UploadCapturedMatchScreenshotIfNeeded(string source) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__148(0) { <>4__this = this, source = source }; } [IteratorStateMachine(typeof(d__149))] private IEnumerator UploadMatchScreenshotFile(Action onUploaded) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__149(0) { <>4__this = this, onUploaded = onUploaded }; } private string BuildMatchScreenshotFileName() { string text = ((!string.IsNullOrWhiteSpace(_currentMatchId)) ? _currentMatchId : DateTime.UtcNow.ToString("yyyyMMddHHmmss")); return "match-" + text + ".jpg"; } private string GetCoreIntegrationEndpointUrl(string functionName) { string baseApiUrl = GetBaseApiUrl(); int num = baseApiUrl.LastIndexOf("/entities", StringComparison.OrdinalIgnoreCase); string text = ((num >= 0) ? baseApiUrl.Substring(0, num) : baseApiUrl); return text + "/integration-endpoints/Core/" + functionName; } private void ApplyIntegrationHeaders(UnityWebRequest req) { if (req != null) { string authToken = GetAuthToken(); if (!string.IsNullOrWhiteSpace(authToken)) { req.SetRequestHeader("api_key", authToken); } req.SetRequestHeader("X-App-Id", GetAppId()); } } private void ClearPendingMatchScreenshot() { _pendingMatchScreenshotBytes = null; _pendingMatchScreenshotFileName = null; _pendingUploadedScreenshotUrl = null; } public void OnCourseRpcInformEndingCourse() { try { if (_courseEndRpcCoroutine == null) { _courseEndRpcCoroutine = ((MonoBehaviour)this).StartCoroutine(HandleCourseEndRpcCoroutine()); } } catch (Exception ex) { Log("[Match Signal] Error starting CourseEnd RPC handler: " + ex.Message + ""); } } [IteratorStateMachine(typeof(d__155))] private IEnumerator HandleCourseEndRpcCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__155(0) { <>4__this = this }; } private float GetCurrentPlayerScreenshotUploadDelaySeconds() { if (_currentSession?.player_ids == null || string.IsNullOrWhiteSpace(_userProfile?.id)) { return 0f; } List list = _currentSession.player_ids.Where((string id) => !string.IsNullOrWhiteSpace(id)).Distinct(StringComparer.Ordinal).OrderBy((string id) => id, StringComparer.Ordinal) .ToList(); if (list.Count == 0) { return 0f; } int num = list.FindIndex((string id) => string.Equals(id, _userProfile.id, StringComparison.Ordinal)); if (num <= 0) { return 0f; } float num2 = (float)num * 0.5f; Log($"[Match Screenshot] Upload slot {num + 1}/{list.Count}; waiting {num2:0.#}s before checking Match.screenshot_url"); return num2; } private Texture2D ResizeTextureToFit(Texture2D source, int maxWidth, int maxHeight) { //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_00da: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)source == (Object)null || ((Texture)source).width <= 0 || ((Texture)source).height <= 0) { return source; } if (((Texture)source).width <= maxWidth && ((Texture)source).height <= maxHeight) { return source; } float num = Mathf.Min((float)maxWidth / (float)((Texture)source).width, (float)maxHeight / (float)((Texture)source).height); int num2 = Mathf.Max(1, Mathf.RoundToInt((float)((Texture)source).width * num)); int num3 = Mathf.Max(1, Mathf.RoundToInt((float)((Texture)source).height * num)); RenderTexture active = RenderTexture.active; RenderTexture temporary = RenderTexture.GetTemporary(num2, num3, 0, (RenderTextureFormat)0); try { Graphics.Blit((Texture)(object)source, temporary); RenderTexture.active = temporary; Texture2D val = new Texture2D(num2, num3, (TextureFormat)3, false); val.ReadPixels(new Rect(0f, 0f, (float)num2, (float)num3), 0, 0, false); val.Apply(false, false); return val; } finally { RenderTexture.active = active; RenderTexture.ReleaseTemporary(temporary); } } private byte[] EncodeScreenshotBytes(Texture2D texture) { if ((Object)(object)texture == (Object)null) { return null; } byte[] array = null; int[] array2 = new int[5] { 90, 80, 70, 60, 50 }; int[] array3 = array2; foreach (int num in array3) { byte[] array4 = ImageConversion.EncodeToJPG(texture, num); if (array4 != null && array4.Length != 0) { array = array4; if (array4.Length <= 819200) { return array4; } } } if (array != null && array.Length <= 1048576) { return array; } if (array != null) { Log($"[Match Screenshot] Best JPEG was still too large ({(float)array.Length / 1024f:0.#} KB) - skipping screenshot upload"); } return null; } [IteratorStateMachine(typeof(d__160))] private IEnumerator CheckAndSubmitMatchStats() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__160(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__161))] private IEnumerator ResolveExistingMatchIdForCurrentSession(Action onResolved, bool logMisses = true) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__161(0) { <>4__this = this, onResolved = onResolved, logMisses = logMisses }; } private JObject SelectNewestReusableMatch(IEnumerable matches) { return (from match in matches?.Where((JObject match) => match != null).Where(delegate(JObject match) { string text = (string)match["id"]; return !string.IsNullOrWhiteSpace(text) && !_finalizedMatchIds.Contains(text); }) orderby ParseApiTimestamp((string)match["created_date"]) descending select match).FirstOrDefault(); } private static DateTime ParseApiTimestamp(string value) { if (DateTime.TryParse(value, null, DateTimeStyles.RoundtripKind, out var result)) { return result; } return DateTime.MinValue; } private float GetCurrentPlayerMatchUploadDelaySeconds() { if (_currentSession?.player_ids == null || string.IsNullOrWhiteSpace(_userProfile?.id)) { return 0f; } List list = _currentSession.player_ids.Where((string id) => !string.IsNullOrWhiteSpace(id)).Distinct(StringComparer.Ordinal).OrderBy((string id) => id, StringComparer.Ordinal) .ToList(); if (list.Count == 0) { return 0f; } int num = list.FindIndex((string id) => string.Equals(id, _userProfile.id, StringComparison.Ordinal)); if (num <= 0) { return 0f; } float num2 = (float)num * 2f; Log($"[Match Creation] Fallback upload slot {num + 1}/{list.Count}; waiting {num2:0.#}s before POST"); return num2; } [IteratorStateMachine(typeof(d__165))] private IEnumerator WaitForExistingMatchBeforeFallback(float delaySeconds, Action onResolved) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__165(0) { <>4__this = this, delaySeconds = delaySeconds, onResolved = onResolved }; } private string BuildStableManualLocalSessionId() { string currentSteamLobbyId = CompetitivePluginCheck.GetCurrentSteamLobbyId(); if (!string.IsNullOrWhiteSpace(currentSteamLobbyId)) { return "local-lobby-" + currentSteamLobbyId; } string text = ResolveCurrentLobbyName(); if (!string.IsNullOrWhiteSpace(text)) { string text2 = Regex.Replace(text.Trim(), "[^A-Za-z0-9_-]+", "-").Trim('-'); if (!string.IsNullOrWhiteSpace(text2)) { return "local-name-" + text2; } } return "local-manual"; } [IteratorStateMachine(typeof(d__167))] private IEnumerator ResolveExistingMatchEntryId(string matchId, string playerId, Action onResolved, bool logMisses = false) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__167(0) { <>4__this = this, matchId = matchId, playerId = playerId, onResolved = onResolved, logMisses = logMisses }; } [IteratorStateMachine(typeof(d__168))] private IEnumerator WaitForPendingMatchEntryCreation(string playerId, Action onResolved) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__168(0) { <>4__this = this, playerId = playerId, onResolved = onResolved }; } [IteratorStateMachine(typeof(d__169))] private IEnumerator EnsureMatchEntryForPlayer(string sourceTag, string playerId, string playerName, string preMatchMmr, string postMatchMmr, int gamePoints, int scoreVsPar, int finishPosition, string notes, Action onResolved) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__169(0) { <>4__this = this, sourceTag = sourceTag, playerId = playerId, playerName = playerName, preMatchMmr = preMatchMmr, postMatchMmr = postMatchMmr, gamePoints = gamePoints, scoreVsPar = scoreVsPar, finishPosition = finishPosition, notes = notes, onResolved = onResolved }; } [IteratorStateMachine(typeof(d__170))] private IEnumerator FinalizeAndResetAfterDrivingRange() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__170(0) { <>4__this = this }; } private void ResetPerMatchState() { if (_endOfMatchSignalCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_endOfMatchSignalCoroutine); _endOfMatchSignalCoroutine = null; } if (_matchScreenshotSignalCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_matchScreenshotSignalCoroutine); _matchScreenshotSignalCoroutine = null; } _currentMatchId = null; if (_currentSession != null) { _currentSession.match_id = null; } _playerMatchEntryIds.Clear(); _matchEntryCreationInProgress.Clear(); _playerIdsByName.Clear(); _lastSubmittedScores.Clear(); _lastSubmittedScoresVsPar.Clear(); _matchEntriesCreated = false; _matchStatsSubmitted = false; _proSeriesSkipLogged = false; _matchEndedReceived = false; ClearPendingMatchScreenshot(); _matchScreenshotUploadInProgress = false; _matchScreenshotUploadCompleted = false; _localManualSessionId = null; _cachedLeaderboardScores.Clear(); _cachedLeaderboardScoresVsPar.Clear(); _finalLeaderboardSnapshot.Clear(); MatchResultSubmissionService.ReceivedP2PMatchId = null; _lastUploadedPlayerCount = -1; Log("[Match] Per-match state reset - ready for new round"); } private void ResetPluginState() { if (_monitorCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_monitorCoroutine); _monitorCoroutine = null; } if (_endOfMatchSignalCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_endOfMatchSignalCoroutine); _endOfMatchSignalCoroutine = null; } if (_matchScreenshotSignalCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_matchScreenshotSignalCoroutine); _matchScreenshotSignalCoroutine = null; } IsRankedTriggered = false; _isQueueing = false; _webStatus = "IDLE"; _currentQueueId = ""; _currentSession = null; _isHost = false; _hasAccepted = false; _hostRulesetSelection = "ranked"; _queueStartTime = null; _hostLobbyStarted = false; _hostServerWasActive = false; _hostCancelSent = false; _matchStatsSubmitted = false; _proSeriesSkipLogged = false; _matchStartTime = null; _syncTickCount = 0; _lobbyCreatedEventCount = 0; _steamLinkUploadAttempts = 0; _steamLinkUploadSuccesses = 0; _steamLinkUploadFailures = 0; _autoJoinAttempts = 0; _autoJoinSuccesses = 0; _autoJoinFailures = 0; _lastLobbyCreatedAt = null; _lastUploadAttemptAt = null; _lastUploadSuccessAt = null; _lastAutoJoinAttemptAt = null; _lastAutoJoinSuccessAt = null; _lastGeneratedSteamLink = "-"; _lastUploadedSteamLink = "-"; _lastAutoJoinSteamLink = "-"; _lastUploadError = "-"; _lastAutoJoinError = "-"; if (_lobbyMonitorCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_lobbyMonitorCoroutine); _lobbyMonitorCoroutine = null; } _currentMatchId = null; _finalizedMatchIds.Clear(); _playerMatchEntryIds.Clear(); _matchEntryCreationInProgress.Clear(); _playerIdsByName.Clear(); _lastSubmittedScores.Clear(); _lastSubmittedScoresVsPar.Clear(); _matchCreationInProgress = false; _matchEntriesCreated = false; _isInGameplay = false; _matchEndedReceived = false; ClearPendingMatchScreenshot(); _matchScreenshotUploadInProgress = false; _matchScreenshotUploadCompleted = false; _localManualSessionId = null; _cachedLeaderboardScores.Clear(); _cachedLeaderboardScoresVsPar.Clear(); _finalLeaderboardSnapshot.Clear(); _lastUploadedPlayerCount = -1; _nextEnsureMatchCreateAttemptAt = 0f; } private void OnDestroy() { SceneManager.sceneLoaded -= OnSceneLoaded; CourseManager.MatchStateChanged -= OnCourseManagerMatchStateChanged; CourseManager.ForceDisplayScoreboardChanged -= OnCourseManagerForceDisplayScoreboardChanged; UnifiedPlugin.ApiConfigChanged -= OnApiConfigChanged; } private void OnApplicationQuit() { if (_isHost && _hostLobbyStarted && _hostServerWasActive && _currentSession != null) { ((MonoBehaviour)this).StartCoroutine(CancelSessionAsHost("host_application_quit")); } } private void Log(string msg) { string item = $"[{DateTime.Now:HH:mm:ss}] {msg}"; _debugLogs.Add(item); if (_debugLogs.Count > 30) { _debugLogs.RemoveAt(0); } _logScroll.y = float.MaxValue; if (_bepinexLogger != null) { string text = Regex.Replace(msg, "<[^>]+>", ""); _bepinexLogger.LogInfo((object)("[MatchmakingAssistant] " + text)); } } private bool TryUseSharedProfile(string logContext) { SharedPlayerProfile playerProfile = UnifiedPlugin.GetPlayerProfile(); if (playerProfile == null || !UnifiedPlugin.IsPlayerProfileResolved() || string.IsNullOrWhiteSpace(playerProfile.ID)) { return false; } _userProfile = new PlayerProfile { id = playerProfile.ID, display_name = playerProfile.DisplayName, current_mmr = playerProfile.CurrentMMR, region = playerProfile.Region, state_province = string.Empty }; Log("[" + logContext + "] ✓ Using shared profile: " + _userProfile.display_name + " (" + _userProfile.id + ")"); return true; } private string TryGetSteamPlayerName() { try { if (SteamClient.IsValid) { return SteamClient.Name; } } catch { } return string.Empty; } [IteratorStateMachine(typeof(d__178))] private IEnumerator EnsureUserProfileResolved(string logContext, float maxWaitSeconds = 0f) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__178(0) { <>4__this = this, logContext = logContext, maxWaitSeconds = maxWaitSeconds }; } [IteratorStateMachine(typeof(d__179))] private IEnumerator BackgroundSyncLoop() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__179(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__180))] private IEnumerator RefreshPlayerList() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__180(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__181))] private IEnumerator CheckExistingQueueEntry() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__181(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__182))] private IEnumerator MatchmakingLoop() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__182(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__183))] private IEnumerator LeaveQueue() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__183(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__184))] private IEnumerator CheckForMatch() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__184(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__185))] private IEnumerator PollSessionStatus() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__185(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__186))] private IEnumerator AcceptMatch() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__186(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__187))] private IEnumerator AutoJoinMatch() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__187(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__188))] private IEnumerator TransitionToReady() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__188(0) { <>4__this = this }; } private void StoreMatchConfigurationInPlayerPrefs(MatchmakingSession session) { try { if (session == null) { Log("[Config] Session is null, cannot store configuration"); return; } string matchType = session.match_type ?? string.Empty; bool flag = IsCasualMatchType(matchType); bool flag2 = IsProSeriesMatchType(matchType); string text = (flag ? "casual" : (flag2 ? "pro_series_season_1" : "ranked_season_1")); int num = ((!flag) ? ((session.season <= 0) ? 1 : session.season) : 0); string text2 = (flag ? "casual" : (flag2 ? "pro_series" : "ranked")); if (flag) { string text3 = ((!string.IsNullOrWhiteSpace(session.selected_course)) ? session.selected_course : PlayerPrefs.GetString("SelectedCourse", "")); PlayerPrefs.SetString("MatchType", text); if (!string.IsNullOrWhiteSpace(text3)) { PlayerPrefs.SetString("SelectedCourse", text3); } PlayerPrefs.SetInt("Season", num); PlayerPrefs.SetString("HostRuleset", text2); PlayerPrefs.Save(); Log(string.Format("[Config] Stored casual match configuration: Type={0}, Course={1}, Season={2}", text, string.IsNullOrWhiteSpace(text3) ? "manual" : text3, num)); return; } try { RuleSetManager.SetLogger(_bepinexLogger); string text4 = ((!string.IsNullOrEmpty(session.selected_course) && RuleSetManager.ValidateCourseForRanked(session.selected_course)) ? session.selected_course : MapPoolConfig.GetRandomApprovedCourse().Name); PlayerPrefs.SetString("MatchType", text); PlayerPrefs.SetString("SelectedCourse", text4); PlayerPrefs.SetInt("Season", num); PlayerPrefs.SetString("HostRuleset", text2); PlayerPrefs.Save(); Log($"[Config] Stored match configuration: Type={text}, Course={text4}, Season={num}"); RuleSetManager.LogMatchConfiguration(text, text4, num); } catch (Exception ex) { Log("[Config] Error during rule validation, storing fallback config: " + ex.Message + ""); PlayerPrefs.SetString("MatchType", text); PlayerPrefs.SetString("SelectedCourse", string.IsNullOrEmpty(session.selected_course) ? MapPoolConfig.GetRandomApprovedCourse().Name : session.selected_course); PlayerPrefs.SetInt("Season", num); PlayerPrefs.SetString("HostRuleset", text2); PlayerPrefs.Save(); } } catch (Exception ex2) { Log("[Config] Exception storing match configuration: " + ex2.Message + " | StackTrace: " + ex2.StackTrace + ""); } } private void ClearMatchConfigurationFromPlayerPrefs() { PlayerPrefs.DeleteKey("MatchType"); PlayerPrefs.DeleteKey("SelectedCourse"); PlayerPrefs.DeleteKey("Season"); PlayerPrefs.Save(); Log("[Config] Cleared match configuration from PlayerPrefs"); } private void InitiateHostSequence() { if (_currentSession == null) { return; } if (!_hasAccepted) { Log("[Host] Must accept match first before initializing lobby"); ((MonoBehaviour)this).StartCoroutine(AcceptMatch()); return; } string @string = PlayerPrefs.GetString("HostRuleset", ""); if (string.Equals(@string, "pro_series", StringComparison.OrdinalIgnoreCase)) { _hostRulesetSelection = "pro_series"; } else if (string.Equals(@string, "casual", StringComparison.OrdinalIgnoreCase)) { _hostRulesetSelection = "casual"; } else { _hostRulesetSelection = "ranked"; } MainMenu val = Object.FindAnyObjectByType(); if ((Object)(object)val != (Object)null) { IsRankedTriggered = true; _hostLobbyStarted = true; _hostServerWasActive = false; _hostCancelSent = false; _matchStartTime = DateTime.UtcNow; _matchStatsSubmitted = false; PlayerPrefs.SetString("LobbyName", _currentSession.lobby_name); PlayerPrefs.SetString("LobbyPassword", _currentSession.lobby_password); PlayerPrefs.SetString("HostRuleset", _hostRulesetSelection); PlayerPrefs.Save(); Log("Host ruleset stored: " + _hostRulesetSelection); val.StartHost(); Log("Host lobby initiated. Waiting for Steamworks lobby creation callback..."); ((MonoBehaviour)this).StartCoroutine(UpdateSessionStatus("in_progress")); } } [IteratorStateMachine(typeof(d__192))] private IEnumerator CancelSessionAsHost(string reason) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__192(0) { <>4__this = this, reason = reason }; } [IteratorStateMachine(typeof(d__193))] private IEnumerator UploadSteamLobbyLink(string steamLink) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__193(0) { <>4__this = this, steamLink = steamLink }; } [IteratorStateMachine(typeof(d__194))] private IEnumerator CreateMatchAndEntries() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__194(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__195))] private IEnumerator CreateMatchAndEntriesInternal() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__195(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__196))] private IEnumerator MonitorLobbyNameForUpload() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__196(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__197))] private IEnumerator MonitorAndUpdateScores() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__197(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__198))] private IEnumerator UpdateMatchEntry(string entryId, string playerId, string playerName, int gamePoints, int scoreVsPar, int finishPosition = 0, string postMatchMmr = null, string preMatchMmr = null) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__198(0) { <>4__this = this, entryId = entryId, playerId = playerId, playerName = playerName, gamePoints = gamePoints, scoreVsPar = scoreVsPar, finishPosition = finishPosition, postMatchMmr = postMatchMmr, preMatchMmr = preMatchMmr }; } private int GetPlayerFinishPosition(string playerName, List finalLeaderboard) { if (string.IsNullOrEmpty(playerName) || finalLeaderboard == null || finalLeaderboard.Count == 0) { return 0; } Dictionary dictionary = BuildFinishPositionMap(finalLeaderboard); if (dictionary.TryGetValue(playerName, out var value)) { return value; } return 0; } private int GetPlayerFinishPosition(string playerName, List finalLeaderboard) { if (string.IsNullOrEmpty(playerName) || finalLeaderboard == null || finalLeaderboard.Count == 0) { return 0; } for (int i = 0; i < finalLeaderboard.Count; i++) { if (finalLeaderboard[i] != null && string.Equals(finalLeaderboard[i].Name, playerName, StringComparison.OrdinalIgnoreCase)) { return i + 1; } } return 0; } private bool TryGetPlayerIdForName(string playerName, out string playerId) { playerId = null; if (string.IsNullOrWhiteSpace(playerName)) { return false; } string text = playerName.Trim(); if (_playerIdsByName.TryGetValue(text, out var value) && !string.IsNullOrWhiteSpace(value)) { playerId = value; return true; } if (_userProfile != null && string.Equals(text, _userProfile.display_name, StringComparison.OrdinalIgnoreCase)) { playerId = _userProfile.id; return !string.IsNullOrWhiteSpace(playerId); } return false; } [IteratorStateMachine(typeof(d__202))] private IEnumerator ResolvePlayerIdByNameFromApi(string playerName, Action onResolved) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__202(0) { <>4__this = this, playerName = playerName, onResolved = onResolved }; } [IteratorStateMachine(typeof(d__203))] private IEnumerator UpdateMatchPlayerCountIfNeeded(int actualPlayerCount, string source) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__203(0) { <>4__this = this, actualPlayerCount = actualPlayerCount, source = source }; } private void CacheLeaderboardSnapshot(List players, string source) { if (players == null || players.Count == 0) { return; } List list = (from player in players where player != null && !string.IsNullOrWhiteSpace(player.Name) select new CachedLeaderboardPlayer { Name = player.Name.Trim(), BaseScore = player.BaseScore, RawStrokes = (player.RawStrokes ?? string.Empty), MMR = player.MMR, ProjectedDelta = ParseProjectedMmrDelta(player.ProjectedDisplay) }).ToList(); if (list.Count != 0) { bool flag = SnapshotHasMeaningfulScores(list); bool flag2 = SnapshotHasMeaningfulScores(_finalLeaderboardSnapshot); if (!flag && flag2) { Log("[Match Snapshot] Ignoring zeroed " + source + " snapshot and keeping last in-game results"); } else { _finalLeaderboardSnapshot = list; } } } private bool SnapshotHasMeaningfulScores(List snapshot) { if (snapshot == null || snapshot.Count == 0) { return false; } foreach (CachedLeaderboardPlayer item in snapshot) { if (item != null) { if (item.BaseScore != 0) { return true; } if (ParseScoreVsPar(item.RawStrokes) != 0) { return true; } } } return false; } private int ParseScoreVsPar(string rawStrokes) { if (string.IsNullOrWhiteSpace(rawStrokes)) { return 0; } string s = rawStrokes.Replace("±", "").Trim(); int.TryParse(s, out var result); return result; } private int ParseProjectedMmrDelta(string projectedDisplay) { if (string.IsNullOrWhiteSpace(projectedDisplay)) { return 0; } Match match = Regex.Match(projectedDisplay, "\\(([+-]?\\d+)\\)"); if (match.Success && int.TryParse(match.Groups[1].Value, out var result)) { return result; } return 0; } private Dictionary BuildFinishPositionMap(List leaderboard) { Dictionary dictionary = new Dictionary(StringComparer.OrdinalIgnoreCase); if (leaderboard == null || leaderboard.Count == 0) { return dictionary; } var list = (from p in leaderboard where p != null && !string.IsNullOrWhiteSpace(p.Name) select new { Player = p, Stroke = ParseScoreVsPar(p.RawStrokes) } into x orderby x.Player.AdjustedPoints descending, x.Player.BaseScore descending, x.Stroke select x).ThenBy(x => x.Player.Name, StringComparer.OrdinalIgnoreCase).ToList(); int num = 1; foreach (var item in list) { if (!dictionary.ContainsKey(item.Player.Name)) { dictionary[item.Player.Name] = num++; } } return dictionary; } private Dictionary BuildFinishPositionMap(List leaderboard) { Dictionary dictionary = new Dictionary(StringComparer.OrdinalIgnoreCase); if (leaderboard == null || leaderboard.Count == 0) { return dictionary; } var list = (from p in leaderboard where p != null && !string.IsNullOrWhiteSpace(p.Name) select new { Player = p, Stroke = ParseScoreVsPar(p.RawStrokes), Adjusted = p.BaseScore + ParseScoreVsPar(p.RawStrokes) * -10 } into x orderby x.Adjusted descending, x.Player.BaseScore descending, x.Stroke select x).ThenBy(x => x.Player.Name, StringComparer.OrdinalIgnoreCase).ToList(); int num = 1; foreach (var item in list) { if (!dictionary.ContainsKey(item.Player.Name)) { dictionary[item.Player.Name] = num++; } } return dictionary; } [IteratorStateMachine(typeof(d__210))] private IEnumerator EnrichPlayerIdsFromLeaderboard(List startingLeaderboard, List playerIds) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__210(0) { <>4__this = this, startingLeaderboard = startingLeaderboard, playerIds = playerIds }; } [IteratorStateMachine(typeof(d__211))] private IEnumerator FinalizeMatchStats() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__211(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__212))] private IEnumerator CreatePlaceholderMatchEntryForMissingSessionPlayer(string playerId) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__212(0) { <>4__this = this, playerId = playerId }; } [IteratorStateMachine(typeof(d__213))] private IEnumerator SubmitMatchStats() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__213(0) { <>4__this = this }; } private MatchStats CollectMatchStats(float duration) { try { string text = ((_currentSession != null) ? _currentSession.id : (_localManualSessionId ?? "local-manual-session")); return new MatchStats { matchmaking_session_id = text, match_id = text, player_id = _userProfile.id, player_name = _userProfile.display_name, match_date = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss.fffZ"), duration_seconds = (int)duration, is_host = _isHost, status = "completed" }; } catch (Exception ex) { Log("[Match Stats] Error collecting stats: " + ex.Message + ""); return null; } } [IteratorStateMachine(typeof(d__215))] private IEnumerator FetchActiveSeasonId() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__215(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__216))] private IEnumerator SubmitMatchEntry(MatchStats stats, Action onMatchIdReceived) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__216(0) { <>4__this = this, stats = stats, onMatchIdReceived = onMatchIdReceived }; } [IteratorStateMachine(typeof(d__217))] private IEnumerator SubmitMatchEntryForPlayer(string matchId, string playerId) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__217(0) { <>4__this = this, matchId = matchId, playerId = playerId }; } private void OnGUI() { //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_0074: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_00c0: Expected O, but got Unknown //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_06fd: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_0774: Unknown result type (might be due to invalid IL or missing references) //IL_07b2: Unknown result type (might be due to invalid IL or missing references) //IL_07fb: Unknown result type (might be due to invalid IL or missing references) //IL_074a: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_05a4: Unknown result type (might be due to invalid IL or missing references) //IL_05c7: Unknown result type (might be due to invalid IL or missing references) //IL_0a56: Unknown result type (might be due to invalid IL or missing references) //IL_0aa4: Unknown result type (might be due to invalid IL or missing references) //IL_0ad2: Unknown result type (might be due to invalid IL or missing references) //IL_0b2c: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_04ea: Unknown result type (might be due to invalid IL or missing references) //IL_04cf: Unknown result type (might be due to invalid IL or missing references) //IL_0d61: Unknown result type (might be due to invalid IL or missing references) //IL_0d8d: Unknown result type (might be due to invalid IL or missing references) //IL_0d93: Unknown result type (might be due to invalid IL or missing references) //IL_0db8: Unknown result type (might be due to invalid IL or missing references) //IL_0dbd: Unknown result type (might be due to invalid IL or missing references) //IL_0dc2: Unknown result type (might be due to invalid IL or missing references) //IL_08a9: Unknown result type (might be due to invalid IL or missing references) //IL_08de: Unknown result type (might be due to invalid IL or missing references) //IL_090d: Unknown result type (might be due to invalid IL or missing references) //IL_094c: Unknown result type (might be due to invalid IL or missing references) //IL_0981: Unknown result type (might be due to invalid IL or missing references) //IL_09c0: Unknown result type (might be due to invalid IL or missing references) //IL_09f5: Unknown result type (might be due to invalid IL or missing references) //IL_0508: Unknown result type (might be due to invalid IL or missing references) //IL_0de2: Unknown result type (might be due to invalid IL or missing references) //IL_0632: Unknown result type (might be due to invalid IL or missing references) //IL_0655: Unknown result type (might be due to invalid IL or missing references) //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_052e: Unknown result type (might be due to invalid IL or missing references) //IL_0b9e: Unknown result type (might be due to invalid IL or missing references) //IL_056a: Unknown result type (might be due to invalid IL or missing references) //IL_0c01: Unknown result type (might be due to invalid IL or missing references) //IL_0c5b: Unknown result type (might be due to invalid IL or missing references) //IL_0cb5: Unknown result type (might be due to invalid IL or missing references) //IL_0cfc: Unknown result type (might be due to invalid IL or missing references) try { Scene activeScene = SceneManager.GetActiveScene(); bool flag = ((Scene)(ref activeScene)).name.ToLower().Contains("menu"); DrawUploadNotification(); DrawLiveUploadDebugOverlay(); if (!flag) { return; } if (_centerLabelStyle == null) { _centerLabelStyle = (((Object)(object)GUI.skin != (Object)null) ? new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4 } : new GUIStyle { alignment = (TextAnchor)4 }); } if (_debugLineStyle == null) { _debugLineStyle = (((Object)(object)GUI.skin != (Object)null) ? new GUIStyle(GUI.skin.label) : new GUIStyle()); _debugLineStyle.alignment = (TextAnchor)3; _debugLineStyle.fontSize = 10; _debugLineStyle.wordWrap = false; _debugLineStyle.clipping = (TextClipping)1; _debugLineStyle.richText = false; } float num = 350f; float num2 = (float)Screen.width - num - 30f; ConfigEntry showLogsConfig = _showLogsConfig; float num3 = ((showLogsConfig != null && showLogsConfig.Value) ? 340f : 230f); ConfigEntry showFlowDebugConfig = _showFlowDebugConfig; if (showFlowDebugConfig != null && showFlowDebugConfig.Value) { num3 += 145f; } GUI.DrawTexture(new Rect(num2, 20f, num, num3), (Texture)(object)_solidBgTex); GUI.Box(new Rect(num2, 20f, num, num3), "SBGL MATCH MAKING ASSISTANT"); if (_currentSession != null) { if (_currentSession.status == "pending_accept") { GUI.backgroundColor = (_hasAccepted ? Color.gray : Color.yellow); if (GUI.Button(new Rect(num2 + 10f, 50f, num - 20f, 50f), _hasAccepted ? "WAITING FOR OTHERS..." : "ACCEPT MATCH") && !_hasAccepted) { ((MonoBehaviour)this).StartCoroutine(AcceptMatch()); } } else if (_currentSession.status == "ready") { if (_isHost) { GUI.backgroundColor = Color.cyan; if (GUI.Button(new Rect(num2 + 10f, 50f, num - 20f, 50f), "INITIALIZE HOST")) { InitiateHostSequence(); } } else if (_hasAccepted && !string.IsNullOrEmpty(_currentSession.steam_lobby_link)) { GUI.backgroundColor = Color.green; GUI.enabled = false; GUI.Button(new Rect(num2 + 10f, 50f, num - 20f, 50f), "AUTO-JOINING..."); GUI.enabled = true; } else if (!_hasAccepted) { GUI.backgroundColor = Color.yellow; if (GUI.Button(new Rect(num2 + 10f, 50f, num - 20f, 50f), "ACCEPT & JOIN")) { ((MonoBehaviour)this).StartCoroutine(AcceptMatch()); } } else { GUI.backgroundColor = Color.gray; GUI.enabled = false; GUI.Button(new Rect(num2 + 10f, 50f, num - 20f, 50f), "JOINING..."); GUI.enabled = true; } } } else { bool enabled = !_isInitializing && _userProfile != null; if (_isQueueing) { GUI.enabled = enabled; GUI.backgroundColor = new Color(0.8f, 0.1f, 0.1f, 1f); if (GUI.Button(new Rect(num2 + 10f, 50f, num - 20f, 50f), "LEAVE QUEUE")) { ((MonoBehaviour)this).StartCoroutine(LeaveQueue()); } GUI.enabled = true; } else { bool flag2 = (Object)(object)UnifiedPlugin.Instance != (Object)null && string.Equals(UnifiedPlugin.Instance.API_Environment?.Value, "PreProd", StringComparison.OrdinalIgnoreCase); if (!flag2) { _queueTypeSelection = "ranked"; } float num4 = (num - 22f) / 2f; bool flag3 = _queueTypeSelection != "casual"; GUI.enabled = enabled; if (flag2) { GUI.backgroundColor = (Color)(flag3 ? new Color(0.1f, 0.4f, 0.9f, 1f) : Color.gray); if (GUI.Button(new Rect(num2 + 10f, 50f, num4, 23f), "RANKED")) { _queueTypeSelection = "ranked"; } GUI.backgroundColor = (Color)((!flag3) ? new Color(0.6f, 0.3f, 0.8f, 1f) : Color.gray); if (GUI.Button(new Rect(num2 + 12f + num4, 50f, num4, 23f), "CASUAL")) { _queueTypeSelection = "casual"; } } else { GUI.backgroundColor = new Color(0.1f, 0.4f, 0.9f, 1f); if (GUI.Button(new Rect(num2 + 10f, 50f, num - 20f, 23f), "RANKED")) { _queueTypeSelection = "ranked"; } } string text = (_isInitializing ? "SYNCING WITH SERVER..." : ((_userProfile != null) ? "JOIN QUEUE" : "RESOLVING PROFILE...")); GUI.backgroundColor = new Color(0.1f, 0.6f, 0.1f, 1f); if (GUI.Button(new Rect(num2 + 10f, 76f, num - 20f, 32f), text)) { if (_queueTypeSelection == "casual") { PlayerPrefs.SetString("MatchType", "casual"); PlayerPrefs.SetString("HostRuleset", "casual"); } else { PlayerPrefs.SetString("MatchType", "ranked_season_1"); PlayerPrefs.SetString("HostRuleset", "ranked"); } ((MonoBehaviour)this).StartCoroutine(MatchmakingLoop()); } GUI.enabled = true; } } float num5 = 0f; GUI.Box(new Rect(num2 + 10f, 110f + num5, num - 20f, 100f), ""); if (_userProfile != null) { if (Object.op_Implicit((Object)(object)_profileTexture)) { GUI.DrawTexture(new Rect(num2 + 20f, 120f + num5, 40f, 40f), (Texture)(object)_profileTexture); } GUI.Label(new Rect(num2 + 70f, 120f + num5, 240f, 20f), "User: " + _userProfile.display_name + ""); GUI.Label(new Rect(num2 + 70f, 135f + num5, 240f, 20f), "" + _webStatus + ""); float num6 = 160f + num5; float num7 = (num - 40f) / 4f; GUI.Label(new Rect(num2 + 20f, num6, num7, 20f), "TIME", _centerLabelStyle); string text2 = "00:00"; if (_isQueueing && _queueStartTime.HasValue) { TimeSpan timeSpan = DateTime.UtcNow - _queueStartTime.Value.ToUniversalTime(); text2 = ((timeSpan.TotalSeconds < 0.0) ? "00:00" : $"{timeSpan.Minutes:00}:{timeSpan.Seconds:00}"); } GUI.Label(new Rect(num2 + 20f, num6 + 15f, num7, 25f), "" + text2 + "", _centerLabelStyle); GUI.Label(new Rect(num2 + 20f + num7, num6, num7, 20f), "QUEUED", _centerLabelStyle); GUI.Label(new Rect(num2 + 20f + num7, num6 + 15f, num7, 25f), $"{_queuedCount}", _centerLabelStyle); GUI.Label(new Rect(num2 + 20f + num7 * 2f, num6, num7, 20f), "MATCHED", _centerLabelStyle); GUI.Label(new Rect(num2 + 20f + num7 * 2f, num6 + 15f, num7, 25f), $"{_matchedCount}", _centerLabelStyle); GUI.Label(new Rect(num2 + 20f + num7 * 3f, num6, num7, 20f), "YOUR MMR", _centerLabelStyle); GUI.Label(new Rect(num2 + 20f + num7 * 3f, num6 + 15f, num7, 25f), $"{_userProfile.current_mmr}", _centerLabelStyle); } float num8 = 215f + num5; ConfigEntry showFlowDebugConfig2 = _showFlowDebugConfig; if (showFlowDebugConfig2 != null && showFlowDebugConfig2.Value) { GUI.Label(new Rect(num2 + 15f, num8, num, 20f), "FLOW DIAGNOSTICS (TEMP)"); num8 += 18f; float num9 = 14f; float num10 = 6f; int num11 = 7; float num12 = num10 + (float)num11 * num9 + 6f; GUI.Box(new Rect(num2 + 10f, num8, num - 20f, num12), ""); GUI.Label(new Rect(num2 + 16f, num8 + num10 + 0f * num9, num - 30f, num9), $"sync_tick={_syncTickCount} host={_isHost} accepted={_hasAccepted}", _debugLineStyle); GUI.Label(new Rect(num2 + 16f, num8 + num10 + 1f * num9, num - 30f, num9), "session=" + ((_currentSession != null) ? _currentSession.id : "none") + " status=" + ((_currentSession != null) ? _currentSession.status : "none"), _debugLineStyle); GUI.Label(new Rect(num2 + 16f, num8 + num10 + 2f * num9, num - 30f, num9), $"lobby_events={_lobbyCreatedEventCount} link_present={!string.IsNullOrEmpty(_currentSession?.steam_lobby_link)}", _debugLineStyle); GUI.Label(new Rect(num2 + 16f, num8 + num10 + 3f * num9, num - 30f, num9), $"upload a/s/f={_steamLinkUploadAttempts}/{_steamLinkUploadSuccesses}/{_steamLinkUploadFailures}", _debugLineStyle); GUI.Label(new Rect(num2 + 16f, num8 + num10 + 4f * num9, num - 30f, num9), $"autojoin a/s/f={_autoJoinAttempts}/{_autoJoinSuccesses}/{_autoJoinFailures}", _debugLineStyle); GUI.Label(new Rect(num2 + 16f, num8 + num10 + 5f * num9, num - 30f, num9), "last_upload_err=" + Truncate(_lastUploadError, 42), _debugLineStyle); GUI.Label(new Rect(num2 + 16f, num8 + num10 + 6f * num9, num - 30f, num9), "last_join_err=" + Truncate(_lastAutoJoinError, 42), _debugLineStyle); num8 += num12 + 5f; } if (_showLogsConfig.Value) { float num13 = num8 + 5f; GUI.Label(new Rect(num2 + 15f, num13, num, 25f), "SYSTEM LOGS:"); _logScroll = GUI.BeginScrollView(new Rect(num2 + 10f, num13 + 25f, num - 20f, 70f), _logScroll, new Rect(0f, 0f, num - 40f, (float)(_debugLogs.Count * 20))); for (int i = 0; i < _debugLogs.Count; i++) { GUI.Label(new Rect(5f, (float)(i * 20), 300f, 20f), "" + _debugLogs[i] + ""); } GUI.EndScrollView(); } } catch (Exception ex) { Log("[CRITICAL] Exception in OnGUI: " + ex.Message + " | StackTrace: " + ex.StackTrace + ""); } } private void DrawUploadNotification() { //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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_0107: Expected O, but got Unknown //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(_uploadNotification)) { return; } float num = (float)(DateTime.UtcNow - _uploadNotificationTime).TotalSeconds; if (num >= 4f) { _uploadNotification = ""; return; } float num2 = 1f; if (num > 3f) { num2 = Mathf.Lerp(1f, 0f, (num - 3f) / 1f); } float num3 = 500f; float num4 = 50f; float num5 = ((float)Screen.width - num3) / 2f; float num6 = (float)Screen.height - 100f; GUI.color = new Color(1f, 1f, 1f, num2); GUI.Box(new Rect(num5, num6, num3, num4), ""); GUIStyle val = (((Object)(object)GUI.skin != (Object)null) ? new GUIStyle(GUI.skin.label) : new GUIStyle()); val.alignment = (TextAnchor)4; val.fontSize = 14; val.richText = true; string text = ColorUtility.ToHtmlStringRGB(_uploadNotificationColor); GUI.Label(new Rect(num5, num6 + 10f, num3, 30f), "" + _uploadNotification + "", val); GUI.color = Color.white; } private void DrawLiveUploadDebugOverlay() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) ConfigEntry showFlowDebugConfig = _showFlowDebugConfig; if (showFlowDebugConfig != null && showFlowDebugConfig.Value) { float num = 860f; float num2 = 62f; float num3 = ((float)Screen.width - num) / 2f; float num4 = (float)Screen.height - 170f; GUIStyle val = (((Object)(object)GUI.skin != (Object)null) ? new GUIStyle(GUI.skin.label) : new GUIStyle()); val.alignment = (TextAnchor)3; val.fontSize = 11; val.richText = true; GUI.Box(new Rect(num3, num4, num, num2), ""); string text = "LobbySources s='" + Truncate(_debugLobbySessionSource, 24) + "' p='" + Truncate(_debugLobbyPrefsSource, 24) + "' c='" + Truncate(_debugLobbyCapturedSource, 24) + "'"; string text2 = "LobbyResolved '" + Truncate(_debugLobbyResolved, 40) + "' via=" + _debugLobbyResolvedBy + " | SessionType='" + Truncate(_currentSession?.match_type ?? "", 24) + "' MatchType='" + Truncate(PlayerPrefs.GetString("MatchType", ""), 24) + "' HostRuleset='" + Truncate(PlayerPrefs.GetString("HostRuleset", ""), 14) + "'"; GUI.Label(new Rect(num3 + 10f, num4 + 7f, num - 20f, 20f), text, val); GUI.Label(new Rect(num3 + 10f, num4 + 29f, num - 20f, 20f), text2, val); } } public async void JoinBySteamLink(string steamLink, string password) { if (string.IsNullOrEmpty(steamLink)) { return; } PlayerPrefs.SetString("LobbyPassword", password); PlayerPrefs.Save(); Log("Password '" + password + "' cached for join."); try { string[] parts = steamLink.Split('/'); if (parts.Length < 5 || !ulong.TryParse(parts[4], out var lobbyId)) { Log("Invalid Steam Link"); return; } Log($"Joining Steam Lobby: {lobbyId}..."); Lobby lobby = new Lobby(SteamId.op_Implicit(lobbyId)); RoomEnter result = await ((Lobby)(ref lobby)).Join(); if ((int)result == 1) { NetworkManager manager = NetworkManager.singleton; manager.networkAddress = lobbyId.ToString(); await Task.Delay(200); manager.StartClient(); _autoJoinSuccesses++; _lastAutoJoinSuccessAt = DateTime.Now; _lastAutoJoinError = "-"; Log("Client started via Steam Link."); } else { _autoJoinFailures++; _lastAutoJoinError = $"Steam room enter failure: {result}"; Log($"Steam Join Failed: {result}"); } } catch (Exception ex) { _autoJoinFailures++; _lastAutoJoinError = ex.Message; Log("Join Error: " + ex.Message); } } [IteratorStateMachine(typeof(d__222))] private IEnumerator UpdateSessionStatus(string status) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__222(0) { <>4__this = this, status = status }; } [IteratorStateMachine(typeof(d__223))] private IEnumerator CallAPI(string endpoint, string method, string json, Action onSuccess) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__223(0) { <>4__this = this, endpoint = endpoint, method = method, json = json, onSuccess = onSuccess }; } private void ApplyApiHeaders(UnityWebRequest req) { if (req != null) { req.SetRequestHeader("Content-Type", "application/json"); req.SetRequestHeader("api_key", GetAuthToken()); req.SetRequestHeader("X-App-Id", GetAppId()); } } [IteratorStateMachine(typeof(d__225))] private IEnumerator ResolveProfile(string steamName) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__225(0) { <>4__this = this, steamName = steamName }; } private List ParseApiObjectList(string rawJson) { if (string.IsNullOrEmpty(rawJson)) { return new List(); } try { JToken val = JToken.Parse(rawJson); JArray val2 = (JArray)(object)((val is JArray) ? val : null); if (val2 != null) { return ((IEnumerable)val2).OfType().ToList(); } JObject val3 = (JObject)(object)((val is JObject) ? val : null); if (val3 != null) { return new List { val3 }; } } catch (Exception ex) { Log("JSON parse warning (list): " + ex.Message + ""); } return new List(); } private JObject ParseApiSingleObject(string rawJson) { if (string.IsNullOrEmpty(rawJson)) { return null; } try { JToken val = JToken.Parse(rawJson); JObject val2 = (JObject)(object)((val is JObject) ? val : null); if (val2 != null) { return val2; } JArray val3 = (JArray)(object)((val is JArray) ? val : null); if (val3 != null) { return ((IEnumerable)val3).OfType().FirstOrDefault(); } } catch (Exception ex) { Log("JSON parse warning (single): " + ex.Message + ""); } return null; } [IteratorStateMachine(typeof(d__228))] private IEnumerator DownloadProfilePic(string url) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__228(0) { <>4__this = this, url = url }; } private void PlayMatchFoundAlert() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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) try { RuntimeManager.PlayOneShot(GameManager.AudioSettings.AnnouncerMainMenuTitle, default(Vector3)); Log("[Alert] ♪ Match found alert played via FMOD AnnouncerMainMenuTitle"); } catch (Exception ex) { Log("[Alert] Could not play match alert: " + ex.Message + ""); } } private string Truncate(string value, int maxLength) { if (string.IsNullOrEmpty(value)) { return "-"; } return (value.Length <= maxLength) ? value : (value.Substring(0, maxLength) + "..."); } [IteratorStateMachine(typeof(d__231))] private IEnumerator ValidateMatchUpload(Action callback) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__231(0) { <>4__this = this, callback = callback }; } private void ShowUploadNotification(string message, string level = "info") { //IL_0073: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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) if (_showUploadNoticesConfig == null || _showUploadNoticesConfig.Value) { _uploadNotification = message; _uploadNotificationTime = DateTime.UtcNow; switch (level) { case "success": _uploadNotificationColor = new Color(0.3f, 0.95f, 0.4f); break; case "failure": _uploadNotificationColor = new Color(1f, 0.45f, 0.45f); break; case "warning": _uploadNotificationColor = new Color(1f, 0.75f, 0.35f); break; default: _uploadNotificationColor = new Color(0.2f, 0.85f, 1f); break; } Log("[Upload Notification] " + message + ""); } } private string ResolveCurrentLobbyName() { string text = NormalizeLobbyName(_currentSession?.lobby_name); string text2 = NormalizeLobbyName(PlayerPrefs.GetString("LobbyName", "")); string text3 = NormalizeLobbyName(CompetitivePluginCheck._currentLobbyName); _debugLobbySessionSource = text; _debugLobbyPrefsSource = text2; _debugLobbyCapturedSource = text3; Log("[LobbyName] Sources: session='" + text + "', prefs='" + text2 + "', captured='" + text3 + "'"); if (IsSbglLobbyName(text3)) { _debugLobbyResolved = text3; _debugLobbyResolvedBy = "captured(sbgl)"; return text3; } if (IsSbglLobbyName(text)) { _debugLobbyResolved = text; _debugLobbyResolvedBy = "session(sbgl)"; return text; } if (IsSbglLobbyName(text2)) { _debugLobbyResolved = text2; _debugLobbyResolvedBy = "prefs(sbgl)"; return text2; } if (!string.IsNullOrEmpty(text3)) { _debugLobbyResolved = text3; _debugLobbyResolvedBy = "captured"; return text3; } if (!string.IsNullOrEmpty(text)) { _debugLobbyResolved = text; _debugLobbyResolvedBy = "session"; return text; } if (!string.IsNullOrEmpty(text2)) { _debugLobbyResolved = text2; _debugLobbyResolvedBy = "prefs"; return text2; } _debugLobbyResolved = ""; _debugLobbyResolvedBy = "none"; return ""; } private static string NormalizeLobbyName(string value) { if (string.IsNullOrWhiteSpace(value)) { return string.Empty; } return Regex.Replace(value, "<.*?>", string.Empty).Replace("\u200b", string.Empty).Trim(); } private static bool IsSbglLobbyName(string lobbyName) { return !string.IsNullOrEmpty(lobbyName) && lobbyName.StartsWith("SBGL-", StringComparison.OrdinalIgnoreCase); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static class LobbyPatch { public static void Prefix(ref string value) { if (SBGLPlugin.IsRankedTriggered) { string @string = PlayerPrefs.GetString("LobbyName"); if (!string.IsNullOrEmpty(@string)) { value = @string; } } } } public class MatchResultSubmissionService { [CompilerGenerated] private sealed class <>c__DisplayClass25_0 { public string resolvedId; public MatchResultSubmissionService <>4__this; public string normalizedName; internal void b__0(string res) { if (string.IsNullOrWhiteSpace(res)) { return; } try { JToken val = JToken.Parse(res); JArray val2 = (JArray)(object)((val is JArray) ? val : null); JObject val3 = (JObject)((val2 != null) ? ((object)((IEnumerable)val2).OfType().FirstOrDefault()) : ((object)((val is JObject) ? val : null))); if (val3 != null) { resolvedId = (string)val3["id"]; } } catch (Exception ex) { <>4__this.Log("[Casual] Could not resolve player '" + normalizedName + "': " + ex.Message + ""); } } } [CompilerGenerated] private sealed class <>c__DisplayClass26_0 { public string playerId; public string resolvedDisplayName; public int casualMatchesPlayed; public bool updated; public MatchResultSubmissionService <>4__this; internal void b__2(string id) { playerId = id; } internal void b__3(string res) { JObject val = <>4__this._parseApiSingleObject(res); if (val != null) { resolvedDisplayName = ((string)val["display_name"]) ?? resolvedDisplayName; int.TryParse(((object)val["casual_matches_played"])?.ToString() ?? "0", out casualMatchesPlayed); } } internal void b__4(string res) { if (<>4__this._parseApiSingleObject(res) != null) { updated = true; } } } [CompilerGenerated] private sealed class <>c__DisplayClass29_0 { public string matchId; public MatchResultSubmissionService <>4__this; internal void b__2(string id) { matchId = id; } internal void b__0(string id) { matchId = id; } internal void b__1(string res) { try { JObject val = <>4__this._parseApiSingleObject(res); if (val != null) { <>4__this.Log("[Match Creation] ✓ MatchmakingSession " + <>4__this._currentSession.id + " linked to match: " + matchId + ""); } else { <>4__this.Log("[Match Creation] Could not confirm MatchmakingSession update"); } } catch (Exception ex) { <>4__this.Log("[Match Creation] Error updating MatchmakingSession: " + ex.Message + ""); } } } [CompilerGenerated] private sealed class <>c__DisplayClass29_1 { public string playerId; public <>c__DisplayClass29_0 CS$<>8__locals1; } [CompilerGenerated] private sealed class <>c__DisplayClass29_2 { public string playerName; public string preMatchMmr; public string entryId; public <>c__DisplayClass29_1 CS$<>8__locals2; internal void b__3(string res) { try { JObject val = CS$<>8__locals2.CS$<>8__locals1.<>4__this._parseApiSingleObject(res); if (val != null) { playerName = (string)val["display_name"]; if (string.IsNullOrEmpty(playerName)) { CS$<>8__locals2.CS$<>8__locals1.<>4__this.Log("[Match Creation] Player " + CS$<>8__locals2.playerId + " has no display_name, using ID"); playerName = CS$<>8__locals2.playerId; } object obj = val["current_mmr"]; if (obj != null) { preMatchMmr = obj.ToString(); } CS$<>8__locals2.CS$<>8__locals1.<>4__this.Log("[Match Creation] Fetched player: " + playerName + " (MMR: " + preMatchMmr + ")"); } else { CS$<>8__locals2.CS$<>8__locals1.<>4__this.Log("[Match Creation] Failed to fetch Player " + CS$<>8__locals2.playerId + " - response null"); playerName = CS$<>8__locals2.playerId; } } catch (Exception ex) { CS$<>8__locals2.CS$<>8__locals1.<>4__this.Log("[Match Creation] Error fetching Player " + CS$<>8__locals2.playerId + ": " + ex.Message + ""); playerName = CS$<>8__locals2.playerId; } } internal void b__4(string res) { try { JObject val = CS$<>8__locals2.CS$<>8__locals1.<>4__this._parseApiSingleObject(res); if (val != null) { entryId = (string)val["id"]; CS$<>8__locals2.CS$<>8__locals1.<>4__this._playerMatchEntryIds[CS$<>8__locals2.playerId] = entryId; CS$<>8__locals2.CS$<>8__locals1.<>4__this.Log("[Match Creation] ✓ MatchEntry created for " + playerName + ": " + entryId + ""); } } catch (Exception ex) { CS$<>8__locals2.CS$<>8__locals1.<>4__this.Log("[Match Creation] Could not parse MatchEntry: " + ex.Message + ""); } } } [CompilerGenerated] private sealed class <>c__DisplayClass32_0 { public MatchResultSubmissionService <>4__this; public string playerName; internal void b__0(string res) { try { JObject val = <>4__this._parseApiSingleObject(res); if (val != null) { <>4__this.Log("[Score Update] ✓ MatchEntry updated for " + playerName + ""); } } catch (Exception ex) { <>4__this.Log("[Score Update] Could not update MatchEntry: " + ex.Message + ""); } } } [CompilerGenerated] private sealed class <>c__DisplayClass33_0 { public MatchResultSubmissionService <>4__this; public Action onMatchIdReceived; internal void b__0(string res) { JObject val = <>4__this._parseApiSingleObject(res); if (val != null) { string text = ((string)val["id"]) ?? "unknown"; <>4__this.Log("[Match Stats] ✓ Match entry created (ID: " + text + ")"); onMatchIdReceived?.Invoke(text); } else { <>4__this.Log("[Match Stats] Response received but could not parse ID"); } } } [CompilerGenerated] private sealed class d__29 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public List startingLeaderboard; public List playerIds; public MatchResultSubmissionService <>4__this; private <>c__DisplayClass29_0 <>8__1; private string 5__2; private string 5__3; private string 5__4; private int 5__5; private SBGLPlugin.MatchStats 5__6; private float 5__7; private List.Enumerator <>s__8; private <>c__DisplayClass29_1 <>8__9; private <>c__DisplayClass29_2 <>8__10; private int 5__11; private int 5__12; private int 5__13; private int 5__14; private string 5__15; private string 5__16; private string 5__17; private string 5__18; private int 5__19; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__29(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 6) <= 1u) { try { } finally { <>m__Finally1(); } } <>8__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; 5__6 = null; <>s__8 = default(List.Enumerator); <>8__9 = null; <>8__10 = null; 5__15 = null; 5__16 = null; 5__17 = null; 5__18 = null; <>1__state = -2; } private bool MoveNext() { try { UnifiedPlugin instance; switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass29_0(); <>8__1.<>4__this = <>4__this; <>4__this.Log("[Match Creation] Starting new match for session " + <>4__this._currentSession.id + ""); <>4__this._matchStartTime = DateTime.UtcNow; 5__2 = <>4__this._currentSession?.match_type ?? PlayerPrefs.GetString("MatchType", ""); if (IsProSeriesMatchType(5__2)) { <>4__this.Log("[Match] Pro Series match — automated upload skipped"); <>4__this._matchEntriesCreated = true; return false; } if (IsCasualMatchType(5__2)) { <>4__this.Log("[Casual] Casual match detected - skipping Match/MatchEntry upload and incrementing player stats instead"); <>2__current = <>4__this.IncrementCasualMatchesPlayedForLeaderboard(startingLeaderboard); <>1__state = 1; return true; } 5__3 = PlayerPrefs.GetString("SelectedCourse", "Unknown"); 5__4 = PlayerPrefs.GetString("MatchType", "unranked"); 5__5 = PlayerPrefs.GetInt("Season", 1); 5__6 = new SBGLPlugin.MatchStats { matchmaking_session_id = <>4__this._currentSession.id, match_id = <>4__this._currentSession.id, player_id = <>4__this._userProfile.id, player_name = <>4__this._userProfile.display_name, match_date = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss.fffZ"), duration_seconds = 0, is_host = false, status = "completed", course_name = 5__3, match_type = 5__4, season = 5__5 }; <>4__this.Log($"[Match Creation] Match configuration - Course: {5__3}, Type: {5__4}, Season: {5__5}"); <>8__1.matchId = null; if (CompetitivePluginCheck.HasHigherVersionPeer()) { <>4__this.Log("[Match Creation] Higher-version peer detected — deferring Match creation to them, waiting for their Match ID..."); ReceivedP2PMatchId = null; 5__7 = Time.realtimeSinceStartup + 15f; goto IL_02f9; } <>2__current = <>4__this.SubmitMatchEntry(5__6, delegate(string id) { <>8__1.matchId = id; }); <>1__state = 4; return true; case 1: <>1__state = -1; return false; case 2: <>1__state = -1; goto IL_02f9; case 3: <>1__state = -1; goto IL_0400; case 4: <>1__state = -1; goto IL_0400; case 5: <>1__state = -1; <>4__this._playerMatchEntryIds.Clear(); <>4__this._lastSubmittedScores.Clear(); <>4__this._lastSubmittedScoresVsPar.Clear(); <>s__8 = playerIds.GetEnumerator(); <>1__state = -3; goto IL_09f3; case 6: <>1__state = -3; goto IL_06c2; case 7: { <>1__state = -3; <>8__10 = null; 5__15 = null; 5__16 = null; 5__17 = null; 5__18 = null; <>8__9 = null; goto IL_09f3; } IL_09f3: if (<>s__8.MoveNext()) { <>8__9 = new <>c__DisplayClass29_1(); <>8__9.CS$<>8__locals1 = <>8__1; <>8__9.playerId = <>s__8.Current; <>8__10 = new <>c__DisplayClass29_2(); <>8__10.CS$<>8__locals2 = <>8__9; <>8__10.playerName = null; <>8__10.preMatchMmr = null; 5__11 = 0; 5__12 = 0; if (<>8__10.CS$<>8__locals2.playerId == <>4__this._userProfile.id) { <>8__10.playerName = <>4__this._userProfile.display_name; <>8__10.preMatchMmr = <>4__this._userProfile.current_mmr.ToString(); <>4__this.Log("[Match Creation] Current player: " + <>8__10.playerName + " (MMR: " + <>8__10.preMatchMmr + ")"); goto IL_06c2; } <>2__current = <>4__this._callApi("/Player/" + <>8__10.CS$<>8__locals2.playerId, "GET", "", delegate(string res) { try { JObject val3 = <>8__10.CS$<>8__locals2.CS$<>8__locals1.<>4__this._parseApiSingleObject(res); if (val3 != null) { <>8__10.playerName = (string)val3["display_name"]; if (string.IsNullOrEmpty(<>8__10.playerName)) { <>8__10.CS$<>8__locals2.CS$<>8__locals1.<>4__this.Log("[Match Creation] Player " + <>8__10.CS$<>8__locals2.playerId + " has no display_name, using ID"); <>8__10.playerName = <>8__10.CS$<>8__locals2.playerId; } object obj = val3["current_mmr"]; if (obj != null) { <>8__10.preMatchMmr = obj.ToString(); } <>8__10.CS$<>8__locals2.CS$<>8__locals1.<>4__this.Log("[Match Creation] Fetched player: " + <>8__10.playerName + " (MMR: " + <>8__10.preMatchMmr + ")"); } else { <>8__10.CS$<>8__locals2.CS$<>8__locals1.<>4__this.Log("[Match Creation] Failed to fetch Player " + <>8__10.CS$<>8__locals2.playerId + " - response null"); <>8__10.playerName = <>8__10.CS$<>8__locals2.playerId; } } catch (Exception ex3) { <>8__10.CS$<>8__locals2.CS$<>8__locals1.<>4__this.Log("[Match Creation] Error fetching Player " + <>8__10.CS$<>8__locals2.playerId + ": " + ex3.Message + ""); <>8__10.playerName = <>8__10.CS$<>8__locals2.playerId; } }); <>1__state = 6; return true; } <>m__Finally1(); <>s__8 = default(List.Enumerator); <>4__this._matchEntriesCreated = true; <>4__this.Log("[Match Creation] ✓ Match and entries initialized. Starting score monitoring..."); <>4__this._isInGameplay = true; <>4__this._startCoroutine?.Invoke(<>4__this.MonitorAndUpdateScores()); return false; IL_0400: if (string.IsNullOrEmpty(<>8__1.matchId)) { <>4__this.Log("[Match Creation] Failed to create Match record"); return false; } <>4__this._currentMatchId = <>8__1.matchId; <>4__this.Log("[Match Creation] ✓ Match created: " + <>8__1.matchId + ""); <>2__current = <>4__this._callApi("/MatchmakingSession/" + <>4__this._currentSession.id, "PUT", "{\"match_id\":\"" + <>8__1.matchId + "\"}", delegate(string res) { try { JObject val2 = <>8__1.<>4__this._parseApiSingleObject(res); if (val2 != null) { <>8__1.<>4__this.Log("[Match Creation] ✓ MatchmakingSession " + <>8__1.<>4__this._currentSession.id + " linked to match: " + <>8__1.matchId + ""); } else { <>8__1.<>4__this.Log("[Match Creation] Could not confirm MatchmakingSession update"); } } catch (Exception ex2) { <>8__1.<>4__this.Log("[Match Creation] Error updating MatchmakingSession: " + ex2.Message + ""); } }); <>1__state = 5; return true; IL_02f9: if (string.IsNullOrEmpty(ReceivedP2PMatchId) && Time.realtimeSinceStartup < 5__7) { <>2__current = null; <>1__state = 2; return true; } <>8__1.matchId = ReceivedP2PMatchId; if (!string.IsNullOrEmpty(<>8__1.matchId)) { <>4__this.Log("[Match Creation] ✓ Adopted Match ID from higher-version peer: " + <>8__1.matchId + ""); goto IL_0400; } <>4__this.Log("[Match Creation] No Match ID received from higher-version peer within 15s — submitting own Match record"); <>2__current = <>4__this.SubmitMatchEntry(5__6, delegate(string id) { <>8__1.matchId = id; }); <>1__state = 3; return true; IL_06c2: if (!string.IsNullOrEmpty(<>8__10.playerName)) { if (<>4__this._cachedLeaderboardScores.TryGetValue(<>8__10.playerName, out 5__19)) { 5__11 = 5__19; <>4__this._cachedLeaderboardScoresVsPar.TryGetValue(<>8__10.playerName, out 5__12); } <>4__this._lastSubmittedScores[<>8__10.playerName] = 5__11; <>4__this._lastSubmittedScoresVsPar[<>8__10.playerName] = 5__12; } 5__13 = <>4__this.GetPlayerFinishPosition(<>8__10.playerName, startingLeaderboard); 5__14 = 5__11 + 5__12 * -10; 5__15 = ((!string.IsNullOrEmpty(<>8__10.preMatchMmr)) ? (",\"pre_match_mmr\":" + <>8__10.preMatchMmr) : ""); 5__16 = ((5__13 > 0) ? $",\"finish_position\":{5__13}" : ""); instance = UnifiedPlugin.Instance; 5__17 = ((instance == null) ? null : ((BaseUnityPlugin)instance).Info.Metadata.Version?.ToString()) ?? "unknown"; 5__18 = "{\"match_id\":\"" + <>8__10.CS$<>8__locals2.CS$<>8__locals1.matchId + "\",\"player_id\":\"" + <>8__10.CS$<>8__locals2.playerId + "\",\"player_name\":\"" + (<>8__10.playerName ?? "Unknown") + "\"," + $"\"game_points\":{5__11}," + $"\"over_under\":{5__12}," + $"\"score_vs_par\":{5__12}," + $"\"adjusted_match_score\":{5__14}" + 5__15 + 5__16 + ",\"notes\":\"Progressive match tracking - created at round start (Mod v" + 5__17 + ")\"}"; <>4__this.Log("[Match Creation] JSON: " + 5__18 + ""); <>8__10.entryId = null; <>2__current = <>4__this._callApi("/MatchEntry", "POST", 5__18, delegate(string res) { try { JObject val = <>8__10.CS$<>8__locals2.CS$<>8__locals1.<>4__this._parseApiSingleObject(res); if (val != null) { <>8__10.entryId = (string)val["id"]; <>8__10.CS$<>8__locals2.CS$<>8__locals1.<>4__this._playerMatchEntryIds[<>8__10.CS$<>8__locals2.playerId] = <>8__10.entryId; <>8__10.CS$<>8__locals2.CS$<>8__locals1.<>4__this.Log("[Match Creation] ✓ MatchEntry created for " + <>8__10.playerName + ": " + <>8__10.entryId + ""); } } catch (Exception ex) { <>8__10.CS$<>8__locals2.CS$<>8__locals1.<>4__this.Log("[Match Creation] Could not parse MatchEntry: " + ex.Message + ""); } }); <>1__state = 7; return true; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>s__8).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__30 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public List finalLeaderboard; public MatchResultSubmissionService <>4__this; private string 5__1; private List.Enumerator <>s__2; private LiveLeaderboardPlugin.SBGLPlayer 5__3; private int 5__4; private int 5__5; private int 5__6; private string 5__7; private string 5__8; private string 5__9; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__30(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 2) { try { } finally { <>m__Finally1(); } } 5__1 = null; <>s__2 = default(List.Enumerator); 5__3 = null; 5__7 = null; 5__8 = null; 5__9 = null; <>1__state = -2; } private bool MoveNext() { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = <>4__this._currentSession?.match_type ?? PlayerPrefs.GetString("MatchType", ""); if (IsProSeriesMatchType(5__1) || IsCasualMatchType(5__1)) { <>4__this._matchStatsSubmitted = true; return false; } <>2__current = (object)new WaitForSeconds(1.5f); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.Log("[Match Finalize] Performing final score update..."); if (finalLeaderboard == null || finalLeaderboard.Count == 0) { <>4__this.Log("[Match Finalize] No leaderboard data available"); <>4__this._matchStatsSubmitted = true; return false; } <>4__this.Log($"[Match Finalize] Using final snapshot with {finalLeaderboard.Count} players"); <>s__2 = finalLeaderboard.GetEnumerator(); <>1__state = -3; goto IL_0349; case 2: { <>1__state = -3; goto IL_0333; } IL_0349: do { if (<>s__2.MoveNext()) { 5__3 = <>s__2.Current; continue; } <>m__Finally1(); <>s__2 = default(List.Enumerator); <>4__this._matchStatsSubmitted = true; <>4__this.Log("[Match Finalize] ✓ Match stats finalized"); return false; } while (5__3 == null); 5__4 = 5__3.BaseScore; 5__5 = 0; 5__6 = <>4__this.GetPlayerFinishPosition(5__3.Name, finalLeaderboard); if (!string.IsNullOrEmpty(5__3.RawStrokes)) { 5__9 = 5__3.RawStrokes.Replace("±", "").Trim(); int.TryParse(5__9, out 5__5); 5__9 = null; } 5__7 = null; 5__8 = null; if (5__3.Name == <>4__this._userProfile.display_name) { 5__7 = <>4__this._userProfile.id; } if (!string.IsNullOrEmpty(5__7) && <>4__this._playerMatchEntryIds.TryGetValue(5__7, out 5__8)) { <>4__this.Log($"[Match Finalize] Final update for {5__3.Name}: {5__4} pts, {5__5} vs par, Position: {5__6}"); <>2__current = <>4__this.UpdateMatchEntry(5__8, 5__7, 5__3.Name, 5__4, 5__5, 5__6); <>1__state = 2; return true; } goto IL_0333; IL_0333: 5__7 = null; 5__8 = null; 5__3 = null; goto IL_0349; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>s__2).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__26 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public List leaderboardPlayers; public MatchResultSubmissionService <>4__this; private List 5__1; private int 5__2; private List.Enumerator <>s__3; private string 5__4; private <>c__DisplayClass26_0 <>8__5; private int 5__6; private string 5__7; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__26(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 1) <= 2u) { try { } finally { <>m__Finally1(); } } 5__1 = null; <>s__3 = default(List.Enumerator); 5__4 = null; <>8__5 = null; 5__7 = null; <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = (from player in leaderboardPlayers?.Where((LiveLeaderboardPlugin.SBGLPlayer player) => player != null && !string.IsNullOrWhiteSpace(player.Name)) select player.Name.Trim()).Distinct(StringComparer.OrdinalIgnoreCase).ToList() ?? new List(); if (5__1.Count == 0) { <>4__this.Log("[Casual] No active leaderboard names found - skipping casual stat increment"); return false; } 5__2 = 0; <>s__3 = 5__1.GetEnumerator(); <>1__state = -3; goto IL_0409; case 1: <>1__state = -3; goto IL_01f1; case 2: <>1__state = -3; 5__6 = <>8__5.casualMatchesPlayed + 1; 5__7 = "{" + $"\"casual_matches_played\":{5__6}" + "}"; <>8__5.updated = false; <>2__current = <>4__this._callApi("/Player/" + <>8__5.playerId, "PUT", 5__7, delegate(string res) { if (<>8__5.<>4__this._parseApiSingleObject(res) != null) { <>8__5.updated = true; } }); <>1__state = 3; return true; case 3: { <>1__state = -3; if (!<>8__5.updated) { <>4__this.Log("[Casual] Failed to update casual_matches_played for " + 5__4 + ""); } else { 5__2++; <>4__this.Log($"[Casual] ✓ Updated {<>8__5.resolvedDisplayName} ({<>8__5.playerId}) casual_matches_played: {<>8__5.casualMatchesPlayed} -> {5__6}"); <>8__5 = null; 5__7 = null; 5__4 = null; } goto IL_0409; } IL_01f1: if (string.IsNullOrWhiteSpace(<>8__5.playerId)) { <>4__this.Log("[Casual] Could not resolve player ID for '" + 5__4 + "' - skipping casual stat update"); goto IL_0409; } <>8__5.casualMatchesPlayed = 0; <>8__5.resolvedDisplayName = 5__4; <>2__current = <>4__this._callApi("/Player/" + <>8__5.playerId, "GET", "", delegate(string res) { JObject val = <>8__5.<>4__this._parseApiSingleObject(res); if (val != null) { <>8__5.resolvedDisplayName = ((string)val["display_name"]) ?? <>8__5.resolvedDisplayName; int.TryParse(((object)val["casual_matches_played"])?.ToString() ?? "0", out <>8__5.casualMatchesPlayed); } }); <>1__state = 2; return true; IL_0409: if (<>s__3.MoveNext()) { 5__4 = <>s__3.Current; <>8__5 = new <>c__DisplayClass26_0(); <>8__5.<>4__this = <>4__this; <>8__5.playerId = null; if (!string.IsNullOrWhiteSpace(<>4__this._userProfile?.id) && string.Equals(5__4, <>4__this._userProfile.display_name, StringComparison.OrdinalIgnoreCase)) { <>8__5.playerId = <>4__this._userProfile.id; } if (string.IsNullOrWhiteSpace(<>8__5.playerId)) { <>2__current = <>4__this.ResolvePlayerIdByName(5__4, delegate(string id) { <>8__5.playerId = id; }); <>1__state = 1; return true; } goto IL_01f1; } <>m__Finally1(); <>s__3 = default(List.Enumerator); <>4__this._matchEntriesCreated = true; <>4__this._matchStatsSubmitted = true; <>4__this.Log($"[Casual] Casual match handling complete - updated {5__2}/{5__1.Count} players"); return false; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>s__3).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__31 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MatchResultSubmissionService <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__31(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.Log("[Match Monitor] Starting score monitoring for gameplay"); break; case 1: <>1__state = -1; break; } if (<>4__this._isInGameplay && <>4__this._currentMatchId != null) { <>2__current = (object)new WaitForSeconds(2f); <>1__state = 1; return true; } <>4__this.Log("[Match Monitor] Score monitoring ended"); 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(); } } [CompilerGenerated] private sealed class d__25 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string playerName; public Action onResolved; public MatchResultSubmissionService <>4__this; private <>c__DisplayClass25_0 <>8__1; private string 5__2; private string 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__25(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; 5__2 = null; 5__3 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass25_0(); <>8__1.<>4__this = <>4__this; if (onResolved == null) { return false; } if (string.IsNullOrWhiteSpace(playerName)) { onResolved(null); return false; } <>8__1.normalizedName = playerName.Trim(); 5__2 = <>8__1.normalizedName.Replace("\\", "\\\\").Replace("\"", "\\\""); 5__3 = "{\"$or\":[{\"display_name\":\"" + 5__2 + "\"},{\"ign\":\"" + 5__2 + "\"}]}"; <>8__1.resolvedId = null; <>2__current = <>4__this._callApi("/Player?q=" + UnityWebRequest.EscapeURL(5__3) + "&limit=1", "GET", "", delegate(string res) { if (string.IsNullOrWhiteSpace(res)) { return; } try { JToken val = JToken.Parse(res); JArray val2 = (JArray)(object)((val is JArray) ? val : null); JObject val3 = (JObject)((val2 != null) ? ((object)((IEnumerable)val2).OfType().FirstOrDefault()) : ((object)((val is JObject) ? val : null))); if (val3 != null) { <>8__1.resolvedId = (string)val3["id"]; } } catch (Exception ex) { <>8__1.<>4__this.Log("[Casual] Could not resolve player '" + <>8__1.normalizedName + "': " + ex.Message + ""); } }); <>1__state = 1; return true; case 1: <>1__state = -1; onResolved(<>8__1.resolvedId); 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(); } } [CompilerGenerated] private sealed class d__33 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SBGLPlugin.MatchStats stats; public Action onMatchIdReceived; public MatchResultSubmissionService <>4__this; private <>c__DisplayClass33_0 <>8__1; private string 5__2; private bool 5__3; private string 5__4; private string 5__5; private JObject 5__6; private string 5__7; private int 5__8; private string 5__9; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__33(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; 5__2 = null; 5__4 = null; 5__5 = null; 5__6 = null; 5__7 = null; 5__9 = null; <>1__state = -2; } private bool MoveNext() { //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: { <>1__state = -1; <>8__1 = new <>c__DisplayClass33_0(); <>8__1.<>4__this = <>4__this; <>8__1.onMatchIdReceived = onMatchIdReceived; if (stats == null || <>4__this._currentSession == null) { return false; } 5__2 = "69de6bf4fb103cb0d5eb00c5"; 5__3 = IsProSeriesMatchType(stats.match_type); 5__4 = (5__3 ? "pro_series" : "mmr"); 5__5 = (5__3 ? "Pro Series" : "Ranked"); JObject val = new JObject { ["matchmaking_session_id"] = JToken.op_Implicit(<>4__this._currentSession.id), ["season_id"] = JToken.op_Implicit(5__2), ["match_date"] = JToken.op_Implicit(stats.match_date), ["match_type"] = JToken.op_Implicit(5__4), ["course_name"] = JToken.op_Implicit(stats.course_name), ["player_count"] = JToken.op_Implicit(2), ["status"] = JToken.op_Implicit("Pending"), ["submitted_by_name"] = JToken.op_Implicit(stats.player_name), ["mode"] = JToken.op_Implicit(5__5) }; UnifiedPlugin instance = UnifiedPlugin.Instance; val["notes"] = JToken.op_Implicit("Auto-submitted via SBGL Unified Mod v" + (((instance == null) ? null : ((BaseUnityPlugin)instance).Info.Metadata.Version?.ToString()) ?? "unknown")); 5__6 = val; if (5__3) { 5__6["pro_series_season_id"] = JToken.op_Implicit("69b59af135403a1cb7b113c8"); 5__8 = PlayerPrefs.GetInt("ProSeriesWeek", 0); if (5__8 > 0) { 5__6["pro_series_week"] = JToken.op_Implicit(5__8); } 5__9 = PlayerPrefs.GetString("ProSeriesEventName", ""); if (!string.IsNullOrWhiteSpace(5__9)) { 5__6["pro_series_event_name"] = JToken.op_Implicit(5__9); } 5__9 = null; } 5__7 = ((JToken)5__6).ToString((Formatting)0, Array.Empty()); <>4__this.Log("[Match Stats] Submitting Match entry to API"); <>4__this.Log("[Match Stats] Full URL: " + <>4__this._getBaseApiUrl() + "/Match"); <>4__this.Log("[Match Stats] Payload: " + 5__7 + ""); <>2__current = <>4__this._callApi("/Match", "POST", 5__7, delegate(string res) { JObject val2 = <>8__1.<>4__this._parseApiSingleObject(res); if (val2 != null) { string text = ((string)val2["id"]) ?? "unknown"; <>8__1.<>4__this.Log("[Match Stats] ✓ Match entry created (ID: " + text + ")"); <>8__1.onMatchIdReceived?.Invoke(text); } else { <>8__1.<>4__this.Log("[Match Stats] Response received but could not parse ID"); } }); <>1__state = 1; return true; } case 1: <>1__state = -1; 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(); } } [CompilerGenerated] private sealed class d__32 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string entryId; public string playerId; public string playerName; public int gamePoints; public int scoreVsPar; public int finishPosition; public MatchResultSubmissionService <>4__this; private <>c__DisplayClass32_0 <>8__1; private int 5__2; private string 5__3; private string 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__32(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; 5__3 = null; 5__4 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: { <>1__state = -1; <>8__1 = new <>c__DisplayClass32_0(); <>8__1.<>4__this = <>4__this; <>8__1.playerName = playerName; <>4__this.Log($"[Score Update] Hole completed for {<>8__1.playerName}: {gamePoints} pts, {scoreVsPar} vs par"); 5__2 = gamePoints + scoreVsPar * -10; UnifiedPlugin instance = UnifiedPlugin.Instance; 5__3 = ((instance == null) ? null : ((BaseUnityPlugin)instance).Info.Metadata.Version?.ToString()) ?? "unknown"; 5__4 = "{" + $"\"game_points\":{gamePoints}," + $"\"over_under\":{scoreVsPar}," + $"\"score_vs_par\":{scoreVsPar}," + $"\"adjusted_match_score\":{5__2}," + $"\"finish_position\":{finishPosition}," + "\"notes\":\"Updated after hole completion (Mod v" + 5__3 + ")\"}"; <>2__current = <>4__this._callApi("/MatchEntry/" + entryId, "PUT", 5__4, delegate(string res) { try { JObject val = <>8__1.<>4__this._parseApiSingleObject(res); if (val != null) { <>8__1.<>4__this.Log("[Score Update] ✓ MatchEntry updated for " + <>8__1.playerName + ""); } } catch (Exception ex) { <>8__1.<>4__this.Log("[Score Update] Could not update MatchEntry: " + ex.Message + ""); } }); <>1__state = 1; return true; } case 1: <>1__state = -1; 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 const int SBGL_NET_CHANNEL = 2622; internal static string ReceivedP2PMatchId; private SBGLPlugin.MatchmakingSession _currentSession; private SBGLPlugin.PlayerProfile _userProfile; private string _currentMatchId; private Dictionary _playerMatchEntryIds = new Dictionary(); private Dictionary _lastSubmittedScores = new Dictionary(); private Dictionary _lastSubmittedScoresVsPar = new Dictionary(); private Dictionary _cachedLeaderboardScores = new Dictionary(); private Dictionary _cachedLeaderboardScoresVsPar = new Dictionary(); private bool _matchEntriesCreated = false; private bool _isInGameplay = false; private DateTime? _matchStartTime = null; private bool _matchStatsSubmitted = false; private Func _getBaseApiUrl; private Action _logger; private Func, IEnumerator> _callApi; private Func _parseApiSingleObject; private Action _startCoroutine; internal static void HandleIncomingMatchIdBroadcast(string matchId) { if (!string.IsNullOrEmpty(matchId)) { ReceivedP2PMatchId = matchId; } } internal static void BroadcastMatchId(string matchId, IEnumerable peers) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) if (!SteamClient.IsValid || string.IsNullOrEmpty(matchId)) { return; } try { byte[] bytes = Encoding.UTF8.GetBytes("SBGL_MATCH_ID:" + matchId); int num = 0; foreach (ulong peer in peers) { try { SteamNetworking.SendP2PPacket(SteamId.op_Implicit(peer), bytes, -1, 2622, (P2PSend)2); num++; } catch { } } Debug.Log((object)$"[SBGL-MatchResult] Broadcast Match ID {matchId} to {num} peers"); } catch (Exception ex) { Debug.LogWarning((object)("[SBGL-MatchResult] BroadcastMatchId error: " + ex.Message)); } } public MatchResultSubmissionService(Func getBaseApiUrl, Action logger, Func, IEnumerator> callApi, Func parseApiSingleObject, Action startCoroutine) { _getBaseApiUrl = getBaseApiUrl; _logger = logger; _callApi = callApi; _parseApiSingleObject = parseApiSingleObject; _startCoroutine = startCoroutine; } private void Log(string message) { _logger?.Invoke(message); } private static bool IsProSeriesMatchType(string matchType) { return !string.IsNullOrWhiteSpace(matchType) && matchType.IndexOf("pro_series", StringComparison.OrdinalIgnoreCase) >= 0; } private static bool IsCasualMatchType(string matchType) { return !string.IsNullOrWhiteSpace(matchType) && matchType.IndexOf("casual", StringComparison.OrdinalIgnoreCase) >= 0; } [IteratorStateMachine(typeof(d__25))] private IEnumerator ResolvePlayerIdByName(string playerName, Action onResolved) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__25(0) { <>4__this = this, playerName = playerName, onResolved = onResolved }; } [IteratorStateMachine(typeof(d__26))] private IEnumerator IncrementCasualMatchesPlayedForLeaderboard(List leaderboardPlayers) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__26(0) { <>4__this = this, leaderboardPlayers = leaderboardPlayers }; } public void Initialize(SBGLPlugin.MatchmakingSession session, SBGLPlugin.PlayerProfile profile) { _currentSession = session; _userProfile = profile; _playerMatchEntryIds.Clear(); _lastSubmittedScores.Clear(); _lastSubmittedScoresVsPar.Clear(); _matchEntriesCreated = false; _matchStatsSubmitted = false; } public void SetCachedScores(Dictionary scores, Dictionary scoresVsPar) { _cachedLeaderboardScores = new Dictionary(scores ?? new Dictionary()); _cachedLeaderboardScoresVsPar = new Dictionary(scoresVsPar ?? new Dictionary()); } [IteratorStateMachine(typeof(d__29))] public IEnumerator CreateMatchAndEntries(List startingLeaderboard, List playerIds) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__29(0) { <>4__this = this, startingLeaderboard = startingLeaderboard, playerIds = playerIds }; } [IteratorStateMachine(typeof(d__30))] public IEnumerator FinalizeMatchStats(List finalLeaderboard) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__30(0) { <>4__this = this, finalLeaderboard = finalLeaderboard }; } [IteratorStateMachine(typeof(d__31))] private IEnumerator MonitorAndUpdateScores() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__31(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__32))] private IEnumerator UpdateMatchEntry(string entryId, string playerId, string playerName, int gamePoints, int scoreVsPar, int finishPosition = 0) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__32(0) { <>4__this = this, entryId = entryId, playerId = playerId, playerName = playerName, gamePoints = gamePoints, scoreVsPar = scoreVsPar, finishPosition = finishPosition }; } [IteratorStateMachine(typeof(d__33))] private IEnumerator SubmitMatchEntry(SBGLPlugin.MatchStats stats, Action onMatchIdReceived) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__33(0) { <>4__this = this, stats = stats, onMatchIdReceived = onMatchIdReceived }; } private int GetPlayerFinishPosition(string playerName, List leaderboard) { if (string.IsNullOrEmpty(playerName) || leaderboard == null || leaderboard.Count == 0) { return 0; } Dictionary dictionary = BuildFinishPositionMap(leaderboard); if (dictionary.TryGetValue(playerName, out var value)) { return value; } return 0; } private int ParseScoreVsPar(string rawStrokes) { if (string.IsNullOrWhiteSpace(rawStrokes)) { return 0; } string s = rawStrokes.Replace("±", "").Trim(); int.TryParse(s, out var result); return result; } private Dictionary BuildFinishPositionMap(List leaderboard) { Dictionary dictionary = new Dictionary(StringComparer.OrdinalIgnoreCase); if (leaderboard == null || leaderboard.Count == 0) { return dictionary; } var list = (from p in leaderboard where p != null && !string.IsNullOrWhiteSpace(p.Name) select new { Player = p, Stroke = ParseScoreVsPar(p.RawStrokes) } into x orderby x.Player.AdjustedPoints descending, x.Player.BaseScore descending, x.Stroke select x).ThenBy(x => x.Player.Name, StringComparer.OrdinalIgnoreCase).ToList(); int num = 1; foreach (var item in list) { if (!dictionary.ContainsKey(item.Player.Name)) { dictionary[item.Player.Name] = num++; } } return dictionary; } } } namespace SBGLLiveLeaderboard { public class LiveLeaderboardPlugin : MonoBehaviour { public class SBGLPlayer { public string Name; public int BaseScore; public int AdjustedPoints; public string RawStrokes; public string MMR = "..."; public string ProjectedDisplay = "..."; } [CompilerGenerated] private sealed class d__50 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string originalName; public LiveLeaderboardPlugin <>4__this; private string 5__1; private string 5__2; private bool 5__3; private UnityWebRequest 5__4; private JArray 5__5; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__50(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__1 = null; 5__2 = null; 5__4 = null; 5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Invalid comparison between Unknown and I4 try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (<>4__this._pendingRequests.Contains(originalName)) { return false; } <>4__this._pendingRequests.Add(originalName); 5__1 = "{\"display_name\":{\"$regex\":\"^" + originalName + "$\",\"$options\":\"i\"}}"; 5__2 = UnifiedPlugin.GetCurrentPlayerApi() + "?q=" + UnityWebRequest.EscapeURL(5__1); 5__3 = false; 5__4 = UnityWebRequest.Get(5__2); <>1__state = -3; 5__4.SetRequestHeader("X-App-Id", UnifiedPlugin.GetCurrentAppId()); 5__4.SetRequestHeader("api_key", UnifiedPlugin.GetCurrentAuthToken()); <>2__current = 5__4.SendWebRequest(); <>1__state = 1; return true; case 1: <>1__state = -3; if ((int)5__4.result == 1) { 5__5 = JArray.Parse(5__4.downloadHandler.text); if (((JContainer)5__5).Count > 0) { <>4__this._mmrCache[originalName] = (((object)5__5[0][(object)"current_mmr"])?.ToString() ?? "--", Time.time); } else { 5__3 = true; } 5__5 = null; } else { 5__3 = true; } <>m__Finally1(); 5__4 = null; if (5__3) { <>2__current = <>4__this.GetMMRFuzzyFallback(originalName); <>1__state = 2; return true; } break; case 2: <>1__state = -1; break; } <>4__this._pendingRequests.Remove(originalName); return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__4 != null) { ((IDisposable)5__4).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__51 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string originalName; public LiveLeaderboardPlugin <>4__this; private string 5__1; private string 5__2; private UnityWebRequest 5__3; private string 5__4; private JArray 5__5; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__51(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; 5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Invalid comparison between Unknown and I4 try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = "{\"display_name\":{\"$regex\":\"" + originalName + "\",\"$options\":\"i\"}}"; 5__2 = UnifiedPlugin.GetCurrentPlayerApi() + "?q=" + UnityWebRequest.EscapeURL(5__1); 5__3 = UnityWebRequest.Get(5__2); <>1__state = -3; 5__3.SetRequestHeader("X-App-Id", UnifiedPlugin.GetCurrentAppId()); 5__3.SetRequestHeader("api_key", UnifiedPlugin.GetCurrentAuthToken()); <>2__current = 5__3.SendWebRequest(); <>1__state = 1; return true; case 1: <>1__state = -3; 5__4 = "--"; if ((int)5__3.result == 1) { 5__5 = JArray.Parse(5__3.downloadHandler.text); if (((JContainer)5__5).Count > 0) { 5__4 = ((object)5__5[0][(object)"current_mmr"])?.ToString() ?? "--"; } 5__5 = null; } <>4__this._mmrCache[originalName] = (5__4, Time.time); 5__4 = null; <>m__Finally1(); 5__3 = null; return false; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__3 != null) { ((IDisposable)5__3).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private ConfigEntry _configWidth; private ConfigEntry _configMaxHeight; private ConfigEntry _configPosX; private ConfigEntry _configPosY; private ConfigEntry _configOpacity; private ConfigEntry _configMaxPlayers; private const float K_FACTOR = 24f; private bool _showWindow = true; private float _updateInterval = 2f; private float _nextUpdateTime = 0f; private float _lastOpacity = -1f; private List _persistentLeaderboard = new List(); private List _finalLeaderboardSnapshot = new List(); private bool _showFinalSnapshot = false; private readonly Dictionary _lastKnownRoundPlayers = new Dictionary(StringComparer.OrdinalIgnoreCase); private bool _roundCacheActive = false; private Dictionary _mmrCache = new Dictionary(); private HashSet _pendingRequests = new HashSet(); private FieldInfo _entriesField; private Scoreboard _cachedScoreboard; private GUIStyle _windowStyle; private GUIStyle _centeredStyle; private GUIStyle _headerStyle; private GUIStyle _nameStyle; private GUIStyle _posStyle; private GUIStyle _negStyle; private Texture2D _blackTexture; private float ConfigWidth => _configWidth?.Value ?? PlayerPrefs.GetFloat("LL_Width", 350f); private float ConfigMaxHeight => _configMaxHeight?.Value ?? PlayerPrefs.GetFloat("LL_MaxHeight", 999f); private float ConfigPosX => _configPosX?.Value ?? PlayerPrefs.GetFloat("LL_PosX", 5f); private float ConfigPosY => _configPosY?.Value ?? PlayerPrefs.GetFloat("LL_PosY", 200f); private float ConfigOpacity => _configOpacity?.Value ?? PlayerPrefs.GetFloat("LL_Opacity", 0.85f); private int ConfigMaxPlayers => _configMaxPlayers?.Value ?? PlayerPrefs.GetInt("LL_MaxPlayers", 16); private Key ToggleKey => (Key)101; public void SetConfig(ConfigEntry width, ConfigEntry maxHeight, ConfigEntry posX, ConfigEntry posY, ConfigEntry opacity, ConfigEntry maxPlayers) { _configWidth = width; _configMaxHeight = maxHeight; _configPosX = posX; _configPosY = posY; _configOpacity = opacity; _configMaxPlayers = maxPlayers; } private void Awake() { //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown if (!PlayerPrefs.HasKey("LL_Width")) { PlayerPrefs.SetFloat("LL_Width", 350f); } if (!PlayerPrefs.HasKey("LL_MaxHeight")) { PlayerPrefs.SetFloat("LL_MaxHeight", 999f); } if (!PlayerPrefs.HasKey("LL_PosX")) { PlayerPrefs.SetFloat("LL_PosX", 5f); } if (!PlayerPrefs.HasKey("LL_PosY")) { PlayerPrefs.SetFloat("LL_PosY", 200f); } if (!PlayerPrefs.HasKey("LL_Opacity")) { PlayerPrefs.SetFloat("LL_Opacity", 0.85f); } if (!PlayerPrefs.HasKey("LL_MaxPlayers")) { PlayerPrefs.SetInt("LL_MaxPlayers", 16); } _entriesField = typeof(Scoreboard).GetField("entries", BindingFlags.Instance | BindingFlags.NonPublic); _blackTexture = new Texture2D(1, 1); UnifiedPlugin.ApiConfigChanged += OnApiConfigChanged; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); } private void OnApiConfigChanged() { _mmrCache.Clear(); _pendingRequests.Clear(); _nextUpdateTime = Time.time; } private void Update() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) if (Keyboard.current != null && ((ButtonControl)Keyboard.current[ToggleKey]).wasPressedThisFrame) { _showWindow = !_showWindow; } Scene activeScene = SceneManager.GetActiveScene(); string text = ((Scene)(ref activeScene)).name ?? string.Empty; bool flag = text.Contains("Driving") || text.Contains("Range"); bool flag2 = text.ToLowerInvariant().Contains("menu"); if (flag) { _showFinalSnapshot = true; } else { _showFinalSnapshot = false; } if (flag2) { ResetForMainMenu(); } if (Time.time >= _nextUpdateTime) { ScrapeData(); _nextUpdateTime = Time.time + _updateInterval; } } private void OnGUI() { //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Expected O, but got Unknown //IL_0124: Expected O, but got Unknown //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014f: 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_0164: Expected O, but got Unknown //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Expected O, but got Unknown //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Expected O, but got Unknown //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Expected O, but got Unknown //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Expected O, but got Unknown //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Expected O, but got Unknown //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Expected O, but got Unknown //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_0528: Unknown result type (might be due to invalid IL or missing references) //IL_054c: Unknown result type (might be due to invalid IL or missing references) //IL_0570: Unknown result type (might be due to invalid IL or missing references) //IL_0594: Unknown result type (might be due to invalid IL or missing references) //IL_05b8: Unknown result type (might be due to invalid IL or missing references) //IL_05dc: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_048c: Unknown result type (might be due to invalid IL or missing references) //IL_04a1: Expected O, but got Unknown //IL_04b7: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_0616: Unknown result type (might be due to invalid IL or missing references) //IL_061b: Unknown result type (might be due to invalid IL or missing references) //IL_0621: Unknown result type (might be due to invalid IL or missing references) //IL_062e: Expected O, but got Unknown //IL_063d: Unknown result type (might be due to invalid IL or missing references) //IL_0679: Unknown result type (might be due to invalid IL or missing references) //IL_06b2: Unknown result type (might be due to invalid IL or missing references) //IL_06fc: Unknown result type (might be due to invalid IL or missing references) //IL_0706: Expected O, but got Unknown //IL_0701: Unknown result type (might be due to invalid IL or missing references) //IL_0706: Unknown result type (might be due to invalid IL or missing references) //IL_0710: Unknown result type (might be due to invalid IL or missing references) //IL_071a: Expected O, but got Unknown //IL_0715: Unknown result type (might be due to invalid IL or missing references) //IL_071a: Unknown result type (might be due to invalid IL or missing references) //IL_0725: Unknown result type (might be due to invalid IL or missing references) //IL_0735: Unknown result type (might be due to invalid IL or missing references) //IL_0763: Unknown result type (might be due to invalid IL or missing references) //IL_076c: Unknown result type (might be due to invalid IL or missing references) //IL_07e5: Unknown result type (might be due to invalid IL or missing references) //IL_0817: Unknown result type (might be due to invalid IL or missing references) //IL_083e: Unknown result type (might be due to invalid IL or missing references) //IL_07b0: Unknown result type (might be due to invalid IL or missing references) //IL_07bd: Unknown result type (might be due to invalid IL or missing references) //IL_07c6: Unknown result type (might be due to invalid IL or missing references) List list = ((_showFinalSnapshot && _finalLeaderboardSnapshot.Count > 0) ? _finalLeaderboardSnapshot : _persistentLeaderboard); if (!_showWindow || (!_showFinalSnapshot && list.Count == 0)) { return; } float num = (float)Screen.height / 1080f; float num2 = 4f * num; float num3 = 26f * num; float num4 = 22f * num; if (_windowStyle == null || Mathf.Abs(_lastOpacity - ConfigOpacity) > 0.01f) { _lastOpacity = ConfigOpacity; _blackTexture.SetPixel(0, 0, new Color(0f, 0f, 0f, _lastOpacity)); _blackTexture.Apply(); GUIStyle val = new GUIStyle(GUI.skin.window); val.normal.background = _blackTexture; val.border = new RectOffset(0, 0, 0, 0); _windowStyle = val; _centeredStyle = new GUIStyle(GUI.skin.label) { fontSize = Mathf.RoundToInt(11f * num), alignment = (TextAnchor)4, richText = true, wordWrap = false }; _headerStyle = new GUIStyle(_centeredStyle) { fontStyle = (FontStyle)1, wordWrap = false }; _nameStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)3, richText = true, wordWrap = false, fontSize = Mathf.RoundToInt(12f * num) }; GUIStyle val2 = new GUIStyle(_centeredStyle); val2.normal.textColor = Color.green; _posStyle = val2; GUIStyle val3 = new GUIStyle(_centeredStyle); val3.normal.textColor = new Color(1f, 0.45f, 0.45f); _negStyle = val3; } float num5 = 0.08f; float num6 = 0.35f; float num7 = 0.26f; float num8 = 0.12f; float num9 = 0.09f; float num10 = 0.1f; float num11 = ConfigWidth * num; float num12 = num11 - num2 * 2f; float num13 = num12 * num5; float num14 = num12 * num6; float num15 = num12 * num7; float num16 = num12 * num8; float num17 = num12 * num9; float num18 = num12 * num10; float num19 = num2 * 2f + num3 * 2f + (float)list.Count * num4; if (!string.IsNullOrWhiteSpace(SBGLPlugin.CurrentMatchId)) { num19 += num3 * 0.7f; } float num20 = Mathf.Min(num19, ConfigMaxHeight * num); float num21 = Mathf.Clamp(ConfigPosX * num, 0f, (float)Screen.width - num11); float num22 = Mathf.Clamp(ConfigPosY * num, 0f, (float)Screen.height - num20); Rect val4 = default(Rect); ((Rect)(ref val4))..ctor(num21, num22, num11, num20); if (num21 != ConfigPosX * num) { _configPosX.Value = num21 / num; } if (num22 != ConfigPosY * num) { _configPosY.Value = num22 / num; } GUI.Box(val4, "", _windowStyle); GUILayout.BeginArea(val4); float num23 = num2; GUIStyle val5 = new GUIStyle(_centeredStyle); val5.normal.textColor = new Color(1f, 0.85f, 0f); val5.fontStyle = (FontStyle)1; GUIStyle val6 = val5; GUIStyle val7 = new GUIStyle(_headerStyle) { fontSize = Mathf.RoundToInt(10f * num) }; if (_showFinalSnapshot) { val7.normal.textColor = new Color(1f, 0.65f, 0.2f); } else { val7.normal.textColor = new Color(0.4f, 1f, 0.4f); } string text = (_showFinalSnapshot ? "FINAL SCORE" : "LIVE"); GUI.Label(new Rect(num2, num23, num11 - num2 * 2f, num3), text, val7); num23 += num3; string currentMatchId = SBGLPlugin.CurrentMatchId; if (!string.IsNullOrWhiteSpace(currentMatchId)) { GUIStyle val8 = new GUIStyle(val7) { fontStyle = (FontStyle)0, fontSize = Mathf.RoundToInt(8f * num) }; val8.normal.textColor = new Color(0.6f, 0.6f, 0.6f); string text2 = ((currentMatchId.Length > 12) ? currentMatchId.Substring(currentMatchId.Length - 12) : currentMatchId); GUI.Label(new Rect(num2, num23, num11 - num2 * 2f, num3 * 0.7f), "ID: " + text2, val8); num23 += num3 * 0.7f; } float num24 = num2; GUI.Label(new Rect(num24, num23, num13, num3), "#", _headerStyle); num24 += num13; GUI.Label(new Rect(num24, num23, num14, num3), "PLAYER", _headerStyle); num24 += num14; GUI.Label(new Rect(num24, num23, num15, num3), "MMR", _headerStyle); num24 += num15; GUI.Label(new Rect(num24, num23, num16, num3), "PTS", _headerStyle); num24 += num16; GUI.Label(new Rect(num24, num23, num17, num3), "+/-", _headerStyle); num24 += num17; GUI.Label(new Rect(num24, num23, num18, num3), "BASE", _headerStyle); num23 += num3; if (list.Count == 0 && _showFinalSnapshot) { GUIStyle val9 = new GUIStyle(_centeredStyle); val9.normal.textColor = Color.gray; GUIStyle val10 = val9; GUI.Label(new Rect(num2, num23, num11 - num2 * 2f, num4), "Loading final scores...", val10); } else { foreach (SBGLPlayer item in list) { float num25 = num2; GUI.Label(new Rect(num25, num23, num13, num4), $"{list.IndexOf(item) + 1}.", _centeredStyle); num25 += num13; GUI.Label(new Rect(num25, num23, num14, num4), item.Name, _nameStyle); num25 += num14; string mMR = item.MMR; string text3 = item.ProjectedDisplay.Replace(mMR, "").Trim(); Vector2 val11 = _centeredStyle.CalcSize(new GUIContent(mMR)); Vector2 val12 = _centeredStyle.CalcSize(new GUIContent(text3)); float num26 = 3f * num; float num27 = val11.x + (string.IsNullOrEmpty(text3) ? 0f : (val12.x + num26)); float num28 = num25 + num15 / 2f - num27 / 2f; GUI.Label(new Rect(num28, num23, val11.x, num4), mMR, _centeredStyle); if (!string.IsNullOrEmpty(text3)) { GUIStyle val13 = (text3.Contains("+") ? _posStyle : _negStyle); GUI.Label(new Rect(num28 + val11.x + num26, num23, val12.x, num4), text3, val13); } num25 += num15; GUI.Label(new Rect(num25, num23, num16, num4), $"{item.AdjustedPoints}", val6); num25 += num16; GUI.Label(new Rect(num25, num23, num17, num4), item.RawStrokes, _centeredStyle); num25 += num17; GUI.Label(new Rect(num25, num23, num18, num4), $"{item.BaseScore}", _centeredStyle); num23 += num4; if (num23 > num20 - num2) { break; } } } GUILayout.EndArea(); } private void ScrapeData() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; if (name.Contains("Driving") || name.Contains("Range")) { _roundCacheActive = false; return; } if (!_roundCacheActive) { _lastKnownRoundPlayers.Clear(); _roundCacheActive = true; } if ((Object)(object)_cachedScoreboard == (Object)null) { _cachedScoreboard = Object.FindAnyObjectByType((FindObjectsInactive)1); } if ((Object)(object)_cachedScoreboard == (Object)null || _entriesField == null || !(_entriesField.GetValue(_cachedScoreboard) is List list) || list.Count == 0) { return; } List list2 = new List(); foreach (ScoreboardEntry item in list) { if ((Object)(object)item == (Object)null) { continue; } TextMeshProUGUI name2 = item.name; string text = CleanTMP((name2 != null) ? ((TMP_Text)name2).text : null); if (string.IsNullOrEmpty(text)) { continue; } string text2 = text.ToLowerInvariant(); if (text == "Name" || text2.Contains("spectator") || text2.Contains("observer") || text2.Contains("spectating") || text2.Contains("spec ")) { continue; } TextMeshProUGUI strokes = item.strokes; string text3 = CleanTMP((strokes != null) ? ((TMP_Text)strokes).text : null); TextMeshProUGUI courseScore = item.courseScore; string text4 = CleanTMP((courseScore != null) ? ((TMP_Text)courseScore).text : null); if (!string.IsNullOrEmpty(text3) && text3.ToUpper().Contains("SPEC")) { continue; } bool flag = Regex.IsMatch(text3 ?? string.Empty, "\\d"); bool flag2 = Regex.IsMatch(text4 ?? string.Empty, "\\d"); bool flag3 = !string.IsNullOrEmpty(text3) && Regex.IsMatch(text3, "^[\\-\\u2013\\u2014\\s]+$"); if (!flag && !flag2 && flag3) { continue; } int.TryParse(text4, out var result); int.TryParse(text3.Replace("±", "").Replace("+", "").Trim(), out var result2); string text5 = "..."; if (_mmrCache.TryGetValue(text, out (string, float) value)) { (text5, _) = value; if (Time.time - value.Item2 > 300f && !_pendingRequests.Contains(text)) { ((MonoBehaviour)this).StartCoroutine(GetMMRForPlayer(text)); } } else if (!_pendingRequests.Contains(text)) { ((MonoBehaviour)this).StartCoroutine(GetMMRForPlayer(text)); } list2.Add(new SBGLPlayer { Name = text, BaseScore = result, RawStrokes = text3, AdjustedPoints = result + result2 * -10, MMR = text5, ProjectedDisplay = text5 }); } HashSet hashSet = new HashSet(list2.Select((SBGLPlayer p) => p.Name), StringComparer.OrdinalIgnoreCase); foreach (KeyValuePair lastKnownRoundPlayer in _lastKnownRoundPlayers) { if (!hashSet.Contains(lastKnownRoundPlayer.Key) && lastKnownRoundPlayer.Value != null) { list2.Add(ClonePlayer(lastKnownRoundPlayer.Value)); } } if (list2.Count > 1) { CalculateProjectedMMR(list2); } _persistentLeaderboard = list2.OrderByDescending((SBGLPlayer p) => p.AdjustedPoints).Take(ConfigMaxPlayers).ToList(); _lastKnownRoundPlayers.Clear(); foreach (SBGLPlayer item2 in _persistentLeaderboard) { if (item2 != null && !string.IsNullOrEmpty(item2.Name)) { _lastKnownRoundPlayers[item2.Name] = ClonePlayer(item2); } } } private SBGLPlayer ClonePlayer(SBGLPlayer source) { if (source == null) { return null; } return new SBGLPlayer { Name = source.Name, BaseScore = source.BaseScore, AdjustedPoints = source.AdjustedPoints, RawStrokes = source.RawStrokes, MMR = source.MMR, ProjectedDisplay = source.ProjectedDisplay }; } private void CalculateProjectedMMR(List players) { Dictionary dictionary = new Dictionary(); foreach (SBGLPlayer player in players) { dictionary[player.Name] = 0f; } for (int i = 0; i < players.Count; i++) { for (int j = i + 1; j < players.Count; j++) { SBGLPlayer sBGLPlayer = players[i]; SBGLPlayer sBGLPlayer2 = players[j]; if (float.TryParse(sBGLPlayer.MMR, out var result) && float.TryParse(sBGLPlayer2.MMR, out var result2)) { float num = 1f / (1f + Mathf.Pow(10f, (result2 - result) / 400f)); float num2 = ((sBGLPlayer.AdjustedPoints > sBGLPlayer2.AdjustedPoints) ? 1f : ((sBGLPlayer.AdjustedPoints < sBGLPlayer2.AdjustedPoints) ? 0f : 0.5f)); float num3 = 24f * (num2 - num); dictionary[sBGLPlayer.Name] += num3; dictionary[sBGLPlayer2.Name] -= num3; } } } foreach (SBGLPlayer player2 in players) { if (float.TryParse(player2.MMR, out var _)) { int num4 = Mathf.RoundToInt(dictionary[player2.Name]); player2.ProjectedDisplay = string.Format("{0} ({1}{2})", player2.MMR, (num4 >= 0) ? "+" : "", num4); } } } [IteratorStateMachine(typeof(d__50))] private IEnumerator GetMMRForPlayer(string originalName) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__50(0) { <>4__this = this, originalName = originalName }; } [IteratorStateMachine(typeof(d__51))] private IEnumerator GetMMRFuzzyFallback(string originalName) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__51(0) { <>4__this = this, originalName = originalName }; } private string CleanTMP(string input) { return string.IsNullOrEmpty(input) ? "" : Regex.Replace(input, "<.*?>", string.Empty).Trim(); } public SBGLPlayer GetPlayerLeaderboardData(string playerName) { return _persistentLeaderboard.FirstOrDefault((SBGLPlayer p) => p.Name.Equals(playerName, StringComparison.OrdinalIgnoreCase)); } public List GetCurrentLeaderboard() { return new List(_persistentLeaderboard); } private void ResetForMainMenu() { if (_persistentLeaderboard.Count != 0 || _finalLeaderboardSnapshot.Count != 0 || _mmrCache.Count != 0) { _persistentLeaderboard.Clear(); _finalLeaderboardSnapshot.Clear(); _showFinalSnapshot = false; _lastKnownRoundPlayers.Clear(); _roundCacheActive = false; _mmrCache.Clear(); _pendingRequests.Clear(); _cachedScoreboard = null; _nextUpdateTime = Time.time + _updateInterval; Debug.Log((object)"[LiveLeaderboard] Reset leaderboard state on main menu"); } } public void CaptureLeaderboardSnapshot() { _finalLeaderboardSnapshot = (from p in _persistentLeaderboard.Select(ClonePlayer) where p != null select p).ToList(); Debug.Log((object)$"[LiveLeaderboard] Captured final snapshot: {_finalLeaderboardSnapshot.Count} players"); } public List GetFinalLeaderboardSnapshot() { if (_finalLeaderboardSnapshot.Count > 0) { return (from p in _finalLeaderboardSnapshot.Select(ClonePlayer) where p != null select p).ToList(); } return (from p in _persistentLeaderboard.Select(ClonePlayer) where p != null select p).ToList(); } } } namespace SBGL.UnifiedMod { public static class MyPluginInfo { public const string PLUGIN_GUID = "SBGL.UnifiedMod"; public const string PLUGIN_NAME = "Super Battle Golf League Unified Mod"; public const string PLUGIN_VERSION = "0.0.1"; } } namespace SBGL.UnifiedMod.Utils { public class BypassCertificate : CertificateHandler { protected override bool ValidateCertificate(byte[] certificateData) { return true; } } public static class ApiUtilities { [CompilerGenerated] private sealed class d__0 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string url; public Dictionary headers; public Action onComplete; public ManualLogSource logger; private UnityWebRequest 5__1; private Dictionary.Enumerator <>s__2; private KeyValuePair 5__3; private string 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__0(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__1 = null; <>s__2 = default(Dictionary.Enumerator); 5__3 = default(KeyValuePair); 5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Invalid comparison between Unknown and I4 try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = UnityWebRequest.Get(url); <>1__state = -3; 5__1.certificateHandler = (CertificateHandler)(object)new BypassCertificate(); if (headers != null) { <>s__2 = headers.GetEnumerator(); try { while (<>s__2.MoveNext()) { 5__3 = <>s__2.Current; 5__1.SetRequestHeader(5__3.Key, 5__3.Value); 5__3 = default(KeyValuePair); } } finally { ((IDisposable)<>s__2).Dispose(); } <>s__2 = default(Dictionary.Enumerator); } <>2__current = 5__1.SendWebRequest(); <>1__state = 1; return true; case 1: <>1__state = -3; if ((int)5__1.result == 1) { onComplete?.Invoke(arg1: true, 5__1.downloadHandler.text); } else { 5__4 = $"HTTP {5__1.responseCode}: {5__1.error}"; DownloadHandler downloadHandler = 5__1.downloadHandler; if (!string.IsNullOrEmpty((downloadHandler != null) ? downloadHandler.text : null)) { 5__4 = 5__4 + " | Response: " + 5__1.downloadHandler.text; } ManualLogSource obj = logger; if (obj != null) { obj.LogWarning((object)("[API] Request failed: " + 5__4)); } onComplete?.Invoke(arg1: false, 5__4); 5__4 = null; } <>m__Finally1(); 5__1 = null; return false; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__1 != null) { ((IDisposable)5__1).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [IteratorStateMachine(typeof(d__0))] public static IEnumerator MakeApiRequest(string url, Dictionary headers, Action onComplete, ManualLogSource logger = null) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__0(0) { url = url, headers = headers, onComplete = onComplete, logger = logger }; } public static JObject ParseJsonResponse(string json) { try { return JObject.Parse(json); } catch (Exception ex) { throw new InvalidOperationException("Failed to parse JSON response: " + ex.Message); } } public static JArray ParseJsonArrayResponse(string json) { try { return JArray.Parse(json); } catch (Exception ex) { throw new InvalidOperationException("Failed to parse JSON array response: " + ex.Message); } } } public static class PlayerProfileFetcher { public class PlayerProfile { public string ID; public string DisplayName; public float CurrentMMR; public string Region; public string ProfilePicUrl; } [CompilerGenerated] private sealed class <>c__DisplayClass1_0 { public PlayerProfile profile; public bool found; public ManualLogSource logger; public string playerIdOrName; internal void b__0(bool success, string response) { if (success) { try { JArray val = ApiUtilities.ParseJsonArrayResponse(response); if (((JContainer)val).Count > 0) { profile = new PlayerProfile { ID = (((object)val[0][(object)"id"])?.ToString() ?? ""), DisplayName = (((object)val[0][(object)"display_name"])?.ToString() ?? ""), Region = (((object)val[0][(object)"region"])?.ToString() ?? "US"), ProfilePicUrl = ((object)val[0][(object)"profile_pic_url"])?.ToString(), CurrentMMR = (float.TryParse(((object)val[0][(object)"current_mmr"])?.ToString() ?? "0", out var result) ? result : 0f) }; found = true; ManualLogSource obj = logger; if (obj != null) { obj.LogInfo((object)("[PlayerProfileFetcher] ✓ Found profile: " + profile.DisplayName + " (ID: " + profile.ID + ")")); } } else { ManualLogSource obj2 = logger; if (obj2 != null) { obj2.LogWarning((object)("[PlayerProfileFetcher] No results for: " + playerIdOrName)); } } return; } catch (Exception ex) { ManualLogSource obj3 = logger; if (obj3 != null) { obj3.LogError((object)("[PlayerProfileFetcher] Parse error: " + ex.Message)); } return; } } ManualLogSource obj4 = logger; if (obj4 != null) { obj4.LogError((object)("[PlayerProfileFetcher] Request failed: " + response)); } } } [CompilerGenerated] private sealed class <>c__DisplayClass2_0 { public PlayerProfile profile; public bool found; public ManualLogSource logger; public string playerName; internal void b__0(bool success, string response) { if (success) { try { JArray val = ApiUtilities.ParseJsonArrayResponse(response); if (((JContainer)val).Count > 0) { profile = new PlayerProfile { ID = (((object)val[0][(object)"id"])?.ToString() ?? ""), DisplayName = (((object)val[0][(object)"display_name"])?.ToString() ?? ""), Region = (((object)val[0][(object)"region"])?.ToString() ?? "US"), ProfilePicUrl = ((object)val[0][(object)"profile_pic_url"])?.ToString(), CurrentMMR = (float.TryParse(((object)val[0][(object)"current_mmr"])?.ToString() ?? "0", out var result) ? result : 0f) }; found = true; ManualLogSource obj = logger; if (obj != null) { obj.LogInfo((object)("[PlayerProfileFetcher] ✓ Fuzzy match: " + profile.DisplayName)); } } else { ManualLogSource obj2 = logger; if (obj2 != null) { obj2.LogWarning((object)("[PlayerProfileFetcher] No fuzzy matches for: " + playerName)); } } return; } catch (Exception ex) { ManualLogSource obj3 = logger; if (obj3 != null) { obj3.LogError((object)("[PlayerProfileFetcher] Fuzzy parse error: " + ex.Message)); } return; } } ManualLogSource obj4 = logger; if (obj4 != null) { obj4.LogError((object)("[PlayerProfileFetcher] Fuzzy request failed: " + response)); } } } [CompilerGenerated] private sealed class d__1 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string playerIdOrName; public string playerApiUrl; public string appId; public string authToken; public Action onComplete; public ManualLogSource logger; private <>c__DisplayClass1_0 <>8__1; private string 5__2; private string 5__3; private Dictionary 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass1_0(); <>8__1.logger = logger; <>8__1.playerIdOrName = playerIdOrName; if (string.IsNullOrEmpty(<>8__1.playerIdOrName)) { onComplete?.Invoke(arg1: false, null); return false; } 5__2 = (<>8__1.playerIdOrName.All(char.IsDigit) ? ("{\"id\":\"" + <>8__1.playerIdOrName + "\"}") : ("{\"display_name\":{\"$regex\":\"^" + <>8__1.playerIdOrName + "$\",\"$options\":\"i\"}}")); 5__3 = playerApiUrl + "?q=" + UnityWebRequest.EscapeURL(5__2); 5__4 = new Dictionary { { "X-App-Id", appId }, { "api_key", authToken } }; <>8__1.found = false; <>8__1.profile = null; <>2__current = ApiUtilities.MakeApiRequest(5__3, 5__4, delegate(bool success, string response) { if (success) { try { JArray val = ApiUtilities.ParseJsonArrayResponse(response); if (((JContainer)val).Count > 0) { <>8__1.profile = new PlayerProfile { ID = (((object)val[0][(object)"id"])?.ToString() ?? ""), DisplayName = (((object)val[0][(object)"display_name"])?.ToString() ?? ""), Region = (((object)val[0][(object)"region"])?.ToString() ?? "US"), ProfilePicUrl = ((object)val[0][(object)"profile_pic_url"])?.ToString(), CurrentMMR = (float.TryParse(((object)val[0][(object)"current_mmr"])?.ToString() ?? "0", out var result) ? result : 0f) }; <>8__1.found = true; ManualLogSource obj = <>8__1.logger; if (obj != null) { obj.LogInfo((object)("[PlayerProfileFetcher] ✓ Found profile: " + <>8__1.profile.DisplayName + " (ID: " + <>8__1.profile.ID + ")")); } } else { ManualLogSource obj2 = <>8__1.logger; if (obj2 != null) { obj2.LogWarning((object)("[PlayerProfileFetcher] No results for: " + <>8__1.playerIdOrName)); } } return; } catch (Exception ex) { ManualLogSource obj3 = <>8__1.logger; if (obj3 != null) { obj3.LogError((object)("[PlayerProfileFetcher] Parse error: " + ex.Message)); } return; } } ManualLogSource obj4 = <>8__1.logger; if (obj4 != null) { obj4.LogError((object)("[PlayerProfileFetcher] Request failed: " + response)); } }, <>8__1.logger); <>1__state = 1; return true; case 1: <>1__state = -1; onComplete?.Invoke(<>8__1.found, <>8__1.profile); 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(); } } [CompilerGenerated] private sealed class d__2 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string playerName; public string playerApiUrl; public string appId; public string authToken; public Action onComplete; public ManualLogSource logger; private <>c__DisplayClass2_0 <>8__1; private string 5__2; private string 5__3; private Dictionary 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass2_0(); <>8__1.logger = logger; <>8__1.playerName = playerName; 5__2 = "{\"display_name\":{\"$regex\":\"" + <>8__1.playerName + "\",\"$options\":\"i\"}}"; 5__3 = playerApiUrl + "?q=" + UnityWebRequest.EscapeURL(5__2); 5__4 = new Dictionary { { "X-App-Id", appId }, { "api_key", authToken } }; <>8__1.found = false; <>8__1.profile = null; <>2__current = ApiUtilities.MakeApiRequest(5__3, 5__4, delegate(bool success, string response) { if (success) { try { JArray val = ApiUtilities.ParseJsonArrayResponse(response); if (((JContainer)val).Count > 0) { <>8__1.profile = new PlayerProfile { ID = (((object)val[0][(object)"id"])?.ToString() ?? ""), DisplayName = (((object)val[0][(object)"display_name"])?.ToString() ?? ""), Region = (((object)val[0][(object)"region"])?.ToString() ?? "US"), ProfilePicUrl = ((object)val[0][(object)"profile_pic_url"])?.ToString(), CurrentMMR = (float.TryParse(((object)val[0][(object)"current_mmr"])?.ToString() ?? "0", out var result) ? result : 0f) }; <>8__1.found = true; ManualLogSource obj = <>8__1.logger; if (obj != null) { obj.LogInfo((object)("[PlayerProfileFetcher] ✓ Fuzzy match: " + <>8__1.profile.DisplayName)); } } else { ManualLogSource obj2 = <>8__1.logger; if (obj2 != null) { obj2.LogWarning((object)("[PlayerProfileFetcher] No fuzzy matches for: " + <>8__1.playerName)); } } return; } catch (Exception ex) { ManualLogSource obj3 = <>8__1.logger; if (obj3 != null) { obj3.LogError((object)("[PlayerProfileFetcher] Fuzzy parse error: " + ex.Message)); } return; } } ManualLogSource obj4 = <>8__1.logger; if (obj4 != null) { obj4.LogError((object)("[PlayerProfileFetcher] Fuzzy request failed: " + response)); } }, <>8__1.logger); <>1__state = 1; return true; case 1: <>1__state = -1; onComplete?.Invoke(<>8__1.found, <>8__1.profile); 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(); } } [IteratorStateMachine(typeof(d__1))] public static IEnumerator FetchPlayerProfile(string playerIdOrName, string playerApiUrl, string appId, string authToken, Action onComplete, ManualLogSource logger = null) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__1(0) { playerIdOrName = playerIdOrName, playerApiUrl = playerApiUrl, appId = appId, authToken = authToken, onComplete = onComplete, logger = logger }; } [IteratorStateMachine(typeof(d__2))] public static IEnumerator FuzzySearchPlayer(string playerName, string playerApiUrl, string appId, string authToken, Action onComplete, ManualLogSource logger = null) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__2(0) { playerName = playerName, playerApiUrl = playerApiUrl, appId = appId, authToken = authToken, onComplete = onComplete, logger = logger }; } } } namespace SBGL.UnifiedMod.Patches { [HarmonyPatch] public static class RulePatches { private static ManualLogSource _logger; private static ConfigEntry _applyRulesets; public static void SetLogger(ManualLogSource logger) { _logger = logger; } public static void SetApplyRulesetsConfig(ConfigEntry applyRulesets) { _applyRulesets = applyRulesets; } private static void Log(string message) { if (_logger != null) { _logger.LogInfo((object)("[RulePatches] " + message)); } } private static void LogError(string message) { if (_logger != null) { _logger.LogError((object)("[RulePatches] " + message)); } } [HarmonyPostfix] [HarmonyPatch(typeof(MatchSetupMenu), "OnStartClient")] public static void PatchMatchSetupMenuOnStartClient(MatchSetupMenu __instance) { try { if (!((NetworkBehaviour)__instance).isServer) { return; } ConfigEntry applyRulesets = _applyRulesets; if (applyRulesets != null && !applyRulesets.Value) { Log("ApplyRulesets is disabled in config — skipping rule enforcement"); return; } string @string = PlayerPrefs.GetString("MatchType", ""); bool flag = !string.IsNullOrEmpty(@string) && @string.Contains("season"); bool flag2 = string.Equals(@string, "casual", StringComparison.OrdinalIgnoreCase); if (!flag && !flag2) { Log("Not a managed ruleset match (MatchType='" + @string + "'), skipping"); return; } MatchSetupRules rules = __instance.rules; if ((Object)(object)rules == (Object)null) { LogError("__instance.rules is null"); return; } Log("=== APPLYING SEASON 1 RULES (OnStartClient) ==="); Log(" Match Type: " + @string); Log(" Host Ruleset: " + PlayerPrefs.GetString("HostRuleset", "ranked")); ApplyRulesToMatchSetup(rules); ApplyCourseSelection(__instance); Log("============================"); } catch (Exception ex) { LogError("Exception in PatchMatchSetupMenuOnStartClient: " + ex.Message); } } public static void ApplyRulesToMatchSetup(MatchSetupRules matchSetup) { //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0216: 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) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Invalid comparison between Unknown and I4 //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) string @string = PlayerPrefs.GetString("HostRuleset", "ranked"); bool flag = @string == "pro_series"; bool flag2 = @string == "casual"; matchSetup.SetPreset((Preset)0); Log("✓ Reset to Classic preset"); if (flag2) { Log("✓ Casual selected - leaving Classic preset defaults intact"); return; } if (flag) { Dictionary proSeriesRulesSettings = Season1RuleSet.GetProSeriesRulesSettings(); int num = 0; foreach (KeyValuePair item in proSeriesRulesSettings) { try { matchSetup.SetValue(item.Key, item.Value); SliderOption value2; if (matchSetup.onOffDropdownLookup.TryGetValue(item.Key, out var value)) { value.SetValue((!matchSetup.GetValueAsBoolInternal(item.Key)) ? 1 : 0); } else if (matchSetup.sliderLookup.TryGetValue(item.Key, out value2)) { value2.SetValue(matchSetup.GetValueInternal(item.Key)); } matchSetup.UpdateRule(item.Key); Log($" ✓ Set {item.Key} = {item.Value}"); num++; } catch (Exception ex) { LogError($" ✗ Failed to set {item.Key}: {ex.Message}"); } } Log($"✓ Applied {num}/{proSeriesRulesSettings.Count} Pro Series rules (item weights at game defaults)"); matchSetup.SetPreset((Preset)2); Log("✓ Set Preset to Custom"); return; } Dictionary rulesSettings = Season1RuleSet.GetRulesSettings(); int num2 = 0; foreach (KeyValuePair item2 in rulesSettings) { try { matchSetup.SetValue(item2.Key, item2.Value); SliderOption value4; if (matchSetup.onOffDropdownLookup.TryGetValue(item2.Key, out var value3)) { value3.SetValue((!matchSetup.GetValueAsBoolInternal(item2.Key)) ? 1 : 0); } else if (matchSetup.sliderLookup.TryGetValue(item2.Key, out value4)) { value4.SetValue(matchSetup.GetValueInternal(item2.Key)); } matchSetup.UpdateRule(item2.Key); if ((int)item2.Key == 11) { matchSetup.CheckAndShowCheatsWarning(); } Log($" ✓ Set {item2.Key} = {item2.Value}"); num2++; } catch (Exception ex2) { LogError($" ✗ Failed to set {item2.Key}: {ex2.Message}"); } } Log($"✓ Applied {num2}/{rulesSettings.Count} rules"); Dictionary itemSpawnWeights = Season1RuleSet.GetItemSpawnWeights(); foreach (KeyValuePair item3 in itemSpawnWeights) { matchSetup.SetSpawnChance(item3.Key.itemPoolIndex, item3.Key.itemType, item3.Value); } HashSet hashSet = new HashSet(); foreach (ItemPoolId key in itemSpawnWeights.Keys) { if (hashSet.Add(key.itemPoolIndex)) { matchSetup.ServerUpdateSpawnChanceValue(key); } } Log($"✓ Applied Season 1 item weights for {hashSet.Count} pools ({itemSpawnWeights.Count} entries)"); matchSetup.SetPreset((Preset)2); Log("✓ Set Preset to Custom"); } public static void ApplyCourseSelection(MatchSetupMenu menu) { string @string = PlayerPrefs.GetString("HostRuleset", "ranked"); bool flag = @string == "pro_series"; bool flag2 = @string == "casual"; if (flag) { Log(" Pro Series: skipping course selection (maps set manually)"); return; } if (flag2) { Log(" Casual: skipping course selection (maps set manually)"); return; } List allHoles = GameManager.AllCourses.allHoles; HashSet hashSet = new HashSet(StringComparer.OrdinalIgnoreCase); foreach (MapPoolConfig.Course approvedCourse in MapPoolConfig.GetApprovedCourses()) { hashSet.Add(approvedCourse.Name); } List list = new List(); HashSet hashSet2 = new HashSet(StringComparer.OrdinalIgnoreCase); foreach (HoleData item in allHoles) { if (hashSet.Contains(((Object)item).name)) { list.Add(item); hashSet2.Add(((Object)item).name); } } foreach (string item2 in hashSet) { if (!hashSet2.Contains(item2)) { LogError(" [UNMATCHED] Approved name '" + item2 + "' not found in allHoles — check MapPoolConfig spelling"); } } if (list.Count == 0) { LogError(" No eligible holes found — aborting course selection"); return; } MatchSetupMenu.CustomCourseData.OverrideHoles(list.ToArray()); menu.SetCourse(-1, false); menu.NetworkrandomEnabled = true; menu.courseRandomToggle.isOn = true; menu.NetworkrandomCupNumHoles = 18; menu.numberOfHolesSlider.value = 18f; Log($" ✓ Set {list.Count} eligible holes, random order ON, 18 holes"); } } } namespace SBGL.UnifiedMod.Features { public class PseudoDedicatedServer : MonoBehaviour { [CompilerGenerated] private sealed class d__19 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SBGLPlugin plugin; public PseudoDedicatedServer <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__19(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = plugin.ClaimHostRoleCoroutine(); <>1__state = 1; return true; case 1: <>1__state = -1; if (plugin.CurrentSession != null && plugin.CurrentSession.status == "pending_accept" && !<>4__this._hasAcceptedThisCycle && !plugin.HasAccepted) { <>4__this._hasAcceptedThisCycle = true; <>4__this.Log("[PDS] Claimed host — auto-accepting match..."); <>2__current = plugin.AcceptMatchCoroutine(); <>1__state = 2; return true; } break; case 2: <>1__state = -1; break; } 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(); } } [CompilerGenerated] private sealed class d__20 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float delay; public PseudoDedicatedServer <>4__this; private SBGLPlugin 5__1; private float 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__20(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(delay); <>1__state = 1; return true; case 1: <>1__state = -1; if (!<>4__this.IsEnabled() || !<>4__this._inMainMenu || <>4__this._hasQueuedThisCycle) { return false; } 5__1 = <>4__this.GetMatchmakingPlugin(); if ((Object)(object)5__1 == (Object)null) { <>4__this.Log("[PDS] SBGLPlugin not found — cannot auto-queue."); return false; } if (5__1.IsQueueing || 5__1.CurrentSession != null) { <>4__this.Log("[PDS] Already queuing or in session — skipping auto-queue."); <>4__this._hasQueuedThisCycle = true; return false; } if (5__1.UserProfile != null) { break; } <>4__this.Log("[PDS] Profile not yet resolved — waiting up to 15s..."); 5__2 = 0f; goto IL_015e; case 2: { <>1__state = -1; 5__2 += 1f; goto IL_015e; } IL_015e: if (5__1.UserProfile == null && 5__2 < 15f) { <>2__current = (object)new WaitForSeconds(1f); <>1__state = 2; return true; } if (5__1.UserProfile == null) { <>4__this.Log("[PDS] Profile still unresolved — aborting auto-queue."); return false; } break; } <>4__this._hasQueuedThisCycle = true; <>4__this.Log("[PDS] Auto-joining queue..."); ((MonoBehaviour)<>4__this).StartCoroutine(5__1.MatchmakingLoopCoroutine()); 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 ConfigEntry _enabled; private ConfigEntry _requeueDelay; private ConfigEntry _defaultRuleset; private ManualLogSource _logger; private bool _inMainMenu = false; private bool _inDrivingRange = false; private bool _hasQueuedThisCycle = false; private bool _hasClaimedHostRole = false; private bool _hasAcceptedThisCycle = false; private bool _hasHostedThisCycle = false; private bool _waitingToReturnToMenu = false; private float _returnToMenuAt = 0f; private SBGLPlugin _matchmakingPlugin; public void SetConfig(ConfigEntry enabled, ConfigEntry requeueDelay, ConfigEntry defaultRuleset, ManualLogSource logger) { _enabled = enabled; _requeueDelay = requeueDelay; _defaultRuleset = defaultRuleset; _logger = logger; } private void Awake() { SceneManager.sceneLoaded += OnSceneLoaded; Log("[PDS] Pseudo Dedicated Server component loaded."); } private void OnDestroy() { SceneManager.sceneLoaded -= OnSceneLoaded; } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { string text = ((Scene)(ref scene)).name.ToLower(); _inMainMenu = text.Contains("menu"); _inDrivingRange = text.Contains("drivingrange") || text.Contains("driving range"); if (!IsEnabled()) { return; } if (_inMainMenu) { Log("[PDS] Entered main menu — resetting cycle state."); _hasQueuedThisCycle = false; _hasClaimedHostRole = false; _hasAcceptedThisCycle = false; _hasHostedThisCycle = false; _waitingToReturnToMenu = false; ((MonoBehaviour)this).StartCoroutine(TryAutoQueueAfterDelay(2.5f)); } else if (_inDrivingRange) { Log("[PDS] Entered driving range."); if (!_waitingToReturnToMenu) { _waitingToReturnToMenu = true; float num = _requeueDelay?.Value ?? 10f; _returnToMenuAt = Time.time + num; Log($"[PDS] Will return to main menu in {num}s to requeue."); } } else { _waitingToReturnToMenu = false; } } private void Update() { if (IsEnabled()) { if (_inDrivingRange && _waitingToReturnToMenu && Time.time >= _returnToMenuAt) { _waitingToReturnToMenu = false; Log("[PDS] Requeue delay elapsed — returning to main menu."); ReturnToMainMenu(); } else if (_inMainMenu) { PollSessionActions(); } } } private void PollSessionActions() { SBGLPlugin matchmakingPlugin = GetMatchmakingPlugin(); if ((Object)(object)matchmakingPlugin == (Object)null) { return; } SBGLPlugin.MatchmakingSession currentSession = matchmakingPlugin.CurrentSession; if (currentSession == null) { return; } if (!_hasClaimedHostRole && !matchmakingPlugin.IsHost && (currentSession.status == "pending_accept" || currentSession.status == "ready")) { _hasClaimedHostRole = true; Log("[PDS] Claiming host role (PATCHing host_player_id)..."); ((MonoBehaviour)this).StartCoroutine(ClaimThenAccept(matchmakingPlugin)); return; } if (_hasClaimedHostRole && !_hasAcceptedThisCycle && !matchmakingPlugin.HasAccepted && currentSession.status == "pending_accept") { _hasAcceptedThisCycle = true; Log("[PDS] Auto-accepting match..."); ((MonoBehaviour)this).StartCoroutine(matchmakingPlugin.AcceptMatchCoroutine()); } if (currentSession.status == "ready" && matchmakingPlugin.IsHost && matchmakingPlugin.HasAccepted && !_hasHostedThisCycle) { _hasHostedThisCycle = true; Log("[PDS] Auto-initializing host lobby (ruleset: " + GetRuleset() + ")..."); PlayerPrefs.SetString("HostRuleset", GetRuleset()); PlayerPrefs.Save(); matchmakingPlugin.InitiateHostSequencePublic(); } } [IteratorStateMachine(typeof(d__19))] private IEnumerator ClaimThenAccept(SBGLPlugin plugin) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__19(0) { <>4__this = this, plugin = plugin }; } [IteratorStateMachine(typeof(d__20))] private IEnumerator TryAutoQueueAfterDelay(float delay) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__20(0) { <>4__this = this, delay = delay }; } private void ReturnToMainMenu() { Log("[PDS] Loading MainMenu scene..."); try { SceneManager.LoadScene("MainMenu"); } catch (Exception ex) { Log("[PDS] LoadScene('MainMenu') failed (" + ex.Message + ") — trying scene index 0."); try { SceneManager.LoadScene(0); } catch (Exception ex2) { Log("[PDS] Fallback LoadScene(0) also failed: " + ex2.Message); } } } private bool IsEnabled() { return _enabled?.Value ?? false; } private string GetRuleset() { return _defaultRuleset?.Value ?? "ranked"; } private SBGLPlugin GetMatchmakingPlugin() { if ((Object)(object)_matchmakingPlugin != (Object)null) { return _matchmakingPlugin; } _matchmakingPlugin = Object.FindAnyObjectByType(); return _matchmakingPlugin; } private void Log(string msg) { if (_logger != null) { _logger.LogInfo((object)msg); } else { Debug.Log((object)msg); } } } public class RuleSetDisplayManager : MonoBehaviour { private ConfigEntry _posX; private ConfigEntry _posY; private ConfigEntry _showDetails; private ConfigEntry _applyRulesets; private GUIStyle _labelStyle; private GUIStyle _smallBtnStyle; private GUIStyle _tooltipStyle; private Texture2D _bgTexture; private Texture2D _tooltipBgTexture; private string _tooltipRanked = null; private string _tooltipPro = null; private string _tooltipCasual = null; private string _noRulesetTooltip = "Applies Classic preset only.\nNo Season 1 rules or item bans enforced."; private string _lastSceneName = string.Empty; private bool _defaultAppliedForScene = false; public void SetConfig(ConfigEntry posX, ConfigEntry posY, ConfigEntry showDetails, ConfigEntry applyRulesets = null) { _posX = posX; _posY = posY; _showDetails = showDetails; _applyRulesets = applyRulesets; } public void Awake() { Debug.Log((object)"[RuleSetDisplayManager] Awake - Feature loaded"); SceneManager.sceneLoaded += OnSceneLoaded; } private void OnDestroy() { SceneManager.sceneLoaded -= OnSceneLoaded; } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { string text = ((Scene)(ref scene)).name.ToLower(); if (text.Contains("menu")) { PlayerPrefs.SetString("HostRuleset", "ranked"); PlayerPrefs.SetString("MatchType", "ranked_season_1"); PlayerPrefs.SetInt("Season", 1); PlayerPrefs.Save(); Debug.Log((object)"[RuleSetDisplayManager] Returned to main menu — ruleset reset to ranked"); } } public void OnGUI() { //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) try { Scene activeScene = SceneManager.GetActiveScene(); string text = ((Scene)(ref activeScene)).name.ToLower(); if (!string.Equals(text, _lastSceneName, StringComparison.Ordinal)) { _lastSceneName = text; _defaultAppliedForScene = false; } if ((text.Contains("drivingrange") || text.Contains("driving range")) && NetworkServer.active) { EnsureDefaultRankedForScene(); RenderPanel(); } } catch (Exception ex) { Debug.LogError((object)("[RuleSetDisplayManager] OnGUI error: " + ex.Message + "\n" + ex.StackTrace)); } } private void EnsureDefaultRankedForScene() { if (!_defaultAppliedForScene) { _defaultAppliedForScene = true; PlayerPrefs.SetString("HostRuleset", "ranked"); PlayerPrefs.SetString("MatchType", "ranked_season_1"); PlayerPrefs.SetInt("Season", 1); string @string = PlayerPrefs.GetString("SelectedCourse", ""); if (string.IsNullOrWhiteSpace(@string)) { MapPoolConfig.Course randomApprovedCourse = MapPoolConfig.GetRandomApprovedCourse(); PlayerPrefs.SetString("SelectedCourse", randomApprovedCourse.Name); } PlayerPrefs.Save(); Debug.Log((object)"[RuleSetDisplayManager] Defaulted ruleset to ranked for this driving-range session"); } } private void RenderPanel() { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0039: 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) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019b: 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_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Expected O, but got Unknown //IL_01b8: Expected O, but got Unknown //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Expected O, but got Unknown //IL_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Expected O, but got Unknown //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Expected O, but got Unknown //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Expected O, but got Unknown //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_0444: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_049c: Unknown result type (might be due to invalid IL or missing references) //IL_04ae: Unknown result type (might be due to invalid IL or missing references) //IL_050a: Unknown result type (might be due to invalid IL or missing references) //IL_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_0515: Unknown result type (might be due to invalid IL or missing references) //IL_0562: Unknown result type (might be due to invalid IL or missing references) //IL_055b: Unknown result type (might be due to invalid IL or missing references) //IL_056d: Unknown result type (might be due to invalid IL or missing references) //IL_05b2: Unknown result type (might be due to invalid IL or missing references) //IL_05c2: Unknown result type (might be due to invalid IL or missing references) //IL_05c8: Invalid comparison between Unknown and I4 //IL_05d9: Unknown result type (might be due to invalid IL or missing references) //IL_05de: Unknown result type (might be due to invalid IL or missing references) //IL_05e5: Unknown result type (might be due to invalid IL or missing references) //IL_077c: Unknown result type (might be due to invalid IL or missing references) //IL_07ae: Unknown result type (might be due to invalid IL or missing references) //IL_07e6: Unknown result type (might be due to invalid IL or missing references) //IL_081e: Unknown result type (might be due to invalid IL or missing references) //IL_05fe: Unknown result type (might be due to invalid IL or missing references) //IL_0617: Unknown result type (might be due to invalid IL or missing references) //IL_0630: Unknown result type (might be due to invalid IL or missing references) //IL_0662: Unknown result type (might be due to invalid IL or missing references) //IL_0669: Expected O, but got Unknown //IL_067a: Unknown result type (might be due to invalid IL or missing references) //IL_0689: Unknown result type (might be due to invalid IL or missing references) //IL_06ab: Unknown result type (might be due to invalid IL or missing references) //IL_06ea: Unknown result type (might be due to invalid IL or missing references) //IL_06d0: Unknown result type (might be due to invalid IL or missing references) if (_labelStyle == null) { GUISkin skin = GUI.skin; _labelStyle = new GUIStyle((GUIStyle)(((object)((skin != null) ? skin.label : null)) ?? ((object)new GUIStyle()))) { alignment = (TextAnchor)3, fontSize = 14, fontStyle = (FontStyle)1, richText = true }; } if (_smallBtnStyle == null) { GUISkin skin2 = GUI.skin; _smallBtnStyle = new GUIStyle((GUIStyle)(((object)((skin2 != null) ? skin2.button : null)) ?? ((object)new GUIStyle()))) { fontSize = 10, fontStyle = (FontStyle)1, richText = true }; } if ((Object)(object)_bgTexture == (Object)null) { _bgTexture = new Texture2D(1, 1); _bgTexture.SetPixel(0, 0, new Color(0.1f, 0.1f, 0.1f, 0.8f)); _bgTexture.Apply(); } if ((Object)(object)_tooltipBgTexture == (Object)null) { _tooltipBgTexture = new Texture2D(1, 1); _tooltipBgTexture.SetPixel(0, 0, new Color(0.05f, 0.05f, 0.05f, 0.95f)); _tooltipBgTexture.Apply(); } if (_tooltipStyle == null) { GUISkin skin3 = GUI.skin; _tooltipStyle = new GUIStyle((GUIStyle)(((object)((skin3 != null) ? skin3.box : null)) ?? ((object)new GUIStyle()))) { alignment = (TextAnchor)0, fontSize = 14, wordWrap = true, richText = true, padding = new RectOffset(8, 8, 6, 6) }; _tooltipStyle.normal.background = _tooltipBgTexture; _tooltipStyle.normal.textColor = Color.white; } bool flag = _showDetails?.Value ?? false; ConfigEntry applyRulesets = _applyRulesets; string text = ((applyRulesets == null || applyRulesets.Value) ? PlayerPrefs.GetString("HostRuleset", "ranked") : "none"); float num = 450f; float num2 = 40f; float num3 = (flag ? 110f : 0f); float num4 = 30f + num2 + num3 + 10f; float num5 = _posX?.Value ?? (-1f); float num6 = ((num5 < 0f) ? ((float)Screen.width - num - 20f) : num5); float num7 = _posY?.Value ?? 20f; GUI.DrawTexture(new Rect(num6, num7, num, num4), (Texture)(object)_bgTexture); GUI.Box(new Rect(num6, num7, num, num4), "APPLY RULESET"); float num8 = num7 + 28f; float num9 = (num - 50f) / 4f; float num10 = num6 + 10f; float num11 = num10 + num9 + 10f; float num12 = num11 + num9 + 10f; float num13 = num12 + num9 + 10f; if (_tooltipRanked == null) { int count = MapPoolConfig.GetApprovedCourses().Count; _tooltipRanked = Season1RuleSet.BuildRulesDescription(Season1RuleSet.GetRulesSettings()) + "\nBanned Items: " + Season1RuleSet.BuildBannedItemsDescription() + "" + $"\nCourses: Random ({count} approved)"; } if (_tooltipPro == null) { _tooltipPro = Season1RuleSet.BuildRulesDescription(Season1RuleSet.GetProSeriesRulesSettings()) + "\nItems: Game defaults (all enabled)\nCourses: Manual selection"; } if (_tooltipCasual == null) { _tooltipCasual = "Applies Classic preset only.\nItems: Game defaults (all enabled)\nCourses: Manual selection\nNo MMR impact. Only casual matches played is tracked."; } GUIContent val = new GUIContent("RANKED"); GUIContent val2 = new GUIContent("PRO SERIES"); GUIContent val3 = new GUIContent("CASUAL"); GUIContent val4 = new GUIContent("NO RULESET"); Rect val5 = default(Rect); ((Rect)(ref val5))..ctor(num10, num8, num9, num2); Rect val6 = default(Rect); ((Rect)(ref val6))..ctor(num11, num8, num9, num2); Rect val7 = default(Rect); ((Rect)(ref val7))..ctor(num12, num8, num9, num2); Rect val8 = default(Rect); ((Rect)(ref val8))..ctor(num13, num8, num9, num2); GUI.backgroundColor = ((text == "ranked") ? Color.green : Color.grey); if (GUI.Button(val5, val)) { if (_applyRulesets != null) { _applyRulesets.Value = true; } ApplyRuleset("ranked"); } GUI.backgroundColor = ((text == "pro_series") ? Color.magenta : Color.grey); if (GUI.Button(val6, val2)) { if (_applyRulesets != null) { _applyRulesets.Value = true; } ApplyRuleset("pro_series"); } GUI.backgroundColor = (Color)((text == "casual") ? new Color(0.2f, 0.75f, 1f) : Color.grey); if (GUI.Button(val7, val3)) { if (_applyRulesets != null) { _applyRulesets.Value = true; } ApplyRuleset("casual"); } GUI.backgroundColor = ((text == "none") ? Color.yellow : Color.grey); if (GUI.Button(val8, val4, _smallBtnStyle)) { if (_applyRulesets != null) { _applyRulesets.Value = false; } ResetToClassicPreset(); Debug.Log((object)"[RuleSetDisplayManager] Ruleset enforcement disabled via No Ruleset button"); } GUI.backgroundColor = Color.white; if ((int)Event.current.type == 7) { Vector2 mousePosition = Event.current.mousePosition; string text2 = null; if (((Rect)(ref val5)).Contains(mousePosition)) { text2 = _tooltipRanked; } else if (((Rect)(ref val6)).Contains(mousePosition)) { text2 = _tooltipPro; } else if (((Rect)(ref val7)).Contains(mousePosition)) { text2 = _tooltipCasual; } else if (((Rect)(ref val8)).Contains(mousePosition)) { text2 = _noRulesetTooltip; } if (!string.IsNullOrEmpty(text2)) { float num14 = 280f; GUIContent val9 = new GUIContent(text2); float num15 = _tooltipStyle.CalcHeight(val9, num14); float num16 = mousePosition.x + 14f; float num17 = mousePosition.y + 14f; if (num16 + num14 > (float)Screen.width) { num16 = mousePosition.x - num14 - 6f; } if (num17 + num15 > (float)Screen.height) { num17 = mousePosition.y - num15 - 6f; } GUI.Box(new Rect(num16, num17, num14, num15), val9, _tooltipStyle); } } if (flag) { string @string = PlayerPrefs.GetString("MatchType", "—"); string string2 = PlayerPrefs.GetString("SelectedCourse", "—"); int @int = PlayerPrefs.GetInt("Season", 0); string string3 = PlayerPrefs.GetString("HostRuleset", "—"); float num18 = num6 + 10f; float num19 = num8 + num2 + 8f; float num20 = 20f; float num21 = 22f; GUI.Label(new Rect(num18, num19, num - 20f, num20), "Type: " + @string + "", _labelStyle); GUI.Label(new Rect(num18, num19 + num21, num - 20f, num20), "Course: " + string2 + "", _labelStyle); GUI.Label(new Rect(num18, num19 + num21 * 2f, num - 20f, num20), $"Season: {@int}", _labelStyle); GUI.Label(new Rect(num18, num19 + num21 * 3f, num - 20f, num20), "Ruleset: " + string3 + "", _labelStyle); } } private void ApplyRuleset(string rulesetName) { Debug.Log((object)("[RuleSetDisplayManager] Applying ruleset: " + rulesetName)); PlayerPrefs.SetString("HostRuleset", rulesetName); int num = 1; switch (rulesetName) { case "ranked": PlayerPrefs.SetString("MatchType", "ranked_season_1"); break; case "pro_series": PlayerPrefs.SetString("MatchType", "pro_series_season_1"); break; case "casual": PlayerPrefs.SetString("MatchType", "casual"); num = 0; break; } PlayerPrefs.SetInt("Season", num); if (rulesetName == "ranked") { MapPoolConfig.Course randomApprovedCourse = MapPoolConfig.GetRandomApprovedCourse(); PlayerPrefs.SetString("SelectedCourse", randomApprovedCourse.Name); PlayerPrefs.Save(); Debug.Log((object)$"[RuleSetDisplayManager] ✓ Ruleset {rulesetName} applied. Season={num}, Course={randomApprovedCourse.Name}. Stored in PlayerPrefs"); } else { PlayerPrefs.Save(); Debug.Log((object)$"[RuleSetDisplayManager] ✓ Ruleset {rulesetName} applied. Season={num}. Course preserved (manual selection mode). Stored in PlayerPrefs"); } ApplyRulesToExistingMatchSetupRules(); } private void ApplyRulesToExistingMatchSetupRules() { try { MatchSetupMenu val = Object.FindAnyObjectByType(); if ((Object)(object)val == (Object)null || !((NetworkBehaviour)val).isServer) { Debug.Log((object)"[RuleSetDisplayManager] Match setup menu not open - rules will be applied automatically when it opens"); return; } MatchSetupRules rules = val.rules; if ((Object)(object)rules == (Object)null) { Debug.Log((object)"[RuleSetDisplayManager] MatchSetupMenu.rules is null"); return; } Debug.Log((object)"[RuleSetDisplayManager] ✓ Match setup menu is open - applying rules NOW"); RulePatches.ApplyRulesToMatchSetup(rules); RulePatches.ApplyCourseSelection(val); } catch (Exception ex) { Debug.LogError((object)("[RuleSetDisplayManager] Error applying rules: " + ex.Message + "\n" + ex.StackTrace)); } } private void ResetToClassicPreset() { try { MatchSetupMenu val = Object.FindAnyObjectByType(); if (!((Object)(object)val == (Object)null) && ((NetworkBehaviour)val).isServer) { MatchSetupRules rules = val.rules; if (!((Object)(object)rules == (Object)null)) { rules.SetPreset((Preset)0); Debug.Log((object)"[RuleSetDisplayManager] ✓ Reset to Classic preset (No Ruleset)"); } } } catch (Exception ex) { Debug.LogError((object)("[RuleSetDisplayManager] Error resetting to Classic: " + ex.Message)); } } } } namespace SBGL.UnifiedMod.Features.CompetitivePluginCheck { public class ProSeriesEvent { public string name; public string event_date; } public class MatchEntry { public string match_summary; public string match_date; } public class CompetitivePluginCheck : MonoBehaviour { private class PlayerComplianceStatus { public ulong SteamId { get; set; } public bool HasReportedMods { get; set; } public bool IsCompliant { get; set; } public bool HasMelonLoader { get; set; } public string ModList { get; set; } public float FirstSeenTime { get; set; } } private class LocalPluginScanResult { public List MissingModNames { get; } = new List(); public List TamperedModNames { get; } = new List(); public List SuspiciousRuntimeAssemblies { get; } = new List(); public bool HasIllegalMods { get; set; } } private sealed class AllowedModsSnapshot { [CompilerGenerated] private sealed class d__13 : IEnumerable, IEnumerable, IEnumerator, IEnumerator, IDisposable { private int <>1__state; private string <>2__current; private int <>l__initialThreadId; private HashSet installedGuids; public HashSet <>3__installedGuids; public AllowedModsSnapshot <>4__this; private Dictionary.Enumerator <>s__1; private KeyValuePair 5__2; string IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__13(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } <>s__1 = default(Dictionary.Enumerator); 5__2 = default(KeyValuePair); <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>s__1 = <>4__this._displayNamesByGuid.GetEnumerator(); <>1__state = -3; break; case 1: <>1__state = -3; 5__2 = default(KeyValuePair); break; } while (<>s__1.MoveNext()) { 5__2 = <>s__1.Current; if (ShouldIgnorePluginGuid(5__2.Key) || installedGuids.Contains(5__2.Key)) { continue; } <>2__current = 5__2.Value; <>1__state = 1; return true; } <>m__Finally1(); <>s__1 = default(Dictionary.Enumerator); return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>s__1).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { d__13 d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; d__ = this; } else { d__ = new d__13(0) { <>4__this = <>4__this }; } d__.installedGuids = <>3__installedGuids; return d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } public static readonly AllowedModsSnapshot Empty = new AllowedModsSnapshot(new HashSet(StringComparer.OrdinalIgnoreCase), new Dictionary(StringComparer.OrdinalIgnoreCase), null); private readonly HashSet _allowedGuids; private readonly Dictionary _displayNamesByGuid; private readonly Dictionary> _allowedHashesByGuid; public int Count => _displayNamesByGuid.Count; public bool HasHashConstraints => _allowedHashesByGuid != null; public IEnumerable DisplayNames => _displayNamesByGuid.Values; private AllowedModsSnapshot(HashSet allowedGuids, Dictionary displayNamesByGuid, Dictionary> allowedHashesByGuid) { _allowedGuids = allowedGuids; _displayNamesByGuid = displayNamesByGuid; _allowedHashesByGuid = allowedHashesByGuid; } public bool ContainsGuid(string guid) { return !string.IsNullOrWhiteSpace(guid) && _allowedGuids.Contains(guid); } public HashSet GetAllowedHashes(string guid) { if (_allowedHashesByGuid == null || string.IsNullOrWhiteSpace(guid)) { return null; } _allowedHashesByGuid.TryGetValue(guid, out var value); return value; } [IteratorStateMachine(typeof(d__13))] public IEnumerable GetMissingModNames(HashSet installedGuids) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__13(-2) { <>4__this = this, <>3__installedGuids = installedGuids }; } public static AllowedModsSnapshot FromJson(string json) { HashSet hashSet = new HashSet(StringComparer.OrdinalIgnoreCase); Dictionary dictionary = new Dictionary(StringComparer.OrdinalIgnoreCase); Dictionary> dictionary2 = new Dictionary>(StringComparer.OrdinalIgnoreCase); try { JObject val = JObject.Parse(json); JToken obj = val["mods"]; JArray val2 = (JArray)(object)((obj is JArray) ? obj : null); if (val2 == null) { return Empty; } foreach (JToken item in val2) { JToken obj2 = item[(object)"guid"]; string text = ((obj2 != null) ? Extensions.Value((IEnumerable)obj2) : null); JToken obj3 = item[(object)"name"]; string text2 = ((obj3 != null) ? Extensions.Value((IEnumerable)obj3) : null); if (string.IsNullOrWhiteSpace(text)) { continue; } hashSet.Add(text); dictionary[text] = (string.IsNullOrWhiteSpace(text2) ? text : text2); JToken obj4 = item[(object)"assemblies"]; JArray val3 = (JArray)(object)((obj4 is JArray) ? obj4 : null); if (val3 == null || ((JContainer)val3).Count <= 0) { continue; } HashSet hashSet2 = new HashSet(StringComparer.OrdinalIgnoreCase); foreach (JToken item2 in val3) { JToken obj5 = item2[(object)"sha256"]; string text3 = ((obj5 != null) ? Extensions.Value((IEnumerable)obj5) : null); if (!string.IsNullOrWhiteSpace(text3)) { hashSet2.Add(text3); } } if (hashSet2.Count > 0) { dictionary2[text] = hashSet2; } } } catch (Exception ex) { Debug.LogWarning((object)("[CompCheck] Failed to parse approved mods JSON manifest: " + ex.Message)); return Empty; } return new AllowedModsSnapshot(hashSet, dictionary, dictionary2); } public static AllowedModsSnapshot FromText(string rawText) { HashSet hashSet = new HashSet(StringComparer.OrdinalIgnoreCase); Dictionary dictionary = new Dictionary(StringComparer.OrdinalIgnoreCase); string[] array = rawText.Split('\n'); foreach (string text in array) { if (string.IsNullOrWhiteSpace(text)) { continue; } string text2; string text3; if (text.Contains("|")) { string[] array2 = text.Split('|'); if (array2.Length < 2) { continue; } text2 = array2[0].Trim(); text3 = array2[1].Trim(); } else { text3 = text.Trim(); text2 = text3; } if (!string.IsNullOrWhiteSpace(text3)) { hashSet.Add(text3); dictionary[text3] = (string.IsNullOrWhiteSpace(text2) ? text3 : text2); } } return new AllowedModsSnapshot(hashSet, dictionary, null); } public static AllowedModsSnapshot Parse(string rawText) { if (string.IsNullOrWhiteSpace(rawText)) { return Empty; } string text = rawText.TrimStart(); return text.StartsWith("{") ? FromJson(text) : FromText(rawText); } } private sealed class KnownVisibleRuntimeAssemblies { public HashSet ExactAssemblyPaths { get; } = new HashSet(StringComparer.OrdinalIgnoreCase); public HashSet AllowedCompanionAssemblyNames { get; } = new HashSet(StringComparer.OrdinalIgnoreCase); } [CompilerGenerated] private sealed class d__145 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CompetitivePluginCheck <>4__this; private float 5__1; private SharedPlayerProfile 5__2; private float 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__145(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = 0f; goto IL_0078; case 1: <>1__state = -1; 5__1 += 0.5f; goto IL_0078; case 2: <>1__state = -1; 5__3 = <>4__this._configUpdateInterval.Value * 60f; goto IL_01a2; case 3: { <>1__state = -1; 5__3 -= 1f; goto IL_01a2; } IL_01a2: if (5__3 > 0f) { <>4__this._timeUntilNextUpdate = 5__3; <>4__this.UpdateUIReport(); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 3; return true; } break; IL_0078: if (!UnifiedPlugin.IsPlayerProfileResolved() && 5__1 < 12f) { <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; } if (UnifiedPlugin.IsPlayerProfileResolved()) { 5__2 = UnifiedPlugin.GetPlayerProfile(); Debug.Log((object)("[CompetitivePluginCheck] Profile now resolved: " + 5__2.DisplayName + " (ID: " + 5__2.ID + ")")); 5__2 = null; } break; } <>2__current = <>4__this.TriggerFullSync(<>4__this.ConfigPlayerId?.Trim()); <>1__state = 2; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__154 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CompetitivePluginCheck <>4__this; private string 5__1; private UnityWebRequest 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__154(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__1 = null; 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Invalid comparison between Unknown and I4 try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = "https://gist.githubusercontent.com/Kingcox22/59765f02af8dd87179ca920409ff3b27/raw/Approved_Mods.json?t=" + DateTime.Now.Ticks; 5__2 = UnityWebRequest.Get(5__1); <>1__state = -3; <>2__current = 5__2.SendWebRequest(); <>1__state = 1; return true; case 1: <>1__state = -3; if ((int)5__2.result == 1) { <>4__this._allowedModsSnapshot = AllowedModsSnapshot.Parse(5__2.downloadHandler.text); } <>m__Finally1(); 5__2 = null; return false; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__2 != null) { ((IDisposable)5__2).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__153 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string url; public CompetitivePluginCheck <>4__this; private UnityWebRequest 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__153(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Invalid comparison between Unknown and I4 try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (string.IsNullOrEmpty(url)) { return false; } if (url.StartsWith("http://")) { url = url.Replace("http://", "https://"); } 5__1 = UnityWebRequestTexture.GetTexture(url); <>1__state = -3; <>2__current = 5__1.SendWebRequest(); <>1__state = 1; return true; case 1: <>1__state = -3; if ((int)5__1.result == 1) { <>4__this._profileIcon.texture = (Texture)(object)DownloadHandlerTexture.GetContent(5__1); <>4__this._profilePicContainer.SetActive(true); } <>m__Finally1(); 5__1 = null; return false; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__1 != null) { ((IDisposable)5__1).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__148 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CompetitivePluginCheck <>4__this; private string 5__1; private string 5__2; private string 5__3; private UnityWebRequest 5__4; private JArray 5__5; private DateTime 5__6; private IEnumerator <>s__7; private JToken 5__8; private string 5__9; private DateTime
5__10; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__148(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; 5__5 = null; <>s__7 = null; 5__8 = null; 5__9 = null; <>1__state = -2; } private bool MoveNext() { //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Invalid comparison between Unknown and I4 try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = UnifiedPlugin.GetCurrentAppId(); 5__2 = UnifiedPlugin.GetCurrentAuthToken(); 5__3 = "https://sbgleague.com/api/apps/" + 5__1 + "/entities/ProSeriesEvent?sort=event_date&limit=50"; 5__4 = UnityWebRequest.Get(5__3); <>1__state = -3; 5__4.SetRequestHeader("X-App-Id", 5__1); 5__4.SetRequestHeader("api_key", 5__2); 5__4.certificateHandler = (CertificateHandler)(object)new BypassCertificate(); <>2__current = 5__4.SendWebRequest(); <>1__state = 1; return true; case 1: <>1__state = -3; if ((int)5__4.result == 1) { try { 5__5 = JArray.Parse(5__4.downloadHandler.text); <>4__this._upcomingEvents.Clear(); 5__6 = DateTime.Now.Date; <>s__7 = 5__5.GetEnumerator(); try { while (<>s__7.MoveNext()) { 5__8 = <>s__7.Current; 5__9 = ((object)5__8[(object)"event_date"])?.ToString() ?? ""; if (DateTime.TryParse(5__9, out
5__10) &&
5__10.Date >= 5__6) { <>4__this._upcomingEvents.Add(new ProSeriesEvent { name = (((object)5__8[(object)"name"])?.ToString() ?? "Tournament"), event_date = 5__9 }); if (<>4__this._upcomingEvents.Count >= 5) { break; } } 5__9 = null; 5__8 = null; } } finally { if (<>s__7 != null) { <>s__7.Dispose(); } } <>s__7 = null; 5__5 = null; } catch { } } <>m__Finally1(); 5__4 = null; return false; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__4 != null) { ((IDisposable)5__4).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__151 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string id; public CompetitivePluginCheck <>4__this; private string 5__1; private string 5__2; private string 5__3; private string 5__4; private UnityWebRequest 5__5; private JArray 5__6; private int 5__7; private IEnumerator <>s__8; private JToken

5__9; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__151(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; 5__5 = null; 5__6 = null; <>s__8 = null;

5__9 = null; <>1__state = -2; } private bool MoveNext() { //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Invalid comparison between Unknown and I4 try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = "%7B%22matches_played%22%3A%7B%22%24gt%22%3A0%7D%7D"; 5__2 = UnifiedPlugin.GetCurrentAppId(); 5__3 = UnifiedPlugin.GetCurrentAuthToken(); 5__4 = "https://sbgleague.com/api/apps/" + 5__2 + "/entities/Player?q=" + 5__1 + "&sort=-current_mmr"; 5__5 = UnityWebRequest.Get(5__4); <>1__state = -3; 5__5.SetRequestHeader("X-App-Id", 5__2); 5__5.SetRequestHeader("api_key", 5__3); 5__5.certificateHandler = (CertificateHandler)(object)new BypassCertificate(); <>2__current = 5__5.SendWebRequest(); <>1__state = 1; return true; case 1: <>1__state = -3; if ((int)5__5.result == 1) { try { 5__6 = JArray.Parse(5__5.downloadHandler.text); <>4__this._totalPlayers = ((JContainer)5__6).Count.ToString(); 5__7 = 1; <>s__8 = 5__6.GetEnumerator(); try { while (<>s__8.MoveNext()) {

5__9 = <>s__8.Current; if (((object)

5__9[(object)"id"])?.ToString() == id) { <>4__this._playerRank = 5__7.ToString(); break; } 5__7++;

5__9 = null; } } finally { if (<>s__8 != null) { <>s__8.Dispose(); } } <>s__8 = null; 5__6 = null; } catch { } } <>m__Finally1(); 5__5 = null; return false; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__5 != null) { ((IDisposable)5__5).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__150 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string id; public CompetitivePluginCheck <>4__this; private string 5__1; private string 5__2; private string 5__3; private UnityWebRequest 5__4; private JArray 5__5; private JToken

5__6; private float 5__7; private float 5__8; private float 5__9; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__150(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; 5__5 = null;

5__6 = null; <>1__state = -2; } private bool MoveNext() { //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Invalid comparison between Unknown and I4 bool result; try { switch (<>1__state) { default: result = false; break; case 0: <>1__state = -1; 5__1 = UnifiedPlugin.GetCurrentAppId(); 5__2 = UnifiedPlugin.GetCurrentAuthToken(); 5__3 = "https://sbgleague.com/api/apps/" + 5__1 + "/entities/Player?q=" + UnityWebRequest.EscapeURL("{\"id\":\"" + id + "\"}"); 5__4 = UnityWebRequest.Get(5__3); <>1__state = -3; 5__4.SetRequestHeader("X-App-Id", 5__1); 5__4.SetRequestHeader("api_key", 5__2); 5__4.certificateHandler = (CertificateHandler)(object)new BypassCertificate(); <>2__current = 5__4.SendWebRequest(); <>1__state = 1; result = true; break; case 1: { <>1__state = -3; if ((int)5__4.result == 1) { try { 5__5 = JArray.Parse(5__4.downloadHandler.text); if (((JContainer)5__5).Count != 0) {

5__6 = 5__5[0]; <>4__this._activeUsername = ((object)

5__6[(object)"display_name"])?.ToString() ?? "Player"; <>4__this._playerMMR = ((object)

5__6[(object)"current_mmr"])?.ToString() ?? "0"; <>4__this._playerPeak = ((object)

5__6[(object)"highest_mmr_ever"])?.ToString() ?? "0"; <>4__this._matches = ((object)

5__6[(object)"matches_played"])?.ToString() ?? "0"; <>4__this._lastChange = ((object)

5__6[(object)"latest_mmr_change"])?.ToString() ?? "0"; <>4__this._top3s = ((object)

5__6[(object)"top_3_finishes"])?.ToString() ?? "0"; float.TryParse(((object)

5__6[(object)"average_score_vs_par"])?.ToString() ?? "0", out 5__7); <>4__this._avgScore = 5__7.ToString("F1"); 5__8 = 0f; 5__9 = 0f; float.TryParse(((object)

5__6[(object)"wins"])?.ToString(), out 5__8); float.TryParse(((object)

5__6[(object)"matches_played"])?.ToString(), out 5__9); <>4__this._winRate = ((5__9 > 0f) ? $"{5__8 / 5__9 * 100f:F0}%" : "0%"); if (

5__6[(object)"profile_pic_url"] != null && !string.IsNullOrEmpty(((object)

5__6[(object)"profile_pic_url"]).ToString())) { ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.DownloadProfilePic(((object)

5__6[(object)"profile_pic_url"]).ToString())); } 5__5 = null;

5__6 = null; goto IL_0416; } <>4__this.ResetPlayerData("Invalid ID"); result = false; } catch { <>4__this.ResetPlayerData("Data Error"); goto IL_0416; } <>m__Finally1(); break; } <>4__this.ResetPlayerData("API Offline"); goto IL_0416; } IL_0416: <>m__Finally1(); 5__4 = null; result = false; break; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } return result; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__4 != null) { ((IDisposable)5__4).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__147 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string id; public CompetitivePluginCheck <>4__this; private string 5__1; private string 5__2; private string 5__3; private string 5__4; private UnityWebRequest 5__5; private JArray 5__6; private IEnumerator <>s__7; private JObject 5__8; private int 5__9; private int 5__10; private int 5__11; private int 5__12; private int 5__13; private string 5__14; private string 5__15; private DateTime
5__16; private string 5__17; private string 5__18; private string 5__19; private string 5__20; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__147(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; 5__5 = null; 5__6 = null; <>s__7 = null; 5__8 = null; 5__14 = null; 5__15 = null; 5__17 = null; 5__18 = null; 5__19 = null; 5__20 = null; <>1__state = -2; } private bool MoveNext() { //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Invalid comparison between Unknown and I4 try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = "{\"player_id\":\"" + id + "\"}"; 5__2 = UnifiedPlugin.GetCurrentAppId(); 5__3 = UnifiedPlugin.GetCurrentAuthToken(); 5__4 = "https://sbgleague.com/api/apps/" + 5__2 + "/entities/MatchEntry?q=" + UnityWebRequest.EscapeURL(5__1) + "&sort=-match_date&limit=5"; 5__5 = UnityWebRequest.Get(5__4); <>1__state = -3; 5__5.SetRequestHeader("X-App-Id", 5__2); 5__5.SetRequestHeader("api_key", 5__3); 5__5.certificateHandler = (CertificateHandler)(object)new BypassCertificate(); <>2__current = 5__5.SendWebRequest(); <>1__state = 1; return true; case 1: <>1__state = -3; if ((int)5__5.result == 1) { try { 5__6 = JArray.Parse(5__5.downloadHandler.text); <>4__this._recentMatches.Clear(); <>s__7 = ((IEnumerable)5__6).OfType().GetEnumerator(); try { while (<>s__7.MoveNext()) { 5__8 = <>s__7.Current; JToken obj = 5__8["finish_position"]; 5__9 = (int)((obj != null) ? Extensions.Value((IEnumerable)obj) : 0f); JToken obj2 = 5__8["adjusted_match_score"]; 5__10 = (int)((obj2 != null) ? Extensions.Value((IEnumerable)obj2) : 0f); JToken obj3 = 5__8["score_vs_par"]; 5__11 = (int)((obj3 != null) ? Extensions.Value((IEnumerable)obj3) : 0f); JToken obj4 = 5__8["mmr_change"]; 5__12 = (int)((obj4 != null) ? Extensions.Value((IEnumerable)obj4) : 0f); JToken obj5 = 5__8["post_match_mmr"]; 5__13 = (int)((obj5 != null) ? Extensions.Value((IEnumerable)obj5) : 0f); 5__14 = ((object)5__8["match_date"])?.ToString() ?? ""; 5__15 = (DateTime.TryParse(5__14, out
5__16) ?
5__16.ToString("MM/dd") : "??/??"); 5__17 = <>4__this.GetOrdinal(5__9); 5__18 = ((5__12 >= 0) ? "#55FF55" : "#FF5555"); 5__19 = ((5__11 > 0) ? "+" : ""); 5__20 = string.Format("{0} | Pos: {1} | Score: {2} ({3}{4}) | MMR: {5} ({7}{8})", 5__15, 5__17, 5__10, 5__19, 5__11, 5__13, 5__18, (5__12 >= 0) ? "+" : "", 5__12); <>4__this._recentMatches.Add(new MatchEntry { match_summary = 5__20, match_date = 5__14 }); 5__14 = null; 5__15 = null; 5__17 = null; 5__18 = null; 5__19 = null; 5__20 = null; 5__8 = null; } } finally { if (<>s__7 != null) { <>s__7.Dispose(); } } <>s__7 = null; 5__6 = null; } catch { } } <>m__Finally1(); 5__5 = null; return false; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__5 != null) { ((IDisposable)5__5).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__134 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string matchId; public float delaySeconds; public ulong senderId; public CompetitivePluginCheck <>4__this; private Exception 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__134(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(delaySeconds); <>1__state = 1; return true; case 1: <>1__state = -1; try { MatchResultSubmissionService.HandleIncomingMatchIdBroadcast(matchId); Debug.Log((object)$"[SBGL-CompPluginCheck] Forwarded P2P Match ID (delayed {delaySeconds:0.#}s) from {senderId}: {matchId}"); } catch (Exception ex) { 5__1 = ex; Debug.LogWarning((object)("[SBGL-CompPluginCheck] Error forwarding Match ID: " + 5__1.Message)); } 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(); } } [CompilerGenerated] private sealed class d__152 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CompetitivePluginCheck <>4__this; private string 5__1; private UnityWebRequest 5__2; private JObject 5__3; private string 5__4; private DateTime
5__5; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__152(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Invalid comparison between Unknown and I4 bool result; try { switch (<>1__state) { default: result = false; break; case 0: <>1__state = -1; 5__1 = "https://timeapi.io/api/Time/current/zone?timeZone=UTC"; 5__2 = UnityWebRequest.Get(5__1); <>1__state = -3; 5__2.timeout = 5; <>2__current = 5__2.SendWebRequest(); <>1__state = 1; result = true; break; case 1: { <>1__state = -3; if ((int)5__2.result == 1) { try { 5__3 = JObject.Parse(5__2.downloadHandler.text); 5__4 = ((object)5__3["dateTime"])?.ToString(); if (!DateTime.TryParse(5__4, out
5__5)) { 5__3 = null; 5__4 = null; goto IL_0127; } <>4__this._lastSyncTime =
5__5.ToLocalTime().ToString("HH:mm:ss"); result = false; } catch { goto IL_0127; } <>m__Finally1(); break; } goto IL_0127; } IL_0127: <>m__Finally1(); 5__2 = null; <>4__this._lastSyncTime = DateTime.Now.ToString("HH:mm:ss") + " (Local)"; result = false; break; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } return result; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__2 != null) { ((IDisposable)5__2).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__149 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string playerName; public CompetitivePluginCheck <>4__this; private string 5__1; private string 5__2; private string 5__3; private string 5__4; private UnityWebRequest 5__5; private JArray 5__6; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__149(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; 5__5 = null; 5__6 = null; <>1__state = -2; } private bool MoveNext() { //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Invalid comparison between Unknown and I4 try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = "{\"display_name\":{\"$regex\":\"^" + playerName + "$\",\"$options\":\"i\"}}"; 5__2 = UnifiedPlugin.GetCurrentAppId(); 5__3 = UnifiedPlugin.GetCurrentAuthToken(); 5__4 = "https://sbgleague.com/api/apps/" + 5__2 + "/entities/MatchEntry?q=" + UnityWebRequest.EscapeURL(5__1) + "&sort=-match_date&limit=5"; 5__5 = UnityWebRequest.Get(5__4); <>1__state = -3; 5__5.SetRequestHeader("X-App-Id", 5__2); 5__5.SetRequestHeader("api_key", 5__3); 5__5.certificateHandler = (CertificateHandler)(object)new BypassCertificate(); <>2__current = 5__5.SendWebRequest(); <>1__state = 1; return true; case 1: <>1__state = -3; if ((int)5__5.result == 1) { try { 5__6 = JArray.Parse(5__5.downloadHandler.text); if (((JContainer)5__6).Count > 0) { <>4__this.ResolvedID = ((object)5__6[0][(object)"id"])?.ToString() ?? "None"; <>4__this.ResolvedName = ((object)5__6[0][(object)"display_name"])?.ToString() ?? "Not Found"; if (<>4__this.ConfigPlayerId == "PASTE_ID_HERE") { <>4__this.ConfigPlayerId = <>4__this.ResolvedID; } } else { <>4__this.ResolvedID = "None"; } 5__6 = null; } catch { <>4__this.ResolvedID = "None"; } } <>m__Finally1(); 5__5 = null; return false; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__5 != null) { ((IDisposable)5__5).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__115 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Lobby lobby; public CompetitivePluginCheck <>4__this; private float[] 5__1; private float[] <>s__2; private int <>s__3; private float 5__4; private string 5__5; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__115(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; <>s__2 = null; 5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = new float[4] { 0.5f, 1.5f, 3f, 6f }; <>s__2 = 5__1; <>s__3 = 0; break; case 1: <>1__state = -1; 5__5 = TryReadLobbyName(lobby); if (!string.IsNullOrWhiteSpace(5__5)) { _currentLobbyName = 5__5; Debug.Log((object)$"[SBGL-CompPluginCheck] ✓ Lobby name resolved (retry +{5__4}s): '{5__5}'"); return false; } 5__5 = null; <>s__3++; break; } if (<>s__3 < <>s__2.Length) { 5__4 = <>s__2[<>s__3]; <>2__current = (object)new WaitForSeconds(5__4); <>1__state = 1; return true; } <>s__2 = null; Debug.LogWarning((object)"[SBGL-CompPluginCheck] Lobby name still blank after all retries (non-host path)."); 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(); } } [CompilerGenerated] private sealed class d__146 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string configId; public CompetitivePluginCheck <>4__this; private string 5__1; private MenuTabs 5__2; private SharedPlayerProfile 5__3; private string 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__146(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (<>4__this._isSyncing) { return false; } <>4__this._isSyncing = true; <>4__this._syncStatus = "Syncing..."; <>4__this.ResetPlayerData(); <>4__this.UpdateUIReport(); 5__1 = ""; if (UnifiedPlugin.IsPlayerProfileResolved()) { 5__3 = UnifiedPlugin.GetPlayerProfile(); 5__1 = 5__3.ID; <>4__this.ResolvedID = 5__3.ID; <>4__this.ResolvedName = 5__3.DisplayName; 5__3 = null; goto IL_0193; } 5__4 = <>4__this.GetInGameName(); if (!string.IsNullOrEmpty(5__4)) { <>2__current = <>4__this.ResolvePlayerIdFromName(5__4); <>1__state = 1; return true; } goto IL_018b; case 1: <>1__state = -1; if (<>4__this.ResolvedID != "None") { 5__1 = <>4__this.ResolvedID; } goto IL_018b; case 2: <>1__state = -1; <>2__current = <>4__this.FetchPlayerData(5__1); <>1__state = 3; return true; case 3: <>1__state = -1; <>2__current = <>4__this.FetchLeaderboardRank(5__1); <>1__state = 4; return true; case 4: <>1__state = -1; <>2__current = <>4__this.GetNetworkTime(); <>1__state = 5; return true; case 5: <>1__state = -1; <>2__current = <>4__this.FetchEvents(); <>1__state = 6; return true; case 6: <>1__state = -1; <>2__current = <>4__this.FetchRecentMatches(5__1); <>1__state = 7; return true; case 7: { <>1__state = -1; <>4__this._syncStatus = ((<>4__this._activeUsername == "Invalid ID" || <>4__this._activeUsername == "API Offline") ? "Error" : "Connected"); break; } IL_0193: if ((string.IsNullOrEmpty(5__1) || 5__1 == "None") && !string.IsNullOrEmpty(configId) && configId != "PASTE_ID_HERE") { 5__1 = configId; <>4__this.ResolvedID = configId; } if (!string.IsNullOrEmpty(5__1) && 5__1 != "None" && 5__1 != "PASTE_ID_HERE") { <>2__current = <>4__this.CheckPluginsRoutine(); <>1__state = 2; return true; } <>4__this._syncStatus = "ID Required"; <>4__this.ResetPlayerData("Link ID in Settings"); break; IL_018b: 5__4 = null; goto IL_0193; } 5__2 = Object.FindFirstObjectByType(); if ((Object)(object)5__2 != (Object)null) { SBGLTabManager.Inject(5__2); } <>4__this._isSyncing = false; <>4__this.UpdateUIReport(); 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 ConfigEntry _configX; private ConfigEntry _configY; private ConfigEntry _configWidth; private ConfigEntry _configAlpha; private ConfigEntry _configUpdateInterval; private ConfigEntry _configCompliancePanelX; private ConfigEntry _configCompliancePanelY; private ConfigEntry _configHideUIWindow; private ConfigEntry _configShowModList; private ConfigEntry _configShowDebugWindow; private ConfigEntry _configMelonLoaderChatEnabled; private ConfigEntry _configPlayerId; private const string ALLOWED_MODS_URL = "https://gist.githubusercontent.com/Kingcox22/59765f02af8dd87179ca920409ff3b27/raw/Approved_Mods.json"; private const int SBGL_NET_CHANNEL = 2622; private Dictionary _remotePlayerMods = new Dictionary(); private Dictionary _playerDisplayNames = new Dictionary(); private Dictionary _playerComplianceStatus = new Dictionary(); private HashSet _playersNotifiedAbout = new HashSet(); private HashSet _knownPeers = new HashSet(); private Dictionary _playerFirstSeenTime = new Dictionary(); private const float COMPLIANCE_TIMEOUT = 15f; private bool _hasLoggedDiscoveryInfo = false; private string _lastDiscoveryScene = ""; private float _lastMelonLoaderAnnouncementTime = -100f; internal static string _currentLobbyName = ""; private int _lastPlayerCosmeticsCount = 0; private Rect _compliancePanelRect; private bool _compliancePanelRectInit = false; private GUIStyle _compWindowStyle; private GameObject _canvasObj; private GameObject _profilePicContainer; private GameObject _bgObj; private GameObject _warnContainer; private GameObject _debugWindowObj; private TextMeshProUGUI _statsText; private TextMeshProUGUI _illegalWarningText; private TextMeshProUGUI _missingWarningText; private TextMeshProUGUI _debugWindowText; private Image _bgImage; private Image _debugWindowBg; private RawImage _profileIcon; private RectTransform _bgRect; private RectTransform _debugWindowRect; private static readonly HashSet IgnoredPluginGuids = new HashSet(StringComparer.OrdinalIgnoreCase) { "BepInEx", "com.sbgl.unified" }; private AllowedModsSnapshot _allowedModsSnapshot = AllowedModsSnapshot.Empty; private readonly HashSet _observedRuntimeAssemblyPaths = new HashSet(StringComparer.OrdinalIgnoreCase); private Lobby _currentLobby; private bool _inLobby = false; public List _upcomingEvents = new List(); public List _recentMatches = new List(); private bool _isSyncing = false; private float _timeUntilNextUpdate = 0f; private string _lastSyncTime = "Never"; public string _activeUsername = "Searching..."; public string _playerRank = "N/A"; public string _totalPlayers = "0"; public string _playerMMR = "0"; public string _matches = "0"; public string _playerPeak = "0"; public string _winRate = "0%"; public string _lastChange = "0"; public string _top3s = "0"; public string _avgScore = "0.0"; public string _syncStatus = "Idle"; public string ResolvedName = "Not Found"; public string ResolvedID = "None"; private float ConfigX => _configX?.Value ?? PlayerPrefs.GetFloat("CompCheck_X", 20f); private float ConfigY => _configY?.Value ?? PlayerPrefs.GetFloat("CompCheck_Y", 100f); private float ConfigWidth => _configWidth?.Value ?? PlayerPrefs.GetFloat("CompCheck_Width", 200f); private float ConfigAlpha => _configAlpha?.Value ?? PlayerPrefs.GetFloat("CompCheck_Alpha", 0.85f); private float ConfigCompliancePanelX { get { return _configCompliancePanelX?.Value ?? PlayerPrefs.GetFloat("CompCheck_ComplianceX", (float)Screen.width - 420f); } set { if (_configCompliancePanelX != null) { _configCompliancePanelX.Value = value; } } } private float ConfigCompliancePanelY { get { return _configCompliancePanelY?.Value ?? PlayerPrefs.GetFloat("CompCheck_ComplianceY", (float)Screen.height - 350f); } set { if (_configCompliancePanelY != null) { _configCompliancePanelY.Value = value; } } } private bool ConfigHideUIWindow => _configHideUIWindow?.Value ?? (PlayerPrefs.GetInt("CompCheck_HideUIWindow", 0) == 1); private bool ConfigShowModList { get { return _configShowModList?.Value ?? (PlayerPrefs.GetInt("CompCheck_ShowModList", 0) == 1); } set { if (_configShowModList != null) { _configShowModList.Value = value; } } } private bool ConfigShowDebugWindow { get { return _configShowDebugWindow?.Value ?? (PlayerPrefs.GetInt("CompCheck_ShowDebugWindow", 0) == 1); } set { if (_configShowDebugWindow != null) { _configShowDebugWindow.Value = value; } } } internal string ConfigPlayerId { get { return _configPlayerId?.Value ?? PlayerPrefs.GetString("CompCheck_PlayerId", "PASTE_ID_HERE"); } set { if (_configPlayerId != null) { _configPlayerId.Value = value; } } } private bool ConfigMelonLoaderChatEnabled => _configMelonLoaderChatEnabled?.Value ?? false; private static string NormalizePath(string path) { if (string.IsNullOrWhiteSpace(path)) { return string.Empty; } try { return Path.GetFullPath(path).TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); } catch { return path; } } private static string TryGetAssemblyLocation(Assembly assembly) { if (assembly == null) { return string.Empty; } try { return NormalizePath(assembly.Location); } catch { return string.Empty; } } private bool IsTrackedRuntimeAssemblyPath(string assemblyPath) { if (string.IsNullOrWhiteSpace(assemblyPath)) { return false; } string text = NormalizePath(assemblyPath); string text2 = NormalizePath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "BepInEx", "plugins")); if (text.StartsWith(text2 + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase)) { return true; } return text.IndexOf(Path.DirectorySeparatorChar + "Cheats" + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase) >= 0; } private void TrackRuntimeAssembly(Assembly assembly) { string text = TryGetAssemblyLocation(assembly); if (IsTrackedRuntimeAssemblyPath(text)) { _observedRuntimeAssemblyPaths.Add(text); } } private void CaptureLoadedRuntimeAssemblies() { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { TrackRuntimeAssembly(assembly); } } private void OnRuntimeAssemblyLoaded(object sender, AssemblyLoadEventArgs args) { TrackRuntimeAssembly(args.LoadedAssembly); } private static string TryGetAssemblySimpleName(string assemblyPath) { if (string.IsNullOrWhiteSpace(assemblyPath) || !File.Exists(assemblyPath)) { return string.Empty; } try { return AssemblyName.GetAssemblyName(assemblyPath).Name ?? string.Empty; } catch { return string.Empty; } } private static string ComputeSha256Hex(string filePath) { try { using SHA256 sHA = SHA256.Create(); using FileStream inputStream = File.OpenRead(filePath); byte[] array = sHA.ComputeHash(inputStream); return BitConverter.ToString(array).Replace("-", "").ToLowerInvariant(); } catch { return string.Empty; } } private KnownVisibleRuntimeAssemblies BuildKnownVisibleRuntimeAssemblies() { KnownVisibleRuntimeAssemblies knownVisibleRuntimeAssemblies = new KnownVisibleRuntimeAssemblies(); foreach (PluginInfo value in Chainloader.PluginInfos.Values) { try { Assembly assembly = (((object)value).GetType().GetProperty("Instance", BindingFlags.Instance | BindingFlags.Public)?.GetValue(value))?.GetType().Assembly; string text = TryGetAssemblyLocation(assembly); if (string.IsNullOrWhiteSpace(text)) { continue; } knownVisibleRuntimeAssemblies.ExactAssemblyPaths.Add(text); AssemblyName[] referencedAssemblies = assembly.GetReferencedAssemblies(); foreach (AssemblyName assemblyName in referencedAssemblies) { if (!string.IsNullOrWhiteSpace(assemblyName.Name)) { knownVisibleRuntimeAssemblies.AllowedCompanionAssemblyNames.Add(assemblyName.Name); } } } catch { } } return knownVisibleRuntimeAssemblies; } private static bool ShouldIgnorePluginGuid(string guid) { return !string.IsNullOrWhiteSpace(guid) && IgnoredPluginGuids.Contains(guid); } private bool IsAllowedPluginGuid(string guid) { return _allowedModsSnapshot.ContainsGuid(guid); } private LocalPluginScanResult BuildLocalPluginScanResult() { LocalPluginScanResult localPluginScanResult = new LocalPluginScanResult(); HashSet installedGuids = new HashSet(from plugin in Chainloader.PluginInfos.Values select plugin.Metadata.GUID into guid where !string.IsNullOrWhiteSpace(guid) select guid, StringComparer.OrdinalIgnoreCase); KnownVisibleRuntimeAssemblies knownVisibleRuntimeAssemblies = BuildKnownVisibleRuntimeAssemblies(); localPluginScanResult.MissingModNames.AddRange(_allowedModsSnapshot.GetMissingModNames(installedGuids)); foreach (PluginInfo value in Chainloader.PluginInfos.Values) { if (ShouldIgnorePluginGuid(value.Metadata.GUID)) { continue; } if (!IsAllowedPluginGuid(value.Metadata.GUID)) { localPluginScanResult.HasIllegalMods = true; break; } if (!_allowedModsSnapshot.HasHashConstraints) { continue; } HashSet allowedHashes = _allowedModsSnapshot.GetAllowedHashes(value.Metadata.GUID); if (allowedHashes == null || allowedHashes.Count <= 0) { continue; } try { string text = TryGetAssemblyLocation((((object)value).GetType().GetProperty("Instance", BindingFlags.Instance | BindingFlags.Public)?.GetValue(value))?.GetType().Assembly); if (!string.IsNullOrWhiteSpace(text) && File.Exists(text)) { string text2 = ComputeSha256Hex(text); if (!string.IsNullOrWhiteSpace(text2) && !allowedHashes.Contains(text2)) { localPluginScanResult.TamperedModNames.Add(value.Metadata.Name); localPluginScanResult.HasIllegalMods = true; } } } catch { } } foreach (string item in _observedRuntimeAssemblyPaths.OrderBy((string path) => path, StringComparer.OrdinalIgnoreCase)) { if (!knownVisibleRuntimeAssemblies.ExactAssemblyPaths.Contains(item)) { string text3 = TryGetAssemblySimpleName(item); if (item.Contains(Path.DirectorySeparatorChar + "Cheats" + Path.DirectorySeparatorChar) || string.IsNullOrWhiteSpace(text3) || !knownVisibleRuntimeAssemblies.AllowedCompanionAssemblyNames.Contains(text3)) { localPluginScanResult.SuspiciousRuntimeAssemblies.Add(item.Replace(NormalizePath(AppDomain.CurrentDomain.BaseDirectory) + Path.DirectorySeparatorChar, string.Empty)); localPluginScanResult.HasIllegalMods = true; } } } return localPluginScanResult; } public void SetConfig(ConfigEntry x, ConfigEntry y, ConfigEntry width, ConfigEntry alpha, ConfigEntry hideUIWindow, ConfigEntry showModList, ConfigEntry showDebugWindow, ConfigEntry updateInterval, ConfigEntry playerId, ConfigEntry compliancePanelX = null, ConfigEntry compliancePanelY = null, ConfigEntry melonLoaderChatEnabled = null) { _configX = x; _configY = y; _configWidth = width; _configAlpha = alpha; _configHideUIWindow = hideUIWindow; _configShowModList = showModList; _configShowDebugWindow = showDebugWindow; _configUpdateInterval = updateInterval; _configPlayerId = playerId; _configCompliancePanelX = compliancePanelX; _configCompliancePanelY = compliancePanelY; _configMelonLoaderChatEnabled = melonLoaderChatEnabled; } private void OnEnable() { try { SteamMatchmaking.OnLobbyEntered += OnLobbyEntered; } catch { } try { SteamMatchmaking.OnLobbyMemberJoined += OnLobbyMemberJoined; } catch { } try { SteamMatchmaking.OnLobbyMemberLeave += OnLobbyMemberLeave; } catch { } try { SteamNetworking.OnP2PSessionRequest = (Action)Delegate.Combine(SteamNetworking.OnP2PSessionRequest, new Action(OnP2PSessionRequest)); } catch { } } private void OnDisable() { try { SteamMatchmaking.OnLobbyEntered -= OnLobbyEntered; } catch { } try { SteamMatchmaking.OnLobbyMemberJoined -= OnLobbyMemberJoined; } catch { } try { SteamMatchmaking.OnLobbyMemberLeave -= OnLobbyMemberLeave; } catch { } try { SteamNetworking.OnP2PSessionRequest = (Action)Delegate.Remove(SteamNetworking.OnP2PSessionRequest, new Action(OnP2PSessionRequest)); } catch { } } private void OnP2PSessionRequest(SteamId remoteId) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_007c: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) if (!_inLobby || !((Lobby)(ref _currentLobby)).Members.Any((Friend m) => SteamId.op_Implicit(m.Id) == SteamId.op_Implicit(remoteId))) { return; } SteamNetworking.AcceptP2PSessionWithUser(remoteId); if (!_playerDisplayNames.ContainsKey(remoteId.Value)) { foreach (Friend member in ((Lobby)(ref _currentLobby)).Members) { Friend current = member; if (SteamId.op_Implicit(current.Id) == SteamId.op_Implicit(remoteId)) { _playerDisplayNames[remoteId.Value] = ((Friend)(ref current)).Name; break; } } } Debug.Log((object)$"[SBGL-CompPluginCheck] ✓ Accepted P2P session request from {remoteId.Value}"); } private void OnLobbyEntered(Lobby lobby) { //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_0015: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) _currentLobby = lobby; _inLobby = true; float time = Time.time; string text = TryReadLobbyName(lobby); if (!string.IsNullOrWhiteSpace(text)) { _currentLobbyName = text; } Debug.Log((object)$"[SBGL-CompPluginCheck] ✓ OnLobbyEntered: {((Lobby)(ref lobby)).Id.Value}, member count: {((Lobby)(ref lobby)).MemberCount}, lobby name: '{text}'"); foreach (Friend member in ((Lobby)(ref lobby)).Members) { Friend current = member; if (current.Id.Value != SteamId.op_Implicit(SteamClient.SteamId)) { Debug.Log((object)$"[SBGL-CompPluginCheck] ✓ Lobby member: {((Friend)(ref current)).Name} ({current.Id.Value})"); _playerDisplayNames[current.Id.Value] = ((Friend)(ref current)).Name; AddPlayerToTracking(current.Id.Value, time); } } if (string.IsNullOrWhiteSpace(text)) { ((MonoBehaviour)this).StartCoroutine(RetryResolveLobbyName(lobby)); } } private static string TryReadLobbyName(Lobby lobby) { string[] array = new string[5] { "name", "Name", "lobby_name", "LobbyName", "server_name" }; string[] array2 = array; foreach (string text in array2) { try { string data = ((Lobby)(ref lobby)).GetData(text); if (!string.IsNullOrWhiteSpace(data)) { return data; } } catch { } } return string.Empty; } [IteratorStateMachine(typeof(d__115))] private IEnumerator RetryResolveLobbyName(Lobby lobby) { //IL_000e: 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) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__115(0) { <>4__this = this, lobby = lobby }; } private void OnLobbyMemberJoined(Lobby lobby, Friend friend) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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) if (friend.Id.Value != SteamId.op_Implicit(SteamClient.SteamId)) { float time = Time.time; Debug.Log((object)$"[SBGL-CompPluginCheck] ✓ Lobby member joined: {((Friend)(ref friend)).Name} ({friend.Id.Value})"); _playerDisplayNames[friend.Id.Value] = ((Friend)(ref friend)).Name; AddPlayerToTracking(friend.Id.Value, time); } } private void OnLobbyMemberLeave(Lobby lobby, Friend friend) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) ulong value = friend.Id.Value; if (value == SteamId.op_Implicit(SteamClient.SteamId)) { _inLobby = false; _playerComplianceStatus.Clear(); _playerFirstSeenTime.Clear(); _knownPeers.Clear(); _playersNotifiedAbout.Clear(); _playerDisplayNames.Clear(); _remotePlayerMods.Clear(); _hasLoggedDiscoveryInfo = false; PlayerPrefs.SetString("LobbyName", ""); Debug.Log((object)"[SBGL-CompPluginCheck] Left lobby — cleared all player tracking"); } else { _playerComplianceStatus.Remove(value); _playerFirstSeenTime.Remove(value); _knownPeers.Remove(value); _playersNotifiedAbout.Remove(value); _playerDisplayNames.Remove(value); _remotePlayerMods.Remove(value); Debug.Log((object)$"[SBGL-CompPluginCheck] Player left lobby: {((Friend)(ref friend)).Name} ({value}) — removed from tracking"); } } private void Awake() { if (!PlayerPrefs.HasKey("CompCheck_X")) { PlayerPrefs.SetFloat("CompCheck_X", 20f); } if (!PlayerPrefs.HasKey("CompCheck_Y")) { PlayerPrefs.SetFloat("CompCheck_Y", 100f); } if (!PlayerPrefs.HasKey("CompCheck_Width")) { PlayerPrefs.SetFloat("CompCheck_Width", 200f); } if (!PlayerPrefs.HasKey("CompCheck_Alpha")) { PlayerPrefs.SetFloat("CompCheck_Alpha", 0.85f); } if (!PlayerPrefs.HasKey("CompCheck_UpdateInterval")) { PlayerPrefs.SetFloat("CompCheck_UpdateInterval", 5f); } if (!PlayerPrefs.HasKey("CompCheck_HideUIWindow")) { PlayerPrefs.SetInt("CompCheck_HideUIWindow", 0); } if (!PlayerPrefs.HasKey("CompCheck_ShowModList")) { PlayerPrefs.SetInt("CompCheck_ShowModList", 0); } if (!PlayerPrefs.HasKey("CompCheck_ShowDebugWindow")) { PlayerPrefs.SetInt("CompCheck_ShowDebugWindow", 0); } if (!PlayerPrefs.HasKey("CompCheck_PlayerId")) { PlayerPrefs.SetString("CompCheck_PlayerId", "PASTE_ID_HERE"); } if (HasMelonLoaderLoaded()) { Debug.LogError((object)"[SBGL-CompPluginCheck] ⚠\ufe0f⚠\ufe0f⚠\ufe0f STARTUP DETECTION: MELONLOADER IS LOADED ⚠\ufe0f⚠\ufe0f⚠\ufe0f"); } UnifiedPlugin.ApiConfigChanged += OnApiConfigChanged; AppDomain.CurrentDomain.AssemblyLoad += OnRuntimeAssemblyLoaded; CaptureLoadedRuntimeAssemblies(); ((MonoBehaviour)this).StartCoroutine(GetNetworkTime()); } private void OnDestroy() { UnifiedPlugin.ApiConfigChanged -= OnApiConfigChanged; AppDomain.CurrentDomain.AssemblyLoad -= OnRuntimeAssemblyLoaded; } private void OnApiConfigChanged() { ((MonoBehaviour)this).StopCoroutine(AutoUpdateLoop()); ((MonoBehaviour)this).StartCoroutine(AutoUpdateLoop()); } private void Start() { if (!string.IsNullOrEmpty(ConfigPlayerId) && ConfigPlayerId != "PASTE_ID_HERE") { ResolvedID = ConfigPlayerId; } CreateUI(); ((MonoBehaviour)this).StartCoroutine(AutoUpdateLoop()); } private void Update() { //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) Keyboard current = Keyboard.current; if (current == null) { return; } if (((ButtonControl)current[(Key)102]).wasPressedThisFrame) { ConfigShowModList = !ConfigShowModList; UpdateUIReport(); } if (((ButtonControl)current[(Key)103]).wasPressedThisFrame) { TriggerManualSync(); } if (((ButtonControl)current[(Key)104]).wasPressedThisFrame) { ConfigShowDebugWindow = !ConfigShowDebugWindow; UpdateUIReport(); } if ((Object)(object)_bgRect != (Object)null) { float num = Mathf.Clamp(ConfigX, 0f, (float)Screen.width - ConfigWidth); float num2 = Mathf.Clamp(ConfigY, 0f, (float)Screen.height - _bgRect.sizeDelta.y); _bgRect.anchoredPosition = new Vector2(num, num2); _bgRect.sizeDelta = new Vector2(ConfigWidth, _bgRect.sizeDelta.y); ((Graphic)_bgImage).color = new Color(0f, 0f, 0f, ConfigAlpha); if (num != ConfigX) { _configX.Value = num; } if (num2 != ConfigY) { _configY.Value = num2; } } if ((Object)(object)_canvasObj != (Object)null) { _canvasObj.SetActive(!ConfigHideUIWindow); } if ((Object)(object)_debugWindowObj != (Object)null) { _debugWindowObj.SetActive(ConfigShowDebugWindow); } int num3 = 0; try { num3 = Object.FindObjectsByType((FindObjectsSortMode)0).Length; } catch { } if (num3 != _lastPlayerCosmeticsCount) { Debug.Log((object)$"[SBGL-CompPluginCheck] PlayerCosmetics count changed: {_lastPlayerCosmeticsCount} → {num3}, triggering immediate discovery"); _lastPlayerCosmeticsCount = num3; _hasLoggedDiscoveryInfo = false; DiscoverLobbyPlayers(); } if (Time.frameCount % 300 == 0) { DiscoverLobbyPlayers(); } if (HasMelonLoaderLoaded() && _inLobby) { float num4 = Time.time - _lastMelonLoaderAnnouncementTime; if (num4 >= 10f) { AnnounceOwnMelonLoaderToChat(); _lastMelonLoaderAnnouncementTime = Time.time; } } AcceptIncomingP2PSessions(); ListenForModReports(); if (Time.frameCount % 600 == 0) { Debug.Log((object)$"[SBGL-CompPluginCheck] Frame {Time.frameCount}: Triggering BroadcastMyMods()"); BroadcastMyMods(); } } private void OnGUI() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (ConfigShowDebugWindow) { Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name.ToLower().Contains("driving range")) { DrawPlayerComplianceDebugUI(); } } } private void DrawPlayerComplianceDebugUI() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0032: Expected O, but got Unknown //IL_0038: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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_0125: Expected O, but got Unknown //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) if (_compWindowStyle == null) { _compWindowStyle = new GUIStyle(GUI.skin.box) { padding = new RectOffset(12, 12, 12, 12) }; } if (!_compliancePanelRectInit) { float num = ((ConfigCompliancePanelX > 0f) ? ConfigCompliancePanelX : ((float)Screen.width - 480f)); float num2 = ((ConfigCompliancePanelY > 0f) ? ConfigCompliancePanelY : ((float)Screen.height - 350f)); _compliancePanelRect = new Rect(num, num2, 10f, 10f); _compliancePanelRectInit = true; } GUI.backgroundColor = new Color(0.07f, 0.07f, 0.07f, 0.95f); _compliancePanelRect = GUILayout.Window(42424, _compliancePanelRect, new WindowFunction(DrawComplianceWindowContent), "", _compWindowStyle, (GUILayoutOption[])(object)new GUILayoutOption[3] { GUILayout.MinWidth(300f), GUILayout.MaxWidth(500f), GUILayout.MaxHeight((float)Screen.height - 40f) }); GUI.backgroundColor = Color.white; } private void DrawComplianceWindowContent(int windowId) { //IL_000b: 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_0019: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003d: 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) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_006f: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Expected O, but got Unknown GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = 15, fontStyle = (FontStyle)1 }; val.normal.textColor = Color.white; GUIStyle val2 = val; GUIStyle val3 = new GUIStyle(GUI.skin.label) { richText = true, fontSize = 12 }; val3.normal.textColor = Color.white; GUIStyle val4 = val3; GUIStyle val5 = new GUIStyle(GUI.skin.label) { richText = true, fontSize = 13, fontStyle = (FontStyle)1 }; val5.normal.textColor = Color.white; GUIStyle val6 = val5; GUIStyle val7 = new GUIStyle(GUI.skin.label) { richText = true, fontSize = 11 }; val7.normal.textColor = Color.white; GUIStyle val8 = val7; GUILayout.Label("PLAYER COMPLIANCE", val2, Array.Empty()); GUILayout.Space(4f); int count = _playerComplianceStatus.Count; int num = _playerComplianceStatus.Values.Count((PlayerComplianceStatus s) => s.IsCompliant && s.HasReportedMods && !s.HasMelonLoader); int num2 = _playerComplianceStatus.Values.Count((PlayerComplianceStatus s) => s.HasReportedMods && (!s.IsCompliant || s.HasMelonLoader)); int num3 = _playerComplianceStatus.Values.Count((PlayerComplianceStatus s) => !s.HasReportedMods); GUILayout.Label($"Players: {count} ✓ {num} ✗ {num2} ? {num3}", val4, Array.Empty()); GUILayout.Space(6f); if (_playerComplianceStatus.Count == 0) { GUIStyle val9 = new GUIStyle(GUI.skin.label) { fontSize = 12 }; val9.normal.textColor = new Color(0.6f, 0.6f, 0.6f); GUILayout.Label("Waiting for players...", val9, Array.Empty()); } else { HashSet hashSet = new HashSet(_allowedModsSnapshot.DisplayNames.Select((string v) => v.ToLowerInvariant())); foreach (KeyValuePair item in _playerComplianceStatus) { PlayerComplianceStatus value = item.Value; string text; string text2; if (!value.HasReportedMods) { text = "?"; text2 = "yellow"; } else if (value.HasMelonLoader) { text = "⚠"; text2 = "orange"; } else if (value.IsCompliant) { text = "✓"; text2 = "lime"; } else { text = "✗"; text2 = "red"; } string value2; string text3 = (_playerDisplayNames.TryGetValue(value.SteamId, out value2) ? value2 : value.SteamId.ToString()); GUILayout.Label("[" + text + "] " + text3, val6, Array.Empty()); if (value.HasMelonLoader) { GUILayout.Label(" ⚠ MelonLoader detected", val8, Array.Empty()); } if (_remotePlayerMods.TryGetValue(value.SteamId, out var value3)) { string[] array = value3.Split(';'); foreach (string text4 in array) { if (!string.IsNullOrEmpty(text4) && !text4.Contains("USER_HAS_MELONLOADER")) { string text5 = text4.Split('|')[0]; bool flag = text5.StartsWith("⚡") || hashSet.Contains(text5.ToLowerInvariant()); string text6 = (flag ? "#AAFFAA" : "#FF4444"); string text7 = (flag ? "✓" : "✗"); GUILayout.Label(" " + text7 + " " + text5 + "", val8, Array.Empty()); } } } GUILayout.Space(5f); } } GUI.DragWindow(); } private bool HasMelonLoaderLoaded() { return MelonLoaderBridge.IsMelonLoaderLoaded; } private void DiscoverLobbyPlayers() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_0557: Unknown result type (might be due to invalid IL or missing references) //IL_055a: Unknown result type (might be due to invalid IL or missing references) //IL_055c: Unknown result type (might be due to invalid IL or missing references) //IL_0575: Unknown result type (might be due to invalid IL or missing references) //IL_0577: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Unknown result type (might be due to invalid IL or missing references) //IL_059e: Unknown result type (might be due to invalid IL or missing references) //IL_05a0: Unknown result type (might be due to invalid IL or missing references) //IL_05c5: Unknown result type (might be due to invalid IL or missing references) //IL_05c7: Unknown result type (might be due to invalid IL or missing references) //IL_05e2: Unknown result type (might be due to invalid IL or missing references) //IL_05e4: Unknown result type (might be due to invalid IL or missing references) //IL_0611: Unknown result type (might be due to invalid IL or missing references) //IL_0613: Unknown result type (might be due to invalid IL or missing references) if (!SteamClient.IsValid) { return; } try { float time = Time.time; Scene activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; if (name != _lastDiscoveryScene) { _hasLoggedDiscoveryInfo = false; _lastDiscoveryScene = name; _lastPlayerCosmeticsCount = 0; _playerComplianceStatus.Clear(); _playerFirstSeenTime.Clear(); _knownPeers.Clear(); _playersNotifiedAbout.Clear(); _playerDisplayNames.Clear(); _remotePlayerMods.Clear(); Debug.Log((object)("[SBGL-CompPluginCheck] Scene changed to: " + name + " - cleared player tracking and resetting discovery")); } bool flag = !_hasLoggedDiscoveryInfo; if (flag && !_playerComplianceStatus.ContainsKey(SteamId.op_Implicit(SteamClient.SteamId))) { bool flag2 = HasMelonLoaderLoaded(); _playerComplianceStatus[SteamId.op_Implicit(SteamClient.SteamId)] = new PlayerComplianceStatus { SteamId = SteamId.op_Implicit(SteamClient.SteamId), FirstSeenTime = time, IsCompliant = true, HasReportedMods = true, HasMelonLoader = flag2, ModList = "⚡SBGL.UnifiedMod|1.0.0" }; if (!_playerFirstSeenTime.ContainsKey(SteamId.op_Implicit(SteamClient.SteamId))) { _playerFirstSeenTime[SteamId.op_Implicit(SteamClient.SteamId)] = time; } Debug.Log((object)$"[SBGL-CompPluginCheck] ✓ Added self ({SteamClient.SteamId}) to tracking as COMPLIANT (MelonLoader={flag2})"); _playerDisplayNames[SteamId.op_Implicit(SteamClient.SteamId)] = SteamClient.Name ?? "Me"; } PlayerCosmetics[] array = (PlayerCosmetics[])(object)new PlayerCosmetics[0]; try { array = Object.FindObjectsByType((FindObjectsSortMode)0); if (flag) { Debug.Log((object)$"[SBGL-CompPluginCheck] \ud83d\udd0d Scene discovery: Found {array.Length} PlayerCosmetics components"); } PlayerCosmetics[] array2 = array; foreach (PlayerCosmetics val in array2) { try { GameObject gameObject = ((Component)val).gameObject; string name2 = ((Object)gameObject).name; if (flag) { Debug.Log((object)("[SBGL-CompPluginCheck] → PlayerCosmetics object: '" + name2 + "'")); } NetworkIdentity component = gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { if (flag) { Debug.Log((object)"[SBGL-CompPluginCheck] → Has NetworkIdentity, checking for owner info"); } ulong num = 0uL; bool flag3 = false; try { PropertyInfo property = typeof(NetworkIdentity).GetProperty("connectionToClient", BindingFlags.Instance | BindingFlags.Public); if (property != null) { object value = property.GetValue(component); if (value != null && flag) { Debug.Log((object)("[SBGL-CompPluginCheck] → Has connectionToClient: " + value.GetType().Name)); Type type = value.GetType(); PropertyInfo property2 = type.GetProperty("authenticationData", BindingFlags.Instance | BindingFlags.Public); if (property2 != null) { object value2 = property2.GetValue(value); if (value2 != null) { Debug.Log((object)$"[SBGL-CompPluginCheck] → Auth data: {value2}"); } } } } } catch { } if (ulong.TryParse(name2, out var result)) { num = result; flag3 = true; if (flag) { Debug.Log((object)$"[SBGL-CompPluginCheck] ✓ Extracted Steam ID from name: {result}"); } } if (flag3) { if (num == SteamId.op_Implicit(SteamClient.SteamId)) { if (flag) { Debug.Log((object)$"[SBGL-CompPluginCheck] ✓ Skipping self ({num})"); } continue; } if (flag) { Debug.Log((object)$"[SBGL-CompPluginCheck] ✓ Discovered player: {num}"); } AddPlayerToTracking(num, time); } else if (flag) { Debug.Log((object)("[SBGL-CompPluginCheck] ⚠\ufe0f PlayerCosmetics '" + name2 + "' has no Steam ID in name. Logging details...")); Type type2 = ((object)component).GetType(); PropertyInfo property3 = type2.GetProperty("ownerId", BindingFlags.Instance | BindingFlags.Public); if (property3 != null) { object value3 = property3.GetValue(component); Debug.Log((object)$"[SBGL-CompPluginCheck] → ownerId: {value3}"); } PropertyInfo property4 = type2.GetProperty("netId", BindingFlags.Instance | BindingFlags.Public); if (property4 != null) { object value4 = property4.GetValue(component); Debug.Log((object)$"[SBGL-CompPluginCheck] → netId: {value4}"); } } } else if (flag) { Debug.Log((object)"[SBGL-CompPluginCheck] ⚠\ufe0f PlayerCosmetics has no NetworkIdentity"); } } catch (Exception ex) { if (flag) { Debug.LogError((object)("[SBGL-CompPluginCheck] Error processing PlayerCosmetics: " + ex.Message)); } } } if (flag) { Debug.Log((object)$"[SBGL-CompPluginCheck] ✓ Discovery complete: {_playerComplianceStatus.Count} players added to tracking"); } } catch (Exception ex2) { if (flag) { Debug.LogError((object)("[SBGL-CompPluginCheck] Error in PlayerCosmetics discovery: " + ex2.Message)); } } if (_inLobby) { try { foreach (Friend member in ((Lobby)(ref _currentLobby)).Members) { Friend current = member; if (current.Id.Value != 0 && current.Id.Value != SteamId.op_Implicit(SteamClient.SteamId)) { if (!_knownPeers.Contains(current.Id.Value)) { Debug.Log((object)$"[SBGL-CompPluginCheck] ✓ Lobby refresh found new peer: {((Friend)(ref current)).Name} ({current.Id.Value})"); AddPlayerToTracking(current.Id.Value, time); } if (!string.IsNullOrEmpty(((Friend)(ref current)).Name)) { _playerDisplayNames[current.Id.Value] = ((Friend)(ref current)).Name; } } } } catch (Exception ex3) { if (flag) { Debug.LogWarning((object)("[SBGL-CompPluginCheck] Lobby member refresh error: " + ex3.Message)); } } } else if (flag) { Debug.Log((object)"[SBGL-CompPluginCheck] ⚠\ufe0f Not in a tracked lobby yet - OnLobbyEntered has not fired"); } _hasLoggedDiscoveryInfo = true; List list = new List(); foreach (KeyValuePair item in _playerComplianceStatus) { ulong key = item.Key; PlayerComplianceStatus value5 = item.Value; if (!value5.HasReportedMods && _playerFirstSeenTime.TryGetValue(key, out var value6) && time - value6 >= 15f) { list.Add(key); } } foreach (ulong item2 in list) { PlayerComplianceStatus playerComplianceStatus = _playerComplianceStatus[item2]; if (!playerComplianceStatus.HasReportedMods) { Debug.LogWarning((object)$"[SBGL-CompPluginCheck] Player {item2} timed out without reporting mods - marking as non-compliant"); playerComplianceStatus.IsCompliant = false; playerComplianceStatus.ModList = "(No report received)"; SendComplianceNotification(item2, playerComplianceStatus); UpdateUIReport(); } } } catch (Exception ex4) { Debug.LogError((object)("[SBGL-CompPluginCheck] Fatal error in DiscoverLobbyPlayers: " + ex4.Message + "\n" + ex4.StackTrace)); } } private void AddPlayerToTracking(ulong steamId, float now) { if (!_playerComplianceStatus.ContainsKey(steamId)) { _playerComplianceStatus[steamId] = new PlayerComplianceStatus { SteamId = steamId, FirstSeenTime = now, IsCompliant = false, HasReportedMods = false }; if (!_playerFirstSeenTime.ContainsKey(steamId)) { _playerFirstSeenTime[steamId] = now; } _knownPeers.Add(steamId); Debug.Log((object)$"[SBGL-CompPluginCheck] Added player {steamId} to tracking (knownPeers={_knownPeers.Count})"); TrySendCurrentMatchIdToPeer(steamId, "peer discovered"); UpdateUIReport(); } } private static bool ShouldShareCurrentMatchId() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) string currentMatchId = SBGLPlugin.CurrentMatchId; if (string.IsNullOrWhiteSpace(currentMatchId)) { return false; } Scene activeScene = SceneManager.GetActiveScene(); string text = ((Scene)(ref activeScene)).name?.ToLowerInvariant() ?? string.Empty; if (text.Contains("menu") || text.Contains("driving") || text.Contains("range") || text.Contains("lobby")) { return false; } return true; } private void TrySendCurrentMatchIdToPeer(ulong peerId, string reason) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) if (!SteamClient.IsValid || peerId == 0L || peerId == SteamId.op_Implicit(SteamClient.SteamId) || !ShouldShareCurrentMatchId()) { return; } string currentMatchId = SBGLPlugin.CurrentMatchId; if (string.IsNullOrWhiteSpace(currentMatchId)) { return; } try { byte[] bytes = Encoding.UTF8.GetBytes("SBGL_MATCH_ID:" + currentMatchId); SteamNetworking.SendP2PPacket(SteamId.op_Implicit(peerId), bytes, -1, 2622, (P2PSend)2); Debug.Log((object)$"[SBGL-CompPluginCheck] Sent active match ID {currentMatchId} to peer {peerId} ({reason})"); } catch (Exception ex) { Debug.LogWarning((object)$"[SBGL-CompPluginCheck] Failed to send active match ID to peer {peerId} ({reason}): {ex.Message}"); } } private void AcceptIncomingP2PSessions() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) if (!SteamClient.IsValid) { return; } try { foreach (ulong item in _playerComplianceStatus.Keys.ToList()) { if (item != SteamId.op_Implicit(SteamClient.SteamId)) { try { SteamNetworking.AcceptP2PSessionWithUser(SteamId.op_Implicit(item)); } catch { } } } foreach (ulong item2 in _knownPeers.ToList()) { if (item2 != SteamId.op_Implicit(SteamClient.SteamId)) { try { SteamNetworking.AcceptP2PSessionWithUser(SteamId.op_Implicit(item2)); } catch { } } } if (Time.frameCount % 1200 == 0) { Debug.Log((object)$"[SBGL-CompPluginCheck] SteamClient.IsValid={SteamClient.IsValid}, SteamClient.SteamId={SteamClient.SteamId}, Known Peers={_knownPeers.Count}, Tracked Players={_playerComplianceStatus.Count}"); } } catch (Exception ex) { Debug.LogWarning((object)("[SBGL-CompPluginCheck] Error in AcceptIncomingP2PSessions: " + ex.Message)); } } private void BroadcastMyMods() { //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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_0199: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) if (!SteamClient.IsValid) { Debug.Log((object)"[SBGL-CompPluginCheck] BroadcastMyMods: SteamClient not valid"); return; } try { StringBuilder stringBuilder = new StringBuilder("SBGL_REPORT:"); UnifiedPlugin instance = UnifiedPlugin.Instance; string text = ((instance == null) ? null : ((BaseUnityPlugin)instance).Info.Metadata.Version?.ToString()) ?? "0.0.0"; stringBuilder.Append("⚡SBGL.UnifiedMod|" + text + ";"); bool flag = HasMelonLoaderLoaded(); if (flag) { stringBuilder.Append("⚠\ufe0fUSER_HAS_MELONLOADER;"); if (_lastMelonLoaderAnnouncementTime < 0f) { Debug.LogWarning((object)"[SBGL-CompPluginCheck] MelonLoader detected on this client."); } } foreach (PluginInfo value3 in Chainloader.PluginInfos.Values) { if (!ShouldIgnorePluginGuid(value3.Metadata.GUID)) { stringBuilder.Append($"{value3.Metadata.Name}|{value3.Metadata.Version};"); } } Debug.Log((object)$"[SBGL-CompPluginCheck] BroadcastMyMods (MelonLoader={flag})"); string value = stringBuilder.ToString().Substring("SBGL_REPORT:".Length); _remotePlayerMods[SteamId.op_Implicit(SteamClient.SteamId)] = value; if (_playerComplianceStatus.TryGetValue(SteamId.op_Implicit(SteamClient.SteamId), out var value2)) { value2.HasMelonLoader = flag; } if (!_playerDisplayNames.ContainsKey(SteamId.op_Implicit(SteamClient.SteamId))) { _playerDisplayNames[SteamId.op_Implicit(SteamClient.SteamId)] = SteamClient.Name ?? "Me"; } byte[] bytes = Encoding.UTF8.GetBytes(stringBuilder.ToString()); HashSet hashSet = new HashSet(_knownPeers); hashSet.UnionWith(_remotePlayerMods.Keys); hashSet.Remove(SteamId.op_Implicit(SteamClient.SteamId)); if (hashSet.Count > 0) { Debug.Log((object)$"[SBGL-CompPluginCheck] Broadcasting to {hashSet.Count} peers"); } foreach (ulong item in hashSet) { try { SteamNetworking.SendP2PPacket(SteamId.op_Implicit(item), bytes, -1, 2622, (P2PSend)2); } catch (Exception ex) { Debug.LogWarning((object)$"[SBGL-CompPluginCheck] Failed to send to peer {item}: {ex.Message}"); } } } catch (Exception ex2) { Debug.LogError((object)("[SBGL-CompPluginCheck] Error in BroadcastMyMods: " + ex2.Message + "\n" + ex2.StackTrace)); } } private void ListenForModReports() { //IL_00d9: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_013d: 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_017e: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) if (!SteamClient.IsValid) { return; } uint num = default(uint); while (SteamNetworking.IsP2PPacketAvailable(ref num, 2622)) { byte[] array = new byte[num]; uint num2 = 0u; SteamId val = default(SteamId); if (!SteamNetworking.ReadP2PPacket(array, ref num2, ref val, 2622)) { continue; } string @string = Encoding.UTF8.GetString(array); Debug.Log((object)$"[SBGL-CompPluginCheck] Received from peer {val.Value}: {@string}"); _knownPeers.Add(val.Value); if (@string.StartsWith("SBGL_MATCH_ID:")) { string text = @string.Replace("SBGL_MATCH_ID:", "").Trim(); try { ((MonoBehaviour)this).StartCoroutine(ForwardP2PMatchIdWithDelay(text, 2f, val.Value)); } catch { MatchResultSubmissionService.HandleIncomingMatchIdBroadcast(text); Debug.Log((object)$"[SBGL-CompPluginCheck] Forwarded P2P Match ID (immediate fallback) from {val.Value}: {text}"); } } else if (@string.StartsWith("SBGL_REPORT:")) { string text2 = @string.Replace("SBGL_REPORT:", ""); TrySendCurrentMatchIdToPeer(val.Value, "mod report received"); if (!_playerComplianceStatus.ContainsKey(val.Value)) { _playerComplianceStatus[val.Value] = new PlayerComplianceStatus { FirstSeenTime = Time.time }; } PlayerComplianceStatus playerComplianceStatus = _playerComplianceStatus[val.Value]; playerComplianceStatus.SteamId = val.Value; playerComplianceStatus.HasReportedMods = true; playerComplianceStatus.ModList = text2; playerComplianceStatus.IsCompliant = text2.Contains("⚡SBGL.UnifiedMod"); playerComplianceStatus.HasMelonLoader = text2.Contains("⚠\ufe0fUSER_HAS_MELONLOADER"); if (playerComplianceStatus.HasMelonLoader) { Debug.LogError((object)$"[SBGL-CompPluginCheck] ⚠\ufe0f⚠\ufe0f⚠\ufe0f ALERT: Player {val.Value} HAS MELONLOADER INSTALLED ⚠\ufe0f⚠\ufe0f⚠\ufe0f"); text2 = text2.Replace("⚠\ufe0fUSER_HAS_MELONLOADER;", ""); } if (!playerComplianceStatus.IsCompliant) { Debug.LogError((object)$"[SBGL-CompPluginCheck] ⚠\ufe0f MISSING MOD ALERT: Player {val.Value} does NOT have SBGL.UnifiedMod installed! Their mod list: {text2}"); SendComplianceNotification(val.Value, playerComplianceStatus); } _remotePlayerMods[val.Value] = text2; UpdateUIReport(); } } } [IteratorStateMachine(typeof(d__134))] private IEnumerator ForwardP2PMatchIdWithDelay(string matchId, float delaySeconds, ulong senderId) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__134(0) { <>4__this = this, matchId = matchId, delaySeconds = delaySeconds, senderId = senderId }; } internal static IEnumerable GetKnownPeers() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) CompetitivePluginCheck competitivePluginCheck = Object.FindFirstObjectByType(); if ((Object)(object)competitivePluginCheck == (Object)null) { return Array.Empty(); } HashSet hashSet = new HashSet(competitivePluginCheck._knownPeers); hashSet.UnionWith(competitivePluginCheck._remotePlayerMods.Keys); if (SteamClient.IsValid) { hashSet.Remove(SteamId.op_Implicit(SteamClient.SteamId)); } return hashSet; } internal static bool HasHigherVersionPeer() { CompetitivePluginCheck competitivePluginCheck = Object.FindFirstObjectByType(); if ((Object)(object)competitivePluginCheck == (Object)null) { return false; } UnifiedPlugin instance = UnifiedPlugin.Instance; Version version = ((instance != null) ? ((BaseUnityPlugin)instance).Info.Metadata.Version : null) ?? new Version(0, 0, 0); foreach (string value in competitivePluginCheck._remotePlayerMods.Values) { if (string.IsNullOrEmpty(value)) { continue; } string[] array = value.Split(';'); foreach (string text in array) { if (text.StartsWith("⚡SBGL.UnifiedMod|")) { string input = text.Substring("⚡SBGL.UnifiedMod|".Length).Trim(); if (Version.TryParse(input, out Version result) && result > version) { return true; } break; } } } return false; } internal static string GetCurrentSteamLobbyId() { //IL_001e: 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_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) CompetitivePluginCheck competitivePluginCheck = Object.FindFirstObjectByType(); if (!((Object)(object)competitivePluginCheck == (Object)null) && competitivePluginCheck._inLobby) { SteamId id = ((Lobby)(ref competitivePluginCheck._currentLobby)).Id; if (((SteamId)(ref id)).IsValid) { id = ((Lobby)(ref competitivePluginCheck._currentLobby)).Id; return id.Value.ToString(); } } return string.Empty; } private void SendComplianceNotification(ulong steamId, PlayerComplianceStatus status) { if (_playersNotifiedAbout.Contains(steamId)) { return; } _playersNotifiedAbout.Add(steamId); string text = string.Format("[SBGL] ⚠\ufe0f Player {0} failed compliance check: {1}", steamId, status.HasMelonLoader ? "MelonLoader detected" : "Missing SBGL.UnifiedMod"); Debug.LogWarning((object)("[SBGL-CompPluginCheck] NOTIFICATION: " + text)); try { Type type = Type.GetType("GameAssembly+Chat, GameAssembly"); if (type != null) { MethodInfo method = type.GetMethod("SendChatMessage", BindingFlags.Static | BindingFlags.Public); if (method != null) { method.Invoke(null, new object[1] { text }); Debug.Log((object)"[SBGL-CompPluginCheck] Chat message sent via game API"); } } } catch (Exception ex) { Debug.Log((object)("[SBGL-CompPluginCheck] Chat API not available (this is OK): " + ex.Message)); } } private void AnnounceOwnMelonLoaderToChat() { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"[SBGL-CompPluginCheck] ✓ AnnounceOwnMelonLoaderToChat() called"); if (!ConfigMelonLoaderChatEnabled) { Debug.Log((object)"[SBGL-CompPluginCheck] MelonLoader chat announcement is disabled in config - skipping"); } else { if (!_inLobby) { return; } string currentLobbyName = _currentLobbyName; Debug.Log((object)("[SBGL-CompPluginCheck] Lobby name check: '" + currentLobbyName + "'")); if (!currentLobbyName.StartsWith("SBGL-")) { Debug.Log((object)("[SBGL-CompPluginCheck] Lobby '" + currentLobbyName + "' is not an SBGL lobby - skipping announcement")); return; } string text = UnifiedPlugin.GetPlayerProfile()?.DisplayName; if (string.IsNullOrEmpty(text)) { SteamId steamId = SteamClient.SteamId; text = ((object)(SteamId)(ref steamId)).ToString(); } string text2 = "⚠\ufe0f MELONLOADER DETECTED: Player " + text + " is running MelonLoader!"; Debug.LogWarning((object)("[SBGL-CompPluginCheck] Announcing MelonLoader presence: " + text2)); if (!TrySendChatMessage(text2)) { Debug.Log((object)"[SBGL-CompPluginCheck] ℹ\ufe0f Chat API not available (game may not have public chat API). MelonLoader detection is still being broadcast via P2P to other SBGL mod users."); } } } private bool TrySendChatMessage(string message) { string[] array = new string[3] { "GameAssembly+TextChatManager, GameAssembly", "GameAssembly.TextChatManager, GameAssembly", "TextChatManager, GameAssembly" }; string[] array2 = new string[5] { "SendChatMessage", "PostMessage", "AddMessage", "Send", "SendMessage" }; string[] array3 = array; foreach (string text in array3) { try { Type type = Type.GetType(text); if (type == null) { continue; } Debug.Log((object)("[SBGL-CompPluginCheck] Found TextChatManager type: " + text)); string[] array4 = array2; foreach (string text2 in array4) { try { MethodInfo method = type.GetMethod(text2, BindingFlags.Static | BindingFlags.Public, null, new Type[1] { typeof(string) }, null); if (method != null) { method.Invoke(null, new object[1] { message }); Debug.Log((object)("[SBGL-CompPluginCheck] ✓ Chat message sent via static " + text + "." + text2)); return true; } } catch { } } PropertyInfo propertyInfo = type.GetProperty("Instance", BindingFlags.Static | BindingFlags.Public) ?? type.GetProperty("Singleton", BindingFlags.Static | BindingFlags.Public) ?? type.GetField("_instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.DeclaringType?.GetProperty("_instance", BindingFlags.Static | BindingFlags.Public); if (propertyInfo == null) { FieldInfo field = type.GetField("Instance", BindingFlags.Static | BindingFlags.Public); if (field != null) { object value = field.GetValue(null); if (value != null) { string[] array5 = array2; foreach (string text3 in array5) { try { MethodInfo method2 = type.GetMethod(text3, BindingFlags.Instance | BindingFlags.Public); if (method2 != null) { method2.Invoke(value, new object[1] { message }); Debug.Log((object)("[SBGL-CompPluginCheck] ✓ Chat message sent via " + text + "." + text3 + "() [instance field]")); return true; } } catch { } } } } } else if ((object)propertyInfo != null) { PropertyInfo propertyInfo2 = propertyInfo; if (true) { object value2 = propertyInfo2.GetValue(null); if (value2 != null) { string[] array6 = array2; foreach (string text4 in array6) { try { MethodInfo method3 = type.GetMethod(text4, BindingFlags.Instance | BindingFlags.Public); if (method3 != null) { method3.Invoke(value2, new object[1] { message }); Debug.Log((object)("[SBGL-CompPluginCheck] ✓ Chat message sent via " + text + "." + text4 + "() [singleton]")); return true; } } catch { } } } } } MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public); Debug.Log((object)("[SBGL-CompPluginCheck] Available methods on " + text + ": " + string.Join(", ", methods.Select((MethodInfo m) => m.Name).Distinct()))); } catch (Exception ex) { Debug.Log((object)("[SBGL-CompPluginCheck] Error trying " + text + ": " + ex.Message)); } } Debug.Log((object)"[SBGL-CompPluginCheck] TextChatManager not found or no compatible method available"); return false; } public void TriggerManualSync() { ((MonoBehaviour)this).StopAllCoroutines(); _isSyncing = false; ((MonoBehaviour)this).StartCoroutine(AutoUpdateLoop()); } private string GetOrdinal(int number) { if (number <= 0) { return number.ToString(); } int num = number % 100; int num2 = num; if ((uint)(num2 - 11) <= 2u) { return number + "th"; } return (number % 10) switch { 1 => number + "st", 2 => number + "nd", 3 => number + "rd", _ => number + "th", }; } private void ResetPlayerData(string userStatus = "Updating...") { _activeUsername = userStatus; _playerRank = "N/A"; _playerMMR = "0"; _playerPeak = "0"; _matches = "0"; _lastChange = "0"; _top3s = "0"; _avgScore = "0.0"; _winRate = "0%"; if ((Object)(object)_profilePicContainer != (Object)null) { _profilePicContainer.SetActive(false); } } private string GetInGameName() { try { Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "com.rlabrecque.steamworks.net" || a.GetName().Name.Contains("Steamworks")); if (assembly != null) { Type type = assembly.GetType("Steamworks.SteamClient"); if (type != null) { string text = type.GetProperty("Name", BindingFlags.Static | BindingFlags.Public)?.GetValue(null)?.ToString(); if (!string.IsNullOrEmpty(text)) { return text; } } } } catch (Exception ex) { Debug.Log((object)("[SBGL] Steam Reflection failed (Safe): " + ex.Message)); } return ""; } [IteratorStateMachine(typeof(d__145))] private IEnumerator AutoUpdateLoop() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__145(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__146))] private IEnumerator TriggerFullSync(string configId) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__146(0) { <>4__this = this, configId = configId }; } [IteratorStateMachine(typeof(d__147))] private IEnumerator FetchRecentMatches(string id) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__147(0) { <>4__this = this, id = id }; } [IteratorStateMachine(typeof(d__148))] private IEnumerator FetchEvents() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__148(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__149))] private IEnumerator ResolvePlayerIdFromName(string playerName) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__149(0) { <>4__this = this, playerName = playerName }; } [IteratorStateMachine(typeof(d__150))] private IEnumerator FetchPlayerData(string id) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__150(0) { <>4__this = this, id = id }; } [IteratorStateMachine(typeof(d__151))] private IEnumerator FetchLeaderboardRank(string id) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__151(0) { <>4__this = this, id = id }; } [IteratorStateMachine(typeof(d__152))] private IEnumerator GetNetworkTime() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__152(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__153))] private IEnumerator DownloadProfilePic(string url) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__153(0) { <>4__this = this, url = url }; } [IteratorStateMachine(typeof(d__154))] private IEnumerator CheckPluginsRoutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__154(0) { <>4__this = this }; } private void UpdateUIReport() { //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) StringBuilder stringBuilder = new StringBuilder(); LocalPluginScanResult localPluginScanResult = BuildLocalPluginScanResult(); stringBuilder.AppendLine("User: " + _activeUsername + ""); stringBuilder.AppendLine("Rank: #" + _playerRank + " / " + _totalPlayers); stringBuilder.AppendLine("Win Rate: " + _winRate + ""); float.TryParse(_lastChange, out var result); stringBuilder.AppendLine("MMR: " + _playerMMR + " (= 0f) ? "#55FF55" : "#FF5555") + ">" + ((result >= 0f) ? "+" : "") + _lastChange + ")"); stringBuilder.AppendLine("Avg. Par: " + _avgScore + ""); stringBuilder.AppendLine("Matches: " + _matches + " | Top 3s: " + _top3s + ""); if (ConfigShowModList) { stringBuilder.AppendLine("--- MY MODS ---"); foreach (PluginInfo value in Chainloader.PluginInfos.Values) { if (!ShouldIgnorePluginGuid(value.Metadata.GUID)) { stringBuilder.AppendLine((IsAllowedPluginGuid(value.Metadata.GUID) ? "O" : "X") + " " + value.Metadata.Name + ""); } } } stringBuilder.AppendLine("---"); stringBuilder.AppendLine("Sync: " + _lastSyncTime + " | Status: " + _syncStatus + ""); if ((Object)(object)_statsText != (Object)null) { ((TMP_Text)_statsText).text = stringBuilder.ToString(); } UpdateDebugWindow(localPluginScanResult); if ((Object)(object)_illegalWarningText != (Object)null) { ((Component)_illegalWarningText).gameObject.SetActive(localPluginScanResult.HasIllegalMods); } if ((Object)(object)_missingWarningText != (Object)null) { Scene activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; bool flag = name.Contains("Driving") || name.Contains("Range"); ((Component)_missingWarningText).gameObject.SetActive(localPluginScanResult.MissingModNames.Count > 0 && flag); if (((Component)_missingWarningText).gameObject.activeSelf) { ((TMP_Text)_missingWarningText).text = "MISSING MODS:\n" + string.Join(", ", localPluginScanResult.MissingModNames) + ""; } } } private void UpdateDebugWindow(LocalPluginScanResult localPluginScan) { if ((Object)(object)_debugWindowText == (Object)null || (Object)(object)_debugWindowObj == (Object)null) { return; } if (ConfigShowDebugWindow) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("--- DEBUG INFORMATION ---"); stringBuilder.AppendLine($"Config Show Debug: {ConfigShowDebugWindow}"); stringBuilder.AppendLine($"Remote Players Count: {_remotePlayerMods.Count}"); stringBuilder.AppendLine($"Allowed Mods Count: {_allowedModsSnapshot.Count}"); stringBuilder.AppendLine("Hash Enforcement: " + (_allowedModsSnapshot.HasHashConstraints ? "ON" : "OFF (legacy)")); stringBuilder.AppendLine($"Missing Mods Count: {localPluginScan.MissingModNames.Count}"); stringBuilder.AppendLine($"Tampered Mods Count: {localPluginScan.TamperedModNames.Count}"); stringBuilder.AppendLine($"Suspicious Runtime Assemblies: {localPluginScan.SuspiciousRuntimeAssemblies.Count}"); stringBuilder.AppendLine($"Any Illegal Mods: {localPluginScan.HasIllegalMods}"); stringBuilder.AppendLine("Sync Status: " + _syncStatus); stringBuilder.AppendLine("Last Sync Time: " + _lastSyncTime); stringBuilder.AppendLine("Player ID: " + ConfigPlayerId); stringBuilder.AppendLine("Resolved ID: " + ResolvedID); if (localPluginScan.TamperedModNames.Count > 0) { stringBuilder.AppendLine("--- HASH MISMATCH (TAMPERED) ---"); foreach (string tamperedModName in localPluginScan.TamperedModNames) { stringBuilder.AppendLine(tamperedModName); } } if (localPluginScan.SuspiciousRuntimeAssemblies.Count > 0) { stringBuilder.AppendLine("--- SUSPICIOUS RUNTIME ASSEMBLIES ---"); foreach (string suspiciousRuntimeAssembly in localPluginScan.SuspiciousRuntimeAssemblies) { stringBuilder.AppendLine(suspiciousRuntimeAssembly); } } stringBuilder.AppendLine("--- REMOTE PLAYERS ---"); foreach (KeyValuePair remotePlayerMod in _remotePlayerMods) { stringBuilder.AppendLine($"Player {remotePlayerMod.Key}: {remotePlayerMod.Value}"); } ((TMP_Text)_debugWindowText).text = stringBuilder.ToString(); _debugWindowObj.SetActive(true); } else { _debugWindowObj.SetActive(false); } } private void CreateUI() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0163: 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_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: 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) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Expected O, but got Unknown //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) _canvasObj = new GameObject("SBG_Canvas"); Canvas val = _canvasObj.AddComponent(); val.renderMode = (RenderMode)0; val.sortingOrder = 99999; _bgObj = new GameObject("BG"); _bgObj.transform.SetParent(_canvasObj.transform, false); _bgImage = _bgObj.AddComponent(); ((Graphic)_bgImage).color = new Color(0f, 0f, 0f, ConfigAlpha); _bgRect = _bgObj.GetComponent(); RectTransform bgRect = _bgRect; RectTransform bgRect2 = _bgRect; Vector2 val2 = (_bgRect.pivot = Vector2.zero); Vector2 val5 = (bgRect.anchorMin = (bgRect2.anchorMax = val2)); VerticalLayoutGroup val6 = _bgObj.AddComponent(); ((LayoutGroup)val6).padding = new RectOffset(10, 10, 10, 10); _bgObj.AddComponent().verticalFit = (FitMode)2; _profilePicContainer = new GameObject("PicContainer"); _profilePicContainer.transform.SetParent(_bgObj.transform, false); RectTransform val7 = _profilePicContainer.AddComponent(); ((Vector2)(ref val2))..ctor(1f, 1f); val7.pivot = val2; val5 = (val7.anchorMin = (val7.anchorMax = val2)); val7.anchoredPosition = new Vector2(-10f, -10f); val7.sizeDelta = new Vector2(42f, 42f); _profilePicContainer.AddComponent().ignoreLayout = true; _profilePicContainer.AddComponent(); _profileIcon = new GameObject("I").AddComponent(); ((Component)_profileIcon).transform.SetParent(_profilePicContainer.transform, false); ((Graphic)_profileIcon).rectTransform.anchorMin = Vector2.zero; ((Graphic)_profileIcon).rectTransform.anchorMax = Vector2.one; ((Graphic)_profileIcon).rectTransform.sizeDelta = Vector2.zero; _profilePicContainer.SetActive(false); _statsText = new GameObject("S").AddComponent(); ((TMP_Text)_statsText).transform.SetParent(_bgObj.transform, false); ((TMP_Text)_statsText).fontSize = 13f; ((TMP_Text)_statsText).richText = true; _warnContainer = new GameObject("WarnContainer"); _warnContainer.transform.SetParent(_canvasObj.transform, false); RectTransform val10 = _warnContainer.AddComponent(); ((Vector2)(ref val5))..ctor(0.5f, 0f); val10.anchorMax = val5; val10.anchorMin = val5; val10.pivot = new Vector2(0.5f, 0f); val10.anchoredPosition = new Vector2(0f, 15f); val10.sizeDelta = new Vector2(1000f, 200f); VerticalLayoutGroup val11 = _warnContainer.AddComponent(); ((LayoutGroup)val11).childAlignment = (TextAnchor)7; _illegalWarningText = new GameObject("RT").AddComponent(); ((TMP_Text)_illegalWarningText).transform.SetParent(_warnContainer.transform, false); ((TMP_Text)_illegalWarningText).text = "ILLEGAL MODS DETECTED"; ((Graphic)_illegalWarningText).color = Color.red; ((TMP_Text)_illegalWarningText).fontSize = 32f; ((TMP_Text)_illegalWarningText).alignment = (TextAlignmentOptions)514; ((TMP_Text)_illegalWarningText).fontStyle = (FontStyles)1; ((Component)_illegalWarningText).gameObject.SetActive(false); _missingWarningText = new GameObject("YT").AddComponent(); ((TMP_Text)_missingWarningText).transform.SetParent(_warnContainer.transform, false); ((Graphic)_missingWarningText).color = Color.yellow; ((TMP_Text)_missingWarningText).fontSize = 18f; ((TMP_Text)_missingWarningText).alignment = (TextAlignmentOptions)514; ((Component)_missingWarningText).gameObject.SetActive(false); Object.DontDestroyOnLoad((Object)(object)_canvasObj); } } [HarmonyPatch] public static class MenuTabsPatch { [HarmonyPostfix] [HarmonyPatch(typeof(MenuTabs), "Awake")] public static void Postfix(MenuTabs __instance) { SBGLTabManager.Inject(__instance); } } public static class SBGLTabManager { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func <>9__1_0; public static Func <>9__1_1; public static UnityAction <>9__5_2; internal bool b__1_0(GameObject t) { return ((Object)t).name == "SBGL"; } internal bool b__1_1(GameObject t) { return ((Object)t).name.Contains("Controls"); } internal void b__5_2() { Application.OpenURL("https://sbgleague.com/AccountSettings"); } } private const string TAB_NAME = "SBGL"; public static void Inject(MenuTabs menuTabs) { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Expected O, but got Unknown //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Expected O, but got Unknown if ((Object)(object)menuTabs == (Object)null) { return; } Transform val = ((Component)menuTabs).transform.Find("Menu/Options Tab"); GameObject val2 = ((IEnumerable)menuTabs.tabs).FirstOrDefault((Func)((GameObject t) => ((Object)t).name == "SBGL")); if ((Object)(object)val2 != (Object)null) { List list = new List(); foreach (Transform item in val2.transform) { Transform val3 = item; list.Add(((Component)val3).gameObject); } list.ForEach((Action)Object.DestroyImmediate); PopulateSBGLPage(val2); return; } Transform val4 = ((val != null) ? val.Find("Controls") : null); GameObject val5 = ((IEnumerable)menuTabs.tabs).FirstOrDefault((Func)((GameObject t) => ((Object)t).name.Contains("Controls"))); if (!((Object)(object)val4 != (Object)null) || !((Object)(object)val5 != (Object)null)) { return; } ((HorizontalOrVerticalLayoutGroup)((Component)val).GetComponent()).spacing = -45f; Button[] tabButtons = menuTabs.tabButtons; foreach (Button val6 in tabButtons) { ((Component)val6).transform.localScale = new Vector3(0.8f, 0.8f, 0.8f); } GameObject val7 = Object.Instantiate(((Component)val4).gameObject, val); ((Object)val7).name = "SBGL"; SetupButtonText(val7, "SBGL"); GameObject val8 = Object.Instantiate(val5, val5.transform.parent); ((Object)val8).name = "SBGL"; if (Object.op_Implicit((Object)(object)val8.GetComponent())) { Object.DestroyImmediate((Object)(object)val8.GetComponent()); } foreach (Transform item2 in val8.transform) { Transform val9 = item2; Object.DestroyImmediate((Object)(object)((Component)val9).gameObject); } PopulateSBGLPage(val8); menuTabs.tabButtons = menuTabs.tabButtons.Append(val7.GetComponent