avatar
Untitled

Guest 158 13th Oct, 2024

MARKUP 16.27 KB
                                           
                         // ==UserScript==
// @name         AutoX SI
// @version      2.0
// @author       Jakis cwel
// @match        https://*.margonem.pl/
// ==/UserScript==


var isNull, minilvl, maxilvl,bohx,bohy,idmapypowrot,icontype;

hero.hujRusz=function(a,b){
    if(this.isBlockedSearchPath())return this.blockedInfoSearchPath();
    var c=map.nodes.getNode(hero.x,hero.y),d=map.nodes.getNode(a,b);
    c.hasSameGroup(d)||(map.nodes.clearAllNodes(),c.setScore(0,map.hce8(d,c)),d=map.nodeSetLoop(d,c,map.findStep)),map.nodes.clearAllNodes(),c.setScore(0,map.hce(c,d)),map.nodeSetLoop(c,d,map.mapStep);
    var e=d;for(road=[];null!==e&&e.id!=c.id;)road.push({x:e.x,y:e.y}),e=e.from;
    null!==e&&road.push({x:e.x,y:e.y}),1<road.length&&null==g.playerCatcher.follow&&$("#target").stop().css({left:32*road[0].x,top:32*road[0].y,display:"block",opacity:1}).fadeOut(1e3)
};

const attackNearbyOrFollow = player => {
    if (   Math.abs(hero.x - player.x) <= 2
        && Math.abs(hero.y - player.y) <= 2) {
        return _g(`fight&a=attack&id=${player.id}`);
    } else if (document.getElementById('follow').checked) {
        return hero.hujRusz(player.x, player.y);
    }
}

const checkIfShouldAttack = player => {
    if(g.dead || g.battle) {
        return false;
    }
    if (Math.sqrt(Math.pow(hero.x - player.x, 2) + Math.pow(hero.y - player.y, 2)) > 15) {
        return false;
    }
    if ( (player.relation == 2 && bicznaj.checked==false)
        || (player.relation == 4 && bicklan.checked==false)
        || (player.relation == 5 && bicsoj.checked==false)) {
        return false;
    }
    if (   player.lvl > maxilvl
        || player.lvl < minilvl) {
        return false;
    }
    return true;
}

const old = newOther;
newOther = players => {
    if (map.pvp !== config.mapStatus) {
        return old(players);
    }
    for (const id in players) {
        if (!player || !players[id].x || !g.other[id]) {
            continue;
        }
        if (checkIfShouldAttack(g.other[id])) {
            attackNearbyOrFollow(g.other[id]);
        }
    }
    return old(players);
}
    function css()
    {
		if(!localStorage.getItem(`autoxkordyokna`)){
        let ihfyasfj = {
            x: 200,
            y: 140
        }
        localStorage.setItem(`autoxkordyokna`, JSON.stringify(ihfyasfj));
		};
		const autoxkordyokna = JSON.parse(localStorage.getItem(`autoxkordyokna`));

		if(!localStorage.getItem(`autoxkordyminiokna`)){
        let ihfyasfj = {
            x: 200,
            y: 140
        }
        localStorage.setItem(`autoxkordyminiokna`, JSON.stringify(ihfyasfj));
		};
		const autoxkordyminiokna = JSON.parse(localStorage.getItem(`autoxkordyminiokna`));


        const $container2 = $( '<div id="container2"></div>' );
		const $titleautox = $('<p class = "tiltle">AutoX</p>');
		const $authorautox = $('<p class = "authorx">Adriks</p>');
        const $trigger = $('<span class = "tekst3">ON/OFF:</span><input type="checkbox" class="check" id="trigger"></br>');
        const $minlvl = $('<input type="text" class="input" id="minlvl" autocomplete="off" placeholder="Min lvl"></br>');
        const $maxlvl = $('<input type="text" class="input" id="maxlvl" autocomplete="off" placeholder="Max lvl"></br>');
        const $follow = $('<span class = "tekst3">Follow:</span><input type="checkbox" class="check" id="follow"></br>');
		const $autof = $('<span class = "tekst3">AutoF:</span><input type="checkbox" class="check" id="autof"></br>');
        const $czymabic = $('<span class = "tekst3">Czy ma bić:</br>');
        const $bicklan = $('<span class = "tekst3">Klan:</span><input type="checkbox" class="check" id="bicklan"></br>');
        const $bicznaj = $('<span class = "tekst3">Znaj:</span><input type="checkbox" class="check" id="bicznaj"></br>');
        const $bicsoj = $('<span class = "tekst3">Soj.Klan.:</span><input type="checkbox" class="check" id="bicsoj"></br>');
        const $backChecker = $('<span class = "tekst">Powrót na</br>mapę i kordy</span><span class = "tekst3"></br>ON/OFF:</span><input type="checkbox" class="check" id="backChecker"></br>');
        const $herox = $('<input type="text" class="backInput" id="herox" placeholder="X">');
        const $heroy = $('<input type="text" class="backInput" id="heroy" placeholder="Y"></br>');
		const $idmapypowrotu = $('<input type="text" class="input" id="idmapypowrotu" placeholder="Id mapy">');
		const $buttonxy = $('<span class = "tekst3"></br>Get X/Y: </span><input type="button" id="buttonxy"</br>');
		const $buttonmapid = $('<span class = "tekst3"></br>Get MapId: </span><input type="button" id="buttonmapid"</br>');

        $("body").append($container2);
        $("#container2").append($titleautox,$authorautox,$trigger, $minlvl, $maxlvl,$follow,$autof,$czymabic,$bicklan,$bicznaj,$bicsoj, $backChecker, $herox, $heroy,$idmapypowrotu,$buttonxy,$buttonmapid);

        $( "#container2" ).css({
            'position': 'absolute',
            'text-align': 'center',
            'width': 'auto',
            'height': 'auto',
			'box-shadow': '0 0 15px #04387c, 0 0 15px #04387c',
            'background': '#032c63',
			'color': '#529bfa',
            'top': `${autoxkordyokna.y}px`,
            'left': `${autoxkordyokna.x}px`,
            'border-radius': '3px',
            'border': '1px solid black',
            'z-index': '999'
        });

        $( ".tiltle").css({
			'font-size': '25px',
			'color': '#ff9933',
            'position': 'relative'
		});

         $( ".check").css({
			'background': '#b3e8ff',
            'position': 'relative'
		});

		$( ".tekst").css({
			'font-size': '15px',
			'color': '#b3daff',
            'position': 'relative'
		});

        $( ".tekst3").css({
			'font-size': '15px',
			'color': '#00b3ff',
            'position': 'relative'
		});

		$( ".authorx").css({
			'font-size': '10px',
			'color': 'gold',
            'position': 'relative'
		});

        $( ".input" ).css({
            'width': '50px',
            'background': '#b3e8ff',
            'position': 'relative',
            'color':'#8000ff',
			'text-align': 'center'
        });

        $( ".backInput" ).css({
            'background': '#b3e8ff',
            'margin-top': '6px',
            'height': '15px',
            'width': '19px',
            'position': 'relative',
            'color':'#8000ff',
			'text-align': 'center'
        });

        $(container2).draggable({
        stop: () => {
            let ihfyasfj = {
                x: parseInt(container2.style.left),
                y: parseInt(container2.style.top)
            }
            localStorage.setItem(`autoxkordyokna`, JSON.stringify(ihfyasfj));
        }
		});

		const $containerminiicon = $( '<div id="containerminiicon"></div>' );
		$("body").append($containerminiicon);
		$( "#containerminiicon" ).css({
            'position': 'absolute',
            'width': '32px',
            'height': '32px',
			'tip': 'AutoX',
            'backgroundImage': `url('https://i.imgur.com/z0FtZm3.gif')`,
            'top': `${autoxkordyminiokna.y}px`,
            'left': `${autoxkordyminiokna.x}px`,
            'z-index': '310'
        });
		containerminiicon.setAttribute('tip', '<center><b>AutoX</b></center> Kliknij aby pokazać okno');

		$(containerminiicon).draggable({
        stop: () => {
            let ihfyasfj = {
                x: parseInt(containerminiicon.style.left),
                y: parseInt(containerminiicon.style.top)
            }
            localStorage.setItem(`autoxkordyminiokna`, JSON.stringify(ihfyasfj));
        }
		});

		container2.addEventListener('contextmenu', (e)=>{
			e.preventDefault();
			icontype = 1;
			container2.style.display = 'none';
			localStorage.setItem('adriksautoxikonka', icontype);
		});

		containerminiicon.addEventListener('contextmenu', (e)=>{
			e.preventDefault();
			if(icontype == 1){
				container2.style.display = 'block';
				icontype = 0;
			}
			else if(icontype == 0){
				container2.style.display = 'none';
				icontype = 1;
			}
			localStorage.setItem('adriksautoxikonka', icontype);
		});

		if(!localStorage.getItem('adriksautoxikonka')){
        let ihfyasfj = 0;
        localStorage.setItem(`adriksautoxikonka`, ihfyasfj);
		};

		icontype = localStorage.getItem('adriksautoxikonka');

		if (icontype == 0) {
        container2.style.display = 'block';
		}
		if (icontype == 1) {
        container2.style.display = 'none';
		}

		if(localStorage.getItem('wloncznikautox') == 'on'){
        trigger.checked=true;
		}else{
        trigger.checked=false;
		}

		    trigger.addEventListener('change',()=>{
        if(trigger.checked==true){
            message('AutoX On');
            localStorage.setItem('wloncznikautox','on');
        }else{
            message('AutoX Off');
            localStorage.setItem('wloncznikautox','off');
        }
		});

		if(localStorage.getItem('wloncznikfollowautox') == 'on'){
        follow.checked=true;
		}else{
        follow.checked=false;
		}

		    follow.addEventListener('change',()=>{
        if(follow.checked==true){
            message('Follow On');
            localStorage.setItem('wloncznikfollowautox','on');
        }else{
            message('Follow Off');
            localStorage.setItem('wloncznikfollowautox','off');
        }
		});

		if(localStorage.getItem('wloncznikautofautox') == 'on'){
        autof.checked=true;
		}else{
        autof.checked=false;
		}

		    autof.addEventListener('change',()=>{
        if(autof.checked==true){
            message('AutoF On');
            localStorage.setItem('wloncznikautofautox','on');
        }else{
            message('AutoF Off');
            localStorage.setItem('wloncznikautofautox','off');
        }
		});

		if(localStorage.getItem('wloncznikbicklanautox') == 'on'){
        bicklan.checked=true;
		}else{
        bicklan.checked=false;
		}

		    bicklan.addEventListener('change',()=>{
        if(bicklan.checked==true){
            localStorage.setItem('wloncznikbicklanautox','on');
        }else{
            localStorage.setItem('wloncznikbicklanautox','off');
        }
		});

		if(localStorage.getItem('wloncznikbicznajautox') == 'on'){
        bicznaj.checked=true;
		}else{
        bicznaj.checked=false;
		}

		    bicznaj.addEventListener('change',()=>{
        if(bicznaj.checked==true){
            localStorage.setItem('wloncznikbicznajautox','on');
        }else{
            localStorage.setItem('wloncznikbicznajautox','off');
        }
		});

		if(localStorage.getItem('wloncznikbicsojautox') == 'on'){
        bicsoj.checked=true;
		}else{
        bicsoj.checked=false;
		}

		    bicsoj.addEventListener('change',()=>{
        if(bicsoj.checked==true){
            localStorage.setItem('wloncznikbicsojautox','on');
        }else{
            localStorage.setItem('wloncznikbicsojautox','off');
        }
		});

        if(localStorage.getItem('wloncznikbackCheckerautox') == 'on'){
        backChecker.checked=true;
		}else{
        backChecker.checked=false;
		}

        backChecker.addEventListener('change',()=>{
        if(backChecker.checked==true){
            message('PowrĂłt On');
            localStorage.setItem('wloncznikbackCheckerautox','on');
        }else{
            message('PowrĂłt Off');
            localStorage.setItem('wloncznikbackCheckerautox','off');
        }
		});

        document.getElementById('minlvl').value = localStorage.getItem('autoxadriksminlvl');
		minilvl = document.getElementById('minlvl').value;
		if(minilvl == ''){minilvl = 0};

		document.getElementById('maxlvl').value = localStorage.getItem('autoxadriksmaxlvl');
		maxilvl = document.getElementById('maxlvl').value;
		if(maxilvl == ''){maxilvl = 300};

		minlvl.addEventListener('change', ()=>{
            minilvl = document.getElementById('minlvl').value;
			localStorage.setItem('autoxadriksminlvl',minilvl);
		});

		maxlvl.addEventListener('change', ()=>{
            maxilvl = document.getElementById('maxlvl').value;
			localStorage.setItem('autoxadriksmaxlvl',maxilvl);
		});

		document.getElementById('herox').value = localStorage.getItem('autoxadriksherox');
		bohx = document.getElementById('herox').value;

		document.getElementById('heroy').value = localStorage.getItem('autoxadriksheroy');
		bohy = document.getElementById('heroy').value;

		herox.addEventListener('change', ()=>{
            bohx = document.getElementById('herox').value;
			localStorage.setItem('autoxadriksherox',bohx);
		});

		heroy.addEventListener('change', ()=>{
            bohy = document.getElementById('heroy').value;
			localStorage.setItem('autoxadriksheroy',bohy);
		});

		buttonxy.addEventListener('click', ()=>{
			document.getElementById('herox').value=hero.x;
			bohx = document.getElementById('herox').value;
			localStorage.setItem('autoxadriksherox',bohx);
			document.getElementById('heroy').value=hero.y;
			bohy = document.getElementById('heroy').value;
			localStorage.setItem('autoxadriksheroy',bohy);
		});

		document.getElementById('idmapypowrotu').value = localStorage.getItem('autoxadriksidmapypowrotu');
		idmapypowrot = document.getElementById('idmapypowrotu').value;

		idmapypowrotu.addEventListener('change', ()=>{
            idmapypowrot = document.getElementById('idmapypowrotu').value;
			localStorage.setItem('autoxadriksidmapypowrotu',idmapypowrot);
		});

		buttonmapid.addEventListener('click', ()=>{
			document.getElementById('idmapypowrotu').value=map.id;
            idmapypowrot = document.getElementById('idmapypowrotu').value;
			localStorage.setItem('autoxadriksidmapypowrotu',idmapypowrot);
		});

setInterval(fun,200);
    }

function fun() {
	if(autof.checked==true){
            if($("#autobattleButton").css("display") == "block"){
                $("#autobattleButton").click()
            };
	}

    if (map.pvp == 2 && (document.getElementById('trigger').checked)) {

            for (const player of Object.values(g.other)) {
                if (!checkIfShouldAttack(player)) {
                    continue;
                }

                attackNearbyOrFollow(player);
            }
            isNull = player ? Object.values( g.other ).every( val => val == null ) : true;
            if(isNull && document.getElementById('backChecker').checked){
				if(map.id==idmapypowrot){
					hero.hujRusz(eval(bohx),eval(bohy));
				}else{
					let cakskdak = g.gwIds[idmapypowrotu].split(`.`);
					hero.hujRusz(eval(cakskdak[0]),eval(cakskdak[1]));
				}
            }
    }
};

window.onload = css();
                      
                                       
To share this paste please copy this url and send to your friends
RAW Paste Data
Recent Pastes
Ta strona używa plików cookie w celu usprawnienia i ułatwienia dostępu do serwisu oraz prowadzenia danych statystycznych. Dalsze korzystanie z tej witryny oznacza akceptację tego stanu rzeczy.
Wykorzystywanie plików Cookie
Jak wyłączyć cookies?
ROZUMIEM