Documentation ¶
Index ¶
- Constants
- func CapitalizeString(s string) string
- func CapitalizeStrings(s []string) []string
- func CheckInvalidFolderName(folderPath string) bool
- func IndexOf(element string, data []string) int
- func UncapitalizeString(s string) string
- type Back
- type CardInfo
- type CardSize
- type Deck
- type DeckType
- type FileHandler
- type Option
- type OptionType
- type Options
- type Plugin
- type Template
- type TemplateInfo
- type URLHandler
Constants ¶
const DefaultBackKey = "default"
DefaultBackKey if the key use for the default card back in Plugin.AvailableBacks.
Variables ¶
This section is empty.
Functions ¶
func CapitalizeString ¶
CapitalizeString puts the first letter of a string in uppercase.
func CapitalizeStrings ¶
CapitalizeStrings puts the first letter of each string in a slice in uppercase.
func CheckInvalidFolderName ¶
CheckInvalidFolderName checks whether the given path can be safely created on all platforms. Since the Tabletop Simulator save files can be shared with Steam Cloud on Windows, make sure that even the folders created on Linux or OS X are also valid on Windows.
func UncapitalizeString ¶
UncapitalizeString puts the first letter of a string in lowercase.
Types ¶
type Back ¶
type Back struct { // URL of the card back. URL string // Description of the card back. Description string }
Back represents the back of a card.
type CardInfo ¶
type CardInfo struct { // Name of the card Name string // Description of the card Description string // ImageURL is the URL of the card image ImageURL string // Count is the amount of this card in the current deck Count int // AlternativeState is used for double-faced cards (transforms and melds // in Magic). The back of the card will be represented as a second state // of the card object. AlternativeState *CardInfo // Oversized card // Used for plane, scheme or meld results in MTG Oversized bool }
CardInfo contains the information about a card used to build a TTS deck.
type Deck ¶
type Deck struct { Name string Cards []CardInfo BackURL string TemplateInfo *TemplateInfo CardSize CardSize Rounded bool ThumbnailURL string }
Deck contains the information about a deck used to build it in TTS.
type DeckType ¶
type DeckType struct { FileHandler FileHandler Example string }
DeckType contains a file handler and an example for a deck type.
type FileHandler ¶
FileHandler is a function used to parse a deck file for a specific file extension.
type Option ¶
type Option struct { // Type of the option. Type OptionType // Description of the option. Description string // DefaultValue is the value the option is set to if no value is provided // by the user. DefaultValue interface{} // AllowedValues should only be set when Type is OptionTypeEnum AllowedValues []string }
Option of a deckconverter plugin.
type OptionType ¶
type OptionType int
OptionType is the type of a plugin option.
const ( // OptionTypeEnum represents an option which has a list of possible values. OptionTypeEnum OptionType = iota // OptionTypeBool represents a boolean option. OptionTypeBool // OptionTypeInt represents an integer option. OptionTypeInt )
func (OptionType) String ¶
func (ot OptionType) String() string
String representation of an OptionType.
type Plugin ¶
type Plugin interface { // PluginID returns the ID of the plugin. PluginID() string // PluginName returns the name of the plugin. PluginName() string // URLHandlers returns the list of URLs supported by the plugin and their // parsing functions. URLHandlers() []URLHandler // FileExtHandlers returns the list of file extensions supported by the // plugins and their parsing functions. FileExtHandlers() map[string]FileHandler // FileExtHandlers returns the list of deck formats supported by the // plugins and their parsing functions. DeckTypeHandlers() map[string]DeckType // GenericFileHandler returns the default file handler for the plugin. GenericFileHandler() DeckType // AvailableOptions returns the list of options that can be set for the // plugin. AvailableOptions() Options // AvailableBacks lists the default card backs available for the plugin. AvailableBacks() map[string]Back }
Plugin represents a deckconverted plugin.
type Template ¶
Template represents a TTS file template. See https://berserk-games.com/knowledgebase/custom-decks/.
type TemplateInfo ¶
type TemplateInfo struct { // ImageURLCardIDMap is a map between card image URLs and card IDs. ImageURLCardIDMap map[string]int // Templates is a map of template ID to template. Templates map[int]*Template }
TemplateInfo maps card image URLs to templates.
func (*TemplateInfo) GetAssociatedTemplate ¶
func (t *TemplateInfo) GetAssociatedTemplate(cardID int) (*Template, int, error)
GetAssociatedTemplate returns the template containing the image of the supplied card ID.
type URLHandler ¶
type URLHandler struct { // BasePath is the main page of the supported website. BasePath string // Regex used to recognize supported URLs. Regex *regexp.Regexp // Handler function used to parse the deck. Handler func(string, map[string]string) ([]*Deck, error) }
URLHandler contains the information and function used for parsing a deck located at an URL.