kill counter

script to display number of kills

  1. // ==UserScript==
  2. // @name kill counter
  3. // @namespace http://tampermonkey.net/
  4. // @version 2.0
  5. // @description script to display number of kills
  6. // @author Python Coder
  7. // @match https://shellshock.io/*
  8. // @license MIT
  9. // ==/UserScript==
  10.  
  11. var egg_count = 0;
  12. var target = 0;
  13. var needed = 0;
  14. var increment = 20;
  15.  
  16. function eggs() {
  17. const eggCountElement = document.querySelector('.egg_count');
  18. if (eggCountElement && eggCountElement.innerText) {
  19. const eggCount = parseInt(eggCountElement.innerText.trim());
  20. return isNaN(eggCount) ? 0 : eggCount;
  21. } else {
  22. return 0; // Return a default value if the element or its content is not found
  23. }
  24. }
  25.  
  26. function targeted(defaultValue) {
  27. const userInput = prompt(`Enter a value (current is ${defaultValue}):`) || defaultValue;
  28. target = userInput;
  29. updateValues(); // Update values when the target changes
  30. }
  31.  
  32. function calculation(egg_targeted, currentlyNoofEggs) {
  33. return Math.ceil((egg_targeted - currentlyNoofEggs) / increment);
  34. }
  35.  
  36.  
  37. function message(value) {
  38. const result = 'kills: ' + value;
  39. return result;
  40. }
  41.  
  42. function updateValues() {
  43. egg_count = eggs();
  44. displayStyledBox('eggs: ' + egg_count, '50px', '150px');
  45. needed = calculation(target, egg_count);
  46. displayStyledBox(message(needed), '10px', '150px');
  47. }
  48.  
  49.  
  50. function displayStyledBox(message, top, right) {
  51. // Remove previous box if it exists
  52. const previousBox = document.getElementById('styled-box');
  53. if (previousBox) {
  54. previousBox.remove();
  55. }
  56.  
  57. // Create a div element for the box
  58. const box = document.createElement('div');
  59.  
  60. // Set styles for the box
  61. box.id = 'styled-box'; // Add an ID for easy identification
  62. box.style.position = 'fixed';
  63. box.style.top = top;
  64. box.style.right = right;
  65. box.style.transform = 'translateX(-50%)';
  66. box.style.backgroundColor = 'rgba(0, 0, 255, 0.8)'; // Blue background with 80% opacity
  67. box.style.color = '#fff'; // White text color
  68. box.style.padding = '10px';
  69. box.style.borderRadius = '5px';
  70. box.style.boxShadow = '0 4px 8px rgba(0, 0, 0, 0.2)'; // Box shadow for a subtle effect
  71. box.style.zIndex = '9999'; // Set a high z-index value
  72.  
  73. // Add content to the box (message)
  74. box.innerText = message;
  75.  
  76. // Append the box to the body
  77. document.body.appendChild(box);
  78. }
  79.  
  80.  
  81. function createStyledButton(top, bottom) {
  82. // Create a button element
  83. const button = document.createElement('button');
  84.  
  85. // Set styles for the button
  86. button.style.position = 'fixed';
  87. button.style.top = top;
  88. button.style.right = bottom;
  89. button.style.transform = 'translateX(-50%)';
  90. button.style.backgroundColor = 'rgba(0, 0, 255, 0.8)'; // Matching blue background
  91. button.style.color = '#fff'; // White text color
  92. button.style.padding = '10px';
  93. button.style.border = 'none';
  94. button.style.borderRadius = '5px';
  95. button.style.cursor = 'pointer';
  96. button.style.zIndex = '9999'; // Set a high z-index value
  97.  
  98. // Add text to the button
  99. button.innerText = 'change target';
  100.  
  101. // Add a click event listener to the button
  102. button.addEventListener('click', function() {
  103. targeted(target);
  104. });
  105.  
  106. // Append the button to the body
  107. document.body.appendChild(button);
  108. }
  109.  
  110. (function() {
  111. 'use strict';
  112. updateValues();
  113. createStyledButton('10px', '0px');
  114. // Remove setInterval since we're updating values dynamically
  115. })();