diff options
| author | NathanHandley <necreia@gmail.com> | 2015-12-25 18:54:15 -0600 |
|---|---|---|
| committer | NathanHandley <necreia@gmail.com> | 2015-12-25 18:54:15 -0600 |
| commit | 33a75afb60f8e9ad44c7a87f7f52dae27dab62b6 (patch) | |
| tree | ad59d1ba7e1ac0a32a2288f063428f67032d8545 /src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp | |
| parent | 347373264b4ca5046af5c23378117e6ddb66504d (diff) | |
Updated AuctionHouseSeller to have item class level stack control
For each item class (consumable, glyph), you can now edit the worldserver.conf to
configure the ratio (percent) of random compared to single stack auction postings.
Example 1
AuctionHouseBot.Class.RandomStackRatio.Consumable = 0
- New consumable auctions posted by AuctionHouseSeller will always be single stack.
Example 2
AuctionHouseBot.Class.RandomStackRatio.Consumable = 100
- New consumable auctions posted by AuctionHouseSeller will always be of a random
stack size.
Example 3
AuctionHouseBot.Class.RandomStackRatio.Consumable = 20
- New consumable auctions posted by AuctionHouseSeller have a 20% chance of being a
random stack size, and an 80% chance of being single stack size.
Diffstat (limited to 'src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp')
| -rw-r--r-- | src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp b/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp index 22dc5bb0bd0..6375b9726e6 100644 --- a/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp +++ b/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp @@ -533,6 +533,23 @@ void AuctionBotSeller::LoadItemsQuantity(SellerConfiguration& config) config.SetItemsQuantityPerClass(AUCTION_QUALITY_YELLOW, ITEM_CLASS_GLYPH, 0); // ============================================================================================ + // Set Stack Quantities + config.SetRandomStackRatioPerClass(ITEM_CLASS_CONSUMABLE, sAuctionBotConfig->GetConfig(CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_CONSUMABLE)); + config.SetRandomStackRatioPerClass(ITEM_CLASS_CONTAINER, sAuctionBotConfig->GetConfig(CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_CONTAINER)); + config.SetRandomStackRatioPerClass(ITEM_CLASS_WEAPON, sAuctionBotConfig->GetConfig(CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_WEAPON)); + config.SetRandomStackRatioPerClass(ITEM_CLASS_GEM, sAuctionBotConfig->GetConfig(CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_GEM)); + config.SetRandomStackRatioPerClass(ITEM_CLASS_ARMOR, sAuctionBotConfig->GetConfig(CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_ARMOR)); + config.SetRandomStackRatioPerClass(ITEM_CLASS_REAGENT, sAuctionBotConfig->GetConfig(CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_REAGENT)); + config.SetRandomStackRatioPerClass(ITEM_CLASS_PROJECTILE, sAuctionBotConfig->GetConfig(CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_PROJECTILE)); + config.SetRandomStackRatioPerClass(ITEM_CLASS_TRADE_GOODS, sAuctionBotConfig->GetConfig(CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_TRADEGOOD)); + config.SetRandomStackRatioPerClass(ITEM_CLASS_GENERIC, sAuctionBotConfig->GetConfig(CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_GENERIC)); + config.SetRandomStackRatioPerClass(ITEM_CLASS_RECIPE, sAuctionBotConfig->GetConfig(CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_RECIPE)); + config.SetRandomStackRatioPerClass(ITEM_CLASS_QUIVER, sAuctionBotConfig->GetConfig(CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_QUIVER)); + config.SetRandomStackRatioPerClass(ITEM_CLASS_QUEST, sAuctionBotConfig->GetConfig(CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_QUEST)); + config.SetRandomStackRatioPerClass(ITEM_CLASS_KEY, sAuctionBotConfig->GetConfig(CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_KEY)); + config.SetRandomStackRatioPerClass(ITEM_CLASS_MISC, sAuctionBotConfig->GetConfig(CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_MISC)); + config.SetRandomStackRatioPerClass(ITEM_CLASS_GLYPH, sAuctionBotConfig->GetConfig(CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_GLYPH)); + // Set the best value to get nearest amount of items wanted for (uint32 j = 0; j < MAX_AUCTION_QUALITY; ++j) { @@ -719,6 +736,24 @@ void AuctionBotSeller::SetPricesOfItem(ItemTemplate const* itemProto, SellerConf bidp = urand(basePrice - range, basePrice + range) + 1; } +// Determines the stack size to use for the item +void AuctionBotSeller::SetStackSizeForItem(ItemTemplate const* itemProto, SellerConfiguration& config, uint32& stackcnt) +{ + uint32 randomStackPercent = config.GetRandomStackRatioPerClass(ItemClass(itemProto->Class)); + if (randomStackPercent >= 100) + stackcnt = urand(1, itemProto->GetMaxStackSize()); + else if (randomStackPercent == 0) + stackcnt = 1; + else + { + uint32 randomStackRoll = urand(0, 99); + if (randomStackRoll < randomStackPercent) + stackcnt = urand(1, itemProto->GetMaxStackSize()); + else + stackcnt = 1; + } +} + // Determine the multiplier for the sell price of any weapon without a buy price. uint32 AuctionBotSeller::GetSellModifier(ItemTemplate const* prototype) { @@ -952,7 +987,8 @@ void AuctionBotSeller::AddNewAuctions(SellerConfiguration& config) continue; } - uint32 stackCount = urand(1, prototype->GetMaxStackSize()); + uint32 stackCount = 1; + SetStackSizeForItem(prototype, config, stackCount); Item* item = Item::CreateItem(itemId, stackCount); if (!item) |
