mirror of
https://github.com/2006-Scape/Parabot-317-API-Minified.git
synced 2026-07-03 00:38:00 +00:00
New interaction method
This commit is contained in:
@@ -10,7 +10,7 @@ import org.rev317.min.api.wrappers.Npc;
|
||||
import org.rev317.min.api.wrappers.SceneObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Properties;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* @author Everel, Matt123337, JKetelaar
|
||||
@@ -24,7 +24,7 @@ public class Bank {
|
||||
10517, 11402, 11758, 12759, 14367, 19230, 20325, 24914, 25808,
|
||||
26972, 29085, 52589, 34752, 35647, 36786, 2012, 2015, 2019, 693,
|
||||
4483, 12308, 20607, 21301, 27663, 42192};
|
||||
private static Properties settings = Context.getInstance().getServerProviderInfo().getSettings();
|
||||
private static HashMap<String, Integer> settings = Context.getInstance().getServerProviderInfo().getSettings();
|
||||
|
||||
/**
|
||||
* Gets nearest banker
|
||||
@@ -85,7 +85,7 @@ public class Bank {
|
||||
* Deposits all items
|
||||
*/
|
||||
public static void depositAll() {
|
||||
Menu.clickButton(Integer.parseInt(settings.getProperty("button_deposit_all")));
|
||||
Menu.clickButton(settings.get("button_deposit_all"));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,15 +106,15 @@ public class Bank {
|
||||
}
|
||||
|
||||
if (amount == 1) {
|
||||
b.transform(Items.Option.TRANSFORM_ONE, Integer.parseInt(settings.getProperty("item_interface_id")));
|
||||
b.transform(Items.Option.TRANSFORM_ONE, settings.get("item_interface_id"));
|
||||
} else if (amount == 5) {
|
||||
b.transform(Items.Option.TRANSFORM_FIVE, Integer.parseInt(settings.getProperty("item_interface_id")));
|
||||
b.transform(Items.Option.TRANSFORM_FIVE, settings.get("item_interface_id"));
|
||||
} else if (amount == 10) {
|
||||
b.transform(Items.Option.TRANSFORM_TEN, Integer.parseInt(settings.getProperty("item_interface_id")));
|
||||
b.transform(Items.Option.TRANSFORM_TEN, settings.get("item_interface_id"));
|
||||
} else if (amount == 0) {
|
||||
b.transform(Items.Option.TRANSFORM_ALL, Integer.parseInt(settings.getProperty("item_interface_id")));
|
||||
b.transform(Items.Option.TRANSFORM_ALL, settings.get("item_interface_id"));
|
||||
} else {
|
||||
b.transform(Items.Option.TRANSFORM_X, Integer.parseInt(settings.getProperty("item_interface_id")));
|
||||
b.transform(Items.Option.TRANSFORM_X, settings.get("item_interface_id"));
|
||||
Time.sleep(1500 + sleep);
|
||||
Keyboard.getInstance().sendKeys("" + amount);
|
||||
}
|
||||
@@ -189,7 +189,7 @@ public class Bank {
|
||||
if (!isOpen()) {
|
||||
return;
|
||||
}
|
||||
Menu.sendAction(200, -1, -1, Integer.parseInt(settings.getProperty("button_close_bank")));
|
||||
Menu.sendAction(200, -1, -1, settings.get("button_close_bank"));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -207,7 +207,7 @@ public class Bank {
|
||||
for (Item i : Inventory.getItems()) {
|
||||
if (!ignored.contains(i.getId())) {
|
||||
while (Bank.isOpen() && Inventory.getCount(i.getId()) > 0) {
|
||||
i.transform(Items.Option.TRANSFORM_ALL, Integer.parseInt(settings.getProperty("inventory_parent_id")));
|
||||
i.transform(Items.Option.TRANSFORM_ALL, settings.get("inventory_parent_id"));
|
||||
ignored.add(i.getId());
|
||||
final int previous = Inventory.getCount(true);
|
||||
Time.sleep(new SleepCondition() {
|
||||
@@ -231,7 +231,7 @@ public class Bank {
|
||||
if (!isOpen()) {
|
||||
return null;
|
||||
}
|
||||
return Loader.getClient().getInterfaceCache()[Integer.parseInt(settings.getProperty("item_interface_id"))].getItems();
|
||||
return Loader.getClient().getInterfaceCache()[settings.get("item_interface_id")].getItems();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -243,7 +243,7 @@ public class Bank {
|
||||
if (!isOpen()) {
|
||||
return null;
|
||||
}
|
||||
return Loader.getClient().getInterfaceCache()[Integer.parseInt(settings.getProperty("item_interface_id"))].getStackSizes();
|
||||
return Loader.getClient().getInterfaceCache()[settings.get("item_interface_id")].getStackSizes();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -287,7 +287,7 @@ public class Bank {
|
||||
* @return <b>true</b> if bank is open
|
||||
*/
|
||||
public static boolean isOpen() {
|
||||
return Loader.getClient().getOpenInterfaceId() == Integer.parseInt(settings.getProperty("bank_interface_id"));
|
||||
return Loader.getClient().getOpenInterfaceId() == settings.get("bank_interface_id");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.rev317.min.api.wrappers.GroundItem;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.Properties;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* @author Everel, JKetelaar
|
||||
@@ -34,7 +34,7 @@ public class GroundItems {
|
||||
|
||||
};
|
||||
private static Client client;
|
||||
private static Properties settings = Context.getInstance().getServerProviderInfo().getSettings();
|
||||
private static HashMap<String, Integer> settings = Context.getInstance().getServerProviderInfo().getSettings();
|
||||
|
||||
/**
|
||||
* Gets all loaded ground items
|
||||
@@ -150,18 +150,18 @@ public class GroundItems {
|
||||
}
|
||||
|
||||
public enum Option{
|
||||
FIRST(Integer.parseInt(settings.getProperty("menu_ground_item_first_interaction"))),
|
||||
FIRST(settings.get("menu_ground_item_first_interaction")),
|
||||
|
||||
SECOND(Integer.parseInt(settings.getProperty("menu_ground_item_second_interaction"))),
|
||||
SECOND(settings.get("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"))),
|
||||
THIRD(settings.get("menu_ground_item_third_interaction")),
|
||||
TAKE(settings.get("menu_ground_item_third_interaction")),
|
||||
|
||||
FOURTH(Integer.parseInt(settings.getProperty("menu_ground_item_fourth_interaction"))),
|
||||
FOURTH(settings.get("menu_ground_item_fourth_interaction")),
|
||||
|
||||
FIFTH(Integer.parseInt(settings.getProperty("menu_ground_item_fifth_interaction"))),
|
||||
FIFTH(settings.get("menu_ground_item_fifth_interaction")),
|
||||
|
||||
EXAMINE(Integer.parseInt(settings.getProperty("menu_ground_item_examine_interaction")));
|
||||
EXAMINE(settings.get("menu_ground_item_examine_interaction"));
|
||||
|
||||
int actionId;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.rev317.min.accessors.Interface;
|
||||
import org.rev317.min.api.wrappers.Item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Properties;
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
/**
|
||||
@@ -17,7 +17,7 @@ import java.util.Properties;
|
||||
*/
|
||||
public class Inventory {
|
||||
|
||||
private static Properties settings = Context.getInstance().getServerProviderInfo().getSettings();
|
||||
private static HashMap<String, Integer> settings = Context.getInstance().getServerProviderInfo().getSettings();
|
||||
|
||||
private static final Filter<Item> ALL_FILTER = new Filter<Item>() {
|
||||
|
||||
@@ -59,7 +59,7 @@ public class Inventory {
|
||||
* @return interface of inventory
|
||||
*/
|
||||
public static Interface getInterface() {
|
||||
return Loader.getClient().getInterfaceCache()[Integer.parseInt(settings.getProperty("inventory_index"))];
|
||||
return Loader.getClient().getInterfaceCache()[settings.get("inventory_index")];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,59 +1,180 @@
|
||||
package org.rev317.min.api.methods;
|
||||
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
import org.parabot.core.Configuration;
|
||||
import org.parabot.core.Context;
|
||||
import org.parabot.environment.api.utils.WebUtil;
|
||||
|
||||
import java.util.Properties;
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* @author JKetelaar
|
||||
*/
|
||||
public class Items {
|
||||
private static Properties settings = Context.getInstance().getServerProviderInfo().getSettings();
|
||||
/**
|
||||
* TODO Cache results
|
||||
*/
|
||||
private static HashMap<String, Integer> settings = Context.getInstance().getServerProviderInfo().getSettings();
|
||||
private static JSONParser jsonParser = new JSONParser();
|
||||
|
||||
private static HashMap<Integer, Long> prices = new HashMap<>();
|
||||
private static HashMap<Integer, String> names = new HashMap<>();
|
||||
|
||||
public static String getName(int id){
|
||||
String name;
|
||||
if ((name = names.get(id)) != null){
|
||||
return name;
|
||||
}else {
|
||||
try {
|
||||
String content = WebUtil.getContents(Configuration.ITEM_API + id);
|
||||
if (content.length() > 0) {
|
||||
JSONObject jsonObject = (JSONObject) jsonParser.parse(content);
|
||||
JSONObject itemInformation = (JSONObject) jsonObject.get("result");
|
||||
if (itemInformation.get("name") != null && !((String) itemInformation.get("name")).equalsIgnoreCase("null")) {
|
||||
name = (String) itemInformation.get("name");
|
||||
names.put(id, name);
|
||||
return name;
|
||||
}
|
||||
}
|
||||
} catch (MalformedURLException | ParseException ignored) {
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int[] getIds(String name){
|
||||
try {
|
||||
String content = WebUtil.getContents(Configuration.ITEM_API + name);
|
||||
if (content.length() > 0) {
|
||||
JSONObject jsonObject = (JSONObject) jsonParser.parse(content);
|
||||
JSONArray array = (JSONArray) jsonObject.get("result");
|
||||
if (array.size() > 0){
|
||||
int[] ids = new int[array.size()];
|
||||
for (int i = 0; i < array.size(); i++){
|
||||
ids[i] = Integer.parseInt((String) array.get(i));
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
}
|
||||
} catch (MalformedURLException | ParseException ignored) {}
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @return
|
||||
*/
|
||||
public static int[] getIdsStart(String name){
|
||||
try {
|
||||
String content = WebUtil.getContents(Configuration.ITEM_API + "starts/" + name);
|
||||
if (content.length() > 0) {
|
||||
JSONObject jsonObject = (JSONObject) jsonParser.parse(content);
|
||||
JSONArray array = (JSONArray) jsonObject.get("result");
|
||||
if (array.size() > 0){
|
||||
int[] ids = new int[array.size()];
|
||||
for (int i = 0; i < array.size(); i++){
|
||||
ids[i] = Integer.parseInt((String) array.get(i));
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
}
|
||||
} catch (MalformedURLException | ParseException ignored) {}
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an int array based on the string it contains. getIdsContain(dragon) will return an int array with all items containingdragon
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static int[] getIdsContain(String name){
|
||||
try {
|
||||
String content = WebUtil.getContents(Configuration.ITEM_API + "contains/" + name);
|
||||
if (content.length() > 0) {
|
||||
JSONObject jsonObject = (JSONObject) jsonParser.parse(content);
|
||||
JSONArray array = (JSONArray) jsonObject.get("result");
|
||||
if (array.size() > 0){
|
||||
int[] ids = new int[array.size()];
|
||||
for (int i = 0; i < array.size(); i++){
|
||||
ids[i] = Integer.parseInt((String) array.get(i));
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
}
|
||||
} catch (MalformedURLException | ParseException ignored) {}
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
public static long getPrice(int id){
|
||||
if (prices.containsKey(id)){
|
||||
return prices.get(id);
|
||||
}else {
|
||||
try {
|
||||
String content = WebUtil.getContents(Configuration.ITEM_API + id + "/" + Context.getInstance().getServerProviderInfo().getServerName());
|
||||
if (content.length() > 0) {
|
||||
JSONObject jsonObject = (JSONObject) jsonParser.parse(content);
|
||||
JSONObject itemInformation = (JSONObject) jsonObject.get("result");
|
||||
if (itemInformation.get("price") != null && !((String) itemInformation.get("price")).equalsIgnoreCase("null")) {
|
||||
long price = Long.parseLong((String) itemInformation.get("price"));
|
||||
prices.put(id, price);
|
||||
return price;
|
||||
}
|
||||
}
|
||||
} catch (MalformedURLException | ParseException ignored) {
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
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_FIRST(settings.get("menu_transform_one_interaction")),
|
||||
VALUE(settings.get("menu_transform_one_interaction")),
|
||||
TRANSFORM_ONE(settings.get("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_SECOND(settings.get("menu_transform_five_interaction")),
|
||||
TRANSFORM_FIVE(settings.get("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_THIRD(settings.get("menu_transform_ten_interaction")),
|
||||
TRANSFORM_TEN(settings.get("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_FOURTH(settings.get("menu_transform_all_interaction")),
|
||||
TRANSFORM_ALL(settings.get("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_FIFTH(settings.get("menu_transform_x_interaction")),
|
||||
TRANSFORM_X(settings.get("menu_transform_x_interaction")),
|
||||
TRANSFORM_HUNDRED(settings.get("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_SIXTH(settings.get("menu_transform_all_but_one_interaction")),
|
||||
TRANSFORM_ALL_BUT_ONE(settings.get("menu_transform_all_but_one_interaction")),
|
||||
|
||||
TRANSFORM_EXAMINE(Integer.parseInt(settings.getProperty("menu_transform_examine_interaction"))),
|
||||
TRANSFORM_EXAMINE(settings.get("menu_transform_examine_interaction")),
|
||||
|
||||
FIRST(Integer.parseInt(settings.getProperty("menu_item_first_interaction"))),
|
||||
WEAR(Integer.parseInt(settings.getProperty("menu_item_first_interaction"))),
|
||||
FIRST(settings.get("menu_item_first_interaction")),
|
||||
WEAR(settings.get("menu_item_first_interaction")),
|
||||
|
||||
SECOND(Integer.parseInt(settings.getProperty("menu_item_second_interaction"))),
|
||||
CONSUME(Integer.parseInt(settings.getProperty("menu_item_second_interaction"))),
|
||||
DRINK(Integer.parseInt(settings.getProperty("menu_item_second_interaction"))),
|
||||
SECOND(settings.get("menu_item_second_interaction")),
|
||||
CONSUME(settings.get("menu_item_second_interaction")),
|
||||
DRINK(settings.get("menu_item_second_interaction")),
|
||||
|
||||
THIRD(Integer.parseInt(settings.getProperty("menu_item_third_interaction"))),
|
||||
USE(Integer.parseInt(settings.getProperty("menu_item_third_interaction"))),
|
||||
THIRD(settings.get("menu_item_third_interaction")),
|
||||
USE(settings.get("menu_item_third_interaction")),
|
||||
|
||||
FOURTH(Integer.parseInt(settings.getProperty("menu_item_fourth_interaction"))),
|
||||
EMPTY(Integer.parseInt(settings.getProperty("menu_item_fourth_interaction"))),
|
||||
FOURTH(settings.get("menu_item_fourth_interaction")),
|
||||
EMPTY(settings.get("menu_item_fourth_interaction")),
|
||||
|
||||
FIFTH(Integer.parseInt(settings.getProperty("menu_item_fifth_interaction"))),
|
||||
DROP(Integer.parseInt(settings.getProperty("menu_item_fifth_interaction"))),
|
||||
FIFTH(settings.get("menu_item_fifth_interaction")),
|
||||
DROP(settings.get("menu_item_fifth_interaction")),
|
||||
|
||||
SIXTH(Integer.parseInt(settings.getProperty("menu_item_sixth_interaction"))),
|
||||
EXAMINE(Integer.parseInt(settings.getProperty("menu_item_sixth_interaction"))),
|
||||
SIXTH(settings.get("menu_item_sixth_interaction")),
|
||||
EXAMINE(settings.get("menu_item_sixth_interaction")),
|
||||
|
||||
SEVENTH(Integer.parseInt(settings.getProperty("menu_item_seventh_interaction"))),
|
||||
USE_WITH(Integer.parseInt(settings.getProperty("menu_item_seventh_interaction")));
|
||||
SEVENTH(settings.get("menu_item_seventh_interaction")),
|
||||
USE_WITH(settings.get("menu_item_seventh_interaction"));
|
||||
|
||||
int actionId;
|
||||
|
||||
|
||||
@@ -6,14 +6,14 @@ import org.rev317.min.accessors.Client;
|
||||
import org.rev317.min.api.wrappers.Character;
|
||||
import org.rev317.min.api.wrappers.*;
|
||||
|
||||
import java.util.Properties;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* @author JKetelaar, Everel
|
||||
*/
|
||||
public class Menu {
|
||||
|
||||
private static Properties settings = Context.getInstance().getServerProviderInfo().getSettings();
|
||||
private static HashMap<String, Integer> settings = Context.getInstance().getServerProviderInfo().getSettings();
|
||||
|
||||
/**
|
||||
* Interacts with a sceneobject
|
||||
@@ -165,7 +165,7 @@ public class Menu {
|
||||
* @param item
|
||||
*/
|
||||
public static void take(GroundItem item) {
|
||||
sendAction(Integer.parseInt(settings.getProperty("button_take_item")), item.getId(), item.getX(), item.getY());
|
||||
sendAction(settings.get("button_take_item"), item.getId(), item.getX(), item.getY());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -268,8 +268,8 @@ public class Menu {
|
||||
* @param item
|
||||
*/
|
||||
public static void drop(Item item) {
|
||||
sendAction(Integer.parseInt(settings.getProperty("button_drop_item")), item.getId() - 1, item.getSlot(),
|
||||
Integer.parseInt(settings.getProperty("inventory_index")));
|
||||
sendAction(settings.get("button_drop_item"), item.getId() - 1, item.getSlot(),
|
||||
settings.get("inventory_index"));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -278,7 +278,7 @@ public class Menu {
|
||||
* @param id
|
||||
*/
|
||||
public static void clickButton(int id) {
|
||||
sendAction(Integer.parseInt(settings.getProperty("button_action_click")), 0, 0, id);
|
||||
sendAction(settings.get("button_action_click"), 0, 0, id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,10 +6,7 @@ import org.rev317.min.Loader;
|
||||
import org.rev317.min.accessors.Client;
|
||||
import org.rev317.min.api.wrappers.Npc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.Properties;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Everel, JKetelaar
|
||||
@@ -33,7 +30,7 @@ public class Npcs {
|
||||
}
|
||||
|
||||
};
|
||||
private static Properties settings = Context.getInstance().getServerProviderInfo().getSettings();
|
||||
private static HashMap<String, Integer> settings = Context.getInstance().getServerProviderInfo().getSettings();
|
||||
|
||||
/**
|
||||
* Gets all Npcs except local Npc
|
||||
@@ -145,31 +142,31 @@ public class Npcs {
|
||||
}
|
||||
|
||||
public enum Option{
|
||||
FIRST(Integer.parseInt(settings.getProperty("menu_character_first_interaction"))),
|
||||
ATTACK(Integer.parseInt(settings.getProperty("menu_character_first_interaction"))),
|
||||
FIRST(settings.get("menu_character_first_interaction")),
|
||||
ATTACK(settings.get("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"))),
|
||||
BAIT(Integer.parseInt(settings.getProperty("menu_character_second_interaction"))),
|
||||
CAGE(Integer.parseInt(settings.getProperty("menu_character_second_interaction"))),
|
||||
NET(Integer.parseInt(settings.getProperty("menu_character_second_interaction"))),
|
||||
SECOND(settings.get("menu_character_second_interaction")),
|
||||
TALK_TO(settings.get("menu_character_second_interaction")),
|
||||
INTERACT(settings.get("menu_character_second_interaction")),
|
||||
BAIT(settings.get("menu_character_second_interaction")),
|
||||
CAGE(settings.get("menu_character_second_interaction")),
|
||||
NET(settings.get("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"))),
|
||||
HARPOON(Integer.parseInt(settings.getProperty("menu_character_third_interaction"))),
|
||||
GET_TASK(Integer.parseInt(settings.getProperty("menu_character_third_interaction"))),
|
||||
THIRD(settings.get("menu_character_third_interaction")),
|
||||
TRADE(settings.get("menu_character_third_interaction")),
|
||||
BANK(settings.get("menu_character_third_interaction")),
|
||||
PICKPOCKET(settings.get("menu_character_third_interaction")),
|
||||
HARPOON(settings.get("menu_character_third_interaction")),
|
||||
GET_TASK(settings.get("menu_character_third_interaction")),
|
||||
|
||||
FOURTH(Integer.parseInt(settings.getProperty("menu_character_fourth_interaction"))),
|
||||
COLLECT(Integer.parseInt(settings.getProperty("menu_character_fourth_interaction"))),
|
||||
CHANGE_CLOTHES(Integer.parseInt(settings.getProperty("menu_character_fourth_interaction"))),
|
||||
FOURTH(settings.get("menu_character_fourth_interaction")),
|
||||
COLLECT(settings.get("menu_character_fourth_interaction")),
|
||||
CHANGE_CLOTHES(settings.get("menu_character_fourth_interaction")),
|
||||
|
||||
FIFTH(Integer.parseInt(settings.getProperty("menu_character_fifth_interaction"))),
|
||||
REWARD(Integer.parseInt(settings.getProperty("menu_character_fifth_interaction"))),
|
||||
FIFTH(settings.get("menu_character_fifth_interaction")),
|
||||
REWARD(settings.get("menu_character_fifth_interaction")),
|
||||
|
||||
EXAMINE(Integer.parseInt(settings.getProperty("menu_character_examine")));
|
||||
EXAMINE(settings.get("menu_character_examine"));
|
||||
|
||||
int actionId;
|
||||
|
||||
|
||||
@@ -6,10 +6,7 @@ import org.rev317.min.Loader;
|
||||
import org.rev317.min.accessors.Client;
|
||||
import org.rev317.min.api.wrappers.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.Properties;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Everel, JKetelaar
|
||||
@@ -33,7 +30,7 @@ public class Players {
|
||||
}
|
||||
|
||||
};
|
||||
private static Properties settings = Context.getInstance().getServerProviderInfo().getSettings();
|
||||
private static HashMap<String, Integer> settings = Context.getInstance().getServerProviderInfo().getSettings();
|
||||
|
||||
/**
|
||||
* Gets all players except local player
|
||||
@@ -99,24 +96,24 @@ public class Players {
|
||||
}
|
||||
|
||||
public enum Option{
|
||||
FIRST(Integer.parseInt(settings.getProperty("menu_character_first_interaction"))),
|
||||
FIRST(settings.get("menu_character_first_interaction")),
|
||||
|
||||
SECOND(Integer.parseInt(settings.getProperty("menu_character_second_interaction"))),
|
||||
SECOND(settings.get("menu_character_second_interaction")),
|
||||
|
||||
THIRD(Integer.parseInt(settings.getProperty("menu_character_third_interaction"))),
|
||||
THIRD(settings.get("menu_character_third_interaction")),
|
||||
|
||||
FOURTH(Integer.parseInt(settings.getProperty("menu_character_fourth_interaction"))),
|
||||
FOURTH(settings.get("menu_character_fourth_interaction")),
|
||||
|
||||
FIFTH(Integer.parseInt(settings.getProperty("menu_character_fifth_interaction"))),
|
||||
FIFTH(settings.get("menu_character_fifth_interaction")),
|
||||
|
||||
FOLLOW(Integer.parseInt(settings.getProperty("menu_character_follow"))),
|
||||
FOLLOW(settings.get("menu_character_follow")),
|
||||
|
||||
TRADE(Integer.parseInt(settings.getProperty("menu_character_trade"))),
|
||||
TRADE(settings.get("menu_character_trade")),
|
||||
|
||||
ATTACK(Integer.parseInt(settings.getProperty("menu_character_attack"))),
|
||||
CHALLENGE(Integer.parseInt(settings.getProperty("menu_character_attack"))),
|
||||
ATTACK(settings.get("menu_character_attack")),
|
||||
CHALLENGE(settings.get("menu_character_attack")),
|
||||
|
||||
EXAMINE(Integer.parseInt(settings.getProperty("menu_character_examine")));
|
||||
EXAMINE(settings.get("menu_character_examine"));
|
||||
|
||||
int actionId;
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ public class SceneObjects {
|
||||
}
|
||||
|
||||
};
|
||||
private static Properties settings = Context.getInstance().getServerProviderInfo().getSettings();
|
||||
private static HashMap<String, Integer> settings = Context.getInstance().getServerProviderInfo().getSettings();
|
||||
|
||||
/**
|
||||
* Gets the most important scene objects in game which can be interacted with, filters out: 'walls, wall
|
||||
@@ -224,33 +224,33 @@ public class 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"))),
|
||||
CLOSE(Integer.parseInt(settings.getProperty("menu_scene_object_first_interaction"))),
|
||||
CROSS(Integer.parseInt(settings.getProperty("menu_scene_object_first_interaction"))),
|
||||
FIRST(settings.get("menu_scene_object_first_interaction")),
|
||||
TALK_TO(settings.get("menu_scene_object_first_interaction")),
|
||||
CHOP_DOWN(settings.get("menu_scene_object_first_interaction")),
|
||||
CRAFT_RUNE(settings.get("menu_scene_object_first_interaction")),
|
||||
PRAY_AT(settings.get("menu_scene_object_first_interaction")),
|
||||
OPEN(settings.get("menu_scene_object_first_interaction")),
|
||||
DEPOSIT(settings.get("menu_scene_object_first_interaction")),
|
||||
USE(settings.get("menu_scene_object_first_interaction")),
|
||||
SEARCH(settings.get("menu_scene_object_first_interaction")),
|
||||
CLOSE(settings.get("menu_scene_object_first_interaction")),
|
||||
CROSS(settings.get("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"))),
|
||||
INSPECT(Integer.parseInt(settings.getProperty("menu_scene_object_second_interaction"))),
|
||||
SECOND(settings.get("menu_scene_object_second_interaction")),
|
||||
TELEPORT(settings.get("menu_scene_object_second_interaction")),
|
||||
STEAL_FROM(settings.get("menu_scene_object_second_interaction")),
|
||||
PRAY(settings.get("menu_scene_object_second_interaction")),
|
||||
USE_QUICKLY(settings.get("menu_scene_object_second_interaction")),
|
||||
INSPECT(settings.get("menu_scene_object_second_interaction")),
|
||||
|
||||
THIRD(Integer.parseInt(settings.getProperty("menu_scene_object_third_interaction"))),
|
||||
THIRD(settings.get("menu_scene_object_third_interaction")),
|
||||
|
||||
FOURTH(Integer.parseInt(settings.getProperty("menu_scene_object_fourth_interaction"))),
|
||||
GUIDE(Integer.parseInt(settings.getProperty("menu_scene_object_fourth_interaction"))),
|
||||
FOURTH(settings.get("menu_scene_object_fourth_interaction")),
|
||||
GUIDE(settings.get("menu_scene_object_fourth_interaction")),
|
||||
|
||||
FIFTH(Integer.parseInt(settings.getProperty("menu_scene_object_fifth_interaction"))),
|
||||
FIFTH(settings.get("menu_scene_object_fifth_interaction")),
|
||||
|
||||
EXAMINE(Integer.parseInt(settings.getProperty("menu_scene_object_examine")));
|
||||
EXAMINE(settings.get("menu_scene_object_examine"));
|
||||
|
||||
int actionId;
|
||||
|
||||
|
||||
@@ -9,14 +9,14 @@ import org.rev317.min.accessors.Interface;
|
||||
import org.rev317.min.api.wrappers.Item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Properties;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* @author JKetelaar
|
||||
*/
|
||||
public class Trading {
|
||||
|
||||
private static Properties settings = Context.getInstance().getServerProviderInfo().getSettings();
|
||||
private static HashMap<String, Integer> settings = Context.getInstance().getServerProviderInfo().getSettings();
|
||||
|
||||
/**
|
||||
* Checks if the first or the second screen is open, based on the given boolean
|
||||
@@ -24,7 +24,7 @@ public class Trading {
|
||||
* @return True if the requested screen is open
|
||||
*/
|
||||
public static boolean isOpen(boolean first){
|
||||
return Loader.getClient().getOpenInterfaceId() == (first ? Integer.parseInt(settings.getProperty("first_trade_interface_id")) : Integer.parseInt(settings.getProperty("second_trade_interface_id")));
|
||||
return Loader.getClient().getOpenInterfaceId() == (first ? settings.get("first_trade_interface_id") : settings.get("second_trade_interface_id"));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,7 +32,7 @@ public class Trading {
|
||||
* @return True if open, false if not open
|
||||
*/
|
||||
public static boolean isOpen(){
|
||||
return Loader.getClient().getOpenInterfaceId() == Integer.parseInt(settings.getProperty("first_trade_interface_id")) || Loader.getClient().getOpenInterfaceId() == Integer.parseInt(settings.getProperty("second_trade_interface_id"));
|
||||
return Loader.getClient().getOpenInterfaceId() == settings.get("first_trade_interface_id") || Loader.getClient().getOpenInterfaceId() == settings.get("second_trade_interface_id");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,8 +51,8 @@ public class Trading {
|
||||
|
||||
public static Item[] getMyOffer() {
|
||||
ArrayList<Item> items = new ArrayList<>();
|
||||
int[] ids = getItemIDs(Integer.parseInt(settings.getProperty("my_offer_interface_id")));
|
||||
int[] stacks = getItemStacks(Integer.parseInt(settings.getProperty("my_offer_interface_id")));
|
||||
int[] ids = getItemIDs(settings.get("my_offer_interface_id"));
|
||||
int[] stacks = getItemStacks(settings.get("my_offer_interface_id"));
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
if (ids[i] > 0) {
|
||||
items.add(new Item(ids[i], stacks[i], i));
|
||||
@@ -63,8 +63,8 @@ public class Trading {
|
||||
|
||||
public static Item[] getOpponentsOffer() {
|
||||
ArrayList<Item> items = new ArrayList<>();
|
||||
int[] ids = getItemIDs(Integer.parseInt(settings.getProperty("opponent_offer_interface_id")));
|
||||
int[] stacks = getItemStacks(Integer.parseInt(settings.getProperty("opponent_offer_interface_id")));
|
||||
int[] ids = getItemIDs(settings.get("opponent_offer_interface_id"));
|
||||
int[] stacks = getItemStacks(settings.get("opponent_offer_interface_id"));
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
if (ids[i] > 0) {
|
||||
items.add(new Item(ids[i], stacks[i], i));
|
||||
|
||||
Reference in New Issue
Block a user