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