mirror of
https://github.com/2006Scape-Scripts/ParaScript.git
synced 2026-07-02 16:49:02 +00:00
Allow pickup custom items
This commit is contained in:
Generated
+3
@@ -3,7 +3,10 @@
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="3ab8e8a0-ccfd-4b0b-9547-98173085dc38" 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/Methods.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ParaScript/Methods.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/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" />
|
||||
</list>
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
|
||||
@@ -14,4 +14,21 @@ public class Methods {
|
||||
}
|
||||
return "" + number;
|
||||
}
|
||||
|
||||
public static int[] combineIntArrays(int[] array1, int[] array2){
|
||||
int[] array1and2 = new int[array1.length + array2.length];
|
||||
int currentPosition = 0;
|
||||
|
||||
for( int i = 0; i < array1.length; i++) {
|
||||
array1and2[currentPosition] = array1[i];
|
||||
currentPosition++;
|
||||
}
|
||||
|
||||
for( int j = 0; j < array2.length; j++) {
|
||||
array1and2[currentPosition] = array2[j];
|
||||
currentPosition++;
|
||||
}
|
||||
|
||||
return array1and2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ public class Variables {
|
||||
// Fighting
|
||||
public static FightingNpcs fighting_npc_selected = FightingNpcs.MAN_WOMAN;
|
||||
public static boolean fighting_bury_bones = true;
|
||||
public static int[] fighting_item_ids = new int[]{};
|
||||
|
||||
// Thieving
|
||||
public static ThievingNpcs thieving_npc_selected = ThievingNpcs.MAN_WOMAN;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package ParaScript.strategies;
|
||||
|
||||
import ParaScript.Methods;
|
||||
import ParaScript.data.Variables;
|
||||
import ParaScript.data.variables.Ores;
|
||||
import org.parabot.environment.api.utils.Time;
|
||||
@@ -33,6 +34,7 @@ public class PickupItems implements Strategy {
|
||||
try {
|
||||
for (GroundItem item : items) {
|
||||
item.take();
|
||||
Time.sleep(500);
|
||||
Time.sleep(() -> item.distanceTo() < 1, 2000);
|
||||
if (Inventory.isFull()){
|
||||
break;
|
||||
@@ -50,6 +52,7 @@ public class PickupItems implements Strategy {
|
||||
if (Variables.fighting_bury_bones)
|
||||
itemIDs = new int[]{526};
|
||||
}
|
||||
itemIDs = Methods.combineIntArrays(Variables.fighting_item_ids, itemIDs);
|
||||
return GroundItems.getNearest(itemIDs);
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,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();
|
||||
|
||||
// Thieving
|
||||
private JComboBox thievingNpcSelect = new JComboBox();
|
||||
@@ -349,6 +351,33 @@ public class UI extends JFrame {
|
||||
});
|
||||
fightingPanel.add(fightingBuryBones);
|
||||
|
||||
// Custom items to pickup
|
||||
lblFightingItemCustomID.setForeground(Color_WhiteSmoke);
|
||||
lblFightingItemCustomID.setBounds(20, 120, 150, 20);
|
||||
fightingPanel.add(lblFightingItemCustomID);
|
||||
fightingItemCustomID.setBounds(20, 140, 150, 20);
|
||||
fightingItemCustomID.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 = fightingItemCustomID.getText().split("(,|;)\\s*");
|
||||
int[] customIDs = new int[sample.length];
|
||||
|
||||
for (int i = 0; i < sample.length; i++)
|
||||
customIDs[i] = Integer.parseInt(sample[i]);
|
||||
Variables.fighting_item_ids = customIDs;
|
||||
} catch (Exception err) {
|
||||
Variables.fighting_item_ids = new int[]{};
|
||||
}
|
||||
}
|
||||
});
|
||||
fightingPanel.add(fightingItemCustomID);
|
||||
|
||||
/*
|
||||
* Thieving Panel
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user