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.Linq; using System.Reflection; using System.Reflection.Emit; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; 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 HotLavaArchipelagoPlugin.Archipelago; using HotLavaArchipelagoPlugin.Archipelago.Data; using HotLavaArchipelagoPlugin.Archipelago.Models.Items; using HotLavaArchipelagoPlugin.Archipelago.Models.Items.Cosmetic; using HotLavaArchipelagoPlugin.Archipelago.Models.Items.Filler; using HotLavaArchipelagoPlugin.Archipelago.Models.Items.Progression; using HotLavaArchipelagoPlugin.Archipelago.Models.Items.Traps; using HotLavaArchipelagoPlugin.Archipelago.Models.Locations; using HotLavaArchipelagoPlugin.Archipelago.Models.Options; using HotLavaArchipelagoPlugin.Enums; using HotLavaArchipelagoPlugin.Extensions; using HotLavaArchipelagoPlugin.Factories; using HotLavaArchipelagoPlugin.GameData; using HotLavaArchipelagoPlugin.Gameplay.Modifiers; using HotLavaArchipelagoPlugin.Helpers; using HotLavaArchipelagoPlugin.Models.Game; using HotLavaArchipelagoPlugin.Properties; using HotLavaArchipelagoPlugin.UI; using Klei.HotLava; using Klei.HotLava.Audio; using Klei.HotLava.Character; using Klei.HotLava.Character.Modifiers; using Klei.HotLava.Character.Progression; using Klei.HotLava.Enums; using Klei.HotLava.Game; using Klei.HotLava.Gameplay; using Klei.HotLava.Intro; using Klei.HotLava.Inventory; using Klei.HotLava.Online; using Klei.HotLava.Profiles; using Klei.HotLava.Rewards; using Klei.HotLava.Settings; using Klei.HotLava.UI; using Klei.HotLava.Unlockables; using Klei.L10n; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using STRINGS; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("HotLavaArchipelagoPlugin")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0+8c02cb993038e6a7c976338c163c86e3c0d6c07f")] [assembly: AssemblyProduct("Hot Lava Archipelago Plugin")] [assembly: AssemblyTitle("HotLavaArchipelagoPlugin")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [CompilerGenerated] internal sealed class <>z__ReadOnlyArray : IEnumerable, ICollection, IList, IEnumerable, IReadOnlyCollection, IReadOnlyList, ICollection, IList { int ICollection.Count => _items.Length; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection.Count => _items.Length; T IReadOnlyList.this[int index] => _items[index]; int ICollection.Count => _items.Length; bool ICollection.IsReadOnly => true; T IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } public <>z__ReadOnlyArray(T[] items) { _items = items; } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.CopyTo(Array array, int index) { ((ICollection)_items).CopyTo(array, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return ((IList)_items).Contains(value); } int IList.IndexOf(object value) { return ((IList)_items).IndexOf(value); } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.Add(T item) { throw new NotSupportedException(); } void ICollection.Clear() { throw new NotSupportedException(); } bool ICollection.Contains(T item) { return ((ICollection)_items).Contains(item); } void ICollection.CopyTo(T[] array, int arrayIndex) { ((ICollection)_items).CopyTo(array, arrayIndex); } bool ICollection.Remove(T item) { throw new NotSupportedException(); } int IList.IndexOf(T item) { return ((IList)_items).IndexOf(item); } void IList.Insert(int index, T item) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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.Property | 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 HotLavaArchipelagoPlugin { [BepInPlugin("HotLavaArchipelagoPlugin", "Hot Lava Archipelago Plugin", "0.1.0")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Logger = new ManualLogSource(string.Empty); public static ConfigEntry ConfigArchipelagoHost; public static ConfigEntry ConfigArchipelagoPort; public static ConfigEntry ConfigArchipelagoPlayerName; public static ConfigEntry ConfigArchipelagoPassword; internal async Task Awake() { Logger = ((BaseUnityPlugin)this).Logger; Logger.LogInfo((object)"Plugin HotLavaArchipelagoPlugin is loaded!"); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); Logger.LogInfo((object)"Harmony patches applied!"); ConfigArchipelagoHost = ((BaseUnityPlugin)this).Config.Bind("Archipelago", "Host", "archipelago.gg", new ConfigDescription("The host name of the Archipelago server", (AcceptableValueBase)null, Array.Empty())); ConfigArchipelagoPort = ((BaseUnityPlugin)this).Config.Bind("Archipelago", "Port", 38281, new ConfigDescription("The port for the Archipelago server", (AcceptableValueBase)null, Array.Empty())); ConfigArchipelagoPlayerName = ((BaseUnityPlugin)this).Config.Bind("Archipelago", "PlayerName", "Player", new ConfigDescription("Your slot name in your YAML file", (AcceptableValueBase)null, Array.Empty())); ConfigArchipelagoPassword = ((BaseUnityPlugin)this).Config.Bind("Archipelago", "Password", string.Empty, new ConfigDescription("The password for connecting to the server, if one is required", (AcceptableValueBase)null, Array.Empty())); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "HotLavaArchipelagoPlugin"; public const string PLUGIN_NAME = "Hot Lava Archipelago Plugin"; public const string PLUGIN_VERSION = "0.1.0"; } } namespace HotLavaArchipelagoPlugin.UI { internal class ModsMenu : MenuTransition { public InputField HostField; public InputField PortField; public InputField PlayerNameField; public InputField PasswordField; public Text StatusText; public Button ConnectButton; public Text ConnectButtonText; public Button BackButton; private bool _isBusy; protected override void OnDisplay() { ((MenuTransition)this).OnDisplay(); RefreshFields(); } private void RefreshFields() { HostField.text = Plugin.ConfigArchipelagoHost.Value; PortField.text = Plugin.ConfigArchipelagoPort.Value.ToString(); PlayerNameField.text = Plugin.ConfigArchipelagoPlayerName.Value; PasswordField.text = Plugin.ConfigArchipelagoPassword.Value; UpdateStatus(); } private void UpdateStatus() { if (_isBusy) { StatusText.text = (Multiworld.Connected ? "Disconnecting..." : "Connecting..."); } else if (Multiworld.Connected) { StatusText.text = "Connected as " + Multiworld.Instance.PlayerName; } else { StatusText.text = "Not connected"; } ConnectButtonText.text = (Multiworld.Connected ? "Disconnect" : "Connect"); ((Selectable)ConnectButton).interactable = !_isBusy; } public void OnConnectClicked() { if (_isBusy) { return; } if (Multiworld.Connected) { _isBusy = true; UpdateStatus(); Task.Run(async delegate { await Multiworld.Disconnect(); ThreadingHelper.Instance.StartSyncInvoke((Action)delegate { _isBusy = false; UpdateStatus(); }); }); return; } string host = HostField.text.Trim(); string playerName = PlayerNameField.text.Trim(); string password = PasswordField.text; if (string.IsNullOrEmpty(host) || string.IsNullOrEmpty(playerName)) { StatusText.text = "Host and player name are required"; return; } if (!int.TryParse(PortField.text.Trim(), out var port)) { StatusText.text = "Port must be a number"; return; } Plugin.ConfigArchipelagoHost.Value = host; Plugin.ConfigArchipelagoPort.Value = port; Plugin.ConfigArchipelagoPlayerName.Value = playerName; Plugin.ConfigArchipelagoPassword.Value = password; ((ConfigEntryBase)Plugin.ConfigArchipelagoHost).ConfigFile.Save(); _isBusy = true; UpdateStatus(); Task.Run(async delegate { await Multiworld.ConnectDirect(host, port, playerName, string.IsNullOrEmpty(password) ? null : password); ThreadingHelper.Instance.StartSyncInvoke((Action)delegate { _isBusy = false; UpdateStatus(); }); }); } public void OnBackClicked() { ((MenuTransition)this).ReturnTranstion(); } } internal static class ModsMenuFactory { private const string ButtonName = "ModsButton"; private const string HamburgerButtonName = "ArchipelagoHamburgerButton"; public static void InstallModsButton(PauseMenu pauseMenu) { //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) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Expected O, but got Unknown //IL_014a: 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_0380: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Expected O, but got Unknown Scene activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; Plugin.Logger.LogInfo((object)("[Archipelago] InstallModsButton called. scene='" + name + "'")); if ((Object)(object)FindDescendant(((Component)pauseMenu).transform, "ModsButton") != (Object)null) { Plugin.Logger.LogInfo((object)"[Archipelago] Mods button already present on this PauseMenu instance; skipping install."); return; } Button spectateButton = pauseMenu.m_SpectateButton; if ((Object)(object)spectateButton == (Object)null) { Plugin.Logger.LogWarning((object)"[Archipelago] Could not find a button template (m_SpectateButton is null) for the Mods menu; skipping."); return; } Text componentInChildren = ((Component)spectateButton).GetComponentInChildren(true); Font font = (((Object)(object)componentInChildren != (Object)null) ? componentInChildren.font : Resources.GetBuiltinResource("LegacyRuntime.ttf")); ModsMenu modsMenu = BuildModsPanel(((Component)pauseMenu).transform, font); Button val = Object.Instantiate