data

package
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ImagePathToURL added in v1.3.0

func ImagePathToURL(cardType, imageName string) string

Types

type ArchivesClient

type ArchivesClient struct {
	// contains filtered or unexported fields
}

ArchivesClient handles communication to the Archives

func NewArchivesClient

func NewArchivesClient(url string) ArchivesClient

NewArchivesClient creates and returns a new ArchivesClient

func (*ArchivesClient) GetCommandCards

func (client *ArchivesClient) GetCommandCards(field, term string) []CommandCard

GetCommandCards get the command cards from the archives

func (*ArchivesClient) GetKeywords

func (client *ArchivesClient) GetKeywords(field, term string) []Keyword

GetKeywords gets the keywords from the archives

func (*ArchivesClient) GetUnits

func (client *ArchivesClient) GetUnits(field, term string) []Unit

GetUnits gets the unit cards from the archives

func (*ArchivesClient) GetUpgrades

func (client *ArchivesClient) GetUpgrades(field, term string) []Upgrade

GetUpgrades get the upgrade cards from the archives

type CommandCard

type CommandCard struct {
	Name         string   `json:"name"`
	Image        string   `json:"image"`
	Requirements []string `json:"requirements"`
	Faction      string   `json:"faction"`
	Keywords     []string `json:"keywords"`
	Pips         int      `json:"pips"`
	Commander    string   `json:"commander"`
	Orders       string   `json:"orders"`
	Weapon       *Weapon  `json:"weapon,omitempty"`
	Text         string   `json:"text,omitempty"`
}

func CardToCommand added in v1.3.0

func CardToCommand(card *legionhq.Card, extCard *legiondata.CommandCard) CommandCard

type Dice

type Dice struct {
	Black int `json:"black,omitempty"`
	Red   int `json:"red,omitempty"`
	White int `json:"white,omitempty"`
}

func (*Dice) String

func (dice *Dice) String() string

type InMemoryClient added in v1.3.0

type InMemoryClient struct {
	// contains filtered or unexported fields
}

func (*InMemoryClient) CommandCards added in v1.3.0

func (c *InMemoryClient) CommandCards(field, term string) ([]CommandCard, error)

CommandCards returns all data with cardType: command where the field and term matches

func (*InMemoryClient) ExtCommandCard added in v1.3.0

func (c *InMemoryClient) ExtCommandCard(name string) (*legiondata.CommandCard, error)

func (*InMemoryClient) ExtUnit added in v1.3.0

func (c *InMemoryClient) ExtUnit(name, rank string) (*legiondata.Unit, error)

func (*InMemoryClient) ExtUpgrade added in v1.3.0

func (c *InMemoryClient) ExtUpgrade(name string) (*legiondata.Upgrade, error)

func (*InMemoryClient) FetchAllData added in v1.3.0

func (c *InMemoryClient) FetchAllData()

func (*InMemoryClient) GetKeywords added in v1.3.0

func (c *InMemoryClient) GetKeywords(nameIn string) ([]Keyword, error)

Keywords returns a slice of keywords

func (*InMemoryClient) UnitCards added in v1.3.0

func (c *InMemoryClient) UnitCards(field, term string) ([]Unit, error)

UnitCards returns all data with cardType: unit where the field and term matches

func (*InMemoryClient) UpgradeCards added in v1.3.0

func (c *InMemoryClient) UpgradeCards(field, term string) ([]Upgrade, error)

UpgradeCards returns all data with cardType: upgrade

type Keyword

type Keyword struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

Keyword is a Legion keyword

type Range

type Range struct {
	From int `json:"from"`
	To   int `json:"to"`
}

type Surge

type Surge struct {
	Attack  string `json:"attack,omitempty"`
	Defense string `json:"defense,omitempty"`
}

func (*Surge) String

func (surge *Surge) String() string

type Unit

type Unit struct {
	Name         string        `json:"name"`
	Image        string        `json:"image"`
	Requirements []string      `json:"requirements"`
	Faction      string        `json:"faction"`
	Keywords     []string      `json:"keywords"`
	Unique       bool          `json:"unique"`
	Cost         int           `json:"cost"`
	Rank         string        `json:"rank"`
	Slots        []string      `json:"slots"`
	CommandCards []CommandCard `json:"commandCards"`
	Wounds       int           `json:"wounds"`
	Courage      *int          `json:"courage,omitempty"`
	Resilience   *int          `json:"resilience,omitempty"`
	Defense      string        `json:"defense"`
	Entourage    []string      `json:"entourage"`
	Surge        *Surge        `json:"surge,omitempty"`
	Weapons      []Weapon      `json:"weapons"`
	Type         string        `json:"cardSubType" graphql:"cardSubType"`
}

Unit is a standard Legion Unit

func CardToUnit added in v1.3.0

func CardToUnit(card *legionhq.Card, extUnit *legiondata.Unit) Unit

CardToUnit converts a legionhq card into a Unit

func (*Unit) FullName

func (unit *Unit) FullName() string

type Upgrade

type Upgrade struct {
	Name               string   `json:"name"`
	Text               string   `json:"text"`
	Type               string   `json:"type" graphql:"cardSubType"`
	Image              string   `json:"image"`
	Requirements       []string `json:"requirements"`
	Keywords           []string `json:"keywords"`
	Cost               int      `json:"cost"`
	Exhaust            bool     `json:"exhaust"`
	Weapon             *Weapon  `json:"weapon"`
	UnitTypeExclusions []string `json:"unitTypeExclusions"`
	Unique             bool     `json:"unique"`
}

func CardToUpgrade added in v1.3.0

func CardToUpgrade(card *legionhq.Card, extUpgrade *legiondata.Upgrade) Upgrade

func (*Upgrade) FullName

func (upgrade *Upgrade) FullName() string

type Weapon

type Weapon struct {
	Name     string   `json:"name,omitempty"`
	Range    Range    `json:"range"`
	Dice     Dice     `json:"dice"`
	Surge    *Surge   `json:"surge,omitempty"`
	Keywords []string `json:"keywords"`
}

func (*Weapon) String

func (weapon *Weapon) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL