diff --git a/README.md b/README.md index b015c4c..5b50e6b 100644 --- a/README.md +++ b/README.md @@ -60,11 +60,13 @@ Usage of csminify: #### Supported Formats -Format | Command Line (`-format` Flag) | Structure ---- | --- | --- -JSON | `json` | [schema.json](schema.json) -MessagePack | `msgpack`, `mp` | [schema.json](schema.json) -Protocol Buffers | `protobuf`, `proto`, `pb` | [replay.proto](protobuf/gen/proto/replay.proto) +| Format | Command Line (`-format` Flag) | Structure | +| --- | --- | --- | +| JSON | `json` | [schema.json](schema.json) | +| MessagePack | `msgpack`, `mp` | [schema.json](schema.json) | +| Protocol Buffers | `protobuf`, `proto`, `pb` | [replay.proto](protobuf/gen/proto/replay.proto) | + +Events and attributes are documented in [events.md](events.md). More formats can be added programmatically by implementing the `ReplayMarshaller` interface. @@ -76,6 +78,8 @@ If you would like to see additional formats supported please open a feature requ This is an example on how to minify a demo to JSON and decode it to a `replay.Replay` again. ```go +package main + import ( "bytes" "encoding/json" diff --git a/events.md b/events.md new file mode 100644 index 0000000..e1e0d82 --- /dev/null +++ b/events.md @@ -0,0 +1,86 @@ +# Events + +- [`fire`](#fire) +- [`hurt`](#hurt) +- [`kill`](#kill) +- [`flashed`](#flashed) +- [`jump`](#jump) +- [`footstep`](#footstep) +- [`chat_message`](#chat_message) +- [`swap_team`](#swap_team) +- [`disconnect`](#disconnect) +- [`round_started`](#round_started) +- [`round_ended`](#round_ended) + +## Attributes + +### `fire` + +| attribute | type | description | +| --- | --- | --- | +| `entityId` | `numVal` | EntityID | + +### `hurt` + +| attribute | type | description | +| --- | --- | --- | +| `entityId` | `numVal` | EntityID | + +### `kill` + +| attribute | type | description | +| --- | --- | --- | +| `victim` | `numVal` | EntityID | +| `weapon` | `numVal` | see [`EquipmentElement`](https://godoc.org/github.com/markus-wa/demoinfocs-golang/common#EquipmentElement) | +| `killer` | `numVal` | EntityID | +| `assister` | `numVal` | EntityID | + +### `flashed` + +| attribute | type | description | +| --- | --- | --- | +| `entityId` | `numVal` | EntityID | + +### `jump` + +| attribute | type | description | +| --- | --- | --- | +| `entityId` | `numVal` | EntityID | + +### `footstep` + +| attribute | type | description | +| --- | --- | --- | +| `entityId` | `numVal` | EntityID | + +### `chat_message` + +| attribute | type | description | +| --- | --- | --- | +| `sender` | `numVal` | EntityID | +| `text` | `strVal` | chat message | + +### `swap_team` + +| attribute | type | description | +| --- | --- | --- | +| `entityId` | `numVal` | EntityID | + +### `disconnect` + +| attribute | type | description | +| --- | --- | --- | +| `entityId` | `numVal` | EntityID | + +### `round_started` + +| attribute | type | description | +| --- | --- | --- | +| - | - | - | + +### `round_ended` + +| attribute | type | description | +| --- | --- | --- | +| `winner` | `numVal` | see [`Team`](https://godoc.org/github.com/markus-wa/demoinfocs-golang/common#Team) | +| `reason` | `numVal` | see [`RoundEndReason`](https://godoc.org/github.com/markus-wa/demoinfocs-golang/events#RoundEndReason) |