Skip to content

Instantly share code, notes, and snippets.

@brunoannunciato
Created May 4, 2025 17:12
Show Gist options
  • Select an option

  • Save brunoannunciato/9affdcaa6bc604162f55b8139b2eb551 to your computer and use it in GitHub Desktop.

Select an option

Save brunoannunciato/9affdcaa6bc604162f55b8139b2eb551 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 2025-04-20
// @description try to take over the world!
// @author You
// @match https://www.delugerpg.com/map/overworld14
// @icon https://www.google.com/s2/favicons?sz=64&domain=delugerpg.com
// @grant none
// ==/UserScript==
const getCurrentStep = () => {
let step
const currentUrl = location.href
if (currentUrl.includes("delugerpg.com/map")) {
step = "map"
return step
}
if (currentUrl.includes("delugerpg.com/catch")) {
const button = document.querySelector(".btn-battle_action")
const buttonContent = button?.getAttribute("name")
if (!buttonContent || document.querySelector(".notify_error")) {
window.location.href = '/map'
runBot()
}
if (buttonContent === "Start Battle") {
step = "choosePokemon"
}
if (buttonContent === "attack_") {
step = "battle"
}
if (buttonContent === "continue_") {
step = "battleFinished"
}
return step
}
}
const steps = {
map: () => {
const controls = {
left: document.querySelector("#dr-e"),
right: document.querySelector("#dr-w")
}
let lastButtonClicked = 'left'
setInterval(() => {
const direction = lastButtonClicked === 'left' ? 'right' : 'left'
const catchButton = document.querySelector("#catchmon")
if (catchButton) {
catchButton.click()
}
const buttonToClick = controls[direction]
controls[direction].click()
lastButtonClicked = direction
}, 1000)
runBot()
},
choosePokemon: () => {
const button = document.querySelector(".btn-battle_action")
button.click()
runBot()
},
battle: () => {
const attack = document.querySelector("#attkopt2")
const button = document.querySelector(".btn-battle_action")
const buttonContent = button.getAttribute("name")
if (buttonContent !== "attack_" || document.querySelector(".notify_error")) {
location.href = "/map"
runBot()
return
}
attack.setAttribute("checked", "checked")
button.click()
runBot()
},
battleFinished: () => {
const button = document.querySelector(".btn-battle_action")
button.click()
runBot()
}
}
const runBot = () => {
setTimeout(() => {
const headings = document.querySelectorAll("h2")
const showPoke = document.querySelector("#show-poke div")
headings.forEach(h2 => {
if (h2?.textContent === "This is to check if you are a human or a bot") {
location.href = "/map"
return
}
})
if (showPoke?.textContent === '!! Error: Please refresh this page. !!') {
location.href = "/map"
return
}
const step = getCurrentStep()
steps[step]()
}, 1000)
}
(function() {
'use strict';
runBot()
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment