About

This is a mangos patch submitted to the official mangos zero repository that adds an option to the auction house bot to auction items under an existing character rather than putting items up with no seller.

Motivation

The main motivation is using addons such as Auctioneer that manifest an odd slowdown when scanning an auction house with items put up for sale under no name. For instance, scanning an auction house with just five pages leads to an infinite estimated scanning time:

with the patch applied, the scanning completes almost instantly:

Code

Sell Under Existing Character Name

--- a/src/game/AuctionHouseBot/AuctionHouseBot.cpp
+++ b/src/game/AuctionHouseBot/AuctionHouseBot.cpp
@@ -484,6 +484,7 @@ void AuctionBotConfig::GetConfigFromFile()
 
 
SetAHBotIncludes(m_AhBotCfg.GetStringDefault("AuctionHouseBot.forceIncludeItems",
""));
 
SetAHBotExcludes(m_AhBotCfg.GetStringDefault("AuctionHouseBot.forceExcludeItems",
""));
--- a/src/game/AuctionHouseBot/AuctionHouseBot.h
+++ b/src/game/AuctionHouseBot/AuctionHouseBot.h
@@ -192,6 +192,12 @@ class AuctionBotConfig
          * @return const char
          */
         const char* GetAHBotExcludes() const { return
m_AHBotExcludes.c_str(); }
+        /**
+         * @brief
+         *
+         * @return const char
+         */
+        const char* GetAHBotCharacterName() const { return
m_AHBotCharacterName.c_str(); }
 
--- a/src/game/AuctionHouseBot/ahbot.conf.dist.in
+++ b/src/game/AuctionHouseBot/ahbot.conf.dist.in
@@ -8,6 +8,11 @@ ConfVersion=2010102201
 ################################################################################
 # AUCTION HOUSE BOT SETTINGS
 #
+#    AuctionHouseBot.CharacterName
+#        The name of the character that the bot will use to auction
+#        items in the Alliance, Horde and neutral auction houses.
+#    Default "" (No owner)
+#
 #    AuctionHouseBot.Seller.Enabled
 #        Enable or disable sales functionality
 #    Default 0 (Disabled)
@@ -145,6 +150,7 @@ ConfVersion=2010102201
 #    Default ""
 #
 ################################################################################
+AuctionHouseBot.CharacterName  = ""
 AuctionHouseBot.Seller.Enabled = 0
 AuctionHouseBot.DEBUG.Seller   = 0

Enabling Commands and Handling

--- AuctionHouseBot.cpp.bak	2016-06-09 08:37:02.000000000 +0100
+++ AuctionHouseBot.cpp	2016-06-12 11:20:02.356000000 +0100
@@ -717,7 +717,11 @@
                 else if (buyerItem.MinBidPrice == 0)
                     { buyerItem.MinBidPrice = Aentry->startbid / item->GetCount(); }
 
-                if (!Aentry->owner)
+                uint32 AHBotGuid;
+                std::string AHBotCharacterName = sAuctionBotConfig.GetAHBotCharacterName();
+                if (!AHBotCharacterName.empty())
+                    { AHBotGuid = sObjectMgr.GetPlayerGuidByName(AHBotCharacterName.c_str()); }
+                if (!Aentry->owner || Aentry->owner == AHBotGuid)
                 {
                     if ((Aentry->bid != 0) && Aentry->bidder) // Add bided by player
                     {
@@ -992,11 +996,15 @@
                          minBuyPrice / 10000, minBidPrice / 10000);
         DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: Actual Entry price,  Buy=%ug, Bid=%ug.", buyoutPrice / 10000, bidPrice / 10000);
 
-        if (!auction->owner)                // Original auction owner
+        uint32 AHBotGuid;
+        std::string AHBotCharacterName = sAuctionBotConfig.GetAHBotCharacterName();
+        if (!AHBotCharacterName.empty())
+            { AHBotGuid = sObjectMgr.GetPlayerGuidByName(AHBotCharacterName.c_str()); }
+        if (!auction->owner || auction->owner == AHBotGuid)        // Original auction owner
         {
-            MaxChance = MaxChance / 5;      // if Owner is AHBot this mean player placed bid on this auction. We divide by 5 chance for AhBuyer to place bid on it. (This make more challenge than ignore entry)
+            MaxChance = MaxChance / 5;                             // if Owner is AHBot this mean player placed bid on this auction. We divide by 5 chance for AhBuyer to place bid on it. (This make more challenge than ignore entry)
         }
-        if (auction->buyout != 0)           // Is the item directly buyable?
+        if (auction->buyout != 0)                                  // Is the item directly buyable?
         {
             if (IsBuyableEntry(buyoutPrice, InGame_BuyPrice, MaxBuyablePrice, minBuyPrice, MaxChance, config.FactionChance))
             {
@@ -1544,7 +1552,11 @@
             ItemPrototype const* prototype = item->GetProto();
             if (prototype)
             {
-                if (!Aentry->owner)                         // Add only ahbot items
+                uint32 AHBotGuid;
+                std::string AHBotCharacterName = sAuctionBotConfig.GetAHBotCharacterName();
+                if (!AHBotCharacterName.empty())
+                    { AHBotGuid = sObjectMgr.GetPlayerGuidByName(AHBotCharacterName.c_str()); }
+                if (!Aentry->owner || Aentry->owner == AHBotGuid)                                  // Add only ahbot items
                 {
                     ++ItemsInAH[prototype->Quality][prototype->Class];
                 }
@@ -1859,7 +1871,11 @@
             if (Item* item = sAuctionMgr.GetAItem(Aentry->itemGuidLow))
             {
                 ItemPrototype const* prototype = item->GetProto();
-                if (!Aentry->owner)                         // Add only ahbot items
+                uint32 AHBotGuid;
+                std::string AHBotCharacterName = sAuctionBotConfig.GetAHBotCharacterName();
+                if (!AHBotCharacterName.empty())
+                    { AHBotGuid = sObjectMgr.GetPlayerGuidByName(AHBotCharacterName.c_str()); }
+                if (!Aentry->owner || Aentry->owner == AHBotGuid)                                  // Add only ahbot items
                 {
                     if (prototype->Quality < MAX_AUCTION_QUALITY)
                         { ++statusInfo[i].QualityInfo[prototype->Quality]; }
@@ -1880,8 +1896,12 @@
         for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
         {
             AuctionEntry* entry = itr->second;
-            if (!entry->owner)                              // ahbot auction
-                if (all || entry->bid == 0)                 // expire now auction if no bid or forced
+            uint32 AHBotGuid;
+            std::string AHBotCharacterName = sAuctionBotConfig.GetAHBotCharacterName();
+            if (!AHBotCharacterName.empty())
+                { AHBotGuid = sObjectMgr.GetPlayerGuidByName(AHBotCharacterName.c_str()); };
+            if (!entry->owner || entry->owner == AHBotGuid)                                        // ahbot auction
+                if (all || entry->bid == 0)                                                        // expire now auction if no bid or forced
                     entry->expireTime = sWorld.GetGameTime();
         }
     }

mangos/server_patches/auction_items_under_existing_character.txt ยท Last modified: 2022/04/19 08:28 by 127.0.0.1

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.