Documentation ¶
Index ¶
- Variables
- func SpaceTradersHandler(request bothandler.Request) string
- type Agent
- type AgentData
- type ChannelAgents
- type ContractData
- type CrewData
- type DeliverData
- type ErrorResponse
- type Faction
- type FactionData
- type FuelData
- type InventoryData
- type NavData
- type PaymentData
- type PlatformChannel
- type RegisterAgentRequest
- type RegisterAgentResponse
- type RegisterAgentResponseData
- type RequestLog
- type RouteData
- type Ship
- type ShipCargoData
- type ShipData
- type ShipEngineData
- type ShipFrameData
- type ShipModuleData
- type ShipMountData
- type ShipReactorData
- type ShipRegistrationData
- type SpaceTraders
- func (a *SpaceTraders) GetTrait(traitCode string) Trait
- func (a *SpaceTraders) LoadKnown()
- func (m *SpaceTraders) LogRequest(ctx context.Context, rl *RequestLog, r *http.Request)
- func (a *SpaceTraders) ProcessRegisterAgentResponse(ctx context.Context, pc PlatformChannel, resp *RegisterAgentResponse)
- func (a *SpaceTraders) RegisterAgent(ctx context.Context, pc PlatformChannel, agentRequest RegisterAgentRequest) (*RegisterAgentResponse, error)
- func (a *SpaceTraders) SetAgent(agent Agent)
- func (a *SpaceTraders) SetFaction(faction Faction)
- func (a *SpaceTraders) SetShip(ship Ship)
- func (a *SpaceTraders) SetTrait(trait Trait)
- type System
- type SystemData
- type SystemResponse
- type TermsData
- type Trait
- type TraitsData
- type Waypoint
- type WaypointData
Constants ¶
This section is empty.
Variables ¶
View Source
var KnownFactions = map[string]bool{ "COSMIC": true, }
Functions ¶
func SpaceTradersHandler ¶
func SpaceTradersHandler(request bothandler.Request) string
SpaceTradersHandler is the catchall handler for SpaceTraders, to make it work within the bothandler framework
Types ¶
type ChannelAgents ¶
type ContractData ¶
type ContractData struct { ID string `json:"id"` FactionSymbol string `json:"factionSymbol"` Type string `json:"type"` Terms TermsData `json:"terms"` Accepted bool `json:"accepted"` Fulfilled bool `json:"fulfilled"` Expiration time.Time `json:"expiration"` DeadlineToAccept time.Time `json:"deadlineToAccept"` }
type DeliverData ¶
type ErrorResponse ¶
type Faction ¶
type Faction struct { gorm.Model Faction string `gorm:"uniqueIndex"` Name string Description string Headquarters string Traits []Trait `gorm:"-"` TraitsString string `gorm:"column:traits;type:text"` IsRecruiting bool `gorm:"column:is_recruiting"` }
func (*Faction) Fix ¶
func (f *Faction) Fix(a *SpaceTraders)
func (*Faction) PrettyPrint ¶
type FactionData ¶
type InventoryData ¶
type InventoryData any
type PaymentData ¶
type PlatformChannel ¶
PlatformChannel maps chat channels and platforms to Agent.Symbol
type RegisterAgentRequest ¶
type RegisterAgentResponse ¶
type RegisterAgentResponse struct { Data *RegisterAgentResponseData `json:"data"` Error *ErrorResponse `json:"error,omitempty"` }
type RegisterAgentResponseData ¶
type RegisterAgentResponseData struct { Token string `json:"token,omitempty"` Agent *AgentData `json:"agent,omitempty"` Contract *ContractData `json:"contract,omitempty"` Faction *FactionData `json:"faction,omitempty"` Ship *ShipData `json:"ship,omitempty"` }
type RequestLog ¶
type RequestLog struct { gorm.Model Platform string `gorm:"column:platform" json:"platform"` Channel string `gorm:"column:channel" json:"channel"` Type string `gorm:"column:type" json:"type"` URL string `gorm:"column:url" json:"url"` Data string `gorm:"column:data" json:"data"` ResponseStatusCode int `gorm:"column:response_status_code" json:"response_status_code"` Response string `gorm:"column:response" json:"response"` }
type RouteData ¶
type RouteData struct { Departure WaypointData `json:"departure"` Destination WaypointData `json:"destination"` Arrival time.Time `json:"arrival"` DepartureTime time.Time `json:"departureTime"` }
type Ship ¶
type Ship struct { gorm.Model Ship string `gorm:"uniqueIndex" json:"symbol"` Owner string `gorm:"column:owner" json:"owner"` Data string `gorm:"column:data;type:text" json:"-"` Crew CrewData `gorm:"-" json:"crew"` Fuel FuelData `gorm:"-" json:"fuel"` Frame ShipFrameData `gorm:"-" json:"frame"` Reactor ShipReactorData `gorm:"-" json:"reactor"` Engine ShipEngineData `gorm:"-" json:"engine"` Modules []ShipModuleData `gorm:"-" json:"modules"` Mounts []ShipMountData `gorm:"-" json:"mounts"` Registration ShipRegistrationData `gorm:"-" json:"registration"` Cargo ShipCargoData `gorm:"-" json:"cargo"` }
func (*Ship) Fix ¶
func (s *Ship) Fix(a *SpaceTraders)
func (*Ship) PrettyPrint ¶
type ShipCargoData ¶
type ShipCargoData struct { Capacity int `json:"capacity"` Units int `json:"units"` Inventory []InventoryData `json:"inventory"` }
type ShipData ¶
type ShipData struct { Symbol string `json:"symbol"` Crew CrewData `json:"crew"` Fuel FuelData `json:"fuel"` Frame ShipFrameData `json:"frame"` Reactor ShipReactorData `json:"reactor"` Engine ShipEngineData `json:"engine"` Modules []ShipModuleData `json:"modules"` Mounts []ShipMountData `json:"mounts"` Registration ShipRegistrationData `json:"registration"` Cargo ShipCargoData `json:"cargo"` }
type ShipEngineData ¶
type ShipFrameData ¶
type ShipFrameData struct { Symbol string `json:"symbol"` Name string `json:"name"` Description string `json:"description"` ModuleSlots int `json:"moduleSlots"` MountingPoints int `json:"mountingPoints"` FuelCapacity int `json:"fuelCapacity"` Condition int `json:"condition"` Requirements struct { Power int `json:"power"` Crew int `json:"crew"` } `json:"requirements"` }
type ShipModuleData ¶
type ShipModuleData struct { Symbol string `json:"symbol"` Name string `json:"name"` Description string `json:"description"` Capacity int `json:"capacity,omitempty"` Requirements struct { Crew int `json:"crew"` Power int `json:"power"` Slots int `json:"slots"` } `json:"requirements"` Range int `json:"range,omitempty"` }
type ShipMountData ¶
type ShipReactorData ¶
type ShipRegistrationData ¶
type SpaceTraders ¶
type SpaceTraders struct { GormDB *gorm.DB Rand *rand.Rand HttpClient http.Client ActiveDev bool KnownFactions map[string]Faction KnownTraits map[string]Trait KnownAgents map[string]Agent KnownShips map[string]Ship AgentShips map[string]map[string]bool // contains filtered or unexported fields }
func (*SpaceTraders) GetTrait ¶
func (a *SpaceTraders) GetTrait(traitCode string) Trait
func (*SpaceTraders) LoadKnown ¶
func (a *SpaceTraders) LoadKnown()
func (*SpaceTraders) LogRequest ¶
func (m *SpaceTraders) LogRequest(ctx context.Context, rl *RequestLog, r *http.Request)
func (*SpaceTraders) ProcessRegisterAgentResponse ¶
func (a *SpaceTraders) ProcessRegisterAgentResponse(ctx context.Context, pc PlatformChannel, resp *RegisterAgentResponse)
func (*SpaceTraders) RegisterAgent ¶
func (a *SpaceTraders) RegisterAgent(ctx context.Context, pc PlatformChannel, agentRequest RegisterAgentRequest) (*RegisterAgentResponse, error)
func (*SpaceTraders) SetAgent ¶
func (a *SpaceTraders) SetAgent(agent Agent)
func (*SpaceTraders) SetFaction ¶
func (a *SpaceTraders) SetFaction(faction Faction)
func (*SpaceTraders) SetShip ¶
func (a *SpaceTraders) SetShip(ship Ship)
func (*SpaceTraders) SetTrait ¶
func (a *SpaceTraders) SetTrait(trait Trait)
type SystemData ¶
type SystemData struct { SystemSymbol string `json:"systemSymbol"` Symbol string `json:"symbol"` Type string `json:"type"` X int `json:"x"` Y int `json:"y"` Orbitals []struct { Symbol string `json:"symbol"` } `json:"orbitals"` Traits []TraitsData `json:"traits"` Chart struct { SubmittedBy string `json:"submittedBy"` SubmittedOn time.Time `json:"submittedOn"` } `json:"chart"` Faction FactionData `json:"faction"` // Note: only Symbol given }
type SystemResponse ¶
type SystemResponse struct {
Data SystemData `json:"data"`
}
type TermsData ¶
type TermsData struct { Deadline time.Time `json:"deadline"` Payment PaymentData `json:"payment"` Deliver []DeliverData `json:"deliver"` }
type TraitsData ¶
Click to show internal directories.
Click to hide internal directories.