mirror of
https://github.com/NathanHandley/mod-ah-bot-plus.git
synced 2026-01-13 01:08:37 +00:00
Add item level controls
This commit is contained in:
@@ -41,6 +41,29 @@ AuctionHouseBot.EnableBuyer = 0
|
|||||||
AuctionHouseBot.GUIDs = 0
|
AuctionHouseBot.GUIDs = 0
|
||||||
AuctionHouseBot.ItemsPerCycle = 75
|
AuctionHouseBot.ItemsPerCycle = 75
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# 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
|
||||||
|
|||||||
@@ -263,12 +263,17 @@ void AuctionHouseBot::populateItemCandidateList()
|
|||||||
if (itr->second.ItemId == 0)
|
if (itr->second.ItemId == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Always store items that are exceptions
|
// If there is an iLevel exception, honor it
|
||||||
if (includeItemIDExecptions.find(itr->second.ItemId) != includeItemIDExecptions.end())
|
if (ListedItemLevelRestrictedEnabled == true)
|
||||||
{
|
{
|
||||||
// Store the item ID
|
// Only test if it's not an exception
|
||||||
itemCandidatesByItemClass[itr->second.Class].push_back(itr->second.ItemId);
|
if (ListedItemLevelExceptionItems.find(itr->second.ItemId) == ListedItemLevelExceptionItems.end())
|
||||||
continue;
|
{
|
||||||
|
if (itr->second.ItemLevel < ListedItemLevelMin)
|
||||||
|
continue;
|
||||||
|
if (itr->second.ItemLevel > ListedItemLevelMax)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disabled items by Id
|
// Disabled items by Id
|
||||||
@@ -279,6 +284,14 @@ void AuctionHouseBot::populateItemCandidateList()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// These items should be included and would otherwise be skipped due to conditions below
|
||||||
|
if (includeItemIDExecptions.find(itr->second.ItemId) != includeItemIDExecptions.end())
|
||||||
|
{
|
||||||
|
// Store the item ID
|
||||||
|
itemCandidatesByItemClass[itr->second.Class].push_back(itr->second.ItemId);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Skip any items not in the seed list
|
// Skip any items not in the seed list
|
||||||
if (std::find(itemCandidateClassWeightedProportionList.begin(), itemCandidateClassWeightedProportionList.end(), itr->second.Class) == itemCandidateClassWeightedProportionList.end())
|
if (std::find(itemCandidateClassWeightedProportionList.begin(), itemCandidateClassWeightedProportionList.end(), itr->second.Class) == itemCandidateClassWeightedProportionList.end())
|
||||||
continue;
|
continue;
|
||||||
@@ -797,6 +810,12 @@ 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<int32>("AuctionHouseBot.ListedItemLevelRestrict.MaxItemLevel", 999);
|
||||||
|
ListedItemLevelMin = sConfigMgr->GetOption<int32>("AuctionHouseBot.ListedItemLevelRestrict.MinItemLevel", 0);
|
||||||
|
AddItemLevelExceptionItems(sConfigMgr->GetOption<std::string>("AuctionHouseBot.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);
|
||||||
@@ -909,6 +928,20 @@ uint32 AuctionHouseBot::GetRandomStackValue(std::string configKeyString, uint32
|
|||||||
return stackValue;
|
return stackValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AuctionHouseBot::AddToListedItemLevelExceptionItems(std::set<uint32>& workingExceptionItemIDs, uint32 itemLevelExceptionItemID)
|
||||||
|
{
|
||||||
|
if (workingExceptionItemIDs.find(itemLevelExceptionItemID) != workingExceptionItemIDs.end())
|
||||||
|
{
|
||||||
|
if (debug_Out)
|
||||||
|
LOG_ERROR("module", "AuctionHouseBot: Duplicate item level exxception item ID of {} found, skipping", itemLevelExceptionItemID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
workingExceptionItemIDs.insert(itemLevelExceptionItemID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void AuctionHouseBot::AddToDisabledItems(std::set<uint32>& workingDisabledItemIDs, uint32 disabledItemID)
|
void AuctionHouseBot::AddToDisabledItems(std::set<uint32>& workingDisabledItemIDs, uint32 disabledItemID)
|
||||||
{
|
{
|
||||||
if (workingDisabledItemIDs.find(disabledItemID) != workingDisabledItemIDs.end())
|
if (workingDisabledItemIDs.find(disabledItemID) != workingDisabledItemIDs.end())
|
||||||
@@ -1020,6 +1053,45 @@ void AuctionHouseBot::AddDisabledItems(std::string disabledItemIdString)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AuctionHouseBot::AddItemLevelExceptionItems(std::string itemLevelExceptionIdString)
|
||||||
|
{
|
||||||
|
std::string delimitedValue;
|
||||||
|
std::stringstream itemLevelExceptionItemIdStream;
|
||||||
|
|
||||||
|
itemLevelExceptionItemIdStream.str(itemLevelExceptionIdString);
|
||||||
|
while (std::getline(itemLevelExceptionItemIdStream, delimitedValue, ',')) // Process each item ID in the string, delimited by the comma ","
|
||||||
|
{
|
||||||
|
std::string valueOne;
|
||||||
|
std::stringstream itemPairStream(delimitedValue);
|
||||||
|
itemPairStream >> valueOne;
|
||||||
|
// If it has a hypen, then it's a range of numbers
|
||||||
|
if (valueOne.find("-") != std::string::npos)
|
||||||
|
{
|
||||||
|
std::string leftIDString = valueOne.substr(0, valueOne.find("-"));
|
||||||
|
std::string rightIDString = valueOne.substr(valueOne.find("-") + 1);
|
||||||
|
|
||||||
|
auto leftId = atoi(leftIDString.c_str());
|
||||||
|
auto rightId = atoi(rightIDString.c_str());
|
||||||
|
|
||||||
|
if (leftId > rightId)
|
||||||
|
{
|
||||||
|
LOG_ERROR("module", "AuctionHouseBot: Duplicate item level exception item ID range of {} to {} needs to be smallest to largest, skipping", leftId, rightId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int32 i = leftId; i <= rightId; ++i)
|
||||||
|
AddToListedItemLevelExceptionItems(ListedItemLevelExceptionItems, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto itemId = atoi(valueOne.c_str());
|
||||||
|
AddToListedItemLevelExceptionItems(ListedItemLevelExceptionItems, itemId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AuctionHouseBot::AddPriceMinimumOverrides(std::string priceMinimimOverridesString)
|
void AuctionHouseBot::AddPriceMinimumOverrides(std::string priceMinimimOverridesString)
|
||||||
{
|
{
|
||||||
std::string delimitedValue;
|
std::string delimitedValue;
|
||||||
|
|||||||
@@ -148,6 +148,10 @@ private:
|
|||||||
uint32 ItemsPerCycle;
|
uint32 ItemsPerCycle;
|
||||||
bool DisabledItemTextFilter;
|
bool DisabledItemTextFilter;
|
||||||
std::set<uint32> DisabledItems;
|
std::set<uint32> DisabledItems;
|
||||||
|
bool ListedItemLevelRestrictedEnabled;
|
||||||
|
int32 ListedItemLevelMax;
|
||||||
|
int32 ListedItemLevelMin;
|
||||||
|
std::set<uint32> ListedItemLevelExceptionItems;
|
||||||
uint32 RandomStackRatioConsumable;
|
uint32 RandomStackRatioConsumable;
|
||||||
uint32 RandomStackRatioContainer;
|
uint32 RandomStackRatioContainer;
|
||||||
uint32 RandomStackRatioWeapon;
|
uint32 RandomStackRatioWeapon;
|
||||||
@@ -255,6 +259,8 @@ public:
|
|||||||
void AddCharacters(std::string characterGUIDString);
|
void AddCharacters(std::string characterGUIDString);
|
||||||
void AddToDisabledItems(std::set<uint32>& workingDisabledItemIDs, uint32 disabledItemID);
|
void AddToDisabledItems(std::set<uint32>& workingDisabledItemIDs, uint32 disabledItemID);
|
||||||
void AddDisabledItems(std::string disabledItemIdString);
|
void AddDisabledItems(std::string disabledItemIdString);
|
||||||
|
void AddToListedItemLevelExceptionItems(std::set<uint32>& workingExceptionItemIDs, uint32 itemLevelExceptionItemID);
|
||||||
|
void AddItemLevelExceptionItems(std::string itemLevelExceptionIdString);
|
||||||
void AddPriceMinimumOverrides(std::string priceMinimimOverridesString);
|
void AddPriceMinimumOverrides(std::string priceMinimimOverridesString);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user