19
19
@ ScriptManifest (authors = "AliveInMe" , name = "CMetalDragons" , category = "Combat" )
20
20
public class Main extends Script implements Starting , Painting , Ending , MessageListening07 {
21
21
22
- private ABCUtil abc ;
23
-
24
22
@ Override
25
23
public void onStart () {
26
24
//Start AntibanCompliance instance
27
25
General .useAntiBanCompliance (true );
28
- abc = new ABCUtil ();
26
+ Variables . get (). abc = new ABCUtil ();
29
27
//Drink when the script first starts inside the dragon room.
30
28
Variables .get ().shouldDrinkAntifire = true ;
31
29
//Generate our eatAt from the abc instance
32
- Variables .get ().eatAt = abc .generateEatAtHP ();
30
+ Variables .get ().eatAt = Variables . get (). abc .generateEatAtHP ();
33
31
//Set to use ranged potions if the inventory contains them
34
32
Variables .get ().shouldDrinkRangingPotion = Inventory .find (Constants .Filters .ITEM .POTION_RANGING ).length > 0 ;
35
33
}
@@ -38,9 +36,11 @@ public void onStart() {
38
36
public void run () {
39
37
while (true ) {
40
38
if (Constants .METAL_DRAGONS_ROOM .contains (Player .getPosition ())){
39
+ /* checks if it should leave the area due to certain conditions */
40
+ if (Variables .get ().shouldLeave )
41
+ leave ();
41
42
/* Check item consumables food & potions*/
42
43
consumables ();
43
-
44
44
if (!isAttacking ()){
45
45
/* checks for loot if shouldLoot */
46
46
loot ();
@@ -68,7 +68,7 @@ public void onPaint(Graphics graphics) {
68
68
@ Override
69
69
public void onEnd () {
70
70
//Close the abcl instance.
71
- abc .close ();
71
+ Variables . get (). abc .close ();
72
72
}
73
73
74
74
@ Override
@@ -97,6 +97,8 @@ public void serverMessageReceived(String s) {
97
97
Variables .get ().shouldDrinkAntifire = true ;
98
98
else if (s .contains ("You drink some of your antifire" ) || s .equals ("You drink some of your extended antifire potion." ))
99
99
Variables .get ().shouldDrinkAntifire = false ;
100
+ else if (s .contains ("There is no ammo left in your quiver." ) || s .contains ("You can’t use that ammo with your crossbow." ))
101
+ Variables .get ().shouldLeave = true ;
100
102
}
101
103
102
104
@ Override
@@ -157,29 +159,29 @@ private RSNPC[] getAvailableValidNPCS() {
157
159
* Tribot Antiban Compliance Methods
158
160
*/
159
161
private void antibanCompliance (){
160
- if (this .abc .shouldCheckTabs ())
161
- this .abc .checkTabs ();
162
+ if (Variables . get () .abc .shouldCheckTabs ())
163
+ Variables . get () .abc .checkTabs ();
162
164
163
- if (this .abc .shouldCheckXP ())
164
- this .abc .checkXP ();
165
+ if (Variables . get () .abc .shouldCheckXP ())
166
+ Variables . get () .abc .checkXP ();
165
167
166
- if (this .abc .shouldExamineEntity ())
167
- this .abc .examineEntity ();
168
+ if (Variables . get () .abc .shouldExamineEntity ())
169
+ Variables . get () .abc .examineEntity ();
168
170
169
- if (this .abc .shouldMoveMouse ())
170
- this .abc .moveMouse ();
171
+ if (Variables . get () .abc .shouldMoveMouse ())
172
+ Variables . get () .abc .moveMouse ();
171
173
172
- if (this .abc .shouldPickupMouse ())
173
- this .abc .pickupMouse ();
174
+ if (Variables . get () .abc .shouldPickupMouse ())
175
+ Variables . get () .abc .pickupMouse ();
174
176
175
- if (this .abc .shouldRightClick ())
176
- this .abc .rightClick ();
177
+ if (Variables . get () .abc .shouldRightClick ())
178
+ Variables . get () .abc .rightClick ();
177
179
178
- if (this .abc .shouldRotateCamera ())
179
- this .abc .rotateCamera ();
180
+ if (Variables . get () .abc .shouldRotateCamera ())
181
+ Variables . get () .abc .rotateCamera ();
180
182
181
- if (this .abc .shouldLeaveGame ())
182
- this .abc .leaveGame ();
183
+ if (Variables . get () .abc .shouldLeaveGame ())
184
+ Variables . get () .abc .leaveGame ();
183
185
}
184
186
185
187
/**
@@ -305,4 +307,13 @@ private void walkAwayFromDanger(){
305
307
}
306
308
}
307
309
310
+ private void leave (){
311
+ RSItem [] teleport = Inventory .find (Constants .Filters .ITEM .TELEPORT_ITEM );
312
+ if (teleport .length > 0 ){
313
+ if (teleport [0 ].click ("Break" )){
314
+ Timing .waitCondition (Constants .Conditions .HAS_LEFT , 3000 );
315
+ }
316
+ }
317
+ }
318
+
308
319
}
0 commit comments