Documentation
¶
Index ¶
- Constants
- Variables
- func Contains(str1, str2 string) bool
- func Cut(in, tag string) []string
- func Equals(str1, str2 string) bool
- func ExtractNumber(str string) string
- func ExtractYear(str string) string
- func GetSet(code string) (*mtgjson.Set, error)
- func GetSetByName(edition string, flags ...bool) (*mtgjson.Set, error)
- func GetSetUUID(uuid string) (*mtgjson.Set, error)
- func GetSets() map[string]*mtgjson.Set
- func GetUUIDs() map[string]CardObject
- func HasBorderlessPrinting(name string, editions ...string) bool
- func HasChineseAltArtPrinting(name string, editions ...string) bool
- func HasEtchedPrinting(name string, editions ...string) bool
- func HasExtendedArtPrinting(name string, editions ...string) bool
- func HasFoilPrinting(name string, editions ...string) bool
- func HasNonfoilPrinting(name string, editions ...string) bool
- func HasPrefix(str1, str2 string) bool
- func HasPrereleasePrinting(name string, editions ...string) bool
- func HasPromoPackPrinting(name string, editions ...string) bool
- func HasReskinPrinting(name string, editions ...string) bool
- func HasRetroFramePrinting(name string, editions ...string) bool
- func HasShowcasePrinting(name string, editions ...string) bool
- func HasSuffix(str1, str2 string) bool
- func IsBasicLand(name string) bool
- func IsToken(name string) bool
- func LoadDatastore(reader io.Reader) error
- func LoadDatastoreFile(filename string) error
- func Match(inCard *Card) (cardId string, err error)
- func MatchId(inputId string, finishes ...bool) (string, error)
- func MatchInSet(cardName string, setCode string) (outCards []mtgjson.Card)
- func NewDatastore(ap mtgjson.AllPrintings)
- func Normalize(str string) string
- func ParseCommanderEdition(edition, variant string) string
- func ParsePrice(priceStr string) (float64, error)
- func Printings4Card(name string) ([]string, error)
- func Scryfall2UUID(id string) string
- func SealedContains(str1, str2 string) bool
- func SealedEquals(str1, str2 string) bool
- func SealedNormalize(str string) string
- func SearchContains(name string) ([]string, error)
- func SearchEquals(name string) ([]string, error)
- func SearchHasPrefix(name string) ([]string, error)
- func SearchRegexp(name string) ([]string, error)
- func SearchSealedContains(name string) ([]string, error)
- func SearchSealedEquals(name string) ([]string, error)
- func SetGlobalLogger(userLogger *log.Logger)
- func SkipLanguage(cardName, edition, language string) bool
- func SplitVariants(str string) []string
- func Tcg2UUID(id string) string
- func Title(str string) string
- type AliasingError
- type Card
- type CardObject
Constants ¶
const LongestCardEver = "" /* 141-byte string literal not displayed */
const NightmareCard = "The Ultimate Nightmare of Wizards of the Coast® Customer Service"
Variables ¶
var ARNGuilds = []string{"Azorius", "Gruul", "Orzhov", "Rakdos", "Simic"}
Guilds found in ARN
Date since BuyABox cards are found in the expansion set instead of Promos
Date since BuyABox cards are not unique any more
var EditionTable = map[string]string{}/* 441 elements not displayed */
var ErrAliasing = newAliasingError()
var ErrCardDoesNotExist = errors.New("unknown card name")
var ErrCardMissingVariant = errors.New("missing necessary variant")
var ErrCardNotInEdition = errors.New("unknown edition")
var ErrCardUnknownId = errors.New("unknown id")
var ErrCardWrongVariant = errors.New("unknown variant")
var ErrDatastoreEmpty = errors.New("datastore is empty")
var ErrUnsupported = errors.New("unsupported")
var GRNGuilds = []string{"Boros", "Dimir", "Golgari", "Izzet", "Selesnya"}
Guilds found in GRN
Date since any card could be Prerelease Promo
Date in which random promos can be in the expansion set
var SeparateFinishCollectorNumberDate = time.Date(2022, time.February, 1, 0, 0, 0, 0, time.UTC)
Date since different finishes (etched, gilded, thick) get separate collector numbers
var VariantsTable = map[string]map[string]map[string]string{
"Alliances": allVariants,
"Alternate Fourth Edition": ed4Variants,
"Anthologies": athVariants,
"Antiquities": atqVariants,
"Arena League 2001": pal01Variants,
"Asia Pacific Land Program": palpVariants,
"Battle Royale Box Set": brbVariants,
"Champions of Kamigawa": chkVariants,
"Chronicles Foreign Black Border": chrVariants,
"Chronicles": chrVariants,
"Collectors’ Edition": oldLandVariants,
"Commander Anthology Volume II": cm2Variants,
"Conspiracy: Take the Crown": cn2Variants,
"Deckmasters": dkmVariants,
"Dominaria United": douVariants,
"Double Masters": xm2Variants,
"European Land Program": pelpVariants,
"Fallen Empires": femVariants,
"Fifth Edition": ed5Variants,
"Foreign Black Border": ed3Variants,
"Fourth Edition Foreign Black Border": ed4Variants,
"Fourth Edition": ed4Variants,
"GRN Ravnica Weekend": prwkVariants,
"Homelands": hmlVariants,
"Ice Age": iceVariants,
"Intl. Collectors’ Edition": oldLandVariants,
"Introductory Two-Player Set": itpVariants,
"Kaldheim": khmVariants,
"Kamigawa: Neon Dynasty": neoVariants,
"League Tokens 2013": l13Variants,
"Limited Edition Alpha": leaVariants,
"Limited Edition Beta": oldLandVariants,
"Magic Premiere Shop 2005": pmpsVariants,
"Mirage": mirVariants,
"Mystery Booster Retail Edition Foils": mb1plistVariants,
"Mystery Booster": mb1plistVariants,
"Oath of the Gatewatch": ogwVariants,
"Portal Second Age": po2Variants,
"Portal": porVariants,
"Pro Tour Collector Set": ptcVariants,
"RNA Ravnica Weekend": prw2Variants,
"Revised Edition": ed3Variants,
"Rinascimento": rinVariants,
"Secret Lair Drop": sldVariants,
"Shadows over Innistrad Promos": psoiVariants,
"Shadows over Innistrad": soiVariants,
"Summer Magic / Edgar": ed3Variants,
"Tempest": tmpVariants,
"The List (Unfinity Foil Edition)": uplistVariants,
"The List": mb1plistVariants,
"Unglued": ulgVariants,
"Unlimited Edition": oldLandVariants,
"Unstable": ustVariants,
"World Championship Decks 1997": wc97Variants,
"World Championship Decks 1998": wc98Variants,
"World Championship Decks 1999": wc99Variants,
"World Championship Decks 2001": wc01Variants,
"World Championship Decks 2002": wc02Variants,
}
Functions ¶
func Cut ¶
Cut splits the input string in two segments, stripping any whitespace before or after the cut, if present.
func ExtractNumber ¶
ExtractNumber returns as lower case string with the _first_ collector number below 1993 found in a given string, or an empty string if none could be found. The input string may have a single character as prefix or up to two characters as suffix (one letter and one special character), but not both. Any extra letters will be ignored while determining the number portion, but preserved in the ouput, and returned as lowercase. Any leading # characters, zeroes or parenthesis are stripped away. Numbers starting with M are ignored because they could be confused with core set names. If a month name is detected anywhere as a single word in the input string, an empty string is returned, to prevent confusing a number with a date or day. If a rational number is provided, only the numerator part is considered.
func ExtractYear ¶
ExtractYear returns as string with _first_ year after 1993 found in a given string, or an empty string if nothing is found. It takes care of some special characters like parenthesis (ignored) and abbreviations (so '06 becomes 2006).
func GetUUIDs ¶
func GetUUIDs() map[string]CardObject
func HasBorderlessPrinting ¶
func HasEtchedPrinting ¶
func HasExtendedArtPrinting ¶
func HasFoilPrinting ¶
func HasNonfoilPrinting ¶
func HasPrereleasePrinting ¶
func HasPromoPackPrinting ¶
func HasReskinPrinting ¶
func HasRetroFramePrinting ¶
func HasShowcasePrinting ¶
func IsBasicLand ¶
Returns whether the input string may represent a basic land
func LoadDatastore ¶
func LoadDatastoreFile ¶
func MatchInSet ¶
Return an array of mtgjson.Card containing all the cards with the exact same name as the input name in the Set identified by setCode.
func NewDatastore ¶
func NewDatastore(ap mtgjson.AllPrintings)
func Normalize ¶
Normalize uses the rules defined in Replacer to replace uncommon elements of card names, dropping all the spaces and producing a lowercase string.
func ParseCommanderEdition ¶
func ParsePrice ¶
Strip input string of dollar sign and commas, convert it to a normal float
func Printings4Card ¶
func Scryfall2UUID ¶
func SealedContains ¶
func SealedEquals ¶
func SealedNormalize ¶
func SearchContains ¶
func SearchEquals ¶
func SearchHasPrefix ¶
func SearchRegexp ¶
func SearchSealedContains ¶
func SearchSealedEquals ¶
func SetGlobalLogger ¶
func SkipLanguage ¶
List of editions and specific cards supported in a non-English language
func SplitVariants ¶
SplitVariants returns an array of strings from the parentheses-defined fields commonly used to distinguish some cards across editions.
Types ¶
type AliasingError ¶
type AliasingError struct {
// contains filtered or unexported fields
}
func (*AliasingError) Error ¶
func (err *AliasingError) Error() string
func (*AliasingError) Probe ¶
func (err *AliasingError) Probe() []string
type Card ¶
type Card struct { // The mtgjson unique identifier of the card // When used as input it can host mtgjson or scryfall id Id string // The canonical name of the card Name string // The hint or commonly know variation Variation string // The set the card comes from, or a portion of it Edition string // Whether the card is foil or not Foil bool // The collector number of the card (output only) Number string // contains filtered or unexported fields }
Card is a generic card representation using fields defined by the MTGJSON project.
func (*Card) IsBasicLand ¶
Returns whether the card is a basic land
func (*Card) IsSurrounded ¶
type CardObject ¶
CardObject is an extension of mtgjson.Card, containing fields that cannot be easily represented in the original object.
func GetUUID ¶
func GetUUID(uuid string) (*CardObject, error)
func (CardObject) String ¶
func (co CardObject) String() string
Card implements the Stringer interface