Fixup dropping items

This commit is contained in:
Danial
2021-10-07 13:58:39 +13:00
parent ab7be16b6b
commit 3eedd24f50
4 changed files with 19 additions and 9 deletions
+3 -1
View File
@@ -1,6 +1,7 @@
package ParaScript.data;
import ParaScript.DesktopTray;
import ParaScript.Methods;
import ParaScript.data.variables.*;
import org.rev317.min.api.methods.Skill;
import org.rev317.min.api.wrappers.Tile;
@@ -177,7 +178,8 @@ public class Variables {
case "Woodcutting":
return new int[]{woodcutting_tree_selected.getItemID()};
case "Mining":
return mining_rock_selected.getItemID();
// Include the gems array as mining will sometimes drop gems
return Methods.combineIntArrays(mining_rock_selected.getItemID(), Rocks.GEM.getItemID());
case "Fishing":
return fishing_spot_selected.getItemIDs();
case "Attack":
@@ -29,7 +29,7 @@ public enum Rocks {
public int x = 0;
public int y = 0;
Rocks(final String name, final int[] objectId, final int levelReq, final int xp, final int mineTimer, final int respawnTimer, final int... oreIds) {
Rocks(final String name, final int[] objectId, final int levelReq, final int xp, final int mineTimer, final int respawnTimer, final int[] oreIds) {
this.name = name;
this.objectId = objectId;
this.levelReq = levelReq;
@@ -5,12 +5,12 @@ import java.util.Arrays;
import java.util.List;
public enum Trees {
NORMAL("Normal", new int[]{1276, 1277, 1278, 1279, 1280}, 1512),
OAK("Oak", new int[]{1281}, 1522),
WILLOW ("Willow", new int[]{1308, 5551, 5552, 5553}, 1520),
MAPLE("Maple", new int[]{1307}, 1518),
YEW("Yew", new int[]{1309}, 1516),
MAGIC("Magic", new int[]{1306}, 1514);
NORMAL("Normal", new int[]{1276, 1277, 1278, 1279, 1280}, 1511),
OAK("Oak", new int[]{1281}, 1521),
WILLOW ("Willow", new int[]{1308, 5551, 5552, 5553}, 1519),
MAPLE("Maple", new int[]{1307}, 1517),
YEW("Yew", new int[]{1309}, 1515),
MAGIC("Magic", new int[]{1306}, 1513);
private String name;
private int[] ids;
@@ -12,7 +12,7 @@ public class Drop implements Strategy {
@Override
public boolean activate() {
items = Inventory.getItems(Variables.getItemIDs());
items = Inventory.getItems(inventoryItemIDs(Variables.getItemIDs()));
return Variables.running
&& Game.isLoggedIn()
&& Variables.shouldDropItems()
@@ -29,4 +29,12 @@ public class Drop implements Strategy {
}
}
}
// Return the item id + 1 (odd way inventory items are handled)
public int[] inventoryItemIDs(int[] itemIDs) {
for(int i = 0; i < itemIDs.length; i++) {
++itemIDs[i];
}
return itemIDs;
}
}