Core/Transports: Force transport passengers into legacy spawn group

Ref #21641

(cherry picked from commit a5df77a9d6f3e48f2c4e8a61d60e3b5f2f0c326e)
This commit is contained in:
Shauren
2021-09-26 01:42:54 +02:00
parent 5274f7af17
commit 068b340b69
3 changed files with 11 additions and 9 deletions
@@ -299,6 +299,8 @@ void Transport::RemovePassenger(WorldObject* passenger)
Creature* Transport::CreateNPCPassenger(ObjectGuid::LowType guid, CreatureData const* data)
{
Map* map = GetMap();
if (map->GetCreatureRespawnTime(guid))
return nullptr;
Creature* creature = Creature::CreateCreatureFromDB(guid, map, false, true);
if (!creature)
@@ -346,6 +348,8 @@ Creature* Transport::CreateNPCPassenger(ObjectGuid::LowType guid, CreatureData c
GameObject* Transport::CreateGOPassenger(ObjectGuid::LowType guid, GameObjectData const* data)
{
Map* map = GetMap();
if (map->GetGORespawnTime(guid))
return nullptr;
GameObject* go = GameObject::CreateGameObjectFromDB(guid, map, false);
if (!go)
+2 -2
View File
@@ -2013,7 +2013,7 @@ void ObjectMgr::LoadCreatures()
data.phaseGroup = fields[25].GetUInt32();
data.terrainSwapMap = fields[26].GetInt32();
data.scriptId = GetScriptId(fields[27].GetString());
data.spawnGroupData = &_spawnGroupDataStore[0];
data.spawnGroupData = &_spawnGroupDataStore[IsTransportMap(data.spawnPoint.GetMapId()) ? 1 : 0]; // transport spawns default to compatibility group
MapEntry const* mapEntry = sMapStore.LookupEntry(data.spawnPoint.GetMapId());
if (!mapEntry)
@@ -2366,7 +2366,7 @@ void ObjectMgr::LoadGameObjects()
data.rotation.z = fields[9].GetFloat();
data.rotation.w = fields[10].GetFloat();
data.spawntimesecs = fields[11].GetInt32();
data.spawnGroupData = &_spawnGroupDataStore[0];
data.spawnGroupData = &_spawnGroupDataStore[IsTransportMap(data.spawnPoint.GetMapId()) ? 1 : 0]; // transport spawns default to compatibility group
MapEntry const* mapEntry = sMapStore.LookupEntry(data.spawnPoint.GetMapId());
if (!mapEntry)
+5 -7
View File
@@ -385,13 +385,11 @@ public:
data.spawnId = guid;
data.id = id;
data.spawnPoint.Relocate(chr->GetTransOffsetX(), chr->GetTransOffsetY(), chr->GetTransOffsetZ(), chr->GetTransOffsetO());
/// @todo: add phases
Creature* creature = trans->CreateNPCPassenger(guid, &data);
creature->SaveToDB(trans->GetGOInfo()->moTransport.SpawnMap, { map->GetDifficultyID() });
sObjectMgr->AddCreatureToGrid(guid, &data);
if (Creature* creature = trans->CreateNPCPassenger(guid, &data))
{
creature->SaveToDB(trans->GetGOInfo()->moTransport.SpawnMap, { map->GetDifficultyID() });
sObjectMgr->AddCreatureToGrid(guid, &data);
}
return true;
}