Core/ObjectMgr: Remove GetPlayer function (Remove double use of singletons)
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user