Documentation
¶
Index ¶
- Constants
- Variables
- func SessionID() string
- type Account
- type AccountInfoPayload
- type Auction
- type AuctionType
- type AuthPayload
- type Client
- func (c *Client) Outgoing(method string, data interface{})
- func (c *Client) SendError(method string, data interface{})
- func (c *Client) SendFail(method string, data interface{})
- func (c *Client) SendForbidden(method string, data interface{})
- func (c *Client) SendMalformed(method string)
- func (c *Client) SendSuccess(method string, data interface{})
- type ClientResponse
- type Econetwork
- type EconodeInfoPayload
- type Item
- type ItemPurchasePayload
- type Node
- type ServerResponse
- type StatsPayload
- type UserMessagePayload
- type WelcomePayload
Constants ¶
View Source
const EconetworkMOTD = "Hello!!!"
TODO: make better motd kek
Variables ¶
View Source
var ( ErrAccountNotExists = errors.New("account doesnt exist") // for when trying to login or get account ErrAccountExists = errors.New("account already exists") // trying to register an already existing username/account ErrMissingCredentials = errors.New("neither username or password were provided") )
View Source
var ( ItemUnknown Item ItemQuark = Item{0.05, 50, "Quark", 0} ItemElectron = Item{0.1, 120, "Electron", 0} ItemTransistor = Item{0.04, 175, "Transistor", 0} ItemLogicCircuit = Item{2, 220, "Logic Circuit", 0} ItemBreadboard = Item{2.7, 275, "Breadboard", 0} ItemFPGA = Item{3, 330, "FPGA", 0} ItemCPU = Item{4.2, 405, "CPU", 0} ItemEmbeddedPC = Item{490, 4.9, "Embedded Computer", 0} ItemSmartphone = Item{640, 5.6, "Smartphone", 0} ItemLaptop = Item{780, 6.4, "Laptop", 0} ItemDesktop = Item{955, 7, "Desktop", 0} ItemWindowsServer = Item{1128, 8.7, "Windows Server", 0} ItemLinuxServer = Item{1200, 9.1, "Linux Server", 0} ItemMainframe = Item{1500, 10.2, "Mainframe", 0} // Rebirth 2 ItemQuantumPC = Item{10000, 22, "Quantum Computer", 0} ItemLunarQuantumFarm = Item{22000, 32, "Lunar Quantum Farm", 0} ItemComputingSolarSystem = Item{34000, 44, "Computing Solar System", 0} ItemQuantumGalaxy = Item{50000, 56, "Quantum Galaxy", 0} ItemComputationalUniverse = Item{75000, 69, "Computational Universe", 0} )
View Source
var (
ErrNotEnoughMoney = errors.New("not enough money to do this")
)
Functions ¶
Types ¶
type Account ¶
type Account struct {
Username string `db:"username"`
ID int `db:"id"`
Node *Node // pointer since a person won't have a node immediately on register
Op bool `db:"op"`
Network *Econetwork
}
A client's account
type AccountInfoPayload ¶
type Auction ¶
type Auction struct {
Type AuctionType
BasePrice float64
SellingPrice float64
}
type AuthPayload ¶
For register and login methods
type Client ¶
func (*Client) SendForbidden ¶
func (*Client) SendMalformed ¶
func (*Client) SendSuccess ¶
type ClientResponse ¶
type ClientResponse struct {
SessionID string `json:"sessionID"`
Method string `json:"method"`
Data *interface{} `json:"data,omitempty"`
}
Fields we should expect from the client
type Econetwork ¶
type Econetwork struct {
Address string
// contains filtered or unexported fields
}
func New ¶
func New() (*Econetwork, error)
func (*Econetwork) CreateNode ¶
func (e *Econetwork) CreateNode(name string, owner *Account)
func (*Econetwork) Dump ¶
func (e *Econetwork) Dump()
func (*Econetwork) GetNode ¶
func (e *Econetwork) GetNode(id int) *Node
func (*Econetwork) GetNodeByName ¶
func (e *Econetwork) GetNodeByName(name string) *Node
func (*Econetwork) Start ¶
func (e *Econetwork) Start()
func (*Econetwork) Stop ¶
func (e *Econetwork) Stop()
type EconodeInfoPayload ¶
type ItemPurchasePayload ¶
type Node ¶
type Node struct {
ID int `db:"id"`
Name string `db:"name"`
OwnerID int `db:"owner"`
Owner *Account
Members []int
Inventory map[string]Item
Balance float64 `db:"balance"`
Gems int `db:"gems"`
Multi float64 `db:"multi"`
// contains filtered or unexported fields
}
Someone's econode The idea is that we can have other people growing a single node together
type ServerResponse ¶
type ServerResponse struct {
Code string `json:"code"`
Method string `json:"method"`
Data *interface{} `json:"data,omitempty"`
}
The server response struct What we should send, as defined by the procotol
type StatsPayload ¶
type UserMessagePayload ¶
type WelcomePayload ¶
type WelcomePayload struct {
MOTD string `json:"motd"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.