TrinityCore
PlayerAchievementMgr Class Reference

#include <AchievementMgr.h>

+ Inheritance diagram for PlayerAchievementMgr:

Public Member Functions

 PlayerAchievementMgr (Player *owner)
 
void Reset () override
 
void LoadFromDB (PreparedQueryResult achievementResult, PreparedQueryResult criteriaResult)
 
void SaveToDB (CharacterDatabaseTransaction trans)
 
void SendAllData (Player const *receiver) const override
 
void SendAchievementInfo (Player *receiver, uint32 achievementId=0) const
 
void CompletedAchievement (AchievementEntry const *entry, Player *referencePlayer) override
 
bool ModifierTreeSatisfied (uint32 modifierTreeId) const
 
bool ModifierTreeSatisfied (ModifierTreeNode const *parent, uint64 miscValue1, uint64 miscValue2, WorldObject const *ref, Player *referencePlayer) const
 
- Public Member Functions inherited from AchievementMgr
 AchievementMgr ()
 
 ~AchievementMgr ()
 
void CheckAllAchievementCriteria (Player *referencePlayer)
 
virtual void CompletedAchievement (AchievementEntry const *entry, Player *referencePlayer)=0
 
bool HasAchieved (uint32 achievementId) const
 
uint32 GetAchievementPoints () const
 
std::vector< uint32GetCompletedAchievementIds () const
 
- Public Member Functions inherited from CriteriaHandler
 CriteriaHandler ()
 
virtual ~CriteriaHandler ()
 
 CriteriaHandler (CriteriaHandler const &right)=delete
 
 CriteriaHandler (CriteriaHandler &&right)=delete
 
CriteriaHandleroperator= (CriteriaHandler const &right)=delete
 
CriteriaHandleroperator= (CriteriaHandler &&right)=delete
 
virtual void Reset ()
 
void UpdateCriteria (CriteriaType type, uint64 miscValue1=0, uint64 miscValue2=0, uint64 miscValue3=0, WorldObject const *ref=nullptr, Player *referencePlayer=nullptr)
 
virtual void SendAllData (Player const *receiver) const =0
 
void UpdateTimedCriteria (Milliseconds timeDiff)
 
void StartCriteria (CriteriaStartEvent startEvent, uint32 entry, Milliseconds timeLost=Milliseconds::zero())
 
virtual void FailCriteria (CriteriaFailEvent failEvent, uint32 asset)
 

Static Public Member Functions

static void DeleteFromDB (ObjectGuid const &guid)
 

Protected Member Functions

void SendCriteriaUpdate (Criteria const *entry, CriteriaProgress const *progress, Seconds timeElapsed, bool timedCompleted) const override
 
void SendCriteriaProgressRemoved (uint32 criteriaId) override
 
void SendAchievementEarned (AchievementEntry const *achievement) const
 
void SendPacket (WorldPacket const *data) const override
 
std::string GetOwnerInfo () const override
 
CriteriaList const & GetCriteriaByType (CriteriaType type, uint32 asset) const override
 
- Protected Member Functions inherited from AchievementMgr
bool CanUpdateCriteriaTree (Criteria const *criteria, CriteriaTree const *tree, Player *referencePlayer) const override
 
bool CanCompleteCriteriaTree (CriteriaTree const *tree) override
 
void CompletedCriteriaTree (CriteriaTree const *tree, Player *referencePlayer) override
 
void AfterCriteriaTreeUpdate (CriteriaTree const *tree, Player *referencePlayer) override
 
bool IsCompletedAchievement (AchievementEntry const *entry)
 
bool RequiredAchievementSatisfied (uint32 achievementId) const override
 
- Protected Member Functions inherited from CriteriaHandler
virtual void SendCriteriaUpdate (Criteria const *criteria, CriteriaProgress const *progress, Seconds timeElapsed, bool timedCompleted) const =0
 
CriteriaProgressGetCriteriaProgress (Criteria const *entry)
 
void SetCriteriaProgress (Criteria const *criteria, uint64 changeValue, Player *referencePlayer, ProgressType progressType=PROGRESS_SET)
 
void RemoveCriteriaProgress (Criteria const *criteria)
 
virtual void SendCriteriaProgressRemoved (uint32 criteriaId)=0
 
bool IsCompletedCriteriaTree (CriteriaTree const *tree)
 
virtual bool CanUpdateCriteriaTree (Criteria const *criteria, CriteriaTree const *tree, Player *referencePlayer) const
 
virtual bool CanCompleteCriteriaTree (CriteriaTree const *tree)
 
virtual void CompletedCriteriaTree (CriteriaTree const *tree, Player *referencePlayer)=0
 
virtual void AfterCriteriaTreeUpdate (CriteriaTree const *, Player *)
 
bool IsCompletedCriteria (Criteria const *criteria, uint64 requiredAmount)
 
bool CanUpdateCriteria (Criteria const *criteria, CriteriaTreeList const *trees, uint64 miscValue1, uint64 miscValue2, uint64 miscValue3, WorldObject const *ref, Player *referencePlayer)
 
virtual void SendPacket (WorldPacket const *data) const =0
 
bool ConditionsSatisfied (Criteria const *criteria, Player *referencePlayer) const
 
bool RequirementsSatisfied (Criteria const *criteria, uint64 miscValue1, uint64 miscValue2, uint64 miscValue3, WorldObject const *ref, Player *referencePlayer) const
 
virtual bool RequiredAchievementSatisfied (uint32) const
 
bool ModifierTreeSatisfied (ModifierTreeNode const *parent, uint64 miscValue1, uint64 miscValue2, WorldObject const *ref, Player *referencePlayer) const
 
bool ModifierSatisfied (ModifierTreeEntry const *modifier, uint64 miscValue1, uint64 miscValue2, WorldObject const *ref, Player *referencePlayer) const
 
virtual std::string GetOwnerInfo () const =0
 
virtual CriteriaList const & GetCriteriaByType (CriteriaType type, uint32 asset) const =0
 

Private Attributes

Player_owner
 

Additional Inherited Members

- Protected Attributes inherited from AchievementMgr
std::unordered_map< uint32, CompletedAchievementData_completedAchievements
 
uint32 _achievementPoints
 
- Protected Attributes inherited from CriteriaHandler
CriteriaProgressMap _criteriaProgress
 
std::unordered_map< uint32, Milliseconds_startedCriteria
 

Detailed Description

Definition at line 77 of file AchievementMgr.h.

Constructor & Destructor Documentation

◆ PlayerAchievementMgr()

PlayerAchievementMgr::PlayerAchievementMgr ( Player owner)
explicit

Definition at line 212 of file AchievementMgr.cpp.

Member Function Documentation

◆ CompletedAchievement()

void PlayerAchievementMgr::CompletedAchievement ( AchievementEntry const *  entry,
Player referencePlayer 
)
overridevirtual

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.

Implements AchievementMgr.

Definition at line 466 of file AchievementMgr.cpp.

+ Here is the call graph for this function:

◆ DeleteFromDB()

void PlayerAchievementMgr::DeleteFromDB ( ObjectGuid const &  guid)
static

Definition at line 235 of file AchievementMgr.cpp.

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

◆ GetCriteriaByType()

CriteriaList const & PlayerAchievementMgr::GetCriteriaByType ( CriteriaType  type,
uint32  asset 
) const
overrideprotectedvirtual

Implements CriteriaHandler.

Definition at line 678 of file AchievementMgr.cpp.

◆ GetOwnerInfo()

std::string PlayerAchievementMgr::GetOwnerInfo ( ) const
overrideprotectedvirtual

Implements CriteriaHandler.

Definition at line 1037 of file AchievementMgr.cpp.

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

◆ LoadFromDB()

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

Definition at line 250 of file AchievementMgr.cpp.

+ Here is the call graph for this function:

◆ ModifierTreeSatisfied() [1/2]

bool CriteriaHandler::ModifierTreeSatisfied ( ModifierTreeNode const *  parent,
uint64  miscValue1,
uint64  miscValue2,
WorldObject const *  ref,
Player referencePlayer 
) const

Definition at line 306 of file CriteriaHandler.cpp.

+ Here is the call graph for this function:

◆ ModifierTreeSatisfied() [2/2]

bool PlayerAchievementMgr::ModifierTreeSatisfied ( uint32  modifierTreeId) const

Definition at line 560 of file AchievementMgr.cpp.

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

◆ Reset()

void PlayerAchievementMgr::Reset ( )
overridevirtual

Reimplemented from CriteriaHandler.

Definition at line 216 of file AchievementMgr.cpp.

+ Here is the call graph for this function:

◆ SaveToDB()

void PlayerAchievementMgr::SaveToDB ( CharacterDatabaseTransaction  trans)

Definition at line 314 of file AchievementMgr.cpp.

+ Here is the call graph for this function:

◆ SendAchievementEarned()

void PlayerAchievementMgr::SendAchievementEarned ( AchievementEntry const *  achievement) const
protected

Definition at line 615 of file AchievementMgr.cpp.

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

◆ SendAchievementInfo()

void PlayerAchievementMgr::SendAchievementInfo ( Player receiver,
uint32  achievementId = 0 
) const

Definition at line 425 of file AchievementMgr.cpp.

+ Here is the call graph for this function:

◆ SendAllData()

void PlayerAchievementMgr::SendAllData ( Player const *  receiver) const
overridevirtual

Implements CriteriaHandler.

Definition at line 365 of file AchievementMgr.cpp.

+ Here is the call graph for this function:

◆ SendCriteriaProgressRemoved()

void PlayerAchievementMgr::SendCriteriaProgressRemoved ( uint32  criteriaId)
overrideprotectedvirtual

Implements CriteriaHandler.

Definition at line 608 of file AchievementMgr.cpp.

+ Here is the call graph for this function:

◆ SendCriteriaUpdate()

void PlayerAchievementMgr::SendCriteriaUpdate ( Criteria const *  entry,
CriteriaProgress const *  progress,
Seconds  timeElapsed,
bool  timedCompleted 
) const
overrideprotectedvirtual

Implements CriteriaHandler.

Definition at line 568 of file AchievementMgr.cpp.

+ Here is the call graph for this function:

◆ SendPacket()

void PlayerAchievementMgr::SendPacket ( WorldPacket const *  data) const
overrideprotectedvirtual

Implements CriteriaHandler.

Definition at line 673 of file AchievementMgr.cpp.

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

Member Data Documentation

◆ _owner

Player* PlayerAchievementMgr::_owner
private

Definition at line 108 of file AchievementMgr.h.


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