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