Last active
March 4, 2021 16:46
-
-
Save lpj145/21f2fdd0a457ee1f6a8be41a4aa4f12b to your computer and use it in GitHub Desktop.
Cheat for pokemon pwa game
This file contains hidden or 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
// See href: https://pokemon-match.netlify.app/#/ | |
// Open browser console, copy past it, have fun :) | |
(function (document){ | |
const btn = document.createElement('button') | |
btn.className = 'v-btn v-size--default' | |
btn.innerText = 'Perfect Match!' | |
btn.style.position = 'fixed' | |
btn.style.bottom = '120px' | |
btn.style.left = '50px' | |
btn.style.border = '2px solid #898989' | |
btn.style.backgroundColor = 'antiquewhite' | |
const insaneBtn = document.createElement('button') | |
insaneBtn.className = 'v-btn v-size--default' | |
insaneBtn.innerText = 'Insane mode!' | |
insaneBtn.style.position = 'fixed' | |
insaneBtn.style.bottom = '50px' | |
insaneBtn.style.left = '50px' | |
insaneBtn.style.border = '2px solid #898989' | |
insaneBtn.style.backgroundColor = 'antiquewhite' | |
let intervalId = 0 | |
const toggleMode = ({ target }, run, exit) => { | |
if ([undefined, 'false'].includes(target.dataset.toggle)) { | |
target.dataset.toggle = true | |
return run() | |
} | |
target.dataset.toggle = false | |
return exit() | |
} | |
insaneBtn.onclick = (e) => toggleMode(e, () => { | |
intervalId = setInterval(() => { | |
matchPokemon() | |
}, 150) | |
}, () => { | |
clearInterval(intervalId) | |
}) | |
const normalizePokemonName = (pokemonName) => { | |
return pokemonName | |
.toLowerCase() | |
.replace('\'', '') | |
.replace('-', '') | |
.replace('.', '') | |
.replace(' ', '') | |
.match(/([A-z])/g).join('') | |
} | |
const compareInsentivePokemonsName = (pokemonName, divPokemonName) => { | |
return normalizePokemonName(pokemonName) === normalizePokemonName(divPokemonName) | |
} | |
const clickPokemonNameDiv = (pokemonName) => { | |
document.querySelectorAll(".v-card.v-card--link .v-card__title.headline") | |
.forEach((div) => { | |
if (compareInsentivePokemonsName(pokemonName, div.innerText)) { | |
div.click() | |
} | |
}) | |
} | |
const matchPokemon = () => { | |
const pokemonName = document.querySelector(".pokemon-card div.v-image__image.v-image__image--cover").style.backgroundImage.split(/\//g).slice(-1)[0].split('.')[0] | |
clickPokemonNameDiv(pokemonName) | |
} | |
btn.onclick = matchPokemon | |
document.body.appendChild(btn) | |
document.body.appendChild(insaneBtn) | |
})(document) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment