More prayer stuff

This commit is contained in:
Danial
2021-11-05 21:13:46 +13:00
parent 287e3f51c8
commit c34921742f
5 changed files with 106 additions and 13 deletions
@@ -54,6 +54,10 @@ public class Variables {
public static FishingSpots fishing_spot_selected = FishingSpots.NET;
public static String fishing_method = "Drop";
// Prayer
public static Bones prayer_bone_type_selected = Bones.BONES;
public static String prayer_method = "Bury";
// Banking
public static int[] bank_items = new int[]{};
@@ -0,0 +1,38 @@
package ParaScript.data.variables;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public enum Bones {
BONES("Bones", 526),
BURNT_BONES("Burnt bones", 528),
BAT_BONES("Bat bones", 530),
BIG_BONES("Big bones", 532),
BABY_DARGON_BONES("Baby dragon bones", 534),
DRAGON_BONES("Dragon bones", 536);
private String name;
private int id;
Bones(String name, int id) {
this.name = name;
this.id = id;
}
public static String[] toStringArray() {
List<Bones> enumList = Arrays.asList(Bones.values());
List<String> locationsArray = new ArrayList<>();
for (Bones obj : enumList) {
locationsArray.add(obj.name);
}
String[] simpleArray = new String[ locationsArray.size() ];
locationsArray.toArray( simpleArray );
return(simpleArray);
}
public String getName() { return this.name; }
public int getID() { return this.id; }
}
@@ -32,7 +32,6 @@ public class BuryBones implements Strategy {
try {
getBones().interact(Items.Option.SECOND);
Time.sleep(500);
if (Game.isLoggedIn() && hasBones()) buryBones();
} catch (Exception ಠ_ಠ) {
System.out.println("Bone burying error: ¯\\_(ツ)_/¯");
}
+12 -11
View File
@@ -24,16 +24,17 @@ public class Prayer implements Strategy {
@Override
public void execute() {
Variables.setStatus("withdrawing bones");
Bank.openBank();
// TODO: allow player to select which bones they want to make use of
Bank.withdrawItem(536, -1);
Time.sleep(500);
Variables.setStatus("closing bank");
Bank.closeBank();
Time.sleep(500);
Variables.setStatus("burying bones");
BuryBones.buryBones();
Variables.setStatus("none");
if (!BuryBones.hasBones()) {
Variables.setStatus("withdrawing bones");
Bank.openBank();
Bank.withdrawItem(Variables.prayer_bone_type_selected.getID(), -1);
Time.sleep(500);
Variables.setStatus("closing bank");
Bank.closeBank();
Time.sleep(500);
} else {
Variables.setStatus("burying bones");
BuryBones.buryBones();
}
}
}
+52 -1
View File
@@ -58,6 +58,10 @@ public class UI extends JFrame {
private JComboBox fishingTypeSelect = new JComboBox();
private JComboBox fishingMethod = new JComboBox();
// Prayer
private JComboBox prayerBoneTypeSelect = new JComboBox();
private JComboBox prayerMethod = new JComboBox();
// Our colors
private Color Color_MidnightBlue = new Color(44, 62, 80);
private Color Color_WetAsphalt = new Color(52, 73, 94);
@@ -639,7 +643,7 @@ public class UI extends JFrame {
fishingTypeSelect.addActionListener (new ActionListener () {
public void actionPerformed(ActionEvent e) {
for (FishingSpots fishingSpot : FishingSpots.values()) {
if (fishingSpot.name().equalsIgnoreCase(fishingTypeSelect.getSelectedItem().toString())) {
if (fishingSpot.getName().equalsIgnoreCase(fishingTypeSelect.getSelectedItem().toString())) {
Variables.fishing_spot_selected = fishingSpot;
}
}
@@ -663,6 +667,53 @@ public class UI extends JFrame {
});
fishingPanel.add(fishingMethod);
/*
* Prayer Panel
*/
JPanel prayerPanel = new JPanel();
prayerPanel.setForeground(Color_WhiteSmoke);
prayerPanel.setBackground(Color_WetAsphalt);
tabbedPane.addTab("Prayer", prayerPanel);
prayerPanel.setLayout(null);
// Select our bone type
JLabel lblBoneTypeSelect = new JLabel("Bone Type");
lblBoneTypeSelect.setForeground(Color_WhiteSmoke);
lblBoneTypeSelect.setBounds(20, 20, 73, 20);
prayerPanel.add(lblBoneTypeSelect);
prayerBoneTypeSelect.setModel(new DefaultComboBoxModel(Bones.toStringArray()));
prayerBoneTypeSelect.setBounds(20, 40, 150, 20);
prayerBoneTypeSelect.addActionListener (new ActionListener () {
public void actionPerformed(ActionEvent e) {
System.out.println("Selected bones: " + prayerBoneTypeSelect.getSelectedItem().toString());
for (Bones bone : Bones.values()) {
if (bone.getName().equalsIgnoreCase(prayerBoneTypeSelect.getSelectedItem().toString())) {
Variables.prayer_bone_type_selected = bone;
System.out.println("Updated bone: " + bone.name());
}
System.out.println("Updating the bones: " + bone.name());
}
}
});
prayerPanel.add(prayerBoneTypeSelect);
// What should we do with out fish
JLabel lblPrayerMethod = new JLabel("Method");
lblPrayerMethod.setForeground(Color_WhiteSmoke);
lblPrayerMethod.setBounds(20, 60, 150, 20);
prayerPanel.add(lblPrayerMethod);
prayerMethod.setModel(new DefaultComboBoxModel(new String[]{
"Bury",
}));
prayerMethod.setBounds(20, 80, 150, 20);
prayerMethod.addActionListener (new ActionListener () {
public void actionPerformed(ActionEvent e) {
Variables.prayer_method = prayerMethod.getSelectedItem().toString();
}
});
prayerPanel.add(prayerMethod);
/*
* Slave Panel
*