Legacy Random Tank Button

Reimplements the random tank button, because for some fucking reason it was removed

  1. // ==UserScript==
  2. // @name Legacy Random Tank Button
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.2
  5. // @description Reimplements the random tank button, because for some fucking reason it was removed
  6. // @author PowfuArras // Discord: @xskt
  7. // @match *://*.woomy.app/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=woomy.app
  9. // @grant none
  10. // @run-at document-start
  11. // @license FLORRIM DEVELOPER GROUP LICENSE (https://github.com/Florrim/license/blob/main/LICENSE.md)
  12. // @credit https://game-icons.net/
  13. // ==/UserScript==
  14.  
  15. (function () {
  16. "use strict";
  17. let socket = null;
  18. const nativeWebSocketSend = WebSocket.prototype.send;
  19. WebSocket.prototype.send = function (data) {
  20. socket = this;
  21. nativeWebSocketSend.call(this, data);
  22. };
  23. window.addEventListener("load", function () {
  24. const canvas = document.getElementById("gameCanvas");
  25. const button = document.createElement("div");
  26. button.style.height = "30px";
  27. button.style.width = "30px";
  28. button.style.position = "fixed";
  29. button.style.top = "10px";
  30. button.style.left = "40px";
  31. button.style.border = "none";
  32. button.style.display = "inline-block";
  33. button.style.opacity = "0.75";
  34. button.style.backgroundImage = `url('data:image/svg+xml,%3Csvg xmlns%3D"http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg" fill%3D"%23DD0000" viewBox%3D"0 0 16 16" width%3D"20" height%3D"20"%3E%3Cpath d%3D"M 8.0528 -0.0064 L 0 5.3616 V 9.0688 L 8.0528 3.7008 L 16.104 9.0688 V 5.3616 Z M 8.0528 4.4576 L 2.7888 8.0096 V 11.1568 L 8.0528 7.6048 L 13.3152 11.1568 V 8.0096 Z M 8.0528 8.3616 L 5.0192 10.408 V 12.7648 L 8.0528 10.7424 L 11.0848 12.7648 V 10.408 Z M 8.0528 11.4976 L 5.0192 13.5184 V 15.7632 L 8.0528 13.7408 L 11.0848 15.7632 V 13.5184 Z"%3E%3C%2Fpath%3E%3C%2Fsvg%3E')`;
  35. button.style.backgroundRepeat = "no-repeat";
  36. button.style.backgroundPosition = "center";
  37. button.style.zIndex = 102;
  38. document.body.appendChild(button);
  39. button.addEventListener("click", function () {
  40. canvas.focus();
  41. if (socket === null) {
  42. return null;
  43. }
  44. for (let i = 0; i < 6; i++) {
  45. socket.talk("U", "random");
  46. }
  47. });
  48. });
  49. })();