using System.Collections.Generic; using System.Text; using PKHeX.Core; namespace PKHeX.Drawing { public static class SpriteName { public static bool AllowShinySprite { get; set; } private const string Separator = "_"; private const string Cosplay = "c"; private const string Shiny = "s"; private const string GGStarter = "p"; /// /// Gets the resource name of the sprite. /// public static string GetResourceStringBall(int ball) => $"_ball{ball}"; /// /// Gets the resource name of the Pokémon sprite. /// public static string GetResourceStringSprite(int species, int form, int gender, int generation = PKX.Generation, bool shiny = false) { if (SpeciesDefaultFormSprite.Contains(species)) // Species who show their default sprite regardless of Form form = 0; var sb = new StringBuilder(); { sb.Append(Separator); sb.Append(species); } if (form != 0) { sb.Append(Separator); sb.Append(form); if (species == (int) Species.Pikachu) { if (generation == 6) sb.Append(Cosplay); else if (form == 8) sb.Append(GGStarter); } else if (species == (int) Species.Eevee) { if (form == 1) sb.Append(GGStarter); } } else if (gender == 1 && SpeciesGenderedSprite.Contains(species)) { sb.Append(Separator); sb.Append(gender); } if (shiny && AllowShinySprite) sb.Append(Shiny); return sb.ToString(); } /// /// Species that show their default Species sprite regardless of current /// private static readonly HashSet SpeciesDefaultFormSprite = new HashSet { (int)Species.Mothim, (int)Species.Arceus, (int)Species.Scatterbug, (int)Species.Spewpa, (int)Species.Silvally, (int)Species.Mimikyu, }; /// /// Species that show a specific Sprite /// private static readonly HashSet SpeciesGenderedSprite = new HashSet { (int)Species.Unfezant, (int)Species.Frillish, (int)Species.Jellicent, (int)Species.Pyroar, }; } }