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.

96 lines
2.8 KiB

  1. //====== Copyright �, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose: Holds the CAccountDetails class.
  4. //
  5. //=============================================================================
  6. #ifndef ACCOUNTDETAILS_H
  7. #define ACCOUNTDETAILS_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "tier1/thash.h"
  12. #include "tier1/utlhashmaplarge.h"
  13. namespace GCSDK
  14. {
  15. class CAccountDetails
  16. {
  17. public:
  18. CAccountDetails();
  19. void Init( KeyValues *pkvDetails );
  20. void Reset();
  21. bool BIsExpired() const;
  22. bool BIsValid() const { return m_bValid; }
  23. void SetCacheTime( int cacheTime );
  24. const char *GetAccountName() const { return m_sAccountName.Get(); }
  25. const char *GetPersonaName() const { return m_sPersonaName.Get(); }
  26. bool BHasPublicProfile() const { return m_bPublicProfile; }
  27. bool BHasPublicInventory() const { return m_bPublicInventory; }
  28. bool BIsVacBanned() const { return m_bVacBanned; }
  29. bool BIsCyberCafe() const { return m_bCyberCafe; }
  30. bool BIsSchoolAccount() const { return m_bSchoolAccount; }
  31. bool BIsFreeTrialAccount() const { return m_bFreeTrialAccount; }
  32. bool BIsFreeTrialAccountOrDemo() const;
  33. bool BIsSubscribed() const { return m_bSubscribed; }
  34. bool BIsLowViolence() const { return m_bLowViolence; }
  35. bool BIsLimitedAccount() const { return m_bLimited; }
  36. bool BIsTrustedAccount() const { return m_bTrusted; }
  37. uint32 GetPackage() const { return m_unPackage; }
  38. RTime32 GetCacheTime() const { return m_rtimeCached; }
  39. #ifdef DBGFLAG_VALIDATE
  40. void Validate( CValidator &validator, const char *pchName );
  41. #endif
  42. private:
  43. RTime32 m_rtimeCached;
  44. CUtlConstString m_sAccountName;
  45. CUtlConstString m_sPersonaName;
  46. uint32 m_unPackage;
  47. bool
  48. m_bValid:1,
  49. m_bPublicProfile:1,
  50. m_bPublicInventory:1,
  51. m_bVacBanned:1,
  52. m_bCyberCafe:1,
  53. m_bSchoolAccount:1,
  54. m_bFreeTrialAccount:1,
  55. m_bSubscribed:1,
  56. m_bLowViolence:1,
  57. m_bLimited:1,
  58. m_bTrusted:1;
  59. };
  60. //-----------------------------------------------------------------------------
  61. // Purpose: Manages requests for CAccountDetails objects
  62. //-----------------------------------------------------------------------------
  63. class CAccountDetailsManager
  64. {
  65. public:
  66. CAccountDetailsManager();
  67. CAccountDetails *YieldingGetAccountDetails( const CSteamID &steamID );
  68. void MarkFrame() { m_hashAccountDetailsCache.StartFrameSchedule( true ); }
  69. bool BExpireAccountDetails( CLimitTimer &limitTimer );
  70. void Dump() const;
  71. private:
  72. friend class CGCJobSendGetAccountDetailsRequest;
  73. bool BFindInLocalCache( const CSteamID &steamID, CAccountDetails **ppAccount );
  74. void WakeWaitingJobs( const CSteamID &steamID );
  75. CTHash<CAccountDetails, uint32> m_hashAccountDetailsCache;
  76. CUtlHashMapLarge<CSteamID, CCopyableUtlVector<JobID_t> > m_mapQueuedRequests;
  77. };
  78. } // namespace GCSDK
  79. #endif // ACCOUNTDETAILS_H