Documentation
¶
Index ¶
- Constants
- Variables
- func AllPromoTypes() []string
- func BoosterGen(setCode, boosterType string) ([]string, error)
- 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 GCD(a, b int) int
- func GetDecklist(setCode, sealedUUID string) ([]string, error)
- func GetPicksForDeck(setCode, deckName string) ([]string, error)
- func GetPicksForSealed(setCode, sealedUUID string) ([]string, error)
- 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() []string
- func HasBorderlessPrinting(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 HasSerializedPrinting(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 LCM(a, b int) int
- 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 MatchInSetNumber(cardName, setCode, number string) (outCards []mtgjson.Card)
- func MatchWithNumber(cardName, setCode, number 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 SealedHasDecklist(setCode, sealedUUID string) bool
- func SealedIsRandom(setCode, sealedUUID string) bool
- func SealedNormalize(str string) string
- func SealedWithinSealed(setCode, sealedUUID 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 SplitVariants(str string) []string
- func Tcg2UUID(id string) string
- func Title(str string) string
- type AliasingError
- type Card
- type CardObject
- type ProductProbabilities
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{}/* 454 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 ErrEditionNoBoosterSheet = errors.New("edition has no booster sheet information")
var ErrEditionNoSealed = errors.New("edition has no sealed information")
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,
"Murders at Karlov Manor": mkmVariants,
"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,
"Special Guests": spgVariants,
"Summer Magic / Edgar": ed3Variants,
"Tales of Middle-earth Commander": ltcVariants,
"Tempest": tmpVariants,
"The List": plstVariants,
"The List (Unfinity Foil Edition)": ulstVariants,
"The Lost Caverns of Ixalan": lciVariants,
"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 AllPromoTypes ¶ added in v0.4.3
func AllPromoTypes() []string
func BoosterGen ¶ added in v0.3.15
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 GetDecklist ¶ added in v0.4.8
func GetPicksForDeck ¶ added in v0.3.25
func GetPicksForSealed ¶ added in v0.3.25
func HasBorderlessPrinting ¶
func HasEtchedPrinting ¶
func HasExtendedArtPrinting ¶
func HasFoilPrinting ¶
func HasNonfoilPrinting ¶
func HasPrereleasePrinting ¶
func HasPromoPackPrinting ¶
func HasReskinPrinting ¶
func HasRetroFramePrinting ¶
func HasSerializedPrinting ¶ added in v0.4.3
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 MatchInSetNumber ¶ added in v0.4.2
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 with the specified collector number.
func MatchWithNumber ¶ added in v0.4.15
Return an array of mtgjson.Card containing all the cards with the exact set code and collector number, using the name as hint (can be empty)
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 SealedHasDecklist ¶ added in v0.3.42
func SealedIsRandom ¶ added in v0.3.33
func SealedNormalize ¶
func SealedWithinSealed ¶ added in v0.3.29
Return a list of sealed products contained by the input product Decks and Packs and Card cannot contain other sealed product, so they are ignored here
func SearchContains ¶
func SearchEquals ¶
func SearchHasPrefix ¶
func SearchRegexp ¶
func SearchSealedContains ¶
func SearchSealedEquals ¶
func SetGlobalLogger ¶
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 `json:"id,omitempty"` // The canonical name of the card Name string `json:"name,omitempty"` // The hint or commonly know variation Variation string `json:"variant,omitempty"` // The set the card comes from, or a portion of it Edition string `json:"edition,omitempty"` // Whether the card is foil or not Foil bool `json:"foil,omitempty"` // The language as parsed Language string `json:"language,omitempty"` // 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
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
type ProductProbabilities ¶ added in v0.4.4
func GetProbabilitiesForSealed ¶ added in v0.4.4
func GetProbabilitiesForSealed(setCode, sealedUUID string) ([]ProductProbabilities, error)
func SealedBoosterProbabilities ¶ added in v0.4.4
func SealedBoosterProbabilities(setCode, boosterType string) ([]ProductProbabilities, error)
func SealedSheetProbabilities ¶ added in v0.4.4
func SealedSheetProbabilities(setCode, boosterType, sheetName string) ([]ProductProbabilities, error)