Counter Strike : Global Offensive Source Code
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.

130 lines
4.5 KiB

  1. //===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. //===========================================================================//
  6. #ifndef IACHIEVEMENTMGR_H
  7. #define IACHIEVEMENTMGR_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "utlmap.h"
  12. #ifndef DEDICATED
  13. #include "vgui_controls/Panel.h"
  14. #endif
  15. class CBaseAchievement;
  16. //=============================================================================
  17. // HPE_BEGIN
  18. // [sbodenbender] UI info to be serialized to profile
  19. //=============================================================================
  20. // [sbodenbender] This is not a good place for this; we can move this later
  21. // for a better connection between gameui and client when we have time; for now, this works
  22. // This class holds the UI screen information to be serialized to the profile
  23. struct UIProfileInfo
  24. {
  25. // keeping these public so the UI elements can have easy access
  26. // medals
  27. int m_GameType;
  28. int m_GameMode;
  29. int m_Map;
  30. bool m_IsPublic; // false means a private game; true is public game
  31. int m_BotDifficulty;
  32. // leaderboards
  33. int m_LeaderboardType;
  34. int m_LeaderboardMode;
  35. int m_LeaderboardFilter;
  36. };
  37. //=============================================================================
  38. // HPE_END
  39. //=============================================================================
  40. abstract_class IAchievement
  41. {
  42. public:
  43. virtual int GetAchievementID() = 0;
  44. virtual const char *GetName() = 0;
  45. virtual int GetFlags() = 0;
  46. virtual int GetGoal() = 0;
  47. virtual int GetCount() = 0;
  48. virtual bool IsAchieved() = 0;
  49. virtual bool IsAvailable() = 0;
  50. virtual int GetPointValue() = 0;
  51. virtual bool ShouldSaveWithGame() = 0;
  52. virtual bool ShouldHideUntilAchieved() = 0;
  53. virtual bool ShouldShowOnHUD() = 0;
  54. virtual void SetShowOnHUD( bool bShow ) = 0;
  55. virtual const char *GetIconPath() = 0;
  56. virtual int GetDisplayOrder() = 0;
  57. virtual int GetNumComponents() = 0;
  58. virtual const char *GetComponentDisplayString( int iComponent ) = 0;
  59. virtual uint64 GetComponentBits() = 0;
  60. };
  61. abstract_class IAchievementMgr
  62. {
  63. public:
  64. virtual IAchievement* GetAchievementByIndex( int index, int nPlayerSlot ) = 0;
  65. virtual IAchievement* GetAchievementByDisplayOrder( int orderIndex, int nPlayerSlot ) = 0;
  66. virtual IAchievement* GetAwardByDisplayOrder( int orderIndex, int nPlayerSlot ) = 0;
  67. virtual CBaseAchievement* GetAchievementByID ( int id, int nPlayerSlot ) = 0;
  68. virtual int GetAchievementCount( bool bAssets = false ) = 0;
  69. virtual void InitializeAchievements( ) = 0;
  70. virtual void AwardAchievement( int nAchievementID, int nPlayerSlot ) = 0;
  71. virtual void OnMapEvent( const char *pchEventName, int nPlayerSlot ) = 0;
  72. virtual void SaveGlobalStateIfDirty( ) = 0;
  73. virtual bool HasAchieved( const char *pchName, int nPlayerSlot ) = 0;
  74. virtual const CUtlVector<int>& GetAchievedDuringCurrentGame( int nPlayerSlot ) = 0;
  75. virtual bool WereCheatsEverOn() = 0;
  76. virtual UIProfileInfo* GetUIProfileInfo() = 0;
  77. virtual void ResetProfileInfo() = 0;
  78. virtual void SendWriteProfileEvent() = 0;
  79. virtual void SendResetProfileEvent() = 0;
  80. virtual bool GetWriteProfileResult() = 0;
  81. };
  82. // flags for IAchievement::GetFlags
  83. #define ACH_LISTEN_KILL_EVENTS 0x0001
  84. #define ACH_LISTEN_MAP_EVENTS 0x0002
  85. #define ACH_LISTEN_COMPONENT_EVENTS 0x0004
  86. #define ACH_HAS_COMPONENTS 0x0020
  87. #define ACH_SAVE_WITH_GAME 0x0040
  88. #define ACH_SAVE_GLOBAL 0x0080
  89. #define ACH_FILTER_ATTACKER_IS_PLAYER 0x0100
  90. #define ACH_FILTER_VICTIM_IS_PLAYER_ENEMY 0x0200
  91. #define ACH_FILTER_FULL_ROUND_ONLY 0x0400
  92. #define ACH_FILTER_LOCAL_PLAYER_EVENTS 0x0800 // Evaluate player-specific events only
  93. #define ACH_LISTEN_PLAYER_KILL_ENEMY_EVENTS ACH_LISTEN_KILL_EVENTS | ACH_FILTER_ATTACKER_IS_PLAYER | ACH_FILTER_VICTIM_IS_PLAYER_ENEMY
  94. #define ACH_LISTEN_KILL_ENEMY_EVENTS ACH_LISTEN_KILL_EVENTS | ACH_FILTER_VICTIM_IS_PLAYER_ENEMY
  95. // Update this for changes in either abstract class in this file
  96. #define ACHIEVEMENTMGR_INTERFACE_VERSION "ACHIEVEMENTMGR_INTERFACE_VERSION001"
  97. #define ACHIEVEMENT_LOCALIZED_NAME_FROM_STR( name ) \
  98. ( g_pVGuiLocalize->FindSafe( CFmtStr( "#%s_NAME", name ) ) )
  99. #define ACHIEVEMENT_LOCALIZED_NAME( pAchievement ) \
  100. ( ACHIEVEMENT_LOCALIZED_NAME_FROM_STR( pAchievement->GetName() ) )
  101. #define ACHIEVEMENT_LOCALIZED_DESC_FROM_STR( name ) \
  102. ( g_pVGuiLocalize->FindSafe( CFmtStr( "#%s_DESC", name ) ) )
  103. #define ACHIEVEMENT_LOCALIZED_DESC( pAchievement ) \
  104. ( ACHIEVEMENT_LOCALIZED_DESC_FROM_STR( pAchievement->GetName() ) )
  105. #endif // IACHIEVEMENTMGR_H
  106. // Special slot designations
  107. #define SINGLE_PLAYER_SLOT 0
  108. #define STEAM_PLAYER_SLOT 0