diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 56dcee2caf..b2e088e553 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -2245,103 +2245,6 @@ void ObjectMgr::RemoveCreatureFromGrid(ObjectGuid::LowType guid, CreatureData co } } -ObjectGuid::LowType ObjectMgr::AddGameObjectData(uint32 entry, uint32 mapId, Position const& pos, QuaternionData const& rot, uint32 spawntimedelay /*= 0*/) -{ - GameObjectTemplate const* goinfo = GetGameObjectTemplate(entry); - if (!goinfo) - return 0; - - Map* map = sMapMgr->CreateBaseMap(mapId); - if (!map) - return 0; - - ObjectGuid::LowType spawnId = GenerateGameObjectSpawnId(); - - GameObjectData& data = NewOrExistGameObjectData(spawnId); - data.spawnId = spawnId; - data.id = entry; - data.mapId = mapId; - data.spawnPoint.Relocate(pos); - data.rotation = rot; - data.spawntimesecs = spawntimedelay; - data.animprogress = 100; - data.spawnMask = 1; - data.goState = GO_STATE_READY; - data.artKit = goinfo->type == GAMEOBJECT_TYPE_CAPTURE_POINT ? 21 : 0; - data.dbData = false; - data.spawnGroupData = GetLegacySpawnGroup(); - - AddGameobjectToGrid(spawnId, &data); - - // Spawn if necessary (loaded grids only) - // We use spawn coords to spawn - if (!map->Instanceable() && map->IsGridLoaded(data.spawnPoint)) - { - GameObject* go = new GameObject; - - if (!go->LoadFromDB(spawnId, map, true)) - { - TC_LOG_ERROR("misc", "AddGameObjectData: cannot add gameobject entry %u to map", entry); - delete go; - return 0; - } - } - - TC_LOG_DEBUG("maps", "AddGameObjectData: dbguid %u entry %u map %u pos %s", spawnId, entry, mapId, data.spawnPoint.ToString().c_str()); - - return spawnId; -} - -ObjectGuid::LowType ObjectMgr::AddCreatureData(uint32 entry, uint32 mapId, Position const& pos, uint32 spawntimedelay /*= 0*/) -{ - CreatureTemplate const* cInfo = GetCreatureTemplate(entry); - if (!cInfo) - return 0; - - uint32 level = cInfo->minlevel == cInfo->maxlevel ? cInfo->minlevel : urand(cInfo->minlevel, cInfo->maxlevel); // Only used for extracting creature base stats - CreatureBaseStats const* stats = GetCreatureBaseStats(level, cInfo->unit_class); - Map* map = sMapMgr->CreateBaseMap(mapId); - if (!map) - return 0; - - ObjectGuid::LowType spawnId = GenerateCreatureSpawnId(); - CreatureData& data = NewOrExistCreatureData(spawnId); - data.spawnId = spawnId; - data.id = entry; - data.mapId = mapId; - data.spawnPoint.Relocate(pos); - data.displayid = 0; - data.equipmentId = 0; - data.spawntimesecs = spawntimedelay; - data.wanderDistance = 0; - data.currentwaypoint = 0; - data.curhealth = stats->GenerateHealth(cInfo); - data.curmana = stats->GenerateMana(cInfo); - data.movementType = cInfo->MovementType; - data.spawnMask = 1; - data.dbData = false; - data.npcflag = cInfo->npcflag; - data.unit_flags = cInfo->unit_flags; - data.dynamicflags = cInfo->dynamicflags; - data.spawnGroupData = GetLegacySpawnGroup(); - - AddCreatureToGrid(spawnId, &data); - - // We use spawn coords to spawn - if (!map->Instanceable() && !map->IsRemovalGrid(data.spawnPoint)) - { - Creature* creature = new Creature(); - if (!creature->LoadFromDB(spawnId, map, true, true)) - { - TC_LOG_ERROR("misc", "AddCreature: Cannot add creature entry %u to map", entry); - delete creature; - return 0; - } - } - - return spawnId; -} - void ObjectMgr::LoadGameObjects() { uint32 oldMSTime = getMSTime(); diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index b0d4c13a7b..20b91d4ca9 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -1485,8 +1485,6 @@ class TC_GAME_API ObjectMgr void RemoveCreatureFromGrid(ObjectGuid::LowType guid, CreatureData const* data); void AddGameobjectToGrid(ObjectGuid::LowType guid, GameObjectData const* data); void RemoveGameobjectFromGrid(ObjectGuid::LowType guid, GameObjectData const* data); - ObjectGuid::LowType AddGameObjectData(uint32 entry, uint32 map, Position const& pos, QuaternionData const& rot, uint32 spawntimedelay = 0); - ObjectGuid::LowType AddCreatureData(uint32 entry, uint32 map, Position const& pos, uint32 spawntimedelay = 0); // reserved names void LoadReservedPlayersNames();