Documentation ¶
Index ¶
- Constants
- Variables
- func AssertAttackCommandRequired(obj AttackCommand) error
- func AssertCombatRequired(obj Combat) error
- func AssertCommandRequired(obj Command) error
- func AssertConstructCommandRequired(obj ConstructCommand) error
- func AssertCredentialsRequired(obj Credentials) error
- func AssertCurrentTickRequired(obj CurrentTick) error
- func AssertDataReportsRequired(obj DataReports) error
- func AssertDataRequired(obj Data) error
- func AssertDecommissionCommandRequired(obj DecommissionCommand) error
- func AssertDestinationRequired(obj Destination) error
- func AssertEndTurnRequired(obj EndTurn) error
- func AssertErrorRequired(obj Error) error
- func AssertMoveCommandRequired(obj MoveCommand) error
- func AssertNetWorthRequired(obj NetWorth) error
- func AssertPlanetRequired(obj Planet) error
- func AssertPlayerIdRequired(obj PlayerId) error
- func AssertPlayerRequired(obj Player) error
- func AssertProfilingRequired(obj Profiling) error
- func AssertRecurseAttackCommandRequired(objSlice interface{}) error
- func AssertRecurseCombatRequired(objSlice interface{}) error
- func AssertRecurseCommandRequired(objSlice interface{}) error
- func AssertRecurseConstructCommandRequired(objSlice interface{}) error
- func AssertRecurseCredentialsRequired(objSlice interface{}) error
- func AssertRecurseCurrentTickRequired(objSlice interface{}) error
- func AssertRecurseDataReportsRequired(objSlice interface{}) error
- func AssertRecurseDataRequired(objSlice interface{}) error
- func AssertRecurseDecommissionCommandRequired(objSlice interface{}) error
- func AssertRecurseDestinationRequired(objSlice interface{}) error
- func AssertRecurseEndTurnRequired(objSlice interface{}) error
- func AssertRecurseErrorRequired(objSlice interface{}) error
- func AssertRecurseInterfaceRequired(obj interface{}, callback func(interface{}) error) error
- func AssertRecurseMoveCommandRequired(objSlice interface{}) error
- func AssertRecurseNetWorthRequired(objSlice interface{}) error
- func AssertRecursePlanetRequired(objSlice interface{}) error
- func AssertRecursePlayerIdRequired(objSlice interface{}) error
- func AssertRecursePlayerRequired(objSlice interface{}) error
- func AssertRecurseProfilingRequired(objSlice interface{}) error
- func AssertRecurseRenameCommandRequired(objSlice interface{}) error
- func AssertRecurseRepairCommandRequired(objSlice interface{}) error
- func AssertRecurseReportsRequired(objSlice interface{}) error
- func AssertRecurseResourceRequired(objSlice interface{}) error
- func AssertRecurseScoreValueRequired(objSlice interface{}) error
- func AssertRecurseShipClassRequired(objSlice interface{}) error
- func AssertRecurseShipRequired(objSlice interface{}) error
- func AssertRecurseStaticDataRequired(objSlice interface{}) error
- func AssertRecurseTradeCommandRequired(objSlice interface{}) error
- func AssertRecurseTradeRequired(objSlice interface{}) error
- func AssertRecurseTradingResourceAllOfRequired(objSlice interface{}) error
- func AssertRecurseTradingResourceRequired(objSlice interface{}) error
- func AssertRecurseValueRequired(value reflect.Value, callback func(interface{}) error) error
- func AssertRecurseWreckRequired(objSlice interface{}) error
- func AssertRenameCommandRequired(obj RenameCommand) error
- func AssertRepairCommandRequired(obj RepairCommand) error
- func AssertReportsRequired(obj Reports) error
- func AssertResourceRequired(obj Resource) error
- func AssertScoreValueRequired(obj ScoreValue) error
- func AssertShipClassRequired(obj ShipClass) error
- func AssertShipRequired(obj Ship) error
- func AssertStaticDataRequired(obj StaticData) error
- func AssertTradeCommandRequired(obj TradeCommand) error
- func AssertTradeRequired(obj Trade) error
- func AssertTradingResourceAllOfRequired(obj TradingResourceAllOf) error
- func AssertTradingResourceRequired(obj TradingResource) error
- func AssertWreckRequired(obj Wreck) error
- func HashPassword(password string) (string, error)
- func IsPasswordValid(hash string, pass string) error
- func IsZeroValue(val interface{}) bool
- func MaybeGetLoggedPlayerId(req *http.Request, sessionManager sessions.Store) *string
- func ParseCommands(s string) (map[string]Command, error)
- func SeasonChanged(game *Game, req *http.Request, sessionManager sessions.Store) bool
- type AttackCommand
- type Combat
- type Command
- type ConstructCommand
- type Credentials
- type CurrentTick
- type Data
- type DataReports
- type DecommissionCommand
- type Destination
- type EndTurn
- type Error
- type Game
- func (game *Game) CreatePlayersForUsers() error
- func (game *Game) CreateWaypointFromCoordinates(c []int64) (string, error)
- func (game *Game) DetermineTarget(d Destination) (string, error)
- func (game *Game) EndTurn(userExpectations EndTurn) CurrentTick
- func (game *Game) GetData(playerId *string) (Data, error)
- func (game *Game) GetGameTickState() CurrentTick
- func (game *Game) GetHistoricStaticData(season int) (string, error)
- func (game *Game) GetHistoryData(season int64, tick int64, playerId *string) (Data, error)
- func (game *Game) GetHistoryReports(season int64, tick int64) (Reports, error)
- func (game *Game) GetPlanets(resources *map[int]map[string]*TradingResource) (map[string]Planet, error)
- func (game *Game) GetShips(playerId *string, resources *map[int]map[string]*TradingResource) (map[string]Ship, error)
- func (game *Game) GetWrecks() (map[string]Wreck, error)
- func (game *Game) Init() error
- func (game *Game) MainLoop(ctx context.Context, wg *sync.WaitGroup)
- func (game *Game) NextSeason()
- func (game *Game) ProcessCommands(commands map[string]Command, user LoggedUser) (map[string]string, error)
- func (game *Game) SetResourceNames() error
- func (game *Game) SetShipClasses() error
- type ImplResponse
- type LoggedUser
- type MoveCommand
- type NetWorth
- type Planet
- type Player
- type PlayerId
- type Profiling
- type RenameCommand
- type RepairCommand
- type Reports
- type RequiredError
- type Resource
- type ScoreValue
- type Ship
- type ShipClass
- type StaticData
- type Trade
- type TradeCommand
- type TradingResource
- type TradingResourceAllOf
- type Wreck
Constants ¶
const PlayerIdField = "playerId"
const SeasonField = "season"
const SessionKey = "SESSION_ID"
const TickDuration = time.Second
const UsernameField = "username"
Variables ¶
var ( // ErrTypeAssertionError is thrown when type an interface does not match the asserted type ErrTypeAssertionError = errors.New("unable to assert type") )
Functions ¶
func AssertAttackCommandRequired ¶
func AssertAttackCommandRequired(obj AttackCommand) error
AssertAttackCommandRequired checks if the required fields are not zero-ed
func AssertCombatRequired ¶
AssertCombatRequired checks if the required fields are not zero-ed
func AssertCommandRequired ¶
AssertCommandRequired checks if the required fields are not zero-ed
func AssertConstructCommandRequired ¶
func AssertConstructCommandRequired(obj ConstructCommand) error
AssertConstructCommandRequired checks if the required fields are not zero-ed
func AssertCredentialsRequired ¶
func AssertCredentialsRequired(obj Credentials) error
AssertCredentialsRequired checks if the required fields are not zero-ed
func AssertCurrentTickRequired ¶
func AssertCurrentTickRequired(obj CurrentTick) error
AssertCurrentTickRequired checks if the required fields are not zero-ed
func AssertDataReportsRequired ¶
func AssertDataReportsRequired(obj DataReports) error
AssertDataReportsRequired checks if the required fields are not zero-ed
func AssertDataRequired ¶
AssertDataRequired checks if the required fields are not zero-ed
func AssertDecommissionCommandRequired ¶
func AssertDecommissionCommandRequired(obj DecommissionCommand) error
AssertDecommissionCommandRequired checks if the required fields are not zero-ed
func AssertDestinationRequired ¶
func AssertDestinationRequired(obj Destination) error
AssertDestinationRequired checks if the required fields are not zero-ed
func AssertEndTurnRequired ¶
AssertEndTurnRequired checks if the required fields are not zero-ed
func AssertErrorRequired ¶
AssertErrorRequired checks if the required fields are not zero-ed
func AssertMoveCommandRequired ¶
func AssertMoveCommandRequired(obj MoveCommand) error
AssertMoveCommandRequired checks if the required fields are not zero-ed
func AssertNetWorthRequired ¶
AssertNetWorthRequired checks if the required fields are not zero-ed
func AssertPlanetRequired ¶
AssertPlanetRequired checks if the required fields are not zero-ed
func AssertPlayerIdRequired ¶
AssertPlayerIdRequired checks if the required fields are not zero-ed
func AssertPlayerRequired ¶
AssertPlayerRequired checks if the required fields are not zero-ed
func AssertProfilingRequired ¶
AssertProfilingRequired checks if the required fields are not zero-ed
func AssertRecurseAttackCommandRequired ¶
func AssertRecurseAttackCommandRequired(objSlice interface{}) error
AssertRecurseAttackCommandRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of AttackCommand (e.g. [][]AttackCommand), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseCombatRequired ¶
func AssertRecurseCombatRequired(objSlice interface{}) error
AssertRecurseCombatRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of Combat (e.g. [][]Combat), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseCommandRequired ¶
func AssertRecurseCommandRequired(objSlice interface{}) error
AssertRecurseCommandRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of Command (e.g. [][]Command), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseConstructCommandRequired ¶
func AssertRecurseConstructCommandRequired(objSlice interface{}) error
AssertRecurseConstructCommandRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of ConstructCommand (e.g. [][]ConstructCommand), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseCredentialsRequired ¶
func AssertRecurseCredentialsRequired(objSlice interface{}) error
AssertRecurseCredentialsRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of Credentials (e.g. [][]Credentials), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseCurrentTickRequired ¶
func AssertRecurseCurrentTickRequired(objSlice interface{}) error
AssertRecurseCurrentTickRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of CurrentTick (e.g. [][]CurrentTick), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseDataReportsRequired ¶
func AssertRecurseDataReportsRequired(objSlice interface{}) error
AssertRecurseDataReportsRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of DataReports (e.g. [][]DataReports), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseDataRequired ¶
func AssertRecurseDataRequired(objSlice interface{}) error
AssertRecurseDataRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of Data (e.g. [][]Data), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseDecommissionCommandRequired ¶
func AssertRecurseDecommissionCommandRequired(objSlice interface{}) error
AssertRecurseDecommissionCommandRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of DecommissionCommand (e.g. [][]DecommissionCommand), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseDestinationRequired ¶
func AssertRecurseDestinationRequired(objSlice interface{}) error
AssertRecurseDestinationRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of Destination (e.g. [][]Destination), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseEndTurnRequired ¶
func AssertRecurseEndTurnRequired(objSlice interface{}) error
AssertRecurseEndTurnRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of EndTurn (e.g. [][]EndTurn), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseErrorRequired ¶
func AssertRecurseErrorRequired(objSlice interface{}) error
AssertRecurseErrorRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of Error (e.g. [][]Error), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseInterfaceRequired ¶
AssertRecurseInterfaceRequired recursively checks each struct in a slice against the callback. This method traverse nested slices in a preorder fashion.
func AssertRecurseMoveCommandRequired ¶
func AssertRecurseMoveCommandRequired(objSlice interface{}) error
AssertRecurseMoveCommandRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of MoveCommand (e.g. [][]MoveCommand), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseNetWorthRequired ¶
func AssertRecurseNetWorthRequired(objSlice interface{}) error
AssertRecurseNetWorthRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of NetWorth (e.g. [][]NetWorth), otherwise ErrTypeAssertionError is thrown.
func AssertRecursePlanetRequired ¶
func AssertRecursePlanetRequired(objSlice interface{}) error
AssertRecursePlanetRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of Planet (e.g. [][]Planet), otherwise ErrTypeAssertionError is thrown.
func AssertRecursePlayerIdRequired ¶
func AssertRecursePlayerIdRequired(objSlice interface{}) error
AssertRecursePlayerIdRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of PlayerId (e.g. [][]PlayerId), otherwise ErrTypeAssertionError is thrown.
func AssertRecursePlayerRequired ¶
func AssertRecursePlayerRequired(objSlice interface{}) error
AssertRecursePlayerRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of Player (e.g. [][]Player), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseProfilingRequired ¶
func AssertRecurseProfilingRequired(objSlice interface{}) error
AssertRecurseProfilingRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of Profiling (e.g. [][]Profiling), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseRenameCommandRequired ¶
func AssertRecurseRenameCommandRequired(objSlice interface{}) error
AssertRecurseRenameCommandRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of RenameCommand (e.g. [][]RenameCommand), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseRepairCommandRequired ¶
func AssertRecurseRepairCommandRequired(objSlice interface{}) error
AssertRecurseRepairCommandRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of RepairCommand (e.g. [][]RepairCommand), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseReportsRequired ¶
func AssertRecurseReportsRequired(objSlice interface{}) error
AssertRecurseReportsRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of Reports (e.g. [][]Reports), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseResourceRequired ¶
func AssertRecurseResourceRequired(objSlice interface{}) error
AssertRecurseResourceRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of Resource (e.g. [][]Resource), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseScoreValueRequired ¶
func AssertRecurseScoreValueRequired(objSlice interface{}) error
AssertRecurseScoreValueRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of ScoreValue (e.g. [][]ScoreValue), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseShipClassRequired ¶
func AssertRecurseShipClassRequired(objSlice interface{}) error
AssertRecurseShipClassRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of ShipClass (e.g. [][]ShipClass), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseShipRequired ¶
func AssertRecurseShipRequired(objSlice interface{}) error
AssertRecurseShipRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of Ship (e.g. [][]Ship), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseStaticDataRequired ¶
func AssertRecurseStaticDataRequired(objSlice interface{}) error
AssertRecurseStaticDataRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of StaticData (e.g. [][]StaticData), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseTradeCommandRequired ¶
func AssertRecurseTradeCommandRequired(objSlice interface{}) error
AssertRecurseTradeCommandRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of TradeCommand (e.g. [][]TradeCommand), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseTradeRequired ¶
func AssertRecurseTradeRequired(objSlice interface{}) error
AssertRecurseTradeRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of Trade (e.g. [][]Trade), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseTradingResourceAllOfRequired ¶
func AssertRecurseTradingResourceAllOfRequired(objSlice interface{}) error
AssertRecurseTradingResourceAllOfRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of TradingResourceAllOf (e.g. [][]TradingResourceAllOf), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseTradingResourceRequired ¶
func AssertRecurseTradingResourceRequired(objSlice interface{}) error
AssertRecurseTradingResourceRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of TradingResource (e.g. [][]TradingResource), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseValueRequired ¶
AssertRecurseValueRequired checks each struct in the nested slice against the callback. This method traverse nested slices in a preorder fashion.
func AssertRecurseWreckRequired ¶
func AssertRecurseWreckRequired(objSlice interface{}) error
AssertRecurseWreckRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of Wreck (e.g. [][]Wreck), otherwise ErrTypeAssertionError is thrown.
func AssertRenameCommandRequired ¶
func AssertRenameCommandRequired(obj RenameCommand) error
AssertRenameCommandRequired checks if the required fields are not zero-ed
func AssertRepairCommandRequired ¶
func AssertRepairCommandRequired(obj RepairCommand) error
AssertRepairCommandRequired checks if the required fields are not zero-ed
func AssertReportsRequired ¶
AssertReportsRequired checks if the required fields are not zero-ed
func AssertResourceRequired ¶
AssertResourceRequired checks if the required fields are not zero-ed
func AssertScoreValueRequired ¶
func AssertScoreValueRequired(obj ScoreValue) error
AssertScoreValueRequired checks if the required fields are not zero-ed
func AssertShipClassRequired ¶
AssertShipClassRequired checks if the required fields are not zero-ed
func AssertShipRequired ¶
AssertShipRequired checks if the required fields are not zero-ed
func AssertStaticDataRequired ¶
func AssertStaticDataRequired(obj StaticData) error
AssertStaticDataRequired checks if the required fields are not zero-ed
func AssertTradeCommandRequired ¶
func AssertTradeCommandRequired(obj TradeCommand) error
AssertTradeCommandRequired checks if the required fields are not zero-ed
func AssertTradeRequired ¶
AssertTradeRequired checks if the required fields are not zero-ed
func AssertTradingResourceAllOfRequired ¶
func AssertTradingResourceAllOfRequired(obj TradingResourceAllOf) error
AssertTradingResourceAllOfRequired checks if the required fields are not zero-ed
func AssertTradingResourceRequired ¶
func AssertTradingResourceRequired(obj TradingResource) error
AssertTradingResourceRequired checks if the required fields are not zero-ed
func AssertWreckRequired ¶
AssertWreckRequired checks if the required fields are not zero-ed
func HashPassword ¶
func IsPasswordValid ¶
func IsZeroValue ¶
func IsZeroValue(val interface{}) bool
IsZeroValue checks if the val is the zero-ed value.
func MaybeGetLoggedPlayerId ¶
Types ¶
type AttackCommand ¶
func NewAttackCommand ¶
func NewAttackCommand(command Command) *AttackCommand
type Command ¶
type Command struct { Type string `json:"type"` Target *string `json:"target,omitempty"` Destination *Destination `json:"destination,omitempty"` Resource *string `json:"resource,omitempty"` Amount *int64 `json:"amount,omitempty"` ShipClass *string `json:"shipClass,omitempty"` Name *string `json:"name,omitempty"` }
type ConstructCommand ¶
type ConstructCommand struct { ShipClass *string `json:"shipClass"` Type string `json:"type,omitempty"` }
func NewConstructCommand ¶
func NewConstructCommand(command Command) *ConstructCommand
type Credentials ¶
type CurrentTick ¶
type Data ¶
type Data struct { CurrentTick CurrentTick `json:"currentTick"` Planets map[string]Planet `json:"planets"` PlayerId *string `json:"playerId,omitempty"` Players map[string]Player `json:"players"` Ships map[string]Ship `json:"ships"` Wrecks map[string]Wreck `json:"wrecks,omitempty"` Reports DataReports `json:"reports,omitempty"` }
type DataReports ¶
type DecommissionCommand ¶
type DecommissionCommand struct {
Type string `json:"type,omitempty"`
}
type Destination ¶
type Game ¶
type Game struct { Tick CurrentTick ResourceNames map[string]string ShipClasses map[string]ShipClass SerializedStaticData []byte Ready *sync.RWMutex ReportsReady *sync.RWMutex TickCond *sync.Cond SessionManager sessions.Store Reports Reports // contains filtered or unexported fields }
func (*Game) CreatePlayersForUsers ¶
func (*Game) CreateWaypointFromCoordinates ¶
func (*Game) DetermineTarget ¶
func (game *Game) DetermineTarget(d Destination) (string, error)
func (*Game) EndTurn ¶
func (game *Game) EndTurn(userExpectations EndTurn) CurrentTick
func (*Game) GetGameTickState ¶
func (game *Game) GetGameTickState() CurrentTick
func (*Game) GetHistoricStaticData ¶
func (*Game) GetHistoryData ¶
func (*Game) GetHistoryReports ¶
func (*Game) GetPlanets ¶
func (*Game) NextSeason ¶
func (game *Game) NextSeason()
func (*Game) ProcessCommands ¶
func (*Game) SetResourceNames ¶
func (*Game) SetShipClasses ¶
type ImplResponse ¶
type ImplResponse struct { Code int Body interface{} }
ImplResponse response defines an error code with the associated body
func Response ¶
func Response(code int, body interface{}) ImplResponse
Response return a ImplResponse struct filled
type LoggedUser ¶
func LoggedUserFromSession ¶
type MoveCommand ¶
type MoveCommand struct { Destination *Destination `json:"destination"` Type string `json:"type,omitempty"` }
func NewMoveCommand ¶
func NewMoveCommand(command Command) *MoveCommand
type Planet ¶
type Planet struct { Name string `json:"name"` Resources map[string]TradingResource `json:"resources"` Position *[]int64 `json:"position"` PrevPosition *[]int64 `json:"prevPosition"` }
type Profiling ¶
type Profiling struct { Tick int64 `json:"tick,omitempty"` Movement int64 `json:"movement,omitempty"` Attacks int64 `json:"attacks,omitempty"` Trades int64 `json:"trades,omitempty"` Recipes int64 `json:"recipes,omitempty"` Prices int64 `json:"prices,omitempty"` Constructions int64 `json:"constructions,omitempty"` Report int64 `json:"report,omitempty"` Total int64 `json:"total,omitempty"` Overall int64 `json:"overall,omitempty"` At int64 `json:"at,omitempty"` }
type RenameCommand ¶
func NewRenameCommand ¶
func NewRenameCommand(command Command) *RenameCommand
type RepairCommand ¶
type RepairCommand struct {
Type string `json:"type,omitempty"`
}
type Reports ¶
type Reports struct { Combat []Combat `json:"combat"` Trade []Trade `json:"trade"` // Profiling information about the game. Used by the visualization website. Profiling []Profiling `json:"profiling"` // Prices are average across all planets. Prices map[string]map[string]int64 `json:"prices"` ResourceAmounts map[string]map[string]int64 `json:"resourceAmounts"` Scores map[string]ScoreValue `json:"scores"` // user SeasonScores map[string]map[string]int64 `json:"seasonScores,omitempty"` // requested / last season Season int64 `json:"season"` // requested / last tick in the season Tick int64 `json:"tick"` }
type RequiredError ¶
type RequiredError struct {
Field string
}
RequiredError indicates that an error has occurred when parsing request parameters
func (*RequiredError) Error ¶
func (e *RequiredError) Error() string
type ScoreValue ¶
type Ship ¶
type Ship struct { ShipClass string `json:"shipClass"` Life int64 `json:"life"` Name string `json:"name"` Player string `json:"player"` Position *[]int64 `json:"position"` PrevPosition *[]int64 `json:"prevPosition"` Resources map[string]Resource `json:"resources"` Command *Command `json:"command,omitempty"` }
type ShipClass ¶
type ShipClass struct { Name string `json:"name"` // whether ships of this class are allowed to construct new ships Shipyard bool `json:"shipyard"` Speed float64 `json:"speed"` // maximum number of resources the ship can carry - sum over all types of resources CargoCapacity int64 `json:"cargoCapacity"` Life int64 `json:"life"` Damage int64 `json:"damage"` Price int64 `json:"price"` // passive regeneration per tick Regen int64 `json:"regen"` // price for healing repairLife per tick (for repair command) RepairPrice int64 `json:"repairPrice"` // how much is repaired per tick (for repair command) RepairLife int64 `json:"repairLife"` }
type StaticData ¶
type TradeCommand ¶
type TradeCommand struct { // Positive value means buy, negative sell. Amount *int64 `json:"amount"` Resource *string `json:"resource"` // Any planet or own ship. Target *string `json:"target"` Type string `json:"type,omitempty"` }
func NewTradeCommand ¶
func NewTradeCommand(command Command) *TradeCommand
type TradingResource ¶
type TradingResourceAllOf ¶
Source Files ¶
- command_attack.go
- command_construct.go
- command_decommision.go
- command_move.go
- command_rename.go
- command_repair.go
- command_stop.go
- command_trade.go
- commands.go
- error.go
- game.go
- helpers.go
- history.go
- impl.go
- main_loop.go
- model_attack_command.go
- model_combat.go
- model_command.go
- model_construct_command.go
- model_credentials.go
- model_current_tick.go
- model_data.go
- model_data_reports.go
- model_decommission_command.go
- model_destination.go
- model_end_turn.go
- model_error.go
- model_move_command.go
- model_net_worth.go
- model_planet.go
- model_player.go
- model_player_id.go
- model_profiling.go
- model_rename_command.go
- model_repair_command.go
- model_reports.go
- model_resource.go
- model_score_value.go
- model_ship.go
- model_ship_class.go
- model_static_data.go
- model_trade.go
- model_trade_command.go
- model_trading_resource.go
- model_trading_resource_all_of.go
- model_wreck.go
- reports.go
- ships.go
- tick.go
- users.go