diff options
Diffstat (limited to 'ArchipelagoManager.cs')
-rw-r--r-- | ArchipelagoManager.cs | 22 |
1 files changed, 22 insertions, 0 deletions
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; | |||
3 | using Archipelago.MultiClient.Net.MessageLog.Messages; | 3 | using Archipelago.MultiClient.Net.MessageLog.Messages; |
4 | using Archipelago.MultiClient.Net.Models; | 4 | using Archipelago.MultiClient.Net.Models; |
5 | using Archipelago.MultiClient.Net.Packets; | 5 | using Archipelago.MultiClient.Net.Packets; |
6 | using Newtonsoft.Json.Linq; | ||
6 | using System; | 7 | using System; |
7 | using System.Collections.Generic; | 8 | using System.Collections.Generic; |
8 | using System.Threading.Tasks; | 9 | using System.Threading.Tasks; |
@@ -17,6 +18,11 @@ namespace ManifoldGardenArchipelago | |||
17 | private HashSet<string> _items = []; | 18 | private HashSet<string> _items = []; |
18 | private HashSet<string> _locations = []; | 19 | private HashSet<string> _locations = []; |
19 | 20 | ||
21 | private bool _roomShuffle = false; | ||
22 | public bool RoomShuffle => _roomShuffle; | ||
23 | |||
24 | public Dictionary<EntranceIdentifier, EntranceIdentifier> EntranceMapping = []; | ||
25 | |||
20 | public async Task<LoginResult> Connect(string url, string slotName, string password) | 26 | public async Task<LoginResult> Connect(string url, string slotName, string password) |
21 | { | 27 | { |
22 | LoginResult result; | 28 | LoginResult result; |
@@ -35,6 +41,22 @@ namespace ManifoldGardenArchipelago | |||
35 | return new LoginFailure(ex.GetBaseException().Message); | 41 | return new LoginFailure(ex.GetBaseException().Message); |
36 | } | 42 | } |
37 | 43 | ||
44 | LoginSuccessful login = result as LoginSuccessful; | ||
45 | if (login.SlotData.ContainsKey("connections")) | ||
46 | { | ||
47 | _roomShuffle = true; | ||
48 | |||
49 | foreach (var connection in (JArray)login.SlotData["connections"]) | ||
50 | { | ||
51 | var connList = (JArray)connection; | ||
52 | EntranceIdentifier ei1 = new((string)connList[0], (string)connList[1]); | ||
53 | EntranceIdentifier ei2 = new((string)connList[2], (string)connList[3]); | ||
54 | |||
55 | EntranceMapping[ei1] = ei2; | ||
56 | EntranceMapping[ei2] = ei1; | ||
57 | } | ||
58 | } | ||
59 | |||
38 | return result; | 60 | return result; |
39 | } | 61 | } |
40 | 62 | ||