mirror of
https://github.com/2006-Scape/Parabot-317-API-Minified.git
synced 2026-07-06 16:50:40 +00:00
Finishing API
This commit is contained in:
@@ -2,6 +2,7 @@ package org.rev317;
|
|||||||
|
|
||||||
import java.applet.Applet;
|
import java.applet.Applet;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
import javax.swing.JMenuBar;
|
import javax.swing.JMenuBar;
|
||||||
@@ -9,6 +10,7 @@ import javax.swing.JMenuBar;
|
|||||||
import org.parabot.core.Context;
|
import org.parabot.core.Context;
|
||||||
import org.parabot.core.asm.ASMClassLoader;
|
import org.parabot.core.asm.ASMClassLoader;
|
||||||
import org.parabot.core.asm.adapters.AddInterfaceAdapter;
|
import org.parabot.core.asm.adapters.AddInterfaceAdapter;
|
||||||
|
import org.parabot.core.asm.hooks.HookFile;
|
||||||
import org.parabot.environment.scripts.Script;
|
import org.parabot.environment.scripts.Script;
|
||||||
import org.parabot.environment.servers.ServerManifest;
|
import org.parabot.environment.servers.ServerManifest;
|
||||||
import org.parabot.environment.servers.ServerProvider;
|
import org.parabot.environment.servers.ServerProvider;
|
||||||
@@ -31,7 +33,7 @@ public class Loader extends ServerProvider {
|
|||||||
try {
|
try {
|
||||||
final Context context = Context.getInstance();
|
final Context context = Context.getInstance();
|
||||||
final ASMClassLoader classLoader = context.getASMClassLoader();
|
final ASMClassLoader classLoader = context.getASMClassLoader();
|
||||||
final Class<?> clientClass = classLoader.loadClass("client");
|
final Class<?> clientClass = classLoader.loadClass("Client");
|
||||||
Object instance = clientClass.newInstance();
|
Object instance = clientClass.newInstance();
|
||||||
applet = (Applet) instance;
|
applet = (Applet) instance;
|
||||||
return applet;
|
return applet;
|
||||||
@@ -73,6 +75,16 @@ public class Loader extends ServerProvider {
|
|||||||
ScriptEngine.getInstance().init();
|
ScriptEngine.getInstance().init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HookFile getHookFile() {
|
||||||
|
try {
|
||||||
|
return new HookFile(new URL("http://bot.parabot.org/hooks/317api_hooks_min.xml"), HookFile.TYPE_XML);
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public void unloadScript(Script script) {
|
public void unloadScript(Script script) {
|
||||||
ScriptEngine.getInstance().unload();
|
ScriptEngine.getInstance().unload();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,14 @@ public interface Client {
|
|||||||
|
|
||||||
public int getPlane();
|
public int getPlane();
|
||||||
|
|
||||||
|
public int[] getMenuActionId();
|
||||||
|
|
||||||
|
public int[] getMenuAction1();
|
||||||
|
|
||||||
|
public int[] getMenuAction2();
|
||||||
|
|
||||||
|
public int[] getMenuAction3();
|
||||||
|
|
||||||
public CollisionMap[] getCollisionMap();
|
public CollisionMap[] getCollisionMap();
|
||||||
|
|
||||||
// args switched
|
// args switched
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public class GroundItems {
|
|||||||
if (client == null) {
|
if (client == null) {
|
||||||
client = Loader.getClient();
|
client = Loader.getClient();
|
||||||
}
|
}
|
||||||
final Deque deque = client.getGroundItems()[0][x][y];
|
final Deque deque = client.getGroundItems()[Game.getPlane()][x][y];
|
||||||
if (deque == null) {
|
if (deque == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -177,7 +177,11 @@ public class Menu {
|
|||||||
int index = 0;
|
int index = 0;
|
||||||
Client client = Loader.getClient();
|
Client client = Loader.getClient();
|
||||||
|
|
||||||
// TODO : set action
|
client.getMenuAction1()[index] = cmd1;
|
||||||
|
client.getMenuAction2()[index] = cmd2;
|
||||||
|
client.getMenuAction3()[index] = cmd3;
|
||||||
|
client.getMenuActionId()[index] = action;
|
||||||
|
|
||||||
|
|
||||||
client.doAction(index);
|
client.doAction(index);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ public class SceneObjects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static SceneObject getSceneObjectAtTile(int x, int y, boolean useCached) {
|
private static SceneObject getSceneObjectAtTile(int x, int y, boolean useCached) {
|
||||||
Ground sceneTile = Loader.getClient().getScene().getGroundArray()[0][x][y];
|
Ground sceneTile = Loader.getClient().getScene().getGroundArray()[Game.getPlane()][x][y];
|
||||||
if(sceneTile == null) {
|
if(sceneTile == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -168,7 +168,7 @@ public class SceneObjects {
|
|||||||
* @return array of sceneobjects, or null if there aren't any
|
* @return array of sceneobjects, or null if there aren't any
|
||||||
*/
|
*/
|
||||||
public static final Collection<SceneObject> getSceneObjectsAtTile(int x, int y, boolean useCached) {
|
public static final Collection<SceneObject> getSceneObjectsAtTile(int x, int y, boolean useCached) {
|
||||||
Ground sceneTile = Loader.getClient().getScene().getGroundArray()[0][x][y];
|
Ground sceneTile = Loader.getClient().getScene().getGroundArray()[Game.getPlane()][x][y];
|
||||||
ArrayList<SceneObject> sceneObjects = null;
|
ArrayList<SceneObject> sceneObjects = null;
|
||||||
final SceneObjectTile[] interactiveObjects = sceneTile.getInteractiveObjects();
|
final SceneObjectTile[] interactiveObjects = sceneTile.getInteractiveObjects();
|
||||||
if(interactiveObjects != null) {
|
if(interactiveObjects != null) {
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ public class Character implements Locatable {
|
|||||||
private int index;
|
private int index;
|
||||||
|
|
||||||
public Character(org.rev317.accessors.Character accessor, int index) {
|
public Character(org.rev317.accessors.Character accessor, int index) {
|
||||||
|
this.accessor = accessor;
|
||||||
this.index = index;
|
this.index = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,8 +65,7 @@ public class SceneObject implements Locatable {
|
|||||||
* @return object id
|
* @return object id
|
||||||
*/
|
*/
|
||||||
public final int getId() {
|
public final int getId() {
|
||||||
// TODO
|
return accessor.getHash() >> 14 & 0x7FFF;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,10 +1,25 @@
|
|||||||
package org.rev317.callback;
|
package org.rev317.callback;
|
||||||
|
|
||||||
|
import org.rev317.Loader;
|
||||||
|
import org.rev317.accessors.Client;
|
||||||
|
import org.rev317.debug.DActions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class MenuAction {
|
public class MenuAction {
|
||||||
|
|
||||||
|
public static void intercept(int index) {
|
||||||
|
if(DActions.debugActions()) {
|
||||||
|
Client client = Loader.getClient();
|
||||||
|
int action1 = client.getMenuAction1()[index];
|
||||||
|
int action2 = client.getMenuAction2()[index];
|
||||||
|
int action3 = client.getMenuAction3()[index];
|
||||||
|
int actionId = client.getMenuActionId()[index];
|
||||||
|
System.out.println(String.format("[index: %d, action1: %d, action2: %d, action3: %d, id: %d]", index, action1, action2, action3, actionId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user