mirror of
https://github.com/2006Scape-Scripts/ParaScript.git
synced 2026-07-03 00:38:36 +00:00
add min hp to fighting
This commit is contained in:
@@ -29,13 +29,14 @@ public class Variables {
|
||||
public static String woodcutting_method = "Fletch";
|
||||
|
||||
// Mining
|
||||
public static Ores mining_ore_selected = Ores.COPPER_TIN;
|
||||
public static Ores mining_ore_selected = Ores.ESSENCE;
|
||||
public static String mining_method = "Bank";
|
||||
|
||||
// Fighting
|
||||
public static FightingNpcs fighting_npc_selected = FightingNpcs.CHICKEN;
|
||||
public static boolean fighting_bury_bones = true;
|
||||
public static int[] fighting_item_ids = new int[]{};
|
||||
public static int fighting_minimum_hitpoints = 0;
|
||||
|
||||
// Thieving
|
||||
public static ThievingNpcs thieving_npc_selected = ThievingNpcs.MAN_WOMAN;
|
||||
|
||||
@@ -7,6 +7,7 @@ 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.wrappers.Npc;
|
||||
import org.rev317.min.api.wrappers.Player;
|
||||
|
||||
public class Fighting implements Strategy {
|
||||
private Npc victim;
|
||||
@@ -14,11 +15,13 @@ public class Fighting implements Strategy {
|
||||
@Override
|
||||
public boolean activate() {
|
||||
victim = victim(); // set the local Variable
|
||||
Player myPlayer = Players.getMyPlayer();
|
||||
if (Variables.running
|
||||
&& victim != null
|
||||
&& !Players.getMyPlayer().isInCombat()
|
||||
&& Players.getMyPlayer().getAnimation() == -1
|
||||
&& !Inventory.isFull()) {
|
||||
&& !myPlayer.isInCombat()
|
||||
&& myPlayer.getAnimation() == -1
|
||||
&& !Inventory.isFull()
|
||||
&& myPlayer.getHealth() > Variables.fighting_minimum_hitpoints) {
|
||||
Variables.setStatus("fighting");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -39,8 +39,8 @@ public class UI extends JFrame {
|
||||
private JLabel lblFightingNpcCustomID = new JLabel("Custom NPC IDs");
|
||||
private JTextField fightingNpcCustomID = new JTextField();
|
||||
private JCheckBox fightingBuryBones = new JCheckBox();
|
||||
private JLabel lblFightingItemCustomID = new JLabel("Pickup Item IDs");
|
||||
private JTextField fightingItemCustomID = new JTextField();
|
||||
private JTextField fightingMinimumHitpoints = new JTextField();
|
||||
|
||||
// Thieving
|
||||
private JComboBox thievingNpcSelect = new JComboBox();
|
||||
@@ -350,6 +350,7 @@ public class UI extends JFrame {
|
||||
fightingPanel.add(fightingBuryBones);
|
||||
|
||||
// Custom items to pickup
|
||||
JLabel lblFightingItemCustomID = new JLabel("Pickup Item IDs");
|
||||
lblFightingItemCustomID.setForeground(Color_WhiteSmoke);
|
||||
lblFightingItemCustomID.setBounds(20, 120, 150, 20);
|
||||
fightingPanel.add(lblFightingItemCustomID);
|
||||
@@ -376,6 +377,29 @@ public class UI extends JFrame {
|
||||
});
|
||||
fightingPanel.add(fightingItemCustomID);
|
||||
|
||||
// Minimum hitpoints to start fighting
|
||||
JLabel lblFightingMinimumHitpoints = new JLabel("Minimum hitpoints");
|
||||
lblFightingMinimumHitpoints.setForeground(Color_WhiteSmoke);
|
||||
lblFightingMinimumHitpoints.setBounds(200, 120, 150, 20);
|
||||
fightingPanel.add(lblFightingMinimumHitpoints);
|
||||
fightingMinimumHitpoints.setBounds(200, 140, 150, 20);
|
||||
fightingMinimumHitpoints.addFocusListener(new FocusListener() {
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
// we don't need to do anything here
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
try {
|
||||
Variables.fighting_minimum_hitpoints = Integer.parseInt(fightingMinimumHitpoints.getText());
|
||||
} catch (Exception ಠ_ಠ) {
|
||||
Variables.fighting_minimum_hitpoints = 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
fightingPanel.add(fightingMinimumHitpoints);
|
||||
|
||||
/*
|
||||
* Thieving Panel
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user