From 0300c3d3809202e4643fa87022f6f0c23b936e42 Mon Sep 17 00:00:00 2001 From: EliphasNUIT Date: Mon, 28 Oct 2024 10:23:33 +0100 Subject: [PATCH] some guid event cleanup --- GW2EIEvtcParser/EIData/Actors/Player.cs | 2 +- GW2EIEvtcParser/ParsedData/CombatData.cs | 4 ++-- .../CombatEvents/MetaDataEvents/EffectGUIDEvent.cs | 5 +++++ .../CombatEvents/MetaDataEvents/IDToGUIDEvent.cs | 6 +++++- .../CombatEvents/MetaDataEvents/MarkerGUIDEvent.cs | 4 ++++ .../StatusEvents/EffectEvents/EffectEvent.cs | 4 +++- .../StatusEvents/MarkerEvents/MarkerEvent.cs | 9 +++++++++ 7 files changed, 29 insertions(+), 5 deletions(-) diff --git a/GW2EIEvtcParser/EIData/Actors/Player.cs b/GW2EIEvtcParser/EIData/Actors/Player.cs index 1e5655358..245465713 100644 --- a/GW2EIEvtcParser/EIData/Actors/Player.cs +++ b/GW2EIEvtcParser/EIData/Actors/Player.cs @@ -122,7 +122,7 @@ public IReadOnlyList> GetCommanderStates(ParsedEvtcLog lo foreach (MarkerEvent markerEvent in markerEvents) { MarkerGUIDEvent marker = markerEvent.GUIDEvent; - if (marker != null) + if (marker.ContentID >= 0) { if (MarkerGUIDs.CommanderTagMarkersHexGUIDs.Contains(marker.HexContentGUID)) { diff --git a/GW2EIEvtcParser/ParsedData/CombatData.cs b/GW2EIEvtcParser/ParsedData/CombatData.cs index 4bce2f7bb..92ff6eba1 100644 --- a/GW2EIEvtcParser/ParsedData/CombatData.cs +++ b/GW2EIEvtcParser/ParsedData/CombatData.cs @@ -1590,7 +1590,7 @@ internal EffectGUIDEvent GetEffectGUIDEvent(long effectID) throw new EvtcCombatEventException("Missing GUID event for effect " + effectID); } #endif - return null; + return EffectGUIDEvent.DummyEffectGUID; } /// @@ -1618,7 +1618,7 @@ internal MarkerGUIDEvent GetMarkerGUIDEvent(long markerID) { return evt; } - return null; + return MarkerGUIDEvent.DummyMarkerGUID; } public IReadOnlyList GetGliderEvents(AgentItem src) diff --git a/GW2EIEvtcParser/ParsedData/CombatEvents/MetaDataEvents/EffectGUIDEvent.cs b/GW2EIEvtcParser/ParsedData/CombatEvents/MetaDataEvents/EffectGUIDEvent.cs index 3b1cc2620..fd36d2a56 100644 --- a/GW2EIEvtcParser/ParsedData/CombatEvents/MetaDataEvents/EffectGUIDEvent.cs +++ b/GW2EIEvtcParser/ParsedData/CombatEvents/MetaDataEvents/EffectGUIDEvent.cs @@ -2,9 +2,14 @@ { public class EffectGUIDEvent : IDToGUIDEvent { + internal static EffectGUIDEvent DummyEffectGUID = new EffectGUIDEvent(); internal EffectGUIDEvent(CombatItem evtcItem) : base(evtcItem) { } + internal EffectGUIDEvent() : base() + { + } + } } diff --git a/GW2EIEvtcParser/ParsedData/CombatEvents/MetaDataEvents/IDToGUIDEvent.cs b/GW2EIEvtcParser/ParsedData/CombatEvents/MetaDataEvents/IDToGUIDEvent.cs index a5521f141..ccdd00d03 100644 --- a/GW2EIEvtcParser/ParsedData/CombatEvents/MetaDataEvents/IDToGUIDEvent.cs +++ b/GW2EIEvtcParser/ParsedData/CombatEvents/MetaDataEvents/IDToGUIDEvent.cs @@ -15,7 +15,11 @@ internal IDToGUIDEvent(CombatItem evtcItem) : base(evtcItem) (HexContentGUID, Base64ContentGUID) = UnpackGUID(evtcItem.SrcAgent, evtcItem.DstAgent); ContentID = evtcItem.SkillID; } - + internal IDToGUIDEvent() : base() + { + (HexContentGUID, Base64ContentGUID) = ("", ""); + ContentID = -1; + } internal static (string hex, string base64) UnpackGUID(ulong first8, ulong last8) { byte[] guid = new byte[16]; diff --git a/GW2EIEvtcParser/ParsedData/CombatEvents/MetaDataEvents/MarkerGUIDEvent.cs b/GW2EIEvtcParser/ParsedData/CombatEvents/MetaDataEvents/MarkerGUIDEvent.cs index d42570c73..40ee9d66a 100644 --- a/GW2EIEvtcParser/ParsedData/CombatEvents/MetaDataEvents/MarkerGUIDEvent.cs +++ b/GW2EIEvtcParser/ParsedData/CombatEvents/MetaDataEvents/MarkerGUIDEvent.cs @@ -2,9 +2,13 @@ { public class MarkerGUIDEvent : IDToGUIDEvent { + internal static MarkerGUIDEvent DummyMarkerGUID = new MarkerGUIDEvent(); internal MarkerGUIDEvent(CombatItem evtcItem) : base(evtcItem) { } + internal MarkerGUIDEvent() : base() + { + } } } diff --git a/GW2EIEvtcParser/ParsedData/CombatEvents/StatusEvents/EffectEvents/EffectEvent.cs b/GW2EIEvtcParser/ParsedData/CombatEvents/StatusEvents/EffectEvents/EffectEvent.cs index 21980514c..d0b7935cd 100644 --- a/GW2EIEvtcParser/ParsedData/CombatEvents/StatusEvents/EffectEvents/EffectEvent.cs +++ b/GW2EIEvtcParser/ParsedData/CombatEvents/StatusEvents/EffectEvents/EffectEvent.cs @@ -10,7 +10,9 @@ public abstract class EffectEvent : AbstractEffectEvent /// Id of the created visual effect. Match to stable GUID with . /// public long EffectID { get; } - + /// + /// GUID event of the effect, can not be null + /// public EffectGUIDEvent GUIDEvent { get; private set; } /// diff --git a/GW2EIEvtcParser/ParsedData/CombatEvents/StatusEvents/MarkerEvents/MarkerEvent.cs b/GW2EIEvtcParser/ParsedData/CombatEvents/StatusEvents/MarkerEvents/MarkerEvent.cs index 56c355b58..e4daf9f48 100644 --- a/GW2EIEvtcParser/ParsedData/CombatEvents/StatusEvents/MarkerEvents/MarkerEvent.cs +++ b/GW2EIEvtcParser/ParsedData/CombatEvents/StatusEvents/MarkerEvents/MarkerEvent.cs @@ -2,8 +2,17 @@ { public class MarkerEvent : AbstractStatusEvent { + /// + /// ID of the marker. Match to stable GUID with . + /// public int MarkerID { get; } + /// + /// GUID event of the effect, can not be null + /// public MarkerGUIDEvent GUIDEvent { get; private set; } + /// + /// Time at which marker has been removed. + /// public long EndTime { get; protected set; } = int.MaxValue; internal bool IsEnd => MarkerID == 0;