Show items gained, exp gained

This commit is contained in:
RedSparr0w
2019-10-15 11:07:36 +13:00
parent b2b103d626
commit 755cdd30a1
9 changed files with 85 additions and 38 deletions
+8 -4
View File
@@ -69,18 +69,22 @@ public class Main extends Script implements MessageListener, Paintable {
g.setColor(Color.WHITE);
g.setFont(new Font("Arial", 1, 14));
g.drawString("AIOWoodcutter", 360, 247);
g.drawString("ParaScript", 360, 247);
g.setFont(new Font("Arial", 1, 11));
g.drawString("Status: " + Variables.getStatus(), 360, 270);
g.drawString("Logs(P/H): " + 10 + "(" + 120 + ")", 360, 290);
g.drawString("EXP(P/H): " + 1000 + "(" + 12685 + ")", 360, 310);
g.drawString("Runtime: " + "02:22:20", 360, 330);
g.drawString("Items(P/H): " + Methods.formatNumber(Variables.itemsGained) + "(" + Methods.formatNumber(Variables.SCRIPT_TIMER.getPerHour(Variables.itemsGained)) + ")", 360, 290);
g.drawString("EXP(P/H): " + Methods.formatNumber((int) Variables.expGained) + "(" + Methods.formatNumber(Variables.SCRIPT_TIMER.getPerHour((int) Variables.expGained)) + ")", 360, 310);
g.drawString("Runtime: " + Variables.SCRIPT_TIMER.toString(), 360, 330);
}
public void messageReceived(MessageEvent message) {
switch (message.getType()) {
case 0:
if (message.getMessage().startsWith("You manage to ")) {
Variables.addItemGained(1);
Variables.addExpGained();
}
if (message.getMessage().contains("Congratulations, you advanced a woodcutting level.")) {
// add in level up to paint
}
+17
View File
@@ -0,0 +1,17 @@
package ParaScript;
import java.text.DecimalFormat;
public class Methods {
public static String formatNumber(int number) {
DecimalFormat nf = new DecimalFormat("0.0");
double i = number;
if (i >= 1000000) {
return nf.format((i / 1000000)) + "M";
}
if (i >= 1000) {
return nf.format((i / 1000)) + "K";
}
return "" + number;
}
}
+24 -2
View File
@@ -3,14 +3,19 @@ package ParaScript.data;
import ParaScript.data.variables.Ores;
import ParaScript.data.variables.Trees;
import ParaScript.data.variables.Zone;
import org.parabot.environment.api.utils.Timer;
import org.rev317.min.api.wrappers.Tile;
import org.rev317.min.api.wrappers.TilePath;
import java.util.List;
public class Variables {
public static final Timer SCRIPT_TIMER = new Timer();
public static boolean running = false;
private static String currentStatus = "none";
public static int itemsGained = 0;
public static double expGained = 0;
// Login Panel
private static String username = "";
@@ -20,10 +25,10 @@ public class Variables {
public static String skill_to_train = "Woodcutting";
// Woodcutting
public static int[] woodcutting_tree_selected = Trees.NORMAL.getIDs();
public static Trees woodcutting_tree_selected = Trees.NORMAL;
// Mining
public static int[] mining_ore_selected = Ores.COPPER_TIN.getIDs();
public static Ores mining_ore_selected = Ores.COPPER_TIN;
// Used for slave accounts
public static String slaveMaster = "";
@@ -79,4 +84,21 @@ public class Variables {
public static String getAccountPassword() { return password; }
public static void setAccountPassword(String i) { password = i; }
public static void addItemGained(int amount){
itemsGained += amount;
}
public static void addExpGained(){
double xp_to_add = 0;
switch(skill_to_train){
case "woodcutting":
xp_to_add = woodcutting_tree_selected.getXP();
break;
case "mining":
xp_to_add = mining_ore_selected.getXP();
break;
}
expGained += xp_to_add;
}
}
@@ -5,18 +5,20 @@ import java.util.Arrays;
import java.util.List;
public enum Ores {
COPPER_TIN("Copper & Tin", new int[]{2090, 2094}),
COPPER("Copper", new int[]{2090}),
TIN("Tin", new int[]{2094}),
IRON ("Iron", new int[]{2092}),
COAL("Coal", new int[]{});
COPPER_TIN("Copper & Tin", new int[]{2090, 2094}, 17.5),
COPPER("Copper", new int[]{2090}, 17.5),
TIN("Tin", new int[]{2094}, 17.5),
IRON ("Iron", new int[]{2092}, 35),
COAL("Coal", new int[]{}, 50);
private String name;
private int[] ids;
private double xp;
Ores(String name, int[] ids) {
Ores(String name, int[] ids, double xp) {
this.name = name;
this.ids = ids;
this.xp = xp;
}
public static String[] toStringArray() {
@@ -33,7 +35,7 @@ public enum Ores {
public String getName() { return this.name; }
public int[] getIDs() {
return this.ids;
}
public int[] getIDs() { return this.ids; }
public double getXP() { return this.xp; }
}
@@ -5,17 +5,19 @@ import java.util.Arrays;
import java.util.List;
public enum Trees {
NORMAL("Normal", new int[]{1276, 1278, 1279}),
OAK("Oak", new int[]{1281}),
WILLOW ("Willow", new int[]{5551, 1308, 5553, 5552}),
MAPLE("Maple", new int[]{1307});
NORMAL("Normal", new int[]{1276, 1278, 1279}, 25),
OAK("Oak", new int[]{1281}, 37.5),
WILLOW ("Willow", new int[]{5551, 1308, 5553, 5552}, 47.5),
MAPLE("Maple", new int[]{1307}, 100);
private String name;
private int[] ids;
private double xp;
Trees(String name, int[] ids) {
Trees(String name, int[] ids, double xp) {
this.name = name;
this.ids = ids;
this.xp = xp;
}
public static String[] toStringArray() {
@@ -32,7 +34,7 @@ public enum Trees {
public String getName() { return this.name; }
public int[] getIDs() {
return this.ids;
}
public int[] getIDs() { return this.ids; }
public double getXP() { return this.xp; }
}
@@ -41,7 +41,7 @@ public class Mine implements Strategy {
}
private SceneObject ore(){
int[] ore_to_mine = Variables.mining_ore_selected;
int[] ore_to_mine = Variables.mining_ore_selected.getIDs();
if (ore_to_mine == Ores.COPPER_TIN.getIDs()) {
if (Inventory.getCount(437) >= 14)
ore_to_mine = Ores.TIN.getIDs();
@@ -37,7 +37,7 @@ public class WoodcutTree implements Strategy {
}
private SceneObject tree(){
int[] tree_to_cut = Variables.woodcutting_tree_selected;
int[] tree_to_cut = Variables.woodcutting_tree_selected.getIDs();
for(SceneObject tree : SceneObjects.getNearest(tree_to_cut)){
if(tree != null){
if(Variables.LUMBRIDGE_NORMAL_TREE_ZONE.inTheZoneObject(tree)) {
+2 -2
View File
@@ -139,7 +139,7 @@ public class UI extends JFrame {
public void actionPerformed(ActionEvent e) {
for (Trees tree : Trees.values()) {
if (tree.getName().equalsIgnoreCase(treeSelect.getSelectedItem().toString())) {
Variables.mining_ore_selected = tree.getIDs();
Variables.woodcutting_tree_selected = tree;
}
}
}
@@ -220,7 +220,7 @@ public class UI extends JFrame {
public void actionPerformed(ActionEvent e) {
for (Ores ore : Ores.values()) {
if (ore.getName().equalsIgnoreCase(oreSelect.getSelectedItem().toString())) {
Variables.mining_ore_selected = ore.getIDs();
Variables.mining_ore_selected = ore;
}
}
}