Skip to content

Instantly share code, notes, and snippets.

@brunos3d
Last active May 20, 2021 19:57
Show Gist options
  • Save brunos3d/5b92b82b83b975edd07cb1e5e292259c to your computer and use it in GitHub Desktop.
Save brunos3d/5b92b82b83b975edd07cb1e5e292259c to your computer and use it in GitHub Desktop.
Simple script that plays Kill the King automagically. https://codepen.io/jcoulterdesign/full/MWeZWxQ
document.querySelector('div.game_intro__inner.start > p').click();
setTimeout(() => {
document.querySelector('div.game_intro__inner.end > div > p.continue').click();
var lastXp = 0;
function loop() {
var stage = parseInt(document.querySelector('div.ui > div > div.ui_progress__stage').innerText.slice(6));
try {
var xp = parseInt(document.querySelector('div.game_inner__footer > div.resources > div').innerText.replace('xp', ''));
for (var idx = 1; idx <= 3; idx++) document.querySelector(`div.upgrades > div:nth-child(${idx}) > div`).click();
if (lastXp <= 0) document.querySelector('div.nextPhase').click();
lastXp = xp;
} catch {
document.body.onkeyup({ keyCode: 32 });
}
setTimeout(loop, stage === 9 ? 350 : 1);
}
loop();
}, 5000);
@brunos3d
Copy link
Author

brunos3d commented Dec 9, 2020

gif

Kill the King Beat Script

๐Ÿค–๐Ÿ‘พ๐Ÿ‘‘

Simple script that plays Kill the King automagically.

Instructions

  1. Just go to the full game view https://codepen.io/jcoulterdesign/full/MWeZWxQ
  2. Open your browser console (Option + โŒ˜ + J or Shift + CTRL + J)
  3. Select the context script like as showed bellow
    image
  4. Paste the script on the console
  5. Press Enter and just watch

Extras

Some extra scripts

Autoclick only

setInterval(()=>document.body.onkeyup({keyCode: 32}), 300);

Infinite battle (bug)

document.querySelector('div.game_intro__inner.start > p').click();
setTimeout(() => {
    document.querySelector('div.game_intro__inner.end > div > p.continue').click();
    var lastXp = 0;
    setInterval(() => {
        try {
            var xp = parseInt(
                document.querySelector('#app > div > div.game_inner > div.game_inner__footer > div.resources > div').innerText.replace('xp', '')
            );

            for (var idx = 1; idx <= 3; idx++) document.querySelector(`div.upgrades > div:nth-child(${idx}) > div`).click();

            if (lastXp <= 0) document.querySelector('div.nextPhase').click();

            lastXp = xp;
        } catch {
            document.body.onkeyup({ keyCode: 32 });
        }
    }, 1);
}, 5000);

@mukaschultze
Copy link

easy peasy lemon squeezy

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment