diff --git a/PKHeX.Core/Saves/SAV4HGSS.cs b/PKHeX.Core/Saves/SAV4HGSS.cs index 0a47a8764..1307dd08d 100644 --- a/PKHeX.Core/Saves/SAV4HGSS.cs +++ b/PKHeX.Core/Saves/SAV4HGSS.cs @@ -221,10 +221,27 @@ public Span GetPokeGearRoloDex() public void SetPokeGearRoloDex(ReadOnlySpan value) => value.CopyTo(GetPokeGearRoloDex()); + /// + /// Returns the player's own on-screen character (Ethan/Lyra), which should not appear as a phone contact. + /// + private PokegearNumber PlayerCharacterRival => Gender == 0 ? PokegearNumber.Ethan : PokegearNumber.Lyra; + public void PokeGearUnlockAllCallers() { + var excluded = PlayerCharacterRival; + var dex = GetPokeGearRoloDex(); + + int index = 0; for (int i = 0; i < GearCallerCount; i++) - SetCallerAtIndex(i, (PokegearNumber)i); + { + var caller = (PokegearNumber)i; + if (caller == excluded || caller == PokegearNumber.Bike_Shop) + continue; + dex[index++] = caller; + } + + // clear remaining callers + PokeGearClearAllCallers(index); } public void PokeGearClearAllCallers(int start = 0) @@ -244,17 +261,24 @@ public void PokeGearClearAllCallers(int start = 0) PokegearNumber.Daycare_Man, PokegearNumber.Daycare_Lady, PokegearNumber.Bill, - PokegearNumber.Bike_Shop, PokegearNumber.Baoba, ]; public void PokeGearUnlockAllCallersNoTrainers() { + var excluded = PlayerCharacterRival; var dex = GetPokeGearRoloDex(); - NotTrainers.CopyTo(dex); + + int index = 0; + foreach (var caller in NotTrainers) + { + if (caller == excluded) + continue; + dex[index++] = caller; + } // clear remaining callers - PokeGearClearAllCallers(NotTrainers.Length); + PokeGearClearAllCallers(index); } public Pokeathlon4 Pokeathlon => new(GeneralBuffer.Slice(0xD9D4, Pokeathlon4.SIZE)); // 0xB80