Documentation ¶
Overview ¶
Package common contains common types, constants and functions used over different demoinfocs packages. Some constants prefixes: MVPReason - the reason why someone got the MVP award. HG - HitGroup - where a bullet hit the player. EE - EquipmentElement - basically the weapon identifiers. RER - RoundEndReason - why the round ended (bomb exploded, defused, time ran out. . .). EC - EquipmentClass - type of equipment (pistol, smg, heavy. . .).
Index ¶
Constants ¶
const ( MaxEditctBits = 11 IndexMask = ((1 << MaxEditctBits) - 1) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdditionalPlayerInformation ¶
type AdditionalPlayerInformation struct { Kills int Deaths int Assists int Score int MVPs int Ping int ClanTag string TotalCashSpent int }
AdditionalPlayerInformation contains mostly scoreboard information.
type DemoHeader ¶
type DemoHeader struct { Filestamp string Protocol int NetworkProtocol int ServerName string ClientName string MapName string GameDirectory string PlaybackTime float32 PlaybackTicks int PlaybackFrames int SignonLength int }
DemoHeader contains information about the demo's header.
type Equipment ¶
type Equipment struct { EntityID int Weapon EquipmentElement OriginalString string SkinID string AmmoInMagazine int AmmoType int Owner *Player ReserveAmmo int }
Equipment is a weapon / piece of equipment belonging to a player. This also includes the skin and some additional data.
func NewEquipment ¶
NewEquipment is a wrapper for NewSkinEquipment to create weapons without skins.
func NewSkinEquipment ¶
NewSkinEquipment creates an equipment with a skin from a skinId and equipment name.
func (Equipment) Class ¶
func (e Equipment) Class() EquipmentClass
Class returns the class of the equipment. E.g. pistol, smg, heavy etc.
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 )
func MapEquipment ¶
func MapEquipment(eqName string) EquipmentElement
MapEquipment creates an EquipmentElement from the name of the weapon / equipment.
type Player ¶
type Player struct { SteamID int64 Position r3.Vector LastAlivePosition r3.Vector Velocity r3.Vector EntityID int TeamID int Name string Hp int Armor int Money int CurrentEquipmentValue int FreezetimeEndEquipmentValue int RoundStartEquipmentValue int ActiveWeaponID int RawWeapons map[int]*Equipment Weapons []*Equipment AmmoLeft [32]int Entity *st.Entity AdditionalPlayerInformation *AdditionalPlayerInformation ViewDirectionX float32 ViewDirectionY float32 FlashDuration float32 Team Team IsBot bool IsDucking bool IsDisconnected bool HasDefuseKit bool HasHelmet bool }
Player contains mostly game-relevant player information.
func NewPlayer ¶
func NewPlayer() *Player
NewPlayer creates a *Player with an initialized equipment map.
func (*Player) ActiveWeapon ¶
ActiveWeapon returns the currently active / equipped weapon of the player.
type PlayerInfo ¶
type PlayerInfo struct { Version int64 XUID int64 Name string UserID int GUID string FriendsID int FriendsName string // Custom files stuff (CRC) CustomFiles0 int CustomFiles1 int CustomFiles2 int CustomFiles3 int // Amount of downloaded files from the server FilesDownloaded byte // Bots IsFakePlayer bool // HLTV Proxy IsHltv bool }
PlayerInfo contains general player information
func ParsePlayerInfo ¶
func ParsePlayerInfo(reader io.Reader) *PlayerInfo
ParsePlayerInfo parses player information from a byte stream.
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 RoundMVPReason ¶
type RoundMVPReason byte
const ( MVPReason_MostEliminations RoundMVPReason = iota + 1 MVPReason_BombDefused MVPReason_BombPlanted )