feat: Add CanPlaceAuctionBid hook (#15154)
* feat: Add CanPlaceAuctionBid hook * Codestyle fix
This commit is contained in:
@@ -422,6 +422,12 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
|
|||||||
AuctionEntry* auction = auctionHouse->GetAuction(auctionId);
|
AuctionEntry* auction = auctionHouse->GetAuction(auctionId);
|
||||||
Player* player = GetPlayer();
|
Player* player = GetPlayer();
|
||||||
|
|
||||||
|
if (!sScriptMgr->CanPlaceAuctionBid(player, auction))
|
||||||
|
{
|
||||||
|
SendAuctionCommandResult(0, AUCTION_PLACE_BID, ERR_AUCTION_RESTRICTED_ACCOUNT);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!auction || auction->owner == player->GetGUID())
|
if (!auction || auction->owner == player->GetGUID())
|
||||||
{
|
{
|
||||||
//you cannot bid your own auction:
|
//you cannot bid your own auction:
|
||||||
|
|||||||
@@ -606,6 +606,21 @@ void ScriptMgr::OnQuestRewardItem(Player* player, Item* item, uint32 count)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ScriptMgr::CanPlaceAuctionBid(Player* player, AuctionEntry* auction)
|
||||||
|
{
|
||||||
|
auto ret = IsValidBoolScript<PlayerScript>([&](PlayerScript *script)
|
||||||
|
{
|
||||||
|
return !script->CanPlaceAuctionBid(player, auction);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (ret && *ret)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void ScriptMgr::OnGroupRollRewardItem(Player* player, Item* item, uint32 count, RollVote voteType, Roll* roll)
|
void ScriptMgr::OnGroupRollRewardItem(Player* player, Item* item, uint32 count, RollVote voteType, Roll* roll)
|
||||||
{
|
{
|
||||||
ExecuteScript<PlayerScript>([&](PlayerScript* script)
|
ExecuteScript<PlayerScript>([&](PlayerScript* script)
|
||||||
|
|||||||
@@ -1190,6 +1190,9 @@ public:
|
|||||||
// After receiving item as a quest reward
|
// After receiving item as a quest reward
|
||||||
virtual void OnQuestRewardItem(Player* /*player*/, Item* /*item*/, uint32 /*count*/) { }
|
virtual void OnQuestRewardItem(Player* /*player*/, Item* /*item*/, uint32 /*count*/) { }
|
||||||
|
|
||||||
|
// When placing a bid or buying out an auction
|
||||||
|
[[nodiscard]] virtual bool CanPlaceAuctionBid(Player* /*player*/, AuctionEntry* /*auction*/) { return true; }
|
||||||
|
|
||||||
// After receiving item as a group roll reward
|
// After receiving item as a group roll reward
|
||||||
virtual void OnGroupRollRewardItem(Player* /*player*/, Item* /*item*/, uint32 /*count*/, RollVote /*voteType*/, Roll* /*roll*/) { }
|
virtual void OnGroupRollRewardItem(Player* /*player*/, Item* /*item*/, uint32 /*count*/, RollVote /*voteType*/, Roll* /*roll*/) { }
|
||||||
|
|
||||||
@@ -2290,6 +2293,7 @@ public: /* PlayerScript */
|
|||||||
void OnStoreNewItem(Player* player, Item* item, uint32 count);
|
void OnStoreNewItem(Player* player, Item* item, uint32 count);
|
||||||
void OnCreateItem(Player* player, Item* item, uint32 count);
|
void OnCreateItem(Player* player, Item* item, uint32 count);
|
||||||
void OnQuestRewardItem(Player* player, Item* item, uint32 count);
|
void OnQuestRewardItem(Player* player, Item* item, uint32 count);
|
||||||
|
bool CanPlaceAuctionBid(Player* player, AuctionEntry* auction);
|
||||||
void OnGroupRollRewardItem(Player* player, Item* item, uint32 count, RollVote voteType, Roll* roll);
|
void OnGroupRollRewardItem(Player* player, Item* item, uint32 count, RollVote voteType, Roll* roll);
|
||||||
bool OnBeforeOpenItem(Player* player, Item* item);
|
bool OnBeforeOpenItem(Player* player, Item* item);
|
||||||
bool OnBeforePlayerQuestComplete(Player* player, uint32 quest_id);
|
bool OnBeforePlayerQuestComplete(Player* player, uint32 quest_id);
|
||||||
|
|||||||
Reference in New Issue
Block a user