mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-05 06:17:56 +00:00
64 lines
2.5 KiB
C++
64 lines
2.5 KiB
C++
/*
|
|
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
* more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "BattlefieldScript.h"
|
|
#include "ScriptMgr.h"
|
|
#include "ScriptMgrMacros.h"
|
|
|
|
void ScriptMgr::OnBattlefieldPlayerEnterZone(Battlefield* bf, Player* player)
|
|
{
|
|
CALL_ENABLED_HOOKS(BattlefieldScript, BATTLEFIELDHOOK_ON_PLAYER_ENTER_ZONE, script->OnBattlefieldPlayerEnterZone(bf, player));
|
|
}
|
|
|
|
void ScriptMgr::OnBattlefieldPlayerLeaveZone(Battlefield* bf, Player* player)
|
|
{
|
|
CALL_ENABLED_HOOKS(BattlefieldScript, BATTLEFIELDHOOK_ON_PLAYER_LEAVE_ZONE, script->OnBattlefieldPlayerLeaveZone(bf, player));
|
|
}
|
|
|
|
void ScriptMgr::OnBattlefieldPlayerJoinWar(Battlefield* bf, Player* player)
|
|
{
|
|
CALL_ENABLED_HOOKS(BattlefieldScript, BATTLEFIELDHOOK_ON_PLAYER_JOIN_WAR, script->OnBattlefieldPlayerJoinWar(bf, player));
|
|
}
|
|
|
|
void ScriptMgr::OnBattlefieldPlayerLeaveWar(Battlefield* bf, Player* player)
|
|
{
|
|
CALL_ENABLED_HOOKS(BattlefieldScript, BATTLEFIELDHOOK_ON_PLAYER_LEAVE_WAR, script->OnBattlefieldPlayerLeaveWar(bf, player));
|
|
}
|
|
|
|
void ScriptMgr::OnBattlefieldBeforeInvitePlayerToWar(Battlefield* bf, Player* player)
|
|
{
|
|
CALL_ENABLED_HOOKS(BattlefieldScript, BATTLEFIELDHOOK_BEFORE_INVITE_PLAYER_TO_WAR, script->OnBattlefieldBeforeInvitePlayerToWar(bf, player));
|
|
}
|
|
|
|
void ScriptMgr::OnBattlefieldWarEnd(Battlefield* bf, bool endByTimer)
|
|
{
|
|
CALL_ENABLED_HOOKS(BattlefieldScript, BATTLEFIELDHOOK_ON_WAR_END, script->OnBattlefieldWarEnd(bf, endByTimer));
|
|
}
|
|
|
|
BattlefieldScript::BattlefieldScript(char const* name, std::vector<uint16> enabledHooks) :
|
|
ScriptObject(name, BATTLEFIELDHOOK_END)
|
|
{
|
|
// If empty - enable all available hooks.
|
|
if (enabledHooks.empty())
|
|
for (uint16 i = 0; i < BATTLEFIELDHOOK_END; ++i)
|
|
enabledHooks.emplace_back(i);
|
|
|
|
ScriptRegistry<BattlefieldScript>::AddScript(this, std::move(enabledHooks));
|
|
}
|
|
|
|
template class AC_GAME_API ScriptRegistry<BattlefieldScript>;
|