Merge pull request #53 from Parabot/feature/dialog-input

[FEATURE] Added dialog input && Set amount
This commit is contained in:
Jeroen Ketelaar
2016-10-17 01:28:55 +02:00
committed by GitHub
6 changed files with 62 additions and 32 deletions
@@ -20,6 +20,8 @@ public interface Client {
void setInterface(int id);
void setAmountOrNameInput(int amount);
int[] getCurrentExp();
Deque[][][] getGroundItems();
@@ -28,6 +30,8 @@ public interface Client {
int getBackDialogId();
int getInputDialogState();
int getPlane();
int[] getMenuActionId();
@@ -31,16 +31,21 @@ public class Game {
* Gets open interface id
*
* @return interface id
* @deprecated Use {@link Interfaces #getOpenInterfaceId()} instead
*/
@Deprecated
public static int getOpenInterfaceId() {
return Loader.getClient().getOpenInterfaceId();
}
/**
* Get open back dialog id
*
* @return back dialog id
* @deprecated Use {@link Interfaces #getBackDialogId()} instead
*/
@Deprecated
public static int getOpenBackDialogId() {
return Loader.getClient().getBackDialogId();
}
@@ -90,7 +95,6 @@ public class Game {
* Returns the settings within the client
*
* @param index The index of the setting you want to gather
*
* @return The specific setting for the given index
*/
public static int getSetting(int index) {
@@ -124,6 +128,7 @@ public class Game {
/**
* Drops the client and returns if the game is logged out or not
*
* @return True if game is logged out, false if not
*/
public static boolean confirmedDropClient() {
@@ -13,6 +13,7 @@ public class Interfaces {
/**
* Get's the interfaces loaded in the interface Cache.
*
* @return Interfaces in the Interface Cache.
*/
public static Interface[] getInterfaces() {
@@ -21,6 +22,7 @@ public class Interfaces {
/**
* Get's the Interface from the Interface Cache using the given ID.
*
* @param id Interface ID.
* @return Interface from the cache by the given ID.
*/
@@ -30,14 +32,25 @@ public class Interfaces {
/**
* Opens the Interface by the given ID.
*
* @param id ID of the Interface to Open.
*/
public static void openInterface(int id) {
Loader.getClient().setInterface(id);
}
/**
* Sets the int by the given Amount
*
* @param amount Amount to set
*/
public static void setAmountOrNameInput(int amount) {
Loader.getClient().setAmountOrNameInput(amount);
}
/**
* Get's the Open Interface ID.
*
* @return The ID of the Open Interface , will be -1 if all Interfaces are closed.
*/
public static int getOpenInterfaceId() {
@@ -46,14 +59,25 @@ public class Interfaces {
/**
* Get's the Open Back Dialog ID.
*
* @return The ID of the Open Back Dialog , will be -1 if all Back Dialogs are closed.
*/
public static int getBackDialogId() {
return Loader.getClient().getBackDialogId();
}
/**
* Get current input dialog state
*
* @return input dialog state
*/
public static int getInputDialogState() {
return Loader.getClient().getInputDialogState();
}
/**
* Checks if the Interface or Back Dialog by the given ID is Open.
*
* @param id ID of the Interface or Back Dialog to check for.
* @return True is the Interface or Back Dialog is Open else will return false.
*/
@@ -63,6 +87,7 @@ public class Interfaces {
/**
* Checks if the Interface by the given ID is Open.
*
* @param id ID of the Interface or Back Dialog to check for depending on the backDialog boolean.
* @param backDialog When tru it will check the Bank Dialog ID else it will check for the Interface ID.
* @return True is the Interface or Back Dialog is Open else will return false.
@@ -77,6 +102,7 @@ public class Interfaces {
/**
* Clicks an option from the given back dialog
*
* @param index Index of the requested option whereas you start at 0
*/
public static void clickBackDialogOption(int index) {
@@ -296,4 +296,3 @@ public class Inventory {
return false;
}
}
@@ -32,10 +32,9 @@ public class Menu {
/**
* Interacts with a sceneobject
*
* @deprecated
*
* @param object
* @param actionIndex
* @deprecated
*/
public static void interact(SceneObject object, int actionIndex) {
int actionId = SceneObjects.Option.FIRST.getActionId();
@@ -86,10 +85,9 @@ public class Menu {
/**
* Interacts with a character
*
* @deprecated
*
* @param character
* @param actionIndex
* @deprecated
*/
public static void interact(Character character, int actionIndex) {
int actionId = 20;
@@ -129,11 +127,10 @@ public class Menu {
/**
* Interacts with an item when it has the following menu Transform-1 Transform-5 Transform-10 etc..
*
* @deprecated
*
* @param item
* @param actionIndex
* @param interfaceParentId
* @deprecated
*/
public static void transformItem(Item item, int actionIndex,
int interfaceParentId) {
@@ -181,10 +178,9 @@ public class Menu {
/**
* Interacts with a ground item
*
* @deprecated
*
* @param item
* @param action
* @deprecated
*/
public static void interact(GroundItem item, int action) {
int actionId = GroundItems.Option.FIRST.getActionId();
@@ -317,7 +313,6 @@ public class Menu {
* @param index
*/
public static void sendAction(int action, int cmd1, int cmd2, int cmd3, int cmd4, int index) {
Client client = Loader.getClient();
client.getMenuAction1()[index] = cmd1;
@@ -4,6 +4,7 @@ import org.parabot.core.Context;
import org.parabot.core.paint.AbstractDebugger;
import org.parabot.core.paint.PaintDebugger;
import org.rev317.min.api.methods.Game;
import org.rev317.min.api.methods.Interfaces;
import java.awt.*;
@@ -13,8 +14,8 @@ public class DInterfaces extends AbstractDebugger {
@Override
public void paint(Graphics g) {
PaintDebugger p = Context.getInstance().getPaintDebugger();
p.addLine("Open interface: " + Game.getOpenInterfaceId());
p.addLine("Open back dialog: " + Game.getOpenBackDialogId());
p.addLine("Open interface: " + Interfaces.getOpenInterfaceId());
p.addLine("Open back dialog: " + Interfaces.getBackDialogId());
}
@Override