diff --git a/.gitignore b/.gitignore index d011fdd..0a3f59e 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,7 @@ CMakeLists.txt.user nbproject/ .sync.ffs_db *.kate-swp +.vscode # # Eclipse diff --git a/src/AuctionHouseBot.cpp b/src/AuctionHouseBot.cpp index e74d674..c183e0c 100644 --- a/src/AuctionHouseBot.cpp +++ b/src/AuctionHouseBot.cpp @@ -32,16 +32,16 @@ using namespace std; AuctionHouseBot::AuctionHouseBot(uint32 account, uint32 id) { - _account = account; - _id = id; + _account = account; + _id = id; - _lastrun_a_sec = time(NULL); - _lastrun_h_sec = time(NULL); - _lastrun_n_sec = time(NULL); + _lastrun_a_sec = time(NULL); + _lastrun_h_sec = time(NULL); + _lastrun_n_sec = time(NULL); _allianceConfig = NULL; - _hordeConfig = NULL; - _neutralConfig = NULL; + _hordeConfig = NULL; + _neutralConfig = NULL; } AuctionHouseBot::~AuctionHouseBot() @@ -49,7 +49,7 @@ AuctionHouseBot::~AuctionHouseBot() // Nothing } -uint32 AuctionHouseBot::getElement(std::set set, int index, uint32 botId, uint32 maxDup, AuctionHouseObject* auctionHouse) +uint32 AuctionHouseBot::getElement(std::set set, int index, uint32 botId, uint32 maxDup, AuctionHouseObject *auctionHouse) { std::set::iterator it = set.begin(); std::advance(it, index); @@ -60,7 +60,7 @@ uint32 AuctionHouseBot::getElement(std::set set, int index, uint32 botId for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = auctionHouse->GetAuctionsBegin(); itr != auctionHouse->GetAuctionsEnd(); ++itr) { - AuctionEntry* Aentry = itr->second; + AuctionEntry *Aentry = itr->second; if (Aentry->owner.GetCounter() == botId) { @@ -80,16 +80,16 @@ uint32 AuctionHouseBot::getElement(std::set set, int index, uint32 botId return *it; } -uint32 AuctionHouseBot::getStackCount(AHBConfig* config, uint32 max) +uint32 AuctionHouseBot::getStackCount(AHBConfig *config, uint32 max) { if (max == 1) { return 1; } - // + // // Organize the stacks in a pseudo random way - // + // if (config->DivisibleStacks) { @@ -118,9 +118,9 @@ uint32 AuctionHouseBot::getStackCount(AHBConfig* config, uint32 max) return ret; } - // + // // Totally random - // + // return urand(1, max); } @@ -130,7 +130,7 @@ uint32 AuctionHouseBot::getElapsedTime(uint32 timeClass) switch (timeClass) { case 2: - return urand(1, 5) * 600; // SHORT = In the range of one hour + return urand(1, 5) * 600; // SHORT = In the range of one hour case 1: return urand(1, 23) * 3600; // MEDIUM = In the range of one day @@ -140,7 +140,7 @@ uint32 AuctionHouseBot::getElapsedTime(uint32 timeClass) } } -uint32 AuctionHouseBot::getNofAuctions(AHBConfig* config, AuctionHouseObject* auctionHouse, ObjectGuid guid) +uint32 AuctionHouseBot::getNofAuctions(AHBConfig *config, AuctionHouseObject *auctionHouse, ObjectGuid guid) { // // All the auctions @@ -159,7 +159,7 @@ uint32 AuctionHouseBot::getNofAuctions(AHBConfig* config, AuctionHouseObject* au for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = auctionHouse->GetAuctionsBegin(); itr != auctionHouse->GetAuctionsEnd(); ++itr) { - AuctionEntry* Aentry = itr->second; + AuctionEntry *Aentry = itr->second; if (guid == Aentry->owner) { @@ -172,13 +172,13 @@ uint32 AuctionHouseBot::getNofAuctions(AHBConfig* config, AuctionHouseObject* au } // ============================================================================= -// This routine performs the bidding operations for the bot +// This routine performs the bidding/buyout operations for the bot. // ============================================================================= -void AuctionHouseBot::Buy(Player* AHBplayer, AHBConfig* config, WorldSession* session) +void AuctionHouseBot::Buy(Player *AHBplayer, AHBConfig *config, WorldSession *session) { // - // Check if disabled + // Check if disabled. // if (!config->AHBBuyer) @@ -187,70 +187,57 @@ void AuctionHouseBot::Buy(Player* AHBplayer, AHBConfig* config, WorldSession* se } // - // Retrieve items not owner by the bot and not bought by the bot + // Retrieve items not owned and not sold/bidded on by the bot. // QueryResult result = CharacterDatabase.Query("SELECT id FROM auctionhouse WHERE itemowner<>{} AND buyguid<>{}", _id, _id); - if (!result) - { - return; - } - - if (result->GetRowCount() == 0) + if (!result || result->GetRowCount() == 0) { return; } // - // Fetches content of selected AH to look for possible bids + // List all existing auctions in AHs enabled in config. // - AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(config->GetAHFID()); - std::set possibleBids; + AuctionHouseObject *auctionHouse = sAuctionMgr->GetAuctionsMap(config->GetAHFID()); + std::set auctionPool; do { - uint32 tmpdata = result->Fetch()->Get(); - possibleBids.insert(tmpdata); + uint32 auctionGuid = result->Fetch()->Get(); + auctionPool.insert(auctionGuid); } while (result->NextRow()); - // - // If it's not possible to bid stop here - // - - if (possibleBids.empty()) + if (auctionPool.empty()) { if (config->DebugOutBuyer) { - LOG_INFO("module", "AHBot [{}]: no auctions to bid on has been recovered", _id); + LOG_INFO("module", "AHBot [{}]: no existing auctions found.", _id); } return; } // - // Perform the operation for a maximum amount of bids attempts configured + // Perform the operation for a maximum amount of bid attempts (defined in config). // - for (uint32 count = 1; count <= config->GetBidsPerInterval(); ++count) + for (uint32 count = 0; count < config->GetBidsPerInterval(); ++count) { // - // Choose a random auction from possible auctions + // Pick an auction from the pool randomly. // - uint32 randBid = urand(0, possibleBids.size() - 1); + uint32 randBid = urand(0, auctionPool.size() - 1); - std::set::iterator it = possibleBids.begin(); + std::set::iterator it = auctionPool.begin(); std::advance(it, randBid); - AuctionEntry* auction = auctionHouse->GetAuction(*it); - - // - // Prevent to bid again on the same auction - // + AuctionEntry *auction = auctionHouse->GetAuction(*it); - possibleBids.erase(randBid); + auctionPool.erase(it); // don't bid on the same auction twice if (!auction) { @@ -258,7 +245,7 @@ void AuctionHouseBot::Buy(Player* AHBplayer, AHBConfig* config, WorldSession* se } // - // Prevent from buying items from the other bots + // Do not bid on auctions created by bots. // if (gBotsId.find(auction->owner.GetCounter()) != gBotsId.end()) @@ -267,10 +254,10 @@ void AuctionHouseBot::Buy(Player* AHBplayer, AHBConfig* config, WorldSession* se } // - // Get the item information + // Get item information and exclude items with a too high quality. // - Item* pItem = sAuctionMgr->GetAItem(auction->item_guid); + Item *pItem = sAuctionMgr->GetAItem(auction->item_guid); if (!pItem) { @@ -282,239 +269,190 @@ void AuctionHouseBot::Buy(Player* AHBplayer, AHBConfig* config, WorldSession* se continue; } - // - // Get the item prototype - // - - ItemTemplate const* prototype = sObjectMgr->GetItemTemplate(auction->item_template); - - // - // Check which price we have to use, startbid or if it is bidded already - // + ItemTemplate const *prototype = sObjectMgr->GetItemTemplate(auction->item_template); - uint32 currentprice; - - if (auction->bid) - { - currentprice = auction->bid; - } - else + if (prototype->Quality > AHB_MAX_QUALITY) { - currentprice = auction->startbid; + if (config->DebugOutBuyer) + { + LOG_INFO("module", "AHBot [{}]: Quality {} not supported.", _id, prototype->Quality); + } + + continue; } // - // Prepare portion from maximum bid + // Determine current price. // - double bidrate = static_cast(urand(1, 100)) / 100; - long double bidMax = 0; + uint32 currentPrice = auction->bid ? auction->bid : auction->startbid; // - // Check that bid has an acceptable value and take bid based on vendorprice, stacksize and quality + // Determine maximum bid and skip auctions with too high a currentPrice. // - if (config->BuyMethod) - { - if (prototype->Quality <= AHB_MAX_QUALITY) - { - if (currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(prototype->Quality)) - { - bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(prototype->Quality); - } - } - else - { - if (config->DebugOutBuyer) - { - LOG_ERROR("module", "AHBot [{}]: Quality {} not Supported", _id, prototype->Quality); - } + double basePrice = config->UseBuyPriceForBuyer ? prototype->BuyPrice : prototype->SellPrice; + double maximumBid = basePrice * pItem->GetCount() * config->GetBuyerPrice(prototype->Quality); - continue; - } + if (config->DebugOutBuyer) + { + LOG_INFO("module", "-------------------------------------------------"); + LOG_INFO("module", "AHBot [{}]: Info for Auction #{}:", _id, auction->Id); + LOG_INFO("module", "AHBot [{}]: AuctionHouse: {}", _id, auction->GetHouseId()); + LOG_INFO("module", "AHBot [{}]: Owner: {}", _id, auction->owner.ToString()); + LOG_INFO("module", "AHBot [{}]: Bidder: {}", _id, auction->bidder.ToString()); + LOG_INFO("module", "AHBot [{}]: Starting Bid: {}", _id, auction->startbid); + LOG_INFO("module", "AHBot [{}]: Current Bid: {}", _id, currentPrice); + LOG_INFO("module", "AHBot [{}]: Buyout: {}", _id, auction->buyout); + LOG_INFO("module", "AHBot [{}]: Deposit: {}", _id, auction->deposit); + LOG_INFO("module", "AHBot [{}]: Expire Time: {}", _id, uint32(auction->expire_time)); + LOG_INFO("module", "AHBot [{}]: Bid Max: {}", _id, maximumBid); + LOG_INFO("module", "AHBot [{}]: Item GUID: {}", _id, auction->item_guid.ToString()); + LOG_INFO("module", "AHBot [{}]: Item Template: {}", _id, auction->item_template); + LOG_INFO("module", "AHBot [{}]: Item ID: {}", _id, prototype->ItemId); + LOG_INFO("module", "AHBot [{}]: Buy Price: {}", _id, prototype->BuyPrice); + LOG_INFO("module", "AHBot [{}]: Sell Price: {}", _id, prototype->SellPrice); + LOG_INFO("module", "AHBot [{}]: Bonding: {}", _id, prototype->Bonding); + LOG_INFO("module", "AHBot [{}]: Quality: {}", _id, prototype->Quality); + LOG_INFO("module", "AHBot [{}]: Item Level: {}", _id, prototype->ItemLevel); + LOG_INFO("module", "AHBot [{}]: Ammo Type: {}", _id, prototype->AmmoType); + LOG_INFO("module", "-------------------------------------------------"); } - else + + if (currentPrice > maximumBid) { - if (prototype->Quality <= AHB_MAX_QUALITY) + if (config->DebugOutBuyer) { - if (currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(prototype->Quality)) - { - bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(prototype->Quality); - } + LOG_INFO("module", "AHBot [{}]: Current price too high, skipped.", _id); } - else - { - if (config->DebugOutBuyer) - { - LOG_ERROR("module", "AHBot [{}]: Quality {} not Supported", _id, prototype->Quality); - } - continue; - } + continue; } // - // Recalculate the bid depending on the type of the item + // Specific item class maximum bid adjustments. // switch (prototype->Class) { - // ammo - case 6: - bidMax = 0; - break; + // TODO: Add balancing rules for items such as glyphs here. default: break; } // - // Test the computed bid + // Make sure to skip the auction if maximum bid is 0. // - if (bidMax == 0) + if (maximumBid == 0) { continue; } // - // Calculate our bid + // Calculate our bid. // - long double bidvalue = currentprice + ((bidMax - currentprice) * bidrate); - uint32 bidprice = static_cast(bidvalue); + double bidRate = static_cast(urand(1, 100)) / 100; + double bidValue = currentPrice + ((maximumBid - currentPrice) * bidRate); + uint32 bidPrice = static_cast(bidValue); // // Check our bid is high enough to be valid. If not, correct it to minimum. // - if ((currentprice + auction->GetAuctionOutBid()) > bidprice) + uint32 minimumOutbid = auction->GetAuctionOutBid(); + if ((currentPrice + minimumOutbid) > bidPrice) { - bidprice = currentprice + auction->GetAuctionOutBid(); + bidPrice = currentPrice + minimumOutbid; } // - // Print out debug info + // Print out debug info. // if (config->DebugOutBuyer) { LOG_INFO("module", "-------------------------------------------------"); - LOG_INFO("module", "AHBot [{}]: Info for Auction #{}:", _id, auction->Id); - LOG_INFO("module", "AHBot [{}]: AuctionHouse: {}" , _id, auction->GetHouseId()); - LOG_INFO("module", "AHBot [{}]: Owner: {}" , _id, auction->owner.ToString()); - LOG_INFO("module", "AHBot [{}]: Bidder: {}" , _id, auction->bidder.ToString()); - LOG_INFO("module", "AHBot [{}]: Starting Bid: {}" , _id, auction->startbid); - LOG_INFO("module", "AHBot [{}]: Current Bid: {}" , _id, currentprice); - LOG_INFO("module", "AHBot [{}]: Buyout: {}" , _id, auction->buyout); - LOG_INFO("module", "AHBot [{}]: Deposit: {}" , _id, auction->deposit); - LOG_INFO("module", "AHBot [{}]: Expire Time: {}" , _id, uint32(auction->expire_time)); - LOG_INFO("module", "AHBot [{}]: Bid Rate: {}" , _id, bidrate); - LOG_INFO("module", "AHBot [{}]: Bid Max: {}" , _id, bidMax); - LOG_INFO("module", "AHBot [{}]: Bid Value: {}" , _id, bidvalue); - LOG_INFO("module", "AHBot [{}]: Bid Price: {}" , _id, bidprice); - LOG_INFO("module", "AHBot [{}]: Item GUID: {}" , _id, auction->item_guid.ToString()); - LOG_INFO("module", "AHBot [{}]: Item Template: {}" , _id, auction->item_template); - LOG_INFO("module", "AHBot [{}]: Item Info:"); - LOG_INFO("module", "AHBot [{}]: Item ID: {}" , _id, prototype->ItemId); - LOG_INFO("module", "AHBot [{}]: Buy Price: {}" , _id, prototype->BuyPrice); - LOG_INFO("module", "AHBot [{}]: Sell Price: {}" , _id, prototype->SellPrice); - LOG_INFO("module", "AHBot [{}]: Bonding: {}" , _id, prototype->Bonding); - LOG_INFO("module", "AHBot [{}]: Quality: {}" , _id, prototype->Quality); - LOG_INFO("module", "AHBot [{}]: Item Level: {}" , _id, prototype->ItemLevel); - LOG_INFO("module", "AHBot [{}]: Ammo Type: {}" , _id, prototype->AmmoType); + LOG_INFO("module", "AHBot [{}]: Bid Rate: {}", _id, bidRate); + LOG_INFO("module", "AHBot [{}]: Bid Value: {}", _id, bidValue); + LOG_INFO("module", "AHBot [{}]: Bid Price: {}", _id, bidPrice); + LOG_INFO("module", "AHBot [{}]: Minimum Outbid: {}", _id, minimumOutbid); LOG_INFO("module", "-------------------------------------------------"); } // - // Check whether we do normal bid, or buyout + // Check whether we bid or buyout. // - bool bought = false; - - if ((bidprice < auction->buyout) || (auction->buyout == 0)) + if ((bidPrice < auction->buyout) || (auction->buyout == 0)) // BID { - // - // Perform a new bid on the auction - // - + if (auction->bidder) { if (auction->bidder != AHBplayer->GetGUID()) { // - // Mail to last bidder and return their money + // Return money to last bidder. // - + auto trans = CharacterDatabase.BeginTransaction(); - - sAuctionMgr->SendAuctionOutbiddedMail(auction, bidprice, session->GetPlayer(), trans); - CharacterDatabase.CommitTransaction (trans); + sAuctionMgr->SendAuctionOutbiddedMail(auction, bidPrice, session->GetPlayer(), trans); + CharacterDatabase.CommitTransaction(trans); } } - + auction->bidder = AHBplayer->GetGUID(); - auction->bid = bidprice; - + auction->bid = bidPrice; + // - // Save the auction into database + // Persist auction in database. // - + CharacterDatabase.Execute("UPDATE auctionhouse SET buyguid = '{}', lastbid = '{}' WHERE id = '{}'", auction->bidder.GetCounter(), auction->bid, auction->Id); + + if (config->TraceBuyer) + { + LOG_INFO("module", "AHBot [{}]: New bid, id={}, ah={}, item={}, start={}, current={}, buyout={}", _id, prototype->ItemId, auction->GetHouseId(), auction->item_template, auction->startbid, currentPrice, auction->buyout); + } } - else + else // BUYOUT { - bought = true; - - // - // Perform the buyout - // - auto trans = CharacterDatabase.BeginTransaction(); if ((auction->bidder) && (AHBplayer->GetGUID() != auction->bidder)) { // - // Send the mail to the last bidder + // Return money to last bidder. // sAuctionMgr->SendAuctionOutbiddedMail(auction, auction->buyout, session->GetPlayer(), trans); } auction->bidder = AHBplayer->GetGUID(); - auction->bid = auction->buyout; + auction->bid = auction->buyout; - // - // Send mails to buyer & seller - // + // + // Send mails to buyer & seller. + // sAuctionMgr->SendAuctionSuccessfulMail(auction, trans); - sAuctionMgr->SendAuctionWonMail (auction, trans); + sAuctionMgr->SendAuctionWonMail(auction, trans); - // - // Removes any trace of the item - // + // + // Delete the auction. + // auction->DeleteFromDB(trans); - sAuctionMgr->RemoveAItem (auction->item_guid); + sAuctionMgr->RemoveAItem(auction->item_guid); auctionHouse->RemoveAuction(auction); CharacterDatabase.CommitTransaction(trans); - } - // - // Tracing - // - - if (config->TraceBuyer) - { - if (bought) + if (config->TraceBuyer) { - LOG_INFO("module", "AHBot [{}]: Bought , id={}, ah={}, item={}, start={}, current={}, buyout={}", _id, prototype->ItemId, auction->GetHouseId(), auction->item_template, auction->startbid, currentprice, auction->buyout); - } - else - { - LOG_INFO("module", "AHBot [{}]: New bid, id={}, ah={}, item={}, start={}, current={}, buyout={}", _id, prototype->ItemId, auction->GetHouseId(), auction->item_template, auction->startbid, currentprice, auction->buyout); + LOG_INFO("module", "AHBot [{}]: Bought , id={}, ah={}, item={}, start={}, current={}, buyout={}", _id, prototype->ItemId, auction->GetHouseId(), auction->item_template, auction->startbid, currentPrice, auction->buyout); } } } @@ -524,20 +462,20 @@ void AuctionHouseBot::Buy(Player* AHBplayer, AHBConfig* config, WorldSession* se // This routine performs the selling operations for the bot // ============================================================================= -void AuctionHouseBot::Sell(Player* AHBplayer, AHBConfig* config) +void AuctionHouseBot::Sell(Player *AHBplayer, AHBConfig *config) { - // + // // Check if disabled - // + // if (!config->AHBSeller) { return; } - // + // // Check the given limits - // + // uint32 minItems = config->GetMinItems(); uint32 maxItems = config->GetMaxItems(); @@ -547,18 +485,18 @@ void AuctionHouseBot::Sell(Player* AHBplayer, AHBConfig* config) return; } - // + // // Retrieve the auction house situation - // + // - AuctionHouseEntry const* ahEntry = sAuctionMgr->GetAuctionHouseEntry(config->GetAHFID()); + AuctionHouseEntry const *ahEntry = sAuctionMgr->GetAuctionHouseEntry(config->GetAHFID()); if (!ahEntry) { return; } - AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(config->GetAHFID()); + AuctionHouseObject *auctionHouse = sAuctionMgr->GetAuctionsMap(config->GetAHFID()); if (!auctionHouse) { @@ -567,14 +505,14 @@ void AuctionHouseBot::Sell(Player* AHBplayer, AHBConfig* config) auctionHouse->Update(); - // + // // Check if we are clear to proceed - // + // - bool aboveMin = false; - bool aboveMax = false; + bool aboveMin = false; + bool aboveMax = false; uint32 auctions = getNofAuctions(config, auctionHouse, AHBplayer->GetGUID()); - uint32 items = 0; + uint32 items = 0; if (auctions >= minItems) { @@ -609,57 +547,57 @@ void AuctionHouseBot::Sell(Player* AHBplayer, AHBConfig* config) items = (maxItems - auctions); } - // + // // Retrieve the configuration for this run - // + // - uint32 greyTGcount = config->GetMaximum(AHB_GREY_TG); - uint32 whiteTGcount = config->GetMaximum(AHB_WHITE_TG); - uint32 greenTGcount = config->GetMaximum(AHB_GREEN_TG); - uint32 blueTGcount = config->GetMaximum(AHB_BLUE_TG); + uint32 greyTGcount = config->GetMaximum(AHB_GREY_TG); + uint32 whiteTGcount = config->GetMaximum(AHB_WHITE_TG); + uint32 greenTGcount = config->GetMaximum(AHB_GREEN_TG); + uint32 blueTGcount = config->GetMaximum(AHB_BLUE_TG); uint32 purpleTGcount = config->GetMaximum(AHB_PURPLE_TG); uint32 orangeTGcount = config->GetMaximum(AHB_ORANGE_TG); uint32 yellowTGcount = config->GetMaximum(AHB_YELLOW_TG); - uint32 greyIcount = config->GetMaximum(AHB_GREY_I); - uint32 whiteIcount = config->GetMaximum(AHB_WHITE_I); - uint32 greenIcount = config->GetMaximum(AHB_GREEN_I); - uint32 blueIcount = config->GetMaximum(AHB_BLUE_I); - uint32 purpleIcount = config->GetMaximum(AHB_PURPLE_I); - uint32 orangeIcount = config->GetMaximum(AHB_ORANGE_I); - uint32 yellowIcount = config->GetMaximum(AHB_YELLOW_I); - - uint32 greyTGoods = config->GetItemCounts(AHB_GREY_TG); - uint32 whiteTGoods = config->GetItemCounts(AHB_WHITE_TG); - uint32 greenTGoods = config->GetItemCounts(AHB_GREEN_TG); - uint32 blueTGoods = config->GetItemCounts(AHB_BLUE_TG); - uint32 purpleTGoods = config->GetItemCounts(AHB_PURPLE_TG); - uint32 orangeTGoods = config->GetItemCounts(AHB_ORANGE_TG); - uint32 yellowTGoods = config->GetItemCounts(AHB_YELLOW_TG); - - uint32 greyItems = config->GetItemCounts(AHB_GREY_I); - uint32 whiteItems = config->GetItemCounts(AHB_WHITE_I); - uint32 greenItems = config->GetItemCounts(AHB_GREEN_I); - uint32 blueItems = config->GetItemCounts(AHB_BLUE_I); - uint32 purpleItems = config->GetItemCounts(AHB_PURPLE_I); - uint32 orangeItems = config->GetItemCounts(AHB_ORANGE_I); - uint32 yellowItems = config->GetItemCounts(AHB_YELLOW_I); + uint32 greyIcount = config->GetMaximum(AHB_GREY_I); + uint32 whiteIcount = config->GetMaximum(AHB_WHITE_I); + uint32 greenIcount = config->GetMaximum(AHB_GREEN_I); + uint32 blueIcount = config->GetMaximum(AHB_BLUE_I); + uint32 purpleIcount = config->GetMaximum(AHB_PURPLE_I); + uint32 orangeIcount = config->GetMaximum(AHB_ORANGE_I); + uint32 yellowIcount = config->GetMaximum(AHB_YELLOW_I); + + uint32 greyTGoods = config->GetItemCounts(AHB_GREY_TG); + uint32 whiteTGoods = config->GetItemCounts(AHB_WHITE_TG); + uint32 greenTGoods = config->GetItemCounts(AHB_GREEN_TG); + uint32 blueTGoods = config->GetItemCounts(AHB_BLUE_TG); + uint32 purpleTGoods = config->GetItemCounts(AHB_PURPLE_TG); + uint32 orangeTGoods = config->GetItemCounts(AHB_ORANGE_TG); + uint32 yellowTGoods = config->GetItemCounts(AHB_YELLOW_TG); + + uint32 greyItems = config->GetItemCounts(AHB_GREY_I); + uint32 whiteItems = config->GetItemCounts(AHB_WHITE_I); + uint32 greenItems = config->GetItemCounts(AHB_GREEN_I); + uint32 blueItems = config->GetItemCounts(AHB_BLUE_I); + uint32 purpleItems = config->GetItemCounts(AHB_PURPLE_I); + uint32 orangeItems = config->GetItemCounts(AHB_ORANGE_I); + uint32 yellowItems = config->GetItemCounts(AHB_YELLOW_I); // // Loop variables // - uint32 noSold = 0; // Tracing counter - uint32 binEmpty = 0; // Tracing counter - uint32 noNeed = 0; // Tracing counter - uint32 tooMany = 0; // Tracing counter - uint32 loopBrk = 0; // Tracing counter - uint32 err = 0; // Tracing counter + uint32 noSold = 0; // Tracing counter + uint32 binEmpty = 0; // Tracing counter + uint32 noNeed = 0; // Tracing counter + uint32 tooMany = 0; // Tracing counter + uint32 loopBrk = 0; // Tracing counter + uint32 err = 0; // Tracing counter for (uint32 cnt = 1; cnt <= items; cnt++) { - uint32 choice = 0; - uint32 itemID = 0; + uint32 choice = 0; + uint32 itemID = 0; uint32 loopbreaker = 0; // @@ -771,12 +709,12 @@ void AuctionHouseBot::Sell(Player* AHBplayer, AHBConfig* config) if (itemID == 0) { binEmpty++; - + if (config->DebugOutSeller) { LOG_ERROR("module", "AHBot [{}]: No item could be selected from the bins", _id); } - + break; } } @@ -787,11 +725,11 @@ void AuctionHouseBot::Sell(Player* AHBplayer, AHBConfig* config) continue; } - // + // // Retrieve information about the selected item - // + // - ItemTemplate const* prototype = sObjectMgr->GetItemTemplate(itemID); + ItemTemplate const *prototype = sObjectMgr->GetItemTemplate(itemID); if (prototype == NULL) { @@ -805,7 +743,7 @@ void AuctionHouseBot::Sell(Player* AHBplayer, AHBConfig* config) continue; } - Item* item = Item::CreateItem(itemID, 1, AHBplayer); + Item *item = Item::CreateItem(itemID, 1, AHBplayer); if (item == NULL) { @@ -819,9 +757,9 @@ void AuctionHouseBot::Sell(Player* AHBplayer, AHBConfig* config) continue; } - // + // // Start interacting with the item by adding a random property - // + // item->AddToUpdateQueueOf(AHBplayer); @@ -845,13 +783,13 @@ void AuctionHouseBot::Sell(Player* AHBplayer, AHBConfig* config) continue; } - // + // // Determine the price - // + // uint64 buyoutPrice = 0; - uint64 bidPrice = 0; - uint32 stackCount = 1; + uint64 bidPrice = 0; + uint32 stackCount = 1; if (config->SellAtMarketPrice) { @@ -860,7 +798,7 @@ void AuctionHouseBot::Sell(Player* AHBplayer, AHBConfig* config) if (buyoutPrice == 0) { - if (config->SellMethod) + if (config->UseBuyPriceForSeller) { buyoutPrice = prototype->BuyPrice; } @@ -873,12 +811,12 @@ void AuctionHouseBot::Sell(Player* AHBplayer, AHBConfig* config) buyoutPrice = buyoutPrice * urand(config->GetMinPrice(prototype->Quality), config->GetMaxPrice(prototype->Quality)); buyoutPrice = buyoutPrice / 100; - bidPrice = buyoutPrice * urand(config->GetMinBidPrice(prototype->Quality), config->GetMaxBidPrice(prototype->Quality)); - bidPrice = bidPrice / 100; + bidPrice = buyoutPrice * urand(config->GetMinBidPrice(prototype->Quality), config->GetMaxBidPrice(prototype->Quality)); + bidPrice = bidPrice / 100; - // + // // Determine the stack size - // + // if (config->GetMaxStack(prototype->Quality) > 1 && item->GetMaxStackCount() > 1) { @@ -895,36 +833,36 @@ void AuctionHouseBot::Sell(Player* AHBplayer, AHBConfig* config) item->SetCount(stackCount); - // + // // Determine the auction time - // + // uint32 etime = getElapsedTime(config->ElapsingTimeClass); - // + // // Determine the deposit - // + // - uint32 dep = sAuctionMgr->GetAuctionDeposit(ahEntry, etime, item, stackCount); + uint32 dep = sAuctionMgr->GetAuctionDeposit(ahEntry, etime, item, stackCount); - // + // // Perform the auction - // + // auto trans = CharacterDatabase.BeginTransaction(); - AuctionEntry* auctionEntry = new AuctionEntry(); - auctionEntry->Id = sObjectMgr->GenerateAuctionID(); - auctionEntry->houseId = config->GetAHID(); - auctionEntry->item_guid = item->GetGUID(); - auctionEntry->item_template = item->GetEntry(); - auctionEntry->itemCount = item->GetCount(); - auctionEntry->owner = AHBplayer->GetGUID(); - auctionEntry->startbid = bidPrice * stackCount; - auctionEntry->buyout = buyoutPrice * stackCount; - auctionEntry->bid = 0; - auctionEntry->deposit = dep; - auctionEntry->expire_time = (time_t)etime + time(NULL); + AuctionEntry *auctionEntry = new AuctionEntry(); + auctionEntry->Id = sObjectMgr->GenerateAuctionID(); + auctionEntry->houseId = config->GetAHID(); + auctionEntry->item_guid = item->GetGUID(); + auctionEntry->item_template = item->GetEntry(); + auctionEntry->itemCount = item->GetCount(); + auctionEntry->owner = AHBplayer->GetGUID(); + auctionEntry->startbid = bidPrice * stackCount; + auctionEntry->buyout = buyoutPrice * stackCount; + auctionEntry->bid = 0; + auctionEntry->deposit = dep; + auctionEntry->expire_time = (time_t)etime + time(NULL); auctionEntry->auctionHouseEntry = ahEntry; item->SaveToDB(trans); @@ -935,9 +873,9 @@ void AuctionHouseBot::Sell(Player* AHBplayer, AHBConfig* config) CharacterDatabase.CommitTransaction(trans); - // + // // Increments the number of items presents in the auction - // + // switch (choice) { @@ -1080,7 +1018,6 @@ void AuctionHouseBot::Update() _lastrun_h_sec = _newrun; } } - } // @@ -1105,7 +1042,7 @@ void AuctionHouseBot::Update() // Execute commands coming from the console // ============================================================================= -void AuctionHouseBot::Commands(AHBotCommand command, uint32 ahMapID, uint32 col, char* args) +void AuctionHouseBot::Commands(AHBotCommand command, uint32 ahMapID, uint32 col, char *args) { // // Retrieve the auction house configuration @@ -1167,67 +1104,67 @@ void AuctionHouseBot::Commands(AHBotCommand command, uint32 ahMapID, uint32 col, { case AHBotCommand::buyer: { - char* param1 = strtok(args, " "); + char *param1 = strtok(args, " "); uint32 state = (uint32)strtoul(param1, NULL, 0); if (state == 0) { _allianceConfig->AHBBuyer = false; - _hordeConfig->AHBBuyer = false; - _neutralConfig->AHBBuyer = false; + _hordeConfig->AHBBuyer = false; + _neutralConfig->AHBBuyer = false; } else { _allianceConfig->AHBBuyer = true; - _hordeConfig->AHBBuyer = true; - _neutralConfig->AHBBuyer = true; + _hordeConfig->AHBBuyer = true; + _neutralConfig->AHBBuyer = true; } break; } case AHBotCommand::seller: { - char* param1 = strtok(args, " "); + char *param1 = strtok(args, " "); uint32 state = (uint32)strtoul(param1, NULL, 0); if (state == 0) { _allianceConfig->AHBSeller = false; - _hordeConfig->AHBSeller = false; - _neutralConfig->AHBSeller = false; + _hordeConfig->AHBSeller = false; + _neutralConfig->AHBSeller = false; } else { _allianceConfig->AHBSeller = true; - _hordeConfig->AHBSeller = true; - _neutralConfig->AHBSeller = true; + _hordeConfig->AHBSeller = true; + _neutralConfig->AHBSeller = true; } break; } case AHBotCommand::useMarketPrice: { - char* param1 = strtok(args, " "); + char *param1 = strtok(args, " "); uint32 state = (uint32)strtoul(param1, NULL, 0); if (state == 0) { _allianceConfig->SellAtMarketPrice = false; - _hordeConfig->SellAtMarketPrice = false; - _neutralConfig->SellAtMarketPrice = false; + _hordeConfig->SellAtMarketPrice = false; + _neutralConfig->SellAtMarketPrice = false; } else { _allianceConfig->SellAtMarketPrice = true; - _hordeConfig->SellAtMarketPrice = true; - _neutralConfig->SellAtMarketPrice = true; + _hordeConfig->SellAtMarketPrice = true; + _neutralConfig->SellAtMarketPrice = true; } break; } case AHBotCommand::ahexpire: { - AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(config->GetAHFID()); + AuctionHouseObject *auctionHouse = sAuctionMgr->GetAuctionsMap(config->GetAHFID()); AuctionHouseObject::AuctionEntryMap::iterator itr; itr = auctionHouse->GetAuctionsBegin(); @@ -1243,8 +1180,8 @@ void AuctionHouseBot::Commands(AHBotCommand command, uint32 ahMapID, uint32 col, // Expired NOW. itr->second->expire_time = GameTime::GetGameTime().count(); - uint32 id = itr->second->Id; - uint32 expire_time = itr->second->expire_time; + uint32 id = itr->second->Id; + uint32 expire_time = itr->second->expire_time; CharacterDatabase.Execute("UPDATE auctionhouse SET time = '{}' WHERE id = '{}'", expire_time, id); } @@ -1256,8 +1193,8 @@ void AuctionHouseBot::Commands(AHBotCommand command, uint32 ahMapID, uint32 col, } case AHBotCommand::minitems: { - char * param1 = strtok(args, " "); - uint32 minItems = (uint32) strtoul(param1, NULL, 0); + char *param1 = strtok(args, " "); + uint32 minItems = (uint32)strtoul(param1, NULL, 0); WorldDatabase.Execute("UPDATE mod_auctionhousebot SET minitems = '{}' WHERE auctionhouse = '{}'", minItems, ahMapID); @@ -1267,8 +1204,8 @@ void AuctionHouseBot::Commands(AHBotCommand command, uint32 ahMapID, uint32 col, } case AHBotCommand::maxitems: { - char * param1 = strtok(args, " "); - uint32 maxItems = (uint32) strtoul(param1, NULL, 0); + char *param1 = strtok(args, " "); + uint32 maxItems = (uint32)strtoul(param1, NULL, 0); WorldDatabase.Execute("UPDATE mod_auctionhousebot SET maxitems = '{}' WHERE auctionhouse = '{}'", maxItems, ahMapID); @@ -1278,35 +1215,35 @@ void AuctionHouseBot::Commands(AHBotCommand command, uint32 ahMapID, uint32 col, } case AHBotCommand::percentages: { - char * param1 = strtok(args, " "); - char * param2 = strtok(NULL, " "); - char * param3 = strtok(NULL, " "); - char * param4 = strtok(NULL, " "); - char * param5 = strtok(NULL, " "); - char * param6 = strtok(NULL, " "); - char * param7 = strtok(NULL, " "); - char * param8 = strtok(NULL, " "); - char * param9 = strtok(NULL, " "); - char * param10 = strtok(NULL, " "); - char * param11 = strtok(NULL, " "); - char * param12 = strtok(NULL, " "); - char * param13 = strtok(NULL, " "); - char * param14 = strtok(NULL, " "); - - uint32 greytg = (uint32) strtoul(param1, NULL, 0); - uint32 whitetg = (uint32) strtoul(param2, NULL, 0); - uint32 greentg = (uint32) strtoul(param3, NULL, 0); - uint32 bluetg = (uint32) strtoul(param4, NULL, 0); - uint32 purpletg = (uint32) strtoul(param5, NULL, 0); - uint32 orangetg = (uint32) strtoul(param6, NULL, 0); - uint32 yellowtg = (uint32) strtoul(param7, NULL, 0); - uint32 greyi = (uint32) strtoul(param8, NULL, 0); - uint32 whitei = (uint32) strtoul(param9, NULL, 0); - uint32 greeni = (uint32) strtoul(param10, NULL, 0); - uint32 bluei = (uint32) strtoul(param11, NULL, 0); - uint32 purplei = (uint32) strtoul(param12, NULL, 0); - uint32 orangei = (uint32) strtoul(param13, NULL, 0); - uint32 yellowi = (uint32) strtoul(param14, NULL, 0); + char *param1 = strtok(args, " "); + char *param2 = strtok(NULL, " "); + char *param3 = strtok(NULL, " "); + char *param4 = strtok(NULL, " "); + char *param5 = strtok(NULL, " "); + char *param6 = strtok(NULL, " "); + char *param7 = strtok(NULL, " "); + char *param8 = strtok(NULL, " "); + char *param9 = strtok(NULL, " "); + char *param10 = strtok(NULL, " "); + char *param11 = strtok(NULL, " "); + char *param12 = strtok(NULL, " "); + char *param13 = strtok(NULL, " "); + char *param14 = strtok(NULL, " "); + + uint32 greytg = (uint32)strtoul(param1, NULL, 0); + uint32 whitetg = (uint32)strtoul(param2, NULL, 0); + uint32 greentg = (uint32)strtoul(param3, NULL, 0); + uint32 bluetg = (uint32)strtoul(param4, NULL, 0); + uint32 purpletg = (uint32)strtoul(param5, NULL, 0); + uint32 orangetg = (uint32)strtoul(param6, NULL, 0); + uint32 yellowtg = (uint32)strtoul(param7, NULL, 0); + uint32 greyi = (uint32)strtoul(param8, NULL, 0); + uint32 whitei = (uint32)strtoul(param9, NULL, 0); + uint32 greeni = (uint32)strtoul(param10, NULL, 0); + uint32 bluei = (uint32)strtoul(param11, NULL, 0); + uint32 purplei = (uint32)strtoul(param12, NULL, 0); + uint32 orangei = (uint32)strtoul(param13, NULL, 0); + uint32 yellowi = (uint32)strtoul(param14, NULL, 0); // // Setup the percentage in the configuration first, so validity test can be performed @@ -1320,20 +1257,20 @@ void AuctionHouseBot::Commands(AHBotCommand command, uint32 ahMapID, uint32 col, auto trans = WorldDatabase.BeginTransaction(); - trans->Append("UPDATE mod_auctionhousebot SET percentgreytradegoods = '{}' WHERE auctionhouse = '{}'", config->GetPercentages(AHB_GREY_TG) , ahMapID); - trans->Append("UPDATE mod_auctionhousebot SET percentwhitetradegoods = '{}' WHERE auctionhouse = '{}'", config->GetPercentages(AHB_WHITE_TG) , ahMapID); - trans->Append("UPDATE mod_auctionhousebot SET percentgreentradegoods = '{}' WHERE auctionhouse = '{}'", config->GetPercentages(AHB_GREEN_TG) , ahMapID); - trans->Append("UPDATE mod_auctionhousebot SET percentbluetradegoods = '{}' WHERE auctionhouse = '{}'", config->GetPercentages(AHB_BLUE_TG) , ahMapID); + trans->Append("UPDATE mod_auctionhousebot SET percentgreytradegoods = '{}' WHERE auctionhouse = '{}'", config->GetPercentages(AHB_GREY_TG), ahMapID); + trans->Append("UPDATE mod_auctionhousebot SET percentwhitetradegoods = '{}' WHERE auctionhouse = '{}'", config->GetPercentages(AHB_WHITE_TG), ahMapID); + trans->Append("UPDATE mod_auctionhousebot SET percentgreentradegoods = '{}' WHERE auctionhouse = '{}'", config->GetPercentages(AHB_GREEN_TG), ahMapID); + trans->Append("UPDATE mod_auctionhousebot SET percentbluetradegoods = '{}' WHERE auctionhouse = '{}'", config->GetPercentages(AHB_BLUE_TG), ahMapID); trans->Append("UPDATE mod_auctionhousebot SET percentpurpletradegoods = '{}' WHERE auctionhouse = '{}'", config->GetPercentages(AHB_PURPLE_TG), ahMapID); trans->Append("UPDATE mod_auctionhousebot SET percentorangetradegoods = '{}' WHERE auctionhouse = '{}'", config->GetPercentages(AHB_ORANGE_TG), ahMapID); trans->Append("UPDATE mod_auctionhousebot SET percentyellowtradegoods = '{}' WHERE auctionhouse = '{}'", config->GetPercentages(AHB_YELLOW_TG), ahMapID); - trans->Append("UPDATE mod_auctionhousebot SET percentgreyitems = '{}' WHERE auctionhouse = '{}'", config->GetPercentages(AHB_GREY_I) , ahMapID); - trans->Append("UPDATE mod_auctionhousebot SET percentwhiteitems = '{}' WHERE auctionhouse = '{}'", config->GetPercentages(AHB_WHITE_I) , ahMapID); - trans->Append("UPDATE mod_auctionhousebot SET percentgreenitems = '{}' WHERE auctionhouse = '{}'", config->GetPercentages(AHB_GREEN_I) , ahMapID); - trans->Append("UPDATE mod_auctionhousebot SET percentblueitems = '{}' WHERE auctionhouse = '{}'", config->GetPercentages(AHB_BLUE_I) , ahMapID); - trans->Append("UPDATE mod_auctionhousebot SET percentpurpleitems = '{}' WHERE auctionhouse = '{}'", config->GetPercentages(AHB_PURPLE_I) , ahMapID); - trans->Append("UPDATE mod_auctionhousebot SET percentorangeitems = '{}' WHERE auctionhouse = '{}'", config->GetPercentages(AHB_ORANGE_I) , ahMapID); - trans->Append("UPDATE mod_auctionhousebot SET percentyellowitems = '{}' WHERE auctionhouse = '{}'", config->GetPercentages(AHB_YELLOW_I) , ahMapID); + trans->Append("UPDATE mod_auctionhousebot SET percentgreyitems = '{}' WHERE auctionhouse = '{}'", config->GetPercentages(AHB_GREY_I), ahMapID); + trans->Append("UPDATE mod_auctionhousebot SET percentwhiteitems = '{}' WHERE auctionhouse = '{}'", config->GetPercentages(AHB_WHITE_I), ahMapID); + trans->Append("UPDATE mod_auctionhousebot SET percentgreenitems = '{}' WHERE auctionhouse = '{}'", config->GetPercentages(AHB_GREEN_I), ahMapID); + trans->Append("UPDATE mod_auctionhousebot SET percentblueitems = '{}' WHERE auctionhouse = '{}'", config->GetPercentages(AHB_BLUE_I), ahMapID); + trans->Append("UPDATE mod_auctionhousebot SET percentpurpleitems = '{}' WHERE auctionhouse = '{}'", config->GetPercentages(AHB_PURPLE_I), ahMapID); + trans->Append("UPDATE mod_auctionhousebot SET percentorangeitems = '{}' WHERE auctionhouse = '{}'", config->GetPercentages(AHB_ORANGE_I), ahMapID); + trans->Append("UPDATE mod_auctionhousebot SET percentyellowitems = '{}' WHERE auctionhouse = '{}'", config->GetPercentages(AHB_YELLOW_I), ahMapID); WorldDatabase.CommitTransaction(trans); @@ -1341,8 +1278,8 @@ void AuctionHouseBot::Commands(AHBotCommand command, uint32 ahMapID, uint32 col, } case AHBotCommand::minprice: { - char * param1 = strtok(args, " "); - uint32 minPrice = (uint32) strtoul(param1, NULL, 0); + char *param1 = strtok(args, " "); + uint32 minPrice = (uint32)strtoul(param1, NULL, 0); WorldDatabase.Execute("UPDATE mod_auctionhousebot SET minprice{} = '{}' WHERE auctionhouse = '{}'", color, minPrice, ahMapID); @@ -1352,8 +1289,8 @@ void AuctionHouseBot::Commands(AHBotCommand command, uint32 ahMapID, uint32 col, } case AHBotCommand::maxprice: { - char * param1 = strtok(args, " "); - uint32 maxPrice = (uint32) strtoul(param1, NULL, 0); + char *param1 = strtok(args, " "); + uint32 maxPrice = (uint32)strtoul(param1, NULL, 0); WorldDatabase.Execute("UPDATE mod_auctionhousebot SET maxprice{} = '{}' WHERE auctionhouse = '{}'", color, maxPrice, ahMapID); @@ -1363,8 +1300,8 @@ void AuctionHouseBot::Commands(AHBotCommand command, uint32 ahMapID, uint32 col, } case AHBotCommand::minbidprice: { - char * param1 = strtok(args, " "); - uint32 minBidPrice = (uint32) strtoul(param1, NULL, 0); + char *param1 = strtok(args, " "); + uint32 minBidPrice = (uint32)strtoul(param1, NULL, 0); WorldDatabase.Execute("UPDATE mod_auctionhousebot SET minbidprice{} = '{}' WHERE auctionhouse = '{}'", color, minBidPrice, ahMapID); @@ -1374,8 +1311,8 @@ void AuctionHouseBot::Commands(AHBotCommand command, uint32 ahMapID, uint32 col, } case AHBotCommand::maxbidprice: { - char * param1 = strtok(args, " "); - uint32 maxBidPrice = (uint32) strtoul(param1, NULL, 0); + char *param1 = strtok(args, " "); + uint32 maxBidPrice = (uint32)strtoul(param1, NULL, 0); WorldDatabase.Execute("UPDATE mod_auctionhousebot SET maxbidprice{} = '{}' WHERE auctionhouse = '{}'", color, maxBidPrice, ahMapID); @@ -1385,8 +1322,8 @@ void AuctionHouseBot::Commands(AHBotCommand command, uint32 ahMapID, uint32 col, } case AHBotCommand::maxstack: { - char * param1 = strtok(args, " "); - uint32 maxStack = (uint32) strtoul(param1, NULL, 0); + char *param1 = strtok(args, " "); + uint32 maxStack = (uint32)strtoul(param1, NULL, 0); WorldDatabase.Execute("UPDATE mod_auctionhousebot SET maxstack{} = '{}' WHERE auctionhouse = '{}'", color, maxStack, ahMapID); @@ -1396,8 +1333,8 @@ void AuctionHouseBot::Commands(AHBotCommand command, uint32 ahMapID, uint32 col, } case AHBotCommand::buyerprice: { - char * param1 = strtok(args, " "); - uint32 buyerPrice = (uint32) strtoul(param1, NULL, 0); + char *param1 = strtok(args, " "); + uint32 buyerPrice = (uint32)strtoul(param1, NULL, 0); WorldDatabase.Execute("UPDATE mod_auctionhousebot SET buyerprice{} = '{}' WHERE auctionhouse = '{}'", color, buyerPrice, ahMapID); @@ -1407,8 +1344,8 @@ void AuctionHouseBot::Commands(AHBotCommand command, uint32 ahMapID, uint32 col, } case AHBotCommand::bidinterval: { - char * param1 = strtok(args, " "); - uint32 bidInterval = (uint32) strtoul(param1, NULL, 0); + char *param1 = strtok(args, " "); + uint32 bidInterval = (uint32)strtoul(param1, NULL, 0); WorldDatabase.Execute("UPDATE mod_auctionhousebot SET buyerbiddinginterval = '{}' WHERE auctionhouse = '{}'", bidInterval, ahMapID); @@ -1418,8 +1355,8 @@ void AuctionHouseBot::Commands(AHBotCommand command, uint32 ahMapID, uint32 col, } case AHBotCommand::bidsperinterval: { - char * param1 = strtok(args, " "); - uint32 bidsPerInterval = (uint32) strtoul(param1, NULL, 0); + char *param1 = strtok(args, " "); + uint32 bidsPerInterval = (uint32)strtoul(param1, NULL, 0); WorldDatabase.Execute("UPDATE mod_auctionhousebot SET buyerbidsperinterval = '{}' WHERE auctionhouse = '{}'", bidsPerInterval, ahMapID); @@ -1436,15 +1373,15 @@ void AuctionHouseBot::Commands(AHBotCommand command, uint32 ahMapID, uint32 col, // Initialization of the bot // ============================================================================= -void AuctionHouseBot::Initialize(AHBConfig* allianceConfig, AHBConfig* hordeConfig, AHBConfig* neutralConfig) +void AuctionHouseBot::Initialize(AHBConfig *allianceConfig, AHBConfig *hordeConfig, AHBConfig *neutralConfig) { - // + // // Save the pointer for the configurations - // + // _allianceConfig = allianceConfig; - _hordeConfig = hordeConfig; - _neutralConfig = neutralConfig; + _hordeConfig = hordeConfig; + _neutralConfig = neutralConfig; // // Done diff --git a/src/AuctionHouseBotConfig.cpp b/src/AuctionHouseBotConfig.cpp index 0cb742a..58c7bd2 100644 --- a/src/AuctionHouseBotConfig.cpp +++ b/src/AuctionHouseBotConfig.cpp @@ -200,8 +200,8 @@ AHBConfig::AHBConfig(uint32 ahid, AHBConfig* conf) TraceBuyer = conf->TraceBuyer; AHBSeller = conf->AHBSeller; AHBBuyer = conf->AHBBuyer; - BuyMethod = conf->BuyMethod; - SellMethod = conf->SellMethod; + UseBuyPriceForBuyer = conf->UseBuyPriceForBuyer; + UseBuyPriceForSeller = conf->UseBuyPriceForSeller; ConsiderOnlyBotAuctions = conf->ConsiderOnlyBotAuctions; ItemsPerCycle = conf->ItemsPerCycle; Vendor_Items = conf->Vendor_Items; @@ -506,8 +506,8 @@ void AHBConfig::Reset() AHBSeller = false; AHBBuyer = false; - BuyMethod = false; - SellMethod = false; + UseBuyPriceForBuyer = false; + UseBuyPriceForSeller = false; SellAtMarketPrice = false; ConsiderOnlyBotAuctions = false; ItemsPerCycle = 200; @@ -2036,8 +2036,8 @@ void AHBConfig::InitializeFromFile() AHBSeller = sConfigMgr->GetOption ("AuctionHouseBot.EnableSeller" , false); AHBBuyer = sConfigMgr->GetOption ("AuctionHouseBot.EnableBuyer" , false); - SellMethod = sConfigMgr->GetOption ("AuctionHouseBot.UseBuyPriceForSeller" , false); - BuyMethod = sConfigMgr->GetOption ("AuctionHouseBot.UseBuyPriceForBuyer" , false); + UseBuyPriceForSeller = sConfigMgr->GetOption ("AuctionHouseBot.UseBuyPriceForSeller" , false); + UseBuyPriceForBuyer = sConfigMgr->GetOption ("AuctionHouseBot.UseBuyPriceForBuyer" , false); SellAtMarketPrice = sConfigMgr->GetOption ("AuctionHouseBot.UseMarketPriceForSeller", false); MarketResetThreshold = sConfigMgr->GetOption("AuctionHouseBot.MarketResetThreshold" , 25); DuplicatesCount = sConfigMgr->GetOption("AuctionHouseBot.DuplicatesCount" , 0); @@ -2593,7 +2593,7 @@ void AHBConfig::InitializeBins() // Exclude items with no possible price // - if (SellMethod) + if (UseBuyPriceForSeller) { if (itr->second.BuyPrice == 0) { diff --git a/src/AuctionHouseBotConfig.h b/src/AuctionHouseBotConfig.h index f649037..db0d93e 100644 --- a/src/AuctionHouseBotConfig.h +++ b/src/AuctionHouseBotConfig.h @@ -180,8 +180,8 @@ class AHBConfig bool AHBSeller; bool AHBBuyer; - bool BuyMethod; - bool SellMethod; + bool UseBuyPriceForBuyer; + bool UseBuyPriceForSeller; bool SellAtMarketPrice; uint32 MarketResetThreshold; bool ConsiderOnlyBotAuctions;