yasha

package module
v0.0.0-...-61b571f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2015 License: MIT Imports: 17 Imported by: 3

README

Yasha

Build Status

Dota 2 (Source 1) replay parser written in Go, extracted from Dotabuff TrueSight.

We're working on both maintaining the parser for replays of both Source 1 and Source 2 Engines.

About Source 1

This parser is able to parse replays recorded since about 2012.

About Source 2

The upcoming Source 2 Engine requires several incompatible changes, so we work on it in a separate repository.

See also Manta, the Dota 2 (Source 2) parser

Installation

Simple as:

$ go get github.com/dotabuff/yasha

And in your code:

import "github.com/dotabuff/yasha"

Please be aware that you can't import Sange and Yasha in the same binary! The Protocol Buffer definitions conflict, and will panic.

Test Coverage

Yasha is a dependency of and was extracted from Dotabuff TrueSight. Test coverage is currently upstream. We'll be working to implement comprehensive testing in both Yasha and Sange and are especially grateful for contributions in this area.

Usage

See the examples directory.

License

MIT, see the LICENSE file.

Help

If you have any questions, just ask manveru in the #dota2replay channel on QuakeNet.

Documentation

Overview

NOTE: This file is generated by update_pbem.rb

Index

Constants

View Source
const (
	CoordIntegerBits    = 14
	CoordFractionalBits = 5
	CoordDenominator    = (1 << CoordFractionalBits)
	CoordResolution     = (1.0 / CoordDenominator)

	NormalFractionalBits = 11
	NormalDenominator    = ((1 << NormalFractionalBits) - 1)
	NormalResolution     = (1.0 / NormalDenominator)
)
View Source
const (
	MaxNameLength  = 0x400
	KeyHistorySize = 32
)
View Source
const (
	MAX_PLAYER_NAME_LENGTH = 32
	MAX_CUSTOM_FILES       = 4  // max 4 files
	SIGNED_GUID_LEN        = 32 // Hashed CD Key (32 hex alphabetic chars + 0 terminator )
)

Variables

This section is empty.

Functions

func Parse

func Parse(data []byte, numEntries, maxEntries, dataSizeBits int, dataFixedSize bool) map[int]*StringTableItem

func ParseCST

func ParseCST(obj CSTObject) map[int]*StringTableItem

func ParseUST

func ParseUST(obj USTObject, meta *CacheItem) map[int]*StringTableItem

func ProtoUnmarshal

func ProtoUnmarshal(data []byte, obj proto.Message) error

func ReadBz2File

func ReadBz2File(path string) []byte

func ReadFile

func ReadFile(path string) []byte

func ReadStringZ

func ReadStringZ(datas []byte, offset int) string

func SnappyUncompress

func SnappyUncompress(compressed []byte) []byte

Types

type Abilities

type Abilities []*AbilityTracker

func (Abilities) Len

func (p Abilities) Len() int

func (Abilities) Less

func (p Abilities) Less(i, j int) bool

func (Abilities) Swap

func (p Abilities) Swap(i, j int)

type AbilityTracker

type AbilityTracker struct {
	HeroHandle int
	Level      int
	Tick       int
	Name       string
}

type BitReader

type BitReader struct {
	// contains filtered or unexported fields
}

func NewBitReader

func NewBitReader(buffer []byte) *BitReader

func (*BitReader) BitsLeft

func (br *BitReader) BitsLeft() int

func (*BitReader) BytesLeft

func (br *BitReader) BytesLeft() int

func (*BitReader) CurrentBit

func (br *BitReader) CurrentBit() int

func (*BitReader) CurrentByte

func (br *BitReader) CurrentByte() int

func (*BitReader) Length

func (br *BitReader) Length() int

func (*BitReader) ReadBitCellCoord

func (br *BitReader) ReadBitCellCoord(bits int, integral, lowPrecision bool) (value float32)

func (*BitReader) ReadBitCoord

func (br *BitReader) ReadBitCoord() (value float32)

func (*BitReader) ReadBitFloat

func (br *BitReader) ReadBitFloat() float32

func (*BitReader) ReadBitNormal

func (br *BitReader) ReadBitNormal() float32

func (*BitReader) ReadBits

func (br *BitReader) ReadBits(nBits int) int

func (*BitReader) ReadBitsAsBytes

func (br *BitReader) ReadBitsAsBytes(n int) []byte

func (*BitReader) ReadBoolean

func (br *BitReader) ReadBoolean() bool

func (*BitReader) ReadByte

func (br *BitReader) ReadByte() byte

func (*BitReader) ReadBytes

func (br *BitReader) ReadBytes(nBytes int) []byte

func (*BitReader) ReadFloat

func (br *BitReader) ReadFloat(prop *SendProp) float64

func (*BitReader) ReadNextEntityIndex

func (br *BitReader) ReadNextEntityIndex(oldEntity int) int

func (*BitReader) ReadPropertiesIndex

func (br *BitReader) ReadPropertiesIndex() []int

func (*BitReader) ReadPropertiesValues

func (br *BitReader) ReadPropertiesValues(mapping []*SendProp, multiples map[string]int, indices []int) map[string]interface{}

FIXME: Rememver that our PE decoder is wrong, it needs to construct key names recursively. https://github.com/spheenik/clarity/tree/master/src/main/java/clarity/decoder/SendTableFlattener.java https://gist.githubusercontent.com/onethirtyfive/07899a78622dc18679c3/raw/19d411910016170e4c4ee2782fd4a987e9ce2afc/gistfile1.txt

func (*BitReader) ReadSpecialFloat

func (br *BitReader) ReadSpecialFloat(prop *SendProp) (float32, bool)

func (*BitReader) ReadString

func (br *BitReader) ReadString() string

func (*BitReader) ReadStringN

func (br *BitReader) ReadStringN(n int) string

func (*BitReader) ReadUBits

func (br *BitReader) ReadUBits(nBits int) uint

func (*BitReader) ReadUBitsByteAligned

func (br *BitReader) ReadUBitsByteAligned(nBits int) uint

func (*BitReader) ReadUBitsNotByteAligned

func (br *BitReader) ReadUBitsNotByteAligned(nBits int) uint

func (*BitReader) ReadVarInt

func (br *BitReader) ReadVarInt() (result uint)

func (*BitReader) ReadVector

func (br *BitReader) ReadVector(prop *SendProp) *Vector3

func (*BitReader) ReadVectorXY

func (br *BitReader) ReadVectorXY(prop *SendProp) *Vector2

func (*BitReader) SeekBits

func (br *BitReader) SeekBits(offset int, origin SeekOrigin)

type BytesReader

type BytesReader struct {
	// contains filtered or unexported fields
}

func NewBytesReader

func NewBytesReader(data []byte) *BytesReader

func (BytesReader) CanRead

func (br BytesReader) CanRead() bool

func (*BytesReader) Read

func (br *BytesReader) Read(length int) []byte

func (*BytesReader) ReadInt32

func (br *BytesReader) ReadInt32() (result int32)

func (*BytesReader) ReadVarInt32

func (br *BytesReader) ReadVarInt32() (result int32)

func (*BytesReader) Skip

func (br *BytesReader) Skip(length int)

type CSTObject

type CSTObject interface {
	GetStringData() []byte
	GetNumEntries() int32
	GetMaxEntries() int32
	GetUserDataFixedSize() bool
	GetUserDataSizeBits() int32
}

type CacheItem

type CacheItem struct {
	Bits        int
	IsFixedSize bool
	MaxEntries  int
	Name        string
}

type CombatLogAbility

type CombatLogAbility struct {
	Target             string  `logIndex:"2" logTable:"CombatLogNames"`
	Attacker           string  `logIndex:"3" logTable:"CombatLogNames"`
	Ability            string  `logIndex:"4" logTable:"CombatLogNames"`
	AttackerIsIllusion bool    `logIndex:"5"`
	TargetIsIllusion   bool    `logIndex:"6"`
	IsDebuff           int     `logIndex:"7"` // seen values: 0,1,2
	Time               float32 `logIndex:"9"`
	TargetSource       string  `logIndex:"10" logTable:"CombatLogNames"`
	AttackerIsHero     bool    `logIndex:"12"`
	TargetIsHero       bool    `logIndex:"13"`
}

TODO: only observed 2,3,4,7,13 so far, but the others would make sense too.

func (CombatLogAbility) Timestamp

func (c CombatLogAbility) Timestamp() float32

func (CombatLogAbility) Type

type CombatLogAbilityTrigger

type CombatLogAbilityTrigger struct {
	Target             string  `logIndex:"2" logTable:"CombatLogNames"`  // 12
	Attacker           string  `logIndex:"3" logTable:"CombatLogNames"`  // 5
	Ability            string  `logIndex:"4" logTable:"CombatLogNames"`  // 47
	AttackerIsIllusion bool    `logIndex:"5"`                            // false
	TargetIsIllusion   bool    `logIndex:"6"`                            // false
	IsDebuff           int     `logIndex:"7"`                            // 3  (seen values: 3)
	Unknown8           int     `logIndex:"8"`                            // 0
	Time               float32 `logIndex:"9"`                            // 1519.1506
	TargetSource       string  `logIndex:"10" logTable:"CombatLogNames"` // 0
	TimeRaw            float32 `logIndex:"11"`                           // 1638.1001
	AttackerIsHero     bool    `logIndex:"12"`                           // true
	TargetIsHero       bool    `logIndex:"13"`                           // true
	Unknown14          bool    `logIndex:"14"`                           // false
	Unknown15          bool    `logIndex:"15"`                           // false
	Unknown16          int     `logIndex:"16"`                           // 4
	Unknown17          int     `logIndex:"17"`                           // 0
	Unknown18          int     `logIndex:"18"`                           // 0
	Unknown19          int     `logIndex:"19"`                           // 0
}

func (CombatLogAbilityTrigger) Timestamp

func (c CombatLogAbilityTrigger) Timestamp() float32

func (CombatLogAbilityTrigger) Type

type CombatLogBuyback

type CombatLogBuyback struct {
	PlayerId int     `logIndex:"7"`  //  7:  9
	Time     float32 `logIndex:"9"`  //  9:  2625.6892
	TimeRaw  float32 `logIndex:"11"` // 11:  2666.3
}

func (CombatLogBuyback) Timestamp

func (c CombatLogBuyback) Timestamp() float32

func (CombatLogBuyback) Type

type CombatLogDamage

type CombatLogDamage struct {
	Source             string  `logIndex:"1" logTable:"CombatLogNames"`  // 3
	Target             string  `logIndex:"2" logTable:"CombatLogNames"`  // 27
	Attacker           string  `logIndex:"3" logTable:"CombatLogNames"`  // 3
	Cause              string  `logIndex:"4" logTable:"CombatLogNames"`  // 0
	AttackerIsIllusion bool    `logIndex:"5"`                            // false
	TargetIsIllusion   bool    `logIndex:"6"`                            // false
	Value              int     `logIndex:"7"`                            // 70
	Health             int     `logIndex:"8"`                            // 429
	Time               float32 `logIndex:"9"`                            // 229.45338
	TargetSource       string  `logIndex:"10" logTable:"CombatLogNames"` // 27
	TimeRaw            float32 `logIndex:"11"`                           // 238.43335
	AttackerIsHero     bool    `logIndex:"12"`                           // true
	TargetIsHero       bool    `logIndex:"13"`                           // false
}

func (CombatLogDamage) Timestamp

func (c CombatLogDamage) Timestamp() float32

func (CombatLogDamage) Type

type CombatLogDeath

type CombatLogDeath struct {
	Source             string  `logIndex:"1" logTable:"CombatLogNames"`
	Target             string  `logIndex:"2" logTable:"CombatLogNames"`
	Attacker           string  `logIndex:"3" logTable:"CombatLogNames"`
	Cause              string  `logIndex:"4" logTable:"CombatLogNames"`
	AttackerIsIllusion bool    `logIndex:"5"`
	TargetIsIllusion   bool    `logIndex:"6"`
	Time               float32 `logIndex:"9"`
	TargetSource       string  `logIndex:"10" logTable:"CombatLogNames"`
	TimeRaw            float32 `logIndex:"11"`
	AttackerIsHero     bool    `logIndex:"12"`
	TargetIsHero       bool    `logIndex:"13"`
}

func (CombatLogDeath) Timestamp

func (c CombatLogDeath) Timestamp() float32

func (CombatLogDeath) Type

type CombatLogEntry

type CombatLogEntry interface {
	Type() dota.DOTA_COMBATLOG_TYPES
	Timestamp() float32
}

type CombatLogGameState

type CombatLogGameState struct {
	State   int     `logIndex:"7"`  //  7: 5 (2,3,4,5,6)
	Time    float32 `logIndex:"9"`  //  9: 505.76474
	TimeRaw float32 `logIndex:"11"` // 11: 597.93335
}

func (CombatLogGameState) Timestamp

func (c CombatLogGameState) Timestamp() float32

func (CombatLogGameState) Type

type CombatLogGold

type CombatLogGold struct {
	Target  string  `logIndex:"2" logTable:"CombatLogNames"`
	Value   int     `logIndex:"7"`
	Time    float32 `logIndex:"9"`
	TimeRaw float32 `logIndex:"11"`
	Reason  int     `logIndex:"17"`
}

func (CombatLogGold) Timestamp

func (c CombatLogGold) Timestamp() float32

func (CombatLogGold) Type

type CombatLogHeal

type CombatLogHeal struct {
	Source             string  `logIndex:"1" logTable:"CombatLogNames"`
	Target             string  `logIndex:"2" logTable:"CombatLogNames"`
	Attacker           string  `logIndex:"3" logTable:"CombatLogNames"`
	Modifier           string  `logIndex:"4" logTable:"CombatLogNames"`
	AttackerIsIllusion bool    `logIndex:"5"`
	TargetIsIllusion   bool    `logIndex:"6"`
	Value              int     `logIndex:"7"`
	Health             int     `logIndex:"8"`
	Time               float32 `logIndex:"9"`
	TargetSource       string  `logIndex:"10" logTable:"CombatLogNames"`
	AttackerIsHero     bool    `logIndex:"12"`
	TargetIsHero       bool    `logIndex:"13"`
}

func (CombatLogHeal) Timestamp

func (c CombatLogHeal) Timestamp() float32

func (CombatLogHeal) Type

type CombatLogItem

type CombatLogItem struct {
	Target             string  `logIndex:"2" logTable:"CombatLogNames"`
	User               string  `logIndex:"3" logTable:"CombatLogNames"`
	Item               string  `logIndex:"4" logTable:"CombatLogNames"`
	AttackerIsIllusion bool    `logIndex:"5"`
	TargetIsIllusion   bool    `logIndex:"6"`
	Time               float32 `logIndex:"9"`
	UserIsHero         bool    `logIndex:"12"`
	TargetIsHero       bool    `logIndex:"13"`
}

func (CombatLogItem) Timestamp

func (c CombatLogItem) Timestamp() float32

func (CombatLogItem) Type

type CombatLogKillStreak

type CombatLogKillStreak struct {
	Unknown0  int     `logIndex:"0"`  // 16
	Unknown1  int     `logIndex:"1"`  // 0
	Unknown2  int     `logIndex:"2"`  // 6
	Unknown3  int     `logIndex:"3"`  // 6
	Unknown4  int     `logIndex:"4"`  // 0
	Unknown5  bool    `logIndex:"5"`  // false
	Unknown6  bool    `logIndex:"6"`  // false
	Unknown7  int     `logIndex:"7"`  // 3
	Unknown8  int     `logIndex:"8"`  // 0
	Time      float32 `logIndex:"9"`  // 0
	Unknown10 int     `logIndex:"10"` // 6
	TimeRaw   float32 `logIndex:"11"` // 0
	Unknown12 bool    `logIndex:"12"` // false
	Unknown13 bool    `logIndex:"13"` // false
	Unknown14 bool    `logIndex:"14"` // false
	Unknown15 bool    `logIndex:"15"` // false
	Unknown16 int     `logIndex:"16"` // 0
	Unknown17 int     `logIndex:"17"` // 0
	Unknown18 int     `logIndex:"18"` // 0
}

func (CombatLogKillStreak) Timestamp

func (c CombatLogKillStreak) Timestamp() float32

func (CombatLogKillStreak) Type

type CombatLogLocation

type CombatLogLocation struct {
	Source             string  `logIndex:"1" logTable:"CombatLogNames"`
	Target             string  `logIndex:"2" logTable:"CombatLogNames"`
	Attacker           string  `logIndex:"3" logTable:"CombatLogNames"`
	Modifier           string  `logIndex:"4" logTable:"CombatLogNames"`
	AttackerIsIllusion bool    `logIndex:"5"`
	TargetIsIllusion   bool    `logIndex:"6"`
	Value              int     `logIndex:"7"`
	Health             int     `logIndex:"8"`
	Time               float32 `logIndex:"9"`
	TargetSource       string  `logIndex:"10" logTable:"CombatLogNames"`
	AttackerIsHero     bool    `logIndex:"12"`
	TargetIsHero       bool    `logIndex:"13"`
}

func (CombatLogLocation) Timestamp

func (c CombatLogLocation) Timestamp() float32

func (CombatLogLocation) Type

type CombatLogModifierAdd

type CombatLogModifierAdd struct {
	Source             string  `logIndex:"1" logTable:"CombatLogNames"`
	Target             string  `logIndex:"2" logTable:"CombatLogNames"`
	Attacker           string  `logIndex:"3" logTable:"CombatLogNames"`
	Modifier           string  `logIndex:"4" logTable:"CombatLogNames"`
	AttackerIsIllusion bool    `logIndex:"5"`
	TargetIsIllusion   bool    `logIndex:"6"`
	IsDebuff           bool    `logIndex:"7"`
	Health             int     `logIndex:"8"`
	Time               float32 `logIndex:"9"`
	TargetSource       string  `logIndex:"10" logTable:"CombatLogNames"`
	AttackerIsHero     bool    `logIndex:"12"`
	TargetIsHero       bool    `logIndex:"13"`
}

func (CombatLogModifierAdd) Timestamp

func (c CombatLogModifierAdd) Timestamp() float32

func (CombatLogModifierAdd) Type

type CombatLogModifierRemove

type CombatLogModifierRemove struct {
	Target             string  `logIndex:"2" logTable:"CombatLogNames"`
	Caster             string  `logIndex:"3" logTable:"CombatLogNames"`
	Modifier           string  `logIndex:"4" logTable:"CombatLogNames"`
	AttackerIsIllusion bool    `logIndex:"5"`
	TargetIsIllusion   bool    `logIndex:"6"`
	IsDebuff           bool    `logIndex:"7"`
	Health             int     `logIndex:"8"`
	Time               float32 `logIndex:"9"`
	AttackerIsHero     bool    `logIndex:"12"`
	TargetIsHero       bool    `logIndex:"13"`
}

func (CombatLogModifierRemove) Timestamp

func (c CombatLogModifierRemove) Timestamp() float32

func (CombatLogModifierRemove) Type

type CombatLogMultikill

type CombatLogMultikill struct {
	Unknown0  int     `logIndex:"0"`  // 15
	Unknown1  int     `logIndex:"1"`  // 0
	Unknown2  int     `logIndex:"2"`  // 7
	Unknown3  int     `logIndex:"3"`  // 7
	Unknown4  int     `logIndex:"4"`  // 0
	Unknown5  bool    `logIndex:"5"`  // false
	Unknown6  bool    `logIndex:"6"`  // false
	Unknown7  int     `logIndex:"7"`  // 3
	Unknown8  int     `logIndex:"8"`  // 0
	Time      float32 `logIndex:"9"`  // 0
	Unknown10 int     `logIndex:"10"` // 2
	TimeRaw   float32 `logIndex:"11"` // 0
	Unknown12 bool    `logIndex:"12"` // false
	Unknown13 bool    `logIndex:"13"` // false
	Unknown14 bool    `logIndex:"14"` // false
	Unknown15 bool    `logIndex:"15"` // false
	Unknown16 int     `logIndex:"16"` // 0
	Unknown17 int     `logIndex:"17"` // 0
	Unknown18 int     `logIndex:"18"` // 0
}

func (CombatLogMultikill) Timestamp

func (c CombatLogMultikill) Timestamp() float32

func (CombatLogMultikill) Type

type CombatLogPlayerstats

type CombatLogPlayerstats struct {
	Unknown0     int     `logIndex:"0"`                            // 14
	Unknown1     int     `logIndex:"1"`                            // 0
	Target       string  `logIndex:"2" logTable:"CombatLogNames"`  // val_shrt:9
	Unknown3     int     `logIndex:"3"`                            // 11
	Unknown4     int     `logIndex:"4"`                            // 0
	Unknown5     bool    `logIndex:"5"`                            // false
	Unknown6     bool    `logIndex:"6"`                            // false
	Unknown7     int     `logIndex:"7"`                            // 22
	Unknown8     int     `logIndex:"8"`                            // 0
	Time         float32 `logIndex:"9"`                            // 2051.7341
	TargetSource string  `logIndex:"10" logTable:"CombatLogNames"` // 3
	TimeRaw      float32 `logIndex:"11"`                           // 2066.2668
	Unknown12    bool    `logIndex:"12"`                           // false
	Unknown13    bool    `logIndex:"13"`                           // false
	Unknown14    bool    `logIndex:"14"`                           // false
	Unknown15    bool    `logIndex:"15"`                           // false
	Unknown16    int     `logIndex:"16"`                           // 0
	Unknown17    int     `logIndex:"17"`                           // 0
	Unknown18    int     `logIndex:"18"`                           // 0
}

func (CombatLogPlayerstats) Timestamp

func (c CombatLogPlayerstats) Timestamp() float32

func (CombatLogPlayerstats) Type

type CombatLogPurchase

type CombatLogPurchase struct {
	Buyer   string  `logIndex:"2" logTable:"CombatLogNames"`
	Item    string  `logIndex:"7" logTable:"CombatLogNames"`
	Time    float32 `logIndex:"9"`
	TimeRaw float32 `logIndex:"11"`
}

func (CombatLogPurchase) Timestamp

func (c CombatLogPurchase) Timestamp() float32

func (CombatLogPurchase) Type

type CombatLogTeamBuildingKill

type CombatLogTeamBuildingKill struct {
	Unknown0  int     `logIndex:"0"`  //  17
	Unknown1  int     `logIndex:"1"`  //  0
	Unknown2  int     `logIndex:"2"`  //  0
	Unknown3  int     `logIndex:"3"`  //  0
	Unknown4  int     `logIndex:"4"`  //  0
	Unknown5  bool    `logIndex:"5"`  //  false
	Unknown6  bool    `logIndex:"6"`  //  false
	Unknown7  int     `logIndex:"7"`  //  3
	Unknown8  int     `logIndex:"8"`  //  0
	Time      float32 `logIndex:"9"`  //  0
	Unknown10 int     `logIndex:"10"` //  0
	TimeRaw   float32 `logIndex:"11"` //  0
	Unknown12 bool    `logIndex:"12"` //  false
	Unknown13 bool    `logIndex:"13"` //  false
	Unknown14 bool    `logIndex:"14"` //  false
	Unknown15 bool    `logIndex:"15"` //  false
	Unknown16 int     `logIndex:"16"` //  0
	Unknown17 int     `logIndex:"17"` //  0
	Unknown18 int     `logIndex:"18"` //  0
}

func (CombatLogTeamBuildingKill) Timestamp

func (c CombatLogTeamBuildingKill) Timestamp() float32

func (CombatLogTeamBuildingKill) Type

type CombatLogXP

type CombatLogXP struct {
	Target  string  `logIndex:"2" logTable:"CombatLogNames"`
	Value   int     `logIndex:"7"`
	Time    float32 `logIndex:"9"`
	TimeRaw float32 `logIndex:"11"`
	Reason  int     `logIndex:"18"`
}

func (CombatLogXP) Timestamp

func (c CombatLogXP) Timestamp() float32

func (CombatLogXP) Type

type DPTType

type DPTType int
const (
	DPT_Int DPTType = iota
	DPT_Float
	DPT_Vector
	DPT_VectorXY
	DPT_String
	DPT_Array
	DPT_DataTable
	DPT_Int64
	DPT_NUMSendPropTypes
)

type Error

type Error string

func (Error) Error

func (e Error) Error() string

type Flag

type Flag int
const (
	SPROP_UNSIGNED                  Flag = 1 << 0
	SPROP_COORD                     Flag = 1 << 1
	SPROP_NOSCALE                   Flag = 1 << 2
	SPROP_ROUNDDOWN                 Flag = 1 << 3
	SPROP_ROUNDUP                   Flag = 1 << 4
	SPROP_NORMAL                    Flag = 1 << 5
	SPROP_EXCLUDE                   Flag = 1 << 6
	SPROP_XYZE                      Flag = 1 << 7
	SPROP_INSIDEARRAY               Flag = 1 << 8
	SPROP_PROXY_ALWAYS_YES          Flag = 1 << 9
	SPROP_IS_A_VECTOR_ELEM          Flag = 1 << 10
	SPROP_COLLAPSIBLE               Flag = 1 << 11
	SPROP_COORD_MP                  Flag = 1 << 12
	SPROP_COORD_MP_LOWPRECISION     Flag = 1 << 13
	SPROP_COORD_MP_INTEGRAL         Flag = 1 << 14
	SPROP_CELL_COORD                Flag = 1 << 15
	SPROP_CELL_COORD_LOWPRECISION   Flag = 1 << 16
	SPROP_CELL_COORD_INTEGRAL       Flag = 1 << 17
	SPROP_CHANGES_OFTEN             Flag = 1 << 18
	SPROP_ENCODED_AGAINST_TICKCOUNT Flag = 1 << 19
)

type Helper

type Helper struct {
	// contains filtered or unexported fields
}

func NewSendTablesHelper

func NewSendTablesHelper() *Helper

func (*Helper) LoadSendTable

func (sth *Helper) LoadSendTable(sendTableName string) []*SendProp

func (*Helper) SetSendTable

func (sth *Helper) SetSendTable(name string, table *dota.CSVCMsg_SendTable)

type ItemType

type ItemType int

type LastHitTracker

type LastHitTracker struct {
	HeroHandle int
	Tick       int
	LastHit    int
}

type LastHits

type LastHits []*LastHitTracker

func (LastHits) Len

func (p LastHits) Len() int

func (LastHits) Less

func (p LastHits) Less(i, j int) bool

func (LastHits) Swap

func (p LastHits) Swap(i, j int)

type ModifierBuffs

type ModifierBuffs []*dota.CDOTAModifierBuffTableEntry

func (ModifierBuffs) Len

func (m ModifierBuffs) Len() int

func (ModifierBuffs) Less

func (m ModifierBuffs) Less(i, j int) bool

func (ModifierBuffs) Swap

func (m ModifierBuffs) Swap(i, j int)

type OuterParser

type OuterParser struct {
	Sequence int64
	Items    map[int64]*OuterParserItem
	// contains filtered or unexported fields
}

func NewOuterParser

func NewOuterParser(data []byte) *OuterParser

func OuterParserFromFile

func OuterParserFromFile(path string) *OuterParser

func (*OuterParser) Analyze

func (p *OuterParser) Analyze(callback func(*OuterParserBaseItem))

func (*OuterParser) AnalyzePacket

func (p *OuterParser) AnalyzePacket(callback func(*OuterParserBaseItem), fromEvent dota.EDemoCommands, tick int, data []byte)

func (*OuterParser) AsBaseEvent

func (p *OuterParser) AsBaseEvent(commandName string) (proto.Message, error)

func (*OuterParser) AsBaseEventBUMDUM

func (p *OuterParser) AsBaseEventBUMDUM(value int) (proto.Message, error)

func (*OuterParser) AsBaseEventNETSVC

func (p *OuterParser) AsBaseEventNETSVC(value int) (proto.Message, error)

type OuterParserBaseEvent

type OuterParserBaseEvent int

type OuterParserBaseEventMapType

type OuterParserBaseEventMapType int
const (
	DEM OuterParserBaseEventMapType = iota
	NET
	SVC
	BUM
	DUM
)

type OuterParserBaseItem

type OuterParserBaseItem struct {
	Sequence int64
	Tick     int
	From     dota.EDemoCommands
	Object   proto.Message
}

type OuterParserBaseItems

type OuterParserBaseItems []*OuterParserBaseItem

OuterParserBaseItems attaches the methods of Interface to []*OuterParserBaseItem, sorting in increasing order by Sequence.

func (OuterParserBaseItems) Len

func (p OuterParserBaseItems) Len() int

func (OuterParserBaseItems) Less

func (p OuterParserBaseItems) Less(i, j int) bool

func (OuterParserBaseItems) Swap

func (p OuterParserBaseItems) Swap(i, j int)

type OuterParserItem

type OuterParserItem struct {
	Sequence int64
	Tick     int
	Data     []byte
	From     dota.EDemoCommands
	Object   proto.Message
}

type OuterParserItems

type OuterParserItems []*OuterParserItem

OuterParserItems attaches the methods of Interface to []*OuterParserItem, sorting in increasing order by Sequence.

func (OuterParserItems) Len

func (p OuterParserItems) Len() int

func (OuterParserItems) Less

func (p OuterParserItems) Less(i, j int) bool

func (OuterParserItems) Swap

func (p OuterParserItems) Swap(i, j int)

type PacketEntity

type PacketEntity struct {
	Tick         int
	Index        int
	SerialNum    int
	ClassId      int
	EntityHandle int
	Name         string
	Type         UpdateType
	Values       map[string]interface{}
	Delta        map[string]interface{}
	OldDelta     map[string]interface{}
}

func (*PacketEntity) Clone

func (pe *PacketEntity) Clone() *PacketEntity

func (*PacketEntity) Handle

func (pe *PacketEntity) Handle() int

type Parser

type Parser struct {
	Parser *OuterParser

	ClassIdNumBits        int
	ClassInfosIdMapping   map[string]int
	ClassInfosNameMapping map[int]string
	FileHeader            *dota.CDemoFileHeader
	GameEventMap          map[int32]*dota.CSVCMsg_GameEventListDescriptorT
	Mapping               map[int][]*SendProp
	Multiples             map[int]map[string]int
	ServerInfo            *dota.CSVCMsg_ServerInfo
	Sth                   *Helper
	Stsh                  *StateHelper
	VoiceInit             *dota.CSVCMsg_VoiceInit

	ActiveModifiers map[int]*dota.CDOTAModifierBuffTableEntry
	Entities        []*PacketEntity
	ByHandle        map[int]*PacketEntity

	OnEntityCreated   func(*PacketEntity)
	OnEntityDeleted   func(*PacketEntity)
	OnEntityPreserved func(*PacketEntity)

	OnActiveModifierDelta func(map[int]*StringTableItem, ModifierBuffs)

	OnAbilitySteal              func(tick int, obj *dota.CDOTAUserMsg_AbilitySteal)
	OnBoosterState              func(tick int, obj *dota.CDOTAUserMsg_BoosterState)
	OnBotChat                   func(tick int, obj *dota.CDOTAUserMsg_BotChat)
	OnChatEvent                 func(tick int, obj *dota.CDOTAUserMsg_ChatEvent)
	OnChatWheel                 func(tick int, obj *dota.CDOTAUserMsg_ChatWheel)
	OnClassInfo                 func(tick int, obj *dota.CSVCMsg_ClassInfo)
	OnCourierKilledAlert        func(tick int, obj *dota.CDOTAUserMsg_CourierKilledAlert)
	OnCreateLinearProjectile    func(tick int, obj *dota.CDOTAUserMsg_CreateLinearProjectile)
	OnDemoStop                  func(tick int, obj *dota.CDemoStop)
	OnDemoSyncTick              func(tick int, obj *dota.CDemoSyncTick)
	OnDestroyLinearProjectile   func(tick int, obj *dota.CDOTAUserMsg_DestroyLinearProjectile)
	OnDodgeTrackingProjectiles  func(tick int, obj *dota.CDOTAUserMsg_DodgeTrackingProjectiles)
	OnEnemyItemAlert            func(tick int, obj *dota.CDOTAUserMsg_EnemyItemAlert)
	OnGlobalLightColor          func(tick int, obj *dota.CDOTAUserMsg_GlobalLightColor)
	OnGlobalLightDirection      func(tick int, obj *dota.CDOTAUserMsg_GlobalLightDirection)
	OnHPManaAlert               func(tick int, obj *dota.CDOTAUserMsg_HPManaAlert)
	OnHalloweenDrops            func(tick int, obj *dota.CDOTAUserMsg_HalloweenDrops)
	OnHudError                  func(tick int, obj *dota.CDOTAUserMsg_HudError)
	OnLocationPing              func(tick int, obj *dota.CDOTAUserMsg_LocationPing)
	OnMapLine                   func(tick int, obj *dota.CDOTAUserMsg_MapLine)
	OnMinimapEvent              func(tick int, obj *dota.CDOTAUserMsg_MinimapEvent)
	OnNevermoreRequiem          func(tick int, obj *dota.CDOTAUserMsg_NevermoreRequiem)
	OnOverheadEvent             func(tick int, obj *dota.CDOTAUserMsg_OverheadEvent)
	OnParticleManager           func(tick int, obj *dota.CDOTAUserMsg_ParticleManager)
	OnPredictionResult          func(tick int, obj *dota.CDOTAUserMsg_PredictionResult)
	OnPrint                     func(tick int, obj *dota.CSVCMsg_Print)
	OnSayText2                  func(tick int, obj *dota.CUserMsg_SayText2)
	OnSendAudio                 func(tick int, obj *dota.CUserMsg_SendAudio)
	OnSendRoshanPopup           func(tick int, obj *dota.CDOTAUserMsg_SendRoshanPopup)
	OnSendStatPopup             func(tick int, obj *dota.CDOTAUserMsg_SendStatPopup)
	OnSetView                   func(tick int, obj *dota.CSVCMsg_SetView)
	OnSharedCooldown            func(tick int, obj *dota.CDOTAUserMsg_SharedCooldown)
	OnSignonState               func(tick int, obj *dota.CNETMsg_SignonState)
	OnSounds                    func(tick int, obj *dota.CSVCMsg_Sounds)
	OnSpectatorPlayerClick      func(tick int, obj *dota.CDOTAUserMsg_SpectatorPlayerClick)
	OnSpectatorPlayerUnitOrders func(tick int, obj *dota.CDOTAUserMsg_SpectatorPlayerUnitOrders)
	OnTempEntities              func(tick int, obj *dota.CSVCMsg_TempEntities)
	OnTextMsg                   func(tick int, obj *dota.CUserMsg_TextMsg)
	OnTick                      func(tick int, obj *dota.CNETMsg_Tick)
	OnUnitEvent                 func(tick int, obj *dota.CDOTAUserMsg_UnitEvent)
	OnVoiceMask                 func(tick int, obj *dota.CUserMsg_VoiceMask)
	OnWorldLine                 func(tick int, obj *dota.CDOTAUserMsg_WorldLine)

	OnFileInfo  func(obj *dota.CDemoFileInfo)
	OnSetConVar func(obj *dota.CNETMsg_SetConVar)
	OnVoiceData func(obj *dota.CSVCMsg_VoiceData)

	OnCombatLog func(tick int, log CombatLogEntry)

	OnTablename func(name string)

	BeforeTick func(tick int)
	AfterTick  func(tick int)
	// contains filtered or unexported fields
}

func NewParser

func NewParser(data []byte) *Parser

func ParserFromFile

func ParserFromFile(path string) *Parser

func (*Parser) Parse

func (p *Parser) Parse()

func (*Parser) ParsePacket

func (p *Parser) ParsePacket(tick int, pe *dota.CSVCMsg_PacketEntities)

func (*Parser) PrintDistinctCombatLogTypes

func (p *Parser) PrintDistinctCombatLogTypes()

type SeekOrigin

type SeekOrigin int
const (
	Current SeekOrigin = iota
	Begin
	End
)

type SendProp

type SendProp struct {
	DtName    string
	VarName   string
	Type      DPTType
	Flags     Flag
	Priority  int
	NumBits   int
	LowValue  float64
	HighValue float64
}

type SignonPacket

type SignonPacket struct{}

func (SignonPacket) ProtoMessage

func (s SignonPacket) ProtoMessage()

func (SignonPacket) Reset

func (s SignonPacket) Reset()

func (SignonPacket) String

func (s SignonPacket) String() string

type StateHelper

type StateHelper struct {
	ClassInfosNameMapping map[int]string
	ActiveModifierDelta   ModifierBuffs
	Mapping               map[int][]*SendProp
	Multiples             map[int]map[string]int
	Baseline              map[int]map[string]interface{}
	// contains filtered or unexported fields
}

func NewStateHelper

func NewStateHelper() *StateHelper

func (*StateHelper) AppendPacket

func (helper *StateHelper) AppendPacket(packet *OuterParserBaseItem)

func (*StateHelper) GetStateAtTick

func (helper *StateHelper) GetStateAtTick(tick int) map[int]*StringTable

func (*StateHelper) GetTableAtTick

func (helper *StateHelper) GetTableAtTick(tick int, tableName string) (result *StringTable)

func (*StateHelper) GetTableNow

func (helper *StateHelper) GetTableNow(tableName string) (result *StringTable)

func (*StateHelper) OnCDST

func (helper *StateHelper) OnCDST(tick int, obj *dota.CDemoStringTables)

func (*StateHelper) OnCST

func (helper *StateHelper) OnCST(tick int, obj *dota.CSVCMsg_CreateStringTable)

func (*StateHelper) OnUST

func (helper *StateHelper) OnUST(tick int, obj *dota.CSVCMsg_UpdateStringTable)

NOTE: We ignore the "userinfo" table decoding process since it's a PITA and has no useful info anyway. In case we ever need it, a struct describing the binary is at: https://github.com/mitsuhiko/dota2-demoinfo2/blob/4ca45a87c631787eab140d313a3f21210b543741/demofile.h#L48

type StringTable

type StringTable struct {
	Tick  int
	Index int
	Name  string
	Items map[int]*StringTableItem
}

type StringTableItem

type StringTableItem struct {
	Str          string
	Data         []byte
	ModifierBuff *dota.CDOTAModifierBuffTableEntry
	Userinfo     *Userinfo
}

type USTObject

type USTObject interface {
	GetStringData() []byte
	GetNumChangedEntries() int32
}

type UpdateType

type UpdateType int
const (
	Create UpdateType = iota
	Delete
	Leave
	Preserve
)

func ReadUpdateType

func ReadUpdateType(br *BitReader) UpdateType

type Userinfo

type Userinfo struct {
	XUID        uint64 // network xuid
	Name        string // scoreboard information
	UserID      int    // local server user ID, unique while server is running
	GUID        string // global unique player identifer
	FriendsID   uint   // friends identification number
	FriendsName string // friends name
	SteamID     uint64
}

type Vector2

type Vector2 struct {
	X, Y float64
}

func (Vector2) String

func (v Vector2) String() string

type Vector3

type Vector3 struct {
	X, Y, Z float64
}

func (Vector3) String

func (v Vector3) String() string

Directories

Path Synopsis
Package dota is a generated protocol buffer package.
Package dota is a generated protocol buffer package.
google/protobuf
Package google_protobuf is a generated protocol buffer package.
Package google_protobuf is a generated protocol buffer package.
examples

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL