Move remaining magic numbers to configs

This commit is contained in:
NathanHandley
2025-09-16 19:32:12 -05:00
parent fa5755a7e3
commit 442360631b
3 changed files with 156 additions and 85 deletions

View File

@@ -10,6 +10,12 @@
# Enable/Disable Debugging output from Filters # Enable/Disable Debugging output from Filters
# Default 0 (disabled) # Default 0 (disabled)
# #
# AuctionHouseBot.AuctionHouseManagerCyclesBetweenBuyOrSell
# How many cycles to wait between executing any buying or selling logic
# - At this time, the AzerothCore has it set as 1 minute inside the
# AuctionHouseMgr.cpp file
# Default 1 (once per AuctionHouseMgr.cpp update cycle)
#
# AuctionHouseBot.EnableSeller # AuctionHouseBot.EnableSeller
# Enable/Disable the part of AHBot that puts items up for auction # Enable/Disable the part of AHBot that puts items up for auction
# Default 0 (disabled) # Default 0 (disabled)
@@ -33,20 +39,67 @@
# from startup complete to first character being able to log in) so a # from startup complete to first character being able to log in) so a
# value greater than a few hundred is not recommended. # value greater than a few hundred is not recommended.
# Default 75 # Default 75
#
# AuctionHouseBot.AuctionHouseManagerCyclesBetweenBuyOrSell
# How many cycles to wait between executing any buying or selling logic
# - At this time, the AzerothCore has it set as 1 minute inside the
# AuctionHouseMgr.cpp file
# Default 1 (once per AuctionHouseMgr.cpp update cycle)
############################################################################### ###############################################################################
AuctionHouseBot.DEBUG = 0 AuctionHouseBot.DEBUG = 0
AuctionHouseBot.DEBUG_FILTERS = 0 AuctionHouseBot.DEBUG_FILTERS = 0
AuctionHouseBot.AuctionHouseManagerCyclesBetweenBuyOrSell = 1
AuctionHouseBot.EnableSeller = 0 AuctionHouseBot.EnableSeller = 0
AuctionHouseBot.GUIDs = 0 AuctionHouseBot.GUIDs = 0
AuctionHouseBot.ItemsPerCycle = 75 AuctionHouseBot.ItemsPerCycle = 75
AuctionHouseBot.AuctionHouseManagerCyclesBetweenBuyOrSell = 1
###############################################################################
# AuctionHouseBot.MaxBuyoutPriceInCopper
# Maximum amount that a buyout on a listing can be in copper. Prevents
# overflow. Don't increase this, but you can decrease it.
# Default 1000000000 (100k gold)
#
# AuctionHouseBot.BuyoutVariationReducePercent
# AuctionHouseBot.BuyoutVariationAddPercent
# After a price is calculated using the various multipliers for either
# a buy or a sell, it is randomized within a band up to +AddPercent
# and down to -ReducePercent
# Default 0.15 (down) and 0.25 (up) - Which means the price range -15% or up +25%
# Note: Do not go negative on either number. Setting both to 0 will cause
# no price variation at all
#
# AuctionHouseBot.BidVariationHighReducePercent
# AuctionHouseBot.BidVariationLowReducePercent
# After the buyout amount is calculated, this is how much deeper down
# the bid price can be. It will range from buyout-HighReduce to buyout-LowReduce
# percent
# Default 0 (high) and .25 (low) - Starting bid will be Buyout (high) and Buyout-25% (low)
# Note: Do not go negative on either number. Set both to 0 if you want bids
# to always be exactly buyout for both buyer and seller.
#
# AuctionHouseBot.BuyoutBelowVendorVariationAddPercent
# If a buyout calculates to a price below vendor price, this is how much to
# add to it in order to bring it up above vendor price.
# Default 0.25 (+25% increase in price)
# Note: Do not put a negative or it will sell less than a vendor. Set to
# zero if you want exactly vendor price
###############################################################################
AuctionHouseBot.MaxBuyoutPriceInCopper = 1000000000
AuctionHouseBot.BuyoutVariationReducePercent = 0.15
AuctionHouseBot.BuyoutVariationAddPercent = 0.25
AuctionHouseBot.BidVariationHighReducePercent = 0
AuctionHouseBot.BidVariationLowReducePercent = 0.25
AuctionHouseBot.BuyoutBelowVendorVariationAddPercent = 0.25
###############################################################################
# AuctionHouseBot.<faction>.MinItems
# AuctionHouseBot.<faction>.MaxItems
# The minimum and maximum number of items to post on that auction house
# Default: 15000 for both
###############################################################################
AuctionHouseBot.Alliance.MinItems = 15000
AuctionHouseBot.Alliance.MaxItems = 15000
AuctionHouseBot.Horde.MinItems = 15000
AuctionHouseBot.Horde.MaxItems = 15000
AuctionHouseBot.Neutral.MinItems = 15000
AuctionHouseBot.Neutral.MaxItems = 15000
############################################################################### ###############################################################################
# BUYER PROPERTIES # BUYER PROPERTIES
@@ -89,7 +142,9 @@ AuctionHouseBot.AuctionHouseManagerCyclesBetweenBuyOrSell = 1
# how much it is willing to spend. # how much it is willing to spend.
# A value of 1 means the buyer bot will generally pay the same as the # A value of 1 means the buyer bot will generally pay the same as the
# seller bot lists. Similarly, a value of 1.5 means it will pay roughly # seller bot lists. Similarly, a value of 1.5 means it will pay roughly
# 50% more than the seller bot's listed price. # 50% more than the seller bot's listed price. Can be less than 1 if you
# want the buyer to be more stingy (0.5 means buyer will pay up to 50%
# of what the seller sells for), but do not go lower than 0
# Default: 1 # Default: 1
############################################################################### ###############################################################################
@@ -97,20 +152,6 @@ AuctionHouseBot.Buyer.Enabled = 0
AuctionHouseBot.Buyer.BuyCandidatesPerBuyCycle = 1 AuctionHouseBot.Buyer.BuyCandidatesPerBuyCycle = 1
AuctionHouseBot.Buyer.AcceptablePriceModifier = 1 AuctionHouseBot.Buyer.AcceptablePriceModifier = 1
###############################################################################
# AuctionHouseBot.<faction>.MinItems
# AuctionHouseBot.<faction>.MaxItems
# The minimum and maximum number of items to post on that auction house
# Default: 15000 for both
###############################################################################
AuctionHouseBot.Alliance.MinItems = 15000
AuctionHouseBot.Alliance.MaxItems = 15000
AuctionHouseBot.Horde.MinItems = 15000
AuctionHouseBot.Horde.MaxItems = 15000
AuctionHouseBot.Neutral.MinItems = 15000
AuctionHouseBot.Neutral.MaxItems = 15000
############################################################################### ###############################################################################
# AuctionHouseBot.ListProportion.* # AuctionHouseBot.ListProportion.*
# Determines how many of the listings, proportionally, show up as new auctions # Determines how many of the listings, proportionally, show up as new auctions
@@ -154,6 +195,13 @@ AuctionHouseBot.ListProportion.Glyph = 2
# into play. Value shouldn't be zero, and the base minimum price will # into play. Value shouldn't be zero, and the base minimum price will
# actually be a +/- 25% range of this value. Used to catch 0 cost or # actually be a +/- 25% range of this value. Used to catch 0 cost or
# extremely low cost items # extremely low cost items
#
# AuctionHouseBot.PriceMinimumCenterBase.OverrideItems
# Comma separated list of items in the format of "itemID:PriceMinCopper"
# which is an override of the PriceMinimumCenterBase", a value that is
# used before variation and multipliers
# Example: "2589:1000000,4306:100000" would set the minimum price center
# of linen cloth to 100 gold and silk cloth to 10 gold each
############################################################################### ###############################################################################
AuctionHouseBot.PriceMinimumCenterBase.Consumable = 1000 AuctionHouseBot.PriceMinimumCenterBase.Consumable = 1000
@@ -172,15 +220,6 @@ AuctionHouseBot.PriceMinimumCenterBase.Key = 1000
AuctionHouseBot.PriceMinimumCenterBase.Misc = 1000 AuctionHouseBot.PriceMinimumCenterBase.Misc = 1000
AuctionHouseBot.PriceMinimumCenterBase.Glyph = 1000 AuctionHouseBot.PriceMinimumCenterBase.Glyph = 1000
###############################################################################
# AuctionHouseBot.PriceMinimumCenterBase.OverrideItems
# Comma separated list of items in the format of "itemID:PriceMinCopper"
# which is an override of the PriceMinimumCenterBase", a value that is
# used before variation and multipliers
# Example: "2589:1000000,4306:100000" would set the minimum price center
# of linen cloth to 100 gold and silk cloth to 10 gold each
###############################################################################
AuctionHouseBot.PriceMinimumCenterBase.OverrideItems = AuctionHouseBot.PriceMinimumCenterBase.OverrideItems =
############################################################################### ###############################################################################
@@ -200,7 +239,8 @@ AuctionHouseBot.PriceMinimumCenterBase.OverrideItems =
# Note that all price multpliers (along with the advanced pricing) are applied # Note that all price multpliers (along with the advanced pricing) are applied
# multiplicative. Example: A Category of 1.5x, Quality of 2x, and CategoryQuality # multiplicative. Example: A Category of 1.5x, Quality of 2x, and CategoryQuality
# of 1.4x would make the multiplier 4.2 (1.5 x 2 x 1.4). The advanced pricing # of 1.4x would make the multiplier 4.2 (1.5 x 2 x 1.4). The advanced pricing
# (below) would then multiply that value further. # (below) would then multiply that value further. Enabling advanced pricing
# will disable PriceMultiplier.ItemLevel pricing for that category
############################################################################### ###############################################################################
AuctionHouseBot.AdvancedPricing.TradeGood.Cloth.Enabled = 1 AuctionHouseBot.AdvancedPricing.TradeGood.Cloth.Enabled = 1
@@ -224,8 +264,9 @@ AuctionHouseBot.AdvancedPricing.Misc.Mount.Enabled = 1
# Multiplier applied to item level when determining auction price, by category # Multiplier applied to item level when determining auction price, by category
# Final multiplier = itemLevel * this value. Set to 0 (or less) to disable. # Final multiplier = itemLevel * this value. Set to 0 (or less) to disable.
# Default: 0 (Disabled) # Default: 0 (Disabled)
# Note: This will be ignored if AdvancedPricing is enabled (above), but this # Note: This will be ignored for any matching specific category above if
# will apply in combination with other price multipliers # AdvancedPricing is enabled (above). This applies in combination with
# all other price multipliers
# #
# AuctionHouseBot.PriceMultiplier.Category*.Quality* # AuctionHouseBot.PriceMultiplier.Category*.Quality*
# Category-and-Quality- modifier values for the prices of items. # Category-and-Quality- modifier values for the prices of items.

View File

@@ -42,6 +42,12 @@ AuctionHouseBot::AuctionHouseBot() :
SellingBotEnabled(false), SellingBotEnabled(false),
BuyingBotEnabled(false), BuyingBotEnabled(false),
CyclesBetweenBuyOrSell(1), CyclesBetweenBuyOrSell(1),
MaxBuyoutPriceInCopper(1000000000),
BuyoutVariationReducePercent(0.15f),
BuyoutVariationAddPercent(0.25f),
BidVariationHighReducePercent(0),
BidVariationLowReducePercent(0.25f),
BuyoutBelowVendorVariationAddPercent(0.25f),
BuyingBotBuyCandidatesPerBuyCycle(1), BuyingBotBuyCandidatesPerBuyCycle(1),
BuyingBotAcceptablePriceModifier(1), BuyingBotAcceptablePriceModifier(1),
AHCharactersGUIDsForQuery(""), AHCharactersGUIDsForQuery(""),
@@ -291,7 +297,7 @@ void AuctionHouseBot::calculateItemValue(ItemTemplate const* itemProto, uint64&
*/ */
// Try to approximate real world prices for Trade Goods based on subclass and item level // Try to approximate real world prices for Trade Goods based on subclass and item level
double advancedPriceingMultiplier = 1.0f; double advancedPricingMultiplier = 1.0f;
if (itemProto->Class == ITEM_CLASS_TRADE_GOODS) if (itemProto->Class == ITEM_CLASS_TRADE_GOODS)
{ {
switch (itemProto->SubClass) switch (itemProto->SubClass)
@@ -301,7 +307,7 @@ void AuctionHouseBot::calculateItemValue(ItemTemplate const* itemProto, uint64&
if (!AdvancedPricingTradeGoodClothEnabled) if (!AdvancedPricingTradeGoodClothEnabled)
break; break;
double clothMultiplierHelper = std::log(1.0 + (itemProto->ItemLevel)); double clothMultiplierHelper = std::log(1.0 + (itemProto->ItemLevel));
advancedPriceingMultiplier = ((std::pow(clothMultiplierHelper,2.0)) / (1 + (0.8 * clothMultiplierHelper))) + (0.001 * std::pow(clothMultiplierHelper,3.5)) - 0.3; advancedPricingMultiplier = ((std::pow(clothMultiplierHelper,2.0)) / (1 + (0.8 * clothMultiplierHelper))) + (0.001 * std::pow(clothMultiplierHelper,3.5)) - 0.3;
break; break;
} }
case ITEM_SUBCLASS_HERB: case ITEM_SUBCLASS_HERB:
@@ -309,7 +315,7 @@ void AuctionHouseBot::calculateItemValue(ItemTemplate const* itemProto, uint64&
if (!AdvancedPricingTradeGoodHerbEnabled) if (!AdvancedPricingTradeGoodHerbEnabled)
break; break;
double herbMultiplierHelper = std::log(1.0 + (5.0 * itemProto->ItemLevel)); double herbMultiplierHelper = std::log(1.0 + (5.0 * itemProto->ItemLevel));
advancedPriceingMultiplier = (std::pow(herbMultiplierHelper,3.0) / (1 + (1.8 * herbMultiplierHelper))) - 4.2; advancedPricingMultiplier = (std::pow(herbMultiplierHelper,3.0) / (1 + (1.8 * herbMultiplierHelper))) - 4.2;
break; break;
} }
case ITEM_SUBCLASS_METAL_STONE: case ITEM_SUBCLASS_METAL_STONE:
@@ -317,7 +323,7 @@ void AuctionHouseBot::calculateItemValue(ItemTemplate const* itemProto, uint64&
if (!AdvancedPricingTradeGoodMetalStoneEnabled) if (!AdvancedPricingTradeGoodMetalStoneEnabled)
break; break;
double metalMultiplierHelper = std::log(1.0 + (75.0 * itemProto->ItemLevel)); double metalMultiplierHelper = std::log(1.0 + (75.0 * itemProto->ItemLevel));
advancedPriceingMultiplier = ((std::pow(metalMultiplierHelper,3.0)) / (1 + (7.0 * metalMultiplierHelper))) + (0.001 * std::pow(metalMultiplierHelper,3.5)) - 5.2; advancedPricingMultiplier = ((std::pow(metalMultiplierHelper,3.0)) / (1 + (7.0 * metalMultiplierHelper))) + (0.001 * std::pow(metalMultiplierHelper,3.5)) - 5.2;
break; break;
} }
case ITEM_SUBCLASS_LEATHER: case ITEM_SUBCLASS_LEATHER:
@@ -325,7 +331,7 @@ void AuctionHouseBot::calculateItemValue(ItemTemplate const* itemProto, uint64&
if (!AdvancedPricingTradeGoodLeatherEnabled) if (!AdvancedPricingTradeGoodLeatherEnabled)
break; break;
double leatherMultiplierHelper = std::log(1.0 + (0.25 * itemProto->ItemLevel)); double leatherMultiplierHelper = std::log(1.0 + (0.25 * itemProto->ItemLevel));
advancedPriceingMultiplier = ((std::pow(leatherMultiplierHelper,0.15)) / (1 + (2.0 * leatherMultiplierHelper))) + (0.4 * std::pow(leatherMultiplierHelper,3.0)) - 0.2; advancedPricingMultiplier = ((std::pow(leatherMultiplierHelper,0.15)) / (1 + (2.0 * leatherMultiplierHelper))) + (0.4 * std::pow(leatherMultiplierHelper,3.0)) - 0.2;
break; break;
} }
case ITEM_SUBCLASS_ENCHANTING: case ITEM_SUBCLASS_ENCHANTING:
@@ -333,14 +339,14 @@ void AuctionHouseBot::calculateItemValue(ItemTemplate const* itemProto, uint64&
if (!AdvancedPricingTradeGoodEnchantingEnabled) if (!AdvancedPricingTradeGoodEnchantingEnabled)
break; break;
double enchantingMultiplierHelper = std::log(1.0 + (0.25 * itemProto->ItemLevel)); double enchantingMultiplierHelper = std::log(1.0 + (0.25 * itemProto->ItemLevel));
advancedPriceingMultiplier = ((std::pow(enchantingMultiplierHelper,0.15)) / (1 + (2.0 * enchantingMultiplierHelper))) + (0.4 * std::pow(enchantingMultiplierHelper,3.0)) - 0.2; advancedPricingMultiplier = ((std::pow(enchantingMultiplierHelper,0.15)) / (1 + (2.0 * enchantingMultiplierHelper))) + (0.4 * std::pow(enchantingMultiplierHelper,3.0)) - 0.2;
break; break;
} }
case ITEM_SUBCLASS_ELEMENTAL: case ITEM_SUBCLASS_ELEMENTAL:
{ {
if (!AdvancedPricingTradeGoodElementalEnabled) if (!AdvancedPricingTradeGoodElementalEnabled)
break; break;
advancedPriceingMultiplier = 85 - (itemProto->ItemLevel / 0.97); advancedPricingMultiplier = 85 - (itemProto->ItemLevel / 0.97);
break; break;
} }
default: default:
@@ -357,7 +363,7 @@ void AuctionHouseBot::calculateItemValue(ItemTemplate const* itemProto, uint64&
if (!AdvancedPricingMiscJunkEnabled) if (!AdvancedPricingMiscJunkEnabled)
break; break;
double miscMultiplierHelper = std::log(1.0 + (0.12 * itemProto->ItemLevel)); double miscMultiplierHelper = std::log(1.0 + (0.12 * itemProto->ItemLevel));
advancedPriceingMultiplier = (std::pow(miscMultiplierHelper,3.2) / (1 + miscMultiplierHelper)); advancedPricingMultiplier = (std::pow(miscMultiplierHelper,3.2) / (1 + miscMultiplierHelper));
break; break;
} }
case ITEM_SUBCLASS_JUNK_MOUNT: case ITEM_SUBCLASS_JUNK_MOUNT:
@@ -366,14 +372,14 @@ void AuctionHouseBot::calculateItemValue(ItemTemplate const* itemProto, uint64&
break; break;
switch (itemProto->Quality) switch (itemProto->Quality)
{ {
case ITEM_QUALITY_POOR: advancedPriceingMultiplier = PriceMultiplierCategoryMountQualityPoor; break; case ITEM_QUALITY_POOR: advancedPricingMultiplier = PriceMultiplierCategoryMountQualityPoor; break;
case ITEM_QUALITY_NORMAL: advancedPriceingMultiplier = PriceMultiplierCategoryMountQualityNormal; break; case ITEM_QUALITY_NORMAL: advancedPricingMultiplier = PriceMultiplierCategoryMountQualityNormal; break;
case ITEM_QUALITY_UNCOMMON: advancedPriceingMultiplier = PriceMultiplierCategoryMountQualityUncommon; break; case ITEM_QUALITY_UNCOMMON: advancedPricingMultiplier = PriceMultiplierCategoryMountQualityUncommon; break;
case ITEM_QUALITY_RARE: advancedPriceingMultiplier = PriceMultiplierCategoryMountQualityRare; break; case ITEM_QUALITY_RARE: advancedPricingMultiplier = PriceMultiplierCategoryMountQualityRare; break;
case ITEM_QUALITY_EPIC: advancedPriceingMultiplier = PriceMultiplierCategoryMountQualityEpic; break; case ITEM_QUALITY_EPIC: advancedPricingMultiplier = PriceMultiplierCategoryMountQualityEpic; break;
case ITEM_QUALITY_LEGENDARY: advancedPriceingMultiplier = PriceMultiplierCategoryMountQualityLegendary; break; case ITEM_QUALITY_LEGENDARY: advancedPricingMultiplier = PriceMultiplierCategoryMountQualityLegendary; break;
case ITEM_QUALITY_ARTIFACT: advancedPriceingMultiplier = PriceMultiplierCategoryMountQualityArtifact; break; case ITEM_QUALITY_ARTIFACT: advancedPricingMultiplier = PriceMultiplierCategoryMountQualityArtifact; break;
case ITEM_QUALITY_HEIRLOOM: advancedPriceingMultiplier = PriceMultiplierCategoryMountQualityHeirloom; break; case ITEM_QUALITY_HEIRLOOM: advancedPricingMultiplier = PriceMultiplierCategoryMountQualityHeirloom; break;
default: break; default: break;
} }
break; break;
@@ -412,9 +418,9 @@ void AuctionHouseBot::calculateItemValue(ItemTemplate const* itemProto, uint64&
// Set the minimum price // Set the minimum price
if (outBuyoutPrice < PriceMinimumCenterBase) if (outBuyoutPrice < PriceMinimumCenterBase)
outBuyoutPrice = urand(PriceMinimumCenterBase * 0.85, PriceMinimumCenterBase * 1.25); outBuyoutPrice = urand(PriceMinimumCenterBase * (1.0f - BuyoutVariationReducePercent), PriceMinimumCenterBase * (1.0f + BuyoutVariationAddPercent));
else else
outBuyoutPrice = urand(outBuyoutPrice * 0.85, outBuyoutPrice * 1.25); outBuyoutPrice = urand(outBuyoutPrice * (1.0f - BuyoutVariationReducePercent), outBuyoutPrice * (1.0f + BuyoutVariationAddPercent));
// Ensure no multipliers are zero or negative // Ensure no multipliers are zero or negative
if (classPriceMultiplier <= 0.0f) if (classPriceMultiplier <= 0.0f)
@@ -423,8 +429,8 @@ void AuctionHouseBot::calculateItemValue(ItemTemplate const* itemProto, uint64&
qualityPriceMultplier = 1.0f; qualityPriceMultplier = 1.0f;
if (classQualityPriceMultiplier <= 0.0f) if (classQualityPriceMultiplier <= 0.0f)
classQualityPriceMultiplier = 1.0f; classQualityPriceMultiplier = 1.0f;
if (advancedPriceingMultiplier <= 0.0f) if (advancedPricingMultiplier <= 0.0f)
advancedPriceingMultiplier = 1.0f; advancedPricingMultiplier = 1.0f;
// Grab any item level price multipliers // Grab any item level price multipliers
float itemLevelPriceMultplier = 0.0f; float itemLevelPriceMultplier = 0.0f;
@@ -447,15 +453,15 @@ void AuctionHouseBot::calculateItemValue(ItemTemplate const* itemProto, uint64&
case ITEM_CLASS_GLYPH: itemLevelPriceMultplier = PriceMultiplierItemLevelCategoryGlyph; break; case ITEM_CLASS_GLYPH: itemLevelPriceMultplier = PriceMultiplierItemLevelCategoryGlyph; break;
default: break; default: break;
} }
// Multiply the price based on multipliers // Multiply the price based on multipliers
outBuyoutPrice *= qualityPriceMultplier; outBuyoutPrice *= qualityPriceMultplier;
outBuyoutPrice *= classPriceMultiplier; outBuyoutPrice *= classPriceMultiplier;
outBuyoutPrice *= classQualityPriceMultiplier; outBuyoutPrice *= classQualityPriceMultiplier;
outBuyoutPrice *= static_cast<float>(advancedPriceingMultiplier); outBuyoutPrice *= static_cast<float>(advancedPricingMultiplier);
// Only apply item level multiplier if set, and no advanced pricing has been enabled // Only apply item level multiplier if set, and no advanced pricing has been enabled
if (itemLevelPriceMultplier > 0.0f && itemProto->ItemLevel > 0 && advancedPriceingMultiplier == 1.0f) if (itemLevelPriceMultplier > 0.0f && itemProto->ItemLevel > 0 && advancedPricingMultiplier == 1.0f)
outBuyoutPrice *= itemProto->ItemLevel * itemLevelPriceMultplier; outBuyoutPrice *= itemProto->ItemLevel * itemLevelPriceMultplier;
// If a vendor sells this item, make the price at least that high // If a vendor sells this item, make the price at least that high
@@ -463,18 +469,18 @@ void AuctionHouseBot::calculateItemValue(ItemTemplate const* itemProto, uint64&
outBuyoutPrice = itemProto->SellPrice; outBuyoutPrice = itemProto->SellPrice;
// Avoid price overflows // Avoid price overflows
if (outBuyoutPrice > 1000000000) if (outBuyoutPrice > MaxBuyoutPriceInCopper)
outBuyoutPrice = 1000000000; outBuyoutPrice = MaxBuyoutPriceInCopper;
// Calculate a bid price based on a variance against buyout price // Calculate a bid price based on a variance against buyout price
float sellVarianceBidPriceTopPercent = 1; float sellVarianceBidPriceTopPercent = 1.0f - BidVariationHighReducePercent;
float sellVarianceBidPriceBottomPercent = .75; float sellVarianceBidPriceBottomPercent = 1.0f - BidVariationLowReducePercent;
outBidPrice = urand(sellVarianceBidPriceBottomPercent * outBuyoutPrice, sellVarianceBidPriceTopPercent * outBuyoutPrice); outBidPrice = urand(sellVarianceBidPriceBottomPercent * outBuyoutPrice, sellVarianceBidPriceTopPercent * outBuyoutPrice);
// If variance brought price below sell price, bring it back up to avoid making money off vendoring AH items // If variance brought price below sell price, bring it back up to avoid making money off vendoring AH items
if (outBuyoutPrice < itemProto->SellPrice) if (outBuyoutPrice < itemProto->SellPrice)
{ {
float minLowPriceAddVariancePercent = 1.25; float minLowPriceAddVariancePercent = 1.0f + BuyoutBelowVendorVariationAddPercent;
outBuyoutPrice = urand(itemProto->SellPrice, minLowPriceAddVariancePercent * itemProto->SellPrice); outBuyoutPrice = urand(itemProto->SellPrice, minLowPriceAddVariancePercent * itemProto->SellPrice);
} }
@@ -1168,14 +1174,10 @@ void AuctionHouseBot::InitializeConfiguration()
{ {
debug_Out = sConfigMgr->GetOption<bool>("AuctionHouseBot.DEBUG", false); debug_Out = sConfigMgr->GetOption<bool>("AuctionHouseBot.DEBUG", false);
debug_Out_Filters = sConfigMgr->GetOption<bool>("AuctionHouseBot.DEBUG_FILTERS", false); debug_Out_Filters = sConfigMgr->GetOption<bool>("AuctionHouseBot.DEBUG_FILTERS", false);
SellingBotEnabled = sConfigMgr->GetOption<bool>("AuctionHouseBot.EnableSeller", false);
// Buyer Bot // Bot enablement
SellingBotEnabled = sConfigMgr->GetOption<bool>("AuctionHouseBot.EnableSeller", false);
BuyingBotEnabled = sConfigMgr->GetOption<bool>("AuctionHouseBot.Buyer.Enabled", false); BuyingBotEnabled = sConfigMgr->GetOption<bool>("AuctionHouseBot.Buyer.Enabled", false);
CyclesBetweenBuyOrSell = sConfigMgr->GetOption<uint32>("AuctionHouseBot.AuctionHouseManagerCyclesBetweenBuyOrSell", 1);
BuyingBotBuyCandidatesPerBuyCycle = sConfigMgr->GetOption<uint32>("AuctionHouseBot.Buyer.BuyCandidatesPerBuyCycle", 1);
BuyingBotAcceptablePriceModifier = sConfigMgr->GetOption<float>("AuctionHouseBot.Buyer.AcceptablePriceModifier", 1);
if (SellingBotEnabled == false && BuyingBotEnabled == false) if (SellingBotEnabled == false && BuyingBotEnabled == false)
return; return;
string charString = sConfigMgr->GetOption<std::string>("AuctionHouseBot.GUIDs", "0"); string charString = sConfigMgr->GetOption<std::string>("AuctionHouseBot.GUIDs", "0");
@@ -1188,7 +1190,19 @@ void AuctionHouseBot::InitializeConfiguration()
} }
AddCharacters(charString); AddCharacters(charString);
// Buyer & Seller core properties
CyclesBetweenBuyOrSell = sConfigMgr->GetOption<uint32>("AuctionHouseBot.AuctionHouseManagerCyclesBetweenBuyOrSell", 1);
ItemsPerCycle = sConfigMgr->GetOption<uint32>("AuctionHouseBot.ItemsPerCycle", 75); ItemsPerCycle = sConfigMgr->GetOption<uint32>("AuctionHouseBot.ItemsPerCycle", 75);
MaxBuyoutPriceInCopper = sConfigMgr->GetOption<uint32>("AuctionHouseBot.Buyer.BuyCandidatesPerBuyCycle", 1000000000);
BuyoutVariationReducePercent = sConfigMgr->GetOption<float>("AuctionHouseBot.BuyoutVariationReducePercent", 0.15f);
BuyoutVariationAddPercent = sConfigMgr->GetOption<float>("AuctionHouseBot.BuyoutVariationAddPercent", 0.25f);
BidVariationHighReducePercent = sConfigMgr->GetOption<float>("AuctionHouseBot.BidVariationHighReducePercent", 0);
BidVariationLowReducePercent = sConfigMgr->GetOption<float>("AuctionHouseBot.BidVariationLowReducePercent", 0.25f);
BuyoutBelowVendorVariationAddPercent = sConfigMgr->GetOption<float>("AuctionHouseBot.BuyoutBelowVendorVariationAddPercent", 0.25f);
// Buyer Bot
BuyingBotBuyCandidatesPerBuyCycle = sConfigMgr->GetOption<uint32>("AuctionHouseBot.Buyer.BuyCandidatesPerBuyCycle", 1);
BuyingBotAcceptablePriceModifier = sConfigMgr->GetOption<float>("AuctionHouseBot.Buyer.AcceptablePriceModifier", 1);
// Stack Ratios // Stack Ratios
RandomStackRatioConsumable = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomRatio.Consumable", 50); RandomStackRatioConsumable = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomRatio.Consumable", 50);
@@ -1208,21 +1222,21 @@ void AuctionHouseBot::InitializeConfiguration()
RandomStackRatioGlyph = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomRatio.Glyph", 0); RandomStackRatioGlyph = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomRatio.Glyph", 0);
// Stack Ratios // Stack Ratios
RandomStackIncrementConsumable = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Consumable", 5); RandomStackIncrementConsumable = GetRandomStackIncrementValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Consumable", 5);
RandomStackIncrementContainer = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Container", 1); RandomStackIncrementContainer = GetRandomStackIncrementValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Container", 1);
RandomStackIncrementWeapon = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Weapon", 1); RandomStackIncrementWeapon = GetRandomStackIncrementValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Weapon", 1);
RandomStackIncrementGem = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Gem", 1); RandomStackIncrementGem = GetRandomStackIncrementValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Gem", 1);
RandomStackIncrementArmor = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Armor", 1); RandomStackIncrementArmor = GetRandomStackIncrementValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Armor", 1);
RandomStackIncrementReagent = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Reagent", 1); RandomStackIncrementReagent = GetRandomStackIncrementValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Reagent", 1);
RandomStackIncrementProjectile = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Projectile", 1000); RandomStackIncrementProjectile = GetRandomStackIncrementValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Projectile", 1000);
RandomStackIncrementTradeGood = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.TradeGood", 5); RandomStackIncrementTradeGood = GetRandomStackIncrementValue("AuctionHouseBot.ListingStack.RandomStackIncrement.TradeGood", 5);
RandomStackIncrementGeneric = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Generic", 1); RandomStackIncrementGeneric = GetRandomStackIncrementValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Generic", 1);
RandomStackIncrementRecipe = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Recipe", 1); RandomStackIncrementRecipe = GetRandomStackIncrementValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Recipe", 1);
RandomStackIncrementQuiver = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Quiver", 1); RandomStackIncrementQuiver = GetRandomStackIncrementValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Quiver", 1);
RandomStackIncrementQuest = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Quest", 1); RandomStackIncrementQuest = GetRandomStackIncrementValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Quest", 1);
RandomStackIncrementKey = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Key", 1); RandomStackIncrementKey = GetRandomStackIncrementValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Key", 1);
RandomStackIncrementMisc = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Misc", 1); RandomStackIncrementMisc = GetRandomStackIncrementValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Misc", 1);
RandomStackIncrementGlyph = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Glyph", 1); RandomStackIncrementGlyph = GetRandomStackIncrementValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Glyph", 1);
// List Proportions // List Proportions
ListProportionConsumable = sConfigMgr->GetOption<uint32>("AuctionHouseBot.ListProportion.Consumable", 2); ListProportionConsumable = sConfigMgr->GetOption<uint32>("AuctionHouseBot.ListProportion.Consumable", 2);
@@ -1372,6 +1386,17 @@ uint32 AuctionHouseBot::GetRandomStackValue(std::string configKeyString, uint32
return stackValue; return stackValue;
} }
uint32 AuctionHouseBot::GetRandomStackIncrementValue(std::string configKeyString, uint32 defaultValue)
{
uint32 stackIncrementValue = sConfigMgr->GetOption<uint32>(configKeyString, defaultValue);
if (stackIncrementValue <= 0)
{
LOG_ERROR("module", "{} value is invalid. Setting to default ({}).", configKeyString, defaultValue);
stackIncrementValue = defaultValue;
}
return stackIncrementValue;
}
void AuctionHouseBot::AddCharacters(std::string characterGUIDString) void AuctionHouseBot::AddCharacters(std::string characterGUIDString)
{ {
std::string delimitedValue; std::string delimitedValue;

View File

@@ -122,10 +122,14 @@ private:
bool SellingBotEnabled; bool SellingBotEnabled;
bool BuyingBotEnabled; bool BuyingBotEnabled;
int CyclesBetweenBuyOrSell; int CyclesBetweenBuyOrSell;
uint32 MaxBuyoutPriceInCopper;
float BuyoutVariationReducePercent;
float BuyoutVariationAddPercent;
float BidVariationHighReducePercent;
float BidVariationLowReducePercent;
float BuyoutBelowVendorVariationAddPercent;
uint32 BuyingBotBuyCandidatesPerBuyCycle; uint32 BuyingBotBuyCandidatesPerBuyCycle;
float BuyingBotAcceptablePriceModifier; float BuyingBotAcceptablePriceModifier;
std::string AHCharactersGUIDsForQuery; std::string AHCharactersGUIDsForQuery;
uint32 ItemsPerCycle; uint32 ItemsPerCycle;
bool DisabledItemTextFilter; bool DisabledItemTextFilter;
@@ -288,6 +292,7 @@ public:
void Initialize(); void Initialize();
void InitializeConfiguration(); void InitializeConfiguration();
uint32 GetRandomStackValue(std::string configKeyString, uint32 defaultValue); uint32 GetRandomStackValue(std::string configKeyString, uint32 defaultValue);
uint32 GetRandomStackIncrementValue(std::string configKeyString, uint32 defaultValue);
void AddCharacters(std::string characterGUIDString); void AddCharacters(std::string characterGUIDString);
void AddPriceMinimumOverrides(std::string priceMinimimOverridesString); void AddPriceMinimumOverrides(std::string priceMinimimOverridesString);