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
14 changes: 14 additions & 0 deletions src/AuctionHouseBot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,15 @@ std::vector<uint32> AuctionHouseBot::GetItemsToSell(AHBConfig* config, ObjectGui

for (const auto& [itemID, _] : config->itemPriceOverrides)
{
// A price override row is a price, not a permission to sell: the item still
// has to have passed the filters in InitializeBins(). Without this, anything
// with an override slipped past the bind, class, level, disabled item and
// whitelist filters - which is how BoP gear reached the auction house.
if (!config->IsSellableItem(itemID))
{
continue;
}

if (missingStacks(itemID) == 0)
{
continue;
Expand All @@ -1359,6 +1368,11 @@ std::vector<uint32> AuctionHouseBot::GetItemsToSell(AHBConfig* config, ObjectGui
std::vector<uint32> itemsWithOverrides;
for (const auto& [itemID, _] : config->itemPriceOverrides)
{
if (!config->IsSellableItem(itemID))
{
continue;
}

itemsWithOverrides.push_back(itemID);
}
std::shuffle(itemsWithOverrides.begin(), itemsWithOverrides.end(), std::mt19937(std::random_device()()));
Expand Down
15 changes: 15 additions & 0 deletions src/AuctionHouseBotConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,12 @@ AHBConfig::AHBConfig(uint32 ahid, AHBConfig* conf)
{
YellowItemsBin.insert(id);
}

SellableItems.clear();
for (uint32 id: conf->SellableItems)
{
SellableItems.insert(id);
}
}

AHBConfig::~AHBConfig()
Expand Down Expand Up @@ -600,6 +606,8 @@ void AHBConfig::Reset()
OrangeItemsBin.clear();
YellowItemsBin.clear();

SellableItems.clear();

itemsCount.clear();
itemsSum.clear();
itemsPrice.clear();
Expand Down Expand Up @@ -3362,6 +3370,8 @@ void AHBConfig::InitializeBins()
// Now that the items passed all the tests, organize it by quality
//

SellableItems.insert(itr->second.ItemId);

if (itr->second.Class == ITEM_CLASS_TRADE_GOODS)
{
switch (itr->second.Quality)
Expand Down Expand Up @@ -3623,6 +3633,11 @@ void AHBConfig::LoadCountOverrides()
LOG_INFO("module", "AHBConfig: Loaded {} count overrides from mod_auctionhousebot_countOverride", itemCountOverrides.size());
}

bool AHBConfig::IsSellableItem(uint32 itemId) const
{
return SellableItems.find(itemId) != SellableItems.end();
}

uint32 AHBConfig::GetCountOverrideForItem(uint32 itemId) const
{
auto it = itemCountOverrides.find(itemId);
Expand Down
5 changes: 5 additions & 0 deletions src/AuctionHouseBotConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,10 @@ class AHBConfig
std::set<uint32> OrangeItemsBin;
std::set<uint32> YellowItemsBin;

// Every item that passed the filters in InitializeBins(), i.e. the union of
// all the bins above. Lets the price override path reuse the filter verdict.
std::set<uint32> SellableItems;

// Vectors for items
std::vector<uint32> GreyItemsVec;
std::vector<uint32> WhiteItemsVec;
Expand Down Expand Up @@ -398,6 +402,7 @@ class AHBConfig
uint64 GetItemPrice(uint32 id);

void LoadPriceOverrides();
bool IsSellableItem(uint32 itemId) const;
void LoadCountOverrides();

void LoadBotGUIDs();
Expand Down
Loading