TrinityCore
Loading...
Searching...
No Matches
AchievementMgr Class Reference

#include <AchievementMgr.h>

Public Member Functions

 AchievementMgr (Player *player)
 
 ~AchievementMgr ()
 
void Reset ()
 
void LoadFromDB (PreparedQueryResult achievementResult, PreparedQueryResult criteriaResult)
 
void SaveToDB (CharacterDatabaseTransaction trans)
 
void ResetAchievementCriteria (AchievementCriteriaCondition condition, uint32 value, bool evenIfCriteriaComplete)
 
void UpdateAchievementCriteria (AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, WorldObject *ref=nullptr)
 
void CompletedAchievement (AchievementEntry const *entry)
 
void CheckAllAchievementCriteria ()
 
void SendAllAchievementData () const
 
void SendRespondInspectAchievements (Player *player) const
 
bool HasAchieved (uint32 achievementId) const
 
PlayerGetPlayer () const
 
void UpdateTimedAchievements (uint32 timeDiff)
 
void StartTimedAchievement (AchievementCriteriaTimedTypes type, uint32 entry, uint32 timeLost=0)
 
void RemoveTimedAchievement (AchievementCriteriaTimedTypes type, uint32 entry)
 
uint32 GetAchievementPoints () const
 

Static Public Member Functions

static void DeleteFromDB (ObjectGuid lowguid)
 

Private Types

typedef std::map< uint32, uint32TimedAchievementMap
 

Private Member Functions

void SendAchievementEarned (AchievementEntry const *achievement) const
 
void SendCriteriaUpdate (AchievementCriteriaEntry const *entry, CriteriaProgress const *progress, uint32 timeElapsed, bool timedCompleted) const
 
CriteriaProgressGetCriteriaProgress (AchievementCriteriaEntry const *entry)
 
void SetCriteriaProgress (AchievementCriteriaEntry const *entry, uint32 changeValue, ProgressType ptype=PROGRESS_SET)
 
void RemoveCriteriaProgress (AchievementCriteriaEntry const *entry)
 
void CompletedCriteriaFor (AchievementEntry const *achievement)
 
bool IsCompletedCriteria (AchievementCriteriaEntry const *achievementCriteria, AchievementEntry const *achievement)
 
bool IsCompletedAchievement (AchievementEntry const *entry)
 
bool CanUpdateCriteria (AchievementCriteriaEntry const *criteria, AchievementEntry const *achievement, uint32 miscValue1, uint32 miscValue2, WorldObject const *ref)
 
void BuildAllDataPacket (Player const *receiver, WorldPacket *data) const
 
bool ConditionsSatisfied (AchievementCriteriaEntry const *criteria) const
 
bool RequirementsSatisfied (AchievementCriteriaEntry const *criteria, AchievementEntry const *achievement, uint32 miscValue1, uint32 miscValue2, WorldObject const *ref) const
 

Private Attributes

Playerm_player
 
CriteriaProgressMap m_criteriaProgress
 
CompletedAchievementMap m_completedAchievements
 
TimedAchievementMap m_timedAchievements
 
uint32 m_achievementPoints
 

Detailed Description

Definition at line 278 of file AchievementMgr.h.

Member Typedef Documentation

◆ TimedAchievementMap

Definition at line 319 of file AchievementMgr.h.

Constructor & Destructor Documentation

◆ AchievementMgr()

AchievementMgr::AchievementMgr ( Player player)

Definition at line 493 of file AchievementMgr.cpp.

◆ ~AchievementMgr()

AchievementMgr::~AchievementMgr ( )

Definition at line 497 of file AchievementMgr.cpp.

Member Function Documentation

◆ BuildAllDataPacket()

void AchievementMgr::BuildAllDataPacket ( Player const *  receiver,
WorldPacket data 
) const
private

used by SMSG_RESPOND_INSPECT_ACHIEVEMENT and SMSG_ALL_ACHIEVEMENT_DATA

Definition at line 1620 of file AchievementMgr.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CanUpdateCriteria()

bool AchievementMgr::CanUpdateCriteria ( AchievementCriteriaEntry const *  criteria,
AchievementEntry const *  achievement,
uint32  miscValue1,
uint32  miscValue2,
WorldObject const *  ref 
)
private

Definition at line 1661 of file AchievementMgr.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckAllAchievementCriteria()

void AchievementMgr::CheckAllAchievementCriteria ( )

called at player login. The player might have fulfilled some achievements when the achievement system wasn't working yet

Definition at line 768 of file AchievementMgr.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CompletedAchievement()

void AchievementMgr::CompletedAchievement ( AchievementEntry const *  entry)

Currently there's only one achievement that deals with gender-specific titles. Since no common attributes were found, (not even in titleRewardFlags field) we explicitly check by ID. Maybe in the future we could move the achievement_reward condition fields to the condition system.

Definition at line 1520 of file AchievementMgr.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CompletedCriteriaFor()

void AchievementMgr::CompletedCriteriaFor ( AchievementEntry const *  achievement)
private

Definition at line 1290 of file AchievementMgr.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ConditionsSatisfied()

bool AchievementMgr::ConditionsSatisfied ( AchievementCriteriaEntry const *  criteria) const
private

Definition at line 1711 of file AchievementMgr.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DeleteFromDB()

void AchievementMgr::DeleteFromDB ( ObjectGuid  lowguid)
static

Definition at line 550 of file AchievementMgr.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAchievementPoints()

uint32 AchievementMgr::GetAchievementPoints ( ) const
inline

Definition at line 300 of file AchievementMgr.h.

◆ GetCriteriaProgress()

CriteriaProgress * AchievementMgr::GetCriteriaProgress ( AchievementCriteriaEntry const *  entry)
private

Definition at line 1362 of file AchievementMgr.cpp.

+ Here is the caller graph for this function:

◆ GetPlayer()

Player * AchievementMgr::GetPlayer ( ) const
inline

Definition at line 295 of file AchievementMgr.h.

+ Here is the caller graph for this function:

◆ HasAchieved()

bool AchievementMgr::HasAchieved ( uint32  achievementId) const

Definition at line 1656 of file AchievementMgr.cpp.

+ Here is the caller graph for this function:

◆ IsCompletedAchievement()

bool AchievementMgr::IsCompletedAchievement ( AchievementEntry const *  entry)
private

Definition at line 1304 of file AchievementMgr.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsCompletedCriteria()

bool AchievementMgr::IsCompletedCriteria ( AchievementCriteriaEntry const *  achievementCriteria,
AchievementEntry const *  achievement 
)
private

Definition at line 1166 of file AchievementMgr.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LoadFromDB()

void AchievementMgr::LoadFromDB ( PreparedQueryResult  achievementResult,
PreparedQueryResult  criteriaResult 
)

Definition at line 616 of file AchievementMgr.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RemoveCriteriaProgress()

void AchievementMgr::RemoveCriteriaProgress ( AchievementCriteriaEntry const *  entry)
private

Definition at line 1440 of file AchievementMgr.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RemoveTimedAchievement()

void AchievementMgr::RemoveTimedAchievement ( AchievementCriteriaTimedTypes  type,
uint32  entry 
)

Definition at line 1500 of file AchievementMgr.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RequirementsSatisfied()

bool AchievementMgr::RequirementsSatisfied ( AchievementCriteriaEntry const *  criteria,
AchievementEntry const *  achievement,
uint32  miscValue1,
uint32  miscValue2,
WorldObject const *  ref 
) const
private

Definition at line 1736 of file AchievementMgr.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Reset()

void AchievementMgr::Reset ( )

Definition at line 499 of file AchievementMgr.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ResetAchievementCriteria()

void AchievementMgr::ResetAchievementCriteria ( AchievementCriteriaCondition  condition,
uint32  value,
bool  evenIfCriteriaComplete 
)

Definition at line 524 of file AchievementMgr.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SaveToDB()

void AchievementMgr::SaveToDB ( CharacterDatabaseTransaction  trans)

Definition at line 565 of file AchievementMgr.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendAchievementEarned()

void AchievementMgr::SendAchievementEarned ( AchievementEntry const *  achievement) const
private

Definition at line 680 of file AchievementMgr.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendAllAchievementData()

void AchievementMgr::SendAllAchievementData ( ) const

Definition at line 1602 of file AchievementMgr.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendCriteriaUpdate()

void AchievementMgr::SendCriteriaUpdate ( AchievementCriteriaEntry const *  entry,
CriteriaProgress const *  progress,
uint32  timeElapsed,
bool  timedCompleted 
) const
private

Definition at line 742 of file AchievementMgr.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendRespondInspectAchievements()

void AchievementMgr::SendRespondInspectAchievements ( Player player) const

Definition at line 1609 of file AchievementMgr.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetCriteriaProgress()

void AchievementMgr::SetCriteriaProgress ( AchievementCriteriaEntry const *  entry,
uint32  changeValue,
ProgressType  ptype = PROGRESS_SET 
)
private

Definition at line 1372 of file AchievementMgr.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ StartTimedAchievement()

void AchievementMgr::StartTimedAchievement ( AchievementCriteriaTimedTypes  type,
uint32  entry,
uint32  timeLost = 0 
)

Definition at line 1478 of file AchievementMgr.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateAchievementCriteria()

void AchievementMgr::UpdateAchievementCriteria ( AchievementCriteriaTypes  type,
uint32  miscValue1 = 0,
uint32  miscValue2 = 0,
WorldObject ref = nullptr 
)

this function will be called whenever the user might have done a criteria relevant action

Definition at line 780 of file AchievementMgr.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateTimedAchievements()

void AchievementMgr::UpdateTimedAchievements ( uint32  timeDiff)

Definition at line 1456 of file AchievementMgr.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_achievementPoints

uint32 AchievementMgr::m_achievementPoints
private

Definition at line 321 of file AchievementMgr.h.

◆ m_completedAchievements

CompletedAchievementMap AchievementMgr::m_completedAchievements
private

Definition at line 318 of file AchievementMgr.h.

◆ m_criteriaProgress

CriteriaProgressMap AchievementMgr::m_criteriaProgress
private

Definition at line 317 of file AchievementMgr.h.

◆ m_player

Player* AchievementMgr::m_player
private

Definition at line 316 of file AchievementMgr.h.

◆ m_timedAchievements

TimedAchievementMap AchievementMgr::m_timedAchievements
private

Definition at line 320 of file AchievementMgr.h.


The documentation for this class was generated from the following files: