19 #ifndef __TRINITY_ACHIEVEMENTMGR_H
20 #define __TRINITY_ACHIEVEMENTMGR_H
68 std::vector<AchievementCriteriaTree const*>
Children;
228 raw.value1 = _value1;
229 raw.value2 = _value2;
230 ScriptId = _scriptId;
240 typedef std::vector<AchievementCriteriaData>
Storage;
242 bool Meets(
Player const* source,
Unit const* target,
uint32 miscValue = 0)
const;
328 void CheckAllAchievementCriteria(
Player* referencePlayer);
329 void SendAllAchievementData(
Player* receiver)
const;
330 void SendAllTrackedCriterias(
Player* receiver, std::set<uint32>
const& trackedCriterias)
const;
331 void SendAchievementInfo(
Player* receiver,
uint32 achievementId = 0)
const;
332 bool HasAchieved(
uint32 achievementId)
const;
335 void UpdateTimedAchievements(
uint32 timeDiff);
372 static char const* GetCriteriaTypeString(
uint32 type);
378 auto itr = _achievementCriteriaTreeByCriteria.find(criteriaId);
379 return itr != _achievementCriteriaTreeByCriteria.end() ? &itr->second :
nullptr;
384 return guild ? _guildAchievementCriteriasByType[type] : _achievementCriteriasByType[type];
389 return _achievementCriteriasByTimedType[type];
394 AchievementListByReferencedId::const_iterator itr = _achievementListByReferencedId.find(
id);
395 return itr != _achievementListByReferencedId.end() ? &itr->second :
NULL;
400 AchievementRewards::const_iterator iter = _achievementRewards.find(achievement->
ID);
401 return iter != _achievementRewards.end() ? &iter->second :
NULL;
406 AchievementRewardLocales::const_iterator iter = _achievementRewardLocales.find(achievement->
ID);
407 return iter != _achievementRewardLocales.end() ? &iter->second :
NULL;
412 AchievementCriteriaDataMap::const_iterator iter = _criteriaDataMap.find(achievementCriteria->
ID);
413 return iter != _criteriaDataMap.end() ? &iter->second :
NULL;
418 AllCompletedAchievements::const_iterator itr = _allCompletedAchievements.find(achievement->
ID);
419 if (itr == _allCompletedAchievements.end())
423 return itr->second != instanceId;
430 if (IsRealmCompleted(achievement, instanceId))
433 _allCompletedAchievements[achievement->
ID] = instanceId;
454 template<
typename Func>
458 WalkCriteriaTree(node, func);
464 void OnInstanceDestroyed(
uint32 instanceId);
466 void LoadAchievementCriteriaModifiersTree();
467 void LoadAchievementCriteriaList();
468 void LoadAchievementCriteriaData();
469 void LoadAchievementReferenceList();
470 void LoadCompletedAchievements();
472 void LoadRewardLocales();
501 #define sAchievementMgr AchievementGlobalMgr::instance()
TimedAchievementMap m_timedAchievements
Definition: AchievementMgr.h:361
AchievementEntryList const * GetAchievementByReferencedId(uint32 id) const
Definition: AchievementMgr.h:392
Definition: AchievementMgr.h:91
Definition: AchievementMgr.h:100
Definition: AchievementMgr.h:99
Definition: AchievementMgr.h:109
uint32 mapId
Definition: AchievementMgr.h:198
uint32 sender
Definition: AchievementMgr.h:255
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: QueryResult.h:107
Definition: AchievementMgr.h:36
AllCompletedAchievements _allCompletedAchievements
Definition: AchievementMgr.h:495
Definition: DBCEnums.h:229
ModifierTreeEntry const * Entry
Definition: AchievementMgr.h:38
bool changed
Definition: AchievementMgr.h:83
std::vector< std::string > subject
Definition: AchievementMgr.h:265
std::vector< ModifierTreeNode const * > Children
Definition: AchievementMgr.h:39
#define ACHIEVEMENT_CRITERIA_TYPE_TOTAL
Definition: DBCEnums.h:360
CompletedAchievementMap m_completedAchievements
Definition: AchievementMgr.h:359
AchievementCriteriaData(uint32 _dataType, uint32 _value1, uint32 _value2, uint32 _scriptId)
Definition: AchievementMgr.h:226
bool changed
Definition: AchievementMgr.h:275
std::unordered_map< uint32, AchievementRewardLocale > AchievementRewardLocales
Definition: AchievementMgr.h:269
Definition: AchievementMgr.h:103
uint32 ID
Definition: AchievementMgr.h:53
Definition: AchievementMgr.h:365
struct AchievementCriteriaData::@58::@62 health
T * _owner
Definition: AchievementMgr.h:357
struct AchievementCriteriaData::@58::@61 classRace
uint32 ScriptId
Definition: AchievementMgr.h:217
uint32 mailTemplate
Definition: AchievementMgr.h:258
uint32 value1
Definition: AchievementMgr.h:213
AchievementCriteriaMap _achievementCriteria
Definition: AchievementMgr.h:480
Definition: AchievementMgr.h:97
void LoadFromDB()
Definition: AddonMgr.cpp:40
uint32 percent
Definition: AchievementMgr.h:136
uint32 Flags
Definition: DB2Structure.h:38
uint32 value2
Definition: AchievementMgr.h:214
AchievementCriteria const * Criteria
Definition: AchievementMgr.h:67
Definition: AchievementMgr.h:62
AchievementRewardLocale const * GetAchievementRewardLocale(AchievementEntry const *achievement) const
Definition: AchievementMgr.h:404
Definition: AchievementMgr.h:88
uint32 FlagsCu
Definition: AchievementMgr.h:56
std::string subject
Definition: AchievementMgr.h:256
AchievementCriteriaDataType dataType
Definition: AchievementMgr.h:117
Definition: DBCEnums.h:199
uint32 state
Definition: AchievementMgr.h:175
AchievementCriteriaTreeList const * GetAchievementCriteriaTreesByCriteria(uint32 criteriaId) const
Definition: AchievementMgr.h:376
Definition: AchievementMgr.h:95
uint32 value
Definition: AchievementMgr.h:148
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: AchievementMgr.h:297
std::unordered_map< uint32, AchievementCriteriaTreeList > AchievementCriteriaTreeByCriteriaMap
Definition: AchievementMgr.h:74
uint32 titleId[2]
Definition: AchievementMgr.h:253
Definition: DBCEnums.h:198
struct AchievementCriteriaData::@58::@60 creature
struct AchievementCriteriaData::@58::@75 game_event
uint32 item_quality
Definition: AchievementMgr.h:193
struct AchievementCriteriaData::@58::@65 level
void Add(AchievementCriteriaData const &data)
Definition: AchievementMgr.h:241
bool IsValid(AchievementCriteria const *criteria)
Definition: AchievementMgr.cpp:48
uint32 minlevel
Definition: AchievementMgr.h:154
Definition: AchievementMgr.h:96
Definition: AchievementMgr.h:107
Definition: DB2Structure.h:903
GuidSet guids
Definition: AchievementMgr.h:274
std::unordered_map< uint32, CompletedAchievementData > CompletedAchievementMap
Definition: AchievementMgr.h:279
uint32 _achievementPoints
Definition: AchievementMgr.h:362
std::vector< AchievementCriteriaData > Storage
Definition: AchievementMgr.h:240
uint32 title_id
Definition: AchievementMgr.h:203
Definition: DBCEnums.h:259
std::unordered_map< uint32, AchievementEntryList > AchievementListByReferencedId
Definition: AchievementMgr.h:76
Definition: AchievementMgr.h:237
AchievementCriteriaDataMap _criteriaDataMap
Definition: AchievementMgr.h:477
bool IsRealmCompleted(AchievementEntry const *achievement, uint32 instanceId) const
Definition: AchievementMgr.h:416
AchievementCriteriaTreeMap _achievementCriteriaTrees
Definition: AchievementMgr.h:479
uint32 effect_idx
Definition: AchievementMgr.h:143
AchievementListByReferencedId _achievementListByReferencedId
Definition: AchievementMgr.h:492
uint32 ID
Definition: AchievementMgr.h:64
std::vector< AchievementCriteriaTree const * > Children
Definition: AchievementMgr.h:68
AchievementRewardLocales _achievementRewardLocales
Definition: AchievementMgr.h:498
Definition: AchievementMgr.h:92
Definition: AchievementMgr.h:106
CriteriaProgressMap m_criteriaProgress
Definition: AchievementMgr.h:358
std::unordered_map< uint32, ModifierTreeNode * > ModifierTreeMap
Definition: AchievementMgr.h:42
static void DeleteFromDB(ObjectGuid lowguid)
Definition: AchievementMgr.h:308
Definition: AchievementMgr.h:283
Definition: AchievementMgr.h:47
AchievementCriteriaDataType
Definition: AchievementMgr.h:86
uint32 item_level
Definition: AchievementMgr.h:192
Definition: AchievementMgr.h:263
Entry
Definition: boss_headless_horseman.cpp:50
uint32 max_score
Definition: AchievementMgr.h:186
struct AchievementCriteriaData::@58::@73 map_id
time_t date
Definition: AchievementMgr.h:273
std::vector< AchievementCriteriaTree const * > AchievementCriteriaTreeList
Definition: AchievementMgr.h:72
Definition: DB2Structure.h:27
uint32 ID
Definition: DB2Structure.h:29
static void DeleteFromDB(ObjectGuid lowguid)
Definition: AchievementMgr.h:302
uint32 race_id
Definition: AchievementMgr.h:131
AchievementCriteriaDataSet()
Definition: AchievementMgr.h:239
struct AchievementCriteriaData::@58::@70 holiday
AchievementCriteriaTimedTypes
Definition: DBCEnums.h:181
std::unordered_map< uint32, AchievementCriteria * > AchievementCriteriaMap
Definition: AchievementMgr.h:60
AchievementCriteriaTypes
Definition: DBCEnums.h:196
Storage storage
Definition: AchievementMgr.h:246
std::unordered_map< uint32, CriteriaProgress > CriteriaProgressMap
Definition: AchievementMgr.h:278
Definition: AchievementMgr.h:285
Achievement
Definition: boss_loatheb.cpp:52
uint32_t uint32
Definition: Define.h:150
Definition: AchievementMgr.h:90
std::unordered_map< uint32, AchievementReward > AchievementRewards
Definition: AchievementMgr.h:261
uint64_t uint64
Definition: Define.h:149
Definition: AchievementMgr.h:104
uint32 id
Definition: AchievementMgr.h:124
uint32 itemId
Definition: AchievementMgr.h:254
AchievementReward const * GetAchievementReward(AchievementEntry const *achievement) const
Definition: AchievementMgr.h:398
Definition: DBCEnums.h:302
AchievementCriteriaData()
Definition: AchievementMgr.h:219
ModifierTreeMap _criteriaModifiers
Definition: AchievementMgr.h:481
AchievementCriteriaTreeByCriteriaMap _achievementCriteriaTreeByCriteria
Definition: AchievementMgr.h:483
struct AchievementCriteriaData::@58::@67 map_players
Definition: AchievementMgr.h:284
Definition: AchievementMgr.h:48
struct AchievementCriteriaData::@58::@76 raw
Definition: DBCEnums.h:193
std::string text
Definition: AchievementMgr.h:257
Definition: AchievementMgr.h:312
uint32 compType
Definition: AchievementMgr.h:149
Definition: DB2Structure.h:318
struct AchievementCriteriaData::@58::@63 aura
std::unordered_map< uint32, AchievementCriteriaTree * > AchievementCriteriaTreeMap
Definition: AchievementMgr.h:71
Definition: AchievementMgr.h:78
void SetRealmCompleted(AchievementEntry const *achievement, uint32 instanceId)
Definition: AchievementMgr.h:428
Definition: AchievementMgr.h:93
std::vector< std::string > text
Definition: AchievementMgr.h:266
uint32 maxcount
Definition: AchievementMgr.h:165
AchievementCriteriaFlagsCu
Definition: AchievementMgr.h:44
TC_GAME_API void DeletePlayerAchievementsFromDB(ObjectGuid guid)
Definition: AchievementMgr.cpp:491
uint32 GetAchievementPoints() const
Definition: AchievementMgr.h:339
uint32 spell_id
Definition: AchievementMgr.h:142
TC_GAME_API void DeleteGuildAchievementsFromDB(ObjectGuid guid)
Definition: AchievementMgr.cpp:506
ProgressType
Definition: AchievementMgr.h:281
void SetCriteriaId(uint32 id)
Definition: AchievementMgr.h:243
bool Meets(uint32 criteria_id, Player const *source, Unit const *target, uint32 miscValue1=0) const
Definition: AchievementMgr.cpp:277
Definition: DB2Structure.h:184
AchievementCriteriaList const & GetTimedAchievementCriteriaByType(AchievementCriteriaTimedTypes type) const
Definition: AchievementMgr.h:387
Definition: AchievementMgr.h:89
uint32 team
Definition: AchievementMgr.h:170
void WalkCriteriaTree(AchievementCriteriaTree const *tree, Func const &func) const
Definition: AchievementMgr.h:455
std::set< ObjectGuid > GuidSet
Definition: ObjectGuid.h:332
std::vector< AchievementEntry const * > AchievementEntryList
Definition: AchievementMgr.h:73
#define TC_GAME_API
Definition: Define.h:134
AchievementCriteriaList const & GetAchievementCriteriaByType(AchievementCriteriaTypes type, bool guild=false) const
Definition: AchievementMgr.h:382
Definition: AchievementMgr.h:115
std::vector< AchievementCriteria const * > AchievementCriteriaList
Definition: AchievementMgr.h:59
std::map< uint32, uint32 > TimedAchievementMap
Definition: AchievementMgr.h:360
uint32 min_score
Definition: AchievementMgr.h:185
AchievementGlobalMgr()
Definition: AchievementMgr.h:367
Definition: DBCEnums.h:92
Definition: AchievementMgr.h:105
uint32 gender
Definition: AchievementMgr.h:159
Definition: AchievementMgr.h:101
ModifierTreeNode const * Modifier
Definition: AchievementMgr.h:55
Definition: ObjectGuid.h:189
uint32 class_id
Definition: AchievementMgr.h:130
uint64 counter
Definition: AchievementMgr.h:80
AchievementRewards _achievementRewards
Definition: AchievementMgr.h:497
std::map< uint32, AchievementCriteriaDataSet > AchievementCriteriaDataMap
Definition: AchievementMgr.h:249
bool IsGroupCriteriaType(AchievementCriteriaTypes type) const
Definition: AchievementMgr.h:436
std::map< uint32, uint32 > AllCompletedAchievements
Definition: AchievementMgr.h:494
ObjectGuid PlayerGUID
Definition: AchievementMgr.h:82
Definition: AchievementMgr.h:46
T * GetOwner() const
Definition: AchievementMgr.h:333
Definition: AchievementMgr.h:271
Definition: AchievementMgr.h:51
Definition: AchievementMgr.h:102
uint32 criteria_id
Definition: AchievementMgr.h:245
Definition: AchievementMgr.h:251
struct AchievementCriteriaData::@58::@72 equipped_item
Definition: WorldPacket.h:26
AchievementCriteriaDataSet const * GetCriteriaDataSet(AchievementCriteria const *achievementCriteria) const
Definition: AchievementMgr.h:410
struct AchievementCriteriaData::@58::@74 known_title
time_t date
Definition: AchievementMgr.h:81
Definition: AchievementMgr.h:110
struct AchievementCriteriaData::@58::@71 bg_loss_team_score
Definition: AchievementMgr.h:112
Definition: AchievementMgr.h:94
struct AchievementCriteriaData::@58::@69 drunk
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58
Definition: DBCEnums.h:220