From 117383c29609a35f60982d47563c1275ebfa00ef Mon Sep 17 00:00:00 2001 From: NathanHandley Date: Mon, 20 Jan 2025 11:51:05 -0600 Subject: [PATCH] Make listing proportions set in the config --- conf/mod_ahbot.conf.dist | 39 +++++++++++++++++++++ src/AuctionHouseBot.cpp | 76 ++++++++++++++++++++-------------------- src/AuctionHouseBot.h | 19 ++++++++-- 3 files changed, 94 insertions(+), 40 deletions(-) diff --git a/conf/mod_ahbot.conf.dist b/conf/mod_ahbot.conf.dist index 66d2143..a3a4d04 100644 --- a/conf/mod_ahbot.conf.dist +++ b/conf/mod_ahbot.conf.dist @@ -64,6 +64,43 @@ AuctionHouseBot.Neutral.MaxItems = 20000 AuctionHouseBot.Neutral.BidInterval = 1 AuctionHouseBot.Neutral.BidsPerInterval = 1 +############################################################################### +# AuctionHouseBot.ListProportion.* +# Determines how many of the listings, proportionally, show up as new auctions +# "0" will mean the item never shows up +# Defaults: Consumable: 2 +# Container: 2 +# Weapon: 6 +# Gem: 2 +# Armor: 6 +# Reagent: 1 +# Projectile: 2 +# TradeGood: 22 +# Generic: 1 +# Recipe: 3 +# Quiver: 1 +# Quest: 2 +# Key: 1 +# Misc: 0 +# Glyph: 2 +############################################################################### + +AuctionHouseBot.ListProportion.Consumable = 2 +AuctionHouseBot.ListProportion.Container = 2 +AuctionHouseBot.ListProportion.Weapon = 6 +AuctionHouseBot.ListProportion.Gem = 2 +AuctionHouseBot.ListProportion.Armor = 6 +AuctionHouseBot.ListProportion.Reagent = 1 +AuctionHouseBot.ListProportion.Projectile = 2 +AuctionHouseBot.ListProportion.TradeGood = 22 +AuctionHouseBot.ListProportion.Generic = 1 +AuctionHouseBot.ListProportion.Recipe = 3 +AuctionHouseBot.ListProportion.Quiver = 1 +AuctionHouseBot.ListProportion.Quest = 2 +AuctionHouseBot.ListProportion.Key = 1 +AuctionHouseBot.ListProportion.Misc = 0 +AuctionHouseBot.ListProportion.Glyph = 2 + ############################################################################### # AuctionHouseBot.RandomStackRatio.* # Used to determine how often a stack of the class will be single or randomly-size stacked when posted @@ -115,6 +152,8 @@ AuctionHouseBot.RandomStackRatio.Glyph = 0 # # AuctionHouseBot.DisabledCraftedItemIDs # Additional Comma separated list of itemIDs to exclude from listing by the seller +# which were originally put in to remove crafted items and fish, in order +# encourage people to level their tradeskills # Ranges using a dash (-) can also be used ############################################################################### diff --git a/src/AuctionHouseBot.cpp b/src/AuctionHouseBot.cpp index 1d22469..48884a1 100644 --- a/src/AuctionHouseBot.cpp +++ b/src/AuctionHouseBot.cpp @@ -176,49 +176,32 @@ void AuctionHouseBot::calculateItemValue(ItemTemplate const* itemProto, uint64& void AuctionHouseBot::populatetemClassSeedListForItemClass(uint32 itemClass, uint32 itemClassSeedWeight) { for (uint32 i = 0; i < itemClassSeedWeight; ++i) - itemCandidateClassWeightedSeedList.push_back(itemClass); + itemCandidateClassWeightedProportionList.push_back(itemClass); } -void AuctionHouseBot::populateItemClassSeedList() +void AuctionHouseBot::populateItemClassProportionList() { // Determine how many of what kinds of items to use based on a seeded weight list, 0 = none - // TODO: Move these weight items to a config - uint32 itemClassSeedWeightConsumable = 2; - uint32 itemClassSeedWeightContainer = 2; - uint32 itemClassSeedWeightWeapon = 6; - uint32 itemClassSeedWeightGem = 2; - uint32 itemClassSeedWeightArmor = 6; - uint32 itemClassSeedWeightReagent = 1; - uint32 itemClassSeedWeightProjectile = 2; - uint32 itemClassSeedWeightTradeGoods = 22; - uint32 itemClassSeedWeightGeneric = 1; - uint32 itemClassSeedWeightRecipe = 3; - uint32 itemClassSeedWeightQuiver = 1; - uint32 itemClassSeedWeightQuest = 2; - uint32 itemClassSeedWeightKey = 1; - uint32 itemClassSeedWeightMisc = 0; - uint32 itemClassSeedWeightGlyph = 2; - // Clear old list - itemCandidateClassWeightedSeedList.clear(); + itemCandidateClassWeightedProportionList.clear(); // Fill the list - populatetemClassSeedListForItemClass(ITEM_CLASS_CONSUMABLE, itemClassSeedWeightConsumable); - populatetemClassSeedListForItemClass(ITEM_CLASS_CONTAINER, itemClassSeedWeightContainer); - populatetemClassSeedListForItemClass(ITEM_CLASS_WEAPON, itemClassSeedWeightWeapon); - populatetemClassSeedListForItemClass(ITEM_CLASS_GEM, itemClassSeedWeightGem); - populatetemClassSeedListForItemClass(ITEM_CLASS_ARMOR, itemClassSeedWeightArmor); - populatetemClassSeedListForItemClass(ITEM_CLASS_REAGENT, itemClassSeedWeightReagent); - populatetemClassSeedListForItemClass(ITEM_CLASS_PROJECTILE, itemClassSeedWeightProjectile); - populatetemClassSeedListForItemClass(ITEM_CLASS_TRADE_GOODS, itemClassSeedWeightTradeGoods); - populatetemClassSeedListForItemClass(ITEM_CLASS_GENERIC, itemClassSeedWeightGeneric); - populatetemClassSeedListForItemClass(ITEM_CLASS_RECIPE, itemClassSeedWeightRecipe); - populatetemClassSeedListForItemClass(ITEM_CLASS_QUIVER, itemClassSeedWeightQuiver); - populatetemClassSeedListForItemClass(ITEM_CLASS_QUEST, itemClassSeedWeightQuest); - populatetemClassSeedListForItemClass(ITEM_CLASS_KEY, itemClassSeedWeightKey); - populatetemClassSeedListForItemClass(ITEM_CLASS_MISC, itemClassSeedWeightMisc); - populatetemClassSeedListForItemClass(ITEM_CLASS_GLYPH, itemClassSeedWeightGlyph); + populatetemClassSeedListForItemClass(ITEM_CLASS_CONSUMABLE, ListProportionConsumable); + populatetemClassSeedListForItemClass(ITEM_CLASS_CONTAINER, ListProportionContainer); + populatetemClassSeedListForItemClass(ITEM_CLASS_WEAPON, ListProportionWeapon); + populatetemClassSeedListForItemClass(ITEM_CLASS_GEM, ListProportionGem); + populatetemClassSeedListForItemClass(ITEM_CLASS_ARMOR, ListProportionArmor); + populatetemClassSeedListForItemClass(ITEM_CLASS_REAGENT, ListProportionReagent); + populatetemClassSeedListForItemClass(ITEM_CLASS_PROJECTILE, ListProportionProjectile); + populatetemClassSeedListForItemClass(ITEM_CLASS_TRADE_GOODS, ListProportionTradeGood); + populatetemClassSeedListForItemClass(ITEM_CLASS_GENERIC, ListProportionGeneric); + populatetemClassSeedListForItemClass(ITEM_CLASS_RECIPE, ListProportionRecipe); + populatetemClassSeedListForItemClass(ITEM_CLASS_QUIVER, ListProportionQuiver); + populatetemClassSeedListForItemClass(ITEM_CLASS_QUEST, ListProportionQuest); + populatetemClassSeedListForItemClass(ITEM_CLASS_KEY, ListProportionKey); + populatetemClassSeedListForItemClass(ITEM_CLASS_MISC, ListProportionMisc); + populatetemClassSeedListForItemClass(ITEM_CLASS_GLYPH, ListProportionGlyph); } void AuctionHouseBot::populateItemCandidateList() @@ -278,7 +261,7 @@ void AuctionHouseBot::populateItemCandidateList() } // Skip any items not in the seed list - if (std::find(itemCandidateClassWeightedSeedList.begin(), itemCandidateClassWeightedSeedList.end(), itr->second.Class) == itemCandidateClassWeightedSeedList.end()) + if (std::find(itemCandidateClassWeightedProportionList.begin(), itemCandidateClassWeightedProportionList.end(), itr->second.Class) == itemCandidateClassWeightedProportionList.end()) continue; // Skip any BOP items @@ -485,7 +468,7 @@ void AuctionHouseBot::addNewAuctions(Player *AHBplayer, AHBConfig *config) LOG_ERROR("module", "AHSeller: {} count", cnt); // Pull a random item out of the candidate list - uint32 chosenItemClass = itemCandidateClassWeightedSeedList[urand(0, itemCandidateClassWeightedSeedList.size() - 1)]; + uint32 chosenItemClass = itemCandidateClassWeightedProportionList[urand(0, itemCandidateClassWeightedProportionList.size() - 1)]; uint32 itemID = 0; if (itemCandidatesByItemClass[chosenItemClass].size() != 0) itemID = itemCandidatesByItemClass[chosenItemClass][urand(0, itemCandidatesByItemClass[chosenItemClass].size() - 1)]; @@ -775,7 +758,7 @@ void AuctionHouseBot::Update() void AuctionHouseBot::Initialize() { // Build a list of items that can be pulled from for auction - populateItemClassSeedList(); + populateItemClassProportionList(); populateItemCandidateList(); } @@ -808,6 +791,23 @@ void AuctionHouseBot::InitializeConfiguration() RandomStackRatioMisc = GetRandomStackValue("AuctionHouseBot.RandomStackRatio.Misc", 100); RandomStackRatioGlyph = GetRandomStackValue("AuctionHouseBot.RandomStackRatio.Glyph", 0); + // List Proportions + ListProportionConsumable = GetRandomStackValue("AuctionHouseBot.ListProportion.Consumable", 2); + ListProportionContainer = GetRandomStackValue("AuctionHouseBot.ListProportion.Container", 2); + ListProportionWeapon = GetRandomStackValue("AuctionHouseBot.ListProportion.Weapon", 6); + ListProportionGem = GetRandomStackValue("AuctionHouseBot.ListProportion.Gem", 2); + ListProportionArmor = GetRandomStackValue("AuctionHouseBot.ListProportion.Armor", 6); + ListProportionReagent = GetRandomStackValue("AuctionHouseBot.ListProportion.Reagent", 1); + ListProportionProjectile = GetRandomStackValue("AuctionHouseBot.ListProportion.Projectile", 2); + ListProportionTradeGood = GetRandomStackValue("AuctionHouseBot.ListProportion.TradeGood", 22); + ListProportionGeneric = GetRandomStackValue("AuctionHouseBot.ListProportion.Generic", 1); + ListProportionRecipe = GetRandomStackValue("AuctionHouseBot.ListProportion.Recipe", 3); + ListProportionQuiver = GetRandomStackValue("AuctionHouseBot.ListProportion.Quiver", 1); + ListProportionQuest = GetRandomStackValue("AuctionHouseBot.ListProportion.Quest", 2); + ListProportionKey = GetRandomStackValue("AuctionHouseBot.ListProportion.Key", 1); + ListProportionMisc = GetRandomStackValue("AuctionHouseBot.ListProportion.Misc", 0); + ListProportionGlyph = GetRandomStackValue("AuctionHouseBot.ListProportion.Glyph", 2); + // Disabled Items DisabledItemTextFilter = sConfigMgr->GetOption("AuctionHouseBot.DisabledItemTextFilter", true); DisabledItems.clear(); diff --git a/src/AuctionHouseBot.h b/src/AuctionHouseBot.h index 293e50e..7ea2d78 100644 --- a/src/AuctionHouseBot.h +++ b/src/AuctionHouseBot.h @@ -151,8 +151,23 @@ private: uint32 RandomStackRatioKey; uint32 RandomStackRatioMisc; uint32 RandomStackRatioGlyph; - std::vector itemCandidateClassWeightedSeedList; + std::vector itemCandidateClassWeightedProportionList; std::map> itemCandidatesByItemClass; + uint32 ListProportionConsumable; + uint32 ListProportionContainer; + uint32 ListProportionWeapon; + uint32 ListProportionGem; + uint32 ListProportionArmor; + uint32 ListProportionReagent; + uint32 ListProportionProjectile; + uint32 ListProportionTradeGood; + uint32 ListProportionGeneric; + uint32 ListProportionRecipe; + uint32 ListProportionQuiver; + uint32 ListProportionQuest; + uint32 ListProportionKey; + uint32 ListProportionMisc; + uint32 ListProportionGlyph; AHBConfig AllianceConfig; AHBConfig HordeConfig; @@ -166,7 +181,7 @@ private: uint32 getStackSizeForItem(ItemTemplate const* itemProto) const; void calculateItemValue(ItemTemplate const* itemProto, uint64& outBidPrice, uint64& outBuyoutPrice); void populatetemClassSeedListForItemClass(uint32 itemClass, uint32 itemClassSeedWeight); - void populateItemClassSeedList(); + void populateItemClassProportionList(); void populateItemCandidateList(); void addNewAuctions(Player *AHBplayer, AHBConfig *config); void addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *config, WorldSession *session);