Documentation ¶
Overview ¶
Package rep provides enumerations and types to model data structures of StarCraft II replays (*.SC2Replay) decoded by the s2prot package.
The type that models a replay (and everything in it) is Rep.
For usage example and information sources, see the package doc of s2prot.
Index ¶
- Constants
- Variables
- func MPQ(r *Rep) *mpq.MPQ
- type AttrEvts
- type BnetLang
- type CacheHandle
- type Color
- type Control
- type Details
- func (d *Details) CacheHandles() []*CacheHandle
- func (d *Details) CampaignIndex() int64
- func (d *Details) DefaultDifficulty() int64
- func (d *Details) Description() string
- func (d *Details) Difficulty() int64
- func (d *Details) GameSpeed() *GameSpeed
- func (d *Details) ImageFilePath() string
- func (d *Details) IsBlizzardMap() bool
- func (d *Details) MapFileName() string
- func (d *Details) Matchup() string
- func (d *Details) MiniSave() bool
- func (d *Details) ModPaths() interface{}
- func (d *Details) Players() []Player
- func (d *Details) RestartAsTransitionMap() bool
- func (d *Details) ThumbnailFile() string
- func (d *Details) Time() time.Time
- func (d *Details) TimeLocalOffset() time.Duration
- func (d *Details) TimeUTC() time.Time
- func (d *Details) Title() string
- type Enum
- type ExpLevel
- type GameDescription
- func (g *GameDescription) CacheHandles() []*CacheHandle
- func (g *GameDescription) DefaultAIBuild() int64
- func (g *GameDescription) DefaultDifficulty() int64
- func (g *GameDescription) ExpLevel() *ExpLevel
- func (g *GameDescription) GameCacheName() string
- func (g *GameDescription) GameSpeed() *GameSpeed
- func (g *GameDescription) GameType() int64
- func (g *GameDescription) HasExtensionMod() bool
- func (g *GameDescription) HasNonBlizzardExtensionMod() bool
- func (g *GameDescription) IsBlizzardMap() bool
- func (g *GameDescription) IsCoopMode() bool
- func (g *GameDescription) IsPremadeFFA() bool
- func (g *GameDescription) MapAuthorName() string
- func (g *GameDescription) MapFileName() string
- func (g *GameDescription) MapFileSyncChecksum() int64
- func (g *GameDescription) MapSizeX() int64
- func (g *GameDescription) MapSizeY() int64
- func (g *GameDescription) MaxColors() int64
- func (g *GameDescription) MaxControls() int64
- func (g *GameDescription) MaxObservers() int64
- func (g *GameDescription) MaxPlayers() int64
- func (g *GameDescription) MaxRaces() int64
- func (g *GameDescription) MaxTeams() int64
- func (g *GameDescription) MaxUsers() int64
- func (g *GameDescription) ModFileSyncChecksum() int64
- func (g *GameDescription) RandomValue() int64
- func (g *GameDescription) Region() *Region
- func (g *GameDescription) SlotDescriptions() []SlotDescription
- type GameMode
- type GameOptions
- func (g *GameOptions) AdvancedSharedControl() bool
- func (g *GameOptions) Amm() bool
- func (g *GameOptions) BattleNet() bool
- func (g *GameOptions) ClientDebugFlags() int64
- func (g *GameOptions) CompetitiveOrRanked() bool
- func (g *GameOptions) Cooperative() bool
- func (g *GameOptions) Fog() int64
- func (g *GameOptions) HeroDuplicatesAllowed() bool
- func (g *GameOptions) LockTeams() bool
- func (g *GameOptions) NoVictoryOrDefeat() bool
- func (g *GameOptions) Observers() int64
- func (g *GameOptions) Practice() bool
- func (g *GameOptions) RandomRaces() bool
- func (g *GameOptions) TeamsTogether() bool
- func (g *GameOptions) UserDifficulty() int64
- type GameSpeed
- type Header
- func (h *Header) BaseBuild() int64
- func (h *Header) DataBuildNum() int64
- func (h *Header) Duration() time.Duration
- func (h *Header) Loops() int64
- func (h *Header) NgdpRootKey() string
- func (h *Header) ReplayCompatibilityHash() string
- func (h *Header) Signature() string
- func (h *Header) Type() int64
- func (h *Header) UseScaledTime() bool
- func (h *Header) Version() Version
- func (h *Header) VersionString() string
- type InitData
- type League
- type LobbyState
- func (l *LobbyState) DefaultAIBuild() int64
- func (l *LobbyState) DefaultDifficulty() int64
- func (l *LobbyState) GameDuration() int64
- func (l *LobbyState) HostUserID() int64
- func (l *LobbyState) IsSinglePlayer() bool
- func (l *LobbyState) MaxObservers() int64
- func (l *LobbyState) MaxUsers() int64
- func (l *LobbyState) Phase() int64
- func (l *LobbyState) PickedMapTag() int64
- func (l *LobbyState) RandomSeed() int64
- type MetaPlayer
- type Metadata
- type Observe
- type Player
- func (p *Player) Control() *Control
- func (p *Player) Handicap() int64
- func (p *Player) Hero() string
- func (p *Player) Observe() *Observe
- func (p *Player) Race() *Race
- func (p *Player) RaceString() string
- func (p *Player) Result() *Result
- func (p *Player) TeamID() int64
- func (p *Player) WorkingSetSlotID() int64
- type PlayerDesc
- type Race
- type Realm
- type Region
- type Rep
- type Result
- type Slot
- func (s *Slot) AIBuild() int64
- func (s *Slot) Artifacts() []interface{}
- func (s *Slot) ColorPrefColor() *Color
- func (s *Slot) Commander() string
- func (s *Slot) CommanderLevel() int64
- func (s *Slot) CommanderMasteryLevel() int64
- func (s *Slot) CommanderMasteryTalents() []interface{}
- func (s *Slot) Control() *Control
- func (s *Slot) Difficulty() int64
- func (s *Slot) Handicap() int64
- func (s *Slot) HasSilencePenalty() bool
- func (s *Slot) Hero() string
- func (s *Slot) Licenses() []interface{}
- func (s *Slot) LogoIndex() int64
- func (s *Slot) Mount() string
- func (s *Slot) Observe() *Observe
- func (s *Slot) RacePrefRace() *Race
- func (s *Slot) Rewards() []interface{}
- func (s *Slot) Skin() string
- func (s *Slot) TandemID() int64
- func (s *Slot) TandemLeaderUserID() int64
- func (s *Slot) TeamID() int64
- func (s *Slot) ToonHandle() string
- func (s *Slot) UserID() int64
- func (s *Slot) WorkingSetSlotID() int64
- type SlotDescription
- func (s *SlotDescription) AllowedAIBuilds() s2prot.BitArr
- func (s *SlotDescription) AllowedColors() s2prot.BitArr
- func (s *SlotDescription) AllowedControls() s2prot.BitArr
- func (s *SlotDescription) AllowedDifficulty() s2prot.BitArr
- func (s *SlotDescription) AllowedObserveTypes() s2prot.BitArr
- func (s *SlotDescription) AllowedRaces() s2prot.BitArr
- type Toon
- type TrackerEvts
- type UserInitData
- func (u *UserInitData) ClanTag() string
- func (u *UserInitData) CombinedRaceLevels() int64
- func (u *UserInitData) CustomInterface() bool
- func (u *UserInitData) Examine() bool
- func (u *UserInitData) Hero() string
- func (u *UserInitData) HighestLeague() *League
- func (u *UserInitData) MMR() int64
- func (u *UserInitData) Mount() string
- func (u *UserInitData) Name() string
- func (u *UserInitData) Observe() *Observe
- func (u *UserInitData) RacePreferenceRace() int64
- func (u *UserInitData) RandomSeed() int64
- func (u *UserInitData) Skin() string
- func (u *UserInitData) TeamPreferenceTeam() int64
- func (u *UserInitData) TestAuto() bool
- func (u *UserInitData) TestMap() bool
- func (u *UserInitData) TestType() int64
- func (u *UserInitData) ToonHandle() string
- type Version
Constants ¶
const ( // TrackerEvtIDPlayerStats is the ID of the Player Stats tracker event TrackerEvtIDPlayerStats = 0 // TrackerEvtIDUnitBorn is the ID of the Unit Born tracker event TrackerEvtIDUnitBorn = 1 // TrackerEvtIDPlayerSetup is the ID of the Player Setup tracker event TrackerEvtIDPlayerSetup = 9 )
const ( GmEIdPlayerLeave = 25 // PlayerLeave game event id [ONLY UP TO BASEBUILD 23260; REPLACED BY USERLEAVE] GmEIdCmd = 27 // CmdEvent game event id GmEIdSelDelta = 28 // SelectionDelta game event id GmEIdCtrlGroupUpdate = 29 // ControlGroupUpdate game event id GmEIdCamUpdate = 49 // CameraUpdate game event id GmEIdUsrLeave = 101 // UserLeave game event id [ONLY FROM BASEBUILD 24764; REPLACES PLAYERLEAVE] )
Game event ids
const ( MsgEIdChat = 0 // ChatMessage message event id MsgEIdPing = 1 // PingMessage message event id )
Message event ids
const (
// ParserVersion is a Semver2 compatible version of the parser.
ParserVersion = "v1.3.0"
)
const (
TrEIdPlayerSetup = 9 // PlayerSetup tracker event id [ONLY FROM BASEBUILD 27950]
)
Tracker event ids
Variables ¶
var ( // ErrInvalidRepFile means invalid replay file. ErrInvalidRepFile = errors.New("Invalid SC2Replay file") // ErrUnsupportedRepVersion means the replay file is valid but its version is not supported. ErrUnsupportedRepVersion = errors.New("Unsupported replay version") // ErrDecoding means decoding the replay file failed, // Most likely because replay file is invalid, but also might be due to an implementation bug ErrDecoding = errors.New("Decoding error") )
var ( GameModeAutoMM = GameModes[0] GameModePrivate = GameModes[1] GameModePublic = GameModes[2] GameModeSinglePlayer = GameModes[3] GameModeUnknown = GameModes[4] )
Named game modes.
var ( GameSpeedSlower = GameSpeeds[0] GameSpeedSlow = GameSpeeds[1] GameSpeedNormal = GameSpeeds[2] GameSpeedFast = GameSpeeds[3] GameSpeedFaster = GameSpeeds[4] GameSpeedUnknown = GameSpeeds[5] )
Named game speeds.
var ( RaceTerran = Races[0] RaceZerg = Races[1] RaceProtoss = Races[2] RaceRandom = Races[3] RaceUnknown = Races[4] )
Named races.
var ( ResultUnknown = Results[0] ResultVictory = Results[1] ResultDefeat = Results[2] ResultTie = Results[3] )
Named results.
var ( ControlOpen = Controls[0] ControlClosed = Controls[1] ControlHuman = Controls[2] ControlComputer = Controls[3] ControlUnknown = Controls[4] )
Named controls.
var ( ObserveParticipant = Observes[0] ObserveSpectator = Observes[1] // Can only talk to other observers. ObserveReferee = Observes[2] // Can talk to players as well. ObserveUnknown = Observes[3] )
Named observes.
var ( ColorUnknown = Colors[0] ColorRed = Colors[1] ColorBlue = Colors[2] ColorTeal = Colors[3] ColorPurple = Colors[4] ColorYellow = Colors[5] ColorOrange = Colors[6] ColorGreen = Colors[7] ColorLightPink = Colors[8] ColorViolet = Colors[9] ColorLightGray = Colors[10] ColorDarkGreen = Colors[11] ColorBrown = Colors[12] ColorLightGreen = Colors[13] ColorDarkGray = Colors[14] ColorPink = Colors[15] )
Named colors.
var ( LeagueUnknown = Leagues[0] LeagueBronze = Leagues[1] LeagueSilver = Leagues[2] LeagueGold = Leagues[3] LeaguePlatinum = Leagues[4] LeagueDiamond = Leagues[5] LeagueMaster = Leagues[6] LeagueGrandmaster = Leagues[7] LeagueUnranked = Leagues[8] )
Named leagues.
var ( BnetLangEnglish = BnetLangs[0] BnetLangChineseTraditional = BnetLangs[1] BnetLangFrench = BnetLangs[2] BnetLangGerman = BnetLangs[3] BnetLangItalian = BnetLangs[4] BnetLangKorean = BnetLangs[5] BnetLangPolish = BnetLangs[6] BnetLangPortuguese = BnetLangs[7] BnetLangRussian = BnetLangs[8] BnetLangSpanish = BnetLangs[9] )
Named Battle.net languages.
var ( RealmNorthAmerica = Realms[0] RealmLatinAmerica = Realms[1] RealmChina = Realms[2] RealmEurope = Realms[3] RealmRussia = Realms[4] RealmKorea = Realms[5] RealmTaiwan = Realms[6] RealmSEA = Realms[7] RealmUnknown = Realms[8] )
Named realms.
var ( RegionUnknown = Regions[0] RegionUS = Regions[1] RegionEU = Regions[2] RegionKR = Regions[3] RegionSEA = Regions[4] RegionCN = Regions[5] RegionPublicTest = Regions[6] RegionPublicTest2 = Regions[7] )
Named regions.
var ( ExpLevelLotV = ExpLevels[0] ExpLevelHotS = ExpLevels[1] ExpLevelWoL = ExpLevels[2] ExpLevelUnknown = ExpLevels[3] )
Named expansion levels.
var BnetLangs = []*BnetLang{ {Enum{"English"}, "en"}, {Enum{"Chinese (Traditional)"}, "zn"}, {Enum{"French"}, "fr"}, {Enum{"German"}, "de"}, {Enum{"Italian"}, "it"}, {Enum{"Korean"}, "ko"}, {Enum{"Polish"}, "pl"}, {Enum{"Portuguese"}, "pt"}, {Enum{"Russian"}, "ru"}, {Enum{"Spanish"}, "es"}, }
BnetLangs is the slice of all Battle.net languages.
var Colors = []*Color{ {Enum: Enum{"Unknown"}, RGB: [3]byte{0, 0, 0}}, {Enum: Enum{"Red"}, RGB: [3]byte{180, 20, 30}}, {Enum: Enum{"Blue"}, RGB: [3]byte{0, 66, 255}}, {Enum: Enum{"Teal"}, RGB: [3]byte{28, 167, 234}}, {Enum: Enum{"Purple"}, RGB: [3]byte{84, 0, 129}}, {Enum: Enum{"Yellow"}, RGB: [3]byte{235, 225, 41}}, {Enum: Enum{"Orange"}, RGB: [3]byte{254, 138, 14}}, {Enum: Enum{"Green"}, RGB: [3]byte{22, 128, 0}}, {Enum: Enum{"Light Pink"}, RGB: [3]byte{204, 166, 252}}, {Enum: Enum{"Violet"}, RGB: [3]byte{31, 1, 201}}, {Enum: Enum{"Light Gray"}, RGB: [3]byte{82, 84, 148}}, {Enum: Enum{"Dark Green"}, RGB: [3]byte{16, 98, 70}}, {Enum: Enum{"Brown"}, RGB: [3]byte{78, 42, 4}}, {Enum: Enum{"Light Green"}, RGB: [3]byte{150, 255, 145}}, {Enum: Enum{"Dark Gray"}, RGB: [3]byte{35, 35, 35}}, {Enum: Enum{"Pink"}, RGB: [3]byte{229, 91, 176}}, }
Colors is the slice of all colors, index used in InitData["lobbyState"]["slots"]["colorPref"]["color"]
var Controls = []*Control{ {Enum{"Open"}, "Open"}, {Enum{"Closed"}, "Clsd"}, {Enum{"Human"}, "Humn"}, {Enum{"Computer"}, "Comp"}, {Enum{"Unknown"}, ""}, }
Controls is the slice of all control, index used in InitData["lobbyState"]["slots"]["control"] and in Details["playerList"]["control"]
var ExpLevels = []*ExpLevel{ {Enum{"LotV"}, "Legacy of the Void", "d92dfc48c484c59154270b924ad7d57484f2ab9a47621c7ab16431bf66c53b40"}, {Enum{"HotS"}, "Heart of the Swarm", "66093832128453efffbb787c80b7d3eec1ad81bde55c83c930dea79c4e505a04"}, {Enum{"WoL"}, "Wings of Liberty", "421c8aa0f3619b652d23a2735dfee812ab644228235e7a797edecfe8b67da30e"}, {Enum{"Unknown"}, "Unknown", ""}, }
ExpLevels is the slice of all expansion levels.
var GameModes = []*GameMode{ {Enum{"AutoMM"}, "Amm"}, {Enum{"Private"}, "Priv"}, {Enum{"Public"}, "Pub"}, {Enum{"Single Player"}, ""}, {Enum{"Unknown"}, "<>"}, }
GameModes is the slice of all game modes.
var GameSpeeds = []*GameSpeed{ {Enum{"Slower"}, "Slor", 60}, {Enum{"Slow"}, "Slow", 45}, {Enum{"Normal"}, "Norm", 36}, {Enum{"Fast"}, "Fast", 30}, {Enum{"Faster"}, "Fasr", 26}, {Enum{"Unknown"}, "", 26}, }
GameSpeeds is the slice of all game speeds, index is used in Details["gameSpeed"]
var Leagues = []*League{ {Enum{"Unknown"}, '-'}, {Enum{"Bronze"}, 'B'}, {Enum{"Silver"}, 'S'}, {Enum{"Gold"}, 'G'}, {Enum{"Platinum"}, 'P'}, {Enum{"Diamond"}, 'D'}, {Enum{"Master"}, 'M'}, {Enum{"Grandmaster"}, 'R'}, {Enum{"Unranked"}, 'U'}, }
Leagues is the slice of all leagues.
var Observes = []*Observe{ {Enum{"Participant"}}, {Enum{"Spectator"}}, {Enum{"Referee"}}, {Enum{"Unknown"}}, }
Observes is the slice of all observes, index used in InitData["lobbyState"]["slots"]["observe"] and in Details["playerList"]["observe"]
var Races = []*Race{ {Enum{"Terran"}, 'T'}, {Enum{"Zerg"}, 'Z'}, {Enum{"Protoss"}, 'P'}, {Enum{"Random"}, 'R'}, {Enum{"Unknown"}, '-'}, }
Races is the slice of all races.
var Realms = []*Realm{ {Enum{"North America"}}, {Enum{"Latin America"}}, {Enum{"China"}}, {Enum{"Europe"}}, {Enum{"Russia"}}, {Enum{"Korea"}}, {Enum{"Taiwan"}}, {Enum{"SEA"}}, {Enum{"Unknown"}}, }
Realms is the slice of all realms.
var Regions = []*Region{ {Enum{"Unknown"}, "", mustPU("http://unknown.depot.battle.net:1119/"), mustPU("http://unknown.battle.net/"), []*Realm{}, []*BnetLang{BnetLangEnglish}}, {Enum{"US"}, "US", mustPU("https://us-s2-depot.classic.blizzard.com/"), mustPU("http://us.battle.net/"), []*Realm{RealmNorthAmerica, RealmLatinAmerica}, []*BnetLang{BnetLangEnglish, BnetLangSpanish, BnetLangPortuguese}}, {Enum{"Europe"}, "EU", mustPU("https://eu-s2-depot.classic.blizzard.com/"), mustPU("http://eu.battle.net/"), []*Realm{RealmEurope, RealmRussia}, []*BnetLang{BnetLangEnglish, BnetLangGerman, BnetLangFrench, BnetLangSpanish, BnetLangRussian, BnetLangItalian, BnetLangPolish}}, {Enum{"Korea"}, "KR", mustPU("https://kr-s2-depot.classic.blizzard.com/"), mustPU("http://kr.battle.net/"), []*Realm{RealmKorea, RealmTaiwan}, []*BnetLang{BnetLangKorean, BnetLangChineseTraditional}}, {Enum{"SEA"}, "SG", mustPU("http://sg.depot.battle.net:1119/"), mustPU("http://sea.battle.net/"), []*Realm{RealmSEA}, []*BnetLang{BnetLangEnglish}}, {Enum{"China"}, "CN", mustPU("http://cn-s2-depot.battlenet.com.cn/"), mustPU("http://www.battlenet.com.cn/"), []*Realm{RealmChina}, []*BnetLang{BnetLangChineseTraditional}}, {Enum{"Public Test"}, "XX", mustPU("http://xx.depot.battle.net:1119/"), mustPU("http://us.battle.net/"), []*Realm{}, []*BnetLang{BnetLangEnglish}}, {Enum{"Public Test"}, "XX", mustPU("http://xx.depot.battle.net:1119/"), mustPU("http://us.battle.net/"), []*Realm{}, []*BnetLang{BnetLangEnglish}}, }
Regions is the slice of all regions, index used in Details["playerList"]["toon"]["region"]
var Results = []*Result{ {Enum{"Unknown"}, '-'}, {Enum{"Victory"}, 'V'}, {Enum{"Defeat"}, 'D'}, {Enum{"Tie"}, 'T'}, }
Results is the slice of all results, index used in Details["playerList"]["result"]
Functions ¶
Types ¶
type AttrEvts ¶ added in v1.1.0
AttrEvts contains game attributes.
func NewAttrEvts ¶ added in v1.2.0
NewAttrEvts creates a new attributes events from the specified Struct.
func (*AttrEvts) MapNamespace ¶ added in v1.1.0
MapNamespace returns the map namespace.
type CacheHandle ¶
type CacheHandle struct { Type string // Type of the resource, file extension. Region *Region // Region the resouce poins to. Digest string // Hexadecimal representation of the SHA-256 digest of the content of the denoted resource. }
CacheHandle is the identifier of a remote resource. A cache hande is a dependency.
func (*CacheHandle) FileName ¶
func (c *CacheHandle) FileName() string
FileName returns the file name denoted by the cache handle (with extension).
func (*CacheHandle) RelativeFile ¶
func (c *CacheHandle) RelativeFile() string
RelativeFile returns the file denoted by the cache handle relative to the local cache folder.
func (*CacheHandle) StandardData ¶
func (c *CacheHandle) StandardData() string
StandardData returns the content of the resource denoted by the cache handle if this is a standard data.
type Color ¶
type Color struct { Enum RGB [3]byte // Color value, RGB components. Darker [3]byte // Darker version of the color's RGB values. Lighter [3]byte // Lighter versions of the color's RGB values. // contains filtered or unexported fields }
Color type.
type Details ¶
Details describles the game details (overall replay details).
func (*Details) CacheHandles ¶
func (d *Details) CacheHandles() []*CacheHandle
CacheHandles returns the array of cache handles.
func (*Details) CampaignIndex ¶
CampaignIndex returns the campaign index.
func (*Details) DefaultDifficulty ¶
DefaultDifficulty returns the default difficulty.
func (*Details) Description ¶
Description returns the description.
func (*Details) Difficulty ¶
Difficulty returns the difficulty.
func (*Details) ImageFilePath ¶
ImageFilePath returns the image file path.
func (*Details) IsBlizzardMap ¶
IsBlizzardMap tells if the map is an official Blizzard map.
func (*Details) MapFileName ¶
MapFileName returns the name of the map file.
func (*Details) Matchup ¶ added in v1.1.0
Matchup returns the matchup, the race letters of players in team order, inserting 'v' between different teams, e.g. "PvT" or "PTZvZTP".
func (*Details) RestartAsTransitionMap ¶
RestartAsTransitionMap returns if restart as transition map.
func (*Details) ThumbnailFile ¶
ThumbnailFile returns the map thumbnail file name.
func (*Details) TimeLocalOffset ¶
TimeLocalOffset returns the local time offset of the playing who saved the replay.
type ExpLevel ¶ added in v1.1.0
type ExpLevel struct { Enum FullName string // Full (long) name of the expansion level Digest string // Cache handle digest that identifies (defines) the expansion level }
ExpLevel is the type of Expansion level.
type GameDescription ¶
type GameDescription struct { s2prot.Struct GameOptions GameOptions // contains filtered or unexported fields }
GameDescription is the game description
func (*GameDescription) CacheHandles ¶
func (g *GameDescription) CacheHandles() []*CacheHandle
CacheHandles returns the array of cache handles.
func (*GameDescription) DefaultAIBuild ¶
func (g *GameDescription) DefaultAIBuild() int64
DefaultAIBuild returns the default AI build.
func (*GameDescription) DefaultDifficulty ¶
func (g *GameDescription) DefaultDifficulty() int64
DefaultDifficulty returns the default difficulty.
func (*GameDescription) ExpLevel ¶ added in v1.1.0
func (g *GameDescription) ExpLevel() *ExpLevel
ExpLevel returns the expansion level of the replay.
func (*GameDescription) GameCacheName ¶
func (g *GameDescription) GameCacheName() string
GameCacheName returns the game cache name.
func (*GameDescription) GameSpeed ¶
func (g *GameDescription) GameSpeed() *GameSpeed
GameSpeed returns the game speed.
func (*GameDescription) GameType ¶
func (g *GameDescription) GameType() int64
GameType returns the game type.
func (*GameDescription) HasExtensionMod ¶
func (g *GameDescription) HasExtensionMod() bool
HasExtensionMod returns if the game has extension mod.
func (*GameDescription) HasNonBlizzardExtensionMod ¶
func (g *GameDescription) HasNonBlizzardExtensionMod() bool
HasNonBlizzardExtensionMod returns if the game has non-Blizzard extension mod.
func (*GameDescription) IsBlizzardMap ¶
func (g *GameDescription) IsBlizzardMap() bool
IsBlizzardMap tells if the map is an official Blizzard map.
func (*GameDescription) IsCoopMode ¶
func (g *GameDescription) IsCoopMode() bool
IsCoopMode tells if the game is coop mode.
func (*GameDescription) IsPremadeFFA ¶
func (g *GameDescription) IsPremadeFFA() bool
IsPremadeFFA tells if the game is pre-made FFA.
func (*GameDescription) MapAuthorName ¶
func (g *GameDescription) MapAuthorName() string
MapAuthorName returns the name of the map author.
func (*GameDescription) MapFileName ¶
func (g *GameDescription) MapFileName() string
MapFileName returns the name of the map file.
func (*GameDescription) MapFileSyncChecksum ¶
func (g *GameDescription) MapFileSyncChecksum() int64
MapFileSyncChecksum returns the map file sync checksum.
func (*GameDescription) MapSizeX ¶
func (g *GameDescription) MapSizeX() int64
MapSizeX returns the map width.
func (*GameDescription) MapSizeY ¶
func (g *GameDescription) MapSizeY() int64
MapSizeY returns the map height.
func (*GameDescription) MaxColors ¶
func (g *GameDescription) MaxColors() int64
MaxColors returns the max colors.
func (*GameDescription) MaxControls ¶
func (g *GameDescription) MaxControls() int64
MaxControls returns the max controls.
func (*GameDescription) MaxObservers ¶
func (g *GameDescription) MaxObservers() int64
MaxObservers returns the max observers.
func (*GameDescription) MaxPlayers ¶
func (g *GameDescription) MaxPlayers() int64
MaxPlayers returns the max players.
func (*GameDescription) MaxRaces ¶
func (g *GameDescription) MaxRaces() int64
MaxRaces returns the max races.
func (*GameDescription) MaxTeams ¶
func (g *GameDescription) MaxTeams() int64
MaxTeams returns the max teams.
func (*GameDescription) MaxUsers ¶
func (g *GameDescription) MaxUsers() int64
MaxUsers returns the max users.
func (*GameDescription) ModFileSyncChecksum ¶
func (g *GameDescription) ModFileSyncChecksum() int64
ModFileSyncChecksum returns the mod file sync checksum.
func (*GameDescription) RandomValue ¶
func (g *GameDescription) RandomValue() int64
RandomValue returns the random value.
func (*GameDescription) Region ¶ added in v1.1.0
func (g *GameDescription) Region() *Region
Region returns the region of the replay.
func (*GameDescription) SlotDescriptions ¶
func (g *GameDescription) SlotDescriptions() []SlotDescription
SlotDescriptions returns the array of slot descriptions.
type GameMode ¶ added in v1.1.0
type GameMode struct { Enum // contains filtered or unexported fields }
GameMode is the game mode type
type GameOptions ¶
GameOptions is the game options
func (*GameOptions) AdvancedSharedControl ¶
func (g *GameOptions) AdvancedSharedControl() bool
AdvancedSharedControl returns if advanced shared control.
func (*GameOptions) Amm ¶
func (g *GameOptions) Amm() bool
Amm returns if AMM (AutoMM - Automated Match Making).
func (*GameOptions) BattleNet ¶
func (g *GameOptions) BattleNet() bool
BattleNet returns if game was played on Battle.net.
func (*GameOptions) ClientDebugFlags ¶
func (g *GameOptions) ClientDebugFlags() int64
ClientDebugFlags returns the client debug flags.
func (*GameOptions) CompetitiveOrRanked ¶
func (g *GameOptions) CompetitiveOrRanked() bool
CompetitiveOrRanked returns if game is competitive or if that property is not present if ranked. Competitive means either ranked or unranked. Before competitive there was no unraked type (so ranked="ladder").
func (*GameOptions) Cooperative ¶
func (g *GameOptions) Cooperative() bool
Cooperative returns if cooperative.
func (*GameOptions) HeroDuplicatesAllowed ¶
func (g *GameOptions) HeroDuplicatesAllowed() bool
HeroDuplicatesAllowed returns if hero duplicates are allowed.
func (*GameOptions) LockTeams ¶
func (g *GameOptions) LockTeams() bool
LockTeams returns if teams are locked.
func (*GameOptions) NoVictoryOrDefeat ¶
func (g *GameOptions) NoVictoryOrDefeat() bool
NoVictoryOrDefeat returns if no victory or defeat.
func (*GameOptions) Observers ¶
func (g *GameOptions) Observers() int64
Observers returns the observers.
func (*GameOptions) RandomRaces ¶
func (g *GameOptions) RandomRaces() bool
RandomRaces returns if random races.
func (*GameOptions) TeamsTogether ¶
func (g *GameOptions) TeamsTogether() bool
TeamsTogether returns if teams together.
func (*GameOptions) UserDifficulty ¶
func (g *GameOptions) UserDifficulty() int64
UserDifficulty returns the user difficulty.
type GameSpeed ¶
type GameSpeed struct { Enum RelSpeed int // Relative speed compared to Normal // contains filtered or unexported fields }
GameSpeed is the game speed type
type Header ¶
Header describes the replay header (replay game version and length).
func (*Header) DataBuildNum ¶
DataBuildNum returns the data build number.
func (*Header) NgdpRootKey ¶
NgdpRootKey returns the data ngdp root key.
func (*Header) ReplayCompatibilityHash ¶
ReplayCompatibilityHash returns the replay compatibility hash.
func (*Header) Signature ¶
Signature returns the header signature. Should always be "StarCratII replay\u001b11".
func (*Header) UseScaledTime ¶
UseScaledTime returns whether scaled time is used.
func (*Header) VersionString ¶
VersionString returns the full version string in the form of "major.minor.revision.build".
type InitData ¶
type InitData struct { s2prot.Struct GameDescription GameDescription `json:"-"` // Game description LobbyState LobbyState `json:"-"` // Lobby state UserInitDatas []UserInitData `json:"-"` // Array User init data structs }
InitData describes the init data (the initial lobby).
func NewInitData ¶ added in v1.2.0
NewInitData creates a new init data from the specified Struct.
type League ¶
type League struct { Enum Letter rune // League letter (first character of the English name except 'R' for LeagueGrandmaster and '-' for Unknown) }
League type.
type LobbyState ¶
LobbyState is the lobby state
func (*LobbyState) DefaultAIBuild ¶
func (l *LobbyState) DefaultAIBuild() int64
DefaultAIBuild returns the default AI build.
func (*LobbyState) DefaultDifficulty ¶
func (l *LobbyState) DefaultDifficulty() int64
DefaultDifficulty returns the default difficulty.
func (*LobbyState) GameDuration ¶
func (l *LobbyState) GameDuration() int64
GameDuration returns the game duration.
func (*LobbyState) HostUserID ¶
func (l *LobbyState) HostUserID() int64
HostUserID returns the host user ID.
func (*LobbyState) IsSinglePlayer ¶
func (l *LobbyState) IsSinglePlayer() bool
IsSinglePlayer tells if game is single player.
func (*LobbyState) MaxObservers ¶
func (l *LobbyState) MaxObservers() int64
MaxObservers returns the max observers.
func (*LobbyState) PickedMapTag ¶
func (l *LobbyState) PickedMapTag() int64
PickedMapTag returns the picked map tag.
func (*LobbyState) RandomSeed ¶
func (l *LobbyState) RandomSeed() int64
RandomSeed returns the random seed.
type MetaPlayer ¶
MetaPlayer describes a player in the metadata section.
func (*MetaPlayer) AssignedRace ¶
func (m *MetaPlayer) AssignedRace() string
AssignedRace returns the race string that was assigned to the player. It's a 4-letter prefix of the race (no Random), e.g. "Prot", "Terr", "Zerg".
func (*MetaPlayer) MMR ¶
func (m *MetaPlayer) MMR() float64
MMR returns the player's (race-specific) MMR value.
func (*MetaPlayer) Result ¶
func (m *MetaPlayer) Result() string
Result returns the result string. "Win" for win, "Loss" for loss, "Undecided" if unknown.
func (*MetaPlayer) SelectedRace ¶
func (m *MetaPlayer) SelectedRace() string
SelectedRace returns the player's selected race string. It's a 4-letter prefix of the race, e.g. "Rand", "Prot", "Terr", "Zerg".
type Metadata ¶
Metadata describes the game metadata (calculated, confirmed results).
func (*Metadata) BaseBuild ¶
BaseBuild returns the base build version string. This has a "Base" prefix to the base build number.
func (*Metadata) DurationSec ¶
DurationSec returns the game duration in seconds.
func (*Metadata) GameVersion ¶
GameVersion returns the game version string.
func (*Metadata) Players ¶
func (m *Metadata) Players() []MetaPlayer
Players returns the list of meta players.
type Player ¶
type Player struct { s2prot.Struct Name string // Name of the player. Contains optional clan tag. Toon Toon // Toon of the player. This is a unique identifier. Color [4]byte // Color of the player, ARGB components. A=255 means completely opaque, A=0 means completely transparent. // contains filtered or unexported fields }
Player (participant of the game). Includes computers players but excludes observers.
func (*Player) Observe ¶
Observe returns the observe. Not always accurate! Observe from slot (init data) should be used instead!
func (*Player) RaceString ¶
RaceString returns the localized race string.
func (*Player) TeamID ¶
TeamID returns the team ID. Not always accurate! Team ID from slot (init data) should be used instead!
func (*Player) WorkingSetSlotID ¶
WorkingSetSlotID returns the working set slot ID.
type PlayerDesc ¶ added in v1.2.0
type PlayerDesc struct { // PlayerID is the ID of the player this PlayerDesc belongs to. PlayerID int64 // SlotID is the slot ID of the player SlotID int64 // UserID is the user ID of the player UserID int64 // Start location of the player StartLocX, StartLocY int64 // StartDir is the start direction of the player, expressed in clock, // e.g. 1 o'clock, 3 o'clock etcc, in range of 1..12 StartDir int32 // SQ (Spending Quotient) of the player SQ int32 // SupplyCappedPercent is the supply-capped percent of the player SupplyCappedPercent int32 }
PlayerDesc contains calculated, derived data from tracker events.
type Region ¶
type Region struct { Enum Code string // 2-letter region code DepotURL *url.URL // Region's depot server URL BnetURL *url.URL // Region's Battle.net website Realms []*Realm // Realms of the region, index+1 used in Details["playerList"]["toon"]["realm"] BnetLangs []*BnetLang // Available languages of the region's web page, first is the default language }
Region is the type of SC2 Region.
type Rep ¶
type Rep struct { Header Header // Replay header (replay game version and length) Details Details // Game details (overall replay details) InitData InitData // Replay init data (the initial lobby) AttrEvts AttrEvts // Attributes events Metadata Metadata // Game metadata (calculated, confirmed results) GameEvts []s2prot.Event // Game events MessageEvts []s2prot.Event // Message events TrackerEvts *TrackerEvts // Tracker events GameEvtsErr bool // Tells if decoding game events had errors MessageEvtsErr bool // Tells if decoding message events had errors TrackerEvtsErr bool // Tells if decoding tracker events had errors // contains filtered or unexported fields }
Rep describes a replay.
func New ¶
func New(input io.ReadSeeker) (*Rep, error)
New returns a new Rep using the specified io.ReadSeeker as the SC2Replay file source. All types of events are decoded from the replay. The returned Rep must be closed with the Close method!
ErrInvalidRepFile is returned if the input is not a valid SC2Replay file content.
ErrUnsupportedRepVersion is returned if the input is a valid SC2Replay file but its version is not supported.
ErrDecoding is returned if decoding the replay fails. This is most likely because the input is invalid, but also might be due to an implementation bug.
func NewEvts ¶
func NewEvts(input io.ReadSeeker, game, message, tracker bool) (*Rep, error)
NewEvts returns a new Rep using the specified io.ReadSeeker as the SC2Replay file source, only the specified types of events decoded. The game, message and tracker tells if game events, message events and tracker events are to be decoded. Replay header, init data, details, attributes events and game metadata are always decoded. The returned Rep must be closed with the Close method!
ErrInvalidRepFile is returned if the input is not a valid SC2Replay file content.
ErrUnsupportedRepVersion is returned if the input is a valid SC2Replay file but its version is not supported.
ErrDecoding is returned if decoding the replay fails. This is most likely because the input is invalid, but also might be due to an implementation bug.
func NewFromFile ¶
NewFromFile returns a new Rep constructed from a file. All types of events are decoded from the replay. The returned Rep must be closed with the Close method!
ErrInvalidRepFile is returned if the specified name does not denote a valid SC2Replay file.
ErrUnsupportedRepVersion is returned if the file exists and is a valid SC2Replay file but its version is not supported.
ErrDecoding is returned if decoding the replay fails. This is most likely because the replay file is invalid, but also might be due to an implementation bug.
func NewFromFileEvts ¶
NewFromFileEvts returns a new Rep constructed from a file, only the specified types of events decoded. The game, message and tracker tells if game events, message events and tracker events are to be decoded. Replay header, init data, details, attributes events and game metadata are always decoded. The returned Rep must be closed with the Close method!
ErrInvalidRepFile is returned if the specified name does not denote a valid SC2Replay file.
ErrUnsupportedRepVersion is returned if the file exists and is a valid SC2Replay file but its version is not supported.
ErrDecoding is returned if decoding the replay fails. This is most likely because the replay file is invalid, but also might be due to an implementation bug.
type Slot ¶
Slot describes a slot
func (*Slot) Artifacts ¶
func (s *Slot) Artifacts() []interface{}
Artifacts returns the array of artifacts. The array has elements of type string.
func (*Slot) ColorPrefColor ¶
ColorPrefColor returns the color preference color.
func (*Slot) CommanderLevel ¶
CommanderLevel returns the commander level.
func (*Slot) CommanderMasteryLevel ¶
CommanderMasteryLevel returns the commander mastery level.
func (*Slot) CommanderMasteryTalents ¶
func (s *Slot) CommanderMasteryTalents() []interface{}
CommanderMasteryTalents returns the array of commander mastery talents. The array has elements of type int64.
func (*Slot) HasSilencePenalty ¶
HasSilencePenalty returns if there is slience penalty.
func (*Slot) Licenses ¶
func (s *Slot) Licenses() []interface{}
Licenses returns the array of licenses. The array has elements of type int64.
func (*Slot) RacePrefRace ¶
RacePrefRace returns the race preference race. This may be RaceRandom.
func (*Slot) Rewards ¶
func (s *Slot) Rewards() []interface{}
Rewards returns the array of rewards. The array has elements of type int64.
func (*Slot) TandemLeaderUserID ¶
TandemLeaderUserID returns the tandem leader user ID (in case of Archon mode games).
func (*Slot) WorkingSetSlotID ¶
WorkingSetSlotID returns the working set slot ID.
type SlotDescription ¶
SlotDescription is the slot description
func (*SlotDescription) AllowedAIBuilds ¶
func (s *SlotDescription) AllowedAIBuilds() s2prot.BitArr
AllowedAIBuilds returns the allowed AI builds bitmap.
func (*SlotDescription) AllowedColors ¶
func (s *SlotDescription) AllowedColors() s2prot.BitArr
AllowedColors returns the allowed colors bitmap.
func (*SlotDescription) AllowedControls ¶
func (s *SlotDescription) AllowedControls() s2prot.BitArr
AllowedControls returns the allowed controls bitmap.
func (*SlotDescription) AllowedDifficulty ¶
func (s *SlotDescription) AllowedDifficulty() s2prot.BitArr
AllowedDifficulty returns the allowed difficulty bitmap.
func (*SlotDescription) AllowedObserveTypes ¶
func (s *SlotDescription) AllowedObserveTypes() s2prot.BitArr
AllowedObserveTypes returns the allowed observe types bitmap.
func (*SlotDescription) AllowedRaces ¶
func (s *SlotDescription) AllowedRaces() s2prot.BitArr
AllowedRaces returns the allowed races bitmap.
type Toon ¶
Toon - a unique identifier (of a player)
func (*Toon) ProgramID ¶
ProgramID returns the program ID, always "S2", leading zeros will be stripped.
type TrackerEvts ¶ added in v1.2.0
type TrackerEvts struct { // Evts contains the tracker events Evts []s2prot.Event // PIDPlayerDescMap is a PlayerDesc map mapped from player ID. PIDPlayerDescMap map[int64]*PlayerDesc // ToonPlayerDescMap is a PlayerDesc map mapped from toon. ToonPlayerDescMap map[string]*PlayerDesc `json:"-"` }
TrackerEvts contains tracker events and some metrics and data calculated from them.
type UserInitData ¶
type UserInitData struct { s2prot.Struct ClanLogo *CacheHandle // Cache handle of the clan logo image resource }
UserInitData describes user initial data
func (*UserInitData) ClanTag ¶
func (u *UserInitData) ClanTag() string
ClanTag returns the clan tag.
func (*UserInitData) CombinedRaceLevels ¶
func (u *UserInitData) CombinedRaceLevels() int64
CombinedRaceLevels returns the combined race levels.
func (*UserInitData) CustomInterface ¶
func (u *UserInitData) CustomInterface() bool
CustomInterface tells if custom interface.
func (*UserInitData) HighestLeague ¶
func (u *UserInitData) HighestLeague() *League
HighestLeague returns the highest league.
func (*UserInitData) MMR ¶ added in v1.5.0
func (u *UserInitData) MMR() int64
MMR returns the mmr for the handle if set
func (*UserInitData) Observe ¶
func (u *UserInitData) Observe() *Observe
Observe returns the observe.
func (*UserInitData) RacePreferenceRace ¶
func (u *UserInitData) RacePreferenceRace() int64
RacePreferenceRace returns the race preference race.
func (*UserInitData) RandomSeed ¶
func (u *UserInitData) RandomSeed() int64
RandomSeed returns the random seed.
func (*UserInitData) TeamPreferenceTeam ¶
func (u *UserInitData) TeamPreferenceTeam() int64
TeamPreferenceTeam returns the team preference team.
func (*UserInitData) TestType ¶
func (u *UserInitData) TestType() int64
TestType returns the test type.
func (*UserInitData) ToonHandle ¶
func (u *UserInitData) ToonHandle() string
ToonHandle returns the toon handle.
type Version ¶
Version of the replay.