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