using System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using Archipelago.MultiClient.Net; using Archipelago.MultiClient.Net.BounceFeatures.DeathLink; using Archipelago.MultiClient.Net.Enums; using Archipelago.MultiClient.Net.Helpers; using Archipelago.MultiClient.Net.Models; using Archipelago.MultiClient.Net.Packets; using ArchipelagoULTRAKILL.Commands; using ArchipelagoULTRAKILL.Components; using ArchipelagoULTRAKILL.Config; using ArchipelagoULTRAKILL.Music; using ArchipelagoULTRAKILL.Powerups; using ArchipelagoULTRAKILL.Properties; using ArchipelagoULTRAKILL.Structures; using BepInEx; using BepInEx.Logging; using GameConsole; using HarmonyLib; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using PluginConfig.API; using PluginConfig.API.Decorators; using PluginConfig.API.Fields; using PluginConfig.API.Functionals; using TMPro; using ULTRAKILL.Cheats; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.AddressableAssets.ResourceLocators; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.ResourceManagement.ResourceProviders; using UnityEngine.SceneManagement; using UnityEngine.UI; using plog; using plog.Models; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("ArchipelagoULTRAKILL")] [assembly: AssemblyDescription("Connect to an Archipelago server to play ULTRAKILL randomizer.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ArchipelagoULTRAKILL")] [assembly: AssemblyCopyright("Copyright © TRPG 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("c7de03cb-cf51-44da-ba1f-6fcecd638e0a")] [assembly: AssemblyFileVersion("3.5.2")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("3.5.2.0")] namespace ArchipelagoULTRAKILL { public static class ColorRandomizer { public static void RandomizeGunColors() { MonoSingleton.Instance.SetBool("gunColorType.1", true); MonoSingleton.Instance.SetBool("gunColorType.1.a", true); MonoSingleton.Instance.SetBool("gunColorType.2", true); MonoSingleton.Instance.SetBool("gunColorType.3", true); MonoSingleton.Instance.SetBool("gunColorType.3.a", true); MonoSingleton.Instance.SetBool("gunColorType.4", true); MonoSingleton.Instance.SetBool("gunColorType.5", true); for (int i = 1; i <= 5; i++) { for (int j = 1; j <= 2; j++) { if (j != 2 || (i != 4 && i != 5)) { bool flag = false; if (j == 2) { flag = true; } for (int k = 1; k <= 3; k++) { MonoSingleton.Instance.SetFloat(string.Concat(new object[6] { "gunColor.", i.ToString(), ".", k.ToString(), flag ? ".a" : ".", "r" }), Random.Range(0f, 1f)); MonoSingleton.Instance.SetFloat(string.Concat(new object[6] { "gunColor.", i.ToString(), ".", k.ToString(), flag ? ".a" : ".", "g" }), Random.Range(0f, 1f)); MonoSingleton.Instance.SetFloat(string.Concat(new object[6] { "gunColor.", i.ToString(), ".", k.ToString(), flag ? ".a" : ".", "b" }), Random.Range(0f, 1f)); MonoSingleton.Instance.SetFloat(string.Concat(new object[6] { "gunColor.", i.ToString(), ".", k.ToString(), flag ? ".a" : ".", "a" }), Random.Range(0f, 1f)); } } } } if (Core.IsPlaying) { MonoSingleton.Instance.UpdateGunColors(); GunColorTypeGetter[] array = Object.FindObjectsOfType(); foreach (GunColorTypeGetter val in array) { val.UpdatePreview(); } } } public static void RandomizeUIColors() { for (int i = 1; i <= 3; i++) { string text = ".r"; if (i == 2) { text = ".g"; } if (i == 3) { text = ".b"; } MonoSingleton.Instance.SetFloat("hudColor.hp" + text, Random.Range(0f, 1f)); MonoSingleton.Instance.SetFloat("hudColor.hptext" + text, Random.Range(0f, 1f)); MonoSingleton.Instance.SetFloat("hudColor.hpaft" + text, Random.Range(0f, 1f)); MonoSingleton.Instance.SetFloat("hudColor.hphdmg" + text, Random.Range(0f, 1f)); MonoSingleton.Instance.SetFloat("hudColor.hpover" + text, Random.Range(0f, 1f)); MonoSingleton.Instance.SetFloat("hudColor.stm" + text, Random.Range(0f, 1f)); MonoSingleton.Instance.SetFloat("hudColor.stmchr" + text, Random.Range(0f, 1f)); MonoSingleton.Instance.SetFloat("hudColor.stmemp" + text, Random.Range(0f, 1f)); MonoSingleton.Instance.SetFloat("hudColor.raifull" + text, Random.Range(0f, 1f)); MonoSingleton.Instance.SetFloat("hudColor.raicha" + text, Random.Range(0f, 1f)); MonoSingleton.Instance.SetFloat("hudColor.var0" + text, Random.Range(0f, 1f)); MonoSingleton.Instance.SetFloat("hudColor.var1" + text, Random.Range(0f, 1f)); MonoSingleton.Instance.SetFloat("hudColor.var2" + text, Random.Range(0f, 1f)); MonoSingleton.Instance.SetFloat("hudColor.var3" + text, Random.Range(0f, 1f)); } if (Core.IsPlaying) { MonoSingleton.Instance.UpdateHudColors(); MonoSingleton.Instance.UpdateWeaponColors(); } } } public static class LevelManager { public static Dictionary skulls = new Dictionary(); public static Door redDoor; public static void FindSkulls() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Invalid comparison between Unknown and I4 //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Invalid comparison between Unknown and I4 //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Invalid comparison between Unknown and I4 //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Invalid comparison between Unknown and I4 //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Invalid comparison between Unknown and I4 //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Invalid comparison between Unknown and I4 //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Invalid comparison between Unknown and I4 //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Invalid comparison between Unknown and I4 //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Invalid comparison between Unknown and I4 //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Invalid comparison between Unknown and I4 //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Invalid comparison between Unknown and I4 skulls.Clear(); int num = 0; ItemIdentifier[] array = Resources.FindObjectsOfTypeAll(); foreach (ItemIdentifier val in array) { if ((int)val.itemType != 1 && (int)val.itemType != 2) { continue; } Scene val2 = ((Component)val).gameObject.scene; string name = ((Scene)(ref val2)).name; val2 = SceneManager.GetActiveScene(); if (!(name == ((Scene)(ref val2)).name)) { continue; } if (SceneHelper.CurrentScene == "Level 2-4") { if ((Object)(object)((Component)val).gameObject.transform.parent == (Object)null || ((Object)((Component)val).gameObject.transform.parent.parent).name != "Altar (1)") { continue; } } else if (SceneHelper.CurrentScene == "Level 7-S") { if (((int)val.itemType == 1 && !Object.op_Implicit((Object)(object)((Component)val).transform.parent.parent.parent)) || ((int)val.itemType == 2 && ((Object)((Component)val).transform.parent.parent.parent).name != "Interactives")) { continue; } } else if (SceneHelper.CurrentScene == "Level 8-1") { if (((Object)((Component)val).gameObject.transform.parent.parent.parent).name != "Inside") { continue; } } else if (SceneHelper.CurrentScene == "Level 8-2") { if (((int)val.itemType == 1 && ((Object)((Component)val).transform.parent.parent).name != "Altar (Blue) (1)") || ((int)val.itemType == 2 && ((Object)((Component)val).transform.parent.parent).name != "Altar (Red) (1)")) { continue; } } else if (SceneHelper.CurrentScene == "Level 8-3") { if (((Object)((Component)val).gameObject.transform.parent.parent.parent).name == "10 Nonstuff") { continue; } } else if (SceneHelper.CurrentScene == "Level 8-4") { if (((int)val.itemType == 1 && ((Object)((Component)val).transform.parent).name != "Bathroom") || ((int)val.itemType == 2 && ((Object)((Component)val).transform.parent.parent).name != "Altar (Red)")) { continue; } } else if (SceneHelper.CurrentScene == "Level 0-E") { if (((int)val.itemType == 1 && Object.op_Implicit((Object)(object)((Component)val).transform.parent.parent.parent)) || ((int)val.itemType == 2 && Object.op_Implicit((Object)(object)((Component)val).transform.parent.parent.parent))) { continue; } } else if (SceneHelper.CurrentScene == "Level 1-E" && (((int)val.itemType == 1 && ((Object)((Component)val).transform.parent.parent).name != "Altar (Blue) (1)") || (int)val.itemType == 2)) { continue; } if (skulls.ContainsKey(((object)(ItemType)(ref val.itemType)).ToString())) { num++; skulls[((object)(ItemType)(ref val.itemType)).ToString() + num] = ((Component)val).gameObject; } else { skulls[((object)(ItemType)(ref val.itemType)).ToString()] = ((Component)val).gameObject; } } for (int j = 0; j < skulls.Count; j++) { KeyValuePair keyValuePair = skulls.ElementAt(j); string text = Core.CurrentLevelInfo.Id.ToString(); if (Core.CurrentLevelInfo.Name == "0-S") { text = "0S"; } else if (Core.CurrentLevelInfo.Name == "7-S") { text = "7S"; } string currentScene = SceneHelper.CurrentScene; string text2 = currentScene; if (!(text2 == "Level 1-4")) { if (text2 == "Level 5-1") { if (j + 1 > Core.data.unlockedSkulls5_1) { DeactivateSkull(keyValuePair.Value); } } else if (((Object)keyValuePair.Value).name.Contains("Blue")) { if (!Core.data.unlockedSkulls.Contains(text + "_b")) { DeactivateSkull(keyValuePair.Value); } } else if (((Object)keyValuePair.Value).name.Contains("Red") && !Core.data.unlockedSkulls.Contains(text + "_r")) { DeactivateSkull(keyValuePair.Value); } } else if (j + 1 > Core.data.unlockedSkulls1_4) { DeactivateSkull(keyValuePair.Value); } } } public static void ActivateSkull(GameObject skull) { ItemPlaceZone val = default(ItemPlaceZone); if (((Component)skull.transform.parent).TryGetComponent(ref val)) { val.elementChangeEffect.Play(); InstantiateObject[] altarElements = val.altarElements; foreach (InstantiateObject val2 in altarElements) { ((Component)val2).gameObject.SetActive(true); if (((Component)val2).gameObject.activeInHierarchy) { val2.Instantiate(); } } } else { Core.Logger.LogWarning((object)(((Object)skull).name + " GameObject has no ItemPlaceZone in parent")); } skull.SetActive(true); } public static void DeactivateSkull(GameObject skull) { ItemPlaceZone val = default(ItemPlaceZone); if (((Component)skull.transform.parent).TryGetComponent(ref val)) { InstantiateObject[] altarElements = val.altarElements; foreach (InstantiateObject val2 in altarElements) { ((Component)val2).gameObject.SetActive(false); } } else { Core.Logger.LogWarning((object)(((Object)skull).name + " GameObject has no ItemPlaceZone in parent")); } skull.SetActive(false); } public static void AddDoorClosers() { ItemPlaceZone[] array = Resources.FindObjectsOfTypeAll(); foreach (ItemPlaceZone val in array) { if (SceneHelper.CurrentScene == "Level 1-1") { if ((Object)(object)((Component)val).transform.parent.parent != (Object)null && ((Object)((Component)val).transform.parent.parent).name == "11 Nonstuff") { GameObjectExtensions.GetOrAddComponent(((Component)((Component)val).transform.parent.parent.parent).gameObject); } } else if (SceneHelper.CurrentScene == "Level 1-2") { if ((Object)(object)((Component)val).transform.parent.parent != (Object)null && ((Object)((Component)val).transform.parent.parent).name == "3 Nonstuff") { GameObjectExtensions.GetOrAddComponent(((Component)((Component)val).transform.parent.parent.parent).gameObject); } } else if (SceneHelper.CurrentScene == "Level 2-3") { if ((Object)(object)((Component)val).transform.parent != (Object)null && (((Object)((Component)val).transform.parent).name == "Altar" || ((Object)((Component)val).transform.parent).name == "Altar (1)")) { GameObjectExtensions.GetOrAddComponent(((Component)((Component)val).transform.parent).gameObject); } } else if (SceneHelper.CurrentScene == "Level 4-4") { if ((Object)(object)((Component)val).transform.parent.parent != (Object)null && ((Object)((Component)val).transform.parent.parent).name == "Secret Hall") { GameObjectExtensions.GetOrAddComponent(((Component)((Component)val).transform.parent.parent.parent).gameObject); } } else if (SceneHelper.CurrentScene == "Level 5-2") { if ((Object)(object)((Component)val).transform.parent.parent != (Object)null && (((Object)((Component)val).transform.parent.parent).name == "6" || ((Object)((Component)val).transform.parent.parent).name == "7B")) { GameObjectExtensions.GetOrAddComponent(((Component)((Component)val).transform.parent.parent).gameObject); } } else if (SceneHelper.CurrentScene == "Level 5-3") { if ((Object)(object)((Component)val).transform.parent.parent != (Object)null && ((Object)((Component)val).transform.parent.parent).name == "2A4 - Skullway") { GameObjectExtensions.GetOrAddComponent(((Component)((Component)val).transform.parent.parent).gameObject); } } else if (SceneHelper.CurrentScene == "Level 6-1") { if ((Object)(object)((Component)val).transform.parent.parent != (Object)null && ((Object)((Component)val).transform.parent.parent).name == "3 - Crossroads") { GameObjectExtensions.GetOrAddComponent(((Component)((Component)val).transform.parent.parent).gameObject); } } else if (SceneHelper.CurrentScene == "Level 1-E" && (Object)(object)((Component)val).transform.parent.parent != (Object)null && ((Object)((Component)val).transform.parent.parent).name == "13-3 Connector") { GameObjectExtensions.GetOrAddComponent(((Component)((Component)val).transform.parent.parent).gameObject); } } } public static void DeactivateNailgun() { GearCheckEnabler[] array = Resources.FindObjectsOfTypeAll(); foreach (GearCheckEnabler val in array) { if (((Object)((Component)val).transform.parent).name == "1 - First Room") { ((Component)val).gameObject.SetActive(false); } } } public static void ChangeIntro() { //IL_00c5: 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_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) if (Core.CurrentLevelHasInfo && Core.CurrentLevelInfo.Id == 1) { TextMeshProUGUI component = ((Component)GameObject.Find("/Canvas").transform.Find("HurtScreen").Find("Text 2 Sound").Find("Text (2)")).GetComponent(); ((TMP_Text)component).text = ((TMP_Text)component).text + "\nARCHIPELAGO BY TRPG"; ((TMP_Text)component).lineSpacing = 25f; TextMeshProUGUI component2 = Object.Instantiate(((Component)component).gameObject, ((TMP_Text)component).transform.parent).GetComponent(); ((TMP_Text)component2).text = "and others!"; ((TMP_Text)component2).fontSize = 32f; ((TMP_Text)component2).transform.localPosition = new Vector3(270f, -70f, 0f); ((TMP_Text)component2).transform.Rotate(new Vector3(0f, 0f, 6f)); GameObject val = Object.Instantiate(((Component)component).gameObject, ((TMP_Text)component).transform.parent); Object.DestroyImmediate((Object)(object)val.GetComponent()); Object.DestroyImmediate((Object)(object)val.GetComponent()); Image val2 = val.AddComponent(); val2.sprite = UIManager.bundle.LoadAsset("assets/trpg.png"); ((Graphic)val2).color = new Color(0.992f, 0.758f, 0.297f); val2.preserveAspect = true; ((Component)val2).transform.localPosition = new Vector3(150f, -32f, 0f); ((Component)val2).transform.localScale = new Vector3(0.08f, 0.08f, 0.08f); ((Component)component).gameObject.AddComponent().objects.Add(((Component)component2).gameObject); ((Component)component).gameObject.AddComponent().objects.Add(((Component)val2).gameObject); } } public static void AddGlassComponents() { if (!Core.CurrentLevelHasInfo || Core.CurrentLevelInfo.Id != 1) { return; } Glass[] array = Resources.FindObjectsOfTypeAll(); foreach (Glass val in array) { string name = ((Object)((Component)val).transform.parent.parent).name; switch (name) { default: if (!(name == "11 Content(Clone)")) { continue; } break; case "5 Stuff": case "5 Stuff(Clone)": case "11 Content": break; } GameObject gameObject = ((Component)((Component)val).transform.parent.parent).gameObject; if (!Object.op_Implicit((Object)(object)gameObject.GetComponent())) { gameObject.AddComponent(); } } } public static void FindHank() { if (!Core.CurrentLevelHasInfo) { return; } HudMessage[] array = Resources.FindObjectsOfTypeAll(); foreach (HudMessage val in array) { if ((Core.CurrentLevelInfo.Id == 9 || Core.CurrentLevelInfo.Id == 22) && ((Object)val).name == "EasterEgg") { string message = val.message; message = message.Replace("Nothing", "Something"); message = message.Replace("but", "and"); val.message = message; ((Component)val).gameObject.AddComponent(); } } } public static void ForceBlueArm() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)MonoSingleton.Instance)) { Core.Logger.LogWarning((object)"FistControl.Instance is null!"); return; } MonoSingleton.Instance.forcedLoadout.arm.blueVariant = (VariantOption)1; MonoSingleton.Instance.ResetFists(); } public static void FindRocketRaceButton() { if (!(SceneHelper.CurrentScene != "CreditsMuseum2") && Core.data.rocketReward) { GameObject.Find("/PuzzleScreen (2)/Canvas/Background/Start").AddComponent(); } } } public class Multiworld : MonoBehaviour { [CompilerGenerated] private sealed class d__30 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Multiworld <>4__this; private WeaponLoadout 5__1; private GameProgressMoneyAndGear 5__2; private LoginResult 5__3; private LoginSuccessful 5__4; private string 5__5; private Dictionary.KeyCollection.Enumerator <>s__6; private string 5__7; private long 5__8; private ScoutedItemInfo 5__9; private string 5__10; private string 5__11; private HashSet.Enumerator <>s__12; private string 5__13; private LoginFailure 5__14; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__30(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; 5__5 = null; <>s__6 = default(Dictionary.KeyCollection.Enumerator); 5__7 = null; 5__9 = null; 5__10 = null; 5__11 = null; <>s__12 = default(HashSet.Enumerator); 5__13 = null; 5__14 = null; <>1__state = -2; } private bool MoveNext() { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown //IL_0a44: Unknown result type (might be due to invalid IL or missing references) //IL_0ab1: Unknown result type (might be due to invalid IL or missing references) //IL_0e59: 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_024b: Expected O, but got Unknown //IL_0cb3: Unknown result type (might be due to invalid IL or missing references) //IL_0cb8: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: { <>1__state = -1; if (Authenticated) { return false; } 5__1 = WeaponLoadout.Get(); Core.Logger.LogInfo((object)"Got loadout"); 5__2 = GameProgressSaver.GetGeneralProgress(); Core.LockAllWeapons(); Core.data.unlockedSkulls1_4 = 0; Core.data.unlockedSkulls5_1 = 0; Session = ArchipelagoSessionFactory.CreateSession(Core.data.host_name, 38281); Session.Socket.SocketClosed += new SocketClosedHandler(SocketClosed); Session.Socket.ErrorReceived += new ErrorReceivedHandler(ErrorReceived); Session.Socket.PacketReceived += new PacketReceivedHandler(PacketReceived); Session.Items.ItemReceived += new ItemReceivedHandler(ItemReceived); Core.Logger.LogInfo((object)string.Format("Attempting connection ({0} - {1} / {2})", Core.data.slot_name, apVersion, "3.5.2")); 5__3 = Session.TryConnectAndLogin("ULTRAKILL", Core.data.slot_name, (ItemsHandlingFlags)7, apVersion, (string[])null, (string)null, (Core.data.password == "") ? null : Core.data.password, true); ref LoginSuccessful reference = ref 5__4; LoginResult obj = 5__3; reference = (LoginSuccessful)(object)((obj is LoginSuccessful) ? obj : null); if (5__4 != null) { Core.Logger.LogInfo((object)"Login successful"); Authenticated = true; PlayerConfig.isConnected.value = true; ((ConfigField)PlayerConfig.playerName).interactable = false; ((ConfigField)PlayerConfig.serverAddress).interactable = false; ((ConfigField)PlayerConfig.serverPassword).interactable = false; ((ConfigField)PlayerConfig.hintMode).interactable = false; ((ConfigField)PlayerConfig.chat).interactable = true; if (Core.DataExists()) { <>4__this.DoServerCheck(Session, 5__4.SlotData); } else { AllowConnect = true; } <>2__current = (object)new WaitUntil((Func)(() => AllowConnect.HasValue)); <>1__state = 1; return true; } ref LoginFailure reference2 = ref 5__14; LoginResult obj2 = 5__3; reference2 = (LoginFailure)(object)((obj2 is LoginFailure) ? obj2 : null); if (5__14 != null) { Core.Logger.LogInfo((object)"Login failed"); Authenticated = false; Core.Logger.LogError((object)string.Join("\n", 5__14.Errors)); PlayerConfig.connectionInfo.text = string.Join("\n", 5__14.Errors); Session.Socket.DisconnectAsync(); Session = null; CanGetItems = false; AllowConnect = null; ((Graphic)UIManager.menuIcon.GetComponent()).color = Colors.Red; Core.SaveGeneralProgress(5__2); } 5__14 = null; break; } case 1: <>1__state = -1; if (!AllowConnect.Value) { LocationManager.itemQueue.Clear(); Disconnect(); return false; } Core.data.seed = Session.RoomState.Seed; TryGetSlotDataValue(ref Core.data.version, 5__4.SlotData, "version", string.Empty); Core.data.serverVersion = Session.RoomState.GeneratorVersion.ToString(); Core.Logger.LogInfo((object)string.Format("Server version: {0} / {1}", Session.RoomState.Version, (Core.data.version == string.Empty) ? "?" : Core.data.version)); TryGetStart(ref Core.data.unlockedLevels, 5__4.SlotData, "0-1"); TryGetGoal(ref Core.data.goal, 5__4.SlotData, "6-2"); TryGetSlotDataValue(ref Core.data.goalRequirement, 5__4.SlotData, "goal_requirement", 15); TryGetSlotDataValue(ref Core.data.perfectGoal, 5__4.SlotData, "perfect_goal", defaultValue: false); TryGetSlotDataValue(ref Core.data.secretExitUnlock, 5__4.SlotData, "secret_mission_unlock_type", defaultValue: true); TryGetSlotDataValue(ref Core.data.secretExitComplete, 5__4.SlotData, "secret_exit_behavior", defaultValue: true); TryGetEnemyOption(ref Core.data.enemyRewards, 5__4.SlotData, "enemy_rewards", EnemyOptions.Disabled); TryGetSlotDataValue(ref Core.data.challengeRewards, 5__4.SlotData, "challenge_rewards", defaultValue: false); TryGetSlotDataValue(ref Core.data.pRankRewards, 5__4.SlotData, "p_rank_rewards", defaultValue: false); TryGetSlotDataValue(ref Core.data.hankRewards, 5__4.SlotData, "hank_rewards", defaultValue: false); TryGetSlotDataValue(ref Core.data.clashReward, 5__4.SlotData, "randomize_clash_mode", defaultValue: false); TryGetSlotDataValue(ref Core.data.fishRewards, 5__4.SlotData, "fish_rewards", defaultValue: false); TryGetSlotDataValue(ref Core.data.cleanRewards, 5__4.SlotData, "cleaning_rewards", defaultValue: false); TryGetSlotDataValue(ref Core.data.chessReward, 5__4.SlotData, "chess_reward", defaultValue: false); TryGetSlotDataValue(ref Core.data.rocketReward, 5__4.SlotData, "rocket_race_reward", defaultValue: false); TryGetFire2(ref Core.data.randomizeFire2, 5__4.SlotData, "randomize_secondary_fire", Fire2Options.Disabled); TryGetSlotDataValue(ref Core.data.revForm, 5__4.SlotData, "revolver_form", WeaponForm.Standard); TryGetSlotDataValue(ref Core.data.shoForm, 5__4.SlotData, "shotgun_form", WeaponForm.Standard); TryGetSlotDataValue(ref Core.data.naiForm, 5__4.SlotData, "nailgun_form", WeaponForm.Standard); TryGetSlotDataValue(ref Core.data.randomizeSkulls, 5__4.SlotData, "randomize_skulls", defaultValue: false); TryGetSlotDataValue(ref Core.data.l1switch, 5__4.SlotData, "randomize_limbo_switches", defaultValue: false); TryGetSlotDataValue(ref Core.data.l7switch, 5__4.SlotData, "randomize_violence_switches", defaultValue: false); if (!UIManager.createdMenuIcons) { UIManager.CreateMenuIcons(); UIManager.CreateChapterRecents(UIManager.chapterSelect); } if (!Core.DataExists()) { Core.Logger.LogInfo((object)"Doing first time setup for save file"); if (Core.data.revForm == WeaponForm.Standard) { Core.data.revstd = true; Core.data.revalt = false; } else { Core.data.revstd = false; Core.data.revalt = true; GameProgressSaver.AddGear("revalt"); } if (Core.data.shoForm == WeaponForm.Standard) { Core.data.shostd = true; Core.data.shoalt = false; } else { Core.data.shostd = false; Core.data.shoalt = true; GameProgressSaver.AddGear("shoalt"); } if (Core.data.naiForm == WeaponForm.Standard) { Core.data.naistd = true; Core.data.naialt = false; } else { Core.data.naistd = false; Core.data.naialt = true; GameProgressSaver.AddGear("naialt"); } TryGetSlotDataValue(ref Core.data.hasArm, 5__4.SlotData, "start_with_arm", defaultValue: true); TryGetSlotDataValue(ref Core.data.dashes, 5__4.SlotData, "starting_stamina", 3); TryGetSlotDataValue(ref Core.data.walljumps, 5__4.SlotData, "starting_walljumps", 3); TryGetSlotDataValue(ref Core.data.canSlide, 5__4.SlotData, "start_with_slide", defaultValue: true); TryGetSlotDataValue(ref Core.data.canSlam, 5__4.SlotData, "start_with_slam", defaultValue: true); TryGetSlotDataValue(ref Core.data.multiplier, 5__4.SlotData, "point_multiplier", 1); TryGetSlotDataValue(ref Core.data.musicRandomizer, 5__4.SlotData, "music_randomizer", defaultValue: false); if (Core.data.musicRandomizer) { Core.data.music = JsonConvert.DeserializeObject>(5__4.SlotData["music"].ToString()); } TryGetSlotDataValue(ref Core.data.cybergrindHints, 5__4.SlotData, "cybergrind_hints", defaultValue: true); try { ColorConfig.uiColorRandomizer.value = (ColorOptions)Enum.Parse(typeof(ColorOptions), 5__4.SlotData["ui_color_randomizer"].ToString()); } catch (KeyNotFoundException) { ColorConfig.uiColorRandomizer.value = ColorOptions.Off; } try { ColorConfig.gunColorRandomizer.value = (ColorOptions)Enum.Parse(typeof(ColorOptions), 5__4.SlotData["gun_color_randomizer"].ToString()); } catch (KeyNotFoundException) { ColorConfig.gunColorRandomizer.value = ColorOptions.Off; } Core.data.playerCount = Session.Players.Players[0].Count - 1; MonoSingleton.Instance.SetInt("difficulty", 4); GameProgressSaver.SetIntro(true); GameProgressSaver.SetTutorial(true); GameProgressSaver.UnlockWeaponCustomization((WeaponCustomizationType)0); GameProgressSaver.UnlockWeaponCustomization((WeaponCustomizationType)1); GameProgressSaver.UnlockWeaponCustomization((WeaponCustomizationType)2); GameProgressSaver.UnlockWeaponCustomization((WeaponCustomizationType)3); GameProgressSaver.UnlockWeaponCustomization((WeaponCustomizationType)4); GameProgressSaver.SaveProgress(34); GameProgressSaver.SetEncoreProgress(101); GameProgressSaver.SetPrime(1, 1); GameProgressSaver.SetPrime(2, 1); Core.SaveData(); if (ColorConfig.uiColorRandomizer.value != 0) { ColorRandomizer.RandomizeUIColors(); } if (ColorConfig.gunColorRandomizer.value != 0) { ColorRandomizer.RandomizeGunColors(); } Core.data.deathLink = bool.Parse(5__4.SlotData["death_link"].ToString()); TryGetSlotDataValue(ref Core.data.deathLinkAmnesty, 5__4.SlotData, "death_link_amnesty", 1); } MonoSingleton.Instance.SetInt("weapon.arm0", 1); LocationManager.locations = ((JToken)(JObject)5__4.SlotData["locations"]).ToObject>(); ConfigManager.LoadStats(); LocationManager.RegenerateItemDefinitions(); Core.Logger.LogInfo((object)("Successfully connected to server as player \"" + Core.data.slot_name + "\".")); PlayerConfig.connectionInfo.text = "Successfully connected to server as player \"" + Core.data.slot_name + "\"."; ((Graphic)UIManager.menuIcon.GetComponent()).color = Colors.Green; if (Core.data.completedLevels.Count < Core.data.goalRequirement) { UIManager.CreateGoalCounter(); } 5__5 = ((LocationManager.locations.Count == 0) ? "?" : LocationManager.locations.Count.ToString()); if (Core.data.deathLink) { EnableDeathLink(); } else { DeathLinkConfig.deathLinkStatus.text = "Death Link is OFF"; } Core.Logger.LogInfo((object)"Scouting shop items"); <>s__6 = Core.shopPrices.Keys.GetEnumerator(); try { while (<>s__6.MoveNext()) { 5__7 = <>s__6.Current; 5__8 = LocationManager.locations["shop_" + 5__7]; 5__9 = Session.Locations.ScoutLocationsAsync(false, new long[1] { LocationManager.locations["shop_" + 5__7] }).Result[5__8]; 5__10 = ((ItemInfo)5__9).ItemName; 5__11 = Session.Players.GetPlayerName(PlayerInfo.op_Implicit(5__9.Player)); if (LocationManager.GetItemDefinition(5__10) != null) { LocationManager.shopScouts.Add("shop_" + 5__7, new UKItem { itemName = 5__10, playerName = 5__11, type = LocationManager.GetItemDefinition(5__10).Type }); } else { LocationManager.shopScouts.Add("shop_" + 5__7, new APItem { itemName = 5__10, playerName = 5__11, type = ((ItemInfo)5__9).Flags }); } 5__9 = null; 5__10 = null; 5__11 = null; 5__7 = null; } } finally { ((IDisposable)<>s__6).Dispose(); } <>s__6 = default(Dictionary.KeyCollection.Enumerator); <>s__12 = Core.data.@checked.GetEnumerator(); try { while (<>s__12.MoveNext()) { 5__13 = <>s__12.Current; LocationManager.CheckLocation(5__13); 5__13 = null; } } finally { ((IDisposable)<>s__12).Dispose(); } <>s__12 = default(HashSet.Enumerator); CanGetItems = true; ((MonoBehaviour)Core.Instance).StartCoroutine("ApplyLoadout", (object)5__1); 5__5 = null; break; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static Version apVersion = new Version(0, 6, 7); public static DeathLinkService DeathLinkService = null; public static DeathLink lastDeathLink = null; public static int currentDeathCount = 0; public static bool Authenticated; public static bool HintMode = false; public static ArchipelagoSession Session; public static List messages = new List(); public GameObject serverCheckBlocker; public TextMeshProUGUI serverCheckText; public static List recentItems = new List(); public static bool CanGetItems { get; private set; } = false; public static bool? AllowConnect { get; private set; } = null; public void SetupServerCheckBlocker() { //IL_00e2: 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) //IL_019a: Expected O, but got Unknown //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Expected O, but got Unknown if (!(SceneHelper.CurrentScene != "Main Menu")) { serverCheckBlocker = ((Component)((Component)Object.Instantiate(((Component)((Component)MonoSingleton.Instance.optionsMenu).transform.Find("Save Slots").Find("Reload Consent Blocker")).gameObject, UIManager.canvas.transform).transform.GetChild(0)).transform.parent).gameObject; ((Object)serverCheckBlocker).name = "Archipelago Server Check Blocker"; Object.Destroy((Object)(object)serverCheckBlocker.GetComponent()); Object.Destroy((Object)(object)((Component)serverCheckBlocker.transform.Find("Consent")).GetComponent()); ((Component)serverCheckBlocker.transform.Find("Consent").Find("Panel")).GetComponent().sizeDelta = new Vector2(0f, 180f); serverCheckText = ((Component)serverCheckBlocker.transform.Find("Consent").Find("Panel").Find("Text")).GetComponent(); GameObject gameObject = ((Component)serverCheckBlocker.transform.Find("Consent").Find("Panel").Find("Yes")).gameObject; ((TMP_Text)gameObject.GetComponentInChildren(true)).text = "YES"; Button component = gameObject.GetComponent