Add item ID restriction to config

This commit is contained in:
NathanHandley
2025-09-16 08:50:06 -05:00
parent 61f7aebf10
commit 1b8a3be492
3 changed files with 114 additions and 32 deletions

View File

@@ -97,30 +97,6 @@ AuctionHouseBot.Buyer.Enabled = 0
AuctionHouseBot.Buyer.BuyCandidatesPerBuyCycle = 1 AuctionHouseBot.Buyer.BuyCandidatesPerBuyCycle = 1
AuctionHouseBot.Buyer.AcceptablePriceModifier = 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.<faction>.MinItems # AuctionHouseBot.<faction>.MinItems
# AuctionHouseBot.<faction>.MaxItems # AuctionHouseBot.<faction>.MaxItems
@@ -220,6 +196,11 @@ AuctionHouseBot.PriceMinimumCenterBase.OverrideItems =
# Note that the AdvancedPricing logic also relies on values # Note that the AdvancedPricing logic also relies on values
# set by AuctionHouseBot.PriceMultiplier.Category*.Quality* # set by AuctionHouseBot.PriceMultiplier.Category*.Quality*
# Defaults: 1 (Enabled) # 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 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, # This allows more precise control than Category.* or Quality.* alone,
# for example making Uncommon Weapons more expensive without affecting # for example making Uncommon Weapons more expensive without affecting
# Uncommon Trade Goods. # 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 AuctionHouseBot.PriceMultiplier.Category.Consumable = 1
@@ -499,6 +485,59 @@ AuctionHouseBot.RandomStackRatio.Key = 10
AuctionHouseBot.RandomStackRatio.Misc = 100 AuctionHouseBot.RandomStackRatio.Misc = 100
AuctionHouseBot.RandomStackRatio.Glyph = 0 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 # AuctionHouseBot.DisabledItemTextFilter
# If true, this will hide items with bad names like "OLD" and "D'Sak" # If true, this will hide items with bad names like "OLD" and "D'Sak"

View File

@@ -118,6 +118,9 @@ AuctionHouseBot::AuctionHouseBot() :
PriceMinimumCenterBaseMisc(1), PriceMinimumCenterBaseMisc(1),
PriceMinimumCenterBaseGlyph(1), PriceMinimumCenterBaseGlyph(1),
ItemLevelPriceMultiplier(1), ItemLevelPriceMultiplier(1),
ListedItemIDRestrictedEnabled(false),
ListedItemIDMin(0),
ListedItemIDMax(200000),
LastCycleCount(0) LastCycleCount(0)
{ {
AllianceConfig = AHBConfig(2); AllianceConfig = AHBConfig(2);
@@ -473,9 +476,38 @@ void AuctionHouseBot::populateItemCandidateList()
if (ListedItemLevelExceptionItems.find(itr->second.ItemId) == ListedItemLevelExceptionItems.end()) if (ListedItemLevelExceptionItems.find(itr->second.ItemId) == ListedItemLevelExceptionItems.end())
{ {
if (itr->second.ItemLevel < ListedItemLevelMin) 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; continue;
}
if (itr->second.ItemLevel > ListedItemLevelMax) 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; 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 (DisabledItems.find(itr->second.ItemId) != DisabledItems.end())
{ {
if (debug_Out_Filters) 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; continue;
} }
@@ -1003,13 +1035,6 @@ void AuctionHouseBot::InitializeConfiguration()
ItemsPerCycle = sConfigMgr->GetOption<uint32>("AuctionHouseBot.ItemsPerCycle", 75); ItemsPerCycle = sConfigMgr->GetOption<uint32>("AuctionHouseBot.ItemsPerCycle", 75);
// Item level Restrictions
ListedItemLevelRestrictedEnabled = sConfigMgr->GetOption<bool>("AuctionHouseBot.ListedItemLevelRestrict.Enabled", false);
ListedItemLevelMax = sConfigMgr->GetOption("AuctionHouseBot.ListedItemLevelRestrict.MaxItemLevel", 999);
ListedItemLevelMin = sConfigMgr->GetOption("AuctionHouseBot.ListedItemLevelRestrict.MinItemLevel", 0);
ListedItemLevelExceptionItems.clear();
AddItemIDsFromString(ListedItemLevelExceptionItems, sConfigMgr->GetOption<std::string>("AuctionHouseBot.ListedItemLevelRestrict.ExceptionItemIDs", ""), "ListedItemLevelRestrict.ExceptionItemIDs");
// Stack Ratios // Stack Ratios
RandomStackRatioConsumable = GetRandomStackValue("AuctionHouseBot.RandomStackRatio.Consumable", 20); RandomStackRatioConsumable = GetRandomStackValue("AuctionHouseBot.RandomStackRatio.Consumable", 20);
RandomStackRatioContainer = GetRandomStackValue("AuctionHouseBot.RandomStackRatio.Container", 0); RandomStackRatioContainer = GetRandomStackValue("AuctionHouseBot.RandomStackRatio.Container", 0);
@@ -1117,6 +1142,20 @@ void AuctionHouseBot::InitializeConfiguration()
PriceMinimumCenterBaseGlyph = sConfigMgr->GetOption<uint32>("AuctionHouseBot.PriceMinimumCenterBase.Glyph", 1000); PriceMinimumCenterBaseGlyph = sConfigMgr->GetOption<uint32>("AuctionHouseBot.PriceMinimumCenterBase.Glyph", 1000);
AddPriceMinimumOverrides(sConfigMgr->GetOption<std::string>("AuctionHouseBot.PriceMinimumCenterBase.OverrideItems", "")); AddPriceMinimumOverrides(sConfigMgr->GetOption<std::string>("AuctionHouseBot.PriceMinimumCenterBase.OverrideItems", ""));
// Item level Restrictions
ListedItemLevelRestrictedEnabled = sConfigMgr->GetOption<bool>("AuctionHouseBot.ListedItemLevelRestrict.Enabled", false);
ListedItemLevelMin = sConfigMgr->GetOption("AuctionHouseBot.ListedItemLevelRestrict.MinItemLevel", 0);
ListedItemLevelMax = sConfigMgr->GetOption("AuctionHouseBot.ListedItemLevelRestrict.MaxItemLevel", 999);
ListedItemLevelExceptionItems.clear();
AddItemIDsFromString(ListedItemLevelExceptionItems, sConfigMgr->GetOption<std::string>("AuctionHouseBot.ListedItemLevelRestrict.ExceptionItemIDs", ""), "ListedItemLevelRestrict.ExceptionItemIDs");
// Item ID Restrictions
ListedItemIDRestrictedEnabled = sConfigMgr->GetOption<bool>("AuctionHouseBot.ListedItemIDRestrict.Enabled", false);
ListedItemIDMin = sConfigMgr->GetOption("AuctionHouseBot.ListedItemIDRestrict.MinItemID", 0);
ListedItemIDMax = sConfigMgr->GetOption("AuctionHouseBot.ListedItemIDRestrict.MaxItemID", 200000);
ListedItemIDExceptionItems.clear();
AddItemIDsFromString(ListedItemIDExceptionItems, sConfigMgr->GetOption<std::string>("AuctionHouseBot.ListedItemIDRestrict.ExceptionItemIDs", ""), "ListedItemIDRestrict.ExceptionItemIDs");
// Disabled Items // Disabled Items
DisabledItemTextFilter = sConfigMgr->GetOption<bool>("AuctionHouseBot.DisabledItemTextFilter", true); DisabledItemTextFilter = sConfigMgr->GetOption<bool>("AuctionHouseBot.DisabledItemTextFilter", true);
DisabledItems.clear(); DisabledItems.clear();

View File

@@ -223,6 +223,10 @@ private:
uint32 PriceMinimumCenterBaseGlyph; uint32 PriceMinimumCenterBaseGlyph;
std::unordered_map<uint32, uint64> PriceMinimumCenterBaseOverridesByItemID; std::unordered_map<uint32, uint64> PriceMinimumCenterBaseOverridesByItemID;
float ItemLevelPriceMultiplier; float ItemLevelPriceMultiplier;
bool ListedItemIDRestrictedEnabled;
uint32 ListedItemIDMin;
uint32 ListedItemIDMax;
std::set<uint32> ListedItemIDExceptionItems;
AHBConfig AllianceConfig; AHBConfig AllianceConfig;
AHBConfig HordeConfig; AHBConfig HordeConfig;