41 bool activeHouse =
false;
158 TC_LOG_DEBUG(
"ahbot",
"AHBot: {} items added to buyable/biddable vector for ah type: {}", count, config.
GetHouseType());
172 if (
uint32 itemSellPrice = item->
GetSellPrice(item->
GetTemplate(), item->
GetQuality(), item->
GetItemLevel(item->
GetTemplate(), *item->
GetBonus(), 0, 0, 0, 0, 0,
false, 0)))
173 itemPrice = float(itemSellPrice);
186 chance = chance / 5.f;
196 chance *= 1.f / std::sqrt(itemBuyPrice / avgBuyPrice);
202 float rand =
frand(0.f, 100.f);
203 bool win = rand <= chance;
204 TC_LOG_DEBUG(
"ahbot",
"AHBot: {} BUY! chance = {:.2f}, price = {}, buyprice = {}.", win ?
"WIN" :
"LOSE", chance,
uint32(itemPrice),
uint32(itemBuyPrice));
215 float itemBidPrice = float(bidPrice);
217 if (
uint32 itemSellPrice = item->
GetSellPrice(item->
GetTemplate(), item->
GetQuality(), item->
GetItemLevel(item->
GetTemplate(), *item->
GetBonus(), 0, 0, 0, 0, 0,
false, 0)))
218 itemPrice = float(itemSellPrice);
237 chance *= 1.f / std::sqrt(itemBidPrice / avgBidPrice);
242 chance = chance / 5.f;
247 float rand =
frand(0.f, 100.f);
248 bool win = rand <= chance;
249 TC_LOG_DEBUG(
"ahbot",
"AHBot: {} BID! chance = {:.2f}, price = {}, bidprice = {}.", win ?
"WIN" :
"LOSE", chance,
uint32(itemPrice),
uint32(itemBidPrice));
262 if (itr->second.LastExist < now)
284 TC_LOG_DEBUG(
"ahbot",
"AHBot: Boost value used for Buyer! (if this happens often adjust both ItemsPerCycle in worldserver.conf)");
288 CheckEntryMap::iterator itr = items.begin();
289 while (cycles && itr != items.end())
294 TC_LOG_DEBUG(
"ahbot",
"AHBot: Entry {} doesn't exists, perhaps bought already?", itr->second.AuctionId);
301 if (itr->second.LastChecked && (now - itr->second.LastChecked) <=
_checkInterval)
303 TC_LOG_DEBUG(
"ahbot",
"AHBot: In time interval wait for entry {}!", auction->
Id);
318 bidPrice = auction->
MinBid;
324 ahInfo = &sameItemItr->second;
326 TC_LOG_DEBUG(
"ahbot",
"AHBot: Rolling for AHentry {}:", auction->
Id);
338 (successBuy && (!successBid ||
urand(1, 5) == 1)))
343 itr->second.LastChecked = now;
412 auction->
Bidder = newBidder;
432 TC_LOG_DEBUG(
"ahbot",
"AHBot: Bid placed to entry {}, {:.2f}g", auction->
Id,
float(bidPrice) /
float(
GOLD));
443 auction->
Bidder = newBidder;
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
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]
void BuyEntry(AuctionPosting *auction, AuctionHouseObject *auctionHouse)
bool RollBuyChance(BuyerItemInfo const *ahInfo, AuctionPosting const *auction)
void PlaceBidToEntry(AuctionPosting *auction, AuctionHouseObject *auctionHouse, uint32 bidPrice)
bool RollBidChance(BuyerItemInfo const *ahInfo, AuctionPosting const *auction, uint32 bidPrice)
uint32 GetItemInformation(BuyerConfiguration &config)
bool Initialize() override
bool Update(AuctionHouseType houseType) override
uint32 GetVendorPrice(uint32 quality)
void LoadBuyerValues(BuyerConfiguration &config)
static char const * GetHouseTypeName(AuctionHouseType houseType)
std::map< uint32, AuctionPosting >::iterator GetAuctionsEnd()
void SendAuctionWon(AuctionPosting const *auction, Player *bidder, CharacterDatabaseTransaction trans) const
AuctionPosting * GetAuction(uint32 auctionId)
void SendAuctionSold(AuctionPosting const *auction, Player *owner, CharacterDatabaseTransaction trans) const
std::map< uint32, AuctionPosting >::iterator GetAuctionsBegin()
void RemoveAuction(CharacterDatabaseTransaction trans, AuctionPosting *auction, std::map< uint32, AuctionPosting >::iterator *auctionItr=nullptr)
void SendAuctionOutbid(AuctionPosting const *auction, ObjectGuid newBidder, uint64 newBidAmount, CharacterDatabaseTransaction trans) const
constexpr std::underlying_type_t< T > AsUnderlyingType() const
uint32 GetQuality() const
ItemTemplate const * GetTemplate() const
BonusData const * GetBonus() const
uint32 GetItemLevel(Player const *owner) const
uint32 GetSellPrice(Player const *owner) const
LowType GetCounter() const
void setUInt8(const uint8 index, const uint8 value)
void setUInt32(const uint8 index, const uint32 value)
void setUInt64(const uint8 index, const uint64 value)
std::vector< Item * > Items
AuctionsBucketData * Bucket
static uint64 CalculateMinIncrement(uint64 bidAmount)
EnumFlag< AuctionPostingServerFlag > ServerFlags
BuyerItemInfoMap SameItemInfo
CheckEntryMap EligibleItems
AuctionHouseType GetHouseType() const
uint32 GetQuality() const