Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
5832a36
Fix crash if auctionsGuidsToConsider.size() < config->GetBidsPerInter…
lotjib Feb 28, 2025
8b824e2
fix crash if auctionsGuidsToConsider.size() > config->GetBidsPerInter…
lotjib Feb 28, 2025
4ab26ec
FIx
lotjib Feb 28, 2025
4f65a66
Fix
lotjib Feb 28, 2025
038bcae
fix
lotjib Feb 28, 2025
1bcd754
fix crash
lotjib Feb 28, 2025
1cb4f55
fix
lotjib Feb 28, 2025
4ffa372
Fix Crash Error
lotjib Feb 28, 2025
27fb2f5
Fix
lotjib Feb 28, 2025
45e40e4
Fix Crash
lotjib Feb 28, 2025
aace71a
Fix Crash Error
lotjib Feb 28, 2025
eefe099
fix
lotjib Feb 28, 2025
0470865
Fix Crash if BuyBidsPerInterval > 1 and "FROM `acore_characters`.`auc…
lotjib Mar 1, 2025
fc520c6
Fix
lotjib Mar 1, 2025
dc03a69
Fix
lotjib Mar 1, 2025
251ea3b
Fix
lotjib Mar 1, 2025
d47ad7b
Fix
lotjib Mar 1, 2025
73d794c
Revert
lotjib Mar 1, 2025
c953b4d
Fix
lotjib Mar 1, 2025
cce768f
Fix
lotjib Mar 1, 2025
a5bc197
hello test
lotjib Mar 1, 2025
01604c1
FF
lotjib Mar 1, 2025
bb513da
FF
lotjib Mar 1, 2025
ccee062
ff
lotjib Mar 1, 2025
4b35328
Fix
lotjib Mar 1, 2025
55d2e5d
ff
lotjib Mar 1, 2025
5e01853
ff
lotjib Mar 1, 2025
bd33a4e
F
lotjib Mar 1, 2025
e37bdc1
fix
lotjib Mar 1, 2025
af31815
ff
lotjib Mar 1, 2025
305a0ae
ff
lotjib Mar 1, 2025
f92246e
Fix Crash
lotjib Mar 1, 2025
ca61e27
fix
lotjib Mar 1, 2025
d3d6ce3
f
lotjib Mar 1, 2025
588cc04
ff
lotjib Mar 1, 2025
cafa712
ff
lotjib Mar 1, 2025
1a978c1
ff
lotjib Mar 1, 2025
edeb703
ff
lotjib Mar 1, 2025
53b5132
ff
lotjib Mar 1, 2025
99fdca2
fix
lotjib Mar 1, 2025
cd191da
Merge branch 'master' into master
lotjib Apr 5, 2025
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
43 changes: 18 additions & 25 deletions src/AuctionHouseBot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,12 @@ void AuctionHouseBot::Buy(Player* AHBplayer, AHBConfig* config, WorldSession* se
//

AuctionHouseObject* auctionHouseObject = sAuctionMgr->GetAuctionsMap(config->GetAHFID());
std::vector<uint32> auctionsGuidsToConsider;
std::set<uint32> auctionsGuidsToConsider;

do
{
uint32 autionGuid = ahContentQueryResult->Fetch()->Get<uint32>();
auctionsGuidsToConsider.push_back(autionGuid);
auctionsGuidsToConsider.insert(autionGuid);
} while (ahContentQueryResult->NextRow());

//
Expand All @@ -244,29 +244,21 @@ void AuctionHouseBot::Buy(Player* AHBplayer, AHBConfig* config, WorldSession* se
LOG_INFO("module", "AHBot [{}]: Considering {} auctions per interval to bid on.", _id, config->GetBidsPerInterval());
}

for (
uint32 count = 1;
count <= config->GetBidsPerInterval() && !auctionsGuidsToConsider.empty();
++count
) {
//
// Choose a random auction from possible auctions
//

uint32 randomIndex = urand(0, auctionsGuidsToConsider.size() - 1);

std::vector<uint32>::iterator itBegin = auctionsGuidsToConsider.begin();
//std::advance(it, randomIndex);

uint32 auctionID = auctionsGuidsToConsider.at(randomIndex);
for (uint32 count = 1; count <= config->GetBidsPerInterval(); ++count)
{
if (auctionsGuidsToConsider.empty()) {
return;
}

std::set<uint32>::iterator it = auctionsGuidsToConsider.begin();
std::advance(it, 0);
uint32 auctionID = *it;
AuctionEntry* auction = auctionHouseObject->GetAuction(auctionID);

//
// Prevent to bid again on the same auction
//

auctionsGuidsToConsider.erase(itBegin + randomIndex);
auctionsGuidsToConsider.erase(it);

if (!auction)
{
Expand Down Expand Up @@ -312,14 +304,15 @@ void AuctionHouseBot::Buy(Player* AHBplayer, AHBConfig* config, WorldSession* se
//
// Determine current price.
//
uint32 currentPrice = auction->bid ? auction->bid : auction->startbid;

uint32 currentPrice = static_cast<uint32>(auction->bid ? auction->bid : auction->startbid);

//
// Determine maximum bid and skip auctions with too high a currentPrice.
//

double basePrice = config->UseBuyPriceForBuyer ? prototype->BuyPrice : prototype->SellPrice;
double maximumBid = basePrice * pItem->GetCount() * config->GetBuyerPrice(prototype->Quality);
uint32 basePrice = static_cast<uint32>(config->UseBuyPriceForBuyer ? prototype->BuyPrice : prototype->SellPrice);
uint32 maximumBid = static_cast<uint32>(basePrice * pItem->GetCount() * config->GetBuyerPrice(prototype->Quality));

if (config->TraceBuyer)
{
Expand Down Expand Up @@ -406,7 +399,7 @@ void AuctionHouseBot::Buy(Player* AHBplayer, AHBConfig* config, WorldSession* se
uint32 minimumOutbid = auction->GetAuctionOutBid();
if ((currentPrice + minimumOutbid) > bidPrice)
{
bidPrice = currentPrice + minimumOutbid;
bidPrice = static_cast<uint32>(currentPrice + minimumOutbid);
}

if (bidPrice > maximumBid)
Expand All @@ -415,7 +408,7 @@ void AuctionHouseBot::Buy(Player* AHBplayer, AHBConfig* config, WorldSession* se
{
LOG_INFO("module", "AHBot [{}]: Bid was above bidMax for item={} AH={}", _id, auction->item_guid.ToString(), config->GetAHID());
}
bidPrice = maximumBid;
bidPrice = static_cast<uint32>(maximumBid);
}

if (config->DebugOutBuyer)
Expand Down
1 change: 0 additions & 1 deletion src/AuctionHouseBot.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class AuctionHouseBot
//
// Main operations
//

void Sell(Player *AHBplayer, AHBConfig *config);
void Buy (Player *AHBplayer, AHBConfig *config, WorldSession *session);

Expand Down