From 442360631b840103f86523cc0fcb5613e06c8f76 Mon Sep 17 00:00:00 2001 From: NathanHandley Date: Tue, 16 Sep 2025 19:32:12 -0500 Subject: [PATCH] Move remaining magic numbers to configs --- conf/mod_ahbot.conf.dist | 109 +++++++++++++++++++++++----------- src/AuctionHouseBot.cpp | 123 +++++++++++++++++++++++---------------- src/AuctionHouseBot.h | 9 ++- 3 files changed, 156 insertions(+), 85 deletions(-) diff --git a/conf/mod_ahbot.conf.dist b/conf/mod_ahbot.conf.dist index de4f98b..44617d6 100644 --- a/conf/mod_ahbot.conf.dist +++ b/conf/mod_ahbot.conf.dist @@ -10,6 +10,12 @@ # Enable/Disable Debugging output from Filters # 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 # Enable/Disable the part of AHBot that puts items up for auction # Default 0 (disabled) @@ -33,20 +39,67 @@ # from startup complete to first character being able to log in) so a # value greater than a few hundred is not recommended. # 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_FILTERS = 0 +AuctionHouseBot.AuctionHouseManagerCyclesBetweenBuyOrSell = 1 AuctionHouseBot.EnableSeller = 0 AuctionHouseBot.GUIDs = 0 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..MinItems +# AuctionHouseBot..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 @@ -89,7 +142,9 @@ AuctionHouseBot.AuctionHouseManagerCyclesBetweenBuyOrSell = 1 # how much it is willing to spend. # 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 -# 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 ############################################################################### @@ -97,20 +152,6 @@ AuctionHouseBot.Buyer.Enabled = 0 AuctionHouseBot.Buyer.BuyCandidatesPerBuyCycle = 1 AuctionHouseBot.Buyer.AcceptablePriceModifier = 1 -############################################################################### -# AuctionHouseBot..MinItems -# AuctionHouseBot..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.* # 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 # actually be a +/- 25% range of this value. Used to catch 0 cost or # 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 @@ -172,15 +220,6 @@ AuctionHouseBot.PriceMinimumCenterBase.Key = 1000 AuctionHouseBot.PriceMinimumCenterBase.Misc = 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 = ############################################################################### @@ -200,7 +239,8 @@ AuctionHouseBot.PriceMinimumCenterBase.OverrideItems = # Note that all price multpliers (along with the advanced pricing) are applied # 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 -# (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 @@ -224,8 +264,9 @@ AuctionHouseBot.AdvancedPricing.Misc.Mount.Enabled = 1 # Multiplier applied to item level when determining auction price, by category # Final multiplier = itemLevel * this value. Set to 0 (or less) to disable. # Default: 0 (Disabled) -# Note: This will be ignored if AdvancedPricing is enabled (above), but this -# will apply in combination with other price multipliers +# Note: This will be ignored for any matching specific category above if +# AdvancedPricing is enabled (above). This applies in combination with +# all other price multipliers # # AuctionHouseBot.PriceMultiplier.Category*.Quality* # Category-and-Quality- modifier values for the prices of items. diff --git a/src/AuctionHouseBot.cpp b/src/AuctionHouseBot.cpp index 1b1ef3b..dc09a4f 100644 --- a/src/AuctionHouseBot.cpp +++ b/src/AuctionHouseBot.cpp @@ -42,6 +42,12 @@ AuctionHouseBot::AuctionHouseBot() : SellingBotEnabled(false), BuyingBotEnabled(false), CyclesBetweenBuyOrSell(1), + MaxBuyoutPriceInCopper(1000000000), + BuyoutVariationReducePercent(0.15f), + BuyoutVariationAddPercent(0.25f), + BidVariationHighReducePercent(0), + BidVariationLowReducePercent(0.25f), + BuyoutBelowVendorVariationAddPercent(0.25f), BuyingBotBuyCandidatesPerBuyCycle(1), BuyingBotAcceptablePriceModifier(1), 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 - double advancedPriceingMultiplier = 1.0f; + double advancedPricingMultiplier = 1.0f; if (itemProto->Class == ITEM_CLASS_TRADE_GOODS) { switch (itemProto->SubClass) @@ -301,7 +307,7 @@ void AuctionHouseBot::calculateItemValue(ItemTemplate const* itemProto, uint64& if (!AdvancedPricingTradeGoodClothEnabled) break; 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; } case ITEM_SUBCLASS_HERB: @@ -309,7 +315,7 @@ void AuctionHouseBot::calculateItemValue(ItemTemplate const* itemProto, uint64& if (!AdvancedPricingTradeGoodHerbEnabled) break; 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; } case ITEM_SUBCLASS_METAL_STONE: @@ -317,7 +323,7 @@ void AuctionHouseBot::calculateItemValue(ItemTemplate const* itemProto, uint64& if (!AdvancedPricingTradeGoodMetalStoneEnabled) break; 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; } case ITEM_SUBCLASS_LEATHER: @@ -325,7 +331,7 @@ void AuctionHouseBot::calculateItemValue(ItemTemplate const* itemProto, uint64& if (!AdvancedPricingTradeGoodLeatherEnabled) break; 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; } case ITEM_SUBCLASS_ENCHANTING: @@ -333,14 +339,14 @@ void AuctionHouseBot::calculateItemValue(ItemTemplate const* itemProto, uint64& if (!AdvancedPricingTradeGoodEnchantingEnabled) break; 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; } case ITEM_SUBCLASS_ELEMENTAL: { if (!AdvancedPricingTradeGoodElementalEnabled) break; - advancedPriceingMultiplier = 85 - (itemProto->ItemLevel / 0.97); + advancedPricingMultiplier = 85 - (itemProto->ItemLevel / 0.97); break; } default: @@ -357,7 +363,7 @@ void AuctionHouseBot::calculateItemValue(ItemTemplate const* itemProto, uint64& if (!AdvancedPricingMiscJunkEnabled) break; 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; } case ITEM_SUBCLASS_JUNK_MOUNT: @@ -366,14 +372,14 @@ void AuctionHouseBot::calculateItemValue(ItemTemplate const* itemProto, uint64& break; switch (itemProto->Quality) { - case ITEM_QUALITY_POOR: advancedPriceingMultiplier = PriceMultiplierCategoryMountQualityPoor; break; - case ITEM_QUALITY_NORMAL: advancedPriceingMultiplier = PriceMultiplierCategoryMountQualityNormal; break; - case ITEM_QUALITY_UNCOMMON: advancedPriceingMultiplier = PriceMultiplierCategoryMountQualityUncommon; break; - case ITEM_QUALITY_RARE: advancedPriceingMultiplier = PriceMultiplierCategoryMountQualityRare; break; - case ITEM_QUALITY_EPIC: advancedPriceingMultiplier = PriceMultiplierCategoryMountQualityEpic; break; - case ITEM_QUALITY_LEGENDARY: advancedPriceingMultiplier = PriceMultiplierCategoryMountQualityLegendary; break; - case ITEM_QUALITY_ARTIFACT: advancedPriceingMultiplier = PriceMultiplierCategoryMountQualityArtifact; break; - case ITEM_QUALITY_HEIRLOOM: advancedPriceingMultiplier = PriceMultiplierCategoryMountQualityHeirloom; break; + case ITEM_QUALITY_POOR: advancedPricingMultiplier = PriceMultiplierCategoryMountQualityPoor; break; + case ITEM_QUALITY_NORMAL: advancedPricingMultiplier = PriceMultiplierCategoryMountQualityNormal; break; + case ITEM_QUALITY_UNCOMMON: advancedPricingMultiplier = PriceMultiplierCategoryMountQualityUncommon; break; + case ITEM_QUALITY_RARE: advancedPricingMultiplier = PriceMultiplierCategoryMountQualityRare; break; + case ITEM_QUALITY_EPIC: advancedPricingMultiplier = PriceMultiplierCategoryMountQualityEpic; break; + case ITEM_QUALITY_LEGENDARY: advancedPricingMultiplier = PriceMultiplierCategoryMountQualityLegendary; break; + case ITEM_QUALITY_ARTIFACT: advancedPricingMultiplier = PriceMultiplierCategoryMountQualityArtifact; break; + case ITEM_QUALITY_HEIRLOOM: advancedPricingMultiplier = PriceMultiplierCategoryMountQualityHeirloom; break; default: break; } break; @@ -412,9 +418,9 @@ void AuctionHouseBot::calculateItemValue(ItemTemplate const* itemProto, uint64& // Set the minimum price if (outBuyoutPrice < PriceMinimumCenterBase) - outBuyoutPrice = urand(PriceMinimumCenterBase * 0.85, PriceMinimumCenterBase * 1.25); + outBuyoutPrice = urand(PriceMinimumCenterBase * (1.0f - BuyoutVariationReducePercent), PriceMinimumCenterBase * (1.0f + BuyoutVariationAddPercent)); 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 if (classPriceMultiplier <= 0.0f) @@ -423,8 +429,8 @@ void AuctionHouseBot::calculateItemValue(ItemTemplate const* itemProto, uint64& qualityPriceMultplier = 1.0f; if (classQualityPriceMultiplier <= 0.0f) classQualityPriceMultiplier = 1.0f; - if (advancedPriceingMultiplier <= 0.0f) - advancedPriceingMultiplier = 1.0f; + if (advancedPricingMultiplier <= 0.0f) + advancedPricingMultiplier = 1.0f; // Grab any item level price multipliers float itemLevelPriceMultplier = 0.0f; @@ -447,15 +453,15 @@ void AuctionHouseBot::calculateItemValue(ItemTemplate const* itemProto, uint64& case ITEM_CLASS_GLYPH: itemLevelPriceMultplier = PriceMultiplierItemLevelCategoryGlyph; break; default: break; } - + // Multiply the price based on multipliers outBuyoutPrice *= qualityPriceMultplier; outBuyoutPrice *= classPriceMultiplier; outBuyoutPrice *= classQualityPriceMultiplier; - outBuyoutPrice *= static_cast(advancedPriceingMultiplier); + outBuyoutPrice *= static_cast(advancedPricingMultiplier); // 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; // 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; // Avoid price overflows - if (outBuyoutPrice > 1000000000) - outBuyoutPrice = 1000000000; + if (outBuyoutPrice > MaxBuyoutPriceInCopper) + outBuyoutPrice = MaxBuyoutPriceInCopper; // Calculate a bid price based on a variance against buyout price - float sellVarianceBidPriceTopPercent = 1; - float sellVarianceBidPriceBottomPercent = .75; + float sellVarianceBidPriceTopPercent = 1.0f - BidVariationHighReducePercent; + float sellVarianceBidPriceBottomPercent = 1.0f - BidVariationLowReducePercent; 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 (outBuyoutPrice < itemProto->SellPrice) { - float minLowPriceAddVariancePercent = 1.25; + float minLowPriceAddVariancePercent = 1.0f + BuyoutBelowVendorVariationAddPercent; outBuyoutPrice = urand(itemProto->SellPrice, minLowPriceAddVariancePercent * itemProto->SellPrice); } @@ -1168,14 +1174,10 @@ void AuctionHouseBot::InitializeConfiguration() { debug_Out = sConfigMgr->GetOption("AuctionHouseBot.DEBUG", false); debug_Out_Filters = sConfigMgr->GetOption("AuctionHouseBot.DEBUG_FILTERS", false); - SellingBotEnabled = sConfigMgr->GetOption("AuctionHouseBot.EnableSeller", false); - // Buyer Bot + // Bot enablement + SellingBotEnabled = sConfigMgr->GetOption("AuctionHouseBot.EnableSeller", false); BuyingBotEnabled = sConfigMgr->GetOption("AuctionHouseBot.Buyer.Enabled", false); - CyclesBetweenBuyOrSell = sConfigMgr->GetOption("AuctionHouseBot.AuctionHouseManagerCyclesBetweenBuyOrSell", 1); - BuyingBotBuyCandidatesPerBuyCycle = sConfigMgr->GetOption("AuctionHouseBot.Buyer.BuyCandidatesPerBuyCycle", 1); - BuyingBotAcceptablePriceModifier = sConfigMgr->GetOption("AuctionHouseBot.Buyer.AcceptablePriceModifier", 1); - if (SellingBotEnabled == false && BuyingBotEnabled == false) return; string charString = sConfigMgr->GetOption("AuctionHouseBot.GUIDs", "0"); @@ -1188,7 +1190,19 @@ void AuctionHouseBot::InitializeConfiguration() } AddCharacters(charString); + // Buyer & Seller core properties + CyclesBetweenBuyOrSell = sConfigMgr->GetOption("AuctionHouseBot.AuctionHouseManagerCyclesBetweenBuyOrSell", 1); ItemsPerCycle = sConfigMgr->GetOption("AuctionHouseBot.ItemsPerCycle", 75); + MaxBuyoutPriceInCopper = sConfigMgr->GetOption("AuctionHouseBot.Buyer.BuyCandidatesPerBuyCycle", 1000000000); + BuyoutVariationReducePercent = sConfigMgr->GetOption("AuctionHouseBot.BuyoutVariationReducePercent", 0.15f); + BuyoutVariationAddPercent = sConfigMgr->GetOption("AuctionHouseBot.BuyoutVariationAddPercent", 0.25f); + BidVariationHighReducePercent = sConfigMgr->GetOption("AuctionHouseBot.BidVariationHighReducePercent", 0); + BidVariationLowReducePercent = sConfigMgr->GetOption("AuctionHouseBot.BidVariationLowReducePercent", 0.25f); + BuyoutBelowVendorVariationAddPercent = sConfigMgr->GetOption("AuctionHouseBot.BuyoutBelowVendorVariationAddPercent", 0.25f); + + // Buyer Bot + BuyingBotBuyCandidatesPerBuyCycle = sConfigMgr->GetOption("AuctionHouseBot.Buyer.BuyCandidatesPerBuyCycle", 1); + BuyingBotAcceptablePriceModifier = sConfigMgr->GetOption("AuctionHouseBot.Buyer.AcceptablePriceModifier", 1); // Stack Ratios RandomStackRatioConsumable = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomRatio.Consumable", 50); @@ -1208,21 +1222,21 @@ void AuctionHouseBot::InitializeConfiguration() RandomStackRatioGlyph = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomRatio.Glyph", 0); // Stack Ratios - RandomStackIncrementConsumable = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Consumable", 5); - RandomStackIncrementContainer = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Container", 1); - RandomStackIncrementWeapon = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Weapon", 1); - RandomStackIncrementGem = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Gem", 1); - RandomStackIncrementArmor = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Armor", 1); - RandomStackIncrementReagent = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Reagent", 1); - RandomStackIncrementProjectile = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Projectile", 1000); - RandomStackIncrementTradeGood = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.TradeGood", 5); - RandomStackIncrementGeneric = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Generic", 1); - RandomStackIncrementRecipe = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Recipe", 1); - RandomStackIncrementQuiver = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Quiver", 1); - RandomStackIncrementQuest = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Quest", 1); - RandomStackIncrementKey = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Key", 1); - RandomStackIncrementMisc = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Misc", 1); - RandomStackIncrementGlyph = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Glyph", 1); + RandomStackIncrementConsumable = GetRandomStackIncrementValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Consumable", 5); + RandomStackIncrementContainer = GetRandomStackIncrementValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Container", 1); + RandomStackIncrementWeapon = GetRandomStackIncrementValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Weapon", 1); + RandomStackIncrementGem = GetRandomStackIncrementValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Gem", 1); + RandomStackIncrementArmor = GetRandomStackIncrementValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Armor", 1); + RandomStackIncrementReagent = GetRandomStackIncrementValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Reagent", 1); + RandomStackIncrementProjectile = GetRandomStackIncrementValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Projectile", 1000); + RandomStackIncrementTradeGood = GetRandomStackIncrementValue("AuctionHouseBot.ListingStack.RandomStackIncrement.TradeGood", 5); + RandomStackIncrementGeneric = GetRandomStackIncrementValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Generic", 1); + RandomStackIncrementRecipe = GetRandomStackIncrementValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Recipe", 1); + RandomStackIncrementQuiver = GetRandomStackIncrementValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Quiver", 1); + RandomStackIncrementQuest = GetRandomStackIncrementValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Quest", 1); + RandomStackIncrementKey = GetRandomStackIncrementValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Key", 1); + RandomStackIncrementMisc = GetRandomStackIncrementValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Misc", 1); + RandomStackIncrementGlyph = GetRandomStackIncrementValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Glyph", 1); // List Proportions ListProportionConsumable = sConfigMgr->GetOption("AuctionHouseBot.ListProportion.Consumable", 2); @@ -1372,6 +1386,17 @@ uint32 AuctionHouseBot::GetRandomStackValue(std::string configKeyString, uint32 return stackValue; } +uint32 AuctionHouseBot::GetRandomStackIncrementValue(std::string configKeyString, uint32 defaultValue) +{ + uint32 stackIncrementValue = sConfigMgr->GetOption(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) { std::string delimitedValue; diff --git a/src/AuctionHouseBot.h b/src/AuctionHouseBot.h index bdc3f49..d3c309a 100644 --- a/src/AuctionHouseBot.h +++ b/src/AuctionHouseBot.h @@ -122,10 +122,14 @@ private: bool SellingBotEnabled; bool BuyingBotEnabled; int CyclesBetweenBuyOrSell; - + uint32 MaxBuyoutPriceInCopper; + float BuyoutVariationReducePercent; + float BuyoutVariationAddPercent; + float BidVariationHighReducePercent; + float BidVariationLowReducePercent; + float BuyoutBelowVendorVariationAddPercent; uint32 BuyingBotBuyCandidatesPerBuyCycle; float BuyingBotAcceptablePriceModifier; - std::string AHCharactersGUIDsForQuery; uint32 ItemsPerCycle; bool DisabledItemTextFilter; @@ -288,6 +292,7 @@ public: void Initialize(); void InitializeConfiguration(); uint32 GetRandomStackValue(std::string configKeyString, uint32 defaultValue); + uint32 GetRandomStackIncrementValue(std::string configKeyString, uint32 defaultValue); void AddCharacters(std::string characterGUIDString); void AddPriceMinimumOverrides(std::string priceMinimimOverridesString);