Core/Scripts: Add BGScripts and new hooks

* OnBattlegroudStart
* OnBattlegroudEndReward
* OnBattlegroudUpdate
* OnBattlegroudAddPlayer
This commit is contained in:
Kargatum
2018-06-18 02:00:20 +07:00
parent a1794c6193
commit 049386b936
3 changed files with 68 additions and 0 deletions

View File

@@ -281,6 +281,8 @@ void Battleground::Update(uint32 diff)
m_ResetStatTimer += diff;
PostUpdateImpl(diff);
sScriptMgr->OnBattlegroudUpdate(this, diff);
}
inline void Battleground::_CheckSafePositions(uint32 diff)
@@ -581,6 +583,8 @@ inline void Battleground::_ProcessJoin(uint32 diff)
// Announce BG starting
if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE))
sWorld->SendWorldText(LANG_BG_STARTED_ANNOUNCE_WORLD, GetName(), std::min(GetMinLevel(), (uint32)80), std::min(GetMaxLevel(), (uint32)80));
sScriptMgr->OnBattlegroudStart(this);
}
}
}
@@ -974,6 +978,8 @@ void Battleground::EndBattleground(TeamId winnerTeamId)
uint32 loser_kills = player->GetRandomWinner() ? BG_REWARD_LOSER_HONOR_LAST : BG_REWARD_LOSER_HONOR_FIRST;
uint32 winner_arena = player->GetRandomWinner() ? BG_REWARD_WINNER_ARENA_LAST : BG_REWARD_WINNER_ARENA_FIRST;
sScriptMgr->OnBattlegroudEndReward(this, player, winnerTeamId);
// Reward winner team
if (bgTeamId == winnerTeamId)
{
@@ -1253,6 +1259,8 @@ void Battleground::AddPlayer(Player* player)
PlayerAddedToBGCheckIfBGIsRunning(player);
AddOrSetPlayerToCorrectBgGroup(player, teamId);
sScriptMgr->OnBattlegroudAddPlayer(this, player);
// Log
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDetail("BATTLEGROUND: Player %s joined the battle.", player->GetName().c_str());