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 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.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.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.0.3.0")] [assembly: AssemblyInformationalVersion("0.0.3+9d45e0ac44d8fd716bd08e335980dea0d3876466")] [assembly: AssemblyProduct("Hot Lava Archipelago Plugin")] [assembly: AssemblyTitle("HotLavaArchipelagoPlugin")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.3.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] [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; } } } internal sealed class ConfigurationManagerAttributes { public delegate void CustomHotkeyDrawerFunc(ConfigEntryBase setting, ref bool isCurrentlyAcceptingInput); public bool? ShowRangeAsPercent; public Action CustomDrawer; public CustomHotkeyDrawerFunc CustomHotkeyDrawer; public bool? Browsable; public string Category; public object DefaultValue; public bool? HideDefaultButton; public bool? HideSettingName; public string Description; public string DispName; public int? Order; public bool? ReadOnly; public bool? IsAdvanced; public Func ObjToStr; public Func StrToObj; } 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.0.3")] 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, new object[1] { new ConfigurationManagerAttributes { Order = 4 } })); ConfigArchipelagoPort = ((BaseUnityPlugin)this).Config.Bind("Archipelago", "Port", 38281, new ConfigDescription("The port for the Archipelago server", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 3 } })); ConfigArchipelagoPlayerName = ((BaseUnityPlugin)this).Config.Bind("Archipelago", "PlayerName", "Player", new ConfigDescription("Your slot name in your YAML file", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 2 } })); ConfigArchipelagoPassword = ((BaseUnityPlugin)this).Config.Bind("Archipelago", "Password", string.Empty, new ConfigDescription("The password for connecting to the server, if one is required", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 1 } })); } } 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.0.3"; } } namespace HotLavaArchipelagoPlugin.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { resourceMan = new ResourceManager("HotLavaArchipelagoPlugin.Properties.Resources", typeof(Resources).Assembly); } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static byte[] ArchipelagoLogo => (byte[])ResourceManager.GetObject("ArchipelagoLogo", resourceCulture); internal static byte[] BoostJump => (byte[])ResourceManager.GetObject("BoostJump", resourceCulture); internal static byte[] Climb => (byte[])ResourceManager.GetObject("Climb", resourceCulture); internal static byte[] Crouch => (byte[])ResourceManager.GetObject("Crouch", resourceCulture); internal static byte[] DoubleJump => (byte[])ResourceManager.GetObject("DoubleJump", resourceCulture); internal static byte[] ForceField => (byte[])ResourceManager.GetObject("ForceField", resourceCulture); internal static byte[] Grab => (byte[])ResourceManager.GetObject("Grab", resourceCulture); internal static byte[] Jetpack => (byte[])ResourceManager.GetObject("Jetpack", resourceCulture); internal static byte[] Pogo => (byte[])ResourceManager.GetObject("Pogo", resourceCulture); internal static byte[] SlideJump => (byte[])ResourceManager.GetObject("SlideJump", resourceCulture); internal static byte[] Surf => (byte[])ResourceManager.GetObject("Surf", resourceCulture); internal static byte[] Swing => (byte[])ResourceManager.GetObject("Swing", resourceCulture); internal static byte[] TinyToy => (byte[])ResourceManager.GetObject("TinyToy", resourceCulture); internal static byte[] VaultJump => (byte[])ResourceManager.GetObject("VaultJump", resourceCulture); internal static byte[] WallJump => (byte[])ResourceManager.GetObject("WallJump", resourceCulture); internal static byte[] XPShard => (byte[])ResourceManager.GetObject("XPShard", resourceCulture); internal Resources() { } } } namespace HotLavaArchipelagoPlugin.Patches.Unlockables { [HarmonyPatch(typeof(Statistics))] internal class StatisticsPatches { [HarmonyPatch("UnlockUnlockable")] [HarmonyPostfix] public static void UnlockUnlockable_PostFix(Unlockable unlockable, bool display) { Plugin.Logger.LogInfo((object)("Unlocking: " + ((object)unlockable).ToString())); if (!Multiworld.Connected) { return; } Location unlockableLocation = Locations.GetUnlockableLocation(unlockable.m_Key.m_Value); if (unlockableLocation != null && !Multiworld.HasCheckedLocation(unlockableLocation)) { Plugin.Logger.LogInfo((object)("Sending AP Check for: " + unlockableLocation.LocationID)); Multiworld.Instance.SendLocationCheck(unlockableLocation.LocationID); ScoutedItemInfo itemForLocation = Multiworld.Instance.GetItemForLocation(unlockableLocation.LocationID); if (itemForLocation != null) { Plugin.Logger.LogInfo((object)("Queueing scouted itme: " + ((ItemInfo)itemForLocation).ItemDisplayName)); Multiworld.Instance.QueueAwardItem(itemForLocation); } } } [HarmonyPatch("HasUnlockedUnlockable")] [HarmonyPrefix] public static bool HasUnlockedUnlockable_PreFix(Unlockable unlockable, ref bool __result) { if (Multiworld.Connected) { Location unlockableLocation = Locations.GetUnlockableLocation(unlockable.m_Key.m_Value); if (unlockableLocation != null) { __result = Multiworld.HasCheckedLocation(unlockableLocation); return false; } } return true; } } [HarmonyPatch(typeof(Unlockable))] internal class UnlockablePatches { } } namespace HotLavaArchipelagoPlugin.Patches.UI { [HarmonyPatch(typeof(AwardsScreen))] internal class AwardsScreenPatches { [HarmonyPatch("DisplayAwards_Internal")] [HarmonyPrefix] public static bool DisplayAwards_Internal_Prefix(AwardsScreen __instance) { if (Multiworld.Connected) { try { ScoutedItemInfo val = Multiworld.Instance.PopAwardsQueue(); if (val == null) { typeof(AwardsScreen).GetMethod("NoAward", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(__instance, Array.Empty()); return false; } string value = "Found Item"; RewardVisualization rewardVisualization = null; if (val.IsReceiverRelatedToActivePlayer) { Item item = Items.GetItem(((ItemInfo)val).ItemId); if (item != null) { rewardVisualization = item.GetRewardVisualization(__instance.m_GiftDropData); } } if (rewardVisualization == null) { rewardVisualization = RewardVisualizationFactory.GetArchipelagoReward(__instance.m_GiftDropData); } rewardVisualization.m_ScratchDescription = ((ItemInfo)val).ItemDisplayName + " for " + val.Player.Name + " (" + ((ItemInfo)val).ItemGame + ")"; typeof(AwardsScreen).GetField("m_UnlockTitle", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, value); typeof(AwardsScreen).GetMethod("Award", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(__instance, new object[1] { (Func)(() => rewardVisualization) }); return false; } catch (Exception ex) { Plugin.Logger.LogError((object)ex.ToString()); return false; } } return true; } } [HarmonyPatch(typeof(CharacterSelectIcon))] internal class CharacterSelectIconPatches { [HarmonyPatch("Set")] [HarmonyPostfix] public static void Set_Postfix(CharacterSelectIcon __instance) { CharacterSelectIcon __instance2 = __instance; if (!Multiworld.Connected) { return; } CharacterItem characterItem = Items.CharacterItems.FirstOrDefault((CharacterItem c) => c.CharacterId == __instance2.m_Character.CharacterEnum); if (characterItem != null) { bool flag = Multiworld.HasReceivedItem(characterItem); if (!flag) { __instance2.m_LockedText.text = "LOCKED"; __instance2.m_LockedText.fontSize = 12; } __instance2.m_Locked.gameObject.SetActive(!flag); ((Selectable)((Component)__instance2).GetComponent