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:
@@ -318,6 +318,9 @@ void MotionTransport::RemovePassenger(WorldObject* passenger, bool withAll)
|
|||||||
Creature* MotionTransport::CreateNPCPassenger(ObjectGuid::LowType guid, CreatureData const* data)
|
Creature* MotionTransport::CreateNPCPassenger(ObjectGuid::LowType guid, CreatureData const* data)
|
||||||
{
|
{
|
||||||
Map* map = GetMap();
|
Map* map = GetMap();
|
||||||
|
if (map->GetCreatureRespawnTime(guid))
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
Creature* creature = new Creature();
|
Creature* creature = new Creature();
|
||||||
|
|
||||||
if (!creature->LoadCreatureFromDB(guid, map, false))
|
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)
|
GameObject* MotionTransport::CreateGOPassenger(ObjectGuid::LowType guid, GameObjectData const* data)
|
||||||
{
|
{
|
||||||
Map* map = GetMap();
|
Map* map = GetMap();
|
||||||
|
if (map->GetGORespawnTime(guid))
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
GameObject* go = new GameObject();
|
GameObject* go = new GameObject();
|
||||||
ASSERT(!sObjectMgr->IsGameObjectStaticTransport(data->id));
|
ASSERT(!sObjectMgr->IsGameObjectStaticTransport(data->id));
|
||||||
|
|
||||||
|
|||||||
@@ -2422,9 +2422,14 @@ void ObjectMgr::LoadCreatures()
|
|||||||
data.spawntimesecs = 14 * DAY;
|
data.spawntimesecs = 14 * DAY;
|
||||||
|
|
||||||
// Skip spawnMask check for transport maps
|
// Skip spawnMask check for transport maps
|
||||||
if (!_transportMaps.count(data.mapid) && data.spawnMask & ~spawnMasks[data.mapid])
|
if (!_transportMaps.count(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 (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;
|
bool ok = true;
|
||||||
for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1 && ok; ++diff)
|
for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1 && ok; ++diff)
|
||||||
@@ -2955,8 +2960,13 @@ void ObjectMgr::LoadGameobjects()
|
|||||||
|
|
||||||
data.spawnMask = fields[14].Get<uint8>();
|
data.spawnMask = fields[14].Get<uint8>();
|
||||||
|
|
||||||
if (!_transportMaps.count(data.mapid) && data.spawnMask & ~spawnMasks[data.mapid])
|
if (!_transportMaps.count(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 (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>();
|
data.phaseMask = fields[15].Get<uint32>();
|
||||||
int16 gameEvent = fields[16].Get<int16>();
|
int16 gameEvent = fields[16].Get<int16>();
|
||||||
@@ -8771,11 +8781,12 @@ void ObjectMgr::LoadSpawnGroups()
|
|||||||
uint32 oldMSTime = getMSTime();
|
uint32 oldMSTime = getMSTime();
|
||||||
|
|
||||||
// Reset prior state for hot-reload support
|
// Reset prior state for hot-reload support
|
||||||
|
// Preserve the forced legacy group for spawns on transport maps (set in LoadCreatures/LoadGameobjects).
|
||||||
_spawnGroupMapStore.clear();
|
_spawnGroupMapStore.clear();
|
||||||
for (auto& [id, data] : _creatureDataStore)
|
for (auto& [id, data] : _creatureDataStore)
|
||||||
data.spawnGroupId = 0;
|
data.spawnGroupId = _transportMaps.count(data.mapid) ? 1 : 0;
|
||||||
for (auto& [id, data] : _gameObjectDataStore)
|
for (auto& [id, data] : _gameObjectDataStore)
|
||||||
data.spawnGroupId = 0;
|
data.spawnGroupId = _transportMaps.count(data.mapid) ? 1 : 0;
|
||||||
|
|
||||||
// 0 1 2
|
// 0 1 2
|
||||||
QueryResult result = WorldDatabase.Query("SELECT groupId, spawnType, spawnId FROM spawn_group");
|
QueryResult result = WorldDatabase.Query("SELECT groupId, spawnType, spawnId FROM spawn_group");
|
||||||
|
|||||||
@@ -235,11 +235,11 @@ public:
|
|||||||
data.posZ = chr->GetTransOffsetZ();
|
data.posZ = chr->GetTransOffsetZ();
|
||||||
data.orientation = chr->GetTransOffsetO();
|
data.orientation = chr->GetTransOffsetO();
|
||||||
|
|
||||||
Creature* creature = trans->CreateNPCPassenger(guid, &data);
|
if (Creature* creature = trans->CreateNPCPassenger(guid, &data))
|
||||||
|
{
|
||||||
creature->SaveToDB(trans->GetGOInfo()->moTransport.mapID, 1 << map->GetSpawnMode(), chr->GetPhaseMaskForSpawn());
|
creature->SaveToDB(trans->GetGOInfo()->moTransport.mapID, 1 << map->GetSpawnMode(), chr->GetPhaseMaskForSpawn());
|
||||||
|
sObjectMgr->AddCreatureToGrid(guid, &data);
|
||||||
sObjectMgr->AddCreatureToGrid(guid, &data);
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user