From 626d1c25277c6e0febbc10d95fd99f532dfe08b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E4=BD=A9=E8=8C=B9?= Date: Fri, 25 Mar 2022 10:35:00 -0600 Subject: [PATCH] Correctly use character not account ID when retrieving items --- src/ReagentBank.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ReagentBank.cpp b/src/ReagentBank.cpp index e579fda..bd04721 100644 --- a/src/ReagentBank.cpp +++ b/src/ReagentBank.cpp @@ -47,8 +47,8 @@ private: // This query can be changed to async to improve performance, but there will be some visual bugs because the query will not be done executing when the menu refreshes WorldSession *session = player->GetSession(); - std::string query = "SELECT amount FROM custom_reagent_bank WHERE character_id = " + std::to_string(player->GetSession()->GetAccountId()) + " AND item_entry = " + std::to_string(entry); - QueryResult result = CharacterDatabase.Query("SELECT amount FROM custom_reagent_bank WHERE character_id = " + std::to_string(player->GetSession()->GetAccountId()) + " AND item_entry = " + std::to_string(entry)); + std::string query = "SELECT amount FROM custom_reagent_bank WHERE character_id = " + std::to_string(player->GetGUID().GetCounter()) + " AND item_entry = " + std::to_string(entry); + QueryResult result = CharacterDatabase.Query("SELECT amount FROM custom_reagent_bank WHERE character_id = " + std::to_string(player->GetGUID().GetCounter()) + " AND item_entry = " + std::to_string(entry)); if (result) { uint32 storedAmount = (*result)[0].Get(); @@ -225,7 +225,7 @@ public: void ShowReagentItems(Player* player, Creature* creature, uint32 item_subclass, uint16 gossipPageNumber) { WorldSession* session = player->GetSession(); - std::string query = "SELECT item_entry, amount FROM custom_reagent_bank WHERE character_id = " + std::to_string(player->GetSession()->GetAccountId()) + " AND item_subclass = " + + std::string query = "SELECT item_entry, amount FROM custom_reagent_bank WHERE character_id = " + std::to_string(player->GetGUID().GetCounter()) + " AND item_subclass = " + std::to_string(item_subclass) + " ORDER BY item_entry"; session->GetQueryProcessor().AddCallback(CharacterDatabase.AsyncQuery(query).WithCallback([=](QueryResult result) {