您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds some QoL 1-click actions and auto-populates some text fields when dialogs are opened.
当前为
// ==UserScript== // @name IdlePixel Slap Chop // @namespace com.anwinity.idlepixel // @version 1.0.1 // @description Adds some QoL 1-click actions and auto-populates some text fields when dialogs are opened. // @author Anwinity // @license MIT // @match *://idle-pixel.com/login/play* // @grant none // @require https://gf.qytechs.cn/scripts/441206-idlepixel/code/IdlePixel+.js // ==/UserScript== (function() { 'use strict'; class SlapChopPlugin extends IdlePixelPlusPlugin { constructor() { super("slapchop", { about: { name: GM_info.script.name, version: GM_info.script.version, author: GM_info.script.author, description: GM_info.script.description }, config: [ { id: "quick_gather_enabled", label: "Right-Click Quick-Gather", type: "boolean", default: true }, { id: "quick_potion_enabled", label: "Right-Click Quick-Potion", type: "boolean", default: true }, { id: "autofill_gather_enabled", label: "Autofill Gather Amount", type: "boolean", default: true }, { id: "autofill_brewing_enabled", label: "Autofill Brew Amount", type: "boolean", default: true }, ] }); } brewablePotions(potion) { const ingredients = Brewing.get_ingredients(potion); if(ingredients.length <= 0) { return 0; } let brewable = Number.MAX_SAFE_INTEGER; for(let i = 0; i < ingredients.length; i+=2) { let required = parseInt(ingredients[i+1]); let owned = IdlePixelPlus.getVarOrDefault(ingredients[i], 0, "int"); brewable = Math.min(brewable, Math.floor(owned/required)); } return brewable; } leftClickLootBag(location) { if(this.getConfig("autofill_gather_enabled")) { const n = IdlePixelPlus.getVarOrDefault(`gathering_loot_bag_${location}`, 0, "int"); $("#modal-input-text").val(n); } } rightClickLootBag(event, location) { if(this.getConfig("quick_gather_enabled")) { event.preventDefault(); const shift = event.shiftKey; const n = IdlePixelPlus.getVarOrDefault(`gathering_loot_bag_${location}`, 0, "int"); if(shift && n>1) { IdlePixelPlus.sendMessage(`OPEN_GATHERING_LOOT=${location}~${n-1}`); } else if(n>0) { IdlePixelPlus.sendMessage(`OPEN_GATHERING_LOOT=${location}~${n}`); } } } rightClickPotion(event, potion) { if(this.getConfig("quick_potion_enabled")) { event.preventDefault(); IdlePixelPlus.sendMessage(`DRINK=${potion}`); } } onLogin() { const self = this; // loot bag gathering ["fields", "forest", "fishing_pond", "kitchen", "gem_mine"].forEach(location => { const el = $(`itembox[data-item=gathering_loot_bag_${location}]`); const lclick = (el.attr("onclick")||""); const rclick = (el.attr("oncontextmenu")||""); el.attr("onclick", `${lclick}; IdlePixelPlus.plugins.slapchop.leftClickLootBag("${location}");`); el.attr("oncontextmenu", `${rclick}; IdlePixelPlus.plugins.slapchop.rightClickLootBag(event, "${location}");`); }); // potions ["energy_potion", "anti_disease_potion", "smelting_upgrade_potion", "farming_speed_potion", "rare_monster_potion", "super_stardust_potion", "heat_potion"].forEach(potion => { const el = $(`itembox[data-item=${potion}]`); const rclick = (el.attr("oncontextmenu")||""); el.attr("oncontextmenu", `${rclick}; IdlePixelPlus.plugins.slapchop.rightClickPotion(event, "${potion}");`); }); // brewing modal Modals._open_brew_dialogue = Modals.open_brew_dialogue; Modals.open_brew_dialogue = function(item) { Modals._open_brew_dialogue(item); if(self.getConfig("autofill_brewing_enabled")) { const n = self.brewablePotions(item); console.log(`open_brew_dialogue ${item} ${n}`); $("#modal-brew-item-amount").val(n); } } } } const plugin = new SlapChopPlugin(); IdlePixelPlus.registerPlugin(plugin); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址