mirror of
https://github.com/2006-Scape/Parabot-317-API-Minified.git
synced 2026-07-03 00:38:00 +00:00
Action 4 support
This commit is contained in:
@@ -38,6 +38,8 @@ public interface Client {
|
||||
|
||||
public int[] getMenuAction3();
|
||||
|
||||
public int[] getMenuAction4();
|
||||
|
||||
public CollisionMap[] getCollisionMap();
|
||||
|
||||
// args switched
|
||||
|
||||
@@ -64,5 +64,18 @@ public class Game {
|
||||
public static int getPlane() {
|
||||
return Loader.getClient().getPlane();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether this client has action 4 hooked
|
||||
* @return <code>true</code> if action 4 is hooked
|
||||
*/
|
||||
public static boolean hasAction4() {
|
||||
try {
|
||||
Loader.getClient().getMenuAction4();
|
||||
return true;
|
||||
} catch(AbstractMethodError e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -182,6 +182,19 @@ public class Menu {
|
||||
* @param index
|
||||
*/
|
||||
public static void sendAction(int action, int cmd1, int cmd2, int cmd3, int index) {
|
||||
sendAction(action, cmd1, cmd2, cmd3, 0, index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends an action to the client
|
||||
* @param action
|
||||
* @param cmd1
|
||||
* @param cmd2
|
||||
* @param cmd3
|
||||
* @param cmd4
|
||||
* @param index
|
||||
*/
|
||||
public static void sendAction(int action, int cmd1, int cmd2, int cmd3, int cmd4, int index) {
|
||||
if (constants == null) {
|
||||
constants = Context.getInstance().getHookParser().getConstants();
|
||||
}
|
||||
@@ -191,6 +204,9 @@ public class Menu {
|
||||
client.getMenuAction1()[index] = cmd1;
|
||||
client.getMenuAction2()[index] = cmd2;
|
||||
client.getMenuAction3()[index] = cmd3;
|
||||
if(Game.hasAction4()) {
|
||||
client.getMenuAction4()[4] = cmd4;
|
||||
}
|
||||
client.getMenuActionId()[index] = action;
|
||||
|
||||
|
||||
|
||||
@@ -3,9 +3,8 @@ 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.ActionEvent;
|
||||
|
||||
import org.rev317.min.api.methods.Game;
|
||||
import org.rev317.min.script.ScriptEngine;
|
||||
|
||||
/**
|
||||
@@ -15,18 +14,23 @@ import org.rev317.min.script.ScriptEngine;
|
||||
*
|
||||
*/
|
||||
public class MenuAction {
|
||||
|
||||
|
||||
public static void intercept(int index) {
|
||||
Client client = Loader.getClient();
|
||||
int action1 = client.getMenuAction1()[index];
|
||||
int action2 = client.getMenuAction2()[index];
|
||||
int action3 = client.getMenuAction3()[index];
|
||||
int actionId = client.getMenuActionId()[index];
|
||||
if(DActions.debugActions()) {
|
||||
System.out.println(String.format("[index: %d, action1: %d, action2: %d, action3: %d, id: %d]", index, action1, action2, action3, actionId));
|
||||
Client client = Loader.getClient();
|
||||
int action1 = client.getMenuAction1()[index];
|
||||
int action2 = client.getMenuAction2()[index];
|
||||
int action3 = client.getMenuAction3()[index];
|
||||
int actionId = client.getMenuActionId()[index];
|
||||
if (DActions.debugActions()) {
|
||||
if(Game.hasAction4()) {
|
||||
int action4 = client.getMenuAction4()[index];
|
||||
System.out.println(String.format("[index: %d, action1: %d, action2: %d, action3: %d, action4: %d, id: %d]", index, action1, action2, action3, action4, actionId));
|
||||
} else {
|
||||
System.out.println(String.format("[index: %d, action1: %d, action2: %d, action3: %d, id: %d]", index, action1, action2, action3, actionId));
|
||||
}
|
||||
}
|
||||
|
||||
final ActionEvent actionEvent = new ActionEvent(actionId,action1,action2,action3,index);
|
||||
|
||||
final ActionEvent actionEvent = new ActionEvent(actionId, action1, action2, action3, index);
|
||||
ScriptEngine.getInstance().dispatch(actionEvent);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user