Class ModifiableCallout<X>

java.lang.Object
gg.xp.xivsupport.callouts.ModifiableCallout<X>
Type Parameters:
X - The type of event the callout handles. If the callout is typically called without an event, just define the field as ModifiableCallout<?>.

public class ModifiableCallout<X> extends Object
A callout that can be customized by the user on the UI. By default, there will be TTS and on-screen-text, as well as optional graphics. The user can modify the tts and text, independently, and change the color of the on-screen text.

Due to evolution of this class over time, some properties are defined in the constructors, while others are set via a builder pattern. In addition, there are some static methods for common patterns.

  • Constructor Details

    • ModifiableCallout

      public ModifiableCallout(String description, String text)
      The most basic type of callout. Uses the same text for TTS and on-screen. The on-screen text will appear for the default time (5 seconds)
      Parameters:
      description - A description for the callout to be shown to the user.
      text - The default TTS and on-screen text.
    • ModifiableCallout

      public ModifiableCallout(String descriptionAndText)
      Simple callout with the same description and text
      Parameters:
      descriptionAndText - The callout text and description
    • ModifiableCallout

      public ModifiableCallout(String description, String tts, String text, Predicate<? super X> expiry)
      A callout with (optionally) different TTS and on-screen text, and a custom expiry condition. This callout will appear until the 'expiry' predicate returns true.
      Parameters:
      description - A description for the callout to be shown to the user.
      tts - The default TTS
      text - The default on-screen text
      expiry - A condition for expiring the callout (removes it from the on-screen display)
    • ModifiableCallout

      public ModifiableCallout(String description, String ttsAndText, int msExpiry)
      A callout with the same TTS and on-screen text, and a custom expiry time.
      Parameters:
      description - A description for the callout to be shown to the user.
      ttsAndText - The default TTS and text.
      msExpiry - The time for the callout to be displayed on the screen.
    • ModifiableCallout

      public ModifiableCallout(String description, String tts, String text)
  • Method Details

    • expiresIn

      public static <X> Predicate<X> expiresIn(Duration dur)
      Read-made predicates for expiration based on time since the event occurred
      Type Parameters:
      X - The event type
      Parameters:
      dur - The duration
      Returns:
      The predicate
    • autoIcon

      public ModifiableCallout<X> autoIcon()
      Adds an automatic icon to a callout. This expects the event type to be a HasAbility or HasStatusEffect
      Returns:
      this (builder pattern)
    • statusIcon

      public ModifiableCallout<X> statusIcon(long statusId)
      Adds a specific status icon to a callout.
      Parameters:
      statusId - The status effect ID
      Returns:
      this (builder pattern)
    • statusIcon

      public ModifiableCallout<X> statusIcon(long statusId, long stacks)
      Adds a specific status icon to a callout.
      Parameters:
      statusId - The status effect ID
      stacks - The stack count to use for the icon
      Returns:
      this (builder pattern)
    • abilityIcon

      public ModifiableCallout<X> abilityIcon(long abilityId)
      Adds a specific ability icon to a callout.
      Parameters:
      abilityId - The ability ID
      Returns:
      this (builder pattern)
    • guiProvider

      public ModifiableCallout<X> guiProvider(Function<? super X,? extends Component> guiProvider)
      Adds a custom graphical component to a callout
      Parameters:
      guiProvider - A function to turn an event into an AWT component
      Returns:
      this (builder pattern)
    • disabledByDefault

      public ModifiableCallout<X> disabledByDefault()
      Indicates that this should be disabled by default. The user will need to manually turn this on.
      Returns:
      this (builder pattern)
    • extendedDescription

      public ModifiableCallout<X> extendedDescription(String extendedDescription)
      Adds an extended description.
      Parameters:
      extendedDescription - The extended description
      Returns:
      this (builder pattern)
    • expiresIn

      public static <X> Predicate<X> expiresIn(int seconds)
      Like expiresIn(Duration) but takes a number of seconds rather than a Duration
      Type Parameters:
      X - the event type
      Parameters:
      seconds - Duration in seconds
      Returns:
      the predicate
    • attachHandle

      public void attachHandle(ModifiedCalloutHandle handle)
      Should not be called by a trigger developer. This is used to attach customizations, since this object will not have access to them initially.
      Parameters:
      handle - The ModifiedCalloutHandle
    • getDescription

      public String getDescription()
      Returns:
      The description for the callout
    • getOriginalTts

      public String getOriginalTts()
      Returns:
      The default TTS
    • getOriginalVisualText

      public String getOriginalVisualText()
      Returns:
      The default on-screen-text
    • getModified

      public RawModifiedCallout<X> getModified()
      Generate a real callout event based on this callout's settings, without any event or parameters.
      Returns:
      A CalloutEvent
    • getModified

      public RawModifiedCallout<X> getModified(X event)
      Generate a real callout event based on this callout's settings, with an event to base it on.
      Parameters:
      event - The event that 'caused' this callout
      Returns:
      A CalloutEvent
    • getModified

      public RawModifiedCallout<X> getModified(X event, Map<String,Object> rawArguments)
      Generate a real callout event based on this callout's settings, with an event to base it on, plus additional variables.
      Parameters:
      event - The event that 'caused' this callout
      rawArguments - Additional variables to be passed to Groovy expressions
      Returns:
      A CalloutEvent
    • getModified

      public RawModifiedCallout<X> getModified(Map<String,Object> rawArguments)
      Generate a real callout event based on this callout's settings, without an event to base it on, but with additional variables.
      Parameters:
      rawArguments - Additional variables to be passed to Groovy expressions
      Returns:
      A CalloutEvent
    • durationBasedCall

      public static <Y extends HasDuration> ModifiableCallout<Y> durationBasedCall(String desc, String text)
      Used for things like water stack in TEA or P2S where the callout is based on a buff time or castbar.

      Just because something *can* be used with this method doesn't mean it should - many buff/castbar mechanics do not warrant this. e.g. if the initial cast merely tells you what you need to do, or if it is expected that the buff will.

      Parameters:
      desc - The description.
      text - The base text. For the visual text, the duration will be appended in parenthesis. e.g. "Water on You" will become "Water on You" (123.4) will be appended, and the timer will count down.
      Returns:
      the ModifiableCallout
    • durationBasedCall

      public static <Y extends HasDuration> ModifiableCallout<Y> durationBasedCall(String descAndText)
    • durationBasedCallWithOffset

      public static <Y extends HasDuration> ModifiableCallout<Y> durationBasedCallWithOffset(String desc, String text, Duration offset)
    • durationBasedCallWithoutDurationText

      public static <Y extends HasDuration> ModifiableCallout<Y> durationBasedCallWithoutDurationText(String desc, String text)
    • durationExpiryPlusDefaultLinger

      public static <Y extends HasDuration> Predicate<Y> durationExpiryPlusDefaultLinger()
    • durationExpiry

      public static <Y extends HasDuration> Predicate<Y> durationExpiry()
    • durationExpiryPlusLingerTime

      public static <Y extends HasDuration> Predicate<Y> durationExpiryPlusLingerTime(Duration linger)
    • isEnabledByDefault

      public boolean isEnabledByDefault()
    • getExtendedDescription

      @Nullable public @Nullable String getExtendedDescription()