mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 19:35:42 +00:00
feat(Core/Hook): A few new hooks (#2671)
This commit is contained in:
@@ -62,6 +62,7 @@ template class ScriptRegistry<BGScript>;
|
||||
template class ScriptRegistry<SpellSC>;
|
||||
template class ScriptRegistry<AccountScript>;
|
||||
template class ScriptRegistry<GameEventScript>;
|
||||
template class ScriptRegistry<MailScript>;
|
||||
|
||||
#include "ScriptMgrMacros.h"
|
||||
|
||||
@@ -125,6 +126,7 @@ void ScriptMgr::Unload()
|
||||
SCR_CLEAR(BGScript);
|
||||
SCR_CLEAR(SpellSC);
|
||||
SCR_CLEAR(GameEventScript);
|
||||
SCR_CLEAR(MailScript);
|
||||
|
||||
#undef SCR_CLEAR
|
||||
}
|
||||
@@ -1128,6 +1130,41 @@ void ScriptMgr::OnAuctionExpire(AuctionHouseObject* ah, AuctionEntry* entry)
|
||||
FOREACH_SCRIPT(AuctionHouseScript)->OnAuctionExpire(ah, entry);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnBeforeAuctionHouseMgrSendAuctionWonMail(AuctionHouseMgr* auctionHouseMgr, AuctionEntry* auction, Player* bidder, uint32& bidder_accId, bool& sendNotification, bool& updateAchievementCriteria, bool& sendMail)
|
||||
{
|
||||
FOREACH_SCRIPT(AuctionHouseScript)->OnBeforeAuctionHouseMgrSendAuctionWonMail(auctionHouseMgr, auction, bidder, bidder_accId, sendNotification, updateAchievementCriteria, sendMail);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnBeforeAuctionHouseMgrSendAuctionSalePendingMail(AuctionHouseMgr* auctionHouseMgr, AuctionEntry* auction, Player* owner, uint32& owner_accId, bool& sendMail)
|
||||
{
|
||||
FOREACH_SCRIPT(AuctionHouseScript)->OnBeforeAuctionHouseMgrSendAuctionSalePendingMail(auctionHouseMgr, auction, owner, owner_accId, sendMail);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnBeforeAuctionHouseMgrSendAuctionSuccessfulMail(AuctionHouseMgr* auctionHouseMgr, AuctionEntry* auction, Player* owner, uint32& owner_accId, uint32& profit, bool& sendNotification, bool& updateAchievementCriteria, bool& sendMail)
|
||||
{
|
||||
FOREACH_SCRIPT(AuctionHouseScript)->OnBeforeAuctionHouseMgrSendAuctionSuccessfulMail(auctionHouseMgr, auction, owner, owner_accId, profit, sendNotification, updateAchievementCriteria, sendMail);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnBeforeAuctionHouseMgrSendAuctionExpiredMail(AuctionHouseMgr* auctionHouseMgr, AuctionEntry* auction, Player* owner, uint32& owner_accId, bool& sendNotification, bool& sendMail)
|
||||
{
|
||||
FOREACH_SCRIPT(AuctionHouseScript)->OnBeforeAuctionHouseMgrSendAuctionExpiredMail(auctionHouseMgr, auction, owner, owner_accId, sendNotification, sendMail);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnBeforeAuctionHouseMgrSendAuctionOutbiddedMail(AuctionHouseMgr* auctionHouseMgr, AuctionEntry* auction, Player* oldBidder, uint32& oldBidder_accId, Player* newBidder, uint32& newPrice, bool& sendNotification, bool& sendMail)
|
||||
{
|
||||
FOREACH_SCRIPT(AuctionHouseScript)->OnBeforeAuctionHouseMgrSendAuctionOutbiddedMail(auctionHouseMgr, auction, oldBidder, oldBidder_accId, newBidder, newPrice, sendNotification, sendMail);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnBeforeAuctionHouseMgrSendAuctionCancelledToBidderMail(AuctionHouseMgr* auctionHouseMgr, AuctionEntry* auction, Player* bidder, uint32& bidder_accId, bool& sendMail)
|
||||
{
|
||||
FOREACH_SCRIPT(AuctionHouseScript)->OnBeforeAuctionHouseMgrSendAuctionCancelledToBidderMail(auctionHouseMgr, auction, bidder, bidder_accId, sendMail);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnBeforeAuctionHouseMgrUpdate()
|
||||
{
|
||||
FOREACH_SCRIPT(AuctionHouseScript)->OnBeforeAuctionHouseMgrUpdate();
|
||||
}
|
||||
|
||||
bool ScriptMgr::OnConditionCheck(Condition* condition, ConditionSourceInfo& sourceInfo)
|
||||
{
|
||||
ASSERT(condition);
|
||||
@@ -2081,6 +2118,12 @@ void ScriptMgr::OnGameEventStop(uint16 EventID)
|
||||
FOREACH_SCRIPT(GameEventScript)->OnStop(EventID);
|
||||
}
|
||||
|
||||
// Mail
|
||||
void ScriptMgr::OnBeforeMailDraftSendMailTo(MailDraft* mailDraft, MailReceiver const& receiver, MailSender const& sender, MailCheckMask& checked, uint32& deliver_delay, uint32& custom_expiration, bool& deleteMailItemsFromDB, bool& sendMail)
|
||||
{
|
||||
FOREACH_SCRIPT(MailScript)->OnBeforeMailDraftSendMailTo(mailDraft, receiver, sender, checked, deliver_delay, custom_expiration, deleteMailItemsFromDB, sendMail);
|
||||
}
|
||||
|
||||
AllMapScript::AllMapScript(const char* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
@@ -2286,3 +2329,9 @@ GameEventScript::GameEventScript(const char* name)
|
||||
ScriptRegistry<GameEventScript>::AddScript(this);
|
||||
}
|
||||
|
||||
MailScript::MailScript(const char* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<MailScript>::AddScript(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "ArenaTeam.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "PetDefines.h"
|
||||
#include "AuctionHouseMgr.h"
|
||||
#include <atomic>
|
||||
|
||||
class AuctionHouseObject;
|
||||
@@ -69,7 +70,6 @@ struct GroupQueueInfo;
|
||||
/*
|
||||
TODO: Add more script type classes.
|
||||
|
||||
MailScript
|
||||
SessionScript
|
||||
CollisionScript
|
||||
ArenaTeamScript
|
||||
@@ -679,6 +679,27 @@ class AuctionHouseScript : public ScriptObject
|
||||
|
||||
// Called when an auction expires.
|
||||
virtual void OnAuctionExpire(AuctionHouseObject* /*ah*/, AuctionEntry* /*entry*/) { }
|
||||
|
||||
// Called before sending the mail concerning a won auction
|
||||
virtual void OnBeforeAuctionHouseMgrSendAuctionWonMail(AuctionHouseMgr* /*auctionHouseMgr*/, AuctionEntry* /*auction*/, Player* /*bidder*/, uint32& /*bidder_accId*/, bool& /*sendNotification*/, bool& /*updateAchievementCriteria*/, bool& /*sendMail*/) { }
|
||||
|
||||
// Called before sending the mail concerning a pending sale
|
||||
virtual void OnBeforeAuctionHouseMgrSendAuctionSalePendingMail(AuctionHouseMgr* /*auctionHouseMgr*/, AuctionEntry* /*auction*/, Player* /*owner*/, uint32& /*owner_accId*/, bool& /*sendMail*/) { }
|
||||
|
||||
// Called before sending the mail concerning a successful auction
|
||||
virtual void OnBeforeAuctionHouseMgrSendAuctionSuccessfulMail(AuctionHouseMgr* /*auctionHouseMgr*/, AuctionEntry* /*auction*/, Player* /*owner*/, uint32& /*owner_accId*/, uint32& /*profit*/, bool& /*sendNotification*/, bool& /*updateAchievementCriteria*/, bool& /*sendMail*/) { }
|
||||
|
||||
// Called before sending the mail concerning an expired auction
|
||||
virtual void OnBeforeAuctionHouseMgrSendAuctionExpiredMail(AuctionHouseMgr* /*auctionHouseMgr*/, AuctionEntry* /*auction*/, Player* /*owner*/, uint32& /*owner_accId*/, bool& /*sendNotification*/, bool& /*sendMail*/) { }
|
||||
|
||||
// Called before sending the mail concerning an outbidded auction
|
||||
virtual void OnBeforeAuctionHouseMgrSendAuctionOutbiddedMail(AuctionHouseMgr* /*auctionHouseMgr*/, AuctionEntry* /*auction*/, Player* /*oldBidder*/, uint32& /*oldBidder_accId*/, Player* /*newBidder*/, uint32& /*newPrice*/, bool& /*sendNotification*/, bool& /*sendMail*/) { }
|
||||
|
||||
// Called before sending the mail concerning an cancelled auction
|
||||
virtual void OnBeforeAuctionHouseMgrSendAuctionCancelledToBidderMail(AuctionHouseMgr* /*auctionHouseMgr*/, AuctionEntry* /*auction*/, Player* /*bidder*/, uint32& /*bidder_accId*/, bool& /*sendMail*/) { }
|
||||
|
||||
// Called before updating the auctions
|
||||
virtual void OnBeforeAuctionHouseMgrUpdate() { }
|
||||
};
|
||||
|
||||
class ConditionScript : public ScriptObject
|
||||
@@ -1185,6 +1206,18 @@ public:
|
||||
virtual void OnStop(uint16 /*EventID*/) { }
|
||||
};
|
||||
|
||||
class MailScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
|
||||
MailScript(const char* name);
|
||||
|
||||
public:
|
||||
|
||||
// Called before mail is sent
|
||||
virtual void OnBeforeMailDraftSendMailTo(MailDraft* /*mailDraft*/, MailReceiver const& /*receiver*/, MailSender const& /*sender*/, MailCheckMask& /*checked*/, uint32& /*deliver_delay*/, uint32& /*custom_expiration*/, bool& /*deleteMailItemsFromDB*/, bool& /*sendMail*/) { }
|
||||
};
|
||||
|
||||
// Manages registration, loading, and execution of scripts.
|
||||
class ScriptMgr
|
||||
{
|
||||
@@ -1330,6 +1363,13 @@ class ScriptMgr
|
||||
void OnAuctionRemove(AuctionHouseObject* ah, AuctionEntry* entry);
|
||||
void OnAuctionSuccessful(AuctionHouseObject* ah, AuctionEntry* entry);
|
||||
void OnAuctionExpire(AuctionHouseObject* ah, AuctionEntry* entry);
|
||||
void OnBeforeAuctionHouseMgrSendAuctionWonMail(AuctionHouseMgr* auctionHouseMgr, AuctionEntry* auction, Player* bidder, uint32& bidder_accId, bool& sendNotification, bool& updateAchievementCriteria, bool& sendMail);
|
||||
void OnBeforeAuctionHouseMgrSendAuctionSalePendingMail(AuctionHouseMgr* auctionHouseMgr, AuctionEntry* auction, Player* owner, uint32& owner_accId, bool& sendMail);
|
||||
void OnBeforeAuctionHouseMgrSendAuctionSuccessfulMail(AuctionHouseMgr* auctionHouseMgr, AuctionEntry* auction, Player* owner, uint32& owner_accId, uint32& profit, bool& sendNotification, bool& updateAchievementCriteria, bool& sendMail);
|
||||
void OnBeforeAuctionHouseMgrSendAuctionExpiredMail(AuctionHouseMgr* auctionHouseMgr, AuctionEntry* auction, Player* owner, uint32& owner_accId, bool& sendNotification, bool& sendMail);
|
||||
void OnBeforeAuctionHouseMgrSendAuctionOutbiddedMail(AuctionHouseMgr* auctionHouseMgr, AuctionEntry* auction, Player* oldBidder, uint32& oldBidder_accId, Player* newBidder, uint32& newPrice, bool& sendNotification, bool& sendMail);
|
||||
void OnBeforeAuctionHouseMgrSendAuctionCancelledToBidderMail(AuctionHouseMgr* auctionHouseMgr, AuctionEntry* auction, Player* bidder, uint32& bidder_accId, bool& sendMail);
|
||||
void OnBeforeAuctionHouseMgrUpdate();
|
||||
|
||||
public: /* ConditionScript */
|
||||
|
||||
@@ -1536,6 +1576,10 @@ class ScriptMgr
|
||||
void OnGameEventStart(uint16 EventID);
|
||||
void OnGameEventStop(uint16 EventID);
|
||||
|
||||
public: /* MailScript */
|
||||
|
||||
void OnBeforeMailDraftSendMailTo(MailDraft* mailDraft, MailReceiver const& receiver, MailSender const& sender, MailCheckMask& checked, uint32& deliver_delay, uint32& custom_expiration, bool& deleteMailItemsFromDB, bool& sendMail);
|
||||
|
||||
private:
|
||||
|
||||
uint32 _scriptCount;
|
||||
|
||||
Reference in New Issue
Block a user