using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using System.Threading.Tasks; using Archipelago.MultiClient.Net; using Archipelago.MultiClient.Net.BounceFeatures.DeathLink; using Archipelago.MultiClient.Net.Enums; using Archipelago.MultiClient.Net.Helpers; using Archipelago.MultiClient.Net.MessageLog.Messages; using Archipelago.MultiClient.Net.MessageLog.Parts; using Archipelago.MultiClient.Net.Models; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Newtonsoft.Json.Linq; using PeaksOfArchipelago.Assets; using PeaksOfArchipelago.CabinHandlers; using PeaksOfArchipelago.Extensions; using PeaksOfArchipelago.GameData; using PeaksOfArchipelago.MonoBehaviours; using PeaksOfArchipelago.Session; using PeaksOfArchipelago.Traps; using PeaksOfArchipelago.UI; using Rewired; using UnityEngine; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("com.c0der23.PeaksOfArchipelago")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("2.2.1+6832846bbcf8eb30c38874dcc366f00060ffbc81")] [assembly: AssemblyProduct("Peaks Of Archipelago")] [assembly: AssemblyTitle("com.c0der23.PeaksOfArchipelago")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : 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] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Archipelago.MultiClient.Net { [AttributeUsage(AttributeTargets.Field, Inherited = false, AllowMultiple = false)] internal sealed class DataStoragePropertyAttribute : Attribute { public string? SessionVariable { get; } public Scope Scope { get; } public string Key { get; } public DataStoragePropertyAttribute(string sessionVariable, Scope scope, string key) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) SessionVariable = sessionVariable; Scope = scope; Key = key; } public DataStoragePropertyAttribute(string sessionVariable, string key) : this(sessionVariable, (Scope)0, key) { } } } namespace PeaksOfArchipelago { [BepInPlugin("com.c0der23.PeaksOfArchipelago", "Peaks Of Archipelago", "2.2.1")] public class PeaksOfArchipelago : BaseUnityPlugin { public enum PlayerState { InMainMenu, InCabin, InPeak } internal static ManualLogSource Logger; public static UIManager ui; private Harmony harmony; private Connection connection; public ConfigEntry Username; public ConfigEntry ServerIP; public ConfigEntry Password; public bool hasDLCInstalled; public ConfigEntry hasSeenProgressScreenTutorial; public static PeaksOfArchipelago Instance { get; private set; } public static PlayerState playerState { get; private set; } public event EventHandler OnEnterCabin; public event EventHandler OnExitCabin; public void Awake() { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown Username = ((BaseUnityPlugin)this).Config.Bind("Session", "Username", "", "The last username used to connect to an Archipelago session."); ServerIP = ((BaseUnityPlugin)this).Config.Bind("Session", "ServerIP", "", "The last server IP used to connect to an Archipelago session."); Password = ((BaseUnityPlugin)this).Config.Bind("Session", "Password", "", "The last password used to connect to an Archipelago session."); hasSeenProgressScreenTutorial = ((BaseUnityPlugin)this).Config.Bind("HasSeenProgressScreenTutorial", "Misc", false, "Whether the player has seen the progress screen tutorial or not."); Instance = this; Logger = ((BaseUnityPlugin)this).Logger; PeaksOfAssets.LoadAssets(); harmony = new Harmony("com.c0der23.PeaksOfArchipelago_Patcher"); try { Logger.LogInfo((object)"Patching..."); harmony.PatchAll(); Logger.LogInfo((object)"Patch complete!"); } catch (Exception arg) { Logger.LogError((object)$"Error during patching: {arg}"); } ui = new UIManager(); SceneManager.sceneLoaded += OnSceneLoad; Logger.LogMessage((object)"Plugin com.c0der23.PeaksOfArchipelago is loaded!"); } public void OnSceneLoad(Scene scene, LoadSceneMode loadSceneMode) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 if ((int)loadSceneMode == 1) { Logger.LogInfo((object)"Scene loaded in additive mode, might want to disable this"); } if (connection == null && ((Scene)(ref scene)).buildIndex == 0) { UIManager.CreateLoginUI(AttemptLogin); } Logger.LogInfo((object)$"Loaded scene index: {((Scene)(ref scene)).buildIndex}, named: {((Scene)(ref scene)).name}"); if (connection == null && ((Scene)(ref scene)).buildIndex != 0) { throw new Exception("How tf did you enter the game without connecting??"); } ui.OnSceneLoaded(connection); switch (((Scene)(ref scene)).buildIndex) { case 0: playerState = PlayerState.InMainMenu; this.OnExitCabin?.Invoke(this, EventArgs.Empty); break; case 1: playerState = PlayerState.InCabin; this.OnEnterCabin?.Invoke(this, Cabins.Cabin); break; case 37: playerState = PlayerState.InCabin; this.OnEnterCabin?.Invoke(this, Cabins.CabinExpert); break; case 67: playerState = PlayerState.InCabin; this.OnEnterCabin?.Invoke(this, Cabins.CabinAlps); break; default: playerState = PlayerState.InPeak; this.OnExitCabin?.Invoke(this, EventArgs.Empty); break; } } internal void OnConnectionSuccesful(SessionSettings settings) { CheckGameVersion val = Object.FindObjectOfType(); if ((Object)(object)val == (Object)null) { Logger.LogError((object)"Couldn't find version checker object in scene!"); } else if (val.CheckGOGDLCInstall() || val.CheckDLCInstall()) { hasDLCInstalled = true; Logger.LogInfo((object)"DLC detected!"); } ui.SetDLCWarning(!hasDLCInstalled && settings.enableDLC); } public void SaveUserCredentials(string username, string uri, string password) { Username.Value = username; ServerIP.Value = uri; Password.Value = password; ((BaseUnityPlugin)this).Config.Save(); } private async Task AttemptLogin(string username, string ip, string password) { Logger.LogInfo((object)"creating session"); connection = new Connection(); Logger.LogInfo((object)"Session Created"); return await connection.ConnectAndLogin(username, ip, password); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "com.c0der23.PeaksOfArchipelago"; public const string PLUGIN_NAME = "Peaks Of Archipelago"; public const string PLUGIN_VERSION = "2.2.1"; } } namespace PeaksOfArchipelago.UI { internal class LoginUI { private InputField usernameField; private InputField ipField; private InputField passwordField; private Text statusText; private Button connectButton; private GameObject panel; private Func> attemptLogin; private bool isConnecting; public void CreateLoginUI(Func> attemptLogin) { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown GameObject val = GameObject.Find("InGameMenuObj_DisableMe"); if (!((Object)(object)val == (Object)null)) { this.attemptLogin = attemptLogin; panel = Object.Instantiate(PeaksOfAssets.LoginScreen, val.transform); Transform child = panel.transform.GetChild(0); usernameField = ((Component)child.GetChild(0)).GetComponent(); ipField = ((Component)child.GetChild(1)).GetComponent(); passwordField = ((Component)child.GetChild(2)).GetComponent(); statusText = ((Component)child.GetChild(3).GetChild(0)).GetComponent(); connectButton = ((Component)child.GetChild(4)).GetComponent