fix(Core/Transports): Force transport passengers into legacy spawn group (#25508)

Co-authored-by: Shauren <shauren.trinity@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Andrew 2026-04-19 21:22:02 -03:00 committed by GitHub
parent 687ceeea70
commit e8eb9843dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 29 additions and 12 deletions

View file

@ -318,6 +318,9 @@ void MotionTransport::RemovePassenger(WorldObject* passenger, bool withAll)
Creature* MotionTransport::CreateNPCPassenger(ObjectGuid::LowType guid, CreatureData const* data)
{
Map* map = GetMap();
if (map->GetCreatureRespawnTime(guid))
return nullptr;
Creature* creature = new Creature();
if (!creature->LoadCreatureFromDB(guid, map, false))
@ -366,6 +369,9 @@ Creature* MotionTransport::CreateNPCPassenger(ObjectGuid::LowType guid, Creature
GameObject* MotionTransport::CreateGOPassenger(ObjectGuid::LowType guid, GameObjectData const* data)
{
Map* map = GetMap();
if (map->GetGORespawnTime(guid))
return nullptr;
GameObject* go = new GameObject();
ASSERT(!sObjectMgr->IsGameObjectStaticTransport(data->id));

View file

@ -2422,9 +2422,14 @@ void ObjectMgr::LoadCreatures()
data.spawntimesecs = 14 * DAY;
// Skip spawnMask check for transport maps
if (!_transportMaps.count(data.mapid) && data.spawnMask & ~spawnMasks[data.mapid])
LOG_ERROR("sql.sql", "Table `creature` have creature (SpawnId: {}) that have wrong spawn mask {} including not supported difficulty modes for map (Id: {}).",
spawnId, data.spawnMask, data.mapid);
if (!_transportMaps.count(data.mapid))
{
if (data.spawnMask & ~spawnMasks[data.mapid])
LOG_ERROR("sql.sql", "Table `creature` have creature (SpawnId: {}) that have wrong spawn mask {} including not supported difficulty modes for map (Id: {}).",
spawnId, data.spawnMask, data.mapid);
}
else
data.spawnGroupId = 1; // force compatibility group for transport spawns
bool ok = true;
for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1 && ok; ++diff)
@ -2955,8 +2960,13 @@ void ObjectMgr::LoadGameobjects()
data.spawnMask = fields[14].Get<uint8>();
if (!_transportMaps.count(data.mapid) && data.spawnMask & ~spawnMasks[data.mapid])
LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: {} Entry: {}) that has wrong spawn mask {} including not supported difficulty modes for map (Id: {}), skip", guid, data.id, data.spawnMask, data.mapid);
if (!_transportMaps.count(data.mapid))
{
if (data.spawnMask & ~spawnMasks[data.mapid])
LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: {} Entry: {}) that has wrong spawn mask {} including not supported difficulty modes for map (Id: {}), skip", guid, data.id, data.spawnMask, data.mapid);
}
else
data.spawnGroupId = 1; // force compatibility group for transport spawns
data.phaseMask = fields[15].Get<uint32>();
int16 gameEvent = fields[16].Get<int16>();
@ -8771,11 +8781,12 @@ void ObjectMgr::LoadSpawnGroups()
uint32 oldMSTime = getMSTime();
// Reset prior state for hot-reload support
// Preserve the forced legacy group for spawns on transport maps (set in LoadCreatures/LoadGameobjects).
_spawnGroupMapStore.clear();
for (auto& [id, data] : _creatureDataStore)
data.spawnGroupId = 0;
data.spawnGroupId = _transportMaps.count(data.mapid) ? 1 : 0;
for (auto& [id, data] : _gameObjectDataStore)
data.spawnGroupId = 0;
data.spawnGroupId = _transportMaps.count(data.mapid) ? 1 : 0;
// 0 1 2
QueryResult result = WorldDatabase.Query("SELECT groupId, spawnType, spawnId FROM spawn_group");

View file

@ -235,11 +235,11 @@ public:
data.posZ = chr->GetTransOffsetZ();
data.orientation = chr->GetTransOffsetO();
Creature* creature = trans->CreateNPCPassenger(guid, &data);
creature->SaveToDB(trans->GetGOInfo()->moTransport.mapID, 1 << map->GetSpawnMode(), chr->GetPhaseMaskForSpawn());
sObjectMgr->AddCreatureToGrid(guid, &data);
if (Creature* creature = trans->CreateNPCPassenger(guid, &data))
{
creature->SaveToDB(trans->GetGOInfo()->moTransport.mapID, 1 << map->GetSpawnMode(), chr->GetPhaseMaskForSpawn());
sObjectMgr->AddCreatureToGrid(guid, &data);
}
return true;
}