Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InitiateTradeOrder ¶
type InitiateTradeOrder struct { // Type is always initiate-trade Type string `json:"type" mapstructure:"type"` // Team that you want to trade with, cannot be your own team. Team int `json:"team" mapstructure:"team"` // Offer of resources you will give to the other team. Keys are the uids // of the resources that you want to give and the values are the amounts // of those resources. Offer map[string]int `json:"offer" mapstructure:"offer"` // Request of resources you will receive from the other team. Keys are the // uids of the resources that you want to receive and the values are the // amounts of those resources. Request map[string]int `json:"request" mapstructure:"request"` }
InitiateTradeOrder is an order sent to a tent to initiate a resource trade with another team. If the other team accepts using an RespondTradeOrder on a tent then the trade goes through. If they reject the trade order with a RespondTradeOrder then the trade is canceled.
The list of active trades on the tent are visible in the tents Additional details. See unitdets.TentSync and unitdets.TentUpdate for the format.
func (*InitiateTradeOrder) GetType ¶
func (o *InitiateTradeOrder) GetType() string
func (*InitiateTradeOrder) PrepareForMarshal ¶
func (o *InitiateTradeOrder) PrepareForMarshal()
type Order ¶
type Order interface { // GetType returns the canonical unique identifier for the order GetType() string // PrepareForMarshal ensures that the default values for this order have // been set correctly. PrepareForMarshal() }
Order describes any of the orders within this package, which is useful for grabbing the Type of the package without a large switch statement.
func ParseOrder ¶
ParseOrder parses a single order from its map representation within a packet. This typically comes from the clipkts.IssueSmartObjectOrderPacket#Order
type RespondTradeOrder ¶
type RespondTradeOrder struct { // Type is always respond-trade Type string `json:"type" mapstructure:"type"` // UID of the trade offer which is being accepted or rejected UID string `json:"uid" mapstructure:"uid"` // Accepted is true if we are trying to accept the offer and false if we are // trying to reject the offer. Accepted bool `json:"accepted" mapstructure:"accepted"` }
RespondTradeOrder is sent by client to respond to a particular trade request on a hut. This only works for trade requests that are from another team; to withdraw a trade order use WithdrawTradeOrder
func (*RespondTradeOrder) GetType ¶
func (o *RespondTradeOrder) GetType() string
func (*RespondTradeOrder) PrepareForMarshal ¶
func (o *RespondTradeOrder) PrepareForMarshal()
type WithdrawTradeOrder ¶
type WithdrawTradeOrder struct { // Type is always withdraw-trade Type string `json:"type" mapstructure:"type"` // UID of the trade offer to withdraw UID string `json:"uid" mapstructure:"uid"` }
WithdrawTradeOrder is sent by the client to a tent to request that a trade offer be withdrawn. This works only on offers that were initiated by the clients team, to accept or reject offers that came from other teams use RespondTradeOrder
func (*WithdrawTradeOrder) GetType ¶
func (o *WithdrawTradeOrder) GetType() string
func (*WithdrawTradeOrder) PrepareForMarshal ¶
func (o *WithdrawTradeOrder) PrepareForMarshal()