From 8064d6d94c8faf4900f792e5b56f6153d824fafe Mon Sep 17 00:00:00 2001 From: XP Date: Mon, 2 Sep 2024 14:12:36 -0700 Subject: [PATCH] improve fflogs error logging, add raw status stacks filter --- .../triggers/easytriggers/EasyTriggers.java | 2 ++ .../conditions/StatusRawStacksFilter.java | 29 +++++++++++++++++++ .../events/fflogs/FflogsReportLocator.java | 6 ++-- 3 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 easytriggers/src/main/java/gg/xp/xivsupport/events/triggers/easytriggers/conditions/StatusRawStacksFilter.java diff --git a/easytriggers/src/main/java/gg/xp/xivsupport/events/triggers/easytriggers/EasyTriggers.java b/easytriggers/src/main/java/gg/xp/xivsupport/events/triggers/easytriggers/EasyTriggers.java index 63e34e369e40..429319b172c4 100644 --- a/easytriggers/src/main/java/gg/xp/xivsupport/events/triggers/easytriggers/EasyTriggers.java +++ b/easytriggers/src/main/java/gg/xp/xivsupport/events/triggers/easytriggers/EasyTriggers.java @@ -83,6 +83,7 @@ import gg.xp.xivsupport.events.triggers.easytriggers.conditions.SourceHasStatusFilter; import gg.xp.xivsupport.events.triggers.easytriggers.conditions.SourcePartyMemberFilter; import gg.xp.xivsupport.events.triggers.easytriggers.conditions.StatusIdFilter; +import gg.xp.xivsupport.events.triggers.easytriggers.conditions.StatusRawStacksFilter; import gg.xp.xivsupport.events.triggers.easytriggers.conditions.StatusStacksFilter; import gg.xp.xivsupport.events.triggers.easytriggers.conditions.TargetCountFilter; import gg.xp.xivsupport.events.triggers.easytriggers.conditions.TargetEntityNpcIdFilter; @@ -433,6 +434,7 @@ private Component generic(Object object, Object trigger) { new ConditionDescription<>(AbilityNameFilter.class, HasAbility.class, "Ability Name", AbilityNameFilter::new, this::generic), new ConditionDescription<>(StatusIdFilter.class, HasStatusEffect.class, "Status Effect ID", StatusIdFilter::new, this::generic), new ConditionDescription<>(StatusStacksFilter.class, HasStatusEffect.class, "Status Effect Stack Count", StatusStacksFilter::new, this::generic), + new ConditionDescription<>(StatusRawStacksFilter.class, HasStatusEffect.class, "Status Effect Raw Stack Count", StatusRawStacksFilter::new, this::generic), new ConditionDescription<>(SourceEntityTypeFilter.class, HasSourceEntity.class, "Source Combatant", SourceEntityTypeFilter::new, this::generic), new ConditionDescription<>(TargetEntityTypeFilter.class, HasTargetEntity.class, "Target Combatant", TargetEntityTypeFilter::new, this::generic), new ConditionDescription<>(SourceEntityNpcIdFilter.class, HasSourceEntity.class, "Source Combatant NPC ID", SourceEntityNpcIdFilter::new, this::generic), diff --git a/easytriggers/src/main/java/gg/xp/xivsupport/events/triggers/easytriggers/conditions/StatusRawStacksFilter.java b/easytriggers/src/main/java/gg/xp/xivsupport/events/triggers/easytriggers/conditions/StatusRawStacksFilter.java new file mode 100644 index 000000000000..356bd60ed6e4 --- /dev/null +++ b/easytriggers/src/main/java/gg/xp/xivsupport/events/triggers/easytriggers/conditions/StatusRawStacksFilter.java @@ -0,0 +1,29 @@ +package gg.xp.xivsupport.events.triggers.easytriggers.conditions; + +import gg.xp.xivsupport.events.actlines.events.HasStatusEffect; +import gg.xp.xivsupport.events.triggers.easytriggers.model.NumericOperator; +import gg.xp.xivsupport.events.triggers.easytriggers.model.SimpleCondition; + + +public class StatusRawStacksFilter implements SimpleCondition { + + public NumericOperator operator = NumericOperator.EQ; + @Description("Raw Stacks") + public long expected; + + @Override + public boolean test(HasStatusEffect hasStatus) { + return operator.checkLong(hasStatus.getRawStacks(), expected); + } + + + @Override + public String fixedLabel() { + return "# of Stacks (raw)"; + } + + @Override + public String dynamicLabel() { + return "# of Raw Stacks " + operator.getFriendlyName() + ' ' + expected; + } +} diff --git a/xivsupport/src/main/java/gg/xp/xivsupport/events/fflogs/FflogsReportLocator.java b/xivsupport/src/main/java/gg/xp/xivsupport/events/fflogs/FflogsReportLocator.java index 319af1208709..3791303e075a 100644 --- a/xivsupport/src/main/java/gg/xp/xivsupport/events/fflogs/FflogsReportLocator.java +++ b/xivsupport/src/main/java/gg/xp/xivsupport/events/fflogs/FflogsReportLocator.java @@ -20,16 +20,16 @@ public static FflogsReportLocator fromURL(String url) { String report = matcher.group(1); String fightRaw = matcher.group(2); int fight = fightRaw.equals("last") ? -1 : Integer.parseInt(fightRaw); - log.info("Parsed fflogs URL: report {}, fight {}", report, fight); + log.info("Parsed fflogs URL: report {}, fight {}, url '{}'", report, fight, url); return new FflogsReportLocator(report, fight); } else if ((noFightMatcher = urlPatternNoFight.matcher(url)).find()) { String report = noFightMatcher.group(1); - log.info("Parsed fflogs URL: report {}, no fight", report); + log.info("Parsed fflogs URL: report {}, no fight, url '{}'", report, url); return new FflogsReportLocator(report, null); } else { - log.warn("Failed to parse fflogs URL"); + log.warn("Failed to parse fflogs URL '{}'", url); throw new IllegalArgumentException("This doesn't look like a valid fflogs fight URL: " + url); } }