Skip to content

Instantly share code, notes, and snippets.

@and3rson
Last active November 13, 2017 08:56
Show Gist options
  • Save and3rson/e2b013a5e4526461cee07c838c800b58 to your computer and use it in GitHub Desktop.
Save and3rson/e2b013a5e4526461cee07c838c800b58 to your computer and use it in GitHub Desktop.
Hack for zty.pe
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