Documentation
¶
Overview ¶
Package skirmish contains code for production of the Dreamkeepers: Skirmish battle card game.
More specifically, it provides an interface between the SQL database that contains card data, Photoshop, and the user (via CLI).
Index ¶
- Variables
- func Connect(host string, port int, dbname, user, sslmode string) error
- func Dump(dir string)
- func Query(query string, args ...interface{}) (*sql.Rows, error)
- func Recover(dir string)
- type Card
- type Config
- type DeckCard
- func (c *DeckCard) Bold() ([][]int, error)
- func (d *DeckCard) CSV(labels bool) [][]string
- func (c *DeckCard) Card() card
- func (d *DeckCard) Copies() int
- func (d *DeckCard) Cost() (string, error)
- func (c *DeckCard) Damage() int
- func (c *DeckCard) Faction() string
- func (c *DeckCard) Flavor() string
- func (c *DeckCard) FullType() string
- func (c *DeckCard) ID(ver int) string
- func (d *DeckCard) Images() (paths []string, err error)
- func (c *DeckCard) JSON() ([]byte, error)
- func (d *DeckCard) Labels() []string
- func (c *DeckCard) Leader() string
- func (c *DeckCard) Life() int
- func (c *DeckCard) Long() string
- func (c *DeckCard) MarshalXML() ([]byte, error)
- func (c *DeckCard) Name() string
- func (d *DeckCard) NormalBorder() bool
- func (d *DeckCard) Rarity() string
- func (c *DeckCard) Regexp() string
- func (c *DeckCard) Resolve() string
- func (c *DeckCard) STypes() []string
- func (d *DeckCard) SetCard(c Card)
- func (d *DeckCard) SetCost(c string)
- func (c *DeckCard) SetDamage(d *int)
- func (c *DeckCard) SetFlavor(s *string)
- func (c *DeckCard) SetLeader(l *string)
- func (c *DeckCard) SetLife(l *int)
- func (c *DeckCard) SetLong(s *string)
- func (c *DeckCard) SetName(name *string)
- func (d *DeckCard) SetRarity(r *int)
- func (c *DeckCard) SetRegexp(reg *string)
- func (c *DeckCard) SetResolve(r *string)
- func (c *DeckCard) SetSTypes(t []string)
- func (c *DeckCard) SetShort(s *string)
- func (c *DeckCard) SetSpeed(s *int)
- func (c *DeckCard) SetType(t *string)
- func (c *DeckCard) Short() string
- func (c *DeckCard) Speed() int
- func (d *DeckCard) String() string
- func (d *DeckCard) Type() string
- func (d DeckCard) UEJSON(ident bool) ([]byte, error)
- func (c *DeckCard) XML() ([]byte, error)
- type NonDeckCard
- func (c *NonDeckCard) Bold() ([][]int, error)
- func (n *NonDeckCard) CSV(lbls bool) [][]string
- func (c *NonDeckCard) Card() card
- func (c *NonDeckCard) Damage() int
- func (n *NonDeckCard) DamageB() int
- func (n *NonDeckCard) Faction() string
- func (c *NonDeckCard) Flavor() string
- func (c *NonDeckCard) FullType() string
- func (c *NonDeckCard) ID(ver int) string
- func (n *NonDeckCard) Images() (paths []string, err error)
- func (c *NonDeckCard) JSON() ([]byte, error)
- func (n *NonDeckCard) Labels() []string
- func (c *NonDeckCard) Leader() string
- func (c *NonDeckCard) Life() int
- func (n *NonDeckCard) LifeB() string
- func (c *NonDeckCard) Long() string
- func (c *NonDeckCard) MarshalXML() ([]byte, error)
- func (c *NonDeckCard) Name() string
- func (c *NonDeckCard) Regexp() string
- func (c *NonDeckCard) Resolve() string
- func (c *NonDeckCard) STypes() []string
- func (n *NonDeckCard) SetCard(c Card)
- func (c *NonDeckCard) SetDamage(d *int)
- func (n *NonDeckCard) SetDamageB(d *int)
- func (n *NonDeckCard) SetFaction(faction *string)
- func (c *NonDeckCard) SetFlavor(s *string)
- func (n *NonDeckCard) SetFlavorB(f *string)
- func (c *NonDeckCard) SetLeader(l *string)
- func (c *NonDeckCard) SetLife(l *int)
- func (n *NonDeckCard) SetLifeB(l *string)
- func (c *NonDeckCard) SetLong(s *string)
- func (n *NonDeckCard) SetLongB(l *string)
- func (c *NonDeckCard) SetName(name *string)
- func (c *NonDeckCard) SetRegexp(reg *string)
- func (c *NonDeckCard) SetResolve(r *string)
- func (n *NonDeckCard) SetResolveB(r *string)
- func (c *NonDeckCard) SetSTypes(t []string)
- func (c *NonDeckCard) SetShort(s *string)
- func (n *NonDeckCard) SetShortB(s *string)
- func (c *NonDeckCard) SetSpeed(s *int)
- func (n *NonDeckCard) SetSpeedB(s *int)
- func (c *NonDeckCard) SetType(t *string)
- func (c *NonDeckCard) Short() string
- func (c *NonDeckCard) Speed() int
- func (n *NonDeckCard) SpeedB() int
- func (n *NonDeckCard) StatsB() string
- func (n *NonDeckCard) String() string
- func (c *NonDeckCard) Type() string
- func (n NonDeckCard) UEJSON(ident bool) ([]byte, error)
- func (c *NonDeckCard) XML() ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
var DataDir = filepath.Join(os.Getenv("SK_SQL"))
TODO(sbrow): Move these vars to appropriate places.
var DefaultImage = filepath.Join(ImageDir, "ImageNotFound.png")
var Delim = ","
var ImageDir = filepath.Join(os.Getenv("SK_PS"), "Images")
TODO(sbrow): define elsewhere.
var Leaders leaders
Functions ¶
func Connect ¶
Connect connects to a postgreSQL database with the given options: host is the ip of the server, port is the server port, dbname is the name of the database, user is the username, and sslmode declares which ssl mode to use.
See github.com/lib/pq for more information on sslmode.
func Dump ¶
func Dump(dir string)
Dump runs pg_dump, saving the contents of the standard database to a SQL file (skirmish_db.sql) in the given directory.
TODO(sbrow): change Dump() to support path instead of dir
Types ¶
type Card ¶
type Card interface {
Card() card
Faction() string
Name() string
FullType() string
Resolve() string
STypes() []string
Speed() int
Type() string
SetDamage(*int)
SetFlavor(*string)
SetLeader(*string)
SetLife(*int)
SetLong(*string)
SetName(*string)
SetRegexp(*string)
SetResolve(*string)
SetShort(*string)
SetSpeed(*int)
SetSTypes([]string)
SetType(*string)
Damage() int
Leader() string
Life() int
Short() string
Regexp() string
Long() string
Flavor() string
Labels() []string
String() string
Images() ([]string, error)
Bold() ([][]int, error)
UEJSON(ident bool) ([]byte, error)
CSV(bool) [][]string
XML() ([]byte, error)
}
Card is an interface shared by DeckCards and NonDeckCards.
It is important to note that each Card object can represent more than one card.
- DeckCards can hold multiple cards with unique art.
- NonDeckCards can hold their frontside Card and rearside Card.
Setters ¶
The Set methods accept pointers because SQL queries return pointer values. Passing nil to a set value will generally result in no change to the Card.
TODO(sbrow): Figure out how to handle id.
TODO(sbrow): Cameo card flavor text.
func Load ¶
Load queries the standard database for a card with the given name, and returns the result as a Card object.
type Config ¶
type Config struct {
// PS holds configuration values related to Photoshop.
PS struct {
Dir string // The directory of the Photoshop files.
Deck string // The name of the Deck Card Photoshop template file.
NonDeck string `yaml:"non_deck"` // The name of the Non-Deck Card Photoshop template file.
} `yaml:"photoshop"`
// DB Holds configuration values related to the PSQL database.
DB struct {
Dir string // The default directory to call Load() and Recover() in.
Host string // The server ip address.
Port int // the server port.
Name string // The name of the database.
User string // The user name to login as.
SSL bool // Whether or not to use SSL.
} `yaml:"database"`
}
Config holds various configuration values for the program, namely the directories of other relevant git repositories.
var Cfg *Config
Cfg holds the currently loaded configuration settings.
type DeckCard ¶
type DeckCard struct {
// contains filtered or unexported fields
}
func NewDeckCard ¶
func NewDeckCard() *DeckCard
func (*DeckCard) ID ¶
ID returns an id unique to the card.
Cards with only one art will have identical ID and Name. Cards with more than one art will have an ID containing their name and which version of art they use.
func (*DeckCard) MarshalXML ¶
func (*DeckCard) NormalBorder ¶
func (*DeckCard) SetResolve ¶
func (c *DeckCard) SetResolve(r *string)
type NonDeckCard ¶
type NonDeckCard struct {
// contains filtered or unexported fields
}
TODO(sbrow): Make getters for NonDeckCard
func (*NonDeckCard) CSV ¶
func (n *NonDeckCard) CSV(lbls bool) [][]string
func (*NonDeckCard) DamageB ¶
func (n *NonDeckCard) DamageB() int
func (*NonDeckCard) Faction ¶
func (n *NonDeckCard) Faction() string
func (*NonDeckCard) ID ¶
ID returns an id unique to the card.
Cards with only one art will have identical ID and Name. Cards with more than one art will have an ID containing their name and which version of art they use.
func (*NonDeckCard) Images ¶
func (n *NonDeckCard) Images() (paths []string, err error)
func (*NonDeckCard) Labels ¶
func (n *NonDeckCard) Labels() []string
func (*NonDeckCard) LifeB ¶
func (n *NonDeckCard) LifeB() string
func (*NonDeckCard) MarshalXML ¶
func (*NonDeckCard) SetCard ¶
func (n *NonDeckCard) SetCard(c Card)
SetCard makes c the DeckCard's base card.
func (*NonDeckCard) SetDamageB ¶
func (n *NonDeckCard) SetDamageB(d *int)
func (*NonDeckCard) SetFaction ¶
func (n *NonDeckCard) SetFaction(faction *string)
func (*NonDeckCard) SetFlavorB ¶
func (n *NonDeckCard) SetFlavorB(f *string)
func (*NonDeckCard) SetLifeB ¶
func (n *NonDeckCard) SetLifeB(l *string)
func (*NonDeckCard) SetLongB ¶
func (n *NonDeckCard) SetLongB(l *string)
func (*NonDeckCard) SetResolve ¶
func (c *NonDeckCard) SetResolve(r *string)
func (*NonDeckCard) SetResolveB ¶
func (n *NonDeckCard) SetResolveB(r *string)
func (*NonDeckCard) SetShortB ¶
func (n *NonDeckCard) SetShortB(s *string)
func (*NonDeckCard) SetSpeedB ¶
func (n *NonDeckCard) SetSpeedB(s *int)
func (*NonDeckCard) SpeedB ¶
func (n *NonDeckCard) SpeedB() int
func (*NonDeckCard) StatsB ¶ added in v0.12.0
func (n *NonDeckCard) StatsB() string
func (*NonDeckCard) String ¶
func (n *NonDeckCard) String() string
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
skir
command
Skir is a tool for developing the Skirmish card game.
|
Skir is a tool for developing the Skirmish card game. |
|
skir/internal/help
Package help implements the “skir help” command.
|
Package help implements the “skir help” command. |
|
skir/internal/version
Package version implements the “go version” command.
|
Package version implements the “go version” command. |