From 1dbfd6c6731eda35b6aa2dfd89642d0a1df8b748 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 1 Mar 2025 10:26:49 -0500 Subject: Entrance randomizer stuff --- ArchipelagoManager.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'ArchipelagoManager.cs') diff --git a/ArchipelagoManager.cs b/ArchipelagoManager.cs index 5aebffa..d96bd05 100644 --- a/ArchipelagoManager.cs +++ b/ArchipelagoManager.cs @@ -3,6 +3,7 @@ using Archipelago.MultiClient.Net.Enums; using Archipelago.MultiClient.Net.MessageLog.Messages; using Archipelago.MultiClient.Net.Models; using Archipelago.MultiClient.Net.Packets; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Threading.Tasks; @@ -17,6 +18,11 @@ namespace ManifoldGardenArchipelago private HashSet _items = []; private HashSet _locations = []; + private bool _roomShuffle = false; + public bool RoomShuffle => _roomShuffle; + + public Dictionary EntranceMapping = []; + public async Task Connect(string url, string slotName, string password) { LoginResult result; @@ -35,6 +41,22 @@ namespace ManifoldGardenArchipelago return new LoginFailure(ex.GetBaseException().Message); } + LoginSuccessful login = result as LoginSuccessful; + if (login.SlotData.ContainsKey("connections")) + { + _roomShuffle = true; + + foreach (var connection in (JArray)login.SlotData["connections"]) + { + var connList = (JArray)connection; + EntranceIdentifier ei1 = new((string)connList[0], (string)connList[1]); + EntranceIdentifier ei2 = new((string)connList[2], (string)connList[3]); + + EntranceMapping[ei1] = ei2; + EntranceMapping[ei2] = ei1; + } + } + return result; } -- cgit 1.4.1