-
Notifications
You must be signed in to change notification settings - Fork 0
/
PVPtrainerTank.java
118 lines (104 loc) · 2.94 KB
/
PVPtrainerTank.java
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
package scripts;
import java.awt.Graphics;
import java.awt.Polygon;
import org.tribot.api.Clicking;
import org.tribot.api.General;
import org.tribot.api.Timing;
import org.tribot.api.types.generic.Condition;
import org.tribot.api.util.ABCUtil;
import org.tribot.api2007.Camera;
import org.tribot.api2007.ChooseOption;
import org.tribot.api2007.Combat;
import org.tribot.api2007.Objects;
import org.tribot.api2007.Walking;
import org.tribot.api2007.types.RSModel;
import org.tribot.api2007.types.RSObject;
import org.tribot.api2007.types.RSTile;
import org.tribot.api2007.util.ThreadSettings;
import org.tribot.script.Script;
import org.tribot.script.interfaces.Painting;
public class PVPtrainerTank extends Script implements Painting{
boolean scriptStatus = true;
RSTile t = new RSTile(3426, 2930, 0);
ABCUtil abc_util = null;
int currHp;
@Override
public void run() {
General.useAntiBanCompliance(true);
ThreadSettings.get().setAlwaysRightClick(true);
sleep(200);
abc_util = new ABCUtil();
currHp = General.random(80, 99);
while(scriptStatus){
if(getHp() > 99){
checkAntiBan();
}
else if (getHp() <= currHp){
if(ChooseOption.isOpen()){
ChooseOption.close();
sleep(200,300);
}
clickAlter();
}
sleep(100);
}
}
public void checkAntiBan(){
if (abc_util.TIME_TRACKER.ROTATE_CAMERA.next() != 0 && abc_util.TIME_TRACKER.ROTATE_CAMERA.next() <= System.currentTimeMillis()){
println("rotating camera");
Camera.setCameraRotation(General.random(0, 355));
abc_util.TIME_TRACKER.ROTATE_CAMERA.reset();
}
else if (abc_util.TIME_TRACKER.EXAMINE_OBJECT.next() != 0 && abc_util.TIME_TRACKER.EXAMINE_OBJECT.next() <= System.currentTimeMillis()){
println("Examining a random object");
RSObject[] random = Objects.getAll(4);
if(random.length > 0){
Clicking.click("Examine", random);
}
abc_util.TIME_TRACKER.EXAMINE_OBJECT.reset();
}
}
public void clickAlter(){
RSObject[] altar2 = Objects.getAt(t);
if(altar2.length > 0){
if(altar2[0].isOnScreen()){
Clicking.click("Pray-at", altar2[0]);
sleep(200);
currHp = General.random(80, 99);
Timing.waitCondition(new Condition() {
public boolean active() {
return getHp() >= 100;
}
}, General.random(1000, 2000));
}
else{
Walking.walkPath(Walking.generateStraightPath(t));
sleep(1000,1200);
}
}
}
public int getHp(){ return Combat.getHPRatio(); }
@Override
public void onPaint(Graphics g) {
RSObject[] altar2 = Objects.getAt(t);
if(altar2.length > 0){
drawModel(altar2[0].getModel(), g, false);
}
g.drawString(currHp + "", 5, 100);
}
public void drawModel(RSModel model, Graphics g, boolean fill) {
if (model.getAllVisiblePoints().length != 0) {
if (fill) {
// fill triangles
for (Polygon p : model.getTriangles()) {
g.fillPolygon(p);
}
} else {
// draw triangles
for (Polygon p : model.getTriangles()) {
g.drawPolygon(p);
}
}
}
}
}