Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,10 @@ faction auction house.
how full the market is, so it keeps a background of listings even when many players are
online (without it, player auctions count toward the total and the SQL max values must be
raised a lot).
- `MinItems` / `MaxItems` bound the total number of auctions; `DuplicatesCount` caps
duplicate stacks of a single item (per-item overrides can raise or lower this).
- `MaxItems` bounds the total number of auctions the bots keep listed; `DuplicatesCount`
caps duplicate stacks of a single item (per-item overrides can raise or lower this).
Both come from the conf file - the `minitems` / `maxitems` columns that used to live in
`mod_auctionhousebot` were never read and have been dropped.

### Item filtering

Expand Down
1 change: 0 additions & 1 deletion conf/mod_ahbot.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ AuctionHouseBot.ConsiderOnlyBotAuctions = 0
AuctionHouseBot.DuplicatesCount = 0
AuctionHouseBot.DivisibleStacks = 0
AuctionHouseBot.ElapsingTimeClass = 1
AuctionHouseBot.MinItems = 10000
AuctionHouseBot.MaxItems = 15000
AuctionHouseBot.MaxStackSize = 20

Expand Down
41 changes: 41 additions & 0 deletions data/sql/db-world/z_2026_08_24_00_drop_minitems_maxitems.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
--
-- Drop the unused minitems / maxitems columns from mod_auctionhousebot.
--
-- The module stopped reading them a long time ago: InitializeFromSql() had both
-- SELECTs commented out, so the seller took its ceiling from AuctionHouseBot.MaxItems
-- in the conf file only, while the columns kept being written by ".ahbotoptions
-- minitems/maxitems" and never read back. Editing them looked like it worked and did
-- nothing.
--
-- Guarded so the file is safe to run twice and works on both MySQL and MariaDB
-- (MySQL has no DROP COLUMN IF EXISTS). The z_ prefix keeps it sorted after
-- mod_auctionhousebot.sql, which still creates the columns on a fresh install.
--

SET @columnExists := (
SELECT COUNT(*) FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = 'mod_auctionhousebot'
AND COLUMN_NAME = 'minitems');

SET @statement := IF(@columnExists > 0,
'ALTER TABLE `mod_auctionhousebot` DROP COLUMN `minitems`',
'DO 0');

PREPARE dropMinItems FROM @statement;
EXECUTE dropMinItems;
DEALLOCATE PREPARE dropMinItems;

SET @columnExists := (
SELECT COUNT(*) FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = 'mod_auctionhousebot'
AND COLUMN_NAME = 'maxitems');

SET @statement := IF(@columnExists > 0,
'ALTER TABLE `mod_auctionhousebot` DROP COLUMN `maxitems`',
'DO 0');

PREPARE dropMaxItems FROM @statement;
EXECUTE dropMaxItems;
DEALLOCATE PREPARE dropMaxItems;
15 changes: 2 additions & 13 deletions src/AuctionHouseBot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1670,24 +1670,13 @@ void AuctionHouseBot::Commands(AHBotCommand command, uint32 ahMapID, uint32 col,

break;
}
case AHBotCommand::minitems:
{
char * param1 = strtok(args, " ");
uint32 minItems = (uint32) strtoul(param1, NULL, 0);

WorldDatabase.Execute("UPDATE mod_auctionhousebot SET minitems = '{}' WHERE auctionhouse = '{}'", minItems, ahMapID);

config->SetMinItems(minItems);

break;
}
case AHBotCommand::maxitems:
{
char * param1 = strtok(args, " ");
uint32 maxItems = (uint32) strtoul(param1, NULL, 0);

WorldDatabase.Execute("UPDATE mod_auctionhousebot SET maxitems = '{}' WHERE auctionhouse = '{}'", maxItems, ahMapID);

// Runtime only: the seller reads its ceiling from AuctionHouseBot.MaxItems,
// so this lasts until the next restart and is not persisted anywhere.
config->SetMaxItems(maxItems);
config->CalculatePercents();
break;
Expand Down
1 change: 0 additions & 1 deletion src/AuctionHouseBotCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ enum class AHBotCommand : uint32
useMarketPrice,

ahexpire,
minitems,
maxitems,
percentages,
minprice,
Expand Down
29 changes: 0 additions & 29 deletions src/AuctionHouseBotConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ AHBConfig::AHBConfig(uint32 ahid, AHBConfig* conf)
// Copy the private values
//

minItems = conf->minItems;
maxItems = conf->maxItems;
percentGreyTradeGoods = conf->percentGreyTradeGoods;
percentWhiteTradeGoods = conf->percentWhiteTradeGoods;
Expand Down Expand Up @@ -392,7 +391,6 @@ void AHBConfig::Reset()
AHID = 0;
AHFID = 0;

minItems = 0;
maxItems = 0;

percentGreyTradeGoods = 0;
Expand Down Expand Up @@ -620,27 +618,6 @@ uint32 AHBConfig::GetMaxStackSize()
return maxStackSize;
}

void AHBConfig::SetMinItems(uint32 value)
{
minItems = value;
}

uint32 AHBConfig::GetMinItems()
{
if ((minItems == 0) && (maxItems))
{
return maxItems;
}
else if ((maxItems) && (minItems > maxItems))
{
return maxItems;
}
else
{
return minItems;
}
}

void AHBConfig::SetMaxItems(uint32 value)
{
maxItems = value;
Expand Down Expand Up @@ -2073,7 +2050,6 @@ void AHBConfig::InitializeFromFile()
ElapsingTimeClass = sConfigMgr->GetOption<uint32>("AuctionHouseBot.ElapsingTimeClass" , 1);
ConsiderOnlyBotAuctions = sConfigMgr->GetOption<bool> ("AuctionHouseBot.ConsiderOnlyBotAuctions", false);
ItemsPerCycle = sConfigMgr->GetOption<uint32>("AuctionHouseBot.ItemsPerCycle" , 200);
minItems = sConfigMgr->GetOption<uint32>("AuctionHouseBot.MinItems" , 1000);
maxItems = sConfigMgr->GetOption<uint32>("AuctionHouseBot.MaxItems" , 5000);
maxStackSize = sConfigMgr->GetOption<uint32>("AuctionHouseBot.MaxStackSize", 20);

Expand Down Expand Up @@ -2211,10 +2187,6 @@ void AHBConfig::InitializeFromFile()

void AHBConfig::InitializeFromSql(std::set<uint32> botsIds)
{
// Load min and max items
//SetMinItems(WorldDatabase.Query("SELECT minitems FROM mod_auctionhousebot WHERE auctionhouse = {}", GetAHID())->Fetch()->Get<uint32>());
//SetMaxItems(WorldDatabase.Query("SELECT maxitems FROM mod_auctionhousebot WHERE auctionhouse = {}", GetAHID())->Fetch()->Get<uint32>());

// Load percentages, min/max prices, min/max bid prices, and max stacks in a single query
QueryResult databaseValuesResult = WorldDatabase.Query(
"SELECT "
Expand Down Expand Up @@ -2306,7 +2278,6 @@ void AHBConfig::InitializeFromSql(std::set<uint32> botsIds)
{
LOG_INFO("module", "Settings for Auctionhouse {}", GetAHID());

//LOG_INFO("module", "minItems = {}", GetMinItems());
//LOG_INFO("module", "maxItems = {}", GetMaxItems());

LOG_INFO("module", "percentGreyTradeGoods = {}", greytg);
Expand Down
4 changes: 0 additions & 4 deletions src/AuctionHouseBotConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class AHBConfig
uint32 AHID; // Id
uint32 AHFID; // Faction id

uint32 minItems;
uint32 maxItems;
uint32 maxStackSize;

Expand Down Expand Up @@ -350,9 +349,6 @@ class AHBConfig
uint32 GetAHID();
uint32 GetAHFID();

uint32 GetMinItems();
void SetMinItems(uint32 value);

uint32 GetMaxItems();
void SetMaxItems(uint32 value);

Expand Down
18 changes: 1 addition & 17 deletions src/cs_ah_bot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,7 @@ class ah_bot_commandscript : public CommandScript
handler->PSendSysMessage("seller - enable/disabler seller");
handler->PSendSysMessage("usemarketprice - enable/disabler selling at market price");
handler->PSendSysMessage("ahexpire - remove all bot auctions");
handler->PSendSysMessage("minitems - set min auctions");
handler->PSendSysMessage("maxitems - set max auctions");
handler->PSendSysMessage("maxitems - set max auctions (until restart)");
handler->PSendSysMessage("percentages - set selling percentages");
handler->PSendSysMessage("minprice - set min price");
handler->PSendSysMessage("maxprice - set max price");
Expand All @@ -237,21 +236,6 @@ class ah_bot_commandscript : public CommandScript
bot->Commands(AHBotCommand::ahexpire, ahMapID, 0, NULL);
}
}
else if (strncmp(opt, "minitems", l) == 0)
{
char* param1 = strtok(NULL, " ");

if (!ahMapIdStr || !param1)
{
handler->PSendSysMessage("Syntax is: ahbotoptions minitems $ahMapID (2, 6 or 7) $minItems");
return false;
}

for (AuctionHouseBot* bot : gBots)
{
bot->Commands(AHBotCommand::minitems, ahMapID, 0, param1);
}
}
else if (strncmp(opt, "maxitems", l) == 0)
{
char* param1 = strtok(NULL, " ");
Expand Down
Loading