Last active
September 6, 2017 19:05
-
-
Save bordeux/23948641b462a28be09f2bbe14c9f281 to your computer and use it in GitHub Desktop.
Cronox killer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var hehe = function(){ | |
function uniqueArray(minRange, maxRange, arrayLength) { | |
var arrayLength = (arrayLength) ? arrayLength : 10 | |
var minRange = (minRange !== undefined) ? minRange : 1 | |
var maxRange = (maxRange !== undefined) ? maxRange : 100 | |
var numberOfItemsInArray = 0 | |
var hash = {} | |
var array = [] | |
if ( arrayLength > (maxRange - minRange) ) throw new Error('Kurwa') | |
while(numberOfItemsInArray < arrayLength){ | |
var randomNumber = (Math.random() * (maxRange - minRange + 1) + minRange) << 0 | |
if (!hash[randomNumber]) { | |
hash[randomNumber] = true | |
array.push(randomNumber) | |
numberOfItemsInArray++ | |
} | |
} | |
return array | |
} | |
this.getToken = function (){ | |
return $.get('https://www.wykop.pl/gra/wycup/oponent/Cronox/') | |
.then(function(t){ | |
return t.match(/__token" value="([A-Za-z0-9\-]+)"/)[1]; | |
}); | |
} | |
this.send = function(token){ | |
$.post( "https://www.wykop.pl/gra/wycup/", { | |
"game" : { | |
"data" : { | |
"defence" : uniqueArray(0, 23, 5), | |
"attack" : uniqueArray(0, 23, 5), | |
}, | |
"user2" : "Cronox" | |
}, | |
"__token" : token | |
}); | |
}; | |
this.play = function(){ | |
this.getToken().then((token) => { | |
this.send(token); | |
}); | |
} | |
}; | |
test = new hehe(); | |
setInterval(() => { | |
test.play(); | |
}, 5000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment