diff --git a/lib/svrquery/protocol/titanfall/query.go b/lib/svrquery/protocol/titanfall/query.go index c2c6b7e..c31a981 100644 --- a/lib/svrquery/protocol/titanfall/query.go +++ b/lib/svrquery/protocol/titanfall/query.go @@ -174,7 +174,11 @@ func (q *queryer) Query() (resp protocol.Responser, err error) { } if i.Version > 2 { - if i.Version >= 9 { + if i.Version >= 10 { + if err = r.Read(&i.MatchStateV10); err != nil { + return nil, err + } + } else if i.Version >= 9 { if err = r.Read(&i.MatchStateV9); err != nil { return nil, err } diff --git a/lib/svrquery/protocol/titanfall/query_test.go b/lib/svrquery/protocol/titanfall/query_test.go index 23332e0..c4fc793 100644 --- a/lib/svrquery/protocol/titanfall/query_test.go +++ b/lib/svrquery/protocol/titanfall/query_test.go @@ -106,6 +106,19 @@ func TestQuery(t *testing.T) { } v9.MatchState = MatchState{} + v10 := v9 + v10.Version = 10 + v10.MatchStateV10 = MatchStateV10{ + MatchStateV9: MatchStateV9{ + Phase: 3, + TimePassed: 0, + TeamsLeftWithPlayersNum: 0, + }, + CurrentEntityPropertyCount: 2, + MaxEntityPropertyCount: 5, + } + v10.MatchStateV9 = MatchStateV9{} + cases := []struct { name string version byte @@ -147,6 +160,15 @@ func TestQuery(t *testing.T) { key: testKey, expEncypted: true, }, + { + name: "v10", + version: 10, + request: "request-v10", + response: "response-v10", + expected: v10, + key: testKey, + expEncypted: true, + }, { name: "keyed", version: 5, diff --git a/lib/svrquery/protocol/titanfall/register.go b/lib/svrquery/protocol/titanfall/register.go index fb9d5a1..c0180d7 100644 --- a/lib/svrquery/protocol/titanfall/register.go +++ b/lib/svrquery/protocol/titanfall/register.go @@ -10,4 +10,5 @@ func init() { protocol.MustRegister("tf2e-v7", newQueryer(7)) protocol.MustRegister("tf2e-v8", newQueryer(8)) protocol.MustRegister("tf2e-v9", newQueryer(9)) + protocol.MustRegister("tf2e-v10", newQueryer(10)) } diff --git a/lib/svrquery/protocol/titanfall/testdata/request-v10 b/lib/svrquery/protocol/titanfall/testdata/request-v10 new file mode 100644 index 0000000..4c925c0 Binary files /dev/null and b/lib/svrquery/protocol/titanfall/testdata/request-v10 differ diff --git a/lib/svrquery/protocol/titanfall/testdata/response-v10 b/lib/svrquery/protocol/titanfall/testdata/response-v10 new file mode 100644 index 0000000..a0a6e8f Binary files /dev/null and b/lib/svrquery/protocol/titanfall/testdata/response-v10 differ diff --git a/lib/svrquery/protocol/titanfall/types.go b/lib/svrquery/protocol/titanfall/types.go index 2a58efa..903a189 100644 --- a/lib/svrquery/protocol/titanfall/types.go +++ b/lib/svrquery/protocol/titanfall/types.go @@ -28,6 +28,8 @@ type Info struct { MatchState // Version 9+ MatchStateV9 + // Version 10+ + MatchStateV10 Teams []Team Clients []Client @@ -182,6 +184,14 @@ type PerformanceInfo struct { MaxUserCommandTime float32 } +// MatchStateV10 represents match state contained in a query response. +// Two new fields on entity count were added in this version of the schema. +type MatchStateV10 struct { + MatchStateV9 + CurrentEntityPropertyCount uint32 + MaxEntityPropertyCount uint32 +} + // MatchStateV9 represents match state contained in a query response. // A number of fields were removed in this version of the schema. type MatchStateV9 struct {