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