Merge branch 'development' into PBLord-mapfix

This commit is contained in:
Jeroen Ketelaar
2019-04-09 15:34:42 -05:00
committed by GitHub
17 changed files with 537 additions and 106 deletions
+2 -2
View File
@@ -51,7 +51,7 @@ deploy:
branch: branch:
- master - master
- development - development
jdk: 'oraclejdk7' jdk: 'openjdk7'
- provider: script - provider: script
script: "cp ./.travis/.travis.settings.xml $HOME/.m2/settings.xml && mvn package javadoc:javadoc deploy site:deploy" script: "cp ./.travis/.travis.settings.xml $HOME/.m2/settings.xml && mvn package javadoc:javadoc deploy site:deploy"
@@ -60,4 +60,4 @@ deploy:
repo: Parabot/Parabot-317-API-Minified repo: Parabot/Parabot-317-API-Minified
branch: branch:
- master - master
jdk: 'oraclejdk7' jdk: 'openjdk7'
@@ -160,14 +160,14 @@ public class Npcs {
SECOND(Settings.getActionByName("menu_character_second_interaction")), SECOND(Settings.getActionByName("menu_character_second_interaction")),
TALK_TO(Settings.getActionByName("menu_character_second_interaction")), TALK_TO(Settings.getActionByName("menu_character_second_interaction")),
INTERACT(Settings.getActionByName("menu_character_second_interaction")), INTERACT(Settings.getActionByName("menu_character_second_interaction")),
BAIT(Settings.getActionByName("menu_character_second_interaction")),
CAGE(Settings.getActionByName("menu_character_second_interaction")),
NET(Settings.getActionByName("menu_character_second_interaction")), NET(Settings.getActionByName("menu_character_second_interaction")),
CAGE(Settings.getActionByName("menu_character_second_interaction")),
THIRD(Settings.getActionByName("menu_character_third_interaction")), THIRD(Settings.getActionByName("menu_character_third_interaction")),
TRADE(Settings.getActionByName("menu_character_third_interaction")), TRADE(Settings.getActionByName("menu_character_third_interaction")),
BANK(Settings.getActionByName("menu_character_third_interaction")), BANK(Settings.getActionByName("menu_character_third_interaction")),
PICKPOCKET(Settings.getActionByName("menu_character_third_interaction")), PICKPOCKET(Settings.getActionByName("menu_character_third_interaction")),
BAIT(Settings.getActionByName("menu_character_third_interaction")),
HARPOON(Settings.getActionByName("menu_character_third_interaction")), HARPOON(Settings.getActionByName("menu_character_third_interaction")),
GET_TASK(Settings.getActionByName("menu_character_third_interaction")), GET_TASK(Settings.getActionByName("menu_character_third_interaction")),
@@ -4,75 +4,69 @@ package org.rev317.min.api.methods.utils;
* @author EmmaStone * @author EmmaStone
*/ */
public enum Settings { public enum Settings {
BANK_INTERFACE_ID("bank_interface_id", 5292), BANK_INTERFACE_ID(5292),
ITEM_INTERFACE_ID("item_interface_id", 5382), ITEM_INTERFACE_ID(5382),
BUTTON_CLOSE_BANK("button_close_bank", 5384), BUTTON_CLOSE_BANK(5384),
BUTTON_DEPOSIT_ALL("button_deposit_all", 5386), BUTTON_DEPOSIT_ALL(5386),
BUTTON_ACTION_CLICK("button_deposit_all", 646), BUTTON_ACTION_CLICK(646),
BUTTON_DROP_ITEM("button_drop_item", 847), BUTTON_DROP_ITEM(847),
BUTTON_TAKE_ITEM("button_take_item", 234), BUTTON_TAKE_ITEM(234),
INVENTORY_PARENT_ID("inventory_parent_id", 5064), INVENTORY_PARENT_ID(5064),
BANK_OPEN_ID("bank_open_index", 1), BANK_OPEN_ID(1),
INVENTORY_INDEX("inventory_index", 3214), INVENTORY_INDEX(3214),
MY_OFFER_INTERFACE_ID("my_offer_interface_id", 3415), MY_OFFER_INTERFACE_ID(3415),
OPPONENT_OFFER_INTERFACE_ID("opponent_offer_interface_id", 3416), OPPONENT_OFFER_INTERFACE_ID(3416),
FIRST_TRADE_INTERFACE_ID("first_trade_interface_id", 3323), FIRST_TRADE_INTERFACE_ID(3323),
SECOND_TRADE_INTERFACE_ID("second_trade_interface_id", 3443), SECOND_TRADE_INTERFACE_ID(3443),
MENU_SCENE_OBJECT_FIRST_INTERACTION("menu_scene_object_first_interaction", 502), MENU_SCENE_OBJECT_FIRST_INTERACTION(502),
MENU_SCENE_OBJECT_SECOND_INTERACTION("menu_scene_object_second_interaction", 900), MENU_SCENE_OBJECT_SECOND_INTERACTION(900),
MENU_SCENE_OBJECT_THIRD_INTERACTION("menu_scene_object_third_interaction", 113), MENU_SCENE_OBJECT_THIRD_INTERACTION(113),
MENU_SCENE_OBJECT_FOURTH_INTERACTION("menu_scene_object_fourth_interaction", 872), MENU_SCENE_OBJECT_FOURTH_INTERACTION(872),
MENU_SCENE_OBJECT_FIFTH_INTERACTION("menu_scene_object_fifth_interaction", 1062), MENU_SCENE_OBJECT_FIFTH_INTERACTION(1062),
MENU_SCENE_OBJECT_EXAMINE("menu_scene_object_examine", 1226), MENU_SCENE_OBJECT_EXAMINE(1226),
MENU_CHARACTER_FOLLOW("menu_character_follow", 2779), MENU_CHARACTER_FOLLOW(2779),
MENU_CHARACTER_TRADE("menu_character_trade", 2027), MENU_CHARACTER_TRADE(2027),
MENU_CHARACTER_ATTACK("menu_character_attack", 2561), MENU_CHARACTER_ATTACK(2561),
MENU_CHARACTER_FIRST_INTERACTION("menu_character_first_interaction", 412), MENU_CHARACTER_FIRST_INTERACTION(412),
MENU_CHARACTER_SECOND_INTERACTION("menu_character_second_interaction", 20), MENU_CHARACTER_SECOND_INTERACTION(20),
MENU_CHARACTER_THIRD_INTERACTION("menu_character_third_interaction", 225), MENU_CHARACTER_THIRD_INTERACTION(225),
MENU_CHARACTER_FOURTH_INTERACTION("menu_character_fourth_interaction", 965), MENU_CHARACTER_FOURTH_INTERACTION(965),
MENU_CHARACTER_FIFTH_INTERACTION("menu_character_fifth_interaction", 478), MENU_CHARACTER_FIFTH_INTERACTION(478),
MENU_CHARACTER_EXAMINE("menu_character_examine", 1025), MENU_CHARACTER_EXAMINE(1025),
MENU_TRANSFORM_ONE_INTERACTION("menu_transform_one_interaction", 632), MENU_TRANSFORM_ONE_INTERACTION(632),
MENU_TRANSFORM_FIVE_INTERACTION("menu_transform_five_interaction", 78), MENU_TRANSFORM_FIVE_INTERACTION(78),
MENU_TRANSFORM_TEN_INTERACTION("menu_transform_ten_interaction", 867), MENU_TRANSFORM_TEN_INTERACTION(867),
MENU_TRANSFORM_ALL_INTERACTION("menu_transform_all_interaction", 431), MENU_TRANSFORM_ALL_INTERACTION(431),
MENU_TRANSFORM_X_INTERACTION("menu_transform_x_interaction", 53), MENU_TRANSFORM_X_INTERACTION(53),
MENU_TRANSFORM_ALL_BUT_ONE_INTERACTION("menu_transform_all_but_one_interaction", 775), MENU_TRANSFORM_ALL_BUT_ONE_INTERACTION(775),
MENU_TRANSFORM_EXAMINE_INTERACTION("menu_transform_examine_interaction", 1125), MENU_TRANSFORM_EXAMINE_INTERACTION(1125),
MENU_GROUND_ITEM_FIRST_INTERACTION("menu_ground_item_first_interaction", 652), MENU_GROUND_ITEM_FIRST_INTERACTION(652),
MENU_GROUND_ITEM_SECOND_INTERACTION("menu_ground_item_second_interaction", 567), MENU_GROUND_ITEM_SECOND_INTERACTION(567),
MENU_GROUND_ITEM_THIRD_INTERACTION("menu_ground_item_third_interaction", 234), MENU_GROUND_ITEM_THIRD_INTERACTION(234),
MENU_GROUND_ITEM_FOURTH_INTERACTION("menu_ground_item_fourth_interaction", 244), MENU_GROUND_ITEM_FOURTH_INTERACTION(244),
MENU_GROUND_ITEM_FIFTH_INTERACTION("menu_ground_item_fifth_interaction", 213), MENU_GROUND_ITEM_FIFTH_INTERACTION(213),
MENU_GROUND_ITEM_EXAMINE_INTERACTION("menu_ground_item_examine_interaction", 1448), MENU_GROUND_ITEM_EXAMINE_INTERACTION(1448),
MENU_ITEM_FIRST_INTERACTION("menu_item_first_interaction", 454), MENU_ITEM_FIRST_INTERACTION(454),
MENU_ITEM_SECOND_INTERACTION("menu_item_second_interaction", 74), MENU_ITEM_SECOND_INTERACTION(74),
MENU_ITEM_THIRD_INTERACTION("menu_item_third_interaction", 447), MENU_ITEM_THIRD_INTERACTION(447),
MENU_ITEM_FOURTH_INTERACTION("menu_item_fourth_interaction", 493), MENU_ITEM_FOURTH_INTERACTION(493),
MENU_ITEM_FIFTH_INTERACTION("menu_item_fifth_interaction", 847), MENU_ITEM_FIFTH_INTERACTION(847),
MENU_ITEM_SIXTH_INTERACTION("menu_item_sixth_interaction", 1125), MENU_ITEM_SIXTH_INTERACTION(1125),
MENU_ITEM_SEVENTH_INTERACTION("menu_item_seventh_interaction", 870); MENU_ITEM_SEVENTH_INTERACTION(870);
private String name;
private int id; private int id;
Settings(String name, int id) { Settings(int id) {
this.name = name;
this.id = id; this.id = id;
} }
public String getName() {
return name;
}
public int getId() { public int getId() {
return id; return id;
} }
public static int getActionByName(String name) { public static int getActionByName(String name) {
for (Settings settings : Settings.values()) { for (Settings settings : Settings.values()) {
if (name.equalsIgnoreCase(settings.getName())) { if (name.equalsIgnoreCase(settings.toString())) {
return settings.getId(); return settings.getId();
} }
} }
@@ -1,6 +1,8 @@
package org.rev317.min.api.wrappers; package org.rev317.min.api.wrappers;
import org.parabot.core.Context;
import org.parabot.core.reflect.RefClass; import org.parabot.core.reflect.RefClass;
import org.parabot.core.reflect.RefMethod;
import org.rev317.min.accessors.SceneObjectTile; import org.rev317.min.accessors.SceneObjectTile;
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;
@@ -35,6 +37,27 @@ public class SceneObject implements Locatable {
return accessor.getHash(); return accessor.getHash();
} }
/**
* Resolves the hash depending on the API's inner SceneObjectTile getHash() methods' type.
* <br>This is strictly to be used only by Debug classes such as {@code DSceneObjects} due to the overhead of Reflection.
* In cases of high usage, classes should be duplicated as usual in a custom API with the required changed type.
* @return An object, casted to either Long or Int
*/
public final Object resolveHash() {
Object hash = (int) 0;
try {
RefMethod hashMethod = new RefClass(Context.getInstance().getASMClassLoader().loadClass("org.rev317.min.accessors.SceneObjectTile"), accessor).getMethod("getHash");
if (hashMethod.getReturnType() == int.class) {
hash = (int) hashMethod.invoke();
} else {
hash = (long) hashMethod.invoke();
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
return hash;
}
/** /**
* Gets location of this tile * Gets location of this tile
* *
@@ -25,7 +25,6 @@ public class MenuAction {
private static int currentOutputIndex = 0; private static int currentOutputIndex = 0;
public static void intercept(int index) { public static void intercept(int index) {
int outputIndex = 0;
Client client = Loader.getClient(); Client client = Loader.getClient();
int action1 = client.getMenuAction1()[index]; int action1 = client.getMenuAction1()[index];
@@ -36,9 +35,9 @@ public class MenuAction {
if (DActions.debugActions()) { if (DActions.debugActions()) {
if (Game.hasAction4()) { if (Game.hasAction4()) {
action4 = client.getMenuAction4()[index]; action4 = client.getMenuAction4()[index];
System.out.println(String.format(outputs[0][outputIndex], index, action1, action2, action3, action4, actionId)); System.out.println(String.format(outputs[0][currentOutputIndex], index, action1, action2, action3, action4, actionId));
} else { } else {
System.out.println(String.format(outputs[1][outputIndex], index, action1, action2, action3, actionId)); System.out.println(String.format(outputs[1][currentOutputIndex], index, action1, action2, action3, actionId));
} }
} }
+12 -1
View File
@@ -1,6 +1,7 @@
package org.rev317.min.debug; package org.rev317.min.debug;
import org.parabot.core.paint.AbstractDebugger; import org.parabot.core.paint.AbstractDebugger;
import org.parabot.core.ui.Logger;
import org.rev317.min.api.methods.Bank; import org.rev317.min.api.methods.Bank;
import org.rev317.min.api.wrappers.Item; import org.rev317.min.api.wrappers.Item;
@@ -8,19 +9,28 @@ import java.awt.*;
public class DBank extends AbstractDebugger { public class DBank extends AbstractDebugger {
private boolean enabled;
@Override @Override
public void paint(Graphics g) { public void paint(Graphics g) {
if (!Bank.isOpen()) {
return;
}
} }
@Override @Override
public boolean isEnabled() { public boolean isEnabled() {
return false; return enabled;
} }
@Override @Override
public void toggle() { public void toggle() {
enabled = !enabled;
if (enabled) {
if (!Bank.isOpen()) { if (!Bank.isOpen()) {
Logger.addMessage("The bank is not open, cannot debug.");
return; return;
} }
@@ -33,4 +43,5 @@ public class DBank extends AbstractDebugger {
} }
} }
} }
}
} }
@@ -1,31 +1,43 @@
package org.rev317.min.debug; package org.rev317.min.debug;
import org.parabot.core.Context;
import org.parabot.core.paint.AbstractDebugger; import org.parabot.core.paint.AbstractDebugger;
import org.parabot.core.paint.PaintDebugger;
import org.parabot.core.ui.Logger;
import org.rev317.min.api.methods.GroundItems; import org.rev317.min.api.methods.GroundItems;
import org.rev317.min.api.methods.Interfaces;
import org.rev317.min.api.wrappers.GroundItem; import org.rev317.min.api.wrappers.GroundItem;
import java.awt.*; import java.awt.*;
public class DGroundItems extends AbstractDebugger { public class DGroundItems extends AbstractDebugger {
private boolean enabled;
@Override @Override
public void paint(Graphics g) { public void paint(Graphics g) {
PaintDebugger p = Context.getInstance().getPaintDebugger();
p.addLine("Close Ground Items: " + GroundItems.getGroundItems().length);
} }
@Override @Override
public boolean isEnabled() { public boolean isEnabled() {
return false; return enabled;
} }
@Override @Override
public void toggle() { public void toggle() {
enabled = !enabled;
if (enabled) {
GroundItem[] items = GroundItems.getNearest(); GroundItem[] items = GroundItems.getNearest();
if (items == null || items.length == 0) { if (items == null || items.length == 0) {
Logger.addMessage("There are no Ground Items close to you.");
return; return;
} }
for (GroundItem item : items) { for (GroundItem item : items) {
System.out.println("ID: " + item.getId() + " Location: " + item.getLocation()); System.out.println("ID: " + item.getId() + " Location: " + item.getLocation());
} }
} }
}
} }
+16 -2
View File
@@ -1,27 +1,41 @@
package org.rev317.min.debug; package org.rev317.min.debug;
import org.parabot.core.Context;
import org.parabot.core.paint.AbstractDebugger; import org.parabot.core.paint.AbstractDebugger;
import org.parabot.core.paint.PaintDebugger;
import org.parabot.core.ui.Logger;
import org.rev317.min.api.methods.Npcs; import org.rev317.min.api.methods.Npcs;
import org.rev317.min.api.methods.Players;
import org.rev317.min.api.wrappers.Npc; import org.rev317.min.api.wrappers.Npc;
import java.awt.*; import java.awt.*;
public class DNpcs extends AbstractDebugger { public class DNpcs extends AbstractDebugger {
private boolean enabled;
@Override @Override
public void paint(Graphics g) { public void paint(Graphics g) {
PaintDebugger p = Context.getInstance().getPaintDebugger();
p.addLine("Close NPCs: " + Npcs.getNearest().length);
} }
@Override @Override
public boolean isEnabled() { public boolean isEnabled() {
return false; return enabled;
} }
@Override @Override
public void toggle() { public void toggle() {
enabled = !enabled;
if (enabled) {
if (Npcs.getNearest().length == 0) {
Logger.addMessage("There are no NPCs close to you.");
return;
}
for (Npc n : Npcs.getNearest()) { for (Npc n : Npcs.getNearest()) {
System.out.println("ID: " + n.getDef().getId() + " Distance: " + n.distanceTo() + " Location: " + n.getLocation().toString()); System.out.println("ID: " + n.getDef().getId() + " Distance: " + n.distanceTo() + " Location: " + n.getLocation().toString());
} }
} }
}
} }
@@ -1,6 +1,10 @@
package org.rev317.min.debug; package org.rev317.min.debug;
import org.parabot.core.Context;
import org.parabot.core.paint.AbstractDebugger; import org.parabot.core.paint.AbstractDebugger;
import org.parabot.core.paint.PaintDebugger;
import org.parabot.core.ui.Logger;
import org.rev317.min.api.methods.GroundItems;
import org.rev317.min.api.methods.Players; import org.rev317.min.api.methods.Players;
import org.rev317.min.api.wrappers.Player; import org.rev317.min.api.wrappers.Player;
@@ -10,19 +14,31 @@ import java.awt.*;
* @author JKetelaar * @author JKetelaar
*/ */
public class DPlayers extends AbstractDebugger { public class DPlayers extends AbstractDebugger {
private boolean enabled = false;
@Override @Override
public void toggle() { public void toggle() {
enabled = !enabled;
if (enabled) {
if (Players.getNearest().length == 0) {
Logger.addMessage("There are no Players close to you.");
return;
}
for (Player player : Players.getNearest()) { for (Player player : Players.getNearest()) {
System.out.println("Username: " + player.getName() + " Index: " + player.getIndex() + " Distance: " + player.distanceTo() + " Location: " + player.getLocation().toString()); System.out.println("Username: " + player.getName() + " Index: " + player.getIndex() + " Distance: " + player.distanceTo() + " Location: " + player.getLocation().toString());
} }
} }
}
@Override @Override
public boolean isEnabled() { public boolean isEnabled() {
return false; return enabled;
} }
@Override @Override
public void paint(Graphics graphics) { public void paint(Graphics graphics) {
PaintDebugger p = Context.getInstance().getPaintDebugger();
p.addLine("Close Players: " + Players.getNearest().length);
} }
} }
@@ -1,26 +1,46 @@
package org.rev317.min.debug; package org.rev317.min.debug;
import org.parabot.core.Context;
import org.parabot.core.paint.AbstractDebugger; import org.parabot.core.paint.AbstractDebugger;
import org.parabot.core.paint.PaintDebugger;
import org.parabot.core.ui.Logger;
import org.rev317.min.api.methods.GroundItems;
import org.rev317.min.api.methods.SceneObjects; import org.rev317.min.api.methods.SceneObjects;
import org.rev317.min.api.wrappers.SceneObject; import org.rev317.min.api.wrappers.SceneObject;
import java.awt.*; import java.awt.*;
import java.util.Comparator;
public class DSceneObjects extends AbstractDebugger { public class DSceneObjects extends AbstractDebugger {
private boolean enabled;
public static final Comparator<SceneObject> SCENE_OBJECT_COMPARATOR_DISTANCE = new Comparator<SceneObject>() {
@Override
public int compare(SceneObject o1, SceneObject o2) {
return o1.distanceTo() > o2.distanceTo() ? 1 : o1.distanceTo() == o2.distanceTo() ? 0 : -1;
}
};
@Override @Override
public void paint(Graphics g) { public void paint(Graphics g) {
PaintDebugger p = Context.getInstance().getPaintDebugger();
p.addLine("Close SceneObjects: " + SceneObjects.getNearest().length);
} }
@Override @Override
public boolean isEnabled() { public boolean isEnabled() {
return false; return enabled;
} }
@Override @Override
public void toggle() { public void toggle() {
enabled = !enabled;
if (enabled) {
SceneObject[] objects = SceneObjects.getNearest(); SceneObject[] objects = SceneObjects.getNearest();
if (objects == null || objects.length == 0) { if (objects == null || objects.length == 0) {
Logger.addMessage("There are no GameObjects around you.");
return; return;
} }
@@ -32,4 +52,5 @@ public class DSceneObjects extends AbstractDebugger {
" Distance: " + objects[i].distanceTo()); " Distance: " + objects[i].distanceTo());
} }
} }
}
} }
@@ -0,0 +1,62 @@
package org.rev317.min.debug;
import org.parabot.core.Context;
import org.parabot.core.paint.AbstractDebugger;
import org.parabot.core.paint.PaintDebugger;
import org.parabot.core.ui.Logger;
import org.parabot.environment.api.utils.Filter;
import org.rev317.min.api.methods.SceneObjects;
import org.rev317.min.api.wrappers.SceneObject;
import java.awt.*;
import java.util.Arrays;
import java.util.Collections;
public class DSceneObjectsGroundDec extends AbstractDebugger {
private boolean enabled;
@Override
public void paint(Graphics g) {
PaintDebugger p = Context.getInstance().getPaintDebugger();
p.addLine("Ground decorations: " + getGroundDecorations().length);
}
@Override
public boolean isEnabled() {
return enabled;
}
@Override
public void toggle() {
enabled = !enabled;
if (enabled) {
SceneObject[] objects = getGroundDecorations();
if (objects == null || objects.length == 0) {
Logger.addMessage("There are no Ground Decorations around you.");
return;
}
java.util.List<SceneObject> objs = Arrays.asList(objects);
Collections.sort(objs, DSceneObjects.SCENE_OBJECT_COMPARATOR_DISTANCE);
objects = objs.toArray(new SceneObject[0]);
for (int i = objects.length - 1; i >= 0; i--) {
System.out.println(
" ID: " + objects[i].getId() +
" UID: " + objects[i].resolveHash() +
" Location: " + objects[i].getLocation() +
" Distance: " + objects[i].distanceTo());
}
}
}
private SceneObject[] getGroundDecorations() {
return SceneObjects.getNearest(new Filter<SceneObject>() {
@Override
public boolean accept(SceneObject sceneObject) {
return sceneObject.getType() == SceneObject.TYPE_GROUNDDECORATION;
}
});
}
}
@@ -0,0 +1,62 @@
package org.rev317.min.debug;
import org.parabot.core.Context;
import org.parabot.core.paint.AbstractDebugger;
import org.parabot.core.paint.PaintDebugger;
import org.parabot.core.ui.Logger;
import org.parabot.environment.api.utils.Filter;
import org.rev317.min.api.methods.SceneObjects;
import org.rev317.min.api.wrappers.SceneObject;
import java.awt.*;
import java.util.Arrays;
import java.util.Collections;
public class DSceneObjectsGroundItems extends AbstractDebugger {
private boolean enabled;
@Override
public void paint(Graphics g) {
PaintDebugger p = Context.getInstance().getPaintDebugger();
p.addLine("Ground Items: " + getGroundItems().length);
}
@Override
public boolean isEnabled() {
return enabled;
}
@Override
public void toggle() {
enabled = !enabled;
if (enabled) {
SceneObject[] objects = getGroundItems();
if (objects == null || objects.length == 0) {
Logger.addMessage("There are no Ground Items around you.");
return;
}
java.util.List<SceneObject> objs = Arrays.asList(objects);
Collections.sort(objs, DSceneObjects.SCENE_OBJECT_COMPARATOR_DISTANCE);
objects = objs.toArray(new SceneObject[0]);
for (int i = objects.length - 1; i >= 0; i--) {
System.out.println(
" ID: " + objects[i].getId() +
" UID: " + objects[i].resolveHash() +
" Location: " + objects[i].getLocation() +
" Distance: " + objects[i].distanceTo());
}
}
}
private SceneObject[] getGroundItems() {
return SceneObjects.getSceneObjects(new Filter<SceneObject>() {
@Override
public boolean accept(SceneObject sceneObject) {
return sceneObject.getType() == SceneObject.TYPE_GROUNDITEM;
}
});
}
}
@@ -0,0 +1,65 @@
package org.rev317.min.debug;
import org.parabot.core.Context;
import org.parabot.core.paint.AbstractDebugger;
import org.parabot.core.paint.PaintDebugger;
import org.parabot.core.reflect.RefClass;
import org.parabot.core.reflect.RefMethod;
import org.parabot.core.ui.Logger;
import org.parabot.environment.api.utils.Filter;
import org.rev317.min.api.methods.SceneObjects;
import org.rev317.min.api.wrappers.SceneObject;
import java.awt.*;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
public class DSceneObjectsInteractiveObj extends AbstractDebugger {
private boolean enabled;
@Override
public void paint(Graphics g) {
PaintDebugger p = Context.getInstance().getPaintDebugger();
p.addLine("Interactive Objects: " + getInteractiveObjects().length);
}
@Override
public boolean isEnabled() {
return enabled;
}
@Override
public void toggle() {
enabled = !enabled;
if (enabled) {
SceneObject[] objects = getInteractiveObjects();
if (objects == null || objects.length == 0) {
Logger.addMessage("There are no Interactive Objects around you.");
return;
}
java.util.List<SceneObject> objs = Arrays.asList(objects);
Collections.sort(objs, DSceneObjects.SCENE_OBJECT_COMPARATOR_DISTANCE);
objects = objs.toArray(new SceneObject[0]);
for (int i = objects.length - 1; i >= 0; i--) {
System.out.println(
" ID: " + objects[i].getId() +
" UID: " + objects[i].resolveHash() +
" Location: " + objects[i].getLocation() +
" Distance: " + objects[i].distanceTo());
}
}
}
private SceneObject[] getInteractiveObjects() {
return SceneObjects.getSceneObjects(new Filter<SceneObject>() {
@Override
public boolean accept(SceneObject sceneObject) {
return sceneObject.getType() == SceneObject.TYPE_INTERACTIVE;
}
});
}
}
@@ -0,0 +1,62 @@
package org.rev317.min.debug;
import org.parabot.core.Context;
import org.parabot.core.paint.AbstractDebugger;
import org.parabot.core.paint.PaintDebugger;
import org.parabot.core.ui.Logger;
import org.parabot.environment.api.utils.Filter;
import org.rev317.min.api.methods.SceneObjects;
import org.rev317.min.api.wrappers.SceneObject;
import java.awt.*;
import java.util.Arrays;
import java.util.Collections;
public class DSceneObjectsWallDec extends AbstractDebugger {
private boolean enabled;
@Override
public void paint(Graphics g) {
PaintDebugger p = Context.getInstance().getPaintDebugger();
p.addLine("Wall decorations: " + getWallDecorations().length);
}
@Override
public boolean isEnabled() {
return enabled;
}
@Override
public void toggle() {
enabled = !enabled;
if (enabled) {
SceneObject[] objects = getWallDecorations();
if (objects == null || objects.length == 0) {
Logger.addMessage("There are no Wall Decorations around you.");
return;
}
java.util.List<SceneObject> objs = Arrays.asList(objects);
Collections.sort(objs, DSceneObjects.SCENE_OBJECT_COMPARATOR_DISTANCE);
objects = objs.toArray(new SceneObject[0]);
for (int i = objects.length - 1; i >= 0; i--) {
System.out.println(
" ID: " + objects[i].getId() +
" UID: " + objects[i].resolveHash() +
" Location: " + objects[i].getLocation() +
" Distance: " + objects[i].distanceTo());
}
}
}
private SceneObject[] getWallDecorations() {
return SceneObjects.getNearest(new Filter<SceneObject>() {
@Override
public boolean accept(SceneObject sceneObject) {
return sceneObject.getType() == SceneObject.TYPE_WALLDECORATION;
}
});
}
}
@@ -0,0 +1,62 @@
package org.rev317.min.debug;
import org.parabot.core.Context;
import org.parabot.core.paint.AbstractDebugger;
import org.parabot.core.paint.PaintDebugger;
import org.parabot.core.ui.Logger;
import org.parabot.environment.api.utils.Filter;
import org.rev317.min.api.methods.SceneObjects;
import org.rev317.min.api.wrappers.SceneObject;
import java.awt.*;
import java.util.Arrays;
import java.util.Collections;
public class DSceneObjectsWallObj extends AbstractDebugger {
private boolean enabled;
@Override
public void paint(Graphics g) {
PaintDebugger p = Context.getInstance().getPaintDebugger();
p.addLine("Wall objects: " + getWallObjects().length);
}
@Override
public boolean isEnabled() {
return enabled;
}
@Override
public void toggle() {
enabled = !enabled;
if (enabled) {
SceneObject[] objects = getWallObjects();
if (objects == null || objects.length == 0) {
Logger.addMessage("There are no Wall Objects around you.");
return;
}
java.util.List<SceneObject> objs = Arrays.asList(objects);
Collections.sort(objs, DSceneObjects.SCENE_OBJECT_COMPARATOR_DISTANCE);
objects = objs.toArray(new SceneObject[0]);
for (int i = objects.length - 1; i >= 0; i--) {
System.out.println(
" ID: " + objects[i].getId() +
" UID: " + objects[i].resolveHash() +
" Location: " + objects[i].getLocation() +
" Distance: " + objects[i].distanceTo());
}
}
}
private SceneObject[] getWallObjects() {
return SceneObjects.getNearest(new Filter<SceneObject>() {
@Override
public boolean accept(SceneObject sceneObject) {
return sceneObject.getType() == SceneObject.TYPE_WALL;
}
});
}
}
@@ -7,16 +7,21 @@ import java.awt.*;
public class DSkills extends AbstractDebugger { public class DSkills extends AbstractDebugger {
private boolean enabled;
@Override @Override
public void toggle() { public void toggle() {
for (Skill skill : Skill.values()){ enabled = !enabled;
System.out.println(String.format("%s level: %d / %d", skill.getName(), skill.getLevel(), skill.getRealLevel())); if (enabled) {
for (Skill skill : Skill.values()) {
System.out.println(String.format("%s level: %d / %d (exp: %s)", skill.getName(), skill.getLevel(), skill.getRealLevel(), skill.getExperience()));
}
} }
} }
@Override @Override
public boolean isEnabled() { public boolean isEnabled() {
return false; return enabled;
} }
@Override @Override
+25 -2
View File
@@ -32,7 +32,13 @@ public class BotMenu implements ActionListener {
JMenuItem messages = newItem("Messages"); JMenuItem messages = newItem("Messages");
JMenuItem mouse = newItem("Mouse"); JMenuItem mouse = newItem("Mouse");
JMenuItem npcs = newItem("Npcs"); JMenuItem npcs = newItem("Npcs");
JMenuItem objects = newItem("Objects"); JMenu objects = new JMenu("Objects");
JMenuItem enableAllObject = newItem("Enable All Objects");
JMenuItem groundDecorations = newItem("Ground Decorations");
JMenuItem interactiveObjects = newItem("Interactive Objects");
JMenuItem wallObjects = newItem("Wall Objects");
JMenuItem wallDecorations = newItem("Wall Decorations");
JMenuItem groundItems = newItem("Ground Items");
JMenuItem players = newItem("Players"); JMenuItem players = newItem("Players");
JMenuItem skills = newItem("Skills"); JMenuItem skills = newItem("Skills");
@@ -47,7 +53,12 @@ public class BotMenu implements ActionListener {
debugger.addDebugger("Messages", new DMessages()); debugger.addDebugger("Messages", new DMessages());
debugger.addDebugger("Mouse", new DMouse()); debugger.addDebugger("Mouse", new DMouse());
debugger.addDebugger("Npcs", new DNpcs()); debugger.addDebugger("Npcs", new DNpcs());
debugger.addDebugger("Objects", new DSceneObjects()); debugger.addDebugger("Enable All Objects", new DSceneObjects());
debugger.addDebugger("Ground Decorations", new DSceneObjectsGroundDec());
debugger.addDebugger("Interactive Objects", new DSceneObjectsInteractiveObj());
debugger.addDebugger("Wall Objects", new DSceneObjectsWallObj());
debugger.addDebugger("Wall Decorations", new DSceneObjectsWallDec());
debugger.addDebugger("Ground Items", new DSceneObjectsGroundItems());
debugger.addDebugger("Players", new DPlayers()); debugger.addDebugger("Players", new DPlayers());
debugger.addDebugger("Skills", new DSkills()); debugger.addDebugger("Skills", new DSkills());
@@ -64,6 +75,13 @@ public class BotMenu implements ActionListener {
debug.add(mouse); debug.add(mouse);
debug.add(npcs); debug.add(npcs);
debug.add(objects); debug.add(objects);
objects.add(enableAllObject);
objects.addSeparator();
objects.add(groundDecorations);
objects.add(groundItems);
objects.add(wallDecorations);
objects.add(wallObjects);
objects.add(interactiveObjects);
debug.add(players); debug.add(players);
debug.add(skills); debug.add(skills);
@@ -81,6 +99,11 @@ public class BotMenu implements ActionListener {
} }
}); });
group.add(debugOutput); group.add(debugOutput);
if (index == 0) {
group.setSelected(debugOutput.getModel(), true);
}
actions.add(debugOutput); actions.add(debugOutput);
} }