// ==UserScript== // @name 宝可梦点击(Poke Clicker)辅助脚本 [自定义功能] 快速漫闪 // @namespace PokeClickerHelper // @version 0.1.3 // @description 通过切换道路的方法快速遇到漫游、闪光宝可梦进行捕获!(理论上兼容全版本后续更新也支持~) // @author 苍猫、DreamNya // @match https://www.pokeclicker.com // @match https://g8hh.github.io/pokeclicker/ // @match https://pokeclicker.g8hh.com // @match https://yx.g8hh.com/pokeclicker/ // @match https://dreamnya.github.io/pokeclicker/ // @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-end // @namespace https://greasyfork.org/users/809466 // ==/UserScript== /* eslint-env jquery */ /* global player, GameConstants, Settings, Battle, PokeClickerHelper, NotificationConstants, RoamingPokemonList, MapHelper, App, Notifier*/ if (typeof PokeClickerHelper == typeof void 0) { alert('宝可梦点击(Poke Clicker)辅助脚本 [自定义功能] 快速漫闪加载失败\n\n未找到核心模块,需要先安装核心模块才可正常使用\n\n论坛主页:https://bbs.tampermonkey.net.cn/forum.php?mod=viewthread&tid=3842') window.open("https://bbs.tampermonkey.net.cn/forum.php?mod=viewthread&tid=3842") return } // UI相关 const listener = () => { $('#PokeClickerHelperRouteAutoShiny').on('click', function () { if (!(App.game.gameState === GameConstants.GameState.fighting)) { Notifier.notify({ message: `你当前位置未处于道路上,请手动切换至任意道路再启动该功能!`, type: NotificationConstants.NotificationOption.danger }); JSON.parse(this.value) ? this.value = 'false' : this.value = 'true'; JSON.parse(this.value) ? $('#PokeClickerHelperRouteAutoShiny').text($('#PokeClickerHelperRouteAutoShiny').text().replace('OFF', 'ON')) : $('#PokeClickerHelperRouteAutoShiny').text($('#PokeClickerHelperRouteAutoShiny').text().replace('ON', 'OFF')); JSON.parse(this.value) ? this.classList.replace('btn-danger', 'btn-success') : this.classList.replace('btn-success', 'btn-danger'); return } JSON.parse(this.value) ? this.value = 'false' : this.value = 'true'; JSON.parse(this.value) ? $('#PokeClickerHelperRouteAutoShiny').text($('#PokeClickerHelperRouteAutoShiny').text().replace('OFF', 'ON')) : $('#PokeClickerHelperRouteAutoShiny').text($('#PokeClickerHelperRouteAutoShiny').text().replace('ON', 'OFF')); JSON.parse(this.value) ? this.classList.replace('btn-danger', 'btn-success') : this.classList.replace('btn-success', 'btn-danger'); JSON.parse(this.value) ? QuickRoamingShiny.type = 'Shiny' : QuickRoamingShiny.type = null; if (JSON.parse(this.value)) { QuickRoamingShiny.route = player.route(); PokeClickerHelper.Worker.clearInterval(QuickRoamingShiny.AutoWild, 50); PokeClickerHelper.Worker.setInterval(QuickRoamingShiny.AutoWild, 50); $('#PokeClickerHelperRouteAutoRoaming')[0].value = 'false'; $('#PokeClickerHelperRouteAutoRoaming')[0].classList.replace('btn-success', 'btn-danger'); $('#PokeClickerHelperRouteAutoRoaming').text($('#PokeClickerHelperRouteAutoRoaming').text().replace('ON', 'OFF')); } }) $('#PokeClickerHelperRouteAutoRoaming').on('click', function () { JSON.parse(this.value) ? this.value = 'false' : this.value = 'true'; JSON.parse(this.value) ? $('#PokeClickerHelperRouteAutoRoaming').text($('#PokeClickerHelperRouteAutoRoaming').text().replace('OFF', 'ON')) : $('#PokeClickerHelperRouteAutoRoaming').text($('#PokeClickerHelperRouteAutoRoaming').text().replace('ON', 'OFF')); JSON.parse(this.value) ? this.classList.replace('btn-danger', 'btn-success') : this.classList.replace('btn-success', 'btn-danger'); JSON.parse(this.value) ? QuickRoamingShiny.type = 'Roaming' : QuickRoamingShiny.type = null; if (JSON.parse(this.value)) { QuickRoamingShiny.route = player.route(); PokeClickerHelper.Worker.clearInterval(QuickRoamingShiny.AutoWild, 50); PokeClickerHelper.Worker.setInterval(QuickRoamingShiny.AutoWild, 50); $('#PokeClickerHelperRouteAutoShiny')[0].value = 'false'; $('#PokeClickerHelperRouteAutoShiny')[0].classList.replace('btn-success', 'btn-danger'); $('#PokeClickerHelperRouteAutoShiny').text($('#PokeClickerHelperRouteAutoShiny').text().replace('ON', 'OFF')); } }) } const fuc = () => { const text = `
` $("#battleContainer .battle-view").before(text) } PokeClickerHelper.UIContainerID.push("#PokeClickerHelperRouteAutoShiny"); PokeClickerHelper.UIContainerID.push("#PokeClickerHelperRouteAutoRoaming"); PokeClickerHelper.UICustomFuc.push(fuc); PokeClickerHelper.UIlistener.push(listener); // 暴露对象方法到全局 const QuickRoamingShiny = {}; PokeClickerHelper.QuickRoamingShiny = QuickRoamingShiny; QuickRoamingShiny.route = 0; //通过绑定PokeClickerHelper.QuickRoamingShiny.route来实现参数的控制 QuickRoamingShiny.type = null;//用于判断当前功能选择类型 // 主函数(道路编号) 通过QuickRoamingShiny.type值判断执行 QuickRoamingShiny.AutoWild = () => { // 手动离开道路停止功能 if (App.game.gameState != GameConstants.GameState.fighting) { PokeClickerHelper.Worker.clearInterval(QuickRoamingShiny.AutoWild, 50); JSON.parse($('#PokeClickerHelperRouteAutoShiny').prop('value')) ? $('#PokeClickerHelperRouteAutoShiny').click() : $('#PokeClickerHelperRouteAutoRoaming').click() return QuickRoamingShiny.type = null; } if (QuickRoamingShiny.type == 'Shiny') { if (Battle.route != QuickRoamingShiny.route) { let id = Battle.enemyPokemon().id; let shiny = Battle.enemyPokemon().shiny; if ((App.game.party.alreadyCaughtPokemon(id) && !(shiny && !App.game.party.alreadyCaughtPokemon(id, true)))) { MapHelper.moveToRoute(QuickRoamingShiny.route, player.region) } else { PokeClickerHelper.Worker.clearInterval(QuickRoamingShiny.AutoWild, 50); PokeClickerHelper.Worker.setTimeout(QuickRoamingShiny.AutoWildReStart, 100) } } else { Battle.route = 0 } } if (QuickRoamingShiny.type == 'Roaming') { QuickRoamingShiny.route = RoamingPokemonList.getIncreasedChanceRouteBySubRegionGroup(player.region, RoamingPokemonList.findGroup(player.region, player.subregionObject().id))().number; if (Battle.route != QuickRoamingShiny.route) { if (!QuickRoamingShiny.WhetherRoamingPokemon(Battle.enemyPokemon().id)) { MapHelper.moveToRoute(QuickRoamingShiny.route, player.region) } else { // PokeClickerHelper.Worker.clearInterval(QuickRoamingShiny.AutoWild, 50); PokeClickerHelper.Worker.setTimeout(QuickRoamingShiny.AutoWildReStart, 100) } } else { Battle.route = 0 } } } // 判断是否属于漫游宝可梦 QuickRoamingShiny.WhetherRoamingPokemon = (PokemonId) => { let WhetheRoaming = false; let RoamingPokemon = RoamingPokemonList.getSubRegionalGroupRoamers(player.region, RoamingPokemonList.findGroup(player.region, player.subregionObject().id)); RoamingPokemon.filter(({ pokemon }) => pokemon.id === PokemonId).length > 0 ? WhetheRoaming = true : WhetheRoaming = false return WhetheRoaming; } // 用于防止卡死进行处理 QuickRoamingShiny.AutoWildReStart = () => { if (QuickRoamingShiny.type == null) return if (JSON.parse($('#PokeClickerHelperRouteAutoRoaming').prop('value')) && JSON.parse($('#PokeClickerHelperRouteAutoShiny').prop('value'))) if (Battle.enemyPokemon().health() == 0) { if (Battle.route == 0) MapHelper.moveToRoute(QuickRoamingShiny.route, player.region) PokeClickerHelper.Worker.clearTimeout(QuickRoamingShiny.AutoWildReStart, 100) PokeClickerHelper.Worker.setInterval(QuickRoamingShiny.AutoWild, 50); } }