using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; 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 Archipelago.MultiClient.Net; using Archipelago.MultiClient.Net.BounceFeatures.DeathLink; using Archipelago.MultiClient.Net.Enums; using Archipelago.MultiClient.Net.Exceptions; using Archipelago.MultiClient.Net.Helpers; using Archipelago.MultiClient.Net.MessageLog.Messages; using Archipelago.MultiClient.Net.MessageLog.Parts; using Archipelago.MultiClient.Net.Models; using Archipelago.MultiClient.Net.Packets; using Archipelago.RiskOfRain2.Console; using Archipelago.RiskOfRain2.Extensions; using Archipelago.RiskOfRain2.Handlers; using Archipelago.RiskOfRain2.Lookup; using Archipelago.RiskOfRain2.Net; using Archipelago.RiskOfRain2.UI; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.Interactables.MSObelisk; using EntityStates.LunarTeleporter; using EntityStates.ScavBackpack; using HG; using KinematicCharacterController; using Microsoft.CodeAnalysis; using On.EntityStates.Interactables.MSObelisk; using On.EntityStates.LunarTeleporter; using On.EntityStates.ScavBackpack; using On.RoR2; using On.RoR2.Artifacts; using On.RoR2.UI; using R2API.Networking; using R2API.Networking.Interfaces; using R2API.Utils; using RoR2; using RoR2.ExpansionManagement; using RoR2.Networking; using RoR2.UI; using TMPro; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Archipelago.RiskOfRain2")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.5.4.0")] [assembly: AssemblyInformationalVersion("1.5.4+e86f95a1d0595f9a4234a329ba8118c05ec4f965")] [assembly: AssemblyProduct("Archipelago.RiskOfRain2")] [assembly: AssemblyTitle("Archipelago.RiskOfRain2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.5.4.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Archipelago.RiskOfRain2 { public class ArchipelagoClient : IDisposable { public delegate void ClientDisconnected(string reason); public delegate void ReleaseClick(bool prompt); public delegate void CollectClick(bool prompt); [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__86_0; public static UnityAction <>9__86_1; public static UnityAction <>9__86_2; public static UnityAction <>9__86_3; internal void b__86_0() { OnReleaseClick(prompt: true); } internal void b__86_1() { OnReleaseClick(prompt: false); } internal void b__86_2() { OnCollectClick(prompt: true); } internal void b__86_3() { OnCollectClick(prompt: false); } } public ArchipelagoItemLogicController ItemLogic; public ArchipelagoLocationCheckProgressBarUI itemCheckBar; public ArchipelagoLocationCheckProgressBarUI shrineCheckBar; private ArchipelagoSession session; private DeathLinkService deathLinkService; private bool finalStageDeath = false; private bool isEndingAcceptable = false; public GameObject ReleasePanel; public GameObject CollectPanel; public GameObject ReleasePromptPanel; public GameObject CollectPromptPanel; public static ReleaseClick OnReleaseClick; public static CollectClick OnCollectClick; private GameObject genericMenuButton; public static string connectedPlayerName; public static string victoryCondition; private GameEndingDef[] acceptableEndings; private string[] acceptableLosses; public string lastServerUrl { get; set; } public string lastSlotName { get; set; } public string lastPassword { get; set; } internal DeathLinkHandler Deathlinkhandler { get; private set; } internal StageBlockerHandler Stageblockerhandler { get; private set; } internal LocationHandler Locationhandler { get; private set; } internal ShrineChanceHandler shrineChanceHelper { get; private set; } public bool reconnecting { get; set; } = false; public static int lastReceivedItemindex { get; set; } public static bool isInGame { get; set; } public event ClientDisconnected OnClientDisconnect; public void Connect(string url, string slotName, string password = null) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Expected O, but got Unknown //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_0733: Unknown result type (might be due to invalid IL or missing references) //IL_073d: Expected O, but got Unknown //IL_0750: Unknown result type (might be due to invalid IL or missing references) //IL_075a: Expected O, but got Unknown //IL_0779: Unknown result type (might be due to invalid IL or missing references) //IL_077e: Unknown result type (might be due to invalid IL or missing references) //IL_06be: Unknown result type (might be due to invalid IL or missing references) //IL_06c3: Unknown result type (might be due to invalid IL or missing references) if (session != null && session.Socket.Connected) { Disconnect(); return; } isEndingAcceptable = false; ChatMessage.SendColored("Attempting to connect to Archipelago at " + url + ".", Color.green); lastServerUrl = url; lastSlotName = slotName; lastPassword = password; try { session = ArchipelagoSessionFactory.CreateSession(url, 38281); } catch (Exception ex) { this.OnClientDisconnect(ex.Message); } ItemLogic = new ArchipelagoItemLogicController(session); itemCheckBar = null; shrineCheckBar = null; if (!isInGame) { lastReceivedItemindex = 0; } LoginResult val = session.TryConnectAndLogin("Risk of Rain 2", slotName, (ItemsHandlingFlags)7, new Version(0, 6, 4), (string[])null, (string)null, password, true); if (!val.Successful) { LoginFailure val2 = (LoginFailure)val; string[] errors = val2.Errors; foreach (string text in errors) { ChatMessage.SendColored(text, Color.red); Log.LogError(text); } Dispose(); return; } LoginSuccessful val3 = (LoginSuccessful)val; ArchipelagoConnectButtonController.ChangeButtonWhenConnected(); object value2; if (val3.SlotData.TryGetValue("finalStageDeath", out var value)) { finalStageDeath = Convert.ToBoolean(value); ChatMessage.SendColored("Connected!", Color.green); } else if (val3.SlotData.TryGetValue("FinalStageDeath", out value2)) { finalStageDeath = Convert.ToBoolean(value2); ChatMessage.SendColored("Connected!", Color.green); } Log.LogDebug($"finalStageDeath {finalStageDeath} "); uint itemPickupStep = 3u; uint num = 3u; if (val3.SlotData.TryGetValue("itemPickupStep", out var value3)) { itemPickupStep = Convert.ToUInt32(value3); Log.LogDebug($"itemPickupStep from slot data: {itemPickupStep}"); itemPickupStep++; } if (val3.SlotData.TryGetValue("shrineUseStep", out var value4)) { num = Convert.ToUInt32(value4); Log.LogDebug($"shrineUseStep from slot data: {num}"); num++; } deathLinkService = DeathLinkProvider.CreateDeathLinkService(session); Log.LogDebug("Starting DeathLink service"); Deathlinkhandler = new DeathLinkHandler(deathLinkService); if (val3.SlotData.TryGetValue("deathLink", out var value5) && Convert.ToBoolean(value5)) { deathLinkService.EnableDeathLink(); Deathlinkhandler?.Hook(); } if (val3.SlotData.TryGetValue("goal", out var value6)) { if (!Convert.ToBoolean(value6)) { Log.LogDebug("Client detected classic_mode"); ArchipelagoLocationsInEnvironmentController.RemoveObjective(); NetMessageExtensions.Send((INetMessage)(object)new AllChecksCompleteInStage(), (NetworkDestination)1); } else { Log.LogDebug("Client detected explore_mode"); Stageblockerhandler = new StageBlockerHandler(); ItemLogic.Stageblockerhandler = Stageblockerhandler; Stageblockerhandler.BlockAll(); Locationhandler = new LocationHandler(session, LocationHandler.buildTemplateFromSlotData(val3.SlotData)); shrineChanceHelper = new ShrineChanceHandler(); itemCheckBar = new ArchipelagoLocationCheckProgressBarUI(new Vector2(-40f, 0f), Vector2.zero, "Item Check Progress:"); shrineCheckBar = new ArchipelagoLocationCheckProgressBarUI(new Vector2(0f, 170f), new Vector2(50f, -50f), "Shrine Check Progress:"); shrineCheckBar.ItemPickupStep = (int)num; Locationhandler.itemBar = itemCheckBar; Locationhandler.shrineBar = shrineCheckBar; Locationhandler.itemPickupStep = itemPickupStep; Locationhandler.shrineUseStep = num; } } if (val3.SlotData.TryGetValue("progressiveStages", out var value7)) { StageBlockerHandler.progressivesStages = Convert.ToBoolean(value7); } if (val3.SlotData.TryGetValue("showSeerPortals", out var value8)) { StageBlockerHandler.showSeerPortals = Convert.ToBoolean(value8); } if (val3.SlotData.TryGetValue("victory", out var value9)) { switch (value9.ToString()) { case "1": acceptableEndings = (GameEndingDef[])(object)new GameEndingDef[1] { GameEndings.MainEnding }; acceptableLosses = new string[2] { "moon", "moon2" }; victoryCondition = "Mithrix"; break; case "2": acceptableEndings = (GameEndingDef[])(object)new GameEndingDef[1] { GameEndings.VoidEnding }; acceptableLosses = new string[1] { "voidraid" }; victoryCondition = "Voidling"; break; case "3": acceptableEndings = (GameEndingDef[])(object)new GameEndingDef[1] { GameEndings.LimboEnding }; acceptableLosses = new string[2] { "mysteryspace", "limbo" }; victoryCondition = "Limbo"; break; case "4": acceptableEndings = (GameEndingDef[])(object)new GameEndingDef[1] { GameEndings.RebirthEndingDef }; victoryCondition = "Rebirth"; break; default: victoryCondition = "any"; acceptableEndings = (GameEndingDef[])(object)new GameEndingDef[4] { GameEndings.MainEnding, GameEndings.LimboEnding, GameEndings.VoidEnding, GameEndings.RebirthEndingDef }; acceptableLosses = new string[6] { "moon", "moon2", "voidraid", "mysteryspace", "limbo", "meridian" }; break; } } else { victoryCondition = "any"; acceptableEndings = (GameEndingDef[])(object)new GameEndingDef[4] { GameEndings.MainEnding, GameEndings.LimboEnding, GameEndings.VoidEnding, GameEndings.RebirthEndingDef }; acceptableLosses = new string[6] { "moon", "moon2", "voidraid", "mysteryspace", "limbo", "meridian" }; } if (itemCheckBar == null) { Log.LogDebug("Setting up bar for classic"); itemCheckBar = new ArchipelagoLocationCheckProgressBarUI(Vector2.zero, Vector2.zero); SyncLocationCheckProgress.OnLocationSynced += itemCheckBar.UpdateCheckProgress; } connectedPlayerName = session.Players.GetPlayerName(session.ConnectionInfo.Slot); itemCheckBar.ItemPickupStep = (int)itemPickupStep; session.MessageLog.OnMessageReceived += new MessageReceivedHandler(Session_OnMessageReceived); session.Socket.SocketClosed += new SocketClosedHandler(Session_SocketClosed); ItemLogic.OnItemDropProcessed += ItemLogicHandler_ItemDropProcessed; genericMenuButton = Addressables.LoadAssetAsync((object)"RoR2/Base/UI/GenericMenuButton.prefab").WaitForCompletion(); HookGame(); NetMessageExtensions.Send((INetMessage)(object)new ArchipelagoStartMessage(), (NetworkDestination)1); if (!Convert.ToBoolean(value6)) { NetMessageExtensions.Send((INetMessage)(object)new ArchipelagoStartClassic(), (NetworkDestination)1); } else { NetMessageExtensions.Send((INetMessage)(object)new ArchipelagoStartExplore(), (NetworkDestination)1); } ItemLogic.Precollect(); if (session.Items.GetItemName(37501L, (string)null) == null) { StageBlockerHandler.stageUnlocks["Stage 1"] = true; StageBlockerHandler.stageUnlocks["Stage 2"] = true; StageBlockerHandler.stageUnlocks["Stage 3"] = true; StageBlockerHandler.stageUnlocks["Stage 4"] = true; } else if (!isInGame) { StageBlockerHandler.stageUnlocks["Stage 1"] = false; StageBlockerHandler.stageUnlocks["Stage 2"] = false; StageBlockerHandler.stageUnlocks["Stage 3"] = false; StageBlockerHandler.stageUnlocks["Stage 4"] = false; } } public void Dispose() { if (ItemLogic != null) { ItemLogic.OnItemDropProcessed -= ItemLogicHandler_ItemDropProcessed; ItemLogic.Dispose(); } if (itemCheckBar != null) { SyncLocationCheckProgress.OnLocationSynced -= itemCheckBar.UpdateCheckProgress; itemCheckBar.Dispose(); } if (shrineCheckBar != null) { shrineCheckBar.Dispose(); } UnhookGame(); session = null; Stageblockerhandler = null; Locationhandler = null; itemCheckBar = null; shrineCheckBar = null; } private void HookGame() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Expected O, but got Unknown //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Expected O, but got Unknown ChatBox.SubmitChat += new hook_SubmitChat(ChatBox_SubmitChat); Run.onRunDestroyGlobal += Run_onRunDestroyGlobal; Run.BeginGameOver += new hook_BeginGameOver(Run_BeginGameOver); ArchipelagoChatMessage.OnChatReceivedFromClient += ArchipelagoChatMessage_OnChatReceivedFromClient; ReleasePanel = AssetBundleHelper.LoadPrefab("ReleasePrompt"); CollectPanel = AssetBundleHelper.LoadPrefab("CollectPrompt"); GameEndReportPanelController.Awake += new hook_Awake(GameEndReportPanelController_Awake); OnReleaseClick = (ReleaseClick)Delegate.Combine(OnReleaseClick, new ReleaseClick(WillRelease)); OnCollectClick = (CollectClick)Delegate.Combine(OnCollectClick, new CollectClick(WillCollect)); SceneObjectToggleGroup.Awake += new hook_Awake(SceneObjectToggleGroup_Awake); Stageblockerhandler?.Hook(); Locationhandler?.Hook(); shrineChanceHelper?.Hook(); ArchipelagoConsoleCommand.OnArchipelagoDeathLinkCommandCalled += ArchipelagoConsoleCommand_OnArchipelagoDeathLinkCommandCalled; ArchipelagoConsoleCommand.OnArchipelagoFinalStageDeathCommandCalled += ArchipelagoConsoleCommand_OnArchipelagoFinalStageDeathCommandCalled; ArchipelagoConsoleCommand.OnArchipelagoReconnectCommandCalled += ArchipelagoConsoleCommand_OnArchipelagoReconnectCommandCalled; session.Socket.ErrorReceived += new ErrorReceivedHandler(Socket_ErrorReceived); PortalDialerPreDialState.OnEnter += new hook_OnEnter(PortalDialerPreDialState_OnEnter); } private void PortalDialerPreDialState_OnEnter(orig_OnEnter orig, PortalDialerPreDialState self) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) ChatMessage.SendColored("Victory conditon is " + victoryCondition + ".", Color.magenta); orig.Invoke(self); } private void UnhookGame() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Expected O, but got Unknown //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Expected O, but got Unknown //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Expected O, but got Unknown ChatBox.SubmitChat -= new hook_SubmitChat(ChatBox_SubmitChat); Run.onRunDestroyGlobal -= Run_onRunDestroyGlobal; Run.BeginGameOver -= new hook_BeginGameOver(Run_BeginGameOver); ArchipelagoChatMessage.OnChatReceivedFromClient -= ArchipelagoChatMessage_OnChatReceivedFromClient; session.MessageLog.OnMessageReceived -= new MessageReceivedHandler(Session_OnMessageReceived); session.Socket.SocketClosed -= new SocketClosedHandler(Session_SocketClosed); GameEndReportPanelController.Awake -= new hook_Awake(GameEndReportPanelController_Awake); OnReleaseClick = (ReleaseClick)Delegate.Remove(OnReleaseClick, new ReleaseClick(WillRelease)); OnCollectClick = (CollectClick)Delegate.Remove(OnCollectClick, new CollectClick(WillCollect)); SceneObjectToggleGroup.Awake -= new hook_Awake(SceneObjectToggleGroup_Awake); Deathlinkhandler?.UnHook(); Stageblockerhandler?.UnHook(); Locationhandler?.UnHook(); shrineChanceHelper?.UnHook(); ArchipelagoConsoleCommand.OnArchipelagoDeathLinkCommandCalled -= ArchipelagoConsoleCommand_OnArchipelagoDeathLinkCommandCalled; ArchipelagoConsoleCommand.OnArchipelagoFinalStageDeathCommandCalled -= ArchipelagoConsoleCommand_OnArchipelagoFinalStageDeathCommandCalled; session.Socket.ErrorReceived -= new ErrorReceivedHandler(Socket_ErrorReceived); PortalDialerPreDialState.OnEnter -= new hook_OnEnter(PortalDialerPreDialState_OnEnter); } private void SceneObjectToggleGroup_Awake(orig_Awake orig, SceneObjectToggleGroup self) { Log.LogDebug($"Scene group length {self.toggleGroups.Length}"); if (self.toggleGroups != null) { for (int i = 0; i < self.toggleGroups.Length; i++) { if (self.toggleGroups[i].objects != null && (Object)(object)self.toggleGroups[i].objects[0] != (Object)null && (((Object)self.toggleGroups[i].objects[0]).name == "NewtStatue" || ((Object)self.toggleGroups[i].objects[0]).name == "NewtStatue (1)")) { Log.LogDebug($"Scene Object Toggle Group min:{self.toggleGroups[i].minEnabled} max:{self.toggleGroups[i].maxEnabled}"); Log.LogDebug("Changing newt alters min and max values"); self.toggleGroups[i].minEnabled = 1; self.toggleGroups[i].maxEnabled = 2; Log.LogDebug($"Scene Object Toggle Group min:{self.toggleGroups[i].minEnabled} max:{self.toggleGroups[i].maxEnabled}"); break; } } } orig.Invoke(self); } private void ArchipelagoConsoleCommand_OnArchipelagoDeathLinkCommandCalled(bool link) { if (link) { Deathlinkhandler?.Hook(); deathLinkService.EnableDeathLink(); } else { Deathlinkhandler?.UnHook(); deathLinkService.DisableDeathLink(); } } private void ArchipelagoConsoleCommand_OnArchipelagoFinalStageDeathCommandCalled(bool finalstage) { finalStageDeath = finalstage; } private void ArchipelagoChatMessage_OnChatReceivedFromClient(string message) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown if (session.Socket.Connected && !string.IsNullOrEmpty(message)) { SayPacket val = new SayPacket(); val.Text = message; session.Socket.SendPacketAsync((ArchipelagoPacketBase)(object)val); } } private void ArchipelagoConsoleCommand_OnArchipelagoReconnectCommandCalled() { reconnecting = true; Session_SocketClosed("Making sure to be disconnected before reconnecting."); } private void ItemLogicHandler_ItemDropProcessed(int pickedUpCount) { if (itemCheckBar != null) { itemCheckBar.CurrentItemCount = pickedUpCount; if (itemCheckBar.CurrentItemCount % ItemLogic.ItemPickupStep == 0) { itemCheckBar.CurrentItemCount = 0; } else { itemCheckBar.CurrentItemCount %= ItemLogic.ItemPickupStep; } } NetMessageExtensions.Send((INetMessage)(object)new SyncLocationCheckProgress(itemCheckBar.CurrentItemCount, itemCheckBar.ItemPickupStep), (NetworkDestination)1); } private void ChatBox_SubmitChat(orig_SubmitChat orig, ChatBox self) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown string text = self.inputField.text; if (session.Socket.Connected && !string.IsNullOrEmpty(text)) { SayPacket val = new SayPacket(); val.Text = text; session.Socket.SendPacketAsync((ArchipelagoPacketBase)(object)val); self.inputField.text = string.Empty; orig.Invoke(self); } else { orig.Invoke(self); } } private void Socket_ErrorReceived(Exception e, string message) { Log.LogDebug($"Error received: {e}, message: {message}"); reconnecting = true; Session_SocketClosed(message); } private void Session_SocketClosed(string reason) { Dispose(); NetMessageExtensions.Send((INetMessage)(object)new ArchipelagoEndMessage(), (NetworkDestination)1); if (this.OnClientDisconnect != null) { this.OnClientDisconnect(reason); } } public IEnumerator AttemptReconnection() { Log.LogDebug("Attempting to reconnect!"); int retryCounter = 0; if (!isInGame) { ArchipelagoConnectButtonController.ChangeButtonWhenDisconnected(); } while ((session == null || !session.Socket.Connected) && retryCounter < 5) { ChatMessage.Send($"Connection attempt #{retryCounter + 1}"); retryCounter++; yield return new WaitForSeconds(3f); Connect(lastServerUrl, lastSlotName, lastPassword); } if (session == null || !session.Socket.Connected) { ChatMessage.SendColored("Could not connect to Archipelago.", Color.red); Dispose(); } else if (session != null && session.Socket.Connected) { ChatMessage.SendColored("Established Archipelago connection.", Color.green); NetMessageExtensions.Send((INetMessage)(object)new ArchipelagoStartMessage(), (NetworkDestination)1); if (Locationhandler != null && isInGame) { Locationhandler.CatchUpSceneLocations(LocationHandler.sceneDef.cachedName); Locationhandler.LoadItemPickupHooks(); } } reconnecting = false; } private void Session_OnMessageReceived(LogMessage message) { Thread thread = new Thread((ThreadStart)delegate { Session_OnMessageReceived_Thread(message); }); thread.Start(); Thread.Sleep(20); } private void Session_OnMessageReceived_Thread(LogMessage message) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) string text = ""; MessagePart[] parts = message.Parts; foreach (MessagePart val in parts) { Color color = val.Color; string text2 = ((Color)(ref color)).R.ToString("X2"); color = val.Color; string text3 = ((Color)(ref color)).G.ToString("X2"); color = val.Color; string text4 = text2 + text3 + ((Color)(ref color)).B.ToString("X2"); text = text + "" + ((object)val)?.ToString() + ""; } ChatMessage.Send(text); } private void Run_BeginGameOver(orig_BeginGameOver orig, Run self, GameEndingDef gameEndingDef) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown if (IsEndingAcceptable(gameEndingDef)) { isEndingAcceptable = true; StatusUpdatePacket val = new StatusUpdatePacket(); val.Status = (ArchipelagoClientState)30; session.Socket.SendPacketAsync((ArchipelagoPacketBase)(object)val); NetMessageExtensions.Send((INetMessage)(object)new ArchipelagoEndMessage(), (NetworkDestination)1); } orig.Invoke(self, gameEndingDef); } private bool IsEndingAcceptable(GameEndingDef gameEndingDef) { Log.LogDebug("ending stage is " + Stage.instance.sceneDef.cachedName); return acceptableEndings.Contains(gameEndingDef) || (finalStageDeath && (Object)(object)gameEndingDef == (Object)(object)GameEndings.StandardLoss && acceptableLosses.Contains(Stage.instance.sceneDef.cachedName)) || (finalStageDeath && (Object)(object)gameEndingDef == (Object)(object)GameEndings.ObliterationEnding && acceptableLosses.Contains(Stage.instance.sceneDef.cachedName)); } private void Run_onRunDestroyGlobal(Run obj) { isInGame = false; lastReceivedItemindex = 0; Disconnect(); } public void Disconnect() { if (session != null && session.Socket.Connected) { ArchipelagoConnectButtonController.ChangeButtonWhenDisconnected(); session.Socket.DisconnectAsync(); } } private void GameEndReportPanelController_Awake(orig_Awake orig, GameEndReportPanelController self) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: 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_026d: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: 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_01d6: Expected O, but got Unknown //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Expected O, but got Unknown //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Expected O, but got Unknown //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Expected O, but got Unknown if (isEndingAcceptable && (Object)(object)ReleasePromptPanel == (Object)null) { if ((Object)(object)genericMenuButton != (Object)null) { GameObject gameObject = ((Component)genericMenuButton.transform.Find("HoverOutline")).gameObject; } else { GameObject gameObject = null; } string text = Convert.ToString(session.RoomState.ReleasePermissions); string text2 = Convert.ToString(session.RoomState.CollectPermissions); bool flag = text == "Goal" || text == "Enabled"; bool flag2 = text2 == "Goal" || text2 == "Enabled"; Log.LogDebug("can release " + text + " can collect " + text2); Log.LogDebug($"release? {flag} collect? {flag2}"); Transform val = ((Component)self).transform.Find("SafeArea (JUICED)/BodyArea"); if (flag) { GameObject val2 = Object.Instantiate(ReleasePanel); val2.transform.SetParent(((Component)val).transform, false); val2.transform.localPosition = new Vector3(0f, 0f, 0f); val2.transform.localScale = Vector3.one; GameObject gameObject2 = ((Component)((Component)self).transform.Find("SafeArea (JUICED)/BodyArea/ReleasePrompt(Clone)/Panel/Release/")).gameObject; gameObject2.AddComponent(); GameObject gameObject3 = ((Component)((Component)self).transform.Find("SafeArea (JUICED)/BodyArea/ReleasePrompt(Clone)/Panel/Cancel/")).gameObject; gameObject3.AddComponent(); ButtonClickedEvent onClick = ((Button)gameObject2.GetComponent()).onClick; object obj = <>c.<>9__86_0; if (obj == null) { UnityAction val3 = delegate { OnReleaseClick(prompt: true); }; <>c.<>9__86_0 = val3; obj = (object)val3; } ((UnityEvent)onClick).AddListener((UnityAction)obj); ButtonClickedEvent onClick2 = ((Button)gameObject3.GetComponent()).onClick; object obj2 = <>c.<>9__86_1; if (obj2 == null) { UnityAction val4 = delegate { OnReleaseClick(prompt: false); }; <>c.<>9__86_1 = val4; obj2 = (object)val4; } ((UnityEvent)onClick2).AddListener((UnityAction)obj2); ReleasePromptPanel = ((Component)((Component)self).transform.Find("SafeArea (JUICED)/BodyArea/ReleasePrompt(Clone)")).gameObject; } if (flag2) { GameObject val5 = Object.Instantiate(CollectPanel); val5.transform.SetParent(((Component)val).transform, false); val5.transform.localPosition = new Vector3(0f, 0f, 0f); val5.transform.localScale = Vector3.one; GameObject gameObject4 = ((Component)((Component)self).transform.Find("SafeArea (JUICED)/BodyArea/CollectPrompt(Clone)/Panel/Collect/")).gameObject; gameObject4.AddComponent(); GameObject gameObject5 = ((Component)((Component)self).transform.Find("SafeArea (JUICED)/BodyArea/CollectPrompt(Clone)/Panel/Cancel/")).gameObject; gameObject5.AddComponent(); ButtonClickedEvent onClick3 = ((Button)gameObject4.GetComponent()).onClick; object obj3 = <>c.<>9__86_2; if (obj3 == null) { UnityAction val6 = delegate { OnCollectClick(prompt: true); }; <>c.<>9__86_2 = val6; obj3 = (object)val6; } ((UnityEvent)onClick3).AddListener((UnityAction)obj3); ButtonClickedEvent onClick4 = ((Button)gameObject5.GetComponent()).onClick; object obj4 = <>c.<>9__86_3; if (obj4 == null) { UnityAction val7 = delegate { OnCollectClick(prompt: false); }; <>c.<>9__86_3 = val7; obj4 = (object)val7; } ((UnityEvent)onClick4).AddListener((UnityAction)obj4); CollectPromptPanel = ((Component)((Component)self).transform.Find("SafeArea (JUICED)/BodyArea/CollectPrompt(Clone)")).gameObject; CollectPromptPanel.SetActive(false); } if (flag2 && !flag) { CollectPromptPanel.SetActive(true); } } orig.Invoke(self); } private void WillRelease(bool prompt) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown SayPacket val = new SayPacket(); if (prompt && isEndingAcceptable) { Log.LogDebug($"Releasing the rest of the items {isEndingAcceptable}"); val.Text = "!release"; session.Socket.SendPacketAsync((ArchipelagoPacketBase)(object)val); } ReleasePromptPanel.SetActive(false); if ((Object)(object)CollectPromptPanel != (Object)null) { CollectPromptPanel.SetActive(true); } } private void WillCollect(bool prompt) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown SayPacket val = new SayPacket(); if (prompt && isEndingAcceptable) { Log.LogDebug($"Collect the rest of the items {isEndingAcceptable}"); val.Text = "!collect"; session.Socket.SendPacketAsync((ArchipelagoPacketBase)(object)val); } GameObject collectPromptPanel = CollectPromptPanel; if (collectPromptPanel != null) { collectPromptPanel.SetActive(false); } } } public class ArchipelagoItemLogicController : IDisposable { public delegate void ItemDropProcessedHandler(int pickedUpCount); private Random rnd = new Random(); private bool finishedAllChecks = false; private ArchipelagoSession session; private Queue> itemReceivedQueue = new Queue>(); private Queue> environmentReceivedQueue = new Queue>(); private Queue> fillerReceivedQueue = new Queue>(); private Queue> trapReceivedQueue = new Queue>(); private Queue> stageReceivedQueue = new Queue>(); private const long environmentRangeLower = 37700L; private const long environmentRangeUpper = 37999L; private const long fillerRangeLower = 37300L; private const long fillerRangeUpper = 37399L; private const long trapRangeLower = 37400L; private const long trapRangeUpper = 37499L; private const long stageRangeLower = 37500L; private const long stageRangeUpper = 37599L; private bool spawnedMonster = false; private bool monsterShrineRecently = false; private bool teleportedRecently = false; private bool exitedPod = false; private UniquePickup[] skippedItems; private GameObject smokescreenPrefab; private CombatDirector combatDirector; public int PickedUpItemCount { get; set; } public int ItemPickupStep { get; set; } public long ItemStartId { get; private set; } public int CurrentChecks { get; set; } public int TotalChecks { get; set; } internal StageBlockerHandler Stageblockerhandler { get; set; } public long[] ChecksTogether { get; set; } public long[] MissingChecks { get; set; } private bool IsInGame => (RoR2Application.isInSinglePlayer || RoR2Application.isInMultiPlayer) && (Object)(object)Run.instance != (Object)null && exitedPod; public event ItemDropProcessedHandler OnItemDropProcessed; public ArchipelagoItemLogicController(ArchipelagoSession session) { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown //IL_0119: 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_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: 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_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0191: 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_019b: 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_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: 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_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //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_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: 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_025e: Unknown result type (might be due to invalid IL or missing references) //IL_026b: 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_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: 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_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_0313: 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_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_035a: 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_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: 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_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) this.session = session; ItemStartId = session.Locations.GetLocationIdFromName("Risk of Rain 2", "ItemPickup1"); RoR2Application.Update += new hook_Update(RoR2Application_Update); SceneDirector.Start += new hook_Start(SceneDirector_Start); session.Socket.PacketReceived += new PacketReceivedHandler(Session_PacketReceived); session.Items.ItemReceived += new ItemReceivedHandler(Items_ItemReceived); CombatDirector.Awake += new hook_Awake(CombatDirector_Awake); SurvivorPodController.OnPassengerExit += new hook_OnPassengerExit(SurvivorPodController_OnPassengerExit); Log.LogDebug("Okay finished hooking."); smokescreenPrefab = Addressables.LoadAssetAsync((object)"RoR2/Junk/Bandit/SmokescreenEffect.prefab").WaitForCompletion(); Log.LogDebug("Okay, finished getting prefab."); Log.LogDebug($"smokescreen {smokescreenPrefab}"); skippedItems = (UniquePickup[])(object)new UniquePickup[24] { new UniquePickup(PickupCatalog.FindPickupIndex(Equipment.AffixBlue.equipmentIndex)), new UniquePickup(PickupCatalog.FindPickupIndex(Equipment.AffixHaunted.equipmentIndex)), new UniquePickup(PickupCatalog.FindPickupIndex(Equipment.AffixLunar.equipmentIndex)), new UniquePickup(PickupCatalog.FindPickupIndex(Equipment.AffixPoison.equipmentIndex)), new UniquePickup(PickupCatalog.FindPickupIndex(Equipment.AffixRed.equipmentIndex)), new UniquePickup(PickupCatalog.FindPickupIndex(Equipment.AffixWhite.equipmentIndex)), new UniquePickup(PickupCatalog.FindPickupIndex(MiscPickups.LunarCoin.miscPickupIndex)), new UniquePickup(PickupCatalog.FindPickupIndex(Items.ArtifactKey.itemIndex)), new UniquePickup(PickupCatalog.FindPickupIndex(Artifacts.Bomb.artifactIndex)), new UniquePickup(PickupCatalog.FindPickupIndex(Artifacts.Command.artifactIndex)), new UniquePickup(PickupCatalog.FindPickupIndex(Artifacts.EliteOnly.artifactIndex)), new UniquePickup(PickupCatalog.FindPickupIndex(Artifacts.Enigma.artifactIndex)), new UniquePickup(PickupCatalog.FindPickupIndex(Artifacts.FriendlyFire.artifactIndex)), new UniquePickup(PickupCatalog.FindPickupIndex(Artifacts.Glass.artifactIndex)), new UniquePickup(PickupCatalog.FindPickupIndex(Artifacts.MixEnemy.artifactIndex)), new UniquePickup(PickupCatalog.FindPickupIndex(Artifacts.MonsterTeamGainsItems.artifactIndex)), new UniquePickup(PickupCatalog.FindPickupIndex(Artifacts.RandomSurvivorOnRespawn.artifactIndex)), new UniquePickup(PickupCatalog.FindPickupIndex(Artifacts.Sacrifice.artifactIndex)), new UniquePickup(PickupCatalog.FindPickupIndex(Artifacts.ShadowClone.artifactIndex)), new UniquePickup(PickupCatalog.FindPickupIndex(Artifacts.SingleMonsterType.artifactIndex)), new UniquePickup(PickupCatalog.FindPickupIndex(Artifacts.Swarms.artifactIndex)), new UniquePickup(PickupCatalog.FindPickupIndex(Artifacts.TeamDeath.artifactIndex)), new UniquePickup(PickupCatalog.FindPickupIndex(Artifacts.WeakAssKnees.artifactIndex)), new UniquePickup(PickupCatalog.FindPickupIndex(Artifacts.WispOnDeath.artifactIndex)) }; Log.LogDebug("Ok, finished browsing catalog."); } private void SceneDirector_Start(orig_Start orig, SceneDirector self) { orig.Invoke(self); exitedPod = true; ArchipelagoClient.isInGame = true; } private void SurvivorPodController_OnPassengerExit(orig_OnPassengerExit orig, SurvivorPodController self, GameObject passenger) { orig.Invoke(self, passenger); Thread thread = new Thread((ThreadStart)delegate { TeleportedRecently(); }); thread.Start(); teleportedRecently = true; exitedPod = true; ArchipelagoClient.isInGame = true; } private void CombatDirector_Awake(orig_Awake orig, CombatDirector self) { orig.Invoke(self); combatDirector = self; } private void Items_ItemReceived(ReceivedItemsHelper helper) { ItemInfo val = helper.DequeueItem(); if (ArchipelagoClient.lastReceivedItemindex < helper.AllItemsReceived.Count) { EnqueueItem(val.ItemId); ArchipelagoClient.lastReceivedItemindex = helper.AllItemsReceived.Count; } else if (37700 <= val.ItemId && val.ItemId <= 37999) { EnqueueItem(val.ItemId); } } private void Check_Locations(ReadOnlyCollection item) { long[] array = new long[item.Count]; item.CopyTo(array, 0); if (MissingChecks != null) { for (int i = 0; i < array.Length; i++) { List list = new List(MissingChecks); int index = Array.IndexOf(MissingChecks, array[i]); list.RemoveAt(index); MissingChecks = list.ToArray(); } Update_MissingChecks(); } } private void Update_MissingChecks() { if (MissingChecks.Count() > 0 && ChecksTogether != null) { int num = Array.IndexOf(ChecksTogether, MissingChecks[0]); Log.LogInfo($"Last item collected is {num}/{TotalChecks} next missing id is {MissingChecks[0]}"); CurrentChecks = num; PickedUpItemCount = num * ItemPickupStep; ArchipelagoTotalChecksObjectiveController.CurrentChecks = CurrentChecks; } } private void Session_PacketReceived(ArchipelagoPacketBase packet) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Expected O, but got Unknown //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown ArchipelagoPacketType packetType = packet.PacketType; ArchipelagoPacketType val = packetType; if ((int)val != 2) { return; } ConnectedPacket val2 = (ConnectedPacket)(object)((packet is ConnectedPacket) ? packet : null); object value; bool flag = !val2.SlotData.TryGetValue("goal", out value) || !Convert.ToBoolean(value); Log.LogDebug($"Detected classic_mode from ArchipelagoItemLogicController? {flag}"); if (flag) { PickupDropletController.CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 += new hook_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3(PickupDropletController_CreatePickupDroplet_CreatePickupInfo); ChestBehavior.ItemDrop += new hook_ItemDrop(ChestBehavior_ItemDrop); session.Locations.CheckedLocationsUpdated += new CheckedLocationsUpdatedHandler(Check_Locations); } else { PickupDropletController.CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 -= new hook_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3(PickupDropletController_CreatePickupDroplet_CreatePickupInfo); ChestBehavior.ItemDrop -= new hook_ItemDrop(ChestBehavior_ItemDrop); session.Locations.CheckedLocationsUpdated -= new CheckedLocationsUpdatedHandler(Check_Locations); } ItemPickupStep = Convert.ToInt32(val2.SlotData["itemPickupStep"]) + 1; TotalChecks = val2.LocationsChecked.Count() + val2.MissingChecks.Count(); ChecksTogether = val2.LocationsChecked.Concat(val2.MissingChecks).ToArray(); ChecksTogether = ChecksTogether.OrderBy((long n) => n).ToArray(); MissingChecks = val2.MissingChecks; Log.LogDebug($"Missing Checks {val2.MissingChecks.Count()} totalChecks {TotalChecks} Locations Checked {val2.LocationsChecked.Count()}"); if (ItemStartId == -1) { ItemStartId = session.Locations.GetLocationIdFromName("Risk of Rain 2", "ItemPickup1"); if (ItemStartId == -1) { ItemStartId = 38000L; } } if (val2.MissingChecks.Count() == 0) { CurrentChecks = TotalChecks; finishedAllChecks = true; } else if (flag) { int num = Array.IndexOf(ChecksTogether, val2.MissingChecks[0]); Log.LogInfo($"Missing index is {num} first missing id is {val2.MissingChecks[0]}"); ItemStartId = ChecksTogether[0]; Log.LogInfo($"ItemStartId {ItemStartId}"); CurrentChecks = num; } else { CurrentChecks = ChecksTogether.Length - val2.MissingChecks.Count(); } ArchipelagoTotalChecksObjectiveController.CurrentChecks = CurrentChecks; ArchipelagoTotalChecksObjectiveController.TotalChecks = TotalChecks; NetMessageExtensions.Send((INetMessage)(object)new SyncTotalCheckProgress(CurrentChecks, TotalChecks), (NetworkDestination)1); PickedUpItemCount = CurrentChecks * ItemPickupStep; } public void EnqueueItem(long itemId) { string itemName = session.Items.GetItemName(itemId, (string)null); if (37700 <= itemId && itemId <= 37999) { environmentReceivedQueue.Enqueue(new KeyValuePair(itemId, itemName)); } else if (37300 <= itemId && itemId <= 37399) { fillerReceivedQueue.Enqueue(new KeyValuePair(itemId, itemName)); } else if (37400 <= itemId && itemId <= 37499) { trapReceivedQueue.Enqueue(new KeyValuePair(itemId, itemName)); } else if (37500 <= itemId && itemId <= 37599) { stageReceivedQueue.Enqueue(new KeyValuePair(itemId, itemName)); } else { itemReceivedQueue.Enqueue(new KeyValuePair(itemId, itemName)); } } public void Dispose() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown PickupDropletController.CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 -= new hook_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3(PickupDropletController_CreatePickupDroplet_CreatePickupInfo); ChestBehavior.ItemDrop -= new hook_ItemDrop(ChestBehavior_ItemDrop); RoR2Application.Update -= new hook_Update(RoR2Application_Update); if (session != null) { session.Socket.PacketReceived -= new PacketReceivedHandler(Session_PacketReceived); session.Items.ItemReceived -= new ItemReceivedHandler(Items_ItemReceived); session = null; } } public void Precollect() { while (environmentReceivedQueue.Any()) { Log.LogDebug("Precollecting environment..."); HandleReceivedEnvironmentQueueItem(); } } private void RoR2Application_Update(orig_Update orig, RoR2Application self) { if (environmentReceivedQueue.Any()) { HandleReceivedEnvironmentQueueItem(); } if (stageReceivedQueue.Any()) { HandleReceivedStageQueueItem(); } if (IsInGame) { if (itemReceivedQueue.Any()) { HandleReceivedItemQueueItem(); } if (fillerReceivedQueue.Any()) { HandleReceivedFillerQueueItem(); } if (trapReceivedQueue.Any()) { HandleReceivedTrapQueueItem(); } } orig.Invoke(self); } private void HandleReceivedEnvironmentQueueItem() { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) KeyValuePair keyValuePair = environmentReceivedQueue.Dequeue(); long num = keyValuePair.Key; string value = keyValuePair.Value; if (num == 37746 && value == "The Planetarium") { num = 37745L; Log.LogDebug("Changing id to 45"); } else if (num == 37745 && value == "Void Locus") { num = 37746L; Log.LogDebug("Changing id to 46"); } Log.LogDebug($"Handling environment with itemid {num} with name {value}"); Stageblockerhandler?.UnBlock((int)(num - 37700)); if (IsInGame) { ChatMessage.SendColored("Received " + value + "!", Color.magenta); } } private void HandleReceivedFillerQueueItem() { KeyValuePair keyValuePair = fillerReceivedQueue.Dequeue(); long key = keyValuePair.Key; string value = keyValuePair.Value; long num = key; long num2 = num; long num3 = num2 - 37301; if ((ulong)num3 <= 2uL) { switch (num3) { case 0L: GiveMoneyToPlayers(); break; case 1L: GiveLunarCoinToPlayers(); break; case 2L: GiveExperienceToPlayers(); break; } } } private void HandleReceivedTrapQueueItem() { KeyValuePair keyValuePair = trapReceivedQueue.Dequeue(); long key = keyValuePair.Key; string value = keyValuePair.Value; long num = key; long num2 = num; long num3 = num2 - 37401; if ((ulong)num3 <= 3uL) { switch (num3) { case 0L: MountainShrineTrap(); break; case 1L: TimeWarpTrap(); break; case 2L: SpawnMonstersTrap(); break; case 3L: TeleportPlayer(); break; } } } private void HandleReceivedStageQueueItem() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) KeyValuePair keyValuePair = stageReceivedQueue.Dequeue(); long key = keyValuePair.Key; string value = keyValuePair.Value; if (key == 37505) { StageBlockerHandler.amountOfStages++; ChatMessage.SendColored($"Received {value} #{StageBlockerHandler.amountOfStages}!", Color.magenta); } else { StageBlockerHandler.stageUnlocks[value] = true; ChatMessage.SendColored("Received " + value + "!", Color.magenta); } } private void HandleReceivedItemQueueItem() { //IL_059b: Unknown result type (might be due to invalid IL or missing references) //IL_05a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: 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_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: 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_01ad: 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_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Invalid comparison between Unknown and I4 //IL_0293: 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_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_0500: Unknown result type (might be due to invalid IL or missing references) //IL_0505: Unknown result type (might be due to invalid IL or missing references) //IL_054f: Unknown result type (might be due to invalid IL or missing references) //IL_0554: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Invalid comparison between Unknown and I4 //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0474: Unknown result type (might be due to invalid IL or missing references) //IL_0479: 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_04ad: Unknown result type (might be due to invalid IL or missing references) //IL_04b2: Unknown result type (might be due to invalid IL or missing references) //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_049d: Unknown result type (might be due to invalid IL or missing references) KeyValuePair keyValuePair = itemReceivedQueue.Dequeue(); long key = keyValuePair.Key; string value = keyValuePair.Value; Log.LogDebug($"Handling item with itemid {key} with name {value}"); long num = key; long num2 = num; long num3 = num2 - 37001; if ((ulong)num3 > 13uL) { return; } switch (num3) { case 1L: { foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { PickupIndex pickupIndex5 = Run.instance.availableTier1DropList.Choice(); GiveItemToPlayers(pickupIndex5, instance); } break; } case 2L: { foreach (PlayerCharacterMasterController instance2 in PlayerCharacterMasterController.instances) { PickupIndex pickupIndex4 = Run.instance.availableTier2DropList.Choice(); GiveItemToPlayers(pickupIndex4, instance2); } break; } case 3L: { foreach (PlayerCharacterMasterController instance3 in PlayerCharacterMasterController.instances) { PickupIndex pickupIndex3 = Run.instance.availableTier3DropList.Choice(); GiveItemToPlayers(pickupIndex3, instance3); } break; } case 4L: { foreach (PlayerCharacterMasterController instance4 in PlayerCharacterMasterController.instances) { PickupIndex pickupIndex2 = Run.instance.availableBossDropList.Choice(); GiveItemToPlayers(pickupIndex2, instance4); } break; } case 5L: { foreach (PlayerCharacterMasterController instance5 in PlayerCharacterMasterController.instances) { PickupIndex val2 = Run.instance.availableLunarCombinedDropList.Choice(); PickupDef pickupDef = PickupCatalog.GetPickupDef(val2); if ((int)pickupDef.itemIndex != -1) { GiveItemToPlayers(val2, instance5); } else if ((int)pickupDef.equipmentIndex != -1) { GiveEquipmentToPlayers(val2, instance5); } } break; } case 6L: { foreach (PlayerCharacterMasterController instance6 in PlayerCharacterMasterController.instances) { PickupIndex pickupIndex = Run.instance.availableEquipmentDropList.Choice(); GiveEquipmentToPlayers(pickupIndex, instance6); } break; } case 7L: { foreach (PlayerCharacterMasterController instance7 in PlayerCharacterMasterController.instances) { GiveItemToPlayers(PickupCatalog.FindPickupIndex(Items.ScrapWhite.itemIndex), instance7); } break; } case 8L: { foreach (PlayerCharacterMasterController instance8 in PlayerCharacterMasterController.instances) { GiveItemToPlayers(PickupCatalog.FindPickupIndex(Items.ScrapGreen.itemIndex), instance8); } break; } case 9L: { foreach (PlayerCharacterMasterController instance9 in PlayerCharacterMasterController.instances) { GiveItemToPlayers(PickupCatalog.FindPickupIndex(Items.ScrapRed.itemIndex), instance9); } break; } case 10L: { foreach (PlayerCharacterMasterController instance10 in PlayerCharacterMasterController.instances) { GiveItemToPlayers(PickupCatalog.FindPickupIndex(Items.ScrapYellow.itemIndex), instance10); } break; } case 11L: { foreach (PlayerCharacterMasterController instance11 in PlayerCharacterMasterController.instances) { int maxValue = 125; int num4 = rnd.Next(maxValue); PickupIndex val = default(PickupIndex); val = ((num4 > 70) ? ((num4 > 110) ? ((num4 > 120) ? Run.instance.availableVoidBossDropList.Choice() : Run.instance.availableVoidTier3DropList.Choice()) : Run.instance.availableVoidTier2DropList.Choice()) : Run.instance.availableVoidTier1DropList.Choice()); GiveItemToPlayers(val, instance11); } break; } case 12L: { foreach (PlayerCharacterMasterController instance12 in PlayerCharacterMasterController.instances) { GiveItemToPlayers(PickupCatalog.FindPickupIndex(Items.LunarTrinket.itemIndex), instance12); } break; } case 13L: { foreach (PlayerCharacterMasterController instance13 in PlayerCharacterMasterController.instances) { GiveEquipmentToPlayers(PickupCatalog.FindPickupIndex(Equipment.Scanner.equipmentIndex), instance13); } break; } case 0L: { foreach (PlayerCharacterMasterController instance14 in PlayerCharacterMasterController.instances) { GiveItemToPlayers(PickupCatalog.FindPickupIndex(Items.ExtraLife.itemIndex), instance14); } break; } } } private void GiveEquipmentToPlayers(PickupIndex pickupIndex, PlayerCharacterMasterController player) { //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) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) Inventory inventory = player.master.inventory; EquipmentState equipment = inventory.GetEquipment((uint)inventory.activeEquipmentSlot); if (!((EquipmentState)(ref equipment)).Equals(EquipmentState.empty)) { GameObject bodyObject = player.master.GetBodyObject(); if ((Object)(object)bodyObject == (Object)null) { return; } CreatePickupInfo val = default(CreatePickupInfo); ((CreatePickupInfo)(ref val)).pickupIndex = PickupCatalog.FindPickupIndex(equipment.equipmentIndex); val.position = bodyObject.transform.position; val.rotation = Quaternion.identity; CreatePickupInfo val2 = val; GenericPickupController.CreatePickup(ref val2); } PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex); inventory.SetEquipmentIndex((EquipmentIndex)((pickupDef == null) ? (-1) : ((int)pickupDef.equipmentIndex))); if (!NetworkServer.active) { CharacterMasterNotificationQueue.PushPickupNotification(player.master, pickupIndex); } else { DisplayPickupNotification(pickupIndex, player); } } private void GiveItemToPlayers(PickupIndex pickupIndex, PlayerCharacterMasterController player) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) Inventory inventory = player.master.inventory; PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex); inventory.GiveItemPermanent((ItemIndex)((pickupDef == null) ? (-1) : ((int)pickupDef.itemIndex)), 1); if (!NetworkServer.active) { CharacterMasterNotificationQueue.PushPickupNotification(player.master, pickupIndex); } else { DisplayPickupNotification(pickupIndex, player); } } private void GiveMoneyToPlayers() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { float difficultyCoefficient = Run.instance.difficultyCoefficient; uint num = (uint)(100f * difficultyCoefficient); Log.LogDebug($"Received {num}"); CharacterMaster master = instance.master; master.money += num; Chat.SendBroadcastChat((ChatMessageBase)new PlayerPickupChatMessage { subjectAsCharacterBody = instance.master.GetBody(), baseToken = "PLAYER_PICKUP", pickupToken = $"${num}!!!", pickupColor = Color32.op_Implicit(Color.green), pickupQuantity = 1u }); } } private void GiveLunarCoinToPlayers() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //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_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_00a1: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { GameObject prefab = Addressables.LoadAssetAsync((object)"RoR2/Base/Common/GenericPickup.prefab").WaitForCompletion(); SpawnCard val = ScriptableObject.CreateInstance(); val.prefab = prefab; Xoroshiro128Plus val2 = new Xoroshiro128Plus(RoR2Application.rng); if ((Object)(object)DirectorCore.instance != (Object)null) { GameObject val3 = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(val, new DirectorPlacementRule { placementMode = (PlacementMode)0, spawnOnTarget = instance.master.GetBody().transform, minDistance = 1f, maxDistance = 10f }, val2)); Vector3 position = val3.transform.position; val3.GetComponent().pickupIndex = PickupCatalog.FindPickupIndex(MiscPickups.LunarCoin.miscPickupIndex); Log.LogDebug($"coin position {position + new Vector3(0f, 10f, 0f)}"); NetworkServer.Spawn(val3); } } } private void GiveExperienceToPlayers() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { instance.master.GiveExperience(1000uL); Chat.SendBroadcastChat((ChatMessageBase)new PlayerPickupChatMessage { subjectAsCharacterBody = instance.master.GetBody(), baseToken = "PLAYER_PICKUP", pickupToken = "1000 XP", pickupColor = Color32.op_Implicit(Color.white), pickupQuantity = 1u }); } } private void MountainShrineTrap() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (!monsterShrineRecently) { ChatMessage.SendColored("The Mountain has invited you for a challenge..", Color.yellow); TeleporterInteraction.instance.AddShrineStack(); monsterShrineRecently = true; Thread thread = new Thread((ThreadStart)delegate { MountainShrineRecently(); }); thread.Start(); PlayShrineSound(); } } private void MountainShrineRecently() { Thread.Sleep(2000); Log.LogDebug("You can get another mountain trap now."); monsterShrineRecently = false; } private void PlayShrineSound() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown if (PlayerCharacterMasterController.instances != null) { EffectManager.SpawnEffect(LegacyResourcesAPI.Load("Prefabs/Effects/ShrineUseEffect"), new EffectData { origin = PlayerCharacterMasterController.instances[0].body.transform.position }, true); } } private void SpawnMonstersTrap() { //IL_009e: 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) if (!((Object)(object)combatDirector != (Object)null) || spawnedMonster) { return; } PlayerCharacterMasterController val = PlayerCharacterMasterController.instances[0]; if (!((Object)(object)val.master.GetBody() == (Object)null)) { spawnedMonster = true; Thread thread = new Thread((ThreadStart)delegate { SpawnedMonstersRecently(); }); thread.Start(); float difficultyCoefficient = Run.instance.difficultyCoefficient; combatDirector.monsterCredit = 100f * difficultyCoefficient; Log.LogDebug($"player position {val.master.GetBody().transform.localPosition} monster credit 100 * {difficultyCoefficient} = {100f * difficultyCoefficient}"); combatDirector.SpendAllCreditsOnMapSpawns(val.master.GetBody().transform); ChatMessage.SendColored("Incoming Monsters!!", Color.red); PlayShrineSound(); } } private void SpawnedMonstersRecently() { Thread.Sleep(2000); Log.LogDebug("You can get another monster trap now."); spawnedMonster = false; } private void TeleportPlayer() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_0074: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_00a8: 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_00c0: Expected O, but got Unknown //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) if (teleportedRecently) { return; } foreach (NetworkUser readOnlyLocalPlayers in NetworkUser.readOnlyLocalPlayersList) { if (Object.op_Implicit((Object)(object)readOnlyLocalPlayers)) { SpawnCard val = ScriptableObject.CreateInstance(); val = LegacyResourcesAPI.Load("SpawnCards/InteractableSpawnCard/iscBarrel1"); Xoroshiro128Plus val2 = new Xoroshiro128Plus(RoR2Application.rng); if ((Object)(object)DirectorCore.instance != (Object)null) { GameObject val3 = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(val, new DirectorPlacementRule { placementMode = (PlacementMode)4 }, val2)); Vector3 position = val3.transform.position; DirectorPlacementRule val4 = new DirectorPlacementRule { placementMode = (PlacementMode)4, minDistance = 5f, maxDistance = 20f }; Log.LogDebug($"directorPlacemnet {val4.targetPosition} card position {position + new Vector3(0f, 10f, 0f)} player position {((Component)readOnlyLocalPlayers.master).transform.position}"); CharacterBody body = readOnlyLocalPlayers.master.GetBody(); ((Component)body).GetComponentInChildren().SetPosition(position + new Vector3(0f, 10f, 0f), true); NetMessageExtensions.Send((INetMessage)(object)new ArchipelagoTeleportClient(), (NetworkDestination)1); val3.SetActive(false); } } } } private void TeleportedRecently() { Thread.Sleep(2000); Log.LogDebug("You can teleport again"); teleportedRecently = false; } private void TimeWarpTrap() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) float runStopwatch = Run.instance.GetRunStopwatch(); runStopwatch += 180f; Run.instance.SetRunStopwatch(runStopwatch); ChatMessage.SendColored("Monsters grow stronger with time!", Color.red); TeamManager.instance.SetTeamLevel((TeamIndex)2, 1u); } private void DisplayPickupNotification(PickupIndex index, PlayerCharacterMasterController player) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_004d: Invalid comparison between Unknown and I4 //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown CharacterMasterNotificationQueue notificationQueueForMaster = CharacterMasterNotificationQueue.GetNotificationQueueForMaster(player.master); PickupDef pickupDef = PickupCatalog.GetPickupDef(index); ItemIndex itemIndex = pickupDef.itemIndex; if ((int)itemIndex != -1) { notificationQueueForMaster.PushNotification(new NotificationInfo((object)ItemCatalog.GetItemDef(itemIndex), (TransformationInfo)null, false, 0), 2f); } EquipmentIndex equipmentIndex = pickupDef.equipmentIndex; if ((int)equipmentIndex != -1) { notificationQueueForMaster.PushNotification(new NotificationInfo((object)EquipmentCatalog.GetEquipmentDef(equipmentIndex), (TransformationInfo)null, false, 0), 2f); } Color baseColor = pickupDef.baseColor; string nameToken = pickupDef.nameToken; Chat.SendBroadcastChat((ChatMessageBase)new PlayerPickupChatMessage { subjectAsCharacterBody = player.master.GetBody(), baseToken = "PLAYER_PICKUP", pickupToken = nameToken, pickupColor = Color32.op_Implicit(baseColor), pickupQuantity = 1u }); } private void ChestBehavior_ItemDrop(orig_ItemDrop orig, ChestBehavior self) { bool flag = finishedAllChecks || HandleItemDrop(); if (this.OnItemDropProcessed != null) { this.OnItemDropProcessed(PickedUpItemCount); } if (flag) { orig.Invoke(self); } NetMessageExtensions.Send((INetMessage)(object)new SyncTotalCheckProgress(finishedAllChecks ? TotalChecks : CurrentChecks, TotalChecks), (NetworkDestination)1); if (finishedAllChecks) { ArchipelagoTotalChecksObjectiveController.RemoveObjective(); NetMessageExtensions.Send((INetMessage)(object)new AllChecksComplete(), (NetworkDestination)1); } } private void PickupDropletController_CreatePickupDroplet_CreatePickupInfo(orig_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 orig, CreatePickupInfo pickupInfo, Vector3 position, Vector3 velocity) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0088: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown if (Array.IndexOf(skippedItems, pickupInfo._pickupState) >= 0) { orig.Invoke(pickupInfo, position, velocity); return; } bool flag = finishedAllChecks || HandleItemDrop(); if (this.OnItemDropProcessed != null) { this.OnItemDropProcessed(PickedUpItemCount); } if (flag) { orig.Invoke(pickupInfo, position, velocity); } if (!flag) { EffectManager.SpawnEffect(smokescreenPrefab, new EffectData { origin = position }, true); } NetMessageExtensions.Send((INetMessage)(object)new SyncTotalCheckProgress(finishedAllChecks ? TotalChecks : CurrentChecks, TotalChecks), (NetworkDestination)1); if (finishedAllChecks) { ArchipelagoTotalChecksObjectiveController.RemoveObjective(); NetMessageExtensions.Send((INetMessage)(object)new AllChecksComplete(), (NetworkDestination)1); } } private bool HandleItemDrop() { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown PickedUpItemCount++; Log.LogDebug($"PickedUpItemCount + 1 {PickedUpItemCount} ItemPickupStep {ItemPickupStep}"); if (PickedUpItemCount % ItemPickupStep == 0) { CurrentChecks++; string arg = $"ItemPickup{CurrentChecks}"; long num = ItemStartId + CurrentChecks - 1; Log.LogDebug($"Sent out location {arg} (id: {num})"); LocationChecksPacket val = new LocationChecksPacket(); val.Locations = new List { num }.ToArray(); session.Socket.SendPacketAsync((ArchipelagoPacketBase)(object)val); if (CurrentChecks == TotalChecks) { ArchipelagoTotalChecksObjectiveController.CurrentChecks = ArchipelagoTotalChecksObjectiveController.TotalChecks; finishedAllChecks = true; } return false; } return true; } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.Ijwu.Archipelago", "Archipelago", "1.5.4")] public class ArchipelagoPlugin : BaseUnityPlugin { public const string PluginGUID = "com.Ijwu.Archipelago"; public const string PluginAuthor = "Ijwu/Sneaki"; public const string PluginName = "Archipelago"; public const string PluginVersion = "1.5.4"; private ArchipelagoClient AP; private ClientItemsHandler ClientItems; internal static string apServerUri = "archipelago.gg"; internal static int apServerPort = 38281; private bool willConnectToAP = true; private bool isPlayingAP = false; internal static string apSlotName = ""; internal static string apPassword; public static ConfigEntry SatelliteEntry { get; set; } public static ConfigEntry SlotNameEntry { get; set; } public static ConfigEntry ServerNameEntry { get; set; } public static ConfigEntry PortEntry { get; set; } public static ConfigEntry PasswordEntry { get; set; } internal static ArchipelagoPlugin Instance { get; private set; } public void Awake() { //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); CreateConfigurations(); apSlotName = SlotNameEntry.Value; apServerUri = ServerNameEntry.Value; apServerPort = PortEntry.Value; apPassword = PasswordEntry.Value; Instance = this; AP = new ArchipelagoClient(); ArchipelagoConnectButtonController.OnConnectClick = (ArchipelagoConnectButtonController.ConnectClicked)Delegate.Combine(ArchipelagoConnectButtonController.OnConnectClick, new ArchipelagoConnectButtonController.ConnectClicked(OnClick_ConnectToArchipelagoWithButton)); AP.OnClientDisconnect += AP_OnClientDisconnect; Run.onRunDestroyGlobal += Run_onRunDestroyGlobal; ArchipelagoStartMessage.OnArchipelagoSessionStart += ArchipelagoStartMessage_OnArchipelagoSessionStart; ArchipelagoEndMessage.OnArchipelagoSessionEnd += ArchipelagoEndMessage_OnArchipelagoSessionEnd; ArchipelagoConsoleCommand.OnArchipelagoCommandCalled += ArchipelagoConsoleCommand_ArchipelagoCommandCalled; ArchipelagoConsoleCommand.OnArchipelagoDisconnectCommandCalled += ArchipelagoConsoleCommand_ArchipelagoDisconnectCommandCalled; NetworkManagerSystem.onStopClientGlobal += GameNetworkManager_onStopClientGlobal; ChatBox.SubmitChat += new hook_SubmitChat(ChatBox_SubmitChat); AssetBundleHelper.LoadBundle(); CreateLobbyFields(); NetworkingAPI.RegisterMessageType(); NetworkingAPI.RegisterMessageType(); NetworkingAPI.RegisterMessageType(); NetworkingAPI.RegisterMessageType(); NetworkingAPI.RegisterMessageType(); NetworkingAPI.RegisterMessageType(); NetworkingAPI.RegisterMessageType(); NetworkingAPI.RegisterMessageType(); NetworkingAPI.RegisterMessageType(); NetworkingAPI.RegisterMessageType(); NetworkingAPI.RegisterMessageType(); NetworkingAPI.RegisterMessageType(); CommandHelper.AddToConsoleWhenReady(); } public void Start() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown GameObject val = new GameObject("ArchipelagoConnectButtonController"); val.AddComponent(); } private void GameNetworkManager_onStopClientGlobal() { if (!NetworkServer.active && isPlayingAP && AP.itemCheckBar != null) { AP.itemCheckBar.Dispose(); } } private void ChatBox_SubmitChat(orig_SubmitChat orig, ChatBox self) { if (!NetworkServer.active && isPlayingAP) { NetMessageExtensions.Send((INetMessage)(object)new ArchipelagoChatMessage(self.inputField.text), (NetworkDestination)2); self.inputField.text = ""; orig.Invoke(self); } else { orig.Invoke(self); } } private void ArchipelagoEndMessage_OnArchipelagoSessionEnd() { if (!NetworkServer.active && isPlayingAP && AP.itemCheckBar != null) { AP.itemCheckBar.Dispose(); } } private void AP_OnClientDisconnect(string reason) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) Log.LogWarning("Archipelago client was disconnected from the server because `" + reason + "`"); ChatMessage.SendColored("Archipelago client was disconnected from the server. " + reason, Color.red); bool flag = NetworkServer.active && RoR2Application.isInMultiPlayer; if (!isPlayingAP || flag || RoR2Application.isInSinglePlayer) { } if (AP.reconnecting) { ((MonoBehaviour)this).StartCoroutine((System.Collections.IEnumerator)AP.AttemptReconnection()); } } public void OnClick_ConnectToArchipelagoWithButton() { isPlayingAP = true; string url = apServerUri + ":" + apServerPort; Log.LogDebug($"Server {apServerUri} Port: {apServerPort} Slot: {apSlotName} Password: {apPassword}"); AP.Connect(url, apSlotName, apPassword); SlotNameEntry.Value = apSlotName; } private void ArchipelagoConsoleCommand_ArchipelagoCommandCalled(string url, int port, string slot, string password) { willConnectToAP = true; isPlayingAP = true; url = url + ":" + port; AP.Connect(url, slot, password); } private void ArchipelagoConsoleCommand_ArchipelagoDisconnectCommandCalled() { AP.Disconnect(); } private void ArchipelagoStartMessage_OnArchipelagoSessionStart() { if (!NetworkServer.active) { ClientItems = new ClientItemsHandler(); ClientItems?.Hook(); isPlayingAP = true; } } private void Run_onRunDestroyGlobal(Run obj) { if (isPlayingAP) { ArchipelagoTotalChecksObjectiveController.RemoveObjective(); ArchipelagoLocationsInEnvironmentController.RemoveObjective(); } } private void CreateLobbyFields() { ArchipelagoConnectButtonController.OnSlotChanged = (string newValue) => apSlotName = newValue; ArchipelagoConnectButtonController.OnPasswordChanged = (string newValue) => apPassword = newValue; ArchipelagoConnectButtonController.OnUrlChanged = (string newValue) => apServerUri = newValue; ArchipelagoConnectButtonController.OnPortChanged = ChangePort; } private void CreateConfigurations() { SatelliteEntry = ((BaseUnityPlugin)this).Config.Bind("HighlightSatellite", "satellite", true, "This will highlight all satellites"); SlotNameEntry = ((BaseUnityPlugin)this).Config.Bind("SlotName", "slotName", "", "Change the default slot name"); ServerNameEntry = ((BaseUnityPlugin)this).Config.Bind("ServerName", "serverName", "archipelago.gg", "Change the default server name"); PortEntry = ((BaseUnityPlugin)this).Config.Bind("Port", "port", 38281, "Change the default port"); PasswordEntry = ((BaseUnityPlugin)this).Config.Bind("Password", "password", "", "Change the default password"); } private string ChangePort(string newValue) { apServerPort = int.Parse(newValue); return newValue; } } public interface IEnumerator { } internal static class Log { internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void LogDebug(object data) { _logSource.LogDebug(data); } internal static void LogError(object data) { _logSource.LogError(data); } internal static void LogFatal(object data) { _logSource.LogFatal(data); } internal static void LogInfo(object data) { _logSource.LogInfo(data); } internal static void LogMessage(object data) { _logSource.LogMessage(data); } internal static void LogWarning(object data) { _logSource.LogWarning(data); } } } namespace Archipelago.RiskOfRain2.UI { public class ArchipelagoConnectButtonController : MonoBehaviour { public delegate string SlotChanged(string newValue); public delegate string PasswordChanged(string newValue); public delegate string UrlChanged(string newValue); public delegate string PortChanged(string newValue); public delegate void ConnectClicked(); [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__28_0; public static UnityAction <>9__29_0; public static UnityAction <>9__29_1; public static UnityAction <>9__29_2; public static UnityAction <>9__29_3; public static UnityAction <>9__30_0; internal void b__28_0() { OnConnectClick(); } internal void b__29_0(string value) { OnSlotChanged(value); } internal void b__29_1(string value) { OnPasswordChanged(value); } internal void b__29_2(string value) { OnUrlChanged(value); } internal void b__29_3(string value) { OnPortChanged(value); } internal void b__30_0() { OnButtonClick(); } } public GameObject connectPanel; public string assetName = "ConnectPanel"; public string bundleName = "connectbundle"; public GameObject chat; public GameObject ConnectPanel; public GameObject MinimizePanel; private string minimizeText = "-"; private TMP_FontAsset font; public static SlotChanged OnSlotChanged; public static PasswordChanged OnPasswordChanged; public static UrlChanged OnUrlChanged; public static PortChanged OnPortChanged; public static ConnectClicked OnConnectClick; public static ConnectClicked OnButtonClick; public static CharacterSelectController contr { get; private set; } public void Start() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown connectPanel = AssetBundleHelper.LoadPrefab("ConnectCanvas"); CharacterSelectController.Update += new hook_Update(CharacterSelectController_Update); } public void OnLoadDone(AsyncOperationHandle obj) { if ((Object)(object)obj.Result == (Object)null) { Log.LogDebug("error obj is null"); } else { Log.LogDebug($"obj.Result {obj.Result}"); } } public void Awake() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown CharacterSelectController.Awake += new hook_Awake(CharacterSelectController_Awake); OnButtonClick = (ConnectClicked)Delegate.Combine(OnButtonClick, new ConnectClicked(ButtonPressed)); } private void CharacterSelectController_Update(orig_Update orig, CharacterSelectController self) { orig.Invoke(self); contr = self; if ((Object)(object)chat != (Object)null && !chat.gameObject.activeSelf) { chat.gameObject.SetActive(true); } } internal void CharacterSelectController_Awake(orig_Awake orig, CharacterSelectController self) { orig.Invoke(self); contr = self; bool flag = NetworkServer.active && RoR2Application.isInMultiPlayer; bool isInSinglePlayer = RoR2Application.isInSinglePlayer; Log.LogDebug($"Is the Host: {flag} Is in Single Player {isInSinglePlayer}"); chat = ((Component)((Component)contr).transform.Find("SafeArea/ChatboxPanel/")).gameObject; if (flag || isInSinglePlayer) { CreateButton(); CreateFields(); CreateMinimizeButton(); Log.LogDebug("Character Controller Awake()"); ConnectPanel = ((Component)((Component)contr).transform.Find("SafeArea/ConnectCanvas(Clone)/Panel")).gameObject; } } private void CreateButton() { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Expected O, but got Unknown Transform val = ((Component)contr).transform.Find("SafeArea/ReadyPanel/ReadyButton"); font = ((TMP_Text)((Component)val).GetComponentInChildren()).font; Transform val2 = ((Component)contr).transform.Find("SafeArea"); GameObject gameObject = ((Component)val.Find("HoverOutlineImage")).gameObject; GameObject val3 = Object.Instantiate(connectPanel); val3.AddComponent(); val3.AddComponent(); val3.transform.SetParent(val2, false); val3.transform.localPosition = new Vector3(125f, 0f, 0f); val3.transform.localScale = Vector3.one; RectTransform component = val3.GetComponent(); GameObject gameObject2 = ((Component)((Component)contr).transform.Find("SafeArea/ConnectCanvas(Clone)/Panel/Button/")).gameObject; GameObject val4 = Object.Instantiate(gameObject); val4.transform.SetParent(gameObject2.transform, false); gameObject2.AddComponent(); gameObject2.GetComponent().imageOnHover = val4.GetComponent(); gameObject2.GetComponent().showImageOnHover = true; gameObject2.AddComponent(); gameObject2.GetComponent().sprite = ((Component)val).gameObject.GetComponent().sprite; ButtonClickedEvent onClick = ((Button)gameObject2.GetComponent()).onClick; object obj = <>c.<>9__28_0; if (obj == null) { UnityAction val5 = delegate { OnConnectClick(); }; <>c.<>9__28_0 = val5; obj = (object)val5; } ((UnityEvent)onClick).AddListener((UnityAction)obj); ((TMP_Text)gameObject2.GetComponentInChildren()).font = font; } private void CreateFields() { GameObject gameObject = ((Component)((Component)contr).transform.Find("SafeArea/ConnectCanvas(Clone)/Panel/InputSlotName/")).gameObject; ((UnityEvent)(object)gameObject.GetComponent().onValueChanged).AddListener((UnityAction)delegate(string value) { OnSlotChanged(value); }); gameObject.GetComponent().text = ArchipelagoPlugin.apSlotName; GameObject gameObject2 = ((Component)((Component)contr).transform.Find("SafeArea/ConnectCanvas(Clone)/Panel/InputPassword/")).gameObject; ((UnityEvent)(object)gameObject2.GetComponent().onValueChanged).AddListener((UnityAction)delegate(string value) { OnPasswordChanged(value); }); gameObject2.GetComponent().text = ArchipelagoPlugin.apPassword; GameObject gameObject3 = ((Component)((Component)contr).transform.Find("SafeArea/ConnectCanvas(Clone)/Panel/InputUrl/")).gameObject; ((UnityEvent)(object)gameObject3.GetComponent().onValueChanged).AddListener((UnityAction)delegate(string value) { OnUrlChanged(value); }); gameObject3.GetComponent().text = ArchipelagoPlugin.apServerUri; GameObject gameObject4 = ((Component)((Component)contr).transform.Find("SafeArea/ConnectCanvas(Clone)/Panel/InputPort/")).gameObject; ((UnityEvent)(object)gameObject4.GetComponent().onValueChanged).AddListener((UnityAction)delegate(string value) { OnPortChanged(value); }); gameObject4.GetComponent().text = string.Concat(ArchipelagoPlugin.apServerPort); } private void CreateMinimizeButton() { //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_007a: Expected O, but got Unknown Transform val = ((Component)contr).transform.Find("SafeArea/ConnectCanvas(Clone)/Hide"); GameObject gameObject = ((Component)((Component)contr).transform.Find("SafeArea/ConnectCanvas(Clone)/Hide/Button")).gameObject; gameObject.AddComponent(); gameObject.AddComponent(); ((TMP_Text)((Component)val).GetComponentInChildren()).font = font; ButtonClickedEvent onClick = ((Button)gameObject.GetComponent()).onClick; object obj = <>c.<>9__30_0; if (obj == null) { UnityAction val2 = delegate { OnButtonClick(); }; <>c.<>9__30_0 = val2; obj = (object)val2; } ((UnityEvent)onClick).AddListener((UnityAction)obj); MinimizePanel = ((Component)val).gameObject; } private void ButtonPressed() { ConnectPanel.SetActive(!ConnectPanel.activeSelf); minimizeText = ((minimizeText == "-") ? "Archipelago" : "-"); ((TMP_Text)MinimizePanel.GetComponentInChildren()).text = minimizeText; } public static void ChangeButtonWhenConnected() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) Log.LogDebug("Changing Button after connecting."); if ((Object)(object)contr != (Object)null) { GameObject gameObject = ((Component)((Component)contr).transform.Find("SafeArea/ConnectCanvas(Clone)/Panel/Button")).gameObject; ((Graphic)gameObject.GetComponent()).color = Color.red; GameObject gameObject2 = ((Component)((Component)contr).transform.Find("SafeArea/ConnectCanvas(Clone)/Panel/Button/Text (TMP)")).gameObject; ((TMP_Text)gameObject2.GetComponent()).text = "Disconnect"; } } public static void ChangeButtonWhenDisconnected() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) Log.LogDebug("Changing Button after connecting."); if ((Object)(object)contr != (Object)null) { GameObject gameObject = ((Component)((Component)contr).transform.Find("SafeArea/ConnectCanvas(Clone)/Panel/Button")).gameObject; ((Graphic)gameObject.GetComponent()).color = new Color(0.0745f, 0.2824f, 0.4392f, 1f); GameObject gameObject2 = ((Component)((Component)contr).transform.Find("SafeArea/ConnectCanvas(Clone)/Panel/Button/Text (TMP)")).gameObject; ((TMP_Text)gameObject2.GetComponent()).text = "Connect To AP"; } } } public class ArchipelagoLocationCheckProgressBarController : MonoBehaviour { public int fill; public int steps; public Color color; public RectTransform fillRectTransform; public CanvasRenderer canvas; public void Update() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_0091: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.InverseLerp(0f, (float)(steps - 1), (float)fill); if (Object.op_Implicit((Object)(object)fillRectTransform)) { fillRectTransform.anchorMin = new Vector2(0f, 0f); fillRectTransform.anchorMax = new Vector2(num, 1f); fillRectTransform.sizeDelta = new Vector2(1f, 1f); } if (Object.op_Implicit((Object)(object)canvas)) { canvas.SetColor(color); } } } public class ArchipelagoLocationCheckProgressBarUI : IDisposable { private HUD hud; private ArchipelagoLocationCheckProgressBarController locationCheckBar; private GameObject container; private Vector2 textoffset; private Vector2 baroffset; private string textcontent; public static readonly Color defaultColor = new Color(0.8f, 0.5f, 1f, 1f); public static readonly Color altColor = new Color(1f, 0.8f, 0.5f, 1f); public int ItemPickupStep { get; set; } public int CurrentItemCount { get; set; } public Color CurrentColor { get; set; } public ArchipelagoLocationCheckProgressBarUI(Vector2 textoffset, Vector2 baroffset, string text = "Location Check Progress: ") { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_001b: 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) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) HUD.Awake += new hook_Awake(HUD_Awake); this.textoffset = textoffset; this.baroffset = baroffset; textcontent = text; CurrentColor = defaultColor; } public void UpdateCheckProgress(int count, int step) { ItemPickupStep = step; CurrentItemCount = count; if ((Object)(object)locationCheckBar != (Object)null) { locationCheckBar.steps = step; locationCheckBar.fill = count; } } public void ChangeBarColor(Color newcolor) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) CurrentColor = newcolor; if ((Object)(object)locationCheckBar != (Object)null) { locationCheckBar.color = newcolor; } } public void Dispose() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown hud = null; HUD.Awake -= new hook_Awake(HUD_Awake); Object.Destroy((Object)(object)container); } private void HUD_Awake(orig_Awake orig, HUD self) { orig.Invoke(self); hud = self; PopulateHUD(); } private void PopulateHUD() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_005d: 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) //IL_00c1: 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_00d8: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("ArchipelagoHUD"); GameObject val2 = CreateTextLabel(); val2.transform.SetParent(val.transform); val2.transform.ResetScaleAndRotation(); GameObject val3 = CreateProgressBar(); val3.transform.SetParent(val.transform); val3.transform.ResetScaleAndRotation(); val3.GetComponent().anchoredPosition = baroffset; RectTransform val4 = val.AddComponent(); val.transform.SetParent(((Component)hud.expBar).transform.parent.parent); val4.ResetAnchorsAndOffsets(); val4.anchoredPosition = textoffset; val.transform.ResetScaleAndRotation(); locationCheckBar.canvas.SetColor(CurrentColor); locationCheckBar.color = CurrentColor; container = val; } private GameObject CreateTextLabel() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0014: 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) GameObject val = new GameObject("ArchipelagoTextLabel"); RectTransform val2 = val.AddComponent(); val2.anchoredPosition = Vector2.zero; val2.ResetAnchorsAndOffsets(); TextMeshProUGUI val3 = Object.Instantiate(hud.levelText.targetText); ((TMP_Text)val3).text = textcontent; ((TMP_Text)val3).transform.SetParent(val.transform); ((TMP_Text)val3).transform.ResetScaleAndRotation(); RectTransform component = ((Component)val3).GetComponent(); component.ResetAnchorsAndOffsets(); component.anchoredPosition = new Vector2(-85f, -2f); return val; } private GameObject CreateProgressBar() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate(((Component)hud.expBar).gameObject); Object.Destroy((Object)(object)val.GetComponent()); RectTransform component = val.GetComponent(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.pivot = Vector2.right; component.anchoredPosition = Vector2.zero; component.offsetMin = new Vector2(250f, 0f); component.offsetMax = new Vector2(0f, 4f); locationCheckBar = val.AddComponent(); locationCheckBar.fill = CurrentItemCount; locationCheckBar.steps = ItemPickupStep; Transform val2 = val.transform.Find("ShrunkenRoot/FillPanel"); locationCheckBar.fillRectTransform = ((Component)val2).GetComponent(); CanvasRenderer component2 = ((Component)val2).GetComponent(); locationCheckBar.canvas = component2; return val; } } public class ArchipelagoLocationsInEnvironmentController { public class ChecksInEnvironment : ObjectiveTracker { public override string GenerateString() { return $"{CurrentScene}: {CurrentChests}/{CurrentShrines}/{CurrentScavangers}/{CurrentScanners}/{CurrentNewts}"; } public override bool IsDirty() { return true; } } internal static LocationHandler.LocationInformationTemplate count; private static bool addObjective; public static string CurrentScene { get; set; } public static int CurrentChests { get; set; } public static int CurrentShrines { get; set; } public static int CurrentScavangers { get; set; } public static int CurrentScanners { get; set; } public static int CurrentNewts { get; set; } static ArchipelagoLocationsInEnvironmentController() { count = new LocationHandler.LocationInformationTemplate(); ObjectivePanelController.collectObjectiveSources += ObjectivePanelController_collectObjectiveSources; } public static void disable() { ObjectivePanelController.collectObjectiveSources -= ObjectivePanelController_collectObjectiveSources; } private static void ObjectivePanelController_collectObjectiveSources(CharacterMaster arg1, List arg2) { //IL_000e: 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) if (addObjective) { arg2.Add(new ObjectiveSourceDescriptor { master = arg1, objectiveType = typeof(ChecksInEnvironment), source = null }); } } public static void AddObjective() { addObjective = true; } public static void RemoveObjective() { addObjective = false; } } public class ArchipelagoTotalChecksObjectiveController { public class TotalChecksObjectiveTracker : ObjectiveTracker { public override string GenerateString() { return $"Complete location checks: {CurrentChecks}/{TotalChecks}"; } public override bool IsDirty() { return true; } } private static bool addObjective; public static int CurrentChecks { get; set; } public static int TotalChecks { get; set; } static ArchipelagoTotalChecksObjectiveController() { ObjectivePanelController.collectObjectiveSources += ObjectivePanelController_collectObjectiveSources; } private static void ObjectivePanelController_collectObjectiveSources(CharacterMaster arg1, List arg2) { //IL_000e: 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) if (addObjective) { arg2.Add(new ObjectiveSourceDescriptor { master = arg1, objectiveType = typeof(TotalChecksObjectiveTracker), source = null }); } } public static void AddObjective() { addObjective = true; } public static void RemoveObjective() { addObjective = false; } } internal class AssetBundleHelper { public static AssetBundle localAssetBundle { get; private set; } internal static void LoadBundle() { localAssetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)ArchipelagoPlugin.Instance).Info.Location), "connectbundle")); if ((Object)(object)localAssetBundle == (Object)null) { Debug.LogError((object)"Failed to load AssetBundle!"); } } internal static GameObject LoadPrefab(string name) { AssetBundle obj = localAssetBundle; return (obj != null) ? obj.LoadAsset(name) : null; } } } namespace Archipelago.RiskOfRain2.Net { public class AllChecksComplete : INetMessage, ISerializableObject { public static event Action OnAllChecksComplete; public void Deserialize(NetworkReader reader) { } public void OnReceived() { ArchipelagoTotalChecksObjectiveController.RemoveObjective(); if (AllChecksComplete.OnAllChecksComplete != null) { AllChecksComplete.OnAllChecksComplete(); } } public void Serialize(NetworkWriter writer) { } } public class AllChecksCompleteInStage : INetMessage, ISerializableObject { public static event Action OnAllChecksCompleteInStage; public void Deserialize(NetworkReader reader) { } public void OnReceived() { ArchipelagoLocationsInEnvironmentController.RemoveObjective(); if (AllChecksCompleteInStage.OnAllChecksCompleteInStage != null) { AllChecksCompleteInStage.OnAllChecksCompleteInStage(); } } public void Serialize(NetworkWriter writer) { } } public class ArchipelagoChatMessage : INetMessage, ISerializableObject { private string message; public static event Action OnChatReceivedFromClient; public ArchipelagoChatMessage(string message) { this.message = message; } public ArchipelagoChatMessage() { } public void Deserialize(NetworkReader reader) { message = reader.ReadString(); } public void OnReceived() { if (ArchipelagoChatMessage.OnChatReceivedFromClient != null) { ArchipelagoChatMessage.OnChatReceivedFromClient(message); } } public void Serialize(NetworkWriter writer) { writer.Write(message); } } public class ArchipelagoEndMessage : INetMessage, ISerializableObject { public static event Action OnArchipelagoSessionEnd; public void Deserialize(NetworkReader reader) { } public void OnReceived() { if (ArchipelagoEndMessage.OnArchipelagoSessionEnd != null) { ArchipelagoEndMessage.OnArchipelagoSessionEnd(); } } public void Serialize(NetworkWriter writer) { } } public class ArchipelagoStartClassic : INetMessage, ISerializableObject { public static event Action OnArchipelagoStartClassic; public void Deserialize(NetworkReader reader) { } public void OnReceived() { if (ArchipelagoStartClassic.OnArchipelagoStartClassic != null) { ArchipelagoStartClassic.OnArchipelagoStartClassic(); } } public void Serialize(NetworkWriter writer) { } } public class ArchipelagoStartExplore : INetMessage, ISerializableObject { public static event Action OnArchipelagoStartExplore; public void Deserialize(NetworkReader reader) { } public void OnReceived() { if (ArchipelagoStartExplore.OnArchipelagoStartExplore != null) { ArchipelagoStartExplore.OnArchipelagoStartExplore(); } } public void Serialize(NetworkWriter writer) { } } public class ArchipelagoStartMessage : INetMessage, ISerializableObject { public static event Action OnArchipelagoSessionStart; public void Deserialize(NetworkReader reader) { } public void OnReceived() { ArchipelagoTotalChecksObjectiveController.AddObjective(); if (ArchipelagoStartMessage.OnArchipelagoSessionStart != null) { ArchipelagoStartMessage.OnArchipelagoSessionStart(); } } public void Serialize(NetworkWriter writer) { } } public class ArchipelagoTeleportClient : INetMessage, ISerializableObject { public static event Action OnArchipelagoTeleportClient; public void Deserialize(NetworkReader reader) { } public void OnReceived() { if (ArchipelagoTeleportClient.OnArchipelagoTeleportClient != null) { ArchipelagoTeleportClient.OnArchipelagoTeleportClient(); } } public void Serialize(NetworkWriter writer) { } } public class NextStageObjectives : INetMessage, ISerializableObject { public static event Action OnNextStageObjectives; public void Deserialize(NetworkReader reader) { } public void OnReceived() { ArchipelagoLocationsInEnvironmentController.AddObjective(); if (NextStageObjectives.OnNextStageObjectives != null) { NextStageObjectives.OnNextStageObjectives(); } } public void Serialize(NetworkWriter writer) { } } public class SyncCurrentEnvironmentCheckProgress : INetMessage, ISerializableObject { private string scene; private int chest; private int shrine; private int scavanger; private int scanner; private int newt; public SyncCurrentEnvironmentCheckProgress(string scene, int chest, int shrine, int scavanger, int scanner, int newt) { this.scene = scene; this.chest = chest; this.shrine = shrine; this.scavanger = scavanger; this.scanner = scanner; this.newt = newt; } public SyncCurrentEnvironmentCheckProgress() { } public void Deserialize(NetworkReader reader) { scene = reader.ReadString(); chest = reader.ReadInt32(); shrine = reader.ReadInt32(); scavanger = reader.ReadInt32(); scanner = reader.ReadInt32(); newt = reader.ReadInt32(); } public void OnReceived() { ArchipelagoLocationsInEnvironmentController.CurrentScene = scene; ArchipelagoLocationsInEnvironmentController.CurrentChests = chest; ArchipelagoLocationsInEnvironmentController.CurrentShrines = shrine; ArchipelagoLocationsInEnvironmentController.CurrentScavangers = scavanger; ArchipelagoLocationsInEnvironmentController.CurrentScanners = scanner; ArchipelagoLocationsInEnvironmentController.CurrentNewts = newt; } public void Serialize(NetworkWriter writer) { writer.Write(scene); writer.Write(chest); writer.Write(shrine); writer.Write(scavanger); writer.Write(scanner); writer.Write(newt); } } public class SyncLocationCheckProgress : INetMessage, ISerializableObject { public delegate void LocationCheckSyncHandler(int count, int step); private int itemPickupCount; private int itemPickupStep; public static event LocationCheckSyncHandler OnLocationSynced; public SyncLocationCheckProgress() { } public SyncLocationCheckProgress(int itemCount, int pickupStep) { itemPickupCount = itemCount; itemPickupStep = pickupStep; } public void Deserialize(NetworkReader reader) { itemPickupStep = reader.ReadInt32(); itemPickupCount = reader.ReadInt32(); } public void OnReceived() { if (SyncLocationCheckProgress.OnLocationSynced != null) { SyncLocationCheckProgress.OnLocationSynced(itemPickupCount, itemPickupStep); } } public void Serialize(NetworkWriter writer) { writer.Write(itemPickupStep); writer.Write(itemPickupCount); } } public class SyncShrineCheckProgress : INetMessage, ISerializableObject { public delegate void ShrineCheckSyncHandler(int count, int step); private int itemPickupCount; private int itemPickupStep; public static event ShrineCheckSyncHandler OnShrineSynced; public SyncShrineCheckProgress() { } public SyncShrineCheckProgress(int shrineCount, int shrinePickupStep) { itemPickupCount = shrineCount; itemPickupStep = shrinePickupStep; } public void Deserialize(NetworkReader reader) { itemPickupStep = reader.ReadInt32(); itemPickupCount = reader.ReadInt32(); } public void OnReceived() { if (SyncShrineCheckProgress.OnShrineSynced != null) { SyncShrineCheckProgress.OnShrineSynced(itemPickupCount, itemPickupStep); } } public void Serialize(NetworkWriter writer) { writer.Write(itemPickupStep); writer.Write(itemPickupCount); } } public class SyncTotalCheckProgress : INetMessage, ISerializableObject { private int currentChecks; private int totalChecks; public SyncTotalCheckProgress() { } public SyncTotalCheckProgress(int current, int total) { currentChecks = current; totalChecks = total; } public void Deserialize(NetworkReader reader) { currentChecks = reader.ReadInt32(); totalChecks = reader.ReadInt32(); } public void OnReceived() { ArchipelagoTotalChecksObjectiveController.CurrentChecks = currentChecks; ArchipelagoTotalChecksObjectiveController.TotalChecks = totalChecks; } public void Serialize(NetworkWriter writer) { writer.Write(currentChecks); writer.Write(totalChecks); } } } namespace Archipelago.RiskOfRain2.Lookup { public class LocationNames { public static readonly Dictionary locationsNames = new Dictionary { { 3, "Aphelian Sanctuary" }, { 7, "Distant Roost" }, { 8, "Distant Roost (2)" }, { 28, "Verdant Falls" }, { 10, "Abyssal Depths" }, { 12, "Wetland Aspect" }, { 13, "Rallypoint Delta" }, { 15, "Titanic Plains" }, { 16, "Titanic Plains (2)" }, { 17, "Abandoned Aqueduct" }, { 35, "Sundered Grove" }, { 37, "Siren's Call" }, { 38, "Sky Meadow" }, { 39, "Siphoned Forest" }, { 41, "Sulfur Pools" }, { 47, "Scorched Acres" }, { 32, "Commencement" }, { 4, "Void Fields" }, { 46, "Void Locus" }, { 45, "The Planetarium" }, { 5, "Hidden Realm: Bulwark's Ambry" }, { 6, "Hidden Realm: Bazaar Between Time" }, { 14, "Hidden Realm: Gilded Coast" }, { 27, "Hidden Realm: A Moment, Whole" }, { 33, "Hidden Realm: A Moment, Fractured" }, { 34, "Viscous Falls" }, { 54, "Shattered Abodes" }, { 55, "Disturbed Impact" }, { 36, "Reformed Altar" }, { 21, "Treeborn Colony" }, { 22, "Golden Dieback" }, { 23, "Helminth Hatchery" }, { 40, "Prime Meridian" } }; public static readonly Dictionary cachedLocationsNames = new Dictionary { { 3, "ancientloft" }, { 4, "arena" }, { 5, "artifactworld" }, { 6, "bazaar" }, { 7, "blackbeach" }, { 8, "blackbeach2" }, { 10, "dampcavesimple" }, { 12, "foggyswamp" }, { 13, "frozenwall" }, { 14, "goldshores" }, { 15, "golemplains" }, { 16, "golemplains2" }, { 17, "goolake" }, { 27, "limbo" }, { 28, "lakes" }, { 32, "moon2" }, { 33, "mysteryspace" }, { 35, "rootjungle" }, { 37, "shipgraveyard" }, { 38, "skymeadow" }, { 39, "snowyforest" }, { 41, "sulfurpools" }, { 45, "voidraid" }, { 46, "voidstage" }, { 47, "wispgraveyard" }, { 34, "lakesnight" }, { 54, "village" }, { 55, "villagenight" }, { 36, "lemuriantemple" }, { 21, "habitat" }, { 22, "habitatfall" }, { 23, "helminthroost" }, { 40, "meridian" } }; public string GetLocationName(string cachedName) { int sceneIndex = GetSceneIndex(cachedName); if (locationsNames.TryGetValue(sceneIndex, out var value)) { return value; } return ""; } public string GetLocationNameByIndex(int index) { if (locationsNames.TryGetValue(index, out var value)) { return value; } return ""; } public string GetCachedLocationNameByIndex(int index) { if (cachedLocationsNames.TryGetValue(index, out var value)) { return value; } return ""; } public bool LocationNamesContains(string sceneName) { return locationsNames.ContainsValue(sceneName); } public bool CachedLocationNamesContains(string cachedName) { return cachedLocationsNames.ContainsValue(cachedName); } public int GetSceneIndex(string cachedName) { foreach (KeyValuePair cachedLocationsName in cachedLocationsNames) { if (cachedLocationsName.Value == cachedName) { return cachedLocationsName.Key; } } return 0; } } } namespace Archipelago.RiskOfRain2.Handlers { internal class ClientItemsHandler : IHandler { public static ArchipelagoLocationCheckProgressBarUI itemCheckBar; public static ArchipelagoLocationCheckProgressBarUI shrineCheckBar; public ClientItemsHandler() { //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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) itemCheckBar = new ArchipelagoLocationCheckProgressBarUI(new Vector2(-40f, 0f), Vector2.zero, "Item Check Progress:"); shrineCheckBar = new ArchipelagoLocationCheckProgressBarUI(new Vector2(0f, 170f), new Vector2(50f, -50f), "Shrine Check Progress:"); } public void Hook() { Log.LogDebug("Client Items Started"); SyncLocationCheckProgress.OnLocationSynced += itemCheckBar.UpdateCheckProgress; ArchipelagoStartExplore.OnArchipelagoStartExplore += ArchipelagoStartExplore_OnArchipelagoStartExplore; ArchipelagoStartClassic.OnArchipelagoStartClassic += ArchipelagoStartClassic_OnArchipelagoStartClassic; ArchipelagoTeleportClient.OnArchipelagoTeleportClient += ArchipelagoTeleportClient_OnArchipelagoTeleportClient; Run.onRunDestroyGlobal += Run_onRunDestroyGlobal; } public void UnHook() { ArchipelagoTeleportClient.OnArchipelagoTeleportClient -= ArchipelagoTeleportClient_OnArchipelagoTeleportClient; if (itemCheckBar != null) { itemCheckBar.Dispose(); } if (shrineCheckBar != null) { shrineCheckBar.Dispose(); } ArchipelagoStartExplore.OnArchipelagoStartExplore -= ArchipelagoStartExplore_OnArchipelagoStartExplore; Run.onRunDestroyGlobal -= Run_onRunDestroyGlobal; } private void ArchipelagoStartClassic_OnArchipelagoStartClassic() { Log.LogDebug("Client Classic Started"); if (shrineCheckBar != null) { shrineCheckBar.Dispose(); } } private void ArchipelagoStartExplore_OnArchipelagoStartExplore() { Log.LogDebug("Client Explore Started"); SyncShrineCheckProgress.OnShrineSynced += shrineCheckBar.UpdateCheckProgress; } private void ArchipelagoTeleportClient_OnArchipelagoTeleportClient() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //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_008d: 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) //IL_00a3: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) foreach (NetworkUser readOnlyLocalPlayers in NetworkUser.readOnlyLocalPlayersList) { if (Object.op_Implicit((Object)(object)readOnlyLocalPlayers)) { SpawnCard val = ScriptableObject.CreateInstance(); val = LegacyResourcesAPI.Load("SpawnCards/InteractableSpawnCard/iscBarrel1"); Xoroshiro128Plus val2 = new Xoroshiro128Plus(RoR2Application.rng); if ((Object)(object)DirectorCore.instance != (Object)null) { GameObject val3 = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(val, new DirectorPlacementRule { placementMode = (PlacementMode)4 }, val2)); Vector3 position = val3.transform.position; Log.LogDebug($"teleport position {position + new Vector3(0f, 10f, 0f)}"); CharacterBody body = readOnlyLocalPlayers.master.GetBody(); ((Component)body).GetComponentInChildren().SetPosition(position + new Vector3(0f, 10f, 0f), true); val3.SetActive(false); } } } } private void Run_onRunDestroyGlobal(Run obj) { UnHook(); } } internal class DeathLinkHandler : IHandler { private readonly DeathLinkService deathLink; private readonly ConcurrentQueue receivedDeathQueue = new ConcurrentQueue(); private volatile bool recievedDeath = false; private float deathCooldownUntil = 0f; private bool deathLinkActive = false; public DeathLinkHandler(DeathLinkService deathLink) { Log.LogDebug("DeathLink handler constructor."); this.deathLink = deathLink; } public void Hook() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown if (!deathLinkActive) { SceneInfo.Awake += new hook_Awake(SceneInfo_Awake); SceneExitController.Begin += new hook_Begin(SceneExitController_Begin); RoR2Application.Update += new hook_Update(DeathLink_Update); deathLinkActive = true; } } public void UnHook() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown deathLink.OnDeathLinkReceived -= new DeathLinkReceivedHandler(DeathLink_OnDeathLinkReceived); CharacterMaster.OnBodyDeath -= new hook_OnBodyDeath(CharacterMaster_OnBodyDeath); SceneInfo.Awake -= new hook_Awake(SceneInfo_Awake); SceneExitController.Begin -= new hook_Begin(SceneExitController_Begin); RoR2Application.Update -= new hook_Update(DeathLink_Update); deathLinkActive = false; } private void SceneInfo_Awake(orig_Awake orig, SceneInfo self) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown orig.Invoke(self); if (deathLinkActive) { deathLink.OnDeathLinkReceived += new DeathLinkReceivedHandler(DeathLink_OnDeathLinkReceived); CharacterMaster.OnBodyDeath += new hook_OnBodyDeath(CharacterMaster_OnBodyDeath); recievedDeath = false; } } private void SceneExitController_Begin(orig_Begin orig, SceneExitController self) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown orig.Invoke(self); deathLink.OnDeathLinkReceived -= new DeathLinkReceivedHandler(DeathLink_OnDeathLinkReceived); CharacterMaster.OnBodyDeath -= new hook_OnBodyDeath(CharacterMaster_OnBodyDeath); } private void CharacterMaster_OnBodyDeath(orig_OnBodyDeath orig, CharacterMaster self, CharacterBody body) { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown try { if (PlayerCharacterMasterController.instances.Select((PlayerCharacterMasterController x) => x.master).Contains(self)) { string text = ""; text = ((!(self.playerCharacterMasterController.GetDisplayName() == "")) ? self.playerCharacterMasterController.GetDisplayName() : ArchipelagoClient.connectedPlayerName); Log.LogDebug("Player OnBodyDeath of " + text + "."); if (!recievedDeath) { recievedDeath = true; deathCooldownUntil = Time.time + 10f; DeathLink val = new DeathLink(text, "The planet rejected " + text); Log.LogDebug($"Deathlink sending. Source: {val.Source} Cause: {val.Cause} Timestamp: {val.Timestamp}"); try { deathLink.SendDeathLink(val); } catch (ArchipelagoSocketClosedException) { Log.LogDebug("Deathlink failed to send because socket was closed."); } } } orig.Invoke(self, body); } catch (Exception data) { Log.LogError("Something went wrong in CharacterMaster_OnBodyDeath"); Log.LogError(data); orig.Invoke(self, body); } } private void DeathLink_Update(orig_Update orig, RoR2Application self) { if (recievedDeath && Time.time >= deathCooldownUntil) { Log.LogDebug("It has been 10 seconds you can now die again!"); recievedDeath = false; } if (!recievedDeath) { if (receivedDeathQueue.TryDequeue(out var result)) { recievedDeath = true; deathCooldownUntil = Time.time + 10f; classicDeathLink(result); } } else { DeathLink result2; while (receivedDeathQueue.TryDequeue(out result2)) { } } orig.Invoke(self); } private void DeathLink_OnDeathLinkReceived(DeathLink deathLink) { Log.LogDebug($"Deathlink received. Source: {deathLink.Source} Cause: {deathLink.Cause} Timestamp: {deathLink.Timestamp}"); if (!recievedDeath) { receivedDeathQueue.Enqueue(deathLink); } } private void classicDeathLink(DeathLink dl) { //IL_0022: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) Log.LogDebug("Running classic DeathLink"); ReadOnlyCollection instances = PlayerCharacterMasterController.instances; ChatMessage.SendColored(dl.Source + " died...", Color.red); foreach (PlayerCharacterMasterController item in instances) { if ((Object)(object)item.master != (Object)null && (Object)(object)item.master.GetBody() != (Object)null && (Object)(object)item.master.GetBody().healthComponent != (Object)null) { Log.LogDebug($"Selected player {item.GetDisplayName()} to die. NetID: {((NetworkBehaviour)item).netId}"); try { item.master.GetBody().healthComponent.Suicide((GameObject)null, (GameObject)null, default(DamageTypeCombo)); } catch (Exception data) { Log.LogDebug("Something went wrong on killing the player"); Log.LogError(data); } } else { Log.LogError("Selected player's body not found."); } } } } internal interface IHandler { void Hook(); void UnHook(); } internal class LocationHandler : IHandler { public enum LocationTypes { chest, shrine, scavenger, radio_scanner, newt_altar, MAX } private class ArchipelagoLocationOffsets { public const int ror2_locations_start_orderedstage = 38250; public static readonly int[] offset = new int[6] { 0, 20, 40, 41, 42, 44 }; public static readonly int allocation = offset[5]; } public class LocationInformationTemplate { private int[] data = new int[5]; public int this[int i] { get { return data[i]; } set { data[i] = value; } } public int this[LocationTypes type] { get { return data[(int)type]; } set { data[(int)type] = value; } } public int total() { int num = 0; for (int i = 0; i < 5; i++) { num += data[i]; } return num; } public string scene() { SceneDef locationScene = GetLocationScene(); if (LocationNames.locationsNames.ContainsKey(sceneIndex)) { ArchipelagoLocationsInEnvironmentController.CurrentScene = LocationNames.locationsNames[sceneIndex] ?? ""; return LocationNames.locationsNames[sceneIndex] ?? ""; } ArchipelagoLocationsInEnvironmentController.CurrentScene = "Environment Location"; return "Environment Location"; } public LocationInformationTemplate copy() { LocationInformationTemplate locationInformationTemplate = new LocationInformationTemplate(); for (int i = 0; i < 5; i++) { locationInformationTemplate[i] = data[i]; } return locationInformationTemplate; } } public const int ancientloft = 3; public const int blackbeach = 7; public const int blackbeach2 = 8; public const int lakes = 28; public const int dampcavesimple = 10; public const int foggyswamp = 12; public const int frozenwall = 13; public const int golemplains = 15; public const int golemplains2 = 16; public const int goolake = 17; public const int rootjungle = 35; public const int shipgraveyard = 37; public const int skymeadow = 38; public const int snowyforest = 39; public const int sulfurpools = 41; public const int wispgraveyard = 47; public const int lakesnight = 34; public const int village = 54; public const int villagenight = 55; public const int lemuriantemple = 36; public const int habitat = 21; public const int habitatfall = 22; public const int helminthroost = 23; public const int meridian = 40; public static int sceneIndex = 0; public static readonly string[] LocationTypesSlotName = new string[5] { "chestsPerStage", "shrinesPerStage", "scavengersPerStage", "scannerPerStage", "altarsPerStage" }; public static readonly string[] LocationTypesShortName = new string[5] { "chests", "shrines", "scavengers", "scanner", "altars" }; private ArchipelagoSession session; private LocationInformationTemplate originallocationstemplate; private Dictionary currentlocations; public ArchipelagoLocationCheckProgressBarUI itemBar = null; public ArchipelagoLocationCheckProgressBarUI shrineBar = null; private uint chestitemsPickedUp = 0u; private uint shrinesUsed = 0u; public uint itemPickupStep = 3u; public uint shrineUseStep = 3u; private bool chestblockitem = false; private bool sacrificeitem = false; private bool chanceshrineblockitem = false; private bool chanceshrinebeat = false; private bool bloodshrineblockgold = false; private int scavbackpackHash = 0; private bool scavbackpackWasLocation = false; private bool scavbackpackblockitem = false; public const int testing = 3; private bool highlightOn = false; public static SceneDef sceneDef { get; private set; } public static LocationInformationTemplate buildTemplateFromSlotData(Dictionary SlotData) { LocationInformationTemplate locationInformationTemplate = new LocationInformationTemplate(); if (SlotData != null) { for (int i = 0; i < 5; i++) { if (SlotData.TryGetValue(LocationTypesSlotName[i], out var value)) { locationInformationTemplate[i] = Convert.ToInt32(value); } } } return locationInformationTemplate; } public LocationHandler(ArchipelagoSession session, LocationInformationTemplate locationstemplate) { Log.LogDebug("Location handler constructor."); this.session = session; originallocationstemplate = locationstemplate.copy(); currentlocations = new Dictionary(); InitialSetupLocationDict(locationstemplate); } private void InitialSetupLocationDict(LocationInformationTemplate locationstemplate) { currentlocations.Add(3, locationstemplate); currentlocations.Add(7, locationstemplate); currentlocations.Add(8, locationstemplate); currentlocations.Add(28, locationstemplate); currentlocations.Add(10, locationstemplate); currentlocations.Add(12, locationstemplate); currentlocations.Add(13, locationstemplate); currentlocations.Add(15, locationstemplate); currentlocations.Add(16, locationstemplate); currentlocations.Add(17, locationstemplate); currentlocations.Add(35, locationstemplate); currentlocations.Add(37, locationstemplate); currentlocations.Add(38, locationstemplate); currentlocations.Add(39, locationstemplate); currentlocations.Add(41, locationstemplate); currentlocations.Add(47, locationstemplate); currentlocations.Add(34, locationstemplate); currentlocations.Add(54, locationstemplate); currentlocations.Add(55, locationstemplate); currentlocations.Add(36, locationstemplate); currentlocations.Add(21, locationstemplate); currentlocations.Add(22, locationstemplate); currentlocations.Add(23, locationstemplate); } public void CatchUpSceneLocations(string sceneName) { int num = GetSceneIndex(sceneName); Dictionary dictionary = currentlocations.ToDictionary((KeyValuePair k) => k.Key, (KeyValuePair k) => k.Value.copy()); if (!dictionary.TryGetValue(num, out var value)) { return; } ReadOnlyCollection allLocationsChecked = session.Locations.AllLocationsChecked; int num2 = num * ArchipelagoLocationOffsets.allocation + 38250; Log.LogDebug($"Doing catch up on environment: index {num}, stage name {sceneName}"); Log.LogDebug($"environment_start_id {num2}"); for (int num3 = 0; num3 < 5; num3++) { for (int num4 = originallocationstemplate[num3] - value[num3]; num4 < originallocationstemplate[num3] && allLocationsChecked.Contains(num4 + ArchipelagoLocationOffsets.offset[num3] + num2); num4++) { value[num3]--; } Log.LogDebug($"caught up to {LocationTypesShortName[num3]} {value[num3]}"); } currentlocations[num] = value; } public void Hook() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected O, but got Unknown //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Expected O, but got Unknown //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Expected O, but got Unknown //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Expected O, but got Unknown //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Expected O, but got Unknown SceneCatalog.OnActiveSceneChanged += new hook_OnActiveSceneChanged(SceneCatalog_OnActiveSceneChanged); SceneExitController.OnDestroy += new hook_OnDestroy(SceneExitController_OnDestroy); SceneInfo.Awake += new hook_Awake(SceneInfo_Awake); SceneCollection.AddToWeightedSelection += new hook_AddToWeightedSelection(SceneCollection_AddToWeightedSelection); SacrificeArtifactManager.OnServerCharacterDeath += new hook_OnServerCharacterDeath(SacrificeArtifactManager_OnServerCharacterDeath); PickupDropletController.CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 += new hook_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3(PickupDropletController_CreatePickupDroplet_ChestDrop); PortalStatueBehavior.GrantPortalEntry += new hook_GrantPortalEntry(PortalStatueBehavior_GrantPortalEntry_Gold); ShrineBloodBehavior.AddShrineStack += new hook_AddShrineStack(ShrineBloodBehavior_AddShrineStack); CharacterMaster.GiveMoney += new hook_GiveMoney(CharacterMaster_GiveMoney); ShrineChanceBehavior.AddShrineStack += new hook_AddShrineStack(ShrineChanceBehavior_AddShrineStack); PickupDropletController.CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 += new hook_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3(PickupDropletController_CreatePickupDroplet_ChanceShrine); ShrineCombatBehavior.AddShrineStack += new hook_AddShrineStack(ShrineCombatBehavior_AddShrineStack); ShrineRestackBehavior.AddShrineStack += new hook_AddShrineStack(ShrineRestackBehavior_AddShrineStack); BossGroup.DropRewards += new hook_DropRewards(BossGroup_DropRewards); ShrineHealingBehavior.AddShrineStack += new hook_AddShrineStack(ShrineHealingBehavior_AddShrineStack); ShrineColossusAccessBehavior.OnInteraction += new hook_OnInteraction(ShrineColossusAccessBehavior_OnInteraction); Opening.OnEnter += new hook_OnEnter(Opening_OnEnter); ChestBehavior.ItemDrop += new hook_ItemDrop(ChestBehavior_ItemDrop_Scavenger); PickupDropletController.CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 += new hook_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3(PickupDropletController_CreatePickupDroplet_Scavenger); SceneDirector.PopulateScene += new hook_PopulateScene(SceneDirector_PopulateScene); RadiotowerTerminal.GrantUnlock += new hook_GrantUnlock(RadiotowerTerminal_GrantUnlock); ArchipelagoConsoleCommand.OnArchipelagoHighlightSatelliteCommandCalled += ArchipelagoConsoleCommand_OnArchipelagoHighlightSatelliteCommandCalled; ArchipelagoConsoleCommand_OnArchipelagoHighlightSatelliteCommandCalled(ArchipelagoPlugin.SatelliteEntry.Value); PortalStatueBehavior.GrantPortalEntry += new hook_GrantPortalEntry(PortalStatueBehavior_GrantPortalEntry_Blue); } public void UnHook() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected O, but got Unknown //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Expected O, but got Unknown //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Expected O, but got Unknown //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Expected O, but got Unknown //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Expected O, but got Unknown //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Expected O, but got Unknown SceneCatalog.OnActiveSceneChanged -= new hook_OnActiveSceneChanged(SceneCatalog_OnActiveSceneChanged); SceneExitController.OnDestroy -= new hook_OnDestroy(SceneExitController_OnDestroy); SceneInfo.Awake -= new hook_Awake(SceneInfo_Awake); SceneCollection.AddToWeightedSelection -= new hook_AddToWeightedSelection(SceneCollection_AddToWeightedSelection); ChestBehavior.ItemDrop -= new hook_ItemDrop(ChestBehavior_ItemDrop_Chest); SacrificeArtifactManager.OnServerCharacterDeath -= new hook_OnServerCharacterDeath(SacrificeArtifactManager_OnServerCharacterDeath); PickupDropletController.CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 -= new hook_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3(PickupDropletController_CreatePickupDroplet_ChestDrop); PortalStatueBehavior.GrantPortalEntry -= new hook_GrantPortalEntry(PortalStatueBehavior_GrantPortalEntry_Gold); ShrineBloodBehavior.AddShrineStack -= new hook_AddShrineStack(ShrineBloodBehavior_AddShrineStack); CharacterMaster.GiveMoney -= new hook_GiveMoney(CharacterMaster_GiveMoney); ShrineChanceBehavior.AddShrineStack -= new hook_AddShrineStack(ShrineChanceBehavior_AddShrineStack); PickupDropletController.CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 -= new hook_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3(PickupDropletController_CreatePickupDroplet_ChanceShrine); ShrineCombatBehavior.AddShrineStack -= new hook_AddShrineStack(ShrineCombatBehavior_AddShrineStack); ShrineRestackBehavior.AddShrineStack -= new hook_AddShrineStack(ShrineRestackBehavior_AddShrineStack); BossGroup.DropRewards -= new hook_DropRewards(BossGroup_DropRewards); ShrineHealingBehavior.AddShrineStack -= new hook_AddShrineStack(ShrineHealingBehavior_AddShrineStack); ShrineColossusAccessBehavior.OnInteraction -= new hook_OnInteraction(ShrineColossusAccessBehavior_OnInteraction); Opening.OnEnter -= new hook_OnEnter(Opening_OnEnter); ChestBehavior.ItemDrop -= new hook_ItemDrop(ChestBehavior_ItemDrop_Scavenger); PickupDropletController.CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 -= new hook_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3(PickupDropletController_CreatePickupDroplet_Scavenger); SceneDirector.PopulateScene -= new hook_PopulateScene(SceneDirector_PopulateScene); RadiotowerTerminal.GrantUnlock -= new hook_GrantUnlock(RadiotowerTerminal_GrantUnlock); ArchipelagoConsoleCommand.OnArchipelagoHighlightSatelliteCommandCalled -= ArchipelagoConsoleCommand_OnArchipelagoHighlightSatelliteCommandCalled; PortalStatueBehavior.GrantPortalEntry -= new hook_GrantPortalEntry(PortalStatueBehavior_GrantPortalEntry_Blue); } private void SceneInfo_Awake(orig_Awake orig, SceneInfo self) { orig.Invoke(self); sceneDef = self.sceneDef; GetCurrentSceneIndex(); Log.LogDebug($"Scene Index is {sceneIndex}"); } public static SceneDef GetLocationScene() { return sceneDef; } public void GetCurrentSceneIndex() { foreach (KeyValuePair cachedLocationsName in LocationNames.cachedLocationsNames) { if (cachedLocationsName.Value == sceneDef.cachedName) { sceneIndex = cachedLocationsName.Key; return; } } sceneIndex = 100; } public int GetSceneIndex(string sceneName) { foreach (KeyValuePair cachedLocationsName in LocationNames.cachedLocationsNames) { if (cachedLocationsName.Value == sceneName) { return cachedLocationsName.Key; } } return 0; } private void updateBar(LocationTypes loctype) { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) ArchipelagoLocationCheckProgressBarUI archipelagoLocationCheckProgressBarUI = null; int num = 0; int num2 = 1; switch (loctype) { case LocationTypes.chest: archipelagoLocationCheckProgressBarUI = itemBar; num = (int)chestitemsPickedUp; num2 = (int)itemPickupStep; NetMessageExtensions.Send((INetMessage)(object)new SyncLocationCheckProgress(num % num2, num2), (NetworkDestination)1); break; case LocationTypes.shrine: archipelagoLocationCheckProgressBarUI = shrineBar; num = (int)shrinesUsed; num2 = (int)shrineUseStep; NetMessageExtensions.Send((INetMessage)(object)new SyncShrineCheckProgress(num % num2, num2), (NetworkDestination)1); break; } if (archipelagoLocationCheckProgressBarUI != null) { archipelagoLocationCheckProgressBarUI.UpdateCheckProgress(num % num2, num2); archipelagoLocationCheckProgressBarUI.ChangeBarColor((0 < checkAvailable(loctype)) ? ArchipelagoLocationCheckProgressBarUI.defaultColor : ArchipelagoLocationCheckProgressBarUI.altColor); } } private void sendLocation(int id) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown LocationChecksPacket val = new LocationChecksPacket(); val.Locations = new List { id }.ToArray(); Log.LogDebug($"planning to send location {id}"); session.Socket.SendPacketAsync((ArchipelagoPacketBase)(object)val); } private int checkAvailable(LocationTypes loctype) { int key = GetSceneIndex(sceneDef.cachedName); if (!currentlocations.TryGetValue(key, out var value)) { return 0; } if (LocationTypes.MAX == loctype) { return value.total(); } return value[loctype]; } private bool sendNextAvailable(LocationTypes loctype) { if (LocationTypes.MAX == loctype) { throw new ArgumentException("MAX is not a sendable location type."); } if (!currentlocations.TryGetValue(sceneIndex, out var value)) { return false; } int num = sceneIndex * ArchipelagoLocationOffsets.allocation + 38250; if (value[loctype] == 0) { return false; } int num2 = originallocationstemplate[loctype] - value[loctype]; int num3 = ArchipelagoLocationOffsets.offset[(int)loctype]; value[loctype]--; ArchipelagoLocationsInEnvironmentController.count[loctype] = value[loctype]; ArchipelagoTotalChecksObjectiveController.CurrentChecks++; int current = ArchipelagoTotalChecksObjectiveController.CurrentChecks++; int totalChecks = ArchipelagoTotalChecksObjectiveController.TotalChecks; NetMessageExtensions.Send((INetMessage)(object)new SyncTotalCheckProgress(current, totalChecks), (NetworkDestination)1); if (ArchipelagoLocationsInEnvironmentController.count.total() == 0) { NetMessageExtensions.Send((INetMessage)(object)new AllChecksCompleteInStage(), (NetworkDestination)1); ArchipelagoLocationsInEnvironmentController.RemoveObjective(); } else { NetMessageExtensions.Send((INetMessage)(object)new NextStageObjectives(), (NetworkDestination)1); ArchipelagoLocationsInEnvironmentController.AddObjective(); UpdateClientsUI(); } currentlocations[sceneIndex] = value; sendLocation(num2 + num3 + num); return true; } private bool UpdateClientsUI() { if (!currentlocations.TryGetValue(sceneIndex, out var value)) { return false; } ArchipelagoLocationsInEnvironmentController.CurrentScene = value.scene(); ArchipelagoLocationsInEnvironmentController.CurrentChests = value[LocationTypes.chest]; ArchipelagoLocationsInEnvironmentController.CurrentShrines = value[LocationTypes.shrine]; ArchipelagoLocationsInEnvironmentController.CurrentScavangers = value[LocationTypes.scavenger]; ArchipelagoLocationsInEnvironmentController.CurrentScanners = value[LocationTypes.radio_scanner]; ArchipelagoLocationsInEnvironmentController.CurrentNewts = value[LocationTypes.newt_altar]; NetMessageExtensions.Send((INetMessage)(object)new SyncCurrentEnvironmentCheckProgress(value.scene(), value[LocationTypes.chest], value[LocationTypes.shrine], value[LocationTypes.scavenger], value[LocationTypes.radio_scanner], value[LocationTypes.newt_altar]), (NetworkDestination)1); return true; } private void SceneCatalog_OnActiveSceneChanged(orig_OnActiveSceneChanged orig, Scene oldScene, Scene newScene) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(oldScene, newScene); LoadItemPickupHooks(); } public void LoadItemPickupHooks() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown CatchUpSceneLocations(sceneDef.cachedName); chestblockitem = false; sacrificeitem = false; chanceshrineblockitem = false; chanceshrinebeat = false; bloodshrineblockgold = false; scavbackpackHash = 0; scavbackpackWasLocation = false; scavbackpackblockitem = false; updateBar(LocationTypes.chest); updateBar(LocationTypes.shrine); if (0 < checkAvailable(LocationTypes.chest)) { ChestBehavior.ItemDrop += new hook_ItemDrop(ChestBehavior_ItemDrop_Chest); SacrificeArtifactManager.OnServerCharacterDeath += new hook_OnServerCharacterDeath(SacrificeArtifactManager_OnServerCharacterDeath); PickupDropletController.CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 += new hook_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3(PickupDropletController_CreatePickupDroplet_ChestDrop); } for (int i = 0; i < 5; i++) { ArchipelagoLocationsInEnvironmentController.count[i] = checkAvailable((LocationTypes)i); } UpdateClientsUI(); if (ArchipelagoLocationsInEnvironmentController.count.total() == 0) { NetMessageExtensions.Send((INetMessage)(object)new AllChecksCompleteInStage(), (NetworkDestination)1); ArchipelagoLocationsInEnvironmentController.RemoveObjective(); } else { NetMessageExtensions.Send((INetMessage)(object)new NextStageObjectives(), (NetworkDestination)1); ArchipelagoLocationsInEnvironmentController.AddObjective(); } } private void SceneExitController_OnDestroy(orig_OnDestroy orig, SceneExitController self) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown ChestBehavior.ItemDrop -= new hook_ItemDrop(ChestBehavior_ItemDrop_Chest); SacrificeArtifactManager.OnServerCharacterDeath -= new hook_OnServerCharacterDeath(SacrificeArtifactManager_OnServerCharacterDeath); PickupDropletController.CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 -= new hook_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3(PickupDropletController_CreatePickupDroplet_ChestDrop); orig.Invoke(self); } private void SceneCollection_AddToWeightedSelection(orig_AddToWeightedSelection orig, SceneCollection self, WeightedSelection dest, Func canAdd) { orig.Invoke(self, dest, canAdd); if (dest == null) { return; } for (int i = 0; i < dest.Count; i++) { string cachedName = dest.choices[i].value.cachedName; int num = GetSceneIndex(cachedName); CatchUpSceneLocations(cachedName); Log.LogDebug($"Environment {num} with weight {dest.choices[i].weight} has stage name {cachedName}."); if (currentlocations.TryGetValue(num, out var value)) { int num2 = value.total() * 5; Log.LogDebug($"Environment {num} with weight {dest.choices[i].weight} has {num2 / 5} locations, adjusting weight."); dest.ModifyChoiceWeight(i, dest.choices[i].weight + (float)num2); Log.LogDebug($"Adjusted weight to {dest.choices[i].weight}."); if (dest.choices[i].weight <= 0f) { Log.LogDebug($"Environment {num} weight adjusted to 1 to prevent zero or negative weight."); dest.ModifyChoiceWeight(i, 1f); } } else { Log.LogDebug($"Environment {num} with weight {dest.choices[i].weight} does not have locations."); } } } private bool chestOpened() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown bool flag = 0 < checkAvailable(LocationTypes.chest); if (!flag) { ChestBehavior.ItemDrop -= new hook_ItemDrop(ChestBehavior_ItemDrop_Chest); SacrificeArtifactManager.OnServerCharacterDeath -= new hook_OnServerCharacterDeath(SacrificeArtifactManager_OnServerCharacterDeath); PickupDropletController.CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 -= new hook_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3(PickupDropletController_CreatePickupDroplet_ChestDrop); } if (flag || (chestitemsPickedUp + 1) % itemPickupStep != 0) { chestitemsPickedUp++; Log.LogDebug("chest counted as towards the locations"); updateBar(LocationTypes.chest); } else { Log.LogDebug("chest not counted as towards the locations"); } if (flag && chestitemsPickedUp % itemPickupStep == 0) { return sendNextAvailable(LocationTypes.chest); } return false; } private void ChestBehavior_ItemDrop_Chest(orig_ItemDrop orig, ChestBehavior self) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && self.currentPickup != UniquePickup.none && scavbackpackHash != ((object)self).GetHashCode()) { chestblockitem = chestOpened(); } if (!chestblockitem) { orig.Invoke(self); } chestblockitem = false; } private void SacrificeArtifactManager_OnServerCharacterDeath(orig_OnServerCharacterDeath orig, DamageReport damageReport) { sacrificeitem = true; orig.Invoke(damageReport); sacrificeitem = false; } private void PickupDropletController_CreatePickupDroplet_ChestDrop(orig_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 orig, CreatePickupInfo pickupInfo, Vector3 position, Vector3 velocity) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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 (sacrificeitem) { if (chestOpened()) { Log.LogDebug($"sacrifice chest item {pickupInfo._pickupState} was used to satisfy a location and thus is consumed"); return; } Log.LogDebug($"sacrifice chest item {pickupInfo._pickupState} passed through"); } orig.Invoke(pickupInfo, position, velocity); } private bool shrineBeat() { bool flag = 0 < checkAvailable(LocationTypes.shrine); if (flag || (shrinesUsed + 1) % shrineUseStep != 0) { shrinesUsed++; Log.LogDebug("shrine counted as towards the locations"); updateBar(LocationTypes.shrine); } else { Log.LogDebug("shrine not counted as towards the locations"); } if (flag && shrinesUsed % shrineUseStep == 0) { return sendNextAvailable(LocationTypes.shrine); } return false; } private bool shrineWillBeLocation() { return (shrinesUsed + 1) % shrineUseStep == 0 && 0 < checkAvailable(LocationTypes.shrine); } private void PortalStatueBehavior_GrantPortalEntry_Gold(orig_GrantPortalEntry orig, PortalStatueBehavior self) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 orig.Invoke(self); if ((int)self.portalType == 1) { shrineBeat(); } } private void ShrineBloodBehavior_AddShrineStack(orig_AddShrineStack orig, ShrineBloodBehavior self, Interactor interactor) { Log.LogDebug("ShrineBloodBehavior_AddShrineStack"); orig.Invoke(self, interactor); shrineBeat(); } private void CharacterMaster_GiveMoney(orig_GiveMoney orig, CharacterMaster self, uint amount) { if (!bloodshrineblockgold) { orig.Invoke(self, amount); } else { Log.LogDebug("CharacterMaster_GiveMoney: Gold blocked because blood shrine."); } } private void ShrineChanceBehavior_AddShrineStack(orig_AddShrineStack orig, ShrineChanceBehavior self, Interactor activator) { Log.LogDebug("ShrineChanceBehavior_AddShrineStack"); chanceshrineblockitem = shrineWillBeLocation(); Log.LogDebug($"Intend to block item: {chanceshrineblockitem}"); chanceshrinebeat = false; orig.Invoke(self, activator); Log.LogDebug($"Item drop detected: {chanceshrinebeat}"); chanceshrineblockitem = false; if (chanceshrinebeat) { shrineBeat(); } } private void PickupDropletController_CreatePickupDroplet_ChanceShrine(orig_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 orig, CreatePickupInfo pickupInfo, Vector3 position, Vector3 velocity) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) chanceshrinebeat = true; if (chanceshrineblockitem) { Log.LogDebug($"chance shrine item {pickupInfo._pickupState} was used to satisfy a location and thus is consumed"); } else { orig.Invoke(pickupInfo, position, velocity); } } private void ShrineCombatBehavior_AddShrineStack(orig_AddShrineStack orig, ShrineCombatBehavior self, Interactor interactor) { orig.Invoke(self, interactor); shrineBeat(); } private void ShrineRestackBehavior_AddShrineStack(orig_AddShrineStack orig, ShrineRestackBehavior self, Interactor interactor) { orig.Invoke(self, interactor); shrineBeat(); } private void BossGroup_DropRewards(orig_DropRewards orig, BossGroup self) { Log.LogDebug($"bonusRewardCount initially: {self.bonusRewardCount}"); for (int num = self.bonusRewardCount; num > 0; num--) { Log.LogDebug("bonusRewardCount means a mountain shrine was beat"); if (shrineBeat()) { int bonusRewardCount = self.bonusRewardCount; self.bonusRewardCount = bonusRewardCount - 1; } } Log.LogDebug($"bonusRewardCount adjusted: {self.bonusRewardCount}"); orig.Invoke(self); } private void ShrineHealingBehavior_AddShrineStack(orig_AddShrineStack orig, ShrineHealingBehavior self, Interactor activator) { orig.Invoke(self, activator); if (self.purchaseCount > self.maxPurchaseCount - 2) { shrineBeat(); return; } if (currentlocations.TryGetValue(sceneIndex, out var value)) { Log.LogDebug($"amount of shrine locations left {value[LocationTypes.shrine]}"); if (value[1] == 0) { return; } } if (self.purchaseCount == 1) { ChatMessage.Send("Hmm thats weird, maybe try again"); } } private void ShrineColossusAccessBehavior_OnInteraction(orig_OnInteraction orig, ShrineColossusAccessBehavior self, Interactor interactor) { orig.Invoke(self, interactor); shrineBeat(); } private void Opening_OnEnter(orig_OnEnter orig, Opening self) { orig.Invoke(self); scavbackpackHash = ((object)self.chestBehavior).GetHashCode(); scavbackpackWasLocation = sendNextAvailable(LocationTypes.scavenger); } private void ChestBehavior_ItemDrop_Scavenger(orig_ItemDrop orig, ChestBehavior self) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && self.currentPickup != UniquePickup.none && scavbackpackHash == ((object)self).GetHashCode()) { scavbackpackblockitem = scavbackpackWasLocation; } orig.Invoke(self); scavbackpackblockitem = false; } private void PickupDropletController_CreatePickupDroplet_Scavenger(orig_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 orig, CreatePickupInfo pickupInfo, Vector3 position, Vector3 velocity) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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 (scavbackpackblockitem) { Log.LogDebug("scavenger backpack was used as a location so this item will be consumed"); } else { orig.Invoke(pickupInfo, position, velocity); } } private void ArchipelagoConsoleCommand_OnArchipelagoHighlightSatelliteCommandCalled(bool highlight) { highlightOn = highlight; } private void SceneDirector_PopulateScene(orig_PopulateScene orig, SceneDirector self) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown Log.LogDebug("SceneDirector_PopulateScene"); orig.Invoke(self); if (0 < checkAvailable(LocationTypes.radio_scanner)) { Log.LogDebug("Environment has radio_scanner locations, spawning an iscRadarTower."); Xoroshiro128Plus val = new Xoroshiro128Plus(self.rng.nextUlong); DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(LegacyResourcesAPI.Load("SpawnCards/InteractableSpawnCard/iscRadarTower"), new DirectorPlacementRule { placementMode = (PlacementMode)4 }, val)); if (highlightOn) { GameObject val2 = GameObject.Find("RadarTower(Clone)"); val2.GetComponent().isOn = true; } } } private void RadiotowerTerminal_GrantUnlock(orig_GrantUnlock orig, RadiotowerTerminal self, Interactor interactor) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown Log.LogDebug("RadiotowerTerminal_GrantUnlock"); if (checkAvailable(LocationTypes.radio_scanner) == 0) { orig.Invoke(self, interactor); return; } GameObject val = GameObject.Find("RadarTower(Clone)"); val.GetComponent().isOn = false; sendNextAvailable(LocationTypes.radio_scanner); EffectManager.SpawnEffect(self.unlockEffect, new EffectData { origin = ((Component)self).transform.position }, true); self.SetHasBeenPurchased(true); } private void PortalStatueBehavior_GrantPortalEntry_Blue(orig_GrantPortalEntry orig, PortalStatueBehavior self) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 orig.Invoke(self); if ((int)self.portalType > 0) { return; } Log.LogDebug("intercepted blue portal ie altar used; attempt to send check"); if (!sendNextAvailable(LocationTypes.newt_altar)) { Log.LogDebug("no check performed; granting blue portal"); return; } Log.LogDebug("check performed; denying blue portal"); foreach (NetworkUser readOnlyLocalPlayers in NetworkUser.readOnlyLocalPlayersList) { Log.LogDebug("Refunding coins..."); readOnlyLocalPlayers.AwardLunarCoins(1u); } } } internal class SeerPortal { private GameObject portalPrefab; private LocationNames locationNames; public void Initialize() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) portalPrefab = Addressables.LoadAssetAsync((object)"RoR2/Base/bazaar/SeerStation.prefab").WaitForCompletion(); locationNames = new LocationNames(); } public void CreatePortal(List sceneDef, float radius = 10f) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)portalPrefab != (Object)null)) { return; } GameObject val = GameObject.Find("TeleporterBaseMesh"); GameObject gameObject = ((Component)val.transform.parent).gameObject; if ((Object)(object)val == (Object)null) { Log.LogWarning("TeleporterBaseMesh not found!"); return; } if ((Object)(object)gameObject == (Object)null) { Log.LogWarning("Teleporter not found!"); return; } Vector3 position = val.transform.position; sceneDef = CheckRequiredExpansion(sceneDef).ToList(); for (int i = 0; i < sceneDef.Count; i++) { SceneIndex sceneDefIndex = sceneDef[i].sceneDefIndex; Log.LogDebug($"Creating seer portal for stage {sceneDef[i].cachedName}. Portal #{i}"); float num = (float)i * MathF.PI * 2f / (float)sceneDef.Count; Vector3 val2 = new Vector3(Mathf.Cos(num), 0f, Mathf.Sin(num)) * radius; Vector3 position2 = position + val2; GameObject val3 = Object.Instantiate(portalPrefab); SeerStationController component = val3.GetComponent(); PurchaseInteraction component2 = val3.GetComponent(); val3.GetComponent().localPlayerAuthority = true; val3.transform.position = position2; val3.transform.localScale = Vector3.one; ((NetworkBehaviour)component).PreStartClient(); ((NetworkBehaviour)component).GetNetworkChannel(); component.SetTargetScene(sceneDef[i]); component.explicitTargetSceneExitController = gameObject.GetComponent(); component2.Networkcost = 0; component2.cost = 0; component2.contextToken = locationNames.GetLocationName(sceneDef[i].cachedName) ?? sceneDef[i].cachedName; } } public List CheckRequiredExpansion(List sceneDefs) { List list = new List(); foreach (SceneDef sceneDef in sceneDefs) { if ((Object)(object)sceneDef.requiredExpansion == (Object)null || Run.instance.IsExpansionEnabled(sceneDef.requiredExpansion)) { list.Add(sceneDef); continue; } string[] obj = new string[5] { "Scene ", sceneDef.cachedName, " requires expansion ", null, null }; ExpansionDef requiredExpansion = sceneDef.requiredExpansion; obj[3] = ((requiredExpansion != null) ? ((Object)requiredExpansion).name : null); obj[4] = ", which is not available."; Log.LogDebug(string.Concat(obj)); } return list; } } internal class ShrineChanceHandler : IHandler { public void Hook() { SceneDirector.onGenerateInteractableCardSelection += SceneDirector_onGenerateInteractableCardSelection; } public void UnHook() { SceneDirector.onGenerateInteractableCardSelection -= SceneDirector_onGenerateInteractableCardSelection; } private void SceneDirector_onGenerateInteractableCardSelection(SceneDirector arg1, DirectorCardCategorySelection arg2) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_008a: Unknown result type (might be due to invalid IL or missing references) Log.LogDebug($"interactible credit {arg1.interactableCredit}"); arg1.interactableCredit *= 2; Log.LogDebug($"interactible credit {arg1.interactableCredit}"); Category[] categories = arg2.categories; foreach (Category val in categories) { Log.LogDebug("categories in arg2 " + val.name); if (val.name == "Shrines") { DirectorCard[] cards = val.cards; foreach (DirectorCard val2 in cards) { Log.LogDebug($"card cost is {val2.cost} {((Object)val2.spawnCard).name}"); val2.spawnCard.directorCreditCost = 5; Log.LogDebug($"card cost is {val2.cost}"); } } } } } internal class StageBlockerHandler : IHandler { public const int arena = 4; public const int lakes = 28; public const int blackbeach = 7; public const int blackbeach2 = 8; public const int dampcavesimple = 10; public const int foggyswamp = 12; public const int frozenwall = 13; public const int golemplains = 15; public const int golemplains2 = 16; public const int goolake = 17; public const int moon2 = 32; public const int rootjungle = 35; public const int shipgraveyard = 37; public const int skymeadow = 38; public const int wispgraveyard = 47; public const int snowyforest = 39; public const int ancientloft = 3; public const int sulfurpools = 41; public const int voidstage = 46; public const int voidraid = 45; public const int lakesnight = 34; public const int village = 54; public const int villagenight = 55; public const int lemuriantemple = 36; public const int habitat = 21; public const int habitatfall = 22; public const int helminthroost = 23; public const int meridian = 40; public const int artifactworld = 5; public const int bazaar = 6; public const int goldshores = 14; public const int limbo = 27; public const int mysteryspace = 33; public LocationNames locationsNames = new LocationNames(); public int mostRecentStageGroup = 0; public static Dictionary stageUnlocks = new Dictionary { { "Stage 1", false }, { "Stage 2", false }, { "Stage 3", false }, { "Stage 4", false } }; public static int amountOfStages = 0; public readonly Dictionary stageLookup = new Dictionary { { "ancientloft", 1 }, { "dampcavesimple", 3 }, { "foggyswamp", 1 }, { "frozenwall", 2 }, { "goolake", 1 }, { "rootjungle", 3 }, { "shipgraveyard", 3 }, { "skymeadow", 4 }, { "sulfurpools", 2 }, { "wispgraveyard", 2 }, { "lemuriantemple", 1 }, { "habitat", 2 }, { "habitatfall", 2 }, { "helminthroost", 4 }, { "meridian", 3 } }; public readonly Dictionary locationNames = new Dictionary { { "ancientloft", "Aphelian Sanctuary" }, { "dampcavesimple", "Abyssal Depths" }, { "foggyswamp", "Wetland Aspect" }, { "frozenwall", "Rallypoint Delta" }, { "goolake", "Abandoned Aqueduct" }, { "rootjungle", "Sundered Grove" }, { "shipgraveyard", "Siren's Call" }, { "skymeadow", "Sky Meadow" }, { "sulfurpools", "Sulfur Pools" }, { "wispgraveyard", "Scorched Acres" }, { "lemuriantemple", "Reformed Altar" }, { "habitat", "Treeborn Colony" }, { "habitatfall", "Golden Dieback" }, { "helminthroost", "Helminhe Hatchery" }, { "meridian", "Prime Meridian" } }; private List blocked_stages; private List unblocked_stages; private List blocked_string_stages; private List unblocked_string_stages; private List stages_available; private bool manuallyPickingStage = false; private bool voidPortalSpawned = false; private SceneDef prevOrderedStage = null; public static bool progressivesStages = false; public static bool showSeerPortals = false; public static string revertToBeginningMessage = ""; private SeerPortal seerPortal; public StageBlockerHandler() { Log.LogDebug("StageBlocker handler constructor."); blocked_stages = new List(); unblocked_stages = new List(); blocked_string_stages = new List(); unblocked_string_stages = new List(); stages_available = new List(); amountOfStages = 0; } public void Hook() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown SceneDirector.PlaceTeleporter += new hook_PlaceTeleporter(SceneDirector_PlaceTeleporter); TeleporterInteraction.AttemptToSpawnAllEligiblePortals += new hook_AttemptToSpawnAllEligiblePortals(TeleporterInteraction_AttemptToSpawnAllEligiblePortals1); SeerStationController.SetTargetScene += new hook_SetTargetScene(SeerStationController_SetTargetScene); ReadyToEndGame.OnEnter += new hook_OnEnter(ReadyToEndGame_OnEnter); TransitionToNextStage.FixedUpdate += new hook_FixedUpdate(TransitionToNextStage_FixedUpdate); PortalDialerController.PerformActionServer += new hook_PerformActionServer(PortalDialerController_PerformActionServer); FrogController.Pet += new hook_Pet(FrogController_Pet); Interactor.PerformInteraction += new hook_PerformInteraction(Interactor_PerformInteraction); SceneExitController.Begin += new hook_Begin(SceneExitController_Begin); Active.OnEnter += new hook_OnEnter(Active_OnEnter); Run.CanPickStage += new hook_CanPickStage(Run_CanPickStage); Run.PickNextStageScene += new hook_PickNextStageScene(Run_PickNextStageScene); ChatBox.OnEnable += new hook_OnEnable(ChatBox_OnEnable); VoidStageMissionController.FixedUpdate += new hook_FixedUpdate(VoidStageMissionController_FixedUpdate); VoidStageMissionController.OnDisable += new hook_OnDisable(VoidStageMissionController_OnDisable); ArchipelagoConsoleCommand.OnArchipelagoShowUnlockedStagesCommandCalled += ArchipelagoConsoleCommand_OnArchipelagoShowUnlockedStagesCommandCalled; SceneDef.AddDestinationsToWeightedSelection += new hook_AddDestinationsToWeightedSelection(SceneDef_AddDestinationsToWeightedSelection); PortalSpawner.Start += new hook_Start(PortalSpawner_Start); } public void UnHook() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected O, but got Unknown //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown SceneDirector.PlaceTeleporter -= new hook_PlaceTeleporter(SceneDirector_PlaceTeleporter); TeleporterInteraction.AttemptToSpawnAllEligiblePortals -= new hook_AttemptToSpawnAllEligiblePortals(TeleporterInteraction_AttemptToSpawnAllEligiblePortals1); SeerStationController.SetTargetScene -= new hook_SetTargetScene(SeerStationController_SetTargetScene); ReadyToEndGame.OnEnter -= new hook_OnEnter(ReadyToEndGame_OnEnter); TransitionToNextStage.FixedUpdate -= new hook_FixedUpdate(TransitionToNextStage_FixedUpdate); PortalDialerController.PerformActionServer -= new hook_PerformActionServer(PortalDialerController_PerformActionServer); FrogController.Pet -= new hook_Pet(FrogController_Pet); Interactor.PerformInteraction -= new hook_PerformInteraction(Interactor_PerformInteraction); SceneExitController.Begin -= new hook_Begin(SceneExitController_Begin); Active.OnEnter -= new hook_OnEnter(Active_OnEnter); Run.CanPickStage -= new hook_CanPickStage(Run_CanPickStage); Run.PickNextStageScene -= new hook_PickNextStageScene(Run_PickNextStageScene); ChatBox.OnEnable -= new hook_OnEnable(ChatBox_OnEnable); VoidStageMissionController.FixedUpdate -= new hook_FixedUpdate(VoidStageMissionController_FixedUpdate); VoidStageMissionController.OnDisable -= new hook_OnDisable(VoidStageMissionController_OnDisable); SceneDef.AddDestinationsToWeightedSelection -= new hook_AddDestinationsToWeightedSelection(SceneDef_AddDestinationsToWeightedSelection); PortalSpawner.Start -= new hook_Start(PortalSpawner_Start); blocked_stages = null; unblocked_stages = null; blocked_string_stages = null; unblocked_string_stages = null; seerPortal = null; stages_available = null; mostRecentStageGroup = 0; } private void SceneDef_AddDestinationsToWeightedSelection(orig_AddDestinationsToWeightedSelection orig, SceneDef self, WeightedSelection dest, Func canAdd) { if (Object.op_Implicit((Object)(object)self.destinationsGroup)) { self.destinationsGroup.AddToWeightedSelection(dest, canAdd); } else { orig.Invoke(self, dest, canAdd); } } private void ChatBox_OnEnable(orig_OnEnable orig, ChatBox self) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (revertToBeginningMessage != "") { ChatMessage.SendColored(revertToBeginningMessage, Color.red); revertToBeginningMessage = ""; } } public void BlockAll() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Invalid comparison between Unknown and I4 //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Invalid comparison between Unknown and I4 //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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Invalid comparison between Unknown and I4 Enumerator enumerator = SceneCatalog.allSceneDefs.GetEnumerator(); try { while (enumerator.MoveNext()) { SceneDef current = enumerator.Current; Log.LogDebug($"scene index {SceneCatalog.FindSceneIndex(current.cachedName)} scene name {current.cachedName}"); Log.LogDebug($"blocked by loop? {current.isLockedBeforeLooping}"); current.isLockedBeforeLooping = false; if ((int)current.sceneType == 1 || (int)current.sceneType == 2) { SceneIndex val = SceneCatalog.FindSceneIndex(current.cachedName); if ((int)val == -1) { break; } Block(current.cachedName); } } } finally { ((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } } public void UnBlockAll() { blocked_string_stages.Clear(); } public bool Block(string stageName) { if (blocked_string_stages.Contains(stageName)) { Log.LogDebug("Environment already blocked: index " + stageName + "."); return false; } Log.LogDebug("Blocking environment: index " + stageName + "."); blocked_string_stages.Add(stageName); return true; } public bool UnBlock(int index) { string text = LocationNames.cachedLocationsNames[index]; Log.LogDebug("UnBlocking environment: index " + text + "."); unblocked_string_stages.Add(text); return blocked_string_stages.Remove(text); } public bool CheckBlocked(string stageName) { if ((Object)(object)Run.instance.nextStageScene != (Object)null && stageLookup.ContainsKey(stageName)) { if (!stageUnlocks[$"Stage {stageLookup[stageName]}"] && !progressivesStages) { return true; } if (stageLookup[stageName] > amountOfStages && progressivesStages) { return true; } } foreach (string blocked_string_stage in blocked_string_stages) { if (stageName == blocked_string_stage) { return true; } } return false; } private void ArchipelagoConsoleCommand_OnArchipelagoShowUnlockedStagesCommandCalled() { foreach (string unblocked_string_stage in unblocked_string_stages) { if (LocationNames.cachedLocationsNames.ContainsValue(unblocked_string_stage)) { ChatMessage.Send(unblocked_string_stage ?? ""); } } } private void Active_OnEnter(orig_OnEnter orig, Active self) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown if (CheckBlocked("moon2")) { ChatMessage.SendColored("Just not feeling it right now.", new Color(93f, 213f, 226f)); ((EntityState)self).outer.SetNextState((EntityState)new ActiveToIdle()); } else { orig.Invoke(self); } } private void SceneExitController_Begin(orig_Begin orig, SceneExitController self) { if (self.isColossusPortal) { bool flag = true; int stageOrder = SceneCatalog.mostRecentSceneDef.stageOrder; Log.LogDebug($"SceneExitController_SetState checking for blocked stages. Current stage order {stageOrder}, mostRecent..{mostRecentStageGroup}."); if (stageOrder > 5) { stageOrder = mostRecentStageGroup; } switch (stageOrder) { case 1: flag = CheckBlocked("lemuriantemple"); break; case 2: { flag = CheckBlocked("habitat") && CheckBlocked("habitatfall"); WeightedSelection val = new WeightedSelection(8); if (!CheckBlocked("habitat")) { val.AddChoice(SceneCatalog.FindSceneDef("habitat"), 10f); } if (!CheckBlocked("habitatfall")) { val.AddChoice(SceneCatalog.FindSceneDef("habitatfall"), 10f); } if (!flag) { self.isAlternatePath = false; } Run.instance.PickNextStageScene(val); self.tier3AlternateDestinationScene = Run.instance.nextStageScene; self.destinationScene = Run.instance.nextStageScene; break; } case 3: case 4: case 5: flag = CheckBlocked("meridian"); break; } self.useRunNextStageScene = flag; } if (self.useRunNextStageScene) { manuallyPickingStage = true; Run.instance.PickNextStageSceneFromCurrentSceneDestinations(); Log.LogDebug("SceneExitController_SetState forcefully reroll next stagescene"); manuallyPickingStage = false; } mostRecentStageGroup = SceneCatalog.mostRecentSceneDef.stageOrder; orig.Invoke(self); } private void Interactor_PerformInteraction(orig_PerformInteraction orig, Interactor self, GameObject interactableObject) { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && Object.op_Implicit((Object)(object)interactableObject)) { IInteractable[] components = interactableObject.GetComponents(); foreach (IInteractable val in components) { GenericInteraction val2 = (GenericInteraction)(object)((val is GenericInteraction) ? val : null); if (!Object.op_Implicit((Object)(object)val2)) { continue; } switch (val2.contextToken) { case "PORTAL_ARENA_CONTEXT": if (CheckBlocked("arena")) { ChatMessage.SendColored("The void rejects you.", new Color(136f, 2f, 214f)); val2.SetInteractabilityConditionsNotMet(); } else { val2.SetInteractabilityAvailable(); } break; case "PORTAL_VOID_CONTEXT": if (CheckBlocked("voidstage")) { ChatMessage.SendColored("The void rejects you.", new Color(136f, 2f, 214f)); val2.SetInteractabilityConditionsNotMet(); } else { val2.SetInteractabilityAvailable(); } break; case "PORTAL_GOLDSHORES_CONTEXT": if (CheckBlocked("goldshores")) { ChatMessage.SendColored("The gold portal was missing the key to enter but stayed to taunt you.", Color.yellow); val2.SetInteractabilityConditionsNotMet(); } else { val2.SetInteractabilityAvailable(); } break; } } } orig.Invoke(self, interactableObject); } private void FrogController_Pet(orig_Pet orig, FrogController self, Interactor interactor) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) if (CheckBlocked("voidraid")) { Log.LogDebug("Blocking petting the frog for planetarium."); if (!NetworkServer.active) { return; } Log.LogDebug("blocking planetarium as host."); foreach (NetworkUser readOnlyLocalPlayers in NetworkUser.readOnlyLocalPlayersList) { Log.LogDebug("Refunding coins..."); readOnlyLocalPlayers.AwardLunarCoins(1u); } ChatMessage.SendColored("The frog does not want to be pet.", Color.white); } else { orig.Invoke(self, interactor); } } private bool PortalDialerController_PerformActionServer(orig_PerformActionServer orig, PortalDialerController self, byte[] sequence) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) Log.LogDebug("PortalDialerController_PerformActionServer called."); if (CheckBlocked("artifactworld")) { ChatMessage.SendColored("The code will never work without Hidden Realm: Bulwark's Ambry.", Color.white); return false; } return orig.Invoke(self, sequence); } private void TransitionToNextStage_FixedUpdate(orig_FixedUpdate orig, TransitionToNextStage self) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown if (CheckBlocked("limbo")) { Run.instance.BeginGameOver(GameEndings.ObliterationEnding); ((EntityState)self).outer.SetNextState((EntityState)new Idle()); } orig.Invoke(self); } private void ReadyToEndGame_OnEnter(orig_OnEnter orig, ReadyToEndGame self) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && CheckBlocked("limbo")) { for (int i = 0; i < CharacterMaster.readOnlyInstancesList.Count; i++) { if (CharacterMaster.readOnlyInstancesList[i].inventory.GetItemCountEffective(Items.LunarTrinket) > 0) { ChatMessage.SendColored("Despite having Beads, you are not yet ready...", new Color(93f, 213f, 226f)); break; } } } orig.Invoke(self); } private void SeerStationController_SetTargetScene(orig_SetTargetScene orig, SeerStationController self, SceneDef sceneDef) { string cachedName = sceneDef.cachedName; if (CheckBlocked(cachedName)) { ((Component)self).GetComponent().SetAvailable(false); Log.LogDebug("Bazaar Seer attempted to pick scene " + cachedName + "; blocked."); } else { Log.LogDebug("Bazaar Seer picked scene " + cachedName); orig.Invoke(self, sceneDef); } } private void SceneDirector_PlaceTeleporter(orig_PlaceTeleporter orig, SceneDirector self) { orig.Invoke(self); seerPortal = null; seerPortal = new SeerPortal(); seerPortal.Initialize(); } private void TeleporterInteraction_AttemptToSpawnAllEligiblePortals1(orig_AttemptToSpawnAllEligiblePortals orig, TeleporterInteraction self) { GetAvailableStages(); if (CheckBlocked("bazaar")) { if (self.shouldAttemptToSpawnShopPortal) { Log.LogDebug("Blue / bazaar portal blocked."); ChatMessage.Send("The blue portal was too shy to come out!"); } self.shouldAttemptToSpawnShopPortal = false; } if (CheckBlocked("goldshores")) { if (self.shouldAttemptToSpawnGoldshoresPortal) { Log.LogDebug("Gold / goldshores portal blocked."); ChatMessage.Send("The gold portal was missing the key to enter and disappeared!"); } self.shouldAttemptToSpawnGoldshoresPortal = false; } if (CheckBlocked("mysteryspace")) { if (self.shouldAttemptToSpawnMSPortal) { Log.LogDebug("Celestial / mysteryspace portal blocked."); ChatMessage.Send("The celestial portal decided you aren't ready!"); } self.shouldAttemptToSpawnMSPortal = false; } orig.Invoke(self); } private void PortalSpawner_Start(orig_Start orig, PortalSpawner self) { if (self.bannedEventFlag == "FalseSonBossComplete") { self.bannedEventFlag = ""; } orig.Invoke(self); } private bool Run_CanPickStage(orig_CanPickStage orig, Run self, SceneDef scenedef) { Log.LogDebug("Checking CanPickStage for " + scenedef.nameToken + "..."); string cachedName = scenedef.cachedName; if (CheckBlocked(cachedName)) { Log.LogDebug("blocking."); return false; } stages_available.Add(scenedef); Log.LogDebug("passing through."); return orig.Invoke(self, scenedef); } public void GetAvailableStages() { stages_available.Clear(); manuallyPickingStage = true; Run.instance.PickNextStageSceneFromCurrentSceneDestinations(); manuallyPickingStage = false; if (stages_available.Count > 0 && showSeerPortals) { seerPortal.CreatePortal(stages_available); } } private void Run_PickNextStageScene(orig_PickNextStageScene orig, Run self, WeightedSelection choices) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_0167: Unknown result type (might be due to invalid IL or missing references) bool hasHabitat = false; bool hasHabitatFall = false; EnumerableExtensions.ForEachTry>((IEnumerable>)choices.choices, (Action>)delegate(ChoiceInfo choice) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (choice.value.cachedName == "habitat") { hasHabitat = true; } if (choice.value.cachedName == "habitatfall") { hasHabitatFall = true; } }, (IDictionary, Exception>)null); if (hasHabitat || hasHabitatFall) { SceneCollection startingSceneGroup = new SceneCollection(); SceneCollection startingSceneGroup2 = self.startingSceneGroup; self.startingSceneGroup = startingSceneGroup; self.startingSceneGroup.AddToWeightedSelection(choices, (Func)self.CanPickStage); orig.Invoke(self, choices); self.startingSceneGroup = startingSceneGroup2; return; } if (SceneCatalog.mostRecentSceneDef.cachedName == "voidstage" && CheckBlocked("voidraid")) { Log.LogDebug("loaded Void Locus without The Planetarium"); SceneCatalog.mostRecentSceneDef.stageOrder = 1; Log.LogDebug("Switching to stage 1"); self.startingSceneGroup.AddToWeightedSelection(choices, (Func)self.CanPickStage); } if (manuallyPickingStage && Object.op_Implicit((Object)(object)SceneCatalog.mostRecentSceneDef) && 1 <= SceneCatalog.mostRecentSceneDef.stageOrder && 5 >= SceneCatalog.mostRecentSceneDef.stageOrder) { if (choices.Count == 0) { string text = ""; Log.LogDebug("no choices for next scene; setting up alternate choices"); if (Object.op_Implicit((Object)(object)prevOrderedStage)) { Log.LogDebug($"prev scene {prevOrderedStage.sceneDefIndex} in stage {prevOrderedStage.stageOrder}"); } else { Log.LogDebug("no prev scene"); } Log.LogDebug($"Most recent scene stage order Stage {SceneCatalog.mostRecentSceneDef.stageOrder}"); if (!stageUnlocks[$"Stage {SceneCatalog.mostRecentSceneDef.stageOrder}"] && !progressivesStages) { text = $"you need Stage {SceneCatalog.mostRecentSceneDef.stageOrder}"; } else if (SceneCatalog.mostRecentSceneDef.stageOrder > amountOfStages && progressivesStages) { text = $"you need {SceneCatalog.mostRecentSceneDef.stageOrder} Progressive Stages"; } else { List list = new List(); text = "you are missing "; foreach (KeyValuePair item in stageLookup) { if (item.Value == SceneCatalog.mostRecentSceneDef.stageOrder) { list.Add(item.Key); } } if (list != null && list.Count > 0) { for (int num = 0; num < list.Count; num++) { text = ((num >= list.Count - 1 && list.Count != 1) ? (text + "or " + locationNames[list[num]]) : (text + locationNames[list[num]] + ", ")); } } } revertToBeginningMessage = "Unable to advance to the next set of stages because " + text + "!"; Log.LogDebug("adding choices for stage 1"); self.startingSceneGroup.AddToWeightedSelection(choices, (Func)self.CanPickStage); } else { Log.LogDebug("there are choices for the next scene; skipping tampering said choices"); } prevOrderedStage = SceneCatalog.mostRecentSceneDef; } orig.Invoke(self, choices); Log.LogDebug($"next scene {self.nextStageScene.cachedName} in stage {self.nextStageScene.stageOrder}"); } private void VoidStageMissionController_FixedUpdate(orig_FixedUpdate orig, VoidStageMissionController self) { orig.Invoke(self); if (CheckBlocked("voidraid") && self.numBatteriesActivated >= self.numBatteriesSpawned && self.numBatteriesSpawned > 0 && !voidPortalSpawned) { Log.LogDebug("Portal Activated"); voidPortalSpawned = true; GameObject val = GameObject.Find("DeepVoidPortal(Clone)"); val.GetComponent().useRunNextStageScene = true; } } private void VoidStageMissionController_OnDisable(orig_OnDisable orig, VoidStageMissionController self) { orig.Invoke(self); voidPortalSpawned = false; } } } namespace Archipelago.RiskOfRain2.Extensions { public static class IEnumerableExtensions { private static Random rand = new Random(); public static T Choice(this IEnumerable self) { int maxValue = self.Count(); return self.Skip(rand.Next(maxValue)).Take(1).SingleOrDefault(); } } public static class RectTransformExtensions { public static void ResetAnchorsAndOffsets(this RectTransform self) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) self.anchorMin = Vector2.zero; self.anchorMax = Vector2.one; self.pivot = Vector2.zero; self.offsetMin = Vector2.zero; self.offsetMax = Vector2.zero; self.sizeDelta = Vector2.zero; } } public static class TransformExtensions { public static void ResetScaleAndRotation(this Transform self) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) self.localScale = Vector3.one; self.rotation = new Quaternion(0f, 0f, 0f, 0f); } } } namespace Archipelago.RiskOfRain2.Console { public static class ArchipelagoConsoleCommand { public delegate void ArchipelagoConsoleCommandHandler(string url, int port, string slot, string password); public delegate void OnArchipelagoDisconnectCommandHandler(); public delegate void OnArchipelagoReconnectCommandHandler(); public delegate void OnArchipelagoDeathLinkCommandHandler(bool link); public delegate void OnArchipelagoHighlightSatelliteCommandHandler(bool highlight); public delegate void OnArchipelagoFinalStageDeathCommandHandler(bool finalstage); public delegate void OnArchipelagoShowUnlockedStagesCommandHandler(); public static event ArchipelagoConsoleCommandHandler OnArchipelagoCommandCalled; public static event OnArchipelagoDisconnectCommandHandler OnArchipelagoDisconnectCommandCalled; public static event OnArchipelagoDisconnectCommandHandler OnArchipelagoReconnectCommandCalled; public static event OnArchipelagoDeathLinkCommandHandler OnArchipelagoDeathLinkCommandCalled; public static event OnArchipelagoHighlightSatelliteCommandHandler OnArchipelagoHighlightSatelliteCommandCalled; public static event OnArchipelagoFinalStageDeathCommandHandler OnArchipelagoFinalStageDeathCommandCalled; public static event OnArchipelagoShowUnlockedStagesCommandHandler OnArchipelagoShowUnlockedStagesCommandCalled; [ConCommand(/*Could not decode attribute arguments.*/)] private static void ArchipelagoConCommand(ConCommandArgs args) { if (((ConCommandArgs)(ref args)).Count < 3 || ((ConCommandArgs)(ref args)).Count > 4) { ChatMessage.Send("Invalid command. Correct Syntax: archipelago_connect [password]"); return; } ((ConCommandArgs)(ref args)).CheckArgumentCount(3); string argString = ((ConCommandArgs)(ref args)).GetArgString(0); int argInt = ((ConCommandArgs)(ref args)).GetArgInt(1); string argString2 = ((ConCommandArgs)(ref args)).GetArgString(2); string password = string.Empty; if (((ConCommandArgs)(ref args)).Count == 4) { password = ((ConCommandArgs)(ref args)).GetArgString(3); } ArchipelagoConsoleCommand.OnArchipelagoCommandCalled(argString, argInt, argString2, password); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void ArchipelagoDisconnect(ConCommandArgs args) { ArchipelagoConsoleCommand.OnArchipelagoDisconnectCommandCalled(); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void ArchipelagoReconnect(ConCommandArgs args) { ArchipelagoConsoleCommand.OnArchipelagoReconnectCommandCalled(); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void ArchipelagoShowUnlockedStages(ConCommandArgs args) { ArchipelagoConsoleCommand.OnArchipelagoShowUnlockedStagesCommandCalled(); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void ArchipelagoDeathlink(ConCommandArgs args) { if (((ConCommandArgs)(ref args)).Count > 1) { ChatMessage.Send("Only accepts one arguement!"); } else if (((ConCommandArgs)(ref args)).GetArgString(0) == "true" || ((ConCommandArgs)(ref args)).GetArgString(0) == "false") { bool flag = Convert.ToBoolean(((ConCommandArgs)(ref args)).GetArgString(0)); ArchipelagoConsoleCommand.OnArchipelagoDeathLinkCommandCalled(flag); ChatMessage.Send($"Deathlink is now set to {flag}"); } else { ChatMessage.Send("Invalid argument. Correct Syntax: archipelago_deathlink true/false"); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void ArchipelagoFinalStageDeath(ConCommandArgs args) { if (((ConCommandArgs)(ref args)).Count > 1) { ChatMessage.Send("Only accepts one arguement!"); } else if (((ConCommandArgs)(ref args)).GetArgString(0) == "true" || ((ConCommandArgs)(ref args)).GetArgString(0) == "false") { bool flag = Convert.ToBoolean(((ConCommandArgs)(ref args)).GetArgString(0)); ArchipelagoConsoleCommand.OnArchipelagoFinalStageDeathCommandCalled(flag); ChatMessage.Send($"FinalStageDeath is now set to {flag}"); } else { ChatMessage.Send("Invalid argument. Correct Syntax: archipelago_final_stage_deat true/false"); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void ArchipelagoHighlightSatellite(ConCommandArgs args) { if (((ConCommandArgs)(ref args)).Count > 1) { ChatMessage.Send("Only accepts one arguement!"); } else if (((ConCommandArgs)(ref args)).GetArgString(0) == "true" || ((ConCommandArgs)(ref args)).GetArgString(0) == "false") { bool highlight = Convert.ToBoolean(((ConCommandArgs)(ref args)).GetArgString(0)); ArchipelagoConsoleCommand.OnArchipelagoHighlightSatelliteCommandCalled(highlight); GameObject val = GameObject.Find("RadarTower(Clone)"); if ((Object)(object)val != (Object)null) { val.GetComponent().isOn = Convert.ToBoolean(((ConCommandArgs)(ref args)).GetArgString(0)); } ChatMessage.Send($"Satellite Highlight is now set to {Convert.ToBoolean(((ConCommandArgs)(ref args)).GetArgString(0))}"); } else { ChatMessage.Send("Invalid argument. Correct Syntax: archipelago_highlight_satellitek true/false"); } } } }