mirror of
https://github.com/2006-Scape/Parabot-317-API-Minified.git
synced 2026-07-07 08:39:13 +00:00
ActionListener > GameActionListener (avoid import conflicts)
ActionEvent > GameActionEvent GameActionEvent added cmd4 field
This commit is contained in:
@@ -1,35 +0,0 @@
|
|||||||
package org.rev317.min.api.events;
|
|
||||||
|
|
||||||
public final class ActionEvent{
|
|
||||||
private int index,cmd1,cmd2,cmd3,action;
|
|
||||||
|
|
||||||
public ActionEvent(int action,int cmd1,int cmd2, int cmd3,int index){
|
|
||||||
this.action = action;
|
|
||||||
this.cmd1 = cmd1;
|
|
||||||
this.cmd2 = cmd2;
|
|
||||||
this.cmd3 = cmd3;
|
|
||||||
this.index = index;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCmd1(){
|
|
||||||
return cmd1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCmd2(){
|
|
||||||
return cmd2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCmd3(){
|
|
||||||
return cmd3;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getAction(){
|
|
||||||
return action;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getIndex(){
|
|
||||||
return index;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package org.rev317.min.api.events;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Matt, Everel
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public final class GameActionEvent {
|
||||||
|
private int index, cmd1, cmd2, cmd3, cmd4, action;
|
||||||
|
|
||||||
|
public GameActionEvent(int action, int cmd1, int cmd2, int cmd3, int cmd4, int index) {
|
||||||
|
this.action = action;
|
||||||
|
this.cmd1 = cmd1;
|
||||||
|
this.cmd2 = cmd2;
|
||||||
|
this.cmd3 = cmd3;
|
||||||
|
this.cmd4 = cmd4;
|
||||||
|
this.index = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCmd1() {
|
||||||
|
return cmd1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCmd2() {
|
||||||
|
return cmd2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCmd3() {
|
||||||
|
return cmd3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCmd4() {
|
||||||
|
return cmd4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAction() {
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIndex() {
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package org.rev317.min.api.events.listeners;
|
|
||||||
|
|
||||||
import org.rev317.min.api.events.ActionEvent;
|
|
||||||
|
|
||||||
public interface ActionListener{
|
|
||||||
|
|
||||||
public void onGameAction(ActionEvent event);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package org.rev317.min.api.events.listeners;
|
||||||
|
|
||||||
|
import org.rev317.min.api.events.GameActionEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Matt
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface GameActionListener {
|
||||||
|
|
||||||
|
public void onGameAction(GameActionEvent event);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@ package org.rev317.min.callback;
|
|||||||
import org.rev317.min.Loader;
|
import org.rev317.min.Loader;
|
||||||
import org.rev317.min.accessors.Client;
|
import org.rev317.min.accessors.Client;
|
||||||
import org.rev317.min.debug.DActions;
|
import org.rev317.min.debug.DActions;
|
||||||
import org.rev317.min.api.events.ActionEvent;
|
import org.rev317.min.api.events.GameActionEvent;
|
||||||
import org.rev317.min.api.methods.Game;
|
import org.rev317.min.api.methods.Game;
|
||||||
import org.rev317.min.script.ScriptEngine;
|
import org.rev317.min.script.ScriptEngine;
|
||||||
|
|
||||||
@@ -20,17 +20,18 @@ public class MenuAction {
|
|||||||
int action1 = client.getMenuAction1()[index];
|
int action1 = client.getMenuAction1()[index];
|
||||||
int action2 = client.getMenuAction2()[index];
|
int action2 = client.getMenuAction2()[index];
|
||||||
int action3 = client.getMenuAction3()[index];
|
int action3 = client.getMenuAction3()[index];
|
||||||
|
int action4 = 0;
|
||||||
int actionId = client.getMenuActionId()[index];
|
int actionId = client.getMenuActionId()[index];
|
||||||
if (DActions.debugActions()) {
|
if (DActions.debugActions()) {
|
||||||
if(Game.hasAction4()) {
|
if(Game.hasAction4()) {
|
||||||
int action4 = client.getMenuAction4()[index];
|
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));
|
System.out.println(String.format("[index: %d, action1: %d, action2: %d, action3: %d, action4: %d, id: %d]", index, action1, action2, action3, action4, actionId));
|
||||||
} else {
|
} else {
|
||||||
System.out.println(String.format("[index: %d, action1: %d, action2: %d, action3: %d, id: %d]", index, action1, action2, action3, actionId));
|
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 GameActionEvent actionEvent = new GameActionEvent(actionId, action1, action2, action3, action4, index);
|
||||||
ScriptEngine.getInstance().dispatch(actionEvent);
|
ScriptEngine.getInstance().dispatch(actionEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ import org.parabot.environment.api.interfaces.Paintable;
|
|||||||
import org.parabot.environment.scripts.Script;
|
import org.parabot.environment.scripts.Script;
|
||||||
import org.rev317.min.api.events.MessageEvent;
|
import org.rev317.min.api.events.MessageEvent;
|
||||||
import org.rev317.min.api.events.listeners.MessageListener;
|
import org.rev317.min.api.events.listeners.MessageListener;
|
||||||
import org.rev317.min.api.events.ActionEvent;
|
import org.rev317.min.api.events.GameActionEvent;
|
||||||
import org.rev317.min.api.events.listeners.ActionListener;
|
import org.rev317.min.api.events.listeners.GameActionListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -26,7 +26,7 @@ public class ScriptEngine {
|
|||||||
private ArrayList<MouseListener> mouseListeners;
|
private ArrayList<MouseListener> mouseListeners;
|
||||||
private ArrayList<MouseMotionListener> mouseMotionListeners;
|
private ArrayList<MouseMotionListener> mouseMotionListeners;
|
||||||
private ArrayList<MessageListener> messageListeners;
|
private ArrayList<MessageListener> messageListeners;
|
||||||
private ArrayList<ActionListener> actionListeners;
|
private ArrayList<GameActionListener> actionListeners;
|
||||||
|
|
||||||
private Script script = null;
|
private Script script = null;
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ public class ScriptEngine {
|
|||||||
this.mouseListeners = new ArrayList<MouseListener>();
|
this.mouseListeners = new ArrayList<MouseListener>();
|
||||||
this.mouseMotionListeners = new ArrayList<MouseMotionListener>();
|
this.mouseMotionListeners = new ArrayList<MouseMotionListener>();
|
||||||
this.messageListeners = new ArrayList<MessageListener>();
|
this.messageListeners = new ArrayList<MessageListener>();
|
||||||
this.actionListeners = new ArrayList<ActionListener>();
|
this.actionListeners = new ArrayList<GameActionListener>();
|
||||||
instances.put(Context.getInstance(), this);
|
instances.put(Context.getInstance(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,11 +46,11 @@ public class ScriptEngine {
|
|||||||
return new ScriptEngine();
|
return new ScriptEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addActionListener(ActionListener a){
|
public void addActionListener(GameActionListener a){
|
||||||
actionListeners.add(a);
|
actionListeners.add(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeActionListener(ActionListener a){
|
public void removeActionListener(GameActionListener a){
|
||||||
actionListeners.remove(a);
|
actionListeners.remove(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,8 +124,8 @@ public class ScriptEngine {
|
|||||||
if(script instanceof Paintable) {
|
if(script instanceof Paintable) {
|
||||||
Context.getInstance().addPaintable((Paintable)script);
|
Context.getInstance().addPaintable((Paintable)script);
|
||||||
}
|
}
|
||||||
if(script instanceof ActionListener){
|
if(script instanceof GameActionListener){
|
||||||
addActionListener((ActionListener) script);
|
addActionListener((GameActionListener) script);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,8 +173,8 @@ public class ScriptEngine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispatch(ActionEvent event) {
|
public void dispatch(GameActionEvent event) {
|
||||||
for(final ActionListener a : actionListeners) {
|
for(final GameActionListener a : actionListeners) {
|
||||||
a.onGameAction(event);
|
a.onGameAction(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user