mirror of
https://github.com/2006Scape-Scripts/ParaScript.git
synced 2026-07-02 16:49:02 +00:00
Allow custom NPC id for thieving
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output url="file://$USER_HOME$/OneDrive/Documents/Parabot/scripts/compiled" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
|
||||
@@ -5,7 +5,8 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public enum Npcs {
|
||||
MAN_WOMAN("Man & Woman", new int[]{1, 2, 3, 4, 5, 6}, 8);
|
||||
MAN_WOMAN("Man & Woman", new int[]{1, 2, 3, 4, 5, 6}, 8),
|
||||
CUSTOM("Custom (specify IDs)", new int[]{-1}, 0);
|
||||
|
||||
private String name;
|
||||
private int[] ids;
|
||||
@@ -19,13 +20,13 @@ public enum Npcs {
|
||||
|
||||
public static String[] toStringArray() {
|
||||
List<Npcs> enumList = Arrays.asList(Npcs.values());
|
||||
List<String> locationsArray = new ArrayList<>();
|
||||
List<String> npcsArray = new ArrayList<>();
|
||||
for (Npcs npc : enumList) {
|
||||
locationsArray.add(npc.name);
|
||||
npcsArray.add(npc.name);
|
||||
}
|
||||
|
||||
String[] simpleArray = new String[ locationsArray.size() ];
|
||||
locationsArray.toArray( simpleArray );
|
||||
String[] simpleArray = new String[ npcsArray.size() ];
|
||||
npcsArray.toArray( simpleArray );
|
||||
return(simpleArray);
|
||||
}
|
||||
|
||||
@@ -33,5 +34,11 @@ public enum Npcs {
|
||||
|
||||
public int[] getIDs() { return this.ids; }
|
||||
|
||||
public void setIDs(int[] ids) {
|
||||
if (this == CUSTOM){
|
||||
this.ids = ids;
|
||||
}
|
||||
}
|
||||
|
||||
public double getXP() { return this.xp; }
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ import javax.swing.border.EmptyBorder;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.FocusListener;
|
||||
|
||||
public class UI extends JFrame {
|
||||
private final ButtonGroup woodcutOptionButtonGroup = new ButtonGroup();
|
||||
@@ -39,7 +41,8 @@ public class UI extends JFrame {
|
||||
|
||||
//Thieving
|
||||
private JComboBox npcSelect = new JComboBox();
|
||||
private JComboBox thievingMethod = new JComboBox();
|
||||
private JLabel lblNpcThievingCustomID = new JLabel("Custom NPC IDs");
|
||||
private JTextField npcThievingCustomID = new JTextField();
|
||||
|
||||
// Our colors
|
||||
private Color Color_MidnightBlue = new Color(44, 62, 80);
|
||||
@@ -273,8 +276,8 @@ public class UI extends JFrame {
|
||||
|
||||
// Select which npc should be our victim
|
||||
JLabel lblNpc = new JLabel("NPC");
|
||||
lblOre.setForeground(Color_WhiteSmoke);
|
||||
lblOre.setBounds(20, 20, 73, 20);
|
||||
lblNpc.setForeground(Color_WhiteSmoke);
|
||||
lblNpc.setBounds(20, 20, 73, 20);
|
||||
thievingPanel.add(lblNpc);
|
||||
npcSelect.setModel(new DefaultComboBoxModel(Npcs.toStringArray()));
|
||||
npcSelect.setBounds(20, 40, 150, 20);
|
||||
@@ -285,10 +288,48 @@ public class UI extends JFrame {
|
||||
Variables.thieving_npc_selected = npc;
|
||||
}
|
||||
}
|
||||
if (Variables.thieving_npc_selected == Npcs.CUSTOM) {
|
||||
lblNpcThievingCustomID.setVisible(true);
|
||||
npcThievingCustomID.setVisible(true);
|
||||
} else {
|
||||
lblNpcThievingCustomID.setVisible(false);
|
||||
npcThievingCustomID.setVisible(false);
|
||||
}
|
||||
UI.this.revalidate();
|
||||
UI.this.repaint();
|
||||
}
|
||||
});
|
||||
thievingPanel.add(npcSelect);
|
||||
|
||||
// Custom npc id to steal from
|
||||
lblNpcThievingCustomID.setForeground(Color_WhiteSmoke);
|
||||
lblNpcThievingCustomID.setBounds(200, 20, 150, 20);
|
||||
thievingPanel.add(lblNpcThievingCustomID);
|
||||
npcThievingCustomID.setBounds(200, 40, 150, 20);
|
||||
npcThievingCustomID.addFocusListener(new FocusListener() {
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
// we don't need to do anything here
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
try {
|
||||
String[] sample = npcThievingCustomID.getText().split("(,|;)\\s*");
|
||||
int[] customIDs = new int[sample.length];
|
||||
|
||||
for (int i = 0; i < sample.length; i++)
|
||||
customIDs[i] = Integer.parseInt(sample[i]);
|
||||
Variables.thieving_npc_selected.setIDs(customIDs);
|
||||
} catch (Exception err) {
|
||||
Npcs.CUSTOM.setIDs(new int[]{0});
|
||||
}
|
||||
}
|
||||
});
|
||||
thievingPanel.add(npcThievingCustomID);
|
||||
lblNpcThievingCustomID.setVisible(false);
|
||||
npcThievingCustomID.setVisible(false);
|
||||
|
||||
/*
|
||||
* Slave Panel
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user