mirror of
https://github.com/2006-Scape/Parabot-317-API-Minified.git
synced 2026-07-03 08:39:09 +00:00
Split objects debug up into all & each of the 5 types
This commit is contained in:
@@ -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 GameObjects 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].getHash() +
|
||||
" 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;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user