Created
February 21, 2010 16:48
-
-
Save SkirnirMaNGOS/310405 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/game/AuctionHouseHandler.cpp b/src/game/AuctionHouseHandler.cpp | |
index 9f29a99..9700af3 100644 | |
--- a/src/game/AuctionHouseHandler.cpp | |
+++ b/src/game/AuctionHouseHandler.cpp | |
@@ -27,6 +27,7 @@ | |
#include "UpdateMask.h" | |
#include "AuctionHouseMgr.h" | |
#include "Util.h" | |
+#include "AuctionHouseBot.h" | |
//please DO NOT use iterator++, because it is slower than ++iterator!!! | |
//post-incrementation is always slower than pre-incrementation ! | |
@@ -120,7 +121,10 @@ void WorldSession::SendAuctionOutbiddedMail(AuctionEntry *auction, uint32 newPri | |
std::ostringstream msgAuctionOutbiddedSubject; | |
msgAuctionOutbiddedSubject << auction->item_template << ":0:" << AUCTION_OUTBIDDED; | |
- if (oldBidder) | |
+ if (oldBidder && !_player) | |
+ 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); | |
MailDraft(msgAuctionOutbiddedSubject.str()) | |
@@ -250,7 +254,10 @@ void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data ) | |
AuctionEntry *AH = new AuctionEntry; | |
AH->Id = sObjectMgr.GenerateAuctionID(); | |
- AH->auctioneer = GUID_LOPART(auctioneer); | |
+ if(sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) | |
+ AH->auctioneer = 23442; | |
+ else | |
+ AH->auctioneer = GUID_LOPART(auctioneer); | |
AH->item_guidlow = GUID_LOPART(item); | |
AH->item_template = it->GetEntry(); | |
AH->owner = pl->GetGUIDLow(); | |
@@ -262,7 +269,7 @@ void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data ) | |
AH->deposit = deposit; | |
AH->auctionHouseEntry = auctionHouseEntry; | |
- sLog.outDetail("selling item %u to auctioneer %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", GUID_LOPART(item), GUID_LOPART(auctioneer), bid, buyout, auction_time, AH->GetHouseId()); | |
+ sLog.outDetail("selling item %u to auctioneer %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", GUID_LOPART(item), AH->auctioneer, bid, buyout, auction_time, AH->GetHouseId()); | |
auctionHouse->AddAuction(AH); | |
sAuctionMgr.AddAItem(it); | |
diff --git a/src/game/AuctionHouseMgr.cpp b/src/game/AuctionHouseMgr.cpp | |
index 115dece..b504cfc 100644 | |
--- a/src/game/AuctionHouseMgr.cpp | |
+++ b/src/game/AuctionHouseMgr.cpp | |
@@ -463,12 +463,12 @@ void AuctionHouseMgr::Update() | |
AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(uint32 factionTemplateId) | |
{ | |
- uint32 houseid = 1; // dwarf auction house (used for normal cut/etc percents) | |
+ uint32 houseid = 7; // goblin auction house | |
if(!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) | |
{ | |
//FIXME: found way for proper auctionhouse selection by another way | |
- // AuctionHo use.dbc have faction field with _player_ factions associated with auction house races. | |
+ // AuctionHouse.dbc have faction field with _player_ factions associated with auction house races. | |
// but no easy way convert creature faction to player race faction for specific city | |
switch(factionTemplateId) | |
{ | |
diff --git a/src/game/AuctionHouseMgr.h b/src/game/AuctionHouseMgr.h | |
index 0d1b040..bdccd78 100644 | |
--- a/src/game/AuctionHouseMgr.h | |
+++ b/src/game/AuctionHouseMgr.h | |
@@ -84,6 +84,9 @@ class AuctionHouseObject | |
uint32 Getcount() { return AuctionsMap.size(); } | |
+ AuctionEntryMap::iterator GetAuctionsBegin() {return AuctionsMap.begin();} | |
+ AuctionEntryMap::iterator GetAuctionsEnd() {return AuctionsMap.end();} | |
+ | |
void AddAuction(AuctionEntry *ah) | |
{ | |
ASSERT( ah ); | |
diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp | |
index c739828..727e3cc 100644 | |
--- a/src/game/Chat.cpp | |
+++ b/src/game/Chat.cpp | |
@@ -666,6 +666,7 @@ ChatCommand * ChatHandler::getCommandTable() | |
{ "cometome", SEC_ADMINISTRATOR, false, &ChatHandler::HandleComeToMeCommand, "", NULL }, | |
{ "damage", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDamageCommand, "", NULL }, | |
{ "combatstop", SEC_GAMEMASTER, false, &ChatHandler::HandleCombatStopCommand, "", NULL }, | |
+ { "ahbotoptions", SEC_ADMINISTRATOR, true, &ChatHandler::HandleAHBotOptionsCommand, "", NULL }, | |
{ "flusharenapoints",SEC_ADMINISTRATOR, false, &ChatHandler::HandleFlushArenaPointsCommand, "", NULL }, | |
{ "repairitems", SEC_GAMEMASTER, true, &ChatHandler::HandleRepairitemsCommand, "", NULL }, | |
{ "waterwalk", SEC_GAMEMASTER, false, &ChatHandler::HandleWaterwalkCommand, "", NULL }, | |
diff --git a/src/game/Chat.h b/src/game/Chat.h | |
index e2adf0d..ae8bc98 100644 | |
--- a/src/game/Chat.h | |
+++ b/src/game/Chat.h | |
@@ -104,6 +104,7 @@ class ChatHandler | |
bool HandleAccountSetAddonCommand(const char* args); | |
bool HandleAccountSetGmLevelCommand(const char* args); | |
bool HandleAccountSetPasswordCommand(const char* args); | |
+ bool HandleAHBotOptionsCommand(const char* args); | |
bool HandleBanAccountCommand(const char* args); | |
bool HandleBanCharacterCommand(const char* args); | |
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp | |
index f319cf0..b6c16bb 100644 | |
--- a/src/game/Level3.cpp | |
+++ b/src/game/Level3.cpp | |
@@ -51,6 +51,477 @@ | |
#include "InstanceData.h" | |
#include "CreatureEventAIMgr.h" | |
#include "DBCEnums.h" | |
+#include "AuctionHouseBot.h" | |
+ | |
+bool ChatHandler::HandleAHBotOptionsCommand(const char* args) | |
+{ | |
+ uint32 ahMapID = 0; | |
+ char * opt = strtok((char*)args, " "); | |
+ char * ahMapIdStr = strtok(NULL, " "); | |
+ if (ahMapIdStr) | |
+ { | |
+ ahMapID = (uint32) strtoul(ahMapIdStr, NULL, 0); | |
+ } | |
+ if (!opt) | |
+ { | |
+ PSendSysMessage("Syntax is: ahbotoptions $option $ahMapID (2, 6 or 7) $parameter"); | |
+ PSendSysMessage("Try ahbotoptions help to see a list of options."); | |
+ return false; | |
+ } | |
+ int l = strlen(opt); | |
+ | |
+ if (strncmp(opt,"help",l) == 0) | |
+ { | |
+ PSendSysMessage("AHBot commands:"); | |
+ PSendSysMessage("ahexpire"); | |
+ PSendSysMessage("minitems"); | |
+ PSendSysMessage("maxitems"); | |
+ PSendSysMessage("mintime"); | |
+ PSendSysMessage("maxtime"); | |
+ PSendSysMessage("percentages"); | |
+ PSendSysMessage("minprice"); | |
+ PSendSysMessage("maxprice"); | |
+ PSendSysMessage("minbidprice"); | |
+ PSendSysMessage("maxbidprice"); | |
+ PSendSysMessage("maxstack"); | |
+ PSendSysMessage("buyerprice"); | |
+ PSendSysMessage("bidinterval"); | |
+ PSendSysMessage("bidsperinterval"); | |
+ return true; | |
+ } | |
+ else if (strncmp(opt,"ahexpire",l) == 0) | |
+ { | |
+ if (!ahMapIdStr) | |
+ { | |
+ PSendSysMessage("Syntax is: ahbotoptions ahexpire $ahMapID (2, 6 or 7)"); | |
+ return false; | |
+ } | |
+ auctionbot.Commands(0, ahMapID, NULL, NULL); | |
+ } | |
+ else if (strncmp(opt,"minitems",l) == 0) | |
+ { | |
+ char * param1 = strtok(NULL, " "); | |
+ if ((!ahMapIdStr) || (!param1)) | |
+ { | |
+ PSendSysMessage("Syntax is: ahbotoptions minitems $ahMapID (2, 6 or 7) $minItems"); | |
+ return false; | |
+ } | |
+ auctionbot.Commands(1, ahMapID, NULL, param1); | |
+ } | |
+ else if (strncmp(opt,"maxitems",l) == 0) | |
+ { | |
+ char * param1 = strtok(NULL, " "); | |
+ if ((!ahMapIdStr) || (!param1)) | |
+ { | |
+ PSendSysMessage("Syntax is: ahbotoptions maxitems $ahMapID (2, 6 or 7) $maxItems"); | |
+ return false; | |
+ } | |
+ auctionbot.Commands(2, ahMapID, NULL, param1); | |
+ } | |
+ else if (strncmp(opt,"mintime",l) == 0) | |
+ { | |
+ char * param1 = strtok(NULL, " "); | |
+ if ((!ahMapIdStr) || (!param1)) | |
+ { | |
+ PSendSysMessage("Syntax is: ahbotoptions mintime $ahMapID (2, 6 or 7) $mintime"); | |
+ return false; | |
+ } | |
+ auctionbot.Commands(3, ahMapID, NULL, param1); | |
+ } | |
+ else if (strncmp(opt,"maxtime",l) == 0) | |
+ { | |
+ char * param1 = strtok(NULL, " "); | |
+ if ((!ahMapIdStr) || (!param1)) | |
+ { | |
+ PSendSysMessage("Syntax is: ahbotoptions maxtime $ahMapID (2, 6 or 7) $maxtime"); | |
+ return false; | |
+ } | |
+ auctionbot.Commands(4, ahMapID, NULL, param1); | |
+ } | |
+ else if (strncmp(opt,"percentages",l) == 0) | |
+ { | |
+ char * param1 = strtok(NULL, " "); | |
+ char * param2 = strtok(NULL, " "); | |
+ char * param3 = strtok(NULL, " "); | |
+ char * param4 = strtok(NULL, " "); | |
+ char * param5 = strtok(NULL, " "); | |
+ char * param6 = strtok(NULL, " "); | |
+ char * param7 = strtok(NULL, " "); | |
+ char * param8 = strtok(NULL, " "); | |
+ char * param9 = strtok(NULL, " "); | |
+ char * param10 = strtok(NULL, " "); | |
+ char * param11 = strtok(NULL, " "); | |
+ char * param12 = strtok(NULL, " "); | |
+ char * param13 = strtok(NULL, " "); | |
+ char * param14 = strtok(NULL, " "); | |
+ if ((!ahMapIdStr) || (!param14)) | |
+ { | |
+ PSendSysMessage("Syntax is: ahbotoptions percentages $ahMapID (2, 6 or 7) $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14"); | |
+ PSendSysMessage("1 GreyTradeGoods 2 WhiteTradeGoods 3 GreenTradeGoods 4 BlueTradeGoods 5 PurpleTradeGoods"); | |
+ PSendSysMessage("6 OrangeTradeGoods 7 YellowTradeGoods 8 GreyItems 9 WhiteItems 10 GreenItems 11 BlueItems"); | |
+ PSendSysMessage("12 PurpleItems 13 OrangeItems 14 YellowItems"); | |
+ PSendSysMessage("The total must add up to 100%"); | |
+ return false; | |
+ } | |
+ uint32 greytg = (uint32) strtoul(param1, NULL, 0); | |
+ uint32 whitetg = (uint32) strtoul(param2, NULL, 0); | |
+ uint32 greentg = (uint32) strtoul(param3, NULL, 0); | |
+ uint32 bluetg = (uint32) strtoul(param3, NULL, 0); | |
+ uint32 purpletg = (uint32) strtoul(param5, NULL, 0); | |
+ uint32 orangetg = (uint32) strtoul(param6, NULL, 0); | |
+ uint32 yellowtg = (uint32) strtoul(param7, NULL, 0); | |
+ uint32 greyi = (uint32) strtoul(param8, NULL, 0); | |
+ uint32 whitei = (uint32) strtoul(param9, NULL, 0); | |
+ uint32 greeni = (uint32) strtoul(param10, NULL, 0); | |
+ uint32 bluei = (uint32) strtoul(param11, NULL, 0); | |
+ uint32 purplei = (uint32) strtoul(param12, NULL, 0); | |
+ uint32 orangei = (uint32) strtoul(param13, NULL, 0); | |
+ uint32 yellowi = (uint32) strtoul(param14, NULL, 0); | |
+ uint32 totalPercent = greytg + whitetg + greentg + bluetg + purpletg + orangetg + yellowtg + greyi + whitei + greeni + bluei + purplei + orangei + yellowi; | |
+ if ((totalPercent == 0) || (totalPercent != 100)) | |
+ { | |
+ PSendSysMessage("Syntax is: ahbotoptions percentages $ahMapID (2, 6 or 7) $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14"); | |
+ PSendSysMessage("1 GreyTradeGoods 2 WhiteTradeGoods 3 GreenTradeGoods 4 BlueTradeGoods 5 PurpleTradeGoods"); | |
+ PSendSysMessage("6 OrangeTradeGoods 7 YellowTradeGoods 8 GreyItems 9 WhiteItems 10 GreenItems 11 BlueItems"); | |
+ PSendSysMessage("12 PurpleItems 13 OrangeItems 14 YellowItems"); | |
+ PSendSysMessage("The total must add up to 100%"); | |
+ return false; | |
+ } | |
+ char param[100]; | |
+ param[0] = '\0'; | |
+ strcat(param, param1); | |
+ strcat(param, " "); | |
+ strcat(param, param2); | |
+ strcat(param, " "); | |
+ strcat(param, param3); | |
+ strcat(param, " "); | |
+ strcat(param, param4); | |
+ strcat(param, " "); | |
+ strcat(param, param5); | |
+ strcat(param, " "); | |
+ strcat(param, param6); | |
+ strcat(param, " "); | |
+ strcat(param, param7); | |
+ strcat(param, " "); | |
+ strcat(param, param8); | |
+ strcat(param, " "); | |
+ strcat(param, param9); | |
+ strcat(param, " "); | |
+ strcat(param, param10); | |
+ strcat(param, " "); | |
+ strcat(param, param11); | |
+ strcat(param, " "); | |
+ strcat(param, param12); | |
+ strcat(param, " "); | |
+ strcat(param, param13); | |
+ strcat(param, " "); | |
+ strcat(param, param14); | |
+ auctionbot.Commands(5, ahMapID, NULL, param); | |
+ } | |
+ else if (strncmp(opt,"minprice",l) == 0) | |
+ { | |
+ char * param1 = strtok(NULL, " "); | |
+ char * param2 = strtok(NULL, " "); | |
+ if ((!ahMapIdStr) || (!param1) || (!param2)) | |
+ { | |
+ PSendSysMessage("Syntax is: ahbotoptions minprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $price"); | |
+ return false; | |
+ } | |
+ if (strncmp(param1,"grey",l) == 0) | |
+ { | |
+ auctionbot.Commands(6, ahMapID, AHB_GREY, param2); | |
+ } | |
+ else if (strncmp(param1,"white",l) == 0) | |
+ { | |
+ auctionbot.Commands(6, ahMapID, AHB_WHITE, param2); | |
+ } | |
+ else if (strncmp(param1,"green",l) == 0) | |
+ { | |
+ auctionbot.Commands(6, ahMapID, AHB_GREEN, param2); | |
+ } | |
+ else if (strncmp(param1,"blue",l) == 0) | |
+ { | |
+ auctionbot.Commands(6, ahMapID, AHB_BLUE, param2); | |
+ } | |
+ else if (strncmp(param1,"purple",l) == 0) | |
+ { | |
+ auctionbot.Commands(6, ahMapID, AHB_PURPLE, param2); | |
+ } | |
+ else if (strncmp(param1,"orange",l) == 0) | |
+ { | |
+ auctionbot.Commands(6, ahMapID, AHB_ORANGE, param2); | |
+ } | |
+ else if (strncmp(param1,"yellow",l) == 0) | |
+ { | |
+ auctionbot.Commands(6, ahMapID, AHB_YELLOW, param2); | |
+ } | |
+ else | |
+ { | |
+ PSendSysMessage("Syntax is: ahbotoptions minprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $price"); | |
+ return false; | |
+ } | |
+ } | |
+ else if (strncmp(opt,"maxprice",l) == 0) | |
+ { | |
+ char * param1 = strtok(NULL, " "); | |
+ char * param2 = strtok(NULL, " "); | |
+ if ((!ahMapIdStr) || (!param1) || (!param2)) | |
+ { | |
+ PSendSysMessage("Syntax is: ahbotoptions maxprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $price"); | |
+ return false; | |
+ } | |
+ if (strncmp(param1,"grey",l) == 0) | |
+ { | |
+ auctionbot.Commands(7, ahMapID, AHB_GREY, param2); | |
+ } | |
+ else if (strncmp(param1,"white",l) == 0) | |
+ { | |
+ auctionbot.Commands(7, ahMapID, AHB_WHITE, param2); | |
+ } | |
+ else if (strncmp(param1,"green",l) == 0) | |
+ { | |
+ auctionbot.Commands(7, ahMapID, AHB_GREEN, param2); | |
+ } | |
+ else if (strncmp(param1,"blue",l) == 0) | |
+ { | |
+ auctionbot.Commands(7, ahMapID, AHB_BLUE, param2); | |
+ } | |
+ else if (strncmp(param1,"purple",l) == 0) | |
+ { | |
+ auctionbot.Commands(7, ahMapID, AHB_PURPLE, param2); | |
+ } | |
+ else if (strncmp(param1,"orange",l) == 0) | |
+ { | |
+ auctionbot.Commands(7, ahMapID, AHB_ORANGE, param2); | |
+ } | |
+ else if (strncmp(param1,"yellow",l) == 0) | |
+ { | |
+ auctionbot.Commands(7, ahMapID, AHB_YELLOW, param2); | |
+ } | |
+ else | |
+ { | |
+ PSendSysMessage("Syntax is: ahbotoptions maxprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $price"); | |
+ return false; | |
+ } | |
+ } | |
+ else if (strncmp(opt,"minbidprice",l) == 0) | |
+ { | |
+ char * param1 = strtok(NULL, " "); | |
+ char * param2 = strtok(NULL, " "); | |
+ if ((!ahMapIdStr) || (!param1) || (!param2)) | |
+ { | |
+ PSendSysMessage("Syntax is: ahbotoptions minbidprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $price"); | |
+ return false; | |
+ } | |
+ uint32 minBidPrice = (uint32) strtoul(param2, NULL, 0); | |
+ if ((minBidPrice < 1) || (minBidPrice > 100)) | |
+ { | |
+ PSendSysMessage("The min bid price multiplier must be between 1 and 100"); | |
+ return false; | |
+ } | |
+ if (strncmp(param1,"grey",l) == 0) | |
+ { | |
+ auctionbot.Commands(8, ahMapID, AHB_GREY, param2); | |
+ } | |
+ else if (strncmp(param1,"white",l) == 0) | |
+ { | |
+ auctionbot.Commands(8, ahMapID, AHB_WHITE, param2); | |
+ } | |
+ else if (strncmp(param1,"green",l) == 0) | |
+ { | |
+ auctionbot.Commands(8, ahMapID, AHB_GREEN, param2); | |
+ } | |
+ else if (strncmp(param1,"blue",l) == 0) | |
+ { | |
+ auctionbot.Commands(8, ahMapID, AHB_BLUE, param2); | |
+ } | |
+ else if (strncmp(param1,"purple",l) == 0) | |
+ { | |
+ auctionbot.Commands(8, ahMapID, AHB_PURPLE, param2); | |
+ } | |
+ else if (strncmp(param1,"orange",l) == 0) | |
+ { | |
+ auctionbot.Commands(8, ahMapID, AHB_ORANGE, param2); | |
+ } | |
+ else if (strncmp(param1,"yellow",l) == 0) | |
+ { | |
+ auctionbot.Commands(8, ahMapID, AHB_YELLOW, param2); | |
+ } | |
+ else | |
+ { | |
+ PSendSysMessage("Syntax is: ahbotoptions minbidprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $price"); | |
+ return false; | |
+ } | |
+ } | |
+ else if (strncmp(opt,"maxbidprice",l) == 0) | |
+ { | |
+ char * param1 = strtok(NULL, " "); | |
+ char * param2 = strtok(NULL, " "); | |
+ if ((!ahMapIdStr) || (!param1) || (!param2)) | |
+ { | |
+ PSendSysMessage("Syntax is: ahbotoptions maxbidprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $price"); | |
+ return false; | |
+ } | |
+ uint32 maxBidPrice = (uint32) strtoul(param2, NULL, 0); | |
+ if ((maxBidPrice < 1) || (maxBidPrice > 100)) | |
+ { | |
+ PSendSysMessage("The max bid price multiplier must be between 1 and 100"); | |
+ return false; | |
+ } | |
+ if (strncmp(param1,"grey",l) == 0) | |
+ { | |
+ auctionbot.Commands(9, ahMapID, AHB_GREY, param2); | |
+ } | |
+ else if (strncmp(param1,"white",l) == 0) | |
+ { | |
+ auctionbot.Commands(9, ahMapID, AHB_WHITE, param2); | |
+ } | |
+ else if (strncmp(param1,"green",l) == 0) | |
+ { | |
+ auctionbot.Commands(9, ahMapID, AHB_GREEN, param2); | |
+ } | |
+ else if (strncmp(param1,"blue",l) == 0) | |
+ { | |
+ auctionbot.Commands(9, ahMapID, AHB_BLUE, param2); | |
+ } | |
+ else if (strncmp(param1,"purple",l) == 0) | |
+ { | |
+ auctionbot.Commands(9, ahMapID, AHB_PURPLE, param2); | |
+ } | |
+ else if (strncmp(param1,"orange",l) == 0) | |
+ { | |
+ auctionbot.Commands(9, ahMapID, AHB_ORANGE, param2); | |
+ } | |
+ else if (strncmp(param1,"yellow",l) == 0) | |
+ { | |
+ auctionbot.Commands(9, ahMapID, AHB_YELLOW, param2); | |
+ } | |
+ else | |
+ { | |
+ PSendSysMessage("Syntax is: ahbotoptions max bidprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $price"); | |
+ return false; | |
+ } | |
+ } | |
+ else if (strncmp(opt,"maxstack",l) == 0) | |
+ { | |
+ char * param1 = strtok(NULL, " "); | |
+ char * param2 = strtok(NULL, " "); | |
+ if ((!ahMapIdStr) || (!param1) || (!param2)) | |
+ { | |
+ PSendSysMessage("Syntax is: ahbotoptions maxstack $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $value"); | |
+ return false; | |
+ } | |
+ uint32 maxStack = (uint32) strtoul(param2, NULL, 0); | |
+ if (maxStack < 0) | |
+ { | |
+ PSendSysMessage("maxstack can't be a negative number."); | |
+ return false; | |
+ } | |
+ if (strncmp(param1,"grey",l) == 0) | |
+ { | |
+ auctionbot.Commands(10, ahMapID, AHB_GREY, param2); | |
+ } | |
+ else if (strncmp(param1,"white",l) == 0) | |
+ { | |
+ auctionbot.Commands(10, ahMapID, AHB_WHITE, param2); | |
+ } | |
+ else if (strncmp(param1,"green",l) == 0) | |
+ { | |
+ auctionbot.Commands(10, ahMapID, AHB_GREEN, param2); | |
+ } | |
+ else if (strncmp(param1,"blue",l) == 0) | |
+ { | |
+ auctionbot.Commands(10, ahMapID, AHB_BLUE, param2); | |
+ } | |
+ else if (strncmp(param1,"purple",l) == 0) | |
+ { | |
+ auctionbot.Commands(10, ahMapID, AHB_PURPLE, param2); | |
+ } | |
+ else if (strncmp(param1,"orange",l) == 0) | |
+ { | |
+ auctionbot.Commands(10, ahMapID, AHB_ORANGE, param2); | |
+ } | |
+ else if (strncmp(param1,"yellow",l) == 0) | |
+ { | |
+ auctionbot.Commands(10, ahMapID, AHB_YELLOW, param2); | |
+ } | |
+ else | |
+ { | |
+ PSendSysMessage("Syntax is: ahbotoptions maxstack $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $value"); | |
+ return false; | |
+ } | |
+ } | |
+ else if (strncmp(opt,"buyerprice",l) == 0) | |
+ { | |
+ char * param1 = strtok(NULL, " "); | |
+ char * param2 = strtok(NULL, " "); | |
+ if ((!ahMapIdStr) || (!param1) || (!param2)) | |
+ { | |
+ PSendSysMessage("Syntax is: ahbotoptions buyerprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue or purple) $price"); | |
+ return false; | |
+ } | |
+ if (strncmp(param1,"grey",l) == 0) | |
+ { | |
+ auctionbot.Commands(11, ahMapID, AHB_GREY, param2); | |
+ } | |
+ else if (strncmp(param1,"white",l) == 0) | |
+ { | |
+ auctionbot.Commands(11, ahMapID, AHB_WHITE, param2); | |
+ } | |
+ else if (strncmp(param1,"green",l) == 0) | |
+ { | |
+ auctionbot.Commands(11, ahMapID, AHB_GREEN, param2); | |
+ } | |
+ else if (strncmp(param1,"blue",l) == 0) | |
+ { | |
+ auctionbot.Commands(11, ahMapID, AHB_BLUE, param2); | |
+ } | |
+ else if (strncmp(param1,"purple",l) == 0) | |
+ { | |
+ auctionbot.Commands(11, ahMapID, AHB_PURPLE, param2); | |
+ } | |
+ else if (strncmp(param1,"orange",l) == 0) | |
+ { | |
+ auctionbot.Commands(11, ahMapID, AHB_ORANGE, param2); | |
+ } | |
+ else if (strncmp(param1,"yellow",l) == 0) | |
+ { | |
+ auctionbot.Commands(11, ahMapID, AHB_YELLOW, param2); | |
+ } | |
+ else | |
+ { | |
+ PSendSysMessage("Syntax is: ahbotoptions buyerprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue or purple) $price"); | |
+ return false; | |
+ } | |
+ } | |
+ else if (strncmp(opt,"bidinterval",l) == 0) | |
+ { | |
+ char * param1 = strtok(NULL, " "); | |
+ if ((!ahMapIdStr) || (!param1)) | |
+ { | |
+ PSendSysMessage("Syntax is: ahbotoptions bidinterval $ahMapID (2, 6 or 7) $interval(in minutes)"); | |
+ return false; | |
+ } | |
+ auctionbot.Commands(12, ahMapID, NULL, param1); | |
+ } | |
+ else if (strncmp(opt,"bidsperinterval",l) == 0) | |
+ { | |
+ char * param1 = strtok(NULL, " "); | |
+ if ((!ahMapIdStr) || (!param1)) | |
+ { | |
+ PSendSysMessage("Syntax is: ahbotoptions bidsperinterval $ahMapID (2, 6 or 7) $bids"); | |
+ return false; | |
+ } | |
+ auctionbot.Commands(13, ahMapID, NULL, param1); | |
+ } | |
+ else | |
+ { | |
+ PSendSysMessage("Syntax is: ahbotoptions $option $ahMapID (2, 6 or 7) $parameter"); | |
+ PSendSysMessage("Try ahbotoptions help to see a list of options."); | |
+ return false; | |
+ } | |
+ return true; | |
+} | |
//reload commands | |
bool ChatHandler::HandleReloadAllCommand(const char*) | |
diff --git a/src/game/Mail.cpp b/src/game/Mail.cpp | |
index 0509240..2a4a0f6 100644 | |
--- a/src/game/Mail.cpp | |
+++ b/src/game/Mail.cpp | |
@@ -28,6 +28,7 @@ | |
#include "UpdateMask.h" | |
#include "Unit.h" | |
#include "Language.h" | |
+#include "AuctionHouseBot.h" | |
#include "DBCStores.h" | |
#include "BattleGroundMgr.h" | |
#include "Item.h" | |
@@ -901,13 +902,29 @@ void MailDraft::SendReturnToSender(uint32 sender_acc, uint32 sender_guid, uint32 | |
uint32 deliver_delay = needItemDelay ? sWorld.getConfig(CONFIG_MAIL_DELIVERY_DELAY) : 0; | |
// will delete item or place to receiver mail list | |
- SendMailTo(MailReceiver(receiver,receiver_guid), MailSender(MAIL_NORMAL, sender_guid), MAIL_CHECK_MASK_RETURNED, deliver_delay); | |
+ if (sender_guid == auctionbot.GetAHBplayerGUID()) | |
+ { | |
+ SendMailTo(MailReceiver(receiver,receiver_guid), MailSender(MAIL_CREATURE, sender_guid), MAIL_CHECK_MASK_RETURNED, deliver_delay); | |
+ } | |
+ else | |
+ { | |
+ SendMailTo(MailReceiver(receiver,receiver_guid), MailSender(MAIL_NORMAL, sender_guid), MAIL_CHECK_MASK_RETURNED, deliver_delay); | |
+ } | |
} | |
void MailDraft::SendMailTo(MailReceiver const& receiver, MailSender const& sender, MailCheckMask checked, uint32 deliver_delay) | |
{ | |
Player* pReceiver = receiver.GetPlayer(); // can be NULL | |
+ if (receiver.GetPlayerGUIDLow() == auctionbot.GetAHBplayerGUID()) | |
+ { | |
+ if (sender.GetMailMessageType() == MAIL_AUCTION && !m_items.empty()) | |
+ { | |
+ deleteIncludedItems(true); | |
+ } | |
+ return; | |
+ } | |
+ | |
if (pReceiver) | |
prepareItems(pReceiver); // generate mail template items | |
diff --git a/src/game/Makefile.am b/src/game/Makefile.am | |
index fec8160..dbab486 100644 | |
--- a/src/game/Makefile.am | |
+++ b/src/game/Makefile.am | |
@@ -37,6 +37,8 @@ libmangosgame_a_SOURCES = \ | |
ArenaTeam.cpp \ | |
ArenaTeam.h \ | |
ArenaTeamHandler.cpp \ | |
+ AuctionHouseBot.cpp \ | |
+ AuctionHouseBot.h \ | |
AuctionHouseHandler.cpp \ | |
AuctionHouseMgr.cpp \ | |
AuctionHouseMgr.h \ | |
diff --git a/src/game/Player.cpp b/src/game/Player.cpp | |
index 8cfe60a..42a2dff 100644 | |
--- a/src/game/Player.cpp | |
+++ b/src/game/Player.cpp | |
@@ -14386,6 +14386,61 @@ void Player::SendQuestUpdateAddCreatureOrGo( Quest const* pQuest, uint64 guid, u | |
/*** LOAD SYSTEM ***/ | |
/*********************************************************/ | |
+bool Player::MinimalLoadFromDB( QueryResult *result, uint32 guid ) | |
+{ | |
+ bool delete_result = true; | |
+ if (!result) | |
+ { | |
+ // 0 1 2 3 4 5 6 7 8 9 10 11 | |
+ result = CharacterDatabase.PQuery("SELECT guid, data, name, position_x, position_y, position_z, map, totaltime, leveltime, at_login, zone, level FROM characters WHERE guid = '%u'",guid); | |
+ if (!result) | |
+ return false; | |
+ } | |
+ else | |
+ delete_result = false; | |
+ | |
+ Field *fields = result->Fetch(); | |
+ | |
+ if (!LoadValues( fields[1].GetString())) | |
+ { | |
+ sLog.outError("Player #%d have broken data in `data` field. Can't be loaded for character list.",GUID_LOPART(guid)); | |
+ if (delete_result) | |
+ delete result; | |
+ return false; | |
+ } | |
+ | |
+ // overwrite possible wrong/corrupted guid | |
+ SetUInt64Value(OBJECT_FIELD_GUID, MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER)); | |
+ | |
+ m_name = fields[2].GetCppString(); | |
+ | |
+ Relocate(fields[3].GetFloat(),fields[4].GetFloat(),fields[5].GetFloat()); | |
+ SetLocationMapId(fields[6].GetUInt32()); | |
+ | |
+ // the instance id is not needed at character enum | |
+ | |
+ m_Played_time[PLAYED_TIME_TOTAL] = fields[7].GetUInt32(); | |
+ m_Played_time[PLAYED_TIME_LEVEL] = fields[8].GetUInt32(); | |
+ | |
+ m_atLoginFlags = fields[9].GetUInt32(); | |
+ | |
+ // I don't see these used anywhere .. | |
+ /*_LoadGroup(); | |
+ | |
+ _LoadBoundInstances();*/ | |
+ | |
+ if (delete_result) | |
+ delete result; | |
+ | |
+ for (int i = 0; i < PLAYER_SLOTS_COUNT; ++i) | |
+ m_items[i] = NULL; | |
+ | |
+ if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) | |
+ m_deathState = DEAD; | |
+ | |
+ return true; | |
+} | |
+ | |
void Player::_LoadDeclinedNames(QueryResult* result) | |
{ | |
if(!result) | |
diff --git a/src/game/Player.h b/src/game/Player.h | |
index 398ff21..7bb59a5 100644 | |
--- a/src/game/Player.h | |
+++ b/src/game/Player.h | |
@@ -1380,6 +1380,7 @@ class MANGOS_DLL_SPEC Player : public Unit | |
bool LoadFromDB(uint32 guid, SqlQueryHolder *holder); | |
+ bool MinimalLoadFromDB(QueryResult *result, uint32 guid); | |
static bool LoadValuesArrayFromDB(Tokens& data,uint64 guid); | |
static uint32 GetUInt32ValueFromArray(Tokens const& data, uint16 index); | |
static float GetFloatValueFromArray(Tokens const& data, uint16 index); | |
diff --git a/src/game/World.cpp b/src/game/World.cpp | |
index a9e6f4b..99ecaf4 100644 | |
--- a/src/game/World.cpp | |
+++ b/src/game/World.cpp | |
@@ -61,6 +61,7 @@ | |
#include "WaypointManager.h" | |
#include "GMTicketMgr.h" | |
#include "Util.h" | |
+#include "AuctionHouseBot.h" | |
INSTANTIATE_SINGLETON_1( World ); | |
@@ -1523,6 +1524,9 @@ void World::SetInitialWorldSettings() | |
uint32 nextGameEvent = sGameEventMgr.Initialize(); | |
m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent); //depend on next event | |
+ sLog.outString("Initialize AuctionHouseBot..."); | |
+ auctionbot.Initialize(); | |
+ | |
sLog.outString( "WORLD: World initialized" ); | |
uint32 uStartInterval = getMSTimeDiff(uStartTime, getMSTime()); | |
@@ -1595,6 +1599,7 @@ void World::Update(uint32 diff) | |
/// <ul><li> Handle auctions when the timer has passed | |
if (m_timers[WUPDATE_AUCTIONS].Passed()) | |
{ | |
+ auctionbot.Update(); | |
m_timers[WUPDATE_AUCTIONS].Reset(); | |
///- Update mails (return old mails with item, or delete them) | |
diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in | |
index 479a6ce..6a94b6f 100644 | |
--- a/src/mangosd/mangosd.conf.dist.in | |
+++ b/src/mangosd/mangosd.conf.dist.in | |
@@ -1342,6 +1342,79 @@ Network.OutUBuff = 65536 | |
Network.TcpNodelay = 1 | |
################################################################################################################### | |
+# AUCTION HOUSE BOT SETTINGS | |
+# | |
+# AuctionHouseBot.EnableSeller | |
+# Enable/Disable the part of AHBot that puts items up for auction | |
+# Default 0 (disabled) | |
+# | |
+# AuctionHouseBot.EnableBuyer | |
+# Enable/Disable the part of AHBot that buys items from players | |
+# Default 0 (disabled) | |
+# | |
+# Auction House Bot character data | |
+# AuctionHouseBot.Account is the account number (in realmd->account table) of the player you want to run as the auction bot. | |
+# AuctionHouseBot.GUID is the GUID (in characters->characters table) of the player you want to run as the auction bot. | |
+# Default: 0 (Auction House Bot disabled) | |
+# | |
+# AuctionHouseBot.VendorItems | |
+# Include items that can be bought from vendors. | |
+# Default 0 | |
+# | |
+# AuctionHouseBot.LootItems | |
+# Include items that can be looted or fished for. | |
+# Default 1 | |
+# | |
+# AuctionHouseBot.OtherItems | |
+# Include misc. items. | |
+# Default 0 | |
+# | |
+# AuctionHouseBot.Bonding_types | |
+# Indicates which bonding types to allow seller to put up for auction | |
+# No_Bind | |
+# Default 1 | |
+# Bind_When_Picked_Up | |
+# Default 0 | |
+# Bind_When_Equipped | |
+# Default 1 | |
+# Bind_When_Use | |
+# Default 1 | |
+# Bind_Quest_Item | |
+# Default 0 | |
+# | |
+# AuctionHouseBot.ItemsPerCycle | |
+# Number of Items to Add/Remove from the AH during mass operations | |
+# Default 200 | |
+# | |
+# AuctionHouseBot.UseBuyPriceForSeller | |
+# Should the Seller use BuyPrice or SellPrice to determine Bid Prices | |
+# Default 0 (use SellPrice) | |
+# | |
+# AuctionHouseBot.UseBuyPriceForBuyer | |
+# Should the Buyer use BuyPrice or SellPrice to determine Bid Prices | |
+# Default 0 (use SellPrice) | |
+# | |
+# All other settings have been moved to sql | |
+# | |
+################################################################################################################### | |
+ | |
+AuctionHouseBot.EnableSeller = 0 | |
+AuctionHouseBot.EnableBuyer = 0 | |
+AuctionHouseBot.Account = 0 | |
+AuctionHouseBot.GUID = 0 | |
+AuctionHouseBot.VendorItems = 0 | |
+AuctionHouseBot.LootItems = 1 | |
+AuctionHouseBot.OtherItems = 0 | |
+AuctionHouseBot.No_Bind = 1 | |
+AuctionHouseBot.Bind_When_Picked_Up = 0 | |
+AuctionHouseBot.Bind_When_Equipped = 1 | |
+AuctionHouseBot.Bind_When_Use = 1 | |
+AuctionHouseBot.Bind_Quest_Item = 0 | |
+AuctionHouseBot.ItemsPerCycle = 200 | |
+AuctionHouseBot.UseBuyPriceForSeller = 0 | |
+AuctionHouseBot.UseBuyPriceForBuyer = 0 | |
+ | |
+################################################################################################################### | |
# CONSOLE AND REMOTE ACCESS | |
# | |
# Console.Enable | |
diff --git a/win/VC100/game.vcxproj b/win/VC100/game.vcxproj | |
index 5654e3d..d39f917 100644 | |
--- a/win/VC100/game.vcxproj | |
+++ b/win/VC100/game.vcxproj | |
@@ -349,6 +349,7 @@ | |
<ClCompile Include="..\..\src\game\AggressorAI.cpp" /> | |
<ClCompile Include="..\..\src\game\ArenaTeam.cpp" /> | |
<ClCompile Include="..\..\src\game\ArenaTeamHandler.cpp" /> | |
+ <ClCompile Include="..\..\src\game\AuctionHouseBot.cpp" /> | |
<ClCompile Include="..\..\src\game\AuctionHouseHandler.cpp" /> | |
<ClCompile Include="..\..\src\game\AuctionHouseMgr.cpp" /> | |
<ClCompile Include="..\..\src\game\Bag.cpp" /> | |
@@ -497,6 +498,7 @@ | |
<ClInclude Include="..\..\src\game\AchievementMgr.h" /> | |
<ClInclude Include="..\..\src\game\AggressorAI.h" /> | |
<ClInclude Include="..\..\src\game\ArenaTeam.h" /> | |
+ <ClInclude Include="..\..\src\game\AuctionHouseBot.h" /> | |
<ClInclude Include="..\..\src\game\AuctionHouseMgr.h" /> | |
<ClInclude Include="..\..\src\game\Bag.h" /> | |
<ClInclude Include="..\..\src\game\BattleGround.h" /> | |
diff --git a/win/VC80/game.vcproj b/win/VC80/game.vcproj | |
index acc7915..786b44b 100644 | |
--- a/win/VC80/game.vcproj | |
+++ b/win/VC80/game.vcproj | |
@@ -1034,6 +1034,18 @@ | |
> | |
</File> | |
<File | |
+ RelativePath="..\..\src\game\AuctionHouseBot.cpp" | |
+ > | |
+ </File> | |
+ <File | |
+ RelativePath="..\..\src\game\AuctionHouseBot.h" | |
+ > | |
+ </File> | |
+ <File | |
+ RelativePath="..\..\src\game\AuctionHouseMgr.cpp" | |
+ > | |
+ </File> | |
+ <File | |
RelativePath="..\..\src\game\FleeingMovementGenerator.cpp" | |
> | |
</File> | |
diff --git a/win/VC90/game.vcproj b/win/VC90/game.vcproj | |
index 10be7d1..15eaa1c 100644 | |
--- a/win/VC90/game.vcproj | |
+++ b/win/VC90/game.vcproj | |
@@ -1035,6 +1035,18 @@ | |
> | |
</File> | |
<File | |
+ RelativePath="..\..\src\game\AuctionHouseBot.cpp" | |
+ > | |
+ </File> | |
+ <File | |
+ RelativePath="..\..\src\game\AuctionHouseBot.h" | |
+ > | |
+ </File> | |
+ <File | |
+ RelativePath="..\..\src\game\AuctionHouseMgr.cpp" | |
+ > | |
+ </File> | |
+ <File | |
RelativePath="..\..\src\game\FleeingMovementGenerator.cpp" | |
> | |
</File> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment