Core/Spawns: Removed ObjectMgr::AddCreatureData and ObjectMgr::AddGameObjectData (old outdoorpvp helpers)

This commit is contained in:
Shauren
2022-07-18 22:51:37 +02:00
parent 775be0682a
commit e1eb474531
2 changed files with 0 additions and 98 deletions

View File

@@ -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();

View File

@@ -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();