diff options
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/BattleGround.cpp | 4 | ||||
| -rw-r--r-- | src/game/BattleGroundHandler.cpp | 10 | ||||
| -rw-r--r-- | src/game/Chat.cpp | 2 | ||||
| -rw-r--r-- | src/game/GameObject.cpp | 2 | ||||
| -rw-r--r-- | src/game/InstanceData.cpp | 2 | ||||
| -rw-r--r-- | src/game/Level1.cpp | 2 | ||||
| -rw-r--r-- | src/game/Level2.cpp | 17 | ||||
| -rw-r--r-- | src/game/LootHandler.cpp | 22 | ||||
| -rw-r--r-- | src/game/Map.cpp | 55 | ||||
| -rw-r--r-- | src/game/Map.h | 5 | ||||
| -rw-r--r-- | src/game/MiscHandler.cpp | 2 | ||||
| -rw-r--r-- | src/game/ObjectAccessor.cpp | 48 | ||||
| -rw-r--r-- | src/game/ObjectAccessor.h | 3 | ||||
| -rw-r--r-- | src/game/Player.cpp | 25 | ||||
| -rw-r--r-- | src/game/QuestHandler.cpp | 4 | ||||
| -rw-r--r-- | src/game/Spell.cpp | 12 | ||||
| -rw-r--r-- | src/game/SpellAuras.cpp | 2 | ||||
| -rw-r--r-- | src/game/SpellEffects.cpp | 6 | ||||
| -rw-r--r-- | src/game/SpellHandler.cpp | 6 | ||||
| -rw-r--r-- | src/game/TaxiHandler.cpp | 2 | ||||
| -rw-r--r-- | src/game/TemporarySummon.cpp | 2 | ||||
| -rw-r--r-- | src/game/Unit.cpp | 16 |
22 files changed, 113 insertions, 136 deletions
diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index fffedb56ad8..2c15395f24b 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -270,9 +270,9 @@ void BattleGround::Update(uint32 diff) if (!plr) continue; - if (!sh) + if (!sh && plr->IsInWorld()) { - sh = ObjectAccessor::GetCreature(*plr, itr->first); + sh = plr->GetMap()->GetCreature(itr->first); // only for visual effect if (sh) sh->CastSpell(sh, SPELL_SPIRIT_HEAL, true); // Spirit Heal, effect 117 diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp index 6e94a8c8a9f..cf062708a80 100644 --- a/src/game/BattleGroundHandler.cpp +++ b/src/game/BattleGroundHandler.cpp @@ -42,7 +42,7 @@ void WorldSession::HandleBattleGroundHelloOpcode( WorldPacket & recv_data ) recv_data >> 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) return; @@ -104,7 +104,7 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data ) if (_player->InBattleGround()) return; - Creature *unit = ObjectAccessor::GetCreature(*_player, guid); + Creature *unit = GetPlayer()->GetMap()->GetCreature(guid); if (!unit) return; @@ -597,7 +597,7 @@ void WorldSession::HandleAreaSpiritHealerQueryOpcode( WorldPacket & recv_data ) uint64 guid; recv_data >> guid; - Creature *unit = ObjectAccessor::GetCreature(*_player, guid); + Creature *unit = GetPlayer()->GetMap()->GetCreature(guid); if (!unit) return; @@ -620,7 +620,7 @@ void WorldSession::HandleAreaSpiritHealerQueueOpcode( WorldPacket & recv_data ) uint64 guid; recv_data >> guid; - Creature *unit = ObjectAccessor::GetCreature(*_player, guid); + Creature *unit = GetPlayer()->GetMap()->GetCreature(guid); if (!unit) return; @@ -649,7 +649,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data ) recv_data >> guid >> arenaslot >> asGroup >> isRated; - Creature *unit = ObjectAccessor::GetCreature(*_player, guid); + Creature *unit = GetPlayer()->GetMap()->GetCreature(guid); if (!unit) return; diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 55872937395..d5a9dd59533 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -1409,7 +1409,7 @@ GameObject* ChatHandler::GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid 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 { diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 9ab929c44bb..a3107cface7 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -634,7 +634,7 @@ void GameObject::DeleteFromDB() GameObject* GameObject::GetGameObject(WorldObject& object, uint64 guid) { - return ObjectAccessor::GetGameObject(object,guid); + return object.GetMap()->GetGameObject(guid); } GameObjectInfo const *GameObject::GetGOInfo() const diff --git a/src/game/InstanceData.cpp b/src/game/InstanceData.cpp index 808ebca2f59..c5eeda84566 100644 --- a/src/game/InstanceData.cpp +++ b/src/game/InstanceData.cpp @@ -33,7 +33,7 @@ void InstanceData::SaveToDB() void InstanceData::HandleGameObject(uint64 GUID, bool open, GameObject *go) { if(!go) - go = instance->GetGameObjectInMap(GUID); + go = instance->GetGameObject(GUID); if(go) go->SetGoState(open ? 0 : 1); else diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index 51829e504f0..963e79f8829 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -107,7 +107,7 @@ bool ChatHandler::HandleNpcWhisperCommand(const char* args) char* text = strtok(NULL, ""); 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) { diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index 9aa1fec4778..4d3ca991af8 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -552,7 +552,7 @@ bool ChatHandler::HandleGameObjectTargetCommand(const char* args) 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); @@ -1384,7 +1384,7 @@ bool ChatHandler::HandleNpcDeleteCommand(const char* args) return false; 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 unit = getSelectedCreature(); @@ -3071,7 +3071,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) // Did the user select a visual spawnpoint? if(wpGuid) - 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)); // attempt check creature existence by DB data else { @@ -3141,7 +3141,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) 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->CombatStop(); wpCreature->DeleteFromDB(); wpCreature->AddObjectToRemoveList(); @@ -3170,7 +3170,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) // Respawn the owner of the waypoints 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->CombatStop(); wpCreature->DeleteFromDB(); wpCreature->AddObjectToRemoveList(); @@ -3281,11 +3281,8 @@ bool ChatHandler::HandleWpShowCommand(const char* args) pathid = atoi((char*)guid_str); } - sLog.outDebug("DEBUG: HandleWpShowCommand: danach"); - - std::string show = show_str; uint32 Maxpoint; @@ -3364,7 +3361,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args) { Field *fields = result2->Fetch(); 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) { @@ -3582,7 +3579,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args) { Field *fields = result->Fetch(); 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)); if(!pCreature) { 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; diff --git a/src/game/Map.cpp b/src/game/Map.cpp index e2d457d4dde..f0dce40e2fd 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -2402,20 +2402,6 @@ void InstanceMap::Remove(Player *player, bool remove) SetResetSchedule(true); } -Creature * Map::GetCreatureInMap(uint64 guid) -{ - Creature * obj = HashMapHolder<Creature>::Find(guid); - if(obj && obj->GetInstanceId() != GetInstanceId()) obj = NULL; - return obj; -} - -GameObject * Map::GetGameObjectInMap(uint64 guid) -{ - GameObject * obj = HashMapHolder<GameObject>::Find(guid); - if(obj && obj->GetInstanceId() != GetInstanceId()) obj = NULL; - return obj; -} - void InstanceMap::CreateInstanceData(bool load) { if(i_data != NULL) @@ -2642,5 +2628,44 @@ void BattleGroundMap::UnloadAll() Map::UnloadAll(); } -/*--------------------------TRINITY-------------------------*/ +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; +} diff --git a/src/game/Map.h b/src/game/Map.h index fe29f448d27..d85eb459171 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -386,8 +386,6 @@ class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::O void resetMarkedCells() { marked_cells.reset(); } bool isCellMarked(uint32 pCellId) { return marked_cells.test(pCellId); } void markCell(uint32 pCellId) { marked_cells.set(pCellId); } - Creature* GetCreatureInMap(uint64 guid); - GameObject* GetGameObjectInMap(uint64 guid); bool HavePlayers() const { return !m_mapRefManager.isEmpty(); } uint32 GetPlayersCountExceptGMs() const; @@ -422,6 +420,9 @@ class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::O CreatureGroupHolderType CreatureGroupHolder; + Creature* GetCreature(uint64 guid); + GameObject* GetGameObject(uint64 guid); + DynamicObject* GetDynamicObject(uint64 guid); private: void LoadMapAndVMap(int gx, int gy); void LoadVMap(int gx, int gy); diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 0672c38ee21..ce86026af90 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -105,7 +105,7 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data ) } else if(IS_GAMEOBJECT_GUID(guid)) { - go = ObjectAccessor::GetGameObject(*_player, guid); + go = _player->GetMap()->GetGameObject(guid); if (!go) { sLog.outDebug( "WORLD: HandleGossipSelectOptionOpcode - GameObject (GUID: %u) not found.", uint32(GUID_LOPART(guid)) ); diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp index 829fd44d1dc..1fa0bd6d1ca 100644 --- a/src/game/ObjectAccessor.cpp +++ b/src/game/ObjectAccessor.cpp @@ -57,23 +57,7 @@ ObjectAccessor::GetCreatureOrPetOrVehicle(WorldObject const &u, uint64 guid) if(Creature *unit = GetVehicle(guid)) return unit; - return GetCreature(u, 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; + return u.GetMap()->GetCreature(guid); } Unit* @@ -119,13 +103,13 @@ Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const &p, uint64 guid, u if(typemask & TYPEMASK_GAMEOBJECT) { - obj = GetGameObject(p,guid); + obj = p.GetMap()->GetGameObject(guid); if(obj) return obj; } if(typemask & TYPEMASK_DYNAMICOBJECT) { - obj = GetDynamicObject(p,guid); + obj = p.GetMap()->GetDynamicObject(guid); if(obj) return obj; } @@ -138,32 +122,6 @@ Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const &p, uint64 guid, u 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* ObjectAccessor::FindPlayer(uint64 guid) { diff --git a/src/game/ObjectAccessor.h b/src/game/ObjectAccessor.h index f25c2f52f53..dd8e02b81ab 100644 --- a/src/game/ObjectAccessor.h +++ b/src/game/ObjectAccessor.h @@ -139,13 +139,10 @@ class TRINITY_DLL_DECL ObjectAccessor : public Trinity::Singleton<ObjectAccessor } static Object* GetObjectByTypeMask(WorldObject const &, uint64, uint32 typemask); - static Creature* GetCreature(WorldObject const &, uint64); static Creature* GetCreatureOrPetOrVehicle(WorldObject const &, uint64); static Unit* GetUnit(WorldObject const &, uint64); static Pet* GetPet(Unit const &, uint64 guid) { return GetPet(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 Pet* GetPet(uint64 guid); static Vehicle* GetVehicle(uint64 guid); diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 7fd6194d73a..6d34202b4bc 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -1651,7 +1651,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati // ObjectAccessor won't find the flag. if (duel && GetMapId()!=mapid) { - GameObject* obj = ObjectAccessor::GetGameObject(*this, GetUInt64Value(PLAYER_DUEL_ARBITER)); + GameObject* obj = GetMap()->GetGameObject(GetUInt64Value(PLAYER_DUEL_ARBITER)); if (obj) DuelComplete(DUEL_FLED); } @@ -2024,7 +2024,7 @@ Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask) return NULL; // exist - Creature *unit = ObjectAccessor::GetCreature(*this,guid); + Creature *unit = GetMap()->GetCreature(guid); if (!unit) return NULL; @@ -2064,7 +2064,7 @@ Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask) 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) { @@ -6255,7 +6255,7 @@ void Player::CheckDuelDistance(time_t currTime) return; uint64 duelFlagGUID = GetUInt64Value(PLAYER_DUEL_ARBITER); - GameObject* obj = ObjectAccessor::GetGameObject(*this, duelFlagGUID); + GameObject* obj = GetMap()->GetGameObject(duelFlagGUID); if(!obj) return; @@ -6329,7 +6329,7 @@ void Player::DuelComplete(DuelCompleteType type) duel->opponent->GetSession()->SendPacket(&data);*/ //Remove Duel Flag object - GameObject* obj = ObjectAccessor::GetGameObject(*this, GetUInt64Value(PLAYER_DUEL_ARBITER)); + GameObject* obj = GetMap()->GetGameObject(GetUInt64Value(PLAYER_DUEL_ARBITER)); if(obj) duel->initiator->RemoveGameObject(obj,true); @@ -7229,8 +7229,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type) if (IS_GAMEOBJECT_GUID(guid)) { sLog.outDebug(" IS_GAMEOBJECT_GUID(guid)"); - GameObject *go = - ObjectAccessor::GetGameObject(*this, guid); + GameObject *go = GetMap()->GetGameObject(guid); // 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 @@ -7355,7 +7354,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type) } 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 if (!creature || creature->isAlive()!=(loot_type == LOOT_PICKPOCKETING) || !creature->IsWithinDistInMap(this,INTERACTION_DISTANCE)) @@ -12111,7 +12110,7 @@ void Player::PrepareQuestMenu( uint64 guid ) Object *pObject; QuestRelations* pObjectQR; QuestRelations* pObjectQIR; - Creature *pCreature = ObjectAccessor::GetCreature(*this, guid); + Creature *pCreature = GetMap()->GetCreature(guid); if( pCreature ) { pObject = (Object*)pCreature; @@ -12120,7 +12119,7 @@ void Player::PrepareQuestMenu( uint64 guid ) } else { - GameObject *pGameObject = ObjectAccessor::GetGameObject(*this, guid); + GameObject *pGameObject = GetMap()->GetGameObject(guid); if( pGameObject ) { pObject = (Object*)pGameObject; @@ -12197,7 +12196,7 @@ void Player::SendPreparedQuest( uint64 guid ) qe._Delay = 0; qe._Emote = 0; std::string title = ""; - Creature *pCreature = ObjectAccessor::GetCreature(*this, guid); + Creature *pCreature = GetMap()->GetCreature(guid); if( pCreature ) { uint32 textid = pCreature->GetNpcTextId(); @@ -12261,7 +12260,7 @@ Quest const * Player::GetNextQuest( uint64 guid, Quest const *pQuest ) QuestRelations* pObjectQR; QuestRelations* pObjectQIR; - Creature *pCreature = ObjectAccessor::GetCreature(*this, guid); + Creature *pCreature = GetMap()->GetCreature(guid); if( pCreature ) { pObject = (Object*)pCreature; @@ -12270,7 +12269,7 @@ Quest const * Player::GetNextQuest( uint64 guid, Quest const *pQuest ) } else { - GameObject *pGameObject = ObjectAccessor::GetGameObject(*this, guid); + GameObject *pGameObject = GetMap()->GetGameObject(guid); if( pGameObject ) { pObject = (Object*)pGameObject; diff --git a/src/game/QuestHandler.cpp b/src/game/QuestHandler.cpp index 7d436796296..b47af0ccd12 100644 --- a/src/game/QuestHandler.cpp +++ b/src/game/QuestHandler.cpp @@ -621,7 +621,7 @@ void WorldSession::HandleQuestgiverStatusQueryMultipleOpcode(WorldPacket& /*recv if(IS_CREATURE_GUID(*itr)) { - Creature *questgiver = ObjectAccessor::GetCreature(*_player, *itr); + Creature *questgiver = GetPlayer()->GetMap()->GetCreature(*itr); if(!questgiver || questgiver->IsHostileTo(_player)) continue; if(!questgiver->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER)) @@ -636,7 +636,7 @@ void WorldSession::HandleQuestgiverStatusQueryMultipleOpcode(WorldPacket& /*recv } else if(IS_GAMEOBJECT_GUID(*itr)) { - GameObject *questgiver = ObjectAccessor::GetGameObject(*_player, *itr); + GameObject *questgiver = GetPlayer()->GetMap()->GetGameObject(*itr); if(!questgiver) continue; if(questgiver->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 576c15643c0..a312e627090 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -152,7 +152,7 @@ void SpellCastTargets::setCorpseTarget(Corpse* corpse) 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_unitTargetGUID==caster->GetGUID() ? caster : ObjectAccessor::GetUnit(*caster, m_unitTargetGUID) ) : NULL; @@ -848,7 +848,7 @@ void Spell::AddGOTarget(GameObject* pVictim, 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) AddGOTarget(go, effIndex); } @@ -1244,7 +1244,7 @@ void Spell::DoAllEffectOnTarget(GOTargetInfo *target) if(!effectMask) return; - GameObject* go = ObjectAccessor::GetGameObject(*m_caster, target->targetGUID); + GameObject* go = m_caster->GetMap()->GetGameObject(target->targetGUID); if(!go) return; @@ -2663,7 +2663,7 @@ void Spell::update(uint32 difftime) { GOTargetInfo* target = &*ihit; - GameObject* go = ObjectAccessor::GetGameObject(*m_caster, target->targetGUID); + GameObject* go = m_caster->GetMap()->GetGameObject(target->targetGUID); if(!go) continue; @@ -3204,7 +3204,7 @@ void Spell::SendChannelStart(uint32 duration) { if(itr->effectMask & (1<<0) ) { - target = ObjectAccessor::GetGameObject(*m_caster, itr->targetGUID); + target = m_caster->GetMap()->GetGameObject(itr->targetGUID); break; } } @@ -5433,7 +5433,7 @@ bool Spell::CheckTarget( Unit* target, uint32 eff ) // Get GO cast coordinates if original caster -> GO WorldObject *caster = NULL; if (IS_GAMEOBJECT_GUID(m_originalCasterGUID)) - caster = ObjectAccessor::GetGameObject(*m_caster, m_originalCasterGUID); + caster = m_caster->GetMap()->GetGameObject(m_originalCasterGUID); if (!caster) caster = m_caster; if(target!=m_caster && !target->IsWithinLOSInMap(caster)) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 09ad6501c4d..f928b8fd8bd 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -2697,7 +2697,7 @@ void AuraEffect::HandleAuraDummy(bool apply, bool Real) uint64 guid = caster->m_SummonSlot[3]; if (guid) { - Creature *totem = ObjectAccessor::GetCreature(*caster, guid); + Creature *totem = caster->GetMap()->GetCreature(guid); if (totem && totem->isTotem()) ((Player*)caster)->CastSpell(totem, 6277, true); } diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index fe7a3b3a68c..30b53e9618c 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -5470,7 +5470,7 @@ void Spell::EffectSummonObject(uint32 i) { GameObject* obj = NULL; if( m_caster ) - obj = ObjectAccessor::GetGameObject(*m_caster, guid); + obj = m_caster->GetMap()->GetGameObject(guid); if(obj) obj->Delete(); m_caster->m_ObjectSlot[slot] = 0; @@ -5951,7 +5951,7 @@ void Spell::EffectDestroyAllTotems(uint32 /*i*/) if(!m_caster->m_SummonSlot[slot]) continue; - Creature* totem = ObjectAccessor::GetCreature(*m_caster,m_caster->m_SummonSlot[slot]); + Creature* totem = m_caster->GetMap()->GetCreature(m_caster->m_SummonSlot[slot]); if(totem && totem->isTotem()) { uint32 spell_id = totem->GetUInt32Value(UNIT_CREATED_BY_SPELL); @@ -6395,7 +6395,7 @@ void Spell::SummonTotem(uint32 entry, SummonPropertiesEntry const *properties) uint64 guid = m_caster->m_SummonSlot[slot]; if(guid != 0) { - Creature *OldTotem = ObjectAccessor::GetCreature(*m_caster, guid); + Creature *OldTotem = m_caster->GetMap()->GetCreature(guid); if(OldTotem && OldTotem->isTotem()) ((Totem*)OldTotem)->UnSummon(); } diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp index 19a33dff75a..8c3300993b9 100644 --- a/src/game/SpellHandler.cpp +++ b/src/game/SpellHandler.cpp @@ -234,7 +234,7 @@ void WorldSession::HandleGameObjectUseOpcode( WorldPacket & recv_data ) if(_player->m_mover != _player) return; - GameObject *obj = ObjectAccessor::GetGameObject(*_player, guid); + GameObject *obj = GetPlayer()->GetMap()->GetGameObject(guid); if(!obj) return; @@ -258,7 +258,7 @@ void WorldSession::HandleGameobjectReportUse(WorldPacket& recvPacket) if(_player->m_mover != _player) return; - GameObject* go = ObjectAccessor::GetGameObject(*_player,guid); + GameObject* go = GetPlayer()->GetMap()->GetGameObject(guid); if(!go) return; @@ -480,7 +480,7 @@ void WorldSession::HandleTotemDestroy( WorldPacket& recvPacket) if(!_player->m_SummonSlot[slotId]) return; - Creature* totem = ObjectAccessor::GetCreature(*_player,_player->m_SummonSlot[slotId]); + Creature* totem = GetPlayer()->GetMap()->GetCreature(_player->m_SummonSlot[slotId]); // Don't unsummon sentry totem if(totem && totem->isTotem() && totem->GetEntry() != SENTRY_TOTEM_ENTRY) ((Totem*)totem)->UnSummon(); diff --git a/src/game/TaxiHandler.cpp b/src/game/TaxiHandler.cpp index 75db8698ea2..24c6aca147a 100644 --- a/src/game/TaxiHandler.cpp +++ b/src/game/TaxiHandler.cpp @@ -48,7 +48,7 @@ void WorldSession::HandleTaxiNodeStatusQueryOpcode( WorldPacket & recv_data ) void WorldSession::SendTaxiStatus( uint64 guid ) { // cheating checks - Creature *unit = ObjectAccessor::GetCreature(*_player, guid); + Creature *unit = GetPlayer()->GetMap()->GetCreature(guid); if (!unit) { sLog.outDebug( "WorldSession::SendTaxiStatus - Unit (GUID: %u) not found.", uint32(GUID_LOPART(guid)) ); diff --git a/src/game/TemporarySummon.cpp b/src/game/TemporarySummon.cpp index 10b4eedb1c8..ed0849a98d6 100644 --- a/src/game/TemporarySummon.cpp +++ b/src/game/TemporarySummon.cpp @@ -198,7 +198,7 @@ void TempSummon::InitSummon(uint32 duration) { if(owner->m_SummonSlot[slot] && owner->m_SummonSlot[slot] != GetGUID()) { - Creature *OldTotem = ObjectAccessor::GetCreature(*this, owner->m_SummonSlot[slot]); + Creature *OldTotem = GetMap()->GetCreature(owner->m_SummonSlot[slot]); if(OldTotem && OldTotem->isSummon()) ((TempSummon*)OldTotem)->UnSummon(); } diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index a29d19cb0c4..9150f312e22 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -4252,7 +4252,7 @@ void Unit::RemoveDynObject(uint32 spellid) return; for (DynObjectGUIDs::iterator i = m_dynObjGUIDs.begin(); i != m_dynObjGUIDs.end();) { - DynamicObject* dynObj = ObjectAccessor::GetDynamicObject(*this, *i); + DynamicObject* dynObj = GetMap()->GetDynamicObject(*i); if(!dynObj) // may happen if a dynobj is removed when grid unload { i = m_dynObjGUIDs.erase(i); @@ -4271,7 +4271,7 @@ void Unit::RemoveAllDynObjects() { while(!m_dynObjGUIDs.empty()) { - DynamicObject* dynObj = ObjectAccessor::GetDynamicObject(*this,*m_dynObjGUIDs.begin()); + DynamicObject* dynObj = GetMap()->GetDynamicObject(*m_dynObjGUIDs.begin()); if(dynObj) dynObj->Delete(); m_dynObjGUIDs.erase(m_dynObjGUIDs.begin()); @@ -4282,7 +4282,7 @@ DynamicObject * Unit::GetDynObject(uint32 spellId, uint32 effIndex) { for (DynObjectGUIDs::iterator i = m_dynObjGUIDs.begin(); i != m_dynObjGUIDs.end();) { - DynamicObject* dynObj = ObjectAccessor::GetDynamicObject(*this, *i); + DynamicObject* dynObj = GetMap()->GetDynamicObject(*i); if(!dynObj) { i = m_dynObjGUIDs.erase(i); @@ -4300,7 +4300,7 @@ DynamicObject * Unit::GetDynObject(uint32 spellId) { for (DynObjectGUIDs::iterator i = m_dynObjGUIDs.begin(); i != m_dynObjGUIDs.end();) { - DynamicObject* dynObj = ObjectAccessor::GetDynamicObject(*this, *i); + DynamicObject* dynObj = GetMap()->GetDynamicObject(*i); if(!dynObj) { i = m_dynObjGUIDs.erase(i); @@ -7875,7 +7875,7 @@ bool Unit::isAttackingPlayer() const for(int8 i = 0; i < MAX_SUMMON_SLOT; ++i) if(m_SummonSlot[i]) - if(Creature *summon = ObjectAccessor::GetCreature(*this, m_SummonSlot[i])) + if(Creature *summon = GetMap()->GetCreature(m_SummonSlot[i])) if(summon->isAttackingPlayer()) return true; @@ -8314,7 +8314,7 @@ void Unit::UnsummonAllTotems() if(!m_SummonSlot[i]) continue; - Creature *OldTotem = ObjectAccessor::GetCreature(*this, m_SummonSlot[i]); + Creature *OldTotem = GetMap()->GetCreature(m_SummonSlot[i]); if(OldTotem && OldTotem->isSummon()) ((TempSummon*)OldTotem)->UnSummon(); } @@ -10726,7 +10726,7 @@ Player* Unit::GetPlayer(uint64 guid) Creature* Unit::GetCreature(WorldObject& object, uint64 guid) { - return ObjectAccessor::GetCreature(object, guid); + return object.GetMap()->GetCreature(guid); } bool Unit::isVisibleForInState( Player const* u, bool inVisibleList ) const @@ -13406,7 +13406,7 @@ void Unit::SetPhaseMask(uint32 newPhaseMask, bool update) for(int8 i = 0; i < MAX_SUMMON_SLOT; ++i) if(m_SummonSlot[i]) - if(Creature *summon = ObjectAccessor::GetCreature(*this, m_SummonSlot[i])) + if(Creature *summon = GetMap()->GetCreature(m_SummonSlot[i])) summon->SetPhaseMask(newPhaseMask,true); } |
