calculate new CyclesBetweenBuyOrSell only if update cycle is hit

This commit is contained in:
zeb
2025-09-26 23:04:20 -04:00
parent e0a465811d
commit cb2c196c8b
2 changed files with 5 additions and 1 deletions

View File

@@ -42,6 +42,7 @@ AuctionHouseBot::AuctionHouseBot() :
SellingBotEnabled(false), SellingBotEnabled(false),
BuyingBotEnabled(false), BuyingBotEnabled(false),
CyclesBetweenBuyOrSellMin(1), CyclesBetweenBuyOrSellMin(1),
CyclesBetweenBuyOrSell(1),
CyclesBetweenBuyOrSellMax(1), CyclesBetweenBuyOrSellMax(1),
MaxBuyoutPriceInCopper(1000000000), MaxBuyoutPriceInCopper(1000000000),
BuyoutVariationReducePercent(0.15f), BuyoutVariationReducePercent(0.15f),
@@ -1176,9 +1177,10 @@ void AuctionHouseBot::Update()
// Only update if the update cycle has been hit // Only update if the update cycle has been hit
LastCycleCount++; LastCycleCount++;
if (LastCycleCount < urand(CyclesBetweenBuyOrSellMin, CyclesBetweenBuyOrSellMax)) if (LastCycleCount < CyclesBetweenBuyOrSell)
return; return;
LastCycleCount = 0; LastCycleCount = 0;
CyclesBetweenBuyOrSell = urand(CyclesBetweenBuyOrSellMin, CyclesBetweenBuyOrSellMax);
// Randomly select the bot to load, and load it // Randomly select the bot to load, and load it
uint32 botIndex = urand(0, AHCharacters.size() - 1); uint32 botIndex = urand(0, AHCharacters.size() - 1);
@@ -1470,6 +1472,7 @@ void AuctionHouseBot::SetCyclesBetweenBuyOrSell()
{ {
std::string cyclesConfigString = sConfigMgr->GetOption<std::string>("AuctionHouseBot.AuctionHouseManagerCyclesBetweenBuyOrSell", "1"); std::string cyclesConfigString = sConfigMgr->GetOption<std::string>("AuctionHouseBot.AuctionHouseManagerCyclesBetweenBuyOrSell", "1");
GetConfigMinAndMax(cyclesConfigString, CyclesBetweenBuyOrSellMin, CyclesBetweenBuyOrSellMax); GetConfigMinAndMax(cyclesConfigString, CyclesBetweenBuyOrSellMin, CyclesBetweenBuyOrSellMax);
CyclesBetweenBuyOrSell = urand(CyclesBetweenBuyOrSellMin, CyclesBetweenBuyOrSellMax);
} }
void AuctionHouseBot::SetBuyingBotBuyCandidatesPerBuyCycle() void AuctionHouseBot::SetBuyingBotBuyCandidatesPerBuyCycle()

View File

@@ -129,6 +129,7 @@ private:
bool SellingBotEnabled; bool SellingBotEnabled;
bool BuyingBotEnabled; bool BuyingBotEnabled;
uint32 CyclesBetweenBuyOrSellMin; uint32 CyclesBetweenBuyOrSellMin;
uint32 CyclesBetweenBuyOrSell;
uint32 CyclesBetweenBuyOrSellMax; uint32 CyclesBetweenBuyOrSellMax;
uint32 MaxBuyoutPriceInCopper; uint32 MaxBuyoutPriceInCopper;
float BuyoutVariationReducePercent; float BuyoutVariationReducePercent;