diff --git a/PKHeX.Core/Legality/Tables.cs b/PKHeX.Core/Legality/Tables.cs
index f61846454..37c784970 100644
--- a/PKHeX.Core/Legality/Tables.cs
+++ b/PKHeX.Core/Legality/Tables.cs
@@ -35,6 +35,28 @@ public static partial class Legal
315, 407, // Roselia
358, // Chimecho
};
+ ///
+ /// Species that show their default Species sprite regardless of current
+ ///
+ public static readonly HashSet SpeciesDefaultFormSprite = new HashSet
+ {
+ 414, // Mothim
+ 493, // Arceus
+ 664, // Scatterbug
+ 665, // Spewpa
+ 773, // Silvally
+ 778, // Mimikyu
+ };
+ ///
+ /// Species that show a specific Sprite
+ ///
+ public static readonly HashSet SpeciesGenderedSprite = new HashSet
+ {
+ 521, // Unfezant
+ 592, // Frillish
+ 593, // Jellicent
+ 668, // Pyroar
+ };
public static readonly HashSet FormChange = new HashSet // Pokémon that can change form and retain it
{
386, // Deoxys
diff --git a/PKHeX.Core/PKM/PKX.cs b/PKHeX.Core/PKM/PKX.cs
index a951ff136..aa5f8a397 100644
--- a/PKHeX.Core/PKM/PKX.cs
+++ b/PKHeX.Core/PKM/PKX.cs
@@ -568,21 +568,27 @@ public static uint GetRandomPID(int species, int cg, int origin, int nature, int
// Data Requests
public static string GetResourceStringBall(int ball) => $"_ball{ball}";
- public static string GetResourceStringSprite(int species, int form, int gender, int generation = Generation)
+ private const string ResourceSeparator = "_";
+ private const string ResourcePikachuCap = "c";
+ private const string ResourceShiny = "s";
+ public static bool AllowShinySprite = false;
+ public static string GetResourceStringSprite(int species, int form, int gender, int generation = Generation, bool shiny = false)
{
- if (new[] { 778, 664, 665, 414, 493, 773 }.Contains(species)) // Species who show their default sprite regardless of Form
+ if (Legal.SpeciesDefaultFormSprite.Contains(species)) // Species who show their default sprite regardless of Form
form = 0;
- string file = $"_{species}";
- if (form > 0) // Alt Form Handling
- file += $"_{form}";
- else if (gender == 1 && new[] { 592, 593, 521, 668 }.Contains(species)) // Frillish & Jellicent, Unfezant & Pyroar
- file += $"_{gender}";
+ var sb = new System.Text.StringBuilder();
+ { sb.Append(ResourceSeparator); sb.Append(species); }
+ if (form > 0)
+ { sb.Append(ResourceSeparator); sb.Append(form); }
+ else if (gender == 1 && Legal.SpeciesGenderedSprite.Contains(species)) // Frillish & Jellicent, Unfezant & Pyroar
+ { sb.Append(ResourceSeparator); sb.Append(gender); }
if (species == 25 && form > 0 && generation >= 7) // Pikachu
- file += "c"; // Cap
-
- return file;
+ sb.Append(ResourcePikachuCap);
+ if (shiny && AllowShinySprite)
+ sb.Append(ResourceShiny);
+ return sb.ToString();
}
///