Core/AreaTriggers: Implement height check for polygon db2 areatriggers

Port From (https://github.com/TrinityCore/TrinityCore/commit/1c3268155d0165e150d239c3a808d5a8dddeae18)
This commit is contained in:
Hondacrx
2024-08-25 20:45:39 -04:00
parent c2409af60b
commit 22ec091beb
9 changed files with 109 additions and 39 deletions
+2
View File
@@ -254,6 +254,7 @@ namespace Game.DataStorage
ParagonReputationStorage = ReadDB2<ParagonReputationRecord>("ParagonReputation.db2", HotfixStatements.SEL_PARAGON_REPUTATION);
PathStorage = ReadDB2<PathRecord>("Path.db2", HotfixStatements.SEL_PATH);
PathNodeStorage = ReadDB2<PathNodeRecord>("PathNode.db2", HotfixStatements.SEL_PATH_NODE);
PathPropertyStorage = ReadDB2<PathPropertyRecord>("PathProperty.db2", HotfixStatements.SEL_PATH_PROPERTY);
PhaseStorage = ReadDB2<PhaseRecord>("Phase.db2", HotfixStatements.SEL_PHASE);
PhaseXPhaseGroupStorage = ReadDB2<PhaseXPhaseGroupRecord>("PhaseXPhaseGroup.db2", HotfixStatements.SEL_PHASE_X_PHASE_GROUP);
PlayerConditionStorage = ReadDB2<PlayerConditionRecord>("PlayerCondition.db2", HotfixStatements.SEL_PLAYER_CONDITION, HotfixStatements.SEL_PLAYER_CONDITION_LOCALE);
@@ -697,6 +698,7 @@ namespace Game.DataStorage
public static DB6Storage<ParagonReputationRecord> ParagonReputationStorage;
public static DB6Storage<PathRecord> PathStorage;
public static DB6Storage<PathNodeRecord> PathNodeStorage;
public static DB6Storage<PathPropertyRecord> PathPropertyStorage;
public static DB6Storage<PhaseRecord> PhaseStorage;
public static DB6Storage<PhaseXPhaseGroupRecord> PhaseXPhaseGroupStorage;
public static DB6Storage<PlayerConditionRecord> PlayerConditionStorage;
+23 -16
View File
@@ -423,28 +423,28 @@ namespace Game.DataStorage
Dictionary<uint, List<PathNodeRecord>> unsortedNodes = new();
foreach (var (_, pathNode) in CliDB.PathNodeStorage)
{
if (CliDB.PathStorage.ContainsKey(pathNode.PathID))
if (CliDB.PathStorage.HasRecord(pathNode.PathID) && CliDB.LocationStorage.HasRecord((uint)pathNode.LocationID))
{
if (CliDB.LocationStorage.ContainsKey(pathNode.LocationID))
{
if (!unsortedNodes.ContainsKey(pathNode.PathID))
unsortedNodes[pathNode.PathID] = new();
if (!unsortedNodes.ContainsKey(pathNode.PathID))
unsortedNodes[pathNode.PathID] = new();
unsortedNodes[pathNode.PathID].Add(pathNode);
}
}
unsortedNodes[pathNode.PathID].Add(pathNode);
}
}
foreach (var (pathId, pathNodes) in unsortedNodes)
{
if (!_paths.ContainsKey(pathId))
_paths[pathId] = new();
pathNodes.OrderBy(node => node.Sequence);
_pathNodes.AddRange(pathId, pathNodes.Select(node =>
{
LocationRecord location = CliDB.LocationStorage.LookupByKey(node.LocationID);
return location.Pos;
}));
_paths[pathId].Locations.AddRange(pathNodes.Select(node => CliDB.LocationStorage.LookupByKey(node.LocationID).Pos));
}
foreach (var (_, pathProperty) in CliDB.PathPropertyStorage)
if (CliDB.PathStorage.HasRecord(pathProperty.PathID))
_paths[pathProperty.PathID].Properties.Add(pathProperty);
foreach (var group in PhaseXPhaseGroupStorage.Values)
{
PhaseRecord phase = PhaseStorage.LookupByKey(group.PhaseId);
@@ -1765,9 +1765,9 @@ namespace Game.DataStorage
return _paragonReputations.LookupByKey(factionId);
}
public List<Vector3> GetNodesForPath(uint pathId)
public PathDb2 GetPath(uint pathId)
{
return _pathNodes.LookupByKey(pathId);
return _paths.LookupByKey(pathId);
}
public PvpDifficultyRecord GetBattlegroundBracketByLevel(uint mapid, uint level)
@@ -2358,7 +2358,7 @@ namespace Game.DataStorage
Dictionary<uint, List<NameGenRecord>[]> _nameGenData = new();
List<string>[] _nameValidators = new List<string>[(int)Locale.Total + 1];
Dictionary<uint, ParagonReputationRecord> _paragonReputations = new();
MultiMap<uint, Vector3> _pathNodes = new();
Dictionary<uint, PathDb2> _paths;
MultiMap<uint, uint> _phasesByGroup = new();
Dictionary<PowerType, PowerTypeRecord> _powerTypes = new();
Dictionary<uint, byte> _pvpItemBonus = new();
@@ -2650,6 +2650,13 @@ namespace Game.DataStorage
public short TargetLevelMax;
}
public class PathDb2
{
public uint Id;
public List<Vector3> Locations = new();
public List<PathPropertyRecord> Properties = new();
}
public class ShapeshiftFormModelData
{
public uint OptionID;
+14 -4
View File
@@ -33,6 +33,16 @@ namespace Game.DataStorage
public int LocationID;
}
public sealed class PathPropertyRecord
{
public uint Id;
public ushort PathID;
public byte PropertyIndex;
public int Value;
public PathPropertyIndex GetPropertyIndex() { return (PathPropertyIndex)PropertyIndex; }
}
public sealed class PhaseRecord
{
public uint Id;
@@ -132,9 +142,9 @@ namespace Game.DataStorage
public uint[] CurrencyCount = new uint[4];
public uint[] QuestKillMonster = new uint[6];
public int[] MovementFlags = new int[2];
public int[]TraitNodeEntryID = new int[4];
public ushort[]TraitNodeEntryMinRank = new ushort[4];
public ushort[]TraitNodeEntryMaxRank = new ushort[4];
public int[] TraitNodeEntryID = new int[4];
public ushort[] TraitNodeEntryMinRank = new ushort[4];
public ushort[] TraitNodeEntryMaxRank = new ushort[4];
}
public sealed class PowerDisplayRecord
@@ -176,7 +186,7 @@ namespace Game.DataStorage
public int AwardedAchievementID;
public bool HasFlag(PrestigeLevelInfoFlags prestigeLevelInfoFlags) { return (Flags & (byte)prestigeLevelInfoFlags) != 0; }
public bool IsDisabled() { return HasFlag(PrestigeLevelInfoFlags.Disabled); }
public bool IsDisabled() { return HasFlag(PrestigeLevelInfoFlags.Disabled); }
}
public sealed class PvpDifficultyRecord