diff options
Diffstat (limited to 'src/server/game/Battlegrounds/Battleground.cpp')
| -rw-r--r-- | src/server/game/Battlegrounds/Battleground.cpp | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 7ddd4e87e2..70b8a90670 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -1,14 +1,14 @@ /* * 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 Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * 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 Affero General Public License for + * 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 @@ -608,7 +608,7 @@ inline void Battleground::_ProcessJoin(uint32 diff) { WorldPacket status; sBattlegroundMgr->BuildBattlegroundStatusPacket(&status, this, player->GetCurrentBattlegroundQueueSlot(), STATUS_IN_PROGRESS, 0, GetStartTime(), GetArenaType(), player->GetBgTeamId()); - player->GetSession()->SendPacket(&status); + player->SendDirectMessage(&status); player->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION); player->ResetAllPowers(); @@ -652,7 +652,7 @@ inline void Battleground::_ProcessJoin(uint32 diff) data << t->GetGUID(); data << uint32(t->GetZoneId()); data << uint32(15 * IN_MILLISECONDS); - p->GetSession()->SendPacket(&data); + p->SendDirectMessage(&data); } m_ToBeTeleported.clear(); } @@ -713,14 +713,14 @@ Position const* Battleground::GetTeamStartPosition(TeamId teamId) const void Battleground::SendPacketToAll(WorldPacket const* packet) { for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) - itr->second->GetSession()->SendPacket(packet); + itr->second->SendDirectMessage(packet); } void Battleground::SendPacketToTeam(TeamId teamId, WorldPacket const* packet, Player* sender, bool self) { for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) if (itr->second->GetBgTeamId() == teamId && (self || sender != itr->second)) - itr->second->GetSession()->SendPacket(packet); + itr->second->SendDirectMessage(packet); } void Battleground::SendChatMessage(Creature* source, uint8 textId, WorldObject* target /*= nullptr*/) @@ -937,7 +937,7 @@ void Battleground::EndBattleground(PvPTeamId winnerTeamId) BlockMovement(player); - player->GetSession()->SendPacket(&pvpLogData); + player->SendDirectMessage(&pvpLogData); if (isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE)) { @@ -964,7 +964,7 @@ void Battleground::EndBattleground(PvPTeamId winnerTeamId) WorldPacket data; sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player->GetCurrentBattlegroundQueueSlot(), STATUS_IN_PROGRESS, TIME_TO_AUTOREMOVE, GetStartTime(), GetArenaType(), player->GetBgTeamId()); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND, player->GetMapId()); } @@ -1062,7 +1062,7 @@ void Battleground::RemovePlayerAtLeave(Player* player) WorldPacket data; sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player->GetCurrentBattlegroundQueueSlot(), STATUS_NONE, 0, 0, 0, TEAM_NEUTRAL); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(GetBgTypeID(), GetArenaType()); @@ -1178,16 +1178,19 @@ void Battleground::AddPlayer(Player* player) sBattlegroundMgr->BuildPlayerJoinedBattlegroundPacket(&data, player); SendPacketToTeam(teamId, &data, player, false); - player->RemoveAurasByType(SPELL_AURA_MOUNTED); - // add arena specific auras if (isArena()) { // restore pets health before remove - if (Pet* pet = player->GetPet()) + Pet* pet = player->GetPet(); + if (pet) if (pet->IsAlive()) pet->SetHealth(pet->GetMaxHealth()); + player->RemoveArenaAuras(); + if (pet) + pet->RemoveArenaAuras(); + player->RemoveArenaSpellCooldowns(true); player->RemoveArenaEnchantments(TEMP_ENCHANTMENT_SLOT); player->DestroyConjuredItems(true); player->UnsummonPetTemporaryIfAny(); @@ -1338,7 +1341,7 @@ bool Battleground::HasFreeSlots() const void Battleground::SpectatorsSendPacket(WorldPacket& data) { for (SpectatorList::const_iterator itr = m_Spectators.begin(); itr != m_Spectators.end(); ++itr) - (*itr)->GetSession()->SendPacket(&data); + (*itr)->SendDirectMessage(&data); } void Battleground::ReadyMarkerClicked(Player* p) @@ -1810,10 +1813,10 @@ void Battleground::PlayerAddedToBGCheckIfBGIsRunning(Player* player) BlockMovement(player); BuildPvPLogDataPacket(data); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player->GetCurrentBattlegroundQueueSlot(), STATUS_IN_PROGRESS, GetEndTime(), GetStartTime(), GetArenaType(), player->GetBgTeamId()); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); } uint32 Battleground::GetAlivePlayersCountByTeam(TeamId teamId) const |
