2705{
2707
2709
2710 QueryResult result =
WorldDatabase.Query(
"SELECT criteria_id, type, value1, value2, ScriptName FROM achievement_criteria_data");
2711
2712 if (!result)
2713 {
2714 LOG_WARN(
"server.loading",
">> Loaded 0 additional achievement criteria data. DB table `achievement_criteria_data` is empty.");
2716 return;
2717 }
2718
2720
2721 do
2722 {
2723 Field* fields = result->Fetch();
2725
2727
2728 if (!criteria)
2729 {
2730 LOG_ERROR(
"sql.sql",
"Table `achievement_criteria_data` has data for non-existing criteria (Entry: {}), ignore.", criteria_id);
2731 continue;
2732 }
2733
2735 std::string scriptName = fields[4].
Get<std::string>();
2737 if (scriptName.length())
2738 {
2740 LOG_ERROR(
"sql.sql",
"Table `achievement_criteria_data` has ScriptName set for non-scripted data type (Entry: {}, type {}), useless data.", criteria_id, dataType);
2741 else
2742 scriptId =
sObjectMgr->GetScriptId(scriptName);
2743 }
2744
2746
2747 if (!data.IsValid(criteria))
2748 continue;
2749
2750
2753
2754
2757
2758
2759 ++count;
2760 } while (result->NextRow());
2761
2762
2764 {
2766 if (!criteria)
2767 continue;
2768
2770 {
2788
2789 break;
2791 {
2793 if (!achievement)
2794 continue;
2795
2796
2797 if (achievement->
ID == 1282)
2798 break;
2799
2800 continue;
2801 }
2804 continue;
2805 break;
2808 continue;
2809 break;
2812 continue;
2813 break;
2816 continue;
2817 break;
2820 {
2822 if (!achievement)
2823 continue;
2825 continue;
2826 break;
2827 }
2828 default:
2829 continue;
2830 }
2831
2833 LOG_ERROR(
"sql.sql",
"Table `achievement_criteria_data` does not have expected data for criteria (Entry: {} Type: {}) for achievement {}.", criteria->
ID, criteria->
requiredType, criteria->
referredAchievement);
2834 }
2835
2836 LOG_INFO(
"server.loading",
">> Loaded {} additional achievement criteria data in {} ms", count,
GetMSTimeDiffToNow(oldMSTime));
2838}
std::uint8_t uint8
Definition: Define.h:110
std::uint32_t uint32
Definition: Define.h:108
#define LOG_INFO(filterType__,...)
Definition: Log.h:165
#define LOG_ERROR(filterType__,...)
Definition: Log.h:157
#define LOG_WARN(filterType__,...)
Definition: Log.h:161
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:131
uint32 getMSTime()
Definition: Timer.h:103
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
std::shared_ptr< ResultSet > QueryResult
Definition: DatabaseEnvFwd.h:28
@ ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT
Definition: AchievementMgr.h:57
@ ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE
Definition: AchievementMgr.h:46
@ DISABLE_TYPE_ACHIEVEMENT_CRITERIA
Definition: DisableMgr.h:33
DBCStorage< AchievementCriteriaEntry > sAchievementCriteriaStore(AchievementCriteriafmt)
#define sObjectMgr
Definition: ObjectMgr.h:1640
@ ACHIEVEMENT_CRITERIA_CONDITION_NO_LOSE
Definition: DBCEnums.h:99
@ ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE
Definition: DBCEnums.h:224
@ ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2
Definition: DBCEnums.h:189
@ ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM
Definition: DBCEnums.h:163
@ ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET
Definition: DBCEnums.h:150
@ ACHIEVEMENT_CRITERIA_TYPE_FALL_WITHOUT_DYING
Definition: DBCEnums.h:147
@ ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL
Definition: DBCEnums.h:151
@ ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST
Definition: DBCEnums.h:139
@ ACHIEVEMENT_CRITERIA_TYPE_OWN_RANK
Definition: DBCEnums.h:166
@ ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT
Definition: DBCEnums.h:173
@ ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE
Definition: DBCEnums.h:176
@ ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE_TYPE
Definition: DBCEnums.h:196
@ ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL
Definition: DBCEnums.h:157
@ ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2
Definition: DBCEnums.h:225
@ ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST
Definition: DBCEnums.h:149
@ ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA
Definition: DBCEnums.h:159
@ ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM
Definition: DBCEnums.h:171
@ ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE
Definition: DBCEnums.h:130
@ ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL
Definition: DBCEnums.h:194
@ ACHIEVEMENT_CRITERIA_TYPE_WIN_BG
Definition: DBCEnums.h:131
@ ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL
Definition: DBCEnums.h:190
@ ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE
Definition: DBCEnums.h:152
@ ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS
Definition: DBCEnums.h:178
@ ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT
Definition: DBCEnums.h:172
@ ACHIEVEMENT_CRITERIA_TYPE_ON_LOGIN
Definition: DBCEnums.h:192
@ CATEGORY_CHILDRENS_WEEK
Definition: DBCEnums.h:237
bool IsDisabledFor(DisableType type, uint32 entry, Unit const *unit, uint8 flags)
Definition: DisableMgr.cpp:306
Class used to access individual fields of database query result.
Definition: Field.h:99
std::enable_if_t< std::is_arithmetic_v< T >, T > Get() const
Definition: Field.h:113
Definition: AchievementMgr.h:85
Definition: AchievementMgr.h:233
void Add(AchievementCriteriaData const &data)
Definition: AchievementMgr.h:236
void SetCriteriaId(uint32 id)
Definition: AchievementMgr.h:238
AchievementCriteriaDataSet const * GetCriteriaDataSet(AchievementCriteriaEntry const *achievementCriteria) const
Definition: AchievementMgr.h:383
Definition: DBCStructure.h:40
uint32 categoryId
Definition: DBCStructure.h:49
uint32 ID
Definition: DBCStructure.h:41
Definition: DBCStructure.h:70
struct AchievementCriteriaEntry::@301::@361 loot_type
uint32 lootTypeCount
Definition: DBCStructure.h:471
uint32 count
Definition: DBCStructure.h:223
struct AchievementCriteriaEntry::@301::@346 do_emote
uint32 duelCount
Definition: DBCStructure.h:440
struct AchievementCriteriaEntry::@303 additionalRequirements[MAX_CRITERIA_REQUIREMENTS]
uint32 ID
Definition: DBCStructure.h:71
uint32 requiredType
Definition: DBCStructure.h:73
uint32 additionalRequirement_type
Definition: DBCStructure.h:503
uint32 referredAchievement
Definition: DBCStructure.h:72
struct AchievementCriteriaEntry::@301::@356 win_duel