demofile

package module
v0.0.0-...-77705d5 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2018 License: MIT Imports: 8 Imported by: 0

README

csgo-demofile

Library that has capabilities to parse .dem files from CSGO and execute events while it parsing

Documentation

Index

Constants

View Source
const (
	MaxEditctBits                       = 11
	NumNetworkedEhandleSerialNumberBits = 10
	NumNetworkedEhandleBits             = MaxEditctBits + NumNetworkedEhandleSerialNumberBits
	InvalidNetworkedEhandleValue        = (1 << NumNetworkedEhandleBits) - 1
	IndexMask                           = ((1 << MaxEditctBits) - 1)
)

Variables

View Source
var (
	DefaultAmmoInWeapon = map[EquipmentElement]int{
		EE_Unknown:      -1,
		EE_P2000:        13,
		EE_Glock:        20,
		EE_P250:         13,
		EE_Deagle:       7,
		EE_FiveSeven:    20,
		EE_DualBarettas: 30,
		EE_Tec9:         18,
		EE_CZ:           12,
		EE_USP:          12,
		EE_Revolver:     8,
		EE_MP7:          30,
		EE_MP9:          30,
		EE_Bizon:        64,
		EE_Mac10:        30,
		EE_UMP:          25,
		EE_P90:          50,
		EE_SawedOff:     7,
		EE_Nova:         8,
		EE_Swag7:        5,
		EE_XM1014:       7,
		EE_M249:         100,
		EE_Negev:        150,
		EE_Gallil:       35,
		EE_Famas:        25,
		EE_AK47:         30,
		EE_M4A4:         30,
		EE_M4A1:         20,
		EE_Scout:        10,
		EE_SG556:        30,
		EE_AUG:          30,
		EE_AWP:          10,
		EE_Scar20:       20,
		EE_G3SG1:        20,
		EE_Zeus:         1,
		EE_Kevlar:       0,
		EE_Helmet:       0,
		EE_Bomb:         1,
		EE_Knife:        0,
		EE_DefuseKit:    1,
		EE_World:        0,
		EE_Decoy:        1,
		EE_Molotov:      1,
		EE_Incendiary:   1,
		EE_Flash:        1,
		EE_Smoke:        1,
		EE_HE:           1,
	}

	MoveSpeedsInWeapon = map[EquipmentElement]int{
		EE_Unknown:      500,
		EE_P2000:        240,
		EE_Glock:        240,
		EE_P250:         240,
		EE_Deagle:       230,
		EE_FiveSeven:    240,
		EE_DualBarettas: 240,
		EE_Tec9:         240,
		EE_CZ:           240,
		EE_USP:          240,
		EE_Revolver:     220,
		EE_MP7:          220,
		EE_MP9:          240,
		EE_Bizon:        240,
		EE_Mac10:        240,
		EE_UMP:          230,
		EE_P90:          230,
		EE_SawedOff:     210,
		EE_Nova:         220,
		EE_Swag7:        225,
		EE_XM1014:       215,
		EE_M249:         195,
		EE_Negev:        195,
		EE_Gallil:       215,
		EE_Famas:        220,
		EE_AK47:         215,
		EE_M4A4:         225,
		EE_M4A1:         225,
		EE_Scout:        230,
		EE_SG556:        210,
		EE_AUG:          220,
		EE_AWP:          200,
		EE_Scar20:       215,
		EE_G3SG1:        215,
		EE_Zeus:         240,
		EE_Bomb:         250,
		EE_Knife:        250,
		EE_Decoy:        245,
		EE_Molotov:      245,
		EE_Incendiary:   245,
		EE_Flash:        245,
		EE_Smoke:        245,
		EE_HE:           245,
	}

	PricesOfWeapons = map[EquipmentElement]int{
		EE_Unknown:      0,
		EE_P2000:        200,
		EE_Glock:        200,
		EE_P250:         250,
		EE_Deagle:       700,
		EE_FiveSeven:    500,
		EE_DualBarettas: 500,
		EE_Tec9:         500,
		EE_CZ:           500,
		EE_USP:          200,
		EE_Revolver:     700,
		EE_MP7:          1700,
		EE_MP9:          1250,
		EE_Bizon:        1400,
		EE_Mac10:        1050,
		EE_UMP:          1200,
		EE_P90:          2350,
		EE_SawedOff:     1200,
		EE_Nova:         1200,
		EE_Swag7:        1800,
		EE_XM1014:       2000,
		EE_M249:         5200,
		EE_Negev:        2000,
		EE_Gallil:       2000,
		EE_Famas:        2250,
		EE_AK47:         2700,
		EE_M4A4:         3100,
		EE_M4A1:         3100,
		EE_Scout:        1700,
		EE_SG556:        3000,
		EE_AUG:          3300,
		EE_AWP:          4750,
		EE_Scar20:       5000,
		EE_G3SG1:        5000,
		EE_Zeus:         200,
		EE_Decoy:        50,
		EE_Molotov:      400,
		EE_Incendiary:   600,
		EE_Flash:        200,
		EE_Smoke:        300,
		EE_HE:           300,
	}
)

Functions

This section is empty.

Types

type BombAbortDefuseEvent

type BombAbortDefuseEvent struct {
}

func (*BombAbortDefuseEvent) Execute

func (e *BombAbortDefuseEvent) Execute(data *Data)

type BombAbortPlant

type BombAbortPlant struct {
}

func (*BombAbortPlant) Execute

func (e *BombAbortPlant) Execute(data *Data)

type BombBeginDefuseEvent

type BombBeginDefuseEvent struct {
}

func (*BombBeginDefuseEvent) Execute

func (e *BombBeginDefuseEvent) Execute(data *Data)

type BombBeginPlant

type BombBeginPlant struct {
}

func (*BombBeginPlant) Execute

func (e *BombBeginPlant) Execute(data *Data)

type BombDefusedEvent

type BombDefusedEvent struct {
}

func (*BombDefusedEvent) Execute

func (e *BombDefusedEvent) Execute(data *Data)

type BombExplodedEvent

type BombExplodedEvent struct {
}

func (*BombExplodedEvent) Execute

func (e *BombExplodedEvent) Execute(data *Data)

type BombPlantedEvent

type BombPlantedEvent struct {
}

func (*BombPlantedEvent) Execute

func (e *BombPlantedEvent) Execute(data *Data)

type BotTakenOverEvent

type BotTakenOverEvent struct {
}

func (*BotTakenOverEvent) Execute

func (e *BotTakenOverEvent) Execute(data *Data)

type Chunk

type Chunk struct {
	Lenght uint32
	Data   []byte
}

type CmdInfo

type CmdInfo struct {
	Parts [maxSplitScreens]SplitCmdInfo
	Data  []byte
}

CmdInfo represents cmd info packet

type Data

type Data struct {
}

Data represents common info on moment ingame tick

type DecoyEndEvent

type DecoyEndEvent struct {
}

func (*DecoyEndEvent) Execute

func (e *DecoyEndEvent) Execute(data *Data)

type DecoyStartEvent

type DecoyStartEvent struct {
}

func (*DecoyStartEvent) Execute

func (e *DecoyStartEvent) Execute(data *Data)

type Demofile

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

Demofile represents main info about demofile

func NewDemofile

func NewDemofile(file string, isDebug bool) (*Demofile, error)

NewDemofile creates Demofile structs with basis things

func (*Demofile) Start

func (d *Demofile) Start() error

Start starts moving via demofile and execute events

type EquipmentClass

type EquipmentClass int
const (
	EC_Unknown EquipmentClass = iota
	EC_Pistols
	EC_SMG
	EC_Heavy
	EC_Rifle
	EC_Equipment
	EC_Grenade
)

type EquipmentElement

type EquipmentElement int
const (
	EE_Unknown EquipmentElement = 0

	EE_P2000        EquipmentElement = 1
	EE_Glock        EquipmentElement = 2
	EE_P250         EquipmentElement = 3
	EE_Deagle       EquipmentElement = 4
	EE_FiveSeven    EquipmentElement = 5
	EE_DualBarettas EquipmentElement = 6
	EE_Tec9         EquipmentElement = 7
	EE_CZ           EquipmentElement = 8
	EE_USP          EquipmentElement = 9
	EE_Revolver     EquipmentElement = 10

	EE_MP7   EquipmentElement = 101
	EE_MP9   EquipmentElement = 102
	EE_Bizon EquipmentElement = 103
	EE_Mac10 EquipmentElement = 104
	EE_UMP   EquipmentElement = 105
	EE_P90   EquipmentElement = 106

	EE_SawedOff EquipmentElement = 201
	EE_Nova     EquipmentElement = 202
	EE_Swag7    EquipmentElement = 203
	EE_XM1014   EquipmentElement = 204
	EE_M249     EquipmentElement = 205
	EE_Negev    EquipmentElement = 206

	EE_Gallil EquipmentElement = 301
	EE_Famas  EquipmentElement = 302
	EE_AK47   EquipmentElement = 303
	EE_M4A4   EquipmentElement = 304
	EE_M4A1   EquipmentElement = 305
	EE_Scout  EquipmentElement = 306
	EE_SG556  EquipmentElement = 307
	EE_AUG    EquipmentElement = 308
	EE_AWP    EquipmentElement = 309
	EE_Scar20 EquipmentElement = 310
	EE_G3SG1  EquipmentElement = 311

	EE_Zeus      EquipmentElement = 401
	EE_Kevlar    EquipmentElement = 402
	EE_Helmet    EquipmentElement = 403
	EE_Bomb      EquipmentElement = 404
	EE_Knife     EquipmentElement = 405
	EE_DefuseKit EquipmentElement = 406
	EE_World     EquipmentElement = 407

	EE_Decoy      EquipmentElement = 501
	EE_Molotov    EquipmentElement = 502
	EE_Incendiary EquipmentElement = 503
	EE_Flash      EquipmentElement = 504
	EE_Smoke      EquipmentElement = 505
	EE_HE         EquipmentElement = 506
)

type Event

type Event interface {
	Execute(data *Data)
}

Event represents interface to execute events like generics :3

type FinalRoundEvent

type FinalRoundEvent struct {
}

func (*FinalRoundEvent) Execute

func (e *FinalRoundEvent) Execute(data *Data)

type FireNadeEndEvent

type FireNadeEndEvent struct {
}

func (*FireNadeEndEvent) Execute

func (e *FireNadeEndEvent) Execute(data *Data)

type FireNadeStartEvent

type FireNadeStartEvent struct {
}

func (*FireNadeStartEvent) Execute

func (e *FireNadeStartEvent) Execute(data *Data)

type FlashExplodedEvent

type FlashExplodedEvent struct {
}

func (*FlashExplodedEvent) Execute

func (e *FlashExplodedEvent) Execute(data *Data)

type FreezetimeEndedEvent

type FreezetimeEndedEvent struct {
}

func (*FreezetimeEndedEvent) Execute

func (e *FreezetimeEndedEvent) Execute(data *Data)

type HeExplodedEvent

type HeExplodedEvent struct {
}

func (*HeExplodedEvent) Execute

func (e *HeExplodedEvent) Execute(data *Data)
type Header struct {
	Filestamp       string
	Protocol        uint32
	NetworkProtocol uint32
	ServerName      string
	ClientName      string
	MapName         string
	GameDirectory   string
	PlaybackTime    float32
	PlaybackTicks   uint32
	PlaybackFrames  uint32
	SignOnLenght    uint32
}

Header represents header of demofile

type Hitgroup

type Hitgroup byte
const (
	HG_Generic  Hitgroup = 0
	HG_Head     Hitgroup = 1
	HG_Chest    Hitgroup = 2
	HG_Stomach  Hitgroup = 3
	HG_LeftArm  Hitgroup = 4
	HG_RightArm Hitgroup = 5
	HG_LeftLeg  Hitgroup = 6
	HG_RightLeg Hitgroup = 7
	HG_Gear     Hitgroup = 10
)

type ItemDropEvent

type ItemDropEvent struct {
}

func (*ItemDropEvent) Execute

func (e *ItemDropEvent) Execute(data *Data)

type ItemEquipEvent

type ItemEquipEvent struct {
}

func (*ItemEquipEvent) Execute

func (e *ItemEquipEvent) Execute(data *Data)

type ItemPickupEvent

type ItemPickupEvent struct {
}

func (*ItemPickupEvent) Execute

func (e *ItemPickupEvent) Execute(data *Data)

type LastRoundHalfEvent

type LastRoundHalfEvent struct {
}

func (*LastRoundHalfEvent) Execute

func (e *LastRoundHalfEvent) Execute(data *Data)

type MatchStartedEvent

type MatchStartedEvent struct {
}

func (*MatchStartedEvent) Execute

func (e *MatchStartedEvent) Execute(data *Data)

type OriginViewAngles

type OriginViewAngles struct {
	ViewOrigin      r3.Vector
	ViewAngles      r3.Vector
	LocalViewAngles r3.Vector
}

OriginViewAngles represents container with view and angle

type Packet

type Packet struct {
	Cmd        uint8
	Tick       int32
	PlayerSlot uint8
}

type Parser

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

func NewParser

func NewParser(isDebug bool) *Parser

func (*Parser) Parse

func (p *Parser) Parse(buf []byte) error

type PlayerBindEvent

type PlayerBindEvent struct {
}

func (*PlayerBindEvent) Execute

func (e *PlayerBindEvent) Execute(data *Data)

type PlayerDisconnectEvent

type PlayerDisconnectEvent struct {
}

func (*PlayerDisconnectEvent) Execute

func (e *PlayerDisconnectEvent) Execute(data *Data)

type PlayerFlashedEvent

type PlayerFlashedEvent struct {
}

func (*PlayerFlashedEvent) Execute

func (e *PlayerFlashedEvent) Execute(data *Data)

type PlayerFootstepEvent

type PlayerFootstepEvent struct {
}

func (*PlayerFootstepEvent) Execute

func (e *PlayerFootstepEvent) Execute(data *Data)

type PlayerHurtEvent

type PlayerHurtEvent struct {
}

func (*PlayerHurtEvent) Execute

func (e *PlayerHurtEvent) Execute(data *Data)

type PlayerInfo

type PlayerInfo struct {
	Version         int64
	XUID            int64
	Name            [maxPlayerName]byte
	UserID          int
	GUID            [signedGUIDLen]byte
	FriendsID       uint32
	FriendsName     [maxPlayerName]byte
	FakePlayer      bool
	IsHLTV          bool
	CustomFiles     [maxCustomFiles]int32
	FilesDownloaded int8
}

PlayerInfo represents player info

type PlayerJumpEvent

type PlayerJumpEvent struct {
}

func (*PlayerJumpEvent) Execute

func (e *PlayerJumpEvent) Execute(data *Data)

type PlayerKilledEvent

type PlayerKilledEvent struct {
}

func (*PlayerKilledEvent) Execute

func (e *PlayerKilledEvent) Execute(data *Data)

type PlayerTeamChangeEvent

type PlayerTeamChangeEvent struct {
}

func (*PlayerTeamChangeEvent) Execute

func (e *PlayerTeamChangeEvent) Execute(data *Data)

type RankUpdateEvent

type RankUpdateEvent struct {
}

func (*RankUpdateEvent) Execute

func (e *RankUpdateEvent) Execute(data *Data)

type RoundAnnounceMatchStartedEvent

type RoundAnnounceMatchStartedEvent struct {
}

func (*RoundAnnounceMatchStartedEvent) Execute

func (e *RoundAnnounceMatchStartedEvent) Execute(data *Data)

type RoundEndReason

type RoundEndReason byte
const (
	RER_TargetBombed RoundEndReason = iota + 1
	RER_VIPEscaped
	RER_VIPKilled
	RER_TerroristsEscaped
	RER_CTStoppedEscape
	RER_TerroristsStopped
	RER_BombDefused
	RER_CTWin
	RER_TerroristsWin
	RER_Draw
	RER_HostagesRescued
	RER_TargetSaved
	RER_HostagesNotRescued
	RER_TerroristsNotEscaped
	RER_VIPNotEscaped
	RER_GameStart
	RER_TerroristsSurrender
	RER_CTSurrender
)

type RoundEndedEvent

type RoundEndedEvent struct {
}

func (*RoundEndedEvent) Execute

func (e *RoundEndedEvent) Execute(data *Data)

type RoundMVPEvent

type RoundMVPEvent struct {
}

func (*RoundMVPEvent) Execute

func (e *RoundMVPEvent) Execute(data *Data)

type RoundMVPReason

type RoundMVPReason byte
const (
	MVPReason_MostEliminations RoundMVPReason = iota + 1
	MVPReason_BombDefused
	MVPReason_BombPlanted
)

type RoundOfficialyEndedEvent

type RoundOfficialyEndedEvent struct {
}

func (*RoundOfficialyEndedEvent) Execute

func (e *RoundOfficialyEndedEvent) Execute(data *Data)

type RoundStartedEvent

type RoundStartedEvent struct {
}

func (*RoundStartedEvent) Execute

func (e *RoundStartedEvent) Execute(data *Data)

type SayText2Event

type SayText2Event struct {
}

func (*SayText2Event) Execute

func (e *SayText2Event) Execute(data *Data)

type SayTextEvent

type SayTextEvent struct {
}

func (*SayTextEvent) Execute

func (e *SayTextEvent) Execute(data *Data)

type SmokeEndEvent

type SmokeEndEvent struct {
}

func (*SmokeEndEvent) Execute

func (e *SmokeEndEvent) Execute(data *Data)

type SmokeStartEvent

type SmokeStartEvent struct {
}

func (*SmokeStartEvent) Execute

func (e *SmokeStartEvent) Execute(data *Data)

type SplitCmdInfo

type SplitCmdInfo struct {
	Flags     int32
	Original  OriginViewAngles
	Resampled OriginViewAngles
}

SplitCmdInfo represents part of cmd info packet

type Team

type Team byte
const (
	Team_Unassigned Team = iota
	Team_Spectators
	Team_Terrorists
	Team_CounterTerrorists
)

type TickDoneEvent

type TickDoneEvent struct {
}

func (*TickDoneEvent) Execute

func (e *TickDoneEvent) Execute(data *Data)

type WeaponFiredEvent

type WeaponFiredEvent struct {
}

func (*WeaponFiredEvent) Execute

func (e *WeaponFiredEvent) Execute(data *Data)

type WinPanelMatchEvent

type WinPanelMatchEvent struct {
}

func (*WinPanelMatchEvent) Execute

func (e *WinPanelMatchEvent) Execute(data *Data)

Directories

Path Synopsis
Package msg is a generated protocol buffer package.
Package msg is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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