IdlePixel UI Tweaks - (Lux Fork)

Adds some options to change details about the IdlePixel user interface.

  1. // ==UserScript==
  2. // @name IdlePixel UI Tweaks - (Lux Fork)
  3. // @namespace luxferre.dev
  4. // @version 3.0.0
  5. // @description Adds some options to change details about the IdlePixel user interface.
  6. // @author Original Author: Anwinity || Modded with ♡: GodofNades & Lux
  7. // @license MIT
  8. // @match *://idle-pixel.com/login/play/
  9. // @grant none
  10. // @require https://gf.qytechs.cn/scripts/441206-idlepixel/code/IdlePixel+.js?anticache=20220905
  11. // @require https://cdnjs.cloudflare.com/ajax/libs/anchorme/2.1.2/anchorme.min.js
  12. // ==/UserScript==
  13.  
  14. (function () {
  15. "use strict";
  16.  
  17. let IPP, getVar, getThis, purpleKeyGo, utcDate, currUTCDate;
  18.  
  19. let gems = {};
  20.  
  21. window.UIT_IMAGE_URL_BASE =
  22. document
  23. .querySelector("itembox[data-item=copper] img")
  24. .src.replace(/\/[^/]+.png$/, "") + "/";
  25.  
  26. // Start New Base Code Re-work
  27. const uitLevel = function () {
  28. window.uitSkills = [
  29. "mining",
  30. "crafting",
  31. "gathering",
  32. "farming",
  33. "brewing",
  34. "woodcutting",
  35. "cooking",
  36. "fishing",
  37. "invention",
  38. "melee",
  39. "archery",
  40. "magic",
  41. ];
  42.  
  43. return {
  44. LEVELS: function () {
  45. let result = [];
  46. result[1] = 0;
  47. for (let lv = 2; lv <= 300; lv++) {
  48. result[lv] = Math.ceil(Math.pow(lv, 3 + lv / 200));
  49. }
  50. return result;
  51. },
  52.  
  53. xpToLevel: function (xp) {
  54. if (xp <= 0) {
  55. return 1;
  56. }
  57. if (xp >= uitLevel().LEVELS()[300]) {
  58. return 300;
  59. }
  60. let lower = 1;
  61. let upper = 300;
  62. while (lower <= upper) {
  63. let mid = Math.floor((lower + upper) / 2);
  64. let midXP = uitLevel().LEVELS()[mid];
  65. let midPlus1XP = uitLevel().LEVELS()[mid + 1];
  66. if (xp < midXP) {
  67. upper = mid;
  68. continue;
  69. }
  70. if (xp > midPlus1XP) {
  71. lower = mid + 1;
  72. continue;
  73. }
  74. if (mid < 100 && xp == uitLevel().LEVELS()[mid + 1]) {
  75. return mid + 1;
  76. }
  77. return mid;
  78. }
  79. },
  80.  
  81. extendedLevelsUpdate: function () {
  82. let overallLevel = 0;
  83.  
  84. uitSkills.forEach((skill) => {
  85. const xp = getVar(`${skill}_xp`, 0, "int");
  86. const level = uitLevel().calculateExtendedLevel(xp);
  87. uitLevel().updateExtendedLevel(skill, level);
  88. overallLevel += level;
  89. });
  90.  
  91. uitLevel().updateOverallLevel(overallLevel);
  92.  
  93. uitLevel().hideOriginalLevels();
  94. },
  95.  
  96. calculateExtendedLevel: function (xp) {
  97. let extendedLevel = 0;
  98. while (Math.pow(extendedLevel, 3 + extendedLevel / 200) < xp) {
  99. extendedLevel++;
  100. }
  101. if (extendedLevel == 0) {
  102. return 1;
  103. }
  104. return extendedLevel - 1;
  105. },
  106.  
  107. updateExtendedLevel: function (skill, extendedLevel) {
  108. const skillElement = document.querySelector(
  109. `#overallLevelExtended-${skill}`
  110. );
  111. const colorStyle = extendedLevel >= 100 ? "color:cyan" : "";
  112. skillElement.textContent = `(LEVEL ${Math.max(extendedLevel, 1)})`;
  113. skillElement.setAttribute("style", colorStyle);
  114. },
  115.  
  116. updateOverallLevel: function (overallLevel) {
  117. const totalElement = document.querySelector(
  118. "#overallLevelExtended-total"
  119. );
  120. if (overallLevel >= 100) {
  121. totalElement.textContent = ` (${overallLevel})`;
  122. totalElement.style.color = "cyan";
  123. } else {
  124. totalElement.textContent = "";
  125. totalElement.style.display = "none";
  126. }
  127. },
  128.  
  129. hideOriginalLevels: function () {
  130. uitSkills.forEach((skill) => {
  131. const skillElement = document.querySelector(
  132. `#menu-bar-${skill}-level`
  133. );
  134. if (skillElement) {
  135. skillElement.style.display = "none";
  136. }
  137. });
  138. },
  139.  
  140. addLoadingSpanAfterElement: function (selector, id) {
  141. const element = document.querySelector(selector);
  142. const loadingSpan = document.createElement("span");
  143. loadingSpan.id = id;
  144. loadingSpan.textContent = "(Loading)";
  145. loadingSpan.className = "color-silver";
  146. element.insertAdjacentElement("afterend", loadingSpan);
  147. },
  148.  
  149. initExtendedLevels: function () {
  150. if (
  151. document.querySelector(".game-top-bar-upper > a:nth-child(4) > item-display")
  152. ) {
  153. uitLevel().addLoadingSpanAfterElement(
  154. ".game-top-bar-upper > a:nth-child(4) > item-display",
  155. "overallLevelExtended-total"
  156. );
  157. } else {
  158. uitLevel().addLoadingSpanAfterElement(
  159. ".game-top-bar-upper > a:nth-child(5) > item-display",
  160. "overallLevelExtended-total"
  161. );
  162. }
  163. uitSkills.forEach((skill) => {
  164. uitLevel().addLoadingSpanAfterElement(
  165. `#menu-bar-${skill}-level`,
  166. `overallLevelExtended-${skill}`
  167. );
  168. });
  169. },
  170.  
  171. initNextLevel: function () {
  172. const itemDisplayElements = document.querySelectorAll("item-display");
  173.  
  174. itemDisplayElements.forEach((el) => {
  175. const dataKey = el.getAttribute("data-key");
  176. if (dataKey && dataKey.endsWith("_xp")) {
  177. const parent = el.parentElement;
  178. const uiTweaksXpNext = document.createElement("span");
  179. uiTweaksXpNext.className = "ui-tweaks-xp-next";
  180. uiTweaksXpNext.innerHTML = "&nbsp;&nbsp;Next Level: ";
  181. const itemDisplayNext = document.createElement("item-display");
  182. itemDisplayNext.setAttribute("data-format", "number");
  183. itemDisplayNext.setAttribute("data-key", `ipp_${dataKey}_next`);
  184. uiTweaksXpNext.appendChild(itemDisplayNext);
  185. parent.appendChild(uiTweaksXpNext);
  186. }
  187. });
  188. },
  189. };
  190. };
  191.  
  192. const uitPurpleKey = function () {
  193. // No global constants/declarations
  194. return {
  195. onPurpleKey: function (monster, rarity, timer) {
  196. if (purpleKeyGo) {
  197. const timeLeft = format_time(timer);
  198. const imageSrc = monster;
  199. const monsterName = imageSrc
  200. .replace(/_/g, " ")
  201. .replace(/\b\w/g, (letter) => letter.toUpperCase());
  202.  
  203. const purpleKeyNotification = document.querySelector(
  204. "#notification-purple_key"
  205. );
  206. const imageElement = document.querySelector(
  207. "#notification-purple_key-image"
  208. );
  209. const imageTextElement = document.querySelector(
  210. "#notification-purple_key-image-text"
  211. );
  212. const rarityElement = document.querySelector(
  213. "#notification-purple_key-rarity"
  214. );
  215. const timeElement = document.querySelector(
  216. "#notification-purple_key-time"
  217. );
  218.  
  219. imageElement.setAttribute(
  220. "src",
  221. `https://d1xsc8x7nc5q8t.cloudfront.net/images/${imageSrc}_icon.png`
  222. );
  223. imageTextElement.innerText = `${monsterName} `;
  224. rarityElement.innerText = ` ${rarity}`;
  225. timeElement.innerText = ` ⏲️${timeLeft}`;
  226.  
  227. if (rarity === "Very Rare") {
  228. purpleKeyNotification.style.backgroundColor = "DarkRed";
  229. [imageTextElement, rarityElement, timeElement].forEach(
  230. (element) => (element.style.color = "white")
  231. );
  232. } else {
  233. let textColor = "black";
  234. if (rarity === "Rare") {
  235. purpleKeyNotification.style.backgroundColor = "orange";
  236. } else if (rarity === "Uncommon") {
  237. purpleKeyNotification.style.backgroundColor = "gold";
  238. } else if (rarity === "Common") {
  239. purpleKeyNotification.style.backgroundColor = "DarkGreen";
  240. textColor = "white";
  241. }
  242. [imageTextElement, rarityElement, timeElement].forEach(
  243. (element) => (element.style.color = textColor)
  244. );
  245. }
  246. return;
  247. }
  248. },
  249.  
  250. addPurpleKeyNotifications: function () {
  251. var purpleKeyUnlocked = getVar("guardian_purple_key_hint", 0, "int");
  252. const notifDiv = document.createElement("div");
  253. notifDiv.id = `notification-purple_key`;
  254. notifDiv.onclick = function () {
  255. websocket.send("CASTLE_MISC=guardian_purple_key_hint");
  256. };
  257. notifDiv.className = "notification hover";
  258. notifDiv.style = "margin-right: 4px; margin-bottom: 4px; display: none";
  259. notifDiv.style.display = "inline-block";
  260.  
  261. var elem = document.createElement("img");
  262. elem.setAttribute("src", "");
  263. const notifIcon = elem;
  264. notifIcon.className = "w20";
  265. notifIcon.id = `notification-purple_key-image`;
  266. notifIcon.innerText = "";
  267.  
  268. const notifDivImgText = document.createElement("span");
  269. notifDivImgText.id = `notification-purple_key-image-text`;
  270. notifDivImgText.innerText = "";
  271. notifDivImgText.className = "color-white";
  272.  
  273. var elemKey = document.createElement("img");
  274. elemKey.setAttribute(
  275. "src",
  276. `${UIT_IMAGE_URL_BASE}purple_gaurdian_key.png`
  277. );
  278. const notifDivRarityKey = elemKey;
  279. notifDivRarityKey.className = "w20";
  280. notifDivRarityKey.id = `notification-purple_key-rarity-img`;
  281. notifDivRarityKey.style = `transform: rotate(-45deg)`;
  282.  
  283. const notifDivRarity = document.createElement("span");
  284. notifDivRarity.id = `notification-purple_key-rarity`;
  285. notifDivRarity.innerText = "Purple Key Info Loading";
  286. notifDivRarity.className = "color-white";
  287.  
  288. const notifDivTime = document.createElement("span");
  289. notifDivTime.id = `notification-purple_key-time`;
  290. notifDivTime.innerText = "";
  291. notifDivTime.className = "color-white";
  292.  
  293. notifDiv.append(
  294. notifIcon,
  295. notifDivImgText,
  296. notifDivRarityKey,
  297. notifDivRarity,
  298. notifDivTime
  299. );
  300. document.querySelector("#notifications-area").prepend(notifDiv);
  301. if (purpleKeyUnlocked == 0) {
  302. document.querySelector("#notification-purple_key").style.display =
  303. "none";
  304. } else {
  305. document.querySelector("#notification-purple_key").style.display =
  306. "inline-block";
  307. }
  308. },
  309. };
  310. };
  311.  
  312. const uitCriptoe = function () {
  313. // No global constants/declarations
  314. return {
  315. addCriptoeValues: function () {
  316. fetch('https://idle-pixel.com/criptoe/')
  317. .then(response => {
  318. if (!response.ok) {
  319. throw new Error('Network response was not ok');
  320. }
  321. return response.json();
  322. })
  323. .then(data => {
  324. let walletPercentages = {};
  325. let seenWallets = new Set();
  326.  
  327. const dataArray = data.data;
  328.  
  329. for (let i = dataArray.length - 1; i >= 0; i--) {
  330. let entry = dataArray[i];
  331. if (!seenWallets.has(entry.wallet)) {
  332. seenWallets.add(entry.wallet);
  333. walletPercentages[`wallet_${entry.wallet}`] = entry.percentage;
  334. }
  335.  
  336. if (seenWallets.size === 4) break;
  337. }
  338.  
  339. const wallets = ["wallet_1", "wallet_2", "wallet_3", "wallet_4"];
  340.  
  341. wallets.forEach((walletKey) => {
  342. const payoutElementId = `${walletKey}_payout`;
  343. const payoutElement = document.getElementById(payoutElementId);
  344. let percentage = walletPercentages[walletKey];
  345. const investedAmount = getVar(`${walletKey.replace("_", "")}_invested`, 0, "int");
  346. if (investedAmount > 0) {
  347. if (percentage > -100) {
  348. payoutElement.innerText = ` ${uitCriptoe().getPayout(investedAmount, percentage)}`;
  349. } else {
  350. payoutElement.innerText = ` Full Loss`;
  351. }
  352. } else {
  353. payoutElement.innerText = ` No Investment`;
  354. }
  355. const percentageElementId = `criptoe-${walletKey.replace("_", "-")}-percentage`;
  356. const percentageElement = document.getElementById(percentageElementId);
  357.  
  358. let percentageText = "";
  359. let weekday = new Date().getUTCDay();
  360. if (weekday == 0) {
  361. percentage = -20;
  362. percentageText = `${percentage} %`;
  363. } else if (weekday == 1) {
  364. percentage = 0;
  365. percentageText = `Go invest!`;
  366.  
  367. } else {
  368. percentageText = `${percentage} %`;
  369. }
  370.  
  371. percentageElement.innerText = `${percentageText}`;
  372.  
  373. if (percentage < 0) {
  374. percentageElement.style.color = "red";
  375. } else if (percentage > 0) {
  376. percentageElement.style.color = "lime";
  377. } else {
  378. percentageElement.style.color = "white";
  379. }
  380. });
  381. })
  382. .catch(error => {
  383. console.error('There has been a problem with your fetch operation:', error);
  384. });
  385. },
  386.  
  387. initCriptoe: function () {
  388. document
  389. .querySelector(
  390. "#panel-criptoe-market > div.charts-content > div > table:nth-child(1) > tbody > tr > td:nth-child(1) > item-display"
  391. )
  392. .insertAdjacentHTML(
  393. "afterend",
  394. `<br><b>Current Payout: </b><span id="wallet_1_payout"></span>`
  395. );
  396. document
  397. .querySelector(
  398. "#panel-criptoe-market > div.charts-content > div > table:nth-child(3) > tbody > tr > td:nth-child(1) > item-display"
  399. )
  400. .insertAdjacentHTML(
  401. "afterend",
  402. `<br><b>Current Payout: </b><span id="wallet_2_payout"></span>`
  403. );
  404. document
  405. .querySelector(
  406. "#panel-criptoe-market > div.charts-content > div > table:nth-child(5) > tbody > tr > td:nth-child(1) > item-display"
  407. )
  408. .insertAdjacentHTML(
  409. "afterend",
  410. `<br><b>Current Payout: </b><span id="wallet_3_payout"></span>`
  411. );
  412. document
  413. .querySelector(
  414. "#panel-criptoe-market > div.charts-content > div > table:nth-child(7) > tbody > tr > td:nth-child(1) > item-display"
  415. )
  416. .insertAdjacentHTML(
  417. "afterend",
  418. `<br><b>Current Payout: </b><span id="wallet_4_payout"></span>`
  419. );
  420.  
  421. document.getElementById("left-panel-item_panel-criptoe-market").onclick =
  422. function () {
  423. switch_panels('panel-criptoe-market');
  424. uitCriptoe().addCriptoeValues();
  425. }
  426. },
  427.  
  428. getPayout: function (wallet, perct) {
  429. let weekday = new Date().getUTCDay();
  430. let payout;
  431. if (weekday == "0") {
  432. payout = Math.floor(
  433. wallet * 0.8
  434. )
  435. return payout;
  436. }
  437. if (weekday == "1") {
  438. return 0;
  439. }
  440. payout = Math.floor(
  441. wallet * (perct / 100 + 1)
  442. ).toLocaleString();
  443. return payout;
  444. },
  445.  
  446. updateCrippledToeTimer: function () {
  447. var now = new Date(); // Create a new date object with the current date and time
  448. var hours = now.getUTCHours(); // Get the hours value in UTC
  449. var minutes = now.getUTCMinutes(); // Get the minutes value in UTC
  450. var seconds = now.getUTCSeconds(); // Get the seconds value in UTC
  451.  
  452. // Pad the hours, minutes, and seconds with leading zeros if they are less than 10
  453. hours = hours.toString().padStart(2, "0");
  454. minutes = minutes.toString().padStart(2, "0");
  455. seconds = seconds.toString().padStart(2, "0");
  456.  
  457. // Concatenate the hours, minutes, and seconds with colons
  458.  
  459. let path = getVar("criptoe_path_selected", "none", "string");
  460. if (path === "none") {
  461. path = "No Path Selected"
  462. } else {
  463. path = `${path.replace(/\b\w/g, (letter) => letter.toUpperCase())} Path`;
  464.  
  465. }
  466. const menuBarCrippledtoeRow = document.querySelector(
  467. "#left-panel-item_panel-criptoe-market table tbody tr"
  468. );
  469.  
  470. let researchTimer = IdlePixelPlus.getVarOrDefault("criptoe_path_timer", 0, "int");
  471. let rTimerText;
  472.  
  473. if (researchTimer > 0) {
  474. rTimerText = format_time(researchTimer);
  475. } else {
  476. rTimerText = "Can swap";
  477. }
  478.  
  479. // Find the cell that contains the text "CRIPTOE MARKET"
  480. const cells = menuBarCrippledtoeRow.getElementsByTagName("td");
  481. let criptoeMarketCell = null;
  482. for (let cell of cells) {
  483. if (cell.textContent.includes("CRIPTOE MARKET")) {
  484. criptoeMarketCell = cell;
  485. break;
  486. }
  487. }
  488. if (criptoeMarketCell) {
  489. criptoeMarketCell.innerHTML = `CRIPTOE MARKET <span style="color:cyan;">(${hours + ":" + minutes + ":" + seconds
  490. })</span>
  491. <i class="font-small" style="" id="criptoe_path_selected-left-label"><br>${path} (${rTimerText})</i>`;
  492. }
  493. },
  494. };
  495. };
  496.  
  497. const uitTableLabels = function () {
  498. window.UIT_POTION_XP_MAP = {
  499. stardust_potion: 75,
  500. energy_potion: 50,
  501. anti_disease_potion: 250,
  502. tree_speed_potion: 525,
  503. smelting_upgrade_potion: 550,
  504. great_stardust_potion: 1925,
  505. farming_speed_potion: 500,
  506. rare_monster_potion: 2125,
  507. super_stardust_potion: 4400,
  508. gathering_unique_potion: 3000,
  509. heat_potion: 2500,
  510. bait_potion: 1000,
  511. bone_potion: 1550,
  512. furnace_speed_potion: 6000,
  513. promethium_potion: 2000,
  514. oil_potion: 5000,
  515. super_rare_monster_potion: 6000,
  516. ultra_stardust_potion: 12900,
  517. magic_shiny_crystal_ball_potion: 7000,
  518. birdhouse_potion: 800,
  519. rocket_potion: 1500,
  520. titanium_potion: 5000,
  521. blue_orb_potion: 50000,
  522. geode_potion: 9500,
  523. magic_crystal_ball_potion: 12000,
  524. stone_converter_potion: 4000,
  525. rain_potion: 2500,
  526. combat_loot_potion: 9500,
  527. rotten_potion: 1250,
  528. merchant_speed_potion: 50000,
  529. green_orb_potion: 200000,
  530. guardian_key_potion: 42500,
  531. ancient_potion: 40000,
  532. red_orb_potion: 500000,
  533. cooks_dust_potion: 100000,
  534. farm_dust_potion: 100000,
  535. fighting_dust_potion: 100000,
  536. tree_dust_potion: 100000,
  537. infinite_oil_potion: 0,
  538. raids_hp_potion: 0,
  539. raids_mana_potion: 0,
  540. raids_bomb_potion: 0,
  541. };
  542.  
  543. return {
  544. addTableCraftLabels: function () {
  545. // Invention Table
  546. const inventionTableRows = document.querySelectorAll(
  547. "#invention-table tbody tr[data-tablette-required]"
  548. );
  549. inventionTableRows.forEach((row) => {
  550. const outputs = row.querySelectorAll(
  551. "td:nth-child(4) item-invention-table"
  552. );
  553. outputs.forEach((output) => {
  554. output.textContent =
  555. Number(output.textContent).toLocaleString() +
  556. " (" +
  557. output.getAttribute("data-materials-item").replaceAll("_", " ") +
  558. ")";
  559. });
  560. });
  561.  
  562. // Crafting Table
  563. const craftingTableRows = document.querySelectorAll(
  564. "#crafting-table tbody tr[data-crafting-item]"
  565. );
  566. craftingTableRows.forEach((row) => {
  567. const outputs = row.querySelectorAll(
  568. "td:nth-child(3) item-crafting-table"
  569. );
  570. outputs.forEach((output) => {
  571. output.textContent =
  572. Number(output.textContent).toLocaleString() +
  573. " (" +
  574. output.getAttribute("data-materials-item").replaceAll("_", " ") +
  575. ")";
  576. });
  577. });
  578.  
  579. // Brewing Table
  580. const brewingTableRows = document.querySelectorAll(
  581. "#brewing-table tbody tr[data-brewing-item]"
  582. );
  583. brewingTableRows.forEach((row) => {
  584. const outputs = row.querySelectorAll(
  585. "td:nth-child(3) item-brewing-table"
  586. );
  587. outputs.forEach((output) => {
  588. output.textContent =
  589. output.textContent +
  590. " (" +
  591. output.getAttribute("data-materials-item").replaceAll("_", " ") +
  592. ")";
  593. });
  594. });
  595. },
  596.  
  597. updateTableCraftLabels: function () {
  598. const brewingTable = document.querySelector("#brewing-table");
  599. if (brewingTable) {
  600. const rows = brewingTable.querySelectorAll(
  601. "tbody tr[data-brewing-item]"
  602. );
  603. rows.forEach((row) => {
  604. if (row.id != "id-raids_hp_potion" || row.id != "id-raids_mana_potion" || row.id != "id-raids_bomb_potion") {
  605. const brewingXP = row.querySelector("td:nth-child(6)");
  606. if (brewingXP) {
  607. const potionName = brewingXP.getAttribute("data-xp").replace("_xp", "");
  608. const potionXP =
  609. UIT_POTION_XP_MAP[potionName]?.toLocaleString() + " xp";
  610. const potionOrig = document.createElement("span");
  611. potionOrig.classList.add("font-small", "color-grey");
  612. potionOrig.textContent = potionXP;
  613. brewingXP.innerHTML = "";
  614. brewingXP.appendChild(potionOrig);
  615. }
  616. }
  617. });
  618. }
  619. },
  620. /*
  621. disableTableRefreshBrewing: function () {
  622. Brewing.refresh_table = function () {
  623. Brewing._refresh_click_events();
  624. Brewing._refresh_materials();
  625. Brewing._refresh_timers();
  626. Brewing._refresh_backgrounds();
  627. //Brewing._refresh_xp_labels();
  628. }
  629. },
  630. */
  631. disableTableRefreshBrewing: function() {
  632. Brewing.refresh_table = function(brewing_table) {
  633. Brewing._refresh_click_events(brewing_table)
  634. Brewing._refresh_materials(brewing_table)
  635. Brewing._refresh_timers(brewing_table)
  636. Brewing._refresh_backgrounds(brewing_table)
  637. //Brewing._refresh_xp_labels(brewing_table)
  638. }
  639. },
  640.  
  641. Crafting_getMaterials: function () {
  642. Crafting._refresh_materials_and_level = function (crafting_table) {
  643. // var crafting_table = document.getElementById("crafting-table");
  644. if(!crafting_table) {
  645. crafting_table = document.getElementById("crafting-table");
  646. }
  647.  
  648. var materials_req_array = crafting_table.getElementsByTagName("item-crafting-table");
  649. var levels_req_array = crafting_table.getElementsByTagName("item-crafting-table-level");
  650.  
  651. for (var i = 0; i < materials_req_array.length; i++) {
  652. var materials_req = materials_req_array[i];
  653. var item = materials_req.getAttribute("data-materials-item");
  654. var originalAmount = materials_req.innerHTML;
  655. var amountText = originalAmount.split(" ")[0];
  656. var cleanedAmountText = amountText.replace(/[,.\s]/g, '');
  657. var amount = parseInt(cleanedAmountText, 10);
  658.  
  659. if (Items.getItem(item) >= amount)
  660. materials_req_array[i].style.color = "#00a200";
  661. else
  662. materials_req_array[i].style.color = "red";
  663. }
  664.  
  665. for (var ix = 0; ix < levels_req_array.length; ix++) {
  666. var levels_req = levels_req_array[ix];
  667. var level_found = parseInt(levels_req.innerHTML);
  668. if (get_level(Items.getItem("crafting_xp")) >= level_found)
  669. levels_req.style.color = "green";
  670. else
  671. levels_req.style.color = "red";
  672. }
  673. }
  674. Crafting._refresh_click_events = function(crafting_table)
  675. {
  676. if(!crafting_table) {
  677. crafting_table = document.getElementById("crafting-table");
  678. }
  679. if (!Crafting._click_events_loaded) {
  680. var crafting_row_array = crafting_table.getElementsByTagName("tr");
  681.  
  682. for (var i = 0; i < crafting_row_array.length; i++) {
  683. var crafting_row = crafting_row_array[i];
  684. if (!crafting_row.hasAttribute("data-crafting-item"))
  685. continue;
  686.  
  687. crafting_row.addEventListener('click', (e) => {
  688. var target_clicked = e.target;
  689. var tr = target_clicked.closest("tr");
  690. var crafting_row_item = tr.getAttribute("data-crafting-item");
  691. var can_use_crafting_input_multiple = tr.getAttribute("data-crafting-item-multiple") === "true";
  692.  
  693. if (can_use_crafting_input_multiple)
  694. Modals.open_input_dialogue(crafting_row_item, "Crafting", "How many do you want to craft?", "CRAFT");
  695. else {
  696. var materials = Crafting.get_materials(crafting_row_item);
  697. var html = "<div class='modal-crafting-ingredients shadow'>";
  698. html += "<b>MATERIALS</b><hr />";
  699. for (var i = 0; i < materials.length; i++) {
  700. var name = materials[i];
  701. i++;
  702. var amount = materials[i];
  703. var originalAmount = materials[i];
  704. //console.log(originalAmount);
  705. var amountText = originalAmount.split(" ")[0];
  706. var cleanedAmountText = amountText.replace(/[,.\s]/g, '');
  707. var amountClick = parseInt(cleanedAmountText, 10);
  708.  
  709. var img = '<img width="15px" height="15px" src="https://d1xsc8x7nc5q8t.cloudfront.net/images/x.png">';
  710.  
  711. if (Items.getItem(name) >= amountClick)
  712. img = '<img width="15px" height="15px" src="https://d1xsc8x7nc5q8t.cloudfront.net/images/check.png">';
  713.  
  714. html += "<img class='w40' src='https://d1xsc8x7nc5q8t.cloudfront.net/images/" + name + ".png' /> " + originalAmount + " " + img;
  715. html += "<br />";
  716. }
  717. html += "</div><br /><br />Craft Item?";
  718.  
  719. document.getElementById("modal-brew-ingredients").innerHTML = html;
  720. Modals.open_image_modal("Crafting", "images/" + crafting_row_item + ".png", html, "Craft", "Cancel", "CRAFT=" + crafting_row_item + "~" + 1)
  721. }
  722.  
  723. });
  724. }
  725. Crafting._click_events_loaded = true;
  726. }
  727.  
  728. }
  729. },
  730.  
  731. Invention_getMaterials: function () {
  732. Invention._refresh_materials = function () {
  733. var invention_table = document.getElementById("invention-table");
  734. var materials_req_array = invention_table.getElementsByTagName("item-invention-table");
  735.  
  736. for (var i = 0; i < materials_req_array.length; i++) {
  737. var materials_req = materials_req_array[i];
  738. var item = materials_req.getAttribute("data-materials-item");
  739. var originalAmount = materials_req.innerHTML;
  740. var amountText = originalAmount.split(" ")[0];
  741. var cleanedAmountText = amountText.replace(/[,.\s]/g, '');
  742. var amount = parseInt(cleanedAmountText, 10);
  743.  
  744. if (Items.getItem(item) >= amount)
  745. materials_req_array[i].style.color = "#00a200";
  746. else
  747. materials_req_array[i].style.color = "red";
  748. }
  749. }
  750. },
  751. Modals_changeModal: function () {
  752. Modals.open_brew_dialogue = function (item) {
  753. document.getElementById("modal-brew-item-name-hidden").value = item;
  754. document.getElementById("modal-brew-item-image").src = get_image("images/" + item + ".png");
  755. document.getElementById("modal-brew-item-amount").value = "1";
  756. var materials = Brewing.get_ingredients(item);
  757. var html = "<b>INGREDIENTS</b><hr />";
  758. var dict = {};
  759. for(var i = 0; i < materials.length; i++)
  760. {
  761. var name = materials[i];
  762. i++;
  763. var amount = materials[i];
  764. var originalAmount = materials[i];
  765. //console.log(originalAmount);
  766. var amountText = originalAmount.split(" ")[0];
  767. var cleanedAmountText = amountText.replace(/[,.\s]/g, '');
  768. var amountClick = parseInt(cleanedAmountText, 10);
  769. html += "<img class='w40' src='https://d1xsc8x7nc5q8t.cloudfront.net/images/"+name+".png' /> " + format_number(amountClick);
  770. html += "<br />";
  771. dict[name] = amountClick;
  772. }
  773. //console.log(dict);
  774. document.getElementById("modal-brew-ingredients").innerHTML = html;
  775. Modals.open_modern_input_dialogue_with_value(
  776. item,
  777. "images/" + item + ".png",
  778. dict,
  779. 'PLUS_ONE',
  780. null,
  781. "Brew",
  782. "BREW=" + item,
  783. )
  784. }
  785. },
  786. };
  787. };
  788.  
  789. const uitFishing = function () {
  790. window.UIT_FISH_ENERGY_MAP = {
  791. // Normal Raw Fish
  792. shrimp: 25,
  793. anchovy: 100,
  794. sardine: 200,
  795. crab: 500,
  796. piranha: 1000,
  797. salmon: 100,
  798. trout: 300,
  799. pike: 1000,
  800. eel: 3000,
  801. rainbow_fish: 30000,
  802. tuna: 500,
  803. swordfish: 3000,
  804. manta_ray: 9000,
  805. shark: 20000,
  806. whale: 40000,
  807.  
  808. // Shiny Raw Fish
  809. shrimp_shiny: 125,
  810. anchovy_shiny: 500,
  811. sardine_shiny: 1000,
  812. crab_shiny: 2500,
  813. piranha_shiny: 5000,
  814. salmon_shiny: 500,
  815. trout_shiny: 1500,
  816. pike_shiny: 5000,
  817. eel_shiny: 15000,
  818. rainbow_fish_shiny: 150000,
  819. tuna_shiny: 2500,
  820. swordfish_shiny: 15000,
  821. manta_ray_shiny: 45000,
  822. shark_shiny: 100000,
  823. whale_shiny: 200000,
  824.  
  825. // Mega Shiny Raw Fish
  826. shrimp_mega_shiny: 625,
  827. anchovy_mega_shiny: 2500,
  828. sardine_mega_shiny: 5000,
  829. crab_mega_shiny: 12500,
  830. piranha_mega_shiny: 25000,
  831. salmon_mega_shiny: 2500,
  832. trout_mega_shiny: 7500,
  833. pike_mega_shiny: 25000,
  834. eel_mega_shiny: 75000,
  835. rainbow_fish_mega_shiny: 750000,
  836. tuna_mega_shiny: 12500,
  837. swordfish_mega_shiny: 75000,
  838. manta_ray_mega_shiny: 225000,
  839. shark_mega_shiny: 500000,
  840. whale_mega_shiny: 1000000,
  841.  
  842. // Misc Fish
  843. bloated_shark: 20000,
  844. small_stardust_fish: 1000,
  845. medium_stardust_fish: 2500,
  846. large_stardust_fish: 5000,
  847. angler_fish: 100000,
  848. };
  849.  
  850. window.UIT_FISH_HEAT_MAP = {
  851. // Normal Raw Fish
  852. shrimp: 10,
  853. anchovy: 20,
  854. sardine: 40,
  855. crab: 75,
  856. piranha: 120,
  857. salmon: 20,
  858. trout: 40,
  859. pike: 110,
  860. eel: 280,
  861. rainbow_fish: 840,
  862. tuna: 75,
  863. swordfish: 220,
  864. manta_ray: 1200,
  865. shark: 3000,
  866. whale: 5000,
  867.  
  868. //Shiny Raw Fish
  869. shrimp_shiny: 10,
  870. anchovy_shiny: 20,
  871. sardine_shiny: 40,
  872. crab_shiny: 75,
  873. piranha_shiny: 120,
  874. salmon_shiny: 20,
  875. trout_shiny: 40,
  876. pike_shiny: 110,
  877. eel_shiny: 280,
  878. rainbow_fish_shiny: 840,
  879. tuna_shiny: 75,
  880. swordfish_shiny: 220,
  881. manta_ray_shiny: 1200,
  882. shark_shiny: 3000,
  883. whale_shiny: 5000,
  884.  
  885. //Mega Shiny Raw Fish
  886. shrimp_mega_shiny: 10,
  887. anchovy_mega_shiny: 20,
  888. sardine_mega_shiny: 40,
  889. crab_mega_shiny: 75,
  890. piranha_mega_shiny: 120,
  891. salmon_mega_shiny: 20,
  892. trout_mega_shiny: 40,
  893. pike_mega_shiny: 110,
  894. eel_mega_shiny: 280,
  895. rainbow_fish_mega_shiny: 840,
  896. tuna_mega_shiny: 75,
  897. swordfish_mega_shiny: 220,
  898. manta_ray_mega_shiny: 1200,
  899. shark_mega_shiny: 3000,
  900. whale_mega_shiny: 5000,
  901.  
  902. // Misc Fish
  903. bloated_shark: 3000,
  904. small_stardust_fish: 300,
  905. medium_stardust_fish: 600,
  906. large_stardust_fish: 2000,
  907. angler_fish: 10000,
  908. };
  909. return {
  910. initFishing: function () {
  911. const fishingNetItembox = document.querySelector(
  912. 'itembox[data-item="fishing_net"]'
  913. );
  914. if (fishingNetItembox) {
  915. const heatFishingTab = document.createElement("itembox");
  916. heatFishingTab.id = "heat-fishing-tab";
  917. heatFishingTab.dataset.item = "heat";
  918. heatFishingTab.classList.add("shadow", "hover");
  919. heatFishingTab.setAttribute("data-bs-toggle", "tooltip");
  920.  
  921. heatFishingTab.innerHTML = `
  922. <div class="center mt-1">
  923. <img src="${UIT_IMAGE_URL_BASE}heat.png" width="50px" height="50px">
  924. </div>
  925. <div class="center mt-2">
  926. <item-display data-format="number" data-key="heat"></item-display>
  927. </div>
  928. `;
  929. fishingNetItembox.before(heatFishingTab);
  930. }
  931.  
  932. // Fishing Energy/Heat Info
  933. const panelFishing = document.querySelector("#panel-fishing");
  934. const progressBar = panelFishing.querySelector(".progress-bar");
  935.  
  936. const hrElement = document.createElement("hr");
  937. progressBar.insertAdjacentElement("afterend", hrElement);
  938.  
  939. const containerDiv = document.createElement("div");
  940. containerDiv.style.display = "flex";
  941. containerDiv.style.flexDirection = "column";
  942.  
  943. const h5Element = document.createElement("h5");
  944. h5Element.textContent = "Fish Energy";
  945.  
  946. const buttonElement = document.createElement("button");
  947. buttonElement.textContent = "Show";
  948. buttonElement.id = "fish_energy-visibility-button";
  949. buttonElement.addEventListener("click", show_hide);
  950. h5Element.appendChild(buttonElement);
  951.  
  952. const innerDiv = document.createElement("div");
  953. innerDiv.id = "fishing-calculator-div";
  954.  
  955. const rawFishEnergySpan = document.createElement("span");
  956. rawFishEnergySpan.textContent = "Total Raw Fish Energy: ";
  957.  
  958. const rawFishEnergyNumberSpan = document.createElement("span");
  959. rawFishEnergyNumberSpan.textContent = "0";
  960. rawFishEnergyNumberSpan.id = "raw-fish-energy-number";
  961. rawFishEnergySpan.appendChild(rawFishEnergyNumberSpan);
  962.  
  963. const br1Element = document.createElement("br");
  964.  
  965. const heatToCookAllSpan = document.createElement("span");
  966. heatToCookAllSpan.textContent = "Heat To Cook All: ";
  967.  
  968. const fishHeatRequiredNumberSpan = document.createElement("span");
  969. fishHeatRequiredNumberSpan.textContent = "0";
  970. fishHeatRequiredNumberSpan.id = "fish-heat-required-number";
  971. heatToCookAllSpan.appendChild(fishHeatRequiredNumberSpan);
  972.  
  973. const br2Element = document.createElement("br");
  974.  
  975. const totalCookedFishEnergySpan = document.createElement("span");
  976. totalCookedFishEnergySpan.textContent = "Total Cooked Fish Energy: ";
  977.  
  978. const cookedFishEnergyNumberSpan = document.createElement("span");
  979. cookedFishEnergyNumberSpan.textContent = "0";
  980. cookedFishEnergyNumberSpan.id = "cooked-fish-energy-number";
  981. totalCookedFishEnergySpan.appendChild(cookedFishEnergyNumberSpan);
  982.  
  983. innerDiv.appendChild(rawFishEnergySpan);
  984. innerDiv.appendChild(br1Element);
  985. innerDiv.appendChild(heatToCookAllSpan);
  986. innerDiv.appendChild(br2Element);
  987. innerDiv.appendChild(totalCookedFishEnergySpan);
  988.  
  989. containerDiv.appendChild(h5Element);
  990. containerDiv.appendChild(innerDiv);
  991.  
  992. hrElement.insertAdjacentElement("afterend", containerDiv);
  993.  
  994. function show_hide() {
  995. const button = document.querySelector(
  996. "#fish_energy-visibility-button"
  997. );
  998. const div = document.querySelector("#fishing-calculator-div");
  999.  
  1000. if (button.textContent === "Hide") {
  1001. div.style.display = "none";
  1002. button.textContent = "Show";
  1003. } else {
  1004. div.style.display = "block";
  1005. button.textContent = "Hide";
  1006. }
  1007. }
  1008. uitFishing().calcFishEnergy();
  1009. document.querySelector("#fishing-calculator-div").style.display =
  1010. "none";
  1011. },
  1012.  
  1013. calcFishEnergy: function () {
  1014. const fishRawEnergy = Object.keys(UIT_FISH_ENERGY_MAP);
  1015. const fishHeat = Object.keys(UIT_FISH_HEAT_MAP);
  1016. const fishCookedEnergy = Object.keys(UIT_FISH_ENERGY_MAP);
  1017. let totalRawEnergy = 0;
  1018. let totalHeat = 0;
  1019. let totalCookedEnergy = 0;
  1020. const collectorModeFish = getThis.getConfig("minusOneHeatInFishingTab");
  1021.  
  1022. fishRawEnergy.forEach((fish) => {
  1023. let currentRawFish = getVar("raw_" + fish, 0, "int");
  1024. let currentCookedFish = getVar("cooked_" + fish, 0, "int");
  1025.  
  1026. if (currentRawFish > 0 && collectorModeFish) {
  1027. currentRawFish--;
  1028. }
  1029. if (currentCookedFish > 0 && collectorModeFish) {
  1030. currentCookedFish--;
  1031. }
  1032. const currentRawEnergy = currentRawFish * UIT_FISH_ENERGY_MAP[fish];
  1033. const currentHeat = currentRawFish * UIT_FISH_HEAT_MAP[fish];
  1034. const currentCookedEnergy =
  1035. currentCookedFish * UIT_FISH_ENERGY_MAP[fish];
  1036. totalRawEnergy += currentRawEnergy;
  1037. totalHeat += currentHeat;
  1038. totalCookedEnergy += currentCookedEnergy;
  1039. });
  1040.  
  1041. document.getElementById("raw-fish-energy-number").textContent =
  1042. totalRawEnergy.toLocaleString();
  1043. document.getElementById("fish-heat-required-number").textContent =
  1044. totalHeat.toLocaleString();
  1045. document.getElementById("cooked-fish-energy-number").textContent =
  1046. totalCookedEnergy.toLocaleString();
  1047. },
  1048. };
  1049. };
  1050.  
  1051. const uitInvention = function () {
  1052. // No global constants/declarations
  1053. return {
  1054. hideOrbsAndRing: function () {
  1055. if (Globals.currentPanel === "panel-invention") {
  1056. const masterRing = getVar("master_ring_assembled", 0, "int");
  1057. const fishingOrb = getVar(
  1058. "mega_shiny_glass_ball_fish_assembled",
  1059. 0,
  1060. "int"
  1061. );
  1062. const leafOrb = getVar(
  1063. "mega_shiny_glass_ball_leaf_assembled",
  1064. 0,
  1065. "int"
  1066. );
  1067. const logsOrb = getVar(
  1068. "mega_shiny_glass_ball_logs_assembled",
  1069. 0,
  1070. "int"
  1071. );
  1072. const monstersOrb = getVar(
  1073. "mega_shiny_glass_ball_monsters_assembled",
  1074. 0,
  1075. "int"
  1076. );
  1077. const volcanoTab = getVar("volcano_tablette_charged", 0, "int");
  1078. const ancientTab = getVar("ancient_tablette_charged", 0, "int");
  1079.  
  1080. const selectors = {
  1081. masterRing:
  1082. "#invention-table > tbody [data-invention-item=master_ring]",
  1083. fishingOrb:
  1084. "#invention-table > tbody [data-invention-item=mega_shiny_glass_ball_fish]",
  1085. leafOrb:
  1086. "#invention-table > tbody [data-invention-item=mega_shiny_glass_ball_leaf]",
  1087. logsOrb:
  1088. "#invention-table > tbody [data-invention-item=mega_shiny_glass_ball_logs]",
  1089. monstersOrb:
  1090. "#invention-table > tbody [data-invention-item=mega_shiny_glass_ball_monsters]",
  1091. };
  1092.  
  1093. const uiTweaksConfig = getThis.getConfig("hideOrbRing");
  1094.  
  1095. for (const orb in selectors) {
  1096. if (selectors.hasOwnProperty(orb)) {
  1097. const element = document.querySelector(selectors[orb]);
  1098. if (uiTweaksConfig) {
  1099. if (orb === "masterRing" && masterRing === 1) {
  1100. element.style.display = "none";
  1101. } else if (orb === "fishingOrb" && fishingOrb === 1) {
  1102. element.style.display = "none";
  1103. } else if (orb === "leafOrb" && leafOrb === 1) {
  1104. element.style.display = "none";
  1105. } else if (orb === "logsOrb" && logsOrb === 1) {
  1106. element.style.display = "none";
  1107. } else if (orb === "monstersOrb" && monstersOrb === 1) {
  1108. element.style.display = "none";
  1109. } else {
  1110. element.style.display = "";
  1111. }
  1112. } else {
  1113. if (orb !== "masterRing" && volcanoTab === 1) {
  1114. element.style.display = "";
  1115. } else if (orb === "masterRing" && ancientTab === 1) {
  1116. element.style.display = "";
  1117. } else {
  1118. element.style.display = "none";
  1119. }
  1120. }
  1121. }
  1122. }
  1123. }
  1124. },
  1125. };
  1126. };
  1127.  
  1128. const uitRocket = function () {
  1129. window.uitMoonImg = `https://idle-pixel.wiki/images/4/47/Moon.png`;
  1130. window.uitSunImg = `https://idle-pixel.wiki/images/6/61/Sun.png`;
  1131. window.uitRocketImg = `${UIT_IMAGE_URL_BASE}rocket.gif`;
  1132. window.uitMegaRocketImg = `${UIT_IMAGE_URL_BASE}mega_rocket.gif`;
  1133. return {
  1134. configChange: function () {
  1135. const rocketETATimer = getThis.getConfig("rocketETATimer");
  1136. if (rocketETATimer) {
  1137. document.getElementById("notification-rocket-timer").style.display =
  1138. "inline-block";
  1139. document.getElementById(
  1140. "notification-mega_rocket-timer"
  1141. ).style.display = "inline-block";
  1142. } else {
  1143. document.getElementById("notification-rocket-timer").style.display =
  1144. "none";
  1145. document.getElementById(
  1146. "notification-mega_rocket-timer"
  1147. ).style.display = "none";
  1148. }
  1149.  
  1150. const hideRocketKM = getThis.getConfig("hideRocketKM");
  1151. if (hideRocketKM) {
  1152. document.getElementById("notification-rocket-label").style.display =
  1153. "none";
  1154. document.getElementById(
  1155. "notification-mega_rocket-label"
  1156. ).style.display = "none";
  1157. } else {
  1158. document.getElementById("notification-rocket-label").style.display =
  1159. "inline-block";
  1160. document.getElementById(
  1161. "notification-mega_rocket-label"
  1162. ).style.display = "inline-block";
  1163. }
  1164.  
  1165. const rocket_usable = getVar("rocket_usable", 0, "int");
  1166. const rocket_travel_check = getVar(
  1167. "rocket_distance_required",
  1168. 0,
  1169. "int"
  1170. );
  1171. const rocket_pot_timer_check = getVar("rocket_potion_timer", 0, "int");
  1172. const rocket_check = getVar("mega_rocket", 0, "int");
  1173.  
  1174. if (
  1175. getThis.getConfig("leftSideRocketInfoSection") &&
  1176. rocket_usable > 0
  1177. ) {
  1178. document.getElementById("current-rocket-info").style.display =
  1179. "block";
  1180.  
  1181. if (getThis.getConfig("leftSideRocketInfo")) {
  1182. document.getElementById("rocket-travel-info").style.display =
  1183. "block";
  1184. document.getElementById("notification-mega_rocket").style.display =
  1185. "none";
  1186. document.getElementById("notification-rocket").style.display =
  1187. "none";
  1188. } else if (rocket_travel_check > 0 && rocket_check == 1) {
  1189. document.getElementById("notification-mega_rocket").style.display =
  1190. "block";
  1191. document.getElementById("rocket-travel-info").style.display =
  1192. "none";
  1193. } else if (rocket_travel_check > 0 && rocket_check == 0) {
  1194. document.getElementById("notification-rocket").style.display =
  1195. "block";
  1196. document.getElementById("rocket-travel-info").style.display =
  1197. "none";
  1198. } else {
  1199. document.getElementById("rocket-travel-info").style.display =
  1200. "none";
  1201. }
  1202.  
  1203. if (getThis.getConfig("leftSideRocketFuel")) {
  1204. document.getElementById("current-rocket-fuel-info").style.display =
  1205. "block";
  1206. } else {
  1207. document.getElementById("current-rocket-fuel-info").style.display =
  1208. "none";
  1209. }
  1210.  
  1211. if (getThis.getConfig("leftSideRocketPot")) {
  1212. document.getElementById("current-rocket-pot-info").style.display =
  1213. "block";
  1214. document.getElementById(
  1215. "notification-potion-rocket_potion_timer"
  1216. ).style.display = "none";
  1217. } else if (rocket_pot_timer_check > 0) {
  1218. document.getElementById(
  1219. "notification-potion-rocket_potion_timer"
  1220. ).style.display = "block";
  1221. document.getElementById("current-rocket-pot-info").style.display =
  1222. "none";
  1223. } else {
  1224. document.getElementById("current-rocket-pot-info").style.display =
  1225. "none";
  1226. }
  1227. } else {
  1228. document.getElementById("current-rocket-info").style.display = "none";
  1229. }
  1230. },
  1231.  
  1232. onLogin: function () {
  1233. const moonImg = `https://idle-pixel.wiki/images/4/47/Moon.png`;
  1234. const sunImg = `https://idle-pixel.wiki/images/6/61/Sun.png`;
  1235. const rocketImg = `${UIT_IMAGE_URL_BASE}rocket.png`;
  1236. const megaRocketImg = `${UIT_IMAGE_URL_BASE}mega_rocket.gif`;
  1237. const currentLocation = uitRocket().currentLocation();
  1238. const currentRocket = uitRocket().currentRocketImg();
  1239.  
  1240. // "Moon & Sun Distance Info
  1241. const rocketInfoSideCar = document.createElement("div");
  1242. rocketInfoSideCar.id = "rocket-info-side_car";
  1243. rocketInfoSideCar.style.paddingLeft = "20px";
  1244. rocketInfoSideCar.style.paddingTop = "10px";
  1245. rocketInfoSideCar.style.paddingBottom = "10px";
  1246.  
  1247. rocketInfoSideCar.innerHTML = `
  1248. <span id="rocket-info-label">MOON & SUN DISTANCE</span>
  1249. <br/>
  1250. <style type="text/css">
  1251. .span2 {
  1252. display: inline-block;
  1253. text-align: right;
  1254. width: 100px;
  1255. }
  1256. </style>
  1257. <span onClick="websocket.send(Modals.clicks_rocket())" id="menu-bar-rocket_moon">
  1258. <img id="moon-img" class="img-20" src="${uitMoonImg}">
  1259. <span class="span2 rocket-dist_moon">0</span>
  1260. <span style='margin-left:0.75em;' class="rocket-dist_moon-symbol">🔴</span>
  1261. <img id="moon-rocket-img" class="img-20" src="${currentRocket}">
  1262. <br/>
  1263. </span>
  1264. <span onClick="websocket.send(Modals.clicks_rocket())" id="menu-bar-rocket_sun">
  1265. <img id "sun-img" class="img-20" src=${uitSunImg}>
  1266. <span class="span2 rocket-dist_sun">0</span>
  1267. <span style='margin-left:0.75em;' class="rocket-dist_sun-symbol">🔴</span>
  1268. <img id="sun-rocket-img" class="img-20" src="${currentRocket}">
  1269. <br/>
  1270. </span>
  1271. `;
  1272.  
  1273. document
  1274. .getElementById("game-menu-bar-skills")
  1275. .insertAdjacentElement("beforebegin", rocketInfoSideCar);
  1276.  
  1277. // "Current Rocket Info" side car
  1278. const rocketInfoSideCarElement = document.getElementById(
  1279. "rocket-info-side_car"
  1280. );
  1281.  
  1282. // Append HTML after #rocket-info-side_car
  1283. const currentRocketInfo = document.createElement("div");
  1284. currentRocketInfo.id = "current-rocket-info";
  1285. currentRocketInfo.style.borderTop = "1px solid rgba(66, 66, 66, 1)";
  1286. currentRocketInfo.style.borderBottom = "1px solid rgba(66, 66, 66, 1)";
  1287. currentRocketInfo.style.paddingTop = "10px";
  1288. currentRocketInfo.style.paddingBottom = "10px";
  1289. /*
  1290. Commented out code
  1291. <img id="rocket-current-travel-location-sun" class="img-20" src="${sunImg}">
  1292. <img id="rocket-type-img-mega" class="img-20" src="${megaRocketImg}">
  1293. <img id="rocket-type-img-reg" class="img-20" src="${rocketImg}">
  1294. */
  1295. currentRocketInfo.innerHTML = `
  1296. <div style="padding-left: 20px;">
  1297. <span id="current-rocket-info-label" style:>CURRENT ROCKET INFO</span>
  1298. <br/>
  1299. <div id="rocket-travel-info">
  1300. <div id="rocket-travel-info-dist">
  1301. <img id="rocket-current-travel-location" class="img-20" src="${currentLocation}">
  1302. <span id="current-rocket-travel-distances" style="padding-left: 20px;">Loading...</span>
  1303. <br/>
  1304. </div>
  1305. <div id="rocket-travel-info-eta">
  1306. <img id="rocket-type-img" class="img-20" src="${currentRocket}">
  1307. <span id="current-rocket-travel-times" style="padding-left: 20px;">00:00:00</span>
  1308. <br/>
  1309. </div>
  1310. </div>
  1311. <div onClick="switch_panels('panel-crafting')" id="current-rocket-fuel-info">
  1312. <img id="rocket-rocket_fuel-img" class="img-20" src="${UIT_IMAGE_URL_BASE}rocket_fuel.png">
  1313. <span style="padding-left: 20px;">Rocket Fuel - </span>
  1314. <span id="rocket-fuel-count">0</span>
  1315. <br/>
  1316. </div>
  1317. <div onClick="switch_panels('panel-brewing')" id="current-rocket-pot-info">
  1318. <img id="rocket-rocket_potion-img" class="img-20" src="${UIT_IMAGE_URL_BASE}rocket_potion.png">
  1319. <span style="padding-left: 20px;">Rocket Potion </span>
  1320. (<span id="rocket-pot-count">0</span>)
  1321. <span> - </span>
  1322. <span id=rocket-pot-timer>0:00:00</span>
  1323. </div>
  1324. </div>
  1325. `;
  1326. rocketInfoSideCarElement.parentNode.insertBefore(
  1327. currentRocketInfo,
  1328. rocketInfoSideCarElement.nextSibling
  1329. );
  1330.  
  1331. const elementsToHide = ["sun-rocket-img", "moon-rocket-img"];
  1332.  
  1333. elementsToHide.forEach((elementId) => {
  1334. const element = document.getElementById(elementId);
  1335. if (element) {
  1336. element.style.display = "none";
  1337. }
  1338. });
  1339.  
  1340. const currentRocketInfoElement = document.getElementById(
  1341. "current-rocket-info"
  1342. );
  1343. if (currentRocketInfoElement) {
  1344. currentRocketInfoElement.style.display = "none";
  1345. }
  1346. },
  1347.  
  1348. timeout: function () {
  1349. const rocket_fuel = getVar("rocket_fuel", 0, "int");
  1350. const rocket_pot_count = getVar("rocket_potion", 0, "int");
  1351. document.querySelector("#rocket-fuel-count").textContent = rocket_fuel.toLocaleString();
  1352. document.querySelector("#rocket-pot-count").textContent =
  1353. rocket_pot_count.toLocaleString();
  1354. },
  1355.  
  1356. onVar: function () {
  1357. const rocket_usable = getVar("rocket_usable", 0, "int");
  1358. const rocket_travel_check = getVar(
  1359. "rocket_distance_required",
  1360. 0,
  1361. "int"
  1362. );
  1363. const rocket_pot_timer_check = getVar("rocket_potion_timer", 0, "int");
  1364. const rocket_check = getVar("mega_rocket", 0, "int");
  1365. if (
  1366. getThis.getConfig("leftSideRocketInfoSection") &&
  1367. rocket_usable > 0
  1368. ) {
  1369. document.getElementById("current-rocket-info").style.display =
  1370. "block";
  1371.  
  1372. if (getThis.getConfig("leftSideRocketInfo")) {
  1373. document.getElementById("rocket-travel-info").style.display = "block";
  1374. document.getElementById("notification-mega_rocket").style.display = "none";
  1375. document.getElementById("notification-rocket").style.display = "none";
  1376. } else if (rocket_travel_check > 0 && rocket_check == 1) {
  1377. document.getElementById("notification-mega_rocket").style.display = "block";
  1378. document.getElementById("rocket-travel-info").style.display = "none";
  1379. } else if (rocket_travel_check > 0 && rocket_check == 0) {
  1380. document.getElementById("notification-rocket").style.display = "inline-block";
  1381. document.getElementById("rocket-travel-info").style.display = "none";
  1382. } else {
  1383. document.getElementById("rocket-travel-info").style.display = "none";
  1384. }
  1385.  
  1386. if (getThis.getConfig("leftSideRocketFuel")) {
  1387. document.getElementById("current-rocket-fuel-info").style.display =
  1388. "block";
  1389. } else {
  1390. document.getElementById("current-rocket-fuel-info").style.display =
  1391. "none";
  1392. }
  1393.  
  1394. if (getThis.getConfig("leftSideRocketPot")) {
  1395. document.getElementById("current-rocket-pot-info").style.display =
  1396. "block";
  1397. document.getElementById(
  1398. "notification-potion-rocket_potion_timer"
  1399. ).style.display = "none";
  1400. } else if (rocket_pot_timer_check > 0) {
  1401. document.getElementById(
  1402. "notification-potion-rocket_potion_timer"
  1403. ).style.display = "inline-block";
  1404. document.getElementById("current-rocket-pot-info").style.display =
  1405. "none";
  1406. } else {
  1407. document.getElementById("current-rocket-pot-info").style.display =
  1408. "none";
  1409. }
  1410. } else {
  1411. document.getElementById("current-rocket-info").style.display = "none";
  1412. }
  1413. },
  1414.  
  1415. varChange: function () {
  1416. const status = getVar("rocket_status", "none", "string");
  1417. const km = getVar("rocket_km", 0, "int");
  1418. var rocket_quest = getVar("junk_planet_quest", 0, "int");
  1419. var rQComp;
  1420. if (rocket_quest == -1) {
  1421. rQComp = 2;
  1422. } else {
  1423. rQComp = 1;
  1424. }
  1425. const total = getVar("rocket_distance_required", 0, "int");
  1426. const rocket_pot = getVar("rocket_potion_timer", 0, "int");
  1427. const rocket_type = getVar("mega_rocket", 0, "int");
  1428. const rocket_fuel = getVar("rocket_fuel", 0, "int");
  1429. const rocket_pot_count = getVar("rocket_potion", 0, "int");
  1430. const rocket_pot_timer = format_time(rocket_pot);
  1431. const rocket_speed_moon = rocket_pot * 12 * rQComp;
  1432. const rocket_speed_sun = rocket_pot * 2400 * rQComp;
  1433. let pot_diff = "";
  1434. let pot_diff_mega = "";
  1435. let label = "";
  1436. let label_side = "";
  1437. let label_side_car_dist = "";
  1438. let label_side_car_eta = "";
  1439. if (status == "to_moon" || status == "from_moon") {
  1440. const remaining =
  1441. status == "to_moon" ? (total - km) / rQComp : km / rQComp;
  1442. pot_diff = Math.round(remaining / 1.5) - rocket_pot * 8;
  1443. let eta = "";
  1444. if (rocket_pot > 0) {
  1445. if (rocket_speed_moon <= remaining * rQComp) {
  1446. eta = rocket_pot + pot_diff;
  1447. } else {
  1448. eta = Math.round(remaining / 12);
  1449. }
  1450. } else {
  1451. eta = Math.round(remaining / 1.5);
  1452. }
  1453. label = format_time(eta);
  1454. label_side = format_time(eta);
  1455. if (
  1456. getThis.getConfig("rocketETATimer") &&
  1457. !getThis.getConfig("hideRocketKM")
  1458. ) {
  1459. label = " - " + label;
  1460. label_side_car_dist =
  1461. km.toLocaleString() + "/" + total.toLocaleString();
  1462. label_side_car_eta = label_side;
  1463. }
  1464. } else if (status == "to_sun" || status == "from_sun") {
  1465. const remaining =
  1466. status == "to_sun" ? (total - km) / rQComp : km / rQComp;
  1467. pot_diff_mega = Math.round(remaining / 300) - rocket_pot * 8;
  1468. let eta = "";
  1469. if (rocket_pot > 0) {
  1470. if (rocket_speed_sun <= remaining * rQComp) {
  1471. eta = rocket_pot + pot_diff_mega;
  1472. } else {
  1473. eta = Math.round(remaining / 2400);
  1474. }
  1475. } else {
  1476. eta = Math.round(remaining / 300);
  1477. }
  1478. label = format_time(eta);
  1479. label_side = format_time(eta);
  1480. if (
  1481. getThis.getConfig("rocketETATimer") &&
  1482. !getThis.getConfig("hideRocketKM")
  1483. ) {
  1484. label = " - " + label;
  1485. if (km == total) {
  1486. label_side_car_dist = "LANDED";
  1487. } else if (total == 0) {
  1488. label_side_car_dist = "IDLE";
  1489. } else {
  1490. label_side_car_dist =
  1491. km.toLocaleString() + "/" + total.toLocaleString();
  1492. label_side_car_eta = label_side;
  1493. }
  1494. }
  1495. }
  1496.  
  1497. document.querySelector("#current-rocket-travel-distances").textContent =
  1498. label_side_car_dist;
  1499. document.querySelector("#current-rocket-travel-times").textContent =
  1500. label_side_car_eta;
  1501. document.querySelector("#rocket-fuel-count").textContent = rocket_fuel.toLocaleString();
  1502. document.querySelector("#rocket-pot-count").textContent =
  1503. rocket_pot_count.toLocaleString();
  1504. document.querySelector("#rocket-pot-timer").textContent =
  1505. rocket_pot_timer;
  1506. },
  1507.  
  1508. rocketInfoUpdate: function (variable) {
  1509. if (variable == "moon_distance") {
  1510. var distanceMoon = Number(var_moon_distance);
  1511. document
  1512. .getElementById("menu-bar-rocket_moon")
  1513. .querySelector(".rocket-dist_moon").textContent =
  1514. distanceMoon.toLocaleString();
  1515. var goodMoon = Number(getThis.getConfig("goodMoon"));
  1516. var rocketDistMoonSymbol = document
  1517. .getElementById("menu-bar-rocket_moon")
  1518. .querySelector(".rocket-dist_moon-symbol");
  1519. rocketDistMoonSymbol.textContent =
  1520. goodMoon >= distanceMoon ? "🟢" : "🔴";
  1521. } else if (variable == "sun_distance") {
  1522. var distanceSun = Number(var_sun_distance);
  1523. document
  1524. .getElementById("menu-bar-rocket_sun")
  1525. .querySelector(".rocket-dist_sun").textContent =
  1526. distanceSun.toLocaleString();
  1527. var goodSun = Number(getThis.getConfig("goodSun"));
  1528. var rocketDistSunSymbol = document
  1529. .getElementById("menu-bar-rocket_sun")
  1530. .querySelector(".rocket-dist_sun-symbol");
  1531. rocketDistSunSymbol.textContent =
  1532. goodSun >= distanceSun ? "🟢" : "🔴";
  1533. }
  1534. },
  1535.  
  1536. currentRocketImg: function () {
  1537. if (getVar("mega_rocket_crafted", 0, "int") == 1) {
  1538. return uitMegaRocketImg;
  1539. } else {
  1540. return uitRocketImg;
  1541. }
  1542. },
  1543.  
  1544. currentLocation: function () {
  1545. const status = getVar("rocket_status", "none", "string");
  1546. if (
  1547. status === "to_sun" ||
  1548. status === "from_sun" ||
  1549. status === "at_sun"
  1550. ) {
  1551. return uitSunImg;
  1552. } else if (
  1553. status === "to_moon" ||
  1554. status === "from_moon" ||
  1555. status === "at_moon"
  1556. ) {
  1557. return uitMoonImg;
  1558. } else {
  1559. return uitMoonImg;
  1560. }
  1561. },
  1562.  
  1563. rocketStatus: function () {
  1564. const rocketStatus = getVar("rocket_status", "");
  1565. if (rocketStatus.startsWith("to")) {
  1566. uitRocket().toLocation(rocketStatus);
  1567. } else if (rocketStatus.startsWith("from")) {
  1568. uitRocket().fromLocation(rocketStatus);
  1569. } else if (rocketStatus.startsWith("at")) {
  1570. uitRocket().atLocation(rocketStatus);
  1571. } else {
  1572. uitRocket().noLocation();
  1573. }
  1574. },
  1575.  
  1576. toLocation: function (location) {
  1577. // Moon & Sun Distance Area
  1578. const locationImg = uitRocket().currentLocation();
  1579. const rocketImg = uitRocket().currentRocketImg();
  1580. if (location.endsWith("moon")) {
  1581. document.getElementById("moon-rocket-img").src = rocketImg;
  1582. document.getElementById("moon-rocket-img").style.transform = "rotate(0deg)";
  1583. document.getElementById("moon-rocket-img").style.display = "inline-block";
  1584. document.getElementById("sun-rocket-img").style.display = "none";
  1585. } else {
  1586. document.getElementById("sun-rocket-img").src = rocketImg;
  1587. document.getElementById("sun-rocket-img").style.transform = "rotate(0deg)";
  1588. document.getElementById("sun-rocket-img").style.display = "inline-block";
  1589. document.getElementById("moon-rocket-img").style.display = "none";
  1590. }
  1591.  
  1592. // Rocket Info Section
  1593. document.getElementById("rocket-travel-info-dist").style.display = "";
  1594. document.getElementById("rocket-current-travel-location").src = locationImg;
  1595. document.getElementById("rocket-type-img").src = rocketImg;
  1596. document.getElementById("rocket-type-img").style.transform = "rotate(0deg)";
  1597. },
  1598.  
  1599. fromLocation: function (location) {
  1600. const status = uitRocket().currentLocation();
  1601. // Moon & Sun Distance Area
  1602. const locationImg = uitRocket().currentLocation();
  1603. const rocketImg = uitRocket().currentRocketImg();
  1604. if (location.endsWith("moon")) {
  1605. document.getElementById("moon-rocket-img").src = rocketImg;
  1606. document.getElementById("moon-rocket-img").style.transform = "rotate(180deg)";
  1607. document.getElementById("moon-rocket-img").style.display = "inline-block";
  1608. document.getElementById("sun-rocket-img").style.display = "none";
  1609. } else {
  1610. document.getElementById("sun-rocket-img").src = rocketImg;
  1611. document.getElementById("sun-rocket-img").style.transform = "rotate(180deg)";
  1612. document.getElementById("sun-rocket-img").style.display = "inline-block";
  1613. document.getElementById("moon-rocket-img").style.display = "none";
  1614. }
  1615.  
  1616. // Rocket Info Section
  1617. document.getElementById("rocket-travel-info-dist").style.display = "";
  1618. document.getElementById("rocket-current-travel-location").src =
  1619. locationImg;
  1620. document.getElementById("rocket-type-img").src = rocketImg;
  1621. document.getElementById("rocket-type-img").style.transform =
  1622. "rotate(180deg)";
  1623. },
  1624.  
  1625. atLocation: function (location) {
  1626. const status = uitRocket().currentLocation();
  1627. // Moon & Sun Distance Area
  1628. const locationImg = uitRocket().currentLocation();
  1629. const rocketImg = uitRocket().currentRocketImg();
  1630. if (location.endsWith("moon")) {
  1631. document.getElementById("moon-rocket-img").src = rocketImg;
  1632. document.getElementById("moon-rocket-img").style.transform = "rotate(135deg)";
  1633. document.getElementById("moon-rocket-img").style.display = "inline-block";
  1634. document.getElementById("sun-rocket-img").style.display = "none";
  1635. } else {
  1636. document.getElementById("sun-rocket-img").src = rocketImg;
  1637. document.getElementById("sun-rocket-img").style.transform = "rotate(135deg)";
  1638. document.getElementById("sun-rocket-img").style.display = "inline-block";
  1639. document.getElementById("moon-rocket-img").style.display = "none";
  1640. }
  1641.  
  1642. // Rocket Info Section
  1643. document.getElementById("rocket-travel-info").style.display = "";
  1644. document.getElementById("rocket-current-travel-location").src = locationImg;
  1645. document.getElementById("rocket-type-img").src = rocketImg;
  1646. document.getElementById("rocket-type-img").style.transform = "rotate(135deg)";
  1647. document.getElementById("current-rocket-travel-times").textContent = "LANDED";
  1648. },
  1649.  
  1650. noLocation: function () {
  1651. // Moon & Sun Distance Area
  1652. document.getElementById("moon-rocket-img").style.display = "none";
  1653. document.getElementById("sun-rocket-img").style.display = "none";
  1654.  
  1655. // Rocket Info Section
  1656. document.getElementById("rocket-travel-info-dist").style.display = "none";
  1657. document.getElementById("rocket-type-img").style.transform =
  1658. "rotate(-45deg)";
  1659. document.getElementById("current-rocket-travel-times").textContent =
  1660. "IDLE";
  1661. },
  1662. };
  1663. };
  1664.  
  1665. const uitMisc = function () {
  1666. // Globals constants
  1667. return {
  1668. initStyles: function () {
  1669. const style = document.createElement("style");
  1670. style.id = "styles-ui-tweaks";
  1671. style.textContent = `
  1672. #chat-top {
  1673. display: flex;
  1674. flex-direction: row;
  1675. justify-content: left;
  1676. }
  1677. #chat-top > button {
  1678. margin-left: 2px;
  1679. margin-right: 2px;
  1680. white-space: nowrap;
  1681. }
  1682. #content.side-chat {
  1683. display: grid;
  1684. column-gap: 0;
  1685. row-gap: 0;
  1686. grid-template-columns: 2fr minmax(300px, 1fr);
  1687. grid-template-rows: 1fr;
  1688. }
  1689. #content.side-chat #game-chat {
  1690. max-height: calc(100vh - 32px);
  1691. }
  1692. #content.side-chat #game-chat > :first-child {
  1693. display: grid;
  1694. column-gap: 0;
  1695. row-gap: 0;
  1696. grid-template-columns: 1fr;
  1697. grid-template-rows: auto 1fr auto;
  1698. height: calc(100% - 16px);
  1699. }
  1700. #content.side-chat #chat-area {
  1701. height: auto !important;
  1702. }
  1703. .farming-plot-wrapper.condensed {
  1704. min-width: 115px;
  1705. display: flex;
  1706. flex-direction: row;
  1707. justify-items: flex-start;
  1708. width: fit-content;
  1709. height: unset;
  1710. min-height: unset;
  1711. max-height: unset;
  1712. }
  1713. .farming-plot-wrapper.condensed > span {
  1714. width: 100px;
  1715. max-height: 200px;
  1716. }
  1717. .farming-plot-wrapper.condensed img {
  1718. width: 100px;
  1719. }
  1720. #panel-gathering .gathering-box.condensed {
  1721. height: 240px;
  1722. position: relative;
  1723. margin: 4px auto;
  1724. padding-left: 4px;
  1725. padding-right: 4px;
  1726. }
  1727. #panel-gathering .gathering-box.condensed img.gathering-area-image {
  1728. position: absolute;
  1729. top: 10px;
  1730. left: 10px;
  1731. width: 68px;
  1732. height: 68px;
  1733. }
  1734. #panel-gathering .gathering-box.condensed br:nth-child(2),
  1735. #panel-gathering .gathering-box.condensed br:nth-child(3)
  1736. {
  1737. display: none;
  1738. }
  1739. #panel-mining.add-arrow-controls itembox {
  1740. position: relative;
  1741. }
  1742. #panel-mining:not(.add-arrow-controls) itembox .arrow-controls {
  1743. display: none !important;
  1744. }
  1745. itembox .arrow-controls {
  1746. position: absolute;
  1747. top: 0px;
  1748. right: 2px;
  1749. height: 100%;
  1750. padding: 2px;
  1751. display: flex;
  1752. flex-direction: column;
  1753. justify-content: space-around;
  1754. align-items: center;
  1755. }
  1756. itembox .arrow {
  1757. border: solid white;
  1758. border-width: 0 4px 4px 0;
  1759. display: inline-block;
  1760. padding: 6px;
  1761. cursor: pointer;
  1762. opacity: 0.85;
  1763. }
  1764. itembox .arrow:hover {
  1765. opacity: 1;
  1766. border-color: yellow;
  1767. }
  1768. itembox .arrow.up {
  1769. transform: rotate(-135deg);
  1770. -webkit-transform: rotate(-135deg);
  1771. margin-top: 3px;
  1772. }
  1773. itembox .arrow.down {
  1774. transform: rotate(45deg);
  1775. -webkit-transform: rotate(45deg);
  1776. margin-bottom: 3px;
  1777. }
  1778.  
  1779. .itembox-large {
  1780. width: 204px;
  1781. margin-bottom: 15px;
  1782. }
  1783.  
  1784. #menu-bar-sd_watch {
  1785. margin-left: 20px;
  1786. }
  1787. .sd-watch-text {
  1788. padding-left: 20px;
  1789. }
  1790. .game-menu-bar-left-table-btn tr
  1791. {
  1792. background-color: transparent !important;
  1793. border:0 !important;
  1794. font-size:medium;
  1795. }
  1796. .hover-menu-bar-item:hover {
  1797. background: #256061 !important;
  1798. border:0 !important;
  1799. filter:unset;
  1800. font-size:medium;
  1801. }
  1802. .thin-progress-bar {
  1803. background:#437b7c !important;
  1804. border:0 !important;
  1805. height:unset;
  1806. }
  1807. .thin-progress-bar-inner {
  1808. background:#88e8ea !important;
  1809. }
  1810. .game-menu-bar-left-table-btn td{
  1811. padding-left:20px !important;
  1812. padding:unset;
  1813. margin:0px;
  1814. font-size:medium;
  1815. }
  1816.  
  1817. .game-menu-bar-left-table-btn div td{
  1818. padding-left:20px !important;
  1819. padding:unset;
  1820. margin:0px;
  1821. font-size:medium;
  1822. background-color: transparent !important;
  1823. }
  1824.  
  1825. #menu-bar-archery-table-btn-wrapper {
  1826. padding-left:20px !important;
  1827. padding:unset;
  1828. margin:0px;
  1829. font-size:medium;
  1830. background-color: transparent !important;
  1831. }
  1832.  
  1833. #menu-bar-magic-table-btn-wrapper {
  1834. padding-left:20px !important;
  1835. padding:unset;
  1836. margin:0px;
  1837. font-size:medium;
  1838. }
  1839.  
  1840. .game-menu-bar-left-table-btn {
  1841. background-color: transparent !important;
  1842. }
  1843. .left-menu-item {
  1844. margin-bottom:unset;
  1845. font-size:medium;
  1846. }
  1847. .left-menu-item > img {
  1848. margin-left: 20px;
  1849. margin-right: 20px;
  1850. }
  1851. .raids-option-bar {
  1852. width: 90px !important;
  1853. height: 25px !important;
  1854. margin-right: 5px !important;
  1855. }
  1856. .raids-buttons {
  1857. justify-content: center !important;
  1858. align-items: center !important;
  1859. border-radius: 5px !important;
  1860. }
  1861. `;
  1862.  
  1863. document.head.appendChild(style);
  1864. },
  1865.  
  1866. fixGKeys: function () {
  1867. // Get the original itembox
  1868. const itemBox = document.getElementById('itembox-fight-guardians');
  1869.  
  1870. // Update the main div's style
  1871. itemBox.style.overflow = 'hidden';
  1872. itemBox.style.marginBottom = '-20px';
  1873.  
  1874. // Select the first and second child divs
  1875. const firstDiv = itemBox.querySelector('.mt-1');
  1876. const secondDiv = itemBox.querySelector('.mt-2');
  1877.  
  1878. // Clear existing content from the firstDiv and create a new structure
  1879. firstDiv.innerHTML = `
  1880. <div class="center mt-1" style="
  1881. height: 100px;
  1882. ">
  1883. <div>
  1884. <span style="display: inline-flex;flex-direction: column;position: relative;bottom: 20px;width: 30%;">
  1885. <span id="fight-guardians-itemxbox-large-green_gaurdian_key" style="background-color: rgb(0, 0, 0, 0.5); padding: 2px;">
  1886. <img class="w25" src="https://d1xsc8x7nc5q8t.cloudfront.net/images/green_gaurdian_key.png" title="green_gaurdian_key">
  1887. <item-display data-format="number" data-key="green_gaurdian_key">290</item-display>
  1888. </span>
  1889. <span id="fight-guardians-itemxbox-large-blue_gaurdian_key" style="background-color: rgba(0, 0, 0, 0.5); padding: 2px;">
  1890. <img class="w25" src="https://d1xsc8x7nc5q8t.cloudfront.net/images/blue_gaurdian_key.png" title="blue_gaurdian_key">
  1891. <item-display data-format="number" data-key="blue_gaurdian_key">430</item-display>
  1892. </span>
  1893. </span>
  1894. <img class="w50" src="https://d1xsc8x7nc5q8t.cloudfront.net/images/faradox_100.png" title="faradox_100" style="
  1895. height: 100%;
  1896. width: 36%;
  1897. ">
  1898. <span style="display: inline-flex;flex-direction: column;position: relative;bottom: 20px;width: 30%;">
  1899. <span id="fight-guardians-itemxbox-large-purple_gaurdian_key" style="background-color: rgba(0, 0, 0, 0.5); padding: 2px;">
  1900. <img class="w25" src="https://d1xsc8x7nc5q8t.cloudfront.net/images/purple_gaurdian_key.png" title="purple_gaurdian_key">
  1901. <item-display data-format="number" data-key="purple_gaurdian_key">33</item-display>
  1902. </span>
  1903. <span id="fight-guardians-itemxbox-large-mixed_gaurdian_key" style="background-color: rgba(0, 0, 0, 0.5); padding: 2px;">
  1904. <img class="w25" src="https://d1xsc8x7nc5q8t.cloudfront.net/images/mixed_gaurdian_key.png" title="mixed_gaurdian_key">
  1905. <item-display data-format="number" data-key="mixed_gaurdian_key">19</item-display>
  1906. </span>
  1907. </span>
  1908. </div></div>
  1909. `;
  1910.  
  1911. // Modify the second div
  1912. secondDiv.textContent = '';
  1913. },
  1914.  
  1915. recolorTableText: function () {
  1916. document.querySelectorAll(".p-2.color-grey.font-small").forEach((cell) => { cell.style.color = "black"; cell.style.fontSize = "1em";})
  1917. document.querySelectorAll(".font-small.color-grey").forEach((cell) => { cell.style.color = "black"; cell.style.fontSize = "1em";})
  1918. },
  1919.  
  1920. fixAchiLabels: function () {
  1921. Achievements.refresh_achievement_area = function (skill, difficulty) {
  1922. var html = "";
  1923.  
  1924. html += "<button onclick='switch_panels(\"panel-achievements\")'>Go Back</button>"
  1925. html += "<h1 class='center'>" + skill.toUpperCase() + " <span class='color-grey'>("+difficulty.toUpperCase()+")</span></h1>";
  1926.  
  1927. html += "<center>";
  1928. for(var entry of Achievements._get_dict(skill, difficulty))
  1929. {
  1930. html += "<div class='achievement-entry mt-3 shadow' style='color: black !important'>";
  1931. html += entry.description
  1932. if(Items.getItem("ach_"+difficulty+"_"+entry.slug) == 1)
  1933. html += "<span class='float-end color-green'>Complete</span>";
  1934. else
  1935. html += "<span class='float-end color-red'>Incomplete</span>";
  1936. html += "</div>";
  1937. }
  1938.  
  1939. html += "<br />";
  1940. html += "<br />";
  1941. html += "<hr />";
  1942. html += "<br />";
  1943. html += "<h2 class='center'>ACHIEVEMENT PERK</h2>";
  1944. html += "<h5 class='center color-grey'>Complete all the achievements in this section for the achievement perk.</h5>";
  1945. html += "<div class='achievement-entry achievement-entry-reward mt-3 shadow' style='color: black !important'>";
  1946. html += Achievements._get_reward_text(skill, difficulty);
  1947. if(Achievements.has_completed_set(skill, difficulty))
  1948. html += "<span class='float-end color-green'>ACTIVE</span>";
  1949. else
  1950. html += "<span class='float-end color-red'>INACTIVE</span>";
  1951. html += "</div>";
  1952. html += "</center>";
  1953.  
  1954. document.getElementById("achievements-area").innerHTML = html;
  1955. document.getElementById("achievements-buttons").style.display = "none";
  1956. }
  1957. },
  1958. replaceLinks: function(message) {
  1959. return anchorme({
  1960. input: message,
  1961. options: {
  1962. attributes: {
  1963. target: "_blank"
  1964. }
  1965. }
  1966. }).replace(/<a(.*?)href="(.+?)">(.*?)<\/a>(-*)/g, '<a$1href="$2$4">$3$4</a>');
  1967. }
  1968. };
  1969. };
  1970.  
  1971. const uitRaids = function () {
  1972. window.uitSoloRaiding = false;
  1973. return {
  1974. initElements: function () {
  1975. var optionsContainer = document.createElement('div');
  1976. optionsContainer.id = 'raid-options-container';
  1977. optionsContainer.style.marginBottom = '10px'
  1978.  
  1979. var raidLocationDropdown = document.createElement('select');
  1980. raidLocationDropdown.id = 'raid-location-dropdown';
  1981. raidLocationDropdown.className = 'raids-option-bar';
  1982. var locations = ['Toybox', 'Mansion'];
  1983. locations.forEach(function (location) {
  1984. var option = document.createElement('option');
  1985. option.value = location.toLowerCase();
  1986. option.text = location;
  1987. raidLocationDropdown.appendChild(option);
  1988. });
  1989.  
  1990. // Create the second dropdown for raid difficulty
  1991. var raidDifficultyDropdown = document.createElement('select');
  1992. raidDifficultyDropdown.id = 'raid-difficulty-dropdown';
  1993. raidDifficultyDropdown.className = 'raids-option-bar';
  1994. var difficulties = ['Practice', 'Normal', 'Hard'];
  1995. difficulties.forEach(function (difficulty) {
  1996. var option = document.createElement('option');
  1997. option.value = difficulty.toLowerCase();
  1998. option.text = difficulty;
  1999. raidDifficultyDropdown.appendChild(option);
  2000. });
  2001.  
  2002. // Create the third dropdown for Public/Private
  2003. var raidVisibilityDropdown = document.createElement('select');
  2004. raidVisibilityDropdown.id = 'raid-visibility-dropdown';
  2005. raidVisibilityDropdown.className = 'raids-option-bar';
  2006. var visibility = ['Public', 'Private']
  2007. visibility.forEach(function (vis) {
  2008. var option = document.createElement('option');
  2009. option.value = vis.toLowerCase();
  2010. option.text = vis;
  2011. raidVisibilityDropdown.appendChild(option);
  2012. });
  2013.  
  2014. let advertRaid = document.createElement('button');
  2015. advertRaid.id = 'raids-advert-button';
  2016. advertRaid.innerText = 'Advertise';
  2017. advertRaid.onclick = function () {
  2018. uitRaids().advertRaid();
  2019. this.disabled = true;
  2020. setTimeout(() => {
  2021. this.disabled = false;
  2022. }, 3000);
  2023. }
  2024. advertRaid.className = 'button raids-option-bar raids-buttons';
  2025. advertRaid.style.display = 'none';
  2026.  
  2027. let startRaid = document.createElement('button');
  2028. startRaid.id = 'raids-start-button';
  2029. startRaid.innerText = 'Start Raid';
  2030. startRaid.onclick = function () {
  2031. uitRaids().startRaid();
  2032. this.disabled = true;
  2033. setTimeout(() => {
  2034. this.disabled = false;
  2035. }, 30000);
  2036. }
  2037. startRaid.className = 'button raids-option-bar raids-buttons';
  2038. startRaid.style.display = 'none';
  2039.  
  2040. let soloRaid = document.createElement('input');
  2041. soloRaid.id = 'raids-solo-button';
  2042. soloRaid.className = 'raid-button';
  2043. soloRaid.value = 'Solo Raid';
  2044. soloRaid.type = 'button';
  2045.  
  2046.  
  2047. // Find the insertion point in the DOM
  2048. var insertionPoint = document.getElementById('raids-create-or-join-team-btns');
  2049.  
  2050. // Insert the dropdowns into the DOM before the specified element
  2051. optionsContainer.appendChild(raidLocationDropdown);
  2052. optionsContainer.appendChild(raidDifficultyDropdown);
  2053. optionsContainer.appendChild(raidVisibilityDropdown);
  2054. optionsContainer.appendChild(advertRaid);
  2055. optionsContainer.appendChild(startRaid);
  2056. insertionPoint.appendChild(soloRaid);
  2057. insertionPoint.parentNode.insertBefore(optionsContainer, insertionPoint);
  2058.  
  2059. document
  2060. .getElementById('raids-create-or-join-team-btns')
  2061. .innerHTML = document.getElementById('raids-create-or-join-team-btns')
  2062. .innerHTML.replace("Modals.raid_create_team_button()", "uitRaids().createRaid()");
  2063.  
  2064.  
  2065. document.getElementById('raids-solo-button').addEventListener('click', function() {
  2066. uitRaids().soloRaid();
  2067. });
  2068. const panel = document.getElementById('raids-team-panel');
  2069. panel.innerHTML = panel.innerHTML.replace(/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/g, '<br/>');
  2070. },
  2071. createRaid: function () {
  2072. let locationRaids = document.getElementById('raid-location-dropdown').value;
  2073. let modeRaids = document.getElementById('raid-difficulty-dropdown').value;
  2074. websocket.send(`CREATE_RAID_TEAM=0`);
  2075. document.getElementById('raids-start-button').style.display = 'inline-flex';
  2076. document.getElementById('raids-advert-button').style.display = 'inline-flex';
  2077. },
  2078. advertRaid: function () {
  2079. let locationRaids = document.getElementById('raid-location-dropdown').selectedOptions[0].text;
  2080. let modeRaids = document.getElementById('raid-difficulty-dropdown').selectedOptions[0].text;;
  2081. let raidPW = document.getElementById('raids-team-panel-uuid').innerText;
  2082. let users = ['user1', 'user2', 'user3', 'user4'];
  2083. let userCount = 0;
  2084. users.forEach((user) => {
  2085. if (!document.getElementById(`raids-team-panel-${user}`).innerHTML.includes('(none)')) {
  2086. userCount++;
  2087. }
  2088. })
  2089. let neededCount = 4 - userCount;
  2090.  
  2091. let fp = {
  2092. toybox: {
  2093. practice: "0 FP",
  2094. normal: "4k FP",
  2095. hard: "4k FP"
  2096. },
  2097. mansion: {
  2098. practice: "0 FP",
  2099. normal: "8k FP",
  2100. hard: "8k FP"
  2101. },
  2102. }
  2103.  
  2104. let energy = {
  2105. toybox: {
  2106. practice: "0 Energy",
  2107. normal: "10k Energy",
  2108. hard: "50k Energy"
  2109. },
  2110. mansion: {
  2111. practice: "0 Energy",
  2112. normal: "100k Energy",
  2113. hard: "250k Energy"
  2114. },
  2115. }
  2116.  
  2117. websocket.send(`CHAT=${raidPW} : [${locationRaids}] || [${modeRaids}] || [${fp[locationRaids.toLowerCase()][modeRaids.toLowerCase()]} & ${energy[locationRaids.toLowerCase()][modeRaids.toLowerCase()]}] || [${neededCount} Open Spots]`);
  2118. //console.log(`${raidPW} : [${locationRaids}] || [${modeRaids}] || [${fp[locationRaids.toLowerCase()][modeRaids.toLowerCase()]} & ${energy[locationRaids.toLowerCase()][modeRaids.toLowerCase()]}] || [${neededCount} Open Spots]`)
  2119. },
  2120. startRaid: function () {
  2121. let locationRaids = document.getElementById('raid-location-dropdown').value;
  2122. let modeRaids = document.getElementById('raid-difficulty-dropdown').value;
  2123. let locationMatch = {
  2124. toybox: 2,
  2125. mansion: 1,
  2126. };
  2127. let modeMatch = {
  2128. practice: 0,
  2129. normal: 1,
  2130. hard: 2
  2131. };
  2132.  
  2133. let locationValue = locationMatch[locationRaids];
  2134. let modeValue = modeMatch[modeRaids];
  2135. websocket.send(`START_RAID_${locationValue}=${modeValue}`);
  2136. },
  2137. soloRaid: function () {
  2138. let locationRaids = document.getElementById('raid-location-dropdown').value;
  2139. let modeRaids = document.getElementById('raid-difficulty-dropdown').value;
  2140. let locationMatch = {
  2141. toybox: 2,
  2142. mansion: 1,
  2143. };
  2144. let modeMatch = {
  2145. practice: 0,
  2146. normal: 1,
  2147. hard: 2
  2148. };
  2149.  
  2150. let locationValue = locationMatch[locationRaids];
  2151. let modeValue = modeMatch[modeRaids];
  2152. websocket.send(`START_RAID_${locationValue}=${modeValue}`);
  2153. uitSoloRaiding = true;
  2154. },
  2155. }
  2156. }
  2157.  
  2158. const uitHoliday = function () {
  2159. window.uitEaster = [
  2160. "chocolate_scythe",
  2161. "chocolate_skeleton_sword",
  2162. "chocolate_dagger",
  2163. "chocolate_stinger",
  2164. "chocolate_fish",
  2165. "chocolate_logs",
  2166. "chocolate_mushroom",
  2167. "chocolate_leaf",
  2168. "chocolate_bar",
  2169. "chocolate_ore"
  2170. ];
  2171. return {
  2172. easter2024: function () {
  2173. let certificateElement = document.querySelector("itembox[data-item=chocolate_certificate]");
  2174. if (certificateElement) {
  2175. certificateElement.setAttribute("data-item", "playtime");
  2176. uitEaster.forEach((item) => {
  2177. let element = document.querySelector(`itembox[data-item=${item}`);
  2178. element.setAttribute("data-item", "playtime");
  2179. certificateElement.insertAdjacentElement("afterEnd", element);
  2180. element.insertAdjacentHTML("beforebegin", `\n\n`)
  2181. let numElem = element.querySelector(`item-display[data-key=${item}`);
  2182. element.className = "itembox-fight shadow hover";
  2183. });
  2184. document.getElementById("panel-keyitems");
  2185. }
  2186. }
  2187. }
  2188. }
  2189.  
  2190. const uitDustPotions = function () {
  2191. window.dustPots = [
  2192. "cooks_dust",
  2193. "cooks_dust_potion",
  2194. "fighting_dust_potion",
  2195. "fighting_dust",
  2196. "tree_dust",
  2197. "tree_dust_potion",
  2198. "farm_dust",
  2199. "farm_dust_potion",
  2200. ];
  2201. return {
  2202. cloneDust: function () {
  2203. const brewing = document.getElementById("panel-brewing");
  2204. const cooking = document.getElementById("panel-cooking").querySelector("itembox[data-item=maggots]");
  2205. const fighting = document.getElementById("combat-badge-itembox");
  2206. const woodcut = document.getElementById("panel-woodcutting").querySelector("itembox[data-item=flexible_logs]");
  2207. const farming = document.getElementById("panel-farming").querySelector("itembox[data-item=bonemeal_bin]");
  2208.  
  2209. dustPots.forEach((item) => {
  2210. let moveMe = brewing.querySelector(`itembox[data-item=${item}]`).cloneNode(true);
  2211. if (item.startsWith("cooks")) {
  2212. cooking.insertAdjacentElement("beforebegin", moveMe);
  2213. moveMe.insertAdjacentHTML("afterend", `\n\n`);
  2214. }
  2215. if (item.startsWith("fighting")) {
  2216. fighting.insertAdjacentElement("beforebegin", moveMe);
  2217. moveMe.insertAdjacentHTML("afterend", `\n\n`);
  2218. }
  2219. if (item.startsWith("tree")) {
  2220. woodcut.insertAdjacentElement("beforebegin", moveMe);
  2221. moveMe.insertAdjacentHTML("afterend", `\n\n`);
  2222. }
  2223. if (item.startsWith("farm")) {
  2224. farming.insertAdjacentElement("beforebegin", moveMe);
  2225. moveMe.insertAdjacentHTML("afterend", `\n\n`);
  2226. }
  2227. });
  2228.  
  2229. }
  2230. }
  2231. }
  2232.  
  2233. // End New Base Code Re-work
  2234. // Window Calls for initializing
  2235. window.uitLevel = uitLevel;
  2236. window.uitPurpleKey = uitPurpleKey;
  2237. window.uitCriptoe = uitCriptoe;
  2238. window.uitTableLabels = uitTableLabels;
  2239. window.uitFishing = uitFishing;
  2240. window.uitInvention = uitInvention;
  2241. window.uitRocket = uitRocket;
  2242. window.uitMisc = uitMisc;
  2243. window.uitRaids = uitRaids;
  2244. window.uitHoliday = uitHoliday;
  2245.  
  2246. let onLoginLoaded = false;
  2247.  
  2248. // will be overwritten if data available in IdlePixelPlus.info
  2249. const SMELT_TIMES = {
  2250. copper: 3,
  2251. iron: 6,
  2252. silver: 15,
  2253. gold: 50,
  2254. promethium: 100,
  2255. titanium: 500,
  2256. ancient_ore: 1800,
  2257. dragon_ore: 3600,
  2258. };
  2259.  
  2260. const copperItemBox = document.querySelector("itembox[data-item=copper] img");
  2261.  
  2262. const FONTS = [];
  2263. const FONT_DEFAULT = "IdlePixel Default";
  2264. const FONT_FAMILY_DEFAULT = 'pixel, "Courier New", Courier, monospace';
  2265. (async () => {
  2266. const FONTS_CHECK = new Set(
  2267. [
  2268. // Windows 10
  2269. "Arial",
  2270. "Arial Black",
  2271. "Bahnschrift",
  2272. "Calibri",
  2273. "Cambria",
  2274. "Cambria Math",
  2275. "Candara",
  2276. "Comic Sans MS",
  2277. "Consolas",
  2278. "Constantia",
  2279. "Corbel",
  2280. "Courier New",
  2281. "Ebrima",
  2282. "Franklin Gothic Medium",
  2283. "Gabriola",
  2284. "Gadugi",
  2285. "Georgia",
  2286. "HoloLens MDL2 Assets",
  2287. "Impact",
  2288. "Ink Free",
  2289. "Javanese Text",
  2290. "Leelawadee UI",
  2291. "Lucida Console",
  2292. "Lucida Sans Unicode",
  2293. "Malgun Gothic",
  2294. "Marlett",
  2295. "Microsoft Himalaya",
  2296. "Microsoft JhengHei",
  2297. "Microsoft New Tai Lue",
  2298. "Microsoft PhagsPa",
  2299. "Microsoft Sans Serif",
  2300. "Microsoft Tai Le",
  2301. "Microsoft YaHei",
  2302. "Microsoft Yi Baiti",
  2303. "MingLiU-ExtB",
  2304. "Mongolian Baiti",
  2305. "MS Gothic",
  2306. "MV Boli",
  2307. "Myanmar Text",
  2308. "Nirmala UI",
  2309. "Palatino Linotype",
  2310. "Segoe MDL2 Assets",
  2311. "Segoe Print",
  2312. "Segoe Script",
  2313. "Segoe UI",
  2314. "Segoe UI Historic",
  2315. "Segoe UI Emoji",
  2316. "Segoe UI Symbol",
  2317. "SimSun",
  2318. "Sitka",
  2319. "Sylfaen",
  2320. "Symbol",
  2321. "Tahoma",
  2322. "Times New Roman",
  2323. "Trebuchet MS",
  2324. "Verdana",
  2325. "Webdings",
  2326. "Wingdings",
  2327. "Yu Gothic",
  2328. // macOS
  2329. "American Typewriter",
  2330. "Andale Mono",
  2331. "Arial",
  2332. "Arial Black",
  2333. "Arial Narrow",
  2334. "Arial Rounded MT Bold",
  2335. "Arial Unicode MS",
  2336. "Avenir",
  2337. "Avenir Next",
  2338. "Avenir Next Condensed",
  2339. "Baskerville",
  2340. "Big Caslon",
  2341. "Bodoni 72",
  2342. "Bodoni 72 Oldstyle",
  2343. "Bodoni 72 Smallcaps",
  2344. "Bradley Hand",
  2345. "Brush Script MT",
  2346. "Chalkboard",
  2347. "Chalkboard SE",
  2348. "Chalkduster",
  2349. "Charter",
  2350. "Cochin",
  2351. "Comic Sans MS",
  2352. "Copperplate",
  2353. "Courier",
  2354. "Courier New",
  2355. "Didot",
  2356. "DIN Alternate",
  2357. "DIN Condensed",
  2358. "Futura",
  2359. "Geneva",
  2360. "Georgia",
  2361. "Gill Sans",
  2362. "Helvetica",
  2363. "Helvetica Neue",
  2364. "Herculanum",
  2365. "Hoefler Text",
  2366. "Impact",
  2367. "Lucida Grande",
  2368. "Luminari",
  2369. "Marker Felt",
  2370. "Menlo",
  2371. "Microsoft Sans Serif",
  2372. "Monaco",
  2373. "Noteworthy",
  2374. "Optima",
  2375. "Palatino",
  2376. "Papyrus",
  2377. "Phosphate",
  2378. "Rockwell",
  2379. "Savoye LET",
  2380. "SignPainter",
  2381. "Skia",
  2382. "Snell Roundhand",
  2383. "Tahoma",
  2384. "Times",
  2385. "Times New Roman",
  2386. "Trattatello",
  2387. "Trebuchet MS",
  2388. "Verdana",
  2389. "Zapfino",
  2390. // other
  2391. "Helvetica",
  2392. "Garamond",
  2393. ].sort()
  2394. );
  2395. await document.fonts.ready;
  2396. for (const font of FONTS_CHECK.values()) {
  2397. if (document.fonts.check(`12px "${font}"`)) {
  2398. FONTS.push(font);
  2399. }
  2400. }
  2401. FONTS.unshift("IdlePixel Default");
  2402. })();
  2403.  
  2404. const BG_COLORS = {
  2405. "#chat-area .server_message": "",
  2406. body: "rgb(200, 247, 248)",
  2407. ".top-bar": getComputedStyle(document.querySelector(".game-top-bar-upper"))
  2408. .backgroundColor,
  2409. "#menu-bar": getComputedStyle(document.querySelector("#menu-bar"))
  2410. .backgroundColor,
  2411. "#chat-area": getComputedStyle(document.querySelector("#chat-area"))
  2412. .backgroundColor,
  2413. "#game-chat": getComputedStyle(document.querySelector("#game-chat"))
  2414. .backgroundColor,
  2415. "#panels": getComputedStyle(document.querySelector("#panels"))
  2416. .backgroundColor,
  2417. };
  2418.  
  2419. const FONT_COLORS = {
  2420. "#chat-area .server_message": "",
  2421. "#chat-area": document.querySelector("#chat-area")
  2422. ? getComputedStyle(document.querySelector("#chat-area")).color
  2423. : "",
  2424. "#chat-area .color-green": document.querySelector("#chat-area .color-green")
  2425. ? getComputedStyle(document.querySelector("#chat-area .color-green"))
  2426. .color
  2427. : "",
  2428. "#chat-area .color-grey": document.querySelector("#chat-area .color-grey")
  2429. ? getComputedStyle(document.querySelector("#chat-area .color-grey")).color
  2430. : "",
  2431. "#chat-area .chat-username": document.querySelector(
  2432. "#chat-area .chat-username"
  2433. )
  2434. ? getComputedStyle(document.querySelector("#chat-area .chat-username"))
  2435. .color
  2436. : "",
  2437. "#panels": document.querySelector("#panels")
  2438. ? getComputedStyle(document.querySelector("#panels")).color
  2439. : "",
  2440. "#panels .color-grey": document.querySelector("#panels .color-grey")
  2441. ? getComputedStyle(document.querySelector("#panels .color-grey")).color
  2442. : "",
  2443. "#panels .font-large": document.querySelector("#panels .font-large")
  2444. ? getComputedStyle(document.querySelector("#panels .font-large")).color
  2445. : "",
  2446. "#menu-bar-button .color-grey": document.querySelector(
  2447. "#panels .color-grey"
  2448. )
  2449. ? getComputedStyle(document.querySelector("#panels .color-grey")).color
  2450. : "",
  2451. };
  2452.  
  2453. const CHAT_UPDATE_FILTER = [
  2454. "#chat-area",
  2455. "#chat-area .color-green",
  2456. "#chat-area .color-grey",
  2457. "#chat-area .chat-username",
  2458. "#chat-area .server_message",
  2459. ];
  2460.  
  2461. const PANEL_UPDATE_FILTER = ["#panels"];
  2462.  
  2463. let condensedLoaded = false;
  2464.  
  2465. class UITweaksPlugin extends IdlePixelPlusPlugin {
  2466. constructor() {
  2467. super("ui-tweaks", {
  2468. about: {
  2469. name: GM_info.script.name + " (ver: " + GM_info.script.version + ")",
  2470. version: GM_info.script.version,
  2471. author: GM_info.script.author,
  2472. description: GM_info.script.description
  2473. },
  2474. config: [
  2475. {
  2476. label:
  2477. "------------------------------------------------<br/>Chat/Images<br/>------------------------------------------------",
  2478. type: "label",
  2479. },
  2480. {
  2481. id: "font",
  2482. label: "Primary Font",
  2483. type: "select",
  2484. options: FONTS,
  2485. default: FONT_DEFAULT,
  2486. },
  2487. {
  2488. id: "sideChat",
  2489. label: "Side Chat",
  2490. type: "boolean",
  2491. default: false,
  2492. },
  2493. {
  2494. id: "condensedUI",
  2495. label: "Enable Condensed UI and Left Bar Tweaks",
  2496. type: "boolean",
  2497. default: true,
  2498. },
  2499. /*{
  2500. id: "pinChat",
  2501. label: "Pin Chat on Side (Only works if Side Chat is active. Thanks BanBan)",
  2502. type: "boolean",
  2503. default: false
  2504. },*/
  2505. {
  2506. id: "chatLimit",
  2507. label: "Chat Message Limit (&leq; 0 means no limit)",
  2508. type: "int",
  2509. min: -1,
  2510. max: 5000,
  2511. default: 0,
  2512. },
  2513. {
  2514. id: "combatChat",
  2515. label: "Enable Chat to be visible while in combat.",
  2516. type: "boolean",
  2517. default: true
  2518. },
  2519. {
  2520. id: "convertNameLink",
  2521. label: "Enable alternate links when clicking player name in chat.",
  2522. type: "boolean",
  2523. default: true,
  2524. },
  2525. {
  2526. id: "imageTitles",
  2527. label: "Image Mouseover",
  2528. type: "boolean",
  2529. default: true,
  2530. },
  2531. {
  2532. id: "tableLabels",
  2533. label:
  2534. "Turn on item component labels for crafting/brewing/invention<br/>May require restart to disable",
  2535. type: "boolean",
  2536. default: true,
  2537. },
  2538. {
  2539. id: "scrollingNotifications",
  2540. label: "Turn on making the notifications area scrollable at the top of the screen<br/>Will set a standard size and stop screen movement as notifications are added and removed.",
  2541. type: "boolean",
  2542. default: false,
  2543. },
  2544. {
  2545. id: "lowerToast",
  2546. label: "Lower Toast (top-right popup)",
  2547. type: "boolean",
  2548. default: false,
  2549. },
  2550. {
  2551. label:
  2552. "------------------------------------------------<br/>Combat<br/>------------------------------------------------",
  2553. type: "label",
  2554. },
  2555. {
  2556. id: "fightPointsStats",
  2557. label: "Fight Points in Left Menu",
  2558. type: "boolean",
  2559. default: true,
  2560. },
  2561. {
  2562. id: "combatInfoSideSelect",
  2563. label:
  2564. "Choose which side you want to see the<br/>Fight Points / Rare Pot Duration / Loot Pot info on.<br/>Left (Player info) || Right (Enemy Info)",
  2565. type: "select",
  2566. default: "left",
  2567. options: [
  2568. { value: "left", label: "Left - Player Side" },
  2569. { value: "right", label: "Right - Enemy Side" },
  2570. ],
  2571. },
  2572. {
  2573. label:
  2574. "------------------------------------------------<br/>Condensed Information<br/>------------------------------------------------",
  2575. type: "label",
  2576. },
  2577. {
  2578. id: "condenseWoodcuttingPatches",
  2579. label: "Condensed Woodcutting Patches",
  2580. type: "boolean",
  2581. default: false,
  2582. },
  2583. {
  2584. id: "condenseFarmingPatches",
  2585. label: "Condensed Farming Patches",
  2586. type: "boolean",
  2587. default: false,
  2588. },
  2589. {
  2590. id: "condenseGatheringBoxes",
  2591. label: "Condensed Gathering Boxes",
  2592. type: "boolean",
  2593. default: false,
  2594. },
  2595. {
  2596. label:
  2597. "------------------------------------------------<br/>Fishing<br/>------------------------------------------------",
  2598. type: "label",
  2599. },
  2600. {
  2601. id: "heatInFishingTab",
  2602. label: "Heat In Fishing Tab",
  2603. type: "boolean",
  2604. default: true,
  2605. },
  2606. {
  2607. id: "minusOneHeatInFishingTab",
  2608. label: "Heat In Fishing Tab (Minus 1 for collectors)",
  2609. type: "boolean",
  2610. default: true,
  2611. },
  2612. {
  2613. id: "hideAquarium",
  2614. label: "Hide the notification for Aquarium needing to be fed",
  2615. type: "boolean",
  2616. default: false,
  2617. },
  2618. {
  2619. id: "hideBoat",
  2620. label: "Hide the notification for Boats (Timer and Collect)",
  2621. type: "boolean",
  2622. default: false,
  2623. },
  2624. {
  2625. label:
  2626. "------------------------------------------------<br/>Invention<br/>------------------------------------------------",
  2627. type: "label",
  2628. },
  2629. {
  2630. id: "hideOrbRing",
  2631. label: "Hide crafted glass orbs and master ring in invention",
  2632. type: "boolean",
  2633. default: false,
  2634. },
  2635. {
  2636. label:
  2637. "------------------------------------------------<br/>Misc<br/>------------------------------------------------",
  2638. type: "label",
  2639. },
  2640. {
  2641. id: "robotReady",
  2642. label: "Show Robot Ready",
  2643. type: "boolean",
  2644. default: true,
  2645. },
  2646. {
  2647. id: "moveSDWatch",
  2648. label: "Move Stardust Watch notifications to left side pannel",
  2649. type: "boolean",
  2650. default: true,
  2651. },
  2652. {
  2653. id: "showHeat",
  2654. label: "Show heat on left side pannel",
  2655. type: "boolean",
  2656. default: true,
  2657. },
  2658. {
  2659. id: "showPurpleKeyNotification",
  2660. label: "Show quick button notification for purple key",
  2661. type: "boolean",
  2662. default: true,
  2663. },
  2664. {
  2665. id: "hideCrystalBall",
  2666. label: "Hide the notification for crystal ball",
  2667. type: "boolean",
  2668. default: false,
  2669. },
  2670. {
  2671. id: "merchantReady",
  2672. label: "Show Merchant Ready notification",
  2673. type: "boolean",
  2674. default: true,
  2675. },
  2676. {
  2677. id: "mixerTimer",
  2678. label: "Show Brewing Mixer timer and charges available",
  2679. type: "boolean",
  2680. default: true,
  2681. },
  2682. {
  2683. label:
  2684. "------------------------------------------------<br/>Oil<br/>------------------------------------------------",
  2685. type: "label",
  2686. },
  2687. {
  2688. id: "oilSummaryMining",
  2689. label: "Oil Summary, Mining Panel",
  2690. type: "boolean",
  2691. default: true,
  2692. },
  2693. {
  2694. id: "oilSummaryCrafting",
  2695. label: "Oil Summary, Crafting Panel",
  2696. type: "boolean",
  2697. default: true,
  2698. },
  2699. {
  2700. id: "oilFullNotification",
  2701. label: "Oil Full",
  2702. type: "boolean",
  2703. default: true,
  2704. },
  2705. {
  2706. id: "oilGainNotification",
  2707. label: "Oil Gain Timer",
  2708. type: "boolean",
  2709. default: true,
  2710. },
  2711. {
  2712. label:
  2713. "------------------------------------------------<br/>Rocket<br/>------------------------------------------------",
  2714. type: "label",
  2715. },
  2716. {
  2717. id: "rocketETATimer",
  2718. label: "Rocket Notification ETA",
  2719. type: "boolean",
  2720. default: true,
  2721. },
  2722. {
  2723. id: "leftSideRocketInfoSection",
  2724. label:
  2725. "Enable moving of rocket information to left side (hides notifications)",
  2726. type: "boolean",
  2727. default: true,
  2728. },
  2729. {
  2730. id: "leftSideRocketInfo",
  2731. label:
  2732. "Enable Rocket Distance/Travel Time on left side (hides rocket notification)",
  2733. type: "boolean",
  2734. default: true,
  2735. },
  2736. {
  2737. id: "leftSideRocketFuel",
  2738. label: "Enable Rocket Fuel Info on left side.",
  2739. type: "boolean",
  2740. default: true,
  2741. },
  2742. {
  2743. id: "leftSideRocketPot",
  2744. label:
  2745. "Enable Rocket Pot Info on left side. (hides rocket pot notification)",
  2746. type: "boolean",
  2747. default: true,
  2748. },
  2749. {
  2750. id: "hideRocketKM",
  2751. label: "Rocket Notification Hide KM",
  2752. type: "boolean",
  2753. default: false,
  2754. },
  2755. {
  2756. id: "goodMoon",
  2757. label:
  2758. "Good moon distance<br/>(Range: 250,000 - 450,000)<br/>Type entire number without ','",
  2759. type: "int",
  2760. default: 300000,
  2761. },
  2762. {
  2763. id: "goodSun",
  2764. label:
  2765. "Good sun distance<br/>(Range: 100,000,000 - 200,000,000)<br/>Type entire number without ','",
  2766. type: "int",
  2767. default: 130000000,
  2768. },
  2769. {
  2770. label:
  2771. "------------------------------------------------<br/>Smelting/Mining<br/>------------------------------------------------",
  2772. type: "label",
  2773. },
  2774. {
  2775. id: "miningMachineArrows",
  2776. label: "Mining Machine Arrows",
  2777. type: "boolean",
  2778. default: true,
  2779. },
  2780. {
  2781. id: "smeltingNotificationTimer",
  2782. label: "Smelting Notification Timer",
  2783. type: "boolean",
  2784. default: true,
  2785. },
  2786. {
  2787. id: "furnaceEmptyNotification",
  2788. label: "Furnace Empty Notification",
  2789. type: "boolean",
  2790. default: true,
  2791. },
  2792. {
  2793. id: "hideDrillNotifications",
  2794. label: "Hide Active Mining Machine Notifications on top bar",
  2795. type: "boolean",
  2796. default: false,
  2797. },
  2798. {
  2799. label:
  2800. "------------------------------------------------<br/>BG Color Overrides<br/>------------------------------------------------",
  2801. type: "label",
  2802. },
  2803. {
  2804. id: "disableBGColorOverrides",
  2805. label:
  2806. "Disable background color overrides (Check = disabled)<br/>Disable the BG Color Overrides if you are wanting to use<br/>the built in settings for the game for your colors<br/>REFRESH REQUIRED WHEN DISABLING THE BG COLORS<br/>",
  2807. type: "boolean",
  2808. default: false,
  2809. },
  2810. {
  2811. id: "color-enabled-body",
  2812. label: "Main Background: Enabled",
  2813. type: "boolean",
  2814. default: false,
  2815. },
  2816. {
  2817. id: "color-body",
  2818. label: "Main Background: Color",
  2819. type: "color",
  2820. default: BG_COLORS["body"],
  2821. },
  2822. {
  2823. id: "color-enabled-panels",
  2824. label: "Panel Background: Enabled",
  2825. type: "boolean",
  2826. default: false,
  2827. },
  2828. {
  2829. id: "color-panels",
  2830. label: "Panel Background: Color",
  2831. type: "color",
  2832. default: BG_COLORS["#panels"],
  2833. },
  2834. {
  2835. id: "color-enabled-top-bar",
  2836. label: "Top Background: Enabled",
  2837. type: "boolean",
  2838. default: false,
  2839. },
  2840. {
  2841. id: "color-top-bar",
  2842. label: "Top Background: Color",
  2843. type: "color",
  2844. default: BG_COLORS[".top-bar"],
  2845. },
  2846. {
  2847. id: "color-enabled-menu-bar",
  2848. label: "Menu Background: Enabled",
  2849. type: "boolean",
  2850. default: false,
  2851. },
  2852. {
  2853. id: "color-menu-bar",
  2854. label: "Menu Background: Color",
  2855. type: "color",
  2856. default: BG_COLORS["#menu-bar"],
  2857. },
  2858. {
  2859. id: "color-enabled-chat-area",
  2860. label: "Inner Chat BG: Enabled",
  2861. type: "boolean",
  2862. default: false,
  2863. },
  2864. {
  2865. id: "color-chat-area",
  2866. label: "Inner Chat BG: Color",
  2867. type: "color",
  2868. default: BG_COLORS["#chat-area"],
  2869. },
  2870. {
  2871. id: "color-enabled-game-chat",
  2872. label: "Outer Chat BG: Enabled",
  2873. type: "boolean",
  2874. default: false,
  2875. },
  2876. {
  2877. id: "color-game-chat",
  2878. label: "Outer Chat BG: Color",
  2879. type: "color",
  2880. default: BG_COLORS["#game-chat"],
  2881. },
  2882. {
  2883. id: "color-enabled-chat-area-server_message",
  2884. label: "Server Message Tag: Enabled",
  2885. type: "boolean",
  2886. default: false,
  2887. },
  2888. {
  2889. id: "color-chat-area-server_message",
  2890. label: "Server Message Tag: Color",
  2891. type: "color",
  2892. default: BG_COLORS["#chat-area .server_message"],
  2893. },
  2894. {
  2895. label: "Text Color Overrides",
  2896. type: "label",
  2897. },
  2898. {
  2899. id: "font-color-enabled-chat-area",
  2900. label: "Chat Text: Enabled",
  2901. type: "boolean",
  2902. default: false,
  2903. },
  2904. {
  2905. id: "font-color-chat-area",
  2906. label: "Chat Text: Color",
  2907. type: "color",
  2908. default: FONT_COLORS["#chat-area"],
  2909. },
  2910. {
  2911. id: "font-color-enabled-chat-area-color-green",
  2912. label: "Chat Timestamp: Enabled",
  2913. type: "boolean",
  2914. default: false,
  2915. },
  2916. {
  2917. id: "font-color-chat-area-color-green",
  2918. label: "Chat Timestamp: Color",
  2919. type: "color",
  2920. default: FONT_COLORS["#chat-area .color-green"]
  2921. },
  2922. {
  2923. id: "font-color-enabled-chat-area-chat-username",
  2924. label: "Chat Username: Enabled",
  2925. type: "boolean",
  2926. default: false
  2927. },
  2928. {
  2929. id: "font-color-chat-area-chat-username",
  2930. label: "Chat Username: Color",
  2931. type: "color",
  2932. default: FONT_COLORS["#chat-area .chat-username"]
  2933. },
  2934. {
  2935. id: "font-color-enabled-chat-area-color-grey",
  2936. label: "Chat Level: Enabled",
  2937. type: "boolean",
  2938. default: false
  2939. },
  2940. {
  2941. id: "font-color-chat-area-color-grey",
  2942. label: "Chat Level: Color",
  2943. type: "color",
  2944. default: FONT_COLORS["#chat-area .color-grey"]
  2945. },
  2946.  
  2947.  
  2948.  
  2949. {
  2950. id: "font-color-chat-area-chat-raid-password",
  2951. label: "Raid Password Link Text: Color",
  2952. type: "color",
  2953. default: "#c5baba",
  2954. },
  2955. {
  2956. id: "background-color-chat-area-raid-password",
  2957. label: "Raid Password Link Background: Color",
  2958. type: "color",
  2959. default: "darkred"
  2960. },
  2961. {
  2962. id: "font-color-enabled-chat-area-server_message",
  2963. label: "Server Message Tag: Enabled",
  2964. type: "boolean",
  2965. default: false,
  2966. },
  2967. {
  2968. id: "font-color-chat-area-server_message",
  2969. label: "Server Message Tag: Color",
  2970. type: "color",
  2971. default: FONT_COLORS["#chat-area .server_message"]
  2972. },
  2973. {
  2974. id: "serverMessageTextOverrideEnabled",
  2975. label: "Server Message Text: Enabled",
  2976. type: "boolean",
  2977. default: false,
  2978. },
  2979. {
  2980. id: "serverMessageTextOverrideColor",
  2981. label: "Server Message Text: Color",
  2982. type: "color",
  2983. default: "blue"
  2984. },
  2985. {
  2986. id: "chatBorderOverrideColorEnabled",
  2987. label: "Chat Border Color: Enabled",
  2988. type: "boolean",
  2989. default: false,
  2990. },
  2991. {
  2992. id: "chatBorderOverrideColor",
  2993. label: "Chat Border Color: Color",
  2994. type: "color",
  2995. default: "blue"
  2996. },
  2997. {
  2998. id: "font-color-enabled-panels",
  2999. label: "Panels 1: Enabled",
  3000. type: "boolean",
  3001. default: false,
  3002. },
  3003. {
  3004. id: "font-color-panels",
  3005. label: "Panels 1: Color",
  3006. type: "color",
  3007. default: FONT_COLORS["#chat-area"]
  3008. },
  3009. {
  3010. id: "font-color-enabled-panels-color-grey",
  3011. label: "Panels 2: Enabled",
  3012. type: "boolean",
  3013. default: false,
  3014. },
  3015. {
  3016. id: "font-color-panels-color-grey",
  3017. label: "Panels 2: Color",
  3018. type: "color",
  3019. default: FONT_COLORS["#chat-area .color-grey"]
  3020. },
  3021. {
  3022. id: "font-color-enabled-panels-font-large",
  3023. label: "Skill Level Color: Enabled",
  3024. type: "boolean",
  3025. default: false,
  3026. },
  3027. {
  3028. id: "font-color-panels-font-large",
  3029. label: "Skill Level: Color",
  3030. type: "color",
  3031. default: FONT_COLORS["#panels .font-large"]
  3032. }
  3033. ]
  3034. })
  3035. }
  3036.  
  3037. condensedUI() {
  3038. let leftbar = document.getElementById("menu-bar-buttons");
  3039.  
  3040. let styleElement = document.getElementById("condensed-ui-tweaks");
  3041.  
  3042. if (styleElement) {
  3043. styleElement.parentNode.removeChild(styleElement);
  3044. }
  3045. document
  3046. .getElementById("menu-bar-buttons")
  3047. .querySelectorAll(".font-small")
  3048. .forEach(function (smallFont) {
  3049. let classInfo = smallFont.className.replaceAll(
  3050. "font-small",
  3051. "font-medium"
  3052. );
  3053. smallFont.className = classInfo;
  3054. });
  3055.  
  3056. var spans = document.querySelectorAll(
  3057. "#menu-bar-cooking-table-btn-wrapper span"
  3058. );
  3059.  
  3060. var cookingSpan = Array.from(spans).find(
  3061. (span) => span.textContent === "COOKING"
  3062. );
  3063.  
  3064. if (cookingSpan) {
  3065. cookingSpan.className = "font-medium color-white";
  3066. }
  3067.  
  3068. leftbar.querySelectorAll("img").forEach(function (img) {
  3069. img.className = "w20";
  3070. });
  3071.  
  3072. setTimeout(function () {
  3073. document.getElementById(
  3074. "market-sidecar"
  3075. ).parentNode.parentNode.style.paddingLeft = "20px";
  3076. document.getElementById(
  3077. "market-sidecar"
  3078. ).parentNode.parentNode.style.padding = "";
  3079. }, 1000);
  3080. document.getElementById("left-menu-bar-labels").style.paddingBottom =
  3081. "10px !important";
  3082. }
  3083.  
  3084. defaultUI() {
  3085. var styleElement = document.getElementById("condensed-ui-tweaks");
  3086.  
  3087. if (styleElement) {
  3088. styleElement.parentNode.removeChild(styleElement);
  3089. }
  3090. }
  3091.  
  3092. miningMachTimer() {
  3093. const drillNotifications = getThis.getConfig("hideDrillNotifications");
  3094.  
  3095. if (drillNotifications) {
  3096. document.getElementById("notification-drill").style.display = "none";
  3097. document.getElementById("notification-crusher").style.display = "none";
  3098. document.getElementById("notification-giant_drill").style.display = "none";
  3099. document.getElementById("notification-excavator").style.display = "none";
  3100. document.getElementById("notification-giant_excavator").style.display = "none";
  3101. document.getElementById("notification-massive_excavator").style.display = "none";
  3102. } else {
  3103. const drill = getVar("drill_on", 0, "int");
  3104. const crusher = getVar("crusher_on", 0, "int");
  3105. const giant_drill = getVar("giant_drill_on", 0, "int");
  3106. const excavator = getVar("excavator_on", 0, "int");
  3107. const giant_excavator = getVar("giant_excavator_on", 0, "int");
  3108. const massive_excavator = getVar("massive_excavator_on", 0, "int");
  3109.  
  3110. if (drill > 0) {
  3111. document.getElementById("notification-drill").style.display = "inline-block";
  3112. }
  3113. if (crusher > 0) {
  3114. document.getElementById("notification-crusher").style.display = "inline-block";
  3115. }
  3116. if (giant_drill > 0) {
  3117. document.getElementById("notification-giant_drill").style.display = "inline-block";
  3118. }
  3119. if (excavator > 0) {
  3120. document.getElementById("notification-excavator").style.display = "inline-block";
  3121. }
  3122. if (giant_excavator > 0) {
  3123. document.getElementById("notification-giant_excavator").style.display = "inline-block";
  3124. }
  3125. if (massive_excavator > 0) {
  3126. document.getElementById("notification-massive_excavator").style.display = "inline-block";
  3127. }
  3128. }
  3129. }
  3130.  
  3131. oilTimerNotification() {
  3132. const notifDiv = document.createElement("div");
  3133. notifDiv.id = "notification-oil_gain";
  3134. notifDiv.className = "notification hover";
  3135. notifDiv.style.marginRight = "4px";
  3136. notifDiv.style.marginBottom = "4px";
  3137. notifDiv.style.display = "none";
  3138.  
  3139. const elem = document.createElement("img");
  3140. elem.setAttribute("src", `${UIT_IMAGE_URL_BASE}oil.png`);
  3141. const notifIcon = elem;
  3142. notifIcon.className = "w20";
  3143.  
  3144. const notifDivLabel = document.createElement("span");
  3145. notifDivLabel.id = "notification-oil_gain-label";
  3146. notifDivLabel.innerText = " Loading";
  3147. notifDivLabel.className = "color-white";
  3148.  
  3149. notifDiv.appendChild(notifIcon);
  3150. notifDiv.appendChild(notifDivLabel);
  3151.  
  3152. const notificationFurnaceAvail = document.getElementById(
  3153. "notification-furnace_avail"
  3154. );
  3155. if (notificationFurnaceAvail) {
  3156. notificationFurnaceAvail.parentNode.insertBefore(
  3157. notifDiv,
  3158. notificationFurnaceAvail
  3159. );
  3160. notifDiv.style.display = "none";
  3161. }
  3162. }
  3163.  
  3164. oilGain() {
  3165. const notificationFurnaceAvail = document.getElementById(
  3166. "notification-furnace_avail"
  3167. );
  3168. const oilDelta = getVar("oil_delta", 0, "int");
  3169. const oil = getVar("oil", 0, "int");
  3170. const oilMax = getVar("max_oil", 0, "int");
  3171. const notificationOilGain = document.getElementById(
  3172. "notification-oil_gain"
  3173. );
  3174. const notificationOilGainLabel = document.getElementById(
  3175. "notification-oil_gain-label"
  3176. );
  3177.  
  3178. if (notificationOilGainLabel) {
  3179. if (getThis.getConfig("oilGainNotification")) {
  3180. if (oilDelta === 0) {
  3181. notificationOilGainLabel.textContent = " Balanced";
  3182. notificationOilGain.style.display = "inline-block";
  3183. } else if (oilDelta < 0) {
  3184. const oilNega = (oilMax - (oilMax - oil)) / -oilDelta;
  3185. const oilNegETA = format_time(oilNega);
  3186. notificationOilGainLabel.textContent =
  3187. " " + oilNegETA + " Until Empty";
  3188. notificationOilGain.style.display = "inline-block";
  3189. } else if (oilDelta > 0 && oil !== oilMax) {
  3190. const oilPosi = (oilMax - oil) / oilDelta;
  3191. const oilPosETA = format_time(oilPosi);
  3192. notificationOilGainLabel.textContent =
  3193. " " + oilPosETA + " Until Full";
  3194. notificationOilGain.style.display = "inline-block";
  3195. } else if (oilDelta > 0 && oil === oilMax) {
  3196. notificationOilGain.style.display = "none";
  3197. }
  3198. } else {
  3199. notificationOilGain.style.display = "none";
  3200. }
  3201. }
  3202. }
  3203.  
  3204. loot_pot_avail() {
  3205. const notifDiv = document.createElement("div");
  3206. notifDiv.id = `notification-loot_pot_avail`;
  3207. notifDiv.className = "notification hover";
  3208. notifDiv.style = "margin-right: 4px; margin-bottom: 4px; display: none";
  3209. notifDiv.style.display = "inline-block";
  3210.  
  3211. var elem = document.createElement("img");
  3212. elem.setAttribute("src", `${UIT_IMAGE_URL_BASE}combat_loot_potion.png`);
  3213. const notifIcon = elem;
  3214. notifIcon.className = "w20";
  3215.  
  3216. const notifDivLabel = document.createElement("span");
  3217. notifDivLabel.id = `notification-loot_pot_avail-label`;
  3218. notifDivLabel.innerText = " Loot Pot Active";
  3219. notifDivLabel.className = "color-white";
  3220.  
  3221. notifDiv.append(notifIcon, notifDivLabel);
  3222. document.querySelector("#notifications-area").append(notifDiv);
  3223. }
  3224.  
  3225. fightPointsFull() {
  3226. const max = getVar("max_fight_points", 0, "int");
  3227. const current = getVar("fight_points", 0, "int");
  3228. const remaining = max - current;
  3229. const remaining_time = format_time(remaining);
  3230.  
  3231. const fightPointsFullTimerMain = document.querySelector(
  3232. "#fight-points-full-id-menu"
  3233. );
  3234. const fightPointsFullTimerMain_2 = document.querySelector(
  3235. "#fight-points-full-id-menu_2"
  3236. );
  3237. const fightPointsFullTimerCombat = document.querySelector(
  3238. "#fight-points-full-id-combat"
  3239. );
  3240.  
  3241. if (remaining === 0) {
  3242. fightPointsFullTimerMain.textContent = "full";
  3243. fightPointsFullTimerCombat.textContent = "full";
  3244. } else {
  3245. var masterRingEquip = getVar("master_ring_equipped", 0, "int");
  3246. if (masterRingEquip === 1) {
  3247. fightPointsFullTimerMain.textContent = format_time(remaining / 2);
  3248. fightPointsFullTimerMain_2.textContent = format_time(remaining / 2);
  3249. fightPointsFullTimerCombat.textContent = format_time(remaining / 2);
  3250. } else {
  3251. fightPointsFullTimerMain.textContent = remaining_time;
  3252. fightPointsFullTimerMain_2.textContent = remaining_time;
  3253. fightPointsFullTimerCombat.textContent = remaining_time;
  3254. }
  3255. }
  3256. }
  3257.  
  3258. //Zlef Code Start
  3259. addChatDisplayWatcher() {
  3260. const chatElement = document.getElementById('game-chat');
  3261. const panelRaidTeam = document.getElementById('raids-team-panel');
  3262. if (!chatElement) {
  3263. console.log('Chat element not found.');
  3264. return;
  3265. }
  3266.  
  3267. const observer = new MutationObserver((mutations) => {
  3268. mutations.forEach((mutation) => {
  3269. if (mutation.attributeName === 'style' && chatElement.style.display === 'none' && IdlePixelPlus.plugins['ui-tweaks'].getConfig("combatChat")) {
  3270. chatElement.style.display = 'block'; // Force chat to be visible
  3271. } else if (mutation.attributeName === 'style' && panelRaidTeam.style.display === 'none') {
  3272. document.getElementById('raids-advert-button').style.display = 'none';
  3273. document.getElementById('raids-start-button').style.display = 'none';
  3274. }
  3275. });
  3276. });
  3277.  
  3278. observer.observe(chatElement, { attributes: true, attributeFilter: ['style'] });
  3279. observer.observe(panelRaidTeam, { attributes: true, attributeFilter: ['style'] });
  3280. //Initiator in onLogin
  3281. }
  3282. //Zlef Code End
  3283.  
  3284. //////////////////////////////// updateColors Start ////////////////////////////////
  3285. updateColors(filter) {
  3286. const bgColorCheck = getThis.getConfig("disableBGColorOverrides");
  3287.  
  3288. if (!bgColorCheck) {
  3289. Object.keys(BG_COLORS).forEach((selector) => {
  3290. if (!filter || filter.includes(selector)) {
  3291. const key = selector.replace(/[#\.]/g, "").replace(/-?\s+-?/, "-");
  3292. const enabled = getThis.getConfig(`color-enabled-${key}`);
  3293. const color = enabled
  3294. ? getThis.getConfig(`color-${key}`)
  3295. : BG_COLORS[selector];
  3296. const selected = document.querySelectorAll(selector);
  3297.  
  3298. for (const element of selected) {
  3299. element.style.backgroundColor = color;
  3300. }
  3301. }
  3302. });
  3303.  
  3304. Object.keys(FONT_COLORS).forEach((selector) => {
  3305. if (!filter || filter.includes(selector)) {
  3306. const key = selector.replace(/[#\.]/g, "").replace(/-?\s+-?/, "-");
  3307. const enabled = getThis.getConfig(`font-color-enabled-${key}`);
  3308. const color = enabled
  3309. ? getThis.getConfig(`font-color-${key}`)
  3310. : FONT_COLORS[selector];
  3311. const selected = document.querySelectorAll(selector);
  3312.  
  3313. for (const element of selected) {
  3314. element.style.color = color;
  3315. }
  3316. }
  3317. });
  3318.  
  3319. const chatBorderOverrideColorEnabled = getThis.getConfig(
  3320. "chatBorderOverrideColorEnabled"
  3321. );
  3322. const chatBorderOverrideColor = getThis.getConfig(
  3323. "chatBorderOverrideColor"
  3324. );
  3325. if (chatBorderOverrideColorEnabled) {
  3326. const chatElements = document.querySelectorAll("#game-chat.chat.m-3");
  3327. for (const element of chatElements) {
  3328. element.style.borderColor = chatBorderOverrideColor;
  3329. }
  3330. }
  3331.  
  3332. const serverMessageTextOverrideEnabled = getThis.getConfig(
  3333. "serverMessageTextOverrideEnabled"
  3334. );
  3335. const serverMessageTextOverrideColor = serverMessageTextOverrideEnabled
  3336. ? getThis.getConfig("serverMessageTextOverrideColor")
  3337. : "blue";
  3338. const serverMessageElements = document.querySelectorAll(
  3339. "#chat-area .server_message"
  3340. );
  3341. for (const element of serverMessageElements) {
  3342. element.parentElement.style.color = serverMessageTextOverrideColor;
  3343. }
  3344. }
  3345. const bodyClassUpdate = document
  3346. .getElementById("body")
  3347. .className.replaceAll("background-primary-gradient ", "");
  3348. document.getElementById("body").className = bodyClassUpdate;
  3349. }
  3350.  
  3351. //////////////////////////////// updateColors end ////////////////////////////////
  3352.  
  3353. //////////////////////////////// onConfigsChanged Start ////////////////////////////////
  3354. onConfigsChanged() {
  3355. if (onLoginLoaded) {
  3356. getThis.fightPointsFull();
  3357. getThis.miningMachTimer();
  3358. uitRocket().configChange();
  3359.  
  3360. document.body.style.fontFamily = "";
  3361. const font = getThis.getConfig("font");
  3362. if (font && font !== FONT_DEFAULT) {
  3363. const bodyStyle = document.body.getAttribute("style");
  3364. document.body.setAttribute(
  3365. "style",
  3366. `${bodyStyle}; font-family: ${font} !important`
  3367. );
  3368. }
  3369.  
  3370. const sideChat = getThis.getConfig("sideChat");
  3371. if (sideChat) {
  3372. document.getElementById("content").classList.add("side-chat");
  3373. } else {
  3374. document.getElementById("content").classList.remove("side-chat");
  3375. }
  3376.  
  3377. if (getThis.getConfig("fightPointsStats")) {
  3378. document.getElementById("menu-bar-fight-points").style.display =
  3379. "inline-block";
  3380. }
  3381. if (getThis.getConfig("fightPointsStats")) {
  3382. document.getElementById("menu-bar-fight-points").style.display =
  3383. "inline-block";
  3384. document.getElementById("menu-bar-fight-fight-points").style.display =
  3385. "block";
  3386. } else {
  3387. document.getElementById("menu-bar-fight-points").style.display =
  3388. "none";
  3389. document.getElementById("menu-bar-fight-fight-points").style.display =
  3390. "none";
  3391. }
  3392.  
  3393. //////
  3394. const condenseWoodcuttingPatches = getThis.getConfig(
  3395. "condenseWoodcuttingPatches"
  3396. );
  3397. if (condenseWoodcuttingPatches) {
  3398. const farmingPatchesArea = document.querySelectorAll(
  3399. "#panel-woodcutting .farming-plot-wrapper"
  3400. );
  3401. farmingPatchesArea.forEach((plot) => {
  3402. plot.classList.add("condensed");
  3403. document
  3404. .querySelectorAll(
  3405. "#panel-woodcutting .farming-plot-wrapper img[id^='img-tree_shiny']"
  3406. )
  3407. .forEach(function (el) {
  3408. el.removeAttribute("width");
  3409. el.removeAttribute("height");
  3410. });
  3411. });
  3412. } else {
  3413. const farmingPatchesArea = document.querySelectorAll(
  3414. "#panel-woodcutting .farming-plot-wrapper"
  3415. );
  3416. farmingPatchesArea.forEach((plot) => {
  3417. plot.classList.remove("condensed");
  3418. document
  3419. .querySelectorAll(
  3420. "#panel-woodcutting .farming-plot-wrapper img[id^='img-tree_shiny']"
  3421. )
  3422. .forEach(function (el) {
  3423. el.setAttribute("width", el.getAttribute("original-width"));
  3424. el.setAttribute("height", el.getAttribute("original-height"));
  3425. });
  3426. });
  3427. }
  3428.  
  3429. const condenseFarmingPatches = getThis.getConfig(
  3430. "condenseFarmingPatches"
  3431. );
  3432. if (condenseFarmingPatches) {
  3433. const farmingPatchesArea = document.querySelectorAll(
  3434. "#panel-farming .farming-plot-wrapper"
  3435. );
  3436. farmingPatchesArea.forEach((plot) => {
  3437. plot.classList.add("condensed");
  3438. document
  3439. .querySelectorAll(
  3440. "#panel-farming .farming-plot-wrapper img[id^='img-farm_shiny']"
  3441. )
  3442. .forEach(function (el) {
  3443. el.removeAttribute("width");
  3444. el.removeAttribute("height");
  3445. });
  3446. });
  3447. } else {
  3448. const farmingPatchesArea = document.querySelectorAll(
  3449. "#panel-farming .farming-plot-wrapper"
  3450. );
  3451. farmingPatchesArea.forEach((plot) => {
  3452. plot.classList.remove("condensed");
  3453. document
  3454. .querySelectorAll(
  3455. "#panel-farming .farming-plot-wrapper img[id^='img-farm_shiny']"
  3456. )
  3457. .forEach(function (el) {
  3458. el.setAttribute("width", el.getAttribute("original-width"));
  3459. el.setAttribute("height", el.getAttribute("original-height"));
  3460. });
  3461. });
  3462. }
  3463.  
  3464. const condenseGatheringBoxes = getThis.getConfig(
  3465. "condenseGatheringBoxes"
  3466. );
  3467. if (condenseGatheringBoxes) {
  3468. const gatheringBoxes = document.querySelectorAll(
  3469. "#panel-gathering .gathering-box"
  3470. );
  3471. gatheringBoxes.forEach(function (el) {
  3472. el.classList.add("condensed");
  3473. });
  3474. } else {
  3475. const gatheringBoxes = document.querySelectorAll(
  3476. "#panel-gathering .gathering-box"
  3477. );
  3478. gatheringBoxes.forEach(function (el) {
  3479. el.classList.remove("condensed");
  3480. });
  3481. }
  3482.  
  3483. if (getThis.getConfig("imageTitles")) {
  3484. const images = document.querySelectorAll("img");
  3485. images.forEach(function (el) {
  3486. const src = el.getAttribute("src");
  3487. if (src && src !== "x") {
  3488. const title = src.replace(/.*\//, "").replace(/\.\w+$/, "");
  3489. el.setAttribute("title", title);
  3490. }
  3491. });
  3492. } else {
  3493. const images = document.querySelectorAll("img");
  3494. images.forEach(function (el) {
  3495. el.removeAttribute("title");
  3496. });
  3497. }
  3498.  
  3499. if (getThis.getConfig("miningMachineArrows")) {
  3500. const panelMining = document.querySelector("#panel-mining");
  3501. panelMining.classList.add("add-arrow-controls");
  3502. } else {
  3503. const panelMining = document.querySelector("#panel-mining");
  3504. panelMining.classList.remove("add-arrow-controls");
  3505. }
  3506. //////
  3507. document.addEventListener("DOMContentLoaded", function () {
  3508. const toast = document.querySelector(".toast-container");
  3509. if (toast) {
  3510. if (getThis.getConfig("lowerToast")) {
  3511. toast.classList.remove("top-0");
  3512. toast.style.top = "45px";
  3513. } else {
  3514. toast.style.top = "";
  3515. toast.classList.add("top-0");
  3516. }
  3517. }
  3518. });
  3519.  
  3520. const oilSummaryMining = getThis.getConfig("oilSummaryMining");
  3521. if (oilSummaryMining) {
  3522. document.getElementById("oil-summary-mining").style.display = "block";
  3523. } else {
  3524. document.getElementById("oil-summary-mining").style.display = "none";
  3525. }
  3526.  
  3527. const oilSummaryCrafting = getThis.getConfig("oilSummaryCrafting");
  3528. if (oilSummaryCrafting) {
  3529. document.getElementById("oil-summary-crafting").style.display =
  3530. "block";
  3531. } else {
  3532. document.getElementById("oil-summary-crafting").style.display =
  3533. "none";
  3534. }
  3535.  
  3536. const smeltingNotificationTimer = getThis.getConfig(
  3537. "smeltingNotificationTimer"
  3538. );
  3539. if (smeltingNotificationTimer) {
  3540. document.getElementById("notification-furnace-timer").style.display =
  3541. "inline-block";
  3542. } else {
  3543. document.getElementById("notification-furnace-timer").style.display =
  3544. "none";
  3545. }
  3546.  
  3547. const heatInFishingTab = getThis.getConfig("heatInFishingTab");
  3548. const heatFishingTab = document.getElementById("heat-fishing-tab");
  3549. if (heatInFishingTab) {
  3550. heatFishingTab.style.display = "block";
  3551. heatFishingTab.setAttribute("data-item", "heat");
  3552. } else {
  3553. heatFishingTab.style.display = "none";
  3554. heatFishingTab.removeAttribute("data-item");
  3555. }
  3556.  
  3557. const merchantReady = getThis.getConfig("merchantReady");
  3558. const merchAvail = getVar("merchant");
  3559. const merchantAvailNotification = document.getElementById(
  3560. "notification-merchant_avail"
  3561. );
  3562. if (merchAvail === 1) {
  3563. if (merchantReady) {
  3564. merchantAvailNotification.style.display = "inline-block";
  3565. } else {
  3566. merchantAvailNotification.style.display = "none";
  3567. }
  3568. }
  3569.  
  3570. const mixerTimer = getThis.getConfig("mixerTimer");
  3571. const mixerAvail = getVar("brewing_xp_mixer_crafted");
  3572. const brewingMixerTimerNotification = document.getElementById(
  3573. "notification-brewing_mixer_timer"
  3574. );
  3575. if (mixerAvail == 1) {
  3576. if (mixerTimer) {
  3577. brewingMixerTimerNotification.style.display = "inline-block";
  3578. } else {
  3579. brewingMixerTimerNotification.style.display = "none";
  3580. }
  3581. }
  3582.  
  3583. const robotReady = getThis.getConfig("robotReady");
  3584. const robotAvail = getVar("robot_crafted");
  3585. const robotAvailNotification = document.getElementById(
  3586. "notification-robot_avail"
  3587. );
  3588. if (robotReady && robotAvailNotification) {
  3589. if (robotReady) {
  3590. robotAvailNotification.style.display = "inline-block";
  3591. } else {
  3592. robotAvailNotification.style.display = "none";
  3593. }
  3594. }
  3595.  
  3596. const drillNotifications = getThis.getConfig("hideDrillNotifications");
  3597. if (drillNotifications) {
  3598. getThis.miningMachTimer();
  3599. }
  3600.  
  3601. //////
  3602. const sdWatchShow = getThis.getConfig("moveSDWatch");
  3603. const sdWatchUnlocked = getVar("stardust_watch_crafted", 0, "int");
  3604. if (sdWatchShow && sdWatchUnlocked === 1) {
  3605. document.getElementById("notification-stardust_watch").style.display =
  3606. "none";
  3607. document.getElementById("menu-bar-sd_watch").style.display = "block";
  3608. } else if (!sdWatchShow && sdWatchUnlocked === 1) {
  3609. document.getElementById("notification-stardust_watch").style.display =
  3610. "inline-block";
  3611. document.getElementById("menu-bar-sd_watch").style.display = "none";
  3612. } else {
  3613. document.getElementById("notification-stardust_watch").style.display =
  3614. "none";
  3615. document.getElementById("menu-bar-sd_watch").style.display = "none";
  3616. }
  3617.  
  3618. const showHeat = getThis.getConfig("showHeat");
  3619. if (showHeat) {
  3620. document.getElementById("menu-bar-heat").style.display = "block";
  3621. } else {
  3622. document.getElementById("menu-bar-heat").style.display = "none";
  3623. }
  3624.  
  3625. getThis.onVariableSet("oil", window.var_oil, window.var_oil);
  3626.  
  3627. getThis.updateColors();
  3628.  
  3629. const combatInfoPanel = getThis.getConfig("combatInfoSideSelect");
  3630. if (combatInfoPanel === "left") {
  3631. document.getElementById(
  3632. "combat-info-fight_point-left"
  3633. ).style.display = "block";
  3634. document.getElementById("combat-info-rare_pot-left").style.display =
  3635. "block";
  3636. document.getElementById("combat-info-loot_pot-left").style.display =
  3637. "block";
  3638. document.getElementById(
  3639. "combat-info-fight_point-right"
  3640. ).style.display = "none";
  3641. document.getElementById("combat-info-rare_pot-right").style.display =
  3642. "none";
  3643. document.getElementById("combat-info-loot_pot-right").style.display =
  3644. "none";
  3645. } else {
  3646. document.getElementById(
  3647. "combat-info-fight_point-left"
  3648. ).style.display = "none";
  3649. document.getElementById("combat-info-rare_pot-left").style.display =
  3650. "none";
  3651. document.getElementById("combat-info-loot_pot-left").style.display =
  3652. "none";
  3653. document.getElementById(
  3654. "combat-info-fight_point-right"
  3655. ).style.display = "block";
  3656. document.getElementById("combat-info-rare_pot-right").style.display =
  3657. "block";
  3658. document.getElementById("combat-info-loot_pot-right").style.display =
  3659. "block";
  3660. }
  3661.  
  3662. const showPurpleKey = getThis.getConfig("showPurpleKeyNotification");
  3663. const purpleKeyUnlock = getVar("guardian_purple_key_hint", 0, "int");
  3664. if (showPurpleKey && purpleKeyUnlock === 1) {
  3665. document.getElementById("notification-purple_key").style.display =
  3666. "inline-block";
  3667. } else {
  3668. document.getElementById("notification-purple_key").style.display =
  3669. "none";
  3670. }
  3671.  
  3672. const hideBoatNotifications = getThis.getConfig("hideBoat");
  3673. const pirate_ship_timer = getVar("pirate_ship_timer", 0, "int");
  3674. const row_boat_timer = getVar("row_boat_timer", 0, "int");
  3675. const canoe_boat_timer = getVar("canoe_boat_timer", 0, "int");
  3676. const stardust_boat_timer = getVar("stardust_boat_timer", 0, "int");
  3677. if (hideBoatNotifications) {
  3678. document.getElementById("notification-row_boat").style.display =
  3679. "none";
  3680. document.getElementById("notification-canoe_boat").style.display =
  3681. "none";
  3682. document.getElementById("notification-stardust_boat").style.display =
  3683. "none";
  3684. document.getElementById("notification-pirate_ship").style.display =
  3685. "none";
  3686. } else {
  3687. if (row_boat_timer > 0) {
  3688. document.getElementById("notification-row_boat").style.display =
  3689. "inline-block";
  3690. }
  3691. if (canoe_boat_timer > 0) {
  3692. document.getElementById("notification-canoe_boat").style.display =
  3693. "inline-block";
  3694. }
  3695. if (stardust_boat_timer > 0) {
  3696. document.getElementById(
  3697. "notification-stardust_boat"
  3698. ).style.display = "inline-block";
  3699. }
  3700. if (pirate_ship_timer > 0) {
  3701. document.getElementById("notification-pirate_ship").style.display =
  3702. "inline-block";
  3703. }
  3704. }
  3705.  
  3706. setTimeout(function () {
  3707. if (document.getElementById("notification-furnace_avail")) {
  3708. const furnaceOreTypeVar = getVar(
  3709. "furnace_ore_amount_set",
  3710. 0,
  3711. "int"
  3712. );
  3713. const furnaceNotifVar = IdlePixelPlus.plugins[
  3714. "ui-tweaks"
  3715. ].getConfig("furnaceEmptyNotification");
  3716. if (furnaceOreTypeVar <= 0 && furnaceNotifVar) {
  3717. document.getElementById(
  3718. "notification-furnace_avail"
  3719. ).style.display = "inline-block";
  3720. } else {
  3721. document.getElementById(
  3722. "notification-furnace_avail"
  3723. ).style.display = "none";
  3724. }
  3725. }
  3726. }, 500);
  3727.  
  3728. purpleKeyGo = getThis.getConfig("showPurpleKeyNotification");
  3729.  
  3730. if (getThis.getConfig("condensedUI")) {
  3731. getThis.condensedUI();
  3732. } else {
  3733. getThis.defaultUI();
  3734. }
  3735.  
  3736. let scrollingNotifications = getThis.getConfig("scrollingNotifications");
  3737. let notifArea = document.getElementById("notifications-area");
  3738.  
  3739. if (scrollingNotifications) {
  3740. notifArea.style.overflowY = "auto";
  3741. notifArea.style.height = "140px";
  3742. } else {
  3743. notifArea.style.overflowY = "unset";
  3744. notifArea.style.height = "unset";
  3745. }
  3746. }
  3747. }
  3748. //////////////////////////////// onConfigsChanged End ////////////////////////////////
  3749.  
  3750. /*restructureTopBar() {
  3751. let topRow = document
  3752. .getElementById("top-menu-bar-labels")
  3753. .querySelector("tr");
  3754. let topCell = document
  3755. .getElementById("top-menu-bar-labels")
  3756. .querySelectorAll("td");
  3757. let gearIcon = topCell[topCell.length - 1];
  3758.  
  3759. topRow.style.justifyContent = "center";
  3760. topRow.style.display = "flex";
  3761. topCell.forEach((element) => {
  3762. element.style =
  3763. "padding-right:20px; padding-left: 20px; border:1px solid white";
  3764. });
  3765. gearIcon.style = "";
  3766. }*/
  3767.  
  3768. //////////////////////////////// onLogin Start ////////////////////////////////
  3769. onLogin() {
  3770. currUTCDate = new Date().getUTCDate();
  3771. IPP = IdlePixelPlus;
  3772. getVar = IdlePixelPlus.getVarOrDefault;
  3773. getThis = IdlePixelPlus.plugins["ui-tweaks"];
  3774. document.getElementById("menu-bar").style.borderTop = "1px solid grey";
  3775. document.getElementById("menu-bar").style.paddingTop = "10px";
  3776. document.getElementById("left-menu-bar-labels").style.borderBottom =
  3777. "1px solid rgba(66,66,66,1)";
  3778. uitMisc().initStyles();
  3779. uitLevel().initExtendedLevels();
  3780. uitRocket().onLogin();
  3781. uitSkills.forEach((skill) => {
  3782. let xpVar = `var_ipp_${skill}_xp_next`;
  3783. let xp = getVar(`${skill}_xp`, 0, "int");
  3784. let level = uitLevel().xpToLevel(xp);
  3785. const xpAtNext = uitLevel().LEVELS()[level + 1];
  3786. const next = xpAtNext - xp;
  3787. window[xpVar] = `${next}`;
  3788. });
  3789.  
  3790. uitPurpleKey().addPurpleKeyNotifications();
  3791. uitCriptoe().initCriptoe();
  3792. uitFishing().initFishing();
  3793. uitRaids().initElements();
  3794.  
  3795. getThis.updateColors();
  3796.  
  3797. var loot_pot = getVar("combat_loot_potion_active", 0, "int");
  3798. var merchantTiming = getVar("merchant_timer", 0, "int");
  3799. var merchantUnlocked = getVar("merchant", 0, "int");
  3800. let robotTiming = getVar("robot_wave_timer", 0, "int");
  3801. var robotUnlocked = getVar("robot_crafted", 0, "int");
  3802. const tableLabel = getThis.getConfig("tableLabels");
  3803. getThis.loot_pot_avail();
  3804. if (tableLabel) {
  3805. uitTableLabels().addTableCraftLabels();
  3806. }
  3807.  
  3808. const addBrewerNotifications = (timer, charges) => {
  3809. var mixerUnlocked = getVar("brewing_xp_mixer_crafted");
  3810. const notifDiv = document.createElement("div");
  3811. notifDiv.id = `notification-brewing_mixer_timer`;
  3812. notifDiv.onclick = function () {
  3813. websocket.send(switch_panels("panel-brewing"));
  3814. websocket.send(Modals.clicks_brewing_xp_mixer());
  3815. };
  3816. notifDiv.className = "notification hover";
  3817. notifDiv.style = "margin-bottom: 4px; display: none";
  3818. notifDiv.style.display = "inline-block";
  3819.  
  3820. var elem = document.createElement("img");
  3821. elem.setAttribute("src", `${UIT_IMAGE_URL_BASE}brewing_xp_mixer.png`);
  3822. const notifIcon = elem;
  3823. notifIcon.className = "w20";
  3824.  
  3825. const notifDivLabel = document.createElement("span");
  3826. notifDivLabel.id = `notification-brewing_mixer_timer-label`;
  3827. notifDivLabel.innerText = " " + timer + " (" + charges + "/5)";
  3828. notifDivLabel.className = "color-white";
  3829.  
  3830. notifDiv.append(notifIcon, notifDivLabel);
  3831. document.querySelector("#notifications-area").prepend(notifDiv);
  3832. if (mixerUnlocked == 0) {
  3833. document.querySelector("#brewing_mixer_timer").style.display = "none";
  3834. }
  3835. };
  3836.  
  3837. const brewingTimer = () => {
  3838. var mixerUnlocked = getVar("brewing_xp_mixer_crafted");
  3839. if (mixerUnlocked == 1) {
  3840. let playerTimer = getVar("playtime", 0, "int");
  3841. let chargesUsed = getVar("brewing_xp_mixer_used", 0, "int");
  3842. let chargesLeft = 5 - chargesUsed;
  3843. let playTimeMod =
  3844. 1 - (playerTimer / 86400 - Math.floor(playerTimer / 86400));
  3845. let etaTimerBrew = format_time(playTimeMod * 86400);
  3846.  
  3847. const runBrewingTimer = setInterval(function () {
  3848. playerTimer = getVar("playtime", 0, "int");
  3849. chargesUsed = getVar("brewing_xp_mixer_used", 0, "int");
  3850. chargesLeft = 5 - chargesUsed;
  3851. playTimeMod =
  3852. 1 - (playerTimer / 86400 - Math.floor(playerTimer / 86400));
  3853. etaTimerBrew = format_time(playTimeMod * 86400);
  3854. const brewingLabel = document.querySelector(
  3855. "#notification-brewing_mixer_timer-label"
  3856. );
  3857. brewingLabel.innerText = ` ${etaTimerBrew} (${chargesLeft}/5)`;
  3858. }, 1000);
  3859.  
  3860. addBrewerNotifications(etaTimerBrew, chargesLeft);
  3861. }
  3862. };
  3863.  
  3864. const addMerchantNotifications = () => {
  3865. var merchantTimerCheck = getVar("merchant_timer", 0, "int");
  3866. var merchantUnlocked = getVar("merchant", 0, "int");
  3867. const notifDiv = document.createElement("div");
  3868. notifDiv.id = `notification-merchant_avail`;
  3869. notifDiv.onclick = function () {
  3870. websocket.send(switch_panels("panel-shop"));
  3871. };
  3872. notifDiv.className = "notification hover";
  3873. notifDiv.style = "margin-right: 4px; margin-bottom: 4px; display: none";
  3874. notifDiv.style.display = "inline-block";
  3875.  
  3876. var elem = document.createElement("img");
  3877. elem.setAttribute("src", `${UIT_IMAGE_URL_BASE}merchant.png`);
  3878. const notifIcon = elem;
  3879. notifIcon.className = "w20";
  3880.  
  3881. const notifDivLabel = document.createElement("span");
  3882. notifDivLabel.id = `notification-merchant_avail-label`;
  3883. notifDivLabel.innerText = " Merchant Ready";
  3884. notifDivLabel.className = "color-white";
  3885.  
  3886. notifDiv.append(notifIcon, notifDivLabel);
  3887. document.querySelector("#notifications-area").prepend(notifDiv);
  3888. if (merchantTimerCheck > 0 || merchantUnlocked == 0) {
  3889. document.querySelector("#notification-merchant_avail").style.display =
  3890. "none";
  3891. }
  3892. };
  3893.  
  3894. const merchantTimer = () => {
  3895. var merchantUnlocked = getVar("merchant", 0, "int");
  3896. if (merchantUnlocked == 1) {
  3897. let merchantTiming = getVar("merchant_timer", 0, "int");
  3898. let etaTimerMerch = format_time(merchantTiming);
  3899. const runMerchantTimer = setInterval(function () {
  3900. merchantTiming = getVar("merchant_timer", 0, "int");
  3901. etaTimerMerch = format_time(merchantTiming);
  3902. const merchantLabel = document.querySelector(
  3903. "#notification-merchant_avail-label"
  3904. );
  3905. if (merchantTiming == 0) {
  3906. merchantLabel.innerText = ` Merchant Ready`;
  3907. document.querySelector(
  3908. "#notification-merchant_avail"
  3909. ).style.display = "inline-block";
  3910. } else {
  3911. document.querySelector(
  3912. "#notification-merchant_avail"
  3913. ).style.display = "none";
  3914. }
  3915. }, 1000);
  3916.  
  3917. addMerchantNotifications(etaTimerMerch);
  3918. }
  3919. };
  3920.  
  3921. const addFurnaceNotification = () => {
  3922. if (getVar("stone_furnace_crafted", 0, "int") == 1) {
  3923. var furnaceOreType = getVar("furnace_ore_type", "none", "string");
  3924. var dragFur = getVar("dragon_furnace", 0, "int");
  3925. var ancFur = getVar("ancient_furnace_crafted", 0, "int");
  3926. var titFur = getVar("titanium_furnace_crafted", 0, "int");
  3927. var promFur = getVar("promethium_furnace_crafted", 0, "int");
  3928. var goldFur = getVar("gold_furnace_crafted", 0, "int");
  3929. var silvFur = getVar("silver_furnace_crafted", 0, "int");
  3930. var ironFur = getVar("iron_furnace_crafted", 0, "int");
  3931. var bronzeFur = getVar("bronze_furnace_crafted", 0, "int");
  3932. var stoneFur = getVar("stone_furnace_crafted", 0, "int");
  3933. var furnImg;
  3934.  
  3935. if (dragFur == 1) {
  3936. furnImg = `${UIT_IMAGE_URL_BASE}dragon_furnace.png`;
  3937. } else if (ancFur == 1) {
  3938. furnImg = `${UIT_IMAGE_URL_BASE}ancient_furnace.png`;
  3939. } else if (titFur == 1) {
  3940. furnImg = `${UIT_IMAGE_URL_BASE}titanium_furnace.png`;
  3941. } else if (promFur == 1) {
  3942. furnImg = `${UIT_IMAGE_URL_BASE}promethium_furnace.png`;
  3943. } else if (goldFur == 1) {
  3944. furnImg = `${UIT_IMAGE_URL_BASE}gold_furnace.png`;
  3945. } else if (silvFur == 1) {
  3946. furnImg = `${UIT_IMAGE_URL_BASE}silver_furnace.png`;
  3947. } else if (ironFur == 1) {
  3948. furnImg = `${UIT_IMAGE_URL_BASE}iron_furnace.png`;
  3949. } else if (bronzeFur == 1) {
  3950. furnImg = `${UIT_IMAGE_URL_BASE}bronze_furnace.png`;
  3951. } else if (stoneFur == 1) {
  3952. furnImg = `${UIT_IMAGE_URL_BASE}stone_furnace.png`;
  3953. } else {
  3954. document.querySelector(
  3955. "#notification-furnace_avail"
  3956. ).style.display = "none";
  3957. }
  3958.  
  3959. const notifDiv = document.createElement("div");
  3960. notifDiv.id = `notification-furnace_avail`;
  3961. notifDiv.onclick = function () {
  3962. websocket.send(switch_panels("panel-crafting"));
  3963. };
  3964. notifDiv.className = "notification hover";
  3965. notifDiv.style =
  3966. "margin-right: 4px; margin-bottom: 4px; display: none";
  3967. notifDiv.style.display = "inline-block";
  3968.  
  3969. var elem = document.createElement("img");
  3970. elem.setAttribute("src", furnImg);
  3971. const notifIcon = elem;
  3972. notifIcon.className = "w20";
  3973.  
  3974. const notifDivLabel = document.createElement("span");
  3975. notifDivLabel.id = `notification-furnace_avail-label`;
  3976. notifDivLabel.innerText = " Furnace Empty";
  3977. notifDivLabel.className = "color-white";
  3978.  
  3979. notifDiv.append(notifIcon, notifDivLabel);
  3980. document.querySelector("#notifications-area").prepend(notifDiv);
  3981. var furnaceNotif = getThis.getConfig("furnaceEmptyNotification");
  3982. if (furnaceOreType != "none" || !furnaceNotif) {
  3983. document.querySelector(
  3984. "#notification-furnace_avail"
  3985. ).style.display = "none";
  3986. }
  3987. }
  3988. };
  3989.  
  3990. const addRobotNotifications = () => {
  3991. var robotTimerCheck = getVar("robot_wave_timer", 0, "int");
  3992. var robotUnlocked = getVar("robot_crafted", 0, "int");
  3993. const notifDiv = document.createElement("div");
  3994. notifDiv.id = `notification-robot_avail`;
  3995. notifDiv.onclick = function () {
  3996. websocket.send(Modals.open_robot_waves());
  3997. };
  3998. notifDiv.className = "notification hover";
  3999. notifDiv.style = "margin-right: 4px; margin-bottom: 4px; display: none";
  4000. notifDiv.style.display = "inline-block";
  4001.  
  4002. var elem = document.createElement("img");
  4003. elem.setAttribute("src", `${UIT_IMAGE_URL_BASE}robot.png`);
  4004. const notifIcon = elem;
  4005. notifIcon.className = "w20";
  4006.  
  4007. const notifDivLabel = document.createElement("span");
  4008. notifDivLabel.id = `notification-robot_avail-label`;
  4009. notifDivLabel.innerText = " Waves Ready";
  4010. notifDivLabel.className = "color-white";
  4011.  
  4012. notifDiv.append(notifIcon, notifDivLabel);
  4013. document.querySelector("#notifications-area").prepend(notifDiv);
  4014. if (robotTimerCheck > 0 || robotUnlocked == 0) {
  4015. document.querySelector("#notification-robot_avail").style.display =
  4016. "none";
  4017. }
  4018. };
  4019.  
  4020. const robotTimer = () => {
  4021. let robotNotification = false;
  4022. var robotUnlocked = getVar("robot_crafted", 0, "int");
  4023. var thisScript = "";
  4024. if (robotUnlocked == 1) {
  4025. let robotTiming = getVar("robot_wave_timer", 0, "int");
  4026. let etaTimerRobot = format_time(robotTiming);
  4027. const runRobotTimer = setInterval(function () {
  4028. robotNotification =
  4029. IdlePixelPlus.plugins["ui-tweaks"].getConfig("robotReady");
  4030. robotTiming = getVar("robot_wave_timer", 0, "int");
  4031. etaTimerRobot = format_time(robotTiming);
  4032. const robotLabel = document.querySelector(
  4033. "#notification-robot_avail-label"
  4034. );
  4035. if (robotTiming == 0 && robotNotification) {
  4036. //console.log(robotNotification);
  4037. robotLabel.innerText = ` Waves Ready`;
  4038. document.querySelector(
  4039. "#notification-robot_avail"
  4040. ).style.display = "inline-block";
  4041. } else {
  4042. document.querySelector(
  4043. "#notification-robot_avail"
  4044. ).style.display = "none";
  4045. }
  4046. }, 1000);
  4047.  
  4048. addRobotNotifications(etaTimerRobot);
  4049. }
  4050. };
  4051.  
  4052. brewingTimer();
  4053. merchantTimer();
  4054. robotTimer();
  4055. addFurnaceNotification();
  4056.  
  4057. const lootPotAvail = document.querySelector(
  4058. "#notification-loot_pot_avail"
  4059. );
  4060. if (loot_pot == 0) {
  4061. lootPotAvail.style.display = "none";
  4062. } else {
  4063. lootPotAvail.style.display = "inline-block";
  4064. }
  4065.  
  4066. const merchantAvail = document.querySelector(
  4067. "#notification-merchant_avail"
  4068. );
  4069. if (merchantAvail) {
  4070. if (merchantTiming > 0 || merchantUnlocked == 0) {
  4071. merchantAvail.style.display = "none";
  4072. } else {
  4073. merchantAvail.style.display = "inline-block";
  4074. }
  4075. }
  4076.  
  4077. const robotAvail = document.querySelector("#notification-robot_avail");
  4078. if (robotAvail) {
  4079. if (robotTiming > 0 || robotUnlocked == 0) {
  4080. robotAvail.style.display = "none";
  4081. } else {
  4082. robotAvail.style.display = "inline-block";
  4083. }
  4084. }
  4085.  
  4086. getThis.miningMachTimer();
  4087. // fix chat
  4088. purpleKeyGo = getThis.getConfig("showPurpleKeyNotification");
  4089.  
  4090. getThis.onConfigsChanged();
  4091.  
  4092. //Left menu energy info
  4093. const menuBarEnergy = document.getElementById("menu-bar-energy");
  4094. const menuBarFightPoints = document.createElement("span");
  4095. menuBarFightPoints.id = "menu-bar-fight-points";
  4096. menuBarFightPoints.innerHTML = `
  4097. (<span class="fight-points-full-timmer" id="fight-points-full-id-menu"></span>)
  4098. `;
  4099.  
  4100. const menuBarFightPoints_2 = document.createElement("span");
  4101. menuBarFightPoints_2.id = "menu-bar-fight-points";
  4102. menuBarFightPoints_2.innerHTML = `
  4103. (<span class="fight-points-full-timmer" id="fight-points-full-id-menu_2"></span>)
  4104. `;
  4105.  
  4106. document
  4107. .getElementById("menu-bar-fp")
  4108. .insertAdjacentElement("beforeend", menuBarFightPoints);
  4109. document
  4110. .getElementById("menu-bar-fp-2")
  4111. .insertAdjacentElement("beforeend", menuBarFightPoints_2);
  4112.  
  4113. const menuBarCrystals = document.getElementById("menu-bar-crystals");
  4114.  
  4115. // SD Watch Left Side
  4116.  
  4117. const sdWatchElement = document.createElement("span");
  4118. sdWatchElement.innerHTML = `<br>
  4119. <span onClick="websocket.send(Modals.clicks_stardust_watch())" id="menu-bar-sd_watch">
  4120. <img id="sd-watch-img" class="img-20" src="${UIT_IMAGE_URL_BASE}stardust_watch.png">
  4121. <span class="sd-watch-text">Watch Charges</span>
  4122. (<span class="sd-watch-charges">0</span>)
  4123. </span>
  4124. `;
  4125. const sdWatchElement2 = document.createElement("td");
  4126. sdWatchElement2.innerHTML = `
  4127. <div class="top-bar-2-item">
  4128. <span onClick="websocket.send(Modals.clicks_stardust_watch())" id="menu-bar-sd_watch_2">
  4129. <img id="sd-watch-img" class="img-20" src="${UIT_IMAGE_URL_BASE}stardust_watch.png">
  4130. <span class="sd-watch-text">Watch Charges</span>
  4131. (<span class="sd-watch-charges_2">0</span>)
  4132. </span>
  4133. </div>
  4134. `;
  4135.  
  4136. document
  4137. .getElementById("menu-bar-crystals")
  4138. .insertAdjacentElement("beforebegin", sdWatchElement);
  4139. document
  4140. .getElementById("menu-bar-crystals-2")
  4141. .parentNode.insertAdjacentElement("beforebegin", sdWatchElement2);
  4142.  
  4143. const energyItemDisplay = document.querySelector(
  4144. '#menu-bar-hero item-display[data-key="energy"]'
  4145. );
  4146.  
  4147. const menuBarFightPointsCombat = document.createElement("span");
  4148. menuBarFightPointsCombat.id = "menu-bar-fight-fight-points";
  4149. menuBarFightPointsCombat.innerHTML = `<img id="menu-bar-fight-points-img" class="img-20" src="${UIT_IMAGE_URL_BASE}fight_points.png"><item-display data-format="number" data-key="fight_points"> 0</item-display>(<span class="fight-points-full-timmer" id="fight-points-full-id-combat"></span>)`;
  4150.  
  4151. energyItemDisplay.parentElement.insertBefore(
  4152. menuBarFightPointsCombat,
  4153. energyItemDisplay.nextSibling
  4154. );
  4155.  
  4156. uitLevel().initNextLevel();
  4157.  
  4158. // machine arrows
  4159. const machineryList = [
  4160. "drill",
  4161. "crusher",
  4162. "giant_drill",
  4163. "excavator",
  4164. "giant_excavator",
  4165. "massive_excavator",
  4166. ];
  4167.  
  4168. machineryList.forEach((machine) => {
  4169. const itemBox = document.querySelector(`itembox[data-item=${machine}]`);
  4170. if (itemBox) {
  4171. const arrowControlsDiv = document.createElement("div");
  4172. arrowControlsDiv.className = "arrow-controls";
  4173. arrowControlsDiv.onclick = function (event) {
  4174. event.stopPropagation();
  4175. };
  4176.  
  4177. const arrowUpDiv = document.createElement("div");
  4178. arrowUpDiv.className = "arrow up";
  4179. arrowUpDiv.onclick = function (event) {
  4180. event.stopPropagation();
  4181. IdlePixelPlus.sendMessage(`MACHINERY=${machine}~increase`);
  4182. };
  4183.  
  4184. const itemDisplay = document.createElement("item-display");
  4185. itemDisplay.setAttribute("data-format", "number");
  4186. itemDisplay.setAttribute("data-key", `${machine}_on`);
  4187. itemDisplay.innerHTML = "1";
  4188.  
  4189. const arrowDownDiv = document.createElement("div");
  4190. arrowDownDiv.className = "arrow down";
  4191. arrowDownDiv.onclick = function (event) {
  4192. event.stopPropagation();
  4193. IdlePixelPlus.sendMessage(`MACHINERY=${machine}~decrease`);
  4194. };
  4195.  
  4196. arrowControlsDiv.appendChild(arrowUpDiv);
  4197. arrowControlsDiv.appendChild(itemDisplay);
  4198. arrowControlsDiv.appendChild(arrowDownDiv);
  4199.  
  4200. itemBox.appendChild(arrowControlsDiv);
  4201. }
  4202. });
  4203.  
  4204. // custom notifications
  4205. const notificationsArea = document.getElementById("notifications-area");
  4206.  
  4207. if (notificationsArea) {
  4208. const notificationOilFull = document.createElement("div");
  4209. notificationOilFull.id = "ui-tweaks-notification-oil-full";
  4210. notificationOilFull.style.display = "none";
  4211. notificationOilFull.classList.add("notification", "hover");
  4212. notificationOilFull.onclick = function () {
  4213. switch_panels("panel-mining");
  4214. };
  4215.  
  4216. notificationOilFull.innerHTML = `
  4217. <img src="${UIT_IMAGE_URL_BASE}oil.png" class="w20">
  4218. <span class="font-small color-yellow">Oil Full</span>
  4219. `;
  4220.  
  4221. notificationsArea.appendChild(notificationOilFull);
  4222. }
  4223.  
  4224. const panelMining = document.querySelector("#panel-mining .progress-bar");
  4225. const panelCrafting = document.querySelector(
  4226. "#panel-crafting .progress-bar"
  4227. );
  4228.  
  4229. if (panelMining) {
  4230. const oilSummaryMining = document.createElement("div");
  4231. oilSummaryMining.id = "oil-summary-mining";
  4232. oilSummaryMining.style.marginTop = "0.5em";
  4233.  
  4234. const oilLabel = document.createElement("strong");
  4235. oilLabel.textContent = "Oil: ";
  4236.  
  4237. const oilDisplay = document.createElement("item-display");
  4238. oilDisplay.setAttribute("data-format", "number");
  4239. oilDisplay.setAttribute("data-key", "oil");
  4240.  
  4241. const maxOilDisplay = document.createElement("item-display");
  4242. maxOilDisplay.setAttribute("data-format", "number");
  4243. maxOilDisplay.setAttribute("data-key", "max_oil");
  4244.  
  4245. const inLabel = document.createElement("strong");
  4246. inLabel.textContent = "In: ";
  4247.  
  4248. const inDisplay = document.createElement("item-display");
  4249. inDisplay.setAttribute("data-format", "number");
  4250. inDisplay.setAttribute("data-key", "oil_in");
  4251.  
  4252. const outLabel = document.createElement("strong");
  4253. outLabel.textContent = "Out: ";
  4254.  
  4255. const outDisplay = document.createElement("item-display");
  4256. outDisplay.setAttribute("data-format", "number");
  4257. outDisplay.setAttribute("data-key", "oil_out");
  4258.  
  4259. const deltaLabel = document.createElement("strong");
  4260. deltaLabel.textContent = "Delta: ";
  4261.  
  4262. const deltaDisplay = document.createElement("item-display");
  4263. deltaDisplay.setAttribute("data-format", "number");
  4264. deltaDisplay.setAttribute("data-key", "oil_delta");
  4265.  
  4266. oilSummaryMining.appendChild(oilLabel);
  4267. oilSummaryMining.appendChild(oilDisplay);
  4268. oilSummaryMining.appendChild(document.createTextNode(" / "));
  4269. oilSummaryMining.appendChild(maxOilDisplay);
  4270. oilSummaryMining.appendChild(document.createElement("br"));
  4271. oilSummaryMining.appendChild(inLabel);
  4272. oilSummaryMining.appendChild(document.createTextNode("+"));
  4273. oilSummaryMining.appendChild(inDisplay);
  4274. oilSummaryMining.appendChild(
  4275. document.createTextNode("\u00A0\u00A0\u00A0")
  4276. );
  4277. oilSummaryMining.appendChild(outLabel);
  4278. oilSummaryMining.appendChild(document.createTextNode("-"));
  4279. oilSummaryMining.appendChild(outDisplay);
  4280. oilSummaryMining.appendChild(document.createElement("br"));
  4281. oilSummaryMining.appendChild(deltaLabel);
  4282. oilSummaryMining.appendChild(deltaDisplay);
  4283.  
  4284. panelMining.parentNode.insertBefore(
  4285. oilSummaryMining,
  4286. panelMining.nextSibling
  4287. );
  4288. }
  4289.  
  4290. if (panelCrafting) {
  4291. const oilSummaryCrafting = document.createElement("div");
  4292. oilSummaryCrafting.id = "oil-summary-crafting";
  4293. oilSummaryCrafting.style.marginTop = "0.5em";
  4294.  
  4295. const oilLabel = document.createElement("strong");
  4296. oilLabel.textContent = "Oil: ";
  4297.  
  4298. const oilDisplay = document.createElement("item-display");
  4299. oilDisplay.setAttribute("data-format", "number");
  4300. oilDisplay.setAttribute("data-key", "oil");
  4301.  
  4302. const maxOilDisplay = document.createElement("item-display");
  4303. maxOilDisplay.setAttribute("data-format", "number");
  4304. maxOilDisplay.setAttribute("data-key", "max_oil");
  4305.  
  4306. const inLabel = document.createElement("strong");
  4307. inLabel.textContent = "In: ";
  4308.  
  4309. const inDisplay = document.createElement("item-display");
  4310. inDisplay.setAttribute("data-format", "number");
  4311. inDisplay.setAttribute("data-key", "oil_in");
  4312.  
  4313. const outLabel = document.createElement("strong");
  4314. outLabel.textContent = "Out: ";
  4315.  
  4316. const outDisplay = document.createElement("item-display");
  4317. outDisplay.setAttribute("data-format", "number");
  4318. outDisplay.setAttribute("data-key", "oil_out");
  4319.  
  4320. const deltaLabel = document.createElement("strong");
  4321. deltaLabel.textContent = "Delta: ";
  4322.  
  4323. const deltaDisplay = document.createElement("item-display");
  4324. deltaDisplay.setAttribute("data-format", "number");
  4325. deltaDisplay.setAttribute("data-key", "oil_delta");
  4326.  
  4327. oilSummaryCrafting.appendChild(oilLabel);
  4328. oilSummaryCrafting.appendChild(oilDisplay);
  4329. oilSummaryCrafting.appendChild(document.createTextNode(" / "));
  4330. oilSummaryCrafting.appendChild(maxOilDisplay);
  4331. oilSummaryCrafting.appendChild(document.createElement("br"));
  4332. oilSummaryCrafting.appendChild(inLabel);
  4333. oilSummaryCrafting.appendChild(document.createTextNode("+"));
  4334. oilSummaryCrafting.appendChild(inDisplay);
  4335. oilSummaryCrafting.appendChild(
  4336. document.createTextNode("\u00A0\u00A0\u00A0")
  4337. );
  4338. oilSummaryCrafting.appendChild(outLabel);
  4339. oilSummaryCrafting.appendChild(document.createTextNode("-"));
  4340. oilSummaryCrafting.appendChild(outDisplay);
  4341. oilSummaryCrafting.appendChild(document.createElement("br"));
  4342. oilSummaryCrafting.appendChild(deltaLabel);
  4343. oilSummaryCrafting.appendChild(deltaDisplay);
  4344.  
  4345. panelCrafting.parentNode.insertBefore(
  4346. oilSummaryCrafting,
  4347. panelCrafting.nextSibling
  4348. );
  4349. }
  4350.  
  4351. document
  4352. .querySelector("#notification-furnace-label")
  4353. .insertAdjacentHTML(
  4354. "afterend",
  4355. '<span id="notification-furnace-timer" class="font-small color-white"></span>'
  4356. );
  4357. document
  4358. .querySelector("#notification-rocket-label")
  4359. .insertAdjacentHTML(
  4360. "afterend",
  4361. '<span id="notification-rocket-timer" class="font-small color-white"></span>'
  4362. );
  4363. document
  4364. .querySelector("#notification-mega_rocket-label")
  4365. .insertAdjacentHTML(
  4366. "afterend",
  4367. '<span id="notification-mega_rocket-timer" class="font-small color-white"></span>'
  4368. );
  4369.  
  4370. // clear chat button
  4371. var chatAutoScrollButton = document.getElementById(
  4372. "chat-auto-scroll-button"
  4373. );
  4374. var chatClearButton = document.createElement("button");
  4375. chatClearButton.id = "chat-clear-button";
  4376. chatClearButton.textContent = "CLEAR";
  4377. chatClearButton.style.color = "green";
  4378. chatClearButton.onclick = function () {
  4379. IdlePixelPlus.plugins["ui-tweaks"].clearChat();
  4380. };
  4381.  
  4382. chatAutoScrollButton.insertAdjacentElement("afterend", chatClearButton);
  4383.  
  4384. // reorganize chat location
  4385. const self = this;
  4386. const chat = document.querySelector("#game-chat > :first-child");
  4387. const chatTop = document.createElement("div");
  4388. chatTop.id = "chat-top";
  4389. const chatArea = document.querySelector("#chat-area");
  4390. const chatBottom = document.querySelector(
  4391. "#game-chat > :first-child > :last-child"
  4392. );
  4393.  
  4394. while (chat.firstChild) {
  4395. chatTop.appendChild(chat.firstChild);
  4396. }
  4397.  
  4398. chat.appendChild(chatTop);
  4399. chat.appendChild(chatArea);
  4400. chat.appendChild(chatBottom);
  4401.  
  4402. // override for service messages
  4403. const original_yell_to_chat_box = Chat.yell_to_chat_box;
  4404. Chat.yell_to_chat_box = function () {
  4405. original_yell_to_chat_box.apply(Chat, arguments);
  4406. self.updateColors();
  4407. };
  4408.  
  4409. var currentFP = getVar("fight_points", 0, "int").toLocaleString();
  4410. var rarePotTimer = getVar("rare_monster_potion_timer", 0, "int");
  4411. var rarePotPlusTimer = getVar(
  4412. "super_rare_monster_potion_timer",
  4413. 0,
  4414. "int"
  4415. );
  4416. var rarePotInfo = "";
  4417.  
  4418. if (rarePotTimer > 0) {
  4419. rarePotInfo = rarePotTimer;
  4420. } else if (rarePotPlusTimer > 0) {
  4421. rarePotInfo = rarePotPlusTimer;
  4422. } else {
  4423. rarePotInfo = "Inactive";
  4424. }
  4425.  
  4426. var combatLootPotActive = getVar("combat_loot_potion_active", 0, "int");
  4427. var combatLootPotTimer = getVar("combat_loot_potion_timer", 0, "int");
  4428. var combatLootPotInfo = "";
  4429.  
  4430. if (combatLootPotActive == 1) {
  4431. combatLootPotInfo = "Active";
  4432. } else {
  4433. combatLootPotInfo = "Inactive";
  4434. }
  4435.  
  4436. function createCombatStatEntry(id, imgSrc, imgTitle, text, value) {
  4437. const entry = document.createElement("div");
  4438. entry.className = "td-combat-stat-entry";
  4439. entry.id = id;
  4440.  
  4441. let content;
  4442.  
  4443. if (
  4444. id == "combat-info-loot_pot-right" ||
  4445. id == "combat-info-loot_pot-left"
  4446. ) {
  4447. content = `
  4448. <br>
  4449. <img class="img-15" src="${imgSrc}" title="${imgTitle}">
  4450. <span style="color:white">${text}:</span>
  4451. <span id="${id}-lp">${value}</span>
  4452. `;
  4453. } else if (
  4454. id == "combat-info-fight_point-right" ||
  4455. id == "combat-info-fight_point-left"
  4456. ) {
  4457. content = `
  4458. <img class="img-15" src="${imgSrc}" title="${imgTitle}">
  4459. <span style="color:white">${text}:</span>
  4460. <span id="${id}-fp">${value}</span>
  4461. `;
  4462. } else {
  4463. content = `
  4464. <img class="img-15" src="${imgSrc}" title="${imgTitle}">
  4465. <span style="color:white">${text}:</span>
  4466. <span id="${id}-rp">${value}</span>
  4467. `;
  4468. }
  4469.  
  4470. entry.innerHTML = content;
  4471. return entry;
  4472. }
  4473.  
  4474. function insertAfter(newNode, referenceNode) {
  4475. referenceNode.parentNode.insertBefore(
  4476. newNode,
  4477. referenceNode.nextSibling
  4478. );
  4479. }
  4480.  
  4481. var lastChildInPanel = document.querySelector(
  4482. "#panel-combat-canvas > center > table > tbody > tr:nth-child(2) > td.fight-left-border > div.td-combat-bottom-panel.shadow > div:last-child"
  4483. );
  4484. insertAfter(
  4485. createCombatStatEntry(
  4486. "combat-info-fight_point-right",
  4487. `${UIT_IMAGE_URL_BASE}fight_points.png`,
  4488. "fight_points_white-right",
  4489. "FP",
  4490. currentFP
  4491. ),
  4492. lastChildInPanel
  4493. );
  4494. insertAfter(
  4495. createCombatStatEntry(
  4496. "combat-info-rare_pot-right",
  4497. `${UIT_IMAGE_URL_BASE}rare_monster_potion.png`,
  4498. "rare_potion_white-right",
  4499. "Rare Pot",
  4500. rarePotInfo
  4501. ),
  4502. lastChildInPanel
  4503. );
  4504. insertAfter(
  4505. createCombatStatEntry(
  4506. "combat-info-loot_pot-right",
  4507. `${UIT_IMAGE_URL_BASE}combat_loot_potion.png`,
  4508. "combat_loot_potion_white-right",
  4509. "Loot Pot",
  4510. combatLootPotInfo
  4511. ),
  4512. lastChildInPanel
  4513. );
  4514.  
  4515. var idleHeroArrowsArea = document.querySelector(
  4516. "#menu-bar-idle-hero-arrows-area-2"
  4517. );
  4518. insertAfter(
  4519. createCombatStatEntry(
  4520. "combat-info-fight_point-left",
  4521. `${UIT_IMAGE_URL_BASE}fight_points.png`,
  4522. "fight_points_white-left",
  4523. "FP",
  4524. currentFP
  4525. ),
  4526. idleHeroArrowsArea
  4527. );
  4528. insertAfter(
  4529. createCombatStatEntry(
  4530. "combat-info-rare_pot-left",
  4531. `${UIT_IMAGE_URL_BASE}rare_monster_potion.png`,
  4532. "rare_potion_white-left",
  4533. "Rare Pot",
  4534. rarePotInfo
  4535. ),
  4536. idleHeroArrowsArea
  4537. );
  4538. insertAfter(
  4539. createCombatStatEntry(
  4540. "combat-info-loot_pot-left",
  4541. `${UIT_IMAGE_URL_BASE}combat_loot_potion.png`,
  4542. "combat_loot_potion_white-left",
  4543. "Loot Pot",
  4544. combatLootPotInfo
  4545. ),
  4546. idleHeroArrowsArea
  4547. );
  4548.  
  4549. getThis.oilTimerNotification();
  4550. setTimeout(function () {
  4551. uitRocket().timeout();
  4552. IdlePixelPlus.plugins["ui-tweaks"].onConfigsChanged();
  4553. }, 20);
  4554.  
  4555. var existingElement = document.getElementById(
  4556. "menu-bar-idlepixelplus-icon"
  4557. ).parentNode;
  4558.  
  4559. var newContainer = document.createElement("div");
  4560. newContainer.setAttribute(
  4561. "onclick",
  4562. "IdlePixelPlus.setPanel('idlepixelplus')"
  4563. );
  4564. newContainer.className = "hover hover-menu-bar-item left-menu-item";
  4565.  
  4566. // Create the inner table structure
  4567. var table = document.createElement("table");
  4568. table.className = "game-menu-bar-left-table-btn left-menu-item-other";
  4569. table.style.width = "100%";
  4570.  
  4571. var tbody = document.createElement("tbody");
  4572. var tr = document.createElement("tr");
  4573. var td1 = document.createElement("td");
  4574. td1.style.width = "30px";
  4575.  
  4576. // Assuming there's only one image in the existing element
  4577. var img = existingElement.querySelector("img");
  4578. img.className = "w30";
  4579. td1.appendChild(img);
  4580.  
  4581. var td2 = document.createElement("td");
  4582. // The text node for 'PLUGINS'
  4583. var textNode = document.createTextNode("PLUGINS");
  4584. td2.appendChild(textNode);
  4585.  
  4586. // Append everything together
  4587. tr.appendChild(td1);
  4588. tr.appendChild(td2);
  4589. tbody.appendChild(tr);
  4590. table.appendChild(tbody);
  4591. newContainer.appendChild(table);
  4592.  
  4593. existingElement.parentNode.replaceChild(newContainer, existingElement);
  4594.  
  4595. if (getThis.getConfig("condensedUI")) {
  4596. getThis.condensedUI();
  4597. } else {
  4598. getThis.defaultUI();
  4599. }
  4600.  
  4601. /*getThis.restructureTopBar();*/
  4602.  
  4603. uitCriptoe().addCriptoeValues();
  4604.  
  4605. // Add event listener to the element
  4606. document.getElementById('raids-team-panel-uuid').addEventListener('click', function (event) {
  4607. // This will copy the text content of the element to the clipboard
  4608. IdlePixelPlus.plugins['ui-tweaks'].copyTextToClipboard(event.target.innerText);
  4609. });
  4610.  
  4611. document.getElementById("raids-team-panel-uuid").addEventListener("click", function (event) {
  4612. // Copy text to clipboard
  4613. navigator.clipboard.writeText(this.innerText).then(() => {
  4614. // Check if the message element already exists, create if not
  4615. let message = document.getElementById("copy-message");
  4616. if (!message) {
  4617. message = document.createElement("div");
  4618. message.id = "copy-message";
  4619. message.style.position = "absolute";
  4620. message.style.backgroundColor = "black";
  4621. message.style.color = "white";
  4622. message.style.padding = "5px";
  4623. message.style.borderRadius = "5px";
  4624. message.style.zIndex = "1000"; // Ensure it appears above other content
  4625. message.style.fontSize = "20px";
  4626. message.innerText = "Password Copied";
  4627. document.getElementById("panel-combat").appendChild(message);
  4628. }
  4629.  
  4630. // Show the "Password Copied" message
  4631. message.style.display = "block";
  4632. message.style.left = `${event.clientX}px`;
  4633. message.style.top = `${event.clientY}px`; // 20 pixels below the cursor for visibility
  4634.  
  4635. // Hide the message after 2 seconds
  4636. setTimeout(() => {
  4637. message.style.display = "none";
  4638. }, 2000);
  4639. }).catch(err => {
  4640. console.error('Failed to copy text: ', err);
  4641. });
  4642. });
  4643. IdlePixelPlus.plugins['ui-tweaks'].addChatDisplayWatcher();
  4644. let archery = document.getElementById("left-panel-item_panel-archery");
  4645. let magic = document.getElementById("left-panel-item_panel-magic");
  4646. let labels = document.getElementById("left-menu-bar-labels");
  4647. archery.className = "";
  4648. magic.className = "";
  4649. archery.querySelector("span[data-menu-bar-skill-label]").style.paddingLeft = "8px";
  4650. magic.querySelector("span[data-menu-bar-skill-label]").style.paddingLeft = "8px";
  4651. labels.style.padding = "unset";
  4652. uitTableLabels().disableTableRefreshBrewing();
  4653. uitTableLabels().Crafting_getMaterials();
  4654. uitTableLabels().Invention_getMaterials();
  4655. uitTableLabels().Modals_changeModal();
  4656. uitHoliday().easter2024();
  4657. uitDustPotions().cloneDust();
  4658. uitMisc().fixGKeys();
  4659.  
  4660.  
  4661. let woodcuttingContainer = document.createElement('span');
  4662. woodcuttingContainer.id = "uit-woodcutting-container";
  4663. woodcuttingContainer.style.display = "flex";
  4664. woodcuttingContainer.style.flexWrap = "wrap";
  4665. let firstWoodcuttingPlot = document.getElementById("panel-woodcutting").querySelector(".farming-plot-wrapper");
  4666. firstWoodcuttingPlot.insertAdjacentElement("beforeBegin", woodcuttingContainer);
  4667. let newWoodcuttingContainer = document.getElementById("uit-woodcutting-container");
  4668. document.getElementById('panel-woodcutting').querySelectorAll('.farming-plot-wrapper').forEach((plot) => {
  4669. newWoodcuttingContainer.insertAdjacentElement('beforeEnd', plot);
  4670. });
  4671.  
  4672. let farmingContainer = document.createElement('span');
  4673. farmingContainer.id = "uit-farming-container";
  4674. farmingContainer.style.display = "flex";
  4675. farmingContainer.style.flexWrap = "wrap";
  4676. let firstPlot = document.getElementById("panel-farming").querySelector(".farming-plot-wrapper");
  4677. firstPlot.insertAdjacentElement("beforeBegin", farmingContainer);
  4678. let newFarmingContainer = document.getElementById("uit-farming-container");
  4679. document.getElementById('panel-farming').querySelectorAll('.farming-plot-wrapper').forEach((plot) => {
  4680. newFarmingContainer.insertAdjacentElement('beforeEnd', plot);
  4681. })
  4682.  
  4683. uitMisc().fixAchiLabels();
  4684.  
  4685. onLoginLoaded = true;
  4686. }
  4687. //////////////////////////////// onLogin End ////////////////////////////////
  4688.  
  4689. clearChat() {
  4690. const chatArea = document.getElementById("chat-area");
  4691. while (chatArea.firstChild) {
  4692. chatArea.removeChild(chatArea.firstChild);
  4693. }
  4694. }
  4695.  
  4696. limitChat() {
  4697. const chatArea = document.getElementById("chat-area");
  4698. const chatLength = chatArea.innerHTML.length;
  4699. const limit = getThis.getConfig("chatLimit");
  4700.  
  4701. if (limit > 0 || chatLength > 190000) {
  4702. const children = chatArea.children;
  4703.  
  4704. if (limit > 0) {
  4705. if (children.length > limit) {
  4706. const toDelete = children.length - limit;
  4707.  
  4708. for (let i = 0; i < toDelete; i++) {
  4709. try {
  4710. chatArea.removeChild(children[i]);
  4711. } catch (err) {
  4712. console.error("Error cleaning up chat", err);
  4713. }
  4714. }
  4715.  
  4716. if (Chat._auto_scroll) {
  4717. chatArea.scrollTop = chatArea.scrollHeight;
  4718. }
  4719. }
  4720. }
  4721.  
  4722. if (chatLength > 190000) {
  4723. for (let i = 0; i < 3; i++) {
  4724. try {
  4725. chatArea.removeChild(children[i]);
  4726. } catch (err) {
  4727. console.error("Error cleaning up chat", err);
  4728. }
  4729. }
  4730. }
  4731. }
  4732. }
  4733.  
  4734. onPanelChanged(panelBefore, panelAfter) {
  4735. if (onLoginLoaded) {
  4736. if (panelAfter = "brewing") {
  4737. uitTableLabels().updateTableCraftLabels();
  4738. }
  4739. uitInvention().hideOrbsAndRing();
  4740.  
  4741. if (panelBefore !== panelAfter && panelAfter === "idlepixelplus") {
  4742. const options = document.querySelectorAll(
  4743. "#idlepixelplus-config-ui-tweaks-font option"
  4744. );
  4745. if (options) {
  4746. options.forEach(function (el) {
  4747. const value = el.getAttribute("value");
  4748. if (value === "IdlePixel Default") {
  4749. el.style.fontFamily = FONT_FAMILY_DEFAULT;
  4750. } else {
  4751. el.style.fontFamily = value;
  4752. }
  4753. });
  4754. }
  4755. }
  4756.  
  4757. if (
  4758. ["farming", "woodcutting", "combat"].includes(panelAfter) &&
  4759. getThis.getConfig("imageTitles")
  4760. ) {
  4761. const images = document.querySelectorAll(`#panel-${panelAfter} img`);
  4762. if (images) {
  4763. images.forEach(function (el) {
  4764. let src = el.getAttribute("src");
  4765. if (src && src !== "x") {
  4766. src = src.replace(/.*\//, "").replace(/\.\w+$/, "");
  4767. el.setAttribute("title", src);
  4768. }
  4769. });
  4770. }
  4771. }
  4772.  
  4773. if (Globals.currentPanel === "panel-brewing" || Globals.currentPanel === "panel-crafting" || Globals.currentPanel === "panel-cooking") {
  4774. uitMisc().recolorTableText();
  4775. }
  4776.  
  4777. if (Globals.currentPanel === "panel-fishing") {
  4778. uitFishing().calcFishEnergy();
  4779. }
  4780.  
  4781. if (Globals.currentPanel === "panel-criptoe-market") {
  4782. uitCriptoe().addCriptoeValues();
  4783. }
  4784. }
  4785. }
  4786.  
  4787. //////////////////////////////// onVariableSet Start ////////////////////////////////
  4788. onVariableSet(key, valueBefore, valueAfter) {
  4789. if (onLoginLoaded) {
  4790. //console.log(new Date() + " " + document.readyState);
  4791. if (Globals.currentPanel != "panel-combat-canvas" && Globals.currentPanel != "panel-combat-canvas-raids") {
  4792. if (key.endsWith("_on")) {
  4793. setTimeout(function () {
  4794. IdlePixelPlus.plugins["ui-tweaks"].miningMachTimer();
  4795. }, 100);
  4796. }
  4797.  
  4798. /*if (Globals.currentPanel == "panel-brewing") {
  4799. uitTableLabels().updateTableCraftLabels();
  4800. }*/
  4801.  
  4802. if (key == "oil") {
  4803. getThis.oilGain();
  4804. }
  4805.  
  4806. if (key == "criptoe" && valueBefore != valueAfter) {
  4807. uitCriptoe().addCriptoeValues();
  4808. }
  4809.  
  4810. if (key.endsWith("_xp")) {
  4811. const varName = `var_ipp_${key}_next`;
  4812. const xp = parseInt(valueAfter || "0");
  4813. const level = uitLevel().xpToLevel(xp);
  4814. const xpAtNext = uitLevel().LEVELS()[level + 1];
  4815. const next = xpAtNext - xp;
  4816. window[varName] = `${next}`;
  4817. }
  4818.  
  4819. if (["oil", "max_oil"].includes(key)) {
  4820. const oil = IdlePixelPlus.getVar("oil");
  4821. const maxOil = IdlePixelPlus.getVar("max_oil");
  4822. if (
  4823. oil &&
  4824. oil == maxOil &&
  4825. getThis.getConfig("oilFullNotification")
  4826. ) {
  4827. document.querySelector(
  4828. "#ui-tweaks-notification-oil-full"
  4829. ).style.display = "";
  4830. } else {
  4831. document.querySelector(
  4832. "#ui-tweaks-notification-oil-full"
  4833. ).style.display = "none";
  4834. }
  4835. }
  4836.  
  4837. if (["oil_in", "oil_out"].includes(key)) {
  4838. const oilIn = getVar("oil_in", 0, "int");
  4839. const oilOut = getVar("oil_out", 0, "int");
  4840. window.var_oil_delta = `${oilIn - oilOut}`;
  4841. }
  4842.  
  4843. getThis.fightPointsFull();
  4844.  
  4845. if (["rocket_km", "rocket_status", "rocket_potion_timer", "rocket_fuel", "rocket_potion"].includes(key)) {
  4846. uitRocket().varChange();
  4847. }
  4848.  
  4849. uitRocket().onVar();
  4850.  
  4851. if (key == "moon_distance" || key == "sun_distance") {
  4852. uitRocket().rocketInfoUpdate(key);
  4853. }
  4854. uitRocket().rocketStatus();
  4855.  
  4856. if (
  4857. [
  4858. "furnace_ore_type",
  4859. "furnace_countdown",
  4860. "furnace_ore_amount_at",
  4861. ].includes(key)
  4862. ) {
  4863. const el = document.querySelector("#notification-furnace-timer");
  4864. const ore = getVar("furnace_ore_type", "none");
  4865. if (ore == "none") {
  4866. el.textContent = "";
  4867. return;
  4868. }
  4869. const timerRemaining = getVar("furnace_countdown", 0, "int");
  4870. const timePerOre = SMELT_TIMES[ore] - 1;
  4871. const startAmount = getVar("furnace_ore_amount_set", 0, "int");
  4872. const doneAmount = getVar("furnace_ore_amount_at", 0, "int");
  4873. const remaining = startAmount - doneAmount - 1;
  4874. const totalTime = remaining * timePerOre + timerRemaining;
  4875. el.textContent = " - " + format_time(totalTime);
  4876. }
  4877.  
  4878. if (key == "combat_loot_potion_active") {
  4879. const loot_pot = getVar("combat_loot_potion_active", 0, "int");
  4880. if (loot_pot == 0) {
  4881. hideElement(
  4882. document.getElementById("notification-loot_pot_avail")
  4883. );
  4884. } else {
  4885. showInlineBlockElement(
  4886. document.getElementById("notification-loot_pot_avail")
  4887. );
  4888. }
  4889. }
  4890.  
  4891. ////////// SD Watch Notification
  4892. const sdWatchCrafted = getVar("stardust_watch_crafted", 0, "int");
  4893. const sdWatchCharges = getVar("stardust_watch_charges", 0, "int");
  4894. if (getThis.getConfig("moveSDWatch") && sdWatchCrafted === 1) {
  4895. hideElement(document.getElementById("notification-stardust_watch"));
  4896. document.querySelector(
  4897. "#menu-bar-sd_watch .sd-watch-charges"
  4898. ).textContent = sdWatchCharges;
  4899. document.querySelector(
  4900. "#menu-bar-sd_watch_2 .sd-watch-charges_2"
  4901. ).textContent = sdWatchCharges;
  4902. } else if (!getThis.getConfig("moveSDWatch") && sdWatchCharges > 0) {
  4903. showElement(document.getElementById("notification-stardust_watch"));
  4904. } else {
  4905. hideElement(document.getElementById("notification-stardust_watch"));
  4906. hideElement(document.getElementById("menu-bar-sd_watch"));
  4907. }
  4908.  
  4909. if (key.startsWith("gathering_working_gathering_loot_bag_")) {
  4910. var today = new Date();
  4911. var time =
  4912. today.getHours().toLocaleString("en-US", {
  4913. minimumIntegerDigits: 2,
  4914. useGrouping: false,
  4915. }) +
  4916. ":" +
  4917. today.getMinutes().toLocaleString("en-US", {
  4918. minimumIntegerDigits: 2,
  4919. useGrouping: false,
  4920. }) +
  4921. ":" +
  4922. today.getSeconds().toLocaleString("en-US", {
  4923. minimumIntegerDigits: 2,
  4924. useGrouping: false,
  4925. });
  4926. var location = key.replace(
  4927. "gathering_working_gathering_loot_bag_",
  4928. ""
  4929. );
  4930. var bagCount = getVar(key, 0, "int").toLocaleString();
  4931. }
  4932.  
  4933. if (key.includes("raw_") || key.includes("cooked_")) {
  4934. if (Globals.currentPanel == "panel-fishing") {
  4935. uitFishing().calcFishEnergy();
  4936. }
  4937. }
  4938.  
  4939. if (key.endsWith("_xp")) {
  4940. uitLevel().extendedLevelsUpdate();
  4941. }
  4942.  
  4943. const hideBoatNotifications = getThis.getConfig("hideBoat");
  4944. const pirate_ship_timer = getVar("pirate_ship_timer", 0, "int");
  4945. const row_boat_timer = getVar("row_boat_timer", 0, "int");
  4946. const canoe_boat_timer = getVar("canoe_boat_timer", 0, "int");
  4947. const stardust_boat_timer = getVar("stardust_boat_timer", 0, "int");
  4948. const submarine_boat_timer = getVar("submarine_boat_timer", 0, "int");
  4949. if (hideBoatNotifications) {
  4950. hideElement(document.getElementById("notification-row_boat"));
  4951. hideElement(document.getElementById("notification-canoe_boat"));
  4952. hideElement(document.getElementById("notification-stardust_boat"));
  4953. hideElement(document.getElementById("notification-pirate_ship"));
  4954. hideElement(document.getElementById("notification-submarine_boat"));
  4955. } else {
  4956. if (row_boat_timer > 0) {
  4957. showElement(document.getElementById("notification-row_boat"));
  4958. }
  4959. if (canoe_boat_timer > 0) {
  4960. showElement(document.getElementById("notification-canoe_boat"));
  4961. }
  4962. if (stardust_boat_timer > 0) {
  4963. showElement(
  4964. document.getElementById("notification-stardust_boat")
  4965. );
  4966. }
  4967. if (pirate_ship_timer > 0) {
  4968. showElement(document.getElementById("notification-pirate_ship"));
  4969. }
  4970. if (submarine_boat_timer > 0) {
  4971. showElement(
  4972. document.getElementById("notification-submarine_boat")
  4973. );
  4974. }
  4975. }
  4976.  
  4977. if (key === "furnace_ore_amount_set") {
  4978. setTimeout(function () {
  4979. var furnaceOreTypeVar = getVar(
  4980. "furnace_ore_amount_set",
  4981. 0,
  4982. "int"
  4983. );
  4984. var furnaceNotifVar = IdlePixelPlus.plugins[
  4985. "ui-tweaks"
  4986. ].getConfig("furnaceEmptyNotification");
  4987.  
  4988. if (furnaceOreTypeVar <= 0 && furnaceNotifVar) {
  4989. document.getElementById(
  4990. "notification-furnace_avail"
  4991. ).style.display = "inline-block";
  4992. } else {
  4993. hideElement(
  4994. document.getElementById("notification-furnace_avail")
  4995. );
  4996. }
  4997. }, 500);
  4998. }
  4999.  
  5000. if (key.startsWith("nades_purple_key")) {
  5001. let purpKeyMonst = getVar("nades_purple_key_monster", "", "string");
  5002. let purpKeyRarity = getVar("nades_purple_key_rarity", "", "string");
  5003. let purpKeyTimer = getVar("nades_purple_key_timer", 0, "int");
  5004.  
  5005. uitPurpleKey().onPurpleKey(
  5006. purpKeyMonst,
  5007. purpKeyRarity,
  5008. purpKeyTimer
  5009. );
  5010. }
  5011.  
  5012. if (key === "playtime") {
  5013. uitCriptoe().updateCrippledToeTimer();
  5014. }
  5015. }
  5016. ////////// Allowed to Run while in combat
  5017. ////////// Current FP with Timer (Left Sidecar)
  5018. if (Globals.currentPanel == "panel-combat-canvas") {
  5019. var currentFP = getVar("fight_points", 0, "int").toLocaleString();
  5020. var rarePotTimer = getVar("rare_monster_potion_timer", 0, "int");
  5021. var rarePotPlusTimer = getVar(
  5022. "super_rare_monster_potion_timer",
  5023. 0,
  5024. "int"
  5025. );
  5026. var rarePotInfo = "";
  5027.  
  5028. if (rarePotTimer > 0) {
  5029. rarePotInfo = rarePotTimer;
  5030. } else if (rarePotPlusTimer > 0) {
  5031. rarePotInfo = format_time(rarePotPlusTimer);
  5032. } else {
  5033. rarePotInfo = "Inactive";
  5034. }
  5035.  
  5036. var combatLootPotActive = getVar(
  5037. "combat_loot_potion_active",
  5038. 0,
  5039. "int"
  5040. );
  5041. var combatLootPotInfo = combatLootPotActive ? "Active" : "Inactive";
  5042.  
  5043. document.getElementById(
  5044. "combat-info-fight_point-right-fp"
  5045. ).textContent = " " + currentFP;
  5046. document.getElementById(
  5047. "combat-info-fight_point-left-fp"
  5048. ).textContent = " " + currentFP;
  5049. document.getElementById("combat-info-rare_pot-right-rp").textContent =
  5050. " " + rarePotInfo;
  5051. document.getElementById("combat-info-rare_pot-left-rp").textContent =
  5052. " " + rarePotInfo;
  5053. document.getElementById("combat-info-loot_pot-right-lp").textContent =
  5054. " " + combatLootPotInfo;
  5055. document.getElementById("combat-info-loot_pot-left-lp").textContent =
  5056. " " + combatLootPotInfo;
  5057. }
  5058.  
  5059. function setTransform(element, transformValue) {
  5060. element.style.transform = transformValue;
  5061. }
  5062.  
  5063. function clearTransform(element) {
  5064. element.style.transform = "";
  5065. }
  5066.  
  5067. function showInlineBlockElement(element) {
  5068. element.style.display = "inline-block";
  5069. }
  5070.  
  5071. function showBlockElement(element) {
  5072. element.style.display = "block";
  5073. }
  5074.  
  5075. function showElement(element) {
  5076. element.style.display = "";
  5077. }
  5078.  
  5079. function showFlexElement(element) {
  5080. element.style.display = "block";
  5081. }
  5082.  
  5083. function hideElement(element) {
  5084. element.style.display = "none";
  5085. }
  5086.  
  5087. if (key == "playtime") {
  5088. utcDate = new Date().getUTCDate();
  5089. if (utcDate != currUTCDate) {
  5090. currUTCDate = utcDate;
  5091. //console.log(`UTCDate is now: ${currUTCDate}, and the criptoe update has fired off.`);
  5092. uitCriptoe().addCriptoeValues();
  5093. }
  5094. }
  5095. if (key == "in_raids" && valueAfter == 1) {
  5096. document.getElementById('raids-advert-button').style.display = 'none';
  5097. document.getElementById('raids-start-button').style.display = 'none';
  5098. }
  5099. }
  5100. }
  5101. //////////////////////////////// onVariableSet end ////////////////////////////////
  5102.  
  5103. onChat(data) {
  5104. getThis.updateColors(CHAT_UPDATE_FILTER);
  5105. getThis.limitChat();
  5106. IdlePixelPlus.plugins['ui-tweaks'].makeUUIDClickable();
  5107. IdlePixelPlus.plugins['ui-tweaks'].convertNameLinks();
  5108. const el = $("#chat-area > *").last();
  5109. el.html(uitMisc().replaceLinks(el.html()));
  5110. }
  5111.  
  5112. onMessageReceived(data) {
  5113. if (data.startsWith("OPEN_DIALOGUE_CALLBACK=NO TEAM") && uitSoloRaiding) {
  5114. uitSoloRaiding = false;
  5115. document.getElementById('modal-image-btn-primary').click();
  5116. }
  5117. }
  5118.  
  5119. onCombatEnd() {
  5120. getThis.updateColors(PANEL_UPDATE_FILTER);
  5121. getThis.updateColors();
  5122. }
  5123.  
  5124. makeUUIDClickable() {
  5125. const regex = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi;
  5126. let chatArea = document.getElementById("chat-area");
  5127. let lastMessageElement = chatArea.lastChild;
  5128. let player = lastMessageElement.querySelector('.chat-username').innerText;
  5129. let bgColor = `background-color: ${IdlePixelPlus.plugins['ui-tweaks'].getConfig('background-color-chat-area-raid-password')}; `;
  5130. let fColor = `color: ${IdlePixelPlus.plugins['ui-tweaks'].getConfig('font-color-chat-area-chat-raid-password')}; `;
  5131.  
  5132. if (lastMessageElement && 'innerHTML' in lastMessageElement) {
  5133. let lastMessage = lastMessageElement.innerHTML;
  5134. lastMessage = lastMessage.replace(regex, function (match) {
  5135. //console.log("Found UUID");
  5136. return `<a href="#" style="${bgColor}${fColor}font-weight: bold; font-style:italic" onclick="IdlePixelPlus.plugins['ui-tweaks'].sendRaidJoinMessage('${match}'); switch_panels('panel-combat'); document.getElementById('game-panels-combat-items-area').style.display = 'none';document.getElementById('combat-stats').style.display = 'none';document.getElementById('game-panels-combat-raids').style.display = ''; return false;">${player} Raid</a>`;
  5137. });
  5138.  
  5139. lastMessageElement.innerHTML = lastMessage;
  5140. } else {
  5141. console.log("No valid last message element found");
  5142. }
  5143. }
  5144.  
  5145. convertNameLinks() {
  5146. if( IdlePixelPlus.plugins['ui-tweaks'].getConfig("convertNameLink") ) {
  5147. let chatArea = document.getElementById("chat-area");
  5148. let lastMessageElement = chatArea.lastChild;
  5149. let player = lastMessageElement.querySelector('.chat-username').innerText;
  5150. lastMessageElement.querySelector('.chat-username').href = `https://data.idle-pixel.com/compare/?player1=${window['var_username']}&player2=${player}`;
  5151. }
  5152. }
  5153.  
  5154. sendRaidJoinMessage(uuid) {
  5155. websocket.send(`JOIN_RAID_TEAM=${uuid}`);
  5156. }
  5157.  
  5158. copyTextToClipboard(text) {
  5159. navigator.clipboard.writeText(text).then(function () {
  5160. //console.log('Copying to clipboard was successful!');
  5161. }, function (err) {
  5162. console.error('Could not copy text: ', err);
  5163. });
  5164. }
  5165.  
  5166. }
  5167.  
  5168. const elementsWithWidth = document.querySelectorAll("[width]");
  5169. elementsWithWidth.forEach(function (el) {
  5170. el.setAttribute("original-width", el.getAttribute("width"));
  5171. });
  5172.  
  5173. const elementsWithHeight = document.querySelectorAll("[height]");
  5174. elementsWithHeight.forEach(function (el) {
  5175. el.setAttribute("original-height", el.getAttribute("height"));
  5176. });
  5177.  
  5178. const plugin = new UITweaksPlugin();
  5179. IdlePixelPlus.registerPlugin(plugin);
  5180. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址