Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Autodobijanie NI
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description try to take over the world!
- // @author You
- // @match http://tempest.margonem.pl/
- // @grant none
- // ==/UserScript==
- (Engine => {
- function algorytm()
- {
- var targets = [];
- if(Engine.map.d.pvp == 2 && document.getElementById('trigger').checked)
- {
- var minLvl = document.getElementById('minLvl').value;
- var maxLvl = document.getElementById('maxLvl').value;
- var backX = document.getElementById('backX').value;
- var backY = document.getElementById('backY').value;
- if(minLvl == ''){minLvl = 0}
- if(maxLvl == ''){maxLvl = 300}
- var eee = Engine.others.getDrawableList().filter(obj => {return obj.d});
- var others = eee.filter(obj => {return (obj.d.relation == 'en' || obj.d.relation == 'cl-en' || obj.d.relation == '') && obj.d.lvl > minLvl && obj.d.lvl < maxLvl});
- for(var i in others)
- {
- var emo = others[i].onSelfEmoList[0];
- if(emo == undefined){
- targets.push({id: others[i].d.id, x: others[i].d.x, y: others[i].d.y, distance: Math.abs(Engine.hero.d.x - others[i].d.x) + Math.abs(Engine.hero.d.y - others[i].d.y)})
- }
- else if(emo.name != 'battle' && emo.name != 'pvpprotected'){
- targets.push({id: others[i].d.id, x: others[i].d.x, y: others[i].d.y, distance: Math.abs(Engine.hero.d.x - others[i].d.x) + Math.abs(Engine.hero.d.y - others[i].d.y)})
- }
- }
- if(targets != '')
- {
- targets = targets.sort((a, b) => (a.distance > b.distance) ? 1 : -1);
- if(targets[0].distance > 2){Engine.hero.autoGoTo({x: targets[0].x, y: targets[0].y})}
- else{window._g('fight&a=attack&id='+targets[0].id)}
- }
- else if(document.getElementById('backChecker').checked && backX != Engine.hero.d.x && backX != '' && backY != Engine.hero.d.y && backY != '')
- {
- Engine.hero.autoGoTo({x: eval(backX), y: eval(backY)});
- }
- }
- setTimeout(algorytm, 50);
- }
- function css()
- {
- const $container2 = $( '<div id="container2"></div>' );
- const $trigger = $('<input type="checkbox" id="trigger">ON/OFF</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" value="301"></br>');
- const $backChecker = $('<input type="checkbox" id="backChecker">');
- const $backX = $('<input type="number" class="backInput" id="backX" placeholder="X">');
- const $backY = $('<input type="number" class="backInput" id="backY" placeholder="Y"></br>');
- const $backButton = $('<button id="backButton">Kordy</button>');
- $("body").append($container2);
- $("#container2").append($trigger, $minLvl, $maxLvl, $backChecker, $backX, $backY, $backButton);
- $( "#container2" ).css({
- 'position': 'absolute',
- 'text-align': 'center',
- 'width': '85px',
- 'height': '120px',
- 'background': '#474747',
- 'font-family': 'Segoe UI',
- 'top': '80.5%',
- 'left': '95.3%',
- 'border-radius': '3px',
- 'border': '1px solid black',
- 'z-index': '999'
- });
- $( "#backButton" ).css({
- 'margin-top': '5px',
- 'height': '18px',
- 'width': '48px',
- 'background':'#918d83'
- });
- $( ".input" ).css({
- 'width': '50px'
- });
- $( ".backInput" ).css({
- 'margin-top': '6px',
- 'height': '15px',
- 'width': '19px'
- });
- $( "#backButton" ).on( 'click', function() {
- document.getElementById('backX').value = Engine.hero.d.x;
- document.getElementById('backY').value = Engine.hero.d.y;
- });
- }
- window.onload = css();
- window.onload = algorytm();
- })(window.Engine)
Add Comment
Please, Sign In to add comment