ADR Cheats

Javascript based cheats for A Dark Room

当前为 2021-08-24 提交的版本,查看 最新版本

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