2019-10-04 01:23:40 +00:00
|
|
|
|
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";
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the resource name of the <see cref="Ball"/> sprite.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static string GetResourceStringBall(int ball) => $"_ball{ball}";
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the resource name of the Pokémon sprite.
|
|
|
|
|
/// </summary>
|
2020-03-04 04:22:57 +00:00
|
|
|
|
public static string GetResourceStringSprite(int species, int form, int gender, uint formarg, int generation = PKX.Generation, bool shiny = false)
|
2019-10-04 01:23:40 +00:00
|
|
|
|
{
|
|
|
|
|
if (SpeciesDefaultFormSprite.Contains(species)) // Species who show their default sprite regardless of Form
|
|
|
|
|
form = 0;
|
|
|
|
|
|
|
|
|
|
var sb = new StringBuilder();
|
2020-03-04 04:22:57 +00:00
|
|
|
|
sb.Append(Separator).Append(species);
|
2019-10-04 01:23:40 +00:00
|
|
|
|
|
|
|
|
|
if (form != 0)
|
|
|
|
|
{
|
2020-03-04 04:22:57 +00:00
|
|
|
|
sb.Append(Separator).Append(form);
|
2019-10-04 01:23:40 +00:00
|
|
|
|
|
|
|
|
|
if (species == (int) Species.Pikachu)
|
|
|
|
|
{
|
|
|
|
|
if (generation == 6)
|
2020-08-11 01:33:44 +00:00
|
|
|
|
{
|
2019-10-04 01:23:40 +00:00
|
|
|
|
sb.Append(Cosplay);
|
2020-08-11 01:33:44 +00:00
|
|
|
|
gender = 1; // Cosplay Pikachu gift can only be Female, but personal entries are set to be either Gender
|
|
|
|
|
}
|
2019-10-04 01:23:40 +00:00
|
|
|
|
else if (form == 8)
|
|
|
|
|
sb.Append(GGStarter);
|
|
|
|
|
}
|
|
|
|
|
else if (species == (int) Species.Eevee)
|
|
|
|
|
{
|
|
|
|
|
if (form == 1)
|
|
|
|
|
sb.Append(GGStarter);
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-09 23:10:11 +00:00
|
|
|
|
if (gender == 1 && SpeciesGenderedSprite.Contains(species))
|
2019-11-16 01:34:18 +00:00
|
|
|
|
{
|
|
|
|
|
sb.Append('f');
|
|
|
|
|
}
|
2019-10-04 01:23:40 +00:00
|
|
|
|
|
2020-03-04 04:22:57 +00:00
|
|
|
|
if (species == (int) Species.Alcremie)
|
|
|
|
|
{
|
|
|
|
|
if (form == 0)
|
|
|
|
|
sb.Append(Separator).Append(form);
|
|
|
|
|
sb.Append(Separator).Append(formarg);
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-04 01:23:40 +00:00
|
|
|
|
if (shiny && AllowShinySprite)
|
|
|
|
|
sb.Append(Shiny);
|
|
|
|
|
return sb.ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Species that show their default Species sprite regardless of current <see cref="PKM.AltForm"/>
|
|
|
|
|
/// </summary>
|
|
|
|
|
private static readonly HashSet<int> SpeciesDefaultFormSprite = new HashSet<int>
|
|
|
|
|
{
|
|
|
|
|
(int)Species.Mothim,
|
|
|
|
|
(int)Species.Arceus,
|
|
|
|
|
(int)Species.Scatterbug,
|
|
|
|
|
(int)Species.Spewpa,
|
2020-05-21 23:19:25 +00:00
|
|
|
|
(int)Species.Rockruff,
|
2019-10-04 01:23:40 +00:00
|
|
|
|
(int)Species.Silvally,
|
|
|
|
|
(int)Species.Mimikyu,
|
2020-03-14 05:02:41 +00:00
|
|
|
|
(int)Species.Sinistea,
|
|
|
|
|
(int)Species.Polteageist,
|
2020-06-19 23:51:15 +00:00
|
|
|
|
(int)Species.Urshifu,
|
2019-10-04 01:23:40 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Species that show a <see cref="PKM.Gender"/> specific Sprite
|
|
|
|
|
/// </summary>
|
|
|
|
|
private static readonly HashSet<int> SpeciesGenderedSprite = new HashSet<int>
|
|
|
|
|
{
|
2020-07-09 23:10:11 +00:00
|
|
|
|
(int)Species.Pikachu,
|
2020-03-14 05:02:41 +00:00
|
|
|
|
(int)Species.Hippopotas,
|
2019-11-16 01:34:18 +00:00
|
|
|
|
(int)Species.Hippowdon,
|
2019-10-04 01:23:40 +00:00
|
|
|
|
(int)Species.Unfezant,
|
|
|
|
|
(int)Species.Frillish,
|
|
|
|
|
(int)Species.Jellicent,
|
|
|
|
|
(int)Species.Pyroar,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|