Core/Transports: force transport spawns into legacy group

This commit is contained in:
Ovahlord
2018-07-25 14:44:47 +02:00
parent 844b074d2f
commit bf68acea1f
3 changed files with 26 additions and 12 deletions

View File

@@ -297,9 +297,12 @@ 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 = new Creature();
if (!creature->LoadFromDB(guid, map, false, true))
if (!creature->LoadFromDB(guid, map, false, false))
{
delete creature;
return nullptr;
@@ -344,6 +347,9 @@ 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 = new GameObject();
if (!go->LoadFromDB(guid, map, false))

View File

@@ -1961,8 +1961,13 @@ void ObjectMgr::LoadCreatures()
}
// Skip spawnMask check for transport maps
if (!IsTransportMap(data.spawnPoint.GetMapId()) && data.spawnMask & ~spawnMasks[data.spawnPoint.GetMapId()])
TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: %u) that have wrong spawn mask %u including unsupported difficulty modes for map (Id: %u).", guid, data.spawnMask, data.spawnPoint.GetMapId());
if (!IsTransportMap(data.spawnPoint.GetMapId()))
{
if (data.spawnMask & ~spawnMasks[data.spawnPoint.GetMapId()])
TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: %u) that have wrong spawn mask %u including unsupported difficulty modes for map (Id: %u).", guid, data.spawnMask, data.spawnPoint.GetMapId());
}
else
data.spawnGroupData = &_spawnGroupDataStore[1]; // force compatibility group for transport spawns
bool ok = true;
for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1 && ok; ++diff)
@@ -2323,8 +2328,13 @@ void ObjectMgr::LoadGameObjects()
data.spawnMask = fields[14].GetUInt8();
if (!IsTransportMap(data.spawnPoint.GetMapId()) && data.spawnMask & ~spawnMasks[data.spawnPoint.GetMapId()])
TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) that has wrong spawn mask %u including unsupported difficulty modes for map (Id: %u), skip", guid, data.id, data.spawnMask, data.spawnPoint.GetMapId());
if (!IsTransportMap(data.spawnPoint.GetMapId()))
{
if (data.spawnMask & ~spawnMasks[data.spawnPoint.GetMapId()])
TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) that has wrong spawn mask %u including unsupported difficulty modes for map (Id: %u), skip", guid, data.id, data.spawnMask, data.spawnPoint.GetMapId());
}
else
data.spawnGroupData = &_spawnGroupDataStore[1]; // force compatibility group for transport spawns
data.phaseMask = fields[15].GetUInt32();
int16 gameEvent = fields[16].GetInt8();

View File

@@ -356,13 +356,11 @@ public:
data.phaseMask = chr->GetPhaseMask();
data.spawnPoint.Relocate(chr->GetTransOffsetX(), chr->GetTransOffsetY(), chr->GetTransOffsetZ(), chr->GetTransOffsetO());
Creature* creature = trans->CreateNPCPassenger(guid, &data);
// creature->CopyPhaseFrom(chr); // will not be saved, and probably useless
creature->SaveToDB(trans->GetGOInfo()->moTransport.mapID, 1 << map->GetSpawnMode(), chr->GetPhaseMask());
sObjectMgr->AddCreatureToGrid(guid, &data);
if (Creature* creature = trans->CreateNPCPassenger(guid, &data))
{
creature->SaveToDB(trans->GetGOInfo()->moTransport.mapID, 1 << map->GetSpawnMode(), chr->GetPhaseMask());
sObjectMgr->AddCreatureToGrid(guid, &data);
}
return true;
}