aboutsummaryrefslogtreecommitdiff
path: root/pkg/messages/types/svcServerInfo.go
diff options
context:
space:
mode:
authorArda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>2023-09-21 01:53:59 +0300
committerGitHub <noreply@github.com>2023-09-21 01:53:59 +0300
commit171e350e348afadb55967b9c13d5eadc7f7d2cf4 (patch)
tree14ec93df8ccc1aca0cf453f826d46a402b09dc8f /pkg/messages/types/svcServerInfo.go
parentdefine todos on packets (diff)
downloadsdp.go-171e350e348afadb55967b9c13d5eadc7f7d2cf4.tar.gz
sdp.go-171e350e348afadb55967b9c13d5eadc7f7d2cf4.tar.bz2
sdp.go-171e350e348afadb55967b9c13d5eadc7f7d2cf4.zip
add strings builder, customize ALL outputs (#6)
Diffstat (limited to 'pkg/messages/types/svcServerInfo.go')
-rw-r--r--pkg/messages/types/svcServerInfo.go24
1 files changed, 22 insertions, 2 deletions
diff --git a/pkg/messages/types/svcServerInfo.go b/pkg/messages/types/svcServerInfo.go
index 7d44569..a6acd53 100644
--- a/pkg/messages/types/svcServerInfo.go
+++ b/pkg/messages/types/svcServerInfo.go
@@ -1,6 +1,9 @@
1package messages 1package messages
2 2
3import "github.com/pektezol/bitreader" 3import (
4 "github.com/pektezol/bitreader"
5 "github.com/pektezol/demoparser/pkg/writer"
6)
4 7
5type SvcServerInfo struct { 8type SvcServerInfo struct {
6 Protocol uint16 9 Protocol uint16
@@ -22,7 +25,7 @@ type SvcServerInfo struct {
22} 25}
23 26
24func ParseSvcServerInfo(reader *bitreader.Reader) SvcServerInfo { 27func ParseSvcServerInfo(reader *bitreader.Reader) SvcServerInfo {
25 return SvcServerInfo{ 28 svcServerInfo := SvcServerInfo{
26 Protocol: reader.TryReadUInt16(), 29 Protocol: reader.TryReadUInt16(),
27 ServerCount: reader.TryReadUInt32(), 30 ServerCount: reader.TryReadUInt32(),
28 IsHltv: reader.TryReadBool(), 31 IsHltv: reader.TryReadBool(),
@@ -40,4 +43,21 @@ func ParseSvcServerInfo(reader *bitreader.Reader) SvcServerInfo {
40 SkyName: reader.TryReadString(), 43 SkyName: reader.TryReadString(),
41 HostName: reader.TryReadString(), 44 HostName: reader.TryReadString(),
42 } 45 }
46 writer.TempAppendLine("\t\tNetwork Protocol: %d", svcServerInfo.Protocol)
47 writer.TempAppendLine("\t\tServer Count: %d", svcServerInfo.ServerCount)
48 writer.TempAppendLine("\t\tIs Hltv: %t", svcServerInfo.IsHltv)
49 writer.TempAppendLine("\t\tIs Dedicated: %t", svcServerInfo.IsDedicated)
50 writer.TempAppendLine("\t\tServer Client CRC: %d", svcServerInfo.ClientCrc)
51 writer.TempAppendLine("\t\tString Table CRC: %d", svcServerInfo.StringTableCrc)
52 writer.TempAppendLine("\t\tMax Server Classes: %d", svcServerInfo.MaxServerClasses)
53 writer.TempAppendLine("\t\tServer Map CRC: %d", svcServerInfo.MapCrc)
54 writer.TempAppendLine("\t\tCurrent Player Count: %d", svcServerInfo.PlayerCount)
55 writer.TempAppendLine("\t\tMax Player Count: %d", svcServerInfo.MaxClients)
56 writer.TempAppendLine("\t\tInterval Per Tick: %f", svcServerInfo.TickInterval)
57 writer.TempAppendLine("\t\tPlatform: %s", svcServerInfo.Platform)
58 writer.TempAppendLine("\t\tGame Directory: %s", svcServerInfo.GameDir)
59 writer.TempAppendLine("\t\tMap Name: %s", svcServerInfo.MapName)
60 writer.TempAppendLine("\t\tSky Name: %s", svcServerInfo.SkyName)
61 writer.TempAppendLine("\t\tHost Name: %s", svcServerInfo.HostName)
62 return svcServerInfo
43} 63}