1
0
KF2-Dev-Scripts/Engine/Classes/OnlineStatsInterface.uc
2020-12-13 18:01:13 +03:00

242 lines
9.7 KiB
Ucode

/**
* Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
*/
/**
* This interface deals with reading & writing stats to the online subsytem.
*/
interface OnlineStatsInterface
dependson(OnlineStatsRead,OnlineStatsWrite);
//@HSL_BEGIN_XBOX
/**
* Reads a set of stats for a player
*
* @param LocalUserNum the local player having their stats queried
* @param StatsRead holds the names of the stats to be queried and
* results are copied into the specified object
*
* @return TRUE if the call is successful, FALSE otherwise
*/
function bool ReadOnlineStatsForPlayer(byte LocalUserNum, OnlineStatsRead StatsRead);
/**
* Reads a set of stats for the specified list of players
*
* @param Players the array of unique ids to read stats for
* @param StatsRead holds the names of the stats to be queried and
* results are copied into the specified object
*
* @return TRUE if the call is successful, FALSE otherwise
*/
function bool ReadOnlineStats(byte LocalUserNum, const out array<UniqueNetId> Players, OnlineStatsRead StatsRead);
/**
* Reads a player's stat and all of that player's friends' stats for the
* specified stat name. This allows you to easily compare a player's
* stat to their friends'.
*
* @param LocalUserNum the local player having their stats and friend's stats read
* @param StatsRead holds the name of the stat to query and
* results are copied into the specified object
*
* @return TRUE if the call is successful, FALSE otherwise
*/
function bool ReadOnlineStatsForFriends(byte LocalUserNum, OnlineStatsRead StatsRead, optional bool FavoriteFriendsOnly=false, optional int NumToRead = 100);
/**
* Reads stats by ranking. This grabs the rows starting at StartIndex through
* NumToRead and places them in the StatsRead object.
*
* @param StatsRead holds the name of a leaderboard to be queried and
* results are copied into the specified object
* @param StartIndex the starting rank to begin reads at (1 for top)
* @param NumToRead the number of rows to read (clamped at 100 underneath)
*
* @return TRUE if the call is successful, FALSE otherwise
*/
function bool ReadOnlineStatsByRank(byte LocalUserNum, OnlineStatsRead StatsRead, optional int StartIndex = 1, optional int NumToRead = 100);
//@HSL_END_XBOX
/**
* Reads stats by ranking centered around a player. This grabs a set of rows
* above and below the player's current rank
*
* @param LocalUserNum the local player having their stats being centered upon
* @param StatsRead holds the name of the leaderboard to be queried and
* results are copied into the specified object
* @param NumRows the number of rows to read above and below the player's rank
*
* @return TRUE if the call is successful, FALSE otherwise
*/
function bool ReadOnlineStatsByRankAroundPlayer(byte LocalUserNum,OnlineStatsRead StatsRead,optional int NumRows = 10);
/**
* Notifies the interested party that the last stats read has completed
*
* @param bWasSuccessful true if the async action completed without error, false if there was an error
*/
delegate OnReadOnlineStatsComplete(bool bWasSuccessful);
/**
* Adds the delegate to a list used to notify the gameplay code that the stats read has completed
*
* @param ReadOnlineStatsCompleteDelegate the delegate to use for notifications
*/
function AddReadOnlineStatsCompleteDelegate(delegate<OnReadOnlineStatsComplete> ReadOnlineStatsCompleteDelegate);
/**
* Removes the delegate from the notify list
*
* @param ReadOnlineStatsCompleteDelegate the delegate to use for notifications
*/
function ClearReadOnlineStatsCompleteDelegate(delegate<OnReadOnlineStatsComplete> ReadOnlineStatsCompleteDelegate);
/**
* Cleans up any platform specific allocated data contained in the stats data
*
* @param StatsRead the object to handle per platform clean up on
*/
function FreeStats(OnlineStatsRead StatsRead);
/**
* Writes out the stats contained within the stats write object to the online
* subsystem's cache of stats data. Note the new data replaces the old. It does
* not write the data to the permanent storage until a FlushOnlineStats() call
* or a session ends. Stats cannot be written without a session or the write
* request is ignored. No more than 5 stats views can be written to at a time
* or the write request is ignored.
*
* @param SessionName the name of the session the stats are being written to
* @param Player the player to write stats for
* @param StatsWrite the object containing the information to write
*
* @return TRUE if the call is successful, FALSE otherwise
*/
function bool WriteOnlineStats(name SessionName,UniqueNetId Player,OnlineStatsWrite StatsWrite);
/**
* Commits any changes in the online stats cache to the permanent storage
*
* @param SessionName the name of the session having stats flushed for
*
* @return TRUE if the call is successful, FALSE otherwise
*/
function bool FlushOnlineStats(name SessionName);
/**
* Delegate called when the stats flush operation has completed
*
* @param SessionName the name of the session having stats flushed for
* @param bWasSuccessful true if the async action completed without error, false if there was an error
*/
delegate OnFlushOnlineStatsComplete(name SessionName,bool bWasSuccessful);
/**
* Adds the delegate used to notify the gameplay code that the stats flush has completed
*
* @param FlushOnlineStatsCompleteDelegate the delegate to use for notifications
*/
function AddFlushOnlineStatsCompleteDelegate(delegate<OnFlushOnlineStatsComplete> FlushOnlineStatsCompleteDelegate);
/**
* Clears the delegate used to notify the gameplay code that the stats flush has completed
*
* @param FlushOnlineStatsCompleteDelegate the delegate to use for notifications
*/
function ClearFlushOnlineStatsCompleteDelegate(delegate<OnFlushOnlineStatsComplete> FlushOnlineStatsCompleteDelegate);
/**
* Writes the score data for the match
*
* @param SessionName the name of the session the player stats are being recorded for
* @param LeaderboardId the leaderboard to write the score information to
* @param PlayerScores the list of players, teams, and scores they earned
*
* @return TRUE if the call is successful, FALSE otherwise
*/
function bool WriteOnlinePlayerScores(name SessionName,int LeaderboardId,const out array<OnlinePlayerScore> PlayerScores);
/**
* Reads the host's stat guid for synching up stats. Only valid on the host.
*
* @return the host's stat guid
*/
function string GetHostStatGuid();
/**
* Registers the host's stat guid with the client for verification they are part of
* the stat. Note this is an async task for any backend communication that needs to
* happen before the registration is deemed complete
*
* @param HostStatGuid the host's stat guid
*
* @return TRUE if the call is successful, FALSE otherwise
*/
function bool RegisterHostStatGuid(const out string HostStatGuid);
/**
* Called when the host stat guid registration is complete
*
* @param bWasSuccessful whether the registration has completed or not
*/
delegate OnRegisterHostStatGuidComplete(bool bWasSuccessful);
/**
* Adds the delegate for notifying when the host guid registration is done
*
* @param RegisterHostStatGuidCompleteDelegate the delegate to use for notifications
*/
function AddRegisterHostStatGuidCompleteDelegate(delegate<OnRegisterHostStatGuidComplete> RegisterHostStatGuidCompleteDelegate);
/**
* Clears the delegate used to notify the gameplay code
*
* @param RegisterHostStatGuidCompleteDelegate the delegate to use for notifications
*/
function ClearRegisterHostStatGuidCompleteDelegateDelegate(delegate<OnRegisterHostStatGuidComplete> RegisterHostStatGuidCompleteDelegate);
/**
* Reads the client's stat guid that was generated by registering the host's guid
* Used for synching up stats. Only valid on the client. Only callable after the
* host registration has completed
*
* @return the client's stat guid
*/
function string GetClientStatGuid();
/**
* Registers the client's stat guid on the host to validate that the client was in the stat.
* Used for synching up stats. Only valid on the host.
*
* @param PlayerId the client's unique net id
* @param ClientStatGuid the client's stat guid
*
* @return TRUE if the call is successful, FALSE otherwise
*/
function bool RegisterStatGuid(UniqueNetId PlayerId,const out string ClientStatGuid);
/**
* Calculates the aggregate skill from an array of skills.
*
* @param Mus - array that holds the mu values
* @param Sigmas - array that holds the sigma values
* @param OutAggregateMu - aggregate Mu
* @param OutAggregateSigma - aggregate Sigma
*/
function CalcAggregateSkill(array<double> Mus, array<double> Sigmas, out double OutAggregateMu, out double OutAggregateSigma);
//@HSL_BEGIN_XBOX
delegate OnStatisticChanged(UniqueNetId PlayerNetId, name StatName, string NewStatValue);
function SubscribeToStatisticEvent(byte LocalUserNum, UniqueNetId PlayerNetId, name StatName, delegate<OnStatisticChanged> EventDelegate);
function UnsubscribeToStatisticEvent(byte LocalUserNum, UniqueNetId PlayerNetId, name StatName);
function bool SendPlayerSessionStart(byte LocalUserNum, string MultiplayerCorrelationId, int GameplayModeId, int DifficultyLevelId);
function bool SendPlayerSessionEnd(byte LocalUserNum, string MultiplayerCorrelationId, int GameplayModeId, int DifficultyLevelId, int ExitStatusId);
function bool SendPlayerSessionPause(byte LocalUserNum, string MultiplayerCorrelationId);
function bool SendPlayerSessionResume(byte LocalUserNum, string MultiplayerCorrelationId, int GameplayModeId, int DifficultyLevelId);
function bool SendTestEvent(byte LocalUserNum, string TestStatInstancing, int TestStatParameter);
//@HSL_END_XBOX