mirror of
https://github.com/NathanHandley/mod-ah-bot-plus.git
synced 2026-01-13 01:08:37 +00:00
added ahbot variance during buy/sell cycles
This commit is contained in:
@@ -36,9 +36,8 @@
|
||||
# AuctionHouseBot.GUIDs = 3,4 <- Both characters with GUID 3 and 4
|
||||
#
|
||||
# AuctionHouseBot.ItemsPerCycle
|
||||
# How many items to post on the auction house every house update. Items
|
||||
# in a cycle will be posted by a single randomly selected bot, so keep
|
||||
# this value low if you want highly diverse "Seller" names in auction listings.
|
||||
# How many items to post on the auction house every house update.
|
||||
# Items in a cycle will be posted by a randomly selected bot.
|
||||
# Default 150
|
||||
#
|
||||
# AuctionHouseBot.ListingExpireTimeInSecondsMin
|
||||
|
||||
@@ -827,7 +827,7 @@ uint32 AuctionHouseBot::GetRandomItemIDForListing()
|
||||
return ItemCandidatesByItemClassAndQuality[listProportionNode.ItemClassID][listProportionNode.ItemQualityID][urand(0, numOfValidItemsInGroup-1)];
|
||||
}
|
||||
|
||||
void AuctionHouseBot::AddNewAuctions(Player* AHBplayer, FactionSpecificAuctionHouseConfig *config)
|
||||
void AuctionHouseBot::AddNewAuctions(std::vector<Player*> AHBPlayers, FactionSpecificAuctionHouseConfig *config)
|
||||
{
|
||||
if (!SellingBotEnabled)
|
||||
{
|
||||
@@ -927,6 +927,8 @@ void AuctionHouseBot::AddNewAuctions(Player* AHBplayer, FactionSpecificAuctionHo
|
||||
continue;
|
||||
}
|
||||
|
||||
Player* AHBplayer = AHBPlayers[urand(0, AHBPlayers.size() - 1)];
|
||||
|
||||
Item* item = Item::CreateItem(itemID, 1, AHBplayer);
|
||||
if (item == NULL)
|
||||
{
|
||||
@@ -982,7 +984,7 @@ void AuctionHouseBot::AddNewAuctions(Player* AHBplayer, FactionSpecificAuctionHo
|
||||
LOG_INFO("module", "AHSeller: Added {} items", itemsGenerated);
|
||||
}
|
||||
|
||||
void AuctionHouseBot::AddNewAuctionBuyerBotBid(Player* AHBplayer, FactionSpecificAuctionHouseConfig *config)
|
||||
void AuctionHouseBot::AddNewAuctionBuyerBotBid(std::vector<Player*> AHBPlayers, FactionSpecificAuctionHouseConfig *config)
|
||||
{
|
||||
if (!BuyingBotEnabled)
|
||||
{
|
||||
@@ -1133,6 +1135,9 @@ void AuctionHouseBot::AddNewAuctionBuyerBotBid(Player* AHBplayer, FactionSpecifi
|
||||
LOG_INFO("module", "AHBuyer: Stopped from buying due to 'PreventOverpayingForVendorItems'?: {}", preventedOverpayingForVendorItem);
|
||||
LOG_INFO("module", "-------------------------------------------------");
|
||||
}
|
||||
|
||||
Player* AHBplayer = AHBPlayers[urand(0, AHBPlayers.size() - 1)];
|
||||
|
||||
if (doBid)
|
||||
{
|
||||
auto trans = CharacterDatabase.BeginTransaction();
|
||||
@@ -1189,32 +1194,37 @@ void AuctionHouseBot::Update()
|
||||
LastCycleCount = 0;
|
||||
CyclesBetweenBuyOrSell = urand(CyclesBetweenBuyOrSellMin, CyclesBetweenBuyOrSellMax);
|
||||
|
||||
// Randomly select the bot to load, and load it
|
||||
uint32 botIndex = urand(0, AHCharacters.size() - 1);
|
||||
// Load all AH Bot Players
|
||||
std::vector<Player*> AHBPlayers;
|
||||
for (uint32 botIndex = 0; botIndex <= AHCharacters.size() - 1; ++botIndex)
|
||||
{
|
||||
CurrentBotCharGUID = AHCharacters[botIndex].CharacterGUID;
|
||||
std::string accountName = "AuctionHouseBot" + std::to_string(AHCharacters[botIndex].AccountID);
|
||||
WorldSession _session(AHCharacters[botIndex].AccountID, std::move(accountName), 0, nullptr, SEC_PLAYER, sWorld->getIntConfig(CONFIG_EXPANSION), 0, LOCALE_enUS, 0, false, false, 0);
|
||||
Player _AHBplayer(&_session);
|
||||
_AHBplayer.Initialize(AHCharacters[botIndex].CharacterGUID);
|
||||
ObjectAccessor::AddObject(&_AHBplayer);
|
||||
Player* _AHBplayer = new Player(&_session);
|
||||
_AHBplayer->Initialize(AHCharacters[botIndex].CharacterGUID);
|
||||
ObjectAccessor::AddObject(_AHBplayer);
|
||||
AHBPlayers.push_back(_AHBplayer);
|
||||
}
|
||||
|
||||
// Add New Bids
|
||||
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
|
||||
{
|
||||
AddNewAuctions(&_AHBplayer, &AllianceConfig);
|
||||
AddNewAuctions(AHBPlayers, &AllianceConfig);
|
||||
if (BuyingBotBuyCandidatesPerBuyCycleMin > 0)
|
||||
AddNewAuctionBuyerBotBid(&_AHBplayer, &AllianceConfig);
|
||||
AddNewAuctionBuyerBotBid(AHBPlayers, &AllianceConfig);
|
||||
|
||||
AddNewAuctions(&_AHBplayer, &HordeConfig);
|
||||
AddNewAuctions(AHBPlayers, &HordeConfig);
|
||||
if (BuyingBotBuyCandidatesPerBuyCycleMin > 0)
|
||||
AddNewAuctionBuyerBotBid(&_AHBplayer, &HordeConfig);
|
||||
AddNewAuctionBuyerBotBid(AHBPlayers, &HordeConfig);
|
||||
}
|
||||
|
||||
AddNewAuctions(&_AHBplayer, &NeutralConfig);
|
||||
AddNewAuctions(AHBPlayers, &NeutralConfig);
|
||||
if (BuyingBotBuyCandidatesPerBuyCycleMin > 0)
|
||||
AddNewAuctionBuyerBotBid(&_AHBplayer, &NeutralConfig);
|
||||
AddNewAuctionBuyerBotBid(AHBPlayers, &NeutralConfig);
|
||||
|
||||
ObjectAccessor::RemoveObject(&_AHBplayer);
|
||||
for (Player* p : AHBPlayers)
|
||||
ObjectAccessor::RemoveObject(p);
|
||||
}
|
||||
|
||||
void AuctionHouseBot::InitializeConfiguration()
|
||||
|
||||
@@ -307,8 +307,8 @@ public:
|
||||
ItemTemplate const* GetProducedItemFromRecipe(ItemTemplate const* recipeItemTemplate);
|
||||
void PopulateItemCandidatesAndProportions();
|
||||
uint32 GetRandomItemIDForListing();
|
||||
void AddNewAuctions(Player* AHBplayer, FactionSpecificAuctionHouseConfig* config);
|
||||
void AddNewAuctionBuyerBotBid(Player* AHBplayer, FactionSpecificAuctionHouseConfig* config);
|
||||
void AddNewAuctions(std::vector<Player*> AHBPlayers, FactionSpecificAuctionHouseConfig* config);
|
||||
void AddNewAuctionBuyerBotBid(std::vector<Player*> AHBPlayers, FactionSpecificAuctionHouseConfig* config);
|
||||
void PopulateVendorItemsPrices();
|
||||
|
||||
template <typename ValueType>
|
||||
|
||||
Reference in New Issue
Block a user