From de84dcd3ba6a2eb3e9770ef1acf4150896f586b3 Mon Sep 17 00:00:00 2001 From: Kurt Date: Fri, 4 Jul 2025 22:43:52 -0500 Subject: [PATCH] Fix wild slot spawn uniqueness filter Cramming in Weather when the hash used 64bits already was my mistake; code wasn't obvious lol. Upgrade to u128; not any noticeable perf drop. Pull out LevelAdjust to not fetch every pokemon attempted (negligible speed boost) --- pkNX.WinForms/Dumping/SV/Encounter/PaldeaEncounter.cs | 6 +++--- pkNX.WinForms/Dumping/SV/Location/LocationStorage.cs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkNX.WinForms/Dumping/SV/Encounter/PaldeaEncounter.cs b/pkNX.WinForms/Dumping/SV/Encounter/PaldeaEncounter.cs index f1596306..51b09322 100644 --- a/pkNX.WinForms/Dumping/SV/Encounter/PaldeaEncounter.cs +++ b/pkNX.WinForms/Dumping/SV/Encounter/PaldeaEncounter.cs @@ -54,7 +54,7 @@ private string GetString(string species) { var form = Form == 0 ? "" : $"-{Form}"; var sex = Sex == 0 ? "" : $" (sex={Sex})"; - return $"{species}{form}{sex} Lv. {MinLevel}-{MaxLevel}"; + return $"{species}{form}{sex} Lv. {MinLevel}-{MaxLevel} {Weather}"; } public bool Absorb(PaldeaEncounter other) @@ -112,9 +112,9 @@ public int CompareTo(PaldeaEncounter? other) return CrossFromLocation.CompareTo(other.CrossFromLocation); } - public ulong GetHash() + public UInt128 GetHash() { - ulong result = Species; + UInt128 result = Species; result = (result << 16) | CrossFromLocation; result = (result << 8) | Form; diff --git a/pkNX.WinForms/Dumping/SV/Location/LocationStorage.cs b/pkNX.WinForms/Dumping/SV/Location/LocationStorage.cs index cb102c37..6c87543f 100644 --- a/pkNX.WinForms/Dumping/SV/Location/LocationStorage.cs +++ b/pkNX.WinForms/Dumping/SV/Location/LocationStorage.cs @@ -10,7 +10,7 @@ public class LocationStorage(int loc, PaldeaFieldIndex fieldIndex, string areaNa public readonly AreaInfo AreaInfo = info; public readonly string AreaName = areaName; - public readonly HashSet Added = []; + public readonly HashSet Added = []; public readonly List Slots = []; public readonly Dictionary SlotsCrossover = []; public readonly List Local = []; @@ -143,6 +143,7 @@ public void GetEncounters(EncountPokeDataArray pokeData, PaldeaSceneModel scene) { foreach (var spawner in Local) { + var boost = spawner.LevelAdjust; foreach (var pd in pokeData.Table) { if (!IsAbleToSpawnAt(pd, spawner, AreaName, scene, fieldIndex)) @@ -154,7 +155,6 @@ public void GetEncounters(EncountPokeDataArray pokeData, PaldeaSceneModel scene) if (pd.BandPoke != 0) // Add band encount spawner.Add(PaldeaEncounter.GetBand(pd, point)); - var boost = spawner.LevelAdjust; if (boost == 0) continue;