sprites

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package sprites provides types and helper methods for retrieving the sprite you need.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DreamWorld

type DreamWorld struct {
	FrontDefault SpriteURL `json:"front_default"`
	FrontFemale  SpriteURL `json:"front_female"`
}

DreamWorld stores the sprites sourced from the pokémon dream world (Gen V).

type GameSources

type GameSources map[string]GameVersions

GameSources is a map of pokeapi.Generation (specifically its [pokeapi.NamedIdentifier.Name]) to that generation's GameVersions' sprite lists.

type GameSprites

type GameSprites map[GameSpritesKey]any

GameSprites is a map of GameSpritesKey to the URLs. Acceptable usage is documented on the GameSpritesKey definition itself.

Not that some keys may be present in the map but have value nil.

type GameSpritesKey

type GameSpritesKey string
const (
	FrontDefault     GameSpritesKey = "front_default"
	FrontTransparent GameSpritesKey = "front_transparent" // Only present in generation-i & generation-ii.
	FrontGray        GameSpritesKey = "front_gray"        // Only present in generation-i.
	FrontShiny       GameSpritesKey = "front_shiny"
	FrontFemale      GameSpritesKey = "front_female"
	FrontShinyFemale GameSpritesKey = "front_shiny_female"

	BackDefault     GameSpritesKey = "back_default"
	BackTransparent GameSpritesKey = "back_transparent" // Only present in generation-ii & generation-ii.
	BackGray        GameSpritesKey = "back_gray"        // Only present in generation-i.
	BackShiny       GameSpritesKey = "back_shiny"
	BackFemale      GameSpritesKey = "back_female"
	BackShinyFemale GameSpritesKey = "back_shiny_female"
)

Cast to string. Typically optional.

const (
	// Animated is only present in generation-v. Cast to a PokemonDefaults.
	Animated GameSpritesKey = "animated"
	// Icons is present from generation-vii onwards. Cast to an IconSprites.
	Icons GameSpritesKey = "icons"
)

type GameVersions

type GameVersions map[string]GameSprites

GameVersions is a map of pokeapi.VersionGroup (specifically its [pokeapi.NamedIdentifier.Name]) to GameSprites sprite sets. Exceptions follow:

- Gold and Silver have separate entries in the map. Key by game instead.

- Sun and Moon are not present in the map. Instead, only Ultra Sun and Ultra Moon's data is returned. Use that instead.

type Home

type Home struct {
	FrontDefault     SpriteURL `json:"front_default"`
	FrontShiny       SpriteURL `json:"front_shiny"`
	FrontFemale      SpriteURL `json:"front_female"`
	FrontShinyFemale SpriteURL `json:"front_shiny_female"`
}

Home stores the sprites sourced from pokémon home.

type IconSprites

type IconSprites struct {
	FrontDefault SpriteURL `json:"front_default"`
	FrontFemale  SpriteURL `json:"front_female"`
}

type Item

type Item struct {
	Default string `json:"default"`
}

Item is a set of URLs pointing to where the sprite images representing the pokeapi.Item are hosted.

type OfficialArtwork

type OfficialArtwork struct {
	FrontDefault SpriteURL `json:"front_default"`
	FrontShiny   SpriteURL `json:"front_shiny"`
}

OfficialArtwork stores the sprites sourced from officially released digital artworks.

type OtherSources

type OtherSources struct {
	DreamWorld      DreamWorld      `json:"dream_world"`
	Home            Home            `json:"home"`
	OfficialArtwork OfficialArtwork `json:"official_artwork"`
	Showdown        Showdown        `json:"showdown"`
}

type Pokemon

type Pokemon struct {
	PokemonDefaults

	Other    OtherSources `json:"other"`
	Versions GameSources  `json:"versions"`
}

Pokemon is a set of URLs pointing to where the sprite images representing the pokeapi.Pokemon are hosted.

type PokemonDefaults

type PokemonDefaults struct {
	FrontDefault string `json:"front_default"`
	FrontShiny   string `json:"front_shiny"`
	BackDefault  string `json:"back_default"`
	BackShiny    string `json:"back_shiny"`

	FrontFemale      SpriteURL `json:"front_female"`
	FrontShinyFemale SpriteURL `json:"front_shiny_female"`
	BackFemale       SpriteURL `json:"back_female"`
	BackShinyFemale  SpriteURL `json:"back_shiny_female"`
}

The PokemonDefaults are the minimum set of pokemon sprite resources. They are the ones presented by the api for general use, and are likely to suit a majority of needs. They are the only resources guaranteed to be present.

type PokemonForm

type PokemonForm struct {
	PokemonDefaults
}

PokemonForm is a set of URLs pointing to where the sprite images representing the pokeapi.PokemonForm are hosted.

type Showdown

type Showdown PokemonDefaults

Showdown stores the sprites used by pokemon showdown.

type SpriteURL

type SpriteURL string

SpriteURL stores the URL the given sprite is hosted at. Most URLs are optional and may or may not be Present.

While the api returns `null` for non-present URLs, the Go JSON decoder safely converts such fields to `""`.

func (SpriteURL) Present

func (o SpriteURL) Present() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL