Alienware Arena Helper Reloaded

Makes earning daily ARP easier

  1. // ==UserScript==
  2. // @name Alienware Arena Helper Reloaded
  3. // @namespace https://github.com/marcodallagatta/userscripts/raw/main/alienware-arena-helper-reloaded
  4. // @version 2022.12.02.17.44
  5. // @description Makes earning daily ARP easier
  6. // @author Marco Dalla Gatta
  7. // @match https://*.alienwarearena.com/*
  8. // @license MIT
  9. // @icon https://www.alienwarearena.com/favicon.ico
  10. // @grant none
  11. // @noframes
  12. // ==/UserScript==
  13.  
  14. function awaHelper() {
  15. // You can configure options through the user interface. It is not recommended to edit the script for these purposes.
  16. const version = "2.1.0";
  17.  
  18. let contentToCheck = [];
  19. let saveOptionsTimer;
  20.  
  21. // Embed style
  22. document.head.appendChild(document.createElement("style")).textContent = `
  23. /* script buttons */
  24. .awah-btn-cons,
  25. .awah-btn-cons:hover {color: gold;}
  26. .list-group-item > .awah-btn-cons {width: 50%;}
  27. .list-profile-actions > li > .awah-btn-cons {width: 50%;}
  28. .awah-btn-cons.disabled {position: relative;}
  29. .awah-btn-quest.disabled::before,
  30. .awah-btn-cons.disabled::before {content: ''; width: 100%; height: 100%; position: absolute; top: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACAQMAAABIeJ9nAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAAAAAAAClZ7nPAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAMSURBVAjXY2hgYAAAAYQAgSjdetcAAAAASUVORK5CYII=');}
  31. .awah-btn-quest {padding-left: 0.25rem; padding-right: 0.25rem;}
  32. .awah-btn-quest.disabled::before {filter: invert(60%)}
  33. .awah-panel {margin: 20px 0;}
  34. .awah-activate-steam-key-btn {text-decoration: none !important; padding: 1px 5px; background-color: rgba( 48, 95, 128, 0.9 ); vertical-align: inherit;}
  35. .awah-activate-steam-key-btn:hover {background: linear-gradient( -60deg, #417a9b 5%,#67c1f5 95%);}
  36.  
  37. /* script tooltips */
  38. .awah-info-btn {cursor: pointer; opacity: 0.4; transition: opacity 0.25s ease-in-out;}
  39. .awah-info-btn:hover {opacity: 1;}
  40. [data-awah-tooltip] {position: relative;}
  41. [data-awah-tooltip]:after {content: attr(data-awah-tooltip); pointer-events: none; padding: 4px 8px; color: white; position: absolute; left: 0; bottom: 100%; opacity: 0; font-weight: normal; text-transform: none; font-size: 0.9rem; white-space: pre; box-shadow: 0px 0px 3px 0px #54bbdb; background-color: #0e0e0e; transition: opacity 0.25s ease-out, bottom 0.25s ease-out; z-index: 1000;}
  42. [data-awah-tooltip]:hover:after {bottom: -100%; opacity: 1;}
  43.  
  44. /* script GUI */
  45. #awah-status-overlay {display: flex; flex-flow: column nowrap; align-items: flex-end; color: white; font-size: smaller !important; pointer-events: none; position: fixed; bottom: 0; right: 0; max-width: 40%; min-width: 20%; padding: 1rem 0.5rem 0 0; text-shadow: 2px 2px 2px rgb(0, 0, 0), -1px -1px 2px rgb(0, 0, 0), 2px 2px 5px rgb(0, 0, 0), -1px -1px 5px rgb(0, 0, 0), 0px 0px 10px rgb(0, 0, 0); text-align: right; background: rgba(0, 0, 0, 0) linear-gradient(to right bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.85) 85%, rgba(0, 0, 0, 0.85) 100%) no-repeat scroll 0 0; z-index: 9001;}
  46. #awah-status-overlay .fa-exclamation-triangle {color: red;}
  47. #awah-status-overlay a,
  48. #awah-status-overlay button {pointer-events: all;}
  49. #awah-status-overlay button {background-color: rgba(255, 255, 255, 0.6);}
  50. #awah-status-messages {display: flex; flex-flow: column nowrap; align-items: flex-end; white-space: nowrap; border-bottom: 1px solid #1c1e22;}
  51. #awah-status-messages > div {clear: both; position: relative; animation: awah-slide-from-bottom 0.3s ease-out 1 forwards;}
  52. .awah-arp-pts {clear: both; width: 100%}
  53. .awah-arp-pts > div {clear: both; width: 100%; background-position: 50% 50%; background-repeat: no-repeat; background-size: 100% 14px;}
  54. .awah-arp-pts > div::after {content: ""; display: block; height: 0; clear: both;}
  55. .awah-grey {color: #767676;}
  56. .awah-casper-out {overflow: hidden !important; animation: awah-casper-out 0.6s ease-in !important;}
  57. .awah-rotating {animation: awah-rotating 2s linear infinite;}
  58.  
  59. li.awah-nav-panel {}
  60. li.awah-nav-panel > a.nav-link {width: 2.5rem; height: 2.5rem; float: left; cursor: pointer;}
  61. li.awah-nav-panel > a.nav-link > i {font-size: 26px;}
  62.  
  63. .awah-daily-reset-timer {min-width: 22%;}
  64. .toast-body table tbody > :nth-child(2n) {background: #090909}
  65.  
  66. /* script options */
  67. .awah-options-btn {float: left; padding-left: 16px; cursor: pointer; transition: text-shadow 0.25s ease-in-out;}
  68. .awah-options-btn:hover {text-shadow: 0px 0px 3px rgba(75, 201, 239, 1), 0px 0px 12px rgba(75, 201, 239, 1); /* animation: awah-breathing-text-neon 2s ease 0s infinite alternate; */}
  69. #awah-options {display: flex; flex-flow: column nowrap; overflow: auto; position: fixed; height: 100vh; width: 30vw; right: calc(-5px - 30vw); padding: 0 11px 2rem 11px; text-shadow: 2px 2px 2px rgb(0, 0, 0), -1px -1px 2px rgb(0, 0, 0); text-align: right; background: rgba(0, 0, 0, 0.85) repeat scroll 0 0; box-shadow: 0px 0px 3px 0px #54bbdb; transition: right 0.3s; z-index: 9000;}
  70. .awah-option {border-bottom: 1px solid #1c1e22; margin-bottom: 11px;}
  71. .awah-option label {display: flex; flex-flow: row nowrap; justify-content: space-between; align-items: baseline; color: whitesmoke;}
  72. #awah-options > :first-child {display: flex; flex-flow: row nowrap; justify-content: space-between; align-items: baseline;}
  73. .awah-opt-input {width: 24%; text-align: right; padding: 0 5px; height: auto; background: transparent; color: white; border-width: 0px 0px 1px 0px;}
  74. .awah-opt-desc {font-size: smaller;}
  75. .awah-option > .btn-danger {width: 100%;}
  76. #awah-options .dismiss-menu {font-size: 32px;}
  77.  
  78. /* custom checkbox */
  79. input.awah-opt-input[type="checkbox"] {position: absolute; right: 0; opacity: 0;}
  80. input.awah-opt-input[type="checkbox"]:focus + div {border-color: #66afe9; outline: 0; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);}
  81. .awah-opt-input[type="checkbox"] + div {transition: 0.25s all ease; position: relative; overflow: hidden; cursor: pointer;}
  82. .awah-opt-input[type="checkbox"] + div > div {transition: 0.25s all ease; background-color: #428bca; width: 50%; height: 100%; position: absolute; left: 0;}
  83. input.awah-opt-input[type="checkbox"]:checked + div {background-color: rgb(66, 139, 202, 0.4);}
  84. input.awah-opt-input[type="checkbox"]:checked + div > div {left: calc(100% - 50%);}
  85. .awah-opt-input[type="checkbox"] + div > div::before {content: 'ON'; position: absolute; right: 120%;}
  86. .awah-opt-input[type="checkbox"] + div > div::after {content: 'OFF'; color: #767676; position: absolute; left: 120%;}
  87.  
  88. /* comments */
  89. .insignia-label::before {content: attr(data-arp-level); font-size: 10px; width: 35px; /* 30 for master */ line-height: 30px; /* 26 for master */ position: absolute; text-align: center; pointer-events: none;}
  90.  
  91. /* user profile */
  92. .awah-sub-recent-activity {text-align: center; font-size: smaller; margin-bottom: 10px; margin-top: -10px;}
  93. section.um-profile__friends {flex-wrap: wrap;}
  94.  
  95. @keyframes awah-slide-from-bottom {
  96. from {opacity: 0.5; bottom: -90px; max-height: 0px;}
  97. to {opacity: 1; bottom: 0px; max-height: 70px;}
  98. }
  99. @keyframes awah-casper-out {
  100. 0% {filter: blur(0px); max-height: 50px;}
  101. 100% {filter: blur(15px); max-height: 0px;}
  102. }
  103. @keyframes awah-breathing-text-neon {
  104. from {text-shadow: 0px 0px 3px rgba(75, 201, 239, 0.25), 0px 0px 12px rgba(75, 201, 239, 0.25);}
  105. to {text-shadow: 0px 0px 3px rgba(75, 201, 239, 1), 0px 0px 12px rgba(75, 201, 239, 1);}
  106. }
  107. @keyframes awah-rotating {
  108. from {transform: rotate(0deg);}
  109. to {transform: rotate(360deg);}
  110. }
  111. @keyframes awah-element-appears-hook {
  112. from {opacity: 0.99;}
  113. to {opacity: 1;}
  114. }
  115. .giveaways__listing .row > div {animation-duration: 0.001s; animation-name: awah-element-appears-hook;}
  116. #giveaway-flash-message {animation-duration: 0.001s; animation-name: awah-element-appears-hook;}
  117.  
  118. /* Fix for Alienware Arena design bugs */
  119. .overlay {position: fixed !important;} /* without it .overlay sticks to top of the site and can be skipped by scrolling */
  120. .videos__listing .videos__listing-post img {max-height: 299px;} /* videos without thumbnail have bigger height and stretching out of the general row */
  121. `;
  122.  
  123. class Options {
  124. constructor() {
  125. this.load();
  126. }
  127.  
  128. default () {
  129. return {
  130. statusMessageDelay: 10000,
  131. actionsDelayMin: 500,
  132. actionsDelayMax: 2000,
  133. twitchPlayerRemove: false,
  134. twitchWatchAutomate: true,
  135. timeOnSiteCheck: true,
  136. version
  137. };
  138. }
  139.  
  140. load() {
  141. let defaultOptions = this.default();
  142. Object.keys(defaultOptions).forEach((key) => (this[key] = defaultOptions[key]));
  143.  
  144. let savedOptions = JSON.parse(localStorage.getItem("AlienwareArenaHelperOptions"));
  145. if (savedOptions !== null) {
  146. Object.keys(savedOptions).forEach((key) => (this[key] = savedOptions[key]));
  147. }
  148. }
  149.  
  150. save() {
  151. this.actionsDelayMin = parseInt(document.querySelector("#awah-actions-delay-min").value, 10);
  152. this.actionsDelayMax = parseInt(document.querySelector("#awah-actions-delay-max").value, 10);
  153. this.twitchPlayerRemove = document.querySelector("#awah-twitchPlayerRemove").checked;
  154. this.twitchWatchAutomate = document.querySelector("#awah-twitchWatchAutomate").checked;
  155. this.timeOnSiteCheck = document.querySelector("#awah-timeOnSiteCheck").checked;
  156. this.statusMessageDelay = parseInt(document.querySelector("#awah-status-message-delay").value, 10);
  157.  
  158. try {
  159. localStorage.setItem("AlienwareArenaHelperOptions", JSON.stringify(this));
  160. return true;
  161. } catch (e) {
  162. console.warn(e);
  163. return false;
  164. }
  165. }
  166. }
  167.  
  168. let options = new Options();
  169.  
  170. class UI {
  171. constructor() {
  172. this.hideOverlayAdditionalFunctions = [];
  173. this.hideOverlayHook();
  174. this.initNavPanel();
  175. this.initStatusOverlay();
  176. this.initOptionsUI();
  177.  
  178. document.addEventListener(
  179. "animationend",
  180. function(event) {
  181. if (event.animationName === "awah-casper-out") {
  182. event.target.remove();
  183. }
  184. },
  185. false
  186. );
  187. }
  188.  
  189. initNavPanel() {
  190. let anchor = document.querySelector("li#notification-dropdown");
  191. this.navPanel = document.createElement("li");
  192. this.navPanel.classList.add("nav-item", "awah-nav-panel");
  193. anchor.insertAdjacentElement("beforebegin", this.navPanel);
  194. }
  195.  
  196. initStatusOverlay() {
  197. let statusOverlayElement = document.createElement("div");
  198. statusOverlayElement.id = "awah-status-overlay";
  199. statusOverlayElement.insertAdjacentHTML("afterbegin", '<div id="awah-status-messages"></div><div class="awah-arp-pts"></div>');
  200. this.messagesContainerElement = statusOverlayElement.querySelector("#awah-status-messages");
  201. this.messagesContainerElement.insertAdjacentHTML("beforeend", `<div class="awah-con-check-queue" style="display: none;">content to check: <span class="awah-con-check-queue-length">${contentToCheck.length}</span> <span class="fa fa-fw fa-search"></span></div>`);
  202. document.getElementById("content").appendChild(statusOverlayElement);
  203. }
  204.  
  205. initOptionsUI() {
  206. this.navPanel.insertAdjacentHTML("beforeend", '<a class="nav-link awah-options-btn" data-awah-tooltip="AWA Helper options"><i aria-hidden="true" class="fa fa-fw fa-cog"></i></a>');
  207.  
  208. document.querySelector("div.wrapper").insertAdjacentHTML(
  209. "beforebegin",
  210. `<div id="awah-options" style="visibility: hidden;">
  211. <div class="awah-option">
  212. <a class="dismiss-menu" data-awah-tooltip="Close options"><i aria-hidden="true" class="fas fa-times"></i></a>
  213. <span class="awah-opt-desc awah-grey">Alienware Arena Helper Realoaded v<b>${version}</b></span>
  214. </div>
  215.  
  216. <div class="awah-option">
  217. <label><span class="awah-opt-title">actionsDelayMin</span><input id="awah-actions-delay-min" class="form-control awah-opt-input" type="text" value="${options.actionsDelayMin}"></label>
  218. <label><span class="awah-opt-title">actionsDelayMax</span><input id="awah-actions-delay-max" class="form-control awah-opt-input" type="text" value="${options.actionsDelayMax}"></label>
  219. <span class="awah-opt-desc awah-grey">Minimum and maximum random delay time between network actions. (milliseconds)<br>Default minimum: ${options.default().actionsDelayMin} || Default maximum: ${options.default().actionsDelayMax}</span>
  220. </div>
  221.  
  222. <div class="awah-option">
  223. <label><span class="awah-opt-title">Remove Twitch Player from Homepage</span><input id="awah-twitchPlayerRemove" class="form-control awah-opt-input" type="checkbox" ${options.twitchPlayerRemove ? "checked" : ""}><div class="form-control awah-opt-input"><div>&nbsp;</div>&nbsp;</div></label>
  224. <span class="awah-opt-desc awah-grey">Removes the player to save resources. Default: ${options.default().twitchPlayerRemove ? "ON" : "OFF"}</span>
  225. </div>
  226.  
  227. <div class="awah-option">
  228. <label><span class="awah-opt-title">Automate Twitch Watching</span><input id="awah-twitchWatchAutomate" class="form-control awah-opt-input" type="checkbox" ${options.twitchWatchAutomate ? "checked" : ""}><div class="form-control awah-opt-input"><div>&nbsp;</div>&nbsp;</div></label>
  229. <span class="awah-opt-desc awah-grey">A popup will appear to open the AWA Twitch page, that page will automatically refresh if no streamers are live and open a stream if they are. Default: ${options.default().twitchWatchAutomate ? "ON" : "OFF"}</span>
  230. </div>
  231.  
  232. <div class="awah-option">
  233. <label><span class="awah-opt-title">Time On Site Notification</span><input id="awah-timeOnSiteCheck" class="form-control awah-opt-input" type="checkbox" ${options.timeOnSiteCheck ? "checked" : ""}><div class="form-control awah-opt-input"><div>&nbsp;</div>&nbsp;</div></label>
  234. <span class="awah-opt-desc awah-grey">A popup will appear when you haven't spent enough time on AWA to get the daily points. Default: ${options.default().timeOnSiteCheck ? "ON" : "OFF"}</span>
  235. </div>
  236.  
  237. <div class="awah-option">
  238. <label><span class="awah-opt-title">statusMessageDelay</span><input id="awah-status-message-delay" class="form-control awah-opt-input" type="text" value="${options.statusMessageDelay}"></label>
  239. <span class="awah-opt-desc awah-grey">How long the status messages will be displayed before they disappear. This doesn't affect persistent notifications such as uncompleted quests. (milliseconds)<br>Default: ${options.default().statusMessageDelay}</span>
  240. </div>
  241.  
  242. <div class="awah-option">
  243. <button id="awah_restore_default" class="btn btn-danger"><span class="fa fa-exclamation-triangle"></span> Restore default</button>
  244. <span class="awah-opt-desc awah-grey">Restore default settings.</span>
  245. </div>
  246.  
  247. </div>`
  248. );
  249.  
  250. document.querySelectorAll('input.awah-opt-input[type="text"]').forEach((elem) => {
  251. elem.addEventListener("input", function() {
  252. this.value = this.value.replace(/[^\d]/, "");
  253. this.value = this.value.slice(0, 5);
  254. });
  255. });
  256.  
  257. document.querySelectorAll("input.awah-opt-input").forEach((elem) => {
  258. elem.addEventListener("change", function() {
  259. clearTimeout(saveOptionsTimer);
  260. saveOptionsTimer = setTimeout(function() {
  261. if (options.save()) {
  262. ui.newStatusMessage('Settings saved! <span class="fa fa-fw fa-floppy-o"></span>');
  263. } else {
  264. ui.newStatusMessage('Error! See console for details. <span class="fa fa-fw fa-exclamation-triangle"></span>');
  265. }
  266. }, 400);
  267. });
  268. });
  269.  
  270. document.querySelector("#awah_restore_default").addEventListener("click", function() {
  271. if (!confirm("Are you damn sure about this?!")) return;
  272. localStorage.removeItem("AlienwareArenaHelperOptions");
  273. ui.newStatusMessage("Default options settings restored! Realoding...");
  274. setTimeout(function() {
  275. window.location.reload();
  276. }, 2500);
  277. });
  278.  
  279. document.querySelector(".awah-options-btn").addEventListener("click", this.toggleOptionsDisplay, false);
  280.  
  281. this.hideOverlayAdditionalFunctions.push(function() {
  282. let awahOptions = document.getElementById("awah-options");
  283. setTimeout(() => {
  284. awahOptions.style.visibility = "hidden";
  285. }, 300);
  286. awahOptions.style.right = "";
  287. });
  288. }
  289.  
  290. hideOverlayHook() {
  291. hideOverlay = new Proxy(hideOverlay, {
  292. apply(target, thisArg, args) {
  293. for (const additionalHideFunction of ui.hideOverlayAdditionalFunctions) {
  294. additionalHideFunction.apply(thisArg, args);
  295. }
  296. target.apply(thisArg, args);
  297. }
  298. });
  299. }
  300.  
  301. toggleOptionsDisplay() {
  302. let overlayElement = document.querySelector(".overlay");
  303. let awahOptions = document.getElementById("awah-options");
  304. if (awahOptions.style.visibility === "hidden") {
  305. overlayElement.classList.add("active");
  306. awahOptions.style.visibility = "visible";
  307. awahOptions.style.right = "0";
  308. } else {
  309. hideOverlay();
  310. }
  311. }
  312.  
  313. newStatusMessage(text, sticky = false) {
  314. let statusMessageElement = document.createElement("div");
  315. statusMessageElement.innerHTML = text;
  316. this.messagesContainerElement.appendChild(statusMessageElement);
  317. if (!sticky) {
  318. setTimeout(() => statusMessageElement.classList.add("awah-casper-out"), options.statusMessageDelay);
  319. }
  320. return statusMessageElement;
  321. }
  322. }
  323.  
  324. let ui = new UI();
  325.  
  326. ///////////////////////////////////////
  327. /// DAILY QUESTS //////////////////////
  328. ///////////////////////////////////////
  329.  
  330. async function showDailyQuestButton() {
  331. while (!document.querySelector(".quest-title")) {
  332. await new Promise((r) => setTimeout(r, 500));
  333. }
  334.  
  335. const dailyQuest = document.querySelector(".quest-title").textContent.toLowerCase().trim();
  336. console.log(`👽 QUEST: ${dailyQuest}`);
  337. if (document.querySelector(".quest-item-progress").textContent === "Complete") {
  338. document.querySelector(".awah-btn-quest").addClass("disabled");
  339. } else {
  340. switch (dailyQuest) {
  341. case "show some id":
  342. case "new bling":
  343. case "new sheriff in town":
  344. ui.newStatusMessage(`<a href="https://www.alienwarearena.com/account/personalization#badges">Daily Quest: change badge</a>`, true);
  345. break;
  346. case "town crier":
  347. case "town gossip":
  348. case "spread the love":
  349. case "sharing is caring!":
  350. case "spread the good word":
  351. ui.newStatusMessage(`<a href="https://www.alienwarearena.com/ucf/show/2082495/boards/awa-on-topic/ForumPost/rules-on-old-dead-topics">Daily Quest: share a post</a>`, true);
  352. break;
  353. case "librarian approved":
  354. case "feed the mind":
  355. case "get smart!":
  356. case "brush up":
  357. case "booksmarts":
  358. case "don the glasses":
  359. case "check out the headline":
  360. ui.newStatusMessage(`<a href="https://eu.alienwarearena.com/ucf/News">Daily Quest: open a news</a>`, true);
  361. break;
  362. case "chatter box":
  363. case "water cooler":
  364. case "chit chat":
  365. case "make some friends!":
  366. ui.newStatusMessage(`<a href="https://www.alienwarearena.com/forums/board/113/awa-on-topic?sort=topic">Daily Quest: write in any thread</a>`, true);
  367. break;
  368. case "rank":
  369. case "who's #1?":
  370. case "climb the ranks":
  371. case "i want to be the very best...":
  372. case "compare notes":
  373. ui.newStatusMessage(`<a href="https://www.alienwarearena.com/rewards/leaderboard">Daily Quest: check the Leaderboard</a>`, true);
  374. break;
  375. case "frame it":
  376. case "picture day!":
  377. case "fresh siding!":
  378. case "give your alien a new home.":
  379. case "new space":
  380. ui.newStatusMessage(`<a href="https://www.alienwarearena.com/account/personalization#borders">Daily Quest: change your avatar's border</a>`, true);
  381. break;
  382. case "go shopping":
  383. case "window shopping":
  384. ui.newStatusMessage(`<a href="https://www.alienwarearena.com/marketplace/">Daily Quest: go to the Market</a>`, true);
  385. break;
  386. default:
  387. ui.newStatusMessage(`<a href="https://www.alienwarearena.com/forums/board/113/awa-on-topic?sort=topic">Special Daily Quest, please check the forum</a>`, true);
  388. break;
  389. }
  390. }
  391. }
  392. showDailyQuestButton();
  393.  
  394. ///////////////////////////////////////
  395. /// ELEMENTS REMOVAL///////////////////
  396. ///////////////////////////////////////
  397.  
  398. // removes twitch player on home page
  399. if (options.twitchPlayerRemove) {
  400. if (window.location.pathname === "/") {
  401. document.querySelector(".embed-responsive-item").remove();
  402. }
  403. }
  404.  
  405. ///////////////////////////////////////
  406. /// TWITCH ON AWA AUTOMATION //////////
  407. ///////////////////////////////////////
  408.  
  409. function awaTwitchPageRedir() {
  410. const targetLink = document.querySelectorAll("a.btn-primary");
  411.  
  412. if (targetLink.length) {
  413. setTimeout(function() {
  414. window.location.href = targetLink[targetLink.length - 1].href;
  415. }, 3000);
  416. } else {
  417. ui.newStatusMessage(`The page will refresh in 5 minutes to check for online streamers`);
  418. setTimeout(function() {
  419. location.reload(true);
  420. }, 300000); // 5 minutes in milliseconds
  421. }
  422. }
  423.  
  424. if (options.twitchWatchAutomate) {
  425. const twitchPoints = document.querySelector("div > div > section:nth-child(9) > div > div:nth-child(2) > center > b");
  426. // if on another page of awa that is not the twitch one, notify to open it, if points are less than maximum
  427. if (window.location.pathname != "/twitch/live" && twitchPoints.innerText < 15) {
  428. ui.newStatusMessage(`<a href="https://www.alienwarearena.com/twitch/live">Open AWA Twitch page and automate watching</a>`, true);
  429. }
  430. // on the awa twitch page, execute actions
  431. if (window.location.pathname === "/twitch/live" && twitchPoints.innerText < 15) {
  432. awaTwitchPageRedir();
  433. }
  434. }
  435.  
  436. ///////////////////////////////////////
  437. /// DAILY TIME SPENT ON AWA ///////////
  438. ///////////////////////////////////////
  439.  
  440. if (options.timeOnSiteCheck) {
  441. const timeOnSitePoints = document.querySelector("#um div center b");
  442. if (timeOnSitePoints.innerHTML < 5) {
  443. ui.newStatusMessage(`You still havent't spent enough time to clear the daily rewards, please keep AWA open`);
  444. }
  445. }
  446. let path = window.location.pathname;
  447. path = path.replace(/\/+/g, "/");
  448. }
  449.  
  450. ///////////////////////////////////////
  451. /// ACTUAL CALLING ////////////////////
  452. ///////////////////////////////////////
  453.  
  454. if (window.location.hostname.split(".").slice(1).join(".") === "alienwarearena.com") {
  455. awaHelper(window);
  456. }