*Use correct indent for aubot.
--HG-- branch : trunk
This commit is contained in:
@@ -504,27 +504,20 @@ static void addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *config, World
|
||||
}
|
||||
|
||||
uint32 bids = config->GetBidsPerInterval();
|
||||
for (uint32 count = 1;count <= bids;count++)
|
||||
for (uint32 count = 0; count < bids; ++count)
|
||||
{
|
||||
|
||||
// Do we have anything to bid? If not, stop here.
|
||||
if(possibleBids.empty())
|
||||
{
|
||||
count = bids + 1;
|
||||
return;
|
||||
}
|
||||
|
||||
// Choose random auction from possible auctions
|
||||
uint32 vectorPos = urand(0, possibleBids.size() - 1);
|
||||
uint32 auctionID = possibleBids[vectorPos];
|
||||
|
||||
// Erase the auction from the vector to prevent bidding on item in next itteration.
|
||||
vector<uint32>::iterator iter = possibleBids.begin();
|
||||
advance(iter, vectorPos);
|
||||
possibleBids.erase(iter);
|
||||
|
||||
// from auctionhousehandler.cpp, creates auction pointer & player pointer
|
||||
AuctionEntry* auction = auctionHouse->GetAuction(auctionID);
|
||||
AuctionEntry* auction = auctionHouse->GetAuction(*iter);
|
||||
// Erase the auction from the vector to prevent bidding on item in next itteration.
|
||||
possibleBids.erase(iter);
|
||||
|
||||
// get exact item information
|
||||
Item *pItem = auctionmgr.GetAItem(auction->item_guidlow);
|
||||
@@ -546,6 +539,7 @@ static void addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *config, World
|
||||
sLog.outError("Sell Price: %u", prototype->SellPrice);
|
||||
sLog.outError("Quality: %u", prototype->Quality);
|
||||
}
|
||||
|
||||
uint32 currentprice;
|
||||
if(auction->bid)
|
||||
{
|
||||
@@ -559,129 +553,104 @@ static void addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *config, World
|
||||
if(debug_Out)
|
||||
{sLog.outError("Current Price: %u", auction->startbid);}
|
||||
}
|
||||
uint32 bidprice;
|
||||
|
||||
// Prepare portion from maximum bid
|
||||
uint32 tmprate2 = urand(0, 100);
|
||||
double tmprate = static_cast<double>(tmprate2);
|
||||
if(debug_Out)
|
||||
{sLog.outError("tmprate: %f", tmprate);}
|
||||
double bidrate = tmprate / 100;
|
||||
if(debug_Out)
|
||||
{sLog.outError("bidrate: %f", bidrate);}
|
||||
long double bidMax = 0;
|
||||
if(debug_Out)
|
||||
{
|
||||
sLog.outError("tmprate: %f", tmprate);
|
||||
sLog.outError("bidrate: %f", bidrate);
|
||||
}
|
||||
|
||||
// check that bid has acceptable value and take bid based on vendorprice, stacksize and quality
|
||||
switch (BuyMethod)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
switch (prototype->Quality)
|
||||
{
|
||||
case 0:
|
||||
if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREY))
|
||||
{
|
||||
bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREY);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_WHITE))
|
||||
{
|
||||
bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_WHITE);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREEN))
|
||||
{
|
||||
bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREEN);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_BLUE))
|
||||
{
|
||||
bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_BLUE);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_PURPLE))
|
||||
{
|
||||
bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_PURPLE);
|
||||
}
|
||||
case 5:
|
||||
if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_ORANGE))
|
||||
{
|
||||
bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_ORANGE);
|
||||
}
|
||||
case 6:
|
||||
if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_YELLOW))
|
||||
{
|
||||
bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_YELLOW);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// quality is something it shouldn't be, let's get out of here
|
||||
if(debug_Out)
|
||||
{sLog.outError("bidMax(fail): %f", bidMax);}
|
||||
sLog.outError("bidMax(fail): %f", bidMax);
|
||||
return;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
switch (prototype->Quality)
|
||||
{
|
||||
case 0:
|
||||
if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREY))
|
||||
{
|
||||
bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREY);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_WHITE))
|
||||
{
|
||||
bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_WHITE);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREEN))
|
||||
{
|
||||
bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREEN);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_BLUE))
|
||||
{
|
||||
bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_BLUE);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_PURPLE))
|
||||
{
|
||||
bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_PURPLE);
|
||||
}
|
||||
case 5:
|
||||
if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_ORANGE))
|
||||
{
|
||||
bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_ORANGE);
|
||||
}
|
||||
case 6:
|
||||
if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_YELLOW))
|
||||
{
|
||||
bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_YELLOW);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// quality is something it shouldn't be, let's get out of here
|
||||
if(debug_Out)
|
||||
{sLog.outError("bidMax(fail): %f", bidMax);}
|
||||
sLog.outError("bidMax(fail): %f", bidMax);
|
||||
return;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
bidMax = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if(debug_Out)
|
||||
{sLog.outError("bidMax(succeed): %f", bidMax);}
|
||||
sLog.outError("bidMax(succeed): %f", bidMax);
|
||||
|
||||
// check some special items, and do recalculating to their prices
|
||||
switch (prototype->Class)
|
||||
@@ -702,19 +671,20 @@ static void addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *config, World
|
||||
|
||||
// Calculate our bid
|
||||
long double bidvalue = currentprice + ( (bidMax - currentprice) * bidrate);
|
||||
if(debug_Out)
|
||||
{sLog.outError("bidvalue: %f", bidvalue);}
|
||||
// Convert to uint32
|
||||
bidprice = static_cast<uint32>(bidvalue);
|
||||
uint32 bidprice = static_cast<uint32>(bidvalue);
|
||||
if(debug_Out)
|
||||
{sLog.outError("bidprice: %u", bidprice);}
|
||||
{
|
||||
sLog.outError("bidprice: %u", bidprice);
|
||||
sLog.outError("bidvalue: %f", bidvalue);
|
||||
}
|
||||
|
||||
// Check our bid is high enough to be valid. If not, correct it to minimum.
|
||||
if((currentprice + auction->GetAuctionOutBid()) > bidprice)
|
||||
{
|
||||
bidprice = currentprice + auction->GetAuctionOutBid();
|
||||
if(debug_Out)
|
||||
{sLog.outError("bidprice(>): %u", bidprice);}
|
||||
sLog.outError("bidprice(>): %u", bidprice);
|
||||
}
|
||||
|
||||
// Check wether we do normal bid, or buyout
|
||||
|
||||
Reference in New Issue
Block a user