-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #449 from xpdota/beta
Combined beta changes
- Loading branch information
Showing
75 changed files
with
1,660 additions
and
774 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
...in/java/gg/xp/xivsupport/events/triggers/easytriggers/actions/WaitBuffDurationAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package gg.xp.xivsupport.events.triggers.easytriggers.actions; | ||
|
||
import com.fasterxml.jackson.annotation.JacksonInject; | ||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
import com.fasterxml.jackson.annotation.OptBoolean; | ||
import gg.xp.xivsupport.events.actlines.events.AbilityCastStart; | ||
import gg.xp.xivsupport.events.actlines.events.BuffApplied; | ||
import gg.xp.xivsupport.events.actlines.events.HasStatusEffect; | ||
import gg.xp.xivsupport.events.state.combatstate.StatusEffectRepository; | ||
import gg.xp.xivsupport.events.triggers.easytriggers.conditions.Description; | ||
import gg.xp.xivsupport.events.triggers.easytriggers.model.EasyTriggerContext; | ||
import gg.xp.xivsupport.events.triggers.easytriggers.model.SqAction; | ||
import gg.xp.xivsupport.events.triggers.marks.gui.AutoMarkGui; | ||
import gg.xp.xivsupport.events.triggers.seq.SequentialTriggerController; | ||
import gg.xp.xivsupport.gui.nav.GlobalUiRegistry; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class WaitBuffDurationAction implements SqAction<BuffApplied> { | ||
|
||
private static final Logger log = LoggerFactory.getLogger(WaitBuffDurationAction.class); | ||
|
||
@JsonIgnore | ||
private final StatusEffectRepository buffs; | ||
|
||
public WaitBuffDurationAction(@JacksonInject(useInput = OptBoolean.FALSE) StatusEffectRepository buffs) { | ||
this.buffs = buffs; | ||
} | ||
|
||
@Description("Remaining Duration") | ||
public long remainingDurationMs = 1000; | ||
@Description("Stop Trigger if Buff Removed") | ||
public boolean stopIfGone; | ||
|
||
@Override | ||
public String fixedLabel() { | ||
return "Wait Until Buff Duration Below"; | ||
} | ||
|
||
@Override | ||
public String dynamicLabel() { | ||
return "Wait until remaining cast duration <= %sms".formatted(remainingDurationMs); | ||
} | ||
|
||
@Override | ||
public void accept(SequentialTriggerController<BuffApplied> stc, EasyTriggerContext context, BuffApplied event) { | ||
while (true) { | ||
BuffApplied latest = buffs.getLatest(event); | ||
if (latest == null) { | ||
if (stopIfGone) { | ||
context.setStopProcessing(true); | ||
} | ||
return; | ||
} | ||
else { | ||
// TODO: this does not handle the case of a buff being replaced with one of a shorter duration | ||
long msToWait = latest.getEstimatedRemainingDuration().minusMillis(remainingDurationMs).toMillis(); | ||
if (msToWait > 0) { | ||
stc.waitMs(msToWait); | ||
} | ||
else { | ||
return; | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public void accept(EasyTriggerContext context, BuffApplied event) { | ||
// Handled above | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...in/java/gg/xp/xivsupport/events/triggers/easytriggers/actions/WaitCastDurationAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package gg.xp.xivsupport.events.triggers.easytriggers.actions; | ||
|
||
import gg.xp.reevent.events.BaseEvent; | ||
import gg.xp.xivsupport.events.actlines.events.AbilityCastStart; | ||
import gg.xp.xivsupport.events.triggers.easytriggers.conditions.Description; | ||
import gg.xp.xivsupport.events.triggers.easytriggers.model.EasyTriggerContext; | ||
import gg.xp.xivsupport.events.triggers.easytriggers.model.SqAction; | ||
import gg.xp.xivsupport.events.triggers.seq.SequentialTriggerController; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class WaitCastDurationAction implements SqAction<AbilityCastStart> { | ||
|
||
private static final Logger log = LoggerFactory.getLogger(WaitCastDurationAction.class); | ||
|
||
@Description("Remaining Duration") | ||
public long remainingDurationMs = 1000; | ||
|
||
@Override | ||
public String fixedLabel() { | ||
return "Wait Until Cast Duration Below"; | ||
} | ||
|
||
@Override | ||
public String dynamicLabel() { | ||
return "Wait until remaining cast duration <= %sms".formatted(remainingDurationMs); | ||
} | ||
|
||
@Override | ||
public void accept(SequentialTriggerController<AbilityCastStart> stc, EasyTriggerContext context, AbilityCastStart event) { | ||
long msToWait = event.getEstimatedRemainingDuration().minusMillis(remainingDurationMs).toMillis(); | ||
if (msToWait > 0) { | ||
stc.waitMs(msToWait); | ||
} | ||
} | ||
|
||
@Override | ||
public void accept(EasyTriggerContext context, AbilityCastStart event) { | ||
// Handled above | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.