自动点击模块
// ==UserScript==
// @name 自动点击模块
// @namespace PokeClickerHelper
// @version 0.1.2
// @description 自动点击战斗,可自定义点击延时!
// @author 超超
// @match https://pokemon.ccox.cc/
// @icon data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/wAAAP8AAAD/AAAA/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/AAAA/319hf99fYX/fX2F/319hf8AAAD/AAAA/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////////////////////99fYX/fX2F/319hf8AAAD/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////wAAAP8AAAD/fX2F/319hf99fYX/AAAA/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////8AAAD/AAAA/wAAAP99fYX/fX2F/wAAAP8AAAD/AAAA/319hf8AAAD/AAAAAAAAAAAAAAAAAAAAAAAAAP8AAAD/HBT//xwU//8AAAD//////319hf8AAAD/Dgim/w4Ipv8AAAD/AAAA/wAAAAAAAAAAAAAAAAAAAAAAAAD/HBT//xwU//8cFP//HBT//wAAAP8AAAD/Dgim/w4Ipv8OCKb/Dgim/wAAAP8AAAAAAAAAAAAAAAAAAAAAAAAA/xwU//8cFP//HBT//xwU/44cFP//HBT//xwU//8cFP//Dgim/w4Ipv8AAAD/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/HBT//xwU/47/////HBT/jhwU//8cFP//HBT//w4Ipv8AAAD/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/xwU//8cFP//HBT/jhwU//8OCKb/Dgim/w4Ipv8OCKb/AAAA/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/AAAA/xwU//8OCKb/Dgim/w4Ipv8AAAD/AAAA/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/AAAA/wAAAP8AAAD/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//8AAPw/AADwDwAA4AcAAOAHAADAAwAAwAMAAMADAADAAwAA4AcAAOAHAADwDwAA/D8AAP//AAD//wAA//8AAA==
// @grant none
// @license MIT
// @run-at document-body
// ==/UserScript==
/* global App, $, PokeClickerHelper, GameConstants, Battle, DungeonBattle, GymBattle, TemporaryBattleBattle */
if (typeof PokeClickerHelper == typeof void 0) {
alert('宝可梦点击(Poke Clicker)辅助脚本 自动地牢/道馆模块加载失败\n\n未找到核心模块,需要先安装核心模块才可正常使用\n\n论坛主页:https://scriptcat.org/script-show-page/1228')
window.open("https://scriptcat.org/script-show-page/1228")
return
}
// UI相关
PokeClickerHelper.UIDOM.push(`
<div id="PokeClickerHelperAutoClickContainer" class="custom-row">
<div class="form-row mb-1">
<div class="col-auto align-self-center">
<label class="m-0">自动点击(ms):</label>
</div>
<div class="col">
<select id="PokeClickerHelperClickDelay" title="提示:游戏内置自动攻击间隔硬上限50ms 建议间隔100ms以上,兼顾性能及游戏性 50ms可能在部分区域会导致游戏卡顿 10ms可以极大减少间隔损耗但同时会极大降低游戏性能 自行抉择(另有定制脚本可以消除以上缺陷)"class="custom-select">
<option value="10">10</option>
<option value="50">50</option>
<option value="100">100</option>
<option value="200">200</option>
<option value="500">500</option>
<option value="1000">1000</option>
</select>
</div>
<button id="PokeClickerHelperAutoClick" class="btn btn-sm btn-primary ml-1" value="开始">开始</button>
</div>
</div>
<div class="mt-2 mb-1 border-top border-secondary"></div>
`)
const clickType = {};
let fuc = () => {
// 挑战模式自动点击隐藏
if (App.game.challenges.list.disableClickAttack.active()) return $('#PokeClickerHelperAutoClickContainer').remove()
// 预设场景点击事件
clickType[GameConstants.GameState.fighting] = Battle.clickAttack.bind(Battle)
clickType[GameConstants.GameState.dungeon] = DungeonBattle.clickAttack.bind(DungeonBattle)
clickType[GameConstants.GameState.gym] = GymBattle.clickAttack.bind(GymBattle)
clickType[GameConstants.GameState.temporaryBattle] = TemporaryBattleBattle.clickAttack.bind(TemporaryBattleBattle)
// 加载脚本读取 点击延迟
ClickAttackHelper.ClickDelay = PokeClickerHelper.get('ClickDelay', '50')
$('#PokeClickerHelperClickDelay').on('change', function () {
PokeClickerHelper.Worker.clearInterval(ClickAttackHelper.AutoClick, ClickAttackHelper.ClickDelay);
PokeClickerHelper.Worker.setInterval(ClickAttackHelper.AutoClick, ClickAttackHelper.ClickDelay = this.value);
})
}
const listener = () => {
$("#PokeClickerHelperAutoClick").on("click", function () {
if (this.value == '开始') {
PokeClickerHelper.Worker.setInterval(ClickAttackHelper.AutoClick, ClickAttackHelper.ClickDelay);
$(this).text(this.value = '结束')
} else {
PokeClickerHelper.Worker.clearInterval(ClickAttackHelper.AutoClick, ClickAttackHelper.ClickDelay)
$(this).text(this.value = '开始')
}
})
}
PokeClickerHelper.UICustomFuc.push(fuc);
PokeClickerHelper.UIlistener.push(listener);
// 暴露对象方法到全局
const ClickAttackHelper = {};
PokeClickerHelper.ClickAttackHelper = ClickAttackHelper;
// 自动点击
ClickAttackHelper.AutoClick = () => clickType[App.game.gameState]?.();