From 1c1ef29e905c1d7bc73b23006178afe3acb87d84 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Tue, 19 Mar 2024 23:38:56 -0400 Subject: [PATCH] Add transformative get-only accessors for IDDB --- SabreTools.DatFiles/ItemDictionaryDB.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/SabreTools.DatFiles/ItemDictionaryDB.cs b/SabreTools.DatFiles/ItemDictionaryDB.cs index 18b830e1..21a82c6c 100644 --- a/SabreTools.DatFiles/ItemDictionaryDB.cs +++ b/SabreTools.DatFiles/ItemDictionaryDB.cs @@ -306,10 +306,14 @@ namespace SabreTools.DatFiles } /// - /// Get all items from the current dictionary + /// Get all item mappings /// - public DatItem[] GetItems() - => _items.Select(kvp => kvp.Value).ToArray(); + public (long, long)[] GetItemMappings() => _itemToMachineMapping.Select(kvp => (kvp.Key, kvp.Value)).ToArray(); + + /// + /// Get all items and their indicies + /// + public (long, DatItem)[] GetItems() => _items.Select(kvp => (kvp.Key, kvp.Value)).ToArray(); /// /// Get the indices and items associated with a bucket name @@ -390,10 +394,9 @@ namespace SabreTools.DatFiles } /// - /// Get all machines from the current dictionary + /// Get all machines and their indicies /// - public Machine[] GetMachines() - => _machines.Select(kvp => kvp.Value).ToArray(); + public (long, Machine)[] GetMachines() => _machines.Select(kvp => (kvp.Key, kvp.Value)).ToArray(); /// /// Remove an item, returning if it could be removed