aboutsummaryrefslogtreecommitdiff
path: root/src/game/LootHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/LootHandler.cpp')
-rw-r--r--src/game/LootHandler.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/game/LootHandler.cpp b/src/game/LootHandler.cpp
index 6aded9b1f97..803fbdec5bd 100644
--- a/src/game/LootHandler.cpp
+++ b/src/game/LootHandler.cpp
@@ -46,8 +46,7 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
if (IS_GAMEOBJECT_GUID(lguid))
{
- GameObject *go =
- ObjectAccessor::GetGameObject(*player, lguid);
+ GameObject *go = player->GetMap()->GetGameObject(lguid);
// not check distance for GO in case owned GO (fishing bobber case, for example) or Fishing hole GO
if (!go || (go->GetOwnerGUID() != _player->GetGUID() && go->GetGoType() != GAMEOBJECT_TYPE_FISHINGHOLE) && !go->IsWithinDistInMap(_player,INTERACTION_DISTANCE))
@@ -82,8 +81,7 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
}
else
{
- Creature* pCreature =
- ObjectAccessor::GetCreature(*player, lguid);
+ Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lguid);
bool ok_loot = pCreature && pCreature->isAlive() == (player->getClass()==CLASS_ROGUE && pCreature->lootForPickPocketed);
@@ -175,7 +173,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ )
{
case HIGHGUID_GAMEOBJECT:
{
- GameObject *pGameObject = ObjectAccessor::GetGameObject(*GetPlayer(), guid);
+ GameObject *pGameObject = GetPlayer()->GetMap()->GetGameObject(guid);
// not check distance for GO in case owned GO (fishing bobber case, for example)
if( pGameObject && (pGameObject->GetOwnerGUID()==_player->GetGUID() || pGameObject->IsWithinDistInMap(_player,INTERACTION_DISTANCE)) )
@@ -200,7 +198,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ )
}
case HIGHGUID_UNIT:
{
- Creature* pCreature = ObjectAccessor::GetCreature(*GetPlayer(), guid);
+ Creature* pCreature = GetPlayer()->GetMap()->GetCreature(guid);
bool ok_loot = pCreature && pCreature->isAlive() == (player->getClass()==CLASS_ROGUE && pCreature->lootForPickPocketed);
@@ -288,10 +286,12 @@ void WorldSession::DoLootRelease( uint64 lguid )
player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_LOOTING);
+ if(!player->IsInWorld())
+ return;
+
if (IS_GAMEOBJECT_GUID(lguid))
{
- GameObject *go =
- ObjectAccessor::GetGameObject(*player, lguid);
+ GameObject *go = GetPlayer()->GetMap()->GetGameObject(lguid);
// not check distance for GO in case owned GO (fishing bobber case, for example) or Fishing hole GO
if (!go || (go->GetOwnerGUID() != _player->GetGUID() && go->GetGoType() != GAMEOBJECT_TYPE_FISHINGHOLE) && !go->IsWithinDistInMap(_player,INTERACTION_DISTANCE))
@@ -413,7 +413,7 @@ void WorldSession::DoLootRelease( uint64 lguid )
}
else
{
- Creature* pCreature = ObjectAccessor::GetCreature(*player, lguid);
+ Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lguid);
bool ok_loot = pCreature && pCreature->isAlive() == (player->getClass()==CLASS_ROGUE && pCreature->lootForPickPocketed);
if ( !ok_loot || !pCreature->IsWithinDistInMap(_player,INTERACTION_DISTANCE) )
@@ -470,7 +470,7 @@ void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data )
if(IS_CREATURE_GUID(GetPlayer()->GetLootGUID()))
{
- Creature *pCreature = ObjectAccessor::GetCreature(*GetPlayer(), lootguid);
+ Creature *pCreature = GetPlayer()->GetMap()->GetCreature(lootguid);
if(!pCreature)
return;
@@ -478,7 +478,7 @@ void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data )
}
else if(IS_GAMEOBJECT_GUID(GetPlayer()->GetLootGUID()))
{
- GameObject *pGO = ObjectAccessor::GetGameObject(*GetPlayer(), lootguid);
+ GameObject *pGO = GetPlayer()->GetMap()->GetGameObject(lootguid);
if(!pGO)
return;