fix(Core/ScriptsMgr): correct hooks name (#6434)

## Changes Proposed:
- Added `virtual` for `CanSendJoinMessageArenaQueue` and `CanSendExitMessageArenaQueue`
- Rename `CanExitJoinMessageArenaQueue` to `CanSendExitMessageArenaQueue`
This commit is contained in:
Kargatum 2021-06-28 13:34:26 +07:00 committed by GitHub
parent 53ab534f0b
commit fbad1f3d6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 10 deletions

View File

@ -0,0 +1,10 @@
### Added
- new hook `OnBeforeSendJoinMessageArenaQueue` and `OnBeforeSendExitMessageArenaQueue`
### Changed
- Rename `CanExitJoinMessageArenaQueue` to `OnBeforeSendExitMessageArenaQueue`
- Rename `CanSendJoinMessageArenaQueue` to `OnBeforeSendJoinMessageArenaQueue`
### How to upgrade
- Just rename all hooks from `CanExitJoinMessageArenaQueue` and `CanSendMessageArenaQueue`, to `OnBeforeSendExitMessageArenaQueue`
- Just rename all hooks from `CanSendJoinMessageArenaQueue` and `OnBeforeSendJoinMessageArenaQueue`

View File

@ -1015,7 +1015,7 @@ void BattlegroundQueue::SendJoinMessageArenaQueue(Player* leader, GroupQueueInfo
if (!sWorld->getBoolConfig(CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE))
return;
if (!sScriptMgr->CanSendJoinMessageArenaQueue(this, leader, ginfo, bracketEntry, isRated))
if (!sScriptMgr->OnBeforeSendJoinMessageArenaQueue(this, leader, ginfo, bracketEntry, isRated))
return;
if (!isRated)
@ -1080,7 +1080,7 @@ void BattlegroundQueue::SendExitMessageArenaQueue(GroupQueueInfo* ginfo)
if (!sWorld->getBoolConfig(CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE))
return;
if (!sScriptMgr->CanExitJoinMessageArenaQueue(this, ginfo))
if (!sScriptMgr->OnBeforeSendExitMessageArenaQueue(this, ginfo))
return;
ArenaTeam* team = sArenaTeamMgr->GetArenaTeamById(ginfo->ArenaTeamId);

View File

@ -2809,23 +2809,23 @@ bool ScriptMgr::CanSendMessageBGQueue(BattlegroundQueue* queue, Player* leader,
return ret;
}
bool ScriptMgr::CanSendJoinMessageArenaQueue(BattlegroundQueue* queue, Player* leader, GroupQueueInfo* ginfo, PvPDifficultyEntry const* bracketEntry, bool isRated)
bool ScriptMgr::OnBeforeSendJoinMessageArenaQueue(BattlegroundQueue* queue, Player* leader, GroupQueueInfo* ginfo, PvPDifficultyEntry const* bracketEntry, bool isRated)
{
bool ret = true;
FOR_SCRIPTS_RET(BGScript, itr, end, ret) // return true by default if not scripts
if (!itr->second->CanSendJoinMessageArenaQueue(queue, leader, ginfo, bracketEntry, isRated))
if (!itr->second->OnBeforeSendJoinMessageArenaQueue(queue, leader, ginfo, bracketEntry, isRated))
ret = false; // we change ret value only when scripts return false
return ret;
}
bool ScriptMgr::CanExitJoinMessageArenaQueue(BattlegroundQueue* queue, GroupQueueInfo* ginfo)
bool ScriptMgr::OnBeforeSendExitMessageArenaQueue(BattlegroundQueue* queue, GroupQueueInfo* ginfo)
{
bool ret = true;
FOR_SCRIPTS_RET(BGScript, itr, end, ret) // return true by default if not scripts
if (!itr->second->CanExitJoinMessageArenaQueue(queue, ginfo))
if (!itr->second->OnBeforeSendExitMessageArenaQueue(queue, ginfo))
ret = false; // we change ret value only when scripts return false
return ret;

View File

@ -1199,9 +1199,26 @@ public:
[[nodiscard]] virtual bool CanSendMessageBGQueue(BattlegroundQueue* /*queue*/, Player* /*leader*/, Battleground* /*bg*/, PvPDifficultyEntry const* /*bracketEntry*/) { return true; }
[[nodiscard]] bool CanSendJoinMessageArenaQueue(BattlegroundQueue* /*queue*/, Player* /*leader*/, GroupQueueInfo* /*ginfo*/, PvPDifficultyEntry const* /*bracketEntry*/, bool /*isRated*/) { return true; }
/**
* @brief This hook runs before sending the join message during the arena queue, allowing you to run extra operations or disabling the join message
*
* @param queue Contains information about the Arena queue
* @param leader Contains information about the player leader
* @param ginfo Contains information about the group of the queue
* @param bracketEntry Contains information about the bracket
* @param isRated Contains information about rated arena or skirmish
* @return True if you want to continue sending the message, false if you want to disable the message
*/
[[nodiscard]] virtual bool OnBeforeSendJoinMessageArenaQueue(BattlegroundQueue* /*queue*/, Player* /*leader*/, GroupQueueInfo* /*ginfo*/, PvPDifficultyEntry const* /*bracketEntry*/, bool /*isRated*/) { return true; }
[[nodiscard]] bool CanExitJoinMessageArenaQueue(BattlegroundQueue* /*queue*/, GroupQueueInfo* /*ginfo*/) { return true; }
/**
* @brief This hook runs before sending the exit message during the arena queue, allowing you to run extra operations or disabling the exit message
*
* @param queue Contains information about the Arena queue
* @param ginfo Contains information about the group of the queue
* @return True if you want to continue sending the message, false if you want to disable the message
*/
[[nodiscard]] virtual bool OnBeforeSendExitMessageArenaQueue(BattlegroundQueue* /*queue*/, GroupQueueInfo* /*ginfo*/) { return true; }
};
class ArenaTeamScript : public ScriptObject
@ -1802,8 +1819,8 @@ public: /* BGScript */
BattlegroundBracketId thisBracketId, BattlegroundQueue* specificQueue, BattlegroundBracketId specificBracketId);
void OnCheckNormalMatch(BattlegroundQueue* queue, uint32& Coef, Battleground* bgTemplate, BattlegroundBracketId bracket_id, uint32& minPlayers, uint32& maxPlayers);
bool CanSendMessageBGQueue(BattlegroundQueue* queue, Player* leader, Battleground* bg, PvPDifficultyEntry const* bracketEntry);
bool CanSendJoinMessageArenaQueue(BattlegroundQueue* queue, Player* leader, GroupQueueInfo* ginfo, PvPDifficultyEntry const* bracketEntry, bool isRated);
bool CanExitJoinMessageArenaQueue(BattlegroundQueue* queue, GroupQueueInfo* ginfo);
bool OnBeforeSendJoinMessageArenaQueue(BattlegroundQueue* queue, Player* leader, GroupQueueInfo* ginfo, PvPDifficultyEntry const* bracketEntry, bool isRated);
bool OnBeforeSendExitMessageArenaQueue(BattlegroundQueue* queue, GroupQueueInfo* ginfo);
public: /* Arena Team Script */
void OnGetSlotByType(const uint32 type, uint8& slot);