mirror of
https://github.com/2006Scape-Scripts/ParaScript.git
synced 2026-07-02 16:49:02 +00:00
Add pickup and bury bones methods
This commit is contained in:
Generated
+2
-2
@@ -5,7 +5,7 @@
|
|||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/main/java/ParaScript/Main.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ParaScript/Main.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/main/java/ParaScript/Main.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ParaScript/Main.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/main/java/ParaScript/data/Variables.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ParaScript/data/Variables.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/main/java/ParaScript/data/Variables.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ParaScript/data/Variables.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/main/java/ParaScript/data/variables/Npcs.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ParaScript/data/variables/ThievingNpcs.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/main/java/ParaScript/strategies/Fighting.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ParaScript/strategies/Fighting.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/main/java/ParaScript/strategies/PickupItems.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ParaScript/strategies/PickupItems.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/main/java/ParaScript/strategies/PickupItems.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ParaScript/strategies/PickupItems.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/main/java/ParaScript/ui/UI.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ParaScript/ui/UI.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/main/java/ParaScript/ui/UI.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ParaScript/ui/UI.java" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
@@ -58,8 +58,8 @@
|
|||||||
<recent name="C:\Users\Dan-j\Documents\GitHub\ParaScript" />
|
<recent name="C:\Users\Dan-j\Documents\GitHub\ParaScript" />
|
||||||
</key>
|
</key>
|
||||||
<key name="CopyClassDialog.RECENTS_KEY">
|
<key name="CopyClassDialog.RECENTS_KEY">
|
||||||
<recent name="ParaScript.data.variables" />
|
|
||||||
<recent name="ParaScript.strategies" />
|
<recent name="ParaScript.strategies" />
|
||||||
|
<recent name="ParaScript.data.variables" />
|
||||||
<recent name="ParaScript" />
|
<recent name="ParaScript" />
|
||||||
<recent name="ParaScript.ui" />
|
<recent name="ParaScript.ui" />
|
||||||
<recent name="ParaScript.data" />
|
<recent name="ParaScript.data" />
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ public class Main extends Script implements MessageListener, Paintable {
|
|||||||
strategies.add(new Thieving());
|
strategies.add(new Thieving());
|
||||||
}
|
}
|
||||||
if(Variables.skill_to_train == Skill.ATTACK) {
|
if(Variables.skill_to_train == Skill.ATTACK) {
|
||||||
|
strategies.add(new PickupItems());
|
||||||
|
strategies.add(new BuryBones());
|
||||||
strategies.add(new Fighting());
|
strategies.add(new Fighting());
|
||||||
}
|
}
|
||||||
if(Variables.skill_to_train == null) {
|
if(Variables.skill_to_train == null) {
|
||||||
|
|||||||
@@ -30,13 +30,14 @@ public class Variables {
|
|||||||
public static Ores mining_ore_selected = Ores.COPPER_TIN;
|
public static Ores mining_ore_selected = Ores.COPPER_TIN;
|
||||||
public static String mining_method = "Bank";
|
public static String mining_method = "Bank";
|
||||||
|
|
||||||
|
// Fighting
|
||||||
|
public static FightingNpcs fighting_npc_selected = FightingNpcs.MAN_WOMAN;
|
||||||
|
public static boolean fighting_bury_bones = true;
|
||||||
|
|
||||||
// Thieving
|
// Thieving
|
||||||
public static ThievingNpcs thieving_npc_selected = ThievingNpcs.MAN_WOMAN;
|
public static ThievingNpcs thieving_npc_selected = ThievingNpcs.MAN_WOMAN;
|
||||||
//public static String thieving_method = "None";
|
//public static String thieving_method = "None";
|
||||||
|
|
||||||
// Fighting
|
|
||||||
public static FightingNpcs fighting_npc_selected = FightingNpcs.MAN_WOMAN;
|
|
||||||
|
|
||||||
|
|
||||||
// Used for slave accounts
|
// Used for slave accounts
|
||||||
public static String slaveMaster = "";
|
public static String slaveMaster = "";
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package ParaScript.strategies;
|
||||||
|
|
||||||
|
import ParaScript.data.Variables;
|
||||||
|
import org.parabot.environment.api.utils.Time;
|
||||||
|
import org.parabot.environment.scripts.framework.Strategy;
|
||||||
|
import org.rev317.min.api.methods.Inventory;
|
||||||
|
import org.rev317.min.api.methods.Items;
|
||||||
|
import org.rev317.min.api.methods.Menu;
|
||||||
|
import org.rev317.min.api.methods.Players;
|
||||||
|
|
||||||
|
public class BuryBones implements Strategy {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean activate() {
|
||||||
|
if (Variables.running
|
||||||
|
&& Variables.fighting_bury_bones
|
||||||
|
&& hasBones()
|
||||||
|
&& !Players.getMyPlayer().isInCombat()
|
||||||
|
&& Players.getMyPlayer().getAnimation() == -1
|
||||||
|
&& Inventory.isFull()) {
|
||||||
|
Variables.setStatus("burying bones");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
Variables.setStatus("none");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
buryBones();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buryBones(){
|
||||||
|
try {
|
||||||
|
Inventory.getItem(527).interact(Items.Option.SECOND);
|
||||||
|
Time.sleep(250);
|
||||||
|
if (hasBones()) buryBones();
|
||||||
|
} catch (Exception err) {
|
||||||
|
System.out.println("Bone burying error: ¯\\_(ツ)_/¯");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean hasBones(){
|
||||||
|
// Make sure we have bones
|
||||||
|
return Inventory.getItem(527) != null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -30,8 +30,8 @@ public class Fighting implements Strategy {
|
|||||||
public void execute() {
|
public void execute() {
|
||||||
victim.interact(Npcs.Option.ATTACK);
|
victim.interact(Npcs.Option.ATTACK);
|
||||||
Time.sleep(2000);
|
Time.sleep(2000);
|
||||||
// Wait for the Player to finish attacking (max 5 seconds)
|
// Wait for the Player to finish attacking (max 30 seconds)
|
||||||
Time.sleep(() -> !Players.getMyPlayer().isInCombat(), 5000);
|
Time.sleep(() -> !Players.getMyPlayer().isInCombat(), 30000);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Npc victim(){
|
private Npc victim(){
|
||||||
|
|||||||
@@ -4,19 +4,19 @@ import ParaScript.data.Variables;
|
|||||||
import ParaScript.data.variables.Ores;
|
import ParaScript.data.variables.Ores;
|
||||||
import org.parabot.environment.api.utils.Time;
|
import org.parabot.environment.api.utils.Time;
|
||||||
import org.parabot.environment.scripts.framework.Strategy;
|
import org.parabot.environment.scripts.framework.Strategy;
|
||||||
import org.rev317.min.api.methods.GroundItems;
|
import org.rev317.min.api.methods.*;
|
||||||
import org.rev317.min.api.methods.Inventory;
|
|
||||||
import org.rev317.min.api.methods.Players;
|
|
||||||
import org.rev317.min.api.methods.SceneObjects;
|
|
||||||
import org.rev317.min.api.wrappers.GroundItem;
|
import org.rev317.min.api.wrappers.GroundItem;
|
||||||
import org.rev317.min.api.wrappers.SceneObject;
|
import org.rev317.min.api.wrappers.SceneObject;
|
||||||
|
import org.rev317.min.api.wrappers.Tile;
|
||||||
|
|
||||||
public class PickupItems implements Strategy {
|
public class PickupItems implements Strategy {
|
||||||
|
GroundItem[] items;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean activate() {
|
public boolean activate() {
|
||||||
|
items = getItems();
|
||||||
if (Variables.running
|
if (Variables.running
|
||||||
&& (Variables.getStatus() == "none" || Variables.getStatus() == "picking up items")
|
&& items.length > 0
|
||||||
&& !Players.getMyPlayer().isInCombat()
|
&& !Players.getMyPlayer().isInCombat()
|
||||||
&& Players.getMyPlayer().getAnimation() == -1
|
&& Players.getMyPlayer().getAnimation() == -1
|
||||||
&& !Inventory.isFull()) {
|
&& !Inventory.isFull()) {
|
||||||
@@ -30,12 +30,10 @@ public class PickupItems implements Strategy {
|
|||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
try {
|
try {
|
||||||
GroundItem[] items = GroundItems.getNearest(436, 438, 440);
|
|
||||||
for (GroundItem item : items) {
|
for (GroundItem item : items) {
|
||||||
item.take();
|
item.take();
|
||||||
Time.sleep(1500);
|
Time.sleep(() -> item.distanceTo() < 1, 2000);
|
||||||
if (Inventory.isFull()){
|
if (Inventory.isFull()){
|
||||||
Variables.setStatus("none");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -43,4 +41,13 @@ public class PickupItems implements Strategy {
|
|||||||
System.out.println("Pickup items error: ¯\\_(ツ)_/¯");
|
System.out.println("Pickup items error: ¯\\_(ツ)_/¯");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private GroundItem[] getItems(){
|
||||||
|
int[] itemIDs = new int[]{};
|
||||||
|
if (Variables.skill_to_train == Skill.ATTACK){
|
||||||
|
if (Variables.fighting_bury_bones)
|
||||||
|
itemIDs = new int[]{526};
|
||||||
|
}
|
||||||
|
return GroundItems.getNearest(itemIDs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -12,10 +12,7 @@ import org.rev317.min.api.methods.Skill;
|
|||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.border.EmptyBorder;
|
import javax.swing.border.EmptyBorder;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.*;
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.awt.event.FocusEvent;
|
|
||||||
import java.awt.event.FocusListener;
|
|
||||||
|
|
||||||
public class UI extends JFrame {
|
public class UI extends JFrame {
|
||||||
private final ButtonGroup woodcutOptionButtonGroup = new ButtonGroup();
|
private final ButtonGroup woodcutOptionButtonGroup = new ButtonGroup();
|
||||||
@@ -43,6 +40,7 @@ public class UI extends JFrame {
|
|||||||
private JComboBox fightingNpcSelect = new JComboBox();
|
private JComboBox fightingNpcSelect = new JComboBox();
|
||||||
private JLabel lblFightingNpcCustomID = new JLabel("Custom NPC IDs");
|
private JLabel lblFightingNpcCustomID = new JLabel("Custom NPC IDs");
|
||||||
private JTextField fightingNpcCustomID = new JTextField();
|
private JTextField fightingNpcCustomID = new JTextField();
|
||||||
|
private JCheckBox fightingBuryBones = new JCheckBox();
|
||||||
|
|
||||||
// Thieving
|
// Thieving
|
||||||
private JComboBox thievingNpcSelect = new JComboBox();
|
private JComboBox thievingNpcSelect = new JComboBox();
|
||||||
@@ -336,6 +334,21 @@ public class UI extends JFrame {
|
|||||||
lblFightingNpcCustomID.setVisible(false);
|
lblFightingNpcCustomID.setVisible(false);
|
||||||
fightingNpcCustomID.setVisible(false);
|
fightingNpcCustomID.setVisible(false);
|
||||||
|
|
||||||
|
JLabel lblFightingBuryBones = new JLabel("Collect and bury bones");
|
||||||
|
lblFightingBuryBones.setForeground(Color_WhiteSmoke);
|
||||||
|
lblFightingBuryBones.setBounds(40, 80, 130, 20);
|
||||||
|
fightingPanel.add(lblFightingBuryBones);
|
||||||
|
fightingBuryBones.setBackground(Color_WetAsphalt);
|
||||||
|
fightingBuryBones.setForeground(Color_WhiteSmoke);
|
||||||
|
fightingBuryBones.setBounds(15, 80, 20, 20);
|
||||||
|
fightingBuryBones.setSelected(true);
|
||||||
|
fightingBuryBones.addItemListener(new ItemListener() {
|
||||||
|
public void itemStateChanged(ItemEvent e) {
|
||||||
|
Variables.fighting_bury_bones = fightingBuryBones.isSelected();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
fightingPanel.add(fightingBuryBones);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Thieving Panel
|
* Thieving Panel
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user