forked from BigAussie/BigAussie
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBigAussieHumidifyClay.simba
More file actions
922 lines (809 loc) · 26.6 KB
/
BigAussieHumidifyClay.simba
File metadata and controls
922 lines (809 loc) · 26.6 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
//{$UNDEF SCRIPT_ID}{$DEFINE SCRIPT_ID := '#'}
{$UNDEF SCRIPT_REVISION}{$DEFINE SCRIPT_REVISION := '1.2.1'}
{$IFDEF WINDOWS}{$DEFINE SCRIPT_GUI}{$ENDIF}
{$I SRL-T/osr.simba}
{$I WaspLib/osr.simba}
// Special thanks for Reldnahc for his help with the GUI and his amazing Wrath Runecrafter which I learned from.
// Shout to the man Prush, His scripts inspired me to start trying to create my own and I have pulled many things from his scripts. Much love man <3
// Huge thanks to 3Garrett3 and all his grand exchange work and flipper, I found the includes a bit late so some of the methods I use a crude...
// Thanks to Torwent and everyone contributing to this amazing project!
type
ScriptSpeedTypes = (
SLOW,
NORMAL,
FAST,
TURBO
);
//=============DEFAULT SETTINGS==============
var
// You ONLY need to edit these if you are not going to use the GUI //
ENABLE_GUI: Boolean = True; // Enable or Disable the use of a GUI - NOTE: Some settings can only be changed in the GUI
STOP_AT_LEVEL: Integer = 99; // Script will Logout and stop when this level is reached.
SCRIPTSPEED: ScriptSpeedTypes = NORMAL; // Values Accepted SLOW/NORMAL/FAST/TURBO - This affects mouse speed + waitimes.
BUYASTRALSCHECK: Boolean = True; // If you have no Astral Runes in your inventory or bank the script will buy more. (The amount purchased will be 1/27 of your clay quantity)
BUYCLAYCHECK: Boolean = True; // If you have no Clay in your inventory or bank the script will buy the amount below in the QuantityInput.
SELLSOFTCLAYCHECK: Boolean = True; // If True the script will sell all Soft Clay before any of the other shopping methods.
QUANTITYINPUT: Integer = 10000;// When you run out of Clay this is how many the script should buy.
PRICESAPICHECK: Boolean = True; // If you are having issues with the prices API no loading this will disable prices, [ALL GRAND EXCHANGE FEATURES WILL BE DISABLED, ALSO YOU WILL NOT GET A PROFIT REPORT]
//===========================================
begin
Login.PlayerIndex := 0;
end;
Type
EState = (
HUMIDIFY
);
HumidifyClay = record (TBaseBankScript)
State : EState;
Clay,
AstralRuneItem,
SoftClay,
SteamBattleStaffBank,
SteamMysticStaffBank,
SoftClayNoted: TRSBankItem;
SteamBattleStaff,
SteamMysticStaff: TRSitem;
ShutDownTime: Int64;
RunTime: TStopWatch;
end;
Var
ClayTotal,
StartXP,
CastCount,
ClayValue,
AstralRuneValue,
SoftClayValue,
SoftClaySold,
ClayPurchased,
withdrawnSoftClay,
AstralRunesPurchased: Int32;
currentLevel: Integer;
NextBreakTime,
NextSleepTime: String;
waitTimeCasting: Int64;
Timer: TStopWatch;
procedure PauseTimer(Task: PBreakTask);
var
T: PBreakTask;
begin
Timer.Pause;
T := Task;
end;
procedure ResumeTimer(Task: PBreakTask);
var
T: PBreakTask;
begin
Timer.Resume;
T := Task;
end;
procedure OnBreakFinish(Task: PBreakTask);
begin
if (Length(Antiban.Breaks) > 0) then
NextBreakTime := Antiban.TimeUntilBreak(Antiban.Breaks[0]);
end;
procedure SetupAntiBan();
begin
Antiban.Skills := [ERSSkill.TOTAL, ERSSKILL.MAGIC];
Antiban.MinZoom := 62;
Antiban.MaxZoom := 80;
end;
procedure HumidifyClay.Init(MaxActions: Int32; MaxTime: Int64); override;
begin
inherited;
if (not RSClient.IsLoggedIn) then
begin
if Login.GetPlayer.Password <> '' then
Login.LoginPlayer
else
Exit;
end;
Self.RSW.SetupNamedRegion();
Self.RSW.AdaptiveWalk := True;
Mouse.Distribution := MOUSE_DISTRIBUTION_GAUSS;
StartXP := XPBar.Read();
// Maybe we use High instead one day, but then we need to rework reports etc I think this is fine for now..
// We had to add this as the script wouldn't start if the API was down..
if PRICESAPICHECK then
begin
ClayValue := ItemData.GetAverage('Clay');
SoftClayValue := ItemData.GetAverage('Soft clay');
AstralRuneValue := ItemData.GetAverage('Astral rune');
end;
if not PRICESAPICHECK then
begin
BUYASTRALSCHECK := False;
BUYCLAYCHECK := False;
SELLSOFTCLAYCHECK := False;
WriteLn('Prices API is disabled, all Grand Exchange features have been disabled.');
end;
Timer.Start();
ClayTotal := 0;
SteamBattleStaff := 'steam battlestaff';
SteamMysticStaff := 'mystic steam staff';
SteamBattleStaffBank := TRSBankItem.Setup('Steam battlestaff', 1);
SteamMysticStaffBank := TRSBankItem.Setup('Mystic steam staff', 1); // never tested but should work?
SoftClay := TRSBankItem.Setup('Soft Clay', 27);
SoftClayNoted := TRSBankItem.Setup('Soft Clay', Bank.QUANTITY_ALL, True);
Clay := TRSBankItem.Setup('Clay', 27);
AstralRuneItem := TRSBankItem.Setup('Astral rune', Bank.QUANTITY_ALL, False);
// Maybe we rework this with TSRL.SkewedRand later?
case SCRIPTSPEED of
SLOW: Mouse.Speed := Random(12, 14);
NORMAL: Mouse.Speed += Random(18, 20);
FAST: Mouse.Speed += Random(20, 22);
TURBO: Mouse.Speed += Random(24, 26);
end;
SetupAntiBan();
currentLevel := Stats.GetLevel(ERSSkill.MAGIC);
Options.SetZoomLevel(RandomRange(62, 80));
Self.EquipRequired();
Bank.WalkOpen();
WaitUntil(Bank.IsOpen(), 375, 2150);
if Bank.IsOpen() then
begin
Bank.DepositAll();
WaitUntil(Inventory.Count() = 0, 375, 2150);
end;
end;
procedure HumidifyClay.OpenGrandExchange();
var
attempts: Integer;
chatTitle: String;
begin
attempts := 0;
while attempts < 3 do
begin
if GrandExchange.Open() then
begin
WriteLn('Successfully opened the Grand Exchange');
Exit;
end;
chatTitle := Chat.GetChatTitle();
if chatTitle = 'Grand Exchange Clerk' then
begin
WriteLn('Clicked on Grand Exchange Clerk, Trying chat options.');
Chat.ClickContinue(True);
Wait(Random(150, 300));
Chat.ClickOption('I''d like to set up trade offers please.', True);
Wait(Random(800, 1200));
Chat.ClickContinue(True);
Inc(attempts);
continue;
end;
WriteLn('Failed to open the Grand Exchange');
Inc(attempts);
end;
Logout.ClickLogout();
TerminateScript('Failed to open Grand Exchange after 3 attempts, logged out and terminated.')
end;
procedure HumidifyClay.CollectAll(UpdateHistory: Boolean = True; Force: Boolean = False);
var
CollectButton: TRSButton;
begin
if not RSClient.IsLoggedIn() then exit();
if not GrandExchange.Open() then
begin
WriteLn('Failed to open the Grand Exchange');
exit();
end;
CollectButton := GrandExchange.GetOverviewButton(ERSGEOverviewButton.COLLECT);
if not CollectButton.Visible() then
begin
WriteLn('Collect button not visible or nothing to collect, moving on.');
exit();
end;
if not CollectButton.Click() then
begin
WriteLn('Failed to click the Collect button');
exit();
end;
if not WaitUntil(not CollectButton.Visible(), 250, 5000) then
WriteLn('Clicked collect button but items did not collect');
MainScreen.CloseInterface(True);
end;
function FindEmptySlot(): Int32;
var
i: Int32;
offerStatus: TRSGEOfferStatus;
begin
for i := 0 to 7 do
begin
offerStatus := GrandExchange.GetOfferStatus(i);
if offerStatus.OfferType = ERSGEOfferType.EMPTY then
begin
Result := i;
Exit;
end;
end;
Result := -1;
end;
procedure HumidifyClay.BuyItem(itemName: String; quantity: Int32; price: Int32);
var
slotNumber: Int32;
i: Int32;
buyButton, confirmButton, quantityButton, increaseButton: TRSButton;
offerStatus: TRSGEOfferStatus;
startTime: Int64;
begin
OpenGrandExchange();
if not GrandExchange.Open() then
begin
exit;
end;
slotNumber := FindEmptySlot();
if slotNumber = -1 then
begin
exit;
end;
buyButton := GrandExchange.GetOfferCreateButton(ERSGEOfferCreateButton.BUY, slotNumber);
if not buyButton.Click() then
begin
exit;
end;
if not GrandExchange.Search(itemName, True) then
begin
exit;
end;
quantityButton := GrandExchange.GetSetupOfferButton(ERSGESetupOfferButton.QUANTITY_ENTER);
if not quantityButton.Click() then
begin
exit;
end;
Wait(Random(1200, 1600)); // A little delay because sometimes it hangs
// Probably a cleaner way to do this but it works so....
Keyboard.Send(IntToStr(quantity));
KeyDown(VK_RETURN);
Wait(80);
if IsKeyDown(VK_RETURN) then
KeyUp(VK_RETURN);
increaseButton := GrandExchange.GetSetupOfferButton(ERSGESetupOfferButton.PRICE_INCREASE);
for i := 1 to 2 do
begin
if not increaseButton.Click() then
begin
exit;
end;
Wait(500);
end;
confirmButton := GrandExchange.GetSetupOfferButton(ERSGESetupOfferButton.CONFIRM);
if not confirmButton.Click() then
begin
exit;
end;
startTime := GetTimeRunning();
repeat
Wait(Random(3000, 5000));
offerStatus := GrandExchange.GetOfferStatus(slotNumber);
until (offerStatus.Progress = 100) or ((GetTimeRunning() - startTime) > RandomRange(160000, 210000));
// Failsafe just in case they are at GE Limit.
if offerStatus.Progress < 100 then
begin
WriteLn('The buy offer for ' + itemName + ' has not been fully fulfilled after 3 minutes, Will move on.');
CollectAll();
end
else
begin
WriteLn('The buy offer for ' + itemName + ' has been fulfilled');
end;
if itemName = 'Clay' then
ClayPurchased += quantity
else if itemName = 'Astral rune' then
AstralRunesPurchased += quantity;
end;
procedure HumidifyClay.SellSoftClay(quantity: Int32; price: Int32);
var
slotNumber: Int32;
sellButton, confirmButton, quantityButton, decreaseButton: TRSButton;
offerStatus: TRSGEOfferStatus;
i: Int32;
startTime: Int64;
begin
OpenGrandExchange();
if not GrandExchange.Open() then
begin
exit;
end;
slotNumber := FindEmptySlot();
if slotNumber = -1 then
begin
WriteLn('All slots are full');
exit;
end;
sellButton := GrandExchange.GetOfferCreateButton(ERSGEOfferCreateButton.SELL, slotNumber);
if not sellButton.Click() then
begin
exit;
end;
if not Inventory.ClickItem('noted Soft clay') then
begin
exit;
end;
decreaseButton := GrandExchange.GetSetupOfferButton(ERSGESetupOfferButton.PRICE_DECREASE);
for i := 1 to 2 do
begin
if not decreaseButton.Click() then
begin
exit;
end;
Wait(Random(500, 800));
end;
quantityButton := GrandExchange.GetSetupOfferButton(ERSGESetupOfferButton.QUANTITY_ALL);
if not quantityButton.Click() then
begin
exit;
end;
confirmButton := GrandExchange.GetSetupOfferButton(ERSGESetupOfferButton.CONFIRM);
if not confirmButton.Click() then
begin
exit;
end;
startTime := GetTimeRunning();
repeat
Wait(Random(3000, 5000));
offerStatus := GrandExchange.GetOfferStatus(slotNumber);
until (offerStatus.Progress = 100) or ((GetTimeRunning() - startTime) > RandomRange(160000, 210000));
if offerStatus.Progress < 100 then
begin
WriteLn('The sell offer for Soft Clay has not been fully fulfilled after 3 minutes');
CollectAll();
end
else
begin
WriteLn('The sell offer for Soft Clay has been fulfilled');
SoftClaySold += withdrawnSoftClay;
end;
end;
procedure HumidifyClay.EquipRequired();
begin
if not Magic.IsSpellBook(ERSSpellBook.LUNAR) then
begin
TerminateScript('You must be on the Lunar Spellbook for Humidify, Script stopping.');
Exit;
end;
if Equipment.ContainsItem(SteamBattleStaff) or Equipment.ContainsItem(SteamMysticStaff) then
Exit;
if Inventory.ContainsItem(SteamBattleStaff) then
begin
Inventory.ClickItem(SteamBattleStaff);
Exit;
end
else if Inventory.ContainsItem(SteamMysticStaff) then
begin
Inventory.ClickItem(SteamMysticStaff);
Exit;
end;
WriteLn('Battlestaff still not found, Checking bank.');
Bank.WalkOpen();
if Bank.IsOpen() then
begin
if Bank.ContainsItem(SteamBattleStaffBank) then
begin
Bank.WithdrawItem(SteamBattleStaffBank, True);
WaitUntil(Inventory.ContainsItem('Steam battlestaff'), 385, 2100);
MainScreen.CloseInterface(True);
Inventory.ClickItem(SteamBattleStaff);
end
else if Bank.ContainsItem(SteamMysticStaffBank) then
begin
Bank.WithdrawItem(SteamMysticStaffBank, True);
WaitUntil(Inventory.ContainsItem('Mystic steam staff'), 385, 2100);
MainScreen.CloseInterface(True);
Inventory.ClickItem(SteamMysticStaff);
end
else
begin
Logout.ClickLogout();
TerminateScript('No Steam Battlestaffs Found, Logging out.')
end;
end;
end;
procedure HumidifyClay.SellSoftClayIfRequired();
begin
if SELLSOFTCLAYCHECK and not Inventory.ContainsItem('Clay') then
begin
Bank.WalkOpen();
WaitUntil(Bank.IsOpen(), 375, 2150);
if Bank.IsOpen() then
begin
if not Inventory.ContainsItem('noted Soft clay') then
begin
Bank.WithdrawItem(SoftClayNoted, True);
WaitUntil(Inventory.ContainsItem('noted Soft clay'), 385, 2100);
withdrawnSoftClay := Inventory.CountItem('noted Soft clay');
end;
if Inventory.ContainsItem('noted Soft clay') then
begin
SellSoftClay(withdrawnSoftClay, SoftClayValue);
end;
end;
end;
end;
procedure HumidifyClay.doAction();
var
astralQuantity: Int32;
attempts: Int32;
begin
Self.State := Self.getState();
case Self.State of
EState.HUMIDIFY:
begin
Bank.WalkOpen();
WaitUntil(Bank.IsOpen(), 375, 2150);
if Bank.IsOpen() then
begin
if Inventory.ContainsItem('Soft clay') then
begin
Bank.DepositItem('Soft clay', True);
WaitUntil(not Inventory.ContainsItem('Soft clay'), 385, 2100);
end;
if not Bank.ContainsItem(Clay) then
begin
if SELLSOFTCLAYCHECK then
begin
WriteLn('Going to sell Soft Clay');
SellSoftClayIfRequired();
end;
if BUYCLAYCHECK then
begin
WriteLn('No Clay found, Going to purchase.');
OpenGrandExchange();
BuyItem('Clay', QuantityInput, ClayValue);
CollectAll();
Bank.WalkOpen();
WaitUntil(Bank.IsOpen(), 375, 2150);
Bank.DepositAll();
WaitUntil(Inventory.Count() = 0, 375, 2150);
end
else
begin
Logout.ClickLogout;
TerminateScript('We are out of Clay, Logging out.');
end;
end;
if not Inventory.ContainsItem('Astral rune') then
begin
Bank.WithdrawItem(AstralRuneItem, True);
WaitUntil(Inventory.ContainsItem('Astral rune'), 385, 2100);
if not Inventory.ContainsItem('Astral rune') then
begin
if BUYASTRALSCHECK then
begin
astralQuantity := (QuantityInput + 26) div 27;
WriteLn('Out of Astral runes, going to purchase ' + IntToStr(astralQuantity));
OpenGrandExchange();
BuyItem('Astral rune', astralQuantity, AstralRuneValue);
CollectAll();
Bank.DepositAll();
WaitUntil(Inventory.Count() = 0, 375, 2150);
end
else
begin
Logout.ClickLogout;
TerminateScript('We are out of Astral Runes, Logging out.');
end;
end;
end;
Bank.WithdrawItem(Clay, True);
WaitUntil(Inventory.ContainsItem('Clay'), 385, 3100);
ClayTotal += 27;
MainScreen.CloseInterface(True);
WaitUntil(not Bank.IsOpen(), 375, 2100);
end;
Magic.CastSpell(ERSSpell.HUMIDIFY);
bank.Hover();
ClearDebug();
Self.Report();
CastCount += 1;
TotalActions += 1;
if (Length(Antiban.Breaks) > 0) and (GetTimeRunning() >= Antiban.Breaks[0].NextAtTime) then
begin
Antiban.TakeBreak(Antiban.Breaks[0]);
end;
if (Length(Antiban.Sleeps) > 0) and (GetTimeRunning() >= Antiban.Sleeps[0].NextAtTime) then
begin
Antiban.TakeSleep(Antiban.Sleeps[0]);
end;
case SCRIPTSPEED of // Thanks Slacky for SkewedRand tip
SLOW: waitTimeCasting := TSRL.SkewedRand(1400, 1500, 2500);
NORMAL: waitTimeCasting := TSRL.SkewedRand(1100, 1300, 1500);
FAST: waitTimeCasting := TSRL.SkewedRand(1100, 1100, 1200);
TURBO: waitTimeCasting := TSRL.SkewedRand(1080, 1080, 1100);
end;
Wait(waitTimeCasting);
currentLevel := Stats.GetLevel(ERSSkill.MAGIC);
if (STOP_AT_LEVEL <> -1) and (currentLevel >= STOP_AT_LEVEL) then
begin
Logout.ClickLogout();
TerminateScript('Reached target level, stopping script.');
end;
attempts := 0;
while not Bank.IsOpen() and (attempts < 5) do
begin
Bank.WalkOpen();
Wait(Random(150, 250));
attempts += 1;
end;
if not Bank.IsOpen() then
begin
WriteLn('Bank could not be opened after 5 attempts, Scriptspeed might be to high?');
end;
WaitUntil(Bank.IsOpen(), 375, 2150);
if Bank.IsOpen() then
begin
Bank.DepositItem(SoftClay, True);
WaitUntil(not Inventory.ContainsItem('Soft clay'), 385, 2100);
end;
end;
end;
end;
procedure HumidifyClay.Run(MaxActions: Int32; MaxTime: Int64);
var
antibanChance: Int32;
begin
Self.Init(MaxActions, MaxTime);
repeat
Self.doAction();
if not MainScreen.HasInterface() then
begin
case SCRIPTSPEED of
TURBO: antibanChance := 80;
FAST: antibanChance := 10;
NORMAL: antibanChance := 4;
SLOW: antibanChance := 2;
end;
if SRL.Dice(antibanChance) then
begin
Antiban.DoAntiban;
end;
end;
until Self.ShouldStop();
end;
function HumidifyClay.StartCheck(): Boolean;
begin
Exit(not Inventory.ContainsItem('Clay'));
end;
function HumidifyClay.GetState(): EState;
begin
if (not RSClient.IsLoggedIn) then Exit;
if Self.StartCheck() then
Exit(EState.HUMIDIFY);
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 HumidifyClay.Report();
var
CurrentXP, GainedXP, XP, Profit: Integer;
begin
CurrentXP := XPBar.Read();
GainedXP := CurrentXP - startXP;
XP := TotalActions * 14 * 200;
Profit := ClayTotal * (SoftClayValue - ClayValue) - ceil(ClayTotal / 27.0) * AstralRuneValue;
if (Length(Antiban.Breaks) > 0) then
NextBreakTime := Antiban.TimeUntilBreak(Antiban.Breaks[0]);
if (Length(Antiban.Sleeps) > 0) then
NextSleepTime := SRL.MsToTime(Max(0, Round(Antiban.Sleeps[0].NextAtTime - GetTimeRunning)), TIME_BARE);
WriteLn('========================================');
WriteLn(' BigAussies Humidify Clay ');
WriteLn(' Version: ' + {$MACRO SCRIPT_REVISION});
WriteLn('========================================');
WriteLn(' Runtime: ' + SRL.MsToTime(GetTimeRunning, Time_Short));
WriteLn(' Total Casts: ' + IntToStr(CastCount));
WriteLn(' XP Gained: ' + FormatRoundedNumber(GainedXP));
WriteLn(' Total Profit: ' + FormatRoundedNumber(Profit));
if (Length(Antiban.Breaks) > 0) then
WriteLn(' Time until next break: ' + NextBreakTime);
if (Length(Antiban.Sleeps) > 0) then
WriteLn(' Time until sleep ' + NextSleepTime);
if STOP_AT_LEVEL <> -1 then
WriteLn(' Current Level: ' + IntToStr(currentLevel) + ' / Stop at Level: ' + IntToStr(STOP_AT_LEVEL));
WriteLn('----------------------------------------');
WriteLn(' XP/Hour: ' + FormatRoundedNumber(Round((GainedXP) / (GetTimeRunning() / 3600000))));
WriteLn(' Casts/Hour: ' + IntToStr(Round(CastCount / (GetTimeRunning() / 3600000))));
WriteLn(' Profit/Hour: ' + FormatRoundedNumber(Round((Profit) / (GetTimeRunning() / 3600000))));
if BUYCLAYCHECK then
begin
if ClayPurchased > 0 then
WriteLn(' Total Clay Purchased: ' + IntToStr(ClayPurchased))
else
WriteLn(' Will attempt to purchase ' + IntToStr(QuantityInput) + ' Clay');
end;
if BUYASTRALSCHECK then
begin
if AstralRunesPurchased > 0 then
WriteLn(' Total Astral Runes Purchased: ' + IntToStr(AstralRunesPurchased))
else
WriteLn(' Purchase Astral Runes is Enabled.');
end;
if SELLSOFTCLAYCHECK then
begin
if SoftClaySold > 0 then
WriteLn(' Total Soft Clay Sold: ' + IntToStr(SoftClaySold))
else
WriteLn(' Sell Soft Clay is Enabled.');
end;
WriteLn('========================================');
WriteLn(' BigAussies Humidify Clay ');
WriteLn('========================================');
end;
var
Script: HumidifyClay;
{$IFDEF SCRIPT_GUI}
type
TConfig = record(TScriptForm)
Message, Message2, QuantityLabel, PricesAPIInfoLabel, ScriptSpeedLabel, GEInfoLabel, GEInfoLabel2, StopAtLevelLabel: TLabel;
QuantityInputBox, StopAtLevelInputBox: TEdit;
ScriptSpeedSelector: TLabeledCombobox;
SellSoftClayCheckBox, BuyClayCheckBox, BuyAstralsCheckBox, PricesAPICheckBox: TLabeledCheckBox;
end;
procedure TConfig.StartScript(sender: TObject); override;
begin
SCRIPTSPEED := ScriptSpeedTypes(Self.ScriptSpeedSelector.GetItemIndex());
SELLSOFTCLAYCHECK := Self.SellSoftClayCheckBox.IsChecked();
BUYCLAYCHECK := Self.BuyClayCheckBox.IsChecked();
BUYASTRALSCHECK := Self.BuyAstralsCheckBox.IsChecked();
PRICESAPICHECK := Self.PricesAPICheckBox.IsChecked();
QUANTITYINPUT := StrToInt(Self.QuantityInputBox.GetText); // This should finally give text, took me longer than I care to admit.....
STOP_AT_LEVEL := StrToInt(Self.StopAtLevelInputBox.GetText);
inherited;
end;
procedure TConfig.Run(); override;
var
tab: TTabSheet;
begin
Self.Setup("BigAussies Humidify Clay");
Self.Start.SetOnClick(@Self.StartScript);
Self.AddTab('Script Settings');
tab := Self.Tabs[High(Self.Tabs)];
Self.CreateBankSettings();
Self.CreateAccountManager(tab);
Self.CreateVersionPanel(tab);
Self.CreateAntibanManager();
Self.CreateWaspLibSettings();
Self.CreateAPISettings();
with Self.ScriptSpeedSelector do
begin
Create(tab);
SetLeft(TControl.AdjustToDPI(37));
SetTop(TControl.AdjustToDPI(170));
AddItemArray(['Slow', 'Normal', 'Fast', 'Turbo']);
SetItemIndex(Ord(SCRIPTSPEED));
SetHint('This affects wait times and mouse speed.');
end;
with Self.StopAtLevelInputBox do
begin
Create(tab);
SetLeft(Self.ScriptSpeedSelector.GetLeft() + 250);
SetTop(Self.ScriptSpeedSelector.GetTop());
SetWidth(100);
SetText('-1');
SetHint('Enter -1 to never stop.');
end;
with Self.StopAtLevelLabel do
begin
Create(tab);
SetLeft(Self.StopAtLevelInputBox.GetLeft());
SetTop(Self.StopAtLevelInputBox.GetTop() - TControl.AdjustToDPI(16));
SetCaption('Stop at Level');
SetHint('Enter -1 to never stop.');
end;
with Self.ScriptSpeedLabel do
begin
Create(tab);
SetLeft(Self.ScriptSpeedSelector.GetLeft());
SetTop(Self.ScriptSpeedSelector.GetTop() - TControl.AdjustToDPI(16));
SetCaption('Script Speed');
SetHint('This affects wait times and mouse speed.');
end;
with Self.Message2 do
begin
Create(tab);
SetLeft(TControl.AdjustToDPI(37));
SetTop(Self.ScriptSpeedSelector.GetTop() + TControl.AdjustToDPI(38));
SetCaption('You MUST have a Steam Battlestaff somewhere and be on the Lunar Spellbook.');
SetFontColor(clRed);
end;
with Self.Message do
begin
Create(tab);
SetLeft(TControl.AdjustToDPI(37));
SetTop(Self.Message2.GetTop() + TControl.AdjustToDPI(15));
SetCaption('Below are BETA Grand Exchange features! You may have issues!');
SetFontColor(clRed);
end;
with Self.SellSoftClayCheckBox do
begin
Create(tab);
SetCaption("Sell Soft Clay");
SetLeft(TControl.AdjustToDPI(37));
SetTop(Self.Message.GetTop() + TControl.AdjustToDPI(25));
SetChecked(SELLSOFTCLAYCHECK);
SetHint('Will sell Soft Clay, Will sell at lowest market sell.');
end;
with Self.BuyAstralsCheckBox do
begin
Create(tab);
SetCaption("Buy Astral Runes");
SetLeft(TControl.AdjustToDPI(37));
SetTop(Self.SellSoftClayCheckBox.GetTop() + TControl.AdjustToDPI(25));
SetChecked(BUYASTRALSCHECK);
SetHint('Will buy Astral Runes, Will buy at lowest market buy.');
end;
with GEInfoLabel do
begin
Create(tab);
SetLeft(Self.SellSoftClayCheckBox.GetLeft() + Self.SellSoftClayCheckBox.GetWidth() + TControl.AdjustToDPI(40));
SetTop(Self.SellSoftClayCheckBox.GetTop()+ TControl.AdjustToDPI(4));
SetCaption('Will sell at market low, will buy at market high.');
SetFontColor(clNavy);
end;
with GEInfoLabel2 do
begin
Create(tab);
SetLeft(Self.SellSoftClayCheckBox.GetLeft() + Self.SellSoftClayCheckBox.GetWidth() + TControl.AdjustToDPI(40));
SetTop(Self.GEInfoLabel.GetTop() + Self.GEInfoLabel.GetHeight() + TControl.AdjustToDPI(4));
SetCaption('If you want to maximize profit Buying and Selling manually is advised.');
SetFontColor(clNavy);
end;
with Self.BuyClayCheckBox do
begin
Create(tab);
SetCaption("Buy Clay");
SetLeft(TControl.AdjustToDPI(37));
SetTop(Self.BuyAstralsCheckBox.GetTop() + TControl.AdjustToDPI(25));
SetChecked(BUYCLAYCHECK);
SetHint('Will buy Clay, Will buy at lowest market buy.');
end;
with Self.QuantityInputBox do
begin
Create(tab);
SetLeft(TControl.AdjustToDPI(37));
SetTop(Self.BuyClayCheckBox.GetTop() + TControl.AdjustToDPI(25));
SetWidth(100);
SetText('5000');
end;
with Self.QuantityLabel do
begin
Create(tab);
SetLeft(Self.QuantityInputBox.GetLeft() + Self.QuantityInputBox.GetWidth() + TControl.AdjustToDPI(10));
SetTop(Self.QuantityInputBox.GetTop());
SetCaption('Amount of Clay to buy?');
end;
with Self.PricesAPICheckBox do
begin
Create(tab);
SetCaption("Enable Real-Time Prices");
SetLeft(TControl.AdjustToDPI(37));
SetTop(Self.QuantityInputBox.GetTop() + TControl.AdjustToDPI(35));
SetChecked(PRICESAPICHECK);
SetHint('If the GE Prices API is down, disable this to run the script without GE Features.');
end;
with PricesAPIInfoLabel do
begin
Create(tab);
SetLeft(Self.PricesAPICheckBox.GetLeft() + Self.PricesAPICheckBox.GetWidth() + TControl.AdjustToDPI(10));
SetTop(Self.PricesAPICheckBox.GetTop());
SetCaption('Disable this if you have issues loading prices, This will DISABLE all GE Features.');
SetFontColor(clNavy);
end;
inherited;
end;
var
Config: TConfig;
{$ENDIF}
begin
{$IFDEF SCRIPT_GUI}
if ENABLE_GUI then
Sync(@Config.Run);
{$ENDIF}
Script.Run(WLSettings.MaxActions, WLSettings.MaxTime);
end.