mirror of
https://github.com/NathanHandley/mod-ah-bot-plus.git
synced 2026-01-13 01:08:37 +00:00
Add random stack increments
This commit is contained in:
@@ -446,13 +446,13 @@ AuctionHouseBot.PriceMultiplier.CategoryPermanent.QualityArtifact = 1.0
|
||||
AuctionHouseBot.PriceMultiplier.CategoryPermanent.QualityHeirloom = 1.0
|
||||
|
||||
###############################################################################
|
||||
# AuctionHouseBot.RandomStackRatio.*
|
||||
# AuctionHouseBot.ListingStack.RandomRatio.*
|
||||
# Used to determine how often a stack of the class will be single or randomly-size stacked when posted
|
||||
# Value needs to be between 0 and 100, no decimal. Anything higher than 100 will be treated as 100
|
||||
# Examples: 100 = stacks will always be random in size
|
||||
# 50 = half the time the stacks are random, the other half being single stack
|
||||
# 0 = stacks will always single size
|
||||
# Defaults: Consumable: 20 (20% random stack size, 80% single stack size)
|
||||
# Defaults: Consumable: 50 (50% random stack size, 50% single stack size)
|
||||
# Container: 0 (100% single stack size)
|
||||
# Weapon: 0 (100% single stack size)
|
||||
# Gem: 5 (5% random stack size, 95% single stack size)
|
||||
@@ -467,23 +467,54 @@ AuctionHouseBot.PriceMultiplier.CategoryPermanent.QualityHeirloom = 1.0
|
||||
# Key: 10 (10% random stack size, 90% single stack size)
|
||||
# Misc: 100 (100% random stack size)
|
||||
# Glyph: 0 (100% single stack size)
|
||||
#
|
||||
# AuctionHouseBot.ListingStack.RandomStackIncrement.*
|
||||
# When randomizing a stack, this is the multiple used in the stack size
|
||||
# Examples: 1 = stacks will be in sizes of 1, 2, 3, ... (item's max stack size)
|
||||
# 5 = stacks will be in sizes of 5, 10, 15, ... (item's max stack size)
|
||||
# Setting the value too high will clamp to the max stack size, so use that
|
||||
# if you want all random stack sizes to be full stacks (like ammo). Also,
|
||||
# it will only use the increment if the it's a random stack 'roll'. A
|
||||
# value of 0 will be treated as a 1
|
||||
#
|
||||
# NOTES: Stack sizes of 1 can show up if the RandomRatio is not set to 100.
|
||||
# If you want something to always post maxed out, set RandomRatio to
|
||||
# 100 and RandomStackIncrement to a value that is at or greater than the
|
||||
# largest possible stack size for that category. Default configurations
|
||||
# here will do that for Projectiles.
|
||||
###############################################################################
|
||||
|
||||
AuctionHouseBot.RandomStackRatio.Consumable = 20
|
||||
AuctionHouseBot.RandomStackRatio.Container = 0
|
||||
AuctionHouseBot.RandomStackRatio.Weapon = 0
|
||||
AuctionHouseBot.RandomStackRatio.Gem = 30
|
||||
AuctionHouseBot.RandomStackRatio.Armor = 0
|
||||
AuctionHouseBot.RandomStackRatio.Reagent = 50
|
||||
AuctionHouseBot.RandomStackRatio.Projectile = 100
|
||||
AuctionHouseBot.RandomStackRatio.TradeGood = 75
|
||||
AuctionHouseBot.RandomStackRatio.Generic = 100
|
||||
AuctionHouseBot.RandomStackRatio.Recipe = 0
|
||||
AuctionHouseBot.RandomStackRatio.Quiver = 0
|
||||
AuctionHouseBot.RandomStackRatio.Quest = 10
|
||||
AuctionHouseBot.RandomStackRatio.Key = 10
|
||||
AuctionHouseBot.RandomStackRatio.Misc = 100
|
||||
AuctionHouseBot.RandomStackRatio.Glyph = 0
|
||||
AuctionHouseBot.ListingStack.RandomRatio.Consumable = 50
|
||||
AuctionHouseBot.ListingStack.RandomRatio.Container = 0
|
||||
AuctionHouseBot.ListingStack.RandomRatio.Weapon = 0
|
||||
AuctionHouseBot.ListingStack.RandomRatio.Gem = 30
|
||||
AuctionHouseBot.ListingStack.RandomRatio.Armor = 0
|
||||
AuctionHouseBot.ListingStack.RandomRatio.Reagent = 50
|
||||
AuctionHouseBot.ListingStack.RandomRatio.Projectile = 100
|
||||
AuctionHouseBot.ListingStack.RandomRatio.TradeGood = 75
|
||||
AuctionHouseBot.ListingStack.RandomRatio.Generic = 100
|
||||
AuctionHouseBot.ListingStack.RandomRatio.Recipe = 0
|
||||
AuctionHouseBot.ListingStack.RandomRatio.Quiver = 0
|
||||
AuctionHouseBot.ListingStack.RandomRatio.Quest = 10
|
||||
AuctionHouseBot.ListingStack.RandomRatio.Key = 10
|
||||
AuctionHouseBot.ListingStack.RandomRatio.Misc = 100
|
||||
AuctionHouseBot.ListingStack.RandomRatio.Glyph = 0
|
||||
|
||||
AuctionHouseBot.ListingStack.RandomStackIncrement.Consumable = 5
|
||||
AuctionHouseBot.ListingStack.RandomStackIncrement.Container = 1
|
||||
AuctionHouseBot.ListingStack.RandomStackIncrement.Weapon = 1
|
||||
AuctionHouseBot.ListingStack.RandomStackIncrement.Gem = 1
|
||||
AuctionHouseBot.ListingStack.RandomStackIncrement.Armor = 1
|
||||
AuctionHouseBot.ListingStack.RandomStackIncrement.Reagent = 1
|
||||
AuctionHouseBot.ListingStack.RandomStackIncrement.Projectile = 1000
|
||||
AuctionHouseBot.ListingStack.RandomStackIncrement.TradeGood = 5
|
||||
AuctionHouseBot.ListingStack.RandomStackIncrement.Generic = 1
|
||||
AuctionHouseBot.ListingStack.RandomStackIncrement.Recipe = 1
|
||||
AuctionHouseBot.ListingStack.RandomStackIncrement.Quiver = 1
|
||||
AuctionHouseBot.ListingStack.RandomStackIncrement.Quest = 1
|
||||
AuctionHouseBot.ListingStack.RandomStackIncrement.Key = 1
|
||||
AuctionHouseBot.ListingStack.RandomStackIncrement.Misc = 1
|
||||
AuctionHouseBot.ListingStack.RandomStackIncrement.Glyph = 1
|
||||
|
||||
###############################################################################
|
||||
# AuctionHouseBot.ListedItemLevelRestrict.Enabled
|
||||
|
||||
@@ -66,6 +66,21 @@ AuctionHouseBot::AuctionHouseBot() :
|
||||
RandomStackRatioKey(1),
|
||||
RandomStackRatioMisc(1),
|
||||
RandomStackRatioGlyph(1),
|
||||
RandomStackIncrementConsumable(1),
|
||||
RandomStackIncrementContainer(1),
|
||||
RandomStackIncrementWeapon(1),
|
||||
RandomStackIncrementGem(1),
|
||||
RandomStackIncrementArmor(1),
|
||||
RandomStackIncrementReagent(1),
|
||||
RandomStackIncrementProjectile(1),
|
||||
RandomStackIncrementTradeGood(1),
|
||||
RandomStackIncrementGeneric(1),
|
||||
RandomStackIncrementRecipe(1),
|
||||
RandomStackIncrementQuiver(1),
|
||||
RandomStackIncrementQuest(1),
|
||||
RandomStackIncrementKey(1),
|
||||
RandomStackIncrementMisc(1),
|
||||
RandomStackIncrementGlyph(1),
|
||||
ListProportionConsumable(1),
|
||||
ListProportionContainer(1),
|
||||
ListProportionWeapon(1),
|
||||
@@ -140,30 +155,58 @@ uint32 AuctionHouseBot::getStackSizeForItem(ItemTemplate const* itemProto) const
|
||||
if (itemProto == NULL)
|
||||
return 1;
|
||||
|
||||
// TODO: Move this to a config
|
||||
uint32 stackRatio = 0;
|
||||
switch (itemProto->Class)
|
||||
{
|
||||
case ITEM_CLASS_CONSUMABLE: stackRatio = RandomStackRatioConsumable; break;
|
||||
case ITEM_CLASS_CONTAINER: stackRatio = RandomStackRatioContainer; break;
|
||||
case ITEM_CLASS_WEAPON: stackRatio = RandomStackRatioWeapon; break;
|
||||
case ITEM_CLASS_GEM: stackRatio = RandomStackRatioGem; break;
|
||||
case ITEM_CLASS_REAGENT: stackRatio = RandomStackRatioReagent; break;
|
||||
case ITEM_CLASS_ARMOR: stackRatio = RandomStackRatioArmor; break;
|
||||
case ITEM_CLASS_PROJECTILE: stackRatio = RandomStackRatioProjectile; break;
|
||||
case ITEM_CLASS_TRADE_GOODS: stackRatio = RandomStackRatioTradeGood; break;
|
||||
case ITEM_CLASS_GENERIC: stackRatio = RandomStackRatioGeneric; break;
|
||||
case ITEM_CLASS_RECIPE: stackRatio = RandomStackRatioRecipe; break;
|
||||
case ITEM_CLASS_QUIVER: stackRatio = RandomStackRatioQuiver; break;
|
||||
case ITEM_CLASS_QUEST: stackRatio = RandomStackRatioQuest; break;
|
||||
case ITEM_CLASS_KEY: stackRatio = RandomStackRatioKey; break;
|
||||
case ITEM_CLASS_MISC: stackRatio = RandomStackRatioMisc; break;
|
||||
case ITEM_CLASS_GLYPH: stackRatio = RandomStackRatioGlyph; break;
|
||||
default: stackRatio = 0; break;
|
||||
case ITEM_CLASS_CONSUMABLE: stackRatio = RandomStackRatioConsumable; break;
|
||||
case ITEM_CLASS_CONTAINER: stackRatio = RandomStackRatioContainer; break;
|
||||
case ITEM_CLASS_WEAPON: stackRatio = RandomStackRatioWeapon; break;
|
||||
case ITEM_CLASS_GEM: stackRatio = RandomStackRatioGem; break;
|
||||
case ITEM_CLASS_REAGENT: stackRatio = RandomStackRatioReagent; break;
|
||||
case ITEM_CLASS_ARMOR: stackRatio = RandomStackRatioArmor; break;
|
||||
case ITEM_CLASS_PROJECTILE: stackRatio = RandomStackRatioProjectile; break;
|
||||
case ITEM_CLASS_TRADE_GOODS: stackRatio = RandomStackRatioTradeGood; break;
|
||||
case ITEM_CLASS_GENERIC: stackRatio = RandomStackRatioGeneric; break;
|
||||
case ITEM_CLASS_RECIPE: stackRatio = RandomStackRatioRecipe; break;
|
||||
case ITEM_CLASS_QUIVER: stackRatio = RandomStackRatioQuiver; break;
|
||||
case ITEM_CLASS_QUEST: stackRatio = RandomStackRatioQuest; break;
|
||||
case ITEM_CLASS_KEY: stackRatio = RandomStackRatioKey; break;
|
||||
case ITEM_CLASS_MISC: stackRatio = RandomStackRatioMisc; break;
|
||||
case ITEM_CLASS_GLYPH: stackRatio = RandomStackRatioGlyph; break;
|
||||
default: stackRatio = 0; break;
|
||||
}
|
||||
|
||||
uint32 stackIncrement = 1;
|
||||
switch (itemProto->Class)
|
||||
{
|
||||
case ITEM_CLASS_CONSUMABLE: stackIncrement = RandomStackIncrementConsumable; break;
|
||||
case ITEM_CLASS_CONTAINER: stackIncrement = RandomStackIncrementContainer; break;
|
||||
case ITEM_CLASS_WEAPON: stackIncrement = RandomStackIncrementWeapon; break;
|
||||
case ITEM_CLASS_GEM: stackIncrement = RandomStackIncrementGem; break;
|
||||
case ITEM_CLASS_REAGENT: stackIncrement = RandomStackIncrementReagent; break;
|
||||
case ITEM_CLASS_ARMOR: stackIncrement = RandomStackIncrementArmor; break;
|
||||
case ITEM_CLASS_PROJECTILE: stackIncrement = RandomStackIncrementProjectile; break;
|
||||
case ITEM_CLASS_TRADE_GOODS: stackIncrement = RandomStackIncrementTradeGood; break;
|
||||
case ITEM_CLASS_GENERIC: stackIncrement = RandomStackIncrementGeneric; break;
|
||||
case ITEM_CLASS_RECIPE: stackIncrement = RandomStackIncrementRecipe; break;
|
||||
case ITEM_CLASS_QUIVER: stackIncrement = RandomStackIncrementQuiver; break;
|
||||
case ITEM_CLASS_QUEST: stackIncrement = RandomStackIncrementQuest; break;
|
||||
case ITEM_CLASS_KEY: stackIncrement = RandomStackIncrementKey; break;
|
||||
case ITEM_CLASS_MISC: stackIncrement = RandomStackIncrementMisc; break;
|
||||
case ITEM_CLASS_GLYPH: stackIncrement = RandomStackIncrementGlyph; break;
|
||||
default: stackIncrement = 1; break;
|
||||
}
|
||||
|
||||
if (stackRatio > urand(0, 99))
|
||||
return urand(1, itemProto->GetMaxStackSize());
|
||||
{
|
||||
uint32 numOfPossibleStackIncrements = (uint32)std::ceil((float)itemProto->GetMaxStackSize() / (float)stackIncrement);
|
||||
uint32 numOfStacks = urand(1, numOfPossibleStackIncrements);
|
||||
uint32 randomStackSize = numOfStacks * stackIncrement;
|
||||
if (randomStackSize > itemProto->GetMaxStackSize())
|
||||
return itemProto->GetMaxStackSize();
|
||||
else
|
||||
return randomStackSize;
|
||||
}
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
@@ -1108,21 +1151,38 @@ void AuctionHouseBot::InitializeConfiguration()
|
||||
ItemsPerCycle = sConfigMgr->GetOption<uint32>("AuctionHouseBot.ItemsPerCycle", 75);
|
||||
|
||||
// Stack Ratios
|
||||
RandomStackRatioConsumable = GetRandomStackValue("AuctionHouseBot.RandomStackRatio.Consumable", 20);
|
||||
RandomStackRatioContainer = GetRandomStackValue("AuctionHouseBot.RandomStackRatio.Container", 0);
|
||||
RandomStackRatioWeapon = GetRandomStackValue("AuctionHouseBot.RandomStackRatio.Weapon", 0);
|
||||
RandomStackRatioGem = GetRandomStackValue("AuctionHouseBot.RandomStackRatio.Gem", 5);
|
||||
RandomStackRatioArmor = GetRandomStackValue("AuctionHouseBot.RandomStackRatio.Armor", 0);
|
||||
RandomStackRatioReagent = GetRandomStackValue("AuctionHouseBot.RandomStackRatio.Reagent", 50);
|
||||
RandomStackRatioProjectile = GetRandomStackValue("AuctionHouseBot.RandomStackRatio.Projectile", 100);
|
||||
RandomStackRatioTradeGood = GetRandomStackValue("AuctionHouseBot.RandomStackRatio.TradeGood", 50);
|
||||
RandomStackRatioGeneric = GetRandomStackValue("AuctionHouseBot.RandomStackRatio.Generic", 100);
|
||||
RandomStackRatioRecipe = GetRandomStackValue("AuctionHouseBot.RandomStackRatio.Recipe", 0);
|
||||
RandomStackRatioQuiver = GetRandomStackValue("AuctionHouseBot.RandomStackRatio.Quiver", 0);
|
||||
RandomStackRatioQuest = GetRandomStackValue("AuctionHouseBot.RandomStackRatio.Quest", 10);
|
||||
RandomStackRatioKey = GetRandomStackValue("AuctionHouseBot.RandomStackRatio.Key", 10);
|
||||
RandomStackRatioMisc = GetRandomStackValue("AuctionHouseBot.RandomStackRatio.Misc", 100);
|
||||
RandomStackRatioGlyph = GetRandomStackValue("AuctionHouseBot.RandomStackRatio.Glyph", 0);
|
||||
RandomStackRatioConsumable = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomRatio.Consumable", 50);
|
||||
RandomStackRatioContainer = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomRatio.Container", 0);
|
||||
RandomStackRatioWeapon = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomRatio.Weapon", 0);
|
||||
RandomStackRatioGem = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomRatio.Gem", 5);
|
||||
RandomStackRatioArmor = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomRatio.Armor", 0);
|
||||
RandomStackRatioReagent = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomRatio.Reagent", 50);
|
||||
RandomStackRatioProjectile = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomRatio.Projectile", 100);
|
||||
RandomStackRatioTradeGood = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomRatio.TradeGood", 50);
|
||||
RandomStackRatioGeneric = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomRatio.Generic", 100);
|
||||
RandomStackRatioRecipe = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomRatio.Recipe", 0);
|
||||
RandomStackRatioQuiver = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomRatio.Quiver", 0);
|
||||
RandomStackRatioQuest = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomRatio.Quest", 10);
|
||||
RandomStackRatioKey = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomRatio.Key", 10);
|
||||
RandomStackRatioMisc = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomRatio.Misc", 100);
|
||||
RandomStackRatioGlyph = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomRatio.Glyph", 0);
|
||||
|
||||
// Stack Ratios
|
||||
RandomStackIncrementConsumable = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Consumable", 5);
|
||||
RandomStackIncrementContainer = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Container", 1);
|
||||
RandomStackIncrementWeapon = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Weapon", 1);
|
||||
RandomStackIncrementGem = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Gem", 1);
|
||||
RandomStackIncrementArmor = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Armor", 1);
|
||||
RandomStackIncrementReagent = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Reagent", 1);
|
||||
RandomStackIncrementProjectile = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Projectile", 1000);
|
||||
RandomStackIncrementTradeGood = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.TradeGood", 5);
|
||||
RandomStackIncrementGeneric = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Generic", 1);
|
||||
RandomStackIncrementRecipe = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Recipe", 1);
|
||||
RandomStackIncrementQuiver = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Quiver", 1);
|
||||
RandomStackIncrementQuest = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Quest", 1);
|
||||
RandomStackIncrementKey = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Key", 1);
|
||||
RandomStackIncrementMisc = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Misc", 1);
|
||||
RandomStackIncrementGlyph = GetRandomStackValue("AuctionHouseBot.ListingStack.RandomStackIncrement.Glyph", 1);
|
||||
|
||||
// List Proportions
|
||||
ListProportionConsumable = sConfigMgr->GetOption<uint32>("AuctionHouseBot.ListProportion.Consumable", 2);
|
||||
|
||||
@@ -150,6 +150,21 @@ private:
|
||||
uint32 RandomStackRatioKey;
|
||||
uint32 RandomStackRatioMisc;
|
||||
uint32 RandomStackRatioGlyph;
|
||||
uint32 RandomStackIncrementConsumable;
|
||||
uint32 RandomStackIncrementContainer;
|
||||
uint32 RandomStackIncrementWeapon;
|
||||
uint32 RandomStackIncrementGem;
|
||||
uint32 RandomStackIncrementArmor;
|
||||
uint32 RandomStackIncrementReagent;
|
||||
uint32 RandomStackIncrementProjectile;
|
||||
uint32 RandomStackIncrementTradeGood;
|
||||
uint32 RandomStackIncrementGeneric;
|
||||
uint32 RandomStackIncrementRecipe;
|
||||
uint32 RandomStackIncrementQuiver;
|
||||
uint32 RandomStackIncrementQuest;
|
||||
uint32 RandomStackIncrementKey;
|
||||
uint32 RandomStackIncrementMisc;
|
||||
uint32 RandomStackIncrementGlyph;
|
||||
std::vector<uint32> ItemCandidateClassWeightedProportionList;
|
||||
std::map<uint32, std::vector<uint32>> ItemCandidatesByItemClass;
|
||||
uint32 ListProportionConsumable;
|
||||
|
||||
Reference in New Issue
Block a user