MH Timers+

Description Pending

当前为 2019-08-09 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name MH Timers+
  3. // @author Warden Slayer - Warden Slayer#2302
  4. // @namespace https://greasyfork.org/en/users/227259-wardenslayer
  5. // @version 1.1.3
  6. // @description Description Pending
  7. // @include https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js
  8. // @include http://www.mousehuntgame.com/*
  9. // @include https://www.mousehuntgame.com/*
  10. // @grant GM_setClipboard
  11. // ==/UserScript==
  12. $(document).ready(function() {
  13. console.log("MH Timers+");
  14. buildTimerBox();
  15. buildControlPanels();
  16. startTimers();
  17. });
  18.  
  19. function buildTimerBox() {
  20. if ($(".timerBox").length > 0) return;
  21. var container = $("#mousehuntContainer");
  22. var timerBox = document.createElement("div");
  23. timerBox.classList.add("timerBox");
  24. $(timerBox).css({
  25. 'background-image': 'url("https://image.freepik.com/free-vector/cool-blue-parchment_53876-86280.jpg")',
  26. 'background-size': 'cover'
  27. });
  28. $(timerBox).css({
  29. 'height': 100 + "px",
  30. 'padding': 2 + "px"
  31. });
  32. let forbiddenGrove = buildForbiddenGrove();
  33. let balacksCove = buildBalacksCove();
  34. let seasonalGarden = buildSeasonalGarden();
  35. let toxicSpill = buildToxicSpill();
  36. timerBox.appendChild(forbiddenGrove)
  37. timerBox.appendChild(balacksCove)
  38. timerBox.appendChild(seasonalGarden)
  39. timerBox.appendChild(toxicSpill)
  40. $(forbiddenGrove).css({
  41. 'float': 'left'
  42. })
  43. $(balacksCove).css({
  44. 'float': 'left',
  45. 'marginLeft': 1 + "px"
  46. })
  47. $(seasonalGarden).css({
  48. 'float': 'left',
  49. 'marginLeft': 1 + "px"
  50. })
  51. $(toxicSpill).css({
  52. 'float': 'left',
  53. 'marginLeft': 1 + "px"
  54. })
  55. //LAST
  56. container.prepend(timerBox)
  57. }
  58.  
  59. function buildControlPanels() {
  60. var timerBox = $(".timerBox");
  61. //FG
  62. var forbiddenGroveControlPanel = document.createElement("div");
  63. forbiddenGroveControlPanel.classList.add("forbiddenGroveControlPanel");
  64. var forbiddenGroveButton = document.createElement("button");
  65. forbiddenGroveButton.id = "forbiddenGroveButton";
  66. forbiddenGroveButton.innerText = "Travel";
  67. forbiddenGroveButton.addEventListener("click", travelToGrove);
  68. forbiddenGroveControlPanel.appendChild(forbiddenGroveButton);
  69. $(forbiddenGroveControlPanel).css({
  70. 'float': 'left',
  71. 'width': '21.5%'
  72. })
  73. $(forbiddenGroveButton).css({
  74. 'width': '75px',
  75. 'float': 'left',
  76. 'marginRight': 5 + "px"
  77. })
  78. var forbiddenGroveCb = document.createElement('input');
  79. forbiddenGroveCb.type = "checkbox";
  80. forbiddenGroveCb.name = "forbiddenGroveCb";
  81. forbiddenGroveCb.value = "value";
  82. forbiddenGroveCb.id = "forbiddenGroveCb";
  83. //forbiddenGroveCb.addEventListener("click", remindMeGrove);
  84. if (localStorage.getItem('RemindGrove') == "Y") {
  85. forbiddenGroveCb.checked = "Yes";
  86. } else {
  87. forbiddenGroveCb.checked = "";
  88. }
  89. var forbiddenGroveCbLabel = document.createElement('label')
  90. forbiddenGroveCbLabel.htmlFor = "forbiddenGroveCbLabel";
  91. forbiddenGroveCbLabel.appendChild(document.createTextNode('Remind '));
  92. forbiddenGroveControlPanel.appendChild(forbiddenGroveCbLabel);
  93. forbiddenGroveControlPanel.appendChild(forbiddenGroveCb)
  94. $(forbiddenGroveCbLabel).css({
  95. 'float': 'left',
  96. 'fontSize': "14px",
  97. 'width': '45px',
  98. })
  99. $(forbiddenGroveCb).css({
  100. 'float': 'left',
  101. 'width': '20px'
  102. })
  103. timerBox.append(forbiddenGroveControlPanel);
  104. //BC
  105. var balacksCoveControlPanel = document.createElement("div");
  106. balacksCoveControlPanel.classList.add("balacksCoveControlPanel");
  107. var balacksCoveButton = document.createElement("button");
  108. balacksCoveButton.id = "balacksCoveButton";
  109. balacksCoveButton.innerText = "Travel";
  110. balacksCoveButton.addEventListener("click", travelToCove);
  111. balacksCoveControlPanel.appendChild(balacksCoveButton);
  112. $(balacksCoveControlPanel).css({
  113. 'float': 'left',
  114. 'width': '25%',
  115. 'marginLeft': 5 + "px"
  116. })
  117. $(balacksCoveButton).css({
  118. 'width': '75px',
  119. 'float': 'left',
  120. 'marginRight': 5 + "px"
  121. })
  122. var balacksCoveCb = document.createElement('input');
  123. balacksCoveCb.type = "checkbox";
  124. balacksCoveCb.name = "balacksCoveCb";
  125. balacksCoveCb.value = "value";
  126. balacksCoveCb.id = "balacksCoveCb";
  127. if (localStorage.getItem('RemindCove') == "Y") {
  128. balacksCoveCb.checked = "Yes";
  129. } else {
  130. balacksCoveCb.checked = "";
  131. }
  132. var balacksCoveCbLabel = document.createElement('label')
  133. balacksCoveCbLabel.htmlFor = "balacksCoveCbLabel";
  134. balacksCoveCbLabel.appendChild(document.createTextNode('Remind '));
  135. balacksCoveControlPanel.appendChild(balacksCoveCbLabel);
  136. balacksCoveControlPanel.appendChild(balacksCoveCb)
  137. $(balacksCoveCbLabel).css({
  138. 'float': 'left',
  139. 'fontSize': "14px",
  140. 'width': '45px',
  141. })
  142. $(balacksCoveCb).css({
  143. 'float': 'left',
  144. 'width': '20px'
  145. })
  146. timerBox.append(balacksCoveControlPanel);
  147. //SG
  148. var seasonalGardenControlPanel = document.createElement("div");
  149. seasonalGardenControlPanel.classList.add("seasonalGardenControlPanel");
  150. var seasonalGardenButton = document.createElement("button");
  151. seasonalGardenButton.id = "seasonalGardenButton";
  152. seasonalGardenButton.innerText = "Travel";
  153. seasonalGardenButton.addEventListener("click", travelToGarden);
  154. seasonalGardenControlPanel.appendChild(seasonalGardenButton);
  155. $(seasonalGardenControlPanel).css({
  156. 'float': 'left',
  157. 'width': '24%',
  158. 'marginLeft': 5 + "px"
  159. })
  160. $(seasonalGardenButton).css({
  161. 'width': '75px',
  162. 'float': 'left',
  163. 'marginRight': 5 + "px"
  164. })
  165. var seasonalGardenCb = document.createElement('input');
  166. seasonalGardenCb.type = "checkbox";
  167. seasonalGardenCb.name = "seasonalGardenCb";
  168. seasonalGardenCb.value = "value";
  169. seasonalGardenCb.id = "seasonalGardenCb";
  170. if (localStorage.getItem('RemindGarden') == "Y") {
  171. seasonalGardenCb.checked = "Yes";
  172. } else {
  173. seasonalGardenCb.checked = "";
  174. }
  175. var seasonalGardenCbLabel = document.createElement('label')
  176. seasonalGardenCbLabel.htmlFor = "seasonalGardenCbLabel";
  177. seasonalGardenCbLabel.appendChild(document.createTextNode('Remind '));
  178. seasonalGardenControlPanel.appendChild(seasonalGardenCbLabel);
  179. seasonalGardenControlPanel.appendChild(seasonalGardenCb)
  180. $(seasonalGardenCbLabel).css({
  181. 'float': 'left',
  182. 'fontSize': "14px",
  183. 'width': '45px',
  184. })
  185. $(seasonalGardenCb).css({
  186. 'float': 'left',
  187. 'width': '20px'
  188. })
  189. timerBox.append(seasonalGardenControlPanel);
  190. //TS
  191. var toxicSpillControlPanel = document.createElement("div");
  192. toxicSpillControlPanel.classList.add("toxicSpillControlPanel");
  193. var toxicSpillButton = document.createElement("button");
  194. toxicSpillButton.id = "toxicSpillButton";
  195. toxicSpillButton.innerText = "Travel";
  196. toxicSpillButton.addEventListener("click", travelToSpill);
  197. toxicSpillControlPanel.appendChild(toxicSpillButton);
  198. $(toxicSpillControlPanel).css({
  199. 'float': 'left',
  200. 'width': '24%',
  201. 'marginLeft': 10 + "px"
  202. })
  203. $(toxicSpillButton).css({
  204. 'width': '75px',
  205. 'float': 'left',
  206. 'marginRight': 5 + "px"
  207. })
  208. var toxicSpillCb = document.createElement('input');
  209. toxicSpillCb.type = "checkbox";
  210. toxicSpillCb.name = "toxicSpillCb";
  211. toxicSpillCb.value = "value";
  212. toxicSpillCb.id = "toxicSpillCb";
  213. if (localStorage.getItem('RemindSpill') == "Y") {
  214. toxicSpillCb.checked = "Yes";
  215. } else {
  216. toxicSpillCb.checked = "";
  217. }
  218. var toxicSpillCbLabel = document.createElement('label')
  219. toxicSpillCbLabel.htmlFor = "toxicSpillCbLabel";
  220. toxicSpillCbLabel.appendChild(document.createTextNode('Remind '));
  221. toxicSpillControlPanel.appendChild(toxicSpillCbLabel);
  222. toxicSpillControlPanel.appendChild(toxicSpillCb)
  223. $(toxicSpillCbLabel).css({
  224. 'float': 'left',
  225. 'fontSize': "14px",
  226. 'width': '45px',
  227. })
  228. $(toxicSpillCb).css({
  229. 'float': 'left',
  230. 'width': '20px'
  231. })
  232. timerBox.append(toxicSpillControlPanel);
  233. }
  234.  
  235. function startTimers() {
  236. localStorage.setItem("mainTimer", 0);
  237. runTimers();
  238. }
  239.  
  240. function runTimers() {
  241. updateText();
  242. var myTimer = setInterval(updateText, 5000);
  243. }
  244.  
  245. function updateText() {
  246. if ($(".forbiddenGrove").length > 0) updateForbiddenGroveTimer();
  247. if ($(".balacksCove").length > 0) updateBalacksCoveTimer();
  248. if ($(".seasonalGarden").length > 0) updateSeasonalGardenTimer();
  249. if ($(".toxicSpill").length > 0) updateToxicSpillTimer();
  250. }
  251. //===================================== Forbidden Grove ======================================
  252. function buildForbiddenGrove() {
  253. if ($(".forbiddenGrove").length > 0) return;
  254. var timerBox = $(".timerBox");
  255. var forbiddenGrove = document.createElement("div");
  256. forbiddenGrove.classList.add("forbiddenGrove");
  257. $(forbiddenGrove).css({
  258. 'border': '1px solid black',
  259. 'width': '21%',
  260. 'height': '75%',
  261. 'padding': 2 + "px"
  262. });
  263. //Header
  264. var forbiddenGroveHeader = document.createElement("div");
  265. forbiddenGroveHeader.classList.add("forbiddenGroveHeader");
  266. var forbiddenGroveHeaderLabel = document.createElement("div");
  267. forbiddenGroveHeaderLabel.classList.add("forbiddenGroveHeaderLabel");
  268. var forbiddenGroveHeaderLabelText = document.createTextNode("Forbidden Grove is:");
  269. forbiddenGroveHeaderLabel.appendChild(forbiddenGroveHeaderLabelText);
  270. var forbiddenGroveHeaderValue = document.createElement("div");
  271. forbiddenGroveHeaderValue.classList.add("forbiddenGroveHeaderValue");
  272. var forbiddenGroveHeaderValueText = document.createTextNode("Open");
  273. forbiddenGroveHeaderValue.appendChild(forbiddenGroveHeaderValueText);
  274. $(forbiddenGroveHeaderLabel).css({
  275. 'float': 'left',
  276. 'font-weight': 700,
  277. "marginRight": "5px"
  278. })
  279. $(forbiddenGroveHeaderValue).css({
  280. "marginLeft": "100px"
  281. });
  282. forbiddenGroveHeader.appendChild(forbiddenGroveHeaderLabel);
  283. forbiddenGroveHeader.appendChild(forbiddenGroveHeaderValue);
  284. //Close
  285. var forbiddenGroveCloses = document.createElement("div");
  286. forbiddenGroveCloses.classList.add("forbiddenGroveCloses");
  287. var forbiddenGroveClosesLabel = document.createElement("div");
  288. forbiddenGroveClosesLabel.classList.add("forbiddenGroveClosesLabel");
  289. var forbiddenGroveClosesLabelText = document.createTextNode("Closes in:");
  290. forbiddenGroveClosesLabel.appendChild(forbiddenGroveClosesLabelText);
  291. var forbiddenGroveClosesValue = document.createElement("div");
  292. forbiddenGroveClosesValue.classList.add("forbiddenGroveClosesValue");
  293. var forbiddenGroveClosesValueText = document.createTextNode("?");
  294. forbiddenGroveClosesValue.appendChild(forbiddenGroveClosesValueText);
  295. $(forbiddenGroveClosesLabel).css({
  296. 'float': 'left',
  297. 'font-weight': 700,
  298. "marginRight": "5px"
  299. })
  300. $(forbiddenGroveClosesValue).css("marginLeft", "50px");
  301. forbiddenGroveCloses.appendChild(forbiddenGroveClosesLabel);
  302. forbiddenGroveCloses.appendChild(forbiddenGroveClosesValue);
  303. //Open
  304. var forbiddenGroveOpens = document.createElement("div");
  305. forbiddenGroveOpens.classList.add("forbiddenGroveOpens");
  306. var forbiddenGroveOpensLabel = document.createElement("div");
  307. forbiddenGroveOpensLabel.classList.add("forbiddenGroveOpensLabel");
  308. var forbiddenGroveOpensLabelText = document.createTextNode("Opens in:");
  309. forbiddenGroveOpensLabel.appendChild(forbiddenGroveOpensLabelText);
  310. var forbiddenGroveOpensValue = document.createElement("div");
  311. forbiddenGroveOpensValue.classList.add("forbiddenGroveOpensValue");
  312. var forbiddenGroveOpensValueText = document.createTextNode("??");
  313. forbiddenGroveOpensValue.appendChild(forbiddenGroveOpensValueText);
  314. $(forbiddenGroveOpensLabel).css({
  315. 'float': 'left',
  316. 'font-weight': 700,
  317. "marginRight": "5px"
  318. })
  319. $(forbiddenGroveOpensValue).css("marginLeft", "50px");
  320. forbiddenGroveOpens.appendChild(forbiddenGroveOpensLabel);
  321. forbiddenGroveOpens.appendChild(forbiddenGroveOpensValue);
  322.  
  323. //Append
  324. forbiddenGrove.appendChild(forbiddenGroveHeader);
  325. forbiddenGrove.appendChild(forbiddenGroveCloses);
  326. forbiddenGrove.appendChild(forbiddenGroveOpens);
  327. return forbiddenGrove;
  328. }
  329.  
  330. function updateForbiddenGroveTimer() {
  331. if ($(".forbiddenGrove").length < 1) return;
  332. var forbiddenGrove = $(".forbiddenGrove");
  333. var firstGroveOpen = 1285704000;
  334. var now = todayNow();
  335. let timePassedHours = (now - firstGroveOpen) / 3600;
  336. var rotaionLenght = 20;
  337. var rotationsExact = timePassedHours / rotaionLenght;
  338. var rotationsInteger = Math.trunc(rotationsExact);
  339. var partialrotation = (rotationsExact - rotationsInteger) * rotaionLenght;
  340. if (partialrotation < 16) {
  341. //Open
  342. $(".forbiddenGroveHeaderValue").text(" OPEN");
  343. var timeCloses = (16 - partialrotation).toPrecision(4);
  344. var closesHours = Math.trunc(timeCloses);
  345. var closesMinutes = Math.ceil((timeCloses - closesHours) * 60);
  346. $(".forbiddenGroveClosesValue").text(closesHours + "h " + closesMinutes + "m");
  347. $(".forbiddenGroveOpensLabel").text("Opens Again in:");
  348. $(".forbiddenGroveOpensValue").text((closesHours + 4) + "h " + closesMinutes + "m");
  349. forbiddenGrove.append($(".forbiddenGroveOpens"))
  350. } else {
  351. //Closed
  352. $(".forbiddenGroveHeaderValue").text("CLOSED")
  353. var timeOpens = (rotaionLenght - partialrotation).toPrecision(4);
  354. var opensHours = Math.trunc(timeOpens);
  355. var opensMinutes = Math.ceil((timeOpens - opensHours) * 60);
  356. $(".forbiddenGroveOpensValue").text(opensHours + "h " + opensMinutes + "m");
  357. $(".forbiddenGroveClosesLabel").text("Next Close in:");
  358. $(".forbiddenGroveClosesValue").text((opensHours + 16) + "h " + opensMinutes + "m");
  359. forbiddenGrove.append($(".forbiddenGroveCloses"))
  360. }
  361. }
  362. $(document).on('change', '#forbiddenGroveCb', function() {
  363. if (this.checked) {
  364. localStorage.setItem('RemindGrove', "Y")
  365. this.checked = "Yes";
  366. } else {
  367. localStorage.setItem('RemindGrove', "N")
  368. this.checked = "";
  369. }
  370. })
  371.  
  372. //====================================== Balacks's Cove ======================================
  373. function buildBalacksCove() {
  374. if ($(".balacksCove").length > 0) return;
  375. var timerBox = $(".timerBox");
  376. var balacksCove = document.createElement("div");
  377. balacksCove.classList.add("balacksCove");
  378. $(balacksCove).css({
  379. 'border': '1px solid black',
  380. 'width': '25%',
  381. 'height': '75%',
  382. 'padding': 2 + "px"
  383. });
  384. //Header
  385. var balacksCoveHeader = document.createElement("div");
  386. balacksCoveHeader.classList.add("balacksCoveHeader");
  387. var balacksCoveHeaderLabel = document.createElement("div");
  388. balacksCoveHeaderLabel.classList.add("balacksCoveHeaderLabel");
  389. var balacksCoveHeaderLabelText = document.createTextNode("Balack's Cove Tide is:");
  390. balacksCoveHeaderLabel.appendChild(balacksCoveHeaderLabelText);
  391. var balacksCoveHeaderValue = document.createElement("div");
  392. balacksCoveHeaderValue.classList.add("balacksCoveHeaderValue");
  393. var balacksCoveHeaderValueText = document.createTextNode("Low");
  394. balacksCoveHeaderValue.appendChild(balacksCoveHeaderValueText);
  395. $(balacksCoveHeaderLabel).css({
  396. 'float': 'left',
  397. 'font-weight': 700,
  398. "marginRight": "5px"
  399. })
  400. $(balacksCoveHeaderValue).css({
  401. "marginLeft": "100px"
  402. });
  403. balacksCoveHeader.appendChild(balacksCoveHeaderLabel);
  404. balacksCoveHeader.appendChild(balacksCoveHeaderValue);
  405. //Low
  406. var balacksCoveLow = document.createElement("div");
  407. balacksCoveLow.classList.add("balacksCoveLow");
  408. var balacksCoveLowLabel = document.createElement("div");
  409. balacksCoveLowLabel.classList.add("balacksCoveLowLabel");
  410. var balacksCoveLowLabelText = document.createTextNode("Low Tide in:");
  411. balacksCoveLowLabel.appendChild(balacksCoveLowLabelText);
  412. var balacksCoveLowValue = document.createElement("div");
  413. balacksCoveLowValue.classList.add("balacksCoveLowValue");
  414. var balacksCoveLowValueText = document.createTextNode("?");
  415. balacksCoveLowValue.appendChild(balacksCoveLowValueText);
  416. $(balacksCoveLowLabel).css({
  417. 'float': 'left',
  418. 'font-weight': 700,
  419. "marginRight": "5px"
  420. })
  421. $(balacksCoveLowValue).css("marginLeft", "50px");
  422. balacksCoveLow.appendChild(balacksCoveLowLabel);
  423. balacksCoveLow.appendChild(balacksCoveLowValue);
  424. //Medium
  425. var balacksCoveMid = document.createElement("div");
  426. balacksCoveMid.classList.add("balacksCoveMid");
  427. var balacksCoveMidLabel = document.createElement("div");
  428. balacksCoveMidLabel.classList.add("balacksCoveMidLabel");
  429. var balacksCoveMidLabelText = document.createTextNode("Mid Tide in:");
  430. balacksCoveMidLabel.appendChild(balacksCoveMidLabelText);
  431. var balacksCoveMidValue = document.createElement("div");
  432. balacksCoveMidValue.classList.add("balacksCoveMidValue");
  433. var balacksCoveMidValueText = document.createTextNode("??");
  434. balacksCoveMidValue.appendChild(balacksCoveMidValueText);
  435. $(balacksCoveMidLabel).css({
  436. 'float': 'left',
  437. 'font-weight': 700,
  438. "marginRight": "5px"
  439. })
  440. $(balacksCoveMidValue).css("marginLeft", "50px");
  441. balacksCoveMid.appendChild(balacksCoveMidLabel);
  442. balacksCoveMid.appendChild(balacksCoveMidValue);
  443. //High
  444. var balacksCoveHigh = document.createElement("div");
  445. balacksCoveHigh.classList.add("balacksCoveHigh");
  446. var balacksCoveHighLabel = document.createElement("div");
  447. balacksCoveHighLabel.classList.add("balacksCoveHighLabel");
  448. var balacksCoveHighLabelText = document.createTextNode("High Tide in:");
  449. balacksCoveHighLabel.appendChild(balacksCoveHighLabelText);
  450. var balacksCoveHighValue = document.createElement("div");
  451. balacksCoveHighValue.classList.add("balacksCoveHighValue");
  452. var balacksCoveHighValueText = document.createTextNode("??");
  453. balacksCoveHighValue.appendChild(balacksCoveHighValueText);
  454. $(balacksCoveHighLabel).css({
  455. 'float': 'left',
  456. 'font-weight': 700,
  457. "marginRight": "5px"
  458. })
  459. $(balacksCoveHighValue).css("marginLeft", "50px");
  460. balacksCoveHigh.appendChild(balacksCoveHighLabel);
  461. balacksCoveHigh.appendChild(balacksCoveHighValue);
  462. //Append
  463. balacksCove.appendChild(balacksCoveHeader);
  464. balacksCove.appendChild(balacksCoveLow);
  465. balacksCove.appendChild(balacksCoveMid);
  466. balacksCove.appendChild(balacksCoveHigh);
  467. return balacksCove;
  468. }
  469.  
  470. function updateBalacksCoveTimer() {
  471. if ($(".balacksCove").length < 1) return;
  472. var balacksCove = $(".balacksCove");
  473. var firstCoveLow = 1294680060;
  474. var now = todayNow();
  475. let timePassedHours = (now - firstCoveLow) / 3600;
  476. var rotaionLenght = 18.6666666666666666666666666666666666666667;
  477. var rotationsExact = timePassedHours / rotaionLenght;
  478. var rotationsInteger = Math.trunc(rotationsExact);
  479. var partialrotation = (rotationsExact - rotationsInteger) * rotaionLenght;
  480. //partialrotation = 17.8;
  481. if (partialrotation < 16) {
  482. //Low
  483. $(".balacksCoveHeaderValue").text("LOW");
  484. var timeMid = (16 - partialrotation).toPrecision(4);
  485. var midHours = Math.trunc(timeMid);
  486. var midMinutes = Math.ceil((timeMid - midHours) * 60);
  487. $(".balacksCoveMidValue").text(midHours + "h " + midMinutes + "m");
  488. $(".balacksCoveMidLabel").text("Mid-Filling in:")
  489. $(".balacksCoveHighValue").text((midHours + 1) + "h " + midMinutes + "m");
  490. $(".balacksCoveLowLabel").text("Low Again in:");
  491. var lowHours = midHours + 2;
  492. var lowMinutes = midMinutes + 40;
  493. if (lowMinutes >= 60) {
  494. lowMinutes = lowMinutes - 60;
  495. lowHours++;
  496. }
  497. $(".balacksCoveLowValue").text((lowHours) + "h " + (lowMinutes) + "m");
  498. balacksCove.append($(".balacksCoveLow"))
  499. } else if ((partialrotation >= 16) && (partialrotation < 17)) {
  500. //Mid (flooding)
  501. $(".balacksCoveHeaderValue").text("MID-Flooding");
  502. var timeHigh = (17 - partialrotation).toPrecision(4);
  503. var highHours = Math.trunc(timeHigh);
  504. var highMinutes = Math.ceil((timeHigh - highHours) * 60);
  505. $(".balacksCoveHighValue").text((highHours) + "h " + highMinutes + "m");
  506. $(".balacksCoveMidLabel").text("Mid-Ebbing in:")
  507. var midHours = highHours;
  508. var midMinutes = highMinutes + 40;
  509. if (midMinutes >= 60) {
  510. midMinutes = midMinutes - 60;
  511. midHours++;
  512. }
  513. $(".balacksCoveMidValue").text(midHours + "h " + midMinutes + "m");
  514. $(".balacksCoveLowLabel").text("Low Tide in:");
  515. $(".balacksCoveLowValue").text((midHours + 1) + "h " + (midMinutes) + "m");
  516. balacksCove.append($(".balacksCoveMid"))
  517. balacksCove.append($(".balacksCoveLow"))
  518.  
  519. } else if ((partialrotation >= 17) && (partialrotation < 17.6666666667)) {
  520. //High
  521. $(".balacksCoveHeaderValue").text("HIGH");
  522. var timeMid = (17.6666666667 - partialrotation).toPrecision(4);
  523. var midHours = Math.trunc(timeMid);
  524. var midMinutes = Math.ceil((timeMid - midHours) * 60);
  525. $(".balacksCoveMidValue").text((midHours) + "h " + midMinutes + "m");
  526. $(".balacksCoveMidLabel").text("Mid-Ebbing in:")
  527. $(".balacksCoveLowLabel").text("Low Tide in:")
  528. $(".balacksCoveLowValue").text((midHours + 1) + "h " + midMinutes + "m");
  529. $(".balacksCoveHigh").hide();
  530. balacksCove.append($(".balacksCoveLow"))
  531. } else if (partialrotation >= 17.6666666667) {
  532. //Mid (ebbing)
  533. $(".balacksCoveHeaderValue").text("MID-Ebbing");
  534. var timeLow = (rotaionLenght - partialrotation).toPrecision(4);
  535. var lowHours = Math.trunc(timeLow);
  536. var lowMinutes = Math.ceil((timeLow - lowHours) * 60);
  537. $(".balacksCoveLowLabel").text("Low Tide in:")
  538. $(".balacksCoveLowValue").text((lowHours) + "h " + lowMinutes + "m");
  539. $(".balacksCoveMidLabel").text("Mid-Filling in:")
  540. $(".balacksCoveMidValue").text(lowHours + 16 + "h " + lowMinutes + "m");
  541. $(".balacksCoveHighLabel").text("High Tide in:");
  542. $(".balacksCoveHighValue").text(lowHours + 17 + "h " + (lowMinutes) + "m");
  543. balacksCove.append($(".balacksCoveHigh").show())
  544. }
  545. }
  546.  
  547. $(document).on('change', '#balacksCoveCb', function() {
  548. if (this.checked) {
  549. localStorage.setItem('RemindCove', "Y")
  550. this.checked = "Yes";
  551. } else {
  552. localStorage.setItem('RemindCove', "N")
  553. this.checked = "";
  554. }
  555. })
  556. //====================================== Seasonal Garden ======================================
  557. function buildSeasonalGarden() {
  558. if ($(".seasonalGarden").length > 0) return;
  559. var timerBox = $(".timerBox");
  560. var seasonalGarden = document.createElement("div");
  561. seasonalGarden.classList.add("seasonalGarden");
  562. $(seasonalGarden).css({
  563. 'border': '1px solid black',
  564. 'width': '24%',
  565. 'height': '75%',
  566. 'padding': 2 + "px"
  567. });
  568. //Header
  569. var seasonalGardenHeader = document.createElement("div");
  570. seasonalGardenHeader.classList.add("seasonalGardenHeader");
  571. var seasonalGardenHeaderLabel = document.createElement("div");
  572. seasonalGardenHeaderLabel.classList.add("seasonalGardenHeaderLabel");
  573. var seasonalGardenHeaderLabelText = document.createTextNode("Current Garden Season:");
  574. seasonalGardenHeaderLabel.appendChild(seasonalGardenHeaderLabelText);
  575. var seasonalGardenHeaderValue = document.createElement("div");
  576. seasonalGardenHeaderValue.classList.add("seasonalGardenHeaderValue");
  577. var seasonalGardenHeaderValueText = document.createTextNode("FALL");
  578. seasonalGardenHeaderValue.appendChild(seasonalGardenHeaderValueText);
  579. $(seasonalGardenHeaderLabel).css({
  580. 'float': 'left',
  581. 'font-weight': 700,
  582. "marginRight": "5px"
  583. })
  584. $(seasonalGardenHeaderValue).css({
  585. "marginLeft": "100px"
  586. });
  587. seasonalGardenHeader.appendChild(seasonalGardenHeaderLabel);
  588. seasonalGardenHeader.appendChild(seasonalGardenHeaderValue);
  589. //Fall
  590. var seasonalGardenFall = document.createElement("div");
  591. seasonalGardenFall.classList.add("seasonalGardenFall");
  592. var seasonalGardenFallLabel = document.createElement("div");
  593. seasonalGardenFallLabel.classList.add("seasonalGardenFallLabel");
  594. var seasonalGardenFallLabelText = document.createTextNode("Fall in:");
  595. seasonalGardenFallLabel.appendChild(seasonalGardenFallLabelText);
  596. var seasonalGardenFallValue = document.createElement("div");
  597. seasonalGardenFallValue.classList.add("seasonalGardenFallValue");
  598. var seasonalGardenFallValueText = document.createTextNode("?");
  599. seasonalGardenFallValue.appendChild(seasonalGardenFallValueText);
  600. $(seasonalGardenFallLabel).css({
  601. 'float': 'left',
  602. 'font-weight': 700,
  603. "marginRight": "5px"
  604. })
  605. $(seasonalGardenFallValue).css("marginLeft", "50px");
  606. seasonalGardenFall.appendChild(seasonalGardenFallLabel);
  607. seasonalGardenFall.appendChild(seasonalGardenFallValue);
  608. //Winter
  609. var seasonalGardenWinter = document.createElement("div");
  610. seasonalGardenWinter.classList.add("seasonalGardenWinter");
  611. var seasonalGardenWinterLabel = document.createElement("div");
  612. seasonalGardenWinterLabel.classList.add("seasonalGardenWinterLabel");
  613. var seasonalGardenWinterLabelText = document.createTextNode("Winter in:");
  614. seasonalGardenWinterLabel.appendChild(seasonalGardenWinterLabelText);
  615. var seasonalGardenWinterValue = document.createElement("div");
  616. seasonalGardenWinterValue.classList.add("seasonalGardenWinterValue");
  617. var seasonalGardenWinterValueText = document.createTextNode("?");
  618. seasonalGardenWinterValue.appendChild(seasonalGardenWinterValueText);
  619. $(seasonalGardenWinterLabel).css({
  620. 'float': 'left',
  621. 'font-weight': 700,
  622. "marginRight": "5px"
  623. })
  624. $(seasonalGardenWinterValue).css("marginLeft", "50px");
  625. seasonalGardenWinter.appendChild(seasonalGardenWinterLabel);
  626. seasonalGardenWinter.appendChild(seasonalGardenWinterValue);
  627. //Spring
  628. var seasonalGardenSpring = document.createElement("div");
  629. seasonalGardenSpring.classList.add("seasonalGardenSpring");
  630. var seasonalGardenSpringLabel = document.createElement("div");
  631. seasonalGardenSpringLabel.classList.add("seasonalGardenSpringLabel");
  632. var seasonalGardenSpringLabelText = document.createTextNode("Spring in:");
  633. seasonalGardenSpringLabel.appendChild(seasonalGardenSpringLabelText);
  634. var seasonalGardenSpringValue = document.createElement("div");
  635. seasonalGardenSpringValue.classList.add("seasonalGardenSpringValue");
  636. var seasonalGardenSpringValueText = document.createTextNode("?");
  637. seasonalGardenSpringValue.appendChild(seasonalGardenSpringValueText);
  638. $(seasonalGardenSpringLabel).css({
  639. 'float': 'left',
  640. 'font-weight': 700,
  641. "marginRight": "5px"
  642. })
  643. $(seasonalGardenSpringValue).css("marginLeft", "50px");
  644. seasonalGardenSpring.appendChild(seasonalGardenSpringLabel);
  645. seasonalGardenSpring.appendChild(seasonalGardenSpringValue);
  646. //Summer
  647. var seasonalGardenSummer = document.createElement("div");
  648. seasonalGardenSummer.classList.add("seasonalGardenSummer");
  649. var seasonalGardenSummerLabel = document.createElement("div");
  650. seasonalGardenSummerLabel.classList.add("seasonalGardenSummerLabel");
  651. var seasonalGardenSummerLabelText = document.createTextNode("Summer in:");
  652. seasonalGardenSummerLabel.appendChild(seasonalGardenSummerLabelText);
  653. var seasonalGardenSummerValue = document.createElement("div");
  654. seasonalGardenSummerValue.classList.add("seasonalGardenSummerValue");
  655. var seasonalGardenSummerValueText = document.createTextNode("?");
  656. seasonalGardenSummerValue.appendChild(seasonalGardenSummerValueText);
  657. $(seasonalGardenSummerLabel).css({
  658. 'float': 'left',
  659. 'font-weight': 700,
  660. "marginRight": "5px"
  661. })
  662. $(seasonalGardenSummerValue).css("marginLeft", "50px");
  663. seasonalGardenSummer.appendChild(seasonalGardenSummerLabel);
  664. seasonalGardenSummer.appendChild(seasonalGardenSummerValue);
  665. //Append
  666. seasonalGarden.appendChild(seasonalGardenHeader);
  667. seasonalGarden.appendChild(seasonalGardenFall);
  668. seasonalGarden.appendChild(seasonalGardenWinter);
  669. seasonalGarden.appendChild(seasonalGardenSpring);
  670. seasonalGarden.appendChild(seasonalGardenSummer);
  671. return seasonalGarden;
  672. }
  673.  
  674. function updateSeasonalGardenTimer() {
  675. if ($(".seasonalGarden").length < 1) return;
  676. var seasonalGarden = $(".seasonalGarden");
  677. var firstFall = 288000;
  678. var now = todayNow();
  679. let timePassedHours = (now - firstFall) / 3600;
  680. var rotaionLenght = 320;
  681. var rotationsExact = timePassedHours / rotaionLenght;
  682. var rotationsInteger = Math.trunc(rotationsExact);
  683. var partialrotation = (rotationsExact - rotationsInteger) * rotaionLenght;
  684. var fallObj = new season(0, 0, 0);
  685. var winterObj = new season(0, 0, 0);
  686. var springObj = new season(0, 0, 0);
  687. var summerObj = new season(0, 0, 0);
  688. if (partialrotation < 80) {
  689. //Summer
  690. $(".seasonalGardenHeaderValue").text("SUMMER");
  691. var timeFall = (80 - partialrotation).toPrecision(4);
  692. fallObj.hours = Math.floor(timeFall);
  693. fallObj.minutes = Math.ceil((timeFall - fallObj.hours) * 60);
  694. fallObj = convertToDyHrMn(0, fallObj.hours, fallObj.minutes);
  695. winterObj = convertToDyHrMn(fallObj.days + 3, fallObj.hours + 8, fallObj.minutes);
  696. springObj = convertToDyHrMn(winterObj.days + 3, winterObj.hours + 8, winterObj.minutes)
  697. summerObj = convertToDyHrMn(springObj.days + 3, springObj.hours + 8, springObj.minutes);
  698. $(".seasonalGardenFallLabel").text("Next Summer in:")
  699. $(".seasonalGardenWinterLabel").text("Winter in:")
  700. $(".seasonalGardenSpringLabel").text("Spring in:")
  701. $(".seasonalGardenSummerLabel").text("Summer in:")
  702. seasonalGarden.append($(".seasonalGardenFall"));
  703. seasonalGarden.append($(".seasonalGardenWinter"));
  704. seasonalGarden.append($(".seasonalGardenSpring"));
  705. seasonalGarden.append($(".seasonalGardenSummer"));
  706. } else if ((partialrotation >= 80) && (partialrotation < 160)) {
  707. //Fall
  708. $(".seasonalGardenHeaderValue").text("FALL");
  709. var timeWinter = (160 - partialrotation).toPrecision(4);
  710. winterObj.hours = Math.floor(timeWinter);
  711. winterObj.minutes = Math.ceil((timeWinter - winterObj.hours) * 60);
  712. winterObj = convertToDyHrMn(0, winterObj.hours, winterObj.minutes);
  713. springObj = convertToDyHrMn(winterObj.days + 3, winterObj.hours + 8, winterObj.minutes)
  714. summerObj = convertToDyHrMn(springObj.days + 3, springObj.hours + 8, springObj.minutes)
  715. fallObj = convertToDyHrMn(summerObj.days + 3, summerObj.hours + 8, summerObj.minutes);
  716. $(".seasonalGardenFallLabel").text("Next Fall in:")
  717. $(".seasonalGardenWinterLabel").text("Winter in:")
  718. $(".seasonalGardenSpringLabel").text("Spring in:")
  719. $(".seasonalGardenSummerLabel").text("Summer in:")
  720. seasonalGarden.append($(".seasonalGardenWinter"));
  721. seasonalGarden.append($(".seasonalGardenSpring"));
  722. seasonalGarden.append($(".seasonalGardenSummer"));
  723. seasonalGarden.append($(".seasonalGardenFall"));
  724. } else if ((partialrotation >= 160) && (partialrotation < 240)) {
  725. //Winter
  726. $(".seasonalGardenHeaderValue").text("WINTER");
  727. var timeSpring = (240 - partialrotation).toPrecision(4);
  728. springObj.hours = Math.floor(timeSpring);
  729. springObj.minutes = Math.ceil((timeSpring - springObj.hours) * 60);
  730. springObj = convertToDyHrMn(0, springObj.hours, springObj.minutes)
  731. summerObj = convertToDyHrMn(springObj.days + 3, springObj.hours + 8, springObj.minutes);
  732. fallObj = convertToDyHrMn(summerObj.days + 3, summerObj.hours + 8, summerObj.minutes);
  733. winterObj = convertToDyHrMn(fallObj.days + 3, fallObj.hours + 8, fallObj.minutes);
  734. $(".seasonalGardenFallLabel").text("Fall in:")
  735. $(".seasonalGardenWinterLabel").text("Next Winter in:")
  736. $(".seasonalGardenSpringLabel").text("Spring in:")
  737. $(".seasonalGardenSummerLabel").text("Summer in:")
  738. seasonalGarden.append($(".seasonalGardenSpring"));
  739. seasonalGarden.append($(".seasonalGardenSummer"));
  740. seasonalGarden.append($(".seasonalGardenFall"));
  741. seasonalGarden.append($(".seasonalGardenWinter"));
  742. } else {
  743. //Spring
  744. $(".seasonalGardenHeaderValue").text("SPRING");
  745. var timeSummer = (320 - partialrotation).toPrecision(4);
  746. summerObj.hours = Math.floor(timeSummer);
  747. summerObj.minutes = Math.ceil((timeSummer - summerObj.hours) * 60);
  748. summerObj = convertToDyHrMn(0, summerObj.hours, summerObj.minutes)
  749. fallObj = convertToDyHrMn(summerObj.days + 3, summerObj.hours + 8, summerObj.minutes);
  750. winterObj = convertToDyHrMn(fallObj.days + 3, fallObj.hours + 8, fallObj.minutes);
  751. springObj = convertToDyHrMn(winterObj.days + 3, winterObj.hours + 8, winterObj.minutes);
  752. $(".seasonalGardenFallLabel").text("Fall in:")
  753. $(".seasonalGardenWinterLabel").text("Winter in:")
  754. $(".seasonalGardenSpringLabel").text("Next Spring in:")
  755. $(".seasonalGardenSummerLabel").text("Summer in:")
  756. seasonalGarden.append($(".seasonalGardenSummer"));
  757. seasonalGarden.append($(".seasonalGardenFall"));
  758. seasonalGarden.append($(".seasonalGardenWinter"));
  759. seasonalGarden.append($(".seasonalGardenSpring"));
  760. }
  761. $(".seasonalGardenFallValue").text(fallObj.days + "d " + fallObj.hours + "h " + fallObj.minutes + "m");
  762. $(".seasonalGardenWinterValue").text(winterObj.days + "d " + winterObj.hours + "h " + winterObj.minutes + "m");
  763. $(".seasonalGardenSpringValue").text(springObj.days + "d " + springObj.hours + "h " + springObj.minutes + "m");
  764. $(".seasonalGardenSummerValue").text(summerObj.days + "d " + summerObj.hours + "h " + summerObj.minutes + "m");
  765. }
  766.  
  767. function season(days, hours, minutes) {
  768. this.days = days;
  769. this.hours = hours;
  770. this.minutes = minutes;
  771. }
  772. $(document).on('change', '#seasonalGardenCb', function() {
  773. if (this.checked) {
  774. localStorage.setItem('RemindGarden', "Y")
  775. this.checked = "Yes";
  776. } else {
  777. localStorage.setItem('RemindGarden', "N")
  778. this.checked = "";
  779. }
  780. })
  781. //====================================== Toxic Spill ======================================
  782. function buildToxicSpill() {
  783. if ($(".toxicSpill").length > 0) return;
  784. var timerBox = $(".timerBox");
  785. var toxicSpill = document.createElement("div");
  786. toxicSpill.classList.add("toxicSpill");
  787. $(toxicSpill).css({
  788. 'border': '1px solid black',
  789. 'width': '26%',
  790. 'height': '75%',
  791. 'padding': 2 + "px"
  792. });
  793. //Header
  794. var toxicSpillHeader = document.createElement("div");
  795. toxicSpillHeader.classList.add("toxicSpillHeader");
  796. var toxicSpillHeaderLabel = document.createElement("div");
  797. toxicSpillHeaderLabel.classList.add("toxicSpillHeaderLabel");
  798. var toxicSpillHeaderLabelText = document.createTextNode("Current Spill Level:");
  799. toxicSpillHeaderLabel.appendChild(toxicSpillHeaderLabelText);
  800. var toxicSpillHeaderValue = document.createElement("div");
  801. toxicSpillHeaderValue.classList.add("toxicSpillHeaderValue");
  802. var toxicSpillHeaderValueText = document.createTextNode("Archduke");
  803. toxicSpillHeaderValue.appendChild(toxicSpillHeaderValueText);
  804. $(toxicSpillHeaderLabel).css({
  805. 'float': 'left',
  806. 'font-weight': 700,
  807. "marginRight": "5px"
  808. })
  809. $(toxicSpillHeaderValue).css({
  810. "marginLeft": "100px"
  811. });
  812. toxicSpillHeader.appendChild(toxicSpillHeaderLabel);
  813. toxicSpillHeader.appendChild(toxicSpillHeaderValue);
  814. //Hero
  815. var toxicSpillHero = document.createElement("div");
  816. toxicSpillHero.classList.add("toxicSpillHero");
  817. var toxicSpillHeroLabel = document.createElement("div");
  818. toxicSpillHeroLabel.classList.add("toxicSpillHeroLabel");
  819. var toxicSpillHeroLabelText = document.createTextNode("Hero in:");
  820. toxicSpillHeroLabel.appendChild(toxicSpillHeroLabelText);
  821. var toxicSpillHeroValue = document.createElement("div");
  822. toxicSpillHeroValue.classList.add("toxicSpillHeroValue");
  823. var toxicSpillHeroValueText = document.createTextNode("?");
  824. toxicSpillHeroValue.appendChild(toxicSpillHeroValueText);
  825. $(toxicSpillHeroLabel).css({
  826. 'float': 'left',
  827. 'font-weight': 700,
  828. "marginRight": "5px"
  829. })
  830. $(toxicSpillHeroValue).css("marginLeft", "50px");
  831. toxicSpillHero.appendChild(toxicSpillHeroLabel);
  832. toxicSpillHero.appendChild(toxicSpillHeroValue);
  833. //Knight
  834. var toxicSpillKnight = document.createElement("div");
  835. toxicSpillKnight.classList.add("toxicSpillKnight");
  836. var toxicSpillKnightLabel = document.createElement("div");
  837. toxicSpillKnightLabel.classList.add("toxicSpillKnightLabel");
  838. var toxicSpillKnightLabelText = document.createTextNode("Knight in:");
  839. toxicSpillKnightLabel.appendChild(toxicSpillKnightLabelText);
  840. var toxicSpillKnightValue = document.createElement("div");
  841. toxicSpillKnightValue.classList.add("toxicSpillKnightValue");
  842. var toxicSpillKnightValueText = document.createTextNode("?");
  843. toxicSpillKnightValue.appendChild(toxicSpillKnightValueText);
  844. $(toxicSpillKnightLabel).css({
  845. 'float': 'left',
  846. 'font-weight': 700,
  847. "marginRight": "5px"
  848. })
  849. $(toxicSpillKnightValue).css("marginLeft", "50px");
  850. toxicSpillKnight.appendChild(toxicSpillKnightLabel);
  851. toxicSpillKnight.appendChild(toxicSpillKnightValue);
  852. //Lord
  853. var toxicSpillLord = document.createElement("div");
  854. toxicSpillLord.classList.add("toxicSpillLord");
  855. var toxicSpillLordLabel = document.createElement("div");
  856. toxicSpillLordLabel.classList.add("toxicSpillLordLabel");
  857. var toxicSpillLordLabelText = document.createTextNode("Lord in:");
  858. toxicSpillLordLabel.appendChild(toxicSpillLordLabelText);
  859. var toxicSpillLordValue = document.createElement("div");
  860. toxicSpillLordValue.classList.add("toxicSpillLordValue");
  861. var toxicSpillLordValueText = document.createTextNode("?");
  862. toxicSpillLordValue.appendChild(toxicSpillLordValueText);
  863. $(toxicSpillLordLabel).css({
  864. 'float': 'left',
  865. 'font-weight': 700,
  866. "marginRight": "5px"
  867. })
  868. $(toxicSpillLordValue).css("marginLeft", "50px");
  869. toxicSpillLord.appendChild(toxicSpillLordLabel);
  870. toxicSpillLord.appendChild(toxicSpillLordValue);
  871. //Baron
  872. var toxicSpillBaron = document.createElement("div");
  873. toxicSpillBaron.classList.add("toxicSpillBaron");
  874. var toxicSpillBaronLabel = document.createElement("div");
  875. toxicSpillBaronLabel.classList.add("toxicSpillBaronLabel");
  876. var toxicSpillBaronLabelText = document.createTextNode("Baron in:");
  877. toxicSpillBaronLabel.appendChild(toxicSpillBaronLabelText);
  878. var toxicSpillBaronValue = document.createElement("div");
  879. toxicSpillBaronValue.classList.add("toxicSpillBaronValue");
  880. var toxicSpillBaronValueText = document.createTextNode("?");
  881. toxicSpillBaronValue.appendChild(toxicSpillBaronValueText);
  882. $(toxicSpillBaronLabel).css({
  883. 'float': 'left',
  884. 'font-weight': 700,
  885. "marginRight": "5px"
  886. })
  887. $(toxicSpillBaronValue).css("marginLeft", "50px");
  888. toxicSpillBaron.appendChild(toxicSpillBaronLabel);
  889. toxicSpillBaron.appendChild(toxicSpillBaronValue);
  890. //Count
  891. var toxicSpillCount = document.createElement("div");
  892. toxicSpillCount.classList.add("toxicSpillCount");
  893. var toxicSpillCountLabel = document.createElement("div");
  894. toxicSpillCountLabel.classList.add("toxicSpillCountLabel");
  895. var toxicSpillCountLabelText = document.createTextNode("Count in:");
  896. toxicSpillCountLabel.appendChild(toxicSpillCountLabelText);
  897. var toxicSpillCountValue = document.createElement("div");
  898. toxicSpillCountValue.classList.add("toxicSpillCountValue");
  899. var toxicSpillCountValueText = document.createTextNode("?");
  900. toxicSpillCountValue.appendChild(toxicSpillCountValueText);
  901. $(toxicSpillCountLabel).css({
  902. 'float': 'left',
  903. 'font-weight': 700,
  904. "marginRight": "5px"
  905. })
  906. $(toxicSpillCountValue).css("marginLeft", "50px");
  907. toxicSpillCount.appendChild(toxicSpillCountLabel);
  908. toxicSpillCount.appendChild(toxicSpillCountValue);
  909. //Duke
  910. var toxicSpillDuke = document.createElement("div");
  911. toxicSpillDuke.classList.add("toxicSpillDuke");
  912. var toxicSpillDukeLabel = document.createElement("div");
  913. toxicSpillDukeLabel.classList.add("toxicSpillDukeLabel");
  914. var toxicSpillDukeLabelText = document.createTextNode("Duke in:");
  915. toxicSpillDukeLabel.appendChild(toxicSpillDukeLabelText);
  916. var toxicSpillDukeValue = document.createElement("div");
  917. toxicSpillDukeValue.classList.add("toxicSpillDukeValue");
  918. var toxicSpillDukeValueText = document.createTextNode("?");
  919. toxicSpillDukeValue.appendChild(toxicSpillDukeValueText);
  920. $(toxicSpillDukeLabel).css({
  921. 'float': 'left',
  922. 'font-weight': 700,
  923. "marginRight": "5px"
  924. })
  925. $(toxicSpillDukeValue).css("marginLeft", "50px");
  926. toxicSpillDuke.appendChild(toxicSpillDukeLabel);
  927. toxicSpillDuke.appendChild(toxicSpillDukeValue);
  928. //Grand Duke
  929. var toxicSpillGrandDuke = document.createElement("div");
  930. toxicSpillGrandDuke.classList.add("toxicSpillGrandDuke");
  931. var toxicSpillGrandDukeLabel = document.createElement("div");
  932. toxicSpillGrandDukeLabel.classList.add("toxicSpillGrandDukeLabel");
  933. var toxicSpillGrandDukeLabelText = document.createTextNode("Grand Duke in:");
  934. toxicSpillGrandDukeLabel.appendChild(toxicSpillGrandDukeLabelText);
  935. var toxicSpillGrandDukeValue = document.createElement("div");
  936. toxicSpillGrandDukeValue.classList.add("toxicSpillGrandDukeValue");
  937. var toxicSpillGrandDukeValueText = document.createTextNode("?");
  938. toxicSpillGrandDukeValue.appendChild(toxicSpillGrandDukeValueText);
  939. $(toxicSpillGrandDukeLabel).css({
  940. 'float': 'left',
  941. 'font-weight': 700,
  942. "marginRight": "5px"
  943. })
  944. $(toxicSpillGrandDukeValue).css("marginLeft", "50px");
  945. toxicSpillGrandDuke.appendChild(toxicSpillGrandDukeLabel);
  946. toxicSpillGrandDuke.appendChild(toxicSpillGrandDukeValue);
  947. //Archduke
  948. var toxicSpillArchduke = document.createElement("div");
  949. toxicSpillArchduke.classList.add("toxicSpillArchduke");
  950. var toxicSpillArchdukeLabel = document.createElement("div");
  951. toxicSpillArchdukeLabel.classList.add("toxicSpillArchdukeLabel");
  952. var toxicSpillArchdukeLabelText = document.createTextNode("Archduke in:");
  953. toxicSpillArchdukeLabel.appendChild(toxicSpillArchdukeLabelText);
  954. var toxicSpillArchdukeValue = document.createElement("div");
  955. toxicSpillArchdukeValue.classList.add("toxicSpillArchdukeValue");
  956. var toxicSpillArchdukeValueText = document.createTextNode("?");
  957. toxicSpillArchdukeValue.appendChild(toxicSpillArchdukeValueText);
  958. $(toxicSpillArchdukeLabel).css({
  959. 'float': 'left',
  960. 'font-weight': 700,
  961. "marginRight": "5px"
  962. })
  963. $(toxicSpillArchdukeValue).css("marginLeft", "50px");
  964. toxicSpillArchduke.appendChild(toxicSpillArchdukeLabel);
  965. toxicSpillArchduke.appendChild(toxicSpillArchdukeValue);
  966. //Append
  967. toxicSpill.appendChild(toxicSpillHeader);
  968. toxicSpill.appendChild(toxicSpillHero);
  969. toxicSpill.appendChild(toxicSpillKnight);
  970. toxicSpill.appendChild(toxicSpillLord);
  971. toxicSpill.appendChild(toxicSpillBaron);
  972. toxicSpill.appendChild(toxicSpillCount);
  973. toxicSpill.appendChild(toxicSpillDuke);
  974. toxicSpill.appendChild(toxicSpillGrandDuke);
  975. toxicSpill.appendChild(toxicSpillArchduke);
  976. return toxicSpill;
  977. }
  978.  
  979. function updateToxicSpillTimer() {
  980. if ($(".toxicSpill").length < 1) return;
  981. var toxicSpill = $(".toxicSpill");
  982. $(".toxicSpill").children().show();
  983. var firstHero = 1503597600;
  984. var now = todayNow();
  985. let timePassedHours = (now - firstHero) / 3600;
  986. var rotaionLenght = 302;
  987. var rotationsExact = timePassedHours / rotaionLenght;
  988. var rotationsInteger = Math.floor(rotationsExact);
  989. var partialrotation = (rotationsExact - rotationsInteger) * rotaionLenght;
  990. var heroObj = new season(0, 0, 0);
  991. var knightObj = new season(0, 0, 0);
  992. var lordObj = new season(0, 0, 0);
  993. var baronObj = new season(0, 0, 0);
  994. var countObj = new season(0, 0, 0);
  995. var dukeObj = new season(0, 0, 0);
  996. var granddukeObj = new season(0, 0, 0);
  997. var archdukeObj = new season(0, 0, 0);
  998. if (partialrotation < 15) {
  999. //Hero Rising
  1000. $(".toxicSpillHeaderValue").text("HERO-RISING");
  1001. var timeKnight = (15 - partialrotation).toPrecision(4);
  1002. knightObj.hours = Math.floor(timeKnight);
  1003. knightObj.minutes = Math.ceil((timeKnight - knightObj.hours) * 60);
  1004. knightObj = convertToDyHrMn(0, knightObj.hours, knightObj.minutes);
  1005. lordObj = convertToDyHrMn(knightObj.days, knightObj.hours + 16, knightObj.minutes);
  1006. baronObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  1007. countObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1008. dukeObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1009. $(".toxicSpillKnightLabel").text("Knight in:");
  1010. $(".toxicSpillLordLabel").text("Lord in:");
  1011. $(".toxicSpillBaronLabel").text("Baron in:");
  1012. $(".toxicSpillCountLabel").text("Count in:");
  1013. $(".toxicSpillDukeLabel").text("Duke in:");
  1014. toxicSpill.append($(".toxicSpillKnight"));
  1015. toxicSpill.append($(".toxicSpillLord"));
  1016. toxicSpill.append($(".toxicSpillBaron"));
  1017. toxicSpill.append($(".toxicSpillCount"));
  1018. toxicSpill.append($(".toxicSpillDuke"));
  1019. $(".toxicSpillHero").hide();
  1020. $(".toxicSpillGrandDuke").hide();
  1021. $(".toxicSpillArchduke").hide();
  1022. } else if (partialrotation >= 15 && partialrotation < 31) {
  1023. //Knight Rising
  1024. $(".toxicSpillHeaderValue").text("KNIGHT-RISING");
  1025. var timeLord = (31 - partialrotation).toPrecision(4);
  1026. lordObj.hours = Math.floor(timeLord);
  1027. lordObj.minutes = Math.ceil((timeLord - lordObj.hours) * 60);
  1028. lordObj = convertToDyHrMn(0, lordObj.hours, lordObj.minutes);
  1029. baronObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  1030. countObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1031. dukeObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1032. granddukeObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours, dukeObj.minutes);
  1033. $(".toxicSpillLordLabel").text("Lord in:");
  1034. $(".toxicSpillBaronLabel").text("Baron in:");
  1035. $(".toxicSpillCountLabel").text("Count in:");
  1036. $(".toxicSpillDukeLabel").text("Duke in:");
  1037. $(".toxicSpillGrandDukeLabel").text("Grand Duke in:");
  1038. toxicSpill.append($(".toxicSpillLord"));
  1039. toxicSpill.append($(".toxicSpillBaron"));
  1040. toxicSpill.append($(".toxicSpillCount"));
  1041. toxicSpill.append($(".toxicSpillDuke"));
  1042. toxicSpill.append($(".toxicSpillGrandDuke"));
  1043. $(".toxicSpillHero").hide();
  1044. $(".toxicSpillKnight").hide();
  1045. $(".toxicSpillArchduke").hide();
  1046. } else if (partialrotation >= 31 && partialrotation < 49) {
  1047. //Lord Rising
  1048. $(".toxicSpillHeaderValue").text("LORD-RISING");
  1049. var timeBaron = (49 - partialrotation).toPrecision(4);
  1050. baronObj.hours = Math.floor(timeBaron);
  1051. baronObj.minutes = Math.ceil((timeBaron - baronObj.hours) * 60);
  1052. baronObj = convertToDyHrMn(0, baronObj.hours, baronObj.minutes);
  1053. countObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1054. dukeObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1055. granddukeObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours, dukeObj.minutes);
  1056. archdukeObj = convertToDyHrMn(granddukeObj.days + 1, granddukeObj.hours, granddukeObj.minutes);
  1057. $(".toxicSpillBaronLabel").text("Baron in:");
  1058. $(".toxicSpillCountLabel").text("Count in:");
  1059. $(".toxicSpillDukeLabel").text("Duke in:");
  1060. $(".toxicSpillGrandDukeLabel").text("Grand Duke in:");
  1061. $(".toxicSpillLordLabel").text("Archduke in:");
  1062. toxicSpill.append($(".toxicSpillBaron"));
  1063. toxicSpill.append($(".toxicSpillCount"));
  1064. toxicSpill.append($(".toxicSpillDuke"));
  1065. toxicSpill.append($(".toxicSpillGrandDuke"));
  1066. toxicSpill.append($(".toxicSpillArchduke"));
  1067. $(".toxicSpillHero").hide();
  1068. $(".toxicSpillKnight").hide();
  1069. $(".toxicSpillLord").hide();
  1070. } else if (partialrotation >= 49 && partialrotation < 67) {
  1071. //Baron Rising
  1072. $(".toxicSpillHeaderValue").text("BARON-RISING");
  1073. var timeCount = (67 - partialrotation).toPrecision(4);
  1074. countObj.hours = Math.floor(timeCount);
  1075. countObj.minutes = Math.ceil((timeCount - countObj.hours) * 60);
  1076. countObj = convertToDyHrMn(0, countObj.hours, countObj.minutes);
  1077. dukeObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1078. granddukeObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours, dukeObj.minutes);
  1079. archdukeObj = convertToDyHrMn(granddukeObj.days + 1, granddukeObj.hours, granddukeObj.minutes);
  1080. countObj = convertToDyHrMn(archdukeObj.days + 3, archdukeObj.hours, archdukeObj.minutes);
  1081. baronObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1082. $(".toxicSpillGrandDukeLabel").text("Grand Duke in:");
  1083. $(".toxicSpillLordLabel").text("Archduke in:");
  1084. $(".toxicSpillDukeLabel").text("Duke in:");
  1085. $(".toxicSpillCountLabel").text("Count in:");
  1086. $(".toxicSpillBaronLabel").text("Baron Falling in:");
  1087. toxicSpill.append($(".toxicSpillCount"));
  1088. toxicSpill.append($(".toxicSpillDuke"));
  1089. toxicSpill.append($(".toxicSpillGrandDuke"));
  1090. toxicSpill.append($(".toxicSpillArchduke"));
  1091. toxicSpill.append($(".toxicSpillBaron"));
  1092. $(".toxicSpillHero").hide();
  1093. $(".toxicSpillKnight").hide();
  1094. $(".toxicSpillLord").hide();
  1095. } else if (partialrotation >= 67 && partialrotation < 91) {
  1096. //Count Rising
  1097. $(".toxicSpillHeaderValue").text("COUNT-RISING");
  1098. var timeDuke = (91 - partialrotation).toPrecision(4);
  1099. dukeObj.hours = Math.floor(timeDuke);
  1100. dukeObj.minutes = Math.ceil((timeDuke - dukeObj.hours) * 60);
  1101. dukeObj = convertToDyHrMn(0, dukeObj.hours, dukeObj.minutes);
  1102. granddukeObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours, dukeObj.minutes);
  1103. archdukeObj = convertToDyHrMn(granddukeObj.days + 1, granddukeObj.hours, granddukeObj.minutes);
  1104. countObj = convertToDyHrMn(archdukeObj.days + 3, archdukeObj.hours, archdukeObj.minutes);
  1105. baronObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1106. $(".toxicSpillGrandDukeLabel").text("Grand Duke in:");
  1107. $(".toxicSpillLordLabel").text("Archduke in:");
  1108. $(".toxicSpillDukeLabel").text("Duke in:");
  1109. $(".toxicSpillCountLabel").text("Count Falling in:");
  1110. $(".toxicSpillBaronLabel").text("Baron in:");
  1111. toxicSpill.append($(".toxicSpillDuke"));
  1112. toxicSpill.append($(".toxicSpillGrandDuke"));
  1113. toxicSpill.append($(".toxicSpillArchduke"));
  1114. toxicSpill.append($(".toxicSpillCount"));
  1115. toxicSpill.append($(".toxicSpillBaron"));
  1116. $(".toxicSpillHero").hide();
  1117. $(".toxicSpillKnight").hide();
  1118. $(".toxicSpillLord").hide();
  1119. } else if (partialrotation >= 91 && partialrotation < 115) {
  1120. //Duke Rising
  1121. $(".toxicSpillHeaderValue").text("DUKE-RISING");
  1122. var timeGrandDuke = (115 - partialrotation).toPrecision(4);
  1123. granddukeObj.hours = Math.floor(timeGrandDuke);
  1124. granddukeObj.minutes = Math.ceil((timeGrandDuke - granddukeObj.hours) * 60);
  1125. granddukeObj = convertToDyHrMn(0, granddukeObj.hours, granddukeObj.minutes);
  1126. archdukeObj = convertToDyHrMn(granddukeObj.days + 1, granddukeObj.hours, granddukeObj.minutes);
  1127. dukeObj = convertToDyHrMn(archdukeObj.days + 2, archdukeObj.hours, archdukeObj.minutes);
  1128. countObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours + 10, dukeObj.minutes);
  1129. baronObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1130. $(".toxicSpillGrandDukeLabel").text("Grand Duke in:");
  1131. $(".toxicSpillLordLabel").text("Archduke in:");
  1132. $(".toxicSpillDukeLabel").text("Duke Falling in:");
  1133. $(".toxicSpillCountLabel").text("Count in:");
  1134. $(".toxicSpillBaronLabel").text("Baron in:");
  1135. toxicSpill.append($(".toxicSpillGrandDuke"));
  1136. toxicSpill.append($(".toxicSpillArchduke"));
  1137. toxicSpill.append($(".toxicSpillDuke"));
  1138. toxicSpill.append($(".toxicSpillCount"));
  1139. toxicSpill.append($(".toxicSpillBaron"));
  1140. $(".toxicSpillHero").hide();
  1141. $(".toxicSpillKnight").hide();
  1142. $(".toxicSpillLord").hide();
  1143. } else if (partialrotation >= 115 && partialrotation < 139) {
  1144. //Grand Duke Rising
  1145. $(".toxicSpillHeaderValue").text("GD-RISING");
  1146. var timeArchduke = (139 - partialrotation).toPrecision(4);
  1147. archdukeObj.hours = Math.floor(timeArchduke);
  1148. archdukeObj.minutes = Math.ceil((timeArchduke - archdukeObj.hours) * 60);
  1149. archdukeObj = convertToDyHrMn(0, archdukeObj.hours, archdukeObj.minutes);
  1150. granddukeObj = convertToDyHrMn(archdukeObj.days, archdukeObj.hours + 24, archdukeObj.minutes);
  1151. dukeObj = convertToDyHrMn(0, granddukeObj.hours + 24, granddukeObj.minutes);
  1152. countObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours + 10, dukeObj.minutes);
  1153. baronObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1154. $(".toxicSpillLordLabel").text("Archduke in:");
  1155. $(".toxicSpillGrandDukeLabel").text("GD Falling in:");
  1156. $(".toxicSpillDukeLabel").text("Duke in:");
  1157. $(".toxicSpillCountLabel").text("Count in:");
  1158. $(".toxicSpillBaronLabel").text("Baron in:");
  1159. toxicSpill.append($(".toxicSpillArchduke"));
  1160. toxicSpill.append($(".toxicSpillGrandDuke"));
  1161. toxicSpill.append($(".toxicSpillDuke"));
  1162. toxicSpill.append($(".toxicSpillCount"));
  1163. toxicSpill.append($(".toxicSpillBaron"));
  1164. $(".toxicSpillHero").hide();
  1165. $(".toxicSpillKnight").hide();
  1166. $(".toxicSpillLord").hide();
  1167. } else if (partialrotation >= 139 && partialrotation < 151) {
  1168. //Archduke Falling
  1169. $(".toxicSpillHeaderValue").text("AD-FALLING");
  1170. var timeArchduke = (151 - partialrotation).toPrecision(4);
  1171. archdukeObj.hours = Math.floor(timeArchduke);
  1172. archdukeObj.minutes = Math.ceil((timeArchduke - archdukeObj.hours) * 60);
  1173. archdukeObj = convertToDyHrMn(0, archdukeObj.hours, archdukeObj.minutes);
  1174. granddukeObj = convertToDyHrMn(archdukeObj.days, archdukeObj.hours + 12, archdukeObj.minutes);
  1175. dukeObj = convertToDyHrMn(0, granddukeObj.hours + 24, granddukeObj.minutes);
  1176. countObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours + 10, dukeObj.minutes);
  1177. baronObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1178. $(".toxicSpillLordLabel").text("AD Falling in:");
  1179. $(".toxicSpillGrandDukeLabel").text("Grand Duke in:");
  1180. $(".toxicSpillDukeLabel").text("Duke in:");
  1181. $(".toxicSpillCountLabel").text("Count in:");
  1182. $(".toxicSpillBaronLabel").text("Baron in:");
  1183. toxicSpill.append($(".toxicSpillArchduke"));
  1184. toxicSpill.append($(".toxicSpillGrandDuke"));
  1185. toxicSpill.append($(".toxicSpillDuke"));
  1186. toxicSpill.append($(".toxicSpillCount"));
  1187. toxicSpill.append($(".toxicSpillBaron"));
  1188. $(".toxicSpillHero").hide();
  1189. $(".toxicSpillKnight").hide();
  1190. $(".toxicSpillLord").hide();
  1191. } else if (partialrotation >= 151 && partialrotation < 163) {
  1192. //Archduke Falling
  1193. $(".toxicSpillHeaderValue").text("AD-FALLING");
  1194. var timeGDuke = (163 - partialrotation).toPrecision(4);
  1195. granddukeObj.hours = Math.floor(timeGDuke);
  1196. granddukeObj.minutes = Math.ceil((timeGDuke - granddukeObj.hours) * 60);
  1197. granddukeObj = convertToDyHrMn(0, granddukeObj.hours, granddukeObj.minutes);
  1198. dukeObj = convertToDyHrMn(0, granddukeObj.hours + 24, granddukeObj.minutes);
  1199. countObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours + 10, dukeObj.minutes);
  1200. baronObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1201. lordObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1202. $(".toxicSpillGrandDukeLabel").text("Grand Duke in:");
  1203. $(".toxicSpillDukeLabel").text("Duke in:");
  1204. $(".toxicSpillCountLabel").text("Count in:");
  1205. $(".toxicSpillBaronLabel").text("Baron in:");
  1206. $(".toxicSpillLordLabel").text("Lord in:");
  1207. toxicSpill.append($(".toxicSpillGrandDuke"));
  1208. toxicSpill.append($(".toxicSpillDuke"));
  1209. toxicSpill.append($(".toxicSpillCount"));
  1210. toxicSpill.append($(".toxicSpillBaron"));
  1211. toxicSpill.append($(".toxicSpillLord"));
  1212. $(".toxicSpillHero").hide();
  1213. $(".toxicSpillKnight").hide();
  1214. $(".toxicSpillArchduke").hide();
  1215. } else if (partialrotation >= 163 && partialrotation < 187) {
  1216. //Grand Duke Falling
  1217. $(".toxicSpillHeaderValue").text("GD-FALLING");
  1218. var timeDuke = (187 - partialrotation).toPrecision(4);
  1219. dukeObj.hours = Math.floor(timeDuke);
  1220. dukeObj.minutes = Math.ceil((timeDuke - dukeObj.hours) * 60);
  1221. dukeObj = convertToDyHrMn(0, dukeObj.hours, dukeObj.minutes);
  1222. countObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours + 10, dukeObj.minutes);
  1223. baronObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1224. lordObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1225. knightObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  1226. $(".toxicSpillDukeLabel").text("Duke in:");
  1227. $(".toxicSpillCountLabel").text("Count in:");
  1228. $(".toxicSpillBaronLabel").text("Baron in:");
  1229. $(".toxicSpillLordLabel").text("Lord in:");
  1230. $(".toxicSpillKnightLabel").text("Knight in:");
  1231. toxicSpill.append($(".toxicSpillDuke"));
  1232. toxicSpill.append($(".toxicSpillCount"));
  1233. toxicSpill.append($(".toxicSpillBaron"));
  1234. toxicSpill.append($(".toxicSpillLord"));
  1235. toxicSpill.append($(".toxicSpillKnight"));
  1236. $(".toxicSpillHero").hide();
  1237. $(".toxicSpillGrandDuke").hide();
  1238. $(".toxicSpillArchduke").hide();
  1239. } else if (partialrotation >= 187 && partialrotation < 211) {
  1240. //Duke Falling
  1241. $(".toxicSpillHeaderValue").text("DUKE-FALLING");
  1242. var timeCount = (211 - partialrotation).toPrecision(4);
  1243. countObj.hours = Math.floor(timeCount);
  1244. countObj.minutes = Math.ceil((timeCount - countObj.hours) * 60);
  1245. countObj = convertToDyHrMn(0, countObj.hours, countObj.minutes);
  1246. baronObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1247. lordObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1248. knightObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  1249. heroObj = convertToDyHrMn(knightObj.days, knightObj.hours + 16, knightObj.minutes);
  1250. $(".toxicSpillCountLabel").text("Count in:");
  1251. $(".toxicSpillBaronLabel").text("Baron in:");
  1252. $(".toxicSpillLordLabel").text("Lord in:");
  1253. $(".toxicSpillKnightLabel").text("Knight in:");
  1254. $(".toxicSpillHeroLabel").text("Hero in:");
  1255. toxicSpill.append($(".toxicSpillCount"));
  1256. toxicSpill.append($(".toxicSpillBaron"));
  1257. toxicSpill.append($(".toxicSpillLord"));
  1258. toxicSpill.append($(".toxicSpillKnight"));
  1259. toxicSpill.append($(".toxicSpillHero"));
  1260. $(".toxicSpillDuke").hide();
  1261. $(".toxicSpillGrandDuke").hide();
  1262. $(".toxicSpillArchduke").hide();
  1263. } else if (partialrotation >= 211 && partialrotation < 235) {
  1264. //Count Falling
  1265. $(".toxicSpillHeaderValue").text("COUNT-FALLING");
  1266. var timeBaron = (235 - partialrotation).toPrecision(4);
  1267. baronObj.hours = Math.floor(timeBaron);
  1268. baronObj.minutes = Math.ceil((timeBaron - baronObj.hours) * 60);
  1269. baronObj = convertToDyHrMn(0, baronObj.hours, baronObj.minutes);
  1270. lordObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1271. knightObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  1272. heroObj = convertToDyHrMn(knightObj.days, knightObj.hours + 16, knightObj.minutes);
  1273. countObj = convertToDyHrMn(heroObj.days + 3, heroObj.hours + 10, heroObj.minutes);
  1274. $(".toxicSpillBaronLabel").text("Baron in:");
  1275. $(".toxicSpillLordLabel").text("Lord in:");
  1276. $(".toxicSpillKnightLabel").text("Knight in:");
  1277. $(".toxicSpillHeroLabel").text("Hero in:");
  1278. $(".toxicSpillCountLabel").text("Count Rising in:");
  1279. toxicSpill.append($(".toxicSpillBaron"));
  1280. toxicSpill.append($(".toxicSpillLord"));
  1281. toxicSpill.append($(".toxicSpillKnight"));
  1282. toxicSpill.append($(".toxicSpillHero"));
  1283. toxicSpill.append($(".toxicSpillCount"));
  1284. $(".toxicSpillDuke").hide();
  1285. $(".toxicSpillGrandDuke").hide();
  1286. $(".toxicSpillArchduke").hide();
  1287. } else if (partialrotation >= 235 && partialrotation < 253) {
  1288. //Baron Falling
  1289. $(".toxicSpillHeaderValue").text("BARON-FALLING");
  1290. var timeLord = (253 - partialrotation).toPrecision(4);
  1291. lordObj.hours = Math.floor(timeLord);
  1292. lordObj.minutes = Math.ceil((timeLord - lordObj.hours) * 60);
  1293. lordObj = convertToDyHrMn(0, lordObj.hours, lordObj.minutes);
  1294. knightObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  1295. heroObj = convertToDyHrMn(knightObj.days, knightObj.hours + 16, knightObj.minutes);
  1296. baronObj = convertToDyHrMn(heroObj.days + 2, heroObj.hours + 16, heroObj.minutes);
  1297. countObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1298. $(".toxicSpillCountLabel").text("Count in:");
  1299. $(".toxicSpillBaronLabel").text("Baron Rising in:");
  1300. $(".toxicSpillLordLabel").text("Lord in:");
  1301. $(".toxicSpillKnightLabel").text("Knight in:");
  1302. $(".toxicSpillHeroLabel").text("Hero in:");
  1303. toxicSpill.append($(".toxicSpillLord"));
  1304. toxicSpill.append($(".toxicSpillKnight"));
  1305. toxicSpill.append($(".toxicSpillHero"));
  1306. toxicSpill.append($(".toxicSpillBaron"));
  1307. toxicSpill.append($(".toxicSpillCount"));
  1308. $(".toxicSpillDuke").hide();
  1309. $(".toxicSpillGrandDuke").hide();
  1310. $(".toxicSpillArchduke").hide();
  1311. } else if (partialrotation >= 256 && partialrotation < 271) {
  1312. //Lord Falling
  1313. $(".toxicSpillHeaderValue").text("LORD-FALLING");
  1314. var timeKnight = (271 - partialrotation).toPrecision(4);
  1315. knightObj.hours = Math.floor(timeKnight);
  1316. knightObj.minutes = Math.ceil((timeKnight - knightObj.hours) * 60);
  1317. knightObj = convertToDyHrMn(0, knightObj.hours, knightObj.minutes);
  1318. heroObj = convertToDyHrMn(knightObj.days, knightObj.hours + 16, knightObj.minutes);
  1319. lordObj = convertToDyHrMn(heroObj.days + 1, heroObj.hours + 22, heroObj.minutes);
  1320. baronObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  1321. countObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1322. $(".toxicSpillCountLabel").text("Count in:");
  1323. $(".toxicSpillBaronLabel").text("Baron in:");
  1324. $(".toxicSpillLordLabel").text("Lord Rising in:");
  1325. $(".toxicSpillKnightLabel").text("Knight in:");
  1326. $(".toxicSpillHeroLabel").text("Hero in:");
  1327. toxicSpill.append($(".toxicSpillKnight"));
  1328. toxicSpill.append($(".toxicSpillHero"));
  1329. toxicSpill.append($(".toxicSpillLord"));
  1330. toxicSpill.append($(".toxicSpillBaron"));
  1331. toxicSpill.append($(".toxicSpillCount"));
  1332. $(".toxicSpillDuke").hide();
  1333. $(".toxicSpillGrandDuke").hide();
  1334. $(".toxicSpillArchduke").hide();
  1335. } else if (partialrotation >= 271 && partialrotation < 287) {
  1336. //Knight Falling
  1337. $(".toxicSpillHeaderValue").text("KNIGHT-FALLING");
  1338. var timeHero = (287 - partialrotation).toPrecision(4);
  1339. heroObj.hours = Math.floor(timeHero);
  1340. heroObj.minutes = Math.ceil((timeHero - heroObj.hours) * 60);
  1341. heroObj = convertToDyHrMn(0, heroObj.hours, heroObj.minutes);
  1342. knightObj = convertToDyHrMn(heroObj.days + 1, heroObj.hours + 6, heroObj.minutes);
  1343. lordObj = convertToDyHrMn(knightObj.days, knightObj.hours + 16, knightObj.minutes);
  1344. baronObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  1345. countObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1346. $(".toxicSpillCountLabel").text("Count in:");
  1347. $(".toxicSpillBaronLabel").text("Baron in:");
  1348. $(".toxicSpillLordLabel").text("Lord in:");
  1349. $(".toxicSpillKnightLabel").text("Knight Rising in:");
  1350. $(".toxicSpillHeroLabel").text("Hero in:");
  1351. toxicSpill.append($(".toxicSpillHero"));
  1352. toxicSpill.append($(".toxicSpillKnight"));
  1353. toxicSpill.append($(".toxicSpillLord"));
  1354. toxicSpill.append($(".toxicSpillBaron"));
  1355. toxicSpill.append($(".toxicSpillCount"));
  1356. $(".toxicSpillDuke").hide();
  1357. $(".toxicSpillGrandDuke").hide();
  1358. $(".toxicSpillArchduke").hide();
  1359. } else if (partialrotation >= 287 && partialrotation < 302) {
  1360. //Hero Falling
  1361. $(".toxicSpillHeaderValue").text("HERO-FALLING");
  1362. var timeHero = (302 - partialrotation).toPrecision(4);
  1363. heroObj.hours = Math.floor(timeHero);
  1364. heroObj.minutes = Math.ceil((timeHero - heroObj.hours) * 60);
  1365. heroObj = convertToDyHrMn(0, heroObj.hours, heroObj.minutes);
  1366. knightObj = convertToDyHrMn(heroObj.days, heroObj.hours + 15, heroObj.minutes);
  1367. lordObj = convertToDyHrMn(knightObj.days, knightObj.hours + 16, knightObj.minutes);
  1368. baronObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  1369. countObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1370. $(".toxicSpillCountLabel").text("Count in:");
  1371. $(".toxicSpillBaronLabel").text("Baron in:");
  1372. $(".toxicSpillLordLabel").text("Lord in:");
  1373. $(".toxicSpillKnightLabel").text("Knight in:");
  1374. $(".toxicSpillHeroLabel").text("Hero Rising in:");
  1375. toxicSpill.append($(".toxicSpillHero"));
  1376. toxicSpill.append($(".toxicSpillKnight"));
  1377. toxicSpill.append($(".toxicSpillLord"));
  1378. toxicSpill.append($(".toxicSpillBaron"));
  1379. toxicSpill.append($(".toxicSpillCount"));
  1380. $(".toxicSpillDuke").hide();
  1381. $(".toxicSpillGrandDuke").hide();
  1382. $(".toxicSpillArchduke").hide();
  1383. } else {
  1384. //WTF are we?
  1385. }
  1386. $(".toxicSpillArchdukeValue").text(archdukeObj.days + "d " + archdukeObj.hours + "h " + archdukeObj.minutes + "m");
  1387. $(".toxicSpillGrandDukeValue").text(granddukeObj.days + "d " + granddukeObj.hours + "h " + granddukeObj.minutes + "m");
  1388. $(".toxicSpillDukeValue").text(dukeObj.days + "d " + dukeObj.hours + "h " + dukeObj.minutes + "m");
  1389. $(".toxicSpillCountValue").text(countObj.days + "d " + countObj.hours + "h " + countObj.minutes + "m");
  1390. $(".toxicSpillBaronValue").text(baronObj.days + "d " + baronObj.hours + "h " + baronObj.minutes + "m");
  1391. $(".toxicSpillLordValue").text(lordObj.days + "d " + lordObj.hours + "h " + lordObj.minutes + "m");
  1392. $(".toxicSpillKnightValue").text(knightObj.days + "d " + knightObj.hours + "h " + knightObj.minutes + "m");
  1393. $(".toxicSpillHeroValue").text(heroObj.days + "d " + heroObj.hours + "h " + heroObj.minutes + "m");
  1394. //https://mhwiki.hitgrab.com/wiki/index.php/Toxic_Spill#Pollution_Levels
  1395. }
  1396.  
  1397. function spillLevel(days, hours, minutes) {
  1398. this.days = days;
  1399. this.hours = hours;
  1400. this.minutes = minutes;
  1401. }
  1402.  
  1403. $(document).on('change', '#toxicSpillCb', function() {
  1404. if (this.checked) {
  1405. localStorage.setItem('RemindSpill', "Y")
  1406. this.checked = "Yes";
  1407. } else {
  1408. localStorage.setItem('RemindSpill', "N")
  1409. this.checked = "";
  1410. }
  1411. })
  1412. //============================================================================================
  1413. function todayNow() {
  1414. var today = new Date();
  1415. var todayEpoch = today.getTime() / 1000.0;
  1416. return todayEpoch;
  1417. }
  1418.  
  1419. function convertToDyHrMn(days, hours, minutes) {
  1420. if (hours >= 24) {
  1421. var daysExact = hours / 24;
  1422. var daysTrunc = Math.floor(daysExact);
  1423. var partialDays = daysExact - daysTrunc;
  1424. hours = Math.floor(partialDays * 24);
  1425. days = daysTrunc + days;
  1426. }
  1427. return {
  1428. days,
  1429. hours,
  1430. minutes
  1431. }
  1432. }
  1433.  
  1434. function travelToGrove(destination) {
  1435. fetch("https://www.mousehuntgame.com/managers/ajax/users/changeenvironment.php", {
  1436. "credentials": "include",
  1437. "headers": {
  1438. "accept": "application/json, text/javascript, */*; q=0.01",
  1439. "accept-language": "en-US,en;q=0.9",
  1440. "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
  1441. "sec-fetch-mode": "cors",
  1442. "sec-fetch-site": "same-origin",
  1443. "x-requested-with": "XMLHttpRequest"
  1444. },
  1445. "referrer": "https://www.mousehuntgame.com/travel.php?tab=map",
  1446. "referrerPolicy": "no-referrer-when-downgrade",
  1447. "body": "sn=Hitgrab&hg_is_ajax=1&destination=forbidden_grove&uh=JqeHeJjz",
  1448. "method": "POST",
  1449. "mode": "cors"
  1450. });
  1451. }
  1452.  
  1453. function travelToCove(destination) {
  1454. fetch("https://www.mousehuntgame.com/managers/ajax/users/changeenvironment.php", {
  1455. "credentials": "include",
  1456. "headers": {
  1457. "accept": "application/json, text/javascript, */*; q=0.01",
  1458. "accept-language": "en-US,en;q=0.9",
  1459. "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
  1460. "sec-fetch-mode": "cors",
  1461. "sec-fetch-site": "same-origin",
  1462. "x-requested-with": "XMLHttpRequest"
  1463. },
  1464. "referrer": "https://www.mousehuntgame.com/travel.php?tab=map",
  1465. "referrerPolicy": "no-referrer-when-downgrade",
  1466. "body": "sn=Hitgrab&hg_is_ajax=1&destination=balacks_cove&uh=JqeHeJjz",
  1467. "method": "POST",
  1468. "mode": "cors"
  1469. });
  1470. }
  1471.  
  1472. function travelToGarden(destination) {
  1473. fetch("https://www.mousehuntgame.com/managers/ajax/users/changeenvironment.php", {
  1474. "credentials": "include",
  1475. "headers": {
  1476. "accept": "application/json, text/javascript, */*; q=0.01",
  1477. "accept-language": "en-US,en;q=0.9",
  1478. "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
  1479. "sec-fetch-mode": "cors",
  1480. "sec-fetch-site": "same-origin",
  1481. "x-requested-with": "XMLHttpRequest"
  1482. },
  1483. "referrer": "https://www.mousehuntgame.com/travel.php?tab=map",
  1484. "referrerPolicy": "no-referrer-when-downgrade",
  1485. "body": "sn=Hitgrab&hg_is_ajax=1&destination=seasonal_garden&uh=JqeHeJjz",
  1486. "method": "POST",
  1487. "mode": "cors"
  1488. });
  1489. }
  1490.  
  1491. function travelToSpill(destination) {
  1492. fetch("https://www.mousehuntgame.com/managers/ajax/users/changeenvironment.php", {
  1493. "credentials": "include",
  1494. "headers": {
  1495. "accept": "application/json, text/javascript, */*; q=0.01",
  1496. "accept-language": "en-US,en;q=0.9",
  1497. "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
  1498. "sec-fetch-mode": "cors",
  1499. "sec-fetch-site": "same-origin",
  1500. "x-requested-with": "XMLHttpRequest"
  1501. },
  1502. "referrer": "https://www.mousehuntgame.com/travel.php?tab=map",
  1503. "referrerPolicy": "no-referrer-when-downgrade",
  1504. "body": "sn=Hitgrab&hg_is_ajax=1&destination=pollution_outbreak&uh=JqeHeJjz",
  1505. "method": "POST",
  1506. "mode": "cors"
  1507. });
  1508. }