mirror of
https://github.com/2006-Scape/Parabot-317-API-Minified.git
synced 2026-07-03 00:38:00 +00:00
Finishing API
This commit is contained in:
@@ -2,6 +2,7 @@ package org.rev317;
|
||||
|
||||
import java.applet.Applet;
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
import javax.swing.JMenuBar;
|
||||
@@ -9,6 +10,7 @@ import javax.swing.JMenuBar;
|
||||
import org.parabot.core.Context;
|
||||
import org.parabot.core.asm.ASMClassLoader;
|
||||
import org.parabot.core.asm.adapters.AddInterfaceAdapter;
|
||||
import org.parabot.core.asm.hooks.HookFile;
|
||||
import org.parabot.environment.scripts.Script;
|
||||
import org.parabot.environment.servers.ServerManifest;
|
||||
import org.parabot.environment.servers.ServerProvider;
|
||||
@@ -31,7 +33,7 @@ public class Loader extends ServerProvider {
|
||||
try {
|
||||
final Context context = Context.getInstance();
|
||||
final ASMClassLoader classLoader = context.getASMClassLoader();
|
||||
final Class<?> clientClass = classLoader.loadClass("client");
|
||||
final Class<?> clientClass = classLoader.loadClass("Client");
|
||||
Object instance = clientClass.newInstance();
|
||||
applet = (Applet) instance;
|
||||
return applet;
|
||||
@@ -73,6 +75,16 @@ public class Loader extends ServerProvider {
|
||||
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) {
|
||||
ScriptEngine.getInstance().unload();
|
||||
}
|
||||
|
||||
@@ -30,6 +30,14 @@ public interface Client {
|
||||
|
||||
public int getPlane();
|
||||
|
||||
public int[] getMenuActionId();
|
||||
|
||||
public int[] getMenuAction1();
|
||||
|
||||
public int[] getMenuAction2();
|
||||
|
||||
public int[] getMenuAction3();
|
||||
|
||||
public CollisionMap[] getCollisionMap();
|
||||
|
||||
// args switched
|
||||
|
||||
@@ -77,7 +77,7 @@ public class GroundItems {
|
||||
if (client == null) {
|
||||
client = Loader.getClient();
|
||||
}
|
||||
final Deque deque = client.getGroundItems()[0][x][y];
|
||||
final Deque deque = client.getGroundItems()[Game.getPlane()][x][y];
|
||||
if (deque == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -177,7 +177,11 @@ public class Menu {
|
||||
int index = 0;
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ public class SceneObjects {
|
||||
}
|
||||
|
||||
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) {
|
||||
return null;
|
||||
}
|
||||
@@ -168,7 +168,7 @@ public class SceneObjects {
|
||||
* @return array of sceneobjects, or null if there aren't any
|
||||
*/
|
||||
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;
|
||||
final SceneObjectTile[] interactiveObjects = sceneTile.getInteractiveObjects();
|
||||
if(interactiveObjects != null) {
|
||||
|
||||
@@ -18,6 +18,7 @@ public class Character implements Locatable {
|
||||
private int index;
|
||||
|
||||
public Character(org.rev317.accessors.Character accessor, int index) {
|
||||
this.accessor = accessor;
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,8 +65,7 @@ public class SceneObject implements Locatable {
|
||||
* @return object id
|
||||
*/
|
||||
public final int getId() {
|
||||
// TODO
|
||||
return -1;
|
||||
return accessor.getHash() >> 14 & 0x7FFF;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,10 +1,25 @@
|
||||
package org.rev317.callback;
|
||||
|
||||
import org.rev317.Loader;
|
||||
import org.rev317.accessors.Client;
|
||||
import org.rev317.debug.DActions;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Everel
|
||||
*
|
||||
*/
|
||||
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