mirror of
https://github.com/2006-Scape/Parabot-317-API-Minified.git
synced 2026-07-07 16:49:11 +00:00
Added new menu
This commit is contained in:
@@ -13,8 +13,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Everel
|
* @author Everel, Matt123337, JKetelaar
|
||||||
* @author Matt123337
|
|
||||||
*/
|
*/
|
||||||
public class Bank {
|
public class Bank {
|
||||||
public static final int[] BANKERS = new int[]{44, 45, 494, 495, 498, 499,
|
public static final int[] BANKERS = new int[]{44, 45, 494, 495, 498, 499,
|
||||||
@@ -25,25 +24,7 @@ public class Bank {
|
|||||||
10517, 11402, 11758, 12759, 14367, 19230, 20325, 24914, 25808,
|
10517, 11402, 11758, 12759, 14367, 19230, 20325, 24914, 25808,
|
||||||
26972, 29085, 52589, 34752, 35647, 36786, 2012, 2015, 2019, 693,
|
26972, 29085, 52589, 34752, 35647, 36786, 2012, 2015, 2019, 693,
|
||||||
4483, 12308, 20607, 21301, 27663, 42192};
|
4483, 12308, 20607, 21301, 27663, 42192};
|
||||||
public static int BANK_INTERFACE = 5292;
|
private static Properties settings = Context.getInstance().getServerProviderInfo().getSettings();
|
||||||
public static int ITEM_INTERFACE = 5382;
|
|
||||||
public static int BUTTON_DEPOSIT_ALL = 5386;
|
|
||||||
public static int INV_PARENT_ID = 5064;
|
|
||||||
public static int BANK_OPEN_INDEX = 1;
|
|
||||||
static {
|
|
||||||
|
|
||||||
Properties p = Context.getInstance().getServerProviderInfo().getProperties();
|
|
||||||
if (p.containsKey("bankInterface"))
|
|
||||||
BANK_INTERFACE = Integer.parseInt(p.getProperty("bankInterface"));
|
|
||||||
if (p.containsKey("bankItemInterface"))
|
|
||||||
ITEM_INTERFACE = Integer.parseInt(p.getProperty("bankItemInterface"));
|
|
||||||
if (p.containsKey("bankDepositAll"))
|
|
||||||
BUTTON_DEPOSIT_ALL = Integer.parseInt(p.getProperty("bankDepositAll"));
|
|
||||||
if (p.containsKey("bankInvParent"))
|
|
||||||
INV_PARENT_ID = Integer.parseInt(p.getProperty("bankInvParent"));
|
|
||||||
if (p.containsKey("bankOpenIndex"))
|
|
||||||
BANK_OPEN_INDEX = Integer.parseInt(p.getProperty("bankOpenIndex"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets nearest banker
|
* Gets nearest banker
|
||||||
@@ -90,10 +71,10 @@ public class Bank {
|
|||||||
Npc banker = getBanker();
|
Npc banker = getBanker();
|
||||||
|
|
||||||
if (bank != null) {
|
if (bank != null) {
|
||||||
bank.interact(BANK_OPEN_INDEX);
|
bank.interact(SceneObjects.Option.USE);
|
||||||
return true;
|
return true;
|
||||||
} else if (banker != null) {
|
} else if (banker != null) {
|
||||||
banker.interact(BANK_OPEN_INDEX);
|
banker.interact(Npcs.Option.BANK);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,7 +85,7 @@ public class Bank {
|
|||||||
* Deposits all items
|
* Deposits all items
|
||||||
*/
|
*/
|
||||||
public static void depositAll() {
|
public static void depositAll() {
|
||||||
Menu.clickButton(BUTTON_DEPOSIT_ALL);
|
Menu.clickButton(Integer.parseInt(settings.getProperty("button_deposit_all")));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -114,7 +95,6 @@ public class Bank {
|
|||||||
* @param amount
|
* @param amount
|
||||||
*/
|
*/
|
||||||
public static void withdraw(int id, int amount, int sleep) {
|
public static void withdraw(int id, int amount, int sleep) {
|
||||||
|
|
||||||
if (!isOpen()) {
|
if (!isOpen()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -126,15 +106,15 @@ public class Bank {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (amount == 1) {
|
if (amount == 1) {
|
||||||
b.transform(0, ITEM_INTERFACE);
|
b.transform(Items.Option.TRANSFORM_ONE, Integer.parseInt(settings.getProperty("item_interface_id")));
|
||||||
} else if (amount == 5) {
|
} else if (amount == 5) {
|
||||||
b.transform(1, ITEM_INTERFACE);
|
b.transform(Items.Option.TRANSFORM_FIVE, Integer.parseInt(settings.getProperty("item_interface_id")));
|
||||||
} else if (amount == 10) {
|
} else if (amount == 10) {
|
||||||
b.transform(2, ITEM_INTERFACE);
|
b.transform(Items.Option.TRANSFORM_TEN, Integer.parseInt(settings.getProperty("item_interface_id")));
|
||||||
} else if (amount == 0) {
|
} else if (amount == 0) {
|
||||||
b.transform(3, ITEM_INTERFACE);
|
b.transform(Items.Option.TRANSFORM_ALL, Integer.parseInt(settings.getProperty("item_interface_id")));
|
||||||
} else {
|
} else {
|
||||||
b.transform(4, ITEM_INTERFACE);
|
b.transform(Items.Option.TRANSFORM_X, Integer.parseInt(settings.getProperty("item_interface_id")));
|
||||||
Time.sleep(1500 + sleep);
|
Time.sleep(1500 + sleep);
|
||||||
Keyboard.getInstance().sendKeys("" + amount);
|
Keyboard.getInstance().sendKeys("" + amount);
|
||||||
}
|
}
|
||||||
@@ -148,16 +128,18 @@ public class Bank {
|
|||||||
* @return bank item
|
* @return bank item
|
||||||
*/
|
*/
|
||||||
public static Item getItem(int id) {
|
public static Item getItem(int id) {
|
||||||
|
|
||||||
if (!isOpen()) {
|
if (!isOpen()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Item i : Bank.getBankItems()) {
|
Item[] items;
|
||||||
|
if ((items = Bank.getBankItems()) != null) {
|
||||||
|
for (Item i : items) {
|
||||||
if (i.getId() == id) {
|
if (i.getId() == id) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,7 +154,8 @@ public class Bank {
|
|||||||
if (!isOpen()) {
|
if (!isOpen()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return getItem(id).getStackSize();
|
Item item;
|
||||||
|
return ((item = getItem(id)) != null ? item.getStackSize() : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -180,17 +163,22 @@ public class Bank {
|
|||||||
*
|
*
|
||||||
* @param bank booth
|
* @param bank booth
|
||||||
*/
|
*/
|
||||||
public static void open(SceneObject bank) {
|
public static void open(final SceneObject bank) {
|
||||||
|
|
||||||
if (isOpen()) {
|
if (isOpen()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bank.getLocation().distanceTo() > 8) {
|
if (bank.getLocation().distanceTo() > 8) {
|
||||||
bank.getLocation().walkTo();
|
bank.getLocation().walkTo();
|
||||||
|
Time.sleep(new SleepCondition() {
|
||||||
|
@Override
|
||||||
|
public boolean isValid() {
|
||||||
|
return bank.distanceTo() < 8;
|
||||||
|
}
|
||||||
|
}, 5000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bank.interact(BANK_OPEN_INDEX);
|
bank.interact(SceneObjects.Option.USE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -201,8 +189,7 @@ public class Bank {
|
|||||||
if (!isOpen()) {
|
if (!isOpen()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//[index: 1, action1: -1, action2: -1, action3: 5384, id: 200]
|
Menu.sendAction(200, -1, -1, Integer.parseInt(settings.getProperty("button_close_bank")));
|
||||||
Menu.sendAction(200, -1, -1, 5384);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -220,7 +207,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(3, INV_PARENT_ID);
|
i.transform(Items.Option.TRANSFORM_ALL, Integer.parseInt(settings.getProperty("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() {
|
||||||
@@ -244,7 +231,7 @@ public class Bank {
|
|||||||
if (!isOpen()) {
|
if (!isOpen()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return Loader.getClient().getInterfaceCache()[5382].getItems();
|
return Loader.getClient().getInterfaceCache()[Integer.parseInt(settings.getProperty("item_interface_id"))].getItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -256,7 +243,7 @@ public class Bank {
|
|||||||
if (!isOpen()) {
|
if (!isOpen()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return Loader.getClient().getInterfaceCache()[5382].getStackSizes();
|
return Loader.getClient().getInterfaceCache()[Integer.parseInt(settings.getProperty("item_interface_id"))].getStackSizes();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -271,12 +258,14 @@ public class Bank {
|
|||||||
ArrayList<Item> items = new ArrayList<Item>();
|
ArrayList<Item> items = new ArrayList<Item>();
|
||||||
int[] ids = getBankItemIDs();
|
int[] ids = getBankItemIDs();
|
||||||
int[] stacks = getBankStacks();
|
int[] stacks = getBankStacks();
|
||||||
|
if (ids != null && stacks != null) {
|
||||||
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (Item[]) items.toArray(new Item[items.size()]);
|
}
|
||||||
|
return items.toArray(new Item[items.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -288,7 +277,8 @@ public class Bank {
|
|||||||
if (!isOpen()) {
|
if (!isOpen()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return getBankItemIDs().length;
|
int[] items;
|
||||||
|
return ((items = getBankItemIDs()) != null ? items.length : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -297,7 +287,7 @@ 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() == BANK_INTERFACE;
|
return Loader.getClient().getOpenInterfaceId() == Integer.parseInt(settings.getProperty("bank_interface_id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.rev317.min.api.methods;
|
package org.rev317.min.api.methods;
|
||||||
|
|
||||||
|
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;
|
||||||
@@ -10,9 +11,10 @@ import org.rev317.min.api.wrappers.GroundItem;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Everel
|
* @author Everel, JKetelaar
|
||||||
*/
|
*/
|
||||||
public class GroundItems {
|
public class GroundItems {
|
||||||
private static final Comparator<GroundItem> NEAREST_SORTER = new Comparator<GroundItem>() {
|
private static final Comparator<GroundItem> NEAREST_SORTER = new Comparator<GroundItem>() {
|
||||||
@@ -32,6 +34,7 @@ public class GroundItems {
|
|||||||
|
|
||||||
};
|
};
|
||||||
private static Client client;
|
private static Client client;
|
||||||
|
private static Properties settings = Context.getInstance().getServerProviderInfo().getSettings();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all loaded ground items
|
* Gets all loaded ground items
|
||||||
@@ -43,7 +46,7 @@ public class GroundItems {
|
|||||||
if (client == null) {
|
if (client == null) {
|
||||||
client = Loader.getClient();
|
client = Loader.getClient();
|
||||||
}
|
}
|
||||||
final ArrayList<GroundItem> items = new ArrayList<GroundItem>();
|
final ArrayList<GroundItem> items = new ArrayList<>();
|
||||||
for (int x = 0; x < 104; x++) {
|
for (int x = 0; x < 104; x++) {
|
||||||
for (int y = 0; y < 104; y++) {
|
for (int y = 0; y < 104; y++) {
|
||||||
final GroundItem[] groundItemsAtTile = getGroundItemsAt(x, y);
|
final GroundItem[] groundItemsAtTile = getGroundItemsAt(x, y);
|
||||||
@@ -76,14 +79,11 @@ public class GroundItems {
|
|||||||
if (deque == null) {
|
if (deque == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
ArrayList<GroundItem> list = null;
|
ArrayList<GroundItem> list = new ArrayList<>();
|
||||||
final Node holder = deque.getHead();
|
final Node holder = deque.getHead();
|
||||||
Node curNode = holder.getNext();
|
Node curNode = holder.getNext();
|
||||||
while (curNode != null && curNode != holder
|
while (curNode != null && curNode != holder
|
||||||
&& curNode != deque.getHead()) {
|
&& curNode != deque.getHead()) {
|
||||||
if (list == null) {
|
|
||||||
list = new ArrayList<GroundItem>();
|
|
||||||
}
|
|
||||||
final org.rev317.min.accessors.Item groundItem = (org.rev317.min.accessors.Item) curNode;
|
final org.rev317.min.accessors.Item groundItem = (org.rev317.min.accessors.Item) curNode;
|
||||||
list.add(new GroundItem(groundItem, x, y));
|
list.add(new GroundItem(groundItem, x, y));
|
||||||
curNode = curNode.getNext();
|
curNode = curNode.getNext();
|
||||||
@@ -149,4 +149,28 @@ public class GroundItems {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum Option{
|
||||||
|
FIRST(Integer.parseInt(settings.getProperty("menu_ground_item_first_interaction"))),
|
||||||
|
|
||||||
|
SECOND(Integer.parseInt(settings.getProperty("menu_ground_item_second_interaction"))),
|
||||||
|
|
||||||
|
THIRD(Integer.parseInt(settings.getProperty("menu_ground_item_third_interaction"))),
|
||||||
|
TAKE(Integer.parseInt(settings.getProperty("menu_ground_item_third_interaction"))),
|
||||||
|
|
||||||
|
FOURTH(Integer.parseInt(settings.getProperty("menu_ground_item_fourth_interaction"))),
|
||||||
|
|
||||||
|
FIFTH(Integer.parseInt(settings.getProperty("menu_ground_item_fifth_interaction"))),
|
||||||
|
|
||||||
|
EXAMINE(Integer.parseInt(settings.getProperty("menu_ground_item_examine_interaction")));
|
||||||
|
|
||||||
|
int actionId;
|
||||||
|
|
||||||
|
Option(int actionId) {
|
||||||
|
this.actionId = actionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getActionId() {
|
||||||
|
return actionId;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.rev317.min.api.methods;
|
package org.rev317.min.api.methods;
|
||||||
|
|
||||||
|
import org.parabot.core.Context;
|
||||||
import org.parabot.environment.api.utils.Filter;
|
import org.parabot.environment.api.utils.Filter;
|
||||||
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;
|
||||||
@@ -8,13 +9,15 @@ import org.rev317.min.accessors.Interface;
|
|||||||
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.Properties;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Everel, JKetelaar, Fryslan
|
* @author Everel, JKetelaar, Fryslan
|
||||||
*/
|
*/
|
||||||
public class Inventory {
|
public class Inventory {
|
||||||
public static final int INVENTORY_INDEX = 3214;
|
|
||||||
|
private static Properties settings = Context.getInstance().getServerProviderInfo().getSettings();
|
||||||
|
|
||||||
private static final Filter<Item> ALL_FILTER = new Filter<Item>() {
|
private static final Filter<Item> ALL_FILTER = new Filter<Item>() {
|
||||||
|
|
||||||
@@ -56,7 +59,7 @@ public class Inventory {
|
|||||||
* @return interface of inventory
|
* @return interface of inventory
|
||||||
*/
|
*/
|
||||||
public static Interface getInterface() {
|
public static Interface getInterface() {
|
||||||
return Loader.getClient().getInterfaceCache()[INVENTORY_INDEX];
|
return Loader.getClient().getInterfaceCache()[Integer.parseInt(settings.getProperty("inventory_index"))];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -178,7 +181,7 @@ public class Inventory {
|
|||||||
}
|
}
|
||||||
final int[] items = inventory.getItems();
|
final int[] items = inventory.getItems();
|
||||||
final int[] stackSizes = inventory.getStackSizes();
|
final int[] stackSizes = inventory.getStackSizes();
|
||||||
final ArrayList<Item> invItems = new ArrayList<Item>(28);
|
final ArrayList<Item> invItems = new ArrayList<>(28);
|
||||||
for (int i = 0; i < items.length; i++) {
|
for (int i = 0; i < items.length; i++) {
|
||||||
final int itemId = items[i];
|
final int itemId = items[i];
|
||||||
if (itemId < 1) {
|
if (itemId < 1) {
|
||||||
@@ -257,9 +260,9 @@ public class Inventory {
|
|||||||
|
|
||||||
if (io != null) {
|
if (io != null) {
|
||||||
if (it != null) {
|
if (it != null) {
|
||||||
Menu.interact(io, "use");
|
Menu.interact(io, Items.Option.USE.getActionId());
|
||||||
Time.sleep(50, 100);
|
Time.sleep(50, 100);
|
||||||
Menu.interact(it, "use with");
|
Menu.interact(it, Items.Option.USE_WITH.getActionId());
|
||||||
Time.sleep(50, 100);
|
Time.sleep(50, 100);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -282,9 +285,9 @@ public class Inventory {
|
|||||||
|
|
||||||
if (io != null) {
|
if (io != null) {
|
||||||
if (it != null) {
|
if (it != null) {
|
||||||
Menu.interact(io, "use");
|
Menu.interact(io, Items.Option.USE.getActionId());
|
||||||
Time.sleep(50, 100);
|
Time.sleep(50, 100);
|
||||||
Menu.interact(it, "use with");
|
Menu.interact(it, Items.Option.USE_WITH.getActionId());
|
||||||
Time.sleep(50, 100);
|
Time.sleep(50, 100);
|
||||||
sleepCondition.isValid();
|
sleepCondition.isValid();
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
package org.rev317.min.api.methods;
|
||||||
|
|
||||||
|
import org.parabot.core.Context;
|
||||||
|
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author JKetelaar
|
||||||
|
*/
|
||||||
|
public class Items {
|
||||||
|
private static Properties settings = Context.getInstance().getServerProviderInfo().getSettings();
|
||||||
|
|
||||||
|
public enum Option{
|
||||||
|
TRANSFORM_FIRST(Integer.parseInt(settings.getProperty("menu_transform_one_interaction"))),
|
||||||
|
VALUE(Integer.parseInt(settings.getProperty("menu_transform_one_interaction"))),
|
||||||
|
TRANSFORM_ONE(Integer.parseInt(settings.getProperty("menu_transform_one_interaction"))),
|
||||||
|
|
||||||
|
TRANSFORM_SECOND(Integer.parseInt(settings.getProperty("menu_transform_five_interaction"))),
|
||||||
|
TRANSFORM_FIVE(Integer.parseInt(settings.getProperty("menu_transform_five_interaction"))),
|
||||||
|
|
||||||
|
TRANSFORM_THIRD(Integer.parseInt(settings.getProperty("menu_transform_ten_interaction"))),
|
||||||
|
TRANSFORM_TEN(Integer.parseInt(settings.getProperty("menu_transform_ten_interaction"))),
|
||||||
|
|
||||||
|
TRANSFORM_FOURTH(Integer.parseInt(settings.getProperty("menu_transform_all_interaction"))),
|
||||||
|
TRANSFORM_ALL(Integer.parseInt(settings.getProperty("menu_transform_all_interaction"))),
|
||||||
|
|
||||||
|
TRANSFORM_FIFTH(Integer.parseInt(settings.getProperty("menu_transform_x_interaction"))),
|
||||||
|
TRANSFORM_X(Integer.parseInt(settings.getProperty("menu_transform_x_interaction"))),
|
||||||
|
TRANSFORM_HUNDRED(Integer.parseInt(settings.getProperty("menu_transform_x_interaction"))),
|
||||||
|
|
||||||
|
TRANSFORM_SIXTH(Integer.parseInt(settings.getProperty("menu_transform_all_but_one_interaction"))),
|
||||||
|
TRANSFORM_ALL_BUT_ONE(Integer.parseInt(settings.getProperty("menu_transform_all_but_one_interaction"))),
|
||||||
|
|
||||||
|
TRANSFORM_EXAMINE(Integer.parseInt(settings.getProperty("menu_transform_examine_interaction"))),
|
||||||
|
|
||||||
|
FIRST(Integer.parseInt(settings.getProperty("menu_item_first_interaction"))),
|
||||||
|
WEAR(Integer.parseInt(settings.getProperty("menu_item_first_interaction"))),
|
||||||
|
|
||||||
|
SECOND(Integer.parseInt(settings.getProperty("menu_item_second_interaction"))),
|
||||||
|
CONSUME(Integer.parseInt(settings.getProperty("menu_item_second_interaction"))),
|
||||||
|
|
||||||
|
THIRD(Integer.parseInt(settings.getProperty("menu_item_third_interaction"))),
|
||||||
|
EMPTY(Integer.parseInt(settings.getProperty("menu_item_third_interaction"))),
|
||||||
|
|
||||||
|
FOURTH(Integer.parseInt(settings.getProperty("menu_item_fourth_interaction"))),
|
||||||
|
USE(Integer.parseInt(settings.getProperty("menu_item_fourth_interaction"))),
|
||||||
|
|
||||||
|
FIFTH(Integer.parseInt(settings.getProperty("menu_item_fifth_interaction"))),
|
||||||
|
DROP(Integer.parseInt(settings.getProperty("menu_item_fifth_interaction"))),
|
||||||
|
|
||||||
|
SIXTH(Integer.parseInt(settings.getProperty("menu_item_sixth_interaction"))),
|
||||||
|
EXAMINE(Integer.parseInt(settings.getProperty("menu_item_sixth_interaction"))),
|
||||||
|
|
||||||
|
SEVENTH(Integer.parseInt(settings.getProperty("menu_item_seventh_interaction"))),
|
||||||
|
USE_WITH(Integer.parseInt(settings.getProperty("menu_item_seventh_interaction")));
|
||||||
|
|
||||||
|
int actionId;
|
||||||
|
|
||||||
|
Option(int actionId) {
|
||||||
|
this.actionId = actionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getActionId() {
|
||||||
|
return actionId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,43 +8,22 @@ import org.rev317.min.api.wrappers.GroundItem;
|
|||||||
import org.rev317.min.api.wrappers.Item;
|
import org.rev317.min.api.wrappers.Item;
|
||||||
import org.rev317.min.api.wrappers.SceneObject;
|
import org.rev317.min.api.wrappers.SceneObject;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.Properties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Everel
|
* @author JKetelaar, Everel
|
||||||
*/
|
*/
|
||||||
public class Menu {
|
public class Menu {
|
||||||
public static final int ACTION_CLICK_BUTTON = 646;
|
|
||||||
public static final int ACTION_DROP_ITEM = 847;
|
|
||||||
public static final int ACTION_TAKE_ITEM = 234;
|
|
||||||
|
|
||||||
private static HashMap<String, String> constants;
|
private static Properties settings = Context.getInstance().getServerProviderInfo().getSettings();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interacts with a sceneobject
|
* Interacts with a sceneobject
|
||||||
*
|
*
|
||||||
* @param object
|
* @param object
|
||||||
* @param actionIndex
|
* @param actionId
|
||||||
*/
|
*/
|
||||||
public static void interact(SceneObject object, int actionIndex) {
|
public static void interact(SceneObject object, int actionId) {
|
||||||
int actionId = 502;
|
|
||||||
switch (actionIndex) {
|
|
||||||
case 0:
|
|
||||||
actionId = 502;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
actionId = 900;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
actionId = 113;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
actionId = 872;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
actionId = 1062;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (Game.hasAction4()) {
|
if (Game.hasAction4()) {
|
||||||
sendAction(actionId, object.getHash(), object.getLocalRegionX(), object.getLocalRegionY(), object.getId(), 0);
|
sendAction(actionId, object.getHash(), object.getLocalRegionX(), object.getLocalRegionY(), object.getId(), 0);
|
||||||
} else {
|
} else {
|
||||||
@@ -56,27 +35,9 @@ public class Menu {
|
|||||||
* Interacts with a character
|
* Interacts with a character
|
||||||
*
|
*
|
||||||
* @param character
|
* @param character
|
||||||
* @param actionIndex
|
* @param actionId
|
||||||
*/
|
*/
|
||||||
public static void interact(Character character, int actionIndex) {
|
public static void interact(Character character, int actionId) {
|
||||||
int actionId = 20;
|
|
||||||
switch (actionIndex) {
|
|
||||||
case 0:
|
|
||||||
actionId = 20;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
actionId = 412;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
actionId = 225;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
actionId = 965;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
actionId = 478;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
sendAction(actionId, character.getIndex(), 0, 0);
|
sendAction(actionId, character.getIndex(), 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,30 +45,12 @@ public class Menu {
|
|||||||
* Interacts with an item when it has the following menu Transform-1 Transform-5 Transform-10 etc..
|
* Interacts with an item when it has the following menu Transform-1 Transform-5 Transform-10 etc..
|
||||||
*
|
*
|
||||||
* @param item
|
* @param item
|
||||||
* @param actionIndex
|
* @param actionId
|
||||||
* @param interfaceParentId
|
* @param interfaceParentId
|
||||||
*/
|
*/
|
||||||
public static void transformItem(Item item, int actionIndex,
|
public static void transformItem(Item item, int actionId,
|
||||||
int interfaceParentId) {
|
int interfaceParentId) {
|
||||||
int actionId = 632;
|
sendAction(actionId, item.getId() - 1, item.getSlot(),
|
||||||
switch (actionIndex) {
|
|
||||||
case 0:
|
|
||||||
actionId = 632;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
actionId = 78;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
actionId = 867;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
actionId = 431;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
actionId = 53;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
sendAction(actionId, (int) item.getId() - 1, item.getSlot(),
|
|
||||||
interfaceParentId);
|
interfaceParentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,78 +60,20 @@ public class Menu {
|
|||||||
* @param item
|
* @param item
|
||||||
*/
|
*/
|
||||||
public static void take(GroundItem item) {
|
public static void take(GroundItem item) {
|
||||||
sendAction(ACTION_TAKE_ITEM, item.getId(), item.getX(), item.getY());
|
sendAction(Integer.parseInt(settings.getProperty("button_take_item")), item.getId(), item.getX(), item.getY());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interacts with a ground item
|
* Interacts with a ground item
|
||||||
*
|
*
|
||||||
* @param item
|
* @param item
|
||||||
* @param action
|
* @param actionId
|
||||||
*/
|
*/
|
||||||
public static void interact(GroundItem item, int action) {
|
public static void interact(GroundItem item, int actionId) {
|
||||||
int actionId = 652;
|
|
||||||
switch (action) {
|
|
||||||
case 0:
|
|
||||||
actionId = 652;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
actionId = 567;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
actionId = 234;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
actionId = 244;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
actionId = 213;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
sendAction(actionId, item.getId(), item.getX(), item.getY());
|
sendAction(actionId, item.getId(), item.getX(), item.getY());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void interact(Item item, int action){
|
public static void interact(Item item, int actionId){
|
||||||
int actionId = 447;
|
|
||||||
switch (action){
|
|
||||||
case 0:
|
|
||||||
actionId = 447;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
actionId = 847;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
actionId = 1125;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
actionId = 1107;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
sendAction(actionId, item.getId() - 1, item.getSlot(), 3214);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void interact(Item item, String action){
|
|
||||||
int actionId = 447;
|
|
||||||
switch (action.toLowerCase()){
|
|
||||||
case "use":
|
|
||||||
actionId = 447;
|
|
||||||
break;
|
|
||||||
case "drop":
|
|
||||||
actionId = 847;
|
|
||||||
break;
|
|
||||||
case "examine":
|
|
||||||
actionId = 1125;
|
|
||||||
break;
|
|
||||||
case "cancel":
|
|
||||||
actionId = 1107;
|
|
||||||
break;
|
|
||||||
case "wear":
|
|
||||||
actionId = 454;
|
|
||||||
break;
|
|
||||||
case "use with":
|
|
||||||
actionId = 870;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
sendAction(actionId, item.getId() - 1, item.getSlot(), 3214);
|
sendAction(actionId, item.getId() - 1, item.getSlot(), 3214);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,8 +83,8 @@ public class Menu {
|
|||||||
* @param item
|
* @param item
|
||||||
*/
|
*/
|
||||||
public static void drop(Item item) {
|
public static void drop(Item item) {
|
||||||
sendAction(ACTION_DROP_ITEM, (int) item.getId() - 1, item.getSlot(),
|
sendAction(Integer.parseInt(settings.getProperty("button_drop_item")), item.getId() - 1, item.getSlot(),
|
||||||
Inventory.INVENTORY_INDEX);
|
Integer.parseInt(settings.getProperty("inventory_index")));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -208,7 +93,7 @@ public class Menu {
|
|||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
public static void clickButton(int id) {
|
public static void clickButton(int id) {
|
||||||
sendAction(ACTION_CLICK_BUTTON, 0, 0, id);
|
sendAction(Integer.parseInt(settings.getProperty("button_action_click")), 0, 0, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -247,9 +132,6 @@ public class Menu {
|
|||||||
* @param index
|
* @param index
|
||||||
*/
|
*/
|
||||||
public static void sendAction(int action, int cmd1, int cmd2, int cmd3, int cmd4, int index) {
|
public static void sendAction(int action, int cmd1, int cmd2, int cmd3, int cmd4, int index) {
|
||||||
if (constants == null) {
|
|
||||||
constants = Context.getInstance().getHookParser().getConstants();
|
|
||||||
}
|
|
||||||
|
|
||||||
Client client = Loader.getClient();
|
Client client = Loader.getClient();
|
||||||
|
|
||||||
@@ -264,6 +146,4 @@ public class Menu {
|
|||||||
|
|
||||||
client.doAction(index);
|
client.doAction(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.rev317.min.api.methods;
|
package org.rev317.min.api.methods;
|
||||||
|
|
||||||
|
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;
|
||||||
@@ -8,9 +9,10 @@ import org.rev317.min.api.wrappers.Npc;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Everel
|
* @author Everel, JKetelaar
|
||||||
*/
|
*/
|
||||||
public class Npcs {
|
public class Npcs {
|
||||||
|
|
||||||
@@ -31,6 +33,7 @@ public class Npcs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
private static Properties settings = Context.getInstance().getServerProviderInfo().getSettings();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all Npcs except local Npc
|
* Gets all Npcs except local Npc
|
||||||
@@ -41,7 +44,7 @@ public class Npcs {
|
|||||||
*/
|
*/
|
||||||
public static final Npc[] getNpcs(final Filter<Npc> filter) {
|
public static final Npc[] getNpcs(final Filter<Npc> filter) {
|
||||||
final Client client = Loader.getClient();
|
final Client client = Loader.getClient();
|
||||||
ArrayList<Npc> npcList = new ArrayList<Npc>();
|
ArrayList<Npc> npcList = new ArrayList<>();
|
||||||
final org.rev317.min.accessors.Npc[] accNpcs = client.getNpcs();
|
final org.rev317.min.accessors.Npc[] accNpcs = client.getNpcs();
|
||||||
for (int i = 0; i < accNpcs.length; i++) {
|
for (int i = 0; i < accNpcs.length; i++) {
|
||||||
if (accNpcs[i] == null) {
|
if (accNpcs[i] == null) {
|
||||||
@@ -141,4 +144,34 @@ public class Npcs {
|
|||||||
return getNearest(ALL_FILTER);
|
return getNearest(ALL_FILTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum Option{
|
||||||
|
FIRST(Integer.parseInt(settings.getProperty("menu_character_first_interaction"))),
|
||||||
|
ATTACK(Integer.parseInt(settings.getProperty("menu_character_first_interaction"))),
|
||||||
|
|
||||||
|
SECOND(Integer.parseInt(settings.getProperty("menu_character_second_interaction"))),
|
||||||
|
TALK_TO(Integer.parseInt(settings.getProperty("menu_character_second_interaction"))),
|
||||||
|
INTERACT(Integer.parseInt(settings.getProperty("menu_character_second_interaction"))),
|
||||||
|
|
||||||
|
THIRD(Integer.parseInt(settings.getProperty("menu_character_third_interaction"))),
|
||||||
|
TRADE(Integer.parseInt(settings.getProperty("menu_character_third_interaction"))),
|
||||||
|
BANK(Integer.parseInt(settings.getProperty("menu_character_third_interaction"))),
|
||||||
|
PICKPOCKET(Integer.parseInt(settings.getProperty("menu_character_third_interaction"))),
|
||||||
|
|
||||||
|
FOURTH(Integer.parseInt(settings.getProperty("menu_character_fourth_interaction"))),
|
||||||
|
COLLECT(Integer.parseInt(settings.getProperty("menu_character_fourth_interaction"))),
|
||||||
|
|
||||||
|
FIFTH(Integer.parseInt(settings.getProperty("menu_character_fifth_interaction"))),
|
||||||
|
|
||||||
|
EXAMINE(Integer.parseInt(settings.getProperty("menu_character_examine")));
|
||||||
|
|
||||||
|
int actionId;
|
||||||
|
|
||||||
|
Option(int actionId) {
|
||||||
|
this.actionId = actionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getActionId() {
|
||||||
|
return actionId;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.rev317.min.api.methods;
|
package org.rev317.min.api.methods;
|
||||||
|
|
||||||
|
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;
|
||||||
@@ -8,9 +9,10 @@ import org.rev317.min.api.wrappers.Player;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Everel
|
* @author Everel, JKetelaar
|
||||||
*/
|
*/
|
||||||
public class Players {
|
public class Players {
|
||||||
|
|
||||||
@@ -31,6 +33,7 @@ public class Players {
|
|||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
private static Properties settings = Context.getInstance().getServerProviderInfo().getSettings();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all players except local player
|
* Gets all players except local player
|
||||||
@@ -95,4 +98,29 @@ public class Players {
|
|||||||
return new Player(Loader.getClient().getMyPlayer(), -1);
|
return new Player(Loader.getClient().getMyPlayer(), -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum Option{
|
||||||
|
FIRST(Integer.parseInt(settings.getProperty("menu_character_first_interaction"))),
|
||||||
|
|
||||||
|
SECOND(Integer.parseInt(settings.getProperty("menu_character_second_interaction"))),
|
||||||
|
|
||||||
|
THIRD(Integer.parseInt(settings.getProperty("menu_character_third_interaction"))),
|
||||||
|
|
||||||
|
FOURTH(Integer.parseInt(settings.getProperty("menu_character_fourth_interaction"))),
|
||||||
|
|
||||||
|
FIFTH(Integer.parseInt(settings.getProperty("menu_character_fifth_interaction"))),
|
||||||
|
|
||||||
|
TRADE(Integer.parseInt(settings.getProperty("menu_character_trade"))),
|
||||||
|
ATTACK(Integer.parseInt(settings.getProperty("menu_character_attack"))),
|
||||||
|
EXAMINE(Integer.parseInt(settings.getProperty("menu_character_examine")));
|
||||||
|
|
||||||
|
int actionId;
|
||||||
|
|
||||||
|
Option(int actionId) {
|
||||||
|
this.actionId = actionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getActionId() {
|
||||||
|
return actionId;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,18 +1,16 @@
|
|||||||
package org.rev317.min.api.methods;
|
package org.rev317.min.api.methods;
|
||||||
|
|
||||||
|
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.Ground;
|
import org.rev317.min.accessors.Ground;
|
||||||
import org.rev317.min.accessors.SceneObjectTile;
|
import org.rev317.min.accessors.SceneObjectTile;
|
||||||
import org.rev317.min.api.wrappers.SceneObject;
|
import org.rev317.min.api.wrappers.SceneObject;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Comparator;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Everel
|
* @author Everel, JKetelaar
|
||||||
*/
|
*/
|
||||||
public class SceneObjects {
|
public class SceneObjects {
|
||||||
|
|
||||||
@@ -33,6 +31,7 @@ public class SceneObjects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
private static Properties settings = Context.getInstance().getServerProviderInfo().getSettings();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the most important scene objects in game which can be interacted with, filters out: 'walls, wall
|
* Gets the most important scene objects in game which can be interacted with, filters out: 'walls, wall
|
||||||
@@ -184,7 +183,7 @@ public class SceneObjects {
|
|||||||
for (final SceneObjectTile interactiveObject : interactiveObjects) {
|
for (final SceneObjectTile interactiveObject : interactiveObjects) {
|
||||||
if (interactiveObject != null) {
|
if (interactiveObject != null) {
|
||||||
if (sceneObjects == null) {
|
if (sceneObjects == null) {
|
||||||
sceneObjects = new ArrayList<SceneObject>();
|
sceneObjects = new ArrayList<>();
|
||||||
}
|
}
|
||||||
sceneObjects.add(new SceneObject(interactiveObject, SceneObject.TYPE_INTERACTIVE));
|
sceneObjects.add(new SceneObject(interactiveObject, SceneObject.TYPE_INTERACTIVE));
|
||||||
}
|
}
|
||||||
@@ -193,7 +192,7 @@ public class SceneObjects {
|
|||||||
SceneObjectTile sceneObjectTile = sceneTile.getWallObject();
|
SceneObjectTile sceneObjectTile = sceneTile.getWallObject();
|
||||||
if (sceneObjectTile != null) {
|
if (sceneObjectTile != null) {
|
||||||
if (sceneObjects == null) {
|
if (sceneObjects == null) {
|
||||||
sceneObjects = new ArrayList<SceneObject>();
|
sceneObjects = new ArrayList<>();
|
||||||
}
|
}
|
||||||
sceneObjects.add(new SceneObject(sceneObjectTile, SceneObject.TYPE_WALL));
|
sceneObjects.add(new SceneObject(sceneObjectTile, SceneObject.TYPE_WALL));
|
||||||
}
|
}
|
||||||
@@ -201,7 +200,7 @@ public class SceneObjects {
|
|||||||
sceneObjectTile = sceneTile.getWallDecoration();
|
sceneObjectTile = sceneTile.getWallDecoration();
|
||||||
if (sceneObjectTile != null) {
|
if (sceneObjectTile != null) {
|
||||||
if (sceneObjects == null) {
|
if (sceneObjects == null) {
|
||||||
sceneObjects = new ArrayList<SceneObject>();
|
sceneObjects = new ArrayList<>();
|
||||||
}
|
}
|
||||||
sceneObjects.add(new SceneObject(sceneObjectTile, SceneObject.TYPE_WALLDECORATION));
|
sceneObjects.add(new SceneObject(sceneObjectTile, SceneObject.TYPE_WALLDECORATION));
|
||||||
}
|
}
|
||||||
@@ -209,7 +208,7 @@ public class SceneObjects {
|
|||||||
sceneObjectTile = sceneTile.getGroundDecoration();
|
sceneObjectTile = sceneTile.getGroundDecoration();
|
||||||
if (sceneObjectTile != null) {
|
if (sceneObjectTile != null) {
|
||||||
if (sceneObjects == null) {
|
if (sceneObjects == null) {
|
||||||
sceneObjects = new ArrayList<SceneObject>();
|
sceneObjects = new ArrayList<>();
|
||||||
}
|
}
|
||||||
sceneObjects.add(new SceneObject(sceneObjectTile, SceneObject.TYPE_GROUNDDECORATION));
|
sceneObjects.add(new SceneObject(sceneObjectTile, SceneObject.TYPE_GROUNDDECORATION));
|
||||||
}
|
}
|
||||||
@@ -217,12 +216,48 @@ public class SceneObjects {
|
|||||||
sceneObjectTile = sceneTile.getGroundItem();
|
sceneObjectTile = sceneTile.getGroundItem();
|
||||||
if (sceneObjectTile != null) {
|
if (sceneObjectTile != null) {
|
||||||
if (sceneObjects == null) {
|
if (sceneObjects == null) {
|
||||||
sceneObjects = new ArrayList<SceneObject>();
|
sceneObjects = new ArrayList<>();
|
||||||
}
|
}
|
||||||
sceneObjects.add(new SceneObject(sceneObjectTile, SceneObject.TYPE_GROUNDITEM));
|
sceneObjects.add(new SceneObject(sceneObjectTile, SceneObject.TYPE_GROUNDITEM));
|
||||||
}
|
}
|
||||||
return sceneObjects;
|
return sceneObjects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum Option{
|
||||||
|
FIRST(Integer.parseInt(settings.getProperty("menu_scene_object_first_interaction"))),
|
||||||
|
TALK_TO(Integer.parseInt(settings.getProperty("menu_scene_object_first_interaction"))),
|
||||||
|
CHOP_DOWN(Integer.parseInt(settings.getProperty("menu_scene_object_first_interaction"))),
|
||||||
|
CRAFT_RUNE(Integer.parseInt(settings.getProperty("menu_scene_object_first_interaction"))),
|
||||||
|
PRAY_AT(Integer.parseInt(settings.getProperty("menu_scene_object_first_interaction"))),
|
||||||
|
OPEN(Integer.parseInt(settings.getProperty("menu_scene_object_first_interaction"))),
|
||||||
|
DEPOSIT(Integer.parseInt(settings.getProperty("menu_scene_object_first_interaction"))),
|
||||||
|
USE(Integer.parseInt(settings.getProperty("menu_scene_object_first_interaction"))),
|
||||||
|
SEARCH(Integer.parseInt(settings.getProperty("menu_scene_object_first_interaction"))),
|
||||||
|
|
||||||
|
SECOND(Integer.parseInt(settings.getProperty("menu_scene_object_second_interaction"))),
|
||||||
|
TELEPORT(Integer.parseInt(settings.getProperty("menu_scene_object_second_interaction"))),
|
||||||
|
STEAL_FROM(Integer.parseInt(settings.getProperty("menu_scene_object_second_interaction"))),
|
||||||
|
PRAY(Integer.parseInt(settings.getProperty("menu_scene_object_second_interaction"))),
|
||||||
|
USE_QUICKLY(Integer.parseInt(settings.getProperty("menu_scene_object_second_interaction"))),
|
||||||
|
|
||||||
|
THIRD(Integer.parseInt(settings.getProperty("menu_scene_object_third_interaction"))),
|
||||||
|
|
||||||
|
FOURTH(Integer.parseInt(settings.getProperty("menu_scene_object_fourth_interaction"))),
|
||||||
|
|
||||||
|
FIFTH(Integer.parseInt(settings.getProperty("menu_scene_object_fifth_interaction"))),
|
||||||
|
|
||||||
|
EXAMINE(Integer.parseInt(settings.getProperty("menu_scene_object_examine")));
|
||||||
|
|
||||||
|
int actionId;
|
||||||
|
|
||||||
|
Option(int actionId) {
|
||||||
|
this.actionId = actionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getActionId() {
|
||||||
|
return actionId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,30 +16,7 @@ import java.util.Properties;
|
|||||||
*/
|
*/
|
||||||
public class Trading {
|
public class Trading {
|
||||||
|
|
||||||
/*
|
private static Properties settings = Context.getInstance().getServerProviderInfo().getSettings();
|
||||||
TODO Get the player its offer and implement its features
|
|
||||||
*/
|
|
||||||
public static int OPPONENT_OFFER_INTERFACE_ID = 3416;
|
|
||||||
public static int MY_OFFER_INTERFACE_ID = 3415;
|
|
||||||
|
|
||||||
public static int FIRST_TRADE_INTERFACE_ID = 3323;
|
|
||||||
public static int SECOND_TRADE_INTERFACE_ID = 3443;
|
|
||||||
|
|
||||||
static {
|
|
||||||
Properties p = Context.getInstance().getServerProviderInfo().getProperties();
|
|
||||||
if (p.containsKey("opponentInterface")) {
|
|
||||||
OPPONENT_OFFER_INTERFACE_ID = Integer.parseInt(p.getProperty("opponentInterface"));
|
|
||||||
}
|
|
||||||
if (p.containsKey("myInterface")) {
|
|
||||||
OPPONENT_OFFER_INTERFACE_ID = Integer.parseInt(p.getProperty("myInterface"));
|
|
||||||
}
|
|
||||||
if (p.containsKey("firstTradeInterface")) {
|
|
||||||
FIRST_TRADE_INTERFACE_ID = Integer.parseInt(p.getProperty("firstTradeInterface"));
|
|
||||||
}
|
|
||||||
if (p.containsKey("secondTradeInterface")) {
|
|
||||||
SECOND_TRADE_INTERFACE_ID = Integer.parseInt(p.getProperty("secondTradeInterface"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
@@ -47,7 +24,7 @@ public class Trading {
|
|||||||
* @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 Loader.getClient().getOpenInterfaceId() == (first ? FIRST_TRADE_INTERFACE_ID : SECOND_TRADE_INTERFACE_ID);
|
return Loader.getClient().getOpenInterfaceId() == (first ? Integer.parseInt(settings.getProperty("first_trade_interface_id")) : Integer.parseInt(settings.getProperty("second_trade_interface_id")));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,7 +32,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 Loader.getClient().getOpenInterfaceId() == FIRST_TRADE_INTERFACE_ID || Loader.getClient().getOpenInterfaceId() == SECOND_TRADE_INTERFACE_ID;
|
return Loader.getClient().getOpenInterfaceId() == Integer.parseInt(settings.getProperty("first_trade_interface_id")) || Loader.getClient().getOpenInterfaceId() == Integer.parseInt(settings.getProperty("second_trade_interface_id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -74,8 +51,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(MY_OFFER_INTERFACE_ID);
|
int[] ids = getItemIDs(Integer.parseInt(settings.getProperty("my_offer_interface_id")));
|
||||||
int[] stacks = getItemStacks(MY_OFFER_INTERFACE_ID);
|
int[] stacks = getItemStacks(Integer.parseInt(settings.getProperty("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));
|
||||||
@@ -86,8 +63,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(OPPONENT_OFFER_INTERFACE_ID);
|
int[] ids = getItemIDs(Integer.parseInt(settings.getProperty("opponent_offer_interface_id")));
|
||||||
int[] stacks = getItemStacks(OPPONENT_OFFER_INTERFACE_ID);
|
int[] stacks = getItemStacks(Integer.parseInt(settings.getProperty("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));
|
||||||
@@ -123,7 +100,7 @@ public class Trading {
|
|||||||
* TODO Figure a way to use packets instead
|
* TODO Figure a way to use packets instead
|
||||||
* Accepts the offer and hits the button to continue to the second screen
|
* Accepts the offer and hits the button to continue to the second screen
|
||||||
*/
|
*/
|
||||||
private static void acceptOffer() {
|
public static void acceptOffer() {
|
||||||
Time.sleep(500, 750);
|
Time.sleep(500, 750);
|
||||||
Mouse.getInstance().click(260, 190, true);
|
Mouse.getInstance().click(260, 190, true);
|
||||||
Time.sleep(500, 750);
|
Time.sleep(500, 750);
|
||||||
@@ -133,7 +110,7 @@ public class Trading {
|
|||||||
* TODO Figure a way to use packets instead
|
* TODO Figure a way to use packets instead
|
||||||
* Accepts the trade and hits the button to complete the trade
|
* Accepts the trade and hits the button to complete the trade
|
||||||
*/
|
*/
|
||||||
private static void acceptTrade() {
|
public static void acceptTrade() {
|
||||||
Time.sleep(500, 750);
|
Time.sleep(500, 750);
|
||||||
Mouse.getInstance().click(230, 310, true);
|
Mouse.getInstance().click(230, 310, true);
|
||||||
Time.sleep(500, 750);
|
Time.sleep(500, 750);
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import org.rev317.min.Loader;
|
|||||||
import org.rev317.min.api.interfaces.Locatable;
|
import org.rev317.min.api.interfaces.Locatable;
|
||||||
import org.rev317.min.api.methods.Calculations;
|
import org.rev317.min.api.methods.Calculations;
|
||||||
import org.rev317.min.api.methods.Game;
|
import org.rev317.min.api.methods.Game;
|
||||||
import org.rev317.min.api.methods.Menu;
|
|
||||||
import org.rev317.min.api.methods.Players;
|
import org.rev317.min.api.methods.Players;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,15 +74,6 @@ public class Character implements Locatable {
|
|||||||
return (int) Calculations.distanceTo(getLocation());
|
return (int) Calculations.distanceTo(getLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Interacts with this character
|
|
||||||
*
|
|
||||||
* @param i
|
|
||||||
*/
|
|
||||||
public void interact(int i) {
|
|
||||||
Menu.interact(this, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets current health
|
* Gets current health
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -2,9 +2,7 @@ package org.rev317.min.api.wrappers;
|
|||||||
|
|
||||||
import org.parabot.core.reflect.RefClass;
|
import org.parabot.core.reflect.RefClass;
|
||||||
import org.rev317.min.api.interfaces.Locatable;
|
import org.rev317.min.api.interfaces.Locatable;
|
||||||
import org.rev317.min.api.methods.Calculations;
|
import org.rev317.min.api.methods.*;
|
||||||
import org.rev317.min.api.methods.Game;
|
|
||||||
import org.rev317.min.api.methods.Menu;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Everel
|
* @author Everel
|
||||||
@@ -50,10 +48,10 @@ public class GroundItem implements Locatable {
|
|||||||
/**
|
/**
|
||||||
* Interacts with this ground item
|
* Interacts with this ground item
|
||||||
*
|
*
|
||||||
* @param actionIndex
|
* @param option
|
||||||
*/
|
*/
|
||||||
public void interact(int actionIndex) {
|
public void interact(GroundItems.Option option) {
|
||||||
Menu.interact(this, actionIndex);
|
Menu.interact(this, option.getActionId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.rev317.min.api.wrappers;
|
package org.rev317.min.api.wrappers;
|
||||||
|
|
||||||
|
import org.rev317.min.api.methods.Items;
|
||||||
import org.rev317.min.api.methods.Menu;
|
import org.rev317.min.api.methods.Menu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -52,27 +53,19 @@ public class Item {
|
|||||||
/**
|
/**
|
||||||
* Interacts with this item
|
* Interacts with this item
|
||||||
*
|
*
|
||||||
* @param i
|
* @param option
|
||||||
*/
|
*/
|
||||||
public void interact(int i) {
|
public void interact(Items.Option option) {
|
||||||
Menu.interact(this, i);
|
Menu.interact(this, option.getActionId());
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interacts with this item
|
|
||||||
* @param s
|
|
||||||
*/
|
|
||||||
public void interact(String s){
|
|
||||||
Menu.interact(this, s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param actionIndex
|
* @param option
|
||||||
* @param interfaceParentId
|
* @param interfaceParentId
|
||||||
*/
|
*/
|
||||||
public void transform(int actionIndex, int interfaceParentId) {
|
public void transform(Items.Option option, int interfaceParentId) {
|
||||||
Menu.transformItem(this, actionIndex, interfaceParentId);
|
Menu.transformItem(this, option.getActionId(), interfaceParentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package org.rev317.min.api.wrappers;
|
package org.rev317.min.api.wrappers;
|
||||||
|
|
||||||
import org.parabot.core.reflect.RefClass;
|
import org.parabot.core.reflect.RefClass;
|
||||||
|
import org.rev317.min.api.methods.Menu;
|
||||||
|
import org.rev317.min.api.methods.Npcs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Everel
|
* @author Everel
|
||||||
@@ -32,4 +34,13 @@ public final class Npc extends Character {
|
|||||||
return new RefClass(this.accessor);
|
return new RefClass(this.accessor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interacts with this character
|
||||||
|
*
|
||||||
|
* @param option
|
||||||
|
*/
|
||||||
|
public void interact(Npcs.Option option) {
|
||||||
|
Menu.interact(this, option.getActionId());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package org.rev317.min.api.wrappers;
|
package org.rev317.min.api.wrappers;
|
||||||
|
|
||||||
|
import org.rev317.min.api.methods.Menu;
|
||||||
|
import org.rev317.min.api.methods.Players;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*/
|
*/
|
||||||
@@ -12,4 +15,13 @@ public class Player extends Character {
|
|||||||
public String getName(){
|
public String getName(){
|
||||||
return getAccessor().getName();
|
return getAccessor().getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interacts with this character
|
||||||
|
*
|
||||||
|
* @param option
|
||||||
|
*/
|
||||||
|
public void interact(Players.Option option) {
|
||||||
|
Menu.interact(this, option.getActionId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import org.rev317.min.api.interfaces.Locatable;
|
|||||||
import org.rev317.min.api.methods.Calculations;
|
import org.rev317.min.api.methods.Calculations;
|
||||||
import org.rev317.min.api.methods.Game;
|
import org.rev317.min.api.methods.Game;
|
||||||
import org.rev317.min.api.methods.Menu;
|
import org.rev317.min.api.methods.Menu;
|
||||||
|
import org.rev317.min.api.methods.SceneObjects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Everel
|
* @author Everel
|
||||||
@@ -91,10 +92,10 @@ public class SceneObject implements Locatable {
|
|||||||
/**
|
/**
|
||||||
* Interacts with this object
|
* Interacts with this object
|
||||||
*
|
*
|
||||||
* @param actionIndex
|
* @param option
|
||||||
*/
|
*/
|
||||||
public void interact(int actionIndex) {
|
public void interact(SceneObjects.Option option) {
|
||||||
Menu.interact(this, actionIndex);
|
Menu.interact(this, option.getActionId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user