the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 133 lines 6.2 kB view raw
1/******************************************************** 2* * 3* Copyright (C) Microsoft. All rights reserved. * 4* * 5********************************************************/ 6 7// Sentient Client Stats API 8// 9// Include this to get access to all Stats-related Sentient features. 10 11#pragma once 12 13#include "SenClientTypes.h" 14 15 16namespace Sentient 17{ 18 /*********************** 19 ***** Stats Types ***** 20 ***********************/ 21 22 #define SenStatID_Custom 128 23 24 // Stats 25 #define SenStatFlag_Normal 1 26 #define SenStatFlag_Time 2 27 #define SenStatFlag_TimeEnd 4 28 29 // Params 30 #define SenStatValueFlag_Inc 1 31 #define SenStatValueFlag_Accum 2 32 #define SenStatValueFlag_Min 4 33 #define SenStatValueFlag_Max 8 34 35 // Enable Logging if we are in debug build 36#ifdef _DEBUG 37 #define SEN_LOGTELEMETRY 38#endif 39 40 struct SenStat 41 { 42 DWORD dwUserID; 43 DWORD dwStatID; 44 DWORD dwFlags; // SenStatFlag_* 45 DWORD dwNumProperties; 46 CHAR* arrProperties; 47 DWORD dwNumValues; 48 CHAR* arrValues; 49 DWORD* arrValueFlags; // SenStatValueFlag_* 50 }; 51 52 53 /*************************** 54 ***** Stats Functions ***** 55 ***************************/ 56 57 /// @brief Submit a stat entry to the sentient system 58 /// 59 /// @param[in] pStat 60 /// The pointer to SenStat structure. The SentientStatsSend function is usually called from the autogenerated fuctions 61 /// which use as [in] parameters the userIndex(0 through 3) and the set of the stat properties/values. The rest of the SenStat structure memebers are 62 /// created automatically from the stat xml file generated code. 63 /// 64 /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: 65 /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. 66 /// E_FAIL: Failed to spawn server call. 67 /// S_OK: Server call spawned successfully. 68 /// 69 /// @details Calls to this function should use generated Telemetry code, rather than 70 /// calling the function from title code 71 HRESULT SentientStatsSend( SenStat *pStat ); 72 73 /// @brief Sets the send interval for Telemetry. Only works in debug builds 74 /// 75 /// @param[in] dwIntervalMs 76 /// The new send interval, in milliseconds. This value is capped at a minimum of 250 ms. 77 /// 78 /// @details The body of this function is conditionally compiled out of non-debug builds. 79 /// 80 void SentientSetStatSendInterval( DWORD dwIntervalMs ); 81 82 /// @brief Requests that Sentient immediately send any stats being buffered 83 /// 84 /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: 85 /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. 86 /// SENTIENT_E_TOO_MANY_CALLS: You tried to flush too quickly after a previous flush. 87 /// S_OK: Buffered stats will be flushed to the server on the next Sentient::Update() call 88 /// 89 /// @details This API can only be called once every minute. Any attempts to call the API more frequently 90 /// will result in the call being throttled, and the API returning SENTIENT_E_TOO_MANY_CALLS 91 /// Data is not actually sent until the next Sentient::Update() call 92 HRESULT SentientFlushStats( ); 93 94 /// @brief Requests that Sentient immediately send any stats being buffered because the title is exiting 95 /// 96 /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: 97 /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. 98 /// SENTIENT_E_TOO_MANY_CALLS: You tried to flush on Exit more than once 99 /// S_OK: Buffered stats will be flushed to the server on the next Sentient::Update() call 100 /// 101 /// @details This API can only be called ONCE. Any attempts to call the API more frequently 102 /// will result in the call being throttled, and the API returning SENTIENT_E_TOO_MANY_CALLS 103 /// Data is not actually sent until the next Sentient::Update() call 104 HRESULT SentientFlushStatsOnExit( ); 105 106 /// @brief Requests that Sentient immediately send any stats being buffered because the title is going to the marketplace and may not return 107 /// 108 /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: 109 /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. 110 /// SENTIENT_E_TOO_MANY_CALLS: You tried to flush on MarketPlace too many times 111 /// S_OK: Buffered stats will be flushed to the server on the next Sentient::Update() call 112 /// 113 /// @details Any attempts to call the API too frequently will result in the call being throttled, 114 /// and the API returning SENTIENT_E_TOO_MANY_CALLS 115 /// Data is not actually sent until the next Sentient::Update() call 116 HRESULT SentientFlushStatsOnMarketPlace( ); 117 118 /// @brief Tells Sentient that an important point in the game was hit and that events should be sent as soon as possible 119 /// 120 /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: 121 /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. 122 /// S_OK: Buffered stats will be flushed to the server within the next minute 123 /// 124 /// @details This API should be caleld when the game hits an important event or point. 125 /// Sentient Will send the event data to the server within the next minute, calling this method frequently will not cause any additional sends 126 HRESULT SentientFlushStatsOnKeyEvent( ); 127 128#ifdef SEN_LOGTELEMETRY 129 // if we're in debug build log out the stat to a file for testing 130 void SentientDebugLogStatSend(const char *statName, const SenStat *pStat); 131#endif 132 133} // namespace Sentient