From 1625a47aa8cb5020e2710dbf69c743b7e87e51f5 Mon Sep 17 00:00:00 2001 From: Anna Date: Sat, 1 Aug 2020 22:38:47 -0400 Subject: [PATCH] feat: use mapping in data files --- Globetrotter/TreasureMaps.cs | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/Globetrotter/TreasureMaps.cs b/Globetrotter/TreasureMaps.cs index 45ff1c1..bc0c0d0 100644 --- a/Globetrotter/TreasureMaps.cs +++ b/Globetrotter/TreasureMaps.cs @@ -17,22 +17,19 @@ namespace Globetrotter { return _mapToRow; } - Item[] unopenedMaps = this.pi.Data.GetExcelSheet() - .Where(item => item.FilterGroup == 18) // this is the filter group for maps - .Where(item => item.RowId != 24_794) // exclude the seemingly special maps - .ToArray(); - EventItem[] openedMaps = this.pi.Data.GetExcelSheet() - .Where(item => item.Unknown13 == 2) // apparently only opened maps have this field - .Where(item => item.Unknown5 == 1) // this removes some weird maps and dupes - .Where(item => item.RowId != 2_002_503 && item.RowId != 2_002_504) // exclude the seemingly special maps - .ToArray(); - Dictionary mapToRow = new Dictionary(); - for (int i = 0; i < unopenedMaps.Length; i++) { - Item unopened = unopenedMaps[i]; - EventItem opened = openedMaps[i]; - // associate the eventitem's id with the additional data of the unopened map, which is the row for the treasure spot table + foreach (TreasureHuntRank rank in this.pi.Data.GetExcelSheet()) { + Item unopened = rank.ItemName.Value; + if (unopened == null) { + continue; + } + + EventItem opened = rank.KeyItemName.Value; + if (opened == null) { + continue; + } + mapToRow[opened.RowId] = unopened.AdditionalData; }