From 1b8a3be492f4e881c8b79e829192df340417449a Mon Sep 17 00:00:00 2001 From: NathanHandley Date: Tue, 16 Sep 2025 08:50:06 -0500 Subject: [PATCH] Add item ID restriction to config --- conf/mod_ahbot.conf.dist | 87 +++++++++++++++++++++++++++++----------- src/AuctionHouseBot.cpp | 55 +++++++++++++++++++++---- src/AuctionHouseBot.h | 4 ++ 3 files changed, 114 insertions(+), 32 deletions(-) diff --git a/conf/mod_ahbot.conf.dist b/conf/mod_ahbot.conf.dist index df84b8a..3fdcd36 100644 --- a/conf/mod_ahbot.conf.dist +++ b/conf/mod_ahbot.conf.dist @@ -97,30 +97,6 @@ AuctionHouseBot.Buyer.Enabled = 0 AuctionHouseBot.Buyer.BuyCandidatesPerBuyCycle = 1 AuctionHouseBot.Buyer.AcceptablePriceModifier = 1 -############################################################################### -# AuctionHouseBot.ListedItemLevelRestrict.Enabled -# If true, the item level will be restricted in listings -# Default: false -# -# AuctionHouseBot.ListedItemLevelRestrict.MaxItemLevel -# The highest item level that will show up in listings -# Default: 999 -# -# AuctionHouseBot.ListedItemLevelRestrict.MinItemLevel -# The lowest item level that will show up in listings -# Default: 0 -# -# AuctionHouseBot.ListedItemLevelRestrict.ExceptionItemIDs -# Comma separated list of itemIDs to exclude from any item level restriction logic -# Ranges using a dash (-) can also be used -# NOTE: The disabled item list will still be honored even if it's listed here -############################################################################### - -AuctionHouseBot.ListedItemLevelRestrict.Enabled = false -AuctionHouseBot.ListedItemLevelRestrict.MaxItemLevel = 999 -AuctionHouseBot.ListedItemLevelRestrict.MinItemLevel = 0 -AuctionHouseBot.ListedItemLevelRestrict.ExceptionItemIDs = - ############################################################################### # AuctionHouseBot..MinItems # AuctionHouseBot..MaxItems @@ -220,6 +196,11 @@ AuctionHouseBot.PriceMinimumCenterBase.OverrideItems = # Note that the AdvancedPricing logic also relies on values # set by AuctionHouseBot.PriceMultiplier.Category*.Quality* # Defaults: 1 (Enabled) +# +# 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. ############################################################################### AuctionHouseBot.AdvancedPricing.TradeGood.Cloth.Enabled = 1 @@ -250,6 +231,11 @@ AuctionHouseBot.AdvancedPricing.Misc.Mount.Enabled = 1 # This allows more precise control than Category.* or Quality.* alone, # for example making Uncommon Weapons more expensive without affecting # Uncommon Trade Goods. +# +# 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 +# (above) would then multiply that value further. ############################################################################### AuctionHouseBot.PriceMultiplier.Category.Consumable = 1 @@ -499,6 +485,59 @@ AuctionHouseBot.RandomStackRatio.Key = 10 AuctionHouseBot.RandomStackRatio.Misc = 100 AuctionHouseBot.RandomStackRatio.Glyph = 0 +############################################################################### +# AuctionHouseBot.ListedItemLevelRestrict.Enabled +# If true, the item level will be restricted in listings +# Default: false +# +# AuctionHouseBot.ListedItemLevelRestrict.MinItemLevel +# The lowest item level that will show up in listings +# Default: 0 +# +# AuctionHouseBot.ListedItemLevelRestrict.MaxItemLevel +# The highest item level that will show up in listings +# Default: 999 +# +# AuctionHouseBot.ListedItemLevelRestrict.ExceptionItemIDs +# Comma separated list of itemIDs to exclude from any item level restriction logic +# Ranges using a dash (-) can also be used +# NOTE: Other filtering will still be honored even if it's listed here +# Example: "100,150-200" would cause item level 100, and all item levels +# between 150 and 200 (inclusively) to not be subjected to this restriction +############################################################################### + +AuctionHouseBot.ListedItemLevelRestrict.Enabled = false +AuctionHouseBot.ListedItemLevelRestrict.MinItemLevel = 0 +AuctionHouseBot.ListedItemLevelRestrict.MaxItemLevel = 999 +AuctionHouseBot.ListedItemLevelRestrict.ExceptionItemIDs = + +############################################################################### +# AuctionHouseBot.ListedItemIDRestrict.Enabled +# If true, the item ids (item_temtplate.entry) will be restricted in listings +# Default: false +# +# AuctionHouseBot.ListedItemIDRestrict.MinItemID +# The lowest item id that will show up in listings +# Default: 0 +# +# AuctionHouseBot.ListedItemIDRestrict.MaxItemID +# The highest item id that will show up in listings +# Default: 200000 +# +# AuctionHouseBot.ListedItemIDRestrict.ExceptionItemIDs +# Comma separated list of itemIDs to exclude from any item id restriction logic +# Ranges using a dash (-) can also be used +# NOTE: Other filtering will still be honored even if it's listed here +# Example: "2589,3200-3202" would cause Linen Cloth (2589), Burnt Leather Bracers (3200), +# Barbarian War Axe (3201), and Forest Leather Bracers (3202) to not +# be subjected to this restriction +############################################################################### + +AuctionHouseBot.ListedItemIDRestrict.Enabled = false +AuctionHouseBot.ListedItemIDRestrict.MinItemID = 0 +AuctionHouseBot.ListedItemIDRestrict.MaxItemID = 200000 +AuctionHouseBot.ListedItemIDRestrict.ExceptionItemIDs = + ############################################################################### # AuctionHouseBot.DisabledItemTextFilter # If true, this will hide items with bad names like "OLD" and "D'Sak" diff --git a/src/AuctionHouseBot.cpp b/src/AuctionHouseBot.cpp index 25f2880..9cccd17 100644 --- a/src/AuctionHouseBot.cpp +++ b/src/AuctionHouseBot.cpp @@ -118,6 +118,9 @@ AuctionHouseBot::AuctionHouseBot() : PriceMinimumCenterBaseMisc(1), PriceMinimumCenterBaseGlyph(1), ItemLevelPriceMultiplier(1), + ListedItemIDRestrictedEnabled(false), + ListedItemIDMin(0), + ListedItemIDMax(200000), LastCycleCount(0) { AllianceConfig = AHBConfig(2); @@ -473,9 +476,38 @@ void AuctionHouseBot::populateItemCandidateList() if (ListedItemLevelExceptionItems.find(itr->second.ItemId) == ListedItemLevelExceptionItems.end()) { if (itr->second.ItemLevel < ListedItemLevelMin) + { + if (debug_Out_Filters) + LOG_ERROR("module", "AuctionHouseBot: Item {} disabled since item level is lower than ListedItemLevelRestrict.MinItemLevel", itr->second.ItemId); continue; + } if (itr->second.ItemLevel > ListedItemLevelMax) + { + if (debug_Out_Filters) + LOG_ERROR("module", "AuctionHouseBot: Item {} disabled since item level is higher than ListedItemLevelRestrict.MaxItemLevel", itr->second.ItemId); continue; + } + } + } + + // If there is an item ID exception, honor it + if (ListedItemIDRestrictedEnabled == true) + { + // Only test if it's not an exception + if (ListedItemIDExceptionItems.find(itr->second.ItemId) == ListedItemIDExceptionItems.end()) + { + if (itr->second.ItemId < ListedItemIDMin) + { + if (debug_Out_Filters) + LOG_ERROR("module", "AuctionHouseBot: Item {} disabled since item id is lower than ListedItemLevelRestrict.MinItemID", itr->second.ItemId); + continue; + } + if (itr->second.ItemId > ListedItemIDMax) + { + if (debug_Out_Filters) + LOG_ERROR("module", "AuctionHouseBot: Item {} disabled since item id is higher than ListedItemLevelRestrict.MaxItemID", itr->second.ItemId); + continue; + } } } @@ -483,7 +515,7 @@ void AuctionHouseBot::populateItemCandidateList() if (DisabledItems.find(itr->second.ItemId) != DisabledItems.end()) { if (debug_Out_Filters) - LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (PTR/Beta/Unused Item)", itr->second.ItemId); + LOG_ERROR("module", "AuctionHouseBot: Item {} disabled (Configured by DisabledItemIDs and DisabledCraftedItemIDs)", itr->second.ItemId); continue; } @@ -1003,13 +1035,6 @@ void AuctionHouseBot::InitializeConfiguration() ItemsPerCycle = sConfigMgr->GetOption("AuctionHouseBot.ItemsPerCycle", 75); - // Item level Restrictions - ListedItemLevelRestrictedEnabled = sConfigMgr->GetOption("AuctionHouseBot.ListedItemLevelRestrict.Enabled", false); - ListedItemLevelMax = sConfigMgr->GetOption("AuctionHouseBot.ListedItemLevelRestrict.MaxItemLevel", 999); - ListedItemLevelMin = sConfigMgr->GetOption("AuctionHouseBot.ListedItemLevelRestrict.MinItemLevel", 0); - ListedItemLevelExceptionItems.clear(); - AddItemIDsFromString(ListedItemLevelExceptionItems, sConfigMgr->GetOption("AuctionHouseBot.ListedItemLevelRestrict.ExceptionItemIDs", ""), "ListedItemLevelRestrict.ExceptionItemIDs"); - // Stack Ratios RandomStackRatioConsumable = GetRandomStackValue("AuctionHouseBot.RandomStackRatio.Consumable", 20); RandomStackRatioContainer = GetRandomStackValue("AuctionHouseBot.RandomStackRatio.Container", 0); @@ -1117,6 +1142,20 @@ void AuctionHouseBot::InitializeConfiguration() PriceMinimumCenterBaseGlyph = sConfigMgr->GetOption("AuctionHouseBot.PriceMinimumCenterBase.Glyph", 1000); AddPriceMinimumOverrides(sConfigMgr->GetOption("AuctionHouseBot.PriceMinimumCenterBase.OverrideItems", "")); + // Item level Restrictions + ListedItemLevelRestrictedEnabled = sConfigMgr->GetOption("AuctionHouseBot.ListedItemLevelRestrict.Enabled", false); + ListedItemLevelMin = sConfigMgr->GetOption("AuctionHouseBot.ListedItemLevelRestrict.MinItemLevel", 0); + ListedItemLevelMax = sConfigMgr->GetOption("AuctionHouseBot.ListedItemLevelRestrict.MaxItemLevel", 999); + ListedItemLevelExceptionItems.clear(); + AddItemIDsFromString(ListedItemLevelExceptionItems, sConfigMgr->GetOption("AuctionHouseBot.ListedItemLevelRestrict.ExceptionItemIDs", ""), "ListedItemLevelRestrict.ExceptionItemIDs"); + + // Item ID Restrictions + ListedItemIDRestrictedEnabled = sConfigMgr->GetOption("AuctionHouseBot.ListedItemIDRestrict.Enabled", false); + ListedItemIDMin = sConfigMgr->GetOption("AuctionHouseBot.ListedItemIDRestrict.MinItemID", 0); + ListedItemIDMax = sConfigMgr->GetOption("AuctionHouseBot.ListedItemIDRestrict.MaxItemID", 200000); + ListedItemIDExceptionItems.clear(); + AddItemIDsFromString(ListedItemIDExceptionItems, sConfigMgr->GetOption("AuctionHouseBot.ListedItemIDRestrict.ExceptionItemIDs", ""), "ListedItemIDRestrict.ExceptionItemIDs"); + // Disabled Items DisabledItemTextFilter = sConfigMgr->GetOption("AuctionHouseBot.DisabledItemTextFilter", true); DisabledItems.clear(); diff --git a/src/AuctionHouseBot.h b/src/AuctionHouseBot.h index c77bafa..0b68601 100644 --- a/src/AuctionHouseBot.h +++ b/src/AuctionHouseBot.h @@ -223,6 +223,10 @@ private: uint32 PriceMinimumCenterBaseGlyph; std::unordered_map PriceMinimumCenterBaseOverridesByItemID; float ItemLevelPriceMultiplier; + bool ListedItemIDRestrictedEnabled; + uint32 ListedItemIDMin; + uint32 ListedItemIDMax; + std::set ListedItemIDExceptionItems; AHBConfig AllianceConfig; AHBConfig HordeConfig;