Core/Transports: Force transport passengers into legacy spawn group

Port From (https://github.com/TrinityCore/TrinityCore/commit/068b340b6988c3edd8db2b9d62a99baebe1b031e)
This commit is contained in:
hondacrx
2021-09-26 11:51:57 -04:00
parent aac3003bc2
commit e747de7608
3 changed files with 12 additions and 7 deletions
+6 -5
View File
@@ -657,12 +657,13 @@ namespace Game.Chat
data.Id = id; data.Id = id;
data.spawnPoint.Relocate(chr.GetTransOffsetX(), chr.GetTransOffsetY(), chr.GetTransOffsetZ(), chr.GetTransOffsetO()); data.spawnPoint.Relocate(chr.GetTransOffsetX(), chr.GetTransOffsetY(), chr.GetTransOffsetZ(), chr.GetTransOffsetO());
data.spawnGroupData = new(); data.spawnGroupData = new();
// @todo: add phases
Creature _creature = trans.CreateNPCPassenger(guid, data); Creature creaturePassenger = trans.CreateNPCPassenger(guid, data);
_creature.SaveToDB((uint)trans.GetGoInfo().MoTransport.SpawnMap, new List<Difficulty>() { map.GetDifficultyID() }); if (creaturePassenger != null)
{
Global.ObjectMgr.AddCreatureToGrid(guid, data); creaturePassenger.SaveToDB((uint)trans.GetGoInfo().MoTransport.SpawnMap, new List<Difficulty>() { map.GetDifficultyID() });
Global.ObjectMgr.AddCreatureToGrid(guid, data);
}
return true; return true;
} }
+4
View File
@@ -318,6 +318,8 @@ namespace Game.Entities
public Creature CreateNPCPassenger(ulong guid, CreatureData data) public Creature CreateNPCPassenger(ulong guid, CreatureData data)
{ {
Map map = GetMap(); Map map = GetMap();
if (map.GetCreatureRespawnTime(guid) != 0)
return null;
Creature creature = Creature.CreateCreatureFromDB(guid, map, false, true); Creature creature = Creature.CreateCreatureFromDB(guid, map, false, true);
if (!creature) if (!creature)
@@ -359,6 +361,8 @@ namespace Game.Entities
GameObject CreateGOPassenger(ulong guid, GameObjectData data) GameObject CreateGOPassenger(ulong guid, GameObjectData data)
{ {
Map map = GetMap(); Map map = GetMap();
if (map.GetGORespawnTime(guid) != 0)
return null;
GameObject go = CreateGameObjectFromDB(guid, map, false); GameObject go = CreateGameObjectFromDB(guid, map, false);
if (!go) if (!go)
+2 -2
View File
@@ -3319,7 +3319,7 @@ namespace Game
data.phaseGroup = result.Read<uint>(25); data.phaseGroup = result.Read<uint>(25);
data.terrainSwapMap = result.Read<int>(26); data.terrainSwapMap = result.Read<int>(26);
data.ScriptId = GetScriptId(result.Read<string>(27)); data.ScriptId = GetScriptId(result.Read<string>(27));
data.spawnGroupData = _spawnGroupDataStorage[0]; data.spawnGroupData = _spawnGroupDataStorage[IsTransportMap(data.spawnPoint.GetMapId()) ? 1 : 0]; // transport spawns default to compatibility group
var mapEntry = CliDB.MapStorage.LookupByKey(data.spawnPoint.GetMapId()); var mapEntry = CliDB.MapStorage.LookupByKey(data.spawnPoint.GetMapId());
if (mapEntry == null) if (mapEntry == null)
@@ -4063,7 +4063,7 @@ namespace Game
data.rotation.Z = result.Read<float>(9); data.rotation.Z = result.Read<float>(9);
data.rotation.W = result.Read<float>(10); data.rotation.W = result.Read<float>(10);
data.spawntimesecs = result.Read<int>(11); data.spawntimesecs = result.Read<int>(11);
data.spawnGroupData = _spawnGroupDataStorage[0]; data.spawnGroupData = _spawnGroupDataStorage[IsTransportMap(data.spawnPoint.GetMapId()) ? 1 : 0]; // transport spawns default to compatibility group
var mapEntry = CliDB.MapStorage.LookupByKey(data.spawnPoint.GetMapId()); var mapEntry = CliDB.MapStorage.LookupByKey(data.spawnPoint.GetMapId());
if (mapEntry == null) if (mapEntry == null)