Core/ObjectMgr: Remove GetPlayer function (Remove double use of singletons)
This commit is contained in:
@@ -301,7 +301,7 @@ inline void Battleground::_ProcessRessurect(uint32 diff)
|
||||
Creature *sh = NULL;
|
||||
for (std::vector<uint64>::const_iterator itr2 = (itr->second).begin(); itr2 != (itr->second).end(); ++itr2)
|
||||
{
|
||||
Player *plr = sObjectMgr->GetPlayer(*itr2);
|
||||
Player *plr = ObjectAccessor::FindPlayer(*itr2);
|
||||
if (!plr)
|
||||
continue;
|
||||
|
||||
@@ -332,7 +332,7 @@ inline void Battleground::_ProcessRessurect(uint32 diff)
|
||||
{
|
||||
for (std::vector<uint64>::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
|
||||
{
|
||||
Player *plr = sObjectMgr->GetPlayer(*itr);
|
||||
Player *plr = ObjectAccessor::FindPlayer(*itr);
|
||||
if (!plr)
|
||||
continue;
|
||||
plr->ResurrectPlayer(1.0f);
|
||||
@@ -397,7 +397,7 @@ inline void Battleground::_ProcessJoin(uint32 diff)
|
||||
{
|
||||
m_ResetStatTimer = 0;
|
||||
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
if (Player *plr = sObjectMgr->GetPlayer(itr->first))
|
||||
if (Player *plr = ObjectAccessor::FindPlayer(itr->first))
|
||||
plr->ResetAllPowers();
|
||||
}
|
||||
|
||||
@@ -445,7 +445,7 @@ inline void Battleground::_ProcessJoin(uint32 diff)
|
||||
{
|
||||
// TODO : add arena sound PlaySoundToAll(SOUND_ARENA_START);
|
||||
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
if (Player *plr = sObjectMgr->GetPlayer(itr->first))
|
||||
if (Player *plr = ObjectAccessor::FindPlayer(itr->first))
|
||||
{
|
||||
// BG Status packet
|
||||
WorldPacket status;
|
||||
@@ -480,7 +480,7 @@ inline void Battleground::_ProcessJoin(uint32 diff)
|
||||
PlaySoundToAll(SOUND_BG_START);
|
||||
|
||||
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
if (Player* plr = sObjectMgr->GetPlayer(itr->first))
|
||||
if (Player* plr = ObjectAccessor::FindPlayer(itr->first))
|
||||
{
|
||||
plr->RemoveAurasDueToSpell(SPELL_PREPARATION);
|
||||
plr->ResetAllPowers();
|
||||
@@ -519,7 +519,7 @@ inline Player* Battleground::_GetPlayer(const uint64& guid, bool offlineRemove,
|
||||
Player* player = NULL;
|
||||
if (!offlineRemove)
|
||||
{
|
||||
player = sObjectMgr->GetPlayer(guid);
|
||||
player = ObjectAccessor::FindPlayer(guid);
|
||||
if (!player)
|
||||
sLog->outError("Battleground::%s: player (GUID: %u) not found for BG (map: %u, instance id: %u)!",
|
||||
context, GUID_LOPART(guid), m_MapId, m_InstanceID);
|
||||
@@ -709,7 +709,7 @@ void Battleground::EndBattleground(uint32 winner)
|
||||
sLog->outArena("Arena match Type: %u for Team1Id: %u - Team2Id: %u ended. WinnerTeamId: %u. Winner rating: +%d, Loser rating: %d", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE], winner_arena_team->GetId(), winner_change, loser_change);
|
||||
if (sWorld->getBoolConfig(CONFIG_ARENA_LOG_EXTENDED_INFO))
|
||||
for (Battleground::BattlegroundScoreMap::const_iterator itr = GetPlayerScoresBegin(); itr != GetPlayerScoresEnd(); itr++)
|
||||
if (Player* player = sObjectMgr->GetPlayer(itr->first))
|
||||
if (Player* player = ObjectAccessor::FindPlayer(itr->first))
|
||||
sLog->outArena("Statistics for %s (GUID: " UI64FMTD ", Team: %d, IP: %s): %u damage, %u healing, %u killing blows", player->GetName(), itr->first, player->GetArenaTeamId(m_ArenaType == 5 ? 2 : m_ArenaType == 3), player->GetSession()->GetRemoteAddress().c_str(), itr->second->DamageDone, itr->second->HealingDone, itr->second->KillingBlows);
|
||||
}
|
||||
// Deduct 16 points from each teams arena-rating if there are no winners after 45+2 minutes
|
||||
@@ -893,7 +893,7 @@ void Battleground::RemovePlayerAtLeave(const uint64& guid, bool Transport, bool
|
||||
|
||||
RemovePlayerFromResurrectQueue(guid);
|
||||
|
||||
Player *plr = sObjectMgr->GetPlayer(guid);
|
||||
Player *plr = ObjectAccessor::FindPlayer(guid);
|
||||
|
||||
// should remove spirit of redemption
|
||||
if (plr && plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
||||
@@ -1337,7 +1337,7 @@ void Battleground::AddPlayerToResurrectQueue(const uint64& npc_guid, const uint6
|
||||
{
|
||||
m_ReviveQueue[npc_guid].push_back(player_guid);
|
||||
|
||||
Player *plr = sObjectMgr->GetPlayer(player_guid);
|
||||
Player *plr = ObjectAccessor::FindPlayer(player_guid);
|
||||
if (!plr)
|
||||
return;
|
||||
|
||||
@@ -1353,7 +1353,7 @@ void Battleground::RemovePlayerFromResurrectQueue(const uint64& player_guid)
|
||||
if (*itr2 == player_guid)
|
||||
{
|
||||
(itr->second).erase(itr2);
|
||||
if (Player *plr = sObjectMgr->GetPlayer(player_guid))
|
||||
if (Player *plr = ObjectAccessor::FindPlayer(player_guid))
|
||||
plr->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT);
|
||||
return;
|
||||
}
|
||||
@@ -1702,7 +1702,7 @@ void Battleground::HandleKillPlayer(Player* player, Player* killer)
|
||||
|
||||
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
Player* plr = sObjectMgr->GetPlayer(itr->first);
|
||||
Player* plr = ObjectAccessor::FindPlayer(itr->first);
|
||||
if (!plr || plr == killer)
|
||||
continue;
|
||||
|
||||
@@ -1766,7 +1766,7 @@ uint32 Battleground::GetAlivePlayersCountByTeam(uint32 Team) const
|
||||
{
|
||||
if (itr->second.Team == Team)
|
||||
{
|
||||
Player* pl = sObjectMgr->GetPlayer(itr->first);
|
||||
Player* pl = ObjectAccessor::FindPlayer(itr->first);
|
||||
if (pl && pl->isAlive() && !pl->HasByteFlag(UNIT_FIELD_BYTES_2, 3, FORM_SPIRITOFREDEMPTION))
|
||||
++count;
|
||||
}
|
||||
@@ -1837,7 +1837,7 @@ bool Battleground::IsTeamScoreInRange(uint32 team, uint32 minScore, uint32 maxSc
|
||||
void Battleground::StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
|
||||
{
|
||||
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
if (Player* pPlayer = sObjectMgr->GetPlayer(itr->first))
|
||||
if (Player* pPlayer = ObjectAccessor::FindPlayer(itr->first))
|
||||
pPlayer->GetAchievementMgr().StartTimedAchievement(type, entry);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user