Guest User

Zombs.io

a guest
Jul 16th, 2019
3,609
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.52 KB | None | 0 0
  1. // ==UserScript==
  2. // @name |TC|Auto Upgrage + Auto Sell + Auto Harvester + MORE !!!
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description go to scripts its the best
  6. // @author Kurt
  7. // @match http://zombs.io/
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. window.addEventListener("load", function(e) {
  12. var menu = document.getElementsByClassName("hud-menu-scripts")[0];
  13. var AHRC_html = `</br><div class='AHRC'>
  14. <p class='AHRCtxt'>Enable AHRC!</p>
  15. <button class='AHRCbtn'>Click me!</button>
  16. </div>`;
  17. var SELLALL_html = `</br><div class='SELLALL'>
  18. <p class='SELLALLtxt'>Enable Sell All!</p>
  19. <button class='SELLALLbtn'>Click Me!</button>
  20. </div>`;
  21. var UPGRADEALL_html = `</br><div class='UPGRADEALL'>
  22. <p class='UPGRADEALLtxt'>Enable Upgrade All!</p>
  23. <button class='UPGRADEALLbtn'>Click Me!</button>
  24. </div>`;
  25.  
  26. menu.innerHTML += AHRC_html;
  27. menu.innerHTML += SELLALL_html;
  28. menu.innerHTML += UPGRADEALL_html;
  29.  
  30. var css = `
  31. <style type='text/css'>
  32. @import 'https://fonts.googleapis.com/css?family=Source+Sans+Pro:700';
  33. *, *::before, *::after {
  34. -webkit-box-sizing: border-box;
  35. -moz-box-sizing: border-box;
  36. box-sizing: border-box;
  37. }
  38. html, body {
  39. height: 100%;
  40. width: 100%;
  41. }
  42. body {
  43. padding: 0px;
  44. margin: 0;
  45. font-family: 'Source Sans Pro', sans-serif;
  46. background: #f5f0ff;
  47. -webkit-font-smoothing: antialiased;
  48. }
  49. .dark {
  50. background: #24252a;
  51. }
  52. .flex {
  53. min-height: 50vh;
  54. display: flex;
  55. align-items: center;
  56. justify-content: center;
  57. }
  58. a.bttn {
  59. color: #ff0072;
  60. text-decoration: none;
  61. -webkit-transition: 0.3s all ease;
  62. transition: 0.3s ease all;
  63. }
  64. a.bttn:hover {
  65. color: #fff;
  66. }
  67. a.bttn:focus {
  68. color: #fff;
  69. }
  70. a.bttn-dark {
  71. color: #644cad;
  72. text-decoration: none;
  73. -webkit-transition: 0.3s all ease;
  74. transition: 0.3s ease all;
  75. }
  76. a.bttn-dark:hover {
  77. color: #fff;
  78. }
  79. a.bttn-dark:focus {
  80. color: #fff;
  81. }
  82. .bttn {
  83. font-size: 18px;
  84. letter-spacing: 2px;
  85. text-transform: uppercase;
  86. display: inline-block;
  87. text-align: center;
  88. width: 270px;
  89. font-weight: bold;
  90. padding: 14px 0px;
  91. border: 3px solid #ff0072;
  92. border-radius: 2px;
  93. position: relative;
  94. box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.1);
  95. }
  96. .bttn:before {
  97. -webkit-transition: 0.5s all ease;
  98. transition: 0.5s all ease;
  99. position: absolute;
  100. top: 0;
  101. left: 50%;
  102. right: 50%;
  103. bottom: 0;
  104. opacity: 0;
  105. content: '';
  106. background-color: #ff0072;
  107. z-index: -2;
  108. }
  109. .bttn:hover:before {
  110. -webkit-transition: 0.5s all ease;
  111. transition: 0.5s all ease;
  112. left: 0;
  113. right: 0;
  114. opacity: 1;
  115. }
  116. .bttn:focus:before {
  117. transition: 0.5s all ease;
  118. left: 0;
  119. right: 0;
  120. opacity: 1;
  121. }
  122. .bttn-dark {
  123. font-size: 18px;
  124. letter-spacing: 2px;
  125. text-transform: uppercase;
  126. display: inline-block;
  127. text-align: center;
  128. width: 270px;
  129. font-weight: bold;
  130. padding: 14px 0px;
  131. border: 3px solid #644cad;
  132. border-radius: 2px;
  133. position: relative;
  134. box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.1);
  135. z-index: 2;
  136. }
  137. .bttn-dark:before {
  138. -webkit-transition: 0.5s all ease;
  139. transition: 0.5s all ease;
  140. position: absolute;
  141. top: 0;
  142. left: 50%;
  143. right: 50%;
  144. bottom: 0;
  145. opacity: 0;
  146. content: '';
  147. background-color: #644cad;
  148. z-index: -1;
  149. }
  150. .bttn-dark:hover:before {
  151. -webkit-transition: 0.5s all ease;
  152. transition: 0.5s all ease;
  153. left: 0;
  154. right: 0;
  155. opacity: 1;
  156. }
  157. .bttn-dark:focus:before {
  158. -webkit-transition: 0.5s all ease;
  159. transition: 0.5s all ease;
  160. left: 0;
  161. right: 0;
  162. opacity: 1;
  163. }
  164. </style>
  165. `;
  166.  
  167. function REFUEL() {
  168. var entities = Game.currentGame.world.entities;
  169. for(var uid in entities) {
  170. if(!entities.hasOwnProperty(uid)) continue;
  171. var obj = entities[uid];
  172. if(obj.fromTick.model == "Harvester") {
  173. let e = Game.currentGame.world.getEntityByUid(obj.fromTick.uid).getTargetTick();
  174. let i = Math.floor(e.depositMax);
  175. Game.currentGame.network.sendRpc({
  176. name: "AddDepositToHarvester",
  177. uid: obj.fromTick.uid,
  178. deposit: i
  179. });
  180. }
  181. }
  182. }
  183.  
  184. function COLLECT() {
  185. var entities = Game.currentGame.world.entities;
  186. for(var uid in entities) {
  187. if(!entities.hasOwnProperty(uid)) continue;
  188. var obj = entities[uid];
  189. if(obj.fromTick.model == "Harvester") {
  190. Game.currentGame.network.sendRpc({
  191. name: "CollectHarvester",
  192. uid: obj.fromTick.uid
  193. });
  194. }
  195. }
  196. }
  197.  
  198. function SELLALL() {
  199. var entities = Game.currentGame.world.entities;
  200. for(var uid in entities) {
  201. if(!entities.hasOwnProperty(uid)) continue;
  202. var obj = entities[uid];
  203. if(obj.fromTick.model !== "GoldStash") {
  204. Game.currentGame.network.sendRpc({
  205. name: "DeleteBuilding",
  206. uid: obj.fromTick.uid
  207. });
  208. }
  209. }
  210. }
  211.  
  212. function UPGRADEALL() {
  213. var entities = Game.currentGame.world.entities;
  214. for(var uid in entities) {
  215. if(!entities.hasOwnProperty(uid)) continue;
  216. var obj = entities[uid];
  217. if(obj.fromTick.model !== "GoldStash") {
  218. Game.currentGame.network.sendRpc({
  219. name: "UpgradeBuilding",
  220. uid: obj.fromTick.uid
  221. });
  222. }
  223. }
  224. }
  225.  
  226. function UPGRADESTASH() {
  227. var entities = Game.currentGame.world.entities;
  228. for(var uid in entities) {
  229. if(!entities.hasOwnProperty(uid)) continue;
  230. var obj = entities[uid];
  231. if(obj.fromTick.model == "GoldStash") {
  232. Game.currentGame.network.sendRpc({
  233. name: "UpgradeBuilding",
  234. uid: obj.fromTick.uid
  235. });
  236. }
  237. }
  238. }
  239.  
  240. var enableAHRC = document.getElementsByClassName("AHRCbtn")[0];
  241. var enableAHRCTxt = document.getElementsByClassName("AHRCtxt")[0];
  242. var id = null;
  243. enableAHRC.addEventListener("click", function(e) {
  244. if(enableAHRCTxt.innerText == "Enable AHRC!") {
  245. id = setInterval(function() {
  246. COLLECT();
  247. REFUEL();
  248. }, 1000);
  249. enableAHRCTxt.innerText = "Disable AHRC!";
  250. } else {
  251. enableAHRCTxt.innerText = "Enable AHRC!";
  252. clearInterval(id);
  253. id = null;
  254. }
  255. });
  256.  
  257. document.body.insertAdjacentHTML("beforeend", css);
  258. enableAHRC.classList.add("bttn-dark");
  259.  
  260. var enableSELLALL = document.getElementsByClassName("SELLALLbtn")[0];
  261. var enableSELLALLTxt = document.getElementsByClassName("SELLALLtxt")[0];
  262. enableSELLALL.addEventListener("click", function(e) {
  263. if(enableSELLALLTxt.innerText == "Enable Sell All!") {
  264. id = setInterval(function() {
  265. SELLALL();
  266. }, 1);
  267. enableSELLALLTxt.innerText = "Disable Sell All!";
  268. } else {
  269. enableSELLALLTxt.innerText = "Enable Sell All!";
  270. clearInterval(id);
  271. id = null;
  272. }
  273. });
  274.  
  275. document.body.insertAdjacentHTML("beforeend", css);
  276. enableSELLALL.classList.add("bttn-dark");
  277.  
  278. var enableUPGRADEALL = document.getElementsByClassName("UPGRADEALLbtn")[0];
  279. var enableUPGRADEALLTxt = document.getElementsByClassName("UPGRADEALLtxt")[0];
  280. enableUPGRADEALL.addEventListener("click", function(e) {
  281. if(enableUPGRADEALLTxt.innerText == "Enable Upgrade All!") {
  282. id = setInterval(function() {
  283. UPGRADEALL();
  284. UPGRADESTASH();
  285. }, 1);
  286. enableUPGRADEALLTxt.innerText = "Disable Upgrade All!";
  287. } else {
  288. enableUPGRADEALLTxt.innerText = "Enable Upgrade All!";
  289. clearInterval(id);
  290. id = null;
  291. }
  292. });
  293. document.body.insertAdjacentHTML("beforeend", css);
  294. enableUPGRADEALL.classList.add("bttn-dark");
  295. });
  296.  
  297. (function() {
  298. let styles = document.createTextNode(`
  299. .hud-menu-scripts {
  300. display: none;
  301. position: fixed;
  302. top: 50%;
  303. left: 50%;
  304. width: 920px;
  305. height: 580px;
  306. margin: -350px 0 0 -460px;
  307. padding: 20px 340px 20px 20px;
  308. background: rgba(0, 0, 0, 0.6);
  309. color: #eee;
  310. border-radius: 4px;
  311. z-index: 15;
  312. }
  313. .hud-menu-icons .hud-menu-icon[data-type=Scripts]::before {
  314. background-image: url('https://i.imgur.com/Igqp5Pc.png');
  315. `);
  316. let css = document.createElement("style");
  317. css.type = "text/css";
  318. css.appendChild(styles);
  319. document.body.appendChild(css);
  320. let menu_html = "<div class='hud-menu-scripts'></div>";
  321. document.body.insertAdjacentHTML("afterbegin", menu_html);
  322. let menu_scripts = document.getElementsByClassName('hud-menu-scripts')[0];
  323. var allItems = document.getElementsByClassName("myCustomIcon");
  324. var menus = document.getElementsByClassName("hud-menu");
  325.  
  326. var newMenuItem = document.createElement("div");
  327. newMenuItem.classList.add("hud-menu-icon");
  328. newMenuItem.classList.add("myCustomIcon");
  329. newMenuItem.setAttribute("data-type", "Scripts");
  330. newMenuItem.innerHTML = "Scripts";
  331. document.getElementById("hud-menu-icons").appendChild(newMenuItem);
  332.  
  333. var allItems = document.getElementsByClassName("myCustomIcon");
  334. for(var item = 0; item < allItems.length; item++) {
  335. allItems[item].addEventListener("mouseenter", onMenuItemEnter, false);
  336. allItems[item].addEventListener("mouseleave", onMenuItemLeave, false);
  337. }
  338.  
  339. function onMenuItemEnter() {
  340. var theTooltip = document.createElement("div");
  341. theTooltip.classList.add("hud-tooltip");
  342. theTooltip.classList.add("hud-tooltip-left");
  343. theTooltip.id = "hud-tooltip";
  344. theTooltip.innerHTML = `<div class="hud-tooltip-menu-icon">
  345. <h4>Scripts</h4>
  346. </div>`;
  347.  
  348. this.appendChild(theTooltip)
  349.  
  350. theTooltip.style.top = "-10px";
  351. theTooltip.style.bottom = 0
  352. theTooltip.style.left = "-96.4px";
  353. theTooltip.style.right = 0;
  354. theTooltip.style.width = "78.5px";
  355. theTooltip.style.fontSize = "16.7px";
  356. theTooltip.style.fontWeight = "bold";
  357. theTooltip.style.position = "relative";
  358. theTooltip.style.textIndent = 0;
  359. }
  360.  
  361. function onMenuItemLeave() {
  362. this.removeChild(document.getElementById("hud-tooltip"));
  363. }
  364.  
  365. document.getElementsByClassName('hud-menu-icon')[3].addEventListener("click", function(e) {
  366. if(menu_scripts.style.display == "none") {
  367. menu_scripts.style.display = "block";
  368. for(var i = 0; i < menus.length; i++) {
  369. menus[i].style.display = "none";
  370. }
  371. } else {
  372. menu_scripts.style.display = "none";
  373. }
  374. });
  375. let icons = document.getElementsByClassName("hud-menu-icon");
  376. let menu_icons = [
  377. icons[0],
  378. icons[1],
  379. icons[2]
  380. ]
  381. menu_icons.forEach(function(elem) {
  382. elem.addEventListener("click", function(e) {
  383. if(menu_scripts.style.display == "block") {
  384. menu_scripts.style.display = "none";
  385. }
  386. })
  387. })
  388. window.addEventListener('mouseup', function(event) {
  389. if(event.target !== menu_scripts && event.target.parentNode !== menu_scripts) {
  390. menu_scripts.style.display = 'none';
  391. }
  392. })
  393. })();
Advertisement
Add Comment
Please, Sign In to add comment