mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-10 06:34:19 +00:00
Fix database search returning empty w/ unfiltered
Closes #4211 Also fix box dump not creating folder and Surprise Trade block optionally existing in SV saves.
This commit is contained in:
parent
353c00ef67
commit
7122c5c3f5
4 changed files with 11 additions and 5 deletions
|
@ -81,6 +81,9 @@ public static class BoxExport
|
|||
private static int ExportBox(SaveFile sav, string destPath, IFileNamer<PKM> namer, int box, BoxExportSettings settings,
|
||||
int boxSlotCount, int total)
|
||||
{
|
||||
if (!Directory.Exists(destPath))
|
||||
Directory.CreateDirectory(destPath);
|
||||
|
||||
int count = GetSlotCountForBox(boxSlotCount, box, total);
|
||||
int ctr = 0;
|
||||
// Export each slot in the box.
|
||||
|
|
|
@ -235,9 +235,12 @@ public static partial class Extensions
|
|||
if (sav.Blocks.TryGetBlock(SaveBlockAccessor9SV.KFusedNecrozmaM, out var lunala))
|
||||
list.Add(new(lunala.Data, 3, true) { Type = StorageSlotType.Fused });
|
||||
|
||||
var st = sav.Blocks.GetBlock(SaveBlockAccessor9SV.KSurpriseTrade).Data.AsMemory();
|
||||
list.Add(new(st[0x198..], 0) { Type = StorageSlotType.Misc }); // my upload
|
||||
list.Add(new(st[0x2C..], 1) { Type = StorageSlotType.Misc }); // received from others
|
||||
if (sav.Blocks.TryGetBlock(SaveBlockAccessor9SV.KSurpriseTrade, out var surprise))
|
||||
{
|
||||
var st = surprise.Data;
|
||||
list.Add(new(st[0x198..], 0) { Type = StorageSlotType.Misc }); // my upload
|
||||
list.Add(new(st[0x2C..], 1) { Type = StorageSlotType.Misc }); // received from others
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -157,7 +157,7 @@ public sealed class SearchSettings
|
|||
return false;
|
||||
if (Item > -1 && pk.HeldItem != Item)
|
||||
return false;
|
||||
if (Version > 0 && pk.Version != Version)
|
||||
if (Version.IsValidSavedVersion() && pk.Version != Version)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ public abstract class SCBlockAccessor : ISaveBlockAccessor<SCBlock>
|
|||
var index = FindIndex(array, key);
|
||||
if (index != -1)
|
||||
return array[index];
|
||||
throw new KeyNotFoundException(nameof(key));
|
||||
throw new KeyNotFoundException($"Key not found: {key:X8}");
|
||||
}
|
||||
|
||||
private static SCBlock FindOrDefault(IReadOnlyList<SCBlock> array, uint key)
|
||||
|
|
Loading…
Reference in a new issue