Documentation ¶
Index ¶
- Constants
- func Unzip(data string, compressionType CompressionType) ([]byte, error)
- type ActiveName
- type Badge
- type BadgePath
- type BadgePreset
- type BodyPart
- type BodyPartType
- type Branch
- type ChangeOrderPrice
- type Color
- type Color256
- type ColorHex
- type CompressionType
- type Connection
- type ConsoleMessages
- type Controller
- type Creep
- type CreepActionLog
- type Destructible
- type Document
- type Energy
- type EnergyStore
- type Error
- type ExtendOrder
- type ExtendedOrder
- type Extension
- type FulfilledOrder
- type GitHub
- type InsertOps
- type InsertResult
- type LeaderboardPosition
- type MapRoomOwner
- type MapRoomStats
- type MarketOrder
- type MarketOrderType
- type Message
- type MessageDirection
- type MessageRead
- type MessageReadUpdate
- type MessageUpdate
- type MessageWithRecipients
- type Mineral
- type MineralType
- type MoneyMessage
- type MoneyOrder
- type MoneyOrderType
- type NewMessage
- type NewOrder
- type Object
- type ObjectIntent
- type ObjectType
- type Point
- type PriceChange
- type ResourceCount
- type Road
- type Room
- type RoomInfo
- type RoomOwner
- type RoomStats
- type RoomStatus
- type RoomTerrain
- type Season
- type ServerData
- type Shard
- type Source
- type Spawn
- type StatName
- type StatWithTime
- type Stats
- type StatsPeriod
- type StatsWithIntervals
- type StatsWithUser
- type Steam
- type Storage
- type Structure
- type Terrain
- type Tower
- type TowerActionLog
- type UniqueObjectName
- type UpsertMessage
- type UpsertMessageData
- type UpsertMessageDataType
- type UpsertMessageOptions
- type User
- type UserOwned
- type Wall
- type WorldStatus
Constants ¶
View Source
const ( BodyPartTypeMove BodyPartType = "move" BodyPartTypeWork = "work" BodyPartTypeCarry = "carry" BodyPartTypeAttack = "attack" // TODO(hinshun): confirm camelCase or snake_case BodyPartTypeRangedAttack = "rangedAttack" BodyPartTypeHeal = "heal" BodyPartTypeClaim = "claim" BodyPartTypeTough = "tough" )
View Source
const ( ErrorNone Error = "" ErrorInvalidParams = "invalid params" ErrorInvalidStatus = "invalid status" )
View Source
const ( // TODO(hinshun): verify values MoneyOrderTypeNew MoneyOrderType = "new" MoneyOrderTypeExtended = "extended" MoneyOrderTypeFulfilled = "fulfilled" MoneyOrderTypePriceChange = "priceChange" )
View Source
const ( ObjectIntentRemove ObjectIntent = "remove" ObjectIntentSuicideCreep = "suicide" ObjectIntentUnclaimController = "unclaim" ObjectIntentDestroyStructure = "destroyStructure" )
View Source
const ( ObjectTypeController ObjectType = "controller" ObjectTypeCreep = "creep" ObjectTypeEnergy = "energy" ObjectTypeExtension = "extension" ObjectTypeMineral = "mineral" ObjectTypeRoad = "road" ObjectTypeSource = "source" ObjectTypeSpawn = "spawn" ObjectTypeStorage = "storage" ObjectTypeTower = "tower" ObjectTypeWall = "constructedWall" )
View Source
const ( StatNameNone StatName = "" StatNameOwner = "owner0" StatNameClaim = "claim0" StatNameCreepsLost = "creepsLost" StatNameCreepsProduced = "creepsProduced" StatNameEnergyConstruction = "energyConstruction" StatNameEnergyControl = "energyControl" StatNameEnergyCreeps = "energyCreeps" StatNameEnergyHarvested = "energyHarvested" )
View Source
const ( StatsPeriodNone StatsPeriod = "" StatsPeriod1Hour = "8" StatsPeriod24Hours = "180" StatsPeriod7Days = "1440" )
View Source
const ( StructureSpawn Structure = "spawn" StructureExtension = "extension" StructureRoad = "road" StructureWall = "constructedWall" StructureRampart = "rampart" StructureKeeper_lair = "keeperLair" StructurePortal = "portal" StructureController = "controller" StructureLink = "link" StructureStorage = "storage" StructureTower = "tower" StructureObserver = "observer" StructurePower_bank = "powerBank" StructurePower_spawn = "powerSpawn" StructureExtractor = "extractor" StructureLab = "lab" StructureTerminal = "terminal" StructureContainer = "container" StructureNuker = "nuker" )
View Source
const ( TerrainPlain Terrain = "plain" TerrainWall = "wall" TerrainSwamp = "swamp" TerrainAlsoWall = "also wall" )
View Source
const ( // WorldStatusLost is the status when the user is despawned. WorldStatusLost WorldStatus = "lost" // WorldStatusEmpty is the status when the authenticated user has respawned, // but has not started their colony. WorldStatusEmpty = "empty" // WorldStatusNormal is the status when the authenticated user has respawned // and started their colony. WorldStatusNormal = "normal" )
View Source
const (
GzipPrefix = "gz"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ActiveName ¶
type ActiveName string
const ( ActiveNameWorld ActiveName = "activeWorld" ActiveNameSim = "activeSim" )
type Badge ¶
type Badge struct { // Type is either a BadgePreset or a BadgePath describing a custom // badge vector. Type json.RawMessage `json:"type"` // Color1 is the first color of the badge. Colors can be either all // unmarshalled into ColorHex or Color256. Color1 json.RawMessage `json:"color1"` // Color2 is the secondary color of the badge. Colors can be either all // unmarshalled into ColorHex or Color256. Color2 json.RawMessage `json:"color2"` // Color3 is the tertiary color of the badge. Colors can be either all // unmarshalled into ColorHex or Color256. Color3 json.RawMessage `json:"color3"` Param int `json:"param"` Flip bool `json:"flip"` }
type BadgePreset ¶
type BadgePreset int
type BodyPart ¶
type BodyPart struct { Type BodyPartType `json:"type"` Hits int `json:"hits"` }
type BodyPartType ¶
type BodyPartType string
type ChangeOrderPrice ¶
type CompressionType ¶
type CompressionType string
CompressionType is an internal constant used to differentiate compression from gzipped data from API and zlib-gzipped data from the websocket API.
const ( CompressionTypeGzip CompressionType = "gzip" CompressionTypeZlib = "zlib" )
type Connection ¶
type ConsoleMessages ¶
type Controller ¶
type Creep ¶
type Creep struct { Object Destructible EnergyStore UserOwned Name string `json:"name"` Body []BodyPart `json:"body"` Spawning bool `json:"spawning"` Fatigue int `json:"fatigue"` AgeTime int `json:"ageTime"` ActionLog CreepActionLog `json:"actionLog"` }
type CreepActionLog ¶
type CreepActionLog struct { Attacked *Point `json:"attacked"` Healed *Point `json:"healed"` Attack *Point `json:"attack"` RangedAttack *Point `json:"rangedAttacked"` RangedMassAttack *Point `json:"rangedMassAttacked"` RangedHeal *Point `json:"rangedHeal"` Harvest *Point `json:"harvest"` Heal *Point `json:"heal"` Repair *Point `json:"repair"` Build *Point `json:"build"` Say *Point `json:"say"` UpgradeController *Point `json:"upgradeController"` ReserveController *Point `json:"reserveController"` }
type Destructible ¶
type EnergyStore ¶
type ExtendOrder ¶
type ExtendedOrder ¶
type ExtendedOrder struct {
ExtendOrder ExtendOrder `json:"extendOrder"`
}
type Extension ¶
type Extension struct { Object Destructible EnergyStore UserOwned Off bool `json:"off"` }
type FulfilledOrder ¶
type InsertResult ¶
type LeaderboardPosition ¶
type MapRoomOwner ¶
type MapRoomStats ¶
type MapRoomStats struct { Status RoomStatus `json:"status"` Novice int `json:"novice"` OpenTime string `json:"openTime"` RespawnArea *int `json:"respawnArea"` Own MapRoomOwner `json:"own"` OwnerStat []StatsWithUser `json:"owner0"` ClaimStat []StatsWithUser `json:"claim0"` CreepsLost1HourStat []StatsWithUser `json:creepsLost8"` CreepsLost24HoursStat []StatsWithUser `json:creepsLost180"` CreepsLost7DaysStat []StatsWithUser `json:creepsLost1440"` CreepsProduced1HourStat []StatsWithUser `json:creepsProduced8"` CreepsProduced24HoursStat []StatsWithUser `json:creepsProduced180"` CreepsProduced7DaysStat []StatsWithUser `json:creepsProduced1440"` Energy1HourStat []StatsWithUser `json:energy8"` Energy24HoursStat []StatsWithUser `json:energy180"` Energy7DaysStat []StatsWithUser `json:energy1440"` EnergyConstruction1HourStat []StatsWithUser `json:energyConstruction8"` EnergyConstruction24HoursStat []StatsWithUser `json:energyConstruction180"` EnergyConstruction7DaysStat []StatsWithUser `json:energyConstruction1440"` EnergyControl1HourStat []StatsWithUser `json:energyControl8"` EnergyControl24HoursStat []StatsWithUser `json:energyControl180"` EnergyControl7DaysStat []StatsWithUser `json:energyControl1440"` EnergyCreeps1HourStat []StatsWithUser `json:energyCreeps8"` EnergyCreeps24HoursStat []StatsWithUser `json:energyCreeps180"` EnergyCreeps7DaysStat []StatsWithUser `json:energyCreeps1440"` EnergyHarvested1HourStat []StatsWithUser `json:energyHarvested8"` EnergyHarvested24HoursStat []StatsWithUser `json:energyHarvested180"` EnergyHarvested7DaysStat []StatsWithUser `json:energyHarvested1440"` Power1HourStat []StatsWithUser `json:power8"` Power24HoursStat []StatsWithUser `json:power180"` Power7DaysStat []StatsWithUser `json:power1440"` PowerProcessed1HourStat []StatsWithUser `json:powerProcessed8"` PowerProcessed24HoursStat []StatsWithUser `json:powerProcessed180"` PowerProcessed7DaysStat []StatsWithUser `json:powerProcessed1440"` }
type MarketOrder ¶
type MarketOrderType ¶
type MarketOrderType string
const ( MarketOrderTypeBuy MarketOrderType = "buy" MarketOrderTypeSell = "sell" )
type MessageDirection ¶
type MessageDirection string
const ( MessageDirectionIn MessageDirection = "in" MessageDirectionOut = "out" )
type MessageRead ¶
type MessageRead struct {
Message MessageReadUpdate `json:"message"`
}
type MessageReadUpdate ¶
type MessageUpdate ¶
type MessageWithRecipients ¶
type Mineral ¶
type Mineral struct { Object Density int `json:"density"` MineralType MineralType `json:"mineralType"` MineralAmount int `json:"mineralAmount"` }
type MoneyMessage ¶
type MoneyMessage struct { ID string `json:"_id"` Date time.Time `json:"date"` Tick bool `json:"tick"` User string `json:"user"` // Type defines which struct to unmarshal `Market` into. // If `Type` is `MoneyOrderTypeNew`, use `NewOrder` // If `Type` is `MoneyOrderTypeExtended`, use `ExtendedOrder` // If `Type` is `MoneyOrderTypeFulfilled`, use `FulfilledOrder` // If `Type` is `MoneyOrderTypePriceChange`, use `PriceChange` Type MoneyOrderType `json:"type"` Balance int `json:"balance"` Change int `json:"change"` Market json.RawMessage `json:"market"` }
type MoneyOrder ¶
type MoneyOrderType ¶
type MoneyOrderType string
type NewMessage ¶
type NewMessage struct {
Message MessageUpdate `json:"message"`
}
type NewOrder ¶
type NewOrder struct {
Order MoneyOrder `json:"order"`
}
type Object ¶
type Object struct { ID string `json:"_id"` Room string `json:"room"` Type ObjectType `json:"type"` X int `json:"x"` Y int `json:"y"` }
type ObjectIntent ¶
type ObjectIntent string
type ObjectType ¶
type ObjectType string
type PriceChange ¶
type PriceChange struct {
ChangeOrderPrice ChangeOrderPrice `json:"changeOrderPrice"`
}
type ResourceCount ¶
type Road ¶
type Road struct { Object Destructible NextDecayTime int `json:nextDecayTime` }
type Room ¶
type Room struct { ID string `json:"_id"` Status RoomStatus `json:"status"` Novice int `json:"novice"` }
type RoomStats ¶
type RoomStats struct { EnergyHarvested []StatWithTime `json:"energyHarvested"` EnergyConstruction []StatWithTime `json:"energyConstruction"` EnergyCreeps []StatWithTime `json:"energyCreeps"` CreepsLost []StatWithTime `json:"creepsLost "` StatsMax StatsWithIntervals `json:"statsMax"` Totals Stats `json:"totals"` }
type RoomStatus ¶
type RoomStatus string
const ( RoomStatusNormal RoomStatus = "normal" RoomStatusOutOfBorders = "out of borders" )
type RoomTerrain ¶
type RoomTerrain struct { ID string `json:"_id"` Room string `json:"room"` X int `json:"x"` Y int `json:"y"` // EncodedTerrain is a string of digits representing the terrain from top left // to bottom right. This string is empty if `encoded` is false. // 0: plain // 1: wall // 2: swamp // 3: also wall EncodedTerrain string `json:"terrain"` Type Terrain `json:"type"` }
type ServerData ¶
type Shard ¶
type Shard struct { Rooms []Room `json:"rooms"` Stats map[string]StatWithTime `json:"stats"` GameTimes []*int `json:"gametimes"` }
type Source ¶
type Source struct { Object EnergyStore TicksToRegeneration int `json:"ticksToRegeneration"` InvaderHarvested int `json:"invaderHarvested"` NextRegenerationTime int `json:"nextRegenerationTime"` }
type Spawn ¶
type Spawn struct { Object Destructible EnergyStore UserOwned Name string `json:"name"` Spawning bool `json:"spawning"` Off bool `json:"off"` }
type StatWithTime ¶
type Stats ¶
type Stats struct { CreepsLost int `json:"creepsLost"` CreepsProduced int `json:"creepsProduced"` EnergyConstruction int `json:"energyConstruction"` EnergyControl int `json:"energyControl"` EnergyCreeps int `json:"energyCreeps"` EnergyHarvested int `json:"energyHarvested"` PowerProcessed int `json:"powerProcessed"` }
type StatsPeriod ¶
type StatsPeriod string
type StatsWithIntervals ¶
type StatsWithIntervals struct { CreepsLost1Hour int `json:creepsLost8"` CreepsLost24Hours int `json:creepsLost180"` CreepsLost7Days int `json:creepsLost1440"` CreepsProduced1Hour int `json:creepsProduced8"` CreepsProduced24Hours int `json:creepsProduced180"` CreepsProduced7Days int `json:creepsProduced1440"` Energy1Hour int `json:energy8"` Energy24Hours int `json:energy180"` Energy7Days int `json:energy1440"` EnergyConstruction1Hour int `json:energyConstruction8"` EnergyConstruction24Hours int `json:energyConstruction180"` EnergyConstruction7Days int `json:energyConstruction1440"` EnergyControl1Hour int `json:energyControl8"` EnergyControl24Hours int `json:energyControl180"` EnergyControl7Days int `json:energyControl1440"` EnergyCreeps1Hour int `json:energyCreeps8"` EnergyCreeps24Hours int `json:energyCreeps180"` EnergyCreeps7Days int `json:energyCreeps1440"` EnergyHarvested1Hour int `json:energyHarvested8"` EnergyHarvested24Hours int `json:energyHarvested180"` EnergyHarvested7Days int `json:energyHarvested1440"` Power1Hour int `json:power8"` Power24Hours int `json:power180"` Power7Days int `json:power1440"` PowerProcessed1Hour int `json:powerProcessed8"` PowerProcessed24Hours int `json:powerProcessed180"` PowerProcessed7Days int `json:powerProcessed1440"` }
type StatsWithUser ¶
type Storage ¶
type Storage struct { Object Destructible EnergyStore UserOwned }
type Tower ¶
type Tower struct { Object Destructible EnergyStore UserOwned ActionLog TowerActionLog `json:"actionLog"` }
type TowerActionLog ¶
type UniqueObjectName ¶
type UniqueObjectName string
const ( UniqueObjectNameFlag UniqueObjectName = "flag" UniqueObjectNameSpawn = "spawn" )
type UpsertMessage ¶
type UpsertMessage struct { Parsed bool `json:"parsed"` Index int `json:"index"` HashedName string `json:"hashedName"` Length int `json:"length"` RequestID int `json:"requestId"` ResponseTo int `json:"responseTo"` ResponseFlags int `json:"responseFlags"` CursorID string `json:"cursorId"` CursorNotFound bool `json:"cursorNotFound"` QueryFailure bool `json:"queryFailure"` ShardConfigStale bool `json:"shardConfigStale"` AwaitCapable bool `json:"awaitCapable"` PromoteLongs bool `json:"promoteLongs"` PromoteValues bool `json:"promoteValues"` PromoteBuffers bool `json:"promoteBuffers"` StartingFrom int `json:"startingFrom"` NumberReturned int `json:"numberReturned"` Raw UpsertMessageData `json:"raw"` Data UpsertMessageData `json:"data"` Options UpsertMessageOptions `json:"opts"` Documents []Document `json:"documents"` }
type UpsertMessageData ¶
type UpsertMessageData struct { Type UpsertMessageDataType `json:"type"` Data []byte `json:"data"` }
type UpsertMessageDataType ¶
type UpsertMessageDataType string
const (
UpsertMessageDataTypeBuffer UpsertMessageDataType = "Buffer"
)
type UpsertMessageOptions ¶
type Wall ¶
type Wall struct { Object Destructible }
type WorldStatus ¶
type WorldStatus string
Click to show internal directories.
Click to hide internal directories.