EvoWorld.io Boss Timer

Adds a boss timer to EvoWorld.io

  1. // ==UserScript==
  2. // @name EvoWorld.io Boss Timer
  3. // @namespace evoworld_boss_timer
  4. // @version 0.1
  5. // @description Adds a boss timer to EvoWorld.io
  6. // @author @LCDAngel99
  7. // @match https://evoworld.io/
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // Create a container for the boss status and timer
  16. let bossContainer = document.createElement('div');
  17. bossContainer.style.position = 'absolute';
  18. bossContainer.style.top = '50px'; // Adjust the position as needed
  19. bossContainer.style.right = '10px'; // Adjust the position to align with the leaderboard
  20. bossContainer.style.zIndex = '9999';
  21. bossContainer.style.display = 'flex';
  22. bossContainer.style.alignItems = 'center';
  23.  
  24. // Add the picture of the demonic angel
  25. let bossImage = document.createElement('img');
  26. bossImage.src = 'https://cdn1.na.evoworld.io/sprites/bosses/boss1/flying/1.png';
  27. bossImage.style.width = '50px'; // Adjust size as needed
  28. bossImage.style.marginRight = '10px'; // Adjust margin as needed
  29. bossContainer.appendChild(bossImage);
  30.  
  31. // Add the boss status text
  32. let bossStatusText = document.createElement('div');
  33. bossStatusText.style.fontSize = '16px';
  34. bossStatusText.style.color = '#000000'; // Adjust color as needed
  35. bossContainer.appendChild(bossStatusText);
  36.  
  37. // Add the boss timer
  38. let bossTimerText = document.createElement('div');
  39. bossTimerText.style.fontSize = '16px';
  40. bossTimerText.style.color = '#ffffff'; // Adjust color as needed
  41. bossContainer.appendChild(bossTimerText);
  42.  
  43. // Function to update the boss status and timer
  44. function updateBossStatusAndTimer() {
  45. // Check if the boss is alive on the current server
  46. let bossIndicator = document.querySelector('.bC'); // Assuming this element indicates the boss's presence
  47. if (bossIndicator) {
  48. bossStatusText.innerText = "THE BOSS IS ALIVE";
  49. bossTimerText.innerText = "";
  50. } else {
  51. // Calculate and display the boss timer
  52. let currentTime = new Date();
  53. let nextBossTime = new Date(currentTime);
  54. nextBossTime.setHours(currentTime.getHours() + 1);
  55. nextBossTime.setMinutes(0);
  56. nextBossTime.setSeconds(0);
  57.  
  58. let timeDifference = nextBossTime - currentTime;
  59. let minutes = Math.floor((timeDifference % (1000 * 60 * 60)) / (1000 * 60));
  60. let seconds = Math.floor((timeDifference % (1000 * 60)) / 1000);
  61.  
  62. // Format the time nicely
  63. let formattedTime = (minutes < 10 ? '0' : '') + minutes + ':' +
  64. (seconds < 10 ? '0' : '') + seconds;
  65.  
  66. bossStatusText.innerText = "";
  67. bossTimerText.innerText = 'Boss Timer: ' + formattedTime;
  68. }
  69. }
  70.  
  71. // Call updateBossStatusAndTimer function every second
  72. setInterval(updateBossStatusAndTimer, 1000);
  73.  
  74. // Append the container to the body
  75. document.body.appendChild(bossContainer);
  76. })();