diff options
| author | Shauren <shauren.trinity@gmail.com> | 2023-01-08 21:16:53 +0100 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2023-01-08 21:16:53 +0100 |
| commit | d791afae1dfcfaf592326f787755ca32d629e4d3 (patch) | |
| tree | 54dc9916ede5800e110a2f0edff91530811fbdb8 /src/server/game/AuctionHouseBot | |
| parent | b6820a706f46f18b9652fcd9806e4bec8805d29d (diff) | |
Core/Logging: Switch from fmt::sprintf to fmt::format (c++20 standard compatible api)
Diffstat (limited to 'src/server/game/AuctionHouseBot')
3 files changed, 30 insertions, 30 deletions
diff --git a/src/server/game/AuctionHouseBot/AuctionHouseBot.cpp b/src/server/game/AuctionHouseBot/AuctionHouseBot.cpp index 924d0924570..36297849dcb 100644 --- a/src/server/game/AuctionHouseBot/AuctionHouseBot.cpp +++ b/src/server/game/AuctionHouseBot/AuctionHouseBot.cpp @@ -81,10 +81,10 @@ bool AuctionBotConfig::Initialize() _AHBotCharacters.push_back(ObjectGuid::Create<HighGuid::Player>((*result)[0].GetUInt64())); } while (result->NextRow()); - TC_LOG_DEBUG("ahbot", "AuctionHouseBot found " UI64FMTD " characters", result->GetRowCount()); + TC_LOG_DEBUG("ahbot", "AuctionHouseBot found {} characters", result->GetRowCount()); } 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; @@ -96,7 +96,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); } } @@ -107,7 +107,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); } } @@ -118,13 +118,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 4270fd21a9d..0508951226f 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); @@ -155,8 +155,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; } @@ -189,7 +189,7 @@ bool AuctionBotBuyer::RollBuyChance(BuyerItemInfo const* ahInfo, AuctionPosting { 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) @@ -201,7 +201,7 @@ bool AuctionBotBuyer::RollBuyChance(BuyerItemInfo const* ahInfo, AuctionPosting 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; } @@ -230,7 +230,7 @@ bool AuctionBotBuyer::RollBidChance(BuyerItemInfo const* ahInfo, AuctionPosting { 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) @@ -246,7 +246,7 @@ bool AuctionBotBuyer::RollBidChance(BuyerItemInfo const* ahInfo, AuctionPosting 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; } @@ -265,7 +265,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 @@ -291,7 +291,7 @@ void AuctionBotBuyer::BuyAndBidItems(BuyerConfiguration& config) AuctionPosting* 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; } @@ -300,7 +300,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; } @@ -323,7 +323,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, auction); @@ -398,7 +398,7 @@ uint32 AuctionBotBuyer::GetChanceMultiplier(uint32 quality) // Buys the auction and does necessary actions to complete the buyout void AuctionBotBuyer::BuyEntry(AuctionPosting* auction, AuctionHouseObject* auctionHouse) { - TC_LOG_DEBUG("ahbot", "AHBot: Entry %u bought at %.2fg", auction->Id, float(auction->BuyoutOrUnitPrice) / float(GOLD)); + TC_LOG_DEBUG("ahbot", "AHBot: Entry {} bought at {:.2f}g", auction->Id, float(auction->BuyoutOrUnitPrice) / float(GOLD)); CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction(); @@ -426,7 +426,7 @@ void AuctionBotBuyer::BuyEntry(AuctionPosting* auction, AuctionHouseObject* auct // Bids on the auction and does the necessary actions for bidding void AuctionBotBuyer::PlaceBidToEntry(AuctionPosting* auction, AuctionHouseObject* auctionHouse, 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 404d2959e7a..36b11cfb685 100644 --- a/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp +++ b/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp @@ -61,8 +61,8 @@ bool AuctionBotSeller::Initialize() excludeItems.insert(atol(temp.c_str())); } - TC_LOG_DEBUG("ahbot", "Forced Inclusion " SZFMTD " items", includeItems.size()); - TC_LOG_DEBUG("ahbot", "Forced Exclusion " SZFMTD " items", excludeItems.size()); + TC_LOG_DEBUG("ahbot", "Forced Inclusion {} items", includeItems.size()); + TC_LOG_DEBUG("ahbot", "Forced Exclusion {} items", 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 " SZFMTD " items", npcItems.size()); + TC_LOG_DEBUG("ahbot", "Npc vendor filter has {} items", 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 " SZFMTD " items", lootItems.size()); + TC_LOG_DEBUG("ahbot", "Loot filter has {} items", lootItems.size()); TC_LOG_DEBUG("ahbot", "Sorting and cleaning items for AHBot seller..."); uint32 itemsAdded = 0; @@ -349,7 +349,7 @@ 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(); @@ -546,7 +546,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), @@ -852,7 +852,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; } @@ -861,7 +861,7 @@ void AuctionBotSeller::AddNewAuctions(SellerConfiguration& config) Item* item = Item::CreateItem(itemId, stackCount, ItemContext::NONE); 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; } @@ -908,14 +908,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; |
