TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
AchievementGlobalMgr Class Reference

#include <AchievementMgr.h>

Public Member Functions

AchievementCriteriaTreeList constGetAchievementCriteriaTreesByCriteria (uint32 criteriaId) const
 
AchievementCriteriaList constGetAchievementCriteriaByType (AchievementCriteriaTypes type, bool guild=false) const
 
AchievementCriteriaList constGetTimedAchievementCriteriaByType (AchievementCriteriaTimedTypes type) const
 
AchievementEntryList constGetAchievementByReferencedId (uint32 id) const
 
AchievementReward constGetAchievementReward (AchievementEntry const *achievement) const
 
AchievementRewardLocale constGetAchievementRewardLocale (AchievementEntry const *achievement) const
 
AchievementCriteriaDataSet constGetCriteriaDataSet (AchievementCriteria const *achievementCriteria) const
 
bool IsRealmCompleted (AchievementEntry const *achievement, uint32 instanceId) const
 
void SetRealmCompleted (AchievementEntry const *achievement, uint32 instanceId)
 
bool IsGroupCriteriaType (AchievementCriteriaTypes type) const
 
template<typename Func >
void WalkCriteriaTree (AchievementCriteriaTree const *tree, Func const &func) const
 
void OnInstanceDestroyed (uint32 instanceId)
 
void LoadAchievementCriteriaModifiersTree ()
 
void LoadAchievementCriteriaList ()
 
void LoadAchievementCriteriaData ()
 
void LoadAchievementReferenceList ()
 
void LoadCompletedAchievements ()
 
void LoadRewards ()
 
void LoadRewardLocales ()
 
AchievementEntry constGetAchievement (uint32 achievementId) const
 
AchievementCriteriaTree constGetAchievementCriteriaTree (uint32 criteriaTreeId) const
 
AchievementCriteria constGetAchievementCriteria (uint32 criteriaId) const
 

Static Public Member Functions

static char constGetCriteriaTypeString (AchievementCriteriaTypes type)
 
static char constGetCriteriaTypeString (uint32 type)
 
static AchievementGlobalMgrinstance ()
 

Private Types

typedef std::map< uint32, uint32AllCompletedAchievements
 

Private Member Functions

 AchievementGlobalMgr ()
 
 ~AchievementGlobalMgr ()
 

Private Attributes

AchievementCriteriaDataMap _criteriaDataMap
 
AchievementCriteriaTreeMap _achievementCriteriaTrees
 
AchievementCriteriaMap _achievementCriteria
 
ModifierTreeMap _criteriaModifiers
 
AchievementCriteriaTreeByCriteriaMap _achievementCriteriaTreeByCriteria
 
AchievementCriteriaList _achievementCriteriasByType [ACHIEVEMENT_CRITERIA_TYPE_TOTAL]
 
AchievementCriteriaList _guildAchievementCriteriasByType [ACHIEVEMENT_CRITERIA_TYPE_TOTAL]
 
AchievementCriteriaList _achievementCriteriasByTimedType [ACHIEVEMENT_TIMED_TYPE_MAX]
 
AchievementListByReferencedId _achievementListByReferencedId
 
AllCompletedAchievements _allCompletedAchievements
 
AchievementRewards _achievementRewards
 
AchievementRewardLocales _achievementRewardLocales
 

Member Typedef Documentation

Constructor & Destructor Documentation

AchievementGlobalMgr::AchievementGlobalMgr ( )
inlineprivate
367 { }
AchievementGlobalMgr::~AchievementGlobalMgr ( )
private
2895 {
2896  for (AchievementCriteriaTreeMap::iterator itr = _achievementCriteriaTrees.begin(); itr != _achievementCriteriaTrees.end(); ++itr)
2897  delete itr->second;
2898 
2899  for (AchievementCriteriaMap::iterator itr = _achievementCriteria.begin(); itr != _achievementCriteria.end(); ++itr)
2900  delete itr->second;
2901 
2902  for (ModifierTreeMap::iterator itr = _criteriaModifiers.begin(); itr != _criteriaModifiers.end(); ++itr)
2903  delete itr->second;
2904 }
AchievementCriteriaMap _achievementCriteria
Definition: AchievementMgr.h:480
AchievementCriteriaTreeMap _achievementCriteriaTrees
Definition: AchievementMgr.h:479
ModifierTreeMap _criteriaModifiers
Definition: AchievementMgr.h:481

Member Function Documentation

AchievementEntry const * AchievementGlobalMgr::GetAchievement ( uint32  achievementId) const
3359 {
3360  return sAchievementStore.LookupEntry(achievementId);
3361 }
DB2Storage< AchievementEntry > sAchievementStore("Achievement.db2", AchievementFormat, HOTFIX_SEL_ACHIEVEMENT)

+ Here is the caller graph for this function:

AchievementEntryList const* AchievementGlobalMgr::GetAchievementByReferencedId ( uint32  id) const
inline
393  {
394  AchievementListByReferencedId::const_iterator itr = _achievementListByReferencedId.find(id);
395  return itr != _achievementListByReferencedId.end() ? &itr->second : NULL;
396  }
arena_t NULL
Definition: jemalloc_internal.h:624
AchievementListByReferencedId _achievementListByReferencedId
Definition: AchievementMgr.h:492
AchievementCriteria const * AchievementGlobalMgr::GetAchievementCriteria ( uint32  criteriaId) const
3373 {
3374  auto itr = _achievementCriteria.find(criteriaId);
3375  if (itr == _achievementCriteria.end())
3376  return nullptr;
3377 
3378  return itr->second;
3379 }
AchievementCriteriaMap _achievementCriteria
Definition: AchievementMgr.h:480

+ Here is the caller graph for this function:

AchievementCriteriaList const& AchievementGlobalMgr::GetAchievementCriteriaByType ( AchievementCriteriaTypes  type,
bool  guild = false 
) const
inline
383  {
385  }
AchievementCriteriaList _guildAchievementCriteriasByType[ACHIEVEMENT_CRITERIA_TYPE_TOTAL]
Definition: AchievementMgr.h:487
AchievementCriteriaList _achievementCriteriasByType[ACHIEVEMENT_CRITERIA_TYPE_TOTAL]
Definition: AchievementMgr.h:486
AchievementCriteriaTree const * AchievementGlobalMgr::GetAchievementCriteriaTree ( uint32  criteriaTreeId) const
3364 {
3365  auto itr = _achievementCriteriaTrees.find(criteriaTreeId);
3366  if (itr == _achievementCriteriaTrees.end())
3367  return nullptr;
3368 
3369  return itr->second;
3370 }
AchievementCriteriaTreeMap _achievementCriteriaTrees
Definition: AchievementMgr.h:479
AchievementCriteriaTreeList const* AchievementGlobalMgr::GetAchievementCriteriaTreesByCriteria ( uint32  criteriaId) const
inline
377  {
378  auto itr = _achievementCriteriaTreeByCriteria.find(criteriaId);
379  return itr != _achievementCriteriaTreeByCriteria.end() ? &itr->second : nullptr;
380  }
AchievementCriteriaTreeByCriteriaMap _achievementCriteriaTreeByCriteria
Definition: AchievementMgr.h:483
AchievementReward const* AchievementGlobalMgr::GetAchievementReward ( AchievementEntry const achievement) const
inline
399  {
400  AchievementRewards::const_iterator iter = _achievementRewards.find(achievement->ID);
401  return iter != _achievementRewards.end() ? &iter->second : NULL;
402  }
arena_t NULL
Definition: jemalloc_internal.h:624
AchievementRewards _achievementRewards
Definition: AchievementMgr.h:497
AchievementRewardLocale const* AchievementGlobalMgr::GetAchievementRewardLocale ( AchievementEntry const achievement) const
inline
405  {
406  AchievementRewardLocales::const_iterator iter = _achievementRewardLocales.find(achievement->ID);
407  return iter != _achievementRewardLocales.end() ? &iter->second : NULL;
408  }
arena_t NULL
Definition: jemalloc_internal.h:624
AchievementRewardLocales _achievementRewardLocales
Definition: AchievementMgr.h:498
AchievementCriteriaDataSet const* AchievementGlobalMgr::GetCriteriaDataSet ( AchievementCriteria const achievementCriteria) const
inline
411  {
412  AchievementCriteriaDataMap::const_iterator iter = _criteriaDataMap.find(achievementCriteria->ID);
413  return iter != _criteriaDataMap.end() ? &iter->second : NULL;
414  }
arena_t NULL
Definition: jemalloc_internal.h:624
AchievementCriteriaDataMap _criteriaDataMap
Definition: AchievementMgr.h:477
char const * AchievementGlobalMgr::GetCriteriaTypeString ( AchievementCriteriaTypes  type)
static
2590 {
2591  switch (type)
2592  {
2594  return "KILL_CREATURE";
2596  return "TYPE_WIN_BG";
2598  return "COMPLETE_RESEARCH";
2600  return "REACH_LEVEL";
2602  return "REACH_SKILL_LEVEL";
2604  return "COMPLETE_ACHIEVEMENT";
2606  return "COMPLETE_QUEST_COUNT";
2608  return "COMPLETE_DAILY_QUEST_DAILY";
2610  return "COMPLETE_QUESTS_IN_ZONE";
2612  return "CURRENCY";
2614  return "DAMAGE_DONE";
2616  return "COMPLETE_DAILY_QUEST";
2618  return "COMPLETE_BATTLEGROUND";
2620  return "DEATH_AT_MAP";
2622  return "DEATH";
2624  return "DEATH_IN_DUNGEON";
2626  return "COMPLETE_RAID";
2628  return "KILLED_BY_CREATURE";
2630  return "KILLED_BY_PLAYER";
2632  return "FALL_WITHOUT_DYING";
2634  return "DEATHS_FROM";
2636  return "COMPLETE_QUEST";
2638  return "BE_SPELL_TARGET";
2640  return "CAST_SPELL";
2642  return "BG_OBJECTIVE_CAPTURE";
2644  return "HONORABLE_KILL_AT_AREA";
2646  return "WIN_ARENA";
2648  return "PLAY_ARENA";
2650  return "LEARN_SPELL";
2652  return "HONORABLE_KILL";
2654  return "OWN_ITEM";
2656  return "WIN_RATED_ARENA";
2658  return "HIGHEST_TEAM_RATING";
2660  return "HIGHEST_PERSONAL_RATING";
2662  return "LEARN_SKILL_LEVEL";
2664  return "USE_ITEM";
2666  return "LOOT_ITEM";
2668  return "EXPLORE_AREA";
2670  return "OWN_RANK";
2672  return "BUY_BANK_SLOT";
2674  return "GAIN_REPUTATION";
2676  return "GAIN_EXALTED_REPUTATION";
2678  return "VISIT_BARBER_SHOP";
2680  return "EQUIP_EPIC_ITEM";
2682  return "ROLL_NEED_ON_LOOT";
2684  return "GREED_ON_LOOT";
2686  return "HK_CLASS";
2688  return "HK_RACE";
2690  return "DO_EMOTE";
2692  return "HEALING_DONE";
2694  return "GET_KILLING_BLOWS";
2696  return "EQUIP_ITEM";
2698  return "MONEY_FROM_VENDORS";
2700  return "GOLD_SPENT_FOR_TALENTS";
2702  return "NUMBER_OF_TALENT_RESETS";
2704  return "MONEY_FROM_QUEST_REWARD";
2706  return "GOLD_SPENT_FOR_TRAVELLING";
2708  return "GOLD_SPENT_AT_BARBER";
2710  return "GOLD_SPENT_FOR_MAIL";
2712  return "LOOT_MONEY";
2714  return "USE_GAMEOBJECT";
2716  return "BE_SPELL_TARGET2";
2718  return "SPECIAL_PVP_KILL";
2720  return "FISH_IN_GAMEOBJECT";
2722  return "ON_LOGIN";
2724  return "LEARN_SKILLLINE_SPELLS";
2726  return "WIN_DUEL";
2728  return "LOSE_DUEL";
2730  return "KILL_CREATURE_TYPE";
2732  return "GOLD_EARNED_BY_AUCTIONS";
2734  return "CREATE_AUCTION";
2736  return "HIGHEST_AUCTION_BID";
2738  return "WON_AUCTIONS";
2740  return "HIGHEST_AUCTION_SOLD";
2742  return "HIGHEST_GOLD_VALUE_OWNED";
2744  return "GAIN_REVERED_REPUTATION";
2746  return "GAIN_HONORED_REPUTATION";
2748  return "KNOWN_FACTIONS";
2750  return "LOOT_EPIC_ITEM";
2752  return "RECEIVE_EPIC_ITEM";
2754  return "ROLL_NEED";
2756  return "ROLL_GREED";
2758  return "HIT_DEALT";
2760  return "HIT_RECEIVED";
2762  return "TOTAL_DAMAGE_RECEIVED";
2764  return "HIGHEST_HEAL_CAST";
2766  return "TOTAL_HEALING_RECEIVED";
2768  return "HIGHEST_HEALING_RECEIVED";
2770  return "QUEST_ABANDONED";
2772  return "FLIGHT_PATHS_TAKEN";
2774  return "LOOT_TYPE";
2776  return "CAST_SPELL2";
2778  return "LEARN_SKILL_LINE";
2780  return "EARN_HONORABLE_KILL";
2782  return "ACCEPTED_SUMMONINGS";
2784  return "EARN_ACHIEVEMENT_POINTS";
2786  return "USE_LFD_TO_GROUP_WITH_PLAYERS";
2788  return "SPENT_GOLD_GUILD_REPAIRS";
2790  return "REACH_GUILD_LEVEL";
2792  return "CRAFT_ITEMS_GUILD";
2794  return "CATCH_FROM_POOL";
2796  return "BUY_GUILD_BANK_SLOTS";
2798  return "EARN_GUILD_ACHIEVEMENT_POINTS";
2800  return "WIN_RATED_BATTLEGROUND";
2802  return "REACH_BG_RATING";
2804  return "BUY_GUILD_TABARD";
2806  return "COMPLETE_QUESTS_GUILD";
2808  return "HONORABLE_KILLS_GUILD";
2810  return "KILL_CREATURE_TYPE_GUILD";
2812  return "GUILD_CHALLENGE_TYPE";
2814  return "GUILD_CHALLENGE";
2816  return "LFR_DUNGEONS_COMPLETED";
2818  return "LFR_LEAVES";
2820  return "LFR_VOTE_KICKS_INITIATED_BY_PLAYER";
2822  return "LFR_VOTE_KICKS_NOT_INIT_BY_PLAYER";
2824  return "BE_KICKED_FROM_LFR";
2826  return "COUNT_OF_LFR_QUEUE_BOOSTS_BY_TANK";
2828  return "COMPLETE_SCENARIO_COUNT";
2830  return "COMPLETE_SCENARIO";
2832  return "OWN_BATTLE_PET";
2834  return "OWN_BATTLE_PET_COUNT";
2836  return "CAPTURE_BATTLE_PET";
2838  return "WIN_PET_BATTLE";
2840  return "LEVEL_BATTLE_PET";
2842  return "CAPTURE_BATTLE_PET_CREDIT";
2844  return "LEVEL_BATTLE_PET_CREDIT";
2846  return "ENTER_AREA";
2848  return "LEAVE_AREA";
2850  return "COMPLETE_DUNGEON_ENCOUNTER";
2852  return "PLACE_GARRISON_BUILDING";
2854  return "UPGRADE_GARRISON_BUILDING";
2856  return "CONSTRUCT_GARRISON_BUILDING";
2858  return "UPGRADE_GARRISON";
2860  return "START_GARRISON_MISSION";
2862  return "COMPLETE_GARRISON_MISSION_COUNT";
2864  return "COMPLETE_GARRISON_MISSION";
2866  return "RECRUIT_GARRISON_FOLLOWER_COUNT";
2868  return "LEARN_GARRISON_BLUEPRINT_COUNT";
2870  return "COMPLETE_GARRISON_SHIPMENT";
2872  return "RAISE_GARRISON_FOLLOWER_ITEM_LEVEL";
2874  return "RAISE_GARRISON_FOLLOWER_LEVEL";
2876  return "OWN_TOY";
2878  return "OWN_TOY_COUNT";
2880  return "RECRUIT_GARRISON_FOLLOWER";
2882  return "OWN_HEIRLOOMS";
2883  }
2884  return "MISSING_TYPE";
2885 }
Definition: DBCEnums.h:207
Definition: DBCEnums.h:265
Definition: DBCEnums.h:236
Definition: DBCEnums.h:234
Definition: DBCEnums.h:221
Definition: DBCEnums.h:208
Definition: DBCEnums.h:263
Definition: DBCEnums.h:199
Definition: DBCEnums.h:271
Definition: DBCEnums.h:198
Definition: DBCEnums.h:249
Definition: DBCEnums.h:224
Definition: DBCEnums.h:235
Definition: DBCEnums.h:212
Definition: DBCEnums.h:246
Definition: DBCEnums.h:237
Definition: DBCEnums.h:354
Definition: DBCEnums.h:244
Definition: DBCEnums.h:218
Definition: DBCEnums.h:357
Definition: DBCEnums.h:279
Definition: DBCEnums.h:245
Definition: DBCEnums.h:266
Definition: DBCEnums.h:316
Definition: DBCEnums.h:233
Definition: DBCEnums.h:201
Definition: DBCEnums.h:247
Definition: DBCEnums.h:257
Definition: DBCEnums.h:355
Definition: DBCEnums.h:226
Definition: DBCEnums.h:280
Definition: DBCEnums.h:290
Definition: DBCEnums.h:333
Definition: DBCEnums.h:289
Definition: DBCEnums.h:228
Definition: DBCEnums.h:334
Definition: DBCEnums.h:211
Definition: DBCEnums.h:225
Definition: DBCEnums.h:214

+ Here is the caller graph for this function:

char const * AchievementGlobalMgr::GetCriteriaTypeString ( uint32  type)
static
2585 {
2587 }
static char const * GetCriteriaTypeString(AchievementCriteriaTypes type)
Definition: AchievementMgr.cpp:2589
AchievementCriteriaTypes
Definition: DBCEnums.h:196

+ Here is the call graph for this function:

AchievementCriteriaList const& AchievementGlobalMgr::GetTimedAchievementCriteriaByType ( AchievementCriteriaTimedTypes  type) const
inline
388  {
390  }
AchievementCriteriaList _achievementCriteriasByTimedType[ACHIEVEMENT_TIMED_TYPE_MAX]
Definition: AchievementMgr.h:489
AchievementGlobalMgr * AchievementGlobalMgr::instance ( )
static
2888 {
2890  return &instance;
2891 }
Definition: AchievementMgr.h:365
static AchievementGlobalMgr * instance()
Definition: AchievementMgr.cpp:2887
bool AchievementGlobalMgr::IsGroupCriteriaType ( AchievementCriteriaTypes  type) const
inline
437  {
438  switch (type)
439  {
446  return true;
447  default:
448  break;
449  }
450 
451  return false;
452  }
Definition: DBCEnums.h:199
Definition: DBCEnums.h:198
bool AchievementGlobalMgr::IsRealmCompleted ( AchievementEntry const achievement,
uint32  instanceId 
) const
inline
417  {
418  AllCompletedAchievements::const_iterator itr = _allCompletedAchievements.find(achievement->ID);
419  if (itr == _allCompletedAchievements.end())
420  return false;
421 
422  if (achievement->Flags & ACHIEVEMENT_FLAG_REALM_FIRST_KILL)
423  return itr->second != instanceId;
424 
425  return true;
426  }
AllCompletedAchievements _allCompletedAchievements
Definition: AchievementMgr.h:495
Definition: DBCEnums.h:92
void AchievementGlobalMgr::LoadAchievementCriteriaData ( )
3100 {
3101  uint32 oldMSTime = getMSTime();
3102 
3103  _criteriaDataMap.clear(); // need for reload case
3104 
3105  QueryResult result = WorldDatabase.Query("SELECT criteria_id, type, value1, value2, ScriptName FROM achievement_criteria_data");
3106 
3107  if (!result)
3108  {
3109  TC_LOG_INFO("server.loading", ">> Loaded 0 additional achievement criteria data. DB table `achievement_criteria_data` is empty.");
3110  return;
3111  }
3112 
3113  uint32 count = 0;
3114 
3115  do
3116  {
3117  Field* fields = result->Fetch();
3118  uint32 criteria_id = fields[0].GetUInt32();
3119 
3120  AchievementCriteria const* criteria = sAchievementMgr->GetAchievementCriteria(criteria_id);
3121 
3122  if (!criteria)
3123  {
3124  TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_data` has data for non-existing criteria (Entry: %u), ignore.", criteria_id);
3125  continue;
3126  }
3127 
3128  uint32 dataType = fields[1].GetUInt8();
3129  std::string scriptName = fields[4].GetString();
3130  uint32 scriptId = 0;
3131  if (!scriptName.empty())
3132  {
3133  if (dataType != ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT)
3134  TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_data` has ScriptName set for non-scripted data type (Entry: %u, type %u), useless data.", criteria_id, dataType);
3135  else
3136  scriptId = sObjectMgr->GetScriptId(scriptName);
3137  }
3138 
3139  AchievementCriteriaData data(dataType, fields[2].GetUInt32(), fields[3].GetUInt32(), scriptId);
3140 
3141  if (!data.IsValid(criteria))
3142  continue;
3143 
3144  // this will allocate empty data set storage
3145  AchievementCriteriaDataSet& dataSet = _criteriaDataMap[criteria_id];
3146  dataSet.SetCriteriaId(criteria_id);
3147 
3148  // add real data only for not NONE data types
3149  if (data.dataType != ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE)
3150  dataSet.Add(data);
3151 
3152  // counting data by and data types
3153  ++count;
3154  }
3155  while (result->NextRow());
3156 
3157  TC_LOG_INFO("server.loading", ">> Loaded %u additional achievement criteria data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
3158 }
Definition: AchievementMgr.h:97
Class used to access individual fields of database query result.
Definition: Field.h:56
Definition: AchievementMgr.h:88
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
void Add(AchievementCriteriaData const &data)
Definition: AchievementMgr.h:241
#define sObjectMgr
Definition: ObjectMgr.h:1567
Definition: AchievementMgr.h:237
AchievementCriteriaDataMap _criteriaDataMap
Definition: AchievementMgr.h:477
uint8 GetUInt8() const
Definition: Field.h:70
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
void SetCriteriaId(uint32 id)
Definition: AchievementMgr.h:243
Definition: AchievementMgr.h:115
uint32 GetUInt32() const
Definition: Field.h:146
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: AchievementMgr.h:51
std::string GetString() const
Definition: Field.h:276
#define sAchievementMgr
Definition: AchievementMgr.h:501

+ Here is the call graph for this function:

void AchievementGlobalMgr::LoadAchievementCriteriaList ( )
2943 {
2944  uint32 oldMSTime = getMSTime();
2945 
2946  if (sCriteriaTreeStore.GetNumRows() == 0)
2947  {
2948  TC_LOG_ERROR("server.loading", ">> Loaded 0 achievement criteria.");
2949  return;
2950  }
2951 
2952  std::unordered_map<uint32 /*criteriaTreeID*/, AchievementEntry const*> achievementCriteriaTreeIds;
2953  for (uint32 i = 0; i < sAchievementStore.GetNumRows(); ++i)
2954  if (AchievementEntry const* achievement = sAchievementStore.LookupEntry(i))
2955  if (achievement->CriteriaTree)
2956  achievementCriteriaTreeIds[achievement->CriteriaTree] = achievement;
2957 
2958  // Load criteria tree nodes
2959  for (uint32 i = 0; i < sCriteriaTreeStore.GetNumRows(); ++i)
2960  {
2961  CriteriaTreeEntry const* tree = sCriteriaTreeStore.LookupEntry(i);
2962  if (!tree)
2963  continue;
2964 
2965  // Find linked achievement
2966  auto achievementItr = achievementCriteriaTreeIds.find(tree->ID);
2967  CriteriaTreeEntry const* cur = tree;
2968  while (achievementItr == achievementCriteriaTreeIds.end())
2969  {
2970  if (!cur->Parent)
2971  break;
2972 
2973  cur = sCriteriaTreeStore.LookupEntry(cur->Parent);
2974  if (!cur)
2975  break;
2976 
2977  achievementItr = achievementCriteriaTreeIds.find(cur->ID);
2978  }
2979 
2980  if (achievementItr == achievementCriteriaTreeIds.end())
2981  continue;
2982 
2983  AchievementCriteriaTree* achievementCriteriaTree = new AchievementCriteriaTree();
2984  achievementCriteriaTree->ID = i;
2985  achievementCriteriaTree->Achievement = achievementItr->second;
2986  achievementCriteriaTree->Entry = tree;
2987 
2988  _achievementCriteriaTrees[achievementCriteriaTree->Entry->ID] = achievementCriteriaTree;
2989  }
2990 
2991  // Build tree
2992  for (auto itr = _achievementCriteriaTrees.begin(); itr != _achievementCriteriaTrees.end(); ++itr)
2993  {
2994  if (!itr->second->Entry->Parent)
2995  continue;
2996 
2997  auto parent = _achievementCriteriaTrees.find(itr->second->Entry->Parent);
2998  if (parent != _achievementCriteriaTrees.end())
2999  {
3000  parent->second->Children.push_back(itr->second);
3001  while (parent != _achievementCriteriaTrees.end())
3002  {
3003  auto cur = parent;
3004  parent = _achievementCriteriaTrees.find(parent->second->Entry->Parent);
3005  if (parent == _achievementCriteriaTrees.end())
3006  {
3007  if (sCriteriaStore.LookupEntry(itr->second->Entry->CriteriaID))
3008  _achievementCriteriaTreeByCriteria[itr->second->Entry->CriteriaID].push_back(cur->second);
3009  }
3010  }
3011  }
3012  else if (sCriteriaStore.LookupEntry(itr->second->Entry->CriteriaID))
3013  _achievementCriteriaTreeByCriteria[itr->second->Entry->CriteriaID].push_back(itr->second);
3014  }
3015 
3016  // Load criteria
3017  uint32 criterias = 0;
3018  uint32 guildCriterias = 0;
3019  for (uint32 i = 0; i < sCriteriaStore.GetNumRows(); ++i)
3020  {
3021  CriteriaEntry const* criteria = sCriteriaStore.LookupEntry(i);
3022  if (!criteria)
3023  continue;
3024 
3025  auto treeItr = _achievementCriteriaTreeByCriteria.find(i);
3026  if (treeItr == _achievementCriteriaTreeByCriteria.end())
3027  continue;
3028 
3029  AchievementCriteria* achievementCriteria = new AchievementCriteria();
3030  achievementCriteria->ID = i;
3031  achievementCriteria->Entry = criteria;
3032  auto mod = _criteriaModifiers.find(criteria->ModifierTreeId);
3033  if (mod != _criteriaModifiers.end())
3034  achievementCriteria->Modifier = mod->second;
3035 
3036  _achievementCriteria[achievementCriteria->ID] = achievementCriteria;
3037 
3038  for (AchievementCriteriaTree const* tree : treeItr->second)
3039  {
3041  achievementCriteria->FlagsCu |= ACHIEVEMENT_CRITERIA_FLAG_CU_GUILD;
3042  else if (tree->Achievement->Flags & ACHIEVEMENT_FLAG_ACCOUNT)
3043  achievementCriteria->FlagsCu |= ACHIEVEMENT_CRITERIA_FLAG_CU_ACCOUNT;
3044  else
3045  achievementCriteria->FlagsCu |= ACHIEVEMENT_CRITERIA_FLAG_CU_PLAYER;
3046  }
3047 
3048  if (achievementCriteria->FlagsCu & ACHIEVEMENT_CRITERIA_FLAG_CU_GUILD)
3049  {
3050  ++guildCriterias;
3051  _guildAchievementCriteriasByType[criteria->Type].push_back(achievementCriteria);
3052  }
3053 
3055  {
3056  ++criterias;
3057  _achievementCriteriasByType[criteria->Type].push_back(achievementCriteria);
3058  }
3059 
3060  if (criteria->StartTimer)
3061  _achievementCriteriasByTimedType[criteria->StartEvent].push_back(achievementCriteria);
3062  }
3063 
3064  for (auto& p : _achievementCriteriaTrees)
3065  const_cast<AchievementCriteriaTree*>(p.second)->Criteria = GetAchievementCriteria(p.second->Entry->CriteriaID);
3066 
3067  TC_LOG_INFO("server.loading", ">> Loaded %u achievement criteria and %u guild achievement crieteria in %u ms", criterias, guildCriterias, GetMSTimeDiffToNow(oldMSTime));
3068 }
CriteriaTreeEntry const * Entry
Definition: AchievementMgr.h:65
uint32 StartTimer
Definition: DB2Structure.h:309
uint32 ID
Definition: AchievementMgr.h:53
AchievementCriteriaMap _achievementCriteria
Definition: AchievementMgr.h:480
AchievementCriteriaList _achievementCriteriasByTimedType[ACHIEVEMENT_TIMED_TYPE_MAX]
Definition: AchievementMgr.h:489
DB2Storage< CriteriaEntry > sCriteriaStore("Criteria.db2", CriteriaFormat, HOTFIX_SEL_CRITERIA)
uint32 Flags
Definition: DB2Structure.h:38
Definition: AchievementMgr.h:62
AchievementCriteria const * GetAchievementCriteria(uint32 criteriaId) const
Definition: AchievementMgr.cpp:3372
uint32 FlagsCu
Definition: AchievementMgr.h:56
uint32 getMSTime()
Definition: Timer.h:24
Definition: DBCEnums.h:97
uint32 Parent
Definition: DB2Structure.h:324
AchievementCriteriaList _guildAchievementCriteriasByType[ACHIEVEMENT_CRITERIA_TYPE_TOTAL]
Definition: AchievementMgr.h:487
uint32 StartEvent
Definition: DB2Structure.h:307
uint32 ModifierTreeId
Definition: DB2Structure.h:312
AchievementCriteriaTreeMap _achievementCriteriaTrees
Definition: AchievementMgr.h:479
uint32 ID
Definition: AchievementMgr.h:64
Definition: AchievementMgr.h:47
uint32 Type
Definition: DB2Structure.h:187
Definition: DB2Structure.h:27
Definition: DBCEnums.h:100
AchievementEntry const * Achievement
Definition: AchievementMgr.h:66
DB2Storage< AchievementEntry > sAchievementStore("Achievement.db2", AchievementFormat, HOTFIX_SEL_ACHIEVEMENT)
uint32 ID
Definition: DB2Structure.h:320
uint32_t uint32
Definition: Define.h:150
DB2Storage< CriteriaTreeEntry > sCriteriaTreeStore("CriteriaTree.db2", CriteriaTreeFormat, HOTFIX_SEL_CRITERIA_TREE)
ModifierTreeMap _criteriaModifiers
Definition: AchievementMgr.h:481
AchievementCriteriaTreeByCriteriaMap _achievementCriteriaTreeByCriteria
Definition: AchievementMgr.h:483
AchievementCriteriaList _achievementCriteriasByType[ACHIEVEMENT_CRITERIA_TYPE_TOTAL]
Definition: AchievementMgr.h:486
Definition: AchievementMgr.h:48
Definition: DB2Structure.h:318
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
CriteriaEntry const * Entry
Definition: AchievementMgr.h:54
Definition: DB2Structure.h:184
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
ModifierTreeNode const * Modifier
Definition: AchievementMgr.h:55
Definition: AchievementMgr.h:46
Definition: AchievementMgr.h:51

+ Here is the call graph for this function:

void AchievementGlobalMgr::LoadAchievementCriteriaModifiersTree ( )
2907 {
2908  uint32 oldMSTime = getMSTime();
2909 
2910  if (sModifierTreeStore.GetNumRows() == 0)
2911  {
2912  TC_LOG_ERROR("server.loading", ">> Loaded 0 achievement criteria modifiers.");
2913  return;
2914  }
2915 
2916  // Load modifier tree nodes
2917  for (uint32 i = 0; i < sModifierTreeStore.GetNumRows(); ++i)
2918  {
2919  ModifierTreeEntry const* tree = sModifierTreeStore.LookupEntry(i);
2920  if (!tree)
2921  continue;
2922 
2923  ModifierTreeNode* node = new ModifierTreeNode();
2924  node->Entry = tree;
2925  _criteriaModifiers[node->Entry->ID] = node;
2926  }
2927 
2928  // Build tree
2929  for (auto itr = _criteriaModifiers.begin(); itr != _criteriaModifiers.end(); ++itr)
2930  {
2931  if (!itr->second->Entry->Parent)
2932  continue;
2933 
2934  auto parent = _criteriaModifiers.find(itr->second->Entry->Parent);
2935  if (parent != _criteriaModifiers.end())
2936  parent->second->Children.push_back(itr->second);
2937  }
2938 
2939  TC_LOG_INFO("server.loading", ">> Loaded %u achievement criteria modifiers in %u ms", uint32(_criteriaModifiers.size()), GetMSTimeDiffToNow(oldMSTime));
2940 }
Definition: AchievementMgr.h:36
ModifierTreeEntry const * Entry
Definition: AchievementMgr.h:38
uint32 getMSTime()
Definition: Timer.h:24
Definition: DB2Structure.h:903
uint32_t uint32
Definition: Define.h:150
ModifierTreeMap _criteriaModifiers
Definition: AchievementMgr.h:481
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
DB2Storage< ModifierTreeEntry > sModifierTreeStore("ModifierTree.db2", ModifierTreeFormat, HOTFIX_SEL_MODIFIER_TREE)
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint32_t uint32
Definition: g3dmath.h:168
uint32 ID
Definition: DB2Structure.h:905

+ Here is the call graph for this function:

void AchievementGlobalMgr::LoadAchievementReferenceList ( )
3071 {
3072  uint32 oldMSTime = getMSTime();
3073 
3074  if (sAchievementStore.GetNumRows() == 0)
3075  {
3076  TC_LOG_INFO("server.loading", ">> Loaded 0 achievement references.");
3077  return;
3078  }
3079 
3080  uint32 count = 0;
3081 
3082  for (uint32 entryId = 0; entryId < sAchievementStore.GetNumRows(); ++entryId)
3083  {
3084  AchievementEntry const* achievement = sAchievementMgr->GetAchievement(entryId);
3085  if (!achievement || !achievement->SharesCriteria)
3086  continue;
3087 
3088  _achievementListByReferencedId[achievement->SharesCriteria].push_back(achievement);
3089  ++count;
3090  }
3091 
3092  // Once Bitten, Twice Shy (10 player) - Icecrown Citadel
3093  if (AchievementEntry const* achievement = sAchievementMgr->GetAchievement(4539))
3094  const_cast<AchievementEntry*>(achievement)->MapID = 631; // Correct map requirement (currently has Ulduar); 6.0.3 note - it STILL has ulduar requirement
3095 
3096  TC_LOG_INFO("server.loading", ">> Loaded %u achievement references in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
3097 }
uint32 getMSTime()
Definition: Timer.h:24
AchievementListByReferencedId _achievementListByReferencedId
Definition: AchievementMgr.h:492
Definition: DB2Structure.h:27
uint32 SharesCriteria
Definition: DB2Structure.h:42
DB2Storage< AchievementEntry > sAchievementStore("Achievement.db2", AchievementFormat, HOTFIX_SEL_ACHIEVEMENT)
uint32_t uint32
Definition: Define.h:150
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define sAchievementMgr
Definition: AchievementMgr.h:501

+ Here is the call graph for this function:

void AchievementGlobalMgr::LoadCompletedAchievements ( )
3161 {
3162  uint32 oldMSTime = getMSTime();
3163 
3164  QueryResult result = CharacterDatabase.Query("SELECT achievement FROM character_achievement GROUP BY achievement");
3165 
3166  if (!result)
3167  {
3168  TC_LOG_INFO("server.loading", ">> Loaded 0 realm first completed achievements. DB table `character_achievement` is empty.");
3169  return;
3170  }
3171 
3172  do
3173  {
3174  Field* fields = result->Fetch();
3175 
3176  uint16 achievementId = fields[0].GetUInt16();
3177  const AchievementEntry* achievement = sAchievementMgr->GetAchievement(achievementId);
3178  if (!achievement)
3179  {
3180  // Remove non existent achievements from all characters
3181  TC_LOG_ERROR("achievement", "Non-existing achievement %u data removed from table `character_achievement`.", achievementId);
3182 
3184  stmt->setUInt16(0, uint16(achievementId));
3185  CharacterDatabase.Execute(stmt);
3186 
3187  continue;
3188  }
3190  _allCompletedAchievements[achievementId] = uint32(0xFFFFFFFF);
3191  }
3192  while (result->NextRow());
3193 
3194  TC_LOG_INFO("server.loading", ">> Loaded %lu realm first completed achievements in %u ms", (unsigned long)_allCompletedAchievements.size(), GetMSTimeDiffToNow(oldMSTime));
3195 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
AllCompletedAchievements _allCompletedAchievements
Definition: AchievementMgr.h:495
Definition: DBCEnums.h:91
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 Flags
Definition: DB2Structure.h:38
uint32 getMSTime()
Definition: Timer.h:24
uint16_t uint16
Definition: g3dmath.h:166
Definition: PreparedStatement.h:74
Definition: CharacterDatabase.h:348
Definition: DB2Structure.h:27
void setUInt16(const uint8 index, const uint16 value)
Definition: PreparedStatement.cpp:106
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint16_t uint16
Definition: Define.h:151
uint16 GetUInt16() const
Definition: Field.h:108
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
Definition: DBCEnums.h:92
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint32_t uint32
Definition: g3dmath.h:168
#define sAchievementMgr
Definition: AchievementMgr.h:501

+ Here is the call graph for this function:

void AchievementGlobalMgr::LoadRewardLocales ( )
3317 {
3318  uint32 oldMSTime = getMSTime();
3319 
3320  _achievementRewardLocales.clear(); // need for reload case
3321 
3322  QueryResult result = WorldDatabase.Query("SELECT entry, subject_loc1, text_loc1, subject_loc2, text_loc2, subject_loc3, text_loc3, subject_loc4, text_loc4, "
3323  "subject_loc5, text_loc5, subject_loc6, text_loc6, subject_loc7, text_loc7, subject_loc8, text_loc8"
3324  " FROM locales_achievement_reward");
3325 
3326  if (!result)
3327  {
3328  TC_LOG_INFO("server.loading", ">> Loaded 0 achievement reward locale strings. DB table `locales_achievement_reward` is empty");
3329  return;
3330  }
3331 
3332  do
3333  {
3334  Field* fields = result->Fetch();
3335 
3336  uint32 entry = fields[0].GetUInt32();
3337 
3338  if (_achievementRewards.find(entry) == _achievementRewards.end())
3339  {
3340  TC_LOG_ERROR("sql.sql", "Table `locales_achievement_reward` (Entry: %u) has locale strings for non-existing achievement reward.", entry);
3341  continue;
3342  }
3343 
3345 
3346  for (uint8 i = OLD_TOTAL_LOCALES - 1; i > 0; --i)
3347  {
3348  LocaleConstant locale = (LocaleConstant) i;
3349  ObjectMgr::AddLocaleString(fields[1 + 2 * (i - 1)].GetString(), locale, data.subject);
3350  ObjectMgr::AddLocaleString(fields[1 + 2 * (i - 1) + 1].GetString(), locale, data.text);
3351  }
3352  }
3353  while (result->NextRow());
3354 
3355  TC_LOG_INFO("server.loading", ">> Loaded %u achievement reward locale strings in %u ms", uint32(_achievementRewardLocales.size()), GetMSTimeDiffToNow(oldMSTime));
3356 }
std::vector< std::string > subject
Definition: AchievementMgr.h:265
Class used to access individual fields of database query result.
Definition: Field.h:56
const uint8 OLD_TOTAL_LOCALES
Definition: Common.h:133
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
AchievementRewardLocales _achievementRewardLocales
Definition: AchievementMgr.h:498
Definition: AchievementMgr.h:263
LocaleConstant
Definition: Common.h:115
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
std::vector< std::string > text
Definition: AchievementMgr.h:266
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
static void AddLocaleString(std::string const &value, LocaleConstant localeConstant, StringVector &data)
Definition: ObjectMgr.cpp:295
uint32 GetUInt32() const
Definition: Field.h:146
uint8_t uint8
Definition: Define.h:152
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint32_t uint32
Definition: g3dmath.h:168
AchievementRewards _achievementRewards
Definition: AchievementMgr.h:497

+ Here is the call graph for this function:

void AchievementGlobalMgr::LoadRewards ( )
3198 {
3199  uint32 oldMSTime = getMSTime();
3200 
3201  _achievementRewards.clear(); // need for reload case
3202 
3203  // 0 1 2 3 4 5 6 7
3204  QueryResult result = WorldDatabase.Query("SELECT entry, title_A, title_H, item, sender, subject, text, mailTemplate FROM achievement_reward");
3205 
3206  if (!result)
3207  {
3208  TC_LOG_ERROR("server.loading", ">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty.");
3209  return;
3210  }
3211 
3212  uint32 count = 0;
3213 
3214  do
3215  {
3216  Field* fields = result->Fetch();
3217  uint32 entry = fields[0].GetUInt32();
3218  AchievementEntry const* achievement = GetAchievement(entry);
3219  if (!achievement)
3220  {
3221  TC_LOG_ERROR("sql.sql", "Table `achievement_reward` has wrong achievement (Entry: %u), ignored.", entry);
3222  continue;
3223  }
3224 
3225  AchievementReward reward;
3226  reward.titleId[0] = fields[1].GetUInt32();
3227  reward.titleId[1] = fields[2].GetUInt32();
3228  reward.itemId = fields[3].GetUInt32();
3229  reward.sender = fields[4].GetUInt32();
3230  reward.subject = fields[5].GetString();
3231  reward.text = fields[6].GetString();
3232  reward.mailTemplate = fields[7].GetUInt32();
3233 
3234  // must be title or mail at least
3235  if (!reward.titleId[0] && !reward.titleId[1] && !reward.sender)
3236  {
3237  TC_LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) does not have title or item reward data, ignored.", entry);
3238  continue;
3239  }
3240 
3241  if (achievement->Faction == ACHIEVEMENT_FACTION_ANY && (!reward.titleId[0] ^ !reward.titleId[1]))
3242  TC_LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) has title (A: %u H: %u) for only one team.", entry, reward.titleId[0], reward.titleId[1]);
3243 
3244  if (reward.titleId[0])
3245  {
3246  CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(reward.titleId[0]);
3247  if (!titleEntry)
3248  {
3249  TC_LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_A`, set to 0", entry, reward.titleId[0]);
3250  reward.titleId[0] = 0;
3251  }
3252  }
3253 
3254  if (reward.titleId[1])
3255  {
3256  CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(reward.titleId[1]);
3257  if (!titleEntry)
3258  {
3259  TC_LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_H`, set to 0", entry, reward.titleId[1]);
3260  reward.titleId[1] = 0;
3261  }
3262  }
3263 
3264  //check mail data before item for report including wrong item case
3265  if (reward.sender)
3266  {
3267  if (!sObjectMgr->GetCreatureTemplate(reward.sender))
3268  {
3269  TC_LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) has invalid creature entry %u as sender, mail reward skipped.", entry, reward.sender);
3270  reward.sender = 0;
3271  }
3272  }
3273  else
3274  {
3275  if (reward.itemId)
3276  TC_LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) does not have sender data but has item reward, item will not be rewarded.", entry);
3277 
3278  if (!reward.subject.empty())
3279  TC_LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) does not have sender data but has mail subject.", entry);
3280 
3281  if (!reward.text.empty())
3282  TC_LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) does not have sender data but has mail text.", entry);
3283 
3284  if (reward.mailTemplate)
3285  TC_LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) does not have sender data but has mailTemplate.", entry);
3286  }
3287 
3288  if (reward.mailTemplate)
3289  {
3290  if (!sMailTemplateStore.LookupEntry(reward.mailTemplate))
3291  {
3292  TC_LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) has invalid mailTemplate (%u).", entry, reward.mailTemplate);
3293  reward.mailTemplate = 0;
3294  }
3295  else if (!reward.subject.empty() || !reward.text.empty())
3296  TC_LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) has mailTemplate (%u) and mail subject/text.", entry, reward.mailTemplate);
3297  }
3298 
3299  if (reward.itemId)
3300  {
3301  if (!sObjectMgr->GetItemTemplate(reward.itemId))
3302  {
3303  TC_LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) has invalid item id %u, reward mail will not contain item.", entry, reward.itemId);
3304  reward.itemId = 0;
3305  }
3306  }
3307 
3308  _achievementRewards[entry] = reward;
3309  ++count;
3310  }
3311  while (result->NextRow());
3312 
3313  TC_LOG_INFO("server.loading", ">> Loaded %u achievement rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
3314 }
uint32 sender
Definition: AchievementMgr.h:255
uint32 mailTemplate
Definition: AchievementMgr.h:258
Definition: DBCStructure.h:162
Class used to access individual fields of database query result.
Definition: Field.h:56
std::string subject
Definition: AchievementMgr.h:256
uint32 getMSTime()
Definition: Timer.h:24
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
uint32 titleId[2]
Definition: AchievementMgr.h:253
#define sObjectMgr
Definition: ObjectMgr.h:1567
DBCStorage< CharTitlesEntry > sCharTitlesStore(CharTitlesfmt)
DB2Storage< MailTemplateEntry > sMailTemplateStore("MailTemplate.db2", MailTemplateFormat, HOTFIX_SEL_MAIL_TEMPLATE)
AchievementEntry const * GetAchievement(uint32 achievementId) const
Definition: AchievementMgr.cpp:3358
Definition: DB2Structure.h:27
uint32_t uint32
Definition: Define.h:150
uint32 itemId
Definition: AchievementMgr.h:254
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
int32 Faction
Definition: DB2Structure.h:30
std::string text
Definition: AchievementMgr.h:257
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
Definition: DBCEnums.h:78
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
AchievementRewards _achievementRewards
Definition: AchievementMgr.h:497
std::string GetString() const
Definition: Field.h:276
Definition: AchievementMgr.h:251

+ Here is the call graph for this function:

void AchievementGlobalMgr::OnInstanceDestroyed ( uint32  instanceId)
3382 {
3383  for (auto& realmCompletion : _allCompletedAchievements)
3384  if (realmCompletion.second == instanceId)
3385  realmCompletion.second = uint32(0xFFFFFFFF);
3386 }
AllCompletedAchievements _allCompletedAchievements
Definition: AchievementMgr.h:495
uint32_t uint32
Definition: g3dmath.h:168
void AchievementGlobalMgr::SetRealmCompleted ( AchievementEntry const achievement,
uint32  instanceId 
)
inline
429  {
430  if (IsRealmCompleted(achievement, instanceId))
431  return;
432 
433  _allCompletedAchievements[achievement->ID] = instanceId;
434  }
AllCompletedAchievements _allCompletedAchievements
Definition: AchievementMgr.h:495
bool IsRealmCompleted(AchievementEntry const *achievement, uint32 instanceId) const
Definition: AchievementMgr.h:416
template<typename Func >
void AchievementGlobalMgr::WalkCriteriaTree ( AchievementCriteriaTree const tree,
Func const func 
) const
inline
456  {
457  for (AchievementCriteriaTree const* node : tree->Children)
458  WalkCriteriaTree(node, func);
459 
460  func(tree);
461  }
Definition: AchievementMgr.h:62
std::vector< AchievementCriteriaTree const * > Children
Definition: AchievementMgr.h:68
void WalkCriteriaTree(AchievementCriteriaTree const *tree, Func const &func) const
Definition: AchievementMgr.h:455

Member Data Documentation

AchievementCriteriaMap AchievementGlobalMgr::_achievementCriteria
private
AchievementCriteriaList AchievementGlobalMgr::_achievementCriteriasByTimedType[ACHIEVEMENT_TIMED_TYPE_MAX]
private
AchievementCriteriaList AchievementGlobalMgr::_achievementCriteriasByType[ACHIEVEMENT_CRITERIA_TYPE_TOTAL]
private
AchievementCriteriaTreeByCriteriaMap AchievementGlobalMgr::_achievementCriteriaTreeByCriteria
private
AchievementCriteriaTreeMap AchievementGlobalMgr::_achievementCriteriaTrees
private
AchievementListByReferencedId AchievementGlobalMgr::_achievementListByReferencedId
private
AchievementRewardLocales AchievementGlobalMgr::_achievementRewardLocales
private
AchievementRewards AchievementGlobalMgr::_achievementRewards
private
AllCompletedAchievements AchievementGlobalMgr::_allCompletedAchievements
private
AchievementCriteriaDataMap AchievementGlobalMgr::_criteriaDataMap
private
ModifierTreeMap AchievementGlobalMgr::_criteriaModifiers
private
AchievementCriteriaList AchievementGlobalMgr::_guildAchievementCriteriasByType[ACHIEVEMENT_CRITERIA_TYPE_TOTAL]
private

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