mirror of
https://github.com/NathanHandley/mod-ah-bot-plus.git
synced 2026-01-16 18:40:30 +00:00
Add ability to filter items by use or equip level
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user