Core/ObjectMgr: Remove GetPlayer function (Remove double use of singletons)
This commit is contained in:
@@ -95,7 +95,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry *auction, SQLTransaction&
|
||||
|
||||
uint32 bidder_accId = 0;
|
||||
uint64 bidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER);
|
||||
Player *bidder = sObjectMgr->GetPlayer(bidder_guid);
|
||||
Player *bidder = ObjectAccessor::FindPlayer(bidder_guid);
|
||||
// data for gm.log
|
||||
if (sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
|
||||
{
|
||||
@@ -166,7 +166,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry *auction, SQLTransaction&
|
||||
void AuctionHouseMgr::SendAuctionSalePendingMail(AuctionEntry * auction, SQLTransaction& trans)
|
||||
{
|
||||
uint64 owner_guid = MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER);
|
||||
Player *owner = sObjectMgr->GetPlayer(owner_guid);
|
||||
Player *owner = ObjectAccessor::FindPlayer(owner_guid);
|
||||
uint32 owner_accId = sObjectMgr->GetPlayerAccountIdByGUID(owner_guid);
|
||||
// owner exist (online or offline)
|
||||
if (owner || owner_accId)
|
||||
@@ -196,7 +196,7 @@ void AuctionHouseMgr::SendAuctionSalePendingMail(AuctionEntry * auction, SQLTran
|
||||
void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry * auction, SQLTransaction& trans)
|
||||
{
|
||||
uint64 owner_guid = MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER);
|
||||
Player *owner = sObjectMgr->GetPlayer(owner_guid);
|
||||
Player *owner = ObjectAccessor::FindPlayer(owner_guid);
|
||||
uint32 owner_accId = sObjectMgr->GetPlayerAccountIdByGUID(owner_guid);
|
||||
// owner exist
|
||||
if (owner || owner_accId)
|
||||
@@ -239,7 +239,7 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry * auction, SQLTransact
|
||||
return;
|
||||
|
||||
uint64 owner_guid = MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER);
|
||||
Player *owner = sObjectMgr->GetPlayer(owner_guid);
|
||||
Player *owner = ObjectAccessor::FindPlayer(owner_guid);
|
||||
uint32 owner_accId = sObjectMgr->GetPlayerAccountIdByGUID(owner_guid);
|
||||
// owner exist
|
||||
if (owner || owner_accId)
|
||||
@@ -260,7 +260,7 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry * auction, SQLTransact
|
||||
void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry *auction, uint32 newPrice, Player* newBidder, SQLTransaction& trans)
|
||||
{
|
||||
uint64 oldBidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER);
|
||||
Player *oldBidder = sObjectMgr->GetPlayer(oldBidder_guid);
|
||||
Player *oldBidder = ObjectAccessor::FindPlayer(oldBidder_guid);
|
||||
|
||||
uint32 oldBidder_accId = 0;
|
||||
if (!oldBidder)
|
||||
@@ -285,7 +285,7 @@ void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry *auction, uint32 new
|
||||
void AuctionHouseMgr::SendAuctionCancelledToBidderMail(AuctionEntry* auction, SQLTransaction& trans)
|
||||
{
|
||||
uint64 bidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER);
|
||||
Player *bidder = sObjectMgr->GetPlayer(bidder_guid);
|
||||
Player *bidder = ObjectAccessor::FindPlayer(bidder_guid);
|
||||
|
||||
uint32 bidder_accId = 0;
|
||||
if (!bidder)
|
||||
|
||||
@@ -49,7 +49,7 @@ ArenaTeam::~ArenaTeam()
|
||||
bool ArenaTeam::Create(uint32 captainGuid, uint8 type, std::string teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor)
|
||||
{
|
||||
// Check if captain is present
|
||||
if (!sObjectMgr->GetPlayer(captainGuid))
|
||||
if (!ObjectAccessor::FindPlayer(captainGuid))
|
||||
return false;
|
||||
|
||||
// Check if arena team name is already taken
|
||||
@@ -103,7 +103,7 @@ bool ArenaTeam::AddMember(const uint64& playerGuid)
|
||||
return false;
|
||||
|
||||
// Get player name and class either from db or ObjectMgr
|
||||
Player* player = sObjectMgr->GetPlayer(playerGuid);
|
||||
Player* player = ObjectAccessor::FindPlayer(playerGuid);
|
||||
if (player)
|
||||
{
|
||||
playerClass = player->getClass();
|
||||
@@ -279,7 +279,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result)
|
||||
void ArenaTeam::SetCaptain(const uint64& guid)
|
||||
{
|
||||
// Disable remove/promote buttons
|
||||
Player* oldCaptain = sObjectMgr->GetPlayer(GetCaptain());
|
||||
Player* oldCaptain = ObjectAccessor::FindPlayer(GetCaptain());
|
||||
if (oldCaptain)
|
||||
oldCaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1);
|
||||
|
||||
@@ -293,7 +293,7 @@ void ArenaTeam::SetCaptain(const uint64& guid)
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
// Enable remove/promote buttons
|
||||
Player *newCaptain = sObjectMgr->GetPlayer(guid);
|
||||
Player *newCaptain = ObjectAccessor::FindPlayer(guid);
|
||||
if (newCaptain)
|
||||
{
|
||||
newCaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0);
|
||||
@@ -313,7 +313,7 @@ void ArenaTeam::DelMember(uint64 guid, bool cleanDb)
|
||||
}
|
||||
|
||||
// Inform player and remove arena team info from player data
|
||||
if (Player* player = sObjectMgr->GetPlayer(guid))
|
||||
if (Player* player = ObjectAccessor::FindPlayer(guid))
|
||||
{
|
||||
player->GetSession()->SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, GetName(), "", 0);
|
||||
// delete all info regarding this team
|
||||
@@ -378,7 +378,7 @@ void ArenaTeam::Roster(WorldSession* session)
|
||||
|
||||
for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr)
|
||||
{
|
||||
pl = sObjectMgr->GetPlayer(itr->Guid);
|
||||
pl = ObjectAccessor::FindPlayer(itr->Guid);
|
||||
|
||||
data << uint64(itr->Guid); // guid
|
||||
data << uint8((pl ? 1 : 0)); // online flag
|
||||
@@ -436,7 +436,7 @@ void ArenaTeam::NotifyStatsChanged()
|
||||
// Updates arena team stats for every member of the team (not only the ones who participated!)
|
||||
for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr)
|
||||
{
|
||||
Player* plr = sObjectMgr->GetPlayer(itr->Guid);
|
||||
Player* plr = ObjectAccessor::FindPlayer(itr->Guid);
|
||||
if (plr)
|
||||
SendStats(plr->GetSession());
|
||||
}
|
||||
@@ -486,7 +486,7 @@ void ArenaTeam::BroadcastPacket(WorldPacket* packet)
|
||||
{
|
||||
for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr)
|
||||
{
|
||||
Player* player = sObjectMgr->GetPlayer(itr->Guid);
|
||||
Player* player = ObjectAccessor::FindPlayer(itr->Guid);
|
||||
if (player)
|
||||
player->GetSession()->SendPacket(packet);
|
||||
}
|
||||
@@ -866,7 +866,7 @@ void ArenaTeam::FinishWeek()
|
||||
bool ArenaTeam::IsFighting() const
|
||||
{
|
||||
for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr)
|
||||
if (Player* player = sObjectMgr->GetPlayer(itr->Guid))
|
||||
if (Player* player = ObjectAccessor::FindPlayer(itr->Guid))
|
||||
if (player->GetMap()->IsBattleArena())
|
||||
return true;
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ void ArenaTeamMgr::DistributeArenaPoints()
|
||||
CharacterDatabase.PExecute("UPDATE characters SET arenaPoints = arenaPoints + '%u' WHERE guid = '%u'", playerItr->second, playerItr->first);
|
||||
|
||||
// Add points to player if online
|
||||
Player* pl = sObjectMgr->GetPlayer(playerItr->first);
|
||||
Player* pl = ObjectAccessor::FindPlayer(playerItr->first);
|
||||
if (pl)
|
||||
pl->ModifyArenaPoints(playerItr->second);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -291,7 +291,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket *data, Battleground *bg)
|
||||
}
|
||||
else
|
||||
{
|
||||
Player *plr = sObjectMgr->GetPlayer(itr2->first);
|
||||
Player *plr = ObjectAccessor::FindPlayer(itr2->first);
|
||||
uint32 team = bg->GetPlayerTeam(itr2->first);
|
||||
if (!team && plr)
|
||||
team = plr->GetBGTeam();
|
||||
|
||||
@@ -283,7 +283,7 @@ uint32 BattlegroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, Battleg
|
||||
//remove player from queue and from group info, if group info is empty then remove it too
|
||||
void BattlegroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCount)
|
||||
{
|
||||
//Player *plr = sObjectMgr->GetPlayer(guid);
|
||||
//Player *plr = ObjectAccessor::FindPlayer(guid);
|
||||
|
||||
int32 bracket_id = -1; // signed for proper for-loop finish
|
||||
QueuedPlayersMap::iterator itr;
|
||||
@@ -366,7 +366,7 @@ void BattlegroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
|
||||
if (at)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "UPDATING memberLost's personal arena rating for %u by opponents rating: %u", GUID_LOPART(guid), group->OpponentsTeamRating);
|
||||
Player *plr = sObjectMgr->GetPlayer(guid);
|
||||
Player *plr = ObjectAccessor::FindPlayer(guid);
|
||||
if (plr)
|
||||
at->MemberLost(plr, group->OpponentsMatchmakerRating);
|
||||
else
|
||||
@@ -388,7 +388,7 @@ void BattlegroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
|
||||
{
|
||||
// remove next player, this is recursive
|
||||
// first send removal information
|
||||
if (Player *plr2 = sObjectMgr->GetPlayer(group->Players.begin()->first))
|
||||
if (Player *plr2 = ObjectAccessor::FindPlayer(group->Players.begin()->first))
|
||||
{
|
||||
Battleground* bg = sBattlegroundMgr->GetBattlegroundTemplate(group->BgTypeId);
|
||||
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(group->BgTypeId, group->ArenaType);
|
||||
@@ -447,7 +447,7 @@ bool BattlegroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, Battleground* bg
|
||||
for (std::map<uint64, PlayerQueueInfo*>::iterator itr = ginfo->Players.begin(); itr != ginfo->Players.end(); ++itr)
|
||||
{
|
||||
// get the player
|
||||
Player* plr = sObjectMgr->GetPlayer(itr->first);
|
||||
Player* plr = ObjectAccessor::FindPlayer(itr->first);
|
||||
// if offline, skip him, this should not happen - player is removed from queue when he logs out
|
||||
if (!plr)
|
||||
continue;
|
||||
@@ -1022,7 +1022,7 @@ void BattlegroundQueue::Update(BattlegroundTypeId bgTypeId, BattlegroundBracketI
|
||||
|
||||
bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||
{
|
||||
Player* plr = sObjectMgr->GetPlayer(m_PlayerGuid);
|
||||
Player* plr = ObjectAccessor::FindPlayer(m_PlayerGuid);
|
||||
// player logged off (we should do nothing, he is correctly removed from queue in another procedure)
|
||||
if (!plr)
|
||||
return true;
|
||||
@@ -1065,7 +1065,7 @@ void BGQueueInviteEvent::Abort(uint64 /*e_time*/)
|
||||
*/
|
||||
bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||
{
|
||||
Player* plr = sObjectMgr->GetPlayer(m_PlayerGuid);
|
||||
Player* plr = ObjectAccessor::FindPlayer(m_PlayerGuid);
|
||||
if (!plr)
|
||||
// player logged off (we should do nothing, he is correctly removed from queue in another procedure)
|
||||
return true;
|
||||
|
||||
@@ -411,7 +411,7 @@ void BattlegroundAB::_NodeDeOccupied(uint8 node)
|
||||
WorldSafeLocsEntry const *ClosestGrave = NULL;
|
||||
for (std::vector<uint64>::const_iterator itr = ghost_list.begin(); itr != ghost_list.end(); ++itr)
|
||||
{
|
||||
Player* plr = sObjectMgr->GetPlayer(*itr);
|
||||
Player* plr = ObjectAccessor::FindPlayer(*itr);
|
||||
if (!plr)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -1031,7 +1031,7 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
|
||||
WorldSafeLocsEntry const *ClosestGrave = NULL;
|
||||
for (std::vector<uint64>::iterator itr = ghost_list.begin(); itr != ghost_list.end(); ++itr)
|
||||
{
|
||||
plr = sObjectMgr->GetPlayer(*ghost_list.begin());
|
||||
plr = ObjectAccessor::FindPlayer(*ghost_list.begin());
|
||||
if (!plr)
|
||||
continue;
|
||||
if (!ClosestGrave)
|
||||
|
||||
@@ -148,7 +148,7 @@ void BattlegroundEY::CheckSomeoneJoinedPoint()
|
||||
uint8 j = 0;
|
||||
while (j < m_PlayersNearPoint[EY_POINTS_MAX].size())
|
||||
{
|
||||
Player *plr = sObjectMgr->GetPlayer(m_PlayersNearPoint[EY_POINTS_MAX][j]);
|
||||
Player *plr = ObjectAccessor::FindPlayer(m_PlayersNearPoint[EY_POINTS_MAX][j]);
|
||||
if (!plr)
|
||||
{
|
||||
sLog->outError("BattlegroundEY:CheckSomeoneJoinedPoint: Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[EY_POINTS_MAX][j]));
|
||||
@@ -188,7 +188,7 @@ void BattlegroundEY::CheckSomeoneLeftPoint()
|
||||
uint8 j = 0;
|
||||
while (j < m_PlayersNearPoint[i].size())
|
||||
{
|
||||
Player *plr = sObjectMgr->GetPlayer(m_PlayersNearPoint[i][j]);
|
||||
Player *plr = ObjectAccessor::FindPlayer(m_PlayersNearPoint[i][j]);
|
||||
if (!plr)
|
||||
{
|
||||
sLog->outError("BattlegroundEY:CheckSomeoneLeftPoint Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[i][j]));
|
||||
@@ -243,7 +243,7 @@ void BattlegroundEY::UpdatePointStatuses()
|
||||
|
||||
for (uint8 i = 0; i < m_PlayersNearPoint[point].size(); ++i)
|
||||
{
|
||||
Player *plr = sObjectMgr->GetPlayer(m_PlayersNearPoint[point][i]);
|
||||
Player *plr = ObjectAccessor::FindPlayer(m_PlayersNearPoint[point][i]);
|
||||
if (plr)
|
||||
{
|
||||
this->UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, m_PointBarStatus[point], plr);
|
||||
|
||||
@@ -90,7 +90,7 @@ void BattlegroundIC::DoAction(uint32 action, uint64 const& var)
|
||||
if (action != ACTION_TELEPORT_PLAYER_TO_TRANSPORT)
|
||||
return;
|
||||
|
||||
Player* plr = sObjectMgr->GetPlayer(var);
|
||||
Player* plr = ObjectAccessor::FindPlayer(var);
|
||||
|
||||
if (!plr || !gunshipAlliance || !gunshipHorde)
|
||||
return;
|
||||
@@ -408,7 +408,7 @@ bool BattlegroundIC::SetupBattleground()
|
||||
//Send transport init packet to all player in map
|
||||
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end();itr++)
|
||||
{
|
||||
if (Player* player = sObjectMgr->GetPlayer(itr->first))
|
||||
if (Player* player = ObjectAccessor::FindPlayer(itr->first))
|
||||
SendTransportInit(player);
|
||||
}
|
||||
|
||||
@@ -480,7 +480,7 @@ void BattlegroundIC::RealocatePlayers(ICNodePointType nodeType)
|
||||
WorldSafeLocsEntry const *ClosestGrave = NULL;
|
||||
for (std::vector<uint64>::const_iterator itr = ghost_list.begin(); itr != ghost_list.end(); ++itr)
|
||||
{
|
||||
Player* plr = sObjectMgr->GetPlayer(*itr);
|
||||
Player* plr = ObjectAccessor::FindPlayer(*itr);
|
||||
if (!plr)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ bool BattlegroundSA::ResetObjs()
|
||||
|
||||
for (int i = BG_SA_BOAT_ONE; i <= BG_SA_BOAT_TWO; i++)
|
||||
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))
|
||||
SendTransportsRemove(plr);
|
||||
|
||||
uint32 atF = BG_SA_Factions[Attackers];
|
||||
@@ -246,7 +246,7 @@ bool BattlegroundSA::ResetObjs()
|
||||
|
||||
for (int i = BG_SA_BOAT_ONE; i <= BG_SA_BOAT_TWO; i++)
|
||||
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))
|
||||
SendTransportInit(plr);
|
||||
|
||||
TeleportPlayers();
|
||||
@@ -265,7 +265,7 @@ void BattlegroundSA::StartShips()
|
||||
{
|
||||
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end();itr++)
|
||||
{
|
||||
if (Player* p = sObjectMgr->GetPlayer(itr->first))
|
||||
if (Player* p = ObjectAccessor::FindPlayer(itr->first))
|
||||
{
|
||||
UpdateData data;
|
||||
WorldPacket pkt;
|
||||
@@ -494,7 +494,7 @@ void BattlegroundSA::TeleportPlayers()
|
||||
{
|
||||
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))
|
||||
{
|
||||
// should remove spirit of redemption
|
||||
if (plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
||||
@@ -799,7 +799,7 @@ void BattlegroundSA::EventPlayerUsedGO(Player* Source, GameObject* object)
|
||||
//Achievement Storm the Beach (1310)
|
||||
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))
|
||||
if (plr->GetTeamId() == Attackers)
|
||||
plr->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 65246);
|
||||
}
|
||||
@@ -823,7 +823,7 @@ void BattlegroundSA::EventPlayerUsedGO(Player* Source, GameObject* object)
|
||||
//Achievement Storm the Beach (1310)
|
||||
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))
|
||||
if (plr->GetTeamId() == Attackers && RoundScores[1].winner == Attackers)
|
||||
plr->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 65246);
|
||||
}
|
||||
|
||||
@@ -142,20 +142,20 @@ void BattlegroundWS::Update(uint32 diff)
|
||||
m_FlagSpellForceTimer += diff;
|
||||
if (m_FlagDebuffState == 0 && m_FlagSpellForceTimer >= 600000) //10 minutes
|
||||
{
|
||||
if (Player* plr = sObjectMgr->GetPlayer(m_FlagKeepers[0]))
|
||||
if (Player* plr = ObjectAccessor::FindPlayer(m_FlagKeepers[0]))
|
||||
plr->CastSpell(plr, WS_SPELL_FOCUSED_ASSAULT, true);
|
||||
if (Player* plr = sObjectMgr->GetPlayer(m_FlagKeepers[1]))
|
||||
if (Player* plr = ObjectAccessor::FindPlayer(m_FlagKeepers[1]))
|
||||
plr->CastSpell(plr, WS_SPELL_FOCUSED_ASSAULT, true);
|
||||
m_FlagDebuffState = 1;
|
||||
}
|
||||
else if (m_FlagDebuffState == 1 && m_FlagSpellForceTimer >= 900000) //15 minutes
|
||||
{
|
||||
if (Player* plr = sObjectMgr->GetPlayer(m_FlagKeepers[0]))
|
||||
if (Player* plr = ObjectAccessor::FindPlayer(m_FlagKeepers[0]))
|
||||
{
|
||||
plr->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
|
||||
plr->CastSpell(plr, WS_SPELL_BRUTAL_ASSAULT, true);
|
||||
}
|
||||
if (Player* plr = sObjectMgr->GetPlayer(m_FlagKeepers[1]))
|
||||
if (Player* plr = ObjectAccessor::FindPlayer(m_FlagKeepers[1]))
|
||||
{
|
||||
plr->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
|
||||
plr->CastSpell(plr, WS_SPELL_BRUTAL_ASSAULT, true);
|
||||
|
||||
@@ -168,7 +168,7 @@ void Channel::Join(uint64 p, const char *pass)
|
||||
return;
|
||||
}
|
||||
|
||||
Player *plr = sObjectMgr->GetPlayer(p);
|
||||
Player *plr = ObjectAccessor::FindPlayer(p);
|
||||
|
||||
if (plr)
|
||||
{
|
||||
@@ -230,7 +230,7 @@ void Channel::Leave(uint64 p, bool send)
|
||||
}
|
||||
else
|
||||
{
|
||||
Player *plr = sObjectMgr->GetPlayer(p);
|
||||
Player *plr = ObjectAccessor::FindPlayer(p);
|
||||
|
||||
if (send)
|
||||
{
|
||||
@@ -273,7 +273,7 @@ void Channel::Leave(uint64 p, bool send)
|
||||
void Channel::KickOrBan(uint64 good, const char *badname, bool ban)
|
||||
{
|
||||
AccountTypes sec = SEC_PLAYER;
|
||||
Player *gplr = sObjectMgr->GetPlayer(good);
|
||||
Player *gplr = ObjectAccessor::FindPlayer(good);
|
||||
if (gplr)
|
||||
sec = gplr->GetSession()->GetSecurity();
|
||||
|
||||
@@ -291,7 +291,7 @@ void Channel::KickOrBan(uint64 good, const char *badname, bool ban)
|
||||
}
|
||||
else
|
||||
{
|
||||
Player *bad = sObjectMgr->GetPlayer(badname);
|
||||
Player *bad = sObjectAccessor->FindPlayerByName(badname);
|
||||
if (bad == NULL || !IsOn(bad->GetGUID()))
|
||||
{
|
||||
WorldPacket data;
|
||||
@@ -337,7 +337,7 @@ void Channel::KickOrBan(uint64 good, const char *badname, bool ban)
|
||||
void Channel::UnBan(uint64 good, const char *badname)
|
||||
{
|
||||
uint32 sec = 0;
|
||||
Player *gplr = sObjectMgr->GetPlayer(good);
|
||||
Player *gplr = ObjectAccessor::FindPlayer(good);
|
||||
if (gplr)
|
||||
sec = gplr->GetSession()->GetSecurity();
|
||||
|
||||
@@ -355,7 +355,7 @@ void Channel::UnBan(uint64 good, const char *badname)
|
||||
}
|
||||
else
|
||||
{
|
||||
Player *bad = sObjectMgr->GetPlayer(badname);
|
||||
Player *bad = sObjectAccessor->FindPlayerByName(badname);
|
||||
if (bad == NULL || !IsBanned(bad->GetGUID()))
|
||||
{
|
||||
WorldPacket data;
|
||||
@@ -379,7 +379,7 @@ void Channel::Password(uint64 p, const char *pass)
|
||||
{
|
||||
std::string plName;
|
||||
uint32 sec = 0;
|
||||
Player *plr = sObjectMgr->GetPlayer(p);
|
||||
Player *plr = ObjectAccessor::FindPlayer(p);
|
||||
if (plr)
|
||||
sec = plr->GetSession()->GetSecurity();
|
||||
|
||||
@@ -411,7 +411,7 @@ void Channel::Password(uint64 p, const char *pass)
|
||||
|
||||
void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
|
||||
{
|
||||
Player *plr = sObjectMgr->GetPlayer(p);
|
||||
Player *plr = ObjectAccessor::FindPlayer(p);
|
||||
if (!plr)
|
||||
return;
|
||||
|
||||
@@ -431,7 +431,7 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
|
||||
}
|
||||
else
|
||||
{
|
||||
Player *newp = sObjectMgr->GetPlayer(p2n);
|
||||
Player *newp = sObjectAccessor->FindPlayerByName(p2n);
|
||||
if (!newp)
|
||||
{
|
||||
WorldPacket data;
|
||||
@@ -479,7 +479,7 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
|
||||
|
||||
void Channel::SetOwner(uint64 p, const char *newname)
|
||||
{
|
||||
Player *plr = sObjectMgr->GetPlayer(p);
|
||||
Player *plr = ObjectAccessor::FindPlayer(p);
|
||||
if (!plr)
|
||||
return;
|
||||
|
||||
@@ -501,7 +501,7 @@ void Channel::SetOwner(uint64 p, const char *newname)
|
||||
return;
|
||||
}
|
||||
|
||||
Player *newp = sObjectMgr->GetPlayer(newname);
|
||||
Player *newp = sObjectAccessor->FindPlayerByName(newname);
|
||||
if (newp == NULL || !IsOn(newp->GetGUID()))
|
||||
{
|
||||
WorldPacket data;
|
||||
@@ -563,7 +563,7 @@ void Channel::List(Player* player)
|
||||
uint32 count = 0;
|
||||
for (PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
|
||||
{
|
||||
Player *plr = sObjectMgr->GetPlayer(i->first);
|
||||
Player *plr = ObjectAccessor::FindPlayer(i->first);
|
||||
|
||||
// PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters
|
||||
// MODERATOR, GAME MASTER, ADMINISTRATOR can see all
|
||||
@@ -585,7 +585,7 @@ void Channel::List(Player* player)
|
||||
void Channel::Announce(uint64 p)
|
||||
{
|
||||
uint32 sec = 0;
|
||||
Player *plr = sObjectMgr->GetPlayer(p);
|
||||
Player *plr = ObjectAccessor::FindPlayer(p);
|
||||
if (plr)
|
||||
sec = plr->GetSession()->GetSecurity();
|
||||
|
||||
@@ -623,7 +623,7 @@ void Channel::Say(uint64 p, const char *what, uint32 lang)
|
||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
|
||||
lang = LANG_UNIVERSAL;
|
||||
|
||||
Player *plr = sObjectMgr->GetPlayer(p);
|
||||
Player *plr = ObjectAccessor::FindPlayer(p);
|
||||
|
||||
if (!IsOn(p))
|
||||
{
|
||||
@@ -666,7 +666,7 @@ void Channel::Invite(uint64 p, const char *newname)
|
||||
return;
|
||||
}
|
||||
|
||||
Player *newp = sObjectMgr->GetPlayer(newname);
|
||||
Player *newp = sObjectAccessor->FindPlayerByName(newname);
|
||||
if (!newp)
|
||||
{
|
||||
WorldPacket data;
|
||||
@@ -683,7 +683,7 @@ void Channel::Invite(uint64 p, const char *newname)
|
||||
return;
|
||||
}
|
||||
|
||||
Player *plr = sObjectMgr->GetPlayer(p);
|
||||
Player *plr = ObjectAccessor::FindPlayer(p);
|
||||
if (!plr)
|
||||
return;
|
||||
|
||||
@@ -749,7 +749,7 @@ void Channel::SendToAll(WorldPacket *data, uint64 p)
|
||||
{
|
||||
for (PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
|
||||
{
|
||||
Player *plr = sObjectMgr->GetPlayer(i->first);
|
||||
Player *plr = ObjectAccessor::FindPlayer(i->first);
|
||||
if (plr)
|
||||
{
|
||||
if (!p || !plr->GetSocial()->HasIgnore(GUID_LOPART(p)))
|
||||
@@ -764,7 +764,7 @@ void Channel::SendToAllButOne(WorldPacket *data, uint64 who)
|
||||
{
|
||||
if (i->first != who)
|
||||
{
|
||||
Player *plr = sObjectMgr->GetPlayer(i->first);
|
||||
Player *plr = ObjectAccessor::FindPlayer(i->first);
|
||||
if (plr)
|
||||
plr->GetSession()->SendPacket(data);
|
||||
}
|
||||
@@ -773,7 +773,7 @@ void Channel::SendToAllButOne(WorldPacket *data, uint64 who)
|
||||
|
||||
void Channel::SendToOne(WorldPacket *data, uint64 who)
|
||||
{
|
||||
Player *plr = sObjectMgr->GetPlayer(who);
|
||||
Player *plr = ObjectAccessor::FindPlayer(who);
|
||||
if (plr)
|
||||
plr->GetSession()->SendPacket(data);
|
||||
}
|
||||
|
||||
@@ -1064,7 +1064,7 @@ Player* ChatHandler::getSelectedPlayer()
|
||||
if (guid == 0)
|
||||
return m_session->GetPlayer();
|
||||
|
||||
return sObjectMgr->GetPlayer(guid);
|
||||
return ObjectAccessor::FindPlayer(guid);
|
||||
}
|
||||
|
||||
Unit* ChatHandler::getSelectedUnit()
|
||||
@@ -1374,7 +1374,7 @@ uint64 ChatHandler::extractGuidFromLink(char* text)
|
||||
if (!normalizePlayerName(name))
|
||||
return 0;
|
||||
|
||||
if (Player* player = sObjectMgr->GetPlayer(name.c_str()))
|
||||
if (Player* player = sObjectAccessor->FindPlayerByName(name.c_str()))
|
||||
return player->GetGUID();
|
||||
|
||||
if (uint64 guid = sObjectMgr->GetPlayerGUIDByName(name))
|
||||
@@ -1432,7 +1432,7 @@ bool ChatHandler::extractPlayerTarget(char* args, Player** player, uint64* playe
|
||||
return false;
|
||||
}
|
||||
|
||||
Player* pl = sObjectMgr->GetPlayer(name.c_str());
|
||||
Player* pl = sObjectAccessor->FindPlayerByName(name.c_str());
|
||||
|
||||
// if allowed player pointer
|
||||
if (player)
|
||||
@@ -1567,7 +1567,7 @@ bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player* &plr, G
|
||||
return false;
|
||||
}
|
||||
|
||||
plr = sObjectMgr->GetPlayer(name.c_str());
|
||||
plr = sObjectAccessor->FindPlayerByName(name.c_str());
|
||||
if (offline)
|
||||
guid = sObjectMgr->GetPlayerGUIDByName(name.c_str());
|
||||
}
|
||||
|
||||
@@ -3080,7 +3080,7 @@ bool ChatHandler::HandleBanInfoCharacterCommand(const char *args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
Player* target = sObjectMgr->GetPlayer(args);
|
||||
Player* target = sObjectAccessor->FindPlayerByName(args);
|
||||
uint32 target_guid = 0;
|
||||
std::string name(args);
|
||||
|
||||
@@ -4464,7 +4464,7 @@ bool ChatHandler::HandleFreezeCommand(const char *args)
|
||||
{
|
||||
name = TargetName;
|
||||
normalizePlayerName(name);
|
||||
player = sObjectMgr->GetPlayer(name.c_str()); //get player by name
|
||||
player = sObjectAccessor->FindPlayerByName(name.c_str());
|
||||
}
|
||||
|
||||
if (!player)
|
||||
@@ -4529,7 +4529,7 @@ bool ChatHandler::HandleUnFreezeCommand(const char *args)
|
||||
{
|
||||
name = TargetName;
|
||||
normalizePlayerName(name);
|
||||
player = sObjectMgr->GetPlayer(name.c_str()); //get player by name
|
||||
player = sObjectAccessor->FindPlayerByName(name.c_str());
|
||||
}
|
||||
|
||||
//effect
|
||||
|
||||
@@ -81,7 +81,7 @@ bool ChatHandler::HandleGMTicketGetByNameCommand(const char* args)
|
||||
|
||||
// Detect target's GUID
|
||||
uint64 guid = 0;
|
||||
if (Player* player = sObjectMgr->GetPlayer(name.c_str()))
|
||||
if (Player* player = sObjectAccessor->FindPlayerByName(name.c_str()))
|
||||
guid = player->GetGUID();
|
||||
else
|
||||
guid = sObjectMgr->GetPlayerGUIDByName(name);
|
||||
|
||||
@@ -159,7 +159,7 @@ void LFGMgr::Update(uint32 diff)
|
||||
{
|
||||
uint64 guid = itRoles->first;
|
||||
ClearState(guid);
|
||||
if (Player* plr = sObjectMgr->GetPlayer(guid))
|
||||
if (Player* plr = ObjectAccessor::FindPlayer(guid))
|
||||
{
|
||||
plr->GetSession()->SendLfgRoleCheckUpdate(roleCheck);
|
||||
|
||||
@@ -188,7 +188,7 @@ void LFGMgr::Update(uint32 diff)
|
||||
{
|
||||
pBoot->inProgress = false;
|
||||
for (LfgAnswerMap::const_iterator itVotes = pBoot->votes.begin(); itVotes != pBoot->votes.end(); ++itVotes)
|
||||
if (Player* plrg = sObjectMgr->GetPlayer(itVotes->first))
|
||||
if (Player* plrg = ObjectAccessor::FindPlayer(itVotes->first))
|
||||
if (plrg->GetGUID() != pBoot->victim)
|
||||
plrg->GetSession()->SendLfgBootPlayer(pBoot);
|
||||
delete pBoot;
|
||||
@@ -226,7 +226,7 @@ void LFGMgr::Update(uint32 diff)
|
||||
{
|
||||
guid = itPlayers->first;
|
||||
SetState(guid, LFG_STATE_PROPOSAL);
|
||||
if (Player* plr = sObjectMgr->GetPlayer(itPlayers->first))
|
||||
if (Player* plr = ObjectAccessor::FindPlayer(itPlayers->first))
|
||||
{
|
||||
Group *grp = plr->GetGroup();
|
||||
if (grp)
|
||||
@@ -291,7 +291,7 @@ void LFGMgr::Update(uint32 diff)
|
||||
}
|
||||
|
||||
for (LfgRolesMap::const_iterator itPlayer = queue->roles.begin(); itPlayer != queue->roles.end(); ++itPlayer)
|
||||
if (Player* plr = sObjectMgr->GetPlayer(itPlayer->first))
|
||||
if (Player* plr = ObjectAccessor::FindPlayer(itPlayer->first))
|
||||
plr->GetSession()->SendLfgQueueStatus(dungeonId, waitTime, m_WaitTimeAvg, m_WaitTimeTank, m_WaitTimeHealer, m_WaitTimeDps, queuedTime, queue->tanks, queue->healers, queue->dps);
|
||||
}
|
||||
}
|
||||
@@ -718,7 +718,7 @@ void LFGMgr::OfferContinue(Group* grp)
|
||||
if (grp)
|
||||
{
|
||||
uint64 gguid = grp->GetGUID();
|
||||
if (Player* leader = sObjectMgr->GetPlayer(grp->GetLeaderGUID()))
|
||||
if (Player* leader = ObjectAccessor::FindPlayer(grp->GetLeaderGUID()))
|
||||
leader->GetSession()->SendLfgOfferContinue(GetDungeon(gguid, false));
|
||||
}
|
||||
}
|
||||
@@ -862,7 +862,7 @@ bool LFGMgr::CheckCompatibility(LfgGuidList check, LfgProposal*& pProposal)
|
||||
PlayerSet players;
|
||||
for (LfgRolesMap::const_iterator it = rolesMap.begin(); it != rolesMap.end(); ++it)
|
||||
{
|
||||
Player* plr = sObjectMgr->GetPlayer(it->first);
|
||||
Player* plr = ObjectAccessor::FindPlayer(it->first);
|
||||
if (!plr)
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::CheckCompatibility: (%s) Warning! [" UI64FMTD "] offline! Marking as not compatibles!", strGuids.c_str(), it->first);
|
||||
else
|
||||
@@ -1027,7 +1027,7 @@ void LFGMgr::UpdateRoleCheck(uint64& gguid, uint64 guid /* = 0 */, uint8 roles /
|
||||
for (LfgRolesMap::const_iterator it = roleCheck->roles.begin(); it != roleCheck->roles.end(); ++it)
|
||||
{
|
||||
uint64 pguid = it->first;
|
||||
Player* plrg = sObjectMgr->GetPlayer(pguid);
|
||||
Player* plrg = ObjectAccessor::FindPlayer(pguid);
|
||||
if (!plrg)
|
||||
{
|
||||
if (roleCheck->state == LFG_ROLECHECK_FINISHED)
|
||||
@@ -1276,7 +1276,7 @@ void LFGMgr::UpdateProposal(uint32 proposalId, const uint64& guid, bool accept)
|
||||
bool allAnswered = true;
|
||||
for (LfgProposalPlayerMap::const_iterator itPlayers = pProposal->players.begin(); itPlayers != pProposal->players.end(); ++itPlayers)
|
||||
{
|
||||
if (Player* plr = sObjectMgr->GetPlayer(itPlayers->first))
|
||||
if (Player* plr = ObjectAccessor::FindPlayer(itPlayers->first))
|
||||
{
|
||||
if (itPlayers->first == pProposal->leader)
|
||||
players.push_front(plr);
|
||||
@@ -1442,7 +1442,7 @@ void LFGMgr::RemoveProposal(LfgProposalMap::iterator itProposal, LfgUpdateType t
|
||||
// Notify players
|
||||
for (LfgProposalPlayerMap::const_iterator it = pProposal->players.begin(); it != pProposal->players.end(); ++it)
|
||||
{
|
||||
Player* plr = sObjectMgr->GetPlayer(it->first);
|
||||
Player* plr = ObjectAccessor::FindPlayer(it->first);
|
||||
if (!plr)
|
||||
continue;
|
||||
|
||||
@@ -1609,7 +1609,7 @@ void LFGMgr::UpdateBoot(Player* plr, bool accept)
|
||||
if (pguid != pBoot->victim)
|
||||
{
|
||||
SetState(pguid, LFG_STATE_DUNGEON);
|
||||
if (Player* plrg = sObjectMgr->GetPlayer(pguid))
|
||||
if (Player* plrg = ObjectAccessor::FindPlayer(pguid))
|
||||
plrg->GetSession()->SendLfgBootPlayer(pBoot);
|
||||
}
|
||||
}
|
||||
@@ -1619,7 +1619,7 @@ void LFGMgr::UpdateBoot(Player* plr, bool accept)
|
||||
if (agreeNum == pBoot->votedNeeded) // Vote passed - Kick player
|
||||
{
|
||||
Player::RemoveFromGroup(grp, pBoot->victim);
|
||||
if (Player* victim = sObjectMgr->GetPlayer(pBoot->victim))
|
||||
if (Player* victim = ObjectAccessor::FindPlayer(pBoot->victim))
|
||||
{
|
||||
TeleportPlayer(victim, true, false);
|
||||
SetState(pBoot->victim, LFG_STATE_NONE);
|
||||
|
||||
@@ -51,7 +51,7 @@ void LFGScripts::OnAddMember(Group* group, uint64 guid)
|
||||
sLFGMgr->Leave(NULL, group);
|
||||
|
||||
if (sLFGMgr->GetState(guid) == LFG_STATE_QUEUED)
|
||||
if (Player *plr = sObjectMgr->GetPlayer(guid))
|
||||
if (Player *plr = ObjectAccessor::FindPlayer(guid))
|
||||
sLFGMgr->Leave(plr);
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ void LFGScripts::OnRemoveMember(Group* group, uint64 guid, RemoveMethod& method,
|
||||
}
|
||||
|
||||
sLFGMgr->ClearState(guid);
|
||||
if (Player *plr = sObjectMgr->GetPlayer(guid))
|
||||
if (Player *plr = ObjectAccessor::FindPlayer(guid))
|
||||
{
|
||||
/*
|
||||
if (method == GROUP_REMOVEMETHOD_LEAVE)
|
||||
@@ -116,13 +116,13 @@ void LFGScripts::OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLe
|
||||
return;
|
||||
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnChangeLeader [" UI64FMTD "]: old [" UI64FMTD "] new [" UI64FMTD "]", gguid, newLeaderGuid, oldLeaderGuid);
|
||||
Player *plr = sObjectMgr->GetPlayer(newLeaderGuid);
|
||||
Player *plr = ObjectAccessor::FindPlayer(newLeaderGuid);
|
||||
|
||||
LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_LEADER);
|
||||
if (plr)
|
||||
plr->GetSession()->SendLfgUpdateParty(updateData);
|
||||
|
||||
plr = sObjectMgr->GetPlayer(oldLeaderGuid);
|
||||
plr = ObjectAccessor::FindPlayer(oldLeaderGuid);
|
||||
if (plr)
|
||||
{
|
||||
updateData.updateType = LFG_UPDATETYPE_GROUP_DISBAND;
|
||||
|
||||
@@ -1120,7 +1120,7 @@ void GameObject::Use(Unit* user)
|
||||
|
||||
if (itr->second)
|
||||
{
|
||||
if (Player* ChairUser = sObjectMgr->GetPlayer(itr->second))
|
||||
if (Player* ChairUser = ObjectAccessor::FindPlayer(itr->second))
|
||||
if (ChairUser->IsSitState() && ChairUser->getStandState() != UNIT_STAND_STATE_SIT && ChairUser->GetExactDist2d(x_i, y_i) < 0.1f)
|
||||
continue; // This seat is already occupied by ChairUser. NOTE: Not sure if the ChairUser->getStandState() != UNIT_STAND_STATE_SIT check is required.
|
||||
else
|
||||
|
||||
@@ -504,7 +504,7 @@ ItemTemplate const *Item::GetTemplate() const
|
||||
|
||||
Player* Item::GetOwner()const
|
||||
{
|
||||
return sObjectMgr->GetPlayer(GetOwnerGUID());
|
||||
return ObjectAccessor::FindPlayer(GetOwnerGUID());
|
||||
}
|
||||
|
||||
uint32 Item::GetSkill()
|
||||
|
||||
@@ -1967,7 +1967,7 @@ void WorldObject::MonsterTextEmote(int32 textId, uint64 TargetGuid, bool IsBossE
|
||||
|
||||
void WorldObject::MonsterWhisper(const char* text, uint64 receiver, bool IsBossWhisper)
|
||||
{
|
||||
Player* player = sObjectMgr->GetPlayer(receiver);
|
||||
Player* player = ObjectAccessor::FindPlayer(receiver);
|
||||
if (!player || !player->GetSession())
|
||||
return;
|
||||
|
||||
@@ -1981,7 +1981,7 @@ void WorldObject::MonsterWhisper(const char* text, uint64 receiver, bool IsBossW
|
||||
|
||||
void WorldObject::MonsterWhisper(int32 textId, uint64 receiver, bool IsBossWhisper)
|
||||
{
|
||||
Player* player = sObjectMgr->GetPlayer(receiver);
|
||||
Player* player = ObjectAccessor::FindPlayer(receiver);
|
||||
if (!player || !player->GetSession())
|
||||
return;
|
||||
|
||||
|
||||
@@ -19274,7 +19274,7 @@ void Player::Whisper(const std::string& text, uint32 language, uint64 receiver)
|
||||
if (!isAddonMessage) // if not addon data
|
||||
language = LANG_UNIVERSAL; // whispers should always be readable
|
||||
|
||||
Player *rPlayer = sObjectMgr->GetPlayer(receiver);
|
||||
Player *rPlayer = ObjectAccessor::FindPlayer(receiver);
|
||||
|
||||
std::string _text(text);
|
||||
sScriptMgr->OnPlayerChat(this, CHAT_MSG_WHISPER, language, _text, rPlayer);
|
||||
@@ -19755,7 +19755,7 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type)
|
||||
uint64 petitionguid = MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_ITEM);
|
||||
|
||||
// send update if charter owner in game
|
||||
Player* owner = sObjectMgr->GetPlayer(ownerguid);
|
||||
Player* owner = ObjectAccessor::FindPlayer(ownerguid);
|
||||
if (owner)
|
||||
owner->GetSession()->SendPetitionQueryOpcode(petitionguid);
|
||||
|
||||
|
||||
@@ -14753,7 +14753,7 @@ void Unit::ClearComboPointHolders()
|
||||
{
|
||||
uint32 lowguid = *m_ComboPointHolders.begin();
|
||||
|
||||
Player* plr = sObjectMgr->GetPlayer(MAKE_NEW_GUID(lowguid, 0, HIGHGUID_PLAYER));
|
||||
Player* plr = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(lowguid, 0, HIGHGUID_PLAYER));
|
||||
if (plr && plr->GetComboTarget() == GetGUID()) // recheck for safe
|
||||
plr->ClearComboPoints(); // remove also guid from m_ComboPointHolders;
|
||||
else
|
||||
@@ -15365,7 +15365,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
|
||||
group->UpdateLooterGuid(creature, true);
|
||||
if (group->GetLooterGuid())
|
||||
{
|
||||
looter = sObjectMgr->GetPlayer(group->GetLooterGuid());
|
||||
looter = ObjectAccessor::FindPlayer(group->GetLooterGuid());
|
||||
if (looter)
|
||||
{
|
||||
creature->SetLootRecipient(looter); // update creature loot recipient to the allowed looter.
|
||||
|
||||
@@ -2015,7 +2015,7 @@ uint64 ObjectMgr::GetPlayerGUIDByName(std::string name) const
|
||||
bool ObjectMgr::GetPlayerNameByGUID(const uint64 &guid, std::string &name) const
|
||||
{
|
||||
// prevent DB access for online player
|
||||
if (Player* player = GetPlayer(guid))
|
||||
if (Player* player = ObjectAccessor::FindPlayer(guid))
|
||||
{
|
||||
name = player->GetName();
|
||||
return true;
|
||||
@@ -2035,7 +2035,7 @@ bool ObjectMgr::GetPlayerNameByGUID(const uint64 &guid, std::string &name) const
|
||||
uint32 ObjectMgr::GetPlayerTeamByGUID(const uint64 &guid) const
|
||||
{
|
||||
// prevent DB access for online player
|
||||
if (Player* player = GetPlayer(guid))
|
||||
if (Player* player = ObjectAccessor::FindPlayer(guid))
|
||||
{
|
||||
return Player::TeamForRace(player->getRace());
|
||||
}
|
||||
@@ -2054,7 +2054,7 @@ uint32 ObjectMgr::GetPlayerTeamByGUID(const uint64 &guid) const
|
||||
uint32 ObjectMgr::GetPlayerAccountIdByGUID(const uint64 &guid) const
|
||||
{
|
||||
// prevent DB access for online player
|
||||
if (Player* player = GetPlayer(guid))
|
||||
if (Player* player = ObjectAccessor::FindPlayer(guid))
|
||||
{
|
||||
return player->GetSession()->GetAccountId();
|
||||
}
|
||||
@@ -5427,7 +5427,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
|
||||
|
||||
Player *pl = NULL;
|
||||
if (serverUp)
|
||||
pl = GetPlayer((uint64)m->receiver);
|
||||
pl = ObjectAccessor::FindPlayer((uint64)m->receiver);
|
||||
|
||||
if (pl && pl->m_mailsLoaded)
|
||||
{ // this code will run very improbably (the time is between 4 and 5 am, in game is online a player, who has old mail
|
||||
|
||||
@@ -616,8 +616,6 @@ class ObjectMgr
|
||||
|
||||
typedef std::map<uint32, uint32> CharacterConversionMap;
|
||||
|
||||
Player* GetPlayer(const char* name) const { return sObjectAccessor->FindPlayerByName(name);}
|
||||
Player* GetPlayer(uint64 guid) const { return ObjectAccessor::FindPlayer(guid); }
|
||||
Player* GetPlayerByLowGUID(uint32 lowguid) const;
|
||||
|
||||
GameObjectTemplate const* GetGameObjectTemplate(uint32 entry);
|
||||
|
||||
@@ -217,7 +217,7 @@ void Group::ConvertToRaid()
|
||||
|
||||
// update quest related GO states (quest activity dependent from raid membership)
|
||||
for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
|
||||
if (Player* player = sObjectMgr->GetPlayer(citr->guid))
|
||||
if (Player* player = ObjectAccessor::FindPlayer(citr->guid))
|
||||
player->UpdateForQuestWorldObjects();
|
||||
}
|
||||
|
||||
@@ -400,7 +400,7 @@ bool Group::RemoveMember(const uint64 &guid, const RemoveMethod &method /*= GROU
|
||||
// remove member and change leader (if need) only if strong more 2 members _before_ member remove (BG allow 1 member group)
|
||||
if (GetMembersCount() > (isBGGroup() ? 1u : 2u))
|
||||
{
|
||||
Player* player = sObjectMgr->GetPlayer(guid);
|
||||
Player* player = ObjectAccessor::FindPlayer(guid);
|
||||
if (player)
|
||||
{
|
||||
// Battleground group handling
|
||||
@@ -478,7 +478,7 @@ bool Group::RemoveMember(const uint64 &guid, const RemoveMethod &method /*= GROU
|
||||
{
|
||||
for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
|
||||
{
|
||||
if (sObjectMgr->GetPlayer(itr->guid))
|
||||
if (ObjectAccessor::FindPlayer(itr->guid))
|
||||
{
|
||||
ChangeLeader(itr->guid);
|
||||
break;
|
||||
@@ -505,7 +505,7 @@ void Group::ChangeLeader(const uint64 &guid)
|
||||
if (slot == m_memberSlots.end())
|
||||
return;
|
||||
|
||||
Player* player = sObjectMgr->GetPlayer(slot->guid);
|
||||
Player* player = ObjectAccessor::FindPlayer(slot->guid);
|
||||
|
||||
// Don't allow switching leader to offline players
|
||||
if (!player)
|
||||
@@ -557,7 +557,7 @@ void Group::Disband(bool hideDestroy /* = false */)
|
||||
Player* player;
|
||||
for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
|
||||
{
|
||||
player = sObjectMgr->GetPlayer(citr->guid);
|
||||
player = ObjectAccessor::FindPlayer(citr->guid);
|
||||
if (!player)
|
||||
continue;
|
||||
|
||||
@@ -643,7 +643,7 @@ void Group::SendLootStartRoll(uint32 CountDown, uint32 mapid, const Roll &r)
|
||||
|
||||
for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr != r.playerVote.end(); ++itr)
|
||||
{
|
||||
Player *p = sObjectMgr->GetPlayer(itr->first);
|
||||
Player *p = ObjectAccessor::FindPlayer(itr->first);
|
||||
if (!p || !p->GetSession())
|
||||
continue;
|
||||
|
||||
@@ -667,7 +667,7 @@ void Group::SendLootRoll(const uint64& SourceGuid, const uint64& TargetGuid, uin
|
||||
|
||||
for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr != r.playerVote.end(); ++itr)
|
||||
{
|
||||
Player *p = sObjectMgr->GetPlayer(itr->first);
|
||||
Player *p = ObjectAccessor::FindPlayer(itr->first);
|
||||
if (!p || !p->GetSession())
|
||||
continue;
|
||||
|
||||
@@ -690,7 +690,7 @@ void Group::SendLootRollWon(const uint64& SourceGuid, const uint64& TargetGuid,
|
||||
|
||||
for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr != r.playerVote.end(); ++itr)
|
||||
{
|
||||
Player *p = sObjectMgr->GetPlayer(itr->first);
|
||||
Player *p = ObjectAccessor::FindPlayer(itr->first);
|
||||
if (!p || !p->GetSession())
|
||||
continue;
|
||||
|
||||
@@ -710,7 +710,7 @@ void Group::SendLootAllPassed(uint32 NumberOfPlayers, const Roll &r)
|
||||
|
||||
for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr != r.playerVote.end(); ++itr)
|
||||
{
|
||||
Player *p = sObjectMgr->GetPlayer(itr->first);
|
||||
Player *p = ObjectAccessor::FindPlayer(itr->first);
|
||||
if (!p || !p->GetSession())
|
||||
continue;
|
||||
|
||||
@@ -799,7 +799,7 @@ void Group::GroupLoot(Loot *loot, WorldObject* pLootedObject)
|
||||
{
|
||||
for (Roll::PlayerVote::const_iterator itr=r->playerVote.begin(); itr != r->playerVote.end(); ++itr)
|
||||
{
|
||||
Player *p = sObjectMgr->GetPlayer(itr->first);
|
||||
Player *p = ObjectAccessor::FindPlayer(itr->first);
|
||||
if (!p || !p->GetSession())
|
||||
continue;
|
||||
|
||||
@@ -890,7 +890,7 @@ void Group::NeedBeforeGreed(Loot *loot, WorldObject* pLootedObject)
|
||||
{
|
||||
for (Roll::PlayerVote::const_iterator itr=r->playerVote.begin(); itr != r->playerVote.end(); ++itr)
|
||||
{
|
||||
Player *p = sObjectMgr->GetPlayer(itr->first);
|
||||
Player *p = ObjectAccessor::FindPlayer(itr->first);
|
||||
if (!p || !p->GetSession())
|
||||
continue;
|
||||
|
||||
@@ -1040,7 +1040,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers)
|
||||
}
|
||||
}
|
||||
SendLootRollWon(0, maxguid, maxresul, ROLL_NEED, *roll);
|
||||
player = sObjectMgr->GetPlayer(maxguid);
|
||||
player = ObjectAccessor::FindPlayer(maxguid);
|
||||
|
||||
if (player && player->GetSession())
|
||||
{
|
||||
@@ -1090,7 +1090,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers)
|
||||
}
|
||||
}
|
||||
SendLootRollWon(0, maxguid, maxresul, rollvote, *roll);
|
||||
player = sObjectMgr->GetPlayer(maxguid);
|
||||
player = ObjectAccessor::FindPlayer(maxguid);
|
||||
|
||||
if (player && player->GetSession())
|
||||
{
|
||||
@@ -1187,7 +1187,7 @@ void Group::SendUpdate()
|
||||
Player* player;
|
||||
for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
|
||||
{
|
||||
player = sObjectMgr->GetPlayer(citr->guid);
|
||||
player = ObjectAccessor::FindPlayer(citr->guid);
|
||||
if (!player || !player->GetSession() || player->GetGroup() != this)
|
||||
continue;
|
||||
|
||||
@@ -1210,7 +1210,7 @@ void Group::SendUpdate()
|
||||
if (citr->guid == citr2->guid)
|
||||
continue;
|
||||
|
||||
Player* member = sObjectMgr->GetPlayer(citr2->guid);
|
||||
Player* member = ObjectAccessor::FindPlayer(citr2->guid);
|
||||
|
||||
uint8 onlineState = (member) ? MEMBER_STATUS_ONLINE : MEMBER_STATUS_OFFLINE;
|
||||
onlineState = onlineState | ((isBGGroup()) ? MEMBER_STATUS_PVP : 0);
|
||||
@@ -1284,7 +1284,7 @@ void Group::OfflineReadyCheck()
|
||||
{
|
||||
for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
|
||||
{
|
||||
Player *pl = sObjectMgr->GetPlayer(citr->guid);
|
||||
Player *pl = ObjectAccessor::FindPlayer(citr->guid);
|
||||
if (!pl || !pl->GetSession())
|
||||
{
|
||||
WorldPacket data(MSG_RAID_READY_CHECK_CONFIRM, 9);
|
||||
@@ -1351,7 +1351,7 @@ void Group::ChangeMembersGroup(const uint64 &guid, const uint8 &group)
|
||||
if (!isBGGroup())
|
||||
CharacterDatabase.PExecute("UPDATE group_member SET subgroup='%u' WHERE memberGuid='%u'", group, GUID_LOPART(guid));
|
||||
|
||||
Player* player = sObjectMgr->GetPlayer(guid);
|
||||
Player* player = ObjectAccessor::FindPlayer(guid);
|
||||
|
||||
// In case the moved player is online, update the player object with the new sub group references
|
||||
if (player)
|
||||
@@ -1740,7 +1740,7 @@ void Group::BroadcastGroupUpdate(void)
|
||||
for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
|
||||
{
|
||||
|
||||
Player *pp = sObjectMgr->GetPlayer(citr->guid);
|
||||
Player *pp = ObjectAccessor::FindPlayer(citr->guid);
|
||||
if (pp && pp->IsInWorld())
|
||||
{
|
||||
pp->ForceValuesUpdateAtIndex(UNIT_FIELD_BYTES_2);
|
||||
@@ -1756,7 +1756,7 @@ void Group::ResetMaxEnchantingLevel()
|
||||
Player *pMember = NULL;
|
||||
for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
|
||||
{
|
||||
pMember = sObjectMgr->GetPlayer(citr->guid);
|
||||
pMember = ObjectAccessor::FindPlayer(citr->guid);
|
||||
if (pMember && m_maxEnchantingLevel < pMember->GetSkillValue(SKILL_ENCHANTING))
|
||||
m_maxEnchantingLevel = pMember->GetSkillValue(SKILL_ENCHANTING);
|
||||
}
|
||||
|
||||
@@ -2065,7 +2065,7 @@ void Guild::BroadcastPacket(WorldPacket* packet) const
|
||||
// Members handling
|
||||
bool Guild::AddMember(const uint64& guid, uint8 rankId)
|
||||
{
|
||||
Player* player = sObjectMgr->GetPlayer(guid);
|
||||
Player* player = ObjectAccessor::FindPlayer(guid);
|
||||
// Player cannot be in guild
|
||||
if (player)
|
||||
{
|
||||
@@ -2135,7 +2135,7 @@ bool Guild::AddMember(const uint64& guid, uint8 rankId)
|
||||
void Guild::DeleteMember(const uint64& guid, bool isDisbanding, bool isKicked)
|
||||
{
|
||||
uint32 lowguid = GUID_LOPART(guid);
|
||||
Player* player = sObjectMgr->GetPlayer(guid);
|
||||
Player* player = ObjectAccessor::FindPlayer(guid);
|
||||
|
||||
// Guild master can be deleted when loading guild and guid doesn't exist in characters table
|
||||
// or when he is removed from guild by gm command
|
||||
|
||||
@@ -288,7 +288,7 @@ private:
|
||||
void ResetTabTimes();
|
||||
void ResetMoneyTime();
|
||||
|
||||
inline Player* FindPlayer() const { return sObjectMgr->GetPlayer(m_guid); }
|
||||
inline Player* FindPlayer() const { return ObjectAccessor::FindPlayer(m_guid); }
|
||||
|
||||
private:
|
||||
uint32 m_guildId;
|
||||
|
||||
@@ -128,7 +128,7 @@ void MailDraft::deleteIncludedItems(SQLTransaction& trans, bool inDB /*= false*/
|
||||
|
||||
void MailDraft::SendReturnToSender(uint32 sender_acc, uint32 sender_guid, uint32 receiver_guid, SQLTransaction& trans)
|
||||
{
|
||||
Player* receiver = sObjectMgr->GetPlayer(MAKE_NEW_GUID(receiver_guid, 0, HIGHGUID_PLAYER));
|
||||
Player* receiver = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(receiver_guid, 0, HIGHGUID_PLAYER));
|
||||
|
||||
uint32 rc_account = 0;
|
||||
if (!receiver)
|
||||
|
||||
@@ -36,7 +36,7 @@ void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket & recvData)
|
||||
recvData >> guid;
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "Inspect Arena stats (GUID: %u TypeId: %u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid)));
|
||||
|
||||
if (Player* player = sObjectMgr->GetPlayer(guid))
|
||||
if (Player* player = ObjectAccessor::FindPlayer(guid))
|
||||
{
|
||||
for (uint8 i = 0; i < MAX_ARENA_SLOT; ++i)
|
||||
{
|
||||
|
||||
@@ -285,7 +285,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
|
||||
}
|
||||
|
||||
// impossible have online own another character (use this for speedup check in case online owner)
|
||||
Player* auction_owner = sObjectMgr->GetPlayer(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER));
|
||||
Player* auction_owner = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER));
|
||||
if (!auction_owner && sObjectMgr->GetPlayerAccountIdByGUID(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER)) == pl->GetSession()->GetAccountId())
|
||||
{
|
||||
//you cannot bid your another character auction:
|
||||
|
||||
@@ -260,11 +260,11 @@ void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket & /*recv_
|
||||
uint32 count1 = 0; //always constant zero?
|
||||
uint32 count2 = 0; //count of next fields
|
||||
|
||||
Player *ali_plr = sObjectMgr->GetPlayer(((BattlegroundWS*)bg)->GetAllianceFlagPickerGUID());
|
||||
Player *ali_plr = ObjectAccessor::FindPlayer(((BattlegroundWS*)bg)->GetAllianceFlagPickerGUID());
|
||||
if (ali_plr)
|
||||
++count2;
|
||||
|
||||
Player *horde_plr = sObjectMgr->GetPlayer(((BattlegroundWS*)bg)->GetHordeFlagPickerGUID());
|
||||
Player *horde_plr = ObjectAccessor::FindPlayer(((BattlegroundWS*)bg)->GetHordeFlagPickerGUID());
|
||||
if (horde_plr)
|
||||
++count2;
|
||||
|
||||
@@ -799,7 +799,7 @@ void WorldSession::HandleReportPvPAFK(WorldPacket & recv_data)
|
||||
{
|
||||
uint64 playerGuid;
|
||||
recv_data >> playerGuid;
|
||||
Player *reportedPlayer = sObjectMgr->GetPlayer(playerGuid);
|
||||
Player *reportedPlayer = ObjectAccessor::FindPlayer(playerGuid);
|
||||
|
||||
if (!reportedPlayer)
|
||||
{
|
||||
|
||||
@@ -702,7 +702,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data)
|
||||
recv_data >> guid;
|
||||
|
||||
// can't delete loaded character
|
||||
if (sObjectMgr->GetPlayer(guid))
|
||||
if (ObjectAccessor::FindPlayer(guid))
|
||||
return;
|
||||
|
||||
uint32 accountId = 0;
|
||||
|
||||
@@ -262,7 +262,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data)
|
||||
break;
|
||||
}
|
||||
|
||||
Player* player = sObjectMgr->GetPlayer(to.c_str());
|
||||
Player* player = sObjectAccessor->FindPlayerByName(to.c_str());
|
||||
uint32 tSecurity = GetSecurity();
|
||||
uint32 pSecurity = player ? player->GetSession()->GetSecurity() : SEC_PLAYER;
|
||||
if (!player || (tSecurity == SEC_PLAYER && pSecurity > SEC_PLAYER && !player->isAcceptWhispers()))
|
||||
@@ -584,7 +584,7 @@ void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recv_data)
|
||||
recv_data >> iguid;
|
||||
recv_data >> unk; // probably related to spam reporting
|
||||
|
||||
Player* player = sObjectMgr->GetPlayer(iguid);
|
||||
Player* player = ObjectAccessor::FindPlayer(iguid);
|
||||
if (!player || !player->GetSession())
|
||||
return;
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket & recv_data)
|
||||
return;
|
||||
}
|
||||
|
||||
Player* player = sObjectMgr->GetPlayer(membername.c_str());
|
||||
Player* player = sObjectAccessor->FindPlayerByName(membername.c_str());
|
||||
|
||||
// no player
|
||||
if (!player)
|
||||
@@ -218,7 +218,7 @@ void WorldSession::HandleGroupAcceptOpcode(WorldPacket& recv_data)
|
||||
return;
|
||||
}
|
||||
|
||||
Player* leader = sObjectMgr->GetPlayer(group->GetLeaderGUID());
|
||||
Player* leader = ObjectAccessor::FindPlayer(group->GetLeaderGUID());
|
||||
|
||||
// Forming a new group, create it
|
||||
if (!group->IsCreated())
|
||||
@@ -252,7 +252,7 @@ void WorldSession::HandleGroupDeclineOpcode(WorldPacket & /*recv_data*/)
|
||||
if (!group) return;
|
||||
|
||||
// Remember leader if online (group pointer will be invalid if group gets disbanded)
|
||||
Player *leader = sObjectMgr->GetPlayer(group->GetLeaderGUID());
|
||||
Player *leader = ObjectAccessor::FindPlayer(group->GetLeaderGUID());
|
||||
|
||||
// uninvite, group can be deleted
|
||||
GetPlayer()->UninviteFromGroup();
|
||||
@@ -370,7 +370,7 @@ void WorldSession::HandleGroupSetLeaderOpcode(WorldPacket & recv_data)
|
||||
uint64 guid;
|
||||
recv_data >> guid;
|
||||
|
||||
Player* player = sObjectMgr->GetPlayer(guid);
|
||||
Player* player = ObjectAccessor::FindPlayer(guid);
|
||||
|
||||
/** error handling **/
|
||||
if (!player || !group->IsLeader(GetPlayer()->GetGUID()) || player->GetGroup() != group)
|
||||
@@ -591,7 +591,7 @@ void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket & recv_data)
|
||||
if (!group->HasFreeSlotSubGroup(groupNr))
|
||||
return;
|
||||
|
||||
Player *movedPlayer = sObjectMgr->GetPlayer(name.c_str());
|
||||
Player* movedPlayer = sObjectAccessor->FindPlayerByName(name.c_str());
|
||||
uint64 guid;
|
||||
if (movedPlayer)
|
||||
{
|
||||
|
||||
@@ -419,7 +419,7 @@ void WorldSession::SendLfgRoleCheckUpdate(const LfgRoleCheck* pRoleCheck)
|
||||
data << uint64(guid); // Guid
|
||||
data << uint8(roles > 0); // Ready
|
||||
data << uint32(roles); // Roles
|
||||
Player* plr = sObjectMgr->GetPlayer(guid);
|
||||
Player* plr = ObjectAccessor::FindPlayer(guid);
|
||||
data << uint8(plr ? plr->getLevel() : 0); // Level
|
||||
|
||||
for (LfgRolesMap::const_iterator it = pRoleCheck->roles.begin(); it != pRoleCheck->roles.end(); ++it)
|
||||
@@ -432,7 +432,7 @@ void WorldSession::SendLfgRoleCheckUpdate(const LfgRoleCheck* pRoleCheck)
|
||||
data << uint64(guid); // Guid
|
||||
data << uint8(roles > 0); // Ready
|
||||
data << uint32(roles); // Roles
|
||||
plr = sObjectMgr->GetPlayer(guid);
|
||||
plr = ObjectAccessor::FindPlayer(guid);
|
||||
data << uint8(plr ? plr->getLevel() : 0); // Level
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
|
||||
return;
|
||||
}
|
||||
|
||||
Player *receive = sObjectMgr->GetPlayer(rc);
|
||||
Player *receive = ObjectAccessor::FindPlayer(rc);
|
||||
|
||||
uint32 rc_team = 0;
|
||||
uint8 mails_count = 0; //do not allow to send to one player more than 100 mails
|
||||
@@ -436,7 +436,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data)
|
||||
if (m->COD > 0) //if there is COD, take COD money from player and send them to sender by mail
|
||||
{
|
||||
uint64 sender_guid = MAKE_NEW_GUID(m->sender, 0, HIGHGUID_PLAYER);
|
||||
Player *receive = sObjectMgr->GetPlayer(sender_guid);
|
||||
Player *receive = ObjectAccessor::FindPlayer(sender_guid);
|
||||
|
||||
uint32 sender_accId = 0;
|
||||
|
||||
|
||||
@@ -1205,7 +1205,7 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data)
|
||||
|
||||
_player->SetSelection(guid);
|
||||
|
||||
Player *plr = sObjectMgr->GetPlayer(guid);
|
||||
Player *plr = ObjectAccessor::FindPlayer(guid);
|
||||
if (!plr) // wrong player
|
||||
return;
|
||||
|
||||
@@ -1234,7 +1234,7 @@ void WorldSession::HandleInspectHonorStatsOpcode(WorldPacket& recv_data)
|
||||
uint64 guid;
|
||||
recv_data >> guid;
|
||||
|
||||
Player* player = sObjectMgr->GetPlayer(guid);
|
||||
Player* player = ObjectAccessor::FindPlayer(guid);
|
||||
|
||||
if (!player)
|
||||
{
|
||||
@@ -1306,7 +1306,7 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
|
||||
return;
|
||||
}
|
||||
|
||||
Player *plr = sObjectMgr->GetPlayer(charname.c_str());
|
||||
Player *plr = sObjectAccessor->FindPlayerByName(charname.c_str());
|
||||
|
||||
if (!plr)
|
||||
{
|
||||
@@ -1669,7 +1669,7 @@ void WorldSession::HandleQueryInspectAchievements(WorldPacket & recv_data)
|
||||
uint64 guid;
|
||||
recv_data.readPackGUID(guid);
|
||||
|
||||
Player* player = sObjectMgr->GetPlayer(guid);
|
||||
Player* player = ObjectAccessor::FindPlayer(guid);
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
|
||||
@@ -541,7 +541,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
|
||||
SendPacket(&data);
|
||||
|
||||
// update for owner if online
|
||||
if (Player *owner = sObjectMgr->GetPlayer(ownerguid))
|
||||
if (Player *owner = ObjectAccessor::FindPlayer(ownerguid))
|
||||
owner->GetSession()->SendPacket(&data);
|
||||
return;
|
||||
}
|
||||
@@ -564,7 +564,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
|
||||
// item->SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1+1, signs);
|
||||
|
||||
// update for owner if online
|
||||
if (Player *owner = sObjectMgr->GetPlayer(ownerguid))
|
||||
if (Player *owner = ObjectAccessor::FindPlayer(ownerguid))
|
||||
owner->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
@@ -585,7 +585,7 @@ void WorldSession::HandlePetitionDeclineOpcode(WorldPacket & recv_data)
|
||||
Field *fields = result->Fetch();
|
||||
ownerguid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
|
||||
|
||||
Player *owner = sObjectMgr->GetPlayer(ownerguid);
|
||||
Player *owner = ObjectAccessor::FindPlayer(ownerguid);
|
||||
if (owner) // petition owner online
|
||||
{
|
||||
WorldPacket data(MSG_PETITION_DECLINE, 8);
|
||||
|
||||
@@ -126,7 +126,7 @@ void WorldSession::HandleNameQueryOpcode(WorldPacket & recv_data)
|
||||
|
||||
recv_data >> guid;
|
||||
|
||||
Player *pChar = sObjectMgr->GetPlayer(guid);
|
||||
Player *pChar = ObjectAccessor::FindPlayer(guid);
|
||||
|
||||
if (pChar)
|
||||
SendNameQueryOpcode(pChar);
|
||||
|
||||
@@ -713,7 +713,7 @@ void Spell::SelectSpellTargets()
|
||||
case SPELL_EFFECT_SUMMON_PLAYER:
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->GetSelection())
|
||||
{
|
||||
Player* target = sObjectMgr->GetPlayer(m_caster->ToPlayer()->GetSelection());
|
||||
Player* target = ObjectAccessor::FindPlayer(m_caster->ToPlayer()->GetSelection());
|
||||
if (target)
|
||||
AddUnitTarget(target, i);
|
||||
}
|
||||
@@ -5230,7 +5230,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
if (!m_caster->ToPlayer()->GetSelection())
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
Player* target = sObjectMgr->GetPlayer(m_caster->ToPlayer()->GetSelection());
|
||||
Player* target = ObjectAccessor::FindPlayer(m_caster->ToPlayer()->GetSelection());
|
||||
if (!target || m_caster->ToPlayer() == target || !target->IsInSameRaidWith(m_caster->ToPlayer()))
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
|
||||
@@ -320,7 +320,7 @@ void CreatureTextMgr::SendChatPacket(WorldPacket* data, WorldObject* source, Cha
|
||||
{
|
||||
if (range == TEXT_RANGE_NORMAL)//ignores team and gmOnly
|
||||
{
|
||||
Player* player = sObjectMgr->GetPlayer(whisperGuid);
|
||||
Player* player = ObjectAccessor::FindPlayer(whisperGuid);
|
||||
if (!player || !player->GetSession())
|
||||
return;
|
||||
player->GetSession()->SendPacket(data);
|
||||
|
||||
@@ -90,10 +90,10 @@ public:
|
||||
bool IsAssignedNotTo(const uint64& guid) const { return IsAssigned() && !IsAssignedTo(guid); }
|
||||
|
||||
uint32 GetId() const { return _id; }
|
||||
Player* GetPlayer() const { return sObjectMgr->GetPlayer(_playerGuid); }
|
||||
Player* GetPlayer() const { return ObjectAccessor::FindPlayer(_playerGuid); }
|
||||
std::string GetPlayerName() const { return _playerName; }
|
||||
std::string GetMessage() const { return _message; }
|
||||
Player* GetAssignedPlayer() const { return sObjectMgr->GetPlayer(_assignedTo); }
|
||||
Player* GetAssignedPlayer() const { return ObjectAccessor::FindPlayer(_assignedTo); }
|
||||
const uint64& GetAssignedToGUID() const { return _assignedTo; }
|
||||
std::string GetAssignedToName() const
|
||||
{
|
||||
|
||||
@@ -2319,7 +2319,7 @@ bool World::RemoveBanAccount(BanMode mode, std::string nameOrIP)
|
||||
/// Ban an account or ban an IP address, duration will be parsed using TimeStringToSecs if it is positive, otherwise permban
|
||||
BanReturn World::BanCharacter(std::string name, std::string duration, std::string reason, std::string author)
|
||||
{
|
||||
Player* pBanned = sObjectMgr->GetPlayer(name.c_str());
|
||||
Player* pBanned = sObjectAccessor->FindPlayerByName(name.c_str());
|
||||
uint32 guid = 0;
|
||||
|
||||
uint32 duration_secs = TimeStringToSecs(duration);
|
||||
@@ -2360,7 +2360,7 @@ BanReturn World::BanCharacter(std::string name, std::string duration, std::strin
|
||||
/// Remove a ban from a character
|
||||
bool World::RemoveBanCharacter(std::string name)
|
||||
{
|
||||
Player* pBanned = sObjectMgr->GetPlayer(name.c_str());
|
||||
Player* pBanned = sObjectAccessor->FindPlayerByName(name.c_str());
|
||||
uint32 guid = 0;
|
||||
|
||||
/// Pick a player to ban if not online
|
||||
|
||||
@@ -1040,7 +1040,7 @@ public:
|
||||
uint64 receiver_guid= atol(receiver_str);
|
||||
|
||||
// check online security
|
||||
if (handler->HasLowerSecurity(sObjectMgr->GetPlayer(receiver_guid), 0))
|
||||
if (handler->HasLowerSecurity(ObjectAccessor::FindPlayer(receiver_guid), 0))
|
||||
return false;
|
||||
|
||||
creature->MonsterWhisper(text, receiver_guid);
|
||||
|
||||
@@ -311,7 +311,7 @@ void OPvPCapturePointZM_GraveYard::SetBeaconState(uint32 controlling_faction)
|
||||
if (m_FlagCarrierGUID)
|
||||
{
|
||||
// remove flag from carrier, reset flag carrier guid
|
||||
Player* p = sObjectMgr->GetPlayer(m_FlagCarrierGUID);
|
||||
Player* p = ObjectAccessor::FindPlayer(m_FlagCarrierGUID);
|
||||
if (p)
|
||||
{
|
||||
p->RemoveAurasDueToSpell(ZM_BATTLE_STANDARD_A);
|
||||
|
||||
@@ -447,7 +447,7 @@ bool ChatHandler::HandleCharacterEraseCommand(const char* args){
|
||||
uint64 character_guid;
|
||||
uint32 account_id;
|
||||
|
||||
Player* player = sObjectMgr->GetPlayer(character_name.c_str());
|
||||
Player* player = sObjectAccessor->FindPlayerByName(character_name.c_str());
|
||||
if (player)
|
||||
{
|
||||
character_guid = player->GetGUID();
|
||||
|
||||
Reference in New Issue
Block a user