From 2a6d228f8683cf0116afbbc9cbddf50e79e83cbd Mon Sep 17 00:00:00 2001 From: zeb <37308742+zeb139@users.noreply.github.com> Date: Sat, 4 Oct 2025 14:48:54 -0400 Subject: [PATCH 1/6] added chat commands for GMs --- src/AuctionHouseBot.cpp | 23 ++++++++++++++++ src/AuctionHouseBot.h | 1 + src/AuctionHouseBotScript.cpp | 51 +++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+) diff --git a/src/AuctionHouseBot.cpp b/src/AuctionHouseBot.cpp index dceef71..948234a 100644 --- a/src/AuctionHouseBot.cpp +++ b/src/AuctionHouseBot.cpp @@ -1584,6 +1584,29 @@ void AuctionHouseBot::InitializeConfiguration() NeutralConfig.SetMaxItems(sConfigMgr->GetOption("AuctionHouseBot.Neutral.MaxItems", 15000)); } +void AuctionHouseBot::EmptyAuctionHouses() +{ + vector configs = { AllianceConfig, HordeConfig, NeutralConfig }; + auto trans = CharacterDatabase.BeginTransaction(); + + for (FactionSpecificAuctionHouseConfig config : configs) { + AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(config.GetAHFID()); + auto auctionEntryMap = auctionHouse->GetAuctions(); + for (auto itr = auctionEntryMap.begin(); itr != auctionEntryMap.end();) + { + AuctionEntry* auction = itr->second; + + auction->DeleteFromDB(trans); + sAuctionMgr->RemoveAItem(auction->item_guid); + auctionHouse->RemoveAuction(auction); + + itr = auctionEntryMap.erase(itr); + } + } + + CharacterDatabase.CommitTransaction(trans); +} + uint32 AuctionHouseBot::GetRandomStackValue(std::string configKeyString, uint32 defaultValue) { uint32 stackValue = sConfigMgr->GetOption(configKeyString, defaultValue); diff --git a/src/AuctionHouseBot.h b/src/AuctionHouseBot.h index bd4d2fa..f5d6569 100644 --- a/src/AuctionHouseBot.h +++ b/src/AuctionHouseBot.h @@ -298,6 +298,7 @@ public: void Update(); void InitializeConfiguration(); + void EmptyAuctionHouses(); uint32 GetRandomStackValue(std::string configKeyString, uint32 defaultValue); uint32 GetRandomStackIncrementValue(std::string configKeyString, uint32 defaultValue); void SetCyclesBetweenBuyOrSell(); diff --git a/src/AuctionHouseBotScript.cpp b/src/AuctionHouseBotScript.cpp index 1abe11c..52ba983 100644 --- a/src/AuctionHouseBotScript.cpp +++ b/src/AuctionHouseBotScript.cpp @@ -2,6 +2,7 @@ * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 */ +#include "Chat.h" #include "ScriptMgr.h" #include "AuctionHouseBot.h" #include "Log.h" @@ -118,9 +119,59 @@ public: } }; +class AHBot_CommandScript : public CommandScript +{ +public: + AHBot_CommandScript() : CommandScript("AHBot_CommandScript") { } + + Acore::ChatCommands::ChatCommandTable GetCommands() const override + { + static Acore::ChatCommands::ChatCommandTable AHBotCommandTable = { + {"update", HandleAHBotUpdateCommand, SEC_GAMEMASTER, Acore::ChatCommands::Console::Yes}, + {"reload", HandleAHBotReloadCommand, SEC_GAMEMASTER, Acore::ChatCommands::Console::Yes}, + {"empty", HandleAHBotEmptyCommand, SEC_GAMEMASTER, Acore::ChatCommands::Console::Yes} + }; + + static Acore::ChatCommands::ChatCommandTable commandTable = { + {"ahbot", AHBotCommandTable}, + }; + + return commandTable; + } + + static bool HandleAHBotUpdateCommand(ChatHandler* handler, const char* /*args*/) + { + LOG_INFO("module", "AuctionHouseBot: Updating Auction House..."); + handler->PSendSysMessage("AuctionHouseBot: Updating Auction House..."); + AuctionHouseBot::instance()->Update(); + return true; + } + + static bool HandleAHBotReloadCommand(ChatHandler* handler, char const* /*args*/) + { + LOG_INFO("module", "AuctionHouseBot: Reloading Config..."); + handler->PSendSysMessage("AuctionHouseBot: Reloading Config..."); + + // Reload config file with isReload = true + sConfigMgr->LoadModulesConfigs(true, false); + AuctionHouseBot::instance()->InitializeConfiguration(); + AuctionHouseBot::instance()->PopulateItemCandidatesAndProportions(); + return true; + } + + static bool HandleAHBotEmptyCommand(ChatHandler* handler, char const* /*args*/) + { + LOG_INFO("module", "AuctionHouseBot: Emptying Auction House..."); + handler->PSendSysMessage("AuctionHouseBot: Emptying Auction House..."); + AuctionHouseBot::instance()->EmptyAuctionHouses(); + return true; + } +}; + void AddAHBotScripts() { new AHBot_WorldScript(); new AHBot_AuctionHouseScript(); new AHBot_MailScript(); + new AHBot_CommandScript(); } From 762f53f180e0fde7eee34f3760462e34cc1d882a Mon Sep 17 00:00:00 2001 From: zeb <37308742+zeb139@users.noreply.github.com> Date: Sat, 4 Oct 2025 15:21:44 -0400 Subject: [PATCH 2/6] added chat commands documentation --- README.md | 13 ++++++++++++- conf/mod_ahbot.conf.dist | 9 +++++++++ src/AuctionHouseBotScript.cpp | 12 +++++++++++- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7e0c981..bb77226 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,18 @@ Notes: - Important! By default, most player crafted items (except glyphs, bolts, maybe a few other things) are disabled from showing up in the auction house in order to encourage player crafting on lower pop servers. If you want different behavior, alter the config variable "AuctionHouseBot.DisabledCraftedItemIDs" by deleting IDs you wish to show up. Note that fish are also disabled to encourage fishing, and that's also managed by disabled lists. - It takes a few hours for the auction house to fully populate, as only 75 items gets added by default every 'tick'. You can change this in the config with the AuctionHouseBot.ItemsPerCycle variable. - All price multpliers (along with the advanced pricing, see config) are applied multiplicative. Example: A Category of 1.5x, Quality of 2x, and CategoryQuality of 1.4x would make the multiplier 4.2 (1.5 x 2 x 1.4). The advanced pricing would then multiply that value further. Using item level price multpliers, which create a multiplier of itemlevel x value, is also multiplicitive along with the others. You cannot use item level price multipliers and advanced pricing, as advanced pricing will take priority between the two. -- Bot-listed prices will not exceed 100k gold buyout +- Bot-listed prices will not exceed 100k gold buyout + +### In-Game Commands + +The AuctionHouseBot module adds the following in-game commands (for GMs only): + +| Command | Description | +|----------|--------------| +| `.ahbot reload` | Reloads the AuctionHouseBot configuration file and updates settings. | +| `.ahbot empty` | Removes all auctions from all auction houses. Use with caution! | +| `.ahbot update` | Forces the bot to refresh or repopulate auction listings immediately.
Note: If you have multiple minutes configured between Buy/Sell cycles, you may have to run this additional times before you see results. | + ## Buying Bot Behavior diff --git a/conf/mod_ahbot.conf.dist b/conf/mod_ahbot.conf.dist index 591f820..3376b4c 100644 --- a/conf/mod_ahbot.conf.dist +++ b/conf/mod_ahbot.conf.dist @@ -1,5 +1,14 @@ [worldserver] +################################################################################################### +# AUCTION HOUSE BOT IN-GAME COMMANDS +# +# Available GM commands: +# .ahbot reload - Reloads AuctionHouseBot configuration +# .ahbot empty - Clears all auctions from all auction houses +# .ahbot update - Forces an immediate update cycle +################################################################################################### + ############################################################################### # AUCTION HOUSE BOT SETTINGS # AuctionHouseBot.DEBUG diff --git a/src/AuctionHouseBotScript.cpp b/src/AuctionHouseBotScript.cpp index 52ba983..139fae5 100644 --- a/src/AuctionHouseBotScript.cpp +++ b/src/AuctionHouseBotScript.cpp @@ -129,7 +129,8 @@ public: static Acore::ChatCommands::ChatCommandTable AHBotCommandTable = { {"update", HandleAHBotUpdateCommand, SEC_GAMEMASTER, Acore::ChatCommands::Console::Yes}, {"reload", HandleAHBotReloadCommand, SEC_GAMEMASTER, Acore::ChatCommands::Console::Yes}, - {"empty", HandleAHBotEmptyCommand, SEC_GAMEMASTER, Acore::ChatCommands::Console::Yes} + {"empty", HandleAHBotEmptyCommand, SEC_GAMEMASTER, Acore::ChatCommands::Console::Yes}, + {"help", HandleAHBotHelpCommand, SEC_GAMEMASTER, Acore::ChatCommands::Console::Yes} }; static Acore::ChatCommands::ChatCommandTable commandTable = { @@ -166,6 +167,15 @@ public: AuctionHouseBot::instance()->EmptyAuctionHouses(); return true; } + + static bool HandleAHBotHelpCommand(ChatHandler* handler, char const* /*args*/) + { + handler->PSendSysMessage("AuctionHouseBot commands:"); + handler->PSendSysMessage(" .ahbot reload - Reloads configuration"); + handler->PSendSysMessage(" .ahbot empty - Removes all auctions"); + handler->PSendSysMessage(" .ahbot update - Runs an update cycle"); + return true; + } }; void AddAHBotScripts() From a22f866e490a64bddfef45620d463a644afe2dbb Mon Sep 17 00:00:00 2001 From: zeb <37308742+zeb139@users.noreply.github.com> Date: Sat, 4 Oct 2025 23:49:22 -0400 Subject: [PATCH 3/6] .ahbot empty respects player auctions and returns bids on cancelled items --- src/AuctionHouseBot.cpp | 100 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 90 insertions(+), 10 deletions(-) diff --git a/src/AuctionHouseBot.cpp b/src/AuctionHouseBot.cpp index 948234a..60a03bb 100644 --- a/src/AuctionHouseBot.cpp +++ b/src/AuctionHouseBot.cpp @@ -1587,20 +1587,100 @@ void AuctionHouseBot::InitializeConfiguration() void AuctionHouseBot::EmptyAuctionHouses() { vector configs = { AllianceConfig, HordeConfig, NeutralConfig }; + vector ahBotActiveAuctions; + + // Get all auctions owned by AHBots which have no bidders + std::string queryString = "SELECT id FROM auctionhouse WHERE itemowner IN ({}) AND buyguid = 0"; + QueryResult result = CharacterDatabase.Query(queryString, AHCharactersGUIDsForQuery); + auto trans = CharacterDatabase.BeginTransaction(); - - for (FactionSpecificAuctionHouseConfig config : configs) { - AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(config.GetAHFID()); - auto auctionEntryMap = auctionHouse->GetAuctions(); - for (auto itr = auctionEntryMap.begin(); itr != auctionEntryMap.end();) + if (result && result->GetRowCount() > 0) + { + do { - AuctionEntry* auction = itr->second; + uint32 tmpdata = result->Fetch()->Get(); + ahBotActiveAuctions.push_back(tmpdata); + } while (result->NextRow()); - auction->DeleteFromDB(trans); - sAuctionMgr->RemoveAItem(auction->item_guid); - auctionHouse->RemoveAuction(auction); + // Remove bidder-less AHBot items from the AHs + for (FactionSpecificAuctionHouseConfig config : configs) { + AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(config.GetAHFID()); + for (uint32 auctionID : ahBotActiveAuctions) + { + vector::iterator iter = ahBotActiveAuctions.begin(); + AuctionEntry* auction = auctionHouse->GetAuction(*iter); + ahBotActiveAuctions.erase(iter); - itr = auctionEntryMap.erase(itr); + auction->DeleteFromDB(trans); + sAuctionMgr->RemoveAItem(auction->item_guid); + auctionHouse->RemoveAuction(auction); + } + } + } + + // Get auctions owned by AHBots which DO have a bidder, return their deposits + std::vector> auctionsToRefund; + std::string refundQueryString = "SELECT id, buyguid FROM auctionhouse WHERE itemowner IN ({}) AND buyguid != 0"; + QueryResult refundResult = CharacterDatabase.Query(refundQueryString, AHCharactersGUIDsForQuery); + if (refundResult && refundResult->GetRowCount() > 0) + { + do + { + Field* fields = refundResult->Fetch(); + uint32 auctionID = fields[0].Get(); + uint32 buyGUID = fields[1].Get(); + auctionsToRefund.push_back({auctionID, buyGUID}); + } while (refundResult->NextRow()); + + // Remove AHBot items with bidders from the AHs + for (FactionSpecificAuctionHouseConfig config : configs) { + AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(config.GetAHFID()); + for (std::pair p : auctionsToRefund) + { + uint32 auctionID = p.first; + uint32 buyGUID = p.second; + + // Lookup accountID and accountName associated with bidder character + std::string accountIDQueryString = "SELECT account FROM characters WHERE guid = {}"; + std::string accountNameQueryString = "SELECT username FROM acore_auth.account WHERE id = {}"; + QueryResult accountIDQueryResult = CharacterDatabase.Query(accountIDQueryString, buyGUID); + + if (!accountIDQueryResult) + continue; + + uint32 bidderAccountID = accountIDQueryResult->Fetch()->Get(); + QueryResult accountNameQueryResult = LoginDatabase.Query(accountNameQueryString, bidderAccountID); + + if (!accountNameQueryResult) + continue; + + std::string bidderAccountName = accountNameQueryResult->Fetch()->Get(); + + // Load Player information, and issue refund + auto session = std::make_unique( + bidderAccountID, std::move(bidderAccountName), 0, nullptr, + SEC_PLAYER, sWorld->getIntConfig(CONFIG_EXPANSION), 0, LOCALE_enUS, 0, false, false, 0 + ); + auto player = std::make_unique(session.get()); + if (!player) + continue; + player->Initialize(buyGUID); + + auto iter = auctionsToRefund.begin(); + AuctionEntry* auction = auctionHouse->GetAuction(iter->first); + if (!auction) + continue; + + uint32 auctionCut = auction->GetAuctionCut(); + sAuctionMgr->SendAuctionCancelledToBidderMail(auction, trans); + player->ModifyMoney(-int32(auctionCut)); // ModifyMoney() already handles negative check + + // Remove item from the AH + auctionsToRefund.erase(iter); + auction->DeleteFromDB(trans); + sAuctionMgr->RemoveAItem(auction->item_guid); + auctionHouse->RemoveAuction(auction); + } } } From 499b0702d37eb2c0199e609748458f1c572f1ce4 Mon Sep 17 00:00:00 2001 From: zeb <37308742+zeb139@users.noreply.github.com> Date: Sat, 4 Oct 2025 23:52:58 -0400 Subject: [PATCH 4/6] updated .ahbot empty documentation --- README.md | 2 +- conf/mod_ahbot.conf.dist | 2 +- src/AuctionHouseBotScript.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bb77226..4c8bf93 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ The AuctionHouseBot module adds the following in-game commands (for GMs only): | Command | Description | |----------|--------------| | `.ahbot reload` | Reloads the AuctionHouseBot configuration file and updates settings. | -| `.ahbot empty` | Removes all auctions from all auction houses. Use with caution! | +| `.ahbot empty` | Removes all AuctionHouseBot auctions from all auction houses.
Player auctions are unaffected. Bids on affected items are returned to players.
Use with caution! | | `.ahbot update` | Forces the bot to refresh or repopulate auction listings immediately.
Note: If you have multiple minutes configured between Buy/Sell cycles, you may have to run this additional times before you see results. | diff --git a/conf/mod_ahbot.conf.dist b/conf/mod_ahbot.conf.dist index 3376b4c..be9fd08 100644 --- a/conf/mod_ahbot.conf.dist +++ b/conf/mod_ahbot.conf.dist @@ -5,7 +5,7 @@ # # Available GM commands: # .ahbot reload - Reloads AuctionHouseBot configuration -# .ahbot empty - Clears all auctions from all auction houses +# .ahbot empty - Clears all AuctionHouseBot auctions from all auction houses # .ahbot update - Forces an immediate update cycle ################################################################################################### diff --git a/src/AuctionHouseBotScript.cpp b/src/AuctionHouseBotScript.cpp index 139fae5..02297f7 100644 --- a/src/AuctionHouseBotScript.cpp +++ b/src/AuctionHouseBotScript.cpp @@ -172,7 +172,7 @@ public: { handler->PSendSysMessage("AuctionHouseBot commands:"); handler->PSendSysMessage(" .ahbot reload - Reloads configuration"); - handler->PSendSysMessage(" .ahbot empty - Removes all auctions"); + handler->PSendSysMessage(" .ahbot empty - Removes all AuctionHouseBot auctions"); handler->PSendSysMessage(" .ahbot update - Runs an update cycle"); return true; } From f058948243fd7196b7f5885620b7ef329c026920 Mon Sep 17 00:00:00 2001 From: zeb <37308742+zeb139@users.noreply.github.com> Date: Sun, 5 Oct 2025 12:19:47 -0400 Subject: [PATCH 5/6] simplified EmptyAuctionHouses() logic --- src/AuctionHouseBot.cpp | 120 +++++++++++++++++++--------------------- 1 file changed, 56 insertions(+), 64 deletions(-) diff --git a/src/AuctionHouseBot.cpp b/src/AuctionHouseBot.cpp index 60a03bb..855ac41 100644 --- a/src/AuctionHouseBot.cpp +++ b/src/AuctionHouseBot.cpp @@ -1586,101 +1586,93 @@ void AuctionHouseBot::InitializeConfiguration() void AuctionHouseBot::EmptyAuctionHouses() { - vector configs = { AllianceConfig, HordeConfig, NeutralConfig }; - vector ahBotActiveAuctions; - - // Get all auctions owned by AHBots which have no bidders - std::string queryString = "SELECT id FROM auctionhouse WHERE itemowner IN ({}) AND buyguid = 0"; - QueryResult result = CharacterDatabase.Query(queryString, AHCharactersGUIDsForQuery); - + struct AuctionInfo { + uint32 itemID {0}; + uint32 characterGUID {0}; + uint32 houseID {0}; + }; + vector ahBotActiveAuctions; auto trans = CharacterDatabase.BeginTransaction(); - if (result && result->GetRowCount() > 0) + + // Get all auctions owned by AHBots + std::string queryString = "SELECT id, buyguid, houseid FROM auctionhouse WHERE itemowner IN ({})"; + QueryResult result = CharacterDatabase.Query(queryString, AHCharactersGUIDsForQuery); + if (!result) + return; + + if (result->GetRowCount() > 0) { + // Load results into vector for lookups later do { - uint32 tmpdata = result->Fetch()->Get(); - ahBotActiveAuctions.push_back(tmpdata); + Field* fields = result->Fetch(); + AuctionInfo ai = { + fields[0].Get(), + fields[1].Get(), + fields[2].Get() + }; + ahBotActiveAuctions.push_back(ai); } while (result->NextRow()); - // Remove bidder-less AHBot items from the AHs - for (FactionSpecificAuctionHouseConfig config : configs) { - AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(config.GetAHFID()); - for (uint32 auctionID : ahBotActiveAuctions) - { - vector::iterator iter = ahBotActiveAuctions.begin(); - AuctionEntry* auction = auctionHouse->GetAuction(*iter); - ahBotActiveAuctions.erase(iter); - - auction->DeleteFromDB(trans); - sAuctionMgr->RemoveAItem(auction->item_guid); - auctionHouse->RemoveAuction(auction); - } - } - } - - // Get auctions owned by AHBots which DO have a bidder, return their deposits - std::vector> auctionsToRefund; - std::string refundQueryString = "SELECT id, buyguid FROM auctionhouse WHERE itemowner IN ({}) AND buyguid != 0"; - QueryResult refundResult = CharacterDatabase.Query(refundQueryString, AHCharactersGUIDsForQuery); - if (refundResult && refundResult->GetRowCount() > 0) - { - do + // For each auction, refund bidder where possible, delete entry from AH + AuctionHouseObject* auctionHouse; + for (auto iter = ahBotActiveAuctions.begin(); iter != ahBotActiveAuctions.end(); ++iter) { - Field* fields = refundResult->Fetch(); - uint32 auctionID = fields[0].Get(); - uint32 buyGUID = fields[1].Get(); - auctionsToRefund.push_back({auctionID, buyGUID}); - } while (refundResult->NextRow()); + AuctionInfo& ai = *iter; - // Remove AHBot items with bidders from the AHs - for (FactionSpecificAuctionHouseConfig config : configs) { - AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(config.GetAHFID()); - for (std::pair p : auctionsToRefund) + // Get Auction House and Auction references + auctionHouse = nullptr; + switch (ai.houseID) { + case 2: auctionHouse = sAuctionMgr->GetAuctionsMap(AllianceConfig.GetAHFID()); break; + case 6: auctionHouse = sAuctionMgr->GetAuctionsMap(HordeConfig.GetAHFID()); break; + case 7: auctionHouse = sAuctionMgr->GetAuctionsMap(NeutralConfig.GetAHFID()); break; + } + if (auctionHouse == nullptr) + continue; + + AuctionEntry* auction = auctionHouse->GetAuction(ai.itemID); + if (!auction) + continue; + + // If auction has a bidder, refund that character + if (ai.characterGUID != 0) { - uint32 auctionID = p.first; - uint32 buyGUID = p.second; - // Lookup accountID and accountName associated with bidder character - std::string accountIDQueryString = "SELECT account FROM characters WHERE guid = {}"; - std::string accountNameQueryString = "SELECT username FROM acore_auth.account WHERE id = {}"; - QueryResult accountIDQueryResult = CharacterDatabase.Query(accountIDQueryString, buyGUID); + std::string accountIDQueryString = "SELECT account FROM characters WHERE guid = {}"; + std::string accountNameQueryString = "SELECT username FROM account WHERE id = {}"; + QueryResult accountIDQueryResult = CharacterDatabase.Query(accountIDQueryString, ai.characterGUID); if (!accountIDQueryResult) continue; - uint32 bidderAccountID = accountIDQueryResult->Fetch()->Get(); - QueryResult accountNameQueryResult = LoginDatabase.Query(accountNameQueryString, bidderAccountID); + uint32 bidderAccountID = (*accountIDQueryResult)[0].Get(); + QueryResult accountNameQueryResult = LoginDatabase.Query(accountNameQueryString, bidderAccountID); if (!accountNameQueryResult) continue; - std::string bidderAccountName = accountNameQueryResult->Fetch()->Get(); + std::string bidderAccountName = (*accountNameQueryResult)[0].Get(); // Load Player information, and issue refund auto session = std::make_unique( bidderAccountID, std::move(bidderAccountName), 0, nullptr, SEC_PLAYER, sWorld->getIntConfig(CONFIG_EXPANSION), 0, LOCALE_enUS, 0, false, false, 0 ); + auto player = std::make_unique(session.get()); if (!player) continue; - player->Initialize(buyGUID); - auto iter = auctionsToRefund.begin(); - AuctionEntry* auction = auctionHouse->GetAuction(iter->first); - if (!auction) - continue; + player->Initialize(ai.characterGUID); - uint32 auctionCut = auction->GetAuctionCut(); sAuctionMgr->SendAuctionCancelledToBidderMail(auction, trans); - player->ModifyMoney(-int32(auctionCut)); // ModifyMoney() already handles negative check - - // Remove item from the AH - auctionsToRefund.erase(iter); - auction->DeleteFromDB(trans); - sAuctionMgr->RemoveAItem(auction->item_guid); - auctionHouse->RemoveAuction(auction); + player->ModifyMoney(-int32(auction->GetAuctionCut())); // ModifyMoney() already handles negative check } + + // Remove item from AH + auction->DeleteFromDB(trans); + sAuctionMgr->RemoveAItem(auction->item_guid); + auctionHouse->RemoveAuction(auction); } } From 642c596c1ab6577a31673b0f1f54acb4b7289b85 Mon Sep 17 00:00:00 2001 From: zeb <37308742+zeb139@users.noreply.github.com> Date: Sun, 5 Oct 2025 15:11:17 -0400 Subject: [PATCH 6/6] removed unnecessary code --- src/AuctionHouseBot.cpp | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/src/AuctionHouseBot.cpp b/src/AuctionHouseBot.cpp index 855ac41..83c2f8c 100644 --- a/src/AuctionHouseBot.cpp +++ b/src/AuctionHouseBot.cpp @@ -1636,38 +1636,7 @@ void AuctionHouseBot::EmptyAuctionHouses() // If auction has a bidder, refund that character if (ai.characterGUID != 0) - { - // Lookup accountID and accountName associated with bidder character - std::string accountIDQueryString = "SELECT account FROM characters WHERE guid = {}"; - std::string accountNameQueryString = "SELECT username FROM account WHERE id = {}"; - - QueryResult accountIDQueryResult = CharacterDatabase.Query(accountIDQueryString, ai.characterGUID); - if (!accountIDQueryResult) - continue; - - uint32 bidderAccountID = (*accountIDQueryResult)[0].Get(); - - QueryResult accountNameQueryResult = LoginDatabase.Query(accountNameQueryString, bidderAccountID); - if (!accountNameQueryResult) - continue; - - std::string bidderAccountName = (*accountNameQueryResult)[0].Get(); - - // Load Player information, and issue refund - auto session = std::make_unique( - bidderAccountID, std::move(bidderAccountName), 0, nullptr, - SEC_PLAYER, sWorld->getIntConfig(CONFIG_EXPANSION), 0, LOCALE_enUS, 0, false, false, 0 - ); - - auto player = std::make_unique(session.get()); - if (!player) - continue; - - player->Initialize(ai.characterGUID); - sAuctionMgr->SendAuctionCancelledToBidderMail(auction, trans); - player->ModifyMoney(-int32(auction->GetAuctionCut())); // ModifyMoney() already handles negative check - } // Remove item from AH auction->DeleteFromDB(trans);