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.

74 lines
2.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #include "cbase.h"
  7. #ifdef CLIENT_DLL
  8. bool CheckWinNoEnemyCaps( IGameEvent *event, int iRole );
  9. bool IsLocalCSPlayerClass( int iClass );
  10. bool GameRulesAllowsAchievements( void );
  11. //----------------------------------------------------------------------------------------------------------------
  12. // Base class for all CS achievements
  13. class CCSBaseAchievement : public CBaseAchievement
  14. {
  15. DECLARE_CLASS( CCSBaseAchievement, CBaseAchievement );
  16. public:
  17. CCSBaseAchievement();
  18. virtual void GetSettings( KeyValues* pNodeOut ); // serialize
  19. virtual void ApplySettings( /* const */ KeyValues* pNodeIn ); // unserialize
  20. // [dwenger] Necessary for sorting achievements by award time
  21. virtual void OnAchieved();
  22. bool GetAwardTime( int& year, int& month, int& day, int& hour, int& minute, int& second );
  23. int64 GetSortKey() const { return GetUnlockTime(); }
  24. };
  25. //----------------------------------------------------------------------------------------------------------------
  26. // Helper class for achievements that check that the player was playing on a game team for the full round
  27. class CCSBaseAchievementFullRound : public CCSBaseAchievement
  28. {
  29. DECLARE_CLASS( CCSBaseAchievementFullRound, CCSBaseAchievement );
  30. public:
  31. virtual void Init() ;
  32. virtual void ListenForEvents();
  33. void FireGameEvent_Internal( IGameEvent *event );
  34. bool PlayerWasInEntireRound( float flRoundTime );
  35. virtual void Event_OnRoundComplete( float flRoundTime, IGameEvent *event ) = 0 ;
  36. };
  37. //----------------------------------------------------------------------------------------------------------------
  38. // Helper class for achievements based on other achievements
  39. class CAchievement_Meta : public CCSBaseAchievement
  40. {
  41. DECLARE_CLASS( CAchievement_Meta, CCSBaseAchievement );
  42. public:
  43. CAchievement_Meta();
  44. virtual void Init();
  45. #if !defined(NO_STEAM)
  46. STEAM_CALLBACK( CAchievement_Meta, Steam_OnUserAchievementStored, UserAchievementStored_t, m_CallbackUserAchievement );
  47. #endif
  48. protected:
  49. void AddRequirement( int nAchievementId );
  50. private:
  51. CUtlVector<int> m_requirements;
  52. };
  53. extern CAchievementMgr g_AchievementMgrCS; // global achievement mgr for CS
  54. #endif // CLIENT_DLL