diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index f38d8ac09..96d145c35 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -266,9 +266,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 e2df35847..06435bd34 100644 --- a/src/game/BattleGroundHandler.cpp +++ b/src/game/BattleGroundHandler.cpp @@ -40,7 +40,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; @@ -102,7 +102,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; @@ -595,7 +595,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; @@ -618,7 +618,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; @@ -647,7 +647,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 7a0bb8f4b..22f95529f 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -1315,7 +1315,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 4b2916de7..7531c01b9 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -627,11 +627,6 @@ void GameObject::DeleteFromDB() 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 { return m_goInfo; diff --git a/src/game/GameObject.h b/src/game/GameObject.h index 8fdea4d2f..f06dbe79e 100644 --- a/src/game/GameObject.h +++ b/src/game/GameObject.h @@ -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); void Update(uint32 p_time); - static GameObject* GetGameObject(WorldObject& object, uint64 guid); GameObjectInfo const* GetGOInfo() const; bool IsTransport() const; diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index d98c0fe83..75a891abd 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -103,7 +103,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 014122cba..79cd2c5da 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -506,7 +506,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); @@ -1338,7 +1338,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(); @@ -2606,7 +2606,7 @@ bool ChatHandler::HandleWpAddCommand(const char* args) 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) { PSendSysMessage(LANG_WAYPOINT_NOTFOUNDDBPROBLEM, lowguid); @@ -2640,7 +2640,7 @@ bool ChatHandler::HandleWpAddCommand(const char* args) 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()) { PSendSysMessage(LANG_WAYPOINT_CREATNOTFOUND, lowguid); @@ -2855,7 +2855,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) 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 ) { @@ -2934,13 +2934,13 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) 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 Creature* wpCreature = NULL; 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->CleanupsBeforeDelete(); wpCreature->AddObjectToRemoveList(); @@ -2995,7 +2995,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) 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 Creature* wpCreature = NULL; @@ -3004,7 +3004,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->DeleteFromDB(); wpCreature->CleanupsBeforeDelete(); wpCreature->AddObjectToRemoveList(); @@ -3067,7 +3067,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) 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) { npcCreature->SetDefaultMovementType(WAYPOINT_MOTION_TYPE); @@ -3167,7 +3167,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args) 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) { @@ -3238,7 +3238,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args) uint32 model2 = fields[11].GetUInt32(); // 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() : ""), creGUID); PSendSysMessage(LANG_WAYPOINT_INFO_WAITTIME, waittime); @@ -3275,7 +3275,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) { @@ -3474,10 +3474,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 = ObjectAccessor::GetCreature(*m_session->GetPlayer(), guid); - + Creature* pCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(guid,VISUAL_WAYPOINT,HIGHGUID_UNIT)); if(!pCreature) { PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, guid); diff --git a/src/game/LootHandler.cpp b/src/game/LootHandler.cpp index 254f1978f..6d3191a27 100644 --- a/src/game/LootHandler.cpp +++ b/src/game/LootHandler.cpp @@ -44,8 +44,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)) @@ -70,8 +69,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); @@ -163,7 +161,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)) ) @@ -188,7 +186,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); @@ -276,10 +274,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)) @@ -401,7 +401,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) ) @@ -458,7 +458,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; @@ -466,7 +466,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 0db29f022..7de4dfa3f 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -2531,3 +2531,45 @@ void BattleGroundMap::UnloadAll(bool 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; +} diff --git a/src/game/Map.h b/src/game/Map.h index 5388d3963..2b1f1c025 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -402,6 +402,10 @@ class MANGOS_DLL_SPEC Map : public GridRefManager, public MaNGOS::Obj void RemoveFromActive(T* obj) { RemoveFromActiveHelper(obj); } void RemoveFromActive(Creature* obj); + + 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/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp index 17d7d59cb..da9dd61c4 100644 --- a/src/game/ObjectAccessor.cpp +++ b/src/game/ObjectAccessor.cpp @@ -55,23 +55,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* @@ -117,13 +101,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; } @@ -136,32 +120,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 a538dcf38..f29dceb68 100644 --- a/src/game/ObjectAccessor.h +++ b/src/game/ObjectAccessor.h @@ -137,13 +137,10 @@ class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::SingletonGetGameObject(GetUInt64Value(PLAYER_DUEL_ARBITER)); if (obj) DuelComplete(DUEL_FLED); } @@ -1962,7 +1962,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; @@ -2002,7 +2002,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) { @@ -6129,7 +6129,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; @@ -6196,7 +6196,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); @@ -7101,8 +7101,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 @@ -7215,7 +7214,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)) @@ -11835,7 +11834,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; @@ -11844,7 +11843,7 @@ void Player::PrepareQuestMenu( uint64 guid ) } else { - GameObject *pGameObject = ObjectAccessor::GetGameObject(*this, guid); + GameObject *pGameObject = GetMap()->GetGameObject(guid); if( pGameObject ) { pObject = (Object*)pGameObject; @@ -11921,7 +11920,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(); @@ -11985,7 +11984,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; @@ -11994,7 +11993,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 bee8aa7eb..430d84c0f 100644 --- a/src/game/QuestHandler.cpp +++ b/src/game/QuestHandler.cpp @@ -611,7 +611,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)) @@ -626,7 +626,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 67da066c3..7f9b796d2 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -158,7 +158,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; @@ -956,7 +956,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); } @@ -1233,7 +1233,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; @@ -1784,7 +1784,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap) // Check original caster is GO - set its coordinates as dst cast 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; // Set dest for targets @@ -2716,7 +2716,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; @@ -3266,7 +3266,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; } } @@ -5414,7 +5414,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/SpellEffects.cpp b/src/game/SpellEffects.cpp index 13d1f039f..d4bb90154 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -5432,7 +5432,7 @@ void Spell::EffectSummonTotem(uint32 i) uint64 guid = m_caster->m_TotemSlot[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(); } @@ -5632,7 +5632,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; @@ -6114,7 +6114,7 @@ void Spell::EffectDestroyAllTotems(uint32 /*i*/) if(!m_caster->m_TotemSlot[slot]) 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()) { uint32 spell_id = totem->GetUInt32Value(UNIT_CREATED_BY_SPELL); diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp index e01aaace5..2601497cb 100644 --- a/src/game/SpellHandler.cpp +++ b/src/game/SpellHandler.cpp @@ -230,7 +230,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; @@ -254,7 +254,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; @@ -471,7 +471,7 @@ void WorldSession::HandleTotemDestroy( WorldPacket& recvPacket) if(!_player->m_TotemSlot[slotId]) return; - Creature* totem = ObjectAccessor::GetCreature(*_player,_player->m_TotemSlot[slotId]); + Creature* totem = GetPlayer()->GetMap()->GetCreature(_player->m_TotemSlot[slotId]); if(totem && totem->isTotem()) ((Totem*)totem)->UnSummon(); } diff --git a/src/game/TaxiHandler.cpp b/src/game/TaxiHandler.cpp index 4a035ce02..4fedb5afc 100644 --- a/src/game/TaxiHandler.cpp +++ b/src/game/TaxiHandler.cpp @@ -46,7 +46,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/Unit.cpp b/src/game/Unit.cpp index a9b3605e2..7b38fdee4 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -3984,7 +3984,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) { i = m_dynObjGUIDs.erase(i); @@ -4003,7 +4003,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()); @@ -4014,7 +4014,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); @@ -4032,7 +4032,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); @@ -7259,7 +7259,7 @@ bool Unit::isAttackingPlayer() const { if(m_TotemSlot[i]) { - Creature *totem = ObjectAccessor::GetCreature(*this, m_TotemSlot[i]); + Creature *totem = GetMap()->GetCreature(m_TotemSlot[i]); if(totem && totem->isAttackingPlayer()) return true; } @@ -7417,7 +7417,7 @@ void Unit::UnsummonAllTotems() if(!m_TotemSlot[i]) continue; - Creature *OldTotem = ObjectAccessor::GetCreature(*this, m_TotemSlot[i]); + Creature *OldTotem = GetMap()->GetCreature(m_TotemSlot[i]); if (OldTotem && OldTotem->isTotem()) ((Totem*)OldTotem)->UnSummon(); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 73e464fee..8b313a2ef 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7689" + #define REVISION_NR "7690" #endif // __REVISION_NR_H__