-
Notifications
You must be signed in to change notification settings - Fork 24
/
hunter.simba
510 lines (393 loc) · 11.1 KB
/
hunter.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
var
mouseSpeed: Integer = 20;
Var
wall:Integer;
procedure humanWindMouse(xs, ys, xe, ye, gravity, wind, minWait, maxWait, targetArea: extended);
var
veloX,veloY,windX,windY,veloMag,dist,randomDist,lastDist,D: extended;
lastX,lastY,MSP,W,TDist: integer;
T : LongWord;
sqrt2,sqrt3,sqrt5,maxStep,rCnc: extended;
begin
MSP := mouseSpeed;
sqrt2:= sqrt(2);
sqrt3:= sqrt(3);
sqrt5:= sqrt(5);
TDist := distance(round(xs), round(ys), round(xe), round(ye));
t := getSystemTime() + 10000;
repeat
if (getSystemTime() > t) then
break;
dist:= hypot(xs - xe, ys - ye);
wind:= minE(wind, dist);
if (dist < 1) then
dist := 1;
D := (round((round(TDist)*0.3))/7);
if (D > 25) then
D := 25;
if (D < 5) then
D := 5;
rCnc := random(6);
if (rCnc = 1) then
D := randomRange(2,3);
if (D <= round(dist)) then
maxStep := D
else
maxStep := round(dist);
if dist >= targetArea then
begin
windX:= windX / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
windY:= windY / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
end else
begin
windX:= windX / sqrt2;
windY:= windY / sqrt2;
end;
veloX:= veloX + windX;
veloY:= veloY + windY;
veloX:= veloX + gravity * (xe - xs) / dist;
veloY:= veloY + gravity * (ye - ys) / dist;
if (hypot(veloX, veloY) > maxStep) then
begin
randomDist:= maxStep / 2.0 + random(round(maxStep) div 2);
veloMag:= sqrt(veloX * veloX + veloY * veloY);
veloX:= (veloX / veloMag) * randomDist;
veloY:= (veloY / veloMag) * randomDist;
end;
lastX:= round(xs);
lastY:= round(ys);
xs:= xs + veloX;
ys:= ys + veloY;
if (lastX <> round(xs)) or (lastY <> round(ys)) then
moveMouse(round(xs), round(ys));
W := (random((round(100/MSP)))*6);
if (W < 5) then
W := 5;
W := round(W*0.9);
wait(W);
lastdist:= dist;
until(hypot(xs - xe, ys - ye) < 1)
if (round(xe) <> round(xs)) or (round(ye) <> round(ys)) then
moveMouse(round(xe), round(ye));
mouseSpeed := MSP;
end;
procedure brakeWindMouse(xs, ys, xe, ye, gravity, wind, minWait, maxWait,
targetArea: extended; double: boolean);
var
veloX,veloY,windX,windY,veloMag,dist,randomDist,lastDist,D: extended;
lastX,lastY,MSP,W,TDist: integer;
T : LongWord;
sqrt2,sqrt3,sqrt5,PDist,maxStep,dModA,dModB,nModA,nModB: extended;
begin
MSP := mouseSpeed;
sqrt2:= sqrt(2);
sqrt3:= sqrt(3);
sqrt5:= sqrt(5);
TDist := distance(round(xs), round(ys), round(xe), round(ye));
if (TDist < 1) then
TDist := 1;
dModA := 0.88; //.80
dModB := 0.95; //.90
if (TDist > 220) then
begin
nModA := 0.08;
nModB := 0.04;
end else if (TDist <= 220) then
begin
nModA := 0.20;
nModB := 0.10;
end;
t := getSystemTime() + 5000;
repeat
if (getSystemTime() > t) then
break;
dist:= hypot(xs - xe, ys - ye);
wind:= minE(wind, dist);
if (dist < 1) then
dist := 1;
PDist := (dist/TDist);
if (PDist < 0.01) then
PDist := 0.01;
if double then
begin
if (PDist <= dModA) then
begin
D := (round((round(dist)*0.3))/5);
if (D < 20) then
D := 20;
end else if (PDist > dModA) then
begin
if (PDist < dModB) then
D := randomRange(5, 8)
else if (PDist >= dModB) then
D := randomRange(3, 4);
end;
end;
if (PDist >= nModA) then
begin
D := (round((round(dist)*0.3))/5);
if (D < 20) then
D := 20;
end else if (PDist < nModA) then
begin
if (PDist >= nModB) then
D := randomRange(5, 8)
else if (PDist < nModB) then
D := randomRange(3, 4);
end;
if (D <= round(dist)) then
maxStep := D
else
maxStep := round(dist);
if dist >= targetArea then
begin
windX:= windX / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
windY:= windY / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
end else
begin
windX:= windX / sqrt2;
windY:= windY / sqrt2;
end;
veloX:= veloX + windX;
veloY:= veloY + windY;
veloX:= veloX + gravity * (xe - xs) / dist;
veloY:= veloY + gravity * (ye - ys) / dist;
if (hypot(veloX, veloY) > maxStep) then
begin
randomDist:= maxStep / 2.0 + random(round(maxStep) div 2);
veloMag:= sqrt(veloX * veloX + veloY * veloY);
veloX:= (veloX / veloMag) * randomDist;
veloY:= (veloY / veloMag) * randomDist;
end;
lastX:= round(xs);
lastY:= round(ys);
xs:= xs + veloX;
ys:= ys + veloY;
if (lastX <> round(xs)) or (lastY <> round(ys)) then
moveMouse(round(xs), round(ys));
W := (random((round(100/MSP)))*6);
if (W < 5) then
W := 5;
if double then
if (PDist > dModA) then
W := round(W*2.5)
else
W := round(W*1.2);
wait(W);
lastdist:= dist;
until(hypot(xs - xe, ys - ye) < 1)
if (round(xe) <> round(xs)) or (round(ye) <> round(ys)) then
moveMouse(round(xe), round(ye));
mouseSpeed := MSP;
end;
(*
Mu is the mean, sigma is the standard deviation.
*)
procedure GaussWait(Mu,Sigma:Double; vmin:Double=30);
var t,g:Double;
begin
t := 2 * PI * Random();
g := mu + (sigma * Sqrt(-2 * Ln(Random()))) * Cos(t);
//WriteLn('Waiting: ', Round( MaxE(g,vmin) ),'ms');
Wait(Round(MaxE(g,vmin)));
end;
function randposition(Mu,Sigma,min,max:Double): Integer;
var t,g:Double;
begin
t := 2 * PI * Random();
g := mu + (sigma * Sqrt(-2 * Ln(Random()))) * Cos(t);
if (g<min) then
g := min;
if (g > max) then
g := max;
Result := Round(g);
end;
var startx, starty, endx, endy:integer;
procedure cMousemove(xpos,ypos:integer);
begin
endx := randposition(xpos,1,xpos-1*1,xpos+1*1);
endy := randposition(ypos,1,ypos-1*1,ypos+1*1);
GetMousePos(startx, starty);
//brakeWindMouse(startx, starty, endx, endy, randomRange(8,15), randomRange(1,8), randomRange(2,15),randomRange(10,20), 10.0,1);
brakeWindMouse(startx, starty, endx, endy, randomRange(8,20), randomRange(1,15), randomRange(2,10),randomRange(10,15), 10.0,1);
//wait(50);
end;
var q,w:integer;
var sx,sy:integer;
procedure cMouseMoveRock(xpos,ypos:integer);
begin
sx := xpos;
sy := ypos;
endx := randposition(xpos,4,xpos-4*4,xpos+4*4);
endy := randposition(ypos,4,ypos-4*4,ypos+4*4);
GetMousePos(startx, starty);
brakeWindMouse(startx, starty, endx, endy, randomRange(8,20), randomRange(1,15), randomRange(2,10),randomRange(10,15), 10.0,1);
//GaussWait(randomRange(1000,1100),100);
//brakeWindMouse(startx, starty, endx, endy, randomRange(8,15), randomRange(1,8), randomRange(2,15),randomRange(10,20), 10.0,1);
//wait(50);
end;
var
fileName,Bot_SavePath,writestring,writestring2: string;
tmpFile: integer;
function OpenReportFile(): integer;
var
fileName,Bot_SavePath: string;
begin
fileName := 'Test.txt'; // file name
if (fileExists(fileName)) then // checks if the file exists
result := appendFile(fileName)
else
result := createFile(fileName); // if it does not exist it creates it
end;
procedure writemousetofile(t1,t2:integer);
begin
// writeln('writing'); // writeln the text
tmpFile := OpenReportFile(); // refers to the function above and opens the file
writestring := 'click ';
writestring2 := tostring(t1)+','+toString(t2);
if (tmpFile >= 0) then
writeFileString(tmpFile, writestring+writestring2+#13#10); // writes the text and the time stamp
closeFile(tmpFile); // closes the file
//writeln('write done');
end;
var esc1:integer = 917;
var esc2:integer = 357;
var b1,b2,tempx,tempy:integer;
procedure cMouseclick();
begin
//if(FindColorTolerance(b1,b2,6913162 ,927, 354,927, 354,40)) then
// begin
// WriteLn('pressing esc');
// Keydown(27);
//Wait(50);
// Keyup(27);
// wait(200);
// end;
wait(randomRange(30,200));
WriteLn('clicked');
GetMousePos(tempx, tempy);
writemousetofile(tempx,tempy);
HoldMouse(tempx, tempy, mouse_Left);
ReleaseMouse(tempx, tempy, mouse_Left);
end;
//var q,w:integer;
procedure cMouseclickRock();
begin
GetMousePos(tempx, tempy);
wait(100);
WriteLn('finding');
//if(FindColorTolerance(q,w,50432,10, 34, 300, 60,40)) then
//begin
WriteLn('found');
writemousetofile(tempx,tempy);
HoldMouse(tempx, tempy, mouse_Left);
ReleaseMouse(tempx, tempy, mouse_Left);
//end;
//GaussWait(randomRange(800,1500),100);
end;
var finalx, finaly, fishfound,clickfishx,clickfishy,tempn,rocknumber,option: integer;
procedure clickfish();
begin
if(rocknumber<1)then
begin
//////////////
option := randomRange(1,10000);
if(option<2000) then
begin
cMouseMoveRock(365,267);
cMouseClickRock();
end
else if(option<5000) then
begin
cMouseMoveRock(345,243);
cMouseClickRock();
end
else
begin
cMouseMoveRock(386,234);
cMouseClickRock();
end;
/////////////////////
rocknumber := 1;
end
else
begin
///////////////
option := randomRange(1,10000);
if(option<2000) then
begin
cMouseMoveRock(697,290);
cMouseClickRock();
end
else if(option<5000) then
begin
cMouseMoveRock(725,248);
cMouseClickRock();
end
else
begin
cMouseMoveRock(747,275);
cMouseClickRock();
end;
///////////////////
rockNumber := 0;
end;
end;
var dropx,dropy:integer;
var x,y,counter,found,isfishing, fishtrynumber: integer;
begin
repeat
counter := 0 ;
repeat
counter := counter + 1 ;
wall:= BitmapFromString(2, 2, 'meJzb3VO3s6t2N5gEAC7OBws=');
writeln('trying to find');
GaussWait(randomRange(1000,2000),500);
If (FindBitmapToleranceIn(wall, X, Y,18,49,760,675,5)) Then //This will search the screen for the bitmap
begin
Y := Y + 3;
X := X + 3;
cMouseMoveRock(X,Y);
cMouseclickRock();
found := 1;
end
Else
Writeln('Could not find copper'); //Tells us we didn't find it
FreeBitmap(wall);
until (counter>2) ;
option := randomRange(1,10000);
if(option<2000) then
begin
cMouseMove(655,443);
cMouseClick();
end
else if(option<5000) then
begin
cMouseMove(655,447);
cMouseClick();
end
else
begin
cMouseMove(658,451);
cMouseClick();
end;
GaussWait(randomRange(300,400),100);
option := randomRange(1,10000);
if(option<2000) then
begin
cMouseMove(785,623);
cMouseClick();
end
else if(option<5000) then
begin
cMouseMove(786,627);
cMouseClick();
end
else
begin
cMouseMove(787,629);
cMouseClick();
end;
//GaussWait(randomRange(25000,30000),100);
until (1>2)
end;