2020 경 동 618 첩 케이크 js 스 크 립 트(친 측 호 용)

1 년 에 한 번 씩 열 리 는 618 이 다가 오 는데 카 트 가 꽉 찼 다.올 해 는 경 동 618 개의 케이크 접 기 행사 가 눈길 을 끌 었 다.어떻게 놀 수 있 을 까?경 동 을 열 어 보 자.그럼 오늘 편집장 님 께 서 2020 경 동 618 첩 케이크 js 스 크 립 트 의 실현 코드 를 공유 해 드 리 겠 습 니 다.관심 있 는 친구 들 과 함께 보 세 요.
경 동 618 케이크 스 크 립 트
在这我一级里插入图片描述

var generalSleep = 2000;//         ( 8   )
var intervalSleep = 800;//        
var checkTimes = 2000;//               
var randomVal = 500; //         ,  generalSleep, generalSleep     random(generalSleep,generalSleep+randomVal)
//                 ,randomVal    0
function getTaskList()
{
       ();
 var taskList = textMatches(/.+\([0-9]+\/[0-9]+\).*/).untilFind();
 return taskList;
}
function getGoButton(task)
{
 var father = task.parent();
 if(father == null) return null;
 father = father.parent();
 if(father == null) return null;
 var selector = text("   ");
 var goOn = father.findOne(selector);
 return goOn;
}
function getSelectedTask(keywordList)
{
 var taskList = getTaskList(),found;
 for(var i = 0; i < taskList.length; i ++){
 found = true;
 for(var j = 0; j < keywordList.length; j ++){
 if(taskList[i].text().indexOf(keywordList[j]) == -1){
 found = false;
 break;
 }
 }
 if(found) return taskList[i];
 }
 return null;
}
function   ()
{
 var goBack = clickable(true).desc("  ").findOne(1000);
 goBack == null ? back() : goBack.click();
}
function       ()
{
 var      ;
 while(true){
      = textContains("    0   ,         ~").findOne(1000);
 if(     != null) break;
   ();
 sleep(1000);
 }
}
function    (  )
{
 textMatches(/.+   /).waitFor();
 var    = textContains("    ").findOne(  *1000);
       ();
 sleep(random(intervalSleep,intervalSleep+randomVal));
}
function     (  )
{
 var goodsList = textMatches(/¥[0-9]+\.[0-9]+/).untilFind(),cnt = 0,finished = false;
 for(var i = 0; i < goodsList.length; i ++){
 if(cnt >=   ){
 finished = true;
 break;
 }
 if(forceClick(goodsList[i]))
 {
 log("        %s    ",goodsList[i].text());
 cnt ++;
 textMatches(/(?:     |    |    |    |   |  )/).waitFor();
 sleep(random(1500,2000));
 back();
 textMatches(/.*  .*  .*/).waitFor();
 sleep(random(300,500));
 }
 }
 sleep(random(500,1000));
       ();
 sleep(random(intervalSleep,intervalSleep+randomVal));
 return finished;
}
function     ()
{
 var goodsList = textMatches(/¥[0-9]+\.[0-9]+/).untilFind(),finished = false,   ,father,selector;
 for(var i = 0; i < goodsList.length; i ++){
     = text("   ").findOnce();
 if(   !=null) {
 log("       ");
 break;
 }
 father = goodsList[i].parent().parent();
 selector = clickable(true).filter(function(w){
 var b = w.bounds(),b_ = father.bounds();
 return Math.abs(b.bottom - b_.bottom) <= 150 && Math.abs(b.right - b_.right) <= 150 
  && b.width() <= 150 && b.height() <= 150;
 });
    = father.findOne(selector);
 if(  !=null){
   .click();
 log("     %s    ",goodsList[i].text());
 sleep(random(1000,1500));
 }
 }
 sleep(random(500,1000));
       ();
 sleep(random(intervalSleep,intervalSleep+randomVal));
 return finished;
}
function        ()
{
 log("          !!!");
 var isRun,taskList,goOn,txt,reg = /(?:  8 | 8 |  |    |8  )/,    ,    ;
 while(true){
 taskList = getTaskList(); isRun = false;
 for(var i = 0; i < taskList.length; i ++){
 txt = taskList[i].text();
 if(reg.test(txt)){
 if(txt.indexOf("AR") != -1) continue;
 goOn = getGoButton(taskList[i]);
 if(goOn != null){
  log(txt);
  goOn.click();
  sleep(checkTimes);
       = textContains("    0   ,         ~").findOne(200);
  if(     == null){
  if(txt.indexOf("8 ")!= null) {
       = textContains("    ").findOne(random(12000,15000));
  if(     != null){
  sleep(random(300,600));
  }
  }
  else sleep(random(generalSleep,generalSleep+randomVal));
        ();
  sleep(random(intervalSleep,intervalSleep+randomVal));
  isRun = true;
  break;
  }
  else{
  log("       ...");
  sleep(500);
  }
 }
 }
 }
 if(!isRun) break;
 }
 log("       ~~~");
 return isRun;
}
function      (keywordList)
{
 log("     %s   !!!",keywordList);
 var task,last_rate=-1,curr_rate,tag_rate,reg_rate = /\([0-9]+\/[0-9]+\)/,reg,arr,sec;
 var isRun = false,    ,maxTryTimes = 10,tryTimes = 0,goOn,isFail;
 while(true){
 task = getSelectedTask(keywordList);
 if(task == null) break;
 arr = task.text().match(reg_rate);
 arr = toIntArr(arr[0]);
 curr_rate = parseInt(arr[0]);
 tag_rate = parseInt(arr[1]);
 if(curr_rate == tag_rate) break;
 if(curr_rate != last_rate){
 log("      %d    ,      %d    ,         ",curr_rate,tag_rate);
 log(task.text());
 isFail = false;
 if(keywordList[0] == "  "){
 reg = /[0-9]+ /;
 arr = task.text().match(reg);
 sec = toInt(arr[0]);
 log("    %s  ",sec);
 goOn = getGoButton(task);
 if(goOn != null) goOn.click();
 sleep(checkTimes);
      = textContains("    0   ,         ~").findOne(200);
 if(     == null){
     (sec);
 }
 else isFail = true;
 }
 else if (keywordList[0] == "  " && keywordList[1] == "  ")
 {
 reg = /[0-9]+   /;
 arr = task.text().match(reg);
 times = toInt(arr[0]);
 log("       %s    ",times);
 goOn = getGoButton(task);
 if(goOn != null) goOn.click();
 sleep(checkTimes);
      = textContains("    0   ,         ~").findOne(200);
 if(     == null){
      (times);
 }
 else isFail = true;
 }
 else if (keywordList[0] == "  " && keywordList[1] == "  "){
 reg = /[0-9]+   /;
 arr = task.text().match(reg);
 times = toInt(arr[0]);
 log("       %s    ",times);
 goOn = getGoButton(task);
 if(goOn != null) goOn.click();
 sleep(checkTimes);
      = textContains("    0   ,         ~").findOne(200);
 if(     == null ){
      (times);
 }
 else isFail = true;
 }
 if(isFail){
 log("       ...");
 tryTimes++;
 if(tryTimes >= maxTryTimes){
  log("      ,      ");
  break;
 }
 sleep(500);
 }
 else{
 isRun = true; last_rate = curr_rate; tryTimes = 0;
 }
 sleep(300);
 }
 else{
 sleep(2000);
 last_rate = curr_rate - 1;
 }
 sleep(300);
 }
 log("%s     ~~~",keywordList);
 if(isRun) sleep(random(2000,2500));
 return isRun;
}
function clickObj(obj)
{
 if(obj != null && obj != undefined){
 if(obj.clickable()){
 obj.click();
 }
 else{
 click(obj.bounds().centerX(),obj.bounds().centerY());
 }
 return true;
 }
 return false;
}
function toIntArr(str)
{
 return str.match(/[0-9]+/g);
}
function toInt(str)
{
 var res = str.match(/[0-9]+/g);
 return parseInt(res[0]);
}
function forceClick(obj)
{
 for(var i = 0 ; i < 8; i ++){
 if(obj == null) return false;
 if(obj.clickable()){
 obj.click();
 return true;
 }
 else obj = obj.parent();
 }
 return false;
}
function openJD()
{
 app.startActivity({ 
 data: "openApp.jdMobile://virtual?params=%7B%22des%22%3A%22m%22%2C%22url%22%3A%22https%3A%2F%2Fbunearth.m.jd.com%2FbabelDiy%2FZeus%2F3xAU77DgiPoDvHdbXUZb95a7u71X%2Findex.html%22%2C%22category%22%3A%22jump%22%2C%22sourceType%22%3A%22JSHOP_SOURCE_TYPE%22%2C%22sourceValue%22%3A%22JSHOP_SOURCE_VALUE%22%2C%22M_sourceFrom%22%3A%22lkyl%22%2C%22msf_type%22%3A%22click%22%2C%22m_param%22%3A%7B%22m_source%22%3A%220%22%2C%22event_series%22%3A%7B%7D%2C%22jda%22%3A%22177095863.1664140455.1538579865.1572975960.1572979455.472%22%2C%22usc%22%3A%22androidapp%22%2C%22ucp%22%3A%22t_335139774%22%2C%22umd%22%3A%22appshare%22%2C%22utr%22%3A%22CopyURL%22%2C%22jdv%22%3A%22177095863%7Candroidapp%7Ct_335139774%7Cappshare%7CCopyURL%7C1572882675599%22%2C%22ref%22%3A%22https%3A%2F%2Fbunearth.m.jd.com%2FbabelDiy%2FZeus%2F3xAU77DgiPoDvHdbXUZb95a7u71X%2Findex.html%22%2C%22psn%22%3A%221664140455%7C472%22%2C%22psq%22%3A5%2C%22pc_source%22%3A%22%22%2C%22mba_muid%22%3A%221664140455%22%2C%22mba_sid%22%3A%221572979455588510925986537476%22%2C%22std%22%3A%22MO-J2011-1%22%2C%22par%22%3A%22%22%2C%22event_id%22%3A%22Mnpm_ComponentApplied%22%2C%22mt_xid%22%3A%22%22%2C%22mt_subsite%22%3A%22%22%7D%2C%22SE%22%3A%7B%22mt_subsite%22%3A%22%22%2C%22__jdv%22%3A%22177095863%7Candroidapp%7Ct_335139774%7Cappshare%7CCopyURL%7C1572882675599%22%2C%22__jda%22%3A%22177095863.1664140455.1538579865.1572975960.1572979455.472%22%7D%7D",
 });
}
function signIn()
{
 var      = textMatches(/(?:    |  )/).findOne(25*1000);
 clickObj(    );
}
function goToHall()
{
 var hall = text("      ").findOne(25*1000);
 clickObj(hall);
}
var notifyClose = textContains("    ");
var continueFloaty = text("     ");
var cakeNotify = textContains("         ");
var closeList = [[notifyClose,false],[continueFloaty,true],[cakeNotify,true]];//true      
function closeFloaty()
{
 var i,obj,cancel;
 while(true){
 for(i in closeList){
 obj = closeList[i][0].findOnce();
 if(obj != null){
 if(closeList[i][1]){
  clickObj(obj);
 }else{
  cancel = textMatches(/(?:  |  )/).findOnce();
  if(cancel != null){
  cancel.click();
  }
 }
 }
 }
 sleep(100);
 }
}
// function closeHall()
// {
// sleep(500);
// var menu = desc("    ").className("ImageView").clickable(true).findOne();
// var    = textContains("    0   ,         ~").findOne();
// var closeBtn = clickable(true).depth(  .depth()+1).filter(function(w){
// var b = w.bounds(),b_ = menu.bounds(),b__ =   .bounds();
// return w.text().length == 0 && b_.left <= b.centerX() && b.centerX() <= b_.right && 
//  b.centerY() < b__.top-50 && b.centerY() > b_.bottom+50;
// }).findOne();
// closeBtn.click()
// }
function closeHall()
{
 back();
 sleep(1500);
 openJD();
 text("      ").waitFor();
}
function collectCoin()
{
 log("       !!!");
 text("      ").waitFor();
 var elf;
 while(true){
 elf = text("     ").findOne(3500);
 if(elf == null) break;
 // click(elf.bounds().centerX(),elf.bounds().top - 50);
 forceClick(elf);
 sleep(random(350,550));
 }
 log("         ");
}
function makeCake()
{
 log("       !!!");
 var make,closeBtn,arr,property,need,obj;
 while(true){
 obj = textMatches(/[0-9]+\/[0-9]+/).findOne();
 arr = toIntArr(obj.text());
 property = parseInt(arr[0]), need = parseInt(arr[1]);
 if(property >= need){
 log("     %d    ,        %d    ,       ",property,need);
 make = textMatches(/    [0-9]+.*   /).clickable(true).findOne();
 sleep(200);
 make.click();
 sleep(1500);
 closeBtn = textContains("         ").findOne();
 sleep(200);
 closeBtn.click();
 sleep(1500);
 }
 else {
 log("     %d    ,        %d    ,          ",property,need);
 break;
 }
 }
 log("     !!!");
}
function keyListen()
{
 events.observeKey();
 events.onKeyDown("volume_down", function(event){
 exit();
 });
}
function main()
{
 console.show();
 textContains("    0   ,         ~").waitFor();
 var flag,ret;
 while(true){
 flag = false;
 ret =      (["  "]);
 sleep(500);
 if(ret) flag = true;
 ret =      (["  ","  "]);
 sleep(500);
 if(ret) flag = true;
 ret =      (["  ","  "]);
 sleep(500);
 if(ret) flag = true;
 ret =        ();
 sleep(500);
 if(ret) flag = true;
 if(!flag) break;
 }
 closeHall();
 collectCoin();
 makeCake();
 threads.start(function(){
 log("          ");
 alert("          ");
 });
 sleep(500);
 exit();
}
openJD();
threads.start(signIn);
threads.start(goToHall);
threads.start(closeFloaty);
threads.start(keyListen);
main();
총결산
2020 경 동 618 첩 케이크 js 스 크 립 트(친 측 용)에 관 한 이 글 은 여기까지 소개 되 었 습 니 다.더 많은 경 동 618 첩 케이크 js 스 크 립 트 내용 은 우리 의 이전 글 을 검색 하거나 아래 의 관련 글 을 계속 찾 아 보 세 요.앞으로 도 많은 응원 부 탁 드 리 겠 습 니 다!

좋은 웹페이지 즐겨찾기