您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Sends custom messages to an account and logs received customs
当前为
// ==UserScript== // @name IdlePixel Custom Interactor // @namespace lbtechnology.info // @version 1.1.0 // @description Sends custom messages to an account and logs received customs // @author Lux-Ferre // @license MIT // @match *://idle-pixel.com/login/play* // @grant none // @require https://greasyfork.org/scripts/441206-idlepixel/code/IdlePixel+.js?anticache=20220905 // ==/UserScript== (function() { 'use strict'; class CustomInteractorPlugin extends IdlePixelPlusPlugin { constructor() { super("custominteractor", { about: { name: GM_info.script.name, version: GM_info.script.version, author: GM_info.script.author, description: GM_info.script.description }, config: [ { id: "receiver", label: "Account to send custom messages to.", type: "string", max: 2000, default: "" } ] }); this.previous = ""; } createPanel(){ IdlePixelPlus.addPanel("interactor", "Custom Message Interactor", function() { let content = "<div>"; content += "<br/>" content += `<form onsubmit='event.preventDefault(); IdlePixelPlus.plugins.custominteractor.sendCustom()'>` content += `<label for='interactor_command_in'><strong>Custom Command:  </strong></label>` content += `<input type="text" id="interactor_command_in" name="interactor_command_in"><br><br>` content += `<input type="submit" value="Send">` content += `</form>` content += "</div>"; return content; }); } onLogin(){ const onlineCount = $(".top-bar .gold:not(#top-bar-admin-link)"); onlineCount.before(` <a href="#" class="hover float-end link-no-decoration" onclick="event.preventDefault(); IdlePixelPlus.setPanel('interactor')" title="Custom Message Interactor">Custom </a> `); this.createPanel() } onCustomMessageReceived(player, content, callbackId) { console.log(`${player}: ${content}`) } sendCustom(){ const receiver = this.getConfig("receiver") const customPrompt = $("#interactor_command_in").val() $("#interactor_command_in").val("") const content = `interactor:${customPrompt}` const payload = { content: content, onResponse: function(player, content, callbackId) { return true; }, onOffline: function(player, content) { console.log(content) }, timeout: 2000 // callback expires after 2 seconds } IdlePixelPlus.sendCustomMessage(receiver, payload) } } const plugin = new CustomInteractorPlugin(); IdlePixelPlus.registerPlugin(plugin); })();