using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Net.Http; using System.Net.Http.Headers; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using System.Xml.Linq; using HarmonyLib; using Il2CppFishNet; using Il2CppFishNet.Managing; using Il2CppFishNet.Managing.Object; using Il2CppFishNet.Object; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.Attributes; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppScheduleOne; using Il2CppScheduleOne.Combat; using Il2CppScheduleOne.Core.Items.Framework; using Il2CppScheduleOne.DevUtilities; using Il2CppScheduleOne.Dragging; using Il2CppScheduleOne.Economy; using Il2CppScheduleOne.EntityFramework; using Il2CppScheduleOne.Equipping; using Il2CppScheduleOne.ItemFramework; using Il2CppScheduleOne.Law; using Il2CppScheduleOne.Management; using Il2CppScheduleOne.Management.UI; using Il2CppScheduleOne.Messaging; using Il2CppScheduleOne.Money; using Il2CppScheduleOne.NPCs; using Il2CppScheduleOne.NPCs.Framework; using Il2CppScheduleOne.NPCs.Relation; using Il2CppScheduleOne.NPCs.Responses; using Il2CppScheduleOne.ObjectScripts; using Il2CppScheduleOne.PlayerScripts; using Il2CppScheduleOne.Police; using Il2CppScheduleOne.Product; using Il2CppScheduleOne.Property; using Il2CppScheduleOne.Storage; using Il2CppScheduleOne.UI; using Il2CppScheduleOne.UI.Management; using Il2CppScheduleOne.UI.Phone; using Il2CppScheduleOne.UI.Phone.Messages; using Il2CppScheduleOne.Vehicles; using Il2CppScheduleOne.Vision; using Il2CppSteamworks; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Il2CppSystem.Reflection; using Il2CppTMPro; using Jint; using MelonLoader; using MelonLoader.Preferences; using MelonLoader.Utils; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using S1API.Console; using S1API.Entities; using S1API.GameTime; using S1API.Input; using S1API.Items; using S1API.Law; using S1API.Leveling; using S1API.Lifecycle; using S1API.Money; using S1API.PhoneApp; using S1API.Products; using S1API.Property; using S1API.Storage; using S1API.Storages; using S1API.UI; using S1API.Utils; using SIAKImperium; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; using UnityEngine.Yoga; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(/*Could not decode attribute arguments.*/)] [assembly: MelonInfo(typeof(SIAKImperiumMod), "[S.I.A.K] Imperium", "3.0.1", "Eternidox", null)] [assembly: MelonColor(255, 255, 80, 80)] [assembly: MelonAuthorColor(255, 80, 160, 255)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: AssemblyVersion("0.0.0.0")] [module: RefSafetyRules(11)] internal class { static () { ImperiumEmbeddedDependencyLoader.InitializeModule(); } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : System.Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(/*Could not decode attribute arguments.*/)] internal sealed class NullableAttribute : System.Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(/*Could not decode attribute arguments.*/)] internal sealed class NullableContextAttribute : System.Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(/*Could not decode attribute arguments.*/)] internal sealed class RefSafetyRulesAttribute : System.Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SIAKImperium { public sealed class ImperiumAntivirusApp : PhoneApp { private static ImperiumAntivirusApp? _instance; private static GameObject? _iconRoot; private static readonly Action OpenFromLauncherAction = new Action(OpenFromLauncher); protected override string AppName => "SIAKAntivirusApp"; protected override string AppTitle => "Advanced Anti Virus"; protected override string IconLabel => "Antivirus"; protected override string IconFileName => string.Empty; protected override Sprite? IconSprite => ImperiumAssets.LoadAntivirusAppIconSprite(); protected override EOrientation Orientation => (EOrientation)0; protected override void OnCreatedUI(GameObject container) { //IL_0095: 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) _instance = this; if (ImperiumWebUiRuntime.Available) { GameObject val = UIFactory.Panel("AntivirusHtmlRoot", container.transform, Color.clear, (Vector2?)null, (Vector2?)null, true); ImperiumAntivirusWebController imperiumAntivirusWebController = val.AddComponent(); if (imperiumAntivirusWebController.Initialize(val, container)) { RefreshAvailability(SIAKImperiumMod.Service.GetSnapshot().Antivirus); return; } val.SetActive(false); Object.Destroy((Object)(object)val); } GameObject val2 = UIFactory.Panel("AntivirusRoot", container.transform, new Color(0.035f, 0.06f, 0.05f), (Vector2?)null, (Vector2?)null, true); ImperiumAntivirusAppController imperiumAntivirusAppController = val2.AddComponent(); imperiumAntivirusAppController.Initialize(val2, container); RefreshAvailability(SIAKImperiumMod.Service.GetSnapshot().Antivirus); } internal static bool TryOpenInstalled() { ImperiumAntivirusStatus antivirus = SIAKImperiumMod.Service.GetSnapshot().Antivirus; if (_instance == null || !antivirus.Enabled || !antivirus.Installed) { return false; } ((PhoneApp)_instance).OpenApp(); return true; } internal static void RefreshAvailability(ImperiumAntivirusStatus antivirus) { if (_instance != null) { _iconRoot = ImperiumPhoneLauncherRecovery.Ensure(_iconRoot, "SIAKAntivirusApp", "Antivirus", ImperiumAssets.LoadAntivirusAppIconSprite(), OpenFromLauncherAction); if ((Object)(object)_iconRoot != (Object)null) { _iconRoot.SetActive(antivirus.Enabled && antivirus.Installed); } } } internal static void RefreshAvailabilityFromService() { ImperiumService service = SIAKImperiumMod.Service; if (service != null) { RefreshAvailability(service.GetSnapshot().Antivirus); } } private static void OpenFromLauncher() { TryOpenInstalled(); } } internal sealed class ImperiumAntivirusAppController : MonoBehaviour { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Action <>9__37_0; public static Action <>9__37_1; internal void b__37_0() { SIAKImperiumMod.Service.SubscribeAntivirus("basic"); } internal void b__37_1() { SIAKImperiumMod.Service.SubscribeAntivirus("premium"); } } private static readonly Color Accent = new Color(0.32f, 0.86f, 0.57f); private static readonly Color Muted = new Color(0.65f, 0.75f, 0.7f); private static readonly Color Panel = new Color(0.06f, 0.12f, 0.1f); private GameObject? _loginRoot; private GameObject? _mainRoot; private RectTransform? _portraitContainer; private RectTransform? _portraitRoot; private Vector2 _lastPortraitContainerSize; private InputField? _playerNameInput; private Button? _fingerprintButton; private Image? _fingerprintScannerBackground; private Image? _fingerprintArtwork; private Text? _loginHint; private Text? _statusText; private Text? _planText; private Text? _scanText; private Text? _malwareText; private Text? _spywareText; private Text? _ransomwareText; private Button? _basicButton; private Text? _basicLabel; private Button? _premiumButton; private Text? _premiumLabel; private Button? _scanButton; private Text? _scanLabel; private Button? _resultsButton; private Text? _resultsLabel; private GameObject? _resultsButtonRoot; private Button? _unsubscribeButton; private Text? _unsubscribeLabel; private string _verifiedPlayerName = string.Empty; private int _lastStateVersion = -1; private float _fingerprintHeldSeconds; private float _scanAnimationStartedAt = -1f; private bool _wasScanning; private bool _resultsVisible; public ImperiumAntivirusAppController(System.IntPtr pointer) : base(pointer) { } public void Initialize(GameObject root, GameObject container) { //IL_002c: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: 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_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_042d: Unknown result type (might be due to invalid IL or missing references) //IL_04a8: Unknown result type (might be due to invalid IL or missing references) //IL_04bf: Unknown result type (might be due to invalid IL or missing references) //IL_04d6: Unknown result type (might be due to invalid IL or missing references) //IL_04ed: Unknown result type (might be due to invalid IL or missing references) //IL_04fa: Unknown result type (might be due to invalid IL or missing references) //IL_053d: Unknown result type (might be due to invalid IL or missing references) //IL_0596: Unknown result type (might be due to invalid IL or missing references) //IL_05d0: Unknown result type (might be due to invalid IL or missing references) //IL_05e7: 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_0615: Unknown result type (might be due to invalid IL or missing references) //IL_062c: Unknown result type (might be due to invalid IL or missing references) //IL_066c: Unknown result type (might be due to invalid IL or missing references) //IL_068c: Unknown result type (might be due to invalid IL or missing references) //IL_069b: Unknown result type (might be due to invalid IL or missing references) //IL_06a0: Unknown result type (might be due to invalid IL or missing references) //IL_06a5: Unknown result type (might be due to invalid IL or missing references) //IL_06bc: Unknown result type (might be due to invalid IL or missing references) //IL_06f0: Unknown result type (might be due to invalid IL or missing references) //IL_0722: Unknown result type (might be due to invalid IL or missing references) //IL_0731: Unknown result type (might be due to invalid IL or missing references) //IL_0736: Unknown result type (might be due to invalid IL or missing references) //IL_073b: 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_078c: Unknown result type (might be due to invalid IL or missing references) //IL_079b: Unknown result type (might be due to invalid IL or missing references) //IL_07a0: Unknown result type (might be due to invalid IL or missing references) //IL_07a5: Unknown result type (might be due to invalid IL or missing references) //IL_07d6: Unknown result type (might be due to invalid IL or missing references) //IL_07f6: Unknown result type (might be due to invalid IL or missing references) //IL_0805: Unknown result type (might be due to invalid IL or missing references) //IL_080a: Unknown result type (might be due to invalid IL or missing references) //IL_080f: Unknown result type (might be due to invalid IL or missing references) //IL_0835: Unknown result type (might be due to invalid IL or missing references) //IL_0867: Unknown result type (might be due to invalid IL or missing references) //IL_0876: Unknown result type (might be due to invalid IL or missing references) //IL_087b: Unknown result type (might be due to invalid IL or missing references) //IL_0880: Unknown result type (might be due to invalid IL or missing references) //IL_08b1: Unknown result type (might be due to invalid IL or missing references) //IL_08d1: Unknown result type (might be due to invalid IL or missing references) //IL_08e0: Unknown result type (might be due to invalid IL or missing references) //IL_08e5: Unknown result type (might be due to invalid IL or missing references) //IL_08ea: Unknown result type (might be due to invalid IL or missing references) //IL_0969: Unknown result type (might be due to invalid IL or missing references) //IL_097a: Unknown result type (might be due to invalid IL or missing references) //IL_097f: Unknown result type (might be due to invalid IL or missing references) //IL_0984: Unknown result type (might be due to invalid IL or missing references) //IL_098c: Unknown result type (might be due to invalid IL or missing references) //IL_09bc: Unknown result type (might be due to invalid IL or missing references) //IL_09cb: Unknown result type (might be due to invalid IL or missing references) //IL_09d0: Unknown result type (might be due to invalid IL or missing references) //IL_09d5: Unknown result type (might be due to invalid IL or missing references) //IL_0a00: Unknown result type (might be due to invalid IL or missing references) //IL_0a11: Unknown result type (might be due to invalid IL or missing references) //IL_0a16: Unknown result type (might be due to invalid IL or missing references) //IL_0a1b: Unknown result type (might be due to invalid IL or missing references) //IL_0a23: Unknown result type (might be due to invalid IL or missing references) //IL_0a53: Unknown result type (might be due to invalid IL or missing references) //IL_0a62: Unknown result type (might be due to invalid IL or missing references) //IL_0a67: Unknown result type (might be due to invalid IL or missing references) //IL_0a6c: Unknown result type (might be due to invalid IL or missing references) //IL_0a97: Unknown result type (might be due to invalid IL or missing references) //IL_0aa8: Unknown result type (might be due to invalid IL or missing references) //IL_0aad: Unknown result type (might be due to invalid IL or missing references) //IL_0ab2: Unknown result type (might be due to invalid IL or missing references) //IL_0aba: Unknown result type (might be due to invalid IL or missing references) //IL_0aea: Unknown result type (might be due to invalid IL or missing references) //IL_0af9: Unknown result type (might be due to invalid IL or missing references) //IL_0afe: Unknown result type (might be due to invalid IL or missing references) //IL_0b03: Unknown result type (might be due to invalid IL or missing references) //IL_0b2e: Unknown result type (might be due to invalid IL or missing references) //IL_0b3f: Unknown result type (might be due to invalid IL or missing references) //IL_0b44: Unknown result type (might be due to invalid IL or missing references) //IL_0b49: Unknown result type (might be due to invalid IL or missing references) //IL_0b51: Unknown result type (might be due to invalid IL or missing references) //IL_0b89: Unknown result type (might be due to invalid IL or missing references) //IL_0b98: Unknown result type (might be due to invalid IL or missing references) //IL_0b9d: Unknown result type (might be due to invalid IL or missing references) //IL_0ba2: Unknown result type (might be due to invalid IL or missing references) //IL_0bcd: Unknown result type (might be due to invalid IL or missing references) //IL_0bde: Unknown result type (might be due to invalid IL or missing references) //IL_0be3: Unknown result type (might be due to invalid IL or missing references) //IL_0be8: Unknown result type (might be due to invalid IL or missing references) //IL_0bf0: Unknown result type (might be due to invalid IL or missing references) //IL_0c20: Unknown result type (might be due to invalid IL or missing references) //IL_0c2f: Unknown result type (might be due to invalid IL or missing references) //IL_0c34: Unknown result type (might be due to invalid IL or missing references) //IL_0c39: Unknown result type (might be due to invalid IL or missing references) //IL_0c5a: Unknown result type (might be due to invalid IL or missing references) //IL_0c5f: Unknown result type (might be due to invalid IL or missing references) //IL_0c65: Expected O, but got Unknown //IL_0c9b: Unknown result type (might be due to invalid IL or missing references) //IL_0ca5: Expected O, but got Unknown //IL_0caf: Unknown result type (might be due to invalid IL or missing references) //IL_0cb9: Expected O, but got Unknown //IL_0cc7: Unknown result type (might be due to invalid IL or missing references) //IL_0cd1: Expected O, but got Unknown //IL_0c81: Unknown result type (might be due to invalid IL or missing references) //IL_0c86: Unknown result type (might be due to invalid IL or missing references) //IL_0c8c: Expected O, but got Unknown _portraitRoot = root.GetComponent(); _portraitContainer = container.GetComponent(); ApplyPortraitCanvasLayout(force: true); GameObject val = UIFactory.Panel("AntivirusBrandLogo", root.transform, Color.clear, (Vector2?)null, (Vector2?)null, false); Image component = val.GetComponent(); component.sprite = ImperiumAssets.LoadAntivirusLogoSprite(); ((Graphic)component).color = Color.white; component.preserveAspect = true; ((Graphic)component).raycastTarget = false; Stretch(val.GetComponent(), new Vector2(0.38f, 0.918f), new Vector2(0.62f, 0.992f), Vector2.zero, Vector2.zero); Text val2 = UIFactory.Text("AntivirusHeader", "Advanced Anti Virus", root.transform, 30, (TextAnchor)4, (FontStyle)1); ((Graphic)val2).color = Accent; Stretch(((Component)val2).GetComponent(), new Vector2(0.08f, 0.865f), new Vector2(0.92f, 0.918f), Vector2.zero, Vector2.zero); Text val3 = UIFactory.Text("AntivirusSubheader", "Made by Imperium", root.transform, 18, (TextAnchor)4, (FontStyle)2); ((Graphic)val3).color = Muted; Stretch(((Component)val3).GetComponent(), new Vector2(0.08f, 0.822f), new Vector2(0.92f, 0.865f), Vector2.zero, Vector2.zero); _loginRoot = UIFactory.Panel("AntivirusLogin", root.transform, Color.clear, (Vector2?)null, (Vector2?)null, true); GameObject val4 = UIFactory.Panel("AntivirusLoginPanel", _loginRoot.transform, Panel, (Vector2?)null, (Vector2?)null, false); Stretch(val4.GetComponent(), new Vector2(0.08f, 0.11f), new Vector2(0.92f, 0.8f), Vector2.zero, Vector2.zero); Text val5 = UIFactory.Text("AntivirusLoginTitle", "Secure User Verification", val4.transform, 24, (TextAnchor)4, (FontStyle)1); ((Graphic)val5).color = Color.white; Stretch(((Component)val5).GetComponent(), new Vector2(0.08f, 0.83f), new Vector2(0.92f, 0.94f), Vector2.zero, Vector2.zero); Text val6 = UIFactory.Text("AntivirusLoginBody", "Enter your current Imperium player name, then hold the fingerprint scanner until it turns green.", val4.transform, 18, (TextAnchor)1, (FontStyle)0); ((Graphic)val6).color = Muted; val6.horizontalOverflow = (HorizontalWrapMode)0; Stretch(((Component)val6).GetComponent(), new Vector2(0.08f, 0.65f), new Vector2(0.92f, 0.81f), Vector2.zero, Vector2.zero); _playerNameInput = CreateInputField("AntivirusPlayerName", val4.transform, "Your Imperium player name", 20); _playerNameInput.lineType = (LineType)0; _playerNameInput.characterLimit = 48; Stretch(((Component)_playerNameInput).GetComponent(), new Vector2(0.1f, 0.5f), new Vector2(0.9f, 0.6f), Vector2.zero, Vector2.zero); GameObject val7 = UIFactory.Panel("AntivirusFingerprintRing", val4.transform, Color.white, (Vector2?)null, (Vector2?)null, false); Image component2 = val7.GetComponent(); component2.sprite = ImperiumAntivirusUiSprites.Ring; component2.type = (Type)0; component2.preserveAspect = true; ((Graphic)component2).raycastTarget = false; ((Graphic)component2).color = new Color(0.2f, 0.78f, 0.54f, 0.95f); RectTransform component3 = val7.GetComponent(); component3.anchorMin = new Vector2(0.5f, 0.31f); component3.anchorMax = new Vector2(0.5f, 0.31f); component3.pivot = new Vector2(0.5f, 0.5f); component3.sizeDelta = new Vector2(170f, 170f); component3.anchoredPosition = Vector2.zero; GameObject val8 = UIFactory.Panel("AntivirusFingerprintScanner", val7.transform, Color.white, (Vector2?)null, (Vector2?)null, false); _fingerprintScannerBackground = val8.GetComponent(); _fingerprintScannerBackground.sprite = ImperiumAntivirusUiSprites.Disc; _fingerprintScannerBackground.type = (Type)0; _fingerprintScannerBackground.preserveAspect = true; ((Graphic)_fingerprintScannerBackground).raycastTarget = true; RectTransform component4 = val8.GetComponent(); component4.anchorMin = new Vector2(0.5f, 0.5f); component4.anchorMax = new Vector2(0.5f, 0.5f); component4.pivot = new Vector2(0.5f, 0.5f); component4.sizeDelta = new Vector2(144f, 144f); component4.anchoredPosition = Vector2.zero; _fingerprintButton = val8.AddComponent", "" }); if (string.Equals(imperiumAppStoreCatalogItem.Category, "RECOMMENDED", (StringComparison)5)) { val2.Append(text3); } else { val3.Append(text3); } _renderedAppIds.Add(imperiumAppStoreCatalogItem.Id); _renderedAppNames.Add(imperiumAppStoreCatalogItem.Name); _renderedAppCategories.Add(string.Equals(imperiumAppStoreCatalogItem.Category, "RECOMMENDED", (StringComparison)5) ? "recommended" : "community"); } StringBuilder val4 = new StringBuilder(); if (val2.Length > 0) { val4.Append("

Recommended

" + $"
{val2}
"); } if (val3.Length > 0) { val4.Append("

Community

" + $"
{val3}
"); } string html = ImperiumAssets.LoadEmbeddedText("interface/appstore/index.html").Replace("{{CATALOG}}", ((object)val4).ToString(), (StringComparison)4).Replace("{{RECOMMENDED_ACTIVE}}", (_selectedCategory == "recommended") ? "store-tab-active" : string.Empty, (StringComparison)4) .Replace("{{COMMUNITY_ACTIVE}}", (_selectedCategory == "community") ? "store-tab-active" : string.Empty, (StringComparison)4) .Replace("{{ALL_ACTIVE}}", (_selectedCategory == "all") ? "store-tab-active" : string.Empty, (StringComparison)4); string css = ImperiumAssets.LoadEmbeddedText("interface/appstore/styles.css"); string script = ImperiumAssets.LoadEmbeddedText("interface/appstore/app.js"); _document?.Dispose(); _document = ImperiumWebUiRuntime.TryRender(_root.transform, html, css, script, (IReadOnlyDictionary?)(object)val, out string error, ImperiumInterfaceSurface.Landscape); if (_document == null) { Instance? modLogger = SIAKImperiumMod.ModLogger; if (modLogger != null) { modLogger.Warning("[Imperium UI] App Store render failed: " + error); } return false; } for (int num2 = 0; num2 < catalog.Count; num2++) { Image artwork = _document.GetArtwork($"app-icon-{num2}"); if (!((Object)(object)artwork == (Object)null) && !((Object)(object)catalog[num2].Icon == (Object)null)) { artwork.sprite = catalog[num2].Icon; artwork.preserveAspect = true; ((Graphic)artwork).color = Color.white; } } TMP_InputField input = _document.GetInput("app-search"); if ((Object)(object)input != (Object)null && _lastSearch.Length > 0) { input.SetTextWithoutNotify(_lastSearch); } _lastManagerVersion = ImperiumAppStoreManager.StateVersion; _lastCatalogVersion = ImperiumAppStoreManager.CatalogVersion; ApplySearch(); UpdateDownloadPanel(); return true; } private void RefreshCardStates() { if (_document != null) { for (int i = 0; i < _renderedAppIds.Count; i++) { string appId = _renderedAppIds[i]; bool flag = ImperiumAppStoreManager.IsInstalled(appId); bool flag2 = ImperiumAppStoreManager.IsActiveDownload(appId); int num = ImperiumAppStoreManager.QueuePosition(appId); string value = (flag ? "Installed on this device" : (flag2 ? "Downloading now" : ((num > 0) ? $"Queued in position {num}" : "Available for local download"))); string value2 = (flag ? "Uninstall" : (flag2 ? "Downloading" : ((num > 0) ? $"Queued #{num}" : "Get"))); _document.SetText($"app-status-{i}", value); _document.SetText($"app-action-{i}", value2); _document.SetInteractable($"app-action-{i}", flag || (!flag2 && num == 0)); } } } private void ApplySearch() { if (_document == null) { return; } string text = _lastSearch.Trim(); int num = 0; Dictionary val = new Dictionary((IEqualityComparer)(object)StringComparer.OrdinalIgnoreCase); int num2 = 0; int num3 = 0; for (int i = 0; i < _renderedAppNames.Count; i++) { string text2 = _renderedAppCategories[i]; bool flag = (_selectedCategory == "all" || string.Equals(_selectedCategory, text2, (StringComparison)5)) && (text.Length == 0 || _renderedAppNames[i].Contains(text, (StringComparison)5)); val[$"app-card-{i}"] = flag; if (flag) { num++; if (text2 == "recommended") { num2++; } else { num3++; } } } val["store-category-recommended"] = num2 > 0; val["store-category-community"] = num3 > 0; val["empty-search"] = num == 0; _document.SetVisibility((IReadOnlyDictionary)(object)val); } private void ShowRecommended() { _selectedCategory = "recommended"; Render(); } private void ShowCommunity() { _selectedCategory = "community"; Render(); } private void ShowAll() { _selectedCategory = "all"; Render(); } private void UpdateDownloadPanel() { if (_document == null) { return; } ImperiumAppStoreDownloadView downloadView = ImperiumAppStoreManager.GetDownloadView(); string text = string.Empty; for (int i = 0; i < _renderedAppIds.Count; i++) { if (string.Equals(_renderedAppIds[i], downloadView.AppId, (StringComparison)5)) { text = _renderedAppNames[i]; break; } } bool flag = downloadView.AppId.Length > 0; _document.SetText("download-name", flag ? text : "No active download"); _document.SetText("download-status", flag ? $"{Mathf.Clamp(Mathf.RoundToInt(downloadView.Progress * 100f), 0, 100)}%" : ((downloadView.QueueCount > 0) ? $"{downloadView.QueueCount} application(s) queued" : "Your local queue is ready.")); _document.SetProgress("download-progress", flag ? downloadView.Progress : 0f); } [HideFromIl2Cpp] private static string E(string? value) { return SecurityElement.Escape(value ?? string.Empty) ?? string.Empty; } } internal sealed class ImperiumAppStoreCatalogItem { [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Id { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Name { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Category { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public Sprite? Icon { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public GameObject? IconRoot { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List IconRoots { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List Aliases { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string MergeKey { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; } internal sealed class ImperiumAppStoreDownloadView { [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string AppId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float Progress { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int SecondsRemaining { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int QueueCount { [CompilerGenerated] get; [CompilerGenerated] set; } } internal sealed class ImperiumLocalAppStoreDatabase { [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int SchemaVersion { [CompilerGenerated] get; [CompilerGenerated] set; } = 3; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool LegacyPreferencesImported { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string LastCleanupUtc { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public Dictionary Profiles { [CompilerGenerated] get; [CompilerGenerated] set; } = new Dictionary((IEqualityComparer)(object)StringComparer.OrdinalIgnoreCase); } internal sealed class ImperiumLocalAppStoreProfile { [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string PlayerId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string WorldId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string LastUsedUtc { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List InstalledAppIds { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List CatalogManagedAppIds { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumLocalAppDownload? ActiveDownload { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List Queue { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int CachedDownloadSeconds { [CompilerGenerated] get; [CompilerGenerated] set; } = 30; } internal sealed class ImperiumLocalAppDownload { [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string AppId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string AppName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int DurationSeconds { [CompilerGenerated] get; [CompilerGenerated] set; } = 30; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string StartedAtUtc { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; } internal static class ImperiumAssets { private static readonly Dictionary DrugProductIds = new Dictionary((IEqualityComparer)(object)StringComparer.OrdinalIgnoreCase) { ["Cocaine"] = "cocaine", ["Granddaddy Purple"] = "granddaddypurple", ["Green Crack"] = "greencrack", ["Meth"] = "meth", ["OG Kush"] = "ogkush", ["Shroom"] = "shroom", ["Sour Diesel"] = "sourdiesel" }; private static readonly Dictionary GamePackagingIds = new Dictionary((IEqualityComparer)(object)StringComparer.OrdinalIgnoreCase) { ["bagged"] = "baggie", ["jarred"] = "jar", ["bricked"] = "brick" }; private const string EmbeddedResourcePrefix = "SIAKImperium.r."; private const string EmbeddedResourceSalt = "siak-imperium-art-v1/"; private static readonly Dictionary SpriteCache = new Dictionary((IEqualityComparer)(object)StringComparer.OrdinalIgnoreCase); private static bool _appIconLoaded; private static Sprite? _appIconSprite; private static bool _imperiumLogoLoaded; private static Sprite? _imperiumLogoSprite; private static bool _antivirusAppIconLoaded; private static Sprite? _antivirusAppIconSprite; private static bool _appStoreAppIconLoaded; private static Sprite? _appStoreAppIconSprite; private static bool _appStoreLogoLoaded; private static Sprite? _appStoreLogoSprite; private static bool _businessManagerAppIconLoaded; private static Sprite? _businessManagerAppIconSprite; private static bool _businessManagerLogoLoaded; private static Sprite? _businessManagerLogoSprite; private static bool _musicAppIconLoaded; private static Sprite? _musicAppIconSprite; private static bool _musicLogoLoaded; private static Sprite? _musicLogoSprite; private static bool _hylandersAppIconLoaded; private static Sprite? _hylandersAppIconSprite; private static bool _hylandersLogoLoaded; private static Sprite? _hylandersLogoSprite; private static readonly Dictionary MusicControlSprites = new Dictionary((IEqualityComparer)(object)StringComparer.OrdinalIgnoreCase); private static bool _notepadAppIconLoaded; private static Sprite? _notepadAppIconSprite; private static bool _notepadLogoLoaded; private static Sprite? _notepadLogoSprite; private static bool _antivirusLogoLoaded; private static Sprite? _antivirusLogoSprite; private static bool _fingerprintLoaded; private static Sprite? _fingerprintSprite; internal static readonly string[] DefaultDrugNames = new string[7] { "OG Kush", "Sour Diesel", "Granddaddy Purple", "Green Crack", "Meth", "Cocaine", "Shroom" }; internal static readonly string[] PackageTypes = new string[3] { "bagged", "jarred", "bricked" }; internal static string NormalizeDrugName(string? itemName) { if (string.IsNullOrWhiteSpace(itemName)) { return "OG Kush"; } string[] defaultDrugNames = DefaultDrugNames; foreach (string text in defaultDrugNames) { if (string.Equals(text, itemName.Trim(), (StringComparison)5)) { return text; } } return itemName.Trim(); } internal static string NormalizePackageType(string? packageType) { if (string.IsNullOrWhiteSpace(packageType)) { return "bricked"; } string text = packageType.Trim().ToLowerInvariant(); return (text == "bagged") ? "bagged" : ((!(text == "jarred")) ? "bricked" : "jarred"); } internal static bool SupportsPackage(string drugName, string packageType) { return DrugProductIds.ContainsKey(NormalizeDrugName(drugName)) && GamePackagingIds.ContainsKey(NormalizePackageType(packageType)); } internal static string GetFirstSupportedDrug(string packageType) { string[] defaultDrugNames = DefaultDrugNames; foreach (string text in defaultDrugNames) { if (SupportsPackage(text, packageType)) { return text; } } return DefaultDrugNames[0]; } internal static string NormalizeTier(string drugName, string? tier) { string[] allowedTiers = GetAllowedTiers(drugName); if (string.IsNullOrWhiteSpace(tier)) { return allowedTiers[0]; } string[] array = allowedTiers; foreach (string text in array) { if (string.Equals(text, tier.Trim(), (StringComparison)5)) { return text; } } return allowedTiers[0]; } internal static string[] GetAllowedTiers(string drugName) { return (!string.Equals(NormalizeDrugName(drugName), "Meth", (StringComparison)5)) ? new string[5] { "Trash", "Poor", "Standard", "Premium", "Heavenly" } : new string[3] { "Poor", "Standard", "Premium" }; } internal static Color ResolveTierColor(string tier) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_00d7: Unknown result type (might be due to invalid IL or missing references) string text = tier.Trim().ToLowerInvariant(); if (!(text == "trash")) { if (!(text == "poor")) { if (!(text == "standard")) { if (!(text == "premium")) { if (text == "heavenly") { return new Color(0.95f, 0.8f, 0.24f); } return new Color(0.72f, 0.76f, 0.82f); } return new Color(0.75f, 0.3f, 0.52f); } return new Color(0.28f, 0.56f, 0.9f); } return new Color(0.36f, 0.72f, 0.32f); } return new Color(0.53f, 0.34f, 0.18f); } internal static Sprite? LoadDrugSprite(string drugName, string packageType) { string text = NormalizeDrugName(drugName); string text2 = NormalizePackageType(packageType); string text3 = text + "::" + text2; Sprite result = default(Sprite); if (SpriteCache.TryGetValue(text3, ref result)) { return result; } string text4 = default(string); string text5 = default(string); if (!DrugProductIds.TryGetValue(text, ref text4) || !GamePackagingIds.TryGetValue(text2, ref text5)) { return null; } try { if (!Singleton.InstanceExists) { return null; } Sprite icon = Singleton.Instance.GetIcon(text4, text5, true); if ((Object)(object)icon != (Object)null) { SpriteCache[text3] = icon; } return icon; } catch (System.Exception ex) { Instance? modLogger = SIAKImperiumMod.ModLogger; if (modLogger != null) { modLogger.Warning($"[Imperium UI] Game product icon '{text4}/{text5}' is not ready: {ex.Message}"); } return null; } } internal static Sprite? LoadItemSprite(string itemId) { string text = itemId?.Trim() ?? string.Empty; if (text.Length == 0) { return null; } string text2 = "item::" + text; Sprite result = default(Sprite); if (SpriteCache.TryGetValue(text2, ref result)) { return result; } try { ItemDefinition definition = ItemManager.GetDefinition(text); Sprite val = ((definition != null) ? definition.Icon : null); if ((Object)(object)val != (Object)null) { SpriteCache[text2] = val; } return val; } catch (System.Exception ex) { Instance? modLogger = SIAKImperiumMod.ModLogger; if (modLogger != null) { modLogger.Warning("[Imperium UI] Game item icon '" + text + "' is not ready: " + ex.Message); } return null; } } internal static Sprite? LoadAppIconSprite() { if (_appIconLoaded) { return _appIconSprite; } _appIconLoaded = true; _appIconSprite = LoadEmbeddedSprite("app/imperium_app.png", "SIAKImperiumAppIcon"); return _appIconSprite; } internal static Sprite? LoadImperiumLogoSprite() { if (_imperiumLogoLoaded) { return _imperiumLogoSprite; } _imperiumLogoLoaded = true; _imperiumLogoSprite = LoadEmbeddedSprite("logo/SIAK TC1.png", "SIAKImperiumLogo"); return _imperiumLogoSprite; } internal static Sprite? LoadAntivirusAppIconSprite() { if (_antivirusAppIconLoaded) { return _antivirusAppIconSprite; } _antivirusAppIconLoaded = true; _antivirusAppIconSprite = LoadEmbeddedSprite("app/antivirus_app.png", "SIAKAntivirusAppIcon"); return _antivirusAppIconSprite; } internal static Sprite? LoadAppStoreIconSprite() { if (_appStoreAppIconLoaded) { return _appStoreAppIconSprite; } _appStoreAppIconLoaded = true; _appStoreAppIconSprite = LoadEmbeddedSprite("app/appstore_app.png", "SIAKAppStoreIcon") ?? LoadAppIconSprite(); return _appStoreAppIconSprite; } internal static Sprite? LoadAppStoreLogoSprite() { if (_appStoreLogoLoaded) { return _appStoreLogoSprite; } _appStoreLogoLoaded = true; _appStoreLogoSprite = LoadEmbeddedSprite("app/appstore_logo.png", "SIAKAppStoreLogo") ?? LoadAppStoreIconSprite(); return _appStoreLogoSprite; } internal static Sprite? LoadBusinessManagerAppIconSprite() { if (_businessManagerAppIconLoaded) { return _businessManagerAppIconSprite; } _businessManagerAppIconLoaded = true; _businessManagerAppIconSprite = LoadEmbeddedSprite("app/businessmanager_app.png", "SIAKBusinessManagerAppIcon") ?? LoadAppStoreIconSprite(); return _businessManagerAppIconSprite; } internal static Sprite? LoadBusinessManagerLogoSprite() { if (_businessManagerLogoLoaded) { return _businessManagerLogoSprite; } _businessManagerLogoLoaded = true; _businessManagerLogoSprite = LoadEmbeddedSprite("app/businessmanager_logo.png", "SIAKBusinessManagerLogo") ?? LoadBusinessManagerAppIconSprite(); return _businessManagerLogoSprite; } internal static Sprite? LoadMusicAppIconSprite() { if (_musicAppIconLoaded) { return _musicAppIconSprite; } _musicAppIconLoaded = true; _musicAppIconSprite = LoadEmbeddedSprite("app/music_app.png", "SIAKMusicAppIcon") ?? LoadAppStoreIconSprite(); return _musicAppIconSprite; } internal static Sprite? LoadMusicLogoSprite() { if (_musicLogoLoaded) { return _musicLogoSprite; } _musicLogoLoaded = true; _musicLogoSprite = LoadEmbeddedSprite("app/music_logo.png", "SIAKMusicLogo") ?? LoadMusicAppIconSprite(); return _musicLogoSprite; } internal static Sprite? LoadHylandersAppIconSprite() { if (_hylandersAppIconLoaded) { return _hylandersAppIconSprite; } _hylandersAppIconLoaded = true; _hylandersAppIconSprite = LoadEmbeddedSprite("app/hylanders_app.png", "SIAKHylandersAppIcon") ?? LoadAppStoreIconSprite(); return _hylandersAppIconSprite; } internal static Sprite? LoadHylandersLogoSprite() { if (_hylandersLogoLoaded) { return _hylandersLogoSprite; } _hylandersLogoLoaded = true; _hylandersLogoSprite = LoadEmbeddedSprite("app/hylanders_logo.png", "SIAKHylandersLogo") ?? LoadHylandersAppIconSprite(); return _hylandersLogoSprite; } internal static Sprite? LoadMusicControlSprite(string control) { string text = control?.Trim().ToLowerInvariant() ?? string.Empty; if ((!(text == "previous") && !(text == "play") && !(text == "pause") && !(text == "next")) || 1 == 0) { return null; } Sprite result = default(Sprite); if (MusicControlSprites.TryGetValue(text, ref result)) { return result; } Sprite val = LoadEmbeddedSprite("music/" + text + ".png", "SIAKMusic_" + text); MusicControlSprites[text] = val; return val; } internal static Sprite? LoadNotepadAppIconSprite() { if (_notepadAppIconLoaded) { return _notepadAppIconSprite; } _notepadAppIconLoaded = true; _notepadAppIconSprite = LoadEmbeddedSprite("app/notepad_app.png", "SIAKNotepadAppIcon") ?? LoadAppIconSprite(); return _notepadAppIconSprite; } internal static Sprite? LoadNotepadLogoSprite() { if (_notepadLogoLoaded) { return _notepadLogoSprite; } _notepadLogoLoaded = true; _notepadLogoSprite = LoadEmbeddedSprite("app/notepad_app_logo.png", "SIAKNotepadLogo") ?? LoadNotepadAppIconSprite(); return _notepadLogoSprite; } internal static Sprite? LoadAntivirusLogoSprite() { if (_antivirusLogoLoaded) { return _antivirusLogoSprite; } _antivirusLogoLoaded = true; _antivirusLogoSprite = LoadEmbeddedSprite("app/antivirus_logo.png", "SIAKAntivirusLogo"); return _antivirusLogoSprite; } internal static Sprite? LoadFingerprintSprite() { if (_fingerprintLoaded) { return _fingerprintSprite; } _fingerprintLoaded = true; _fingerprintSprite = LoadEmbeddedSprite("antivirus/fingerprint.png", "SIAKAntivirusFingerprint"); return _fingerprintSprite; } internal static Sprite? LoadMessageSprite(string? iconKey) { string text = iconKey?.Trim() ?? string.Empty; if (text.StartsWith("installed-app:", (StringComparison)5)) { string appId = text.Substring("installed-app:".Length); return ImperiumAppStoreManager.GetCatalogIcon(appId) ?? LoadAppStoreLogoSprite(); } string text2 = text.ToLowerInvariant(); string text3 = ((text2 == "srt") ? "srt" : ((text2 == "player") ? "player" : ((text2 == "virus_basic") ? "virus_basic" : ((text2 == "virus_premium") ? "virus_premium" : ((!(text2 == "antivirus")) ? "siak" : "antivirus"))))); string text4 = text3; string text5 = "message::" + text4; Sprite result = default(Sprite); if (SpriteCache.TryGetValue(text5, ref result)) { return result; } text3 = ((text4 == "srt") ? "messages/SRT.png" : ((text4 == "player") ? "messages/player.png" : ((text4 == "virus_basic") ? "messages/virusscanned.png" : ((text4 == "virus_premium") ? "messages/premium_virusscanned.png" : ((!(text4 == "antivirus")) ? "messages/SIAKImperium.png" : "messages/antivirus_notifications.png"))))); string relativePath = text3; Sprite val = LoadEmbeddedSprite(relativePath, "SIAKImperiumMessage_" + text4); if ((Object)(object)val != (Object)null) { SpriteCache[text5] = val; } return val; } internal static Sprite? LoadEmbeddedSprite(string relativePath, string spriteName) { byte[] array = LoadEmbeddedAssetBytes(relativePath); return (array == null) ? null : CreateSpriteFromBytes(array, spriteName); } internal static byte[]? LoadEmbeddedAssetBytes(string relativePath) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown try { Stream manifestResourceStream = typeof(ImperiumAssets).Assembly.GetManifestResourceStream(BuildEmbeddedResourceName(relativePath)); try { if (manifestResourceStream == null) { return null; } MemoryStream val = new MemoryStream(); try { manifestResourceStream.CopyTo((Stream)(object)val); return val.ToArray(); } finally { ((System.IDisposable)val)?.Dispose(); } } finally { ((System.IDisposable)manifestResourceStream)?.Dispose(); } } catch { return null; } } internal static string LoadEmbeddedText(string relativePath) { byte[] array = LoadEmbeddedAssetBytes(relativePath); return (array == null) ? string.Empty : Encoding.UTF8.GetString(array); } private static string BuildEmbeddedResourceName(string relativePath) { string text = (relativePath ?? string.Empty).Replace('\\', '/').TrimStart('/'); SHA256 val = SHA256.Create(); try { byte[] array = ((HashAlgorithm)val).ComputeHash(Encoding.UTF8.GetBytes("siak-imperium-art-v1/" + text)); return string.Concat("SIAKImperium.r.", string.Concat(Enumerable.Select((System.Collections.Generic.IEnumerable)array, (Func)((byte value) => value.ToString("x2", (IFormatProvider)(object)CultureInfo.InvariantCulture))))); } finally { ((System.IDisposable)val)?.Dispose(); } } private static Sprite? CreateSpriteFromBytes(byte[] bytes, string spriteName) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) try { Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false) { hideFlags = (HideFlags)61 }; if (!ImageConversion.LoadImage(val, Il2CppStructArray.op_Implicit(bytes))) { Object.Destroy((Object)(object)val); return null; } ((Object)val).name = spriteName; Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); ((Object)val2).name = spriteName; ((Object)val2).hideFlags = (HideFlags)61; return val2; } catch { return null; } } } public sealed class ImperiumBusinessManagerApp : PhoneApp { internal const string ApplicationId = "SIAKBusinessManagerApp"; private static ImperiumBusinessManagerApp? _instance; private static ImperiumBusinessManagerController? _controller; private static GameObject? _iconRoot; private static readonly Action OpenFromLauncherAction = new Action(OpenFromLauncher); protected override string AppName => "SIAKBusinessManagerApp"; protected override string AppTitle => "Business Manager"; protected override string IconLabel => "Business Manager"; protected override string IconFileName => string.Empty; protected override Sprite? IconSprite => ImperiumAssets.LoadBusinessManagerAppIconSprite(); protected override EOrientation Orientation => (EOrientation)0; protected override void OnCreatedUI(GameObject container) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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) _instance = this; GameObject val = UIFactory.Panel("BusinessManagerHtmlRoot", container.transform, Color.clear, (Vector2?)null, (Vector2?)null, true); if (!(_controller = val.AddComponent()).Initialize(val)) { Text val2 = UIFactory.Text("BusinessManagerFallback", "Business Manager could not initialise.", val.transform, 22, (TextAnchor)4, (FontStyle)1); RectTransform rectTransform = ((Graphic)val2).rectTransform; rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; rectTransform.offsetMin = Vector2.zero; rectTransform.offsetMax = Vector2.zero; } RefreshAvailabilityFromService(); ImperiumAppStoreManager.ScheduleCatalogRefresh(); } internal static void RefreshAvailabilityFromService() { ImperiumAppStoreManager.RefreshBusinessManagerAvailability(); ImperiumBusinessManagerSettings imperiumBusinessManagerSettings = SIAKImperiumMod.Service?.GetSnapshot().BusinessManager ?? new ImperiumBusinessManagerSettings(); ApplyLauncherVisibility(imperiumBusinessManagerSettings.Enabled && ImperiumAppStoreManager.IsInstalled("SIAKBusinessManagerApp")); } internal static void ApplyLauncherVisibility(bool visible) { if (_instance != null) { _iconRoot = ImperiumPhoneLauncherDeduplicator.AdoptExistingLauncher(_iconRoot, "SIAKBusinessManagerApp", visible); } } private static void OpenFromLauncher() { ImperiumBusinessManagerApp? instance = _instance; if (instance != null) { ((PhoneApp)instance).OpenApp(); } ImperiumBusinessManagerRuntime.RunCollectionCycle(); _controller?.RefreshOwnershipNow(); } } internal static class ImperiumBusinessManagerRuntime { [CompilerGenerated] private static class <>O { public static Action <0>__HandleDayPass; public static Action <1>__HandleHourPass; public static Func <2>__IsLetterOrDigit; public static Func <3>__ToLowerInvariant; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Action <>9__10_0; public static Action <>9__10_1; public static Func <>9__11_1; public static Func <>9__11_2; public static Func <>9__11_0; public static Func <>9__12_0; public static Func <>9__13_0; public static Func <>9__13_1; public static Func <>9__22_1; internal void b__10_0() { } internal void b__10_1() { } internal bool b__11_1(ImperiumWorkerContractView item) { return item.PaidToday; } internal float b__11_2(ImperiumWorkerContractView item) { return item.Capacity; } internal float b__11_0(ImperiumBusinessView item) { return item.MaxLaunderable; } internal string b__12_0(string code) { return code; } internal string b__13_0(ImperiumBusinessView item) { return item.Code; } internal string b__13_1(string code) { return code; } internal float b__22_1(ImperiumWorkerContract contract) { return ResolveWorker(contract.WorkerCode)?.Capacity ?? 0f; } } private static readonly ImperiumBusinessDefinition[] BusinessDefinitions = new ImperiumBusinessDefinition[4] { new ImperiumBusinessDefinition("laundromat", "Laundromat", 2000f, 2), new ImperiumBusinessDefinition("postoffice", "Post Office", 4000f, 3), new ImperiumBusinessDefinition("carwash", "Car Wash", 6000f, 4), new ImperiumBusinessDefinition("tacoticklers", "Taco Ticklers", 8000f, 5) }; private static readonly ImperiumWorkerDefinition[] WorkerDefinitions = new ImperiumWorkerDefinition[7] { new ImperiumWorkerDefinition("intern", "Intern", 20f, 115f), new ImperiumWorkerDefinition("junior", "Junior", 62f, 285f), new ImperiumWorkerDefinition("assistant", "Assistant", 115f, 495f), new ImperiumWorkerDefinition("experienced", "Experienced", 265f, 935f), new ImperiumWorkerDefinition("senior", "Senior", 545f, 1610f), new ImperiumWorkerDefinition("specialist", "Specialist", 1050f, 2425f), new ImperiumWorkerDefinition("manager", "Manager", 2250f, 3880f) }; private static ImperiumBusinessManagerDatabase? _database; private static bool _subscribed; private static int _stateVersion; internal static int StateVersion => _stateVersion; internal static System.Collections.Generic.IReadOnlyList Workers => WorkerDefinitions; internal static void Initialize() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0027: 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_0032: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_0056: 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_0061: Expected O, but got Unknown EnsureLoaded(); if (!_subscribed) { Action onDayPass = TimeManager.OnDayPass; object obj = <>O.<0>__HandleDayPass; if (obj == null) { Action val = HandleDayPass; <>O.<0>__HandleDayPass = val; obj = (object)val; } TimeManager.OnDayPass = (Action)System.Delegate.Combine((System.Delegate)(object)onDayPass, (System.Delegate)obj); Action onHourPass = TimeManager.OnHourPass; object obj2 = <>O.<1>__HandleHourPass; if (obj2 == null) { Action val2 = HandleHourPass; <>O.<1>__HandleHourPass = val2; obj2 = (object)val2; } TimeManager.OnHourPass = (Action)System.Delegate.Combine((System.Delegate)(object)onHourPass, (System.Delegate)obj2); _subscribed = true; } } internal static void Dispose() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_0064: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_0054: 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_005f: Expected O, but got Unknown //IL_00b6: Expected O, but got Unknown //IL_00a6: 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_00b1: Expected O, but got Unknown if (!_subscribed) { return; } Action onDayPass = TimeManager.OnDayPass; object obj = <>O.<0>__HandleDayPass; if (obj == null) { Action val = HandleDayPass; <>O.<0>__HandleDayPass = val; obj = (object)val; } Action val2 = (Action)System.Delegate.Remove((System.Delegate)(object)onDayPass, (System.Delegate)obj); object obj2 = (object)val2; if ((int)val2 == 0) { obj2 = <>c.<>9__10_0; if (obj2 == null) { Action val3 = delegate { }; <>c.<>9__10_0 = val3; obj2 = (object)val3; } } TimeManager.OnDayPass = (Action)obj2; Action onHourPass = TimeManager.OnHourPass; object obj3 = <>O.<1>__HandleHourPass; if (obj3 == null) { Action val4 = HandleHourPass; <>O.<1>__HandleHourPass = val4; obj3 = (object)val4; } Action val5 = (Action)System.Delegate.Remove((System.Delegate)(object)onHourPass, (System.Delegate)obj3); object obj4 = (object)val5; if ((int)val5 == 0) { obj4 = <>c.<>9__10_1; if (obj4 == null) { Action val6 = delegate { }; <>c.<>9__10_1 = val6; obj4 = (object)val6; } } TimeManager.OnHourPass = (Action)obj4; _subscribed = false; } internal static List GetOwnedBusinesses() { //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) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) List val = new List(); ImperiumBusinessManagerProfile profile = CurrentProfile(); List ownedBusinessWrappers = GetOwnedBusinessWrappers(); Enumerator enumerator = ownedBusinessWrappers.GetEnumerator(); try { while (enumerator.MoveNext()) { BusinessWrapper current = enumerator.Current; ImperiumBusinessDefinition imperiumBusinessDefinition = ResolveBusiness(((BaseProperty)current).PropertyName, ((BaseProperty)current).PropertyCode); if (imperiumBusinessDefinition == null) { continue; } ImperiumBusinessState businessState = GetBusinessState(profile, imperiumBusinessDefinition.Code); List val2 = new List(); Enumerator enumerator2 = businessState.Contracts.GetEnumerator(); try { while (enumerator2.MoveNext()) { ImperiumWorkerContract current2 = enumerator2.Current; ImperiumWorkerDefinition imperiumWorkerDefinition = ResolveWorker(current2.WorkerCode); if (!(imperiumWorkerDefinition == null)) { val2.Add(new ImperiumWorkerContractView { ContractId = current2.ContractId, WorkerCode = imperiumWorkerDefinition.Code, WorkerName = imperiumWorkerDefinition.Name, Wage = imperiumWorkerDefinition.Wage, Capacity = imperiumWorkerDefinition.Capacity, PaidToday = (current2.LastPaidGameDay == CurrentGameDay()), Status = ((current2.LastPaidGameDay == CurrentGameDay()) ? "Ready" : "Payment required") }); } } } finally { ((System.IDisposable)enumerator2/*cast due to .constrained prefix*/).Dispose(); } List val3 = ((IsWeekend() && !businessState.WorkWeekends) ? new List() : Enumerable.ToList(Enumerable.Where((System.Collections.Generic.IEnumerable)val2, (Func)((ImperiumWorkerContractView item) => item.PaidToday)))); float storedCash = 0f; int storageCount = 0; int cashStackCount = 0; SIAKImperiumMod.Service?.TryGetBusinessStoredCash(((BaseProperty)current).PropertyCode, out storedCash, out storageCount, out cashStackCount, out string _); val.Add(new ImperiumBusinessView { Code = imperiumBusinessDefinition.Code, PropertyCode = ((BaseProperty)current).PropertyCode, Name = imperiumBusinessDefinition.Name, MaxLaunderable = imperiumBusinessDefinition.MaxLaunderable, WorkerSlots = imperiumBusinessDefinition.WorkerSlots, WorkWeekends = businessState.WorkWeekends, Contracts = val2, WorkingCapacity = Enumerable.Sum((System.Collections.Generic.IEnumerable)val3, (Func)((ImperiumWorkerContractView item) => item.Capacity)), AutomatedToday = ((businessState.AutomatedGameDay == CurrentGameDay()) ? businessState.AutomatedToday : 0f), StoredCash = Math.Max(0f, storedCash), StorageCount = Math.Max(0, storageCount), CashStackCount = Math.Max(0, cashStackCount), NativeActiveAmount = Math.Max(0f, current.CurrentLaunderTotal), NativeAvailableCapacity = Math.Max(0f, current.AppliedLaunderLimit), LastStatus = businessState.LastStatus }); } } finally { ((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } return Enumerable.ToList((System.Collections.Generic.IEnumerable)Enumerable.OrderBy((System.Collections.Generic.IEnumerable)val, (Func)((ImperiumBusinessView item) => item.MaxLaunderable))); } internal static string GetOwnedBusinessSignature() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) List val = new List(); Enumerator enumerator = GetOwnedBusinessWrappers().GetEnumerator(); try { while (enumerator.MoveNext()) { BusinessWrapper current = enumerator.Current; ImperiumBusinessDefinition imperiumBusinessDefinition = ResolveBusiness(((BaseProperty)current).PropertyName, ((BaseProperty)current).PropertyCode); if (imperiumBusinessDefinition != null) { val.Add(imperiumBusinessDefinition.Code); } } } finally { ((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } return string.Join("|", (System.Collections.Generic.IEnumerable)Enumerable.OrderBy(Enumerable.Distinct((System.Collections.Generic.IEnumerable)val, (IEqualityComparer)(object)StringComparer.OrdinalIgnoreCase), (Func)((string code) => code), (IComparer)(object)StringComparer.OrdinalIgnoreCase)); } internal static string BuildOwnershipSignature(System.Collections.Generic.IEnumerable businesses) { return string.Join("|", (System.Collections.Generic.IEnumerable)Enumerable.OrderBy(Enumerable.Distinct(Enumerable.Select(businesses, (Func)((ImperiumBusinessView item) => item.Code)), (IEqualityComparer)(object)StringComparer.OrdinalIgnoreCase), (Func)((string code) => code), (IComparer)(object)StringComparer.OrdinalIgnoreCase)); } internal static List GetOwnedBusinessWrappers() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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) Dictionary val = new Dictionary((IEqualityComparer)(object)StringComparer.OrdinalIgnoreCase); try { Enumerator enumerator = BusinessManager.GetOwnedBusinesses().GetEnumerator(); try { while (enumerator.MoveNext()) { BusinessWrapper current = enumerator.Current; if (current != null) { val[BusinessIdentity(current)] = current; } } } finally { ((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } } catch { } try { Enumerator enumerator2 = BusinessManager.GetAllBusinesses().GetEnumerator(); try { while (enumerator2.MoveNext()) { BusinessWrapper current2 = enumerator2.Current; if (current2 != null && ((BaseProperty)current2).IsOwned) { val[BusinessIdentity(current2)] = current2; } } } finally { ((System.IDisposable)enumerator2/*cast due to .constrained prefix*/).Dispose(); } } catch { } return Enumerable.ToList((System.Collections.Generic.IEnumerable)val.Values); } private static string BusinessIdentity(BusinessWrapper business) { string text = ((BaseProperty)business).PropertyCode?.Trim() ?? string.Empty; return (text.Length > 0) ? text : Normalise(((BaseProperty)business).PropertyName ?? string.Empty); } internal static List GetApplicants(string businessCode) { ImperiumBusinessManagerProfile imperiumBusinessManagerProfile = CurrentProfile(); ImperiumBusinessState businessState = GetBusinessState(imperiumBusinessManagerProfile, businessCode); int day = CurrentGameDay(); List val = new List(); ImperiumWorkerDefinition[] workerDefinitions = WorkerDefinitions; foreach (ImperiumWorkerDefinition worker in workerDefinitions) { int num = DailySupply(imperiumBusinessManagerProfile.ProfileKey, businessCode, worker.Code, day); int num2 = Enumerable.Count((System.Collections.Generic.IEnumerable)businessState.Contracts, (Func)((ImperiumWorkerContract contract) => contract.HiredGameDay == day && string.Equals(contract.WorkerCode, worker.Code, (StringComparison)5))); val.Add(new ImperiumApplicantView { WorkerCode = worker.Code, WorkerName = worker.Name, Wage = worker.Wage, WeekendWage = Mathf.Ceil(worker.Wage * 1.4f), Capacity = worker.Capacity, Available = Math.Max(0, num - num2) }); } return val; } internal static bool Hire(string businessCode, string workerCode, out string message) { //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) message = string.Empty; if (!CanMutate(out message)) { return false; } ImperiumBusinessDefinition definition = ResolveBusiness(businessCode, businessCode); ImperiumWorkerDefinition worker = ResolveWorker(workerCode); if (definition == null || worker == null) { message = "That worker offer is no longer available."; return false; } if (!Enumerable.Any((System.Collections.Generic.IEnumerable)GetOwnedBusinesses(), (Func)((ImperiumBusinessView item) => string.Equals(item.Code, definition.Code, (StringComparison)5)))) { message = "Your organisation does not own this business."; return false; } ImperiumBusinessManagerProfile profile = CurrentProfile(); ImperiumBusinessState businessState = GetBusinessState(profile, definition.Code); if (businessState.Contracts.Count >= definition.WorkerSlots) { message = $"All {definition.WorkerSlots} worker slots are occupied."; return false; } ImperiumApplicantView imperiumApplicantView = Enumerable.FirstOrDefault((System.Collections.Generic.IEnumerable)GetApplicants(definition.Code), (Func)((ImperiumApplicantView item) => string.Equals(item.WorkerCode, worker.Code, (StringComparison)5))); if (imperiumApplicantView == null || imperiumApplicantView.Available <= 0) { message = "No applicant of that level is available today."; return false; } float num = EffectiveWage(worker.Wage, businessState.WorkWeekends); if (!TryPay(num, definition.Name + " " + worker.Name, out message)) { return false; } List contracts = businessState.Contracts; ImperiumWorkerContract imperiumWorkerContract = new ImperiumWorkerContract(); Guid val = Guid.NewGuid(); imperiumWorkerContract.ContractId = ((Guid)(ref val)).ToString("N"); imperiumWorkerContract.WorkerCode = worker.Code; imperiumWorkerContract.HiredGameDay = CurrentGameDay(); imperiumWorkerContract.LastPaidGameDay = CurrentGameDay(); imperiumWorkerContract.WeekendPremiumPaidGameDay = ((IsWeekend() && businessState.WorkWeekends) ? CurrentGameDay() : (-1)); contracts.Add(imperiumWorkerContract); businessState.LastStatus = $"{worker.Name} hired. First wage paid: ${num:N0}."; Save(); _stateVersion++; HandleHourPass(); message = businessState.LastStatus; return true; } internal static bool Fire(string businessCode, string contractId, out string message) { message = string.Empty; if (!CanMutate(out message)) { return false; } ImperiumBusinessState businessState = GetBusinessState(CurrentProfile(), businessCode); if (businessState.Contracts.RemoveAll((Predicate)((ImperiumWorkerContract contract) => string.Equals(contract.ContractId, contractId, (StringComparison)5))) == 0) { message = "That worker contract is no longer active."; return false; } businessState.LastStatus = "Worker contract ended. Previously paid wages are not refundable."; Save(); _stateVersion++; message = businessState.LastStatus; return true; } internal static bool ToggleWeekends(string businessCode, out string message) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) message = string.Empty; if (!CanMutate(out message)) { return false; } ImperiumBusinessState businessState = GetBusinessState(CurrentProfile(), businessCode); bool flag = !businessState.WorkWeekends; if (flag && IsWeekend()) { float num = 0f; Enumerator enumerator = businessState.Contracts.GetEnumerator(); try { while (enumerator.MoveNext()) { ImperiumWorkerContract current = enumerator.Current; ImperiumWorkerDefinition imperiumWorkerDefinition = ResolveWorker(current.WorkerCode); if (!(imperiumWorkerDefinition == null) && current.WeekendPremiumPaidGameDay != CurrentGameDay()) { float num2 = ((current.LastPaidGameDay == CurrentGameDay()) ? Mathf.Ceil(imperiumWorkerDefinition.Wage * 0.4f) : Mathf.Ceil(imperiumWorkerDefinition.Wage * 1.4f)); if (!TryPay(num2, "Weekend premium: " + imperiumWorkerDefinition.Name, out message)) { businessState.LastStatus = ((num > 0f) ? $"Weekend shifts partially funded (${num:N0}). Unpaid workers remain idle." : message); Save(); _stateVersion++; return false; } num += num2; current.LastPaidGameDay = CurrentGameDay(); current.WeekendPremiumPaidGameDay = CurrentGameDay(); } } } finally { ((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } } businessState.WorkWeekends = flag; businessState.LastStatus = (businessState.WorkWeekends ? "Weekend shifts enabled. Saturday and Sunday wages cost 40% more." : "Weekend shifts disabled. Workers pause without pay on Saturday and Sunday."); Save(); _stateVersion++; message = businessState.LastStatus; return true; } private static void HandleDayPass() { //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) ImperiumBusinessManagerSettings imperiumBusinessManagerSettings = SIAKImperiumMod.Service?.GetSnapshot().BusinessManager ?? new ImperiumBusinessManagerSettings(); if (!imperiumBusinessManagerSettings.Enabled || !CanMutate(out string message)) { return; } ImperiumBusinessManagerProfile profile = CurrentProfile(); int num = CurrentGameDay(); ImperiumBusinessDefinition[] businessDefinitions = BusinessDefinitions; foreach (ImperiumBusinessDefinition imperiumBusinessDefinition in businessDefinitions) { ImperiumBusinessState businessState = GetBusinessState(profile, imperiumBusinessDefinition.Code); businessState.AutomatedGameDay = num; businessState.AutomatedToday = 0f; if (IsWeekend() && !businessState.WorkWeekends) { businessState.LastStatus = "Weekend pause active. No wages charged and no automatic laundering today."; continue; } Enumerator enumerator = businessState.Contracts.GetEnumerator(); try { while (enumerator.MoveNext()) { ImperiumWorkerContract current = enumerator.Current; if (current.LastPaidGameDay == num) { continue; } ImperiumWorkerDefinition imperiumWorkerDefinition = ResolveWorker(current.WorkerCode); if (!(imperiumWorkerDefinition == null)) { float amount = EffectiveWage(imperiumWorkerDefinition.Wage, businessState.WorkWeekends); if (TryPay(amount, imperiumBusinessDefinition.Name + " " + imperiumWorkerDefinition.Name, out message)) { current.LastPaidGameDay = num; current.WeekendPremiumPaidGameDay = (IsWeekend() ? num : (-1)); businessState.LastStatus = "Morning payroll completed."; } else { businessState.LastStatus = "Insufficient organisation bank funds. Unpaid workers are idle today."; } } } } finally { ((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } } Save(); _stateVersion++; HandleHourPass(); } internal static void RunCollectionCycle() { HandleHourPass(); } private static void HandleHourPass() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) ImperiumBusinessManagerSettings imperiumBusinessManagerSettings = SIAKImperiumMod.Service?.GetSnapshot().BusinessManager ?? new ImperiumBusinessManagerSettings(); if (!imperiumBusinessManagerSettings.Enabled || !CanMutate(out string _)) { return; } ImperiumBusinessManagerProfile profile = CurrentProfile(); int day = CurrentGameDay(); bool flag = false; Enumerator enumerator = GetOwnedBusinesses().GetEnumerator(); try { while (enumerator.MoveNext()) { ImperiumBusinessView current = enumerator.Current; ImperiumBusinessState businessState = GetBusinessState(profile, current.Code); if (businessState.AutomatedGameDay != day) { businessState.AutomatedGameDay = day; businessState.AutomatedToday = 0f; } if (IsWeekend() && !businessState.WorkWeekends) { continue; } float num = Enumerable.Sum(Enumerable.Select(Enumerable.Where((System.Collections.Generic.IEnumerable)businessState.Contracts, (Func)((ImperiumWorkerContract contract) => contract.LastPaidGameDay == day)), (Func)((ImperiumWorkerContract contract) => ResolveWorker(contract.WorkerCode)?.Capacity ?? 0f))); float num2 = Math.Max(0f, Math.Min(num, current.MaxLaunderable) - businessState.AutomatedToday); if (!(num2 < 1f)) { ImperiumService service = SIAKImperiumMod.Service; string status = "Imperium service is reconnecting."; if (service != null && service.TryAutomateBusinessLaundering(current.PropertyCode, num2, current.MaxLaunderable, out float startedAmount, out status)) { businessState.AutomatedToday += startedAmount; flag = true; } if (!string.Equals(businessState.LastStatus, status, (StringComparison)4)) { businessState.LastStatus = status; flag = true; } } } } finally { ((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } if (flag) { Save(); _stateVersion++; } } private static bool CanMutate(out string message) { message = string.Empty; if (SIAKImperiumMod.Service == null || !SIAKImperiumMod.Service.IsLocalLobbyHost()) { message = "Only the organisation host can manage workers and laundering."; return false; } return true; } private static bool TryPay(float amount, string note, out string message) { message = string.Empty; float onlineBalance = Money.GetOnlineBalance(); if (onlineBalance + 0.01f < amount) { message = $"The organisation bank needs ${amount:N0}; only ${onlineBalance:N0} is available."; return false; } Money.CreateOnlineTransaction("Business Manager Payroll", 0f - amount, 1f, note); return true; } private static float EffectiveWage(float baseWage, bool workWeekends) { return (IsWeekend() && workWeekends) ? Mathf.Ceil(baseWage * 1.4f) : baseWage; } private static bool IsWeekend() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 try { return (int)TimeManager.CurrentDay == 5 || (int)TimeManager.CurrentDay == 6; } catch { return false; } } private static int CurrentGameDay() { try { return Math.Max(0, TimeManager.ElapsedDays); } catch { return 0; } } private static int DailySupply(string profileKey, string businessCode, string workerCode, int day) { int num = 17; string text = $"{profileKey}|{businessCode}|{workerCode}|{day}"; foreach (char c in text) { num = num * 31 + c; } int num2 = num & 0x7FFFFFFF; bool flag = ((workerCode == "specialist" || workerCode == "manager") ? true : false); int num3 = (flag ? 2 : 3); return num2 % num3; } private static ImperiumBusinessDefinition? ResolveBusiness(string name, string code) { string text = Normalise(name + code); ImperiumBusinessDefinition[] businessDefinitions = BusinessDefinitions; foreach (ImperiumBusinessDefinition imperiumBusinessDefinition in businessDefinitions) { if (text.Contains(imperiumBusinessDefinition.Code, (StringComparison)4)) { return imperiumBusinessDefinition; } } return null; } private static ImperiumWorkerDefinition? ResolveWorker(string code) { ImperiumWorkerDefinition[] workerDefinitions = WorkerDefinitions; foreach (ImperiumWorkerDefinition imperiumWorkerDefinition in workerDefinitions) { if (string.Equals(imperiumWorkerDefinition.Code, code, (StringComparison)5)) { return imperiumWorkerDefinition; } } return null; } private static string Normalise(string value) { return new string(Enumerable.ToArray(Enumerable.Select(Enumerable.Where((System.Collections.Generic.IEnumerable)value, (Func)char.IsLetterOrDigit), (Func)char.ToLowerInvariant))); } private static ImperiumBusinessManagerProfile CurrentProfile() { EnsureLoaded(); string text = (SIAKImperiumMod.Service?.GetSnapshot())?.SteamId?.Trim() ?? string.Empty; if (text.Length == 0 || string.Equals(text, "Unavailable", (StringComparison)5)) { text = "device"; } string text2 = SIAKImperiumMod.Service?.GetCurrentSaveIdentifier()?.Trim() ?? string.Empty; if (text2.Length == 0) { text2 = SIAKImperiumMod.ImperiumSessionSaveIdentifier?.Value?.Trim() ?? "unspecified-save"; } string text3 = text + "|" + text2; ImperiumBusinessManagerProfile imperiumBusinessManagerProfile = default(ImperiumBusinessManagerProfile); if (!_database.Profiles.TryGetValue(text3, ref imperiumBusinessManagerProfile)) { imperiumBusinessManagerProfile = new ImperiumBusinessManagerProfile { ProfileKey = text3 }; _database.Profiles[text3] = imperiumBusinessManagerProfile; } imperiumBusinessManagerProfile.ProfileKey = text3; ImperiumBusinessManagerProfile imperiumBusinessManagerProfile2 = imperiumBusinessManagerProfile; if (imperiumBusinessManagerProfile2.Businesses == null) { Dictionary val = (imperiumBusinessManagerProfile2.Businesses = new Dictionary((IEqualityComparer)(object)StringComparer.OrdinalIgnoreCase)); } return imperiumBusinessManagerProfile; } private static ImperiumBusinessState GetBusinessState(ImperiumBusinessManagerProfile profile, string code) { ImperiumBusinessState imperiumBusinessState = default(ImperiumBusinessState); if (!profile.Businesses.TryGetValue(code, ref imperiumBusinessState)) { imperiumBusinessState = new ImperiumBusinessState(); profile.Businesses[code] = imperiumBusinessState; } ImperiumBusinessState imperiumBusinessState2 = imperiumBusinessState; if (imperiumBusinessState2.Contracts == null) { List val = (imperiumBusinessState2.Contracts = new List()); } return imperiumBusinessState; } private static void EnsureLoaded() { if (_database == null) { try { _database = JsonConvert.DeserializeObject(SIAKImperiumMod.LocalBusinessManagerState?.Value ?? string.Empty); } catch { _database = null; } if (_database == null) { _database = new ImperiumBusinessManagerDatabase(); } ImperiumBusinessManagerDatabase database = _database; if (database.Profiles == null) { Dictionary val = (database.Profiles = new Dictionary((IEqualityComparer)(object)StringComparer.OrdinalIgnoreCase)); } } } private static void Save() { if (_database != null && SIAKImperiumMod.LocalBusinessManagerState != null) { SIAKImperiumMod.LocalBusinessManagerState.Value = JsonConvert.SerializeObject((object)_database); SIAKImperiumMod.ConfigCategory.SaveToFile(false); } } } internal sealed class ImperiumBusinessManagerController : MonoBehaviour { private const float OwnershipRefreshSeconds = 1f; private ImperiumHtmlDocument? _document; private GameObject? _root; private string _selectedBusiness = string.Empty; private string _notice = string.Empty; private int _lastRuntimeVersion = -1; private int _lastServiceVersion = -1; private string _lastSettingsSignature = string.Empty; private string _lastOwnershipSignature = string.Empty; private float _nextOwnershipRefreshAt; public ImperiumBusinessManagerController(System.IntPtr pointer) : base(pointer) { } public bool Initialize(GameObject root) { _root = root; Canvas.ForceUpdateCanvases(); bool result = Render(); _document?.RefreshLayout(); return result; } public void OnEnable() { ImperiumHtmlDocument? document = _document; if (document != null && document.RefreshViewport()) { _document.RefreshLayout(); } else { _document?.RefreshLayout(); } RefreshOwnershipNow(); } internal void RefreshOwnershipNow() { _nextOwnershipRefreshAt = Time.unscaledTime + 1f; if ((Object)(object)_root != (Object)null) { Render(); } } public void Update() { if ((Object)(object)_root == (Object)null) { return; } ImperiumHtmlDocument? document = _document; if (document != null && document.RefreshViewport()) { _document.RefreshLayout(); } if (Time.unscaledTime >= _nextOwnershipRefreshAt) { _nextOwnershipRefreshAt = Time.unscaledTime + 1f; string ownedBusinessSignature = ImperiumBusinessManagerRuntime.GetOwnedBusinessSignature(); if (!string.Equals(_lastOwnershipSignature, ownedBusinessSignature, (StringComparison)4)) { Render(); return; } } ImperiumService service = SIAKImperiumMod.Service; int num = service?.StateVersion ?? (-1); if (_lastRuntimeVersion != ImperiumBusinessManagerRuntime.StateVersion || _lastServiceVersion != num) { ImperiumBusinessManagerSettings imperiumBusinessManagerSettings = service?.GetSnapshot().BusinessManager ?? new ImperiumBusinessManagerSettings(); string text = $"{imperiumBusinessManagerSettings.Enabled}|{imperiumBusinessManagerSettings.Available}|{imperiumBusinessManagerSettings.DownloadSeconds}"; if (_lastRuntimeVersion != ImperiumBusinessManagerRuntime.StateVersion || !string.Equals(_lastSettingsSignature, text, (StringComparison)4)) { Render(); } } } [HideFromIl2Cpp] private bool Render() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_root == (Object)null) { return false; } ImperiumBusinessManagerSettings imperiumBusinessManagerSettings = SIAKImperiumMod.Service?.GetSnapshot().BusinessManager ?? new ImperiumBusinessManagerSettings(); List ownedBusinesses = ImperiumBusinessManagerRuntime.GetOwnedBusinesses(); _lastOwnershipSignature = ImperiumBusinessManagerRuntime.BuildOwnershipSignature((System.Collections.Generic.IEnumerable)ownedBusinesses); _nextOwnershipRefreshAt = Time.unscaledTime + 1f; ImperiumBusinessView imperiumBusinessView = null; Enumerator enumerator = ownedBusinesses.GetEnumerator(); try { while (enumerator.MoveNext()) { ImperiumBusinessView current = enumerator.Current; if (string.Equals(current.Code, _selectedBusiness, (StringComparison)5)) { imperiumBusinessView = current; break; } } } finally { ((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } if (_selectedBusiness.Length > 0 && imperiumBusinessView == null) { _selectedBusiness = string.Empty; } Dictionary actions = new Dictionary((IEqualityComparer)(object)StringComparer.Ordinal); string text = ((_selectedBusiness.Length == 0) ? BuildDirectory(ownedBusinesses, actions, imperiumBusinessManagerSettings) : BuildDetail(imperiumBusinessView, actions, imperiumBusinessManagerSettings)); string html = ImperiumAssets.LoadEmbeddedText("interface/business-manager/index.html").Replace("{{CONTENT}}", text, (StringComparison)4); string css = ImperiumAssets.LoadEmbeddedText("interface/business-manager/styles.css"); string script = ImperiumAssets.LoadEmbeddedText("interface/business-manager/app.js"); _document?.Dispose(); _document = ImperiumWebUiRuntime.TryRender(_root.transform, html, css, script, (IReadOnlyDictionary?)(object)actions, out string error, ImperiumInterfaceSurface.Landscape); if (_document == null) { Instance? modLogger = SIAKImperiumMod.ModLogger; if (modLogger != null) { modLogger.Warning("[Imperium UI] Business Manager render failed: " + error); } return false; } _document.RefreshLayout(); _lastRuntimeVersion = ImperiumBusinessManagerRuntime.StateVersion; _lastServiceVersion = SIAKImperiumMod.Service?.StateVersion ?? (-1); _lastSettingsSignature = $"{imperiumBusinessManagerSettings.Enabled}|{imperiumBusinessManagerSettings.Available}|{imperiumBusinessManagerSettings.DownloadSeconds}"; return true; } [HideFromIl2Cpp] private string BuildDirectory(List businesses, Dictionary actions, ImperiumBusinessManagerSettings settings) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown if (!settings.Enabled) { return "

Service unavailable

Imperium Architects have disabled Business Manager.

"; } if (businesses.Count == 0) { return "

No supported businesses owned

Purchase a Laundromat, Post Office, Car Wash, or Taco Ticklers to begin.

"; } StringBuilder val = new StringBuilder(); for (int i = 0; i < businesses.Count; i++) { ImperiumBusinessView imperiumBusinessView = businesses[i]; string text = $"business.open.{i}"; string code = imperiumBusinessView.Code; actions[text] = (Action)delegate { _selectedBusiness = code; _notice = string.Empty; Render(); }; val.Append(string.Concat(new string[11] { "" })); } return "

VIRTUAL OPERATIONS

Owned Businesses

Hire remote staff to move stored cash into native laundering operations.

" + $"
{val}
"; } [HideFromIl2Cpp] private string BuildDetail(ImperiumBusinessView business, Dictionary actions, ImperiumBusinessManagerSettings settings) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Expected O, but got Unknown //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Expected O, but got Unknown actions["business.back"] = (Action)delegate { _selectedBusiness = string.Empty; _notice = string.Empty; Render(); }; actions["business.weekends"] = (Action)delegate { ImperiumBusinessManagerRuntime.ToggleWeekends(business.Code, out _notice); Render(); }; StringBuilder val = new StringBuilder(); for (int num = 0; num < business.Contracts.Count; num++) { ImperiumWorkerContractView imperiumWorkerContractView = business.Contracts[num]; string text = $"business.fire.{num}"; string contractId = imperiumWorkerContractView.ContractId; actions[text] = (Action)delegate { ImperiumBusinessManagerRuntime.Fire(business.Code, contractId, out _notice); Render(); }; val.Append(string.Concat(new string[8] { "

", E(imperiumWorkerContractView.WorkerName), "

", $"

${imperiumWorkerContractView.Wage:N0}/day | {imperiumWorkerContractView.Capacity:N0} capacity

", $"

{E(imperiumWorkerContractView.Status)}

", "
" })); } if (val.Length == 0) { val.Append("

No workers hired.

"); } StringBuilder val2 = new StringBuilder(); List applicants = ImperiumBusinessManagerRuntime.GetApplicants(business.Code); for (int num2 = 0; num2 < applicants.Count; num2++) { ImperiumApplicantView imperiumApplicantView = applicants[num2]; string text2 = $"business.hire.{num2}"; string workerCode = imperiumApplicantView.WorkerCode; bool flag = imperiumApplicantView.Available <= 0 || business.Contracts.Count >= business.WorkerSlots || !settings.Enabled; if (!flag) { actions[text2] = (Action)delegate { ImperiumBusinessManagerRuntime.Hire(business.Code, workerCode, out _notice); Render(); }; } string text3 = (flag ? " unavailable" : string.Empty); string text4 = (flag ? " unavailable-text" : string.Empty); string text5 = (flag ? string.Empty : (" onclick=\"imperium('" + text2 + "')\"")); string text6 = ((imperiumApplicantView.Available <= 0) ? "Unavailable" : ((business.Contracts.Count >= business.WorkerSlots) ? "Slots Full" : (settings.Enabled ? "Hire" : "Unavailable"))); val2.Append(string.Concat(new string[10] { "
", $"

{imperiumApplicantView.Available} AVAILABLE TODAY

", $"

{E(imperiumApplicantView.WorkerName)}

", $"

${imperiumApplicantView.Wage:N0}/day (${imperiumApplicantView.WeekendWage:N0} weekends)

", "
", $"

{imperiumApplicantView.Capacity:N0} capacity

", $"", "
" })); } float num3 = Math.Max(0f, Math.Min(business.WorkingCapacity, business.MaxLaunderable) - business.AutomatedToday); string text7 = E((_notice.Length > 0) ? _notice : ((business.LastStatus.Length > 0) ? business.LastStatus : "Waiting for the next hourly collection cycle.")); return string.Concat(new string[23] { "

BUSINESS OPERATIONS

", E(business.Name), "

Business ceiling

", $"

${business.MaxLaunderable:N0}

", "
", $"

Stored cash · {business.StorageCount} storage{((business.StorageCount == 1) ? string.Empty : "s")} · {business.CashStackCount} cash

", $"

${business.StoredCash:N0}

", "

Capacity remaining

", $"

{num3:N0}

", "

Automated today

", $"

${business.AutomatedToday:N0}

", "

Operations: ", text7, "

", $"

Current Staff {business.Contracts.Count}/{business.WorkerSlots}

", $"{val}", "

Today's Applicants

", $"{val2}", "
" }); } public void OnDestroy() { _document?.Dispose(); _document = null; } [HideFromIl2Cpp] private static string E(string? value) { return SecurityElement.Escape(value ?? string.Empty) ?? string.Empty; } } internal sealed record ImperiumBusinessDefinition(string Code, string Name, float MaxLaunderable, int WorkerSlots) { [CompilerGenerated] private System.Type EqualityContract { [CompilerGenerated] get { return typeof(ImperiumBusinessDefinition); } } [CompilerGenerated] public override string ToString() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown StringBuilder val = new StringBuilder(); val.Append("ImperiumBusinessDefinition"); val.Append(" { "); if (PrintMembers(val)) { val.Append(' '); } val.Append('}'); return ((object)val).ToString(); } [CompilerGenerated] private bool PrintMembers(StringBuilder builder) { RuntimeHelpers.EnsureSufficientExecutionStack(); builder.Append("Code = "); builder.Append((object)Code); builder.Append(", Name = "); builder.Append((object)Name); builder.Append(", MaxLaunderable = "); builder.Append(((object)MaxLaunderable/*cast due to .constrained prefix*/).ToString()); builder.Append(", WorkerSlots = "); builder.Append(((object)WorkerSlots/*cast due to .constrained prefix*/).ToString()); return true; } [CompilerGenerated] public bool Equals(ImperiumBusinessDefinition? other) { return (object)this == other || ((object)other != null && EqualityContract == other.EqualityContract && EqualityComparer.Default.Equals(Code, other.Code) && EqualityComparer.Default.Equals(Name, other.Name) && EqualityComparer.Default.Equals(MaxLaunderable, other.MaxLaunderable) && EqualityComparer.Default.Equals(WorkerSlots, other.WorkerSlots)); } } internal sealed record ImperiumWorkerDefinition(string Code, string Name, float Wage, float Capacity) { [CompilerGenerated] private System.Type EqualityContract { [CompilerGenerated] get { return typeof(ImperiumWorkerDefinition); } } [CompilerGenerated] public override string ToString() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown StringBuilder val = new StringBuilder(); val.Append("ImperiumWorkerDefinition"); val.Append(" { "); if (PrintMembers(val)) { val.Append(' '); } val.Append('}'); return ((object)val).ToString(); } [CompilerGenerated] private bool PrintMembers(StringBuilder builder) { RuntimeHelpers.EnsureSufficientExecutionStack(); builder.Append("Code = "); builder.Append((object)Code); builder.Append(", Name = "); builder.Append((object)Name); builder.Append(", Wage = "); builder.Append(((object)Wage/*cast due to .constrained prefix*/).ToString()); builder.Append(", Capacity = "); builder.Append(((object)Capacity/*cast due to .constrained prefix*/).ToString()); return true; } [CompilerGenerated] public bool Equals(ImperiumWorkerDefinition? other) { return (object)this == other || ((object)other != null && EqualityContract == other.EqualityContract && EqualityComparer.Default.Equals(Code, other.Code) && EqualityComparer.Default.Equals(Name, other.Name) && EqualityComparer.Default.Equals(Wage, other.Wage) && EqualityComparer.Default.Equals(Capacity, other.Capacity)); } } internal sealed class ImperiumBusinessManagerDatabase { [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public Dictionary Profiles { [CompilerGenerated] get; [CompilerGenerated] set; } = new Dictionary((IEqualityComparer)(object)StringComparer.OrdinalIgnoreCase); } internal sealed class ImperiumBusinessManagerProfile { [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ProfileKey { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public Dictionary Businesses { [CompilerGenerated] get; [CompilerGenerated] set; } = new Dictionary((IEqualityComparer)(object)StringComparer.OrdinalIgnoreCase); } internal sealed class ImperiumBusinessState { [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool WorkWeekends { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int AutomatedGameDay { [CompilerGenerated] get; [CompilerGenerated] set; } = -1; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float AutomatedToday { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string LastStatus { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List Contracts { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); } internal sealed class ImperiumWorkerContract { [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ContractId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string WorkerCode { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int HiredGameDay { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int LastPaidGameDay { [CompilerGenerated] get; [CompilerGenerated] set; } = -1; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int WeekendPremiumPaidGameDay { [CompilerGenerated] get; [CompilerGenerated] set; } = -1; } internal sealed class ImperiumBusinessView { [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Code { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string PropertyCode { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Name { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float MaxLaunderable { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int WorkerSlots { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool WorkWeekends { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float WorkingCapacity { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float AutomatedToday { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float StoredCash { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int StorageCount { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int CashStackCount { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float NativeActiveAmount { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float NativeAvailableCapacity { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string LastStatus { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List Contracts { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); } internal sealed class ImperiumWorkerContractView { [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ContractId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string WorkerCode { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string WorkerName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float Wage { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float Capacity { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool PaidToday { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Status { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; } internal sealed class ImperiumApplicantView { [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string WorkerCode { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string WorkerName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float Wage { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float WeekendWage { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float Capacity { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int Available { [CompilerGenerated] get; [CompilerGenerated] set; } } internal static class ImperiumClipboardDeskManager { private const string InjectedNamePrefix = "SIAKImperium_"; private const string DeskPanelName = "SIAKImperium_OperationDeskPanel"; private static readonly BindingFlags InstanceFlags = (BindingFlags)52; private static readonly FieldInfo? WrappedPlaceableStorageField = typeof(StorageEntity).GetField("S1PlaceableStorageEntity", InstanceFlags); private static readonly Dictionary> PanelSelections = new Dictionary>(); private static List LatestSelectedConfigs = new List(); internal static void TryInject(ConfigPanel? panel, List? configs, string sourceTag) { } private static void InjectDeskControls(ConfigPanel? panel, List selectedConfigs, PlaceableStorageEntity selectedStorage, string sourceTag) { if (!((Object)(object)panel == (Object)null)) { RememberLatestSelection((System.Collections.Generic.IEnumerable?)selectedConfigs); RememberSelectedConfigs(panel, (System.Collections.Generic.IEnumerable)selectedConfigs); DestroyInjectedFields(panel); InjectFallbackPanel(panel, selectedConfigs, selectedStorage, sourceTag); } } private static void DestroyInjectedFields(ConfigPanel? panel) { if ((Object)(object)panel == (Object)null) { return; } for (int num = ((Component)panel).transform.childCount - 1; num >= 0; num--) { Transform child = ((Component)panel).transform.GetChild(num); if ((Object)(object)child != (Object)null && ((Object)child).name.StartsWith("SIAKImperium_", (StringComparison)4)) { Object.Destroy((Object)(object)((Component)child).gameObject); } } } private static void InjectFallbackPanel(ConfigPanel panel, List selectedConfigs, PlaceableStorageEntity selectedStorage, string sourceTag) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_00d2: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_011a: 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_0130: 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_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0145: 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_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0186: 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_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Expected O, but got Unknown GameObject val = UIFactory.Panel("SIAKImperium_OperationDeskPanel", ((Component)panel).transform, Color.clear, (Vector2?)null, (Vector2?)null, false); RectTransform component = val.GetComponent(); Stretch(component, new Vector2(0.08f, 0.1f), new Vector2(0.92f, 0.18f), Vector2.zero, Vector2.zero); Text title = UIFactory.Text("DeskTitle", "Imperium Desk", val.transform, 18, (TextAnchor)3, (FontStyle)1); ((Graphic)title).color = new Color(1f, 0.85f, 0.45f); Stretch(((Component)title).GetComponent(), new Vector2(0f, 0f), new Vector2(0.58f, 1f), new Vector2(6f, 0f), new Vector2(0f, 0f)); ValueTuple val2 = UIFactory.RoundedButtonWithLabel("DeskToggleButton", "Set Desk", val.transform, new Color(0.24f, 0.24f, 0.24f), 170f, 38f, 15, Color.white); Button button = val2.Item2; Text label = val2.Item3; RectTransform component2 = ((Component)button).GetComponent(); Stretch(component2, new Vector2(1f, 0.5f), new Vector2(1f, 0.5f), new Vector2(-176f, -19f), new Vector2(-6f, 19f)); ButtonUtils.AddListener(button, (Action)delegate { if (TryResolveSelectedStorage((System.Collections.Generic.IEnumerable)selectedConfigs, out PlaceableStorageEntity storage)) { DebugLog("Fallback clipboard desk button clicked for " + GetStorageLabel(storage) + "."); ToggleOperationDesk(storage); title.text = (IsActiveStorage(storage) ? "Imperium Desk Active" : "Imperium Desk"); UpdateFallbackButton(button, label, storage); } }); title.text = (IsActiveStorage(selectedStorage) ? "Imperium Desk Active" : "Imperium Desk"); UpdateFallbackButton(button, label, selectedStorage); DebugLog($"Injected fallback clipboard panel from {sourceTag} for {GetStorageLabel(selectedStorage)}."); } internal static void TryInjectKnownPanels(System.Collections.Generic.IEnumerable? selectedConfigs, string sourceTag) { } internal static bool TryAssignOperationDesk(StorageEntity storage, out string statusMessage) { if (!TryResolvePlaceableStorage(storage, out PlaceableStorageEntity placeableStorage)) { statusMessage = "Open a large or huge storage to assign an Imperium S.R.D Storage."; return false; } return TryAssignOperationDesk(placeableStorage, out statusMessage); } internal static bool TryAssignOperationDesk(PlaceableStorageEntity selectedStorage, out string statusMessage) { statusMessage = "Open a large or huge storage to assign an Imperium S.R.D Storage."; if ((Object)(object)selectedStorage == (Object)null) { return false; } string storageGuid = GetStorageGuid(selectedStorage); if (string.IsNullOrWhiteSpace(storageGuid)) { MelonLogger.Warning("[Imperium] Could not determine the selected storage GUID for desk assignment."); return false; } if (!IsEligibleStorage(selectedStorage)) { statusMessage = "Only large or huge storage units can become the Imperium S.R.D Storage."; return false; } string value = SIAKImperiumMod.ActiveDeskGuid.Value; if (!string.IsNullOrWhiteSpace(value) && !string.Equals(value, storageGuid, (StringComparison)5) && TryFindStorageByGuid(value, out PlaceableStorageEntity storage)) { RestoreStorageName(storage, SIAKImperiumMod.ActiveDeskPreviousName.Value); } ClearDeskNameFromOthers(storageGuid); string backupStorageName = GetBackupStorageName(selectedStorage); SIAKImperiumMod.ActiveDeskGuid.Value = storageGuid; SIAKImperiumMod.ActiveDeskPreviousName.Value = backupStorageName; SIAKImperiumMod.ActiveDeskLocationHint.Value = ResolveLocationHint(selectedStorage); ApplyDeskName(selectedStorage); QueueRefresh(); statusMessage = "Assigned " + GetStorageLabel(selectedStorage) + " as the Imperium S.R.D Storage."; DebugLog($"Assigned S.R.D Storage to {GetStorageLabel(selectedStorage)} ({storageGuid}) through app flow."); return true; } internal static bool TryUnassignOperationDesk(out string statusMessage) { statusMessage = "No Imperium S.R.D Storage is currently assigned."; string value = SIAKImperiumMod.ActiveDeskGuid.Value; if (string.IsNullOrWhiteSpace(value)) { return false; } if (TryFindStorageByGuid(value, out PlaceableStorageEntity storage)) { RestoreStorageName(storage, SIAKImperiumMod.ActiveDeskPreviousName.Value); } SIAKImperiumMod.ActiveDeskGuid.Value = string.Empty; SIAKImperiumMod.ActiveDeskPreviousName.Value = string.Empty; SIAKImperiumMod.ActiveDeskLocationHint.Value = string.Empty; QueueRefresh(); statusMessage = "Imperium S.R.D Storage unassigned."; DebugLog("Cleared active S.R.D Storage assignment (" + value + ")."); return true; } private static void UpdateFallbackButton(Button button, Text? buttonLabel, PlaceableStorageEntity selectedStorage) { //IL_0045: 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_009b: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) bool flag = IsEligibleStorage(selectedStorage); bool flag2 = IsActiveStorage(selectedStorage); if ((Object)(object)buttonLabel != (Object)null) { buttonLabel.text = ((!flag) ? "Unavailable" : (flag2 ? "Unset Desk" : "Set Desk")); } ((Selectable)button).interactable = flag; ColorBlock colors = ((Selectable)button).colors; Color normalColor = ((!flag) ? new Color(0.32f, 0.18f, 0.18f, 1f) : (flag2 ? new Color(0.31f, 0.62f, 0.37f, 1f) : new Color(0.24f, 0.24f, 0.24f, 1f))); Color val = ((!flag) ? new Color(0.38f, 0.2f, 0.2f, 1f) : (flag2 ? new Color(0.36f, 0.69f, 0.41f, 1f) : new Color(0.32f, 0.32f, 0.32f, 1f))); Color pressedColor = ((!flag) ? new Color(0.24f, 0.16f, 0.16f, 1f) : (flag2 ? new Color(0.23f, 0.52f, 0.28f, 1f) : new Color(0.18f, 0.18f, 0.18f, 1f))); ((ColorBlock)(ref colors)).normalColor = normalColor; ((ColorBlock)(ref colors)).highlightedColor = val; ((ColorBlock)(ref colors)).selectedColor = val; ((ColorBlock)(ref colors)).pressedColor = pressedColor; ((Selectable)button).colors = colors; } private static string GetSelectionSummary(PlaceableStorageEntity storage) { string storageLabel = GetStorageLabel(storage); string text = (IsActiveStorage(storage) ? "Active Desk" : "Selected Storage"); return text + ": " + storageLabel; } private static string BuildDescription(PlaceableStorageEntity storage) { if (!IsEligibleStorage(storage)) { return "Only large or huge storage units can become the S.I.A.K Imperium S.R.D Storage."; } return "Mark this storage as the dedicated Imperium S.R.D Storage. If another storage already exists, it will be cleared automatically."; } private static bool IsStoragePanelCandidate(ConfigPanel panel) { if ((Object)(object)panel == (Object)null || (Object)(object)((Component)panel).gameObject == (Object)null || !((Component)panel).gameObject.activeInHierarchy) { return false; } string identity = ((Object)panel).name + " " + ((object)panel).GetType().FullName; string[] array = new string[12] { "Packager", "Packaging", "Cauldron", "DryingRack", "Mixing", "Cleaner", "Botanist", "Chemist", "Employee", "Route", "Bed", "BrickPress" }; return !Enumerable.Any((System.Collections.Generic.IEnumerable)array, (Func)((string hint) => identity.IndexOf(hint, (StringComparison)5) >= 0)); } private static List ExtractStorageConfigs(List? configs) { List val = new List(); if (configs == null) { return val; } for (int i = 0; i < configs.Count; i++) { EntityConfiguration val2 = configs[i]; if (val2 != null && TryResolvePlaceableStorage((object)val2, out PlaceableStorageEntity _)) { val.Add(val2); } } return val; } private static void RememberSelectedConfigs(ConfigPanel panel, System.Collections.Generic.IEnumerable selectedConfigs) { if (!((Object)(object)panel == (Object)null)) { List val = ((selectedConfigs != null) ? Enumerable.ToList(Enumerable.Where(selectedConfigs, (Func)((EntityConfiguration config) => config != null))) : null) ?? new List(); PanelSelections[((Object)panel).GetInstanceID()] = val; } } private static void RememberLatestSelection(System.Collections.Generic.IEnumerable? selectedConfigs) { LatestSelectedConfigs = ((selectedConfigs != null) ? Enumerable.ToList(Enumerable.Where(selectedConfigs, (Func)((EntityConfiguration config) => config != null))) : null) ?? new List(); } private static bool TryGetRememberedSelection(ConfigPanel? panel, out List selectedConfigs) { selectedConfigs = new List(); if ((Object)(object)panel == (Object)null) { return false; } List val = default(List); if (!PanelSelections.TryGetValue(((Object)panel).GetInstanceID(), ref val) || val == null || val.Count == 0) { return false; } selectedConfigs = Enumerable.ToList(Enumerable.Where((System.Collections.Generic.IEnumerable)val, (Func)((EntityConfiguration config) => config != null))); return selectedConfigs.Count > 0; } private static bool TryResolveSelectedStorage(System.Collections.Generic.IEnumerable selectedConfigs, out PlaceableStorageEntity storage) { System.Collections.Generic.IEnumerator enumerator = selectedConfigs.GetEnumerator(); try { while (((System.Collections.IEnumerator)enumerator).MoveNext()) { EntityConfiguration current = enumerator.Current; if (current != null && TryResolvePlaceableStorage((object)current, out storage)) { return true; } } } finally { ((System.IDisposable)enumerator)?.Dispose(); } storage = null; return false; } private static bool TryResolvePlaceableStorage(StorageEntity storage, out PlaceableStorageEntity placeableStorage) { placeableStorage = null; if (storage == null) { return false; } try { FieldInfo? wrappedPlaceableStorageField = WrappedPlaceableStorageField; object obj = ((wrappedPlaceableStorageField != null) ? wrappedPlaceableStorageField.GetValue((object)storage) : null); PlaceableStorageEntity val = (PlaceableStorageEntity)((obj is PlaceableStorageEntity) ? obj : null); if ((Object)(object)val == (Object)null) { return false; } placeableStorage = val; return true; } catch { return false; } } private static bool TryResolvePlaceableStorage(object root, out PlaceableStorageEntity storage) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_0255: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) storage = null; if (root == null) { return false; } HashSet val = new HashSet(); Queue> val2 = new Queue>(); val2.Enqueue(new ValueTuple(root, 0)); while (val2.Count > 0) { ValueTuple val3 = val2.Dequeue(); object item = val3.Item1; int item2 = val3.Item2; if (item == null) { continue; } int hashCode = item.GetHashCode(); if (!val.Add(hashCode)) { continue; } PlaceableStorageEntity val4 = (PlaceableStorageEntity)((item is PlaceableStorageEntity) ? item : null); if (val4 != null) { storage = val4; return true; } Component val5 = (Component)((item is Component) ? item : null); if (val5 != null) { PlaceableStorageEntity componentInParent = val5.GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null) { storage = componentInParent; return true; } } GameObject val6 = (GameObject)((item is GameObject) ? item : null); if (val6 != null) { PlaceableStorageEntity componentInParent2 = val6.GetComponentInParent(); if ((Object)(object)componentInParent2 != (Object)null) { storage = componentInParent2; return true; } } if (item is System.Collections.IEnumerable enumerable && !(item is string)) { foreach (object item3 in enumerable) { if (item3 != null) { val2.Enqueue(new ValueTuple(item3, item2 + 1)); } } } if (item2 >= 5) { continue; } System.Type type = item.GetType(); PropertyInfo[] properties = type.GetProperties(InstanceFlags); foreach (PropertyInfo val7 in properties) { if (val7.CanRead && val7.GetIndexParameters().Length == 0 && !(val7.PropertyType == typeof(string)) && !val7.PropertyType.IsPrimitive) { object obj = null; try { obj = val7.GetValue(item); } catch { } if (obj != null) { val2.Enqueue(new ValueTuple(obj, item2 + 1)); } } } FieldInfo[] fields = type.GetFields(InstanceFlags); foreach (FieldInfo val8 in fields) { if (!(val8.FieldType == typeof(string)) && !val8.FieldType.IsPrimitive) { object obj3 = null; try { obj3 = val8.GetValue(item); } catch { } if (obj3 != null) { val2.Enqueue(new ValueTuple(obj3, item2 + 1)); } } } } return false; } private static void ToggleOperationDesk(PlaceableStorageEntity selectedStorage) { if ((Object)(object)selectedStorage == (Object)null) { return; } string storageGuid = GetStorageGuid(selectedStorage); if (string.IsNullOrWhiteSpace(storageGuid)) { MelonLogger.Warning("[Imperium] Could not determine the selected storage GUID for the clipboard desk button."); DebugLog("Selected storage '" + GetStorageLabel(selectedStorage) + "' did not expose a GUID."); return; } if (!IsEligibleStorage(selectedStorage)) { MelonLogger.Warning("[Imperium] Only large or huge storage units can become the Imperium S.R.D Storage."); DebugLog("Storage '" + GetStorageLabel(selectedStorage) + "' was rejected because it is not large or huge."); return; } string value = SIAKImperiumMod.ActiveDeskGuid.Value; if (string.Equals(value, storageGuid, (StringComparison)5)) { RestoreStorageName(selectedStorage, SIAKImperiumMod.ActiveDeskPreviousName.Value); SIAKImperiumMod.ActiveDeskGuid.Value = string.Empty; SIAKImperiumMod.ActiveDeskPreviousName.Value = string.Empty; SIAKImperiumMod.ActiveDeskLocationHint.Value = string.Empty; DebugLog($"Cleared active S.R.D Storage from {GetStorageLabel(selectedStorage)} ({storageGuid})."); QueueRefresh(); return; } if (!string.IsNullOrWhiteSpace(value) && TryFindStorageByGuid(value, out PlaceableStorageEntity storage)) { RestoreStorageName(storage, SIAKImperiumMod.ActiveDeskPreviousName.Value); } ClearDeskNameFromOthers(storageGuid); string backupStorageName = GetBackupStorageName(selectedStorage); SIAKImperiumMod.ActiveDeskGuid.Value = storageGuid; SIAKImperiumMod.ActiveDeskPreviousName.Value = backupStorageName; ApplyDeskName(selectedStorage); DebugLog($"Set active S.R.D Storage to {GetStorageLabel(selectedStorage)} ({storageGuid})."); QueueRefresh(); } private static void QueueRefresh() { SIAKImperiumMod.ConfigCategory.SaveToFile(false); SIAKImperiumMod.Service.QueueImmediateRefresh(); SIAKImperiumMod.Service.QueueImmediateLeaderboardRefresh(); SIAKImperiumMod.Service.QueueImmediateMarketRefresh(); SIAKImperiumMod.Service.QueueImmediateMessagesRefresh(); } private static void ClearDeskNameFromOthers(string selectedGuid) { Il2CppArrayBase val = Object.FindObjectsOfType(); if (val == null) { return; } System.Collections.Generic.IEnumerator enumerator = val.GetEnumerator(); try { while (((System.Collections.IEnumerator)enumerator).MoveNext()) { PlaceableStorageEntity current = enumerator.Current; if ((Object)(object)current == (Object)null) { continue; } string storageGuid = GetStorageGuid(current); if (!string.Equals(storageGuid, selectedGuid, (StringComparison)5)) { string storageCustomName = GetStorageCustomName(current); string storageDisplayName = GetStorageDisplayName(current); if (IsDeskName(storageCustomName) || IsDeskName(storageDisplayName)) { RestoreStorageName(current, GetDefaultStorageName(current)); } } } } finally { ((System.IDisposable)enumerator)?.Dispose(); } } private static bool TryFindStorageByGuid(string guid, out PlaceableStorageEntity storage) { storage = null; Il2CppArrayBase val = Object.FindObjectsOfType(); if (val == null) { return false; } System.Collections.Generic.IEnumerator enumerator = val.GetEnumerator(); try { while (((System.Collections.IEnumerator)enumerator).MoveNext()) { PlaceableStorageEntity current = enumerator.Current; if ((Object)(object)current == (Object)null || !string.Equals(GetStorageGuid(current), guid, (StringComparison)5)) { continue; } storage = current; return true; } } finally { ((System.IDisposable)enumerator)?.Dispose(); } return false; } internal static void EnsureAssignedStorageName() { string value = SIAKImperiumMod.ActiveDeskGuid.Value; if (!string.IsNullOrWhiteSpace(value) && TryFindStorageByGuid(value, out PlaceableStorageEntity storage)) { string storageCustomName = GetStorageCustomName(storage); string storageDisplayName = GetStorageDisplayName(storage); if (!string.Equals(storageCustomName, "[S.I.A.K] Imperium S.R.D Storage", (StringComparison)5) || !string.Equals(storageDisplayName, "[S.I.A.K] Imperium S.R.D Storage", (StringComparison)5)) { ApplyDeskName(storage); } } } private static bool IsActiveStorage(PlaceableStorageEntity storage) { string storageGuid = GetStorageGuid(storage); return !string.IsNullOrWhiteSpace(storageGuid) && string.Equals(storageGuid, SIAKImperiumMod.ActiveDeskGuid.Value, (StringComparison)5); } private static bool IsEligibleStorage(PlaceableStorageEntity storage) { string eligibilityHint = GetEligibilityHint(storage); return (eligibilityHint.IndexOf("storage", (StringComparison)5) >= 0 || eligibilityHint.IndexOf("storageunit", (StringComparison)5) >= 0) && (eligibilityHint.IndexOf("large", (StringComparison)5) >= 0 || eligibilityHint.IndexOf("huge", (StringComparison)5) >= 0 || eligibilityHint.IndexOf("unit2", (StringComparison)5) >= 0 || eligibilityHint.IndexOf("unit3", (StringComparison)5) >= 0 || IsActiveStorage(storage)); } private static string GetEligibilityHint(PlaceableStorageEntity storage) { string defaultStorageName = GetDefaultStorageName(storage); string storageDisplayName = GetStorageDisplayName(storage); string text = string.Empty; try { ItemInstance itemInstance = ((BuildableItem)storage).ItemInstance; object obj; if (itemInstance == null) { obj = null; } else { ItemDefinition definition = itemInstance.Definition; obj = ((definition != null) ? ((BaseItemDefinition)definition).ID : null); } if (obj == null) { obj = string.Empty; } text = (string)obj; } catch { } return $"{defaultStorageName} {storageDisplayName} {text}"; } private static string GetSelectionStorageName(PlaceableStorageEntity storage) { string storageCustomName = GetStorageCustomName(storage); return (storageCustomName != null && storageCustomName.Length > 0 && !IsDeskName(storageCustomName)) ? storageCustomName : GetDefaultStorageName(storage); } private static string GetBackupStorageName(PlaceableStorageEntity storage) { string storageCustomName = GetStorageCustomName(storage); if (!string.IsNullOrWhiteSpace(storageCustomName) && !IsDeskName(storageCustomName)) { return storageCustomName; } return GetDefaultStorageName(storage); } private static string GetStorageLabel(PlaceableStorageEntity storage) { string selectionStorageName = GetSelectionStorageName(storage); return string.IsNullOrWhiteSpace(selectionStorageName) ? "Storage" : selectionStorageName; } private static string ResolveLocationHint(PlaceableStorageEntity storage) { //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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) try { List val = new List(); Transform val2 = ((Component)storage).transform; int num = 0; while ((Object)(object)val2 != (Object)null && num < 8) { string text = (((Object)val2).name ?? string.Empty).Trim(); if (!string.IsNullOrWhiteSpace(text) && !text.Contains("Clone", (StringComparison)5) && !text.Contains("Storage", (StringComparison)5) && !text.Contains("Placeable", (StringComparison)5) && !text.Contains("Container", (StringComparison)5)) { val.Add(text); } val2 = val2.parent; num++; } string text2 = Enumerable.FirstOrDefault((System.Collections.Generic.IEnumerable)val, (Func)((string candidate) => candidate.IndexOf("barn", (StringComparison)5) >= 0 || candidate.IndexOf("bungalow", (StringComparison)5) >= 0 || candidate.IndexOf("motel", (StringComparison)5) >= 0 || candidate.IndexOf("warehouse", (StringComparison)5) >= 0)); if (!string.IsNullOrWhiteSpace(text2)) { return text2; } if (val.Count > 0) { return val[0]; } Vector3 position = ((Component)storage).transform.position; return $"World X:{position.x:0} Z:{position.z:0}"; } catch { return "World location pending"; } } private static string GetDefaultStorageName(PlaceableStorageEntity storage) { try { ItemInstance itemInstance = ((BuildableItem)storage).ItemInstance; object obj; if (itemInstance == null) { obj = null; } else { ItemDefinition definition = itemInstance.Definition; obj = ((definition != null) ? ((BaseItemDefinition)definition).Name : null); } string text = (string)obj; if (!string.IsNullOrWhiteSpace(text)) { return text; } } catch { } return "Storage"; } private static string GetStorageDisplayName(PlaceableStorageEntity storage) { try { StorageEntity storageEntity = storage.StorageEntity; return ((storageEntity != null) ? storageEntity.StorageEntityName : null) ?? string.Empty; } catch { return string.Empty; } } private static string GetStorageCustomName(PlaceableStorageEntity storage) { try { EntityConfiguration configuration = storage.Configuration; object obj; if (configuration == null) { obj = null; } else { StringField name = configuration.Name; obj = ((name != null) ? name.Value : null); } if (obj == null) { obj = string.Empty; } return (string)obj; } catch { return string.Empty; } } private static string GetStorageGuid(PlaceableStorageEntity storage) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) try { PropertyInfo property = ((object)storage).GetType().GetProperty("GUID", InstanceFlags); return ((property != null) ? property.GetValue((object)storage) : null)?.ToString() ?? string.Empty; } catch { return string.Empty; } } private static void ApplyDeskName(PlaceableStorageEntity storage) { try { if ((Object)(object)storage.StorageEntity != (Object)null) { storage.StorageEntity.StorageEntityName = "[S.I.A.K] Imperium S.R.D Storage"; } EntityConfiguration configuration = storage.Configuration; if (((configuration != null) ? configuration.Name : null) != null) { storage.Configuration.Name.SetValue("[S.I.A.K] Imperium S.R.D Storage", true); } } catch (System.Exception ex) { MelonLogger.Warning("[Imperium] Failed to apply S.R.D Storage name: " + ex.Message); } } private static void Stretch(RectTransform rect, Vector2 anchorMin, Vector2 anchorMax, Vector2 offsetMin, Vector2 offsetMax) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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) if (!((Object)(object)rect == (Object)null)) { rect.anchorMin = anchorMin; rect.anchorMax = anchorMax; rect.offsetMin = offsetMin; rect.offsetMax = offsetMax; } } private static void DebugLog(string message) { if (SIAKImperiumMod.DebugLogging.Value) { MelonLogger.Msg("[Imperium Debug] " + message); } } private static void RestoreStorageName(PlaceableStorageEntity storage, string fallbackName) { string text = ((string.IsNullOrWhiteSpace(fallbackName) || IsDeskName(fallbackName)) ? GetDefaultStorageName(storage) : fallbackName); try { if ((Object)(object)storage.StorageEntity != (Object)null) { storage.StorageEntity.StorageEntityName = text; } EntityConfiguration configuration = storage.Configuration; if (((configuration != null) ? configuration.Name : null) != null) { storage.Configuration.Name.SetValue(text, true); } } catch (System.Exception ex) { MelonLogger.Warning("[Imperium] Failed to restore storage name: " + ex.Message); } } private static bool IsDeskName(string? value) { return ImperiumService.LooksLikeOperationDeskName(value); } } [HarmonyPatch(typeof(ConfigPanel), "Bind")] internal static class ImperiumConfigPanelBindPatch { [Obfuscation(Exclude = true)] private static void Postfix(ConfigPanel __instance, List configs) { int num = configs?.Count ?? 0; ImperiumClipboardDeskManager.TryInject(__instance, configs, $"ConfigPanel.Bind[{num}]"); } } [HarmonyPatch(typeof(EntityConfiguration), "Selected")] internal static class ImperiumEntityConfigurationSelectedPatch { [Obfuscation(Exclude = true)] private static void Postfix(EntityConfiguration __instance) { if (__instance != null) { ImperiumClipboardDeskManager.TryInjectKnownPanels((System.Collections.Generic.IEnumerable?)(object)new EntityConfiguration[1] { __instance }, "EntityConfiguration.Selected"); } } } [HarmonyPatch(typeof(ClipboardScreen), "Open")] internal static class ImperiumClipboardScreenOpenPatch { [Obfuscation(Exclude = true)] private static void Postfix(ClipboardScreen __instance) { ImperiumClipboardDeskManager.TryInjectKnownPanels(null, "ClipboardScreen.Open"); } } internal static class ImperiumConsoleAuditPatches { internal static bool BlockAll() { return false; } } internal sealed class ImperiumUploadMissionProductCommand : BaseConsoleCommand { public override string CommandWord => "siakupload"; public override string CommandDescription => "Uploads distinct drug recipes from the assigned Imperium S.R.D Storage to the mission catalogue."; public override string ExampleUsage => "siakupload"; public override void ExecuteCommand(List args) { SIAKImperiumMod.Service.UploadHeldMissionProduct(); } } internal sealed class ImperiumLogoutCommand : BaseConsoleCommand { public override string CommandWord => "siaklogout"; public override string CommandDescription => "Revokes this device's Imperium sign-in and restarts secure Steam verification."; public override string ExampleUsage => "siaklogout"; public override void ExecuteCommand(List args) { SIAKImperiumMod.Service.LogoutPlayerDevice(); } } internal static class ImperiumEmbeddedDependencyLoader { [CompilerGenerated] private static class <>O { public static ResolveEventHandler <0>__ResolveEmbeddedAssembly; } private const string JintResource = "SIAKImperium.deps.Jint.dll"; private const string AcornimaResource = "SIAKImperium.deps.Acornima.dll"; private static readonly object Gate = new object(); private static readonly Dictionary Loaded = new Dictionary((IEqualityComparer)(object)StringComparer.OrdinalIgnoreCase); private static bool _installed; private static bool _available; private static string _failure = string.Empty; internal static bool Available => EnsureInstalled(); internal static string Failure { get { EnsureInstalled(); return _failure; } } [ModuleInitializer] internal static void InitializeModule() { EnsureInstalled(); } internal static bool EnsureInstalled() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown lock (Gate) { if (_installed) { return _available; } _installed = true; AppDomain currentDomain = AppDomain.CurrentDomain; object obj = <>O.<0>__ResolveEmbeddedAssembly; if (obj == null) { ResolveEventHandler val = ResolveEmbeddedAssembly; <>O.<0>__ResolveEmbeddedAssembly = val; obj = (object)val; } currentDomain.AssemblyResolve += (ResolveEventHandler)obj; try { LoadEmbedded("Acornima", "SIAKImperium.deps.Acornima.dll"); LoadEmbedded("Jint", "SIAKImperium.deps.Jint.dll"); _available = true; } catch (System.Exception ex) { _available = false; _failure = ex.Message; Instance? modLogger = SIAKImperiumMod.ModLogger; if (modLogger != null) { modLogger.Warning("[Imperium UI] Embedded renderer runtime could not start: " + ex.Message); } } return _available; } } private static Assembly? ResolveEmbeddedAssembly(object? sender, ResolveEventArgs args) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) string name; try { name = new AssemblyName(args.Name).Name; } catch { return null; } string text = name?.ToLowerInvariant(); return (text == "jint") ? TryLoadEmbedded("Jint", "SIAKImperium.deps.Jint.dll") : ((!(text == "acornima")) ? null : TryLoadEmbedded("Acornima", "SIAKImperium.deps.Acornima.dll")); } private static Assembly? TryLoadEmbedded(string simpleName, string resourceName) { try { return LoadEmbedded(simpleName, resourceName); } catch (System.Exception ex) { _failure = ex.Message; Instance? modLogger = SIAKImperiumMod.ModLogger; if (modLogger != null) { modLogger.Warning("[Imperium UI] Could not resolve embedded " + simpleName + ": " + ex.Message); } return null; } } private static Assembly LoadEmbedded(string simpleName, string resourceName) { //IL_004f: 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_005d: Expected O, but got Unknown lock (Gate) { Assembly result = default(Assembly); if (Loaded.TryGetValue(simpleName, ref result)) { return result; } Stream val = typeof(ImperiumEmbeddedDependencyLoader).Assembly.GetManifestResourceStream(resourceName) ?? throw new FileNotFoundException("Embedded renderer dependency was not found: " + resourceName); try { MemoryStream val2 = new MemoryStream(); try { val.CopyTo((Stream)(object)val2); result = Assembly.Load(val2.ToArray()); Loaded[simpleName] = result; return result; } finally { ((System.IDisposable)val2)?.Dispose(); } } finally { ((System.IDisposable)val)?.Dispose(); } } } } public sealed class ImperiumHylandersApp : PhoneApp { internal const string ApplicationId = "SIAKHylandersApp"; private static ImperiumHylandersApp? _instance; private static ImperiumHylandersController? _controller; private static GameObject? _iconRoot; private static readonly Action OpenFromLauncherAction = new Action(OpenFromLauncher); protected override string AppName => "SIAKHylandersApp"; protected override string AppTitle => "Hylanders"; protected override string IconLabel => "Hylanders"; protected override string IconFileName => string.Empty; protected override Sprite? IconSprite => ImperiumAssets.LoadHylandersAppIconSprite(); protected override EOrientation Orientation => (EOrientation)0; protected override void OnCreatedUI(GameObject container) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) _instance = this; GameObject val = UIFactory.Panel("HylandersHtmlRoot", container.transform, Color.clear, (Vector2?)null, (Vector2?)null, true); _controller = val.AddComponent(); if (!_controller.Initialize(val)) { Text val2 = UIFactory.Text("HylandersFallback", "Hylanders could not initialise.", val.transform, 22, (TextAnchor)4, (FontStyle)1); ((Graphic)val2).rectTransform.anchorMin = Vector2.zero; ((Graphic)val2).rectTransform.anchorMax = Vector2.one; ((Graphic)val2).rectTransform.offsetMin = Vector2.zero; ((Graphic)val2).rectTransform.offsetMax = Vector2.zero; } ApplyLauncherVisibility(ImperiumAppStoreManager.IsInstalled("SIAKHylandersApp")); ImperiumAppStoreManager.ScheduleCatalogRefresh(); } internal static void ApplyLauncherVisibility(bool visible) { if (_instance != null) { _iconRoot = ImperiumPhoneLauncherDeduplicator.AdoptExistingLauncher(_iconRoot, "SIAKHylandersApp", visible); } } private static void OpenFromLauncher() { ImperiumHylandersApp? instance = _instance; if (instance != null) { ((PhoneApp)instance).OpenApp(); } ImperiumService service = SIAKImperiumMod.Service; if (service != null) { service.QueueImmediateRefresh(); SIAKImperiumMod.RequestEventPulse(); } _controller?.RefreshNow(); } } internal static class ImperiumHylandersRuntime { internal const float SingleCleaningCost = 4000f; internal const float SubscriptionEntryCost = 10000f; internal const float SubscriptionDailyCost = 1500f; internal const int IncludedCleaningDays = 6; private static ImperiumHylandersDatabase? _database; private static bool _subscribed; private static int _stateVersion; internal static int StateVersion => _stateVersion; internal static void Initialize() { EnsureLoaded(); if (!_subscribed) { TimeManager.OnSleepEnd = (Action)(object)System.Delegate.Combine((System.Delegate)(object)TimeManager.OnSleepEnd, (System.Delegate)(object)new Action(HandleSleepEnd)); _subscribed = true; } } internal static void Dispose() { if (_subscribed) { TimeManager.OnSleepEnd = ((Action)(object)System.Delegate.Remove((System.Delegate)(object)TimeManager.OnSleepEnd, (System.Delegate)(object)new Action(HandleSleepEnd))) ?? ((Action)delegate { }); _subscribed = false; } } internal static ImperiumHylandersView GetView() { ImperiumHylandersProfile imperiumHylandersProfile = CurrentProfile(); return new ImperiumHylandersView { PendingSingleCleanings = imperiumHylandersProfile.PendingSingleCleanings, IncludedCleaningsRemaining = imperiumHylandersProfile.IncludedCleaningsRemaining, SubscriptionRenewalEnabled = imperiumHylandersProfile.SubscriptionRenewalEnabled, LastCleanedGameDay = imperiumHylandersProfile.LastCleanedGameDay, LastStatus = imperiumHylandersProfile.LastStatus }; } internal static bool PurchaseSingleCleaning(out string message) { if (!CanManage(out message)) { return false; } ImperiumHylandersProfile imperiumHylandersProfile = CurrentProfile(); if (imperiumHylandersProfile.PendingSingleCleanings > 0) { message = "A cleaning visit is already queued for the next wake-up."; return false; } if (imperiumHylandersProfile.IncludedCleaningsRemaining > 0 || imperiumHylandersProfile.SubscriptionRenewalEnabled) { message = "Your cleaning subscription already covers the next eligible wake-up."; return false; } if (!TryPay(4000f, "One-time town cleaning", out message)) { return false; } imperiumHylandersProfile.PendingSingleCleanings = 1; imperiumHylandersProfile.LastStatus = "Cleaning service booked. The town will be cleaned after your next sleep."; SaveChanged(); message = imperiumHylandersProfile.LastStatus; return true; } internal static bool StartOrResumeSubscription(out string message) { if (!CanManage(out message)) { return false; } ImperiumHylandersProfile imperiumHylandersProfile = CurrentProfile(); if (imperiumHylandersProfile.SubscriptionRenewalEnabled) { message = "Cleaning subscription renewal is already active."; return false; } if (imperiumHylandersProfile.IncludedCleaningsRemaining > 0) { imperiumHylandersProfile.SubscriptionRenewalEnabled = true; imperiumHylandersProfile.LastStatus = "Subscription renewal resumed. Your remaining prepaid cleaning days are unchanged."; SaveChanged(); message = imperiumHylandersProfile.LastStatus; return true; } if (!TryPay(10000f, "Six-day cleaning service", out message)) { return false; } imperiumHylandersProfile.IncludedCleaningsRemaining = 6; imperiumHylandersProfile.SubscriptionRenewalEnabled = true; imperiumHylandersProfile.LastStatus = $"Subscription started with {6} prepaid cleaning days."; SaveChanged(); message = imperiumHylandersProfile.LastStatus; return true; } internal static bool CancelSubscription(out string message) { if (!CanManage(out message)) { return false; } ImperiumHylandersProfile imperiumHylandersProfile = CurrentProfile(); if (!imperiumHylandersProfile.SubscriptionRenewalEnabled) { message = "Cleaning subscription renewal is already disabled."; return false; } imperiumHylandersProfile.SubscriptionRenewalEnabled = false; imperiumHylandersProfile.LastStatus = ((imperiumHylandersProfile.IncludedCleaningsRemaining > 0) ? $"Renewal cancelled. {imperiumHylandersProfile.IncludedCleaningsRemaining} prepaid cleaning day(s) remain available." : "Cleaning subscription renewal cancelled."); SaveChanged(); message = imperiumHylandersProfile.LastStatus; return true; } private static void HandleSleepEnd(int skippedMinutes) { if (!CanManage(out string _)) { return; } ImperiumHylandersProfile imperiumHylandersProfile = CurrentProfile(); int num = CurrentGameDay(); if (imperiumHylandersProfile.LastProcessedWakeGameDay == num || (imperiumHylandersProfile.PendingSingleCleanings <= 0 && imperiumHylandersProfile.IncludedCleaningsRemaining <= 0 && !imperiumHylandersProfile.SubscriptionRenewalEnabled)) { return; } imperiumHylandersProfile.LastProcessedWakeGameDay = num; if (imperiumHylandersProfile.PendingSingleCleanings > 0) { if (TryCleanTown(out string status)) { imperiumHylandersProfile.PendingSingleCleanings--; imperiumHylandersProfile.LastCleanedGameDay = num; } imperiumHylandersProfile.LastStatus = status; SaveChanged(); return; } if (imperiumHylandersProfile.IncludedCleaningsRemaining > 0) { if (TryCleanTown(out string status2)) { imperiumHylandersProfile.IncludedCleaningsRemaining--; imperiumHylandersProfile.LastCleanedGameDay = num; status2 += $" {imperiumHylandersProfile.IncludedCleaningsRemaining} prepaid day(s) remain."; } imperiumHylandersProfile.LastStatus = status2; SaveChanged(); return; } if (!TryPay(1500f, "Daily cleaning service", out string message2)) { imperiumHylandersProfile.LastStatus = message2 + " No cleaning was performed today."; SaveChanged(); return; } if (TryCleanTown(out string status3)) { imperiumHylandersProfile.LastCleanedGameDay = num; imperiumHylandersProfile.LastStatus = $"${1500f:N0} renewal paid. {status3}"; } else { imperiumHylandersProfile.PendingSingleCleanings++; imperiumHylandersProfile.LastStatus = $"${1500f:N0} renewal paid. The cleaning visit remains queued: {status3}"; } SaveChanged(); } private static bool TryCleanTown(out string status) { try { ConsoleHelper.ClearTrash(); status = "Hyland Point was cleaned successfully after wake-up."; return true; } catch (System.Exception ex) { Instance? modLogger = SIAKImperiumMod.ModLogger; if (modLogger != null) { modLogger.Warning("[Imperium] Hylanders cleanup failed: " + ex.Message); } status = "The cleaning crew could not access the town. Your paid visit was not consumed."; return false; } } private static bool TryPay(float amount, string note, out string message) { float onlineBalance = Money.GetOnlineBalance(); if (onlineBalance + 0.01f < amount) { message = $"The organisation bank needs ${amount:N0}; only ${onlineBalance:N0} is available."; return false; } Money.CreateOnlineTransaction("Hylanders Cleaning Service", 0f - amount, 1f, note); message = string.Empty; return true; } private static bool CanManage(out string message) { if (SIAKImperiumMod.Service == null || !SIAKImperiumMod.Service.IsLocalLobbyHost()) { message = "Only the organisation host can manage town cleaning services."; return false; } message = string.Empty; return true; } private static int CurrentGameDay() { try { return Math.Max(0, TimeManager.ElapsedDays); } catch { return 0; } } private static ImperiumHylandersProfile CurrentProfile() { EnsureLoaded(); string text = (SIAKImperiumMod.Service?.GetSnapshot())?.SteamId?.Trim() ?? string.Empty; if (text.Length == 0 || string.Equals(text, "Unavailable", (StringComparison)5)) { text = "device"; } string text2 = SIAKImperiumMod.Service?.GetCurrentSaveIdentifier()?.Trim() ?? string.Empty; if (text2.Length == 0) { text2 = SIAKImperiumMod.ImperiumSessionSaveIdentifier?.Value?.Trim() ?? "unspecified-save"; } string text3 = text + "|" + text2; ImperiumHylandersProfile imperiumHylandersProfile = default(ImperiumHylandersProfile); if (!_database.Profiles.TryGetValue(text3, ref imperiumHylandersProfile)) { imperiumHylandersProfile = new ImperiumHylandersProfile { ProfileKey = text3 }; _database.Profiles[text3] = imperiumHylandersProfile; } imperiumHylandersProfile.ProfileKey = text3; return imperiumHylandersProfile; } private static void EnsureLoaded() { if (_database == null) { try { _database = JsonConvert.DeserializeObject(SIAKImperiumMod.LocalHylandersState?.Value ?? string.Empty); } catch { _database = null; } if (_database == null) { _database = new ImperiumHylandersDatabase(); } ImperiumHylandersDatabase database = _database; if (database.Profiles == null) { Dictionary val = (database.Profiles = new Dictionary((IEqualityComparer)(object)StringComparer.OrdinalIgnoreCase)); } } } private static void SaveChanged() { if (_database != null && SIAKImperiumMod.LocalHylandersState != null) { SIAKImperiumMod.LocalHylandersState.Value = JsonConvert.SerializeObject((object)_database); SIAKImperiumMod.ConfigCategory.SaveToFile(false); _stateVersion++; } } } internal sealed class ImperiumHylandersController : MonoBehaviour { private ImperiumHtmlDocument? _document; private GameObject? _root; private string _tab = "news"; private string _notice = string.Empty; private int _lastRuntimeVersion = -1; private int _lastServiceVersion = -1; public ImperiumHylandersController(System.IntPtr pointer) : base(pointer) { } public bool Initialize(GameObject root) { _root = root; Canvas.ForceUpdateCanvases(); bool result = Render(); _document?.RefreshLayout(); return result; } public void OnEnable() { Canvas.ForceUpdateCanvases(); RefreshNow(); ImperiumHtmlDocument? document = _document; if (document != null && document.RefreshViewport()) { _document.RefreshLayout(); } else { _document?.RefreshLayout(); } } public void Update() { if (!((Object)(object)_root == (Object)null)) { if (_document != null && _document.RefreshViewport()) { _document.RefreshLayout(); } if (_lastRuntimeVersion != ImperiumHylandersRuntime.StateVersion || _lastServiceVersion != (SIAKImperiumMod.Service?.StateVersion ?? (-1))) { Render(); } } } internal void RefreshNow() { if ((Object)(object)_root != (Object)null) { Render(); } } [HideFromIl2Cpp] private bool Render() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown if ((Object)(object)_root == (Object)null) { return false; } Dictionary actions = new Dictionary((IEqualityComparer)(object)StringComparer.Ordinal) { ["hylanders.news"] = (Action)([CompilerGenerated] () => { _tab = "news"; _notice = string.Empty; Render(); }), ["hylanders.services"] = (Action)([CompilerGenerated] () => { _tab = "services"; _notice = string.Empty; Render(); }), ["hylanders.clean.once"] = (Action)([CompilerGenerated] () => { ImperiumHylandersRuntime.PurchaseSingleCleaning(out _notice); Render(); }), ["hylanders.subscribe"] = (Action)([CompilerGenerated] () => { ImperiumHylandersRuntime.StartOrResumeSubscription(out _notice); Render(); }), ["hylanders.cancel"] = (Action)([CompilerGenerated] () => { ImperiumHylandersRuntime.CancelSubscription(out _notice); Render(); }) }; string text = (string.Equals(_tab, "services", (StringComparison)4) ? BuildServices() : BuildNews()); string html = ImperiumAssets.LoadEmbeddedText("interface/hylanders/index.html").Replace("{{CONTENT}}", text, (StringComparison)4); string css = ImperiumAssets.LoadEmbeddedText("interface/hylanders/styles.css"); string script = ImperiumAssets.LoadEmbeddedText("interface/hylanders/app.js"); _document?.Dispose(); _document = ImperiumWebUiRuntime.TryRender(_root.transform, html, css, script, (IReadOnlyDictionary?)(object)actions, out string error, ImperiumInterfaceSurface.Landscape); if (_document == null) { Instance? modLogger = SIAKImperiumMod.ModLogger; if (modLogger != null) { modLogger.Warning("[Imperium UI] Hylanders render failed: " + error); } return false; } _document.RefreshLayout(); _lastRuntimeVersion = ImperiumHylandersRuntime.StateVersion; _lastServiceVersion = SIAKImperiumMod.Service?.StateVersion ?? (-1); return true; } [HideFromIl2Cpp] private string BuildNews() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown List val = SIAKImperiumMod.Service?.GetSnapshot().Hylanders.News ?? new List(); StringBuilder val2 = new StringBuilder(); int num = 0; System.Collections.Generic.IEnumerator enumerator = Enumerable.Take((System.Collections.Generic.IEnumerable)Enumerable.OrderBy((System.Collections.Generic.IEnumerable)val, (Func)((ImperiumHylandersNewsItem item) => item.SortOrder)), 12).GetEnumerator(); try { while (((System.Collections.IEnumerator)enumerator).MoveNext()) { ImperiumHylandersNewsItem current = enumerator.Current; if (!string.IsNullOrWhiteSpace(current.Title) && !string.IsNullOrWhiteSpace(current.Body)) { val2.Append("

").Append(E(string.IsNullOrWhiteSpace(current.Category) ? "HYLAND POINT DAILY" : current.Category)).Append("

") .Append(E(current.Title)) .Append("

") .Append(E(current.Body)) .Append("

"); num++; } } } finally { ((System.IDisposable)enumerator)?.Dispose(); } if (num == 0) { val2.Append("

HYLAND POINT DAILY

No active bulletins

Hylanders has no public notices scheduled at this time.

"); num = 1; } int num2 = Math.Max(1, (num + 2) / 3); int num3 = num2 * 270 + Math.Max(0, num2 - 1) * 14; return Navigation("news") + "

HYLAND POINT DAILY

News from across Hyland Point.

Local coverage, municipal notices, and discreet intelligence published by Hylanders.

" + $"
{val2}
"; } [HideFromIl2Cpp] private string BuildServices() { ImperiumHylandersView view = ImperiumHylandersRuntime.GetView(); string text = (view.SubscriptionRenewalEnabled ? "active" : "inactive"); string text2 = (view.SubscriptionRenewalEnabled ? "Renewal active" : "Renewal disabled"); string value = ((view.LastCleanedGameDay < 0) ? "No completed visit yet" : $"Last cleaned on game day {view.LastCleanedGameDay}"); string text3 = (string.IsNullOrWhiteSpace(_notice) ? string.Empty : ("

" + E(_notice) + "

")); return string.Concat(new string[18] { Navigation("services"), "

RESIDENT SERVICES

Cleaning Services

All visits execute after the organisation host wakes from sleep. Every purchase is charged to the organisation bank.

", text3, "
", $"

${4000f:N0}

", "

ONE-TIME SERVICE

Call in Cleaning Service

Remove accumulated trash across Hyland Point after your next sleep.

", $"

Queued visits: {view.PendingSingleCleanings}

", "
", $"

${10000f:N0}

", "

CLEANING SUBSCRIPTION

Six-Day Coverage

", $"

Includes {6} prepaid cleaning days. Afterwards, renewal costs ${1500f:N0} per cleaning day.

", $"

{text2}

", $"

{view.IncludedCleaningsRemaining} prepaid day(s) remaining

", "

", E(value), "

", E(view.LastStatus), "

" }); } [HideFromIl2Cpp] private static string Navigation(string active) { string text = (string.Equals(active, "news", (StringComparison)4) ? "active" : string.Empty); string text2 = (string.Equals(active, "services", (StringComparison)4) ? "active" : string.Empty); return string.Concat(new string[5] { "" }); } private static string E(string? value) { return SecurityElement.Escape(value ?? string.Empty) ?? string.Empty; } } internal sealed class ImperiumHylandersDatabase { [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public Dictionary Profiles { [CompilerGenerated] get; [CompilerGenerated] set; } = new Dictionary((IEqualityComparer)(object)StringComparer.OrdinalIgnoreCase); } internal sealed class ImperiumHylandersProfile { [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ProfileKey { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int PendingSingleCleanings { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int IncludedCleaningsRemaining { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool SubscriptionRenewalEnabled { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int LastProcessedWakeGameDay { [CompilerGenerated] get; [CompilerGenerated] set; } = -1; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int LastCleanedGameDay { [CompilerGenerated] get; [CompilerGenerated] set; } = -1; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string LastStatus { [CompilerGenerated] get; [CompilerGenerated] set; } = "No cleaning services have been booked."; } internal sealed class ImperiumHylandersView { [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int PendingSingleCleanings { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int IncludedCleaningsRemaining { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool SubscriptionRenewalEnabled { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int LastCleanedGameDay { [CompilerGenerated] get; [CompilerGenerated] set; } = -1; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string LastStatus { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; } internal sealed class ImperiumInterfaceTemplates { private readonly Dictionary _templates = new Dictionary((IEqualityComparer)(object)StringComparer.OrdinalIgnoreCase); internal ImperiumInterfaceTemplates(string source) { //IL_0027: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrWhiteSpace(source)) { throw new InvalidOperationException("The Imperium interface template source is empty."); } XDocument val = XDocument.Parse(source, (LoadOptions)1); System.Collections.Generic.IEnumerator enumerator = Enumerable.Where(((XContainer)val).Descendants(), (Func)((XElement node) => string.Equals(node.Name.LocalName, "template", (StringComparison)5))).GetEnumerator(); try { while (((System.Collections.IEnumerator)enumerator).MoveNext()) { XElement current = enumerator.Current; XAttribute obj = current.Attribute(XName.op_Implicit("id")); string text = ((obj == null) ? null : obj.Value?.Trim()) ?? string.Empty; if (string.IsNullOrWhiteSpace(text)) { throw new InvalidOperationException("Every Imperium interface template must have an id."); } if (_templates.ContainsKey(text)) { throw new InvalidOperationException("Duplicate Imperium interface template '" + text + "'."); } _templates[text] = string.Concat(Enumerable.Select(((XContainer)current).Nodes(), (Func)((XNode node) => node.ToString((SaveOptions)1)))); } } finally { ((System.IDisposable)enumerator)?.Dispose(); } if (_templates.Count == 0) { throw new InvalidOperationException("The Imperium interface does not contain any named templates."); } } internal string Render(string id, params string[] replacements) { //IL_0026: 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) string text = default(string); if (!_templates.TryGetValue(id, ref text)) { throw new InvalidOperationException("Imperium interface template '" + id + "' was not found."); } if (replacements.Length % 2 != 0) { throw new ArgumentException("Template replacements must be supplied as token/value pairs.", "replacements"); } for (int i = 0; i < replacements.Length; i += 2) { string text2 = replacements[i]?.Trim() ?? string.Empty; if (!string.IsNullOrWhiteSpace(text2)) { text = text.Replace("{{" + text2 + "}}", replacements[i + 1] ?? string.Empty, (StringComparison)4); } } return text; } } internal static class ImperiumLowHealthDisorientation { internal const float TriggerHealthFraction = 0.35f; internal const float RecoveryHoldSeconds = 30f; private const float HealthReadIntervalSeconds = 0.2f; private const float ErrorLogCooldownSeconds = 10f; private static readonly string[] DisorientingTypeNames = new string[5] { "Il2CppScheduleOne.Properties.Disorienting", "Il2CppScheduleOne.Effects.Disorienting", "Il2CppScheduleOne.Product.Disorienting", "ScheduleOne.Properties.Disorienting", "ScheduleOne.Effects.Disorienting" }; private static object? _disorienting; private static MethodInfo? _applyToPlayer; private static MethodInfo? _clearFromPlayer; private static Player? _affectedPlayer; private static int _affectedPlayerInstanceId; private static bool _initialized; private static bool _worldActive; private static bool _effectApplied; private static bool _effectApiResolved; private static bool _effectApiUnavailableLogged; private static float _recoveryStartedAt = -1f; private static float _nextHealthReadAt; private static float _nextErrorLogAt; private static Instance? _logger; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] internal static float MaximumHealth { [CompilerGenerated] get; [CompilerGenerated] set; } = 100f; internal static bool HasPendingWork => _initialized && _worldActive; internal static void Patch(Harmony harmony, Instance logger) { _logger = logger; _initialized = true; MaximumHealth = Mathf.Max(1f, MaximumHealth); ResolveEffectApi(); logger.Msg("[Imperium] Successfully loaded: P-LowHD 5hz"); } internal static void NotifyWorldReady() { if (_initialized) { _worldActive = true; _nextHealthReadAt = 0f; EvaluateNow(); } } internal static void Update() { if (!HasPendingWork) { return; } float unscaledTime = Time.unscaledTime; if (unscaledTime < _nextHealthReadAt) { return; } _nextHealthReadAt = unscaledTime + 0.2f; try { EvaluateNow(); } catch (System.Exception exception) { WarnOccasionally("Low-health Disorienting check failed: " + Unwrap(exception).Message); } } internal static void Reset() { _worldActive = false; _nextHealthReadAt = 0f; _recoveryStartedAt = -1f; _nextErrorLogAt = 0f; ClearEffect(); } internal static void Dispose() { Reset(); _initialized = false; } private static void EvaluateNow() { Player local = Player.Local; if ((Object)(object)local == (Object)null || (Object)(object)local.Health == (Object)null) { ClearEffect(); return; } int instanceID = ((Object)local).GetInstanceID(); if (_effectApplied && instanceID != _affectedPlayerInstanceId) { ClearEffect(); } float currentHealth = local.Health.CurrentHealth; if (float.IsNaN(currentHealth) || float.IsInfinity(currentHealth) || currentHealth <= 0f) { ClearEffect(); return; } float num = ReadMaximumHealth(local.Health); float num2 = currentHealth / Mathf.Max(1f, num); if (num2 < 0.35f) { _recoveryStartedAt = -1f; EnsureEffectApplied(local, instanceID); } else if (!_effectApplied) { _recoveryStartedAt = -1f; } else if (_recoveryStartedAt < 0f) { _recoveryStartedAt = Time.time; } else if (Time.time - _recoveryStartedAt >= 30f) { ClearEffect(); } } private static float ReadMaximumHealth(object health) { try { object obj = ReadInstanceMember(health, "MaximumHealth", "MaxHealth", "maxHealth", "HealthMax", "StartingHealth"); if (obj != null) { float num = Convert.ToSingle(obj); if (!float.IsNaN(num) && !float.IsInfinity(num) && num > 0.01f) { return num; } } } catch { } return Mathf.Max(1f, MaximumHealth); } private static void EnsureEffectApplied(Player player, int playerInstanceId) { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) if (_effectApplied && playerInstanceId == _affectedPlayerInstanceId) { return; } ClearEffect(); if (!ResolveEffectApi()) { if (!_effectApiUnavailableLogged) { _effectApiUnavailableLogged = true; Instance? logger = _logger; if (logger != null) { logger.Warning("[Imperium] The built-in Disorienting property could not be resolved."); } } return; } System.Type declaringType = ((MemberInfo)_applyToPlayer).DeclaringType; if (declaringType == (System.Type)null) { throw new InvalidOperationException("Disorienting.ApplyToPlayer has no declaring type."); } _disorienting = Activator.CreateInstance(declaringType); if (_disorienting == null) { throw new InvalidOperationException("Could not create " + declaringType.FullName + "."); } ((MethodBase)_applyToPlayer).Invoke(_disorienting, new object[1] { player }); _affectedPlayer = player; _affectedPlayerInstanceId = playerInstanceId; _effectApplied = true; _recoveryStartedAt = -1f; } private static void ClearEffect() { if (_effectApplied && _disorienting != null && _clearFromPlayer != (MethodInfo)null && (Object)(object)_affectedPlayer != (Object)null) { try { ((MethodBase)_clearFromPlayer).Invoke(_disorienting, new object[1] { _affectedPlayer }); } catch (System.Exception exception) { WarnOccasionally("Could not clear low-health Disorienting: " + Unwrap(exception).Message); } } _disorienting = null; _affectedPlayer = null; _affectedPlayerInstanceId = 0; _effectApplied = false; _recoveryStartedAt = -1f; } private static bool ResolveEffectApi() { if (_effectApiResolved) { return _applyToPlayer != (MethodInfo)null && _clearFromPlayer != (MethodInfo)null; } _effectApiResolved = true; System.Type type = FindLoadedType(DisorientingTypeNames) ?? FindTypeByExactName("Disorienting"); if (type == (System.Type)null) { return false; } MethodInfo[] methods = type.GetMethods((BindingFlags)116); _applyToPlayer = FindPlayerMethod(methods, "ApplyToPlayer"); _clearFromPlayer = FindPlayerMethod(methods, "ClearFromPlayer"); if (_applyToPlayer == (MethodInfo)null || _clearFromPlayer == (MethodInfo)null) { _applyToPlayer = null; _clearFromPlayer = null; return false; } Instance? logger = _logger; if (logger != null) { logger.Msg("[Imperium] Successfully loaded: P-LHD"); } return true; } private static System.Type? FindLoadedType(System.Collections.Generic.IEnumerable fullNames) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); System.Collections.Generic.IEnumerator enumerator = fullNames.GetEnumerator(); try { while (((System.Collections.IEnumerator)enumerator).MoveNext()) { string current = enumerator.Current; Assembly[] array = assemblies; foreach (Assembly val in array) { try { System.Type type = val.GetType(current, false, false); if (type != (System.Type)null) { return type; } } catch { } } } } finally { ((System.IDisposable)enumerator)?.Dispose(); } return null; } private static System.Type? FindTypeByExactName(string typeName) { //IL_00b6: Expected O, but got Unknown Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly val in assemblies) { string text = val.GetName().Name ?? string.Empty; if (!text.Contains("ScheduleOne", (StringComparison)5) && !text.Equals("Assembly-CSharp", (StringComparison)5)) { continue; } try { System.Type type = Enumerable.FirstOrDefault((System.Collections.Generic.IEnumerable)val.GetTypes(), (Func)((System.Type candidate) => string.Equals(((MemberInfo)candidate).Name, typeName, (StringComparison)4) && candidate.IsClass)); if (type != (System.Type)null) { return type; } } catch (ReflectionTypeLoadException ex) { ReflectionTypeLoadException ex2 = ex; System.Type type2 = Enumerable.FirstOrDefault(Enumerable.Where((System.Collections.Generic.IEnumerable)ex2.Types, (Func)((System.Type candidate) => candidate != (System.Type)null)), (Func)((System.Type candidate) => string.Equals(((MemberInfo)candidate).Name, typeName, (StringComparison)4) && candidate.IsClass)); if (type2 != (System.Type)null) { return type2; } } catch { } } return null; } private static MethodInfo? FindPlayerMethod(System.Collections.Generic.IEnumerable methods, string methodName) { MethodInfo[] array = Enumerable.ToArray(Enumerable.Where(methods, (Func)((MethodInfo method) => string.Equals(((MemberInfo)method).Name, methodName, (StringComparison)4) && ((MethodBase)method).GetParameters().Length == 1))); MethodInfo[] array2 = array; foreach (MethodInfo val in array2) { System.Type parameterType = ((MethodBase)val).GetParameters()[0].ParameterType; if (parameterType.IsAssignableFrom(typeof(Player)) || typeof(Player).IsAssignableFrom(parameterType)) { return val; } } return Enumerable.FirstOrDefault((System.Collections.Generic.IEnumerable)array); } private static object? ReadInstanceMember(object source, params string[] names) { System.Type type = source.GetType(); foreach (string text in names) { try { PropertyInfo property = type.GetProperty(text, (BindingFlags)116); if (property != (PropertyInfo)null && property.GetIndexParameters().Length == 0) { return property.GetValue(source); } FieldInfo field = type.GetField(text, (BindingFlags)116); if (field != (FieldInfo)null) { return field.GetValue(source); } } catch { } } return null; } private static void WarnOccasionally(string message) { float unscaledTime = Time.unscaledTime; if (!(unscaledTime < _nextErrorLogAt)) { _nextErrorLogAt = unscaledTime + 10f; Instance? logger = _logger; if (logger != null) { logger.Warning("[Imperium] " + message); } } } private static System.Exception Unwrap(System.Exception exception) { while (true) { TargetInvocationException ex = (TargetInvocationException)(object)((exception is TargetInvocationException) ? exception : null); if (ex == null || exception.InnerException == null) { break; } exception = ((System.Exception)(object)ex).InnerException; } return exception; } } internal sealed class ImperiumPlayerPayload { [JsonProperty("steam_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SteamId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("steam_username")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SteamUsername { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("player_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string PlayerName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("player_code")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string PlayerCode { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("organisation_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string OrganisationName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("game_organisation_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string GameOrganisationName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("bank_balance")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float BankBalance { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("cash_balance")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float CashBalance { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("net_worth")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float NetWorth { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("operation_desk")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumOperationDesk OperationDesk { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumOperationDesk(); [JsonProperty("product_catalog")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List ProductCatalog { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [JsonProperty("session_players")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List SessionPlayers { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [JsonProperty("economy_events")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List EconomyEvents { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [JsonProperty("progression")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumProgression Progression { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumProgression(); [JsonProperty("progression_events")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List ProgressionEvents { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [JsonProperty("police_status")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumPoliceStatus PoliceStatus { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumPoliceStatus(); [JsonProperty("game_version")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string GameVersion { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("mod_version")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ModVersion { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("client_time_utc")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ClientTimeUtc { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("save_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SaveId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("game_day")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int GameDay { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("world_progress")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumWorldProgress WorldProgress { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumWorldProgress(); } internal sealed class ImperiumWorldProgress { [JsonProperty("unlocked_properties")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List UnlockedProperties { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [JsonProperty("owned_businesses")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List OwnedBusinesses { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [JsonProperty("dealer_count")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int DealerCount { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("dealer_lifetime_earnings")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float DealerLifetimeEarnings { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("world_game_day")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int WorldGameDay { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("world_game_time")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string WorldGameTime { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("world_game_minutes")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int WorldGameMinutes { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("observed_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ObservedAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; } internal sealed class ImperiumEconomyEvent { [JsonProperty("id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Id { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("source")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Source { [CompilerGenerated] get; [CompilerGenerated] set; } = "game_console"; [JsonProperty("command")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Command { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("currency")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Currency { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("amount")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int Amount { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("created_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string CreatedAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; } internal sealed class ImperiumPoliceResponseSettings { [JsonProperty("enabled")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Enabled { [CompilerGenerated] get; [CompilerGenerated] set; } = true; [JsonProperty("fines_enabled")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool FinesEnabled { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("capability")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Capability { [CompilerGenerated] get; [CompilerGenerated] set; } = "s1api_arrest_crime_fines"; [JsonProperty("controlled_substance_fine")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float ControlledSubstanceFine { [CompilerGenerated] get; [CompilerGenerated] set; } = 100f; [JsonProperty("low_severity_drug_fine")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float LowSeverityDrugFine { [CompilerGenerated] get; [CompilerGenerated] set; } = 100f; [JsonProperty("moderate_severity_drug_fine")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float ModerateSeverityDrugFine { [CompilerGenerated] get; [CompilerGenerated] set; } = 250f; [JsonProperty("high_severity_drug_fine")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float HighSeverityDrugFine { [CompilerGenerated] get; [CompilerGenerated] set; } = 750f; [JsonProperty("failure_to_comply_fine")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float FailureToComplyFine { [CompilerGenerated] get; [CompilerGenerated] set; } = 250f; [JsonProperty("evading_fine")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float EvadingFine { [CompilerGenerated] get; [CompilerGenerated] set; } = 500f; [JsonProperty("violating_curfew_fine")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float ViolatingCurfewFine { [CompilerGenerated] get; [CompilerGenerated] set; } = 100f; [JsonProperty("attempting_to_sell_fine")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float AttemptingToSellFine { [CompilerGenerated] get; [CompilerGenerated] set; } = 250f; [JsonProperty("assault_fine")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float AssaultFine { [CompilerGenerated] get; [CompilerGenerated] set; } = 750f; [JsonProperty("deadly_assault_fine")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float DeadlyAssaultFine { [CompilerGenerated] get; [CompilerGenerated] set; } = 2000f; [JsonProperty("vandalism_fine")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float VandalismFine { [CompilerGenerated] get; [CompilerGenerated] set; } = 250f; [JsonProperty("theft_fine")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float TheftFine { [CompilerGenerated] get; [CompilerGenerated] set; } = 250f; [JsonProperty("brandishing_weapon_fine")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float BrandishingWeaponFine { [CompilerGenerated] get; [CompilerGenerated] set; } = 750f; [JsonProperty("discharge_firearm_fine")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float DischargeFirearmFine { [CompilerGenerated] get; [CompilerGenerated] set; } = 750f; [JsonProperty("drug_trafficking_fine")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float DrugTraffickingFine { [CompilerGenerated] get; [CompilerGenerated] set; } = 750f; [JsonProperty("transporting_illicit_items_fine")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float TransportingIllicitItemsFine { [CompilerGenerated] get; [CompilerGenerated] set; } = 250f; [JsonProperty("vehicular_assault_fine")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float VehicularAssaultFine { [CompilerGenerated] get; [CompilerGenerated] set; } = 2000f; [JsonProperty("updated_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string UpdatedAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; } internal sealed class ImperiumPoliceStatus { [JsonProperty("available")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Available { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("is_arrested")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool IsArrested { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("pursuit_level")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string PursuitLevel { [CompilerGenerated] get; [CompilerGenerated] set; } = "None"; [JsonProperty("body_search_pending")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool BodySearchPending { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("evaded_arrest")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool EvadedArrest { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("time_since_sighted_seconds")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int TimeSinceSightedSeconds { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("search_time_seconds")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int SearchTimeSeconds { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("active_officer_count")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int ActiveOfficerCount { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("observed_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ObservedAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; } internal sealed class ImperiumProgression { [JsonProperty("total_xp")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int TotalXp { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("current_xp")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int CurrentXp { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("xp_to_next_tier")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float XpToNextTier { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("rank")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Rank { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("tier")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int Tier { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("rank_label")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string RankLabel { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("rank_index")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int RankIndex { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("overall_level")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int OverallLevel { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("observed_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ObservedAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; } internal sealed class ImperiumProgressionEvent { [JsonProperty("id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Id { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("source")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Source { [CompilerGenerated] get; [CompilerGenerated] set; } = "game_console"; [JsonProperty("command")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Command { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("amount")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int Amount { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("created_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string CreatedAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; } internal sealed class ImperiumDeviceAuthorizationStartResponse { [JsonProperty("success")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Success { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("message")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Message { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("device_code")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string DeviceCode { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("verification_uri_complete")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string VerificationUriComplete { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("expires_in")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int ExpiresIn { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("interval")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int IntervalSeconds { [CompilerGenerated] get; [CompilerGenerated] set; } = 4; } internal sealed class ImperiumDeviceAuthorizationPollResponse { [JsonProperty("success")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Success { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("pending")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Pending { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("message")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Message { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("session_token")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SessionToken { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("expires_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ExpiresAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("steam_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SteamId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; } internal sealed class ImperiumLogoutResponse { [JsonProperty("success")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Success { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("message")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Message { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; } internal sealed class ImperiumProductCatalogItem { [JsonProperty("drug")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Drug { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("item_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ItemId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("item_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ItemName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; } internal sealed class ImperiumMembership { [JsonProperty("active")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Active { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("frozen")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Frozen { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("loyalty_frozen")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool LoyaltyFrozen { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("expires_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ExpiresAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("expires_game_day")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int ExpiresGameDay { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("total_pledged_amount")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float TotalPledgedAmount { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("last_pledge_amount")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float LastPledgeAmount { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("pledge_count")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int PledgeCount { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("last_pledged_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string LastPledgedAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("frozen_reason")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string FrozenReason { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("frozen_by")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string FrozenBy { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("auto_renew")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool AutoRenew { [CompilerGenerated] get; [CompilerGenerated] set; } } internal sealed class ImperiumAntivirusWantedEffect { [JsonProperty("id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Id { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("issued_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string IssuedAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("expires_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ExpiresAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("pursuit_level")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string PursuitLevel { [CompilerGenerated] get; [CompilerGenerated] set; } = "arresting"; [JsonProperty("source_steam_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SourceSteamId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; } internal sealed class ImperiumAntivirusEvent { [JsonProperty("id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Id { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("type")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Type { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("template_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string TemplateName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("expires_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ExpiresAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; } internal sealed class ImperiumAntivirusSettings { [JsonProperty("scan_seconds")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int ScanSeconds { [CompilerGenerated] get; [CompilerGenerated] set; } = 20; [JsonProperty("basic_timeout_multiplier")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float BasicTimeoutMultiplier { [CompilerGenerated] get; [CompilerGenerated] set; } = 2f; [JsonProperty("premium_sleep_reduction_percent")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int PremiumSleepReductionPercent { [CompilerGenerated] get; [CompilerGenerated] set; } = 10; [JsonProperty("full_clean_cost")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int FullCleanCost { [CompilerGenerated] get; [CompilerGenerated] set; } = 3000; [JsonProperty("full_clean_seconds")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int FullCleanSeconds { [CompilerGenerated] get; [CompilerGenerated] set; } = 240; } internal sealed class ImperiumAntivirusStatus { [JsonProperty("enabled")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Enabled { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("available")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Available { [CompilerGenerated] get; [CompilerGenerated] set; } = true; [JsonProperty("virus_enabled")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool VirusEnabled { [CompilerGenerated] get; [CompilerGenerated] set; } = true; [JsonProperty("organisation_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string OrganisationName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("download_seconds")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int DownloadSeconds { [CompilerGenerated] get; [CompilerGenerated] set; } = 300; [JsonProperty("installing")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Installing { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("install_started_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string InstallStartedAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("install_complete_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string InstallCompleteAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("installed")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Installed { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("installed_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string InstalledAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("subscription_tier")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SubscriptionTier { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("subscription_active")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool SubscriptionActive { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("subscription_cancelled")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool SubscriptionCancelled { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("subscription_ends_game_day")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int SubscriptionEndsGameDay { [CompilerGenerated] get; [CompilerGenerated] set; } = -1; [JsonProperty("basic_daily_cost")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int BasicDailyCost { [CompilerGenerated] get; [CompilerGenerated] set; } = 100; [JsonProperty("premium_daily_cost")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int PremiumDailyCost { [CompilerGenerated] get; [CompilerGenerated] set; } = 1000; [JsonProperty("scan_in_progress")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool ScanInProgress { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("scan_started_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ScanStartedAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("scan_complete_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ScanCompleteAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("last_scan_completed_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string LastScanCompletedAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("clean_in_progress")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool CleanInProgress { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("clean_started_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string CleanStartedAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("clean_complete_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string CleanCompleteAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("scan_results_available")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool ScanResultsAvailable { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("malware_percent")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float MalwarePercent { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("spyware_percent")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float SpywarePercent { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("ransomware_percent")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float RansomwarePercent { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("ransomware_locked")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool RansomwareLocked { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("spyware_extortion_active")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool SpywareExtortionActive { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("ransomware_extortion_active")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool RansomwareExtortionActive { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("next_spyware_report_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string NextSpywareReportAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("next_ransomware_follow_up_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string NextRansomwareFollowUpAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("active_events")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List ActiveEvents { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [JsonProperty("wanted_effects")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List WantedEffects { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [JsonProperty("settings")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumAntivirusSettings Settings { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumAntivirusSettings(); } internal sealed class ImperiumAntivirusActionResponse { [JsonProperty("success")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Success { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("message")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Message { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("antivirus")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumAntivirusStatus Antivirus { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumAntivirusStatus(); [JsonProperty("pending_actions")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List PendingActions { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); } internal sealed class ImperiumNotepadStatus { [JsonProperty("enabled")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Enabled { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("available")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Available { [CompilerGenerated] get; [CompilerGenerated] set; } = true; [JsonProperty("download_seconds")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int DownloadSeconds { [CompilerGenerated] get; [CompilerGenerated] set; } = 30; [JsonProperty("installing")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Installing { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("install_started_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string InstallStartedAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("install_complete_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string InstallCompleteAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("installed")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Installed { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("installed_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string InstalledAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; } internal sealed class ImperiumNotepadActionResponse { [JsonProperty("success")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Success { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("message")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Message { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("notepad")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumNotepadStatus Notepad { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumNotepadStatus(); } internal sealed class ImperiumAppStoreSettings { [JsonProperty("download_seconds")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int DownloadSeconds { [CompilerGenerated] get; [CompilerGenerated] set; } = 30; } internal sealed class ImperiumBusinessManagerSettings { [JsonProperty("active")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Enabled { [CompilerGenerated] get; [CompilerGenerated] set; } = true; [JsonProperty("available")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Available { [CompilerGenerated] get; [CompilerGenerated] set; } = true; [JsonProperty("download_seconds")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int DownloadSeconds { [CompilerGenerated] get; [CompilerGenerated] set; } = 30; } internal sealed class ImperiumMusicSettings { [JsonProperty("active")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Enabled { [CompilerGenerated] get; [CompilerGenerated] set; } = true; [JsonProperty("available")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Available { [CompilerGenerated] get; [CompilerGenerated] set; } = true; [JsonProperty("download_seconds")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int DownloadSeconds { [CompilerGenerated] get; [CompilerGenerated] set; } = 30; } internal sealed class ImperiumHylandersContent { [JsonProperty("news")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List News { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [JsonProperty("updated_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string UpdatedAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; } internal sealed class ImperiumHylandersNewsItem { [JsonProperty("id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Id { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("category")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Category { [CompilerGenerated] get; [CompilerGenerated] set; } = "HYLAND POINT DAILY"; [JsonProperty("title")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Title { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("body")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Body { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("sort_order")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int SortOrder { [CompilerGenerated] get; [CompilerGenerated] set; } } internal sealed class ImperiumPledgeRequest { [JsonProperty("action")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Action { [CompilerGenerated] get; [CompilerGenerated] set; } = "subscribe"; [JsonProperty("steam_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SteamId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("game_day")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int GameDay { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("session_players")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List SessionPlayers { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); } internal sealed class ImperiumPledgeResponse { [JsonProperty("success")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Success { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("message")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Message { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("membership")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumMembership Membership { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumMembership(); [JsonProperty("pledge_cost")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int PledgeCost { [CompilerGenerated] get; [CompilerGenerated] set; } = 10000; [JsonProperty("network_access")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumNetworkAccess NetworkAccess { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumNetworkAccess(); } internal sealed class ImperiumLeaderboardEntry { [JsonProperty("steam_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SteamId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("steam_username")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SteamUsername { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("player_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string PlayerName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("player_code")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string PlayerCode { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("organisation_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string OrganisationName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("bank_balance")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float BankBalance { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("cash_balance")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float CashBalance { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("net_worth")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float NetWorth { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("operation_desk")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumOperationDesk OperationDesk { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumOperationDesk(); [JsonProperty("updated_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string UpdatedAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("isOnline")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool IsOnline { [CompilerGenerated] get; [CompilerGenerated] set; } } internal sealed class ImperiumNetworkSummary { [JsonProperty("tracked_players")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int TrackedPlayers { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("online_players")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int OnlinePlayers { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("offline_players")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int OfflinePlayers { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("total_bank_balance")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float TotalBankBalance { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("total_cash_balance")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float TotalCashBalance { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("total_net_worth")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float TotalNetWorth { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("top_bank_balance")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float TopBankBalance { [CompilerGenerated] get; [CompilerGenerated] set; } } internal sealed class ImperiumLivePlayer { [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string PlayerName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string PlayerCode { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool IsLocal { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool IsHost { [CompilerGenerated] get; [CompilerGenerated] set; } } internal sealed class ImperiumSessionPlayer { [JsonProperty("steam_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SteamId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("player_code")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string PlayerCode { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("player_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string PlayerName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("is_local")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool IsLocal { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("is_host")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool IsHost { [CompilerGenerated] get; [CompilerGenerated] set; } } internal sealed class ImperiumProductEffect { [JsonProperty("id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Id { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Name { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; } internal sealed class ImperiumMessage { [JsonProperty("id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Id { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("scope")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Scope { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("title")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Title { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("body")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Body { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("icon_key")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string IconKey { [CompilerGenerated] get; [CompilerGenerated] set; } = "siak"; [JsonProperty("sender_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SenderName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("contact_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ContactId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("conversation_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ConversationId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("created_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string CreatedAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("choices")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List Choices { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [JsonProperty("response")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumMessageChoiceResponse? Response { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("read")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Read { [CompilerGenerated] get; [CompilerGenerated] set; } } internal sealed class ImperiumMessageChoice { [JsonProperty("id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Id { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("text")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Text { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; } internal sealed class ImperiumMessageChoiceResponse { [JsonProperty("choice_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ChoiceId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("choice_text")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ChoiceText { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("answered_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string AnsweredAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; } internal sealed class ImperiumMessageChoiceRequest { [JsonProperty("message_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string MessageId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("choice_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ChoiceId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("session_players")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List SessionPlayers { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); } internal sealed class ImperiumMessageChoiceSubmissionResponse { [JsonProperty("success")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Success { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("message")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Message { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("response")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumMessageChoiceResponse Response { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumMessageChoiceResponse(); [JsonProperty("follow_up_message")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumMessage? FollowUpMessage { [CompilerGenerated] get; [CompilerGenerated] set; } } internal sealed class ImperiumPendingDeskMutation { [JsonProperty("mode")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Mode { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("item_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ItemId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("item_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ItemName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("tier")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Tier { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("package_type")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string PackageType { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("effects")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List Effects { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [JsonProperty("quantity")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int Quantity { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("cash_amount")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float CashAmount { [CompilerGenerated] get; [CompilerGenerated] set; } } internal sealed class ImperiumPendingAction { [JsonProperty("id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Id { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("type")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Type { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("listing_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ListingId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("title")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Title { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("message")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Message { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("bank_delta")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float BankDelta { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("cash_delta")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float CashDelta { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("desk_mutations")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List DeskMutations { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [JsonProperty("created_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string CreatedAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; } internal sealed class ImperiumReadRequest { [JsonProperty("steam_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SteamId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("message_ids")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List MessageIds { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); } internal sealed class ImperiumDeskInventoryItem { [JsonProperty("item_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ItemId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("item_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ItemName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("drug")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Drug { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("quantity")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int Quantity { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("stack_count")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int StackCount { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("tier")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Tier { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("package_type")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string PackageType { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("effects")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List Effects { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); } internal sealed class ImperiumOperationDesk { [JsonProperty("enabled")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Enabled { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("display_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string DisplayName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("locker_type")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string LockerType { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("location_hint")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string LocationHint { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("status")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Status { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("item_count")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int ItemCount { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("unique_item_count")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int UniqueItemCount { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("cash_stored")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float CashStored { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("last_scanned_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string LastScannedAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("last_synced_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string LastSyncedAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("cooldown_until_utc")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string CooldownUntilUtc { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("inventory")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List Inventory { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [JsonIgnore] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool IsOpen { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonIgnore] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Fingerprint { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; } internal sealed class ImperiumMarketSettings { [JsonProperty("stock_cap_per_listing")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int StockCapPerListing { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("notes")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Notes { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("updated_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string UpdatedAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("max_active_sell_per_organisation")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int MaxActiveSellPerOrganisation { [CompilerGenerated] get; [CompilerGenerated] set; } = 1; [JsonProperty("max_active_request_per_organisation")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int MaxActiveRequestPerOrganisation { [CompilerGenerated] get; [CompilerGenerated] set; } = 1; [JsonProperty("srd_cash_max_purchase")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float SrdCashMaxPurchase { [CompilerGenerated] get; [CompilerGenerated] set; } = 20000f; [JsonProperty("srd_cash_spend_limit")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float SrdCashSpendLimit { [CompilerGenerated] get; [CompilerGenerated] set; } = 40000f; [JsonProperty("srd_cash_spend_window_hours")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int SrdCashSpendWindowHours { [CompilerGenerated] get; [CompilerGenerated] set; } = 12; [JsonProperty("srd_cash_stack_limit")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float SrdCashStackLimit { [CompilerGenerated] get; [CompilerGenerated] set; } = 10000f; [JsonProperty("max_active_sell_per_player")] private int LegacyMaxActiveSellPerPlayer { set { if (value > 0) { MaxActiveSellPerOrganisation = value; } } } [JsonProperty("max_active_request_per_player")] private int LegacyMaxActiveRequestPerPlayer { set { if (value > 0) { MaxActiveRequestPerOrganisation = value; } } } [JsonProperty("catalog")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public Dictionary Catalog { [CompilerGenerated] get; [CompilerGenerated] set; } = new Dictionary(); } internal sealed class ImperiumMarketProductRules { [JsonProperty("packages")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public Dictionary Packages { [CompilerGenerated] get; [CompilerGenerated] set; } = new Dictionary(); [JsonProperty("tiers")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public Dictionary Tiers { [CompilerGenerated] get; [CompilerGenerated] set; } = new Dictionary(); } internal sealed class ImperiumMarketPackageRules { [JsonProperty("tiers")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public Dictionary Tiers { [CompilerGenerated] get; [CompilerGenerated] set; } = new Dictionary(); } internal sealed class ImperiumMarketRule { [JsonProperty("min_quantity")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int MinQuantity { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("max_quantity")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int MaxQuantity { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("min_price_per_unit")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float MinPricePerUnit { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("max_price_per_unit")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float MaxPricePerUnit { [CompilerGenerated] get; [CompilerGenerated] set; } } internal sealed class ImperiumMarketListing { [JsonProperty("id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Id { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("seller_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SellerName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("seller_steam_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SellerSteamId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("organisation_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string OrganisationName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("item_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ItemName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("trade_type")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string TradeType { [CompilerGenerated] get; [CompilerGenerated] set; } = "sell"; [JsonProperty("package_type")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string PackageType { [CompilerGenerated] get; [CompilerGenerated] set; } = "bricked"; [JsonProperty("tier")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Tier { [CompilerGenerated] get; [CompilerGenerated] set; } = "Standard"; [JsonProperty("image_path")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ImagePath { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("quantity_bricks")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int QuantityBricks { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("price_per_brick")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float PricePerBrick { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("payment_type")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string PaymentType { [CompilerGenerated] get; [CompilerGenerated] set; } = "bank"; [JsonProperty("description")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Description { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("note")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Note { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("status")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Status { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("claimed_by_steam_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ClaimedBySteamId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("claimed_by_organisation")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ClaimedByOrganisation { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("claim_expires_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ClaimExpiresAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("updated_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string UpdatedAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; } internal sealed class ImperiumMarketClaimRequest { [JsonProperty("listing_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ListingId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("steam_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SteamId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("steam_username")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SteamUsername { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("player_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string PlayerName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("player_code")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string PlayerCode { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("organisation_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string OrganisationName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("payment_type")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string PaymentType { [CompilerGenerated] get; [CompilerGenerated] set; } = "bank"; [JsonProperty("session_players")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List SessionPlayers { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); } internal sealed class ImperiumMarketCreateRequest { [JsonProperty("steam_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SteamId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("player_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string PlayerName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("organisation_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string OrganisationName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("trade_type")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string TradeType { [CompilerGenerated] get; [CompilerGenerated] set; } = "request"; [JsonProperty("item_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ItemName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("package_type")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string PackageType { [CompilerGenerated] get; [CompilerGenerated] set; } = "bricked"; [JsonProperty("tier")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Tier { [CompilerGenerated] get; [CompilerGenerated] set; } = "Standard"; [JsonProperty("quantity_bricks")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int Quantity { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("price_per_brick")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float PricePerUnit { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("payment_type")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string PaymentType { [CompilerGenerated] get; [CompilerGenerated] set; } = "bank"; [JsonProperty("note")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Note { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("operation_desk")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumOperationDesk OperationDesk { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumOperationDesk(); [JsonProperty("session_players")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List SessionPlayers { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); } internal sealed class ImperiumMarketClaimResponse { [JsonProperty("success")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Success { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("message")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Message { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("listing")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumMarketListing Listing { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumMarketListing(); [JsonProperty("pending_action")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumPendingAction? PendingAction { [CompilerGenerated] get; [CompilerGenerated] set; } } internal sealed class ImperiumSubmitResponse { [JsonProperty("success")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Success { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("message")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Message { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("effective_organisation_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string EffectiveOrganisationName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("effective_player_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string EffectivePlayerName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("leaderboard")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List Leaderboard { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [JsonProperty("summary")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumNetworkSummary Summary { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumNetworkSummary(); [JsonProperty("market_payout")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float MarketPayout { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("market_cancellation_fee_due")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float MarketCancellationFeeDue { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("membership")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumMembership Membership { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumMembership(); [JsonProperty("antivirus")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumAntivirusStatus Antivirus { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumAntivirusStatus(); [JsonProperty("notepad")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumNotepadStatus Notepad { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumNotepadStatus(); [JsonProperty("app_store")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumAppStoreSettings AppStore { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumAppStoreSettings(); [JsonProperty("business_manager")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumBusinessManagerSettings BusinessManager { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumBusinessManagerSettings(); [JsonProperty("music")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumMusicSettings Music { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumMusicSettings(); [JsonProperty("hylanders")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumHylandersContent Hylanders { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumHylandersContent(); [JsonProperty("police_response")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumPoliceResponseSettings PoliceResponse { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumPoliceResponseSettings(); [JsonProperty("pending_actions")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List PendingActions { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [JsonProperty("network_access")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumNetworkAccess NetworkAccess { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumNetworkAccess(); } internal sealed class ImperiumLeaderboardResponse { [JsonProperty("success")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Success { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("leaderboard")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List Leaderboard { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [JsonProperty("summary")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumNetworkSummary Summary { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumNetworkSummary(); } internal sealed class ImperiumMessagesResponse { [JsonProperty("success")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Success { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("messages")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List Messages { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [JsonProperty("unread_count")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int UnreadCount { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("pending_actions")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List PendingActions { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [JsonProperty("market_payout")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float MarketPayout { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("market_cancellation_fee_due")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float MarketCancellationFeeDue { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("membership")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumMembership Membership { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumMembership(); [JsonProperty("antivirus")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumAntivirusStatus Antivirus { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumAntivirusStatus(); [JsonProperty("notepad")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumNotepadStatus Notepad { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumNotepadStatus(); [JsonProperty("app_store")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumAppStoreSettings AppStore { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumAppStoreSettings(); [JsonProperty("business_manager")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumBusinessManagerSettings BusinessManager { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumBusinessManagerSettings(); [JsonProperty("music")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumMusicSettings Music { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumMusicSettings(); [JsonProperty("hylanders")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumHylandersContent Hylanders { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumHylandersContent(); [JsonProperty("network_access")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumNetworkAccess NetworkAccess { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumNetworkAccess(); } internal sealed class ImperiumNetworkAccess { [JsonProperty("allowed")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Allowed { [CompilerGenerated] get; [CompilerGenerated] set; } = true; [JsonProperty("state")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string State { [CompilerGenerated] get; [CompilerGenerated] set; } = "allowed"; [JsonProperty("maintenance_mode")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool MaintenanceMode { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("maintenance_message")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string MaintenanceMessage { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("required_mod_version")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string RequiredModVersion { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("loyalty_pledge_cost")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int LoyaltyPledgeCost { [CompilerGenerated] get; [CompilerGenerated] set; } = 10000; [JsonProperty("loyalty_pledge_game_days")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int LoyaltyPledgeGameDays { [CompilerGenerated] get; [CompilerGenerated] set; } = 7; [JsonProperty("loyalty_max_game_days")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int LoyaltyMaxGameDays { [CompilerGenerated] get; [CompilerGenerated] set; } = 70; [JsonProperty("network_tagline")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string NetworkTagline { [CompilerGenerated] get; [CompilerGenerated] set; } = "One app. One network."; [JsonProperty("update_required_sender_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string UpdateRequiredSenderName { [CompilerGenerated] get; [CompilerGenerated] set; } = "S.I.A.K Update"; [JsonProperty("update_required_message")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string UpdateRequiredMessage { [CompilerGenerated] get; [CompilerGenerated] set; } = "Imperium Software needs an update. We advise you to contact the Imperium Architects."; [JsonProperty("terms_version")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int TermsVersion { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("terms_required")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool TermsRequired { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("terms_text")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string TermsText { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("terms_updated_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string TermsUpdatedAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("identity_required")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool IdentityRequired { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("identity_completed_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string IdentityCompletedAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("identity_player_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string IdentityPlayerName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("identity_organisation_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string IdentityOrganisationName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("original_organisation_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string OriginalOrganisationName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("game_player_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string GamePlayerName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("game_organisation_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string GameOrganisationName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("is_organisation_leader")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool IsOrganisationLeader { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("player_name_cooldown_until")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string PlayerNameCooldownUntil { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("organisation_name_cooldown_until")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string OrganisationNameCooldownUntil { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("player_name_cooldown_days")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int PlayerNameCooldownDays { [CompilerGenerated] get; [CompilerGenerated] set; } = 30; [JsonProperty("organisation_name_cooldown_days")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int OrganisationNameCooldownDays { [CompilerGenerated] get; [CompilerGenerated] set; } = 30; [JsonProperty("blocked_steam_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string BlockedSteamId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("blocked_player_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string BlockedPlayerName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("blocked_reason")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string BlockedReason { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("access_frozen")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool AccessFrozen { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("investigation_status")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string InvestigationStatus { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("investigation_expires_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string InvestigationExpiresAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("message")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Message { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; } internal sealed class ImperiumTermsResponse { [JsonProperty("success")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Success { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("message")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Message { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("network_access")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumNetworkAccess NetworkAccess { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumNetworkAccess(); } internal sealed class ImperiumIdentityResponse { [JsonProperty("success")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Success { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("message")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Message { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("player_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string PlayerName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("organisation_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string OrganisationName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("network_access")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumNetworkAccess NetworkAccess { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumNetworkAccess(); } internal sealed class ImperiumMissionProduct { [JsonProperty("item_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ItemId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("item_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ItemName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("drug")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Drug { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("package_type")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string PackageType { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("tier")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Tier { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("effects")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List Effects { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [JsonProperty("effect_fingerprint")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string EffectFingerprint { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; } internal sealed class ImperiumMission { [JsonProperty("id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Id { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("title")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Title { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("description")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Description { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("accent_color")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string AccentColor { [CompilerGenerated] get; [CompilerGenerated] set; } = "#e7b84f"; [JsonProperty("enabled")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Enabled { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("available")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Available { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("completed")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Completed { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("deadline_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string DeadlineAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("payout")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float Payout { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("price_per_item")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float PricePerItem { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("quantity")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int Quantity { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("requirements")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumMissionProduct Requirements { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumMissionProduct(); [JsonProperty("completion_count")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int CompletionCount { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("total_payout")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float TotalPayout { [CompilerGenerated] get; [CompilerGenerated] set; } } internal sealed class ImperiumMissionsResponse { [JsonProperty("success")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Success { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("message")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Message { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("missions")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List Missions { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [JsonProperty("network_access")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumNetworkAccess NetworkAccess { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumNetworkAccess(); } internal sealed class ImperiumMissionCompleteRequest { [JsonProperty("action")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Action { [CompilerGenerated] get; [CompilerGenerated] set; } = "complete"; [JsonProperty("steam_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SteamId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("mission_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string MissionId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("session_players")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List SessionPlayers { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); } internal sealed class ImperiumMissionActionResponse { [JsonProperty("success")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Success { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("message")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Message { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("mission")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumMission Mission { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumMission(); [JsonProperty("pending_action")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumPendingAction? PendingAction { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("network_access")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumNetworkAccess NetworkAccess { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumNetworkAccess(); } internal sealed class ImperiumMissionUploadRequest { [JsonProperty("steam_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SteamId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("product")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumMissionProduct Product { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumMissionProduct(); [JsonProperty("products")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List Products { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); } internal sealed class ImperiumMissionUploadResponse { [JsonProperty("success")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Success { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("message")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Message { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("product")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumMissionProduct Product { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumMissionProduct(); [JsonProperty("products")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List Products { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); } internal sealed class ImperiumActionAckRequest { [JsonProperty("steam_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SteamId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("action_ids")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List ActionIds { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); } internal sealed class ImperiumMarketPayoutWithdrawRequest { [JsonProperty("steam_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SteamId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("destination")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Destination { [CompilerGenerated] get; [CompilerGenerated] set; } = "cash"; [JsonProperty("session_players")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List SessionPlayers { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); } internal sealed class ImperiumMarketPayoutResponse { [JsonProperty("success")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Success { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("message")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Message { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("market_payout")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float MarketPayout { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("pending_action")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumPendingAction? PendingAction { [CompilerGenerated] get; [CompilerGenerated] set; } } internal sealed class ImperiumEventResponse { [JsonProperty("success")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Success { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("sequence")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public long Sequence { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("timeout")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Timeout { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("event")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumServerEvent? Event { [CompilerGenerated] get; [CompilerGenerated] set; } } internal sealed class ImperiumServerEvent { [JsonProperty("type")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Type { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("occurred_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string OccurredAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; } internal sealed class ImperiumMarketResponse { [JsonProperty("success")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Success { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("settings")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumMarketSettings Settings { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumMarketSettings(); [JsonProperty("listings")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List Listings { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [JsonProperty("viewer_organisation_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ViewerOrganisationName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; } internal sealed class ImperiumChatMessage { [JsonProperty("id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Id { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("sender_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SenderName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("sender_steam_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SenderSteamId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("sender_org")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SenderOrganisation { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("recipient_org")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string RecipientOrganisation { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("body")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Body { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("created_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string CreatedAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("source")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Source { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; } internal sealed class ImperiumOrganisationChat { [JsonProperty("conversation_key")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ConversationKey { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("chat_type")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ChatType { [CompilerGenerated] get; [CompilerGenerated] set; } = "direct"; [JsonProperty("title")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Title { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("participant_orgs")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List ParticipantOrganisations { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [JsonProperty("can_leave")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool CanLeave { [CompilerGenerated] get; [CompilerGenerated] set; } = true; [JsonProperty("counts_toward_limit")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool CountsTowardLimit { [CompilerGenerated] get; [CompilerGenerated] set; } = true; [JsonProperty("left_org")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string LeftOrganisation { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("right_org")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string RightOrganisation { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("status")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Status { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("requested_by_org")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string RequestedByOrganisation { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("updated_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string UpdatedAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("unread_count")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int UnreadCount { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("messages")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List Messages { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); } internal sealed class ImperiumChatPolicy { [JsonProperty("max_open_chats")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int MaxOpenChats { [CompilerGenerated] get; [CompilerGenerated] set; } = 5; [JsonProperty("auto_close_after_days")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int AutoCloseAfterDays { [CompilerGenerated] get; [CompilerGenerated] set; } = 7; } internal sealed class ImperiumChatsResponse { [JsonProperty("success")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Success { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("message")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Message { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("chats")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List Chats { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [JsonProperty("chat_policy")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumChatPolicy ChatPolicy { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumChatPolicy(); } internal sealed class ImperiumChatRequest { [JsonProperty("action")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Action { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("conversation_key")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ConversationKey { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("source_org")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SourceOrganisation { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("target_org")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string TargetOrganisation { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("sender_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SenderName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("sender_steam_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SenderSteamId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("body")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Body { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("session_players")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List SessionPlayers { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); } internal sealed class ImperiumOrganisationVisibility { [JsonProperty("products_sold")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool ProductsSold { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("economy_current_bank")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool EconomyCurrentBank { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("items_sold")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool ItemsSold { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("items_bought")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool ItemsBought { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("money_made_selling")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool MoneyMadeSelling { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("money_used_buying")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool MoneyUsedBuying { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("misc_stats")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool MiscStats { [CompilerGenerated] get; [CompilerGenerated] set; } } internal sealed class ImperiumOrganisationMiscStats { [JsonProperty("online_members")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int OnlineMembers { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("known_members")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int KnownMembers { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("active_listings")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int ActiveListings { [CompilerGenerated] get; [CompilerGenerated] set; } } internal sealed class ImperiumOrganisationStatistics { [JsonProperty("products_sold")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int? ProductsSold { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("current_bank")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float? CurrentBank { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("items_sold")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int? ItemsSold { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("items_bought")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int? ItemsBought { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("money_made_selling")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float? MoneyMadeSelling { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("money_used_buying")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float? MoneyUsedBuying { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("misc_stats")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumOrganisationMiscStats? MiscStats { [CompilerGenerated] get; [CompilerGenerated] set; } } internal sealed class ImperiumOrganisationMember { [JsonProperty("steam_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SteamId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("player_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string PlayerName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("is_leader")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool IsLeader { [CompilerGenerated] get; [CompilerGenerated] set; } } internal sealed class ImperiumOrganisationProfile { [JsonProperty("organisation_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string OrganisationName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("description")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Description { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("motto")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Motto { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("visibility")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumOrganisationVisibility Visibility { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumOrganisationVisibility(); [JsonProperty("loyalty_active")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool LoyaltyActive { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("is_viewer_organisation")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool IsViewerOrganisation { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("can_edit")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool CanEdit { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("updated_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string UpdatedAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("edit_cooldown_until")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string EditCooldownUntil { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("members")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List Members { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [JsonProperty("stats")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumOrganisationStatistics Stats { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumOrganisationStatistics(); } internal sealed class ImperiumOrganisationsResponse { [JsonProperty("success")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool Success { [CompilerGenerated] get; [CompilerGenerated] set; } [JsonProperty("message")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Message { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("viewer_organisation_name")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ViewerOrganisationName { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("organisations")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List Organisations { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [JsonProperty("profile")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumOrganisationProfile Profile { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumOrganisationProfile(); } internal sealed class ImperiumOrganisationProfileUpdateRequest { [JsonProperty("steam_id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SteamId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("motto")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Motto { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("description")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Description { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("visibility")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumOrganisationVisibility Visibility { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumOrganisationVisibility(); } internal sealed class ImperiumStatusSnapshot { [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SteamId { [CompilerGenerated] get; [CompilerGenerated] set; } = "Unavailable"; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SteamUsername { [CompilerGenerated] get; [CompilerGenerated] set; } = "Unavailable"; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string PlayerName { [CompilerGenerated] get; [CompilerGenerated] set; } = "Unavailable"; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string PlayerCode { [CompilerGenerated] get; [CompilerGenerated] set; } = "Unavailable"; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string OrganisationName { [CompilerGenerated] get; [CompilerGenerated] set; } = "Unavailable"; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float BankBalance { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float CashBalance { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float NetWorth { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int GameDay { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float MarketPayout { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float MarketCancellationFeeDue { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string LastSyncText { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string LastError { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumNetworkSummary Summary { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumNetworkSummary(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List Leaderboard { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List LivePlayers { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List Organisations { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List Messages { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int UnreadMessages { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List PendingActions { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumMarketSettings MarketSettings { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumMarketSettings(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List MarketListings { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List Chats { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumChatPolicy ChatPolicy { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumChatPolicy(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List Missions { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumOperationDesk OperationDesk { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumOperationDesk(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumMembership Membership { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumMembership(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumAntivirusStatus Antivirus { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumAntivirusStatus(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumNotepadStatus Notepad { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumNotepadStatus(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumAppStoreSettings AppStore { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumAppStoreSettings(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumBusinessManagerSettings BusinessManager { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumBusinessManagerSettings(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumMusicSettings Music { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumMusicSettings(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumHylandersContent Hylanders { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumHylandersContent(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumPoliceResponseSettings PoliceResponse { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumPoliceResponseSettings(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumPoliceStatus PoliceStatus { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumPoliceStatus(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public ImperiumNetworkAccess NetworkAccess { [CompilerGenerated] get; [CompilerGenerated] set; } = new ImperiumNetworkAccess(); } internal static class ImperiumMultiScheduleCompatibility { private const string LegacyCategoryId = "SIAKImperium"; private const string RuntimeCategoryId = "LocalRuntimeCache"; internal static void Patch(Harmony harmony, Instance logger) { //IL_00a2: 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_00bb: Expected O, but got Unknown try { System.Type type = Enumerable.FirstOrDefault(Enumerable.Select((System.Collections.Generic.IEnumerable)AppDomain.CurrentDomain.GetAssemblies(), (Func)((Assembly assembly) => assembly.GetType("MultiSchedule.ModMain", false))), (Func)((System.Type type2) => type2 != (System.Type)null)); MethodInfo val = ((type == (System.Type)null) ? null : AccessTools.Method(type, "CategoryMatchesMod", (System.Type[])null, (System.Type[])null)); MethodInfo val2 = AccessTools.Method(typeof(ImperiumMultiScheduleCompatibility), "CategoryMatchesModPrefix", (System.Type[])null, (System.Type[])null); if (!(val == (MethodInfo)null) && !(val2 == (MethodInfo)null)) { harmony.Patch((MethodBase)(object)val, new HarmonyMethod(val2) { priority = 800 }, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); logger.Msg("[Imperium] MultiSchedule compatibility active; Imperium runtime state will not enter lobby bundles."); } } catch (System.Exception ex) { logger.Warning("[Imperium] MultiSchedule compatibility could not be applied: " + ex.Message); } } private static bool CategoryMatchesModPrefix(MelonPreferences_Category __0, ref bool __result) { string text = ((__0 == null) ? null : __0.Identifier?.Trim()) ?? string.Empty; if (!string.Equals(text, "SIAKImperium", (StringComparison)5) && !string.Equals(text, "LocalRuntimeCache", (StringComparison)5)) { return true; } __result = false; return false; } } public sealed class ImperiumMusicApp : PhoneApp { internal const string ApplicationId = "SIAKMusicApp"; private static ImperiumMusicApp? _instance; private static ImperiumMusicController? _controller; private static GameObject? _iconRoot; private static bool _isOpen; private static readonly Action OpenFromLauncherAction = new Action(OpenFromLauncher); internal static bool IsMusicAppOpen => _isOpen; protected override string AppName => "SIAKMusicApp"; protected override string AppTitle => "Music"; protected override string IconLabel => "Music"; protected override string IconFileName => string.Empty; protected override Sprite? IconSprite => ImperiumAssets.LoadMusicAppIconSprite(); protected override EOrientation Orientation => (EOrientation)0; protected override void OnCreatedUI(GameObject container) { //IL_0018: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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) _instance = this; ImperiumMusicLifecyclePatch.EnsurePatched(); GameObject val = UIFactory.Panel("MusicHtmlRoot", container.transform, Color.clear, (Vector2?)null, (Vector2?)null, true); _controller = val.AddComponent(); if (!_controller.Initialize(val)) { Text val2 = UIFactory.Text("MusicFallback", "Music could not initialise.", val.transform, 22, (TextAnchor)4, (FontStyle)1); ((Graphic)val2).rectTransform.anchorMin = Vector2.zero; ((Graphic)val2).rectTransform.anchorMax = Vector2.one; ((Graphic)val2).rectTransform.offsetMin = Vector2.zero; ((Graphic)val2).rectTransform.offsetMax = Vector2.zero; } RefreshAvailabilityFromService(); ImperiumAppStoreManager.ScheduleCatalogRefresh(); NotifyClosed(); } internal static void RefreshAvailabilityFromService() { ImperiumAppStoreManager.RefreshMusicAvailability(); ImperiumMusicSettings imperiumMusicSettings = SIAKImperiumMod.Service?.GetSnapshot().Music ?? new ImperiumMusicSettings(); ApplyLauncherVisibility(imperiumMusicSettings.Enabled && ImperiumAppStoreManager.IsInstalled("SIAKMusicApp")); } internal static void ApplyLauncherVisibility(bool visible) { if (_instance != null) { _iconRoot = ImperiumPhoneLauncherDeduplicator.AdoptExistingLauncher(_iconRoot, "SIAKMusicApp", visible); } } private static void OpenFromLauncher() { ImperiumMusicApp? instance = _instance; if (instance != null) { ((PhoneApp)instance).OpenApp(); } NotifyOpened(); } internal static void NotifyOpened() { _isOpen = true; _controller?.SetAppOpen(isOpen: true); } internal static void NotifyClosed() { _isOpen = false; _controller?.SetAppOpen(isOpen: false); } } internal sealed class ImperiumMusicController : MonoBehaviour { private static readonly float[] VisualizerBaseHeights; private const float MetadataRefreshIntervalSeconds = 1.25f; private const float VisualizerFrameIntervalSeconds = 1f / 30f; private readonly RectTransform?[] _visualizerBars = (RectTransform?[])(object)new RectTransform[VisualizerBaseHeights.Length]; private readonly object _metadataSync = new object(); private ImperiumHtmlDocument? _document; private GameObject? _root; private int _lastServiceVersion = -1; private int _metadataRefreshInFlight; private int _openGeneration; private volatile bool _appOpen; private bool _serviceEnabled = true; private bool _isPlaying; private bool _playbackStateInitialised; private int _consecutiveMetadataMisses; private bool _metadataResultReady; private bool _pendingTrackFound; private bool _visualizerIdleApplied; private bool _statusVisible = true; private volatile bool _destroyed; private float _nextMetadataRefresh; private float _nextVisualizerFrame; private float _nextTransportCommandAt; private float _ignorePlaybackSnapshotUntil; private WindowsMediaSnapshot _pendingSnapshot; private string _displayedTrackTitle = string.Empty; private string _displayedStatus = string.Empty; public ImperiumMusicController(System.IntPtr pointer) : base(pointer) { } public bool Initialize(GameObject root) { _root = root; _appOpen = false; return Render(); } internal void SetAppOpen(bool isOpen) { if (!_destroyed && _appOpen != isOpen) { _appOpen = isOpen; Interlocked.Increment(ref _openGeneration); lock (_metadataSync) { _metadataResultReady = false; _pendingTrackFound = false; _pendingSnapshot = default(WindowsMediaSnapshot); } if (!isOpen) { _nextMetadataRefresh = 1f / 0f; _nextVisualizerFrame = 1f / 0f; return; } _nextMetadataRefresh = 0f; _nextVisualizerFrame = 0f; _nextTransportCommandAt = 0f; _ignorePlaybackSnapshotUntil = 0f; _consecutiveMetadataMisses = 0; _visualizerIdleApplied = false; RefreshServiceState(); PumpTrackMetadata(); } } public void Update() { if (_appOpen && !((Object)(object)_root == (Object)null) && _root.activeInHierarchy) { RefreshServiceState(); PumpTrackMetadata(); AnimateVisualizer(); } } public void OnDisable() { if (_appOpen) { ImperiumMusicApp.NotifyClosed(); } } public void OnDestroy() { _destroyed = true; _appOpen = false; Interlocked.Increment(ref _openGeneration); _document?.Dispose(); _document = null; } [HideFromIl2Cpp] private bool Render() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown if ((Object)(object)_root == (Object)null) { return false; } Dictionary actions = new Dictionary((IEqualityComparer)(object)StringComparer.Ordinal) { ["music.previous"] = (Action)([CompilerGenerated] () => { SendMediaKey(177); }), ["music.play-pause"] = new Action(TogglePlayback), ["music.next"] = (Action)([CompilerGenerated] () => { SendMediaKey(176); }) }; RefreshServiceState(); string html = ImperiumAssets.LoadEmbeddedText("interface/music/index.html"); string css = ImperiumAssets.LoadEmbeddedText("interface/music/styles.css"); string script = ImperiumAssets.LoadEmbeddedText("interface/music/app.js"); _document?.Dispose(); _document = ImperiumWebUiRuntime.TryRender(_root.transform, html, css, script, (IReadOnlyDictionary?)(object)actions, out string error, ImperiumInterfaceSurface.Landscape); if (_document == null) { Instance? modLogger = SIAKImperiumMod.ModLogger; if (modLogger != null) { modLogger.Warning("[Imperium UI] Music render failed: " + error); } return false; } _displayedTrackTitle = string.Empty; _displayedStatus = string.Empty; _statusVisible = true; SetStatusMessage(_serviceEnabled ? "Open Spotify, YouTube Music, or another media player." : "Music has been disabled by Imperium Architects."); CreateVisualizer(); _nextMetadataRefresh = (_appOpen ? 0f : (1f / 0f)); _nextVisualizerFrame = (_appOpen ? 0f : (1f / 0f)); _consecutiveMetadataMisses = 0; _visualizerIdleApplied = false; if (_appOpen) { PumpTrackMetadata(); } UpdatePlaybackArtwork(); return true; } [HideFromIl2Cpp] private void TogglePlayback() { if (!_serviceEnabled) { return; } float unscaledTime = Time.unscaledTime; if (!(unscaledTime < _nextTransportCommandAt)) { _nextTransportCommandAt = unscaledTime + 0.6f; if (WindowsMediaControl.SendMediaKey(179)) { _isPlaying = !_isPlaying; _playbackStateInitialised = true; _ignorePlaybackSnapshotUntil = unscaledTime + 0.65f; _visualizerIdleApplied = false; _nextVisualizerFrame = 0f; _nextMetadataRefresh = unscaledTime + 0.7f; UpdatePlaybackArtwork(); } } } [HideFromIl2Cpp] private void UpdatePlaybackArtwork() { _document?.SetImage("music-play-state", ImperiumAssets.LoadMusicControlSprite(_isPlaying ? "pause" : "play")); } private void AnimateVisualizer() { //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) if (!_appOpen || _document == null || (Object)(object)_root == (Object)null || !_root.activeInHierarchy) { return; } if (!_isPlaying) { if (_visualizerIdleApplied) { return; } for (int i = 0; i < VisualizerBaseHeights.Length; i++) { RectTransform val = _visualizerBars[i]; if ((Object)(object)val != (Object)null) { val.sizeDelta = new Vector2(18f, VisualizerBaseHeights[i] * 0.42f); } } _visualizerIdleApplied = true; } else { if (Time.unscaledTime < _nextVisualizerFrame) { return; } _nextVisualizerFrame = Time.unscaledTime + 1f / 30f; _visualizerIdleApplied = false; float num = Time.unscaledTime * 5.2f; for (int j = 0; j < VisualizerBaseHeights.Length; j++) { RectTransform val2 = _visualizerBars[j]; if (!((Object)(object)val2 == (Object)null)) { float num2 = 18f + VisualizerBaseHeights[j] * (0.35f + Mathf.Abs(Mathf.Sin(num + (float)j * 0.83f)) * 0.65f); if (Mathf.Abs(val2.sizeDelta.y - num2) > 0.35f) { val2.sizeDelta = new Vector2(18f, num2); } } } } } [HideFromIl2Cpp] private void CreateVisualizer() { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) RectTransform val = _document?.GetRect("music-visualizer-anchor"); if (!((Object)(object)val == (Object)null)) { float num = (float)VisualizerBaseHeights.Length * 18f + (float)(VisualizerBaseHeights.Length - 1) * 10f; for (int i = 0; i < VisualizerBaseHeights.Length; i++) { GameObject val2 = new GameObject($"MusicVisualizerBar{i + 1}"); val2.transform.SetParent((Transform)(object)val, false); RectTransform val3 = val2.AddComponent(); val3.anchorMin = new Vector2(0.5f, 0f); val3.anchorMax = new Vector2(0.5f, 0f); val3.pivot = new Vector2(0.5f, 0f); val3.anchoredPosition = new Vector2((0f - num) * 0.5f + 9f + (float)i * 28f, 0f); val3.sizeDelta = new Vector2(18f, VisualizerBaseHeights[i] * 0.42f); Image val4 = val2.AddComponent(); val4.sprite = ImperiumUiSprites.Rounded; val4.type = (Type)1; ((Graphic)val4).color = Color.Lerp(new Color(0.32f, 0.85f, 0.91f), new Color(0.55f, 0.47f, 1f), (float)i / 8f); ((Graphic)val4).raycastTarget = false; _visualizerBars[i] = val3; } } } [HideFromIl2Cpp] private void PumpTrackMetadata() { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown if (!_appOpen || _document == null) { return; } ApplyPendingMetadataResult(); if (!_serviceEnabled) { SetTrackTitle("Music unavailable"); SetStatusMessage("Music has been disabled by Imperium Architects."); } else { if (Time.unscaledTime < _nextMetadataRefresh || Interlocked.CompareExchange(ref _metadataRefreshInFlight, 1, 0) != 0) { return; } _nextMetadataRefresh = Time.unscaledTime + 1.25f; int generation = Volatile.Read(ref _openGeneration); System.Threading.Tasks.Task.Run((Action)delegate { bool flag = false; WindowsMediaSnapshot snapshot = default(WindowsMediaSnapshot); try { flag = WindowsMediaControl.TryGetMediaSnapshot(out snapshot); } catch { flag = false; snapshot = default(WindowsMediaSnapshot); } lock (_metadataSync) { if (!_destroyed && _appOpen && generation == Volatile.Read(ref _openGeneration)) { _pendingTrackFound = flag; _pendingSnapshot = snapshot; _metadataResultReady = true; } } Interlocked.Exchange(ref _metadataRefreshInFlight, 0); }); } } private void ApplyPendingMetadataResult() { bool metadataResultReady; bool pendingTrackFound; WindowsMediaSnapshot pendingSnapshot; lock (_metadataSync) { metadataResultReady = _metadataResultReady; pendingTrackFound = _pendingTrackFound; pendingSnapshot = _pendingSnapshot; _metadataResultReady = false; } if (!metadataResultReady || !_appOpen || _document == null) { return; } if (pendingTrackFound && !string.IsNullOrWhiteSpace(pendingSnapshot.Title)) { _consecutiveMetadataMisses = 0; string text = WindowsMediaControl.SanitizeTitleForDisplay(pendingSnapshot.Title); string text2 = WindowsMediaControl.SanitizeArtistForDisplay(pendingSnapshot.Artist); if (string.Equals(text, text2, (StringComparison)5)) { text2 = string.Empty; } SetTrackTitle(text); SetStatusMessage(text2); if (pendingSnapshot.PlaybackKnown && Time.unscaledTime >= _ignorePlaybackSnapshotUntil) { SetPlaybackState(pendingSnapshot.IsPlaying); } } else { _consecutiveMetadataMisses++; SetTrackTitle("No active track detected"); SetStatusMessage("Open Spotify, YouTube Music, or another media player."); if (_consecutiveMetadataMisses >= 2 && Time.unscaledTime >= _ignorePlaybackSnapshotUntil) { SetPlaybackState(isPlaying: false); } } } private void SetPlaybackState(bool isPlaying) { if (!_playbackStateInitialised || _isPlaying != isPlaying) { _isPlaying = isPlaying; _playbackStateInitialised = true; _visualizerIdleApplied = false; _nextVisualizerFrame = 0f; UpdatePlaybackArtwork(); } } private void SetTrackTitle(string value) { if (value == null) { value = string.Empty; } if (!string.Equals(_displayedTrackTitle, value, (StringComparison)4)) { _displayedTrackTitle = value; _document?.SetText("music-track-title", value); } } private void SetStatusMessage(string value) { if (value == null) { value = string.Empty; } bool flag = !string.IsNullOrWhiteSpace(value); if (!string.Equals(_displayedStatus, value, (StringComparison)4)) { _displayedStatus = value; _document?.SetText("music-status", value); } if (_statusVisible != flag) { _statusVisible = flag; _document?.SetVisible("music-status", flag); } } [HideFromIl2Cpp] private void SendMediaKey(byte key) { if (!_serviceEnabled) { return; } float unscaledTime = Time.unscaledTime; if (!(unscaledTime < _nextTransportCommandAt)) { _nextTransportCommandAt = unscaledTime + 0.45f; if (WindowsMediaControl.SendMediaKey(key)) { _nextMetadataRefresh = unscaledTime + 0.55f; } } } private void RefreshServiceState() { ImperiumService service = SIAKImperiumMod.Service; if (service != null && service.StateVersion != _lastServiceVersion) { _lastServiceVersion = service.StateVersion; _serviceEnabled = service.GetSnapshot().Music.Enabled; if (!_serviceEnabled) { _isPlaying = false; _visualizerIdleApplied = false; _nextVisualizerFrame = 0f; UpdatePlaybackArtwork(); } } } static ImperiumMusicController() { float[] array = new float[9]; RuntimeHelpers.InitializeArray((System.Array)array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); VisualizerBaseHeights = array; } } internal static class ImperiumMusicLifecyclePatch { private const string HarmonyId = "siak.imperium.music-lifecycle"; private static bool _patched; private static Harmony? _harmony; internal static void EnsurePatched() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown if (_patched) { return; } try { _harmony = new Harmony("siak.imperium.music-lifecycle"); MethodInfo val = AccessTools.Method(typeof(PhoneApp), "OpenApp", (System.Type[])null, (System.Type[])null); MethodInfo val2 = AccessTools.Method(typeof(ImperiumMusicLifecyclePatch), "OpenPostfix", (System.Type[])null, (System.Type[])null); MethodInfo val3 = AccessTools.Method(typeof(PhoneApp), "Exit", (System.Type[])null, (System.Type[])null); MethodInfo val4 = AccessTools.Method(typeof(ImperiumMusicLifecyclePatch), "ExitPrefix", (System.Type[])null, (System.Type[])null); if (val != (MethodInfo)null && val2 != (MethodInfo)null) { _harmony.Patch((MethodBase)(object)val, (HarmonyMethod)null, new HarmonyMethod(val2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } if (val3 != (MethodInfo)null && val4 != (MethodInfo)null) { _harmony.Patch((MethodBase)(object)val3, new HarmonyMethod(val4), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } _patched = true; } catch (System.Exception ex) { Instance? modLogger = SIAKImperiumMod.ModLogger; if (modLogger != null) { modLogger.Warning("[Imperium Music] Could not install app lifecycle tracking: " + ex.Message); } } } public static void OpenPostfix(PhoneApp __instance) { if (__instance is ImperiumMusicApp) { ImperiumMusicApp.NotifyOpened(); } } public static void ExitPrefix(PhoneApp __instance) { if (__instance is ImperiumMusicApp) { ImperiumMusicApp.NotifyClosed(); } } } internal readonly struct WindowsMediaSnapshot { [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] internal string Title { [CompilerGenerated] get; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] internal string Artist { [CompilerGenerated] get; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] internal bool PlaybackKnown { [CompilerGenerated] get; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] internal bool IsPlaying { [CompilerGenerated] get; } internal WindowsMediaSnapshot(string title, string artist, bool playbackKnown, bool isPlaying) { Title = title ?? string.Empty; Artist = artist ?? string.Empty; PlaybackKnown = playbackKnown; IsPlaying = isPlaying; } } internal static class WindowsMediaControl { private delegate bool EnumWindowsCallback(System.IntPtr window, System.IntPtr parameter); private static readonly string[] ProviderLabels = new string[18] { "YouTube", "YouTube Music", "Spotify", "Google Chrome", "Chrome", "Microsoft Edge", "Edge", "Mozilla Firefox", "Firefox", "VLC media player", "VLC", "TIDAL", "Deezer", "MusicBee", "foobar2000", "Winamp", "AIMP", "iTunes" }; internal const byte MediaNext = 176; internal const byte MediaPrevious = 177; internal const byte MediaPlayPause = 179; private const uint KeyUp = 2u; [DllImport("user32.dll")] private static extern void keybd_event(byte virtualKey, byte scanCode, uint flags, System.UIntPtr extraInfo); [DllImport("user32.dll")] [return: MarshalAs((UnmanagedType)2)] private static extern bool EnumWindows(EnumWindowsCallback callback, System.IntPtr parameter); [DllImport("user32.dll")] [return: MarshalAs((UnmanagedType)2)] private static extern bool IsWindowVisible(System.IntPtr window); [DllImport("user32.dll", CharSet = (CharSet)3)] private static extern int GetWindowText(System.IntPtr window, StringBuilder text, int maximumCount); [DllImport("user32.dll")] private static extern int GetWindowTextLength(System.IntPtr window); [DllImport("user32.dll")] private static extern uint GetWindowThreadProcessId(System.IntPtr window, out uint processId); internal static string SanitizeTitleForDisplay(string? value) { return CleanTrackTitle(value ?? string.Empty); } internal static string SanitizeArtistForDisplay(string? value, string? source = null) { string text = (value ?? string.Empty).Trim(); if (text.Length == 0) { return string.Empty; } text = StripProviderAffixes(text); if (text.Length == 0 || IsProviderLabel(text) || (!string.IsNullOrWhiteSpace(source) && string.Equals(NormalizeProviderToken(text), NormalizeProviderToken(source), (StringComparison)4))) { return string.Empty; } return text; } internal static bool SendMediaKey(byte key) { try { keybd_event(key, 0, 0u, System.UIntPtr.Zero); keybd_event(key, 0, 2u, System.UIntPtr.Zero); return true; } catch (System.Exception ex) { Instance? modLogger = SIAKImperiumMod.ModLogger; if (modLogger != null) { modLogger.Warning("[Imperium Music] Media command failed: " + ex.Message); } return false; } } internal static bool TryGetMediaSnapshot(out WindowsMediaSnapshot snapshot) { if (WindowsGlobalMediaSession.TryGetSnapshot(out snapshot)) { return true; } return TryGetWindowSnapshot(out snapshot); } private static bool TryGetWindowSnapshot(out WindowsMediaSnapshot snapshot) { string detectedTitle = string.Empty; string detectedArtist = string.Empty; int bestScore = 0; Dictionary processNames = new Dictionary(); try { EnumWindows(delegate(System.IntPtr window, System.IntPtr _) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown if (!IsWindowVisible(window)) { return true; } int windowTextLength = GetWindowTextLength(window); if (windowTextLength < 3 || windowTextLength > 512) { return true; } StringBuilder val = new StringBuilder(windowTextLength + 1); if (GetWindowText(window, val, val.Capacity) <= 0) { return true; } string text = ((object)val).ToString().Trim(); if (text.Length < 3) { return true; } GetWindowThreadProcessId(window, out var processId); string text2 = default(string); if (!processNames.TryGetValue(processId, ref text2)) { try { Process processById = Process.GetProcessById((int)processId); try { text2 = processById.ProcessName.ToLowerInvariant(); } finally { ((System.IDisposable)processById)?.Dispose(); } } catch { text2 = string.Empty; } processNames[processId] = text2; } string source; int num = ScoreMediaWindow(text2, text, out source); if (num <= bestScore) { return true; } ParseWindowMetadata(text2, source, text, out string title, out string artist); title = SanitizeTitleForDisplay(title); artist = SanitizeArtistForDisplay(artist, source); if (title.Length < 2) { return true; } bestScore = num; detectedTitle = title; detectedArtist = artist; return true; }, System.IntPtr.Zero); } catch { detectedTitle = string.Empty; detectedArtist = string.Empty; } snapshot = new WindowsMediaSnapshot(detectedTitle, detectedArtist, playbackKnown: false, isPlaying: false); return detectedTitle.Length > 0; } private static int ScoreMediaWindow(string processName, string title, out string source) { source = string.Empty; if (processName.Contains("spotify", (StringComparison)4)) { source = "Spotify"; return (!title.Equals("Spotify", (StringComparison)5) && !title.Contains("Spotify Premium", (StringComparison)5)) ? 100 : 0; } if (title.Equals("YouTube Music", (StringComparison)5)) { return 0; } if (title.Contains("YouTube Music", (StringComparison)5)) { source = "YouTube Music"; return 95; } if (title.Contains(" - YouTube", (StringComparison)5)) { source = "YouTube"; return 90; } bool flag; switch (.ComputeStringHash(processName)) { case 2736739156u: if (processName == "vlc") { goto IL_01a9; } goto default; case 3657830976u: if (processName == "musicbee") { goto IL_01a9; } goto default; case 392118538u: if (processName == "foobar2000") { goto IL_01a9; } goto default; case 2269711677u: if (processName == "winamp") { goto IL_01a9; } goto default; case 4248196594u: if (processName == "aimp") { goto IL_01a9; } goto default; case 1850241139u: if (processName == "itunes") { goto IL_01a9; } goto default; case 1790172771u: if (processName == "tidal") { goto IL_01a9; } goto default; case 1239097630u: if (processName == "deezer") { goto IL_01a9; } goto default; default: { flag = false; break; } IL_01a9: flag = true; break; } if (flag) { source = processName; return 85; } return 0; } private static void ParseWindowMetadata(string processName, string source, string rawTitle, out string title, out string artist) { string text = (title = CleanTrackTitle(rawTitle)); artist = string.Empty; int num = text.IndexOf(" • ", (StringComparison)4); if (num > 0 && num < text.Length - 3) { title = text.Substring(0, num).Trim(); string text2 = text; int num2 = num + 3; artist = text2.Substring(num2, text2.Length - num2).Trim(); RemoveProviderArtist(source, ref artist); return; } int num3 = text.IndexOf(" - ", (StringComparison)4); if (num3 > 0 && num3 < text.Length - 3) { string text3 = text.Substring(0, num3).Trim(); string text2 = text; int num2 = num3 + 3; string text4 = text2.Substring(num2, text2.Length - num2).Trim(); title = text3; artist = text4; RemoveProviderArtist(source, ref artist); } } private static void RemoveProviderArtist(string source, ref string artist) { artist = SanitizeArtistForDisplay(artist, source); } private static string CleanTrackTitle(string title) { string[] array = new string[31] { " - YouTube Music", " | YouTube Music", " — YouTube Music", " • YouTube Music", " - YouTube", " | YouTube", " — YouTube", " • YouTube", " - Google Chrome", " | Google Chrome", " — Google Chrome", " - Chrome", " | Chrome", " — Chrome", " — Mozilla Firefox", " - Mozilla Firefox", " | Mozilla Firefox", " - Firefox", " | Firefox", " — Firefox", " - Microsoft Edge", " | Microsoft Edge", " — Microsoft Edge", " - Edge", " | Edge", " — Edge", " - VLC media player", " | VLC media player", " - Spotify", " | Spotify", " — Spotify" }; string text = (title ?? string.Empty).Trim(); bool flag = true; while (flag) { flag = false; string[] array2 = array; foreach (string text2 in array2) { if (text.EndsWith(text2, (StringComparison)5)) { string text3 = text; int length = text2.Length; text = text3.Substring(0, text3.Length - length).Trim(); flag = true; } } } return text; } private static string StripProviderAffixes(string value) { string text = value.Trim(); string[] array = new string[4] { " | ", " - ", " — ", " • " }; bool flag = true; while (flag && text.Length > 0) { flag = false; string[] providerLabels = ProviderLabels; foreach (string text2 in providerLabels) { if (string.Equals(text, text2, (StringComparison)5)) { return string.Empty; } string[] array2 = array; foreach (string text3 in array2) { string text4 = text3 + text2; if (text.EndsWith(text4, (StringComparison)5)) { string text5 = text; int length = text4.Length; text = text5.Substring(0, text5.Length - length).Trim(); flag = true; break; } string text6 = text2 + text3; if (text.StartsWith(text6, (StringComparison)5)) { string text5 = text; int length = text6.Length; text = text5.Substring(length, text5.Length - length).Trim(); flag = true; break; } } if (flag) { break; } } } return text; } private static bool IsProviderLabel(string value) { string text = NormalizeProviderToken(value); if (text.Length == 0) { return true; } string[] providerLabels = ProviderLabels; foreach (string value2 in providerLabels) { if (string.Equals(text, NormalizeProviderToken(value2), (StringComparison)4)) { return true; } } return text.Contains("youtube", (StringComparison)4) || text.Contains("spotify", (StringComparison)4) || text.Contains("googlechrome", (StringComparison)4) || text.Contains("microsoftedge", (StringComparison)4) || text.Contains("mozillafirefox", (StringComparison)4); } private static string NormalizeProviderToken(string? value) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown if (string.IsNullOrWhiteSpace(value)) { return string.Empty; } StringBuilder val = new StringBuilder(value.Length); foreach (char c in value) { if (char.IsLetterOrDigit(c)) { val.Append(char.ToLowerInvariant(c)); } } return ((object)val).ToString(); } } internal static class WindowsGlobalMediaSession { private static readonly object Sync = new object(); private static object? _manager; private static System.Type? _managerType; private static bool _permanentlyUnavailable; internal static bool TryGetSnapshot(out WindowsMediaSnapshot snapshot) { //IL_006c: 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) snapshot = default(WindowsMediaSnapshot); try { object manager = GetManager(); if (manager == null) { return false; } List sessions = GetSessions(manager); if (sessions.Count == 0) { object obj = InvokeNoArguments(manager, "GetCurrentSession"); if (obj != null) { sessions.Add(obj); } } bool flag = false; int num = -2147483648; WindowsMediaSnapshot windowsMediaSnapshot = default(WindowsMediaSnapshot); Enumerator enumerator = sessions.GetEnumerator(); try { while (enumerator.MoveNext()) { object current = enumerator.Current; if (TryReadSession(current, out var snapshot2, out var score) && (!flag || score > num)) { flag = true; num = score; windowsMediaSnapshot = snapshot2; } } } finally { ((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } snapshot = windowsMediaSnapshot; return flag; } catch { return false; } } private static object? GetManager() { lock (Sync) { if (_manager != null) { return _manager; } if (_permanentlyUnavailable) { return null; } if (_managerType == null) { _managerType = ResolveManagerType(); } if (_managerType == (System.Type)null) { _permanentlyUnavailable = true; return null; } MethodInfo method = _managerType.GetMethod("RequestAsync", (BindingFlags)24, (Binder)null, System.Type.EmptyTypes, (ParameterModifier[])null); if (method == (MethodInfo)null) { _permanentlyUnavailable = true; return null; } object operation = ((MethodBase)method).Invoke((object)null, (object[])null); _manager = WaitForAsyncResult(operation, 2000); return _manager; } } private static System.Type? ResolveManagerType() { string[] array = new string[2] { "Windows.Media.Control.GlobalSystemMediaTransportControlsSessionManager, Windows, ContentType=WindowsRuntime", "Windows.Media.Control.GlobalSystemMediaTransportControlsSessionManager, Microsoft.Windows.SDK.NET" }; string[] array2 = array; foreach (string text in array2) { try { System.Type type = System.Type.GetType(text, false); if (type != (System.Type)null) { return type; } } catch { } } Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly val in assemblies) { try { System.Type type2 = val.GetType("Windows.Media.Control.GlobalSystemMediaTransportControlsSessionManager", false, false); if (type2 != (System.Type)null) { return type2; } } catch { } } return null; } private static List GetSessions(object manager) { List val = new List(); object obj = InvokeNoArguments(manager, "GetSessions"); if (obj == null) { return val; } if (obj is System.Collections.IEnumerable enumerable) { foreach (object item in enumerable) { if (item != null) { val.Add(item); } } return val; } System.Type type = obj.GetType(); int num = ReadInteger(obj, "Count", ReadInteger(obj, "Size", 0)); if (num <= 0 || num > 64) { return val; } MethodInfo method = type.GetMethod("GetAt", (BindingFlags)20); PropertyInfo property = type.GetProperty("Item", (BindingFlags)20); for (int i = 0; i < num; i++) { object obj2 = null; try { if (method != (MethodInfo)null) { obj2 = ((MethodBase)method).Invoke(obj, new object[1] { Convert.ChangeType((object)i, ((MethodBase)method).GetParameters()[0].ParameterType, (IFormatProvider)(object)CultureInfo.InvariantCulture) }); } else if (property != (PropertyInfo)null) { obj2 = property.GetValue(obj, new object[1] { i }); } } catch { obj2 = null; } if (obj2 != null) { val.Add(obj2); } } return val; } private static bool TryReadSession(object session, out WindowsMediaSnapshot snapshot, out int score) { snapshot = default(WindowsMediaSnapshot); score = 0; object source = InvokeNoArguments(session, "GetPlaybackInfo"); string text = ReadMember(source, "PlaybackStatus")?.ToString() ?? string.Empty; bool playbackKnown = false; bool isPlaying = false; if (text.Equals("Playing", (StringComparison)5)) { playbackKnown = true; isPlaying = true; score += 1000; } else if (text.Equals("Paused", (StringComparison)5) || text.Equals("Stopped", (StringComparison)5) || text.Equals("Closed", (StringComparison)5)) { playbackKnown = true; isPlaying = false; score += 700; } object operation = InvokeNoArguments(session, "TryGetMediaPropertiesAsync"); object obj = WaitForAsyncResult(operation, 1500); if (obj == null) { return false; } string title = ReadMember(obj, "Title")?.ToString()?.Trim() ?? string.Empty; string artist = ReadMember(obj, "Artist")?.ToString()?.Trim() ?? string.Empty; if (title.Length == 0) { return false; } string source2 = ReadMember(session, "SourceAppUserModelId")?.ToString() ?? string.Empty; if (artist.Length == 0) { ParseMissingArtist(source2, ref title, ref artist); } title = WindowsMediaControl.SanitizeTitleForDisplay(title); artist = WindowsMediaControl.SanitizeArtistForDisplay(artist, source2); if (title.Length == 0) { return false; } score += 100; snapshot = new WindowsMediaSnapshot(title, artist, playbackKnown, isPlaying); return true; } private static void ParseMissingArtist(string source, ref string title, ref string artist) { int num = title.IndexOf(" • ", (StringComparison)4); if (num > 0 && num < title.Length - 3) { string text = title; int num2 = num + 3; artist = text.Substring(num2, text.Length - num2).Trim(); title = title.Substring(0, num).Trim(); return; } int num3 = title.IndexOf(" - ", (StringComparison)4); if (num3 > 0 && num3 < title.Length - 3) { string text2 = title.Substring(0, num3).Trim(); string text = title; int num2 = num3 + 3; string text3 = text.Substring(num2, text.Length - num2).Trim(); title = text2; artist = text3; } } private static object? WaitForAsyncResult(object? operation, int timeoutMilliseconds) { if (operation == null) { return null; } if (operation is System.Threading.Tasks.Task task) { return WaitForTask(task, timeoutMilliseconds); } System.Threading.Tasks.Task task2 = TryConvertToTask(operation); if (task2 != null) { return WaitForTask(task2, timeoutMilliseconds); } Stopwatch val = Stopwatch.StartNew(); while (val.ElapsedMilliseconds < timeoutMilliseconds) { string text = ReadMember(operation, "Status")?.ToString() ?? string.Empty; if (text.Equals("Completed", (StringComparison)5)) { return InvokeNoArguments(operation, "GetResults"); } if (text.Equals("Canceled", (StringComparison)5) || text.Equals("Error", (StringComparison)5)) { return null; } Thread.Sleep(10); } return null; } private static System.Threading.Tasks.Task? TryConvertToTask(object operation) { System.Type type = operation.GetType(); Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly val in assemblies) { System.Type type2 = null; try { type2 = val.GetType("System.WindowsRuntimeSystemExtensions", false) ?? val.GetType("WinRT.WindowsRuntimeSystemExtensions", false); } catch { type2 = null; } if (type2 == (System.Type)null) { continue; } MethodInfo[] methods = type2.GetMethods((BindingFlags)24); foreach (MethodInfo val2 in methods) { if (!string.Equals(((MemberInfo)val2).Name, "AsTask", (StringComparison)4)) { continue; } ParameterInfo[] parameters = ((MethodBase)val2).GetParameters(); if (parameters.Length != 1) { continue; } try { MethodInfo val3 = val2; if (!((MethodBase)val2).IsGenericMethodDefinition) { goto IL_0127; } System.Type type3 = Enumerable.FirstOrDefault((System.Collections.Generic.IEnumerable)type.GetInterfaces(), (Func)((System.Type candidate) => candidate.IsGenericType && ((MemberInfo)candidate).Name.StartsWith("IAsyncOperation", (StringComparison)4))); if (type3 == (System.Type)null) { continue; } val3 = val2.MakeGenericMethod(new System.Type[1] { type3.GetGenericArguments()[0] }); goto IL_0127; IL_0127: if (((MethodBase)val3).Invoke((object)null, new object[1] { operation }) is System.Threading.Tasks.Task result) { return result; } } catch { } } } return null; } private static object? WaitForTask(System.Threading.Tasks.Task task, int timeoutMilliseconds) { try { if (!task.Wait(timeoutMilliseconds)) { return null; } PropertyInfo property = ((object)task).GetType().GetProperty("Result", (BindingFlags)20); return (property != null) ? property.GetValue((object)task) : null; } catch { return null; } } private static object? InvokeNoArguments(object? source, string methodName) { if (source == null) { return null; } try { MethodInfo method = source.GetType().GetMethod(methodName, (BindingFlags)52, (Binder)null, System.Type.EmptyTypes, (ParameterModifier[])null); return (method != null) ? ((MethodBase)method).Invoke(source, (object[])null) : null; } catch { return null; } } private static object? ReadMember(object? source, string memberName) { if (source == null) { return null; } try { System.Type type = source.GetType(); PropertyInfo property = type.GetProperty(memberName, (BindingFlags)52); if (property != (PropertyInfo)null && property.GetIndexParameters().Length == 0) { return property.GetValue(source); } FieldInfo field = type.GetField(memberName, (BindingFlags)52); return (field != null) ? field.GetValue(source) : null; } catch { return null; } } private static int ReadInteger(object source, string memberName, int fallback) { try { object obj = ReadMember(source, memberName); return (obj == null) ? fallback : Convert.ToInt32(obj, (IFormatProvider)(object)CultureInfo.InvariantCulture); } catch { return fallback; } } } internal static class ImperiumNativeMessageBridge { private sealed class ContactState { [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] internal string Key { [CompilerGenerated] get; [CompilerGenerated] init; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] internal string DisplayName { [CompilerGenerated] get; [CompilerGenerated] init; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] internal GameObject Root { [CompilerGenerated] get; [CompilerGenerated] init; } = null; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] internal NPC Npc { [CompilerGenerated] get; [CompilerGenerated] init; } = null; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] internal MSGConversation Conversation { [CompilerGenerated] get; [CompilerGenerated] init; } = null; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] internal Sprite Icon { [CompilerGenerated] get; [CompilerGenerated] init; } = null; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] internal HashSet ResponsePointers { [CompilerGenerated] get; } = new HashSet(); } private sealed class ResponseBinding { [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] internal ContactState State { [CompilerGenerated] get; [CompilerGenerated] init; } = null; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] internal ImperiumMessageChoice Choice { [CompilerGenerated] get; [CompilerGenerated] init; } = null; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] internal Action? OnChoiceSelected { [CompilerGenerated] get; [CompilerGenerated] init; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] internal Action NativeCallback { [CompilerGenerated] get; [CompilerGenerated] init; } = null; } private static readonly Dictionary ContactsByKey = new Dictionary((IEqualityComparer)(object)StringComparer.OrdinalIgnoreCase); private static readonly Dictionary ContactsByConversation = new Dictionary(); private static readonly Dictionary ResponseBindings = new Dictionary(); private static readonly HashSet LoggedDeliveryFailures = new HashSet((IEqualityComparer)(object)StringComparer.OrdinalIgnoreCase); private static MessagesApp? _messagesApp; private static bool _messagesAppReady; private static bool _patched; internal static void Patch(Harmony harmony) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Expected O, but got Unknown //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Expected O, but got Unknown if (_patched) { return; } MethodInfo val = AccessTools.Method(typeof(MSGConversation), "DisplayRelationshipInfo", (System.Type[])null, (System.Type[])null); if (val != (MethodInfo)null) { harmony.Patch((MethodBase)(object)val, new HarmonyMethod(typeof(ImperiumNativeMessageBridge), "SkipManagedRelationshipInfo", (System.Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo val2 = AccessTools.Method(typeof(MSGConversation), "ResponseChosen", (System.Type[])null, (System.Type[])null); if (val2 != (MethodInfo)null) { harmony.Patch((MethodBase)(object)val2, new HarmonyMethod(typeof(ImperiumNativeMessageBridge), "HandleManagedResponseChosen", (System.Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo val3 = AccessTools.Method(typeof(MessagesApp), "SetCurrentConversation", (System.Type[])null, (System.Type[])null); if (val3 != (MethodInfo)null) { harmony.Patch((MethodBase)(object)val3, (HarmonyMethod)null, new HarmonyMethod(typeof(ImperiumNativeMessageBridge), "RefreshManagedConversationChrome", (System.Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo val4 = AccessTools.DeclaredMethod(typeof(MessagesApp), "Loaded", (System.Type[])null, (System.Type[])null); if (val4 != (MethodInfo)null) { harmony.Patch((MethodBase)(object)val4, (HarmonyMethod)null, new HarmonyMethod(typeof(ImperiumNativeMessageBridge), "CaptureMessagesAppLoaded", (System.Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } else { Instance? modLogger = SIAKImperiumMod.ModLogger; if (modLogger != null) { modLogger.Warning("[Imperium] Stock Messages bridge could not locate MessagesApp.Loaded; messages will remain queued."); } } _patched = true; } internal static bool TryDeliver(ImperiumMessage message, Action? onChoiceSelected, out string error) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown error = string.Empty; try { if ((Object)(object)GetMessagesApp() == (Object)null) { error = "the stock Messages app is still loading"; LogDeliveryFailure(message, error); return false; } ContactState orCreateContact = GetOrCreateContact(message, out error); if (orCreateContact == null) { LogDeliveryFailure(message, error); return false; } Message val = new Message(FormatMessage(message), (ESenderType)1, true, -1); orCreateContact.Conversation.SendMessage(val, true, false); ConfigureMessageResponses(orCreateContact, message, onChoiceSelected); Instance? modLogger = SIAKImperiumMod.ModLogger; if (modLogger != null) { modLogger.Msg("[Imperium] Stock Messages delivered '" + orCreateContact.DisplayName + "'."); } return true; } catch (System.Exception ex) { error = ex.Message; LogDeliveryFailure(message, error); return false; } } private static void ConfigureMessageResponses(ContactState state, ImperiumMessage message, Action? onChoiceSelected) { //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Expected O, but got Unknown //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown ClearResponseBindings(state); state.Conversation.ClearResponses(false); if (message.Response != null || message.Choices == null || message.Choices.Count == 0) { return; } List val = new List(); int num = Math.Min(4, message.Choices.Count); for (int i = 0; i < num; i++) { ImperiumMessageChoice imperiumMessageChoice = message.Choices[i]; if (!string.IsNullOrWhiteSpace(imperiumMessageChoice.Id) && !string.IsNullOrWhiteSpace(imperiumMessageChoice.Text)) { ImperiumMessageChoice imperiumMessageChoice2 = new ImperiumMessageChoice { Id = imperiumMessageChoice.Id.Trim(), Text = imperiumMessageChoice.Text.Trim() }; Response val2 = new Response { label = imperiumMessageChoice2.Id, text = imperiumMessageChoice2.Text, disableDefaultResponseBehaviour = true }; System.IntPtr responsePointer = ((Il2CppObjectBase)val2).Pointer; Action val3 = (Action)delegate { CompleteManagedResponse(responsePointer); }; val2.callback = Action.op_Implicit(val3); ResponseBindings[responsePointer] = new ResponseBinding { State = state, Choice = imperiumMessageChoice2, OnChoiceSelected = onChoiceSelected, NativeCallback = val3 }; state.ResponsePointers.Add(responsePointer); val.Add(val2); } } if (val.Count > 0) { state.Conversation.ShowResponses(val, 0.25f, false); } } [Obfuscation(Exclude = true)] private static bool HandleManagedResponseChosen(MSGConversation __instance, Response __0) { if (!TryGetState(__instance, out ContactState _) || __0 == null) { return true; } if (!TryTakeResponseBinding(((Il2CppObjectBase)__0).Pointer, out ResponseBinding binding)) { return true; } CompleteManagedResponse(binding); return false; } private static void CompleteManagedResponse(System.IntPtr responsePointer) { if (TryTakeResponseBinding(responsePointer, out ResponseBinding binding)) { CompleteManagedResponse(binding); } } private static void CompleteManagedResponse(ResponseBinding binding) { try { binding.State.Conversation.ClearResponses(false); } catch (System.Exception ex) { Instance? modLogger = SIAKImperiumMod.ModLogger; if (modLogger != null) { modLogger.Warning("[Imperium] Could not clear message replies: " + ex.Message); } } try { Instance? modLogger2 = SIAKImperiumMod.ModLogger; if (modLogger2 != null) { modLogger2.Msg($"[Imperium] Message reply selected: '{binding.Choice.Text}' for '{binding.State.DisplayName}'."); } binding.OnChoiceSelected?.Invoke(binding.Choice); } catch (System.Exception ex2) { Instance? modLogger3 = SIAKImperiumMod.ModLogger; if (modLogger3 != null) { modLogger3.Warning("[Imperium] Message reply callback failed: " + ex2.Message); } } } private static bool TryTakeResponseBinding(System.IntPtr responsePointer, out ResponseBinding binding) { if (!ResponseBindings.TryGetValue(responsePointer, ref binding)) { return false; } ResponseBindings.Remove(responsePointer); binding.State.ResponsePointers.Remove(responsePointer); ClearResponseBindings(binding.State); return true; } private static void ClearResponseBindings(ContactState state) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) Enumerator enumerator = state.ResponsePointers.GetEnumerator(); try { while (enumerator.MoveNext()) { System.IntPtr current = enumerator.Current; ResponseBindings.Remove(current); } } finally { ((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } state.ResponsePointers.Clear(); } internal static void Reset() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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) //IL_0021: Unknown result type (might be due to invalid IL or missing references) try { List conversations = MessagesApp.Conversations; if (conversations != null) { Enumerator enumerator = ContactsByKey.Values.GetEnumerator(); try { while (enumerator.MoveNext()) { ContactState current = enumerator.Current; conversations.Remove(current.Conversation); } } finally { ((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } } } catch { } Enumerator enumerator2 = ContactsByKey.Values.GetEnumerator(); try { while (enumerator2.MoveNext()) { ContactState current2 = enumerator2.Current; if ((Object)(object)current2.Root != (Object)null) { Object.Destroy((Object)(object)current2.Root); } } } finally { ((System.IDisposable)enumerator2/*cast due to .constrained prefix*/).Dispose(); } ContactsByKey.Clear(); ContactsByConversation.Clear(); ResponseBindings.Clear(); LoggedDeliveryFailures.Clear(); _messagesApp = null; _messagesAppReady = false; } private static ContactState? GetOrCreateContact(ImperiumMessage message, out string error) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) error = string.Empty; string text = BuildContactKey(message); ContactState result = default(ContactState); if (ContactsByKey.TryGetValue(text, ref result)) { return result; } Sprite val = ResolveMessagePortrait(message); if ((Object)(object)val == (Object)null) { error = "the embedded message portrait could not be loaded"; return null; } string text2 = ResolveDisplayName(message); GameObject val2 = null; try { val2 = CreateNativeMessageNpcRoot(); NPC component = val2.GetComponent(); if ((Object)(object)component == (Object)null) { throw new InvalidOperationException("The Schedule I civilian message prefab has no NPC component."); } NPCData nPCData = component.NPCData; if (((nPCData != null) ? nPCData.BasicInfo : null) == null || nPCData.Appearance == null || nPCData.Messaging == null) { throw new InvalidOperationException("The Schedule I civilian message prefab has no runtime NPC data."); } nPCData.BasicInfo.ID = $"siak_phone_{Guid.NewGuid():N}"; Guid val3 = Guid.NewGuid(); component.BakedGUID = ((Guid)(ref val3)).ToString("N"); nPCData.BasicInfo.FirstName = text2; nPCData.BasicInfo.LastName = string.Empty; nPCData.BasicInfo.HasLastName = false; nPCData.Appearance.Mugshot = val; List val4 = new List(); val4.Add((EConversationCategory)0); Il2CppStructArray val5 = new Il2CppStructArray(1L); ((Il2CppArrayBase)(object)val5)[0] = (EConversationCategory)0; nPCData.Messaging.ConversationCategories = val5; nPCData.Messaging.ConversationCanBeHidden = true; RemoveFromNpcRegistry(component); component.CreateMessageConversation(); MSGConversation mSGConversation = component.MSGConversation; if (mSGConversation == null) { throw new InvalidOperationException("Schedule I did not create the message conversation."); } RemoveFromNpcRegistry(component); mSGConversation.contactName = text2; mSGConversation.SetCategories(val4); mSGConversation.SetIsKnown(true); ContactState contactState = new ContactState { Key = text, DisplayName = text2, Root = val2, Npc = component, Conversation = mSGConversation, Icon = val }; ContactsByKey[text] = contactState; ContactsByConversation[((Il2CppObjectBase)mSGConversation).Pointer] = contactState; return contactState; } catch (System.Exception ex) { if ((Object)(object)val2 != (Object)null) { Object.Destroy((Object)(object)val2); } error = ex.Message; return null; } } private static GameObject CreateNativeMessageNpcRoot() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = InstanceFinder.NetworkManager; PrefabObjects val = ((networkManager != null) ? networkManager.SpawnablePrefabs : null); if ((Object)(object)val == (Object)null) { throw new InvalidOperationException("Schedule I's NPC prefab catalogue is not ready yet."); } GameObject val2 = null; for (int i = 0; i < val.GetObjectCount(); i++) { NetworkObject val3 = val.GetObject(true, i); GameObject val4 = ((val3 != null) ? ((Component)val3).gameObject : null); if (!((Object)(object)val4 == (Object)null) && !((Object)(object)val4.GetComponent() == (Object)null)) { if (string.Equals(((Object)val4).name, "CivilianNPC", (StringComparison)4)) { return CreateHiddenPrefabClone(val4); } if (val2 == null) { val2 = val4; } } } if ((Object)(object)val2 == (Object)null) { throw new InvalidOperationException("Schedule I did not expose a civilian NPC prefab for Messages."); } return CreateHiddenPrefabClone(val2); } private static GameObject CreateHiddenPrefabClone(GameObject prefab) { GameObject val = Object.Instantiate(prefab); ((Object)val).name = $"ImperiumNativeMessage_{ContactsByKey.Count + 1}"; ((Object)val).hideFlags = (HideFlags)61; val.SetActive(false); return val; } private static void RemoveFromNpcRegistry(NPC npc) { List nPCRegistry = NPCManager.NPCRegistry; if (nPCRegistry == null) { return; } for (int num = nPCRegistry.Count - 1; num >= 0; num--) { if ((Object)(object)nPCRegistry[num] == (Object)(object)npc) { nPCRegistry.RemoveAt(num); } } } private static Sprite? ResolveMessagePortrait(ImperiumMessage message) { if (NormalizeIconKey(message.IconKey) != "npc_random") { return ImperiumAssets.LoadMessageSprite(message.IconKey); } try { List nPCRegistry = NPCManager.NPCRegistry; if (nPCRegistry != null) { List val = new List(); Enumerator enumerator = nPCRegistry.GetEnumerator(); while (enumerator.MoveNext()) { NPC current = enumerator.Current; if (!((Object)(object)current == (Object)null) && !((Object)(object)current.MugshotSprite == (Object)null) && (string.IsNullOrWhiteSpace(current.ID) || !current.ID.StartsWith("siak_phone_", (StringComparison)5))) { val.Add(current.MugshotSprite); } } if (val.Count > 0) { return val[Random.Range(0, val.Count)]; } } } catch (System.Exception ex) { Instance? modLogger = SIAKImperiumMod.ModLogger; if (modLogger != null) { modLogger.Warning("[Imperium] Could not select a native NPC mugshot: " + ex.Message); } } return ImperiumAssets.LoadMessageSprite("player"); } private static MessagesApp? GetMessagesApp() { if ((Object)(object)_messagesApp != (Object)null && IsMessagesAppReady(_messagesApp)) { return _messagesApp; } try { MessagesApp instance = PlayerSingleton.Instance; if ((Object)(object)instance != (Object)null && IsMessagesAppReady(instance)) { _messagesApp = instance; _messagesAppReady = true; return instance; } } catch { } _messagesApp = null; _messagesAppReady = false; return null; } [Obfuscation(Exclude = true)] private static void CaptureMessagesAppLoaded(MessagesApp __instance) { if (!((Object)(object)__instance == (Object)null)) { _messagesApp = __instance; _messagesAppReady = IsMessagesAppReady(__instance); } } private static bool IsMessagesAppReady(MessagesApp? app) { if ((Object)(object)app == (Object)null || MessagesApp.Conversations == null || MessagesApp.ActiveConversations == null || app.unreadConversations == null || (Object)(object)app.mainMessagesUIScreen == (Object)null || (Object)(object)app.mainMessagesUIPanel == (Object)null) { return false; } try { MessagesApp instance = PlayerSingleton.Instance; return (Object)(object)instance != (Object)null && ((Il2CppObjectBase)instance).Pointer == ((Il2CppObjectBase)app).Pointer; } catch { return false; } } private static void LogDeliveryFailure(ImperiumMessage message, string error) { string text = message.Id + "|" + error; if (LoggedDeliveryFailures.Add(text)) { Instance? modLogger = SIAKImperiumMod.ModLogger; if (modLogger != null) { modLogger.Warning("[Imperium] Stock Messages delivery waiting for '" + ResolveDisplayName(message) + "': " + error); } } } private static string BuildContactKey(ImperiumMessage message) { string text = NormalizeIconKey(message.IconKey); string text2 = message.ConversationId?.Trim() ?? string.Empty; if (IsRansomwareConversation(message, text2)) { if (text2.StartsWith("virus:ransomware:", (StringComparison)5)) { return text2.ToLowerInvariant(); } return "virus:ransomware:" + NormalizeKey(ResolveDisplayName(message)); } if (!string.IsNullOrWhiteSpace(text2)) { return text2.ToLowerInvariant(); } if (!string.IsNullOrWhiteSpace(message.ContactId)) { return message.ContactId.Trim().ToLowerInvariant(); } return (text == "player") ? ("player:" + NormalizeKey(ResolveDisplayName(message))) : ("system:" + text); } private static bool IsRansomwareConversation(ImperiumMessage message, string conversationId) { if (conversationId.StartsWith("virus:ransomware:", (StringComparison)5)) { return true; } if (!conversationId.StartsWith("virus:", (StringComparison)5)) { return false; } string text = $"{message.Title}\n{message.SenderName}\n{message.Body}"; return text.IndexOf("ransomware", (StringComparison)5) >= 0 || text.IndexOf("recovery key", (StringComparison)5) >= 0 || text.IndexOf("device recovery", (StringComparison)5) >= 0 || text.IndexOf("device remains encrypted", (StringComparison)5) >= 0 || text.IndexOf("device is currently unavailable", (StringComparison)5) >= 0; } private static string ResolveDisplayName(ImperiumMessage message) { string text = NormalizeIconKey(message.IconKey); if (text.StartsWith("installed-app:", (StringComparison)5)) { return string.IsNullOrWhiteSpace(message.SenderName) ? "Installed Application" : message.SenderName.Trim(); } return (text == "srt") ? "Imperium S.R.D" : ((text == "player") ? (string.IsNullOrWhiteSpace(message.SenderName) ? "Player" : message.SenderName.Trim()) : ((text == "npc_random") ? (string.IsNullOrWhiteSpace(message.SenderName) ? "Unknown Sender" : message.SenderName.Trim()) : ((text == "virus_basic") ? (string.IsNullOrWhiteSpace(message.SenderName) ? "Unknown Sender" : message.SenderName.Trim()) : ((text == "virus_premium") ? (string.IsNullOrWhiteSpace(message.SenderName) ? "Unknown Sender" : message.SenderName.Trim()) : ((!(text == "antivirus")) ? "S.I.A.K Imperium" : "Advanced Anti Virus"))))); } private static string NormalizeIconKey(string? iconKey) { string text = iconKey?.Trim().ToLowerInvariant() ?? string.Empty; if (text.StartsWith("installed-app:", (StringComparison)4)) { return text; } return (text == "srt") ? "srt" : ((text == "player") ? "player" : ((text == "npc_random") ? "npc_random" : ((text == "virus_basic") ? "virus_basic" : ((text == "virus_premium") ? "virus_premium" : ((!(text == "antivirus")) ? "siak" : "antivirus"))))); } private static string NormalizeKey(string value) { char[] array = value.Trim().ToLowerInvariant().ToCharArray(); for (int i = 0; i < array.Length; i++) { if (!char.IsLetterOrDigit(array[i])) { array[i] = '_'; } } return new string(array); } private static string FormatMessage(ImperiumMessage message) { string text = (string.IsNullOrWhiteSpace(message.Body) ? "No message body was provided." : message.Body.Trim()); System.DateTime dateTime = System.DateTime.Now; System.DateTime dateTime2 = default(System.DateTime); if (System.DateTime.TryParse(message.CreatedAt, (IFormatProvider)(object)CultureInfo.InvariantCulture, (DateTimeStyles)71, ref dateTime2)) { dateTime = dateTime2.ToLocalTime(); } return $"{text}\n\n{dateTime:yyyy/MM/dd HH:mm}"; } [Obfuscation(Exclude = true)] private static bool SkipManagedRelationshipInfo(MSGConversation __instance) { return !IsManagedConversation(__instance); } [Obfuscation(Exclude = true)] private static void RefreshManagedConversationChrome(MessagesApp __instance, MSGConversation __0) { if (TryGetState(__0, out ContactState state)) { if ((Object)(object)__instance.iconImage != (Object)null) { __instance.iconImage.sprite = state.Icon; } if ((Object)(object)__instance.dialoguePageNameText != (Object)null) { __instance.dialoguePageNameText.text = state.DisplayName; } Hide(__instance.relationshipContainer); Hide(__instance.debtContainer); Hide(__instance.standardsContainer); ApplyIcon(__0.entry, state.Icon); ApplyIcon(__0.container, state.Icon); } } private static bool IsManagedConversation(MSGConversation? conversation) { return conversation != null && ContactsByConversation.ContainsKey(((Il2CppObjectBase)conversation).Pointer); } private static bool TryGetState(MSGConversation? conversation, out ContactState state) { if (conversation != null && ContactsByConversation.TryGetValue(((Il2CppObjectBase)conversation).Pointer, ref state)) { return true; } state = null; return false; } private static void Hide(RectTransform? rect) { if ((Object)(object)rect != (Object)null) { ((Component)rect).gameObject.SetActive(false); } } private static void ApplyIcon(RectTransform? root, Sprite icon) { if (!((Object)(object)root == (Object)null) && !((Object)(object)icon == (Object)null)) { ApplyIcon(((Component)root).transform, icon); ApplyIcon(((Transform)root).Find("Icon"), icon); ApplyIcon(((Transform)root).Find("IconMask/Icon"), icon); } } private static void ApplyIcon(Transform? target, Sprite icon) { if (!((Object)(object)target == (Object)null)) { Image component = ((Component)target).GetComponent(); if (!((Object)(object)component == (Object)null)) { component.sprite = icon; ((Behaviour)component).enabled = true; } } } } public sealed class ImperiumNotepadApp : PhoneApp { private static ImperiumNotepadApp? _instance; private static GameObject? _iconRoot; private static readonly Action OpenFromLauncherAction = new Action(OpenFromLauncher); protected override string AppName => "SIAKNotepadApp"; protected override string AppTitle => "Notepad"; protected override string IconLabel => "Notepad"; protected override string IconFileName => string.Empty; protected override Sprite? IconSprite => ImperiumAssets.LoadNotepadAppIconSprite(); protected override EOrientation Orientation => (EOrientation)1; protected override void OnCreatedUI(GameObject container) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) _instance = this; GameObject val = UIFactory.Panel("NotepadRoot", container.transform, ImperiumNotepadAppController.Paper, (Vector2?)null, (Vector2?)null, true); ImperiumNotepadAppController imperiumNotepadAppController = val.AddComponent(); imperiumNotepadAppController.Initialize(val, container); RefreshAvailability(SIAKImperiumMod.Service.GetSnapshot().Notepad); } internal static bool TryOpenInstalled() { ImperiumNotepadStatus notepad = SIAKImperiumMod.Service.GetSnapshot().Notepad; if (_instance == null || !notepad.Enabled || !ImperiumAppStoreManager.IsInstalled("SIAKNotepadApp")) { return false; } ((PhoneApp)_instance).OpenApp(); return true; } internal static void RefreshAvailability(ImperiumNotepadStatus notepad) { ApplyLauncherVisibility(notepad.Enabled && ImperiumAppStoreManager.IsInstalled("SIAKNotepadApp")); } internal static void ApplyLauncherVisibility(bool visible) { if (_instance != null) { _iconRoot = ImperiumPhoneLauncherRecovery.Ensure(_iconRoot, "SIAKNotepadApp", "Notepad", ImperiumAssets.LoadNotepadAppIconSprite(), OpenFromLauncherAction); if ((Object)(object)_iconRoot != (Object)null) { _iconRoot.SetActive(visible); } } } internal static void RefreshAvailabilityFromService() { ImperiumService service = SIAKImperiumMod.Service; if (service != null) { ImperiumAppStoreManager.RefreshNotepadAvailability(); RefreshAvailability(service.GetSnapshot().Notepad); } } private static void OpenFromLauncher() { TryOpenInstalled(); } } internal sealed class ImperiumNotepadAppController : MonoBehaviour { private const int MaxNotes = 50; private const int MaxTitleLength = 60; private const int MaxBodyLength = 2000; private const float DraftSaveDelaySeconds = 0.65f; private const string LocalNotesFolderName = "SIAKImperium"; private const string LocalNotesFileName = "notepad-notes.json"; private static readonly Color Accent = new Color(0.08f, 0.09f, 0.11f); internal static readonly Color Paper = new Color(1f, 82f / 85f, 0.5882353f); private static readonly Color Panel = new Color(0.96f, 0.9f, 0.42f); private static readonly Color Normal = new Color(1f, 0.985f, 0.72f); private RectTransform? _portraitContainer; private RectTransform? _portraitRoot; private Vector2 _lastPortraitContainerSize; private GameObject? _libraryView; private GameObject? _editorView; private RectTransform? _noteList; private InputField? _titleInput; private InputField? _bodyInput; private int _bodyFocusFrame = -1; private string _draftSignature = string.Empty; private float _draftSaveAt = -1f; private readonly List _notes = new List(); private string _selectedNoteId = string.Empty; private bool _initialized; private bool _editorOpen; public ImperiumNotepadAppController(System.IntPtr pointer) : base(pointer) { } public void Initialize(GameObject root, GameObject container) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00e1: 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_0140: 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_0154: 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_0186: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: 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_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0343: 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_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Expected O, but got Unknown //IL_0378: 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_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_040a: 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) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_0468: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_04aa: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Unknown result type (might be due to invalid IL or missing references) //IL_04dc: 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_0507: Unknown result type (might be due to invalid IL or missing references) //IL_050c: Unknown result type (might be due to invalid IL or missing references) //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_0540: Unknown result type (might be due to invalid IL or missing references) //IL_0551: Unknown result type (might be due to invalid IL or missing references) //IL_0556: 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_057b: Unknown result type (might be due to invalid IL or missing references) //IL_058a: Unknown result type (might be due to invalid IL or missing references) //IL_058f: 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_05c1: Unknown result type (might be due to invalid IL or missing references) //IL_05dd: Unknown result type (might be due to invalid IL or missing references) //IL_05ec: Unknown result type (might be due to invalid IL or missing references) //IL_05f1: Unknown result type (might be due to invalid IL or missing references) //IL_05f6: Unknown result type (might be due to invalid IL or missing references) //IL_063b: Unknown result type (might be due to invalid IL or missing references) //IL_064a: Unknown result type (might be due to invalid IL or missing references) //IL_064f: Unknown result type (might be due to invalid IL or missing references) //IL_0654: Unknown result type (might be due to invalid IL or missing references) //IL_0692: 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_06c1: Unknown result type (might be due to invalid IL or missing references) //IL_06c6: Unknown result type (might be due to invalid IL or missing references) //IL_06cb: Unknown result type (might be due to invalid IL or missing references) //IL_06df: Unknown result type (might be due to invalid IL or missing references) //IL_06e9: Expected O, but got Unknown //IL_06f3: Unknown result type (might be due to invalid IL or missing references) //IL_06fd: Expected O, but got Unknown //IL_0706: Unknown result type (might be due to invalid IL or missing references) //IL_0710: Expected O, but got Unknown _portraitRoot = root.GetComponent(); _portraitContainer = container.GetComponent(); ApplyPortraitCanvasLayout(force: true); _libraryView = UIFactory.Panel("NotepadLibrary", root.transform, Color.black, (Vector2?)null, (Vector2?)null, true); ValueTuple val = UIFactory.RoundedButtonWithLabel("NotepadExit", "Exit", _libraryView.transform, new Color(0.24f, 0.23f, 0.16f), 88f, 38f, 16, Paper); GameObject item = val.Item1; Button item2 = val.Item2; Stretch(item.GetComponent(), new Vector2(0.05f, 0.915f), new Vector2(0.23f, 0.98f), Vector2.zero, Vector2.zero); GameObject val2 = UIFactory.Panel("NotepadLibraryLogo", _libraryView.transform, Color.clear, (Vector2?)null, (Vector2?)null, false); Image component = val2.GetComponent(); component.sprite = ImperiumAssets.LoadNotepadLogoSprite(); ((Graphic)component).color = Color.white; component.preserveAspect = true; ((Graphic)component).raycastTarget = false; Stretch(val2.GetComponent(), new Vector2(0.34f, 0.915f), new Vector2(0.44f, 0.985f), Vector2.zero, Vector2.zero); Text val3 = UIFactory.Text("NotepadHeading", "Notepad", _libraryView.transform, 28, (TextAnchor)3, (FontStyle)1); ((Graphic)val3).color = Paper; Stretch(((Component)val3).GetComponent(), new Vector2(0.445f, 0.915f), new Vector2(0.78f, 0.985f), Vector2.zero, Vector2.zero); GameObject val4 = UIFactory.Panel("NotepadListPanel", _libraryView.transform, Panel, (Vector2?)null, (Vector2?)null, false); Stretch(val4.GetComponent(), new Vector2(0.05f, 0.12f), new Vector2(0.95f, 0.88f), Vector2.zero, Vector2.zero); Text val5 = UIFactory.Text("NotepadListTitle", "Your Notes", val4.transform, 19, (TextAnchor)3, (FontStyle)1); ((Graphic)val5).color = Accent; Stretch(((Component)val5).GetComponent(), new Vector2(0.05f, 0.91f), new Vector2(0.95f, 0.985f), Vector2.zero, Vector2.zero); _noteList = CreateScrollableVerticalList("NotepadList", val4.transform); StretchScrollableList(_noteList, new Vector2(0.025f, 0.025f), new Vector2(0.975f, 0.89f), Vector2.zero, Vector2.zero); ValueTuple val6 = UIFactory.RoundedButtonWithLabel("NotepadAdd", "+", _libraryView.transform, new Color(0.24f, 0.23f, 0.16f), 64f, 56f, 32, Paper); GameObject item3 = val6.Item1; Button item4 = val6.Item2; Stretch(item3.GetComponent(), new Vector2(0.8f, 0.025f), new Vector2(0.95f, 0.105f), Vector2.zero, Vector2.zero); ButtonUtils.AddListener(item4, new Action(CreateNewNote)); _editorView = UIFactory.Panel("NotepadEditor", root.transform, Color.black, (Vector2?)null, (Vector2?)null, true); ValueTuple val7 = UIFactory.RoundedButtonWithLabel("NotepadBack", "Back", _editorView.transform, new Color(0.78f, 0.8f, 0.84f), 96f, 38f, 17, Accent); GameObject item5 = val7.Item1; Button item6 = val7.Item2; Stretch(item5.GetComponent(), new Vector2(0.05f, 0.915f), new Vector2(0.25f, 0.98f), Vector2.zero, Vector2.zero); GameObject val8 = UIFactory.Panel("NotepadEditorLogo", _editorView.transform, Color.clear, (Vector2?)null, (Vector2?)null, false); Image component2 = val8.GetComponent(); component2.sprite = ImperiumAssets.LoadNotepadLogoSprite(); ((Graphic)component2).color = Color.white; component2.preserveAspect = true; ((Graphic)component2).raycastTarget = false; Stretch(val8.GetComponent(), new Vector2(0.34f, 0.915f), new Vector2(0.44f, 0.985f), Vector2.zero, Vector2.zero); Text val9 = UIFactory.Text("NotepadEditorHeading", "Notepad", _editorView.transform, 28, (TextAnchor)3, (FontStyle)1); ((Graphic)val9).color = Paper; Stretch(((Component)val9).GetComponent(), new Vector2(0.445f, 0.915f), new Vector2(0.78f, 0.985f), Vector2.zero, Vector2.zero); ValueTuple val10 = UIFactory.RoundedButtonWithLabel("NotepadDelete", "Delete", _editorView.transform, new Color(0.72f, 0.13f, 0.14f), 130f, 38f, 15, Color.white); GameObject item7 = val10.Item1; Button item8 = val10.Item2; Stretch(item7.GetComponent(), new Vector2(0.68f, 0.915f), new Vector2(0.95f, 0.98f), Vector2.zero, Vector2.zero); Text val11 = UIFactory.Text("NotepadTitleLabel", "Title", _editorView.transform, 21, (TextAnchor)3, (FontStyle)1); ((Graphic)val11).color = Paper; Stretch(((Component)val11).GetComponent(), new Vector2(0.06f, 0.845f), new Vector2(0.94f, 0.895f), Vector2.zero, Vector2.zero); _titleInput = CreateInputField("NotepadTitleInput", _editorView.transform, "Untitled note", 27, multiline: false, 60); Stretch(((Component)_titleInput).GetComponent(), new Vector2(0.05f, 0.755f), new Vector2(0.95f, 0.84f), Vector2.zero, Vector2.zero); _bodyInput = CreateInputField("NotepadBodyInput", _editorView.transform, string.Empty, 25, multiline: true, 2000); ((Graphic)((Component)_bodyInput).GetComponent()).color = Panel; Stretch(((Component)_bodyInput).GetComponent(), new Vector2(0.05f, 0.1f), new Vector2(0.95f, 0.735f), Vector2.zero, Vector2.zero); ButtonUtils.AddListener(item6, new Action(ReturnToLibrary)); ButtonUtils.AddListener(item8, new Action(DeleteCurrentNote)); ButtonUtils.AddListener(item2, new Action(ExitNotepad)); LoadNotes(); _initialized = true; ShowLibrary(); } private void Update() { bool flag = ApplyPortraitCanvasLayout(force: false); if (!_editorOpen) { if (flag) { RenderNoteList(); } return; } if (_bodyFocusFrame >= 0 && Time.frameCount >= _bodyFocusFrame) { _bodyFocusFrame = -1; FocusBodyInput(); } SaveEditorDraftAfterTypingPause(); } private void OnEnable() { if (!_initialized) { return; } try { if (PlayerSingleton.InstanceExists) { PlayerSingleton.Instance.SetIsHorizontal(false); } } catch { } ApplyPortraitCanvasLayout(force: true); LoadNotes(); ShowLibrary(); } private void OnDisable() { _bodyFocusFrame = -1; _draftSaveAt = -1f; if (_editorOpen) { SaveEditorDraft(); } if ((Object)(object)_titleInput != (Object)null) { _titleInput.DeactivateInputField(); ImperiumAppController.NotifyImperiumInputDeactivated(_titleInput); } if ((Object)(object)_bodyInput != (Object)null) { _bodyInput.DeactivateInputField(); ImperiumAppController.NotifyImperiumInputDeactivated(_bodyInput); } } private void LoadNotes() { _notes.Clear(); HashSet knownIds = new HashSet((IEqualityComparer)(object)StringComparer.Ordinal); bool flag = File.Exists(GetLocalNotesFilePath()); if (flag) { try { AppendNotesFromJson(File.ReadAllText(GetLocalNotesFilePath()), knownIds); } catch (System.Exception ex) { SIAKImperiumMod.LogUi("Notepad file read failed: " + ex.Message); } } try { AppendNotesFromJson(SIAKImperiumMod.LocalNotepadNotes?.Value ?? "[]", knownIds); } catch (System.Exception ex2) { SIAKImperiumMod.LogUi("Notepad preference read failed: " + ex2.Message); } SortNotes(); if (_notes.Count > 50) { _notes.RemoveRange(50, _notes.Count - 50); } if (!flag || _notes.Count > 0) { PersistNotes(); } RenderNoteList(); } private void CreateNewNote() { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) if (_notes.Count >= 50) { SetStatus($"Notepad supports up to {50} local notes.", new Color(1f, 0.68f, 0.35f)); return; } Guid val = Guid.NewGuid(); _selectedNoteId = ((Guid)(ref val)).ToString("N"); if ((Object)(object)_titleInput != (Object)null) { _titleInput.text = string.Empty; } if ((Object)(object)_bodyInput != (Object)null) { _bodyInput.text = string.Empty; } ShowEditor(); } private void SelectNote(string noteId) { ImperiumLocalNote imperiumLocalNote = FindNote(noteId); if (imperiumLocalNote == null) { SIAKImperiumMod.LogUi("Notepad ignored a stale note-card click."); return; } _selectedNoteId = imperiumLocalNote.Id; if ((Object)(object)_titleInput != (Object)null) { _titleInput.text = imperiumLocalNote.Title; } if ((Object)(object)_bodyInput != (Object)null) { _bodyInput.text = imperiumLocalNote.Body; } ShowEditor(); } private void ReturnToLibrary() { //IL_006b: 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) InputField? titleInput = _titleInput; string text = (((titleInput != null) ? titleInput.text : null) ?? string.Empty).Trim(); InputField? bodyInput = _bodyInput; string text2 = (((bodyInput != null) ? bodyInput.text : null) ?? string.Empty).Trim(); bool flag = SaveEditorDraft(); ShowLibrary(); if (flag) { SetStatus("Saved locally on this device.", new Color(0.42f, 0.9f, 0.58f)); } else if (!string.IsNullOrWhiteSpace(text) || !string.IsNullOrWhiteSpace(text2)) { SetStatus("Unable to save this note.", new Color(1f, 0.68f, 0.35f)); } } private void ExitNotepad() { if (_editorOpen) { SaveEditorDraft(); } if ((Object)(object)_titleInput != (Object)null) { _titleInput.DeactivateInputField(); ImperiumAppController.NotifyImperiumInputDeactivated(_titleInput); } if ((Object)(object)_bodyInput != (Object)null) { _bodyInput.DeactivateInputField(); ImperiumAppController.NotifyImperiumInputDeactivated(_bodyInput); } if (PlayerSingleton.InstanceExists && PlayerSingleton.Instance.IsOpen) { PlayerSingleton.Instance.RequestCloseApp(); } } [HideFromIl2Cpp] private bool SaveEditorDraft() { //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) InputField? titleInput = _titleInput; string text = (((titleInput != null) ? titleInput.text : null) ?? string.Empty).Trim(); InputField? bodyInput = _bodyInput; string text2 = (((bodyInput != null) ? bodyInput.text : null) ?? string.Empty).Trim(); if (string.IsNullOrWhiteSpace(text)) { text = "Untitled Note"; } ImperiumLocalNote imperiumLocalNote = FindNote(_selectedNoteId); if (imperiumLocalNote == null) { if (string.IsNullOrWhiteSpace(text2) && string.Equals(text, "Untitled Note", (StringComparison)4)) { return false; } ImperiumLocalNote imperiumLocalNote2 = new ImperiumLocalNote(); string id; if (!string.IsNullOrWhiteSpace(_selectedNoteId)) { id = _selectedNoteId; } else { Guid val = Guid.NewGuid(); id = ((Guid)(ref val)).ToString("N"); } imperiumLocalNote2.Id = id; imperiumLocalNote = imperiumLocalNote2; _notes.Add(imperiumLocalNote); _selectedNoteId = imperiumLocalNote.Id; } imperiumLocalNote.Title = ((text.Length > 60) ? text.Substring(0, 60) : text); imperiumLocalNote.Body = ((text2.Length > 2000) ? text2.Substring(0, 2000) : text2); imperiumLocalNote.UpdatedAt = System.DateTime.UtcNow.ToString("O", (IFormatProvider)(object)CultureInfo.InvariantCulture); return PersistNotes(); } [HideFromIl2Cpp] private void DeleteCurrentNote() { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrWhiteSpace(_selectedNoteId)) { ShowLibrary(); return; } int num = 0; for (int num2 = _notes.Count - 1; num2 >= 0; num2--) { if (string.Equals(_notes[num2].Id, _selectedNoteId, (StringComparison)4)) { _notes.RemoveAt(num2); num++; } } _selectedNoteId = string.Empty; if (num > 0 && PersistNotes()) { SetStatus("Note deleted from this device.", new Color(1f, 0.72f, 0.45f)); } if ((Object)(object)_titleInput != (Object)null) { _titleInput.text = string.Empty; } if ((Object)(object)_bodyInput != (Object)null) { _bodyInput.text = string.Empty; } ShowLibrary(); } private bool PersistNotes() { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) try { SortNotes(); if (_notes.Count > 50) { _notes.RemoveRange(50, _notes.Count - 50); } string text = JsonConvert.SerializeObject((object)_notes); WriteLocalNotesFile(text); try { SIAKImperiumMod.LocalNotepadNotes.Value = text; SIAKImperiumMod.ConfigCategory.SaveToFile(false); } catch (System.Exception ex) { SIAKImperiumMod.LogUi("Notepad preference backup failed: " + ex.Message); } return true; } catch (System.Exception ex2) { SIAKImperiumMod.LogUi("Notepad save failed: " + ex2.Message); SetStatus("Unable to save this note locally.", new Color(0.72f, 0.13f, 0.14f)); return false; } } private void RenderNoteList() { //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) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00e9: 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_0123: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: 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_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Expected O, but got Unknown if ((Object)(object)_noteList == (Object)null) { return; } ClearChildren((Transform)(object)_noteList); Transform parent = ((Transform)_noteList).parent; RectTransform val = (RectTransform)(object)((parent is RectTransform) ? parent : null); float num; if (val == null) { num = 0f; } else { Rect rect = val.rect; num = ((Rect)(ref rect)).height; } float num2 = Math.Max(220f, num); if (_notes.Count == 0) { Text val2 = UIFactory.Text("NotepadEmpty", "No notes yet. Press + to create one.", (Transform)(object)_noteList, 18, (TextAnchor)4, (FontStyle)2); ((Graphic)val2).color = new Color(0.3f, 0.33f, 0.38f); RectTransform component = ((Component)val2).GetComponent(); component.anchorMin = new Vector2(0f, 1f); component.anchorMax = new Vector2(1f, 1f); component.pivot = new Vector2(0.5f, 1f); component.anchoredPosition = new Vector2(0f, -8f); component.sizeDelta = new Vector2(-16f, Math.Max(180f, num2 - 16f)); _noteList.sizeDelta = new Vector2(0f, num2); } else { for (int i = 0; i < _notes.Count; i++) { ImperiumLocalNote imperiumLocalNote = _notes[i]; string text = (string.IsNullOrWhiteSpace(imperiumLocalNote.Title) ? "Untitled Note" : imperiumLocalNote.Title); string text2 = (string.IsNullOrWhiteSpace(imperiumLocalNote.Body) ? "Empty note" : imperiumLocalNote.Body.Replace("\r", " ").Replace("\n", " ").Trim()); if (text2.Length > 72) { text2 = text2.Substring(0, 72) + "..."; } ValueTuple val3 = UIFactory.RoundedButtonWithLabel("NotepadRow_" + imperiumLocalNote.Id, text + "\n" + text2, (Transform)(object)_noteList, Normal, 260f, 68f, 19, Accent); GameObject item = val3.Item1; Button item2 = val3.Item2; Text item3 = val3.Item3; RectTransform component2 = item.GetComponent(); component2.anchorMin = new Vector2(0f, 1f); component2.anchorMax = new Vector2(1f, 1f); component2.pivot = new Vector2(0.5f, 1f); component2.anchoredPosition = new Vector2(0f, 0f - (8f + (float)i * 98f)); component2.sizeDelta = new Vector2(-16f, 88f); item3.alignment = (TextAnchor)0; item3.horizontalOverflow = (HorizontalWrapMode)0; item3.verticalOverflow = (VerticalWrapMode)0; string noteId = imperiumLocalNote.Id; ButtonUtils.AddListener(item2, (Action)delegate { SelectNote(noteId); }); } _noteList.sizeDelta = new Vector2(0f, Math.Max(num2, 16f + (float)_notes.Count * 98f)); } _noteList.anchoredPosition = Vector2.zero; Canvas.ForceUpdateCanvases(); LayoutRebuilder.ForceRebuildLayoutImmediate(_noteList); if ((Object)(object)val != (Object)null) { LayoutRebuilder.ForceRebuildLayoutImmediate(val); } ScrollRect val4 = ((val != null) ? ((Component)val).GetComponent() : null); if ((Object)(object)val4 != (Object)null) { val4.StopMovement(); val4.verticalNormalizedPosition = 1f; } } private void ShowLibrary() { _editorOpen = false; _bodyFocusFrame = -1; _draftSaveAt = -1f; if ((Object)(object)_titleInput != (Object)null) { _titleInput.DeactivateInputField(); ImperiumAppController.NotifyImperiumInputDeactivated(_titleInput); } if ((Object)(object)_bodyInput != (Object)null) { _bodyInput.DeactivateInputField(); ImperiumAppController.NotifyImperiumInputDeactivated(_bodyInput); } if ((Object)(object)_editorView != (Object)null) { _editorView.SetActive(false); } if ((Object)(object)_libraryView != (Object)null) { _libraryView.SetActive(true); } RenderNoteList(); } private void ShowEditor() { _editorOpen = true; _bodyFocusFrame = Time.frameCount + 1; _draftSignature = BuildEditorDraftSignature(); _draftSaveAt = -1f; if ((Object)(object)_libraryView != (Object)null) { _libraryView.SetActive(false); } if ((Object)(object)_editorView != (Object)null) { _editorView.SetActive(true); } } private void FocusBodyInput() { if (!((Object)(object)_bodyInput == (Object)null) && ((Component)_bodyInput).gameObject.activeInHierarchy) { ((Selectable)_bodyInput).Select(); _bodyInput.ActivateInputField(); ImperiumAppController.NotifyImperiumInputActivated(_bodyInput); } } private void SaveEditorDraftAfterTypingPause() { string text = BuildEditorDraftSignature(); if (!string.Equals(text, _draftSignature, (StringComparison)4)) { _draftSignature = text; _draftSaveAt = Time.unscaledTime + 0.65f; } if (!(_draftSaveAt < 0f) && !(Time.unscaledTime < _draftSaveAt)) { _draftSaveAt = -1f; SaveEditorDraft(); } } private string BuildEditorDraftSignature() { InputField? titleInput = _titleInput; string obj = ((titleInput != null) ? titleInput.text : null) ?? string.Empty; InputField? bodyInput = _bodyInput; return obj + "\u001f" + (((bodyInput != null) ? bodyInput.text : null) ?? string.Empty); } [HideFromIl2Cpp] private void AppendNotesFromJson(string raw, HashSet knownIds) { List val = JsonConvert.DeserializeObject>(raw) ?? new List(); for (int i = 0; i < val.Count; i++) { ImperiumLocalNote imperiumLocalNote = val[i]; if (imperiumLocalNote != null) { ImperiumLocalNote imperiumLocalNote2 = NormaliseNote(imperiumLocalNote); if (string.IsNullOrWhiteSpace(imperiumLocalNote2.Id)) { imperiumLocalNote2.Id = BuildLegacyNoteId(imperiumLocalNote2, i); } if (knownIds.Add(imperiumLocalNote2.Id)) { _notes.Add(imperiumLocalNote2); } } } } [HideFromIl2Cpp] private static string BuildLegacyNoteId(ImperiumLocalNote note, int sourceIndex) { ulong num = 14695981039346656037uL; string text = string.Concat(new string[7] { sourceIndex.ToString((IFormatProvider)(object)CultureInfo.InvariantCulture), "\u001f", note.Title ?? string.Empty, "\u001f", note.Body ?? string.Empty, "\u001f", note.UpdatedAt ?? string.Empty }); for (int i = 0; i < text.Length; i++) { num ^= text[i]; num *= 1099511628211L; } return "legacy_" + num.ToString("x16", (IFormatProvider)(object)CultureInfo.InvariantCulture); } [HideFromIl2Cpp] private static string GetLocalNotesFilePath() { return Path.Combine(MelonEnvironment.UserDataDirectory, "SIAKImperium", "notepad-notes.json"); } [HideFromIl2Cpp] private static void WriteLocalNotesFile(string payload) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown string localNotesFilePath = GetLocalNotesFilePath(); string directoryName = Path.GetDirectoryName(localNotesFilePath); if (!string.IsNullOrWhiteSpace(directoryName)) { Directory.CreateDirectory(directoryName); } File.WriteAllText(localNotesFilePath, payload, (Encoding)new UTF8Encoding(false)); } [HideFromIl2Cpp] private ImperiumLocalNote? FindNote(string noteId) { if (string.IsNullOrWhiteSpace(noteId)) { return null; } for (int i = 0; i < _notes.Count; i++) { ImperiumLocalNote imperiumLocalNote = _notes[i]; if (string.Equals(imperiumLocalNote.Id, noteId, (StringComparison)4)) { return imperiumLocalNote; } } return null; } [HideFromIl2Cpp] private void SortNotes() { for (int i = 1; i < _notes.Count; i++) { ImperiumLocalNote imperiumLocalNote = _notes[i]; int num = i - 1; while (num >= 0 && string.Compare(_notes[num].UpdatedAt, imperiumLocalNote.UpdatedAt, (StringComparison)4) < 0) { _notes[num + 1] = _notes[num]; num--; } _notes[num + 1] = imperiumLocalNote; } } [HideFromIl2Cpp] private static ImperiumLocalNote NormaliseNote(ImperiumLocalNote note) { string text = (note.Id ?? string.Empty).Trim(); string text2 = (note.Title ?? string.Empty).Trim(); string text3 = (note.Body ?? string.Empty).Trim(); return new ImperiumLocalNote { Id = ((text.Length > 80) ? text.Substring(0, 80) : text), Title = ((text2.Length > 60) ? text2.Substring(0, 60) : text2), Body = ((text3.Length > 2000) ? text3.Substring(0, 2000) : text3), UpdatedAt = (string.IsNullOrWhiteSpace(note.UpdatedAt) ? System.DateTime.MinValue.ToString("O", (IFormatProvider)(object)CultureInfo.InvariantCulture) : note.UpdatedAt) }; } private void SetStatus(string message, Color color) { SIAKImperiumMod.LogUi("Notepad: " + message); } private bool ApplyPortraitCanvasLayout(bool force) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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_010e: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_portraitContainer == (Object)null || (Object)(object)_portraitRoot == (Object)null) { return false; } Canvas.ForceUpdateCanvases(); Rect rect = _portraitContainer.rect; Vector2 size = ((Rect)(ref rect)).size; if (size.x < 1f || size.y < 1f || (!force && Vector2.SqrMagnitude(size - _lastPortraitContainerSize) < 0.25f)) { return false; } _portraitRoot.anchorMin = Vector2.zero; _portraitRoot.anchorMax = Vector2.one; _portraitRoot.pivot = new Vector2(0.5f, 0.5f); _portraitRoot.sizeDelta = Vector2.zero; _portraitRoot.anchoredPosition = Vector2.zero; ((Transform)_portraitRoot).localRotation = Quaternion.identity; ((Transform)_portraitRoot).localScale = Vector3.one; _lastPortraitContainerSize = size; return true; } private static InputField CreateInputField(string name, Transform parent, string placeholderText, int fontSize, bool multiline, int characterLimit) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0105: 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_0154: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) GameObject val = UIFactory.Panel(name, parent, Normal, (Vector2?)null, (Vector2?)null, false); InputField val2 = val.AddComponent(); ((Selectable)val2).targetGraphic = (Graphic)(object)val.GetComponent(); ((Selectable)val2).interactable = true; val2.readOnly = false; val2.lineType = (LineType)(multiline ? 2 : 0); val2.characterLimit = characterLimit; val2.customCaretColor = true; val2.caretColor = Accent; val2.caretWidth = 2; if (multiline) { Mask val3 = val.AddComponent(); val3.showMaskGraphic = true; } Text val4 = UIFactory.Text("Text", string.Empty, val.transform, fontSize, (TextAnchor)((!multiline) ? 3 : 0), (FontStyle)0); val4.font = Resources.GetBuiltinResource("Arial.ttf"); ((Graphic)val4).raycastTarget = false; ((Graphic)val4).color = Accent; val4.horizontalOverflow = (HorizontalWrapMode)0; val4.verticalOverflow = (VerticalWrapMode)1; Stretch(((Component)val4).GetComponent(), Vector2.zero, Vector2.one, new Vector2(10f, 7f), new Vector2(-10f, -7f)); Text val5 = UIFactory.Text("Placeholder", placeholderText, val.transform, Math.Max(14, fontSize - 1), (TextAnchor)((!multiline) ? 3 : 0), (FontStyle)2); ((Graphic)val5).color = new Color(0.44f, 0.47f, 0.52f); ((Graphic)val5).raycastTarget = false; Stretch(((Component)val5).GetComponent(), Vector2.zero, Vector2.one, new Vector2(10f, 7f), new Vector2(-10f, -7f)); val2.textComponent = val4; val2.placeholder = (Graphic)(object)val5; ImperiumAppController.RegisterImperiumInput(val2); return val2; } private static RectTransform CreateScrollableVerticalList(string name, Transform parent) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: 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_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) GameObject val = UIFactory.Panel(name + "Viewport", parent, Color.clear, (Vector2?)null, (Vector2?)null, true); RectTransform component = val.GetComponent(); Stretch(component, Vector2.zero, Vector2.one, Vector2.zero, new Vector2(-14f, 0f)); Image component2 = val.GetComponent(); ((Graphic)component2).color = Color.white; ((Graphic)component2).raycastTarget = true; Mask val2 = val.AddComponent(); val2.showMaskGraphic = false; ScrollRect val3 = val.AddComponent(); val3.horizontal = false; val3.vertical = true; val3.movementType = (MovementType)2; val3.inertia = true; val3.scrollSensitivity = 28f; val3.viewport = component; GameObject val4 = UIFactory.Panel(name + "ScrollTrack", parent, new Color(0.72f, 0.74f, 0.78f), (Vector2?)null, (Vector2?)null, false); RectTransform component3 = val4.GetComponent(); Stretch(component3, new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(-10f, 6f), new Vector2(-2f, -6f)); Scrollbar val5 = val4.AddComponent(); ((Selectable)val5).targetGraphic = (Graphic)(object)val4.GetComponent(); val5.direction = (Direction)3; GameObject val6 = UIFactory.Panel("Handle", val4.transform, Accent, (Vector2?)null, (Vector2?)null, false); RectTransform component4 = val6.GetComponent(); component4.anchorMin = new Vector2(0f, 0.5f); component4.anchorMax = new Vector2(1f, 1f); component4.offsetMin = new Vector2(1f, 1f); component4.offsetMax = new Vector2(-1f, -1f); val5.handleRect = component4; val3.verticalScrollbar = val5; val3.verticalScrollbarVisibility = (ScrollbarVisibility)1; GameObject val7 = UIFactory.Panel(name, val.transform, Color.clear, (Vector2?)null, (Vector2?)null, false); RectTransform component5 = val7.GetComponent(); component5.anchorMin = new Vector2(0f, 1f); component5.anchorMax = new Vector2(1f, 1f); component5.pivot = new Vector2(0.5f, 1f); component5.anchoredPosition = Vector2.zero; component5.sizeDelta = Vector2.zero; ((Graphic)val7.GetComponent()).raycastTarget = false; val3.content = component5; return component5; } private static void StretchScrollableList(RectTransform content, Vector2 anchorMin, Vector2 anchorMax, Vector2 offsetMin, Vector2 offsetMax) { //IL_0037: 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) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) Transform parent = ((Transform)content).parent; RectTransform val = (RectTransform)(object)((parent is RectTransform) ? parent : null); Transform val2 = ((val != null) ? ((Transform)val).parent : null); if (!((Object)(object)val == (Object)null) && !((Object)(object)val2 == (Object)null)) { Stretch(val, anchorMin, anchorMax, offsetMin, new Vector2(offsetMax.x - 14f, offsetMax.y)); Transform obj = val2.Find(((Object)content).name + "ScrollTrack"); RectTransform val3 = (RectTransform)(object)((obj is RectTransform) ? obj : null); if ((Object)(object)val3 != (Object)null) { Stretch(val3, new Vector2(anchorMax.x, anchorMin.y), anchorMax, new Vector2(offsetMax.x - 10f, offsetMin.y + 6f), new Vector2(offsetMax.x - 2f, offsetMax.y - 6f)); } } } private static void ClearChildren(Transform parent) { for (int num = parent.childCount - 1; num >= 0; num--) { Object.DestroyImmediate((Object)(object)((Component)parent.GetChild(num)).gameObject); } } private static void Stretch(RectTransform rect, Vector2 anchorMin, Vector2 anchorMax, Vector2 offsetMin, Vector2 offsetMax) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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) rect.anchorMin = anchorMin; rect.anchorMax = anchorMax; rect.offsetMin = offsetMin; rect.offsetMax = offsetMax; } } internal sealed class ImperiumLocalNote { [JsonProperty("id")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Id { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("title")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Title { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("body")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Body { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonProperty("updated_at")] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string UpdatedAt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; } internal static class ImperiumNotificationSound { private const string SoundAssetPath = "sounds/notification.wav"; private static AudioSource? _source; private static AudioClip? _clip; private static bool _initialised; private static bool _reportedFailure; internal static void Play() { try { float num = Mathf.Clamp01((float)(SIAKImperiumMod.NotificationVolumePercent?.Value ?? 40) / 100f); if (!(num <= 0f)) { EnsureReady(); if ((Object)(object)_source != (Object)null && (Object)(object)_clip != (Object)null) { _source.PlayOneShot(_clip, num); } } } catch (System.Exception ex) { MelonPreferences_Entry debugLogging = SIAKImperiumMod.DebugLogging; if (!_reportedFailure && debugLogging != null && debugLogging.Value) { _reportedFailure = true; Instance? modLogger = SIAKImperiumMod.ModLogger; if (modLogger != null) { modLogger.Warning("[Imperium] Notification sound unavailable: " + ex.Message); } } } } private static void EnsureReady() { //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown if (_initialised) { return; } _initialised = true; byte[] array = ImperiumAssets.LoadEmbeddedAssetBytes("sounds/notification.wav"); if (array == null || !TryDecodePcmWave(array, out int channels, out int sampleRate, out float[] samples)) { return; } int num = samples.Length / Math.Max(1, channels); if (num > 0) { _clip = AudioClip.Create("SIAKImperiumNotification", num, channels, sampleRate, false); Il2CppStructArray val = new Il2CppStructArray((long)samples.Length); for (int i = 0; i < samples.Length; i++) { ((Il2CppArrayBase)(object)val)[i] = samples[i]; } if (!_clip.SetData(val, 0)) { Object.Destroy((Object)(object)_clip); _clip = null; return; } GameObject val2 = new GameObject("SIAKImperiumNotificationAudio"); Object.DontDestroyOnLoad((Object)(object)val2); _source = val2.AddComponent(); _source.playOnAwake = false; _source.spatialBlend = 0f; _source.volume = 1f; } } private static bool TryDecodePcmWave(byte[] bytes, out int channels, out int sampleRate, out float[] samples) { channels = 0; sampleRate = 0; samples = System.Array.Empty(); if (bytes.Length < 44 || ReadTag(bytes, 0) != "RIFF" || ReadTag(bytes, 8) != "WAVE") { return false; } int num = 0; int num2 = 0; int num3 = 0; int num4 = -1; int num5 = 0; int num6 = 12; while (num6 + 8 <= bytes.Length) { string text = ReadTag(bytes, num6); int num7 = (int)ReadUInt32(bytes, num6 + 4); int num8 = num6 + 8; if (num7 < 0 || num8 > bytes.Length || num7 > bytes.Length - num8) { return false; } if (text == "fmt " && num7 >= 16) { num = ReadUInt16(bytes, num8); channels = ReadUInt16(bytes, num8 + 2); sampleRate = (int)ReadUInt32(bytes, num8 + 4); num3 = ReadUInt16(bytes, num8 + 12); num2 = ReadUInt16(bytes, num8 + 14); } else if (text == "data") { num4 = num8; num5 = num7; } num6 = num8 + num7 + (num7 & 1); } bool flag = num4 < 0; bool flag2 = flag; if (!flag2) { int num9 = channels; bool flag3 = ((num9 < 1 || num9 > 2) ? true : false); flag2 = flag3; } if (flag2 || sampleRate <= 0 || num3 <= 0 || num5 < num3) { return false; } int num10 = num2 / 8; bool flag4 = num != 1 && num != 3; bool flag5 = flag4; if (!flag5) { bool flag3 = ((num10 < 1 || num10 > 4) ? true : false); flag5 = flag3; } if (flag5 || num3 < channels * num10) { return false; } int num11 = num5 / num10; samples = new float[num11]; for (int i = 0; i < num11; i++) { int offset = num4 + i * num10; samples[i] = DecodeSample(bytes, offset, num, num2); } return true; } private static float DecodeSample(byte[] bytes, int offset, int format, int bitsPerSample) { if (format == 3 && bitsPerSample == 32) { return Mathf.Clamp(BitConverter.ToSingle(bytes, offset), -1f, 1f); } return bitsPerSample switch { 8 => (float)(bytes[offset] - 128) / 128f, 16 => (float)ReadInt16(bytes, offset) / 32768f, 24 => (float)ReadInt24(bytes, offset) / 8388608f, 32 => (float)ReadInt32(bytes, offset) / 2.1474836E+09f, _ => 0f, }; } private static string ReadTag(byte[] bytes, int offset) { return (offset + 4 <= bytes.Length) ? Encoding.ASCII.GetString(bytes, offset, 4) : string.Empty; } private static ushort ReadUInt16(byte[] bytes, int offset) { return (ushort)(bytes[offset] | (bytes[offset + 1] << 8)); } private static uint ReadUInt32(byte[] bytes, int offset) { return (uint)(bytes[offset] | (bytes[offset + 1] << 8) | (bytes[offset + 2] << 16) | (bytes[offset + 3] << 24)); } private static short ReadInt16(byte[] bytes, int offset) { return (short)ReadUInt16(bytes, offset); } private static int ReadInt24(byte[] bytes, int offset) { int num = bytes[offset] | (bytes[offset + 1] << 8) | (bytes[offset + 2] << 16); return ((num & 0x800000) != 0) ? (num | -16777216) : num; } private static int ReadInt32(byte[] bytes, int offset) { return (int)ReadUInt32(bytes, offset); } } internal static class ImperiumNpcHostilityModule { internal static readonly bool ModuleEnabled = true; private static Instance? _logger; private static System.DateTime _nextWarningUtc = System.DateTime.MinValue; internal static void Patch(Harmony harmony, Instance logger) { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown _logger = logger; if (!ModuleEnabled) { logger.Msg("[Imperium] NPC hostility module disabled."); return; } try { MethodInfo val = AccessTools.Method(typeof(NPC), "ReceiveImpact", new System.Type[1] { typeof(Impact) }, (System.Type[])null); MethodInfo val2 = AccessTools.Method(typeof(ImperiumNpcHostilityModule), "ReceiveImpactPostfix", (System.Type[])null, (System.Type[])null); if (val == (MethodInfo)null || val2 == (MethodInfo)null) { logger.Warning("[Imperium] NPC hostility module could not locate NPC.ReceiveImpact."); return; } harmony.Patch((MethodBase)(object)val, (HarmonyMethod)null, new HarmonyMethod(val2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); logger.Msg("[Imperium] Successfully loaded: EV-Hos T"); } catch (System.Exception ex) { logger.Warning("[Imperium] NPC hostility module unavailable: " + ex.Message); } } private static void ReceiveImpactPostfix(NPC __instance, Impact __0) { try { Player val = default(Player); if (ModuleEnabled && SIAKImperiumMod.Enabled != null && SIAKImperiumMod.Enabled.Value && !((Object)(object)__instance == (Object)null) && __0 != null && ((NetworkBehaviour)__instance).IsServerInitialized && __0.IsPlayerImpact(ref val) && !((Object)(object)val == (Object)null)) { NPCHealth health = __instance.Health; NPCRelationData relationData = __instance.RelationData; if (!((Object)(object)health == (Object)null) && relationData != null && (health.IsDead || health.IsKnockedOut) && relationData.RelationDelta > NPCRelationData.MinRelationship) { relationData.SetRelationship(NPCRelationData.MinRelationship, true); } } } catch (System.Exception ex) { WarnOccasionally("NPC hostility update skipped: " + ex.Message); } } private static void WarnOccasionally(string message) { if (!(System.DateTime.UtcNow < _nextWarningUtc)) { _nextWarningUtc = System.DateTime.UtcNow.AddSeconds(10.0); Instance? logger = _logger; if (logger != null) { logger.Warning("[Imperium] " + message); } } } } internal static class ImperiumOptionalGameplayModules { private static readonly string[] ModuleTypeNames = new string[4] { "SIAKImperium.ImperiumNpcHostilityModule", "SIAKImperium.ImperiumPoliceDurabilityModule", "SIAKImperium.ImperiumPoliceBatResistanceModule", "SIAKImperium.ImperiumPoliceHeldItemAlertModule" }; internal static void PatchAll(Harmony harmony, Instance logger) { string[] moduleTypeNames = ModuleTypeNames; foreach (string text in moduleTypeNames) { System.Type type = typeof(ImperiumOptionalGameplayModules).Assembly.GetType(text, false); if (type == (System.Type)null) { logger.Msg("[Imperium] Optional gameplay module not included: " + ShortName(text) + "."); continue; } try { MethodInfo method = type.GetMethod("Patch", (BindingFlags)56); if (method == (MethodInfo)null) { logger.Warning("[Imperium] Optional gameplay module has no Patch method: " + ShortName(text) + "."); continue; } ((MethodBase)method).Invoke((object)null, new object[2] { harmony, logger }); } catch (System.Exception ex) { TargetInvocationException ex2 = (TargetInvocationException)(object)((ex is TargetInvocationException) ? ex : null); System.Exception ex3 = ((ex2 != null && ((System.Exception)(object)ex2).InnerException != null) ? ((System.Exception)(object)ex2).InnerException : ex); logger.Warning("[Imperium] Optional gameplay module failed safely (" + ShortName(text) + "): " + ex3.Message); } } } internal static void ResetAll() { string[] moduleTypeNames = ModuleTypeNames; foreach (string text in moduleTypeNames) { System.Type type = typeof(ImperiumOptionalGameplayModules).Assembly.GetType(text, false); if (type == (System.Type)null) { continue; } try { MethodInfo method = type.GetMethod("Reset", (BindingFlags)56); if (method != null) { ((MethodBase)method).Invoke((object)null, (object[])null); } } catch { } } } private static string ShortName(string typeName) { int num = typeName.LastIndexOf('.'); string result; if (num < 0) { result = typeName; } else { int num2 = num + 1; result = typeName.Substring(num2, typeName.Length - num2); } return result; } } internal static class ImperiumPauseMenuPatches { private const string ImperiumPauseTitle = "Imperium is watching you."; internal static void UpdateCartelNamePostfix(PauseMenu __instance) { if ((Object)(object)((__instance != null) ? __instance.CartelNameLabel : null) != (Object)null) { ((TMP_Text)__instance.CartelNameLabel).text = "Imperium is watching you."; } } } internal static class ImperiumPhoneAdminDiagnostics { [Conditional("PADMIN_DIAGNOSTICS")] internal static void Write(string message) { Instance? modLogger = SIAKImperiumMod.ModLogger; if (modLogger != null) { modLogger.Msg(message); } } } public sealed class ImperiumPhoneAdminApp : PhoneApp { internal const string ApplicationId = "SIAKPhoneAdminApp"; private static ImperiumPhoneAdminApp? _instance; private static ImperiumPhoneAdminController? _controller; private static GameObject? _iconRoot; private static readonly Action OpenFromLauncherAction = new Action(OpenFromLauncher); protected override string AppName => "SIAKPhoneAdminApp"; protected override string AppTitle => "P-Admin"; protected override string IconLabel => "P-Admin"; protected override string IconFileName => string.Empty; protected override Sprite? IconSprite => ImperiumPhoneAdminAssets.LoadAppIconSprite(); protected override EOrientation Orientation => (EOrientation)0; protected override void OnCreatedUI(GameObject container) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) _instance = this; GameObject val = UIFactory.Panel("PhoneAdminHtmlRoot", container.transform, Color.clear, (Vector2?)null, (Vector2?)null, true); _controller = val.AddComponent(); if (!_controller.Initialize(val)) { Text val2 = UIFactory.Text("PhoneAdminFallback", "P-Admin could not initialise.", val.transform, 22, (TextAnchor)4, (FontStyle)1); ((Graphic)val2).rectTransform.anchorMin = Vector2.zero; ((Graphic)val2).rectTransform.anchorMax = Vector2.one; ((Graphic)val2).rectTransform.offsetMin = Vector2.zero; ((Graphic)val2).rectTransform.offsetMax = Vector2.zero; } ApplyLauncherVisibility(visible: true); } internal static void ApplyLauncherVisibility(bool visible) { if (_instance != null) { _iconRoot = ImperiumPhoneLauncherDeduplicator.AdoptExistingLauncher(_iconRoot, "SIAKPhoneAdminApp", visible); } } private static void OpenFromLauncher() { ImperiumPhoneAdminApp? instance = _instance; if (instance != null) { ((PhoneApp)instance).OpenApp(); } ImperiumPhoneAdminRuntime.RequestUiSnapshot(); _controller?.RefreshNow(); } internal static bool IsActuallyOpen() { try { return _instance != null && ((PhoneApp)_instance).IsOpen(); } catch { return false; } } internal static void NotifyUiDestroyed(ImperiumPhoneAdminController controller) { if (_controller == controller) { _controller = null; } _iconRoot = null; } } internal static class ImperiumPhoneAdminRuntime { private const float InitialConnectionProbeDelaySeconds = 0.15f; private const float ConnectionProbeIntervalSeconds = 0.75f; private const float PendingAccessProbeIntervalSeconds = 1.5f; private const float ConnectionDiscoveryWindowSeconds = 8f; private const float WorldEntryScanSeconds = 10f; private const float WorldEntryScanIntervalSeconds = 1f; private const float ConnectingIdentityTimeoutSeconds = 3f; private const float ConnectingIdentityProbeIntervalSeconds = 0.25f; private const float ManualApprovalTimeoutSeconds = 60f; private const int PasswordIterations = 120000; private const int MaximumHistoryEntries = 100; private const ulong MinimumIndividualSteamId64 = 76561197960265728uL; private const string ModeOpen = "open"; private const string ModeWhitelist = "whitelist"; private const string ModeManual = "manual"; private const string ModePassword = "password"; private static readonly Dictionary CurrentPlayers = new Dictionary((IEqualityComparer)(object)StringComparer.Ordinal); private static readonly HashSet PreviousMemberIds = new HashSet((IEqualityComparer)(object)StringComparer.Ordinal); private static readonly HashSet SessionApprovedIds = new HashSet((IEqualityComparer)(object)StringComparer.Ordinal); private static readonly Dictionary PendingStartedAt = new Dictionary((IEqualityComparer)(object)StringComparer.Ordinal); private static readonly Dictionary NextRejectionAt = new Dictionary((IEqualityComparer)(object)StringComparer.Ordinal); private static readonly Dictionary PendingFishNetConnectionIds = new Dictionary(); private static readonly Dictionary FishNetConnectionObjects = new Dictionary(); private static readonly Dictionary FishNetConnectionIdBySteamId = new Dictionary((IEqualityComparer)(object)StringComparer.Ordinal); private static readonly Dictionary PendingIdentityDeadlines = new Dictionary(); private static ImperiumPhoneAdminState? _state; private static bool _uiSnapshotRequested; private static bool _connectionProbeActive; private static bool _disconnectSnapshotRequested; private static bool _policyPublishRequested; private static bool _worldEntryScanActive; private static float _nextConnectionProbeAt; private static float _connectionProbeDeadline; private static bool _initialized; private static bool _lastHostAccess; private static string _connectionStatus = "Waiting for the Steam lobby."; private static string _sessionChallenge = string.Empty; private static string _clientMode = "unknown"; private static string _clientStatus = "Waiting for the host's P-Admin policy."; private static string _clientSalt = string.Empty; private static string _clientChallenge = string.Empty; private static int _stateVersion; internal static int StateVersion => _stateVersion; internal static string ConnectionStatus => _connectionStatus; internal static bool HasHostAccess => IsLocalHost(); internal static bool HasPendingWork => _initialized && (_uiSnapshotRequested || _connectionProbeActive || _disconnectSnapshotRequested || _policyPublishRequested || PendingIdentityDeadlines.Count > 0); private static string AccessMode { get { EnsureLoaded(); return NormalizeAccessMode(_state.AccessMode); } } private static bool PasswordConfigured => _state != null && !string.IsNullOrWhiteSpace(_state.PasswordSalt) && !string.IsNullOrWhiteSpace(_state.PasswordVerifier); internal static void Initialize() { EnsureLoaded(); EnsureSessionChallenge(); _initialized = true; _uiSnapshotRequested = false; _connectionProbeActive = false; _disconnectSnapshotRequested = false; _policyPublishRequested = false; _worldEntryScanActive = false; _nextConnectionProbeAt = 0f; _connectionProbeDeadline = 0f; PendingFishNetConnectionIds.Clear(); FishNetConnectionObjects.Clear(); FishNetConnectionIdBySteamId.Clear(); PendingIdentityDeadlines.Clear(); ImperiumPhoneAdminSteamBridge.RefreshLocalSteamId(); _lastHostAccess = IsLocalHost(); ImperiumPhoneAdminConnectionEvents.EnsurePatched(); ImperiumPhoneAdminPreConnectGate.EnsurePatched(); _stateVersion++; } internal static void Tick() { if (!_initialized || (!_uiSnapshotRequested && !_connectionProbeActive && !_disconnectSnapshotRequested && !_policyPublishRequested)) { return; } bool flag = IsLocalHost(); if (flag != _lastHostAccess) { _lastHostAccess = flag; _stateVersion++; } if (_uiSnapshotRequested) { _uiSnapshotRequested = false; if (!flag) { TickClientAccessState(); return; } PublishPolicyIfRequested(); CaptureHostSnapshot(refreshProfiles: true); } if (!flag) { return; } float unscaledTime = Time.unscaledTime; ProcessPendingConnectionIdentities(unscaledTime); if (!_connectionProbeActive && !_disconnectSnapshotRequested) { PublishPolicyIfRequested(); } else { if (unscaledTime < _nextConnectionProbeAt) { return; } PublishPolicyIfRequested(); HashSet before = new HashSet((System.Collections.Generic.IEnumerable)PreviousMemberIds, (IEqualityComparer)(object)StringComparer.Ordinal); if (!TryCaptureHostSnapshot(refreshProfiles: false, out List members, out string status)) { SetConnectionStatus(status); if (unscaledTime >= _connectionProbeDeadline) { _connectionProbeActive = false; _disconnectSnapshotRequested = false; _worldEntryScanActive = false; PendingIdentityDeadlines.Clear(); } else { _nextConnectionProbeAt = unscaledTime + 0.75f; } return; } bool flag2 = Enumerable.Any((System.Collections.Generic.IEnumerable)members, (Func)((ImperiumPhoneAdminSteamMember member) => !before.Contains(member.SteamId))); bool flag3 = Enumerable.Any((System.Collections.Generic.IEnumerable)CurrentPlayers.Values, (Func)((ImperiumPhoneAdminPlayerView player) => player.IsPending)); bool flag4 = Enumerable.Any((System.Collections.Generic.IEnumerable)CurrentPlayers.Values, (Func)((ImperiumPhoneAdminPlayerView player) => player.IsBlocked)); bool flag5 = PendingIdentityDeadlines.Count > 0; if (flag3) { _connectionProbeActive = true; _disconnectSnapshotRequested = false; _nextConnectionProbeAt = unscaledTime + 1.5f; } else if (flag5) { _connectionProbeActive = true; _disconnectSnapshotRequested = false; _nextConnectionProbeAt = unscaledTime + 0.25f; } else if (flag4 && unscaledTime < _connectionProbeDeadline) { _connectionProbeActive = true; _disconnectSnapshotRequested = false; _nextConnectionProbeAt = unscaledTime + 0.25f; } else if (_disconnectSnapshotRequested) { _disconnectSnapshotRequested = false; _connectionProbeActive = false; } else if (_worldEntryScanActive) { if (unscaledTime >= _connectionProbeDeadline) { _worldEntryScanActive = false; _connectionProbeActive = false; } else { _connectionProbeActive = true; _nextConnectionProbeAt = unscaledTime + 1f; } } else if (flag2 || unscaledTime >= _connectionProbeDeadline) { _connectionProbeActive = false; } else { _nextConnectionProbeAt = unscaledTime + 0.75f; } } } internal static void RequestUiSnapshot() { if (_initialized) { ImperiumPhoneAdminSteamBridge.RequestLobbyRefresh(); _uiSnapshotRequested = true; if (IsLocalHost()) { _policyPublishRequested = true; } } } internal static void RequestWorldEntryScan() { if (_initialized) { float unscaledTime = Time.unscaledTime; _worldEntryScanActive = true; _connectionProbeActive = true; _disconnectSnapshotRequested = false; _policyPublishRequested = true; _connectionProbeDeadline = unscaledTime + 10f; _nextConnectionProbeAt = unscaledTime + 0.5f; } } internal static void RequestWorldPlayerSnapshot() { if (_initialized && IsLocalHost()) { float unscaledTime = Time.unscaledTime; _connectionProbeActive = true; _disconnectSnapshotRequested = false; _connectionProbeDeadline = unscaledTime + 2f; _nextConnectionProbeAt = unscaledTime; } } internal static void NotifyRemoteConnectionState(bool started, int connectionId, object? connection) { //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) if (!_initialized || !IsLocalHost() || connectionId < 0) { return; } float unscaledTime = Time.unscaledTime; if (ImperiumPhoneAdminSteamBridge.IsLocalFishNetConnection(connectionId, connection)) { PendingFishNetConnectionIds.Remove(connectionId); FishNetConnectionObjects.Remove(connectionId); PendingIdentityDeadlines.Remove(connectionId); return; } if (connection != null) { FishNetConnectionObjects[connectionId] = connection; } if (started) { PendingFishNetConnectionIds[connectionId] = unscaledTime; PendingIdentityDeadlines[connectionId] = unscaledTime + 3f; if (TryEvaluateConnectingAccount(connectionId, connection, out var rejected)) { PendingIdentityDeadlines.Remove(connectionId); if (rejected) { PendingFishNetConnectionIds.Remove(connectionId); _disconnectSnapshotRequested = true; _connectionProbeActive = true; _connectionProbeDeadline = unscaledTime + 8f; _nextConnectionProbeAt = unscaledTime + 0.25f; return; } } _connectionProbeActive = true; _disconnectSnapshotRequested = false; _policyPublishRequested = true; _connectionProbeDeadline = unscaledTime + 8f; _nextConnectionProbeAt = unscaledTime + 0.15f; return; } PendingFishNetConnectionIds.Remove(connectionId); FishNetConnectionObjects.Remove(connectionId); PendingIdentityDeadlines.Remove(connectionId); Enumerator> enumerator = Enumerable.ToList>(Enumerable.Where>((System.Collections.Generic.IEnumerable>)FishNetConnectionIdBySteamId, (Func, bool>)((KeyValuePair pair) => pair.Value == connectionId))).GetEnumerator(); try { while (enumerator.MoveNext()) { KeyValuePair current = enumerator.Current; FishNetConnectionIdBySteamId.Remove(current.Key); } } finally { ((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } _disconnectSnapshotRequested = true; _connectionProbeActive = false; _connectionProbeDeadline = unscaledTime + 8f; _nextConnectionProbeAt = unscaledTime + 0.15f; } internal static bool ShouldPreventBeforeConnect(string steamId, out string reason) { reason = string.Empty; if (string.IsNullOrWhiteSpace(steamId)) { return false; } EnsureLoaded(); if (ImperiumPhoneAdminSteamBridge.IsLocalSteamId(steamId)) { return false; } if (Contains((System.Collections.Generic.IEnumerable)_state.Blacklist, steamId)) { reason = "Blocked: blacklisted"; return true; } if (Contains((System.Collections.Generic.IEnumerable)_state.Whitelist, steamId)) { return false; } if (SessionApprovedIds.Contains(steamId)) { return false; } if (!string.Equals(AccessMode, "whitelist", (StringComparison)4)) { return false; } if (_state.AllowSteamFriends && ImperiumPhoneAdminSteamBridge.IsFriend(steamId)) { return false; } reason = "Blocked: not whitelisted"; return true; } internal static void RecordPreConnectRejection(string steamId, string reason) { EnsureLoaded(); string name = ResolveKnownName(steamId); AddOrUpdateHistory(steamId, name, reason, isNewConnection: true); SaveChanged(); _uiSnapshotRequested = true; _stateVersion++; } private static void ProcessPendingConnectionIdentities(float now) { //IL_0022: 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_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) if (PendingIdentityDeadlines.Count == 0) { return; } Enumerator> enumerator = Enumerable.ToList>((System.Collections.Generic.IEnumerable>)PendingIdentityDeadlines).GetEnumerator(); try { object connection = default(object); while (enumerator.MoveNext()) { KeyValuePair current = enumerator.Current; int key = current.Key; FishNetConnectionObjects.TryGetValue(key, ref connection); if (TryEvaluateConnectingAccount(key, connection, out var rejected)) { PendingIdentityDeadlines.Remove(key); if (rejected) { PendingFishNetConnectionIds.Remove(key); } } else if (!(now < current.Value)) { PendingIdentityDeadlines.Remove(key); PendingFishNetConnectionIds.Remove(key); } } } finally { ((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } } private static bool TryEvaluateConnectingAccount(int connectionId, object? connection, out bool rejected) { rejected = false; if (!ImperiumPhoneAdminSteamBridge.TryResolveConnectingSteamId(connectionId, connection, out string steamId)) { return false; } if (ImperiumPhoneAdminSteamBridge.IsLocalSteamId(steamId)) { PendingFishNetConnectionIds.Remove(connectionId); PendingIdentityDeadlines.Remove(connectionId); FishNetConnectionObjects.Remove(connectionId); return true; } FishNetConnectionIdBySteamId[steamId] = connectionId; if (_state != null && _state.AllowSteamFriends && string.Equals(AccessMode, "whitelist", (StringComparison)4) && !Contains((System.Collections.Generic.IEnumerable)_state.Blacklist, steamId) && !Contains((System.Collections.Generic.IEnumerable)_state.Whitelist, steamId)) { return true; } bool isFriend = _state != null && _state.AllowSteamFriends && !string.Equals(AccessMode, "open", (StringComparison)4) && !Contains((System.Collections.Generic.IEnumerable)_state.Blacklist, steamId) && !Contains((System.Collections.Generic.IEnumerable)_state.Whitelist, steamId) && ImperiumPhoneAdminSteamBridge.IsFriend(steamId); ImperiumPhoneAdminAccessDecision imperiumPhoneAdminAccessDecision = EvaluateAccess(steamId, isFriend, isHost: false); if (!imperiumPhoneAdminAccessDecision.Blocked) { return true; } rejected = true; ImperiumPhoneAdminSteamBridge.DisconnectSteamUser(steamId, imperiumPhoneAdminAccessDecision.Reason, connectionId); string personaName = ImperiumPhoneAdminSteamBridge.GetPersonaName(steamId); AddOrUpdateHistory(steamId, personaName, imperiumPhoneAdminAccessDecision.Reason, isNewConnection: true); SaveChanged(); return true; } private static void PublishPolicyIfRequested() { if (_policyPublishRequested && IsLocalHost()) { EnsureSessionChallenge(); string challenge = (string.Equals(AccessMode, "password", (StringComparison)4) ? _sessionChallenge : string.Empty); if (ImperiumPhoneAdminSteamBridge.PublishAccessAdvertisement(AccessMode, _state.PasswordSalt, challenge, out string _)) { _policyPublishRequested = false; } } } private static void CaptureHostSnapshot(bool refreshProfiles) { if (!TryCaptureHostSnapshot(refreshProfiles, out List _, out string status)) { SetConnectionStatus(status); ShowLocalHostFallback(status); if (ImperiumPhoneAdminApp.IsActuallyOpen()) { float unscaledTime = Time.unscaledTime; _connectionProbeActive = true; _connectionProbeDeadline = unscaledTime + 8f; _nextConnectionProbeAt = unscaledTime + 0.75f; } } } private static void ShowLocalHostFallback(string status) { string localSteamId = ImperiumPhoneAdminSteamBridge.LocalSteamId; if (!string.IsNullOrWhiteSpace(localSteamId)) { List obj = new List(); obj.Add(new ImperiumPhoneAdminSteamMember { SteamId = localSteamId, Name = ImperiumPhoneAdminSteamBridge.GetPersonaName(localSteamId), IsFriend = false }); List members = obj; SynchronizeMembers((System.Collections.Generic.IReadOnlyList)members, localSteamId, localSteamId, refreshProfiles: true); SetConnectionStatus(string.IsNullOrWhiteSpace(status) ? "Local host detected; waiting for the Steam lobby member list." : status); } } private static bool TryCaptureHostSnapshot(bool refreshProfiles, out List members, out string status) { if (!ImperiumPhoneAdminSteamBridge.TryGetLobbyMembers(out members, out string localSteamId, out string lobbyOwnerSteamId, out status)) { return false; } SetConnectionStatus(status); SynchronizeMembers((System.Collections.Generic.IReadOnlyList)members, localSteamId, lobbyOwnerSteamId, refreshProfiles); return true; } private static void TickClientAccessState() { if (CurrentPlayers.Count > 0 || PreviousMemberIds.Count > 0) { CurrentPlayers.Clear(); PreviousMemberIds.Clear(); PendingStartedAt.Clear(); NextRejectionAt.Clear(); } if (!ImperiumPhoneAdminSteamBridge.TryGetAccessAdvertisement(out string mode, out string salt, out string challenge, out string status)) { SetClientState("unknown", string.Empty, string.Empty, status); SetConnectionStatus(status); } else { SetClientState(mode, salt, challenge, status); SetConnectionStatus(status); } } internal static void ResetSession() { if (_initialized) { MarkDisconnectedHistory((System.Collections.Generic.IEnumerable)PreviousMemberIds); CurrentPlayers.Clear(); PreviousMemberIds.Clear(); SessionApprovedIds.Clear(); PendingStartedAt.Clear(); NextRejectionAt.Clear(); PendingFishNetConnectionIds.Clear(); FishNetConnectionObjects.Clear(); FishNetConnectionIdBySteamId.Clear(); PendingIdentityDeadlines.Clear(); _worldEntryScanActive = false; _sessionChallenge = string.Empty; _clientMode = "unknown"; _clientStatus = "Waiting for the host's P-Admin policy."; _clientSalt = string.Empty; _clientChallenge = string.Empty; _uiSnapshotRequested = false; _connectionProbeActive = false; _disconnectSnapshotRequested = false; _policyPublishRequested = false; _nextConnectionProbeAt = 0f; _connectionProbeDeadline = 0f; SetConnectionStatus("Waiting for the Steam lobby."); _stateVersion++; } } internal static void Dispose() { ResetSession(); ImperiumPhoneAdminConnectionEvents.Dispose(); ImperiumPhoneAdminPreConnectGate.Dispose(); ImperiumPhoneAdminSteamBridge.Dispose(); _initialized = false; } internal static ImperiumPhoneAdminDashboardView GetDashboardView() { EnsureLoaded(); List currentPlayers = Enumerable.ToList(Enumerable.Select((System.Collections.Generic.IEnumerable)Enumerable.ThenBy(Enumerable.ThenBy(Enumerable.ThenByDescending(Enumerable.OrderByDescending((System.Collections.Generic.IEnumerable)CurrentPlayers.Values, (Func)((ImperiumPhoneAdminPlayerView player) => player.IsHost)), (Func)((ImperiumPhoneAdminPlayerView player) => player.IsPending)), (Func)((ImperiumPhoneAdminPlayerView player) => player.IsBlocked)), (Func)((ImperiumPhoneAdminPlayerView player) => player.Name), (IComparer)(object)StringComparer.OrdinalIgnoreCase), (Func)ClonePlayer)); string localSteamId = ImperiumPhoneAdminSteamBridge.LocalSteamId; List history = Enumerable.ToList(Enumerable.Select(Enumerable.Take((System.Collections.Generic.IEnumerable)Enumerable.OrderByDescending(Enumerable.Where((System.Collections.Generic.IEnumerable)(_state.History ?? new List()), (Func)((ImperiumPhoneAdminHistoryEntry entry) => string.IsNullOrWhiteSpace(localSteamId) || !string.Equals(entry.SteamId, localSteamId, (StringComparison)4))), (Func)((ImperiumPhoneAdminHistoryEntry entry) => ParseUtc(entry.LastSeenUtc))), 100), (Func)CloneHistory)); return new ImperiumPhoneAdminDashboardView { HostAccess = IsLocalHost(), AccessMode = AccessMode, AllowSteamFriends = _state.AllowSteamFriends, PasswordConfigured = PasswordConfigured, ClientMode = _clientMode, ClientStatus = _clientStatus, Whitelist = Enumerable.ToList((System.Collections.Generic.IEnumerable)Enumerable.OrderBy((System.Collections.Generic.IEnumerable)(_state.Whitelist ?? new List()), (Func)((string id) => id), (IComparer)(object)StringComparer.Ordinal)), Blacklist = Enumerable.ToList((System.Collections.Generic.IEnumerable)Enumerable.OrderBy((System.Collections.Generic.IEnumerable)(_state.Blacklist ?? new List()), (Func)((string id) => id), (IComparer)(object)StringComparer.Ordinal)), CurrentPlayers = currentPlayers, History = history, ConnectionStatus = _connectionStatus }; } internal static bool AddToWhitelist(string rawSteamId, out string message) { if (!CanManage(out message) || !TryNormalizeSteamId(rawSteamId, out string steamId, out message)) { return false; } EnsureLoaded(); bool flag = AddUnique(_state.Whitelist, steamId); flag |= RemoveValue(_state.Blacklist, steamId); SessionApprovedIds.Add(steamId); PendingStartedAt.Remove(steamId); NextRejectionAt.Remove(steamId); int num = default(int); if (FishNetConnectionIdBySteamId.TryGetValue(steamId, ref num)) { PendingIdentityDeadlines.Remove(num); PendingFishNetConnectionIds.Remove(num); } ImperiumPhoneAdminPlayerView imperiumPhoneAdminPlayerView = default(ImperiumPhoneAdminPlayerView); if (CurrentPlayers.TryGetValue(steamId, ref imperiumPhoneAdminPlayerView)) { imperiumPhoneAdminPlayerView.IsAllowed = true; imperiumPhoneAdminPlayerView.IsBlocked = false; imperiumPhoneAdminPlayerView.IsPending = false; imperiumPhoneAdminPlayerView.Decision = "Allowed: whitelisted"; } string text = ResolveKnownName(steamId); message = (flag ? (text + " is now whitelisted and remains connected.") : (text + " is already whitelisted.")); if (flag) { SaveChanged(); } ForcePolicyRefresh(); return true; } internal static bool AddToBlacklist(string rawSteamId, out string message) { if (!CanManage(out message) || !TryNormalizeSteamId(rawSteamId, out string steamId, out message)) { return false; } EnsureLoaded(); if (string.Equals(steamId, ImperiumPhoneAdminSteamBridge.LocalSteamId, (StringComparison)4)) { message = "The local host cannot blacklist their own Steam account."; return false; } bool flag = AddUnique(_state.Blacklist, steamId); flag |= RemoveValue(_state.Whitelist, steamId); SessionApprovedIds.Remove(steamId); PendingStartedAt.Remove(steamId); string text = ResolveKnownName(steamId); message = (flag ? (text + " is now blacklisted and will be removed immediately if connected.") : (text + " is already blacklisted.")); if (flag) { SaveChanged(); } if (CurrentPlayers.ContainsKey(steamId)) { int num = default(int); bool flag2 = FishNetConnectionIdBySteamId.TryGetValue(steamId, ref num); bool flag3 = ImperiumPhoneAdminSteamBridge.DisconnectSteamUser(steamId, "Blocked: blacklisted", flag2 ? new int?(num) : ((int?)null)); } ForcePolicyRefresh(); return true; } internal static bool RemoveFromWhitelist(string rawSteamId, out string message) { if (!CanManage(out message) || !TryNormalizeSteamId(rawSteamId, out string steamId, out message)) { return false; } EnsureLoaded(); string text = ResolveKnownName(steamId); bool flag = RemoveValue(_state.Whitelist, steamId); message = (flag ? (text + " was removed from the whitelist.") : "That Steam account was not whitelisted."); if (flag) { SaveChanged(); } ForcePolicyRefresh(); return flag; } internal static bool RemoveFromBlacklist(string rawSteamId, out string message) { if (!CanManage(out message) || !TryNormalizeSteamId(rawSteamId, out string steamId, out message)) { return false; } EnsureLoaded(); string text = ResolveKnownName(steamId); bool flag = RemoveValue(_state.Blacklist, steamId); message = (flag ? (text + " was removed from the blacklist.") : "That Steam account was not blacklisted."); if (flag) { SaveChanged(); } ForcePolicyRefresh(); return flag; } internal static bool SetAccessMode(string rawMode, out string message) { //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) if (!CanManage(out message)) { return false; } EnsureLoaded(); string text = NormalizeAccessMode(rawMode); if (string.Equals(text, "password", (StringComparison)4) && !PasswordConfigured) { message = "Set a P-Admin password before enabling password mode."; return false; } if (string.Equals(AccessMode, text, (StringComparison)4)) { message = AccessModeLabel(text) + " is already active."; return true; } List val = Enumerable.ToList(Enumerable.Distinct(Enumerable.Where(Enumerable.Concat(Enumerable.Select(Enumerable.Where((System.Collections.Generic.IEnumerable)CurrentPlayers.Values, (Func)((ImperiumPhoneAdminPlayerView player) => !player.IsHost && !Contains((System.Collections.Generic.IEnumerable)_state.Blacklist, player.SteamId))), (Func)((ImperiumPhoneAdminPlayerView player) => player.SteamId)), Enumerable.Where((System.Collections.Generic.IEnumerable)PreviousMemberIds, (Func)((string steamId) => !Contains((System.Collections.Generic.IEnumerable)_state.Blacklist, steamId)))), (Func)((string steamId) => !string.IsNullOrWhiteSpace(steamId))), (IEqualityComparer)(object)StringComparer.Ordinal)); _state.AccessMode = text; _state.WhitelistOnly = string.Equals(text, "whitelist", (StringComparison)4); SessionApprovedIds.Clear(); if (!string.Equals(text, "open", (StringComparison)4)) { Enumerator enumerator = val.GetEnumerator(); try { while (enumerator.MoveNext()) { string current = enumerator.Current; SessionApprovedIds.Add(current); } } finally { ((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } } PendingStartedAt.Clear(); NextRejectionAt.Clear(); _sessionChallenge = string.Empty; EnsureSessionChallenge(); message = ((val.Count > 0 && !string.Equals(text, "open", (StringComparison)4)) ? ($"Access mode changed to {AccessModeLabel(text)}. {val.Count} connected player(s) remain approved for this session; " + "new joins and reconnects use the new policy.") : ("Access mode changed to " + AccessModeLabel(text) + ".")); SaveChanged(); ForcePolicyRefresh(); Instance? modLogger = SIAKImperiumMod.ModLogger; if (modLogger != null) { modLogger.Msg($"[P-Admin] Access mode changed to {text}; {val.Count} existing remote connection(s) retained for this session."); } return true; } internal static bool ToggleWhitelistOnly(out string message) { return SetAccessMode(string.Equals(AccessMode, "whitelist", (StringComparison)4) ? "open" : "whitelist", out message); } internal static bool ToggleAllowSteamFriends(out string message) { if (!CanManage(out message)) { return false; } EnsureLoaded(); _state.AllowSteamFriends = !_state.AllowSteamFriends; message = (_state.AllowSteamFriends ? "Steam friends may bypass restricted access modes." : "Steam friends no longer bypass restricted access modes."); SaveChanged(); ForcePolicyRefresh(); return true; } internal static bool ApproveOnce(string rawSteamId, out string message) { if (!CanManage(out message) || !TryNormalizeSteamId(rawSteamId, out string steamId, out message)) { return false; } EnsureLoaded(); if (Contains((System.Collections.Generic.IEnumerable)_state.Blacklist, steamId)) { message = "Remove this SteamID from the blacklist before approving it."; return false; } SessionApprovedIds.Add(steamId); PendingStartedAt.Remove(steamId); NextRejectionAt.Remove(steamId); message = ResolveKnownName(steamId) + " was approved for this connection only."; _connectionProbeActive = Enumerable.Any((System.Collections.Generic.IEnumerable)CurrentPlayers.Values, (Func)((ImperiumPhoneAdminPlayerView player) => player.IsPending && !string.Equals(player.SteamId, steamId, (StringComparison)4))); ForcePolicyRefresh(); return true; } internal static bool SetPassword(string rawPassword, out string message) { if (!CanManage(out message)) { return false; } string text = rawPassword ?? string.Empty; if (text.Length < 6) { message = "The password must contain at least 6 characters."; return false; } if (text.Length > 64) { message = "The password cannot exceed 64 characters."; return false; } EnsureLoaded(); byte[] array = new byte[24]; RandomNumberGenerator.Fill(System.Span.op_Implicit(array)); byte[] array2 = DerivePasswordVerifier(text, array); _state.PasswordSalt = Convert.ToBase64String(array); _state.PasswordVerifier = Convert.ToBase64String(array2); _sessionChallenge = string.Empty; EnsureSessionChallenge(); message = "P-Admin password updated. The password itself was not stored."; SaveChanged(); ForcePolicyRefresh(); return true; } internal static bool ClearPassword(out string message) { if (!CanManage(out message)) { return false; } EnsureLoaded(); _state.PasswordSalt = string.Empty; _state.PasswordVerifier = string.Empty; if (string.Equals(AccessMode, "password", (StringComparison)4)) { _state.AccessMode = "manual"; } _sessionChallenge = string.Empty; message = "The saved password was removed. Manual approval mode is now active."; SaveChanged(); ForcePolicyRefresh(); return true; } internal static bool SubmitClientPassword(string rawPassword, out string message) { if (IsLocalHost()) { message = "The host does not need to submit the lobby password."; return false; } if (!string.Equals(_clientMode, "password", (StringComparison)4)) { message = "The host is not currently using password mode."; return false; } if (string.IsNullOrWhiteSpace(_clientSalt) || string.IsNullOrWhiteSpace(_clientChallenge)) { message = "The host's password challenge is not available yet."; return false; } string text = rawPassword ?? string.Empty; if (text.Length == 0) { message = "Enter the host's P-Admin password."; return false; } try { byte[] salt = Convert.FromBase64String(_clientSalt); byte[] verifier = DerivePasswordVerifier(text, salt); string localSteamId = ImperiumPhoneAdminSteamBridge.LocalSteamId; if (string.IsNullOrWhiteSpace(localSteamId)) { message = "Your local SteamID is not available yet."; return false; } string proof = ComputePasswordProof(verifier, _clientChallenge, localSteamId); if (!ImperiumPhoneAdminSteamBridge.SetLocalPasswordProof(proof, out string status)) { message = status; return false; } _clientStatus = "Password proof sent to the host. Waiting for verification."; _stateVersion++; message = "Password proof sent. P-Admin never sends the plain password to the host."; return true; } catch { message = "The host's password challenge was invalid. Reopen P-Admin and try again."; return false; } } internal static bool KickNow(string rawSteamId, out string message) { if (!CanManage(out message) || !TryNormalizeSteamId(rawSteamId, out string steamId, out message)) { return false; } if (string.Equals(steamId, ImperiumPhoneAdminSteamBridge.LocalSteamId, (StringComparison)4)) { message = "The host cannot remove their own connection."; return false; } SessionApprovedIds.Remove(steamId); PendingStartedAt.Remove(steamId); string text = ResolveKnownName(steamId); int num = default(int); bool flag = FishNetConnectionIdBySteamId.TryGetValue(steamId, ref num); bool flag2 = ImperiumPhoneAdminSteamBridge.DisconnectSteamUser(steamId, "Removed by the P-Admin host", flag ? new int?(num) : ((int?)null)); message = (flag2 ? ("Removal command sent for " + text + ".") : ("No active network connection for " + text + " was found, but the Steam session was closed.")); AddOrUpdateHistory(steamId, ResolveKnownName(steamId), "Removed by host", isNewConnection: false); SaveChanged(); return true; } internal static Sprite? GetAvatarSprite(string steamId) { return ImperiumPhoneAdminSteamBridge.GetAvatarSprite(steamId); } private static bool TryClaimFishNetConnectionId(string steamId, out int connectionId) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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) connectionId = -1; if (FishNetConnectionIdBySteamId.TryGetValue(steamId, ref connectionId)) { return true; } float cutoff = Time.unscaledTime - 8f; Enumerator enumerator = Enumerable.ToList(Enumerable.Select, int>(Enumerable.Where>((System.Collections.Generic.IEnumerable>)PendingFishNetConnectionIds, (Func, bool>)((KeyValuePair pair) => pair.Value < cutoff)), (Func, int>)((KeyValuePair pair) => pair.Key))).GetEnumerator(); try { while (enumerator.MoveNext()) { int current = enumerator.Current; PendingFishNetConnectionIds.Remove(current); FishNetConnectionObjects.Remove(current); } } finally { ((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } if (PendingFishNetConnectionIds.Count == 0) { return false; } connectionId = Enumerable.First>((System.Collections.Generic.IEnumerable>)Enumerable.OrderByDescending, float>((System.Collections.Generic.IEnumerable>)PendingFishNetConnectionIds, (Func, float>)((KeyValuePair pair) => pair.Value))).Key; PendingFishNetConnectionIds.Remove(connectionId); FishNetConnectionIdBySteamId[steamId] = connectionId; return true; } private static void SynchronizeMembers(System.Collections.Generic.IReadOnlyList members, string localSteamId, string lobbyOwnerSteamId, bool refreshProfiles) { //IL_05f9: 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_06d2: Unknown result type (might be due to invalid IL or missing references) //IL_06d7: Unknown result type (might be due to invalid IL or missing references) //IL_0721: Unknown result type (might be due to invalid IL or missing references) //IL_0726: Unknown result type (might be due to invalid IL or missing references) EnsureLoaded(); float unscaledTime = Time.unscaledTime; HashSet currentIds = new HashSet(Enumerable.Select((System.Collections.Generic.IEnumerable)members, (Func)((ImperiumPhoneAdminSteamMember member) => member.SteamId)), (IEqualityComparer)(object)StringComparer.Ordinal); bool flag = false; bool flag2 = false; if (!string.IsNullOrWhiteSpace(localSteamId)) { FishNetConnectionIdBySteamId.Remove(localSteamId); } if (!string.IsNullOrWhiteSpace(localSteamId) && _state.History.RemoveAll((Predicate)((ImperiumPhoneAdminHistoryEntry entry) => string.Equals(entry.SteamId, localSteamId, (StringComparison)4))) > 0) { flag2 = true; } System.Collections.Generic.IEnumerator enumerator = ((System.Collections.Generic.IEnumerable)members).GetEnumerator(); try { ImperiumPhoneAdminPlayerView imperiumPhoneAdminPlayerView = default(ImperiumPhoneAdminPlayerView); float num = default(float); float num2 = default(float); while (((System.Collections.IEnumerator)enumerator).MoveNext()) { ImperiumPhoneAdminSteamMember current = enumerator.Current; bool flag3 = !PreviousMemberIds.Contains(current.SteamId); string text = current.Name; bool flag4 = current.IsFriend; if (flag3 || refreshProfiles) { text = ImperiumPhoneAdminSteamBridge.GetPersonaName(current.SteamId); flag4 = ImperiumPhoneAdminSteamBridge.IsFriend(current.SteamId); } bool flag5 = string.Equals(current.SteamId, localSteamId, (StringComparison)4) || string.Equals(current.SteamId, lobbyOwnerSteamId, (StringComparison)4); int connectionId = current.ConnectionId; if (!flag5) { if (connectionId >= 0) { FishNetConnectionIdBySteamId[current.SteamId] = connectionId; } else if (!FishNetConnectionIdBySteamId.TryGetValue(current.SteamId, ref connectionId)) { connectionId = -1; if (flag3) { TryClaimFishNetConnectionId(current.SteamId, out connectionId); } } } if (!CurrentPlayers.TryGetValue(current.SteamId, ref imperiumPhoneAdminPlayerView)) { imperiumPhoneAdminPlayerView = new ImperiumPhoneAdminPlayerView { SteamId = current.SteamId, Name = text, IsFriend = flag4, IsHost = flag5, FirstSeenUtc = System.DateTime.UtcNow.ToString("O", (IFormatProvider)(object)CultureInfo.InvariantCulture), LastProfileRefreshAt = unscaledTime }; CurrentPlayers[current.SteamId] = imperiumPhoneAdminPlayerView; flag = true; } else if (refreshProfiles) { if (!string.IsNullOrWhiteSpace(text) && !string.Equals(imperiumPhoneAdminPlayerView.Name, text, (StringComparison)4)) { imperiumPhoneAdminPlayerView.Name = text; flag = true; ImperiumPhoneAdminHistoryEntry imperiumPhoneAdminHistoryEntry = FindHistory(current.SteamId); if (imperiumPhoneAdminHistoryEntry != null && !string.Equals(imperiumPhoneAdminHistoryEntry.Name, text, (StringComparison)4)) { imperiumPhoneAdminHistoryEntry.Name = text; flag2 = true; } } if (imperiumPhoneAdminPlayerView.IsFriend != flag4) { imperiumPhoneAdminPlayerView.IsFriend = flag4; flag = true; } imperiumPhoneAdminPlayerView.LastProfileRefreshAt = unscaledTime; } if (imperiumPhoneAdminPlayerView.IsHost != flag5) { imperiumPhoneAdminPlayerView.IsHost = flag5; flag = true; } ImperiumPhoneAdminAccessDecision imperiumPhoneAdminAccessDecision = EvaluateAccess(current.SteamId, imperiumPhoneAdminPlayerView.IsFriend, flag5); if (imperiumPhoneAdminAccessDecision.Pending) { if (!PendingStartedAt.TryGetValue(current.SteamId, ref num)) { num = unscaledTime; PendingStartedAt[current.SteamId] = num; if (!flag5) { try { ImperiumNotificationSound.Play(); } catch { } } } if (unscaledTime - num >= 60f) { imperiumPhoneAdminAccessDecision = new ImperiumPhoneAdminAccessDecision(ImperiumPhoneAdminDecisionState.Blocked, "Blocked: approval timed out"); } } else { PendingStartedAt.Remove(current.SteamId); } if (imperiumPhoneAdminPlayerView.IsAllowed != imperiumPhoneAdminAccessDecision.Allowed || imperiumPhoneAdminPlayerView.IsBlocked != imperiumPhoneAdminAccessDecision.Blocked || imperiumPhoneAdminPlayerView.IsPending != imperiumPhoneAdminAccessDecision.Pending || !string.Equals(imperiumPhoneAdminPlayerView.Decision, imperiumPhoneAdminAccessDecision.Reason, (StringComparison)4)) { imperiumPhoneAdminPlayerView.IsAllowed = imperiumPhoneAdminAccessDecision.Allowed; imperiumPhoneAdminPlayerView.IsBlocked = imperiumPhoneAdminAccessDecision.Blocked; imperiumPhoneAdminPlayerView.IsPending = imperiumPhoneAdminAccessDecision.Pending; imperiumPhoneAdminPlayerView.Decision = imperiumPhoneAdminAccessDecision.Reason; flag = true; } if (!flag5) { if (flag3) { AddOrUpdateHistory(current.SteamId, imperiumPhoneAdminPlayerView.Name, imperiumPhoneAdminAccessDecision.Reason, isNewConnection: true); flag2 = true; } else { ImperiumPhoneAdminHistoryEntry imperiumPhoneAdminHistoryEntry2 = FindHistory(current.SteamId); if (imperiumPhoneAdminHistoryEntry2 != null && !string.Equals(imperiumPhoneAdminHistoryEntry2.LastDecision, imperiumPhoneAdminAccessDecision.Reason, (StringComparison)4)) { imperiumPhoneAdminHistoryEntry2.LastDecision = imperiumPhoneAdminAccessDecision.Reason; imperiumPhoneAdminHistoryEntry2.Name = imperiumPhoneAdminPlayerView.Name; flag2 = true; } } } if (imperiumPhoneAdminAccessDecision.Blocked && !flag5) { if (!NextRejectionAt.TryGetValue(current.SteamId, ref num2) || unscaledTime >= num2) { NextRejectionAt[current.SteamId] = unscaledTime + 1.5f; ImperiumPhoneAdminSteamBridge.DisconnectSteamUser(current.SteamId, imperiumPhoneAdminAccessDecision.Reason, (connectionId >= 0) ? new int?(connectionId) : ((int?)null)); AddOrUpdateHistory(current.SteamId, imperiumPhoneAdminPlayerView.Name, imperiumPhoneAdminAccessDecision.Reason, isNewConnection: false); flag2 = true; } } else { NextRejectionAt.Remove(current.SteamId); } } } finally { ((System.IDisposable)enumerator)?.Dispose(); } List val = Enumerable.ToList(Enumerable.Where((System.Collections.Generic.IEnumerable)PreviousMemberIds, (Func)((string id) => !currentIds.Contains(id) && !string.Equals(id, localSteamId, (StringComparison)4)))); if (val.Count > 0) { MarkDisconnectedHistory((System.Collections.Generic.IEnumerable)val); flag2 = true; flag = true; Enumerator enumerator2 = val.GetEnumerator(); try { int num3 = default(int); while (enumerator2.MoveNext()) { string current2 = enumerator2.Current; CurrentPlayers.Remove(current2); SessionApprovedIds.Remove(current2); PendingStartedAt.Remove(current2); NextRejectionAt.Remove(current2); if (FishNetConnectionIdBySteamId.TryGetValue(current2, ref num3)) { FishNetConnectionIdBySteamId.Remove(current2); PendingFishNetConnectionIds.Remove(num3); FishNetConnectionObjects.Remove(num3); } } } finally { ((System.IDisposable)enumerator2/*cast due to .constrained prefix*/).Dispose(); } } Enumerator enumerator3 = Enumerable.ToList(Enumerable.Where((System.Collections.Generic.IEnumerable)CurrentPlayers.Keys, (Func)((string id) => !currentIds.Contains(id)))).GetEnumerator(); try { while (enumerator3.MoveNext()) { string current3 = enumerator3.Current; CurrentPlayers.Remove(current3); flag = true; } } finally { ((System.IDisposable)enumerator3/*cast due to .constrained prefix*/).Dispose(); } PreviousMemberIds.Clear(); Enumerator enumerator4 = currentIds.GetEnumerator(); try { while (enumerator4.MoveNext()) { string current4 = enumerator4.Current; PreviousMemberIds.Add(current4); } } finally { ((System.IDisposable)enumerator4/*cast due to .constrained prefix*/).Dispose(); } if (flag2) { Save(); } if (flag || flag2) { _stateVersion++; } } private static ImperiumPhoneAdminAccessDecision EvaluateAccess(string steamId, bool isFriend, bool isHost) { EnsureLoaded(); if (isHost) { return new ImperiumPhoneAdminAccessDecision(ImperiumPhoneAdminDecisionState.Allowed, "Host account"); } if (Contains((System.Collections.Generic.IEnumerable)_state.Blacklist, steamId)) { return new ImperiumPhoneAdminAccessDecision(ImperiumPhoneAdminDecisionState.Blocked, "Blocked: blacklisted"); } if (Contains((System.Collections.Generic.IEnumerable)_state.Whitelist, steamId)) { return new ImperiumPhoneAdminAccessDecision(ImperiumPhoneAdminDecisionState.Allowed, "Allowed: whitelisted"); } if (_state.AllowSteamFriends && isFriend && !string.Equals(AccessMode, "open", (StringComparison)4)) { return new ImperiumPhoneAdminAccessDecision(ImperiumPhoneAdminDecisionState.Allowed, "Allowed: Steam friend"); } if (SessionApprovedIds.Contains(steamId)) { return new ImperiumPhoneAdminAccessDecision(ImperiumPhoneAdminDecisionState.Allowed, "Allowed: host approved this session"); } if (string.Equals(AccessMode, "open", (StringComparison)4)) { return new ImperiumPhoneAdminAccessDecision(ImperiumPhoneAdminDecisionState.Allowed, "Allowed: open mode"); } if (string.Equals(AccessMode, "whitelist", (StringComparison)4)) { return new ImperiumPhoneAdminAccessDecision(ImperiumPhoneAdminDecisionState.Blocked, "Blocked: not whitelisted"); } if (string.Equals(AccessMode, "manual", (StringComparison)4)) { return new ImperiumPhoneAdminAccessDecision(ImperiumPhoneAdminDecisionState.Pending, "Pending: waiting for host approval (60-second limit)"); } if (!PasswordConfigured) { return new ImperiumPhoneAdminAccessDecision(ImperiumPhoneAdminDecisionState.Blocked, "Blocked: host password is not configured"); } if (VerifyMemberPasswordProof(steamId)) { return new ImperiumPhoneAdminAccessDecision(ImperiumPhoneAdminDecisionState.Allowed, "Allowed: password verified"); } return new ImperiumPhoneAdminAccessDecision(ImperiumPhoneAdminDecisionState.Pending, "Pending: password or host approval required (60-second limit)"); } private static bool VerifyMemberPasswordProof(string steamId) { if (_state == null || string.IsNullOrWhiteSpace(_state.PasswordVerifier) || string.IsNullOrWhiteSpace(_sessionChallenge)) { return false; } try { byte[] verifier = Convert.FromBase64String(_state.PasswordVerifier); string expected = ComputePasswordProof(verifier, _sessionChallenge, steamId); string memberPasswordProof = ImperiumPhoneAdminSteamBridge.GetMemberPasswordProof(steamId); return FixedTimeEquals(expected, memberPasswordProof); } catch { return false; } } private static byte[] DerivePasswordVerifier(string password, byte[] salt) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown Rfc2898DeriveBytes val = new Rfc2898DeriveBytes(password, salt, 120000, HashAlgorithmName.SHA256); try { return ((DeriveBytes)val).GetBytes(32); } finally { ((System.IDisposable)val)?.Dispose(); } } private static string ComputePasswordProof(byte[] verifier, string challenge, string steamId) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown HMACSHA256 val = new HMACSHA256(verifier); try { byte[] bytes = Encoding.UTF8.GetBytes(challenge + "|" + steamId); return Convert.ToBase64String(((HashAlgorithm)val).ComputeHash(bytes)); } finally { ((System.IDisposable)val)?.Dispose(); } } private static bool FixedTimeEquals(string expected, string supplied) { if (string.IsNullOrEmpty(expected) || string.IsNullOrEmpty(supplied)) { return false; } byte[] bytes = Encoding.UTF8.GetBytes(expected); byte[] bytes2 = Encoding.UTF8.GetBytes(supplied); int num = bytes.Length ^ bytes2.Length; int num2 = Math.Min(bytes.Length, bytes2.Length); for (int i = 0; i < num2; i++) { num |= bytes[i] ^ bytes2[i]; } return num == 0; } private static void EnsureSessionChallenge() { if (string.IsNullOrWhiteSpace(_sessionChallenge)) { byte[] array = new byte[24]; RandomNumberGenerator.Fill(System.Span.op_Implicit(array)); _sessionChallenge = Convert.ToBase64String(array); } } private static string NormalizeAccessMode(string? value) { string text = (value ?? string.Empty).Trim().ToLowerInvariant(); if (!(text == "whitelist")) { if (!(text == "manual")) { if (text == "password") { return "password"; } return "open"; } return "manual"; } return "whitelist"; } internal static string AccessModeLabel(string? mode) { string text = (mode ?? string.Empty).Trim().ToLowerInvariant(); if (string.Equals(text, "unknown", (StringComparison)4) || text.Length == 0) { return "Unknown"; } string text2 = NormalizeAccessMode(text); return (text2 == "whitelist") ? "Whitelist only" : ((text2 == "manual") ? "Manual approval" : ((!(text2 == "password")) ? "Open / blacklist" : "Password")); } private static void SetClientState(string mode, string salt, string challenge, string status) { string text = (mode ?? string.Empty).Trim().ToLowerInvariant(); bool flag = ((text == "open" || text == "whitelist" || text == "manual" || text == "password") ? true : false); mode = (flag ? text : "unknown"); status = (string.IsNullOrWhiteSpace(status) ? "Host P-Admin policy detected." : status); if (!string.Equals(_clientMode, mode, (StringComparison)4) || !string.Equals(_clientSalt, salt, (StringComparison)4) || !string.Equals(_clientChallenge, challenge, (StringComparison)4) || !string.Equals(_clientStatus, status, (StringComparison)4)) { _clientMode = mode; _clientSalt = salt ?? string.Empty; _clientChallenge = challenge ?? string.Empty; _clientStatus = status; _stateVersion++; } } private static void ForcePolicyRefresh() { _policyPublishRequested = true; _uiSnapshotRequested = true; _stateVersion++; } private static bool CanManage(out string message) { if (!IsLocalHost()) { message = "You do not have access to the organization's control panel."; return false; } message = string.Empty; return true; } private static bool IsLocalHost() { try { return SIAKImperiumMod.Service != null && SIAKImperiumMod.Service.IsLocalLobbyHost(); } catch { return false; } } private static bool TryNormalizeSteamId(string raw, out string steamId, out string message) { steamId = (raw ?? string.Empty).Trim(); message = string.Empty; ulong num = default(ulong); if (steamId.Length != 17 || !ulong.TryParse(steamId, (NumberStyles)0, (IFormatProvider)(object)CultureInfo.InvariantCulture, ref num) || num < 76561197960265728L) { steamId = string.Empty; message = "Enter a valid 17-digit SteamID64."; return false; } steamId = num.ToString((IFormatProvider)(object)CultureInfo.InvariantCulture); return true; } private static void EnsureLoaded() { if (_state != null) { return; } try { _state = JsonConvert.DeserializeObject(SIAKImperiumMod.LocalPhoneAdminState?.Value ?? string.Empty); } catch { _state = null; } if (_state == null) { _state = new ImperiumPhoneAdminState(); } if (string.IsNullOrWhiteSpace(_state.AccessMode)) { _state.AccessMode = (_state.WhitelistOnly ? "whitelist" : "open"); } _state.AccessMode = NormalizeAccessMode(_state.AccessMode); _state.WhitelistOnly = string.Equals(_state.AccessMode, "whitelist", (StringComparison)4); ImperiumPhoneAdminState state = _state; if (state.PasswordSalt == null) { string text = (state.PasswordSalt = string.Empty); } state = _state; if (state.PasswordVerifier == null) { string text = (state.PasswordVerifier = string.Empty); } _state.Whitelist = NormalizeList((System.Collections.Generic.IEnumerable?)_state.Whitelist); _state.Blacklist = NormalizeList((System.Collections.Generic.IEnumerable?)_state.Blacklist); state = _state; if (state.History == null) { List val = (state.History = new List()); } _state.History = Enumerable.ToList(Enumerable.Take((System.Collections.Generic.IEnumerable)Enumerable.OrderByDescending(Enumerable.Select, ImperiumPhoneAdminHistoryEntry>(Enumerable.GroupBy(Enumerable.Where((System.Collections.Generic.IEnumerable)_state.History, (Func)((ImperiumPhoneAdminHistoryEntry entry) => entry != null && TryNormalizeSteamId(entry.SteamId, out string _, out string _))), (Func)((ImperiumPhoneAdminHistoryEntry entry) => entry.SteamId), (IEqualityComparer)(object)StringComparer.Ordinal), (Func, ImperiumPhoneAdminHistoryEntry>)((IGrouping group) => Enumerable.First((System.Collections.Generic.IEnumerable)Enumerable.OrderByDescending((System.Collections.Generic.IEnumerable)group, (Func)((ImperiumPhoneAdminHistoryEntry entry) => ParseUtc(entry.LastSeenUtc)))))), (Func)((ImperiumPhoneAdminHistoryEntry entry) => ParseUtc(entry.LastSeenUtc))), 100)); } private static List NormalizeList(System.Collections.Generic.IEnumerable? source) { List val = new List(); System.Collections.Generic.IEnumerator enumerator = (source ?? System.Array.Empty()).GetEnumerator(); try { while (((System.Collections.IEnumerator)enumerator).MoveNext()) { string current = enumerator.Current; if (TryNormalizeSteamId(current, out string steamId, out string _) && !Enumerable.Contains((System.Collections.Generic.IEnumerable)val, steamId, (IEqualityComparer)(object)StringComparer.Ordinal)) { val.Add(steamId); } } } finally { ((System.IDisposable)enumerator)?.Dispose(); } return val; } private static void SaveChanged() { Save(); _stateVersion++; } private static void Save() { if (_state != null && SIAKImperiumMod.LocalPhoneAdminState != null) { _state.History = Enumerable.ToList(Enumerable.Take((System.Collections.Generic.IEnumerable)Enumerable.OrderByDescending((System.Collections.Generic.IEnumerable)(_state.History ?? new List()), (Func)((ImperiumPhoneAdminHistoryEntry entry) => ParseUtc(entry.LastSeenUtc))), 100)); SIAKImperiumMod.LocalPhoneAdminState.Value = JsonConvert.SerializeObject((object)_state); SIAKImperiumMod.ConfigCategory.SaveToFile(false); } } private static void AddOrUpdateHistory(string steamId, string name, string decision, bool isNewConnection) { EnsureLoaded(); string text = System.DateTime.UtcNow.ToString("O", (IFormatProvider)(object)CultureInfo.InvariantCulture); ImperiumPhoneAdminHistoryEntry imperiumPhoneAdminHistoryEntry = FindHistory(steamId); if (imperiumPhoneAdminHistoryEntry == null) { imperiumPhoneAdminHistoryEntry = new ImperiumPhoneAdminHistoryEntry { SteamId = steamId, Name = (string.IsNullOrWhiteSpace(name) ? "Unknown Steam user" : name), FirstSeenUtc = text, LastSeenUtc = text, LastDecision = decision, JoinCount = 1 }; _state.History.Add(imperiumPhoneAdminHistoryEntry); } else { if (!string.IsNullOrWhiteSpace(name)) { imperiumPhoneAdminHistoryEntry.Name = name; } imperiumPhoneAdminHistoryEntry.LastSeenUtc = text; imperiumPhoneAdminHistoryEntry.LastDecision = decision; if (isNewConnection) { imperiumPhoneAdminHistoryEntry.JoinCount = Math.Max(1, imperiumPhoneAdminHistoryEntry.JoinCount + 1); } } } private static void MarkDisconnectedHistory(System.Collections.Generic.IEnumerable steamIds) { if (_state == null) { return; } string lastSeenUtc = System.DateTime.UtcNow.ToString("O", (IFormatProvider)(object)CultureInfo.InvariantCulture); bool flag = false; System.Collections.Generic.IEnumerator enumerator = steamIds.GetEnumerator(); try { while (((System.Collections.IEnumerator)enumerator).MoveNext()) { string current = enumerator.Current; ImperiumPhoneAdminHistoryEntry imperiumPhoneAdminHistoryEntry = FindHistory(current); if (imperiumPhoneAdminHistoryEntry != null) { imperiumPhoneAdminHistoryEntry.LastSeenUtc = lastSeenUtc; flag = true; } } } finally { ((System.IDisposable)enumerator)?.Dispose(); } if (flag) { Save(); } } private static ImperiumPhoneAdminHistoryEntry? FindHistory(string steamId) { ImperiumPhoneAdminState? state = _state; object result; if (state == null) { result = null; } else { List history = state.History; result = ((history != null) ? Enumerable.FirstOrDefault((System.Collections.Generic.IEnumerable)history, (Func)((ImperiumPhoneAdminHistoryEntry entry) => string.Equals(entry.SteamId, steamId, (StringComparison)4))) : null); } return (ImperiumPhoneAdminHistoryEntry?)result; } internal static string ResolveKnownName(string steamId) { ImperiumPhoneAdminPlayerView imperiumPhoneAdminPlayerView = default(ImperiumPhoneAdminPlayerView); if (CurrentPlayers.TryGetValue(steamId, ref imperiumPhoneAdminPlayerView) && !string.IsNullOrWhiteSpace(imperiumPhoneAdminPlayerView.Name)) { return imperiumPhoneAdminPlayerView.Name; } ImperiumPhoneAdminHistoryEntry imperiumPhoneAdminHistoryEntry = FindHistory(steamId); if (imperiumPhoneAdminHistoryEntry != null && !string.IsNullOrWhiteSpace(imperiumPhoneAdminHistoryEntry.Name)) { return imperiumPhoneAdminHistoryEntry.Name; } return ImperiumPhoneAdminSteamBridge.GetPersonaName(steamId); } private static void SetConnectionStatus(string value) { value = (string.IsNullOrWhiteSpace(value) ? "Steam lobby status unavailable." : value); if (!string.Equals(_connectionStatus, value, (StringComparison)4)) { _connectionStatus = value; _stateVersion++; } } private static bool AddUnique(List list, string value) { if (Contains((System.Collections.Generic.IEnumerable)list, value)) { return false; } list.Add(value); return true; } private static bool RemoveValue(List list, string value) { bool result = false; for (int num = list.Count - 1; num >= 0; num--) { if (string.Equals(list[num], value, (StringComparison)4)) { list.RemoveAt(num); result = true; } } return result; } private static bool Contains(System.Collections.Generic.IEnumerable values, string value) { return Enumerable.Any(values, (Func)((string candidate) => string.Equals(candidate, value, (StringComparison)4))); } private static System.DateTime ParseUtc(string? value) { System.DateTime dateTime = default(System.DateTime); return System.DateTime.TryParse(value, (IFormatProvider)(object)CultureInfo.InvariantCulture, (DateTimeStyles)128, ref dateTime) ? dateTime : System.DateTime.MinValue; } private static ImperiumPhoneAdminPlayerView ClonePlayer(ImperiumPhoneAdminPlayerView source) { return new ImperiumPhoneAdminPlayerView { SteamId = source.SteamId, Name = source.Name, IsFriend = source.IsFriend, IsHost = source.IsHost, IsAllowed = source.IsAllowed, IsBlocked = source.IsBlocked, IsPending = source.IsPending, Decision = source.Decision, FirstSeenUtc = source.FirstSeenUtc }; } private static ImperiumPhoneAdminHistoryEntry CloneHistory(ImperiumPhoneAdminHistoryEntry source) { return new ImperiumPhoneAdminHistoryEntry { SteamId = source.SteamId, Name = source.Name, FirstSeenUtc = source.FirstSeenUtc, LastSeenUtc = source.LastSeenUtc, LastDecision = source.LastDecision, JoinCount = source.JoinCount }; } } internal sealed class ImperiumPhoneAdminController : MonoBehaviour { private ImperiumHtmlDocument? _document; private GameObject? _root; private string _tab = "online"; private string _notice = string.Empty; private int _lastRuntimeVersion = -1; private float _nextUiRefreshAt; private float _nextAvatarRefreshAt; private float _nextPlayerCountCheckAt; private int _lastObservedPlayerCount = -1; private readonly List _avatarTargets = new List(); public ImperiumPhoneAdminController(System.IntPtr pointer) : base(pointer) { } public bool Initialize(GameObject root) { _root = root; Canvas.ForceUpdateCanvases(); return Render(); } public void OnEnable() { ImperiumPhoneAdminRuntime.RequestUiSnapshot(); RefreshNow(); } public void Update() { if ((Object)(object)_root == (Object)null || !_root.activeInHierarchy || !ImperiumPhoneAdminApp.IsActuallyOpen()) { return; } float unscaledTime = Time.unscaledTime; if (unscaledTime >= _nextPlayerCountCheckAt) { _nextPlayerCountCheckAt = unscaledTime + 1f; int loadedPlayerCount = ImperiumPhoneAdminSteamBridge.GetLoadedPlayerCount(); if (loadedPlayerCount >= 0 && loadedPlayerCount != _lastObservedPlayerCount) { _lastObservedPlayerCount = loadedPlayerCount; ImperiumPhoneAdminRuntime.RequestWorldPlayerSnapshot(); } } if (!(unscaledTime < _nextUiRefreshAt)) { _nextUiRefreshAt = unscaledTime + 0.1f; ImperiumHtmlDocument? document = _document; if (document != null && document.RefreshViewport()) { _document.RefreshLayout(); } if (_lastRuntimeVersion != ImperiumPhoneAdminRuntime.StateVersion) { Render(); } else if (unscaledTime >= _nextAvatarRefreshAt) { _nextAvatarRefreshAt = unscaledTime + 10f; ApplyArtwork(); } } } public void OnDestroy() { _document?.Dispose(); _document = null; ImperiumPhoneAdminApp.NotifyUiDestroyed(this); ImperiumPhoneAdminAssets.InvalidateLogo(); } internal void RefreshNow() { if ((Object)(object)_root != (Object)null) { Render(); } } [HideFromIl2Cpp] private bool Render() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Expected O, but got Unknown //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Expected O, but got Unknown //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Expected O, but got Unknown if ((Object)(object)_root == (Object)null) { return false; } ImperiumPhoneAdminDashboardView dashboardView = ImperiumPhoneAdminRuntime.GetDashboardView(); Dictionary actions = new Dictionary((IEqualityComparer)(object)StringComparer.Ordinal) { ["padmin.tab.online"] = (Action)([CompilerGenerated] () => { _tab = "online"; _notice = string.Empty; Render(); }), ["padmin.tab.history"] = (Action)([CompilerGenerated] () => { _tab = "history"; _notice = string.Empty; Render(); }), ["padmin.tab.rules"] = (Action)([CompilerGenerated] () => { _tab = "rules"; _notice = string.Empty; Render(); }), ["padmin.mode.open"] = (Action)([CompilerGenerated] () => { ImperiumPhoneAdminRuntime.SetAccessMode("open", out _notice); Render(); }), ["padmin.mode.whitelist"] = (Action)([CompilerGenerated] () => { ImperiumPhoneAdminRuntime.SetAccessMode("whitelist", out _notice); Render(); }), ["padmin.mode.manual"] = (Action)([CompilerGenerated] () => { ImperiumPhoneAdminRuntime.SetAccessMode("manual", out _notice); Render(); }), ["padmin.mode.password"] = (Action)([CompilerGenerated] () => { ImperiumPhoneAdminRuntime.SetAccessMode("password", out _notice); Render(); }), ["padmin.toggle.friends"] = (Action)([CompilerGenerated] () => { ImperiumPhoneAdminRuntime.ToggleAllowSteamFriends(out _notice); Render(); }), ["padmin.password.set"] = new Action(SetHostPassword), ["padmin.password.clear"] = (Action)([CompilerGenerated] () => { ImperiumPhoneAdminRuntime.ClearPassword(out _notice); Render(); }), ["padmin.client.password.submit"] = new Action(SubmitClientPassword), ["padmin.manual.whitelist"] = new Action(AddManualWhitelist), ["padmin.manual.blacklist"] = new Action(AddManualBlacklist) }; string text; if (!dashboardView.HostAccess) { text = BuildClientAccess(dashboardView); } else { string tab = _tab; string text2 = ((tab == "history") ? BuildHistory(dashboardView, actions) : ((!(tab == "rules")) ? BuildOnline(dashboardView, actions) : BuildRules(dashboardView, actions))); text = text2; } string html = ImperiumAssets.LoadEmbeddedText("interface/phone-admin/index.html").Replace("{{CONTENT}}", text, (StringComparison)4); string css = ImperiumAssets.LoadEmbeddedText("interface/phone-admin/styles.css"); string script = ImperiumAssets.LoadEmbeddedText("interface/phone-admin/app.js"); _document?.Dispose(); _document = ImperiumWebUiRuntime.TryRender(_root.transform, html, css, script, (IReadOnlyDictionary?)(object)actions, out string _, ImperiumInterfaceSurface.Landscape); if (_document == null) { return false; } _document.SetImage("padmin-header-logo", ImperiumPhoneAdminAssets.LoadLogoSprite()); ApplyArtwork(); _document.RefreshLayout(); _lastRuntimeVersion = ImperiumPhoneAdminRuntime.StateVersion; _nextUiRefreshAt = Time.unscaledTime + 0.1f; _nextAvatarRefreshAt = Time.unscaledTime + 10f; _nextPlayerCountCheckAt = Time.unscaledTime; return true; } [HideFromIl2Cpp] private string BuildOnline(ImperiumPhoneAdminDashboardView view, Dictionary actions) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Expected O, but got Unknown _avatarTargets.Clear(); StringBuilder val = new StringBuilder(); Enumerator enumerator = view.CurrentPlayers.GetEnumerator(); try { while (enumerator.MoveNext()) { ImperiumPhoneAdminPlayerView current = enumerator.Current; string safeKey = current.SteamId; string text = "padmin-avatar-online-" + safeKey; _avatarTargets.Add(new ImperiumPhoneAdminAvatarTarget(text, current.SteamId)); string text2 = "padmin.online.approve." + safeKey; string text3 = "padmin.online.whitelist." + safeKey; string text4 = "padmin.online.blacklist." + safeKey; string text5 = "padmin.online.kick." + safeKey; actions[text2] = (Action)delegate { ImperiumPhoneAdminRuntime.ApproveOnce(safeKey, out _notice); Render(); }; actions[text3] = (Action)delegate { ImperiumPhoneAdminRuntime.AddToWhitelist(safeKey, out _notice); Render(); }; actions[text4] = (Action)delegate { ImperiumPhoneAdminRuntime.AddToBlacklist(safeKey, out _notice); Render(); }; actions[text5] = (Action)delegate { ImperiumPhoneAdminRuntime.KickNow(safeKey, out _notice); Render(); }; string text6 = (current.IsPending ? "player-row pending" : (current.IsBlocked ? "player-row blocked" : (current.IsHost ? "player-row host" : "player-row allowed"))); string text7 = (current.IsFriend ? "STEAM FRIEND" : "STEAM USER"); string text8 = (current.IsPending ? "PENDING" : (current.IsBlocked ? "BLOCKED" : (current.IsHost ? "HOST" : "ALLOWED"))); val.Append("
") .Append("
") .Append("

") .Append(E(current.Name)) .Append("

") .Append("

") .Append(text7) .Append("

") .Append("

") .Append(text8) .Append("

") .Append(E(current.Decision)) .Append("

") .Append("
"); if (current.IsHost) { val.Append("

HOST CONNECTION PROTECTED

"); } else if (current.IsPending) { val.Append("") .Append("") .Append(""); } else { val.Append("") .Append("") .Append(""); } val.Append("
"); } } finally { ((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } if (val.Length == 0) { val.Append("

No Steam users detected

").Append("

The host is waiting for the active Steam lobby and connected members.

"); } int num = Enumerable.Count((System.Collections.Generic.IEnumerable)view.CurrentPlayers, (Func)((ImperiumPhoneAdminPlayerView player) => player.IsPending)); int num2 = Math.Max(170, view.CurrentPlayers.Count * 104 + 10); int num3 = 250 + num2; return string.Concat(new string[9] { Navigation("online"), Notice(), $"
", "
", SummaryCard("CURRENTLY ONLINE", view.CurrentPlayers.Count.ToString((IFormatProvider)(object)CultureInfo.InvariantCulture), view.ConnectionStatus), SummaryCard("ACCESS MODE", ImperiumPhoneAdminRuntime.AccessModeLabel(view.AccessMode).ToUpperInvariant(), (num > 0) ? $"{num} awaiting approval" : "No pending requests"), SummaryCard("SAVED RULES", $"{view.Whitelist.Count} / {view.Blacklist.Count}", "Whitelist / Blacklist"), "

LIVE STEAM CONNECTIONS

Connected users

Pending users must be accepted before the 60-second approval window expires.

", $"
{val}
" }); } [HideFromIl2Cpp] private string BuildHistory(ImperiumPhoneAdminDashboardView view, Dictionary actions) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Expected O, but got Unknown _avatarTargets.Clear(); StringBuilder val = new StringBuilder(); System.Collections.Generic.IEnumerator enumerator = Enumerable.Take((System.Collections.Generic.IEnumerable)view.History, 50).GetEnumerator(); try { while (((System.Collections.IEnumerator)enumerator).MoveNext()) { ImperiumPhoneAdminHistoryEntry current = enumerator.Current; string safeKey = current.SteamId; string text = "padmin-avatar-history-" + safeKey; _avatarTargets.Add(new ImperiumPhoneAdminAvatarTarget(text, current.SteamId)); string text2 = "padmin.history.whitelist." + safeKey; string text3 = "padmin.history.blacklist." + safeKey; actions[text2] = (Action)delegate { ImperiumPhoneAdminRuntime.AddToWhitelist(safeKey, out _notice); Render(); }; actions[text3] = (Action)delegate { ImperiumPhoneAdminRuntime.AddToBlacklist(safeKey, out _notice); Render(); }; val.Append("
").Append("
") .Append("

") .Append(E(current.Name)) .Append("

") .Append("

STEAM ACCOUNT

") .Append("

") .Append(E(current.LastDecision)) .Append("

") .Append("

") .Append(E(FormatTimestamp(current.LastSeenUtc))) .Append("

") .Append("

") .Append(current.JoinCount.ToString((IFormatProvider)(object)CultureInfo.InvariantCulture)) .Append(" connection(s)

") .Append("
") .Append("
"); } } finally { ((System.IDisposable)enumerator)?.Dispose(); } if (val.Length == 0) { val.Append("

No connection history yet

").Append("

Steam accounts will appear here after the host detects them.

"); } int num = Math.Max(190, Math.Min(50, view.History.Count) * 92 + 10); int num2 = 150 + num; return string.Concat(new string[5] { Navigation("history"), Notice(), $"
", "

AUDIT HISTORY

Previous Steam connections

Use an earlier connection to add the account to either access list.

", $"
{val}
" }); } [HideFromIl2Cpp] private string BuildRules(ImperiumPhoneAdminDashboardView view, Dictionary actions) { _avatarTargets.Clear(); string text = BuildRuleRows((System.Collections.Generic.IReadOnlyList)view.Whitelist, whitelist: true, actions); string text2 = BuildRuleRows((System.Collections.Generic.IReadOnlyList)view.Blacklist, whitelist: false, actions); int num = Math.Max(Math.Max(1, view.Whitelist.Count), Math.Max(1, view.Blacklist.Count)); int num2 = Math.Max(180, num * 70 + 10); int num3 = 660 + num2; return string.Concat(new string[17] { Navigation("rules"), Notice(), $"
", "

HOST ACCESS POLICY

Connection approval modes

Blacklisted users are always removed. Whitelisted users bypass every restricted mode.

", ModeCard("OPEN / BLACKLIST", "Anyone not blacklisted is allowed.", "open", view.AccessMode), ModeCard("WHITELIST ONLY", "Existing players stay for this session. New joins and reconnects must be whitelisted.", "whitelist", view.AccessMode), ModeCard("MANUAL ACCEPT", "Unknown users wait up to 60 seconds for the host.", "manual", view.AccessMode), ModeCard("PASSWORD", "Imperium users may prove the password; the host can still accept manually.", "password", view.AccessMode), "
", PolicyCard("ALLOW STEAM FRIENDS", view.AllowSteamFriends ? "ENABLED" : "DISABLED", "Friends bypass whitelist, manual, and password checks when enabled.", "padmin.toggle.friends", view.AllowSteamFriends ? "Disable friends" : "Allow friends", view.AllowSteamFriends), "

PASSWORD MODE

", view.PasswordConfigured ? "PASSWORD CONFIGURED" : "NO PASSWORD SET", "

Only a salted verifier is saved. The plain password is never stored or placed in Steam lobby data.

Manual SteamID64 entry

Paste the account's 17-digit SteamID64, then choose the destination list.

", $"
", $"

Whitelist ({view.Whitelist.Count})

{text}
", $"

Blacklist ({view.Blacklist.Count})

{text2}
", "
" }); } [HideFromIl2Cpp] private string BuildRuleRows(System.Collections.Generic.IReadOnlyList ids, bool whitelist, Dictionary actions) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0087: 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_0091: Expected O, but got Unknown if (((System.Collections.Generic.IReadOnlyCollection)ids).Count == 0) { return "

No Steam accounts saved in this list.

"; } StringBuilder val = new StringBuilder(); System.Collections.Generic.IEnumerator enumerator = ((System.Collections.Generic.IEnumerable)ids).GetEnumerator(); try { while (((System.Collections.IEnumerator)enumerator).MoveNext()) { string current = enumerator.Current; string safeKey = current; string text = (whitelist ? "padmin.rule.unwhitelist." : "padmin.rule.unblacklist.") + safeKey; actions[text] = (whitelist ? ((Action)delegate { ImperiumPhoneAdminRuntime.RemoveFromWhitelist(safeKey, out _notice); Render(); }) : ((Action)delegate { ImperiumPhoneAdminRuntime.RemoveFromBlacklist(safeKey, out _notice); Render(); })); string value = ImperiumPhoneAdminRuntime.ResolveKnownName(current); val.Append("

").Append(E(value)).Append("

") .Append(whitelist ? "WHITELISTED STEAM ACCOUNT" : "BLACKLISTED STEAM ACCOUNT") .Append("

") .Append("
"); } } finally { ((System.IDisposable)enumerator)?.Dispose(); } return ((object)val).ToString(); } [HideFromIl2Cpp] private string BuildClientAccess(ImperiumPhoneAdminDashboardView view) { _avatarTargets.Clear(); string text = ImperiumPhoneAdminRuntime.AccessModeLabel(view.ClientMode); if (string.Equals(view.ClientMode, "password", (StringComparison)4)) { return "

P-ADMIN PASSWORD REQUIRED

Protected lobby

The host requires Imperium password verification or manual approval.

" + E(view.ClientStatus) + "

The plain password is not sent through Steam. Without approval, the host removes the connection after the approval window.

"; } string value = (string.Equals(view.ClientMode, "manual", (StringComparison)4) ? "Waiting for host approval" : "Access denied"); string value2 = (string.Equals(view.ClientMode, "manual", (StringComparison)4) ? "The host must manually accept your Steam account. Unapproved connections expire after 60 seconds." : "You do not have access to the organization's control panel."); return string.Concat(new string[9] { "

HOST POLICY: ", E(text.ToUpperInvariant()), "

", E(value), "

", E(value2), "

", E(view.ClientStatus), "

Administration settings remain available only to the current lobby host.

" }); } [HideFromIl2Cpp] private void AddManualWhitelist() { string rawSteamId = _document?.GetInputValue("padmin-steamid-input") ?? string.Empty; ImperiumPhoneAdminRuntime.AddToWhitelist(rawSteamId, out _notice); Render(); } [HideFromIl2Cpp] private void AddManualBlacklist() { string rawSteamId = _document?.GetInputValue("padmin-steamid-input") ?? string.Empty; ImperiumPhoneAdminRuntime.AddToBlacklist(rawSteamId, out _notice); Render(); } [HideFromIl2Cpp] private void SetHostPassword() { string rawPassword = _document?.GetInputValue("padmin-password-input") ?? string.Empty; ImperiumPhoneAdminRuntime.SetPassword(rawPassword, out _notice); Render(); } [HideFromIl2Cpp] private void SubmitClientPassword() { string rawPassword = _document?.GetInputValue("padmin-client-password") ?? string.Empty; ImperiumPhoneAdminRuntime.SubmitClientPassword(rawPassword, out _notice); Render(); } private void ApplyArtwork() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (_document == null || !ImperiumPhoneAdminApp.IsActuallyOpen()) { return; } _document.SetImage("padmin-header-logo", ImperiumPhoneAdminAssets.LoadLogoSprite()); Enumerator enumerator = _avatarTargets.GetEnumerator(); try { while (enumerator.MoveNext()) { ImperiumPhoneAdminAvatarTarget current = enumerator.Current; Sprite avatarSprite = ImperiumPhoneAdminRuntime.GetAvatarSprite(current.SteamId); if ((Object)(object)avatarSprite != (Object)null) { _document.SetImage(current.ElementId, avatarSprite); } } } finally { ((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } } private string Navigation(string active) { string text = ((active == "online") ? "tab-button active" : "tab-button"); string text2 = ((active == "history") ? "tab-button active" : "tab-button"); string text3 = ((active == "rules") ? "tab-button active" : "tab-button"); return string.Concat(new string[7] { "" }); } private string Notice() { return string.IsNullOrWhiteSpace(_notice) ? string.Empty : ("

" + E(_notice) + "

"); } private static string SummaryCard(string label, string value, string detail) { return string.Concat(new string[7] { "

", E(label), "

", E(value), "

", E(detail), "

" }); } private static string PolicyCard(string label, string value, string detail, string action, string buttonText, bool enabled) { return $"

{E(label)}

{E(value)}

{E(detail)}

"; } private static string ModeCard(string title, string detail, string mode, string activeMode) { bool flag = string.Equals(mode, activeMode, (StringComparison)4); return $"

{(flag ? "ACTIVE MODE" : "AVAILABLE")}

{E(title)}

{E(detail)}

"; } private static string FormatTimestamp(string value) { System.DateTime dateTime = default(System.DateTime); if (!System.DateTime.TryParse(value, (IFormatProvider)(object)CultureInfo.InvariantCulture, (DateTimeStyles)128, ref dateTime)) { return "Unknown time"; } return dateTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm", (IFormatProvider)(object)CultureInfo.InvariantCulture); } private static string E(string? value) { return SecurityElement.Escape(value ?? string.Empty) ?? string.Empty; } } internal static class ImperiumPhoneAdminConnectionEvents { private const string HarmonyId = "siak.imperium.padmin.connection-events"; private static Harmony? _harmony; private static bool _attempted; private static bool _patched; internal static void EnsurePatched() { //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Expected O, but got Unknown //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Expected O, but got Unknown //IL_015d: Expected O, but got Unknown if (_patched || _attempted) { return; } _attempted = true; try { System.Type type = FindServerManagerType(); if (type == (System.Type)null) { LogDisabled("Il2CppFishNet ServerManager was not found."); return; } MethodInfo val = Enumerable.FirstOrDefault((System.Collections.Generic.IEnumerable)Enumerable.ThenBy(Enumerable.OrderBy(Enumerable.Where((System.Collections.Generic.IEnumerable)type.GetMethods((BindingFlags)52), (Func)delegate(MethodInfo method) { if (((MethodBase)method).IsAbstract || ((MethodBase)method).IsSpecialName || ((MethodBase)method).ContainsGenericParameters) { return false; } ParameterInfo[] parameters = ((MethodBase)method).GetParameters(); return parameters.Length == 1 && string.Equals(((MemberInfo)parameters[0].ParameterType).Name, "RemoteConnectionStateArgs", (StringComparison)4); }), (Func)((MethodInfo method) => (!string.Equals(((MemberInfo)method).Name, "Transport_OnRemoteConnectionState", (StringComparison)4)) ? 1 : 0)), (Func)((MethodInfo method) => (!((MemberInfo)method).Name.Contains("Transport", (StringComparison)5)) ? 1 : 0))); if (val == (MethodInfo)null) { LogDisabled("ServerManager.Transport_OnRemoteConnectionState(RemoteConnectionStateArgs) was not found."); return; } MethodInfo val2 = AccessTools.Method(typeof(ImperiumPhoneAdminConnectionEvents), "RemoteStatePrefix", (System.Type[])null, (System.Type[])null); MethodInfo val3 = AccessTools.Method(typeof(ImperiumPhoneAdminConnectionEvents), "RemoteStatePostfix", (System.Type[])null, (System.Type[])null); if (val2 == (MethodInfo)null || val3 == (MethodInfo)null) { LogDisabled("The P-Admin connection callbacks could not be resolved."); return; } _harmony = new Harmony("siak.imperium.padmin.connection-events"); _harmony.Patch((MethodBase)(object)val, new HarmonyMethod(val2), new HarmonyMethod(val3), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); _patched = true; } catch (System.Exception ex) { LogDisabled("The exact FishNet connection hook failed: " + ex.Message); } } internal static void Dispose() { try { Harmony? harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } catch { } ImperiumPhoneAdminSteamBridge.SetFishNetServerManager(null); _harmony = null; _attempted = false; _patched = false; } public static void RemoteStatePrefix(object __instance, object[] __args) { try { ImperiumPhoneAdminSteamBridge.SetFishNetServerManager(__instance); if (!(!TryReadRemoteState(__args, out var started, out var connectionId) || started)) { ImperiumPhoneAdminRuntime.NotifyRemoteConnectionState(started: false, connectionId, TryReadClient(__instance, connectionId)); } } catch (System.Exception) { } } public static void RemoteStatePostfix(object __instance, object[] __args) { try { ImperiumPhoneAdminSteamBridge.SetFishNetServerManager(__instance); if (TryReadRemoteState(__args, out var started, out var connectionId) && started) { object connection = TryReadClient(__instance, connectionId); ImperiumPhoneAdminRuntime.NotifyRemoteConnectionState(started: true, connectionId, connection); } } catch (System.Exception) { } } private static bool TryReadRemoteState(object[] args, out bool started, out int connectionId) { started = false; connectionId = -1; if (args == null || args.Length != 1 || args[0] == null) { return false; } object obj = args[0]; if (!string.Equals(((MemberInfo)obj.GetType()).Name, "RemoteConnectionStateArgs", (StringComparison)4)) { return false; } connectionId = ReadIntMember(obj, "ConnectionId", -1); if (connectionId < 0) { return false; } string text = ReadMember(obj, "ConnectionState")?.ToString() ?? string.Empty; if (text.EndsWith("Started", (StringComparison)5)) { started = true; return true; } if (text.EndsWith("Stopped", (StringComparison)5)) { started = false; return true; } return false; } private static object? TryReadClient(object serverManager, int connectionId) { try { object obj = ReadMember(serverManager, "Clients"); if (obj == null) { return null; } IDictionary val = (IDictionary)((obj is IDictionary) ? obj : null); if (val != null) { return val.Contains((object)connectionId) ? val[(object)connectionId] : null; } System.Type type = obj.GetType(); MethodInfo val2 = Enumerable.FirstOrDefault((System.Collections.Generic.IEnumerable)type.GetMethods((BindingFlags)52), (Func)delegate(MethodInfo method) { if (!string.Equals(((MemberInfo)method).Name, "TryGetValue", (StringComparison)4)) { return false; } ParameterInfo[] parameters = ((MethodBase)method).GetParameters(); return parameters.Length == 2 && parameters[0].ParameterType == typeof(int) && parameters[1].ParameterType.IsByRef; }); if (val2 != (MethodInfo)null) { object[] array = new object[2] { connectionId, null }; object obj2 = ((MethodBase)val2).Invoke(obj, array); bool flag = default(bool); int num; if (obj2 is bool) { flag = (bool)obj2; num = 1; } else { num = 0; } if (((uint)num & (flag ? 1u : 0u)) != 0) { return array[1]; } } PropertyInfo property = type.GetProperty("Item", (BindingFlags)52, (Binder)null, (System.Type)null, new System.Type[1] { typeof(int) }, (ParameterModifier[])null); if (property != (PropertyInfo)null) { return property.GetValue(obj, new object[1] { connectionId }); } } catch { } return null; } private static System.Type? FindServerManagerType() { string[] array = new string[2] { "Il2CppFishNet.Managing.Server.ServerManager", "FishNet.Managing.Server.ServerManager" }; string[] array2 = array; foreach (string text in array2) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly val in assemblies) { try { System.Type type = val.GetType(text, false, false); if (type != (System.Type)null) { return type; } } catch { } } } return null; } private static void LogDisabled(string reason) { _patched = false; Instance? modLogger = SIAKImperiumMod.ModLogger; if (modLogger != null) { modLogger.Error("[P-Admin] Connection interception disabled: " + reason); } } private static object? ReadMember(object source, string memberName) { try { System.Type type = source.GetType(); PropertyInfo property = type.GetProperty(memberName, (BindingFlags)52); if (property != (PropertyInfo)null && property.GetIndexParameters().Length == 0) { return property.GetValue(source); } FieldInfo field = type.GetField(memberName, (BindingFlags)52); return (field != null) ? field.GetValue(source) : null; } catch { return null; } } private static int ReadIntMember(object source, string memberName, int fallback) { try { object obj = ReadMember(source, memberName); return (obj == null) ? fallback : Convert.ToInt32(obj, (IFormatProvider)(object)CultureInfo.InvariantCulture); } catch { return fallback; } } } internal static class ImperiumPhoneAdminPreConnectGate { private const string HarmonyId = "siak.imperium.padmin.preconnect-gate"; private static Harmony? _harmony; private static bool _attempted; private static bool _patched; internal static void EnsurePatched() { //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown if (_patched || _attempted) { return; } _attempted = true; try { System.Type type = FindServerSocketType(); if (type == (System.Type)null) { LogDisabled("FishySteamworks ServerSocket was not found."); return; } MethodInfo val = Enumerable.FirstOrDefault((System.Collections.Generic.IEnumerable)type.GetMethods((BindingFlags)52), (Func)delegate(MethodInfo method) { if (((MethodBase)method).IsAbstract || ((MethodBase)method).IsSpecialName || ((MethodBase)method).ContainsGenericParameters) { return false; } ParameterInfo[] parameters = ((MethodBase)method).GetParameters(); return parameters.Length == 1 && string.Equals(((MemberInfo)parameters[0].ParameterType).Name, "SteamNetConnectionStatusChangedCallback_t", (StringComparison)4); }); if (val == (MethodInfo)null) { LogDisabled("ServerSocket.OnRemoteConnectionState(SteamNetConnectionStatusChangedCallback_t) was not found."); return; } MethodInfo val2 = AccessTools.Method(typeof(ImperiumPhoneAdminPreConnectGate), "ConnectingPrefix", (System.Type[])null, (System.Type[])null); if (val2 == (MethodInfo)null) { LogDisabled("The P-Admin pre-connect callback could not be resolved."); return; } _harmony = new Harmony("siak.imperium.padmin.preconnect-gate"); _harmony.Patch((MethodBase)(object)val, new HarmonyMethod(val2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); _patched = true; } catch (System.Exception ex) { LogDisabled("The pre-connect Steam gate failed to install: " + ex.Message); } } internal static void Dispose() { try { Harmony? harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } catch { } _harmony = null; _attempted = false; _patched = false; } public static bool ConnectingPrefix(object __instance, object[] __args) { try { if (__args == null || __args.Length != 1 || __args[0] == null) { return true; } object source = __args[0]; object obj = ReadField(source, "m_info"); if (obj == null) { return true; } string text = ReadField(obj, "m_eState")?.ToString() ?? string.Empty; if (!text.EndsWith("Connecting", (StringComparison)5)) { return true; } object obj2 = ReadField(obj, "m_identityRemote"); if (obj2 == null) { return true; } MethodInfo method = obj2.GetType().GetMethod("GetSteamID64", (BindingFlags)52, (Binder)null, System.Type.EmptyTypes, (ParameterModifier[])null); if (!(((method != null) ? ((MethodBase)method).Invoke(obj2, (object[])null) : null) is ulong num) || num == 0) { return true; } string steamId = num.ToString((IFormatProvider)(object)CultureInfo.InvariantCulture); if (!ImperiumPhoneAdminRuntime.ShouldPreventBeforeConnect(steamId, out string reason)) { return true; } object obj3 = ReadField(source, "m_hConn"); if (obj3 != null) { ImperiumPhoneAdminSteamBridge.CloseRawConnection(obj3, reason); } ImperiumPhoneAdminRuntime.RecordPreConnectRejection(steamId, reason); return false; } catch (System.Exception) { return true; } } private static object? ReadField(object source, string fieldName) { try { FieldInfo field = source.GetType().GetField(fieldName, (BindingFlags)52); return (field != null) ? field.GetValue(source) : null; } catch { return null; } } private static System.Type? FindServerSocketType() { //IL_0026: Expected O, but got Unknown Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly val in assemblies) { System.Type[] array; try { array = val.GetTypes(); } catch (ReflectionTypeLoadException ex) { ReflectionTypeLoadException ex2 = ex; array = Enumerable.ToArray(Enumerable.Cast((System.Collections.IEnumerable)Enumerable.Where((System.Collections.Generic.IEnumerable)ex2.Types, (Func)((System.Type type2) => type2 != (System.Type)null)))); } catch { continue; } System.Type[] array2 = array; foreach (System.Type type in array2) { if (string.Equals(((MemberInfo)type).Name, "ServerSocket", (StringComparison)4)) { string text = type.FullName ?? string.Empty; if (text.Contains("FishySteamworks", (StringComparison)5)) { return type; } } } } return null; } private static void LogDisabled(string reason) { _patched = false; Instance? modLogger = SIAKImperiumMod.ModLogger; if (modLogger != null) { modLogger.Error("[P-Admin] Pre-connect Steam gate disabled: " + reason); } } } internal static class ImperiumPhoneAdminSteamBridge { [CompilerGenerated] private sealed class d__69 : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable, System.Collections.Generic.IEnumerator, System.IDisposable, System.Collections.IEnumerator { private int <>1__state; private object <>2__current; private int <>l__initialThreadId; private System.Type type; public System.Type <>3__type; private object source; public object <>3__source; private bool staticOnly; public bool <>3__staticOnly; private int depth; public int <>3__depth; private BindingFlags 5__1; private MemberInfo[] <>s__2; private int <>s__3; private MemberInfo 5__4; private string 5__5; private object 5__6; private System.Collections.Generic.IEnumerator <>s__7; private object 5__8; object System.Collections.Generic.IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object System.Collections.IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__69(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void System.IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 2) { try { } finally { <>m__Finally1(); } } <>s__2 = null; 5__4 = null; 5__5 = null; 5__6 = null; <>s__7 = null; 5__8 = null; <>1__state = -2; } private bool MoveNext() { //IL_0046: 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) try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = (BindingFlags)(0x30 | (staticOnly ? 8 : 4)); <>s__2 = type.GetMembers(5__1); <>s__3 = 0; goto IL_0244; case 1: <>1__state = -1; goto IL_0236; case 2: { <>1__state = -3; 5__8 = null; goto IL_0205; } IL_0236: <>s__3++; goto IL_0244; IL_0205: if (((System.Collections.IEnumerator)<>s__7).MoveNext()) { 5__8 = <>s__7.Current; <>2__current = 5__8; <>1__state = 2; return true; } <>m__Finally1(); <>s__7 = null; 5__5 = null; 5__6 = null; 5__4 = null; goto IL_0236; IL_0244: if (<>s__3 < <>s__2.Length) { 5__4 = <>s__2[<>s__3]; if (5__4 is FieldInfo || 5__4 is PropertyInfo) { 5__5 = 5__4.Name; if ((5__5.Contains("lobby", (StringComparison)5) || 5__5.Contains("steam", (StringComparison)5) || 5__5.EndsWith("ID", (StringComparison)5)) && TryReadMemberValue(5__4, source, out 5__6) && 5__6 != null) { if (TryExtractSteamId(5__6, out var _)) { <>2__current = 5__6; <>1__state = 1; return true; } if (depth < 1 && 5__5.Contains("lobby", (StringComparison)5)) { <>s__7 = EnumerateCandidateValues(5__6.GetType(), 5__6, staticOnly: false, depth + 1).GetEnumerator(); <>1__state = -3; goto IL_0205; } } } goto IL_0236; } <>s__2 = null; return false; } } catch { //try-fault ((System.IDisposable)this).Dispose(); throw; } } bool System.Collections.IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>s__7 != null) { ((System.IDisposable)<>s__7).Dispose(); } } [DebuggerHidden] void System.Collections.IEnumerator.Reset() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) throw new NotSupportedException(); } [DebuggerHidden] System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { d__69 d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; d__ = this; } else { d__ = new d__69(0); } d__.type = <>3__type; d__.source = <>3__source; d__.staticOnly = <>3__staticOnly; d__.depth = <>3__depth; return d__; } [DebuggerHidden] System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return (System.Collections.IEnumerator)((System.Collections.Generic.IEnumerable)this).GetEnumerator(); } } [CompilerGenerated] private sealed class d__51 : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable, System.Collections.Generic.IEnumerator, System.IDisposable, System.Collections.IEnumerator { private int <>1__state; private object <>2__current; private int <>l__initialThreadId; private object collection; public object <>3__collection; private System.Collections.IEnumerable 5__1; private System.Type 5__2; private int 5__3; private PropertyInfo 5__4; private System.Collections.IEnumerator <>s__5; private object 5__6; private int 5__7; private object 5__8; object System.Collections.Generic.IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object System.Collections.IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__51(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void System.IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__1 = null; 5__2 = null; 5__4 = null; <>s__5 = null; 5__6 = null; 5__8 = null; <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (collection == null) { return false; } 5__1 = collection as System.Collections.IEnumerable; if (5__1 != null) { <>s__5 = 5__1.GetEnumerator(); <>1__state = -3; goto IL_00d3; } 5__2 = collection.GetType(); 5__3 = ToInt(ReadNamedMember(5__2, collection, staticOnly: false, "Count"), 0); if (5__3 <= 0 || 5__3 > 256) { return false; } 5__4 = 5__2.GetProperty("Item", (BindingFlags)52); if (5__4 == (PropertyInfo)null || 5__4.GetIndexParameters().Length != 1) { return false; } 5__7 = 0; goto IL_0228; case 1: <>1__state = -3; goto IL_00cb; case 2: { <>1__state = -1; goto IL_020e; } IL_0228: if (5__7 < 5__3) { 5__8 = null; try { 5__8 = 5__4.GetValue(collection, new object[1] { 5__7 }); } catch { } if (5__8 != null) { <>2__current = 5__8; <>1__state = 2; return true; } goto IL_020e; } return false; IL_00cb: 5__6 = null; goto IL_00d3; IL_00d3: if (<>s__5.MoveNext()) { 5__6 = <>s__5.Current; if (5__6 != null) { <>2__current = 5__6; <>1__state = 1; return true; } goto IL_00cb; } <>m__Finally1(); <>s__5 = null; return false; IL_020e: 5__8 = null; 5__7++; goto IL_0228; } } catch { //try-fault ((System.IDisposable)this).Dispose(); throw; } } bool System.Collections.IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>s__5 is System.IDisposable disposable) { disposable.Dispose(); } } [DebuggerHidden] void System.Collections.IEnumerator.Reset() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) throw new NotSupportedException(); } [DebuggerHidden] System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { d__51 d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; d__ = this; } else { d__ = new d__51(0); } d__.collection = <>3__collection; return d__; } [DebuggerHidden] System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return (System.Collections.IEnumerator)((System.Collections.Generic.IEnumerable)this).GetEnumerator(); } } [CompilerGenerated] private sealed class d__50 : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable, System.Collections.Generic.IEnumerator, System.IDisposable, System.Collections.IEnumerator { private int <>1__state; private object <>2__current; private int <>l__initialThreadId; private System.Type playerType; public System.Type <>3__playerType; private HashSet 5__1; private object 5__2; private System.Collections.Generic.IEnumerator <>s__3; private object 5__4; private int 5__5; private System.Collections.Generic.IEnumerator <>s__6; private object 5__7; private int 5__8; object System.Collections.Generic.IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object System.Collections.IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__50(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void System.IDisposable.Dispose() { switch (<>1__state) { case -3: case 1: try { } finally { <>m__Finally1(); } break; case -4: case 2: try { } finally { <>m__Finally2(); } break; } 5__1 = null; 5__2 = null; <>s__3 = null; 5__4 = null; <>s__6 = null; 5__7 = null; <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = new HashSet(); 5__2 = null; try { 5__2 = ReadNamedMember(playerType, null, staticOnly: true, "PlayerList"); } catch { 5__2 = null; } <>s__3 = EnumerateCollectionValues(5__2).GetEnumerator(); <>1__state = -3; goto IL_00f3; case 1: <>1__state = -3; goto IL_00eb; case 2: { <>1__state = -4; goto IL_01b5; } IL_01bd: if (((System.Collections.IEnumerator)<>s__6).MoveNext()) { 5__7 = <>s__6.Current; 5__8 = GetObjectIdentity(5__7); if (5__1.Add(5__8)) { <>2__current = 5__7; <>1__state = 2; return true; } goto IL_01b5; } <>m__Finally2(); <>s__6 = null; break; IL_00f3: if (((System.Collections.IEnumerator)<>s__3).MoveNext()) { 5__4 = <>s__3.Current; 5__5 = GetObjectIdentity(5__4); if (5__1.Add(5__5)) { <>2__current = 5__4; <>1__state = 1; return true; } goto IL_00eb; } <>m__Finally1(); <>s__3 = null; if (5__1.Count != 0 || !typeof(Object).IsAssignableFrom(playerType)) { break; } <>s__6 = FindUnityObjectsOfType(playerType).GetEnumerator(); <>1__state = -4; goto IL_01bd; IL_00eb: 5__4 = null; goto IL_00f3; IL_01b5: 5__7 = null; goto IL_01bd; } return false; } catch { //try-fault ((System.IDisposable)this).Dispose(); throw; } } bool System.Collections.IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>s__3 != null) { ((System.IDisposable)<>s__3).Dispose(); } } private void <>m__Finally2() { <>1__state = -1; if (<>s__6 != null) { ((System.IDisposable)<>s__6).Dispose(); } } [DebuggerHidden] void System.Collections.IEnumerator.Reset() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) throw new NotSupportedException(); } [DebuggerHidden] System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { d__50 d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; d__ = this; } else { d__ = new d__50(0); } d__.playerType = <>3__playerType; return d__; } [DebuggerHidden] System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return (System.Collections.IEnumerator)((System.Collections.Generic.IEnumerable)this).GetEnumerator(); } } [CompilerGenerated] private sealed class d__78 : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable, System.Collections.Generic.IEnumerator, System.IDisposable, System.Collections.IEnumerator { private int <>1__state; private object <>2__current; private int <>l__initialThreadId; private System.Type objectType; public System.Type <>3__objectType; private object 5__1; private System.Collections.IEnumerable 5__2; private MethodInfo 5__3; private MethodInfo 5__4; private System.Collections.IEnumerator <>s__5; private object 5__6; object System.Collections.Generic.IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object System.Collections.IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__78(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void System.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; <>s__5 = null; 5__6 = null; <>1__state = -2; } private bool MoveNext() { try { int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -3; goto IL_0221; } <>1__state = -1; if (objectType == (System.Type)null || !typeof(Object).IsAssignableFrom(objectType)) { return false; } 5__1 = null; try { 5__3 = Enumerable.FirstOrDefault((System.Collections.Generic.IEnumerable)typeof(Resources).GetMethods((BindingFlags)24), (Func)((MethodInfo method) => string.Equals(((MemberInfo)method).Name, "FindObjectsOfTypeAll", (StringComparison)4) && ((MethodBase)method).IsGenericMethodDefinition && ((MethodBase)method).GetGenericArguments().Length == 1 && ((MethodBase)method).GetParameters().Length == 0)); if (5__3 != (MethodInfo)null) { 5__1 = ((MethodBase)5__3.MakeGenericMethod(new System.Type[1] { objectType })).Invoke((object)null, (object[])null); } 5__3 = null; } catch { 5__1 = null; } if (5__1 == null) { try { 5__4 = Enumerable.FirstOrDefault((System.Collections.Generic.IEnumerable)typeof(Object).GetMethods((BindingFlags)24), (Func)delegate(MethodInfo method) { if (!string.Equals(((MemberInfo)method).Name, "FindObjectsOfType", (StringComparison)4) || !((MethodBase)method).IsGenericMethodDefinition || ((MethodBase)method).GetGenericArguments().Length != 1) { return false; } ParameterInfo[] parameters = ((MethodBase)method).GetParameters(); return parameters.Length == 1 && parameters[0].ParameterType == typeof(bool); }); if (5__4 != (MethodInfo)null) { 5__1 = ((MethodBase)5__4.MakeGenericMethod(new System.Type[1] { objectType })).Invoke((object)null, new object[1] { true }); } 5__4 = null; } catch { 5__1 = null; } } 5__2 = 5__1 as System.Collections.IEnumerable; if (5__2 == null) { return false; } <>s__5 = 5__2.GetEnumerator(); <>1__state = -3; goto IL_0229; IL_0221: 5__6 = null; goto IL_0229; IL_0229: if (<>s__5.MoveNext()) { 5__6 = <>s__5.Current; if (5__6 != null) { <>2__current = 5__6; <>1__state = 1; return true; } goto IL_0221; } <>m__Finally1(); <>s__5 = null; return false; } catch { //try-fault ((System.IDisposable)this).Dispose(); throw; } } bool System.Collections.IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>s__5 is System.IDisposable disposable) { disposable.Dispose(); } } [DebuggerHidden] void System.Collections.IEnumerator.Reset() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) throw new NotSupportedException(); } [DebuggerHidden] System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { d__78 d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; d__ = this; } else { d__ = new d__78(0); } d__.objectType = <>3__objectType; return d__; } [DebuggerHidden] System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return (System.Collections.IEnumerator)((System.Collections.Generic.IEnumerable)this).GetEnumerator(); } } [CompilerGenerated] private sealed class d__90 : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable, System.Collections.Generic.IEnumerator, System.IDisposable, System.Collections.IEnumerator { private int <>1__state; private System.Type <>2__current; private int <>l__initialThreadId; private Assembly[] <>s__1; private int <>s__2; private Assembly 5__3; private System.Type[] 5__4; private ReflectionTypeLoadException 5__5; private System.Type[] <>s__6; private int <>s__7; private System.Type 5__8; System.Type System.Collections.Generic.IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object System.Collections.IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__90(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void System.IDisposable.Dispose() { <>s__1 = null; 5__3 = null; 5__4 = null; 5__5 = null; <>s__6 = null; 5__8 = null; <>1__state = -2; } private bool MoveNext() { //IL_006a: Expected O, but got Unknown int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; 5__8 = null; <>s__7++; goto IL_0115; } <>1__state = -1; <>s__1 = AppDomain.CurrentDomain.GetAssemblies(); <>s__2 = 0; goto IL_0149; IL_0149: if (<>s__2 < <>s__1.Length) { 5__3 = <>s__1[<>s__2]; try { 5__4 = 5__3.GetTypes(); } catch (ReflectionTypeLoadException ex) { ReflectionTypeLoadException ex2 = ex; 5__5 = ex2; 5__4 = Enumerable.ToArray(Enumerable.Cast((System.Collections.IEnumerable)Enumerable.Where((System.Collections.Generic.IEnumerable)5__5.Types, (Func)((System.Type type) => type != (System.Type)null)))); } catch { goto IL_013b; } <>s__6 = 5__4; <>s__7 = 0; goto IL_0115; } <>s__1 = null; return false; IL_0115: if (<>s__7 < <>s__6.Length) { 5__8 = <>s__6[<>s__7]; <>2__current = 5__8; <>1__state = 1; return true; } <>s__6 = null; 5__4 = null; 5__3 = null; goto IL_013b; IL_013b: <>s__2++; goto IL_0149; } bool System.Collections.IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void System.Collections.IEnumerator.Reset() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) throw new NotSupportedException(); } [DebuggerHidden] System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; return this; } return new d__90(0); } [DebuggerHidden] System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return (System.Collections.IEnumerator)((System.Collections.Generic.IEnumerable)this).GetEnumerator(); } } [CompilerGenerated] private sealed class d__68 : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable, System.Collections.Generic.IEnumerator, System.IDisposable, System.Collections.IEnumerator { private int <>1__state; private object <>2__current; private int <>l__initialThreadId; private System.Type lobbyType; public System.Type <>3__lobbyType; private HashSet 5__1; private List 5__2; private MemberInfo[] <>s__3; private int <>s__4; private MemberInfo 5__5; private object 5__6; private System.Collections.Generic.IEnumerator <>s__7; private object 5__8; private Enumerator <>s__9; private object 5__10; private ulong 5__11; private System.Type 5__12; private System.Collections.Generic.IEnumerator <>s__13; private object 5__14; private ulong 5__15; object System.Collections.Generic.IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object System.Collections.IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__68(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void System.IDisposable.Dispose() { //IL_0074: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; if ((uint)(num - -4) <= 1u || (uint)(num - 1) <= 1u) { try { if (num == -4 || num == 2) { try { } finally { <>m__Finally2(); } } } finally { <>m__Finally1(); } } 5__1 = null; 5__2 = null; <>s__3 = null; 5__5 = null; 5__6 = null; <>s__7 = null; 5__8 = null; <>s__9 = default(Enumerator); 5__10 = null; 5__12 = null; <>s__13 = null; 5__14 = null; <>1__state = -2; } private bool MoveNext() { //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_0387: 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 = new HashSet(); List obj = new List(); obj.Add((object)null); 5__2 = obj; <>s__3 = lobbyType.GetMembers((BindingFlags)56); for (<>s__4 = 0; <>s__4 < <>s__3.Length; <>s__4++) { 5__5 = <>s__3[<>s__4]; if (5__5.Name.Contains("instance", (StringComparison)5) || 5__5.Name.Contains("lobby", (StringComparison)5)) { if (TryReadMemberValue(5__5, null, out 5__6) && 5__6 != null) { 5__2.Add(5__6); } 5__6 = null; 5__5 = null; } } <>s__3 = null; try { if (typeof(Object).IsAssignableFrom(lobbyType)) { <>s__7 = FindUnityObjectsOfType(lobbyType).GetEnumerator(); try { while (((System.Collections.IEnumerator)<>s__7).MoveNext()) { 5__8 = <>s__7.Current; if (5__8 != null) { 5__2.Add(5__8); } 5__8 = null; } } finally { if (<>s__7 != null) { ((System.IDisposable)<>s__7).Dispose(); } } <>s__7 = null; } } catch { } <>s__9 = 5__2.GetEnumerator(); <>1__state = -3; goto IL_036a; } case 1: <>1__state = -3; goto IL_026d; case 2: { <>1__state = -4; 5__14 = null; goto IL_033d; } IL_026d: 5__12 = 5__10?.GetType() ?? lobbyType; <>s__13 = EnumerateCandidateValues(5__12, 5__10, 5__10 == null, 0).GetEnumerator(); <>1__state = -4; goto IL_033d; IL_033d: while (((System.Collections.IEnumerator)<>s__13).MoveNext()) { 5__14 = <>s__13.Current; if (!TryExtractSteamId(5__14, out 5__15) || 5__15 < 10000000000000000L || !5__1.Add(5__15)) { continue; } <>2__current = 5__14; <>1__state = 2; return true; } <>m__Finally2(); <>s__13 = null; 5__12 = null; 5__10 = null; goto IL_036a; IL_036a: if (<>s__9.MoveNext()) { 5__10 = <>s__9.Current; if (5__10 != null && TryExtractSteamId(5__10, out 5__11) && 5__11 >= 10000000000000000L && 5__1.Add(5__11)) { <>2__current = 5__10; <>1__state = 1; return true; } goto IL_026d; } <>m__Finally1(); <>s__9 = default(Enumerator); return false; } } catch { //try-fault ((System.IDisposable)this).Dispose(); throw; } } bool System.Collections.IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((System.IDisposable)<>s__9/*cast due to .constrained prefix*/).Dispose(); } private void <>m__Finally2() { <>1__state = -3; if (<>s__13 != null) { ((System.IDisposable)<>s__13).Dispose(); } } [DebuggerHidden] void System.Collections.IEnumerator.Reset() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) throw new NotSupportedException(); } [DebuggerHidden] System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { d__68 d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; d__ = this; } else { d__ = new d__68(0); } d__.lobbyType = <>3__lobbyType; return d__; } [DebuggerHidden] System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return (System.Collections.IEnumerator)((System.Collections.Generic.IEnumerable)this).GetEnumerator(); } } private const float LobbyResolveRetrySeconds = 5f; private const float AvatarRetrySeconds = 10f; private const float PersonaRefreshSeconds = 30f; private const ulong MinimumIndividualSteamId64 = 76561197960265728uL; private const ulong MinimumPlausibleSteamId64 = 10000000000000000uL; private static readonly Dictionary AvatarCache = new Dictionary((IEqualityComparer)(object)StringComparer.Ordinal); private static readonly Dictionary AvatarRetryAt = new Dictionary((IEqualityComparer)(object)StringComparer.Ordinal); private static readonly Dictionary PersonaNameCache = new Dictionary((IEqualityComparer)(object)StringComparer.Ordinal); private static readonly Dictionary FriendCache = new Dictionary((IEqualityComparer)(object)StringComparer.Ordinal); private static readonly Dictionary ProfileRetryAt = new Dictionary((IEqualityComparer)(object)StringComparer.Ordinal); private static readonly Dictionary StaticMethodCache = new Dictionary((IEqualityComparer)(object)StringComparer.Ordinal); private static System.Type[]? _cachedLobbyTypes; private static MethodInfo? _hasFriendMethod; private static object? _fishNetServerManager; private static System.Type? _steamUserType; private static System.Type? _steamMatchmakingType; private static System.Type? _steamFriendsType; private static System.Type? _steamUtilsType; private static System.Type? _steamNetworkingType; private static System.Type? _steamNetworkingMessagesType; private static System.Type? _steamNetworkingSocketsType; private static System.Type? _steamGameServerNetworkingSocketsType; private static System.Type? _steamIdType; private static object? _cachedLobbyId; private static float _nextLobbyResolveAt; private static bool _resolvedTypes; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] internal static string LocalSteamId { [CompilerGenerated] get; [CompilerGenerated] private set; } = string.Empty; internal static bool RefreshLocalSteamId() { try { ResolveTypes(); if (_steamUserType == (System.Type)null) { return false; } object value = InvokeStatic(_steamUserType, "GetSteamID"); if (!TryExtractSteamId(value, out var steamId) || steamId < 76561197960265728L) { return false; } LocalSteamId = steamId.ToString((IFormatProvider)(object)CultureInfo.InvariantCulture); return true; } catch { return false; } } internal static bool IsLocalSteamId(string steamId) { if (string.IsNullOrWhiteSpace(steamId)) { return false; } if (string.IsNullOrWhiteSpace(LocalSteamId)) { RefreshLocalSteamId(); } return !string.IsNullOrWhiteSpace(LocalSteamId) && string.Equals(steamId, LocalSteamId, (StringComparison)4); } internal static bool IsLocalFishNetConnection(int connectionId, object? connection) { if (connectionId < 0) { return false; } try { if (connection != null) { string[] array = new string[3] { "IsLocalClient", "IsLocalConnection", "IsHostConnection" }; bool flag = default(bool); foreach (string name in array) { object obj = ReadNamedMember(connection.GetType(), connection, staticOnly: false, name); int num; if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } if (((uint)num & (flag ? 1u : 0u)) != 0) { return true; } } } System.Type type = FindType("Il2CppFishNet.InstanceFinder", "FishNet.InstanceFinder"); if (type == (System.Type)null) { return false; } object obj2 = ReadNamedMember(type, null, staticOnly: true, "ClientManager"); if (obj2 == null) { return false; } object obj3 = ReadNamedMember(obj2.GetType(), obj2, staticOnly: false, "Connection") ?? ReadNamedMember(obj2.GetType(), obj2, staticOnly: false, "LocalConnection"); if (obj3 == null) { return false; } if (connection != null && connection == obj3) { return true; } int num2 = TryReadFishNetClientId(obj3); return num2 >= 0 && num2 == connectionId; } catch { return false; } } internal static bool TryGetLobbyMembers(out List members, out string localSteamId, out string lobbyOwnerSteamId, out string status) { members = new List(); localSteamId = string.Empty; lobbyOwnerSteamId = string.Empty; status = "Steam API is not ready."; ResolveTypes(); if (_steamUserType == (System.Type)null || _steamMatchmakingType == (System.Type)null || _steamIdType == (System.Type)null) { status = "Steamworks types were not found in the current game build."; return false; } object value = InvokeStatic(_steamUserType, "GetSteamID"); if (!TryExtractSteamId(value, out var steamId)) { status = "The local Steam account is not available yet."; return false; } localSteamId = steamId.ToString((IFormatProvider)(object)CultureInfo.InvariantCulture); LocalSteamId = localSteamId; if (TryGetLoadedGamePlayers(steamId, out members, out status)) { lobbyOwnerSteamId = localSteamId; return true; } object obj = ResolveCurrentLobby(steamId); if (obj == null) { status = "Local host detected, but no loaded player or Steam lobby member list was available yet."; return false; } object value2 = InvokeStatic(_steamMatchmakingType, "GetNumLobbyMembers", obj); int num = ToInt(value2, 0); if (num <= 0) { _cachedLobbyId = null; status = "The Steam lobby currently has no readable members."; return false; } object value3 = InvokeStatic(_steamMatchmakingType, "GetLobbyOwner", obj); if (TryExtractSteamId(value3, out var steamId2)) { lobbyOwnerSteamId = steamId2.ToString((IFormatProvider)(object)CultureInfo.InvariantCulture); } string text2 = default(string); bool flag = default(bool); for (int i = 0; i < num; i++) { object value4 = InvokeStatic(_steamMatchmakingType, "GetLobbyMemberByIndex", obj, i); if (TryExtractSteamId(value4, out var steamId3) && steamId3 != 0) { string text = steamId3.ToString((IFormatProvider)(object)CultureInfo.InvariantCulture); string name = ((PersonaNameCache.TryGetValue(text, ref text2) && !string.IsNullOrWhiteSpace(text2)) ? text2 : "Loading Steam profile..."); bool isFriend = FriendCache.TryGetValue(text, ref flag) && flag; members.Add(new ImperiumPhoneAdminSteamMember { SteamId = text, Name = name, IsFriend = isFriend }); } } if (members.Count == 0) { status = "Steam reported a lobby, but no member SteamIDs could be read."; return false; } status = $"Steam lobby online - {members.Count} authenticated account(s) detected."; return true; } internal static bool PublishAccessAdvertisement(string mode, string salt, string challenge, out string status) { status = "Steam lobby policy advertisement is unavailable."; if (!TryResolveLocalLobby(out object lobbyId, out string _)) { return false; } object result = InvokeStatic(_steamMatchmakingType, "SetLobbyData", lobbyId, "siak_pa_mode", mode ?? string.Empty); object result2 = InvokeStatic(_steamMatchmakingType, "SetLobbyData", lobbyId, "siak_pa_salt", salt ?? string.Empty); object result3 = InvokeStatic(_steamMatchmakingType, "SetLobbyData", lobbyId, "siak_pa_challenge", challenge ?? string.Empty); bool flag = IsSuccessfulSteamWrite(result) && IsSuccessfulSteamWrite(result2) && IsSuccessfulSteamWrite(result3); status = (flag ? "P-Admin policy published through the Steam lobby." : status); return flag; } internal static bool TryGetAccessAdvertisement(out string mode, out string salt, out string challenge, out string status) { mode = string.Empty; salt = string.Empty; challenge = string.Empty; status = "Waiting for the host's P-Admin policy."; if (!TryResolveLocalLobby(out object lobbyId, out string _)) { return false; } mode = InvokeStatic(_steamMatchmakingType, "GetLobbyData", lobbyId, "siak_pa_mode")?.ToString()?.Trim() ?? string.Empty; salt = InvokeStatic(_steamMatchmakingType, "GetLobbyData", lobbyId, "siak_pa_salt")?.ToString()?.Trim() ?? string.Empty; challenge = InvokeStatic(_steamMatchmakingType, "GetLobbyData", lobbyId, "siak_pa_challenge")?.ToString()?.Trim() ?? string.Empty; if (string.IsNullOrWhiteSpace(mode)) { return false; } status = "Host P-Admin policy detected: " + mode + "."; return true; } internal static bool SetLocalPasswordProof(string proof, out string status) { status = "Could not publish the password proof to the Steam lobby."; if (!TryResolveLocalLobby(out object lobbyId, out string _)) { return false; } if (!(_steamMatchmakingType != (System.Type)null) || !Enumerable.Any((System.Collections.Generic.IEnumerable)_steamMatchmakingType.GetMethods((BindingFlags)56), (Func)((MethodInfo method) => ((MemberInfo)method).Name == "SetLobbyMemberData" && ((MethodBase)method).GetParameters().Length == 3))) { return false; } InvokeStatic(_steamMatchmakingType, "SetLobbyMemberData", lobbyId, "siak_pa_proof", proof ?? string.Empty); status = "Password proof published to the host."; return true; } internal static string GetMemberPasswordProof(string steamId) { if (!TryResolveLocalLobby(out object lobbyId, out string _) || !TryCreateSteamId(steamId, out object steamIdObject)) { return string.Empty; } return InvokeStatic(_steamMatchmakingType, "GetLobbyMemberData", lobbyId, steamIdObject, "siak_pa_proof")?.ToString()?.Trim() ?? string.Empty; } private static bool TryResolveLocalLobby(out object lobbyId, out string localSteamId) { lobbyId = null; localSteamId = string.Empty; ResolveTypes(); if (_steamUserType == (System.Type)null || _steamMatchmakingType == (System.Type)null || _steamIdType == (System.Type)null) { return false; } object value = InvokeStatic(_steamUserType, "GetSteamID"); if (!TryExtractSteamId(value, out var steamId)) { return false; } localSteamId = steamId.ToString((IFormatProvider)(object)CultureInfo.InvariantCulture); LocalSteamId = localSteamId; object obj = ResolveCurrentLobby(steamId); if (obj == null) { return false; } lobbyId = obj; return true; } private static bool IsSuccessfulSteamWrite(object? result) { bool flag = default(bool); int num; if (result is bool) { flag = (bool)result; num = ((1 == 0) ? 1 : 0); } else { num = 1; } return (byte)((uint)num | (flag ? 1u : 0u)) != 0; } internal static string GetPersonaName(string steamId) { string text = default(string); if (PersonaNameCache.TryGetValue(steamId, ref text) && !string.IsNullOrWhiteSpace(text)) { return text; } ResolveTypes(); if (!TryCreateSteamId(steamId, out object steamIdObject)) { return "Unknown Steam user"; } RefreshSteamProfileIfDue(steamIdObject, steamId, force: true); return (PersonaNameCache.TryGetValue(steamId, ref text) && !string.IsNullOrWhiteSpace(text)) ? text : "Loading Steam profile..."; } internal static bool IsFriend(string steamId) { bool flag = default(bool); if (FriendCache.TryGetValue(steamId, ref flag)) { return flag; } ResolveTypes(); if (!TryCreateSteamId(steamId, out object steamIdObject)) { return false; } RefreshSteamProfileIfDue(steamIdObject, steamId, force: true); return FriendCache.TryGetValue(steamId, ref flag) && flag; } internal static Sprite? GetAvatarSprite(string steamId) { //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Expected O, but got Unknown //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) if (!ImperiumPhoneAdminApp.IsActuallyOpen() || string.IsNullOrWhiteSpace(steamId)) { return null; } Sprite result = default(Sprite); if (AvatarCache.TryGetValue(steamId, ref result)) { return result; } float num = default(float); if (AvatarRetryAt.TryGetValue(steamId, ref num) && Time.unscaledTime < num) { return null; } AvatarRetryAt[steamId] = Time.unscaledTime + 10f; ResolveTypes(); if (_steamFriendsType == (System.Type)null || _steamUtilsType == (System.Type)null || !TryCreateSteamId(steamId, out object steamIdObject)) { return null; } InvokeStatic(_steamFriendsType, "RequestUserInformation", steamIdObject, false); int num2 = ToInt(InvokeStatic(_steamFriendsType, "GetMediumFriendAvatar", steamIdObject), 0); if (num2 <= 0) { return null; } if (!TryGetImageSize(num2, out var width, out var height) || width <= 0 || height <= 0) { return null; } if (!TryGetImageBytes(num2, width, height, out byte[] bytes)) { return null; } try { FlipRgbaVertically(bytes, width, height); Texture2D val = new Texture2D(width, height, (TextureFormat)4, false) { name = "PAdminAvatar_" + steamId, filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1 }; val.LoadRawTextureData(Il2CppStructArray.op_Implicit(bytes)); val.Apply(false, true); Object.DontDestroyOnLoad((Object)(object)val); Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)width, (float)height), new Vector2(0.5f, 0.5f), (float)Math.Max(width, height), 0u, (SpriteMeshType)0); ((Object)val2).name = "PAdminAvatarSprite_" + steamId; Object.DontDestroyOnLoad((Object)(object)val2); AvatarCache[steamId] = val2; return val2; } catch { return null; } } internal static void SetFishNetServerManager(object? serverManager) { _fishNetServerManager = serverManager; } internal static bool TryResolveConnectingSteamId(int connectionId, object? connection, out string steamId) { steamId = string.Empty; if (connection == null) { connection = TryGetFishNetConnection(connectionId); } if (TryResolveSteamIdFromConnection(connection, out steamId)) { return true; } return TryResolveSteamIdFromTransport(connectionId, connection, out steamId); } internal static bool DisconnectFishNetConnection(int connectionId, object? connection, string reason) { if (connection == null) { connection = TryGetFishNetConnection(connectionId); } return TryHardDisconnectFishNetConnection(connectionId, connection, reason); } internal static bool DisconnectSteamUser(string steamId, string reason, int? fishNetConnectionId = null) { ResolveTypes(); if (IsLocalSteamId(steamId)) { return false; } bool flag = false; if (fishNetConnectionId.HasValue) { object connection = TryGetFishNetConnection(fishNetConnectionId.Value); flag |= TryHardDisconnectFishNetConnection(fishNetConnectionId.Value, connection, reason); } if (!TryCreateSteamId(steamId, out object steamIdObject)) { return flag; } try { object obj = InvokeStatic(_steamNetworkingType, "CloseP2PSessionWithUser", steamIdObject); bool num = flag; bool flag2 = default(bool); int num2; if (obj is bool) { flag2 = (bool)obj; num2 = 1; } else { num2 = 0; } flag = (byte)((num ? 1u : 0u) | ((uint)num2 & (flag2 ? 1u : 0u))) != 0; } catch { } try { object obj3 = InvokeStatic(_steamNetworkingMessagesType, "CloseSessionWithUser", steamIdObject); bool num3 = flag; bool flag3 = default(bool); int num4; if (obj3 is bool) { flag3 = (bool)obj3; num4 = 1; } else { num4 = 0; } flag = (byte)((num3 ? 1u : 0u) | ((uint)num4 & (flag3 ? 1u : 0u))) != 0; } catch { } return flag | TryDisconnectFishNetPlayer(steamId, reason); } internal static bool CloseRawConnection(object connectionHandle, string reason) { ResolveTypes(); System.Type[] array = new System.Type[2] { _steamNetworkingSocketsType, _steamGameServerNetworkingSocketsType }; foreach (System.Type type in array) { if (type == (System.Type)null || connectionHandle == null) { continue; } MethodInfo val = Enumerable.FirstOrDefault((System.Collections.Generic.IEnumerable)Enumerable.OrderByDescending(Enumerable.Where(Enumerable.Where((System.Collections.Generic.IEnumerable)type.GetMethods((BindingFlags)56), (Func)((MethodInfo candidate) => string.Equals(((MemberInfo)candidate).Name, "CloseConnection", (StringComparison)4))), (Func)delegate(MethodInfo candidate) { ParameterInfo[] parameters2 = ((MethodBase)candidate).GetParameters(); return parameters2.Length >= 1 && string.Equals(((MemberInfo)parameters2[0].ParameterType).Name, "HSteamNetConnection", (StringComparison)4); }), (Func)((MethodInfo candidate) => ((MethodBase)candidate).GetParameters().Length))); if (val == (MethodInfo)null) { continue; } try { ParameterInfo[] parameters = ((MethodBase)val).GetParameters(); object[] array2 = new object[parameters.Length]; array2[0] = connectionHandle; for (int num = 1; num < parameters.Length; num++) { ParameterInfo val2 = parameters[num]; if (val2.ParameterType == typeof(int)) { array2[num] = 0; } else if (val2.ParameterType == typeof(string)) { array2[num] = reason ?? string.Empty; } else if (val2.ParameterType == typeof(bool)) { array2[num] = false; } else if (val2.HasDefaultValue) { array2[num] = val2.DefaultValue; } else { array2[num] = (val2.ParameterType.IsValueType ? Activator.CreateInstance(val2.ParameterType) : null); } } ((MethodBase)val).Invoke((object)null, array2); return true; } catch (System.Exception) { } } return false; } private static bool TryGetLoadedGamePlayers(ulong localSteamId, out List members, out string status) { members = new List(); status = "Schedule I player objects are not available yet."; string localIdText = localSteamId.ToString((IFormatProvider)(object)CultureInfo.InvariantCulture); HashSet val = new HashSet((IEqualityComparer)(object)StringComparer.Ordinal); HashSet val2 = new HashSet(); try { System.Type type = FindType("Il2CppScheduleOne.PlayerScripts.Player", "ScheduleOne.PlayerScripts.Player"); if (type != (System.Type)null) { System.Collections.Generic.IEnumerator enumerator = EnumerateScheduleOnePlayers(type).GetEnumerator(); try { ulong num2 = default(ulong); string text = default(string); bool flag2 = default(bool); while (((System.Collections.IEnumerator)enumerator).MoveNext()) { object current = enumerator.Current; if (current == null) { continue; } bool flag = TryReadBooleanMember(current, "IsLocalPlayer"); int num = TryReadPlayerOwnerId(current); object obj = ((num >= 0) ? TryGetFishNetConnection(num) : null); if (obj == null) { obj = FindConnectionObject(current, 0); } if (num < 0) { num = TryReadFishNetClientId(obj); } string steamId; if (flag) { steamId = localIdText; } else if (!TryResolvePlayerSteamId(current, obj, num, out steamId)) { continue; } if (ulong.TryParse(steamId, (NumberStyles)0, (IFormatProvider)(object)CultureInfo.InvariantCulture, ref num2) && num2 >= 76561197960265728L && val.Add(steamId)) { if (num >= 0) { val2.Add(num); } members.Add(new ImperiumPhoneAdminSteamMember { SteamId = steamId, Name = ((PersonaNameCache.TryGetValue(steamId, ref text) && !string.IsNullOrWhiteSpace(text)) ? text : "Loading Steam profile..."), IsFriend = (FriendCache.TryGetValue(steamId, ref flag2) && flag2), ConnectionId = num }); } } } finally { ((System.IDisposable)enumerator)?.Dispose(); } } } catch (System.Exception) { } if (val.Add(localIdText)) { string text2 = default(string); members.Insert(0, new ImperiumPhoneAdminSteamMember { SteamId = localIdText, Name = ((PersonaNameCache.TryGetValue(localIdText, ref text2) && !string.IsNullOrWhiteSpace(text2)) ? text2 : "Loading Steam profile..."), IsFriend = false, ConnectionId = -1 }); } if (members.Count == 0) { return false; } int num3 = Enumerable.Count((System.Collections.Generic.IEnumerable)members, (Func)((ImperiumPhoneAdminSteamMember member) => !string.Equals(member.SteamId, localIdText, (StringComparison)4))); status = ((num3 == 0) ? "Game session online - local host detected." : $"Game session online - host plus {num3} remote player(s) detected."); return true; } internal static int GetLoadedPlayerCount() { try { System.Type type = FindType("Il2CppScheduleOne.PlayerScripts.Player", "ScheduleOne.PlayerScripts.Player"); if (type == (System.Type)null) { return -1; } object obj = ReadNamedMember(type, null, staticOnly: true, "PlayerList"); if (obj == null) { return -1; } object value = ReadNamedMember(obj.GetType(), obj, staticOnly: false, "Count"); return ToInt(value, -1); } catch { return -1; } } [IteratorStateMachine(typeof(d__50))] private static System.Collections.Generic.IEnumerable EnumerateScheduleOnePlayers(System.Type playerType) { HashSet yielded = new HashSet(); object playerList; try { playerList = ReadNamedMember(playerType, null, staticOnly: true, "PlayerList"); } catch { playerList = null; } System.Collections.Generic.IEnumerator enumerator = EnumerateCollectionValues(playerList).GetEnumerator(); try { while (((System.Collections.IEnumerator)enumerator).MoveNext()) { object player = enumerator.Current; int key = GetObjectIdentity(player); if (yielded.Add(key)) { yield return player; } } } finally { ((System.IDisposable)enumerator)?.Dispose(); } if (yielded.Count != 0 || !typeof(Object).IsAssignableFrom(playerType)) { yield break; } System.Collections.Generic.IEnumerator enumerator2 = FindUnityObjectsOfType(playerType).GetEnumerator(); try { while (((System.Collections.IEnumerator)enumerator2).MoveNext()) { object player2 = enumerator2.Current; int key2 = GetObjectIdentity(player2); if (yielded.Add(key2)) { yield return player2; } } } finally { ((System.IDisposable)enumerator2)?.Dispose(); } } [IteratorStateMachine(typeof(d__51))] private static System.Collections.Generic.IEnumerable EnumerateCollectionValues(object? collection) { if (collection == null) { yield break; } if (collection is System.Collections.IEnumerable enumerable) { foreach (object item in enumerable) { if (item != null) { yield return item; } } yield break; } System.Type type = collection.GetType(); int count = ToInt(ReadNamedMember(type, collection, staticOnly: false, "Count"), 0); if (count <= 0 || count > 256) { yield break; } PropertyInfo itemProperty = type.GetProperty("Item", (BindingFlags)52); if (itemProperty == (PropertyInfo)null || itemProperty.GetIndexParameters().Length != 1) { yield break; } for (int index = 0; index < count; index++) { object item2 = null; try { item2 = itemProperty.GetValue(collection, new object[1] { index }); } catch { } if (item2 != null) { yield return item2; } } } private static int GetObjectIdentity(object value) { try { Object val = (Object)((value is Object) ? value : null); if (val != null) { return val.GetInstanceID(); } } catch { } return RuntimeHelpers.GetHashCode(value); } private static int TryReadPlayerOwnerId(object player) { try { System.Type type = player.GetType(); int num = ToInt(ReadNamedMember(type, player, staticOnly: false, "OwnerId"), -1); if (num >= 0) { return num; } object obj = ReadNamedMember(type, player, staticOnly: false, "NetworkObject"); if (obj != null) { num = ToInt(ReadNamedMember(obj.GetType(), obj, staticOnly: false, "OwnerId"), -1); if (num >= 0) { return num; } } return TryReadFishNetClientId(FindConnectionObject(player, 0)); } catch { return -1; } } private static bool TryReadBooleanMember(object source, string memberName) { try { object obj = ReadNamedMember(source.GetType(), source, staticOnly: false, memberName); bool flag = default(bool); int num; if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } catch { return false; } } private static object? GetFishNetServerManager() { if (_fishNetServerManager != null) { return _fishNetServerManager; } try { System.Type type = FindType("Il2CppFishNet.InstanceFinder", "FishNet.InstanceFinder"); if (type == (System.Type)null) { return null; } _fishNetServerManager = ReadNamedMember(type, null, staticOnly: true, "ServerManager"); } catch { _fishNetServerManager = null; } return _fishNetServerManager; } private static object? TryGetFishNetConnection(int connectionId) { if (connectionId < 0) { return null; } try { object fishNetServerManager = GetFishNetServerManager(); if (fishNetServerManager == null) { return null; } object obj = ReadNamedMember(fishNetServerManager.GetType(), fishNetServerManager, staticOnly: false, "Clients"); if (obj == null) { return null; } IDictionary val = (IDictionary)((obj is IDictionary) ? obj : null); if (val != null) { return val.Contains((object)connectionId) ? val[(object)connectionId] : null; } System.Type type = obj.GetType(); MethodInfo val2 = Enumerable.FirstOrDefault((System.Collections.Generic.IEnumerable)type.GetMethods((BindingFlags)52), (Func)delegate(MethodInfo method) { if (!string.Equals(((MemberInfo)method).Name, "TryGetValue", (StringComparison)4)) { return false; } ParameterInfo[] parameters = ((MethodBase)method).GetParameters(); return parameters.Length == 2 && parameters[0].ParameterType == typeof(int) && parameters[1].ParameterType.IsByRef; }); if (val2 != (MethodInfo)null) { object[] array = new object[2] { connectionId, null }; object obj2 = ((MethodBase)val2).Invoke(obj, array); bool flag = default(bool); int num; if (obj2 is bool) { flag = (bool)obj2; num = 1; } else { num = 0; } if (((uint)num & (flag ? 1u : 0u)) != 0) { return array[1]; } } PropertyInfo property = type.GetProperty("Item", (BindingFlags)52, (Binder)null, (System.Type)null, new System.Type[1] { typeof(int) }, (ParameterModifier[])null); return (property != null) ? property.GetValue(obj, new object[1] { connectionId }) : null; } catch { return null; } } private static bool TryResolvePlayerSteamId(object player, object? connection, int connectionId, out string steamId) { steamId = string.Empty; if (TryResolveSteamIdFromConnection(connection, out steamId)) { return true; } if (connectionId >= 0) { if (connection == null) { connection = TryGetFishNetConnection(connectionId); } if (TryResolveSteamIdFromConnection(connection, out steamId)) { return true; } if (TryResolveSteamIdFromTransport(connectionId, connection, out steamId)) { return true; } } if (TryFindNamedSteamId(player, 0, out steamId) && IsValidIndividualSteamId(steamId)) { return true; } steamId = string.Empty; return false; } private static bool TryResolveSteamIdFromConnection(object? connection, out string steamId) { steamId = string.Empty; if (connection == null) { return false; } try { System.Type type = connection.GetType(); MethodInfo method = type.GetMethod("GetAddress", (BindingFlags)52, (Binder)null, System.Type.EmptyTypes, (ParameterModifier[])null); if (method != (MethodInfo)null && TryNormalizeSteamId64(((MethodBase)method).Invoke(connection, (object[])null), out steamId)) { return true; } string[] array = new string[5] { "Address", "RemoteAddress", "SteamId", "SteamID", "CustomData" }; foreach (string name in array) { if (TryNormalizeSteamId64(ReadNamedMember(type, connection, staticOnly: false, name), out steamId)) { return true; } } } catch { } steamId = string.Empty; return false; } private static bool TryResolveSteamIdFromTransport(int connectionId, object? connection, out string steamId) { steamId = string.Empty; try { object fishNetServerManager = GetFishNetServerManager(); if (fishNetServerManager == null) { return false; } object obj = ReadNamedMember(fishNetServerManager.GetType(), fishNetServerManager, staticOnly: false, "NetworkManager"); if (obj == null) { return false; } object obj2 = ReadNamedMember(obj.GetType(), obj, staticOnly: false, "TransportManager"); if (obj2 == null) { return false; } int num = ((connection != null) ? ToInt(ReadNamedMember(connection.GetType(), connection, staticOnly: false, "TransportIndex"), 0) : 0); object obj3 = null; MethodInfo val = Enumerable.FirstOrDefault((System.Collections.Generic.IEnumerable)obj2.GetType().GetMethods((BindingFlags)52), (Func)delegate(MethodInfo method) { if (!string.Equals(((MemberInfo)method).Name, "GetTransport", (StringComparison)4) || ((MethodBase)method).IsGenericMethod) { return false; } ParameterInfo[] parameters = ((MethodBase)method).GetParameters(); return parameters.Length == 1 && parameters[0].ParameterType == typeof(int); }); if (val != (MethodInfo)null) { obj3 = ((MethodBase)val).Invoke(obj2, new object[1] { num }); } if (obj3 == null) { obj3 = ReadNamedMember(obj2.GetType(), obj2, staticOnly: false, "Transport"); } if (obj3 == null) { return false; } MethodInfo val2 = Enumerable.FirstOrDefault((System.Collections.Generic.IEnumerable)obj3.GetType().GetMethods((BindingFlags)52), (Func)delegate(MethodInfo method) { if (!string.Equals(((MemberInfo)method).Name, "GetConnectionAddress", (StringComparison)4)) { return false; } ParameterInfo[] parameters = ((MethodBase)method).GetParameters(); return parameters.Length == 1 && parameters[0].ParameterType == typeof(int); }); return val2 != (MethodInfo)null && TryNormalizeSteamId64(((MethodBase)val2).Invoke(obj3, new object[1] { connectionId }), out steamId); } catch { steamId = string.Empty; return false; } } private static bool TryNormalizeSteamId64(object? value, out string steamId) { steamId = string.Empty; if (TryExtractSteamId(value, out var steamId2) && steamId2 >= 76561197960265728L) { steamId = steamId2.ToString((IFormatProvider)(object)CultureInfo.InvariantCulture); return true; } string text = value?.ToString() ?? string.Empty; if (text.Length == 0) { return false; } ulong num2 = default(ulong); for (int i = 0; i < text.Length; i++) { if (char.IsDigit(text[i])) { int j; for (j = i; j < text.Length && char.IsDigit(text[j]); j++) { } int num = j - i; if (num >= 17 && num <= 20 && ulong.TryParse(text.Substring(i, num), (NumberStyles)0, (IFormatProvider)(object)CultureInfo.InvariantCulture, ref num2) && num2 >= 76561197960265728L) { steamId = num2.ToString((IFormatProvider)(object)CultureInfo.InvariantCulture); return true; } i = j; } } return false; } private static bool IsValidIndividualSteamId(string value) { ulong num = default(ulong); return value.Length == 17 && ulong.TryParse(value, (NumberStyles)0, (IFormatProvider)(object)CultureInfo.InvariantCulture, ref num) && num >= 76561197960265728L; } private static int TryReadFishNetClientId(object? connection) { if (connection == null) { return -1; } try { System.Type type = connection.GetType(); string[] array = new string[3] { "ClientId", "ConnectionId", "TransportId" }; foreach (string name in array) { object value = ReadNamedMember(type, connection, staticOnly: false, name); int num = ToInt(value, -1); if (num >= 0) { return num; } } } catch { } return -1; } internal static void RequestLobbyRefresh() { _cachedLobbyId = null; _nextLobbyResolveAt = 0f; } internal static void Dispose() { _cachedLobbyId = null; _nextLobbyResolveAt = 0f; AvatarRetryAt.Clear(); PersonaNameCache.Clear(); FriendCache.Clear(); ProfileRetryAt.Clear(); StaticMethodCache.Clear(); _cachedLobbyTypes = null; _hasFriendMethod = null; _fishNetServerManager = null; } private static object? ResolveCurrentLobby(ulong localSteamId) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) if (_cachedLobbyId != null) { return _cachedLobbyId; } if (Time.unscaledTime < _nextLobbyResolveAt) { return null; } _nextLobbyResolveAt = Time.unscaledTime + 5f; _cachedLobbyId = null; List val = Enumerable.ToList(FindLobbyTypes()); int num = 0; List val2 = new List(); Enumerator enumerator = val.GetEnumerator(); try { while (enumerator.MoveNext()) { System.Type current = enumerator.Current; System.Collections.Generic.IEnumerator enumerator2 = ReadLobbyIdCandidates(current).GetEnumerator(); try { while (((System.Collections.IEnumerator)enumerator2).MoveNext()) { object current2 = enumerator2.Current; num++; if (ValidateLobby(current2, localSteamId, out string reason)) { _cachedLobbyId = current2; return current2; } if (val2.Count < 5) { val2.Add(current.FullName + ": " + reason); } } } finally { ((System.IDisposable)enumerator2)?.Dispose(); } } } finally { ((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } return null; } private static bool ValidateLobby(object candidate, ulong localSteamId, out string reason) { reason = "SteamMatchmaking type unavailable"; if (_steamMatchmakingType == (System.Type)null) { return false; } try { int num = ToInt(InvokeStatic(_steamMatchmakingType, "GetNumLobbyMembers", candidate), 0); if (num <= 0 || num > 64) { reason = $"member count {num} out of range"; return false; } for (int i = 0; i < num; i++) { object value = InvokeStatic(_steamMatchmakingType, "GetLobbyMemberByIndex", candidate, i); if (TryExtractSteamId(value, out var steamId) && steamId == localSteamId) { return true; } } reason = $"local account not found among {num} member(s)"; return false; } catch (System.Exception ex) { reason = "threw " + ((MemberInfo)ex.GetType()).Name + ": " + ex.Message; return false; } } private static System.Collections.Generic.IEnumerable FindLobbyTypes() { if (_cachedLobbyTypes != null) { return _cachedLobbyTypes; } List val = Enumerable.ToList(GetAllTypes()); List val2 = Enumerable.ToList(Enumerable.Where((System.Collections.Generic.IEnumerable)val, (Func)delegate(System.Type type) { string text = type.FullName ?? string.Empty; return text.Contains("ScheduleOne.Networking", (StringComparison)5) && (((MemberInfo)type).Name.Equals("Lobby", (StringComparison)5) || ((MemberInfo)type).Name.Contains("Lobby", (StringComparison)5)); })); List val3 = ((val2.Count > 0) ? val2 : Enumerable.ToList(Enumerable.Take(Enumerable.Where((System.Collections.Generic.IEnumerable)val, (Func)delegate(System.Type type) { string text = ((MemberInfo)type).Name ?? string.Empty; string text2 = type.FullName ?? string.Empty; return text.Contains("Lobby", (StringComparison)5) && (text2.Contains("ScheduleOne", (StringComparison)5) || text2.Contains("Steam", (StringComparison)5)); }), 40))); _cachedLobbyTypes = Enumerable.ToArray((System.Collections.Generic.IEnumerable)Enumerable.OrderByDescending(Enumerable.Distinct((System.Collections.Generic.IEnumerable)val3), (Func)((System.Type type) => string.Equals(((MemberInfo)type).Name, "Lobby", (StringComparison)5)))); return _cachedLobbyTypes; } [IteratorStateMachine(typeof(d__68))] private static System.Collections.Generic.IEnumerable ReadLobbyIdCandidates(System.Type lobbyType) { HashSet seen = new HashSet(); List obj = new List(); obj.Add((object)null); List sources = obj; MemberInfo[] members = lobbyType.GetMembers((BindingFlags)56); foreach (MemberInfo member in members) { if (member.Name.Contains("instance", (StringComparison)5) || member.Name.Contains("lobby", (StringComparison)5)) { if (TryReadMemberValue(member, null, out object value) && value != null) { sources.Add(value); } value = null; } } try { if (typeof(Object).IsAssignableFrom(lobbyType)) { System.Collections.Generic.IEnumerator enumerator = FindUnityObjectsOfType(lobbyType).GetEnumerator(); try { while (((System.Collections.IEnumerator)enumerator).MoveNext()) { object instance = enumerator.Current; if (instance != null) { sources.Add(instance); } } } finally { ((System.IDisposable)enumerator)?.Dispose(); } } } catch { } Enumerator enumerator2 = sources.GetEnumerator(); try { while (enumerator2.MoveNext()) { object source = enumerator2.Current; if (source != null && TryExtractSteamId(source, out var directSteamId) && directSteamId >= 10000000000000000L && seen.Add(directSteamId)) { yield return source; } System.Type sourceType = source?.GetType() ?? lobbyType; System.Collections.Generic.IEnumerator enumerator3 = EnumerateCandidateValues(sourceType, source, source == null, 0).GetEnumerator(); try { while (((System.Collections.IEnumerator)enumerator3).MoveNext()) { object value2 = enumerator3.Current; if (TryExtractSteamId(value2, out var steamId) && steamId >= 10000000000000000L && seen.Add(steamId)) { yield return value2; } } } finally { ((System.IDisposable)enumerator3)?.Dispose(); } } } finally { ((System.IDisposable)enumerator2/*cast due to .constrained prefix*/).Dispose(); } } [IteratorStateMachine(typeof(d__69))] private static System.Collections.Generic.IEnumerable EnumerateCandidateValues(System.Type type, object? source, bool staticOnly, int depth) { BindingFlags flags = (BindingFlags)(0x30 | (staticOnly ? 8 : 4)); MemberInfo[] members = type.GetMembers(flags); foreach (MemberInfo member in members) { if (!(member is FieldInfo) && !(member is PropertyInfo)) { continue; } string name = member.Name; if ((!name.Contains("lobby", (StringComparison)5) && !name.Contains("steam", (StringComparison)5) && !name.EndsWith("ID", (StringComparison)5)) || !TryReadMemberValue(member, source, out object value) || value == null) { continue; } if (TryExtractSteamId(value, out var _)) { yield return value; } else { if (depth >= 1 || !name.Contains("lobby", (StringComparison)5)) { continue; } System.Collections.Generic.IEnumerator enumerator = EnumerateCandidateValues(value.GetType(), value, staticOnly: false, depth + 1).GetEnumerator(); try { while (((System.Collections.IEnumerator)enumerator).MoveNext()) { yield return enumerator.Current; } } finally { ((System.IDisposable)enumerator)?.Dispose(); } value = null; } } } private static void RefreshSteamProfileIfDue(object steamIdObject, string steamId, bool force = false) { float unscaledTime = Time.unscaledTime; float num = default(float); if (!force && ProfileRetryAt.TryGetValue(steamId, ref num) && unscaledTime < num) { return; } ProfileRetryAt[steamId] = unscaledTime + 30f; if (_steamFriendsType == (System.Type)null) { return; } try { InvokeStatic(_steamFriendsType, "RequestUserInformation", steamIdObject, false); string text = InvokeStatic(_steamFriendsType, "GetFriendPersonaName", steamIdObject)?.ToString()?.Trim(); if (!string.IsNullOrWhiteSpace(text) && !string.Equals(text, "[unknown]", (StringComparison)5) && !string.Equals(text, steamId, (StringComparison)4)) { PersonaNameCache[steamId] = text; } FriendCache[steamId] = IsFriendObject(steamIdObject); } catch { } } private static string GetPersonaNameFromObject(object steamIdObject, string steamId) { RefreshSteamProfileIfDue(steamIdObject, steamId); string text = default(string); return (PersonaNameCache.TryGetValue(steamId, ref text) && !string.IsNullOrWhiteSpace(text)) ? text : "Loading Steam profile..."; } private static bool IsFriendObject(object steamIdObject) { if (_steamFriendsType == (System.Type)null) { return false; } try { if (_hasFriendMethod == null) { _hasFriendMethod = Enumerable.FirstOrDefault((System.Collections.Generic.IEnumerable)_steamFriendsType.GetMethods((BindingFlags)56), (Func)((MethodInfo candidate) => ((MemberInfo)candidate).Name == "HasFriend" && ((MethodBase)candidate).GetParameters().Length == 2)); } if (_hasFriendMethod == (MethodInfo)null) { return false; } ParameterInfo[] parameters = ((MethodBase)_hasFriendMethod).GetParameters(); object obj = (parameters[1].ParameterType.IsEnum ? System.Enum.ToObject(parameters[1].ParameterType, 4) : Convert.ChangeType((object)4, parameters[1].ParameterType, (IFormatProvider)(object)CultureInfo.InvariantCulture)); object obj2 = ((MethodBase)_hasFriendMethod).Invoke((object)null, new object[2] { steamIdObject, obj }); bool flag = default(bool); int num; if (obj2 is bool) { flag = (bool)obj2; num = 1; } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } catch { return false; } } private static bool TryGetImageSize(int handle, out int width, out int height) { width = 0; height = 0; if (_steamUtilsType == (System.Type)null) { return false; } System.Collections.Generic.IEnumerator enumerator = Enumerable.Where((System.Collections.Generic.IEnumerable)_steamUtilsType.GetMethods((BindingFlags)56), (Func)((MethodInfo candidate) => ((MemberInfo)candidate).Name == "GetImageSize" && ((MethodBase)candidate).GetParameters().Length == 3)).GetEnumerator(); try { while (((System.Collections.IEnumerator)enumerator).MoveNext()) { MethodInfo current = enumerator.Current; try { object[] array = new object[3] { handle, 0u, 0u }; if (!(((MethodBase)current).Invoke((object)null, array) is bool flag) || flag) { width = ToInt(array[1], 0); height = ToInt(array[2], 0); if (width > 0 && height > 0) { return true; } } } catch { } } } finally { ((System.IDisposable)enumerator)?.Dispose(); } return false; } private static bool TryGetImageBytes(int handle, int width, int height, out byte[] bytes) { //IL_00aa: Unknown result type (might be due to invalid IL or missing references) bytes = System.Array.Empty(); if (_steamUtilsType == (System.Type)null) { return false; } int num = checked(width * height * 4); System.Collections.Generic.IEnumerator enumerator = Enumerable.Where((System.Collections.Generic.IEnumerable)_steamUtilsType.GetMethods((BindingFlags)56), (Func)((MethodInfo candidate) => ((MemberInfo)candidate).Name == "GetImageRGBA" && ((MethodBase)candidate).GetParameters().Length == 3)).GetEnumerator(); try { while (((System.Collections.IEnumerator)enumerator).MoveNext()) { MethodInfo current = enumerator.Current; try { System.Type parameterType = ((MethodBase)current).GetParameters()[1].ParameterType; object obj = ((!(parameterType == typeof(byte[]))) ? (CreateByteBuffer(parameterType, num) ?? throw new InvalidOperationException()) : new byte[num]); object[] array = new object[3] { handle, obj, num }; if ((!(((MethodBase)current).Invoke((object)null, array) is bool flag) || flag) && TryCopyByteBuffer(array[1] ?? obj, num, out bytes)) { return true; } } catch { } } } finally { ((System.IDisposable)enumerator)?.Dispose(); } return false; } private static object? CreateByteBuffer(System.Type bufferType, int length) { object[] array = new object[4] { length, (long)length, (uint)length, (ulong)length }; foreach (object obj in array) { try { object obj2 = Activator.CreateInstance(bufferType, new object[1] { obj }); if (obj2 != null) { return obj2; } } catch { } } return null; } private static bool TryCopyByteBuffer(object buffer, int length, out byte[] bytes) { bytes = new byte[length]; if (buffer is byte[] array) { if (array.Length < length) { return false; } Buffer.BlockCopy((System.Array)array, 0, (System.Array)bytes, 0, length); return true; } try { PropertyInfo property = buffer.GetType().GetProperty("Item", (BindingFlags)20); PropertyInfo property2 = buffer.GetType().GetProperty("Length"); int num = ToInt((property2 != null) ? property2.GetValue(buffer) : null, 0); if (property == (PropertyInfo)null || num < length) { return false; } for (int i = 0; i < length; i++) { bytes[i] = Convert.ToByte(property.GetValue(buffer, new object[1] { i }), (IFormatProvider)(object)CultureInfo.InvariantCulture); } return true; } catch { return false; } } private static void FlipRgbaVertically(byte[] bytes, int width, int height) { int num = width * 4; byte[] array = new byte[num]; for (int i = 0; i < height / 2; i++) { int num2 = i * num; int num3 = (height - 1 - i) * num; Buffer.BlockCopy((System.Array)bytes, num2, (System.Array)array, 0, num); Buffer.BlockCopy((System.Array)bytes, num3, (System.Array)bytes, num2, num); Buffer.BlockCopy((System.Array)array, 0, (System.Array)bytes, num3, num); } } [IteratorStateMachine(typeof(d__78))] private static System.Collections.Generic.IEnumerable FindUnityObjectsOfType(System.Type objectType) { if (objectType == (System.Type)null || !typeof(Object).IsAssignableFrom(objectType)) { yield break; } object result = null; try { MethodInfo resourcesMethod = Enumerable.FirstOrDefault((System.Collections.Generic.IEnumerable)typeof(Resources).GetMethods((BindingFlags)24), (Func)((MethodInfo method) => string.Equals(((MemberInfo)method).Name, "FindObjectsOfTypeAll", (StringComparison)4) && ((MethodBase)method).IsGenericMethodDefinition && ((MethodBase)method).GetGenericArguments().Length == 1 && ((MethodBase)method).GetParameters().Length == 0)); if (resourcesMethod != (MethodInfo)null) { result = ((MethodBase)resourcesMethod.MakeGenericMethod(new System.Type[1] { objectType })).Invoke((object)null, (object[])null); } } catch { result = null; } if (result == null) { try { MethodInfo objectMethod = Enumerable.FirstOrDefault((System.Collections.Generic.IEnumerable)typeof(Object).GetMethods((BindingFlags)24), (Func)delegate(MethodInfo method) { if (!string.Equals(((MemberInfo)method).Name, "FindObjectsOfType", (StringComparison)4) || !((MethodBase)method).IsGenericMethodDefinition || ((MethodBase)method).GetGenericArguments().Length != 1) { return false; } ParameterInfo[] parameters = ((MethodBase)method).GetParameters(); return parameters.Length == 1 && parameters[0].ParameterType == typeof(bool); }); if (objectMethod != (MethodInfo)null) { result = ((MethodBase)objectMethod.MakeGenericMethod(new System.Type[1] { objectType })).Invoke((object)null, new object[1] { true }); } } catch { result = null; } } if (!(result is System.Collections.IEnumerable enumerable)) { yield break; } foreach (object item in enumerable) { if (item != null) { yield return item; } } } private static bool TryHardDisconnectFishNetConnection(int clientId, object? connection, string reason) { bool flag = false; if (connection != null) { flag |= TryKickNetworkConnection(connection, reason); flag |= TryDisconnectNetworkConnectionImmediately(connection); } if (!flag) { flag |= TryDisconnectFishNetClientId(clientId, reason); } return flag; } private static bool TryKickNetworkConnection(object connection, string reason) { try { MethodInfo val = Enumerable.FirstOrDefault((System.Collections.Generic.IEnumerable)Enumerable.OrderBy(Enumerable.Where((System.Collections.Generic.IEnumerable)connection.GetType().GetMethods((BindingFlags)52), (Func)delegate(MethodInfo candidate) { if (!string.Equals(((MemberInfo)candidate).Name, "Kick", (StringComparison)4)) { return false; } ParameterInfo[] parameters2 = ((MethodBase)candidate).GetParameters(); return parameters2.Length >= 1 && string.Equals(((MemberInfo)parameters2[0].ParameterType).Name, "KickReason", (StringComparison)4); }), (Func)((MethodInfo candidate) => ((MethodBase)candidate).GetParameters().Length))); if (val == (MethodInfo)null) { return false; } ParameterInfo[] parameters = ((MethodBase)val).GetParameters(); object[] array = new object[parameters.Length]; for (int num = 0; num < parameters.Length; num++) { ParameterInfo val2 = parameters[num]; if (string.Equals(((MemberInfo)val2.ParameterType).Name, "KickReason", (StringComparison)4) && val2.ParameterType.IsEnum) { array[num] = ParseEnumValue(val2.ParameterType, "UnexpectedProblem"); } else if (string.Equals(((MemberInfo)val2.ParameterType).Name, "LoggingType", (StringComparison)4) && val2.ParameterType.IsEnum) { array[num] = ParseEnumValue(val2.ParameterType, "Off"); } else if (val2.ParameterType == typeof(string)) { array[num] = reason; } else if (val2.HasDefaultValue) { array[num] = val2.DefaultValue; } else { array[num] = (val2.ParameterType.IsValueType ? Activator.CreateInstance(val2.ParameterType) : null); } } ((MethodBase)val).Invoke(connection, array); return true; } catch { return false; } } private static bool TryDisconnectNetworkConnectionImmediately(object connection) { try { MethodInfo method = connection.GetType().GetMethod("Disconnect", (BindingFlags)52, (Binder)null, new System.Type[1] { typeof(bool) }, (ParameterModifier[])null); if (method == (MethodInfo)null) { return false; } ((MethodBase)method).Invoke(connection, new object[1] { true }); return true; } catch { return false; } } private static bool TryDisconnectFishNetClientId(int clientId, string reason) { //IL_0287: Expected O, but got Unknown if (clientId < 0) { return false; } try { object obj = _fishNetServerManager; if (obj == null) { System.Type type = FindType("Il2CppFishNet.InstanceFinder", "FishNet.InstanceFinder"); obj = ((type == (System.Type)null) ? null : ReadNamedMember(type, null, staticOnly: true, "ServerManager")); } if (obj == null) { return false; } MethodInfo val = Enumerable.FirstOrDefault((System.Collections.Generic.IEnumerable)Enumerable.OrderBy(Enumerable.Where((System.Collections.Generic.IEnumerable)obj.GetType().GetMethods((BindingFlags)52), (Func)delegate(MethodInfo method) { if (!string.Equals(((MemberInfo)method).Name, "Kick", (StringComparison)4)) { return false; } ParameterInfo[] parameters2 = ((MethodBase)method).GetParameters(); return parameters2.Length >= 2 && parameters2[0].ParameterType == typeof(int) && string.Equals(((MemberInfo)parameters2[1].ParameterType).Name, "KickReason", (StringComparison)4); }), (Func)((MethodInfo method) => ((MethodBase)method).GetParameters().Length))); if (val == (MethodInfo)null) { return false; } ParameterInfo[] parameters = ((MethodBase)val).GetParameters(); object[] array = new object[parameters.Length]; for (int num = 0; num < parameters.Length; num++) { ParameterInfo val2 = parameters[num]; if (num == 0 && val2.ParameterType == typeof(int)) { array[num] = clientId; } else if (string.Equals(((MemberInfo)val2.ParameterType).Name, "KickReason", (StringComparison)4) && val2.ParameterType.IsEnum) { array[num] = ParseEnumValue(val2.ParameterType, "UnexpectedProblem"); } else if (string.Equals(((MemberInfo)val2.ParameterType).Name, "LoggingType", (StringComparison)4) && val2.ParameterType.IsEnum) { array[num] = ParseEnumValue(val2.ParameterType, "Common"); } else if (val2.ParameterType == typeof(string)) { array[num] = reason; } else if (val2.ParameterType == typeof(bool)) { array[num] = true; } else if (val2.HasDefaultValue) { array[num] = val2.DefaultValue; } else { array[num] = (val2.ParameterType.IsValueType ? Activator.CreateInstance(val2.ParameterType) : null); } } ((MethodBase)val).Invoke(obj, array); return true; } catch (TargetInvocationException ex) { TargetInvocationException ex2 = ex; string text = ((System.Exception)(object)ex2).InnerException?.Message ?? ((System.Exception)(object)ex2).Message; return false; } catch (System.Exception) { return false; } } private static object ParseEnumValue(System.Type enumType, string preferredName) { try { if (Enumerable.Any((System.Collections.Generic.IEnumerable)System.Enum.GetNames(enumType), (Func)((string name) => string.Equals(name, preferredName, (StringComparison)5)))) { return System.Enum.Parse(enumType, preferredName, true); } } catch { } System.Array values = System.Enum.GetValues(enumType); return (values.Length > 0) ? values.GetValue(0) : Activator.CreateInstance(enumType); } private static bool TryDisconnectFishNetPlayer(string steamId, string reason) { try { System.Type type = FindType("Il2CppScheduleOne.PlayerScripts.Player", "ScheduleOne.PlayerScripts.Player"); if (type == (System.Type)null) { return false; } System.Collections.Generic.IEnumerator enumerator = EnumerateScheduleOnePlayers(type).GetEnumerator(); try { while (((System.Collections.IEnumerator)enumerator).MoveNext()) { object current = enumerator.Current; if (current == null) { continue; } int num = TryReadPlayerOwnerId(current); object obj = ((num >= 0) ? TryGetFishNetConnection(num) : FindConnectionObject(current, 0)); if (!TryResolvePlayerSteamId(current, obj, num, out string steamId2) || !string.Equals(steamId2, steamId, (StringComparison)4)) { continue; } if (num >= 0 && TryDisconnectFishNetClientId(num, reason)) { return true; } if (obj == null) { return false; } object fishNetServerManager = GetFishNetServerManager(); if (fishNetServerManager != null && InvokeDisconnectMethod(fishNetServerManager, obj, reason)) { return true; } return InvokeDisconnectMethod(obj, obj, reason); } } finally { ((System.IDisposable)enumerator)?.Dispose(); } } catch { } return false; } private static bool InvokeDisconnectMethod(object target, object connection, string reason) { IOrderedEnumerable val = Enumerable.OrderBy(Enumerable.Where((System.Collections.Generic.IEnumerable)target.GetType().GetMethods((BindingFlags)52), (Func)((MethodInfo method) => ((MemberInfo)method).Name.Contains("StopConnection", (StringComparison)5) || ((MemberInfo)method).Name.Contains("Disconnect", (StringComparison)5) || ((MemberInfo)method).Name.Contains("Kick", (StringComparison)5))), (Func)((MethodInfo method) => (!((MemberInfo)method).Name.Contains("StopConnection", (StringComparison)5)) ? 1 : 0)); System.Collections.Generic.IEnumerator enumerator = ((System.Collections.Generic.IEnumerable)val).GetEnumerator(); try { while (((System.Collections.IEnumerator)enumerator).MoveNext()) { MethodInfo current = enumerator.Current; ParameterInfo[] parameters = ((MethodBase)current).GetParameters(); int num = System.Array.FindIndex(parameters, (Predicate)((ParameterInfo parameter) => parameter.ParameterType.IsInstanceOfType(connection) || parameter.ParameterType.IsAssignableFrom(connection.GetType()))); if ((target != connection && num < 0) || (target == connection && Enumerable.Any((System.Collections.Generic.IEnumerable)parameters, (Func)((ParameterInfo parameter) => !parameter.HasDefaultValue && parameter.ParameterType != typeof(bool) && parameter.ParameterType != typeof(string) && !parameter.ParameterType.IsEnum)))) { continue; } try { object[] array = new object[parameters.Length]; for (int num2 = 0; num2 < parameters.Length; num2++) { ParameterInfo val2 = parameters[num2]; if (num2 == num) { array[num2] = connection; } else if (val2.ParameterType == typeof(bool)) { array[num2] = true; } else if (val2.ParameterType == typeof(string)) { array[num2] = reason; } else if (val2.ParameterType.IsEnum) { array[num2] = System.Enum.ToObject(val2.ParameterType, 0); } else if (val2.HasDefaultValue) { array[num2] = val2.DefaultValue; } else { array[num2] = (val2.ParameterType.IsValueType ? Activator.CreateInstance(val2.ParameterType) : null); } } ((MethodBase)current).Invoke(target, array); return true; } catch { } } } finally { ((System.IDisposable)enumerator)?.Dispose(); } return false; } private static object? FindConnectionObject(object source, int depth) { if (depth > 3) { return null; } string text = source.GetType().FullName ?? string.Empty; if (text.Contains("NetworkConnection", (StringComparison)5)) { return source; } MemberInfo[] members = source.GetType().GetMembers((BindingFlags)52); foreach (MemberInfo val in members) { if (!(val is FieldInfo) && !(val is PropertyInfo)) { continue; } string name = val.Name; if ((name.Contains("owner", (StringComparison)5) || name.Contains("connection", (StringComparison)5) || name.Contains("network", (StringComparison)5)) && TryReadMemberValue(val, source, out object value) && value != null && value != source) { object obj = FindConnectionObject(value, depth + 1); if (obj != null) { return obj; } } } return null; } private static bool TryFindNamedSteamId(object source, int depth, out string steamId) { steamId = string.Empty; if (depth > 2) { return false; } MemberInfo[] members = source.GetType().GetMembers((BindingFlags)52); foreach (MemberInfo val in members) { if (!(val is FieldInfo) && !(val is PropertyInfo)) { continue; } string name = val.Name; if (name.Contains("steam", (StringComparison)5) && TryReadMemberValue(val, source, out object value) && value != null) { if (TryExtractSteamId(value, out var steamId2)) { steamId = steamId2.ToString((IFormatProvider)(object)CultureInfo.InvariantCulture); return true; } if (TryFindNamedSteamId(value, depth + 1, out steamId)) { return true; } } } return false; } private static void ResolveTypes() { if (!_resolvedTypes) { _resolvedTypes = true; _steamUserType = FindType("Il2CppSteamworks.SteamUser", "Steamworks.SteamUser"); _steamMatchmakingType = FindType("Il2CppSteamworks.SteamMatchmaking", "Steamworks.SteamMatchmaking"); _steamFriendsType = FindType("Il2CppSteamworks.SteamFriends", "Steamworks.SteamFriends"); _steamUtilsType = FindType("Il2CppSteamworks.SteamUtils", "Steamworks.SteamUtils"); _steamNetworkingType = FindType("Il2CppSteamworks.SteamNetworking", "Steamworks.SteamNetworking"); _steamNetworkingMessagesType = FindType("Il2CppSteamworks.SteamNetworkingMessages", "Steamworks.SteamNetworkingMessages"); _steamNetworkingSocketsType = FindType("Il2CppSteamworks.SteamNetworkingSockets", "Steamworks.SteamNetworkingSockets"); _steamGameServerNetworkingSocketsType = FindType("Il2CppSteamworks.SteamGameServerNetworkingSockets", "Steamworks.SteamGameServerNetworkingSockets"); _steamIdType = FindType("Il2CppSteamworks.CSteamID", "Steamworks.CSteamID"); } } private static System.Type? FindType(params string[] fullNames) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly val in assemblies) { foreach (string text in fullNames) { try { System.Type type = val.GetType(text, false, false); if (type != (System.Type)null) { return type; } } catch { } } } HashSet shortNames = new HashSet(Enumerable.Select((System.Collections.Generic.IEnumerable)fullNames, (Func)((string name) => Enumerable.Last((System.Collections.Generic.IEnumerable)name.Split('.', (StringSplitOptions)0)))), (IEqualityComparer)(object)StringComparer.Ordinal); return Enumerable.FirstOrDefault(GetAllTypes(), (Func)delegate(System.Type type2) { int result; if (shortNames.Contains(((MemberInfo)type2).Name)) { string text2 = type2.Namespace; result = (((text2 != null && text2.Contains("Steamworks", (StringComparison)5)) || (type2.Namespace?.Contains("FishNet", (StringComparison)5) ?? false)) ? 1 : 0); } else { result = 0; } return (byte)result != 0; }); } [IteratorStateMachine(typeof(d__90))] private static System.Collections.Generic.IEnumerable GetAllTypes() { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { System.Type[] types; try { types = assembly.GetTypes(); } catch (ReflectionTypeLoadException ex) { ReflectionTypeLoadException ex2 = ex; ReflectionTypeLoadException exception = ex2; types = Enumerable.ToArray(Enumerable.Cast((System.Collections.IEnumerable)Enumerable.Where((System.Collections.Generic.IEnumerable)exception.Types, (Func)((System.Type type) => type != (System.Type)null)))); } catch { continue; } System.Type[] array = types; for (int num = 0; num < array.Length; num++) { yield return array[num]; } } } private static object? InvokeStatic(System.Type? type, string methodName, params object?[] supplied) { if (type == (System.Type)null) { return null; } string text = string.Join(",", Enumerable.Select((System.Collections.Generic.IEnumerable)supplied, (Func)((object value) => value?.GetType().FullName ?? ""))); string text2 = string.Concat(new string[7] { type.AssemblyQualifiedName, "|", methodName, "|", supplied.Length.ToString((IFormatProvider)(object)CultureInfo.InvariantCulture), "|", text }); MethodInfo val = default(MethodInfo); if (StaticMethodCache.TryGetValue(text2, ref val)) { try { object[] array = PrepareArguments(((MethodBase)val).GetParameters(), supplied); return ((MethodBase)val).Invoke((object)null, array); } catch { StaticMethodCache.Remove(text2); } } System.Collections.Generic.IEnumerator enumerator = Enumerable.Where((System.Collections.Generic.IEnumerable)type.GetMethods((BindingFlags)56), (Func)((MethodInfo candidate) => ((MemberInfo)candidate).Name == methodName && ((MethodBase)candidate).GetParameters().Length == supplied.Length)).GetEnumerator(); try { while (((System.Collections.IEnumerator)enumerator).MoveNext()) { MethodInfo current = enumerator.Current; try { object[] array2 = PrepareArguments(((MethodBase)current).GetParameters(), supplied); object result = ((MethodBase)current).Invoke((object)null, array2); StaticMethodCache[text2] = current; return result; } catch { } } } finally { ((System.IDisposable)enumerator)?.Dispose(); } return null; } private static object?[] PrepareArguments(ParameterInfo[] parameters, object?[] supplied) { object[] array = new object[supplied.Length]; for (int i = 0; i < supplied.Length; i++) { object obj = supplied[i]; System.Type type = parameters[i].ParameterType; if (type.IsByRef) { type = type.GetElementType() ?? type; } if (obj == null || type.IsInstanceOfType(obj)) { array[i] = obj; } else if (type.IsEnum) { array[i] = System.Enum.ToObject(type, obj); } else { array[i] = Convert.ChangeType(obj, type, (IFormatProvider)(object)CultureInfo.InvariantCulture); } } return array; } private static bool TryCreateSteamId(string steamId, out object steamIdObject) { steamIdObject = null; ResolveTypes(); ulong num = default(ulong); if (_steamIdType == (System.Type)null || !ulong.TryParse(steamId, (NumberStyles)0, (IFormatProvider)(object)CultureInfo.InvariantCulture, ref num)) { return false; } try { ConstructorInfo[] constructors = _steamIdType.GetConstructors((BindingFlags)52); foreach (ConstructorInfo val in constructors) { ParameterInfo[] parameters = ((MethodBase)val).GetParameters(); if (parameters.Length == 1) { try { steamIdObject = val.Invoke(new object[1] { Convert.ChangeType((object)num, parameters[0].ParameterType, (IFormatProvider)(object)CultureInfo.InvariantCulture) }); return steamIdObject != null; } catch { } } } steamIdObject = Activator.CreateInstance(_steamIdType); MemberInfo[] members = _steamIdType.GetMembers((BindingFlags)52); foreach (MemberInfo val2 in members) { if (val2.Name.Contains("SteamID", (StringComparison)5) && TryWriteMemberValue(val2, steamIdObject, num)) { return true; } } } catch { } steamIdObject = null; return false; } private static bool TryExtractSteamId(object? value, out ulong steamId) { steamId = 0uL; if (value == null) { return false; } if (value is ulong num) { steamId = num; return steamId != 0; } if (value is long num2 && num2 > 0) { steamId = (ulong)num2; return true; } if (value is string text && ulong.TryParse(text, ref steamId)) { return steamId != 0; } System.Type type = value.GetType(); MemberInfo[] members = type.GetMembers((BindingFlags)52); foreach (MemberInfo val in members) { if ((!val.Name.Contains("SteamID", (StringComparison)5) && !val.Name.Equals("Value", (StringComparison)5)) || !TryReadMemberValue(val, value, out object value2) || value2 == null || value2 == value) { continue; } try { steamId = Convert.ToUInt64(value2, (IFormatProvider)(object)CultureInfo.InvariantCulture); if (steamId != 0) { return true; } } catch { } } return ulong.TryParse(value.ToString(), (NumberStyles)0, (IFormatProvider)(object)CultureInfo.InvariantCulture, ref steamId) && steamId != 0; } private static bool TryReadMemberValue(MemberInfo member, object? source, out object? value) { value = null; try { FieldInfo val = (FieldInfo)(object)((member is FieldInfo) ? member : null); if (val != null) { value = val.GetValue(source); return true; } PropertyInfo val2 = (PropertyInfo)(object)((member is PropertyInfo) ? member : null); if (val2 != null && val2.GetIndexParameters().Length == 0 && val2.GetMethod != (MethodInfo)null) { value = val2.GetValue(source); return true; } } catch { } return false; } private static bool TryWriteMemberValue(MemberInfo member, object source, ulong value) { try { FieldInfo val = (FieldInfo)(object)((member is FieldInfo) ? member : null); if (val != null && !val.IsInitOnly) { val.SetValue(source, Convert.ChangeType((object)value, val.FieldType, (IFormatProvider)(object)CultureInfo.InvariantCulture)); return true; } PropertyInfo val2 = (PropertyInfo)(object)((member is PropertyInfo) ? member : null); if (val2 != null && val2.SetMethod != (MethodInfo)null) { val2.SetValue(source, Convert.ChangeType((object)value, val2.PropertyType, (IFormatProvider)(object)CultureInfo.InvariantCulture)); return true; } } catch { } return false; } private static object? ReadNamedMember(System.Type type, object? source, bool staticOnly, string name) { //IL_0018: 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) BindingFlags val = (BindingFlags)(0x30 | (staticOnly ? 8 : 4)); MemberInfo val2 = Enumerable.FirstOrDefault((System.Collections.Generic.IEnumerable)type.GetMembers(val), (Func)((MemberInfo candidate) => string.Equals(candidate.Name, name, (StringComparison)5))); object value; return (val2 != (MemberInfo)null && TryReadMemberValue(val2, source, out value)) ? value : null; } private static int ToInt(object? value, int fallback) { try { return (value == null) ? fallback : Convert.ToInt32(value, (IFormatProvider)(object)CultureInfo.InvariantCulture); } catch { return fallback; } } } internal static class ImperiumPhoneAdminAssets { private static readonly string[] AppIconPaths = new string[4] { "app/PhoneAdmin_app.png", "PhoneAdmin_app.png", "phone-admin/PhoneAdmin_app.png", "p-admin/PhoneAdmin_app.png" }; private static readonly string[] LogoPaths = new string[4] { "app/PhoneAdmin_logo.png", "PhoneAdmin_logo.png", "phone-admin/PhoneAdmin_logo.png", "p-admin/PhoneAdmin_logo.png" }; private static Sprite? _appIcon; private static Sprite? _logo; internal static Sprite? LoadAppIconSprite() { if (!IsSpriteUsable(_appIcon)) { ReleaseSprite(ref _appIcon); _appIcon = LoadFirstSprite(AppIconPaths, "PAdminAppIcon", "PhoneAdmin_app.png"); } return _appIcon; } internal static Sprite? LoadLogoSprite() { if (!IsSpriteUsable(_logo)) { ReleaseSprite(ref _logo); _logo = LoadFirstSprite(LogoPaths, "PAdminLogo", "PhoneAdmin_logo.png"); } return _logo; } internal static void InvalidateLogo() { ReleaseSprite(ref _logo); } private static bool IsSpriteUsable(Sprite? sprite) { try { return (Object)(object)sprite != (Object)null && (Object)(object)sprite.texture != (Object)null && ((Texture)sprite.texture).width > 0 && ((Texture)sprite.texture).height > 0; } catch { return false; } } private static void ReleaseSprite(ref Sprite? sprite) { if ((Object)(object)sprite == (Object)null) { sprite = null; return; } try { Texture2D texture = sprite.texture; Object.Destroy((Object)(object)sprite); if ((Object)(object)texture != (Object)null) { Object.Destroy((Object)(object)texture); } } catch { } sprite = null; } private static Sprite? LoadFirstSprite(System.Collections.Generic.IEnumerable relativePaths, string name, string expectedFileName) { System.Collections.Generic.IEnumerator enumerator = relativePaths.GetEnumerator(); try { while (((System.Collections.IEnumerator)enumerator).MoveNext()) { string current = enumerator.Current; Sprite val = LoadEmbeddedSprite(current, name); if ((Object)(object)val != (Object)null) { return val; } } } finally { ((System.IDisposable)enumerator)?.Dispose(); } return null; } private static Sprite? LoadEmbeddedSprite(string relativePath, string name) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) try { string text = BuildResourceName(relativePath); Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(text); try { if (manifestResourceStream == null) { return null; } MemoryStream val = new MemoryStream(); try { manifestResourceStream.CopyTo((Stream)(object)val); Texture2D val2 = new Texture2D(2, 2, (TextureFormat)4, false) { name = name + "Texture", filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1 }; if (!ImageConversion.LoadImage(val2, Il2CppStructArray.op_Implicit(val.ToArray()), false)) { Object.Destroy((Object)(object)val2); return null; } Object.DontDestroyOnLoad((Object)(object)val2); Sprite val3 = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0.5f, 0.5f), (float)Math.Max(((Texture)val2).width, ((Texture)val2).height), 0u, (SpriteMeshType)0); ((Object)val3).name = name; Object.DontDestroyOnLoad((Object)(object)val3); return val3; } finally { ((System.IDisposable)val)?.Dispose(); } } finally { ((System.IDisposable)manifestResourceStream)?.Dispose(); } } catch (System.Exception) { return null; } } private static string BuildResourceName(string relativePath) { string text = (relativePath ?? string.Empty).Replace('\\', '/').TrimStart('/'); SHA256 val = SHA256.Create(); try { byte[] bytes = Encoding.UTF8.GetBytes("siak-imperium-art-v1/" + text); byte[] array = ((HashAlgorithm)val).ComputeHash(bytes); string text2 = BitConverter.ToString(array).Replace("-", string.Empty, (StringComparison)4).ToLowerInvariant(); return "SIAKImperium.r." + text2; } finally { ((System.IDisposable)val)?.Dispose(); } } } internal sealed class ImperiumPhoneAdminState { [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool WhitelistOnly { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string AccessMode { [CompilerGenerated] get; [CompilerGenerated] set; } = "open"; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool AllowSteamFriends { [CompilerGenerated] get; [CompilerGenerated] set; } = true; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string PasswordSalt { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string PasswordVerifier { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List Whitelist { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List Blacklist { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List History { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); } internal sealed class ImperiumPhoneAdminHistoryEntry { [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SteamId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Name { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string FirstSeenUtc { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string LastSeenUtc { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string LastDecision { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int JoinCount { [CompilerGenerated] get; [CompilerGenerated] set; } } internal sealed class ImperiumPhoneAdminPlayerView { [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SteamId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Name { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool IsFriend { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool IsHost { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool IsAllowed { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool IsBlocked { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool IsPending { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Decision { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string FirstSeenUtc { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [JsonIgnore] [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public float LastProfileRefreshAt { [CompilerGenerated] get; [CompilerGenerated] set; } } internal sealed class ImperiumPhoneAdminDashboardView { [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool HostAccess { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string AccessMode { [CompilerGenerated] get; [CompilerGenerated] set; } = "open"; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool AllowSteamFriends { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool PasswordConfigured { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ClientMode { [CompilerGenerated] get; [CompilerGenerated] set; } = "unknown"; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ClientStatus { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string ConnectionStatus { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List Whitelist { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List Blacklist { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List CurrentPlayers { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public List History { [CompilerGenerated] get; [CompilerGenerated] set; } = new List(); } internal sealed class ImperiumPhoneAdminSteamMember { [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string SteamId { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public string Name { [CompilerGenerated] get; [CompilerGenerated] set; } = string.Empty; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public bool IsFriend { [CompilerGenerated] get; [CompilerGenerated] set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public int ConnectionId { [CompilerGenerated] get; [CompilerGenerated] set; } = -1; } internal enum ImperiumPhoneAdminDecisionState { Allowed, Pending, Blocked } internal readonly struct ImperiumPhoneAdminAccessDecision { [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] internal ImperiumPhoneAdminDecisionState State { [CompilerGenerated] get; } internal bool Allowed => State == ImperiumPhoneAdminDecisionState.Allowed; internal bool Pending => State == ImperiumPhoneAdminDecisionState.Pending; internal bool Blocked => State == ImperiumPhoneAdminDecisionState.Blocked; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] internal string Reason { [CompilerGenerated] get; } internal ImperiumPhoneAdminAccessDecision(ImperiumPhoneAdminDecisionState state, string reason) { State = state; Reason = reason; } } internal readonly struct ImperiumPhoneAdminAvatarTarget { [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] internal string ElementId { [CompilerGenerated] get; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] internal string SteamId { [CompilerGenerated] get; } internal ImperiumPhoneAdminAvatarTarget(string elementId, string steamId) { ElementId = elementId; SteamId = steamId; } } internal static class ImperiumPhoneHomeScroll { private const float ProbeIntervalSeconds = 0.75f; private const float WheelSensitivity = 42f; private const float GlideDeceleration = 0.11f; private static float _nextProbeAt; private static int _boundHomeScreenId; private static int _boundScrollRectId; internal static void OnHomeScreenStarted(HomeScreen? homeScreen) { _nextProbeAt = 0f; TryBind(homeScreen); } internal static void Tick() { if (Time.unscaledTime < _nextProbeAt) { return; } _nextProbeAt = Time.unscaledTime + 0.75f; if (!PlayerSingleton.InstanceExists) { ResetBinding(); return; } HomeScreen instance = PlayerSingleton.Instance; if ((Object)(object)instance == (Object)null) { ResetBinding(); return; } ImperiumApp.EnsureLauncherVisible(); ImperiumAppStoreApp.EnsureLauncherVisible(); int instanceID = ((Object)((Component)instance).gameObject).GetInstanceID(); if (instanceID != _boundHomeScreenId || !BindingStillExists(instance)) { TryBind(instance); } } private static bool BindingStillExists(HomeScreen homeScreen) { if (_boundScrollRectId == 0) { return false; } Il2CppArrayBase componentsInChildren = ((Component)homeScreen).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { ScrollRect val = componentsInChildren[i]; if ((Object)(object)val != (Object)null && ((Object)((Component)val).gameObject).GetInstanceID() == _boundScrollRectId) { return true; } } return false; } private static void TryBind(HomeScreen? homeScreen) { if ((Object)(object)homeScreen == (Object)null) { return; } ScrollRect val = FindAppIconScrollRect(homeScreen); if (!((Object)(object)val == (Object)null) && !((Object)(object)val.content == (Object)null) && !((Object)(object)val.viewport == (Object)null)) { int instanceID = ((Object)((Component)homeScreen).gameObject).GetInstanceID(); int instanceID2 = ((Object)((Component)val).gameObject).GetInstanceID(); bool flag = instanceID != _boundHomeScreenId || instanceID2 != _boundScrollRectId; val.horizontal = false; val.vertical = true; val.movementType = (MovementType)2; val.elasticity = 0f; val.inertia = true; val.decelerationRate = 0.11f; val.scrollSensitivity = 42f; Image component = ((Component)val.viewport).GetComponent(); if ((Object)(object)component != (Object)null) { ((Graphic)component).raycastTarget = true; } if (flag) { Canvas.ForceUpdateCanvases(); LayoutRebuilder.ForceRebuildLayoutImmediate(val.content); Canvas.ForceUpdateCanvases(); val.StopMovement(); val.verticalNormalizedPosition = 1f; _boundHomeScreenId = instanceID; _boundScrollRectId = instanceID2; SIAKImperiumMod.LogUi("Phone home scrolling bound with clamped inertial movement."); } } } private static ScrollRect? FindAppIconScrollRect(HomeScreen homeScreen) { Il2CppArrayBase componentsInChildren = ((Component)homeScreen).GetComponentsInChildren(true); ScrollRect result = null; for (int i = 0; i < componentsInChildren.Length; i++) { ScrollRect val = componentsInChildren[i]; if (!((Object)(object)val == (Object)null)) { if ((Object)(object)val.content != (Object)null && string.Equals(((Object)((Component)val.content).gameObject).name, "AppIcons", (StringComparison)5)) { return val; } if (string.Equals(((Object)((Component)val).gameObject).name, "AppIconsScrollView", (StringComparison)5)) { result = val; } } } return result; } private static void ResetBinding() { _boundHomeScreenId = 0; _boundScrollRectId = 0; } } internal static class ImperiumPhoneLauncherRecovery { internal static GameObject? Ensure(GameObject? cachedRoot, string appName, string label, Sprite? sprite, Action openApp) { if (!PlayerSingleton.InstanceExists) { return null; } Transform val = ResolveRealAppIcons(PlayerSingleton.Instance); if ((Object)(object)val == (Object)null) { return null; } object obj2; if (!IsLauncherInContainer(cachedRoot, val)) { Transform? obj = FindDirectChild(val, appName); obj2 = ((obj != null) ? ((Component)obj).gameObject : null); } else { obj2 = cachedRoot; } GameObject val2 = (GameObject)obj2; bool immediate = false; if ((Object)(object)val2 == (Object)null) { Transform val3 = FindLauncherTemplate(val); if ((Object)(object)val3 == (Object)null) { return null; } val2 = Object.Instantiate(((Component)val3).gameObject, val, false); ((Object)val2).name = appName; immediate = true; } ConfigureLauncher(val2, appName, label, sprite, openApp); RebuildGrid(val, immediate); return val2; } private static Transform? ResolveRealAppIcons(HomeScreen homeScreen) { RectTransform appIconContainer = homeScreen.appIconContainer; if ((Object)(object)appIconContainer != (Object)null && (Object)(object)((Component)appIconContainer).GetComponent() != (Object)null) { return (Transform?)(object)appIconContainer; } return FindGridContainer(((Component)homeScreen).transform); } private static Transform? FindGridContainer(Transform root) { if (string.Equals(((Object)root).name, "AppIcons", (StringComparison)5) && (Object)(object)((Component)root).GetComponent() != (Object)null) { return root; } for (int i = 0; i < root.childCount; i++) { Transform val = FindGridContainer(root.GetChild(i)); if ((Object)(object)val != (Object)null) { return val; } } return null; } private static Transform? FindDirectChild(Transform parent, string name) { for (int i = 0; i < parent.childCount; i++) { Transform child = parent.GetChild(i); if (string.Equals(((Object)child).name, name, (StringComparison)4)) { return child; } } return null; } private static Transform? FindLauncherTemplate(Transform appIcons) { Transform val = null; for (int i = 0; i < appIcons.childCount; i++) { Transform child = appIcons.GetChild(i); if (!((Object)(object)((Component)child).GetComponent