Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name AUTOX SI
- // @namespace http://tampermonkey.net/
- // @version 2.3
- // @description Skrypt automatycznie biega za graczem, wraca na kordy po zabiciu itd.
- // @author Padonim
- // @match https://fobos.margonem.pl/
- // @start-at document-idle
- // @grant GM_setValue
- // @grant GM_getValue
- // ==/UserScript==
- (async (window, sleep) => {
- const initCSS = () => {
- const $container2 = $('<div id="p4d0k1ll"></div>').css({
- 'width':'120px',
- 'position':'absolute',
- 'z-index':'999',
- 'background':'rgba(15, 15, 15, 0.85)',
- 'border':'1px solid orange',
- 'color':'white'
- });
- const $head = $('<div id="p4d0k1ll-head"></div>').css({
- 'width':'120px',
- 'height':'25px',
- });
- const $body = $('<div id="p4d0k1ll-body"></div>').css({
- 'width':'120px',
- 'height':'40px',
- 'font-size':'8px'
- })
- const $settings_input = $('<div id="p4d0k1ll-settings">⚙️</div>').css({
- 'float':'left'
- });
- const $mode_input = $('<input type="checkbox" id="mode" tabindex="0">').css({
- 'float':'left'
- });
- const $levels_input = $('<input type="text" id="levels" autocomplete="off" placeholder="MIN-MAX">').css({
- 'width':'65px',
- 'height':'15px',
- 'background':'rgba(15, 15, 15, 0.45)',
- 'border':'0',
- 'border-bottom':'1px dotted orange',
- 'color':'orange',
- 'text-align':'center',
- 'float':'left'
- });
- const $backmode_input = $('<input type="checkbox" id="backmode" tabindex="0"><small>KORDY</small>').css({
- 'float':'left'
- });
- const $coords_input = $('<input type="text" id="coords" autocomplete="off" placeholder="X,Y">').css({
- 'width':'55px',
- 'height':'15px',
- 'background':'rgba(15, 15, 15, 0.45)',
- 'border':'0',
- 'border-bottom':'1px dotted orange',
- 'color':'orange',
- 'text-align':'center',
- 'float':'left'
- });
- const $automode_input = $('<span style="clear: both;"></span><input type="checkbox" id="automode"><small>AUTO F</small><br>').css({
- 'float':'left',
- 'text-align':'left'
- });
- const $follow_input = $('<input type="checkbox" id="follow"><small>FOLLOW</small>').css({
- 'float':'left',
- 'text-align':'left'
- });
- $("body").append($container2);
- $("#p4d0k1ll").append($head, $body);
- $("#p4d0k1ll-head").append($settings_input, $mode_input, $levels_input);
- $("#p4d0k1ll-body").append($backmode_input, $coords_input, $automode_input, $follow_input);
- $('#p4d0k1ll-settings').click(function () {
- $('#p4d0k1ll-body').toggle('slow');
- });
- }
- window.onload = initCSS();
- localStorage.getItem('p4d0k1llsi') || localStorage.setItem('p4d0k1llsi', JSON.stringify({ x: 0, y: 0}));
- let padoPosition = JSON.parse(localStorage.getItem('p4d0k1llsi'));
- document.querySelector('#p4d0k1ll').style.left = `${padoPosition.x}`;
- document.querySelector('#p4d0k1ll').style.top = `${padoPosition.y}`;
- document.querySelector('#p4d0k1ll').style.position = 'absolute';
- $(document.querySelector('#p4d0k1ll')).draggable({
- stop: () => {
- padoPosition.x = document.querySelector('#p4d0k1ll').style.left;
- padoPosition.y = document.querySelector('#p4d0k1ll').style.top;
- localStorage.setItem('p4d0k1llsi', JSON.stringify(padoPosition));
- document.querySelector('#p4d0k1ll').style.left = padoPosition.x;
- document.querySelector('#p4d0k1ll').style.top = padoPosition.y;
- document.querySelector('#p4d0k1ll').style.position = 'absolute';
- }
- });
- const loadSettings = () => {
- sleep(4000);
- if (localStorage.getItem('status' + getCookie("mchar_id")) == "true") {
- document.getElementById('mode').setAttribute('checked', 'checked');
- }
- if (localStorage.getItem('backmode' + getCookie("mchar_id")) == "true") {
- document.getElementById('backmode').setAttribute('checked', 'checked');
- }
- if (localStorage.getItem('automode' + getCookie("mchar_id")) == "true") {
- document.getElementById('automode').setAttribute('checked', 'checked');
- }
- if (localStorage.getItem('follow' + getCookie("mchar_id")) == "true") {
- document.getElementById('follow').setAttribute('checked', 'checked');
- }
- if (localStorage.getItem('coords' + getCookie("mchar_id")) == null || localStorage.getItem('coords' + getCookie("mchar_id")) == undefined) {
- localStorage.setItem('coords' + getCookie("mchar_id"), '00,00');
- }
- if (localStorage.getItem("levels" + getCookie("mchar_id")) == null || localStorage.getItem('levels' + getCookie("mchar_id")) == undefined) {
- localStorage.setItem("levels" + getCookie("mchar_id"), '0-500');
- }
- document.getElementById("levels").value = localStorage.getItem("levels" + getCookie("mchar_id"));
- document.getElementById("coords").value = localStorage.getItem("coords" + getCookie("mchar_id"));
- console.log('[P4D0K1LL] Załadowano ustawienia.');
- }
- window.onload = loadSettings();
- document.getElementById('levels').onchange = () => {
- localStorage.setItem("levels" + getCookie("mchar_id"), document.getElementById("levels").value);
- console.log('[P4D0K1LL] Zapisano ustawienia.');
- }
- document.getElementById('coords').onchange = () => {
- localStorage.setItem("coords" + getCookie("mchar_id"), document.getElementById("coords").value);
- console.log('[P4D0K1LL] Zapisano ustawienia.');
- }
- document.getElementById('follow').addEventListener('click', () => {
- localStorage.setItem("follow" + getCookie("mchar_id"), document.getElementById(`follow`).checked);
- console.log('[P4D0K1LL] Zapisano ustawienia.');
- });
- document.getElementById('mode').addEventListener('click', () => {
- localStorage.setItem("status" + getCookie("mchar_id"), document.getElementById(`mode`).checked);
- console.log('[P4D0K1LL] Zapisano ustawienia.');
- });
- document.getElementById('automode').addEventListener('click', () => {
- localStorage.setItem("automode" + getCookie("mchar_id"), document.getElementById(`automode`).checked);
- console.log('[P4D0K1LL] Zapisano ustawienia.');
- });
- document.getElementById('backmode').addEventListener('click', () => {
- localStorage.setItem("backmode" + getCookie("mchar_id"), document.getElementById(`backmode`).checked);
- console.log('[P4D0K1LL] Zapisano ustawienia.');
- });
- const sendAttackReq = (id) => {
- if (new Date() / 60 - lastAttackReq < 0.3) return;
- window._g('fight&a=attack&id=' + id);
- lastAttackReq = new Date() / 60;
- }
- let lastAttackReq = new Date() / 60;
- const searchPath = (t, s) => {
- if (road.length && road[0].x == t && road[0].y == s) {
- return false;
- }
- if (hero.isBlockedSearchPath()) return hero.blockedInfoSearchPath();
- var i = map.nodes.getNode(hero.x, hero.y),
- a = map.nodes.getNode(t, s);
- i.hasSameGroup(a) ||
- (map.nodes.clearAllNodes(),
- i.setScore(0, map.hce8(a, i)),
- (a = map.nodeSetLoop(a, i, map.findStep))),
- map.nodes.clearAllNodes(),
- i.setScore(0, map.hce(i, a)),
- map.nodeSetLoop(i, a, map.mapStep);
- var e = a;
- for (road = []; null !== e && e.id != i.id;)
- road.push({
- x: e.x,
- y: e.y,
- }),
- (e = e.from);
- null !== e &&
- road.push({
- x: e.x,
- y: e.y,
- });
- };
- const backTo = async () => {
- while (true) {
- if (window.g.init < 5) {
- await sleep(2000);
- continue;
- }
- let enemies = Object.values(g.other).filter(obj => {
- return (obj.relation == 'en' || obj.relation == 'cl-en' || obj.relation == '') && obj.lvl >= document.getElementById("levels").value.split("-")[0] && obj.lvl <= document.getElementById("levels").value.split("-")[1];
- });
- if (document.getElementById("mode").checked && window.map.pvp == 2 && document.getElementById("backmode").checked && enemies == '') {
- if (hero.x != document.getElementById("coords").value.split(",")[0] || hero.y != document.getElementById("coords").value.split(",")[1]) {
- searchPath(parseInt(document.getElementById("coords").value.split(",")[0]), parseInt(document.getElementById("coords").value.split(",")[1]));
- }
- }
- await sleep(Math.random() * (900 - 700) + 900);
- }
- }
- window.onload = backTo();
- const initX = async () => {
- while (true) {
- if (window.g.init < 5) {
- await sleep(2000);
- continue;
- }
- let targets = [];
- const getOthers = Object.values(g.other).filter(obj => {
- return (obj.relation == 'en' || obj.relation == 'cl-en' || obj.relation == '') && obj.lvl >= document.getElementById("levels").value.split("-")[0] && obj.lvl <= document.getElementById("levels").value.split("-")[1];
- });
- if (document.getElementById('mode').checked && window.map.pvp == 2) {
- for (const i in getOthers) {
- let emoBattle = document.querySelector('#other' + getOthers[i].id).querySelector('.emo-cointainer > .emo.emo-battle');
- let pvpProtected = document.querySelector('#other' + getOthers[i].id).querySelector('.emo-cointainer > .emo.emo-pvpprotected');
- if (emoBattle == null || emoBattle == undefined) {
- if (pvpProtected == null || pvpProtected == undefined) {
- targets.push({
- id: getOthers[i].id,
- x: getOthers[i].x,
- y: getOthers[i].y,
- distance: Math.abs(hero.x - getOthers[i].x) + Math.abs(hero.y - getOthers[i].y)
- });
- }
- }
- }
- if (targets != '') {
- targets = targets.sort((a, b) => (a.distance > b.distance) ? 1 : -1);
- if (targets[0].distance > 2 && document.getElementById("follow").checked) {
- searchPath(targets[0].x, targets[0].y);
- } else sendAttackReq(targets[0].id);
- } else if (document.getElementById("automode").checked) {
- if (g.battle) {
- if ($("#autobattleButton").css("display") == "block") {
- $("#autobattleButton").click()
- }
- }
- }
- }
- await sleep(50);
- }
- }
- window.onload = initX();
- })(typeof unsafeWindow !== "undefined" ? unsafeWindow : window, (ms) => new Promise((resolve) => setTimeout(resolve, ms)));// ==UserScript==
- // @name AUTOX SI
- // @namespace http://tampermonkey.net/
- // @version 2.3
- // @description Skrypt automatycznie biega za graczem, wraca na kordy po zabiciu itd.
- // @author Padonim
- // @match https://fobos.margonem.pl/
- // @start-at document-idle
- // @grant GM_setValue
- // @grant GM_getValue
- // ==/UserScript==
- (async (window, sleep) => {
- const initCSS = () => {
- const $container2 = $('<div id="p4d0k1ll"></div>').css({
- 'width':'120px',
- 'position':'absolute',
- 'z-index':'999',
- 'background':'rgba(15, 15, 15, 0.85)',
- 'border':'1px solid orange',
- 'color':'white'
- });
- const $head = $('<div id="p4d0k1ll-head"></div>').css({
- 'width':'120px',
- 'height':'25px',
- });
- const $body = $('<div id="p4d0k1ll-body"></div>').css({
- 'width':'120px',
- 'height':'40px',
- 'font-size':'8px'
- })
- const $settings_input = $('<div id="p4d0k1ll-settings">⚙️</div>').css({
- 'float':'left'
- });
- const $mode_input = $('<input type="checkbox" id="mode" tabindex="0">').css({
- 'float':'left'
- });
- const $levels_input = $('<input type="text" id="levels" autocomplete="off" placeholder="MIN-MAX">').css({
- 'width':'65px',
- 'height':'15px',
- 'background':'rgba(15, 15, 15, 0.45)',
- 'border':'0',
- 'border-bottom':'1px dotted orange',
- 'color':'orange',
- 'text-align':'center',
- 'float':'left'
- });
- const $backmode_input = $('<input type="checkbox" id="backmode" tabindex="0"><small>KORDY</small>').css({
- 'float':'left'
- });
- const $coords_input = $('<input type="text" id="coords" autocomplete="off" placeholder="X,Y">').css({
- 'width':'55px',
- 'height':'15px',
- 'background':'rgba(15, 15, 15, 0.45)',
- 'border':'0',
- 'border-bottom':'1px dotted orange',
- 'color':'orange',
- 'text-align':'center',
- 'float':'left'
- });
- const $automode_input = $('<span style="clear: both;"></span><input type="checkbox" id="automode"><small>AUTO F</small><br>').css({
- 'float':'left',
- 'text-align':'left'
- });
- const $follow_input = $('<input type="checkbox" id="follow"><small>FOLLOW</small>').css({
- 'float':'left',
- 'text-align':'left'
- });
- $("body").append($container2);
- $("#p4d0k1ll").append($head, $body);
- $("#p4d0k1ll-head").append($settings_input, $mode_input, $levels_input);
- $("#p4d0k1ll-body").append($backmode_input, $coords_input, $automode_input, $follow_input);
- $('#p4d0k1ll-settings').click(function () {
- $('#p4d0k1ll-body').toggle('slow');
- });
- }
- window.onload = initCSS();
- localStorage.getItem('p4d0k1llsi') || localStorage.setItem('p4d0k1llsi', JSON.stringify({ x: 0, y: 0}));
- let padoPosition = JSON.parse(localStorage.getItem('p4d0k1llsi'));
- document.querySelector('#p4d0k1ll').style.left = `${padoPosition.x}`;
- document.querySelector('#p4d0k1ll').style.top = `${padoPosition.y}`;
- document.querySelector('#p4d0k1ll').style.position = 'absolute';
- $(document.querySelector('#p4d0k1ll')).draggable({
- stop: () => {
- padoPosition.x = document.querySelector('#p4d0k1ll').style.left;
- padoPosition.y = document.querySelector('#p4d0k1ll').style.top;
- localStorage.setItem('p4d0k1llsi', JSON.stringify(padoPosition));
- document.querySelector('#p4d0k1ll').style.left = padoPosition.x;
- document.querySelector('#p4d0k1ll').style.top = padoPosition.y;
- document.querySelector('#p4d0k1ll').style.position = 'absolute';
- }
- });
- const loadSettings = () => {
- sleep(4000);
- if (localStorage.getItem('status' + getCookie("mchar_id")) == "true") {
- document.getElementById('mode').setAttribute('checked', 'checked');
- }
- if (localStorage.getItem('backmode' + getCookie("mchar_id")) == "true") {
- document.getElementById('backmode').setAttribute('checked', 'checked');
- }
- if (localStorage.getItem('automode' + getCookie("mchar_id")) == "true") {
- document.getElementById('automode').setAttribute('checked', 'checked');
- }
- if (localStorage.getItem('follow' + getCookie("mchar_id")) == "true") {
- document.getElementById('follow').setAttribute('checked', 'checked');
- }
- if (localStorage.getItem('coords' + getCookie("mchar_id")) == null || localStorage.getItem('coords' + getCookie("mchar_id")) == undefined) {
- localStorage.setItem('coords' + getCookie("mchar_id"), '00,00');
- }
- if (localStorage.getItem("levels" + getCookie("mchar_id")) == null || localStorage.getItem('levels' + getCookie("mchar_id")) == undefined) {
- localStorage.setItem("levels" + getCookie("mchar_id"), '0-500');
- }
- document.getElementById("levels").value = localStorage.getItem("levels" + getCookie("mchar_id"));
- document.getElementById("coords").value = localStorage.getItem("coords" + getCookie("mchar_id"));
- console.log('[P4D0K1LL] Załadowano ustawienia.');
- }
- window.onload = loadSettings();
- document.getElementById('levels').onchange = () => {
- localStorage.setItem("levels" + getCookie("mchar_id"), document.getElementById("levels").value);
- console.log('[P4D0K1LL] Zapisano ustawienia.');
- }
- document.getElementById('coords').onchange = () => {
- localStorage.setItem("coords" + getCookie("mchar_id"), document.getElementById("coords").value);
- console.log('[P4D0K1LL] Zapisano ustawienia.');
- }
- document.getElementById('follow').addEventListener('click', () => {
- localStorage.setItem("follow" + getCookie("mchar_id"), document.getElementById(`follow`).checked);
- console.log('[P4D0K1LL] Zapisano ustawienia.');
- });
- document.getElementById('mode').addEventListener('click', () => {
- localStorage.setItem("status" + getCookie("mchar_id"), document.getElementById(`mode`).checked);
- console.log('[P4D0K1LL] Zapisano ustawienia.');
- });
- document.getElementById('automode').addEventListener('click', () => {
- localStorage.setItem("automode" + getCookie("mchar_id"), document.getElementById(`automode`).checked);
- console.log('[P4D0K1LL] Zapisano ustawienia.');
- });
- document.getElementById('backmode').addEventListener('click', () => {
- localStorage.setItem("backmode" + getCookie("mchar_id"), document.getElementById(`backmode`).checked);
- console.log('[P4D0K1LL] Zapisano ustawienia.');
- });
- const sendAttackReq = (id) => {
- if (new Date() / 60 - lastAttackReq < 0.3) return;
- window._g('fight&a=attack&id=' + id);
- lastAttackReq = new Date() / 60;
- }
- let lastAttackReq = new Date() / 60;
- const searchPath = (t, s) => {
- if (road.length && road[0].x == t && road[0].y == s) {
- return false;
- }
- if (hero.isBlockedSearchPath()) return hero.blockedInfoSearchPath();
- var i = map.nodes.getNode(hero.x, hero.y),
- a = map.nodes.getNode(t, s);
- i.hasSameGroup(a) ||
- (map.nodes.clearAllNodes(),
- i.setScore(0, map.hce8(a, i)),
- (a = map.nodeSetLoop(a, i, map.findStep))),
- map.nodes.clearAllNodes(),
- i.setScore(0, map.hce(i, a)),
- map.nodeSetLoop(i, a, map.mapStep);
- var e = a;
- for (road = []; null !== e && e.id != i.id;)
- road.push({
- x: e.x,
- y: e.y,
- }),
- (e = e.from);
- null !== e &&
- road.push({
- x: e.x,
- y: e.y,
- });
- };
- const backTo = async () => {
- while (true) {
- if (window.g.init < 5) {
- await sleep(2000);
- continue;
- }
- let enemies = Object.values(g.other).filter(obj => {
- return (obj.relation == 'en' || obj.relation == 'cl-en' || obj.relation == '') && obj.lvl >= document.getElementById("levels").value.split("-")[0] && obj.lvl <= document.getElementById("levels").value.split("-")[1];
- });
- if (document.getElementById("mode").checked && window.map.pvp == 2 && document.getElementById("backmode").checked && enemies == '') {
- if (hero.x != document.getElementById("coords").value.split(",")[0] || hero.y != document.getElementById("coords").value.split(",")[1]) {
- searchPath(parseInt(document.getElementById("coords").value.split(",")[0]), parseInt(document.getElementById("coords").value.split(",")[1]));
- }
- }
- await sleep(Math.random() * (900 - 700) + 900);
- }
- }
- window.onload = backTo();
- const initX = async () => {
- while (true) {
- if (window.g.init < 5) {
- await sleep(2000);
- continue;
- }
- let targets = [];
- const getOthers = Object.values(g.other).filter(obj => {
- return (obj.relation == 'en' || obj.relation == 'cl-en' || obj.relation == '') && obj.lvl >= document.getElementById("levels").value.split("-")[0] && obj.lvl <= document.getElementById("levels").value.split("-")[1];
- });
- if (document.getElementById('mode').checked && window.map.pvp == 2) {
- for (const i in getOthers) {
- let emoBattle = document.querySelector('#other' + getOthers[i].id).querySelector('.emo-cointainer > .emo.emo-battle');
- let pvpProtected = document.querySelector('#other' + getOthers[i].id).querySelector('.emo-cointainer > .emo.emo-pvpprotected');
- if (emoBattle == null || emoBattle == undefined) {
- if (pvpProtected == null || pvpProtected == undefined) {
- targets.push({
- id: getOthers[i].id,
- x: getOthers[i].x,
- y: getOthers[i].y,
- distance: Math.abs(hero.x - getOthers[i].x) + Math.abs(hero.y - getOthers[i].y)
- });
- }
- }
- }
- if (targets != '') {
- targets = targets.sort((a, b) => (a.distance > b.distance) ? 1 : -1);
- if (targets[0].distance > 2 && document.getElementById("follow").checked) {
- searchPath(targets[0].x, targets[0].y);
- } else sendAttackReq(targets[0].id);
- } else if (document.getElementById("automode").checked) {
- if (g.battle) {
- if ($("#autobattleButton").css("display") == "block") {
- $("#autobattleButton").click()
- }
- }
- }
- }
- await sleep(50);
- }
- }
- window.onload = initX();
- })(typeof unsafeWindow !== "undefined" ? unsafeWindow : window, (ms) => new Promise((resolve) => setTimeout(resolve, ms)));// ==UserScript==
- // @name AUTOX SI
- // @namespace http://tampermonkey.net/
- // @version 2.3
- // @description Skrypt automatycznie biega za graczem, wraca na kordy po zabiciu itd.
- // @author Padonim
- // @match https://fobos.margonem.pl/
- // @start-at document-idle
- // @grant GM_setValue
- // @grant GM_getValue
- // ==/UserScript==
- (async (window, sleep) => {
- const initCSS = () => {
- const $container2 = $('<div id="p4d0k1ll"></div>').css({
- 'width':'120px',
- 'position':'absolute',
- 'z-index':'999',
- 'background':'rgba(15, 15, 15, 0.85)',
- 'border':'1px solid orange',
- 'color':'white'
- });
- const $head = $('<div id="p4d0k1ll-head"></div>').css({
- 'width':'120px',
- 'height':'25px',
- });
- const $body = $('<div id="p4d0k1ll-body"></div>').css({
- 'width':'120px',
- 'height':'40px',
- 'font-size':'8px'
- })
- const $settings_input = $('<div id="p4d0k1ll-settings">⚙️</div>').css({
- 'float':'left'
- });
- const $mode_input = $('<input type="checkbox" id="mode" tabindex="0">').css({
- 'float':'left'
- });
- const $levels_input = $('<input type="text" id="levels" autocomplete="off" placeholder="MIN-MAX">').css({
- 'width':'65px',
- 'height':'15px',
- 'background':'rgba(15, 15, 15, 0.45)',
- 'border':'0',
- 'border-bottom':'1px dotted orange',
- 'color':'orange',
- 'text-align':'center',
- 'float':'left'
- });
- const $backmode_input = $('<input type="checkbox" id="backmode" tabindex="0"><small>KORDY</small>').css({
- 'float':'left'
- });
- const $coords_input = $('<input type="text" id="coords" autocomplete="off" placeholder="X,Y">').css({
- 'width':'55px',
- 'height':'15px',
- 'background':'rgba(15, 15, 15, 0.45)',
- 'border':'0',
- 'border-bottom':'1px dotted orange',
- 'color':'orange',
- 'text-align':'center',
- 'float':'left'
- });
- const $automode_input = $('<span style="clear: both;"></span><input type="checkbox" id="automode"><small>AUTO F</small><br>').css({
- 'float':'left',
- 'text-align':'left'
- });
- const $follow_input = $('<input type="checkbox" id="follow"><small>FOLLOW</small>').css({
- 'float':'left',
- 'text-align':'left'
- });
- $("body").append($container2);
- $("#p4d0k1ll").append($head, $body);
- $("#p4d0k1ll-head").append($settings_input, $mode_input, $levels_input);
- $("#p4d0k1ll-body").append($backmode_input, $coords_input, $automode_input, $follow_input);
- $('#p4d0k1ll-settings').click(function () {
- $('#p4d0k1ll-body').toggle('slow');
- });
- }
- window.onload = initCSS();
- localStorage.getItem('p4d0k1llsi') || localStorage.setItem('p4d0k1llsi', JSON.stringify({ x: 0, y: 0}));
- let padoPosition = JSON.parse(localStorage.getItem('p4d0k1llsi'));
- document.querySelector('#p4d0k1ll').style.left = `${padoPosition.x}`;
- document.querySelector('#p4d0k1ll').style.top = `${padoPosition.y}`;
- document.querySelector('#p4d0k1ll').style.position = 'absolute';
- $(document.querySelector('#p4d0k1ll')).draggable({
- stop: () => {
- padoPosition.x = document.querySelector('#p4d0k1ll').style.left;
- padoPosition.y = document.querySelector('#p4d0k1ll').style.top;
- localStorage.setItem('p4d0k1llsi', JSON.stringify(padoPosition));
- document.querySelector('#p4d0k1ll').style.left = padoPosition.x;
- document.querySelector('#p4d0k1ll').style.top = padoPosition.y;
- document.querySelector('#p4d0k1ll').style.position = 'absolute';
- }
- });
- const loadSettings = () => {
- sleep(4000);
- if (localStorage.getItem('status' + getCookie("mchar_id")) == "true") {
- document.getElementById('mode').setAttribute('checked', 'checked');
- }
- if (localStorage.getItem('backmode' + getCookie("mchar_id")) == "true") {
- document.getElementById('backmode').setAttribute('checked', 'checked');
- }
- if (localStorage.getItem('automode' + getCookie("mchar_id")) == "true") {
- document.getElementById('automode').setAttribute('checked', 'checked');
- }
- if (localStorage.getItem('follow' + getCookie("mchar_id")) == "true") {
- document.getElementById('follow').setAttribute('checked', 'checked');
- }
- if (localStorage.getItem('coords' + getCookie("mchar_id")) == null || localStorage.getItem('coords' + getCookie("mchar_id")) == undefined) {
- localStorage.setItem('coords' + getCookie("mchar_id"), '00,00');
- }
- if (localStorage.getItem("levels" + getCookie("mchar_id")) == null || localStorage.getItem('levels' + getCookie("mchar_id")) == undefined) {
- localStorage.setItem("levels" + getCookie("mchar_id"), '0-500');
- }
- document.getElementById("levels").value = localStorage.getItem("levels" + getCookie("mchar_id"));
- document.getElementById("coords").value = localStorage.getItem("coords" + getCookie("mchar_id"));
- console.log('[P4D0K1LL] Załadowano ustawienia.');
- }
- window.onload = loadSettings();
- document.getElementById('levels').onchange = () => {
- localStorage.setItem("levels" + getCookie("mchar_id"), document.getElementById("levels").value);
- console.log('[P4D0K1LL] Zapisano ustawienia.');
- }
- document.getElementById('coords').onchange = () => {
- localStorage.setItem("coords" + getCookie("mchar_id"), document.getElementById("coords").value);
- console.log('[P4D0K1LL] Zapisano ustawienia.');
- }
- document.getElementById('follow').addEventListener('click', () => {
- localStorage.setItem("follow" + getCookie("mchar_id"), document.getElementById(`follow`).checked);
- console.log('[P4D0K1LL] Zapisano ustawienia.');
- });
- document.getElementById('mode').addEventListener('click', () => {
- localStorage.setItem("status" + getCookie("mchar_id"), document.getElementById(`mode`).checked);
- console.log('[P4D0K1LL] Zapisano ustawienia.');
- });
- document.getElementById('automode').addEventListener('click', () => {
- localStorage.setItem("automode" + getCookie("mchar_id"), document.getElementById(`automode`).checked);
- console.log('[P4D0K1LL] Zapisano ustawienia.');
- });
- document.getElementById('backmode').addEventListener('click', () => {
- localStorage.setItem("backmode" + getCookie("mchar_id"), document.getElementById(`backmode`).checked);
- console.log('[P4D0K1LL] Zapisano ustawienia.');
- });
- const sendAttackReq = (id) => {
- if (new Date() / 60 - lastAttackReq < 0.3) return;
- window._g('fight&a=attack&id=' + id);
- lastAttackReq = new Date() / 60;
- }
- let lastAttackReq = new Date() / 60;
- const searchPath = (t, s) => {
- if (road.length && road[0].x == t && road[0].y == s) {
- return false;
- }
- if (hero.isBlockedSearchPath()) return hero.blockedInfoSearchPath();
- var i = map.nodes.getNode(hero.x, hero.y),
- a = map.nodes.getNode(t, s);
- i.hasSameGroup(a) ||
- (map.nodes.clearAllNodes(),
- i.setScore(0, map.hce8(a, i)),
- (a = map.nodeSetLoop(a, i, map.findStep))),
- map.nodes.clearAllNodes(),
- i.setScore(0, map.hce(i, a)),
- map.nodeSetLoop(i, a, map.mapStep);
- var e = a;
- for (road = []; null !== e && e.id != i.id;)
- road.push({
- x: e.x,
- y: e.y,
- }),
- (e = e.from);
- null !== e &&
- road.push({
- x: e.x,
- y: e.y,
- });
- };
- const backTo = async () => {
- while (true) {
- if (window.g.init < 5) {
- await sleep(2000);
- continue;
- }
- let enemies = Object.values(g.other).filter(obj => {
- return (obj.relation == 'en' || obj.relation == 'cl-en' || obj.relation == '') && obj.lvl >= document.getElementById("levels").value.split("-")[0] && obj.lvl <= document.getElementById("levels").value.split("-")[1];
- });
- if (document.getElementById("mode").checked && window.map.pvp == 2 && document.getElementById("backmode").checked && enemies == '') {
- if (hero.x != document.getElementById("coords").value.split(",")[0] || hero.y != document.getElementById("coords").value.split(",")[1]) {
- searchPath(parseInt(document.getElementById("coords").value.split(",")[0]), parseInt(document.getElementById("coords").value.split(",")[1]));
- }
- }
- await sleep(Math.random() * (900 - 700) + 900);
- }
- }
- window.onload = backTo();
- const initX = async () => {
- while (true) {
- if (window.g.init < 5) {
- await sleep(2000);
- continue;
- }
- let targets = [];
- const getOthers = Object.values(g.other).filter(obj => {
- return (obj.relation == 'en' || obj.relation == 'cl-en' || obj.relation == '') && obj.lvl >= document.getElementById("levels").value.split("-")[0] && obj.lvl <= document.getElementById("levels").value.split("-")[1];
- });
- if (document.getElementById('mode').checked && window.map.pvp == 2) {
- for (const i in getOthers) {
- let emoBattle = document.querySelector('#other' + getOthers[i].id).querySelector('.emo-cointainer > .emo.emo-battle');
- let pvpProtected = document.querySelector('#other' + getOthers[i].id).querySelector('.emo-cointainer > .emo.emo-pvpprotected');
- if (emoBattle == null || emoBattle == undefined) {
- if (pvpProtected == null || pvpProtected == undefined) {
- targets.push({
- id: getOthers[i].id,
- x: getOthers[i].x,
- y: getOthers[i].y,
- distance: Math.abs(hero.x - getOthers[i].x) + Math.abs(hero.y - getOthers[i].y)
- });
- }
- }
- }
- if (targets != '') {
- targets = targets.sort((a, b) => (a.distance > b.distance) ? 1 : -1);
- if (targets[0].distance > 2 && document.getElementById("follow").checked) {
- searchPath(targets[0].x, targets[0].y);
- } else sendAttackReq(targets[0].id);
- } else if (document.getElementById("automode").checked) {
- if (g.battle) {
- if ($("#autobattleButton").css("display") == "block") {
- $("#autobattleButton").click()
- }
- }
- }
- }
- await sleep(50);
- }
- }
- window.onload = initX();
- })(typeof unsafeWindow !== "undefined" ? unsafeWindow : window, (ms) => new Promise((resolve) => setTimeout(resolve, ms)));// ==UserScript==
- // @name AUTOX SI
- // @namespace http://tampermonkey.net/
- // @version 2.3
- // @description Skrypt automatycznie biega za graczem, wraca na kordy po zabiciu itd.
- // @author Padonim
- // @match https://fobos.margonem.pl/
- // @start-at document-idle
- // @grant GM_setValue
- // @grant GM_getValue
- // ==/UserScript==
- (async (window, sleep) => {
- const initCSS = () => {
- const $container2 = $('<div id="p4d0k1ll"></div>').css({
- 'width':'120px',
- 'position':'absolute',
- 'z-index':'999',
- 'background':'rgba(15, 15, 15, 0.85)',
- 'border':'1px solid orange',
- 'color':'white'
- });
- const $head = $('<div id="p4d0k1ll-head"></div>').css({
- 'width':'120px',
- 'height':'25px',
- });
- const $body = $('<div id="p4d0k1ll-body"></div>').css({
- 'width':'120px',
- 'height':'40px',
- 'font-size':'8px'
- })
- const $settings_input = $('<div id="p4d0k1ll-settings">⚙️</div>').css({
- 'float':'left'
- });
- const $mode_input = $('<input type="checkbox" id="mode" tabindex="0">').css({
- 'float':'left'
- });
- const $levels_input = $('<input type="text" id="levels" autocomplete="off" placeholder="MIN-MAX">').css({
- 'width':'65px',
- 'height':'15px',
- 'background':'rgba(15, 15, 15, 0.45)',
- 'border':'0',
- 'border-bottom':'1px dotted orange',
- 'color':'orange',
- 'text-align':'center',
- 'float':'left'
- });
- const $backmode_input = $('<input type="checkbox" id="backmode" tabindex="0"><small>KORDY</small>').css({
- 'float':'left'
- });
- const $coords_input = $('<input type="text" id="coords" autocomplete="off" placeholder="X,Y">').css({
- 'width':'55px',
- 'height':'15px',
- 'background':'rgba(15, 15, 15, 0.45)',
- 'border':'0',
- 'border-bottom':'1px dotted orange',
- 'color':'orange',
- 'text-align':'center',
- 'float':'left'
- });
- const $automode_input = $('<span style="clear: both;"></span><input type="checkbox" id="automode"><small>AUTO F</small><br>').css({
- 'float':'left',
- 'text-align':'left'
- });
- const $follow_input = $('<input type="checkbox" id="follow"><small>FOLLOW</small>').css({
- 'float':'left',
- 'text-align':'left'
- });
- $("body").append($container2);
- $("#p4d0k1ll").append($head, $body);
- $("#p4d0k1ll-head").append($settings_input, $mode_input, $levels_input);
- $("#p4d0k1ll-body").append($backmode_input, $coords_input, $automode_input, $follow_input);
- $('#p4d0k1ll-settings').click(function () {
- $('#p4d0k1ll-body').toggle('slow');
- });
- }
- window.onload = initCSS();
- localStorage.getItem('p4d0k1llsi') || localStorage.setItem('p4d0k1llsi', JSON.stringify({ x: 0, y: 0}));
- let padoPosition = JSON.parse(localStorage.getItem('p4d0k1llsi'));
- document.querySelector('#p4d0k1ll').style.left = `${padoPosition.x}`;
- document.querySelector('#p4d0k1ll').style.top = `${padoPosition.y}`;
- document.querySelector('#p4d0k1ll').style.position = 'absolute';
- $(document.querySelector('#p4d0k1ll')).draggable({
- stop: () => {
- padoPosition.x = document.querySelector('#p4d0k1ll').style.left;
- padoPosition.y = document.querySelector('#p4d0k1ll').style.top;
- localStorage.setItem('p4d0k1llsi', JSON.stringify(padoPosition));
- document.querySelector('#p4d0k1ll').style.left = padoPosition.x;
- document.querySelector('#p4d0k1ll').style.top = padoPosition.y;
- document.querySelector('#p4d0k1ll').style.position = 'absolute';
- }
- });
- const loadSettings = () => {
- sleep(4000);
- if (localStorage.getItem('status' + getCookie("mchar_id")) == "true") {
- document.getElementById('mode').setAttribute('checked', 'checked');
- }
- if (localStorage.getItem('backmode' + getCookie("mchar_id")) == "true") {
- document.getElementById('backmode').setAttribute('checked', 'checked');
- }
- if (localStorage.getItem('automode' + getCookie("mchar_id")) == "true") {
- document.getElementById('automode').setAttribute('checked', 'checked');
- }
- if (localStorage.getItem('follow' + getCookie("mchar_id")) == "true") {
- document.getElementById('follow').setAttribute('checked', 'checked');
- }
- if (localStorage.getItem('coords' + getCookie("mchar_id")) == null || localStorage.getItem('coords' + getCookie("mchar_id")) == undefined) {
- localStorage.setItem('coords' + getCookie("mchar_id"), '00,00');
- }
- if (localStorage.getItem("levels" + getCookie("mchar_id")) == null || localStorage.getItem('levels' + getCookie("mchar_id")) == undefined) {
- localStorage.setItem("levels" + getCookie("mchar_id"), '0-500');
- }
- document.getElementById("levels").value = localStorage.getItem("levels" + getCookie("mchar_id"));
- document.getElementById("coords").value = localStorage.getItem("coords" + getCookie("mchar_id"));
- console.log('[P4D0K1LL] Załadowano ustawienia.');
- }
- window.onload = loadSettings();
- document.getElementById('levels').onchange = () => {
- localStorage.setItem("levels" + getCookie("mchar_id"), document.getElementById("levels").value);
- console.log('[P4D0K1LL] Zapisano ustawienia.');
- }
- document.getElementById('coords').onchange = () => {
- localStorage.setItem("coords" + getCookie("mchar_id"), document.getElementById("coords").value);
- console.log('[P4D0K1LL] Zapisano ustawienia.');
- }
- document.getElementById('follow').addEventListener('click', () => {
- localStorage.setItem("follow" + getCookie("mchar_id"), document.getElementById(`follow`).checked);
- console.log('[P4D0K1LL] Zapisano ustawienia.');
- });
- document.getElementById('mode').addEventListener('click', () => {
- localStorage.setItem("status" + getCookie("mchar_id"), document.getElementById(`mode`).checked);
- console.log('[P4D0K1LL] Zapisano ustawienia.');
- });
- document.getElementById('automode').addEventListener('click', () => {
- localStorage.setItem("automode" + getCookie("mchar_id"), document.getElementById(`automode`).checked);
- console.log('[P4D0K1LL] Zapisano ustawienia.');
- });
- document.getElementById('backmode').addEventListener('click', () => {
- localStorage.setItem("backmode" + getCookie("mchar_id"), document.getElementById(`backmode`).checked);
- console.log('[P4D0K1LL] Zapisano ustawienia.');
- });
- const sendAttackReq = (id) => {
- if (new Date() / 60 - lastAttackReq < 0.3) return;
- window._g('fight&a=attack&id=' + id);
- lastAttackReq = new Date() / 60;
- }
- let lastAttackReq = new Date() / 60;
- const searchPath = (t, s) => {
- if (road.length && road[0].x == t && road[0].y == s) {
- return false;
- }
- if (hero.isBlockedSearchPath()) return hero.blockedInfoSearchPath();
- var i = map.nodes.getNode(hero.x, hero.y),
- a = map.nodes.getNode(t, s);
- i.hasSameGroup(a) ||
- (map.nodes.clearAllNodes(),
- i.setScore(0, map.hce8(a, i)),
- (a = map.nodeSetLoop(a, i, map.findStep))),
- map.nodes.clearAllNodes(),
- i.setScore(0, map.hce(i, a)),
- map.nodeSetLoop(i, a, map.mapStep);
- var e = a;
- for (road = []; null !== e && e.id != i.id;)
- road.push({
- x: e.x,
- y: e.y,
- }),
- (e = e.from);
- null !== e &&
- road.push({
- x: e.x,
- y: e.y,
- });
- };
- const backTo = async () => {
- while (true) {
- if (window.g.init < 5) {
- await sleep(2000);
- continue;
- }
- let enemies = Object.values(g.other).filter(obj => {
- return (obj.relation == 'en' || obj.relation == 'cl-en' || obj.relation == '') && obj.lvl >= document.getElementById("levels").value.split("-")[0] && obj.lvl <= document.getElementById("levels").value.split("-")[1];
- });
- if (document.getElementById("mode").checked && window.map.pvp == 2 && document.getElementById("backmode").checked && enemies == '') {
- if (hero.x != document.getElementById("coords").value.split(",")[0] || hero.y != document.getElementById("coords").value.split(",")[1]) {
- searchPath(parseInt(document.getElementById("coords").value.split(",")[0]), parseInt(document.getElementById("coords").value.split(",")[1]));
- }
- }
- await sleep(Math.random() * (900 - 700) + 900);
- }
- }
- window.onload = backTo();
- const initX = async () => {
- while (true) {
- if (window.g.init < 5) {
- await sleep(2000);
- continue;
- }
- let targets = [];
- const getOthers = Object.values(g.other).filter(obj => {
- return (obj.relation == 'en' || obj.relation == 'cl-en' || obj.relation == '') && obj.lvl >= document.getElementById("levels").value.split("-")[0] && obj.lvl <= document.getElementById("levels").value.split("-")[1];
- });
- if (document.getElementById('mode').checked && window.map.pvp == 2) {
- for (const i in getOthers) {
- let emoBattle = document.querySelector('#other' + getOthers[i].id).querySelector('.emo-cointainer > .emo.emo-battle');
- let pvpProtected = document.querySelector('#other' + getOthers[i].id).querySelector('.emo-cointainer > .emo.emo-pvpprotected');
- if (emoBattle == null || emoBattle == undefined) {
- if (pvpProtected == null || pvpProtected == undefined) {
- targets.push({
- id: getOthers[i].id,
- x: getOthers[i].x,
- y: getOthers[i].y,
- distance: Math.abs(hero.x - getOthers[i].x) + Math.abs(hero.y - getOthers[i].y)
- });
- }
- }
- }
- if (targets != '') {
- targets = targets.sort((a, b) => (a.distance > b.distance) ? 1 : -1);
- if (targets[0].distance > 2 && document.getElementById("follow").checked) {
- searchPath(targets[0].x, targets[0].y);
- } else sendAttackReq(targets[0].id);
- } else if (document.getElementById("automode").checked) {
- if (g.battle) {
- if ($("#autobattleButton").css("display") == "block") {
- $("#autobattleButton").click()
- }
- }
- }
- }
- await sleep(50);
- }
- }
- window.onload = initX();
- })(typeof unsafeWindow !== "undefined" ? unsafeWindow : window, (ms) => new Promise((resolve) => setTimeout(resolve, ms)));
Advertisement
Add Comment
Please, Sign In to add comment