Rise
The Vieneo Province
Toggle main menu visibility
Loading...
Searching...
No Matches
isteamgameserverstats.h
Go to the documentation of this file.
1
//====== Copyright © Valve Corporation, All rights reserved. =======
2
//
3
// Purpose: interface for game servers to steam stats and achievements
4
//
5
//=============================================================================
6
7
#ifndef ISTEAMGAMESERVERSTATS_H
8
#define ISTEAMGAMESERVERSTATS_H
9
#ifdef _WIN32
10
#pragma once
11
#endif
12
13
#include "
steam_api_common.h
"
14
15
//-----------------------------------------------------------------------------
16
// Purpose: Functions for authenticating users via Steam to play on a game server
17
//-----------------------------------------------------------------------------
18
class
ISteamGameServerStats
19
{
20
public
:
21
// downloads stats for the user
22
// returns a GSStatsReceived_t callback when completed
23
// if the user has no stats, GSStatsReceived_t.m_eResult will be set to k_EResultFail
24
// these stats will only be auto-updated for clients playing on the server. For other
25
// users you'll need to call RequestUserStats() again to refresh any data
26
STEAM_CALL_RESULT
(
GSStatsReceived_t
)
27
virtual
SteamAPICall_t
RequestUserStats
(
CSteamID
steamIDUser ) = 0;
28
29
// requests stat information for a user, usable after a successful call to RequestUserStats()
30
STEAM_FLAT_NAME
( GetUserStatInt32 )
31
virtual
bool
GetUserStat
(
CSteamID
steamIDUser, const
char
*pchName,
int32
*pData ) = 0;
32
33
STEAM_FLAT_NAME
( GetUserStatFloat )
34
virtual
bool
GetUserStat
(
CSteamID
steamIDUser, const
char
*pchName,
float
*pData ) = 0;
35
36
virtual
bool
GetUserAchievement
(
CSteamID
steamIDUser, const
char
*pchName,
bool
*pbAchieved ) = 0;
37
38
// Set / update stats and achievements.
39
// Note: These updates will work only on stats game servers are allowed to edit and only for
40
// game servers that have been declared as officially controlled by the game creators.
41
// Set the IP range of your official servers on the Steamworks page
42
43
STEAM_FLAT_NAME
( SetUserStatInt32 )
44
virtual
bool
SetUserStat
(
CSteamID
steamIDUser, const
char
*pchName,
int32
nData ) = 0;
45
46
STEAM_FLAT_NAME
( SetUserStatFloat )
47
virtual
bool
SetUserStat
(
CSteamID
steamIDUser, const
char
*pchName,
float
fData ) = 0;
48
49
virtual
bool
UpdateUserAvgRateStat
(
CSteamID
steamIDUser, const
char
*pchName,
float
flCountThisSession,
double
dSessionLength ) = 0;
50
51
virtual
bool
SetUserAchievement
(
CSteamID
steamIDUser, const
char
*pchName ) = 0;
52
virtual
bool
ClearUserAchievement
(
CSteamID
steamIDUser, const
char
*pchName ) = 0;
53
54
// Store the current data on the server, will get a GSStatsStored_t callback when set.
55
//
56
// If the callback has a result of k_EResultInvalidParam, one or more stats
57
// uploaded has been rejected, either because they broke constraints
58
// or were out of date. In this case the server sends back updated values.
59
// The stats should be re-iterated to keep in sync.
60
STEAM_CALL_RESULT
(
GSStatsStored_t
)
61
virtual
SteamAPICall_t
StoreUserStats
(
CSteamID
steamIDUser ) = 0;
62
};
63
#define STEAMGAMESERVERSTATS_INTERFACE_VERSION "SteamGameServerStats001"
64
65
// Global accessor
66
inline
ISteamGameServerStats
*
SteamGameServerStats
();
67
STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR
(
ISteamGameServerStats
*,
SteamGameServerStats
,
STEAMGAMESERVERSTATS_INTERFACE_VERSION
);
68
69
70
// callbacks
71
#if defined( VALVE_CALLBACK_PACK_SMALL )
72
#pragma pack( push, 4 )
73
#elif defined( VALVE_CALLBACK_PACK_LARGE )
74
#pragma pack( push, 8 )
75
#else
76
#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
77
#endif
78
79
//-----------------------------------------------------------------------------
80
// Purpose: called when the latests stats and achievements have been received
81
// from the server
82
//-----------------------------------------------------------------------------
83
struct
GSStatsReceived_t
84
{
85
enum
{
k_iCallback
=
k_iSteamGameServerStatsCallbacks
};
86
EResult
m_eResult
;
// Success / error fetching the stats
87
CSteamID
m_steamIDUser
;
// The user for whom the stats are retrieved for
88
};
89
90
91
//-----------------------------------------------------------------------------
92
// Purpose: result of a request to store the user stats for a game
93
//-----------------------------------------------------------------------------
94
struct
GSStatsStored_t
95
{
96
enum
{
k_iCallback
=
k_iSteamGameServerStatsCallbacks
+ 1 };
97
EResult
m_eResult
;
// success / error
98
CSteamID
m_steamIDUser
;
// The user for whom the stats were stored
99
};
100
101
//-----------------------------------------------------------------------------
102
// Purpose: Callback indicating that a user's stats have been unloaded.
103
// Call RequestUserStats again to access stats for this user
104
//-----------------------------------------------------------------------------
105
struct
GSStatsUnloaded_t
106
{
107
enum
{
k_iCallback
=
k_iSteamUserStatsCallbacks
+ 8 };
108
CSteamID
m_steamIDUser
;
// User whose stats have been unloaded
109
};
110
111
#pragma pack( pop )
112
113
114
#endif
// ISTEAMGAMESERVERSTATS_H
CSteamID
Definition
steamclientpublic.h:485
ISteamGameServerStats
Definition
isteamgameserverstats.h:19
ISteamGameServerStats::SetUserStat
virtual bool SetUserStat(CSteamID steamIDUser, const char *pchName, int32 nData)=0
ISteamGameServerStats::GetUserStat
virtual bool GetUserStat(CSteamID steamIDUser, const char *pchName, int32 *pData)=0
ISteamGameServerStats::SetUserAchievement
virtual bool SetUserAchievement(CSteamID steamIDUser, const char *pchName)=0
ISteamGameServerStats::StoreUserStats
virtual SteamAPICall_t StoreUserStats(CSteamID steamIDUser)=0
ISteamGameServerStats::RequestUserStats
virtual SteamAPICall_t RequestUserStats(CSteamID steamIDUser)=0
ISteamGameServerStats::UpdateUserAvgRateStat
virtual bool UpdateUserAvgRateStat(CSteamID steamIDUser, const char *pchName, float flCountThisSession, double dSessionLength)=0
ISteamGameServerStats::ClearUserAchievement
virtual bool ClearUserAchievement(CSteamID steamIDUser, const char *pchName)=0
ISteamGameServerStats::GetUserAchievement
virtual bool GetUserAchievement(CSteamID steamIDUser, const char *pchName, bool *pbAchieved)=0
SteamGameServerStats
ISteamGameServerStats * SteamGameServerStats()
STEAMGAMESERVERSTATS_INTERFACE_VERSION
#define STEAMGAMESERVERSTATS_INTERFACE_VERSION
Definition
isteamgameserverstats.h:63
steam_api_common.h
STEAM_FLAT_NAME
#define STEAM_FLAT_NAME(NAME)
Definition
steam_api_internal.h:305
STEAM_CALL_RESULT
#define STEAM_CALL_RESULT(RESULT_TYPE)
Definition
steam_api_internal.h:303
k_iSteamGameServerStatsCallbacks
@ k_iSteamGameServerStatsCallbacks
Definition
steam_api_internal.h:261
k_iSteamUserStatsCallbacks
@ k_iSteamUserStatsCallbacks
Definition
steam_api_internal.h:253
STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR
#define STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR(type, name, version)
Definition
steam_api_internal.h:43
EResult
EResult
Definition
steamclientpublic.h:15
int32
int int32
Definition
steamtypes.h:57
SteamAPICall_t
uint64 SteamAPICall_t
Definition
steamtypes.h:93
GSStatsReceived_t
Definition
isteamgameserverstats.h:84
GSStatsReceived_t::k_iCallback
@ k_iCallback
Definition
isteamgameserverstats.h:85
GSStatsReceived_t::m_eResult
EResult m_eResult
Definition
isteamgameserverstats.h:86
GSStatsReceived_t::m_steamIDUser
CSteamID m_steamIDUser
Definition
isteamgameserverstats.h:87
GSStatsStored_t
Definition
isteamgameserverstats.h:95
GSStatsStored_t::m_eResult
EResult m_eResult
Definition
isteamgameserverstats.h:97
GSStatsStored_t::m_steamIDUser
CSteamID m_steamIDUser
Definition
isteamgameserverstats.h:98
GSStatsStored_t::k_iCallback
@ k_iCallback
Definition
isteamgameserverstats.h:96
GSStatsUnloaded_t
Definition
isteamgameserverstats.h:106
GSStatsUnloaded_t::m_steamIDUser
CSteamID m_steamIDUser
Definition
isteamgameserverstats.h:108
GSStatsUnloaded_t::k_iCallback
@ k_iCallback
Definition
isteamgameserverstats.h:107
ThirdParty
SteamworksSDK
include
steam
isteamgameserverstats.h
Generated on
for Rise by
1.18.0