From cb2c196c8be624d5dc7b93fd89c2ab86acd4410e Mon Sep 17 00:00:00 2001 From: zeb <37308742+zeb139@users.noreply.github.com> Date: Fri, 26 Sep 2025 23:04:20 -0400 Subject: [PATCH] calculate new CyclesBetweenBuyOrSell only if update cycle is hit --- src/AuctionHouseBot.cpp | 5 ++++- src/AuctionHouseBot.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/AuctionHouseBot.cpp b/src/AuctionHouseBot.cpp index 9bfb64f..3028645 100644 --- a/src/AuctionHouseBot.cpp +++ b/src/AuctionHouseBot.cpp @@ -42,6 +42,7 @@ AuctionHouseBot::AuctionHouseBot() : SellingBotEnabled(false), BuyingBotEnabled(false), CyclesBetweenBuyOrSellMin(1), + CyclesBetweenBuyOrSell(1), CyclesBetweenBuyOrSellMax(1), MaxBuyoutPriceInCopper(1000000000), BuyoutVariationReducePercent(0.15f), @@ -1176,9 +1177,10 @@ void AuctionHouseBot::Update() // Only update if the update cycle has been hit LastCycleCount++; - if (LastCycleCount < urand(CyclesBetweenBuyOrSellMin, CyclesBetweenBuyOrSellMax)) + if (LastCycleCount < CyclesBetweenBuyOrSell) return; LastCycleCount = 0; + CyclesBetweenBuyOrSell = urand(CyclesBetweenBuyOrSellMin, CyclesBetweenBuyOrSellMax); // Randomly select the bot to load, and load it uint32 botIndex = urand(0, AHCharacters.size() - 1); @@ -1470,6 +1472,7 @@ void AuctionHouseBot::SetCyclesBetweenBuyOrSell() { std::string cyclesConfigString = sConfigMgr->GetOption("AuctionHouseBot.AuctionHouseManagerCyclesBetweenBuyOrSell", "1"); GetConfigMinAndMax(cyclesConfigString, CyclesBetweenBuyOrSellMin, CyclesBetweenBuyOrSellMax); + CyclesBetweenBuyOrSell = urand(CyclesBetweenBuyOrSellMin, CyclesBetweenBuyOrSellMax); } void AuctionHouseBot::SetBuyingBotBuyCandidatesPerBuyCycle() diff --git a/src/AuctionHouseBot.h b/src/AuctionHouseBot.h index ff98a33..bb39ca0 100644 --- a/src/AuctionHouseBot.h +++ b/src/AuctionHouseBot.h @@ -129,6 +129,7 @@ private: bool SellingBotEnabled; bool BuyingBotEnabled; uint32 CyclesBetweenBuyOrSellMin; + uint32 CyclesBetweenBuyOrSell; uint32 CyclesBetweenBuyOrSellMax; uint32 MaxBuyoutPriceInCopper; float BuyoutVariationReducePercent;