From 703434055fbb3aeae50f5f59f16f4a063401c329 Mon Sep 17 00:00:00 2001 From: Zach Parks Date: Thu, 5 Sep 2024 14:43:02 -0500 Subject: [PATCH] Quick patches to fix overlap ids. The code is dirty and I'm not proud. --- Randomizer/ArchipelagoManager.cs | 12 ++++++------ Randomizer/ItemHandler.cs | 18 ++++++++++++------ Rogue Legacy Randomizer.csproj | 6 +++--- RogueLegacy/Game.cs | 2 +- RogueLegacy/LevelENV.cs | 8 ++++---- RogueLegacy/Screens/SkillScreen.cs | 6 +++--- inno/installer.iss | 2 +- packages.config | 2 +- 8 files changed, 31 insertions(+), 25 deletions(-) diff --git a/Randomizer/ArchipelagoManager.cs b/Randomizer/ArchipelagoManager.cs index 1ddeea9..3186230 100644 --- a/Randomizer/ArchipelagoManager.cs +++ b/Randomizer/ArchipelagoManager.cs @@ -37,8 +37,8 @@ public class ArchipelagoManager public DeathLink DeathLinkData { get; private set; } public bool IsDeathLinkSafe { get; set; } public bool Ready { get; private set; } - public Queue> ItemQueue { get; private set; } = new(); - public Dictionary LocationDictionary { get; private set; } = new(); + public Queue> ItemQueue { get; private set; } = new(); + public Dictionary LocationDictionary { get; private set; } = new(); public List> ChatLog { get; } = new(); public bool CanCollect => _session.RoomState.CollectPermissions is Permissions.Goal or Permissions.Enabled; @@ -270,11 +270,11 @@ public string GetItemName(long item) /// The network item to get name from. /// A string representation of the item (or a trap). [SuppressMessage("ReSharper", "StringLiteralTypo")] - public string GetItemOrTrapName(NetworkItem item) + public string GetItemOrTrapName(ItemInfo item) { if (!item.Flags.HasFlag(ItemFlags.Trap)) { - return GetItemName(item.Item); + return GetItemName(item.ItemId); } // I'm hilarious, obviously. @@ -366,9 +366,9 @@ private async Task BuildLocationDictionary() { var locations = await _session.Locations.ScoutLocationsAsync(false, _session.Locations.AllLocations.ToArray()); - foreach (var item in locations.Locations) + foreach (var item in locations.Values) { - LocationDictionary[item.Location] = item; + LocationDictionary[item.LocationId] = item; } } diff --git a/Randomizer/ItemHandler.cs b/Randomizer/ItemHandler.cs index 76e703d..09a7588 100644 --- a/Randomizer/ItemHandler.cs +++ b/Randomizer/ItemHandler.cs @@ -31,10 +31,16 @@ public void CheckReceivedItemQueue() return; } - var (index, item) = Manager.ItemQueue.Dequeue(); + var (index, itemInfo) = Manager.ItemQueue.Dequeue(); if (!HasReceivedItem(index)) { - GainItem(item); + GainItem(itemInfo); + var item = new NetworkItem + { + Item = itemInfo.ItemId, + Location = itemInfo.LocationId, + Player = itemInfo.Player, + }; ReceivedItems.Add(index, item); Program.Game.SaveManager.SaveFiles(SaveType.PlayerData, SaveType.Lineage, SaveType.UpgradeData); } @@ -45,10 +51,10 @@ private bool HasReceivedItem(int index) return ReceivedItems.ContainsKey(index); } - private static void GainItem(NetworkItem item) + private static void GainItem(ItemInfo item) { var stats = new float[] { -1, -1, -1 }; - switch (item.Item) + switch (item.ItemId) { #region Vendors @@ -479,8 +485,8 @@ private static void GainItem(NetworkItem item) // Add item to received items HUD. var tupleStats = new Tuple(stats[0], stats[1], stats[2], 0); Game.ScreenManager.GetLevelScreen().AddReceivedItem( - item.Item.GetItemType(), - item.Item, + item.ItemId.GetItemType(), + item.ItemId, Manager.GetPlayerName(item.Player), tupleStats ); diff --git a/Rogue Legacy Randomizer.csproj b/Rogue Legacy Randomizer.csproj index 756eca2..deda035 100644 --- a/Rogue Legacy Randomizer.csproj +++ b/Rogue Legacy Randomizer.csproj @@ -40,8 +40,8 @@ TRACE - - packages\Archipelago.MultiClient.Net.5.0.6\lib\net45\Archipelago.MultiClient.Net.dll + + packages\Archipelago.MultiClient.Net.6.3.1\lib\net45\Archipelago.MultiClient.Net.dll lib\DS2DEngine.dll @@ -57,7 +57,7 @@ - packages\Archipelago.MultiClient.Net.5.0.6\lib\net45\Newtonsoft.Json.dll + packages\Archipelago.MultiClient.Net.6.3.1\lib\net45\Newtonsoft.Json.dll lib\SpriteSystem.dll diff --git a/RogueLegacy/Game.cs b/RogueLegacy/Game.cs index aa04aa9..9122e1b 100644 --- a/RogueLegacy/Game.cs +++ b/RogueLegacy/Game.cs @@ -1152,7 +1152,7 @@ public void CollectItemFromLocation(long location) new Vector2(stats.Item1, stats.Item4), new Vector2(stats.Item2, stats.Item3), ArchipelagoManager.GetPlayerName(item.Player), - item.Item + item.ItemId, }; ScreenManager.DisplayScreen((int) ScreenType.GetItem, true, data); diff --git a/RogueLegacy/LevelENV.cs b/RogueLegacy/LevelENV.cs index 545bcc7..aa909b0 100644 --- a/RogueLegacy/LevelENV.cs +++ b/RogueLegacy/LevelENV.cs @@ -55,10 +55,10 @@ public static class LevelENV public const int LevelDungeonBottomDoor = 100; public static string GameName => "Rogue Legacy Randomizer"; - public static Version TargetVersion => Version.Parse("1.0.0"); - public static int PreRelease => 6; - public static string FullVersion => $"v{TargetVersion}" + (PreRelease > 0 ? $" Alpha {PreRelease}" : ""); - public static string VersionSubtitle => "Development Build 2023-10-26"; + public static Version TargetVersion => Version.Parse("1.0.1"); + public static int PreRelease => 1; + public static string FullVersion => $"v{TargetVersion}" + (PreRelease > 0 ? $" Alpha Hotfix {PreRelease}" : ""); + public static string VersionSubtitle => "Development Build 2024-09-05"; static LevelENV() { diff --git a/RogueLegacy/Screens/SkillScreen.cs b/RogueLegacy/Screens/SkillScreen.cs index b739b8e..ce9ed41 100644 --- a/RogueLegacy/Screens/SkillScreen.cs +++ b/RogueLegacy/Screens/SkillScreen.cs @@ -240,12 +240,12 @@ public override void OnEnter() var item = Program.Game.ArchipelagoManager.LocationDictionary[ManorContainer.ArchipelagoLocationTable[(ManorPiece) SkillSystem.GetManorPiece(s)]]; // Toggle correct plate. - s.IconName = GetSkillPlateIcon(item.Item); - s.Name = Program.Game.ArchipelagoManager.GetLocationName(item.Location).Replace("Manor - ", ""); + s.IconName = GetSkillPlateIcon(item.ItemId); + s.Name = Program.Game.ArchipelagoManager.GetLocationName(item.LocationId).Replace("Manor - ", ""); var itemName = Program.Game.ArchipelagoManager.GetItemOrTrapName(item); // Check if we grabbed this location, and change our skillArray current level. - if (Program.Game.ArchipelagoManager.IsLocationChecked(item.Location)) + if (Program.Game.ArchipelagoManager.IsLocationChecked(item.LocationId)) { s.CurrentLevel = 1; } diff --git a/inno/installer.iss b/inno/installer.iss index 3bc3940..2d8f306 100644 --- a/inno/installer.iss +++ b/inno/installer.iss @@ -3,7 +3,7 @@ #define MyAppId "{6741975E-782A-438F-8C05-502EDB37E7DB}" #define MyAppName "Rogue Legacy Randomizer" -#define MyAppVersion "1.0.0 Alpha 6" +#define MyAppVersion "1.0.1 Alpha Hotfix 1" #define MyAppPublisher "Zach Parks & Cellar Door Games" #define MyAppURL "https://github.com/ThePhar/RogueLegacyRandomizer" #define MyAppExeName "Rogue Legacy Randomizer.exe" diff --git a/packages.config b/packages.config index a323ea9..3518193 100644 --- a/packages.config +++ b/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file