aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/AuctionHouseBot
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2023-08-15 20:10:04 +0200
committerShauren <shauren.trinity@gmail.com>2023-08-15 20:10:04 +0200
commitaaa6e73c8ca6d60e943cb964605536eb78219db2 (patch)
treef5a0187925e646ef071d647efa7a5dac20501813 /src/server/game/AuctionHouseBot
parent825c697a764017349ca94ecfca8f30a8365666c0 (diff)
Core/Logging: Switch from fmt::sprintf to fmt::format (c++20 standard compatible api)
(cherry picked from commit d791afae1dfcfaf592326f787755ca32d629e4d3)
Diffstat (limited to 'src/server/game/AuctionHouseBot')
-rw-r--r--src/server/game/AuctionHouseBot/AuctionHouseBot.cpp12
-rw-r--r--src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp28
-rw-r--r--src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp22
3 files changed, 31 insertions, 31 deletions
diff --git a/src/server/game/AuctionHouseBot/AuctionHouseBot.cpp b/src/server/game/AuctionHouseBot/AuctionHouseBot.cpp
index 9af6435beb2..ca89f687380 100644
--- a/src/server/game/AuctionHouseBot/AuctionHouseBot.cpp
+++ b/src/server/game/AuctionHouseBot/AuctionHouseBot.cpp
@@ -87,10 +87,10 @@ bool AuctionBotConfig::Initialize()
} while (result->NextRow());
}
- TC_LOG_DEBUG("ahbot", "AuctionHouseBot found %u characters", count);
+ TC_LOG_DEBUG("ahbot", "AuctionHouseBot found {} characters", count);
}
else
- TC_LOG_WARN("ahbot", "AuctionHouseBot Account ID %u has no associated characters.", ahBotAccId);
+ TC_LOG_WARN("ahbot", "AuctionHouseBot Account ID {} has no associated characters.", ahBotAccId);
}
return true;
@@ -102,7 +102,7 @@ void AuctionBotConfig::SetConfig(AuctionBotConfigUInt32Values index, char const*
if (int32(GetConfig(index)) < 0)
{
- TC_LOG_ERROR("ahbot", "AHBot: %s (%i) can't be negative. Using %u instead.", fieldname, int32(GetConfig(index)), defvalue);
+ TC_LOG_ERROR("ahbot", "AHBot: {} ({}) can't be negative. Using {} instead.", fieldname, int32(GetConfig(index)), defvalue);
SetConfig(index, defvalue);
}
}
@@ -113,7 +113,7 @@ void AuctionBotConfig::SetConfigMax(AuctionBotConfigUInt32Values index, char con
if (GetConfig(index) > maxvalue)
{
- TC_LOG_ERROR("ahbot", "AHBot: %s (%u) must be in range 0...%u. Using %u instead.", fieldname, GetConfig(index), maxvalue, maxvalue);
+ TC_LOG_ERROR("ahbot", "AHBot: {} ({}) must be in range 0...{}. Using {} instead.", fieldname, GetConfig(index), maxvalue, maxvalue);
SetConfig(index, maxvalue);
}
}
@@ -124,13 +124,13 @@ void AuctionBotConfig::SetConfigMinMax(AuctionBotConfigUInt32Values index, char
if (GetConfig(index) > maxvalue)
{
- TC_LOG_ERROR("ahbot", "AHBot: %s (%u) must be in range %u...%u. Using %u instead.", fieldname, GetConfig(index), minvalue, maxvalue, maxvalue);
+ TC_LOG_ERROR("ahbot", "AHBot: {} ({}) must be in range {}...{}. Using {} instead.", fieldname, GetConfig(index), minvalue, maxvalue, maxvalue);
SetConfig(index, maxvalue);
}
if (GetConfig(index) < minvalue)
{
- TC_LOG_ERROR("ahbot", "AHBot: %s (%u) must be in range %u...%u. Using %u instead.", fieldname, GetConfig(index), minvalue, maxvalue, minvalue);
+ TC_LOG_ERROR("ahbot", "AHBot: {} ({}) must be in range {}...{}. Using {} instead.", fieldname, GetConfig(index), minvalue, maxvalue, minvalue);
SetConfig(index, minvalue);
}
}
diff --git a/src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp b/src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp
index 3594a4200b9..7d1a5ef71cd 100644
--- a/src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp
+++ b/src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp
@@ -53,7 +53,7 @@ bool AuctionBotBuyer::Initialize()
// load Check interval
_checkInterval = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYER_RECHECK_INTERVAL) * MINUTE;
- TC_LOG_DEBUG("ahbot", "AHBot buyer interval is %u minutes", _checkInterval / MINUTE);
+ TC_LOG_DEBUG("ahbot", "AHBot buyer interval is {} minutes", _checkInterval / MINUTE);
return true;
}
@@ -78,7 +78,7 @@ bool AuctionBotBuyer::Update(AuctionHouseType houseType)
if (!sAuctionBotConfig->GetConfigBuyerEnabled(houseType))
return false;
- TC_LOG_DEBUG("ahbot", "AHBot: %s buying ...", AuctionBotConfig::GetHouseTypeName(houseType));
+ TC_LOG_DEBUG("ahbot", "AHBot: {} buying ...", AuctionBotConfig::GetHouseTypeName(houseType));
BuyerConfiguration& config = _houseConfig[houseType];
uint32 eligibleItems = GetItemInformation(config);
@@ -153,8 +153,8 @@ uint32 AuctionBotBuyer::GetItemInformation(BuyerConfiguration& config)
}
}
- TC_LOG_DEBUG("ahbot", "AHBot: %u items added to buyable/biddable vector for ah type: %u", count, config.GetHouseType());
- TC_LOG_DEBUG("ahbot", "AHBot: SameItemInfo size = %u", (uint32)config.SameItemInfo.size());
+ TC_LOG_DEBUG("ahbot", "AHBot: {} items added to buyable/biddable vector for ah type: {}", count, config.GetHouseType());
+ TC_LOG_DEBUG("ahbot", "AHBot: SameItemInfo size = {}", (uint32)config.SameItemInfo.size());
return count;
}
@@ -181,7 +181,7 @@ bool AuctionBotBuyer::RollBuyChance(BuyerItemInfo const* ahInfo, Item const* ite
{
float avgBuyPrice = ahInfo->TotalBuyPrice / float(ahInfo->BuyItemCount);
- TC_LOG_DEBUG("ahbot", "AHBot: buyout average: %.1f items with buyout: %u", avgBuyPrice, ahInfo->BuyItemCount);
+ TC_LOG_DEBUG("ahbot", "AHBot: buyout average: {:.1f} items with buyout: {}", avgBuyPrice, ahInfo->BuyItemCount);
// If there are more than 5 items on AH of this entry, try weigh in the average buyout price
if (ahInfo->BuyItemCount > 5)
@@ -193,7 +193,7 @@ bool AuctionBotBuyer::RollBuyChance(BuyerItemInfo const* ahInfo, Item const* ite
float rand = frand(0.f, 100.f);
bool win = rand <= chance;
- TC_LOG_DEBUG("ahbot", "AHBot: %s BUY! chance = %.2f, price = %u, buyprice = %u.", win ? "WIN" : "LOSE", chance, uint32(itemPrice), uint32(itemBuyPrice));
+ TC_LOG_DEBUG("ahbot", "AHBot: {} BUY! chance = {:.2f}, price = {}, buyprice = {}.", win ? "WIN" : "LOSE", chance, uint32(itemPrice), uint32(itemBuyPrice));
return win;
}
@@ -213,7 +213,7 @@ bool AuctionBotBuyer::RollBidChance(BuyerItemInfo const* ahInfo, Item const* ite
{
float avgBidPrice = ahInfo->TotalBidPrice / float(ahInfo->BidItemCount);
- TC_LOG_DEBUG("ahbot", "AHBot: Bid average: %.1f biddable item count: %u", avgBidPrice, ahInfo->BidItemCount);
+ TC_LOG_DEBUG("ahbot", "AHBot: Bid average: {:.1f} biddable item count: {}", avgBidPrice, ahInfo->BidItemCount);
// If there are more than 5 items on AH of this entry, try weigh in the average bid price
if (ahInfo->BidItemCount >= 5)
@@ -229,7 +229,7 @@ bool AuctionBotBuyer::RollBidChance(BuyerItemInfo const* ahInfo, Item const* ite
float rand = frand(0.f, 100.f);
bool win = rand <= chance;
- TC_LOG_DEBUG("ahbot", "AHBot: %s BID! chance = %.2f, price = %u, bidprice = %u.", win ? "WIN" : "LOSE", chance, uint32(itemPrice), uint32(itemBidPrice));
+ TC_LOG_DEBUG("ahbot", "AHBot: {} BID! chance = {:.2f}, price = {}, bidprice = {}.", win ? "WIN" : "LOSE", chance, uint32(itemPrice), uint32(itemBidPrice));
return win;
}
@@ -248,7 +248,7 @@ void AuctionBotBuyer::PrepareListOfEntry(BuyerConfiguration& config)
++itr;
}
- TC_LOG_DEBUG("ahbot", "AHBot: EligibleItems size = %u", (uint32)config.EligibleItems.size());
+ TC_LOG_DEBUG("ahbot", "AHBot: EligibleItems size = {}", (uint32)config.EligibleItems.size());
}
// Tries to bid and buy items based on their prices and chances set in configs
@@ -274,7 +274,7 @@ void AuctionBotBuyer::BuyAndBidItems(BuyerConfiguration& config)
AuctionEntry* auction = auctionHouse->GetAuction(itr->second.AuctionId);
if (!auction)
{
- TC_LOG_DEBUG("ahbot", "AHBot: Entry %u doesn't exists, perhaps bought already?", itr->second.AuctionId);
+ TC_LOG_DEBUG("ahbot", "AHBot: Entry {} doesn't exists, perhaps bought already?", itr->second.AuctionId);
items.erase(itr++);
continue;
}
@@ -283,7 +283,7 @@ void AuctionBotBuyer::BuyAndBidItems(BuyerConfiguration& config)
// If it has been checked and it was recently, skip it
if (itr->second.LastChecked && (now - itr->second.LastChecked) <= _checkInterval)
{
- TC_LOG_DEBUG("ahbot", "AHBot: In time interval wait for entry %u!", auction->Id);
+ TC_LOG_DEBUG("ahbot", "AHBot: In time interval wait for entry {}!", auction->Id);
++itr;
continue;
}
@@ -314,7 +314,7 @@ void AuctionBotBuyer::BuyAndBidItems(BuyerConfiguration& config)
if (sameItemItr != config.SameItemInfo.end())
ahInfo = &sameItemItr->second;
- TC_LOG_DEBUG("ahbot", "AHBot: Rolling for AHentry %u:", auction->Id);
+ TC_LOG_DEBUG("ahbot", "AHBot: Rolling for AHentry {}:", auction->Id);
// Roll buy and bid chances
bool successBuy = RollBuyChance(ahInfo, item, auction, bidPrice);
@@ -389,7 +389,7 @@ uint32 AuctionBotBuyer::GetChanceMultiplier(uint32 quality)
// Buys the auction and does necessary actions to complete the buyout
void AuctionBotBuyer::BuyEntry(AuctionEntry* auction, AuctionHouseObject* auctionHouse)
{
- TC_LOG_DEBUG("ahbot", "AHBot: Entry %u bought at %.2fg", auction->Id, float(auction->buyout) / float(GOLD));
+ TC_LOG_DEBUG("ahbot", "AHBot: Entry {} bought at {:.2f}g", auction->Id, float(auction->buyout) / float(GOLD));
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
@@ -420,7 +420,7 @@ void AuctionBotBuyer::BuyEntry(AuctionEntry* auction, AuctionHouseObject* auctio
// Bids on the auction and does the necessary actions for bidding
void AuctionBotBuyer::PlaceBidToEntry(AuctionEntry* auction, uint32 bidPrice)
{
- TC_LOG_DEBUG("ahbot", "AHBot: Bid placed to entry %u, %.2fg", auction->Id, float(bidPrice) / float(GOLD));
+ TC_LOG_DEBUG("ahbot", "AHBot: Bid placed to entry {}, {:.2f}g", auction->Id, float(bidPrice) / float(GOLD));
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
diff --git a/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp b/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp
index 2705c4067f5..6cd32cd475f 100644
--- a/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp
+++ b/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp
@@ -61,8 +61,8 @@ bool AuctionBotSeller::Initialize()
excludeItems.insert(atoi(temp.c_str()));
}
- TC_LOG_DEBUG("ahbot", "Forced Inclusion %u items", (uint32)includeItems.size());
- TC_LOG_DEBUG("ahbot", "Forced Exclusion %u items", (uint32)excludeItems.size());
+ TC_LOG_DEBUG("ahbot", "Forced Inclusion {} items", (uint32)includeItems.size());
+ TC_LOG_DEBUG("ahbot", "Forced Exclusion {} items", (uint32)excludeItems.size());
TC_LOG_DEBUG("ahbot", "Loading npc vendor items for filter..");
CreatureTemplateContainer const& creatures = sObjectMgr->GetCreatureTemplates();
@@ -71,7 +71,7 @@ bool AuctionBotSeller::Initialize()
for (VendorItem const& vendorItem : data->m_items)
npcItems.insert(vendorItem.item);
- TC_LOG_DEBUG("ahbot", "Npc vendor filter has %u items", (uint32)npcItems.size());
+ TC_LOG_DEBUG("ahbot", "Npc vendor filter has {} items", (uint32)npcItems.size());
TC_LOG_DEBUG("ahbot", "Loading loot items for filter..");
QueryResult result = WorldDatabase.PQuery(
@@ -101,7 +101,7 @@ bool AuctionBotSeller::Initialize()
} while (result->NextRow());
}
- TC_LOG_DEBUG("ahbot", "Loot filter has %u items", (uint32)lootItems.size());
+ TC_LOG_DEBUG("ahbot", "Loot filter has {} items", (uint32)lootItems.size());
TC_LOG_DEBUG("ahbot", "Sorting and cleaning items for AHBot seller...");
uint32 itemsAdded = 0;
@@ -353,13 +353,13 @@ bool AuctionBotSeller::Initialize()
return false;
}
- TC_LOG_DEBUG("ahbot", "AuctionHouseBot seller will use %u items to fill auction house (according your config choices)", itemsAdded);
+ TC_LOG_DEBUG("ahbot", "AuctionHouseBot seller will use {} items to fill auction house (according your config choices)", itemsAdded);
LoadConfig();
TC_LOG_DEBUG("ahbot", "Items loaded \tGray\tWhite\tGreen\tBlue\tPurple\tOrange\tYellow");
for (uint32 i = 0; i < MAX_ITEM_CLASS; ++i)
- TC_LOG_DEBUG("ahbot", "\t\t%u\t%u\t%u\t%u\t%u\t%u\t%u",
+ TC_LOG_DEBUG("ahbot", "\t\t{}\t{}\t{}\t{}\t{}\t{}\t{}",
(uint32)_itemPool[0][i].size(), (uint32)_itemPool[1][i].size(), (uint32)_itemPool[2][i].size(),
(uint32)_itemPool[3][i].size(), (uint32)_itemPool[4][i].size(), (uint32)_itemPool[5][i].size(),
(uint32)_itemPool[6][i].size());
@@ -553,7 +553,7 @@ uint32 AuctionBotSeller::SetStat(SellerConfiguration& config)
TC_LOG_DEBUG("ahbot", "AHBot: Missed Item \tGray\tWhite\tGreen\tBlue\tPurple\tOrange\tYellow");
for (uint32 i = 0; i < MAX_ITEM_CLASS; ++i)
{
- TC_LOG_DEBUG("ahbot", "AHBot: \t\t%u\t%u\t%u\t%u\t%u\t%u\t%u",
+ TC_LOG_DEBUG("ahbot", "AHBot: \t\t{}\t{}\t{}\t{}\t{}\t{}\t{}",
config.GetMissedItemsPerClass(AUCTION_QUALITY_GRAY, (ItemClass)i),
config.GetMissedItemsPerClass(AUCTION_QUALITY_WHITE, (ItemClass)i),
config.GetMissedItemsPerClass(AUCTION_QUALITY_GREEN, (ItemClass)i),
@@ -875,7 +875,7 @@ void AuctionBotSeller::AddNewAuctions(SellerConfiguration& config)
ItemTemplate const* prototype = sObjectMgr->GetItemTemplate(itemId);
if (!prototype)
{
- TC_LOG_DEBUG("ahbot", "AHBot: Unknown item %u auction creating attempt.", itemId);
+ TC_LOG_DEBUG("ahbot", "AHBot: Unknown item {} auction creating attempt.", itemId);
continue;
}
@@ -884,7 +884,7 @@ void AuctionBotSeller::AddNewAuctions(SellerConfiguration& config)
Item* item = Item::CreateItem(itemId, stackCount);
if (!item)
{
- TC_LOG_ERROR("ahbot", "AHBot: Item::CreateItem() returned NULL for item %u (stack: %u)", itemId, stackCount);
+ TC_LOG_ERROR("ahbot", "AHBot: Item::CreateItem() returned NULL for item {} (stack: {})", itemId, stackCount);
return;
}
@@ -941,14 +941,14 @@ void AuctionBotSeller::AddNewAuctions(SellerConfiguration& config)
}
CharacterDatabase.CommitTransaction(trans);
- TC_LOG_DEBUG("ahbot", "AHBot: Added %u items to auction", count);
+ TC_LOG_DEBUG("ahbot", "AHBot: Added {} items to auction", count);
}
bool AuctionBotSeller::Update(AuctionHouseType houseType)
{
if (sAuctionBotConfig->GetConfigItemAmountRatio(houseType) > 0)
{
- TC_LOG_DEBUG("ahbot", "AHBot: %s selling ...", AuctionBotConfig::GetHouseTypeName(houseType));
+ TC_LOG_DEBUG("ahbot", "AHBot: {} selling ...", AuctionBotConfig::GetHouseTypeName(houseType));
if (SetStat(_houseConfig[houseType]))
AddNewAuctions(_houseConfig[houseType]);
return true;