mirror of
https://github.com/kwsch/pkNX.git
synced 2026-06-01 10:27:03 -05:00
109 lines
3.7 KiB
C#
109 lines
3.7 KiB
C#
using System.Collections.Generic;
|
|
using System.Text;
|
|
using pkNX.Structures;
|
|
|
|
namespace pkNX.Sprites
|
|
{
|
|
public static class SpriteName
|
|
{
|
|
public static bool AllowShinySprite { get; set; } = true;
|
|
public static bool AllowGigantamaxSprite { get; set; } = true;
|
|
|
|
private const string Separator = "_";
|
|
private const string Cosplay = "c";
|
|
private const string Shiny = "s";
|
|
private const string Gigantamax = "gmax";
|
|
private const string GGStarter = "p";
|
|
|
|
public static string GetResourceStringBall(int ball) => $"_ball{ball}";
|
|
|
|
/// <summary>
|
|
/// Gets the resource name of the Pokémon sprite.
|
|
/// </summary>
|
|
public static string GetResourceStringSprite(int species, int form, int gender, int generation = 8, bool shiny = false, bool gmax = false)
|
|
{
|
|
if (SpeciesDefaultFormSprite.Contains(species) && !gmax) // Species who show their default sprite regardless of Form
|
|
form = 0;
|
|
|
|
if (gmax && (species == (int)Species.Toxtricity || species == (int)Species.Alcremie)) // same sprites for all altform gmaxes
|
|
form = 0;
|
|
|
|
switch (form)
|
|
{
|
|
case 30 when species >= (int)Species.Scatterbug && species <= (int)Species.Vivillon: // save file specific
|
|
form = 0;
|
|
break;
|
|
case 31 when species == (int)Species.Unown || species == (int)Species.Deerling || species == (int)Species.Sawsbuck: // Random
|
|
form = 0;
|
|
break;
|
|
}
|
|
|
|
var sb = new StringBuilder();
|
|
sb.Append(Separator).Append(species);
|
|
|
|
if (form != 0)
|
|
{
|
|
sb.Append(Separator); sb.Append(form);
|
|
|
|
if (species == (int)Species.Pikachu)
|
|
{
|
|
if (generation == 6)
|
|
{
|
|
sb.Append(Cosplay);
|
|
gender = 2; // Cosplay Pikachu gift can only be Female, but personal entries are set to be either Gender
|
|
}
|
|
else if (form == 8)
|
|
sb.Append(GGStarter);
|
|
}
|
|
else if (species == (int)Species.Eevee)
|
|
{
|
|
if (form == 1)
|
|
sb.Append(GGStarter);
|
|
}
|
|
}
|
|
if (gender == 2 && SpeciesGenderedSprite.Contains(species) && !gmax)
|
|
{
|
|
sb.Append('f');
|
|
}
|
|
|
|
if (gmax && AllowGigantamaxSprite)
|
|
{
|
|
sb.Append(Separator);
|
|
sb.Append(Gigantamax);
|
|
}
|
|
if (shiny && AllowShinySprite)
|
|
sb.Append(Shiny);
|
|
return sb.ToString();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Species that show their default Species sprite regardless of current form
|
|
/// </summary>
|
|
public static readonly HashSet<int> SpeciesDefaultFormSprite = new HashSet<int>
|
|
{
|
|
(int)Species.Mothim,
|
|
(int)Species.Scatterbug,
|
|
(int)Species.Spewpa,
|
|
(int)Species.Rockruff,
|
|
(int)Species.Mimikyu,
|
|
(int)Species.Sinistea,
|
|
(int)Species.Polteageist,
|
|
(int)Species.Urshifu,
|
|
};
|
|
|
|
/// <summary>
|
|
/// Species that show a Gender specific Sprite
|
|
/// </summary>
|
|
public static readonly HashSet<int> SpeciesGenderedSprite = new HashSet<int>
|
|
{
|
|
(int)Species.Pikachu,
|
|
(int)Species.Hippopotas,
|
|
(int)Species.Hippowdon,
|
|
(int)Species.Unfezant,
|
|
(int)Species.Frillish,
|
|
(int)Species.Jellicent,
|
|
(int)Species.Pyroar,
|
|
};
|
|
}
|
|
}
|