Performance Settings

Adds some performance options to the settings menu. Adds options "Performance Mode" and "Quick Dust Removal".

  1. // ==UserScript==
  2. // @name Performance Settings
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.4
  5. // @description Adds some performance options to the settings menu. Adds options "Performance Mode" and "Quick Dust Removal".
  6. // @author Zoltar
  7. // @match http://manyland.com/*
  8. // @icon https://cdn.discordapp.com/icons/852442189283983380/a_70793eeb1f509f9c4aa1021e5691fab4.webp
  9. // @grant GM.setValue
  10. // @grant GM.getValue
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. 'use strict';
  15.  
  16. // took this part from Eternity's mod
  17. function loadObf() {
  18. if (typeof Deobfuscator === 'undefined')
  19. return $.getScript("https://cdn.jsdelivr.net/gh/parseml/many-deobf@latest/deobf.js")
  20. }
  21.  
  22.  
  23. async function main() {
  24. ig.game.settings.add = Deobfuscator.function(ig.game.settings, 'Math.min(ig.system.scale,5)', true);
  25. ig.game.settings.header = Deobfuscator.function(ig.game.settings, 'text-transform: uppercase;', true);
  26.  
  27. let performanceSetting = await GM.getValue("performance");
  28. let dustSetting = await GM.getValue("dust");
  29.  
  30. ig.game.settings.performanceMode = function () {
  31. if (!this.pmodeon) {
  32. this.pInterval = setInterval(() => {
  33. for (let entity of ig.game.entities) {
  34. if (Object.keys(entity.anims).includes('cell1') || entity.type == 0 && !Object.keys(entity.anims).includes('normal')) {
  35. entity.kill();
  36. } else if (typeof entity.anims.main !== 'undefined' && !Object.keys(entity.anims).includes('run')) {
  37. if (entity.anims.main.timer.base > 0)
  38. entity.kill()
  39. }
  40. }
  41. }, 250)
  42. this.pmodeon = !this.pmodeon;
  43. GM.setValue("performance", this.pmodeon);
  44. } else {
  45. this.pmodeon = !this.pmodeon;
  46. GM.setValue("performance", this.pmodeon);
  47. clearInterval(this.pInterval);
  48. }
  49. }
  50.  
  51. ig.game.settings.duster = function () {
  52.  
  53. if (!this.dustr) {
  54. this.dustInterval = setInterval(() => {
  55. for (let entity of ig.game.entities) {
  56. if (typeof entity.animSheet != 'undefined' && entity.animSheet != null) {
  57. if (typeof entity.animSheet.image != 'undefined') {
  58. if (entity.animSheet.image.path == "extracted/bigdust" || entity.animSheet.image.path == "extracted/dust") {
  59. entity.kill();
  60. }
  61. }
  62. }
  63.  
  64. }
  65. }, 250)
  66. this.dustr = !this.dustr;
  67. GM.setValue("dust", this.dustr);
  68. } else {
  69. this.dustr = !this.dustr;
  70. GM.setValue("dust", this.dustr);
  71. clearInterval(this.dustInterval);
  72. }
  73. }
  74.  
  75. if (typeof performanceSetting != 'undefined') {
  76. ig.game.settings.pmodeon = performanceSetting;
  77.  
  78. } else {
  79. ig.game.settings.pmodeon = false;
  80. }
  81.  
  82. if (typeof dustSetting != 'undefined') {
  83. ig.game.settings.dustr = dustSetting;
  84.  
  85. } else {
  86. ig.game.settings.dustr = false;
  87. }
  88.  
  89. if (ig.game.settings.pmodeon) {
  90. ig.game.settings.pmodeon = !ig.game.settings.pmodeon;
  91. ig.game.settings.performanceMode();
  92.  
  93. }
  94.  
  95. if (ig.game.settings.dustr) {
  96. ig.game.settings.dustr = !ig.game.settings.dustr;
  97. ig.game.settings.duster();
  98. }
  99.  
  100. ig.game.settings.dustInterval = 1;
  101. ig.game.settings.pInterval = 1;
  102.  
  103.  
  104.  
  105. eval('ig.game.settings.openDialog = function(){ ' + ig.game.settings.openDialog.toString().split('function(){')[1].split('a+="</div>";').join(`a += this.${ig.game.settings.header}("Performance"); a += this.${ig.game.settings.add}("pmodeon", "Performance Mode", null, "ig.game.settings.performanceMode()", this.pmodeon); a += this.${ig.game.settings.add}("dustr", "Quick Dust Removal", null, "ig.game.settings.duster()", this.dustr); a+="</div>";`));
  106. }
  107.  
  108. // Parses smooth loader
  109. !async function loader() {
  110. let loading = setInterval(async function () {
  111. if (typeof ig === "undefined") return
  112. else if (typeof ig.game === "undefined") return
  113. else if (typeof ig.game.screen === "undefined") return
  114. else if (ig.game.screen.x == 0) return
  115. else if (typeof Settings !== "function") return
  116.  
  117. clearInterval(loading);
  118. await loadObf();
  119. main();
  120. }, 250)
  121. }()
  122. })();