Class SequentialTriggerController<X extends BaseEvent>
java.lang.Object
gg.xp.xivsupport.events.triggers.seq.SequentialTriggerController<X>
-
Constructor Summary
ConstructorDescriptionSequentialTriggerController
(EventContext initialEventContext, X initialEvent, BiConsumer<X, SequentialTriggerController<X>> triggerCode, int timeout) -
Method Summary
Modifier and TypeMethodDescriptionvoid
@Nullable RawModifiedCallout<?>
call
(ModifiableCallout<?> call) Trigger a callout.<C> @Nullable RawModifiedCallout<C>
call
(ModifiableCallout<C> call, C event) Trigger a callout.collectAoeHits
(Predicate<AbilityUsedEvent> condition) <Y> void
collectEvents
(int limit, int timeoutMs, Class<Y> eventClass, boolean exclusive, List<EventCollector<? super Y>> collectors) LikegroupEvents(int, int, Class, boolean, List)
, but usesEventCollector
objects to filter and collect the result.void
findOrWaitForBuff
(StatusEffectRepository repo, Predicate<BuffApplied> condition) findOrWaitForCast
(ActiveCastRepository repo, Predicate<AbilityCastStart> condition, boolean includeExpired) Find an active cast, or wait for the matching cast to start.void
@Nullable HasCalloutTrackingKey
Retrives current callout params.groupEvents
(int limit, int timeoutMs, Class<Y> eventClass, boolean exclusive, List<P> filters) Wait for a certain number of events, but with multiple filters in an 'or' fashion.boolean
isDone()
void
provideEvent
(EventContext ctx, X event) void
void
refreshCombatants
(long delay) void
Sets a parameter which will be passed into ModifiableCallout instances incall(gg.xp.xivsupport.callouts.ModifiableCallout<?>)
orupdateCall(gg.xp.xivsupport.speech.CalloutEvent)
.void
void
updateCall
(ModifiableCallout<?> call) Replace the last call used with updateCall (if any) with this one.<C> @Nullable RawModifiedCallout<C>
updateCall
(ModifiableCallout<C> call, C event) Replace the last call used with updateCall (if any) with this one.void
updateCall
(RawModifiedCallout<?> call) Accept a new callout event, BUT mark it as "replacing" any previous call i.e.void
updateCall
(CalloutEvent call) Accept a new callout event, BUT mark it as "replacing" any previous call i.e.void
waitBuffRemoved
(StatusEffectRepository repo, BuffApplied buff) waitCastFinished
(ActiveCastRepository repo, AbilityCastStart cast) Wait for a cast to finish, or return immediately if it already has finished.void
waitDuration
(Duration duration) <Y> Y
<Y> Y
<Y> List<Y>
waitEvents
(int events, Class<Y> eventClass, Predicate<Y> eventFilter) waitEventsQuickSuccession
(int limit, Class<Y> eventClass, Predicate<Y> eventFilter) waitEventsQuickSuccession
(int limit, Class<Y> eventClass, Predicate<Y> eventFilter, Duration maxDelta) <Y,
Z> List<Y> waitEventsUntil
(int limit, Class<Y> eventClass, Predicate<Y> eventFilter, Class<Z> stopOnType, Predicate<Z> stopOn) <Y,
Z> Y waitEventUntil
(Class<Y> eventClass, Predicate<Y> eventFilter, Class<Z> stopOnType, Predicate<Z> stopOn) void
waitMs
(long ms) void
waitThenRefreshCombatants
(long delay)
-
Constructor Details
-
SequentialTriggerController
public SequentialTriggerController(EventContext initialEventContext, X initialEvent, BiConsumer<X, SequentialTriggerController<X>> triggerCode, int timeout)
-
-
Method Details
-
accept
-
enqueue
-
waitThenRefreshCombatants
public void waitThenRefreshCombatants(long delay) -
refreshCombatants
public void refreshCombatants() -
refreshCombatants
public void refreshCombatants(long delay) -
forceExpire
public void forceExpire() -
stopSilently
public void stopSilently() -
waitDuration
-
waitMs
public void waitMs(long ms) -
getLastCall
-
updateCall
Accept a new callout event, BUT mark it as "replacing" any previous call i.e. update callout text + emit a new TTS- Parameters:
call
- The new callout
-
getParams
Retrives current callout params. Set new values usingsetParam(String, Object)
- Returns:
- The current callout parameters map
-
setParam
Sets a parameter which will be passed into ModifiableCallout instances incall(gg.xp.xivsupport.callouts.ModifiableCallout<?>)
orupdateCall(gg.xp.xivsupport.speech.CalloutEvent)
.- Parameters:
name
- The param/variable namevalue
- The value
-
updateCall
Replace the last call used with updateCall (if any) with this one. Automatically handles parameters set withsetParam(String, Object)
. Equivalent to callingupdateCall(call.getModified(getParams())
.This particular version does not take an event. See
updateCall(ModifiableCallout, Object)
if you are supplying an event.- Parameters:
call
- The callout
-
updateCall
@Contract("null, _ -> null; !null, _ -> !null") @Nullable public <C> @Nullable RawModifiedCallout<C> updateCall(ModifiableCallout<C> call, C event) Replace the last call used with updateCall (if any) with this one. Automatically handles parameters set withsetParam(String, Object)
. Equivalent to callingupdateCall(call.getModified(event, getParams())
.This particular version takes an event. See
updateCall(ModifiableCallout)
if you are NOT supplying an event.- Parameters:
call
- The callout- Returns:
- The modified call.
-
call
@Contract("null -> null; !null -> !null") @Nullable public @Nullable RawModifiedCallout<?> call(ModifiableCallout<?> call) Trigger a callout. Does not replace nor is replaced by any other call unless explicitly done by your code. Automatically handles parameters set withsetParam(String, Object)
. Equivalent to callingaccept(call.getModified(getParams())
.This particular version does NOT take an event. See
call(ModifiableCallout, Object)
if you are supplying an event.- Parameters:
call
- The callout- Returns:
- The modified call
-
call
@Contract("null, _ -> null; !null, _ -> !null") @Nullable public <C> @Nullable RawModifiedCallout<C> call(ModifiableCallout<C> call, C event) Trigger a callout. Does not replace nor is replaced by any other call unless explicitly done by your code. Automatically handles parameters set withsetParam(String, Object)
. Equivalent to callingaccept(call.getModified(getParams())
.This particular version takes an event. See
call(ModifiableCallout)
if you are NOT supplying an event.- Parameters:
call
- The callout- Returns:
- The modified call
-
timeSinceStart
- Returns:
- The duration since this trigger began
-
updateCall
Accept a new callout event, BUT mark it as "replacing" any previous call i.e. update callout text + emit a new TTS- Parameters:
call
- The new callout
-
waitEvent
-
waitEvent
-
waitEvents
-
groupEvents
public <P extends Predicate<? super Y>,Y> Map<P,List<Y>> groupEvents(int limit, int timeoutMs, Class<Y> eventClass, boolean exclusive, List<P> filters) Wait for a certain number of events, but with multiple filters in an 'or' fashion. This method returns a map of filters to a list of events that passed that filter. With 'exclusive' set to true, an event that matches more than one filter will only be assigned to the first in the return value.- Type Parameters:
P
- The type of filter.Y
- The type of event.- Parameters:
limit
- Number of eventstimeoutMs
- Timeout in ms to wait for eventseventClass
- Class of eventexclusive
- false if you would like an event to be allowed to match multiple filters, rather than movingn on to the next event after a single match.filters
- The list of filters.- Returns:
- A map, where the keys are the filters, and the values are a list of events that matched that filter.
-
collectEvents
public <Y> void collectEvents(int limit, int timeoutMs, Class<Y> eventClass, boolean exclusive, List<EventCollector<? super Y>> collectors) LikegroupEvents(int, int, Class, boolean, List)
, but usesEventCollector
objects to filter and collect the result. This method works exactly like groupEvents, but does not return anything. Rather, you would query each of your EventCollectors to see what was matched. Each collector specifies what should be matched, and will be populated with the matches.- Type Parameters:
Y
- The type of event.- Parameters:
limit
- Number of eventstimeoutMs
- Timeout in ms to wait for eventseventClass
- Class of eventexclusive
- false if you would like an event to be allowed to match multiple filters, rather than moving on to the next event after a single match.collectors
- The list of collectors.
-
waitEventsQuickSuccession
-
waitEventsQuickSuccession
-
waitBuffRemoved
-
findOrWaitForBuff
-
findOrWaitForCast
public AbilityCastStart findOrWaitForCast(ActiveCastRepository repo, Predicate<AbilityCastStart> condition, boolean includeExpired) Find an active cast, or wait for the matching cast to start.- Parameters:
repo
- The ActiveCastRepositorycondition
- The condition for the cast, i.e. the same thing you would feed towaitEvent(java.lang.Class<Y>)
and similar methodsincludeExpired
- Whether to allow already-completed casts.- Returns:
- The cast.
-
waitCastFinished
Wait for a cast to finish, or return immediately if it already has finished.- Parameters:
repo
- The ActiveCastRepositorycast
- The cast whose finish you wish to wait for.- Returns:
- The event that ended the cast. Will usually be an
AbilityUsedEvent
, but can also be other event types such asAbilityCastCancel
for when the cast is interrupted.
-
collectAoeHits
-
waitEventUntil
-
waitEventsUntil
-
provideEvent
-
isDone
public boolean isDone()
-