Rise
The Vieneo Province
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//-----------------------------------------------------------------------------
19{
20public:
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
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.
61 virtual SteamAPICall_t StoreUserStats( CSteamID steamIDUser ) = 0;
62};
63#define STEAMGAMESERVERSTATS_INTERFACE_VERSION "SteamGameServerStats001"
64
65// Global accessor
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//-----------------------------------------------------------------------------
84{
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//-----------------------------------------------------------------------------
95{
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//-----------------------------------------------------------------------------
106{
108 CSteamID m_steamIDUser; // User whose stats have been unloaded
109};
110
111#pragma pack( pop )
112
113
114#endif // ISTEAMGAMESERVERSTATS_H
virtual bool SetUserStat(CSteamID steamIDUser, const char *pchName, int32 nData)=0
virtual bool GetUserStat(CSteamID steamIDUser, const char *pchName, int32 *pData)=0
virtual bool SetUserAchievement(CSteamID steamIDUser, const char *pchName)=0
virtual SteamAPICall_t StoreUserStats(CSteamID steamIDUser)=0
virtual SteamAPICall_t RequestUserStats(CSteamID steamIDUser)=0
virtual bool UpdateUserAvgRateStat(CSteamID steamIDUser, const char *pchName, float flCountThisSession, double dSessionLength)=0
virtual bool ClearUserAchievement(CSteamID steamIDUser, const char *pchName)=0
virtual bool GetUserAchievement(CSteamID steamIDUser, const char *pchName, bool *pbAchieved)=0
ISteamGameServerStats * SteamGameServerStats()
#define STEAMGAMESERVERSTATS_INTERFACE_VERSION
#define STEAM_FLAT_NAME(NAME)
#define STEAM_CALL_RESULT(RESULT_TYPE)
@ k_iSteamGameServerStatsCallbacks
@ k_iSteamUserStatsCallbacks
#define STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR(type, name, version)
int int32
Definition steamtypes.h:57
uint64 SteamAPICall_t
Definition steamtypes.h:93