Evades Helper

Nothing interesting. Just helper for evades.io.

当前为 2023-03-15 提交的版本,查看 最新版本

// ==UserScript==
// @name         Evades Helper
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Nothing interesting. Just helper for evades.io.
// @author       TimiT#3626
// @match        https://evades.io/
// @run-at       document-start
// @grant        none
// ==/UserScript==

/*



Этот код сделал на коленке за пару вечеров чисто по фану :P



*/

const DEVS = ["TimiT"]

let CLONE_ID = null
let WATCH_CLONE = false
let IGNORE_CLONE = true

let _obs = new MutationObserver((ev) => {
    let elem = Array.from(document.querySelectorAll('script')).filter(a=>a.type === "module" && a.src.match(/\/index\.[0-9a-f]{8}\.js/))[0];
    if (!elem) return;
    let src = elem.src

    elem.remove()

    let req = new XMLHttpRequest()
    req.open("GET", src, false)
    req.send()
    let code = req.response
    code = code
        //.replace("b[p].render(this.context,this.camera)}", "b[p].render(this.context,this.camera)};window.customRender(this.context,this.camera);")
        .replace("if(t.area.lighting<1)", "if(t.area.lighting<1 && !window.ignoreLighting)")
        // .replace("t.canvasScale=1/8,", "t.canvasScale=1/8,window.setRenderOptions(t),")
        // .replace("this.setState({leaderboardProps:this.initialLeaderboardProps()})", "this.setState({leaderboardProps:this.initialLeaderboardProps()});window.updateLeaderboard()")
        .replace('e.beginPath(),e.arc(this.x+t.x,this.y+t.y,this.radius,0,2*Math.PI,!1)','this.color.length==7&&(this.color+="BD"),e.beginPath(),e.arc(this.x+t.x,this.y+t.y,this.radius,0,2*Math.PI,!1)')
        .replace('this.isDeparted||','this.isDeparted&&(h="#0008"),')
        .replace("case\"focus\":case\"blur\":", "case\"focus\":case\"blur\":break;")


        .replace(/([a-zA-Z0-9\$]+)\=[a-zA-Z0-9\$]+\.FramePayload.decode\([a-zA-Z0-9]+\)/, (a,b) => {
            // sole.log("Replace: ", a)
            return a + ",_=window.work("+b+")"
        })
        .replace(/function ([a-zA-Z0-9\$]+)\([a-zA-Z0-9\$]+\)\{const [a-zA-Z0-9\$]+\=[a-zA-Z0-9\$]+\.ClientPayload.encode\(([a-zA-Z0-9]+)\)\.finish\(\);/, (a,b,c) => {
            // sole.log("Replace: ", a)
            return a + "window.inputWork(" + c + ");window.sendMsg=" + b + ";"
        })
        .replace("this.sequence=0,","this.sequence=0,window.user=this,")
        .replace(/this\.camera\.centerOn\(([a-z])\.self\.entity\)\,/, (a,b) => {
            return "window.setCameraObject(this.camera),this.camera.centerOn(window.setCameraPosition(" + b + ")),"
        })
        .replace(/.=(.)\.sender,.=.\.style,.=.\.text[;,][a-z\, ]+(.)=null,(.)=null,.=null;.+"private-message"\),/, (a,b,c,d) => {
            // console.log("Replace: ", a, b, c, d)
            return a + "[" + c + "," + d + "]=window.checkSender(" + b + ".sender);"
        })
        .replace(/const (.)=this\.props\.message;/, (a, b) => {
            return a + "window.currentMessage=" + b + ";"
        })

    document.body.appendChild(panel)
    document.body.appendChild(openPanel)

    /* document.addEventListener("mousemove", (ev) => {
        window.mousePosition.x = ev.pageX
        window.mousePosition.y = ev.pageY
    })

    canvas = document.getElementById("canvas")
    canvas.addEventListener("wheel", (ev) => {
        window.scaleGame(ev.deltaY < 0)
    }) */

    setInterval(() => {
        if (window.antiAFK && window.ws){
            window.ws.send(window.p.ClientPayload.encode({
                sequence: ++window.user.sequence,
                unblockedUsernames: [],
                keys: [],
                blockedUsernames: []
            }).finish())
        }
    }, 60000)

    let nScr = document.createElement("script")
    nScr.setAttribute("type", "module")
    nScr.innerHTML = code
    document.body.appendChild(nScr)

    console.log("Init")
    _obs.disconnect()

})
_obs.observe(document, {childList: true, subtree: true});

window.work = (msg) => {
    window.showMsg && console.log(msg)

    if (msg.area && window.ignoreLighting){
        msg.area.lighting = Math.max(msg.area.lighting, 0.5)
    }

    let abil = window.user.heroInfoCard.abilityTwo
    if (abil.abilityType === 52){
        if (CLONE_ID){
            if (IGNORE_CLONE){
                IGNORE_CLONE = false
            } else {
                if (abil.cooldown >= abil.totalCooldown - abil.totalCooldown / 14.5) WATCH_CLONE = !WATCH_CLONE
                console.log(abil.cooldown, abil.totalCooldown, CLONE_ID, WATCH_CLONE)
            }
        }
    }

    let e = msg.entities && window.user && window.user.self.entity && msg.entities.find(ee => {
        return ee.name === window.user.name && ee.id !== window.user.self.id
    })

    // console.log(e)
    if (e){
        CLONE_ID = e.id
    }

    if (WATCH_CLONE && msg.globalEntities){
        let p = msg.globalEntities.find(ee => {
            return ee.id === window.user.id
        })
//        if (p && !p.deathTimer && (p.x !== window.user.entity.x || p.y !== window.user.entity.y)){
//            console.log(p)
//            WATCH_CLONE = false
//        }
    }

    if (msg.area){
        CLONE_ID = undefined
        WATCH_CLONE = false;
        IGNORE_CLONE = true
    }
};
window.inputWork = (msg) => {
    window.showInput && console.log(msg)
//    if (msg.keys.find(k => k.keyEvent === 1 && k.keyType === 11)){
//        console.log("here")
//    }
}

addEventListener("keydown", (event) => {
    if (event.code === "End"){
        window.sendMsg({
            "sequence": ++window.user.sequence,
            "message": "/ff"
        })
        location.reload()
    }
});

window.ignoreLighting = true
window.freeCameraMove = false
window.focusCameraOn = undefined
window.autoBot = true
window.antiAFK = true
window.mousePosition = {x: 0, y: 0}
var canvas

window.updateLighting = (th) => {
    window.ignoreLighting = th.checked
}
window.updateFreeCameraMove = (th) => {
    window.freeCameraMove = th.checked
}
window.updateFreeScale = (th) => {
    window.freeScale = th.checked
}


window.setRenderOptions = (o) => {
    window.renderOptions = o
}
window.setCameraObject = (cam) => {
    if (!window.camera){
        window.camera = cam
    }
}

window.checkSender = (sender) => {
    if (DEVS.includes(sender)) return ["[E-H Dev]", "ehdev"];
    return [null,null];
}

window.setCameraPosition = (t) => {
    // console.log(t)
    let obj
//    if (window.focusCameraOn ?? window.focusCameraOn !== t.name){
//        let ent = Object.values(t.entities).find(e => e.showOnMap && e.name === window.focusCameraOn)
//        if (ent) obj = {x: ent.x, y: ent.y}
//    }
//    if (!obj){
        obj = {x: t.self.entity.x, y: t.self.entity.y}
        window.focusCameraOn = undefined
//    }

    if (WATCH_CLONE && CLONE_ID){
        let clone = t.entities[CLONE_ID]
        if (!clone){
            CLONE_ID = undefined
            WATCH_CLONE = false;
            IGNORE_CLONE = true
        } else {
            obj = {x: clone.x, y: clone.y}
        }
    }

    if (window.freeCameraMove){
        obj.x += (window.mousePosition.x - window.screen.width/2) * (window.startScale ? window.startScale[0] : 1)
        obj.y += (window.mousePosition.y - window.screen.height/2) * (window.startScale ? window.startScale[0] : 1)
    }
    return obj
}
/*
window.scaleGame = (wh) => {
    if (!window.freeScale) return;
    if (!window.startScale) { window.startScale = [
        1,
        window.camera.viewportSize.width,
        window.camera.viewportSize.height,
        canvas.width,
        canvas.height
    ] }
    let change = 0.05
    wh ? window.startScale[0] -= change : window.startScale[0] += change
    let scale = window.startScale[0]

    window.camera.viewportSize.width = window.startScale[1] * scale
    window.camera.viewportSize.height = window.startScale[2] * scale

    canvas.width = window.startScale[3] * scale
    canvas.height = window.startScale[4] * scale

    window.dispatchEvent(new Event('resize'));

    document.getElementById("free_scale").innerHTML = "Free scale (x" + window.startScale[0].toFixed(2) + ")"
}*/

/*
window.updateLeaderboard = () => {
	for (let names of [...document.getElementsByClassName('leaderboard-name')]) {
		names.onclick = event => {
			// window.client.openUcard(getAttrInParents(event.target,"ariaLabel"), [20,event.y], window.client.userlog);
            window.focusCameraOn = event.target.innerHTML.split(" ")[0]
		};
		names.style.cursor = "pointer";
	}
}
*/

let panel = document.createElement("div")
panel.style.background = "rgba(200, 200, 200, 0.8)"
panel.style.width = "400px"
panel.align = "center"
panel.style.position = "fixed"
panel.style.top = "50px"
panel.style.left = "calc(50% - 200px)"
panel.style.borderRadius = "10px"
panel.style.visibility = "hidden"
panel.style.padding = "20px"

panel.innerHTML = `
<h3>
  Evades helper v0.1
</h3>

<table>
  <tbody>
    <tr>
      <td>
      	<input type="checkbox" checked="` + window.ignoreLighting + `"onclick="window.updateLighting(this)"/>
      </td>
      <td>Enable light on all maps</td>
    </tr>
    <tr>
      <td>
      	<input type="checkbox" onclick="window.updateFreeCameraMove(this)" />
      </td>
      <td>Free camera move</td>
    </tr>
  </tbody>
</table>
<p>Developer [DISCORD]: <a id="developer" href="https://discordapp.com/users/998856554033987604">TimiT#3626</a></p>
<p>Уважаемые игроки, у меня есть желание сделать удобный скрипт, но нет идей :(<\p>
<p>Поэтому я буду рад получить от вас какие-либо предложения</p>
<br/>
<p>Переключение на клон виолы дает фокус камеры именно на клон<br/>
Свет в темных комнатах автоматически повышен
</p>
<style>
  #developer:link {
    color: black;
  }

  #developer:visited {
    color: black;
  }

  #developer:hover {
    color: #333333;
  }

  #developer:active {
    color: black;
  }
  .chat-message .ehdev {
    color: #ff4f00
  }
</style>
`

let openPanel = document.createElement("div")
openPanel.style.background = "rgba(100, 100, 100, 0.5)"
openPanel.style.borderRadius = "10px"
openPanel.style.bottom = "60px"
openPanel.style.right = "10px"
openPanel.style.position = "fixed"
openPanel.style.width = "40px"
openPanel.style.height = "40px"
openPanel.onclick = () => {
    panel.style.visibility = panel.style.visibility === "visible" ? "hidden" : "visible"
}