Melvor Idle - AutoLoot

Automatically collects loot

  1. // ==UserScript==
  2. // @name Melvor Idle - AutoLoot
  3. // @description Automatically collects loot
  4. // @version 1.1
  5. // @namespace Visua
  6. // @match https://*.melvoridle.com/*
  7. // @exclude https://wiki.melvoridle.com*
  8. // @noframes
  9. // @grant none
  10. // ==/UserScript==
  11. /* jshint esversion: 6 */
  12.  
  13. ((main) => {
  14. var script = document.createElement('script');
  15. script.textContent = `try { (${main})(); } catch (e) { console.log(e); }`;
  16. document.body.appendChild(script).parentNode.removeChild(script);
  17. })(() => {
  18. 'use strict';
  19.  
  20. function autoLoot() {
  21. setInterval(() => {
  22. if (player.manager.loot.drops.length) {
  23. player.manager.loot.lootAll();
  24. }
  25. }, 5000);
  26. }
  27.  
  28. function loadScript() {
  29. if (typeof confirmedLoaded !== 'undefined' && confirmedLoaded) {
  30. clearInterval(interval);
  31. console.log('Loading AutoLoot');
  32. autoLoot();
  33. }
  34. }
  35.  
  36. const interval = setInterval(loadScript, 1000);
  37. });