diff --git a/src/TrackerCouncil.Smz3.Abstractions/ITrackerLocationService.cs b/src/TrackerCouncil.Smz3.Abstractions/ITrackerLocationService.cs
index 116f033cc..9ed1896e8 100644
--- a/src/TrackerCouncil.Smz3.Abstractions/ITrackerLocationService.cs
+++ b/src/TrackerCouncil.Smz3.Abstractions/ITrackerLocationService.cs
@@ -18,7 +18,11 @@ public interface ITrackerLocationService
/// The location to clear.
/// The speech recognition confidence.
/// If this was tracked by the auto tracker
- void Clear(Location location, float? confidence = null, bool autoTracked = false, bool stateResponse = true, bool allowLocationComments = false, bool updateTreasureCount = true);
+ /// If the location being cleared will be commented on by tracker
+ /// If location specific comments should be stated
+ /// If the dungeon treasure count should be updated, if applicable
+ /// If the dungeon treasure count should be commented on. If not specified, the value of stateResponse will be used.
+ void Clear(Location location, float? confidence = null, bool autoTracked = false, bool stateResponse = true, bool allowLocationComments = false, bool updateTreasureCount = true, bool? stateTreasureResponse = null);
///
/// Unclears an item from the specified location.
diff --git a/src/TrackerCouncil.Smz3.SeedGenerator/FileData/IpsPatches/ArchipelagoMSU.ips b/src/TrackerCouncil.Smz3.SeedGenerator/FileData/IpsPatches/ArchipelagoMSU.ips
index 5ff19a3b6..9027bee7f 100644
Binary files a/src/TrackerCouncil.Smz3.SeedGenerator/FileData/IpsPatches/ArchipelagoMSU.ips and b/src/TrackerCouncil.Smz3.SeedGenerator/FileData/IpsPatches/ArchipelagoMSU.ips differ
diff --git a/src/TrackerCouncil.Smz3.Tracking/AutoTracking/AutoTrackerModules/GiftedItemSync.cs b/src/TrackerCouncil.Smz3.Tracking/AutoTracking/AutoTrackerModules/GiftedItemSync.cs
index a7b5811ca..50b8a42aa 100644
--- a/src/TrackerCouncil.Smz3.Tracking/AutoTracking/AutoTrackerModules/GiftedItemSync.cs
+++ b/src/TrackerCouncil.Smz3.Tracking/AutoTracking/AutoTrackerModules/GiftedItemSync.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Linq;
using Microsoft.Extensions.Logging;
using SnesConnectorLibrary;
@@ -85,21 +86,29 @@ private async void OnMemorySync(SnesData firstDataSet, SnesData? firstPrevData)
{
if (_itemDetailLength == 4)
{
- // var fromPlayerId = firstBlockResponse.Data.ReadUInt16(i * 4)!.Value;
var itemId = (ItemType)firstBlockResponse.Data.ReadUInt16(i * 4 + 2)!.Value;
receivedItems.Add(Tracker.World.AllItems.First(x => x.Type == itemId && x.IsLocalPlayerItem));
}
else
{
- // var fromPlayerId = firstBlockResponse.Data.ReadUInt8(i * 2)!.Value;
- var itemId = (ItemType)firstBlockResponse.Data.ReadUInt8(i * 2 + 1)!.Value;
- receivedItems.Add(Tracker.World.AllItems.First(x => x.Type == itemId && x.IsLocalPlayerItem));
+ var itemId = firstBlockResponse.Data.ReadUInt8(i * 2 + 1)!.Value;
+ try
+ {
+ var itemType = (ItemType)itemId;
+ receivedItems.Add(Tracker.World.AllItems.First(x => x.Type == itemType && x.IsLocalPlayerItem));
+ }
+ catch (Exception)
+ {
+ logger.LogWarning("Invalid item type {Id} received", itemId);
+ }
}
}
- logger.LogInformation("Received Items: {Items}", string.Join(",", receivedItems));
-
- Tracker.ItemTracker.TrackItems(receivedItems, true, true);
+ if (receivedItems.Count > 0)
+ {
+ logger.LogInformation("Received Items: {Items}", string.Join(",", receivedItems));
+ Tracker.ItemTracker.TrackItems(receivedItems, true, true);
+ }
trackerState.GiftedItemCount = newItemCount.Value;
await Tracker.SaveAsync();
diff --git a/src/TrackerCouncil.Smz3.Tracking/TrackingServices/TrackerItemService.cs b/src/TrackerCouncil.Smz3.Tracking/TrackingServices/TrackerItemService.cs
index 264df4e56..d0325fa88 100644
--- a/src/TrackerCouncil.Smz3.Tracking/TrackingServices/TrackerItemService.cs
+++ b/src/TrackerCouncil.Smz3.Tracking/TrackingServices/TrackerItemService.cs
@@ -176,7 +176,7 @@ public bool TrackItem(Item item, string? trackedAs = null, float? confidence = n
{
logger.LogInformation("Clearing location for item {ItemType}", item.Type.GetDescription());
- Tracker.LocationTracker.Clear(location, confidence, autoTracked, stateResponse: false, allowLocationComments: true, updateTreasureCount: true);
+ Tracker.LocationTracker.Clear(location, confidence, autoTracked, stateResponse: false, allowLocationComments: true, updateTreasureCount: true, stateTreasureResponse: true);
// If this is a parsed AP/Mainline rom and this is an item for another player, let's comment on it
if (stateResponse && item is { IsLocalPlayerItem: false } && World.Config.RomGenerator != RomGenerator.Cas)
@@ -197,6 +197,8 @@ public bool TrackItem(Item item, string? trackedAs = null, float? confidence = n
item.Metadata.NameWithArticle, item.PlayerName]);
}
}
+
+ return true;
}
if (!didTrack)
@@ -233,7 +235,7 @@ public bool TrackItem(Item item, string? trackedAs = null, float? confidence = n
// Clear the location if it's for the local player's world
if (location != null && location.World == World && !location.Cleared)
{
- Tracker.LocationTracker.Clear(location, confidence, autoTracked, !silent, true);
+ Tracker.LocationTracker.Clear(location, confidence, autoTracked, !silent && !isGTPreBigKey, true);
undoActions.Add(autoTracked ? null : PopUndo().Action);
}
}
diff --git a/src/TrackerCouncil.Smz3.Tracking/TrackingServices/TrackerLocationService.cs b/src/TrackerCouncil.Smz3.Tracking/TrackingServices/TrackerLocationService.cs
index 6cf05254f..416606710 100644
--- a/src/TrackerCouncil.Smz3.Tracking/TrackingServices/TrackerLocationService.cs
+++ b/src/TrackerCouncil.Smz3.Tracking/TrackingServices/TrackerLocationService.cs
@@ -24,7 +24,7 @@ internal class TrackerLocationService(ILogger logger, IP
public event EventHandler? LocationCleared;
public event EventHandler? LocationMarked;
- public void Clear(Location location, float? confidence = null, bool autoTracked = false, bool stateResponse = true, bool allowLocationComments = false, bool updateTreasureCount = true)
+ public void Clear(Location location, float? confidence = null, bool autoTracked = false, bool stateResponse = true, bool allowLocationComments = false, bool updateTreasureCount = true, bool? stateTreasureCount = null)
{
if (stateResponse && allowLocationComments)
{
@@ -48,7 +48,7 @@ public void Clear(Location location, float? confidence = null, bool autoTracked
}
var undoTrackTreasure = updateTreasureCount
- ? Tracker.TreasureTracker.TryTrackDungeonTreasure(location, confidence, stateResponse: stateResponse)
+ ? Tracker.TreasureTracker.TryTrackDungeonTreasure(location, confidence, stateResponse: stateTreasureCount ?? stateResponse)
: null;
// Important: clear only after tracking dungeon treasure, as
diff --git a/src/TrackerCouncil.Smz3.Tracking/TrackingServices/TrackerTreasureService.cs b/src/TrackerCouncil.Smz3.Tracking/TrackingServices/TrackerTreasureService.cs
index 7fa7038ae..828da8017 100644
--- a/src/TrackerCouncil.Smz3.Tracking/TrackingServices/TrackerTreasureService.cs
+++ b/src/TrackerCouncil.Smz3.Tracking/TrackingServices/TrackerTreasureService.cs
@@ -121,7 +121,7 @@ public bool UntrackDungeonTreasure(IHasTreasure region, int amount = 1)
}
var dungeon = location.GetTreasureRegion();
- if (dungeon != null && (location.Item.IsTreasure || World.Config.ZeldaKeysanity))
+ if (dungeon != null && (location.Item.IsTreasure || World.Config.ZeldaKeysanity || !location.Item.IsLocalPlayerItem))
{
if (TrackDungeonTreasure(dungeon, confidence, 1, autoTracked, stateResponse))
{