Savekiki

1.1

May 3rd, 2022
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 46.13 KB | None | 0 0
  1. // ==UserScript==
  2. // @name AUTOX SI
  3. // @namespace http://tampermonkey.net/
  4. // @version 2.3
  5. // @description Skrypt automatycznie biega za graczem, wraca na kordy po zabiciu itd.
  6. // @author Padonim
  7. // @match https://fobos.margonem.pl/
  8. // @start-at document-idle
  9. // @grant GM_setValue
  10. // @grant GM_getValue
  11. // ==/UserScript==
  12.  
  13. (async (window, sleep) => {
  14.  
  15. const initCSS = () => {
  16.  
  17. const $container2 = $('<div id="p4d0k1ll"></div>').css({
  18. 'width':'120px',
  19. 'position':'absolute',
  20. 'z-index':'999',
  21. 'background':'rgba(15, 15, 15, 0.85)',
  22. 'border':'1px solid orange',
  23. 'color':'white'
  24. });
  25. const $head = $('<div id="p4d0k1ll-head"></div>').css({
  26. 'width':'120px',
  27. 'height':'25px',
  28. });
  29.  
  30. const $body = $('<div id="p4d0k1ll-body"></div>').css({
  31. 'width':'120px',
  32. 'height':'40px',
  33. 'font-size':'8px'
  34. })
  35.  
  36. const $settings_input = $('<div id="p4d0k1ll-settings">⚙️</div>').css({
  37. 'float':'left'
  38. });
  39.  
  40. const $mode_input = $('<input type="checkbox" id="mode" tabindex="0">').css({
  41. 'float':'left'
  42. });
  43.  
  44. const $levels_input = $('<input type="text" id="levels" autocomplete="off" placeholder="MIN-MAX">').css({
  45. 'width':'65px',
  46. 'height':'15px',
  47. 'background':'rgba(15, 15, 15, 0.45)',
  48. 'border':'0',
  49. 'border-bottom':'1px dotted orange',
  50. 'color':'orange',
  51. 'text-align':'center',
  52. 'float':'left'
  53. });
  54.  
  55. const $backmode_input = $('<input type="checkbox" id="backmode" tabindex="0"><small>KORDY</small>').css({
  56. 'float':'left'
  57. });
  58.  
  59. const $coords_input = $('<input type="text" id="coords" autocomplete="off" placeholder="X,Y">').css({
  60. 'width':'55px',
  61. 'height':'15px',
  62. 'background':'rgba(15, 15, 15, 0.45)',
  63. 'border':'0',
  64. 'border-bottom':'1px dotted orange',
  65. 'color':'orange',
  66. 'text-align':'center',
  67. 'float':'left'
  68. });
  69.  
  70. const $automode_input = $('<span style="clear: both;"></span><input type="checkbox" id="automode"><small>AUTO F</small><br>').css({
  71. 'float':'left',
  72. 'text-align':'left'
  73. });
  74.  
  75. const $follow_input = $('<input type="checkbox" id="follow"><small>FOLLOW</small>').css({
  76. 'float':'left',
  77. 'text-align':'left'
  78. });
  79.  
  80. $("body").append($container2);
  81. $("#p4d0k1ll").append($head, $body);
  82. $("#p4d0k1ll-head").append($settings_input, $mode_input, $levels_input);
  83. $("#p4d0k1ll-body").append($backmode_input, $coords_input, $automode_input, $follow_input);
  84.  
  85. $('#p4d0k1ll-settings').click(function () {
  86. $('#p4d0k1ll-body').toggle('slow');
  87. });
  88.  
  89. }
  90. window.onload = initCSS();
  91.  
  92. localStorage.getItem('p4d0k1llsi') || localStorage.setItem('p4d0k1llsi', JSON.stringify({ x: 0, y: 0}));
  93.  
  94. let padoPosition = JSON.parse(localStorage.getItem('p4d0k1llsi'));
  95.  
  96. document.querySelector('#p4d0k1ll').style.left = `${padoPosition.x}`;
  97. document.querySelector('#p4d0k1ll').style.top = `${padoPosition.y}`;
  98. document.querySelector('#p4d0k1ll').style.position = 'absolute';
  99.  
  100. $(document.querySelector('#p4d0k1ll')).draggable({
  101. stop: () => {
  102. padoPosition.x = document.querySelector('#p4d0k1ll').style.left;
  103. padoPosition.y = document.querySelector('#p4d0k1ll').style.top;
  104. localStorage.setItem('p4d0k1llsi', JSON.stringify(padoPosition));
  105.  
  106. document.querySelector('#p4d0k1ll').style.left = padoPosition.x;
  107. document.querySelector('#p4d0k1ll').style.top = padoPosition.y;
  108. document.querySelector('#p4d0k1ll').style.position = 'absolute';
  109. }
  110. });
  111.  
  112. const loadSettings = () => {
  113. sleep(4000);
  114. if (localStorage.getItem('status' + getCookie("mchar_id")) == "true") {
  115. document.getElementById('mode').setAttribute('checked', 'checked');
  116. }
  117. if (localStorage.getItem('backmode' + getCookie("mchar_id")) == "true") {
  118. document.getElementById('backmode').setAttribute('checked', 'checked');
  119. }
  120. if (localStorage.getItem('automode' + getCookie("mchar_id")) == "true") {
  121. document.getElementById('automode').setAttribute('checked', 'checked');
  122. }
  123. if (localStorage.getItem('follow' + getCookie("mchar_id")) == "true") {
  124. document.getElementById('follow').setAttribute('checked', 'checked');
  125. }
  126. if (localStorage.getItem('coords' + getCookie("mchar_id")) == null || localStorage.getItem('coords' + getCookie("mchar_id")) == undefined) {
  127. localStorage.setItem('coords' + getCookie("mchar_id"), '00,00');
  128. }
  129. if (localStorage.getItem("levels" + getCookie("mchar_id")) == null || localStorage.getItem('levels' + getCookie("mchar_id")) == undefined) {
  130. localStorage.setItem("levels" + getCookie("mchar_id"), '0-500');
  131. }
  132. document.getElementById("levels").value = localStorage.getItem("levels" + getCookie("mchar_id"));
  133. document.getElementById("coords").value = localStorage.getItem("coords" + getCookie("mchar_id"));
  134. console.log('[P4D0K1LL] Załadowano ustawienia.');
  135. }
  136. window.onload = loadSettings();
  137.  
  138. document.getElementById('levels').onchange = () => {
  139. localStorage.setItem("levels" + getCookie("mchar_id"), document.getElementById("levels").value);
  140. console.log('[P4D0K1LL] Zapisano ustawienia.');
  141. }
  142.  
  143. document.getElementById('coords').onchange = () => {
  144. localStorage.setItem("coords" + getCookie("mchar_id"), document.getElementById("coords").value);
  145. console.log('[P4D0K1LL] Zapisano ustawienia.');
  146. }
  147.  
  148. document.getElementById('follow').addEventListener('click', () => {
  149. localStorage.setItem("follow" + getCookie("mchar_id"), document.getElementById(`follow`).checked);
  150. console.log('[P4D0K1LL] Zapisano ustawienia.');
  151. });
  152.  
  153. document.getElementById('mode').addEventListener('click', () => {
  154. localStorage.setItem("status" + getCookie("mchar_id"), document.getElementById(`mode`).checked);
  155. console.log('[P4D0K1LL] Zapisano ustawienia.');
  156. });
  157.  
  158. document.getElementById('automode').addEventListener('click', () => {
  159. localStorage.setItem("automode" + getCookie("mchar_id"), document.getElementById(`automode`).checked);
  160. console.log('[P4D0K1LL] Zapisano ustawienia.');
  161. });
  162.  
  163. document.getElementById('backmode').addEventListener('click', () => {
  164. localStorage.setItem("backmode" + getCookie("mchar_id"), document.getElementById(`backmode`).checked);
  165. console.log('[P4D0K1LL] Zapisano ustawienia.');
  166. });
  167.  
  168. const sendAttackReq = (id) => {
  169. if (new Date() / 60 - lastAttackReq < 0.3) return;
  170. window._g('fight&a=attack&id=' + id);
  171. lastAttackReq = new Date() / 60;
  172. }
  173. let lastAttackReq = new Date() / 60;
  174.  
  175. const searchPath = (t, s) => {
  176. if (road.length && road[0].x == t && road[0].y == s) {
  177. return false;
  178. }
  179. if (hero.isBlockedSearchPath()) return hero.blockedInfoSearchPath();
  180. var i = map.nodes.getNode(hero.x, hero.y),
  181. a = map.nodes.getNode(t, s);
  182. i.hasSameGroup(a) ||
  183. (map.nodes.clearAllNodes(),
  184. i.setScore(0, map.hce8(a, i)),
  185. (a = map.nodeSetLoop(a, i, map.findStep))),
  186. map.nodes.clearAllNodes(),
  187. i.setScore(0, map.hce(i, a)),
  188. map.nodeSetLoop(i, a, map.mapStep);
  189. var e = a;
  190. for (road = []; null !== e && e.id != i.id;)
  191. road.push({
  192. x: e.x,
  193. y: e.y,
  194. }),
  195. (e = e.from);
  196. null !== e &&
  197. road.push({
  198. x: e.x,
  199. y: e.y,
  200. });
  201. };
  202.  
  203.  
  204. const backTo = async () => {
  205. while (true) {
  206. if (window.g.init < 5) {
  207. await sleep(2000);
  208. continue;
  209. }
  210. let enemies = Object.values(g.other).filter(obj => {
  211. 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];
  212. });
  213. if (document.getElementById("mode").checked && window.map.pvp == 2 && document.getElementById("backmode").checked && enemies == '') {
  214. if (hero.x != document.getElementById("coords").value.split(",")[0] || hero.y != document.getElementById("coords").value.split(",")[1]) {
  215. searchPath(parseInt(document.getElementById("coords").value.split(",")[0]), parseInt(document.getElementById("coords").value.split(",")[1]));
  216. }
  217. }
  218. await sleep(Math.random() * (900 - 700) + 900);
  219. }
  220. }
  221. window.onload = backTo();
  222.  
  223. const initX = async () => {
  224. while (true) {
  225. if (window.g.init < 5) {
  226. await sleep(2000);
  227. continue;
  228. }
  229. let targets = [];
  230. const getOthers = Object.values(g.other).filter(obj => {
  231. 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];
  232. });
  233. if (document.getElementById('mode').checked && window.map.pvp == 2) {
  234. for (const i in getOthers) {
  235. let emoBattle = document.querySelector('#other' + getOthers[i].id).querySelector('.emo-cointainer > .emo.emo-battle');
  236. let pvpProtected = document.querySelector('#other' + getOthers[i].id).querySelector('.emo-cointainer > .emo.emo-pvpprotected');
  237. if (emoBattle == null || emoBattle == undefined) {
  238. if (pvpProtected == null || pvpProtected == undefined) {
  239. targets.push({
  240. id: getOthers[i].id,
  241. x: getOthers[i].x,
  242. y: getOthers[i].y,
  243. distance: Math.abs(hero.x - getOthers[i].x) + Math.abs(hero.y - getOthers[i].y)
  244. });
  245. }
  246. }
  247. }
  248. if (targets != '') {
  249. targets = targets.sort((a, b) => (a.distance > b.distance) ? 1 : -1);
  250. if (targets[0].distance > 2 && document.getElementById("follow").checked) {
  251. searchPath(targets[0].x, targets[0].y);
  252. } else sendAttackReq(targets[0].id);
  253. } else if (document.getElementById("automode").checked) {
  254. if (g.battle) {
  255. if ($("#autobattleButton").css("display") == "block") {
  256. $("#autobattleButton").click()
  257. }
  258. }
  259. }
  260. }
  261. await sleep(50);
  262. }
  263. }
  264. window.onload = initX();
  265.  
  266. })(typeof unsafeWindow !== "undefined" ? unsafeWindow : window, (ms) => new Promise((resolve) => setTimeout(resolve, ms)));// ==UserScript==
  267. // @name AUTOX SI
  268. // @namespace http://tampermonkey.net/
  269. // @version 2.3
  270. // @description Skrypt automatycznie biega za graczem, wraca na kordy po zabiciu itd.
  271. // @author Padonim
  272. // @match https://fobos.margonem.pl/
  273. // @start-at document-idle
  274. // @grant GM_setValue
  275. // @grant GM_getValue
  276. // ==/UserScript==
  277.  
  278. (async (window, sleep) => {
  279.  
  280. const initCSS = () => {
  281.  
  282. const $container2 = $('<div id="p4d0k1ll"></div>').css({
  283. 'width':'120px',
  284. 'position':'absolute',
  285. 'z-index':'999',
  286. 'background':'rgba(15, 15, 15, 0.85)',
  287. 'border':'1px solid orange',
  288. 'color':'white'
  289. });
  290. const $head = $('<div id="p4d0k1ll-head"></div>').css({
  291. 'width':'120px',
  292. 'height':'25px',
  293. });
  294.  
  295. const $body = $('<div id="p4d0k1ll-body"></div>').css({
  296. 'width':'120px',
  297. 'height':'40px',
  298. 'font-size':'8px'
  299. })
  300.  
  301. const $settings_input = $('<div id="p4d0k1ll-settings">⚙️</div>').css({
  302. 'float':'left'
  303. });
  304.  
  305. const $mode_input = $('<input type="checkbox" id="mode" tabindex="0">').css({
  306. 'float':'left'
  307. });
  308.  
  309. const $levels_input = $('<input type="text" id="levels" autocomplete="off" placeholder="MIN-MAX">').css({
  310. 'width':'65px',
  311. 'height':'15px',
  312. 'background':'rgba(15, 15, 15, 0.45)',
  313. 'border':'0',
  314. 'border-bottom':'1px dotted orange',
  315. 'color':'orange',
  316. 'text-align':'center',
  317. 'float':'left'
  318. });
  319.  
  320. const $backmode_input = $('<input type="checkbox" id="backmode" tabindex="0"><small>KORDY</small>').css({
  321. 'float':'left'
  322. });
  323.  
  324. const $coords_input = $('<input type="text" id="coords" autocomplete="off" placeholder="X,Y">').css({
  325. 'width':'55px',
  326. 'height':'15px',
  327. 'background':'rgba(15, 15, 15, 0.45)',
  328. 'border':'0',
  329. 'border-bottom':'1px dotted orange',
  330. 'color':'orange',
  331. 'text-align':'center',
  332. 'float':'left'
  333. });
  334.  
  335. const $automode_input = $('<span style="clear: both;"></span><input type="checkbox" id="automode"><small>AUTO F</small><br>').css({
  336. 'float':'left',
  337. 'text-align':'left'
  338. });
  339.  
  340. const $follow_input = $('<input type="checkbox" id="follow"><small>FOLLOW</small>').css({
  341. 'float':'left',
  342. 'text-align':'left'
  343. });
  344.  
  345. $("body").append($container2);
  346. $("#p4d0k1ll").append($head, $body);
  347. $("#p4d0k1ll-head").append($settings_input, $mode_input, $levels_input);
  348. $("#p4d0k1ll-body").append($backmode_input, $coords_input, $automode_input, $follow_input);
  349.  
  350. $('#p4d0k1ll-settings').click(function () {
  351. $('#p4d0k1ll-body').toggle('slow');
  352. });
  353.  
  354. }
  355. window.onload = initCSS();
  356.  
  357. localStorage.getItem('p4d0k1llsi') || localStorage.setItem('p4d0k1llsi', JSON.stringify({ x: 0, y: 0}));
  358.  
  359. let padoPosition = JSON.parse(localStorage.getItem('p4d0k1llsi'));
  360.  
  361. document.querySelector('#p4d0k1ll').style.left = `${padoPosition.x}`;
  362. document.querySelector('#p4d0k1ll').style.top = `${padoPosition.y}`;
  363. document.querySelector('#p4d0k1ll').style.position = 'absolute';
  364.  
  365. $(document.querySelector('#p4d0k1ll')).draggable({
  366. stop: () => {
  367. padoPosition.x = document.querySelector('#p4d0k1ll').style.left;
  368. padoPosition.y = document.querySelector('#p4d0k1ll').style.top;
  369. localStorage.setItem('p4d0k1llsi', JSON.stringify(padoPosition));
  370.  
  371. document.querySelector('#p4d0k1ll').style.left = padoPosition.x;
  372. document.querySelector('#p4d0k1ll').style.top = padoPosition.y;
  373. document.querySelector('#p4d0k1ll').style.position = 'absolute';
  374. }
  375. });
  376.  
  377. const loadSettings = () => {
  378. sleep(4000);
  379. if (localStorage.getItem('status' + getCookie("mchar_id")) == "true") {
  380. document.getElementById('mode').setAttribute('checked', 'checked');
  381. }
  382. if (localStorage.getItem('backmode' + getCookie("mchar_id")) == "true") {
  383. document.getElementById('backmode').setAttribute('checked', 'checked');
  384. }
  385. if (localStorage.getItem('automode' + getCookie("mchar_id")) == "true") {
  386. document.getElementById('automode').setAttribute('checked', 'checked');
  387. }
  388. if (localStorage.getItem('follow' + getCookie("mchar_id")) == "true") {
  389. document.getElementById('follow').setAttribute('checked', 'checked');
  390. }
  391. if (localStorage.getItem('coords' + getCookie("mchar_id")) == null || localStorage.getItem('coords' + getCookie("mchar_id")) == undefined) {
  392. localStorage.setItem('coords' + getCookie("mchar_id"), '00,00');
  393. }
  394. if (localStorage.getItem("levels" + getCookie("mchar_id")) == null || localStorage.getItem('levels' + getCookie("mchar_id")) == undefined) {
  395. localStorage.setItem("levels" + getCookie("mchar_id"), '0-500');
  396. }
  397. document.getElementById("levels").value = localStorage.getItem("levels" + getCookie("mchar_id"));
  398. document.getElementById("coords").value = localStorage.getItem("coords" + getCookie("mchar_id"));
  399. console.log('[P4D0K1LL] Załadowano ustawienia.');
  400. }
  401. window.onload = loadSettings();
  402.  
  403. document.getElementById('levels').onchange = () => {
  404. localStorage.setItem("levels" + getCookie("mchar_id"), document.getElementById("levels").value);
  405. console.log('[P4D0K1LL] Zapisano ustawienia.');
  406. }
  407.  
  408. document.getElementById('coords').onchange = () => {
  409. localStorage.setItem("coords" + getCookie("mchar_id"), document.getElementById("coords").value);
  410. console.log('[P4D0K1LL] Zapisano ustawienia.');
  411. }
  412.  
  413. document.getElementById('follow').addEventListener('click', () => {
  414. localStorage.setItem("follow" + getCookie("mchar_id"), document.getElementById(`follow`).checked);
  415. console.log('[P4D0K1LL] Zapisano ustawienia.');
  416. });
  417.  
  418. document.getElementById('mode').addEventListener('click', () => {
  419. localStorage.setItem("status" + getCookie("mchar_id"), document.getElementById(`mode`).checked);
  420. console.log('[P4D0K1LL] Zapisano ustawienia.');
  421. });
  422.  
  423. document.getElementById('automode').addEventListener('click', () => {
  424. localStorage.setItem("automode" + getCookie("mchar_id"), document.getElementById(`automode`).checked);
  425. console.log('[P4D0K1LL] Zapisano ustawienia.');
  426. });
  427.  
  428. document.getElementById('backmode').addEventListener('click', () => {
  429. localStorage.setItem("backmode" + getCookie("mchar_id"), document.getElementById(`backmode`).checked);
  430. console.log('[P4D0K1LL] Zapisano ustawienia.');
  431. });
  432.  
  433. const sendAttackReq = (id) => {
  434. if (new Date() / 60 - lastAttackReq < 0.3) return;
  435. window._g('fight&a=attack&id=' + id);
  436. lastAttackReq = new Date() / 60;
  437. }
  438. let lastAttackReq = new Date() / 60;
  439.  
  440. const searchPath = (t, s) => {
  441. if (road.length && road[0].x == t && road[0].y == s) {
  442. return false;
  443. }
  444. if (hero.isBlockedSearchPath()) return hero.blockedInfoSearchPath();
  445. var i = map.nodes.getNode(hero.x, hero.y),
  446. a = map.nodes.getNode(t, s);
  447. i.hasSameGroup(a) ||
  448. (map.nodes.clearAllNodes(),
  449. i.setScore(0, map.hce8(a, i)),
  450. (a = map.nodeSetLoop(a, i, map.findStep))),
  451. map.nodes.clearAllNodes(),
  452. i.setScore(0, map.hce(i, a)),
  453. map.nodeSetLoop(i, a, map.mapStep);
  454. var e = a;
  455. for (road = []; null !== e && e.id != i.id;)
  456. road.push({
  457. x: e.x,
  458. y: e.y,
  459. }),
  460. (e = e.from);
  461. null !== e &&
  462. road.push({
  463. x: e.x,
  464. y: e.y,
  465. });
  466. };
  467.  
  468.  
  469. const backTo = async () => {
  470. while (true) {
  471. if (window.g.init < 5) {
  472. await sleep(2000);
  473. continue;
  474. }
  475. let enemies = Object.values(g.other).filter(obj => {
  476. 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];
  477. });
  478. if (document.getElementById("mode").checked && window.map.pvp == 2 && document.getElementById("backmode").checked && enemies == '') {
  479. if (hero.x != document.getElementById("coords").value.split(",")[0] || hero.y != document.getElementById("coords").value.split(",")[1]) {
  480. searchPath(parseInt(document.getElementById("coords").value.split(",")[0]), parseInt(document.getElementById("coords").value.split(",")[1]));
  481. }
  482. }
  483. await sleep(Math.random() * (900 - 700) + 900);
  484. }
  485. }
  486. window.onload = backTo();
  487.  
  488. const initX = async () => {
  489. while (true) {
  490. if (window.g.init < 5) {
  491. await sleep(2000);
  492. continue;
  493. }
  494. let targets = [];
  495. const getOthers = Object.values(g.other).filter(obj => {
  496. 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];
  497. });
  498. if (document.getElementById('mode').checked && window.map.pvp == 2) {
  499. for (const i in getOthers) {
  500. let emoBattle = document.querySelector('#other' + getOthers[i].id).querySelector('.emo-cointainer > .emo.emo-battle');
  501. let pvpProtected = document.querySelector('#other' + getOthers[i].id).querySelector('.emo-cointainer > .emo.emo-pvpprotected');
  502. if (emoBattle == null || emoBattle == undefined) {
  503. if (pvpProtected == null || pvpProtected == undefined) {
  504. targets.push({
  505. id: getOthers[i].id,
  506. x: getOthers[i].x,
  507. y: getOthers[i].y,
  508. distance: Math.abs(hero.x - getOthers[i].x) + Math.abs(hero.y - getOthers[i].y)
  509. });
  510. }
  511. }
  512. }
  513. if (targets != '') {
  514. targets = targets.sort((a, b) => (a.distance > b.distance) ? 1 : -1);
  515. if (targets[0].distance > 2 && document.getElementById("follow").checked) {
  516. searchPath(targets[0].x, targets[0].y);
  517. } else sendAttackReq(targets[0].id);
  518. } else if (document.getElementById("automode").checked) {
  519. if (g.battle) {
  520. if ($("#autobattleButton").css("display") == "block") {
  521. $("#autobattleButton").click()
  522. }
  523. }
  524. }
  525. }
  526. await sleep(50);
  527. }
  528. }
  529. window.onload = initX();
  530.  
  531. })(typeof unsafeWindow !== "undefined" ? unsafeWindow : window, (ms) => new Promise((resolve) => setTimeout(resolve, ms)));// ==UserScript==
  532. // @name AUTOX SI
  533. // @namespace http://tampermonkey.net/
  534. // @version 2.3
  535. // @description Skrypt automatycznie biega za graczem, wraca na kordy po zabiciu itd.
  536. // @author Padonim
  537. // @match https://fobos.margonem.pl/
  538. // @start-at document-idle
  539. // @grant GM_setValue
  540. // @grant GM_getValue
  541. // ==/UserScript==
  542.  
  543. (async (window, sleep) => {
  544.  
  545. const initCSS = () => {
  546.  
  547. const $container2 = $('<div id="p4d0k1ll"></div>').css({
  548. 'width':'120px',
  549. 'position':'absolute',
  550. 'z-index':'999',
  551. 'background':'rgba(15, 15, 15, 0.85)',
  552. 'border':'1px solid orange',
  553. 'color':'white'
  554. });
  555. const $head = $('<div id="p4d0k1ll-head"></div>').css({
  556. 'width':'120px',
  557. 'height':'25px',
  558. });
  559.  
  560. const $body = $('<div id="p4d0k1ll-body"></div>').css({
  561. 'width':'120px',
  562. 'height':'40px',
  563. 'font-size':'8px'
  564. })
  565.  
  566. const $settings_input = $('<div id="p4d0k1ll-settings">⚙️</div>').css({
  567. 'float':'left'
  568. });
  569.  
  570. const $mode_input = $('<input type="checkbox" id="mode" tabindex="0">').css({
  571. 'float':'left'
  572. });
  573.  
  574. const $levels_input = $('<input type="text" id="levels" autocomplete="off" placeholder="MIN-MAX">').css({
  575. 'width':'65px',
  576. 'height':'15px',
  577. 'background':'rgba(15, 15, 15, 0.45)',
  578. 'border':'0',
  579. 'border-bottom':'1px dotted orange',
  580. 'color':'orange',
  581. 'text-align':'center',
  582. 'float':'left'
  583. });
  584.  
  585. const $backmode_input = $('<input type="checkbox" id="backmode" tabindex="0"><small>KORDY</small>').css({
  586. 'float':'left'
  587. });
  588.  
  589. const $coords_input = $('<input type="text" id="coords" autocomplete="off" placeholder="X,Y">').css({
  590. 'width':'55px',
  591. 'height':'15px',
  592. 'background':'rgba(15, 15, 15, 0.45)',
  593. 'border':'0',
  594. 'border-bottom':'1px dotted orange',
  595. 'color':'orange',
  596. 'text-align':'center',
  597. 'float':'left'
  598. });
  599.  
  600. const $automode_input = $('<span style="clear: both;"></span><input type="checkbox" id="automode"><small>AUTO F</small><br>').css({
  601. 'float':'left',
  602. 'text-align':'left'
  603. });
  604.  
  605. const $follow_input = $('<input type="checkbox" id="follow"><small>FOLLOW</small>').css({
  606. 'float':'left',
  607. 'text-align':'left'
  608. });
  609.  
  610. $("body").append($container2);
  611. $("#p4d0k1ll").append($head, $body);
  612. $("#p4d0k1ll-head").append($settings_input, $mode_input, $levels_input);
  613. $("#p4d0k1ll-body").append($backmode_input, $coords_input, $automode_input, $follow_input);
  614.  
  615. $('#p4d0k1ll-settings').click(function () {
  616. $('#p4d0k1ll-body').toggle('slow');
  617. });
  618.  
  619. }
  620. window.onload = initCSS();
  621.  
  622. localStorage.getItem('p4d0k1llsi') || localStorage.setItem('p4d0k1llsi', JSON.stringify({ x: 0, y: 0}));
  623.  
  624. let padoPosition = JSON.parse(localStorage.getItem('p4d0k1llsi'));
  625.  
  626. document.querySelector('#p4d0k1ll').style.left = `${padoPosition.x}`;
  627. document.querySelector('#p4d0k1ll').style.top = `${padoPosition.y}`;
  628. document.querySelector('#p4d0k1ll').style.position = 'absolute';
  629.  
  630. $(document.querySelector('#p4d0k1ll')).draggable({
  631. stop: () => {
  632. padoPosition.x = document.querySelector('#p4d0k1ll').style.left;
  633. padoPosition.y = document.querySelector('#p4d0k1ll').style.top;
  634. localStorage.setItem('p4d0k1llsi', JSON.stringify(padoPosition));
  635.  
  636. document.querySelector('#p4d0k1ll').style.left = padoPosition.x;
  637. document.querySelector('#p4d0k1ll').style.top = padoPosition.y;
  638. document.querySelector('#p4d0k1ll').style.position = 'absolute';
  639. }
  640. });
  641.  
  642. const loadSettings = () => {
  643. sleep(4000);
  644. if (localStorage.getItem('status' + getCookie("mchar_id")) == "true") {
  645. document.getElementById('mode').setAttribute('checked', 'checked');
  646. }
  647. if (localStorage.getItem('backmode' + getCookie("mchar_id")) == "true") {
  648. document.getElementById('backmode').setAttribute('checked', 'checked');
  649. }
  650. if (localStorage.getItem('automode' + getCookie("mchar_id")) == "true") {
  651. document.getElementById('automode').setAttribute('checked', 'checked');
  652. }
  653. if (localStorage.getItem('follow' + getCookie("mchar_id")) == "true") {
  654. document.getElementById('follow').setAttribute('checked', 'checked');
  655. }
  656. if (localStorage.getItem('coords' + getCookie("mchar_id")) == null || localStorage.getItem('coords' + getCookie("mchar_id")) == undefined) {
  657. localStorage.setItem('coords' + getCookie("mchar_id"), '00,00');
  658. }
  659. if (localStorage.getItem("levels" + getCookie("mchar_id")) == null || localStorage.getItem('levels' + getCookie("mchar_id")) == undefined) {
  660. localStorage.setItem("levels" + getCookie("mchar_id"), '0-500');
  661. }
  662. document.getElementById("levels").value = localStorage.getItem("levels" + getCookie("mchar_id"));
  663. document.getElementById("coords").value = localStorage.getItem("coords" + getCookie("mchar_id"));
  664. console.log('[P4D0K1LL] Załadowano ustawienia.');
  665. }
  666. window.onload = loadSettings();
  667.  
  668. document.getElementById('levels').onchange = () => {
  669. localStorage.setItem("levels" + getCookie("mchar_id"), document.getElementById("levels").value);
  670. console.log('[P4D0K1LL] Zapisano ustawienia.');
  671. }
  672.  
  673. document.getElementById('coords').onchange = () => {
  674. localStorage.setItem("coords" + getCookie("mchar_id"), document.getElementById("coords").value);
  675. console.log('[P4D0K1LL] Zapisano ustawienia.');
  676. }
  677.  
  678. document.getElementById('follow').addEventListener('click', () => {
  679. localStorage.setItem("follow" + getCookie("mchar_id"), document.getElementById(`follow`).checked);
  680. console.log('[P4D0K1LL] Zapisano ustawienia.');
  681. });
  682.  
  683. document.getElementById('mode').addEventListener('click', () => {
  684. localStorage.setItem("status" + getCookie("mchar_id"), document.getElementById(`mode`).checked);
  685. console.log('[P4D0K1LL] Zapisano ustawienia.');
  686. });
  687.  
  688. document.getElementById('automode').addEventListener('click', () => {
  689. localStorage.setItem("automode" + getCookie("mchar_id"), document.getElementById(`automode`).checked);
  690. console.log('[P4D0K1LL] Zapisano ustawienia.');
  691. });
  692.  
  693. document.getElementById('backmode').addEventListener('click', () => {
  694. localStorage.setItem("backmode" + getCookie("mchar_id"), document.getElementById(`backmode`).checked);
  695. console.log('[P4D0K1LL] Zapisano ustawienia.');
  696. });
  697.  
  698. const sendAttackReq = (id) => {
  699. if (new Date() / 60 - lastAttackReq < 0.3) return;
  700. window._g('fight&a=attack&id=' + id);
  701. lastAttackReq = new Date() / 60;
  702. }
  703. let lastAttackReq = new Date() / 60;
  704.  
  705. const searchPath = (t, s) => {
  706. if (road.length && road[0].x == t && road[0].y == s) {
  707. return false;
  708. }
  709. if (hero.isBlockedSearchPath()) return hero.blockedInfoSearchPath();
  710. var i = map.nodes.getNode(hero.x, hero.y),
  711. a = map.nodes.getNode(t, s);
  712. i.hasSameGroup(a) ||
  713. (map.nodes.clearAllNodes(),
  714. i.setScore(0, map.hce8(a, i)),
  715. (a = map.nodeSetLoop(a, i, map.findStep))),
  716. map.nodes.clearAllNodes(),
  717. i.setScore(0, map.hce(i, a)),
  718. map.nodeSetLoop(i, a, map.mapStep);
  719. var e = a;
  720. for (road = []; null !== e && e.id != i.id;)
  721. road.push({
  722. x: e.x,
  723. y: e.y,
  724. }),
  725. (e = e.from);
  726. null !== e &&
  727. road.push({
  728. x: e.x,
  729. y: e.y,
  730. });
  731. };
  732.  
  733.  
  734. const backTo = async () => {
  735. while (true) {
  736. if (window.g.init < 5) {
  737. await sleep(2000);
  738. continue;
  739. }
  740. let enemies = Object.values(g.other).filter(obj => {
  741. 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];
  742. });
  743. if (document.getElementById("mode").checked && window.map.pvp == 2 && document.getElementById("backmode").checked && enemies == '') {
  744. if (hero.x != document.getElementById("coords").value.split(",")[0] || hero.y != document.getElementById("coords").value.split(",")[1]) {
  745. searchPath(parseInt(document.getElementById("coords").value.split(",")[0]), parseInt(document.getElementById("coords").value.split(",")[1]));
  746. }
  747. }
  748. await sleep(Math.random() * (900 - 700) + 900);
  749. }
  750. }
  751. window.onload = backTo();
  752.  
  753. const initX = async () => {
  754. while (true) {
  755. if (window.g.init < 5) {
  756. await sleep(2000);
  757. continue;
  758. }
  759. let targets = [];
  760. const getOthers = Object.values(g.other).filter(obj => {
  761. 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];
  762. });
  763. if (document.getElementById('mode').checked && window.map.pvp == 2) {
  764. for (const i in getOthers) {
  765. let emoBattle = document.querySelector('#other' + getOthers[i].id).querySelector('.emo-cointainer > .emo.emo-battle');
  766. let pvpProtected = document.querySelector('#other' + getOthers[i].id).querySelector('.emo-cointainer > .emo.emo-pvpprotected');
  767. if (emoBattle == null || emoBattle == undefined) {
  768. if (pvpProtected == null || pvpProtected == undefined) {
  769. targets.push({
  770. id: getOthers[i].id,
  771. x: getOthers[i].x,
  772. y: getOthers[i].y,
  773. distance: Math.abs(hero.x - getOthers[i].x) + Math.abs(hero.y - getOthers[i].y)
  774. });
  775. }
  776. }
  777. }
  778. if (targets != '') {
  779. targets = targets.sort((a, b) => (a.distance > b.distance) ? 1 : -1);
  780. if (targets[0].distance > 2 && document.getElementById("follow").checked) {
  781. searchPath(targets[0].x, targets[0].y);
  782. } else sendAttackReq(targets[0].id);
  783. } else if (document.getElementById("automode").checked) {
  784. if (g.battle) {
  785. if ($("#autobattleButton").css("display") == "block") {
  786. $("#autobattleButton").click()
  787. }
  788. }
  789. }
  790. }
  791. await sleep(50);
  792. }
  793. }
  794. window.onload = initX();
  795.  
  796. })(typeof unsafeWindow !== "undefined" ? unsafeWindow : window, (ms) => new Promise((resolve) => setTimeout(resolve, ms)));// ==UserScript==
  797. // @name AUTOX SI
  798. // @namespace http://tampermonkey.net/
  799. // @version 2.3
  800. // @description Skrypt automatycznie biega za graczem, wraca na kordy po zabiciu itd.
  801. // @author Padonim
  802. // @match https://fobos.margonem.pl/
  803. // @start-at document-idle
  804. // @grant GM_setValue
  805. // @grant GM_getValue
  806. // ==/UserScript==
  807.  
  808. (async (window, sleep) => {
  809.  
  810. const initCSS = () => {
  811.  
  812. const $container2 = $('<div id="p4d0k1ll"></div>').css({
  813. 'width':'120px',
  814. 'position':'absolute',
  815. 'z-index':'999',
  816. 'background':'rgba(15, 15, 15, 0.85)',
  817. 'border':'1px solid orange',
  818. 'color':'white'
  819. });
  820. const $head = $('<div id="p4d0k1ll-head"></div>').css({
  821. 'width':'120px',
  822. 'height':'25px',
  823. });
  824.  
  825. const $body = $('<div id="p4d0k1ll-body"></div>').css({
  826. 'width':'120px',
  827. 'height':'40px',
  828. 'font-size':'8px'
  829. })
  830.  
  831. const $settings_input = $('<div id="p4d0k1ll-settings">⚙️</div>').css({
  832. 'float':'left'
  833. });
  834.  
  835. const $mode_input = $('<input type="checkbox" id="mode" tabindex="0">').css({
  836. 'float':'left'
  837. });
  838.  
  839. const $levels_input = $('<input type="text" id="levels" autocomplete="off" placeholder="MIN-MAX">').css({
  840. 'width':'65px',
  841. 'height':'15px',
  842. 'background':'rgba(15, 15, 15, 0.45)',
  843. 'border':'0',
  844. 'border-bottom':'1px dotted orange',
  845. 'color':'orange',
  846. 'text-align':'center',
  847. 'float':'left'
  848. });
  849.  
  850. const $backmode_input = $('<input type="checkbox" id="backmode" tabindex="0"><small>KORDY</small>').css({
  851. 'float':'left'
  852. });
  853.  
  854. const $coords_input = $('<input type="text" id="coords" autocomplete="off" placeholder="X,Y">').css({
  855. 'width':'55px',
  856. 'height':'15px',
  857. 'background':'rgba(15, 15, 15, 0.45)',
  858. 'border':'0',
  859. 'border-bottom':'1px dotted orange',
  860. 'color':'orange',
  861. 'text-align':'center',
  862. 'float':'left'
  863. });
  864.  
  865. const $automode_input = $('<span style="clear: both;"></span><input type="checkbox" id="automode"><small>AUTO F</small><br>').css({
  866. 'float':'left',
  867. 'text-align':'left'
  868. });
  869.  
  870. const $follow_input = $('<input type="checkbox" id="follow"><small>FOLLOW</small>').css({
  871. 'float':'left',
  872. 'text-align':'left'
  873. });
  874.  
  875. $("body").append($container2);
  876. $("#p4d0k1ll").append($head, $body);
  877. $("#p4d0k1ll-head").append($settings_input, $mode_input, $levels_input);
  878. $("#p4d0k1ll-body").append($backmode_input, $coords_input, $automode_input, $follow_input);
  879.  
  880. $('#p4d0k1ll-settings').click(function () {
  881. $('#p4d0k1ll-body').toggle('slow');
  882. });
  883.  
  884. }
  885. window.onload = initCSS();
  886.  
  887. localStorage.getItem('p4d0k1llsi') || localStorage.setItem('p4d0k1llsi', JSON.stringify({ x: 0, y: 0}));
  888.  
  889. let padoPosition = JSON.parse(localStorage.getItem('p4d0k1llsi'));
  890.  
  891. document.querySelector('#p4d0k1ll').style.left = `${padoPosition.x}`;
  892. document.querySelector('#p4d0k1ll').style.top = `${padoPosition.y}`;
  893. document.querySelector('#p4d0k1ll').style.position = 'absolute';
  894.  
  895. $(document.querySelector('#p4d0k1ll')).draggable({
  896. stop: () => {
  897. padoPosition.x = document.querySelector('#p4d0k1ll').style.left;
  898. padoPosition.y = document.querySelector('#p4d0k1ll').style.top;
  899. localStorage.setItem('p4d0k1llsi', JSON.stringify(padoPosition));
  900.  
  901. document.querySelector('#p4d0k1ll').style.left = padoPosition.x;
  902. document.querySelector('#p4d0k1ll').style.top = padoPosition.y;
  903. document.querySelector('#p4d0k1ll').style.position = 'absolute';
  904. }
  905. });
  906.  
  907. const loadSettings = () => {
  908. sleep(4000);
  909. if (localStorage.getItem('status' + getCookie("mchar_id")) == "true") {
  910. document.getElementById('mode').setAttribute('checked', 'checked');
  911. }
  912. if (localStorage.getItem('backmode' + getCookie("mchar_id")) == "true") {
  913. document.getElementById('backmode').setAttribute('checked', 'checked');
  914. }
  915. if (localStorage.getItem('automode' + getCookie("mchar_id")) == "true") {
  916. document.getElementById('automode').setAttribute('checked', 'checked');
  917. }
  918. if (localStorage.getItem('follow' + getCookie("mchar_id")) == "true") {
  919. document.getElementById('follow').setAttribute('checked', 'checked');
  920. }
  921. if (localStorage.getItem('coords' + getCookie("mchar_id")) == null || localStorage.getItem('coords' + getCookie("mchar_id")) == undefined) {
  922. localStorage.setItem('coords' + getCookie("mchar_id"), '00,00');
  923. }
  924. if (localStorage.getItem("levels" + getCookie("mchar_id")) == null || localStorage.getItem('levels' + getCookie("mchar_id")) == undefined) {
  925. localStorage.setItem("levels" + getCookie("mchar_id"), '0-500');
  926. }
  927. document.getElementById("levels").value = localStorage.getItem("levels" + getCookie("mchar_id"));
  928. document.getElementById("coords").value = localStorage.getItem("coords" + getCookie("mchar_id"));
  929. console.log('[P4D0K1LL] Załadowano ustawienia.');
  930. }
  931. window.onload = loadSettings();
  932.  
  933. document.getElementById('levels').onchange = () => {
  934. localStorage.setItem("levels" + getCookie("mchar_id"), document.getElementById("levels").value);
  935. console.log('[P4D0K1LL] Zapisano ustawienia.');
  936. }
  937.  
  938. document.getElementById('coords').onchange = () => {
  939. localStorage.setItem("coords" + getCookie("mchar_id"), document.getElementById("coords").value);
  940. console.log('[P4D0K1LL] Zapisano ustawienia.');
  941. }
  942.  
  943. document.getElementById('follow').addEventListener('click', () => {
  944. localStorage.setItem("follow" + getCookie("mchar_id"), document.getElementById(`follow`).checked);
  945. console.log('[P4D0K1LL] Zapisano ustawienia.');
  946. });
  947.  
  948. document.getElementById('mode').addEventListener('click', () => {
  949. localStorage.setItem("status" + getCookie("mchar_id"), document.getElementById(`mode`).checked);
  950. console.log('[P4D0K1LL] Zapisano ustawienia.');
  951. });
  952.  
  953. document.getElementById('automode').addEventListener('click', () => {
  954. localStorage.setItem("automode" + getCookie("mchar_id"), document.getElementById(`automode`).checked);
  955. console.log('[P4D0K1LL] Zapisano ustawienia.');
  956. });
  957.  
  958. document.getElementById('backmode').addEventListener('click', () => {
  959. localStorage.setItem("backmode" + getCookie("mchar_id"), document.getElementById(`backmode`).checked);
  960. console.log('[P4D0K1LL] Zapisano ustawienia.');
  961. });
  962.  
  963. const sendAttackReq = (id) => {
  964. if (new Date() / 60 - lastAttackReq < 0.3) return;
  965. window._g('fight&a=attack&id=' + id);
  966. lastAttackReq = new Date() / 60;
  967. }
  968. let lastAttackReq = new Date() / 60;
  969.  
  970. const searchPath = (t, s) => {
  971. if (road.length && road[0].x == t && road[0].y == s) {
  972. return false;
  973. }
  974. if (hero.isBlockedSearchPath()) return hero.blockedInfoSearchPath();
  975. var i = map.nodes.getNode(hero.x, hero.y),
  976. a = map.nodes.getNode(t, s);
  977. i.hasSameGroup(a) ||
  978. (map.nodes.clearAllNodes(),
  979. i.setScore(0, map.hce8(a, i)),
  980. (a = map.nodeSetLoop(a, i, map.findStep))),
  981. map.nodes.clearAllNodes(),
  982. i.setScore(0, map.hce(i, a)),
  983. map.nodeSetLoop(i, a, map.mapStep);
  984. var e = a;
  985. for (road = []; null !== e && e.id != i.id;)
  986. road.push({
  987. x: e.x,
  988. y: e.y,
  989. }),
  990. (e = e.from);
  991. null !== e &&
  992. road.push({
  993. x: e.x,
  994. y: e.y,
  995. });
  996. };
  997.  
  998.  
  999. const backTo = async () => {
  1000. while (true) {
  1001. if (window.g.init < 5) {
  1002. await sleep(2000);
  1003. continue;
  1004. }
  1005. let enemies = Object.values(g.other).filter(obj => {
  1006. 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];
  1007. });
  1008. if (document.getElementById("mode").checked && window.map.pvp == 2 && document.getElementById("backmode").checked && enemies == '') {
  1009. if (hero.x != document.getElementById("coords").value.split(",")[0] || hero.y != document.getElementById("coords").value.split(",")[1]) {
  1010. searchPath(parseInt(document.getElementById("coords").value.split(",")[0]), parseInt(document.getElementById("coords").value.split(",")[1]));
  1011. }
  1012. }
  1013. await sleep(Math.random() * (900 - 700) + 900);
  1014. }
  1015. }
  1016. window.onload = backTo();
  1017.  
  1018. const initX = async () => {
  1019. while (true) {
  1020. if (window.g.init < 5) {
  1021. await sleep(2000);
  1022. continue;
  1023. }
  1024. let targets = [];
  1025. const getOthers = Object.values(g.other).filter(obj => {
  1026. 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];
  1027. });
  1028. if (document.getElementById('mode').checked && window.map.pvp == 2) {
  1029. for (const i in getOthers) {
  1030. let emoBattle = document.querySelector('#other' + getOthers[i].id).querySelector('.emo-cointainer > .emo.emo-battle');
  1031. let pvpProtected = document.querySelector('#other' + getOthers[i].id).querySelector('.emo-cointainer > .emo.emo-pvpprotected');
  1032. if (emoBattle == null || emoBattle == undefined) {
  1033. if (pvpProtected == null || pvpProtected == undefined) {
  1034. targets.push({
  1035. id: getOthers[i].id,
  1036. x: getOthers[i].x,
  1037. y: getOthers[i].y,
  1038. distance: Math.abs(hero.x - getOthers[i].x) + Math.abs(hero.y - getOthers[i].y)
  1039. });
  1040. }
  1041. }
  1042. }
  1043. if (targets != '') {
  1044. targets = targets.sort((a, b) => (a.distance > b.distance) ? 1 : -1);
  1045. if (targets[0].distance > 2 && document.getElementById("follow").checked) {
  1046. searchPath(targets[0].x, targets[0].y);
  1047. } else sendAttackReq(targets[0].id);
  1048. } else if (document.getElementById("automode").checked) {
  1049. if (g.battle) {
  1050. if ($("#autobattleButton").css("display") == "block") {
  1051. $("#autobattleButton").click()
  1052. }
  1053. }
  1054. }
  1055. }
  1056. await sleep(50);
  1057. }
  1058. }
  1059. window.onload = initX();
  1060.  
  1061. })(typeof unsafeWindow !== "undefined" ? unsafeWindow : window, (ms) => new Promise((resolve) => setTimeout(resolve, ms)));
Advertisement
Add Comment
Please, Sign In to add comment