Core/AreaTriggers: Fix triggering of client areatriggers for some shapes

Port From (https://github.com/TrinityCore/TrinityCore/commit/b070e63fa867f7f25e73e9ef3aafbe18902a50e9)
This commit is contained in:
Hondacrx
2024-08-25 19:11:12 -04:00
parent a21c82d0c0
commit c2409af60b
11 changed files with 218 additions and 111 deletions
+6
View File
@@ -230,6 +230,7 @@ namespace Game.DataStorage
LFGDungeonsStorage = ReadDB2<LFGDungeonsRecord>("LFGDungeons.db2", HotfixStatements.SEL_LFG_DUNGEONS, HotfixStatements.SEL_LFG_DUNGEONS_LOCALE);
LightStorage = ReadDB2<LightRecord>("Light.db2", HotfixStatements.SEL_LIGHT);
LiquidTypeStorage = ReadDB2<LiquidTypeRecord>("LiquidType.db2", HotfixStatements.SEL_LIQUID_TYPE);
LocationStorage = ReadDB2<LocationRecord>("Location.db2", HotfixStatements.SEL_LOCATION);
LockStorage = ReadDB2<LockRecord>("Lock.db2", HotfixStatements.SEL_LOCK);
MailTemplateStorage = ReadDB2<MailTemplateRecord>("MailTemplate.db2", HotfixStatements.SEL_MAIL_TEMPLATE, HotfixStatements.SEL_MAIL_TEMPLATE_LOCALE);
MapStorage = ReadDB2<MapRecord>("Map.db2", HotfixStatements.SEL_MAP, HotfixStatements.SEL_MAP_LOCALE);
@@ -251,6 +252,8 @@ namespace Game.DataStorage
NumTalentsAtLevelStorage = ReadDB2<NumTalentsAtLevelRecord>("NumTalentsAtLevel.db2", HotfixStatements.SEL_NUM_TALENTS_AT_LEVEL);
OverrideSpellDataStorage = ReadDB2<OverrideSpellDataRecord>("OverrideSpellData.db2", HotfixStatements.SEL_OVERRIDE_SPELL_DATA);
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);
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);
@@ -670,6 +673,7 @@ namespace Game.DataStorage
public static DB6Storage<LFGDungeonsRecord> LFGDungeonsStorage;
public static DB6Storage<LightRecord> LightStorage;
public static DB6Storage<LiquidTypeRecord> LiquidTypeStorage;
public static DB6Storage<LocationRecord> LocationStorage;
public static DB6Storage<LockRecord> LockStorage;
public static DB6Storage<MailTemplateRecord> MailTemplateStorage;
public static DB6Storage<MapRecord> MapStorage;
@@ -691,6 +695,8 @@ namespace Game.DataStorage
public static DB6Storage<NumTalentsAtLevelRecord> NumTalentsAtLevelStorage;
public static DB6Storage<OverrideSpellDataRecord> OverrideSpellDataStorage;
public static DB6Storage<ParagonReputationRecord> ParagonReputationStorage;
public static DB6Storage<PathRecord> PathStorage;
public static DB6Storage<PathNodeRecord> PathNodeStorage;
public static DB6Storage<PhaseRecord> PhaseStorage;
public static DB6Storage<PhaseXPhaseGroupRecord> PhaseXPhaseGroupStorage;
public static DB6Storage<PlayerConditionRecord> PlayerConditionStorage;
+31
View File
@@ -420,6 +420,31 @@ namespace Game.DataStorage
if (FactionStorage.HasRecord(paragonReputation.FactionID))
_paragonReputations[paragonReputation.FactionID] = paragonReputation;
Dictionary<uint, List<PathNodeRecord>> unsortedNodes = new();
foreach (var (_, pathNode) in CliDB.PathNodeStorage)
{
if (CliDB.PathStorage.ContainsKey(pathNode.PathID))
{
if (CliDB.LocationStorage.ContainsKey(pathNode.LocationID))
{
if (!unsortedNodes.ContainsKey(pathNode.PathID))
unsortedNodes[pathNode.PathID] = new();
unsortedNodes[pathNode.PathID].Add(pathNode);
}
}
}
foreach (var (pathId, pathNodes) in unsortedNodes)
{
pathNodes.OrderBy(node => node.Sequence);
_pathNodes.AddRange(pathId, pathNodes.Select(node =>
{
LocationRecord location = CliDB.LocationStorage.LookupByKey(node.LocationID);
return location.Pos;
}));
}
foreach (var group in PhaseXPhaseGroupStorage.Values)
{
PhaseRecord phase = PhaseStorage.LookupByKey(group.PhaseId);
@@ -1740,6 +1765,11 @@ namespace Game.DataStorage
return _paragonReputations.LookupByKey(factionId);
}
public List<Vector3> GetNodesForPath(uint pathId)
{
return _pathNodes.LookupByKey(pathId);
}
public PvpDifficultyRecord GetBattlegroundBracketByLevel(uint mapid, uint level)
{
PvpDifficultyRecord maxEntry = null; // used for level > max listed level case
@@ -2328,6 +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();
MultiMap<uint, uint> _phasesByGroup = new();
Dictionary<PowerType, PowerTypeRecord> _powerTypes = new();
Dictionary<uint, byte> _pvpItemBonus = new();
@@ -96,6 +96,13 @@ namespace Game.DataStorage
public float[] Coefficient = new float[4];
}
public sealed class LocationRecord
{
public uint Id;
public Vector3 Pos;
public float[] Rot = new float[3];
}
public sealed class LockRecord
{
public uint Id;
@@ -13,6 +13,26 @@ namespace Game.DataStorage
public int QuestID;
}
public sealed class PathRecord
{
public uint Id;
public byte Type;
public byte SplineType;
public byte Red;
public byte Green;
public byte Blue;
public byte Alpha;
public byte Flags;
}
public sealed class PathNodeRecord
{
public uint Id;
public ushort PathID;
public short Sequence;
public int LocationID;
}
public sealed class PhaseRecord
{
public uint Id;