Skip to content

Commit

Permalink
Analytics: Identify extension events
Browse files Browse the repository at this point in the history
  • Loading branch information
Sejsel committed Jul 8, 2024
1 parent b25e4d0 commit 2aa6331
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions EVTCAnalytics/Events/UnknownEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,9 @@ public class UnknownEvent(long time, object eventData) : Event(time)
/// </remarks>
public object EventData { get; } = eventData;
}

/// <summary>
/// An <see cref="Event"/> from an extension (an addon for arcdps) which is not recognized or implemented yet.
/// </summary>
public class UnknownExtensionEvent(long time, object eventData) : UnknownEvent(time, eventData);
}
4 changes: 4 additions & 0 deletions EVTCAnalytics/Parsing/CombatItemFilters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ private static IEnumerable<StateChange> GetDirectStateChangesForEventType(Type e
// so we need to return all of them.
Debug.Assert(Enum.GetUnderlyingType(typeof(StateChange)) == typeof(byte));
if (eventType == typeof(UnknownEvent)) return Enumerable.Range(0, 256).Select(x => (StateChange) x);
if (eventType == typeof(UnknownExtensionEvent)) return [StateChange.Extension];

throw new ArgumentException($"Event type {eventType} is not supported.");
}
Expand Down Expand Up @@ -353,6 +354,7 @@ private static bool IsDirectBuffDamage(Type eventType)

// The unknown event can come from anything
if (eventType == typeof(UnknownEvent)) return true;
if (eventType == typeof(UnknownExtensionEvent)) return false;

throw new ArgumentException($"Event type {eventType} is not supported.");
}
Expand Down Expand Up @@ -427,6 +429,7 @@ private static bool IsDirectSkillCast(Type eventType)

// The unknown event can come from anything
if (eventType == typeof(UnknownEvent)) return true;
if (eventType == typeof(UnknownExtensionEvent)) return false;

throw new ArgumentException($"Event type {eventType} is not supported.");
}
Expand Down Expand Up @@ -503,6 +506,7 @@ private static IEnumerable<Result> GetDirectPhysicalResultsForEventType(Type eve
// so we need to return all of them.
Debug.Assert(Enum.GetUnderlyingType(typeof(Result)) == typeof(byte));
if (eventType == typeof(UnknownEvent)) return Enumerable.Range(0, 256).Select(x => (Result) x);
if (eventType == typeof(UnknownExtensionEvent)) return [];

throw new ArgumentException($"Event type {eventType} is not supported.");
}
Expand Down
3 changes: 1 addition & 2 deletions EVTCAnalytics/Processing/LogProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1120,8 +1120,7 @@ static WeaponSet WeaponSetFromId(long id)
// Should not appear in logs
return new UnknownEvent(item.Time, item);
case StateChange.Extension:
// TODO: Implement
return new UnknownEvent(item.Time, item);
return new UnknownExtensionEvent(item.Time, item);
case StateChange.ApiDelayed:
// Should not appear in logs
return new UnknownEvent(item.Time, item);
Expand Down

0 comments on commit 2aa6331

Please sign in to comment.