forked from AyaseCore/mod-ahbot
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
No changes, just the script classes being organized in their own sour…
…ce and header files
- Loading branch information
1 parent
6296e2e
commit 62bb00f
Showing
10 changed files
with
240 additions
and
164 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#include "AuctionHouseBot.h" | ||
#include "AuctionHouseBotAuctionHouseScript.h" | ||
|
||
AHBot_AuctionHouseScript::AHBot_AuctionHouseScript() : AuctionHouseScript("AHBot_AuctionHouseScript") | ||
{ | ||
|
||
} | ||
|
||
void AHBot_AuctionHouseScript::OnBeforeAuctionHouseMgrSendAuctionSuccessfulMail( | ||
AuctionHouseMgr*, /*auctionHouseMgr*/ | ||
AuctionEntry*, /*auction*/ | ||
Player* owner, | ||
uint32&, /*owner_accId*/ | ||
uint32&, /*profit*/ | ||
bool& sendNotification, | ||
bool& updateAchievementCriteria, | ||
bool& /*sendMail*/) | ||
{ | ||
if (owner && owner->GetGUID().GetCounter() == auctionbot->GetAHBplayerGUID()) | ||
{ | ||
sendNotification = false; | ||
updateAchievementCriteria = false; | ||
} | ||
} | ||
|
||
void AHBot_AuctionHouseScript::OnBeforeAuctionHouseMgrSendAuctionExpiredMail( | ||
AuctionHouseMgr*, /* auctionHouseMgr */ | ||
AuctionEntry*, /* auction */ | ||
Player* owner, | ||
uint32&, /* owner_accId */ | ||
bool& sendNotification, | ||
bool& /* sendMail */) | ||
{ | ||
if (owner && owner->GetGUID().GetCounter() == auctionbot->GetAHBplayerGUID()) | ||
{ | ||
sendNotification = false; | ||
} | ||
} | ||
|
||
void AHBot_AuctionHouseScript::OnBeforeAuctionHouseMgrSendAuctionOutbiddedMail( | ||
AuctionHouseMgr*, /* auctionHouseMgr */ | ||
AuctionEntry* auction, | ||
Player* oldBidder, | ||
uint32&, /* oldBidder_accId */ | ||
Player* newBidder, | ||
uint32& newPrice, | ||
bool&, /* sendNotification */ | ||
bool& /* sendMail */) | ||
{ | ||
if (oldBidder && !newBidder) | ||
{ | ||
oldBidder->GetSession()->SendAuctionBidderNotification( | ||
auction->GetHouseId(), | ||
auction->Id, | ||
ObjectGuid::Create<HighGuid::Player>(auctionbot->GetAHBplayerGUID()), | ||
newPrice, | ||
auction->GetAuctionOutBid(), | ||
auction->item_template); | ||
} | ||
} | ||
|
||
void AHBot_AuctionHouseScript::OnAuctionAdd(AuctionHouseObject* /*ah*/, AuctionEntry* auction) | ||
{ | ||
// | ||
// Keeps updated the amount of items in the auction | ||
// | ||
|
||
auctionbot->IncrementItemCounts(auction); | ||
} | ||
|
||
void AHBot_AuctionHouseScript::OnAuctionRemove(AuctionHouseObject* /*ah*/, AuctionEntry* auction) | ||
{ | ||
// | ||
// Keeps updated the amount of items in the auction | ||
// | ||
|
||
auctionbot->DecrementItemCounts(auction); | ||
} | ||
|
||
void AHBot_AuctionHouseScript::OnBeforeAuctionHouseMgrUpdate() | ||
{ | ||
auctionbot->Update(); | ||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 | ||
*/ | ||
|
||
#ifndef AUCTION_HOUSE_BOT_AUCTION_HOUSE_SCRIPT_H | ||
#define AUCTION_HOUSE_BOT_AUCTION_HOUSE_SCRIPT_H | ||
|
||
#include "Player.h" | ||
#include "ScriptMgr.h" | ||
|
||
// ============================================================================= | ||
// Interaction with the auction house core mechanisms | ||
// ============================================================================= | ||
|
||
class AHBot_AuctionHouseScript : public AuctionHouseScript | ||
{ | ||
public: | ||
AHBot_AuctionHouseScript(); | ||
|
||
void OnBeforeAuctionHouseMgrSendAuctionSuccessfulMail(AuctionHouseMgr* auctionHouseMgr, AuctionEntry* auction, Player* owner, uint32& owner_accId, uint32& profit, bool& sendNotification, bool& updateAchievementCriteria, bool& sendMail) override; | ||
void OnBeforeAuctionHouseMgrSendAuctionExpiredMail (AuctionHouseMgr* auctionHouseMgr, AuctionEntry* auction, Player* owner, uint32& owner_accId, bool& sendNotification, bool& sendMail) override; | ||
void OnBeforeAuctionHouseMgrSendAuctionOutbiddedMail (AuctionHouseMgr* auctionHouseMgr, AuctionEntry* auction, Player* oldBidder, uint32& oldBidder_accId, Player* newBidder, uint32& newPrice, bool& sendNotification, bool& sendMail) override; | ||
|
||
void OnAuctionAdd (AuctionHouseObject* ah, AuctionEntry* auction) override; | ||
void OnAuctionRemove(AuctionHouseObject* ah, AuctionEntry* auction) override; | ||
|
||
void OnBeforeAuctionHouseMgrUpdate() override; | ||
}; | ||
|
||
#endif /* AUCTION_HOUSE_BOT_AUCTION_HOUSE_SCRIPT_H */ |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include "AuctionHouseBot.h" | ||
#include "AuctionHouseBotMailScript.h" | ||
|
||
AHBot_MailScript::AHBot_MailScript() : MailScript("AHBot_MailScript") | ||
{ | ||
|
||
} | ||
|
||
void AHBot_MailScript::OnBeforeMailDraftSendMailTo( | ||
MailDraft*, /* mailDraft */ | ||
MailReceiver const& receiver, | ||
MailSender const& sender, | ||
MailCheckMask&, /* checked */ | ||
uint32&, /* deliver_delay */ | ||
uint32&, /* custom_expiration */ | ||
bool& deleteMailItemsFromDB, | ||
bool& sendMail) | ||
{ | ||
// | ||
// If the mail is for the bot, then remove it and delete the items bought | ||
// | ||
|
||
if (receiver.GetPlayerGUIDLow() == auctionbot->GetAHBplayerGUID()) | ||
{ | ||
if (sender.GetMailMessageType() == MAIL_AUCTION) | ||
{ | ||
deleteMailItemsFromDB = true; | ||
} | ||
|
||
sendMail = false; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 | ||
*/ | ||
|
||
#ifndef AUCTION_HOUSE_BOT_MAIL_SCRIPT_H | ||
#define AUCTION_HOUSE_BOT_MAIL_SCRIPT_H | ||
|
||
#include "ScriptMgr.h" | ||
#include "Mail.h" | ||
|
||
// ============================================================================= | ||
// Interaction with the mailing systems | ||
// ============================================================================= | ||
|
||
class AHBot_MailScript : public MailScript | ||
{ | ||
public: | ||
AHBot_MailScript(); | ||
|
||
void OnBeforeMailDraftSendMailTo(MailDraft* mailDraft, MailReceiver const& receiver, MailSender const& sender, MailCheckMask& checked, uint32& deliver_delay, uint32& custom_expiration, bool& deleteMailItemsFromDB, bool& sendMail) override; | ||
}; | ||
|
||
#endif /* AUCTION_HOUSE_BOT_MAIL_SCRIPT_H */ |
Oops, something went wrong.