add fishing options

This commit is contained in:
RedSparr0w
2019-10-25 18:47:55 +13:00
parent fd9760c631
commit 5ad7579ae4
5 changed files with 47 additions and 49 deletions
+3 -2
View File
@@ -3,8 +3,9 @@
<component name="ChangeListManager">
<list default="true" id="14d0b690-21f2-4a9c-b8cf-803e9cc87ab5" name="Default Changelist" comment="">
<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/data/variables/Ores.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ParaScript/data/variables/Ores.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/strategies/Fish.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ParaScript/strategies/Fish.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/ParaScript/strategies/Killer.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/ParaScript/strategies/MakeArrowShafts.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ParaScript/strategies/MakeArrowShafts.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" />
@@ -2,6 +2,7 @@ package ParaScript.data;
import ParaScript.data.variables.*;
import org.parabot.environment.api.utils.Timer;
import org.rev317.min.api.methods.Npcs;
import org.rev317.min.api.methods.Skill;
import org.rev317.min.api.wrappers.Tile;
import org.rev317.min.api.wrappers.TilePath;
@@ -38,6 +39,8 @@ public class Variables {
public static ThievingNpcs thieving_npc_selected = ThievingNpcs.MAN_WOMAN;
//public static String thieving_method = "None";
// Fishing
public static Npcs.Option fishing_type_selected = Npcs.Option.NET;
// Used for slave accounts
public static String slaveMaster = "";
@@ -9,6 +9,7 @@ import org.rev317.min.api.wrappers.SceneObject;
public class Fish implements Strategy {
private Npc fishingSpot;
private int[] items = new int[]{317, 321};
@Override
public boolean activate() {
@@ -28,9 +29,10 @@ public class Fish implements Strategy {
@Override
public void execute() {
try {
fishingSpot.interact(Npcs.Option.NET);
fishingSpot.interact(Variables.fishing_type_selected);
Time.sleep(1000);
Time.sleep(() -> Players.getMyPlayer().getAnimation() == -1, 30000);
// Wait for the Player to finish fishing (max 60 seconds)
Time.sleep(() -> Players.getMyPlayer().getAnimation() == -1, 60000);
} catch (Exception err){
System.out.println("Fishing error: ¯\\_(ツ)_/¯");
}
@@ -1,45 +0,0 @@
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.Npcs;
import org.rev317.min.api.methods.Players;
import org.rev317.min.api.methods.SceneObjects;
import org.rev317.min.api.wrappers.Npc;
import org.rev317.min.api.wrappers.SceneObject;
public class Killer implements Strategy {
private Npc victim;
@Override
public boolean activate() {
victim = victim(); // set the local Variable
if (Variables.running
&& victim != null
&& !Players.getMyPlayer().isInCombat()
&& Players.getMyPlayer().getAnimation() == -1
&& !Inventory.isFull()) {
return true;
}
return false;
}
@Override
public void execute() {
victim.interact(Npcs.Option.ATTACK);
Time.sleep(1000);
//Wait for the Player to finish pickpocketing
Time.sleep(() -> Players.getMyPlayer().getAnimation() == -1, 500);
}
private Npc victim(){
for(Npc victim : Npcs.getNearest(41)){
if(victim != null){
return victim;
}
}
return null;
}
}
+37
View File
@@ -3,6 +3,7 @@ package ParaScript.ui;
import ParaScript.data.variables.*;
import ParaScript.data.Variables;
import org.rev317.min.api.methods.Game;
import org.rev317.min.api.methods.Npcs;
import org.rev317.min.api.methods.Players;
import org.rev317.min.api.methods.Skill;
import org.rev317.min.api.wrappers.Player;
@@ -47,6 +48,9 @@ public class UI extends JFrame {
private JLabel lblThievingNpcCustomID = new JLabel("Custom NPC IDs");
private JTextField thievingNpcCustomID = new JTextField();
// Fishing
private JComboBox fishingTypeSelect = new JComboBox();
// Our colors
private Color Color_MidnightBlue = new Color(44, 62, 80);
private Color Color_WetAsphalt = new Color(52, 73, 94);
@@ -467,6 +471,39 @@ public class UI extends JFrame {
lblThievingNpcCustomID.setVisible(false);
thievingNpcCustomID.setVisible(false);
/*
* Fishing Panel
*/
JPanel fishingPanel = new JPanel();
fishingPanel.setForeground(Color_WhiteSmoke);
fishingPanel.setBackground(Color_WetAsphalt);
tabbedPane.addTab("Fishing", fishingPanel);
fishingPanel.setLayout(null);
// Select which npc should be our victim
JLabel lblFishingTypeSelect = new JLabel("Fishing Type");
lblFishingTypeSelect.setForeground(Color_WhiteSmoke);
lblFishingTypeSelect.setBounds(20, 20, 73, 20);
fishingPanel.add(lblFishingTypeSelect);
fishingTypeSelect.setModel(new DefaultComboBoxModel(new String[]{
Npcs.Option.NET.name(),
Npcs.Option.BAIT.name(),
Npcs.Option.CAGE.name(),
Npcs.Option.HARPOON.name(),
}));
fishingTypeSelect.setBounds(20, 40, 150, 20);
fishingTypeSelect.addActionListener (new ActionListener () {
public void actionPerformed(ActionEvent e) {
for (Npcs.Option option : Npcs.Option.values()) {
if (option.name().equalsIgnoreCase(fishingTypeSelect.getSelectedItem().toString())) {
Variables.fishing_type_selected = option;
}
}
}
});
fishingPanel.add(fishingTypeSelect);
/*
* Slave Panel
*