using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Threading; 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.Models; using Archipelago.MultiClient.Net.Packets; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Newtonsoft.Json.Linq; using Peak.AP; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.TextCore; using UnityEngine.UI; using YamlDotNet.Serialization; using YamlDotNet.Serialization.NamingConventions; using Zorro.ControllerSupport; using Zorro.Core; using Zorro.Settings; using Zorro.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Zorro.UI.Runtime")] [assembly: AssemblyCompany("PeakArchipelago")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Archipelago integration for PEAK")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+cb896f3a393836f9e8c04c05270270f665b9e041")] [assembly: AssemblyProduct("PeakArchipelago")] [assembly: AssemblyTitle("PeakArchipelago")] [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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace PeakArchipelago { [HarmonyPatch(typeof(LootData), "PopulateLootData")] public static class LootTablePatch { private static ManualLogSource _log => PeakArchipelagoPlugin._instance?._log; private static void Postfix() { //IL_009d: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) try { if (LootData.AllSpawnWeightData == null) { ManualLogSource log = _log; if (log != null) { log.LogWarning((object)"[PeakPelago] LootData.AllSpawnWeightData is null"); } return; } Dictionary dictionary = new Dictionary { { 70, 1 } }; Dictionary dictionary2 = new Dictionary { { 25, 1 }, { 67, 1 }, { 16, 1 } }; SpawnPool[] array = (SpawnPool[])(object)new SpawnPool[2] { (SpawnPool)131072, (SpawnPool)65536 }; SpawnPool[] array2 = new SpawnPool[7]; RuntimeHelpers.InitializeArray(array2, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); SpawnPool[] array3 = (SpawnPool[])(object)array2; foreach (KeyValuePair item in dictionary2) { SpawnPool[] array4 = array; foreach (SpawnPool key in array4) { if (LootData.AllSpawnWeightData.ContainsKey(key) && (!LootData.AllSpawnWeightData[key].ContainsKey(item.Key) || LootData.AllSpawnWeightData[key][item.Key] == 0)) { LootData.AllSpawnWeightData[key][item.Key] = item.Value; } } } foreach (KeyValuePair item2 in dictionary) { SpawnPool[] array4 = array3; foreach (SpawnPool key2 in array4) { if (LootData.AllSpawnWeightData.ContainsKey(key2) && (!LootData.AllSpawnWeightData[key2].ContainsKey(item2.Key) || LootData.AllSpawnWeightData[key2][item2.Key] == 0)) { LootData.AllSpawnWeightData[key2][item2.Key] = item2.Value; } } } OriginalLootWeights.CaptureOriginalWeights(); UnlockedItemsManager.CheckDeferredRefresh(); } catch (Exception ex) { ManualLogSource log2 = _log; if (log2 != null) { log2.LogError((object)("[PeakPelago] Error modifying loot tables: " + ex.Message)); } } } } [HarmonyPatch(typeof(LootData), "GetRandomItems")] public static class GetRandomItemsPatch { private static bool Prefix(SpawnPool spawnPool, int count, ref List __result) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (LootData.AllSpawnWeightData == null || !LootData.AllSpawnWeightData.ContainsKey(spawnPool) || LootData.AllSpawnWeightData[spawnPool].Count == 0) { __result = new List(); return false; } return true; } } [HarmonyPatch(typeof(LootData), "GetRandomItem")] public static class GetRandomItemPatch { private static bool Prefix(SpawnPool spawnPool, ref GameObject __result) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (LootData.AllSpawnWeightData == null || !LootData.AllSpawnWeightData.ContainsKey(spawnPool) || LootData.AllSpawnWeightData[spawnPool].Count == 0) { __result = null; return false; } return true; } } [HarmonyPatch(typeof(Item), "IsValidToSpawn")] public static class ItemIsValidToSpawnPatch { private static bool Prefix(ref bool __result) { if (PeakArchipelagoPlugin._instance?.Session != null) { __result = true; return false; } return true; } } [HarmonyPatch(typeof(LootData), "GetRandomItem")] public static class LootDataGetRandomItemPatch { public static bool Prefix(SpawnPool spawnPool, ref GameObject __result) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (LootData.AllSpawnWeightData == null) { LootData.PopulateLootData(); } if (!LootData.AllSpawnWeightData.TryGetValue(spawnPool, out var value)) { __result = null; return false; } if (value.Where((KeyValuePair kvp) => kvp.Value > 0).ToList().Count == 0) { __result = null; return false; } return true; } } [HarmonyPatch(typeof(PeakSequence), "OnDisable")] public static class PeakSequencePatch { private static void Postfix() { Character.forceWin = false; } } } namespace Peak.AP { public class BreathLinkService { private readonly ManualLogSource _log; private ArchipelagoSession _session; private bool _isEnabled; private int _connectionId; private ArchipelagoNotificationManager _notifications; private DateTime _lastBreathSent = DateTime.MinValue; private DateTime _lastBreathReceived = DateTime.MinValue; private bool _isDepleting; private const float COOLDOWN_SECONDS = 10f; public BreathLinkService(ManualLogSource log, ArchipelagoNotificationManager notifications) { _log = log; _connectionId = Random.Range(int.MinValue, int.MaxValue); _notifications = notifications; } public void Initialize(ArchipelagoSession session, bool enabled) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown _session = session; _isEnabled = enabled; if (_isEnabled && _session != null) { _session.Socket.PacketReceived += new PacketReceivedHandler(OnPacketReceived); _log.LogInfo((object)$"[PeakPelago] Breath Link service initialized (Connection ID: {_connectionId})"); } } public void SetEnabled(bool enabled) { _isEnabled = enabled; _log.LogInfo((object)("[PeakPelago] Breath Link " + (enabled ? "enabled" : "disabled"))); } public bool IsEnabled() { return _isEnabled; } public bool IsDepleting() { return _isDepleting; } public void SetDepleting(bool value) { _isDepleting = value; } public void SendBreathLink(string source) { //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown if (_session == null || !_isEnabled) { return; } try { if (DateTime.Now - _lastBreathSent < TimeSpan.FromSeconds(10.0)) { _log.LogDebug((object)"[PeakPelago] Breath Link throttled - too recent"); return; } if (_isDepleting) { _log.LogDebug((object)"[PeakPelago] Stamina depletion was caused by BreathLink, not sending another"); return; } _lastBreathSent = DateTime.Now; Dictionary data = new Dictionary { { "time", JToken.FromObject((object)DateTimeOffset.UtcNow.ToUnixTimeSeconds()) }, { "source", JToken.FromObject((object)_connectionId) }, { "cause", JToken.FromObject((object)source) } }; BouncePacket val = new BouncePacket { Tags = new List { "BreathLink" }, Data = data }; _session.Socket.SendPacket((ArchipelagoPacketBase)(object)val); _log.LogInfo((object)("[PeakPelago] Breath Link sent: " + source)); _notifications.ShowDeathLink("BreathLink", source); } catch (Exception ex) { _log.LogError((object)("[PeakPelago] Failed to send Breath Link: " + ex.Message)); } } private void OnPacketReceived(ArchipelagoPacketBase packet) { try { BouncePacket val = (BouncePacket)(object)((packet is BouncePacket) ? packet : null); if (val != null && val.Tags != null && val.Tags.Contains("BreathLink") && _isEnabled) { HandleBreathLinkReceived(val.Data); } } catch (Exception ex) { _log.LogError((object)("[PeakPelago] Error handling Breath Link packet: " + ex.Message)); } } private void HandleBreathLinkReceived(Dictionary data) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) try { Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name.StartsWith("Level_")) { if (data.ContainsKey("source") && data["source"].ToObject() == _connectionId) { _log.LogDebug((object)"[PeakPelago] Ignoring own Breath Link"); return; } if (DateTime.Now - _lastBreathReceived < TimeSpan.FromSeconds(10.0)) { _log.LogDebug((object)"[PeakPelago] Breath Link receive throttled - too recent"); return; } _lastBreathReceived = DateTime.Now; string text = (data.ContainsKey("cause") ? data["cause"].ToObject() : "Unknown"); _log.LogInfo((object)("[PeakPelago] Breath Link received from: " + text)); _notifications.ShowDeathLink("BreathLink: Out of breath!", text); DepleteAllPlayersStamina(); } } catch (Exception ex) { _log.LogError((object)("[PeakPelago] Error handling Breath Link: " + ex.Message)); } } private void DepleteAllPlayersStamina() { _isDepleting = true; try { if ((Object)(object)PeakArchipelagoPlugin._instance?.PhotonView != (Object)null && PhotonNetwork.IsConnected) { PeakArchipelagoPlugin._instance.PhotonView.RPC("BreathLinkDepleteStaminaRPC", (RpcTarget)0, Array.Empty()); } else { DepleteLocalStamina(); } } catch (Exception ex) { _log.LogError((object)("[PeakPelago] Error depleting stamina: " + ex.Message)); _isDepleting = false; } } public void DepleteLocalStamina() { try { foreach (Character allCharacter in Character.AllCharacters) { if ((Object)(object)allCharacter != (Object)null && !allCharacter.data.dead && !allCharacter.data.fullyPassedOut) { allCharacter.data.currentStamina = 0f; allCharacter.data.extraStamina = 0f; _log.LogInfo((object)("[PeakPelago] Breath Link: Depleted stamina for " + allCharacter.characterName)); } } } catch (Exception ex) { _log.LogError((object)("[PeakPelago] Error depleting local stamina: " + ex.Message)); } finally { _isDepleting = false; } } public void Cleanup() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown if (_session != null) { _session.Socket.PacketReceived -= new PacketReceivedHandler(OnPacketReceived); } } } public class EnergyLinkService { private static class EnergyLinkPatches { [HarmonyPatch(typeof(GUIManager), "UpdateItemPrompts")] public static class GUIManagerUpdateItemPromptsPatches { private static void Postfix(GUIManager __instance) { try { if (_instance != null) { _instance.UpdateTertiaryPrompt(__instance); } } catch (Exception ex) { if (_instance != null) { _instance._log.LogError((object)("[PeakPelago] GUIManager.UpdateItemPrompts patch error: " + ex.Message)); } } } } [HarmonyPatch(typeof(Item), "Update")] public static class ItemUpdatePatch { private static void Postfix(Item __instance) { try { if (_instance != null) { _instance.HandleItemConversionInput(__instance); } } catch (Exception ex) { if (_instance != null) { _instance._log.LogError((object)("[PeakPelago] Item.Update patch error: " + ex.Message)); } } } } private static EnergyLinkService _instance; public static void SetInstance(EnergyLinkService instance) { _instance = instance; } } private readonly ManualLogSource _log; private ArchipelagoSession _session; private bool _isEnabled; private string _teamName; private IDataStorageHelper _dataStorageHelper; private ArchipelagoNotificationManager _notifications; private Harmony _harmony; private int _currentEnergy; private int _maxEnergy; private string _energyKey; private GameObject _tertiaryPromptObject; private TextMeshProUGUI _tertiaryPromptText; private float _lastConversionTime; private const float CONVERSION_COOLDOWN = 0.5f; private float _conversionProgress; private const float CONVERSION_TIME = 1.5f; private Item _convertingItem; private PeakArchipelagoPlugin _plugin; public EnergyLinkService(ManualLogSource log, ArchipelagoNotificationManager notifications) { _log = log; _notifications = notifications; } public void Initialize(ArchipelagoSession session, bool enabled, string teamName, PeakArchipelagoPlugin plugin = null) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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 _session = session; _isEnabled = enabled; _teamName = teamName; _plugin = plugin; _energyKey = "EnergyLink" + _teamName; if (!_isEnabled) { return; } try { if (_session != null) { _dataStorageHelper = _session.DataStorage; DataStorageElement obj = _dataStorageHelper[(Scope)0, _energyKey]; obj.OnValueChanged += new DataStorageUpdatedHandler(HandleEnergyChanged); obj.Initialize(JToken.op_Implicit(0)); _log.LogInfo((object)("[PeakPelago] EnergyLink service initialized with session for team: " + _teamName + " (key: " + _energyKey + ")")); RefreshEnergyState(); } else { _log.LogInfo((object)"[PeakPelago] EnergyLink enabled for CLIENT - will use RPC to sync"); } _harmony = new Harmony("com.mickemoose.peak.ap.energylink"); _harmony.PatchAll(typeof(EnergyLinkPatches)); EnergyLinkPatches.SetInstance(this); } catch (Exception ex) { _log.LogError((object)("[PeakPelago] Failed to initialize EnergyLink: " + ex.Message)); } } private void HandleEnergyChanged(JToken originalValue, JToken newValue, Dictionary additionalArguments) { try { _currentEnergy = newValue.ToObject(); _log.LogInfo((object)$"[PeakPelago] EnergyLink updated from server: {_currentEnergy}"); BroadcastEnergyUpdate(); } catch (Exception ex) { _log.LogError((object)("[PeakPelago] Error handling EnergyLink change: " + ex.Message)); } } public bool IsEnabled() { return _isEnabled; } public void SetEnabled(bool enabled) { _isEnabled = enabled; _log.LogInfo((object)("[PeakPelago] EnergyLink " + (enabled ? "enabled" : "disabled"))); } public void RefreshEnergyState() { if (_session == null || !_isEnabled) { return; } try { DataStorageElement val = _dataStorageHelper[(Scope)0, _energyKey]; _currentEnergy = val.To(); _log.LogDebug((object)$"[PeakPelago] EnergyLink state: {_currentEnergy}"); } catch (Exception ex) { _log.LogError((object)("[PeakPelago] Failed to refresh EnergyLink state: " + ex.Message)); } } public void ContributeEnergy(string itemName, int amount) { if (!_isEnabled || amount <= 0) { return; } _log.LogInfo((object)$"[PeakPelago] ContributeEnergy called: {itemName}, {amount} (HasSession: {_session != null})"); if (_session == null) { if ((Object)(object)_plugin != (Object)null && (Object)(object)_plugin.PhotonView != (Object)null && PhotonNetwork.IsConnected) { _log.LogInfo((object)$"[PeakPelago] CLIENT: Requesting host to contribute {amount} J from {itemName}"); _plugin.PhotonView.RPC("RPC_ContributeEnergy", (RpcTarget)2, new object[2] { itemName, amount }); double num = (double)amount / 1000000.0; if (num >= 1.0) { if (num % 1.0 == 0.0) { _notifications.ShowEnergyLinkNotification($"EnergyLink: Contributed {num:F0} MJ from {itemName}"); } else { _notifications.ShowEnergyLinkNotification($"EnergyLink: Contributed {num:F2} MJ from {itemName}"); } } else { double num2 = (double)amount / 1000.0; _notifications.ShowEnergyLinkNotification($"EnergyLink: Contributed {num2:F0} kJ from {itemName}"); } } else { _log.LogWarning((object)"[PeakPelago] CLIENT: Cannot contribute energy - not connected to host"); } return; } try { IDataStorageHelper dataStorageHelper = _dataStorageHelper; string energyKey = _energyKey; dataStorageHelper[(Scope)0, energyKey] = dataStorageHelper[(Scope)0, energyKey] + amount; _log.LogInfo((object)$"[PeakPelago] HOST: Contributed {amount} J from {itemName} to EnergyLink"); double num3 = (double)amount / 1000000.0; if (num3 >= 1.0) { if (num3 % 1.0 == 0.0) { _notifications.ShowEnergyLinkNotification($"EnergyLink: Contributed {num3:F0} MJ from {itemName}"); } else { _notifications.ShowEnergyLinkNotification($"EnergyLink: Contributed {num3:F2} MJ from {itemName}"); } } else { double num4 = (double)amount / 1000.0; _notifications.ShowEnergyLinkNotification($"EnergyLink: Contributed {num4:F0} kJ from {itemName}"); } } catch (Exception ex) { _log.LogError((object)("[PeakPelago] Failed to contribute energy: " + ex.Message)); } } public void BroadcastEnergyUpdate() { if ((Object)(object)_plugin != (Object)null && (Object)(object)_plugin.PhotonView != (Object)null && PhotonNetwork.IsConnected) { _plugin.PhotonView.RPC("RPC_UpdateEnergy", (RpcTarget)0, new object[2] { _currentEnergy, 0 }); } } public void UpdateEnergyCache(int current, int max) { _currentEnergy = current; _log.LogInfo((object)$"[PeakPelago] Updated energy cache: {_currentEnergy}"); } private int GetItemEnergyValue(Item item) { if ((Object)(object)item == (Object)null) { return 0; } string text = item.GetName().ToLower(); float num = 30f; string text2 = text; switch (text2) { default: if (text2 == null) { break; } if (!text2.Contains("drink") && !(text2 == "trail mix")) { if (text2 == "napberry") { num = 55f; } else if (text2.Contains("berrynana peel")) { num = 1f; } else if (text2.Contains("berry")) { num = 9f; } else if (!text2.Contains("shroom")) { if (!(text2 == "beehive")) { if (!(text2 == "cooked bird") && !text2.Contains("egg")) { switch (text2) { case "honeycomb": num = 30f; break; case "hot dog": case "marshmallow": num = 29.95f; break; case "half-coconut": num = 3.75f; break; case "coconut": num = 7.5f; break; case "tick": num = 7.5f; break; case "balloon bunch": num = 15f; break; case "balloon": num = 5f; break; case "anti-rope cannon": num = 77.5f; break; case "rescue claw": case "chain launcher": num = 75f; break; case "rope cannon": case "scout cannon": num = 60f; break; case "scout effigy": case "faerie lantern": num = 99.9f; break; case "cursed skull": case "the book of bones": num = 96f; break; case "remedy fungus": case "cure-all": num = 80f; break; case "first aid kit": num = 79.95f; break; case "medicinal root": case "antidote": num = 50f; break; case "fortified milk": num = 49.95f; break; case "blowgun": num = 45f; break; case "portable stove": num = 44.95f; break; case "heat pack": num = 42f; break; case "aloe vera": num = 30f; break; case "sunscreen": num = 29.95f; break; case "bandages": num = 7.5f; break; default: { if (!text2.Contains("fungus")) { switch (text2) { case "magic bean": break; case "ancient idol": num = 300f; goto end_IL_00c3; case "bugle of friendship": case "scoutmaster's bugle": num = 60f; goto end_IL_00c3; case "strange gem": num = 19f; goto end_IL_00c3; case "torn page": num = 10f; goto end_IL_00c3; case "anti-rope spool": case "checkpoint flag": num = 35f; goto end_IL_00c3; case "parasol": case "pirate's compass": num = 33f; goto end_IL_00c3; case "rope spool": case "piton": case "torch": num = 25f; goto end_IL_00c3; case "scroll": num = 8f; goto end_IL_00c3; case "cactus": num = 1f; goto end_IL_00c3; case "snowball": num = 0.5f; goto end_IL_00c3; case "guidebook": case "bugle": num = 2f; goto end_IL_00c3; case "compass": case "flare": num = 1.95f; goto end_IL_00c3; case "bing bong": num = 1.88f; goto end_IL_00c3; case "binoculars": case "lantern": num = 1.5f; goto end_IL_00c3; case "flying disc": num = 1f; goto end_IL_00c3; case "conch": num = 0.2f; goto end_IL_00c3; default: goto end_IL_00c3; } } num = 40f; break; } end_IL_00c3: break; } } else { num = 40f; } } else { num = 60f; } } else { num = 10f; } } else { num = 19.95f; } break; case "pandora's lunchbox": num = 66.6f; break; case "airline food": num = 40f; break; case "big lollipop": case "scout cookies": num = 39.95f; break; case "granola bar": num = 29.95f; break; } return Mathf.RoundToInt(num * 100f) * 10000; } public bool ConsumeEnergy(int amount) { //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_00ad: 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) //IL_00c8: Expected O, but got Unknown if (!_isEnabled || amount <= 0) { return false; } _log.LogInfo((object)$"[PeakPelago] ConsumeEnergy called: {amount} (HasSession: {_session != null})"); if (_session == null) { _log.LogWarning((object)"[PeakPelago] CLIENT: Cannot consume energy directly - must go through host"); return false; } try { if (_currentEnergy < amount) { _log.LogWarning((object)$"[PeakPelago] Not enough energy to consume {amount} (available: {_currentEnergy})"); return false; } DataStorageElement val = _dataStorageHelper[(Scope)0, _energyKey]; val += -amount; val += new OperationSpecification { OperationType = (OperationType)3, Value = JToken.FromObject((object)0) }; _dataStorageHelper[(Scope)0, _energyKey] = val; _log.LogInfo((object)$"[PeakPelago] Consumed {amount} energy from EnergyLink"); double num = (double)amount / 1000000.0; List list = new List { "And through the square window is...", "*anxiety-inducing whirring noises*", "Are you feeling lucky?", "Bing Bong approves!", "Door opening, please stand clear.", "For your health!", "Generator online.", "Get a load of this!", "Gotta spend 'em all!", "Here, catch!", "Here's something to toot your bugle about.", "Initiating surprise in 3... 2... 1.", "It ain't Burger King, but it'll do.", "Mhhh, that's the good stuff.", "Now THIS is Pandora's Box.", "Please don't be cursed...", "Prepare to get bonked.", "Some items for your troubles.", "*slurping noises*", "Surprise! We're doing it now!", "This could be quite explosive...", "What could possibly go wrong?", "What's behind door #1?", "WHAT'S IN THE BOX!?!?", "What's the deal with airline food?", "Where are you getting all these batteries?", "You might just get a new check!" }; List list2 = Character.AllCharacters.Where((Character c) => (Object)(object)c != (Object)null && ((Component)c).gameObject.activeInHierarchy && !c.data.dead && !c.data.fullyPassedOut).ToList(); if (list2.Count >= 2) { list.Add("Let's get you all patched up."); list.Add("Someone's gonna steal it all, I guarantee it."); list.Add($"Watch out, {list2.Count} Scouts are about!"); list.Add("What are y'all gonna get?"); list.Add("You all planning on sharing?"); } else { list.Add("Been farming, have you?"); list.Add("If it's just you, who put these Stores here?"); list.Add("It's dangerous to go alone! Take this."); list.Add("Let's get you patched up."); list.Add("What are you gonna get?"); } _notifications.ShowEnergyLinkNotification($"EnergyLink: Consumed -{num:F0} MJ. {list[Random.Range(0, list.Count)]}"); return true; } catch (Exception ex) { _log.LogError((object)("[PeakPelago] Failed to consume energy: " + ex.Message)); return false; } } public int GetCurrentEnergy() { return _currentEnergy; } public bool HasEnergy(int amount) { return _currentEnergy >= amount; } public int GetMaxEnergy() { return _maxEnergy; } private bool CanConvertItem(Item item) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)item == (Object)null) { return false; } Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name.Contains("Airport")) { return false; } switch (item.GetName().ToLower()) { case "passport": case "scorpion": case "dynamite": case "mandrake": case "king": case "pawn": case "rook": case "bishop": case "knight": case "basketball": case "queen": return false; default: return true; } } private void CreateTertiaryPromptUI(GUIManager guiManager) { //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013e: 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_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: 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_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)_tertiaryPromptObject != (Object)null) { return; } GameObject gameObject = ((Component)guiManager.itemPromptSecondary).gameObject; if ((Object)(object)gameObject == (Object)null) { _log.LogError((object)"[PeakPelago] Could not find item prompt secondary to get parent"); return; } InputIcon component = gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { ManualLogSource log = _log; TMP_SpriteAsset keyboardSprites = component.keyboardSprites; log.LogInfo((object)("[PeakPelago] InputIcon keyboard sprites: " + ((keyboardSprites != null) ? ((Object)keyboardSprites).name : null))); } InputSpriteData instance = SingletonAsset.Instance; if ((Object)(object)instance != (Object)null) { ManualLogSource log2 = _log; TMP_SpriteAsset keyboardSprites2 = instance.keyboardSprites; log2.LogInfo((object)("[PeakPelago] Singleton keyboard sprites: " + ((keyboardSprites2 != null) ? ((Object)keyboardSprites2).name : null))); } TextMeshProUGUI component2 = gameObject.GetComponent(); if ((Object)(object)component2 != (Object)null) { ManualLogSource log3 = _log; TMP_SpriteAsset spriteAsset = ((TMP_Text)component2).spriteAsset; log3.LogInfo((object)("[PeakPelago] Secondary text sprite asset: " + ((spriteAsset != null) ? ((Object)spriteAsset).name : null))); } _tertiaryPromptObject = new GameObject("ItemPromptTertiary_EnergyLink"); _tertiaryPromptObject.transform.SetParent(gameObject.transform.parent, false); RectTransform val = _tertiaryPromptObject.AddComponent(); RectTransform component3 = gameObject.GetComponent(); if ((Object)(object)component3 != (Object)null) { val.anchorMin = component3.anchorMin; val.anchorMax = component3.anchorMax; val.pivot = component3.pivot; val.sizeDelta = component3.sizeDelta; Vector2 anchoredPosition = component3.anchoredPosition; val.anchoredPosition = new Vector2(anchoredPosition.x, anchoredPosition.y - 40f); } _tertiaryPromptText = _tertiaryPromptObject.AddComponent(); if ((Object)(object)component2 != (Object)null) { ((TMP_Text)_tertiaryPromptText).font = ((TMP_Text)component2).font; ((TMP_Text)_tertiaryPromptText).fontSize = ((TMP_Text)component2).fontSize; ((Graphic)_tertiaryPromptText).color = ((Graphic)component2).color; ((TMP_Text)_tertiaryPromptText).alignment = ((TMP_Text)component2).alignment; ((TMP_Text)_tertiaryPromptText).fontStyle = ((TMP_Text)component2).fontStyle; if ((Object)(object)instance != (Object)null && (Object)(object)instance.keyboardSprites != (Object)null) { ((TMP_Text)_tertiaryPromptText).spriteAsset = instance.keyboardSprites; } } ((TMP_Text)_tertiaryPromptText).text = " Convert"; _tertiaryPromptObject.SetActive(false); _log.LogInfo((object)"[PeakPelago] Created custom tertiary item prompt UI for EnergyLink"); } catch (Exception ex) { _log.LogError((object)("[PeakPelago] Failed to create tertiary prompt UI: " + ex.Message)); } } public void UpdateTertiaryPrompt(GUIManager guiManager) { if (!_isEnabled) { return; } try { if ((Object)(object)_tertiaryPromptObject == (Object)null) { CreateTertiaryPromptUI(guiManager); } if ((Object)(object)Character.localCharacter != (Object)null && (Object)(object)Character.localCharacter.data.currentItem != (Object)null) { Item currentItem = Character.localCharacter.data.currentItem; if (CanConvertItem(currentItem)) { _tertiaryPromptObject.SetActive(true); ((TMP_Text)_tertiaryPromptText).text = "Convert "; } else { _tertiaryPromptObject.SetActive(false); } } else if ((Object)(object)_tertiaryPromptObject != (Object)null) { _tertiaryPromptObject.SetActive(false); } } catch (Exception ex) { _log.LogError((object)("[PeakPelago] UpdateTertiaryPrompt error: " + ex.Message)); } } public void HandleItemConversionInput(Item item) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Invalid comparison between Unknown and I4 if (!_isEnabled || (Object)(object)item == (Object)null || (int)item.itemState != 1 || (Object)(object)item.holderCharacter != (Object)(object)Character.localCharacter) { return; } Character holderCharacter = item.holderCharacter; if ((Object)(object)holderCharacter == (Object)null || (Object)(object)holderCharacter.input == (Object)null || !CanConvertItem(item)) { return; } if (Input.GetKey((KeyCode)109)) { if ((Object)(object)_convertingItem != (Object)(object)item) { _convertingItem = item; _conversionProgress = 0f; } _conversionProgress += Time.deltaTime / 1.5f; item.overrideProgress = _conversionProgress; item.overrideForceProgress = true; if (_conversionProgress >= 1f) { _conversionProgress = 0f; _convertingItem = null; string name = item.GetName(); int itemEnergyValue = GetItemEnergyValue(item); _log.LogInfo((object)$"[PeakPelago] Converting {name} to {itemEnergyValue} energy"); ContributeEnergy(name, itemEnergyValue); item.overrideProgress = 0f; item.overrideForceProgress = false; ((MonoBehaviour)item).StartCoroutine(item.ConsumeDelayed(true)); } } else { if ((Object)(object)_convertingItem == (Object)(object)item) { item.overrideProgress = 0f; item.overrideForceProgress = false; } _conversionProgress = 0f; _convertingItem = null; } } public void Cleanup() { if ((Object)(object)_tertiaryPromptObject != (Object)null) { Object.Destroy((Object)(object)_tertiaryPromptObject); _tertiaryPromptObject = null; _tertiaryPromptText = null; } if (_harmony != null) { _harmony.UnpatchSelf(); } EnergyLinkPatches.SetInstance(null); _session = null; _isEnabled = false; _currentEnergy = 0; _maxEnergy = 0; } } [HarmonyPatch] public class CampfireModelSpawner { private static GameObject modelPrefab; private static ManualLogSource _log; private static readonly Dictionary spawnedModels = new Dictionary(); private static EnergyLinkService _energyLinkService; public static Texture2D redEmissiveTexture; public static Texture2D greenEmissiveTexture; public static void Initialize(ManualLogSource log) { _log = log; LoadModelPrefab(); PhotonNetwork.NetworkingClient.EventReceived += OnPhotonEvent; } private static void OnPhotonEvent(EventData photonEvent) { if (photonEvent.Code != 117) { return; } object[] array = (object[])photonEvent.CustomData; if (array != null && array.Length != 0) { object obj = array[0]; if (obj is int) { int campfireInstanceId = (int)obj; HandleStorePurchase(campfireInstanceId); } } } public static void HandleStorePurchase(int campfireInstanceId) { ManualLogSource log = _log; if (log != null) { log.LogInfo((object)$"[CampfireSpawner] Handling store purchase for campfire {campfireInstanceId}"); } foreach (KeyValuePair spawnedModel in spawnedModels) { if (!((Object)(object)spawnedModel.Key != (Object)null) || ((Object)spawnedModel.Key).GetInstanceID() != campfireInstanceId) { continue; } GameObject value = spawnedModel.Value; EnergyLinkStoreInteractable energyLinkStoreInteractable = ((value != null) ? value.GetComponent() : null); if ((Object)(object)energyLinkStoreInteractable != (Object)null) { energyLinkStoreInteractable.MarkAsUsed(); ManualLogSource log2 = _log; if (log2 != null) { log2.LogInfo((object)"[CampfireSpawner] Store marked as used"); } } break; } } public static void SetEnergyLinkService(EnergyLinkService service) { _energyLinkService = service; ManualLogSource log = _log; if (log != null) { log.LogInfo((object)"[CampfireSpawner] EnergyLinkService reference set"); } } private static void LoadModelPrefab() { string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "energylinkstore.peakbundle"); ManualLogSource log = _log; if (log != null) { log.LogInfo((object)("[CampfireSpawner] Looking for AssetBundle at: " + text)); } if (File.Exists(text)) { try { AssetBundle val = AssetBundle.LoadFromFile(text); if ((Object)(object)val != (Object)null) { modelPrefab = val.LoadAsset("EnergyLinkStore"); redEmissiveTexture = val.LoadAsset("RED"); greenEmissiveTexture = val.LoadAsset("GREEN"); if ((Object)(object)modelPrefab != (Object)null) { Object.DontDestroyOnLoad((Object)(object)modelPrefab); ManualLogSource log2 = _log; if (log2 != null) { log2.LogInfo((object)"[CampfireSpawner] Loaded prefab from AssetBundle"); } } if ((Object)(object)redEmissiveTexture != (Object)null) { Object.DontDestroyOnLoad((Object)(object)redEmissiveTexture); ManualLogSource log3 = _log; if (log3 != null) { log3.LogInfo((object)"[CampfireSpawner] Loaded RED emissive texture"); } } if ((Object)(object)greenEmissiveTexture != (Object)null) { Object.DontDestroyOnLoad((Object)(object)greenEmissiveTexture); ManualLogSource log4 = _log; if (log4 != null) { log4.LogInfo((object)"[CampfireSpawner] Loaded GREEN emissive texture"); } } } return; } catch (Exception ex) { ManualLogSource log5 = _log; if (log5 != null) { log5.LogError((object)("[CampfireSpawner] Error loading AssetBundle: " + ex.Message)); } return; } } ManualLogSource log6 = _log; if (log6 != null) { log6.LogError((object)("[CampfireSpawner] AssetBundle not found at: " + text)); } } [HarmonyPostfix] [HarmonyPatch(typeof(Campfire), "Awake")] private static void OnCampfireAwake(Campfire __instance) { EnergyLinkService energyLinkService = _energyLinkService; if (energyLinkService == null || !energyLinkService.IsEnabled()) { ManualLogSource log = _log; if (log != null) { log.LogDebug((object)"[CampfireSpawner] EnergyLink not enabled, skipping store spawn"); } } else { SpawnStoreOnCampfire(__instance); } } private static void SpawnStoreOnCampfire(Campfire campfire) { //IL_0069: 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_008b: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)modelPrefab == (Object)null) { ManualLogSource log = _log; if (log != null) { log.LogWarning((object)"[CampfireSpawner] Model prefab not loaded!"); } } else if (!spawnedModels.ContainsKey(campfire)) { GameObject val = Object.Instantiate(modelPrefab); val.SetActive(true); ((Object)val).name = $"APCampfireModel_{((Object)campfire).GetInstanceID()}"; ApplyPeakShaderToModel(val); Vector3 position = ((Component)campfire).transform.position; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(6f, -0.25f, 2f); val.transform.position = position + val2; val.transform.LookAt(position); Vector3 eulerAngles = val.transform.eulerAngles; val.transform.eulerAngles = new Vector3(0f, eulerAngles.y, 0f); val.transform.localScale = Vector3.one * 2f; val.transform.SetParent(((Component)campfire).transform, true); val.AddComponent().Initialize(_log, _energyLinkService, null); spawnedModels[campfire] = val; ManualLogSource log2 = _log; if (log2 != null) { log2.LogInfo((object)$"[CampfireSpawner] Spawned model at {val.transform.position}"); } } } public static void SpawnOnExistingCampfires() { EnergyLinkService energyLinkService = _energyLinkService; if (energyLinkService == null || !energyLinkService.IsEnabled()) { return; } Campfire[] array = Object.FindObjectsByType((FindObjectsSortMode)0); Campfire[] array2 = array; foreach (Campfire val in array2) { if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeInHierarchy) { SpawnStoreOnCampfire(val); } } ManualLogSource log = _log; if (log != null) { log.LogInfo((object)$"[CampfireSpawner] Checked {array.Length} existing campfires for store spawning"); } } public static void CleanupAllModels() { foreach (KeyValuePair item in spawnedModels.ToList()) { if ((Object)(object)item.Value != (Object)null) { Object.Destroy((Object)(object)item.Value); } } spawnedModels.Clear(); ManualLogSource log = _log; if (log != null) { log.LogInfo((object)"[CampfireSpawner] Cleaned up all campfire models"); } } public static void CleanupDestroyedCampfires() { List list = (from kvp in spawnedModels where (Object)(object)kvp.Key == (Object)null || (Object)(object)kvp.Value == (Object)null select kvp.Key).ToList(); foreach (Campfire item in list) { spawnedModels.Remove(item); } if (list.Count > 0) { ManualLogSource log = _log; if (log != null) { log.LogDebug((object)$"[CampfireSpawner] Cleaned up {list.Count} destroyed campfire entries"); } } } private static void ApplyPeakShaderToModel(GameObject model) { //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_00ae: 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_0105: Unknown result type (might be due to invalid IL or missing references) try { Shader val = Shader.Find("W/Peak_Standard"); if ((Object)(object)val == (Object)null) { ManualLogSource log = _log; if (log != null) { log.LogWarning((object)"[CampfireSpawner] W/Peak_Standard shader not found!"); } return; } Renderer[] componentsInChildren = model.GetComponentsInChildren(true); ManualLogSource log2 = _log; if (log2 != null) { log2.LogInfo((object)$"[CampfireSpawner] Found {componentsInChildren.Length} renderers in model"); } int num = 0; Renderer[] array = componentsInChildren; foreach (Renderer obj in array) { obj.enabled = true; Material[] materials = obj.materials; foreach (Material val2 in materials) { Color color = val2.color; Texture mainTexture = val2.mainTexture; ManualLogSource log3 = _log; if (log3 != null) { log3.LogInfo((object)$"[CampfireSpawner] Material '{((Object)val2).name}': Color={color}, HasTexture={(Object)(object)mainTexture != (Object)null}"); } val2.shader = val; if (val2.HasProperty("_BaseColor")) { val2.SetColor("_BaseColor", color); } if (val2.HasProperty("_Tint")) { val2.SetColor("_Tint", color); } if ((Object)(object)mainTexture != (Object)null) { if (val2.HasProperty("_BaseTexture")) { val2.SetTexture("_BaseTexture", mainTexture); ManualLogSource log4 = _log; if (log4 != null) { log4.LogInfo((object)"[CampfireSpawner] Set _BaseTexture"); } } if (val2.HasProperty("_MainTex")) { val2.SetTexture("_MainTex", mainTexture); ManualLogSource log5 = _log; if (log5 != null) { log5.LogInfo((object)"[CampfireSpawner] Set _MainTex"); } } } num++; } } ManualLogSource log6 = _log; if (log6 != null) { log6.LogInfo((object)$"[CampfireSpawner] Applied Peak shader to {num} materials across {componentsInChildren.Length} renderers"); } } catch (Exception ex) { ManualLogSource log7 = _log; if (log7 != null) { log7.LogError((object)("[CampfireSpawner] Error applying Peak shader: " + ex.Message)); } ManualLogSource log8 = _log; if (log8 != null) { log8.LogError((object)("[CampfireSpawner] Stack trace: " + ex.StackTrace)); } } } public static int GetSpawnedModelCount() { return spawnedModels.Count; } } public class EnergyLinkStoreInteractable : MonoBehaviour, IInteractible, IInteractibleConstant { private class BundleDefinition { public (string itemName, int count)[] Items { get; } public BundleDefinition(string itemName, int count) { Items = new(string, int)[1] { (itemName, count) }; } public BundleDefinition((string itemName, int count)[] items) { Items = items; } } [CompilerGenerated] private sealed class d__18 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public float delay; public EnergyLinkStoreInteractable <>4__this; public BundleDefinition bundle; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__18(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0075: 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_0081: 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_009d: 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) int num = <>1__state; EnergyLinkStoreInteractable energyLinkStoreInteractable = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(delay); <>1__state = 1; return true; case 1: { <>1__state = -1; if ((Object)(object)energyLinkStoreInteractable._animator != (Object)null) { ((Behaviour)energyLinkStoreInteractable._animator).enabled = false; } Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(-0.453f, 0.523f, 0.512f); Vector3 val2 = ((Component)energyLinkStoreInteractable).transform.position + ((Component)energyLinkStoreInteractable).transform.TransformDirection(val); ManualLogSource log = energyLinkStoreInteractable._log; if (log != null) { log.LogInfo((object)$"[EnergyLinkStore] Dispensing from position: {val2}"); } (string, int)[] items = bundle.Items; for (int i = 0; i < items.Length; i++) { var (itemName, count) = items[i]; energyLinkStoreInteractable.SpawnPhysicalItems(itemName, count, val2); } 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(); } } private ManualLogSource _log; private EnergyLinkService _energyLinkService; private BoxCollider _collider; private Animator _animator; private int _cachedEnergy; private string _selectedBundleName; private Action _selectedBundleAction; private const int BUNDLE_COST = 400000000; private const float PURCHASE_TIME = 2f; private const float ENERGY_UPDATE_INTERVAL = 0.5f; private float _lastEnergyUpdateTime; private bool _isAvailable = true; private Campfire _parentCampfire; private static readonly Dictionary BundleDefinitions = new Dictionary { { "Trailblazer Snacks", new BundleDefinition("Granola Bar", 4) }, { "Trailblazer Snacks Alt", new BundleDefinition(new(string, int)[2] { ("Granola Bar", 2), ("TrailMix", 6) }) }, { "Lovely Bunch", new BundleDefinition("Item_Coconut", 4) }, { "Lovely Bunch Alt", new BundleDefinition("Item_Coconut_half", 8) }, { "Bear Favorite", new BundleDefinition("Item_Honeycomb", 4) }, { "Bear Favorite Alt", new BundleDefinition("Item_Honeycomb", 6) }, { "Rainy Day", new BundleDefinition("Parasol", 3) }, { "Rainy Day Alt", new BundleDefinition("Parasol", 4) }, { "Turkey Day", new BundleDefinition("EggTurkey", 4) }, { "Turkey Day Alt", new BundleDefinition(new(string, int)[2] { ("EggTurkey", 2), ("NestEgg", 3) }) }, { "Special Delivery", new BundleDefinition("Lantern_Faerie", 2) }, { "Special Delivery Alt", new BundleDefinition("Dynamite", 5) }, { "For Your Health", new BundleDefinition(new(string, int)[2] { ("FirstAidKit", 1), ("Bandages", 4) }) }, { "For Your Health Alt", new BundleDefinition("Bandages", 8) }, { "Rooty Tooty", new BundleDefinition("MedicinalRoot", 4) }, { "Rooty Tooty Alt", new BundleDefinition(new(string, int)[2] { ("MedicinalRoot", 3), ("Mandrake", 1) }) }, { "Banana Bonanza", new BundleDefinition(new(string, int)[2] { ("Berrynana Yellow", 4), ("Berrynana Pink", 4) }) }, { "Banana Bonanza Alt", new BundleDefinition(new(string, int)[2] { ("Berrynana Blue", 4), ("Berrynana Brown", 4) }) }, { "Cluster Of Berries", new BundleDefinition(new(string, int)[8] { ("Apple Berry Green", 1), ("Apple Berry Red", 1), ("Clusterberry Red", 1), ("Clusterberry Yellow", 1), ("Kingberry Green", 1), ("Kingberry Yellow", 1), ("Prickleberry_Red", 1), ("Winterberry Orange", 1) }) }, { "Cluster Of Berries Alt", new BundleDefinition(new(string, int)[8] { ("Apple Berry Red", 1), ("Apple Berry Yellow", 1), ("Clusterberry Black", 1), ("Clusterberry Yellow", 1), ("Kingberry Green", 1), ("Kingberry Purple", 1), ("Prickleberry_Gold", 1), ("Winterberry Yellow", 1) }) }, { "Grapple Pack", new BundleDefinition("RopeShooter", 3) }, { "Grapple Pack Alt", new BundleDefinition(new(string, int)[2] { ("ChainShooter", 1), ("RescueHook", 1) }) }, { "Mass Production", new BundleDefinition("BingBong", 4) }, { "Mass Production Alt", new BundleDefinition("BingBong", 8) }, { "Night Night", new BundleDefinition("HealingDart Variant", 2) }, { "Night Night Alt", new BundleDefinition("Napberry", 2) }, { "Sugar Rush", new BundleDefinition(new(string, int)[2] { ("Lollipop", 1), ("Energy Drink", 4) }) }, { "Sugar Rush Alt", new BundleDefinition(new(string, int)[2] { ("Lollipop", 2), ("Energy Drink", 4) }) } }; public bool holdOnFinish => false; public void Initialize(ManualLogSource log, EnergyLinkService energyLinkService, AnimationClip openClip) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_00c8: Unknown result type (might be due to invalid IL or missing references) _log = log; _energyLinkService = energyLinkService; _parentCampfire = ((Component)this).GetComponentInParent(); if ((Object)(object)_parentCampfire == (Object)null) { ManualLogSource log2 = _log; if (log2 != null) { log2.LogError((object)"[EnergyLinkStore] No parent Campfire found!"); } } BoxCollider obj = ((Component)this).gameObject.AddComponent(); obj.center = new Vector3(-0.16f, 0f, 0.1f); obj.size = new Vector3(1.5f, 2.7f, 1.05f); ((Collider)obj).isTrigger = false; _collider = ((Component)this).gameObject.AddComponent(); _collider.center = new Vector3(-0.16f, 0f, 0.1f); _collider.size = new Vector3(1.5f, 2.7f, 1.05f); ((Collider)_collider).isTrigger = true; _animator = ((Component)this).GetComponentInChildren(); if ((Object)(object)_animator != (Object)null) { ManualLogSource log3 = _log; if (log3 != null) { log3.LogInfo((object)"[EnergyLinkStore] Found Animator component"); } ((Behaviour)_animator).enabled = false; } else { ManualLogSource log4 = _log; if (log4 != null) { log4.LogWarning((object)"[EnergyLinkStore] No Animator found!"); } } EnergyLinkService energyLinkService2 = _energyLinkService; if (energyLinkService2 != null && energyLinkService2.IsEnabled()) { _cachedEnergy = _energyLinkService.GetCurrentEnergy(); ManualLogSource log5 = _log; if (log5 != null) { log5.LogInfo((object)$"[EnergyLinkStore] Initial energy: {_cachedEnergy}"); } } UpdateCachedEnergy(); SelectRandomBundle(); SetEmissiveTexture(CampfireModelSpawner.redEmissiveTexture); } private void SelectRandomBundle() { List> list = BundleDefinitions.ToList(); int index = Random.Range(0, list.Count); KeyValuePair keyValuePair = list[index]; BundleDefinition bundleDef = keyValuePair.Value; _selectedBundleAction = delegate { DispenseBundle(bundleDef); }; _selectedBundleName = keyValuePair.Key; string text = _selectedBundleName; if (_selectedBundleName.EndsWith(" Alt")) { text = _selectedBundleName.Substring(0, _selectedBundleName.Length - 4); } ManualLogSource log = _log; if (log != null) { log.LogInfo((object)("[EnergyLinkStore] Selected bundle: " + text)); } } private void DispenseBundle(BundleDefinition bundle) { ManualLogSource log = _log; if (log != null) { log.LogInfo((object)("[EnergyLinkStore] Dispensing bundle: " + _selectedBundleName)); } if ((Object)(object)_animator != (Object)null) { ManualLogSource log2 = _log; if (log2 != null) { log2.LogInfo((object)"[EnergyLinkStore] Playing animation"); } ((Behaviour)_animator).enabled = true; _animator.Play("armature|anim_open", 0, 0f); ((MonoBehaviour)this).StartCoroutine(DispenseAfterDelay(bundle, 3f)); } else { ManualLogSource log3 = _log; if (log3 != null) { log3.LogWarning((object)"[EnergyLinkStore] No animator, dispensing immediately"); } ((MonoBehaviour)this).StartCoroutine(DispenseAfterDelay(bundle, 0.1f)); } } [IteratorStateMachine(typeof(d__18))] private IEnumerator DispenseAfterDelay(BundleDefinition bundle, float delay) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__18(0) { <>4__this = this, bundle = bundle, delay = delay }; } private void Update() { if (Time.time - _lastEnergyUpdateTime >= 0.5f) { UpdateCachedEnergy(); _lastEnergyUpdateTime = Time.time; } } private void UpdateCachedEnergy() { EnergyLinkService energyLinkService = _energyLinkService; if (energyLinkService != null && energyLinkService.IsEnabled()) { _cachedEnergy = _energyLinkService.GetCurrentEnergy(); } } private void SpawnPhysicalItems(string itemName, int count, Vector3 basePosition) { //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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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_010b: 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) try { Item val = null; Item val2 = default(Item); for (ushort num = 1; num < 1000; num++) { if (ItemDatabase.TryGetItem(num, ref val2) && ((Object)val2).name.Equals(itemName, StringComparison.OrdinalIgnoreCase)) { val = val2; break; } } if ((Object)(object)val == (Object)null) { ManualLogSource log = _log; if (log != null) { log.LogWarning((object)("[EnergyLinkStore] Could not find item in database: " + itemName)); } return; } Vector3 val3 = default(Vector3); for (int i = 0; i < count; i++) { ((Vector3)(ref val3))..ctor(Random.Range(-0.3f, 0.3f), Random.Range(0f, 0.2f), Random.Range(-0.3f, 0.3f)); Vector3 val4 = basePosition + val3; Vector3 forward = ((Component)this).transform.forward; Quaternion val5 = Quaternion.LookRotation(forward); Rigidbody component = PhotonNetwork.Instantiate("0_Items/" + ((Object)val).name, val4, val5, (byte)0, (object[])null).GetComponent(); if ((Object)(object)component != (Object)null) { Vector3 val6 = forward * Random.Range(1f, 1.5f) + Vector3.up * 1f; component.AddForce(val6, (ForceMode)1); } ManualLogSource log2 = _log; if (log2 != null) { log2.LogInfo((object)$"[EnergyLinkStore] Spawned {itemName} at {val4}"); } } } catch (Exception ex) { ManualLogSource log3 = _log; if (log3 != null) { log3.LogError((object)("[EnergyLinkStore] Error spawning items: " + ex.Message)); } } } public Vector3 Center() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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) if ((Object)(object)_collider != (Object)null) { Bounds bounds = ((Collider)_collider).bounds; return ((Bounds)(ref bounds)).center; } return ((Component)this).transform.position; } public string GetInteractionText() { UpdateCachedEnergy(); string arg = _selectedBundleName; if (_selectedBundleName.EndsWith(" Alt")) { arg = _selectedBundleName.Substring(0, _selectedBundleName.Length - 4); } double num = (double)_cachedEnergy / 1000000.0; double num2 = 400.0; if (_cachedEnergy >= 400000000) { return $"Bundle: {arg}\n{num:F2} / {num2:F0} MJ"; } return $"Bundle: {arg}\nNOT ENOUGH ENERGY\n({num:F2} / {num2:F0} MJ)"; } public string GetName() { return "Energy Link Store"; } public Transform GetTransform() { return ((Component)this).transform; } public void HoverEnter() { UpdateCachedEnergy(); } public void HoverExit() { } public void Interact(Character interactor) { ManualLogSource log = _log; if (log != null) { log.LogInfo((object)("[EnergyLinkStore] Player " + ((MonoBehaviourPun)interactor).photonView.Owner.NickName + " interacted with Energy Link Store")); } } private void SetEmissiveTexture(Texture2D texture) { if ((Object)(object)texture == (Object)null) { return; } try { Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { Material[] materials = componentsInChildren[i].materials; foreach (Material val in materials) { bool flag = false; string[] array = new string[5] { "_EmissionMap", "_EmissiveMap", "_Emission", "_EmissiveTex", "_Emissive" }; foreach (string text in array) { if (val.HasProperty(text)) { val.SetTexture(text, (Texture)(object)texture); ManualLogSource log = _log; if (log != null) { log.LogInfo((object)("[EnergyLinkStore] Set texture on property: " + text)); } flag = true; } } if (!flag) { ManualLogSource log2 = _log; if (log2 != null) { log2.LogWarning((object)("[EnergyLinkStore] No emission property found on material " + ((Object)val).name)); } } } } } catch (Exception ex) { ManualLogSource log3 = _log; if (log3 != null) { log3.LogError((object)("[EnergyLinkStore] Error changing emissive texture: " + ex.Message)); } } } public void Interact_CastFinished(Character interactor) { ManualLogSource log = _log; if (log != null) { log.LogInfo((object)"[EnergyLinkStore] Interact_CastFinished called!"); } EnergyLinkService energyLinkService = _energyLinkService; if (energyLinkService == null || !energyLinkService.IsEnabled()) { ManualLogSource log2 = _log; if (log2 != null) { log2.LogWarning((object)"[EnergyLinkStore] EnergyLink not enabled"); } return; } if (!_isAvailable) { ManualLogSource log3 = _log; if (log3 != null) { log3.LogInfo((object)"[EnergyLinkStore] Store already used"); } return; } UpdateCachedEnergy(); if (_cachedEnergy < 400000000) { ManualLogSource log4 = _log; if (log4 != null) { log4.LogInfo((object)$"[EnergyLinkStore] Not enough energy! Need {400000000}J, have {_cachedEnergy}J"); } } else if (PhotonNetwork.IsMasterClient) { ManualLogSource log5 = _log; if (log5 != null) { log5.LogInfo((object)"[EnergyLinkStore] HOST: Processing purchase"); } ProcessPurchase(); } else { if (!((Object)(object)_parentCampfire != (Object)null)) { return; } int instanceID = ((Object)_parentCampfire).GetInstanceID(); ManualLogSource log6 = _log; if (log6 != null) { log6.LogInfo((object)$"[EnergyLinkStore] CLIENT: Sending purchase request to host for campfire {instanceID}"); } object tagObject = PhotonNetwork.LocalPlayer.TagObject; if ((Object)((tagObject is PhotonView) ? tagObject : null) == (Object)null) { PeakArchipelagoPlugin peakArchipelagoPlugin = Object.FindFirstObjectByType(); if ((Object)(object)peakArchipelagoPlugin != (Object)null && (Object)(object)peakArchipelagoPlugin.PhotonView != (Object)null) { peakArchipelagoPlugin.PhotonView.RPC("RPC_PurchaseEnergyLinkStore", (RpcTarget)2, new object[1] { instanceID }); } } } } private void ProcessPurchase() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_0051: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) if (_energyLinkService.ConsumeEnergy(400000000)) { ManualLogSource log = _log; if (log != null) { log.LogInfo((object)"[EnergyLinkStore] Purchase successful!"); } int instanceID = ((Object)_parentCampfire).GetInstanceID(); object[] array = new object[1] { instanceID }; RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)1 }; PhotonNetwork.RaiseEvent((byte)117, (object)array, val, SendOptions.SendReliable); _cachedEnergy = _energyLinkService.GetCurrentEnergy(); } else { ManualLogSource log2 = _log; if (log2 != null) { log2.LogWarning((object)"[EnergyLinkStore] Failed to consume energy for purchase"); } } } public void MarkAsUsed() { _isAvailable = false; SetEmissiveTexture(CampfireModelSpawner.greenEmissiveTexture); _selectedBundleAction?.Invoke(); } [PunRPC] private void RPC_PurchaseStore() { ManualLogSource log = _log; if (log != null) { log.LogInfo((object)"[EnergyLinkStore] RPC received - executing purchase"); } _isAvailable = false; SetEmissiveTexture(CampfireModelSpawner.greenEmissiveTexture); _selectedBundleAction?.Invoke(); } public void CancelCast(Character interactor) { } public void ReleaseInteract(Character interactor) { } public bool IsInteractible(Character interactor) { if (_isAvailable) { return _energyLinkService?.IsEnabled() ?? false; } return false; } public bool IsConstantlyInteractable(Character interactor) { return IsInteractible(interactor); } public float GetInteractTime(Character interactor) { return 2f; } } public class HardRingLinkService { private static class HardRingLinkPatches { [HarmonyPatch(typeof(MountainProgressHandler), "CheckAreaAchievement")] public static class MountainProgressPeakReachedPatch { private static void Postfix(ProgressPoint pointReached) { try { if (_instance == null || !_instance._isEnabled) { return; } string text = "Unknown"; if (pointReached != null) { FieldInfo field = ((object)pointReached).GetType().GetField("title"); if (field != null) { text = ((string)field.GetValue(pointReached)) ?? "Unknown"; } } _instance._log.LogInfo((object)("[PeakPelago] Player reached peak: " + text)); int num = 0; if (text.ToUpper() == "PEAK") { num = 200; _instance._log.LogInfo((object)$"[PeakPelago] Final PEAK reached, sending +{num} rings via Hard Ring Link"); } else if (text.ToUpper() == "SHORE") { num = 25; _instance._log.LogInfo((object)$"[PeakPelago] SHORE reached, sending +{num} rings via Hard Ring Link"); } else if (!string.IsNullOrEmpty(text) && text.ToUpper() != "UNKNOWN") { num = 100; _instance._log.LogInfo((object)$"[PeakPelago] Peak '{text}' reached, sending +{num} rings via Hard Ring Link"); } if (num > 0) { _instance.SendHardRingLink(num); } } catch (Exception ex) { if (_instance != null) { _instance._log.LogError((object)("[PeakPelago] MountainProgressPeakReachedPatch error: " + ex.Message)); } } } } [HarmonyPatch(typeof(Character), "RPCA_Die")] public static class CharacterDeathPatch { private static void Postfix(Character __instance) { try { if (_instance != null && _instance._isEnabled) { if ((Object)(object)PeakArchipelagoPlugin._instance != (Object)null && PeakArchipelagoPlugin._instance._isDyingFromDeathLink) { _instance._log.LogDebug((object)"[PeakPelago] Death was from DeathLink, not sending Hard Ring Link"); return; } string text = __instance.characterName ?? "Unknown"; _instance._log.LogInfo((object)("[PeakPelago] Character died: " + text + ", sending -75 rings via Hard Ring Link")); _instance.SendHardRingLink(-75); } } catch (Exception ex) { if (_instance != null) { _instance._log.LogError((object)("[PeakPelago] CharacterDeathPatch error: " + ex.Message)); } } } } [HarmonyPatch(typeof(Character), "FinishZombifying")] public static class CharacterZombifyPatch { private static void Postfix(Character __instance) { try { if (_instance != null && _instance._isEnabled) { if ((Object)(object)PeakArchipelagoPlugin._instance != (Object)null && PeakArchipelagoPlugin._instance._isDyingFromDeathLink) { _instance._log.LogDebug((object)"[PeakPelago] Zombification was from DeathLink, not sending Hard Ring Link"); return; } string text = __instance.characterName ?? "Unknown"; _instance._log.LogInfo((object)("[PeakPelago] Character zombified: " + text + ", sending -75 rings via Hard Ring Link")); _instance.SendHardRingLink(-75); } } catch (Exception ex) { if (_instance != null) { _instance._log.LogError((object)("[PeakPelago] CharacterZombifyPatch error: " + ex.Message)); } } } } [HarmonyPatch(typeof(Scoutmaster), "SetCurrentTarget")] public static class ScoutmasterSetTargetPatch { [HarmonyPatch(typeof(Scoutmaster), "OnDisable")] public static class ScoutmasterOnDisablePatch { private static void Postfix() { _hasSpawnedThisSession = false; } } private static bool _hasSpawnedThisSession; private static void Postfix(Scoutmaster __instance, Character setCurrentTarget) { try { if (_instance != null && _instance._isEnabled && (Object)(object)setCurrentTarget != (Object)null && !_hasSpawnedThisSession) { _hasSpawnedThisSession = true; _instance._log.LogInfo((object)("[PeakPelago] Scoutmaster spawned/activated (targeting " + setCurrentTarget.characterName + "), sending -45 rings via Hard Ring Link")); _instance.SendHardRingLink(-45); } } catch (Exception ex) { if (_instance != null) { _instance._log.LogError((object)("[PeakPelago] ScoutmasterSetTargetPatch error: " + ex.Message)); } } } } [HarmonyPatch(typeof(ItemCooking), "Wreck")] public static class ItemCookingWreckPatch { private static void Postfix(ItemCooking __instance) { try { if (_instance != null && _instance._isEnabled && (Object)(object)((ItemComponent)__instance).item != (Object)null && (Object)(object)((ItemComponent)__instance).item.holderCharacter != (Object)null) { string text = ((Object)((ItemComponent)__instance).item).name ?? "Unknown"; string text2 = ((ItemComponent)__instance).item.holderCharacter.characterName ?? "Unknown"; _instance._log.LogInfo((object)("[PeakPelago] Item wrecked from cooking: " + text + " (held by " + text2 + "), sending -15 rings via Hard Ring Link")); _instance.SendHardRingLink(-15); } } catch (Exception ex) { if (_instance != null) { _instance._log.LogError((object)("[PeakPelago] ItemCookingWreckPatch error: " + ex.Message)); } } } } private static HardRingLinkService _instance; public static void SetInstance(HardRingLinkService instance) { _instance = instance; } } private readonly ManualLogSource _log; private ArchipelagoSession _session; private bool _isEnabled; private int _connectionId; private Harmony _harmony; private ArchipelagoNotificationManager _notifications; public HardRingLinkService(ManualLogSource log, ArchipelagoNotificationManager notifications) { _log = log; _connectionId = Random.Range(int.MinValue, int.MaxValue); _notifications = notifications; } public void Initialize(ArchipelagoSession session, bool enabled) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown _session = session; _isEnabled = enabled; if (_isEnabled) { _harmony = new Harmony("com.mickemoose.peak.ap.hardringlink"); _harmony.PatchAll(typeof(HardRingLinkPatches)); HardRingLinkPatches.SetInstance(this); if (_session != null) { _session.Socket.PacketReceived += new PacketReceivedHandler(OnPacketReceived); _log.LogInfo((object)$"[PeakPelago] Hard Ring Link service initialized with session (Connection ID: {_connectionId})"); } else { _log.LogInfo((object)"[PeakPelago] Hard Ring Link service enabled for client (no session, effects only)"); } } } public void SetEnabled(bool enabled) { _isEnabled = enabled; _log.LogInfo((object)("[PeakPelago] Hard Ring Link " + (enabled ? "enabled" : "disabled"))); } public void SendHardRingLink(int amount) { //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_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Expected O, but got Unknown if (!_isEnabled) { return; } if (_session == null) { try { PeakArchipelagoPlugin instance = PeakArchipelagoPlugin._instance; if ((Object)(object)instance != (Object)null && (Object)(object)instance.PhotonView != (Object)null && PhotonNetwork.IsConnected) { instance.PhotonView.RPC("RPC_SendHardRingLink", (RpcTarget)2, new object[1] { amount }); string text = ((amount > 0) ? "positive" : "negative"); _log.LogInfo((object)$"[PeakPelago] Client forwarded Hard Ring Link to host: {amount} rings ({text})"); if (text == "positive") { _notifications.ShowRingLinkNotification($"HardRingLink: Sent +{amount} ring(s)"); } else { _notifications.ShowRingLinkNotification($"HardRingLink: Sent -{amount} ring(s)"); } } return; } catch (Exception ex) { _log.LogError((object)("[PeakPelago] Failed to forward Hard Ring Link to host: " + ex.Message)); return; } } try { Dictionary data = new Dictionary { { "time", JToken.FromObject((object)DateTimeOffset.UtcNow.ToUnixTimeSeconds()) }, { "source", JToken.FromObject((object)_connectionId) }, { "amount", JToken.FromObject((object)amount) } }; BouncePacket val = new BouncePacket { Tags = new List { "HardRingLink" }, Data = data }; _session.Socket.SendPacket((ArchipelagoPacketBase)(object)val); string text2 = ((amount > 0) ? "positive" : "negative"); _log.LogInfo((object)$"[PeakPelago] Sent Hard Ring Link: {amount} rings ({text2})"); if (text2 == "positive") { _notifications.ShowRingLinkNotification($"HardRingLink: Sent +{amount} ring(s)"); } else { _notifications.ShowRingLinkNotification($"HardRingLink: Sent -{amount} ring(s)"); } } catch (Exception ex2) { _log.LogError((object)("[PeakPelago] Failed to send Ring Link: " + ex2.Message)); } } private void OnPacketReceived(ArchipelagoPacketBase packet) { try { BouncePacket val = (BouncePacket)(object)((packet is BouncePacket) ? packet : null); if (val != null && val.Tags != null && val.Tags.Contains("HardRingLink") && _isEnabled) { HandleHardRingLinkReceived(val.Data); } } catch (Exception ex) { _log.LogError((object)("[PeakPelago] Error handling Ring Link packet: " + ex.Message)); } } private void HandleHardRingLinkReceived(Dictionary data) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) try { Scene activeScene = SceneManager.GetActiveScene(); if (!((Scene)(ref activeScene)).name.StartsWith("Level_")) { return; } if (data.ContainsKey("source") && data["source"].ToObject() == _connectionId) { _log.LogDebug((object)"[PeakPelago] Ignoring own Hard Ring Link"); } else if (data.ContainsKey("amount")) { int num = data["amount"].ToObject(); string text = ((num > 0) ? "positive" : "negative"); _log.LogInfo((object)$"[PeakPelago] Hard Ring Link received: {num} rings ({text})"); if (text == "positive") { _notifications.ShowRingLinkNotification($"HardRingLink: +{num} ring(s)!"); } else { _notifications.ShowRingLinkNotification($"HardRingLink: -{num} ring(s)!"); } ApplyRingLinkEffect(num); } } catch (Exception ex) { _log.LogError((object)("[PeakPelago] Failed to handle Hard Ring Link: " + ex.Message)); } } private void ApplyRingLinkEffect(int amount) { try { if (Character.AllCharacters == null || Character.AllCharacters.Count == 0) { _log.LogWarning((object)"[PeakPelago] Cannot apply Hard Ring Link - no characters found"); return; } float num = (float)amount / 100f; List list = Character.AllCharacters.Where((Character c) => (Object)(object)c != (Object)null && ((Component)c).gameObject.activeInHierarchy && !c.data.dead).ToList(); foreach (Character item in list) { if (num > 0f) { item.data.extraStamina = Mathf.Min(item.data.extraStamina + num, 1f); } else if (num < 0f) { float num2 = Mathf.Abs(num); if (item.data.extraStamina > 0f) { float num3 = Mathf.Min(item.data.extraStamina, num2); CharacterData data = item.data; data.extraStamina -= num3; num2 -= num3; } if (num2 > 0f) { item.data.currentStamina = Mathf.Max(0f, item.data.currentStamina - num2); } } item.data.extraStamina = Mathf.Clamp(item.data.extraStamina, 0f, 1f); string arg = ((amount > 0) ? "added" : "deducted"); _log.LogInfo((object)$"[PeakPelago] Hard Ring Link {arg}: {Mathf.Abs(num)} stamina (from {amount} rings)"); } _log.LogInfo((object)$"[PeakPelago] Hard Ring Link applied to {list.Count} character(s)"); } catch (Exception ex) { _log.LogError((object)("[PeakPelago] Failed to apply Hard Ring Link: " + ex.Message)); } } public void Cleanup() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown if (_session != null) { _session.Socket.PacketReceived -= new PacketReceivedHandler(OnPacketReceived); } if (_harmony != null) { _harmony.UnpatchSelf(); } HardRingLinkPatches.SetInstance(null); _session = null; _isEnabled = false; } } public class RingLinkService { private static class RingLinkPatches { [HarmonyPatch(typeof(Item), "Awake")] public static class ItemAwakePatch { private static void Postfix(Item __instance) { try { if (_instance == null || !_instance._isEnabled) { return; } __instance.OnConsumed = (Action)Delegate.Combine(__instance.OnConsumed, (Action)delegate { if (_instance != null && _instance._isEnabled && !((Object)(object)__instance.holderCharacter == (Object)null)) { int num = CalculateRingValue(__instance); if (num != 0) { string arg = ((num > 0) ? "positive" : "negative"); _instance._log.LogInfo((object)$"[PeakPelago] Item consumed: {((Object)__instance).name}, sending {num} rings ({arg})"); _instance.SendRingLink(num); } } }); } catch (Exception ex) { if (_instance != null) { _instance._log.LogError((object)("[PeakPelago] ItemAwake patch error: " + ex.Message)); } } } private static int CalculateRingValue(Item item) { string name = ((Object)item).name; if (HasPoisonEffects(item)) { float num = CalculatePoisonPenalty(item); if (num > 0f) { _instance._log.LogInfo((object)$"[PeakPelago] Item {name} is poisonous, penalty: {num}"); return -Mathf.RoundToInt(num * 100f); } } float num2 = 0f; if (name.Contains("Apple Berry")) { num2 += 0.1f; } if (name.Contains("Berrynana")) { num2 += 0.2f; } if (name.Contains("Clusterberry")) { num2 += 0.35f; } if (name.Contains("Kingberry")) { num2 += 0.15f; } if (name.Contains("Marshmallow")) { num2 += 0.5f; } if (name.Contains("Mushroom")) { num2 += 0.07f; } if (name.Contains("Sports Drink")) { num2 += 0.15f; } if (name.Contains("Energy Drink")) { num2 += 0.25f; } if (name.Contains("Winterberry") || name.Contains("Shroomberry")) { num2 += 0.35f; } if (name.Contains("Honeycomb")) { num2 += 0.15f; } if (name.Contains("Coconut_half")) { num2 += 0.35f; } if (name.Contains("AloeVera")) { num2 += 0.35f; } if (name.Contains("Glizzy")) { num2 += 0.69f; } if (name.Contains("Milk")) { num2 += 0.4f; } if (name.Contains("Turkey")) { num2 += 0.75f; } if (name.Contains("Napberry")) { num2 += 1f; } if (name.Contains("Prickleberry")) { num2 += 0.15f; } if (name.Contains("Cure-All")) { num2 += 0.3f; } if (name.Contains("MedicinalRoot")) { num2 += 0.25f; } if (name.Contains("Granola Bar")) { num2 += 0.15f; } if (name.Contains("Scout Cookies") || name.Contains("ScoutCookies")) { num2 += 0.3f; } if (name.Contains("Trail Mix") || name.Contains("TrailMix")) { num2 += 0.25f; } if (name.Contains("Airline Food")) { num2 += 0.35f; } if (name.Contains("Lollipop")) { num2 += 0.2f; } if (name.Contains("Egg") && !name.Contains("Turkey")) { num2 += 0.15f; } return Mathf.RoundToInt(num2 * 100f); } private static bool HasPoisonEffects(Item item) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 try { if ((Object)(object)((Component)item).GetComponent() != (Object)null) { return true; } Action_ModifyStatus[] components = ((Component)item).GetComponents(); if (components != null) { Action_ModifyStatus[] array = components; foreach (Action_ModifyStatus val in array) { if ((int)val.statusType == 3 && val.changeAmount > 0f) { return true; } } } if ((Object)(object)((Component)item).GetComponent() != (Object)null) { return true; } } catch (Exception ex) { if (_instance != null) { _instance._log.LogError((object)("[PeakPelago] Error checking poison effects: " + ex.Message)); } } return false; } private static float CalculatePoisonPenalty(Item item) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 float num = 0f; try { Action_InflictPoison component = ((Component)item).GetComponent(); if ((Object)(object)component != (Object)null) { FieldInfo field = ((object)component).GetType().GetField("poisonAmount", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { float num2 = (float)field.GetValue(component); num += num2 * 0.05f; } else { num += 0.05f; } if (num < 0.01f) { num = 0.05f; } } Action_ModifyStatus[] components = ((Component)item).GetComponents(); if (components != null) { Action_ModifyStatus[] array = components; foreach (Action_ModifyStatus val in array) { if ((int)val.statusType == 3 && val.changeAmount > 0f) { num += val.changeAmount * 0.05f; } } } if ((Object)(object)((Component)item).GetComponent() != (Object)null) { num += 0.05f; } } catch (Exception ex) { if (_instance != null) { _instance._log.LogError((object)("[PeakPelago] Error calculating poison penalty: " + ex.Message)); } num = 0.05f; } if (num < 0.01f) { num = 0.05f; } return num; } } private static RingLinkService _instance; public static void SetInstance(RingLinkService instance) { _instance = instance; } } private readonly ManualLogSource _log; private ArchipelagoSession _session; private bool _isEnabled; private int _connectionId; private Harmony _harmony; private ArchipelagoNotificationManager _notifications; public RingLinkService(ManualLogSource log, ArchipelagoNotificationManager notifications) { _log = log; _connectionId = Random.Range(int.MinValue, int.MaxValue); _notifications = notifications; } public void Initialize(ArchipelagoSession session, bool enabled) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown _session = session; _isEnabled = enabled; if (_isEnabled) { if (_session != null) { _session.Socket.PacketReceived += new PacketReceivedHandler(OnPacketReceived); _log.LogInfo((object)$"[PeakPelago] Ring Link service initialized with session (Connection ID: {_connectionId})"); } else { _log.LogInfo((object)"[PeakPelago] Ring Link service enabled for client (no session, effects only)"); } _harmony = new Harmony("com.mickemoose.peak.ap.ringlink"); _harmony.PatchAll(typeof(RingLinkPatches)); RingLinkPatches.SetInstance(this); } } public void SetEnabled(bool enabled) { _isEnabled = enabled; _log.LogInfo((object)("[PeakPelago] Ring Link " + (enabled ? "enabled" : "disabled"))); } public void SendRingLink(int amount) { //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_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Expected O, but got Unknown if (!_isEnabled) { return; } if (_session == null) { try { PeakArchipelagoPlugin instance = PeakArchipelagoPlugin._instance; if ((Object)(object)instance != (Object)null && (Object)(object)instance.PhotonView != (Object)null && PhotonNetwork.IsConnected) { instance.PhotonView.RPC("RPC_SendRingLink", (RpcTarget)2, new object[1] { amount }); string text = ((amount > 0) ? "positive" : "negative"); _log.LogInfo((object)$"[PeakPelago] Client forwarded Ring Link to host: {amount} rings ({text})"); if (text == "positive") { _notifications.ShowRingLinkNotification($"RingLink: Sent +{amount} ring(s)"); } else { _notifications.ShowRingLinkNotification($"RingLink: Sent -{amount} ring(s)"); } } return; } catch (Exception ex) { _log.LogError((object)("[PeakPelago] Failed to forward Ring Link to host: " + ex.Message)); return; } } try { Dictionary data = new Dictionary { { "time", JToken.FromObject((object)DateTimeOffset.UtcNow.ToUnixTimeSeconds()) }, { "source", JToken.FromObject((object)_connectionId) }, { "amount", JToken.FromObject((object)amount) } }; BouncePacket val = new BouncePacket { Tags = new List { "RingLink" }, Data = data }; _session.Socket.SendPacket((ArchipelagoPacketBase)(object)val); string text2 = ((amount > 0) ? "positive" : "negative"); _log.LogInfo((object)$"[PeakPelago] Sent Ring Link: {amount} rings ({text2})"); if (text2 == "positive") { _notifications.ShowRingLinkNotification($"RingLink: Sent +{amount} ring(s)"); } else { _notifications.ShowRingLinkNotification($"RingLink: Sent -{amount} ring(s)"); } } catch (Exception ex2) { _log.LogError((object)("[PeakPelago] Failed to send Ring Link: " + ex2.Message)); } } private void OnPacketReceived(ArchipelagoPacketBase packet) { try { BouncePacket val = (BouncePacket)(object)((packet is BouncePacket) ? packet : null); if (val != null && val.Tags != null && val.Tags.Contains("RingLink") && _isEnabled) { HandleRingLinkReceived(val.Data); } } catch (Exception ex) { _log.LogError((object)("[PeakPelago] Error handling Ring Link packet: " + ex.Message)); } } private void HandleRingLinkReceived(Dictionary data) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) try { Scene activeScene = SceneManager.GetActiveScene(); if (!((Scene)(ref activeScene)).name.StartsWith("Level_")) { return; } if (data.ContainsKey("source") && data["source"].ToObject() == _connectionId) { _log.LogDebug((object)"[PeakPelago] Ignoring own Ring Link"); } else if (data.ContainsKey("amount")) { int num = data["amount"].ToObject(); string text = ((num > 0) ? "positive" : "negative"); _log.LogInfo((object)$"[PeakPelago] Ring Link received: {num} rings ({text})"); if (text == "positive") { _notifications.ShowRingLinkNotification($"RingLink: +{num} ring(s)!"); } else { _notifications.ShowRingLinkNotification($"RingLink: -{num} ring(s)!"); } ApplyRingLinkEffect(num); } } catch (Exception ex) { _log.LogError((object)("[PeakPelago] Failed to handle Ring Link: " + ex.Message)); } } private void ApplyRingLinkEffect(int amount) { try { if (Character.AllCharacters == null || Character.AllCharacters.Count == 0) { _log.LogWarning((object)"[PeakPelago] Cannot apply Ring Link - no characters found"); return; } float num = (float)amount / 100f; List list = Character.AllCharacters.Where((Character c) => (Object)(object)c != (Object)null && ((Component)c).gameObject.activeInHierarchy && !c.data.dead).ToList(); foreach (Character item in list) { if (num > 0f) { item.data.extraStamina = Mathf.Min(item.data.extraStamina + num, 1f); _log.LogInfo((object)$"[PeakPelago] Ring Link added: {num} stamina (from {amount} rings), capped at 1.0"); } else if (num < 0f) { float num2 = Mathf.Abs(num); if (item.data.extraStamina > 0f) { float num3 = Mathf.Min(item.data.extraStamina, num2); CharacterData data = item.data; data.extraStamina -= num3; num2 -= num3; } if (num2 > 0f) { item.data.currentStamina = Mathf.Max(0f, item.data.currentStamina - num2); } _log.LogInfo((object)$"[PeakPelago] Ring Link deducted: {Mathf.Abs(num)} stamina (from {amount} rings)"); } item.data.extraStamina = Mathf.Clamp(item.data.extraStamina, 0f, 1f); } _log.LogInfo((object)$"[PeakPelago] Ring Link applied to {list.Count} character(s)"); } catch (Exception ex) { _log.LogError((object)("[PeakPelago] Failed to apply Ring Link: " + ex.Message)); } } public void Cleanup() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown if (_session != null) { _session.Socket.PacketReceived -= new PacketReceivedHandler(OnPacketReceived); } if (_harmony != null) { _harmony.UnpatchSelf(); } RingLinkPatches.SetInstance(null); _session = null; _isEnabled = false; } } public class TrapLinkService { public static class StandardTraps { public const string Trap144p = "144p Trap"; public const string Aaa = "Aaa Trap"; public const string Animal = "Animal Trap"; public const string AnimalBonus = "Animal Bonus Trap"; public const string Army = "Army Trap"; public const string Bald = "Bald Trap"; public const string BananaPeel = "Banana Peel Trap"; public const string Banana = "Banana Trap"; public const string Banner = "Banner Trap"; public const string Bee = "Bee Trap"; public const string BlueBalls = "Blue Balls Curse"; public const string Bomb = "Bomb"; public const string BombTrap = "Bomb Trap"; public const string Bonk = "Bonk Trap"; public const string Breakout = "Breakout Trap"; public const string Bubble = "Bubble Trap"; public const string BulletTime = "Bullet Time Trap"; public const string Burn = "Burn Trap"; public const string Buyon = "Buyon Trap"; public const string CameraRotate = "Camera Rotate Trap"; public const string ChaosControl = "Chaos Control Trap"; public const string ChartModifier = "Chart Modifier Trap"; public const string Chaser = "Chaser Trap"; public const string ClearImage = "Clear Image Trap"; public const string Confound = "Confound Trap"; public const string Confuse = "Confuse Trap"; public const string Confusion = "Confusion Trap"; public const string ControlBall = "Control Ball Trap"; public const string ControllerDrift = "Controller Drift Trap"; public const string CursedBall = "Cursed Ball Trap"; public const string Cutscene = "Cutscene Trap"; public const string Damage = "Damage Trap"; public const string Deisometric = "Deisometric Trap"; public const string Depletion = "Depletion Trap"; public const string DisableA = "Disable A Trap"; public const string DisableB = "Disable B Trap"; public const string DisableCUp = "Disable C Up Trap"; public const string DisableTag = "Disable Tag Trap"; public const string DisableZ = "Disable Z Trap"; public const string Disarm = "Disarm Trap"; public const string DoubleDamage = "Double Damage"; public const string Dry = "Dry Trap"; public const string EjectAbility = "Eject Ability"; public const string Electrocution = "Electrocution Trap"; public const string EmptyItemBox = "Empty Item Box Trap"; public const string EnemyBall = "Enemy Ball Trap"; public const string EnergyDrain = "Energy Drain Trap"; public const string ExpensiveStocks = "Expensive Stocks"; public const string Explosion = "Explosion Trap"; public const string Exposition = "Exposition Trap"; public const string FakeTransition = "Fake Transition"; public const string Fast = "Fast Trap"; public const string Fear = "Fear Trap"; public const string Fire = "Fire Trap"; public const string FishEye = "Fish Eye Trap"; public const string Fishing = "Fishing Trap"; public const string FishinBoo = "Fishin' Boo Trap"; public const string FlipHorizontal = "Flip Horizontal Trap"; public const string Flip = "Flip Trap"; public const string FlipVertical = "Flip Vertical Trap"; public const string FrameSlime = "Frame Slime Trap"; public const string Freeze = "Freeze Trap"; public const string Frog = "Frog Trap"; public const string Frost = "Frost Trap"; public const string Frozen = "Frozen Trap"; public const string Fuzzy = "Fuzzy Trap"; public const string GadgetShuffle = "Gadget Shuffle Trap"; public const string GetOut = "Get Out Trap"; public const string Ghost = "Ghost"; public const string GhostChat = "Ghost Chat"; public const string GooeyBag = "Gooey Bag"; public const string Gravity = "Gravity Trap"; public const string Help = "Help Trap"; public const string Hey = "Hey! Trap"; public const string Hiccup = "Hiccup Trap"; public const string Home = "Home Trap"; public const string Honey = "Honey Trap"; public const string IceFloor = "Ice Floor Trap"; public const string Ice = "Ice Trap"; public const string IcyHotPants = "Icy Hot Pants Trap"; public const string InputSequence = "Input Sequence Trap"; public const string InstantCrystal = "Instant Crystal Trap"; public const string InstantDeath = "Instant Death Trap"; public const string InvertColors = "Invert Colors Trap"; public const string InvertedMouse = "Inverted Mouse Trap"; public const string Invisiball = "Invisiball Trap"; public const string Invisible = "Invisible Trap"; public const string Invisibility = "Invisibility Trap"; public const string IronBoots = "Iron Boots Trap"; public const string ItemsToBombs = "Items to Bombs"; public const string Jump = "Jump Trap"; public const string JumpingJacks = "Jumping Jacks Trap"; public const string Laughter = "Laughter Trap"; public const string LightUpPath = "Light Up Path Trap"; public const string Literature = "Literature Trap"; public const string ManaDrain = "Mana Drain Trap"; public const string MarketCrash = "Market Crash Trap"; public const string MathQuiz = "Math Quiz Trap"; public const string Meteor = "Meteor Trap"; public const string Metronome = "Metronome Trap"; public const string Mirror = "Mirror Trap"; public const string MonkeyMash = "Monkey Mash Trap"; public const string MyTurn = "My Turn! Trap"; public const string Ninja = "Ninja Trap"; public const string NoGuarding = "No Guarding"; public const string NoPetals = "No Petals"; public const string NoRevivals = "No Revivals"; public const string NoStocks = "No Stocks"; public const string NoVac = "No Vac Trap"; public const string NumberSequence = "Number Sequence Trap"; public const string Nut = "Nut Trap"; public const string Omo = "OmoTrap"; public const string OneHitKO = "One Hit KO"; public const string Paper = "Paper Trap"; public const string Paralyze = "Paralyze Trap"; public const string Paralysis = "Paralysis Trap"; public const string Phone = "Phone Trap"; public const string Pie = "Pie Trap"; public const string Pinball = "Pinball Trap"; public const string Pixelate = "Pixelate Trap"; public const string Pixellation = "Pixellation Trap"; public const string PoisonMushroom = "Poison Mushroom"; public const string Poison = "Poison Trap"; public const string PokemonCount = "Pokemon Count Trap"; public const string PokemonTrivia = "Pokemon Trivia Trap"; public const string Police = "Police Trap"; public const string PONGChallenge = "PONG Challenge"; public const string Pong = "Pong Trap"; public const string Posession = "Posession Trap"; public const string PowerPoint = "PowerPoint Trap"; public const string Push = "Push Trap"; public const string Radiation = "Radiation Trap"; public const string Rail = "Rail Trap"; public const string Ranch = "Ranch Trap"; public const string RandomStatus = "Random Status Trap"; public const string Resistance = "Resistance Trap"; public const string Reversal = "Reversal Trap"; public const string ReverseControls = "Reverse Controls Trap"; public const string Reverse = "Reverse Trap"; public const string Rockfall = "Rockfall Trap"; public const string Sandstorm = "Sandstorm Trap"; public const string ScreenFlip = "Screen Flip Trap"; public const string Shake = "Shake Trap"; public const string Sleep = "Sleep Trap"; public const string Slip = "Slip Trap"; public const string Slow = "Slow Trap"; public const string Slowness = "Slowness Trap"; public const string Snake = "Snake Trap"; public const string Spam = "Spam Trap"; public const string SpikeBall = "Spike Ball Trap"; public const string Spooky = "Spooky Time"; public const string Spotlight = "Spotlight Trap"; public const string Spring = "Spring Trap"; public const string Squash = "Squash Trap"; public const string StickyFloor = "Sticky Floor Trap"; public const string StickyHands = "Sticky Hands Trap"; public const string Stun = "Stun Trap"; public const string SvCEffect = "SvC Effect"; public const string Swap = "Swap Trap"; public const string Tarr = "Tarr Trap"; public const string Teleport = "Teleport Trap"; public const string Text = "Text Trap"; public const string Thwimp = "Thwimp Trap"; public const string Thwomp = "Thwomp Trap"; public const string TimeLimit = "Time Limit"; public const string TimeWarp = "Time Warp Trap"; public const string Timer = "Timer Trap"; public const string Tiny = "Tiny Trap"; public const string Tip = "Tip Trap"; public const string TNTBarrel = "TNT Barrel Trap"; public const string TNT = "TNT Trap"; public const string ToolSwap = "Tool Swap Trap"; public const string Trivia = "Trivia Trap"; public const string Tutorial = "Tutorial Trap"; public const string Underwater = "Underwater Trap"; public const string Undo = "Undo Trap"; public const string UNOChallenge = "UNO Challenge"; public const string Void = "Void Trap"; public const string WarpBall = "Warp Ball Trap"; public const string WarpPipe = "Warp Pipe Trap"; public const string Whirlpool = "Whirlpool Trap"; public const string Whoops = "Whoops! Trap"; public const string WIDE = "W I D E Trap"; public const string Wind = "Wind Trap"; public const string Wither = "Wither Trap"; public const string ZoomIn = "Zoom In Trap"; public const string ZoomOut = "Zoom Out Trap"; public const string Zoom = "Zoom Trap"; } private readonly ManualLogSource _log; private ArchipelagoSession _session; private bool _isEnabled; private string _playerName; private LinkedList _trapQueue = new LinkedList(); private string _priorityTrap; private float _lastTrapActivation; private const float TRAP_ACTIVATION_COOLDOWN = 5f; private string _activeTrap; private float _activeTrapTime; private const float ACTIVE_TRAP_DISPLAY_DURATION = 5f; private bool _trapInProgress; private const float TRAP_TIMEOUT = 120f; private Action _applyTrapEffect; private Dictionary _peakToStandardMapping; private Dictionary _standardToPeakMapping; private HashSet _enabledTraps; private ArchipelagoNotificationManager _notifications; private static readonly HashSet _coroutineTraps = new HashSet { "Pokemon Trivia Trap", "Custom Trivia Trap", "Pokemon Count Trap", "Chaos Control Trap", "Inverted Mouse Trap", "Screen Flip Trap", "Zoom Trap", "Pixel Trap", "Blackout Trap", "Fear Trap", "Stamina Drain Trap", "Fungal Infection Trap" }; public bool IsTrapInProgress => _trapInProgress; public int QueueCount => _trapQueue.Count; public void NotifyTrapComplete() { _trapInProgress = false; _log.LogInfo((object)"[PeakPelago] Trap completed, queue can proceed"); } public TrapLinkService(ManualLogSource log, ArchipelagoNotificationManager notifications) { _log = log; _notifications = notifications; _peakToStandardMapping = new Dictionary(); _standardToPeakMapping = new Dictionary(); RegisterAllTraps(); } private void Register(string peakTrapName, string sendsAs, params string[] receivesAs) { if (sendsAs != null) { _peakToStandardMapping[peakTrapName] = sendsAs; } foreach (string key in receivesAs) { _standardToPeakMapping[key] = peakTrapName; } } private void RegisterAllTraps() { Register("Spawn Bee Swarm", "Bee Trap", "Bee Trap", "Honey Trap"); Register("Dynamite", "Bomb", "TNT Barrel Trap", "TNT Trap", "Bomb Trap", "Bomb"); Register("Banana Peel Trap", "Banana Peel Trap", "Banana Peel Trap", "Banana Trap"); Register("Minor Poison Trap", "Poison Mushroom", "Poison Mushroom"); Register("Poison Trap", "Poison Trap", "Poison Trap"); Register("Deadly Poison Trap", "Poison Trap"); Register("Tornado Trap", "Meteor Trap", "Meteor Trap", "Whirlpool Trap", "Sandstorm Trap"); Register("Swap Trap", "Swap Trap", "Swap Trap"); Register("Nap Time Trap", "Stun Trap", "Stun Trap", "Paralyze Trap", "Slowness Trap", "Slow Trap"); Register("Hungry Hungry Camper Trap", "Depletion Trap", "Depletion Trap", "Dry Trap"); Register("Balloon Trap", "Gravity Trap", "Gravity Trap", "Bubble Trap", "Spring Trap"); Register("Slip Trap", "Slip Trap", "Slip Trap", "Flip Trap", "Flip Vertical Trap", "Flip Horizontal Trap"); Register("Freeze Trap", "Freeze Trap", "Freeze Trap", "Frozen Trap"); Register("Cold Trap", "Ice Trap", "Ice Trap", "Ice Floor Trap"); Register("Hot Trap", "Fire Trap", "Fire Trap", "Icy Hot Pants Trap", "Burn Trap"); Register("Injury Trap", "Damage Trap", "Damage Trap", "Double Damage", "Electrocution Trap"); Register("Cactus Ball Trap", "Spike Ball Trap", "Spike Ball Trap", "Cursed Ball Trap", "Sticky Hands Trap"); Register("Instant Death Trap", "Instant Death Trap", "Instant Death Trap", "One Hit KO"); Register("Yeet Trap", "Whoops! Trap", "Eject Ability", "Whoops! Trap"); Register("Tumbleweed Trap", "Tip Trap", "Tip Trap"); Register("Zombie Horde Trap", "Spooky Time", "Spooky Time", "Army Trap", "Police Trap"); Register("Gust Trap", "Get Out Trap", "Get Out Trap", "Resistance Trap"); Register("Mandrake Trap", "OmoTrap", "OmoTrap"); Register("Fungal Infection Trap", "Posession Trap", "Posession Trap"); Register("Items to Bombs", "Items to Bombs", "Items to Bombs"); Register("Pokemon Trivia Trap", "Pokemon Trivia Trap", "Pokemon Trivia Trap"); Register("Pokemon Count Trap", "Pokemon Count Trap", "Pokemon Count Trap"); Register("Blackout Trap", "Confuse Trap", "Confuse Trap", "Confusion Trap", "Confound Trap", "Invert Colors Trap"); Register("Fear Trap", "Fear Trap", "Fear Trap"); Register("Scoutmaster Trap", "My Turn! Trap", "My Turn! Trap", "Fishin' Boo Trap", "Disable Tag Trap", "Chaser Trap"); Register("Zoom Trap", "Zoom Trap", "Zoom Trap", "W I D E Trap", "Zoom In Trap", "Zoom Out Trap"); Register("Screen Flip Trap", "Screen Flip Trap", "Screen Flip Trap", "Camera Rotate Trap"); Register("Drop Everything Trap", "Empty Item Box Trap", "Empty Item Box Trap", "Gadget Shuffle Trap", "Disarm Trap"); Register("Pixel Trap", "144p Trap", "144p Trap", "Pixellation Trap", "Pixelate Trap"); Register("Eruption Trap", "Light Up Path Trap", "Light Up Path Trap"); Register("Beetle Horde Trap", "Buyon Trap", "Buyon Trap", "Animal Trap"); Register("Custom Trivia Trap", "Trivia Trap", "Trivia Trap"); Register("Stamina Drain Trap", "Energy Drain Trap", "Energy Drain Trap", "Mana Drain Trap"); Register("Chaos Control Trap", "Chaos Control Trap", "Chaos Control Trap"); Register("Inverted Mouse Trap", "Inverted Mouse Trap", "Reverse Controls Trap", "Reverse Trap", "Reversal Trap", "Inverted Mouse Trap"); Register("Emergency Rescue Trap", "Tutorial Trap", "Tutorial Trap", "Home Trap"); Register("Explosion Trap", "Explosion Trap", "Explosion Trap", "Enemy Ball Trap"); _log.LogInfo((object)$"[PeakPelago] Initialized trap mappings: {_peakToStandardMapping.Count} outgoing, {_standardToPeakMapping.Count} incoming"); } public void Initialize(ArchipelagoSession session, bool enabled, string playerName, HashSet enabledTraps, Action applyTrapEffectCallback) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown _session = session; _isEnabled = enabled; _playerName = playerName; _enabledTraps = enabledTraps ?? new HashSet(); _applyTrapEffect = applyTrapEffectCallback; if (_isEnabled) { if (_session != null) { _session.Socket.PacketReceived += new PacketReceivedHandler(OnPacketReceived); _log.LogInfo((object)("[PeakPelago] Trap Link service initialized with session for player: " + _playerName)); } else { _log.LogInfo((object)("[PeakPelago] Trap Link service enabled for client: " + _playerName + " (no session, effects only)")); } _log.LogInfo((object)("[PeakPelago] Enabled traps: " + string.Join(", ", _enabledTraps))); } } public void SetEnabled(bool enabled) { _isEnabled = enabled; _log.LogInfo((object)("[PeakPelago] Trap Link " + (enabled ? "enabled" : "disabled"))); } public void SendTrapLink(string peakTrapName, bool fromTrapLink = false) { //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_00f2: Expected O, but got Unknown if (_session == null || !_isEnabled || fromTrapLink) { return; } try { if (!_peakToStandardMapping.TryGetValue(peakTrapName, out var value)) { _log.LogDebug((object)("[PeakPelago] No outgoing TrapLink mapping for '" + peakTrapName + "', not sending")); return; } _log.LogDebug((object)("[PeakPelago] Mapped '" + peakTrapName + "' to '" + value + "' for sending")); Dictionary data = new Dictionary { { "time", JToken.FromObject((object)DateTimeOffset.UtcNow.ToUnixTimeSeconds()) }, { "source", JToken.FromObject((object)_playerName) }, { "trap_name", JToken.FromObject((object)value) } }; BouncePacket val = new BouncePacket { Tags = new List { "TrapLink" }, Data = data }; _session.Socket.SendPacket((ArchipelagoPacketBase)(object)val); _log.LogInfo((object)("[PeakPelago] Sent Trap Link: '" + value + "' (from '" + peakTrapName + "')")); _notifications.ShowTrapLinkNotification("TrapLink: sent " + value); } catch (Exception ex) { _log.LogError((object)("[PeakPelago] Failed to send Trap Link: " + ex.Message)); } } private void OnPacketReceived(ArchipelagoPacketBase packet) { try { BouncePacket val = (BouncePacket)(object)((packet is BouncePacket) ? packet : null); if (val != null && val.Tags != null && val.Tags.Contains("TrapLink") && _isEnabled) { HandleTrapLinkReceived(val.Data); } } catch (Exception ex) { _log.LogError((object)("[PeakPelago] Error handling Trap Link packet: " + ex.Message)); } } private void HandleTrapLinkReceived(Dictionary data) { try { if (data.ContainsKey("source") && data["source"].ToObject() == _playerName) { _log.LogDebug((object)"[PeakPelago] Ignoring own Trap Link"); } else if (data.ContainsKey("trap_name")) { string text = data["trap_name"].ToObject(); string text2 = (data.ContainsKey("source") ? data["source"].ToObject() : "Unknown"); _log.LogInfo((object)("[PeakPelago] Trap Link received: '" + text + "'")); string text3 = MapToPeakTrap(text); if (text3 != null && _enabledTraps.Contains(text3)) { _priorityTrap = text3; _notifications.ShowTrapLinkNotification("TrapLink: received " + text + " from " + text2); _log.LogInfo((object)("[PeakPelago] Set priority trap: '" + text3 + "' (from '" + text + "')")); } else if (text3 == null) { _log.LogDebug((object)("[PeakPelago] No PEAK mapping for trap '" + text + "'")); } else { _log.LogDebug((object)("[PeakPelago] Trap '" + text3 + "' not enabled")); } } } catch (Exception ex) { _log.LogError((object)("[PeakPelago] Failed to handle Trap Link: " + ex.Message)); } } private string MapToPeakTrap(string externalTrapName) { if (_standardToPeakMapping.TryGetValue(externalTrapName, out var value)) { return value; } return null; } public void Update() { if (_trapInProgress) { if (!(Time.time - _activeTrapTime > 120f)) { return; } _log.LogWarning((object)$"[PeakPelago] Trap '{_activeTrap}' timed out after {120f}s, forcing completion"); _trapInProgress = false; } if (Time.time - _lastTrapActivation < 5f) { return; } if (_priorityTrap != null) { if (CanActivateTrap(_priorityTrap)) { ActivateTrap(_priorityTrap, fromTrapLink: true); _lastTrapActivation = Time.time; _priorityTrap = null; } } else if (_trapQueue.Count > 0) { string value = _trapQueue.First.Value; if (CanActivateTrap(value)) { _trapQueue.RemoveFirst(); ActivateTrap(value, fromTrapLink: false); _lastTrapActivation = Time.time; } } } private bool CanActivateTrap(string trapName) { if ((Object)(object)Character.localCharacter == (Object)null) { return false; } if (Character.localCharacter.data.dead) { return false; } if (Character.localCharacter.data.fullyPassedOut) { return false; } if (Character.localCharacter.data.passedOutOnTheBeach > 0f) { return false; } if (LoadingScreenHandler.loading) { return false; } return true; } private void ActivateTrap(string trapName, bool fromTrapLink) { try { _log.LogInfo((object)$"[PeakPelago] Activating trap: '{trapName}' (fromTrapLink: {fromTrapLink})"); _activeTrap = trapName; _activeTrapTime = Time.time; _trapInProgress = true; _applyTrapEffect?.Invoke(trapName, fromTrapLink); if (!_coroutineTraps.Contains(trapName)) { _trapInProgress = false; } } catch (Exception ex) { _log.LogError((object)("[PeakPelago] Failed to activate trap '" + trapName + "': " + ex.Message)); _trapInProgress = false; } } public void QueueTrap(string trapName) { _trapQueue.AddLast(trapName); _log.LogInfo((object)("[PeakPelago] Queued trap: '" + trapName + "'")); } public (string activeTrap, List queued) GetQueueState(int maxVisible = 5) { string item = null; if (_activeTrap != null && Time.time - _activeTrapTime < 5f) { item = _activeTrap; } else { _activeTrap = null; } List list = new List(); int num = 0; foreach (string item2 in _trapQueue) { if (num >= maxVisible) { break; } list.Add(item2); num++; } return (item, list); } public void Cleanup() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown if (_session != null) { _session.Socket.PacketReceived -= new PacketReceivedHandler(OnPacketReceived); } _session = null; _isEnabled = false; _trapQueue.Clear(); _priorityTrap = null; } } public class ArchipelagoUI : MonoBehaviour { private PeakArchipelagoPlugin _plugin; private Texture2D _whiteIcon; private Texture2D _colorIcon; private const int ICON_SIZE = 32; private const int ICON_MARGIN = 10; private GameObject _canvasObject; private RawImage _iconImage; private TextMeshProUGUI _versionTMP; private TextMeshProUGUI _statusTMP; private bool _setupAttempted; private RectTransform _iconRect; public void Initialize(PeakArchipelagoPlugin plugin) { _plugin = plugin; LoadIcons(); } private void LoadIcons() { _whiteIcon = LoadEmbeddedTexture("PeakArchipelagoPlugin.white-icon.png"); _colorIcon = LoadEmbeddedTexture("PeakArchipelagoPlugin.color-icon.png"); } private Texture2D LoadEmbeddedTexture(string resourceName) { //IL_0030: 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_003c: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown try { using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName); if (stream == null) { return null; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); ImageConversion.LoadImage(val, array); ((Texture)val).filterMode = (FilterMode)1; return val; } catch { return null; } } private void SetupUI() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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_011b: 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_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Expected O, but got Unknown //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Expected O, but got Unknown //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) if (_setupAttempted) { return; } VersionString val = Object.FindFirstObjectByType(); if (!((Object)(object)val == (Object)null)) { TextMeshProUGUI component = ((Component)val).GetComponent(); if (!((Object)(object)component == (Object)null)) { _setupAttempted = true; _canvasObject = new GameObject("PeakPelagoOverlay"); Canvas obj = _canvasObject.AddComponent(); obj.renderMode = (RenderMode)0; obj.sortingOrder = 100; _canvasObject.AddComponent(); GameObject val2 = new GameObject("Icon"); val2.transform.SetParent(_canvasObject.transform, false); _iconImage = val2.AddComponent(); _iconImage.texture = (Texture)(object)_whiteIcon; ((Graphic)_iconImage).raycastTarget = false; _iconRect = val2.GetComponent(); _iconRect.anchorMin = new Vector2(0f, 0f); _iconRect.anchorMax = new Vector2(0f, 0f); _iconRect.pivot = new Vector2(0.5f, 0.5f); _iconRect.anchoredPosition = new Vector2(26f, 26f); _iconRect.sizeDelta = new Vector2(32f, 32f); GameObject val3 = new GameObject("VersionText"); val3.transform.SetParent(_canvasObject.transform, false); _versionTMP = val3.AddComponent(); ((TMP_Text)_versionTMP).font = ((TMP_Text)component).font; ((TMP_Text)_versionTMP).fontSize = ((TMP_Text)component).fontSize; ((TMP_Text)_versionTMP).fontStyle = ((TMP_Text)component).fontStyle; ((Graphic)_versionTMP).color = ((Graphic)component).color; ((TMP_Text)_versionTMP).alignment = (TextAlignmentOptions)4097; ((TMP_Text)_versionTMP).text = "v" + ((BaseUnityPlugin)_plugin).Info.Metadata.Version; ((Graphic)_versionTMP).raycastTarget = false; RectTransform component2 = val3.GetComponent(); component2.anchorMin = new Vector2(0f, 0f); component2.anchorMax = new Vector2(0f, 0f); component2.pivot = new Vector2(0f, 0f); component2.anchoredPosition = new Vector2(46f, 10f); component2.sizeDelta = new Vector2(200f, 32f); GameObject val4 = new GameObject("StatusText"); val4.transform.SetParent(_canvasObject.transform, false); _statusTMP = val4.AddComponent(); ((TMP_Text)_statusTMP).font = ((TMP_Text)component).font; ((TMP_Text)_statusTMP).fontSize = ((TMP_Text)component).fontSize * 0.85f; ((Graphic)_statusTMP).color = Color.white; ((TMP_Text)_statusTMP).alignment = (TextAlignmentOptions)1025; ((TMP_Text)_statusTMP).text = ""; ((Graphic)_statusTMP).raycastTarget = false; RectTransform component3 = val4.GetComponent(); component3.anchorMin = new Vector2(0f, 0f); component3.anchorMax = new Vector2(0f, 0f); component3.pivot = new Vector2(0f, 0f); component3.anchoredPosition = new Vector2(10f, 46f); component3.sizeDelta = new Vector2(300f, 40f); } } } private void Update() { //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_0121: 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_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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_0153: 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_0162: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_plugin == (Object)null) { return; } if ((Object)(object)_canvasObject == (Object)null) { _setupAttempted = false; SetupUI(); } if ((Object)(object)_iconImage == (Object)null) { return; } bool num = _plugin.Status == "Connected"; bool isConnecting = _plugin._isConnecting; bool isReconnecting = _plugin.IsReconnecting; float num2; bool flag; if (num) { _iconImage.texture = (Texture)(object)(_colorIcon ?? _whiteIcon); num2 = 1f; flag = false; } else if (isConnecting || isReconnecting) { _iconImage.texture = (Texture)(object)_whiteIcon; num2 = 1f; flag = true; } else { _iconImage.texture = (Texture)(object)_whiteIcon; num2 = 0.75f; flag = false; } ((Graphic)_iconImage).color = new Color(1f, 1f, 1f, num2); if (flag) { float num3 = Time.unscaledTime * 90f % 360f; ((Transform)_iconRect).localRotation = Quaternion.Euler(0f, 0f, 0f - num3); } else { ((Transform)_iconRect).localRotation = Quaternion.identity; } if ((Object)(object)_versionTMP != (Object)null) { Color color = ((Graphic)_versionTMP).color; ((Graphic)_versionTMP).color = new Color(color.r, color.g, color.b, num2); } if (!((Object)(object)_statusTMP != (Object)null)) { return; } if (isReconnecting) { int reconnectAttempts = _plugin._reconnectAttempts; int num4 = 10; int offlineCheckCount = _plugin.OfflineCheckCount; string text = (isConnecting ? $"Connecting... (Attempt {reconnectAttempts}/{num4})" : $"Waiting to reconnect... ({reconnectAttempts}/{num4})"); if (offlineCheckCount > 0) { text += $"\n{offlineCheckCount} checks queued"; } ((TMP_Text)_statusTMP).text = text; } else if (isConnecting) { ((TMP_Text)_statusTMP).text = "Connecting..."; } else { ((TMP_Text)_statusTMP).text = ""; } } private void OnDestroy() { if ((Object)(object)_canvasObject != (Object)null) { Object.Destroy((Object)(object)_canvasObject); } } } public class ArchipelagoSettingsPage : UIPage, IHaveParentPage, INavigationPage { [CompilerGenerated] private sealed class d__32 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public RectTransform container; private List.Enumerator <>7__wrap1; private CanvasGroup 5__3; private float 5__4; private float 5__5; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__32(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } <>7__wrap1 = default(List.Enumerator); 5__3 = 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_0109; } <>1__state = -1; List list = new List(); for (int i = 0; i < ((Transform)container).childCount; i++) { Transform child = ((Transform)container).GetChild(i); CanvasGroup val = ((Component)child).GetComponent(); if ((Object)(object)val == (Object)null) { val = ((Component)child).gameObject.AddComponent(); } val.alpha = 0f; list.Add(val); } <>7__wrap1 = list.GetEnumerator(); <>1__state = -3; goto IL_012e; IL_0109: if (5__4 < 5__5) { 5__4 += Time.unscaledDeltaTime; 5__3.alpha = Mathf.Clamp01(5__4 / 5__5); <>2__current = null; <>1__state = 1; return true; } 5__3.alpha = 1f; 5__3 = null; goto IL_012e; IL_012e: if (<>7__wrap1.MoveNext()) { 5__3 = <>7__wrap1.Current; 5__4 = 0f; 5__5 = 0.15f; goto IL_0109; } <>m__Finally1(); <>7__wrap1 = default(List.Enumerator); return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>7__wrap1).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__59 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ArchipelagoSettingsPage <>4__this; private Canvas 5__2; private RectTransform 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__59(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; 5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_005b: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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) //IL_009e: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; ArchipelagoSettingsPage archipelagoSettingsPage = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; 5__2 = ((Component)archipelagoSettingsPage).GetComponentInParent(); Canvas obj = 5__2; 5__3 = ((obj != null) ? ((Component)obj).GetComponent() : null); if ((Object)(object)5__3 == (Object)null) { return false; } break; } case 1: <>1__state = -1; break; } if ((Object)(object)archipelagoSettingsPage._tooltipRoot != (Object)null && ((Component)archipelagoSettingsPage._tooltipRoot).gameObject.activeSelf) { Vector2 val = default(Vector2); RectTransformUtility.ScreenPointToLocalPointInRectangle(5__3, Vector2.op_Implicit(Input.mousePosition), 5__2.worldCamera, ref val); ((Transform)archipelagoSettingsPage._tooltipRoot).position = ((Transform)5__3).TransformPoint(Vector2.op_Implicit(val + new Vector2(0f, 25f))); <>2__current = null; <>1__state = 1; return true; } 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(); } } [CompilerGenerated] private sealed class d__31 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ArchipelagoSettingsPage <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__31(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; ArchipelagoSettingsPage archipelagoSettingsPage = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; archipelagoSettingsPage.LoadSettings(); 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(); } } private bool _built; private TMP_InputField _serverField; private TMP_InputField _portField; private TMP_InputField _slotField; private TMP_InputField _passwordField; private Button _connectButton; private TextMeshProUGUI _connectButtonText; private TextMeshProUGUI _statusText; private Button _backButton; private Button _connectionTabBtn; private Button _linksTabBtn; private Button _trackerTabBtn; private RectTransform _connectionContent; private RectTransform _linksContent; private RectTransform _trackerContent; private const string PREFS_SERVER = "PeakPelago_ServerUrl"; private const string PREFS_PORT = "PeakPelago_Port"; private const string PREFS_SLOT = "PeakPelago_SlotName"; private const string PREFS_PASSWORD = "PeakPelago_Password"; private TMP_FontAsset _font; private TMP_FontAsset _tabFont; private ColorBlock _buttonColors; private Sprite _buttonSprite; private SpriteState _buttonSpriteState; private Sprite _blurSprite; private Material _blurMaterial; private Sprite _blurOutlineSprite; private Sprite _arrowSprite; public static GameObject TemplateInputCell; public static GameObject TemplateDropdownCell; private RectTransform _trackerScrollContent; private TextMeshProUGUI _trackerTooltip; private static readonly string[] BiomeNames = new string[5] { "Shore", "Tropics / Roots", "Mesa / Alpine", "Caldera", "Kiln" }; private static readonly int[] BiomeMountainReq = new int[5] { 0, 1, 2, 3, 4 }; private RectTransform _tooltipRoot; public override void OnPageEnter() { ((UIPage)this).OnPageEnter(); if (!_built) { if ((Object)(object)TemplateInputCell == (Object)null || (Object)(object)TemplateDropdownCell == (Object)null) { UIPageHandler componentInParent = ((Component)this).GetComponentInParent(); PauseMenuSettingsMenuPage val = ((componentInParent != null) ? ((Component)componentInParent).GetComponentInChildren(true) : null); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.SetActive(true); ((Component)val).gameObject.SetActive(false); } } BuildUI(); } ((MonoBehaviour)this).StartCoroutine(LoadSettingsDelayed()); RectTransform container = (((Component)_connectionContent).gameObject.activeSelf ? _connectionContent : _linksContent); ((MonoBehaviour)this).StartCoroutine(AnimateRowsIn(container)); UpdateStatus(); } [IteratorStateMachine(typeof(d__31))] private IEnumerator LoadSettingsDelayed() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__31(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__32))] private IEnumerator AnimateRowsIn(RectTransform container) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__32(0) { container = container }; } private void Update() { if (_built) { UpdateStatus(); } } private void UpdateStatus() { //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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) PeakArchipelagoPlugin instance = PeakArchipelagoPlugin._instance; if ((Object)(object)instance == (Object)null) { return; } bool flag = instance.Status == "Connected"; bool isConnecting = instance._isConnecting; if ((Object)(object)_connectButtonText != (Object)null) { if (flag) { ((TMP_Text)_connectButtonText).text = "Disconnect"; } else if (isConnecting) { ((TMP_Text)_connectButtonText).text = "Connecting..."; } else { ((TMP_Text)_connectButtonText).text = "Connect"; } } if ((Object)(object)_statusText != (Object)null) { ((TMP_Text)_statusText).text = instance.Status; ((Graphic)_statusText).color = (flag ? new Color(0.4f, 1f, 0.4f) : (isConnecting ? new Color(1f, 1f, 0.4f) : new Color(1f, 1f, 1f, 0.6f))); } if ((Object)(object)_connectButton != (Object)null) { ((Selectable)_connectButton).interactable = !isConnecting; } } private void GrabStyling() { //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_0219: 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) UIPageHandler componentInParent = ((Component)this).GetComponentInParent(); PauseMenuSettingsMenuPage val = ((componentInParent != null) ? ((Component)componentInParent).GetComponentInChildren(true) : null); if ((Object)(object)val != (Object)null) { SharedSettingsMenu componentInChildren = ((Component)val).GetComponentInChildren(true); object obj; if (componentInChildren == null) { obj = null; } else { Transform obj2 = ((Component)componentInChildren).transform.Find("Header"); obj = ((obj2 != null) ? ((Component)obj2).GetComponent() : null); } TextMeshProUGUI val2 = (TextMeshProUGUI)obj; if ((Object)(object)val2 != (Object)null) { _font = ((TMP_Text)val2).font; } else { TextMeshProUGUI componentInChildren2 = ((Component)val).GetComponentInChildren(true); if ((Object)(object)componentInChildren2 != (Object)null) { _font = ((TMP_Text)componentInChildren2).font; } } } if ((Object)(object)_font == (Object)null) { TextMeshProUGUI val3 = ((componentInParent != null) ? ((Component)componentInParent).GetComponentInChildren(true) : null); if ((Object)(object)val3 != (Object)null) { _font = ((TMP_Text)val3).font; } } Image[] array = Resources.FindObjectsOfTypeAll(); foreach (Image val4 in array) { if (!((Object)(object)val4.sprite == (Object)null)) { if (((Object)val4.sprite).name == "UI_Blur" && (Object)(object)_blurSprite == (Object)null) { _blurSprite = val4.sprite; _blurMaterial = ((Graphic)val4).material; } else if (((Object)val4.sprite).name == "UI_Blur_Outlne_Thick" && (Object)(object)_blurOutlineSprite == (Object)null) { _blurOutlineSprite = val4.sprite; } else if (((Object)val4.sprite).name == "Reticle_Climb" && (Object)(object)_arrowSprite == (Object)null) { _arrowSprite = val4.sprite; } if ((Object)(object)_blurSprite != (Object)null && (Object)(object)_blurOutlineSprite != (Object)null && (Object)(object)_arrowSprite != (Object)null) { break; } } } PauseMenuMainPage val5 = ((componentInParent != null) ? ((Component)componentInParent).GetComponentInChildren(true) : null); if (!((Object)(object)val5 != (Object)null)) { return; } Button settingsButton = val5.m_settingsButton; if ((Object)(object)settingsButton != (Object)null) { _buttonColors = ((Selectable)settingsButton).colors; Image component = ((Component)settingsButton).GetComponent(); if ((Object)(object)component != (Object)null) { _buttonSprite = component.sprite; } _buttonSpriteState = ((Selectable)settingsButton).spriteState; } } private void BuildUI() { //IL_0012: 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_0029: 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_0094: 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_00be: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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_013e: 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_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_021a: 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_0396: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: 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_03da: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Unknown result type (might be due to invalid IL or missing references) //IL_05e5: Unknown result type (might be due to invalid IL or missing references) //IL_05ff: Unknown result type (might be due to invalid IL or missing references) //IL_0619: Unknown result type (might be due to invalid IL or missing references) //IL_0646: Unknown result type (might be due to invalid IL or missing references) //IL_0650: Expected O, but got Unknown //IL_0662: Unknown result type (might be due to invalid IL or missing references) //IL_066c: Expected O, but got Unknown //IL_067e: Unknown result type (might be due to invalid IL or missing references) //IL_0688: Expected O, but got Unknown _built = true; GrabStyling(); GameObject val2 = new GameObject("Header"); val2.transform.SetParent(((Component)this).transform, false); TextMeshProUGUI val3 = val2.AddComponent(); ((TMP_Text)val3).text = "ARCHIPELAGO"; ((TMP_Text)val3).fontSize = 48f; ((TMP_Text)val3).fontStyle = (FontStyles)0; ((Graphic)val3).color = Color.white; ((TMP_Text)val3).alignment = (TextAlignmentOptions)4097; if ((Object)(object)_font != (Object)null) { ((TMP_Text)val3).font = _font; } ((Graphic)val3).raycastTarget = false; RectTransform component = val2.GetComponent(); component.anchorMin = new Vector2(0f, 1f); component.anchorMax = new Vector2(0f, 1f); component.pivot = new Vector2(0f, 0.5f); component.anchoredPosition = new Vector2(30f, -59.5f); component.sizeDelta = new Vector2(400f, 64.9f); ((TMP_Text)val3).overflowMode = (TextOverflowModes)0; ((TMP_Text)val3).textWrappingMode = (TextWrappingModes)0; _backButton = CreateBackButton(); RectTransform val4 = CreateChild(((Component)this).transform, "Content"); val4.anchorMin = Vector2.zero; val4.anchorMax = Vector2.one; val4.anchoredPosition = new Vector2(148.64f, -19.73f); val4.sizeDelta = new Vector2(-558.73f, -101.31f); RectTransform val5 = CreateChild((Transform)(object)val4, "Parent"); val5.anchorMin = Vector2.zero; val5.anchorMax = Vector2.one; val5.anchoredPosition = new Vector2(0f, -30.92f); val5.sizeDelta = new Vector2(0f, -61.85f); VerticalLayoutGroup obj = ((Component)val5).gameObject.AddComponent(); ((HorizontalOrVerticalLayoutGroup)obj).spacing = 4f; ((LayoutGroup)obj).childAlignment = (TextAnchor)1; ((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false; RectTransform val6 = CreateChild((Transform)(object)val4, "TABS"); val6.anchorMin = new Vector2(0f, 1f); val6.anchorMax = new Vector2(1f, 1f); val6.anchoredPosition = Vector2.zero; val6.sizeDelta = new Vector2(0f, 40f); HorizontalLayoutGroup obj2 = ((Component)val6).gameObject.AddComponent(); ((HorizontalOrVerticalLayoutGroup)obj2).spacing = 8f; ((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = true; _connectionTabBtn = CreateTabButton(val6, "CONNECTION"); _linksTabBtn = CreateTabButton(val6, "LINKS"); _trackerTabBtn = CreateTabButton(val6, "TRACKER"); Button connectionTabBtn = _connectionTabBtn; TextMeshProUGUI val7 = ((connectionTabBtn != null) ? ((Component)connectionTabBtn).GetComponentInChildren(true) : null); if ((Object)(object)val7 != (Object)null) { _tabFont = ((TMP_Text)val7).font; } _connectionContent = val5; _serverField = CreateInputRow(val5, "SERVER", "archipelago.gg"); _portField = CreateInputRow(val5, "PORT", "38281"); _slotField = CreateInputRow(val5, "SLOT NAME", ""); _passwordField = CreateInputRow(val5, "PASSWORD", ""); _passwordField.contentType = (ContentType)7; CreateSpacer(val5, 16f); _statusText = CreateLabel(val5, "Status", "Disconnected", 22, (TextAlignmentOptions)514); CreateSpacer(val5, 8f); _connectButton = CreateConnectButton(val5); _linksContent = CreateChild((Transform)(object)val4, "LinksParent"); _linksContent.anchorMin = Vector2.zero; _linksContent.anchorMax = Vector2.one; _linksContent.anchoredPosition = new Vector2(0f, -30.92f); _linksContent.sizeDelta = new Vector2(0f, -61.85f); VerticalLayoutGroup obj3 = ((Component)_linksContent).gameObject.AddComponent(); ((HorizontalOrVerticalLayoutGroup)obj3).spacing = 4f; ((LayoutGroup)obj3).childAlignment = (TextAnchor)1; ((HorizontalOrVerticalLayoutGroup)obj3).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj3).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)obj3).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj3).childForceExpandHeight = false; CreateLinkToggleRow(_linksContent, "DEATH LINK", delegate { PeakArchipelagoPlugin instance6 = PeakArchipelagoPlugin._instance; return (Object)(object)instance6 != (Object)null && instance6._deathLinkEnabled && instance6.cfgDeathLinkEnabled.Value; }, delegate(bool val) { PeakArchipelagoPlugin instance5 = PeakArchipelagoPlugin._instance; if (!((Object)(object)instance5 == (Object)null)) { instance5._deathLinkEnabled = val; instance5.cfgDeathLinkEnabled.Value = val; if (val) { DeathLinkService deathLinkService = instance5._deathLinkService; if (deathLinkService != null) { deathLinkService.EnableDeathLink(); } } else { DeathLinkService deathLinkService2 = instance5._deathLinkService; if (deathLinkService2 != null) { deathLinkService2.DisableDeathLink(); } } instance5.SendUpdatedLinkTags(); } }); CreateLinkToggleRow(_linksContent, "RING LINK", () => PeakArchipelagoPlugin._instance?._ringLinkEnabled ?? false, delegate(bool val) { PeakArchipelagoPlugin instance4 = PeakArchipelagoPlugin._instance; if (!((Object)(object)instance4 == (Object)null)) { instance4._ringLinkEnabled = val; instance4._ringLinkService?.SetEnabled(val); instance4.SendUpdatedLinkTags(); } }); CreateLinkToggleRow(_linksContent, "HARD RING LINK", () => PeakArchipelagoPlugin._instance?._hardRingLinkEnabled ?? false, delegate(bool val) { PeakArchipelagoPlugin instance3 = PeakArchipelagoPlugin._instance; if (!((Object)(object)instance3 == (Object)null)) { instance3._hardRingLinkEnabled = val; instance3._hardRingLinkService?.SetEnabled(val); instance3.SendUpdatedLinkTags(); } }); CreateLinkToggleRow(_linksContent, "TRAP LINK", () => PeakArchipelagoPlugin._instance?._trapLinkEnabled ?? false, delegate(bool val) { PeakArchipelagoPlugin instance2 = PeakArchipelagoPlugin._instance; if (!((Object)(object)instance2 == (Object)null)) { instance2._trapLinkEnabled = val; instance2._trapLinkService?.SetEnabled(val); instance2.SendUpdatedLinkTags(); } }); CreateLinkToggleRow(_linksContent, "BREATH LINK", () => PeakArchipelagoPlugin._instance?._breathLinkEnabled ?? false, delegate(bool val) { PeakArchipelagoPlugin instance = PeakArchipelagoPlugin._instance; if (!((Object)(object)instance == (Object)null)) { instance._breathLinkEnabled = val; instance._breathLinkService?.SetEnabled(val); instance.SendUpdatedLinkTags(); } }); ((Component)_linksContent).gameObject.SetActive(false); _trackerContent = CreateChild((Transform)(object)val4, "TrackerParent"); _trackerContent.anchorMin = Vector2.zero; _trackerContent.anchorMax = Vector2.one; _trackerContent.anchoredPosition = new Vector2(0f, -30.92f); _trackerContent.sizeDelta = new Vector2(0f, -61.85f); ((Component)_trackerContent).gameObject.SetActive(false); ((UnityEvent)_connectionTabBtn.onClick).AddListener((UnityAction)delegate { SwitchTab("connection"); }); ((UnityEvent)_linksTabBtn.onClick).AddListener((UnityAction)delegate { SwitchTab("links"); }); ((UnityEvent)_trackerTabBtn.onClick).AddListener((UnityAction)delegate { SwitchTab("tracker"); }); _connectButtonText = ((Component)_connectButton).GetComponentInChildren(); SwitchTab("connection"); } private void LoadSettings() { if ((Object)(object)_serverField != (Object)null) { _serverField.text = PlayerPrefs.GetString("PeakPelago_ServerUrl", "archipelago.gg"); } if ((Object)(object)_portField != (Object)null) { _portField.text = PlayerPrefs.GetString("PeakPelago_Port", "38281"); } if ((Object)(object)_slotField != (Object)null) { _slotField.text = PlayerPrefs.GetString("PeakPelago_SlotName", ""); } if ((Object)(object)_passwordField != (Object)null) { _passwordField.text = PlayerPrefs.GetString("PeakPelago_Password", ""); } } private void SaveSettings() { PlayerPrefs.SetString("PeakPelago_ServerUrl", _serverField.text); PlayerPrefs.SetString("PeakPelago_Port", _portField.text); PlayerPrefs.SetString("PeakPelago_SlotName", _slotField.text); PlayerPrefs.SetString("PeakPelago_Password", _passwordField.text); PlayerPrefs.Save(); } private void OnConnectClicked() { PeakArchipelagoPlugin instance = PeakArchipelagoPlugin._instance; if ((Object)(object)instance == (Object)null) { return; } if (instance.Status == "Connected") { instance._intentionalDisconnect = true; ArchipelagoSession session = instance.Session; if (session != null) { IArchipelagoSocketHelper socket = session.Socket; if (socket != null) { socket.Disconnect(); } } instance._status = "Disconnected"; } else { SaveSettings(); instance.SetConnectionDetails(_serverField.text, _portField.text, _slotField.text, _passwordField.text); instance.Connect(); } } private void OnBackClicked() { base.pageHandler.TransistionToPage(); } public (UIPage, PageTransistion) GetParentPage() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown return (base.pageHandler.GetPage(), (PageTransistion)new SetActivePageTransistion()); } public GameObject GetFirstSelectedGameObject() { if (!((Object)(object)_serverField != (Object)null)) { if (!((Object)(object)_backButton != (Object)null)) { return ((Component)this).gameObject; } return ((Component)_backButton).gameObject; } return ((Component)_serverField).gameObject; } private void CreateLinkToggleRow(RectTransform parent, string label, Func getCurrent, Action setCurrent) { //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0250: 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_0270: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: 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_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_0481: Unknown result type (might be due to invalid IL or missing references) //IL_048c: Unknown result type (might be due to invalid IL or missing references) //IL_04a1: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_04da: Unknown result type (might be due to invalid IL or missing references) //IL_052b: 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_0555: Unknown result type (might be due to invalid IL or missing references) //IL_056a: 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_05de: Unknown result type (might be due to invalid IL or missing references) //IL_05f4: Unknown result type (might be due to invalid IL or missing references) //IL_060a: Unknown result type (might be due to invalid IL or missing references) //IL_0616: 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_0646: Unknown result type (might be due to invalid IL or missing references) //IL_0675: Unknown result type (might be due to invalid IL or missing references) //IL_0681: Unknown result type (might be due to invalid IL or missing references) //IL_068d: Unknown result type (might be due to invalid IL or missing references) //IL_06a3: Unknown result type (might be due to invalid IL or missing references) //IL_06de: Unknown result type (might be due to invalid IL or missing references) //IL_0713: Unknown result type (might be due to invalid IL or missing references) //IL_0729: Unknown result type (might be due to invalid IL or missing references) //IL_0735: Unknown result type (might be due to invalid IL or missing references) //IL_074b: Unknown result type (might be due to invalid IL or missing references) //IL_0778: Unknown result type (might be due to invalid IL or missing references) //IL_078e: Unknown result type (might be due to invalid IL or missing references) //IL_07a4: Unknown result type (might be due to invalid IL or missing references) //IL_07c8: Unknown result type (might be due to invalid IL or missing references) //IL_07d3: Unknown result type (might be due to invalid IL or missing references) //IL_07e8: Unknown result type (might be due to invalid IL or missing references) //IL_07fd: Unknown result type (might be due to invalid IL or missing references) //IL_0815: Unknown result type (might be due to invalid IL or missing references) //IL_083f: Unknown result type (might be due to invalid IL or missing references) //IL_0854: Unknown result type (might be due to invalid IL or missing references) //IL_0869: Unknown result type (might be due to invalid IL or missing references) //IL_087e: Unknown result type (might be due to invalid IL or missing references) //IL_08aa: Unknown result type (might be due to invalid IL or missing references) //IL_08c9: Unknown result type (might be due to invalid IL or missing references) //IL_08d4: Unknown result type (might be due to invalid IL or missing references) //IL_08e9: Unknown result type (might be due to invalid IL or missing references) //IL_08f4: Unknown result type (might be due to invalid IL or missing references) //IL_0918: Unknown result type (might be due to invalid IL or missing references) //IL_096c: Unknown result type (might be due to invalid IL or missing references) //IL_0982: Unknown result type (might be due to invalid IL or missing references) //IL_0998: Unknown result type (might be due to invalid IL or missing references) //IL_09c6: Unknown result type (might be due to invalid IL or missing references) //IL_0a06: Unknown result type (might be due to invalid IL or missing references) //IL_0a12: Unknown result type (might be due to invalid IL or missing references) //IL_0a28: Unknown result type (might be due to invalid IL or missing references) //IL_0a3e: Unknown result type (might be due to invalid IL or missing references) //IL_0a59: Unknown result type (might be due to invalid IL or missing references) //IL_0a65: Unknown result type (might be due to invalid IL or missing references) //IL_0a7b: Unknown result type (might be due to invalid IL or missing references) //IL_0a91: Unknown result type (might be due to invalid IL or missing references) //IL_0aab: Unknown result type (might be due to invalid IL or missing references) TMP_Dropdown val2 = null; if ((Object)(object)TemplateDropdownCell != (Object)null) { GameObject val3 = Object.Instantiate(TemplateDropdownCell, (Transform)(object)parent); ((Object)val3).name = label + "Row"; Component[] componentsInChildren = val3.GetComponentsInChildren(true); foreach (Component val4 in componentsInChildren) { if (!((Object)(object)val4 == (Object)null)) { string name = ((object)val4).GetType().Name; if (name.Contains("Localize") || name.Contains("SettingUI") || name.Contains("EnumSettingUI") || name == "SettingsUICell") { Object.DestroyImmediate((Object)(object)val4); } } } Transform obj = val3.transform.Find("Text (TMP)"); TextMeshProUGUI val5 = ((obj != null) ? ((Component)obj).GetComponent() : null); if ((Object)(object)val5 != (Object)null) { ((TMP_Text)val5).text = label; } Transform val6 = val3.transform.Find("OnlyOnMainMenu"); if ((Object)(object)val6 != (Object)null) { ((Component)val6).gameObject.SetActive(false); } val2 = val3.GetComponentInChildren(true); if ((Object)(object)val2 != (Object)null) { val2.ClearOptions(); val2.AddOptions(new List { "OFF", "ON" }); } LayoutElement val7 = val3.GetComponent(); if ((Object)(object)val7 == (Object)null) { val7 = val3.AddComponent(); } val7.preferredHeight = 90f; } if ((Object)(object)val2 == (Object)null) { RectTransform val8 = CreateChild((Transform)(object)parent, label + "Row"); ((Component)val8).gameObject.AddComponent().preferredHeight = 90f; RectTransform obj2 = CreateChild((Transform)(object)val8, "Image"); obj2.anchorMin = Vector2.zero; obj2.anchorMax = Vector2.one; obj2.offsetMin = Vector2.zero; obj2.offsetMax = Vector2.zero; Image val9 = ((Component)obj2).gameObject.AddComponent(); ((Graphic)val9).color = new Color(0.179f, 0.125f, 0.09f, 0.729f); ApplyBlurSprite(val9); RectTransform obj3 = CreateChild((Transform)(object)val8, "Text (TMP)"); obj3.anchorMin = new Vector2(0f, 0f); obj3.anchorMax = new Vector2(0f, 1f); obj3.pivot = new Vector2(0f, 0.5f); obj3.anchoredPosition = Vector2.zero; obj3.sizeDelta = new Vector2(600f, 0f); TextMeshProUGUI val10 = ((Component)obj3).gameObject.AddComponent(); ((TMP_Text)val10).text = label; ((TMP_Text)val10).fontSize = 28f; ((TMP_Text)val10).alignment = (TextAlignmentOptions)4097; ((Graphic)val10).color = Color.white; if ((Object)(object)_font != (Object)null) { ((TMP_Text)val10).font = _font; } RectTransform val11 = CreateChild((Transform)(object)val8, "InputParent"); val11.anchorMin = new Vector2(1f, 0f); val11.anchorMax = new Vector2(1f, 1f); val11.pivot = new Vector2(1f, 0.5f); val11.sizeDelta = new Vector2(468f, 0f); RectTransform val12 = CreateChild((Transform)(object)val11, "Dropdown"); val12.anchorMin = Vector2.zero; val12.anchorMax = Vector2.one; val12.offsetMin = new Vector2(20f, 15f); val12.offsetMax = new Vector2(-20f, -15f); Image val13 = ((Component)val12).gameObject.AddComponent(); ((Graphic)val13).color = Color.white; ApplyBlurSprite(val13); RectTransform obj4 = CreateChild((Transform)(object)val12, "Border"); obj4.anchorMin = Vector2.zero; obj4.anchorMax = Vector2.one; obj4.offsetMin = Vector2.zero; obj4.offsetMax = Vector2.zero; Image val14 = ((Component)obj4).gameObject.AddComponent(); ((Graphic)val14).color = new Color(0.196f, 0.196f, 0.196f, 1f); if ((Object)(object)_blurOutlineSprite != (Object)null) { val14.sprite = _blurOutlineSprite; val14.type = (Type)1; val14.pixelsPerUnitMultiplier = 15f; } ((Graphic)val14).raycastTarget = false; val2 = ((Component)val12).gameObject.AddComponent(); val2.AddOptions(new List { "OFF", "ON" }); RectTransform obj5 = CreateChild((Transform)(object)val12, "Label"); obj5.anchorMin = Vector2.zero; obj5.anchorMax = Vector2.one; obj5.offsetMin = new Vector2(10f, 0f); obj5.offsetMax = new Vector2(-60f, -5f); TextMeshProUGUI val15 = ((Component)obj5).gameObject.AddComponent(); ((TMP_Text)val15).fontSize = 26f; ((Graphic)val15).color = Color.black; ((TMP_Text)val15).alignment = (TextAlignmentOptions)4097; if ((Object)(object)_font != (Object)null) { ((TMP_Text)val15).font = _font; } val2.captionText = (TMP_Text)(object)val15; RectTransform obj6 = CreateChild((Transform)(object)val12, "Arrow"); obj6.anchorMin = new Vector2(1f, 0.5f); obj6.anchorMax = new Vector2(1f, 0.5f); obj6.anchoredPosition = new Vector2(-21.4f, 0f); obj6.sizeDelta = new Vector2(20f, 20f); Image val16 = ((Component)obj6).gameObject.AddComponent(); ((Graphic)val16).color = new Color(0.196f, 0.196f, 0.196f, 1f); if ((Object)(object)_arrowSprite != (Object)null) { val16.sprite = _arrowSprite; } ((Graphic)val16).raycastTarget = false; RectTransform val17 = CreateChild((Transform)(object)val12, "Template"); val17.anchorMin = new Vector2(0f, 0f); val17.anchorMax = new Vector2(1f, 0f); val17.pivot = new Vector2(0.5f, 1f); val17.anchoredPosition = Vector2.zero; val17.sizeDelta = new Vector2(0f, 150f); Image val18 = ((Component)val17).gameObject.AddComponent(); ((Graphic)val18).color = Color.black; ApplyBlurSprite(val18); ScrollRect obj7 = ((Component)val17).gameObject.AddComponent(); RectTransform val19 = CreateChild((Transform)(object)val17, "Viewport"); val19.anchorMin = Vector2.zero; val19.anchorMax = Vector2.one; val19.offsetMin = Vector2.zero; val19.offsetMax = new Vector2(-17f, 0f); ((Component)val19).gameObject.AddComponent(); Image val20 = ((Component)val19).gameObject.AddComponent(); ((Graphic)val20).color = new Color(0.085f, 0.085f, 0.085f, 1f); ApplyBlurSprite(val20); obj7.viewport = val19; RectTransform val21 = CreateChild((Transform)(object)val19, "Content"); val21.anchorMin = new Vector2(0f, 1f); val21.anchorMax = new Vector2(1f, 1f); val21.anchoredPosition = Vector2.zero; val21.sizeDelta = new Vector2(0f, 40f); obj7.content = val21; RectTransform val22 = CreateChild((Transform)(object)val21, "Item"); val22.anchorMin = new Vector2(0f, 0.5f); val22.anchorMax = new Vector2(1f, 0.5f); val22.sizeDelta = new Vector2(0f, 40f); Toggle obj8 = ((Component)val22).gameObject.AddComponent(); RectTransform obj9 = CreateChild((Transform)(object)val22, "Item Background"); obj9.anchorMin = Vector2.zero; obj9.anchorMax = Vector2.one; obj9.offsetMin = new Vector2(2f, 1f); obj9.offsetMax = new Vector2(-2f, -1f); Image val23 = ((Component)obj9).gameObject.AddComponent(); ((Graphic)val23).color = Color.white; ApplyBlurSprite(val23); RectTransform obj10 = CreateChild((Transform)(object)val22, "Item Checkmark"); obj10.anchorMin = new Vector2(0f, 0f); obj10.anchorMax = new Vector2(0f, 1f); obj10.anchoredPosition = new Vector2(2f, 0f); obj10.sizeDelta = new Vector2(20f, -4f); Image val24 = ((Component)obj10).gameObject.AddComponent(); ((Graphic)val24).color = new Color(1f, 0.63f, 0f, 0.769f); obj8.graphic = (Graphic)(object)val24; RectTransform obj11 = CreateChild((Transform)(object)val22, "Item Label"); obj11.anchorMin = Vector2.zero; obj11.anchorMax = Vector2.one; obj11.offsetMin = new Vector2(20f, 0f); obj11.offsetMax = Vector2.zero; TextMeshProUGUI val25 = ((Component)obj11).gameObject.AddComponent(); ((TMP_Text)val25).fontSize = 24f; ((Graphic)val25).color = Color.black; ((TMP_Text)val25).alignment = (TextAlignmentOptions)4097; if ((Object)(object)_font != (Object)null) { ((TMP_Text)val25).font = _font; } val2.itemText = (TMP_Text)(object)val25; RectTransform val26 = CreateChild((Transform)(object)val17, "Scrollbar"); val26.anchorMin = new Vector2(1f, 0f); val26.anchorMax = new Vector2(1f, 1f); val26.sizeDelta = new Vector2(20f, 0f); Image val27 = ((Component)val26).gameObject.AddComponent(); ((Graphic)val27).color = new Color(0.805f, 0.805f, 0.805f, 1f); ApplyBlurSprite(val27); Scrollbar val28 = ((Component)val26).gameObject.AddComponent(); val28.direction = (Direction)2; obj7.verticalScrollbar = val28; RectTransform val29 = CreateChild((Transform)(object)val26, "Sliding Area"); val29.anchorMin = Vector2.zero; val29.anchorMax = Vector2.one; val29.offsetMin = new Vector2(10f, 10f); val29.offsetMax = new Vector2(-10f, -10f); RectTransform val30 = CreateChild((Transform)(object)val29, "Handle"); val30.anchorMin = Vector2.zero; val30.anchorMax = Vector2.one; val30.offsetMin = new Vector2(-10f, -10f); val30.offsetMax = new Vector2(10f, 10f); Image val31 = ((Component)val30).gameObject.AddComponent(); ((Graphic)val31).color = Color.white; ApplyBlurSprite(val31); val28.handleRect = val30; ((Selectable)val28).targetGraphic = (Graphic)(object)val31; ((Component)val17).gameObject.SetActive(false); val2.template = val17; } val2.SetValueWithoutNotify(getCurrent() ? 1 : 0); ((UnityEvent)(object)val2.onValueChanged).AddListener((UnityAction)delegate(int val) { setCurrent(val == 1); }); ((Component)val2).gameObject.AddComponent().Initialize(val2, getCurrent); } private void SwitchTab(string tab) { //IL_0176: 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_0196: Unknown result type (might be due to invalid IL or missing references) //IL_018f: 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_01af: Unknown result type (might be due to invalid IL or missing references) bool flag = tab == "connection"; bool flag2 = tab == "links"; bool flag3 = tab == "tracker"; ((Component)_connectionContent).gameObject.SetActive(flag); ((Component)_linksContent).gameObject.SetActive(flag2); ((Component)_trackerContent).gameObject.SetActive(flag3); RectTransform container = (flag ? _connectionContent : (flag2 ? _linksContent : _trackerContent)); ((MonoBehaviour)this).StartCoroutine(AnimateRowsIn(container)); Button connectionTabBtn = _connectionTabBtn; Transform val = ((connectionTabBtn != null) ? ((Component)connectionTabBtn).transform.Find("Selected") : null); Button linksTabBtn = _linksTabBtn; Transform val2 = ((linksTabBtn != null) ? ((Component)linksTabBtn).transform.Find("Selected") : null); Button trackerTabBtn = _trackerTabBtn; Transform val3 = ((trackerTabBtn != null) ? ((Component)trackerTabBtn).transform.Find("Selected") : null); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.SetActive(flag); } if ((Object)(object)val2 != (Object)null) { ((Component)val2).gameObject.SetActive(flag2); } if ((Object)(object)val3 != (Object)null) { ((Component)val3).gameObject.SetActive(flag3); } Button connectionTabBtn2 = _connectionTabBtn; TextMeshProUGUI val4 = ((connectionTabBtn2 != null) ? ((Component)connectionTabBtn2).GetComponentInChildren(true) : null); Button linksTabBtn2 = _linksTabBtn; TextMeshProUGUI val5 = ((linksTabBtn2 != null) ? ((Component)linksTabBtn2).GetComponentInChildren(true) : null); Button trackerTabBtn2 = _trackerTabBtn; TextMeshProUGUI val6 = ((trackerTabBtn2 != null) ? ((Component)trackerTabBtn2).GetComponentInChildren(true) : null); if ((Object)(object)val4 != (Object)null) { ((Graphic)val4).color = (flag ? Color.black : Color.white); } if ((Object)(object)val5 != (Object)null) { ((Graphic)val5).color = (flag2 ? Color.black : Color.white); } if ((Object)(object)val6 != (Object)null) { ((Graphic)val6).color = (flag3 ? Color.black : Color.white); } if (flag3) { RefreshTrackerContent(); } } private void EnsureTrackerScroll() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_0043: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Expected O, but got Unknown //IL_01c3: 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) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_021a: 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_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_trackerScrollContent != (Object)null)) { RectTransform val = CreateChild((Transform)(object)_trackerContent, "Viewport"); val.anchorMin = Vector2.zero; val.anchorMax = Vector2.one; val.offsetMin = Vector2.zero; val.offsetMax = Vector2.zero; ((Component)val).gameObject.AddComponent(); Image obj = ((Component)val).gameObject.AddComponent(); ((Graphic)obj).color = new Color(0f, 0f, 0f, 0.01f); ((Graphic)obj).raycastTarget = true; _trackerScrollContent = CreateChild((Transform)(object)val, "ScrollContent"); _trackerScrollContent.anchorMin = new Vector2(0f, 1f); _trackerScrollContent.anchorMax = new Vector2(1f, 1f); _trackerScrollContent.pivot = new Vector2(0.5f, 1f); _trackerScrollContent.offsetMin = Vector2.zero; _trackerScrollContent.offsetMax = Vector2.zero; VerticalLayoutGroup obj2 = ((Component)_trackerScrollContent).gameObject.AddComponent(); ((HorizontalOrVerticalLayoutGroup)obj2).spacing = 6f; ((LayoutGroup)obj2).padding = new RectOffset(10, 10, 5, 10); ((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = false; ((Component)_trackerScrollContent).gameObject.AddComponent().verticalFit = (FitMode)2; ScrollRect obj3 = ((Component)_trackerContent).gameObject.AddComponent(); obj3.content = _trackerScrollContent; obj3.viewport = val; obj3.vertical = true; obj3.horizontal = false; obj3.movementType = (MovementType)2; obj3.scrollSensitivity = 30f; RectTransform val2 = (_tooltipRoot = CreateChild((Transform)(object)_trackerContent, "Tooltip")); val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.zero; val2.pivot = new Vector2(0.5f, 0f); val2.sizeDelta = new Vector2(200f, 30f); RectTransform obj4 = CreateChild((Transform)(object)val2, "Bg"); obj4.anchorMin = Vector2.zero; obj4.anchorMax = Vector2.one; obj4.offsetMin = Vector2.zero; obj4.offsetMax = Vector2.zero; Image obj5 = ((Component)obj4).gameObject.AddComponent(); ((Graphic)obj5).color = new Color(0.1f, 0.07f, 0.05f, 0.95f); ((Graphic)obj5).raycastTarget = false; RectTransform val3 = CreateChild((Transform)(object)val2, "Text"); val3.anchorMin = Vector2.zero; val3.anchorMax = Vector2.one; val3.offsetMin = Vector2.zero; val3.offsetMax = Vector2.zero; _trackerTooltip = ((Component)val3).gameObject.AddComponent(); ((TMP_Text)_trackerTooltip).fontSize = 16f; ((TMP_Text)_trackerTooltip).alignment = (TextAlignmentOptions)514; ((Graphic)_trackerTooltip).color = Color.white; ((Graphic)_trackerTooltip).raycastTarget = false; if ((Object)(object)_font != (Object)null) { ((TMP_Text)_trackerTooltip).font = _font; } ((Component)val2).gameObject.SetActive(false); } } private HashSet GetAcquiredLocationNames() { HashSet hashSet = new HashSet(StringComparer.OrdinalIgnoreCase); PeakArchipelagoPlugin instance = PeakArchipelagoPlugin._instance; if ((Object)(object)instance == (Object)null) { return hashSet; } StateData stateData = instance._stateData; if (stateData == null) { return hashSet; } ArchipelagoSession session = instance._session; if (session == null) { return hashSet; } foreach (long reportedCheck in stateData.ReportedChecks) { string locationNameFromId = session.Locations.GetLocationNameFromId(reportedCheck, "PEAK"); if (locationNameFromId != null) { hashSet.Add(locationNameFromId); } } return hashSet; } private HashSet GetUnlockedItemNames() { HashSet hashSet = new HashSet(StringComparer.OrdinalIgnoreCase); PeakArchipelagoPlugin instance = PeakArchipelagoPlugin._instance; if (instance?._session == null) { return hashSet; } foreach (ItemInfo item in instance._session.Items.AllItemsReceived) { string itemName = instance._session.Items.GetItemName(item.ItemId, item.ItemGame); if (itemName != null) { hashSet.Add(itemName); } } return hashSet; } private void CreateBiomeHeader(RectTransform parent, string biomeName, bool locked, int mountainsNeeded) { //IL_0066: 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_0083: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_0106: Unknown result type (might be due to invalid IL or missing references) RectTransform val = CreateChild((Transform)(object)parent, biomeName + "_Header"); ((Component)val).gameObject.AddComponent().preferredHeight = 36f; Image obj = ((Component)val).gameObject.AddComponent(); ((Graphic)obj).color = (locked ? new Color(0.2f, 0.15f, 0.12f, 0.5f) : new Color(0.3f, 0.2f, 0.15f, 0.85f)); ((Graphic)obj).raycastTarget = false; RectTransform obj2 = CreateChild((Transform)(object)val, "Label"); obj2.anchorMin = Vector2.zero; obj2.anchorMax = Vector2.one; obj2.offsetMin = new Vector2(10f, 0f); obj2.offsetMax = Vector2.zero; TextMeshProUGUI val2 = ((Component)obj2).gameObject.AddComponent(); if (locked) { string arg = ((mountainsNeeded == 1) ? "" : "s"); ((TMP_Text)val2).text = $"Find {mountainsNeeded} Progressive Mountain{arg} to unlock {biomeName}"; ((Graphic)val2).color = new Color(0.5f, 0.45f, 0.4f, 0.8f); } else { ((TMP_Text)val2).text = biomeName; ((Graphic)val2).color = Color.white; } ((TMP_Text)val2).fontSize = 22f; ((TMP_Text)val2).fontStyle = (FontStyles)1; ((TMP_Text)val2).alignment = (TextAlignmentOptions)4097; ((Graphic)val2).raycastTarget = false; if ((Object)(object)_tabFont != (Object)null) { ((TMP_Text)val2).font = _tabFont; } else if ((Object)(object)_font != (Object)null) { ((TMP_Text)val2).font = _font; } } private void CreateIconGrid(RectTransform parent, List acquireLocNames, HashSet acquired, HashSet unlocked, bool itemSanity) { //IL_0023: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_017f: 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_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: 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) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Expected O, but got Unknown //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Expected O, but got Unknown //IL_0258: 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_0224: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0312: 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_031b: Expected O, but got Unknown RectTransform val = CreateChild((Transform)(object)parent, "IconGrid"); GridLayoutGroup obj = ((Component)val).gameObject.AddComponent(); obj.cellSize = new Vector2(56f, 56f); obj.spacing = new Vector2(4f, 4f); ((LayoutGroup)obj).padding = new RectOffset(8, 8, 4, 4); ((LayoutGroup)obj).childAlignment = (TextAnchor)0; obj.constraint = (Constraint)0; ((Component)val).gameObject.AddComponent().verticalFit = (FitMode)2; int num = 0; Item val3 = default(Item); foreach (string acquireLocName in acquireLocNames) { string text = (acquireLocName.StartsWith("Acquire ") ? acquireLocName.Substring(8) : acquireLocName); string text2 = text + " Unlock"; string text3 = null; ushort value = 0; if (ItemIdMappings.ApNameToInternalName.TryGetValue(text2, out var value2)) { text3 = value2; ItemIdMappings.NameToId.TryGetValue(text3, out value); } bool flag = acquired.Contains(acquireLocName); bool flag2 = !itemSanity || unlocked.Contains(text2); Texture2D val2 = null; if (text3 != null && ItemDatabase.TryGetItem(value, ref val3)) { val2 = val3.UIData?.icon; } RectTransform val4 = CreateChild((Transform)(object)((Component)val).GetComponent(), text + "_Icon"); ((Graphic)((Component)val4).gameObject.AddComponent()).color = (flag ? new Color(0.2f, 0.35f, 0.2f, 0.7f) : new Color(0.15f, 0.12f, 0.1f, 0.6f)); if ((Object)(object)val2 != (Object)null) { RectTransform obj2 = CreateChild((Transform)(object)val4, "Icon"); obj2.anchorMin = new Vector2(0.1f, 0.1f); obj2.anchorMax = new Vector2(0.9f, 0.9f); obj2.offsetMin = Vector2.zero; obj2.offsetMax = Vector2.zero; RawImage val5 = ((Component)obj2).gameObject.AddComponent(); val5.texture = (Texture)(object)val2; ((Graphic)val5).raycastTarget = false; if (!flag && itemSanity && !flag2) { ((Graphic)val5).color = new Color(0f, 0f, 0f, 0.8f); } else if (!flag) { ((Graphic)val5).color = new Color(0.3f, 0.3f, 0.3f, 0.7f); } else { ((Graphic)val5).color = Color.white; } } bool isLocked = !flag && itemSanity && !flag2; string capturedUnlockName = text2; string capturedItemName = text; EventTrigger val6 = ((Component)val4).gameObject.AddComponent(); Entry val7 = new Entry { eventID = (EventTriggerType)0 }; ((UnityEvent)(object)val7.callback).AddListener((UnityAction)delegate { PeakArchipelagoPlugin instance = PeakArchipelagoPlugin._instance; if (isLocked && (Object)(object)instance != (Object)null && instance._activeHints.TryGetValue(capturedUnlockName, out var value3)) { ShowTrackerTooltip(value3); } else if (isLocked) { ShowTrackerTooltip(GetHintCostText()); } else { ShowTrackerTooltip(capturedItemName); } }); val6.triggers.Add(val7); Entry val8 = new Entry { eventID = (EventTriggerType)1 }; ((UnityEvent)(object)val8.callback).AddListener((UnityAction)delegate { HideTrackerTooltip(); }); val6.triggers.Add(val8); if (isLocked) { Entry val9 = new Entry { eventID = (EventTriggerType)4 }; ((UnityEvent)(object)val9.callback).AddListener((UnityAction)delegate { OnLockedItemClicked(capturedUnlockName); }); val6.triggers.Add(val9); } num++; } } private void ShowTrackerTooltip(string text) { if (!((Object)(object)_trackerTooltip == (Object)null) && !((Object)(object)_tooltipRoot == (Object)null)) { ((TMP_Text)_trackerTooltip).text = text; ((Component)_tooltipRoot).gameObject.SetActive(true); ((MonoBehaviour)this).StartCoroutine(FollowMouseTooltip()); } } private void HideTrackerTooltip() { if (!((Object)(object)_tooltipRoot == (Object)null)) { ((Component)_tooltipRoot).gameObject.SetActive(false); } } private string GetHintCostText() { PeakArchipelagoPlugin instance = PeakArchipelagoPlugin._instance; if (instance?._session == null) { return "Not connected"; } try { int hintCost = instance._session.RoomState.HintCost; int hintPoints = instance._session.RoomState.HintPoints; return $"Click to hint ({hintCost} pts, you have {hintPoints})"; } catch { return "Click to hint"; } } private void OnLockedItemClicked(string unlockName) { //IL_006f: 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_0086: Expected O, but got Unknown PeakArchipelagoPlugin instance = PeakArchipelagoPlugin._instance; if (instance?._session == null || instance._activeHints.ContainsKey(unlockName)) { return; } try { int hintCost = instance._session.RoomState.HintCost; int hintPoints = instance._session.RoomState.HintPoints; if (hintPoints < hintCost) { ShowTrackerTooltip($"Not enough points ({hintPoints}/{hintCost})"); return; } } catch { } try { SayPacket val = new SayPacket { Text = "!hint " + unlockName }; instance._session.Socket.SendPacket((ArchipelagoPacketBase)(object)val); ShowTrackerTooltip("Hinting..."); } catch (Exception ex) { ShowTrackerTooltip("Hint failed"); ManualLogSource log = instance._log; if (log != null) { log.LogWarning((object)("[PeakPelago] Hint request failed: " + ex.Message)); } } } [IteratorStateMachine(typeof(d__59))] private IEnumerator FollowMouseTooltip() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__59(0) { <>4__this = this }; } private void RefreshTrackerContent() { EnsureTrackerScroll(); for (int num = ((Transform)_trackerScrollContent).childCount - 1; num >= 0; num--) { Object.Destroy((Object)(object)((Component)((Transform)_trackerScrollContent).GetChild(num)).gameObject); } PeakArchipelagoPlugin instance = PeakArchipelagoPlugin._instance; if ((Object)(object)instance == (Object)null || instance._lootBiomeAssignments == null || instance._lootBiomeAssignments.Count == 0) { CreateBiomeHeader(_trackerScrollContent, "Connect to a server to see loot assignments", locked: false, 0); return; } bool itemSanityEnabled = instance._itemSanityEnabled; int progressiveMountainCount = instance._progressiveMountainCount; HashSet acquiredLocationNames = GetAcquiredLocationNames(); HashSet unlockedItemNames = GetUnlockedItemNames(); Dictionary> dictionary = new Dictionary>(); foreach (KeyValuePair lootBiomeAssignment in instance._lootBiomeAssignments) { if (!dictionary.ContainsKey(lootBiomeAssignment.Value)) { dictionary[lootBiomeAssignment.Value] = new List(); } dictionary[lootBiomeAssignment.Value].Add(lootBiomeAssignment.Key); } for (int i = 0; i < BiomeNames.Length; i++) { if (dictionary.ContainsKey(i)) { List list = dictionary[i]; list.Sort(); int num2 = BiomeMountainReq[i]; bool flag = num2 > 0 && progressiveMountainCount < num2; CreateBiomeHeader(_trackerScrollContent, BiomeNames[i].ToUpper(), flag, num2); if (!flag) { CreateIconGrid(_trackerScrollContent, list, acquiredLocationNames, unlockedItemNames, itemSanityEnabled); } } } } private Button CreateTabButton(RectTransform parent, string label) { //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Expected O, but got Unknown //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) UIPageHandler componentInParent = ((Component)this).GetComponentInParent(); PauseMenuSettingsMenuPage obj = ((componentInParent != null) ? ((Component)componentInParent).GetComponentInChildren(true) : null); SharedSettingsMenu obj2 = ((obj != null) ? ((Component)obj).GetComponentInChildren(true) : null); object obj3; if (obj2 == null) { obj3 = null; } else { Transform obj4 = ((Component)obj2).transform.Find("Content"); obj3 = ((obj4 != null) ? obj4.Find("TABS") : null); } Transform val = (Transform)obj3; if ((Object)(object)val != (Object)null && val.childCount > 0) { GameObject val2 = Object.Instantiate(((Component)val.GetChild(0)).gameObject, (Transform)(object)parent); ((Object)val2).name = label; Component[] componentsInChildren = val2.GetComponentsInChildren(true); foreach (Component val3 in componentsInChildren) { if (!((Object)(object)val3 == (Object)null)) { string name = ((object)val3).GetType().Name; if (name.Contains("Localize") || name.Contains("SettingsTABSButton")) { Object.DestroyImmediate((Object)(object)val3); } } } TextMeshProUGUI componentInChildren = val2.GetComponentInChildren(true); if ((Object)(object)componentInChildren != (Object)null) { ((TMP_Text)componentInChildren).text = label; } Button val4 = val2.GetComponent