41 bool activeHouse =
false;
128 itemBidPrice = std::min(itemInfo.
MinBidPrice, itemBidPrice);
156 TC_LOG_DEBUG(
"ahbot",
"AHBot: {} items added to buyable/biddable vector for ah type: {}", count, config.
GetHouseType());
178 chance = chance / 5.f;
188 chance *= 1.f / std::sqrt(itemBuyPrice / avgBuyPrice);
194 float rand =
frand(0.f, 100.f);
195 bool win = rand <= chance;
196 TC_LOG_DEBUG(
"ahbot",
"AHBot: {} BUY! chance = {:.2f}, price = {}, buyprice = {}.", win ?
"WIN" :
"LOSE", chance,
uint32(itemPrice),
uint32(itemBuyPrice));
203 float itemBidPrice = float(bidPrice / item->
GetCount());
220 chance *= 1.f / std::sqrt(itemBidPrice / avgBidPrice);
225 chance = chance / 5.f;
230 float rand =
frand(0.f, 100.f);
231 bool win = rand <= chance;
232 TC_LOG_DEBUG(
"ahbot",
"AHBot: {} BID! chance = {:.2f}, price = {}, bidprice = {}.", win ?
"WIN" :
"LOSE", chance,
uint32(itemPrice),
uint32(itemBidPrice));
245 if (itr->second.LastExist < now)
267 TC_LOG_DEBUG(
"ahbot",
"AHBot: Boost value used for Buyer! (if this happens often adjust both ItemsPerCycle in worldserver.conf)");
271 CheckEntryMap::iterator itr = items.begin();
272 while (cycles && itr != items.end())
277 TC_LOG_DEBUG(
"ahbot",
"AHBot: Entry {} doesn't exists, perhaps bought already?", itr->second.AuctionId);
284 if (itr->second.LastChecked && (now - itr->second.LastChecked) <=
_checkInterval)
286 TC_LOG_DEBUG(
"ahbot",
"AHBot: In time interval wait for entry {}!", auction->
Id);
315 ahInfo = &sameItemItr->second;
317 TC_LOG_DEBUG(
"ahbot",
"AHBot: Rolling for AHentry {}:", auction->
Id);
320 bool successBuy =
RollBuyChance(ahInfo, item, auction, bidPrice);
321 bool successBid =
RollBidChance(ahInfo, item, auction, bidPrice);
328 if ((auction->
buyout && successBid && bidPrice >= auction->
buyout) ||
329 (successBuy && (!successBid ||
urand(1, 5) == 1)))
334 itr->second.LastChecked = now;
405 sAuctionMgr->SendAuctionSalePendingMail(auction, trans);
406 sAuctionMgr->SendAuctionSuccessfulMail(auction, trans);
423 TC_LOG_DEBUG(
"ahbot",
"AHBot: Bid placed to entry {}, {:.2f}g", auction->
Id,
float(bidPrice) /
float(
GOLD));
429 sAuctionMgr->SendAuctionOutbiddedMail(auction, bidPrice,
nullptr, trans);
433 auction->
bid = bidPrice;
std::map< uint32, BuyerAuctionEval > CheckEntryMap
@ CONFIG_AHBOT_BUYER_BASEPRICE_GRAY
@ CONFIG_AHBOT_BUYER_CHANCEMULTIPLIER_GRAY
@ CONFIG_AHBOT_BUYER_CHANCEMULTIPLIER_ORANGE
@ CONFIG_AHBOT_BUYER_RECHECK_INTERVAL
@ CONFIG_AHBOT_BUYER_BASEPRICE_BLUE
@ CONFIG_AHBOT_BUYER_BASEPRICE_PURPLE
@ CONFIG_AHBOT_BUYER_BASEPRICE_YELLOW
@ CONFIG_AHBOT_BUYER_CHANCEMULTIPLIER_YELLOW
@ CONFIG_AHBOT_BUYER_BASEPRICE_ORANGE
@ CONFIG_AHBOT_BUYER_BASEPRICE_GREEN
@ CONFIG_AHBOT_BUYER_CHANCEMULTIPLIER_BLUE
@ CONFIG_AHBOT_BUYER_CHANCEMULTIPLIER_PURPLE
@ CONFIG_AHBOT_BUYER_CHANCEMULTIPLIER_WHITE
@ CONFIG_AHBOT_BUYER_CHANCEMULTIPLIER_GREEN
@ CONFIG_AHBOT_BUYER_BASEPRICE_WHITE
@ CONFIG_AHBOT_BUYER_CHANCE_FACTOR
#define MAX_AUCTION_HOUSE_TYPE
#define sAuctionBotConfig
@ AUCTION_ENTRY_FLAG_GM_LOG_BUYER
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
#define TC_LOG_DEBUG(filterType__,...)
float frand(float min, float max)
uint32 urand(uint32 min, uint32 max)
uint32 GetChanceMultiplier(uint32 quality)
void BuyAndBidItems(BuyerConfiguration &config)
void PrepareListOfEntry(BuyerConfiguration &config)
BuyerConfiguration _houseConfig[MAX_AUCTION_HOUSE_TYPE]
uint32 GetItemInformation(BuyerConfiguration &config)
bool Initialize() override
bool Update(AuctionHouseType houseType) override
bool RollBuyChance(BuyerItemInfo const *ahInfo, Item const *item, AuctionEntry const *auction, uint32 bidPrice)
bool RollBidChance(BuyerItemInfo const *ahInfo, Item const *item, AuctionEntry const *auction, uint32 bidPrice)
void PlaceBidToEntry(AuctionEntry *auction, uint32 bidPrice)
uint32 GetVendorPrice(uint32 quality)
void LoadBuyerValues(BuyerConfiguration &config)
void BuyEntry(AuctionEntry *auction, AuctionHouseObject *auctionHouse)
static char const * GetHouseTypeName(AuctionHouseType houseType)
AuctionEntry * GetAuction(uint32 id) const
AuctionEntryMap::iterator GetAuctionsEnd()
AuctionEntryMap::iterator GetAuctionsBegin()
bool RemoveAuction(AuctionEntry *auction)
ItemTemplate const * GetTemplate() const
void setUInt32(uint8 index, uint32 value)
void setUInt8(uint8 index, uint8 value)
ObjectGuid::LowType bidder
uint32 GetAuctionOutBid() const
the sum of outbid is (1% from current bid)*5, if bid is very small, it is 1c
void DeleteFromDB(CharacterDatabaseTransaction trans) const
ObjectGuid::LowType owner
ObjectGuid::LowType itemGUIDLow
BuyerItemInfoMap SameItemInfo
CheckEntryMap EligibleItems
AuctionHouseType GetHouseType() const