Core/Misc: Some refactoring
Port From (https://github.com/TrinityCore/TrinityCore/commit/94a79bac7a06aa0f931e9d651928de7eea0a8b5c)
This commit is contained in:
@@ -53,6 +53,9 @@ namespace Game.Entities
|
||||
if (!IsInWorld)
|
||||
{
|
||||
GetMap().GetObjectsStore().Add(GetGUID(), this);
|
||||
if (_spawnId != 0)
|
||||
GetMap().GetAreaTriggerBySpawnIdStore().Add(_spawnId, this);
|
||||
|
||||
base.AddToWorld();
|
||||
}
|
||||
}
|
||||
@@ -74,6 +77,9 @@ namespace Game.Entities
|
||||
_ai.OnRemove();
|
||||
|
||||
base.RemoveFromWorld();
|
||||
if (_spawnId != 0)
|
||||
GetMap().GetAreaTriggerBySpawnIdStore().Remove(_spawnId, this);
|
||||
|
||||
GetMap().GetObjectsStore().Remove(GetGUID());
|
||||
}
|
||||
}
|
||||
@@ -236,7 +242,7 @@ namespace Game.Entities
|
||||
if (position == null)
|
||||
return false;
|
||||
|
||||
AreaTriggerTemplate areaTriggerTemplate = Global.AreaTriggerDataStorage.GetAreaTriggerTemplate(position.Id);
|
||||
AreaTriggerTemplate areaTriggerTemplate = Global.AreaTriggerDataStorage.GetAreaTriggerTemplate(position.TriggerId);
|
||||
if (areaTriggerTemplate == null)
|
||||
return false;
|
||||
|
||||
@@ -246,7 +252,7 @@ namespace Game.Entities
|
||||
bool CreateServer(Map map, AreaTriggerTemplate areaTriggerTemplate, AreaTriggerSpawn position)
|
||||
{
|
||||
SetMap(map);
|
||||
Relocate(position.Location);
|
||||
Relocate(position.SpawnPoint);
|
||||
if (!IsPositionValid())
|
||||
{
|
||||
Log.outError(LogFilter.AreaTrigger, $"AreaTriggerServer (id {areaTriggerTemplate.Id}) not created. Invalid coordinates (X: {GetPositionX()} Y: {GetPositionY()})");
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Dynamic;
|
||||
using Game.Maps;
|
||||
using Game.Networking;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -319,18 +320,12 @@ namespace Game.Entities
|
||||
public uint ScriptId;
|
||||
}
|
||||
|
||||
public class AreaTriggerSpawn
|
||||
public class AreaTriggerSpawn : SpawnData
|
||||
{
|
||||
public ulong SpawnId;
|
||||
public AreaTriggerId Id;
|
||||
public WorldLocation Location;
|
||||
public uint PhaseId;
|
||||
public uint PhaseGroup;
|
||||
public byte PhaseUseFlags;
|
||||
|
||||
public AreaTriggerId TriggerId;
|
||||
public AreaTriggerShapeInfo Shape = new();
|
||||
|
||||
public uint ScriptId;
|
||||
public AreaTriggerSpawn() : base(SpawnObjectType.AreaTrigger) { }
|
||||
}
|
||||
|
||||
public struct AreaTriggerAction
|
||||
|
||||
Reference in New Issue
Block a user