Package net.eternalclient.api.accessors
Class Dialogues
- java.lang.Object
-
- net.eternalclient.api.accessors.Dialogues
-
public class Dialogues extends java.lang.Object
Utility class for handling dialogues.
-
-
Constructor Summary
Constructors Constructor Description Dialogues()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
canContinue()
Checks if the user can continue by searching for a specific widget child with the text "Click here to continue" or "Click to continue".static boolean
canEnterInput()
Checks if the input can be entered on the chatbox.static boolean
canEnterOption()
Checks if the dialog option group widget is rendered.static boolean
clickOption(int optionIndex)
Clicks on the specified option based on the provided index.static boolean
clickOption(java.lang.String option)
Clicks on the specified option.static boolean
clickOption(java.util.function.Predicate<java.lang.String> predicate)
Clicks on the first option that matches the given predicate.static boolean
clickOptionContaining(java.lang.String option)
Clicks on the option that contains the specified string.static boolean
containsOptions(java.lang.String... options)
Checks if the given options are present in the dialogue options.static boolean
continueDialogue()
Checks if the dialogue can continue and presses the space key.static java.lang.String
getDialogueText()
Retrieves the dialogue text from a specific widget child.static java.lang.String
getInputText()
Retrieves the input text from the PlayerSettings object.static java.lang.String
getNPCDialogue()
Returns the dialogue text of the visible and open dialogue widget child in the NPC dialogue interface.static int
getOptionIndex(java.lang.String... options)
Returns the index of the first option found in the provided options list, or -1 if no match is found.static int
getOptionIndexContaining(java.lang.String... options)
Returns the index of the first option in the provided array "options" that is contained (case-insensitive) in the array of chat options.static java.lang.String[]
getOptions()
Retrieves the options as an array of strings.static java.util.List<java.lang.String>
getOptionsList()
Retrieves a list of options from a widget child.static boolean
hasOptions(java.lang.String... options)
Checks if any of the given options match the available dialogue options.static boolean
inDialogue()
Checks if the player is currently in a dialogue.static void
invokeQueue(net.eternalclient.api.data.DialogOption... options)
Invokes a queue of dialog options on the client thread.static boolean
isProcessing()
Checks if the game is currently processing a message.static boolean
solve(java.lang.String... options)
Solve the dialogue event with the given options.static boolean
typeOption(int optionIndex)
Sends a keyboard key corresponding to the given option index if entering an option is possible.static boolean
typeOption(java.lang.String option)
Selects a given option by entering its corresponding index on the keyboard.static boolean
typeOption(java.util.function.Predicate<java.lang.String> predicate)
Checks if any of the options matches the given predicate and returns the result of typing that option.static boolean
typeOptionContaining(java.lang.String option)
Returns true if the specified option can be entered using the keyboard, false otherwise.
-
-
-
Method Detail
-
inDialogue
public static boolean inDialogue()
Checks if the player is currently in a dialogue.- Returns:
- true if the player is in a dialogue, otherwise false.
-
isProcessing
public static boolean isProcessing()
Checks if the game is currently processing a message.- Returns:
- true if a message is being processed, false otherwise.
-
getOptionsList
public static java.util.List<java.lang.String> getOptionsList()
Retrieves a list of options from a widget child.- Returns:
- a List of Strings representing the options
-
getOptions
public static java.lang.String[] getOptions()
Retrieves the options as an array of strings.- Returns:
- the options as an array of strings
-
hasOptions
public static boolean hasOptions(java.lang.String... options)
Checks if any of the given options match the available dialogue options.- Parameters:
options
- the options to check against the available dialogue options.- Returns:
- true if at least one option matches, false otherwise.
-
containsOptions
public static boolean containsOptions(java.lang.String... options)
Checks if the given options are present in the dialogue options.- Parameters:
options
- List of options to be checked.- Returns:
- true if any option is found, false otherwise.
-
canEnterOption
public static boolean canEnterOption()
Checks if the dialog option group widget is rendered.- Returns:
- true if the dialog option group widget is rendered, false otherwise.
-
getOptionIndex
public static int getOptionIndex(java.lang.String... options)
Returns the index of the first option found in the provided options list, or -1 if no match is found.- Parameters:
options
- A list of options to search for.- Returns:
- The index of the first matching option, or -1 if not found.
-
getOptionIndexContaining
public static int getOptionIndexContaining(java.lang.String... options)
Returns the index of the first option in the provided array "options" that is contained (case-insensitive) in the array of chat options. Returns -1 if no matching option is found.- Parameters:
options
- the options to search for- Returns:
- the index of the found option or -1 if not found
-
canContinue
public static boolean canContinue()
Checks if the user can continue by searching for a specific widget child with the text "Click here to continue" or "Click to continue".- Returns:
- true if the widget child is found, false otherwise.
-
continueDialogue
public static boolean continueDialogue()
Checks if the dialogue can continue and presses the space key.- Returns:
- true if the dialogue can continue and the space key is pressed, false otherwise.
-
clickOption
public static boolean clickOption(int optionIndex)
Clicks on the specified option based on the provided index.- Parameters:
optionIndex
- the index of the option to be clicked- Returns:
- true if the option was successfully clicked, false otherwise
-
clickOption
public static boolean clickOption(java.util.function.Predicate<java.lang.String> predicate)
Clicks on the first option that matches the given predicate.- Parameters:
predicate
- the condition to match against the options- Returns:
- true if an option was successfully clicked, false otherwise
-
clickOption
public static boolean clickOption(java.lang.String option)
Clicks on the specified option.- Parameters:
option
- the option to click on- Returns:
- true if the option was successfully clicked, false otherwise
-
clickOptionContaining
public static boolean clickOptionContaining(java.lang.String option)
Clicks on the option that contains the specified string.- Parameters:
option
- the string to search for in the options- Returns:
- true if option is found and clicked, otherwise false
-
typeOption
public static boolean typeOption(int optionIndex)
Sends a keyboard key corresponding to the given option index if entering an option is possible.- Parameters:
optionIndex
- the index of the option to be selected (must be between 0-9)- Returns:
- true if the option was successfully entered, false otherwise
-
typeOption
public static boolean typeOption(java.lang.String option)
Selects a given option by entering its corresponding index on the keyboard.- Parameters:
option
- the option to be selected- Returns:
- true if the option is successfully selected, false otherwise
-
typeOption
public static boolean typeOption(java.util.function.Predicate<java.lang.String> predicate)
Checks if any of the options matches the given predicate and returns the result of typing that option.- Parameters:
predicate
- The condition to be satisfied by the options.- Returns:
- true if an option satisfies the predicate and is successfully typed, false otherwise.
-
typeOptionContaining
public static boolean typeOptionContaining(java.lang.String option)
Returns true if the specified option can be entered using the keyboard, false otherwise.- Parameters:
option
- the option to check- Returns:
- true if option can be entered, false otherwise
-
getNPCDialogue
public static java.lang.String getNPCDialogue()
Returns the dialogue text of the visible and open dialogue widget child in the NPC dialogue interface.- Returns:
- the dialogue text as a string, or an empty string if no dialogue text is found
-
canEnterInput
public static boolean canEnterInput()
Checks if the input can be entered on the chatbox.- Returns:
- true if input can be entered, false otherwise.
-
getInputText
public static java.lang.String getInputText()
Retrieves the input text from the PlayerSettings object.- Returns:
- the input text as a String.
-
solve
public static boolean solve(java.lang.String... options)
Solve the dialogue event with the given options.- Parameters:
options
- the options for the dialogue event- Returns:
- true if the dialogue event is successfully executed, otherwise false
-
getDialogueText
public static java.lang.String getDialogueText()
Retrieves the dialogue text from a specific widget child.- Returns:
- the cleaned dialogue text, or an empty string if the widget child or its text is null.
-
invokeQueue
public static void invokeQueue(net.eternalclient.api.data.DialogOption... options)
Invokes a queue of dialog options on the client thread.- Parameters:
options
- the array of dialog options to be processed.
-
-