Skip to content

Commit

Permalink
Lots of improvements to stats
Browse files Browse the repository at this point in the history
Add support for team ID
Update keyvalues doc example
Rename FlashbangAssists to FlashAssists for consistency
  • Loading branch information
nickdnk committed Mar 11, 2023
1 parent 6b1f659 commit bbfc341
Show file tree
Hide file tree
Showing 16 changed files with 532 additions and 341 deletions.
97 changes: 89 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,96 @@ details.
name is always `GOTV`. Alternatively, you can ignore all messages with an empty `steamid`.
2. The [stats system](https://splewis.github.io/get5/dev/stats_system/#keyvalue) has been updated. This means that
the structure has been modified to allow for more information, specifically the starting side and score for each side
for each team.
for each team, full stats for players as well as a new option to add team IDs.

**If you use any of the stats extensions, you must also update those plugins (`get5_mysqlstats.smx`
and `get5_apistats.smx`)!**

Keys changed in the map root (i.e. `map0`):
1. `team1_name` and `team2_name` removed.
2. `team1` and `team2` added (objects), each with an `id` and a `name` key.

Keys changed for each team (i.e. `map0 -> team1`):
1. Players' SteamIDs and stats have moved from the root of the team object into a key called `players`.
1. Players' SteamIDs and stats have moved from the root of the team object into an object called `players`.
2. Added `score_ct`
3. Added `score_t`
4. Added `starting_side` (`2` for T, `3` for CT as this is an integer enum)
3. The structure of the `Get5_OnRoundEnd` JSON event has changed (not to be confused with the KeyValues file in #2
above):

`teamX_score` (int) has been replaced by an object called `teamX`, which looks like this.
3. The structure of the `Get5_OnSeriesInit` JSON event has changed:

Old:
```json5
{
"event": "series_start",
"matchid": "29844",
"team1_name": "TeamName",
"team2_name": "AnotherTeamName"
}
```
New:
```json5
{
"event": "series_start",
"series_length": 3, // Bo3
"matchid": "29844",
"team1": {
"id": "482", // nullable in JSON, empty string in SourceMod.
"name": "TeamName"
}
// same for team2
}
```
4. The structure of the `Get5_OnMapResult` JSON event has changed:

Old:
```json5
{
"event": "map_result",
"matchid": "29844",
"map_number": 0,
"winner": {
"team": "team1",
"side": "t"
},
"team1_score": 10,
"team2_score": 12
}
```

New:
```json5
{
"event": "map_result",
"matchid": "29844",
"map_number": 0,
"winner": {
"team": "team1",
"side": "t"
},
"team1": {
"id": "482", // nullable in JSON, empty string in SourceMod.
"name": "TeamName",
"series_score": 1,
"score": 10,
"score_ct": 4,
"score_t": 6,
"side": "t",
"starting_side": "ct",
"players": [
{
"name": "Nyxi",
"steamid": "76561197996426755",
"stats": {
// Full player stats.
}
}
]
},
// same for team2
}
```

5. Similarly to 4., the structure of the `Get5_OnRoundEnd` JSON event has changed:

Old:
```json5
Expand Down Expand Up @@ -69,7 +145,9 @@ details.
"side": "t"
},
"team1": {
"id": "482", // nullable in JSON, empty string in SourceMod.
"name": "TeamName",
"series_score": 1,
"score": 10,
"score_ct": 4,
"score_t": 6,
Expand All @@ -89,8 +167,8 @@ details.
}
```

This affects the `Get5_OnRoundEnd` forward as well, so if you have a plugin that reads this data, you must update it.
For full details and the SourceMod properties, see
These changes affect the corresponding forwards as well, so if you have a plugin that reads this data, you must
update it. For full details and the SourceMod properties, see
the [event documentation](https://splewis.github.io/get5/dev/events_and_forwards/#events).
4. Get5 no longer sets its [game state](https://splewis.github.io/get5/dev/commands/#get5_status) to `none`
immediately following the end of the series, but now waits until the restore timer fires. Get5 will be in `post_game`
Expand All @@ -106,7 +184,8 @@ details.
set [`get5_pretty_print_json 0`](https://splewis.github.io/get5/dev/configuration/#get5_pretty_print_json) to
avoid hitting the limit. You **will** see an error in console if this happens.
3. The `get5_mysqlstats` extension now uses a transaction to update stat rows for each player. This improves performance
via reduced I/O between the game server and the database server.
via reduced I/O between the game server and the database server. It now also runs on the JSON methodmaps provided to
forwards instead of copying the KeyValue stat object.
4. The [documentation of events](https://splewis.github.io/get5/dev/events_and_forwards/#events) is now rendered
on `https://redocly.github.io` instead of being embedded in the Get5 documentation website. This allows for more
space and makes it easier to browse/read.
Expand All @@ -116,6 +195,8 @@ details.
[`mp_teamlogo_1`](https://totalcsgo.com/command/mpteamlogo1) etc.) are now reset to blank when Get5 ends a series.
Previously, these parameters would linger and would have to be manually reset or replaced by loading a new match
configuration.
6. You can now provide an `id` parameter to your team objects in match configurations, which is echoed back in the
forwards and JSON events.

# 0.13.0

Expand Down
1 change: 1 addition & 0 deletions configs/get5/tests/default_valid.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"favored_percentage_text" "team percentage text"
"team1"
{
"id" "TeamAID"
"name" "Team A Default"
"tag" "TAG-A"
"flag" "US"
Expand Down
1 change: 1 addition & 0 deletions configs/get5/tests/default_valid.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"favored_percentage_team1": 75,
"favored_percentage_text": "team percentage text",
"team1": {
"id": "TeamAID",
"name": "Team A Default",
"tag": "TAG-A",
"flag": "US",
Expand Down
1 change: 1 addition & 0 deletions configs/get5/tests/team2.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"Team"
{
"id" "TeamBID"
"name" "Team B Default"
"tag" "TAG-FF"
"flag" "DE"
Expand Down
1 change: 1 addition & 0 deletions configs/get5/tests/team2.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"id": "TeamBID",
"name": "Team B Default",
"tag": "TAG-FF",
"flag": "DE",
Expand Down
116 changes: 62 additions & 54 deletions documentation/docs/event_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,16 +163,14 @@ paths:
event:
enum:
- series_start
team1_name:
type: string
example: NaVi
description: The name of team 1. `GetTeam1Name()` and `SetTeam1Name()`
in SourceMod.
team2_name:
type: string
example: Astralis
description: The name of team 2. `GetTeam2Name()` and `SetTeam2Name()`
in SourceMod.
series_length:
type: integer
minimum: 1
description: The number of maps in the series, i.e. 3 for a Bo3. `SeriesLength` in SourceMod.
team1:
"$ref": "#/components/schemas/Get5TeamWrapper"
team2:
"$ref": "#/components/schemas/Get5TeamWrapper"
responses: { }
"/Get5_OnMatchPaused":
post:
Expand Down Expand Up @@ -255,16 +253,10 @@ paths:
event:
enum:
- map_result
team1_score:
type: integer
minimum: 0
description: The score of team1. `Team1Score` in SourceMod.
example: 16
team2_score:
type: integer
minimum: 0
description: The score of team2. `Team2Score` in SourceMod.
example: 13
team1:
$ref: "#/components/schemas/Get5StatsTeam"
team2:
$ref: "#/components/schemas/Get5StatsTeam"
winner:
$ref: "#/components/schemas/Get5Winner"
responses: { }
Expand Down Expand Up @@ -1112,43 +1104,59 @@ components:
properties:
pause_type:
$ref: "#/components/schemas/Get5PauseType"
Get5StatsTeam:
Get5TeamWrapper:
type: object
description: Describes a team. `Team1` or `Team2` in SourceMod.
properties:
id:
type: string
description: User-supplied ID of the team, if one was provided. `GetId()` and `SetId()` in SourceMod. `null` in JSON and an empty string in SourceMod.
example: "2843"
nullable: true
name:
type: string
description: The name of the team.
description: The name of the team. `GetName()` and `SetName()` in SourceMod.
example: Natus Vincere
score:
type: integer
minimum: 0
description: The team's total score on the current map.
example: 14
score_ct:
type: integer
minimum: 0
description: The team's score on the CT side on the current map.
example: 10
score_t:
type: integer
minimum: 0
description: The team's score on the T side on the current map.
example: 14
players:
type: array
description: The players on the team.
items:
$ref: "#/components/schemas/Get5StatsPlayer"
side:
title: Get5Side
description: The current side of the team.
allOf:
- $ref: "#/components/schemas/Get5Side"
starting_side:
title: Get5Side
description: The starting side of the team.
allOf:
- $ref: "#/components/schemas/Get5Side"
Get5StatsTeam:
description: Describes a team with its score and player stats. `Team1` or `Team2` in SourceMod.
allOf:
- $ref: "#/components/schemas/Get5TeamWrapper"
- type: object
properties:
series_score:
type: integer
minimum: 0
description: The team's current series score, i.e. the number of maps they have won in the series. `SeriesScore` in SourceMod.
score:
type: integer
minimum: 0
description: The team's total score on the current map. `Score` in SourceMod.
example: 14
score_ct:
type: integer
minimum: 0
description: The team's score on the CT side on the current map. `ScoreCT` in SourceMod.
example: 10
score_t:
type: integer
minimum: 0
description: The team's score on the T side on the current map. `ScoreT` in SourceMod.
example: 14
players:
type: array
description: The players on the team. `Players` in SourceMod.
items:
$ref: "#/components/schemas/Get5StatsPlayer"
side:
title: Get5Side
description: The current side of the team. `Side` in SourceMod.
allOf:
- $ref: "#/components/schemas/Get5Side"
starting_side:
title: Get5Side
description: The starting side of the team. `StartingSide` in SourceMod.
allOf:
- $ref: "#/components/schemas/Get5Side"
Get5PlayerBase:
type: object
properties:
Expand Down Expand Up @@ -1324,10 +1332,10 @@ components:
minimum: 0
description: 'The number of assists the player had. `Assists` in SourceMod.'
example: 5
flashbang_assists:
flash_assists:
type: integer
minimum: 0
description: 'The number of flashbang assists the player had. `FlashbangAssists` in SourceMod.'
description: 'The number of flashbang assists the player had. `FlashAssists` in SourceMod.'
example: 3
team_kills:
type: integer
Expand Down
14 changes: 11 additions & 3 deletions documentation/docs/match_schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type SteamID = string // (8)
type Get5PlayerSet = { [key: SteamID]: string } | SteamID[] // (9)

interface Get5MatchTeam {
"id": string | undefined // (38)
"players": Get5PlayerSet // (24)
"coaches": Get5PlayerSet | undefined // (23)
"name": string | undefined // (16)
Expand Down Expand Up @@ -164,6 +165,8 @@ interface Get5Match {
strings consisting of any valid combination of `team1_ban`, `team2_ban`, `team1_pick` and `team2_pick`.
37. _Optional_<br>Whether to configure the match for [Wingman mode](../wingman). If this is enabled, `players_per_team`
defaults to `2` instead of `5`.<br><br>**`Default: false`**
38. _Optional_<br>The ID of the team. This can be used to link the team to an external resource, such as a database ID.
The ID is included in the event system for events that include a team.

!!! info "Team assignment priority"

Expand Down Expand Up @@ -230,6 +233,7 @@ These examples are identical in the way they would work if loaded.
"fromfile": "addons/sourcemod/get5/team_navi.json"
},
"team2": {
"id": "3752",
"name": "Astralis",
"tag": "Astralis",
"flag": "DK",
Expand Down Expand Up @@ -257,6 +261,7 @@ These examples are identical in the way they would work if loaded.
`fromfile` example:
```json title="addons/sourcemod/get5/team_navi.json"
{
"id": "1348",
"name": "Natus Vincere",
"tag": "NaVi",
"flag": "UA",
Expand Down Expand Up @@ -311,6 +316,7 @@ These examples are identical in the way they would work if loaded.
"fromfile": "addons/sourcemod/get5/team_navi.json"
},
"team2": {
"id": "3752",
"name": "Astralis",
"tag": "Astralis",
"flag": "DK",
Expand Down Expand Up @@ -394,8 +400,9 @@ These examples are identical in the way they would work if loaded.
}
"team2"
{
"id" "3752"
"name" "Astralis"
"tag" "Astralis"
"tag" "Astralis"
"flag" "DK"
"logo" "astr"
"matchtext" "Defending Champions"
Expand Down Expand Up @@ -424,9 +431,10 @@ These examples are identical in the way they would work if loaded.
`fromfile` example:
```cfg title="addons/sourcemod/get5/team_navi.cfg"
"Team"
{
{
"id" "1348"
"name" "Natus Vincere"
"tag" "NaVi"
"tag" "NaVi"
"flag" "UA"
"logo" "navi"
"matchtext" "Challengers"
Expand Down

0 comments on commit bbfc341

Please sign in to comment.