Skip to content

Commit

Permalink
Fix locked bench edge cases in bench sync
Browse files Browse the repository at this point in the history
  • Loading branch information
BadMagic100 committed Sep 28, 2024
1 parent 8791652 commit 23b91f5
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions Archipelago.HollowKnight/IC/Modules/BenchSyncModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Archipelago.MultiClient.Net.Enums;
using Archipelago.MultiClient.Net.Models;
using Benchwarp;
using ItemChanger;
using ItemChanger.Modules;
using Newtonsoft.Json.Linq;
using System;
Expand All @@ -14,6 +15,13 @@ public partial class BenchSyncModule : Module
{
private const string DATASTORAGE_KEY_UNLOCKED_BENCHES = "unlocked_benches";
private const string BENCH_KEY_SEPARATOR = ":::";
static readonly Dictionary<string, string> lockedBenches = new()
{
[SceneNames.Hive_01] = "Hive Bench",
[SceneNames.Ruins1_31] = "Toll Machine Bench",
[SceneNames.Abyss_18] = "Toll Machine Bench",
[SceneNames.Fungus3_50] = "Toll Machine Bench"
};

private ArchipelagoSession session;

Expand Down Expand Up @@ -86,6 +94,28 @@ private void UnlockBenches(Dictionary<string, bool> benches)
if (benchLookup.TryGetValue(key, out Bench bench))
{
bench.SetVisited(kv.Value);
if (lockedBenches.TryGetValue(bench.sceneName, out string persistentBoolName))
{
GameManager.instance.sceneData.SaveMyState(new PersistentBoolData()
{
activated = true,
sceneName = bench.sceneName,
semiPersistent = false,
id = persistentBoolName
});
}

switch (bench.sceneName)
{
case SceneNames.Room_Tram:
PlayerData.instance.SetBool(nameof(PlayerData.openedTramLower), true);
PlayerData.instance.SetBool(nameof(PlayerData.tramOpenedDeepnest), true);
break;
case SceneNames.Room_Tram_RG:
PlayerData.instance.SetBool(nameof(PlayerData.openedTramRestingGrounds), true);
PlayerData.instance.SetBool(nameof(PlayerData.tramOpenedCrossroads), true);
break;
}
}
}
}
Expand Down

0 comments on commit 23b91f5

Please sign in to comment.