-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzerg_push_attacker.js
35 lines (32 loc) · 1.11 KB
/
zerg_push_attacker.js
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
// Set true for stop attack
var stopAttack = false;
// Set duration = 10 minutes
var duration = 10 * 60 * 1000;
(function(duration){
var attackFrequency = 200, //milliseconds
startTime = Date.now(),
stopTime = startTime + duration,
attackCount = 0;
var dispatchMouseEvent = function(target, var_args) {
var e = document.createEvent("MouseEvents");
e.initEvent.apply(e, Array.prototype.slice.call(arguments, 1));
target.dispatchEvent(e);
};
var attackZergs = function(){
var zergs = document.getElementsByClassName('zr_zergling_container');
if (zergs.length > 0) {
for (var i in zergs){
if (zergs.hasOwnProperty(i) && i !== 'length'){
dispatchMouseEvent(zergs[i], 'mousedown', true, true);
attackCount += 1;
}
}
}
if (!stopAttack && stopTime > Date.now()) {
setTimeout(attackZergs, attackFrequency);
}else {
console.log('Your attack count:' + attackCount);
}
};
attackZergs();
})(duration);