IdlePixel+ Overview Panel

Single panel to control many skills

  1. // ==UserScript==
  2. // @name IdlePixel+ Overview Panel
  3. // @namespace lbtechnology.info
  4. // @version 1.5.2
  5. // @description Single panel to control many skills
  6. // @author Lux-Ferre
  7. // @license MIT
  8. // @match *://idle-pixel.com/login/play*
  9. // @grant none
  10. // @require https://gf.qytechs.cn/scripts/441206-idlepixel/code/IdlePixel+.js?anticache=20220905
  11. // @require https://gf.qytechs.cn/scripts/491983-idlepixel-plugin-paneller/code/IdlePixel%2B%20Plugin%20Paneller.js?anticache=20240808
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16.  
  17. class OverviewPlugin extends IdlePixelPlusPlugin {
  18. constructor() {
  19. super("overview", {
  20. about: {
  21. name: GM_info.script.name,
  22. version: GM_info.script.version,
  23. author: GM_info.script.author,
  24. description: GM_info.script.description
  25. },
  26. config: [
  27. {
  28. id: "colNum",
  29. label: "Number of modules per row",
  30. type: "integer",
  31. min: 1,
  32. max: 12,
  33. default: 3
  34. },
  35. {
  36. id: "farmingEnabled",
  37. label: "farmingEnabled",
  38. type: "boolean",
  39. default: true
  40. },
  41. {
  42. id: "gatheringEnabled",
  43. label: "gatheringEnabled",
  44. type: "boolean",
  45. default: true
  46. },
  47. {
  48. id: "mineralsEnabled",
  49. label: "mineralsEnabled",
  50. type: "boolean",
  51. default: true
  52. },
  53. {
  54. id: "woodcuttingEnabled",
  55. label: "woodcuttingEnabled",
  56. type: "boolean",
  57. default: true
  58. },
  59. {
  60. id: "smeltingEnabled",
  61. label: "smeltingEnabled",
  62. type: "boolean",
  63. default: true
  64. },
  65. {
  66. id: "cookingEnabled",
  67. label: "cookingEnabled",
  68. type: "boolean",
  69. default: true
  70. },
  71. {
  72. id: "brewingEnabled",
  73. label: "brewingEnabled",
  74. type: "boolean",
  75. default: true
  76. },
  77. {
  78. id: "fishingEnabled",
  79. label: "fishingEnabled",
  80. type: "boolean",
  81. default: false
  82. },
  83. {
  84. id: "machineryEnabled",
  85. label: "machineryEnabled",
  86. type: "boolean",
  87. default: false
  88. },
  89. {
  90. id: "hiddenItems",
  91. label: "Do not edit manually. Use GUI.",
  92. type: "string",
  93. default: ""
  94. }
  95. ]
  96. });
  97. this.previous = "";
  98. this.hiddenConfigActive = false;
  99. }
  100.  
  101. onConfigsChanged() {
  102. this.applyConfigs()
  103. }
  104.  
  105. onLogin() {
  106. window["var_show_item"] = 1 // For overriding Smitty's itembox hiding
  107. this.loadHiddenItems()
  108.  
  109. Paneller.registerPanel("overview", "Overview")
  110.  
  111. this.addStyles()
  112. this.createPanel()
  113. this.addBonemealbinToPanel()
  114. this.addMeteorsToPanel()
  115. this.toggleMultiHarvest()
  116. this.addGatheringAreasToPanel()
  117. this.highlightGathering()
  118. this.applyConfigs()
  119.  
  120. const standardItemBoxes = {
  121. overviewLogsContainer: {
  122. itemList: ["logs", "oak_logs", "willow_logs", "maple_logs", "stardust_logs", "pine_logs", "redwood_logs", "dense_logs"],
  123. onClickString: "IdlePixelPlus.plugins['overview'].clicksLogs(this.getAttribute('ov-data-item'))",
  124. onContextMenu: ""
  125. },
  126. overviewBonemealContainer: {
  127. itemList: ["bones", "big_bones", "ice_bones", "blood_bones", "dragon_bones", "ashes"],
  128. onClickString: "IdlePixelPlus.plugins['overview'].clicksBones(this.getAttribute('ov-data-item'), 'left')",
  129. onContextMenu: "IdlePixelPlus.plugins['overview'].clicksBones(this.getAttribute('ov-data-item'), 'right'); return false;"
  130. },
  131. overviewSeedsContainer: {
  132. itemList: [
  133. "dotted_green_leaf_seeds", "green_leaf_seeds", "lime_leaf_seeds", "gold_leaf_seeds",
  134. "crystal_leaf_seeds", "red_mushroom_seeds", "stardust_seeds", "tree_seeds", "oak_tree_seeds",
  135. "willow_tree_seeds", "maple_tree_seeds", "stardust_tree_seeds", "pine_tree_seeds", "redwood_tree_seeds",
  136. "apple_tree_seeds", "banana_tree_seeds", "orange_tree_seeds", "palm_tree_seeds", "dragon_fruit_tree_seeds",
  137. "bone_tree_seeds", "lava_tree_seeds", "strange_tree_seeds", "potato_seeds", "carrot_seeds", "beet_seeds", "broccoli_seeds"
  138. ],
  139. onClickString: "IdlePixelPlus.plugins['overview'].clicksSeeds(this.getAttribute('ov-data-item'), 'left')",
  140. onContextMenu: "IdlePixelPlus.plugins['overview'].clicksSeeds(this.getAttribute('ov-data-item'), 'right'); return false;"
  141. },
  142. overviewBarsContainer: {
  143. itemList: ["bronze_bar", "iron_bar", "silver_bar", "gold_bar", "promethium_bar", "titanium_bar", "ancient_bar", "dragon_bar"],
  144. onClickString: "Modals.open_stardust_or_sell_item_dialogue('crafting', this.getAttribute('ov-data-item'))",
  145. onContextMenu: "IdlePixelPlus.plugins['overview'].rightClicksBars(this.getAttribute('ov-data-item')); return false;"
  146. },
  147. overviewOresContainer: {
  148. itemList: ["stone", "copper", "iron", "silver", "gold", "promethium", "titanium", "ancient_ore", "dragon_ore"],
  149. onClickString: "Modals.open_stardust_or_sell_item_dialogue('mining', this.getAttribute('ov-data-item'))",
  150. onContextMenu: ""
  151. },
  152. overviewRecipeContainer: {
  153. itemList: ["dotted_salad", "chocolate_cake", "lime_leaf_salad", "golden_apple", "banana_jello", "orange_pie", "pancakes", "coconut_stew", "dragon_fruit_salad",
  154. "potato_shake", "carrot_shake", "beet_shake", "broccoli_shake"],
  155. onClickString: "IdlePixelPlus.plugins['overview'].clicksRecipe(this.getAttribute('ov-data-item'), 'left')",
  156. onContextMenu: "IdlePixelPlus.plugins['overview'].clicksRecipe(this.getAttribute('ov-data-item'), 'right'); return false;"
  157. },
  158. overviewGatheringBagsContainer: {
  159. itemList: ["gathering_loot_bag_mines", "gathering_loot_bag_fields", "gathering_loot_bag_forest", "gathering_loot_bag_fishing_pond",
  160. "gathering_loot_bag_kitchen", "gathering_loot_bag_gem_mine", "gathering_loot_bag_castle", "gathering_loot_bag_junk"],
  161. onClickString: "IdlePixelPlus.plugins['overview'].clicksBags(this.getAttribute('ov-data-item'), 'left')",
  162. onContextMenu: "IdlePixelPlus.plugins['overview'].clicksBags(this.getAttribute('ov-data-item'), 'right'); return false;"
  163. },
  164. overviewGemContainer: {
  165. itemList: ["sapphire", "emerald", "ruby", "diamond", "blood_diamond"],
  166. onClickString: "",
  167. onContextMenu: ""
  168. },
  169. overviewSDCrystalContainer: {
  170. itemList: ["small_stardust_prism", "medium_stardust_prism", "large_stardust_prism", "huge_stardust_prism"],
  171. onClickString: "IdlePixelPlus.plugins['overview'].clicksSDCrystals(this.getAttribute('ov-data-item'), 'left')",
  172. onContextMenu: "IdlePixelPlus.plugins['overview'].clicksSDCrystals(this.getAttribute('ov-data-item'), 'right'); return false;"
  173. },
  174. overviewGeodeContainer: {
  175. itemList: ["grey_geode", "blue_geode", "green_geode", "red_geode", "cyan_geode", "ancient_geode"],
  176. onClickString: "IdlePixelPlus.plugins['overview'].clicksGeode(this.getAttribute('ov-data-item'), 'left')",
  177. onContextMenu: "IdlePixelPlus.plugins['overview'].clicksGeode(this.getAttribute('ov-data-item'), 'right'); return false;"
  178. },
  179. overviewMineralContainer: {
  180. itemList: ["blue_marble_mineral", "amethyst_mineral", "sea_crystal_mineral", "dense_marble_mineral", "fluorite_mineral", "clear_marble_mineral",
  181. "jade_mineral", "lime_quartz_mineral", "opal_mineral", "purple_quartz_mineral", "amber_mineral", "smooth_pearl_mineral",
  182. "sulfer_mineral", "topaz_mineral", "tanzanite_mineral", "magnesium_mineral", "frozen_mineral", "blood_crystal_mineral"],
  183. onClickString: "IdlePixelPlus.plugins['overview'].clicksMineral(this.getAttribute('ov-data-item'), 'left')",
  184. onContextMenu: "IdlePixelPlus.plugins['overview'].clicksMineral(this.getAttribute('ov-data-item'), 'right'); return false;"
  185. },
  186. overviewPotionContainer: {
  187. itemList: ["stardust_potion", "energy_potion", "anti_disease_potion", "tree_speed_potion", "smelting_upgrade_potion", "great_stardust_potion", "farming_speed_potion",
  188. "rare_monster_potion", "super_stardust_potion", "gathering_unique_potion", "heat_potion", "bait_potion", "bone_potion", "furnace_speed_potion", "promethium_potion",
  189. "super_rare_monster_potion", "ultra_stardust_potion", "cooks_dust_potion", "fighting_dust_potion", "tree_dust_potion", "farm_dust_potion",
  190. "magic_shiny_crystal_ball_potion", "birdhouse_potion", "rocket_potion", "titanium_potion", "blue_orb_potion", "geode_potion", "magic_crystal_ball_potion",
  191. "stone_converter_potion", "rain_potion", "combat_loot_potion", "rotten_potion", "merchant_speed_potion", "green_orb_potion", "ancient_potion", "guardian_key_potion",
  192. "red_orb_potion"],
  193. onClickString: "IdlePixelPlus.plugins['overview'].clicksPotion(this.getAttribute('ov-data-item'))",
  194. onContextMenu: "IdlePixelPlus.plugins['overview'].rightClicksPotion(this.getAttribute('ov-data-item')); return false;"
  195. }
  196. /*,
  197. template: {
  198. itemList: [],
  199. onClickString: "",
  200. onContextMenu: ""
  201. }*/
  202. }
  203.  
  204. for (const [containerId, itemData] of Object.entries(standardItemBoxes)) {
  205. this.addStandardItemsToPanel(containerId, itemData)
  206. }
  207. this.hideHiddenItems()
  208. }
  209.  
  210. onMessageReceived(data) {
  211. if(Globals.currentPanel !== "panel-overview"){return;}
  212. if (data.startsWith("SET_ITEMS")){
  213. this.updatePanelTrees()
  214. this.updatePanelPlants()
  215. this.updatePanelCooking()
  216. this.updateSmeltingPanel()
  217. }
  218. }
  219.  
  220. addStyles(){
  221. let borderColour
  222.  
  223. if ("ui-tweaks" in IdlePixelPlus.plugins){
  224. borderColour = IdlePixelPlus.plugins["ui-tweaks"].config["font-color-panels"]
  225. } else {
  226. borderColour = "black"
  227. }
  228.  
  229. $("head").append(`
  230. <style id="styles-overview">
  231. .overviewSkillModule {
  232. border-radius: 3px;
  233. border-style: outset;
  234. }
  235. .overviewGatheringBoxArea {
  236. width: 150px;
  237. height: 150px;
  238. border-radius: 30px;
  239. }
  240. .overviewGatheringBoxSelected {
  241. box-shadow: 0 0 15px #80ed6f;
  242. }
  243. .overviewDottedBorder {
  244. border-radius: 2px;
  245. border: 1px dotted ${borderColour};
  246. }
  247. .overviewHiddenItem {
  248. display: none;
  249. }
  250. .overviewConfigCover {
  251. position: absolute;
  252. width: 100px;
  253. height: 100px;
  254. border-radius: 5pt;
  255. }
  256. .overviewHiddenCover {
  257. z-index: -1;
  258. }
  259. .overviewConfigShown {
  260. background-color: rgba(0, 200, 0, 25%);
  261. }
  262. .overviewConfigHidden {
  263. background-color: rgba(200, 0, 0, 25%);
  264. }
  265. </style>
  266. `)
  267. }
  268.  
  269. createPanel(){
  270. const title = `<span>Overview</span><span><button type="button" class="btn btn-outline-primary" style="margin-left: 2%;" onclick="IdlePixelPlus.plugins['overview'].toggleHideConfig()">Hide Items</button></span>`
  271.  
  272. IdlePixelPlus.addPanel("overview", title, function() {
  273. const content = `
  274. <div id="overviewTopLevelRow" class="row row-cols-3 d-flex flex-wrap">
  275. <div id="overviewFarmingModule" class="col overviewSkillModule">
  276. <div id="overviewBonemealContainer" class="row g-0 d-flex justify-content-evenly overviewDottedBorder"></div>
  277. <div id="overviewSeedsContainer" class="row g-0 d-flex justify-content-evenly overviewDottedBorder"></div>
  278. <div id="overviewFarmingPlotContainer" class="row farming-patches-area g-0 overviewDottedBorder">
  279. <div id="overviewFarmingPlot-1" class="col text-center d-flex flex-column align-items-center"><img id="overviewFarmingPatchImg-1" class="farming-patch" src="https://idlepixel.s3.us-east-2.amazonaws.com/images/woodcutting_none.png" width="75" onclick="Farming.clicksPlot(1)" /><label id="overviewFarmingTimer-1" class="form-label">0</label></div>
  280. <div id="overviewFarmingPlot-2" class="col text-center d-flex flex-column align-items-center"><img id="overviewFarmingPatchImg-2" class="farming-patch" src="https://idlepixel.s3.us-east-2.amazonaws.com/images/woodcutting_none.png" width="75" onclick="Farming.clicksPlot(2)" /><label id="overviewFarmingTimer-2" class="form-label">0</label></div>
  281. <div id="overviewFarmingPlot-3" class="col text-center d-flex flex-column align-items-center"><img id="overviewFarmingPatchImg-3" class="farming-patch" src="https://idlepixel.s3.us-east-2.amazonaws.com/images/woodcutting_none.png" width="75" onclick="Farming.clicksPlot(3)" /><label id="overviewFarmingTimer-3" class="form-label">0</label></div>
  282. <div id="overviewFarmingPlot-4" class="col text-center d-flex flex-column align-items-center"><img id="overviewFarmingPatchImg-4" class="farming-patch" src="https://idlepixel.s3.us-east-2.amazonaws.com/images/woodcutting_none.png" width="75" onclick="Farming.clicksPlot(4)" /><label id="overviewFarmingTimer-4" class="form-label">0</label></div>
  283. <div id="overviewFarmingPlot-5" class="col text-center d-flex flex-column align-items-center"><img id="overviewFarmingPatchImg-5" class="farming-patch" src="https://idlepixel.s3.us-east-2.amazonaws.com/images/woodcutting_none.png" width="75" onclick="Farming.clicksPlot(5)" /><label id="overviewFarmingTimer-5" class="form-label">0</label></div>
  284. </div>
  285. <div class="row">
  286. <div class="col text-center overviewDottedBorder"><button id="overviewHarvestAll" class="btn btn-primary" type="button" onclick="sCFarming().quickHarvest()">Harvest All</button></div>
  287. </div>
  288. </div>
  289. <div id="overviewGatheringModule" class="col overviewSkillModule">
  290. <div id="overviewGatheringBagsContainer" class="row g-0 d-flex justify-content-evenly overviewDottedBorder"></div>
  291. <div id="overviewGatheringAreasContainer" class="row g-0 d-flex justify-content-evenly overviewDottedBorder"></div>
  292. </div>
  293. <div id="overviewMineralModule" class="col overviewSkillModule">
  294. <div id="overviewGemContainer" class="row g-0 d-flex justify-content-evenly overviewDottedBorder"></div>
  295. <div id="overviewSDCrystalContainer" class="row g-0 d-flex justify-content-evenly overviewDottedBorder"></div>
  296. <div id="overviewGeodeContainer" class="row g-0 d-flex justify-content-evenly overviewDottedBorder"></div>
  297. <div id="overviewMineralContainer" class="row g-0 d-flex justify-content-evenly overviewDottedBorder"></div>
  298. </div>
  299. <div id="overviewWoodcuttingModule" class="col overviewSkillModule">
  300. <div class="row">
  301. <div class="col-lg-3 overviewDottedBorder">
  302. <div>
  303. <div class="form-check"><input id="overviewUseLogsNone" class="form-check-input" type="radio" checked name="overviewUseLogsType" value="none" /><label class="form-check-label" for="overviewUseLogsNone">None</label></div>
  304. <div class="form-check"><input id="overviewUseLogsHeat" class="form-check-input" type="radio" name="overviewUseLogsType" value="heat" /><label class="form-check-label" for="overviewUseLogsHeat">Heat</label></div>
  305. <div class="form-check"><input id="overviewUseLogsCharcoal" class="form-check-input" type="radio" name="overviewUseLogsType" value="charcoal" /><label class="form-check-label" for="overviewUseLogsCharcoal">Charcoal</label></div>
  306. </div>
  307. </div>
  308. <div class="col">
  309. <div id="overviewLogsContainer" class="row g-0 d-flex justify-content-evenly overviewDottedBorder"></div>
  310. </div>
  311. </div>
  312. <div id="overviewWCPlotContainer" class="row farming-patches-area g-0 overviewDottedBorder">
  313. <div id="overviewWCPlot-1" class="col text-center d-flex flex-column align-items-center"><img id="overviewWoodcuttingPatchImg-1" class="farming-patch" src="https://idlepixel.s3.us-east-2.amazonaws.com/images/woodcutting_none.png" width="75" onclick="Woodcutting.clicksPlot(1)" /><label id="overviewWoodcuttingTimer-1" class="form-label">0</label></div>
  314. <div id="overviewWCPlot-2" class="col text-center d-flex flex-column align-items-center"><img id="overviewWoodcuttingPatchImg-2" class="farming-patch" src="https://idlepixel.s3.us-east-2.amazonaws.com/images/woodcutting_none.png" width="75" onclick="Woodcutting.clicksPlot(2)" /><label id="overviewWoodcuttingTimer-2" class="form-label">0</label></div>
  315. <div id="overviewWCPlot-3" class="col text-center d-flex flex-column align-items-center"><img id="overviewWoodcuttingPatchImg-3" class="farming-patch" src="https://idlepixel.s3.us-east-2.amazonaws.com/images/woodcutting_none.png" width="75" onclick="Woodcutting.clicksPlot(3)" /><label id="overviewWoodcuttingTimer-3" class="form-label">0</label></div>
  316. <div id="overviewWCPlot-4" class="col text-center d-flex flex-column align-items-center"><img id="overviewWoodcuttingPatchImg-4" class="farming-patch" src="https://idlepixel.s3.us-east-2.amazonaws.com/images/woodcutting_none.png" width="75" onclick="Woodcutting.clicksPlot(4)" /><label id="overviewWoodcuttingTimer-4" class="form-label">0</label></div>
  317. <div id="overviewWCPlot-5" class="col text-center d-flex flex-column align-items-center"><img id="overviewWoodcuttingPatchImg-5" class="farming-patch" src="https://idlepixel.s3.us-east-2.amazonaws.com/images/woodcutting_none.png" width="75" onclick="Woodcutting.clicksPlot(5)" /><label id="overviewWoodcuttingTimer-5" class="form-label">0</label></div>
  318. </div>
  319. <div class="row">
  320. <div class="col text-center overviewDottedBorder"><button id="overviewChopAll" class="btn btn-primary" type="button" onclick="sCWoodcutting().quickChop()">Chop All</button></div>
  321. </div>
  322. </div>
  323. <div id="overviewSmeltingModule" class="col overviewSkillModule">
  324. <div class="row">
  325. <div class="col">
  326. <div class="row">
  327. <div class="col d-flex justify-content-between overviewDottedBorder"><label class="form-label">Oil</label><label id="overviewOilNum" class="form-label">0</label></div>
  328. </div>
  329. <div class="row">
  330. <div class="col d-flex justify-content-between overviewDottedBorder"><label class="form-label">Lava</label><label id="overviewLavaNum" class="form-label">0</label></div>
  331. </div>
  332. <div class="row">
  333. <div class="col d-flex justify-content-between overviewDottedBorder"><label class="form-label">Buckets</label><label id="overviewBucketsNum" class="form-label">0</label></div>
  334. </div>
  335. </div>
  336. <div class="col text-center align-self-center"><img id="overviewFurnaceIcon" src="https://idlepixel.s3.us-east-2.amazonaws.com/images/promethium_furnace.png" onclick="Modals.open_furnace_dialogue()" /></div>
  337. <div class="col">
  338. <div class="row">
  339. <div class="col d-flex justify-content-between overviewDottedBorder"><label class="form-label">Charcoal</label><label id="overviewCharcoalNum" class="form-label">0</label></div>
  340. </div>
  341. <div class="row">
  342. <div class="col d-flex justify-content-between overviewDottedBorder"><label class="form-label">Plasma</label><label id="overviewPlasmaNum" class="form-label">0</label></div>
  343. </div>
  344. <div class="row">
  345. <div class="col d-flex justify-content-between overviewDottedBorder"><label class="form-label">D. Fire</label><label id="overviewDFireNum" class="form-label">0</label></div>
  346. </div>
  347. </div>
  348. </div>
  349. <div id="overviewBarsContainer" class="row g-0 d-flex justify-content-evenly overviewDottedBorder"></div>
  350. <div id="overviewOresContainer" class="row g-0 d-flex justify-content-evenly overviewDottedBorder"></div>
  351. </div>
  352. <div id="overviewCookingModule" class="col overviewSkillModule">
  353. <div class="row">
  354. <div class="col-xl-4 text-center align-self-center overviewDottedBorder"><img id="overviewCooksBookItem" style="width: 100px;height: 100px;" onclick="IdlePixelPlus.plugins[&#39;overview&#39;].clicksCooksBook(&#39;left&#39;)" oncontextmenu="IdlePixelPlus.plugins[&#39;overview&#39;].clicksCooksBook(&#39;right&#39;); return false;" /></div>
  355. <div class="col text-center align-self-center overviewDottedBorder"><label id="overviewCooksBookTimer" class="col-form-label">0</label></div>
  356. </div>
  357. <div id="overviewRecipeContainer" class="row g-0 d-flex justify-content-evenly overviewDottedBorder"></div>
  358. </div>
  359. <div id="overviewBrewingModule" class="col overviewSkillModule">
  360. <div id="overviewPotionContainer" class="row g-0 d-flex justify-content-evenly overviewDottedBorder"></div>
  361. </div>
  362. <div id="overviewFishingModule" class="col overviewSkillModule"></div>
  363. <div id="overviewMachineryModule" class="col overviewSkillModule"></div>
  364. </div>
  365. `
  366. return content
  367. });
  368. }
  369.  
  370. applyConfigs() {
  371. // Modules per row
  372. const colClass = "row-cols-" + this.getConfig("colNum")
  373. const topLevel = $("#overviewTopLevelRow")
  374.  
  375. for(let i = 0; i <= 12 ; i++) {
  376. const oldClass = `row-cols-${i}`
  377. topLevel.removeClass(oldClass)
  378. }
  379.  
  380. topLevel.addClass(colClass)
  381.  
  382. // Enable/disable modules
  383. const moduleList = [
  384. ["farmingEnabled", "overviewFarmingModule"],
  385. ["gatheringEnabled", "overviewGatheringModule"],
  386. ["mineralsEnabled", "overviewMineralModule"],
  387. ["woodcuttingEnabled", "overviewWoodcuttingModule"],
  388. ["smeltingEnabled", "overviewSmeltingModule"],
  389. ["cookingEnabled", "overviewCookingModule"],
  390. ["brewingEnabled", "overviewBrewingModule"],
  391. ["fishingEnabled", "overviewFishingModule"],
  392. ["machineryEnabled", "overviewMachineryModule"]
  393. ]
  394.  
  395. moduleList.forEach(module => {
  396. const moduleEnabled = this.getConfig(module[0])
  397.  
  398. const moduleLocation = $(`#${module[1]}`)
  399.  
  400. if (moduleEnabled){
  401. moduleLocation.show()
  402. } else {
  403. moduleLocation.hide()
  404. }
  405. })
  406. }
  407.  
  408. formatTimeWithDays(timeInSecs) {
  409. let timerStr = "";
  410. const hour24 = 24 * 60 * 60;
  411.  
  412. const timerDays = Math.floor(timeInSecs / hour24);
  413. if(timeInSecs > hour24) {
  414. timerStr = `${timerDays}d ${format_time(timeInSecs - (timerDays * hour24))}`
  415. } else {
  416. timerStr = `${format_time(timeInSecs - (timerDays * hour24))}`
  417. }
  418.  
  419. return timerStr;
  420. }
  421.  
  422. getFurnace(){
  423. const furnaceList = ["dragon_furnace", "ancient_furnace", "titanium_furnace", "promethium_furnace", "gold_furnace",
  424. "silver_furnace", "iron_furnace", "bronze_furnace", "stone_furnace"]
  425. for(let i = 0; i < furnaceList.length; i++) {
  426. const furnace = furnaceList[i]
  427. if(window["var_"+furnace]){
  428. return furnace
  429. }
  430. }
  431. return "";
  432. }
  433.  
  434. addStandardItemsToPanel(containerId, itemData){
  435. const itemList = itemData.itemList
  436. const itemOnClick = itemData.onClickString
  437. const itemRightClick = itemData.onContextMenu
  438.  
  439. itemList.forEach((itemType) => {
  440. const itemElementString = `<div class="col d-flex justify-content-center overviewItemBoxContainer">
  441. <div class="overviewConfigCover overviewHiddenCover" ov-data-item="${itemType}" onclick="IdlePixelPlus.plugins['overview'].toggleCover(this)"></div>
  442. <itembox data-item="show_item" ov-data-item="${itemType}" id="overview-itembox-${itemType}" onclick="${itemOnClick}" onContextMenu="${itemRightClick}" class="shadow hover">
  443. <div class="center mt-1"><img src="https://d1xsc8x7nc5q8t.cloudfront.net/images/${itemType}.png" title="${itemType}"></div>
  444. <div class="center mt-2"> <item-display data-format="number" data-key="${itemType}"></item-display></div>
  445. </itembox>
  446. </div>`
  447. const itemBox = $.parseHTML(itemElementString)
  448. $(`#${containerId}`).append(itemBox)
  449. })
  450. }
  451.  
  452. addGatheringAreasToPanel(){
  453. const areaData = [
  454. {
  455. id: "overviewGatheringBoxMines",
  456. background: "background-dark-grey",
  457. image: "gathering_mine.png",
  458. name: "mines"
  459. },
  460. {
  461. id: "overviewGatheringBoxFields",
  462. background: "background-dark-green",
  463. image: "gathering_field.png",
  464. name: "fields"
  465. },
  466. {
  467. id: "overviewGatheringBoxForest",
  468. background: "background-brown",
  469. image: "gathering_forest.png",
  470. name: "forest"
  471. },
  472. {
  473. id: "overviewGatheringBoxFishingPond",
  474. background: "background-dark-blue",
  475. image: "gathering_fishing_pond.png",
  476. name: "fishing_pond"
  477. },
  478. {
  479. id: "overviewGatheringBoxKitchen",
  480. background: "background-dark-orange",
  481. image: "gathering_kitchen.png",
  482. name: "kitchen"
  483. },
  484. {
  485. id: "overviewGatheringBoxGemMine",
  486. background: "background-dark-cyan",
  487. image: "gathering_gem_mine.png",
  488. name: "gem_mine"
  489. },
  490. {
  491. id: "overviewGatheringBoxCastle",
  492. background: "background-veryrare",
  493. image: "gathering_castle.png",
  494. name: "castle"
  495. }
  496. ]
  497.  
  498. areaData.forEach((area) => {
  499. const areaId = area.id
  500. const background = area.background
  501. const image = area.image
  502. const name = area.name
  503.  
  504. const areaElementString = `<div class="col d-flex justify-content-center">
  505. <div id="${areaId}" class="d-flex ${background} hover overviewGatheringBoxArea"
  506. ov-data-item="${name}" onclick="IdlePixelPlus.plugins['overview'].changeGatheringArea(this.getAttribute('ov-data-item'))">
  507. <img class="m-auto w-80 h-80" src="https://d1xsc8x7nc5q8t.cloudfront.net/images/${image}" />
  508. </div>
  509. </div>`
  510. const areaBox = $.parseHTML(areaElementString)
  511. $(`#overviewGatheringAreasContainer`).append(areaBox)
  512. })
  513. }
  514.  
  515. addMeteorsToPanel(){
  516. const meteorString = `
  517. <div class="col d-flex justify-content-center">
  518. <itembox data-item="show_item" ov-data-item="meteor" class="shadow hover itembox-resource-mining-1"
  519. onclick="Modals.open_image_modal('METEOR', 'images/meteor.png', 'Mine the material from the meteor?', 'Mine it!', 'Close', 'MINE_METEOR')"
  520. oncontextmenu="websocket.send('MINE_METEOR')"
  521. >
  522. <div class="center mt-1"><img draggable="false" src="https://d1xsc8x7nc5q8t.cloudfront.net/images/meteor.png" title="meteor"></div>
  523. <div class="center mt-2"><item-display data-format="number" data-key="meteor">0</item-display></div>
  524. </itembox>
  525. </div>`
  526.  
  527. const meteorBox = $.parseHTML(meteorString)
  528. $("#overviewGeodeContainer").append(meteorBox)
  529. }
  530.  
  531. addBonemealbinToPanel(){
  532. const binString = `
  533. <div class="col d-flex justify-content-center">
  534. <itembox data-item="show_item" ov-data-item="bonemeal_bin" class="shadow hover bone-item-box">
  535. <div class="center mt-1"><img draggable="false" src="https://d1xsc8x7nc5q8t.cloudfront.net/images/bonemeal_bin.png" title="bonemeal_bin"></div>
  536. <div class="center mt-2"> <img src="https://d1xsc8x7nc5q8t.cloudfront.net/images/bonemeal_icon.png"> <item-display data-format="number" data-key="bonemeal">0</item-display></div>
  537. </itembox>
  538. </div>`
  539.  
  540. const bonemealBox = $.parseHTML(binString)
  541. $("#overviewBonemealContainer").append(bonemealBox)
  542. }
  543.  
  544. toggleMultiHarvest(){
  545. if (!("slapchop" in IdlePixelPlus.plugins)){
  546. $("#overviewChopAll").hide()
  547. $("#overviewHarvestAll").hide()
  548. }
  549. }
  550.  
  551. updatePanelTrees(){
  552. for(let i = 1; i < 6; i++) {
  553. const tree = Items.getItemString("tree_" + i);
  554. const stage = Items.getItem("tree_stage_" + i);
  555. const tree_time = Items.getItem("tree_timer_"+ i)
  556. let time_string
  557.  
  558. if(tree_time===0){
  559. time_string = "EMPTY"
  560. } else if (tree_time===1){
  561. time_string = "READY"
  562. } else {
  563. time_string = this.formatTimeWithDays(tree_time)
  564. }
  565.  
  566. $(`#overviewWoodcuttingTimer-${i}`).html(time_string)
  567.  
  568. let img_url
  569.  
  570. if(tree !== "none"){
  571. img_url = `https://idlepixel.s3.us-east-2.amazonaws.com/images/woodcutting_${tree}_${stage}.png`
  572. } else {
  573. if(i === 4 || i === 5){
  574. if(!DonorShop.has_donor_active(Items.getItem("donor_tree_patches_timestamp"))){
  575. img_url = `https://idlepixel.s3.us-east-2.amazonaws.com/images/woodcutting_locked.png`
  576. } else {
  577. img_url = `https://idlepixel.s3.us-east-2.amazonaws.com/images/woodcutting_none.png`
  578. }
  579. } else {
  580. img_url = `https://idlepixel.s3.us-east-2.amazonaws.com/images/woodcutting_none.png`
  581. }
  582. }
  583. $(`#overviewWoodcuttingPatchImg-${i}`).attr("src", img_url)
  584. }
  585. }
  586.  
  587. updatePanelPlants(){
  588. for(let i = 1; i < 6; i++) {
  589. const crop = Items.getItemString("farm_" + i);
  590. const stage = Items.getItem("farm_stage_" + i);
  591. const crop_time = Items.getItem("farm_timer_"+ i)
  592. let time_string
  593.  
  594. if(crop_time===0){
  595. time_string = "EMPTY"
  596. } else if (crop_time===1){
  597. time_string = "READY"
  598. } else {
  599. time_string = this.formatTimeWithDays(crop_time)
  600. }
  601.  
  602. $(`#overviewFarmingTimer-${i}`).html(time_string)
  603.  
  604. let img_url
  605.  
  606. if(crop !== "none"){
  607. if (Items.getItem("farm_death_" + i) === 1){
  608. img_url = "https://idlepixel.s3.us-east-2.amazonaws.com/images/farming_dead_leaf.png"
  609. } else {
  610. img_url = `https://idlepixel.s3.us-east-2.amazonaws.com/images/farming_${crop}_${stage}.png`
  611. }
  612. } else {
  613. if(i === 4 || i === 5){
  614. if(!DonorShop.has_donor_active(Items.getItem("donor_tree_patches_timestamp"))){
  615. img_url = `https://idlepixel.s3.us-east-2.amazonaws.com/images/farming_locked.png`
  616. } else {
  617. img_url = `https://idlepixel.s3.us-east-2.amazonaws.com/images/farming_none.png`
  618. }
  619. } else {
  620. img_url = `https://idlepixel.s3.us-east-2.amazonaws.com/images/farming_none.png`
  621. }
  622. }
  623. $(`#overviewFarmingPatchImg-${i}`).attr("src", img_url)
  624. }
  625. }
  626.  
  627. updatePanelCooking() {
  628. let current_item = IdlePixelPlus.getVarOrDefault("cooks_book_item", "cooks_book", "string")
  629. if (current_item === "none"){current_item="cooks_book"}
  630.  
  631. const current_time = IdlePixelPlus.getVarOrDefault("cooks_book_timer", 0, "int")
  632. let formatted_time
  633. if (current_time<=1){
  634. formatted_time = "Completed."
  635. } else {
  636. formatted_time = this.formatTimeWithDays(current_time)
  637. }
  638.  
  639. $("#overviewCooksBookItem").attr("src", `https://d1xsc8x7nc5q8t.cloudfront.net/images/${current_item}.png`)
  640. $("#overviewCooksBookTimer").html(`${formatted_time}`)
  641. }
  642.  
  643. updateSmeltingPanel(){
  644. /*oil, lava, buckets, coal, plasma, fire, furnace, bar_click*/
  645. const oilNum = IdlePixelPlus.getVarOrDefault("oil", 0, "int")
  646. const lavaNum = IdlePixelPlus.getVarOrDefault("lava", 0, "int")
  647. const bucketsNum = IdlePixelPlus.getVarOrDefault("iron_bucket", 0, "int")
  648. const charcoalNum = IdlePixelPlus.getVarOrDefault("charcoal", 0, "int")
  649. const plasmaNum = IdlePixelPlus.getVarOrDefault("plasma", 0, "int")
  650. const dFireNum = IdlePixelPlus.getVarOrDefault("dragon_fire", 0, "int")
  651.  
  652. const furnaceType = this.getFurnace()
  653.  
  654. $("#overviewOilNum").html(oilNum)
  655. $("#overviewLavaNum").html(lavaNum)
  656. $("#overviewBucketsNum").html(bucketsNum)
  657. $("#overviewCharcoalNum").html(charcoalNum)
  658. $("#overviewPlasmaNum").html(plasmaNum)
  659. $("#overviewDFNum").html(dFireNum)
  660.  
  661. $("#overviewFurnaceIcon").attr("src", `https://idlepixel.s3.us-east-2.amazonaws.com/images/${furnaceType}.png`)
  662. }
  663.  
  664. clicksLogs(logType){
  665. const action = $('input[name=overviewUseLogsType]:checked').val();
  666. if (action === "none") {return;}
  667. if (action === "heat"){
  668. Modals.clicks_oven_log(logType)
  669. } else if (action === "charcoal"){
  670. if ("slapchop" in IdlePixelPlus.plugins){
  671. IdlePixelPlus.plugins.slapchop.quickFoundry(logType)
  672. } else {
  673. Modals.open_foundry_clicks_log(logType)
  674. }
  675. }
  676. }
  677.  
  678. clicksSeeds(seedType, clickType){
  679. let n = IdlePixelPlus.getVarOrDefault(seedType, 0, "int");
  680.  
  681. if(clickType==="left" && n>1) {
  682. n = 1;
  683. }
  684. const donor = DonorShop.has_donor_active(Items.getItem("donor_farm_patches_timestamp"));
  685. const maxPlot = donor ? 5 : 3;
  686. for(let plot = 1; plot <= maxPlot && n > 0; plot++) {
  687. if(IdlePixelPlus.getVar(`farm_${plot}`) === "none") {
  688. websocket.send(`PLANT=${seedType}~${plot}`);
  689. n--;
  690. }
  691. }
  692. }
  693.  
  694. rightClicksBars(barType){
  695. const oreBarMap = {
  696. bronze_bar: "copper",
  697. iron_bar: "iron",
  698. silver_bar: "silver",
  699. gold_bar: "gold",
  700. promethium_bar: "promethium",
  701. titanium_bar: "titanium",
  702. ancient_bar: "ancient_ore",
  703. dragon_bar: "dragon_ore"
  704. }
  705. if ("slapchop" in IdlePixelPlus.plugins){
  706. IdlePixelPlus.plugins.slapchop.quickSmelt(oreBarMap[barType])
  707. } else {
  708. Modals.open_stardust_or_sell_item_dialogue('crafting', barType)
  709. }
  710. }
  711.  
  712. clicksBags(bagType, clickType){
  713. const area = bagType.slice(19)
  714. const num = IdlePixelPlus.getVarOrDefault(bagType, 0, "int");
  715.  
  716. if (clickType === "left"){
  717. Modals.open_input_dialogue_with_value(area, 'Open', 'How many?', num, 'OPEN_GATHERING_LOOT')
  718. } else if (num > 0) {
  719. websocket.send(`OPEN_GATHERING_LOOT=${area}~${num}`);
  720. }
  721. }
  722.  
  723. clicksSDCrystals(crystalType, clickType){
  724. const num = IdlePixelPlus.getVarOrDefault(crystalType, 0, "int");
  725.  
  726. if (clickType === "left"){
  727. Modals.open_input_dialogue_with_value(crystalType, 'Smash', 'How many stardust prism do you want to smash?', num, 'SMASH_STARDUST_PRISM')
  728. } else if (num > 0 ){
  729. websocket.send(`SMASH_STARDUST_PRISM=${crystalType}~${num}`);
  730. }
  731. }
  732.  
  733. clicksGeode(geodeType, clickType){
  734. const num = IdlePixelPlus.getVarOrDefault(geodeType, 0, "int");
  735.  
  736. if (clickType === "left"){
  737. Modals.open_input_dialogue_with_value(geodeType, 'Open', 'How many geodes to you want to crack?', num, 'CRACK_GEODE')
  738. } else if (num > 0 ){
  739. websocket.send(`CRACK_GEODE=${geodeType}~${num}`)
  740. }
  741. }
  742.  
  743. clicksMineral(mineralType, clickType){
  744. const num = IdlePixelPlus.getVarOrDefault(mineralType, 0, "int");
  745.  
  746. if (clickType === "left"){
  747. Modals.clicks_mineral(mineralType)
  748. } else if (num > 0 ){
  749. websocket.send(`MINERAL_XP=${mineralType}~${num}`)
  750. }
  751. }
  752.  
  753. clicksBones(boneType, clickType){
  754. const num = IdlePixelPlus.getVarOrDefault(boneType, 0, "int");
  755.  
  756. if (clickType === "left"){
  757. Farming.clicks_bones(boneType)
  758. } else if (num > 0 ){
  759. websocket.send(`ADD_BONEMEAL=${boneType}~${num}`);
  760. }
  761. }
  762.  
  763. clicksCooksBook(clickType){
  764. const currentRecipe = IdlePixelPlus.getVarOrDefault("cooks_book_item", "none", "string")
  765. if (currentRecipe==="none"){return;}
  766.  
  767. websocket.send("COOKS_BOOK_READY")
  768.  
  769. if (clickType === "left"){return;}
  770.  
  771. websocket.send(`COOKS_BOOK=${currentRecipe}`)
  772. }
  773.  
  774. clicksRecipe(recipe, clickType){
  775. if (clickType === "right"){
  776. websocket.send("COOKS_BOOK_READY")
  777. }
  778.  
  779. websocket.send(`COOKS_BOOK=${recipe}`)
  780. }
  781.  
  782. clicksPotion(potionType){
  783. websocket.send(`BREW=${potionType}~1`)
  784. }
  785.  
  786. rightClicksPotion(potionType){
  787. const potionCount = IdlePixelPlus.getVarOrDefault(potionType, 0, "int")
  788.  
  789. if (potionCount<1){return;}
  790.  
  791. switch(potionType){
  792. case "combat_loot_potion":
  793. if (window["var_combat_loot_potion_timer"] === "0"){
  794. websocket.send(`BREWING_DRINK_COMBAT_LOOT_POTION`);
  795. }
  796. break;
  797. case "rotten_potion":
  798. if (window["var_rotten_potion_timer"] === "0"){
  799. websocket.send(`BREWING_DRINK_ROTTEN_POTION`);
  800. }
  801. break;
  802. case "merchant_speed_potion":
  803. if (window["var_merchant_speed_potion_timer"] === "0"){
  804. websocket.send(`BREWING_DRINK_MERCHANT_SPEED_POTION`);
  805. }
  806. break;
  807. default:
  808. websocket.send(`DRINK=${potionType}`);
  809. break;
  810. }
  811. }
  812.  
  813. highlightGathering(){
  814. this.gatheringMap = {
  815. mines: "overviewGatheringBoxMines",
  816. fields: "overviewGatheringBoxFields",
  817. forest: "overviewGatheringBoxForest",
  818. fishing_pond: "overviewGatheringBoxFishingPond",
  819. kitchen: "overviewGatheringBoxKitchen",
  820. gem_mine: "overviewGatheringBoxGemMine",
  821. castle: "overviewGatheringBoxCastle",
  822. none: "none"
  823. }
  824.  
  825. const currentArea = IdlePixelPlus.getVarOrDefault("current_gathering_area", "none", "string")
  826. const areaId = this.gatheringMap[currentArea]
  827.  
  828. this.selectedGatheringArea = areaId
  829.  
  830. $(`#${areaId}`).addClass("overviewGatheringBoxSelected")
  831. }
  832.  
  833. changeGatheringArea(newArea){
  834. websocket.send("GATHERING=" + newArea);
  835. const newAreaId = this.gatheringMap[newArea]
  836.  
  837. const previousArea = this.selectedGatheringArea
  838. $(`#${previousArea}`).removeClass("overviewGatheringBoxSelected")
  839.  
  840. $(`#${newAreaId}`).addClass("overviewGatheringBoxSelected")
  841. this.selectedGatheringArea = newAreaId
  842. }
  843.  
  844. toggleHideConfig(){
  845. if (this.hiddenConfigActive){
  846. this.exitHideConfig()
  847. } else {
  848. this.enterHideConfig()
  849. }
  850.  
  851. this.hiddenConfigActive = !this.hiddenConfigActive
  852. }
  853.  
  854. loadHiddenItems(){
  855. const itemListString = this.getConfig("hiddenItems")
  856. const itemList = itemListString.split(",")
  857.  
  858. if (itemList[0]===""){itemList.shift()}
  859.  
  860. this.hiddenItems = itemList
  861. }
  862.  
  863. saveHiddenItems(){
  864. IdlePixelPlus.refreshPanel("idlepixelplus")
  865. $(`#idlepixelplus-config-overview-hiddenItems`).val(this.hiddenItems.toString())
  866. IdlePixelPlus.savePluginConfigs("overview")
  867. }
  868.  
  869. toggleCover(cover){
  870. const item = cover.getAttribute('ov-data-item')
  871.  
  872. if(this.hiddenItems.includes(item)){
  873. this.hiddenItems.splice(this.hiddenItems.indexOf(item), 1)
  874. cover.classList.add("overviewConfigShown")
  875. cover.classList.remove("overviewConfigHidden")
  876. } else {
  877. this.hiddenItems.push(item)
  878. cover.classList.remove("overviewConfigShown")
  879. cover.classList.add("overviewConfigHidden")
  880.  
  881. }
  882. }
  883.  
  884. enterHideConfig(){
  885. const overviewPanel = $("#overviewTopLevelRow")
  886. const allItemContainers = $(".overviewItemBoxContainer", overviewPanel)
  887. const allItemCovers = $(".overviewConfigCover", overviewPanel)
  888.  
  889. allItemContainers.removeClass("overviewHiddenItem")
  890. allItemContainers.addClass("d-flex")
  891. allItemCovers.removeClass("overviewHiddenCover")
  892. allItemCovers.addClass("overviewConfigShown")
  893.  
  894. this.hiddenItems.forEach(item => {
  895. const itemContainer = $(`itembox[ov-data-item=${item}]`).parent()
  896. const cover = $(".overviewConfigCover", itemContainer)
  897. cover.removeClass("overviewConfigShown")
  898. cover.addClass("overviewConfigHidden")
  899. })
  900. }
  901.  
  902. exitHideConfig(){
  903. const overviewPanel = $("#overviewTopLevelRow")
  904. const allItemCovers = $(".overviewConfigCover", overviewPanel)
  905.  
  906. allItemCovers.addClass("overviewHiddenCover")
  907.  
  908. this.hideHiddenItems()
  909. this.saveHiddenItems()
  910. }
  911.  
  912. hideHiddenItems() {
  913. const overviewPanel = $("#overviewTopLevelRow")
  914.  
  915. this.hiddenItems.forEach(item => {
  916. const itemContainer = $(`itembox[ov-data-item=${item}]`).parent()
  917. itemContainer.addClass("overviewHiddenItem")
  918. itemContainer.removeClass("d-flex")
  919. })
  920. }
  921. }
  922.  
  923. const plugin = new OverviewPlugin();
  924. IdlePixelPlus.registerPlugin(plugin);
  925.  
  926. })();

QingJ © 2025

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