mirror of
https://github.com/bdnugget/IdleRSC.git
synced 2026-11-07 07:57:27 +00:00
AIOQuester Release
This commit is contained in:
1 parent
f92efd28f6
commit
6135e1eff3
28 files changed
+3233
-1134
No files matched your search
@@ -1498,8 +1498,11 @@ public class Main {
|
||||
}
|
||||
|
||||
/**
|
||||
* A function which returns the current running IdleScript/Script instance.
|
||||
* Returns the debugger.
|
||||
*
|
||||
* @return Object (which is an instanceof IdleScript or Script)
|
||||
* @return debugger
|
||||
*/
|
||||
public static Debugger getDebugger() {
|
||||
return debugger;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package controller;
|
||||
|
||||
import bot.Main;
|
||||
import bot.debugger.Debugger;
|
||||
import callbacks.DrawCallback;
|
||||
import com.openrsc.client.entityhandling.EntityHandler;
|
||||
import com.openrsc.client.entityhandling.defs.DoorDef;
|
||||
@@ -6277,6 +6278,30 @@ public class Controller {
|
||||
return Config.C_BATCH_PROGRESS_BAR;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Map of bank items and their amount from the debugger. If you want to do checking
|
||||
* while in a bank, use getBankItems() instead. The debugger stays populated the entire time
|
||||
* you're logged in, and doesn't require being in a bank to use.
|
||||
*
|
||||
* @return Map - Bank items
|
||||
*/
|
||||
public Map<Integer, Integer> getDebuggerBank() {
|
||||
Map<Integer, Integer> bankMap = new HashMap<>();
|
||||
try {
|
||||
Debugger debugger = Main.getDebugger();
|
||||
Field debuggerBankField = Debugger.class.getDeclaredField("bankItems");
|
||||
debuggerBankField.setAccessible(true);
|
||||
List<Item> bankList = (List<Item>) debuggerBankField.get(debugger);
|
||||
if (bankList == null) return null;
|
||||
if (bankList.size() > 0)
|
||||
bankList.forEach(item -> bankMap.put(item.getCatalogID(), item.getAmount()));
|
||||
return bankMap;
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
System.out.println(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display String "Hr:Min:Sec" version of milliseconds long int.
|
||||
*
|
||||
@@ -6379,7 +6404,25 @@ public class Controller {
|
||||
}
|
||||
|
||||
public void hideWelcomeScreen() {
|
||||
System.out.println("Attempting tohide login screen...");
|
||||
System.out.println("Attempting to hide login screen...");
|
||||
mud.setShowDialogMessage(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the players gamemode. 0 is normal, 1 is ironman, 2 is ultimate, 3 is hardcore.
|
||||
*
|
||||
* @return int -- Mode
|
||||
*/
|
||||
public int getPlayerMode() {
|
||||
return mud.getIronmanInterface().getIronManMode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the player is an ironman mode.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean isPlayerAnIronMode() {
|
||||
return getPlayerMode() != 0;
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ public class PaintBuilder {
|
||||
private int rainbowSpeed = 4;
|
||||
private boolean isScriptPaint, isPlaceholderPaint, tCentered = false;
|
||||
|
||||
private ArrayList<RowBuilder> rowData = new ArrayList<>();
|
||||
private final ArrayList<RowBuilder> rowData = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* @param width int -- Width of the paint
|
||||
@@ -245,7 +245,7 @@ public class PaintBuilder {
|
||||
|
||||
/** Adds an empty row used to add a space between two rows. */
|
||||
public void addSpacerRow(int rowHeight) {
|
||||
rowHeight = rowHeight < 0 ? 0 : rowHeight;
|
||||
rowHeight = Math.max(rowHeight, 0);
|
||||
RowBuilder row = new RowBuilder();
|
||||
row.rowHeight = rowHeight;
|
||||
rowData.add(row);
|
||||
@@ -305,13 +305,13 @@ public class PaintBuilder {
|
||||
return fontSize > 0 && fontSize < 8 ? fontYOffsets[fontSize - 1] : 0;
|
||||
}
|
||||
|
||||
/** This is ran once per draw cycle. Put variables that need updating here */
|
||||
/** This is run once per draw cycle. Put variables that need updating here */
|
||||
private void doUpdates() {
|
||||
hue = hue <= 0 ? 1f : hue - (float) (rainbowSpeed * 0.0005);
|
||||
|
||||
colorRainbow = Color.HSBtoRGB(hue, 1f, 1f);
|
||||
stringRunTime = c.msToString(System.currentTimeMillis() - startTime);
|
||||
runTimeSeconds = ((System.currentTimeMillis() - startTime) / 1000);
|
||||
runTimeSeconds = ((float) (System.currentTimeMillis() - startTime) / 1000);
|
||||
timeScale = (60 * 60) / runTimeSeconds;
|
||||
}
|
||||
|
||||
@@ -347,131 +347,151 @@ public class PaintBuilder {
|
||||
}
|
||||
|
||||
// Draw rows
|
||||
if (rowData != null && rowData.size() > 0) {
|
||||
for (int rowNum = 0; rowNum < rowData.size(); rowNum++) {
|
||||
RowBuilder r = rowData.get(rowNum);
|
||||
|
||||
if (!rowData.isEmpty()) {
|
||||
for (RowBuilder r : rowData) {
|
||||
// Highlight row backgrounds for testing r.rowHeight
|
||||
/* if (rowNum % 2 == 1) {
|
||||
c.drawBoxAlpha(
|
||||
pX, pY + cumulativeRowHeight + rowsY, pWidth, r.rowHeight, 0xffffff, 155);
|
||||
} else {
|
||||
c.drawBoxAlpha(
|
||||
pX, pY + cumulativeRowHeight + rowsY, pWidth, r.rowHeight, 0x454545, 155);
|
||||
} */
|
||||
|
||||
// Draws a row with three strings
|
||||
if (r.type.equals("MultipleStrings")) {
|
||||
int x = pX;
|
||||
int y = pY + rowsY + cumulativeRowHeight + fixFontAnchoring(r.fontSize);
|
||||
for (int i = 0; i < r.strings.length; i++) {
|
||||
x += r.stringXOffsets[i];
|
||||
String text = r.strings[i];
|
||||
int color = r.colors[i];
|
||||
if (text != null && color != 0) c.drawString(text, x, y, color, r.fontSize);
|
||||
/*boolean debug = false;
|
||||
if (debug) {
|
||||
if (rowNum % 2 == 1) {
|
||||
c.drawBoxAlpha(
|
||||
pX, pY + cumulativeRowHeight + rowsY, pWidth, r.rowHeight, 0xffffff, 155);
|
||||
} else {
|
||||
c.drawBoxAlpha(
|
||||
pX, pY + cumulativeRowHeight + rowsY, pWidth, r.rowHeight, 0x454545, 155);
|
||||
}
|
||||
}*/
|
||||
|
||||
// Draws a row with a single string
|
||||
} else if (r.type.equals("SingleString")) {
|
||||
String text = r.text;
|
||||
int x = r.borderXOffset + pX;
|
||||
int y = pY + rowsY + cumulativeRowHeight + fixFontAnchoring(r.fontSize);
|
||||
int color = r.stringColor;
|
||||
switch (r.type) {
|
||||
// Draws a row with multiple strings
|
||||
case "MultipleStrings":
|
||||
{
|
||||
int x = pX;
|
||||
int y = pY + rowsY + cumulativeRowHeight + fixFontAnchoring(r.fontSize);
|
||||
for (int i = 0; i < r.strings.length; i++) {
|
||||
x += r.stringXOffsets[i];
|
||||
String text = r.strings[i];
|
||||
int color = r.colors[i];
|
||||
if (text != null && color != 0) c.drawString(text, x, y, color, r.fontSize);
|
||||
}
|
||||
|
||||
if (text != null && color != 0) c.drawString(text, x, y, color, r.fontSize);
|
||||
break;
|
||||
}
|
||||
// Draws a row with a single string
|
||||
case "SingleString":
|
||||
{
|
||||
String text = r.text;
|
||||
int x = r.borderXOffset + pX;
|
||||
int y = pY + rowsY + cumulativeRowHeight + fixFontAnchoring(r.fontSize);
|
||||
int color = r.stringColor;
|
||||
|
||||
} else if (r.type.equals("CenteredString")) {
|
||||
String text = r.text;
|
||||
int x = (pWidth / 2) + pX;
|
||||
int y = pY + rowsY + cumulativeRowHeight + (r.fontSize < 3 ? 4 : 5);
|
||||
int color = r.stringColor;
|
||||
if (text != null && color != 0) c.drawString(text, x, y, color, r.fontSize);
|
||||
|
||||
if (text != null && color != 0) c.drawCenteredString(text, x, y, color, r.fontSize);
|
||||
break;
|
||||
}
|
||||
// Draws a row with a single centered string
|
||||
case "CenteredString":
|
||||
{
|
||||
String text = r.text;
|
||||
int x = (pWidth / 2) + pX;
|
||||
int y = pY + rowsY + cumulativeRowHeight + (r.fontSize < 3 ? 4 : 5);
|
||||
int color = r.stringColor;
|
||||
|
||||
// Draws a row with multiple item sprites and strings for each
|
||||
} else if (r.type.equals("MultipleSprites")) {
|
||||
if (r.colors == null) r.colors = new int[] {0xffffff};
|
||||
int cumulativeSpacing = 0;
|
||||
for (int i = 0; i < r.ids.length; i++) {
|
||||
String str = r.strings[i];
|
||||
int id = r.ids[i];
|
||||
int scale = r.scales[i];
|
||||
int stringXOffset = r.stringXOffset;
|
||||
int color = r.colors.length == r.ids.length ? r.colors[i] : r.colors[0];
|
||||
if (text != null && color != 0)
|
||||
c.drawCenteredString(text, x, y, color, r.fontSize);
|
||||
|
||||
cumulativeSpacing += c.getItemSpriteScaledWidth(id, scale) + r.spriteSpacing;
|
||||
int spriteX = r.borderXOffset + cumulativeSpacing;
|
||||
int spriteY =
|
||||
pY
|
||||
+ rowsY
|
||||
+ cumulativeRowHeight
|
||||
+ (int) (c.getItemSpriteScaledWidth(id, scale) / 2);
|
||||
int stringX = pX + r.borderXOffset + stringXOffset + cumulativeSpacing;
|
||||
int stringY = pY + spriteY + r.stringYOffset + 11;
|
||||
break;
|
||||
}
|
||||
// Draws a row with multiple item sprites and strings for each
|
||||
case "MultipleSprites":
|
||||
if (r.colors == null) r.colors = new int[] {0xffffff};
|
||||
int cumulativeSpacing = 0;
|
||||
for (int i = 0; i < r.ids.length; i++) {
|
||||
String str = r.strings[i];
|
||||
int id = r.ids[i];
|
||||
int scale = r.scales[i];
|
||||
int stringXOffset = r.stringXOffset;
|
||||
int color = r.colors.length == r.ids.length ? r.colors[i] : r.colors[0];
|
||||
|
||||
c.drawItemSprite(id, spriteX, spriteY, scale, false);
|
||||
c.drawString(str, stringX, stringY, color, 1);
|
||||
}
|
||||
cumulativeSpacing += c.getItemSpriteScaledWidth(id, scale) + r.spriteSpacing;
|
||||
int spriteX = r.borderXOffset + cumulativeSpacing;
|
||||
int spriteY =
|
||||
pY
|
||||
+ rowsY
|
||||
+ cumulativeRowHeight
|
||||
+ (int) (c.getItemSpriteScaledWidth(id, scale) / 2);
|
||||
int stringX = pX + r.borderXOffset + stringXOffset + cumulativeSpacing;
|
||||
int stringY = pY + spriteY + r.stringYOffset + 11;
|
||||
|
||||
// Draws a row with an item sprite and multiple strings
|
||||
c.drawItemSprite(id, spriteX, spriteY, scale, false);
|
||||
c.drawString(str, stringX, stringY, color, 1);
|
||||
}
|
||||
|
||||
} else if (r.type.equals("SingleSpriteMultipleStrings")) {
|
||||
int id = r.itemId;
|
||||
int rowX = pX + r.borderXOffset;
|
||||
int spriteY = pY + rowsY + cumulativeRowHeight + 2;
|
||||
int stringY = spriteY + r.stringYOffset + fixFontAnchoring(r.fontSize);
|
||||
int scale = r.spriteScale;
|
||||
c.drawItemSprite(id, rowX, spriteY, scale, false);
|
||||
int stringX = rowX;
|
||||
for (int i = 0; i < r.strings.length; i++) {
|
||||
stringX += r.stringXOffsets[i];
|
||||
int color = r.colors[i];
|
||||
String text = r.strings[i];
|
||||
if (text != null && color != 0) c.drawString(text, stringX, stringY, color, 1);
|
||||
}
|
||||
break;
|
||||
// Draws a row with an item sprite and multiple strings
|
||||
case "SingleSpriteMultipleStrings":
|
||||
{
|
||||
int id = r.itemId;
|
||||
int rowX = pX + r.borderXOffset;
|
||||
int spriteY = pY + rowsY + cumulativeRowHeight + 2;
|
||||
int stringY = spriteY + r.stringYOffset + fixFontAnchoring(r.fontSize);
|
||||
int scale = r.spriteScale;
|
||||
c.drawItemSprite(id, rowX, spriteY, scale, false);
|
||||
int stringX = rowX;
|
||||
for (int i = 0; i < r.strings.length; i++) {
|
||||
stringX += r.stringXOffsets[i];
|
||||
int color = r.colors[i];
|
||||
String text = r.strings[i];
|
||||
if (text != null && color != 0) c.drawString(text, stringX, stringY, color, 1);
|
||||
}
|
||||
|
||||
// Draws a row with an item sprite and one string
|
||||
} else if (r.type.equals("SingleSpriteSingleString")) {
|
||||
int id = r.itemId;
|
||||
int scale = r.spriteScale;
|
||||
String str = r.text;
|
||||
int color = r.stringColor;
|
||||
int spriteY = pY + rowsY + cumulativeRowHeight + 2;
|
||||
int spriteX = pX + r.borderXOffset;
|
||||
int stringX = spriteX + r.stringXOffset;
|
||||
int stringY = spriteY + r.stringYOffset + (c.getStringHeight(1) / 2);
|
||||
c.drawItemSprite(id, spriteX, spriteY, scale, false);
|
||||
c.drawString(str, stringX, stringY, color, 1);
|
||||
break;
|
||||
}
|
||||
// Draws a row with an item sprite and one string
|
||||
case "SingleSpriteSingleString":
|
||||
{
|
||||
int id = r.itemId;
|
||||
int scale = r.spriteScale;
|
||||
String str = r.text;
|
||||
int color = r.stringColor;
|
||||
int spriteY = pY + rowsY + cumulativeRowHeight + 2;
|
||||
int spriteX = pX + r.borderXOffset;
|
||||
int stringX = spriteX + r.stringXOffset;
|
||||
int stringY = spriteY + r.stringYOffset + (c.getStringHeight(1) / 2);
|
||||
c.drawItemSprite(id, spriteX, spriteY, scale, false);
|
||||
c.drawString(str, stringX, stringY, color, 1);
|
||||
|
||||
// Draws a row with a progress bar and a description string
|
||||
} else if (r.type.equals("ProgressBar")) {
|
||||
int barX = pX + r.borderXOffset;
|
||||
int barY = pY + rowsY + cumulativeRowHeight + 14;
|
||||
c.drawCenteredString(
|
||||
r.text, barX + (r.progressBarWidth / 2), barY - 10, r.stringColor, 1);
|
||||
c.drawProgressBar(
|
||||
r.currentProgress,
|
||||
r.maximumProgress,
|
||||
r.bgColor,
|
||||
r.fgColor,
|
||||
r.borderColor,
|
||||
barX,
|
||||
barY,
|
||||
r.progressBarWidth,
|
||||
r.progressBarHeight,
|
||||
r.showPercentage,
|
||||
r.showGoal);
|
||||
break;
|
||||
}
|
||||
// Draws a row with a progress bar and a description string
|
||||
case "ProgressBar":
|
||||
int barX = pX + r.borderXOffset;
|
||||
int barY = pY + rowsY + cumulativeRowHeight + 14;
|
||||
c.drawCenteredString(
|
||||
r.text, barX + (r.progressBarWidth / 2), barY - 10, r.stringColor, 1);
|
||||
c.drawProgressBar(
|
||||
r.currentProgress,
|
||||
r.maximumProgress,
|
||||
r.bgColor,
|
||||
r.fgColor,
|
||||
r.borderColor,
|
||||
barX,
|
||||
barY,
|
||||
r.progressBarWidth,
|
||||
r.progressBarHeight,
|
||||
r.showPercentage,
|
||||
r.showGoal);
|
||||
break;
|
||||
}
|
||||
cumulativeRowHeight += r.rowHeight;
|
||||
}
|
||||
}
|
||||
this.setHeight(cumulativeRowHeight + rowsY + 2);
|
||||
if (rowData.size() > 0) rowData.clear();
|
||||
if (!rowData.isEmpty()) rowData.clear();
|
||||
}
|
||||
|
||||
if (!c.isRunning()) {
|
||||
if (isScriptPaint) isScriptPaint = false;
|
||||
if (rowData.size() > 0) rowData.clear();
|
||||
if (!rowData.isEmpty()) rowData.clear();
|
||||
startTime = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,13 +70,8 @@ public class BruteForceUtils {
|
||||
}
|
||||
}
|
||||
|
||||
Main.getController()
|
||||
.log(
|
||||
"Can't find the closest walkable node to "
|
||||
+ x
|
||||
+ ", "
|
||||
+ y
|
||||
+ ", using Euclidean closest.");
|
||||
System.out.println(
|
||||
"Can't find the closest walkable node to " + x + ", " + y + ", using Euclidean closest.");
|
||||
closestNodeCache.put(cacheKey, findClosestNodeEuclidian(x, y, adjacencyList));
|
||||
return closestNodeCache.get(cacheKey);
|
||||
}
|
||||
|
||||
@@ -340,4 +340,47 @@ public class CustomLabelHandlers {
|
||||
return Main.getController()
|
||||
.sleepUntil(() -> Main.getController().getObjectAtCoord(xCoord, yCoord) == 58, 6000);
|
||||
}
|
||||
|
||||
public static boolean varrockEastDigsiteGate() {
|
||||
int xCoord = 79, yCoord = 505;
|
||||
if (Main.getController().getObjectAtCoord(xCoord, yCoord) == 59)
|
||||
return true; // Gate is already open
|
||||
Main.log("Opening Varrock East Digsite Gate...");
|
||||
Main.getController().atObject(xCoord, yCoord);
|
||||
return Main.getController()
|
||||
.sleepUntil(() -> Main.getController().getObjectAtCoord(xCoord, yCoord) == 59, 6000);
|
||||
}
|
||||
|
||||
public static boolean wizardTowerBasement() {
|
||||
boolean goingDown = Main.getController().currentY() <= 1000;
|
||||
int ladderId = goingDown ? 6 : 5;
|
||||
|
||||
if (!Main.getController().isDoorOpen(217, 690)) {
|
||||
while (!Main.getController().isDoorOpen(217, 690) && Main.getController().isRunning()) {
|
||||
Main.getController().openDoor(217, 690);
|
||||
Main.getController().sleep(1280);
|
||||
}
|
||||
}
|
||||
|
||||
Main.log("Going down the ladder to Wizards' Tower Basement...");
|
||||
Main.getController().atObject(ladderId);
|
||||
return Main.getController()
|
||||
.sleepUntil(() -> goingDown == (Main.getController().currentY() < 1000));
|
||||
}
|
||||
|
||||
public static boolean wizardTowerDoor() {
|
||||
boolean goingNorth = Main.getController().currentY() >= 689;
|
||||
if (Main.getController().getWallObjectIdAtCoord(215, 689) == 8) {
|
||||
Main.getController().log("Opening the Wizards' Tower Door");
|
||||
while (Main.getController().getWallObjectIdAtCoord(215, 689) == 8
|
||||
&& Main.getController().isRunning()) {
|
||||
Main.getController().atWallObject(215, 689);
|
||||
Main.getController().sleep(1280);
|
||||
}
|
||||
}
|
||||
Main.getController().walkTo(215, goingNorth ? 688 : 689);
|
||||
return goingNorth
|
||||
? Main.getController().currentY() <= 688
|
||||
: Main.getController().currentY() >= 689;
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ public class WebWalker {
|
||||
* @param currentY the current Y coordinate
|
||||
* @param endCoords the array of end coordinate pairs, where each pair is an array of two integers
|
||||
* [endX, endY]
|
||||
* @return true if successfully took a step towards the closest end coordinate pair
|
||||
* @return if successfully took a step towards the closest end coordinate pair
|
||||
*/
|
||||
public boolean webwalkTowards(int currentX, int currentY, int[][] endCoords) {
|
||||
long startTime = System.currentTimeMillis();
|
||||
@@ -35,8 +35,8 @@ public class WebWalker {
|
||||
}
|
||||
|
||||
if (closestNodesToEndCoords.isEmpty()) {
|
||||
Main.getController()
|
||||
.log("No walkable end nodes found, yeeting off in a random direction to get unstuck..");
|
||||
System.out.println(
|
||||
"No walkable end nodes found, yeeting off in a random direction to get unstuck..");
|
||||
Main.getController()
|
||||
.walkTo(
|
||||
currentX + ThreadLocalRandom.current().nextInt(-5, 6),
|
||||
@@ -70,37 +70,26 @@ public class WebWalker {
|
||||
for (WebwalkNode node : path) {
|
||||
pathLog.append("(").append(node.getX()).append(", ").append(node.getY()).append(") -> ");
|
||||
}
|
||||
Main.getController()
|
||||
.log(
|
||||
"Path calculated in "
|
||||
+ (System.currentTimeMillis() - startTime)
|
||||
+ "ms: "
|
||||
+ pathLog.substring(0, pathLog.length() - 4));
|
||||
System.out.println(
|
||||
"Path calculated in "
|
||||
+ (System.currentTimeMillis() - startTime)
|
||||
+ "ms: "
|
||||
+ pathLog.substring(0, pathLog.length() - 4));
|
||||
|
||||
// Walk the first edge of the path
|
||||
|
||||
if (path.get(0).getX() == Main.getController().currentX()
|
||||
&& path.get(0).getY() == Main.getController().currentY()) {
|
||||
System.out.println(
|
||||
"Removed the first element of the path because it's the same as the current position");
|
||||
path.remove(0);
|
||||
if (path.size() == 1) {
|
||||
// We were already standing on a web node, but we removed it. We're right beside the end
|
||||
// though, so just go
|
||||
Main.getController().walkDamnit(path.get(0).getX(), path.get(0).getY());
|
||||
return true;
|
||||
}
|
||||
if (path.size() == 1) {
|
||||
Main.getController().log("Walking to the last node..");
|
||||
Main.getController().walkDamnit(path.get(0).getX(), path.get(0).getY());
|
||||
return true;
|
||||
}
|
||||
|
||||
WebwalkEdge edge = graph.getEdge(path.get(0), path.get(1));
|
||||
if (edge != null && edge.getLabel().isPresent()) {
|
||||
Main.getController().log("Walking along " + edge + " with label: " + edge.getLabel().get());
|
||||
System.out.println("Walking along " + edge + " with label: " + edge.getLabel().get());
|
||||
if (executeCustomLabelFunction(edge.getLabel().get())) {
|
||||
Main.getController().walkDamnit(path.get(1).getX(), path.get(1).getY());
|
||||
return true;
|
||||
} else {
|
||||
Main.getController()
|
||||
.log("Failed to execute custom function for label: " + edge.getLabel().get());
|
||||
System.out.println("Failed to execute custom function for label: " + edge.getLabel().get());
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
@@ -109,6 +98,44 @@ public class WebWalker {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a rough estimate of the distance of a webwalker path.
|
||||
*
|
||||
* @param x1 int -- X1
|
||||
* @param y1 int -- Y1
|
||||
* @param x2 int -- X2
|
||||
* @param y2 int -- Y2
|
||||
* @return int
|
||||
*/
|
||||
public int distanceBetween(int x1, int y1, int x2, int y2) {
|
||||
Map<WebwalkNode, int[]> closestNodesToEndCoords = new HashMap<>();
|
||||
int[][] endCoords = new int[][] {{x2, y2}};
|
||||
for (int[] coords : endCoords) {
|
||||
WebwalkNode node = graph.findClosestNode(coords[0], coords[1]);
|
||||
closestNodesToEndCoords.put(node, coords);
|
||||
}
|
||||
WebwalkNode startNode = graph.findClosestNode(x1, y1);
|
||||
|
||||
Set<WebwalkNode> endNodes = closestNodesToEndCoords.keySet();
|
||||
List<WebwalkNode> path = dijkstraPathfinding(startNode, endNodes);
|
||||
|
||||
int distance = 0;
|
||||
WebwalkNode previousNode = path.get(0);
|
||||
|
||||
for (WebwalkNode current : path) {
|
||||
if (current.equals(previousNode)) continue;
|
||||
int stepDistance =
|
||||
Main.getController()
|
||||
.distance(previousNode.getX(), previousNode.getY(), current.getX(), current.getY());
|
||||
|
||||
distance += stepDistance;
|
||||
previousNode = current;
|
||||
}
|
||||
System.out.printf(
|
||||
"The distance between (%s, %s) and (%s, %s) is roughly: %s%n", x1, y1, x2, y2, distance);
|
||||
return distance;
|
||||
}
|
||||
|
||||
private List<WebwalkNode> dijkstraPathfinding(WebwalkNode start, Set<WebwalkNode> goals) {
|
||||
Map<WebwalkNode, Double> costFromStart = new HashMap<>();
|
||||
costFromStart.put(start, 0.0);
|
||||
@@ -233,6 +260,12 @@ public class WebWalker {
|
||||
return CustomLabelHandlers.varrockPalaceNorthwestLadder();
|
||||
case "varrockPalaceFence":
|
||||
return CustomLabelHandlers.varrockPalaceFence();
|
||||
case "varrockEastDigsiteGate":
|
||||
return CustomLabelHandlers.varrockEastDigsiteGate();
|
||||
case "wizardTowerDoor":
|
||||
return CustomLabelHandlers.wizardTowerDoor();
|
||||
case "wizardTowerBasement":
|
||||
return CustomLabelHandlers.wizardTowerBasement();
|
||||
default:
|
||||
Main.getController().log("Missing function for label: " + label);
|
||||
return false;
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package scripting.idlescript.AIOQuester;
|
||||
|
||||
import bot.Main;
|
||||
import controller.Controller;
|
||||
import scripting.idlescript.AIOQuester.models.*;
|
||||
import scripting.idlescript.IdleScript;
|
||||
|
||||
/**
|
||||
* This is the main entry point of AIOQuester. This class starts the setup ui which returns a
|
||||
* QuestDef. The script class for that QuestDef is then passed off to QuestHandler.start(class) to
|
||||
* actually run the script.
|
||||
*/
|
||||
public class AIOQuester extends IdleScript {
|
||||
protected static final Controller c = Main.getController();
|
||||
|
||||
/* TODO: Don't forget to set these to false before committing
|
||||
These are for testing quest stages and methods. There's obviously no way to reinitialize a
|
||||
certain dialog state with an npc apart from having server permissions to reset stages, so stage
|
||||
testing is only used for pathing/interacting with objects(unless they're stage-locked/etc...*/
|
||||
protected static final boolean TESTING_LOOP = false;
|
||||
public static final boolean SKIP_QUEST_DEFINED_CHECK = false;
|
||||
public static final boolean TESTING_QUESTS = false;
|
||||
public static final int TESTING_STAGE = 0;
|
||||
|
||||
public int start(String[] parameters) {
|
||||
QuestHandler.updateBankItems();
|
||||
setupAndRun();
|
||||
c.stop();
|
||||
return 1000;
|
||||
}
|
||||
|
||||
/** Starts the script ui; then passes the selected quest's script class to the QuestHandler. */
|
||||
private void setupAndRun() {
|
||||
QuestHandler.paintBuilder = null;
|
||||
QuestHandler.rowBuilder = null;
|
||||
QuestHandler.quest = null;
|
||||
|
||||
QuestDef quest = TESTING_LOOP ? QuestDef.loopTesting : QuestUI.showFrame();
|
||||
if (quest != null) {
|
||||
QuestHandler.paintBuilder = paintBuilder;
|
||||
QuestHandler.rowBuilder = rowBuilder;
|
||||
QuestHandler.quest = quest;
|
||||
if (TESTING_LOOP) {
|
||||
QuestHandler.startTestingLoop();
|
||||
} else {
|
||||
if (quest.getScript() == null) {
|
||||
System.out.println(
|
||||
"The quest: '" + quest.getName() + "' does not have a script class assigned to it");
|
||||
c.stop();
|
||||
}
|
||||
if (c.isRunning()) QuestHandler.start(quest.getScript());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverMessageInterrupt(String message) {
|
||||
// Do server message checks in the QuestHandler method instead of in here.
|
||||
QuestHandler.serverMessageInterrupt(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintInterrupt() {
|
||||
if (c != null) QuestHandler.drawPaint();
|
||||
}
|
||||
}
|
||||
+373
-494
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,346 @@
|
||||
package scripting.idlescript.AIOQuester;
|
||||
|
||||
import static scripting.idlescript.AIOQuester.AIOQuester.c;
|
||||
|
||||
import bot.Main;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import javax.swing.table.JTableHeader;
|
||||
import scripting.idlescript.AIOQuester.models.Quest;
|
||||
import scripting.idlescript.AIOQuester.models.QuestDef;
|
||||
|
||||
public class QuestUI {
|
||||
static final Color backgroundColor = Main.getThemeBackColor();
|
||||
static final Color foregroundColor = Main.getThemeTextColor();
|
||||
|
||||
static SpringLayout sl = new SpringLayout();
|
||||
static final JFrame frame = new JFrame("AIOQuester");
|
||||
static final JPanel panel = new JPanel();
|
||||
static final String[] columnNames = {"Quests"};
|
||||
static final DefaultTableModel tableModel = new DefaultTableModel(columnNames, 0);
|
||||
static JTable table =
|
||||
new JTable(tableModel) {
|
||||
@Override
|
||||
public boolean isCellEditable(int row, int column) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
static final JButton startBtn = new JButton("Select a quest");
|
||||
static final JTableHeader header = table.getTableHeader();
|
||||
static final JScrollPane questScroller = new JScrollPane(table);
|
||||
static final JTextPane descriptionTextPane = new JTextPane();
|
||||
static final JScrollPane descriptionScroller = new JScrollPane(descriptionTextPane);
|
||||
static final JLabel descLabel = new JLabel("Description");
|
||||
static ListSelectionModel selectionModel = table.getSelectionModel();
|
||||
static final JCheckBox showCanStartCheckbox = new JCheckBox("Show only start-able quests");
|
||||
|
||||
static boolean started;
|
||||
static QuestDef selected;
|
||||
|
||||
/**
|
||||
* Shows the script ui and waits for it to return a QuestDef
|
||||
*
|
||||
* @return QuestDef
|
||||
*/
|
||||
public static QuestDef showFrame() {
|
||||
selected = null;
|
||||
started = false;
|
||||
table.clearSelection();
|
||||
|
||||
panel.setLayout(sl);
|
||||
panel.add(startBtn);
|
||||
panel.add(questScroller);
|
||||
panel.add(descriptionScroller);
|
||||
panel.add(descLabel);
|
||||
panel.add(showCanStartCheckbox);
|
||||
setTheming();
|
||||
setConstraints();
|
||||
populateTable();
|
||||
|
||||
frame.add(panel);
|
||||
|
||||
frame.pack();
|
||||
frame.setLocationRelativeTo(null);
|
||||
frame.setVisible(true);
|
||||
|
||||
// Listeners
|
||||
selectionModel.addListSelectionListener(e -> tableSelectionChanged());
|
||||
startBtn.addActionListener(e -> buttonPressed());
|
||||
showCanStartCheckbox.addActionListener(e -> populateTable());
|
||||
|
||||
while (c.isRunning() && !started && frame.isVisible()) {
|
||||
c.sleep(640);
|
||||
}
|
||||
sl.removeLayoutComponent(frame);
|
||||
if (started) return selected;
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Populates the table with quests */
|
||||
private static void populateTable() {
|
||||
selected = null;
|
||||
descriptionTextPane.setText("");
|
||||
startBtn.setText("Select a quest");
|
||||
startBtn.setEnabled(false);
|
||||
tableModel.setRowCount(0);
|
||||
|
||||
boolean onlyStartable = showCanStartCheckbox.isSelected();
|
||||
System.out.println(
|
||||
onlyStartable ? "Showing quests with met requirements" : "Showing all available quests");
|
||||
ArrayList<QuestDef> quests = new ArrayList<>();
|
||||
for (Quest quest : Quest.values()) {
|
||||
QuestDef q = quest.getQuestDef();
|
||||
|
||||
if (onlyStartable) {
|
||||
if (q.isDisplayedStartable()) quests.add(q);
|
||||
} else {
|
||||
if (q.isQuestDefined()) quests.add(q);
|
||||
}
|
||||
}
|
||||
if (!quests.isEmpty()) quests.forEach(q -> tableModel.addRow(new String[] {q.getName()}));
|
||||
}
|
||||
|
||||
/** Manages the JFrame's, and its child components' theming */
|
||||
private static void setTheming() {
|
||||
frame.getContentPane().setBackground(backgroundColor);
|
||||
frame.getContentPane().setForeground(foregroundColor);
|
||||
frame.setResizable(false);
|
||||
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
frame.setPreferredSize(new Dimension(600, 400));
|
||||
|
||||
panel.setBackground(backgroundColor);
|
||||
panel.setForeground(foregroundColor);
|
||||
|
||||
startBtn.setEnabled(false);
|
||||
startBtn.setBackground(backgroundColor.darker());
|
||||
startBtn.setForeground(foregroundColor);
|
||||
|
||||
questScroller.setBackground(backgroundColor);
|
||||
questScroller.setForeground(foregroundColor);
|
||||
questScroller.getViewport().setBackground(backgroundColor.brighter());
|
||||
questScroller.setBorder(BorderFactory.createEmptyBorder());
|
||||
|
||||
descLabel.setFont(table.getTableHeader().getFont().deriveFont(Font.BOLD, 15f));
|
||||
descLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
descLabel.setBackground(backgroundColor);
|
||||
descLabel.setForeground(foregroundColor);
|
||||
|
||||
descriptionTextPane.setEditable(false);
|
||||
descriptionTextPane.setBackground(backgroundColor.brighter());
|
||||
descriptionTextPane.setForeground(foregroundColor);
|
||||
|
||||
descriptionScroller.setBackground(backgroundColor.brighter());
|
||||
descriptionScroller.setForeground(foregroundColor);
|
||||
descriptionScroller.setBorder(BorderFactory.createEmptyBorder());
|
||||
|
||||
showCanStartCheckbox.setBackground(backgroundColor);
|
||||
showCanStartCheckbox.setForeground(foregroundColor);
|
||||
showCanStartCheckbox.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
showCanStartCheckbox.setSelected(true);
|
||||
showCanStartCheckbox.setToolTipText(
|
||||
"<html>Shows only the quests that can be started by the player.<br>Completed quests and quests requiring missing skills or prerequisite quests are hidden.</html>");
|
||||
|
||||
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
table.setBorder(BorderFactory.createEmptyBorder());
|
||||
table.setBackground(backgroundColor.brighter());
|
||||
table.setForeground(foregroundColor);
|
||||
|
||||
header.setReorderingAllowed(false);
|
||||
header.setResizingAllowed(false);
|
||||
header.setFont(table.getTableHeader().getFont().deriveFont(Font.BOLD, 15f));
|
||||
header.setBackground(backgroundColor);
|
||||
header.setForeground(foregroundColor);
|
||||
header.setBorder(
|
||||
BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager.getColor("controlDkShadow")));
|
||||
header.setDefaultRenderer(
|
||||
new DefaultTableCellRenderer() {
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(
|
||||
JTable table,
|
||||
Object value,
|
||||
boolean isSelected,
|
||||
boolean hasFocus,
|
||||
int row,
|
||||
int column) {
|
||||
|
||||
JLabel label =
|
||||
(JLabel)
|
||||
super.getTableCellRendererComponent(
|
||||
table, value, isSelected, hasFocus, row, column);
|
||||
label.setBorder(
|
||||
BorderFactory.createMatteBorder(0, 0, 0, 0, UIManager.getColor("controlDkShadow")));
|
||||
label.setFont(header.getFont().deriveFont(Font.BOLD, 15f));
|
||||
label.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
label.setBackground(backgroundColor);
|
||||
return label;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** Manages the JFrame's SpringLayout constraints */
|
||||
private static void setConstraints() {
|
||||
// Set constraints for start button
|
||||
sl.putConstraint(SpringLayout.SOUTH, startBtn, -4, SpringLayout.SOUTH, panel);
|
||||
sl.putConstraint(SpringLayout.NORTH, startBtn, -24, SpringLayout.SOUTH, panel);
|
||||
sl.putConstraint(SpringLayout.WEST, startBtn, 4, SpringLayout.WEST, panel);
|
||||
sl.putConstraint(SpringLayout.EAST, startBtn, -4, SpringLayout.EAST, panel);
|
||||
|
||||
// Set constraints for the quest list
|
||||
int listWidth = (int) ((frame.getPreferredSize().getWidth() * .3) + 4);
|
||||
sl.putConstraint(SpringLayout.WIDTH, questScroller, listWidth, SpringLayout.WEST, panel);
|
||||
sl.putConstraint(SpringLayout.NORTH, questScroller, 4, SpringLayout.NORTH, panel);
|
||||
sl.putConstraint(SpringLayout.WEST, questScroller, 4, SpringLayout.WEST, panel);
|
||||
sl.putConstraint(SpringLayout.SOUTH, questScroller, -28, SpringLayout.SOUTH, startBtn);
|
||||
|
||||
// Set constraints for start-able checkbox
|
||||
sl.putConstraint(SpringLayout.SOUTH, showCanStartCheckbox, -4, SpringLayout.NORTH, startBtn);
|
||||
sl.putConstraint(SpringLayout.WEST, showCanStartCheckbox, 4, SpringLayout.EAST, questScroller);
|
||||
sl.putConstraint(SpringLayout.EAST, showCanStartCheckbox, -4, SpringLayout.EAST, panel);
|
||||
|
||||
// Set constraints for description label
|
||||
sl.putConstraint(SpringLayout.NORTH, descLabel, 6, SpringLayout.NORTH, panel);
|
||||
sl.putConstraint(SpringLayout.WEST, descLabel, 4, SpringLayout.EAST, questScroller);
|
||||
sl.putConstraint(SpringLayout.EAST, descLabel, -4, SpringLayout.EAST, panel);
|
||||
sl.putConstraint(SpringLayout.SOUTH, descLabel, 18, SpringLayout.NORTH, panel);
|
||||
|
||||
// Set constraints for description box
|
||||
sl.putConstraint(SpringLayout.NORTH, descriptionScroller, 3, SpringLayout.SOUTH, descLabel);
|
||||
sl.putConstraint(
|
||||
SpringLayout.SOUTH, descriptionScroller, -4, SpringLayout.NORTH, showCanStartCheckbox);
|
||||
sl.putConstraint(SpringLayout.EAST, descriptionScroller, -4, SpringLayout.EAST, panel);
|
||||
sl.putConstraint(SpringLayout.WEST, descriptionScroller, 4, SpringLayout.EAST, questScroller);
|
||||
}
|
||||
|
||||
private static void buttonPressed() {
|
||||
started = true;
|
||||
frame.dispose();
|
||||
}
|
||||
|
||||
private static void tableSelectionChanged() {
|
||||
if (table.getSelectedRow() > -1) {
|
||||
selected =
|
||||
Quest.getQuestDefFromName(String.valueOf(table.getValueAt(table.getSelectedRow(), 0)));
|
||||
}
|
||||
if (selected != null) {
|
||||
if (selected.isStartable()) {
|
||||
startBtn.setText("Start " + selected.getName());
|
||||
startBtn.setEnabled(true);
|
||||
} else {
|
||||
if (selected.getId() > -1 && c.getQuestStage(selected.getId()) == -1) {
|
||||
startBtn.setText(selected.getName() + " is already completed");
|
||||
|
||||
} else {
|
||||
startBtn.setText("Unable to start " + selected.getName());
|
||||
}
|
||||
startBtn.setEnabled(false);
|
||||
}
|
||||
updateDescription();
|
||||
}
|
||||
}
|
||||
|
||||
private static void updateDescription() {
|
||||
StringBuilder description = new StringBuilder(selected.getDescription());
|
||||
|
||||
// ✔ Leave this as a unicode escape sequence, or it'll apparently break on Windows
|
||||
@SuppressWarnings("UnnecessaryUnicodeEscape")
|
||||
String reqComplete = " \u2714";
|
||||
String reqUnknown = " ?";
|
||||
|
||||
if (selected.getRequiredQuests() != null && selected.getRequiredQuests().length > 0) {
|
||||
description.append("\n\nQuests Required: ");
|
||||
for (Quest quest : selected.getRequiredQuests()) {
|
||||
QuestDef def = quest.getQuestDef();
|
||||
description.append("\n - ").append(def.getName());
|
||||
if (!def.isMiniquest() && c.getQuestStage(def.getId()) == -1)
|
||||
description.append(reqComplete);
|
||||
if (def.isMiniquest()) description.append(" (Unable to check mini-quests)");
|
||||
}
|
||||
}
|
||||
|
||||
if (selected.getRequiredSkills() != null && selected.getRequiredSkills().length > 0) {
|
||||
description.append("\n\nLevels Required: ");
|
||||
for (int[] skill : selected.getRequiredSkills()) {
|
||||
String skillName = c.getSkillNamesLong()[skill[0]];
|
||||
String level = String.valueOf(skill[1]);
|
||||
description.append("\n - ").append(level).append(" ").append(skillName);
|
||||
if (c.getBaseStat(skill[0]) >= skill[1]) description.append(reqComplete);
|
||||
}
|
||||
}
|
||||
|
||||
if (selected.getRequiredEquippedItems() != null
|
||||
&& selected.getRequiredEquippedItems().length > 0) {
|
||||
description.append("\n\nEquipped Items Required: ");
|
||||
for (int[] item : selected.getRequiredEquippedItems()) {
|
||||
int id = item[0];
|
||||
int amount = item[1];
|
||||
String name = c.getItemName(item[0]);
|
||||
name = name.substring(0, 1).toUpperCase() + name.substring(1);
|
||||
description.append("\n - ");
|
||||
if (amount > 1) description.append(amount).append(" ");
|
||||
description.append(name);
|
||||
// TODO: Eventually add amount checking here for equipped ammunition amount
|
||||
if (c.isItemIdEquipped(id)) description.append(reqComplete);
|
||||
}
|
||||
}
|
||||
|
||||
if (selected.getRequiredInventoryItems() != null
|
||||
&& selected.getRequiredInventoryItems().length > 0) {
|
||||
description.append("\n\nInventory Items Required: ");
|
||||
for (int[] item : selected.getRequiredInventoryItems()) {
|
||||
int id = item[0];
|
||||
int amount = item[1];
|
||||
String name = c.getItemName(item[0]);
|
||||
name = name.substring(0, 1).toUpperCase() + name.substring(1);
|
||||
description.append("\n - ").append(amount).append(" ").append(name);
|
||||
if (c.getInventoryItemCount(id) >= amount) description.append(reqComplete);
|
||||
}
|
||||
}
|
||||
|
||||
if (selected.getRequiredBankItems() != null && selected.getRequiredBankItems().length > 0) {
|
||||
if (c.getPlayerMode() != 2 && QuestHandler.bankItems == null) {
|
||||
description.append("\n\nOPEN A BANK THEN RESTART THE SCRIPT TO POPULATE ITEMS");
|
||||
description.append("\nBanked Items Required: ");
|
||||
} else {
|
||||
description.append("\n\nBanked Items Required: ");
|
||||
}
|
||||
for (int[] item : selected.getRequiredBankItems()) {
|
||||
int id = item[0];
|
||||
int amount = item[1];
|
||||
String name = c.getItemName(item[0]);
|
||||
name = name.substring(0, 1).toUpperCase() + name.substring(1);
|
||||
|
||||
description.append("\n - ").append(amount).append(" ").append(name);
|
||||
|
||||
if (c.getPlayerMode() == 2) {
|
||||
description.append(" UIM");
|
||||
} else if (QuestHandler.bankItems == null) {
|
||||
description.append(reqUnknown);
|
||||
} else if (QuestHandler.bankItems.containsKey(id)
|
||||
&& QuestHandler.bankItems.get(id) >= amount) {
|
||||
description.append(reqComplete);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int neededQP = selected.getRequiredQuestPoints();
|
||||
if (neededQP > 0) {
|
||||
description.append("\n\nQuest Points Required: ").append(selected.getRequiredQuestPoints());
|
||||
if (neededQP > c.getQuestPoints()) {
|
||||
description.append(" (").append(c.getQuestPoints()).append(")");
|
||||
} else {
|
||||
description.append(reqComplete);
|
||||
}
|
||||
}
|
||||
|
||||
int neededSlots = selected.getRequiredEmptyInventorySlots();
|
||||
if (neededSlots > 0) {
|
||||
description.append("\n\nEmpty Inventory Slots Required: ").append(neededSlots);
|
||||
if (neededSlots <= 30 - c.getInventoryItemCount()) description.append(reqComplete);
|
||||
}
|
||||
|
||||
descriptionTextPane.setText(description.toString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,474 @@
|
||||
package scripting.idlescript.AIOQuester.models;
|
||||
|
||||
// TODO: Add more locations for the over-world
|
||||
|
||||
import bot.Main;
|
||||
import controller.Controller;
|
||||
import controller.WebWalker.WebWalker;
|
||||
import controller.WebWalker.WebwalkGraph;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Enum of locations useful for checking if the player is in a Location's boundary with
|
||||
* QuestHandler.isAtLocation()or Location.isAtLocation(), or walking to a location's standable tile
|
||||
* with QuestHandler.walkTowards() or Location.walkTowards().
|
||||
*/
|
||||
public enum Location {
|
||||
AL_KHARID_BORDER_GATE(
|
||||
new Boundary(88, 647, 91, 652), new Tile(80, 649), "Al-Kharid Gate to Lumbridge"),
|
||||
ARDOUGNE_MONASTERY(new Boundary(575, 651, 603, 669), new Tile(589, 653), "Ardougne Monastery"),
|
||||
ARDOUGNE_SOUTH_BANK(new Boundary(534, 605, 557, 619), new Tile(552, 613), "Ardougne South Bank"),
|
||||
BARBARIAN_OUTPOST_ENTRANCE(
|
||||
new Boundary(493, 538, 506, 555), new Tile(495, 544), "Barbarian Outpost Gate"),
|
||||
BARBARIAN_OUTPOST_INNER(
|
||||
new Boundary(485, 541, 493, 555), new Tile(491, 546), "Barbarian Outpost Inner"),
|
||||
BRIMHAVEN_SHRIMP_AND_PARROT(
|
||||
new Boundary(443, 679, 459, 692), new Tile(443, 679), "Shrimp and Parrot Pub"),
|
||||
CHAMPIONS_GUILD(new Boundary(148, 554, 152, 562), new Tile(150, 556), "Champion's Guild "),
|
||||
DWARF_TUNNEL_WEST_ENTRANCE(
|
||||
new Boundary(420, 450, 432, 464), new Tile(427, 457), "Dwarf Tunnel Western Entrance"),
|
||||
EDGEVILLE_MONASTERY(new Boundary(249, 456, 265, 472), new Tile(255, 464), "Edgeville Monastery"),
|
||||
FALADOR_WEST_BANK(new Boundary(328, 549, 334, 557), new Tile(328, 552), "Falador West Bank"),
|
||||
LUMBRIDGE_BOBS_AXES(new Boundary(122, 666, 124, 670), new Tile(122, 668), "Bob's Axe Shop"),
|
||||
LUMBRIDGE_BORDER_GATE(
|
||||
new Boundary(92, 647, 95, 652), new Tile(93, 649), "Lumbridge Gate to Al-Kharid"),
|
||||
LUMBRIDGE_CABBAGE_FIELD(
|
||||
new Boundary(137, 597, 153, 612), new Tile(145, 606), "Lumbridge Cabbage Field"),
|
||||
LUMBRIDGE_CASTLE_COURTYARD(
|
||||
new Boundary(120, 652, 128, 665), new Tile(126, 658), "Lumbridge Castle Courtyard"),
|
||||
LUMBRIDGE_CASTLE_DUKES_ROOM(
|
||||
new Boundary(129, 1601, 133, 1606), new Tile(132, 1603), "Lumbridge Duke's Room"),
|
||||
LUMBRIDGE_CASTLE_KITCHEN(
|
||||
new Boundary(131, 659, 137, 662), new Tile(135, 660), "Lumbridge Castle Kitchen"),
|
||||
LUMBRIDGE_CASTLE_SPINNING_WHEEL(
|
||||
new Boundary(136, 2552, 141, 2557), new Tile(138, 2554), "Lumbridge Spinning Wheel"),
|
||||
LUMBRIDGE_CHICKEN_PEN(
|
||||
new Boundary(115, 603, 122, 612), new Tile(117, 609), "Lumbridge Chicken Pen"),
|
||||
LUMBRIDGE_CHURCH(new Boundary(109, 660, 113, 669), new Tile(113, 664), "Lumbridge Church"),
|
||||
LUMBRIDGE_CORN_FIELD(
|
||||
new Boundary(157, 600, 163, 609), new Tile(160, 607), "Lumbridge Corn Field"),
|
||||
LUMBRIDGE_COW_PEN(new Boundary(96, 605, 104, 628), new Tile(103, 619), "Lumbridge Cow Pen"),
|
||||
LUMBRIDGE_FARMER_FREDS_HOUSE(
|
||||
new Boundary(157, 617, 161, 620), new Tile(159, 618), "Farmer Fred's House"),
|
||||
LUMBRIDGE_FURNACE(new Boundary(130, 626, 133, 630), new Tile(130, 628), "Lumbridge Furnace"),
|
||||
LUMBRIDGE_GENERAL_STORE(
|
||||
new Boundary(132, 642, 134, 643), new Tile(133, 642), "Lumbridge General Store"),
|
||||
LUMBRIDGE_GOBLIN_HUT(
|
||||
new Boundary(115, 628, 119, 632), new Tile(117, 630), "Lumbridge Goblin Hut"),
|
||||
LUMBRIDGE_GRAVEYARD(new Boundary(106, 666, 110, 676), new Tile(107, 675), "Lumbridge Graveyard"),
|
||||
LUMBRIDGE_MILL_F1(
|
||||
new Boundary(163, 597, 169, 603), new Tile(166, 601), "Lumbridge Mill Ground Floor"),
|
||||
LUMBRIDGE_MILL_F2(
|
||||
new Boundary(163, 1541, 169, 1547), new Tile(164, 1544), "Lumbridge Mill Second Floor"),
|
||||
LUMBRIDGE_MILL_F3(
|
||||
new Boundary(163, 2485, 169, 2491), new Tile(167, 2489), "Lumbridge Mill Third Floor"),
|
||||
LUMBRIDGE_MUMS_HOUSE(new Boundary(119, 664, 119, 667), new Tile(119, 666), "Mum's House"),
|
||||
LUMBRIDGE_ONION_FIELD(
|
||||
new Boundary(157, 621, 160, 623), new Tile(160, 621), "Lumbridge Onion Field"),
|
||||
LUMBRIDGE_POTATO_FIELD(
|
||||
new Boundary(95, 588, 103, 603), new Tile(102, 597), "Lumbridge Potato Field"),
|
||||
LUMBRIDGE_SHEEP_PEN(new Boundary(136, 618, 156, 633), new Tile(144, 630), "Lumbridge Sheep Pen"),
|
||||
LUMBRIDGE_SWAMP_KRESHS_HUT(
|
||||
new Boundary(156, 694, 159, 697), new Tile(157, 695), "Lumbridge Swamp Kresh's Hut"),
|
||||
LUMBRIDGE_SWAMP_LEPRECHAUN_TREE(
|
||||
new Boundary(171, 660, 173, 663), new Tile(173, 662), "Lumbridge Swamp Leprechaun Tree"),
|
||||
LUMBRIDGE_SWAMP_URHNEYS_HOUSE(
|
||||
new Boundary(115, 709, 118, 712),
|
||||
new Tile(116, 710),
|
||||
"Lumbridge Swamp Father Urhney's House"),
|
||||
LUMBRIDGE_SWAMP_ZANARIS_SHED(
|
||||
new Boundary(126, 685, 127, 687), new Tile(126, 686), "Lumbridge Swamp Zanaris Shed"),
|
||||
LUMBRIDGE_WHEAT_FIELD(
|
||||
new Boundary(170, 596, 178, 604), new Tile(172, 604), "Lumbridge Wheat Field"),
|
||||
MYSTERIOUS_RUINS_AIR(
|
||||
new Boundary(305, 592, 309, 596), new Tile(307, 592), "Air Altar Mysterious Ruins"),
|
||||
MYSTERIOUS_RUINS_BODY(
|
||||
new Boundary(258, 502, 262, 506), new Tile(261, 506), "Body Altar Mysterious Ruins"),
|
||||
MYSTERIOUS_RUINS_CHAOS(
|
||||
new Boundary(231, 374, 235, 378), new Tile(233, 378), "Chaos Altar Mysterious Ruins"),
|
||||
MYSTERIOUS_RUINS_EARTH(
|
||||
new Boundary(61, 463, 65, 467), new Tile(64, 467), "Earth Altar Mysterious Ruins"),
|
||||
MYSTERIOUS_RUINS_FIRE(
|
||||
new Boundary(49, 632, 53, 636), new Tile(53, 634), "Fire Altar Mysterious Ruins"),
|
||||
MYSTERIOUS_RUINS_MIND(
|
||||
new Boundary(296, 437, 300, 441), new Tile(298, 441), "Mind Altar Mysterious Ruins"),
|
||||
MYSTERIOUS_RUINS_NATURE(
|
||||
new Boundary(391, 803, 395, 807), new Tile(394, 803), "Nature Altar Mysterious Ruins"),
|
||||
MYSTERIOUS_RUINS_WATER(
|
||||
new Boundary(145, 682, 150, 687), new Tile(150, 684), "Water Altar Mysterious Ruins"),
|
||||
SORCERERS_TOWER(
|
||||
new Boundary(507, 505, 514, 511), new Tile(511, 508), "Sorcerers' Tower Ground Floor"),
|
||||
SORCERERS_TOWER_ABOVE(
|
||||
new Boundary(507, 1448, 514, 1458), new Tile(511, 1452), "Sorcerers' Tower 1st Floor "),
|
||||
TAVERLEY_DUNGEON_ENTRANCE_OUTER(
|
||||
new Boundary(371, 514, 384, 525), new Tile(377, 520), "Taverly Dungeon Entrance Outer"),
|
||||
VARROCK_ANVILS(new Boundary(145, 510, 148, 516), new Tile(148, 512), "Varrock Anvils"),
|
||||
VARROCK_APOTHECARY(new Boundary(141, 518, 145, 521), new Tile(143, 520), "Varrock Apothecary"),
|
||||
VARROCK_AUBURYS_SHOP(
|
||||
new Boundary(101, 522, 103, 525), new Tile(101, 525), "Varrock Aubury's Rune Shop"),
|
||||
VARROCK_BERRY_BUSHES_EAST(
|
||||
new Boundary(75, 530, 78, 536), new Tile(76, 533), "Varrock Berry Bushes East"),
|
||||
VARROCK_BERRY_BUSHES_SOUTH(
|
||||
new Boundary(81, 536, 87, 538), new Tile(84, 537), "Varrock Berry Bushes South"),
|
||||
VARROCK_BERRY_BUSHES_WEST(
|
||||
new Boundary(96, 536, 103, 538), new Tile(99, 537), "Varrock Berry Bushes West"),
|
||||
VARROCK_BLACK_ARM_GANG_ENTRANCE(
|
||||
new Boundary(145, 533, 151, 535), new Tile(148, 534), "Varrock Black Arm Gang"),
|
||||
VARROCK_BLUE_MOON_INN(
|
||||
new Boundary(120, 520, 126, 526), new Tile(122, 523), "Varrock Blue Moon Inn"),
|
||||
VARROCK_BLUE_MOON_INN_KITCHEN(
|
||||
new Boundary(116, 520, 119, 526), new Tile(117, 525), "Varrock Blue Moon Inn Kitchen"),
|
||||
VARROCK_BRASS_KEY_HUT(
|
||||
new Boundary(201, 481, 204, 484), new Tile(202, 482), "Varrock Brass Key Hut"),
|
||||
VARROCK_CASTLE_ALTAR(
|
||||
new Boundary(130, 1399, 137, 1403), new Tile(136, 1401), "Varrock Castle Altar"),
|
||||
VARROCK_CASTLE_COURTYARD(
|
||||
new Boundary(123, 478, 139, 486), new Tile(131, 483), "Varrock Castle Courtyard"),
|
||||
VARROCK_CASTLE_GARDEN(
|
||||
new Boundary(123, 487, 139, 499), new Tile(130, 493), "Varrock Castle Garden"),
|
||||
VARROCK_CASTLE_GUARD_BARRACKS(
|
||||
new Boundary(138, 1395, 142, 1408), new Tile(140, 1398), "Varrock Castle Guard Barracks"),
|
||||
VARROCK_CASTLE_KITCHEN(
|
||||
new Boundary(118, 461, 123, 468), new Tile(119, 465), "Varrock Castle Kitchen"),
|
||||
VARROCK_CASTLE_LIBRARY(
|
||||
new Boundary(126, 455, 134, 459), new Tile(128, 457), "Varrock Castle Library"),
|
||||
VARROCK_CASTLE_SIR_PRYSINS_ROOM(
|
||||
new Boundary(135, 472, 140, 477), new Tile(137, 474), "Varrock Castle Sir Prysin's Room"),
|
||||
VARROCK_CASTLE_THRONE_ROOM(
|
||||
new Boundary(124, 472, 128, 477), new Tile(126, 474), "Varrock Castle Throne Room"),
|
||||
VARROCK_CHURCH(
|
||||
new Boundary(98, 473, 106, 482), new Tile(100, 475), "Varrock Church Ground Floor"),
|
||||
VARROCK_CHURCH_SECOND_FLOOR(
|
||||
new Boundary(103, 1417, 105, 1420), new Tile(104, 1418), "Varrock Church Second Floor"),
|
||||
VARROCK_COOKS_GUILD(new Boundary(176, 480, 181, 487), new Tile(179, 483), "Cook's Guild"),
|
||||
VARROCK_DANCING_DONKEY_INN(
|
||||
new Boundary(89, 528, 94, 539), new Tile(91, 529), "Varrock Dancing Donkey Inn"),
|
||||
VARROCK_DIMINTHEIS_HOUSE(
|
||||
new Boundary(84, 521, 85, 523), new Tile(84, 522), "Varrock Dimintheis' House"),
|
||||
VARROCK_EAST_BANK(new Boundary(98, 510, 106, 515), new Tile(102, 512), "Varrock East Bank"),
|
||||
VARROCK_EAST_MINE(new Boundary(68, 542, 80, 550), new Tile(73, 545), "Varrock East Mine"),
|
||||
VARROCK_GENERAL_STORE(
|
||||
new Boundary(124, 513, 129, 517), new Tile(126, 515), "Varrock General Store"),
|
||||
VARROCK_GERTRUDES_HOUSE(
|
||||
new Boundary(163, 511, 168, 517), new Tile(165, 512), "Varrock Gertrude's House"),
|
||||
VARROCK_GUIDORS_HOUSE(
|
||||
new Boundary(79, 530, 86, 535), new Tile(85, 533), "Varrock Guidor's House"),
|
||||
VARROCK_HORVIKS_SHOP(
|
||||
new Boundary(113, 498, 119, 505), new Tile(117, 501), "Varrock Horvik's Shop"),
|
||||
VARROCK_JULIETS_HOUSE(
|
||||
new Boundary(165, 494, 174, 501), new Tile(168, 496), "Varrock Juliet's House"),
|
||||
VARROCK_LOWES_SHOP(
|
||||
new Boundary(113, 511, 116, 516), new Tile(114, 513), "Varrock Lowe's Archery Shop"),
|
||||
VARROCK_MARKET_SQUARE(
|
||||
new Boundary(126, 505, 137, 511), new Tile(134, 506), "Varrock Market Square"),
|
||||
VARROCK_MUSEUM(
|
||||
new Boundary(97, 484, 106, 496), new Tile(100, 494), "Varrock Museum Ground Floor"),
|
||||
VARROCK_MUSEUM_SECOND_FLOOR(
|
||||
new Boundary(97, 1428, 106, 1440), new Tile(100, 1433), "Varrock Museum Second Floor"),
|
||||
VARROCK_PHOENIX_GANG_ENTRANCE(
|
||||
new Boundary(106, 534, 107, 536), new Tile(106, 535), "Varrock Phoenix Gang Entrance"),
|
||||
VARROCK_SEWER_ENTRANCE(
|
||||
new Boundary(110, 473, 112, 475), new Tile(111, 475), "Varrock Sewer Entrance"),
|
||||
VARROCK_SHEEP_PEN(new Boundary(96, 560, 109, 570), new Tile(104, 566), "Varrock Sheep Pen"),
|
||||
VARROCK_SOUTH_ALTAR(new Boundary(96, 528, 101, 535), new Tile(98, 531), "Varrock South Altar"),
|
||||
VARROCK_SPIRIT_TREE(new Boundary(159, 452, 161, 454), new Tile(161, 453), "Varrock Spirit Tree"),
|
||||
VARROCK_STONE_CIRCLE(
|
||||
new Boundary(104, 545, 117, 558), new Tile(111, 553), "Varrock Stone Circle"),
|
||||
VARROCK_SWORD_SHOP(new Boundary(133, 522, 138, 527), new Tile(134, 525), "Varrock Sword Shop"),
|
||||
VARROCK_TAILORS_HOUSE(
|
||||
new Boundary(82, 524, 85, 526), new Tile(84, 525), "Varrock Tailor's House"),
|
||||
VARROCK_THESSALIAS_SHOP(
|
||||
new Boundary(136, 515, 139, 516), new Tile(137, 516), "Varrock Thessalia's Clothes Shop"),
|
||||
VARROCK_TRAINING_ROOM(
|
||||
new Boundary(101, 499, 107, 505), new Tile(104, 502), "Varrock Training Room"),
|
||||
VARROCK_WEST_BANK(new Boundary(147, 499, 153, 506), new Tile(150, 502), "Varrock West Bank"),
|
||||
VARROCK_WEST_BANK_BASEMENT(
|
||||
new Boundary(147, 3330, 152, 3332), new Tile(149, 3332), "Varrock West Bank Basement"),
|
||||
VARROCK_WEST_MINE(new Boundary(160, 531, 169, 548), new Tile(161, 541), "Varrock West Mine"),
|
||||
VARROCK_WHEAT_FIELD(new Boundary(129, 558, 136, 569), new Tile(131, 559), "Varrock Wheat Field"),
|
||||
VARROCK_ZAFFS_SHOP(
|
||||
new Boundary(138, 503, 142, 506), new Tile(140, 505), "Varrock Zaff's Staff Shop"),
|
||||
WIZARDS_TOWER_BASEMENT(
|
||||
new Boundary(213, 3514, 225, 3526), new Tile(220, 3519), "Wizards' Tower Basement"),
|
||||
WIZARDS_TOWER_ENTRANCE(
|
||||
new Boundary(214, 684, 220, 688), new Tile(217, 687), "Wizards' Tower Entrance");
|
||||
|
||||
// MYSTERIOUS_RUINS_COSMIC(new Boundary(), new Tile(), "Cosmic Altar Mysterious Ruins"),
|
||||
// MYSTERIOUS_RUINS_LAW(new Boundary(), new Tile(), "Law Altar Mysterious Ruins"), NOT ADDED
|
||||
// MYSTERIOUS_RUINS_DEATH(new Boundary(), new Tile(), "Death Altar Mysterious Ruins"), NOT ADDED
|
||||
// MYSTERIOUS_RUINS_BLOOD(new Boundary(), new Tile(), "Blood Altar Mysterious Ruins"), NOT ADDED
|
||||
|
||||
// TREE_GNOME_STRONGHOLD_SPIRIT_TREE(new Boundary(), new Tile(), "Tree Gnome Stronghold Spirit
|
||||
// Tree"),
|
||||
// TREE_GNOME_VILLAGE_SPIRIT_TREE(new Boundary(), new Tile(), "Tree Gnome Village Spirit Tree"),
|
||||
// BATTLEFIELD_SPIRIT_TREE(new Boundary(), new Tile(), "Battlefield Spirit Tree"),
|
||||
|
||||
private static final Controller c = Main.getController();
|
||||
private static final WebWalker w = new WebWalker(new WebwalkGraph("assets/map/graph.txt"));
|
||||
private final Boundary boundary;
|
||||
private final Tile standableTile;
|
||||
private final String description;
|
||||
|
||||
/**
|
||||
* @param boundary Boundary - Rectangular area that makes up the location
|
||||
* @param standableTile Tile - Standable tile within the boundary
|
||||
* @param description String - Description of the location
|
||||
*/
|
||||
Location(Boundary boundary, Tile standableTile, String description) {
|
||||
this.boundary = sortBoundary(boundary);
|
||||
// If a location's standable tile is null, it will default to the first corner of its boundary
|
||||
this.standableTile =
|
||||
standableTile != null
|
||||
? new Tile(standableTile.getX(), standableTile.getY())
|
||||
: new Tile(this.boundary.getX1(), this.boundary.getY1());
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to walk towards the specified location's standable tile. If this fails, WebWalker may
|
||||
* need to be updated to support the location you're attempting to navigate to.
|
||||
*/
|
||||
public void walkTowards() {
|
||||
if (c.isRunning()) {
|
||||
int x = getX();
|
||||
int y = getY();
|
||||
if (notAtCoords(x, y)) {
|
||||
c.displayMessage(
|
||||
"@yel@Attempting to walk to: @cya@" + Location.getDescriptionFromStandableTile(x, y));
|
||||
System.out.println(
|
||||
"\nAttempting to walk to: " + Location.getDescriptionFromStandableTile(x, y));
|
||||
System.out.println(
|
||||
"If this fails, WebWalker might need to be updated to include the area.");
|
||||
int failedAttempts = 0;
|
||||
while (notAtCoords(x, y) && c.isRunning()) {
|
||||
failedAttempts = !c.walkTowards(x, y) ? ++failedAttempts : 0;
|
||||
if (failedAttempts >= 5) {
|
||||
c.log("Failed to walk to specified location. WebWalker may need to be updated.", "red");
|
||||
c.stop();
|
||||
}
|
||||
c.sleep(100);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to walk to the closest Location in an array of Locations.
|
||||
*
|
||||
* @param locations Location[] -- Array of locations
|
||||
*/
|
||||
public static void walkTowardsClosest(Location[] locations) {
|
||||
if (locations == null) return;
|
||||
getClosest(locations).walkTowards();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the closest Location from a given array of Locations.
|
||||
*
|
||||
* @param locations Location[] -- Array of locations to check
|
||||
* @return Location
|
||||
*/
|
||||
private static Location getClosest(Location[] locations) {
|
||||
if (locations == null) return null;
|
||||
Map<Location, Integer> locationMap =
|
||||
Arrays.stream(locations).collect(Collectors.toMap(l -> l, Location::distanceTo));
|
||||
return Collections.min(locationMap.entrySet(), Comparator.comparingInt(Map.Entry::getValue))
|
||||
.getKey();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a rough Geodesic distance from the player's current position to the standable tile of
|
||||
* the Location. Geodesic distance is the distance between two points while considering terrain
|
||||
* and navigability.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public int distanceTo() {
|
||||
return w.distanceBetween(c.currentX(), c.currentY(), getX(), getY());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a rough Geodesic distance from this Location to a second Location. Geodesic distance is
|
||||
* the distance between two points while considering terrain and navigability.
|
||||
*
|
||||
* @param loc Location -- Location to check
|
||||
* @return int
|
||||
*/
|
||||
public int distanceBetween(Location loc) {
|
||||
return w.distanceBetween(loc.getX(), loc.getY(), getX(), getY());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a rough Geodesic distance between two locations. Geodesic distance is the distance
|
||||
* between two points while considering terrain and navigability.
|
||||
*
|
||||
* @param loc1 Location -- Location to check
|
||||
* @param loc2 Location -- Location to check
|
||||
* @return int
|
||||
*/
|
||||
public static int distanceBetween(Location loc1, Location loc2) {
|
||||
return w.distanceBetween(loc1.getX(), loc1.getY(), loc2.getX(), loc2.getY());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the player is not at the specified coordinates.
|
||||
*
|
||||
* @param x int -- X Coordinate
|
||||
* @param y int -- Y Coordinate
|
||||
* @return boolean
|
||||
*/
|
||||
private static boolean notAtCoords(int x, int y) {
|
||||
return c.currentX() != x || c.currentY() != y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Location's Boundary
|
||||
*
|
||||
* @return Boundary
|
||||
*/
|
||||
private Boundary getBoundary() {
|
||||
return boundary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the X coordinate of the Location's standable tile.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public int getX() {
|
||||
return standableTile.getX();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Y coordinate of the Location's standable tile.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public int getY() {
|
||||
return standableTile.getY();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of a start location
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the coordinates of the boundary so that the first coordinate pair is always lower than
|
||||
* the second.
|
||||
*
|
||||
* @param boundary Boundary -- Boundary to sort
|
||||
* @return Boundary
|
||||
*/
|
||||
private static Boundary sortBoundary(Boundary boundary) {
|
||||
int x1 = Math.min(boundary.getX1(), boundary.getX2());
|
||||
int y1 = Math.min(boundary.getY1(), boundary.getY2());
|
||||
int x2 = Math.max(boundary.getX1(), boundary.getX2());
|
||||
int y2 = Math.max(boundary.getY1(), boundary.getY2());
|
||||
return new Boundary(x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the player is within the Location's boundary rectangle.
|
||||
*
|
||||
* @param loc Location -- Location to check
|
||||
* @return boolean
|
||||
*/
|
||||
public static boolean isAtLocation(Location loc) {
|
||||
int cX = c.currentX();
|
||||
int cY = c.currentY();
|
||||
Boundary b = loc.getBoundary();
|
||||
|
||||
return cX >= b.getX1() && cX <= b.getX2() && cY >= b.getY1() && cY <= b.getY2();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the player is within the Location's boundary rectangle.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean isAtLocation() {
|
||||
int cX = c.currentX();
|
||||
int cY = c.currentY();
|
||||
Boundary b = getBoundary();
|
||||
|
||||
return cX >= b.getX1() && cX <= b.getX2() && cY >= b.getY1() && cY <= b.getY2();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns either the description of a Location with a matching standable tile, or (X, Y)
|
||||
* coordinates as a string.
|
||||
*
|
||||
* @param x int - X coordinate to check for description
|
||||
* @param y int - Y coordinate to check for description
|
||||
* @return String - Location description
|
||||
*/
|
||||
public static String getDescriptionFromStandableTile(int x, int y) {
|
||||
return Arrays.stream(Location.values())
|
||||
.filter(loc -> loc.getX() == x && loc.getY() == y)
|
||||
.findFirst()
|
||||
.map(Location::getDescription)
|
||||
.orElse(String.format("(%s, %s)", x, y));
|
||||
}
|
||||
}
|
||||
|
||||
class Boundary {
|
||||
private final int x1;
|
||||
private final int y1;
|
||||
private final int x2;
|
||||
private final int y2;
|
||||
|
||||
Boundary(int x1, int y1, int x2, int y2) {
|
||||
this.x1 = x1;
|
||||
this.y1 = y1;
|
||||
this.x2 = x2;
|
||||
this.y2 = y2;
|
||||
}
|
||||
|
||||
public int getX1() {
|
||||
return x1;
|
||||
}
|
||||
|
||||
public int getY1() {
|
||||
return y1;
|
||||
}
|
||||
|
||||
public int getX2() {
|
||||
return x2;
|
||||
}
|
||||
|
||||
public int getY2() {
|
||||
return y2;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return String.format("(%s, %s), (%s, %s)", x1, y1, x2, y2);
|
||||
}
|
||||
}
|
||||
|
||||
class Tile {
|
||||
private final int x;
|
||||
private final int y;
|
||||
|
||||
Tile(int x, int y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return String.format("(%s, %s)", x, y);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,899 @@
|
||||
package scripting.idlescript.AIOQuester.models;
|
||||
|
||||
import java.util.Arrays;
|
||||
import models.entities.ItemId;
|
||||
import models.entities.QuestId;
|
||||
import models.entities.SkillId;
|
||||
import scripting.idlescript.AIOQuester.quests.*;
|
||||
|
||||
// TODO: Add support for UIMs in quests requiring banked items
|
||||
// TODO: Add descriptions for last few QuestDefs in Quest enum
|
||||
|
||||
// While mini-quests can be added to requiredQuests there is no way to check them via controller.
|
||||
// If the only missing requirement for a quest is the mini-quest, the quest can be started.
|
||||
// You must add checking for the miniquest in its corresponding quest script.
|
||||
|
||||
public enum Quest {
|
||||
BLACK_KNIGHTS_FORTRESS(
|
||||
new QuestDef(
|
||||
"Black Knight's Fortress",
|
||||
QuestId.BLACK_KNIGHTS_FORTRESS.getId(),
|
||||
false,
|
||||
"The black knights are up to no good. You are hired by the white knights to spy on them and uncover their evil scheme.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
12,
|
||||
null)),
|
||||
COOKS_ASSISTANT(
|
||||
new QuestDef(
|
||||
"Cook's Assistant",
|
||||
QuestId.COOKS_ASSISTANT.getId(),
|
||||
false,
|
||||
"The lumbridge castle cook is in a mess. It is the duke of Lumbridge's birthday and the cook is making the cake. He needs a lot of ingredients and doesn't have much time.",
|
||||
1,
|
||||
Location.LUMBRIDGE_CASTLE_COURTYARD,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
4,
|
||||
0,
|
||||
CooksAssistant.class)),
|
||||
DEMON_SLAYER(
|
||||
new QuestDef(
|
||||
"Demon Slayer",
|
||||
QuestId.DEMON_SLAYER.getId(),
|
||||
false,
|
||||
"A mighty demon is being summoned to destroy the city of Varrock. You find out you are the one destined to stop him.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
DORICS_QUEST(
|
||||
new QuestDef(
|
||||
"Doric's Quest",
|
||||
QuestId.DORICS_QUEST.getId(),
|
||||
false,
|
||||
"Doric the dwarf is happy to let you use his anvils but first he would like you to run an errand for him.",
|
||||
1,
|
||||
Location.FALADOR_WEST_BANK,
|
||||
null,
|
||||
new int[][] {{SkillId.MINING.getId(), 15}},
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
13,
|
||||
0,
|
||||
DoricsQuest.class)),
|
||||
THE_RESTLESS_GHOST(
|
||||
new QuestDef(
|
||||
"The Restless Ghost",
|
||||
QuestId.THE_RESTLESS_GHOST.getId(),
|
||||
false,
|
||||
"A ghost is haunting Lumbridge graveyard. The priest of the Lumbridge church of Saradomin wants you to find out how to get rid of it.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
GOBLIN_DIPLOMACY(
|
||||
new QuestDef(
|
||||
"Goblin Diplomacy",
|
||||
QuestId.GOBLIN_DIPLOMACY.getId(),
|
||||
false,
|
||||
"There's a disturbance in the goblin village. Help the goblins solve their dispute so the world doesn't have to worry about rioting goblins.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
ERNEST_THE_CHICKEN(
|
||||
new QuestDef(
|
||||
"Ernest the Chicken",
|
||||
QuestId.ERNEST_THE_CHICKEN.getId(),
|
||||
false,
|
||||
"Veronica is very worried. Her fiancee went into the big spooky manor house to ask for directions. An hour later and he's still not out yet.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
IMP_CATCHER(
|
||||
new QuestDef(
|
||||
"Imp Catcher",
|
||||
QuestId.IMP_CATCHER.getId(),
|
||||
false,
|
||||
"The Wizard Grayzag has summoned hundreds of little imps. They have stolen a lot of things belonging to the Wizard Mizgog including his magic beads.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
PIRATES_TREASURE(
|
||||
new QuestDef(
|
||||
"Pirate's Treasure",
|
||||
QuestId.PIRATES_TREASURE.getId(),
|
||||
false,
|
||||
"Redbeard Frank knows where secret pirate treasure is hidden, it may require some work to persuade him to let you know where though.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
PRINCE_ALI_RESCUE(
|
||||
new QuestDef(
|
||||
"Prince Ali Rescue",
|
||||
QuestId.PRINCE_ALI_RESCUE.getId(),
|
||||
false,
|
||||
"Prince Ali of Al Kharid has been kidnapped by the scheming Lady Keli. You are hired to stage a rescue mission.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
ROMEO_AND_JULIET(
|
||||
new QuestDef(
|
||||
"Romeo and Juliet",
|
||||
QuestId.ROMEO_AND_JULIET.getId(),
|
||||
false,
|
||||
"Romeo & Juliet are desperately in love, but Juliet's father doesn't approve. Help them to find a way to get married and live happily ever after.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
SHEEP_SHEARER(
|
||||
new QuestDef(
|
||||
"Sheep Shearer",
|
||||
QuestId.SHEEP_SHEARER.getId(),
|
||||
false,
|
||||
"Farmer Fred's sheep are getting mighty woolly. He will pay you to shear them.",
|
||||
1,
|
||||
Location.LUMBRIDGE_CASTLE_COURTYARD,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
21,
|
||||
0,
|
||||
SheepShearer.class)),
|
||||
SHIELD_OF_ARRAV(
|
||||
new QuestDef(
|
||||
"Shield of Arrav",
|
||||
QuestId.SHIELD_OF_ARRAV.getId(),
|
||||
false,
|
||||
"Varrocian literature tells of a valuable shield stolen from long ago the museum of Varrock by a gang of professional thieves. See if you can track down this shield and return it to the museum. You will need a friend to help you complete this quest.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
THE_KNIGHTS_SWORD(
|
||||
new QuestDef(
|
||||
"The Knight's Sword",
|
||||
QuestId.THE_KNIGHTS_SWORD.getId(),
|
||||
false,
|
||||
"Sir Vyvin's squire is in trouble. He has lost Sir Vyvin's ceremonial sword. Help him find a replacement without Sir Vyvin finding out.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
VAMPIRE_SLAYER(
|
||||
new QuestDef(
|
||||
"Vampire Slayer",
|
||||
QuestId.VAMPIRE_SLAYER.getId(),
|
||||
false,
|
||||
"The people of Draynor village live in constant terror. Their numbers are dwindling, all due to the foul creature lurking in the manor to the north known as a vampire.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
WITCHS_POTION(
|
||||
new QuestDef(
|
||||
"Witch's Potion",
|
||||
QuestId.WITCHS_POTION.getId(),
|
||||
false,
|
||||
"Become one with your darker side. Tap into your hidden depths of magical potential by making a potion with the help of Hetty the Rimmington witch.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
DRAGON_SLAYER(
|
||||
new QuestDef(
|
||||
"Dragon Slayer",
|
||||
QuestId.DRAGON_SLAYER.getId(),
|
||||
false,
|
||||
"Prove yourself a true hero. Kill the mighty dragon Elvarg of Crandor Island and earn the right to buy and wear the powerful rune plate mail body.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
32,
|
||||
null)),
|
||||
WITCHS_HOUSE(
|
||||
new QuestDef(
|
||||
"Witch's House",
|
||||
QuestId.WITCHS_HOUSE.getId(),
|
||||
false,
|
||||
"A young boy who lives in Taverley has kicked his ball into the garden of a scary old lady. He asks you to get it back for him. This proves more difficult than it first sounds.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
LOST_CITY(
|
||||
new QuestDef(
|
||||
"Lost City",
|
||||
QuestId.LOST_CITY.getId(),
|
||||
false,
|
||||
"Legends tell of a magical lost city hidden in the swamps. Many adventurers have tried to find this city, but it is proving difficult. Can you unlock the secrets of the city of Zanaris?",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
HEROS_QUEST(
|
||||
new QuestDef(
|
||||
"Hero's Quest",
|
||||
QuestId.HEROS_QUEST.getId(),
|
||||
false,
|
||||
"Prove you are worthy to enter the hero's guild. To prove your status as a hero you will need to obtain a number of items. There are many challenges standing between you and these items.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
55,
|
||||
null)),
|
||||
DRUIDIC_RITUAL(
|
||||
new QuestDef(
|
||||
"Druidic Ritual",
|
||||
QuestId.DRUIDIC_RITUAL.getId(),
|
||||
false,
|
||||
"To start using the herblaw skill you will need to ask for some training from the druids. However they require some help with a ritual before they will help you.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
MERLINS_CRYSTAL(
|
||||
new QuestDef(
|
||||
"Merlin's Crystal",
|
||||
QuestId.MERLINS_CRYSTAL.getId(),
|
||||
false,
|
||||
"Merlin the wizard has carelessly become imprisoned inside a giant crystal. Take up king Arthur's quest to free Merlin and become one of the knights of the round table.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
BARCRAWL(
|
||||
new QuestDef(
|
||||
"Alfred Grimhand Bar Crawl",
|
||||
-1,
|
||||
true,
|
||||
"Add a quest description here",
|
||||
-1,
|
||||
Location.BARBARIAN_OUTPOST_ENTRANCE,
|
||||
null,
|
||||
null,
|
||||
new int[][] {{ItemId.COINS.getId(), 1000}},
|
||||
null,
|
||||
null,
|
||||
5,
|
||||
0,
|
||||
BarCrawl.class)),
|
||||
SCORPION_CATCHER(
|
||||
new QuestDef(
|
||||
"Scorpion Catcher",
|
||||
QuestId.SCORPION_CATCHER.getId(),
|
||||
false,
|
||||
"Thormac has lost his rare lesser kharid scorpions after leaving their cage door open. These scorpions have hidden in areas that are rather difficult to get into. You will have to overcome various challenges (and drink a lot of beer) to get all the scorpions back If you manage to help him Thormac will improve your battle staffs.",
|
||||
2,
|
||||
Location.SORCERERS_TOWER,
|
||||
new Quest[] {BARCRAWL},
|
||||
new int[][] {{SkillId.PRAYER.getId(), 31}, {SkillId.AGILITY.getId(), 70}},
|
||||
new int[][] {{ItemId.COINS.getId(), 1000}},
|
||||
new int[][] {{ItemId.ANTI_DRAGON_BREATH_SHIELD.getId(), 1}},
|
||||
null,
|
||||
5,
|
||||
0,
|
||||
ScorpionCatcher.class)),
|
||||
FAMILY_CREST(
|
||||
new QuestDef(
|
||||
"Family Crest",
|
||||
QuestId.FAMILY_CREST.getId(),
|
||||
false,
|
||||
"The Fitzharmon family crest has gone missing, and the family honour has been lost. Can you find the crest and return it to Dimintheis in Varrock? There are 3 different rewards available, but you can only choose one, so choose carefully!",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
TRIBAL_TOTEM(
|
||||
new QuestDef(
|
||||
"Tribal Totem",
|
||||
QuestId.TRIBAL_TOTEM.getId(),
|
||||
false,
|
||||
"Lord Handelmort of Ardougne is collector of exotic artifacts. A recent addition to his private collection is a strange looking totem from Karamja. The Rantuki tribe are not happy about the recent disappearance of their totem.",
|
||||
2,
|
||||
Location.ARDOUGNE_SOUTH_BANK,
|
||||
null,
|
||||
new int[][] {{SkillId.THIEVING.getId(), 21}},
|
||||
new int[][] {{ItemId.COINS.getId(), 1000}},
|
||||
null,
|
||||
null,
|
||||
5,
|
||||
0,
|
||||
TribalTotem.class)),
|
||||
FISHING_CONTEST(
|
||||
new QuestDef(
|
||||
"Fishing Contest",
|
||||
QuestId.FISHING_CONTEST.getId(),
|
||||
false,
|
||||
"The mountain Dwarves home would be an ideal way to get across White Wolf mountain safely. However the Dwarves aren't to fond of strangers. They will let you through if you can bring them a trophy. The trophy is the prize for the annual Hemenster fishing competition.",
|
||||
3,
|
||||
Location.DWARF_TUNNEL_WEST_ENTRANCE,
|
||||
null,
|
||||
new int[][] {{SkillId.FISHING.getId(), 10}},
|
||||
new int[][] {{ItemId.COINS.getId(), 1000}},
|
||||
null,
|
||||
null,
|
||||
10,
|
||||
0,
|
||||
FishingContest.class)),
|
||||
MONKS_FRIEND(
|
||||
new QuestDef(
|
||||
"Monk's Friend",
|
||||
QuestId.MONKS_FRIEND.getId(),
|
||||
false,
|
||||
"A monk's child has had their blanket stolen. Find the thieves' den and return the blanket, then help Brother Omad organise the drinks for the child's birthday party.",
|
||||
4,
|
||||
Location.ARDOUGNE_MONASTERY,
|
||||
null,
|
||||
null,
|
||||
new int[][] {{ItemId.BRONZE_AXE.getId(), 1}},
|
||||
null,
|
||||
null,
|
||||
5,
|
||||
0,
|
||||
MonksFriend.class)),
|
||||
TEMPLE_OF_IKOV(
|
||||
new QuestDef(
|
||||
"Temple of Ikov",
|
||||
QuestId.TEMPLE_OF_IKOV.getId(),
|
||||
false,
|
||||
"A mysterious stranger called Lucien asks you to go on a mission deep under the Temple of Ikov in central Kandarin. He wants you to retrieve an artifact known as the Staff of Armadyl. Towards the end of the quest you are presented with a choice on how to complete the quest.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
CLOCK_TOWER(
|
||||
new QuestDef(
|
||||
"Clock Tower",
|
||||
QuestId.CLOCK_TOWER.getId(),
|
||||
false,
|
||||
"Help the confused Brother Kojo find the missing cogs and fix his watch tower. Search the dungeon using brawn and brains to correctly place the four cogs.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
THE_HOLY_GRAIL(
|
||||
new QuestDef(
|
||||
"The Holy Grail",
|
||||
QuestId.THE_HOLY_GRAIL.getId(),
|
||||
false,
|
||||
"King Arthur is sending out his knights on a quest for the famous holy grail. If you are a knight of the round table go to king Arthur for further orders.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
FIGHT_ARENA(
|
||||
new QuestDef(
|
||||
"Fight Arena",
|
||||
QuestId.FIGHT_ARENA.getId(),
|
||||
false,
|
||||
"The prosperous Servil family have been abducted by the infamous General Khazard. He plans to have the family battle for his entertainment in the fight arena. Can you rescue the Servil's before the tyrant has these innocent (not to mention wealthy) civilians slain.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
TREE_GNOME_VILLAGE(
|
||||
new QuestDef(
|
||||
"Tree Gnome Village",
|
||||
QuestId.TREE_GNOME_VILLAGE.getId(),
|
||||
false,
|
||||
"The tree gnomes are in trouble. General Khazard's forces are hunting them to extinction. Find you way through the hedge maze to the gnomes secret treetop village. Then help the gnomes fight Khazard and retrieve the orbs of protection.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
THE_HAZEEL_CULT(
|
||||
new QuestDef(
|
||||
"The Hazeel Cult",
|
||||
QuestId.THE_HAZEEL_CULT.getId(),
|
||||
true,
|
||||
"Discover the truth behind the Carnillean family fortune. Decide for yourself whether to aid the Carnilleans in retrieving stolen goods, or join the Hazeel cult members in their mission to resurrect the infamous Lord Hazeel.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
SHEEP_HERDER(
|
||||
new QuestDef(
|
||||
"Sheep Herder",
|
||||
QuestId.SHEEP_HERDER.getId(),
|
||||
false,
|
||||
"Some plague infected sheep have escaped into East Ardounge. They must be found and disposed off before the whole town is infected, time is of the essence.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
PLAGUE_CITY(
|
||||
new QuestDef(
|
||||
"Plague City",
|
||||
QuestId.PLAGUE_CITY.getId(),
|
||||
false,
|
||||
"A shadow of disease has overcast Ardounge. Edmond's daughter Elena has gone missing in West Ardougne whilst trying to help the plague victims there. See if you can find out what's going on.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
SEA_SLUG(
|
||||
new QuestDef(
|
||||
"Sea Slug",
|
||||
QuestId.SEA_SLUG.getId(),
|
||||
false,
|
||||
"Something strange is happening on the fishing platform. Missing fishermen and the presence of dozens of strange sea creatures gives cause for concern. Investigate the platform, discover the truth before it's too late.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
WATERFALL_QUEST(
|
||||
new QuestDef(
|
||||
"Waterfall Quest",
|
||||
QuestId.WATERFALL_QUEST.getId(),
|
||||
false,
|
||||
"Investigate the death of elven leaders of old. Search for the elf king Baxtorian's tomb and discover the mysterious hidden treasure of the waterfall.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
BIOHAZARD(
|
||||
new QuestDef(
|
||||
"Biohazard",
|
||||
QuestId.BIOHAZARD.getId(),
|
||||
false,
|
||||
"Second part of an ongoing adventure. Help Elena discover the truth about the infamous Ardounge plague. Smuggle test samples across Ardounge to Elena's old mentor.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
JUNGLE_POTION(
|
||||
new QuestDef(
|
||||
"Jungle Potion",
|
||||
QuestId.JUNGLE_POTION.getId(),
|
||||
false,
|
||||
"Trufitus Shakaya of the Tai Bwo Wannai Village requires that you collect five special jungle herbs for a potion so he can commune with his Gods.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
GRAND_TREE(
|
||||
new QuestDef(
|
||||
"Grand Tree",
|
||||
QuestId.GRAND_TREE.getId(),
|
||||
false,
|
||||
"The Grand Tree, which shelters the majority of RuneScape's small gnome population, is dying. Is it human sabotage or an inside job? Help King Shareem to find the true cause and save the tree gnomes from an uncertain fate.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
SHILO_VILLAGE(
|
||||
new QuestDef(
|
||||
"Shilo Village",
|
||||
QuestId.SHILO_VILLAGE.getId(),
|
||||
false,
|
||||
"New areas in the Southern part of Karamja Island have been discovered with a mysterious village. Who knows what hidden treasures exist, and what dangers lurk to guard them?",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
UNDERGROUND_PASS(
|
||||
new QuestDef(
|
||||
"Underground Pass",
|
||||
QuestId.UNDERGROUND_PASS.getId(),
|
||||
false,
|
||||
"The Underground Pass, sealed for thousands of years, has now been reopened to reveal a complex labyrinth of tunnels and chasms. You must find a way through, and get one step closer to the evil King Tyras. But the road is long and it could be lonely. When fatigue starts to take it's toll, mental strength is what you'll need...",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
OBSERVATORY_QUEST(
|
||||
new QuestDef(
|
||||
"Observatory Quest",
|
||||
QuestId.OBSERVATORY_QUEST.getId(),
|
||||
false,
|
||||
"The observatory in South West Ardougne has been ransacked by a family of nearby goblins. Can you help the professors to rebuild it?\n\nUse your skills at crafting to make the various parts, and fight your way through the cavern under the observatory. Use the telescope and the stars hold a secret for you.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
TOURIST_TRAP(
|
||||
new QuestDef(
|
||||
"Tourist Trap",
|
||||
QuestId.TOURIST_TRAP.getId(),
|
||||
false,
|
||||
"South of Al Kharid a new Desert Pass has opened up, leading to the dangers of the Kharid desert.\n\nDon your desert garb and make sure your waterskin is full before heading off into the trackless dunes in search of desert adventure.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
WATCHTOWER(
|
||||
new QuestDef(
|
||||
"Watchtower",
|
||||
QuestId.WATCHTOWER.getId(),
|
||||
false,
|
||||
"The Wizards of the Yanille Watch Tower have been reporting increased ogre sightings recently. Use a wide variety of your skills to help the wizards recover their stolen power crystals and stop the advance of the ogre hordes!",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
DWARF_CANNON(
|
||||
new QuestDef(
|
||||
"Dwarf Cannon",
|
||||
QuestId.DWARF_CANNON.getId(),
|
||||
false,
|
||||
"For several years now the dwarven black guard have been developing the latest in projectile warfare. Now with the constant attack of goblin renegades, the dwarven troops who protect the mines need to put this secret weapon into action. Only with your help can the true power of this cannon be harnessed!",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
MURDER_MYSTERY(
|
||||
new QuestDef(
|
||||
"Murder Mystery",
|
||||
QuestId.MURDER_MYSTERY.getId(),
|
||||
false,
|
||||
"Lord Sinclair, a highly respected Nobleman of Kandarin has been found murdered in his mansion. Despite the presence of a large number of guards all working hard to solve the crime, local law enforcement officers are totally baffled.\n\nCan you use your razor sharp analytical mind to uncover the evidence and unmask the culprit?",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
DIGSITE(
|
||||
new QuestDef(
|
||||
"Digsite Quest",
|
||||
QuestId.DIGSITE.getId(),
|
||||
false,
|
||||
"Feeling uneducated? Desperate for buried treasure?\n\n...There's gold in them there hills (well stream actually) as well as many other items that can be found at the digsite.\n\nJoin the students in their attempt to be a qualified archaeologist, and become experienced in making the earth move!\n\nHave you got what it takes to unearth the hidden altar to one of Runescape's lesser-known Gods...?",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
GERTRUDES_CAT(
|
||||
new QuestDef(
|
||||
"Gertrude's Cat",
|
||||
QuestId.GERTRUDES_CAT.getId(),
|
||||
false,
|
||||
"Gertrude's cat has been missing for some time now - for her piece of mind her prized pet must be rescued.\n\nHandling cats isn't an easy business. They get hungry and need plenty of attention but if you're the pet type, then this is the quest for you!",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
LEGENDS_QUEST(
|
||||
new QuestDef(
|
||||
"Legend's Quest",
|
||||
QuestId.LEGENDS_QUEST.getId(),
|
||||
false,
|
||||
"Accept the challenge of the Legends Guild to map the Southern part of Karamja Island, make friends with the natives and bring back a prize to display in the Legends Guild Main Hall.",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
107,
|
||||
null)),
|
||||
RUNE_MYSTERIES(
|
||||
new QuestDef(
|
||||
"Rune Mysteries",
|
||||
QuestId.RUNE_MYSTERIES.getId(),
|
||||
false,
|
||||
"Recent research at the Wizards' Tower has found a way to create Runes for the first time in centuries. Assist the head wizard Sedridor in his research and he too may teach you these secrets!",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
PEELING_THE_ONION(
|
||||
new QuestDef(
|
||||
"Peeling the Onion",
|
||||
QuestId.PEELING_THE_ONION.getId(),
|
||||
false,
|
||||
"Add a quest description here",
|
||||
-1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
null)),
|
||||
ODYSSEY(
|
||||
new QuestDef(
|
||||
"The Odyssey",
|
||||
-1,
|
||||
true,
|
||||
"Add a quest description here",
|
||||
-1,
|
||||
null,
|
||||
new Quest[] {LEGENDS_QUEST},
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
5,
|
||||
0,
|
||||
null));
|
||||
|
||||
private final QuestDef quest;
|
||||
|
||||
Quest(QuestDef quest) {
|
||||
this.quest = quest;
|
||||
}
|
||||
|
||||
public QuestDef getQuestDef() {
|
||||
return quest;
|
||||
}
|
||||
|
||||
public static QuestDef getQuestDefFromName(String name) {
|
||||
return Arrays.stream(Quest.values())
|
||||
.map(Quest::getQuestDef)
|
||||
.filter(q -> q.getName().equals(name))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
package scripting.idlescript.AIOQuester.models;
|
||||
|
||||
import static scripting.idlescript.AIOQuester.AIOQuester.SKIP_QUEST_DEFINED_CHECK;
|
||||
import static scripting.idlescript.AIOQuester.AIOQuester.TESTING_QUESTS;
|
||||
|
||||
import bot.Main;
|
||||
import controller.Controller;
|
||||
import java.util.ArrayList;
|
||||
import models.entities.QuestId;
|
||||
import scripting.idlescript.AIOQuester.QuestHandler;
|
||||
|
||||
public class QuestDef {
|
||||
private static final Controller c = Main.getController();
|
||||
|
||||
private final String name;
|
||||
private final int id;
|
||||
private final boolean isMiniquest;
|
||||
private final int stagesTotal;
|
||||
private final Location startLocation;
|
||||
private final Quest[] requiredQuests;
|
||||
private final int[][] requiredSkills;
|
||||
private final int[][] requiredInventoryItems;
|
||||
private final int[][] requiredBankItems;
|
||||
private final int[][] requiredEquippedItems;
|
||||
private final int requiredEmptyInventorySlots;
|
||||
private final int requiredQuestPoints;
|
||||
private final Class<? extends QuestHandler> script;
|
||||
private final String description;
|
||||
|
||||
public QuestDef(
|
||||
String name,
|
||||
int id,
|
||||
boolean isMiniquest,
|
||||
String description,
|
||||
int stagesTotal,
|
||||
Location startLocation,
|
||||
Quest[] requiredQuests,
|
||||
int[][] requiredSkills,
|
||||
int[][] requiredInventoryItems,
|
||||
int[][] requiredEquippedItems,
|
||||
int[][] requiredBankItems,
|
||||
int requiredEmptyInventorySlots,
|
||||
int requiredQuestPoints,
|
||||
Class<? extends QuestHandler> script) {
|
||||
this.name = name;
|
||||
this.id = id;
|
||||
this.isMiniquest = isMiniquest;
|
||||
this.description = description;
|
||||
this.stagesTotal = stagesTotal;
|
||||
this.startLocation = startLocation;
|
||||
this.requiredQuests = requiredQuests;
|
||||
this.requiredSkills = requiredSkills;
|
||||
this.requiredInventoryItems = requiredInventoryItems;
|
||||
this.requiredBankItems = requiredBankItems;
|
||||
this.requiredEquippedItems = requiredEquippedItems;
|
||||
this.requiredEmptyInventorySlots = requiredEmptyInventorySlots;
|
||||
this.requiredQuestPoints = requiredQuestPoints;
|
||||
this.script = script;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public boolean isMiniquest() {
|
||||
return isMiniquest;
|
||||
}
|
||||
|
||||
public int getStagesTotal() {
|
||||
return stagesTotal;
|
||||
}
|
||||
|
||||
public Location getStartLocation() {
|
||||
return startLocation;
|
||||
}
|
||||
|
||||
public Quest[] getRequiredQuests() {
|
||||
return requiredQuests;
|
||||
}
|
||||
|
||||
public int[][] getRequiredSkills() {
|
||||
return requiredSkills;
|
||||
}
|
||||
|
||||
public int[][] getRequiredInventoryItems() {
|
||||
return requiredInventoryItems;
|
||||
}
|
||||
|
||||
public int[][] getRequiredEquippedItems() {
|
||||
return requiredEquippedItems;
|
||||
}
|
||||
|
||||
public int[][] getRequiredBankItems() {
|
||||
return requiredBankItems;
|
||||
}
|
||||
|
||||
public int getRequiredEmptyInventorySlots() {
|
||||
return requiredEmptyInventorySlots;
|
||||
}
|
||||
|
||||
public int getRequiredQuestPoints() {
|
||||
return requiredQuestPoints;
|
||||
}
|
||||
|
||||
public Class<? extends QuestHandler> getScript() {
|
||||
return script;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the quest is correctly defined
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean isQuestDefined() {
|
||||
if (SKIP_QUEST_DEFINED_CHECK) return true;
|
||||
|
||||
if (name == null || name.isEmpty()) return false;
|
||||
if (id < 0 && !isMiniquest) return false;
|
||||
if (description == null || description.isEmpty()) return false;
|
||||
if (startLocation == null) return false;
|
||||
if (requiredEmptyInventorySlots < 0) return false;
|
||||
if (requiredQuestPoints < 0) return false;
|
||||
return script != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the quest is correctly defined and can be shown to the player in the UI by
|
||||
* default
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean isDisplayedStartable() {
|
||||
if (!isQuestDefined()) return false;
|
||||
ArrayList<Quest> missingQuests = new ArrayList<>();
|
||||
ArrayList<int[]> missingSkills = new ArrayList<>();
|
||||
|
||||
if (requiredQuests != null) {
|
||||
for (Quest quest : requiredQuests) {
|
||||
int questId = quest.getQuestDef().getId();
|
||||
if (questId != -1 && c.getQuestStage(questId) != -1) missingQuests.add(quest);
|
||||
}
|
||||
}
|
||||
|
||||
if (requiredSkills != null) {
|
||||
for (int[] skill : requiredSkills) {
|
||||
if (c.getBaseStat(skill[0]) < skill[1]) missingSkills.add(skill);
|
||||
}
|
||||
}
|
||||
|
||||
// Checks if the requirements are met
|
||||
if (c.getQuestPoints() < requiredQuestPoints) return false;
|
||||
if (!TESTING_QUESTS && id > -1 && c.getQuestStage(id) == -1) return false;
|
||||
if (!missingQuests.isEmpty()) return false;
|
||||
if (!missingSkills.isEmpty()) return false;
|
||||
return doMiniquestChecking();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the quest can be started
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean isStartable() {
|
||||
if (!isDisplayedStartable()) return false;
|
||||
ArrayList<int[]> missingInventoryItems = new ArrayList<>();
|
||||
ArrayList<int[]> missingEquippedItems = new ArrayList<>();
|
||||
ArrayList<int[]> missingBankedItems = new ArrayList<>();
|
||||
|
||||
if (requiredInventoryItems != null) {
|
||||
for (int[] item : requiredInventoryItems) {
|
||||
if (c.getInventoryItemCount(item[0]) < item[1]) missingInventoryItems.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
if (requiredEquippedItems != null) {
|
||||
for (int[] item : requiredEquippedItems) {
|
||||
// TODO: Add amounts here for ammunition checking
|
||||
if (!c.isItemIdEquipped(item[0])) missingEquippedItems.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
if (requiredBankItems != null && QuestHandler.bankItems != null) {
|
||||
for (int[] item : requiredBankItems) {
|
||||
if (!QuestHandler.bankItems.containsKey(item[0])
|
||||
|| QuestHandler.bankItems.get(item[0]) < item[1]) missingBankedItems.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
if (getRequiredEmptyInventorySlots() > 30 - c.getInventoryItemCount()) return false;
|
||||
if (!missingInventoryItems.isEmpty()) return false;
|
||||
if (!missingEquippedItems.isEmpty()) return false;
|
||||
if (requiredBankItems != null && QuestHandler.bankItems == null) return false;
|
||||
if (c.getPlayerMode() != 2 && !missingBankedItems.isEmpty()) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a boolean based on the questName and whether a follow-up quest is completed to
|
||||
* determine if a miniquest is complete.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
private boolean doMiniquestChecking() {
|
||||
// Marks Barcrawl not start-able if Scorpion Catcher has already been completed.
|
||||
// This is the only way to determine completion.
|
||||
if (getName().equals(Quest.BARCRAWL.getQuestDef().getName())
|
||||
&& c.getQuestStage(QuestId.SCORPION_CATCHER.getId()) == -1) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/** This is only used for test loops so the paint correctly shows */
|
||||
public static final QuestDef loopTesting =
|
||||
new QuestDef(
|
||||
"Quest Handler",
|
||||
-1,
|
||||
true,
|
||||
"Testing QuestHandler",
|
||||
0,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
0,
|
||||
0,
|
||||
null);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package scripting.idlescript.AIOQuester.models;
|
||||
|
||||
public enum QuitReason {
|
||||
SCRIPT_STOPPED("The script has been stopped"),
|
||||
QUEST_COMPLETED("Quest Completed"),
|
||||
// Players should never see these messages if quest scripts are written correctly
|
||||
INVENTORY_FULL("Unable to pick up item because inventory is full"),
|
||||
NPC_NOT_FOUND("An npc with the given id was not found nearby"),
|
||||
OBJECT_NOT_FOUND("An object was not found. Check the coordinates"),
|
||||
PATH_TILE_NOT_REACHABLE("The walk path tile was not reachable"),
|
||||
QUEST_STAGE_NOT_IN_SWITCH("The current quest stage is not defined in the switch case"),
|
||||
UNABLE_TO_WALK_TO_LOCATION(
|
||||
"Failed to walk to specified location. WebWalker may need to be updated.");
|
||||
|
||||
private final String reason;
|
||||
|
||||
QuitReason(String reason) {
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return reason;
|
||||
}
|
||||
}
|
||||
+9
-19
@@ -1,8 +1,10 @@
|
||||
package scripting.idlescript;
|
||||
package scripting.idlescript.AIOQuester.quests;
|
||||
|
||||
import models.entities.*;
|
||||
import scripting.idlescript.AIOQuester.QuestHandler;
|
||||
import scripting.idlescript.AIOQuester.models.QuitReason;
|
||||
|
||||
public final class QH_BarCrawl extends QH__QuestHandler {
|
||||
public final class BarCrawl extends QuestHandler {
|
||||
private static final int[] BARB_OUTPOST_DOOR = {494, 543};
|
||||
// ITEM IDS
|
||||
private static final int BAR_CRAWL_CARD = ItemId.BARCRAWL_CARD.getId();
|
||||
@@ -25,20 +27,9 @@ public final class QH_BarCrawl extends QH__QuestHandler {
|
||||
"I want to come through this gate", "Looks can be deceiving, I am in fact a barbarian"
|
||||
};
|
||||
|
||||
public int start(String[] param) { // warning does not handle food conditions
|
||||
QUEST_NAME = "Miniquest";
|
||||
START_RECTANGLE = BARB_OUTPOST;
|
||||
QUEST_REQUIREMENTS = new String[] {};
|
||||
SKILL_REQUIREMENTS = new int[][] {};
|
||||
EQUIP_REQUIREMENTS = new int[][] {};
|
||||
ITEM_REQUIREMENTS = new int[][] {{ItemId.COINS.getId(), 1000}};
|
||||
INVENTORY_SPACES_NEEDED = 5;
|
||||
doQuestChecks();
|
||||
public static void run() { // warning does not handle food conditions
|
||||
c.log("~ by Kaila", "mag");
|
||||
|
||||
while (c.isRunning()) {
|
||||
if (c.getNeedToMove()) c.moveCharacter();
|
||||
if (c.getShouldSleep()) c.sleepHandler(true);
|
||||
while (isQuesting()) {
|
||||
if (c.isRunning()) {
|
||||
CURRENT_QUEST_STEP = "Starting Barcrawl";
|
||||
c.walkTo(494, 544);
|
||||
@@ -48,13 +39,12 @@ public final class QH_BarCrawl extends QH__QuestHandler {
|
||||
}
|
||||
doBarCrawl();
|
||||
CURRENT_QUEST_STEP = "Quest Complete";
|
||||
quit("Quest completed");
|
||||
quit(QuitReason.QUEST_COMPLETED);
|
||||
}
|
||||
quit("Script stopped");
|
||||
return 1000;
|
||||
quit(QuitReason.SCRIPT_STOPPED);
|
||||
}
|
||||
|
||||
public void doBarCrawl() {
|
||||
public static void doBarCrawl() {
|
||||
if (c.getInventoryItemCount(BAR_CRAWL_CARD) > 0) { // do bar crawl
|
||||
if (c.isRunning()) {
|
||||
CURRENT_QUEST_STEP = "Going to Brimhaven Pub";
|
||||
+10
-27
@@ -1,10 +1,11 @@
|
||||
package scripting.idlescript;
|
||||
package scripting.idlescript.AIOQuester.quests;
|
||||
|
||||
import models.entities.ItemId;
|
||||
import models.entities.NpcId;
|
||||
import scripting.idlescript.AIOQuester.QuestHandler;
|
||||
import scripting.idlescript.AIOQuester.models.QuitReason;
|
||||
|
||||
public final class QH_CooksAssistant extends QH__QuestHandler {
|
||||
|
||||
public final class CooksAssistant extends QuestHandler {
|
||||
// COORDINATES FOR walkPath() PATHS AND pickupUnreachableItem()
|
||||
private static final int[] WHEAT_FIELD_OUTER = {172, 607};
|
||||
private static final int[] WHEAT_FIELD_INNER = {172, 606};
|
||||
@@ -65,21 +66,8 @@ public final class QH_CooksAssistant extends QH__QuestHandler {
|
||||
// NPC DIALOGS
|
||||
private static final String[] COOK_START_QUEST_DIALOG = {"What's wrong?", "Yes, I'll help you"};
|
||||
|
||||
public int start(String[] param) {
|
||||
QUEST_NAME = "Cook's Assistant";
|
||||
START_RECTANGLE = LUMBRIDGE_CASTLE_COURTYARD;
|
||||
TOTAL_QUEST_STAGES = 1;
|
||||
QUEST_REQUIREMENTS = new String[] {};
|
||||
SKILL_REQUIREMENTS = new int[][] {};
|
||||
ITEM_REQUIREMENTS = new int[][] {};
|
||||
EQUIP_REQUIREMENTS = new int[][] {};
|
||||
INVENTORY_SPACES_NEEDED = 4;
|
||||
doQuestChecks();
|
||||
|
||||
while (c.isRunning()) {
|
||||
if (c.getNeedToMove()) c.moveCharacter();
|
||||
if (c.getShouldSleep()) c.sleepHandler(true);
|
||||
QUEST_STAGE = c.getQuestStage(QUEST_ID);
|
||||
public static void run() {
|
||||
while (isQuesting()) {
|
||||
switch (QUEST_STAGE) {
|
||||
case 0:
|
||||
// Gather pot and bucket if needed
|
||||
@@ -117,7 +105,7 @@ public final class QH_CooksAssistant extends QH__QuestHandler {
|
||||
CURRENT_QUEST_STEP = "Getting ingredients";
|
||||
while (!hasAtLeastItemAmount(EGG_ID, 1) && c.isRunning()) {
|
||||
CURRENT_QUEST_STEP = "Getting an egg";
|
||||
if (isInRectangle(START_RECTANGLE)) {
|
||||
if (isAtLocation(START_LOCATION)) {
|
||||
walkPath(COURTYARD_TO_PENS);
|
||||
walkPath(PENS_TO_CHICKENS);
|
||||
}
|
||||
@@ -125,7 +113,7 @@ public final class QH_CooksAssistant extends QH__QuestHandler {
|
||||
}
|
||||
while (!hasAtLeastItemAmount(MILK_ID, 1) && c.isRunning()) {
|
||||
CURRENT_QUEST_STEP = "Getting milk";
|
||||
if (isInRectangle(START_RECTANGLE)) {
|
||||
if (isAtLocation(START_LOCATION)) {
|
||||
walkPath(COURTYARD_TO_PENS);
|
||||
walkPath(PENS_TO_COWS);
|
||||
} else {
|
||||
@@ -135,7 +123,7 @@ public final class QH_CooksAssistant extends QH__QuestHandler {
|
||||
}
|
||||
while (!hasAtLeastItemAmount(POT_OF_FLOUR_ID, 1) && c.isRunning()) {
|
||||
CURRENT_QUEST_STEP = "Getting flour";
|
||||
if (isInRectangle(START_RECTANGLE)) {
|
||||
if (isAtLocation(START_LOCATION)) {
|
||||
walkPathReverse(MILL_TO_COURTYARD);
|
||||
} else {
|
||||
walkPath(COWS_TO_MILL);
|
||||
@@ -175,15 +163,10 @@ public final class QH_CooksAssistant extends QH__QuestHandler {
|
||||
CURRENT_QUEST_STEP = "Handing in items to the Cook";
|
||||
talkToNpcId(COOK_ID);
|
||||
break;
|
||||
case -1:
|
||||
quit("Quest completed");
|
||||
break;
|
||||
default:
|
||||
quit("");
|
||||
quit(QuitReason.QUEST_STAGE_NOT_IN_SWITCH);
|
||||
break;
|
||||
}
|
||||
}
|
||||
quit("Script stopped");
|
||||
return 1000;
|
||||
}
|
||||
}
|
||||
+7
-24
@@ -1,10 +1,11 @@
|
||||
package scripting.idlescript;
|
||||
package scripting.idlescript.AIOQuester.quests;
|
||||
|
||||
import models.entities.ItemId;
|
||||
import models.entities.NpcId;
|
||||
import models.entities.SkillId;
|
||||
import scripting.idlescript.AIOQuester.QuestHandler;
|
||||
import scripting.idlescript.AIOQuester.models.QuitReason;
|
||||
|
||||
public final class QH_DoricsQuest extends QH__QuestHandler {
|
||||
public final class DoricsQuest extends QuestHandler {
|
||||
|
||||
// COORDINATES FOR walkPath() PATHS AND pickupUnreachableItem()
|
||||
private static final int[] GENERAL_STORE = {316, 533};
|
||||
@@ -72,21 +73,8 @@ public final class QH_DoricsQuest extends QH__QuestHandler {
|
||||
"I wanted to use your anvils", "Yes I will get you materials"
|
||||
};
|
||||
|
||||
public int start(String[] param) {
|
||||
QUEST_NAME = "Doric's Quest";
|
||||
START_RECTANGLE = FALADOR_WEST_BANK;
|
||||
QUEST_REQUIREMENTS = new String[] {};
|
||||
SKILL_REQUIREMENTS = new int[][] {{SkillId.MINING.getId(), 15}};
|
||||
ITEM_REQUIREMENTS = new int[][] {};
|
||||
EQUIP_REQUIREMENTS = new int[][] {};
|
||||
INVENTORY_SPACES_NEEDED = 13;
|
||||
TOTAL_QUEST_STAGES = 1;
|
||||
doQuestChecks();
|
||||
|
||||
while (c.isRunning()) {
|
||||
if (c.getNeedToMove()) c.moveCharacter();
|
||||
if (c.getShouldSleep()) c.sleepHandler(true);
|
||||
QUEST_STAGE = c.getQuestStage(QUEST_ID);
|
||||
public static void run() {
|
||||
while (isQuesting()) {
|
||||
switch (QUEST_STAGE) {
|
||||
case 0:
|
||||
if (c.isRunning()) {
|
||||
@@ -157,15 +145,10 @@ public final class QH_DoricsQuest extends QH__QuestHandler {
|
||||
if (c.isRunning()) talkToNpcId(DORIC_ID);
|
||||
sleepUntilQuestStageChanges();
|
||||
break;
|
||||
case -1:
|
||||
quit("Quest completed");
|
||||
break;
|
||||
default:
|
||||
quit("");
|
||||
quit(QuitReason.QUEST_STAGE_NOT_IN_SWITCH);
|
||||
break;
|
||||
}
|
||||
}
|
||||
quit("Script stopped");
|
||||
return 1000;
|
||||
}
|
||||
}
|
||||
+9
-26
@@ -1,10 +1,11 @@
|
||||
package scripting.idlescript;
|
||||
package scripting.idlescript.AIOQuester.quests;
|
||||
|
||||
import models.entities.ItemId;
|
||||
import models.entities.NpcId;
|
||||
import models.entities.SkillId;
|
||||
import scripting.idlescript.AIOQuester.QuestHandler;
|
||||
import scripting.idlescript.AIOQuester.models.QuitReason;
|
||||
|
||||
public final class QH_FishingContest extends QH__QuestHandler {
|
||||
public final class FishingContest extends QuestHandler {
|
||||
private static final int[] OUTSIDE_HUT_WAYPOINT = {433, 460};
|
||||
private static final int[] CUPBOARD_COORDS = {216, 1562};
|
||||
private static final int GIANT_CARP = ItemId.RAW_GIANT_CARP.getId();
|
||||
@@ -28,23 +29,10 @@ public final class QH_FishingContest extends QH__QuestHandler {
|
||||
private static final String[] BONZO_START_DIALOG = {"I'll give that a go then"};
|
||||
private static final String[] BONZO_END_DIALOG = {"I have this big fish,is it enough to win?"};
|
||||
|
||||
public int start(String[] param) { // warning does not handle food conditions
|
||||
QUEST_NAME = "Fishing contest";
|
||||
START_RECTANGLE = WEST_DWARF_TUNNEL;
|
||||
QUEST_REQUIREMENTS = new String[] {};
|
||||
SKILL_REQUIREMENTS = new int[][] {{SkillId.FISHING.getId(), 10}};
|
||||
EQUIP_REQUIREMENTS = new int[][] {};
|
||||
ITEM_REQUIREMENTS = new int[][] {{ItemId.COINS.getId(), 1000}};
|
||||
INVENTORY_SPACES_NEEDED = 10;
|
||||
TOTAL_QUEST_STAGES = 3;
|
||||
doQuestChecks();
|
||||
public static void run() { // warning does not handle food conditions
|
||||
c.log("WARNING: Entering dangerous areas, low combat not recommended", "red");
|
||||
c.log("~ by Kaila", "mag");
|
||||
|
||||
while (c.isRunning()) {
|
||||
if (c.getNeedToMove()) c.moveCharacter();
|
||||
if (c.getShouldSleep()) c.sleepHandler(true);
|
||||
QUEST_STAGE = c.getQuestStage(QUEST_ID);
|
||||
while (isQuesting()) {
|
||||
switch (QUEST_STAGE) { // 6 stages in total
|
||||
case 0: // not started
|
||||
CURRENT_QUEST_STEP = "Getting ingredients";
|
||||
@@ -100,7 +88,7 @@ public final class QH_FishingContest extends QH__QuestHandler {
|
||||
&& c.getInventoryItemCount(SPADE) > 0
|
||||
&& c.getInventoryItemCount(GARLIC) > 0) {
|
||||
|
||||
if (c.isRunning() && !isInRectangle(START_RECTANGLE)) {
|
||||
if (c.isRunning() && !isAtLocation(START_LOCATION)) {
|
||||
CURRENT_QUEST_STEP = "Walking back to Dwarf";
|
||||
pathWalker(OUTSIDE_HUT_WAYPOINT);
|
||||
}
|
||||
@@ -185,7 +173,7 @@ public final class QH_FishingContest extends QH__QuestHandler {
|
||||
case 3: // has trophy
|
||||
int FISHING_TROPHY = ItemId.HEMENSTER_FISHING_TROPHY.getId();
|
||||
if (c.getInventoryItemCount(FISHING_TROPHY) > 0) {
|
||||
if (c.isRunning() && !isInRectangle(START_RECTANGLE)) {
|
||||
if (c.isRunning() && !isAtLocation(START_LOCATION)) {
|
||||
CURRENT_QUEST_STEP = "Walking to Dwarf";
|
||||
pathWalker(OUTSIDE_HUT_WAYPOINT);
|
||||
}
|
||||
@@ -196,15 +184,10 @@ public final class QH_FishingContest extends QH__QuestHandler {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case -1:
|
||||
quit("Quest completed");
|
||||
break;
|
||||
default:
|
||||
quit("");
|
||||
quit(QuitReason.QUEST_STAGE_NOT_IN_SWITCH);
|
||||
break;
|
||||
}
|
||||
}
|
||||
quit("Script stopped");
|
||||
return 1000;
|
||||
}
|
||||
}
|
||||
+10
-26
@@ -1,9 +1,11 @@
|
||||
package scripting.idlescript;
|
||||
package scripting.idlescript.AIOQuester.quests;
|
||||
|
||||
import models.entities.ItemId;
|
||||
import models.entities.NpcId;
|
||||
import scripting.idlescript.AIOQuester.QuestHandler;
|
||||
import scripting.idlescript.AIOQuester.models.QuitReason;
|
||||
|
||||
public final class QH_MonksFriend extends QH__QuestHandler {
|
||||
public final class MonksFriend extends QuestHandler {
|
||||
private static final int[] OUTSIDE_WAYPOINT = {589, 647};
|
||||
private static final int[] INSIDE_MONESTARY = {589, 664};
|
||||
private static final int BUCKET_OF_WATER = ItemId.BUCKET_OF_WATER.getId();
|
||||
@@ -22,22 +24,9 @@ public final class QH_MonksFriend extends QH__QuestHandler {
|
||||
"Yes i'd be happy to",
|
||||
};
|
||||
|
||||
public int start(String[] param) { // warning does not handle food conditions
|
||||
QUEST_NAME = "Monk's friend";
|
||||
START_RECTANGLE = ARDY_MONASTERY;
|
||||
QUEST_REQUIREMENTS = new String[] {};
|
||||
SKILL_REQUIREMENTS = new int[][] {};
|
||||
EQUIP_REQUIREMENTS = new int[][] {};
|
||||
ITEM_REQUIREMENTS = new int[][] {{ItemId.BRONZE_AXE.getId(), 1}};
|
||||
INVENTORY_SPACES_NEEDED = 5;
|
||||
TOTAL_QUEST_STAGES = 6;
|
||||
doQuestChecks();
|
||||
public static void run() {
|
||||
c.log("~ by Kaila", "mag");
|
||||
|
||||
while (c.isRunning()) {
|
||||
if (c.getNeedToMove()) c.moveCharacter();
|
||||
if (c.getShouldSleep()) c.sleepHandler(true);
|
||||
QUEST_STAGE = c.getQuestStage(QUEST_ID);
|
||||
while (isQuesting()) {
|
||||
switch (QUEST_STAGE) { // 6 stages in total
|
||||
case 0: // not started
|
||||
if (c.isRunning() && c.getInventoryItemCount(LOGS) == 0) {
|
||||
@@ -69,7 +58,7 @@ public final class QH_MonksFriend extends QH__QuestHandler {
|
||||
case 1: // get the blanket and return it
|
||||
if (c.isRunning() && c.getInventoryItemCount(BLANKET) == 0) {
|
||||
CURRENT_QUEST_STEP = "Walking to Kandarin Dungeon";
|
||||
if (isInRectangle(START_RECTANGLE))
|
||||
if (isAtLocation(START_LOCATION))
|
||||
walkPath(new int[][] {OUTSIDE_WAYPOINT}); // walk outside
|
||||
pathWalker(618, 657); // walk to kandarin dungeon
|
||||
}
|
||||
@@ -104,7 +93,7 @@ public final class QH_MonksFriend extends QH__QuestHandler {
|
||||
case 3: // Talk to cedric
|
||||
if (c.isRunning() && c.currentX() < 608) {
|
||||
CURRENT_QUEST_STEP = "Walking to Cedric";
|
||||
if (isInRectangle(START_RECTANGLE))
|
||||
if (isAtLocation(START_LOCATION))
|
||||
walkPath(new int[][] {OUTSIDE_WAYPOINT}); // walk outside
|
||||
pathWalker(616, 640);
|
||||
// walkPath(new int[][]{{589,653},{602,645},{615,636}}); //walk outside
|
||||
@@ -134,7 +123,7 @@ public final class QH_MonksFriend extends QH__QuestHandler {
|
||||
case 4: // Sober them up
|
||||
if (c.isRunning() && c.currentX() < 608) {
|
||||
CURRENT_QUEST_STEP = "Walking to Cedric";
|
||||
if (isInRectangle(START_RECTANGLE))
|
||||
if (isAtLocation(START_LOCATION))
|
||||
walkPath(new int[][] {OUTSIDE_WAYPOINT}); // walk outside
|
||||
pathWalker(616, 640);
|
||||
}
|
||||
@@ -174,15 +163,10 @@ public final class QH_MonksFriend extends QH__QuestHandler {
|
||||
sleepUntilQuestStageChanges();
|
||||
}
|
||||
break;
|
||||
case -1:
|
||||
quit("Quest completed");
|
||||
break;
|
||||
default:
|
||||
quit("");
|
||||
quit(QuitReason.QUEST_STAGE_NOT_IN_SWITCH);
|
||||
break;
|
||||
}
|
||||
}
|
||||
quit("Script stopped");
|
||||
return 1000;
|
||||
}
|
||||
}
|
||||
+20
-51
@@ -1,8 +1,12 @@
|
||||
package scripting.idlescript;
|
||||
package scripting.idlescript.AIOQuester.quests;
|
||||
|
||||
import models.entities.*;
|
||||
import scripting.idlescript.AIOQuester.QuestHandler;
|
||||
import scripting.idlescript.AIOQuester.models.Location;
|
||||
import scripting.idlescript.AIOQuester.models.QuitReason;
|
||||
import scripting.idlescript.K_kailaScript;
|
||||
|
||||
public final class QH_ScorpionCatcher extends QH__QuestHandler {
|
||||
public final class ScorpionCatcher extends QuestHandler {
|
||||
|
||||
// MAP POINTS377,520
|
||||
private static final MapPoint TOWER_ENTRANCE = new MapPoint(511, 507);
|
||||
@@ -12,8 +16,6 @@ public final class QH_ScorpionCatcher extends QH__QuestHandler {
|
||||
private static final MapPoint MONESTARY_LADDER = new MapPoint(251, 467);
|
||||
private static final MapPoint PRAYER_ALTER = new MapPoint(262, 460);
|
||||
private static final MapPoint TAV_LADDER_ABOVE = new MapPoint(377, 520);
|
||||
private static final MapPoint TAV_LADDER_UNDER = new MapPoint(376, 3351);
|
||||
private static final MapPoint TAV_DUSTY_WAYPOINT = new MapPoint(376, 3351);
|
||||
// OBJECT COORDINATES
|
||||
private static final int[] TOWER_LADDER_UP = {510, 507};
|
||||
private static final int[] TOWER_LADDER_DOWN = {510, 1451};
|
||||
@@ -28,25 +30,11 @@ public final class QH_ScorpionCatcher extends QH__QuestHandler {
|
||||
private static final int SCORP_CAGE_STAGE_2 = ItemId.SCORPION_CAGE_TWO.getId();
|
||||
private static final int SCORP_CAGE_STAGE_3 = ItemId.SCORPION_CAGE_TWO_THREE.getId();
|
||||
private static final int SCORP_CAGE_STAGE_4 = ItemId.SCORPION_CAGE_ONE_TWO_THREE.getId();
|
||||
private static final int BAR_CRAWL_CARD = ItemId.BARCRAWL_CARD.getId();
|
||||
// NPC IDS
|
||||
private static final int CPT_BARNABY = NpcId.CAPTAIN_BARNABY.getId();
|
||||
private static final int CST_OFFICIAL = NpcId.CUSTOMS_OFFICIAL.getId();
|
||||
private static final int THORMAC_ID = NpcId.THORMAC_THE_SORCEROR.getId();
|
||||
private static final int SEER_ID = NpcId.SEER.getId();
|
||||
private static final int MONK_ID = NpcId.ABBOT_LANGLEY.getId();
|
||||
private static final int BRIM_TENDER = NpcId.BARTENDER_BRIMHAVEN.getId();
|
||||
private static final int SEERS_TENDER = NpcId.BARTENDER_SEERS.getId();
|
||||
private static final int FALADOR_TENDER = NpcId.BARMAID.getId();
|
||||
private static final int SARIM_TENDER = NpcId.BARTENDER_PORTSARIM.getId();
|
||||
private static final int VARROCK_TENDER = NpcId.BARTENDER_VARROCK.getId();
|
||||
private static final int BOAR_TENDER = NpcId.BARTENDER_JOLLY_BOAR.getId();
|
||||
// NPC DIALOGS
|
||||
private static final String[] BOAT_TO_BRIM_DIALOG = {"Yes please"};
|
||||
private static final String[] GENERIC_TENDER_DIALOG = {"I'm doing Alfred Grimhand's barcrawl"};
|
||||
private static final String[] BOAT_TO_ARDY_DIALOG = {
|
||||
"Can I board this ship?", "Search away I have nothing to hide", "Ok"
|
||||
};
|
||||
private static final String[] THORMAC_START_QUEST_DIALOG = {
|
||||
"What do you need assistance with?",
|
||||
"So how would I go about catching them then?",
|
||||
@@ -59,9 +47,8 @@ public final class QH_ScorpionCatcher extends QH__QuestHandler {
|
||||
"I need to locate some scorpions",
|
||||
};
|
||||
private static final String[] MONK_DIALOG = {"Well can i join your order?"};
|
||||
private static final int[][] BARB_OUTPOST_REC = {{485, 541}, {493, 555}};
|
||||
|
||||
private void drinkAnti() {
|
||||
private static void drinkAnti() {
|
||||
timeToDrinkAntidote = false;
|
||||
if (K_kailaScript.drinkAnti(true)) {
|
||||
c.stop();
|
||||
@@ -69,39 +56,27 @@ public final class QH_ScorpionCatcher extends QH__QuestHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public int start(String[] param) { // warning does not handle food conditions
|
||||
QUEST_NAME = "Scorpion catcher";
|
||||
public static void run() { // warning does not handle food conditions
|
||||
if (c.getInventoryItemCount(SCORP_CAGE_STAGE_1) == 1) {
|
||||
START_RECTANGLE = BARB_OUTPOST;
|
||||
START_LOCATION = Location.BARBARIAN_OUTPOST_ENTRANCE;
|
||||
} else if (c.getInventoryItemCount(SCORP_CAGE_STAGE_2) == 1) {
|
||||
START_RECTANGLE = EDGE_MONASTERY;
|
||||
START_LOCATION = Location.EDGEVILLE_MONASTERY;
|
||||
} else if (c.getInventoryItemCount(SCORP_CAGE_STAGE_3) == 1) {
|
||||
START_RECTANGLE = TAV_DUNGEON_LADDER;
|
||||
START_LOCATION = Location.TAVERLEY_DUNGEON_ENTRANCE_OUTER;
|
||||
} else if (c.currentY() > 1200) {
|
||||
START_RECTANGLE = SORCERERS_TOWER_ABOVE;
|
||||
START_LOCATION = Location.SORCERERS_TOWER_ABOVE;
|
||||
} else {
|
||||
START_RECTANGLE = SORCERERS_TOWER;
|
||||
START_LOCATION = Location.SORCERERS_TOWER;
|
||||
}
|
||||
QUEST_REQUIREMENTS = new String[] {};
|
||||
SKILL_REQUIREMENTS = new int[][] {{SkillId.PRAYER.getId(), 31}, {SkillId.AGILITY.getId(), 70}};
|
||||
EQUIP_REQUIREMENTS = new int[][] {{ItemId.ANTI_DRAGON_BREATH_SHIELD.getId(), 1}};
|
||||
ITEM_REQUIREMENTS = new int[][] {{ItemId.COINS.getId(), 1000}};
|
||||
INVENTORY_SPACES_NEEDED = 5;
|
||||
TOTAL_QUEST_STAGES = 2;
|
||||
doQuestChecks();
|
||||
c.log("~ by Kaila", "mag");
|
||||
|
||||
while (c.isRunning()) {
|
||||
if (c.getNeedToMove()) c.moveCharacter();
|
||||
if (c.getShouldSleep()) c.sleepHandler(true);
|
||||
QUEST_STAGE = c.getQuestStage(QUEST_ID);
|
||||
while (isQuesting()) {
|
||||
switch (QUEST_STAGE) {
|
||||
case 0: // not started
|
||||
// get anti
|
||||
if (c.isRunning()
|
||||
&& c.getInventoryItemCount(ItemId.CURE_POISON_POTION_1DOSE.getId()) == 0) {
|
||||
CURRENT_QUEST_STEP = "Getting cure poison potion";
|
||||
if (isInRectangle(SORCERERS_TOWER_ABOVE)) climb(510, 1451);
|
||||
if (isAtLocation(Location.SORCERERS_TOWER_ABOVE)) climb(510, 1451);
|
||||
c.walkTo(511, 513); // outside tower
|
||||
pathWalker(new MapPoint(631, 634)); // battlefield
|
||||
pathWalker(new MapPoint(691, 678)); // goblins
|
||||
@@ -110,7 +85,7 @@ public final class QH_ScorpionCatcher extends QH__QuestHandler {
|
||||
c.walkTo(691, 678); // outside gobs
|
||||
pathWalker(new MapPoint(631, 634)); // battlefield
|
||||
}
|
||||
if (c.isRunning() && !isInRectangle(SORCERERS_TOWER_ABOVE)) {
|
||||
if (c.isRunning() && !isAtLocation(Location.SORCERERS_TOWER_ABOVE)) {
|
||||
CURRENT_QUEST_STEP = "Walking to Thormac";
|
||||
pathWalker(TOWER_ENTRANCE);
|
||||
climb(TOWER_LADDER_UP);
|
||||
@@ -153,8 +128,7 @@ public final class QH_ScorpionCatcher extends QH__QuestHandler {
|
||||
c.sleep(3000);
|
||||
}
|
||||
}
|
||||
QH_BarCrawl barCrawl = new QH_BarCrawl();
|
||||
barCrawl.doBarCrawl();
|
||||
BarCrawl.doBarCrawl();
|
||||
|
||||
if (c.isRunning()) {
|
||||
CURRENT_QUEST_STEP = "Getting Barb Outpost Scorpion";
|
||||
@@ -165,7 +139,7 @@ public final class QH_ScorpionCatcher extends QH__QuestHandler {
|
||||
// DO IN THIS ORDER barb outpost, monestary, tavelry
|
||||
} else if (c.getInventoryItemCount(SCORP_CAGE_STAGE_2) == 1) {
|
||||
if (c.isRunning()) {
|
||||
if (isInRectangle(BARB_OUTPOST_REC)) {
|
||||
if (isAtLocation(Location.BARBARIAN_OUTPOST_INNER)) {
|
||||
atObject(BARB_OUTPOST_DOOR);
|
||||
}
|
||||
CURRENT_QUEST_STEP = "Walking to Monestery Scorpion";
|
||||
@@ -224,7 +198,7 @@ public final class QH_ScorpionCatcher extends QH__QuestHandler {
|
||||
c.walkTo(374, 513);
|
||||
}
|
||||
} else if (c.getInventoryItemCount(SCORP_CAGE_STAGE_4) == 1) {
|
||||
if (c.isRunning() && !isInRectangle(SORCERERS_TOWER_ABOVE)) {
|
||||
if (c.isRunning() && !isAtLocation(Location.SORCERERS_TOWER_ABOVE)) {
|
||||
CURRENT_QUEST_STEP = "Walking to Tower";
|
||||
if (timeToDrinkAntidote) drinkAnti();
|
||||
pathWalker(TOWER_ENTRANCE);
|
||||
@@ -239,15 +213,10 @@ public final class QH_ScorpionCatcher extends QH__QuestHandler {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case -1:
|
||||
quit("Quest completed");
|
||||
break;
|
||||
default:
|
||||
quit("");
|
||||
quit(QuitReason.QUEST_STAGE_NOT_IN_SWITCH);
|
||||
break;
|
||||
}
|
||||
}
|
||||
quit("Script stopped");
|
||||
return 1000;
|
||||
}
|
||||
}
|
||||
+8
-24
@@ -1,9 +1,11 @@
|
||||
package scripting.idlescript;
|
||||
package scripting.idlescript.AIOQuester.quests;
|
||||
|
||||
import models.entities.ItemId;
|
||||
import models.entities.NpcId;
|
||||
import scripting.idlescript.AIOQuester.QuestHandler;
|
||||
import scripting.idlescript.AIOQuester.models.QuitReason;
|
||||
|
||||
public final class QH_SheepShearer extends QH__QuestHandler {
|
||||
public final class SheepShearer extends QuestHandler {
|
||||
|
||||
// COORDINATES FOR walkPath() PATHS AND pickupUnreachableItem()
|
||||
private static final int[] GENERAL_STORE_OUTER = {131, 641};
|
||||
@@ -22,7 +24,7 @@ public final class QH_SheepShearer extends QH__QuestHandler {
|
||||
private static final int[] LADDER = {139, 667};
|
||||
|
||||
// PATHS FOR walkPath()
|
||||
final int[][] COURTYARD_TO_FRED = {
|
||||
static final int[][] COURTYARD_TO_FRED = {
|
||||
COURTYARD_OUTER,
|
||||
GENERAL_STORE_OUTER,
|
||||
ROAD_FURNACE,
|
||||
@@ -69,21 +71,8 @@ public final class QH_SheepShearer extends QH__QuestHandler {
|
||||
"I'm looking for a quest", "Yes okay. I can do that"
|
||||
};
|
||||
|
||||
public int start(String[] param) {
|
||||
QUEST_NAME = "Sheep Shearer";
|
||||
START_RECTANGLE = LUMBRIDGE_CASTLE_COURTYARD;
|
||||
QUEST_REQUIREMENTS = new String[] {};
|
||||
SKILL_REQUIREMENTS = new int[][] {};
|
||||
ITEM_REQUIREMENTS = new int[][] {};
|
||||
EQUIP_REQUIREMENTS = new int[][] {};
|
||||
INVENTORY_SPACES_NEEDED = 21;
|
||||
TOTAL_QUEST_STAGES = 1;
|
||||
doQuestChecks();
|
||||
|
||||
while (c.isRunning()) {
|
||||
if (c.getNeedToMove()) c.moveCharacter();
|
||||
if (c.getShouldSleep()) c.sleepHandler(true);
|
||||
QUEST_STAGE = c.getQuestStage(QUEST_ID);
|
||||
public static void run() {
|
||||
while (isQuesting()) {
|
||||
switch (QUEST_STAGE) {
|
||||
case 0:
|
||||
STEP_ITEMS = new int[][] {{SHEARS_ID, 1}};
|
||||
@@ -145,15 +134,10 @@ public final class QH_SheepShearer extends QH__QuestHandler {
|
||||
if (c.isRunning()) talkToNpcId(FRED_ID);
|
||||
c.sleep(640);
|
||||
break;
|
||||
case -1:
|
||||
quit("quest completed");
|
||||
break;
|
||||
default:
|
||||
quit("");
|
||||
quit(QuitReason.QUEST_STAGE_NOT_IN_SWITCH);
|
||||
break;
|
||||
}
|
||||
}
|
||||
quit("script stopped");
|
||||
return 1000;
|
||||
}
|
||||
}
|
||||
+21
-29
@@ -1,10 +1,12 @@
|
||||
package scripting.idlescript;
|
||||
package scripting.idlescript.AIOQuester.quests;
|
||||
|
||||
import models.entities.ItemId;
|
||||
import models.entities.NpcId;
|
||||
import models.entities.SkillId;
|
||||
import scripting.idlescript.AIOQuester.QuestHandler;
|
||||
import scripting.idlescript.AIOQuester.models.Location;
|
||||
import scripting.idlescript.AIOQuester.models.QuitReason;
|
||||
|
||||
public final class QH_TribalTotem extends QH__QuestHandler {
|
||||
public final class TribalTotem extends QuestHandler {
|
||||
private static final int[][] BOAT_TO_HORACIO = {{546, 609}, {548, 594}, {554, 579}, {555, 579}};
|
||||
private static final int CPT_BARNABY = NpcId.CAPTAIN_BARNABY.getId();
|
||||
private static final int CST_OFFICIAL = NpcId.CUSTOMS_OFFICIAL.getId();
|
||||
@@ -29,7 +31,7 @@ public final class QH_TribalTotem extends QH__QuestHandler {
|
||||
"I'm in search of adventure", "Ok I will get it back"
|
||||
};
|
||||
|
||||
private void openBradDoor() {
|
||||
private static void openBradDoor() {
|
||||
int x = c.currentX();
|
||||
int y = c.currentY();
|
||||
while (c.currentX() == x && c.currentY() == y) {
|
||||
@@ -47,30 +49,19 @@ public final class QH_TribalTotem extends QH__QuestHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public int start(String[] param) { // warning does not handle food conditions
|
||||
QUEST_NAME = "Tribal totem";
|
||||
public static void run() { // warning does not handle food conditions
|
||||
if (c.currentX() < 500 && c.currentX() > 400 && c.currentY() > 645) {
|
||||
START_RECTANGLE = SHRIMP_AND_PARROT; // on brim
|
||||
START_LOCATION = Location.BRIMHAVEN_SHRIMP_AND_PARROT;
|
||||
} else {
|
||||
START_RECTANGLE = ARDY_SOUTH_BANK;
|
||||
START_LOCATION = Location.ARDOUGNE_SOUTH_BANK;
|
||||
}
|
||||
QUEST_REQUIREMENTS = new String[] {};
|
||||
SKILL_REQUIREMENTS = new int[][] {{SkillId.THIEVING.getId(), 21}};
|
||||
EQUIP_REQUIREMENTS = new int[][] {};
|
||||
ITEM_REQUIREMENTS = new int[][] {{ItemId.COINS.getId(), 1000}};
|
||||
INVENTORY_SPACES_NEEDED = 5;
|
||||
TOTAL_QUEST_STAGES = 2;
|
||||
doQuestChecks();
|
||||
|
||||
// c.log("WARNING: Entering dangerous areas, low combat not recommended", "red");
|
||||
c.log("~ by Kaila", "mag");
|
||||
|
||||
while (c.isRunning()) { // start cases with pathwalk for resume cases
|
||||
if (c.getNeedToMove()) c.moveCharacter();
|
||||
if (c.getShouldSleep()) c.sleepHandler(true);
|
||||
QUEST_STAGE = c.getQuestStage(QUEST_ID);
|
||||
while (isQuesting()) {
|
||||
switch (QUEST_STAGE) { // 6 stages in total
|
||||
case 0: // not started
|
||||
if (c.isRunning() && !isInRectangle(START_RECTANGLE)) {
|
||||
if (c.isRunning() && !isAtLocation(START_LOCATION)) {
|
||||
CURRENT_QUEST_STEP = "Walking back to Start";
|
||||
pathWalker(546, 615);
|
||||
}
|
||||
@@ -81,7 +72,10 @@ public final class QH_TribalTotem extends QH__QuestHandler {
|
||||
CURRENT_QUEST_STEP = "Boat to Brimhaven";
|
||||
followNPCDialog(CPT_BARNABY, BOAT_TO_BRIM_DIALOG);
|
||||
CURRENT_QUEST_STEP = "Walking to Bar";
|
||||
c.walkTo(467, 659);
|
||||
while (!c.isCloseToCoord(467, 659) && c.isRunning()) {
|
||||
c.walkTo(467, 659);
|
||||
c.sleep(640);
|
||||
}
|
||||
pathWalker(451, 688);
|
||||
CURRENT_QUEST_STEP = "Starting Quest";
|
||||
followNPCDialog(KANGAI_MAU, KANGAI_MAU_START_DIALOG);
|
||||
@@ -188,7 +182,10 @@ public final class QH_TribalTotem extends QH__QuestHandler {
|
||||
}
|
||||
if (c.isRunning()) {
|
||||
CURRENT_QUEST_STEP = "Walking to Bar";
|
||||
c.walkTo(467, 659);
|
||||
while (!c.isCloseToCoord(467, 659) && c.isRunning()) {
|
||||
c.walkTo(467, 659);
|
||||
c.sleep(640);
|
||||
}
|
||||
pathWalker(451, 688);
|
||||
CURRENT_QUEST_STEP = "Ending Quest";
|
||||
talkToNpcId(KANGAI_MAU);
|
||||
@@ -196,15 +193,10 @@ public final class QH_TribalTotem extends QH__QuestHandler {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case -1:
|
||||
quit("Quest completed");
|
||||
break;
|
||||
default:
|
||||
quit("");
|
||||
quit(QuitReason.QUEST_STAGE_NOT_IN_SWITCH);
|
||||
break;
|
||||
}
|
||||
}
|
||||
quit("Script stopped");
|
||||
return 1000;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package scripting.idlescript.AIOQuester.quests;
|
||||
|
||||
import scripting.idlescript.AIOQuester.QuestHandler;
|
||||
import scripting.idlescript.AIOQuester.models.Location;
|
||||
import scripting.idlescript.AIOQuester.models.QuitReason;
|
||||
|
||||
// ! Quest scripts must extend QuestHandler and have a static void method named run.
|
||||
|
||||
// * Check out QuestHandler for useful methods for writing scripts
|
||||
|
||||
// * Please strive to make quest scripts viable to UIMs.
|
||||
|
||||
/* Any info you need from the QuestDef for your quest you can get from 'quest,'
|
||||
For example, to get the array of required equipped items you would use:
|
||||
quest.getRequiredEquippedItems(); */
|
||||
|
||||
public final class _Example extends QuestHandler {
|
||||
|
||||
// ! Quest scripts must have a static run method. This is what QuestHandler runs
|
||||
public static void run() {
|
||||
/* OPTIONAL: Reassigning START_LOCATION must happen before looping isQuesting.
|
||||
This should only be done if you want a START_LOCATION different from
|
||||
quest.getStartLocation(), which is automatically loaded from the Quest enum by the Handler
|
||||
|
||||
Here's an example of changing the start location based on inventory items */
|
||||
if (c.getInventoryItemCount(10) > 2) {
|
||||
START_LOCATION = Location.ARDOUGNE_MONASTERY;
|
||||
} else if (c.getInventoryItemCount(129) < 1) {
|
||||
START_LOCATION = Location.BARBARIAN_OUTPOST_ENTRANCE;
|
||||
}
|
||||
|
||||
/* REQUIRED: isQuesting will check if the controller is still running every loop,
|
||||
as well as update QUEST_STAGE, and check if the quest is complete.
|
||||
It will also walk to START_LOCATION during the first loop
|
||||
|
||||
This will keep looping until either the controller is stopped,
|
||||
the quit method is called, or the quest is completed */
|
||||
while (isQuesting()) {
|
||||
|
||||
/* REQUIRED FOR NON-MINIQUESTS: Start stage checking loop here.
|
||||
Quest complete stage (-1) is already handled in isQuesting().
|
||||
If you get the QUEST_STAGE_NOT_IN_SWITCH error, you haven't defined your current quest
|
||||
stage in the switch
|
||||
|
||||
Miniquests don't have stages, so you'll have to be a bit more creative with them */
|
||||
switch (QUEST_STAGE) {
|
||||
/* Add a case for each quest stage */
|
||||
|
||||
/* At the end of every stage case, you should add a call to
|
||||
sleepUntilQuestStageChanges() to make sure nothing unexpected happens.
|
||||
Make sure everything else in the stage is finished or the script will get
|
||||
stuck. */
|
||||
case 0:
|
||||
// You can set CURRENT_QUEST_STEP to update the paint's second string.
|
||||
CURRENT_QUEST_STEP = "Doing stage 0 stuff";
|
||||
// Do stage 0 stuff here
|
||||
sleepUntilQuestStageChanges();
|
||||
case 1:
|
||||
CURRENT_QUEST_STEP = "Doing stage 1 stuff";
|
||||
// Do stage 1 stuff here
|
||||
sleepUntilQuestStageChanges();
|
||||
break;
|
||||
default:
|
||||
// REQUIRED: Quest stage isn't defined in switch
|
||||
quit(QuitReason.QUEST_STAGE_NOT_IN_SWITCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,7 @@ import models.entities.ItemId;
|
||||
* @author Dvorak - origional script
|
||||
* <p>Searos - modified and expanded
|
||||
* <p>Kaila - full update, gui, rewrite
|
||||
* <p>Seatta - fixed holy/unholy symbol crafting and replaced ids with ItemIds
|
||||
*/
|
||||
/*
|
||||
* todo
|
||||
@@ -54,35 +55,35 @@ public class AIOSmelter extends IdleScript {
|
||||
private long startTime;
|
||||
private int destinationId = -1;
|
||||
private final int[] productIds = { // product smelting in same order as options
|
||||
169,
|
||||
170,
|
||||
384,
|
||||
171,
|
||||
1041,
|
||||
172,
|
||||
173,
|
||||
174,
|
||||
408,
|
||||
44,
|
||||
1027,
|
||||
283,
|
||||
288,
|
||||
296,
|
||||
284,
|
||||
289,
|
||||
297,
|
||||
285,
|
||||
290,
|
||||
298,
|
||||
286,
|
||||
291,
|
||||
299,
|
||||
287,
|
||||
292,
|
||||
300,
|
||||
543,
|
||||
544,
|
||||
524,
|
||||
ItemId.BRONZE_BAR.getId(),
|
||||
ItemId.IRON_BAR.getId(),
|
||||
ItemId.SILVER_BAR.getId(),
|
||||
ItemId.STEEL_BAR.getId(),
|
||||
ItemId.MULTI_CANNON_BALL.getId(),
|
||||
ItemId.GOLD_BAR.getId(),
|
||||
ItemId.MITHRIL_BAR.getId(),
|
||||
ItemId.ADAMANTITE_BAR.getId(),
|
||||
ItemId.RUNITE_BAR.getId(),
|
||||
ItemId.UNSTRUNG_HOLY_SYMBOL_OF_SARADOMIN.getId(),
|
||||
ItemId.UNSTRUNG_UNHOLY_SYMBOL_OF_ZAMORAK.getId(),
|
||||
ItemId.GOLD_RING.getId(),
|
||||
ItemId.GOLD_NECKLACE.getId(),
|
||||
ItemId.UNSTRUNG_GOLD_AMULET.getId(),
|
||||
ItemId.SAPPHIRE_RING.getId(),
|
||||
ItemId.SAPPHIRE_NECKLACE.getId(),
|
||||
ItemId.UNSTRUNG_SAPPHIRE_AMULET.getId(),
|
||||
ItemId.EMERALD_RING.getId(),
|
||||
ItemId.EMERALD_NECKLACE.getId(),
|
||||
ItemId.UNSTRUNG_EMERALD_AMULET.getId(),
|
||||
ItemId.RUBY_RING.getId(),
|
||||
ItemId.RUBY_NECKLACE.getId(),
|
||||
ItemId.UNSTRUNG_RUBY_AMULET.getId(),
|
||||
ItemId.DIAMOND_RING.getId(),
|
||||
ItemId.DIAMOND_NECKLACE.getId(),
|
||||
ItemId.UNSTRUNG_DIAMOND_AMULET.getId(),
|
||||
ItemId.DRAGONSTONE_RING.getId(),
|
||||
ItemId.DRAGONSTONE_NECKLACE.getId(),
|
||||
ItemId.UNSTRUNG_DRAGONSTONE_AMULET.getId(),
|
||||
ItemId.GOLD_CROWN.getId(),
|
||||
ItemId.SAPPHIRE_CROWN.getId(),
|
||||
ItemId.EMERALD_CROWN.getId(),
|
||||
@@ -182,6 +183,9 @@ public class AIOSmelter extends IdleScript {
|
||||
c.stop();
|
||||
}
|
||||
}*/
|
||||
|
||||
// Fixes UI not showing up after stopping the script once in a session
|
||||
if (!c.isRunning()) guiSetup = false;
|
||||
return 1000; // start() must return an int value now.
|
||||
}
|
||||
|
||||
@@ -205,35 +209,43 @@ public class AIOSmelter extends IdleScript {
|
||||
int mouldAnswer = -1;
|
||||
int gemAnswer = 0;
|
||||
|
||||
if (oreId == 1057) { // do not use the cannonball mold on the furnace!
|
||||
oreId = 171;
|
||||
} else if (c.getInventoryItemCount(293) > 0) {
|
||||
oreId = 172;
|
||||
if (oreId
|
||||
== ItemId.CANNON_AMMO_MOULD.getId()) { // do not use the cannonball mold on the furnace!
|
||||
oreId = ItemId.STEEL_BAR.getId();
|
||||
} else if (c.getInventoryItemCount(ItemId.RING_MOULD.getId()) > 0) {
|
||||
oreId = ItemId.GOLD_BAR.getId();
|
||||
mouldAnswer = 0;
|
||||
} else if (c.getInventoryItemCount(295) > 0) {
|
||||
oreId = 172;
|
||||
} else if (c.getInventoryItemCount(ItemId.NECKLACE_MOULD.getId()) > 0) {
|
||||
oreId = ItemId.GOLD_BAR.getId();
|
||||
mouldAnswer = 0; // was 1, Fixes menuing after crafting update
|
||||
} else if (c.getInventoryItemCount(294) > 0) {
|
||||
oreId = 172;
|
||||
} else if (c.getInventoryItemCount(ItemId.AMULET_MOULD.getId()) > 0) {
|
||||
oreId = ItemId.GOLD_BAR.getId();
|
||||
mouldAnswer = 0; // was 2, Fixes menuing after crafting update
|
||||
} else if (c.getInventoryItemCount(1502) > 0) {
|
||||
oreId = 172;
|
||||
} else if (c.getInventoryItemCount(ItemId.CROWN_MOULD.getId()) > 0) {
|
||||
oreId = ItemId.GOLD_BAR.getId();
|
||||
mouldAnswer = 0;
|
||||
} else if (c.getInventoryItemCount(ItemId.HOLY_SYMBOL_MOULD.getId()) > 0) {
|
||||
oreId = ItemId.SILVER_BAR.getId();
|
||||
mouldAnswer = 0;
|
||||
} else if (c.getInventoryItemCount(ItemId.UNHOLY_SYMBOL_MOULD.getId()) > 0) {
|
||||
oreId = ItemId.SILVER_BAR.getId();
|
||||
mouldAnswer = 1;
|
||||
}
|
||||
|
||||
if (c.isAuthentic()) { // for uranium only
|
||||
if (c.getInventoryItemCount(164) > 0) gemAnswer = 1;
|
||||
if (c.getInventoryItemCount(163) > 0) gemAnswer = 2;
|
||||
if (c.getInventoryItemCount(162) > 0) gemAnswer = 3;
|
||||
if (c.getInventoryItemCount(161) > 0) gemAnswer = 4;
|
||||
if (c.getInventoryItemCount(523) > 0) gemAnswer = 5;
|
||||
if (c.getInventoryItemCount(ItemId.SAPPHIRE.getId()) > 0) gemAnswer = 1;
|
||||
if (c.getInventoryItemCount(ItemId.EMERALD.getId()) > 0) gemAnswer = 2;
|
||||
if (c.getInventoryItemCount(ItemId.RUBY.getId()) > 0) gemAnswer = 3;
|
||||
if (c.getInventoryItemCount(ItemId.DIAMOND.getId()) > 0) gemAnswer = 4;
|
||||
if (c.getInventoryItemCount(ItemId.DRAGONSTONE.getId()) > 0) gemAnswer = 5;
|
||||
}
|
||||
if (c.getInventoryItemCount(oreId) > 0 && c.getNearestObjectById(118) != null) {
|
||||
|
||||
c.waitForBatching(false);
|
||||
if (c.getInventoryItemCount(699) > 0) { // wield gauntlets
|
||||
if (c.getInventoryItemCount(ItemId.GAUNTLETS_OF_GOLDSMITHING.getId())
|
||||
> 0) { // wield gauntlets
|
||||
c.setStatus("Wielding gauntlets..");
|
||||
c.equipItem(c.getInventoryItemSlotIndex(699));
|
||||
c.equipItem(c.getInventoryItemSlotIndex(ItemId.GAUNTLETS_OF_GOLDSMITHING.getId()));
|
||||
c.sleep(618);
|
||||
}
|
||||
c.setStatus("Smelting!");
|
||||
@@ -243,10 +255,10 @@ public class AIOSmelter extends IdleScript {
|
||||
c.getNearestObjectById(118)[0], c.getNearestObjectById(118)[1], oreId);
|
||||
c.sleep(640); // added tick to resync the bot before checking batching
|
||||
}
|
||||
if (oreId == 171) {
|
||||
if (oreId == ItemId.STEEL_BAR.getId()) {
|
||||
c.sleep(
|
||||
3000); // cannonballs take way longer and can be interrupted by starting another one
|
||||
} else if (oreId == 172) {
|
||||
} else if (oreId == ItemId.GOLD_BAR.getId() || oreId == ItemId.SILVER_BAR.getId()) {
|
||||
c.sleep(800);
|
||||
c.optionAnswer(mouldAnswer);
|
||||
c.sleep(800);
|
||||
@@ -279,17 +291,20 @@ public class AIOSmelter extends IdleScript {
|
||||
c.sleep(2000);
|
||||
if (c.isInBank()) {
|
||||
for (int itemId : c.getInventoryUniqueItemIds()) {
|
||||
if (itemId != 0 && itemId != 1263 && itemId != 1057) {
|
||||
if (itemId != 0
|
||||
&& itemId != ItemId.SLEEPING_BAG.getId()
|
||||
&& itemId != ItemId.CANNON_AMMO_MOULD.getId()) {
|
||||
c.depositItem(itemId, c.getInventoryItemCount(itemId));
|
||||
c.sleep(618);
|
||||
}
|
||||
}
|
||||
c.sleep(1280);
|
||||
for (Map.Entry<Integer, Integer> entry : ingredients.entrySet()) {
|
||||
if (entry.getKey() == 699) continue;
|
||||
if (entry.getKey() == ItemId.GAUNTLETS_OF_GOLDSMITHING.getId()) continue;
|
||||
|
||||
if (entry.getKey() == 151 || entry.getKey() == 153) {
|
||||
if (c.getInventoryItemCount(1263) > 0)
|
||||
if (entry.getKey() == ItemId.IRON_ORE.getId()
|
||||
|| entry.getKey() == ItemId.MITHRIL_ORE.getId()) {
|
||||
if (c.getInventoryItemCount(ItemId.SLEEPING_BAG.getId()) > 0)
|
||||
c.withdrawItem(entry.getKey(), entry.getValue() - 1);
|
||||
else c.withdrawItem(entry.getKey(), entry.getValue());
|
||||
|
||||
@@ -307,9 +322,9 @@ public class AIOSmelter extends IdleScript {
|
||||
|
||||
private boolean isEnoughOre() {
|
||||
for (Map.Entry<Integer, Integer> entry : ingredients.entrySet()) {
|
||||
if (entry.getKey() == 699) continue;
|
||||
if (entry.getKey() == ItemId.GAUNTLETS_OF_GOLDSMITHING.getId()) continue;
|
||||
|
||||
if (c.getInventoryItemCount(1263) > 0) {
|
||||
if (c.getInventoryItemCount(ItemId.SLEEPING_BAG.getId()) > 0) {
|
||||
if (c.getInventoryItemCount(entry.getKey())
|
||||
< entry.getValue()
|
||||
- 1) // this is why bot leaves after 1 ore when batching is off. When ores in inv
|
||||
@@ -386,96 +401,112 @@ public class AIOSmelter extends IdleScript {
|
||||
}
|
||||
|
||||
private void whatIsOreId() {
|
||||
if (barId == 169) { // bronze Bars
|
||||
primaryOreId = 150;
|
||||
secondaryOreId = 202;
|
||||
if (barId == ItemId.BRONZE_BAR.getId()) { // bronze Bars
|
||||
primaryOreId = ItemId.COPPER_ORE.getId();
|
||||
secondaryOreId = ItemId.TIN_ORE.getId();
|
||||
barName = "Bronze Bars";
|
||||
primaryName = "Copper";
|
||||
secondaryName = "Tin";
|
||||
} else if (barId == 170) { // Iron Bars
|
||||
primaryOreId = 151;
|
||||
} else if (barId == ItemId.IRON_BAR.getId()) { // Iron Bars
|
||||
primaryOreId = ItemId.IRON_ORE.getId();
|
||||
barName = "Iron Bars";
|
||||
primaryName = "Iron Ore";
|
||||
secondaryName = "N/A";
|
||||
} else if (barId == 384) { // Silver Bars
|
||||
primaryOreId = 383;
|
||||
} else if (barId == ItemId.SILVER_BAR.getId()) { // Silver Bars
|
||||
primaryOreId = ItemId.SILVER.getId();
|
||||
barName = "Silver Bars";
|
||||
primaryName = "Silver Ore";
|
||||
secondaryName = "N/A";
|
||||
} else if (barId == 171) { // Steel Bars
|
||||
primaryOreId = 151;
|
||||
secondaryOreId = 155;
|
||||
} else if (barId == ItemId.STEEL_BAR.getId()) { // Steel Bars
|
||||
primaryOreId = ItemId.IRON_ORE.getId();
|
||||
secondaryOreId = ItemId.COAL.getId();
|
||||
barName = "Steel Bars";
|
||||
primaryName = "Iron Ore";
|
||||
secondaryName = "Coal Ore";
|
||||
} else if (barId == 1041) { // Cannonballs
|
||||
primaryOreId = 171;
|
||||
} else if (barId == ItemId.MULTI_CANNON_BALL.getId()) { // Cannonballs
|
||||
primaryOreId = ItemId.STEEL_BAR.getId();
|
||||
barName = "Cannonballs";
|
||||
primaryName = "Steel Bars";
|
||||
secondaryName = "N/A";
|
||||
} else if (barId == 172) { // Gold Bars
|
||||
primaryOreId = 152;
|
||||
} else if (barId == ItemId.GOLD_BAR.getId()) { // Gold Bars
|
||||
primaryOreId = ItemId.GOLD.getId();
|
||||
barName = "Gold Bars";
|
||||
primaryName = "Gold Ore";
|
||||
secondaryName = "N/A";
|
||||
} else if (barId == 173) { // Mithril Bar
|
||||
primaryOreId = 153;
|
||||
secondaryOreId = 155;
|
||||
} else if (barId == ItemId.MITHRIL_BAR.getId()) { // Mithril Bar
|
||||
primaryOreId = ItemId.MITHRIL_ORE.getId();
|
||||
secondaryOreId = ItemId.COAL.getId();
|
||||
barName = "Mithril Bars";
|
||||
primaryName = "Mithril Ore";
|
||||
secondaryName = "Coal Ore";
|
||||
} else if (barId == 174) { // Addy Bar
|
||||
primaryOreId = 154;
|
||||
secondaryOreId = 155;
|
||||
} else if (barId == ItemId.ADAMANTITE_BAR.getId()) { // Addy Bar
|
||||
primaryOreId = ItemId.ADAMANTITE_ORE.getId();
|
||||
secondaryOreId = ItemId.COAL.getId();
|
||||
barName = "Addy Bars";
|
||||
primaryName = "Addy Ore";
|
||||
secondaryName = "Coal Ore";
|
||||
} else if (barId == 408) { // Rune Bar
|
||||
primaryOreId = 409;
|
||||
secondaryOreId = 155;
|
||||
} else if (barId == ItemId.RUNITE_BAR.getId()) { // Rune Bar
|
||||
primaryOreId = ItemId.RUNITE_ORE.getId();
|
||||
secondaryOreId = ItemId.COAL.getId();
|
||||
barName = "Rune Bars";
|
||||
primaryName = "Runite Ore";
|
||||
secondaryName = "Coal Ore";
|
||||
} else if (barId == 44 || barId == 1027) { // holy/unholy/etc
|
||||
} else if (barId == ItemId.UNSTRUNG_HOLY_SYMBOL_OF_SARADOMIN.getId()
|
||||
|| barId == ItemId.UNSTRUNG_UNHOLY_SYMBOL_OF_ZAMORAK.getId()) { // holy/unholy/etc
|
||||
primaryOreId = 29;
|
||||
barName = "Holy/Unholy Symbols";
|
||||
primaryName = "Silver Bar";
|
||||
secondaryName = "N/A";
|
||||
} else if (barId == 283 || barId == 288 || barId == 296) { // gold jewelry
|
||||
primaryOreId = 172;
|
||||
} else if (barId == ItemId.GOLD_RING.getId()
|
||||
|| barId == ItemId.GOLD_NECKLACE.getId()
|
||||
|| barId == ItemId.UNSTRUNG_GOLD_AMULET.getId()
|
||||
|| barId == ItemId.GOLD_CROWN.getId()) { // gold jewelry
|
||||
primaryOreId = ItemId.GOLD_BAR.getId();
|
||||
barName = "Gold Jewelry";
|
||||
primaryName = "Gold Ore";
|
||||
secondaryName = "N/A";
|
||||
} else if (barId == 284 || barId == 289 || barId == 297 || barId == 1504) { // Sapphire Jewelry
|
||||
primaryOreId = 164;
|
||||
secondaryOreId = 172;
|
||||
} else if (barId == ItemId.SAPPHIRE_RING.getId()
|
||||
|| barId == ItemId.SAPPHIRE_NECKLACE.getId()
|
||||
|| barId == ItemId.UNSTRUNG_SAPPHIRE_AMULET.getId()
|
||||
|| barId == ItemId.SAPPHIRE_CROWN.getId()) { // Sapphire Jewelry
|
||||
primaryOreId = ItemId.SAPPHIRE.getId();
|
||||
secondaryOreId = ItemId.GOLD_BAR.getId();
|
||||
barName = "Sapphire Jewelry";
|
||||
primaryName = "Sapphires";
|
||||
secondaryName = "Gold Bars";
|
||||
} else if (barId == 285 || barId == 290 || barId == 298 || barId == 1505) { // Emerald Jewelry
|
||||
primaryOreId = 163;
|
||||
secondaryOreId = 172;
|
||||
} else if (barId == ItemId.EMERALD_RING.getId()
|
||||
|| barId == ItemId.EMERALD_NECKLACE.getId()
|
||||
|| barId == ItemId.UNSTRUNG_EMERALD_AMULET.getId()
|
||||
|| barId == ItemId.EMERALD_CROWN.getId()) { // Emerald Jewelry
|
||||
primaryOreId = ItemId.EMERALD.getId();
|
||||
secondaryOreId = ItemId.GOLD_BAR.getId();
|
||||
barName = "Emerald Jewelry";
|
||||
primaryName = "Emeralds";
|
||||
secondaryName = "Gold Bars";
|
||||
} else if (barId == 286 || barId == 291 || barId == 299 || barId == 1506) { // Ruby Jewelry
|
||||
primaryOreId = 162;
|
||||
secondaryOreId = 172;
|
||||
} else if (barId == ItemId.RUBY_RING.getId()
|
||||
|| barId == ItemId.RUBY_NECKLACE.getId()
|
||||
|| barId == ItemId.UNSTRUNG_RUBY_AMULET.getId()
|
||||
|| barId == ItemId.RUBY_CROWN.getId()) { // Ruby Jewelry
|
||||
primaryOreId = ItemId.RUBY.getId();
|
||||
secondaryOreId = ItemId.GOLD_BAR.getId();
|
||||
barName = "Ruby Jewelry";
|
||||
primaryName = "Rubys";
|
||||
secondaryName = "Gold Bars";
|
||||
} else if (barId == 287 || barId == 292 || barId == 300 || barId == 1507) { // Diamond Jewelry
|
||||
primaryOreId = 172;
|
||||
secondaryOreId = 202;
|
||||
} else if (barId == ItemId.DIAMOND_RING.getId()
|
||||
|| barId == ItemId.DIAMOND_NECKLACE.getId()
|
||||
|| barId == ItemId.UNSTRUNG_DIAMOND_AMULET.getId()
|
||||
|| barId == ItemId.DIAMOND_CROWN.getId()) { // Diamond Jewelry
|
||||
primaryOreId = ItemId.GOLD_BAR.getId();
|
||||
secondaryOreId = ItemId.TIN_ORE.getId();
|
||||
barName = "Diamond Jewelry";
|
||||
primaryName = "Diamonds";
|
||||
secondaryName = "Gold Bars";
|
||||
} else if (barId == 543
|
||||
|| barId == 544
|
||||
|| barId == 524
|
||||
|| barId == 1508) { // Dragonstone Jewelry
|
||||
primaryOreId = 523;
|
||||
secondaryOreId = 172;
|
||||
} else if (barId == ItemId.DRAGONSTONE_RING.getId()
|
||||
|| barId == ItemId.DRAGONSTONE_NECKLACE.getId()
|
||||
|| barId == ItemId.UNSTRUNG_DRAGONSTONE_AMULET.getId()
|
||||
|| barId == ItemId.DRAGONSTONE_CROWN.getId()) { // Dragonstone Jewelry
|
||||
primaryOreId = ItemId.DRAGONSTONE.getId();
|
||||
secondaryOreId = ItemId.GOLD_BAR.getId();
|
||||
barName = "Dragonstone Jewelry";
|
||||
primaryName = "Dragonstones";
|
||||
secondaryName = "Gold Bars";
|
||||
@@ -554,248 +585,248 @@ public class AIOSmelter extends IdleScript {
|
||||
new HashMap<Integer, Map<Integer, Integer>>() {
|
||||
{
|
||||
put(
|
||||
169,
|
||||
ItemId.BRONZE_BAR.getId(),
|
||||
new HashMap<Integer, Integer>() { // bronze
|
||||
{
|
||||
put(150, 15);
|
||||
put(202, 15);
|
||||
put(ItemId.COPPER_ORE.getId(), 15);
|
||||
put(ItemId.TIN_ORE.getId(), 15);
|
||||
}
|
||||
}); // bronze needs 1 copper and 1 tin
|
||||
put(
|
||||
170,
|
||||
ItemId.IRON_BAR.getId(),
|
||||
new HashMap<Integer, Integer>() { // iron
|
||||
{
|
||||
put(151, 30);
|
||||
put(ItemId.IRON_ORE.getId(), 30);
|
||||
}
|
||||
}); // iron needs 1 iron ore
|
||||
put(
|
||||
384,
|
||||
ItemId.SILVER_BAR.getId(),
|
||||
new HashMap<Integer, Integer>() { // silver
|
||||
{
|
||||
put(383, 30);
|
||||
put(ItemId.SILVER.getId(), 30);
|
||||
}
|
||||
}); // silver needs 1 silver ore
|
||||
put(
|
||||
171,
|
||||
ItemId.STEEL_BAR.getId(),
|
||||
new HashMap<Integer, Integer>() { // steel
|
||||
{
|
||||
put(151, 10);
|
||||
put(155, 20);
|
||||
put(ItemId.IRON_ORE.getId(), 10);
|
||||
put(ItemId.COAL.getId(), 20);
|
||||
}
|
||||
}); // steel needs 1 iron 2 coal
|
||||
put(
|
||||
1041,
|
||||
ItemId.MULTI_CANNON_BALL.getId(),
|
||||
new HashMap<Integer, Integer>() { // cannonballs
|
||||
{
|
||||
put(1057, 1); // cannonballs
|
||||
put(171, 29);
|
||||
put(ItemId.CANNON_AMMO_MOULD.getId(), 1); // cannonballs
|
||||
put(ItemId.STEEL_BAR.getId(), 29);
|
||||
}
|
||||
});
|
||||
put(
|
||||
172,
|
||||
ItemId.GOLD_BAR.getId(),
|
||||
new HashMap<Integer, Integer>() { // gold
|
||||
{
|
||||
put(152, 29); // gold
|
||||
put(699, 1);
|
||||
put(ItemId.GOLD.getId(), 29); // gold
|
||||
put(ItemId.GAUNTLETS_OF_GOLDSMITHING.getId(), 1);
|
||||
}
|
||||
}); // gold needs 1 gold ore
|
||||
put(
|
||||
173,
|
||||
ItemId.MITHRIL_BAR.getId(),
|
||||
new HashMap<Integer, Integer>() { // mith bar
|
||||
{
|
||||
put(153, 6);
|
||||
put(155, 24); // coal
|
||||
put(ItemId.MITHRIL_ORE.getId(), 6);
|
||||
put(ItemId.COAL.getId(), 24); // coal
|
||||
}
|
||||
});
|
||||
put(
|
||||
174,
|
||||
ItemId.ADAMANTITE_BAR.getId(),
|
||||
new HashMap<Integer, Integer>() { // addy bar
|
||||
{
|
||||
put(154, 4);
|
||||
put(155, 24);
|
||||
put(ItemId.ADAMANTITE_ORE.getId(), 4);
|
||||
put(ItemId.COAL.getId(), 24);
|
||||
}
|
||||
});
|
||||
put(
|
||||
408,
|
||||
ItemId.RUNITE_BAR.getId(),
|
||||
new HashMap<Integer, Integer>() { // runite bar
|
||||
{
|
||||
put(409, 3);
|
||||
put(155, 24);
|
||||
put(ItemId.RUNITE_ORE.getId(), 3);
|
||||
put(ItemId.COAL.getId(), 24);
|
||||
}
|
||||
});
|
||||
put(
|
||||
44,
|
||||
ItemId.UNSTRUNG_HOLY_SYMBOL_OF_SARADOMIN.getId(),
|
||||
new HashMap<Integer, Integer>() { // Holy symbol
|
||||
{
|
||||
put(384, 29);
|
||||
put(386, 1);
|
||||
put(ItemId.SILVER_BAR.getId(), 29);
|
||||
put(ItemId.HOLY_SYMBOL_MOULD.getId(), 1);
|
||||
}
|
||||
});
|
||||
put(
|
||||
1027,
|
||||
ItemId.UNSTRUNG_UNHOLY_SYMBOL_OF_ZAMORAK.getId(),
|
||||
new HashMap<Integer, Integer>() { // Unholy symbol
|
||||
{
|
||||
put(384, 29);
|
||||
put(1026, 1);
|
||||
put(ItemId.SILVER_BAR.getId(), 29);
|
||||
put(ItemId.UNHOLY_SYMBOL_MOULD.getId(), 1);
|
||||
}
|
||||
});
|
||||
put(
|
||||
283,
|
||||
ItemId.GOLD_RING.getId(),
|
||||
new HashMap<Integer, Integer>() { // Gold ring
|
||||
{
|
||||
put(293, 1);
|
||||
put(172, 29);
|
||||
put(ItemId.RING_MOULD.getId(), 1);
|
||||
put(ItemId.GOLD_BAR.getId(), 29);
|
||||
}
|
||||
});
|
||||
put(
|
||||
288,
|
||||
ItemId.GOLD_NECKLACE.getId(),
|
||||
new HashMap<Integer, Integer>() { // Gold necklace
|
||||
{
|
||||
put(295, 1);
|
||||
put(172, 29);
|
||||
put(ItemId.NECKLACE_MOULD.getId(), 1);
|
||||
put(ItemId.GOLD_BAR.getId(), 29);
|
||||
}
|
||||
});
|
||||
put(
|
||||
296,
|
||||
ItemId.UNSTRUNG_GOLD_AMULET.getId(),
|
||||
new HashMap<Integer, Integer>() { // Gold amulet
|
||||
{
|
||||
put(294, 1);
|
||||
put(172, 29);
|
||||
put(ItemId.AMULET_MOULD.getId(), 1);
|
||||
put(ItemId.GOLD_BAR.getId(), 29);
|
||||
}
|
||||
});
|
||||
put(
|
||||
284,
|
||||
ItemId.SAPPHIRE_RING.getId(),
|
||||
new HashMap<Integer, Integer>() { // Sapphire ring
|
||||
{
|
||||
put(293, 1);
|
||||
put(172, 14);
|
||||
put(164, 14);
|
||||
put(ItemId.RING_MOULD.getId(), 1);
|
||||
put(ItemId.GOLD_BAR.getId(), 14);
|
||||
put(ItemId.SAPPHIRE.getId(), 14);
|
||||
}
|
||||
});
|
||||
put(
|
||||
289,
|
||||
ItemId.SAPPHIRE_NECKLACE.getId(),
|
||||
new HashMap<Integer, Integer>() { // Sapphire necklace
|
||||
{
|
||||
put(295, 1);
|
||||
put(172, 14);
|
||||
put(164, 14);
|
||||
put(ItemId.NECKLACE_MOULD.getId(), 1);
|
||||
put(ItemId.GOLD_BAR.getId(), 14);
|
||||
put(ItemId.SAPPHIRE.getId(), 14);
|
||||
}
|
||||
});
|
||||
put(
|
||||
297,
|
||||
ItemId.UNSTRUNG_SAPPHIRE_AMULET.getId(),
|
||||
new HashMap<Integer, Integer>() { // Sapphire amulet
|
||||
{
|
||||
put(294, 1);
|
||||
put(172, 14);
|
||||
put(164, 14);
|
||||
put(ItemId.AMULET_MOULD.getId(), 1);
|
||||
put(ItemId.GOLD_BAR.getId(), 14);
|
||||
put(ItemId.SAPPHIRE.getId(), 14);
|
||||
}
|
||||
});
|
||||
put(
|
||||
285,
|
||||
ItemId.EMERALD_RING.getId(),
|
||||
new HashMap<Integer, Integer>() { // Emerald ring
|
||||
{
|
||||
put(293, 1);
|
||||
put(172, 14);
|
||||
put(163, 14);
|
||||
put(ItemId.RING_MOULD.getId(), 1);
|
||||
put(ItemId.GOLD_BAR.getId(), 14);
|
||||
put(ItemId.EMERALD.getId(), 14);
|
||||
}
|
||||
});
|
||||
put(
|
||||
290,
|
||||
ItemId.EMERALD_NECKLACE.getId(),
|
||||
new HashMap<Integer, Integer>() { // Emerald necklace
|
||||
{
|
||||
put(295, 1);
|
||||
put(172, 14);
|
||||
put(163, 14);
|
||||
put(ItemId.NECKLACE_MOULD.getId(), 1);
|
||||
put(ItemId.GOLD_BAR.getId(), 14);
|
||||
put(ItemId.EMERALD.getId(), 14);
|
||||
}
|
||||
});
|
||||
put(
|
||||
298,
|
||||
ItemId.UNSTRUNG_EMERALD_AMULET.getId(),
|
||||
new HashMap<Integer, Integer>() { // Emerald amulet
|
||||
{
|
||||
put(294, 1);
|
||||
put(172, 14);
|
||||
put(163, 14);
|
||||
put(ItemId.AMULET_MOULD.getId(), 1);
|
||||
put(ItemId.GOLD_BAR.getId(), 14);
|
||||
put(ItemId.EMERALD.getId(), 14);
|
||||
}
|
||||
});
|
||||
put(
|
||||
286,
|
||||
ItemId.RUBY_RING.getId(),
|
||||
new HashMap<Integer, Integer>() { // Ruby ring
|
||||
{
|
||||
put(293, 1);
|
||||
put(172, 14);
|
||||
put(162, 14);
|
||||
put(ItemId.RING_MOULD.getId(), 1);
|
||||
put(ItemId.GOLD_BAR.getId(), 14);
|
||||
put(ItemId.RUBY.getId(), 14);
|
||||
}
|
||||
});
|
||||
put(
|
||||
291,
|
||||
ItemId.RUBY_NECKLACE.getId(),
|
||||
new HashMap<Integer, Integer>() { // Ruby necklace
|
||||
{
|
||||
put(295, 1);
|
||||
put(172, 14);
|
||||
put(162, 14);
|
||||
put(ItemId.NECKLACE_MOULD.getId(), 1);
|
||||
put(ItemId.GOLD_BAR.getId(), 14);
|
||||
put(ItemId.RUBY.getId(), 14);
|
||||
}
|
||||
});
|
||||
put(
|
||||
299,
|
||||
ItemId.UNSTRUNG_RUBY_AMULET.getId(),
|
||||
new HashMap<Integer, Integer>() { // Ruby amulet
|
||||
{
|
||||
put(294, 1);
|
||||
put(172, 14);
|
||||
put(162, 14);
|
||||
put(ItemId.AMULET_MOULD.getId(), 1);
|
||||
put(ItemId.GOLD_BAR.getId(), 14);
|
||||
put(ItemId.RUBY.getId(), 14);
|
||||
}
|
||||
});
|
||||
put(
|
||||
287,
|
||||
ItemId.DIAMOND_RING.getId(),
|
||||
new HashMap<Integer, Integer>() { // Diamond ring
|
||||
{
|
||||
put(293, 1);
|
||||
put(172, 14);
|
||||
put(161, 14);
|
||||
put(ItemId.RING_MOULD.getId(), 1);
|
||||
put(ItemId.GOLD_BAR.getId(), 14);
|
||||
put(ItemId.DIAMOND.getId(), 14);
|
||||
}
|
||||
});
|
||||
put(
|
||||
292,
|
||||
ItemId.DIAMOND_NECKLACE.getId(),
|
||||
new HashMap<Integer, Integer>() { // Diamond necklace
|
||||
{
|
||||
put(295, 1);
|
||||
put(172, 14);
|
||||
put(161, 14);
|
||||
put(ItemId.NECKLACE_MOULD.getId(), 1);
|
||||
put(ItemId.GOLD_BAR.getId(), 14);
|
||||
put(ItemId.DIAMOND.getId(), 14);
|
||||
}
|
||||
});
|
||||
put(
|
||||
300,
|
||||
ItemId.UNSTRUNG_DIAMOND_AMULET.getId(),
|
||||
new HashMap<Integer, Integer>() { // Diamond amulet
|
||||
{
|
||||
put(294, 1);
|
||||
put(172, 14);
|
||||
put(161, 14);
|
||||
put(ItemId.AMULET_MOULD.getId(), 1);
|
||||
put(ItemId.GOLD_BAR.getId(), 14);
|
||||
put(ItemId.DIAMOND.getId(), 14);
|
||||
}
|
||||
});
|
||||
put(
|
||||
543,
|
||||
ItemId.DRAGONSTONE_RING.getId(),
|
||||
new HashMap<Integer, Integer>() { // Dragonstone ring
|
||||
{
|
||||
put(293, 1);
|
||||
put(172, 14);
|
||||
put(523, 14);
|
||||
put(ItemId.RING_MOULD.getId(), 1);
|
||||
put(ItemId.GOLD_BAR.getId(), 14);
|
||||
put(ItemId.DRAGONSTONE.getId(), 14);
|
||||
}
|
||||
});
|
||||
put(
|
||||
544,
|
||||
ItemId.DRAGONSTONE_NECKLACE.getId(),
|
||||
new HashMap<Integer, Integer>() { // Dragonstone necklace
|
||||
{
|
||||
put(295, 1);
|
||||
put(172, 14);
|
||||
put(523, 14);
|
||||
put(ItemId.NECKLACE_MOULD.getId(), 1);
|
||||
put(ItemId.GOLD_BAR.getId(), 14);
|
||||
put(ItemId.DRAGONSTONE.getId(), 14);
|
||||
}
|
||||
});
|
||||
put(
|
||||
524,
|
||||
ItemId.UNSTRUNG_DRAGONSTONE_AMULET.getId(),
|
||||
new HashMap<Integer, Integer>() { // Dragonstone amulet
|
||||
{
|
||||
put(294, 1);
|
||||
put(172, 14);
|
||||
put(523, 14);
|
||||
put(ItemId.AMULET_MOULD.getId(), 1);
|
||||
put(ItemId.GOLD_BAR.getId(), 14);
|
||||
put(ItemId.DRAGONSTONE.getId(), 14);
|
||||
}
|
||||
});
|
||||
put(
|
||||
@@ -811,8 +842,8 @@ public class AIOSmelter extends IdleScript {
|
||||
new HashMap<Integer, Integer>() { // Sapp Crown
|
||||
{
|
||||
put(ItemId.CROWN_MOULD.getId(), 1);
|
||||
put(172, 14);
|
||||
put(164, 14);
|
||||
put(ItemId.GOLD_BAR.getId(), 14);
|
||||
put(ItemId.SAPPHIRE.getId(), 14);
|
||||
}
|
||||
});
|
||||
put(
|
||||
@@ -820,8 +851,8 @@ public class AIOSmelter extends IdleScript {
|
||||
new HashMap<Integer, Integer>() { // Emerald Crown
|
||||
{
|
||||
put(ItemId.CROWN_MOULD.getId(), 1);
|
||||
put(172, 14);
|
||||
put(163, 14);
|
||||
put(ItemId.GOLD_BAR.getId(), 14);
|
||||
put(ItemId.EMERALD.getId(), 14);
|
||||
}
|
||||
});
|
||||
put(
|
||||
@@ -829,8 +860,8 @@ public class AIOSmelter extends IdleScript {
|
||||
new HashMap<Integer, Integer>() { // ruby Crown
|
||||
{
|
||||
put(ItemId.CROWN_MOULD.getId(), 1);
|
||||
put(172, 14);
|
||||
put(162, 14);
|
||||
put(ItemId.GOLD_BAR.getId(), 14);
|
||||
put(ItemId.RUBY.getId(), 14);
|
||||
}
|
||||
});
|
||||
put(
|
||||
@@ -838,8 +869,8 @@ public class AIOSmelter extends IdleScript {
|
||||
new HashMap<Integer, Integer>() { // Diamond Crown
|
||||
{
|
||||
put(ItemId.CROWN_MOULD.getId(), 1);
|
||||
put(172, 14);
|
||||
put(161, 14);
|
||||
put(ItemId.GOLD_BAR.getId(), 14);
|
||||
put(ItemId.DIAMOND.getId(), 14);
|
||||
}
|
||||
});
|
||||
put(
|
||||
@@ -847,8 +878,8 @@ public class AIOSmelter extends IdleScript {
|
||||
new HashMap<Integer, Integer>() { // Dragonstone Crown
|
||||
{
|
||||
put(ItemId.CROWN_MOULD.getId(), 1);
|
||||
put(172, 14);
|
||||
put(523, 14);
|
||||
put(ItemId.GOLD_BAR.getId(), 14);
|
||||
put(ItemId.DRAGONSTONE.getId(), 14);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -991,7 +991,7 @@ public class K_kailaScript extends IdleScript {
|
||||
* combat.
|
||||
* @return boolean -- true if was able to drink, false if not
|
||||
*/
|
||||
protected static boolean drinkAnti(boolean leaveCombat) {
|
||||
public static boolean drinkAnti(boolean leaveCombat) {
|
||||
int[] curepoison = {
|
||||
ItemId.CURE_POISON_POTION_1DOSE.getId(),
|
||||
ItemId.CURE_POISON_POTION_2DOSE.getId(),
|
||||
|
||||
@@ -1,40 +1,84 @@
|
||||
package scripting.idlescript;
|
||||
|
||||
import bot.Main;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Queue;
|
||||
|
||||
/**
|
||||
* Tests walking around the map to random locations
|
||||
* Tests walking to specific coordinates passed as parameters
|
||||
*
|
||||
* @author Red Bracket
|
||||
* @author
|
||||
*/
|
||||
public class WebwalkTester extends IdleScript {
|
||||
|
||||
private final List<List<Integer>> coords =
|
||||
Arrays.asList(
|
||||
Arrays.asList(111, 659), // North of Church
|
||||
Arrays.asList(116, 635), // By Goblin House
|
||||
Arrays.asList(115, 711), // Lummy mines
|
||||
Arrays.asList(118, 607), // Chicken pen
|
||||
Arrays.asList(162, 652)); // Southwest of HAM hideout
|
||||
private List<Integer> dest = coords.get(0);
|
||||
private int successCount = 0;
|
||||
private Queue<Integer> coordinates = new LinkedList<>();
|
||||
private boolean scriptStarted = false;
|
||||
private Integer currentDestX = null;
|
||||
private Integer currentDestY = null;
|
||||
|
||||
public int start(String[] parameters) {
|
||||
if (Main.getController().currentX() == dest.get(0)
|
||||
&& Main.getController().currentY() == dest.get(1)) {
|
||||
Main.getController().log("Reached dest! Picking new location..");
|
||||
dest = coords.get((int) (Math.random() * coords.size()));
|
||||
successCount += 1;
|
||||
if (!scriptStarted) {
|
||||
if (!startup(parameters)) stop();
|
||||
}
|
||||
|
||||
Main.getController().log("Webwalking to: " + dest.get(0) + ", " + dest.get(1));
|
||||
Main.getController().walkTowards(dest.get(0), dest.get(1));
|
||||
if (currentDestX == null && currentDestY == null) {
|
||||
if (coordinates.isEmpty()) {
|
||||
Main.getController().log("All destinations reached!");
|
||||
stop();
|
||||
return 0;
|
||||
} else {
|
||||
currentDestX = coordinates.poll();
|
||||
currentDestY = coordinates.poll();
|
||||
Main.getController().log("New destination: " + currentDestX + ", " + currentDestY);
|
||||
}
|
||||
}
|
||||
|
||||
if (Main.getController().currentX() == currentDestX
|
||||
&& Main.getController().currentY() == currentDestY) {
|
||||
Main.getController().log("Made it to " + currentDestX + ", " + currentDestY + "!");
|
||||
currentDestX = null;
|
||||
currentDestY = null;
|
||||
} else {
|
||||
Main.getController().log("Webwalking to: " + currentDestX + ", " + currentDestY);
|
||||
Main.getController().walkTowards(currentDestX, currentDestY);
|
||||
}
|
||||
|
||||
return 1000;
|
||||
}
|
||||
|
||||
private boolean startup(String[] parameters) {
|
||||
scriptStarted = true;
|
||||
if (parameters.length != 1) {
|
||||
Main.getController()
|
||||
.log("Invalid parameters. Please pass in coordinates as comma-separated integers.");
|
||||
return false;
|
||||
}
|
||||
|
||||
String[] coords = parameters[0].split(",");
|
||||
if (coords.length % 2 != 0) {
|
||||
Main.getController()
|
||||
.log("Invalid format. Please pass in an even number of comma-separated integers.");
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
for (String coord : coords) {
|
||||
coordinates.add(Integer.parseInt(coord.trim()));
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
Main.getController().log("Invalid format. Coordinates must be integers.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void stop() {
|
||||
scriptStarted = false;
|
||||
coordinates.clear();
|
||||
Main.getController().stop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintInterrupt() {
|
||||
Main.getController().drawString("@red@Webwalk Tester", 6, 21, 0xFFFFFF, 1);
|
||||
@@ -48,14 +92,17 @@ public class WebwalkTester extends IdleScript {
|
||||
21 + 14 * 1,
|
||||
0xFFFFFF,
|
||||
1);
|
||||
if (currentDestX != null && currentDestY != null) {
|
||||
Main.getController()
|
||||
.drawString(
|
||||
"@red@Current destination: " + currentDestX + ", " + currentDestY,
|
||||
6,
|
||||
21 + 14 * 2,
|
||||
0xFFFFFF,
|
||||
1);
|
||||
}
|
||||
Main.getController()
|
||||
.drawString(
|
||||
"@red@Current destination: " + dest.get(0) + ", " + dest.get(1),
|
||||
6,
|
||||
21 + 14 * 2,
|
||||
0xFFFFFF,
|
||||
1);
|
||||
Main.getController()
|
||||
.drawString("@red@Successful walks: " + successCount, 6, 21 + 14 * 3, 0xFFFFFF, 1);
|
||||
"@red@Remaining destinations: " + coordinates.size() / 2, 6, 21 + 14 * 3, 0xFFFFFF, 1);
|
||||
}
|
||||
}
|
||||
@@ -98,8 +98,6 @@
|
||||
232,610,243,610,11,
|
||||
259,611,260,626,16,
|
||||
260,626,260,642,16,
|
||||
260,642,269,642,9,
|
||||
269,642,269,658,16,
|
||||
269,658,275,666,34,
|
||||
275,666,284,676,19,
|
||||
283,692,284,676,17,
|
||||
@@ -114,7 +112,6 @@
|
||||
309,668,309,678,10,
|
||||
260,626,273,629,18,
|
||||
273,629,277,644,23,
|
||||
269,642,277,644,22,
|
||||
277,644,284,652,15,
|
||||
284,652,291,659,14,
|
||||
291,659,297,665,12,
|
||||
@@ -166,15 +163,7 @@
|
||||
119,511,120,519,9,
|
||||
107,525,120,519,19,
|
||||
104,510,119,511,18,
|
||||
82,510,91,509,10,
|
||||
82,510,82,496,14,
|
||||
78,486,82,496,14,
|
||||
78,486,83,475,16,
|
||||
80,463,83,475,17,
|
||||
73,452,80,463,18,
|
||||
73,452,75,442,12,
|
||||
83,475,88,486,16,
|
||||
82,496,88,486,16,
|
||||
91,509,99,520,19,
|
||||
99,520,107,525,17,
|
||||
118,540,129,549,20,
|
||||
@@ -184,7 +173,6 @@
|
||||
72,545,76,541,8,
|
||||
75,528,76,541,14,
|
||||
75,528,83,518,18,
|
||||
82,510,83,518,9,
|
||||
71,560,72,545,16,
|
||||
71,560,83,561,13,
|
||||
83,561,84,574,14,
|
||||
@@ -1986,3 +1974,22 @@
|
||||
57,547,53,558,15,
|
||||
53,558,46,550,15,
|
||||
137,464,141,1398,-1,varrockPalaceNorthwestLadder
|
||||
536,616,467,647,-1,brimhavenArdyBoat
|
||||
260,642,268,646,12,
|
||||
268,646,277,644,19,
|
||||
268,646,269,658,13,
|
||||
268,646,323,713,-1,portSarimKaramjaBoat
|
||||
69,503,74,503,5,
|
||||
74,503,82,502,-1,varrockEastDigsiteGate
|
||||
82,502,82,491,13,
|
||||
82,491,82,480,11,
|
||||
82,480,89,470,17,
|
||||
82,480,80,468,18,
|
||||
80,468,76,458,14,
|
||||
76,458,73,452,9,
|
||||
89,470,91,459,13,
|
||||
91,459,99,451,16,
|
||||
99,451,110,451,11,
|
||||
99,451,96,438,16,
|
||||
91,509,82,502,16,
|
||||
91,509,83,518,17,
|
||||
@@ -98,8 +98,6 @@
|
||||
232,610,243,610,11,
|
||||
259,611,260,626,16,
|
||||
260,626,260,642,16,
|
||||
260,642,269,642,9,
|
||||
269,642,269,658,16,
|
||||
269,658,275,666,34,
|
||||
275,666,284,676,19,
|
||||
283,692,284,676,17,
|
||||
@@ -114,7 +112,6 @@
|
||||
309,668,309,678,10,
|
||||
260,626,273,629,18,
|
||||
273,629,277,644,23,
|
||||
269,642,277,644,22,
|
||||
277,644,284,652,15,
|
||||
284,652,291,659,14,
|
||||
291,659,297,665,12,
|
||||
@@ -166,15 +163,7 @@
|
||||
119,511,120,519,9,
|
||||
107,525,120,519,19,
|
||||
104,510,119,511,18,
|
||||
82,510,91,509,10,
|
||||
82,510,82,496,14,
|
||||
78,486,82,496,14,
|
||||
78,486,83,475,16,
|
||||
80,463,83,475,17,
|
||||
73,452,80,463,18,
|
||||
73,452,75,442,12,
|
||||
83,475,88,486,16,
|
||||
82,496,88,486,16,
|
||||
91,509,99,520,19,
|
||||
99,520,107,525,17,
|
||||
118,540,129,549,20,
|
||||
@@ -184,7 +173,6 @@
|
||||
72,545,76,541,8,
|
||||
75,528,76,541,14,
|
||||
75,528,83,518,18,
|
||||
82,510,83,518,9,
|
||||
71,560,72,545,16,
|
||||
71,560,83,561,13,
|
||||
83,561,84,574,14,
|
||||
@@ -1986,3 +1974,23 @@
|
||||
57,547,53,558,15,
|
||||
53,558,46,550,15,
|
||||
137,464,141,1398,-1,varrockPalaceNorthwestLadder
|
||||
536,616,467,647,-1,brimhavenArdyBoat
|
||||
260,642,268,646,12,
|
||||
268,646,277,644,19,
|
||||
268,646,269,658,13,
|
||||
268,646,323,713,-1,portSarimKaramjaBoat
|
||||
69,503,74,503,5,
|
||||
74,503,82,502,-1,varrockEastDigsiteGate
|
||||
82,502,82,491,13,
|
||||
82,491,82,480,11,
|
||||
82,480,89,470,17,
|
||||
82,480,80,468,18,
|
||||
80,468,76,458,14,
|
||||
76,458,73,452,9,
|
||||
89,470,91,459,13,
|
||||
91,459,99,451,16,
|
||||
99,451,110,451,11,
|
||||
99,451,96,438,16,
|
||||
91,509,82,502,16,
|
||||
91,509,83,518,17,
|
||||
220,3522,215,691,12,wizardTowerBasement
|
||||
+20
-12
@@ -98,8 +98,6 @@
|
||||
232,610,243,610,11,
|
||||
259,611,260,626,16,
|
||||
260,626,260,642,16,
|
||||
260,642,269,642,9,
|
||||
269,642,269,658,16,
|
||||
269,658,275,666,34,
|
||||
275,666,284,676,19,
|
||||
283,692,284,676,17,
|
||||
@@ -114,7 +112,6 @@
|
||||
309,668,309,678,10,
|
||||
260,626,273,629,18,
|
||||
273,629,277,644,23,
|
||||
269,642,277,644,22,
|
||||
277,644,284,652,15,
|
||||
284,652,291,659,14,
|
||||
291,659,297,665,12,
|
||||
@@ -166,15 +163,7 @@
|
||||
119,511,120,519,9,
|
||||
107,525,120,519,19,
|
||||
104,510,119,511,18,
|
||||
82,510,91,509,10,
|
||||
82,510,82,496,14,
|
||||
78,486,82,496,14,
|
||||
78,486,83,475,16,
|
||||
80,463,83,475,17,
|
||||
73,452,80,463,18,
|
||||
73,452,75,442,12,
|
||||
83,475,88,486,16,
|
||||
82,496,88,486,16,
|
||||
91,509,99,520,19,
|
||||
99,520,107,525,17,
|
||||
118,540,129,549,20,
|
||||
@@ -184,7 +173,6 @@
|
||||
72,545,76,541,8,
|
||||
75,528,76,541,14,
|
||||
75,528,83,518,18,
|
||||
82,510,83,518,9,
|
||||
71,560,72,545,16,
|
||||
71,560,83,561,13,
|
||||
83,561,84,574,14,
|
||||
@@ -1986,3 +1974,23 @@
|
||||
57,547,53,558,15,
|
||||
53,558,46,550,15,
|
||||
137,464,141,1398,-1,varrockPalaceNorthwestLadder
|
||||
536,616,467,647,-1,brimhavenArdyBoat
|
||||
260,642,268,646,12,
|
||||
268,646,277,644,19,
|
||||
268,646,269,658,13,
|
||||
268,646,323,713,-1,portSarimKaramjaBoat
|
||||
69,503,74,503,5,
|
||||
74,503,82,502,-1,varrockEastDigsiteGate
|
||||
82,502,82,491,13,
|
||||
82,491,82,480,11,
|
||||
82,480,89,470,17,
|
||||
82,480,80,468,18,
|
||||
80,468,76,458,14,
|
||||
76,458,73,452,9,
|
||||
89,470,91,459,13,
|
||||
91,459,99,451,16,
|
||||
99,451,110,451,11,
|
||||
99,451,96,438,16,
|
||||
91,509,82,502,16,
|
||||
91,509,83,518,17,
|
||||
220,3522,215,691,12,wizardTowerBasement
|
||||
Reference in new issue
Block a user