[TASK] Moved settings to the api

Related to issue #77.
This commit is contained in:
Emma Stone
2017-03-09 11:07:57 +00:00
parent f3629e936a
commit 6afd4da0e5
36 changed files with 403 additions and 245 deletions
@@ -1,6 +1,5 @@
package org.rev317.min.accessors; package org.rev317.min.accessors;
public interface CollisionMap { public interface CollisionMap {
int[][] getFlags(); int[][] getFlags();
@@ -2,7 +2,6 @@ package org.rev317.min.api.events.listeners;
import org.rev317.min.api.events.MessageEvent; import org.rev317.min.api.events.MessageEvent;
public interface MessageListener { public interface MessageListener {
void messageReceived(MessageEvent event); void messageReceived(MessageEvent event);
@@ -5,6 +5,7 @@ import org.parabot.environment.api.utils.Time;
import org.parabot.environment.input.Keyboard; import org.parabot.environment.input.Keyboard;
import org.parabot.environment.scripts.framework.SleepCondition; import org.parabot.environment.scripts.framework.SleepCondition;
import org.rev317.min.Loader; import org.rev317.min.Loader;
import org.rev317.min.api.methods.utils.Settings;
import org.rev317.min.api.wrappers.Item; import org.rev317.min.api.wrappers.Item;
import org.rev317.min.api.wrappers.Npc; import org.rev317.min.api.wrappers.Npc;
import org.rev317.min.api.wrappers.SceneObject; import org.rev317.min.api.wrappers.SceneObject;
@@ -85,7 +86,7 @@ public class Bank {
* Deposits all items * Deposits all items
*/ */
public static void depositAll() { public static void depositAll() {
Menu.clickButton(settings.get("button_deposit_all")); Menu.clickButton(Settings.getActionByName("button_deposit_all"));
} }
/** /**
@@ -105,15 +106,15 @@ public class Bank {
} }
if (amount == 1) { if (amount == 1) {
b.transform(Items.Option.TRANSFORM_ONE, settings.get("item_interface_id")); b.transform(Items.Option.TRANSFORM_ONE, Settings.getActionByName("item_interface_id"));
} else if (amount == 5) { } else if (amount == 5) {
b.transform(Items.Option.TRANSFORM_FIVE, settings.get("item_interface_id")); b.transform(Items.Option.TRANSFORM_FIVE, Settings.getActionByName("item_interface_id"));
} else if (amount == 10) { } else if (amount == 10) {
b.transform(Items.Option.TRANSFORM_TEN, settings.get("item_interface_id")); b.transform(Items.Option.TRANSFORM_TEN, Settings.getActionByName("item_interface_id"));
} else if (amount == 0) { } else if (amount == 0) {
b.transform(Items.Option.TRANSFORM_ALL, settings.get("item_interface_id")); b.transform(Items.Option.TRANSFORM_ALL, Settings.getActionByName("item_interface_id"));
} else { } else {
b.transform(Items.Option.TRANSFORM_X, settings.get("item_interface_id")); b.transform(Items.Option.TRANSFORM_X, Settings.getActionByName("item_interface_id"));
Time.sleep(1500 + sleep); Time.sleep(1500 + sleep);
Keyboard.getInstance().sendKeys("" + amount); Keyboard.getInstance().sendKeys("" + amount);
} }
@@ -123,6 +124,7 @@ public class Bank {
* Gets bank item with given id * Gets bank item with given id
* *
* @param id * @param id
*
* @return bank item * @return bank item
*/ */
public static Item getItem(int id) { public static Item getItem(int id) {
@@ -146,6 +148,7 @@ public class Bank {
* Counts the amount of items with given id in bank * Counts the amount of items with given id in bank
* *
* @param id * @param id
*
* @return count * @return count
*/ */
public static int getCount(int id) { public static int getCount(int id) {
@@ -180,7 +183,6 @@ public class Bank {
bank.interact(SceneObjects.Option.USE); bank.interact(SceneObjects.Option.USE);
} }
/** /**
* Closes the bank interface * Closes the bank interface
*/ */
@@ -189,7 +191,7 @@ public class Bank {
return; return;
} }
Menu.sendAction(200, -1, -1, settings.get("button_close_bank")); Menu.sendAction(200, -1, -1, Settings.getActionByName("button_close_bank"));
} }
/** /**
@@ -207,7 +209,7 @@ public class Bank {
for (Item i : Inventory.getItems()) { for (Item i : Inventory.getItems()) {
if (!ignored.contains(i.getId())) { if (!ignored.contains(i.getId())) {
while (Bank.isOpen() && Inventory.getCount(i.getId()) > 0) { while (Bank.isOpen() && Inventory.getCount(i.getId()) > 0) {
i.transform(Items.Option.TRANSFORM_ALL, settings.get("inventory_parent_id")); i.transform(Items.Option.TRANSFORM_ALL, Settings.getActionByName("inventory_parent_id"));
ignored.add(i.getId()); ignored.add(i.getId());
final int previous = Inventory.getCount(true); final int previous = Inventory.getCount(true);
Time.sleep(new SleepCondition() { Time.sleep(new SleepCondition() {
@@ -232,7 +234,7 @@ public class Bank {
return null; return null;
} }
return Loader.getClient().getInterfaceCache()[settings.get("item_interface_id")].getItems(); return Loader.getClient().getInterfaceCache()[Settings.getActionByName("item_interface_id")].getItems();
} }
/** /**
@@ -245,7 +247,7 @@ public class Bank {
return null; return null;
} }
return Loader.getClient().getInterfaceCache()[settings.get("item_interface_id")].getStackSizes(); return Loader.getClient().getInterfaceCache()[Settings.getActionByName("item_interface_id")].getStackSizes();
} }
/** /**
@@ -258,7 +260,7 @@ public class Bank {
return null; return null;
} }
ArrayList<Item> items = new ArrayList<Item>(); ArrayList<Item> items = new ArrayList<>();
int[] ids = getBankItemIDs(); int[] ids = getBankItemIDs();
int[] stacks = getBankStacks(); int[] stacks = getBankStacks();
if (ids != null && stacks != null) { if (ids != null && stacks != null) {
@@ -292,6 +294,6 @@ public class Bank {
* @return <b>true</b> if bank is open * @return <b>true</b> if bank is open
*/ */
public static boolean isOpen() { public static boolean isOpen() {
return Loader.getClient().getOpenInterfaceId() == settings.get("bank_interface_id"); return Loader.getClient().getOpenInterfaceId() == Settings.getActionByName("bank_interface_id");
} }
} }
@@ -12,6 +12,7 @@ public class Calculations {
* Calculates distance between local player and given tile * Calculates distance between local player and given tile
* *
* @param tile * @param tile
*
* @return distance between local player and given tile * @return distance between local player and given tile
*/ */
public static final double distanceTo(Tile tile) { public static final double distanceTo(Tile tile) {
@@ -23,6 +24,7 @@ public class Calculations {
* *
* @param a * @param a
* @param b * @param b
*
* @return distance between a and b * @return distance between a and b
*/ */
public static final double distanceBetween(Tile a, Tile b) { public static final double distanceBetween(Tile a, Tile b) {
@@ -32,13 +34,13 @@ public class Calculations {
return Math.sqrt((x * x) + (y * y)); return Math.sqrt((x * x) + (y * y));
} }
/** /**
* @param startX the startX (0 < startX < 104) * @param startX the startX (0 < startX < 104)
* @param startY the startY (0 < startY < 104) * @param startY the startY (0 < startY < 104)
* @param destX the destX (0 < destX < 104) * @param destX the destX (0 < destX < 104)
* @param destY the destY (0 < destY < 104) * @param destY the destY (0 < destY < 104)
* @param findAdjacent if it's an object, it will find path which touches it. * @param findAdjacent if it's an object, it will find path which touches it.
*
* @return The distance of the shortest path to the destination; or -1 if no valid path to the destination was * @return The distance of the shortest path to the destination; or -1 if no valid path to the destination was
* found. * found.
*/ */
@@ -158,6 +160,7 @@ public class Calculations {
* *
* @param from Start Tile. * @param from Start Tile.
* @param to Destination Tile. * @param to Destination Tile.
*
* @return True if Path is found. * @return True if Path is found.
*/ */
public static boolean foundPath(Tile from, Tile to) { public static boolean foundPath(Tile from, Tile to) {
@@ -170,6 +173,7 @@ public class Calculations {
* @param from Start Tile. * @param from Start Tile.
* @param to Destination Tile. * @param to Destination Tile.
* @param isObject Is destination an Object. * @param isObject Is destination an Object.
*
* @return True if Path is found. * @return True if Path is found.
*/ */
public static boolean foundPath(Tile from, Tile to, boolean isObject) { public static boolean foundPath(Tile from, Tile to, boolean isObject) {
@@ -181,6 +185,7 @@ public class Calculations {
* *
* @param from Start Tile. * @param from Start Tile.
* @param to Destination Tile. * @param to Destination Tile.
*
* @return Shortest Path distance between two tiles using Dijkstra algorithm, returns -1 if path isn't found. * @return Shortest Path distance between two tiles using Dijkstra algorithm, returns -1 if path isn't found.
*/ */
public static int pathDistanceBetween(Tile from, Tile to) { public static int pathDistanceBetween(Tile from, Tile to) {
@@ -197,6 +202,7 @@ public class Calculations {
* @param from Start Tile. * @param from Start Tile.
* @param to Destination Tile. * @param to Destination Tile.
* @param isObject Is destination an Object. * @param isObject Is destination an Object.
*
* @return Shortest Path distance between two tiles using Dijkstra algorithm, returns -1 if path isn't found. * @return Shortest Path distance between two tiles using Dijkstra algorithm, returns -1 if path isn't found.
*/ */
public static int pathDistanceBetween(Tile from, Tile to, boolean isObject) { public static int pathDistanceBetween(Tile from, Tile to, boolean isObject) {
@@ -211,6 +217,7 @@ public class Calculations {
* Gets the shortest distance to a tile. * Gets the shortest distance to a tile.
* *
* @param tile Destination Tile. * @param tile Destination Tile.
*
* @return Shortest distance to tile. * @return Shortest distance to tile.
*/ */
public static int pathDistanceTo(Tile tile) { public static int pathDistanceTo(Tile tile) {
@@ -222,6 +229,7 @@ public class Calculations {
* *
* @param tile Destination Tile. * @param tile Destination Tile.
* @param isObject Is destination an Object. * @param isObject Is destination an Object.
*
* @return Shortest distance to tile. * @return Shortest distance to tile.
*/ */
public static int pathDistanceTo(Tile tile, boolean isObject) { public static int pathDistanceTo(Tile tile, boolean isObject) {
@@ -233,6 +241,7 @@ public class Calculations {
* *
* @param first First tile. * @param first First tile.
* @param second Second tile. * @param second Second tile.
*
* @return True if Coordinate data from first and second tiles match. * @return True if Coordinate data from first and second tiles match.
*/ */
public static boolean isSameTile(Tile first, Tile second) { public static boolean isSameTile(Tile first, Tile second) {
@@ -243,6 +252,7 @@ public class Calculations {
* Checks if player is at the destination tile. * Checks if player is at the destination tile.
* *
* @param destination destination tile. * @param destination destination tile.
*
* @return true if players location equals destination tile. * @return true if players location equals destination tile.
*/ */
public static boolean atTile(Tile destination) { public static boolean atTile(Tile destination) {
@@ -254,6 +264,7 @@ public class Calculations {
* *
* @param start Starting value. * @param start Starting value.
* @param current Current value. * @param current Current value.
*
* @return difference between start and current. * @return difference between start and current.
*/ */
public static int gained(int start, int current) { public static int gained(int start, int current) {
@@ -266,6 +277,7 @@ public class Calculations {
* @param runtime Timer used for calculating hourly difference. * @param runtime Timer used for calculating hourly difference.
* @param start Starting value. * @param start Starting value.
* @param current Current value. * @param current Current value.
*
* @return Hourly difference between start and current. * @return Hourly difference between start and current.
*/ */
public static int gainedPerHour(Timer runtime, int start, int current) { public static int gainedPerHour(Timer runtime, int start, int current) {
@@ -61,6 +61,7 @@ public class Equipment {
* Check if the Player is Wearing an Item based on the ID. * Check if the Player is Wearing an Item based on the ID.
* *
* @param id ID of the item to check for. * @param id ID of the item to check for.
*
* @return True if the Player is wearing the Item. * @return True if the Player is wearing the Item.
*/ */
public static boolean isWearing(int id) { public static boolean isWearing(int id) {
@@ -77,6 +78,7 @@ public class Equipment {
* Get's the item ID in slot. * Get's the item ID in slot.
* *
* @param slot Slot to get the item ID from. * @param slot Slot to get the item ID from.
*
* @return Item ID from given slot. * @return Item ID from given slot.
*/ */
public static int getItemId(Slot slot) { public static int getItemId(Slot slot) {
@@ -87,6 +89,7 @@ public class Equipment {
* Check's if there is an item in the given slot. * Check's if there is an item in the given slot.
* *
* @param slot Slot to check for Item. * @param slot Slot to check for Item.
*
* @return True if there is an Item in the given slot. * @return True if there is an Item in the given slot.
*/ */
public static boolean hasItem(Slot slot) { public static boolean hasItem(Slot slot) {
@@ -97,6 +100,7 @@ public class Equipment {
* Check's if the given slot is empty. * Check's if the given slot is empty.
* *
* @param slot Slot to check for Item. * @param slot Slot to check for Item.
*
* @return True if the given slot is empty. * @return True if the given slot is empty.
*/ */
public static boolean isEmpty(Slot slot) { public static boolean isEmpty(Slot slot) {
@@ -32,6 +32,7 @@ public class Game {
* Gets open interface id * Gets open interface id
* *
* @return interface id * @return interface id
*
* @deprecated Use {@link Interfaces #getOpenInterfaceId()} instead * @deprecated Use {@link Interfaces #getOpenInterfaceId()} instead
*/ */
@Deprecated @Deprecated
@@ -39,11 +40,11 @@ public class Game {
return Loader.getClient().getOpenInterfaceId(); return Loader.getClient().getOpenInterfaceId();
} }
/** /**
* Get open back dialog id * Get open back dialog id
* *
* @return back dialog id * @return back dialog id
*
* @deprecated Use {@link Interfaces #getBackDialogId()} instead * @deprecated Use {@link Interfaces #getBackDialogId()} instead
*/ */
@Deprecated @Deprecated
@@ -105,6 +106,7 @@ public class Game {
* Returns the settings within the client * Returns the settings within the client
* *
* @param index The index of the setting you want to gather * @param index The index of the setting you want to gather
*
* @return The specific setting for the given index * @return The specific setting for the given index
*/ */
public static int getSetting(int index) { public static int getSetting(int index) {
@@ -6,6 +6,7 @@ import org.rev317.min.Loader;
import org.rev317.min.accessors.Client; import org.rev317.min.accessors.Client;
import org.rev317.min.accessors.Deque; import org.rev317.min.accessors.Deque;
import org.rev317.min.accessors.Node; import org.rev317.min.accessors.Node;
import org.rev317.min.api.methods.utils.Settings;
import org.rev317.min.api.wrappers.GroundItem; import org.rev317.min.api.wrappers.GroundItem;
import org.rev317.min.api.wrappers.Tile; import org.rev317.min.api.wrappers.Tile;
@@ -67,6 +68,7 @@ public class GroundItems {
* *
* @param x - local region x * @param x - local region x
* @param y - local region y * @param y - local region y
*
* @return GroundItems Array of the Nearest GroundItems with the first index to be the nearest. * @return GroundItems Array of the Nearest GroundItems with the first index to be the nearest.
*/ */
public static final GroundItem[] getGroundItemsAt(final int x, final int y) { public static final GroundItem[] getGroundItemsAt(final int x, final int y) {
@@ -102,6 +104,7 @@ public class GroundItems {
* Gets GroundItems at a specific tile using x and y location. * Gets GroundItems at a specific tile using x and y location.
* *
* @param tile Tile to get the GroundItems from. * @param tile Tile to get the GroundItems from.
*
* @return GroundItems Array of the Nearest GroundItems with the first index to be the nearest. * @return GroundItems Array of the Nearest GroundItems with the first index to be the nearest.
*/ */
public static final GroundItem[] getGroundItemsAt(final Tile tile) { public static final GroundItem[] getGroundItemsAt(final Tile tile) {
@@ -121,6 +124,7 @@ public class GroundItems {
* Gets the closest GroundItem which matches the given filter. * Gets the closest GroundItem which matches the given filter.
* *
* @param filter Filter that should be applied to the GroundItem. * @param filter Filter that should be applied to the GroundItem.
*
* @return closest GroundItem * @return closest GroundItem
*/ */
public static final GroundItem getClosest(final Filter<GroundItem> filter) { public static final GroundItem getClosest(final Filter<GroundItem> filter) {
@@ -136,6 +140,7 @@ public class GroundItems {
* Gets the closest GroundItems which matches the given ids. * Gets the closest GroundItems which matches the given ids.
* *
* @param ids ID's of the GroundItems to look for. * @param ids ID's of the GroundItems to look for.
*
* @return closest GroundItems * @return closest GroundItems
*/ */
public static final GroundItem getClosest(int... ids) { public static final GroundItem getClosest(int... ids) {
@@ -151,6 +156,7 @@ public class GroundItems {
* Returns Array of GroundItems with the first index to be the nearest. * Returns Array of GroundItems with the first index to be the nearest.
* *
* @param filter Filter that should be applied to the GroundItem. * @param filter Filter that should be applied to the GroundItem.
*
* @return GroundItems Array of the Nearest GroundItems with the first index to be the nearest. * @return GroundItems Array of the Nearest GroundItems with the first index to be the nearest.
*/ */
public static final GroundItem[] getNearest(Filter<GroundItem> filter) { public static final GroundItem[] getNearest(Filter<GroundItem> filter) {
@@ -173,6 +179,7 @@ public class GroundItems {
* Returns Array of GroundItems with the first index to be the nearest. * Returns Array of GroundItems with the first index to be the nearest.
* *
* @param ids GroundItem ID's to look for. * @param ids GroundItem ID's to look for.
*
* @return GroundItems Array of the Nearest GroundItems with the first index to be the nearest. * @return GroundItems Array of the Nearest GroundItems with the first index to be the nearest.
*/ */
public static final GroundItem[] getNearest(final int... ids) { public static final GroundItem[] getNearest(final int... ids) {
@@ -191,18 +198,18 @@ public class GroundItems {
} }
public enum Option { public enum Option {
FIRST(settings.get("menu_ground_item_first_interaction")), FIRST(Settings.getActionByName("menu_ground_item_first_interaction")),
SECOND(settings.get("menu_ground_item_second_interaction")), SECOND(Settings.getActionByName("menu_ground_item_second_interaction")),
THIRD(settings.get("menu_ground_item_third_interaction")), THIRD(Settings.getActionByName("menu_ground_item_third_interaction")),
TAKE(settings.get("menu_ground_item_third_interaction")), TAKE(Settings.getActionByName("menu_ground_item_third_interaction")),
FOURTH(settings.get("menu_ground_item_fourth_interaction")), FOURTH(Settings.getActionByName("menu_ground_item_fourth_interaction")),
FIFTH(settings.get("menu_ground_item_fifth_interaction")), FIFTH(Settings.getActionByName("menu_ground_item_fifth_interaction")),
EXAMINE(settings.get("menu_ground_item_examine_interaction")); EXAMINE(Settings.getActionByName("menu_ground_item_examine_interaction"));
private int actionId; private int actionId;
@@ -24,6 +24,7 @@ public class Interfaces {
* Get's the Interface from the Interface Cache using the given ID. * Get's the Interface from the Interface Cache using the given ID.
* *
* @param id Interface ID. * @param id Interface ID.
*
* @return Interface from the cache by the given ID. * @return Interface from the cache by the given ID.
*/ */
public static Interface getInterface(int id) { public static Interface getInterface(int id) {
@@ -79,6 +80,7 @@ public class Interfaces {
* Checks if the Interface or Back Dialog by the given ID is Open. * 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. * @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. * @return True is the Interface or Back Dialog is Open else will return false.
*/ */
public static boolean isOpen(int id) { public static boolean isOpen(int id) {
@@ -90,6 +92,7 @@ public class Interfaces {
* *
* @param id ID of the Interface or Back Dialog to check for depending on the backDialog boolean. * @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. * @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. * @return True is the Interface or Back Dialog is Open else will return false.
*/ */
public static boolean isOpen(int id, boolean backDialog) { public static boolean isOpen(int id, boolean backDialog) {
@@ -6,12 +6,12 @@ import org.parabot.environment.api.utils.Time;
import org.parabot.environment.scripts.framework.SleepCondition; import org.parabot.environment.scripts.framework.SleepCondition;
import org.rev317.min.Loader; import org.rev317.min.Loader;
import org.rev317.min.accessors.Interface; import org.rev317.min.accessors.Interface;
import org.rev317.min.api.methods.utils.Settings;
import org.rev317.min.api.wrappers.Item; import org.rev317.min.api.wrappers.Item;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
/** /**
* @author Everel, JKetelaar, Fryslan * @author Everel, JKetelaar, Fryslan
*/ */
@@ -58,7 +58,7 @@ public class Inventory {
* @return interface of inventory * @return interface of inventory
*/ */
public static Interface getInterface() { public static Interface getInterface() {
return Loader.getClient().getInterfaceCache()[settings.get("inventory_index")]; return Loader.getClient().getInterfaceCache()[Settings.getActionByName("inventory_index")];
} }
/** /**
@@ -74,6 +74,7 @@ public class Inventory {
* Gets the amount of items with given ids in inventory, excludes the stack sizes * Gets the amount of items with given ids in inventory, excludes the stack sizes
* *
* @param ids * @param ids
*
* @return amount of items * @return amount of items
*/ */
public static int getCount(int... ids) { public static int getCount(int... ids) {
@@ -84,6 +85,7 @@ public class Inventory {
* Gets the amount of items in inventory * Gets the amount of items in inventory
* *
* @param includeStack - true for including stack sizes to the counting * @param includeStack - true for including stack sizes to the counting
*
* @return amount of items * @return amount of items
*/ */
public static int getCount(final boolean includeStack) { public static int getCount(final boolean includeStack) {
@@ -107,6 +109,7 @@ public class Inventory {
* *
* @param includeStack - true for including stack sizes to the counting * @param includeStack - true for including stack sizes to the counting
* @param ids * @param ids
*
* @return amount of items * @return amount of items
*/ */
public static int getCount(final boolean includeStack, int... ids) { public static int getCount(final boolean includeStack, int... ids) {
@@ -144,6 +147,7 @@ public class Inventory {
* Gets all items with given ids * Gets all items with given ids
* *
* @param ids * @param ids
*
* @return items * @return items
*/ */
public static Item[] getItems(final int... ids) { public static Item[] getItems(final int... ids) {
@@ -166,6 +170,7 @@ public class Inventory {
* Gets all items accepted by filter * Gets all items accepted by filter
* *
* @param filter * @param filter
*
* @return items * @return items
*/ */
public static Item[] getItems(final Filter<Item> filter) { public static Item[] getItems(final Filter<Item> filter) {
@@ -212,6 +217,7 @@ public class Inventory {
* Checks if an item exists in the inventory * Checks if an item exists in the inventory
* *
* @param id The item id that will be looked for * @param id The item id that will be looked for
*
* @return True if the item exists in the inventory * @return True if the item exists in the inventory
*/ */
public static boolean contains(int... id) { public static boolean contains(int... id) {
@@ -227,6 +233,7 @@ public class Inventory {
* Returns the item in the inventory based on the given id * Returns the item in the inventory based on the given id
* *
* @param id The item id that will be used to find the item in the inventory * @param id The item id that will be used to find the item in the inventory
*
* @return First found item in the inventory * @return First found item in the inventory
*/ */
public static Item getItem(int id) { public static Item getItem(int id) {
@@ -243,6 +250,7 @@ public class Inventory {
* *
* @param itemOne The first item id that will be used to combine * @param itemOne The first item id that will be used to combine
* @param itemTwo The second item id that will be used to combine * @param itemTwo The second item id that will be used to combine
*
* @return True if nothing unexpected happened * @return True if nothing unexpected happened
*/ */
public static boolean combine(int itemOne, int itemTwo) { public static boolean combine(int itemOne, int itemTwo) {
@@ -267,6 +275,7 @@ public class Inventory {
* @param itemOne The first item id that will be used to combine * @param itemOne The first item id that will be used to combine
* @param itemTwo The second item id that will be used to combine * @param itemTwo The second item id that will be used to combine
* @param sleepCondition The sleep condition that will be used to check and wait until the condition is valid * @param sleepCondition The sleep condition that will be used to check and wait until the condition is valid
*
* @return True if the condition was true and nothing unexpected happened * @return True if the condition was true and nothing unexpected happened
*/ */
public static boolean combine(int itemOne, int itemTwo, SleepCondition sleepCondition) { public static boolean combine(int itemOne, int itemTwo, SleepCondition sleepCondition) {
@@ -7,6 +7,7 @@ import org.json.simple.parser.ParseException;
import org.parabot.core.Configuration; import org.parabot.core.Configuration;
import org.parabot.core.Context; import org.parabot.core.Context;
import org.parabot.environment.api.utils.WebUtil; import org.parabot.environment.api.utils.WebUtil;
import org.rev317.min.api.methods.utils.Settings;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.util.HashMap; import java.util.HashMap;
@@ -73,6 +74,7 @@ public class Items {
* Returns an int array based on the string it starts with. getIdsStart(dragon) will return an int array with all items starting with dragon * Returns an int array based on the string it starts with. getIdsStart(dragon) will return an int array with all items starting with dragon
* *
* @param name * @param name
*
* @return * @return
*/ */
public static int[] getIdsStart(String name) { public static int[] getIdsStart(String name) {
@@ -100,6 +102,7 @@ public class Items {
* Returns an int array based on the string it contains. getIdsContain(dragon) will return an int array with all items containingdragon * Returns an int array based on the string it contains. getIdsContain(dragon) will return an int array with all items containingdragon
* *
* @param name * @param name
*
* @return * @return
*/ */
public static int[] getIdsContain(String name) { public static int[] getIdsContain(String name) {
@@ -146,49 +149,49 @@ public class Items {
} }
public enum Option { public enum Option {
TRANSFORM_FIRST(settings.get("menu_transform_one_interaction")), TRANSFORM_FIRST(Settings.getActionByName("menu_transform_one_interaction")),
VALUE(settings.get("menu_transform_one_interaction")), VALUE(Settings.getActionByName("menu_transform_one_interaction")),
TRANSFORM_ONE(settings.get("menu_transform_one_interaction")), TRANSFORM_ONE(Settings.getActionByName("menu_transform_one_interaction")),
TRANSFORM_SECOND(settings.get("menu_transform_five_interaction")), TRANSFORM_SECOND(Settings.getActionByName("menu_transform_five_interaction")),
TRANSFORM_FIVE(settings.get("menu_transform_five_interaction")), TRANSFORM_FIVE(Settings.getActionByName("menu_transform_five_interaction")),
TRANSFORM_THIRD(settings.get("menu_transform_ten_interaction")), TRANSFORM_THIRD(Settings.getActionByName("menu_transform_ten_interaction")),
TRANSFORM_TEN(settings.get("menu_transform_ten_interaction")), TRANSFORM_TEN(Settings.getActionByName("menu_transform_ten_interaction")),
TRANSFORM_FOURTH(settings.get("menu_transform_all_interaction")), TRANSFORM_FOURTH(Settings.getActionByName("menu_transform_all_interaction")),
TRANSFORM_ALL(settings.get("menu_transform_all_interaction")), TRANSFORM_ALL(Settings.getActionByName("menu_transform_all_interaction")),
TRANSFORM_FIFTH(settings.get("menu_transform_x_interaction")), TRANSFORM_FIFTH(Settings.getActionByName("menu_transform_x_interaction")),
TRANSFORM_X(settings.get("menu_transform_x_interaction")), TRANSFORM_X(Settings.getActionByName("menu_transform_x_interaction")),
TRANSFORM_HUNDRED(settings.get("menu_transform_x_interaction")), TRANSFORM_HUNDRED(Settings.getActionByName("menu_transform_x_interaction")),
TRANSFORM_SIXTH(settings.get("menu_transform_all_but_one_interaction")), TRANSFORM_SIXTH(Settings.getActionByName("menu_transform_all_but_one_interaction")),
TRANSFORM_ALL_BUT_ONE(settings.get("menu_transform_all_but_one_interaction")), TRANSFORM_ALL_BUT_ONE(Settings.getActionByName("menu_transform_all_but_one_interaction")),
TRANSFORM_EXAMINE(settings.get("menu_transform_examine_interaction")), TRANSFORM_EXAMINE(Settings.getActionByName("menu_transform_examine_interaction")),
FIRST(settings.get("menu_item_first_interaction")), FIRST(Settings.getActionByName("menu_item_first_interaction")),
WEAR(settings.get("menu_item_first_interaction")), WEAR(Settings.getActionByName("menu_item_first_interaction")),
SECOND(settings.get("menu_item_second_interaction")), SECOND(Settings.getActionByName("menu_item_second_interaction")),
CONSUME(settings.get("menu_item_second_interaction")), CONSUME(Settings.getActionByName("menu_item_second_interaction")),
DRINK(settings.get("menu_item_second_interaction")), DRINK(Settings.getActionByName("menu_item_second_interaction")),
THIRD(settings.get("menu_item_third_interaction")), THIRD(Settings.getActionByName("menu_item_third_interaction")),
USE(settings.get("menu_item_third_interaction")), USE(Settings.getActionByName("menu_item_third_interaction")),
FOURTH(settings.get("menu_item_fourth_interaction")), FOURTH(Settings.getActionByName("menu_item_fourth_interaction")),
EMPTY(settings.get("menu_item_fourth_interaction")), EMPTY(Settings.getActionByName("menu_item_fourth_interaction")),
FIFTH(settings.get("menu_item_fifth_interaction")), FIFTH(Settings.getActionByName("menu_item_fifth_interaction")),
DROP(settings.get("menu_item_fifth_interaction")), DROP(Settings.getActionByName("menu_item_fifth_interaction")),
SIXTH(settings.get("menu_item_sixth_interaction")), SIXTH(Settings.getActionByName("menu_item_sixth_interaction")),
EXAMINE(settings.get("menu_item_sixth_interaction")), EXAMINE(Settings.getActionByName("menu_item_sixth_interaction")),
SEVENTH(settings.get("menu_item_seventh_interaction")), SEVENTH(Settings.getActionByName("menu_item_seventh_interaction")),
USE_WITH(settings.get("menu_item_seventh_interaction")); USE_WITH(Settings.getActionByName("menu_item_seventh_interaction"));
private int actionId; private int actionId;
@@ -3,6 +3,7 @@ package org.rev317.min.api.methods;
import org.parabot.core.Context; import org.parabot.core.Context;
import org.rev317.min.Loader; import org.rev317.min.Loader;
import org.rev317.min.accessors.Client; import org.rev317.min.accessors.Client;
import org.rev317.min.api.methods.utils.Settings;
import org.rev317.min.api.wrappers.Character; import org.rev317.min.api.wrappers.Character;
import org.rev317.min.api.wrappers.*; import org.rev317.min.api.wrappers.*;
@@ -34,6 +35,7 @@ public class Menu {
* *
* @param object * @param object
* @param actionIndex * @param actionIndex
*
* @deprecated * @deprecated
*/ */
public static void interact(SceneObject object, int actionIndex) { public static void interact(SceneObject object, int actionIndex) {
@@ -87,6 +89,7 @@ public class Menu {
* *
* @param character * @param character
* @param actionIndex * @param actionIndex
*
* @deprecated * @deprecated
*/ */
public static void interact(Character character, int actionIndex) { public static void interact(Character character, int actionIndex) {
@@ -129,6 +132,7 @@ public class Menu {
* @param item * @param item
* @param actionIndex * @param actionIndex
* @param interfaceParentId * @param interfaceParentId
*
* @deprecated * @deprecated
*/ */
public static void transformItem(Item item, int actionIndex, int interfaceParentId) { public static void transformItem(Item item, int actionIndex, int interfaceParentId) {
@@ -160,7 +164,7 @@ public class Menu {
* @param item * @param item
*/ */
public static void take(GroundItem item) { public static void take(GroundItem item) {
sendAction(settings.get("button_take_item"), item.getId(), item.getX(), item.getY()); sendAction(Settings.getActionByName("button_take_item"), item.getId(), item.getX(), item.getY());
} }
/** /**
@@ -178,6 +182,7 @@ public class Menu {
* *
* @param item * @param item
* @param action * @param action
*
* @deprecated * @deprecated
*/ */
public static void interact(GroundItem item, int action) { public static void interact(GroundItem item, int action) {
@@ -262,7 +267,7 @@ public class Menu {
* @param item * @param item
*/ */
public static void drop(Item item) { public static void drop(Item item) {
sendAction(settings.get("button_drop_item"), item.getId() - 1, item.getSlot(), settings.get("inventory_index")); sendAction(Settings.getActionByName("button_drop_item"), item.getId() - 1, item.getSlot(), Settings.getActionByName("inventory_index"));
} }
/** /**
@@ -271,7 +276,7 @@ public class Menu {
* @param id * @param id
*/ */
public static void clickButton(int id) { public static void clickButton(int id) {
sendAction(settings.get("button_action_click"), 0, 0, id); sendAction(Settings.getActionByName("button_action_click"), 0, 0, id);
} }
/** /**
@@ -4,6 +4,7 @@ import org.parabot.core.Context;
import org.parabot.environment.api.utils.Filter; import org.parabot.environment.api.utils.Filter;
import org.rev317.min.Loader; import org.rev317.min.Loader;
import org.rev317.min.accessors.Client; import org.rev317.min.accessors.Client;
import org.rev317.min.api.methods.utils.Settings;
import org.rev317.min.api.wrappers.Npc; import org.rev317.min.api.wrappers.Npc;
import java.util.ArrayList; import java.util.ArrayList;
@@ -39,6 +40,7 @@ public class Npcs {
* Gets all Npcs except local Npc * Gets all Npcs except local Npc
* *
* @param filter * @param filter
*
* @return all Npcs * @return all Npcs
*/ */
public static final Npc[] getNpcs(final Filter<Npc> filter) { public static final Npc[] getNpcs(final Filter<Npc> filter) {
@@ -71,6 +73,7 @@ public class Npcs {
* Gets the closest npc which matches the given filter * Gets the closest npc which matches the given filter
* *
* @param filter * @param filter
*
* @return closest npc * @return closest npc
*/ */
public static final Npc getClosest(final Filter<Npc> filter) { public static final Npc getClosest(final Filter<Npc> filter) {
@@ -86,6 +89,7 @@ public class Npcs {
* Gets the closest npc which matches the given ids * Gets the closest npc which matches the given ids
* *
* @param ids * @param ids
*
* @return closest npc * @return closest npc
*/ */
public static final Npc getClosest(int... ids) { public static final Npc getClosest(int... ids) {
@@ -101,6 +105,7 @@ public class Npcs {
* Returns array with the first index to be the nearest Npc * Returns array with the first index to be the nearest Npc
* *
* @param filter * @param filter
*
* @return nearest Npcs * @return nearest Npcs
*/ */
public static final Npc[] getNearest(final Filter<Npc> filter) { public static final Npc[] getNearest(final Filter<Npc> filter) {
@@ -114,6 +119,7 @@ public class Npcs {
* Gets nearest npcs which hold given id(s) * Gets nearest npcs which hold given id(s)
* *
* @param ids * @param ids
*
* @return array of npcs with the first index to be the nearest * @return array of npcs with the first index to be the nearest
*/ */
public static final Npc[] getNearest(final int... ids) { public static final Npc[] getNearest(final int... ids) {
@@ -148,31 +154,31 @@ public class Npcs {
} }
public enum Option { public enum Option {
FIRST(settings.get("menu_character_first_interaction")), FIRST(Settings.getActionByName("menu_character_first_interaction")),
ATTACK(settings.get("menu_character_first_interaction")), ATTACK(Settings.getActionByName("menu_character_first_interaction")),
SECOND(settings.get("menu_character_second_interaction")), SECOND(Settings.getActionByName("menu_character_second_interaction")),
TALK_TO(settings.get("menu_character_second_interaction")), TALK_TO(Settings.getActionByName("menu_character_second_interaction")),
INTERACT(settings.get("menu_character_second_interaction")), INTERACT(Settings.getActionByName("menu_character_second_interaction")),
BAIT(settings.get("menu_character_second_interaction")), BAIT(Settings.getActionByName("menu_character_second_interaction")),
CAGE(settings.get("menu_character_second_interaction")), CAGE(Settings.getActionByName("menu_character_second_interaction")),
NET(settings.get("menu_character_second_interaction")), NET(Settings.getActionByName("menu_character_second_interaction")),
THIRD(settings.get("menu_character_third_interaction")), THIRD(Settings.getActionByName("menu_character_third_interaction")),
TRADE(settings.get("menu_character_third_interaction")), TRADE(Settings.getActionByName("menu_character_third_interaction")),
BANK(settings.get("menu_character_third_interaction")), BANK(Settings.getActionByName("menu_character_third_interaction")),
PICKPOCKET(settings.get("menu_character_third_interaction")), PICKPOCKET(Settings.getActionByName("menu_character_third_interaction")),
HARPOON(settings.get("menu_character_third_interaction")), HARPOON(Settings.getActionByName("menu_character_third_interaction")),
GET_TASK(settings.get("menu_character_third_interaction")), GET_TASK(Settings.getActionByName("menu_character_third_interaction")),
FOURTH(settings.get("menu_character_fourth_interaction")), FOURTH(Settings.getActionByName("menu_character_fourth_interaction")),
COLLECT(settings.get("menu_character_fourth_interaction")), COLLECT(Settings.getActionByName("menu_character_fourth_interaction")),
CHANGE_CLOTHES(settings.get("menu_character_fourth_interaction")), CHANGE_CLOTHES(Settings.getActionByName("menu_character_fourth_interaction")),
FIFTH(settings.get("menu_character_fifth_interaction")), FIFTH(Settings.getActionByName("menu_character_fifth_interaction")),
REWARD(settings.get("menu_character_fifth_interaction")), REWARD(Settings.getActionByName("menu_character_fifth_interaction")),
EXAMINE(settings.get("menu_character_examine")); EXAMINE(Settings.getActionByName("menu_character_examine"));
private int actionId; private int actionId;
@@ -4,6 +4,7 @@ import org.parabot.core.Context;
import org.parabot.environment.api.utils.Filter; import org.parabot.environment.api.utils.Filter;
import org.rev317.min.Loader; import org.rev317.min.Loader;
import org.rev317.min.accessors.Client; import org.rev317.min.accessors.Client;
import org.rev317.min.api.methods.utils.Settings;
import org.rev317.min.api.wrappers.Player; import org.rev317.min.api.wrappers.Player;
import java.util.ArrayList; import java.util.ArrayList;
@@ -39,6 +40,7 @@ public class Players {
* Gets all players except local player * Gets all players except local player
* *
* @param filter * @param filter
*
* @return all players * @return all players
*/ */
public static final Player[] getPlayers(final Filter<Player> filter) { public static final Player[] getPlayers(final Filter<Player> filter) {
@@ -71,6 +73,7 @@ public class Players {
* Returns array with the first index to be the nearest player * Returns array with the first index to be the nearest player
* *
* @param filter * @param filter
*
* @return nearest players * @return nearest players
*/ */
public static final Player[] getNearest(final Filter<Player> filter) { public static final Player[] getNearest(final Filter<Player> filter) {
@@ -98,24 +101,24 @@ public class Players {
} }
public enum Option { public enum Option {
FIRST(settings.get("menu_character_first_interaction")), FIRST(Settings.getActionByName("menu_character_first_interaction")),
SECOND(settings.get("menu_character_second_interaction")), SECOND(Settings.getActionByName("menu_character_second_interaction")),
THIRD(settings.get("menu_character_third_interaction")), THIRD(Settings.getActionByName("menu_character_third_interaction")),
FOURTH(settings.get("menu_character_fourth_interaction")), FOURTH(Settings.getActionByName("menu_character_fourth_interaction")),
FIFTH(settings.get("menu_character_fifth_interaction")), FIFTH(Settings.getActionByName("menu_character_fifth_interaction")),
FOLLOW(settings.get("menu_character_follow")), FOLLOW(Settings.getActionByName("menu_character_follow")),
TRADE(settings.get("menu_character_trade")), TRADE(Settings.getActionByName("menu_character_trade")),
ATTACK(settings.get("menu_character_attack")), ATTACK(Settings.getActionByName("menu_character_attack")),
CHALLENGE(settings.get("menu_character_attack")), CHALLENGE(Settings.getActionByName("menu_character_attack")),
EXAMINE(settings.get("menu_character_examine")); EXAMINE(Settings.getActionByName("menu_character_examine"));
private int actionId; private int actionId;
@@ -5,6 +5,7 @@ import org.parabot.environment.api.utils.Filter;
import org.rev317.min.Loader; import org.rev317.min.Loader;
import org.rev317.min.accessors.Ground; import org.rev317.min.accessors.Ground;
import org.rev317.min.accessors.SceneObjectTile; import org.rev317.min.accessors.SceneObjectTile;
import org.rev317.min.api.methods.utils.Settings;
import org.rev317.min.api.wrappers.SceneObject; import org.rev317.min.api.wrappers.SceneObject;
import java.util.*; import java.util.*;
@@ -67,6 +68,7 @@ public class SceneObjects {
* Returns array of sceneobjects with the first index to be the nearest * Returns array of sceneobjects with the first index to be the nearest
* *
* @param filter * @param filter
*
* @return sceneobjects * @return sceneobjects
*/ */
public static final SceneObject[] getNearest(Filter<SceneObject> filter) { public static final SceneObject[] getNearest(Filter<SceneObject> filter) {
@@ -89,6 +91,7 @@ public class SceneObjects {
* Returns nearest objects with given id * Returns nearest objects with given id
* *
* @param ids * @param ids
*
* @return sceneobjects * @return sceneobjects
*/ */
public static final SceneObject[] getNearest(final int... ids) { public static final SceneObject[] getNearest(final int... ids) {
@@ -175,6 +178,7 @@ public class SceneObjects {
* *
* @param x * @param x
* @param y * @param y
*
* @return array of sceneobjects, or null if there aren't any * @return array of sceneobjects, or null if there aren't any
*/ */
public static final Collection<SceneObject> getSceneObjectsAtTile(int x, int y) { public static final Collection<SceneObject> getSceneObjectsAtTile(int x, int y) {
@@ -228,37 +232,36 @@ public class SceneObjects {
return sceneObjects; return sceneObjects;
} }
public enum Option { public enum Option {
FIRST(settings.get("menu_scene_object_first_interaction")), FIRST(Settings.getActionByName("menu_scene_object_first_interaction")),
TALK_TO(settings.get("menu_scene_object_first_interaction")), TALK_TO(Settings.getActionByName("menu_scene_object_first_interaction")),
CHOP_DOWN(settings.get("menu_scene_object_first_interaction")), CHOP_DOWN(Settings.getActionByName("menu_scene_object_first_interaction")),
CRAFT_RUNE(settings.get("menu_scene_object_first_interaction")), CRAFT_RUNE(Settings.getActionByName("menu_scene_object_first_interaction")),
PRAY_AT(settings.get("menu_scene_object_first_interaction")), PRAY_AT(Settings.getActionByName("menu_scene_object_first_interaction")),
OPEN(settings.get("menu_scene_object_first_interaction")), OPEN(Settings.getActionByName("menu_scene_object_first_interaction")),
DEPOSIT(settings.get("menu_scene_object_first_interaction")), DEPOSIT(Settings.getActionByName("menu_scene_object_first_interaction")),
USE(settings.get("menu_scene_object_first_interaction")), USE(Settings.getActionByName("menu_scene_object_first_interaction")),
SEARCH(settings.get("menu_scene_object_first_interaction")), SEARCH(Settings.getActionByName("menu_scene_object_first_interaction")),
CLOSE(settings.get("menu_scene_object_first_interaction")), CLOSE(Settings.getActionByName("menu_scene_object_first_interaction")),
CROSS(settings.get("menu_scene_object_first_interaction")), CROSS(Settings.getActionByName("menu_scene_object_first_interaction")),
MINE(settings.get("menu_scene_object_first_interaction")), MINE(Settings.getActionByName("menu_scene_object_first_interaction")),
SMELT(settings.get("menu_scene_object_first_interaction")), SMELT(Settings.getActionByName("menu_scene_object_first_interaction")),
SECOND(settings.get("menu_scene_object_second_interaction")), SECOND(Settings.getActionByName("menu_scene_object_second_interaction")),
TELEPORT(settings.get("menu_scene_object_second_interaction")), TELEPORT(Settings.getActionByName("menu_scene_object_second_interaction")),
STEAL_FROM(settings.get("menu_scene_object_second_interaction")), STEAL_FROM(Settings.getActionByName("menu_scene_object_second_interaction")),
PRAY(settings.get("menu_scene_object_second_interaction")), PRAY(Settings.getActionByName("menu_scene_object_second_interaction")),
USE_QUICKLY(settings.get("menu_scene_object_second_interaction")), USE_QUICKLY(Settings.getActionByName("menu_scene_object_second_interaction")),
INSPECT(settings.get("menu_scene_object_second_interaction")), INSPECT(Settings.getActionByName("menu_scene_object_second_interaction")),
THIRD(settings.get("menu_scene_object_third_interaction")), THIRD(Settings.getActionByName("menu_scene_object_third_interaction")),
FOURTH(settings.get("menu_scene_object_fourth_interaction")), FOURTH(Settings.getActionByName("menu_scene_object_fourth_interaction")),
GUIDE(settings.get("menu_scene_object_fourth_interaction")), GUIDE(Settings.getActionByName("menu_scene_object_fourth_interaction")),
FIFTH(settings.get("menu_scene_object_fifth_interaction")), FIFTH(Settings.getActionByName("menu_scene_object_fifth_interaction")),
EXAMINE(settings.get("menu_scene_object_examine")); EXAMINE(Settings.getActionByName("menu_scene_object_examine"));
private int actionId; private int actionId;
@@ -30,6 +30,7 @@ public enum Skill {
* Returns the experience of the provided skill. * Returns the experience of the provided skill.
* *
* @param index the skill index. * @param index the skill index.
*
* @return the experience. * @return the experience.
*/ */
public static final int getCurrentExperience(int index) { public static final int getCurrentExperience(int index) {
@@ -40,6 +41,7 @@ public enum Skill {
* Returns the real level of the provided skill. * Returns the real level of the provided skill.
* *
* @param index the skill index. * @param index the skill index.
*
* @return the real skill level. * @return the real skill level.
*/ */
public static final int getRealLevel(int index) { public static final int getRealLevel(int index) {
@@ -50,6 +52,7 @@ public enum Skill {
* Returns the current level of the provided skill. (Will return de-buffed/buffed levels) * Returns the current level of the provided skill. (Will return de-buffed/buffed levels)
* *
* @param index the skill index. * @param index the skill index.
*
* @return the current skill level. Done by Bears * @return the current skill level. Done by Bears
*/ */
public static final int getCurrentLevel(int index) { public static final int getCurrentLevel(int index) {
@@ -60,6 +63,7 @@ public enum Skill {
* Returns the exact experience at the provided level. * Returns the exact experience at the provided level.
* *
* @param level the level. * @param level the level.
*
* @return the experience at the provided level. * @return the experience at the provided level.
*/ */
public static final int getExperienceByLevel(int level) { public static final int getExperienceByLevel(int level) {
@@ -74,6 +78,7 @@ public enum Skill {
* Returns the exact level with the provided experience. * Returns the exact level with the provided experience.
* *
* @param experience the experience. * @param experience the experience.
*
* @return the level at the provided experience. * @return the level at the provided experience.
*/ */
public static final int getLevelByExperience(int experience) { public static final int getLevelByExperience(int experience) {
@@ -90,6 +95,7 @@ public enum Skill {
* Returns the remaining experience for the provided skill to level up. * Returns the remaining experience for the provided skill to level up.
* *
* @param index the skill index. * @param index the skill index.
*
* @return the remaining experience. * @return the remaining experience.
*/ */
public static final int getRemainingExperience(int index) { public static final int getRemainingExperience(int index) {
@@ -105,6 +111,7 @@ public enum Skill {
* Returns the percentage to the next level for the provided skill. * Returns the percentage to the next level for the provided skill.
* *
* @param index the skill index. * @param index the skill index.
*
* @return the remaining percentage. * @return the remaining percentage.
*/ */
public static final int getPercentToNextLevel(int index) { public static final int getPercentToNextLevel(int index) {
@@ -4,6 +4,7 @@ import org.parabot.core.Context;
import org.parabot.environment.api.utils.Time; import org.parabot.environment.api.utils.Time;
import org.parabot.environment.scripts.framework.SleepCondition; import org.parabot.environment.scripts.framework.SleepCondition;
import org.rev317.min.accessors.Interface; import org.rev317.min.accessors.Interface;
import org.rev317.min.api.methods.utils.Settings;
import org.rev317.min.api.wrappers.Item; import org.rev317.min.api.wrappers.Item;
import java.util.ArrayList; import java.util.ArrayList;
@@ -20,10 +21,11 @@ public class Trading {
* Checks if the first or the second screen is open, based on the given boolean * Checks if the first or the second screen is open, based on the given boolean
* *
* @param first If true, the first trade screen will be checked. If false, the second screen will be checked * @param first If true, the first trade screen will be checked. If false, the second screen will be checked
*
* @return True if the requested screen is open * @return True if the requested screen is open
*/ */
public static boolean isOpen(boolean first) { public static boolean isOpen(boolean first) {
return Interfaces.getOpenInterfaceId() == (first ? settings.get("first_trade_interface_id") : settings.get("second_trade_interface_id")); return Interfaces.getOpenInterfaceId() == (first ? Settings.getActionByName("first_trade_interface_id") : Settings.getActionByName("second_trade_interface_id"));
} }
/** /**
@@ -32,7 +34,7 @@ public class Trading {
* @return True if open, false if not open * @return True if open, false if not open
*/ */
public static boolean isOpen() { public static boolean isOpen() {
return Interfaces.getOpenInterfaceId() == settings.get("first_trade_interface_id") || Interfaces.getOpenInterfaceId() == settings.get("second_trade_interface_id"); return Interfaces.getOpenInterfaceId() == Settings.getActionByName("first_trade_interface_id") || Interfaces.getOpenInterfaceId() == Settings.getActionByName("second_trade_interface_id");
} }
/** /**
@@ -51,8 +53,8 @@ public class Trading {
public static Item[] getMyOffer() { public static Item[] getMyOffer() {
ArrayList<Item> items = new ArrayList<>(); ArrayList<Item> items = new ArrayList<>();
int[] ids = getItemIDs(settings.get("my_offer_interface_id")); int[] ids = getItemIDs(Settings.getActionByName("my_offer_interface_id"));
int[] stacks = getItemStacks(settings.get("my_offer_interface_id")); int[] stacks = getItemStacks(Settings.getActionByName("my_offer_interface_id"));
for (int i = 0; i < ids.length; i++) { for (int i = 0; i < ids.length; i++) {
if (ids[i] > 0) { if (ids[i] > 0) {
items.add(new Item(ids[i], stacks[i], i)); items.add(new Item(ids[i], stacks[i], i));
@@ -63,8 +65,8 @@ public class Trading {
public static Item[] getOpponentsOffer() { public static Item[] getOpponentsOffer() {
ArrayList<Item> items = new ArrayList<>(); ArrayList<Item> items = new ArrayList<>();
int[] ids = getItemIDs(settings.get("opponent_offer_interface_id")); int[] ids = getItemIDs(Settings.getActionByName("opponent_offer_interface_id"));
int[] stacks = getItemStacks(settings.get("opponent_offer_interface_id")); int[] stacks = getItemStacks(Settings.getActionByName("opponent_offer_interface_id"));
for (int i = 0; i < ids.length; i++) { for (int i = 0; i < ids.length; i++) {
if (ids[i] > 0) { if (ids[i] > 0) {
items.add(new Item(ids[i], stacks[i], i)); items.add(new Item(ids[i], stacks[i], i));
@@ -106,7 +108,7 @@ public class Trading {
Time.sleep(new SleepCondition() { Time.sleep(new SleepCondition() {
@Override @Override
public boolean isValid() { public boolean isValid() {
return Interfaces.getOpenInterfaceId() == settings.get("second_trade_interface_id"); return Interfaces.getOpenInterfaceId() == Settings.getActionByName("second_trade_interface_id");
} }
}, 2500); }, 2500);
} }
@@ -1,6 +1,5 @@
package org.rev317.min.api.methods; package org.rev317.min.api.methods;
import org.parabot.core.Context; import org.parabot.core.Context;
import org.rev317.min.Loader; import org.rev317.min.Loader;
import org.rev317.min.api.wrappers.Tile; import org.rev317.min.api.wrappers.Tile;
@@ -36,6 +35,7 @@ public class Walking {
/** /**
* @param tilePath * @param tilePath
*
* @return <b>true</b> if destination reached, otherwise <b>false</b> * @return <b>true</b> if destination reached, otherwise <b>false</b>
*/ */
public static boolean walkDown(TilePath tilePath) { public static boolean walkDown(TilePath tilePath) {
@@ -51,6 +51,7 @@ public class Walking {
* Gets nearest reachable tile on minimap to given tile * Gets nearest reachable tile on minimap to given tile
* *
* @param tile * @param tile
*
* @return nearest reachable tile on minimap * @return nearest reachable tile on minimap
*/ */
public static Tile getNearestTileTo(Tile tile) { public static Tile getNearestTileTo(Tile tile) {
@@ -0,0 +1,82 @@
package org.rev317.min.api.methods.utils;
/**
* @author EmmaStone
*/
public enum Settings {
BANK_INTERFACE_ID("bank_interface_id", 5292),
ITEM_INTERFACE_ID("item_interface_id", 5382),
BUTTON_CLOSE_BANK("button_close_bank", 5384),
BUTTON_DEPOSIT_ALL("button_deposit_all", 5386),
BUTTON_ACTION_CLICK("button_deposit_all", 646),
BUTTON_DROP_ITEM("button_drop_item", 847),
BUTTON_TAKE_ITEM("button_take_item", 234),
INVENTORY_PARENT_ID("inventory_parent_id", 5064),
BANK_OPEN_ID("bank_open_index", 1),
INVENTORY_INDEX("inventory_index", 3214),
MY_OFFER_INTERFACE_ID("my_offer_interface_id", 3415),
OPPONENT_OFFER_INTERFACE_ID("opponent_offer_interface_id", 3416),
FIRST_TRADE_INTERFACE_ID("first_trade_interface_id", 3323),
SECOND_TRADE_INTERFACE_ID("second_trade_interface_id", 3443),
MENU_SCENE_OBJECT_FIRST_INTERACTION("menu_scene_object_first_interaction", 502),
MENU_SCENE_OBJECT_SECOND_INTERACTION("menu_scene_object_second_interaction", 900),
MENU_SCENE_OBJECT_THIRD_INTERACTION("menu_scene_object_third_interaction", 113),
MENU_SCENE_OBJECT_FOURTH_INTERACTION("menu_scene_object_fourth_interaction", 872),
MENU_SCENE_OBJECT_FIFTH_INTERACTION("menu_scene_object_fifth_interaction", 1062),
MENU_SCENE_OBJECT_EXAMINE("menu_scene_object_examine", 1226),
MENU_CHARACTER_FOLLOW("menu_character_follow", 2779),
MENU_CHARACTER_TRADE("menu_character_trade", 2027),
MENU_CHARACTER_ATTACK("menu_character_attack", 2561),
MENU_CHARACTER_FIRST_INTERACTION("menu_character_first_interaction", 412),
MENU_CHARACTER_SECOND_INTERACTION("menu_character_second_interaction", 20),
MENU_CHARACTER_THIRD_INTERACTION("menu_character_third_interaction", 225),
MENU_CHARACTER_FOURTH_INTERACTION("menu_character_fourth_interaction", 965),
MENU_CHARACTER_FIFTH_INTERACTION("menu_character_fifth_interaction", 478),
MENU_CHARACTER_EXAMINE("menu_character_examine", 1025),
MENU_TRANSFORM_ONE_INTERACTION("menu_transform_one_interaction", 632),
MENU_TRANSFORM_FIVE_INTERACTION("menu_transform_five_interaction", 78),
MENU_TRANSFORM_TEN_INTERACTION("menu_transform_ten_interaction", 867),
MENU_TRANSFORM_ALL_INTERACTION("menu_transform_all_interaction", 431),
MENU_TRANSFORM_X_INTERACTION("menu_transform_x_interaction", 53),
MENU_TRANSFORM_ALL_BUT_ONE_INTERACTION("menu_transform_all_but_one_interaction", 775),
MENU_TRANSFORM_EXAMINE_INTERACTION("menu_transform_examine_interaction", 1125),
MENU_GROUND_ITEM_FIRST_INTERACTION("menu_ground_item_first_interaction", 652),
MENU_GROUND_ITEM_SECOND_INTERACTION("menu_ground_item_second_interaction", 567),
MENU_GROUND_ITEM_THIRD_INTERACTION("menu_ground_item_third_interaction", 234),
MENU_GROUND_ITEM_FOURTH_INTERACTION("menu_ground_item_fourth_interaction", 244),
MENU_GROUND_ITEM_FIFTH_INTERACTION("menu_ground_item_fifth_interaction", 213),
MENU_GROUND_ITEM_EXAMINE_INTERACTION("menu_ground_item_examine_interaction", 1448),
MENU_ITEM_FIRST_INTERACTION("menu_item_first_interaction", 454),
MENU_ITEM_SECOND_INTERACTION("menu_item_second_interaction", 74),
MENU_ITEM_THIRD_INTERACTION("menu_item_third_interaction", 447),
MENU_ITEM_FOURTH_INTERACTION("menu_item_fourth_interaction", 493),
MENU_ITEM_FIFTH_INTERACTION("menu_item_fifth_interaction", 847),
MENU_ITEM_SIXTH_INTERACTION("menu_item_sixth_interaction", 1125),
MENU_ITEM_SEVENTH_INTERACTION("menu_item_seventh_interaction", 870);
private String name;
private int id;
Settings(String name, int id) {
this.name = name;
this.id = id;
}
public String getName() {
return name;
}
public int getId() {
return id;
}
public static int getActionByName(String name) {
for (Settings settings : Settings.values()) {
if (name.equalsIgnoreCase(settings.getName())) {
return settings.getId();
}
}
return 0;
}
}
@@ -86,6 +86,7 @@ public class Area {
* Checks if a tile is in the area * Checks if a tile is in the area
* *
* @param tile The tile to check * @param tile The tile to check
*
* @return <b>true</b> if area does contain the tile, otherwise <b>false</b> * @return <b>true</b> if area does contain the tile, otherwise <b>false</b>
*/ */
public boolean contains(Tile tile) { public boolean contains(Tile tile) {
@@ -97,6 +98,7 @@ public class Area {
* *
* @param x The x-axis from the tile * @param x The x-axis from the tile
* @param y The y-axis from the tile * @param y The y-axis from the tile
*
* @return True if the area does contain the tile, otherwise false * @return True if the area does contain the tile, otherwise false
*/ */
public boolean contains(int x, int y) { public boolean contains(int x, int y) {
@@ -116,6 +116,7 @@ public class Character implements Locatable {
* Interacts with this character * Interacts with this character
* *
* @param i * @param i
*
* @deprecated * @deprecated
*/ */
public void interact(int i) { public void interact(int i) {
@@ -61,6 +61,7 @@ public class GroundItem implements Locatable {
* Interacts with this ground item * Interacts with this ground item
* *
* @param actionIndex * @param actionIndex
*
* @deprecated * @deprecated
*/ */
public void interact(int actionIndex) { public void interact(int actionIndex) {
@@ -71,6 +71,7 @@ public class Item {
* Interacts with this item * Interacts with this item
* *
* @param i * @param i
*
* @deprecated * @deprecated
*/ */
public void interact(int i) { public void interact(int i) {
@@ -81,6 +82,7 @@ public class Item {
* Interacts with this item * Interacts with this item
* *
* @param s * @param s
*
* @deprecated * @deprecated
*/ */
public void interact(String s) { public void interact(String s) {
@@ -90,6 +92,7 @@ public class Item {
/** /**
* @param actionIndex * @param actionIndex
* @param interfaceParentId * @param interfaceParentId
*
* @deprecated * @deprecated
*/ */
public void transform(int actionIndex, int interfaceParentId) { public void transform(int actionIndex, int interfaceParentId) {
@@ -15,7 +15,6 @@ public final class Npc extends Character {
this.accessor = accessor; this.accessor = accessor;
} }
/** /**
* Gets the definition of this npc * Gets the definition of this npc
* *
@@ -25,6 +25,7 @@ public class NpcDef {
* Gets id of this item * Gets id of this item
* *
* @param avoidLong defines if it should check if long id exists * @param avoidLong defines if it should check if long id exists
*
* @return id of this item * @return id of this item
*/ */
private int getId(boolean avoidLong) { private int getId(boolean avoidLong) {
@@ -102,6 +102,7 @@ public class SceneObject implements Locatable {
* Interacts with this object * Interacts with this object
* *
* @param actionIndex * @param actionIndex
*
* @deprecated * @deprecated
*/ */
public void interact(int actionIndex) { public void interact(int actionIndex) {
@@ -139,6 +139,7 @@ public final class Tile implements TileFlags, Locatable {
* Determines if this tile is reachable * Determines if this tile is reachable
* *
* @param isObject whether this tile is an object tile * @param isObject whether this tile is an object tile
*
* @return <code>true</code> if this tile is reachable, otherwise <code>false</code> * @return <code>true</code> if this tile is reachable, otherwise <code>false</code>
*/ */
public boolean isReachable(boolean isObject) { public boolean isReachable(boolean isObject) {
@@ -3,7 +3,6 @@ package org.rev317.min.callback;
import org.rev317.min.api.events.MessageEvent; import org.rev317.min.api.events.MessageEvent;
import org.rev317.min.script.ScriptEngine; import org.rev317.min.script.ScriptEngine;
public class MessageCallback { public class MessageCallback {
public static final void messageListenerHook(int type, String name, String message) { public static final void messageListenerHook(int type, String name, String message) {
@@ -20,8 +20,9 @@ public class DSceneObjects extends AbstractDebugger {
@Override @Override
public void toggle() { public void toggle() {
SceneObject[] objects = SceneObjects.getNearest(); SceneObject[] objects = SceneObjects.getNearest();
if (objects == null || objects.length == 0) if (objects == null || objects.length == 0) {
return; return;
}
for (int i = objects.length - 1; i >= 0; i--) { for (int i = objects.length - 1; i >= 0; i--) {
System.out.println( System.out.println(