Last active
November 13, 2017 08:56
-
-
Save and3rson/e2b013a5e4526461cee07c838c800b58 to your computer and use it in GitHub Desktop.
Hack for zty.pe
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
const getWords = () => Object.keys(ig.game.targets).map( | |
key => (ig.game.targets.hasOwnProperty(key) && ig.game.targets[key].length && ig.game.targets[key][0].health) ? ig.game.targets[key][0].word : null | |
).filter(x => x); | |
const delayed = (fn) => new Promise((resolve, reject) => { | |
setTimeout(() => { | |
fn(); | |
resolve(); | |
}, 33); | |
}); | |
const process = () => { | |
let chain = Promise.resolve(); | |
getWords().forEach( | |
word => word.split('').forEach( | |
letter => chain = chain.then(() => delayed(() => ig.game.shoot(letter))) | |
) | |
); | |
chain.then(() => setTimeout(process, 25)); | |
}; | |
process(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment