Core/Misc: Rename AreaTriggerStruct to AreaTriggerTeleport

Port From (https://github.com/TrinityCore/TrinityCore/commit/d5b07faca1bb36bd7c836f3f280530f9b26834b1)
This commit is contained in:
Hondacrx
2025-12-08 14:08:14 -05:00
parent bb9d8b50fc
commit 1047cd825d
5 changed files with 24 additions and 24 deletions
+2 -2
View File
@@ -249,7 +249,7 @@ namespace Game.Chat.Commands
player.SaveRecallPosition(); player.SaveRecallPosition();
// try going to entrance // try going to entrance
AreaTriggerStruct exit = Global.ObjectMgr.GetGoBackTrigger(mapId); AreaTriggerTeleport exit = Global.ObjectMgr.GetGoBackTrigger(mapId);
if (exit != null) if (exit != null)
{ {
if (player.TeleportTo(exit.target_mapId, exit.target_X, exit.target_Y, exit.target_Z, exit.target_Orientation + MathF.PI)) if (player.TeleportTo(exit.target_mapId, exit.target_X, exit.target_Y, exit.target_Z, exit.target_Orientation + MathF.PI))
@@ -268,7 +268,7 @@ namespace Game.Chat.Commands
handler.SendSysMessage(CypherStrings.CommandInstanceNoExit, mapName, mapId); handler.SendSysMessage(CypherStrings.CommandInstanceNoExit, mapName, mapId);
// try going to start // try going to start
AreaTriggerStruct entrance = Global.ObjectMgr.GetMapEntranceTrigger(mapId); AreaTriggerTeleport entrance = Global.ObjectMgr.GetMapEntranceTrigger(mapId);
if (entrance != null) if (entrance != null)
{ {
if (player.TeleportTo(entrance.target_mapId, entrance.target_X, entrance.target_Y, entrance.target_Z, entrance.target_Orientation)) if (player.TeleportTo(entrance.target_mapId, entrance.target_X, entrance.target_Y, entrance.target_Z, entrance.target_Orientation))
+1 -1
View File
@@ -216,7 +216,7 @@ namespace Game.DungeonFinding
// No teleport coords in database, load from areatriggers // No teleport coords in database, load from areatriggers
if (dungeon.type != LfgType.Random && dungeon.x == 0.0f && dungeon.y == 0.0f && dungeon.z == 0.0f) if (dungeon.type != LfgType.Random && dungeon.x == 0.0f && dungeon.y == 0.0f && dungeon.z == 0.0f)
{ {
AreaTriggerStruct at = Global.ObjectMgr.GetMapEntranceTrigger(dungeon.map); AreaTriggerTeleport at = Global.ObjectMgr.GetMapEntranceTrigger(dungeon.map);
if (at == null) if (at == null)
{ {
Log.outError(LogFilter.Lfg, "LoadLFGDungeons: Failed to load dungeon {0} (Id: {1}), cant find areatrigger for map {2}", dungeon.name, dungeon.id, dungeon.map); Log.outError(LogFilter.Lfg, "LoadLFGDungeons: Failed to load dungeon {0} (Id: {1}), cant find areatrigger for map {2}", dungeon.name, dungeon.id, dungeon.map);
+1 -1
View File
@@ -3390,7 +3390,7 @@ namespace Game.Entities
if (map == null) if (map == null)
map = Global.MapMgr.CreateMap(mapId, this); map = Global.MapMgr.CreateMap(mapId, this);
AreaTriggerStruct areaTrigger = null; AreaTriggerTeleport areaTrigger = null;
bool check = false; bool check = false;
if (map == null) if (map == null)
+19 -19
View File
@@ -5464,17 +5464,24 @@ namespace Game
{ {
++count; ++count;
uint Trigger_ID = result.Read<uint>(0); uint triggerId = result.Read<uint>(0);
uint PortLocID = result.Read<uint>(1); uint portLocId = result.Read<uint>(1);
WorldSafeLocsEntry portLoc = GetWorldSafeLoc(PortLocID); var atEntry = CliDB.AreaTriggerStorage.LookupByKey(triggerId);
if (portLoc == null) if (atEntry == null)
{ {
Log.outError(LogFilter.Sql, "Area Trigger (ID: {0}) has a non-existing Port Loc (ID: {1}) in WorldSafeLocs.dbc, skipped", Trigger_ID, PortLocID); Log.outError(LogFilter.Sql, $"Area Trigger (ID: {triggerId}) does not exist in AreaTrigger.dbc.");
continue; continue;
} }
AreaTriggerStruct at = new(); WorldSafeLocsEntry portLoc = GetWorldSafeLoc(portLocId);
if (portLoc == null)
{
Log.outError(LogFilter.Sql, "Area Trigger (ID: {0}) has a non-existing Port Loc (ID: {1}) in WorldSafeLocs.dbc, skipped", triggerId, portLocId);
continue;
}
AreaTriggerTeleport at = new();
at.target_mapId = portLoc.Loc.GetMapId(); at.target_mapId = portLoc.Loc.GetMapId();
at.target_X = portLoc.Loc.GetPositionX(); at.target_X = portLoc.Loc.GetPositionX();
at.target_Y = portLoc.Loc.GetPositionY(); at.target_Y = portLoc.Loc.GetPositionY();
@@ -5482,14 +5489,7 @@ namespace Game
at.target_Orientation = portLoc.Loc.GetOrientation(); at.target_Orientation = portLoc.Loc.GetOrientation();
at.PortLocId = portLoc.Id; at.PortLocId = portLoc.Id;
AreaTriggerRecord atEntry = CliDB.AreaTriggerStorage.LookupByKey(Trigger_ID); _areaTriggerStorage[triggerId] = at;
if (atEntry == null)
{
Log.outError(LogFilter.Sql, "Area trigger (ID: {0}) does not exist in `AreaTrigger.dbc`.", Trigger_ID);
continue;
}
_areaTriggerStorage[Trigger_ID] = at;
} while (result.NextRow()); } while (result.NextRow());
@@ -11277,7 +11277,7 @@ namespace Game
return mountModel.CreatureDisplayID; return mountModel.CreatureDisplayID;
} }
public AreaTriggerStruct GetAreaTrigger(uint trigger) public AreaTriggerTeleport GetAreaTrigger(uint trigger)
{ {
return _areaTriggerStorage.LookupByKey(trigger); return _areaTriggerStorage.LookupByKey(trigger);
} }
@@ -11292,7 +11292,7 @@ namespace Game
return _tavernAreaTriggerStorage.Contains(Trigger_ID); return _tavernAreaTriggerStorage.Contains(Trigger_ID);
} }
public AreaTriggerStruct GetGoBackTrigger(uint Map) public AreaTriggerTeleport GetGoBackTrigger(uint Map)
{ {
uint? parentId = null; uint? parentId = null;
MapRecord mapEntry = CliDB.MapStorage.LookupByKey(Map); MapRecord mapEntry = CliDB.MapStorage.LookupByKey(Map);
@@ -11319,7 +11319,7 @@ namespace Game
return null; return null;
} }
public AreaTriggerStruct GetMapEntranceTrigger(uint Map) public AreaTriggerTeleport GetMapEntranceTrigger(uint Map)
{ {
foreach (var pair in _areaTriggerStorage) foreach (var pair in _areaTriggerStorage)
{ {
@@ -11783,7 +11783,7 @@ namespace Game
Dictionary<int, PlayerChoiceLocale> _playerChoiceLocales = new(); Dictionary<int, PlayerChoiceLocale> _playerChoiceLocales = new();
List<uint> _tavernAreaTriggerStorage = new(); List<uint> _tavernAreaTriggerStorage = new();
Dictionary<uint, AreaTriggerStruct> _areaTriggerStorage = new(); Dictionary<uint, AreaTriggerTeleport> _areaTriggerStorage = new();
Dictionary<ulong, AccessRequirement> _accessRequirementStorage = new(); Dictionary<ulong, AccessRequirement> _accessRequirementStorage = new();
Dictionary<uint, WorldSafeLocsEntry> _worldSafeLocs = new(); Dictionary<uint, WorldSafeLocsEntry> _worldSafeLocs = new();
@@ -12312,7 +12312,7 @@ namespace Game
} }
} }
public class AreaTriggerStruct public class AreaTriggerTeleport
{ {
public uint target_mapId; public uint target_mapId;
public float target_X; public float target_X;
+1 -1
View File
@@ -288,7 +288,7 @@ namespace Game
if (!packet.Entered) if (!packet.Entered)
return; return;
AreaTriggerStruct at = Global.ObjectMgr.GetAreaTrigger(packet.AreaTriggerID); AreaTriggerTeleport at = Global.ObjectMgr.GetAreaTrigger(packet.AreaTriggerID);
if (at == null) if (at == null)
return; return;