-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathNezzTutorialIslandFIXED.java
More file actions
1461 lines (1425 loc) · 39.8 KB
/
NezzTutorialIslandFIXED.java
File metadata and controls
1461 lines (1425 loc) · 39.8 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package examples;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.io.IOException;
import java.util.List;
import org.dreambot.api.data.GameState;
import org.dreambot.api.input.event.impl.InteractionEvent;
import org.dreambot.api.input.mouse.destination.impl.shape.RectangleDestination;
import org.dreambot.api.methods.Calculations;
import org.dreambot.api.methods.MethodProvider;
import org.dreambot.api.methods.magic.Normal;
import org.dreambot.api.methods.map.Tile;
import org.dreambot.api.methods.tabs.Tab;
import org.dreambot.api.methods.widget.Widget;
import org.dreambot.api.script.AbstractScript;
import org.dreambot.api.script.Category;
import org.dreambot.api.script.ScriptManifest;
import org.dreambot.api.utilities.Timer;
import org.dreambot.api.utilities.impl.Condition;
import org.dreambot.api.methods.container.impl.equipment.EquipmentSlot;
import org.dreambot.api.methods.filter.*;
import org.dreambot.api.wrappers.interactive.GameObject;
import org.dreambot.api.wrappers.interactive.NPC;
import org.dreambot.api.wrappers.items.Item;
import org.dreambot.api.wrappers.widgets.WidgetChild;
@ScriptManifest(author = "Nezz", category = Category.MISC, description = "Does tutorial island", name = "DreamBot Tutorial Island", version = 1)
public class NezzTutorialIslandFIXED extends AbstractScript{
private final int TAB_CONFIG = 1021;
private final int PERC_COMP = 406;
private final int ATT_SPEED = 843;
private final int POLL_OPEN = 375;
private final int TUT_PROG = 281;
private final int APPEAR_PAR = 269;
private final int[][] appChildren = {{106,113},{107,114},{108,115},{109,116},{110,117},{111,118},{112,119},{105,121},{123,127},{122,129},{124,130},{125,131}};
private final int ACCEPT = 100;
private final String RUNESCAPE_GUIDE = "RuneScape Guide";
private final String SURVIVAL_EXPERT = "Survival Expert";
private final String COOK_GUIDE = "Master Chef";
private final String QUEST_GUIDE = "Quest Guide";
private final String MINING_GUIDE = "Mining Instructor";
private final String COMBAT_GUIDE = "Combat Instructor";
private final String FINANCIAL_GUIDE = "Financial Advisor";
private final String PRAY_GUIDE = "Brother Brace";
private final String MAGIC_GUIDE = "Magic Instructor";
Tile[] cookToQuest = new Tile[]{new Tile(3072,3090,0),new Tile(3072,3092,0),new Tile(3072,3094,0),new Tile(3071,3095,0),new Tile(3071,3097,0),new Tile(3071,3099,0),new Tile(3071,3101,0),new Tile(3071,3103,0),new Tile(3072,3104,0),new Tile(3073,3105,0),new Tile(3074,3106,0),new Tile(3076,3106,0),new Tile(3077,3107,0),new Tile(3077,3109,0),new Tile(3077,3111,0),new Tile(3077,3113,0),new Tile(3077,3115,0),new Tile(3077,3117,0),new Tile(3076,3119,0),new Tile(3076,3121,0),new Tile(3076,3123,0),new Tile(3077,3125,0),new Tile(3079,3125,0),new Tile(3080,3126,0),new Tile(3082,3126,0),new Tile(3084,3126,0),new Tile(3086,3126,0)};
Tile[] combatToLadder = new Tile[]{new Tile(3106,9509,0),new Tile(3107,9510,0),new Tile(3108,9511,0),new Tile(3109,9512,0),new Tile(3110,9513,0),new Tile(3111,9515,0),new Tile(3112,9516,0),new Tile(3112,9518,0),new Tile(3112,9520,0),new Tile(3112,9522,0),new Tile(3112,9524,0),new Tile(3111,9525,0)};
Tile[] finToPray = new Tile[]{new Tile(3130,3124,0),new Tile(3132,3124,0),new Tile(3133,3123,0),new Tile(3133,3121,0),new Tile(3134,3119,0),new Tile(3134,3117,0),new Tile(3133,3115,0),new Tile(3132,3114,0),new Tile(3131,3113,0),new Tile(3131,3111,0),new Tile(3130,3110,0),new Tile(3130,3108,0)};
Tile[] prayToMage = new Tile[]{new Tile(3122,3102,0),new Tile(3123,3101,0),new Tile(3124,3100,0),new Tile(3125,3099,0),new Tile(3126,3098,0),new Tile(3127,3097,0),new Tile(3128,3096,0),new Tile(3129,3095,0),new Tile(3130,3094,0),new Tile(3132,3094,0),new Tile(3133,3093,0),new Tile(3134,3092,0),new Tile(3135,3091,0),new Tile(3136,3090,0),new Tile(3137,3089,0),new Tile(3138,3088,0),new Tile(3140,3087,0),new Tile(3141,3088,0)};
private boolean hover = false;
private boolean forceEmail = false;
boolean started = false;
boolean accMade = false;
private State state;
private Timer t;
private enum State{
CREATE_ACC, OPEN_TAB, DO_TUT
}
private State getState(){
if(!started){
return State.CREATE_ACC;
}
if(getPlayerSettings().getConfig(TAB_CONFIG) > 0){
return State.OPEN_TAB;
}
return State.DO_TUT;
}
public void onStart(String...args){
t = new Timer();
}
public void onStart(){
if(!getClient().isLoggedIn()){
}
else{
accMade = true;
started = true;
}
t = new Timer();
}
private WidgetChild getClickHereToContinue(){
if(!getDialogues().inDialogue()){
log("Not in dialogue");
return null;
}
List<WidgetChild> children = getWidgets().getWidgetChildrenContainingText("Click here to continue");
if(children.isEmpty()){
children = getWidgets().getWidgetChildrenContainingText("Click to continue");
}
if(children.isEmpty()){
return null;
}
for(WidgetChild wc : children){
if(wc.isVisible()){
if(wc.getParentID() != 137){
if(wc.isGrandChild()){
if(wc.getID() != 107 && wc.isVisible())
return wc;
}else if(wc.isVisible()){
return wc;
}
}
}
}
children = getWidgets().getWidgetChildrenContainingText("Click to continue");
for(WidgetChild wc : children){
if(wc.isVisible()){
if(wc.getParentID() != 137){
if(wc.isGrandChild()){
if(wc.getID() != 107 && wc.isVisible())
return wc;
}else if(wc.isVisible()){
return wc;
}
}
}
}
return null;
}
private boolean isRoofEnabled(){
return false;
}
private int toggleRoof(){
if(!isRoofEnabled())
return -1;
return -1;
}
private int makeAccount(){
return 0;
}
@Override
public int onLoop() {
state = getState();
if(state != State.CREATE_ACC){
List<WidgetChild> clickToContinue = getWidgets().getWidgetChildrenContainingText("Click to continue");
if(!clickToContinue.isEmpty()){
WidgetChild wc = clickToContinue.get(0);
if(wc != null && wc.isVisible()){
wc.interact();
sleep(900,1200);
}
}
}
switch(state){
case CREATE_ACC:
if(!getClient().isLoggedIn()){
int res = makeAccount();
if(res == -1){
return res;
}
}
else{
accMade = true;
t = new Timer();
log("appearance");
final Widget par = getWidgets().getWidget(APPEAR_PAR);
if(par != null && par.isVisible()){
for(int i =0; i < appChildren.length; i++){
if(getClient().seededRandom() >= 1){
if(getClient().seededRandom() > 1){
for(int ii = 0; ii < 5; ii++){
par.getChild(appChildren[i][0]).interact();
sleep(100,150);
}
}
else{
for(int ii = 0; ii < 5; ii++){
par.getChild(appChildren[i][1]).interact();
sleep(100,150);
}
}
sleep(200,300);
}
}
par.getChild(ACCEPT).interact();
sleepUntil(new Condition(){
public boolean verify(){
WidgetChild wc = par.getChild(ACCEPT);
return wc == null || !wc.isVisible();
}
},1200);
started = true;
}
}
break;
case DO_TUT:
int conf = getPlayerSettings().getConfig(TUT_PROG);
switch(conf){
case 7:
case 0:
talkTo(RUNESCAPE_GUIDE);
break;
case 3:
//open settings
break;
case 10:
if(!getWalking().isRunEnabled()){
getWalking().toggleRun();
}
GameObject door = getGameObjects().closest("Door");
if(door != null){
if(door.interact("Open")){
walkingSleep();
sleepUntil(new Condition(){
public boolean verify(){
return getPlayerSettings().getConfig(TUT_PROG) != 10;
}
},Calculations.random(1600,2000));
}
}
//open door
break;
case 70:
case 20:
talkTo(SURVIVAL_EXPERT);
//talked to survival expert
break;
case 30:
getDialogues().clickContinue();
//opened invnetory
break;
case 40:
GameObject tree = getGameObjects().closest("Tree");
if(tree != null){
if(getLocalPlayer().getAnimation() != -1){
sleepUntil(new Condition(){
public boolean verify(){
return getInventory().contains("Logs");
}
},Calculations.random(1000,2000));
break;
}
if(tree.interact("Chop down")){
walkingSleep();
sleepUntil(new Condition(){
public boolean verify(){
return getInventory().contains("Logs");
}
},Calculations.random(1000,2000));
}
}
//chopped logs
break;
case 50:
if(!getInventory().contains("Logs")){
sleepUntil(new Condition(){
public boolean verify(){
return getPlayerSettings().getConfig(TUT_PROG) != 50;
}
},5000);
break;
}
lightFire();
//lit logs
break;
case 60:
//opened skills
break;
case 80:
if(getLocalPlayer().getAnimation() != -1){
sleepUntil(new Condition(){
public boolean verify(){
return getPlayerSettings().getConfig(TUT_PROG) != 80;
}
},5000);
break;
}
NPC pool = getNpcs().closest("Fishing spot");
if(pool != null){
if(pool.interact("Net")){
walkingSleep();
sleepUntil(new Condition(){
public boolean verify(){
return getPlayerSettings().getConfig(TUT_PROG) != 80;
}
},Calculations.random(4000,5000));
}
}
//caught shrimp
break;
case 90:
cookShrimp();
break;
case 100:
if(getDialogues().canContinue()){
getDialogues().clickContinue();
break;
}
cookShrimp();
//burned shrimp
break;
case 110:
if(!getInventory().contains("Raw shrimps")){
if(getLocalPlayer().getAnimation() != -1){
sleepUntil(new Condition(){
public boolean verify(){
return getInventory().contains("Raw shrimps");
}
},5000);
}
else{
pool = getNpcs().closest("Fishing spot");
if(pool != null){
pool.interact("Net");
sleepUntil(new Condition(){
public boolean verify(){
return getInventory().contains("Raw shrimps");
}
},5000);
}
}
}
else{
cookShrimp();
}
//cooked second shrimp
break;
case 120:
if(getLocalPlayer().getTile().distance(new Tile(3091,3092,0)) > 5){
getWalking().walk(new Tile(3090,3092,0));
walkingSleep();
}
else{
GameObject gate = getGameObjects().closest("Gate");
if(gate != null){
if(gate.interact("Open")){
walkingSleep();
sleepUntil(new Condition(){
public boolean verify(){
return getPlayerSettings().getConfig(TUT_PROG) != 120;
}
},Calculations.random(1400,1800));
}
}
}
//went through gate
break;
case 130:
if(getLocalPlayer().getTile().distance(new Tile(3080,3084,0)) > 5){
getWalking().walk(new Tile(3080,3084,0));
walkingSleep();
}
else{
GameObject gate = getGameObjects().closest("Door");
if(gate != null){
if(gate.interact("Open")){
walkingSleep();
sleepUntil(new Condition(){
public boolean verify(){
return getPlayerSettings().getConfig(TUT_PROG) != 130;
}
},1200);
}
}
}
//went through cook door
break;
case 140:
talkTo(COOK_GUIDE);
//talked to cook
break;
case 150:
if(!getInventory().isItemSelected()){
if(getInventory().interact("Bucket of water", "Use")){
sleepUntil(new Condition(){
public boolean verify(){
return getInventory().isItemSelected();
}
}, Calculations.random(1200,1400));
}
}
else{
if(getInventory().interact("Pot of flour", "Use")){
sleepUntil(new Condition(){
public boolean verify(){
return getInventory().contains("Bread dough");
}
},Calculations.random(1200,1400));
}
}
//made dough
break;
case 160:
if(!getInventory().isItemSelected()){
if(getInventory().interact("Bread dough", "Use")){
sleepUntil(new Condition(){
public boolean verify(){
return getInventory().isItemSelected();
}
},Calculations.random(1200,1400));
}
}
else{
GameObject range = getGameObjects().closest("Range");
if(range.interact("Use")){
walkingSleep();
sleepUntil(new Condition(){
public boolean verify(){
return getInventory().contains("Bread");
}
},Calculations.random(2000,3000));
}
}
//cooked bread
break;
case 170:
//opened music
break;
case 180:
if(getLocalPlayer().getTile().distance(new Tile(3073,3090,0)) > 5){
getWalking().walk(new Tile(3073,3090,0));
walkingSleep();
}
else{
GameObject gate = getGameObjects().closest("Door");
if(gate != null){
if(gate.interact("Open")){
walkingSleep();
sleepUntil(new Condition(){
public boolean verify(){
return getPlayerSettings().getConfig(TUT_PROG) != 180;
}
},Calculations.random(1200,1600));
}
}
}
//opened cook door
break;
case 183:
//opened emotes
break;
case 187:
Rectangle r = new Rectangle(560,213,20,40);
getMouse().move(r);
getMouse().click();
sleepUntil(new Condition(){
public boolean verify(){
return getPlayerSettings().getConfig(TUT_PROG) != 187;
}
},5000);
//use emote
break;
case 190:
//opened settings
break;
case 200:
//261,65
WidgetChild wc = getWidgets().getChildWidget(261,63);
if(wc != null && wc.isVisible()){
wc.interact();
sleepUntil(new Condition(){
public boolean verify(){
return getWalking().isRunEnabled();
}
},1200);
}
//turned on run in settings
break;
case 210:
if(getLocalPlayer().getTile().distance(new Tile(3086,3126,0)) > 5){
getWalking().walk(cookToQuest[cookToQuest.length - 1]);//, Calculations.random(10,15));
sleepUntil(new Condition(){
public boolean verify(){
return getLocalPlayer().isMoving();
}
},1200);
sleepUntil(new Condition(){
public boolean verify(){
Tile dest = getClient().getDestination();
return !getLocalPlayer().isMoving() || dest == null || getLocalPlayer().distance(dest) < 5;
}
},Calculations.random(2600,3000));
}
else{
GameObject gate = getGameObjects().closest("Door");
if(gate != null){
if(gate.interact("Open")){
walkingSleep();
sleepUntil(new Condition(){
public boolean verify(){
return getPlayerSettings().getConfig(TUT_PROG) != 210;
}
},Calculations.random(1200,1400));
}
}
}
//opened door
break;
case 240:
case 220:
talkTo(QUEST_GUIDE);
//talked to quest guy
break;
case 230:
//open quest tab
break;
case 250:
GameObject gate = getGameObjects().closest("Ladder");
if(gate != null){
if(gate.interact("Climb-down")){
walkingSleep();
sleepUntil(new Condition(){
public boolean verify(){
return getPlayerSettings().getConfig(TUT_PROG) != 250;
}
},Calculations.random(4000,6000));
}
}
//climb down ladder
break;
case 330:
case 290:
case 260:
talkTo(MINING_GUIDE);
//talk to mining instructor
break;
case 270:
GameObject tin = getGameObjects().closest(new Filter<GameObject>(){
public boolean match(GameObject g){
if(g == null || g.getName() == null)
return false;
if(!g.getName().equals("Rocks"))
return false;
if(g.getTile().equals(new Tile(3077,9504,0)))
return true;
return false;
}
});
if(tin != null){
if(tin.interact("Prospect")){
walkingSleep();
sleepUntil(new Condition(){
public boolean verify(){
return getPlayerSettings().getConfig(TUT_PROG)!=270;
}
},Calculations.random(3000,4000));
}
}
//inspect tin
break;
case 280:
tin = getGameObjects().closest(new Filter<GameObject>(){
public boolean match(GameObject g){
if(g == null || g.getName() == null)
return false;
if(!g.getName().equals("Rocks"))
return false;
if(g.getTile().equals(new Tile(3083,9501,0)))
return true;
return false;
}
});
if(tin != null){
if(tin.interact("Prospect")){
sleepUntil(new Condition(){
public boolean verify(){
return getPlayerSettings().getConfig(TUT_PROG)!=280;
}
},Calculations.random(4000,5000));
}
}
//inspect copper
break;
case 300:
tin = getGameObjects().closest(new Filter<GameObject>(){
public boolean match(GameObject g){
if(g == null || g.getName() == null)
return false;
if(!g.getName().equals("Rocks"))
return false;
if(g.getTile().equals(new Tile(3077,9504,0)))
return true;
return false;
}
});
if(tin != null){
if(tin.interact("Mine")){
walkingSleep();
sleepUntil(new Condition(){
public boolean verify(){
return getPlayerSettings().getConfig(TUT_PROG)!=300;
}
},Calculations.random(2000,3000));
}
}
//mine tin
break;
case 310:
tin = getGameObjects().closest(new Filter<GameObject>(){
public boolean match(GameObject g){
if(g == null || g.getName() == null)
return false;
if(!g.getName().equals("Rocks"))
return false;
if(g.getTile().equals(new Tile(3083,9501,0)))
return true;
return false;
}
});
if(tin != null){
if(tin.interact("Mine")){
walkingSleep();
sleepUntil(new Condition(){
public boolean verify(){
return getPlayerSettings().getConfig(TUT_PROG)!=310;
}
},Calculations.random(2000,3000));
}
}
//mine copper
break;
case 320:
if(getDialogues().canContinue()){
getDialogues().clickContinue();
sleep(900,1200);
}
else{
if(!getInventory().isItemSelected()){
sleep(1200,1800);
getInventory().interact("Tin ore", "Use");
sleepUntil(new Condition(){
public boolean verify(){
return getInventory().isItemSelected();
}
},Calculations.random(800,1200));
}
else{
GameObject furnace = getGameObjects().closest(10082);
if(furnace != null){
if(furnace.interact("Use")){
walkingSleep();
sleepUntil(new Condition(){
public boolean verify(){
return getInventory().contains("Bronze bar");
}
},Calculations.random(2000,3000));
}
}
}
}
//smelt bronze
break;
case 340:
if(!getInventory().isItemSelected()){
getInventory().interact("Bronze bar", "Use");
sleepUntil(new Condition(){
public boolean verify(){
return getInventory().isItemSelected();
}
},1200);
}
else{
GameObject furnace = getGameObjects().closest("Anvil");
if(furnace != null){
if(furnace.interact("Use")){
walkingSleep();
sleepUntil(new Condition(){
public boolean verify(){
return getPlayerSettings().getConfig(TUT_PROG) != 340;
}
},Calculations.random(2000,3000));
}
}
}
//open anvil panel
break;
case 350:
getWidgets().getChildWidget(312,2).interact();
sleepUntil(new Condition(){
public boolean verify(){
return getPlayerSettings().getConfig(TUT_PROG) != 350;
}
},3000);
//smith knife
break;
case 360:
if(getLocalPlayer().getTile().distance(new Tile(3094,9502,0)) > 5){
getWalking().walk(new Tile(3094,9502,0));
walkingSleep();
}
else{
gate = getGameObjects().closest("Gate");
if(gate != null){
if(gate.interact("Open")){
walkingSleep();
sleepUntil(new Condition(){
public boolean verify(){
return getPlayerSettings().getConfig(TUT_PROG) !=360;
}
},Calculations.random(1200,1800));
}
}
}
//open gate
break;
case 410:
case 370:
talkTo(COMBAT_GUIDE);
//tlak to combat instructor
break;
case 390:
//open equipment
break;
case 400:
getWidgets().getChildWidget(387,17).interact();
sleepUntil(new Condition(){
public boolean verify(){
return getPlayerSettings().getConfig(TUT_PROG) != 400;
}
},Calculations.random(1200,1600));
//open equipment stats
break;
case 405:
if(getInventory().interact("Bronze dagger", "Equip")){
sleepUntil(new Condition(){
public boolean verify(){
return getPlayerSettings().getConfig(TUT_PROG) != 410;
}
},Calculations.random(1200,1600));
}
else if(getInventory().interact("Bronze dagger", "Wield")){
sleepUntil(new Condition(){
public boolean verify(){
return getPlayerSettings().getConfig(TUT_PROG) != 410;
}
},Calculations.random(1200,1600));
}
getWidgets().getChildWidget(84,4).interact();
//equip dagger
break;
case 420:
Item i = getEquipment().getItemInSlot(EquipmentSlot.WEAPON.getSlot());
if(i != null && i.getName().contains("dagger")){
getEquipment().unequip(EquipmentSlot.WEAPON);
}
else{
if(i != null){
getInventory().interact("Wooden shield", "Wield");
sleepUntil(new Condition(){
public boolean verify(){
return getEquipment().getItemInSlot(EquipmentSlot.SHIELD.getSlot()) != null;
}
},Calculations.random(1200,1600));
}
else{
getInventory().interact("Bronze sword", "Wield");
sleepUntil(new Condition(){
public boolean verify(){
return getEquipment().getItemInSlot(EquipmentSlot.WEAPON.getSlot()) != null;
}
},Calculations.random(1200,1600));
}
}
//unequip knife
//equip sword/shield
break;
case 430:
//open combat tab
break;
case 440:
if(getLocalPlayer().getTile().distance(new Tile(3111,9518,0)) > 5){
getWalking().walk(new Tile(3111,9518,0));
walkingSleep();
}
else{
gate = getGameObjects().closest("Gate");
if(gate != null){
if(gate.interact("Open")){
walkingSleep();
sleepUntil(new Condition(){
public boolean verify(){
return getPlayerSettings().getConfig(TUT_PROG) !=360;
}
},Calculations.random(1200,1600));
}
}
}
//open rat gate
break;
case 450:
NPC rat = getNpcs().closest(new Filter<NPC>(){
public boolean match(NPC n){
if(n == null || n.getName() == null)
return false;
return n.getName().equals("Giant rat") && !n.isInCombat();
}
});
if(rat != null){
if(rat.interact("Attack")){
walkingSleep();
sleepUntil(new Condition(){
public boolean verify(){
return getPlayerSettings().getConfig(TUT_PROG) != 450;
}
},Calculations.random(1200,2000));
}
else{
if(getCamera().getPitch() < Calculations.random(150,200)){
getCamera().rotateToPitch(Calculations.random(200,360));
}
}
}
//attack rat
break;
case 460:
sleepUntil(new Condition(){
public boolean verify(){
return getPlayerSettings().getConfig(TUT_PROG) != 460;
}
},2400);
//killed rat
break;
case 470:
if(!getMap().canReach(new Tile(3112,9518,0))){
gate = getGameObjects().closest("Gate");
if(gate != null){
if(gate.interact("Open")){
walkingSleep();
sleepUntil(new Condition(){
public boolean verify(){
return getLocalPlayer().getTile().getX() == 3111;
}
},Calculations.random(1200,1400));
}
}
}
else
talkTo(COMBAT_GUIDE);
//talk to combat instructor
break;
case 480:
if(getEquipment().isSlotEmpty(EquipmentSlot.ARROWS.getSlot())){
getInventory().interact("Bronze arrow", "Wield");
sleepUntil(new Condition(){
public boolean verify(){
return getEquipment().isSlotFull(EquipmentSlot.ARROWS.getSlot());
}
},Calculations.random(1200,1600));
}
else if(getInventory().contains("Shortbow")){
getInventory().interact("Shortbow", "Wield");
sleepUntil(new Condition(){
public boolean verify(){
return !getInventory().contains("Shortbow");
}
},Calculations.random(1200,1600));
}
else{
rat = getNpcs().closest(new Filter<NPC>(){
public boolean match(NPC n){
if(n == null || n.getName() == null)
return false;
return n.getName().equals("Giant rat") && !n.isInCombat();
}
});
if(rat != null){
if(rat.interact("Attack")){
sleepUntil(new Condition(){
public boolean verify(){
return getPlayerSettings().getConfig(TUT_PROG) != 480;
}
},Calculations.random(2400, 3600));
}
}
}
//equip bow & arrow
//attack rat
break;
case 490:
if(getEquipment().isSlotEmpty(EquipmentSlot.ARROWS.getSlot())){
getInventory().interact("Bronze arrow", "Wield");
sleepUntil(new Condition(){
public boolean verify(){
return getEquipment().isSlotFull(EquipmentSlot.ARROWS.getSlot());
}
},1200);
}
else if(getInventory().contains("Shortbow")){
getInventory().interact("Shortbow", "Wield");
sleepUntil(new Condition(){
public boolean verify(){
return !getInventory().contains("Shortbow");
}
},1200);
}
else{
if(getLocalPlayer().getInteractingCharacter() == null){
rat = getNpcs().closest(new Filter<NPC>(){
public boolean match(NPC n){
if(n == null || n.getName() == null)
return false;
return n.getName().equals("Giant rat") && !n.isInCombat();
}
});
if(rat != null){
if(rat.interact("Attack")){
sleepUntil(new Condition(){
public boolean verify(){
return getPlayerSettings().getConfig(TUT_PROG) != 480;
}
},Calculations.random(2400, 3600));
}
}
}
else{
sleepUntil(new Condition(){
public boolean verify(){
return getPlayerSettings().getConfig(TUT_PROG) != 490;
}
},Calculations.random(2400,3000));
}
}
//killed rat
break;
case 500:
if(getLocalPlayer().getTile().distance(new Tile(3112,9525,0)) > 5){
getWalking().walk(combatToLadder[combatToLadder.length-1]);//, Calculations.random(10,15));
walkingSleep();
}
else{
gate = getGameObjects().closest("Ladder");
if(gate != null){
if(gate.interact("Climb-up")){
walkingSleep();
sleepUntil(new Condition(){
public boolean verify(){
return getPlayerSettings().getConfig(TUT_PROG) != 500;
}
},Calculations.random(2400,3600));
}
}
}
//go up ladder
break;
case 510:
Tile t = new Tile(3122,3123,0);
if(getLocalPlayer().distance(t) > 5){
getWalking().walk(t);
walkingSleep();
}
else{
if(getDialogues().getOptionIndex("Yes.") > 0){
getDialogues().clickOption("Yes.");
sleepUntil(new Condition(){
public boolean verify(){
return getBank().isOpen();
}
},Calculations.random(1200,1600));
getBank().depositAllItems();
sleepUntil(new Condition(){
public boolean verify(){
return getInventory().isEmpty();
}
},Calculations.random(800,1200));
getBank().depositAllEquipment();
sleepUntil(new Condition(){
public boolean verify(){
return getEquipment().isEmpty();
}
},Calculations.random(800,1200));
getBank().close();
sleepUntil(new Condition(){
public boolean verify(){
return !getBank().isOpen();
}
}, Calculations.random(800,1200));
}
else{
if(!getDialogues().canContinue()){
GameObject bankBooth = getGameObjects().closest("Bank booth");
if(bankBooth != null){
if(bankBooth.interact("Use")){
sleepUntil(new Condition(){
public boolean verify(){
return getDialogues().canContinue();
}
},Calculations.random(2400,3000));