This repository was archived by the owner on Dec 30, 2025. It is now read-only.
forked from crazyeyes-pb/Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWhiteBearAIOFiremaker.java
More file actions
4298 lines (4011 loc) · 140 KB
/
WhiteBearAIOFiremaker.java
File metadata and controls
4298 lines (4011 loc) · 140 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
/**
* @author White Bear
* @copyright (C)2010-2011 White Bear
* No one except White Bear has the right to modify this script!
*/
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.geom.Rectangle2D;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Properties;
import java.util.Set;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFormattedTextField;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
import org.rsbot.Configuration;
import org.rsbot.event.events.MessageEvent;
import org.rsbot.event.listeners.MessageListener;
import org.rsbot.event.listeners.PaintListener;
import org.rsbot.script.Script;
import org.rsbot.script.ScriptManifest;
import org.rsbot.script.methods.Bank;
import org.rsbot.script.methods.Game;
import org.rsbot.script.methods.GrandExchange.GEItem;
import org.rsbot.script.methods.Players;
import org.rsbot.script.methods.Skills;
import org.rsbot.script.methods.Walking;
import org.rsbot.script.wrappers.RSComponent;
import org.rsbot.script.wrappers.RSPlayer;
import org.rsbot.script.wrappers.RSTile;
@ScriptManifest(authors = { "WhiteBear" }, keywords = "Burner Firemaker Logs Global Universal", name = "White Bear AIO Firemaker", version = 1.13, description = "Fast and Flawless All-in-One Firemaker", website = "http://whitebearrs.orgfree.com")
public class WhiteBearAIOFiremaker extends Script implements PaintListener,
MessageListener, MouseListener, MouseMotionListener {
// ---------------ANTIBAN--------------\\
private class Antiban {
int moveMouseB = 75;
int allRand = 21, cam = 27, skill = 45, player = 18, friend = 61;
boolean checkFriend = false, checkExperience = true,
screenLookaway = false;
// Antiban timeouts and next times
long timeOutB1 = 50000, timeOutB2 = 100000;
long timeFriend = System.currentTimeMillis(),
timeExp = System.currentTimeMillis();
long timeLook = System.currentTimeMillis();
long timeOutFriend = 20000, timeOutExp = 20000;
private boolean breakingCheck() {
if (nextBreak <= System.currentTimeMillis()) {
return true;
}
return false;
}
private void breakingNew() {
if (randomBreaking) {
final long varTime = random(7200000, 18000000);
nextBreak = System.currentTimeMillis() + varTime;
final long varLength = random(120000, 600000);
nextLength = varLength;
} else {
final int diff = randTime * 1000 * 60;
final long varTime = random(midTime * 1000 * 60 - diff, midTime
* 1000 * 60 + diff);
nextBreak = System.currentTimeMillis() + varTime;
final int diff2 = randLength * 1000 * 60;
final long varLength = random(midLength * 1000 * 60 - diff2, midLength
* 1000 * 60 + diff2);
nextLength = varLength;
}
}
private RSPlayer getNearbyMod() {
final RSPlayer[] modCheck = players.getAll();
int Dist = 18;
RSPlayer closest = null;
int element = 0;
final int size = modCheck.length;
while (element < size) {
if (modCheck[element] != null) {
try {
if (modCheck[element].getName().startsWith("Mod")) {
final int distance = calc.distanceTo(modCheck[element]);
if (distance < Dist) {
Dist = distance;
closest = modCheck[element];
}
}
} catch (final Exception ignored) {
}
}
element += 1;
}
return closest;
}
private boolean load() {
try {
WBini.load(new FileInputStream(new File(Configuration.Paths.getScriptCacheDirectory(), "WhiteBearAIOFiremaker.ini")));
} catch (final java.lang.Exception e) {
log.severe("[ERROR] Could not load settings file!");
return false;
}
if (WBini.getProperty("ABallRand") != null) {
allRand = Integer.parseInt(WBini.getProperty("ABallRand"));
}
if (WBini.getProperty("ABcam") != null) {
cam = Integer.parseInt(WBini.getProperty("ABcam"));
}
if (WBini.getProperty("ABskill") != null) {
skill = Integer.parseInt(WBini.getProperty("ABskill"));
}
if (WBini.getProperty("ABplayer") != null) {
player = Integer.parseInt(WBini.getProperty("ABplayer"));
}
if (WBini.getProperty("ABfriend") != null) {
friend = Integer.parseInt(WBini.getProperty("ABfriend"));
}
if (WBini.getProperty("ABtimeOutFriend") != null) {
timeOutFriend = Integer.parseInt(WBini.getProperty("ABtimeOutFriend"));
}
if (WBini.getProperty("ABtimeOutExp") != null) {
timeOutExp = Integer.parseInt(WBini.getProperty("ABtimeOutExp"));
}
if (WBini.getProperty("ABmoveMouseB") != null) {
moveMouseB = Integer.parseInt(WBini.getProperty("ABmoveMouseB"));
}
return true;
}
private boolean lookAway() {
if (!chatRes.typing && screenLookaway
&& timeLook < System.currentTimeMillis()
&& random(0, 111) == 0) {
chatRes.pause = true;
status = "Look Away";
if (random(0, moveMouseB) <= 50) {
mouse.setSpeed(random(3, 5));
mouse.move(random(40, game.getWidth() - 50), game.getHeight());
mouse.setSpeed(random(minMS, maxMS));
}
final int r1 = random(0, 101);
if (getMyPlayer().isMoving()) {
int m = 0;
while (valid() && m < 31) {
m++;
sleep(50);
if (r1 < 41 && m > 13) {
break;
}
if (!getMyPlayer().isMoving()) {
break;
}
}
timeLook = (long) (System.currentTimeMillis() + random(timeOutB1, timeOutB2));
}
chatRes.pause = false;
return true;
}
return false;
}
private void main(final boolean extras) {
mouse.setSpeed(random(minMS + 1, maxMS + 1));
if (!chatRes.typing) {
if (nextRun < System.currentTimeMillis()
&& walking.getEnergy() >= random(79, 90)) {
nextRun = System.currentTimeMillis() + 7000;
walking.setRun(true);
sleep(100);
}
final int random = random(1, allRand);
if (random == 1) {
if (random(1, 3) == 1) {
chatRes.wait = true;
mouse.move(random(5, game.getWidth()), random(5, game.getHeight()));
chatRes.wait = false;
}
}
if (random == 2) {
final int randCamera = random(1, cam);
if (randCamera <= 4) {
camTurned += 1;
chatRes.wait = true;
turnCamera();
chatRes.wait = false;
}
}
if (checkExperience && random == 6) {
if (System.currentTimeMillis() > timeExp
&& random(1, skill) == 1
&& getMyPlayer().getAnimation() != -1) {
if (game.getCurrentTab() != 1) {
chatRes.wait = true;
game.openTab(1);
final Point stats = new Point(interfaces.get(320).getComponent(3).getAbsoluteX() + 20, interfaces.get(320).getComponent(3).getAbsoluteY() + 10);
mouse.move(stats, 5, 5);
sleepCR(random(28, 31));
timeExp = System.currentTimeMillis()
+ (long) random(timeOutExp - 1500, timeOutExp + 1500);
chatRes.wait = false;
}
}
}
if (random == 7) {
if (random(0, 2) == 0) {
if (checkFriend
&& System.currentTimeMillis() > timeFriend
&& random(1, friend) == 1) {
if (getMyPlayer().getAnimation() != -1
|| getMyPlayer().isMoving()
&& calc.distanceTo(walking.getDestination()) > 5) {
chatRes.wait = true;
game.openTab(9);
sleepCR(random(18, 25));
timeFriend = System.currentTimeMillis()
+ (long) random(timeOutFriend - 1500, timeOutFriend + 1500);
chatRes.wait = false;
}
}
}
}
if (random == 8) {
if (extras == true) {
final int chance2 = random(1, player);
if (chance2 == 1) {
final RSPlayer player = players.getNearest(Players.ALL_FILTER);
if (player != null && calc.distanceTo(player) != 0) {
chatRes.wait = true;
mouse.move(player.getScreenLocation(), 5, 5);
sleepCR(random(6, 9));
mouse.click(false);
sleepCR(random(15, 17));
mouse.move(random(10, 450), random(10, 495));
chatRes.wait = false;
}
}
}
}
}
mouse.setSpeed(random(minMS, maxMS));
}
private boolean personalize() {
try {
WBini.load(new FileInputStream(new File(Configuration.Paths.getScriptCacheDirectory(), "WhiteBearAIOFiremaker.ini")));
} catch (final java.lang.Exception e) {
}
if (WBini.getProperty("ABallRand") == null) {
WBini.setProperty("ABallRand", Integer.toString(random(20, 23)));
}
if (WBini.getProperty("ABcam") == null) {
WBini.setProperty("ABcam", Integer.toString(random(26, 29)));
}
if (WBini.getProperty("ABskill") == null) {
WBini.setProperty("ABskill", Integer.toString(random(44, 49)));
}
if (WBini.getProperty("ABplayer") == null) {
WBini.setProperty("ABplayer", Integer.toString(random(19, 23)));
}
if (WBini.getProperty("ABfriend") == null) {
WBini.setProperty("ABfriend", Integer.toString(random(59, 69)));
}
if (WBini.getProperty("ABtimeOutFriend") == null) {
WBini.setProperty("ABtimeOutFriend", Integer.toString(random(33000, 60000)));
}
if (WBini.getProperty("ABtimeOutExp") == null) {
WBini.setProperty("ABtimeOutExp", Integer.toString(random(25000, 50000)));
}
if (WBini.getProperty("ABmoveMouseB") == null) {
WBini.setProperty("ABmoveMouseB", Integer.toString(random(55, 105)));
}
try {
WBini.store(new FileWriter(new File(Configuration.Paths.getScriptCacheDirectory(), "WhiteBearAIOFiremaker.ini")), "The GUI Settings for White Bear AIO Firemaker (Version: "
+ Double.toString(properties.version()) + ")");
} catch (final java.lang.Exception e) {
log.severe("[ERROR] Could not save settings file!");
return true;
}
boolean load = antiban.load();
while (!load) {
load = antiban.load();
}
return true;
}
private boolean sleepCR(final int amtOfHalfSecs) {
for (int x = 0; x < amtOfHalfSecs + 1; x++) {
sleep(random(48, 53));
if (chatRes.typing) {
return false;
}
}
return true;
}
private void turnCamera() {
final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
final char[] LRUD = new char[] { KeyEvent.VK_LEFT,
KeyEvent.VK_RIGHT, KeyEvent.VK_UP, KeyEvent.VK_UP };
final int randomLR = random(0, 2);
final int randomUD = random(0, 2);
final int randomAll = random(0, 4);
if (random(0, 3) == 0) {
keyboard.pressKey(LR[randomLR]);
sleepCR(random(2, 9));
keyboard.pressKey(UD[randomUD]);
sleepCR(random(6, 10));
keyboard.releaseKey(UD[randomUD]);
sleepCR(random(2, 7));
keyboard.releaseKey(LR[randomLR]);
} else {
keyboard.pressKey(LRUD[randomAll]);
if (randomAll > 1) {
sleepCR(random(6, 11));
} else {
sleepCR(random(9, 12));
}
keyboard.releaseKey(LRUD[randomAll]);
}
}
}
private class Area {
int minX, minY, maxX, maxY;
public Area(final int minX, final int minY, final int maxX,
final int maxY) {
this.minX = minX;
this.minY = minY;
this.maxX = maxX;
this.maxY = maxY;
}
public boolean inArea(final RSTile t) {
if (t.getX() >= minX && t.getX() <= maxX && t.getY() >= minY
&& t.getY() <= maxY) {
return true;
}
return false;
}
}
// --------------CLASSES---------------\\
private static class AStar {
private static class Node {
public int x, y;
public Node prev;
public double g, f;
public Node(final int x, final int y) {
this.x = x;
this.y = y;
g = f = 0;
}
public boolean equals(final Object o) {
if (o instanceof Node) {
final Node n = (Node) o;
return x == n.x && y == n.y;
}
return false;
}
public int hashCode() {
return x << 4 | y;
}
public RSTile toRSTile(final int baseX, final int baseY) {
return new RSTile(x + baseX, y + baseY);
}
public String toString() {
return "(" + x + "," + y + ")";
}
}
public static final int WALL_NORTH_WEST = 0x1;
public static final int WALL_NORTH = 0x2;
public static final int WALL_NORTH_EAST = 0x4;
public static final int WALL_EAST = 0x8;
public static final int WALL_SOUTH_EAST = 0x10;
public static final int WALL_SOUTH = 0x20;
public static final int WALL_SOUTH_WEST = 0x40;
public static final int WALL_WEST = 0x80;
public static final int BLOCKED = 0x100;
private Walking walking;
private Game game;
private int[][] flags;
private int off_x, off_y;
public boolean canMoveEast(final RSTile tile) {
final int base_x = game.getBaseX(), base_y = game.getBaseY();
final int x = tile.getX() - base_x, y = tile.getY() - base_y;
final RSTile off = walking.getCollisionOffset(game.getPlane());
final int flags = walking.getCollisionFlags(game.getPlane())[x
- off.getX()][y - off.getY()];
return (flags & WALL_EAST) == 0;
}
private double dist(final Node start, final Node end) {
if (start.x != end.x && start.y != end.y) {
return 1.41421356;
} else {
return 1.0;
}
}
public RSTile[] findPath(final RSTile start, final RSTile end) {
final int base_x = game.getBaseX(), base_y = game.getBaseY();
final int curr_x = start.getX() - base_x, curr_y = start.getY()
- base_y;
final int dest_x = end.getX() - base_x, dest_y = end.getY()
- base_y;
// load client data
flags = walking.getCollisionFlags(game.getPlane());
final RSTile offset = walking.getCollisionOffset(game.getPlane());
off_x = offset.getX();
off_y = offset.getY();
// loaded region only
if (flags == null || curr_x < 0 || curr_y < 0
|| curr_x >= flags.length || curr_y >= flags.length
|| dest_x < 0 || dest_y < 0 || dest_x >= flags.length
|| dest_y >= flags.length) {
return null;
}
// structs
final HashSet<Node> open = new HashSet<Node>();
final HashSet<Node> closed = new HashSet<Node>();
Node curr = new Node(curr_x, curr_y);
final Node dest = new Node(dest_x, dest_y);
curr.f = heuristic(curr, dest);
open.add(curr);
// search
while (!open.isEmpty()) {
curr = lowest_f(open);
if (curr.equals(dest)) {
// reconstruct from pred tree
return path(curr, base_x, base_y);
}
open.remove(curr);
closed.add(curr);
for (final Node next : successors(curr)) {
if (!closed.contains(next)) {
final double t = curr.g + dist(curr, next);
boolean use_t = false;
if (!open.contains(next)) {
open.add(next);
use_t = true;
} else if (t < next.g) {
use_t = true;
}
if (use_t) {
next.prev = curr;
next.g = t;
next.f = t + heuristic(next, dest);
}
}
}
}
// no path
return null;
}
private double heuristic(final Node start, final Node end) {
double dx = start.x - end.x;
double dy = start.y - end.y;
if (dx < 0) {
dx = -dx;
}
if (dy < 0) {
dy = -dy;
}
return dx < dy ? dy : dx;
}
public void init(final Game game, final Walking walking) {
this.game = game;
this.walking = walking;
}
private Node lowest_f(final Set<Node> open) {
Node best = null;
for (final Node t : open) {
if (best == null || t.f < best.f) {
best = t;
}
}
return best;
}
private RSTile[] path(final Node end, final int base_x, final int base_y) {
final LinkedList<RSTile> path = new LinkedList<RSTile>();
Node p = end;
while (p != null) {
path.addFirst(p.toRSTile(base_x, base_y));
p = p.prev;
}
return path.toArray(new RSTile[path.size()]);
}
private java.util.List<Node> successors(final Node t) {
final LinkedList<Node> tiles = new LinkedList<Node>();
final int x = t.x, y = t.y;
final int f_x = x - off_x, f_y = y - off_y;
final int here = flags[f_x][f_y];
if (f_y > 0 && (here & WALL_SOUTH) == 0
&& (flags[f_x][f_y - 1] & BLOCKED) == 0) {
tiles.add(new Node(x, y - 1));
}
if (f_x > 0 && (here & WALL_WEST) == 0
&& (flags[f_x - 1][f_y] & BLOCKED) == 0) {
tiles.add(new Node(x - 1, y));
}
if (f_y < 103 && (here & WALL_NORTH) == 0
&& (flags[f_x][f_y + 1] & BLOCKED) == 0) {
tiles.add(new Node(x, y + 1));
}
if (f_x < 103 && (here & WALL_EAST) == 0
&& (flags[f_x + 1][f_y] & BLOCKED) == 0) {
tiles.add(new Node(x + 1, y));
}
if (f_x > 0 && f_y > 0
&& (here & (WALL_SOUTH_WEST | WALL_SOUTH | WALL_WEST)) == 0
&& (flags[f_x - 1][f_y - 1] & BLOCKED) == 0
&& (flags[f_x][f_y - 1] & (BLOCKED | WALL_WEST)) == 0
&& (flags[f_x - 1][f_y] & (BLOCKED | WALL_SOUTH)) == 0) {
tiles.add(new Node(x - 1, y - 1));
}
if (f_x > 0 && f_y < 103
&& (here & (WALL_NORTH_WEST | WALL_NORTH | WALL_WEST)) == 0
&& (flags[f_x - 1][f_y + 1] & BLOCKED) == 0
&& (flags[f_x][f_y + 1] & (BLOCKED | WALL_WEST)) == 0
&& (flags[f_x - 1][f_y] & (BLOCKED | WALL_NORTH)) == 0) {
tiles.add(new Node(x - 1, y + 1));
}
if (f_x < 103 && f_y > 0
&& (here & (WALL_SOUTH_EAST | WALL_SOUTH | WALL_EAST)) == 0
&& (flags[f_x + 1][f_y - 1] & BLOCKED) == 0
&& (flags[f_x][f_y - 1] & (BLOCKED | WALL_EAST)) == 0
&& (flags[f_x + 1][f_y] & (BLOCKED | WALL_SOUTH)) == 0) {
tiles.add(new Node(x + 1, y - 1));
}
if (f_x > 0 && f_y < 103
&& (here & (WALL_NORTH_EAST | WALL_NORTH | WALL_EAST)) == 0
&& (flags[f_x + 1][f_y + 1] & BLOCKED) == 0
&& (flags[f_x][f_y + 1] & (BLOCKED | WALL_EAST)) == 0
&& (flags[f_x + 1][f_y] & (BLOCKED | WALL_NORTH)) == 0) {
tiles.add(new Node(x + 1, y + 1));
}
return tiles;
}
}
// -----------CHAT RESPONDER-----------\\
private class ChatResponder extends Thread {
long lastSaidHi = System.currentTimeMillis() - 110000,
lastDenyBot = System.currentTimeMillis() - 110000;
long lastLevelUp = System.currentTimeMillis() - 300000,
nextCustom = System.currentTimeMillis() - 1000000;
long lastSaidLevel = System.currentTimeMillis() - 110000,
nextModAlert = System.currentTimeMillis(),
sayNo = System.currentTimeMillis();
int level = 0; // records firemaking level
boolean run = true, doLevelRes = false, doCustomRes = false;
boolean typing = false; // read by antiban (true = suppress antiban)
boolean wait = false; // written by antiban (true = chat responder will
// wait)
boolean pause = false; // true if look away from screen is active
// Chat Responder Customization
String[] tradeRes = { "No thanks", "No thx", "Nope", "Im fine" },
greetingRes = { "hi!", "hi.", "hi", "hello", "hello!",
"hello.", "hello..", "yo", "yo!", "yes?", "what",
"what?", "hey!" }, botterRes = { "huh", "zzz", "...",
"???", "?????", "what", "what?", "no", "nop", "nope" },
levelRes = { "yay", "haha", ":)", "yay!", "yay!!!",
"finally..." }, customDetect = {}, customRes = {};
double customTO = 160000, customTOR = 30000;
private boolean findText(final String t, final String[] check) {
final String[] m = check;
for (final String element : m) {
if (t.contains(element)) {
return true;
}
}
return false;
}
private String getChatMessage() {
try {
String text = null;
for (int x = 280; x >= 180; x--) {
if (interfaces.get(137).getComponent(x).getText() != null) {
if (interfaces.get(137).getComponent(x).getText().contains("<col=")) {
text = interfaces.get(137).getComponent(x).getText();
break;
}
}
}
return text;
} catch (final Exception e) {
}
return null;
}
private void response(final String m) {
if (doLevelRes) {
if (level > 0
&& skills.getCurrentLevel(Skills.FIREMAKING) > level
&& System.currentTimeMillis() - 200000 >= lastLevelUp) {
lastLevelUp = System.currentTimeMillis();
if (random(0, 11) <= 7) {
resCount++;
sleepNE(random(200, 600));
final String[] r = levelRes;
final int ra = random(0, r.length);
sendText(r[ra]);
log("[Response] Level Up Response: " + r[ra]);
sleepNE(random(150, 250));
}
level = skills.getCurrentLevel(Skills.FIREMAKING);
return;
}
level = skills.getCurrentLevel(Skills.FIREMAKING);
}
if (System.currentTimeMillis() - 150000 >= lastSaidLevel) {
if (findText(m, new String[] { "fm", "firemak", "fremak" })
&& findText(m, new String[] { "level", "levl", "lvel",
"lvl" })) {
lastSaidLevel = System.currentTimeMillis();
resCount++;
sleepNE(random(600, 2000));
final int random = random(1, 11);
if (random == 1) {
sendText("fm lvl "
+ skills.getCurrentLevel(Skills.FIREMAKING));
} else if (random == 2) {
sendText("level: "
+ skills.getCurrentLevel(Skills.FIREMAKING));
} else if (random == 3) {
sendText("" + skills.getCurrentLevel(Skills.FIREMAKING));
} else if (random == 4) {
sendText("mines "
+ skills.getCurrentLevel(Skills.FIREMAKING));
} else if (random == 5) {
sendText("lv "
+ skills.getCurrentLevel(Skills.FIREMAKING));
} else if (random == 6) {
sendText(Integer.toString(skills.getCurrentLevel(Skills.FIREMAKING)));
} else if (random > 6) {
sleepNE(random(100, 200));
keyboard.sendKey((char) KeyEvent.VK_ENTER);
sleepNE(random(800, 1200));
keyboard.sendKey('S');
sleepNE(random(800, 1200));
keyboard.sendKey('P');
sleepNE(random(800, 1200));
keyboard.sendKey('2');
}
log("[Response] Answered to Level Question: '" + m + "'");
sleepNE(random(200, 300));
return;
}
}
if (findText(m, new String[] { "bottin", "botin", "botttin",
"botter", "bottter", "boter", "bootin", "boottin",
"booter", "bootter" })) {
if (m.contains("?")
|| m.contains(getMyPlayer().getName().toLowerCase())
|| m.contains("!")) {
if (System.currentTimeMillis() - 130000 >= lastDenyBot) {
lastDenyBot = System.currentTimeMillis();
resCount++;
sleepNE(random(600, 2000));
final String[] bot = botterRes;
final int random3 = random(0, bot.length);
sendText(bot[random3]);
log("[Response] Answered to Botting Message: '" + m
+ "'");
sleepNE(random(150, 250));
return;
}
}
}
if (findText(m, new String[] { "hi ", "hello", "hi<", "hey", "hi!",
"hi.", "yo!", "yo.", "yo<" })) {
if (System.currentTimeMillis() - 130000 >= lastSaidHi) {
lastSaidHi = System.currentTimeMillis();
resCount++;
sleepNE(random(600, 1600));
final String[] hi = greetingRes;
final int random2 = random(0, hi.length);
sendText(hi[random2]);
log("[Response] Answered to Greeting: '" + m + "'");
sleepNE(random(150, 250));
return;
}
}
if (doCustomRes && findText(m, customDetect)
&& System.currentTimeMillis() > nextCustom) {
nextCustom = (long) (System.currentTimeMillis() + random(customTO
- customTOR, customTO + customTOR));
resCount++;
sleepNE(random(500, 1400));
final int r = random(0, customRes.length);
sendText(customRes[r]);
log("[Response] Custom Response: '" + m + "'");
sleepNE(random(150, 250));
return;
}
sleepNE(random(650, 750));
}
public void run() {
while (!thePainter.savedStats || getChatMessage() == null) {
sleepNE(200);
}
while (run) {
try {
if (game.getClientState() == 10 && !pause) {
if (useChatRes && tradeResponse) {
if (sayNo < System.currentTimeMillis()) {
tradeResponse = false;
final int timeOut = random(110000, 130000);
sayNo = System.currentTimeMillis() + timeOut;
sleepNE(random(300, 700));
final String[] res = tradeRes;
final int rand = random(0, res.length);
sendText(res[rand]);
log("[Response] Said No to a Trade Request. Timeout: "
+ timeOut / 1000 + " sec");
}
}
final String m = getChatMessage().toLowerCase();
if (m != null
&& !m.equals(lastMessage)
&& m.contains(getMyPlayer().getName().toLowerCase()
+ ": <") != true) {
if (useChatRes) {
response(m);
} else {
sleepNE(random(700, 850));
}
lastMessage = m;
} else {
sleepNE(random(600, 700));
}
} else {
sleepNE(random(300, 400));
}
} catch (final java.lang.Throwable t) {
}
}
}
private void sendText(final String text) {
final char[] chs = text.toCharArray();
typing = true;
if (wait) {
for (int i = 0; i < 21; i++) {
sleepNE(10);
if (!wait) {
i = 21;
}
}
}
for (final char element : chs) {
keyboard.sendKey(element);
sleepNE(random(280, 550));
}
keyboard.sendKey((char) KeyEvent.VK_ENTER);
typing = false;
}
private void sleepNE(final int ms) {
try {
Thread.sleep(ms);
} catch (final Exception e) {
}
}
}
private class ChatResponderGUI {
private static final long serialVersionUID = 1L;
private JFrame WhiteBearGUI;
private JPanel panel1;
private JTabbedPane tabbedPane1;
private JPanel panel6;
private JTextArea textArea1;
private JTextArea textArea2;
private JButton button2;
private JTextArea textArea4;
private JTextArea textArea5;
private JButton button3;
private JTextArea textArea6;
private JPanel panel4;
private JLabel label17;
private JLabel label18;
private JLabel label20;
private JLabel label30;
private JTextArea textArea3;
private JTextArea textArea7;
private JTextArea textArea8;
private JTextArea textArea9;
private JLabel label19;
private JButton button4;
private JCheckBox radioButton2;
private JPanel panel3;
private JCheckBox radioButton1;
private JLabel label8;
private JFormattedTextField formattedTextField1;
private JLabel label9;
private JFormattedTextField formattedTextField3;
private JButton button5;
private JLabel label21;
private JTextArea textArea10;
private JTextArea textArea11;
private JLabel label22;
private JButton button1;
private JLabel label1;
private ChatResponderGUI() {
initComponentx();
}
private void back1ActionPerformed(final ActionEvent e) {
tabbedPane1.setSelectedIndex(0);
}
private void back2ActionPerformed(final ActionEvent e) {
tabbedPane1.setSelectedIndex(0);
}
private void button1ActionPerformed(final ActionEvent e) {
try {
chatRes.tradeRes = textArea3.getText().toLowerCase().split("/");
chatRes.greetingRes = textArea7.getText().toLowerCase().split("/");
chatRes.botterRes = textArea8.getText().toLowerCase().split("/");
chatRes.levelRes = textArea9.getText().toLowerCase().split("/");
chatRes.customDetect = textArea10.getText().toLowerCase().split("/");
chatRes.customRes = textArea11.getText().toLowerCase().split("/");
chatRes.doLevelRes = radioButton2.isSelected();
chatRes.doCustomRes = radioButton1.isSelected();
chatRes.customTO = Integer.parseInt(formattedTextField1.getText());
chatRes.customTOR = Integer.parseInt(formattedTextField3.getText());
WBini.setProperty("CRuseLevelRes", String.valueOf(radioButton2.isSelected() ? true
: false));
WBini.setProperty("CRuseCustomRes", String.valueOf(radioButton1.isSelected() ? true
: false));
WBini.setProperty("CRtradeRes", textArea3.getText());
WBini.setProperty("CRgreetingRes", textArea7.getText());
WBini.setProperty("CRbotterRes", textArea8.getText());
WBini.setProperty("CRlevelRes", textArea9.getText());
WBini.setProperty("CRdetection", textArea10.getText());
WBini.setProperty("CRresponse", textArea11.getText());
WBini.setProperty("CRcustomTO", formattedTextField1.getText());
WBini.setProperty("CRcustomTOR", formattedTextField3.getText());
try {
WBini.store(new FileWriter(new File(Configuration.Paths.getScriptCacheDirectory(), "WhiteBearAIOFiremaker.ini")), "The GUI Settings for White Bear AIO Firemaker (Version: "
+ Double.toString(properties.version()) + ")");
} catch (final IOException ioe) {
log.warning("[GUI] Error occurred when saving GUI settings!");
}
chatResGUI = false;
WhiteBearGUI.dispose();
} catch (final java.lang.Exception ex) {
log.severe("Error occurred when saving GUI options.");
}
}
private void button2ActionPerformed(final ActionEvent e) {
tabbedPane1.setSelectedIndex(1);
}
private void button3ActionPerformed(final ActionEvent e) {
tabbedPane1.setSelectedIndex(2);
}
private void initComponentx() {
WhiteBearGUI = new JFrame();
panel1 = new JPanel();
tabbedPane1 = new JTabbedPane();
panel6 = new JPanel();
textArea1 = new JTextArea();
textArea2 = new JTextArea();
button2 = new JButton();
textArea4 = new JTextArea();
textArea5 = new JTextArea();
button3 = new JButton();
textArea6 = new JTextArea();
panel4 = new JPanel();
label17 = new JLabel();
label18 = new JLabel();
label20 = new JLabel();
label30 = new JLabel();
textArea3 = new JTextArea();
textArea7 = new JTextArea();
textArea8 = new JTextArea();
textArea9 = new JTextArea();
label19 = new JLabel();
button4 = new JButton();
radioButton2 = new JCheckBox();
panel3 = new JPanel();
radioButton1 = new JCheckBox();
label8 = new JLabel();
formattedTextField1 = new JFormattedTextField();
label9 = new JLabel();
formattedTextField3 = new JFormattedTextField();
button5 = new JButton();
label21 = new JLabel();
textArea10 = new JTextArea();
textArea11 = new JTextArea();
label22 = new JLabel();
button1 = new JButton();
label1 = new JLabel();
// ======== WhiteBearGUI ========
{
WhiteBearGUI.setAlwaysOnTop(true);
WhiteBearGUI.setBackground(Color.black);
WhiteBearGUI.setResizable(false);
WhiteBearGUI.setMinimumSize(new Dimension(405, 405));
WhiteBearGUI.setTitle("White Bear AIO Firemaker");
WhiteBearGUI.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
WhiteBearGUI.setFont(new Font("Century Gothic", Font.PLAIN, 12));
final Container WhiteBearGUIContentPane = WhiteBearGUI.getContentPane();
WhiteBearGUIContentPane.setLayout(null);
// ======== panel1 ========