Skip to content

Commit 40697c4

Browse files
committed
Create response models
1 parent ce6ff03 commit 40697c4

11 files changed

Lines changed: 277 additions & 0 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace SteamQueryNet.Enums
2+
{
3+
public enum Environment
4+
{
5+
Linux = 'l',
6+
Windows = 'w',
7+
Mac = 'm'
8+
}
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace SteamQueryNet.Enums
2+
{
3+
public enum ServerType
4+
{
5+
Dedicated = 'd',
6+
NonDedicated = 'l',
7+
SourceTVRelay = 'p'
8+
}
9+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace SteamQueryNet.Enums
2+
{
3+
public enum ShipGameMode
4+
{
5+
Hunt = 0,
6+
Elimination = 1,
7+
Duel = 2,
8+
Deathmatch = 3,
9+
VIPTeam = 4,
10+
TeamElimination = 5
11+
}
12+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace SteamQueryNet.Enums
2+
{
3+
public enum VAC
4+
{
5+
Unsecured = 0,
6+
Secured = 1
7+
}
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace SteamQueryNet.Enums
2+
{
3+
public enum Visibility
4+
{
5+
Public = 0,
6+
Private = 1
7+
}
8+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
namespace SteamQueryNet.Models
2+
{
3+
public sealed class RequestHeaders
4+
{
5+
public const byte A2S_INFO = 0x54;
6+
7+
public const byte A2S_PLAYER = 0x55;
8+
9+
public const byte A2S_RULES = 0x56;
10+
}
11+
12+
public sealed class ResponseHeaders
13+
{
14+
public const byte S2A_INFO = 0x49;
15+
16+
public const byte S2A_CHALLENGE = 0x41;
17+
18+
public const byte S2A_PLAYER = 0x44;
19+
20+
public const byte S2A_RULES = 0x45;
21+
}
22+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using SteamQueryNet.Models.TheShip;
2+
3+
namespace SteamQueryNet.Models
4+
{
5+
public sealed class Player
6+
{
7+
/// <summary>
8+
/// Index of player chunk starting from 0.
9+
/// </summary>
10+
public byte Index { get; set; }
11+
12+
/// <summary>
13+
/// Name of the player.
14+
/// </summary>
15+
public string Name { get; set; }
16+
17+
/// <summary>
18+
/// Player's score (usually "frags" or "kills".)
19+
/// </summary>
20+
public long Score { get; set; }
21+
22+
/// <summary>
23+
/// Time (in seconds) player has been connected to the server.
24+
/// </summary>
25+
public float Duration { get; set; }
26+
27+
/// <summary>
28+
/// The Ship additional player info.
29+
/// </summary>
30+
public ShipPlayerDetails ShipPlayerDetails { get; set; }
31+
}
32+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
namespace SteamQueryNet.Models
2+
{
3+
public sealed class Rule
4+
{
5+
/// <summary>
6+
/// Name of the rule.
7+
/// </summary>
8+
public string Name { get; set; }
9+
10+
/// <summary>
11+
/// Value of the rule.
12+
/// </summary>
13+
public string Value { get; set; }
14+
}
15+
}
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
using SteamQueryNet.Enums;
2+
using SteamQueryNet.Models.TheShip;
3+
4+
namespace SteamQueryNet.Models
5+
{
6+
public sealed class ServerInfo
7+
{
8+
/// <summary>
9+
/// Protocol version used by the server.
10+
/// </summary>
11+
public byte Protocol { get; set; }
12+
13+
/// <summary>
14+
/// Name of the server.
15+
/// </summary>
16+
public string Name { get; set; }
17+
18+
/// <summary>
19+
/// Map the server has currently loaded.
20+
/// </summary>
21+
public string Map { get; set; }
22+
23+
/// <summary>
24+
/// Name of the folder containing the game files.
25+
/// </summary>
26+
public string Folder { get; set; }
27+
28+
/// <summary>
29+
/// Full name of the game.
30+
/// </summary>
31+
public string Game { get; set; }
32+
33+
/// <summary>
34+
/// Steam Application ID of game.
35+
/// </summary>
36+
public short ID { get; set; }
37+
38+
/// <summary>
39+
/// Number of players on the server.
40+
/// </summary>
41+
public byte Players { get; set; }
42+
43+
/// <summary>
44+
/// Maximum number of players the server reports it can hold.
45+
/// </summary>
46+
public byte MaxPlayers { get; set; }
47+
48+
/// <summary>
49+
/// Number of bots on the server.
50+
/// </summary>
51+
public byte Bots { get; set; }
52+
53+
/// <summary>
54+
/// Indicates the type of server.
55+
/// </summary>
56+
public ServerType ServerType { get; set; }
57+
58+
/// <summary>
59+
/// Indicates the operating system of the server.
60+
/// </summary>
61+
public Environment Environment { get; set; }
62+
63+
/// <summary>
64+
/// Indicates whether the server requires a password.
65+
/// </summary>
66+
public Visibility Visibility { get; set; }
67+
68+
/// <summary>
69+
/// Specifies whether the server uses VAC.
70+
/// </summary>
71+
public VAC VAC { get; set; }
72+
73+
/// <summary>
74+
/// This property only exist in a response if the server is running The Ship.
75+
/// </summary>
76+
public ShipGameInfo ShipGameInfo { get; set; }
77+
78+
/// <summary>
79+
/// Version of the game installed on the server.
80+
/// </summary>
81+
public string Version { get; set; }
82+
83+
/// <summary>
84+
/// If present, this specifies which additional data fields will be included.
85+
/// </summary>
86+
public byte EDF { get; set; }
87+
88+
/// <summary>
89+
/// The server's game port number.
90+
/// </summary>
91+
public short Port { get; set; }
92+
93+
/// <summary>
94+
/// Server's SteamID.
95+
/// </summary>
96+
public long SteamID { get; set; }
97+
98+
/// <summary>
99+
/// Spectator port number for SourceTV.
100+
/// </summary>
101+
public short SourceTVPort { get; set; }
102+
103+
/// <summary>
104+
/// Name of the spectator server for SourceTV.
105+
/// </summary>
106+
public string SourceTVServerName { get; set; }
107+
108+
/// <summary>
109+
/// Tags that describe the game according to the server (for future use.)
110+
/// </summary>
111+
public string Keywords { get; set; }
112+
113+
/// <summary>
114+
/// The server's 64-bit GameID. If this is present, a more accurate AppID is present in the low 24 bits.
115+
/// The earlier AppID could have been truncated as it was forced into 16-bit storage.
116+
/// </summary>
117+
public long GameID { get; set; }
118+
}
119+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using SteamQueryNet.Enums;
2+
3+
namespace SteamQueryNet.Models.TheShip
4+
{
5+
/// <summary>
6+
/// These fields only exist in a response if the server is running The Ship.
7+
/// </summary>
8+
public sealed class ShipGameInfo
9+
{
10+
/// <summary>
11+
/// Indicates the game mode.
12+
/// </summary>
13+
public ShipGameMode Mode { get; set; }
14+
15+
/// <summary>
16+
/// The number of witnesses necessary to have a player arrested.
17+
/// </summary>
18+
public byte Witnesses { get; set; }
19+
20+
/// <summary>
21+
/// Time (in seconds) before a player is arrested while being witnessed.
22+
/// </summary>
23+
public byte Duration { get; set; }
24+
}
25+
}

0 commit comments

Comments
 (0)