mirror of
https://github.com/NathanHandley/mod-ah-bot-plus.git
synced 2026-01-13 01:08:37 +00:00
added CyclesBetweenBuyOrSell variance
This commit is contained in:
@@ -41,7 +41,8 @@ AuctionHouseBot::AuctionHouseBot() :
|
||||
debug_Out_Filters(false),
|
||||
SellingBotEnabled(false),
|
||||
BuyingBotEnabled(false),
|
||||
CyclesBetweenBuyOrSell(1),
|
||||
CyclesBetweenBuyOrSellMin(1),
|
||||
CyclesBetweenBuyOrSellMax(1),
|
||||
MaxBuyoutPriceInCopper(1000000000),
|
||||
BuyoutVariationReducePercent(0.15f),
|
||||
BuyoutVariationAddPercent(0.25f),
|
||||
@@ -1173,7 +1174,7 @@ void AuctionHouseBot::Update()
|
||||
|
||||
// Only update if the update cycle has been hit
|
||||
LastCycleCount++;
|
||||
if (LastCycleCount < CyclesBetweenBuyOrSell)
|
||||
if (LastCycleCount < urand(CyclesBetweenBuyOrSellMin, CyclesBetweenBuyOrSellMax))
|
||||
return;
|
||||
LastCycleCount = 0;
|
||||
|
||||
@@ -1226,7 +1227,7 @@ void AuctionHouseBot::InitializeConfiguration()
|
||||
AddCharacters(charString);
|
||||
|
||||
// Buyer & Seller core properties
|
||||
CyclesBetweenBuyOrSell = sConfigMgr->GetOption<uint32>("AuctionHouseBot.AuctionHouseManagerCyclesBetweenBuyOrSell", 1);
|
||||
SetCyclesBetweenBuyOrSell();
|
||||
ItemsPerCycle = sConfigMgr->GetOption<uint32>("AuctionHouseBot.ItemsPerCycle", 75);
|
||||
MaxBuyoutPriceInCopper = sConfigMgr->GetOption<uint32>("AuctionHouseBot.MaxBuyoutPriceInCopper", 1000000000);
|
||||
BuyoutVariationReducePercent = sConfigMgr->GetOption<float>("AuctionHouseBot.BuyoutVariationReducePercent", 0.15f);
|
||||
@@ -1463,6 +1464,26 @@ uint32 AuctionHouseBot::GetRandomStackIncrementValue(std::string configKeyString
|
||||
return stackIncrementValue;
|
||||
}
|
||||
|
||||
void AuctionHouseBot::SetCyclesBetweenBuyOrSell()
|
||||
{
|
||||
std::string cyclesConfigString = sConfigMgr->GetOption<std::string>("AuctionHouseBot.AuctionHouseManagerCyclesBetweenBuyOrSell", "1");
|
||||
size_t pos = cyclesConfigString.find(':');
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
CyclesBetweenBuyOrSellMin = std::stoi(cyclesConfigString.substr(0, pos));
|
||||
CyclesBetweenBuyOrSellMax = std::stoi(cyclesConfigString.substr(pos + 1));
|
||||
|
||||
if (CyclesBetweenBuyOrSellMin < 1)
|
||||
CyclesBetweenBuyOrSellMin = 1;
|
||||
if (CyclesBetweenBuyOrSellMax < CyclesBetweenBuyOrSellMin)
|
||||
CyclesBetweenBuyOrSellMax = CyclesBetweenBuyOrSellMin;
|
||||
}
|
||||
else
|
||||
{
|
||||
CyclesBetweenBuyOrSellMin = CyclesBetweenBuyOrSellMax = std::stoi(cyclesConfigString);
|
||||
}
|
||||
}
|
||||
|
||||
void AuctionHouseBot::AddCharacters(std::string characterGUIDString)
|
||||
{
|
||||
AHCharacters.clear();
|
||||
|
||||
@@ -128,7 +128,8 @@ private:
|
||||
|
||||
bool SellingBotEnabled;
|
||||
bool BuyingBotEnabled;
|
||||
int CyclesBetweenBuyOrSell;
|
||||
int CyclesBetweenBuyOrSellMin;
|
||||
int CyclesBetweenBuyOrSellMax;
|
||||
uint32 MaxBuyoutPriceInCopper;
|
||||
float BuyoutVariationReducePercent;
|
||||
float BuyoutVariationAddPercent;
|
||||
@@ -290,6 +291,7 @@ public:
|
||||
void InitializeConfiguration();
|
||||
uint32 GetRandomStackValue(std::string configKeyString, uint32 defaultValue);
|
||||
uint32 GetRandomStackIncrementValue(std::string configKeyString, uint32 defaultValue);
|
||||
void SetCyclesBetweenBuyOrSell();
|
||||
void AddCharacters(std::string characterGUIDString);
|
||||
void AddItemIDsFromString(std::set<uint32>& workingItemIDSet, std::string itemString, const char* parentOperationName);
|
||||
void AddToItemIDSet(std::set<uint32>& workingItemIDSet, uint32 itemID, const char* parentOperationName);
|
||||
|
||||
Reference in New Issue
Block a user