forked from BigAussie/BigAussie
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBigAussieWyrmHopper.simba
More file actions
966 lines (826 loc) · 29 KB
/
BigAussieWyrmHopper.simba
File metadata and controls
966 lines (826 loc) · 29 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
{$DEFINE SCRIPT_ID := '9796a306-c0ef-472f-93a3-b4777b5ac1da'}
{$UNDEF SCRIPT_REVISION}{$DEFINE SCRIPT_REVISION := '9'}
{$IFDEF WINDOWS}{$DEFINE SCRIPT_GUI}{$ENDIF}
{$I SRL-T/osr.simba}
{$I WaspLib/osr.simba}
// This is a heavily modified version of Flights Pollinivneach roof-hopper
// https://villavu.com/forum/showthread.php?t=177756=
//
// If you wish to use Summer Pies to boost, please ensure you start with them in your inventory.
// ###These are edited in the GUI and saved to your configuration .ini, you should not need to change these manually
var
WEBHOOKURL: String = '';
DiscordUID: String = '';
STOP_AT_LEVEL: Integer = -1;
STOP_AT_TERMITES: Integer = -1;
ENABLEWEBHOOKS: Boolean = True;
PINGONTERMINATED: Boolean = True;
TELEPORTMOUSE: Boolean = False;
// ###These are edited in the GUI and saved to your configuration .ini, you should not need to change these manually.##
ActiveTimer: TStopWatch;
Type
TLocation = (START, FINISH, TIGHTROPE, PLATFORM1, ZIPLINE, ADVANCEDPLATFORM1, ADVANCEDPLATFORM2, BASICPLATFORM1, BASICPLATFORM2, UNKNOWN);
ResultEx = (COMPLETE, FAILED, NOTFOUND);
TObstacle = record
Index,
MaxTime,XP : Int32;
WalkTile : TPoint;
NextLoc : TLocation;
Color : TCTS2Color;
MMTiles : TPointArray;
UpText : TStringArray;
AngleMin, AngleMax: Int32;
end;
WyrmAgility = record (TBaseBankScript)
StartTile : TPoint;
Obstacles : Array [0..5] of TObstacle;
Obs_Names : Array [0..5] of String;
FailCount,Attempts : Int32;
MyFullPos: TRSPosition;
Timer: TStopWatch;
RunningTime: TStopWatch;
BoostTimer: TStopWatch;
SummerPiesBoost,
AdvancedCourse,
NewLap: Boolean;
Termites: TRSitem;
BoneShards: TRSitem;
SummerPies: TRSitem;
Index: Int32;
StartingBoneShards: Integer;
StartingTermites: Integer;
TotalTermites: Integer;
TotalBoneShards: Integer;
StartXP: Integer;
CurrentXP: Integer;
PrevXP: Integer;
XPGained: Integer;
LapCount: Integer;
end;
var
Script: WyrmAgility;
procedure WyrmAgility.HighlightRect(Rect: TRectangle; Color, Opacity: Integer);
begin
RSClient.Image.Clear(MainScreen.Bounds);
RSClient.Image.DrawRect(Rect, $FFFF00);
end;
procedure OnBreakStart(Task: PBreakTask);
begin
ActiveTimer.Pause();
end;
procedure OnBreakFinish(Task: PBreakTask);
begin
ActiveTimer.Resume();
end;
procedure OnSleepStart(Task: PSleepTask);
begin
ActiveTimer.Pause();
end;
procedure OnSleepFinish(Task: PSleepTask);
begin
ActiveTimer.Resume();
end;
procedure WyrmAgility.SendWebhook(msg: String; FilePath: String = '');
var
HTTP: Int32;
Response, Payload: String;
begin
if WEBHOOKURL = "" then
Exit;
if DiscordUID <> '' then
msg := '<@' + DiscordUID + '> ' + msg;
// First attempt with JSON payload
Payload := '{"content": "' + msg + '"}';
HTTP := InitializeHTTPClient(False);
try
SetHTTPHeader(HTTP, 'Content-Type', 'application/json');
Response := PostHTTPPage(HTTP, WEBHOOKURL, Payload);
if Response = '' then
WriteLn('Webhook successfully sent with JSON payload.')
else
WriteLn('Webhook sent with JSON payload. Response: ', Response);
// Fallback to FORMS if JSON Fails - We had to fallback as some users had issues with JSON Thanks @Chandler for all the help testing this.
if Pos('"code": 50006', Response) > 0 then
begin
FreeHTTPClient(HTTP);
HTTP := InitializeHTTPClient(False);
AddPostVariable(HTTP, 'content', msg);
Response := PostHTTPPageEx(HTTP, WEBHOOKURL);
if Response = '' then
WriteLn('Webhook fallback successfully sent with form data after code 50006 error.')
else
WriteLn('Webhook fallback sent with form data after code 50006 error. Response: ', Response);
end;
finally
FreeHTTPClient(HTTP);
end;
end;
procedure WyrmAgility.SendTerminationNotification();
begin
Self.SendWebhook('Colossal Wyrm Agility has terminated or crashed.');
end;
procedure WyrmAgility.TakeScreenshot(Name: String);
var
i: Int32;
begin
CreateDirectory('Screenshots/');
i := Length(GetFiles('Screenshots/', 'png'));
SaveScreenshot('Screenshots/BAWyrmAgility_' + Name + '_' + IntToStr(i) + '.png');
end;
procedure TAntiban.Setup(); override;
begin
Self.Skills := [ERSSkill.Agility, ERSSkill.TOTAL];
Self.MinZoom := 0;
Self.MaxZoom := 10;
Antiban.OnStartBreak := @OnBreakStart;
Antiban.OnFinishBreak := @OnBreakFinish;
Antiban.OnStartSleep := @OnSleepStart;
Antiban.OnFinishSleep := @OnSleepFinish;
inherited;
end;
function FormatRoundedNumber(Number: Integer): String;
begin
// If the number is >= 1 million, format it with 1 decimal place and add "M" suffix
if Number >= 1000000 then
Result := FormatFloat('0.0M', Number / 1000000)
// If the number is >= 1 thousand, format it with no decimal places and add "K" suffix
else if Number >= 1000 then
Result := FormatFloat('0K', Number / 1000)
// For smaller numbers, use the regular SRL.FormatNumber function
else
Result := SRL.FormatNumber(Number);
end;
procedure WyrmAgility.Report();
var
ActiveRuntime: Integer;
CurrentXP: Integer;
GainedXP: Integer;
CurrentTermites: Integer;
CurrentBoneShards: Integer;
XPPerHour, XPPerHourExcludingBreaks: Integer;
i: Integer;
begin
ClearDebug();
if NewLap then
begin
NewLap := False;
TotalTermites := 0;
TotalBoneShards := 0;
CurrentTermites := Inventory.CountItemStack('Termites');
CurrentBoneShards := Inventory.CountItemStack('Blessed bone shards');
if CurrentTermites = -1 then
CurrentTermites := 0;
if CurrentBoneShards = -1 then
CurrentBoneShards := 0;
TotalTermites := CurrentTermites - StartingTermites;
TotalBoneShards := CurrentBoneShards - StartingBoneShards;
end;
APIClient.SubmitStats(APIClient.GetUUID());
XPBar.EarnedXP();
CurrentXP := XPBar.Read();
GainedXP := CurrentXP - StartXP;
WriteLn('========================================');
WriteLn(' BigAussies Wyrm Roof-Hopper ');
WriteLn('========================================');
if AdvancedCourse then
WriteLn(' Course Type: Advanced')
else
WriteLn(' Course Type: Basic');
WriteLn(' Runtime: ' + SRL.MsToTime(GetTimeRunning, Time_Short));
WriteLn(' Termites Obtained: ' + IntToStr(TotalTermites));
WriteLn(' Bone Shards Obtained: ' + IntToStr(TotalBoneShards));
WriteLn(' XP Gained: ' + FormatRoundedNumber(GainedXP));
if (STOP_AT_LEVEL <> -1) or (STOP_AT_LEVEL = 99) then
WriteLn(' Current Level: ' + IntToStr(Stats.GetLevel(ERSSkill.Agility)) + ' / Stop at Level: ' + IntToStr(STOP_AT_LEVEL));
WriteLn('----------------------------------------');
XPPerHour := Round((GainedXP) / (RunningTime.ElapsedTime / 3600000));
XPPerHourExcludingBreaks := Round((GainedXP) / (ActiveTimer.ElapsedTime / 3600000));
WriteLn(' XP/Hour: ' + FormatRoundedNumber(XPPerHourExcludingBreaks));
Writeln(' Termites per hour: ' + FormatRoundedNumber(Round(TotalTermites / (RunningTime.ElapsedTime / 3600000))));
Writeln(' Bone shards per hour: ' + FormatRoundedNumber(Round(TotalBoneShards / (RunningTime.ElapsedTime / 3600000))));
if Length(Antiban.Breaks) > 0 then
WriteLn(' Time till break: ' + SRL.MsToTime(Max(0, Round(Antiban.Breaks[0].NextAtTime - RunningTime.ElapsedTime)), Time_Short));
if Length(Antiban.Sleeps) > 0 then
if Antiban.Sleeps[0].NextAtTime > GetTimeRunning then
WriteLn(' Time till sleep: ' + SRL.MsToTime(Max(0, Round(Antiban.Sleeps[0].NextAtTime - RunningTime.ElapsedTime)), Time_Short));
if Self.SummerPiesBoost then
WriteLn(' Summer Pie Boost Enabled');
if STOP_AT_TERMITES > 0 then
WriteLn(' Stopping at ' + IntToStr(STOP_AT_TERMITES) + ' Termites');
WriteLn('========================================');
WriteLn(' BigAussies Wyrm Roof-Hopper ');
WriteLn(' Version: ' + {$MACRO SCRIPT_REVISION});
WriteLn('========================================');
if (STOP_AT_TERMITES > 0) and (Inventory.CountItemStack('Termites') >= STOP_AT_TERMITES) then
begin
WriteLn('Stopping script as we have reached the termites limit');
Logout.ClickLogout();
TerminateScript();
end;
end;
// full Credits to SkunkBUILDAGUIworks & Student for helping with this so we can see the portals.
procedure TRSMinimap.RotateWithinAngles(min, max: Int32);
var
minMaxAvg: Int32 := Floor((min + max) div 2);
preferredAngle: Int32 := SRL.SkewedRand(minMaxAvg, min, max);
begin
if preferredAngle < 0 then
preferredAngle := preferredAngle + 360;
if InRange(self.getCompassAngle(True), min, max) then
Exit; //tztok Aussie fat cok
Minimap.SetCompassAngle(preferredAngle);
end;
function WyrmAgility.GetLocation(): TLocation;
begin
MyFullPos := Map.FullPosition;
//writeln(MyFullPos);
if (MyFullPos.Plane = 0) and MyFullPos.InBox([2476, 38682, 2524, 38738]) then Exit(START);
if MyFullPos.InBox([15572, 38702, 15584, 38726]) then Exit(TIGHTROPE);
if (MyFullPos.Plane = 1) and MyFullPos.InBox([15548, 38786, 15556, 38794]) then Exit(PLATFORM1);
if (MyFullPos.Plane = 2) and MyFullPos.InBox([28602, 38796, 28614, 38808]) then Exit(ADVANCEDPLATFORM1);
if (MyFullPos.Plane = 2) and MyFullPos.InBox([28548, 38798, 28556, 38806]) then Exit(ADVANCEDPLATFORM2);
if MyFullPos.InBox([28508, 38698, 28517, 38706]) then Exit(ZIPLINE);
if MyFullPos.InBox([15492, 38786, 15502, 38794]) then Exit(BASICPLATFORM1);
if MyFullPos.InBox([15464, 38698, 15472, 38706]) then Exit(BASICPLATFORM2);
end;
function WyrmAgility.GetNextObstacle(): Int32;
var
Loc := Self.GetLocation();
begin
if (not RSClient.IsLoggedIn) then Exit;
case Loc of
START : Exit(0);
TIGHTROPE : Exit(1);
PLATFORM1 : Exit(2);
ADVANCEDPLATFORM1 : Exit(3);
ADVANCEDPLATFORM2 : Exit(4);
ZIPLINE : Exit(5);
BASICPLATFORM1 : Exit(3);
BASICPLATFORM2 : Exit(4);
end;
end;
function WyrmAgility.CheckAndBoostSummerPie(): Boolean;
var
dropItems: TRSItemArray;
begin
Result := False;
dropItems := ['Pie dish'];
if SRL.Dice(5) then
begin
WriteLn('[Antiban]: Skipping boost');
Exit;
end;
if not (Inventory.ClickItem('Half a summer pie') or Inventory.ClickItem('Summer pie')) then
Exit;
Result := True;
if Inventory.ContainsItem('Pie dish') then
begin
Wait(100, 200);
Inventory.RightClickDrop(dropItems, DROP_PATTERN_SNAKE);
WriteLn('Dropped Pie dish');
end;
end;
function WyrmAgility.FindObstacle(Obs: TObstacle): Boolean;
var
Pt, Tile: TPoint;
MSRect: TRectangle;
TPA: TPointArray;
ATPA: T2DPointArray;
Finder: TRSObjectFinder;
begin
if (not RSClient.IsLoggedIn) then Exit(False);
for Tile in Obs.MMTiles do
begin
if RSClient.RemoteInput.IsSetup then
RSClient.Image.Clear(Mainscreen.Bounds);
MSRect := Map.GetTileMS(Tile, 0);
if MainScreen.IsVisible(MSRect.Mean) then
begin
if RSClient.RemoteInput.IsSetup then
Self.HighlightRect(MSRect, 16105854, 75);
if Obs.Color.Color <> 0 then
begin
Finder.Colors := [Obs.Color];
Finder.ClusterDistance := 5;
for 1 to SRL.NormalRange(3,5) do
begin
if Obs.Index = 0 then
ATPA := MainScreen.FindObject(Finder, MSRect.Expand(20).Bounds)
else
ATPA := MainScreen.FindObject(Finder, MSRect.Expand(5).Bounds);
if Length(ATPA) < 1 then Exit;
for TPA in ATPA do
begin
if TELEPORTMOUSE then
Mouse.Teleport(TPA.Mean)
else
Mouse.Move(TPA.Mean);
if MainScreen.IsUpText(Obs.UpText, 75) then Exit(True);
end;
end;
end else
begin
for 1 to SRL.NormalRange(2,4) do
begin
Pt := SRL.RandomPoint(MSRect);
if TELEPORTMOUSE then
Mouse.Teleport(Pt)
else
Mouse.Move(Pt);
if MainScreen.IsUpText(Obs.UpText, 75) then Exit(True);
end;
end;
end;
end;
Result := Mainscreen.IsUpText(Obs.UpText, 75);
end;
function WyrmAgility.HandleObstacle(Obs: TObstacle): ResultEx;
var
T: TCountDown;
i, InitialXP, CurrentXP: Int32;
NextObs: TObstacle;
begin
Result := NOTFOUND;
Self.DoAntiban();
if (not RSClient.IsLoggedIn) then Exit;
while Minimap.IsPlayerMoving() do
Wait(35, 45);
if Obs.WalkTile.X < 2 then
Obs.WalkTile := Obs.MMTiles[0];
for 1 to 3 do
begin
if Self.FindObstacle(Obs) then Break;
end;
if Mainscreen.IsUpText(Obs.UpText, 75) then
begin
Mouse.Click(MOUSE_LEFT);
if (not MainScreen.DidRedClick) then Exit;
if RSClient.RemoteInput.IsSetup then
RSClient.Image.Clear(Mainscreen.Bounds);
Self.Attempts := 0;
end else
Exit(NOTFOUND);
T.Init(Obs.MaxTime);
InitialXP := XPBar.Read();
if Index = 5 then
NewLap := True;
while (not T.IsFinished) do
begin
if (not RSClient.IsLoggedIn) then Exit;
CurrentXP := XPBar.Read();
if (CurrentXP - InitialXP) >= Obs.XP then
Break;
Wait(75, 115);
end;
Result := COMPLETE;
Self.PrevXP := XPBar.Read();
Self.Report();
end;
procedure WyrmAgility.SetupObstacles();
var
i: Int32;
begin
Self.Obs_Names := ['Climb Ladder', 'Cross Tightrope', 'Main Platform 1', 'Platform 2', 'Platform 3', 'Zip Line'];
writeln('Starting Obstacle Setup');
with Obstacles[0] do // START LADDER
begin
Index := 0;
UpText := ['limb'];
MMTiles := [[2516, 38704]];
Color := CTS2(6659008, 7, 0.04, 2.02);
XP := 37;
NextLoc := TIGHTROPE;
MaxTime := 6500;
end;
with Obstacles[1] do // First Cross Rope
begin
Index := 1;
UpText := ['oss'];
MMTiles := [[15581, 38730]];
Color := CTS2(1812174, 20, 0.08, 0.85);
XP := 73;
NextLoc := PLATFORM1;
MaxTime := 21000;
end;
if Stats.GetLevel(ERSSkill.Agility) >= 62 then
begin
AdvancedCourse := True;
writeln('Setting up advanced course');
with Obstacles[2] do // Advanced Platform 1 Jump Edge
begin
Index := 2;
UpText := ['limb'];
MMTiles := [[15552, 38796]]; // Coords if we do advance course
//Color := CTS2(1943496, 8, 0.02, 0.54);
XP := 60;
NextLoc := ADVANCEDPLATFORM1;
MaxTime := 3500;
end;
with Obstacles[3] do // Advanced Platform 1 Jump Edge
begin
Index := 3;
UpText := ['ump'];
MMTiles := [[28600, 38802]];
Color := CTS2(1943496, 8, 0.02, 0.54);
XP := 60;
NextLoc := ADVANCEDPLATFORM2;
MaxTime := 7000;
end;
with Obstacles[4] do // Advanced Platform 2 Cross Rope
begin
Index := 4;
UpText := ['oss'];
MMTiles := [[28548, 38798]];
XP := 123;
NextLoc := ZIPLINE;
MaxTime := 21000;
end;
end
else
begin
writeln('Setting up basic course');
with Obstacles[2] do // Advanced Platform 1 Jump Edge
begin
Index := 2;
UpText := ['ross'];
MMTiles := [[15546, 38790]]; // Coords to start basic course
Color := CTS2(2071995, 4, 0.02, 0.55);
XP := 37;
NextLoc := BASICPLATFORM1;
MaxTime := 13000;
end;
with Obstacles[3] do // Basic Platform 1
begin
Index := 3;
UpText := ['limb'];
MMTiles := [[15484, 38790]];
XP := 74;
NextLoc := BASICPLATFORM2;
MaxTime := 12000;
end;
with Obstacles[4] do // Basic platform 2
begin
Index := 4;
UpText := ['limb'];
MMTiles := [[15462, 38702]];
XP := 37;
NextLoc := ZIPLINE;
MaxTime := 4500;
end;
end;
with Obstacles[5] do // Final Zipline
begin
Index := 5;
UpText := ['lide'];
MMTiles := [[28518, 38698]];
if Stats.GetLevel(ERSSkill.Agility) >= 62 then
XP := 325
else
XP := 244;
NextLoc := START;
MaxTime := 9200;
end;
end;
procedure WyrmAgility.Init(MaxActions: UInt32; MaxTime: UInt64); override;
var
CurrentZoomLevel: Integer;
i: Int32;
begin
inherited;
if RSClient.RemoteInput.IsSetup then
RSClient.Image.Clear(Mainscreen.Bounds);
Map.SetupChunkEx([24, 46, 26, 44], [0, 1, 2]);
Objects.Setup(Map.Objects(), @Map.Walker);
Npcs.Setup(Map.NPCs(), @Map.Walker);
StartXP := XPBar.Read();
StartingTermites := Inventory.CountItemStack('Termites');
if StartingTermites = -1 then
StartingTermites := 0;
StartingBoneShards := Inventory.CountItemStack('Blessed bone shards');
if StartingBoneShards = -1 then
StartingBoneShards := 0;
SummerPies := ('Summer Pie');
if inventory.ContainsItem(SummerPies) or inventory.ContainsItem('Half a summer pie') then
begin
writeln('Summer Pies Found, Will use Summer Pies to boost.');
Self.SummerPiesBoost := True;
end;
Self.RSW.EnableRunAtEnergy := 85;
CurrentZoomLevel := Options.GetZoomLevel;
if (CurrentZoomLevel < 0) or (CurrentZoomLevel > 10) then
Options.SetZoomLevel(SRL.NormalRange(0, 10));
if PINGONTERMINATED and ENABLEWEBHOOKS then
AddOnTerminate(@Self.SendTerminationNotification);
Mouse.Speed := SRL.NormalRange(22,26);
Self.PrevXP := XPBar.Read();
AdvancedCourse := False;
SetupObstacles();
RunningTime.Start();
ActiveTimer.Start();
end;
procedure WyrmAgility.Run(MaxActions: UInt32; MaxTime: UInt64);
var
TRes: ResultEx;
Recal, StartOver: Boolean;
NextObstacleIndex: Int32;
begin
Self.Init(MaxActions, MaxTime);
repeat
if (STOP_AT_LEVEL > 0) and (Stats.GetLevel(ERSSkill.Agility) >= STOP_AT_LEVEL) then
begin
WriteLn('Reached level ', STOP_AT_LEVEL, '. Stopping script.');
Logout.ClickLogout;
TerminateScript();
end;
if (Index = 0) and (Stats.GetLevel(ERSSkill.Agility) <= 61) then
SetupObstacles();
if WL.Activity.IsFinished() then
begin
WriteLn('No activity detected in 5 minutes! Shutting down.');
Break;
end;
Recal := False;
for Index := Self.GetNextObstacle to High(Self.Obstacles) do
begin
TRes := Self.HandleObstacle(Self.Obstacles[Index]);
if TRes = NOTFOUND then
begin
Inc(Self.Attempts);
if Self.Attempts > 5 then
begin
MyFullPos := Map.FullPosition;
WriteLn('Failed to locate obstacle: ' + Obs_Names[Index]);
WriteLn('Index: ' + ToStr(Index) + ', Loc: ' + ToStr(Self.GetLocation) + ', Ang: ' + ToStr(Minimap.GetCompassAngle(True)));
WriteLn('Coords: (' + IntToStr(MyFullPos.X) + ', ' + IntToStr(MyFullPos.Y) + ', Plane: ' + IntToStr(MyFullPos.Plane) + ')');
TakeScreenshot('FailedObstacle');
Logout.ClickLogout();
TerminateScript();
end;
if WL.Activity.IsFinished() then
begin
WriteLn('No activity detected in 5 minutes! Shutting down.');
Break;
end;
Antiban.RandomRotate();
Recal := True;
end;
if Recal then break;
end;
//Wait(SRL.NormalRange(125, 275));
until Self.ShouldStop();
Logout.ClickLogout();
TerminateScript('Time to shutdown');
end;
{$IFDEF SCRIPT_GUI}
type
TConfig = record(TScriptForm)
WebhookLabel , DiscordUIDLabel, DiscordUIDInfo: TLabel;
WebHookInput, DiscordUIDInput, StopAtLevelInputBox, StopAtTermitesInputBox: TLabeledEdit;
PingOnDMCheckBox, PingOnInGameChatCheckBox, PingOnTerminatedCheckBox, EnableWebhooksCheckBox, TeleportMouseCheckBox: TLabeledCheckBox;
StopAtLevelLabel, WebhookInfo: TLabel;
end;
procedure TConfig.UpdateAccountValues(sender: TObject);
var
selector: TComboBox;
user, pass, pin: TEdit;
worlds: TMemo;
idx: Int32;
worldsStr: String;
i: Int32;
begin
selector := TComboBox(Self.Form.GetChild('am_selector_combobox'));
idx := selector.GetItemIndex();
if (idx < 0) or (idx > High(Login.Players)) then Exit;
Self.SaveUserSettings();
Login.PlayerIndex := idx;
user := TEdit(Self.Form.GetChild('am_user_edit'));
pass := TEdit(Self.Form.GetChild('am_pass_edit'));
pin := TEdit(Self.Form.GetChild('am_pin_edit'));
worlds := TMemo(Self.Form.GetChild('am_worlds_memo'));
user.SetText(Login.Players[idx].User);
pass.SetText(Login.Players[idx].Password);
pin.SetText(Login.Players[idx].Pin);
worldsStr := '';
for i := 0 to High(Login.Players[idx].Worlds) do
begin
worldsStr += ToStr(Login.Players[idx].Worlds[i]);
if i < High(Login.Players[idx].Worlds) then
worldsStr += ', ';
end;
worlds.SetText(worldsStr);
Self.LoadUserSettings();
end;
procedure TConfig.InitializeAccountManager;
var
accountManagerTab: TTabSheet;
selector: TComboBox;
begin
selector := TComboBox(Self.Form.GetChild('am_selector_combobox'));
selector.SetOnChange(@UpdateAccountValues);
end;
procedure TConfig.LoadUserSettings();
var
SavedDiscordUID, SavedWebhookURL: String;
SavedStopAtTermites: Int32;
SavedPingOnTerminated, SavedEnableWebhooks, SavedTeleportMouse: Boolean;
Username: String;
begin
if (Login.PlayerIndex < 0) or (Login.PlayerIndex > High(Login.Players)) then
Username := 'NoUserNameSelected'
else
Username := Login.Players[Login.PlayerIndex].User;
if Username = '' then Exit;
SavedDiscordUID := ReadINI(Username + ' Webhook Settings', 'DiscordUID', 'Configs/BASettings.ini');
SavedWebhookURL := ReadINI(Username + ' Webhook Settings', 'WebhookURL', 'Configs/BASettings.ini');
SavedEnableWebhooks := StrToBoolDef(ReadINI(Username + ' Webhook Settings', 'EnableWebhooks', 'Configs/BASettings.ini'), False);
SavedPingOnTerminated := StrToBoolDef(ReadINI(Username + ' Webhook Settings', 'PingOnTerminated', 'Configs/BASettings.ini'), True);
SavedTeleportMouse := StrToBoolDef(ReadINI(Username + ' Colossal Wyrm Agility Settings', 'TeleportMouse', 'Configs/BASettings.ini'), False);
SavedStopAtTermites := StrToIntDef(ReadINI(Username + ' Colossal Wyrm Agility Settings', 'StopAtTermites', 'Configs/BASettings.ini'), -1);
if Assigned(Self.TeleportMouseCheckBox) then
begin
Self.TeleportMouseCheckBox.SetChecked(SavedTeleportMouse);
end;
if Assigned(Self.EnableWebhooksCheckBox) then
begin
Self.EnableWebhooksCheckBox.SetChecked(SavedEnableWebhooks);
Self.WebhooksCheckboxChanged(Self.EnableWebhooksCheckBox.CheckBox);
end;
if Assigned(Self.PingOnTerminatedCheckBox) then
begin
Self.PingOnTerminatedCheckBox.SetChecked(SavedPingOnTerminated);
end;
if Assigned(Self.DiscordUIDInput) then
Self.DiscordUIDInput.SetText(SavedDiscordUID);
if Assigned(Self.WebHookInput) then
Self.WebHookInput.SetText(SavedWebhookURL);
if Assigned(Self.StopAtTermitesInputBox) then
Self.StopAtTermitesInputBox.SetText(ToStr(SavedStopAtTermites));
end;
procedure TConfig.SaveUserSettings();
var
Username: String;
begin
if (Login.PlayerIndex < 0) or (Login.PlayerIndex > High(Login.Players)) then
Username := 'NoUserNameSelected'
else
Username := Login.Players[Login.PlayerIndex].User;
if Username = '' then Exit;
if Assigned(Self.TeleportMouseCheckBox) then
TELEPORTMOUSE := Self.TeleportMouseCheckBox.IsChecked();
if Assigned(Self.EnableWebhooksCheckBox) then
ENABLEWEBHOOKS := Self.EnableWebhooksCheckBox.IsChecked();
if Assigned(Self.PingOnTerminatedCheckBox) then
PINGONTERMINATED := Self.PingOnTerminatedCheckBox.IsChecked();
if Assigned(Self.DiscordUIDInput) then
DiscordUID := Self.DiscordUIDInput.GetText();
if Assigned(Self.WebHookInput) then
WEBHOOKURL := Self.WebHookInput.GetText();
if Assigned(Self.StopAtTermitesInputBox) then
STOP_AT_TERMITES := StrToIntDef(Self.StopAtTermitesInputBox.GetText(), -1);
WriteINI(Username + ' Colossal Wyrm Agility Settings', 'StopAtTermites', ToStr(STOP_AT_TERMITES), 'Configs/BASettings.ini');
WriteINI(Username + ' Colossal Wyrm Agility Settings', 'TeleportMouse', BoolToStr(TELEPORTMOUSE, 'true', 'false'), 'Configs/BASettings.ini');
WriteINI(Username + ' Webhook Settings', 'DiscordUID', DiscordUID, 'Configs/BASettings.ini');
WriteINI(Username + ' Webhook Settings', 'WebhookURL', WEBHOOKURL, 'Configs/BASettings.ini');
WriteINI(Username + ' Webhook Settings', 'PingOnTerminated', BoolToStr(PINGONTERMINATED, 'true', 'false'), 'Configs/BASettings.ini');
WriteINI(Username + ' Webhook Settings', 'EnableWebhooks', BoolToStr(ENABLEWEBHOOKS, 'true', 'false'), 'Configs/BASettings.ini');
end;
procedure TConfig.StartScript(sender: TObject); override;
begin
Self.SaveUserSettings();
inherited;
end;
procedure TConfig.OpenURL(Sender: TObject);
begin
if Sender = Self.WebhookInfo then
OpenWebPage('https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks')
else if Sender = Self.DiscordUIDInfo then
OpenWebPage('https://support.discord.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID');
end;
procedure TConfig.WebhooksCheckboxChanged(Sender: TObject);
begin
Self.WebhookInfo.SetVisible(Self.EnableWebhooksCheckBox.IsChecked());
Self.DiscordUIDInfo.SetVisible(Self.EnableWebhooksCheckBox.IsChecked());
Self.DiscordUIDInput.SetVisible(Self.EnableWebhooksCheckBox.IsChecked());
Self.WebHookInput.SetVisible(Self.EnableWebhooksCheckBox.IsChecked());
Self.PingOnTerminatedCheckBox.SetVisible(Self.EnableWebhooksCheckBox.IsChecked());
end;
procedure TConfig.Run(); override;
var
tab: TTabSheet;
SavedDiscordUID, SavedWebhookURL: String;
SavedPingOnTerminated, SavedEnableWebhooks, SavedRemoteInput, SavedTeleportMouse: Boolean;
begin
ClearDebug();
Self.Setup('BigAussies Colossal Wyrm Agility');
Self.Start.SetOnClick(@Self.StartScript);
Self.AddTab('Script Settings');
tab := Self.Tabs[High(Self.Tabs)];
Self.CreateAccountManager(tab);
InitializeAccountManager();
Self.LoadUserSettings();
with Self.TeleportMouseCheckBox do
begin
Create(tab);
SetLeft(TControl.AdjustToDPI(37));
SetTop(TControl.AdjustToDPI(140));
SetCaption('Teleport Mouse mode');
SetHint('Instead of moving the mouse to obstacles the mouse will be teleported.');
SetChecked(SavedTeleportMouse);
end;
with Self.StopAtLevelInputBox do
begin
Create(tab);
SetLeft(Self.TeleportMouseCheckBox.GetLeft() + TControl.AdjustToDPI(175));
SetTop(TControl.AdjustToDPI(140));
SetWidth(110);
SetCaption('Stop at Level');
SetHint('Enter -1 to never stop.');
Edit.SetOnKeyPress(@Edit.NumberField);
end;
with Self.StopAtTermitesInputBox do
begin
Create(tab);
SetLeft(Self.TeleportMouseCheckBox.GetLeft() + TControl.AdjustToDPI(175));
SetTop(Self.StopAtLevelInputBox.GetTop() + TControl.AdjustToDPI(50));
SetWidth(110);
SetCaption('Stop at Termites');
SetHint('Enter -1 to never stop.');
Edit.SetOnKeyPress(@Edit.NumberField);
end;
with Self.EnableWebhooksCheckBox do
begin
Create(tab);
SetCaption("Discord Notifications");
SetLeft(Self.TeleportMouseCheckBox.GetLeft());
SetTop(Self.TeleportMouseCheckBox.GetTop() + TControl.AdjustToDPI(25));
SetHint('Script will ping you on your own discord server when it stops.');
SetChecked(SavedEnableWebhooks);
CheckBox.SetOnChange(@WebhooksCheckboxChanged);
end;
with Self.WebhookInfo do
begin
Create(tab);
SetLeft(Self.EnableWebhooksCheckBox.GetLeft());
SetTop(Self.EnableWebhooksCheckBox.GetTop() + TControl.AdjustToDPI(25));
SetCaption('Click here to learn how to generate your own Discord webhook URL');
SetHint('Click here to learn how to generate your own Discord webhook URL');
setOnClick(@OpenURL);
SetFontSize(TControl.AdjustToDPI(9));
SetFontColor(clBlue);
end;
with Self.DiscordUIDInput do
begin
Create(tab);
SetLeft(Self.WebhookInfo.GetLeft());
SetTop(Self.WebhookInfo.GetTop() + TControl.AdjustToDPI(30));
SetCaption('Discord UID (Optional)');
SetHint('What name to @ in discord when script terminates');
SetWidth(TControl.AdjustToDPI(140));
SetText(SavedDiscordUID);
end;
with Self.DiscordUIDInfo do
begin
Create(tab);
SetFontColor(clBlue);
SetLeft(Self.DiscordUIDInput.GetLeft() + Self.DiscordUIDInput.GetWidth() + TControl.AdjustToDPI(10));
SetTop(Self.DiscordUIDInput.GetTop() + TControl.AdjustToDPI(18));
SetCaption('Click here to learn how to find your Discord User ID');
SetHint('Click here to learn how to find your Discord User ID');
setOnClick(@OpenURL);
SetFontSize(TControl.AdjustToDPI(9));
end;
with Self.WebHookInput do
begin
Create(tab);
SetLeft(Self.DiscordUIDInput.GetLeft());
SetTop(Self.DiscordUIDInput.GetTop() + TControl.AdjustToDPI(45));
SetCaption('Discord Webhook URL');
SetHint('Discord Webhook URL');
SetWidth(TControl.AdjustToDPI(180));
SetText(savedWebhookURL);
end;
with Self.PingOnTerminatedCheckBox do
begin
Create(tab);
SetCaption("Ping on script termination");
SetLeft(Self.WebHookInput.GetLeft());
SetTop(Self.WebHookInput.GetTop() + TControl.AdjustToDPI(50));
SetHint('Enable to ping when the script terminates cleanly');
SetChecked(SavedPingOnTerminated);
end;
WebhooksCheckboxChanged(Self.EnableWebhooksCheckBox.CheckBox);
Self.CreateVersionPanel(tab);
Self.CreateAntibanManager();
Self.CreateWaspLibSettings();
Self.CreateAPISettings();
inherited;
end;
var
Config: TConfig;
{$ENDIF}
begin
{$IFDEF SCRIPT_GUI}
Sync(@Config.Run);
{$ENDIF}
Script.Run(WLSettings.MaxActions, WLSettings.MaxTime);
end;