diff options
author | Shauren <shauren.trinity@gmail.com> | 2022-07-18 22:51:37 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-07-18 22:51:37 +0200 |
commit | e1eb474531c75cbfcfea65f11e288a381859f8fb (patch) | |
tree | c5585d1c2055b1f4705af3ff0c7e2073209e5ed4 /src | |
parent | 775be0682a794d0a1f62d656f8c6c6dffca8de79 (diff) |
Core/Spawns: Removed ObjectMgr::AddCreatureData and ObjectMgr::AddGameObjectData (old outdoorpvp helpers)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 96 | ||||
-rw-r--r-- | src/server/game/Globals/ObjectMgr.h | 2 |
2 files changed, 0 insertions, 98 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 67a83cf7c8d..844a800f242 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -2507,102 +2507,6 @@ void ObjectMgr::RemoveCreatureFromGrid(CreatureData const* data) RemoveSpawnDataFromGrid<&CellObjectGuids::creatures>(data); } -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 UI64LIT(0); - - Map* map = sMapMgr->CreateBaseMap(mapId); - if (!map) - return UI64LIT(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.spawnDifficulties.push_back(DIFFICULTY_NONE); - data.goState = GO_STATE_READY; - data.artKit = goinfo->type == GAMEOBJECT_TYPE_CONTROL_ZONE ? 21 : 0; - data.dbData = false; - data.spawnGroupData = GetLegacySpawnGroup(); - - AddGameobjectToGrid(&data); - - // Spawn if necessary (loaded grids only) - // We use spawn coords to spawn - if (!map->Instanceable() && map->IsGridLoaded(data.spawnPoint)) - { - GameObject* go = GameObject::CreateGameObjectFromDB(spawnId, map); - if (!go) - { - TC_LOG_ERROR("misc", "AddGameObjectData: cannot add gameobject entry %u to map", entry); - return UI64LIT(0); - } - } - - TC_LOG_DEBUG("maps", "AddGameObjectData: dbguid " UI64FMTD " 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 UI64LIT(0); - - std::pair<int16, int16> levels = cInfo->GetMinMaxLevel(); - uint32 level = levels.first == levels.second ? levels.first : urand(levels.first, levels.second); // Only used for extracting creature base stats - CreatureBaseStats const* stats = GetCreatureBaseStats(level, cInfo->unit_class); - Map* map = sMapMgr->CreateBaseMap(mapId); - if (!map) - return UI64LIT(0); - - CreatureLevelScaling const* scaling = cInfo->GetLevelScaling(map->GetDifficultyID()); - - 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.wander_distance = 0; - data.currentwaypoint = 0; - data.curhealth = sDB2Manager.EvaluateExpectedStat(ExpectedStatType::CreatureHealth, level, cInfo->GetHealthScalingExpansion(), scaling->ContentTuningID, Classes(cInfo->unit_class)) * cInfo->ModHealth * cInfo->ModHealthExtra; - data.curmana = stats->GenerateMana(cInfo); - data.movementType = cInfo->MovementType; - data.spawnDifficulties.push_back(DIFFICULTY_NONE); - data.dbData = false; - data.npcflag = cInfo->npcflag; - data.unit_flags = cInfo->unit_flags; - data.dynamicflags = cInfo->dynamicflags; - data.spawnGroupData = GetLegacySpawnGroup(); - - AddCreatureToGrid(&data); - - // We use spawn coords to spawn - if (!map->Instanceable() && !map->IsRemovalGrid(data.spawnPoint)) - { - Creature* creature = Creature::CreateCreatureFromDB(spawnId, map, true, true); - if (!creature) - { - TC_LOG_ERROR("misc", "AddCreature: Cannot add creature entry %u to map", entry); - return UI64LIT(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 047002d74a0..1cc7d1939e9 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -1615,8 +1615,6 @@ class TC_GAME_API ObjectMgr void RemoveCreatureFromGrid(CreatureData const* data); void AddGameobjectToGrid(GameObjectData const* data); void RemoveGameobjectFromGrid(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(); |