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 AutoConnect() error
- func Connect(host string, port int, dbname, user, pass, sslmode string) error
- func Dump(path string)
- func Exec(query string, args ...interface{}) (sql.Result, error)
- func Query(query string, args ...interface{}) (*sql.Rows, error)
- func QueryRow(query string, args ...interface{}) *sql.Row
- func Recover(path string) (sql.Result, error)
- 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(enc *xml.Encoder, start xml.StartElement) 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 (c *DeckCard) Type() string
- func (d DeckCard) UEJSON(ident bool) ([]byte, error)
- func (c *DeckCard) XML() ([]byte, error)
- type Leader
- type NonDeckCard
- func (c *NonDeckCard) Bold() ([][]int, error)
- func (n *NonDeckCard) CSV(labels bool) [][]string
- func (c *NonDeckCard) Card() card
- func (c *NonDeckCard) Copies() int
- 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 (n *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 (n *NonDeckCard) LongB() string
- func (c *NonDeckCard) MarshalXML(enc *xml.Encoder, start xml.StartElement) error
- func (c *NonDeckCard) Name() string
- func (c *NonDeckCard) Regexp() string
- func (c *NonDeckCard) Resolve() string
- func (n *NonDeckCard) ResolveB() 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 (n *NonDeckCard) ShortB() 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 CfgDir string
CfgDir is the location that config files are saved to.
var DefaultImage = "ImageNotFound.png"
DefaultImage is the name of the image file to use when a card's image cannot be found.
var Delim = ","
Delim is the Delimiter to use when Marshalling cards to csv format.
var ImageDir string
ImageDir is the path to the root directory where card images are located.
var Leaders leaders
Leaders is the list of valid deck leaders.
var LocalDB = &Config{ DB: cfgDB{ Host: "localhost", Port: 5432, Name: "postgres", User: "postgres", Pass: "", SSL: false, }, }
LocalDB holds the configuration for connecting to the default, local postgres database. It is primarily used for running tests.
var Version = "undefined"
Functions ¶
func AutoConnect ¶ added in v0.19.0
func AutoConnect() error
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.
- sslmode declares which ssl mode to use.
See package github.com/lib/pq for more information on sslmode.
func Dump ¶
func Dump(path string)
Dump runs pg_dump on the connected database, saving the contents to a SQL formatted file at the given path.
func Exec ¶ added in v0.13.0
Exec executes a query on the standard database without returning any rows. The args are for any placeholder parameters in the query.
func Query ¶
Query returns the results of a query to the standard database. The args are for any placeholder parameters in the query.
Types ¶
type Card ¶
type Card interface { Card() card Faction() string ID(int) string Name() string FullType() string Resolve() string STypes() []string Speed() int Type() string Copies() int 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) MarshalXML(*xml.Encoder, xml.StartElement) 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. [Issue](https://github.com/sbrow/skirmish/issues/33)
TODO(sbrow): Cameo card flavor text. [Issue](https://github.com/sbrow/skirmish/issues/32)
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. Pass string 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: "dreamkeepers-dat" and "dreamkeepers-psd".
var Cfg *Config
Cfg holds the currently loaded configuration settings.
type DeckCard ¶
type DeckCard struct {
// contains filtered or unexported fields
}
DeckCard is a card that goes in a leader's deck.
func NewDeckCard ¶
func NewDeckCard() *DeckCard
NewDeckCard returns a pointer to a new, empty DeckCard.
func (*DeckCard) CSV ¶
CSV returns the card in CSV format. If labels is true, the first row of the output will be the contents of d.Labels().
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) Images ¶
Images returns any and all paths to Images with this card name. Multiple Images may exist to account for cameos, etc.
func (*DeckCard) Labels ¶
Labels returns the column labels to use when marshaling d into to csv format.
func (*DeckCard) MarshalXML ¶
func (*DeckCard) NormalBorder ¶
NormalBorder returns whether or not to show the normal border when applying this card to the Photoshop template.
NormalBorder will return false for any card with one of the following attributes:
- "Rare" rarity.
- "Action" card type.
- "Item" card type.
- "Continuous" super type.
func (*DeckCard) Regexp ¶
func (c *DeckCard) Regexp() string
Regexp returns the regular expression that matches bold words in the card's short text.
func (*DeckCard) SetRarity ¶
SetRarity sets the DeckCard's copies to *r. If r is nil, d remains unchanged.
func (*DeckCard) SetResolve ¶
func (c *DeckCard) SetResolve(r *string)
type Leader ¶ added in v0.14.0
type Leader struct { Name string // The Leader's name. Banner []uint8 // The leader's Banner color (in hexadecimal format). Indicator []uint8 // The leader's Indicator color (in hexadecimal format). }
Leader represents a deck leader
type NonDeckCard ¶
type NonDeckCard struct {
// contains filtered or unexported fields
}
NonDeckCard represents a Leader or Partner card.
func (*NonDeckCard) CSV ¶
func (n *NonDeckCard) CSV(labels bool) [][]string
CSV returns the card in CSV format. If labels is true, the first row of the output will be the contents of n.Labels().
func (*NonDeckCard) Copies ¶ added in v0.14.0
func (c *NonDeckCard) Copies() int
Copies returns the number of times this card appears in the game.
func (*NonDeckCard) DamageB ¶
func (n *NonDeckCard) DamageB() int
DamageB returns n's Halo side damage.
If n doesn't have a Halo side, DamageB returns 0.
func (*NonDeckCard) Faction ¶
func (n *NonDeckCard) Faction() string
Faction returns the faction that n is aligned to.
func (*NonDeckCard) ID ¶
func (n *NonDeckCard) ID(ver int) string
ID returns this card's unique identifier.
func (*NonDeckCard) Images ¶
func (n *NonDeckCard) Images() (paths []string, err error)
Images returns the path's to n's front side and Halo side images (if applicable).
func (*NonDeckCard) Labels ¶
func (n *NonDeckCard) Labels() []string
Labels returns the column labels to use when marshaling n into to csv format.
func (*NonDeckCard) LifeB ¶
func (n *NonDeckCard) LifeB() string
LifeB returns n's Halo side life.
If n doesn't have a Halo side, LifeB returns 0.
func (*NonDeckCard) LongB ¶
func (n *NonDeckCard) LongB() string
LongB returns n's Halo side long text.
If n doesn't have a Halo side, LongB returns 0.
func (*NonDeckCard) MarshalXML ¶
func (c *NonDeckCard) MarshalXML(enc *xml.Encoder, start xml.StartElement) error
func (*NonDeckCard) Regexp ¶
func (c *NonDeckCard) Regexp() string
Regexp returns the regular expression that matches bold words in the card's short text.
func (*NonDeckCard) ResolveB ¶
func (n *NonDeckCard) ResolveB() string
ResolveB returns n's Halo side Resolve.
If n doesn't have a Halo side, ResolveB returns "".
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)
SetDamageB sets n's Halo side damage to d.
If n doesn't have a Halo side, or if d is nil, SetDamageB does nothing.
func (*NonDeckCard) SetFaction ¶
func (n *NonDeckCard) SetFaction(faction *string)
SetFaction sets n's Faction to faction.SetFaction
If faction is nil, n is not changed.
func (*NonDeckCard) SetFlavorB ¶
func (n *NonDeckCard) SetFlavorB(f *string)
SetFlavorB sets n's Halo side flavor to f.
If n doesn't have a Halo side, or if f is nil, SetFlavorB does nothing.
func (*NonDeckCard) SetLifeB ¶
func (n *NonDeckCard) SetLifeB(l *string)
SetLifeB sets n's Halo side life to l.
If n doesn't have a Halo side, or if l is nil, SetLifeB does nothing.
func (*NonDeckCard) SetLongB ¶
func (n *NonDeckCard) SetLongB(l *string)
SetLongB sets n's Halo side long text to l.
If n doesn't have a Halo side, or if l is nil, SetLongB does nothing.
func (*NonDeckCard) SetResolve ¶
func (c *NonDeckCard) SetResolve(r *string)
func (*NonDeckCard) SetResolveB ¶
func (n *NonDeckCard) SetResolveB(r *string)
SetResolveB sets n's Halo side resolve to r.
If n doesn't have a Halo side, or if r is nil, SetResolveB does nothing.
func (*NonDeckCard) SetShortB ¶
func (n *NonDeckCard) SetShortB(s *string)
SetShortB sets n's Halo side short text to s.
If n doesn't have a Halo side, or if s is nil, SetShortB does nothing.
func (*NonDeckCard) SetSpeedB ¶
func (n *NonDeckCard) SetSpeedB(s *int)
SetSpeedB sets n's Halo side speed to s.
If n doesn't have a Halo side, or if s is nil, SetDamageB does nothing.
func (*NonDeckCard) ShortB ¶
func (n *NonDeckCard) ShortB() string
ShortB returns n's Halo side short text.
If n doesn't have a Halo side, ShortB returns 0.
func (*NonDeckCard) SpeedB ¶
func (n *NonDeckCard) SpeedB() int
SpeedB returns n's Halo side speed.
If n doesn't have a Halo side, SpeedB returns 0.
func (*NonDeckCard) StatsB ¶ added in v0.12.0
func (n *NonDeckCard) StatsB() string
StatsB returns the string representation of n's Halo side stats.
If n doesn't have a Halo side, an empty string is returned.
func (*NonDeckCard) String ¶
func (n *NonDeckCard) String() string
String returns the string representation of n.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package ps fills in Photoshop templates with Card information.DeckTemplate ps acts as a bridge between github.com/sbrow/skirmish and github.com/sbrow/ps, allowing the user to fill out Photoshop templates with Card data pulled from an SQL database.
|
Package ps fills in Photoshop templates with Card information.DeckTemplate ps acts as a bridge between github.com/sbrow/skirmish and github.com/sbrow/ps, allowing the user to fill out Photoshop templates with Card data pulled from an SQL database. |
Skir is a tool for developing the Skirmish card game.
|
Skir is a tool for developing the Skirmish card game. |
internal/help
Package help implements the “skir help” command.
|
Package help implements the “skir help” command. |
internal/version
Package version implements the “go version” command.
|
Package version implements the “go version” command. |
internal/xml
Package xml is a test package
|
Package xml is a test package |