// ==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 { 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 = $( '
' ); const $titleautox = $('

AutoX

'); const $authorautox = $('

Adriks

'); const $trigger = $('ON/OFF:
'); const $minlvl = $('
'); const $maxlvl = $('
'); const $follow = $('Follow:
'); const $autof = $('AutoF:
'); const $czymabic = $('Czy ma bić:
'); const $bicklan = $('Klan:
'); const $bicznaj = $('Znaj:
'); const $bicsoj = $('Soj.Klan.:
'); const $backChecker = $('PowrĂłt na
mapę i kordy

ON/OFF:

'); const $herox = $(''); const $heroy = $('
'); const $idmapypowrotu = $(''); const $buttonxy = $('
Get X/Y:
'); const $buttonmapid = $('
Get MapId:
'); $("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 = $( '
' ); $("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', '
AutoX
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();