aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/AuctionHouseBot.cpp1384
-rw-r--r--src/game/AuctionHouseBot.h1004
-rw-r--r--src/game/AuctionHouseHandler.cpp2
-rw-r--r--src/game/Level3.cpp100
-rw-r--r--src/game/Mail.cpp4
-rw-r--r--src/game/World.cpp4
6 files changed, 1354 insertions, 1144 deletions
diff --git a/src/game/AuctionHouseBot.cpp b/src/game/AuctionHouseBot.cpp
index 2d468a280b8..02fa297758d 100644
--- a/src/game/AuctionHouseBot.cpp
+++ b/src/game/AuctionHouseBot.cpp
@@ -1,73 +1,37 @@
-#include <vector>
-#include <iostream>
-#include "time.h"
-
-#include "ObjectMgr.h"
-#include "World.h"
-#include "WorldSession.h"
-#include "Config/ConfigEnv.h"
-#include "Database/DatabaseEnv.h"
-
#include "AuctionHouseBot.h"
+#include "ObjectMgr.h"
#include "AuctionHouseMgr.h"
-#include "Bag.h"
-#include "Item.h"
-#include "Log.h"
-#include "Player.h"
+
+#include "Policies/SingletonImp.h"
+INSTANTIATE_SINGLETON_1(AuctionHouseBot);
using namespace std;
-static bool debug_Out = sConfig.GetBoolDefault("AuctionHouseBot.DEBUG", false);
-
-static vector<uint32> npcItems;
-static vector<uint32> lootItems;
-static vector<uint32> greyTradeGoodsBin;
-static vector<uint32> whiteTradeGoodsBin;
-static vector<uint32> greenTradeGoodsBin;
-static vector<uint32> blueTradeGoodsBin;
-static vector<uint32> purpleTradeGoodsBin;
-static vector<uint32> orangeTradeGoodsBin;
-static vector<uint32> yellowTradeGoodsBin;
-static vector<uint32> greyItemsBin;
-static vector<uint32> whiteItemsBin;
-static vector<uint32> greenItemsBin;
-static vector<uint32> blueItemsBin;
-static vector<uint32> purpleItemsBin;
-static vector<uint32> orangeItemsBin;
-static vector<uint32> yellowItemsBin;
-
-static bool AHBSeller = 0;
-static bool AHBBuyer = 0;
-
-static bool Vendor_Items = 0;
-static bool Loot_Items = 0;
-static bool Other_Items = 0;
-
-static bool No_Bind = 0;
-static bool Bind_When_Picked_Up = 0;
-static bool Bind_When_Equipped = 0;
-static bool Bind_When_Use = 0;
-static bool Bind_Quest_Item = 0;
-
-static AHBConfig AllianceConfig = AHBConfig(2);
-static AHBConfig HordeConfig = AHBConfig(6);
-static AHBConfig NeutralConfig = AHBConfig(7);
-time_t _lastrun_a;
-time_t _lastrun_h;
-time_t _lastrun_n;
-
-///////////////////////////////////////////////////////////////////////////////
-//
-///////////////////////////////////////////////////////////////////////////////
-static inline uint32 minValue(uint32 a, uint32 b)
+AuctionHouseBot::AuctionHouseBot()
+{
+ AHBSeller = 0;
+ AHBBuyer = 0;
+
+ Vendor_Items = 0;
+ Loot_Items = 0;
+ Other_Items = 0;
+
+ No_Bind = 0;
+ Bind_When_Picked_Up = 0;
+ Bind_When_Equipped = 0;
+ Bind_When_Use = 0;
+ Bind_Quest_Item = 0;
+
+ AllianceConfig = AHBConfig(2);
+ HordeConfig = AHBConfig(6);
+ NeutralConfig = AHBConfig(7);
+}
+
+AuctionHouseBot::~AuctionHouseBot()
{
- return a <= b ? a : b;
}
-///////////////////////////////////////////////////////////////////////////////
-//
-///////////////////////////////////////////////////////////////////////////////
-static void addNewAuctions(Player *AHBplayer, AHBConfig *config)
+void AuctionHouseBot::addNewAuctions(Player *AHBplayer, AHBConfig *config)
{
if (!AHBSeller)
return;
@@ -78,19 +42,26 @@ static void addNewAuctions(Player *AHBplayer, AHBConfig *config)
uint32 maxItems = config->GetMaxItems();
uint32 auctions = auctionHouse->Getcount();
uint32 AuctioneerGUID = 0;
- switch (config->GetAHID()){
- case 2:
- AuctioneerGUID = 79707; //Human in stormwind.
- case 6:
- AuctioneerGUID = 4656; //orc in Orgrimmar
- case 7:
- AuctioneerGUID = 23442; //goblin in GZ
- default:
- AuctioneerGUID = 23442; //default to neutral 7
+ switch (config->GetAHID())
+ {
+ case 2:
+ AuctioneerGUID = 79707; //Human in stormwind.
+ break;
+ case 6:
+ AuctioneerGUID = 4656; //orc in Orgrimmar
+ break;
+ case 7:
+ AuctioneerGUID = 23442; //goblin in GZ
+ break;
+ default:
+ if (debug_Out) sLog.outError("GetAHID() - Default switch reached");
+ AuctioneerGUID = 23442; //default to neutral 7
+ break;
}
if (auctions >= minItems)
- return;
+ return;
+
if (auctions <= maxItems)
{
if ((maxItems - auctions) > ItemsPerCycle)
@@ -113,9 +84,9 @@ static void addNewAuctions(Player *AHBplayer, AHBConfig *config)
uint32 orangeIcount = config->GetPercents(AHB_ORANGE_I);
uint32 yellowIcount = config->GetPercents(AHB_YELLOW_I);
uint32 total = greyTGcount + whiteTGcount + greenTGcount + blueTGcount
- + purpleTGcount + orangeTGcount + yellowTGcount
- + whiteIcount + greenIcount + blueIcount + purpleIcount
- + orangeIcount + yellowIcount;
+ + purpleTGcount + orangeTGcount + yellowTGcount
+ + whiteIcount + greenIcount + blueIcount + purpleIcount
+ + orangeIcount + yellowIcount;
uint32 greyTGoods = 0;
uint32 whiteTGoods = 0;
@@ -133,74 +104,71 @@ static void addNewAuctions(Player *AHBplayer, AHBConfig *config)
uint32 orangeItems = 0;
uint32 yellowItems = 0;
- for (AuctionHouseObject::AuctionEntryMap::iterator itr = auctionHouse->GetAuctionsBegin();itr != auctionHouse->GetAuctionsEnd();++itr)
+ for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = auctionHouse->GetAuctionsBegin();itr != auctionHouse->GetAuctionsEnd();++itr)
{
AuctionEntry *Aentry = itr->second;
Item *item = auctionmgr.GetAItem(Aentry->item_guidlow);
- if( item )
+ if (item)
{
ItemPrototype const *prototype = item->GetProto();
- if( prototype )
+ if (prototype)
{
switch (prototype->Quality)
{
- case 0:
+ case 0:
if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
- ++greyTGoods;
+ ++greyTGoods;
else
- ++greyItems;
+ ++greyItems;
break;
-
- case 1:
+ case 1:
if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
- ++whiteTGoods;
+ ++whiteTGoods;
else
- ++whiteItems;
+ ++whiteItems;
break;
-
- case 2:
+ case 2:
if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
- ++greenTGoods;
+ ++greenTGoods;
else
- ++greenItems;
+ ++greenItems;
break;
-
- case 3:
+ case 3:
if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
- ++blueTGoods;
+ ++blueTGoods;
else
- ++blueItems;
+ ++blueItems;
break;
-
- case 4:
+ case 4:
if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
- ++purpleTGoods;
+ ++purpleTGoods;
else
- ++purpleItems;
+ ++purpleItems;
break;
-
- case 5:
+ case 5:
if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
- ++orangeTGoods;
+ ++orangeTGoods;
else
- ++orangeItems;
+ ++orangeItems;
break;
-
- case 6:
+ case 6:
if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
- ++yellowTGoods;
+ ++yellowTGoods;
else
- ++yellowItems;
+ ++yellowItems;
break;
}
}
}
}
+
// only insert a few at a time, so as not to peg the processor
for (uint32 cnt = 1;cnt <= items;cnt++)
{
uint32 itemID = 0;
- while (itemID == 0)
+ uint32 loopBreaker = 0;
+ uint32 itemColor = 99;
+ while (itemID == 0 && loopBreaker < 50)
{
uint32 choice = urand(0, 13);
switch (choice)
@@ -208,269 +176,224 @@ static void addNewAuctions(Player *AHBplayer, AHBConfig *config)
case 0:
{
if ((greyItemsBin.size() > 0) && (greyItems < greyIcount))
- {
- itemID = greyItemsBin[urand(0, greyItemsBin.size() - 1)];
- ++greyItems;
- break;
- }
+ itemID = greyItemsBin[urand(0, greyItemsBin.size() - 1)];
+ else continue;
+ break;
}
case 1:
{
if ((whiteItemsBin.size() > 0) && (whiteItems < whiteIcount))
- {
- itemID = whiteItemsBin[urand(0, whiteItemsBin.size() - 1)];
- ++whiteItems;
- break;
- }
+ itemID = whiteItemsBin[urand(0, whiteItemsBin.size() - 1)];
+ else continue;
+ break;
}
case 2:
{
if ((greenItemsBin.size() > 0) && (greenItems < greenIcount))
- {
- itemID = greenItemsBin[urand(0, greenItemsBin.size() - 1)];
- ++greenItems;
- break;
- }
+ itemID = greenItemsBin[urand(0, greenItemsBin.size() - 1)];
+ else continue;
+ break;
}
case 3:
{
if ((blueItemsBin.size() > 0) && (blueItems < blueIcount))
- {
- itemID = blueItemsBin[urand(0, blueItemsBin.size() - 1)];
- ++blueItems;
- break;
- }
+ itemID = blueItemsBin[urand(0, blueItemsBin.size() - 1)];
+ else continue;
+ break;
}
case 4:
{
if ((purpleItemsBin.size() > 0) && (purpleItems < purpleIcount))
- {
itemID = purpleItemsBin[urand(0, purpleItemsBin.size() - 1)];
- ++purpleItems;
- break;
- }
+ else continue;
+ break;
}
case 5:
{
if ((orangeItemsBin.size() > 0) && (orangeItems < orangeIcount))
- {
itemID = orangeItemsBin[urand(0, orangeItemsBin.size() - 1)];
- ++orangeItems;
- break;
- }
+ else continue;
+ break;
}
case 6:
{
if ((yellowItemsBin.size() > 0) && (yellowItems < yellowIcount))
- {
itemID = yellowItemsBin[urand(0, yellowItemsBin.size() - 1)];
- ++yellowItems;
- break;
- }
+ else continue;
+ break;
}
case 7:
{
if ((greyTradeGoodsBin.size() > 0) && (greyTGoods < greyTGcount))
- {
- itemID = whiteTradeGoodsBin[urand(0, whiteTradeGoodsBin.size() - 1)];
- ++greyTGoods;
- break;
- }
+ itemID = greyTradeGoodsBin[urand(0, greyTradeGoodsBin.size() - 1)];
+ else continue;
+ break;
}
case 8:
{
if ((whiteTradeGoodsBin.size() > 0) && (whiteTGoods < whiteTGcount))
- {
- itemID = whiteTradeGoodsBin[urand(0, whiteTradeGoodsBin.size() - 1)];
- ++whiteTGoods;
- break;
- }
+ itemID = whiteTradeGoodsBin[urand(0, whiteTradeGoodsBin.size() - 1)];
+ else continue;
+ break;
}
case 9:
{
if ((greenTradeGoodsBin.size() > 0) && (greenTGoods < greenTGcount))
- {
- itemID = greenTradeGoodsBin[urand(0, greenTradeGoodsBin.size() - 1)];
- ++greenTGoods;
- break;
- }
+ itemID = greenTradeGoodsBin[urand(0, greenTradeGoodsBin.size() - 1)];
+ else continue;
+ break;
}
case 10:
{
if ((blueTradeGoodsBin.size() > 0) && (blueTGoods < blueTGcount))
- {
- itemID = blueTradeGoodsBin[urand(0, blueTradeGoodsBin.size() - 1)];
- ++blueTGoods;
- break;
- }
+ itemID = blueTradeGoodsBin[urand(0, blueTradeGoodsBin.size() - 1)];
+ else continue;
+ break;
}
case 11:
{
if ((purpleTradeGoodsBin.size() > 0) && (purpleTGoods < purpleTGcount))
- {
- itemID = purpleTradeGoodsBin[urand(0, purpleTradeGoodsBin.size() - 1)];
- ++purpleTGoods;
- break;
- }
+ itemID = purpleTradeGoodsBin[urand(0, purpleTradeGoodsBin.size() - 1)];
+ else continue;
+ break;
}
case 12:
{
if ((orangeTradeGoodsBin.size() > 0) && (orangeTGoods < orangeTGcount))
- {
- itemID = orangeTradeGoodsBin[urand(0, orangeTradeGoodsBin.size() - 1)];
- ++orangeTGoods;
- break;
- }
+ itemID = orangeTradeGoodsBin[urand(0, orangeTradeGoodsBin.size() - 1)];
+ else continue;
+ break;
}
case 13:
{
if ((yellowTradeGoodsBin.size() > 0) && (yellowTGoods < yellowTGcount))
- {
- itemID = yellowTradeGoodsBin[urand(0, yellowTradeGoodsBin.size() - 1)];
- ++yellowTGoods;
- break;
- }
+ itemID = yellowTradeGoodsBin[urand(0, yellowTradeGoodsBin.size() - 1)];
+ else continue;
+ break;
}
default:
{
+ if (debug_Out) sLog.outError("AuctionHouseBot: itemID Switch - Default Reached");
break;
}
+ ++loopBreaker;
}
- }
-
- ItemPrototype const* prototype = objmgr.GetItemPrototype(itemID);
- if (prototype == NULL)
- {
- sLog.outString("AuctionHouseBot: Huh?!?! prototype == NULL");
- continue;
- }
-
- Item* item = Item::CreateItem(itemID, 1, AHBplayer);
- item->AddToUpdateQueueOf(AHBplayer);
- if (item == NULL)
- {
- sLog.outString("AuctionHouseBot: Item::CreateItem() returned NULL");
- break;
- }
-
- uint32 randomPropertyId = Item::GenerateItemRandomPropertyId(itemID);
- if (randomPropertyId != 0)
- item->SetItemRandomProperties(randomPropertyId);
-
- uint64 buyoutPrice;
- uint64 bidPrice = 0;
- uint32 stackCount = urand(1, item->GetMaxStackCount());
-
- switch (SellMethod)
- {
- case 0:
- buyoutPrice = prototype->SellPrice * item->GetCount();
- break;
- case 1:
- buyoutPrice = prototype->BuyPrice * item->GetCount();
- break;
- default:
- buyoutPrice = 0;
- break;
- }
-
- switch (prototype->Quality)
- {
- case 0:
- if (config->GetMaxStack(AHB_GREY) != 0)
+ if (itemID == 0)
{
- stackCount = urand(1, minValue(item->GetMaxStackCount(), config->GetMaxStack(AHB_GREY)));
+ if (debug_Out) sLog.outError("AuctionHouseBot: Item::CreateItem() - ItemID is 0");
+ continue;
}
- buyoutPrice *= urand(config->GetMinPrice(AHB_GREY), config->GetMaxPrice(AHB_GREY)) * stackCount;
- buyoutPrice /= 100;
- bidPrice = buyoutPrice * urand(config->GetMinBidPrice(AHB_GREY), config->GetMaxBidPrice(AHB_GREY));
- bidPrice /= 100;
- break;
- case 1:
- if (config->GetMaxStack(AHB_WHITE) != 0)
+ ItemPrototype const* prototype = objmgr.GetItemPrototype(itemID);
+ if (prototype == NULL)
{
- stackCount = urand(1, minValue(item->GetMaxStackCount(), config->GetMaxStack(AHB_WHITE)));
+ if (debug_Out) sLog.outError("AuctionHouseBot: Huh?!?! prototype == NULL");
+ continue;
}
- buyoutPrice *= urand(config->GetMinPrice(AHB_WHITE), config->GetMaxPrice(AHB_WHITE)) * stackCount;
- buyoutPrice /= 100;
- bidPrice = buyoutPrice * urand(config->GetMinBidPrice(AHB_WHITE), config->GetMaxBidPrice(AHB_WHITE));
- bidPrice /= 100;
- break;
- case 2:
- if (config->GetMaxStack(AHB_GREEN) != 0)
+ Item* item = Item::CreateItem(itemID, 1, AHBplayer);
+ item->AddToUpdateQueueOf(AHBplayer);
+ if (item == NULL)
{
- stackCount = urand(1, minValue(item->GetMaxStackCount(), config->GetMaxStack(AHB_GREEN)));
+ if (debug_Out) sLog.outError("AuctionHouseBot: Item::CreateItem() returned NULL");
+ break;
}
- buyoutPrice *= urand(config->GetMinPrice(AHB_GREEN), config->GetMaxPrice(AHB_GREEN)) * stackCount;
- buyoutPrice /= 100;
- bidPrice = buyoutPrice * urand(config->GetMinBidPrice(AHB_GREEN), config->GetMaxBidPrice(AHB_GREEN));
- bidPrice /= 100;
- break;
- case 3:
- if (config->GetMaxStack(AHB_BLUE) != 0)
- {
- stackCount = urand(1, minValue(item->GetMaxStackCount(), config->GetMaxStack(AHB_BLUE)));
- }
- buyoutPrice *= urand(config->GetMinPrice(AHB_BLUE), config->GetMaxPrice(AHB_BLUE)) * stackCount;
- buyoutPrice /= 100;
- bidPrice = buyoutPrice * urand(config->GetMinBidPrice(AHB_BLUE), config->GetMaxBidPrice(AHB_BLUE));
- bidPrice /= 100;
- break;
+ uint32 randomPropertyId = Item::GenerateItemRandomPropertyId(itemID);
+ if (randomPropertyId != 0)
+ item->SetItemRandomProperties(randomPropertyId);
- case 4:
- if (config->GetMaxStack(AHB_PURPLE) != 0)
- {
- stackCount = urand(1, minValue(item->GetMaxStackCount(), config->GetMaxStack(AHB_PURPLE)));
- }
- buyoutPrice *= urand(config->GetMinPrice(AHB_PURPLE), config->GetMaxPrice(AHB_PURPLE)) * stackCount;
- buyoutPrice /= 100;
- bidPrice = buyoutPrice * urand(config->GetMinBidPrice(AHB_PURPLE), config->GetMaxBidPrice(AHB_PURPLE));
- bidPrice /= 100;
- break;
- case 5:
- if (config->GetMaxStack(AHB_ORANGE) != 0)
+ uint64 buyoutPrice = 0;
+ uint64 bidPrice = 0;
+ uint32 stackCount = 1;
+
+ switch (SellMethod)
{
- stackCount = urand(1, minValue(item->GetMaxStackCount(), config->GetMaxStack(AHB_ORANGE)));
+ case 0:
+ buyoutPrice = prototype->SellPrice;
+ break;
+ case 1:
+ buyoutPrice = prototype->BuyPrice;
+ break;
}
- buyoutPrice *= urand(config->GetMinPrice(AHB_ORANGE), config->GetMaxPrice(AHB_ORANGE)) * stackCount;
- buyoutPrice /= 100;
- bidPrice = buyoutPrice * urand(config->GetMinBidPrice(AHB_ORANGE), config->GetMaxBidPrice(AHB_ORANGE));
- bidPrice /= 100;
- break;
- case 6:
- if (config->GetMaxStack(AHB_YELLOW) != 0)
+
+ switch (prototype->Quality)
{
- stackCount = urand(1, minValue(item->GetMaxStackCount(), config->GetMaxStack(AHB_YELLOW)));
+ case AHB_GREY:
+ if (config->GetMaxStack(AHB_GREY) > 1 && item->GetMaxStackCount() > 1)
+ stackCount = urand(1, minValue(item->GetMaxStackCount(), config->GetMaxStack(AHB_GREY)));
+ else
+ stackCount = 1;
+ buyoutPrice *= urand(config->GetMinPrice(AHB_GREY), config->GetMaxPrice(AHB_GREY));
+ buyoutPrice /= 100;
+ bidPrice = buyoutPrice * urand(config->GetMinBidPrice(AHB_GREY), config->GetMaxBidPrice(AHB_GREY));
+ bidPrice /= 100;
+ break;
+ case AHB_WHITE:
+ if (config->GetMaxStack(AHB_WHITE) > 1 && item->GetMaxStackCount() > 1)
+ stackCount = urand(1, minValue(item->GetMaxStackCount(), config->GetMaxStack(AHB_WHITE)));
+ else
+ stackCount = 1;
+ buyoutPrice *= urand(config->GetMinPrice(AHB_WHITE), config->GetMaxPrice(AHB_WHITE));
+ buyoutPrice /= 100;
+ bidPrice = buyoutPrice * urand(config->GetMinBidPrice(AHB_WHITE), config->GetMaxBidPrice(AHB_WHITE));
+ bidPrice /= 100;
+ break;
+ case AHB_GREEN:
+ if (config->GetMaxStack(AHB_GREEN) > 1 && item->GetMaxStackCount() > 1)
+ stackCount = urand(1, minValue(item->GetMaxStackCount(), config->GetMaxStack(AHB_GREEN)));
+ else
+ stackCount = 1;
+ buyoutPrice *= urand(config->GetMinPrice(AHB_GREEN), config->GetMaxPrice(AHB_GREEN));
+ buyoutPrice /= 100;
+ bidPrice = buyoutPrice * urand(config->GetMinBidPrice(AHB_GREEN), config->GetMaxBidPrice(AHB_GREEN));
+ bidPrice /= 100;
+ break;
+ case AHB_BLUE:
+ if (config->GetMaxStack(AHB_BLUE) > 1 && item->GetMaxStackCount() > 1)
+ stackCount = urand(1, minValue(item->GetMaxStackCount(), config->GetMaxStack(AHB_BLUE)));
+ else
+ stackCount = 1;
+ buyoutPrice *= urand(config->GetMinPrice(AHB_BLUE), config->GetMaxPrice(AHB_BLUE));
+ buyoutPrice /= 100;
+ bidPrice = buyoutPrice * urand(config->GetMinBidPrice(AHB_BLUE), config->GetMaxBidPrice(AHB_BLUE));
+ bidPrice /= 100;
+ break;
+ case AHB_PURPLE:
+ if (config->GetMaxStack(AHB_PURPLE) > 1 && item->GetMaxStackCount() > 1)
+ stackCount = urand(1, minValue(item->GetMaxStackCount(), config->GetMaxStack(AHB_PURPLE)));
+ else
+ stackCount = 1;
+ buyoutPrice *= urand(config->GetMinPrice(AHB_PURPLE), config->GetMaxPrice(AHB_PURPLE));
+ buyoutPrice /= 100;
+ bidPrice = buyoutPrice * urand(config->GetMinBidPrice(AHB_PURPLE), config->GetMaxBidPrice(AHB_PURPLE));
+ bidPrice /= 100;
+ break;
+ case AHB_ORANGE:
+ if (config->GetMaxStack(AHB_ORANGE) > 1 && item->GetMaxStackCount() > 1)
+ stackCount = urand(1, minValue(item->GetMaxStackCount(), config->GetMaxStack(AHB_ORANGE)));
+ else
+ stackCount = 1;
+ buyoutPrice *= urand(config->GetMinPrice(AHB_ORANGE), config->GetMaxPrice(AHB_ORANGE));
+ buyoutPrice /= 100;
+ bidPrice = buyoutPrice * urand(config->GetMinBidPrice(AHB_ORANGE), config->GetMaxBidPrice(AHB_ORANGE));
+ bidPrice /= 100;
+ break;
+ case AHB_YELLOW:
+ if (config->GetMaxStack(AHB_YELLOW) > 1 && item->GetMaxStackCount() > 1)
+ stackCount = urand(1, minValue(item->GetMaxStackCount(), config->GetMaxStack(AHB_YELLOW)));
+ else
+ stackCount = 1;
+ buyoutPrice *= urand(config->GetMinPrice(AHB_YELLOW), config->GetMaxPrice(AHB_YELLOW));
+ buyoutPrice /= 100;
+ bidPrice = buyoutPrice * urand(config->GetMinBidPrice(AHB_YELLOW), config->GetMaxBidPrice(AHB_YELLOW));
+ bidPrice /= 100;
+ break;
}
- buyoutPrice *= urand(config->GetMinPrice(AHB_YELLOW), config->GetMaxPrice(AHB_YELLOW)) * stackCount;
- buyoutPrice /= 100;
- bidPrice = buyoutPrice * urand(config->GetMinBidPrice(AHB_YELLOW), config->GetMaxBidPrice(AHB_YELLOW));
- bidPrice /= 100;
- break;
- }
-
- if(auctionmgr.GetAItem(GUID_LOPART(item->GetGUID())))
- {
- sLog.outError("Item %u not found", item->GetEntry());
- break;
- }
- if(!item->CanBeTraded())
- {
- sLog.outError("Item %u can't be traded", item->GetEntry());
- break;
- }
- if (item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_CONJURED) || item->GetUInt32Value(ITEM_FIELD_DURATION))
- {
- sLog.outError("Item %u is conjured or has a duration", item->GetEntry());
- break;
- }
- uint32 etime = urand(1,3);
- switch(etime)
- {
+ uint32 etime = urand(1,3);
+ switch(etime)
+ {
case 1:
etime = 43200;
break;
@@ -483,91 +406,144 @@ static void addNewAuctions(Player *AHBplayer, AHBConfig *config)
default:
etime = 86400;
break;
+ }
+ item->SetCount(stackCount);
+
+ uint32 dep = auctionmgr.GetAuctionDeposit(ahEntry, etime, item);
+
+ AuctionEntry* auctionEntry = new AuctionEntry;
+ auctionEntry->Id = objmgr.GenerateAuctionID();
+ auctionEntry->auctioneer = AuctioneerGUID;
+ auctionEntry->item_guidlow = item->GetGUIDLow();
+ auctionEntry->item_template = item->GetEntry();
+ auctionEntry->owner = AHBplayer->GetGUIDLow();
+ auctionEntry->startbid = bidPrice * stackCount;
+ auctionEntry->buyout = buyoutPrice * stackCount;
+ auctionEntry->bidder = 0;
+ auctionEntry->bid = 0;
+ auctionEntry->deposit = dep;
+ auctionEntry->expire_time = (time_t) etime + time(NULL);
+ auctionEntry->auctionHouseEntry = ahEntry;
+ item->SaveToDB();
+ item->RemoveFromUpdateQueueOf(AHBplayer);
+ auctionmgr.AddAItem(item);
+ auctionHouse->AddAuction(auctionEntry);
+ auctionEntry->SaveToDB();
+
+ switch(itemColor)
+ {
+ case 0:
+ ++greyItems;
+ break;
+ case 1:
+ ++whiteItems;
+ break;
+ case 2:
+ ++greenItems;
+ break;
+ case 3:
+ ++blueItems;
+ break;
+ case 4:
+ ++purpleItems;
+ break;
+ case 5:
+ ++orangeItems;
+ break;
+ case 6:
+ ++yellowItems;
+ break;
+ case 7:
+ ++greyTGoods;
+ break;
+ case 8:
+ ++whiteTGoods;
+ break;
+ case 9:
+ ++greenTGoods;
+ break;
+ case 10:
+ ++blueTGoods;
+ break;
+ case 11:
+ ++purpleTGoods;
+ break;
+ case 12:
+ ++orangeTGoods;
+ break;
+ case 13:
+ ++yellowTGoods;
+ break;
+ default:
+ break;
+ }
}
- uint32 dep = auctionmgr.GetAuctionDeposit( ahEntry, etime, item );
-
- item->SetCount(stackCount);
-
- AuctionEntry* auctionEntry = new AuctionEntry;
- auctionEntry->Id = objmgr.GenerateAuctionID();
- auctionEntry->auctioneer = AuctioneerGUID;
- auctionEntry->item_guidlow = item->GetGUIDLow();
- auctionEntry->item_template = item->GetEntry();
- auctionEntry->owner = AHBplayer->GetGUIDLow();
- auctionEntry->startbid = bidPrice;
- auctionEntry->buyout = buyoutPrice;
- auctionEntry->bidder = 0;
- auctionEntry->bid = 0;
- auctionEntry->deposit = dep;
- auctionEntry->expire_time = (time_t) etime + time(NULL);
- auctionEntry->auctionHouseEntry = ahEntry;
- item->SaveToDB();
- item->RemoveFromUpdateQueueOf(AHBplayer);
- auctionmgr.AddAItem(item);
- auctionHouse->AddAuction(auctionEntry);
- auctionEntry->SaveToDB();
}
}
-
-static void addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *config, WorldSession *session)
+void AuctionHouseBot::addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *config, WorldSession *session)
{
if (!AHBBuyer)
return;
// Fetches content of selected AH
AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap(config->GetAHFID());
- AuctionHouseObject::AuctionEntryMap::iterator itr;
-
- itr = auctionHouse->GetAuctionsBegin();
vector<uint32> possibleBids;
- while (itr != auctionHouse->GetAuctionsEnd())
+ for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = auctionHouse->GetAuctionsBegin();itr != auctionHouse->GetAuctionsEnd();++itr)
{
- AuctionHouseObject::AuctionEntryMap::iterator tmp = itr;
- ++itr;
// Check if the auction is ours
// if it is, we skip this iteration.
- if(tmp->second->owner == AHBplayerGUID)
+ if (itr->second->owner == AHBplayerGUID)
{
continue;
}
// Check that we haven't bidded in this auction already.
- if(tmp->second->bidder != AHBplayerGUID)
+ if (itr->second->bidder != AHBplayerGUID)
{
- uint32 tmpdata = tmp->second->Id;
+ uint32 tmpdata = itr->second->Id;
possibleBids.push_back(tmpdata);
}
}
- uint32 bids = config->GetBidsPerInterval();
- for (uint32 count = 0; count < bids; ++count)
+ for (uint32 count = 1;count < config->GetBidsPerInterval();++count)
{
// Do we have anything to bid? If not, stop here.
- if(possibleBids.empty())
- return;
+ if (possibleBids.empty())
+ {
+ count = config->GetBidsPerInterval();
+ continue;
+ }
// Choose random auction from possible auctions
uint32 vectorPos = urand(0, possibleBids.size() - 1);
vector<uint32>::iterator iter = possibleBids.begin();
advance(iter, vectorPos);
+
// from auctionhousehandler.cpp, creates auction pointer & player pointer
AuctionEntry* auction = auctionHouse->GetAuction(*iter);
- // Erase the auction from the vector to prevent bidding on item in next itteration.
+
+ // Erase the auction from the vector to prevent bidding on item in next iteration.
possibleBids.erase(iter);
+ if (!auction)
+ {
+ if (debug_Out) sLog.outError("Item doesn't exist, perhaps bought already?");
+ continue;
+ }
+
// get exact item information
Item *pItem = auctionmgr.GetAItem(auction->item_guidlow);
if (!pItem)
{
- sLog.outError("Item doesn't exists, perhaps bought already?");
- return;
+ if (debug_Out) sLog.outError("Item doesn't exist, perhaps bought already?");
+ continue;
}
// get item prototype
ItemPrototype const* prototype = objmgr.GetItemPrototype(auction->item_template);
// check which price we have to use, startbid or if it is bidded already
- if(debug_Out)
+ if (debug_Out)
{
sLog.outError("Auction Number: %u", auction->Id);
sLog.outError("Item Template: %u", auction->item_template);
@@ -577,17 +553,15 @@ static void addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *config, World
}
uint32 currentprice;
- if(auction->bid)
+ if (auction->bid)
{
currentprice = auction->bid;
- if(debug_Out)
- {sLog.outError("Current Price: %u", auction->bid);}
+ if (debug_Out) sLog.outError("Current Price: %u", auction->bid);
}
else
{
currentprice = auction->startbid;
- if(debug_Out)
- {sLog.outError("Current Price: %u", auction->startbid);}
+ if (debug_Out) sLog.outError("Current Price: %u", auction->startbid);
}
// Prepare portion from maximum bid
@@ -595,7 +569,7 @@ static void addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *config, World
double tmprate = static_cast<double>(tmprate2);
double bidrate = tmprate / 100;
long double bidMax = 0;
- if(debug_Out)
+ if (debug_Out)
{
sLog.outError("tmprate: %f", tmprate);
sLog.outError("bidrate: %f", bidrate);
@@ -604,140 +578,135 @@ static void addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *config, World
// check that bid has acceptable value and take bid based on vendorprice, stacksize and quality
switch (BuyMethod)
{
- case 0:
+ case 0:
{
switch (prototype->Quality)
{
- case 0:
- if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREY))
- bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREY);
- break;
- case 1:
- if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_WHITE))
- bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_WHITE);
- break;
- case 2:
- if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREEN))
- bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREEN);
- break;
- case 3:
- if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_BLUE))
- bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_BLUE);
- break;
- case 4:
- if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_PURPLE))
- bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_PURPLE);
- case 5:
- if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_ORANGE))
- bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_ORANGE);
- case 6:
- if(currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_YELLOW))
- bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_YELLOW);
- break;
- default:
- // quality is something it shouldn't be, let's get out of here
- if(debug_Out)
- sLog.outError("bidMax(fail): %f", bidMax);
- return;
+ case 0:
+ if (currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREY))
+ bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREY);
+ break;
+ case 1:
+ if (currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_WHITE))
+ bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_WHITE);
+ break;
+ case 2:
+ if (currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREEN))
+ bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREEN);
+ break;
+ case 3:
+ if (currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_BLUE))
+ bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_BLUE);
+ break;
+ case 4:
+ if (currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_PURPLE))
+ bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_PURPLE);
+ case 5:
+ if (currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_ORANGE))
+ bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_ORANGE);
+ case 6:
+ if (currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_YELLOW))
+ bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_YELLOW);
+ break;
+ default:
+ // quality is something it shouldn't be, let's get out of here
+ if (debug_Out) sLog.outError("bidMax(fail): %f", bidMax);
+ continue;
+ break;
}
break;
}
- case 1:
+ case 1:
{
switch (prototype->Quality)
{
- case 0:
- if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREY))
- bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREY);
- break;
- case 1:
- if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_WHITE))
- bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_WHITE);
- break;
- case 2:
- if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREEN))
- bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREEN);
- break;
- case 3:
- if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_BLUE))
- bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_BLUE);
- break;
- case 4:
- if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_PURPLE))
- bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_PURPLE);
- case 5:
- if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_ORANGE))
- bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_ORANGE);
- case 6:
- if(currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_YELLOW))
- bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_YELLOW);
- break;
- default:
- // quality is something it shouldn't be, let's get out of here
- if(debug_Out)
- sLog.outError("bidMax(fail): %f", bidMax);
- return;
+ case 0:
+ if (currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREY))
+ bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREY);
+ break;
+ case 1:
+ if (currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_WHITE))
+ bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_WHITE);
+ break;
+ case 2:
+ if (currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREEN))
+ bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_GREEN);
+ break;
+ case 3:
+ if (currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_BLUE))
+ bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_BLUE);
+ break;
+ case 4:
+ if (currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_PURPLE))
+ bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_PURPLE);
+ case 5:
+ if (currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_ORANGE))
+ bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_ORANGE);
+ case 6:
+ if (currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_YELLOW))
+ bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(AHB_YELLOW);
+ break;
+ default:
+ // quality is something it shouldn't be, let's get out of here
+ if (debug_Out) sLog.outError("bidMax(fail): %f", bidMax);
+ continue;
+ break;
}
break;
}
- default:
- bidMax = 0;
- break;
}
- if(debug_Out)
- sLog.outError("bidMax(succeed): %f", bidMax);
+ if (debug_Out) sLog.outError("bidMax(succeed): %f", bidMax);
// check some special items, and do recalculating to their prices
switch (prototype->Class)
{
// ammo
- case 6:
- bidMax = 0;
- break;
- default:
- break;
+ case 6:
+ bidMax = 0;
+ break;
+ default:
+ break;
}
- if(bidMax == 0)
+ if (bidMax == 0)
{
// quality check failed to get bidmax, let's get out of here
- return;
+ continue;
}
// Calculate our bid
- long double bidvalue = currentprice + ( (bidMax - currentprice) * bidrate);
+ long double bidvalue = currentprice + ((bidMax - currentprice) * bidrate);
// Convert to uint32
uint32 bidprice = static_cast<uint32>(bidvalue);
- if(debug_Out)
+ if (debug_Out)
{
sLog.outError("bidprice: %u", bidprice);
sLog.outError("bidvalue: %f", bidvalue);
}
// Check our bid is high enough to be valid. If not, correct it to minimum.
- if((currentprice + auction->GetAuctionOutBid()) > bidprice)
+ if ((currentprice + auction->GetAuctionOutBid()) > bidprice)
{
bidprice = currentprice + auction->GetAuctionOutBid();
- if(debug_Out)
- sLog.outError("bidprice(>): %u", bidprice);
+ if (debug_Out) sLog.outError("bidprice(>): %u", bidprice);
}
- // Check wether we do normal bid, or buyout
+ // Check whether we do normal bid, or buyout
if ((bidprice < auction->buyout) || (auction->buyout == 0))
{
if (auction->bidder > 0)
{
- if ( auction->bidder == AHBplayer->GetGUIDLow() )
+ if (auction->bidder == AHBplayer->GetGUIDLow())
{
- //pl->ModifyMoney( -int32(price - auction->bid));
+ //pl->ModifyMoney(-int32(price - auction->bid));
}
else
{
// mail to last bidder and return money
- session->SendAuctionOutbiddedMail( auction , bidprice );
- //pl->ModifyMoney( -int32(price) );
+ session->SendAuctionOutbiddedMail(auction , bidprice);
+ //pl->ModifyMoney(-int32(price));
}
}
@@ -750,24 +719,24 @@ static void addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *config, World
else
{
//buyout
- if (AHBplayer->GetGUIDLow() == auction->bidder )
+ if (AHBplayer->GetGUIDLow() == auction->bidder)
{
//pl->ModifyMoney(-int32(auction->buyout - auction->bid));
}
else
{
//pl->ModifyMoney(-int32(auction->buyout));
- if ( auction->bidder )
+ if (auction->bidder)
{
- session->SendAuctionOutbiddedMail( auction, auction->buyout );
+ session->SendAuctionOutbiddedMail(auction, auction->buyout);
}
}
auction->bidder = AHBplayer->GetGUIDLow();
auction->bid = auction->buyout;
// Send mails to buyer & seller
- auctionmgr.SendAuctionSuccessfulMail( auction );
- auctionmgr.SendAuctionWonMail( auction );
+ auctionmgr.SendAuctionSuccessfulMail(auction);
+ auctionmgr.SendAuctionWonMail(auction);
// Remove item from auctionhouse
auctionmgr.RemoveAItem(auction->item_guidlow);
@@ -779,21 +748,20 @@ static void addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *config, World
}
}
}
-///////////////////////////////////////////////////////////////////////////////
-//
-///////////////////////////////////////////////////////////////////////////////
-void AuctionHouseBot()
+
+void AuctionHouseBot::Update()
{
time_t _newrun = time(NULL);
if ((!AHBSeller) && (!AHBBuyer))
- return;
+ return;
WorldSession _session(AHBplayerAccount, NULL, SEC_PLAYER, true, 0, LOCALE_enUS);
Player _AHBplayer(&_session);
_AHBplayer.MinimalLoadFromDB(NULL, AHBplayerGUID);
ObjectAccessor::Instance().AddObject(&_AHBplayer);
- if(!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
+ // Add New Bids
+ if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
{
addNewAuctions(&_AHBplayer, &AllianceConfig);
if (((_newrun - _lastrun_a) > (AllianceConfig.GetBiddingInterval() * 60)) && (AllianceConfig.GetBidsPerInterval() > 0))
@@ -801,6 +769,7 @@ void AuctionHouseBot()
addNewAuctionBuyerBotBid(&_AHBplayer, &AllianceConfig, &_session);
_lastrun_a = _newrun;
}
+
addNewAuctions(&_AHBplayer, &HordeConfig);
if (((_newrun - _lastrun_h) > (HordeConfig.GetBiddingInterval() *60)) && (HordeConfig.GetBidsPerInterval() > 0))
{
@@ -808,6 +777,7 @@ void AuctionHouseBot()
_lastrun_h = _newrun;
}
}
+
addNewAuctions(&_AHBplayer, &NeutralConfig);
if (((_newrun - _lastrun_n) > (NeutralConfig.GetBiddingInterval() * 60)) && (NeutralConfig.GetBidsPerInterval() > 0))
{
@@ -816,25 +786,29 @@ void AuctionHouseBot()
}
ObjectAccessor::Instance().RemoveObject(&_AHBplayer);
}
-///////////////////////////////////////////////////////////////////////////////
-//
-///////////////////////////////////////////////////////////////////////////////
-void AuctionHouseBotInit()
+
+void AuctionHouseBot::Initialize()
{
AHBSeller = sConfig.GetBoolDefault("AuctionHouseBot.EnableSeller", false);
AHBBuyer = sConfig.GetBoolDefault("AuctionHouseBot.EnableBuyer", false);
+ AHBplayerAccount = sConfig.GetIntDefault("AuctionHouseBot.Account", 0);
+ AHBplayerGUID = sConfig.GetIntDefault("AuctionHouseBot.GUID", 0);
+ debug_Out = sConfig.GetBoolDefault("AuctionHouseBot.DEBUG", false);
No_Bind = sConfig.GetBoolDefault("AuctionHouseBot.No_Bind", true);
Bind_When_Picked_Up = sConfig.GetBoolDefault("AuctionHouseBot.Bind_When_Picked_Up", false);
Bind_When_Equipped = sConfig.GetBoolDefault("AuctionHouseBot.Bind_When_Equipped", true);
Bind_When_Use = sConfig.GetBoolDefault("AuctionHouseBot.Bind_When_Use", true);
Bind_Quest_Item = sConfig.GetBoolDefault("AuctionHouseBot.Bind_Quest_Item", false);
+ ItemsPerCycle = sConfig.GetIntDefault("AuctionHouseBot.ItemsPerCycle", 200);
+ SellMethod = sConfig.GetIntDefault("AuctionHouseBot.UseBuyPriceForSeller", 0);
+ BuyMethod = sConfig.GetIntDefault("AuctionHouseBot.UseBuyPriceForBuyer", 0);
- if(!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
+ if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
{
- AuctionHouseBotLoadValues(&AllianceConfig);
- AuctionHouseBotLoadValues(&HordeConfig);
+ LoadValues(&AllianceConfig);
+ LoadValues(&HordeConfig);
}
- AuctionHouseBotLoadValues(&NeutralConfig);
+ LoadValues(&NeutralConfig);
if (AHBSeller)
{
@@ -847,44 +821,45 @@ void AuctionHouseBotInit()
results = WorldDatabase.PQuery(npcQuery);
if (results != NULL)
{
- do
- {
- Field* fields = results->Fetch();
- npcItems.push_back(fields[0].GetUInt32());
+ do
+ {
+ Field* fields = results->Fetch();
+ npcItems.push_back(fields[0].GetUInt32());
- } while (results->NextRow());
+ } while (results->NextRow());
- delete results;
+ delete results;
}
else
{
- sLog.outString("AuctionHouseBot: \"%s\" failed", npcQuery);
+ if (debug_Out) sLog.outString("AuctionHouseBot: \"%s\" failed", npcQuery);
}
char lootQuery[] = "SELECT `item` FROM `creature_loot_template` UNION "
- "SELECT `item` FROM `disenchant_loot_template` UNION "
- "SELECT `item` FROM `fishing_loot_template` UNION "
- "SELECT `item` FROM `gameobject_loot_template` UNION "
- "SELECT `item` FROM `item_loot_template` UNION "
- "SELECT `item` FROM `pickpocketing_loot_template` UNION "
- "SELECT `item` FROM `prospecting_loot_template` UNION "
- "SELECT `item` FROM `skinning_loot_template`";
+ "SELECT `item` FROM `disenchant_loot_template` UNION "
+ "SELECT `item` FROM `fishing_loot_template` UNION "
+ "SELECT `item` FROM `gameobject_loot_template` UNION "
+ "SELECT `item` FROM `item_loot_template` UNION "
+ "SELECT `item` FROM `milling_loot_template` UNION "
+ "SELECT `item` FROM `pickpocketing_loot_template` UNION "
+ "SELECT `item` FROM `prospecting_loot_template` UNION "
+ "SELECT `item` FROM `skinning_loot_template`";
results = WorldDatabase.PQuery(lootQuery);
if (results != NULL)
{
- do
- {
- Field* fields = results->Fetch();
- lootItems.push_back(fields[0].GetUInt32());
+ do
+ {
+ Field* fields = results->Fetch();
+ lootItems.push_back(fields[0].GetUInt32());
- } while (results->NextRow());
+ } while (results->NextRow());
- delete results;
+ delete results;
}
else
{
- sLog.outString("AuctionHouseBot: \"%s\" failed", lootQuery);
+ if (debug_Out) sLog.outString("AuctionHouseBot: \"%s\" failed", lootQuery);
}
for (uint32 itemID = 0; itemID < sItemStorage.MaxEntry; itemID++)
@@ -892,8 +867,121 @@ void AuctionHouseBotInit()
ItemPrototype const* prototype = objmgr.GetItemPrototype(itemID);
if (prototype == NULL)
- continue;
+ continue;
+
+ /* disabled filters for now
+ // Disable WOTLK items
+ if (prototype->ItemId > 39000)
+ {
+ if (debug_Out) sLog.outError("AuctionHouseBot: Item %u disabled (WOTLK Item)", prototype->ItemId);
+ continue;
+ }
+
+ // Disable PTR/Beta/Unused items
+ if ((prototype->ItemId == 21878) || (prototype->ItemId == 27774) || (prototype->ItemId == 27811) || (prototype->ItemId == 28117) || (prototype->ItemId == 28112))
+ {
+ if (debug_Out) sLog.outError("AuctionHouseBot: Item %u disabled (PTR/Beta/Unused Item)", prototype->ItemId);
+ continue;
+ }
+ // Disable item level above 175 (Sunwell items)
+ if (prototype->ItemLevel > 175)
+ {
+ if (debug_Out) sLog.outError("AuctionHouseBot: Item %u disabled (SunWell Item)", prototype->ItemId);
+ continue;
+ }
+
+ // Disable items for level higher than 70
+ if (prototype->RequiredLevel > 70)
+ {
+ if (debug_Out) sLog.outError("AuctionHouseBot: Item %u disabled (RequiredLevel = %u)", prototype->ItemId, prototype->RequiredLevel);
+ continue;
+ }
+
+ // Disable items for DK
+ if (prototype->AllowableClass == 32)
+ {
+ if (debug_Out) sLog.outError("AuctionHouseBot: Item %u disabled (DK Item)", prototype->ItemId);
+ continue;
+ }
+
+ // Disable items require skill higher than 375
+ if (prototype->RequiredSkillRank > 375)
+ {
+ if (debug_Out) sLog.outError("AuctionHouseBot: Item %u disabled (RequiredSkillRank = %u)", prototype->ItemId, prototype->RequiredSkillRank);
+ continue;
+ }
+
+ // Disable permanent enchants items
+ if (prototype->Class == ITEM_CLASS_PERMANENT)
+ {
+ if (debug_Out) sLog.outError("AuctionHouseBot: Item %u disabled (Permanent Enchant Item)", prototype->ItemId);
+ continue;
+ }
+
+ // Disable conjured items
+ if (prototype->IsConjuredConsumable())
+ {
+ if (debug_Out) sLog.outError("AuctionHouseBot: Item %u disabled (Conjured Consumable)", prototype->ItemId);
+ continue;
+ }
+
+ // Disable WotLK ingredients including some TBC ingredients
+ if (prototype->Class == ITEM_CLASS_TRADE_GOODS && prototype->ItemLevel >= 70)
+ {
+ if (debug_Out) sLog.outError("AuctionHouseBot: Item %u disabled (ItemLevel = %u)", prototype->ItemId, prototype->ItemLevel);
+ continue;
+ }
+
+ // Disable gems
+ if (prototype->Class == ITEM_CLASS_GEM)
+ {
+ if (debug_Out) sLog.outError("AuctionHouseBot: Item %u disabled (Gem)", prototype->ItemId);
+ continue;
+ }
+
+ // Disable money
+ if (prototype->Class == ITEM_CLASS_MONEY)
+ {
+ if (debug_Out) sLog.outError("AuctionHouseBot: Item %u disabled (Money)", prototype->ItemId);
+ continue;
+ }
+
+ // Disable moneyloot
+ if (prototype->MinMoneyLoot > 0)
+ {
+ if (debug_Out) sLog.outError("AuctionHouseBot: Item %u disabled (MoneyLoot)", prototype->ItemId);
+ continue;
+ }
+
+ // Disable lootable items
+ if (prototype->Flags & 4)
+ {
+ if (debug_Out) sLog.outError("AuctionHouseBot: Item %u disabled (Lootable Item)", prototype->ItemId);
+ continue;
+ }
+
+ // Disable Keys
+ if (prototype->Class == ITEM_CLASS_KEY)
+ {
+ if (debug_Out) sLog.outError("AuctionHouseBot: Item %u disabled (Quest Item)", prototype->ItemId);
+ continue;
+ }
+
+ // Disable items with duration
+ if (prototype->Duration > 0)
+ {
+ if (debug_Out) sLog.outError("AuctionHouseBot: Item %u disabled (Has a Duration)", prototype->ItemId);
+ continue;
+ }
+
+ if ((prototype->Bonding == BIND_WHEN_PICKED_UP || prototype->Bonding == BIND_QUEST_ITEM) && prototype->RequiredLevel == 0)
+ {
+ if (debug_Out) sLog.outError("AuctionHouseBot: Item %u disabled (BOP or BQI and required level 0)", prototype->ItemId);
+ continue;
+ }
+
+ */
switch (prototype->Bonding)
{
case 0:
@@ -931,13 +1019,10 @@ void AuctionHouseBotInit()
if (prototype->BuyPrice == 0)
continue;
break;
- default:
- continue;
- break;
}
if ((prototype->Quality < 0) || (prototype->Quality > 6))
- continue;
+ continue;
if (Vendor_Items == 0)
{
@@ -945,12 +1030,12 @@ void AuctionHouseBotInit()
for (unsigned int i = 0; (i < npcItems.size()) && (!isVendorItem); i++)
{
- if (itemID == npcItems[i])
- isVendorItem = true;
+ if (itemID == npcItems[i])
+ isVendorItem = true;
}
if (isVendorItem)
- continue;
+ continue;
}
if (Loot_Items == 0)
@@ -959,12 +1044,12 @@ void AuctionHouseBotInit()
for (unsigned int i = 0; (i < lootItems.size()) && (!isLootItem); i++)
{
- if (itemID == lootItems[i])
- isLootItem = true;
+ if (itemID == lootItems[i])
+ isLootItem = true;
}
if (isLootItem)
- continue;
+ continue;
}
if (Other_Items == 0)
@@ -974,13 +1059,13 @@ void AuctionHouseBotInit()
for (unsigned int i = 0; (i < npcItems.size()) && (!isVendorItem); i++)
{
- if (itemID == npcItems[i])
- isVendorItem = true;
+ if (itemID == npcItems[i])
+ isVendorItem = true;
}
for (unsigned int i = 0; (i < lootItems.size()) && (!isLootItem); i++)
{
- if (itemID == lootItems[i])
- isLootItem = true;
+ if (itemID == lootItems[i])
+ isLootItem = true;
}
if ((!isLootItem) && (!isVendorItem))
continue;
@@ -988,78 +1073,75 @@ void AuctionHouseBotInit()
switch (prototype->Quality)
{
- case 0:
+ case 0:
if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
- greyTradeGoodsBin.push_back(itemID);
+ greyTradeGoodsBin.push_back(itemID);
else
- greyItemsBin.push_back(itemID);
+ greyItemsBin.push_back(itemID);
break;
- case 1:
+ case 1:
if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
- whiteTradeGoodsBin.push_back(itemID);
+ whiteTradeGoodsBin.push_back(itemID);
else
- whiteItemsBin.push_back(itemID);
+ whiteItemsBin.push_back(itemID);
break;
- case 2:
+ case 2:
if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
- greenTradeGoodsBin.push_back(itemID);
+ greenTradeGoodsBin.push_back(itemID);
else
- greenItemsBin.push_back(itemID);
+ greenItemsBin.push_back(itemID);
break;
- case 3:
+ case 3:
if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
- blueTradeGoodsBin.push_back(itemID);
+ blueTradeGoodsBin.push_back(itemID);
else
- blueItemsBin.push_back(itemID);
+ blueItemsBin.push_back(itemID);
break;
- case 4:
+ case 4:
if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
- purpleTradeGoodsBin.push_back(itemID);
+ purpleTradeGoodsBin.push_back(itemID);
else
- purpleItemsBin.push_back(itemID);
+ purpleItemsBin.push_back(itemID);
break;
- case 5:
+ case 5:
if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
- orangeTradeGoodsBin.push_back(itemID);
+ orangeTradeGoodsBin.push_back(itemID);
else
- orangeItemsBin.push_back(itemID);
+ orangeItemsBin.push_back(itemID);
break;
- case 6:
+ case 6:
if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
- yellowTradeGoodsBin.push_back(itemID);
+ yellowTradeGoodsBin.push_back(itemID);
else
- yellowItemsBin.push_back(itemID);
+ yellowItemsBin.push_back(itemID);
break;
}
}
- if (
- (greyTradeGoodsBin.size() == 0) &&
- (whiteTradeGoodsBin.size() == 0) &&
- (greenTradeGoodsBin.size() == 0) &&
- (blueTradeGoodsBin.size() == 0) &&
- (purpleTradeGoodsBin.size() == 0) &&
- (orangeTradeGoodsBin.size() == 0) &&
- (yellowTradeGoodsBin.size() == 0) &&
- (greyItemsBin.size() == 0) &&
- (whiteItemsBin.size() == 0) &&
- (greenItemsBin.size() == 0) &&
- (blueItemsBin.size() == 0) &&
- (purpleItemsBin.size() == 0) &&
- (orangeItemsBin.size() == 0) &&
- (yellowItemsBin.size() == 0)
- )
+ if ((greyTradeGoodsBin.size() == 0) &&
+ (whiteTradeGoodsBin.size() == 0) &&
+ (greenTradeGoodsBin.size() == 0) &&
+ (blueTradeGoodsBin.size() == 0) &&
+ (purpleTradeGoodsBin.size() == 0) &&
+ (orangeTradeGoodsBin.size() == 0) &&
+ (yellowTradeGoodsBin.size() == 0) &&
+ (greyItemsBin.size() == 0) &&
+ (whiteItemsBin.size() == 0) &&
+ (greenItemsBin.size() == 0) &&
+ (blueItemsBin.size() == 0) &&
+ (purpleItemsBin.size() == 0) &&
+ (orangeItemsBin.size() == 0) &&
+ (yellowItemsBin.size() == 0))
{
- sLog.outString("AuctionHouseBot: No items");
- AHBSeller = 0;
+ sLog.outString("AuctionHouseBot: No items");
+ AHBSeller = 0;
}
-
sLog.outString("AuctionHouseBot:");
sLog.outString("loaded %u grey trade goods", greyTradeGoodsBin.size());
sLog.outString("loaded %u white trade goods", whiteTradeGoodsBin.size());
@@ -1078,9 +1160,8 @@ void AuctionHouseBotInit()
}
sLog.outString("AuctionHouseBot by Paradox (original by ChrisK) has been loaded.");
sLog.outString("AuctionHouseBot now includes AHBuyer by Kerbe and Paradox");
-
}
-void AuctionHouseBotCommands(uint32 command, uint32 ahMapID, uint32 col, char* args)
+void AuctionHouseBot::Commands(uint32 command, uint32 ahMapID, uint32 col, char* args)
{
AHBConfig *config;
switch (ahMapID)
@@ -1133,32 +1214,33 @@ void AuctionHouseBotCommands(uint32 command, uint32 ahMapID, uint32 col, char* a
while (itr != auctionHouse->GetAuctionsEnd())
{
- if (itr->second->owner == AHBplayerGUID)
- itr->second->expire_time = sWorld.GetGameTime();
+ if (itr->second->owner == AHBplayerGUID)
+ itr->second->expire_time = sWorld.GetGameTime();
- ++itr;
+ ++itr;
}
- }break;
+ }
+ break;
case 1: //min items
{
char * param1 = strtok(args, " ");
uint32 minItems = (uint32) strtoul(param1, NULL, 0);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET minitems = '%u' WHERE auctionhouse = '%u'", minItems, ahMapID);
config->SetMinItems(minItems);
- }break;
+ }
+ break;
case 2: //max items
{
char * param1 = strtok(args, " ");
uint32 maxItems = (uint32) strtoul(param1, NULL, 0);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET maxitems = '%u' WHERE auctionhouse = '%u'", maxItems, ahMapID);
config->SetMaxItems(maxItems);
- }break;
+ }
+ break;
case 3: //min time Deprecated (Place holder for future commands)
- {
- }break;
+ break;
case 4: //max time Deprecated (Place holder for future commands)
- {
- }break;
+ break;
case 5: //percentages
{
char * param1 = strtok(args, " ");
@@ -1207,77 +1289,89 @@ void AuctionHouseBotCommands(uint32 command, uint32 ahMapID, uint32 col, char* a
CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentyellowitems = '%u' WHERE auctionhouse = '%u'", yellowi, ahMapID);
CharacterDatabase.CommitTransaction();
config->SetPercentages(greytg, whitetg, greentg, bluetg, purpletg, orangetg, yellowtg, greyi, whitei, greeni, bluei, purplei, orangei, yellowi);
- }break;
+ }
+ break;
case 6: //min prices
{
char * param1 = strtok(args, " ");
uint32 minPrice = (uint32) strtoul(param1, NULL, 0);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET minprice%s = '%u' WHERE auctionhouse = '%u'",color.c_str(), minPrice, ahMapID);
config->SetMinPrice(col, minPrice);
- }break;
+ }
+ break;
case 7: //max prices
{
char * param1 = strtok(args, " ");
uint32 maxPrice = (uint32) strtoul(param1, NULL, 0);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET maxprice%s = '%u' WHERE auctionhouse = '%u'",color.c_str(), maxPrice, ahMapID);
config->SetMaxPrice(col, maxPrice);
- }break;
+ }
+ break;
case 8: //min bid price
{
char * param1 = strtok(args, " ");
uint32 minBidPrice = (uint32) strtoul(param1, NULL, 0);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET minbidprice%s = '%u' WHERE auctionhouse = '%u'",color.c_str(), minBidPrice, ahMapID);
config->SetMinBidPrice(col, minBidPrice);
- }break;
+ }
+ break;
case 9: //max bid price
{
char * param1 = strtok(args, " ");
uint32 maxBidPrice = (uint32) strtoul(param1, NULL, 0);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET maxbidprice%s = '%u' WHERE auctionhouse = '%u'",color.c_str(), maxBidPrice, ahMapID);
config->SetMaxBidPrice(col, maxBidPrice);
- }break;
+ }
+ break;
case 10: //max stacks
{
char * param1 = strtok(args, " ");
uint32 maxStack = (uint32) strtoul(param1, NULL, 0);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET maxstack%s = '%u' WHERE auctionhouse = '%u'",color.c_str(), maxStack, ahMapID);
config->SetMaxStack(col, maxStack);
- }break;
+ }
+ break;
case 11: //buyer bid prices
{
char * param1 = strtok(args, " ");
uint32 buyerPrice = (uint32) strtoul(param1, NULL, 0);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET buyerprice%s = '%u' WHERE auctionhouse = '%u'",color.c_str(), buyerPrice, ahMapID);
config->SetBuyerPrice(col, buyerPrice);
- }break;
+ }
+ break;
case 12: //buyer bidding interval
{
char * param1 = strtok(args, " ");
uint32 bidInterval = (uint32) strtoul(param1, NULL, 0);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET buyerbiddinginterval = '%u' WHERE auctionhouse = '%u'", bidInterval, ahMapID);
config->SetBiddingInterval(bidInterval);
- }break;
+ }
+ break;
case 13: //buyer bids per interval
{
char * param1 = strtok(args, " ");
uint32 bidsPerInterval = (uint32) strtoul(param1, NULL, 0);
CharacterDatabase.PExecute("UPDATE auctionhousebot SET buyerbidsperinterval = '%u' WHERE auctionhouse = '%u'", bidsPerInterval, ahMapID);
config->SetBidsPerInterval(bidsPerInterval);
- }break;
+ }
+ break;
default:
break;
}
}
-void AuctionHouseBotLoadValues(AHBConfig *config)
+
+void AuctionHouseBot::LoadValues(AHBConfig *config)
{
if (AHBSeller)
{
//load min and max items
config->SetMinItems(CharacterDatabase.PQuery("SELECT minitems FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
config->SetMaxItems(CharacterDatabase.PQuery("SELECT maxitems FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError("minItems = %u", config->GetMinItems());
- sLog.outError("maxItems = %u", config->GetMaxItems());}
+ if (debug_Out)
+ {
+ sLog.outError("minItems = %u", config->GetMinItems());
+ sLog.outError("maxItems = %u", config->GetMaxItems());
+ }
//load percentages
uint32 greytg = CharacterDatabase.PQuery("SELECT percentgreytradegoods FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32();
uint32 whitetg = CharacterDatabase.PQuery("SELECT percentwhitetradegoods FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32();
@@ -1294,7 +1388,7 @@ void AuctionHouseBotLoadValues(AHBConfig *config)
uint32 orangei = CharacterDatabase.PQuery("SELECT percentorangeitems FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32();
uint32 yellowi = CharacterDatabase.PQuery("SELECT percentyellowitems FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32();
config->SetPercentages(greytg, whitetg, greentg, bluetg, purpletg, orangetg, yellowtg, greyi, whitei, greeni, bluei, purplei, orangei, yellowi);
- if(debug_Out)
+ if (debug_Out)
{
sLog.outError("percentGreyTradeGoods = %u", config->GetPercentages(AHB_GREY_TG));
sLog.outError("percentWhiteTradeGoods = %u", config->GetPercentages(AHB_WHITE_TG));
@@ -1314,104 +1408,160 @@ void AuctionHouseBotLoadValues(AHBConfig *config)
//load min and max prices
config->SetMinPrice(AHB_GREY, CharacterDatabase.PQuery("SELECT minpricegrey FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
config->SetMaxPrice(AHB_GREY, CharacterDatabase.PQuery("SELECT maxpricegrey FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError("minPriceGrey = %u", config->GetMinPrice(AHB_GREY));
- sLog.outError("maxPriceGrey = %u", config->GetMaxPrice(AHB_GREY));}
+ if (debug_Out)
+ {
+ sLog.outError("minPriceGrey = %u", config->GetMinPrice(AHB_GREY));
+ sLog.outError("maxPriceGrey = %u", config->GetMaxPrice(AHB_GREY));
+ }
config->SetMinPrice(AHB_WHITE, CharacterDatabase.PQuery("SELECT minpricewhite FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
config->SetMaxPrice(AHB_WHITE, CharacterDatabase.PQuery("SELECT maxpricewhite FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError("minPriceWhite = %u", config->GetMinPrice(AHB_WHITE));
- sLog.outError("maxPriceWhite = %u", config->GetMaxPrice(AHB_WHITE));}
+ if (debug_Out)
+ {
+ sLog.outError("minPriceWhite = %u", config->GetMinPrice(AHB_WHITE));
+ sLog.outError("maxPriceWhite = %u", config->GetMaxPrice(AHB_WHITE));
+ }
config->SetMinPrice(AHB_GREEN, CharacterDatabase.PQuery("SELECT minpricegreen FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
config->SetMaxPrice(AHB_GREEN, CharacterDatabase.PQuery("SELECT maxpricegreen FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError("minPriceGreen = %u", config->GetMinPrice(AHB_GREEN));
- sLog.outError("maxPriceGreen = %u", config->GetMaxPrice(AHB_GREEN));}
+ if (debug_Out)
+ {
+ sLog.outError("minPriceGreen = %u", config->GetMinPrice(AHB_GREEN));
+ sLog.outError("maxPriceGreen = %u", config->GetMaxPrice(AHB_GREEN));
+ }
config->SetMinPrice(AHB_BLUE, CharacterDatabase.PQuery("SELECT minpriceblue FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
config->SetMaxPrice(AHB_BLUE, CharacterDatabase.PQuery("SELECT maxpriceblue FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError("minPriceBlue = %u", config->GetMinPrice(AHB_BLUE));
- sLog.outError("maxPriceBlue = %u", config->GetMaxPrice(AHB_BLUE));}
+ if (debug_Out)
+ {
+ sLog.outError("minPriceBlue = %u", config->GetMinPrice(AHB_BLUE));
+ sLog.outError("maxPriceBlue = %u", config->GetMaxPrice(AHB_BLUE));
+ }
config->SetMinPrice(AHB_PURPLE, CharacterDatabase.PQuery("SELECT minpricepurple FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
config->SetMaxPrice(AHB_PURPLE, CharacterDatabase.PQuery("SELECT maxpricepurple FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError("minPricePurple = %u", config->GetMinPrice(AHB_PURPLE));
- sLog.outError("maxPricePurple = %u", config->GetMaxPrice(AHB_PURPLE));}
+ if (debug_Out)
+ {
+ sLog.outError("minPricePurple = %u", config->GetMinPrice(AHB_PURPLE));
+ sLog.outError("maxPricePurple = %u", config->GetMaxPrice(AHB_PURPLE));
+ }
config->SetMinPrice(AHB_ORANGE, CharacterDatabase.PQuery("SELECT minpriceorange FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
config->SetMaxPrice(AHB_ORANGE, CharacterDatabase.PQuery("SELECT maxpriceorange FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError("minPriceOrange = %u", config->GetMinPrice(AHB_ORANGE));
- sLog.outError("maxPriceOrange = %u", config->GetMaxPrice(AHB_ORANGE));}
+ if (debug_Out)
+ {
+ sLog.outError("minPriceOrange = %u", config->GetMinPrice(AHB_ORANGE));
+ sLog.outError("maxPriceOrange = %u", config->GetMaxPrice(AHB_ORANGE));
+ }
config->SetMinPrice(AHB_YELLOW, CharacterDatabase.PQuery("SELECT minpriceyellow FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
config->SetMaxPrice(AHB_YELLOW, CharacterDatabase.PQuery("SELECT maxpriceyellow FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError("minPriceYellow = %u", config->GetMinPrice(AHB_YELLOW));
- sLog.outError("maxPriceYellow = %u", config->GetMaxPrice(AHB_YELLOW));}
+ if (debug_Out)
+ {
+ sLog.outError("minPriceYellow = %u", config->GetMinPrice(AHB_YELLOW));
+ sLog.outError("maxPriceYellow = %u", config->GetMaxPrice(AHB_YELLOW));
+ }
//load min and max bid prices
config->SetMinBidPrice(AHB_GREY, CharacterDatabase.PQuery("SELECT minbidpricegrey FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError(",minBidPriceGrey = %u", config->GetMinBidPrice(AHB_GREY));}
+ if (debug_Out)
+ {
+ sLog.outError("minBidPriceGrey = %u", config->GetMinBidPrice(AHB_GREY));
+ }
config->SetMaxBidPrice(AHB_GREY, CharacterDatabase.PQuery("SELECT maxbidpricegrey FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError("maxBidPriceGrey = %u", config->GetMaxBidPrice(AHB_GREY));}
+ if (debug_Out)
+ {
+ sLog.outError("maxBidPriceGrey = %u", config->GetMaxBidPrice(AHB_GREY));
+ }
config->SetMinBidPrice(AHB_WHITE, CharacterDatabase.PQuery("SELECT minbidpricewhite FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError(",minBidPriceWhite = %u", config->GetMinBidPrice(AHB_WHITE));}
+ if (debug_Out)
+ {
+ sLog.outError("minBidPriceWhite = %u", config->GetMinBidPrice(AHB_WHITE));
+ }
config->SetMaxBidPrice(AHB_WHITE, CharacterDatabase.PQuery("SELECT maxbidpricewhite FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError("maxBidPriceWhite = %u", config->GetMaxBidPrice(AHB_WHITE));}
+ if (debug_Out)
+ {
+ sLog.outError("maxBidPriceWhite = %u", config->GetMaxBidPrice(AHB_WHITE));
+ }
config->SetMinBidPrice(AHB_GREEN, CharacterDatabase.PQuery("SELECT minbidpricegreen FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError("minBidPriceGreen = %u", config->GetMinBidPrice(AHB_GREEN));}
+ if (debug_Out)
+ {
+ sLog.outError("minBidPriceGreen = %u", config->GetMinBidPrice(AHB_GREEN));
+ }
config->SetMaxBidPrice(AHB_GREEN, CharacterDatabase.PQuery("SELECT maxbidpricegreen FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError("maxBidPriceGreen = %u", config->GetMaxBidPrice(AHB_GREEN));}
+ if (debug_Out)
+ {
+ sLog.outError("maxBidPriceGreen = %u", config->GetMaxBidPrice(AHB_GREEN));
+ }
config->SetMinBidPrice(AHB_BLUE, CharacterDatabase.PQuery("SELECT minbidpriceblue FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError("minBidPriceBlue = %u", config->GetMinBidPrice(AHB_BLUE));}
+ if (debug_Out)
+ {
+ sLog.outError("minBidPriceBlue = %u", config->GetMinBidPrice(AHB_BLUE));
+ }
config->SetMaxBidPrice(AHB_BLUE, CharacterDatabase.PQuery("SELECT maxbidpriceblue FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError("maxBidPriceBlue = %u", config->GetMinBidPrice(AHB_BLUE));}
+ if (debug_Out)
+ {
+ sLog.outError("maxBidPriceBlue = %u", config->GetMinBidPrice(AHB_BLUE));
+ }
config->SetMinBidPrice(AHB_PURPLE, CharacterDatabase.PQuery("SELECT minbidpricepurple FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError("minBidPricePurple = %u", config->GetMinBidPrice(AHB_PURPLE));}
+ if (debug_Out)
+ {
+ sLog.outError("minBidPricePurple = %u", config->GetMinBidPrice(AHB_PURPLE));
+ }
config->SetMaxBidPrice(AHB_PURPLE, CharacterDatabase.PQuery("SELECT maxbidpricepurple FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError("maxBidPricePurple = %u", config->GetMaxBidPrice(AHB_PURPLE));}
+ if (debug_Out)
+ {
+ sLog.outError("maxBidPricePurple = %u", config->GetMaxBidPrice(AHB_PURPLE));
+ }
config->SetMinBidPrice(AHB_ORANGE, CharacterDatabase.PQuery("SELECT minbidpriceorange FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError("minBidPriceOrange = %u", config->GetMinBidPrice(AHB_ORANGE));}
+ if (debug_Out)
+ {
+ sLog.outError("minBidPriceOrange = %u", config->GetMinBidPrice(AHB_ORANGE));
+ }
config->SetMaxBidPrice(AHB_ORANGE, CharacterDatabase.PQuery("SELECT maxbidpriceorange FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError("maxBidPriceOrange = %u", config->GetMaxBidPrice(AHB_ORANGE));}
+ if (debug_Out)
+ {
+ sLog.outError("maxBidPriceOrange = %u", config->GetMaxBidPrice(AHB_ORANGE));
+ }
config->SetMinBidPrice(AHB_YELLOW, CharacterDatabase.PQuery("SELECT minbidpriceyellow FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError("minBidPriceYellow = %u", config->GetMinBidPrice(AHB_YELLOW));}
+ if (debug_Out)
+ {
+ sLog.outError("minBidPriceYellow = %u", config->GetMinBidPrice(AHB_YELLOW));
+ }
config->SetMaxBidPrice(AHB_YELLOW, CharacterDatabase.PQuery("SELECT maxbidpriceyellow FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError("maxBidPriceYellow = %u", config->GetMaxBidPrice(AHB_YELLOW));}
+ if (debug_Out)
+ {
+ sLog.outError("maxBidPriceYellow = %u", config->GetMaxBidPrice(AHB_YELLOW));
+ }
//load max stacks
config->SetMaxStack(AHB_GREY, CharacterDatabase.PQuery("SELECT maxstackgrey FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError("maxStackGrey = %u", config->GetMaxStack(AHB_GREY));}
+ if (debug_Out)
+ {
+ sLog.outError("maxStackGrey = %u", config->GetMaxStack(AHB_GREY));
+ }
config->SetMaxStack(AHB_WHITE, CharacterDatabase.PQuery("SELECT maxstackwhite FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError("maxStackWhite = %u", config->GetMaxStack(AHB_WHITE));}
+ if (debug_Out)
+ {
+ sLog.outError("maxStackWhite = %u", config->GetMaxStack(AHB_WHITE));
+ }
config->SetMaxStack(AHB_GREEN, CharacterDatabase.PQuery("SELECT maxstackgreen FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError("maxStackGreen = %u", config->GetMaxStack(AHB_GREEN));}
+ if (debug_Out)
+ {
+ sLog.outError("maxStackGreen = %u", config->GetMaxStack(AHB_GREEN));
+ }
config->SetMaxStack(AHB_BLUE, CharacterDatabase.PQuery("SELECT maxstackblue FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError("maxStackBlue = %u", config->GetMaxStack(AHB_BLUE));}
+ if (debug_Out)
+ {
+ sLog.outError("maxStackBlue = %u", config->GetMaxStack(AHB_BLUE));
+ }
config->SetMaxStack(AHB_PURPLE, CharacterDatabase.PQuery("SELECT maxstackpurple FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError("maxStackPurple = %u", config->GetMaxStack(AHB_PURPLE));}
+ if (debug_Out)
+ {
+ sLog.outError("maxStackPurple = %u", config->GetMaxStack(AHB_PURPLE));
+ }
config->SetMaxStack(AHB_ORANGE, CharacterDatabase.PQuery("SELECT maxstackorange FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError("maxStackOrange = %u", config->GetMaxStack(AHB_ORANGE));}
+ if (debug_Out)
+ {
+ sLog.outError("maxStackOrange = %u", config->GetMaxStack(AHB_ORANGE));
+ }
config->SetMaxStack(AHB_YELLOW, CharacterDatabase.PQuery("SELECT maxstackyellow FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError("maxStackYellow = %u", config->GetMaxStack(AHB_YELLOW));}
+ if (debug_Out)
+ {
+ sLog.outError("maxStackYellow = %u", config->GetMaxStack(AHB_YELLOW));
+ }
}
if (AHBBuyer)
{
@@ -1423,7 +1573,7 @@ void AuctionHouseBotLoadValues(AHBConfig *config)
config->SetBuyerPrice(AHB_PURPLE, CharacterDatabase.PQuery("SELECT buyerpricepurple FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
config->SetBuyerPrice(AHB_ORANGE, CharacterDatabase.PQuery("SELECT buyerpriceorange FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
config->SetBuyerPrice(AHB_YELLOW, CharacterDatabase.PQuery("SELECT buyerpriceyellow FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
+ if (debug_Out)
{
sLog.outError("buyerPriceGrey = %u", config->GetBuyerPrice(AHB_GREY));
sLog.outError("buyerPriceWhite = %u", config->GetBuyerPrice(AHB_WHITE));
@@ -1435,11 +1585,15 @@ void AuctionHouseBotLoadValues(AHBConfig *config)
}
//load bidding interval
config->SetBiddingInterval(CharacterDatabase.PQuery("SELECT buyerbiddinginterval FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError("buyerBiddingInterval = %u", config->GetBiddingInterval());}
+ if (debug_Out)
+ {
+ sLog.outError("buyerBiddingInterval = %u", config->GetBiddingInterval());
+ }
//load bids per interval
config->SetBidsPerInterval(CharacterDatabase.PQuery("SELECT buyerbidsperinterval FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32());
- if(debug_Out)
- {sLog.outError("buyerBidsPerInterval = %u", config->GetBidsPerInterval());}
+ if (debug_Out)
+ {
+ sLog.outError("buyerBidsPerInterval = %u", config->GetBidsPerInterval());
+ }
}
}
diff --git a/src/game/AuctionHouseBot.h b/src/game/AuctionHouseBot.h
index 906a857d206..8c27d2f1f52 100644
--- a/src/game/AuctionHouseBot.h
+++ b/src/game/AuctionHouseBot.h
@@ -1,10 +1,9 @@
#ifndef AUCTION_HOUSE_BOT_H
#define AUCTION_HOUSE_BOT_H
-#include "Common.h"
+#include "World.h"
#include "Config/ConfigEnv.h"
-
-#include "Log.h"
+#include "ace/Vector_T.h"
#define AHB_GREY 0
#define AHB_WHITE 1
@@ -27,153 +26,149 @@
#define AHB_PURPLE_I 11
#define AHB_ORANGE_I 12
#define AHB_YELLOW_I 13
-#define AHBplayerAccount sConfig.GetIntDefault("AuctionHouseBot.Account", 0)
-#define AHBplayerGUID sConfig.GetIntDefault("AuctionHouseBot.GUID", 0)
-#define ItemsPerCycle sConfig.GetIntDefault("AuctionHouseBot.ItemsPerCycle", 200)
-#define SellMethod sConfig.GetIntDefault("AuctionHouseBot.UseBuyPriceForSeller", 1)
-#define BuyMethod sConfig.GetIntDefault("AuctionHouseBot.UseBuyPriceForBuyer", 0)
class AHBConfig
{
- private:
- uint32 AHID;
- uint32 AHFID;
- uint32 minItems;
- uint32 maxItems;
- uint32 percentGreyTradeGoods;
- uint32 percentWhiteTradeGoods;
- uint32 percentGreenTradeGoods;
- uint32 percentBlueTradeGoods;
- uint32 percentPurpleTradeGoods;
- uint32 percentOrangeTradeGoods;
- uint32 percentYellowTradeGoods;
- uint32 percentGreyItems;
- uint32 percentWhiteItems;
- uint32 percentGreenItems;
- uint32 percentBlueItems;
- uint32 percentPurpleItems;
- uint32 percentOrangeItems;
- uint32 percentYellowItems;
- uint32 minPriceGrey;
- uint32 maxPriceGrey;
- uint32 minBidPriceGrey;
- uint32 maxBidPriceGrey;
- uint32 maxStackGrey;
- uint32 minPriceWhite;
- uint32 maxPriceWhite;
- uint32 minBidPriceWhite;
- uint32 maxBidPriceWhite;
- uint32 maxStackWhite;
- uint32 minPriceGreen;
- uint32 maxPriceGreen;
- uint32 minBidPriceGreen;
- uint32 maxBidPriceGreen;
- uint32 maxStackGreen;
- uint32 minPriceBlue;
- uint32 maxPriceBlue;
- uint32 minBidPriceBlue;
- uint32 maxBidPriceBlue;
- uint32 maxStackBlue;
- uint32 minPricePurple;
- uint32 maxPricePurple;
- uint32 minBidPricePurple;
- uint32 maxBidPricePurple;
- uint32 maxStackPurple;
- uint32 minPriceOrange;
- uint32 maxPriceOrange;
- uint32 minBidPriceOrange;
- uint32 maxBidPriceOrange;
- uint32 maxStackOrange;
- uint32 minPriceYellow;
- uint32 maxPriceYellow;
- uint32 minBidPriceYellow;
- uint32 maxBidPriceYellow;
- uint32 maxStackYellow;
+private:
+ uint32 AHID;
+ uint32 AHFID;
+ uint32 minItems;
+ uint32 maxItems;
+ uint32 percentGreyTradeGoods;
+ uint32 percentWhiteTradeGoods;
+ uint32 percentGreenTradeGoods;
+ uint32 percentBlueTradeGoods;
+ uint32 percentPurpleTradeGoods;
+ uint32 percentOrangeTradeGoods;
+ uint32 percentYellowTradeGoods;
+ uint32 percentGreyItems;
+ uint32 percentWhiteItems;
+ uint32 percentGreenItems;
+ uint32 percentBlueItems;
+ uint32 percentPurpleItems;
+ uint32 percentOrangeItems;
+ uint32 percentYellowItems;
+ uint32 minPriceGrey;
+ uint32 maxPriceGrey;
+ uint32 minBidPriceGrey;
+ uint32 maxBidPriceGrey;
+ uint32 maxStackGrey;
+ uint32 minPriceWhite;
+ uint32 maxPriceWhite;
+ uint32 minBidPriceWhite;
+ uint32 maxBidPriceWhite;
+ uint32 maxStackWhite;
+ uint32 minPriceGreen;
+ uint32 maxPriceGreen;
+ uint32 minBidPriceGreen;
+ uint32 maxBidPriceGreen;
+ uint32 maxStackGreen;
+ uint32 minPriceBlue;
+ uint32 maxPriceBlue;
+ uint32 minBidPriceBlue;
+ uint32 maxBidPriceBlue;
+ uint32 maxStackBlue;
+ uint32 minPricePurple;
+ uint32 maxPricePurple;
+ uint32 minBidPricePurple;
+ uint32 maxBidPricePurple;
+ uint32 maxStackPurple;
+ uint32 minPriceOrange;
+ uint32 maxPriceOrange;
+ uint32 minBidPriceOrange;
+ uint32 maxBidPriceOrange;
+ uint32 maxStackOrange;
+ uint32 minPriceYellow;
+ uint32 maxPriceYellow;
+ uint32 minBidPriceYellow;
+ uint32 maxBidPriceYellow;
+ uint32 maxStackYellow;
+
+ uint32 buyerPriceGrey;
+ uint32 buyerPriceWhite;
+ uint32 buyerPriceGreen;
+ uint32 buyerPriceBlue;
+ uint32 buyerPricePurple;
+ uint32 buyerPriceOrange;
+ uint32 buyerPriceYellow;
+ uint32 buyerBiddingInterval;
+ uint32 buyerBidsPerInterval;
- uint32 buyerPriceGrey;
- uint32 buyerPriceWhite;
- uint32 buyerPriceGreen;
- uint32 buyerPriceBlue;
- uint32 buyerPricePurple;
- uint32 buyerPriceOrange;
- uint32 buyerPriceYellow;
- uint32 buyerBiddingInterval;
- uint32 buyerBidsPerInterval;
+ uint32 greytgp;
+ uint32 whitetgp;
+ uint32 greentgp;
+ uint32 bluetgp;
+ uint32 purpletgp;
+ uint32 orangetgp;
+ uint32 yellowtgp;
+ uint32 greyip;
+ uint32 whiteip;
+ uint32 greenip;
+ uint32 blueip;
+ uint32 purpleip;
+ uint32 orangeip;
+ uint32 yellowip;
- uint32 greytgp;
- uint32 whitetgp;
- uint32 greentgp;
- uint32 bluetgp;
- uint32 purpletgp;
- uint32 orangetgp;
- uint32 yellowtgp;
- uint32 greyip;
- uint32 whiteip;
- uint32 greenip;
- uint32 blueip;
- uint32 purpleip;
- uint32 orangeip;
- uint32 yellowip;
- public:
+public:
AHBConfig(uint32 ahid)
- {
- AHID = ahid;
- switch(ahid)
- {
- case 2:
- AHFID = 55;
- break;
- case 6:
+ {
+ AHID = ahid;
+ switch(ahid)
+ {
+ case 2:
+ AHFID = 55;
+ break;
+ case 6:
AHFID = 29;
- break;
- case 7:
+ break;
+ case 7:
AHFID = 120;
- break;
- default:
+ break;
+ default:
AHFID = 120;
- break;
- }
- }
- AHBConfig()
- {
- }
- uint32 GetAHID()
- {
- return AHID;
- }
- uint32 GetAHFID()
- {
- return AHFID;
- }
- void SetMinItems(uint32 value)
- {
- minItems = value;
- }
- uint32 GetMinItems()
- {
+ break;
+ }
+ }
+ AHBConfig()
+ {
+ }
+ uint32 GetAHID()
+ {
+ return AHID;
+ }
+ uint32 GetAHFID()
+ {
+ return AHFID;
+ }
+ void SetMinItems(uint32 value)
+ {
+ minItems = value;
+ }
+ uint32 GetMinItems()
+ {
if ((minItems == 0) && (maxItems))
return maxItems;
else if ((maxItems) && (minItems > maxItems))
return maxItems;
else
return minItems;
- }
- void SetMaxItems(uint32 value)
- {
- maxItems = value;
- CalculatePercents();
- }
- uint32 GetMaxItems()
- {
+ }
+ void SetMaxItems(uint32 value)
+ {
+ maxItems = value;
+ CalculatePercents();
+ }
+ uint32 GetMaxItems()
+ {
return maxItems;
- }
- void SetPercentages(uint32 greytg, uint32 whitetg, uint32 greentg, uint32 bluetg, uint32 purpletg, uint32 orangetg, uint32 yellowtg, uint32 greyi, uint32 whitei, uint32 greeni, uint32 bluei, uint32 purplei, uint32 orangei, uint32 yellowi)
- {
+ }
+ void SetPercentages(uint32 greytg, uint32 whitetg, uint32 greentg, uint32 bluetg, uint32 purpletg, uint32 orangetg, uint32 yellowtg, uint32 greyi, uint32 whitei, uint32 greeni, uint32 bluei, uint32 purplei, uint32 orangei, uint32 yellowi)
+ {
uint32 totalPercent = greytg + whitetg + greentg + bluetg + purpletg + orangetg + yellowtg + greyi + whitei + greeni + bluei + purplei + orangei + yellowi;
if (totalPercent == 0)
{
- maxItems = 0;
+ maxItems = 0;
}
else if (totalPercent != 100)
{
@@ -207,92 +202,92 @@ class AHBConfig
percentOrangeItems = orangei;
percentYellowItems = yellowi;
CalculatePercents();
- }
- uint32 GetPercentages(uint32 color)
- {
- switch(color)
- {
- case AHB_GREY_TG:
+ }
+ uint32 GetPercentages(uint32 color)
+ {
+ switch(color)
+ {
+ case AHB_GREY_TG:
return percentGreyTradeGoods;
- break;
- case AHB_WHITE_TG:
+ break;
+ case AHB_WHITE_TG:
return percentWhiteTradeGoods;
- break;
- case AHB_GREEN_TG:
+ break;
+ case AHB_GREEN_TG:
return percentGreenTradeGoods;
- break;
- case AHB_BLUE_TG:
+ break;
+ case AHB_BLUE_TG:
return percentBlueTradeGoods;
- break;
- case AHB_PURPLE_TG:
+ break;
+ case AHB_PURPLE_TG:
return percentPurpleTradeGoods;
- break;
- case AHB_ORANGE_TG:
+ break;
+ case AHB_ORANGE_TG:
return percentOrangeTradeGoods;
- break;
- case AHB_YELLOW_TG:
+ break;
+ case AHB_YELLOW_TG:
return percentYellowTradeGoods;
- break;
- case AHB_GREY_I:
+ break;
+ case AHB_GREY_I:
return percentGreyItems;
- break;
- case AHB_WHITE_I:
+ break;
+ case AHB_WHITE_I:
return percentWhiteItems;
- break;
- case AHB_GREEN_I:
+ break;
+ case AHB_GREEN_I:
return percentGreenItems;
- break;
- case AHB_BLUE_I:
+ break;
+ case AHB_BLUE_I:
return percentBlueItems;
- break;
- case AHB_PURPLE_I:
+ break;
+ case AHB_PURPLE_I:
return percentPurpleItems;
- break;
- case AHB_ORANGE_I:
+ break;
+ case AHB_ORANGE_I:
return percentOrangeItems;
- break;
- case AHB_YELLOW_I:
+ break;
+ case AHB_YELLOW_I:
return percentYellowItems;
- break;
- default:
+ break;
+ default:
return 0;
- break;
- }
- }
- void SetMinPrice(uint32 color, uint32 value)
- {
- switch(color)
- {
- case AHB_GREY:
+ break;
+ }
+ }
+ void SetMinPrice(uint32 color, uint32 value)
+ {
+ switch(color)
+ {
+ case AHB_GREY:
minPriceGrey = value;
- break;
- case AHB_WHITE:
+ break;
+ case AHB_WHITE:
minPriceWhite = value;
- break;
- case AHB_GREEN:
+ break;
+ case AHB_GREEN:
minPriceGreen = value;
- break;
- case AHB_BLUE:
+ break;
+ case AHB_BLUE:
minPriceBlue = value;
- break;
- case AHB_PURPLE:
+ break;
+ case AHB_PURPLE:
minPricePurple = value;
- break;
- case AHB_ORANGE:
+ break;
+ case AHB_ORANGE:
minPriceOrange = value;
- break;
- case AHB_YELLOW:
+ break;
+ case AHB_YELLOW:
minPriceYellow = value;
- break;
- default:
- break;
- }
- }
- uint32 GetMinPrice(uint32 color)
- {
- switch(color)
- {
- case AHB_GREY:
+ break;
+ default:
+ break;
+ }
+ }
+ uint32 GetMinPrice(uint32 color)
+ {
+ switch(color)
+ {
+ case AHB_GREY:
{
if (minPriceGrey == 0)
return 100;
@@ -302,7 +297,7 @@ class AHBConfig
return minPriceGrey;
break;
}
- case AHB_WHITE:
+ case AHB_WHITE:
{
if (minPriceWhite == 0)
return 150;
@@ -312,7 +307,7 @@ class AHBConfig
return minPriceWhite;
break;
}
- case AHB_GREEN:
+ case AHB_GREEN:
{
if (minPriceGreen == 0)
return 200;
@@ -322,7 +317,7 @@ class AHBConfig
return minPriceGreen;
break;
}
- case AHB_BLUE:
+ case AHB_BLUE:
{
if (minPriceBlue == 0)
return 250;
@@ -332,7 +327,7 @@ class AHBConfig
return minPriceBlue;
break;
}
- case AHB_PURPLE:
+ case AHB_PURPLE:
{
if (minPricePurple == 0)
return 300;
@@ -342,7 +337,7 @@ class AHBConfig
return minPricePurple;
break;
}
- case AHB_ORANGE:
+ case AHB_ORANGE:
{
if (minPriceOrange == 0)
return 400;
@@ -352,7 +347,7 @@ class AHBConfig
return minPriceOrange;
break;
}
- case AHB_YELLOW:
+ case AHB_YELLOW:
{
if (minPriceYellow == 0)
return 500;
@@ -362,47 +357,47 @@ class AHBConfig
return minPriceYellow;
break;
}
- default:
- {
- return 0;
- break;
- }
+ default:
+ {
+ return 0;
+ break;
+ }
}
- }
- void SetMaxPrice(uint32 color, uint32 value)
- {
- switch(color)
- {
- case AHB_GREY:
+ }
+ void SetMaxPrice(uint32 color, uint32 value)
+ {
+ switch(color)
+ {
+ case AHB_GREY:
maxPriceGrey = value;
- break;
- case AHB_WHITE:
+ break;
+ case AHB_WHITE:
maxPriceWhite = value;
- break;
- case AHB_GREEN:
+ break;
+ case AHB_GREEN:
maxPriceGreen = value;
- break;
- case AHB_BLUE:
+ break;
+ case AHB_BLUE:
maxPriceBlue = value;
- break;
- case AHB_PURPLE:
+ break;
+ case AHB_PURPLE:
maxPricePurple = value;
- break;
- case AHB_ORANGE:
+ break;
+ case AHB_ORANGE:
maxPriceOrange = value;
- break;
- case AHB_YELLOW:
+ break;
+ case AHB_YELLOW:
maxPriceYellow = value;
- break;
- default:
- break;
- }
- }
- uint32 GetMaxPrice(uint32 color)
- {
- switch(color)
- {
- case AHB_GREY:
+ break;
+ default:
+ break;
+ }
+ }
+ uint32 GetMaxPrice(uint32 color)
+ {
+ switch(color)
+ {
+ case AHB_GREY:
{
if (maxPriceGrey == 0)
return 150;
@@ -410,7 +405,7 @@ class AHBConfig
return maxPriceGrey;
break;
}
- case AHB_WHITE:
+ case AHB_WHITE:
{
if (maxPriceWhite == 0)
return 250;
@@ -418,7 +413,7 @@ class AHBConfig
return maxPriceWhite;
break;
}
- case AHB_GREEN:
+ case AHB_GREEN:
{
if (maxPriceGreen == 0)
return 300;
@@ -426,7 +421,7 @@ class AHBConfig
return maxPriceGreen;
break;
}
- case AHB_BLUE:
+ case AHB_BLUE:
{
if (maxPriceBlue == 0)
return 350;
@@ -434,7 +429,7 @@ class AHBConfig
return maxPriceBlue;
break;
}
- case AHB_PURPLE:
+ case AHB_PURPLE:
{
if (maxPricePurple == 0)
return 450;
@@ -442,7 +437,7 @@ class AHBConfig
return maxPricePurple;
break;
}
- case AHB_ORANGE:
+ case AHB_ORANGE:
{
if (maxPriceOrange == 0)
return 550;
@@ -450,7 +445,7 @@ class AHBConfig
return maxPriceOrange;
break;
}
- case AHB_YELLOW:
+ case AHB_YELLOW:
{
if (maxPriceYellow == 0)
return 650;
@@ -458,47 +453,47 @@ class AHBConfig
return maxPriceYellow;
break;
}
- default:
- {
- return 0;
- break;
- }
+ default:
+ {
+ return 0;
+ break;
+ }
}
- }
- void SetMinBidPrice(uint32 color, uint32 value)
- {
- switch(color)
- {
- case AHB_GREY:
+ }
+ void SetMinBidPrice(uint32 color, uint32 value)
+ {
+ switch(color)
+ {
+ case AHB_GREY:
minBidPriceGrey = value;
- break;
- case AHB_WHITE:
+ break;
+ case AHB_WHITE:
minBidPriceWhite = value;
- break;
- case AHB_GREEN:
+ break;
+ case AHB_GREEN:
minBidPriceGreen = value;
- break;
- case AHB_BLUE:
+ break;
+ case AHB_BLUE:
minBidPriceBlue = value;
- break;
- case AHB_PURPLE:
+ break;
+ case AHB_PURPLE:
minBidPricePurple = value;
- break;
- case AHB_ORANGE:
+ break;
+ case AHB_ORANGE:
minBidPriceOrange = value;
- break;
- case AHB_YELLOW:
+ break;
+ case AHB_YELLOW:
minBidPriceYellow = value;
- break;
- default:
- break;
- }
- }
- uint32 GetMinBidPrice(uint32 color)
- {
- switch(color)
- {
- case AHB_GREY:
+ break;
+ default:
+ break;
+ }
+ }
+ uint32 GetMinBidPrice(uint32 color)
+ {
+ switch(color)
+ {
+ case AHB_GREY:
{
if (minBidPriceGrey > 100)
return 100;
@@ -506,7 +501,7 @@ class AHBConfig
return minBidPriceGrey;
break;
}
- case AHB_WHITE:
+ case AHB_WHITE:
{
if (minBidPriceWhite > 100)
return 100;
@@ -514,7 +509,7 @@ class AHBConfig
return minBidPriceWhite;
break;
}
- case AHB_GREEN:
+ case AHB_GREEN:
{
if (minBidPriceGreen > 100)
return 100;
@@ -522,7 +517,7 @@ class AHBConfig
return minBidPriceGreen;
break;
}
- case AHB_BLUE:
+ case AHB_BLUE:
{
if (minBidPriceBlue > 100)
return 100;
@@ -530,7 +525,7 @@ class AHBConfig
return minBidPriceBlue;
break;
}
- case AHB_PURPLE:
+ case AHB_PURPLE:
{
if (minBidPricePurple > 100)
return 100;
@@ -538,7 +533,7 @@ class AHBConfig
return minBidPricePurple;
break;
}
- case AHB_ORANGE:
+ case AHB_ORANGE:
{
if (minBidPriceOrange > 100)
return 100;
@@ -546,7 +541,7 @@ class AHBConfig
return minBidPriceOrange;
break;
}
- case AHB_YELLOW:
+ case AHB_YELLOW:
{
if (minBidPriceYellow > 100)
return 100;
@@ -554,47 +549,47 @@ class AHBConfig
return minBidPriceYellow;
break;
}
- default:
- {
- return 0;
- break;
- }
- }
- }
- void SetMaxBidPrice(uint32 color, uint32 value)
- {
- switch(color)
- {
- case AHB_GREY:
+ default:
+ {
+ return 0;
+ break;
+ }
+ }
+ }
+ void SetMaxBidPrice(uint32 color, uint32 value)
+ {
+ switch(color)
+ {
+ case AHB_GREY:
maxBidPriceGrey = value;
- break;
- case AHB_WHITE:
+ break;
+ case AHB_WHITE:
maxBidPriceWhite = value;
- break;
- case AHB_GREEN:
+ break;
+ case AHB_GREEN:
maxBidPriceGreen = value;
- break;
- case AHB_BLUE:
+ break;
+ case AHB_BLUE:
maxBidPriceBlue = value;
- break;
- case AHB_PURPLE:
+ break;
+ case AHB_PURPLE:
maxBidPricePurple = value;
- break;
- case AHB_ORANGE:
+ break;
+ case AHB_ORANGE:
maxBidPriceOrange = value;
- break;
- case AHB_YELLOW:
+ break;
+ case AHB_YELLOW:
maxBidPriceYellow = value;
- break;
- default:
- break;
- }
- }
- uint32 GetMaxBidPrice(uint32 color)
- {
- switch(color)
- {
- case AHB_GREY:
+ break;
+ default:
+ break;
+ }
+ }
+ uint32 GetMaxBidPrice(uint32 color)
+ {
+ switch(color)
+ {
+ case AHB_GREY:
{
if (maxBidPriceGrey > 100)
return 100;
@@ -602,7 +597,7 @@ class AHBConfig
return maxBidPriceGrey;
break;
}
- case AHB_WHITE:
+ case AHB_WHITE:
{
if (maxBidPriceWhite > 100)
return 100;
@@ -610,7 +605,7 @@ class AHBConfig
return maxBidPriceWhite;
break;
}
- case AHB_GREEN:
+ case AHB_GREEN:
{
if (maxBidPriceGreen > 100)
return 100;
@@ -618,7 +613,7 @@ class AHBConfig
return maxBidPriceGreen;
break;
}
- case AHB_BLUE:
+ case AHB_BLUE:
{
if (maxBidPriceBlue > 100)
return 100;
@@ -626,7 +621,7 @@ class AHBConfig
return maxBidPriceBlue;
break;
}
- case AHB_PURPLE:
+ case AHB_PURPLE:
{
if (maxBidPricePurple > 100)
return 100;
@@ -634,7 +629,7 @@ class AHBConfig
return maxBidPricePurple;
break;
}
- case AHB_ORANGE:
+ case AHB_ORANGE:
{
if (maxBidPriceOrange > 100)
return 100;
@@ -642,7 +637,7 @@ class AHBConfig
return maxBidPriceOrange;
break;
}
- case AHB_YELLOW:
+ case AHB_YELLOW:
{
if (maxBidPriceYellow > 100)
return 100;
@@ -650,157 +645,157 @@ class AHBConfig
return maxBidPriceYellow;
break;
}
- default:
- {
- return 0;
- break;
- }
- }
- }
- void SetMaxStack(uint32 color, uint32 value)
- {
- switch(color)
- {
- case AHB_GREY:
+ default:
+ {
+ return 0;
+ break;
+ }
+ }
+ }
+ void SetMaxStack(uint32 color, uint32 value)
+ {
+ switch(color)
+ {
+ case AHB_GREY:
maxStackGrey = value;
- break;
- case AHB_WHITE:
+ break;
+ case AHB_WHITE:
maxStackWhite = value;
- break;
- case AHB_GREEN:
+ break;
+ case AHB_GREEN:
maxStackGreen = value;
- break;
- case AHB_BLUE:
+ break;
+ case AHB_BLUE:
maxStackBlue = value;
- break;
- case AHB_PURPLE:
+ break;
+ case AHB_PURPLE:
maxStackPurple = value;
- break;
- case AHB_ORANGE:
+ break;
+ case AHB_ORANGE:
maxStackOrange = value;
- break;
- case AHB_YELLOW:
+ break;
+ case AHB_YELLOW:
maxStackYellow = value;
- break;
- default:
- break;
- }
- }
- uint32 GetMaxStack(uint32 color)
- {
- switch(color)
- {
- case AHB_GREY:
+ break;
+ default:
+ break;
+ }
+ }
+ uint32 GetMaxStack(uint32 color)
+ {
+ switch(color)
+ {
+ case AHB_GREY:
{
return maxStackGrey;
break;
}
- case AHB_WHITE:
+ case AHB_WHITE:
{
return maxStackWhite;
break;
}
- case AHB_GREEN:
+ case AHB_GREEN:
{
return maxStackGreen;
break;
}
- case AHB_BLUE:
+ case AHB_BLUE:
{
return maxStackBlue;
break;
}
- case AHB_PURPLE:
+ case AHB_PURPLE:
{
return maxStackPurple;
break;
}
- case AHB_ORANGE:
+ case AHB_ORANGE:
{
return maxStackOrange;
break;
}
- case AHB_YELLOW:
+ case AHB_YELLOW:
{
return maxStackYellow;
break;
}
- default:
- {
- return 0;
- break;
- }
- }
- }
- void SetBuyerPrice(uint32 color, uint32 value)
- {
- switch(color)
- {
- case AHB_GREY:
+ default:
+ {
+ return 0;
+ break;
+ }
+ }
+ }
+ void SetBuyerPrice(uint32 color, uint32 value)
+ {
+ switch(color)
+ {
+ case AHB_GREY:
buyerPriceGrey = value;
- break;
- case AHB_WHITE:
+ break;
+ case AHB_WHITE:
buyerPriceWhite = value;
- break;
- case AHB_GREEN:
+ break;
+ case AHB_GREEN:
buyerPriceGreen = value;
- break;
- case AHB_BLUE:
+ break;
+ case AHB_BLUE:
buyerPriceBlue = value;
- break;
- case AHB_PURPLE:
+ break;
+ case AHB_PURPLE:
buyerPricePurple = value;
- break;
- case AHB_ORANGE:
+ break;
+ case AHB_ORANGE:
buyerPriceOrange = value;
- break;
- case AHB_YELLOW:
+ break;
+ case AHB_YELLOW:
buyerPriceYellow = value;
- break;
- default:
- break;
- }
- }
- uint32 GetBuyerPrice(uint32 color)
- {
- switch(color)
- {
- case AHB_GREY:
+ break;
+ default:
+ break;
+ }
+ }
+ uint32 GetBuyerPrice(uint32 color)
+ {
+ switch(color)
+ {
+ case AHB_GREY:
return buyerPriceGrey;
- break;
- case AHB_WHITE:
+ break;
+ case AHB_WHITE:
return buyerPriceWhite;
- break;
- case AHB_GREEN:
+ break;
+ case AHB_GREEN:
return buyerPriceGreen;
- break;
- case AHB_BLUE:
+ break;
+ case AHB_BLUE:
return buyerPriceBlue;
- break;
- case AHB_PURPLE:
+ break;
+ case AHB_PURPLE:
return buyerPricePurple;
- break;
- case AHB_ORANGE:
+ break;
+ case AHB_ORANGE:
return buyerPriceOrange;
- break;
- case AHB_YELLOW:
+ break;
+ case AHB_YELLOW:
return buyerPriceYellow;
- break;
- default:
- return 0;
- break;
- }
- }
- void SetBiddingInterval(uint32 value)
- {
- buyerBiddingInterval = value;
- }
- uint32 GetBiddingInterval()
- {
- return buyerBiddingInterval;
- }
- void CalculatePercents()
- {
+ break;
+ default:
+ return 0;
+ break;
+ }
+ }
+ void SetBiddingInterval(uint32 value)
+ {
+ buyerBiddingInterval = value;
+ }
+ uint32 GetBiddingInterval()
+ {
+ return buyerBiddingInterval;
+ }
+ void CalculatePercents()
+ {
greytgp = (uint32) (((double)percentGreyTradeGoods / 100.0) * maxItems);
whitetgp = (uint32) (((double)percentWhiteTradeGoods / 100.0) * maxItems);
greentgp = (uint32) (((double)percentGreenTradeGoods / 100.0) * maxItems);
@@ -828,72 +823,133 @@ class AHBConfig
{
whiteip += diff;
}
- }
- uint32 GetPercents(uint32 color)
- {
- switch(color)
- {
- case AHB_GREY_TG:
+ }
+ uint32 GetPercents(uint32 color)
+ {
+ switch(color)
+ {
+ case AHB_GREY_TG:
return greytgp;
- break;
- case AHB_WHITE_TG:
+ break;
+ case AHB_WHITE_TG:
return whitetgp;
- break;
- case AHB_GREEN_TG:
+ break;
+ case AHB_GREEN_TG:
return greentgp;
- break;
- case AHB_BLUE_TG:
+ break;
+ case AHB_BLUE_TG:
return bluetgp;
- break;
- case AHB_PURPLE_TG:
+ break;
+ case AHB_PURPLE_TG:
return purpletgp;
- break;
- case AHB_ORANGE_TG:
+ break;
+ case AHB_ORANGE_TG:
return orangetgp;
- break;
- case AHB_YELLOW_TG:
+ break;
+ case AHB_YELLOW_TG:
return yellowtgp;
- break;
- case AHB_GREY_I:
- return greyip;
- break;
- case AHB_WHITE_I:
+ break;
+ case AHB_GREY_I:
+ return greyip;
+ break;
+ case AHB_WHITE_I:
return whiteip;
- break;
- case AHB_GREEN_I:
+ break;
+ case AHB_GREEN_I:
return greenip;
- break;
- case AHB_BLUE_I:
+ break;
+ case AHB_BLUE_I:
return blueip;
- break;
- case AHB_PURPLE_I:
+ break;
+ case AHB_PURPLE_I:
return purpleip;
- break;
- case AHB_ORANGE_I:
+ break;
+ case AHB_ORANGE_I:
return orangeip;
- break;
- case AHB_YELLOW_I:
+ break;
+ case AHB_YELLOW_I:
return yellowip;
- break;
- default:
- return 0;
- break;
- }
- }
- void SetBidsPerInterval(uint32 value)
- {
- buyerBidsPerInterval = value;
- }
- uint32 GetBidsPerInterval()
- {
- return buyerBidsPerInterval;
- }
- ~AHBConfig()
- {
- }
+ break;
+ default:
+ return 0;
+ break;
+ }
+ }
+ void SetBidsPerInterval(uint32 value)
+ {
+ buyerBidsPerInterval = value;
+ }
+ uint32 GetBidsPerInterval()
+ {
+ return buyerBidsPerInterval;
+ }
+ ~AHBConfig()
+ {
+ }
};
-void AuctionHouseBot();
-void AuctionHouseBotInit();
-void AuctionHouseBotLoadValues(AHBConfig*);
-void AuctionHouseBotCommands(uint32, uint32, uint32, char*);
+class AuctionHouseBot
+{
+private:
+ ACE_Vector<uint32> npcItems;
+ ACE_Vector<uint32> lootItems;
+ ACE_Vector<uint32> greyTradeGoodsBin;
+ ACE_Vector<uint32> whiteTradeGoodsBin;
+ ACE_Vector<uint32> greenTradeGoodsBin;
+ ACE_Vector<uint32> blueTradeGoodsBin;
+ ACE_Vector<uint32> purpleTradeGoodsBin;
+ ACE_Vector<uint32> orangeTradeGoodsBin;
+ ACE_Vector<uint32> yellowTradeGoodsBin;
+ ACE_Vector<uint32> greyItemsBin;
+ ACE_Vector<uint32> whiteItemsBin;
+ ACE_Vector<uint32> greenItemsBin;
+ ACE_Vector<uint32> blueItemsBin;
+ ACE_Vector<uint32> purpleItemsBin;
+ ACE_Vector<uint32> orangeItemsBin;
+ ACE_Vector<uint32> yellowItemsBin;
+
+ bool debug_Out;
+
+ bool AHBSeller;
+ bool AHBBuyer;
+ bool BuyMethod;
+ bool SellMethod;
+
+ uint32 AHBplayerAccount;
+ uint32 AHBplayerGUID;
+ uint32 ItemsPerCycle;
+
+ bool Vendor_Items;
+ bool Loot_Items;
+ bool Other_Items;
+
+ bool No_Bind;
+ bool Bind_When_Picked_Up;
+ bool Bind_When_Equipped;
+ bool Bind_When_Use;
+ bool Bind_Quest_Item;
+
+ AHBConfig AllianceConfig;
+ AHBConfig HordeConfig;
+ AHBConfig NeutralConfig;
+
+ time_t _lastrun_a;
+ time_t _lastrun_h;
+ time_t _lastrun_n;
+
+ inline uint32 minValue(uint32 a, uint32 b) { return a <= b ? a : b; };
+ void addNewAuctions(Player *AHBplayer, AHBConfig *config);
+ void addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *config, WorldSession *session);
+
+public:
+ AuctionHouseBot();
+ ~AuctionHouseBot();
+ void Update();
+ void Initialize();
+ void LoadValues(AHBConfig*);
+ void Commands(uint32, uint32, uint32, char*);
+ uint32 GetAHBplayerGUID() { return AHBplayerGUID; };
+};
+
+#define auctionbot Trinity::Singleton<AuctionHouseBot>::Instance()
+
#endif
diff --git a/src/game/AuctionHouseHandler.cpp b/src/game/AuctionHouseHandler.cpp
index d1f399bf570..9962a16bc77 100644
--- a/src/game/AuctionHouseHandler.cpp
+++ b/src/game/AuctionHouseHandler.cpp
@@ -127,7 +127,7 @@ void WorldSession::SendAuctionOutbiddedMail(AuctionEntry *auction, uint32 newPri
msgAuctionOutbiddedSubject << auction->item_template << ":0:" << AUCTION_OUTBIDDED;
if (oldBidder && !_player)
- oldBidder->GetSession()->SendAuctionBidderNotification( auction->GetHouseId(), auction->Id, AHBplayerGUID, newPrice, auction->GetAuctionOutBid(), auction->item_template);
+ oldBidder->GetSession()->SendAuctionBidderNotification( auction->GetHouseId(), auction->Id, auctionbot.GetAHBplayerGUID(), newPrice, auction->GetAuctionOutBid(), auction->item_template);
if (oldBidder && _player)
oldBidder->GetSession()->SendAuctionBidderNotification( auction->GetHouseId(), auction->Id, _player->GetGUID(), newPrice, auction->GetAuctionOutBid(), auction->item_template);
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index 33790d4d3fe..c1b8b56f043 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -108,7 +108,7 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
PSendSysMessage("Syntax is: ahbotoptions ahexpire $ahMapID (2, 6 or 7)");
return false;
}
- AuctionHouseBotCommands(0, ahMapID, NULL, NULL);
+ auctionbot.Commands(0, ahMapID, NULL, NULL);
}
else if (strncmp(opt,"minitems",l) == 0)
{
@@ -118,7 +118,7 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
PSendSysMessage("Syntax is: ahbotoptions minitems $ahMapID (2, 6 or 7) $minItems");
return false;
}
- AuctionHouseBotCommands(1, ahMapID, NULL, param1);
+ auctionbot.Commands(1, ahMapID, NULL, param1);
}
else if (strncmp(opt,"maxitems",l) == 0)
{
@@ -128,7 +128,7 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
PSendSysMessage("Syntax is: ahbotoptions maxitems $ahMapID (2, 6 or 7) $maxItems");
return false;
}
- AuctionHouseBotCommands(2, ahMapID, NULL, param1);
+ auctionbot.Commands(2, ahMapID, NULL, param1);
}
else if (strncmp(opt,"mintime",l) == 0)
{
@@ -141,7 +141,7 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
PSendSysMessage("Syntax is: ahbotoptions mintime $ahMapID (2, 6 or 7) $mintime");
return false;
}
- AuctionHouseBotCommands(3, ahMapID, NULL, param1);
+ auctionbot.Commands(3, ahMapID, NULL, param1);
*/
}
else if (strncmp(opt,"maxtime",l) == 0)
@@ -155,7 +155,7 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
PSendSysMessage("Syntax is: ahbotoptions maxtime $ahMapID (2, 6 or 7) $maxtime");
return false;
}
- AuctionHouseBotCommands(4, ahMapID, NULL, param1);
+ auctionbot.Commands(4, ahMapID, NULL, param1);
*/
}
else if (strncmp(opt,"percentages",l) == 0)
@@ -236,7 +236,7 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
strcat(param, param13);
strcat(param, " ");
strcat(param, param14);
- AuctionHouseBotCommands(5, ahMapID, NULL, param);
+ auctionbot.Commands(5, ahMapID, NULL, param);
}
else if (strncmp(opt,"minprice",l) == 0)
{
@@ -249,31 +249,31 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
}
if (strncmp(param1,"grey",l) == 0)
{
- AuctionHouseBotCommands(6, ahMapID, AHB_GREY, param2);
+ auctionbot.Commands(6, ahMapID, AHB_GREY, param2);
}
else if (strncmp(param1,"white",l) == 0)
{
- AuctionHouseBotCommands(6, ahMapID, AHB_WHITE, param2);
+ auctionbot.Commands(6, ahMapID, AHB_WHITE, param2);
}
else if (strncmp(param1,"green",l) == 0)
{
- AuctionHouseBotCommands(6, ahMapID, AHB_GREEN, param2);
+ auctionbot.Commands(6, ahMapID, AHB_GREEN, param2);
}
else if (strncmp(param1,"blue",l) == 0)
{
- AuctionHouseBotCommands(6, ahMapID, AHB_BLUE, param2);
+ auctionbot.Commands(6, ahMapID, AHB_BLUE, param2);
}
else if (strncmp(param1,"purple",l) == 0)
{
- AuctionHouseBotCommands(6, ahMapID, AHB_PURPLE, param2);
+ auctionbot.Commands(6, ahMapID, AHB_PURPLE, param2);
}
else if (strncmp(param1,"orange",l) == 0)
{
- AuctionHouseBotCommands(6, ahMapID, AHB_ORANGE, param2);
+ auctionbot.Commands(6, ahMapID, AHB_ORANGE, param2);
}
else if (strncmp(param1,"yellow",l) == 0)
{
- AuctionHouseBotCommands(6, ahMapID, AHB_YELLOW, param2);
+ auctionbot.Commands(6, ahMapID, AHB_YELLOW, param2);
}
else
{
@@ -292,31 +292,31 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
}
if (strncmp(param1,"grey",l) == 0)
{
- AuctionHouseBotCommands(7, ahMapID, AHB_GREY, param2);
+ auctionbot.Commands(7, ahMapID, AHB_GREY, param2);
}
else if (strncmp(param1,"white",l) == 0)
{
- AuctionHouseBotCommands(7, ahMapID, AHB_WHITE, param2);
+ auctionbot.Commands(7, ahMapID, AHB_WHITE, param2);
}
else if (strncmp(param1,"green",l) == 0)
{
- AuctionHouseBotCommands(7, ahMapID, AHB_GREEN, param2);
+ auctionbot.Commands(7, ahMapID, AHB_GREEN, param2);
}
else if (strncmp(param1,"blue",l) == 0)
{
- AuctionHouseBotCommands(7, ahMapID, AHB_BLUE, param2);
+ auctionbot.Commands(7, ahMapID, AHB_BLUE, param2);
}
else if (strncmp(param1,"purple",l) == 0)
{
- AuctionHouseBotCommands(7, ahMapID, AHB_PURPLE, param2);
+ auctionbot.Commands(7, ahMapID, AHB_PURPLE, param2);
}
else if (strncmp(param1,"orange",l) == 0)
{
- AuctionHouseBotCommands(7, ahMapID, AHB_ORANGE, param2);
+ auctionbot.Commands(7, ahMapID, AHB_ORANGE, param2);
}
else if (strncmp(param1,"yellow",l) == 0)
{
- AuctionHouseBotCommands(7, ahMapID, AHB_YELLOW, param2);
+ auctionbot.Commands(7, ahMapID, AHB_YELLOW, param2);
}
else
{
@@ -341,31 +341,31 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
}
if (strncmp(param1,"grey",l) == 0)
{
- AuctionHouseBotCommands(8, ahMapID, AHB_GREY, param2);
+ auctionbot.Commands(8, ahMapID, AHB_GREY, param2);
}
else if (strncmp(param1,"white",l) == 0)
{
- AuctionHouseBotCommands(8, ahMapID, AHB_WHITE, param2);
+ auctionbot.Commands(8, ahMapID, AHB_WHITE, param2);
}
else if (strncmp(param1,"green",l) == 0)
{
- AuctionHouseBotCommands(8, ahMapID, AHB_GREEN, param2);
+ auctionbot.Commands(8, ahMapID, AHB_GREEN, param2);
}
else if (strncmp(param1,"blue",l) == 0)
{
- AuctionHouseBotCommands(8, ahMapID, AHB_BLUE, param2);
+ auctionbot.Commands(8, ahMapID, AHB_BLUE, param2);
}
else if (strncmp(param1,"purple",l) == 0)
{
- AuctionHouseBotCommands(8, ahMapID, AHB_PURPLE, param2);
+ auctionbot.Commands(8, ahMapID, AHB_PURPLE, param2);
}
else if (strncmp(param1,"orange",l) == 0)
{
- AuctionHouseBotCommands(8, ahMapID, AHB_ORANGE, param2);
+ auctionbot.Commands(8, ahMapID, AHB_ORANGE, param2);
}
else if (strncmp(param1,"yellow",l) == 0)
{
- AuctionHouseBotCommands(8, ahMapID, AHB_YELLOW, param2);
+ auctionbot.Commands(8, ahMapID, AHB_YELLOW, param2);
}
else
{
@@ -390,31 +390,31 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
}
if (strncmp(param1,"grey",l) == 0)
{
- AuctionHouseBotCommands(9, ahMapID, AHB_GREY, param2);
+ auctionbot.Commands(9, ahMapID, AHB_GREY, param2);
}
else if (strncmp(param1,"white",l) == 0)
{
- AuctionHouseBotCommands(9, ahMapID, AHB_WHITE, param2);
+ auctionbot.Commands(9, ahMapID, AHB_WHITE, param2);
}
else if (strncmp(param1,"green",l) == 0)
{
- AuctionHouseBotCommands(9, ahMapID, AHB_GREEN, param2);
+ auctionbot.Commands(9, ahMapID, AHB_GREEN, param2);
}
else if (strncmp(param1,"blue",l) == 0)
{
- AuctionHouseBotCommands(9, ahMapID, AHB_BLUE, param2);
+ auctionbot.Commands(9, ahMapID, AHB_BLUE, param2);
}
else if (strncmp(param1,"purple",l) == 0)
{
- AuctionHouseBotCommands(9, ahMapID, AHB_PURPLE, param2);
+ auctionbot.Commands(9, ahMapID, AHB_PURPLE, param2);
}
else if (strncmp(param1,"orange",l) == 0)
{
- AuctionHouseBotCommands(9, ahMapID, AHB_ORANGE, param2);
+ auctionbot.Commands(9, ahMapID, AHB_ORANGE, param2);
}
else if (strncmp(param1,"yellow",l) == 0)
{
- AuctionHouseBotCommands(9, ahMapID, AHB_YELLOW, param2);
+ auctionbot.Commands(9, ahMapID, AHB_YELLOW, param2);
}
else
{
@@ -439,31 +439,31 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
}
if (strncmp(param1,"grey",l) == 0)
{
- AuctionHouseBotCommands(10, ahMapID, AHB_GREY, param2);
+ auctionbot.Commands(10, ahMapID, AHB_GREY, param2);
}
else if (strncmp(param1,"white",l) == 0)
{
- AuctionHouseBotCommands(10, ahMapID, AHB_WHITE, param2);
+ auctionbot.Commands(10, ahMapID, AHB_WHITE, param2);
}
else if (strncmp(param1,"green",l) == 0)
{
- AuctionHouseBotCommands(10, ahMapID, AHB_GREEN, param2);
+ auctionbot.Commands(10, ahMapID, AHB_GREEN, param2);
}
else if (strncmp(param1,"blue",l) == 0)
{
- AuctionHouseBotCommands(10, ahMapID, AHB_BLUE, param2);
+ auctionbot.Commands(10, ahMapID, AHB_BLUE, param2);
}
else if (strncmp(param1,"purple",l) == 0)
{
- AuctionHouseBotCommands(10, ahMapID, AHB_PURPLE, param2);
+ auctionbot.Commands(10, ahMapID, AHB_PURPLE, param2);
}
else if (strncmp(param1,"orange",l) == 0)
{
- AuctionHouseBotCommands(10, ahMapID, AHB_ORANGE, param2);
+ auctionbot.Commands(10, ahMapID, AHB_ORANGE, param2);
}
else if (strncmp(param1,"yellow",l) == 0)
{
- AuctionHouseBotCommands(10, ahMapID, AHB_YELLOW, param2);
+ auctionbot.Commands(10, ahMapID, AHB_YELLOW, param2);
}
else
{
@@ -482,31 +482,31 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
}
if (strncmp(param1,"grey",l) == 0)
{
- AuctionHouseBotCommands(11, ahMapID, AHB_GREY, param2);
+ auctionbot.Commands(11, ahMapID, AHB_GREY, param2);
}
else if (strncmp(param1,"white",l) == 0)
{
- AuctionHouseBotCommands(11, ahMapID, AHB_WHITE, param2);
+ auctionbot.Commands(11, ahMapID, AHB_WHITE, param2);
}
else if (strncmp(param1,"green",l) == 0)
{
- AuctionHouseBotCommands(11, ahMapID, AHB_GREEN, param2);
+ auctionbot.Commands(11, ahMapID, AHB_GREEN, param2);
}
else if (strncmp(param1,"blue",l) == 0)
{
- AuctionHouseBotCommands(11, ahMapID, AHB_BLUE, param2);
+ auctionbot.Commands(11, ahMapID, AHB_BLUE, param2);
}
else if (strncmp(param1,"purple",l) == 0)
{
- AuctionHouseBotCommands(11, ahMapID, AHB_PURPLE, param2);
+ auctionbot.Commands(11, ahMapID, AHB_PURPLE, param2);
}
else if (strncmp(param1,"orange",l) == 0)
{
- AuctionHouseBotCommands(11, ahMapID, AHB_ORANGE, param2);
+ auctionbot.Commands(11, ahMapID, AHB_ORANGE, param2);
}
else if (strncmp(param1,"yellow",l) == 0)
{
- AuctionHouseBotCommands(11, ahMapID, AHB_YELLOW, param2);
+ auctionbot.Commands(11, ahMapID, AHB_YELLOW, param2);
}
else
{
@@ -522,7 +522,7 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
PSendSysMessage("Syntax is: ahbotoptions bidinterval $ahMapID (2, 6 or 7) $interval(in minutes)");
return false;
}
- AuctionHouseBotCommands(12, ahMapID, NULL, param1);
+ auctionbot.Commands(12, ahMapID, NULL, param1);
}
else if (strncmp(opt,"bidsperinterval",l) == 0)
{
@@ -532,7 +532,7 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args)
PSendSysMessage("Syntax is: ahbotoptions bidsperinterval $ahMapID (2, 6 or 7) $bids");
return false;
}
- AuctionHouseBotCommands(13, ahMapID, NULL, param1);
+ auctionbot.Commands(13, ahMapID, NULL, param1);
}
else
{
diff --git a/src/game/Mail.cpp b/src/game/Mail.cpp
index 9a71c87cd23..94f40f0079e 100644
--- a/src/game/Mail.cpp
+++ b/src/game/Mail.cpp
@@ -390,7 +390,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data )
}
}
- if (m->sender == AHBplayerGUID)
+ if (m->sender == auctionbot.GetAHBplayerGUID())
{
SendReturnToSender(MAIL_CREATURE, GetAccountId(), m->receiver, m->sender, m->subject, m->itemTextId, &mi, m->money, m->mailTemplateId);
}
@@ -836,7 +836,7 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket & /*recv_data*/ )
void WorldSession::SendMailTo(Player* receiver, uint8 messageType, uint8 stationery, uint32 sender_guidlow_or_entry, uint32 receiver_guidlow, std::string subject, uint32 itemTextId, MailItemsInfo* mi, uint32 money, uint32 COD, uint32 checked, uint32 deliver_delay, uint16 mailTemplateId)
{
- if (receiver_guidlow == AHBplayerGUID)
+ if (receiver_guidlow == auctionbot.GetAHBplayerGUID())
{
if(messageType == MAIL_AUCTION && mi) // auction mail with items
{
diff --git a/src/game/World.cpp b/src/game/World.cpp
index 47f18362ce3..4669590392c 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -1587,7 +1587,7 @@ void World::SetInitialWorldSettings()
poolhandler.Initialize();
sLog.outString("Initialize AuctionHouseBot...");
- AuctionHouseBotInit();
+ auctionbot.Initialize();
// possibly enable db logging; avoid massive startup spam by doing it here.
if (sLog.GetLogDBLater())
@@ -1713,7 +1713,7 @@ void World::Update(uint32 diff)
/// <ul><li> Handle auctions when the timer has passed
if (m_timers[WUPDATE_AUCTIONS].Passed())
{
- AuctionHouseBot();
+ auctionbot.Update();
m_timers[WUPDATE_AUCTIONS].Reset();
///- Update mails (return old mails with item, or delete them)