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:
Chaz Brown
2009-08-06 03:00:45 -04:00
parent 11b6ae7924
commit b9eb4ddf2e
9 changed files with 1365 additions and 1163 deletions

View File

@@ -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
{