mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[7690] Move GetCreature/GetGameobject to class Map.
* This let get objects at map without reference to player or another object. * Simplify future implementation for per-map storage for like objects
This commit is contained in:
parent
ee9ea143d1
commit
fc0e1ecdf1
20 changed files with 118 additions and 127 deletions
|
|
@ -266,9 +266,9 @@ void BattleGround::Update(uint32 diff)
|
||||||
if (!plr)
|
if (!plr)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!sh)
|
if (!sh && plr->IsInWorld())
|
||||||
{
|
{
|
||||||
sh = ObjectAccessor::GetCreature(*plr, itr->first);
|
sh = plr->GetMap()->GetCreature(itr->first);
|
||||||
// only for visual effect
|
// only for visual effect
|
||||||
if (sh)
|
if (sh)
|
||||||
sh->CastSpell(sh, SPELL_SPIRIT_HEAL, true); // Spirit Heal, effect 117
|
sh->CastSpell(sh, SPELL_SPIRIT_HEAL, true); // Spirit Heal, effect 117
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ void WorldSession::HandleBattleGroundHelloOpcode( WorldPacket & recv_data )
|
||||||
recv_data >> guid;
|
recv_data >> guid;
|
||||||
sLog.outDebug( "WORLD: Recvd CMSG_BATTLEMASTER_HELLO Message from: " I64FMT, guid);
|
sLog.outDebug( "WORLD: Recvd CMSG_BATTLEMASTER_HELLO Message from: " I64FMT, guid);
|
||||||
|
|
||||||
Creature *unit = ObjectAccessor::GetCreature(*_player, guid);
|
Creature *unit = GetPlayer()->GetMap()->GetCreature(guid);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -102,7 +102,7 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
|
||||||
if (_player->InBattleGround())
|
if (_player->InBattleGround())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Creature *unit = ObjectAccessor::GetCreature(*_player, guid);
|
Creature *unit = GetPlayer()->GetMap()->GetCreature(guid);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -595,7 +595,7 @@ void WorldSession::HandleAreaSpiritHealerQueryOpcode( WorldPacket & recv_data )
|
||||||
uint64 guid;
|
uint64 guid;
|
||||||
recv_data >> guid;
|
recv_data >> guid;
|
||||||
|
|
||||||
Creature *unit = ObjectAccessor::GetCreature(*_player, guid);
|
Creature *unit = GetPlayer()->GetMap()->GetCreature(guid);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -618,7 +618,7 @@ void WorldSession::HandleAreaSpiritHealerQueueOpcode( WorldPacket & recv_data )
|
||||||
uint64 guid;
|
uint64 guid;
|
||||||
recv_data >> guid;
|
recv_data >> guid;
|
||||||
|
|
||||||
Creature *unit = ObjectAccessor::GetCreature(*_player, guid);
|
Creature *unit = GetPlayer()->GetMap()->GetCreature(guid);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -647,7 +647,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
||||||
|
|
||||||
recv_data >> guid >> arenaslot >> asGroup >> isRated;
|
recv_data >> guid >> arenaslot >> asGroup >> isRated;
|
||||||
|
|
||||||
Creature *unit = ObjectAccessor::GetCreature(*_player, guid);
|
Creature *unit = GetPlayer()->GetMap()->GetCreature(guid);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1315,7 +1315,7 @@ GameObject* ChatHandler::GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid
|
||||||
|
|
||||||
Player* pl = m_session->GetPlayer();
|
Player* pl = m_session->GetPlayer();
|
||||||
|
|
||||||
GameObject* obj = ObjectAccessor::GetGameObject(*pl, MAKE_NEW_GUID(lowguid, entry, HIGHGUID_GAMEOBJECT));
|
GameObject* obj = pl->GetMap()->GetGameObject(MAKE_NEW_GUID(lowguid, entry, HIGHGUID_GAMEOBJECT));
|
||||||
|
|
||||||
if(!obj && objmgr.GetGOData(lowguid)) // guid is DB guid of object
|
if(!obj && objmgr.GetGOData(lowguid)) // guid is DB guid of object
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -627,11 +627,6 @@ void GameObject::DeleteFromDB()
|
||||||
WorldDatabase.PExecuteLog("DELETE FROM game_event_gameobject WHERE guid = '%u'", m_DBTableGuid);
|
WorldDatabase.PExecuteLog("DELETE FROM game_event_gameobject WHERE guid = '%u'", m_DBTableGuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
GameObject* GameObject::GetGameObject(WorldObject& object, uint64 guid)
|
|
||||||
{
|
|
||||||
return ObjectAccessor::GetGameObject(object,guid);
|
|
||||||
}
|
|
||||||
|
|
||||||
GameObjectInfo const *GameObject::GetGOInfo() const
|
GameObjectInfo const *GameObject::GetGOInfo() const
|
||||||
{
|
{
|
||||||
return m_goInfo;
|
return m_goInfo;
|
||||||
|
|
|
||||||
|
|
@ -427,7 +427,6 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
|
||||||
|
|
||||||
bool Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, uint32 go_state);
|
bool Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, uint32 go_state);
|
||||||
void Update(uint32 p_time);
|
void Update(uint32 p_time);
|
||||||
static GameObject* GetGameObject(WorldObject& object, uint64 guid);
|
|
||||||
GameObjectInfo const* GetGOInfo() const;
|
GameObjectInfo const* GetGOInfo() const;
|
||||||
|
|
||||||
bool IsTransport() const;
|
bool IsTransport() const;
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ bool ChatHandler::HandleNpcWhisperCommand(const char* args)
|
||||||
char* text = strtok(NULL, "");
|
char* text = strtok(NULL, "");
|
||||||
|
|
||||||
uint64 guid = m_session->GetPlayer()->GetSelection();
|
uint64 guid = m_session->GetPlayer()->GetSelection();
|
||||||
Creature* pCreature = ObjectAccessor::GetCreature(*m_session->GetPlayer(), guid);
|
Creature* pCreature = m_session->GetPlayer()->GetMap()->GetCreature(guid);
|
||||||
|
|
||||||
if(!pCreature || !receiver_str || !text)
|
if(!pCreature || !receiver_str || !text)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -506,7 +506,7 @@ bool ChatHandler::HandleGameObjectTargetCommand(const char* args)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameObject* target = ObjectAccessor::GetGameObject(*m_session->GetPlayer(),MAKE_NEW_GUID(lowguid,id,HIGHGUID_GAMEOBJECT));
|
GameObject* target = m_session->GetPlayer()->GetMap()->GetGameObject(MAKE_NEW_GUID(lowguid,id,HIGHGUID_GAMEOBJECT));
|
||||||
|
|
||||||
PSendSysMessage(LANG_GAMEOBJECT_DETAIL, lowguid, goI->name, lowguid, id, x, y, z, mapid, o);
|
PSendSysMessage(LANG_GAMEOBJECT_DETAIL, lowguid, goI->name, lowguid, id, x, y, z, mapid, o);
|
||||||
|
|
||||||
|
|
@ -1338,7 +1338,7 @@ bool ChatHandler::HandleNpcDeleteCommand(const char* args)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (CreatureData const* cr_data = objmgr.GetCreatureData(lowguid))
|
if (CreatureData const* cr_data = objmgr.GetCreatureData(lowguid))
|
||||||
unit = ObjectAccessor::GetCreature(*m_session->GetPlayer(), MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT));
|
unit = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
unit = getSelectedCreature();
|
unit = getSelectedCreature();
|
||||||
|
|
@ -2606,7 +2606,7 @@ bool ChatHandler::HandleWpAddCommand(const char* args)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
target = ObjectAccessor::GetCreature(*m_session->GetPlayer(),MAKE_NEW_GUID(lowguid,data->id,HIGHGUID_UNIT));
|
target = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(lowguid,data->id,HIGHGUID_UNIT));
|
||||||
if(!target)
|
if(!target)
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_WAYPOINT_NOTFOUNDDBPROBLEM, lowguid);
|
PSendSysMessage(LANG_WAYPOINT_NOTFOUNDDBPROBLEM, lowguid);
|
||||||
|
|
@ -2640,7 +2640,7 @@ bool ChatHandler::HandleWpAddCommand(const char* args)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
target = ObjectAccessor::GetCreature(*m_session->GetPlayer(),MAKE_NEW_GUID(lowguid,data->id,HIGHGUID_UNIT));
|
target = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(lowguid,data->id,HIGHGUID_UNIT));
|
||||||
if(!target || target->isPet())
|
if(!target || target->isPet())
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_WAYPOINT_CREATNOTFOUND, lowguid);
|
PSendSysMessage(LANG_WAYPOINT_CREATNOTFOUND, lowguid);
|
||||||
|
|
@ -2855,7 +2855,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Creature* npcCreature = ObjectAccessor::GetCreature(*m_session->GetPlayer(), MAKE_NEW_GUID(lowguid, data->id, HIGHGUID_UNIT));
|
Creature* npcCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(lowguid, data->id, HIGHGUID_UNIT));
|
||||||
|
|
||||||
if( !npcCreature )
|
if( !npcCreature )
|
||||||
{
|
{
|
||||||
|
|
@ -2934,13 +2934,13 @@ bool ChatHandler::HandleWpModifyCommand(const char* args)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Creature* npcCreature = ObjectAccessor::GetCreature(*m_session->GetPlayer(), MAKE_NEW_GUID(lowguid, data->id, HIGHGUID_UNIT));
|
Creature* npcCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(lowguid, data->id, HIGHGUID_UNIT));
|
||||||
|
|
||||||
// wpCreature
|
// wpCreature
|
||||||
Creature* wpCreature = NULL;
|
Creature* wpCreature = NULL;
|
||||||
if( wpGuid != 0 )
|
if( wpGuid != 0 )
|
||||||
{
|
{
|
||||||
wpCreature = ObjectAccessor::GetCreature(*m_session->GetPlayer(),MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT));
|
wpCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT));
|
||||||
wpCreature->DeleteFromDB();
|
wpCreature->DeleteFromDB();
|
||||||
wpCreature->CleanupsBeforeDelete();
|
wpCreature->CleanupsBeforeDelete();
|
||||||
wpCreature->AddObjectToRemoveList();
|
wpCreature->AddObjectToRemoveList();
|
||||||
|
|
@ -2995,7 +2995,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Creature* npcCreature = ObjectAccessor::GetCreature(*m_session->GetPlayer(), MAKE_NEW_GUID(lowguid, data->id, HIGHGUID_UNIT));
|
Creature* npcCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(lowguid, data->id, HIGHGUID_UNIT));
|
||||||
|
|
||||||
// wpCreature
|
// wpCreature
|
||||||
Creature* wpCreature = NULL;
|
Creature* wpCreature = NULL;
|
||||||
|
|
@ -3004,7 +3004,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args)
|
||||||
// Respawn the owner of the waypoints
|
// Respawn the owner of the waypoints
|
||||||
if( wpGuid != 0 )
|
if( wpGuid != 0 )
|
||||||
{
|
{
|
||||||
wpCreature = ObjectAccessor::GetCreature(*m_session->GetPlayer(),MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT));
|
wpCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT));
|
||||||
wpCreature->DeleteFromDB();
|
wpCreature->DeleteFromDB();
|
||||||
wpCreature->CleanupsBeforeDelete();
|
wpCreature->CleanupsBeforeDelete();
|
||||||
wpCreature->AddObjectToRemoveList();
|
wpCreature->AddObjectToRemoveList();
|
||||||
|
|
@ -3067,7 +3067,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args)
|
||||||
|
|
||||||
WaypointMgr.SetNodeText(lowguid, point, show_str, arg_str);
|
WaypointMgr.SetNodeText(lowguid, point, show_str, arg_str);
|
||||||
|
|
||||||
Creature* npcCreature = ObjectAccessor::GetCreature(*m_session->GetPlayer(), MAKE_NEW_GUID(lowguid, data->id, HIGHGUID_UNIT));
|
Creature* npcCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(lowguid, data->id, HIGHGUID_UNIT));
|
||||||
if(npcCreature)
|
if(npcCreature)
|
||||||
{
|
{
|
||||||
npcCreature->SetDefaultMovementType(WAYPOINT_MOTION_TYPE);
|
npcCreature->SetDefaultMovementType(WAYPOINT_MOTION_TYPE);
|
||||||
|
|
@ -3167,7 +3167,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
target = ObjectAccessor::GetCreature(*m_session->GetPlayer(),MAKE_NEW_GUID(lowguid,data->id,HIGHGUID_UNIT));
|
target = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(lowguid,data->id,HIGHGUID_UNIT));
|
||||||
|
|
||||||
if(!target)
|
if(!target)
|
||||||
{
|
{
|
||||||
|
|
@ -3238,7 +3238,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
|
||||||
uint32 model2 = fields[11].GetUInt32();
|
uint32 model2 = fields[11].GetUInt32();
|
||||||
|
|
||||||
// Get the creature for which we read the waypoint
|
// Get the creature for which we read the waypoint
|
||||||
Creature* wpCreature = ObjectAccessor::GetCreature(*m_session->GetPlayer(),MAKE_NEW_GUID(creGUID,VISUAL_WAYPOINT,HIGHGUID_UNIT));
|
Creature* wpCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(creGUID,VISUAL_WAYPOINT,HIGHGUID_UNIT));
|
||||||
|
|
||||||
PSendSysMessage(LANG_WAYPOINT_INFO_TITLE, point, (wpCreature ? wpCreature->GetName() : "<not found>"), creGUID);
|
PSendSysMessage(LANG_WAYPOINT_INFO_TITLE, point, (wpCreature ? wpCreature->GetName() : "<not found>"), creGUID);
|
||||||
PSendSysMessage(LANG_WAYPOINT_INFO_WAITTIME, waittime);
|
PSendSysMessage(LANG_WAYPOINT_INFO_WAITTIME, waittime);
|
||||||
|
|
@ -3275,7 +3275,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
|
||||||
{
|
{
|
||||||
Field *fields = result2->Fetch();
|
Field *fields = result2->Fetch();
|
||||||
uint32 wpguid = fields[0].GetUInt32();
|
uint32 wpguid = fields[0].GetUInt32();
|
||||||
Creature* pCreature = ObjectAccessor::GetCreature(*m_session->GetPlayer(),MAKE_NEW_GUID(wpguid,VISUAL_WAYPOINT,HIGHGUID_UNIT));
|
Creature* pCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpguid,VISUAL_WAYPOINT,HIGHGUID_UNIT));
|
||||||
|
|
||||||
if(!pCreature)
|
if(!pCreature)
|
||||||
{
|
{
|
||||||
|
|
@ -3474,10 +3474,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
|
||||||
{
|
{
|
||||||
Field *fields = result->Fetch();
|
Field *fields = result->Fetch();
|
||||||
uint32 guid = fields[0].GetUInt32();
|
uint32 guid = fields[0].GetUInt32();
|
||||||
Creature* pCreature = ObjectAccessor::GetCreature(*m_session->GetPlayer(),MAKE_NEW_GUID(guid,VISUAL_WAYPOINT,HIGHGUID_UNIT));
|
Creature* pCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(guid,VISUAL_WAYPOINT,HIGHGUID_UNIT));
|
||||||
|
|
||||||
//Creature* pCreature = ObjectAccessor::GetCreature(*m_session->GetPlayer(), guid);
|
|
||||||
|
|
||||||
if(!pCreature)
|
if(!pCreature)
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, guid);
|
PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, guid);
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,7 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
|
||||||
|
|
||||||
if (IS_GAMEOBJECT_GUID(lguid))
|
if (IS_GAMEOBJECT_GUID(lguid))
|
||||||
{
|
{
|
||||||
GameObject *go =
|
GameObject *go = player->GetMap()->GetGameObject(lguid);
|
||||||
ObjectAccessor::GetGameObject(*player, lguid);
|
|
||||||
|
|
||||||
// not check distance for GO in case owned GO (fishing bobber case, for example) or Fishing hole GO
|
// 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))
|
if (!go || (go->GetOwnerGUID() != _player->GetGUID() && go->GetGoType() != GAMEOBJECT_TYPE_FISHINGHOLE) && !go->IsWithinDistInMap(_player,INTERACTION_DISTANCE))
|
||||||
|
|
@ -70,8 +69,7 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Creature* pCreature =
|
Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lguid);
|
||||||
ObjectAccessor::GetCreature(*player, lguid);
|
|
||||||
|
|
||||||
bool ok_loot = pCreature && pCreature->isAlive() == (player->getClass()==CLASS_ROGUE && pCreature->lootForPickPocketed);
|
bool ok_loot = pCreature && pCreature->isAlive() == (player->getClass()==CLASS_ROGUE && pCreature->lootForPickPocketed);
|
||||||
|
|
||||||
|
|
@ -163,7 +161,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ )
|
||||||
{
|
{
|
||||||
case HIGHGUID_GAMEOBJECT:
|
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)
|
// 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)) )
|
if( pGameObject && (pGameObject->GetOwnerGUID()==_player->GetGUID() || pGameObject->IsWithinDistInMap(_player,INTERACTION_DISTANCE)) )
|
||||||
|
|
@ -188,7 +186,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ )
|
||||||
}
|
}
|
||||||
case HIGHGUID_UNIT:
|
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);
|
bool ok_loot = pCreature && pCreature->isAlive() == (player->getClass()==CLASS_ROGUE && pCreature->lootForPickPocketed);
|
||||||
|
|
||||||
|
|
@ -276,10 +274,12 @@ void WorldSession::DoLootRelease( uint64 lguid )
|
||||||
|
|
||||||
player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_LOOTING);
|
player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_LOOTING);
|
||||||
|
|
||||||
|
if(!player->IsInWorld())
|
||||||
|
return;
|
||||||
|
|
||||||
if (IS_GAMEOBJECT_GUID(lguid))
|
if (IS_GAMEOBJECT_GUID(lguid))
|
||||||
{
|
{
|
||||||
GameObject *go =
|
GameObject *go = GetPlayer()->GetMap()->GetGameObject(lguid);
|
||||||
ObjectAccessor::GetGameObject(*player, lguid);
|
|
||||||
|
|
||||||
// not check distance for GO in case owned GO (fishing bobber case, for example) or Fishing hole GO
|
// 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))
|
if (!go || (go->GetOwnerGUID() != _player->GetGUID() && go->GetGoType() != GAMEOBJECT_TYPE_FISHINGHOLE) && !go->IsWithinDistInMap(_player,INTERACTION_DISTANCE))
|
||||||
|
|
@ -401,7 +401,7 @@ void WorldSession::DoLootRelease( uint64 lguid )
|
||||||
}
|
}
|
||||||
else
|
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);
|
bool ok_loot = pCreature && pCreature->isAlive() == (player->getClass()==CLASS_ROGUE && pCreature->lootForPickPocketed);
|
||||||
if ( !ok_loot || !pCreature->IsWithinDistInMap(_player,INTERACTION_DISTANCE) )
|
if ( !ok_loot || !pCreature->IsWithinDistInMap(_player,INTERACTION_DISTANCE) )
|
||||||
|
|
@ -458,7 +458,7 @@ void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data )
|
||||||
|
|
||||||
if(IS_CREATURE_GUID(GetPlayer()->GetLootGUID()))
|
if(IS_CREATURE_GUID(GetPlayer()->GetLootGUID()))
|
||||||
{
|
{
|
||||||
Creature *pCreature = ObjectAccessor::GetCreature(*GetPlayer(), lootguid);
|
Creature *pCreature = GetPlayer()->GetMap()->GetCreature(lootguid);
|
||||||
if(!pCreature)
|
if(!pCreature)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -466,7 +466,7 @@ void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data )
|
||||||
}
|
}
|
||||||
else if(IS_GAMEOBJECT_GUID(GetPlayer()->GetLootGUID()))
|
else if(IS_GAMEOBJECT_GUID(GetPlayer()->GetLootGUID()))
|
||||||
{
|
{
|
||||||
GameObject *pGO = ObjectAccessor::GetGameObject(*GetPlayer(), lootguid);
|
GameObject *pGO = GetPlayer()->GetMap()->GetGameObject(lootguid);
|
||||||
if(!pGO)
|
if(!pGO)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2531,3 +2531,45 @@ void BattleGroundMap::UnloadAll(bool pForce)
|
||||||
|
|
||||||
Map::UnloadAll(pForce);
|
Map::UnloadAll(pForce);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Creature*
|
||||||
|
Map::GetCreature(uint64 guid)
|
||||||
|
{
|
||||||
|
Creature * ret = ObjectAccessor::GetObjectInWorld(guid, (Creature*)NULL);
|
||||||
|
if(!ret)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if(ret->GetMapId() != GetId())
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if(ret->GetInstanceId() != GetInstanceId())
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameObject*
|
||||||
|
Map::GetGameObject(uint64 guid)
|
||||||
|
{
|
||||||
|
GameObject * ret = ObjectAccessor::GetObjectInWorld(guid, (GameObject*)NULL);
|
||||||
|
if(!ret)
|
||||||
|
return NULL;
|
||||||
|
if(ret->GetMapId() != GetId())
|
||||||
|
return NULL;
|
||||||
|
if(ret->GetInstanceId() != GetInstanceId())
|
||||||
|
return NULL;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
DynamicObject*
|
||||||
|
Map::GetDynamicObject(uint64 guid)
|
||||||
|
{
|
||||||
|
DynamicObject * ret = ObjectAccessor::GetObjectInWorld(guid, (DynamicObject*)NULL);
|
||||||
|
if(!ret)
|
||||||
|
return NULL;
|
||||||
|
if(ret->GetMapId() != GetId())
|
||||||
|
return NULL;
|
||||||
|
if(ret->GetInstanceId() != GetInstanceId())
|
||||||
|
return NULL;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -402,6 +402,10 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::Obj
|
||||||
void RemoveFromActive(T* obj) { RemoveFromActiveHelper(obj); }
|
void RemoveFromActive(T* obj) { RemoveFromActiveHelper(obj); }
|
||||||
|
|
||||||
void RemoveFromActive(Creature* obj);
|
void RemoveFromActive(Creature* obj);
|
||||||
|
|
||||||
|
Creature* GetCreature(uint64 guid);
|
||||||
|
GameObject* GetGameObject(uint64 guid);
|
||||||
|
DynamicObject* GetDynamicObject(uint64 guid);
|
||||||
private:
|
private:
|
||||||
void LoadMapAndVMap(int gx, int gy);
|
void LoadMapAndVMap(int gx, int gy);
|
||||||
void LoadVMap(int gx, int gy);
|
void LoadVMap(int gx, int gy);
|
||||||
|
|
|
||||||
|
|
@ -55,23 +55,7 @@ ObjectAccessor::GetCreatureOrPetOrVehicle(WorldObject const &u, uint64 guid)
|
||||||
if(Creature *unit = GetVehicle(guid))
|
if(Creature *unit = GetVehicle(guid))
|
||||||
return unit;
|
return unit;
|
||||||
|
|
||||||
return GetCreature(u, guid);
|
return u.GetMap()->GetCreature(guid);
|
||||||
}
|
|
||||||
|
|
||||||
Creature*
|
|
||||||
ObjectAccessor::GetCreature(WorldObject const &u, uint64 guid)
|
|
||||||
{
|
|
||||||
Creature * ret = GetObjectInWorld(guid, (Creature*)NULL);
|
|
||||||
if(!ret)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if(ret->GetMapId() != u.GetMapId())
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if(ret->GetInstanceId() != u.GetInstanceId())
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Unit*
|
Unit*
|
||||||
|
|
@ -117,13 +101,13 @@ Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const &p, uint64 guid, u
|
||||||
|
|
||||||
if(typemask & TYPEMASK_GAMEOBJECT)
|
if(typemask & TYPEMASK_GAMEOBJECT)
|
||||||
{
|
{
|
||||||
obj = GetGameObject(p,guid);
|
obj = p.GetMap()->GetGameObject(guid);
|
||||||
if(obj) return obj;
|
if(obj) return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(typemask & TYPEMASK_DYNAMICOBJECT)
|
if(typemask & TYPEMASK_DYNAMICOBJECT)
|
||||||
{
|
{
|
||||||
obj = GetDynamicObject(p,guid);
|
obj = p.GetMap()->GetDynamicObject(guid);
|
||||||
if(obj) return obj;
|
if(obj) return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -136,32 +120,6 @@ Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const &p, uint64 guid, u
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameObject*
|
|
||||||
ObjectAccessor::GetGameObject(WorldObject const &u, uint64 guid)
|
|
||||||
{
|
|
||||||
GameObject * ret = GetObjectInWorld(guid, (GameObject*)NULL);
|
|
||||||
if(!ret)
|
|
||||||
return NULL;
|
|
||||||
if(ret->GetMapId() != u.GetMapId())
|
|
||||||
return NULL;
|
|
||||||
if(ret->GetInstanceId() != u.GetInstanceId())
|
|
||||||
return NULL;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
DynamicObject*
|
|
||||||
ObjectAccessor::GetDynamicObject(WorldObject const &u, uint64 guid)
|
|
||||||
{
|
|
||||||
DynamicObject * ret = GetObjectInWorld(guid, (DynamicObject*)NULL);
|
|
||||||
if(!ret)
|
|
||||||
return NULL;
|
|
||||||
if(ret->GetMapId() != u.GetMapId())
|
|
||||||
return NULL;
|
|
||||||
if(ret->GetInstanceId() != u.GetInstanceId())
|
|
||||||
return NULL;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
Player*
|
Player*
|
||||||
ObjectAccessor::FindPlayer(uint64 guid)
|
ObjectAccessor::FindPlayer(uint64 guid)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -137,13 +137,10 @@ class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::Singleton<ObjectAccessor,
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object* GetObjectByTypeMask(WorldObject const &, uint64, uint32 typemask);
|
static Object* GetObjectByTypeMask(WorldObject const &, uint64, uint32 typemask);
|
||||||
static Creature* GetCreature(WorldObject const &, uint64);
|
|
||||||
static Creature* GetCreatureOrPetOrVehicle(WorldObject const &, uint64);
|
static Creature* GetCreatureOrPetOrVehicle(WorldObject const &, uint64);
|
||||||
static Unit* GetUnit(WorldObject const &, uint64);
|
static Unit* GetUnit(WorldObject const &, uint64);
|
||||||
static Pet* GetPet(Unit const &, uint64 guid) { return GetPet(guid); }
|
static Pet* GetPet(Unit const &, uint64 guid) { return GetPet(guid); }
|
||||||
static Player* GetPlayer(Unit const &, uint64 guid) { return FindPlayer(guid); }
|
static Player* GetPlayer(Unit const &, uint64 guid) { return FindPlayer(guid); }
|
||||||
static GameObject* GetGameObject(WorldObject const &, uint64);
|
|
||||||
static DynamicObject* GetDynamicObject(WorldObject const &, uint64);
|
|
||||||
static Corpse* GetCorpse(WorldObject const &u, uint64 guid);
|
static Corpse* GetCorpse(WorldObject const &u, uint64 guid);
|
||||||
static Pet* GetPet(uint64 guid);
|
static Pet* GetPet(uint64 guid);
|
||||||
static Vehicle* GetVehicle(uint64 guid);
|
static Vehicle* GetVehicle(uint64 guid);
|
||||||
|
|
|
||||||
|
|
@ -1596,7 +1596,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
||||||
// ObjectAccessor won't find the flag.
|
// ObjectAccessor won't find the flag.
|
||||||
if (duel && GetMapId()!=mapid)
|
if (duel && GetMapId()!=mapid)
|
||||||
{
|
{
|
||||||
GameObject* obj = ObjectAccessor::GetGameObject(*this, GetUInt64Value(PLAYER_DUEL_ARBITER));
|
GameObject* obj = GetMap()->GetGameObject(GetUInt64Value(PLAYER_DUEL_ARBITER));
|
||||||
if (obj)
|
if (obj)
|
||||||
DuelComplete(DUEL_FLED);
|
DuelComplete(DUEL_FLED);
|
||||||
}
|
}
|
||||||
|
|
@ -1962,7 +1962,7 @@ Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// exist
|
// exist
|
||||||
Creature *unit = ObjectAccessor::GetCreature(*this,guid);
|
Creature *unit = GetMap()->GetCreature(guid);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
@ -2002,7 +2002,7 @@ Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask)
|
||||||
|
|
||||||
GameObject* Player::GetGameObjectIfCanInteractWith(uint64 guid, GameobjectTypes type) const
|
GameObject* Player::GetGameObjectIfCanInteractWith(uint64 guid, GameobjectTypes type) const
|
||||||
{
|
{
|
||||||
if(GameObject *go = ObjectAccessor::GetGameObject(*this,guid))
|
if(GameObject *go = GetMap()->GetGameObject(guid))
|
||||||
{
|
{
|
||||||
if(go->GetGoType() == type)
|
if(go->GetGoType() == type)
|
||||||
{
|
{
|
||||||
|
|
@ -6129,7 +6129,7 @@ void Player::CheckDuelDistance(time_t currTime)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint64 duelFlagGUID = GetUInt64Value(PLAYER_DUEL_ARBITER);
|
uint64 duelFlagGUID = GetUInt64Value(PLAYER_DUEL_ARBITER);
|
||||||
GameObject* obj = ObjectAccessor::GetGameObject(*this, duelFlagGUID);
|
GameObject* obj = GetMap()->GetGameObject(duelFlagGUID);
|
||||||
if(!obj)
|
if(!obj)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -6196,7 +6196,7 @@ void Player::DuelComplete(DuelCompleteType type)
|
||||||
duel->opponent->GetSession()->SendPacket(&data);*/
|
duel->opponent->GetSession()->SendPacket(&data);*/
|
||||||
|
|
||||||
//Remove Duel Flag object
|
//Remove Duel Flag object
|
||||||
GameObject* obj = ObjectAccessor::GetGameObject(*this, GetUInt64Value(PLAYER_DUEL_ARBITER));
|
GameObject* obj = GetMap()->GetGameObject(GetUInt64Value(PLAYER_DUEL_ARBITER));
|
||||||
if(obj)
|
if(obj)
|
||||||
duel->initiator->RemoveGameObject(obj,true);
|
duel->initiator->RemoveGameObject(obj,true);
|
||||||
|
|
||||||
|
|
@ -7101,8 +7101,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
|
||||||
if (IS_GAMEOBJECT_GUID(guid))
|
if (IS_GAMEOBJECT_GUID(guid))
|
||||||
{
|
{
|
||||||
sLog.outDebug(" IS_GAMEOBJECT_GUID(guid)");
|
sLog.outDebug(" IS_GAMEOBJECT_GUID(guid)");
|
||||||
GameObject *go =
|
GameObject *go = GetMap()->GetGameObject(guid);
|
||||||
ObjectAccessor::GetGameObject(*this, guid);
|
|
||||||
|
|
||||||
// not check distance for GO in case owned GO (fishing bobber case, for example)
|
// not check distance for GO in case owned GO (fishing bobber case, for example)
|
||||||
// And permit out of range GO with no owner in case fishing hole
|
// And permit out of range GO with no owner in case fishing hole
|
||||||
|
|
@ -7215,7 +7214,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Creature *creature = ObjectAccessor::GetCreature(*this, guid);
|
Creature *creature = GetMap()->GetCreature(guid);
|
||||||
|
|
||||||
// must be in range and creature must be alive for pickpocket and must be dead for another loot
|
// must be in range and creature must be alive for pickpocket and must be dead for another loot
|
||||||
if (!creature || creature->isAlive()!=(loot_type == LOOT_PICKPOCKETING) || !creature->IsWithinDistInMap(this,INTERACTION_DISTANCE))
|
if (!creature || creature->isAlive()!=(loot_type == LOOT_PICKPOCKETING) || !creature->IsWithinDistInMap(this,INTERACTION_DISTANCE))
|
||||||
|
|
@ -11835,7 +11834,7 @@ void Player::PrepareQuestMenu( uint64 guid )
|
||||||
Object *pObject;
|
Object *pObject;
|
||||||
QuestRelations* pObjectQR;
|
QuestRelations* pObjectQR;
|
||||||
QuestRelations* pObjectQIR;
|
QuestRelations* pObjectQIR;
|
||||||
Creature *pCreature = ObjectAccessor::GetCreature(*this, guid);
|
Creature *pCreature = GetMap()->GetCreature(guid);
|
||||||
if( pCreature )
|
if( pCreature )
|
||||||
{
|
{
|
||||||
pObject = (Object*)pCreature;
|
pObject = (Object*)pCreature;
|
||||||
|
|
@ -11844,7 +11843,7 @@ void Player::PrepareQuestMenu( uint64 guid )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GameObject *pGameObject = ObjectAccessor::GetGameObject(*this, guid);
|
GameObject *pGameObject = GetMap()->GetGameObject(guid);
|
||||||
if( pGameObject )
|
if( pGameObject )
|
||||||
{
|
{
|
||||||
pObject = (Object*)pGameObject;
|
pObject = (Object*)pGameObject;
|
||||||
|
|
@ -11921,7 +11920,7 @@ void Player::SendPreparedQuest( uint64 guid )
|
||||||
qe._Delay = 0;
|
qe._Delay = 0;
|
||||||
qe._Emote = 0;
|
qe._Emote = 0;
|
||||||
std::string title = "";
|
std::string title = "";
|
||||||
Creature *pCreature = ObjectAccessor::GetCreature(*this, guid);
|
Creature *pCreature = GetMap()->GetCreature(guid);
|
||||||
if( pCreature )
|
if( pCreature )
|
||||||
{
|
{
|
||||||
uint32 textid = pCreature->GetNpcTextId();
|
uint32 textid = pCreature->GetNpcTextId();
|
||||||
|
|
@ -11985,7 +11984,7 @@ Quest const * Player::GetNextQuest( uint64 guid, Quest const *pQuest )
|
||||||
QuestRelations* pObjectQR;
|
QuestRelations* pObjectQR;
|
||||||
QuestRelations* pObjectQIR;
|
QuestRelations* pObjectQIR;
|
||||||
|
|
||||||
Creature *pCreature = ObjectAccessor::GetCreature(*this, guid);
|
Creature *pCreature = GetMap()->GetCreature(guid);
|
||||||
if( pCreature )
|
if( pCreature )
|
||||||
{
|
{
|
||||||
pObject = (Object*)pCreature;
|
pObject = (Object*)pCreature;
|
||||||
|
|
@ -11994,7 +11993,7 @@ Quest const * Player::GetNextQuest( uint64 guid, Quest const *pQuest )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GameObject *pGameObject = ObjectAccessor::GetGameObject(*this, guid);
|
GameObject *pGameObject = GetMap()->GetGameObject(guid);
|
||||||
if( pGameObject )
|
if( pGameObject )
|
||||||
{
|
{
|
||||||
pObject = (Object*)pGameObject;
|
pObject = (Object*)pGameObject;
|
||||||
|
|
|
||||||
|
|
@ -611,7 +611,7 @@ void WorldSession::HandleQuestgiverStatusQueryMultipleOpcode(WorldPacket& /*recv
|
||||||
|
|
||||||
if(IS_CREATURE_GUID(*itr))
|
if(IS_CREATURE_GUID(*itr))
|
||||||
{
|
{
|
||||||
Creature *questgiver = ObjectAccessor::GetCreature(*_player, *itr);
|
Creature *questgiver = GetPlayer()->GetMap()->GetCreature(*itr);
|
||||||
if(!questgiver || questgiver->IsHostileTo(_player))
|
if(!questgiver || questgiver->IsHostileTo(_player))
|
||||||
continue;
|
continue;
|
||||||
if(!questgiver->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER))
|
if(!questgiver->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER))
|
||||||
|
|
@ -626,7 +626,7 @@ void WorldSession::HandleQuestgiverStatusQueryMultipleOpcode(WorldPacket& /*recv
|
||||||
}
|
}
|
||||||
else if(IS_GAMEOBJECT_GUID(*itr))
|
else if(IS_GAMEOBJECT_GUID(*itr))
|
||||||
{
|
{
|
||||||
GameObject *questgiver = ObjectAccessor::GetGameObject(*_player, *itr);
|
GameObject *questgiver = GetPlayer()->GetMap()->GetGameObject(*itr);
|
||||||
if(!questgiver)
|
if(!questgiver)
|
||||||
continue;
|
continue;
|
||||||
if(questgiver->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER)
|
if(questgiver->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER)
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ void SpellCastTargets::setCorpseTarget(Corpse* corpse)
|
||||||
|
|
||||||
void SpellCastTargets::Update(Unit* caster)
|
void SpellCastTargets::Update(Unit* caster)
|
||||||
{
|
{
|
||||||
m_GOTarget = m_GOTargetGUID ? ObjectAccessor::GetGameObject(*caster,m_GOTargetGUID) : NULL;
|
m_GOTarget = m_GOTargetGUID ? caster->GetMap()->GetGameObject(m_GOTargetGUID) : NULL;
|
||||||
m_unitTarget = m_unitTargetGUID ?
|
m_unitTarget = m_unitTargetGUID ?
|
||||||
( m_unitTargetGUID==caster->GetGUID() ? caster : ObjectAccessor::GetUnit(*caster, m_unitTargetGUID) ) :
|
( m_unitTargetGUID==caster->GetGUID() ? caster : ObjectAccessor::GetUnit(*caster, m_unitTargetGUID) ) :
|
||||||
NULL;
|
NULL;
|
||||||
|
|
@ -956,7 +956,7 @@ void Spell::AddGOTarget(GameObject* pVictim, uint32 effIndex)
|
||||||
|
|
||||||
void Spell::AddGOTarget(uint64 goGUID, uint32 effIndex)
|
void Spell::AddGOTarget(uint64 goGUID, uint32 effIndex)
|
||||||
{
|
{
|
||||||
GameObject* go = ObjectAccessor::GetGameObject(*m_caster, goGUID);
|
GameObject* go = m_caster->GetMap()->GetGameObject(goGUID);
|
||||||
if (go)
|
if (go)
|
||||||
AddGOTarget(go, effIndex);
|
AddGOTarget(go, effIndex);
|
||||||
}
|
}
|
||||||
|
|
@ -1233,7 +1233,7 @@ void Spell::DoAllEffectOnTarget(GOTargetInfo *target)
|
||||||
if(!effectMask)
|
if(!effectMask)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GameObject* go = ObjectAccessor::GetGameObject(*m_caster, target->targetGUID);
|
GameObject* go = m_caster->GetMap()->GetGameObject(target->targetGUID);
|
||||||
if(!go)
|
if(!go)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -1784,7 +1784,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
|
||||||
// Check original caster is GO - set its coordinates as dst cast
|
// Check original caster is GO - set its coordinates as dst cast
|
||||||
WorldObject *caster = NULL;
|
WorldObject *caster = NULL;
|
||||||
if (IS_GAMEOBJECT_GUID(m_originalCasterGUID))
|
if (IS_GAMEOBJECT_GUID(m_originalCasterGUID))
|
||||||
caster = ObjectAccessor::GetGameObject(*m_caster, m_originalCasterGUID);
|
caster = m_caster->GetMap()->GetGameObject(m_originalCasterGUID);
|
||||||
if (!caster)
|
if (!caster)
|
||||||
caster = m_caster;
|
caster = m_caster;
|
||||||
// Set dest for targets
|
// Set dest for targets
|
||||||
|
|
@ -2716,7 +2716,7 @@ void Spell::update(uint32 difftime)
|
||||||
{
|
{
|
||||||
GOTargetInfo* target = &*ihit;
|
GOTargetInfo* target = &*ihit;
|
||||||
|
|
||||||
GameObject* go = ObjectAccessor::GetGameObject(*m_caster, target->targetGUID);
|
GameObject* go = m_caster->GetMap()->GetGameObject(target->targetGUID);
|
||||||
if(!go)
|
if(!go)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -3266,7 +3266,7 @@ void Spell::SendChannelStart(uint32 duration)
|
||||||
{
|
{
|
||||||
if(itr->effectMask & (1<<0) )
|
if(itr->effectMask & (1<<0) )
|
||||||
{
|
{
|
||||||
target = ObjectAccessor::GetGameObject(*m_caster, itr->targetGUID);
|
target = m_caster->GetMap()->GetGameObject(itr->targetGUID);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -5414,7 +5414,7 @@ bool Spell::CheckTarget( Unit* target, uint32 eff )
|
||||||
// Get GO cast coordinates if original caster -> GO
|
// Get GO cast coordinates if original caster -> GO
|
||||||
WorldObject *caster = NULL;
|
WorldObject *caster = NULL;
|
||||||
if (IS_GAMEOBJECT_GUID(m_originalCasterGUID))
|
if (IS_GAMEOBJECT_GUID(m_originalCasterGUID))
|
||||||
caster = ObjectAccessor::GetGameObject(*m_caster, m_originalCasterGUID);
|
caster = m_caster->GetMap()->GetGameObject(m_originalCasterGUID);
|
||||||
if (!caster)
|
if (!caster)
|
||||||
caster = m_caster;
|
caster = m_caster;
|
||||||
if(target!=m_caster && !target->IsWithinLOSInMap(caster))
|
if(target!=m_caster && !target->IsWithinLOSInMap(caster))
|
||||||
|
|
|
||||||
|
|
@ -5432,7 +5432,7 @@ void Spell::EffectSummonTotem(uint32 i)
|
||||||
uint64 guid = m_caster->m_TotemSlot[slot];
|
uint64 guid = m_caster->m_TotemSlot[slot];
|
||||||
if(guid != 0)
|
if(guid != 0)
|
||||||
{
|
{
|
||||||
Creature *OldTotem = ObjectAccessor::GetCreature(*m_caster, guid);
|
Creature *OldTotem = m_caster->GetMap()->GetCreature(guid);
|
||||||
if(OldTotem && OldTotem->isTotem())
|
if(OldTotem && OldTotem->isTotem())
|
||||||
((Totem*)OldTotem)->UnSummon();
|
((Totem*)OldTotem)->UnSummon();
|
||||||
}
|
}
|
||||||
|
|
@ -5632,7 +5632,7 @@ void Spell::EffectSummonObject(uint32 i)
|
||||||
{
|
{
|
||||||
GameObject* obj = NULL;
|
GameObject* obj = NULL;
|
||||||
if( m_caster )
|
if( m_caster )
|
||||||
obj = ObjectAccessor::GetGameObject(*m_caster, guid);
|
obj = m_caster->GetMap()->GetGameObject(guid);
|
||||||
|
|
||||||
if(obj) obj->Delete();
|
if(obj) obj->Delete();
|
||||||
m_caster->m_ObjectSlot[slot] = 0;
|
m_caster->m_ObjectSlot[slot] = 0;
|
||||||
|
|
@ -6114,7 +6114,7 @@ void Spell::EffectDestroyAllTotems(uint32 /*i*/)
|
||||||
if(!m_caster->m_TotemSlot[slot])
|
if(!m_caster->m_TotemSlot[slot])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Creature* totem = ObjectAccessor::GetCreature(*m_caster,m_caster->m_TotemSlot[slot]);
|
Creature* totem = m_caster->GetMap()->GetCreature(m_caster->m_TotemSlot[slot]);
|
||||||
if(totem && totem->isTotem())
|
if(totem && totem->isTotem())
|
||||||
{
|
{
|
||||||
uint32 spell_id = totem->GetUInt32Value(UNIT_CREATED_BY_SPELL);
|
uint32 spell_id = totem->GetUInt32Value(UNIT_CREATED_BY_SPELL);
|
||||||
|
|
|
||||||
|
|
@ -230,7 +230,7 @@ void WorldSession::HandleGameObjectUseOpcode( WorldPacket & recv_data )
|
||||||
if(_player->m_mover != _player)
|
if(_player->m_mover != _player)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GameObject *obj = ObjectAccessor::GetGameObject(*_player, guid);
|
GameObject *obj = GetPlayer()->GetMap()->GetGameObject(guid);
|
||||||
|
|
||||||
if(!obj)
|
if(!obj)
|
||||||
return;
|
return;
|
||||||
|
|
@ -254,7 +254,7 @@ void WorldSession::HandleGameobjectReportUse(WorldPacket& recvPacket)
|
||||||
if(_player->m_mover != _player)
|
if(_player->m_mover != _player)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GameObject* go = ObjectAccessor::GetGameObject(*_player,guid);
|
GameObject* go = GetPlayer()->GetMap()->GetGameObject(guid);
|
||||||
if(!go)
|
if(!go)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -471,7 +471,7 @@ void WorldSession::HandleTotemDestroy( WorldPacket& recvPacket)
|
||||||
if(!_player->m_TotemSlot[slotId])
|
if(!_player->m_TotemSlot[slotId])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Creature* totem = ObjectAccessor::GetCreature(*_player,_player->m_TotemSlot[slotId]);
|
Creature* totem = GetPlayer()->GetMap()->GetCreature(_player->m_TotemSlot[slotId]);
|
||||||
if(totem && totem->isTotem())
|
if(totem && totem->isTotem())
|
||||||
((Totem*)totem)->UnSummon();
|
((Totem*)totem)->UnSummon();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ void WorldSession::HandleTaxiNodeStatusQueryOpcode( WorldPacket & recv_data )
|
||||||
void WorldSession::SendTaxiStatus( uint64 guid )
|
void WorldSession::SendTaxiStatus( uint64 guid )
|
||||||
{
|
{
|
||||||
// cheating checks
|
// cheating checks
|
||||||
Creature *unit = ObjectAccessor::GetCreature(*_player, guid);
|
Creature *unit = GetPlayer()->GetMap()->GetCreature(guid);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WorldSession::SendTaxiStatus - Unit (GUID: %u) not found.", uint32(GUID_LOPART(guid)) );
|
sLog.outDebug( "WorldSession::SendTaxiStatus - Unit (GUID: %u) not found.", uint32(GUID_LOPART(guid)) );
|
||||||
|
|
|
||||||
|
|
@ -3984,7 +3984,7 @@ void Unit::RemoveDynObject(uint32 spellid)
|
||||||
return;
|
return;
|
||||||
for (DynObjectGUIDs::iterator i = m_dynObjGUIDs.begin(); i != m_dynObjGUIDs.end();)
|
for (DynObjectGUIDs::iterator i = m_dynObjGUIDs.begin(); i != m_dynObjGUIDs.end();)
|
||||||
{
|
{
|
||||||
DynamicObject* dynObj = ObjectAccessor::GetDynamicObject(*this,*i);
|
DynamicObject* dynObj = GetMap()->GetDynamicObject(*i);
|
||||||
if(!dynObj)
|
if(!dynObj)
|
||||||
{
|
{
|
||||||
i = m_dynObjGUIDs.erase(i);
|
i = m_dynObjGUIDs.erase(i);
|
||||||
|
|
@ -4003,7 +4003,7 @@ void Unit::RemoveAllDynObjects()
|
||||||
{
|
{
|
||||||
while(!m_dynObjGUIDs.empty())
|
while(!m_dynObjGUIDs.empty())
|
||||||
{
|
{
|
||||||
DynamicObject* dynObj = ObjectAccessor::GetDynamicObject(*this,*m_dynObjGUIDs.begin());
|
DynamicObject* dynObj = GetMap()->GetDynamicObject(*m_dynObjGUIDs.begin());
|
||||||
if(dynObj)
|
if(dynObj)
|
||||||
dynObj->Delete();
|
dynObj->Delete();
|
||||||
m_dynObjGUIDs.erase(m_dynObjGUIDs.begin());
|
m_dynObjGUIDs.erase(m_dynObjGUIDs.begin());
|
||||||
|
|
@ -4014,7 +4014,7 @@ DynamicObject * Unit::GetDynObject(uint32 spellId, uint32 effIndex)
|
||||||
{
|
{
|
||||||
for (DynObjectGUIDs::iterator i = m_dynObjGUIDs.begin(); i != m_dynObjGUIDs.end();)
|
for (DynObjectGUIDs::iterator i = m_dynObjGUIDs.begin(); i != m_dynObjGUIDs.end();)
|
||||||
{
|
{
|
||||||
DynamicObject* dynObj = ObjectAccessor::GetDynamicObject(*this,*i);
|
DynamicObject* dynObj = GetMap()->GetDynamicObject(*i);
|
||||||
if(!dynObj)
|
if(!dynObj)
|
||||||
{
|
{
|
||||||
i = m_dynObjGUIDs.erase(i);
|
i = m_dynObjGUIDs.erase(i);
|
||||||
|
|
@ -4032,7 +4032,7 @@ DynamicObject * Unit::GetDynObject(uint32 spellId)
|
||||||
{
|
{
|
||||||
for (DynObjectGUIDs::iterator i = m_dynObjGUIDs.begin(); i != m_dynObjGUIDs.end();)
|
for (DynObjectGUIDs::iterator i = m_dynObjGUIDs.begin(); i != m_dynObjGUIDs.end();)
|
||||||
{
|
{
|
||||||
DynamicObject* dynObj = ObjectAccessor::GetDynamicObject(*this,*i);
|
DynamicObject* dynObj = GetMap()->GetDynamicObject(*i);
|
||||||
if(!dynObj)
|
if(!dynObj)
|
||||||
{
|
{
|
||||||
i = m_dynObjGUIDs.erase(i);
|
i = m_dynObjGUIDs.erase(i);
|
||||||
|
|
@ -7259,7 +7259,7 @@ bool Unit::isAttackingPlayer() const
|
||||||
{
|
{
|
||||||
if(m_TotemSlot[i])
|
if(m_TotemSlot[i])
|
||||||
{
|
{
|
||||||
Creature *totem = ObjectAccessor::GetCreature(*this, m_TotemSlot[i]);
|
Creature *totem = GetMap()->GetCreature(m_TotemSlot[i]);
|
||||||
if(totem && totem->isAttackingPlayer())
|
if(totem && totem->isAttackingPlayer())
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -7417,7 +7417,7 @@ void Unit::UnsummonAllTotems()
|
||||||
if(!m_TotemSlot[i])
|
if(!m_TotemSlot[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Creature *OldTotem = ObjectAccessor::GetCreature(*this, m_TotemSlot[i]);
|
Creature *OldTotem = GetMap()->GetCreature(m_TotemSlot[i]);
|
||||||
if (OldTotem && OldTotem->isTotem())
|
if (OldTotem && OldTotem->isTotem())
|
||||||
((Totem*)OldTotem)->UnSummon();
|
((Totem*)OldTotem)->UnSummon();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "7689"
|
#define REVISION_NR "7690"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue