-
Notifications
You must be signed in to change notification settings - Fork 1
/
gc_bot_mouseMovement.txt
100 lines (72 loc) · 2.78 KB
/
gc_bot_mouseMovement.txt
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
sub(GetMin, $val1, $val2)
$min_return = $val1
if($val2 < $val1)
$min_return = $val2
end_if
END_SUB
sub(GetMax, $val1, $val2)
$max_return = $val1
if($val2 > $val1)
$max_return = $val2
end_if
END_SUB
sub(GetCP, $MSX, $MSY, $MFX, $MFY)
$cpXRes = 0
$cpYRes = 0
GetMin($MSX, $MFX)
$mouseMinX = $min_return
GetMax($MSX, $MFX)
$mouseMaxX = $max_return
GetMin($MSY, $MFY)
$mouseMinY = $min_return
GetMax($MSY, $MFY)
$mouseMaxY = $max_return
$rectBoundLUX = $mouseMinX // - ($mouseMaxX - $mouseMinX)
$rectBoundLUY = $mouseMinY // - ($mouseMaxY - $mouseMinY)
$rectBoundRDX = $mouseMaxX // + ($mouseMaxX - $mouseMinX)
$rectBoundRDY = $mouseMaxY // + ($mouseMaxY - $mouseMinY)
//$rectBoundLUX = 0
//$rectBoundLUY = 0
//$rectBoundRDX = 1919
//$rectBoundRDY = 1079
$cpXRes = rnd($rectBoundLUX, $rectBoundRDX)
$cpYRes = rnd($rectBoundLUY, $rectBoundRDY)
END_SUB
Sub(GetXBezier, $t)
$returned_x = (1-$t) * (1-$t) * (1-$t) * (1-$t) * $mouseStartX + 4 * $t * (1-$t) *(1-$t) *(1-$t) * $bezierCP_1X + 6 * $t * $t * (1-$t) * (1-$t) * $bezierCP_2X + 4 * $t * $t * $t * (1-$t) * $bezierCP_3X + $t * $t * $t * $t * $mouseFinishX
END_SUB
Sub(GetYBezier, $t)
$returned_y = (1-$t) * (1-$t) * (1-$t) * (1-$t) * $mouseStartY + 4 * $t * (1-$t) *(1-$t) *(1-$t) * $bezierCP_1Y + 6 * $t * $t * (1-$t) * (1-$t) * $bezierCP_2Y + 4 * $t * $t * $t * (1-$t) * $bezierCP_3Y + $t * $t * $t * $t * $mouseFinishY
END_SUB
sub(MoveTo, $moveToX, $moveToY)
$mouseStartX = $last_mouse_posX
$mouseStartY = $last_mouse_posY
$mouseFinishX = $moveToX
$mouseFinishY = $moveToY
GetCP($mouseStartX, $mouseStartY, $mouseFinishX, $mouseFinishY)
$bezierCP_1X = $cpXRes
$bezierCP_1Y = $cpYRes
GetCP($mouseStartX, $mouseStartY, $mouseFinishX, $mouseFinishY)
$bezierCP_2X = $cpXRes
$bezierCP_2Y = $cpYRes
GetCP($mouseStartX, $mouseStartY, $mouseFinishX, $mouseFinishY)
$bezierCP_3X = $cpXRes
$bezierCP_3Y = $cpYRes
$mouseStepsMove = int(sqrt(dist($mouseStartX, $mouseStartY, $mouseFinishX, $mouseFinishY) / 3))
//$mouseStepsMove = int(dist($mouseStartX, $mouseStartY, $mouseFinishX, $mouseFinishY) / 20)
if($mouseStepsMove ! 0)
for($i = 0, $i <= $mouseStepsMove, 1)
$movementProgress = 1 - ((1 - $i/$mouseStepsMove) * (1 - $i/$mouseStepsMove))
GetXBezier($movementProgress)
GetYBezier($movementProgress)
GetMin($returned_x, 1919)
GetMax($min_return, 0)
$currMoveX = int($max_return)
GetMin($returned_y, 1079)
GetMax($min_return, 0)
$currMoveY = int($max_return)
move($currMoveX, $currMoveY)
//waitms(rnd(5,10))
end_cyc
end_if
END_SUB