server

package
v0.0.0-...-358ff03 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessLog

func AccessLog(next http.Handler) http.Handler

AccessLog interceptor to log method calls.

Types

type BuyOrderRequest

type BuyOrderRequest struct {
	PlayerName   string `json:"player"`
	ResourceName string `json:"resource"`
	Quantity     int64  `json:"quantity"`
}

type BuyOrderResponse

type BuyOrderResponse struct {
	Cost    string `json:"cost"`
	Message string `json:"message"`
}

type DigActionRequest

type DigActionRequest struct {
	PlayerName   string `json:"player"`
	ResourceName string `json:"resource"`
	Quantity     int64  `json:"quantity"`
}

type DigActionResponse

type DigActionResponse struct {
	Cost    float64 `json:"cost"`
	Message string  `json:"message"`
}

type GameInfoResponse

type GameInfoResponse struct {
	Info string `json:"info"`
}

type GetPlayerInventoryResponse

type GetPlayerInventoryResponse struct {
	Player Player `json:"player"`
}

type Item

type Item struct {
	Name     string `json:"name"`
	Type     string `json:"type"`
	Quantity int64  `json:"quantity"`
}

func NewItem

func NewItem(src *game.Item) Item

type ListMarketStockResponse

type ListMarketStockResponse struct {
	NextMarketUpdate string    `json:"nextMarketUpdate"`
	Stock            []Listing `json:"stock"`
}

type Listing

type Listing struct {
	Name          string         `json:"name"`
	Type          string         `json:"type"`
	BuyPrice      string         `json:"buy_price"`
	SellPrice     string         `json:"sell_price"`
	Prerequisites []Prerequisite `json:"prerequisites,omitempty"`
}

func NewListing

func NewListing(src *game.Listing) Listing

type Player

type Player struct {
	Name      string `json:"name"`
	Title     string `json:"title"`
	NetWorth  string `json:"netWorth"`
	Money     string `json:"money"`
	Salary    string `json:"salary"`
	Inventory []Item `json:"inventory"`
}

func NewPlayer

func NewPlayer(src *game.Player) Player

type Prerequisite

type Prerequisite struct {
	Name     string `json:"name"`
	Quantity int64  `json:"quantity"`
}

type ProspectActionRequest

type ProspectActionRequest struct {
	PlayerName   string `json:"player"`
	ResourceName string `json:"resource"`
	Quantity     int64  `json:"quantity"`
}

type ProspectActionResponse

type ProspectActionResponse struct {
	Profit  float64 `json:"profit"`
	Message string  `json:"message"`
}

type SellOrderRequest

type SellOrderRequest struct {
	PlayerName   string `json:"player"`
	ResourceName string `json:"resource"`
	Quantity     int64  `json:"quantity"`
}

type SellOrderResponse

type SellOrderResponse struct {
	Profit  string `json:"profit"`
	Message string `json:"message"`
}

type Server

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

Server contains the implementation.

func NewServer

func NewServer(manager *game.Manager) *Server

NewServer creates a new instance of Server.

func (*Server) BuyOrder

func (s *Server) BuyOrder(w http.ResponseWriter, req *http.Request)

Buy an item from the market.

func (*Server) DigAction

func (s *Server) DigAction(w http.ResponseWriter, req *http.Request)

Buy an item from the market.

func (*Server) GameInfo

func (s *Server) GameInfo(w http.ResponseWriter, req *http.Request)

Retrieve information about the game.

func (*Server) GetPlayerInventory

func (s *Server) GetPlayerInventory(w http.ResponseWriter, req *http.Request)

List stats for player, including their entire inventory.

func (*Server) ListMarketStock

func (s *Server) ListMarketStock(w http.ResponseWriter, req *http.Request)

List entire market inventory.

func (*Server) Ping

func (s *Server) Ping(w http.ResponseWriter, req *http.Request)

Ping service for availability.

func (*Server) ProspectAction

func (s *Server) ProspectAction(w http.ResponseWriter, req *http.Request)

Sell an item on the market.

func (*Server) SellOrder

func (s *Server) SellOrder(w http.ResponseWriter, req *http.Request)

Sell an item on the market.

func (*Server) Shutdown

func (s *Server) Shutdown() error

Jump to

Keyboard shortcuts

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