Add ability to filter items by use or equip level

This commit is contained in:
NathanHandley
2026-01-06 08:41:32 -06:00
parent 5561885b8b
commit dcb615212d
3 changed files with 70 additions and 2 deletions

View File

@@ -893,6 +893,37 @@ AuctionHouseBot.ListedItemLevelRestrict.MinItemLevel = 0
AuctionHouseBot.ListedItemLevelRestrict.MaxItemLevel = 999
AuctionHouseBot.ListedItemLevelRestrict.ExceptionItemIDs =
###############################################################################
# AuctionHouseBot.EquipItemUseOrEquipLevelRestrict.Enabled
# If true, the logic related to restricting the bot from listing items
# based on the equipped level or use level is active. Note that items
# with no equip or use level are ignored from this logic (always included)
# Default: false
#
# AuctionHouseBot.EquipItemUseOrEquipLevelRestrict.MinLevel
# The lowest equip or use level that will show up in listings. Items
# no equip or use levels will not be restricted
# Default: 0
#
# AuctionHouseBot.EquipItemUseOrEquipLevelRestrict.MaxLevel
# The highest equip or use level that will show up in listings. Items
# no equip or use levels will not be restricted
# Default: 0
#
# AuctionHouseBot.EquipItemUseOrEquipLevelRestrict.ExceptionItemIDs
# Comma separated list of itemIDs to exclude from any equip or use 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: "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.EquipItemUseOrEquipLevelRestrict.Enabled = false
AuctionHouseBot.EquipItemUseOrEquipLevelRestrict.MinLevel = 0
AuctionHouseBot.EquipItemUseOrEquipLevelRestrict.MaxLevel = 999
AuctionHouseBot.EquipItemUseOrEquipLevelRestrict.ExceptionItemIDs =
###############################################################################
# AuctionHouseBot.ListedItemIDRestrict.Enabled
# If true, the item ids (item_temtplate.entry) will be restricted in listings

View File

@@ -68,8 +68,11 @@ AuctionHouseBot::AuctionHouseBot() :
DisabledRecipeProducedItemFilterEnabled(false),
ListedItemLevelRestrictedEnabled(false),
ListedItemLevelRestrictedUseCraftedItemForCalculation(true),
ListedItemLevelMax(999),
ListedItemLevelMin(0),
ListedItemLevelMax(999),
ListedItemUseOrEquipRestrictedEnabled(false),
ListedItemUseOrEquipRestrictMinLevel(0),
ListedItemUseOrEquipRestrictMaxLevel(999),
RandomStackRatioConsumable(1),
RandomStackRatioContainer(1),
RandomStackRatioWeapon(1),
@@ -728,6 +731,29 @@ void AuctionHouseBot::PopulateItemCandidatesAndProportions()
}
}
// If there is a use/equip level exception, honor it
if (ListedItemUseOrEquipRestrictedEnabled == true)
{
// Only test if it's not an exception
if (ListedItemUseOrEquipExceptionItems.find(itr->second.ItemId) == ListedItemUseOrEquipExceptionItems.end())
{
uint32 useOrEquipLevelCompare = itr->second.RequiredLevel;
if (useOrEquipLevelCompare > 0 && useOrEquipLevelCompare < ListedItemUseOrEquipRestrictMinLevel)
{
if (debug_Out_Filters)
LOG_ERROR("module", "AuctionHouseBot: Item {} disabled since item use or equip level is lower than EquipItemUseOrEquipLevelRestrict.MinItemLevel", itr->second.ItemId);
continue;
}
if (useOrEquipLevelCompare > 0 && useOrEquipLevelCompare > ListedItemUseOrEquipRestrictMaxLevel)
{
if (debug_Out_Filters)
LOG_ERROR("module", "AuctionHouseBot: Item {} disabled since item use or equip level is higher than EquipItemUseOrEquipLevelRestrict.MaxItemLevel", itr->second.ItemId);
continue;
}
}
}
// Disabled items by Id
if (DisabledItems.find(itr->second.ItemId) != DisabledItems.end())
{
@@ -2048,6 +2074,13 @@ void AuctionHouseBot::InitializeConfiguration()
ListedItemIDExceptionItems.clear();
ParseNumberListToSet(ListedItemIDExceptionItems, sConfigMgr->GetOption<std::string>("AuctionHouseBot.ListedItemIDRestrict.ExceptionItemIDs", ""), "ListedItemIDRestrict.ExceptionItemIDs");
// Equip or use restrictions
ListedItemUseOrEquipRestrictedEnabled = sConfigMgr->GetOption<bool>("AuctionHouseBot.EquipItemUseOrEquipLevelRestrict.Enabled", false);
ListedItemUseOrEquipRestrictMinLevel = sConfigMgr->GetOption("AuctionHouseBot.EquipItemUseOrEquipLevelRestrict.MinLevel", 0);
ListedItemUseOrEquipRestrictMaxLevel = sConfigMgr->GetOption("AuctionHouseBot.EquipItemUseOrEquipLevelRestrict.MaxLevel", 999);
ListedItemUseOrEquipExceptionItems.clear();
ParseNumberListToSet(ListedItemUseOrEquipExceptionItems, sConfigMgr->GetOption<std::string>("AuctionHouseBot.EquipItemUseOrEquipLevelRestrict.ExceptionItemIDs", ""), "EquipItemUseOrEquipLevelRestrict.ExceptionItemIDs");
// Disabled Items
DisabledItemTextFilter = sConfigMgr->GetOption<bool>("AuctionHouseBot.DisabledItemTextFilter", true);
DisabledRecipeProducedItemFilterEnabled = sConfigMgr->GetOption<bool>("AuctionHouseBot.DisabledRecipeProducedItemFilterEnabled", false);

View File

@@ -159,9 +159,13 @@ private:
std::set<uint32> DisabledItems;
bool ListedItemLevelRestrictedEnabled;
bool ListedItemLevelRestrictedUseCraftedItemForCalculation;
uint32 ListedItemLevelMax;
uint32 ListedItemLevelMin;
uint32 ListedItemLevelMax;
std::set<uint32> ListedItemLevelExceptionItems;
bool ListedItemUseOrEquipRestrictedEnabled;
uint32 ListedItemUseOrEquipRestrictMinLevel;
uint32 ListedItemUseOrEquipRestrictMaxLevel;
std::set<uint32> ListedItemUseOrEquipExceptionItems;
uint32 RandomStackRatioConsumable;
uint32 RandomStackRatioContainer;
uint32 RandomStackRatioWeapon;