@@ -213,12 +213,12 @@ void AuctionHouseBot::Buy(Player* AHBplayer, AHBConfig* config, WorldSession* se
213213 //
214214
215215 AuctionHouseObject* auctionHouseObject = sAuctionMgr ->GetAuctionsMap (config->GetAHFID ());
216- std::vector <uint32> auctionsGuidsToConsider;
216+ std::set <uint32> auctionsGuidsToConsider;
217217
218218 do
219219 {
220220 uint32 autionGuid = ahContentQueryResult->Fetch ()->Get <uint32>();
221- auctionsGuidsToConsider.push_back (autionGuid);
221+ auctionsGuidsToConsider.insert (autionGuid);
222222 } while (ahContentQueryResult->NextRow ());
223223
224224 //
@@ -244,29 +244,21 @@ void AuctionHouseBot::Buy(Player* AHBplayer, AHBConfig* config, WorldSession* se
244244 LOG_INFO (" module" , " AHBot [{}]: Considering {} auctions per interval to bid on." , _id, config->GetBidsPerInterval ());
245245 }
246246
247- for (
248- uint32 count = 1 ;
249- count <= config->GetBidsPerInterval () && !auctionsGuidsToConsider.empty ();
250- ++count
251- ) {
252- //
253- // Choose a random auction from possible auctions
254- //
255-
256- uint32 randomIndex = urand (0 , auctionsGuidsToConsider.size () - 1 );
257-
258- std::vector<uint32>::iterator itBegin = auctionsGuidsToConsider.begin ();
259- // std::advance(it, randomIndex);
260-
261- uint32 auctionID = auctionsGuidsToConsider.at (randomIndex);
247+ for (uint32 count = 1 ; count <= config->GetBidsPerInterval (); ++count)
248+ {
249+ if (auctionsGuidsToConsider.empty ()) {
250+ return ;
251+ }
262252
253+ std::set<uint32>::iterator it = auctionsGuidsToConsider.begin ();
254+ std::advance (it, 0 );
255+ uint32 auctionID = *it;
263256 AuctionEntry* auction = auctionHouseObject->GetAuction (auctionID);
264-
257+
265258 //
266259 // Prevent to bid again on the same auction
267260 //
268-
269- auctionsGuidsToConsider.erase (itBegin + randomIndex);
261+ auctionsGuidsToConsider.erase (it);
270262
271263 if (!auction)
272264 {
@@ -312,14 +304,15 @@ void AuctionHouseBot::Buy(Player* AHBplayer, AHBConfig* config, WorldSession* se
312304 //
313305 // Determine current price.
314306 //
315- uint32 currentPrice = auction->bid ? auction->bid : auction->startbid ;
307+
308+ uint32 currentPrice = static_cast <uint32>(auction->bid ? auction->bid : auction->startbid );
316309
317310 //
318311 // Determine maximum bid and skip auctions with too high a currentPrice.
319312 //
320313
321- double basePrice = config->UseBuyPriceForBuyer ? prototype->BuyPrice : prototype->SellPrice ;
322- double maximumBid = basePrice * pItem->GetCount () * config->GetBuyerPrice (prototype->Quality );
314+ uint32 basePrice = static_cast <uint32>( config->UseBuyPriceForBuyer ? prototype->BuyPrice : prototype->SellPrice ) ;
315+ uint32 maximumBid = static_cast <uint32>( basePrice * pItem->GetCount () * config->GetBuyerPrice (prototype->Quality ) );
323316
324317 if (config->TraceBuyer )
325318 {
@@ -406,7 +399,7 @@ void AuctionHouseBot::Buy(Player* AHBplayer, AHBConfig* config, WorldSession* se
406399 uint32 minimumOutbid = auction->GetAuctionOutBid ();
407400 if ((currentPrice + minimumOutbid) > bidPrice)
408401 {
409- bidPrice = currentPrice + minimumOutbid;
402+ bidPrice = static_cast <uint32>( currentPrice + minimumOutbid) ;
410403 }
411404
412405 if (bidPrice > maximumBid)
@@ -415,7 +408,7 @@ void AuctionHouseBot::Buy(Player* AHBplayer, AHBConfig* config, WorldSession* se
415408 {
416409 LOG_INFO (" module" , " AHBot [{}]: Bid was above bidMax for item={} AH={}" , _id, auction->item_guid .ToString (), config->GetAHID ());
417410 }
418- bidPrice = maximumBid;
411+ bidPrice = static_cast <uint32>( maximumBid) ;
419412 }
420413
421414 if (config->DebugOutBuyer )
0 commit comments