diff --git a/conf/mod_ahbot.conf.dist b/conf/mod_ahbot.conf.dist index 4869fa6..d021d33 100644 --- a/conf/mod_ahbot.conf.dist +++ b/conf/mod_ahbot.conf.dist @@ -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 diff --git a/src/AuctionHouseBot.cpp b/src/AuctionHouseBot.cpp index ca90d71..a55f608 100644 --- a/src/AuctionHouseBot.cpp +++ b/src/AuctionHouseBot.cpp @@ -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("AuctionHouseBot.ListedItemIDRestrict.ExceptionItemIDs", ""), "ListedItemIDRestrict.ExceptionItemIDs"); + // Equip or use restrictions + ListedItemUseOrEquipRestrictedEnabled = sConfigMgr->GetOption("AuctionHouseBot.EquipItemUseOrEquipLevelRestrict.Enabled", false); + ListedItemUseOrEquipRestrictMinLevel = sConfigMgr->GetOption("AuctionHouseBot.EquipItemUseOrEquipLevelRestrict.MinLevel", 0); + ListedItemUseOrEquipRestrictMaxLevel = sConfigMgr->GetOption("AuctionHouseBot.EquipItemUseOrEquipLevelRestrict.MaxLevel", 999); + ListedItemUseOrEquipExceptionItems.clear(); + ParseNumberListToSet(ListedItemUseOrEquipExceptionItems, sConfigMgr->GetOption("AuctionHouseBot.EquipItemUseOrEquipLevelRestrict.ExceptionItemIDs", ""), "EquipItemUseOrEquipLevelRestrict.ExceptionItemIDs"); + // Disabled Items DisabledItemTextFilter = sConfigMgr->GetOption("AuctionHouseBot.DisabledItemTextFilter", true); DisabledRecipeProducedItemFilterEnabled = sConfigMgr->GetOption("AuctionHouseBot.DisabledRecipeProducedItemFilterEnabled", false); diff --git a/src/AuctionHouseBot.h b/src/AuctionHouseBot.h index c225798..2d991c4 100644 --- a/src/AuctionHouseBot.h +++ b/src/AuctionHouseBot.h @@ -159,9 +159,13 @@ private: std::set DisabledItems; bool ListedItemLevelRestrictedEnabled; bool ListedItemLevelRestrictedUseCraftedItemForCalculation; - uint32 ListedItemLevelMax; uint32 ListedItemLevelMin; + uint32 ListedItemLevelMax; std::set ListedItemLevelExceptionItems; + bool ListedItemUseOrEquipRestrictedEnabled; + uint32 ListedItemUseOrEquipRestrictMinLevel; + uint32 ListedItemUseOrEquipRestrictMaxLevel; + std::set ListedItemUseOrEquipExceptionItems; uint32 RandomStackRatioConsumable; uint32 RandomStackRatioContainer; uint32 RandomStackRatioWeapon;