Documentation ¶
Index ¶
- Variables
- func BlockPacks(block BlockID) (draft.PackProvider, error)
- func CleanSetCache()
- func LoadAllSets() error
- func LoadSetData(sets map[SetID][]byte) error
- func ToDraft(cards []Card) []draft.Card
- type BlockID
- type Card
- type I8PCube
- type I8PPool
- type I8PSchema
- type I8PSchemaSlot
- type I8PSet
- type I8PType
- type PowerRequirement
- type Rarity
- type Set
- type SetID
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidCardID = errors.New("invalid card id") ErrCardNotFound = errors.New("card not found in their set") )
Errors involving loading cards
var (
ErrSetNotLoaded = errors.New("set not loaded")
)
Errors
var HTTPClient = http.DefaultClient
HTTPClient is the HTTP client used in LoadSetHTTP
var HTTPSource = "https://mcg.zyg.ovh/setdata/"
HTTPSource is the base URL for fetching sets remotely via HTTP
Functions ¶
func BlockPacks ¶
func BlockPacks(block BlockID) (draft.PackProvider, error)
BlockPacks returns a pack provider for a block draft
func LoadAllSets ¶ added in v0.0.4
func LoadAllSets() error
LoadAllSets just loads all sets from the web
Types ¶
type Card ¶
type Card struct { ID string Name string Subname string Element []string Keywords []string Traits []string Requirement PowerRequirement `json:",omitempty"` Cost *int `json:",omitempty"` Power *int `json:",omitempty"` Type string Text string Rarity Rarity ProblemBonus *int `json:",omitempty"` ProblemOpponentPower int `json:",omitempty"` ProblemRequirement PowerRequirement `json:",omitempty"` Boosted *Card `json:",omitempty"` }
Card is a single MLP:CCG card in a set
func LoadCardList ¶ added in v0.0.2
LoadCardList loads cards from sets, fetching them from HTTP if needed/wanted
func (Card) ToDraftCard ¶
ToDraftCard converts cards to draft.Card
type I8PCube ¶
I8PCube is a cube that uses I8Pages' pack schema. I8Pages' cube uses different kinds of packs, so a single schema is not possible. Therefore, I8PCube itself is not a valid set, but contains two valid sets for both types of packs (main deck / problems)
Infos on I8Pages' cube: https://docs.google.com/spreadsheets/d/1Ufz4QLwLCZ1vLemAhE6cuAmu2lq_VAN7RhLO9p1opNQ
func MakeI8PCube ¶
MakeI8PCube takes an organized set of cards and sorts them into a draftable I8PCube
func (*I8PCube) PackProvider ¶
func (c *I8PCube) PackProvider(mainPacks, problemPacks int) draft.PackProvider
PackProvider returns a PackProvider for a given number of main and problem packs
type I8PSchema ¶
type I8PSchema []I8PSchemaSlot
I8PSchema is a schema to seed a single I8PCube pack
func DefaultI8PSchema ¶
func DefaultI8PSchema() I8PSchema
DefaultI8PSchema returns I8Pages' schema as specified in his docs
type I8PSchemaSlot ¶
I8PSchemaSlot is a single slot of a I8PSchema
type I8PSet ¶
type I8PSet struct { Cards I8PPool Schema draft.PackSchema }
I8PSet is one of the sets of packs contained in a I8PCube
func (*I8PSet) PackSchema ¶
func (s *I8PSet) PackSchema() draft.PackSchema
PackSchema returns the pack schema for building packs from a I8PCube
func (*I8PSet) ProviderByType ¶
func (s *I8PSet) ProviderByType(typ I8PType) draft.CardProvider
ProviderByType provides cards from a specified category
func (*I8PSet) ProviderOther ¶
func (s *I8PSet) ProviderOther() draft.CardProvider
ProviderOther picks a random card for any available set (except Problems)
type I8PType ¶
type I8PType string
I8PType is a category of cards to be seeded into packs
const ( I8PTypeBlue I8PType = "blue" I8PTypeOrange I8PType = "orange" I8PTypePink I8PType = "pink" I8PTypePurple I8PType = "purple" I8PTypeWhite I8PType = "white" I8PTypeYellow I8PType = "yellow" I8PTypeNone I8PType = "none" I8PTypeMulti I8PType = "multi" I8PTypeEntry I8PType = "entry" I8PTypeProblem I8PType = "problem" // Special types I8PTypeAll I8PType = "all" // all means "from any other non-problem type" )
All types used for seeding packs
type PowerRequirement ¶
PowerRequirement denotes one or more power requirements, colored or not
type Set ¶
Set is a set/expansion of MLP:CCG
func LoadSetBytes ¶
LoadSetBytes loads a set with a specified ID from JSON
func LoadSetHTTP ¶
LoadSetHTTP loads a set using MCG's remote server
func LoadSetMemory ¶
LoadSetMemory loads a set from memory (must have been previously loaded with LoadSetData or other functions)
func (*Set) PackSchema ¶
func (set *Set) PackSchema() draft.PackSchema
PackSchema returns the pack schema from a booster box for a specific set
func (*Set) ProviderByRarity ¶
func (set *Set) ProviderByRarity(rarity Rarity) draft.CardProvider
ProviderByRarity returns a provider for a given rarity level from a given set
type SetID ¶
type SetID string
SetID denotes a card's set
const ( SetPremiere SetID = "PR" SetCanterlotNights SetID = "CN" SetRockNRave SetID = "RR" SetCelestialSolstice SetID = "CS" SetCrystalGames SetID = "CG" SetAbsoluteDiscord SetID = "AD" SetEquestrialOdysseys SetID = "EO" SetHighMagic SetID = "HM" SetMarksInTime SetID = "MT" SetDefendersOfEquestria SetID = "DE" SetSeaquestriaBeyond SetID = "SB" SetFriendsForever SetID = "FF" SetPromo SetID = "Promo" )
All sets