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:
@@ -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