From 9ac769ac6bdd2fa083711f6d94f78ea682a0e7e7 Mon Sep 17 00:00:00 2001 From: whipowill Date: Wed, 18 May 2022 09:27:24 -0500 Subject: [PATCH 1/7] Fix GetOptionBool depricated warning. --- .gitignore | 1 + src/mod_achievements.cpp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e6639a7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +reset.sh \ No newline at end of file diff --git a/src/mod_achievements.cpp b/src/mod_achievements.cpp index 19154ff..6ca8a19 100644 --- a/src/mod_achievements.cpp +++ b/src/mod_achievements.cpp @@ -27,9 +27,9 @@ public: void OnLogin(Player* pPlayer) { - if (sConfigMgr->GetBoolDefault("Account.Achievements.Enable", true)) + if (sConfigMgr->GetOption("Account.Achievements.Enable", true)) { - if (sConfigMgr->GetBoolDefault("Account.Achievements.Announce", true)) + if (sConfigMgr->GetOption("Account.Achievements.Announce", true)) { ChatHandler(pPlayer->GetSession()).SendSysMessage("This server is running the |cff4CFF00AccountAchievements |rmodule."); } @@ -74,7 +74,7 @@ public: void AddAchievements(Player* player, uint32 AchievementID) { - if (sConfigMgr->GetBoolDefault("Account.Achievements.Enable", true)) + if (sConfigMgr->GetOption("Account.Achievements.Enable", true)) { if (limitlevel) setlevel = minlevel; From 21d3397b03fbbdb6db459bd61360a9295f5d00a4 Mon Sep 17 00:00:00 2001 From: whipowill Date: Wed, 18 May 2022 09:34:34 -0500 Subject: [PATCH 2/7] Change method PQuery to Query. --- src/mod_achievements.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod_achievements.cpp b/src/mod_achievements.cpp index 6ca8a19..2ea6edf 100644 --- a/src/mod_achievements.cpp +++ b/src/mod_achievements.cpp @@ -35,7 +35,7 @@ public: } std::vector Guids; - QueryResult result1 = CharacterDatabase.PQuery("SELECT guid, race FROM characters WHERE account = %u", pPlayer->GetSession()->GetAccountId()); + QueryResult result1 = CharacterDatabase.Query("SELECT guid, race FROM characters WHERE account = %u", pPlayer->GetSession()->GetAccountId()); if (!result1) return; @@ -54,7 +54,7 @@ public: for (auto& i : Guids) { - QueryResult result2 = CharacterDatabase.PQuery("SELECT achievement FROM character_achievement WHERE guid = %u", i); + QueryResult result2 = CharacterDatabase.Query("SELECT achievement FROM character_achievement WHERE guid = %u", i); if (!result2) continue; From ca1d726256c972169a752caddb12d53b76b840da Mon Sep 17 00:00:00 2001 From: whipowill Date: Wed, 18 May 2022 11:04:05 -0500 Subject: [PATCH 3/7] Second attempt to fix PQuery issue. --- src/mod_achievements.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mod_achievements.cpp b/src/mod_achievements.cpp index 2ea6edf..5193f4b 100644 --- a/src/mod_achievements.cpp +++ b/src/mod_achievements.cpp @@ -13,7 +13,7 @@ #include "ScriptMgr.h" #include "Chat.h" #include "Player.h" - +#include "DatabaseEnv.h" class AccountAchievements : public PlayerScript { @@ -35,7 +35,7 @@ public: } std::vector Guids; - QueryResult result1 = CharacterDatabase.Query("SELECT guid, race FROM characters WHERE account = %u", pPlayer->GetSession()->GetAccountId()); + QueryResult result1 = CharacterDatabase.PQuery("SELECT guid, race FROM characters WHERE account = %u", pPlayer->GetSession()->GetAccountId()); if (!result1) return; @@ -54,7 +54,7 @@ public: for (auto& i : Guids) { - QueryResult result2 = CharacterDatabase.Query("SELECT achievement FROM character_achievement WHERE guid = %u", i); + QueryResult result2 = CharacterDatabase.PQuery("SELECT achievement FROM character_achievement WHERE guid = %u", i); if (!result2) continue; From 516e8d48cb6210d9ab0bd690b32a50fd584e213d Mon Sep 17 00:00:00 2001 From: whipowill Date: Wed, 18 May 2022 11:11:11 -0500 Subject: [PATCH 4/7] Back to first attempt to fix PQuery issue. --- src/mod_achievements.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/mod_achievements.cpp b/src/mod_achievements.cpp index 5193f4b..8001c67 100644 --- a/src/mod_achievements.cpp +++ b/src/mod_achievements.cpp @@ -13,7 +13,6 @@ #include "ScriptMgr.h" #include "Chat.h" #include "Player.h" -#include "DatabaseEnv.h" class AccountAchievements : public PlayerScript { @@ -35,7 +34,7 @@ public: } std::vector Guids; - QueryResult result1 = CharacterDatabase.PQuery("SELECT guid, race FROM characters WHERE account = %u", pPlayer->GetSession()->GetAccountId()); + QueryResult result1 = CharacterDatabase.Query("SELECT guid, race FROM characters WHERE account = %u", pPlayer->GetSession()->GetAccountId()); if (!result1) return; @@ -54,7 +53,7 @@ public: for (auto& i : Guids) { - QueryResult result2 = CharacterDatabase.PQuery("SELECT achievement FROM character_achievement WHERE guid = %u", i); + QueryResult result2 = CharacterDatabase.Query("SELECT achievement FROM character_achievement WHERE guid = %u", i); if (!result2) continue; From 12c90267e0200bd3eb672344a4efe87f87b9d3ae Mon Sep 17 00:00:00 2001 From: whipowill Date: Wed, 18 May 2022 11:34:28 -0500 Subject: [PATCH 5/7] Fix GetUInt8 to Get. --- src/mod_achievements.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod_achievements.cpp b/src/mod_achievements.cpp index 8001c67..763dab6 100644 --- a/src/mod_achievements.cpp +++ b/src/mod_achievements.cpp @@ -42,7 +42,7 @@ public: { Field* fields = result1->Fetch(); - uint32 race = fields[1].GetUInt8(); + uint32 race = fields[1].Get(); if ((Player::TeamIdForRace(race) == Player::TeamIdForRace(pPlayer->getRace())) || !limitrace) Guids.push_back(result1->Fetch()[0].GetUInt32()); From 89e7ee170208e03d8c0afa5c6bd8de18faa736b2 Mon Sep 17 00:00:00 2001 From: whipowill Date: Wed, 18 May 2022 11:36:37 -0500 Subject: [PATCH 6/7] Fix GetUInt32 to Get. --- src/mod_achievements.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod_achievements.cpp b/src/mod_achievements.cpp index 763dab6..e37e08c 100644 --- a/src/mod_achievements.cpp +++ b/src/mod_achievements.cpp @@ -45,7 +45,7 @@ public: uint32 race = fields[1].Get(); if ((Player::TeamIdForRace(race) == Player::TeamIdForRace(pPlayer->getRace())) || !limitrace) - Guids.push_back(result1->Fetch()[0].GetUInt32()); + Guids.push_back(result1->Fetch()[0].Get()); } while (result1->NextRow()); @@ -59,7 +59,7 @@ public: do { - Achievement.push_back(result2->Fetch()[0].GetUInt32()); + Achievement.push_back(result2->Fetch()[0].Get()); } while (result2->NextRow()); } From eed962ff657a72d90bc4b91c11fb2aa2a826ce1e Mon Sep 17 00:00:00 2001 From: whipowill Date: Thu, 19 May 2022 08:33:48 -0500 Subject: [PATCH 7/7] Fix query. --- src/mod_achievements.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod_achievements.cpp b/src/mod_achievements.cpp index e37e08c..813911b 100644 --- a/src/mod_achievements.cpp +++ b/src/mod_achievements.cpp @@ -34,7 +34,7 @@ public: } std::vector Guids; - QueryResult result1 = CharacterDatabase.Query("SELECT guid, race FROM characters WHERE account = %u", pPlayer->GetSession()->GetAccountId()); + QueryResult result1 = CharacterDatabase.Query("SELECT guid, race FROM characters WHERE account = {}", pPlayer->GetSession()->GetAccountId()); if (!result1) return; @@ -53,7 +53,7 @@ public: for (auto& i : Guids) { - QueryResult result2 = CharacterDatabase.Query("SELECT achievement FROM character_achievement WHERE guid = %u", i); + QueryResult result2 = CharacterDatabase.Query("SELECT achievement FROM character_achievement WHERE guid = {}", i); if (!result2) continue;