diff --git a/PKHeX.Core/Editing/Bulk/BatchFilters.cs b/PKHeX.Core/Editing/Bulk/BatchFilters.cs index 061d0a5ed..a71e89ceb 100644 --- a/PKHeX.Core/Editing/Bulk/BatchFilters.cs +++ b/PKHeX.Core/Editing/Bulk/BatchFilters.cs @@ -22,10 +22,10 @@ public static class BatchFilters (obj, cmd) => obj is SlotCache s && s.Identify().Contains(cmd.PropertyValue) == cmd.Evaluator), new MetaFilter(nameof(SlotInfoBox.Box), - (obj, cmd) => obj is SlotCache { Source: SlotInfoBox b } && (b.Box.ToString() == cmd.PropertyValue) == cmd.Evaluator), + (obj, cmd) => obj is SlotCache { Source: SlotInfoBox b } && int.TryParse(cmd.PropertyValue, out var box) && b.Box == box), new MetaFilter(nameof(ISlotInfo.Slot), - (obj, cmd) => obj is SlotCache s && (s.Source.Slot.ToString() == cmd.PropertyValue) == cmd.Evaluator), + (obj, cmd) => obj is SlotCache s && int.TryParse(cmd.PropertyValue, out var slot) && s.Source.Slot == slot), }; } } diff --git a/PKHeX.Core/Editing/Saves/Slots/Info/SlotInfoLoader.cs b/PKHeX.Core/Editing/Saves/Slots/Info/SlotInfoLoader.cs index 493be556e..0d1a0ff0d 100644 --- a/PKHeX.Core/Editing/Saves/Slots/Info/SlotInfoLoader.cs +++ b/PKHeX.Core/Editing/Saves/Slots/Info/SlotInfoLoader.cs @@ -123,7 +123,7 @@ public static void AddBoxData(SaveFile sav, ICollection db) { for (int slot = 0; slot < sc; slot++, ctr++) { - var ident = new SlotInfoBox(box, slot); + var ident = new SlotInfoBox(box + 1, slot + 1); var result = new SlotCache(ident, bd[ctr], sav); db.Add(result); } @@ -139,7 +139,7 @@ public static void AddPartyData(SaveFile sav, ICollection db) if (pk.Species == 0) continue; - var ident = new SlotInfoParty(index); + var ident = new SlotInfoParty(index + 1); var result = new SlotCache(ident, pk, sav); db.Add(result); } diff --git a/PKHeX.WinForms/Subforms/PKM Editors/BatchEditor.cs b/PKHeX.WinForms/Subforms/PKM Editors/BatchEditor.cs index 5681424ec..3be4a7677 100644 --- a/PKHeX.WinForms/Subforms/PKM Editors/BatchEditor.cs +++ b/PKHeX.WinForms/Subforms/PKM Editors/BatchEditor.cs @@ -241,15 +241,24 @@ private void SetProgressBar(int i) private void ProcessSAV(IList data, IReadOnlyList Filters, IReadOnlyList Instructions) { + if (data.Count == 0) + return; + var filterMeta = Filters.Where(f => BatchFilters.FilterMeta.Any(z => z.IsMatch(f.PropertyName))).ToArray(); if (filterMeta.Length != 0) Filters = Filters.Except(filterMeta).ToArray(); + var max = data[0].Entity.MaxSpeciesID; + for (int i = 0; i < data.Count; i++) { var entry = data[i]; var pk = data[i].Entity; + var spec = pk.Species; + if (spec <= 0 || spec > max) + continue; + if (entry.Source is SlotInfoBox info && SAV.GetSlotFlags(info.Box, info.Slot).IsOverwriteProtected()) editor.AddSkipped(); else if(!BatchEditing.IsFilterMatchMeta(filterMeta, entry))