-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMonkeyBurst.java
More file actions
101 lines (86 loc) · 2.72 KB
/
Copy pathMonkeyBurst.java
File metadata and controls
101 lines (86 loc) · 2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import org.rspeer.runetek.adapter.component.Item;
import org.rspeer.runetek.adapter.scene.Npc;
import org.rspeer.runetek.api.commons.Time;
import org.rspeer.runetek.api.commons.math.Random;
import org.rspeer.runetek.api.component.tab.Inventory;
import org.rspeer.runetek.api.component.tab.Prayers;
import org.rspeer.runetek.api.local.Health;
import org.rspeer.runetek.api.scene.Npcs;
import org.rspeer.script.Script;
import org.rspeer.script.ScriptMeta;
import org.rspeer.ui.Log;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import java.io.File;
@ScriptMeta(developer = "Sri", name = "MMBurst", desc = "Magic")
public class MonkeyBurst extends Script {
long startTime;
public void sound() {
try
{
Clip clip = AudioSystem.getClip();
clip.open(AudioSystem.getAudioInputStream(new File("C:\\Notification.wav")));
clip.start();
}
catch (Exception exc)
{
exc.printStackTrace(System.out);
}
}
public int getRand(int low, int high) {
int highRand = Random.high(low, high);
int lowRand = Random.low(low, high);
int rand;
if (Random.nextInt(0, 100) < 50) {
rand = lowRand;
}
else {
rand = highRand;
}
return rand;
}
public void randomWait(int low, int high) {
int sleepTime = getRand(low, high);
Time.sleep(sleepTime);
}
@Override
public void onStart() {
startTime = System.currentTimeMillis();
super.onStart();
}
@Override
public int loop() {
// Npc nearest = Npcs.getNearest("Maniacal monkey");
// Log.fine(nearest.getTarget().getName());
if (Prayers.getPoints() < 37 + getRand(3, 12)) {
Item pPot = Inventory.getFirst(i -> i.getName().contains("Prayer potion"));
pPot.interact("Drink");
randomWait(1000, 3000);
}
if (Inventory.getCount(i -> i.getName().contains("Prayer potion")) < 2 || Health.getCurrent() < 40) {
sound();
Time.sleep(2000);
sound();
Time.sleep(2000);
sound();
Time.sleep(2000);
sound();
Item teletab = Inventory.getFirst(8007);
teletab.interact("Break");
return -1;
}
//Aggro timer for 10 minutes
if ((System.currentTimeMillis() - startTime) > 600000) {
sound();
Time.sleep(2000);
sound();
Time.sleep(2000);
sound();
Time.sleep(2000);
sound();
Log.fine("Aggro gone?");
startTime = System.currentTimeMillis();
}
return 0;
}
}