-
Notifications
You must be signed in to change notification settings - Fork 3
/
Universal_Miner - no-smart.simba
745 lines (630 loc) · 19.2 KB
/
Universal_Miner - no-smart.simba
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
program Universal_Miner_V040;
{$I SRL/OSR.simba}
{$I SRL/utils/rsclient.simba}
{$I SRL/utils/rsclient_overrides.simba}
{$I SRL/utils/slackdebug.simba}
{$I WindowOverlay/WindowOverlay.simba}
{$I RSWalker/Walker.simba}
{$H-}{$R+}{$X+}
{==============================================================================]
| Universal Miner ™
|
| Steps to use:
| 1. For longer runs you need to declare login details bellow
| 2. Start the script at your min.ing site, and run setup.
[==============================================================================}
type
EDropStyle = (dsRegular, dsIntense, dsAdaptive);
const
LOGIN_NAME = '';
LOGIN_PASS = '';
RS_WORLD = -1; // preferred world
IS_MEMBER = False; //
SHIFT_DROP = True; // use shift to drop
INTENSE_DROP = dsAdaptive; // dsIntense, and dsAdaptive = mine some drop some (can be higher XP)
INTENSITY_LEVEL = 80; // min energy before intensive dropping is disabled
CHANCE_OF_MISS = 0; // % fraction chance of clicking a nearby point;
MINING_TIMEOUT = 35000; // max time it takes to mine a rock
SLEEP_AT_CLOCK = '07:00'; // when does the bot go to bed?
// --- Probably dont wanna touch bellow here ---------------------------------
CONFIG_PATH = IncludePath+'Universal_Miner/';
CONFIG_FILE = 'config.cfg';
CONFIG_MAP = 'map.png';
type
TClickHistory = record
Data: TRectArray;
end;
TStatistics = record
Trips: Int32;
StartInfo: TSkillInfo;
CurrLvl: Int32;
Count: Int32;
PrcToNextLvl: Int32;
Gains,Rem,CurrXP:Double;
XPPerOre: Int32;
DismissedRandoms: Int32;
Isset_XPPerOre: Boolean;
end;
TMiner = record
ConfigPath: String;
StartTime: Int64;
QuickDeposit: Boolean;
BotStats: TStatistics;
StatsDebugTick: Int64;
StatsDebugArea: TBox;
RockSpots, BankSpots: TPointArray;
RockColors, BankColors: array of TCTS2Color;
BankPath: TPointArray;
Offset: Vector2;
ClickOrder: TClickHistory;
FailCount: Int32;
Antiban, StockAB: TAntiban;
end;
var
Bot: TMiner;
RSW: TRSWalker;
{$ifdecl TWindowOverlay}
Overlay: TWindowOverlay;
Debug: TMufasaBitmap;
{$endif}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// UTILITY FUNCTIONS
function GetTimeRunning(): UInt32; override;
begin
if Bot.StartTime = 0 then Exit(0);
Result := GetTickCount() - Bot.StartTime;
end;
function StrToTPA(s:String): TPointArray;
var
i: Int32;
Arr: TExtArray;
begin
Arr := s.ExtractNumbers();
SetLength(Result, Length(Arr) div 2);
for i:=0 to High(Result) do
begin
Result[i].x := Trunc(Arr[i*2]);
Result[i].y := Trunc(Arr[i*2+1]);
end;
end;
function StrToCTS2(s:String): array of TCTS2Color;
var
i: Int32;
Arr: TExtArray;
begin
Arr := s.ExtractNumbers();
SetLength(Result, Length(Arr) div 4);
for i:=0 to High(Result) do
begin
Result[i].Color := Trunc(Arr[i*4]);
Result[i].Tolerance := Trunc(Arr[i*4+1]);
Result[i].HueMod := Arr[i*4+2];
Result[i].SatMod := Arr[i*4+3];
end;
end;
procedure TMouse.Move(P: TPoint); override;
var
dist: Double;
q: TPoint;
maxSpeed := Random(20,22);
minSpeed := Random(4,6);
begin
q := Self.GetPosition;
dist := Hypot(q.x-p.x, q.y-p.y);
self.Speed := Trunc(minSpeed + (maxSpeed-minSpeed) * Power(dist / 1000, 1/2));
inherited;
end;
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// MISC BOT FUNCTIONS
procedure TClickHistory.Push(x: TRectangle);
begin
Insert(x, Self.Data, 0);
end;
function TClickHistory.Pop(): TRectangle;
begin
if Length(Self.Data) < Length(Bot.RockSpots) then
Exit(Self.Data[High(Self.Data)]);
Result := Self.Data[High(Self.Data)];
SetLength(Self.Data, High(Self.Data));
end;
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Extensions to TAntiban
procedure TAntiban.EnergyAdjustInterval(Base: TAntiban; Fact:Double);
var
z,e: Double;
i: Int32;
begin
e := 1 - Self.EnergyLevel / 100;
for i:=0 to High(Self.Tasks) do
begin
z := Base.Tasks[i].Interval;
Self.Tasks[i].Interval := z-z*e*fact;
end;
end;
procedure Wait(min, max:Double; weight:EWaitDir=wdMean); override;
var t:Double := GetTickCount();
begin
inherited(min, max, weight);
Bot.Antiban.WaitFatigue(GetTickCount() - t);
end;
procedure WaitEx(mean, dev:Double); override;
var t:Double := GetTickCount();
begin
inherited(mean, dev);
Bot.Antiban.WaitFatigue(GetTickCount() - t);
end;
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// MINER
procedure TMiner.DeclarePlayers();
begin
with Players.New()^ do
begin
LoginName := LOGIN_NAME;
Password := LOGIN_PASS;
IsActive := True;
IsMember := IS_MEMBER;
World := RS_WORLD;
end;
Players.SetCurrent(0);
end;
procedure TMiner.SetupAntiban();
var
i:Int32;
sum: Double;
begin
StockAB.Init(SKILL_MINING);
StockAB.AddTask([@Antiban.LoseFocus, ONE_MINUTE*8, 0.20]);
StockAB.AddTask([@Antiban.HoverPlayers, ONE_MINUTE*10, 0.20]);
StockAB.AddTask([@Antiban.CheckSkill, ONE_MINUTE*13, 0.20]);
StockAB.AddTask([@Antiban.CheckStats, ONE_MINUTE*18, 0.20]);
StockAB.AddTask([@Antiban.OpenRandomTab, ONE_MINUTE*20, 0.20]);
StockAB.AddTask([@Antiban.RandomCompassNESW, ONE_MINUTE*40, 0.25]);
StockAB.AddTask([@Antiban.DoMiscStuff, ONE_MINUTE*45, 0.25]);
StockAB.AddTask([@Antiban.VeryShortBreak, ONE_MINUTE*50, 0.25]);
StockAB.AddBreak([2.0 * ONE_HOUR, 05 * ONE_MINUTE, 0.50, 0.33]);
StockAB.AddBreak([4.0 * ONE_HOUR, 40 * ONE_MINUTE, 0.96, 0.20]);
StockAB.AddBreak([16 * ONE_HOUR, 08 * ONE_HOUR, 0.99, 0.03]);
Antiban := StockAB.Copy();
with Antiban.Breaks[High(Antiban.Breaks)] do
NextAtTime := Antiban.TimeRunningAtClock(SLEEP_AT_CLOCK, '00:25');
for i:=0 to High(Antiban.Tasks) do
sum += ONE_HOUR / Antiban.Tasks[i].Interval;
WriteLn('Doing ',Round(sum,2),' antibans per hour');
end;
function TMiner.HasBanking(): Boolean;
begin
Result := (Self.BankColors <> []) and (Self.BankPath <> []) and (Self.BankSpots <> []);
end;
procedure TMiner.DoAntiban();
var
Id: Int32;
begin
if Self.Antiban.DoBreak(Id) and (Id = Self.Antiban.GetSleepId()) then
begin
// Reset the sleeptimer after having performed a sleep
// to about 07:30 / 7:30am +/- 25 min normal variation
Self.Antiban.Breaks[Id].NextAtTime := Self.Antiban.TimeRunningAtClock(SLEEP_AT_CLOCK, '00:25');
end;
if Self.Antiban.DoAntiban(False) then
Players.GetCurrent()^.Login();
Antiban.EnergyAdjustInterval(Self.StockAB, 0.35);
end;
procedure TMiner.PostAction(CheckAntiban: Boolean = True);
begin
WaitEx(500,70);
if CheckAntiban then Self.DoAntiban;
end;
procedure TMiner.ProcessWhileWaiting();
var
n,atNextLvl,atCurrLvl:Int32;
begin
BotStats.Gains := BotStats.count * BotStats.XPPerOre;
BotStats.CurrXP := BotStats.StartInfo.XP + BotStats.Gains;
BotStats.CurrLvl := srl.GetLevelAtXP(Ceil(BotStats.CurrXP));
atNextLvl := srl.GetXPAtLevel(BotStats.CurrLvl+1);
atCurrLvl := srl.GetXPAtLevel(BotStats.CurrLvl);
BotStats.Rem := atNextLvl - BotStats.CurrXP;
BotStats.PrcToNextLvl := 100 - Round((BotStats.Rem / (atNextLvl - atCurrLvl)) * 100);
if GetTickCount() - StatsDebugTick > 2000 then
begin
ClearDebug();
WriteLn('+---| STATS |----------------------------------------');
WriteLn('|- Script Runtime : ', SRL.MsToTime(GetTimeRunning, Time_Short));
WriteLn('|- Trips / Drops : ', BotStats.Trips);
WriteLn('|- Ores Mined : ', BotStats.Count);
WriteLn('|- Experience Gained : ', BotStats.Gains);
WriteLn('|- Experience Per Hour : ', Round(BotStats.Gains / (GetTimeRunning()/1000/60/60)) );
WriteLn('+----------------------------------------------------');
WriteLn('|- Current Map Offset : ', Self.Offset);
WriteLn('|- Dismissed Randoms : ', BotStats.DismissedRandoms);
WriteLn('|- Energy (profile) : ', Round(Antiban.EnergyLevel,2), '% (', Round(Antiban.Patience,3), ', ', Round(Antiban.Endurance,3),')');
WriteLn('|- Time Since Break : ', SRL.MsToTime(Antiban.TimeSinceBreak, Time_Short));
WriteLn('|- Time Till Sleep : ', SRL.MsToTime(Trunc(Antiban.Breaks[Antiban.GetSleepId].NextAtTime - Antiban.TimeRunning), Time_Short));
WriteLn('+----------------------------------------------------');
{$ifdecl TWindowOverlay}
StatsDebugArea := Debug.DrawSkillReport([288,3], clProgBrown, Trunc(BotStats.CurrXP), Trunc(BotStats.Gains), BotStats.Count, 'Mining');
{$ENDIF}
StatsDebugTick := GetTickCount();
end;
Self.DoAntiban;
end;
function TMiner.CountColors(R: TRectangle; Colors: array of TCTS2Color; Estimate:Boolean=True): Int32;
var
TPA: TPointArray;
i, count: Int32;
begin
for i:=0 to High(Colors) do
begin
count := srl.FindColors(TPA, Colors[i], R.Bounds);
if not Estimate then
count := Length(R.Filter(TPA));
Result += Count;
end;
end;
function TMiner.Find(Locations: TPointArray): TRectArray;
var
i: Int32;
me: TPoint;
rect: TRectangle;
begin
me := RSW.GetMyPos();
for i:=0 to High(Locations) do
begin
rect := RSW.GetTileMSEx(me, Locations[i], Offset.X, Offset.Y, 1).Expand(-2);
if MainScreen.GetBounds.Contains(rect.Bounds) then
Result += rect;
end;
if (Length(Result) = 0) then
begin
if (Self.FailCount in [2,6]) then
Minimap.RandomCompass(0,359)
else if (Self.FailCount = 7) then
begin
WriteLn('Trying to recover from failure');
Logout.ClickLogout();
Wait(5000,30000,wdLeft);
Players.GetCurrent^.Login();
MainScreen.SetAngle(True);
WaitEx(500,150);
end else if (Self.FailCount > 10) then
TerminateScript('Not close enough to objects: ('+ ToStr(me.x) +','+ToStr(me.y)+') -> '+ ToStr(locations));
Inc(Self.FailCount);
WaitEx(1600,450);
end else
Self.FailCount := 0;
end;
procedure TMiner.SetBestOffset(Locations: TPointArray; Colors:array of TCTS2Color);
var
i: Int32;
x,y,sum, best: Double;
rect: TRectangle;
me: TPoint;
begin
me := RSW.GetMyPos();
x := -1.8;
while (x <= 1.8) do begin
y := -1.8;
while (y <= 1.8) do begin
sum := 0;
for i:=0 to High(Locations) do
begin
rect := RSW.GetTileMSEx(me, Locations[i], X,Y, 1);
if MainScreen.GetBounds.Contains(rect.Bounds) then
sum += Self.CountColors(rect, Colors+CTS2(5263446,16), False);
end;
if sum > best then
begin
best := sum;
Self.Offset := [x,y];
end;
y += 0.2;
end;
x += 0.2;
end;
end;
function TMiner.DoWork(): Boolean;
var
i: Int32;
T: TCountDown;
TRA: TRectArray;
next: TRectangle;
tmpCurrXP, invCount: Int32;
function MaybeMiss(): Boolean;
var
R: TRectangle;
begin
Result := True;
if Random() <= CHANCE_OF_MISS then
begin
R := Minimap.PointToMsRect(Point(MM2MS.MMCX+Random(-6,6), MM2MS.MMCY+Random(-6,6)));
Mouse.Move(R, True);
WaitEx(65,10);
if MainScreen.IsUpText(['Walk here', 'Mine', 'Rocks']) then
Exit();
Result := False;
end;
end;
function ClickRock(rect: TRectangle): Int8;
begin
mouse.Move(rect, Random(10) = 0);
WaitEx(65,10);
if not Mainscreen.IsUpText(['Mine', 'Rocks']) then
Exit(1);
if (not MaybeMiss()) then
Exit(0);
if (Random() <= 0.05) and ChooseOption.Select('Mine Rocks') then
ClickOrder.Push(TRA[i])
else if Mouse.Click(ctRed) then
begin
ClickOrder.Push(TRA[i]);
for 6 to Round(srl.TruncatedGauss(0,12)) do
begin
Mouse.Click(mouse_Left);
WaitEx(65,10);
end;
end else
begin
Wait(400,7000,wdLeft);
Self.DoAntiban;
Antiban.WaitFatigue(Random(1500,3000), 0.6);
Exit(0);
end;
WaitEx(300,60);
Result := 2;
end;
begin
{$ifdecl TWindowOverlay}
Debug.ClearAllBut(Self.StatsDebugArea);
{$endif}
invCount := Inventory.Count;
TRA := Self.Find(self.RockSpots);
{$ifdecl TWindowOverlay}
for i:=0 to High(TRA) do
Debug.DrawRect(TRA[i], 255);
{$endif}
if (Self.BotStats.StartInfo = []) and (Self.BotStats.XPPerOre = 0) then
begin
Self.BotStats.StartInfo := Stats.GetSkillInfo(SKILL_MINING);
Self.BotStats.XPPerOre := BotStats.StartInfo.XP;
end;
for i:=0 to High(TRA) do
begin
if Self.CountColors(TRA[i], Self.RockColors) < 100 then
Continue;
Antiban.WaitFatigue(Random(700,1200), 0.5);
case ClickRock(TRA[i]) of
0: Exit;
1: Continue;
2: Minimap.WaitPlayerMoving(False);
end;
next := ClickOrder.Pop();
if (Self.Antiban.EnergyLevel > 40) or (Random() < 0.05) then
begin
if(Random() > 0.05) then
Mouse.Move(next, Random() < 0.1)
else if(Random() < 0.05) then
begin
Mouse.Move(srl.DefaultClientBounds, True, rndRandom);
Antiban.WaitFatigue(5000);
end;
end;
TRA := Find(self.RockSpots); // update the TRA in case we moved
T.Init(Trunc(srl.NormalRange(MINING_TIMEOUT, MINING_TIMEOUT*1.25)));
while (not T.IsFinished) and (Self.CountColors(TRA[i], Self.RockColors) > 100) do
begin
if(Chatbox.GotLevelUp()) then
if(Random(9) = 0) then
Chatbox.HandleLevelUp()
else
Break;
if 'inventory is too full' in Chatbox.GetNotification() then
Break;
Self.ProcessWhileWaiting();
Wait(30);
end;
if (Inventory.Count > invCount) then
begin
Inc(Self.BotStats.Count);
if (not Self.BotStats.Isset_XPPerOre) then //XXXXXXXXXXXX
begin
Self.BotStats.XPPerOre := Stats.GetSkillInfo(SKILL_MINING).XP - Self.BotStats.XPPerOre;
Self.BotStats.Isset_XPPerOre := Self.BotStats.XPPerOre > 0;
end;
end;
Exit(True);
end;
end;
procedure TMiner.DoBanking();
function OpenBank(): Boolean;
var Rect: TRectangle;
begin
for 0 to 3 do begin
for Rect in Find(self.BankSpots) do
if (Self.CountColors(Rect, Self.BankColors) > 100) and
BankScreen.OpenAt(srl.RandomPoint(Rect.Mean, Trunc(Rect.Radius))) then
Exit(True);
Wait(800,1300);
end;
end;
function BankInventory(): Boolean;
var
slots: TIntArray;
t: TCountDown;
begin
if Self.QuickDeposit then
Exit(BankScreen.DepositAll);
slots := Inventory.GetUsedSlots();
slots.Remove(0); //reserved
while Length(slots) > 0 do
begin
Inventory.MouseSlot(slots[0]);
ChooseOption.Select('Deposit-All');
t.Init(2000);
while Inventory.IsSlotUsed(slots[0]) and (not t.IsFinished) do
WaitEx(90,10);
slots := Inventory.GetUsedSlots();
slots.Remove(0);
end;
Wait(1, 1200, wdLeft);
Result := not Inventory.IsFull();
if Inventory.Count = 0 then
Self.QuickDeposit := True;
end;
function Walk(path: TPointArray): Boolean;
begin
for 0 to 2 do
if RSW.WalkPath(Path) then
Exit(True)
else
Wait(800, 3200, wdRight);
end;
begin
{$ifdecl TWindowOverlay}
Debug.ClearAllBut(Self.StatsDebugArea);
{$endif}
if(not Walk(self.BankPath)) then
TerminateScript('Failed to walk path [1]');
Self.DoAntiban;
if(not OpenBank()) then
TerminateScript('Failed to open bank');
PostAction(False);
if(not BankInventory()) then
TerminateScript('Failed to deposit items');
PostAction;
if(not Walk(self.BankPath.Reversed)) then
TerminateScript('Failed to walk path [2]');
Self.DoAntiban;
end;
procedure TMiner.IntenseDrop(Test: function: Boolean of Object);
var
p: TPoint;
Slots: TIntArray;
n: Int32 = 3;
begin
if Test() then Exit;
if Random(5) = 0 then
n := Random(2,4);
p := Mouse.GetPosition();
Slots := Inventory.GetUsedSlots();
if (Length(Slots) >= 3)then
begin
if(not Self.QuickDeposit) then Slots.Remove(0);
SetLength(Slots, Min(Length(Slots), n));
Inventory.DropItems(Inventory.ErrorPattern(Slots,2));
Mouse.Move(p,20);
end;
end;
procedure TMiner.DropInventory();
begin
if Self.QuickDeposit then
Inventory.DropItems(Inventory.ErrorPattern())
else
Inventory.DropItemsExcept([0], Inventory.ErrorPattern());
end;
procedure TMiner.Run();
var
loc: TPoint;
timer: TCountDown;
procedure TryDropWhileMining();
begin
if (not HasBanking) and (INTENSE_DROP in [dsIntense,dsAdaptive]) then
begin
if (INTENSE_DROP = dsIntense) then
Self.IntenseDrop(@Self.DoWork)
else if (INTENSE_DROP = dsAdaptive) and (Antiban.EnergyLevel > INTENSITY_LEVEL) then
Self.IntenseDrop(@Self.DoWork);
end;
end;
begin
Self.StartTime := GetTickCount();
MainScreen.SetAngle(True);
if Inventory.Count = 0 then
Self.QuickDeposit := True;
if Self.HasBanking() then
begin
loc := RSW.GetMyPos();
if (Distance(loc, self.BankPath[high(self.BankPath)]) < Distance(loc, self.BankPath[0])) and
(not RSW.WalkPath(self.BankPath.Reversed)) then
TerminateScript('Failed to walk from bank on startup');
end;
// --------- bot loop
repeat
// handle inventory
if (Random(5000) <> 0) and Inventory.IsFull() then
begin
if HasBanking then Self.DoBanking()
else Self.DropInventory();
Inc(BotStats.Trips);
end;
// tweak coordinates for our rocks
if timer.IsFinished() then
begin
Self.SetBestOffset(Self.RockSpots, Self.RockColors);
timer.Init(ONE_MINUTE);
end;
// do some mining
if Self.DoWork() then
begin
TryDropWhileMining();
Self.DoAntiban;
end else
Players.GetCurrent()^.Login();
Wait(1);
until False;
end;
procedure TMiner.Init();
const H = 0.5; O = 1;
begin
{$ifdecl TWindowOverlay}
Overlay := TWindowOverlay.Create();
Overlay.PaintInterval(100);
Debug := Overlay.ToMufasaBitmap();
{$endif}
self.DeclarePlayers();
Self.SetupAntiban();
Mouse.Speed := 10;
Inventory.ShiftDrop := SHIFT_DROP;
TerminateScript;
Players.GetCurrent()^.Login();
end;
procedure TMiner.Setup();
function LoadConfig(): Boolean;
begin
if not FileExists(ConfigPath+CONFIG_FILE) then
Exit(False);
BankPath := StrToTPA (ReadINI('settings', 'BankPath', ConfigPath+CONFIG_FILE));
RockSpots := StrToTPA (ReadINI('settings', 'RockSpots', ConfigPath+CONFIG_FILE));
RockColors := StrToCTS2(ReadINI('settings', 'RockColors', ConfigPath+CONFIG_FILE));
BankSpots := StrToTPA (ReadINI('settings', 'BankSpots', ConfigPath+CONFIG_FILE));
BankColors := StrToCTS2(ReadINI('settings', 'BankColors', ConfigPath+CONFIG_FILE));
Result := True;
end;
begin
InputQuery('Load config','Name of config', Self.ConfigPath);
Self.ConfigPath := CONFIG_PATH + Self.ConfigPath + '/';
if not LoadConfig() then
TerminateScript('Unknown config');
RSClient.SetFocus();
end;
procedure TMiner.Free();
begin
RSW.Free();
{$ifdecl TWindowOverlay}
Overlay.Free();
Debug.Free();
{$endif}
end;
begin
srl.SetupForClient('',[soDebugAntiban]);
Bot.Setup();
Bot.Init();
AddOnTerminate(@Bot.Free);
RSW.Init(Bot.ConfigPath+CONFIG_MAP);
RSW.MemScanEnabled := False;
AddOnTerminate(@RSW.Free);
Bot.Run();
end.