diff --git a/xivsupport/src/main/java/gg/xp/xivsupport/events/actlines/events/AbilityUsedEvent.java b/xivsupport/src/main/java/gg/xp/xivsupport/events/actlines/events/AbilityUsedEvent.java index a433f5b8f684..75748aa894e3 100644 --- a/xivsupport/src/main/java/gg/xp/xivsupport/events/actlines/events/AbilityUsedEvent.java +++ b/xivsupport/src/main/java/gg/xp/xivsupport/events/actlines/events/AbilityUsedEvent.java @@ -26,11 +26,15 @@ public class AbilityUsedEvent extends BaseEvent implements HasSourceEntity, HasT private final long sequenceId; private final long targetIndex; private final long numberOfTargets; - private @Nullable Duration animationLock; + private final @Nullable Duration animationLock; private @Nullable DescribesCastLocation locationInfo; private @Nullable AbilityCastStart precursor; public AbilityUsedEvent(XivAbility ability, XivCombatant caster, XivCombatant target, List effects, long sequenceId, long targetIndex, long numberOfTargets) { + this(ability, caster, target, effects, sequenceId, targetIndex, numberOfTargets, null); + } + + public AbilityUsedEvent(XivAbility ability, XivCombatant caster, XivCombatant target, List effects, long sequenceId, long targetIndex, long numberOfTargets, @Nullable Duration animationLock) { this.ability = ability; this.caster = caster; this.target = target; @@ -38,6 +42,7 @@ public AbilityUsedEvent(XivAbility ability, XivCombatant caster, XivCombatant ta this.sequenceId = sequenceId; this.targetIndex = targetIndex; this.numberOfTargets = numberOfTargets; + this.animationLock = animationLock; } @Override @@ -104,22 +109,13 @@ public void setPrecursor(@NotNull AbilityCastStart precursor) { /** * Get the animation lock. - *

- * Note that this is expected to be populated *after* this event is emitted, as this data - * is not known at the time of the original event. In addition, it may never be present, - * such as if you are importing a non-OP log, or an fflogs import. * - * @see AnimationLockEvent - * @return The animation lock, if one has been set. + * @return The animation lock, if one has been set. Null if using an old ACT version that does not support this. */ public @Nullable Duration getAnimationLock() { return animationLock; } - public void setAnimationLock(@Nullable Duration animationLock) { - this.animationLock = animationLock; - } - @Override public String toString() { return "AbilityUsedEvent{" + diff --git a/xivsupport/src/main/java/gg/xp/xivsupport/events/actlines/events/AnimationLockEvent.java b/xivsupport/src/main/java/gg/xp/xivsupport/events/actlines/events/AnimationLockEvent.java index 2731a8db24ff..39d71060890f 100644 --- a/xivsupport/src/main/java/gg/xp/xivsupport/events/actlines/events/AnimationLockEvent.java +++ b/xivsupport/src/main/java/gg/xp/xivsupport/events/actlines/events/AnimationLockEvent.java @@ -8,6 +8,7 @@ import java.io.Serial; import java.time.Duration; +@Deprecated // No longer needed @SystemEvent public class AnimationLockEvent extends BaseEvent implements HasDuration, HasAbility, HasSourceEntity, HasTargetEntity { @Serial diff --git a/xivsupport/src/main/java/gg/xp/xivsupport/events/actlines/parsers/NetworkAbilityFields.java b/xivsupport/src/main/java/gg/xp/xivsupport/events/actlines/parsers/NetworkAbilityFields.java index c5543b237f63..f6abaa50b86d 100644 --- a/xivsupport/src/main/java/gg/xp/xivsupport/events/actlines/parsers/NetworkAbilityFields.java +++ b/xivsupport/src/main/java/gg/xp/xivsupport/events/actlines/parsers/NetworkAbilityFields.java @@ -3,6 +3,9 @@ import gg.xp.reevent.events.Event; import gg.xp.xivsupport.events.actlines.events.AbilityUsedEvent; import gg.xp.xivsupport.models.XivCombatant; +import org.apache.commons.lang3.time.DurationUtils; + +import java.time.Duration; enum NetworkAbilityFields { casterId, casterName, abilityId, abilityName, targetId, targetName, @@ -17,8 +20,13 @@ enum NetworkAbilityFields { targetCurHp, targetMaxHp, targetCurMp, targetMaxMp, targetUnknown1, targetUnknown2, targetX, targetY, targetZ, targetHeading, casterCurHp, casterMaxHp, casterCurMp, casterMaxMp, casterUnknown1, casterUnknown2, casterX, casterY, casterZ, casterHeading, sequenceId, - targetIndex, - numberOfTargets; + targetIndex, numberOfTargets, + casterOwnerId, casterOwnerName, + effectDisplayType, + actionId, + actionAnimationId, + animationLock, + castAngleRaw; // New fields (not currently used are): /* source.owner.id @@ -44,14 +52,24 @@ public static Event convert(FieldMapper fields) { // Workaround in case someone is using an old ACT version or importing an old log targets = targetIndex; } - return new AbilityUsedEvent( + Duration animLock; + try { + double animLockRaw = fields.getDouble(animationLock); + animLock = Duration.ofMillis((long) (animLockRaw * 1000.0)); + } + catch (Throwable e) { + animLock = null; + } + AbilityUsedEvent out = new AbilityUsedEvent( fields.getAbility(abilityId, abilityName), caster, target, fields.getAbilityEffects(targetName.ordinal() + 3, 8), sequenceId == null ? -1 : sequenceId, targetIndex, - targets + targets, + animLock ); + return out; } } diff --git a/xivsupport/src/main/resources/te_changelog.html b/xivsupport/src/main/resources/te_changelog.html index 1bac587ce0c3..9c24812d10db 100644 --- a/xivsupport/src/main/resources/te_changelog.html +++ b/xivsupport/src/main/resources/te_changelog.html @@ -1,5 +1,9 @@ +

November 15, 2024

+
    +
  • Properly support animation lock field.
  • +

November 12, 2024

  • Game data updates for 7.1.