summary refs log tree commit diff stats
path: root/ArchipelagoManager.cs
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2025-03-01 10:26:49 -0500
committerStar Rauchenberger <fefferburbia@gmail.com>2025-03-01 10:26:49 -0500
commit1dbfd6c6731eda35b6aa2dfd89642d0a1df8b748 (patch)
treee9b3f52da6f7f0a72e44c0a3ecb89bf661a0b737 /ArchipelagoManager.cs
parent1a5383e84e84faefa009ffb72cd725e66812bc6c (diff)
downloadmanifold-garden-archipelago-1dbfd6c6731eda35b6aa2dfd89642d0a1df8b748.tar.gz
manifold-garden-archipelago-1dbfd6c6731eda35b6aa2dfd89642d0a1df8b748.tar.bz2
manifold-garden-archipelago-1dbfd6c6731eda35b6aa2dfd89642d0a1df8b748.zip
Entrance randomizer stuff
Diffstat (limited to 'ArchipelagoManager.cs')
-rw-r--r--ArchipelagoManager.cs22
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;
3using Archipelago.MultiClient.Net.MessageLog.Messages; 3using Archipelago.MultiClient.Net.MessageLog.Messages;
4using Archipelago.MultiClient.Net.Models; 4using Archipelago.MultiClient.Net.Models;
5using Archipelago.MultiClient.Net.Packets; 5using Archipelago.MultiClient.Net.Packets;
6using Newtonsoft.Json.Linq;
6using System; 7using System;
7using System.Collections.Generic; 8using System.Collections.Generic;
8using System.Threading.Tasks; 9using 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