MH Timers+

Handy script to keep track of the various MH location timers

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

  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.3.1
  6. // @description Handy script to keep track of the various MH location timers
  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. if ($(".accordion").length > 0) return;
  22. var container = $("#mousehuntContainer");
  23. var accordion = document.createElement("div");
  24. accordion.classList.add("accordion");
  25. $(accordion).css({
  26. 'background-image': "url('https://www.toptal.com/designers/subtlepatterns/patterns/interlaced.png')",
  27. 'width': '98%',
  28. 'height': '15px',
  29. 'padding': '5px',
  30. 'border': '2px solid black',
  31. });
  32. var accordionPrompt = document.createElement("div");
  33. accordionPrompt.classList.add("accordionPrompt");
  34. var accordionTitle = document.createElement("div");
  35. accordionTitle.classList.add("accordionTitle");
  36. $(accordionTitle).text("Mousehunt Timers+").css({
  37. 'float': 'left',
  38. 'padding': '1px 0',
  39. 'font-size': '12px',
  40. 'font-weight': 'bold'
  41. })
  42. $(accordionPrompt).text("Click to Hide").css({
  43. 'float': 'right',
  44. 'padding': '1px 0',
  45. 'font-size': '11px',
  46. 'font-weight': 'bold'
  47. })
  48. accordion.appendChild(accordionTitle)
  49. accordion.appendChild(accordionPrompt)
  50. var timerBox = document.createElement("div");
  51. if (localStorage.getItem('HideTimers') == "Y") {
  52. timerBox.classList.add("timerBox")
  53. timerBox.classList.add("hide");
  54. $(accordionPrompt).text("Click to Show")
  55. } else {
  56. timerBox.classList.add("timerBox");
  57. }
  58. $(timerBox).css({
  59. 'background-image': "url('https://www.toptal.com/designers/subtlepatterns/patterns/interlaced.png')"
  60. });
  61. $(timerBox).css({
  62. 'height': 112 + "px",
  63. 'padding': 2 + "px"
  64. });
  65. let forbiddenGrove = buildForbiddenGrove();
  66. let balacksCove = buildBalacksCove();
  67. let seasonalGarden = buildSeasonalGarden();
  68. let toxicSpill = buildToxicSpill();
  69. timerBox.appendChild(forbiddenGrove)
  70. timerBox.appendChild(balacksCove)
  71. timerBox.appendChild(seasonalGarden)
  72. timerBox.appendChild(toxicSpill)
  73. $(forbiddenGrove).css({
  74. 'float': 'left'
  75. })
  76. $(balacksCove).css({
  77. 'float': 'left',
  78. 'marginLeft': 1 + "px"
  79. })
  80. $(seasonalGarden).css({
  81. 'float': 'left',
  82. 'marginLeft': 1 + "px"
  83. })
  84. $(toxicSpill).css({
  85. 'float': 'left',
  86. 'marginLeft': 1 + "px"
  87. })
  88. //LAST
  89. container.prepend(timerBox)
  90. container.prepend(accordion)
  91.  
  92. }
  93. $(document).on('click', '.accordion', function() {
  94. console.log('clicked')
  95. if (localStorage.getItem('HideTimers') == "Y") {
  96. //show
  97. $('.timerBox').removeClass("hide")
  98. $('.accordionPrompt').text("Click to Hide")
  99. localStorage.setItem('HideTimers', "N")
  100. } else {
  101. //hide
  102. $('.timerBox').addClass("hide")
  103. $('.accordionPrompt').text("Click to Show")
  104. localStorage.setItem('HideTimers', "Y")
  105. }
  106. })
  107.  
  108. function buildControlPanels() {
  109. var timerBox = $(".timerBox");
  110. //FG
  111. var forbiddenGroveControlPanel = document.createElement("div");
  112. forbiddenGroveControlPanel.classList.add("forbiddenGroveControlPanel");
  113. var forbiddenGroveButton = document.createElement("button");
  114. forbiddenGroveButton.id = "forbiddenGroveButton";
  115. forbiddenGroveButton.innerText = "Travel";
  116. forbiddenGroveButton.addEventListener("click", travelToGrove);
  117. forbiddenGroveControlPanel.appendChild(forbiddenGroveButton);
  118. $(forbiddenGroveControlPanel).css({
  119. 'float': 'left',
  120. 'width': '21.5%'
  121. })
  122. $(forbiddenGroveButton).css({
  123. 'width': '75px',
  124. 'float': 'left',
  125. 'marginRight': 5 + "px"
  126. })
  127. var forbiddenGroveCb = document.createElement('input');
  128. forbiddenGroveCb.type = "checkbox";
  129. forbiddenGroveCb.name = "forbiddenGroveCb";
  130. forbiddenGroveCb.value = "value";
  131. forbiddenGroveCb.id = "forbiddenGroveCb";
  132. if (localStorage.getItem('RemindGrove') == "Y") {
  133. forbiddenGroveCb.checked = "Yes";
  134. } else {
  135. forbiddenGroveCb.checked = "";
  136. }
  137. var forbiddenGroveCbLabel = document.createElement('label')
  138. forbiddenGroveCbLabel.htmlFor = "forbiddenGroveCbLabel";
  139. forbiddenGroveCbLabel.appendChild(document.createTextNode('Remind '));
  140. forbiddenGroveControlPanel.appendChild(forbiddenGroveCbLabel);
  141. forbiddenGroveControlPanel.appendChild(forbiddenGroveCb)
  142. $(forbiddenGroveCbLabel).css({
  143. 'float': 'left',
  144. 'fontSize': "14px",
  145. 'width': '45px',
  146. })
  147. $(forbiddenGroveCb).css({
  148. 'float': 'left',
  149. 'width': '20px'
  150. })
  151. timerBox.append(forbiddenGroveControlPanel);
  152. //BC
  153. var balacksCoveControlPanel = document.createElement("div");
  154. balacksCoveControlPanel.classList.add("balacksCoveControlPanel");
  155. var balacksCoveButton = document.createElement("button");
  156. balacksCoveButton.id = "balacksCoveButton";
  157. balacksCoveButton.innerText = "Travel";
  158. balacksCoveButton.addEventListener("click", travelToCove);
  159. balacksCoveControlPanel.appendChild(balacksCoveButton);
  160. $(balacksCoveControlPanel).css({
  161. 'float': 'left',
  162. 'width': '25%',
  163. 'marginLeft': 5 + "px"
  164. })
  165. $(balacksCoveButton).css({
  166. 'width': '75px',
  167. 'float': 'left',
  168. 'marginRight': 5 + "px"
  169. })
  170. var balacksCoveCb = document.createElement('input');
  171. balacksCoveCb.type = "checkbox";
  172. balacksCoveCb.name = "balacksCoveCb";
  173. balacksCoveCb.value = "value";
  174. balacksCoveCb.id = "balacksCoveCb";
  175. if (localStorage.getItem('RemindCove') == "Y") {
  176. balacksCoveCb.checked = "Yes";
  177. } else {
  178. balacksCoveCb.checked = "";
  179. }
  180. var balacksCoveCbLabel = document.createElement('label')
  181. balacksCoveCbLabel.htmlFor = "balacksCoveCbLabel";
  182. balacksCoveCbLabel.appendChild(document.createTextNode('Remind '));
  183. balacksCoveControlPanel.appendChild(balacksCoveCbLabel);
  184. balacksCoveControlPanel.appendChild(balacksCoveCb)
  185. $(balacksCoveCbLabel).css({
  186. 'float': 'left',
  187. 'fontSize': "14px",
  188. 'width': '45px',
  189. })
  190. $(balacksCoveCb).css({
  191. 'float': 'left',
  192. 'width': '20px'
  193. })
  194. timerBox.append(balacksCoveControlPanel);
  195. //SG
  196. var seasonalGardenControlPanel = document.createElement("div");
  197. seasonalGardenControlPanel.classList.add("seasonalGardenControlPanel");
  198. var seasonalGardenButton = document.createElement("button");
  199. seasonalGardenButton.id = "seasonalGardenButton";
  200. seasonalGardenButton.innerText = "Travel";
  201. seasonalGardenButton.addEventListener("click", travelToGarden);
  202. seasonalGardenControlPanel.appendChild(seasonalGardenButton);
  203. $(seasonalGardenControlPanel).css({
  204. 'float': 'left',
  205. 'width': '24%',
  206. 'marginLeft': 5 + "px"
  207. })
  208. $(seasonalGardenButton).css({
  209. 'width': '75px',
  210. 'float': 'left',
  211. 'marginRight': 5 + "px"
  212. })
  213. var seasonalGardenCb = document.createElement('input');
  214. seasonalGardenCb.type = "checkbox";
  215. seasonalGardenCb.name = "seasonalGardenCb";
  216. seasonalGardenCb.value = "value";
  217. seasonalGardenCb.id = "seasonalGardenCb";
  218. if (localStorage.getItem('RemindGarden') == "Y") {
  219. seasonalGardenCb.checked = "Yes";
  220. } else {
  221. seasonalGardenCb.checked = "";
  222. }
  223. var seasonalGardenCbLabel = document.createElement('label')
  224. seasonalGardenCbLabel.htmlFor = "seasonalGardenCbLabel";
  225. seasonalGardenCbLabel.appendChild(document.createTextNode('Remind '));
  226. seasonalGardenControlPanel.appendChild(seasonalGardenCbLabel);
  227. seasonalGardenControlPanel.appendChild(seasonalGardenCb)
  228. $(seasonalGardenCbLabel).css({
  229. 'float': 'left',
  230. 'fontSize': "14px",
  231. 'width': '45px',
  232. })
  233. $(seasonalGardenCb).css({
  234. 'float': 'left',
  235. 'width': '20px'
  236. })
  237. timerBox.append(seasonalGardenControlPanel);
  238. //TS
  239. var toxicSpillControlPanel = document.createElement("div");
  240. toxicSpillControlPanel.classList.add("toxicSpillControlPanel");
  241. var toxicSpillButton = document.createElement("button");
  242. toxicSpillButton.id = "toxicSpillButton";
  243. toxicSpillButton.innerText = "Travel";
  244. toxicSpillButton.addEventListener("click", travelToSpill);
  245. toxicSpillControlPanel.appendChild(toxicSpillButton);
  246. $(toxicSpillControlPanel).css({
  247. 'float': 'left',
  248. 'width': '24%',
  249. 'marginLeft': 10 + "px"
  250. })
  251. $(toxicSpillButton).css({
  252. 'width': '75px',
  253. 'float': 'left',
  254. 'marginRight': 5 + "px"
  255. })
  256. var toxicSpillCb = document.createElement('input');
  257. toxicSpillCb.type = "checkbox";
  258. toxicSpillCb.name = "toxicSpillCb";
  259. toxicSpillCb.value = "value";
  260. toxicSpillCb.id = "toxicSpillCb";
  261. if (localStorage.getItem('RemindSpill') == "Y") {
  262. toxicSpillCb.checked = "Yes";
  263. } else {
  264. toxicSpillCb.checked = "";
  265. }
  266. var toxicSpillCbLabel = document.createElement('label')
  267. toxicSpillCbLabel.htmlFor = "toxicSpillCbLabel";
  268. toxicSpillCbLabel.appendChild(document.createTextNode('Remind '));
  269. toxicSpillControlPanel.appendChild(toxicSpillCbLabel);
  270. toxicSpillControlPanel.appendChild(toxicSpillCb)
  271. $(toxicSpillCbLabel).css({
  272. 'float': 'left',
  273. 'fontSize': "14px",
  274. 'width': '45px',
  275. })
  276. $(toxicSpillCb).css({
  277. 'float': 'left',
  278. 'width': '20px'
  279. })
  280. timerBox.append(toxicSpillControlPanel);
  281. }
  282.  
  283. function startTimers() {
  284. localStorage.setItem("mainTimer", 0);
  285. runTimers();
  286. }
  287.  
  288. function runTimers() {
  289. updateText();
  290. var myTimer = setInterval(updateText, 60000);
  291. }
  292.  
  293. function updateText() {
  294. if ($(".forbiddenGrove").length > 0) updateForbiddenGroveTimer();
  295. if ($(".balacksCove").length > 0) updateBalacksCoveTimer();
  296. if ($(".seasonalGarden").length > 0) updateSeasonalGardenTimer();
  297. if ($(".toxicSpill").length > 0) updateToxicSpillTimer();
  298. }
  299. //===================================== Forbidden Grove ======================================
  300. function buildForbiddenGrove() {
  301. if ($(".forbiddenGrove").length > 0) return;
  302. var timerBox = $(".timerBox");
  303. var forbiddenGrove = document.createElement("div");
  304. forbiddenGrove.classList.add("forbiddenGrove");
  305. $(forbiddenGrove).css({
  306. 'border': '1px solid black',
  307. 'width': '21%',
  308. 'height': '75%',
  309. 'padding': 2 + "px"
  310. });
  311. //Header
  312. var forbiddenGroveHeader = document.createElement("div");
  313. forbiddenGroveHeader.classList.add("forbiddenGroveHeader");
  314. var forbiddenGroveHeaderLabel = document.createElement("div");
  315. forbiddenGroveHeaderLabel.classList.add("forbiddenGroveHeaderLabel");
  316. var forbiddenGroveHeaderLabelText = document.createTextNode("Forbidden Grove is:");
  317. forbiddenGroveHeaderLabel.appendChild(forbiddenGroveHeaderLabelText);
  318. var forbiddenGroveHeaderValue = document.createElement("div");
  319. forbiddenGroveHeaderValue.classList.add("forbiddenGroveHeaderValue");
  320. var forbiddenGroveHeaderValueText = document.createTextNode("Open");
  321. forbiddenGroveHeaderValue.appendChild(forbiddenGroveHeaderValueText);
  322. $(forbiddenGroveHeaderLabel).css({
  323. 'float': 'left',
  324. 'font-weight': 700,
  325. "marginRight": "5px"
  326. })
  327. $(forbiddenGroveHeaderValue).css({
  328. "marginLeft": "100px"
  329. });
  330. forbiddenGroveHeader.appendChild(forbiddenGroveHeaderLabel);
  331. forbiddenGroveHeader.appendChild(forbiddenGroveHeaderValue);
  332. //Close
  333. var forbiddenGroveCloses = document.createElement("div");
  334. forbiddenGroveCloses.classList.add("forbiddenGroveCloses");
  335. var forbiddenGroveClosesLabel = document.createElement("div");
  336. forbiddenGroveClosesLabel.classList.add("forbiddenGroveClosesLabel");
  337. var forbiddenGroveClosesLabelText = document.createTextNode("Closes in:");
  338. forbiddenGroveClosesLabel.appendChild(forbiddenGroveClosesLabelText);
  339. var forbiddenGroveClosesValue = document.createElement("div");
  340. forbiddenGroveClosesValue.classList.add("forbiddenGroveClosesValue");
  341. var forbiddenGroveClosesValueText = document.createTextNode("?");
  342. forbiddenGroveClosesValue.appendChild(forbiddenGroveClosesValueText);
  343. $(forbiddenGroveClosesLabel).css({
  344. 'float': 'left',
  345. 'font-weight': 700,
  346. "marginRight": "5px"
  347. })
  348. forbiddenGroveCloses.appendChild(forbiddenGroveClosesLabel);
  349. forbiddenGroveCloses.appendChild(forbiddenGroveClosesValue);
  350. //Open
  351. var forbiddenGroveOpens = document.createElement("div");
  352. forbiddenGroveOpens.classList.add("forbiddenGroveOpens");
  353. var forbiddenGroveOpensLabel = document.createElement("div");
  354. forbiddenGroveOpensLabel.classList.add("forbiddenGroveOpensLabel");
  355. var forbiddenGroveOpensLabelText = document.createTextNode("Opens in:");
  356. forbiddenGroveOpensLabel.appendChild(forbiddenGroveOpensLabelText);
  357. var forbiddenGroveOpensValue = document.createElement("div");
  358. forbiddenGroveOpensValue.classList.add("forbiddenGroveOpensValue");
  359. var forbiddenGroveOpensValueText = document.createTextNode("??");
  360. forbiddenGroveOpensValue.appendChild(forbiddenGroveOpensValueText);
  361. $(forbiddenGroveOpensLabel).css({
  362. 'float': 'left',
  363. 'font-weight': 700,
  364. "marginRight": "5px"
  365. })
  366. forbiddenGroveOpens.appendChild(forbiddenGroveOpensLabel);
  367. forbiddenGroveOpens.appendChild(forbiddenGroveOpensValue);
  368.  
  369. //Append
  370. forbiddenGrove.appendChild(forbiddenGroveHeader);
  371. forbiddenGrove.appendChild(forbiddenGroveCloses);
  372. forbiddenGrove.appendChild(forbiddenGroveOpens);
  373. return forbiddenGrove;
  374. }
  375.  
  376. function updateForbiddenGroveTimer() {
  377. if ($(".forbiddenGrove").length < 1) return;
  378. var forbiddenGrove = $(".forbiddenGrove");
  379. var firstGroveOpen = 1285704000;
  380. var now = todayNow();
  381. let timePassedHours = (now - firstGroveOpen) / 3600;
  382. var rotaionLenght = 20;
  383. var rotationsExact = timePassedHours / rotaionLenght;
  384. var rotationsInteger = Math.trunc(rotationsExact);
  385. var partialrotation = (rotationsExact - rotationsInteger) * rotaionLenght;
  386. if (partialrotation < 16) {
  387. //Open
  388. $(".forbiddenGroveHeaderValue").text(" OPEN");
  389. $(".forbiddenGroveHeaderValue").css({
  390. 'color': 'green'
  391. })
  392. var timeCloses = (16 - partialrotation).toPrecision(4);
  393. var closesHours = Math.trunc(timeCloses);
  394. var closesMinutes = Math.ceil((timeCloses - closesHours) * 60);
  395. $(".forbiddenGroveClosesValue").text(closesHours + "h " + closesMinutes + "m");
  396. $(".forbiddenGroveClosesValue").css({
  397. 'float': 'right'
  398. }),
  399. $(".forbiddenGroveOpensLabel").text("Opens Again in:");
  400. $(".forbiddenGroveOpensValue").text((closesHours + 4) + "h " + closesMinutes + "m");
  401. $(".forbiddenGroveOpensValue").css({
  402. 'float': 'right'
  403. }),
  404. forbiddenGrove.append($(".forbiddenGroveOpens"))
  405. if ((closesHours == 0) && (closesMinutes <= 15) && (localStorage.getItem('RemindGrove') == "Y")) {
  406. if (confirm('The forbidden grove is closing soon, travel there now?') == true) {
  407. travelToGrove("skip");
  408. }
  409. localStorage.setItem('RemindGrove', "N")
  410. $("#forbiddenGroveCb").prop('checked', false)
  411. }
  412. } else {
  413. //Closed
  414. $(".forbiddenGroveHeaderValue").text("CLOSED")
  415. $(".forbiddenGroveHeaderValue").css({
  416. 'color': 'red'
  417. })
  418. var timeOpens = (rotaionLenght - partialrotation).toPrecision(4);
  419. var opensHours = Math.trunc(timeOpens);
  420. var opensMinutes = Math.ceil((timeOpens - opensHours) * 60);
  421. $(".forbiddenGroveOpensValue").text(opensHours + "h " + opensMinutes + "m");
  422. $(".forbiddenGroveOpensValue").css({
  423. 'float': 'right'
  424. }),
  425. $(".forbiddenGroveClosesLabel").text("Next Close in:");
  426. $(".forbiddenGroveClosesValue").text((opensHours + 16) + "h " + opensMinutes + "m");
  427. $(".forbiddenGroveClosesValue").css({
  428. 'float': 'right'
  429. }),
  430. forbiddenGrove.append($(".forbiddenGroveCloses"))
  431. if ((opensHours == 0) && (opensMinutes <= 15) && (localStorage.getItem('RemindGrove') == "Y")) {
  432. alert('The forbidden grove is opening soon')
  433. localStorage.setItem('RemindGrove', "N")
  434. $("#forbiddenGroveCb").prop('checked', false)
  435. }
  436. }
  437. }
  438. $(document).on('change', '#forbiddenGroveCb', function() {
  439. if (this.checked) {
  440. localStorage.setItem('RemindGrove', "Y")
  441. this.checked = "Yes";
  442. } else {
  443. localStorage.setItem('RemindGrove', "N")
  444. this.checked = "";
  445. }
  446. })
  447.  
  448. //====================================== Balacks's Cove ======================================
  449. function buildBalacksCove() {
  450. if ($(".balacksCove").length > 0) return;
  451. var timerBox = $(".timerBox");
  452. var balacksCove = document.createElement("div");
  453. balacksCove.classList.add("balacksCove");
  454. $(balacksCove).css({
  455. 'border': '1px solid black',
  456. 'width': '25%',
  457. 'height': '75%',
  458. 'padding': 2 + "px"
  459. });
  460. //Header
  461. var balacksCoveHeader = document.createElement("div");
  462. balacksCoveHeader.classList.add("balacksCoveHeader");
  463. var balacksCoveHeaderLabel = document.createElement("div");
  464. balacksCoveHeaderLabel.classList.add("balacksCoveHeaderLabel");
  465. var balacksCoveHeaderLabelText = document.createTextNode("Balack's Cove Tide is:");
  466. balacksCoveHeaderLabel.appendChild(balacksCoveHeaderLabelText);
  467. var balacksCoveHeaderValue = document.createElement("div");
  468. balacksCoveHeaderValue.classList.add("balacksCoveHeaderValue");
  469. var balacksCoveHeaderValueText = document.createTextNode("Low");
  470. balacksCoveHeaderValue.appendChild(balacksCoveHeaderValueText);
  471. $(balacksCoveHeaderLabel).css({
  472. 'float': 'left',
  473. 'font-weight': 700,
  474. "marginRight": "5px"
  475. })
  476. $(balacksCoveHeaderValue).css({
  477. "marginLeft": "100px"
  478. });
  479. balacksCoveHeader.appendChild(balacksCoveHeaderLabel);
  480. balacksCoveHeader.appendChild(balacksCoveHeaderValue);
  481. //Low
  482. var balacksCoveLow = document.createElement("div");
  483. balacksCoveLow.classList.add("balacksCoveLow");
  484. var balacksCoveLowLabel = document.createElement("div");
  485. balacksCoveLowLabel.classList.add("balacksCoveLowLabel");
  486. var balacksCoveLowLabelText = document.createTextNode("Low Tide in:");
  487. balacksCoveLowLabel.appendChild(balacksCoveLowLabelText);
  488. var balacksCoveLowValue = document.createElement("div");
  489. balacksCoveLowValue.classList.add("balacksCoveLowValue");
  490. var balacksCoveLowValueText = document.createTextNode("?");
  491. balacksCoveLowValue.appendChild(balacksCoveLowValueText);
  492. $(balacksCoveLowLabel).css({
  493. 'float': 'left',
  494. 'width': '100px',
  495. 'font-weight': 700,
  496. "marginRight": "5px"
  497. })
  498. balacksCoveLow.appendChild(balacksCoveLowLabel);
  499. balacksCoveLow.appendChild(balacksCoveLowValue);
  500. //Medium
  501. var balacksCoveMid = document.createElement("div");
  502. balacksCoveMid.classList.add("balacksCoveMid");
  503. var balacksCoveMidLabel = document.createElement("div");
  504. balacksCoveMidLabel.classList.add("balacksCoveMidLabel");
  505. var balacksCoveMidLabelText = document.createTextNode("Mid Tide in:");
  506. balacksCoveMidLabel.appendChild(balacksCoveMidLabelText);
  507. var balacksCoveMidValue = document.createElement("div");
  508. balacksCoveMidValue.classList.add("balacksCoveMidValue");
  509. var balacksCoveMidValueText = document.createTextNode("??");
  510. balacksCoveMidValue.appendChild(balacksCoveMidValueText);
  511. $(balacksCoveMidLabel).css({
  512. 'float': 'left',
  513. 'width': '100px',
  514. 'font-weight': 700,
  515. "marginRight": "5px"
  516. })
  517. balacksCoveMid.appendChild(balacksCoveMidLabel);
  518. balacksCoveMid.appendChild(balacksCoveMidValue);
  519. //High
  520. var balacksCoveHigh = document.createElement("div");
  521. balacksCoveHigh.classList.add("balacksCoveHigh");
  522. var balacksCoveHighLabel = document.createElement("div");
  523. balacksCoveHighLabel.classList.add("balacksCoveHighLabel");
  524. var balacksCoveHighLabelText = document.createTextNode("High Tide in:");
  525. balacksCoveHighLabel.appendChild(balacksCoveHighLabelText);
  526. var balacksCoveHighValue = document.createElement("div");
  527. balacksCoveHighValue.classList.add("balacksCoveHighValue");
  528. var balacksCoveHighValueText = document.createTextNode("??");
  529. balacksCoveHighValue.appendChild(balacksCoveHighValueText);
  530. $(balacksCoveHighLabel).css({
  531. 'float': 'left',
  532. 'width': '100px',
  533. 'font-weight': 700,
  534. "marginRight": "5px"
  535. })
  536. balacksCoveHigh.appendChild(balacksCoveHighLabel);
  537. balacksCoveHigh.appendChild(balacksCoveHighValue);
  538. //Append
  539. balacksCove.appendChild(balacksCoveHeader);
  540. balacksCove.appendChild(balacksCoveLow);
  541. balacksCove.appendChild(balacksCoveMid);
  542. balacksCove.appendChild(balacksCoveHigh);
  543. return balacksCove;
  544. }
  545.  
  546. function updateBalacksCoveTimer() {
  547. if ($(".balacksCove").length < 1) return;
  548. var balacksCove = $(".balacksCove");
  549. var firstCoveLow = 1294680060;
  550. var now = todayNow();
  551. let timePassedHours = (now - firstCoveLow) / 3600;
  552. var rotaionLenght = 18.6666666666666666666666666666666666666667;
  553. var rotationsExact = timePassedHours / rotaionLenght;
  554. var rotationsInteger = Math.trunc(rotationsExact);
  555. var partialrotation = (rotationsExact - rotationsInteger) * rotaionLenght;
  556. if (partialrotation < 16) {
  557. //Low
  558. $(".balacksCoveHeaderValue").text("LOW");
  559. $(".balacksCoveHeaderValue").css({
  560. 'color': 'green'
  561. })
  562. var timeMid = (16 - partialrotation).toPrecision(4);
  563. var midHours = Math.trunc(timeMid);
  564. var midMinutes = Math.ceil((timeMid - midHours) * 60);
  565. $(".balacksCoveMidValue").text(midHours + "h " + midMinutes + "m");
  566. $(".balacksCoveMidLabel").text("Mid-Filling in:")
  567. $(".balacksCoveHighValue").text((midHours + 1) + "h " + midMinutes + "m");
  568. $(".balacksCoveLowLabel").text("Low Again in:");
  569. $(".balacksCoveMidValue").css({
  570. 'float': 'right'
  571. })
  572. $(".balacksCoveHighValue").css({
  573. 'float': 'right'
  574. })
  575. $(".balacksCoveLowValue").css({
  576. 'float': 'right'
  577. })
  578. var lowHours = midHours + 2;
  579. var lowMinutes = midMinutes + 40;
  580. if (lowMinutes >= 60) {
  581. lowMinutes = lowMinutes - 60;
  582. lowHours++;
  583. }
  584. $(".balacksCoveLowValue").text((lowHours) + "h " + (lowMinutes) + "m");
  585. balacksCove.append($(".balacksCoveLow"))
  586. if ((midHours == 0) && (midMinutes <= 15) && (localStorage.getItem('RemindCove') == "Y")) {
  587. if (confirm('It will be mid tide soon, travel there now?') == true) {
  588. travelToCove("skip");
  589. }
  590. localStorage.setItem('RemindCove', "N")
  591. $("#balacksCoveCb").prop('checked', false)
  592. }
  593. } else if ((partialrotation >= 16) && (partialrotation < 17)) {
  594. //Mid (flooding)
  595. $(".balacksCoveHeaderValue").text("MID-Flooding");
  596. $(".balacksCoveHeaderValue").css({
  597. 'color': 'orange'
  598. })
  599. var timeHigh = (17 - partialrotation).toPrecision(4);
  600. var highHours = Math.trunc(timeHigh);
  601. var highMinutes = Math.ceil((timeHigh - highHours) * 60);
  602. $(".balacksCoveHighValue").text((highHours) + "h " + highMinutes + "m");
  603. $(".balacksCoveMidLabel").text("Mid-Ebbing in:")
  604. var midHours = highHours;
  605. var midMinutes = highMinutes + 40;
  606. if (midMinutes >= 60) {
  607. midMinutes = midMinutes - 60;
  608. midHours++;
  609. }
  610. $(".balacksCoveMidValue").text(midHours + "h " + midMinutes + "m");
  611. $(".balacksCoveLowLabel").text("Low Tide in:");
  612. $(".balacksCoveLowValue").text((midHours + 1) + "h " + (midMinutes) + "m");
  613. $(".balacksCoveMidValue").css({
  614. 'float': 'right'
  615. })
  616. $(".balacksCoveHighValue").css({
  617. 'float': 'right'
  618. })
  619. $(".balacksCoveLowValue").css({
  620. 'float': 'right'
  621. })
  622. balacksCove.append($(".balacksCoveMid"))
  623. balacksCove.append($(".balacksCoveLow"))
  624. if ((highHours == 0) && (highMinutes <= 15) && (localStorage.getItem('RemindCove') == "Y")) {
  625. if (confirm('It will be high tide soon, travel there now?') == true) {
  626. travelToCove("skip");
  627. }
  628. localStorage.setItem('RemindCove', "N")
  629. $("#balacksCoveCb").prop('checked', false)
  630. }
  631. } else if ((partialrotation >= 17) && (partialrotation < 17.6666666667)) {
  632. //High
  633. $(".balacksCoveHeaderValue").text("HIGH");
  634. $(".balacksCoveHeaderValue").css({
  635. 'color': 'red'
  636. })
  637. var timeMid = (17.6666666667 - partialrotation).toPrecision(4);
  638. var midHours = Math.trunc(timeMid);
  639. var midMinutes = Math.ceil((timeMid - midHours) * 60);
  640. $(".balacksCoveMidValue").text((midHours) + "h " + midMinutes + "m");
  641. $(".balacksCoveMidLabel").text("Mid-Ebbing in:")
  642. $(".balacksCoveLowLabel").text("Low Tide in:")
  643. $(".balacksCoveLowValue").text((midHours + 1) + "h " + midMinutes + "m");
  644. $(".balacksCoveMidValue").css({
  645. 'float': 'right'
  646. })
  647. $(".balacksCoveLowValue").css({
  648. 'float': 'right'
  649. })
  650. $(".balacksCoveHigh").hide();
  651. balacksCove.append($(".balacksCoveLow"))
  652. if ((midHours == 0) && (midMinutes <= 15) && (localStorage.getItem('RemindCove') == "Y")) {
  653. if (confirm('It will be mid tide soon, travel there now?') == true) {
  654. travelToCove("skip");
  655. }
  656. localStorage.setItem('RemindCove', "N")
  657. $("#balacksCoveCb").prop('checked', false)
  658. }
  659. } else if (partialrotation >= 17.6666666667) {
  660. //Mid (ebbing)
  661. $(".balacksCoveHeaderValue").text("MID-Ebbing");
  662. $(".balacksCoveHeaderValue").css({
  663. 'color': 'orange'
  664. })
  665. var timeLow = (rotaionLenght - partialrotation).toPrecision(4);
  666. var lowHours = Math.trunc(timeLow);
  667. var lowMinutes = Math.ceil((timeLow - lowHours) * 60);
  668. $(".balacksCoveLowLabel").text("Low Tide in:")
  669. $(".balacksCoveLowValue").text((lowHours) + "h " + lowMinutes + "m");
  670. $(".balacksCoveMidLabel").text("Mid-Filling in:")
  671. $(".balacksCoveMidValue").text(lowHours + 16 + "h " + lowMinutes + "m");
  672. $(".balacksCoveHighLabel").text("High Tide in:");
  673. $(".balacksCoveHighValue").text(lowHours + 17 + "h " + (lowMinutes) + "m");
  674. $(".balacksCoveMidValue").css({
  675. 'float': 'right'
  676. })
  677. $(".balacksCoveHighValue").css({
  678. 'float': 'right'
  679. })
  680. $(".balacksCoveLowValue").css({
  681. 'float': 'right'
  682. })
  683. balacksCove.append($(".balacksCoveHigh").show())
  684. if ((lowHours == 0) && (lowMinutes <= 15) && (localStorage.getItem('RemindCove') == "Y")) {
  685. if (confirm('It will be low tide soon, travel there now?') == true) {
  686. travelToCove("skip");
  687. }
  688. localStorage.setItem('RemindCove', "N")
  689. $("#balacksCoveCb").prop('checked', false)
  690. }
  691. }
  692. }
  693.  
  694. $(document).on('change', '#balacksCoveCb', function() {
  695. if (this.checked) {
  696. localStorage.setItem('RemindCove', "Y")
  697. this.checked = "Yes";
  698. } else {
  699. localStorage.setItem('RemindCove', "N")
  700. this.checked = "";
  701. }
  702. })
  703. //====================================== Seasonal Garden ======================================
  704. function buildSeasonalGarden() {
  705. if ($(".seasonalGarden").length > 0) return;
  706. var timerBox = $(".timerBox");
  707. var seasonalGarden = document.createElement("div");
  708. seasonalGarden.classList.add("seasonalGarden");
  709. $(seasonalGarden).css({
  710. 'border': '1px solid black',
  711. 'width': '24%',
  712. 'height': '75%',
  713. 'padding': 2 + "px"
  714. });
  715. //Header
  716. var seasonalGardenHeader = document.createElement("div");
  717. seasonalGardenHeader.classList.add("seasonalGardenHeader");
  718. var seasonalGardenHeaderLabel = document.createElement("div");
  719. seasonalGardenHeaderLabel.classList.add("seasonalGardenHeaderLabel");
  720. var seasonalGardenHeaderLabelText = document.createTextNode("Current Garden Season:");
  721. seasonalGardenHeaderLabel.appendChild(seasonalGardenHeaderLabelText);
  722. var seasonalGardenHeaderValue = document.createElement("div");
  723. seasonalGardenHeaderValue.classList.add("seasonalGardenHeaderValue");
  724. var seasonalGardenHeaderValueText = document.createTextNode("FALL");
  725. seasonalGardenHeaderValue.appendChild(seasonalGardenHeaderValueText);
  726. $(seasonalGardenHeaderLabel).css({
  727. 'float': 'left',
  728. 'font-weight': 700,
  729. "marginRight": "5px"
  730. })
  731. $(seasonalGardenHeaderValue).css({
  732. "marginLeft": "100px"
  733. });
  734. seasonalGardenHeader.appendChild(seasonalGardenHeaderLabel);
  735. seasonalGardenHeader.appendChild(seasonalGardenHeaderValue);
  736. //Fall
  737. var seasonalGardenFall = document.createElement("div");
  738. seasonalGardenFall.classList.add("seasonalGardenFall");
  739. var seasonalGardenFallLabel = document.createElement("div");
  740. seasonalGardenFallLabel.classList.add("seasonalGardenFallLabel");
  741. var seasonalGardenFallLabelText = document.createTextNode("Fall in:");
  742. seasonalGardenFallLabel.appendChild(seasonalGardenFallLabelText);
  743. var seasonalGardenFallValue = document.createElement("div");
  744. seasonalGardenFallValue.classList.add("seasonalGardenFallValue");
  745. var seasonalGardenFallValueText = document.createTextNode("?");
  746. seasonalGardenFallValue.appendChild(seasonalGardenFallValueText);
  747. $(seasonalGardenFallLabel).css({
  748. 'float': 'left',
  749. 'width': '100px',
  750. 'font-weight': 700,
  751. "marginRight": "5px"
  752. })
  753. seasonalGardenFall.appendChild(seasonalGardenFallLabel);
  754. seasonalGardenFall.appendChild(seasonalGardenFallValue);
  755. //Winter
  756. var seasonalGardenWinter = document.createElement("div");
  757. seasonalGardenWinter.classList.add("seasonalGardenWinter");
  758. var seasonalGardenWinterLabel = document.createElement("div");
  759. seasonalGardenWinterLabel.classList.add("seasonalGardenWinterLabel");
  760. var seasonalGardenWinterLabelText = document.createTextNode("Winter in:");
  761. seasonalGardenWinterLabel.appendChild(seasonalGardenWinterLabelText);
  762. var seasonalGardenWinterValue = document.createElement("div");
  763. seasonalGardenWinterValue.classList.add("seasonalGardenWinterValue");
  764. var seasonalGardenWinterValueText = document.createTextNode("?");
  765. seasonalGardenWinterValue.appendChild(seasonalGardenWinterValueText);
  766. $(seasonalGardenWinterLabel).css({
  767. 'float': 'left',
  768. 'width': '100px',
  769. 'font-weight': 700,
  770. "marginRight": "5px"
  771. })
  772. seasonalGardenWinter.appendChild(seasonalGardenWinterLabel);
  773. seasonalGardenWinter.appendChild(seasonalGardenWinterValue);
  774. //Spring
  775. var seasonalGardenSpring = document.createElement("div");
  776. seasonalGardenSpring.classList.add("seasonalGardenSpring");
  777. var seasonalGardenSpringLabel = document.createElement("div");
  778. seasonalGardenSpringLabel.classList.add("seasonalGardenSpringLabel");
  779. var seasonalGardenSpringLabelText = document.createTextNode("Spring in:");
  780. seasonalGardenSpringLabel.appendChild(seasonalGardenSpringLabelText);
  781. var seasonalGardenSpringValue = document.createElement("div");
  782. seasonalGardenSpringValue.classList.add("seasonalGardenSpringValue");
  783. var seasonalGardenSpringValueText = document.createTextNode("?");
  784. seasonalGardenSpringValue.appendChild(seasonalGardenSpringValueText);
  785. $(seasonalGardenSpringLabel).css({
  786. 'float': 'left',
  787. 'width': '100px',
  788. 'font-weight': 700,
  789. "marginRight": "5px"
  790. })
  791. seasonalGardenSpring.appendChild(seasonalGardenSpringLabel);
  792. seasonalGardenSpring.appendChild(seasonalGardenSpringValue);
  793. //Summer
  794. var seasonalGardenSummer = document.createElement("div");
  795. seasonalGardenSummer.classList.add("seasonalGardenSummer");
  796. var seasonalGardenSummerLabel = document.createElement("div");
  797. seasonalGardenSummerLabel.classList.add("seasonalGardenSummerLabel");
  798. var seasonalGardenSummerLabelText = document.createTextNode("Summer in:");
  799. seasonalGardenSummerLabel.appendChild(seasonalGardenSummerLabelText);
  800. var seasonalGardenSummerValue = document.createElement("div");
  801. seasonalGardenSummerValue.classList.add("seasonalGardenSummerValue");
  802. var seasonalGardenSummerValueText = document.createTextNode("?");
  803. seasonalGardenSummerValue.appendChild(seasonalGardenSummerValueText);
  804. $(seasonalGardenSummerLabel).css({
  805. 'float': 'left',
  806. 'width': '100px',
  807. 'font-weight': 700,
  808. "marginRight": "5px"
  809. })
  810. seasonalGardenSummer.appendChild(seasonalGardenSummerLabel);
  811. seasonalGardenSummer.appendChild(seasonalGardenSummerValue);
  812. //Append
  813. seasonalGarden.appendChild(seasonalGardenHeader);
  814. seasonalGarden.appendChild(seasonalGardenFall);
  815. seasonalGarden.appendChild(seasonalGardenWinter);
  816. seasonalGarden.appendChild(seasonalGardenSpring);
  817. seasonalGarden.appendChild(seasonalGardenSummer);
  818. return seasonalGarden;
  819. }
  820.  
  821. function updateSeasonalGardenTimer() {
  822. if ($(".seasonalGarden").length < 1) return;
  823. var seasonalGarden = $(".seasonalGarden");
  824. var firstFall = 288000;
  825. var now = todayNow();
  826. let timePassedHours = (now - firstFall) / 3600;
  827. var rotaionLenght = 320;
  828. var rotationsExact = timePassedHours / rotaionLenght;
  829. var rotationsInteger = Math.trunc(rotationsExact);
  830. var partialrotation = (rotationsExact - rotationsInteger) * rotaionLenght;
  831. var fallObj = new season(0, 0, 0);
  832. var winterObj = new season(0, 0, 0);
  833. var springObj = new season(0, 0, 0);
  834. var summerObj = new season(0, 0, 0);
  835. if (partialrotation < 80) {
  836. //Summer
  837. $(".seasonalGardenHeaderValue").text("SUMMER");
  838. $(".seasonalGardenHeaderValue").css({
  839. 'color': 'red'
  840. })
  841. var timeFall = (80 - partialrotation).toPrecision(4);
  842. fallObj.hours = Math.floor(timeFall);
  843. fallObj.minutes = Math.ceil((timeFall - fallObj.hours) * 60);
  844. fallObj = convertToDyHrMn(0, fallObj.hours, fallObj.minutes);
  845. winterObj = convertToDyHrMn(fallObj.days + 3, fallObj.hours + 8, fallObj.minutes);
  846. springObj = convertToDyHrMn(winterObj.days + 3, winterObj.hours + 8, winterObj.minutes)
  847. summerObj = convertToDyHrMn(springObj.days + 3, springObj.hours + 8, springObj.minutes);
  848. $(".seasonalGardenFallLabel").text("Next Summer in:")
  849. $(".seasonalGardenWinterLabel").text("Winter in:")
  850. $(".seasonalGardenSpringLabel").text("Spring in:")
  851. $(".seasonalGardenSummerLabel").text("Summer in:")
  852. seasonalGarden.append($(".seasonalGardenFall"));
  853. seasonalGarden.append($(".seasonalGardenWinter"));
  854. seasonalGarden.append($(".seasonalGardenSpring"));
  855. seasonalGarden.append($(".seasonalGardenSummer"));
  856. if ((fallObj.hours == 0) && (fallObj.minutes <= 15) && (localStorage.getItem('RemindGarden') == "Y")) {
  857. if (confirm('It will be fall in the garden soon, travel there now?') == true) {
  858. travelToGarden("skip");
  859. }
  860. localStorage.setItem('RemindGarden', "N")
  861. $("#seasonalGardenCb").prop('checked', false)
  862. }
  863. } else if ((partialrotation >= 80) && (partialrotation < 160)) {
  864. //Fall
  865. $(".seasonalGardenHeaderValue").text("FALL");
  866. $(".seasonalGardenHeaderValue").css({
  867. 'color': 'orange'
  868. })
  869. var timeWinter = (160 - partialrotation).toPrecision(4);
  870. winterObj.hours = Math.floor(timeWinter);
  871. winterObj.minutes = Math.ceil((timeWinter - winterObj.hours) * 60);
  872. winterObj = convertToDyHrMn(0, winterObj.hours, winterObj.minutes);
  873. springObj = convertToDyHrMn(winterObj.days + 3, winterObj.hours + 8, winterObj.minutes)
  874. summerObj = convertToDyHrMn(springObj.days + 3, springObj.hours + 8, springObj.minutes)
  875. fallObj = convertToDyHrMn(summerObj.days + 3, summerObj.hours + 8, summerObj.minutes);
  876. $(".seasonalGardenFallLabel").text("Next Fall in:")
  877. $(".seasonalGardenWinterLabel").text("Winter in:")
  878. $(".seasonalGardenSpringLabel").text("Spring in:")
  879. $(".seasonalGardenSummerLabel").text("Summer in:")
  880. seasonalGarden.append($(".seasonalGardenWinter"));
  881. seasonalGarden.append($(".seasonalGardenSpring"));
  882. seasonalGarden.append($(".seasonalGardenSummer"));
  883. seasonalGarden.append($(".seasonalGardenFall"));
  884. if ((winterObj.hours == 0) && (winterObj.minutes <= 15) && (localStorage.getItem('RemindGarden') == "Y")) {
  885. if (confirm('It will be winter in the garden soon, travel there now?') == true) {
  886. travelToGarden("skip");
  887. }
  888. localStorage.setItem('RemindGarden', "N")
  889. $("#seasonalGardenCb").prop('checked', false)
  890. }
  891. } else if ((partialrotation >= 160) && (partialrotation < 240)) {
  892. //Winter
  893. $(".seasonalGardenHeaderValue").text("WINTER");
  894. $(".seasonalGardenHeaderValue").css({
  895. 'color': 'blue'
  896. })
  897. var timeSpring = (240 - partialrotation).toPrecision(4);
  898. springObj.hours = Math.floor(timeSpring);
  899. springObj.minutes = Math.ceil((timeSpring - springObj.hours) * 60);
  900. springObj = convertToDyHrMn(0, springObj.hours, springObj.minutes)
  901. summerObj = convertToDyHrMn(springObj.days + 3, springObj.hours + 8, springObj.minutes);
  902. fallObj = convertToDyHrMn(summerObj.days + 3, summerObj.hours + 8, summerObj.minutes);
  903. winterObj = convertToDyHrMn(fallObj.days + 3, fallObj.hours + 8, fallObj.minutes);
  904. $(".seasonalGardenFallLabel").text("Fall in:")
  905. $(".seasonalGardenWinterLabel").text("Next Winter in:")
  906. $(".seasonalGardenSpringLabel").text("Spring in:")
  907. $(".seasonalGardenSummerLabel").text("Summer in:")
  908. seasonalGarden.append($(".seasonalGardenSpring"));
  909. seasonalGarden.append($(".seasonalGardenSummer"));
  910. seasonalGarden.append($(".seasonalGardenFall"));
  911. seasonalGarden.append($(".seasonalGardenWinter"));
  912. if ((springObj.hours == 0) && (springObj.minutes <= 15) && (localStorage.getItem('RemindGarden') == "Y")) {
  913. if (confirm('It will be spring in the garden soon, travel there now?') == true) {
  914. travelToGarden("skip");
  915. }
  916. localStorage.setItem('RemindGarden', "N")
  917. $("#seasonalGardenCb").prop('checked', false)
  918. }
  919. } else {
  920. //Spring
  921. $(".seasonalGardenHeaderValue").text("SPRING");
  922. $(".seasonalGardenHeaderValue").css({
  923. 'color': 'green'
  924. })
  925. var timeSummer = (320 - partialrotation).toPrecision(4);
  926. summerObj.hours = Math.floor(timeSummer);
  927. summerObj.minutes = Math.ceil((timeSummer - summerObj.hours) * 60);
  928. summerObj = convertToDyHrMn(0, summerObj.hours, summerObj.minutes)
  929. fallObj = convertToDyHrMn(summerObj.days + 3, summerObj.hours + 8, summerObj.minutes);
  930. winterObj = convertToDyHrMn(fallObj.days + 3, fallObj.hours + 8, fallObj.minutes);
  931. springObj = convertToDyHrMn(winterObj.days + 3, winterObj.hours + 8, winterObj.minutes);
  932. $(".seasonalGardenFallLabel").text("Fall in:")
  933. $(".seasonalGardenWinterLabel").text("Winter in:")
  934. $(".seasonalGardenSpringLabel").text("Next Spring in:")
  935. $(".seasonalGardenSummerLabel").text("Summer in:")
  936. seasonalGarden.append($(".seasonalGardenSummer"));
  937. seasonalGarden.append($(".seasonalGardenFall"));
  938. seasonalGarden.append($(".seasonalGardenWinter"));
  939. seasonalGarden.append($(".seasonalGardenSpring"));
  940. if ((summerObj.hours == 0) && (summerObj.minutes <= 15) && (localStorage.getItem('RemindGarden') == "Y")) {
  941. if (confirm('It will be summer in the garden soon, travel there now?') == true) {
  942. travelToGarden("skip");
  943. }
  944. localStorage.setItem('RemindGarden', "N")
  945. $("#seasonalGardenCb").prop('checked', false)
  946. }
  947. }
  948. $(".seasonalGardenFallValue").text(fallObj.days + "d " + fallObj.hours + "h " + fallObj.minutes + "m");
  949. $(".seasonalGardenWinterValue").text(winterObj.days + "d " + winterObj.hours + "h " + winterObj.minutes + "m");
  950. $(".seasonalGardenSpringValue").text(springObj.days + "d " + springObj.hours + "h " + springObj.minutes + "m");
  951. $(".seasonalGardenSummerValue").text(summerObj.days + "d " + summerObj.hours + "h " + summerObj.minutes + "m");
  952. $(".seasonalGardenFallValue").css({
  953. 'float': 'right'
  954. })
  955. $(".seasonalGardenWinterValue").css({
  956. 'float': 'right'
  957. })
  958. $(".seasonalGardenSpringValue").css({
  959. 'float': 'right'
  960. })
  961. $(".seasonalGardenSummerValue").css({
  962. 'float': 'right'
  963. })
  964. }
  965.  
  966. function season(days, hours, minutes) {
  967. this.days = days;
  968. this.hours = hours;
  969. this.minutes = minutes;
  970. }
  971. $(document).on('change', '#seasonalGardenCb', function() {
  972. if (this.checked) {
  973. localStorage.setItem('RemindGarden', "Y")
  974. this.checked = "Yes";
  975. } else {
  976. localStorage.setItem('RemindGarden', "N")
  977. this.checked = "";
  978. }
  979. })
  980. //====================================== Toxic Spill ======================================
  981. function buildToxicSpill() {
  982. if ($(".toxicSpill").length > 0) return;
  983. var timerBox = $(".timerBox");
  984. var toxicSpill = document.createElement("div");
  985. toxicSpill.classList.add("toxicSpill");
  986. $(toxicSpill).css({
  987. 'border': '1px solid black',
  988. 'width': '26%',
  989. 'height': '75%',
  990. 'padding': 2 + "px"
  991. });
  992. //Header
  993. var toxicSpillHeader = document.createElement("div");
  994. toxicSpillHeader.classList.add("toxicSpillHeader");
  995. var toxicSpillHeaderLabel = document.createElement("div");
  996. toxicSpillHeaderLabel.classList.add("toxicSpillHeaderLabel");
  997. var toxicSpillHeaderLabelText = document.createTextNode("Current Spill Level:");
  998. toxicSpillHeaderLabel.appendChild(toxicSpillHeaderLabelText);
  999. var toxicSpillHeaderValue = document.createElement("div");
  1000. toxicSpillHeaderValue.classList.add("toxicSpillHeaderValue");
  1001. var toxicSpillHeaderValueText = document.createTextNode("Archduke");
  1002. toxicSpillHeaderValue.appendChild(toxicSpillHeaderValueText);
  1003. $(toxicSpillHeaderLabel).css({
  1004. 'float': 'left',
  1005. 'font-weight': 700,
  1006. "marginRight": "5px"
  1007. })
  1008. $(toxicSpillHeaderValue).css({
  1009. "marginLeft": "100px"
  1010. });
  1011. toxicSpillHeader.appendChild(toxicSpillHeaderLabel);
  1012. toxicSpillHeader.appendChild(toxicSpillHeaderValue);
  1013. //Hero
  1014. var toxicSpillHero = document.createElement("div");
  1015. toxicSpillHero.classList.add("toxicSpillHero");
  1016. var toxicSpillHeroLabel = document.createElement("div");
  1017. toxicSpillHeroLabel.classList.add("toxicSpillHeroLabel");
  1018. var toxicSpillHeroLabelText = document.createTextNode("Hero in:");
  1019. toxicSpillHeroLabel.appendChild(toxicSpillHeroLabelText);
  1020. var toxicSpillHeroValue = document.createElement("div");
  1021. toxicSpillHeroValue.classList.add("toxicSpillHeroValue");
  1022. var toxicSpillHeroValueText = document.createTextNode("?");
  1023. toxicSpillHeroValue.appendChild(toxicSpillHeroValueText);
  1024. $(toxicSpillHeroLabel).css({
  1025. 'float': 'left',
  1026. 'width': '100px',
  1027. 'font-weight': 700,
  1028. "marginRight": "5px"
  1029. })
  1030. toxicSpillHero.appendChild(toxicSpillHeroLabel);
  1031. toxicSpillHero.appendChild(toxicSpillHeroValue);
  1032. //Knight
  1033. var toxicSpillKnight = document.createElement("div");
  1034. toxicSpillKnight.classList.add("toxicSpillKnight");
  1035. var toxicSpillKnightLabel = document.createElement("div");
  1036. toxicSpillKnightLabel.classList.add("toxicSpillKnightLabel");
  1037. var toxicSpillKnightLabelText = document.createTextNode("Knight in:");
  1038. toxicSpillKnightLabel.appendChild(toxicSpillKnightLabelText);
  1039. var toxicSpillKnightValue = document.createElement("div");
  1040. toxicSpillKnightValue.classList.add("toxicSpillKnightValue");
  1041. var toxicSpillKnightValueText = document.createTextNode("?");
  1042. toxicSpillKnightValue.appendChild(toxicSpillKnightValueText);
  1043. $(toxicSpillKnightLabel).css({
  1044. 'float': 'left',
  1045. 'width': '100px',
  1046. 'font-weight': 700,
  1047. "marginRight": "5px"
  1048. })
  1049. toxicSpillKnight.appendChild(toxicSpillKnightLabel);
  1050. toxicSpillKnight.appendChild(toxicSpillKnightValue);
  1051. //Lord
  1052. var toxicSpillLord = document.createElement("div");
  1053. toxicSpillLord.classList.add("toxicSpillLord");
  1054. var toxicSpillLordLabel = document.createElement("div");
  1055. toxicSpillLordLabel.classList.add("toxicSpillLordLabel");
  1056. var toxicSpillLordLabelText = document.createTextNode("Lord in:");
  1057. toxicSpillLordLabel.appendChild(toxicSpillLordLabelText);
  1058. var toxicSpillLordValue = document.createElement("div");
  1059. toxicSpillLordValue.classList.add("toxicSpillLordValue");
  1060. var toxicSpillLordValueText = document.createTextNode("?");
  1061. toxicSpillLordValue.appendChild(toxicSpillLordValueText);
  1062. $(toxicSpillLordLabel).css({
  1063. 'float': 'left',
  1064. 'width': '100px',
  1065. 'font-weight': 700,
  1066. "marginRight": "5px"
  1067. })
  1068. toxicSpillLord.appendChild(toxicSpillLordLabel);
  1069. toxicSpillLord.appendChild(toxicSpillLordValue);
  1070. //Baron
  1071. var toxicSpillBaron = document.createElement("div");
  1072. toxicSpillBaron.classList.add("toxicSpillBaron");
  1073. var toxicSpillBaronLabel = document.createElement("div");
  1074. toxicSpillBaronLabel.classList.add("toxicSpillBaronLabel");
  1075. var toxicSpillBaronLabelText = document.createTextNode("Baron in:");
  1076. toxicSpillBaronLabel.appendChild(toxicSpillBaronLabelText);
  1077. var toxicSpillBaronValue = document.createElement("div");
  1078. toxicSpillBaronValue.classList.add("toxicSpillBaronValue");
  1079. var toxicSpillBaronValueText = document.createTextNode("?");
  1080. toxicSpillBaronValue.appendChild(toxicSpillBaronValueText);
  1081. $(toxicSpillBaronLabel).css({
  1082. 'float': 'left',
  1083. 'width': '100px',
  1084. 'font-weight': 700,
  1085. "marginRight": "5px"
  1086. })
  1087. toxicSpillBaron.appendChild(toxicSpillBaronLabel);
  1088. toxicSpillBaron.appendChild(toxicSpillBaronValue);
  1089. //Count
  1090. var toxicSpillCount = document.createElement("div");
  1091. toxicSpillCount.classList.add("toxicSpillCount");
  1092. var toxicSpillCountLabel = document.createElement("div");
  1093. toxicSpillCountLabel.classList.add("toxicSpillCountLabel");
  1094. var toxicSpillCountLabelText = document.createTextNode("Count in:");
  1095. toxicSpillCountLabel.appendChild(toxicSpillCountLabelText);
  1096. var toxicSpillCountValue = document.createElement("div");
  1097. toxicSpillCountValue.classList.add("toxicSpillCountValue");
  1098. var toxicSpillCountValueText = document.createTextNode("?");
  1099. toxicSpillCountValue.appendChild(toxicSpillCountValueText);
  1100. $(toxicSpillCountLabel).css({
  1101. 'float': 'left',
  1102. 'width': '100px',
  1103. 'font-weight': 700,
  1104. "marginRight": "5px"
  1105. })
  1106. toxicSpillCount.appendChild(toxicSpillCountLabel);
  1107. toxicSpillCount.appendChild(toxicSpillCountValue);
  1108. //Duke
  1109. var toxicSpillDuke = document.createElement("div");
  1110. toxicSpillDuke.classList.add("toxicSpillDuke");
  1111. var toxicSpillDukeLabel = document.createElement("div");
  1112. toxicSpillDukeLabel.classList.add("toxicSpillDukeLabel");
  1113. var toxicSpillDukeLabelText = document.createTextNode("Duke in:");
  1114. toxicSpillDukeLabel.appendChild(toxicSpillDukeLabelText);
  1115. var toxicSpillDukeValue = document.createElement("div");
  1116. toxicSpillDukeValue.classList.add("toxicSpillDukeValue");
  1117. var toxicSpillDukeValueText = document.createTextNode("?");
  1118. toxicSpillDukeValue.appendChild(toxicSpillDukeValueText);
  1119. $(toxicSpillDukeLabel).css({
  1120. 'float': 'left',
  1121. 'width': '100px',
  1122. 'font-weight': 700,
  1123. "marginRight": "5px"
  1124. })
  1125. toxicSpillDuke.appendChild(toxicSpillDukeLabel);
  1126. toxicSpillDuke.appendChild(toxicSpillDukeValue);
  1127. //Grand Duke
  1128. var toxicSpillGrandDuke = document.createElement("div");
  1129. toxicSpillGrandDuke.classList.add("toxicSpillGrandDuke");
  1130. var toxicSpillGrandDukeLabel = document.createElement("div");
  1131. toxicSpillGrandDukeLabel.classList.add("toxicSpillGrandDukeLabel");
  1132. var toxicSpillGrandDukeLabelText = document.createTextNode("Grand Duke in:");
  1133. toxicSpillGrandDukeLabel.appendChild(toxicSpillGrandDukeLabelText);
  1134. var toxicSpillGrandDukeValue = document.createElement("div");
  1135. toxicSpillGrandDukeValue.classList.add("toxicSpillGrandDukeValue");
  1136. var toxicSpillGrandDukeValueText = document.createTextNode("?");
  1137. toxicSpillGrandDukeValue.appendChild(toxicSpillGrandDukeValueText);
  1138. $(toxicSpillGrandDukeLabel).css({
  1139. 'float': 'left',
  1140. 'width': '100px',
  1141. 'font-weight': 700,
  1142. "marginRight": "5px"
  1143. })
  1144. toxicSpillGrandDuke.appendChild(toxicSpillGrandDukeLabel);
  1145. toxicSpillGrandDuke.appendChild(toxicSpillGrandDukeValue);
  1146. //Archduke
  1147. var toxicSpillArchduke = document.createElement("div");
  1148. toxicSpillArchduke.classList.add("toxicSpillArchduke");
  1149. var toxicSpillArchdukeLabel = document.createElement("div");
  1150. toxicSpillArchdukeLabel.classList.add("toxicSpillArchdukeLabel");
  1151. var toxicSpillArchdukeLabelText = document.createTextNode("Archduke in:");
  1152. toxicSpillArchdukeLabel.appendChild(toxicSpillArchdukeLabelText);
  1153. var toxicSpillArchdukeValue = document.createElement("div");
  1154. toxicSpillArchdukeValue.classList.add("toxicSpillArchdukeValue");
  1155. var toxicSpillArchdukeValueText = document.createTextNode("?");
  1156. toxicSpillArchdukeValue.appendChild(toxicSpillArchdukeValueText);
  1157. $(toxicSpillArchdukeLabel).css({
  1158. 'float': 'left',
  1159. 'width': '100px',
  1160. 'font-weight': 700,
  1161. "marginRight": "5px"
  1162. })
  1163. toxicSpillArchduke.appendChild(toxicSpillArchdukeLabel);
  1164. toxicSpillArchduke.appendChild(toxicSpillArchdukeValue);
  1165. //Append
  1166. toxicSpill.appendChild(toxicSpillHeader);
  1167. toxicSpill.appendChild(toxicSpillHero);
  1168. toxicSpill.appendChild(toxicSpillKnight);
  1169. toxicSpill.appendChild(toxicSpillLord);
  1170. toxicSpill.appendChild(toxicSpillBaron);
  1171. toxicSpill.appendChild(toxicSpillCount);
  1172. toxicSpill.appendChild(toxicSpillDuke);
  1173. toxicSpill.appendChild(toxicSpillGrandDuke);
  1174. toxicSpill.appendChild(toxicSpillArchduke);
  1175. return toxicSpill;
  1176. }
  1177.  
  1178. function updateToxicSpillTimer() {
  1179. if ($(".toxicSpill").length < 1) return;
  1180. var toxicSpill = $(".toxicSpill");
  1181. $(".toxicSpill").children().show();
  1182. var firstHero = 1503597600;
  1183. var now = todayNow();
  1184. let timePassedHours = (now - firstHero) / 3600;
  1185. var rotaionLenght = 302;
  1186. var rotationsExact = timePassedHours / rotaionLenght;
  1187. var rotationsInteger = Math.floor(rotationsExact);
  1188. var partialrotation = (rotationsExact - rotationsInteger) * rotaionLenght;
  1189. var heroObj = new season(0, 0, 0);
  1190. var knightObj = new season(0, 0, 0);
  1191. var lordObj = new season(0, 0, 0);
  1192. var baronObj = new season(0, 0, 0);
  1193. var countObj = new season(0, 0, 0);
  1194. var dukeObj = new season(0, 0, 0);
  1195. var granddukeObj = new season(0, 0, 0);
  1196. var archdukeObj = new season(0, 0, 0);
  1197. if (partialrotation < 15) {
  1198. //Hero Rising
  1199. $(".toxicSpillHeaderValue").text("HERO-RISING");
  1200. $(".toxicSpillHeaderValue").css({
  1201. 'color': 'red'
  1202. });
  1203. var timeKnight = (15 - partialrotation).toPrecision(4);
  1204. knightObj.hours = Math.floor(timeKnight);
  1205. knightObj.minutes = Math.ceil((timeKnight - knightObj.hours) * 60);
  1206. knightObj = convertToDyHrMn(0, knightObj.hours, knightObj.minutes);
  1207. lordObj = convertToDyHrMn(knightObj.days, knightObj.hours + 16, knightObj.minutes);
  1208. baronObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  1209. countObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1210. dukeObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1211. $(".toxicSpillKnightLabel").text("Knight in:");
  1212. $(".toxicSpillLordLabel").text("Lord in:");
  1213. $(".toxicSpillBaronLabel").text("Baron in:");
  1214. $(".toxicSpillCountLabel").text("Count in:");
  1215. $(".toxicSpillDukeLabel").text("Duke in:");
  1216. toxicSpill.append($(".toxicSpillKnight"));
  1217. toxicSpill.append($(".toxicSpillLord"));
  1218. toxicSpill.append($(".toxicSpillBaron"));
  1219. toxicSpill.append($(".toxicSpillCount"));
  1220. toxicSpill.append($(".toxicSpillDuke"));
  1221. $(".toxicSpillHero").hide();
  1222. $(".toxicSpillGrandDuke").hide();
  1223. $(".toxicSpillArchduke").hide();
  1224. if ((knightObj.hours == 0) && (knightObj.minutes <= 15) && (localStorage.getItem('RemindSpill') == "Y")) {
  1225. if (confirm('It will be Knight level soon at the toxic spill, travel there now?') == true) {
  1226. travelToSpill("skip");
  1227. }
  1228. localStorage.setItem('RemindSpill', "N")
  1229. $("#toxicSpillCb").prop('checked', false)
  1230. }
  1231. } else if (partialrotation >= 15 && partialrotation < 31) {
  1232. //Knight Rising
  1233. $(".toxicSpillHeaderValue").text("KNIGHT-RISING");
  1234. $(".toxicSpillHeaderValue").css({
  1235. 'color': 'red'
  1236. });
  1237. var timeLord = (31 - partialrotation).toPrecision(4);
  1238. lordObj.hours = Math.floor(timeLord);
  1239. lordObj.minutes = Math.ceil((timeLord - lordObj.hours) * 60);
  1240. lordObj = convertToDyHrMn(0, lordObj.hours, lordObj.minutes);
  1241. baronObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  1242. countObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1243. dukeObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1244. granddukeObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours, dukeObj.minutes);
  1245. $(".toxicSpillLordLabel").text("Lord in:");
  1246. $(".toxicSpillBaronLabel").text("Baron in:");
  1247. $(".toxicSpillCountLabel").text("Count in:");
  1248. $(".toxicSpillDukeLabel").text("Duke in:");
  1249. $(".toxicSpillGrandDukeLabel").text("Grand Duke in:");
  1250. toxicSpill.append($(".toxicSpillLord"));
  1251. toxicSpill.append($(".toxicSpillBaron"));
  1252. toxicSpill.append($(".toxicSpillCount"));
  1253. toxicSpill.append($(".toxicSpillDuke"));
  1254. toxicSpill.append($(".toxicSpillGrandDuke"));
  1255. $(".toxicSpillHero").hide();
  1256. $(".toxicSpillKnight").hide();
  1257. $(".toxicSpillArchduke").hide();
  1258. if ((lordObj.hours == 0) && (lordObj.minutes <= 15) && (localStorage.getItem('RemindSpill') == "Y")) {
  1259. if (confirm('It will be Lord level soon at the toxic spill, travel there now?') == true) {
  1260. travelToSpill("skip");
  1261. }
  1262. localStorage.setItem('RemindSpill', "N")
  1263. $("#toxicSpillCb").prop('checked', false)
  1264. }
  1265. } else if (partialrotation >= 31 && partialrotation < 49) {
  1266. //Lord Rising
  1267. $(".toxicSpillHeaderValue").text("LORD-RISING");
  1268. $(".toxicSpillHeaderValue").css({
  1269. 'color': 'red'
  1270. });
  1271. var timeBaron = (49 - partialrotation).toPrecision(4);
  1272. baronObj.hours = Math.floor(timeBaron);
  1273. baronObj.minutes = Math.ceil((timeBaron - baronObj.hours) * 60);
  1274. baronObj = convertToDyHrMn(0, baronObj.hours, baronObj.minutes);
  1275. countObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1276. dukeObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1277. granddukeObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours, dukeObj.minutes);
  1278. archdukeObj = convertToDyHrMn(granddukeObj.days + 1, granddukeObj.hours, granddukeObj.minutes);
  1279. $(".toxicSpillBaronLabel").text("Baron in:");
  1280. $(".toxicSpillCountLabel").text("Count in:");
  1281. $(".toxicSpillDukeLabel").text("Duke in:");
  1282. $(".toxicSpillGrandDukeLabel").text("Grand Duke in:");
  1283. $(".toxicSpillArchdukeLabel").text("Archduke in:");
  1284. toxicSpill.append($(".toxicSpillBaron"));
  1285. toxicSpill.append($(".toxicSpillCount"));
  1286. toxicSpill.append($(".toxicSpillDuke"));
  1287. toxicSpill.append($(".toxicSpillGrandDuke"));
  1288. toxicSpill.append($(".toxicSpillArchduke"));
  1289. $(".toxicSpillHero").hide();
  1290. $(".toxicSpillKnight").hide();
  1291. $(".toxicSpillLord").hide();
  1292. if ((baronObj.hours == 0) && (baronObj.minutes <= 15) && (localStorage.getItem('RemindSpill') == "Y")) {
  1293. if (confirm('It will be Baron level soon at the toxic spill, travel there now?') == true) {
  1294. travelToSpill("skip");
  1295. }
  1296. localStorage.setItem('RemindSpill', "N")
  1297. $("#toxicSpillCb").prop('checked', false)
  1298. }
  1299. } else if (partialrotation >= 49 && partialrotation < 67) {
  1300. //Baron Rising
  1301. $(".toxicSpillHeaderValue").text("BARON-RISING");
  1302. $(".toxicSpillHeaderValue").css({
  1303. 'color': 'red'
  1304. });
  1305. var timeCount = (67 - partialrotation).toPrecision(4);
  1306. countObj.hours = Math.floor(timeCount);
  1307. countObj.minutes = Math.ceil((timeCount - countObj.hours) * 60);
  1308. countObj = convertToDyHrMn(0, countObj.hours, countObj.minutes);
  1309. dukeObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1310. granddukeObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours, dukeObj.minutes);
  1311. archdukeObj = convertToDyHrMn(granddukeObj.days + 1, granddukeObj.hours, granddukeObj.minutes);
  1312. countObj = convertToDyHrMn(archdukeObj.days + 3, archdukeObj.hours, archdukeObj.minutes);
  1313. baronObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1314. $(".toxicSpillGrandDukeLabel").text("Grand Duke in:");
  1315. $(".toxicSpillArchdukeLabel").text("Archduke in:");
  1316. $(".toxicSpillDukeLabel").text("Duke in:");
  1317. $(".toxicSpillCountLabel").text("Count in:");
  1318. $(".toxicSpillBaronLabel").text("Baron Falling in:");
  1319. toxicSpill.append($(".toxicSpillCount"));
  1320. toxicSpill.append($(".toxicSpillDuke"));
  1321. toxicSpill.append($(".toxicSpillGrandDuke"));
  1322. toxicSpill.append($(".toxicSpillArchduke"));
  1323. toxicSpill.append($(".toxicSpillBaron"));
  1324. $(".toxicSpillHero").hide();
  1325. $(".toxicSpillKnight").hide();
  1326. $(".toxicSpillLord").hide();
  1327. if ((countObj.hours == 0) && (countObj.minutes <= 15) && (localStorage.getItem('RemindSpill') == "Y")) {
  1328. if (confirm('It will be Count level soon at the toxic spill, travel there now?') == true) {
  1329. travelToSpill("skip");
  1330. }
  1331. localStorage.setItem('RemindSpill', "N")
  1332. $("#toxicSpillCb").prop('checked', false)
  1333. }
  1334. } else if (partialrotation >= 67 && partialrotation < 91) {
  1335. //Count Rising
  1336. $(".toxicSpillHeaderValue").text("COUNT-RISING");
  1337. $(".toxicSpillHeaderValue").css({
  1338. 'color': 'red'
  1339. });
  1340. var timeDuke = (91 - partialrotation).toPrecision(4);
  1341. dukeObj.hours = Math.floor(timeDuke);
  1342. dukeObj.minutes = Math.ceil((timeDuke - dukeObj.hours) * 60);
  1343. dukeObj = convertToDyHrMn(0, dukeObj.hours, dukeObj.minutes);
  1344. granddukeObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours, dukeObj.minutes);
  1345. archdukeObj = convertToDyHrMn(granddukeObj.days + 1, granddukeObj.hours, granddukeObj.minutes);
  1346. countObj = convertToDyHrMn(archdukeObj.days + 3, archdukeObj.hours, archdukeObj.minutes);
  1347. baronObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1348. $(".toxicSpillGrandDukeLabel").text("Grand Duke in:");
  1349. $(".toxicSpillArchdukeLabel").text("Archduke in:");
  1350. $(".toxicSpillDukeLabel").text("Duke in:");
  1351. $(".toxicSpillCountLabel").text("Count Falling in:");
  1352. $(".toxicSpillBaronLabel").text("Baron in:");
  1353. toxicSpill.append($(".toxicSpillDuke"));
  1354. toxicSpill.append($(".toxicSpillGrandDuke"));
  1355. toxicSpill.append($(".toxicSpillArchduke"));
  1356. toxicSpill.append($(".toxicSpillCount"));
  1357. toxicSpill.append($(".toxicSpillBaron"));
  1358. $(".toxicSpillHero").hide();
  1359. $(".toxicSpillKnight").hide();
  1360. $(".toxicSpillLord").hide();
  1361. if ((dukeObj.hours == 0) && (dukeObj.minutes <= 15) && (localStorage.getItem('RemindSpill') == "Y")) {
  1362. if (confirm('It will be Duke level soon at the toxic spill, travel there now?') == true) {
  1363. travelToSpill("skip");
  1364. }
  1365. localStorage.setItem('RemindSpill', "N")
  1366. $("#toxicSpillCb").prop('checked', false)
  1367. }
  1368. } else if (partialrotation >= 91 && partialrotation < 115) {
  1369. //Duke Rising
  1370. $(".toxicSpillHeaderValue").text("DUKE-RISING");
  1371. $(".toxicSpillHeaderValue").css({
  1372. 'color': 'red'
  1373. });
  1374. var timeGrandDuke = (115 - partialrotation).toPrecision(4);
  1375. granddukeObj.hours = Math.floor(timeGrandDuke);
  1376. granddukeObj.minutes = Math.ceil((timeGrandDuke - granddukeObj.hours) * 60);
  1377. granddukeObj = convertToDyHrMn(0, granddukeObj.hours, granddukeObj.minutes);
  1378. archdukeObj = convertToDyHrMn(granddukeObj.days + 1, granddukeObj.hours, granddukeObj.minutes);
  1379. dukeObj = convertToDyHrMn(archdukeObj.days + 2, archdukeObj.hours, archdukeObj.minutes);
  1380. countObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours + 10, dukeObj.minutes);
  1381. baronObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1382. $(".toxicSpillGrandDukeLabel").text("Grand Duke in:");
  1383. $(".toxicSpillArchdukeLabel").text("Archduke in:");
  1384. $(".toxicSpillDukeLabel").text("Duke Falling in:");
  1385. $(".toxicSpillCountLabel").text("Count in:");
  1386. $(".toxicSpillBaronLabel").text("Baron in:");
  1387. toxicSpill.append($(".toxicSpillGrandDuke"));
  1388. toxicSpill.append($(".toxicSpillArchduke"));
  1389. toxicSpill.append($(".toxicSpillDuke"));
  1390. toxicSpill.append($(".toxicSpillCount"));
  1391. toxicSpill.append($(".toxicSpillBaron"));
  1392. $(".toxicSpillHero").hide();
  1393. $(".toxicSpillKnight").hide();
  1394. $(".toxicSpillLord").hide();
  1395. if ((granddukeObj.hours == 0) && (granddukeObj.minutes <= 15) && (localStorage.getItem('RemindSpill') == "Y")) {
  1396. if (confirm('It will be Grand Duke level soon at the toxic spill, travel there now?') == true) {
  1397. travelToSpill("skip");
  1398. }
  1399. localStorage.setItem('RemindSpill', "N")
  1400. $("#toxicSpillCb").prop('checked', false)
  1401. }
  1402. } else if (partialrotation >= 115 && partialrotation < 139) {
  1403. //Grand Duke Rising
  1404. $(".toxicSpillHeaderValue").text("GD-RISING");
  1405. $(".toxicSpillHeaderValue").css({
  1406. 'color': 'red'
  1407. });
  1408. var timeArchduke = (139 - partialrotation).toPrecision(4);
  1409. archdukeObj.hours = Math.floor(timeArchduke);
  1410. archdukeObj.minutes = Math.ceil((timeArchduke - archdukeObj.hours) * 60);
  1411. archdukeObj = convertToDyHrMn(0, archdukeObj.hours, archdukeObj.minutes);
  1412. granddukeObj = convertToDyHrMn(archdukeObj.days, archdukeObj.hours + 24, archdukeObj.minutes);
  1413. dukeObj = convertToDyHrMn(0, granddukeObj.hours + 24, granddukeObj.minutes);
  1414. countObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours + 10, dukeObj.minutes);
  1415. baronObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1416. $(".toxicSpillArchdukeLabel").text("Archduke in:");
  1417. $(".toxicSpillGrandDukeLabel").text("GD Falling in:");
  1418. $(".toxicSpillDukeLabel").text("Duke in:");
  1419. $(".toxicSpillCountLabel").text("Count in:");
  1420. $(".toxicSpillBaronLabel").text("Baron in:");
  1421. toxicSpill.append($(".toxicSpillArchduke"));
  1422. toxicSpill.append($(".toxicSpillGrandDuke"));
  1423. toxicSpill.append($(".toxicSpillDuke"));
  1424. toxicSpill.append($(".toxicSpillCount"));
  1425. toxicSpill.append($(".toxicSpillBaron"));
  1426. $(".toxicSpillHero").hide();
  1427. $(".toxicSpillKnight").hide();
  1428. $(".toxicSpillLord").hide();
  1429. if ((granddukeObj.hours == 0) && (granddukeObj.minutes <= 15) && (localStorage.getItem('RemindSpill') == "Y")) {
  1430. if (confirm('It will be Grand Duke level soon at the toxic spill, travel there now?') == true) {
  1431. travelToSpill("skip");
  1432. }
  1433. localStorage.setItem('RemindSpill', "N")
  1434. $("#toxicSpillCb").prop('checked', false)
  1435. }
  1436. } else if (partialrotation >= 139 && partialrotation < 151) {
  1437. //Archduke Rising
  1438. $(".toxicSpillHeaderValue").text("AD-RISING");
  1439. $(".toxicSpillHeaderValue").css({
  1440. 'color': 'red'
  1441. });
  1442. var timeArchduke = (151 - partialrotation).toPrecision(4);
  1443. archdukeObj.hours = Math.floor(timeArchduke);
  1444. archdukeObj.minutes = Math.ceil((timeArchduke - archdukeObj.hours) * 60);
  1445. archdukeObj = convertToDyHrMn(0, archdukeObj.hours, archdukeObj.minutes);
  1446. granddukeObj = convertToDyHrMn(archdukeObj.days, archdukeObj.hours + 12, archdukeObj.minutes);
  1447. dukeObj = convertToDyHrMn(0, granddukeObj.hours + 24, granddukeObj.minutes);
  1448. countObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours + 10, dukeObj.minutes);
  1449. baronObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1450. $(".toxicSpillArchdukeLabel").text("AD Falling in:");
  1451. $(".toxicSpillGrandDukeLabel").text("Grand Duke in:");
  1452. $(".toxicSpillDukeLabel").text("Duke in:");
  1453. $(".toxicSpillCountLabel").text("Count in:");
  1454. $(".toxicSpillBaronLabel").text("Baron in:");
  1455. toxicSpill.append($(".toxicSpillArchduke"));
  1456. toxicSpill.append($(".toxicSpillGrandDuke"));
  1457. toxicSpill.append($(".toxicSpillDuke"));
  1458. toxicSpill.append($(".toxicSpillCount"));
  1459. toxicSpill.append($(".toxicSpillBaron"));
  1460. $(".toxicSpillHero").hide();
  1461. $(".toxicSpillKnight").hide();
  1462. $(".toxicSpillLord").hide();
  1463. } else if (partialrotation >= 151 && partialrotation < 163) {
  1464. //Archduke Falling
  1465. $(".toxicSpillHeaderValue").text("AD-FALLING");
  1466. $(".toxicSpillHeaderValue").css({
  1467. 'color': 'green'
  1468. });
  1469. var timeGDuke = (163 - partialrotation).toPrecision(4);
  1470. granddukeObj.hours = Math.floor(timeGDuke);
  1471. granddukeObj.minutes = Math.ceil((timeGDuke - granddukeObj.hours) * 60);
  1472. granddukeObj = convertToDyHrMn(0, granddukeObj.hours, granddukeObj.minutes);
  1473. dukeObj = convertToDyHrMn(0, granddukeObj.hours + 24, granddukeObj.minutes);
  1474. countObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours + 10, dukeObj.minutes);
  1475. baronObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1476. lordObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1477. $(".toxicSpillGrandDukeLabel").text("Grand Duke in:");
  1478. $(".toxicSpillDukeLabel").text("Duke in:");
  1479. $(".toxicSpillCountLabel").text("Count in:");
  1480. $(".toxicSpillBaronLabel").text("Baron in:");
  1481. $(".toxicSpillLordLabel").text("Lord in:");
  1482. toxicSpill.append($(".toxicSpillGrandDuke"));
  1483. toxicSpill.append($(".toxicSpillDuke"));
  1484. toxicSpill.append($(".toxicSpillCount"));
  1485. toxicSpill.append($(".toxicSpillBaron"));
  1486. toxicSpill.append($(".toxicSpillLord"));
  1487. $(".toxicSpillHero").hide();
  1488. $(".toxicSpillKnight").hide();
  1489. $(".toxicSpillArchduke").hide();
  1490. if ((granddukeObj.hours == 0) && (granddukeObj.minutes <= 15) && (localStorage.getItem('RemindSpill') == "Y")) {
  1491. if (confirm('It will be Grand Duke level soon at the toxic spill, travel there now?') == true) {
  1492. travelToSpill("skip");
  1493. }
  1494. localStorage.setItem('RemindSpill', "N")
  1495. $("#toxicSpillCb").prop('checked', false)
  1496. }
  1497. } else if (partialrotation >= 163 && partialrotation < 187) {
  1498. //Grand Duke Falling
  1499. $(".toxicSpillHeaderValue").text("GD-FALLING");
  1500. $(".toxicSpillHeaderValue").css({
  1501. 'color': 'green'
  1502. });
  1503. var timeDuke = (187 - partialrotation).toPrecision(4);
  1504. dukeObj.hours = Math.floor(timeDuke);
  1505. dukeObj.minutes = Math.ceil((timeDuke - dukeObj.hours) * 60);
  1506. dukeObj = convertToDyHrMn(0, dukeObj.hours, dukeObj.minutes);
  1507. countObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours + 10, dukeObj.minutes);
  1508. baronObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1509. lordObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1510. knightObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  1511. $(".toxicSpillDukeLabel").text("Duke in:");
  1512. $(".toxicSpillCountLabel").text("Count in:");
  1513. $(".toxicSpillBaronLabel").text("Baron in:");
  1514. $(".toxicSpillLordLabel").text("Lord in:");
  1515. $(".toxicSpillKnightLabel").text("Knight in:");
  1516. toxicSpill.append($(".toxicSpillDuke"));
  1517. toxicSpill.append($(".toxicSpillCount"));
  1518. toxicSpill.append($(".toxicSpillBaron"));
  1519. toxicSpill.append($(".toxicSpillLord"));
  1520. toxicSpill.append($(".toxicSpillKnight"));
  1521. $(".toxicSpillHero").hide();
  1522. $(".toxicSpillGrandDuke").hide();
  1523. $(".toxicSpillArchduke").hide();
  1524. if ((dukeObj.hours == 0) && (dukeObj.minutes <= 15) && (localStorage.getItem('RemindSpill') == "Y")) {
  1525. if (confirm('It will be Duke level soon at the toxic spill, travel there now?') == true) {
  1526. travelToSpill("skip");
  1527. }
  1528. localStorage.setItem('RemindSpill', "N")
  1529. $("#toxicSpillCb").prop('checked', false)
  1530. }
  1531. } else if (partialrotation >= 187 && partialrotation < 211) {
  1532. //Duke Falling
  1533. $(".toxicSpillHeaderValue").text("DUKE-FALLING");
  1534. $(".toxicSpillHeaderValue").css({
  1535. 'color': 'green'
  1536. });
  1537. var timeCount = (211 - partialrotation).toPrecision(4);
  1538. countObj.hours = Math.floor(timeCount);
  1539. countObj.minutes = Math.ceil((timeCount - countObj.hours) * 60);
  1540. countObj = convertToDyHrMn(0, countObj.hours, countObj.minutes);
  1541. baronObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1542. lordObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1543. knightObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  1544. heroObj = convertToDyHrMn(knightObj.days, knightObj.hours + 16, knightObj.minutes);
  1545. $(".toxicSpillCountLabel").text("Count in:");
  1546. $(".toxicSpillBaronLabel").text("Baron in:");
  1547. $(".toxicSpillLordLabel").text("Lord in:");
  1548. $(".toxicSpillKnightLabel").text("Knight in:");
  1549. $(".toxicSpillHeroLabel").text("Hero in:");
  1550. toxicSpill.append($(".toxicSpillCount"));
  1551. toxicSpill.append($(".toxicSpillBaron"));
  1552. toxicSpill.append($(".toxicSpillLord"));
  1553. toxicSpill.append($(".toxicSpillKnight"));
  1554. toxicSpill.append($(".toxicSpillHero"));
  1555. $(".toxicSpillDuke").hide();
  1556. $(".toxicSpillGrandDuke").hide();
  1557. $(".toxicSpillArchduke").hide();
  1558. if ((countObj.hours == 0) && (countObj.minutes <= 15) && (localStorage.getItem('RemindSpill') == "Y")) {
  1559. if (confirm('It will be Count level soon at the toxic spill, travel there now?') == true) {
  1560. travelToSpill("skip");
  1561. }
  1562. localStorage.setItem('RemindSpill', "N")
  1563. $("#toxicSpillCb").prop('checked', false)
  1564. }
  1565. } else if (partialrotation >= 211 && partialrotation < 235) {
  1566. //Count Falling
  1567. $(".toxicSpillHeaderValue").text("COUNT-FALLING");
  1568. $(".toxicSpillHeaderValue").css({
  1569. 'color': 'green'
  1570. });
  1571. var timeBaron = (235 - partialrotation).toPrecision(4);
  1572. baronObj.hours = Math.floor(timeBaron);
  1573. baronObj.minutes = Math.ceil((timeBaron - baronObj.hours) * 60);
  1574. baronObj = convertToDyHrMn(0, baronObj.hours, baronObj.minutes);
  1575. lordObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1576. knightObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  1577. heroObj = convertToDyHrMn(knightObj.days, knightObj.hours + 16, knightObj.minutes);
  1578. countObj = convertToDyHrMn(heroObj.days + 3, heroObj.hours + 10, heroObj.minutes);
  1579. $(".toxicSpillBaronLabel").text("Baron in:");
  1580. $(".toxicSpillLordLabel").text("Lord in:");
  1581. $(".toxicSpillKnightLabel").text("Knight in:");
  1582. $(".toxicSpillHeroLabel").text("Hero in:");
  1583. $(".toxicSpillCountLabel").text("Count Rising in:");
  1584. toxicSpill.append($(".toxicSpillBaron"));
  1585. toxicSpill.append($(".toxicSpillLord"));
  1586. toxicSpill.append($(".toxicSpillKnight"));
  1587. toxicSpill.append($(".toxicSpillHero"));
  1588. toxicSpill.append($(".toxicSpillCount"));
  1589. $(".toxicSpillDuke").hide();
  1590. $(".toxicSpillGrandDuke").hide();
  1591. $(".toxicSpillArchduke").hide();
  1592. if ((baronObj.hours == 0) && (baronObj.minutes <= 15) && (localStorage.getItem('RemindSpill') == "Y")) {
  1593. if (confirm('It will be Baron level soon at the toxic spill, travel there now?') == true) {
  1594. travelToSpill("skip");
  1595. }
  1596. localStorage.setItem('RemindSpill', "N")
  1597. $("#toxicSpillCb").prop('checked', false)
  1598. }
  1599. } else if (partialrotation >= 235 && partialrotation < 253) {
  1600. //Baron Falling
  1601. $(".toxicSpillHeaderValue").text("BARON-FALLING");
  1602. $(".toxicSpillHeaderValue").css({
  1603. 'color': 'green'
  1604. });
  1605. var timeLord = (253 - partialrotation).toPrecision(4);
  1606. lordObj.hours = Math.floor(timeLord);
  1607. lordObj.minutes = Math.ceil((timeLord - lordObj.hours) * 60);
  1608. lordObj = convertToDyHrMn(0, lordObj.hours, lordObj.minutes);
  1609. knightObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  1610. heroObj = convertToDyHrMn(knightObj.days, knightObj.hours + 16, knightObj.minutes);
  1611. baronObj = convertToDyHrMn(heroObj.days + 2, heroObj.hours + 16, heroObj.minutes);
  1612. countObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1613. $(".toxicSpillCountLabel").text("Count in:");
  1614. $(".toxicSpillBaronLabel").text("Baron Rising in:");
  1615. $(".toxicSpillLordLabel").text("Lord in:");
  1616. $(".toxicSpillKnightLabel").text("Knight in:");
  1617. $(".toxicSpillHeroLabel").text("Hero in:");
  1618. toxicSpill.append($(".toxicSpillLord"));
  1619. toxicSpill.append($(".toxicSpillKnight"));
  1620. toxicSpill.append($(".toxicSpillHero"));
  1621. toxicSpill.append($(".toxicSpillBaron"));
  1622. toxicSpill.append($(".toxicSpillCount"));
  1623. $(".toxicSpillDuke").hide();
  1624. $(".toxicSpillGrandDuke").hide();
  1625. $(".toxicSpillArchduke").hide();
  1626. if ((lordObj.hours == 0) && (lordObj.minutes <= 15) && (localStorage.getItem('RemindSpill') == "Y")) {
  1627. if (confirm('It will be Lord level soon at the toxic spill, travel there now?') == true) {
  1628. travelToSpill("skip");
  1629. }
  1630. localStorage.setItem('RemindSpill', "N")
  1631. $("#toxicSpillCb").prop('checked', false)
  1632. }
  1633. } else if (partialrotation >= 253 && partialrotation < 271) {
  1634. //Lord Falling
  1635. $(".toxicSpillHeaderValue").text("LORD-FALLING");
  1636. $(".toxicSpillHeaderValue").css({
  1637. 'color': 'green'
  1638. });
  1639. var timeKnight = (271 - partialrotation).toPrecision(4);
  1640. knightObj.hours = Math.floor(timeKnight);
  1641. knightObj.minutes = Math.ceil((timeKnight - knightObj.hours) * 60);
  1642. knightObj = convertToDyHrMn(0, knightObj.hours, knightObj.minutes);
  1643. heroObj = convertToDyHrMn(knightObj.days, knightObj.hours + 16, knightObj.minutes);
  1644. lordObj = convertToDyHrMn(heroObj.days + 1, heroObj.hours + 22, heroObj.minutes);
  1645. baronObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  1646. countObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1647. $(".toxicSpillCountLabel").text("Count in:");
  1648. $(".toxicSpillBaronLabel").text("Baron in:");
  1649. $(".toxicSpillLordLabel").text("Lord Rising in:");
  1650. $(".toxicSpillKnightLabel").text("Knight in:");
  1651. $(".toxicSpillHeroLabel").text("Hero in:");
  1652. toxicSpill.append($(".toxicSpillKnight"));
  1653. toxicSpill.append($(".toxicSpillHero"));
  1654. toxicSpill.append($(".toxicSpillLord"));
  1655. toxicSpill.append($(".toxicSpillBaron"));
  1656. toxicSpill.append($(".toxicSpillCount"));
  1657. $(".toxicSpillDuke").hide();
  1658. $(".toxicSpillGrandDuke").hide();
  1659. $(".toxicSpillArchduke").hide();
  1660. if ((knightObj.hours == 0) && (knightObj.minutes <= 15) && (localStorage.getItem('RemindSpill') == "Y")) {
  1661. if (confirm('It will be Knight level soon at the toxic spill, travel there now?') == true) {
  1662. travelToSpill("skip");
  1663. }
  1664. localStorage.setItem('RemindSpill', "N")
  1665. $("#toxicSpillCb").prop('checked', false)
  1666. }
  1667. } else if (partialrotation >= 271 && partialrotation < 287) {
  1668. //Knight Falling
  1669. $(".toxicSpillHeaderValue").text("KNIGHT-FALLING");
  1670. $(".toxicSpillHeaderValue").css({
  1671. 'color': 'green'
  1672. });
  1673. var timeHero = (287 - partialrotation).toPrecision(4);
  1674. heroObj.hours = Math.floor(timeHero);
  1675. heroObj.minutes = Math.ceil((timeHero - heroObj.hours) * 60);
  1676. heroObj = convertToDyHrMn(0, heroObj.hours, heroObj.minutes);
  1677. knightObj = convertToDyHrMn(heroObj.days + 1, heroObj.hours + 6, heroObj.minutes);
  1678. lordObj = convertToDyHrMn(knightObj.days, knightObj.hours + 16, knightObj.minutes);
  1679. baronObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  1680. countObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1681. $(".toxicSpillCountLabel").text("Count in:");
  1682. $(".toxicSpillBaronLabel").text("Baron in:");
  1683. $(".toxicSpillLordLabel").text("Lord in:");
  1684. $(".toxicSpillKnightLabel").text("Knight Rising in:");
  1685. $(".toxicSpillHeroLabel").text("Hero in:");
  1686. toxicSpill.append($(".toxicSpillHero"));
  1687. toxicSpill.append($(".toxicSpillKnight"));
  1688. toxicSpill.append($(".toxicSpillLord"));
  1689. toxicSpill.append($(".toxicSpillBaron"));
  1690. toxicSpill.append($(".toxicSpillCount"));
  1691. $(".toxicSpillDuke").hide();
  1692. $(".toxicSpillGrandDuke").hide();
  1693. $(".toxicSpillArchduke").hide();
  1694. if ((heroObj.hours == 0) && (heroObj.minutes <= 15) && (localStorage.getItem('RemindSpill') == "Y")) {
  1695. if (confirm('It will be Hero level soon at the toxic spill, travel there now?') == true) {
  1696. travelToSpill("skip");
  1697. }
  1698. localStorage.setItem('RemindSpill', "N")
  1699. $("#toxicSpillCb").prop('checked', false)
  1700. }
  1701. } else if (partialrotation >= 287 && partialrotation < 302) {
  1702. //Hero Falling
  1703. $(".toxicSpillHeaderValue").text("HERO-FALLING");
  1704. $(".toxicSpillHeaderValue").css({
  1705. 'color': 'green'
  1706. });
  1707. var timeHero = (302 - partialrotation).toPrecision(4);
  1708. heroObj.hours = Math.floor(timeHero);
  1709. heroObj.minutes = Math.ceil((timeHero - heroObj.hours) * 60);
  1710. heroObj = convertToDyHrMn(0, heroObj.hours, heroObj.minutes);
  1711. knightObj = convertToDyHrMn(heroObj.days, heroObj.hours + 15, heroObj.minutes);
  1712. lordObj = convertToDyHrMn(knightObj.days, knightObj.hours + 16, knightObj.minutes);
  1713. baronObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  1714. countObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1715. $(".toxicSpillCountLabel").text("Count in:");
  1716. $(".toxicSpillBaronLabel").text("Baron in:");
  1717. $(".toxicSpillLordLabel").text("Lord in:");
  1718. $(".toxicSpillKnightLabel").text("Knight in:");
  1719. $(".toxicSpillHeroLabel").text("Hero Rising in:");
  1720. toxicSpill.append($(".toxicSpillHero"));
  1721. toxicSpill.append($(".toxicSpillKnight"));
  1722. toxicSpill.append($(".toxicSpillLord"));
  1723. toxicSpill.append($(".toxicSpillBaron"));
  1724. toxicSpill.append($(".toxicSpillCount"));
  1725. $(".toxicSpillDuke").hide();
  1726. $(".toxicSpillGrandDuke").hide();
  1727. $(".toxicSpillArchduke").hide();
  1728. } else {
  1729. //WTF are we?
  1730. }
  1731. $(".toxicSpillArchdukeValue").text(archdukeObj.days + "d " + archdukeObj.hours + "h " + archdukeObj.minutes + "m");
  1732. $(".toxicSpillGrandDukeValue").text(granddukeObj.days + "d " + granddukeObj.hours + "h " + granddukeObj.minutes + "m");
  1733. $(".toxicSpillDukeValue").text(dukeObj.days + "d " + dukeObj.hours + "h " + dukeObj.minutes + "m");
  1734. $(".toxicSpillCountValue").text(countObj.days + "d " + countObj.hours + "h " + countObj.minutes + "m");
  1735. $(".toxicSpillBaronValue").text(baronObj.days + "d " + baronObj.hours + "h " + baronObj.minutes + "m");
  1736. $(".toxicSpillLordValue").text(lordObj.days + "d " + lordObj.hours + "h " + lordObj.minutes + "m");
  1737. $(".toxicSpillKnightValue").text(knightObj.days + "d " + knightObj.hours + "h " + knightObj.minutes + "m");
  1738. $(".toxicSpillHeroValue").text(heroObj.days + "d " + heroObj.hours + "h " + heroObj.minutes + "m");
  1739. //https://mhwiki.hitgrab.com/wiki/index.php/Toxic_Spill#Pollution_Levels
  1740. $(".toxicSpillArchdukeValue").css({
  1741. 'float': 'right'
  1742. })
  1743. $(".toxicSpillGrandDukeValue").css({
  1744. 'float': 'right'
  1745. })
  1746. $(".toxicSpillDukeValue").css({
  1747. 'float': 'right'
  1748. })
  1749. $(".toxicSpillCountValue").css({
  1750. 'float': 'right'
  1751. })
  1752. $(".toxicSpillBaronValue").css({
  1753. 'float': 'right'
  1754. })
  1755. $(".toxicSpillLordValue").css({
  1756. 'float': 'right'
  1757. })
  1758. $(".toxicSpillKnightValue").css({
  1759. 'float': 'right'
  1760. })
  1761. $(".toxicSpillHeroValue").css({
  1762. 'float': 'right'
  1763. })
  1764. }
  1765.  
  1766. function spillLevel(days, hours, minutes) {
  1767. this.days = days;
  1768. this.hours = hours;
  1769. this.minutes = minutes;
  1770. }
  1771.  
  1772. $(document).on('change', '#toxicSpillCb', function() {
  1773. if (this.checked) {
  1774. localStorage.setItem('RemindSpill', "Y")
  1775. this.checked = "Yes";
  1776. } else {
  1777. localStorage.setItem('RemindSpill', "N")
  1778. this.checked = "";
  1779. }
  1780. })
  1781. //============================================================================================
  1782. function todayNow() {
  1783. var today = new Date();
  1784. var todayEpoch = today.getTime() / 1000.0;
  1785. return todayEpoch;
  1786. }
  1787.  
  1788. function convertToDyHrMn(days, hours, minutes) {
  1789. if (hours >= 24) {
  1790. var daysExact = hours / 24;
  1791. var daysTrunc = Math.floor(daysExact);
  1792. var partialDays = daysExact - daysTrunc;
  1793. hours = Math.floor(partialDays * 24);
  1794. days = daysTrunc + days;
  1795. }
  1796. return {
  1797. days,
  1798. hours,
  1799. minutes
  1800. }
  1801. }
  1802.  
  1803. function travelToGrove(skip) {
  1804. if ($('#hudLocationContent').hasClass('hudLocationContent forbidden_grove') == true) {
  1805. //Do nothing you are already there
  1806. } else if ($(".forbiddenGroveHeaderValue").text() == "CLOSED") {
  1807. alert('The Forbiddengrove is closed now, you cannot travel there right now')
  1808. } else if (skip == "skip") {
  1809. app.pages.TravelPage.travel("forbidden_grove");
  1810. } else if (confirm('Travel to the Forbidden Grove now?') == true) {
  1811. app.pages.TravelPage.travel("forbidden_grove");
  1812. }
  1813. }
  1814.  
  1815. function travelToCove(skip) {
  1816. if ($('#hudLocationContent').hasClass('hudLocationContent balacks_cove') == true) {
  1817. //Do nothing, you are already there
  1818. } else if (skip == "skip") {
  1819. app.pages.TravelPage.travel("balacks_cove");
  1820. } else if (confirm("Travel to Balack's Cove now?") == true) {
  1821. app.pages.TravelPage.travel("balacks_cove");
  1822. }
  1823. }
  1824.  
  1825. function travelToGarden(skip) {
  1826. if ($('#hudLocationContent').hasClass('hudLocationContent seasonal_garden') == true) {
  1827. //Do nothing, you are already there
  1828. } else if (skip == "skip") {
  1829. app.pages.TravelPage.travel("seasonal_garden");
  1830. } else if (confirm("Travel to the Seasonal Garden now?") == true) {
  1831. app.pages.TravelPage.travel("seasonal_garden");
  1832. }
  1833. }
  1834.  
  1835. function travelToSpill(skip) {
  1836. if ($('#hudLocationContent').hasClass('hudLocationContent pollution_outbreak') == true) {
  1837. //Do nothing, you are already there
  1838. } else if (skip == "skip") {
  1839. app.pages.TravelPage.travel("pollution_outbreak");
  1840. } else if (confirm("Travel to the Toxic Spill now?") == true) {
  1841. app.pages.TravelPage.travel("pollution_outbreak");
  1842. }
  1843. }