Version: v0.0.0-...-ba6ee8b Latest Latest

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

Go to latest
Published: Sep 9, 2020 License: MIT Imports: 10 Imported by: 0




This section is empty.


View Source
var BuyABoxInExpansionSetsDate = time.Date(2018, time.April, 1, 0, 0, 0, 0, time.UTC)

Date since BuyABox cards are found in the expansion set instead of Promos

View Source
var EditionTable = map[string]string{}/* 392 elements not displayed */
View Source
var ErrAliasing = newAliasingError()
View Source
var ErrCardDoesNotExist = errors.New("unknown card name")
View Source
var ErrCardNotInEdition = errors.New("unknown edition")
View Source
var ErrCardUnknownId = errors.New("unknown id")
View Source
var ErrCardWrongVariant = errors.New("unknown variant")
View Source
var ErrDatastoreEmpty = errors.New("datastore is empty")
View Source
var NewPrereleaseDate = time.Date(2014, time.September, 1, 0, 0, 0, 0, time.UTC)

Date since any card could be Prerelease Promo

View Source
var PromosForEverybodyYay = time.Date(2019, time.October, 1, 0, 0, 0, 0, time.UTC)

Date in which random promos can be in the expansion set

View Source
var VariantsTable = map[string]map[string]map[string]string{
	"Alliances":                     allVariants,
	"Anthologies":                   athVariants,
	"Antiquities":                   atqVariants,
	"Arena League 2001":             pal01Variants,
	"Asia Pacific Land Program":     palpVariants,
	"Battle Royale Box Set":         brbVariants,
	"Champions of Kamigawa":         chkVariants,
	"Chronicles":                    chrVariants,
	"Collectors’ Edition":           oldLandVariants,
	"Commander Anthology Volume II": cm2Variants,
	"Conspiracy: Take the Crown":    cn2Variants,
	"Deckmasters":                   dkmVariants,
	"Fallen Empires":                femVariants,
	"Fifth Edition":                 ed5Variants,
	"Fourth Edition":                ed4Variants,
	"GRN Ravnica Weekend":           prwkVariants,
	"Homelands":                     hmlVariants,
	"Ice Age":                       iceVariants,
	"Intl. Collectors’ Edition":     oldLandVariants,
	"Introductory Two-Player Set":   itpVariants,
	"Limited Edition Alpha":         leaVariants,
	"Limited Edition Beta":          oldLandVariants,
	"Magic Premiere Shop 2005":      pmpsVariants,
	"Mirage":                        mirVariants,
	"Oath of the Gatewatch":         ogwVariants,
	"Portal Second Age":             po2Variants,
	"Portal":                        porVariants,
	"Pro Tour Collector Set":        ptcVariants,
	"Rinascimento":                  rinVariants,
	"RNA Ravnica Weekend":           prw2Variants,
	"Revised Edition":               ed3Variants,
	"Secret Lair Drop":              sldVariants,
	"Shadows over Innistrad Promos": psoiVariants,
	"Shadows over Innistrad":        soiVariants,
	"Tempest":                       tmpVariants,
	"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,


func Contains

func Contains(str1, str2 string) bool

Check if str1 contains str2 after both are Normalize-d.

func Cut

func Cut(in, tag string) []string

Cut splits the input string in two segments, stripping any whitespace before or after the cut, if present.

func Equals

func Equals(str1, str2 string) bool

Compare strings after both are Normalize-d.

func ExtractNumber

func ExtractNumber(str string) string

ExtractNumber returns as string with _first_ 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 suffix (but not both), which will be ignored while determining the number portion, but preserved, in lowercase if suffix, or as-is if prefix. Any leading # characters 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 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

func ExtractYear(str string) string

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 GetSets

func GetSets() map[string]mtgjson.Set

func GetUUIDs

func GetUUIDs() map[string]cardobject

func HasPrefix

func HasPrefix(str1, str2 string) bool

Check if str2 is the prefix of str1 after both are Normalize-d.

func HasPromoPackPrinting

func HasPromoPackPrinting(name string) bool

func IsBasicLand

func IsBasicLand(name string) bool

Returns whether the input string may represent a basic land

func LoadDatastore

func LoadDatastore(reader io.Reader) error

func Match

func Match(inCard *Card) (cardId string, err error)

func NewDatastore

func NewDatastore(ap mtgjson.AllPrintings)

func Normalize

func Normalize(str string) string

Normalize uses the rules defined in Replacer to replace uncommon elements of card names, dropping all the spaces and producing a lowercase string.

func SetGlobalLogger

func SetGlobalLogger(userLogger *log.Logger)

func SplitVariants

func SplitVariants(str string) []string

SplitVariants returns an array of strings from the parentheses-defined fields commonly used to distinguish some cards across editions.


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

Card is a generic card representation using fields defined by the MTGJSON project.

func Unmatch

func Unmatch(cardId string) (*Card, error)

func (*Card) IsBasicLand

func (c *Card) IsBasicLand() bool

Returns whether the card is a basic land

func (*Card) String

func (c *Card) String() string

Card implements the Stringer interface


Path Synopsis

Jump to

Keyboard shortcuts

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