ADR Cheats

Javascript based cheats for A Dark Room

当前为 2019-11-16 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name ADR Cheats
  3. // @namespace ew0345
  4. // @author Ew0345
  5. // @description Javascript based cheats for A Dark Room
  6. // @version 2.2
  7. // @homepage https://youtube.com/user/ew0345
  8. // @icon https://i.imgur.com/iRck696.png
  9. // @match http://adarkroom.doublespeakgames.com/
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. /*
  14. * Game Link: http://adarkroom.doublespeakgames.com/
  15. *
  16. * Updates:
  17. * 1.1 - Added additional resources (weren't in my original js that I used to make this)
  18. * 1.2 - Made Auto Stoke/Gather/Check into individual keybinds
  19. * 1.3 - Changed $SM.set to $SM.add so that it adds the resources/weapons instead of just setting them
  20. * 1.4 - Changed from If Statements to switch statements
  21. * 1.5 - Added: No Food/Water Consumption, Cured Meat/Medicine heals 50k, 999,999,999 HP, 999,999 Weight (Rucksack space), Add 100 Cured Meat & Medicine to current amount in rucksack, and reset embark timer.
  22. * 1.6 - Added notification message in the games notifications for enabling cheats, made things a bit more modular, and also added Userscript stuff
  23. * 2.0 - Added a cheat menu with buttons for the cheats. Keybinds still work in place of them if you don't want to use it
  24. * 2.1 - Put the stuff being appended into it's own function as well as changed the buttons to be append through an array and a for-statement
  25. * 2.2 - Added some checking to Stoke, Gather and Check which should stop any errors from not having things unlocked.
  26. *
  27. * Keycode List:
  28. * Numpad 0 - 9: 96-105
  29. * Numpad *: 106
  30. * Numpad +: 107
  31. * Numpad -: 109
  32. * Numpad .: 110
  33. * Numpad /: 111
  34. *
  35. * Things that work but are glitchy/will cause lots of errors
  36. * setting interval for Ship Upgrades: reinforceButton.click() & engineButton.click()
  37. * setting interval for buying the Scout Maps: buyMap.click()
  38. * Additional Note: Change 'var amount' to the amount of resource you want. For max amount you can use $SM.MAX_STORE as the amount.
  39. * Bug: Doesn't seem to add beyond the initial added amount for some resources and weapons. Not sure why.
  40. * Bug: Interface doesn't update when setting HP, Rucksack space, adding things to rucksack etc until you do something to update the interface.
  41. */
  42. alert ('Welcome to ADR Cheats - Open console for info');
  43. function ListOfKeys() {
  44. Notifications.printMessage('Open browser console to view keybinds');
  45. console.log('Keylist:\n'
  46. +' Numpad 0 - Auto Stoke Fire\n'
  47. +' Numpad 1 - Auto Gather Wood\n'
  48. +' Numpad 2 - Auto Check Trap\n'
  49. +' Numpad 3 - 10,000 of all resources\n'
  50. +' Numpad 4 - 10,000 of all weapons\n'
  51. +' Numpad 5 - All Perks\n'
  52. +' Numpad 6 - No Water/Food Consumption on movement\n'
  53. +' Numpad 7 - Cured Meat/Medicine Heals 50,000 HP\n'
  54. +' Numpad 8 - Sets Base HP (Before Armor) to 999,999,999 and heals you to your max health (BASE_HEALTH + HP From Armor) (Heal does not work in combat)\n'
  55. +' Numpad 9 - Sets rucksack space to 999,999\n'
  56. +' Numpad * - Adds 100 to current medicine and cured meat in rucksack while exploring\n'
  57. +' Numpad + - Reset embark timer so you can instantly embark again\n'
  58. +' Numpad . - This Message\n\n'
  59. +'Anything that updates the interface while out in the world will not update the interface until you have moved or casued another interface to open up.');
  60. }
  61.  
  62. var amount = 10000;
  63. var resources = ['alien alloy', 'bait', 'bullets', 'charm', 'cloth', 'coal', 'compass', 'cured meat', 'energy cell', 'fur', 'iron', 'leather', 'meat', 'medicine', 'scales', 'steel', 'teeth', 'torch', 'wood'];
  64. var weapons = ['bayonet', 'bolas', 'bone spear', 'iron sword', 'steel sword', 'rifle', 'laser rifle', 'grenade'];
  65. var perks = ['barbarian', 'boxer', 'desert rat', 'evasive', 'gastronome', 'martial artist', 'percise', 'scout', 'slow metabolism', 'stealthy', 'unarmed master'];
  66. var heal = 50000;
  67. var basehp = 999999;
  68. var bagspace = 999999;
  69. var medsamount = 100;
  70.  
  71. var cm = document.createElement('div');
  72. var bar = document.createElement('hr');
  73. var bar2 = document.createElement('hr');
  74. var btn1 = document.createElement('button');
  75. var btn2 = document.createElement('button');
  76. var btn3 = document.createElement('button');
  77. var btn4 = document.createElement('button');
  78. var btn5 = document.createElement('button');
  79. var btn6 = document.createElement('button');
  80. var btn7 = document.createElement('button');
  81. var btn8 = document.createElement('button');
  82. var btn9 = document.createElement('button');
  83. var btn10 = document.createElement('button');
  84. var btn11 = document.createElement('button');
  85.  
  86. cm.innerHTML = "--Cheat Menu-- ";
  87. cm.id = "cm";
  88. cm.style="text-align: center;"
  89.  
  90. btn1.innerHTML = "Auto Stoke";
  91. btn1.style = "cursor: pointer;";
  92. btn1.addEventListener('click', ADR_Stoke);
  93.  
  94. btn2.innerHTML = "Auto Gather";
  95. btn2.style = "cursor: pointer;";
  96. btn2.addEventListener('click', ADR_Gather);
  97.  
  98. btn3.innerHTML = "Auto Check";
  99. btn3.style = "cursor: pointer;";
  100. btn3.addEventListener('click', ADR_Check);
  101.  
  102. btn4.innerHTML = "Resources";
  103. btn4.style = "cursor: pointer;";
  104. btn4.addEventListener('click', ADR_Resources);
  105.  
  106. btn5.innerHTML = "Weapons";
  107. btn5.style = "cursor: pointer;";
  108. btn5.addEventListener('click', ADR_Weapons);
  109.  
  110. btn6.innerHTML = "All Perks";
  111. btn6.style = "cursor: pointer;";
  112. btn6.addEventListener('click', ADR_AllPerks);
  113.  
  114. btn7.innerHTML = "No Water/Food Use";
  115. btn7.style = "cursor: pointer;";
  116. btn7.addEventListener('click', ADR_NoWaterFood);
  117.  
  118. btn8.innerHTML = "More Health from Food/Meds";
  119. btn8.style = "cursor: pointer;";
  120. btn8.addEventListener('click', ADR_HighHealing);
  121.  
  122. btn9.innerHTML = "More Base HP";
  123. btn9.style = "cursor: pointer;";
  124. btn9.addEventListener('click', ADR_LotsOfHP);
  125.  
  126. btn10.innerHTML = "More Base Bag Space";
  127. btn10.style = "cursor: pointer;";
  128. btn10.addEventListener('click', ADR_Storage);
  129.  
  130. btn11.innerHTML = "Reset Death Cooldown";
  131. btn11.style = "cursor: pointer;";
  132. btn11.addEventListener('click', ADR_DeathCooldown);
  133.  
  134. function ADR_Stoke() {
  135. if ($SM.get('game.fire.value') == 0) {
  136. lightButton.click();
  137. }
  138. setInterval(function() { stokeButton.click(); }, 100);
  139.  
  140. Notifications.printMessage('Enabled Auto Fire Stoking');
  141. }
  142.  
  143. function ADR_Gather() {
  144. if ($SM.get('stores.wood') != undefined) {
  145. setInterval(function ADR_Gather() { gatherButton.click(); }, 2000);
  146. Notifications.printMessage('Enabled Auto Wood Gathering');
  147. } else if ($SM.get('stores.wood') == undefined) {
  148. Notifications.printMessage('You have not unlocked the ability to gather wood yet.');
  149. }
  150. }
  151.  
  152. function ADR_Check() {
  153. if ($SM.get('game.buildings["trap"]', true) > 0) {
  154. setInterval(function ADR_Check() { trapsButton.click(); }, 2000);
  155. Notifications.printMessage('Enabled Auto Trap Checking');
  156. setInterval(function() {
  157. while ($SM.get('game.buildings["trap"]', true) == 0) {
  158. Notifications.printMessage('No traps found; Building trap.');
  159. build_trap.click();
  160. }
  161. }, 2000);
  162. }
  163. if ($SM.get('game.buildings["trap"]', true) == 0 || $SM.get('game.buildings["trap"]', true) == undefined) {
  164. Notifications.printMessage('No traps built. Please build a trap first.');
  165. }
  166. }
  167.  
  168. function ADR_Resources() {
  169. for (var i=0; i < resources.length; i++) {
  170. $SM.add('stores.'+resources[i]+'', amount);
  171. $SM.set('stores.compass', 1);
  172. }
  173.  
  174. Notifications.printMessage('Gave '+amount+' resouces');
  175. }
  176.  
  177. function ADR_Weapons() {
  178. for (var i=0; i < weapons.length; i++) {
  179. $SM.add('stores.'+weapons[i]+'', amount);
  180. }
  181.  
  182. Notifications.printMessage('Gave '+amount+' weapons');
  183. }
  184.  
  185. function ADR_AllPerks() {
  186. for (var i=0; i < perks.length; i++) {
  187. $SM.set('character.perks["'+perks+'"]', true);
  188. }
  189.  
  190. Notifications.printMessage('Gave all perks');
  191. }
  192.  
  193. function ADR_NoWaterFood() {
  194. World.MOVES_PER_FOOD = $SM.MAX_STORE;
  195. World.MOVES_PER_WATER = $SM.MAX_STORE;
  196.  
  197. Notifications.printMessage('Moves per food and water set to: '+$SM.MAX_STORE);
  198. }
  199. function ADR_HighHealing() {
  200. World.MEAT_HEAL = heal;
  201. World.MEDS_HEAL = heal;
  202.  
  203. Notifications.printMessage('Cured Meat and Medicine now heal '+heal+' hp');
  204. }
  205.  
  206. function ADR_LotsOfHP() {
  207. World.BASE_HEALTH = basehp;
  208. World.health = World.getMaxHealth();
  209.  
  210. Notifications.printMessage('Base Health set to: '+basehp);
  211. }
  212.  
  213. function ADR_Storage() {
  214. Path.DEFAULT_BAG_SPACE = bagspace;
  215.  
  216. Notifications.printMessage('Default bag space set to: '+bagspace);
  217. }
  218.  
  219. function ADR_AddMeatMeds() {
  220. Path.outfit["cured meat"] = medsamount;
  221. Path.outfit["medicine"] = medsamount;
  222.  
  223. Notifications.printMessage('Added '+medsamount+' of Cured Meat and Medicine to rucksack');
  224. }
  225.  
  226. function ADR_DeathCooldown() {
  227. Button.clearCooldown($('#embarkButton'));
  228.  
  229. Notifications.printMessage('Embark button cooldown reset');
  230. }
  231.  
  232. window.onkeydown = function (e) {
  233. switch (e.keyCode) {
  234. case 96:
  235. ADR_Stoke();
  236. break;
  237. case 97:
  238. ADR_Gather();
  239. break;
  240. case 98:
  241. ADR_Check()
  242. break;
  243. case 99:
  244. ADR_Resources();
  245. break;
  246. case 100:
  247. ADR_Weapons();
  248. break;
  249. case 101:
  250. ADR_AllPerks();
  251. break;
  252. case 102:
  253. ADR_NoWaterFood();
  254. break;
  255. case 103:
  256. ADR_HighHealing();
  257. break;
  258. case 104:
  259. ADR_LotsOfHP();
  260. break;
  261. case 105:
  262. ADR_Storage();
  263. break;
  264. case 106:
  265. ADR_AddMeatMeds();
  266. break;
  267. case 107:
  268. ADR_DeathCooldown();
  269. break;
  270. case 110:
  271. ListOfKeys();
  272. break;
  273. default: break;
  274. }
  275. };
  276.  
  277. function appendStuff() {
  278. $('body').prepend(cm);
  279.  
  280. var btns = [btn1,btn2,btn3,btn4,btn5,btn6,btn7,btn8,btn9,btn10,btn11];
  281. for (var i = 0; i < btns.length; i++) {
  282. $('#cm').append(btns[i]);
  283. }
  284.  
  285. $('#cm').append(bar);
  286. $('body').prepend(bar2);
  287. }
  288.  
  289. ListOfKeys();
  290. appendStuff();