Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
4.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================
  7. #ifndef TF_MAPINFO_H
  8. #define TF_MAPINFO_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. // Formally Mapinfo
  13. enum ETFLeaderboardType
  14. {
  15. kMapLeaderboard,
  16. kDuckLeaderboard,
  17. kDuckStat,
  18. kLadderLeaderboard,
  19. };
  20. class CLeaderboardInfo
  21. {
  22. public:
  23. CCallResult< CLeaderboardInfo, LeaderboardFindResult_t > findLeaderboardCallback;
  24. CCallResult< CLeaderboardInfo, LeaderboardScoresDownloaded_t > downloadLeaderboardCallbackGlobal;
  25. CCallResult< CLeaderboardInfo, LeaderboardScoresDownloaded_t > downloadLeaderboardCallbackGlobalAroundUser;
  26. CCallResult< CLeaderboardInfo, LeaderboardScoresDownloaded_t > downloadLeaderboardCallbackFriends;
  27. LeaderboardFindResult_t findLeaderboardResults;
  28. CUtlVector< LeaderboardEntry_t* > downloadedLeaderboardScoresGlobal;
  29. CUtlVector< LeaderboardEntry_t* > downloadedLeaderboardScoresGlobalAroundUser;
  30. CUtlVector< LeaderboardEntry_t* > downloadedLeaderboardScoresFriends;
  31. int iNumLeaderboardEntries;
  32. ETFLeaderboardType m_kLeaderboardType;
  33. CLeaderboardInfo( const char *pLeaderboardName );
  34. ~CLeaderboardInfo();
  35. const char *GetLeaderboardName() { return m_pLeaderboardName; }
  36. void RetrieveLeaderboardData();
  37. bool DownloadLeaderboardData();
  38. void OnFindLeaderboard( LeaderboardFindResult_t *pResult, bool bIOFailure );
  39. void OnLeaderboardScoresDownloadedGlobal( LeaderboardScoresDownloaded_t *pResult, bool bIOFailure );
  40. void OnLeaderboardScoresDownloadedGlobalAroundUser( LeaderboardScoresDownloaded_t *pResult, bool bIOFailure );
  41. void OnLeaderboardScoresDownloadedFriends( LeaderboardScoresDownloaded_t *pResult, bool bIOFailure );
  42. void SetMyScore ( int score );
  43. int GetMyScore() { return m_iMyScore; }
  44. bool HasPendingUpdate() { return m_bHasPendingUpdate; }
  45. void SetHasPendingUpdate( bool bStatus ) { m_bHasPendingUpdate = bStatus; }
  46. bool IsLeaderboardFound() { return m_bLeaderboardFound; }
  47. private:
  48. const char *m_pLeaderboardName;
  49. int m_iMyScore;
  50. bool m_bHasPendingUpdate;
  51. bool m_bLeaderboardFound;
  52. };
  53. /**
  54. * Refresh the leaderboard for the given map
  55. * @param pMapName
  56. */
  57. void MapInfo_RefreshLeaderboard( const char *pMapName );
  58. /**
  59. * Retrieve the leaderboard for the given map
  60. * @param pMapName
  61. * @param scores
  62. * @return true if the leaderboard info was retrieved, false otherwise
  63. */
  64. bool MapInfo_GetLeaderboardInfo( const char *pMapName, CUtlVector< LeaderboardEntry_t* > &scores, int &iNumLeaderboardEntries, uint32 unMinScores );
  65. /**
  66. * @param unAccountID
  67. * @param pLevelName
  68. * @return how many times the player has donated
  69. */
  70. int MapInfo_GetDonationAmount( uint32 unAccountID, const char *pLevelName );
  71. /**
  72. * @param unAccountID
  73. * @param pLevelName
  74. * return true if the player donated to the current map, false otherwise
  75. */
  76. bool MapInfo_DidPlayerDonate( uint32 unAccountID, const char *pLevelName );
  77. /**
  78. * Retrieve the duel wins leaderboard
  79. * @param scores
  80. * @param bGlobal
  81. * return true if the duel wins leaderboard were retrieved, false otherwise
  82. */
  83. bool Leaderboards_GetDuelWins( CUtlVector< LeaderboardEntry_t* > &scores, bool bGlobal );
  84. // Get a list of AccountID's for all people on the Duck Leaderboards
  85. void Leaderboards_GetDuckLeaderboardSteamIDs( CUtlVector< AccountID_t > &vecIds );
  86. /**
  87. * Retrieve the duel wins leaderboard
  88. * @param scores
  89. * @param bGlobal
  90. * return true if the duel wins leaderboard were retrieved, false otherwise
  91. */
  92. bool Leaderboards_GetDuckLeaderboard( CUtlVector< LeaderboardEntry_t* > &scores, const char* kName );
  93. // Get total number of entries for a leaderboard type
  94. int Leaderboards_GetDuckLeaderboardTotalEntryCount( const char* kName );
  95. /**
  96. * Refreshes leaderboards not associated with maps
  97. */
  98. void Leaderboards_Refresh();
  99. /**
  100. * Retrieve the competitive ladder ratings leaderboard
  101. * @param scores
  102. * @param nType
  103. * return true if the leaderboard were retrieved, false otherwise
  104. */
  105. bool Leaderboards_GetLadderLeaderboard( CUtlVector< LeaderboardEntry_t* > &scores, const char *pszName, bool bGlobal );
  106. void Leaderboards_LadderRefresh( void );
  107. #endif // TF_MAPINFO_H