mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-07 16:49:10 +00:00
Added comments to most classes
This commit is contained in:
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user