Re-arranged code

This commit is contained in:
JKetelaar
2014-08-19 03:08:07 +02:00
parent d19933b14f
commit 88050384f8
54 changed files with 2867 additions and 2843 deletions
+4 -6
View File
@@ -22,15 +22,17 @@ import java.io.File;
import java.net.URL;
/**
*
* @author Everel
*
*/
@ServerManifest(author = "Everel & Paradox", name = "Server name here", type = Type.INJECTION, version = 2.1)
public class Loader extends ServerProvider {
private Applet applet;
private HookFile hookFile = new HookFile(Context.getInstance().getServerProviderInfo().getExtendenHookFile(), HookFile.TYPE_XML);
public static Client getClient() {
return (Client) Context.getInstance().getClient();
}
@Override
public Applet fetchApplet() {
try {
@@ -58,10 +60,6 @@ public class Loader extends ServerProvider {
return WebUtil.toURL(target);
}
public static Client getClient() {
return (Client) Context.getInstance().getClient();
}
@Override
public void addMenuItems(JMenuBar bar) {
new BotMenu(bar);
@@ -1,9 +1,7 @@
package org.rev317.min.api.events;
/**
*
* @author Matt, Everel
*
*/
public final class GameActionEvent {
private int index, cmd1, cmd2, cmd3, cmd4, action;
@@ -1,19 +1,16 @@
package org.rev317.min.api.events;
/**
*
* @author Everel, Matt
*
*/
public final class MessageEvent {
private int type;
private String name;
private String message;
public static final int TYPE_GENERIC = 0;
public static final int TYPE_PLAYER = 2;
public static final int TYPE_TRADE = 4;
public static final int TYPE_DUEL = 8;
private int type;
private String name;
private String message;
public MessageEvent(final int type, String name, String msg) {
this.type = type;
@@ -3,9 +3,7 @@ package org.rev317.min.api.events.listeners;
import org.rev317.min.api.events.GameActionEvent;
/**
*
* @author Matt
*
*/
public interface GameActionListener {
@@ -3,20 +3,20 @@ package org.rev317.min.api.interfaces;
import org.rev317.min.api.wrappers.Tile;
/**
*
* @author Everel
*
*/
public interface Locatable {
/**
* Gets location of this locatable instance
*
* @return location
*/
public Tile getLocation();
/**
* Gets distance to this locatable instance
*
* @return distance from player to locatable
*/
public int distanceTo();
+15 -19
View File
@@ -1,8 +1,5 @@
package org.rev317.min.api.methods;
import java.util.ArrayList;
import java.util.HashMap;
import org.parabot.core.Context;
import org.parabot.environment.api.utils.Time;
import org.parabot.environment.input.Keyboard;
@@ -11,19 +8,27 @@ import org.rev317.min.api.wrappers.Item;
import org.rev317.min.api.wrappers.Npc;
import org.rev317.min.api.wrappers.SceneObject;
import java.util.ArrayList;
import java.util.HashMap;
/**
*
* @author Everel
* @author Matt123337
*
*/
public class Bank {
public static final int[] BANKERS = new int[]{44, 45, 494, 495, 498, 499,
909, 958, 1036, 2271, 2354, 2355, 3824, 5488, 5901, 4456, 4457,
4458, 4459, 5912, 5913, 6362, 6532, 6533, 6534, 6535, 7605, 8948,
9710, 14367};
public static final int[] BANKS = new int[]{782, 2213, 2995, 5276, 6084,
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};
public static int BANK_INTERFACE = 5292;
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 {
HashMap<String, String> p = Context.getInstance().getServerProviderInfo().getProperties();
if (p.containsKey("bankInterface"))
@@ -38,15 +43,6 @@ public class Bank {
BANK_OPEN_INDEX = Integer.parseInt(p.get("bankOpenIndex"));
}
public static final int[] BANKERS = new int[] { 44, 45, 494, 495, 498, 499,
909, 958, 1036, 2271, 2354, 2355, 3824, 5488, 5901, 4456, 4457,
4458, 4459, 5912, 5913, 6362, 6532, 6533, 6534, 6535, 7605, 8948,
9710, 14367 };
public static final int[] BANKS = new int[] { 782, 2213, 2995, 5276, 6084,
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 };
/**
* Gets nearest banker
*
@@ -146,6 +142,7 @@ public class Bank {
* Gets bank item with given id
*
* @param id
*
* @return bank item
*/
public static Item getItem(int id) {
@@ -166,6 +163,7 @@ public class Bank {
* Counts the amount of items with given id in bank
*
* @param id
*
* @return count
*/
public static int getCount(int id) {
@@ -178,8 +176,7 @@ public class Bank {
/**
* Opens the bank
*
* @param bank
* booth
* @param bank booth
*/
public static void open(SceneObject bank) {
@@ -209,8 +206,7 @@ public class Bank {
/**
* Deposits all items except the given ids
*
* @param exceptions
* the item indexes that will be ignored.
* @param exceptions the item indexes that will be ignored.
*/
public static void depositAllExcept(int... exceptions) {
if (Bank.isOpen()) {
@@ -3,9 +3,7 @@ package org.rev317.min.api.methods;
import org.rev317.min.api.wrappers.Tile;
/**
*
* @author Everel
*
*/
public class Calculations {
@@ -13,6 +11,7 @@ public class Calculations {
* Calculates distance between local player and given tile
*
* @param tile
*
* @return distance between local player and given tile
*/
public static final double distanceTo(Tile tile) {
@@ -21,8 +20,10 @@ public class Calculations {
/**
* Calculates distance between two given tiles
*
* @param a
* @param b
*
* @return distance between a and b
*/
public static final double distanceBetween(Tile a, Tile b) {
@@ -38,7 +39,9 @@ public class Calculations {
* @param destX the destX (0 < destX < 104)
* @param destY the destY (0 < destY < 104)
* @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 found.
*
* @return The distance of the shortest path to the destination; or -1 if no valid path to the destination was
* found.
*/
public static int dijkstraDist(final int startX, final int startY, final int destX, final int destY, final boolean findAdjacent) {
try {
+8 -2
View File
@@ -3,14 +3,13 @@ package org.rev317.min.api.methods;
import org.rev317.min.Loader;
/**
*
* @author Everel
*
*/
public class Game {
/**
* Gets BaseX
*
* @return baseX
*/
public static int getBaseX() {
@@ -19,6 +18,7 @@ public class Game {
/**
* Gets BaseY
*
* @return baseY
*/
public static int getBaseY() {
@@ -27,6 +27,7 @@ public class Game {
/**
* Gets open interface id
*
* @return interface id
*/
public static int getOpenInterfaceId() {
@@ -35,6 +36,7 @@ public class Game {
/**
* Get open back dialog id
*
* @return back dialog id
*/
public static int getOpenBackDialogId() {
@@ -43,6 +45,7 @@ public class Game {
/**
* Gets loop cycle
*
* @return loop cycle
*/
public static int getLoopCycle() {
@@ -51,6 +54,7 @@ public class Game {
/**
* Get collision flags
*
* @return collision flags
*/
public static int[][] getCollisionFlags() {
@@ -59,6 +63,7 @@ public class Game {
/**
* Gets current plane
*
* @return current plane
*/
public static int getPlane() {
@@ -67,6 +72,7 @@ public class Game {
/**
* Determines whether this client has action 4 hooked
*
* @return <code>true</code> if action 4 is hooked
*/
public static boolean hasAction4() {
+10 -13
View File
@@ -1,9 +1,5 @@
package org.rev317.min.api.methods;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import org.parabot.environment.api.utils.Filter;
import org.rev317.min.Loader;
import org.rev317.min.accessors.Client;
@@ -11,14 +7,14 @@ import org.rev317.min.accessors.Deque;
import org.rev317.min.accessors.Node;
import org.rev317.min.api.wrappers.GroundItem;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
/**
*
* @author Everel
*
*/
public class GroundItems {
private static Client client;
private static final Comparator<GroundItem> NEAREST_SORTER = new Comparator<GroundItem>() {
@Override
@@ -27,7 +23,6 @@ public class GroundItems {
}
};
private static final Filter<GroundItem> ALL_FILTER = new Filter<GroundItem>() {
@Override
@@ -36,6 +31,7 @@ public class GroundItems {
}
};
private static Client client;
/**
* Gets all loaded ground items
@@ -66,10 +62,9 @@ public class GroundItems {
/**
* Gets a ground item
*
* @param x
* - local region x
* @param y
* - local region y
* @param x - local region x
* @param y - local region y
*
* @return ground item array
*/
public static final GroundItem[] getGroundItemsAt(final int x, final int y) {
@@ -113,6 +108,7 @@ public class GroundItems {
* Returns array of GroundItems with the first index to be the nearest
*
* @param filter
*
* @return GroundItems
*/
public static final GroundItem[] getNearest(Filter<GroundItem> filter) {
@@ -134,6 +130,7 @@ public class GroundItems {
* Returns nearest ground items with given id
*
* @param ids
*
* @return GroundItems
*/
public static final GroundItem[] getNearest(final int... ids) {
+17 -4
View File
@@ -1,18 +1,16 @@
package org.rev317.min.api.methods;
import java.util.ArrayList;
import org.parabot.environment.api.utils.Filter;
import org.parabot.environment.api.utils.Time;
import org.rev317.min.Loader;
import org.rev317.min.accessors.Interface;
import org.rev317.min.api.wrappers.Item;
import java.util.ArrayList;
/**
*
* @author Everel
*
*/
public class Inventory {
public static final int INVENTORY_INDEX = 3214;
@@ -38,6 +36,7 @@ public class Inventory {
/**
* Gets inventory interface
*
* @return interface of inventory
*/
public static Interface getInterface() {
@@ -46,6 +45,7 @@ public class Inventory {
/**
* Gets the amount of items in inventory, excludes the stack sizes
*
* @return amount of items
*/
public static final int getCount() {
@@ -54,7 +54,9 @@ public class Inventory {
/**
* Gets the amount of items with given ids in inventory, excludes the stack sizes
*
* @param ids
*
* @return amount of items
*/
public static final int getCount(int... ids) {
@@ -63,7 +65,9 @@ public class Inventory {
/**
* Gets the amount of items in inventory
*
* @param includeStack - true for including stack sizes to the counting
*
* @return amount of items
*/
public static final int getCount(final boolean includeStack) {
@@ -84,8 +88,10 @@ public class Inventory {
/**
* Gets the amount of items with given ids in inventory
*
* @param includeStack - true for including stack sizes to the counting
* @param ids
*
* @return amount of items
*/
public static final int getCount(final boolean includeStack, int... ids) {
@@ -112,6 +118,7 @@ public class Inventory {
/**
* Gets every item in inventory
*
* @return items
*/
public static final Item[] getItems() {
@@ -120,7 +127,9 @@ public class Inventory {
/**
* Gets all items with given ids
*
* @param ids
*
* @return items
*/
public static final Item[] getItems(final int... ids) {
@@ -141,7 +150,9 @@ public class Inventory {
/**
* Gets all items accepted by filter
*
* @param filter
*
* @return items
*/
public static final Item[] getItems(final Filter<Item> filter) {
@@ -168,6 +179,7 @@ public class Inventory {
/**
* Determines if inventory is full
*
* @return <b>true</b> if inventory is full, otherwise <b>false</b>
*/
public static final boolean isFull() {
@@ -176,6 +188,7 @@ public class Inventory {
/**
* Determines if inventory is empty
*
* @return <b>true</b> if inventory is empty, otherwise <b>false</b>
*/
public static final boolean isEmpty() {
+13 -9
View File
@@ -1,7 +1,5 @@
package org.rev317.min.api.methods;
import java.util.HashMap;
import org.parabot.core.Context;
import org.rev317.min.Loader;
import org.rev317.min.accessors.Client;
@@ -10,10 +8,10 @@ import org.rev317.min.api.wrappers.GroundItem;
import org.rev317.min.api.wrappers.Item;
import org.rev317.min.api.wrappers.SceneObject;
import java.util.HashMap;
/**
*
* @author Everel
*
*/
public class Menu {
public static final int ACTION_CLICK_BUTTON = 646;
@@ -24,6 +22,7 @@ public class Menu {
/**
* Interacts with a sceneobject
*
* @param object
* @param actionIndex
*/
@@ -55,6 +54,7 @@ public class Menu {
/**
* Interacts with a character
*
* @param character
* @param actionIndex
*/
@@ -81,11 +81,8 @@ 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 actionIndex
* @param interfaceParentId
@@ -116,6 +113,7 @@ public class Menu {
/**
* Takes grounditem from the ground
*
* @param item
*/
public static void take(GroundItem item) {
@@ -124,6 +122,7 @@ public class Menu {
/**
* Interacts with a ground item
*
* @param item
* @param action
*/
@@ -151,6 +150,7 @@ public class Menu {
/**
* Drops an item
*
* @param item
*/
public static void drop(Item item) {
@@ -160,6 +160,7 @@ public class Menu {
/**
* Clicks a button
*
* @param id
*/
public static void clickButton(int id) {
@@ -168,6 +169,7 @@ public class Menu {
/**
* Sends an action to the client
*
* @param action
* @param cmd1
* @param cmd2
@@ -179,6 +181,7 @@ public class Menu {
/**
* Sends an action to the client
*
* @param action
* @param cmd1
* @param cmd2
@@ -191,6 +194,7 @@ public class Menu {
/**
* Sends an action to the client
*
* @param action
* @param cmd1
* @param cmd2
+11 -6
View File
@@ -1,18 +1,16 @@
package org.rev317.min.api.methods;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import org.parabot.environment.api.utils.Filter;
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;
/**
*
* @author Everel
*
*/
public class Npcs {
@@ -38,6 +36,7 @@ public class Npcs {
* Gets all Npcs except local Npc
*
* @param filter
*
* @return all Npcs
*/
public static final Npc[] getNpcs(final Filter<Npc> filter) {
@@ -67,7 +66,9 @@ public class Npcs {
/**
* Gets the closest npc which matches the given filter
*
* @param filter
*
* @return closest npc
*/
public static final Npc getClosest(final Filter<Npc> filter) {
@@ -80,7 +81,9 @@ public class Npcs {
/**
* Gets the closest npc which matches the given ids
*
* @param ids
*
* @return closest npc
*/
public static final Npc getClosest(int... ids) {
@@ -95,6 +98,7 @@ public class Npcs {
* Returns array with the first index to be the nearest Npc
*
* @param filter
*
* @return nearest Npcs
*/
public static final Npc[] getNearest(final Filter<Npc> filter) {
@@ -107,6 +111,7 @@ public class Npcs {
* Gets nearest npcs which hold given id(s)
*
* @param ids
*
* @return array of npcs with the first index to be the nearest
*/
public static final Npc[] getNearest(final int... ids) {
+11 -6
View File
@@ -1,18 +1,16 @@
package org.rev317.min.api.methods;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import org.parabot.environment.api.utils.Filter;
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;
/**
*
* @author Everel
*
*/
public class Players {
@@ -36,7 +34,9 @@ public class Players {
/**
* Gets all players except local player
*
* @param filter
*
* @return all players
*/
public static final Player[] getPlayers(final Filter<Player> filter) {
@@ -57,6 +57,7 @@ public class Players {
/**
* Gets all players except local player
*
* @return all players
*/
public static final Player[] getPlayers() {
@@ -65,7 +66,9 @@ public class Players {
/**
* Returns array with the first index to be the nearest player
*
* @param filter
*
* @return nearest players
*/
public static final Player[] getNearest(final Filter<Player> filter) {
@@ -76,6 +79,7 @@ public class Players {
/**
* Returns array with the first index to be the nearest player
*
* @return nearest players
*/
public static final Player[] getNearest() {
@@ -84,6 +88,7 @@ public class Players {
/**
* Gets local player
*
* @return local player
*/
public static Player getMyPlayer() {
@@ -1,20 +1,18 @@
package org.rev317.min.api.methods;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import org.parabot.environment.api.utils.Filter;
import org.rev317.min.Loader;
import org.rev317.min.accessors.Ground;
import org.rev317.min.accessors.SceneObjectTile;
import org.rev317.min.api.wrappers.SceneObject;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
/**
*
* @author Everel
*
*/
public class SceneObjects {
@@ -37,7 +35,9 @@ public class SceneObjects {
};
/**
* Gets the most important scene objects in game which can be interacted with, filters out: 'walls, wall decorations, ground decorations'
* Gets the most important scene objects in game which can be interacted with, filters out: 'walls, wall
* decorations, ground decorations'
*
* @return scene objects
*/
public static final SceneObject[] getSceneObjects(Filter<SceneObject> filter) {
@@ -56,6 +56,7 @@ public class SceneObjects {
/**
* Gets the most important scene objects in game which can be interacted with
*
* @return scene objects
*/
public static final SceneObject[] getSceneObjects() {
@@ -64,7 +65,9 @@ public class SceneObjects {
/**
* Returns array of sceneobjects with the first index to be the nearest
*
* @param filter
*
* @return sceneobjects
*/
public static final SceneObject[] getNearest(Filter<SceneObject> filter) {
@@ -75,6 +78,7 @@ public class SceneObjects {
/**
* Returns array of sceneobjects with the first index to be the nearest
*
* @return sceneobjects
*/
public static final SceneObject[] getNearest() {
@@ -83,7 +87,9 @@ public class SceneObjects {
/**
* Returns nearest objects with given id
*
* @param ids
*
* @return sceneobjects
*/
public static final SceneObject[] getNearest(final int... ids) {
@@ -145,6 +151,7 @@ public class SceneObjects {
/**
* Gets every loaded scene object in game
*
* @return every loaded scene object in game
*/
public static final SceneObject[] getAllSceneObjects() {
@@ -162,9 +169,11 @@ public class SceneObjects {
/**
* Gets all sceneobjects at a tile
*
* @param x
* @param y
* @param useCached
*
* @return array of sceneobjects, or null if there aren't any
*/
public static final Collection<SceneObject> getSceneObjectsAtTile(int x, int y, boolean useCached) {
+100 -108
View File
@@ -3,17 +3,11 @@ package org.rev317.min.api.methods;
import org.rev317.min.Loader;
/**
*
* @author Dane
*
*/
public enum Skill {
ATTACK, DEFENSE, STRENGTH, HITPOINTS, CONSTITUTION, RANGE, PRAYER
, MAGIC, COOKING, WOODCUTTING, FLETCHING, FISHING, FIREMAKING
, CRAFTING, SMITHING, MINING, HERBLORE, HERBLAW
, AGILITY, THIEVING, SLAYER, FARMING, RUNECRAFTING
, HUNTER, CONSTRUCTION, SUMMONING, DUNGEONEERING;
ATTACK, DEFENSE, STRENGTH, HITPOINTS, CONSTITUTION, RANGE, PRAYER, MAGIC, COOKING, WOODCUTTING, FLETCHING, FISHING, FIREMAKING, CRAFTING, SMITHING, MINING, HERBLORE, HERBLAW, AGILITY, THIEVING, SLAYER, FARMING, RUNECRAFTING, HUNTER, CONSTRUCTION, SUMMONING, DUNGEONEERING;
private static final int[] EXPERIENCE = {0, 0, 83, 174, 276, 388, 512,
650, 801, 969, 1154, 1358, 1584, 1833, 2107, 2411, 2746, 3115,
@@ -33,8 +27,103 @@ public enum Skill {
77474828, 85539082, 94442737, 104273167};
/**
* @Deprecated use Skill.ordinal() instead
* Returns the skill's index.
* Returns the experience of the provided skill.
*
* @param index the skill index.
*
* @return the experience.
*/
public static final int getCurrentExperience(int index) {
return Loader.getClient().getCurrentExp()[index];
}
/**
* Returns the real level of the provided skill.
*
* @param index the skill index.
*
* @return the real skill level.
*/
public static final int getRealLevel(int index) {
return getLevelByExperience(getCurrentExperience(index));
}
/**
* Returns the current level of the provided skill. (Will return de-buffed/buffed levels)
*
* @param index the skill index.
*
* @return the current skill level. Done by Bears
*/
public static final int getCurrentLevel(int index) {
//return Loader.getClient().getCurrentStats()[index];
return getRealLevel(index); //TODO fix this method, it invokes a method not in the client accessor.
}
/**
* Returns the exact experience at the provided level.
*
* @param level the level.
*
* @return the experience at the provided level.
*/
public static final int getExperienceByLevel(int level) {
if (level > 99 || level < 1) {
return 0;
}
return EXPERIENCE[level];
}
/**
* Returns the exact level with the provided experience.
*
* @param experience the experience.
*
* @return the level at the provided experience.
*/
public static final int getLevelByExperience(int experience) {
for (int i = EXPERIENCE.length - 1; i > 0; i--) {
if (experience > EXPERIENCE[i]) {
return i;
}
}
return 1;
}
/**
* Returns the remaining experience for the provided skill to level up.
*
* @param index the skill index.
*
* @return the remaining experience.
*/
public static final int getRemainingExperience(int index) {
int level = getLevelByExperience(getCurrentExperience(index));
if (level >= 99 || level < 1) {
return 0;
}
return EXPERIENCE[(level + 1)] - getCurrentExperience(index);
}
/**
* Returns the percentage to the next level for the provided skill.
*
* @param index the skill index.
*
* @return the remaining percentage.
*/
public static final int getPercentToNextLevel(int index) {
int currentLevel = getLevelByExperience(getCurrentExperience(index));
int nextLevel = currentLevel + 1;
if (currentLevel == 99 || nextLevel > 99 || currentLevel < 1
|| nextLevel < 1) {
return 0;
}
return (int) (100f * ((float) getCurrentExperience(index) / (float) EXPERIENCE[nextLevel]));
}
/**
* @Deprecated use Skill.ordinal() instead Returns the skill's index.
*/
public int getIndex() {
return ordinal();
@@ -63,8 +152,8 @@ public enum Skill {
}
/**
* Returns the current level. (For example, if you've been de-buffed by a spell, or drank a beer that buffs the stat; it will return the buffed level.)
* Done by Bears
* Returns the current level. (For example, if you've been de-buffed by a spell, or drank a beer that buffs the
* stat; it will return the buffed level.) Done by Bears
*/
public final int getLevel() {
return Skill.getCurrentLevel(this.getIndex());
@@ -92,101 +181,4 @@ public enum Skill {
return "Skill: [" + this.getName() + ": " + this.getLevel() + " / "
+ this.getRealLevel() + "]";
}
/**
* Returns the experience of the provided skill.
*
* @param index
* the skill index.
* @return the experience.
*/
public static final int getCurrentExperience(int index) {
return Loader.getClient().getCurrentExp()[index];
}
/**
* Returns the real level of the provided skill.
*
* @param index
* the skill index.
* @return the real skill level.
*/
public static final int getRealLevel(int index) {
return getLevelByExperience(getCurrentExperience(index));
}
/**
* Returns the current level of the provided skill. (Will return de-buffed/buffed levels)
*
* @param index
* the skill index.
* @return the current skill level.
* Done by Bears
*/
public static final int getCurrentLevel(int index) {
//return Loader.getClient().getCurrentStats()[index];
return getRealLevel(index); //TODO fix this method, it invokes a method not in the client accessor.
}
/**
* Returns the exact experience at the provided level.
*
* @param level
* the level.
* @return the experience at the provided level.
*/
public static final int getExperienceByLevel(int level) {
if (level > 99 || level < 1) {
return 0;
}
return EXPERIENCE[level];
}
/**
* Returns the exact level with the provided experience.
*
* @param experience
* the experience.
* @return the level at the provided experience.
*/
public static final int getLevelByExperience(int experience) {
for (int i = EXPERIENCE.length - 1; i > 0; i--) {
if (experience > EXPERIENCE[i]) {
return i;
}
}
return 1;
}
/**
* Returns the remaining experience for the provided skill to level up.
*
* @param index
* the skill index.
* @return the remaining experience.
*/
public static final int getRemainingExperience(int index) {
int level = getLevelByExperience(getCurrentExperience(index));
if (level >= 99 || level < 1) {
return 0;
}
return EXPERIENCE[(level + 1)] - getCurrentExperience(index);
}
/**
* Returns the percentage to the next level for the provided skill.
*
* @param index
* the skill index.
* @return the remaining percentage.
*/
public static final int getPercentToNextLevel(int index) {
int currentLevel = getLevelByExperience(getCurrentExperience(index));
int nextLevel = currentLevel + 1;
if (currentLevel == 99 || nextLevel > 99 || currentLevel < 1
|| nextLevel < 1) {
return 0;
}
return (int) (100f * ((float) getCurrentExperience(index) / (float) EXPERIENCE[nextLevel]));
}
}
+4 -3
View File
@@ -5,14 +5,13 @@ import org.rev317.min.api.wrappers.Tile;
import org.rev317.min.api.wrappers.TilePath;
/**
*
* @author Everel
*
*/
public class Walking {
/**
* Walks from tile to tile
*
* @param from
* @param to
*/
@@ -21,8 +20,8 @@ public class Walking {
}
/**
*
* @param tilePath
*
* @return <b>true</b> if destination reached, otherwise <b>false</b>
*/
public static boolean walkDown(TilePath tilePath) {
@@ -35,7 +34,9 @@ public class Walking {
/**
* Gets nearest reachable tile on minimap to given tile
*
* @param tile
*
* @return nearest reachable tile on minimap
*/
public static Tile getNearestTileTo(Tile tile) {
@@ -9,9 +9,7 @@ import org.rev317.min.api.methods.Menu;
import org.rev317.min.api.methods.Players;
/**
*
* @author Everel
*
*/
public class Character implements Locatable {
@@ -157,6 +155,7 @@ public class Character implements Locatable {
/**
* Gets the accessor class
*
* @return RefClass of accessor
*/
public RefClass getRefClass() {
@@ -7,9 +7,7 @@ import org.rev317.min.api.methods.Game;
import org.rev317.min.api.methods.Menu;
/**
*
* @author Everel
*
*/
public class GroundItem implements Locatable {
private org.rev317.min.accessors.Item accessor;
@@ -24,6 +22,7 @@ public class GroundItem implements Locatable {
/**
* Gets location of this ground item
*
* @return location
*/
public Tile getLocation() {
@@ -32,6 +31,7 @@ public class GroundItem implements Locatable {
/**
* Gets region X
*
* @return x
*/
public int getX() {
@@ -40,6 +40,7 @@ public class GroundItem implements Locatable {
/**
* Gets region Y
*
* @return y
*/
public int getY() {
@@ -48,6 +49,7 @@ public class GroundItem implements Locatable {
/**
* Interacts with this ground item
*
* @param actionIndex
*/
public void interact(int actionIndex) {
@@ -63,6 +65,7 @@ public class GroundItem implements Locatable {
/**
* Gets distance between you and this ground item
*
* @return distance
*/
public int distanceTo() {
@@ -71,6 +74,7 @@ public class GroundItem implements Locatable {
/**
* Get's ID of this item
*
* @return ID
*/
public int getId() {
@@ -79,6 +83,7 @@ public class GroundItem implements Locatable {
/**
* Gets the accessor class
*
* @return RefClass of accessor
*/
public RefClass getRefClass() {
+4 -2
View File
@@ -3,9 +3,7 @@ package org.rev317.min.api.wrappers;
import org.rev317.min.api.methods.Menu;
/**
*
* @author Everel
*
*/
public class Item {
private int id, stackSize;
@@ -19,6 +17,7 @@ public class Item {
/**
* Get id of this item
*
* @return id
*/
public int getId() {
@@ -27,6 +26,7 @@ public class Item {
/**
* Gets quantity of this item
*
* @return stack size
*/
public int getStackSize() {
@@ -35,6 +35,7 @@ public class Item {
/**
* Item slot
*
* @return slot
*/
public int getSlot() {
@@ -50,6 +51,7 @@ public class Item {
/**
* Interacts with this item
*
* @param i
*/
public void interact(int i) {
+2 -2
View File
@@ -3,9 +3,7 @@ package org.rev317.min.api.wrappers;
import org.parabot.core.reflect.RefClass;
/**
*
* @author Everel
*
*/
public final class Npc extends Character {
private org.rev317.min.accessors.Npc accessor;
@@ -18,6 +16,7 @@ public final class Npc extends Character {
/**
* Gets the definition of this npc
*
* @return npc definitions
*/
public final NpcDef getDef() {
@@ -26,6 +25,7 @@ public final class Npc extends Character {
/**
* Gets the accessor class
*
* @return RefClass of accessor
*/
public RefClass getRefClass() {
+2 -2
View File
@@ -3,9 +3,7 @@ package org.rev317.min.api.wrappers;
import org.parabot.core.reflect.RefClass;
/**
*
* @author Everel
*
*/
public class NpcDef {
private org.rev317.min.accessors.NpcDef accessor;
@@ -16,6 +14,7 @@ public class NpcDef {
/**
* Gets id of this item
*
* @return id of this item
*/
public int getId() {
@@ -24,6 +23,7 @@ public class NpcDef {
/**
* Gets the accessor class
*
* @return RefClass of accessor
*/
public RefClass getRefClass() {
@@ -1,9 +1,7 @@
package org.rev317.min.api.wrappers;
/**
*
* @author Everel
*
*/
public class Player extends Character {
@@ -8,9 +8,7 @@ import org.rev317.min.api.methods.Game;
import org.rev317.min.api.methods.Menu;
/**
*
* @author Everel
*
*/
public class SceneObject implements Locatable {
public static final int TYPE_WALL = 0; // object1
@@ -38,6 +36,7 @@ public class SceneObject implements Locatable {
/**
* Gets location of this tile
*
* @return location
*/
public final Tile getLocation() {
@@ -46,6 +45,7 @@ public class SceneObject implements Locatable {
/**
* Gets region X
*
* @return region X
*/
public final int getLocalRegionX() {
@@ -54,6 +54,7 @@ public class SceneObject implements Locatable {
/**
* Gets region Y
*
* @return region Y
*/
public final int getLocalRegionY() {
@@ -80,6 +81,7 @@ public class SceneObject implements Locatable {
/**
* Calculates distance to this object
*
* @return distance
*/
public final int distanceTo() {
@@ -88,6 +90,7 @@ public class SceneObject implements Locatable {
/**
* Interacts with this object
*
* @param actionIndex
*/
public void interact(int actionIndex) {
@@ -96,6 +99,7 @@ public class SceneObject implements Locatable {
/**
* Gets the accessor class
*
* @return RefClass of accessor
*/
public RefClass getRefClass() {
+7 -2
View File
@@ -8,11 +8,9 @@ import org.rev317.min.api.methods.Players;
import org.rev317.min.api.methods.Walking;
/**
*
* Class which holds a world location
*
* @author Everel
*
*/
public final class Tile implements TileFlags, Locatable {
private int x;
@@ -50,6 +48,7 @@ public final class Tile implements TileFlags, Locatable {
/**
* Gets region x
*
* @return region x
*/
public final int getRegionX() {
@@ -58,6 +57,7 @@ public final class Tile implements TileFlags, Locatable {
/**
* Gets region y
*
* @return region y
*/
public final int getRegionY() {
@@ -128,6 +128,7 @@ public final class Tile implements TileFlags, Locatable {
/**
* Determines if this tile is walkable
*
* @return <code>true</code> if this tile is walkable, otherwise <code>false</code>
*/
public boolean isWalkable() {
@@ -136,7 +137,9 @@ public final class Tile implements TileFlags, Locatable {
/**
* Determines if this tile is reachable
*
* @param isObject whether this tile is an object tile
*
* @return <code>true</code> if this tile is reachable, otherwise <code>false</code>
*/
public boolean isReachable(boolean isObject) {
@@ -146,6 +149,7 @@ public final class Tile implements TileFlags, Locatable {
/**
* Determines if this tile is reachable
*
* @return <code>true</code> if this tile is reachable, otherwise <code>false</code>
*/
public boolean isReachable() {
@@ -154,6 +158,7 @@ public final class Tile implements TileFlags, Locatable {
/**
* Determines if this tile is an object tile
*
* @return <code>true</code> if this tile is an object tile, otherwise <code>false</code>
*/
public boolean isObjectTile() {
@@ -1,9 +1,7 @@
package org.rev317.min.api.wrappers;
/**
*
* @author Everel
*
*/
public class TilePath {
+1 -3
View File
@@ -2,16 +2,14 @@ package org.rev317.min.callback;
import org.rev317.min.Loader;
import org.rev317.min.accessors.Client;
import org.rev317.min.debug.DActions;
import org.rev317.min.api.events.GameActionEvent;
import org.rev317.min.api.methods.Game;
import org.rev317.min.debug.DActions;
import org.rev317.min.script.ScriptEngine;
/**
*
* @author Everel
* @author Matt123337
*
*/
public class MenuAction {
@@ -1,7 +1,6 @@
package org.rev317.min.callback;
import org.rev317.min.api.events.MessageEvent;
import org.rev317.min.script.ScriptEngine;
+6 -6
View File
@@ -1,12 +1,16 @@
package org.rev317.min.debug;
import java.awt.Graphics;
import org.parabot.core.paint.AbstractDebugger;
import java.awt.*;
public class DActions extends AbstractDebugger {
private static boolean enabled;
public static boolean debugActions() {
return enabled;
}
@Override
public void paint(Graphics g) {
}
@@ -21,8 +25,4 @@ public class DActions extends AbstractDebugger {
enabled = !enabled;
}
public static boolean debugActions() {
return enabled;
}
}
+2 -2
View File
@@ -1,11 +1,11 @@
package org.rev317.min.debug;
import java.awt.Graphics;
import org.parabot.core.Context;
import org.parabot.core.paint.AbstractDebugger;
import org.rev317.min.api.methods.Players;
import java.awt.*;
public class DAnimation extends AbstractDebugger {
private boolean enabled;
+2 -2
View File
@@ -1,10 +1,10 @@
package org.rev317.min.debug;
import java.awt.Graphics;
import org.parabot.core.paint.AbstractDebugger;
import org.rev317.min.api.methods.Bank;
import java.awt.*;
public class DBank extends AbstractDebugger {
@Override
@@ -1,7 +1,5 @@
package org.rev317.min.debug;
import java.awt.Graphics;
import org.parabot.core.Context;
import org.parabot.core.paint.AbstractDebugger;
import org.parabot.core.paint.PaintDebugger;
@@ -9,6 +7,8 @@ import org.rev317.min.api.methods.Game;
import org.rev317.min.api.methods.Players;
import org.rev317.min.api.wrappers.Tile;
import java.awt.*;
public class DCollisionFlags extends AbstractDebugger {
private boolean enabled;
+2 -2
View File
@@ -1,11 +1,11 @@
package org.rev317.min.debug;
import java.awt.Graphics;
import org.parabot.core.paint.AbstractDebugger;
import org.rev317.min.api.methods.GroundItems;
import org.rev317.min.api.wrappers.GroundItem;
import java.awt.*;
public class DGroundItems extends AbstractDebugger {
@Override
+2 -2
View File
@@ -1,12 +1,12 @@
package org.rev317.min.debug;
import java.awt.Graphics;
import org.parabot.core.Context;
import org.parabot.core.paint.AbstractDebugger;
import org.parabot.core.paint.PaintDebugger;
import org.rev317.min.api.methods.Game;
import java.awt.*;
public class DInterfaces extends AbstractDebugger {
private boolean enabled;
+2 -2
View File
@@ -1,11 +1,11 @@
package org.rev317.min.debug;
import java.awt.Graphics;
import org.parabot.core.paint.AbstractDebugger;
import org.rev317.min.api.methods.Inventory;
import org.rev317.min.api.wrappers.Item;
import java.awt.*;
public class DInventory extends AbstractDebugger {
@Override
+2 -2
View File
@@ -1,13 +1,13 @@
package org.rev317.min.debug;
import java.awt.Graphics;
import org.parabot.core.Context;
import org.parabot.core.paint.AbstractDebugger;
import org.parabot.core.paint.PaintDebugger;
import org.rev317.min.api.methods.Game;
import org.rev317.min.api.methods.Players;
import java.awt.*;
public class DMap extends AbstractDebugger {
private boolean enabled;
+2 -2
View File
@@ -1,11 +1,11 @@
package org.rev317.min.debug;
import java.awt.Graphics;
import org.parabot.core.Context;
import org.parabot.core.paint.AbstractDebugger;
import org.parabot.environment.input.Mouse;
import java.awt.*;
public class DMouse extends AbstractDebugger {
private boolean enabled;
+2 -2
View File
@@ -1,11 +1,11 @@
package org.rev317.min.debug;
import java.awt.Graphics;
import org.parabot.core.paint.AbstractDebugger;
import org.rev317.min.api.methods.Npcs;
import org.rev317.min.api.wrappers.Npc;
import java.awt.*;
public class DNpcs extends AbstractDebugger {
@Override
+2 -2
View File
@@ -1,11 +1,11 @@
package org.rev317.min.debug;
import java.awt.Graphics;
import org.parabot.core.paint.AbstractDebugger;
import org.rev317.min.api.methods.SceneObjects;
import org.rev317.min.api.wrappers.SceneObject;
import java.awt.*;
public class DSceneObjects extends AbstractDebugger {
@Override
+9 -11
View File
@@ -1,25 +1,23 @@
package org.rev317.min.script;
import java.awt.AWTEvent;
import org.parabot.core.Context;
import org.parabot.environment.api.interfaces.Paintable;
import org.parabot.environment.scripts.Script;
import org.rev317.min.api.events.GameActionEvent;
import org.rev317.min.api.events.MessageEvent;
import org.rev317.min.api.events.listeners.GameActionListener;
import org.rev317.min.api.events.listeners.MessageListener;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.util.ArrayList;
import java.util.HashMap;
import org.parabot.core.Context;
import org.parabot.environment.api.interfaces.Paintable;
import org.parabot.environment.scripts.Script;
import org.rev317.min.api.events.MessageEvent;
import org.rev317.min.api.events.listeners.MessageListener;
import org.rev317.min.api.events.GameActionEvent;
import org.rev317.min.api.events.listeners.GameActionListener;
/**
*
* @author Everel
* @author matt123337
*
*/
public class ScriptEngine {
private static HashMap<Context, ScriptEngine> instances = new HashMap<Context, ScriptEngine>();
+5 -9
View File
@@ -1,16 +1,12 @@
package org.rev317.min.ui;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import org.rev317.min.debug.*;
import org.parabot.core.Context;
import org.parabot.core.paint.PaintDebugger;
import org.rev317.min.debug.*;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class BotMenu implements ActionListener {