|
发表于 2022-1-10 04:38:39
|
显示全部楼层
//点怪
setInterval(function () {
document.getElementsByClassName('enemy')[0].click();
}, 50);
//农场
setInterval(function () {
App.game.farming.plantAll(FarmController.selectedBerry());
App.game.farming.harvestAll();
} , 1000);
//收蛋
setInterval(function () {
App.game.breeding.hatchPokemonEgg(0)
App.game.breeding.hatchPokemonEgg(1)
App.game.breeding.hatchPokemonEgg(2)
App.game.breeding.hatchPokemonEgg(3)
} , 1000);
//副本函数
var testTime = -1;
function fb(time,boss,playe){//1
var yss;
boss=boss?boss:[0,0];
playe =playe?playe: [1,1];
if(document.getElementsByClassName("dungeon-board")[0])
document.getElementsByClassName("dungeon-board")[0].getElementsByTagName("tr")[playe[0]].getElementsByTagName("td")[playe[1]].click();
if(DungeonRunner.map.board()[boss[0]][boss[1]].type() != 4 || DungeonRunner.map.board()[playe[0]][playe[1]].hasPlayer != true) //判断boss与playe的位置
for(var i = 0; i<DungeonRunner.map.board().length;i++){//2
for(var j=0;j<DungeonRunner.map.board()[0].length;j++){//3
if(DungeonRunner.map.board()[i][j].type() == 4) boss = [i,j];
if(DungeonRunner.map.board()[i][j].hasPlayer == true)playe = [i,j];
//console.log(i,j,": [",DungeonRunner.map.board()[i][j].isVisible,DungeonRunner.map.board()[i][j].hasPlayer,DungeonRunner.map.board()[i][j].type(),"]");
}//3
}//2
if(DungeonRunner.map.board()[playe[0]][playe[1]].type() != 2 && DungeonRunner.map.board()[playe[0]][playe[1]].type() != 4){//2
if(boss[0] != playe[0]){
playe[0] = playe[0] > boss[0] ? playe[0] -= 1: playe[0] += 1;
} else if(boss[1] != playe[1] ){
playe[1] = playe[1] > boss[1] ? playe[1] -= 1: playe[1] += 1;
}
}//2
if(document.getElementsByClassName("dungeon-board")[0])
document.getElementsByClassName("dungeon-board")[0].getElementsByTagName("tr")[playe[0]].getElementsByTagName("td")[playe[1]].click();
if(DungeonRunner.map.board()[playe[0]][playe[1]].type() == 4 || document.getElementsByClassName("progress timer")[0] == undefined){
if(document.getElementsByClassName("progress timer")[0] != undefined && document.getElementsByClassName("btn btn-danger dungeon-button")[0])
document.getElementsByClassName("btn btn-danger dungeon-button")[0].click();
if(document.getElementsByClassName("progress timer")[0] == undefined){
testTime += 1;
if(testTime != time){
DungeonRunner.initializeDungeon(player.town().dungeon)//点开副本
console.log("副本完成了:",testTime,",正在打第",testTime+1,"局副本;");
} else {
console.log("副本完成了:",testTime,",完成了!");
}
}
}
if(testTime == time){clearTimeout(yss);testTime = -1;} else {yss = setTimeout(function(){fb(time,boss,playe)},50)}
}//1
//document.getElementsByClassName("city currentTown")[0].dataset.town //player.town
function dg(num1){
var yss;
if(document.getElementsByClassName('list-group')[1].getElementsByClassName("btn")[0] !=undefined&&document.getElementsByClassName('list-group')[1].getElementsByClassName("btn")[0].textContent == "道馆"){
ys+=1;
document.getElementsByClassName('list-group')[1].getElementsByClassName("btn")[0].click();
}
yss = setTimeout(function(){dg(num1)},500);
if(ys == num1){
clearTimeout(yss);
ys = 0;
}
}
var ys = 0;
var boss = 1;
var numAll = 0;
function lm(num1,num2){
var yss;
if(document.getElementsByClassName('list-group')[0].getElementsByClassName("btn")[num2-1] != undefined){
ys+=1;
document.getElementsByClassName('list-group')[0].getElementsByClassName("btn")[num2-1].click();
}
yss = setTimeout(function(){lm(num1,num2)},500);
if(ys == num1){
clearTimeout(yss);
ys = 0;
}
}
var ys = 0;
var boss = 1;
var numAll = 0;
//App.game.underground.energy 有多少体力
//Mine.rewardGrid 获得 12*25
// document.getElementById("mineBody").getElementsByClassName("row")[0].getElementsByClassName("col-sm-1")[6].className.indexOf("rock0") > -1 判断是否挖完
//挖矿函数
/*
function wk(){
for(var x=0;x<Mine.rewardGrid.length;x++){
for(var y=0;y<Mine.rewardGrid[x].length;y++){
if(Mine.rewardGrid[x][y]){ console.log(x,y)
// do{
document.getElementById("mineBody").getElementsByClassName("row")[x].getElementsByClassName("col-sm-1")[y].click();
document.getElementById("mineBody").getElementsByClassName("row")[x].getElementsByClassName("col-sm-1")[y].click();
document.getElementById("mineBody").getElementsByClassName("row")[x].getElementsByClassName("col-sm-1")[y].click();
document.getElementById("mineBody").getElementsByClassName("row")[x].getElementsByClassName("col-sm-1")[y].click();
document.getElementById("mineBody").getElementsByClassName("row")[x].getElementsByClassName("col-sm-1")[y].click();
//} while (document.getElementById("mineBody").getElementsByClassName("row")[x].getElementsByClassName("col-sm-1")[y].className.indexOf("rock0") == -1)
}
}
}
}*/
function wk_01(x,y,yss){
x = x?x:0;
y = y?y:0;
if(Mine.rewardGrid[x][y] && document.getElementById("mineBody").getElementsByClassName("row")[x].getElementsByClassName("col-sm-1")[y].className.indexOf("rock0") == -1){
wk_02(x,y);
}
console.log(x,y);y++;
yss = setTimeout(function(){wk_01(x,y,yss)},50);
y = y > Mine.rewardGrid[0].length-1?y=0-x+x++:y;
x %=12;
if(/*x == Mine.rewardGrid.length ||*/ App.game.underground.energy < 10) {clearTimeout(yss);}
}
function wk_02(x,y,yss){
if(document.getElementById("mineBody").getElementsByClassName("row")[x].getElementsByClassName("col-sm-1")[y].className.indexOf("rock0") == -1){
document.getElementById("mineBody").getElementsByClassName("row")[x].getElementsByClassName("col-sm-1")[y].click();
}
yss = setTimeout(function(){wk_02(x,y,yss)},50);
if(document.getElementById("mineBody").getElementsByClassName("row")[x].getElementsByClassName("col-sm-1")[y].className.indexOf("rock0") > -1){clearTimeout(yss);}
}
//挖矿
setInterval(function () {
wk_01();
}, 120000);
//补蛋
function autoBreeding (){
  if(App.game.breeding.queueList().length>0)return;
  var pokemonList = App.game.party.caughtPokemon;
var pokemonList = pokemonList.sort(PartyController.compareBy(SortOptions.breedingEfficiency, false));
  var visible = BreedingController.visible;
  for(var i=0;i<pokemonList.length;i++){
    if(visible(pokemonList[i])()){
      App.game.breeding.addPokemonToHatchery(pokemonList[i]);
    }else{
      continue;
    }
    if(App.game.breeding.queueList().length>0)return;
  }
}
App.game.breeding.hatchPokemonEgg = function (index) {
const egg = this._eggList[index]();
const hatched = egg.hatch();
if (hatched) {
this._eggList[index](new Egg());
this.moveEggs();
if (this.queueList().length) {
const nextEgg = this.createEgg(this.queueList.shift());
this.gainEgg(nextEgg);
if (!this.queueList().length) {
Notifier.notify({
message: 'Hatchery queue is empty',
type: NotificationConstants.NotificationOption.success,
timeout: 1e4,
sound: NotificationConstants.NotificationSound.empty_queue,
setting: NotificationConstants.NotificationSetting.empty_queue,
});
}
}
      autoBreeding ();
}
} |
|