AHBot rewrite, pulled from TC2-3.0.9 repo, in no particular order.
*Any file named README.Something (including the original README) will be copied to the build directory when compiled with VS *Converted AuctionHouseBot to class structure, implemented Singleton for class *Moved global variables inside of AuctionHouseBot class, *Minor code cleanups, reformated headers, fixed switch logic errors *Parts of this code are from Naicisum's Mangos version. *Prevent endless looping condition where Item Quality has no percentage *Fix situation where items in the AH would be less than the maxitems setting *Move AHBot item filters to initialization so the items that are not allowed only get evaluated once. *Change the way Bid prices are calculated, along with Maximius' uint64 fix, prices should look a lot better now. *Includes a fix for grey items from MrSmite --HG-- branch : trunk
This commit is contained in:
+772
-618
File diff suppressed because it is too large
Load Diff
+530
-474
File diff suppressed because it is too large
Load Diff
@@ -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);
|
||||
|
||||
+50
-50
@@ -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
|
||||
{
|
||||
|
||||
+2
-2
@@ -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
|
||||
{
|
||||
|
||||
+2
-2
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user