mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-07 08:39:12 +00:00
Added comments to most classes
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
package org.parabot.core;
|
package org.parabot.core;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* Holds some important constants
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import java.io.BufferedReader;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* The core of parabot
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ import javax.swing.JFileChooser;
|
|||||||
import org.parabot.environment.OperatingSystem;
|
import org.parabot.environment.OperatingSystem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* Holds parabot's used directories
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
* @author Matt
|
* @author Matt
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ import org.objectweb.asm.tree.ClassNode;
|
|||||||
import org.parabot.core.classpath.ClassPath;
|
import org.parabot.core.classpath.ClassPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* Makes classnodes into runnable classes
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
* @author Matt
|
* @author Matt
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import org.objectweb.asm.tree.MethodNode;
|
|||||||
import org.parabot.core.Context;
|
import org.parabot.core.Context;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* A collection of various asm util methods
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import org.parabot.core.asm.ASMUtils;
|
|||||||
import org.parabot.core.asm.interfaces.Injectable;
|
import org.parabot.core.asm.interfaces.Injectable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* This class appends an interface to a class
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ import org.parabot.core.asm.ASMUtils;
|
|||||||
import org.parabot.core.asm.interfaces.Injectable;
|
import org.parabot.core.asm.interfaces.Injectable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* This class is used for changing the super class of a class
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,7 +1,15 @@
|
|||||||
package org.parabot.core.asm.interfaces;
|
package org.parabot.core.asm.interfaces;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Injectable
|
||||||
|
* @author Everel
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface Injectable {
|
public interface Injectable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Injects bytecode into a class
|
||||||
|
*/
|
||||||
public void inject();
|
public void inject();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import org.parabot.core.asm.adapters.AddCallbackAdapter;
|
|||||||
import org.parabot.core.asm.interfaces.Injectable;
|
import org.parabot.core.asm.interfaces.Injectable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* This class is used for injecting a callback into a methodnode
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import org.parabot.core.asm.adapters.AddGetterAdapter;
|
|||||||
import org.parabot.core.asm.interfaces.Injectable;
|
import org.parabot.core.asm.interfaces.Injectable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* This class injects a getter which gets a specific field
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import org.parabot.core.asm.adapters.AddInterfaceAdapter;
|
|||||||
import org.parabot.core.asm.interfaces.Injectable;
|
import org.parabot.core.asm.interfaces.Injectable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* This class appends an interface to a class
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import org.parabot.core.asm.adapters.AddInvokerAdapter;
|
|||||||
import org.parabot.core.asm.interfaces.Injectable;
|
import org.parabot.core.asm.interfaces.Injectable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* This class is used for injecting an invoker into a methodnode
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import org.parabot.core.asm.adapters.AddSetterAdapter;
|
|||||||
import org.parabot.core.asm.interfaces.Injectable;
|
import org.parabot.core.asm.interfaces.Injectable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* This class is used for injecting a setter for a specific field
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package org.parabot.core.asm.wrappers;
|
|||||||
import org.parabot.core.asm.adapters.AddSuperAdapter;
|
import org.parabot.core.asm.adapters.AddSuperAdapter;
|
||||||
import org.parabot.core.asm.interfaces.Injectable;
|
import org.parabot.core.asm.interfaces.Injectable;
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* This class is used for changing the super class of a class
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import java.net.URL;
|
|||||||
import java.net.URLClassLoader;
|
import java.net.URLClassLoader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* Class used for adding urls to the buildpath
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ import org.parabot.core.io.SizeInputStream;
|
|||||||
import org.parabot.core.ui.components.VerboseLoader;
|
import org.parabot.core.ui.components.VerboseLoader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* Manages, parses and dumps class files & jars
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
* @author Matt
|
* @author Matt
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package org.parabot.core.desc;
|
package org.parabot.core.desc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* Holds information about a server
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
package org.parabot.core.forum;
|
package org.parabot.core.forum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Gives access to account details
|
||||||
|
*
|
||||||
|
* @author Everel
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface AccountManagerAccess {
|
public interface AccountManagerAccess {
|
||||||
|
|
||||||
public void setManager(AccountManager manager);
|
public void setManager(AccountManager manager);
|
||||||
|
|||||||
@@ -1,9 +1,24 @@
|
|||||||
package org.parabot.core.io;
|
package org.parabot.core.io;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Keeps track of a progress
|
||||||
|
*
|
||||||
|
* @author Everel
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface ProgressListener {
|
public interface ProgressListener {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when progress increased
|
||||||
|
* @param value
|
||||||
|
*/
|
||||||
public void onProgressUpdate(double value);
|
public void onProgressUpdate(double value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates upload speed
|
||||||
|
* @param mbPerSecond
|
||||||
|
*/
|
||||||
public void updateDownloadSpeed(double mbPerSecond);
|
public void updateDownloadSpeed(double mbPerSecond);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import org.parabot.core.Directories;
|
|||||||
import org.parabot.core.build.BuildPath;
|
import org.parabot.core.build.BuildPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* Jython util class
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -2,10 +2,24 @@ package org.parabot.core.paint;
|
|||||||
|
|
||||||
import org.parabot.environment.api.interfaces.Paintable;
|
import org.parabot.environment.api.interfaces.Paintable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Abstract class for debugging in game values & more
|
||||||
|
*
|
||||||
|
* @author Everel
|
||||||
|
*
|
||||||
|
*/
|
||||||
public abstract class AbstractDebugger implements Paintable {
|
public abstract class AbstractDebugger implements Paintable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggles this debugger
|
||||||
|
*/
|
||||||
public abstract void toggle();
|
public abstract void toggle();
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return <b>true</b> if this debugger is enabled, otherwise <b>false</b>
|
||||||
|
*/
|
||||||
public abstract boolean isEnabled();
|
public abstract boolean isEnabled();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import java.util.Queue;
|
|||||||
import org.parabot.core.Context;
|
import org.parabot.core.Context;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* Manages and paints on a collection of AbstractDebuggers
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import org.parabot.environment.scripts.ScriptManifest;
|
|||||||
import org.parabot.environment.scripts.loader.JavaScriptLoader;
|
import org.parabot.environment.scripts.loader.JavaScriptLoader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* Parses locally stored java scripts
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import org.python.util.PythonInterpreter;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Parser python scripts
|
* Parses python scripts
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import org.parabot.environment.api.utils.WebUtil;
|
|||||||
import org.parabot.environment.scripts.SDNScriptExecuter;
|
import org.parabot.environment.scripts.SDNScriptExecuter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* Parses scripts stored at parabot´s sdn
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import org.parabot.core.jython.Jython;
|
|||||||
import org.parabot.environment.scripts.ScriptExecuter;
|
import org.parabot.environment.scripts.ScriptExecuter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* Abstract class for parsing scripts
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import java.awt.event.ActionEvent;
|
|||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* The bot user interface
|
||||||
*
|
*
|
||||||
* @author Dane, Everel
|
* @author Dane, Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ import org.parabot.core.ui.images.Images;
|
|||||||
import org.parabot.core.ui.utils.SwingUtil;
|
import org.parabot.core.ui.utils.SwingUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* Users must login with their parabot account through this LoginUI class
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import org.parabot.core.logging.SystemConsoleHandler;
|
|||||||
import org.parabot.core.logging.TextAreaLogHandler;
|
import org.parabot.core.logging.TextAreaLogHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* The LogArea of the BotUI
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import java.awt.Graphics2D;
|
|||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.Rectangle2D;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* ProgressBar
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import javax.swing.GroupLayout;
|
|||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* Game Applet holder
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import java.util.HashMap;
|
|||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* Caches and loads images from resource
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import java.awt.Dimension;
|
|||||||
import java.awt.Toolkit;
|
import java.awt.Toolkit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* Holds various awt util based methods
|
||||||
*
|
*
|
||||||
* @author Dane
|
* @author Dane
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package org.parabot.core.ui.utils;
|
|||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* Holds various swing util based methods
|
||||||
*
|
*
|
||||||
* @author Dane
|
* @author Dane
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package org.parabot.core.ui.utils;
|
|||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* Log messages to the log user interface which is attached to the bot user interface
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import org.parabot.core.ui.ServerSelector;
|
|||||||
import org.parabot.environment.Environment;
|
import org.parabot.environment.Environment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A colorful server widget
|
* A neat looking server widget
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import org.parabot.core.ui.components.VerboseLoader;
|
|||||||
import org.parabot.environment.api.utils.WebUtil;
|
import org.parabot.environment.api.utils.WebUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* Initiliazes the bot environment
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
package org.parabot.environment;
|
package org.parabot.environment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* This class is used for detecting the user's operating system
|
||||||
|
*
|
||||||
|
* @author Everel
|
||||||
|
*
|
||||||
|
*/
|
||||||
public enum OperatingSystem {
|
public enum OperatingSystem {
|
||||||
|
|
||||||
WINDOWS, LINUX, MAC, OTHER;
|
WINDOWS, LINUX, MAC, OTHER;
|
||||||
|
|||||||
@@ -1,14 +1,17 @@
|
|||||||
package org.parabot.environment.api.utils;
|
package org.parabot.environment.api.utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple class to filter things
|
* A simple class to filter things out of an collection
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
* @param <F>
|
* @param <F>
|
||||||
*/
|
*/
|
||||||
public interface Filter<F>
|
public interface Filter<F> {
|
||||||
{
|
/**
|
||||||
|
* Determines if this object should be accepted
|
||||||
|
* @param f
|
||||||
|
* @return <b>true</b> to include this object, otherwise <b>false</b> to exclude.
|
||||||
|
*/
|
||||||
public boolean accept(F f);
|
public boolean accept(F f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package org.parabot.environment.api.utils;
|
package org.parabot.environment.api.utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* A random class is used for generating random numbers
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package org.parabot.environment.api.utils;
|
package org.parabot.environment.api.utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* Holds various Time utilities
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -7,8 +7,7 @@ package org.parabot.environment.api.utils;
|
|||||||
* @author Everel, Parameter
|
* @author Everel, Parameter
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class Timer
|
public class Timer {
|
||||||
{
|
|
||||||
|
|
||||||
private long start;
|
private long start;
|
||||||
private long end;
|
private long end;
|
||||||
@@ -18,8 +17,7 @@ public class Timer
|
|||||||
*
|
*
|
||||||
* @param start
|
* @param start
|
||||||
*/
|
*/
|
||||||
public Timer(long end)
|
public Timer(long end) {
|
||||||
{
|
|
||||||
|
|
||||||
start = System.currentTimeMillis();
|
start = System.currentTimeMillis();
|
||||||
this.end = System.currentTimeMillis() + end;
|
this.end = System.currentTimeMillis() + end;
|
||||||
@@ -28,8 +26,7 @@ public class Timer
|
|||||||
/**
|
/**
|
||||||
* Timer Constructor
|
* Timer Constructor
|
||||||
*/
|
*/
|
||||||
public Timer()
|
public Timer() {
|
||||||
{
|
|
||||||
this(0);
|
this(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,7 +40,8 @@ public class Timer
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if the end time has been reached, does not mean it stopped running.
|
* Determines if the end time has been reached, does not mean it stopped
|
||||||
|
* running.
|
||||||
*/
|
*/
|
||||||
public boolean isFinished() {
|
public boolean isFinished() {
|
||||||
return System.currentTimeMillis() > end;
|
return System.currentTimeMillis() > end;
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ import org.parabot.core.io.ProgressListener;
|
|||||||
import org.parabot.core.io.SizeInputStream;
|
import org.parabot.core.io.SizeInputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* A WebUtil class fetches data from an URL
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import java.util.Random;
|
|||||||
import org.parabot.core.Context;
|
import org.parabot.core.Context;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* Virtual keyboard, dispatches key events to a component.
|
||||||
*
|
*
|
||||||
* @author Everel, Matt, Dane
|
* @author Everel, Matt, Dane
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import org.parabot.core.Context;
|
|||||||
import org.parabot.environment.api.utils.Time;
|
import org.parabot.environment.api.utils.Time;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* A virtual mouse, dispatches mouse events to a component
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import org.parabot.core.ui.images.Images;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* Holds script categories
|
||||||
*
|
*
|
||||||
* @author Dane
|
* @author Dane
|
||||||
*
|
*
|
||||||
@@ -16,10 +18,19 @@ public enum Category
|
|||||||
|
|
||||||
AGILITY, COMBAT, COOKING, CRAFTING, FARMING, FIREMAKING, FISHING, FLETCHING, HERBLORE, MAGIC, MINING, OTHER, PRAYER, RUNECRAFTING, SLAYER, SMITHING, THIEVING, UTILITY, WOODCUTTING;
|
AGILITY, COMBAT, COOKING, CRAFTING, FARMING, FIREMAKING, FISHING, FLETCHING, HERBLORE, MAGIC, MINING, OTHER, PRAYER, RUNECRAFTING, SLAYER, SMITHING, THIEVING, UTILITY, WOODCUTTING;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets image belonging to this category
|
||||||
|
* @return icon
|
||||||
|
*/
|
||||||
public BufferedImage getIcon() {
|
public BufferedImage getIcon() {
|
||||||
return Category.getIcon(this.name().toLowerCase());
|
return Category.getIcon(this.name().toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets category icon image from filename
|
||||||
|
* @param s
|
||||||
|
* @return icon
|
||||||
|
*/
|
||||||
public static BufferedImage getIcon(String s) {
|
public static BufferedImage getIcon(String s) {
|
||||||
if (images.get(s) == null) {
|
if (images.get(s) == null) {
|
||||||
images.put(s, Images.getResource("/org/parabot/core/ui/images/category/" + s + ".png"));
|
images.put(s, Images.getResource("/org/parabot/core/ui/images/category/" + s + ".png"));
|
||||||
@@ -35,6 +46,9 @@ public enum Category
|
|||||||
return new String(b);
|
return new String(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache
|
||||||
|
*/
|
||||||
private static HashMap<String, BufferedImage> images = new HashMap<String, BufferedImage>();
|
private static HashMap<String, BufferedImage> images = new HashMap<String, BufferedImage>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import org.parabot.environment.scripts.framework.LoopTask;
|
|||||||
import org.parabot.environment.scripts.framework.Strategy;
|
import org.parabot.environment.scripts.framework.Strategy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* Holds various script frameworks
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package org.parabot.environment.scripts;
|
package org.parabot.environment.scripts;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* Loads a locally stored script
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ import org.parabot.environment.api.utils.WebUtil;
|
|||||||
import org.parabot.environment.scripts.loader.JavaScriptLoader;
|
import org.parabot.environment.scripts.loader.JavaScriptLoader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* Loads a script from the SDN
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import org.parabot.environment.scripts.framework.SleepCondition;
|
|||||||
import org.parabot.environment.scripts.framework.Strategy;
|
import org.parabot.environment.scripts.framework.Strategy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* Script template, scripts are 'add-ons' which executes various tasks in-game
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,9 +1,21 @@
|
|||||||
package org.parabot.environment.scripts;
|
package org.parabot.environment.scripts;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Executes a script
|
||||||
|
*
|
||||||
|
* @author Everel
|
||||||
|
*
|
||||||
|
*/
|
||||||
public abstract class ScriptExecuter {
|
public abstract class ScriptExecuter {
|
||||||
|
|
||||||
public abstract void run(final ThreadGroup tg);
|
public abstract void run(final ThreadGroup tg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start script.
|
||||||
|
* @param tg
|
||||||
|
* @param script
|
||||||
|
*/
|
||||||
public final void finalize(final ThreadGroup tg, final Script script) {
|
public final void finalize(final ThreadGroup tg, final Script script) {
|
||||||
new Thread(tg, script).start();
|
new Thread(tg, script).start();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import java.lang.annotation.Retention;
|
|||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A script manifest
|
* A script manifest, holds all script data
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
package org.parabot.environment.scripts.framework;
|
package org.parabot.environment.scripts.framework;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Abstract framework for a script
|
||||||
|
*
|
||||||
|
* @author Everel
|
||||||
|
*
|
||||||
|
*/
|
||||||
public abstract class AbstractFramework {
|
public abstract class AbstractFramework {
|
||||||
|
|
||||||
public abstract boolean execute();
|
public abstract boolean execute();
|
||||||
|
|||||||
@@ -1,7 +1,18 @@
|
|||||||
package org.parabot.environment.scripts.framework;
|
package org.parabot.environment.scripts.framework;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* A LoopTask interface is used to keep calling the loop method which should return the sleep time
|
||||||
|
*
|
||||||
|
* @author Everel
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface LoopTask {
|
public interface LoopTask {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return sleepTime in ms
|
||||||
|
*/
|
||||||
public int loop();
|
public int loop();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,12 @@ package org.parabot.environment.scripts.framework;
|
|||||||
|
|
||||||
import org.parabot.environment.scripts.Script;
|
import org.parabot.environment.scripts.Script;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Jython script, only supports a loop
|
||||||
|
*
|
||||||
|
* @author Everel
|
||||||
|
*
|
||||||
|
*/
|
||||||
public abstract class PythonScript extends Script {
|
public abstract class PythonScript extends Script {
|
||||||
|
|
||||||
public abstract int loop();
|
public abstract int loop();
|
||||||
|
|||||||
@@ -1,7 +1,17 @@
|
|||||||
package org.parabot.environment.scripts.framework;
|
package org.parabot.environment.scripts.framework;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Keeps sleeping till a condition is valid
|
||||||
|
*
|
||||||
|
* @author Everel
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface SleepCondition {
|
public interface SleepCondition {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if condition is valid
|
||||||
|
* @return <b>true</b> if valid, otherwise <b>false</b>.
|
||||||
|
*/
|
||||||
public boolean isValid();
|
public boolean isValid();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,22 @@
|
|||||||
package org.parabot.environment.scripts.framework;
|
package org.parabot.environment.scripts.framework;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Strategy framework for scripts
|
||||||
|
*
|
||||||
|
* @author Everel
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface Strategy {
|
public interface Strategy {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to activate this strategy
|
||||||
|
* @return <b>true</b> if this strategy should be executed, otherwise <b>false</b>.
|
||||||
|
*/
|
||||||
public boolean activate();
|
public boolean activate();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Executes this strategy
|
||||||
|
*/
|
||||||
public void execute();
|
public void execute();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import org.parabot.environment.scripts.Script;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* An environment to load a server
|
* An environment to load a script
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ import org.parabot.environment.api.utils.WebUtil;
|
|||||||
import org.parabot.environment.servers.loader.ServerLoader;
|
import org.parabot.environment.servers.loader.ServerLoader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* Fetches a server provider from the parabot sdn
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import org.parabot.core.Context;
|
|||||||
import org.parabot.core.ui.components.BotToolbar;
|
import org.parabot.core.ui.components.BotToolbar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* Executes a server provider
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package org.parabot.environment.servers;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Bot type
|
* Server provider type
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user