diff options
Diffstat (limited to 'src/server')
5 files changed, 103 insertions, 2 deletions
diff --git a/src/server/game/AuctionHouseBot/AuctionHouseBot.cpp b/src/server/game/AuctionHouseBot/AuctionHouseBot.cpp index 80b1c6cf8ac..1f0274572d7 100644 --- a/src/server/game/AuctionHouseBot/AuctionHouseBot.cpp +++ b/src/server/game/AuctionHouseBot/AuctionHouseBot.cpp @@ -248,6 +248,22 @@ void AuctionBotConfig::GetConfigFromFile()      SetConfig(CONFIG_AHBOT_CLASS_TRADEGOOD_MAX_ITEM_LEVEL, "AuctionHouseBot.Class.TradeGood.ItemLevel.Max", 0);      SetConfig(CONFIG_AHBOT_CLASS_CONTAINER_MIN_ITEM_LEVEL, "AuctionHouseBot.Class.Container.ItemLevel.Min", 0);      SetConfig(CONFIG_AHBOT_CLASS_CONTAINER_MAX_ITEM_LEVEL, "AuctionHouseBot.Class.Container.ItemLevel.Max", 0); + +    SetConfig(CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_CONSUMABLE, "AuctionHouseBot.Class.RandomStackRatio.Consumable", 20); +    SetConfig(CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_CONTAINER, "AuctionHouseBot.Class.RandomStackRatio.Container", 0); +    SetConfig(CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_WEAPON, "AuctionHouseBot.Class.RandomStackRatio.Weapon", 0); +    SetConfig(CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_GEM, "AuctionHouseBot.Class.RandomStackRatio.Gem", 20); +    SetConfig(CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_ARMOR, "AuctionHouseBot.Class.RandomStackRatio.Armor", 0); +    SetConfig(CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_REAGENT, "AuctionHouseBot.Class.RandomStackRatio.Reagent", 100); +    SetConfig(CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_PROJECTILE, "AuctionHouseBot.Class.RandomStackRatio.Projectile", 100); +    SetConfig(CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_TRADEGOOD, "AuctionHouseBot.Class.RandomStackRatio.TradeGood", 50); +    SetConfig(CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_GENERIC, "AuctionHouseBot.Class.RandomStackRatio.Generic", 100); +    SetConfig(CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_RECIPE, "AuctionHouseBot.Class.RandomStackRatio.Recipe", 0); +    SetConfig(CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_QUIVER, "AuctionHouseBot.Class.RandomStackRatio.Quiver", 0); +    SetConfig(CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_QUEST, "AuctionHouseBot.Class.RandomStackRatio.Quest", 100); +    SetConfig(CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_KEY, "AuctionHouseBot.Class.RandomStackRatio.Key", 100); +    SetConfig(CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_MISC, "AuctionHouseBot.Class.RandomStackRatio.Misc", 100); +    SetConfig(CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_GLYPH, "AuctionHouseBot.Class.RandomStackRatio.Glyph", 0);  }  char const* AuctionBotConfig::GetHouseTypeName(AuctionHouseType houseType) diff --git a/src/server/game/AuctionHouseBot/AuctionHouseBot.h b/src/server/game/AuctionHouseBot/AuctionHouseBot.h index a4b5976e85a..8f90e8fa76f 100644 --- a/src/server/game/AuctionHouseBot/AuctionHouseBot.h +++ b/src/server/game/AuctionHouseBot/AuctionHouseBot.h @@ -137,6 +137,21 @@ enum AuctionBotConfigUInt32Values      CONFIG_AHBOT_CLASS_TRADEGOOD_MAX_ITEM_LEVEL,      CONFIG_AHBOT_CLASS_CONTAINER_MIN_ITEM_LEVEL,      CONFIG_AHBOT_CLASS_CONTAINER_MAX_ITEM_LEVEL, +    CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_CONSUMABLE, +    CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_CONTAINER, +    CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_WEAPON, +    CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_GEM, +    CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_ARMOR, +    CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_REAGENT, +    CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_PROJECTILE, +    CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_TRADEGOOD, +    CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_GENERIC, +    CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_RECIPE, +    CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_QUIVER, +    CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_QUEST, +    CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_KEY, +    CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_MISC, +    CONFIG_AHBOT_CLASS_RANDOMSTACKRATIO_GLYPH,      CONFIG_UINT32_AHBOT_UINT32_COUNT  }; diff --git a/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp b/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp index d3215f10db5..b751f2747ef 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,15 @@ void AuctionBotSeller::SetPricesOfItem(ItemTemplate const* itemProto, SellerConf      bidp = urand(basePrice - range, basePrice + range) + 1;  } +// Determines the stack size to use for the item +uint32 AuctionBotSeller::GetStackSizeForItem(ItemTemplate const* itemProto, SellerConfiguration& config) const +{ +    if (config.GetRandomStackRatioPerClass(ItemClass(itemProto->Class)) > urand(0, 99)) +        return urand(1, itemProto->GetMaxStackSize()); +    else +        return 1; +} +  // Determine the multiplier for the sell price of any weapon without a buy price.  uint32 AuctionBotSeller::GetSellModifier(ItemTemplate const* prototype)  { @@ -950,7 +976,7 @@ void AuctionBotSeller::AddNewAuctions(SellerConfiguration& config)              continue;          } -        uint32 stackCount = urand(1, prototype->GetMaxStackSize()); +        uint32 stackCount = GetStackSizeForItem(prototype, config);          Item* item = Item::CreateItem(itemId, stackCount);          if (!item) diff --git a/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.h b/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.h index 7168915ec75..05782ee84b8 100644 --- a/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.h +++ b/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.h @@ -33,12 +33,13 @@ typedef std::vector<std::vector<uint32>> AllItemsArray;  struct SellerItemClassInfo  { -    SellerItemClassInfo(): AmountOfItems(0), MissItems(0), Quantity(0), PriceRatio(0) {} +    SellerItemClassInfo(): AmountOfItems(0), MissItems(0), Quantity(0), PriceRatio(0), RandomStackRatio(100) {}      uint32 AmountOfItems;      uint32 MissItems;      uint32 Quantity;      uint32 PriceRatio; +    uint32 RandomStackRatio;  };  struct SellerItemInfo @@ -102,6 +103,8 @@ public:      uint32 GetPriceRatioPerQuality(AuctionQuality quality) const { return _ItemInfo[quality].PriceRatio; }      void SetPriceRatioPerClass(ItemClass item, uint32 value) { _ItemInfo[0].ItemClassInfos[item].PriceRatio = value; }      uint32 GetPriceRatioPerClass(ItemClass item) const { return _ItemInfo[0].ItemClassInfos[item].PriceRatio; } +    void SetRandomStackRatioPerClass(ItemClass item, uint32 value) { _ItemInfo[0].ItemClassInfos[item].RandomStackRatio = value; } +    uint32 GetRandomStackRatioPerClass(ItemClass item) const { return _ItemInfo[0].ItemClassInfos[item].RandomStackRatio; }  private:      AuctionHouseType _houseType; @@ -139,6 +142,7 @@ private:      uint32 SetStat(SellerConfiguration& config);      bool GetItemsToSell(SellerConfiguration& config, ItemsToSellArray& itemsToSellArray, AllItemsArray const& addedItem);      void SetPricesOfItem(ItemTemplate const* itemProto, SellerConfiguration& config, uint32& buyp, uint32& bidp, uint32 stackcnt); +    uint32 GetStackSizeForItem(ItemTemplate const* itemProto, SellerConfiguration& config) const;      void LoadItemsQuantity(SellerConfiguration& config);      static uint32 GetBuyModifier(ItemTemplate const* prototype);      static uint32 GetSellModifier(ItemTemplate const* itemProto); diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 1b4ad557c0d..3e65a8589e4 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -3248,6 +3248,46 @@ AuctionHouseBot.forceIncludeItems = ""  AuctionHouseBot.forceExcludeItems = ""  # +#    AuctionHouseBot.Class.RandomStackRatio.* +#       Description: 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 +#       Default:     Consumable: 20 (20% random stack size, 80% single stack size) +#                    Container: 0 (100% single stack size) +#                    Weapon: 0 (100% single stack size) +#                    Gem: 20 (20% random stack size, 80% single stack size) +#                    Armor: 0 (100% single stack size) +#                    Reagent: 100 (100% random stack size) +#                    Projectile: 100 (100% random stack size) +#                    TradeGood: 50 (50% random stack size, 50% single stack size) +#                    Generic: 100 (100% random stack size) +#                    Recipe: 0 (100% single stack size) +#                    Quiver: 0 (100% single stack size) +#                    Quest: 100 (100% random stack size) +#                    Key: 100 (100% random stack size) +#                    Misc: 100 (100% random stack size) +#                    Glyph: 0 (100% single stack size) +# + +AuctionHouseBot.Class.RandomStackRatio.Consumable = 20 +AuctionHouseBot.Class.RandomStackRatio.Container = 0 +AuctionHouseBot.Class.RandomStackRatio.Weapon = 0 +AuctionHouseBot.Class.RandomStackRatio.Gem = 20 +AuctionHouseBot.Class.RandomStackRatio.Armor = 0 +AuctionHouseBot.Class.RandomStackRatio.Reagent = 100 +AuctionHouseBot.Class.RandomStackRatio.Projectile = 100 +AuctionHouseBot.Class.RandomStackRatio.TradeGood = 50 +AuctionHouseBot.Class.RandomStackRatio.Generic = 100 +AuctionHouseBot.Class.RandomStackRatio.Recipe = 0 +AuctionHouseBot.Class.RandomStackRatio.Quiver = 0 +AuctionHouseBot.Class.RandomStackRatio.Quest = 100 +AuctionHouseBot.Class.RandomStackRatio.Key = 100 +AuctionHouseBot.Class.RandomStackRatio.Misc = 100 +AuctionHouseBot.Class.RandomStackRatio.Glyph = 0 + +#  ###################################################################################################  ###################################################################################################  | 
