阴阳师脚本代码,供学习

很久没有登录这个了.而且我也很久没有写脚本了,今天无意登录了一下,看到很多人都想学习这个脚本语言.现在把我以前的脚本源码发大家看看吧,这个以前是有30万运行次数的 几乎包含了游戏的所有功能;

require "TSLib"
screenOir = 1;
init("0",screenOir)
---##################################################################################################  --全局变量
UIretMack=0;
runModel="副本妖怪发现"
sectionClass = "0" -- 第一章,第几层
awakeType = "业火轮" --业火轮,风转符,水灵鲤,天雷鼓
runType = "0"
runAccount = "account"
runPassword = "password"
SImage="1.png";
STitle="鬼使黑";
tpower = 30;
SImageClass = "0";
loopNum = 3;--循环次数
originTime = getNetTime(); --获取时间
originTimeRock = originTime;--石头车的时间
originTimePerson = originTime;--个人突破时间
originTimeLockDevice = originTime;--锁定时间
originTimeExit = originTime;--重启时间
originTimeZD = originTime;--组队时间

GLchangeLead = false;
GLchangeViewer = false;
GLchangeViewerNum =0;
GLchangeLeadNum = 0;
yehuoyuanTpye = "tan"
dianjizutuiBtn = true;--点击组队钱的延迟
GLModelMark = true;--记录探索队员选择

appPath = userPath();--获取触动精灵、帮你玩脚本商城、企业版、小精灵客户端的用户路径

loopNumfilelist={}
loopNumfile = isFileExist(appPath.."/wdyloopNum.txt")
if loopNumfile then
  loopNumfilelist = readFile(appPath.."/wdyloopNum.txt")
  loopNum = tonumber(loopNumfilelist[1]) or 3;
end

wdyaccountNickNameList={}
wdyaccountNickNamefile = isFileExist(appPath.."/wdyaccountNickName.txt")
if wdyaccountNickNamefile then
  wdyaccountNickNameList = readFile(appPath.."/wdyaccountNickName.txt")
end

accountfile = isFileExist(appPath.."/res/wdyys.txt")--账号个数
if accountfile then
  accountList = readFile(appPath.."/res/wdyys.txt")  
else
  accountList={}
end

accountNumlist={}
accountNumfile = isFileExist(appPath.."/res/wdyysNum.txt")--当前个数
if accountNumfile then
  accountNumlist = readFile(appPath.."/res/wdyysNum.txt")
  accountNum = tonumber(accountNumlist[1]) or 0;
else
  accountNumlist[1]=0;
  writeFile(appPath.."/res/wdyysNum.txt",accountNumlist,"w")
  accountNum = 0;
end
mSleep(500)

RadioGroupStr=""
for a=1,loopNum do
  NickNameStr =  wdyaccountNickNameList[a];
  if NickNameStr == "" or NickNameStr == nil then
    NickNameStr = ("账号:"..a);
  end
  
  
  if a==loopNum then
    RadioGroupStr =RadioGroupStr..NickNameStr;
  else
    RadioGroupStr =RadioGroupStr..NickNameStr..","; 
  end  
end



function randomTap(x,y,r)
  r = tonumber(r) or 1;
  math.randomseed(tostring(os.time()):reverse():sub(1, 6))  --设置随机数种子
  local index = math.random(1,2)
  x = x + math.random(-r,r)
  y = y + math.random(-r,r)
  touchDown(index,x, y)
  mSleep(math.random(60,80))                --某些特殊情况需要增大延迟才能模拟点击效果
  touchUp(index, x, y)
  mSleep(math.random(80,100))   
  
end

---##################################################################################################  --全局变量



---##################################################################################################  --初始化面板
function initialStatu (...)
  
  local sz = require("sz")
  local json = sz.json
  w,h = getScreenSize();
  
  MyTable1 = {
    ["style"]        = "custom",
    ["rettype"]      = "table",
    ["width"]        = w,
    ["height"]       = h,
    ["config"]       = "dwdyysv0.dat",
    ["timer"]        = 99,
    ["orient"]       = 0,
    ["pagetype"]     = "multi",
    ["pagenumtype"]  = "dot",
    ["title"]        = "阴阳师全能辅助",
    ["cancelname"]   = "还没准备好",
    ["okname"]       = "下一步",
    pages            =
    {
      {
                        {
          ["type"] = "Image",
          ["src"]  = appPath.."/res/color239.png",
          ["rect"]= "0,0,1536,400"  ,  
        } ,  
        {
          ["type"] = "Image",
          ["src"]  = appPath.."/res/xxlogo.png",
          ["rect"]= "641,20,254,338"  ,  
        } ,
        {
          ["type"] = "Label",
          ["text"] = "【游戏开启时屏幕旋转方向】",
          ["size"] = 14,
          ["align"] = "left",
          ["color"] =  "219,71,31",
          ["rect"]= "70,450,1000,20"  ,  
        },
        {
          ["id"] = "a001",
          ["type"] = "RadioGroup",
          ["list"] = "home键靠左(默认),home键靠右",
          ["align"] = "left",
          ["images"] = appPath.."/res/homeLeft.png,"..appPath.."/res/homeRight.png",
          ["scale"] = 0.7,  
          ["select"] = "0",--第一个是零
          ["rect"]= "100,550,1400,300"  ,  
        },
        {
          ["type"] = "Label",
          ["text"] = " ※ 请务必关闭屏幕的虚拟窗、悬浮窗,否则会影响脚本正常识别。",
          ["size"] = 14,
          ["align"] = "left",
          ["color"] = "50,70,50",
          ["rect"]= "70,850,1200,200"  ,  
        },      
        {
          ["id"] = "a002",
          ["type"] = "CheckBoxGroup",
          ["list"] = "每隔 两个小时 【重启触动服务】", 
          ["rect"]= "118,1030,600,50",  
        },
        
        {
          ["type"] = "Label",
          ["text"] = " ※ 根据触动官方建议:重启触动服务可以解决部分系统脚本运行一段时间后出现不会识别的问题,并且重启服务会重置进程号,具有一定防封效果,但开启后会对定时灭屏有影响。",
          ["size"] = 14,
          ["align"] = "left",
          ["color"] =  "0, 168, 233",
          ["rect"]= "118,1050,1100,200"  ,  
        },          
        
        {
          ["type"] = "Label",
          ["text"] = "【“探索主界面” 如下图】",
          ["size"] = 14,
          ["align"] = "left",
          ["color"] =  "219,71,31",
          ["rect"]= "70,1300,1000,20"  ,  
        }
        ,
        {
          ["type"] = "Image",
          ["src"]  = appPath.."/res/wdyysts.png",
          ["rect"]= "118,1400,1300,730"  ,  
        }
        ,
        {
          ["type"] = "Label",
          ["text"] = "【“游戏主界面” 如下图】",
          ["size"] = 14,
          ["align"] = "left",
          ["color"] =  "219,71,31",
          ["rect"]= "70,2200,1000,20"  ,  
        }
        ,
        {
          ["type"] = "Image",
          ["src"]  = appPath.."/res/wdyyssy.png",
          ["rect"]= "118,2300,1300,730"  ,  
        }
        ,
        {
          ["type"] = "Label",
          ["text"] = "【“大队长位置” 如下图】",
          ["size"] = 14,
          ["align"] = "left",
          ["color"] =  "219,71,31",
          ["rect"]= "70,3100,1000,20"  ,  
        }
        ,
        {
          ["type"] = "Image",
          ["src"]  = appPath.."/res/wdyysgl.png",
          ["rect"]= "118,3200,1300,730"  ,  
        }
        ,
        {
          ["type"] = "Label",
          ["text"] = "\n1.※本脚本支持 5/5c/5s/6/6s/6plus/ipad。\n2.※游戏画质设置为精细。\n3.※关闭虚拟Home键等一切悬浮窗(小的可以放在主页头像的下面)。\n4.※关闭手机消息推送。",
          ["size"] = 14,
          ["align"] = "left",
          ["color"] = "50,70,50",
          ["rect"]= "70,4000,1000,300"  ,  
        }
        
      }
    }
  }  
  
  
  MyTable = {
    ["style"]        = "default",
    ["rettype"]      = "table",
    ["width"]        = w,
    ["height"]       = h,
    ["config"]       = "dwdyysv1.dat",
    ["timer"]        = 99,
    ["orient"]       = 0,
    ["pagetype"]     = "multi",
    ["pagenumtype"]  = "dot",
    ["title"]        = "阴阳师全能辅助",
    ["cancelname"]   = "还没准备好",
    ["okname"]       = "开始",
    pages            =
    {
      {
        {
          ["type"] = "Label",
          ["text"] = "-【每个功能详情请向右滑动】-",
          ["size"] = 20,
          ["align"] = "center",
          ["color"] =  "219,71,31",
        },
        {
          ["type"] = "Label",
          ["text"] = "1.※本脚本支持 5/5c/5s/6/6s/6plus/ipad。\n2.※游戏画质设置为精细。\n3.※关闭虚拟Home键等一切悬浮窗(小的可以放在主页头像的下面)。\n4.※关闭手机消息推送。",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] = "50,70,50",
        },
        {
          ["type"] = "Label",
          ["text"] = "\n【设置执行哪个页面的功能】",
          ["size"] = 20,
          ["align"] = "left",
          ["color"] =  "219,71,31",
        },
        {
          ["id"] = "a03",
          ["type"] = "RadioGroup",
          ["list"] = "「第1页」探索副本换狗粮,「第2页」快速组队上车                ,「第3页」御魂觉醒组队当队长                 ,「第4页」独立功能大集合      ,「第5页」一键消耗体力突破卷            ,「第6页」一键切换账号                 ",
          ["align"] = "center",
          ["select"] = "0",--第一个是零
        },
        {
          ["type"] = "Label",
          ["text"] = "\n【勾选全局配置】",
          ["size"] = 20,
          ["align"] = "left",
          ["color"] =  "219,71,31",
          },{
          ["id"] = "a00",
          ["type"] = "CheckBoxGroup",
          ["list"] = "接受所有悬赏邀请",
          ["nowrap"] = 1,
          ["width"] = 400,
        },
        {
          ["id"] = "a01",
          ["type"] = "CheckBoxGroup",
          ["list"] = "开启无人值守",
        },
        {
          ["type"] = "Label",
          ["text"] = " ※ 如果出现重复重启游戏的情况请关闭无人值守查看错误原因",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] = "50,70,50",
        },
        {
          ["type"] = "Label",
          ["text"] = "\n【定时关闭】",
          ["size"] = 20,
          ["align"] = "left",
          ["color"] =  "219,71,31",
        },
        {
          ["id"] = "cb001",
          ["type"] = "ComboBox",
          ["list"] = "不自动停止脚本(默认),1小时停止脚本灭屏,2小时停止脚本灭屏,3小时停止脚本灭屏,4小时停止脚本灭屏,5小时停止脚本灭屏,6小时停止脚本灭屏,7小时停止脚本灭屏,8小时停止脚本灭屏", 
          ["select"] = "0",  
        },
        {
          ["type"] = "Label",
          ["text"] = "\n【体力用完】",
          ["size"] = 20,
          ["align"] = "left",
          ["color"] =  "219,71,31",
        },
        {
          ["id"] = "a04",
          ["type"] = "RadioGroup",
          ["list"] = "关闭屏幕(默认),切换账号执行同样任务 ",
          ["align"] = "center",
          ["select"] = "0",--第一个是零
        },  
        {
          ["type"] = "Label",
          ["text"] = "1.※账号文件按照“账号----密码”格式,一行一个保存在wdyys.txt。\n\n2.※wdyys.txt 放在"..appPath.."/res/。",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        },
        {
          ["type"] = "Label",
          ["text"] = "「当前wdyys.txt账号个数」",
          ["size"] = 18,
          ["width"] = 500,
          ["align"] = "left",
          ["color"] = "50,60,160",
          ["nowrap"] = 1,
        },
        {
          ["type"] = "Label",
          ["text"] = tostring(#accountList),
          ["size"] = 18,
          ["width"] = 300,
          ["align"] = "left",
          ["color"] = "250,50,50",
        },
        {
          ["type"] = "Label",
          ["text"] = "「下次换号位置:从1开始」",
          ["size"] = 18,
          ["width"] = 500,
          ["align"] = "left",
          ["color"] = "50,60,160",
          ["nowrap"] = 1,
        },
        {
          ["id"] = "accountNum",
          ["type"] = "Edit",
          ["width"] = 300,
          ["prompt"] = "账号位置",
          ["text"] = tostring(accountNum),
          ["kbtype"] = "number",
        },
        {
          ["type"] = "Label",
          ["text"] = "\n\n-【本次更新内容】-",
          ["size"] = 20,
          ["align"] = "center",
          ["color"] =  "219,71,31",
        },
        {
          ["type"] = "Label",
          ["text"] = "\n[更新] 组队上车增加类别,队长模式,无人值守.",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        },
        {
          ["type"] = "Label",
          ["text"] = "\n 本次更新较多,如果有问题请及时联系",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        }
      },
      {
        
        {
          ["type"] = "Label",
          ["text"] = "1.探索副本换狗粮",
          ["size"] = 25,
          ["align"] = "center",
          ["color"] = "241,36,36",
          }, {
          ["type"] = "Label",
          ["text"] = "\n【妖怪发现探索副本】",
          ["size"] = 20,
          ["align"] = "left",
          ["color"] =  "219,71,31",
        },
        {
          ["id"] = "cb701",
          ["type"] = "ComboBox",
          ["list"] = "妖怪发现(普通),妖怪发现(困难),探索队员",
          ["select"] = "0",
          ["data"] = "第一章,第二章,第三章,第四章,第五章,第六章,第七章,第八章,第九章,第十章,第十一章,第十二章,第十三章,第十四章,第十五章,第十六章,第十七章,第十八章,第十九章,第二十章,第二十一章#第一章,第二章,第三章,第四章,第五章,第六章,第七章,第八章,第九章,第十章,第十一章,第十二章,第十三章,第十四章,第十五章,第十六章,第十七章,第十八章,第十九章,第二十章,第二十一章#探索队员",
          ["source"] = "fubenmode1"
        },
        {
          ["id"] = "cb7011",
          ["type"] = "ComboBox",
          ["select"] = "0",
          ["dataSource"] = "fubenmode1"
        },
        {
          ["id"] = "a702",
          ["type"] = "CheckBoxGroup",
          ["list"] = "10分钟打结界",
          ["width"] = 400,
          ["nowrap"] = 1,  
        },
        {
          ["id"] = "a704",
          ["type"] = "CheckBoxGroup",
          ["list"] = "只打经验怪",
        }, 
        {
          ["id"] = "a705",
          ["type"] = "CheckBoxGroup",
          ["list"] = "只打金币怪[颜色原因,识别出错情况高]",
        },
        {
          ["id"] = "a706",
          ["type"] = "CheckBoxGroup",
          ["list"] = "1小时打石距",
          ["width"] = 400,  
          ["nowrap"] = 1,  
        },
        {
          ["id"] = "a707",
          ["type"] = "CheckBoxGroup",
          ["list"] = "满10票个人突破",
          
        }, 
        {
          ["id"] = "a7051",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火小怪左",
          ["width"] = 400,  
          ["nowrap"] = 1,  
        },
        {
          ["id"] = "a7052",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火小怪右",  
        },
        {
          ["id"] = "a7053",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火大怪", 
          ["width"] = 400,            
          ["nowrap"] = 1,   
        },
        {
          ["id"] = "a7055",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火草人", 
        },      
        {
          ["id"] = "a7054",
          ["type"] = "CheckBoxGroup",
          ["list"] = "不打BOSS",  
        },
        {
          ["id"] = "a7000",
          ["type"] = "CheckBoxGroup",
          ["list"] = "困难副本开启「队长模式」",
          
        }, 
        {
          ["id"] = "a7001",
          ["type"] = "CheckBoxGroup",
          ["list"] = "替换大队长位置满级式神",
        },
        {
          ["type"] = "Label",
          ["text"] = "\n【当前狗粮满级后替换N卡狗粮的星级】",
          ["size"] = 20,
          ["align"] = "left",
          ["color"] =  "219,71,31",
        },
        {
          ["id"] = "a703",
          ["type"] = "RadioGroup",
          ["list"] = "默认(两星狗粮),三星狗粮",
          ["align"] = "center",
          ["select"] = "0",--第一个是零
        },
        {
          ["id"] = "a708",
          ["type"] = "CheckBoxGroup",
          ["list"] = "白达摩",
          ["width"] = 150, 
          ["select"] = "0",
          ["nowrap"] = 1,  
        },  
        {
          ["id"] = "a709",
          ["type"] = "CheckBoxGroup",
          ["list"] = "红达摩",
          ["select"] = "0",  
          ["width"] = 150, 
          
          ["nowrap"] = 1,  
        },  
        {
          ["id"] = "a710",
          ["type"] = "CheckBoxGroup",
          ["list"] = "非蓝黑蛋N卡",
          ["select"] = "0",
        },
        {
          ["type"] = "Label",
          ["text"] = " ※ 狗粮卡不勾选则不换狗粮。队员和单人模式的大队长放在换狗粮界面的最左边",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        }
        ,
        {
          ["type"] = "Label",
          ["text"] = "\n\n-【本页功能说明】-",
          ["size"] = 20,
          ["align"] = "center",
          ["color"] =  "219,71,31",
        },
        {
          ["type"] = "Label",
          ["text"] = "0.※一个号开启困难本探索队长模式,另一个号开启队员模式可以实现互肝",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        },
        {
          ["type"] = "Label",
          ["text"] = "1.※执行本页功能请在第一页勾选《1.探索副本换狗粮》 -【请注意横屏时Home的位置,在首页设置.】-",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        },
        {
          ["type"] = "Label",
          ["text"] = "2.※请来到探索主页面再运行本页面功能",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        },
        {
          ["type"] = "Label",
          ["text"] = "3.※队长要放在「替换狗粮页面」的「最左边」,队长如果已经满级则识别效果更佳。",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        },  
        {
          ["type"] = "Label",
          ["text"] = "4.※已知硬伤错误,因为N卡「寄生魂」满级后,游戏的显示问题,观众换狗粮界面不显示“满”,所以导致识别不到已满级,但是当观众界面两个同时满了,则不识别“满”直接全部替换",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        }
      }
      ,
      {
        {
          ["type"] = "Label",
          ["text"] = "2.快速组队上车",
          ["size"] = 25,
          ["align"] = "center",
          ["color"] = "241,36,36",
        },
        {
          ["type"] = "Label",
          ["text"] = "\n【选择组队队伍】",
          ["size"] = 20,
          ["align"] = "left",
          ["color"] =  "219,71,31",
        },
        {
          ["id"] = "cb201",
          ["type"] = "ComboBox",
          ["list"] = "妖气封印,石距,年兽,御魂,觉醒火,觉醒风,觉醒水,觉醒雷,金币妖怪,经验妖怪",
          ["select"] = "0",
          ["data"] = "随机SR(御札还魂),鬼使黑,海坊主,椒图,二口女,骨女,饿鬼,跳跳哥哥#石距#年兽#随机(默认),肆层,伍层,陆层,柒层,捌层,玖层,拾层 #随机(默认),肆层,伍层,陆层,柒层,捌层,玖层,拾层 #随机(默认),肆层,伍层,陆层,柒层,捌层,玖层,拾层 #随机(默认),肆层,伍层,陆层,柒层,捌层,玖层,拾层 #随机(默认),肆层,伍层,陆层,柒层,捌层,玖层,拾层#金币妖怪#经验妖怪 ",
          ["source"] = "zuduishangche"
        },
        {
          ["id"] = "cb202",
          ["type"] = "ComboBox",
          ["select"] = "0",
          ["dataSource"] = "zuduishangche"
        },
        {
          ["type"] = "Label",
          ["text"] = "\n【本页功能配置】",
          ["size"] = 20,
          ["align"] = "left",
          ["color"] =  "219,71,31",
        },
        {
          ["id"] = "a015",
          ["type"] = "CheckBoxGroup",
          ["list"] = "10分钟打结界",
          ["width"] = 250,  
          ["nowrap"] = 1,   
        },
        {
          ["id"] = "a016",
          ["type"] = "CheckBoxGroup",
          ["list"] = "刷新随机延迟500毫秒",
        },
        {
          ["id"] = "a017",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火草人",
        },
        {
          ["type"] = "Label",
          ["text"] = "\n【御魂集火】-非[左中右]怪物队形请关闭",
          ["size"] = 20,
          ["align"] = "left",
          ["color"] =  "219,71,31",
        },
        {
          ["type"] = "Label",
          ["text"] = " 第一回目",
          ["size"] = 14,
          ["align"] = "left",
          ["width"] = 200,  
          ["color"] =  "0,168,233",
          ["nowrap"] = 1,    
        },
        {
          ["id"] = "a2011",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火左",
          ["width"] = 200,
          ["nowrap"] = 1,    
        },
        {
          ["id"] = "a2012",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火中",
          ["width"] = 200,
          ["nowrap"] = 1,    
        },
        {
          ["id"] = "a2013",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火右",
          ["width"] = 200,   
          },{
          ["type"] = "Label",
          ["text"] = " 第二回目",
          ["size"] = 14,
          ["align"] = "left",
          ["width"] = 200,  
          ["color"] =  "0,168,233",
          ["nowrap"] = 1,    
        },
        {
          ["id"] = "a2021",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火左",
          ["width"] = 200,
          ["nowrap"] = 1,    
        },
        {
          ["id"] = "a2022",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火中",
          ["width"] = 200,
          ["nowrap"] = 1,    
        },
        {
          ["id"] = "a2023",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火右",
          ["width"] = 200,   
        },
        {
          ["type"] = "Label",
          ["text"] = " 第三回目",
          ["size"] = 14,
          ["align"] = "left",
          ["width"] = 200,  
          ["color"] =  "0,168,233",
          ["nowrap"] = 1,    
        },
        {
          ["id"] = "a2031",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火左",
          ["width"] = 200,
          ["nowrap"] = 1,    
        },
        {
          ["id"] = "a2032",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火中",
          ["width"] = 200,
          ["nowrap"] = 1,    
        },
        {
          ["id"] = "a2033",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火右",
          ["width"] = 200,   
        },
        {
          ["type"] = "Label",
          ["text"] = "\n\n-【本页功能说明】-",
          ["size"] = 20,
          ["align"] = "center",
          ["color"] =  "219,71,31",
        },
        {
          ["type"] = "Label",
          ["text"] = "\n-【使用本页面功能,请务必阅读以下三条】-",
          ["size"] = 20,
          ["align"] = "center",
          ["color"] =  "219,71,31",
          },{
          ["type"] = "Label",
          ["text"] = "1.※执行本页功能请在第一页勾选《2.快速组队上车》 -【请注意横屏时Home的位置,在首页设置.】-",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        },
        {
          ["type"] = "Label",
          ["text"] = "2.※请务必把游戏打开到‘游戏主页面’ 或者 ‘组队页面’(阴阳寮左边的组队按钮)",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        },
        {
          ["type"] = "Label",
          ["text"] = "2.※使用本页面功能请务必把游戏进入到对应界面",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        },
        {
          ["type"] = "Label",
          ["text"] = "3.※如需要设定战斗时的队伍阵型,请先手动玩一把,设定好队伍再运行脚本",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        }
      }
      ,
      {
        {
          ["type"] = "Label",
          ["text"] = "3.御魂觉醒组队当队长",
          ["size"] = 25,
          ["align"] = "center",
          ["color"] = "241,36,36",
        },
        {
          ["type"] = "Label",
          ["text"] = "\n【选择任务】",
          ["size"] = 20,
          ["align"] = "left",
          ["color"] =  "219,71,31",
          },{
          ["id"] = "cb051",
          ["type"] = "ComboBox",
          ["list"] = "组队御魂,组队觉醒,御魂觉醒队员",
          ["select"] = "0",
          ["data"] = "壹层,贰层,叁层,肆层,伍层,陆层,柒层,捌层,玖层,拾层#壹层,贰层,叁层,肆层,伍层,陆层,柒层,捌层,玖层,拾层#御魂觉醒队员",
          ["source"] = "fubenmode"
        },
        {
          ["id"] = "cb052",
          ["type"] = "ComboBox",
          ["select"] = "0",
          ["dataSource"] = "fubenmode"
          },        {
          ["type"] = "Label",
          ["text"] = "\n【选择觉醒类型】",
          ["size"] = 20,
          ["align"] = "left",
          ["color"] =  "219,71,31",
        },
        {
          ["id"] = "a051",
          ["type"] = "RadioGroup",
          ["list"] = "业火轮,风转符,水灵鲤,天雷鼓",
          ["align"] = "center",
          ["select"] = "0",--第一个是零
        },
        {
          ["type"] = "Label",
          ["text"] = "\n【发车人数】",
          ["size"] = 20,
          ["align"] = "left",
          ["color"] =  "219,71,31",
        },
        {
          ["id"] = "a052",
          ["type"] = "RadioGroup",
          ["list"] = "三人(默认),两人",
          ["align"] = "center",
          ["select"] = "0",--第一个是零
        },
        {
          ["type"] = "Label",
          ["text"] = "\n【队长邀请队员方式】",
          ["size"] = 20,
          ["align"] = "left",
          ["color"] =  "219,71,31",
        },
        {
          ["id"] = "a061",
          ["type"] = "RadioGroup",
          ["list"] = "公开组队(需手动邀请一次小号),非公开组队(组最近邀请,注意发车人数)",
          ["align"] = "center",
          ["select"] = "0",--第一个是零
        },
        {
          ["type"] = "Label",
          ["text"] = "\n【御魂集火】-非[左中右]怪物队形请关闭",
          ["size"] = 20,
          ["align"] = "left",
          ["color"] =  "219,71,31",
        },
        {
          ["type"] = "Label",
          ["text"] = " 第一回目",
          ["size"] = 14,
          ["align"] = "left",
          ["width"] = 200,  
          ["color"] =  "0,168,233",
          ["nowrap"] = 1,    
        },
        {
          ["id"] = "a3011",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火左",
          ["width"] = 200,
          ["nowrap"] = 1,    
        },
        {
          ["id"] = "a3012",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火中",
          ["width"] = 200,
          ["nowrap"] = 1,    
        },
        {
          ["id"] = "a3013",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火右",
          ["width"] = 200,   
          },{
          ["type"] = "Label",
          ["text"] = " 第二回目",
          ["size"] = 14,
          ["align"] = "left",
          ["width"] = 200,  
          ["color"] =  "0,168,233",
          ["nowrap"] = 1,    
        },
        {
          ["id"] = "a3021",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火左",
          ["width"] = 200,
          ["nowrap"] = 1,    
        },
        {
          ["id"] = "a3022",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火中",
          ["width"] = 200,
          ["nowrap"] = 1,    
        },
        {
          ["id"] = "a3023",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火右",
          ["width"] = 200,   
        },
        {
          ["type"] = "Label",
          ["text"] = " 第三回目",
          ["size"] = 14,
          ["align"] = "left",
          ["width"] = 200,  
          ["color"] =  "0,168,233",
          ["nowrap"] = 1,    
        },
        {
          ["id"] = "a3031",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火左",
          ["width"] = 200,
          ["nowrap"] = 1,    
        },
        {
          ["id"] = "a3032",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火中",
          ["width"] = 200,
          ["nowrap"] = 1,    
        },
        {
          ["id"] = "a3033",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火右",
          ["width"] = 200,   
        },
        {
          ["id"] = "a3044",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火草人",
          ["align"] = "center",      
        },
        {
          ["type"] = "Label",
          ["text"] = "\n\n-【本页功能说明】-",
          ["size"] = 20,
          ["align"] = "center",
          ["color"] =  "219,71,31",
        },
        {
          ["type"] = "Label",
          ["text"] = "\n-【使用本页面功能,请务必阅读以下三条】-",
          ["size"] = 20,
          ["align"] = "center",
          ["color"] =  "219,71,31",
        },  
        {
          ["type"] = "Label",
          ["text"] = "0.※一个号开启队长模式会一直邀请,另一个号开启队员会接受邀请,实现互肝",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        },
        {
          ["type"] = "Label",
          ["text"] = "1.※执行本页功能请在第一页勾选《3.御魂觉醒组队当队长》 -【请注意横屏时Home的位置,在首页设置.】-",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        },
        {
          ["type"] = "Label",
          ["text"] = "2.※请来到探索主页面再运行本页面功能",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        },
        {
          ["type"] = "Label",
          ["text"] = "3.※如需要设定战斗时的队伍阵型,请先手动玩一把,设定好队伍再运行脚本",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        }
      }
      ,
      {
        {
          ["type"] = "Label",
          ["text"] = "4.独立功能大集合",
          ["size"] = 25,
          ["align"] = "center",
          ["color"] = "241,36,36",
        },
        {
          ["type"] = "Label",
          ["text"] = "\n【请选择任务】",
          ["size"] = 20,
          ["align"] = "left",
          ["color"] =  "219,71,31",
        },
        {
          ["id"] = "a401",
          ["type"] = "ComboBox",
          ["list"] = "御魂单人挂机,觉醒单人挂机,结界突破个人,结界突破阴阳寮,业火原贪,业火原嗔,业火原痴,百鬼夜行,御灵神龙,御灵白藏主,御灵黑豹,御灵孔雀",
          ["align"] = "center",
          ["select"] = "0",
          ["data"] = "技能自动挂机,兔子黑科技#技能自动挂机#打满9个刷新,打完3个刷新#单人模式:单人挑战,单人模式:单人挑战+石距,队长模式:单人挑战+组队,队长模式:单人挑战+组队+石距,突破寮队员模式#技能自动挂机,兔子黑科技#技能自动挂机,兔子黑科技#技能自动挂机,兔子黑科技#百鬼夜行#技能自动挂机#技能自动挂机#技能自动挂机#技能自动挂机",
          ["source"] = "duligongneng"
        },
        {
          ["id"] = "a402",
          ["type"] = "ComboBox",
          ["select"] = "0",
          ["dataSource"] = "duligongneng"
        },
        {
          ["type"] = "Label",
          ["text"] = " ※ 组队的组员模式在对应队长的页面",
          ["size"] = 14,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        },          
        {
          ["type"] = "Label",
          ["text"] = "\n【「御魂」自动模式集火】",
          ["size"] = 20,
          ["align"] = "left",
          ["color"] =  "219,71,31",
        },      
        {
          ["type"] = "Label",
          ["text"] = " 第一回目",
          ["size"] = 14,
          ["align"] = "left",
          ["width"] = 200,  
          ["color"] =  "0,168,233",
          ["nowrap"] = 1,    
        },
        {
          ["id"] = "a4011",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火左",
          ["width"] = 200,
          ["nowrap"] = 1,    
        },
        {
          ["id"] = "a4012",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火中",
          ["width"] = 200,
          ["nowrap"] = 1,    
        },
        {
          ["id"] = "a4013",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火右",
          ["width"] = 200,   
          },{
          ["type"] = "Label",
          ["text"] = " 第二回目",
          ["size"] = 14,
          ["align"] = "left",
          ["width"] = 200,  
          ["color"] =  "0,168,233",
          ["nowrap"] = 1,    
        },
        {
          ["id"] = "a4021",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火左",
          ["width"] = 200,
          ["nowrap"] = 1,    
        },
        {
          ["id"] = "a4022",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火中",
          ["width"] = 200,
          ["nowrap"] = 1,    
        },
        {
          ["id"] = "a4023",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火右",
          ["width"] = 200,   
        },
        {
          ["type"] = "Label",
          ["text"] = " 第三回目",
          ["size"] = 14,
          ["align"] = "left",
          ["width"] = 200,  
          ["color"] =  "0,168,233",
          ["nowrap"] = 1,    
        },
        {
          ["id"] = "a4031",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火左",
          ["width"] = 200,
          ["nowrap"] = 1,    
        },
        {
          ["id"] = "a4032",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火中",
          ["width"] = 200,
          ["nowrap"] = 1,    
        },
        {
          ["id"] = "a4033",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火右",
          ["width"] = 200,   
        },
        {
          ["type"] = "Label",
          ["text"] = "\n【设置结界突破阴阳寮】",
          ["size"] = 20,
          ["align"] = "left",
          ["color"] =  "219,71,31",
        },  
        {
          ["id"] = "a403",
          ["type"] = "CheckBoxGroup",
          ["list"] = "继续攻打已经突破的寮",
          ["width"] = 200,   
        }, 
         {
          ["id"] = "a4044",
          ["type"] = "CheckBoxGroup",
          ["list"] = "集火草人",
          ["width"] = 120,   
        },
        {
          ["type"] = "Label",
          ["text"] = "\n\n-【本页功能说明】-",
          ["size"] = 20,
          ["align"] = "center",
          ["color"] =  "219,71,31",
        },
        {
          ["type"] = "Label",
          ["text"] = "\n-【使用本页面功能,请务必阅读以下三条】-",
          ["size"] = 20,
          ["align"] = "center",
          ["color"] =  "219,71,31",
          },{
          ["type"] = "Label",
          ["text"] = "1.※执行本页功能请在第一页勾选《4.独立功能大集合》 -【请注意横屏时Home的位置,在首页设置.】-",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        },
        {
          ["type"] = "Label",
          ["text"] = "2.※使用本页面功能请务必把游戏进入到对应界面",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        },
        {
          ["type"] = "Label",
          ["text"] = "3.※如需要设定战斗时的队伍阵型,请先手动玩一把,设定好队伍再运行脚本",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
          },{
          ["type"] = "Label",
          ["text"] = "\n【御魂、觉醒材料】",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "219,71,31",
        },
        {
          ["type"] = "Label",
          ["text"] = "※请来到游戏探索界面把层数选后好,停留在有“挑战”按钮的页面,然后执行脚本,脚本停止的条件是活力少于6.",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] = "50,70,50",
        },
        {
          ["type"] = "Label",
          ["text"] = "\n【妖怪发现副本】",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "219,71,31",
        },
        {
          ["type"] = "Label",
          ["text"] = "※请来到游戏探索界面把章节选好后,停留在有“探索”按钮的页面,然后执行脚本,打完大BOSS收了箱子和宝箱回到探索页面就会停止脚本",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] = "50,70,50",
          },{
          ["type"] = "Label",
          ["text"] = "\n【阴阳寮】",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "219,71,31",
        },
        {
          ["type"] = "Label",
          ["text"] = "※请来到游戏探索界面进入到结界突破后,停留在有“刷新”按钮的页面,然后执行脚本,打完阴阳寮三次会就退出脚本",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] = "50,70,50",
        },
        {
          ["type"] = "Label",
          ["text"] = "\n【业原火】",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "219,71,31",
        },
        {
          ["type"] = "Label",
          ["text"] = "※请来到游戏探索界面打开御魂后,停留在有“挑战”按钮的页面,然后执行脚本,卷用完了停止脚本",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] = "50,70,50",
        },
        {
          ["type"] = "Label",
          ["text"] = "\n【业原火-源博雅兔子黑科技】",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "219,71,31",
        },
        {
          ["type"] = "Label",
          ["text"] = "※源博雅特别版模式 必须选择阴阳术'源博雅';必须带上技能 '诛邪箭' 和 '影分身'\n※此模式,每一回目开始的时候,源博雅'会手动先使用影分身,再使用诛邪箭,所以必须带上这两个技能。\n※除了打火机,剩余的都要带上兔子,如果不是兔子则只使用普通攻击(人物用默认皮肤,打火机和兔子用觉醒皮肤)。\n※请来到游戏探索界面打开御魂后,停留在有“挑战”按钮的页面,然后执行脚本,卷用完了停止脚本。",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] = "50,70,50",
        },
        {
          ["type"] = "Label",
          ["text"] = "\n【接受组队模式】",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "219,71,31",
        },
        {
          ["type"] = "Label",
          ["text"] = "※请在游戏主页(有头像页面)开启这个模式,组队结束后要回到游戏主页。\n※此模式玩法1,大号开启当队长模式,小号开启此模式,实现互肝.\n※此模式玩法2,就是开启后,手动组队页面参加队伍,然后开始后就可以坐等别人组队了",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] = "50,70,50",
        }
      } 
      ,
      {
        {
          ["type"] = "Label",
          ["text"] = "5.一键消耗体力突破卷",
          ["size"] = 25,
          ["align"] = "center",
          ["color"] = "241,36,36",
        },
        {
          ["type"] = "Label",
          ["text"] = "\n【勾选则加入任务队列】\n",
          ["size"] = 20,
          ["align"] = "left",
          ["color"] =  "219,71,31",
        },
        {
          ["id"] = "a501",
          ["type"] = "CheckBoxGroup",
          ["list"] = "加入探索",
          ["width"] = 250,
          --["nowrap"] = 1,    
        },
        {
          ["id"] = "a5011",
          ["type"] = "ComboBox",
          ["list"] = "体力消耗完(默认),探索三回合,探索十回合", 
          ["select"] = "0",  
        },
        {
          ["type"] = "Label",
          ["text"] = " ※ 请在[探索副本换狗粮]界面设定探索需要的功能\n",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        },
        {
          ["id"] = "a502",
          ["type"] = "CheckBoxGroup",
          ["list"] = "加入御魂",
          ["width"] = 250,
          --["nowrap"] = 1,    
        },
        {
          ["id"] = "a5022",
          ["type"] = "ComboBox",
          ["list"] = "体力消耗完(默认),御魂三回合,御魂十回合", 
          ["select"] = "0",  
        },
        {
          ["type"] = "Label",
          ["text"] = " ※ 请在[御魂觉醒当队长]界面设定御魂需要的功能\n",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        },
        {
          ["id"] = "a503",
          ["type"] = "CheckBoxGroup",
          ["list"] = "加入觉醒",
          ["width"] = 200,
          --["nowrap"] = 1,    
        },
        {
          ["id"] = "a5033",
          ["type"] = "ComboBox",
          ["list"] = "体力消耗完(默认),觉醒三回合,觉醒十回合", 
          ["select"] = "0",  
        },
        {
          ["type"] = "Label",
          ["text"] = " ※ 觉醒的配置和御魂一致\n",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        },
        {
          ["id"] = "a504",
          ["type"] = "CheckBoxGroup",
          ["list"] = "加入结界突破",
          ["width"] = 250,
          --["nowrap"] = 1,    
        },
        {
          ["id"] = "a5044",
          ["type"] = "ComboBox",
          ["list"] = "满10卷打突破(默认),满1卷打突破", 
          ["select"] = "0",  
        },
        {
          ["type"] = "Label",
          ["text"] = " ※ 突破模式为个人突破,打三个刷新\n",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        },
        {
          ["id"] = "a505",
          ["type"] = "CheckBoxGroup",
          ["list"] = "加入一小时石距",
          ["width"] = 120,
          --["nowrap"] = 1,    
        },
        {
          ["type"] = "Label",
          ["text"] = " ※ 挂机过程中石头车为一个小时打一次,如果勾选任务全部都结束了,石头车也会停止。\n",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        },
        
        {
          ["type"] = "Label",
          ["text"] = "\n【本页功能说明】",
          ["size"] = 20,
          ["align"] = "left",
          ["color"] =  "219,71,31",
        },
        {
          ["type"] = "Label",
          ["text"] = " ※ 1.结束条件是所有任务都不能再进行了,在队列里的任务会穿插执行直到全部都完成。\n",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        },
        {
          ["type"] = "Label",
          ["text"] = " ※ 2.结束后需要锁屏或者切换账号请在脚本首页设置,本页面同样服从脚本首页的倒计时功能。\n",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        }
      }
      ,
      {
        {
          ["type"] = "Label",
          ["text"] = "6.一键切换账号",
          ["size"] = 25,
          ["align"] = "center",
          ["color"] = "241,36,36",
          },{
          ["type"] = "Label",
          ["text"] = "\n-【使用本页面功能,请务必阅读以下四条】-",
          ["size"] = 20,
          ["align"] = "center",
          ["color"] =  "219,71,31",
          },{
          ["type"] = "Label",
          ["text"] = "1.※执行本页功能请在第一页勾选《6.一键切换账号》 -【请注意横屏时Home的位置,在首页设置.】-",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        },
        {
          ["type"] = "Label",
          ["text"] = "2.※游戏登录成功后,会在要选区的时候停止脚本,由用户自己选择区服,进入游戏",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        },
        {
          ["type"] = "Label",
          ["text"] = "3.※账号的“备注”用于标记区分不同的账号,自己找起来快些,建议用区服或者账号游戏里的名字,备注名不能有标点符号和空格",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        },
        {
          ["type"] = "Label",
          ["text"] = "4.※账号信息只保存在config文件夹官方加密的dat内,删除这个文件即清空所有信息,账号个数设置成零也会删除账号信息",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] =  "50,70,50",
        },
        {
          ["type"] = "Label",
          ["text"] = "\n【设置账号的个数,默认3个,点击“开始”按钮重启脚本后生效】",
          ["size"] = 20,
          ["align"] = "left",
          ["color"] =  "219,71,31",
        },
        {
          ["type"] = "Label",
          ["text"] = "「只能输入小于30的正整数」",
          ["size"] = 18,
          ["width"] = 600,
          ["align"] = "left",
          ["color"] = "0,130,233",
          ["nowrap"] = 1,
        },
        
        {
          ["id"] = "countNum",
          ["type"] = "Edit",
          ["width"] = 250,
          ["prompt"] = "账号个数",
          ["text"] = tostring(loopNum),
          ["kbtype"] = "number",
        },
        
        {
          ["type"] = "Label",
          ["text"] = "「当前显示账号个数」",
          ["size"] = 18,
          ["width"] = 600,
          ["align"] = "left",
          ["color"] = "0,130,233",
          ["nowrap"] = 1,
        },
        {
          ["type"] = "Label",
          ["text"] = tostring(loopNum),
          ["size"] = 18,
          ["width"] = 350,
          ["align"] = "left",
          ["color"] = "250,50,50",
        },
        {
          ["type"] = "Label",
          ["text"] = "\n【选择要运行的账号「名字为账号的备注」】",
          ["size"] = 20,
          ["align"] = "left",
          ["color"] =  "219,71,31",
        },
        {
          ["id"] = "a011",
          ["type"] = "RadioGroup",
          ["list"] = RadioGroupStr,
          ["align"] = "center",
          ["select"] = "0",--第一个是零
          },{
          ["type"] = "Label",
          ["text"] = "\n【填写账号的信息】",
          ["size"] = 20,
          ["align"] = "left",
          ["color"] =  "219,71,31",
        },
        {
          ["type"] = "Label",
          ["text"] = "※备注名不要有标点符号和空格,用户名需要邮箱的后缀.com \n※「信息只保存在config文件夹官方加密的dat内,删除这个文件即清空所有信息,账号个数设置成零也会删除账号信息」",
          ["size"] = 18,
          ["align"] = "left",
          ["color"] = "50,70,50",
        } 
      } 
    }   
  }
  
  for i=1,loopNum do
    
    account1= {
      ["type"] = "Label",
      ["text"] = "\n------------------ 账号:"..i.." ------------------",
      ["size"] = 12,
      ["align"] = "center",
      ["color"] = "200,70,70",
    }
    account2= {
      ["id"] = "edit01"..i,
      ["type"] = "Edit",
      ["prompt"] = "请输入该账号的备注",
      ["text"] = "",
      ["kbtype"] = "ascii",
    }
    account3= {
      ["id"] = "edit02"..i,
      ["type"] = "Edit",
      ["prompt"] = "请输入邮箱全称",
      ["text"] = "",
      ["kbtype"] = "ascii",
    }   
    account4= {
      ["id"] = "edit03"..i,
      ["type"] = "Edit",
      ["prompt"] = "请输入密码",
      ["text"] = "",
      ["kbtype"] = "number",
    }
    
    
    table.insert(MyTable.pages[7],16+((i-1)*4),account1)
    table.insert(MyTable.pages[7],16+((i-1)*4)+1,account2)
    table.insert(MyTable.pages[7],16+((i-1)*4)+2,account3)
    table.insert(MyTable.pages[7],16+((i-1)*4)+3,account4) 
  end
  
  
  local MyJsonString1 = json.encode(MyTable1);
  UIret1,values1 = showUI(MyJsonString1)
  if UIret1 == 1 then
  else
    return;
  end
  
  local MyJsonString = json.encode(MyTable);
  UIret,values = showUI(MyJsonString)
  if UIret == 1 then    
    
    ---设置屏幕方向
    if values1.a001 =="0" then
      screenOir = 2;
    end 
    
    if values1.a001 =="1" then
      screenOir = 1;
    end 
    
    init("0",screenOir)
    
    if values.a03 =="0" then--1.探索换狗粮
      UIretMack=1;--
    end
    
    
    if values.a03 =="1" then--2.快速上车
      UIretMack=1;      
      
      if values.cb201 =="0" then--妖气封印--鬼使黑,海坊主,椒图,二口女,骨女,饿鬼,跳跳哥哥,金币妖怪,经验妖怪911,56
        if values.cb202 =="1" then--鬼使黑-
          SImage="guishiheiipad.png";
          STitle="鬼使黑"
          tpower = 3;
        end
        if values.cb202 =="2" then--海坊主-ipad
          SImage="haifangipad.png";
          STitle="海坊主"
          tpower = 3;
        end
        if values.cb202 =="3" then--椒图-
          SImage="jiaotuipad.png";
          STitle="椒图"
          tpower = 3;
        end
        if values.cb202 =="4" then--二口女-
          SImage="erkounvipad.png";
          STitle="二口女"
          tpower = 3;
        end
        if values.cb202 =="5" then--骨女--
          SImage="gunvipad.png";
          STitle="骨女"
          tpower = 3;
        end
        if values.cb202 =="6" then--饿鬼-ipad
          SImage="eguiipad.png";
          STitle="饿鬼"
          tpower = 3;
        end
        if values.cb202 =="7" then--跳跳哥哥-
          SImage="tiaotiaoipad.png";
          STitle="跳跳哥哥"
          tpower = 3;
        end
        --        if values.cb202 =="8" then--金币妖怪-
        --          SImage="jinbiipad.png";
        --          STitle="金币妖怪"
        --          tpower = 30;
        --        end
        --        if values.cb202 =="9" then--经验妖怪-
        --          SImage="jinyanipad.png";
        --          STitle="经验妖怪"
        --          tpower = 30;
        --        end
      end
      
      if values.cb201 =="1" then--石距
        STitle="石距"
        tpower = 30;
      end
      
      if values.cb201 =="2" then--年兽
        STitle="年兽"
        tpower = 30;        
      end
      
      if values.cb201 =="3" then--御魂
        SImageNUM = tonumber(tostring(values.cb202))+3;
        SImageNUMStr =tostring(SImageNUM).."层";
        SImage="YHipad_"..SImageNUM..".png";
        STitle="御魂"..SImageNUMStr;
        tpower = 4;
      end
      
      if values.cb201 =="4" or values.cb201 =="5" or values.cb201 =="6" or values.cb201 =="7" then--觉醒
        SImageNUM = tonumber(tostring(values.cb202))+3;
        SImageNUMStr =tostring(SImageNUM).."层";
        SImage="JXipad_"..SImageNUM..".png";
        STitle="觉醒"..SImageNUMStr;
        tpower = 4; 
      end   
      if values.cb201 ~="1" and values.cb201 ~="2" and values.cb202 =="0" then
        STitle = "正在随机"
      end
      if values.cb201 =="8" then--金币妖怪
        STitle="金币妖怪"
        tpower = 30;        
      end  
      
      if values.cb201 =="9" then--经验妖怪
        STitle="经验妖怪"
        tpower = 30;        
      end       
      
      
    end     
    
    
    if values.a03 =="2" then---执行御魂队长模式
      UIretMack=1;--
    end
    
    if values.a03 =="3" then--独立功能大集合
      UIretMack=1;--
    end
    
    if values.a03 =="4" then--执行一键每日
      UIretMack=1;--
    end
    
    if values.a03 =="5" then    --一键切换账号
      cNumStr=string.gsub(tostring(values.countNum), "^%s*(.-)%s*$", "%1")
      cNum = tonumber(cNumStr)
      if cNum < 0 then
        cNum = cNum * -1;
      end
      
      cNumZ =math.ceil(cNum)
      if cNumZ>30 then
        dialog("设置个数有误,不能大于30个.\n请现在重新启动脚本设置",6)
        mSleep(3000)
      else
        loopNumfilelist={}
        loopNumfilelist[1]=cNumZ;
        if cNumZ ~= loopNum then 
          delFile(appPath.."/wdyloopNum.txt")
          mSleep(500)
          writeFile(appPath.."/wdyloopNum.txt",loopNumfilelist,"w")
          mSleep(500)   
          dialog("账号个数更改为:"..cNumZ.." 个,\n请现在重启启动脚本",6)  
          
        else
          UIretMack=1;--
        end
      end
      
      if UIretMack==1 then
        runID = tonumber(values.a011);
        runID = runID +1;
        runIDStr = tostring(runID);
        editAStr ="edit02"..runIDStr;
        editPStr = "edit03"..runIDStr;
        runAccount = values[editAStr];
        runPassword = values[editPStr];
        if runAccount =="" or runAccount==nil then
          dialog("您选择的账号用户名为空,请核实后再运行,脚本退出", 0)
          lua_exit()
        end 
        
        if runPassword =="" or runPassword==nil then
          dialog("您选择的账号密码为空,请核实后再运行,脚本退出", 0)
          lua_exit()
        end
      end
    end
    
    --------------------------------------------保存账号的昵称到本地
    j=1
    wdyaccountNickNameList={}
    for i=16,#MyTable.pages[7],4 do
      
      editStr ="edit01"..j;
      wdyaccountNickName = values[editStr]
      
      wdyaccountNickName=string.gsub(wdyaccountNickName, ",", "");
      wdyaccountNickName=string.gsub(wdyaccountNickName, " ", "")
      if wdyaccountNickName == "" or wdyaccountNickName == nil then
        wdyaccountNickName = ("账号:"..j);
      end
      table.insert(wdyaccountNickNameList,j,wdyaccountNickName)
      j=j+1;
    end
    
    
    delFile(appPath.."/wdyaccountNickName.txt")
    mSleep(500)
    writeFile(appPath.."/wdyaccountNickName.txt",wdyaccountNickNameList,"w")
    mSleep(500)  
    
    --------------------------------------------保存账号的昵称到本地
    
    
    
  end
  
  if values.a04 =="1" then--切换账号  --保存个数
    accountNumlist1={};
    caccountNumStr=string.gsub(tostring(values.accountNum), "^%s*(.-)%s*$", "%1")
    caccountNum = tonumber(caccountNumStr)   
    accountNumlist1[1]= caccountNum;
    delFile(appPath.."/res/wdyysNum.txt")
    mSleep(500)
    writeFile(appPath.."/res/wdyysNum.txt",accountNumlist1,"w")
    mSleep(500)  
    
  end    
  
end

---##################################################################################################  --初始面板







---##################################################################################################  --常用函数

--检测指定文件是否存在
function file_exists(file_name)
  local f = io.open(file_name, "r")
  return f ~= nil and f:close()
end


function tansuoshouye(...)--探索首页--返回-御魂-挑战卷
   if zhandouhuamian() then
    return false;
  end   
  return (isColor(  76,   97, 0xf0f5fb, 85) and isColor( 858,   52, 0x731e11, 85) and isColor(1183,   52, 0x1d415b, 85) and isColor(1410,   65, 0x2a170c, 85))--pad
end

function youxishouye(...)-- 游戏主页--信封-短信-加成
   if zhandouhuamian() then
    return false;
  end   
  return (isColor(1868,   50, 0xd6c4a1, 85) and isColor(1972,   46, 0xd6c4a1, 85) and isColor(1988,   78, 0xd6c4a1, 85))
end


function homeIconClick(...)--点击首页头像位置
  randomTap(395,   94,2)
  mSleep(1500)
end




function ready6(...)--ready6
  local  x1,y1;
  mSleep(200)
  x1,y1 = findMultiColorInRegionFuzzy( 0xfff1cb, "60|6|0xfff2ce,122|170|0x9f1f0d,-28|-2|0xfff4d3", 90, 1696, 1126, 2028, 1462)--ipad
  --ready6
  if x1 ~= -1 and y1 ~= -1 then        --如果在指定区域找到某图片符合条件
    randomTap(1868, 1261,5)
    turnFight = 1;  
    mSleep(1500);
  end
end


function zhandouhuamian(...)--战斗画面
  return (isColor(  60,   66, 0xd6c4a1, 85) and isColor( 172,   68, 0xd6c4a1, 85) and isColor( 292,   58, 0xd6c4a1, 85))
end--战斗画面


function fightManual6(...)--fightManual6
  noticeDown() 
  
  if zhandouhuamian() then
    x,y = findMultiColorInRegionFuzzy( 0xf2edda, "0|-13|0xf8f3e0,17|-15|0xe9e5d2,3|-22|0xf4eedc", 90, 42, 1399, 144, 1491)--ipad
    --fightManual6
    if x ~= -1 and y ~= -1 then        --如果在指定区域找到某图片符合条件               
      randomTap(88, 1441,2)
      mSleep(1500)
    end 
    
  end--战斗画面
end



function windrum3_6(...)--失败--windrum3_6
  if zhandouhuamian() then
    return -1,-1;
  end
  --    if zuduiBox() or yuhunjuexingTZ() or tansuoInHome() or tupoInHomeOri() or tupoInHome() then
  --    else
  --        windrumClick();
  --    end  
  return findMultiColorInRegionFuzzy( 0x514b5c, "-33|61|0x5e5468,51|68|0x5b5265,7|44|0xb9a790,44|25|0xb29e87", 90,  639, 19, 1247, 462)
end

function windrum2_6(...)--胜利--windrum2_6
  if zhandouhuamian() then
    return -1,-1;
  end
  --    if zuduiBox() or yuhunjuexingTZ() or tansuoInHome() or tupoInHomeOri() or tupoInHome() then
  --    else
  --        windrumClick();
  --    end  
  return findMultiColorInRegionFuzzy( 0x7f1910, "-43|60|0x991c12,50|70|0xa21b11,5|76|0xd3c4ae,42|20|0xcdbda8,187|45|0xa38a5a", 90, 639, 19, 1247, 462)--ipad
end


function windrumClick(...)---windrumClick
  invite()
  randomTap(1000, 1510,5)
  mSleep(1000)
end





function inviteRefuse(...)--邀请拒绝
  if (isColor(  76,  407, 0xd86a57, 85) and isColor( 219,  418, 0x54b05f, 85)) then
    x,y = findMultiColorInRegionFuzzy( 0xdd7260, "-10|-16|0xda6856,23|-21|0xe07665", 90, 16, 356, 122, 463)
    if x ~= -1 and y ~= -1 then        --如果在指定区域找到某图片符合条件                   
      touchDown(1,x,y); --
      mSleep(30);
      touchUp(1,x,y); 
      mSleep(200)
    end 
  end--有叉叉和勾出现
end


function inviteAccept(...)--邀请接受
  if (isColor(  76,  407, 0xd86a57, 85) and isColor( 219,  418, 0x54b05f, 85)) then
    x,y = findMultiColorInRegionFuzzy( 0x56b261, "-18|-14|0x5bb566,27|-22|0x5fb96a", 90, 164, 353, 279, 461)
    if x ~= -1 and y ~= -1 then        --如果在指定区域找到某图片符合条件                   
      touchDown(1,x,y); --
      mSleep(30);
      touchUp(1,x,y); 
      mSleep(200)
    end         
  end--有叉叉和勾出现
end




function zuduiBox(...)
  return (isColor( 712,  856, 0xdf6851, 85) and isColor(1334,  912, 0xf3b25e, 85) and isColor(1022,  932, 0xcbb59c, 85) and isColor(1022,  600, 0xcbb59c, 85) and isColor( 956,  884, 0xdf6851, 85))
  
end--邀请组队页面


function zuduiJujue(...)--出现了再次组队的框--拒绝
  if zuduiBox() then
    randomTap(836,  874,2)
    mSleep(1000)            
  end--出现了再次组队的框--拒绝    
end


function zuduiJieshou(...)--出现了再次组队的框--接受
  if zuduiBox() then
    randomTap(1210,  878,2)
    mSleep(1000)            
  end--出现了再次组队的框--接受    
end

function zuduiLoading(...)
  return (isColor( 250, 1134, 0xdf6851, 85) and isColor( 480, 1178, 0xdf6851, 85) and isColor( 542, 1158, 0xc7bdb4, 85))
end




function yuhunjuexingTZ(...)
  return (isColor(1438,  960, 0xf3b25e, 85) and isColor(1614, 1018, 0xf3b25e, 85) and isColor(1612,  958, 0xf3b25e, 85) and isColor(1686,  418, 0x6a2f39, 85))
  
end--御魂觉醒挑战界面


function zuduiCreatQu(...)
  return (isColor( 138,  633, 0x8d7245, 85) and isColor( 188, 1389, 0x1d1815, 85) and isColor(1908,  640, 0x8d7245, 85) and isColor(1922,  525, 0x692f38, 85)) 
end--组队页面创建队伍-刷新-创建-花

function zuduiCreatType(...)--组队创建队伍类型页面
  return (isColor( 562, 1116, 0xdf6851, 85) and isColor(1320, 1115, 0xf3b25e, 85)) 
end--取消和创建按钮

function tansuoTPJ(count)
  count = count or 10;
  local huoliSTR = "";
  local huoliSTRNUM = 0;
  local huoli = 0;
  if tansuoshouye() then
    whitelist = "0123456789-"
    huoliSTR = ocrText(1242, 25, 1310, 65, 0,whitelist) --首页-御魂-发现副本
    mSleep(1000)
    huoli = tonumber(tostring(huoliSTR)) or 0
    huoliSTRNUM = string.len(huoliSTR)
    if huoli >= count then
      return "1"
    end
  end
  return "0"
  
end--御魂觉醒识别体力

function tansuoTL(count)
  count = count or 6;
  local huoliSTR = "";
  local huoliSTRNUM = 0;
  local huoli = 0;
  if tansuoshouye() then
    whitelist = "0123456789-"
    huoliSTR = ocrText( 1568, 28, 1613, 63, 0,whitelist) --首页-御魂-发现副本
    mSleep(1000)
    huoli = tonumber(tostring(huoliSTR)) or 0
    huoliSTRNUM = string.len(huoliSTR)
    if huoli >= count or (huoliSTRNUM > 1 and count~=30) then
      return "1"
    end
  end
  return "0"
  
end--探索主页--体力 

function tansuoButTS(...)
  return (isColor(1442, 1018, 0xf3b25e, 85) and isColor(1606, 1074, 0xf3b25e, 85) and isColor(1696,  450, 0x6a2f39, 85))
end--出现探索按钮--叉叉探索


function tansuoInHome(...)
  return (isColor(  58,  104, 0xf0f5fb, 85) and isColor(1828,   32, 0xd6c4a1, 85) and isColor(1942,   34, 0xd6c4a1, 85) and isColor(2030,   78, 0x76471f, 85) and isColor(1897, 1437, 0xece7d5, 85))
end--探索副本里的主页面


function tansuoFightMiddle(...)
  return findMultiColorInRegionFuzzy( 0xd0d2f9, "-18|-3|0x242754,9|19|0x1c1f4b,10|-24|0x24150e", 90, 40, 184, 2014, 1350)
end--探索小怪图标

function tansuoFightMax(...)
  return findMultiColorInRegionFuzzy( 0xfefaf3, "-5|-9|0xa02525,14|11|0x540b0c,11|-25|0x462d4b", 90, 112, 186, 1958, 1276)
end--探索大怪图标

function tansuoFightExp(...)
  if tansuoInHome() then
    return findMultiColorInRegionFuzzy( 0x23677c, "0|27|0x921e1d", 90, 40, 184, 2014, 1350);
  else
    return -1,-1;  
  end  
end--探索经验图标

function tansuoFightMon(...)--findMultiColorInRegionFuzzy( 0xd7c667, "8|1|0xdacd72,-1|7|0xdbc464", 90, 0, 0, 2047, 1535)
  if tansuoInHome() then
    return findMultiColorInRegionFuzzy( 0xd7c667, "8|1|0xdacd72,-1|7|0xdbc464",  90, 40, 184, 2014, 1350);
  else
    return -1,-1;  
  end  
end--探索金币图标

function yeyuanhuoTS(...)--御魂赢有了
  --return (isColor( 899,  471, 0x943920, 85) and isColor( 899,  479, 0xf4b25f, 85) and isColor(1006,  520, 0x953b2a, 85) and isColor(1069,  125, 0x662c45, 85))
end--业原火--没有组队按钮-来到挑战按钮

function noticeDown(...)
  mSleep(30)
  x1,y1 = findMultiColorInRegionFuzzy( 0xe8d4cf, "36|5|0x682b47,10|32|0x6a2f39,-21|0|0x74363a", 90, 799, 6, 910, 113)
  if x1 ~= -1 and y1 ~= -1 then        --如果在指定区域找到某图片符合条件
    touchDown(1,x1,y1); 
    mSleep(50);
    touchUp(1,x1,y1); 
    mSleep(1000);
    x1=-1;
    y1=-1;
  end --中间的叉叉
  
  
  x,y = findMultiColorInRegionFuzzy( 0xe8d4cf, "36|5|0x682b47,10|32|0x6a2f39,-21|0|0x74363a", 90, 1398, 10, 2040, 674)
  if x ~= -1 and y ~= -1 then        --如果在指定区域找到某图片符合条件
    touchDown(1,x,y); 
    mSleep(50);
    touchUp(1,x,y); 
    mSleep(1000);
    x=-1;
    y=-1;
  end --右边的叉叉
  
  if (isColor( 745,  695, 0xf3b25e, 85) and isColor(1131,  694, 0xf3b25e, 85) and isColor( 728,  397, 0x9f876d, 85) and isColor(1011,  763, 0xcbb59c, 85)) then
    randomTap( 824,  714,2)--pad
    mSleep(1000)
  end--关联手机 
  
  if exhaustion() then--体力--
    if values.a03 =="4" then --一键消耗,回环;
      gotoTansuoHome();
      simpleExhaustion()
    else    
      energyLoop();
    end
  end--体力购买页面
  
  invite()
  
end


function invite(...)
  
  mSleep(30)
  if (isColor(1366, 1008, 0xdf7462, 85) and isColor(1361,  857, 0x52af5d, 85) and isColor( 802,  394, 0xb39276, 85) and isColor(1228,  400, 0xb39276, 85)) then
    if values.a00 =="0" then
      randomTap(1361,  857,2); --接受悬赏
      mSleep(1000)
    else
      randomTap(1366, 1008,2); --拒绝悬赏
      mSleep(1000)
    end
    return;
  end
  
  
  if exhaustion() then--体力--
    if values.a03 =="4" then --一键消耗,回环;
      gotoTansuoHome();
      simpleExhaustion()
    else    
      energyLoop();
    end
  end--体力购买页面
  
end


function exhaustion(...)--体力--关闭坐标:
  return (isColor( 911,  937, 0xf3b25e, 85) and isColor( 910,  969, 0xf3b25e, 85) and isColor(1131,  940, 0xf3b25e, 85) and isColor(1123,  970, 0xf3b25e, 85) and isColor(1103,  779, 0x22180f, 85) and isColor(1509,  533, 0xcc6e95, 85))--pad
end--体力购买框


function downloadVoice(...)
  if (isColor( 713,  860, 0xdf6851, 85) and isColor(1324,  909, 0xf3b25e, 85) and isColor(1013,  597, 0xcbb59c, 85) and isColor(1018,  938, 0xcbb59c, 85)) then
    randomTap(831,  881,2)--p
    mSleep(1000)
  end--拒绝下载语音
end



function HomeToExplore(...)
  
  while (true) do
    
    x,y = findMultiColorInRegionFuzzy( 0xffffc6, "11|5|0x23180d,24|7|0xffffb8,12|45|0x271c0e", 90, 518, 275, 1887, 365)
    --exploreIconIPAD
    if x ~= -1 and y ~= -1 then        --如果在指定区域找到某图片符合条件   
      touchDown(1,x,  y); 
      mSleep(50);
      touchUp(1,x,  y);
      mSleep(2000);
      x=-1;
      y=-1;
    end
    
    
    x1, y1 = findMultiColorInRegionFuzzy( 0xffffca, "9|6|0x2a1c0f,22|6|0xffffc2,9|46|0x302010", 90, 518, 275, 1887, 365)
    --exploreIconIPAD_1
    if x1 ~= -1 and y1 ~= -1 then        --如果在指定区域找到某图片符合条件         
      touchDown(1,x1,y1); 
      mSleep(50);
      touchUp(1,x1,y1);
      mSleep(2000)
      x1=-1;
      y1=-1;
    end
    
    if tansuoshouye() then
      break;
    end--探索首页--返回-御魂-挑战卷
    
  end
  
  
end


function ExploreToHome(...)
  whileCount = 0
  while (true) do
    whileCount = whileCount + 1;
    if whileCount>=1000 then
      errorLoop()
      dialog("当前页面不是探索主页", 0)
      lua_exit();
    end
    if tansuoshouye() then
      touchDown(1,73,   98); 
      mSleep(50);
      touchUp(1,73,   98);
      mSleep(3000);
    end--探索首页--返回-御魂-挑战卷
    downloadVoice()
    accountIdentification()--取消认证
    noticeDown()    
    if tansuoshouye() then--不在探索首页
    else
      if youxishouye() then
        break;
      end -- 游戏主页--头像下的网易logo
    end 
    
    
  end
end


function tupoInHome(...)
  return (isColor( 258, 1158, 0xf3b25e, 85) and isColor( 266, 1068, 0xa5521e, 85) and isColor(1906,  328, 0x682f38, 85) and isColor( 544, 1180, 0xd6c9b9, 85))
end--突破首页


function tupoInHomeOri(...)
  return (isColor( 182, 1286, 0x181412, 85) and isColor( 990,  268, 0xf8f3e0, 85) and isColor(1100,  278, 0xf8f3e0, 85) and isColor(1906,  328, 0x672f38, 85))
end--突破寮首页



function tupoCount(...)--卷的数量
  if tupoInHome() then 
    whitelist = "0123456789-"
    huoliSTR = ocrText(644, 1164, 696, 1202, 0,whitelist)
    huoli = tonumber(tostring(huoliSTR)) or 0
    if huoli < 1  then
      while (true) do
        invite();
        if tansuoshouye() then  
          return 1
        else
          noticeDown() 
          
        end--退出点击结界突破
      end 
    end 
  end
  
  return 0
end


function timeOut(...)
  if values.cb001~="0" then
    local baseTime = values.cb001;
    local baseTimeNum = tonumber(tostring(baseTime));
    local currentTime = getNetTime(); 
    local tmpTime = currentTime - originTimeLockDevice
    
    if tmpTime >=(baseTimeNum*3600) then
      lockDevice(); 
      lua_exit();
    end 
  end
  
  
  if values1.a002 =="0" then
    local currentTime = getNetTime(); 
    local tmpTime = currentTime - originTimeExit;
    
    if tmpTime >=(2*3600) then
      os.exit();
    end     
    
  end  
  return;
end



function assFight(...)--集火
  local x,y;
  if huimu1() then 
    turnFight = 1
  end
  if huimu2() then 
    turnFight = 2
  end
  if huimu3() then 
    turnFight = 3
  end   
  
  
  if values.a03 =="0"  and zhandouhuamian() then--探索副本换狗粮
    
    x,y = findMultiColorInRegionFuzzy( 0xfd5871, "16|-2|0xfc5489,5|10|0xfe9962,12|9|0xfe9564", 90, 558, 1, 1558, 500)--已经有集火图标
    if x ~= -1 and y ~= -1 then 
      return;
    end
    
    
    if (isColor(  71, 1303, 0xa67232, 85) and isColor(  50, 1316, 0xd3ad65, 85)) then--扭转
      randomTap(69, 1305,2)
      mSleep(800)  
    end
    
    if values.a7051 =="0"  and zhandouhuamian() then 
      randomTap( 744,  465,3)
      mSleep(500)
    end--集火小怪左
    
    
    if values.a7052 =="0"  and zhandouhuamian() then 
      randomTap(1364,  461,3)
      mSleep(500)       
    end--集火大怪右  
    
    if values.a7053 =="0"  and zhandouhuamian() then 
      randomTap(1057,  220,3)
      mSleep(500)
    end--集火大怪       
    
    if values.a7055 =="0"  and zhandouhuamian() then 
      randomTap( 1059,  569,2)--p
      mSleep(500)
    end--集火草人
    
  end
  
  if values.a03 =="1"  and zhandouhuamian() then--快速上车  
    x,y = findMultiColorInRegionFuzzy( 0xfd6569, "15|0|0xfd676a,4|10|0xfea161,10|10|0xffa364", 90, 335, 2, 1746, 700)--已经有集火图标
    if x ~= -1 and y ~= -1 then 
      return;
    end
    
    if (isColor(  71, 1303, 0xa67232, 85) and isColor(  50, 1316, 0xd3ad65, 85)) then--扭转
      randomTap(69, 1305,2)
      mSleep(800)  
    end
    
    if turnFight == 1  and zhandouhuamian() then
      if values.a2011 =="0" then
        assFightLeft()
      end
      if values.a2012 =="0" then
        assFightCenter()
      end
      if values.a2013 =="0" then
        assFightRight()
      end       
    end
    
    if turnFight == 2  and zhandouhuamian() then
      if values.a2021 =="0" then
        assFightLeft()
      end
      if values.a2022 =="0" then
        assFightCenter()
      end
      if values.a2023 =="0" then
        assFightRight()
      end           
    end
    
    if turnFight == 3  and zhandouhuamian() then
      if values.a2031 =="0" then
        assFightLeft()
      end
      if values.a2032 =="0" then
        assFightCenter()
      end
      if values.a2033 =="0" then
        assFightRight()
      end           
    end 
    
    if values.a017 == "0"  and zhandouhuamian() then
       assFightCao();
    end
  end
  
  if values.a03 =="2"  and zhandouhuamian() then--御魂队长模式
    x,y = findMultiColorInRegionFuzzy( 0xfd6569, "15|0|0xfd676a,4|10|0xfea161,10|10|0xffa364", 90, 335, 2, 1746, 700)--已经有集火图标
    if x ~= -1 and y ~= -1 then 
      return;
    end
    
    if (isColor(  71, 1303, 0xa67232, 85) and isColor(  50, 1316, 0xd3ad65, 85)) then--扭转
      randomTap(69, 1305,2)
      mSleep(800)  
    end
    
    if turnFight == 1  and zhandouhuamian() then
      if values.a3011 =="0" then
        assFightLeft()
      end
      if values.a3012 =="0" then
        assFightCenter()
      end
      if values.a3013 =="0" then
        assFightRight()
      end       
    end
    
    if turnFight == 2  and zhandouhuamian() then
      if values.a3021 =="0" then
        assFightLeft()
      end
      if values.a3022 =="0" then
        assFightCenter()
      end
      if values.a3023 =="0" then
        assFightRight()
      end           
    end
    
    if turnFight == 3  and zhandouhuamian() then
      if values.a3031 =="0" then
        assFightLeft()
      end
      if values.a3032 =="0" then
        assFightCenter()
      end
      if values.a3033 =="0" then
        assFightRight()
      end           
    end 
    if values.a3044 == "0"  and zhandouhuamian() then
       assFightCao();
    end
  end   
  
  
  if values.a03 =="3"  and zhandouhuamian() then--独立功能大集合   
    x,y = findMultiColorInRegionFuzzy( 0xfd6569, "15|0|0xfd676a,4|10|0xfea161,10|10|0xffa364", 90, 335, 2, 1746, 700)--已经有集火图标
    if x ~= -1 and y ~= -1 then 
      return;
    end
    
    if (isColor(  71, 1303, 0xa67232, 85) and isColor(  50, 1316, 0xd3ad65, 85)) then--扭转
      randomTap(69, 1305,2)
      mSleep(800)  
    end
    
    if turnFight == 1  and zhandouhuamian() then
      if values.a4011 =="0" then
        assFightLeft()
      end
      if values.a4012 =="0" then
        assFightCenter()
      end
      if values.a4013 =="0" then
        assFightRight()
      end       
    end
    
    if turnFight == 2  and zhandouhuamian() then
      if values.a4021 =="0" then
        assFightLeft()
      end
      if values.a4022 =="0" then
        assFightCenter()
      end
      if values.a4023 =="0" then
        assFightRight()
      end           
    end
    
    if turnFight == 3  and zhandouhuamian() then
      if values.a4031 =="0" then
        assFightLeft()
      end
      if values.a4032 =="0" then
        assFightCenter()
      end
      if values.a4033 =="0" then
        assFightRight()
      end           
    end 
    if values.a4044 == "0"  and zhandouhuamian() then
       assFightCao();
    end
  end           
  
  if huimu1() then 
    turnFight = 1
  end
  if huimu2() then 
    turnFight = 2
  end
  if huimu3() then 
    turnFight = 3
  end   
  
  
end


function huimu1(...)--出现中间的回目
  return (isColor( 897,  703, 0xdcc8b1, 85) and isColor( 908,  773, 0x272420, 85) and isColor( 981,  898, 0xf1d4a0, 85) and isColor(1092,  986, 0x7f160a, 85))
end

function huimu2(...)--出现中间的回目
  return (isColor( 906,  707, 0xdcc8af, 85) and isColor(1096,  983, 0x861509, 85) and isColor( 922,  755, 0x272420, 85) and isColor( 971,  902, 0xf1d4a0, 85))
end


function huimu3(...)--出现中间的回目
  return (isColor( 912,  698, 0xdbc4ab, 85) and isColor(1110,  976, 0x971709, 85) and isColor( 917,  754, 0x272420, 85) and isColor( 973,  899, 0xf2d5a1, 85))
end

function assFightLeft(...)
  if zhandouhuamian() then 
    randomTap( 525,  511,3)
    mSleep(500) 
    
  end
end

function assFightCenter(...)
  if zhandouhuamian() then 
    randomTap(1064,  414,3)
    mSleep(500) 
    
  end
end

function assFightRight(...)
  if zhandouhuamian() then 
    randomTap(1600,  511,3)
    mSleep(500) 
    
  end
end

function assFightCao(...)
  if zhandouhuamian() then 
    randomTap( 1067,  607,3)--p
    mSleep(1200)    
    
  end
end

function backtotansuoHome(...)--返回探索主页
  whileCount=0;
  while (true) do
    whileCount=whileCount+1;
    if whileCount>=100 then
      break;  --执行了一百次都不能就是卡住了自动退出 重新开始执行脚本
    end--直到点击进到页面
    noticeDown();
    if tansuoshouye() then
      
      break;
    end--识别返回和突破
    
    if tansuoInHome() then--外面的界面
      if tansuoshouye() then
        
      else
        randomTap(72,  104,2)
        mSleep(500);
      end
    end
    
    if (isColor( 688,  816, 0xf3b25e, 85) and isColor( 916,  858, 0xf3b25e, 85) and isColor(1130,  822, 0xf3b25e, 85) and isColor(1344,  852, 0xf3b25e, 85) and isColor(1016,  644, 0xcbb59c, 85)) then
      randomTap(1242,  834,2)
      mSleep(1500);
    end --IPAD
    
    if tansuoshouye() then
      break;
    end--识别返回和突破
    
    if zuduiBox() then
      break;
    end--组队框        
    
  end
  
end

function noticeGhost(...)--百鬼夜行公告栏
  return (isColor(1452, 1021, 0xf3b25e, 85) and isColor(1454, 1073, 0xf3b25e, 85) and isColor( 409, 1099, 0xa5998f, 85) and isColor(1703,  485, 0x672f38, 85)) --p
end


function choiceGhost(...)--百鬼夜行选择
  return (isColor( 902,  199, 0xddd5cc, 85) and isColor( 943,  224, 0x272420, 85) and isColor(1007,  212, 0xe3dcd4, 85) and isColor(1038,  230, 0x272420, 85)) --p
end

function homeGhost(...)--在鬼页面
  return (isColor( 316, 1453, 0x271818, 85) and isColor(  61,   95, 0xf0f5fb, 85) and isColor( 367, 1458, 0xf2cc4a, 85))--p
end

function boxGhost(...)--百鬼契约书
  return (isColor( 144,  532, 0x927a64, 85) and isColor( 188,  971, 0xc6b097, 85) and isColor( 183,  446, 0xa0663f, 85) and isColor( 431,  270, 0x9d3025, 85)) --p
end

function accountIdentification(...)--账号认证--拒绝
  if (isColor( 760,  908, 0xdf6851, 85) and isColor(1284,  910, 0xf3b25e, 85) and isColor(1012,  979, 0xcbb59c, 85) and isColor(1064,  550, 0xcbb59c, 85)) then--p
    randomTap( 839,  927,2)--p
    mSleep(1000)    
  end
end
---##################################################################################################  --常用函数

---##################################################################################################  --探索选楼层
function F探索选楼层开始(...)
  -- body
end

function findGreaterUp(...)
      mSleep(500)
      moveTo(1890,  300,1890,  1000,20,800)
      mSleep(1000)--上移动一个窗口
end

function findGreateDown(...)
      mSleep(500)
      moveTo(1890,  1000,1890,  300,20,800)
      mSleep(1000)--下移动一个窗口
end

function findGreater(imageName,alpha)
    local x,y,count;
    count = 0
    whileCount=0;
    while (true) do
        whileCount=whileCount+1;
        if whileCount>=100 then
            errorLoop()
        end--直到点击进到页面
        invite()
        if tansuoButTS() then
            break --弹出来探索框
        end

        x, y = findImage(imageName,1734, 214, 2042, 1050,alpha);--ipad
        if x ~= -1 and y ~= -1 then        --如果在指定区域找到某图片符合条件
            randomTap(x,y,2)
            mSleep(1500)
        else--如果找不到符合条件的图片
            if count <= 6 then
                findGreaterUp();
                count = count + 1 ;
            end
            
            if count > 6 then
                findGreateDown();
                count = count + 1 ;
            end
            
            if count > 12 then
                count = 0;
            end
        end

    end
end

fubenMissoin={
  [0]={"classipad_1.png",7000000},
  [1]={"classipad_2.png",10000000},
  [2]={"classipad_3.png",10000000},
  [3]={"classipad_4.png",10000000},
  [4]={"classipad_5.png",10000000},
  [5]={"classipad_6.png",10000000},
  [6]={"classipad_7.png",10000000},
  [7]={"classipad_8.png",10000000},
  [8]={"classipad_9.png",10000000},
  [9]={"classipad_10.png",7000000},
  [10]={"classipad_11.png",10000000},
  [11]={"classipad_12.png",10000000},
  [12]={"classipad_13.png",10000000},
  [13]={"classipad_14.png",10000000},
  [14]={"classipad_15.png",10000000},
  [15]={"classipad_16.png",10000000},
  [16]={"classipad_17.png",9000000},
  [17]={"classipad_18.png",10000000},
  [18]={"classipad_19.png",10000000},
  [19]={"classipad_20.png",9000000},
  [20]={"classipad_21.png",10000000}
}



function F探索选楼层结束(...)
  -- body
end
---##################################################################################################  --探索选楼层
---##################################################################################################  --御魂觉醒楼层
function F御魂觉醒选楼层结束(...)
  -- body
end

function juexingClass1(...)
  mSleep(500)
  moveTo(640,  450,640, 820,50,800)--到1pad
  mSleep(1000)
  --来到最上面
  if (isColor( 474,  462, 0xc0b8af, 85)) then
    randomTap(474,  462,1)
    mSleep(50)
    randomTap(474,  462,1)
    mSleep(50)
  else
    dialog("您选择的层数有误,可能未通过上一层,脚本停止,请重新选择", 0)
    lua_exit()
  end
  
  
end

function juexingClass2(...)
  mSleep(500)
  moveTo(640,  450,640, 820,50,800)--到1pad
  mSleep(1000)
  --来到最上面
  if (isColor(474,  582, 0xc0b8af, 85)) then
    randomTap(474,  582,1)
    mSleep(50)
    randomTap(474,  582,1)
    mSleep(50)
  else
    dialog("您选择的层数有误,可能未通过上一层,脚本停止,请重新选择", 0)
    lua_exit()
  end
  
end

function juexingClass3(...)
  mSleep(500)
  moveTo(640,  450,640, 820,50,800)--到1pad
  mSleep(1000)
  --来到最上面
  if (isColor( 478,  700, 0xc0b8af, 85)) then
    randomTap(478,  700,1)
    mSleep(50)
    randomTap(478,  700,1)
    mSleep(50)
  else
    dialog("您选择的层数有误,可能未通过上一层,脚本停止,请重新选择", 0)
    lua_exit()
  end
end

function juexingClass4(...)
  mSleep(500)
  moveTo(640,  450,640, 820,50,800)--到1pad
  mSleep(1000)
  --来到最上面
  if (isColor( 476,  818, 0xc0b8af, 85)) then
    randomTap(476,  818,1)
    mSleep(50)
    randomTap(476,  818,1)
    mSleep(50)
  else
    dialog("您选择的层数有误,可能未通过上一层,脚本停止,请重新选择", 0)
    lua_exit()
  end
end

function juexingClass5(...)
  mSleep(500)
  moveTo(640,  450,640, 820,50,800)--到1pad
  mSleep(800)
  moveTo(640,  750,640, 450,50,800)--到1pad
  mSleep(1000)  
  
  if (isColor(  464,  612, 0xc0b8af, 85)) then
    randomTap( 464,  612,1)
    mSleep(50)
    randomTap( 464,  612,1)
    mSleep(50)
  else
    dialog("您选择的层数有误,可能未通过上一层,脚本停止,请重新选择", 0)
    lua_exit()
  end
  
end

function juexingClass6(...)
  mSleep(500)
  moveTo(640,  450,640, 820,50,800)--到1pad
  mSleep(800)
  moveTo(640,  750,640, 450,50,800)--到1pad
  mSleep(1000)  
  
  if (isColor( 472,  732, 0xc0b8af, 85)) then
    randomTap(472,  732,1)
    mSleep(50)
    randomTap(472,  732,1)
    mSleep(50)
  else
    dialog("您选择的层数有误,可能未通过上一层,脚本停止,请重新选择", 0)
    lua_exit()
  end
end

function juexingClass7(...)
  mSleep(500)
  moveTo(640,  816,640, 400,50,800)--到1ipad
  mSleep(1000)
  --来到最下面
  if (isColor(  458,  446, 0xc0b8af, 85)) then
    randomTap( 458,  446,1)
    mSleep(50)
    randomTap( 458,  446,1)
    mSleep(50)
  else
    dialog("您选择的层数有误,可能未通过上一层,脚本停止,请重新选择", 0)
    lua_exit()
  end
end

function juexingClass8(...)
  mSleep(500)
  moveTo(640,  816,640, 400,50,800)--到1ipad
  mSleep(1000)
  --来到最下面
  if (isColor(  482,  566, 0xc0b8af, 85)) then
    randomTap( 482,  566,1)
    mSleep(50)
    randomTap( 482,  566,1)
    mSleep(50)
  else
    dialog("您选择的层数有误,可能未通过上一层,脚本停止,请重新选择", 0)
    lua_exit()
  end
end

function juexingClass9(...)
  mSleep(500)
  moveTo(640,  816,640, 400,50,800)--到1ipad
  mSleep(1000)
  --来到最下面
  if (isColor( 472,  686, 0xc0b8af, 85)) then
    randomTap(472,  686,1)
    mSleep(50)
    randomTap(472,  686,1)
    mSleep(50)
  else
    dialog("您选择的层数有误,可能未通过上一层,脚本停止,请重新选择", 0)
    lua_exit()
  end
end

function juexingClass10(...)
  mSleep(500)
  moveTo(640,  816,640, 400,50,800)--到1ipad
  mSleep(1000)
  --来到最下面
  if (isColor(  486,  804, 0xc0b8af, 85)) then
    randomTap( 486,  804,1)
    mSleep(50)
    randomTap( 486,  804,1)
    mSleep(50)
  else
    dialog("您选择的层数有误,可能未通过上一层,脚本停止,请重新选择", 0)
    lua_exit()
  end
end






juexingMissoin={
  [0]=juexingClass1,
  [1]=juexingClass2,
  [2]=juexingClass3,
  [3]=juexingClass4,
  [4]=juexingClass5,
  [5]=juexingClass6,
  [6]=juexingClass7,
  [7]=juexingClass8,
  [8]=juexingClass9,
  [9]=juexingClass10
}



function F御魂觉醒选楼层结束(...)
  -- body
end

---##################################################################################################  --御魂觉醒楼层

---##################################################################################################  --探索副本换狗粮
function F探索副本换狗粮开始(...)
  -- body
end


function GLModel(...)
  local currentClass = values.cb7011;
  local zdMark = true;
  -- body
  whileCount=0;
  timer=0;
  while (true) do
    whileCount=whileCount+1;
    if whileCount>=20 then
      --errorLoop()
    end--直到点击进到页面
    
    if (isColor(1723,  560, 0xf8f3e0, 85)) then--选项为探索
      break;
    else
      randomTap(1767,  638,2) 
      mSleep(500)
    end
    
    
  end
  
  
  
  
  if values.cb701 == "0" then --妖怪发现(普通)
    while (true) do
      if (isColor( 549,  456, 0x5a2fb7, 85)) then--选到普通
        if tansuoButTS() then
          mSleep(50);               
          randomTap(1522, 1043,2)--探索按钮
          mSleep(3000)
        end--点击探索按钮  
        
      else
        if tansuoButTS() then  
          randomTap( 545,  547,2)--点击普通
          mSleep(1500)
        end
      end
      
      if tansuoInHome() then 
        break;
      end
    end
    
  end
  
  
  if values.cb701 == "1" and values.a7000 ~="0" then --妖怪发现(困难)
    while (true) do
      if (isColor( 767,  455, 0x5c31b7, 85)) then--(困难)
        if tansuoButTS() then
          mSleep(50);               
          randomTap(1522, 1043,2)--探索按钮
          mSleep(3000)
        end--点击探索按钮  
        
      else
        if tansuoButTS() then  
          randomTap(762,  545,2)--点击困难
          mSleep(1500)
        end
      end
      
      if tansuoInHome() then 
        break;
      end
    end
  end
  
  
  if values.cb701 == "1" and values.a7000 =="0" then----妖怪发现(困难)--组队
    while (true) do
      if (isColor( 767,  455, 0x5c31b7, 85)) then--(困难)
        if tansuoButTS() then
          mSleep(50);               
          randomTap(1048, 1037,2)--组队按钮
          mSleep(2500)
        end--点击探索按钮  
        
      else
        if tansuoButTS() then  
          randomTap(762,  545,2)--点击困难
          mSleep(1500)
        end
      end
      
      mSleep(200)  
      if zuduiBox()then 
        zuduiJieshou()
      end
      
      invite()
      
      if tansuoshouye() then 
        findGreater(fubenMissoin[currentClass-0][1],fubenMissoin[currentClass-0][2]);
        mSleep(500)  
        GLModel();  
      end
      
      
      
      if (isColor( 640,  434, 0xeac89e, 85) and isColor( 729, 1091, 0xdf6851, 85) and isColor(1161, 1090, 0xf3b25e, 85)) then
        randomTap(830,  434,2)
        mSleep(800)
      end--选到好友 
      
      if GLModelMark then  
        if (isColor( 822,  435, 0xeac89e, 85) and isColor( 727, 1089, 0xdf6851, 85) and isColor(1161, 1088, 0xf3b25e, 85)) then
          toast("首次手动选队员,下回合自动邀请第一个",1)
          mSleep(2000)
        end--邀请按钮--提示
      else
        if (isColor( 822,  435, 0xeac89e, 85) and isColor( 727, 1089, 0xdf6851, 85) and isColor(1161, 1088, 0xf3b25e, 85)) then
          randomTap( 813,  557,2)
          mSleep(1000)
        end--邀请按钮--提示       
      end
      
      if (isColor( 822,  435, 0xeac89e, 85) and isColor( 727, 1089, 0xdf6851, 85) and isColor(1161, 1088, 0xf3b25e, 85)) then
        randomTap(1238, 1110,2)
        mSleep(2000)
      end--邀请按钮
      
      
      if tansuoInHome() then 
        GLModelMark = false;   
        break;
      end
    end
  end
  
  
end



function GLchagaheSeek(...)
  
  if values.a708 ~="0"  and values.a709 ~="0" and values.a710 ~="0" then
    return;
  end
  
  mSleep(2500)
  GLchangeLeadNum = 0;
  GLchangeViewerNum =0;  
  
  
  if values.cb701 ~= "2" and values.a7000 ~="0" then --单刷--非队长
    
    
    x211,y211 = findMultiColorInRegionFuzzy( 0xf8f3e0, "-7|-19|0xf7f2e0,24|-18|0xd3cdbc,36|3|0xf7f2df,72|2|0xe8e2d0", 90, 922, 813, 1122, 870)
    --战斗满经验
    if x211 ~= -1 and y211 ~= -1 then        --如果在指定区域找到某图片符合条件
      GLchangeLead = true;
      GLchangeLeadNum = GLchangeLeadNum +1;
    end
    x212,y212 = findMultiColorInRegionFuzzy( 0xf8f3e0, "-7|-19|0xf7f2e0,24|-18|0xd3cdbc,36|3|0xf7f2df,72|2|0xe8e2d0", 90, 1283, 815, 1470, 873)
    --战斗满经验
    if x212 ~= -1 and y212 ~= -1 then        --如果在指定区域找到某图片符合条件
      GLchangeLead = true;
      GLchangeLeadNum = GLchangeLeadNum +1;
    end
    x213,y213 = findMultiColorInRegionFuzzy( 0xf8f3e0, "-7|-19|0xf7f2e0,24|-18|0xd3cdbc,36|3|0xf7f2df,72|2|0xe8e2d0", 90, 1644, 815, 1842, 873)
    --战斗满经验
    if x213 ~= -1 and y213 ~= -1 then        --如果在指定区域找到某图片符合条件
      GLchangeLead = true;
      GLchangeLeadNum = GLchangeLeadNum +1;
    end
    
    x22,y22 = findMultiColorInRegionFuzzy( 0xf8f3e0, "-7|-19|0xf7f2e0,24|-18|0xd3cdbc,36|3|0xf7f2df,72|2|0xe8e2d0", 90, 559, 996, 754, 1057)
    --观众满经验
    if x22 ~= -1 and y22 ~= -1 then        --如果在指定区域找到某图片符合条件
      GLchangeViewer = true;
      GLchangeViewerNum= GLchangeViewerNum +1;
    end
    x221,y221 = findMultiColorInRegionFuzzy( 0xf8f3e0, "-7|-19|0xf7f2e0,24|-18|0xd3cdbc,36|3|0xf7f2df,72|2|0xe8e2d0", 90, 926, 994, 1107, 1052)
    --观众满经验
    if x221 ~= -1 and y221 ~= -1 then        --如果在指定区域找到某图片符合条件
      GLchangeViewer = true;
      GLchangeViewerNum= GLchangeViewerNum +1;
    end
    
    
    
    
    
    
    
  end
  
  if values.cb701 ~= "2" and values.a7000 =="0" then --组队--队长
    
    x211,y211 = findMultiColorInRegionFuzzy( 0xf8f3e0, "-7|-19|0xf7f2e0,24|-18|0xd3cdbc,36|3|0xf7f2df,72|2|0xe8e2d0", 90,919, 815, 1118, 875)
    --战斗满经验
    if x211 ~= -1 and y211 ~= -1 then        --如果在指定区域找到某图片符合条件
      GLchangeLead = true;
      GLchangeLeadNum = GLchangeLeadNum +1;
    end
    x212,y212 = findMultiColorInRegionFuzzy( 0xf8f3e0, "-7|-19|0xf7f2e0,24|-18|0xd3cdbc,36|3|0xf7f2df,72|2|0xe8e2d0", 90,1280, 814, 1481, 875)
    --战斗满经验
    if x212 ~= -1 and y212 ~= -1 then        --如果在指定区域找到某图片符合条件
      GLchangeLead = true;
      GLchangeLeadNum = GLchangeLeadNum +1;
    end
    
    x22,y22 = findMultiColorInRegionFuzzy( 0xf8f3e0, "-7|-19|0xf7f2e0,24|-18|0xd3cdbc,36|3|0xf7f2df,72|2|0xe8e2d0", 90, 1645, 814, 1840, 873)
    --观众满经验
    if x22 ~= -1 and y22 ~= -1 then        --如果在指定区域找到某图片符合条件
      GLchangeViewer = true;
      GLchangeViewerNum= GLchangeViewerNum +1;
    end
    x221,y221 = findMultiColorInRegionFuzzy( 0xf8f3e0, "-7|-19|0xf7f2e0,24|-18|0xd3cdbc,36|3|0xf7f2df,72|2|0xe8e2d0", 90,560, 994, 753, 1055)
    --观众满经验
    if x221 ~= -1 and y221 ~= -1 then        --如果在指定区域找到某图片符合条件
      GLchangeViewer = true;
      GLchangeViewerNum= GLchangeViewerNum +1;
    end
    
    
    
  end--队长模式
  
  if values.cb701 == "2" then --组队--队员
    
    x211,y211 = findMultiColorInRegionFuzzy( 0xf8f3e0, "-7|-19|0xf7f2e0,24|-18|0xd3cdbc,36|3|0xf7f2df,72|2|0xe8e2d0", 90,558, 814, 760, 874)
    --战斗满经验
    if x211 ~= -1 and y211 ~= -1 then        --如果在指定区域找到某图片符合条件
      GLchangeLead = true;
      GLchangeLeadNum = GLchangeLeadNum +1;
    end
    x212,y212 = findMultiColorInRegionFuzzy( 0xf8f3e0, "-7|-19|0xf7f2e0,24|-18|0xd3cdbc,36|3|0xf7f2df,72|2|0xe8e2d0", 90, 922, 812, 1116, 874)
    --战斗满经验
    if x212 ~= -1 and y212 ~= -1 then        --如果在指定区域找到某图片符合条件
      GLchangeLead = true;
      GLchangeLeadNum = GLchangeLeadNum +1;
    end
    x213,y213 = findMultiColorInRegionFuzzy( 0xf8f3e0, "-7|-19|0xf7f2e0,24|-18|0xd3cdbc,36|3|0xf7f2df,72|2|0xe8e2d0", 90,1284, 812, 1468, 874)
    --战斗满经验
    if x213 ~= -1 and y213 ~= -1 then        --如果在指定区域找到某图片符合条件
      GLchangeLead = true;
      GLchangeLeadNum = GLchangeLeadNum +1;
    end     
    
    x22,y22 = findMultiColorInRegionFuzzy( 0xf8f3e0, "-7|-19|0xf7f2e0,24|-18|0xd3cdbc,36|3|0xf7f2df,72|2|0xe8e2d0", 90, 1645, 814, 1840, 873)--1644, 810, 1836, 876
    --观众满经验
    if x22 ~= -1 and y22 ~= -1 then        --如果在指定区域找到某图片符合条件
      GLchangeViewer = true;
      GLchangeViewerNum= GLchangeViewerNum +1;
    end
    x221,y221 = findMultiColorInRegionFuzzy( 0xf8f3e0, "-7|-19|0xf7f2e0,24|-18|0xd3cdbc,36|3|0xf7f2df,72|2|0xe8e2d0", 90,560, 994, 753, 1055)
    --观众满经验
    if x221 ~= -1 and y221 ~= -1 then        --如果在指定区域找到某图片符合条件
      GLchangeViewer = true;
      GLchangeViewerNum= GLchangeViewerNum +1;
    end     
    
  end 
  
  
  if GLchangeLeadNum>=2 or GLchangeViewer then
    toast("准备换狗粮",1)
  end
  
  mSleep(500);
  
  
  
  
  
end



function GLintoFight(...)
  
  while (true) do--进到战斗画面
    
    noticeDown();
    
    x1,y1 = findMultiColorInRegionFuzzy( 0xfff1cb, "60|6|0xfff2ce,122|170|0x9f1f0d,-28|-2|0xfff4d3", 90, 1696, 1126, 2028, 1462)--ipad
    --ready6
    if x1 ~= -1 and y1 ~= -1 then        --如果在指定区域找到某图片符合条件
      
      if GLchangeLeadNum >=2 or GLchangeViewer then
        GLchagahe()
        mSleep(1000);
        touchDown(1,x1,y1); 
        mSleep(50);
        touchUp(1,x1,y1); 
        mSleep(1000);
      else
        
        mSleep(50);
        touchDown(1,x1,y1); 
        mSleep(50);
        touchUp(1,x1,y1); 
        mSleep(1000);
      end
      x1=-1;
      y1=-1;
      
    end
    
    fightManual6()
    
    x2,y2 = windrum2_6()
    --胜利--windrum2_6
    if x2 ~= -1 and y2 ~= -1 then 
      
      GLchagaheSeek()
      
      while (true) do   
        if tansuoInHome() then
          break;
        else
          windrumClick();
        end
      end
      
    end     
    
    if tansuoInHome() then 
      break;
    end--退出大的循环
    
    x3,y3 = windrum3_6()
    --失败--windrum3_6
    if x3 ~= -1 and y3 ~= -1 then 
      while (true) do   
        if tansuoInHome() then
          break;
        else
          windrumClick();
        end
      end
    end 
    
    
    
    if zhandouhuamian() then
      assFight()--集火
      mSleep(math.random(100,300))
    end   
    
  end
end


function GLyaoguaifaxianInStep(...)
  
  GLModel()
  
  whileCount=0;
  timer=0;
  while (true) do
    whileCount=whileCount+1;
    if whileCount>=800 then
      errorLoop()
    end--直到点击进到页面
    
    
    if zhandouhuamian() then
      mSleep(500)
      timer = 0;
      GLintoFight()
    end--防止点了 但是已经退出了
    
    
    
    
    if tansuoInHome() then
      mSleep(50)
      if (isColor(1594, 1418, 0x2c2017, 85) and isColor(1604, 1428, 0x2c2017, 85) and isColor(1936,   34, 0xd6c4a1, 85) and isColor(2040,   82, 0x76471f, 85)) then--IPAD
      else
        
        randomTap(1600, 1424,2)
        mSleep(1000)
      end --点击不锁定   
      
      noticeDown()
      
      timer = timer +1
      
      if timer == 1 then
        toast("三次找不到战斗图标将会移动",1)
        mSleep(50)
      end
      
      
      if timer%3 == 0 then
        if timer <= 15 then
          x3, y3 = tansuoFightMax()
          --fightMax6--大怪图标
          if x3 == -1 and y3 == -1 then 
            mSleep(100)
            moveTo( 1750,  450,930,  450,50,1000)
            mSleep(1000)
          end
        end
      end
      if timer%3 == 0 then
        if timer > 15 then
          x3, y3 = tansuoFightMax()
          --fightMax6--大怪图标
          if x3 == -1 and y3 == -1 then 
            mSleep(100)
            moveTo( 930,  450,1750,  450,50,1000)
            mSleep(1000)
          end
        end
        
        if timer>=30 then
          timer=0
        end
        
      end
      noticeDown()  
    end --点击两边 并且换方向
    
    x14, y14 = tansuoFightMiddle()
    --fightMiddle6--小怪图标
    if x14 ~= -1 and y14 ~= -1 then        --如果在指定区域找到某图片符合条件
      touchDown(1,x14,y14); 
      mSleep(30);
      touchUp(1,x14,y14); 
      mSleep(500)
      x14= -1;
      y14= -1;      
    else
      x3, y3 = tansuoFightMax()
      --fightMax6--大怪图标
      if x3 ~= -1 and y3 ~= -1 then        --如果在指定区域找到某图片符合条件
        mSleep(1500)
        if tansuoInHome() then
          x14, y14 = tansuoFightMiddle()
          --fightMiddle6--小怪图标
          if x14 == -1 and y14 == -1 then 
            break
          end--在探索里主页面
        end
      end
      
    end  --剧情的小boss
    
  end
  
  whileCount=0;
  timer=0;
  while (true) do
    invite();
    if values.a7054 =="0" then --不打BOSS     
      backtotansuoHome()
    else    
      x3, y3 = tansuoFightMax()
      --fightMax6--大怪图标
      if x3 ~= -1 and y3 ~= -1 then        --如果在指定区域找到某图片符合条件               
        touchDown(1,x3,y3); --大的BOSS
        mSleep(30);
        touchUp(1,x3,y3);   
        mSleep(1000)
      end
      
      if zhandouhuamian() then
        toast("正在打大BOSS,准备退出",1)
        mSleep(1200)
        break;
      end--防止大BOS没有点到
      
      x2,y2 = windrum2_6()
      --胜利--windrum2_6
      if x2 ~= -1 and y2 ~= -1 then 
        break;
      end       
      
      x3,y3 = windrum3_6()
      --失败--windrum3_6
      if x3 ~= -1 and y3 ~= -1 then 
        break;
      end   
      
      x1,y1 = findMultiColorInRegionFuzzy( 0xfff1cb, "60|6|0xfff2ce,122|170|0x9f1f0d,-28|-2|0xfff4d3", 90, 1696, 1126, 2028, 1462)--ipad
      --ready6
      if x1 ~= -1 and y1 ~= -1 then        --如果在指定区域找到某图片符合条件
        break;
      end
    end
    if zuduiBox() then
      break;
    end--组队框            
    if tansuoshouye() then
      break;
    end--探索主页面--识别挑战卷和突破
  end
  
  
  
  
  whileCount=0;
  timer=0;
  while (true) do
    whileCount=whileCount+1;
    if whileCount>=1300 then
      --errorLoop()
    end--直到点击进到页面
    invite();
    ready6();
    fightManual6();
    if zhandouhuamian() then
      assFight()--集火
      mSleep(math.random(100,300))
    end       
    
    x2,y2 = windrum2_6()
    --胜利--windrum2_6
    if x2 ~= -1 and y2 ~= -1 then 
      while (true) do   
        if tansuoInHome() then
          break;
        else
          noticeDown() 
          windrumClick()
        end
      end
    end     
    
    x3,y3 = windrum3_6()
    --失败--windrum3_6
    if x3 ~= -1 and y3 ~= -1 then 
      while (true) do   
        if tansuoInHome() then
          break;
        else
          noticeDown() 
          windrumClick()
        end
      end
    end     
    
    if tansuoInHome() then
      break;
    end
    
    if tansuoshouye() then
      break;
    end--探索主页面--识别挑战卷和突破
    
    if zuduiBox() then
      break;
    end--组队框        
    
    
    
  end
  
  clickChestIn();--检测宝箱
end



---##################################################################################################  --经验怪
function GLyaoguaifaxianInStepExp(...)
  
  GLModel()
  
  EXPtansuoFightMax = false;--记录本次探索有没有出现大boss
  
  whileCount=0;
  timer=0;
  while (true) do
    whileCount=whileCount+1;
    if whileCount>=500 then
      errorLoop()
    end--直到点击进到页面
    
    
    
    if zhandouhuamian() then
      mSleep(500)
      GLintoFight()
    end--防止点了 但是已经退出了
    
    
    
    if tansuoInHome() or zhandouhuamian() then--不在战斗也不在探索
    else
      if tansuoshouye() then
        break;
      end--打完BOSS出来了
    end
    
    
    
    
    
    if tansuoInHome() then
      mSleep(50)
      if (isColor(1594, 1418, 0x2c2017, 85) and isColor(1604, 1428, 0x2c2017, 85) and isColor(1936,   34, 0xd6c4a1, 85) and isColor(2040,   82, 0x76471f, 85)) then--IPAD
      else
        
        randomTap(1600, 1424,2)
        mSleep(1000)
      end --点击不锁定
      noticeDown()
      
      if timer == 0 then
        toast("三次找不到经验图标将会退出",1)
        mSleep(1000)
      end
      
      boolExp =  Exp();
      if boolExp then
        mSleep(100)
        moveTo( 1750,  450,930,  450,50,1000)
        mSleep(1000)
        boolExp = false;
        timer = timer +1
      end
      
      
      
      
      if timer>=5 then
        break;
      end
    end --点击两边 并且换方向
    
    
  end  --剧情的小boss
  
  
  
  if EXPtansuoFightMax then
    clickChestIn();
    clickChest();
  end--已经出现了大怪
  
  whileCount=0;
  while (true) do
    whileCount=whileCount+1;
    if whileCount>=100 then
      break;  --执行了一百次都不能就是卡住了自动退出 重新开始执行脚本
    end--直到点击进到页面
    noticeDown();
    if tansuoshouye() then
      
      break;
    end--识别返回和突破
    
    if tansuoInHome() then--外面的界面
      if tansuoshouye() then
        
      else
        randomTap(72,  104,2)
        mSleep(500);
      end
    end
    
    if (isColor( 688,  816, 0xf3b25e, 85) and isColor( 916,  858, 0xf3b25e, 85) and isColor(1130,  822, 0xf3b25e, 85) and isColor(1344,  852, 0xf3b25e, 85) and isColor(1016,  644, 0xcbb59c, 85)) then
      randomTap(1242,  834,2)
      mSleep(1500);
    end --IPAD
    
    if tansuoshouye() then
      break;
    end--识别返回和突破
    
    if zuduiBox() then
      break;
    end--组队框        
  end
  
end

function Exp(...)
  local  x3, y3;
  local x,y = -1,-1;
  
  countNum = 0;
  while (true) do
    countNum = countNum+1;
    
    x3, y3 = tansuoFightMax()
    --fightMax6--大怪图标
    if x3 ~= -1 and y3 ~= -1 then        --如果在指定区域找到某图片符合条件
      if values.a7054 =="0" then --不打BOSS       
        backtotansuoHome()
        EXPtansuoFightMax = false;
        return;
      else
        mSleep(100);                    
        randomTap(x3, y3,2);
        EXPtansuoFightMax = true;
        mSleep(2500)
      end
    end
    
    if values.a704 == "0" and x == -1 and y == -1 then--经验怪
      x,y = tansuoFightExp()
    end
    if values.a705 == "0" and x == -1 and y == -1 then--金币怪
      x,y = tansuoFightMon()
    end 
    if x ~= -1 and y ~= -1 then  --如果在指定区域找到某点符合条件
      touchDown(1, x,y-90); 
      mSleep(30);
      touchUp(1,x,y-90); 
      
      mSleep(30);--
      touchDown(1, x,y-180); 
      mSleep(30);
      touchUp(1,x,y-180); 
      
      mSleep(30);--
      touchDown(1, x,y-270); 
      mSleep(30);
      touchUp(1,x,y-270);
      
      x1 = x;
      if (x+30) >= 2048 then
        x1=2048-30;
      end
      if (x-30) <= 0 then
        x1=31;
      end
      mSleep(30);
      randomTap(x1,y-90,30)
      
      
      mSleep(30);
      randomTap(x1,y-180,30)
      
      
      mSleep(30);
      randomTap(x1,y-270,30)
      
      
      x, y=-1,-1;
      
      if countNum>20 then--避免大怪出来了;一直在点击
        return false;
      end
      
    else                         --如果找不到符合条件的点
      if countNum>6 then
        if tansuoInHome() then
          if values.a704 == "0" then--经验怪
            toast("没找到经验图",1)
          end
          if values.a705 == "0" then--金币怪
            toast("没找到金币怪",1)
          end  
          mSleep(1000);
          return true;
        end
      end
      
      if countNum>150 then--避免大怪出来了;
        toast("超时滑动",1)
        return true;
      end
      
    end
    
    noticeDown()
    if zhandouhuamian() then 
      return false;
    end--在战斗了
    
  end
  
end




function GLchagahe(...)
  if values.a708 ~="0"  and values.a709 ~="0" and values.a710 ~="0" then
    return;
  end
  mSleep(500);
  if GLchangeLead and GLchangeLeadNum >=2 then
    
    if values.cb701 == "1" and values.a7000 =="0" then----妖怪发现(困难)--组队
      GLchangeLeadFunDZ()
    else
      GLchangeLeadFun();
    end 
    
  end
  mSleep(1000);
  if GLchangeViewer then
    GLchangeViewerFun();
  end
  
end


function GLchangeLeadFun(...)
  local pos1 = true;
  local pos2 = true;
  local pos0 = true;--队长位置
  local GLlevel = values.a703;
  local x1,x2,x3,x4;
  local y1,y2,y3,y4;    
  
  while (true) do
    if (isColor(  86, 1450, 0xffffff, 85) and isColor( 136, 1458, 0xffffff, 85) and isColor( 112, 1470, 0x2c2d9b, 85)) then--ipad
      --交替按钮按钮
      break;
    else                    
      randomTap(1442, 1210,2)  
      mSleep(1000);
    end
  end
  
  while (true) do
    if (isColor( 101, 1255, 0x939295, 85) and isColor(  62, 1241, 0x43311f, 85)) then
      --已经选到N
      break;
    end
    
    if (isColor(  86, 1450, 0xffffff, 85) and isColor( 136, 1458, 0xffffff, 85) and isColor( 112, 1470, 0x2c2d9b, 85)) then--ipad
      --交替按钮按钮          
      randomTap(103, 1258,2) 
      mSleep(800);
    end
    if (isColor( 101,  891, 0x8c8c8f, 85) and isColor(  63,  879, 0x43311f, 85)) then
      --选N      
      randomTap(103,  896,2) 
      mSleep(800);
    end
    
    if (isColor( 101, 1255, 0x939295, 85) and isColor(  62, 1241, 0x43311f, 85)) then
      --已经选到N
      break;
    end
    
  end
  
  
  
  if GLchangeLeadNum >=2 then
    x2,y2 = findMultiColorInRegionFuzzy( 0xfee804, "8|-3|0xffe106,27|-2|0xffe405", 90, 701, 89, 1440, 1065)
    if x2 ~= -1 and y2 ~= -1 then        --如果在指定区域找到某图片符合条件
      pos1 = false;
    end
    mSleep(500)
    x3,y3 = findMultiColorInRegionFuzzy( 0xfee804, "7|-3|0xffe006,27|-2|0xffe305", 90, 1493, 225, 2021, 1034)
    if x3 ~= -1 and y3 ~= -1 then        --如果在指定区域找到某图片符合条件
      pos2 = false;
    end
    if values.a7001 =="0" then --队长位置也换;
      x4,y4 = findMultiColorInRegionFuzzy( 0xfde704, "7|-4|0xffde07,27|-4|0xffde07", 90, 37, 46, 693, 1012)--
      if x4 ~= -1 and y4 ~= -1 then        --如果在指定区域找到某图片符合条件
        pos0 = false;
      end
    end  
  end
  
  
  
  while (true) do
    
    if pos0 then
    else
      if GLlevel == "0" then
        x000,y000 = seekGLlevel1()
      else
        x000,y000 = seekGLlevel20()
      end
      pos0 = true;
      
      
      mSleep(500)
      moveTo(x000,y000,329,  520,10,1200)--329,  520
      mSleep(1500)
      
    end   
    if pos1 then
    else
      if GLlevel == "0" then
        x111,y111 = seekGLlevel1()
      else
        x111,y111 = seekGLlevel20()
      end
      pos1 = true;
      mSleep(500)
      moveTo(x111,y111,1034,  546,20,1200)--1052,  429
      mSleep(1500)
      
    end
    
    if pos2 then
    else
      if GLlevel == "0" then
        x222,y222 = seekGLlevel1()
      else
        x222,y222 = seekGLlevel20()
      end
      pos2 = true;
      mSleep(500)
      moveTo(x222,y222,1739,  548,20,1200)--1806,  441
      mSleep(1500)
      
    end
    
    
    if pos1 and pos2 and pos0 then
      GLchangeLead = false;
      break;
    end
    
  end
  
  while (true) do
    if (isColor(  86, 1450, 0xffffff, 85) and isColor( 136, 1458, 0xffffff, 85) and isColor( 112, 1470, 0x2c2d9b, 85)) then--ipad
      --交替按钮按钮
      randomTap( 52,   46,2) 
      mSleep(1500);
    else                    
      break;
    end
  end
  
  
end



function GLchangeLeadFunDZ(...)
  local pos1 = true;
  local pos2 = true;
  local GLlevel = values.a703;
  local x1,x2,x3,x4;
  local y1,y2,y3,y4;    
  
  while (true) do
    if (isColor(  86, 1450, 0xffffff, 85) and isColor( 136, 1458, 0xffffff, 85) and isColor( 112, 1470, 0x2c2d9b, 85)) then--ipad
      --交替按钮按钮
      break;
    else                    
      randomTap(1442, 1210,2)  
      mSleep(1000);
    end
  end
  
  while (true) do
    if (isColor( 101, 1255, 0x939295, 85) and isColor(  62, 1241, 0x43311f, 85)) then
      --已经选到N
      break;
    end
    
    if (isColor(  86, 1450, 0xffffff, 85) and isColor( 136, 1458, 0xffffff, 85) and isColor( 112, 1470, 0x2c2d9b, 85)) then--ipad
      --交替按钮按钮          
      randomTap(103, 1258,2) 
      mSleep(800);
    end
    if (isColor( 101,  891, 0x8c8c8f, 85) and isColor(  63,  879, 0x43311f, 85)) then
      --选N      
      randomTap(103,  896,2) 
      mSleep(800);
    end
    
    if (isColor( 101, 1255, 0x939295, 85) and isColor(  62, 1241, 0x43311f, 85)) then
      --已经选到N
      break;
    end
    
  end
  
  
  if GLchangeLeadNum >=2 then
    x2,y2 = findMultiColorInRegionFuzzy( 0xfee804, "7|-3|0xffe006,27|-2|0xffe305", 90, 290, 1, 873, 992)
    if x2 ~= -1 and y2 ~= -1 then        --如果在指定区域找到某图片符合条件
      pos1 = false;
    end
    mSleep(500)
    x3,y3 = findMultiColorInRegionFuzzy( 0xfde704, "7|-3|0xffe006,27|-2|0xffe305", 90, 1360, 1, 1902, 998)
    if x3 ~= -1 and y3 ~= -1 then        --如果在指定区域找到某图片符合条件
      pos2 = false;
    end
    
  end
  
  
  
  while (true) do
    
    if pos1 then
    else
      if GLlevel == "0" then
        x111,y111 = seekGLlevel1()
      else
        x111,y111 = seekGLlevel20()
      end
      pos1 = true;
      mSleep(500)
      moveTo(x111,y111,537,  480,20,1200)--537,  445
      mSleep(1500)
      
    end
    
    if pos2 then
    else
      if GLlevel == "0" then
        x222,y222 = seekGLlevel1()
      else
        x222,y222 = seekGLlevel20()
      end
      pos2 = true;
      mSleep(500)
      moveTo(x222,y222,1580,  480,20,1200)--1580,  436
      mSleep(1500)
      
    end
    
    
    if pos1 and pos2 then
      GLchangeLead = false;
      break;
    end
    
  end
  
  while (true) do
    if (isColor(  86, 1450, 0xffffff, 85) and isColor( 136, 1458, 0xffffff, 85) and isColor( 112, 1470, 0x2c2d9b, 85)) then--ipad
      --交替按钮按钮
      randomTap( 52,   46,2) 
      mSleep(1500);
    else                    
      break;
    end
  end
  
  
end







function seekGLlevel1(...)
  local x,y,x1,y1,x2,y2,x3,y3,x4,y4;
  mSleep(1000)  
  whileCount = 0
  while (true) do
    whileCount=whileCount+1;
    if whileCount>=50 then
      toast("没有找到未满的二星狗粮,脚本退出", 0)
      -- lua_exit();
      return 800,  530;
    end
    
    if values.a708 == "0" then -- 白达摩
      x,y = findMultiColorInRegionFuzzy( 0x372215, "142|184|0x2c160d,44|249|0x767676,-33|266|0x30180f,28|44|0xffffff", 90, 180, 1182, 1720, 1532)--白达摩
      if x ~= -1 and y ~= -1 then        --如果在指定区域找到某图片符合条件
        return x,y;
      end
    end
    
    if values.a709 == "0" then --红达摩
      x1,y1 =findMultiColorInRegionFuzzy( 0x372215, "142|168|0x2d170d,36|39|0xf25e51,45|249|0x777777,-32|266|0x30180f", 90, 180, 1182, 1720, 1532)--红达摩
      if x1 ~= -1 and y1 ~= -1 then        --如果在指定区域找到某图片符合条件
        return x1,y1;
      end
    end
    
    if values.a710 == "0" then --非蓝蛋N卡 1137, 1231, 1256, 1289
      x2,y2 =  findMultiColorInRegionFuzzy( 0x372215, "142|184|0x2c160d,44|249|0x767676,-33|266|0x30180f", 90, 180, 1182, 1720, 1532)--所有卡
      if x2 ~= -1 and y2 ~= -1 then        --如果在指定区域找到某图片符合条件
        x3,y3 = findMultiColorInRegionFuzzy( 0x557bb5, "8|10|0x2f4d8e",90, x2,y2, x2+119,y2+60)
        if x3 ~= -1 and y3 ~= -1 then 
        else
          x4,y4 = findMultiColorInRegionFuzzy(0x2f2d2d, "1|7|0x111011", 90, x2,y2,x2+119,y2+60);--黑蛋
          if x4 ~= -1 and y4 ~= -1 then 
          else
            return x2,y2;
          end  
        end
      end 
      noticeDown()   
      mSleep(500)
      moveTo(1500,  1360,500,  1360,20,800)--ipad
      mSleep(1000)
    end
  end
  
end

function seekGLlevel20(...)
  mSleep(1000)
  whileCount = 0
  while (true) do
    whileCount=whileCount+1;
    if whileCount>=50 then
      toast("没有找到未满的三星狗粮,脚本退出", 0)
      -- lua_exit();
      
    end
    x,y = findMultiColorInRegionFuzzy( 0x352114, "142|170|0x2d170e,42|250|0x649dc1,68|248|0x747474,-32|266|0x30180f", 90, 180, 1182, 1720, 1532)--ipad
    if x ~= -1 and y ~= -1 then        --如果在指定区域找到某图片符合条件
      return x,y;
    else
      noticeDown() 
      mSleep(500)
      moveTo(1500,  1360,500,  1360,20,800)--ipad
      mSleep(1000)
    end
  end
end


function GLchangeViewerFun(...)
  local pos1 = true;
  local pos2 = true;
  local GLlevel = values.a703;
  local x1,x2,x3,x4;
  local y1,y2,y3,y4;    
  
  while (true) do
    if (isColor(  84, 1272, 0x110e14, 85) and isColor(  72, 1290, 0x903154, 85)) then
      --左下角灯笼
      randomTap(92,  888,2) 
      mSleep(1500);
    else                    
      break;
    end
  end
  
  
  while (true) do
    if (isColor( 102, 1256, 0x959698, 85) and isColor(  62, 1240, 0x42301e, 85)) then
      --已经选到N
      break;
    else
      randomTap(101, 1257,2)  
      mSleep(800);
      
    end
    
    if (isColor( 100,  890, 0x8a8a8d, 85) and isColor(  62,  880, 0x43311f, 85)) then
      randomTap( 102,  896,2) 
      mSleep(800);
    end
    
    if (isColor( 102, 1256, 0x959698, 85) and isColor(  62, 1240, 0x42301e, 85)) then
      --已经选到N
      break;
    end
  end
  
  if GLchangeViewerNum >=2 then
    pos1 = false;
    pos2 = false;
  else
    x2,y2 = findMultiColorInRegionFuzzy( 0xffea03, "7|-4|0xffdf06,27|-4|0xffdf06", 90, 65, 1, 953, 1029)
    if x2 ~= -1 and y2 ~= -1 then        --如果在指定区域找到某图片符合条件
      pos1 = false;
    end
    mSleep(500)
    x3,y3 = findMultiColorInRegionFuzzy( 0xffeb03, "7|-3|0xfcdf06,27|-3|0xffe305", 90, 900, 1, 1710, 865)
    if x3 ~= -1 and y3 ~= -1 then        --如果在指定区域找到某图片符合条件
      pos2 = false;
    end
  end
  
  
  whileCount=0;
  while (true) do
    whileCount=whileCount+1;
    if whileCount>50 then 
      break;
    end
    
    if pos1 then
    else
      if GLlevel == "0" then
        x111,y111 = seekGLlevel1()
      else
        x111,y111 = seekGLlevel20()
      end
      pos1 = true;
      mSleep(500)
      moveTo(x111,y111, 490,  379,20,1200)--490,  379
      mSleep(1500)
      
    end
    
    if pos2 then
    else
      if GLlevel == "0" then
        x222,y222 = seekGLlevel1()
      else
        x222,y222 = seekGLlevel20()
      end
      pos2 = true;
      mSleep(500)
      moveTo(x222,y222,1388,  333,20,1200)--1388,  333
      mSleep(1500)
      
    end
    
    
    if pos1 and pos2 then
      GLchangeViewer = false;
      break;
    end
    
  end
  
  
  
end






function GLyaoguaifaxian(...)
  local currentClass = values.cb7011;
  originTime = getNetTime(); 
  while (true) do
    
    
    if values.cb701 == "0" and values.a7000 =="0" then --妖怪发现(普通)勾选了队长模式
      dialog("普通副本请不要勾选[困难本的队长模式],按确定脚本重启", 0)
      mSleep(1000)
      lua_restart()
    end
    
    
    
    if values.a7000 =="0" then --组队模式
      invite()
      findGreater(fubenMissoin[currentClass-0][1],fubenMissoin[currentClass-0][2]);
      
      while (true) do
        -- body
        if values.a704 == "0" or values.a705 == "0" then
          GLyaoguaifaxianInStepExp()  
          
        else
          GLyaoguaifaxianInStep()
        end
        
      end
      
    end
    
    
    
    
    
    
    if tansuoshouye() then--探索主页面
      
      invite()
      findGreater(fubenMissoin[currentClass-0][1],fubenMissoin[currentClass-0][2]);
      if values.a704 == "0" or values.a705 == "0" then
        GLyaoguaifaxianInStepExp()  
        
      else
        GLyaoguaifaxianInStep()
        clickChest()
      end
      
      
      if values.a702 =="0" then
        currentTime = getNetTime(); 
        tmpTime = currentTime -originTime;
        if tmpTime >600 then
          originTime = currentTime;
          breakthrough(1)
          toast("完成结节突破",1) 
          mSleep(1200)
        else
          tmpTime1 = 600-tmpTime;
          toast("还有"..tostring(tmpTime1).."秒打结界",1);    
          mSleep(1200)
        end
      end
      
      mSleep(1000)
      if values.a706 =="0" then--石头车--一个小时
        currentTimeRock = getNetTime(); 
        tmpTimeRock = currentTimeRock -originTimeRock;
        if tmpTimeRock >3600 then
          originTimeRock = currentTimeRock;
          ExploreToHome()
          seekRock()--石头车
          HomeToExplore()  
          
        else
          tmpTime1Rock = 3600-tmpTimeRock;
          toast("还有"..tostring(tmpTime1Rock).."秒打石头车",1);   
          mSleep(1200)
        end
      end
      
      
      mSleep(1000)
      if values.a707 =="0" then--满10卷
        if tansuoTPJ() =="1" then
          breakthroughPerson()--个人突破
        end 
      end
      
      
      
      timeOut()--检查关闭时间
      
    end 
    
  end
  
end

function clickChestIn(...)
  toast("找奖励盒子中",2)
  mSleep(3500)
  whileCount=0;
  while (true) do
    whileCount=whileCount+1;
    if whileCount>=40 then
      break;
    end--直到点击进到页面
    noticeDown();
    if tansuoshouye() then
      break;
    end--识别返回和突破
    
    if zuduiBox() then
      break;
    end--组队框       
    
    if tansuoInHome() then--探索副本里的主页面
      x,y = findMultiColorInRegionFuzzy( 0xb1441e, "-24|-14|0xfff4d4,-22|18|0xfff4d4,26|16|0xfff4d3,20|-16|0xfff3d0", 90, 110, 186, 2024, 1292)--pad
      --clickChestIn6.
      if x ~= -1 and y ~= -1 then        --如果在指定区域找到某图片符合条件
        mSleep(30);                 
        touchDown(1,x,y); --点开宝箱
        mSleep(30);
        touchUp(1,x,y); 
        x=-1;
        y=-1;
        whileCount = 0
        mSleep(1000)
      end   
    else
      if tansuoshouye() then
      else
        windrumClick()
      end
    end
    
    if (isColor(1832,   38, 0x413b31, 85) and isColor(1940,   36, 0x413b31, 85)) then--pad      
      randomTap(2020,   34,1) --获得奖励
      mSleep(500)
    end
    if (isColor(1976,   36, 0x817762, 85) and isColor(2088,   34, 0x817762, 85)) then
      mSleep(30);                   
      touchUp(1,2170,   50); --发现新妖怪
      mSleep(30);
      touchUp(1,2170,   50); 
      mSleep(500)
    end         
    
  end
  
  
  if (isColor(1832,   38, 0x413b31, 85) and isColor(1940,   36, 0x413b31, 85)) then--pad        
    randomTap(2020,   34,1) --获得奖励
    mSleep(500)
  end
  
  if (isColor(1976,   36, 0x817762, 85) and isColor(2088,   34, 0x817762, 85)) then
    mSleep(30);                 
    touchUp(1,2170,   50); --发现新妖怪
    mSleep(30);
    touchUp(1,2170,   50); 
    mSleep(500)
  end       
  
  
  mSleep(500)
  
  whileCount=0;
  while (true) do
    whileCount=whileCount+1;
    if whileCount>=100 then
      break;  --执行了一百次都不能就是卡住了自动退出 重新开始执行脚本
    end--直到点击进到页面
    noticeDown();
    if tansuoshouye() then
      
      break;
    end--识别返回和突破
    
    if tansuoInHome() then--外面的界面
      if tansuoshouye() then
        
      else
        randomTap(72,  104,2)
        mSleep(500);
      end
    end
    
    if (isColor( 688,  816, 0xf3b25e, 85) and isColor( 916,  858, 0xf3b25e, 85) and isColor(1130,  822, 0xf3b25e, 85) and isColor(1344,  852, 0xf3b25e, 85) and isColor(1016,  644, 0xcbb59c, 85)) then
      randomTap(1242,  834,2)
      mSleep(1500);
    end --IPAD
    
    if tansuoshouye() then
      break;
    end--识别返回和突破
    
    if zuduiBox() then
      break;
    end--组队框        
    
  end
  
  
end



function clickChest(...)
  
  if zuduiBox() then
    return;
  end--组队框      
  
  toast("找宝箱中",1)
  mSleep(1200)
  whileCount=0;
  while (true) do
    whileCount=whileCount+1;
    if whileCount>=30 then
      break;
    end--直到点击进到页面
    noticeDown();
    x,y = findMultiColorInRegionFuzzy( 0xface35, "-30|-16|0xb12919,30|-8|0xb63819,-26|26|0xd8931d", 90, 146, 180, 1734, 1356)--pad
    --clickChest6
    if x ~= -1 and y ~= -1 then        --如果在指定区域找到某图片符合条件
      mSleep(30);                   
      touchDown(1,x,y); --点开宝箱
      mSleep(30);
      touchUp(1,x,y); 
      mSleep(1000)
    end 
    
  end
  
  whileCount=0;
  while (true) do
    whileCount=whileCount+1;
    if whileCount>=8 then
      break;
    end--直到点击进到页
    randomTap(2020,   34,1) --获得奖励
    mSleep(500)
  end
  
  
end

function F探索副本换狗粮结束(...)
  -- body
end

---##################################################################################################  --探索副本换狗粮




---##################################################################################################  --第二页组队上车
function F组队上车开始(...)
  -- body
end

function check(...)
  
  countCheck=0;
  while (true) do
    invite();
    inviteRefuse()--拒绝组队
    countCheck = countCheck +1;
    if countCheck > 100 then
      dialog("当前脚本为组队模式,请进入游戏来到组队界面后再运行本脚本(阴阳寮左边的组队按钮),按确定退出脚本。【注意:辅助的首页设置Home键位置】", 0)
      lua_exit()
    end 
    
    if zuduiCreatQu() then
      break;
    else--到了组队页面
      noticeDown(); 
    end
    
    x,y = findMultiColorInRegionFuzzy( 0x7b2412, "4|36|0xd5c6c2,44|-24|0xe3d6d0,42|26|0x842a14", 90, 1882, 1340, 1980, 1434)
    --underPaper6
    if x ~= -1 and y ~= -1 then        --如果在指定区域找到某图片符合条件
      randomTap(1932, 1384,2);      --打开卷轴
      x=-1;
      y=-1;
      mSleep(1500)
      
    else
      if youxishouye() then
        randomTap(398, 1366,2)--点击组队按钮
        mSleep(1500)
      end--这个是在外面的页面;
      
    end
    
  end
end


function seekTitleRandom(...)
  local x,y,x1,y1,x2,y2,x3,y3;
  x3,y3 = findMultiColorInRegionFuzzy( 0xf6eaa7, "-18|24|0xddb241,24|20|0xe0b84f", 90, 1596, 1068, 1786, 1174)--4
  if x3 ~= -1 and y3 ~= -1 then 
    randomTap(x3,y3,5)
    mSleep(100)
  end  
  x2,y2 = findMultiColorInRegionFuzzy( 0xf6eaa7, "-18|24|0xddb241,24|20|0xe0b84f", 90, 1600, 908, 1786, 1006)--3
  if x2 ~= -1 and y2 ~= -1 then 
    randomTap(x2,y2,5)
    mSleep(100)
  end  
  x1,y1 = findMultiColorInRegionFuzzy( 0xf6eaa7, "-18|24|0xddb241,24|20|0xe0b84f", 90, 1598, 744, 1784, 844)--2
  if x1 ~= -1 and y1 ~= -1 then 
    randomTap(x1,y1,5)
    mSleep(100)
  end  
  x,y = findMultiColorInRegionFuzzy( 0xf6eaa7, "-18|24|0xddb241,24|20|0xe0b84f", 90, 1594, 582, 1788, 680)--1
  if x ~= -1 and y ~= -1 then 
    randomTap(x,y,5)
    mSleep(100)
  end
  
  
  
end


function seekTitleXY(...)
  
  local x1,x2,x3,x4,x5;
  local y1,y2,y3,y4,y5; 
  
  
  if values.cb201 =="0" then--妖气封印--鬼使黑,海坊主,椒图,二口女,骨女,饿鬼,跳跳哥哥,金币妖怪,经验妖怪
    if  values.cb202 =="0" then 
      
      x1,y1=findImage("guishiheiipad.png", 838, 542, 918, 1240,1100000);--鬼使黑
      if x1 ~= -1 and y1 ~= -1 then 
        return x1,y1;
      end
      x2,y2=findImage("haifangipad.png", 838, 542, 925, 1200,1100000);--海坊主
      if x2 ~= -1 and y2 ~= -1 then 
        return x2,y2;
      end
      x3,y3=findImage("erkounvipad.png", 838, 542, 925, 1200,1100000);--二口女
      if x3 ~= -1 and y3 ~= -1 then 
        return x3,y3;
      end               
      x4,y4=findImage("gunvipad.png", 838, 542, 925, 1200,1100000);--骨女
      if x4 ~= -1 and y4 ~= -1 then 
        return x4,y4;
      end   
      x5,y5=findImage("tiaotiaoipad.png", 838, 542, 925, 1200,1100000);--跳跳哥哥
      if x5 ~= -1 and y5 ~= -1 then 
        return x5,y5;
      end               
      
      return x5,y5;
      
    end
    
    
    return findImage(SImage, 838, 542, 925, 1200,1100000);
  end
  
  if values.cb201 =="1" or values.cb201 =="2" or values.cb201 =="8" or values.cb201 =="9" then--石距年兽金币妖气
    seekTitleRandom()
    return -1,-1;
  end
  
  if values.cb201 =="3" then--御魂
    if  values.cb202 =="0" then 
      seekTitleRandom()
      return -1,-1; 
    end
    
    return findImage(SImage,758, 565, 822, 1190,5500000);
  end
  
  if values.cb201 =="4" or values.cb201 =="5" or values.cb201 =="6" or values.cb201 =="7" then--觉醒
    if  values.cb202 =="0" then 
      seekTitleRandom()
      return -1,-1; 
    end
    
    return findImage(SImage,886, 556, 956, 1210,5500000);
  end
end


function seekTitle(...)
  local     paddingX,paddingY;
  inviteRefuse()--拒绝组队
  mSleep(500)
  if values.cb201 =="0" then--妖气封印--鬼使黑,海坊主,椒图,二口女,骨女,饿鬼,跳跳哥哥,金币妖怪,经验妖怪
    paddingX = 844;
    paddingY = 46;
    
    while (true) do--确定是按了左上角的全部按钮
      invite();
      if (isColor( 260, 1232, 0xe8d6c1, 85)) then--妖气封印按钮   --ipad
        randomTap(260, 1232,2);
        mSleep(1000);
      end
      
      
      if (isColor( 666,  502, 0xf8f3e0, 85) and isColor( 688,  504, 0x4e0c0c, 85)) then--妖气封印标志
        break;
      end
      
    end     
  end
  
  if values.cb201 =="1" then--石距
    mSleep(500)
    moveTo(390,  1200,390,  500,50,800)
    mSleep(1200)--直接移动到最下面
    
    while (true) do--确定是按了左上角的全部按钮
      invite();
      if (isColor( 521, 1039, 0xe8d6c1, 85)) then--石距   
        randomTap(521, 1039,2)
        mSleep(1000);
      end
      
      
      if (isColor( 662,  490, 0xf8f3e0, 85) and isColor( 748,  492, 0x5e0909, 85)) then--石距标志
        break;
      end
      
    end     
  end
  
  if values.cb201 =="2" then--年兽
    mSleep(500)
    moveTo(390,  1200,390,  500,50,800)
    mSleep(1200)--直接移动到最下面
    
    
    while (true) do--确定是按了左上角的全部按钮
      invite();
      if (isColor( 513,  921, 0xe8d6c1, 85)) then--年兽   
        randomTap(513,  921,2)
        mSleep(1000);
      end
      
      
      if (isColor( 666,  498, 0xf8f3e0, 85) and isColor( 750,  490, 0x5e0909, 85)) then--年兽 标志
        break;
      end
      
    end     
    
  end
  
  if values.cb201 =="3" then--御魂
    paddingX = 932;
    paddingY = 48;
    
    while (true) do--确定是按了左上角的全部按钮
      invite();
      if (isColor( 272, 1120, 0xe8d6c1, 85)) then--御魂按钮 
        randomTap(272, 1120,2)
        mSleep(1000);
      end
      
      if (isColor( 750,  492, 0x600808, 85) and isColor( 670,  550, 0xb7aa9e, 85)) then--选到了
        break;
      else
        randomTap(1214, 1304,2)--出现选层
        mSleep(500);
      end
      
    end 
    
  end
  
  if values.cb201 =="4" or values.cb201 =="5" or values.cb201 =="6" or values.cb201 =="7" then--觉醒
    --觉醒火,觉醒风,觉醒水,觉醒雷
    paddingX = 794;
    paddingY = 50;  
    
    while (true) do--确定是按了左上角的全部按钮
      invite();
      if values.cb201 =="4" and (isColor( 254,  646, 0xe8d6c1, 85)) then--觉醒火   
        randomTap(254,  646,2)
        mSleep(1000);
      end
      if values.cb201 =="5" and (isColor( 252,  760, 0xe8d6c1, 85)) then--觉醒风   
        randomTap(252,  760,2)
        mSleep(1000);
      end
      if values.cb201 =="6" and (isColor( 248,  880, 0xe8d6c1, 85)) then--觉醒水   
        randomTap( 248,  880,2)
        mSleep(1000);
      end
      if values.cb201 =="7" and (isColor( 250,  998, 0xe8d6c1, 85)) then--觉醒雷   
        randomTap(250,  998,2)
        mSleep(1000);
      end
      
      
      if (isColor( 680,  508, 0x4b0c0c, 85) and isColor( 670,  550, 0xb7aa9e, 85)) then--选到了
        break;
      else
        randomTap(1214, 1304,2)--出现选层
        mSleep(500);
      end
      
      
      
    end
  end
  
  
  if values.cb201 =="8" then--金币妖怪
    mSleep(500)
    moveTo(390,  1200,390,  500,50,800)
    mSleep(1200)--直接移动到最下面
    
    
    while (true) do--确定是按了左上角的全部按钮
      invite();
      if (isColor( 531,  800, 0xe8d6c1, 85)) then--金币妖怪 
        randomTap( 531,  800,3)
        mSleep(1000);
      end
      
      
      if (isColor( 683,  510, 0x4d0c0c, 85) and isColor( 822,  497, 0x8e0b0b, 85)) then--金币妖怪   标志
        break;
      end
      
    end     
    
  end
  
  
  
  if values.cb201 =="9" then--经验妖怪
    mSleep(500)
    moveTo(390,  1200,390,  500,50,800)
    mSleep(1200)--直接移动到最下面
    
    
    while (true) do--确定是按了左上角的全部按钮
      invite();
      if (isColor( 528,  683, 0xe8d6c1, 85)) then
        randomTap( 528,  683,3)
        mSleep(1000);
      end
      
      
      if (isColor( 815,  496, 0x7f0a0a, 85) and isColor( 818,  496, 0x810d0d, 85)) then--经验妖怪   标志
        break;
      end
      
    end     
    
  end      
  
  countSeekImage = 0;
  while (true) do--选择图片
    countSeekImage = countSeekImage +1; 
    invite();
    
    if (isColor( 693, 1294, 0xf3b25e, 85)) then--检测按钮的颜色
      x, y = seekTitleXY() 
      if x ~= -1 and y ~= -1 then 
        randomTap(x+paddingX,  y+paddingY,5)
        mSleep(600);
        x=-1;
        y=-1;
        if countSeekImage > 10 then
          randomTap(693, 1294,5)--按刷新按钮
          mSleep(200);
          countSeekImage = 0;
        end 
      end
      
      if (isColor( 693, 1294, 0xf3b25e, 85)) then   --刷新按钮
        if values.a016 =="0" then--刷新随机500毫秒
          mSleep(math.random(500))
        end           
        randomTap(693, 1294,5)--按刷新按钮
        mSleep(500);
      end
      
    end
    
    
    
    if zuduiLoading() then --进来了
      break;
    end --toast("准备开始了,请稍等",1)
    
    
    if zhandouhuamian() then
      break;
    end--战斗直接开始了
    
  end
  
  while (true) do--开始战斗
    invite();
    --超时自动退出了
    if zuduiCreatQu() then--超时退出后一直关闭回到主页重新开始
      while (true) do
        if youxishouye() then
          break
        else
          noticeDown();
          mSleep(1000)
        end
      end
    end
    
    
    if youxishouye() then
      break;
    end
    
    if (isColor( 253, 1132, 0xdf6851, 85) and isColor(1553, 1130, 0xf3b25e, 85)) then
      randomTap(1670, 1148,3)
      mSleep(1500)
    end--自己当了房主
    
    if (isColor(1286,  692, 0xcbb59c, 85)) then
      randomTap(830, 1256,2)--点到了添加好友
      mSleep(50)
    end--点到了添加好友--左边
    
    if (isColor(1930,  692, 0xcbb59c, 85)) then
      randomTap(830, 1256,2)--点到了添加好友
      mSleep(50)
    end--点到了添加好友--右边
    
    if (isColor( 234, 1178, 0x8c857f, 85)) then
      randomTap(830, 1256,2)--点到了添加好友
      mSleep(50)
    end--点到了添加好友--右边
    
    if zuduiLoading() then
    else--离开了这个等待页面
      if zhandouhuamian() then
        toast("战斗开始",1)
        mSleep(500)
        break;
      end
    end
  end
  
  countCheck=0;
local markseek = false;   
  while (true) do
    noticeDown();
    ready6();
    fightManual6()
    if zhandouhuamian() then   
      assFight()--集火
      mSleep(math.random(100,200))
    end  
    x3,y3 = windrum3_6()
    --失败--windrum3_6
    if x3 ~= -1 and y3 ~= -1 then 
      while (true) do
        zuduiJujue()--出现了再次组队的框--拒绝     
        if youxishouye() then--外面的界面
            markseek = true;
          break;
        else
          homeIconClick();
        end
      end
    end     
    
    x2,y2 = windrum2_6()
    --胜利--windrum2_6
    if x2 ~= -1 and y2 ~= -1 then 
      while (true) do   
        zuduiJujue()--出现了再次组队的框--拒绝     
        if youxishouye() then--外面的界面
            markseek = true;
          break;
        else
          homeIconClick();
        end
      end
    end     
    if zhandouhuamian() then--战斗中延迟
      mSleep(math.random(100,300))
    end     
    noticeDown()    
  
    if youxishouye() and markseek then---外面的界面
      break;
    end
    
  end
end



function seekRock(...)
  countCheck=0;
  while (true) do
    invite();
    inviteRefuse()--拒绝组队
    countCheck = countCheck +1;
    if countCheck > 100 then
      dialog("当前脚本为组队模式,请进入游戏来到组队界面后再运行本脚本(阴阳寮左边的组队按钮),按确定退出脚本。【注意:辅助的首页设置Home键位置】", 0)
      lua_exit()
    end 
    
    if zuduiCreatQu() then
      break;
    else--到了组队页面
      noticeDown(); 
    end
    
    x,y = findMultiColorInRegionFuzzy( 0x7b2412, "4|36|0xd5c6c2,44|-24|0xe3d6d0,42|26|0x842a14", 90, 1882, 1340, 1980, 1434)
    --underPaper6
    if x ~= -1 and y ~= -1 then        --如果在指定区域找到某图片符合条件
      randomTap(1932, 1384,2);      --打开卷轴
      x=-1;
      y=-1;
      mSleep(1500)
      
    else
      if youxishouye() then
        randomTap(398, 1366,2)--点击组队按钮
        mSleep(1500)
      end--这个是在外面的页面;
      
    end
    
  end
  
  
  --if values.cb201 =="1" then--石距
  mSleep(1000)
  moveTo(390,  1200,390,  500,50,800)
  mSleep(1200)--直接移动到最下面
  
  while (true) do--确定是按了左上角的全部按钮
    invite();
    if (isColor( 521, 1039, 0xe8d6c1, 85)) then--石距 
      randomTap(521, 1039,2)
      mSleep(1000);
    end
    
    
    if (isColor( 662,  490, 0xf8f3e0, 85) and isColor( 748,  492, 0x5e0909, 85)) then--石距标志
      break;
    end
    
  end   
  -- end
  
  
  
  
  
  while (true) do--选择图片
    invite();
    
    if (isColor( 693, 1294, 0xf3b25e, 85)) then--检测按钮的颜色
      seekTitleRandom()
      mSleep(600)
      
      if (isColor( 693, 1294, 0xf3b25e, 85)) then   --刷新按钮  
        if values.a016 =="0" then--刷新随机500毫秒
          mSleep(math.random(500))
        end           
        randomTap(693, 1294,5)--按刷新按钮
        mSleep(500);
      end
      
    end
    
    
    
    if zuduiLoading() then --进来了
      break;
    end --toast("准备开始了,请稍等",1)
    
    
    if zhandouhuamian() then
      break;
    end--战斗直接开始了
    
  end
  
  while (true) do--开始战斗
    invite();
    --超时自动退出了
    if zuduiCreatQu() then--超时退出后一直关闭回到主页重新开始
      while (true) do
        if youxishouye() then
          break
        else
          noticeDown();
          mSleep(1000)
        end
      end
    end
    
    
    if youxishouye() then
      break;
    end
    
    if (isColor( 253, 1132, 0xdf6851, 85) and isColor(1553, 1130, 0xf3b25e, 85)) then
      randomTap(1670, 1148,3)
      mSleep(1500)
    end--自己当了房主
    
    if (isColor(1286,  692, 0xcbb59c, 85)) then
      randomTap(830, 1256,2)--点到了添加好友
      mSleep(50)
    end--点到了添加好友--左边
    
    if (isColor(1930,  692, 0xcbb59c, 85)) then
      randomTap(830, 1256,2)--点到了添加好友
      mSleep(50)
    end--点到了添加好友--右边
    
    if (isColor( 234, 1178, 0x8c857f, 85)) then
      randomTap(830, 1256,2)--点到了添加好友
      mSleep(50)
    end--点到了添加好友--右边
    
    if zuduiLoading() then
    else--离开了这个等待页面
      if zhandouhuamian() then
        toast("战斗开始",1)
        mSleep(500)
        break;
      end
    end
  end
  
  countCheck=0;
local markseek = false;   
  while (true) do
    noticeDown();
    ready6();
    fightManual6()
    
    x3,y3 = windrum3_6()
    --失败--windrum3_6
    if x3 ~= -1 and y3 ~= -1 then 
      while (true) do
        zuduiJujue()--出现了再次组队的框--拒绝     
        if youxishouye() then--外面的界面
            markseek = true;
          break;
        else
          homeIconClick();
        end
      end
    end     
    
    x2,y2 = windrum2_6()
    --胜利--windrum2_6
    if x2 ~= -1 and y2 ~= -1 then 
      while (true) do   
        zuduiJujue()--出现了再次组队的框--拒绝     
        if youxishouye() then--外面的界面
            markseek = true;
          break;
        else
          homeIconClick();
        end
      end
    end     
    if zhandouhuamian() then--战斗中延迟
      mSleep(math.random(100,300))
    end     
    noticeDown()    
    
    
    if youxishouye() and markseek then---外面的界面
      break;
    end
    
  end
  
  
  
end



function F组队上车结束(...)
  -- body
end

---##################################################################################################  --第结界突破

function F突破开始(...)
  -- body
end

function seekPerson3Click(...)
  local x,y,x1,y1,x3,y3,x4,y4,x5,y5
  if tupoInHome() then
    x,y = findMultiColorInRegionFuzzy( 0x7a5a4b, "323|-127|0xccbca7,337|18|0x9b8774,322|26|0x9b8774,188|-24|0xb3a28d,249|-24|0xb3a28d", 90, 194, 325, 1854, 990)--0星--p
    mSleep(500)
    if x ~= -1 and y ~= -1 then
      return x,y
    end
    mSleep(500)
    x1,y1 =findMultiColorInRegionFuzzy( 0x7a5a4b, "260|-127|0xccbca7,274|18|0x9b8774,259|26|0x9b8774,125|-24|0xb3a28d,186|-24|0xb3a28d", 90, 194, 325, 1854, 990)--1星--p
    if x1 ~= -1 and y1 ~= -1 then
      return x1,y1
    end
    mSleep(500)
    x2,y2 = findMultiColorInRegionFuzzy( 0x7a5a4b, "197|-127|0xccbca7,211|18|0x9b8774,196|26|0x9b8774,62|-24|0xb3a28d,123|-24|0xb3a28d", 90, 194, 325, 1854, 990)--2星--p
    if x2 ~= -1 and y2 ~= -1 then
      return x2,y2
    end 
    mSleep(500)
    x3,y3 = findMultiColorInRegionFuzzy( 0x765144, "133|-129|0xccbba7,148|17|0x9b8774,131|26|0x9b8774,-2|-26|0xb3a28d,59|-26|0xb3a28d", 90, 194, 325, 1854, 990)--3星--p
    if x3 ~= -1 and y3 ~= -1 then
      return x3,y3
    end     
    mSleep(500)
    x4,y4 = findMultiColorInRegionFuzzy( 0x765144, "68|-129|0xccbba7,65|26|0x9b8774,84|15|0x9b8774,-3|-28|0xb3a28d", 90, 194, 325, 1854, 990)--4星--p
    if x4 ~= -1 and y4 ~= -1 then
      return x4,y4
    end 
    mSleep(500)
    x5,y5 = findMultiColorInRegionFuzzy( 0xd5c8b8, "364|-105|0xcbbaa5,377|42|0x9b8774,357|53|0x9b8874", 90, 194, 325, 1854, 990)--5星--p
    if x5 ~= -1 and y5 ~= -1 then
      return x5,y5
    end 
    mSleep(500)
  end
  
  return -1,-1;
end



function breakthroughOriBase(...)
  breakthrough(1)
  mSleep(1200)
  while (true) do
    currentTime = getNetTime(); 
    tmpTime = currentTime -originTime;
    if tmpTime >600 then
      originTime = currentTime;
      breakthrough(1)
    else
      tmpTime1 = 600-tmpTime;
      toast("还有"..tostring(tmpTime1).."秒打结界".."本框30秒自动关闭",30);
      mSleep(35000)
    end
    
    
  end
end


function breakthroughOri(...)
  breakthrough(1)
  mSleep(1200)
  while (true) do
    currentTime = getNetTime(); 
    tmpTime = currentTime -originTime;
    if tmpTime >600 then
      originTime = currentTime;
      breakthrough(1)
    else
      tmpTime1 = 600-tmpTime;
      toast("还有"..tostring(tmpTime1).."秒打结界".."本框30秒自动关闭",30);
      mSleep(35000)
    end
    
    --石头车--一个小时
    currentTimeRock = getNetTime(); 
    tmpTimeRock = currentTimeRock -originTimeRock;
    if tmpTimeRock >3600 then
      originTimeRock = currentTimeRock;
      mSleep(1000)
      ExploreToHome()
      seekRock()--石头车
      HomeToExplore()  
      mSleep(1000)
    else
      tmpTime1Rock = 3600-tmpTimeRock;
      toast("还有"..tostring(tmpTime1Rock).."秒打石头车",1);   
      mSleep(1200)
    end
    
  end
end



function breakthroughOriZD(...)
  breakthrough(1)
  mSleep(1000)  
  breakthrough(2)
  mSleep(1200)
  
  local breakthrough1 = true;
  local breakthrough2 = false;  
  
  
  while (true) do
    currentTime = getNetTime(); 
    tmpTime = currentTime -originTime;
    if tmpTime >600 and breakthrough1 then
      originTime = currentTime;
      breakthrough(1)
      breakthrough1 = false;  
      breakthrough2 = true; 
      mSleep(5000)  
    else
      tmpTime1 = 600-tmpTime;
      toast("还有"..tostring(tmpTime1).."秒打结界".."本框30秒自动关闭",30);
      mSleep(35000)
    end
    
    
    mSleep(3000)
    if  breakthrough2 then
      breakthrough(2)--组队打寮
      breakthrough1 = true;  
      breakthrough2 = false;
      mSleep(5000)  
    end
    
    
    
    
    --石头车--一个小时
    currentTimeRock = getNetTime(); 
    tmpTimeRock = currentTimeRock -originTimeRock;
    if tmpTimeRock >3600 then
      originTimeRock = currentTimeRock;
      mSleep(1000)
      ExploreToHome()
      seekRock()--石头车
      HomeToExplore()  
      mSleep(1000)
    else
      tmpTime1Rock = 3600-tmpTimeRock;
      toast("还有"..tostring(tmpTime1Rock).."秒打石头车",1);   
      mSleep(1200)
    end
    
  end
end


function breakthroughOriZDBase(...)
  breakthrough(1)
  mSleep(1000)  
  breakthrough(2)
  mSleep(1200)
  
  local breakthrough1 = true;
  local breakthrough2 = false;  
  
  
  while (true) do
    currentTime = getNetTime(); 
    tmpTime = currentTime -originTime;
    if tmpTime >600 and breakthrough1 then
      originTime = currentTime;
      breakthrough(1)
      breakthrough1 = false;  
      breakthrough2 = true; 
      mSleep(5000)  
    else
      tmpTime1 = 600-tmpTime;
      toast("还有"..tostring(tmpTime1).."秒打结界".."本框30秒自动关闭",30);
      mSleep(35000)
    end
    
    
    mSleep(3000)
    if  breakthrough2 then
      breakthrough(2)--组队打寮
      breakthrough1 = true;  
      breakthrough2 = false;
      mSleep(5000)  
    end
    
    
  end
end

--结界突破寮-向上滑动
function seekLastup(...)
  mSleep(500)--
  moveTo(1790, 425,1790, 1250,10,800)--p
  mSleep(1000)--
end

--结界突破寮-向下滑动
function seekLastdown(...)
  mSleep(500)--
  moveTo(1790, 1150,1790, 325,10,800)--p
  mSleep(1000)--
end

--结界突破寮-攻破
function seekLastbreak(...)
  local x, y;
  x, y = findMultiColorInRegionFuzzy( 0xcfbfac, "1|67|0xcbb9a4,59|60|0x701a2b,73|-16|0xaa3636", 90, 748, 332, 1864, 1277)--p
  if x ~= -1 and y ~= -1 then 
    return true;
    
  else
    return false;
  end
end


--从0星开始找
function seekLastClick(...)--748, 332, 1864, 1277
  local x,y,x1,y1,x3,y3,x4,y4,x5,y5
  if tupoInHomeOri() then
    x,y = findMultiColorInRegionFuzzy( 0x7a5a4b, "323|-127|0xccbca7,337|18|0x9b8774,322|26|0x9b8774,188|-24|0xb3a28d,249|-24|0xb3a28d", 90,748, 332, 1864, 1277)--0星--p
    mSleep(500)
    if x ~= -1 and y ~= -1 then
      return x,y
    end
    mSleep(500)
    x1,y1 =findMultiColorInRegionFuzzy( 0x7a5a4b, "260|-127|0xccbca7,274|18|0x9b8774,259|26|0x9b8774,125|-24|0xb3a28d,186|-24|0xb3a28d", 90,748, 332, 1864, 1277)--1星--p
    if x1 ~= -1 and y1 ~= -1 then
      return x1,y1
    end
    mSleep(500)
    x2,y2 = findMultiColorInRegionFuzzy( 0x7a5a4b, "197|-127|0xccbca7,211|18|0x9b8774,196|26|0x9b8774,62|-24|0xb3a28d,123|-24|0xb3a28d", 90,748, 332, 1864, 1277)--2星--p
    if x2 ~= -1 and y2 ~= -1 then
      return x2,y2
    end 
    mSleep(500)
    x3,y3 = findMultiColorInRegionFuzzy( 0x765144, "133|-129|0xccbba7,148|17|0x9b8774,131|26|0x9b8774,-2|-26|0xb3a28d,59|-26|0xb3a28d", 90,748, 332, 1864, 1277)--3星--p
    if x3 ~= -1 and y3 ~= -1 then
      return x3,y3
    end     
    mSleep(500)
    x4,y4 = findMultiColorInRegionFuzzy( 0x765144, "68|-129|0xccbba7,65|26|0x9b8774,84|15|0x9b8774,-3|-28|0xb3a28d", 90,748, 332, 1864, 1277)--4星--p
    if x4 ~= -1 and y4 ~= -1 then
      return x4,y4
    end 
    mSleep(500)
    x5,y5 = findMultiColorInRegionFuzzy( 0xd5c8b8, "364|-105|0xcbbaa5,377|42|0x9b8774,357|53|0x9b8874", 90,748, 332, 1864, 1277)--5星--p
    if x5 ~= -1 and y5 ~= -1 then
      return x5,y5
    end 
    mSleep(500)
  end
  
  return -1,-1;
end

function seekLast(...)--5
  local x,y;
  local countSlip = 0;
  
  whileCount=0;
  while (true) do
    whileCount=whileCount+1;
    if whileCount>200 then --选择阴阳寮
      if tansuoshouye() then
      else
        randomTap(986, 1282,2)--激活一下
        mSleep(500);  
      end
      return true;
    end
    invite()
    mSleep(200)
    if (seekLastbreak()==false) and countSlip < 3  then--如果已经找到破的或者失败的 
      seekLastdown()
      countSlip = countSlip + 1;
      toast("滑动"..tostring(3-countSlip).."次后,在该页面随机没打过的。",1)
      mSleep(1500)
    else
      x,y = seekLastClick()--从小找到大;
      if x == -1 and y == -1 then 
        seekLastup()--向上滑动一次在找一次;
        mSleep(1200)
        return seekLastClick();
      else
        return x,y;
      end       
      
    end
    
  end
end

function rununionIn(breakType)
  local x=1;
  local y=1;
  x,y = seekLast();
  if x == -1 and y == -1 then 
    return true;
  end
  whileCount=0;
  while (true) do
    invite()
    whileCount=whileCount+1;
    if whileCount>100 then 
      return true;
    end
    if tupoInHomeOri() then  
      randomTap(x,y,2)
      mSleep(1200);
    end  
    mSleep(50)
    x1,y1 =findMultiColorInRegionFuzzy( 0xf3b25e, "0|48|0xf3b25e,156|46|0xf3b25e,156|-2|0xf3b25e,-48|28|0xcbb59c", 90, 726, 298, 1872, 1432)
    --YYLzudui6
    if x1 ~= -1 and y1 ~= -1 then 
      break
    end
    
  end
  
  
  if breakType == 1 then --单打
    whileCount=0;
    while (true) do
      invite()
      whileCount=whileCount+1;
      if whileCount>100 then --找不到是因为还在冷却时间
        x1,y1 =findMultiColorInRegionFuzzy( 0xf3b25e, "0|48|0xf3b25e,156|46|0xf3b25e,156|-2|0xf3b25e,-48|28|0xcbb59c", 90, 726, 298, 1916, 1432)-- 730, 310, 1916, 1408
        --YYLzudui6
        if x1 ~= -1 and y1 ~= -1 then 
          randomTap(1596,  250,2)
          mSleep(500) 
          return true;
        end  
      end   
      mSleep(50)
      x1, y1 = findMultiColorInRegionFuzzy( 0xf3b25e, "-84|-34|0xf3b25e,-82|24|0xf3b25e,-128|-6|0xcbb59c,-390|-6|0xcbb59c,152|-2|0xcbb59c", 90, 726, 298, 1916, 1432)
      --YYLgongji6
      if x1 ~= -1 and y1 ~= -1 then        --如果在指定区域找到某图片符合条件
        mSleep(50);             
        touchDown(1,x1,y1); 
        mSleep(50);
        touchUp(1,x1,y1); 
        mSleep(2500)   
        whileCount = -100;
      end
      
      if zhandouhuamian() then
        break;
      end   --战斗画面
    end
    
    
  end           
  
  if breakType == 2 then --组队
    
    
    whileCount=0;
    while (true) do
      invite()
      whileCount=whileCount+1;
      if whileCount>100 then --找不到是因为还在冷却时间
        if tupoInHomeOri() or tansuoshouye() then--突破寮  
          return true;
        end--回到了突破的位置   --在这个界面下--上面的框 和叉叉  
      end
      mSleep(100)
      x1,y1 = findMultiColorInRegionFuzzy( 0xf3b25e, "-80|-25|0xf3b25e,-81|24|0xf3b25e,-117|3|0xcbb59c,132|0|0xcbb59c,384|0|0xcbb59c", 90,746, 294, 1916, 1296)
      --YYLzudui6
      if x1 ~= -1 and y1 ~= -1 then 
        mSleep(50);
        randomTap(x1,y1,2)
        mSleep(1500) 
      end  
      
      
      if zuduiLoading() then--等待组队页面
        if (isColor(1184,  926, 0xddc16a, 85)) then--邀请1
          randomTap(1184,  926,2)
          mSleep(1000)
        end
        mSleep(100)
        if (isColor(1672, 1144, 0xf3b25e, 85)) then--可以开始战斗了
          randomTap(1672, 1144,2)
          mSleep(1000)              
        end
        mSleep(100)  
        
        end
        
        if (isColor( 488, 1158, 0x9e4939, 85) and isColor( 532, 1158, 0x8d857f, 85)) then
          randomTap( 830, 1256,2)
          mSleep(500)
        end--点到了好友资料
      
      if (isColor( 729, 1089, 0xdf6851, 85) and isColor(1162, 1090, 0xf3b25e, 85) and isColor( 598,  401, 0x9f876d, 85)) then
        if (isColor( 798,  584, 0xccc4b9, 85)) then--选择第一个
          randomTap(798,  584,2)
          mSleep(500)
        end
        mSleep(100)
        if (isColor( 725, 1093, 0xdf6851, 85) and isColor(1161, 1088, 0xf3b25e, 85) and isColor( 818,  588, 0x93cdda, 85)) then--选到第一个,邀请
          randomTap(1240, 1109,2)
          mSleep(1000)
        end
        
        
        
      end--邀请组队页面
      
      
      if zhandouhuamian() then
        break;
      end   --战斗画面
      
      
      
    end
    
  end               
  
  
  
  countCheck=0;
  while (true) do
    invite()
    countCheck = countCheck +1;
    if countCheck > 10000 then
      errorLoop()  
      dialog("超时,请来到探索页面,再运行脚本6", 0);
      lua_exit()    
    end 
    invite();
    ready6();
    fightManual6()
    
    x3,y3 = windrum3_6()
    --失败--windrum3_6
    if x3 ~= -1 and y3 ~= -1 then 
      while (true) do
        if tupoInHomeOri() or tansuoshouye() then--突破寮  
          return true;
        else
          randomTap(986, 1282,2)--激活一下
          mSleep(1500); 
        end
      end
    end     
    
    x2,y2 =  windrum2_6()
    --胜利--windrum2_6
    if x2 ~= -1 and y2 ~= -1 then 
      while (true) do
        if tupoInHomeOri() or tansuoshouye() then--突破寮  
          return true;
        else
          randomTap(986, 1282,2)--激活一下
          mSleep(1500); 
        end
        
      end
    end     
    
    if tupoInHomeOri() or tansuoshouye() then--突破寮  
      return true;
    end--回到了突破的位置   --在这个界面下--上面的框 和叉叉  
  end
end


function rununion1(breakType)
  
  
  whileCount=0;
  while (true) do
    whileCount=whileCount+1;
    if whileCount>100 then --选择阴阳寮
      return true;
    end
    mSleep(50)
    if (isColor( 214,  349, 0xcad1f8, 85)) then
      break;
    else
      invite();
      randomTap(443,  500,2)
      mSleep(800);
    end
    if tansuoshouye() then
      toast("窗口可能崩了,回到了探索主页,结界结束",1)
      mSleep(1200)
      return true;
    end 
  end--选中第一个阴阳寮
  
  return rununionIn(breakType)
  
end



function rununion2(breakType)
  
  whileCount=0;
  while (true) do
    whileCount=whileCount+1;
    if whileCount>100 then --选择阴阳寮
      return true;
    end
    mSleep(50)
    if (isColor( 215,  647, 0xcad1f8, 85)) then
      break;
    else
      invite();
      randomTap(458,  793,2)
      mSleep(800);
    end
    
    
    if tansuoshouye() then
      toast("窗口可能崩了,回到了探索主页,结界结束",1)
      mSleep(1200)
      return true;
    end 
    
  end--选中第二个阴阳寮
  
  return rununionIn(breakType)   
end


function rununion3(breakType)
  
  whileCount=0;
  while (true) do
    whileCount=whileCount+1;
    if whileCount>100 then --选择阴阳寮
      return true;
    end
    mSleep(50)
    if (isColor( 216,  945, 0xcad1f8, 85)) then
      break;
    else
      invite();
      randomTap(216,  945,2)
      mSleep(800);
    end
    if tansuoshouye() then
      toast("窗口可能崩了,回到了探索主页,结界结束",1)
      mSleep(1200)
      return true;
    end 
  end--选中第三个阴阳寮
  
  return rununionIn(breakType)   
end


function breakthrough(breakType)
  
  if tupoInHome() then
  else
    noticeDown()
    noticeDown() 
  end --防止打开了这个界面   
  
  
  
  whileCount=0;
  while (true) do
    whileCount=whileCount+1;
    if whileCount>200 then --找位置
      --在主页面    
      errorLoop()  
      dialog("请来到探索主页面,再运行脚本。【注意:辅助的首页设置Home键位置】", 0)
      lua_exit()    
    end
    invite();
    mSleep(500)
    if tansuoshouye() then  
      randomTap(666, 1410,2) --点击结界突破
      mSleep(1500);
    else
      -- noticeDown() 
    end--点击结界突破
    
    if tupoInHome() then--突破首页
      break;
    end 
    
  end 
  
  
  whileCount=0;
  while (true) do
    whileCount=whileCount+1;
    if whileCount>300 then --选择阴阳寮
      errorLoop()
      dialog("请来到探索页面,再运行脚本", 0)
      lua_exit()        
    end
    mSleep(50)
    if (isColor(1930,  458, 0xf8f3e0, 85) and isColor(1933,  458, 0xf8f3e0, 85)) then
      randomTap(1976,  742,2) --选择阴阳寮
      mSleep(500);
    end
    
    if (isColor(1929,  657, 0xf8f3e0, 85)) then
      break 
    end--选择阴阳寮---选中的阴阳寮-白色的边
    
    
  end 
  
  
  mSleep(2000)
  
  -- 这里开始判断
  union1 = false;
  union2 = false;
  union3 = false; 
  
  whileCount=0;
  while (true) do
    whileCount=whileCount+1;
    if whileCount>300 then --选择阴阳寮
      --在主页面    
      errorLoop()  
      dialog("请来到探索页面,再运行脚,寮界面", 0)
      lua_exit()    
    end
    
    if union1 and union2 and union3 then
      break;
    end
    
    
    
    if tansuoshouye() then
      toast("窗口可能崩了,回到了探索主页,结界结束",1)
      mSleep(1200)
      return;
    end
    
    
    if tupoInHomeOri() and values.a403~="0" then--突破寮
      
      if (isColor( 646,  472, 0xd3bf87, 85) and isColor( 644,  460, 0xcbc0b4, 85)) then
        
      else
        toast("寮 1 已被攻破,跳过了",1)  
        mSleep(1200)  
        union1 = true;
      end
      
      if (isColor( 628,  756, 0xcbc0b4, 85) and isColor( 628,  774, 0xd2bc84, 85)) then
        
      else
        toast("寮 2 已被攻破,跳过了",1)  
        mSleep(1200)   
        union2 = true;
      end
      
      if (isColor( 634, 1054, 0xcbc0b4, 85) and isColor( 636, 1070, 0xd3be85, 85)) then
        
      else
        toast("寮 3 已被攻破,跳过了",1)  
        mSleep(1200)   
        union3 = true;
      end
      
    end --在这个界面下--上面的框 和叉叉  
    
    
    if tupoInHomeOri() and values.a403=="0" then--突破寮
      
      if  (isColor( 644,  460, 0xcbc0b4, 85)) then
        
      else
        toast("寮 1 已被攻破,跳过了",1)  
        mSleep(1200)  
        union1 = true;
      end
      
      if (isColor( 628,  756, 0xcbc0b4, 85))then
        
      else
        toast("寮 2 已被攻破,跳过了",1)  
        mSleep(1200)   
        union2 = true;
      end
      
      if (isColor( 634, 1054, 0xcbc0b4, 85)) then
        
      else
        toast("寮 3 已被攻破,跳过了",1)  
        mSleep(1200)   
        union3 = true;
      end
      
    end --在这个界面下--上面的框 和叉叉      
    
    if tansuoshouye() then
    else
      randomTap(986, 1282,2)--激活一下
      mSleep(500);   
    end
    
    
    --(第一个寮)
    if (isColor( 644,  460, 0xcbc0b4, 85)) and union1==false then
      union1 = rununion1(breakType)
    end
    
    --(第二个寮)
    if (isColor( 628,  756, 0xcbc0b4, 85))  and union2==false and  union1 then
      union2 = rununion2(breakType)
    end 
    
    --(第三个寮)
    if (isColor( 634, 1054, 0xcbc0b4, 85)) and union3==false and union2 then
      union3 = rununion3(breakType)
    end
    
    
    if tansuoshouye() then
    else
      randomTap(986, 1282,2)--激活一下
      mSleep(500);   
    end
    
    
  end
  
  whileCount=0;--完成突破回到主页面
  while (true) do
    whileCount=whileCount+1;
    if whileCount>500 then --选择阴阳寮
      --在主页面    
      errorLoop()  
      dialog("回到探索主页出现错误,脚本退出", 0)
      lua_exit()    
    end 
    mSleep(500)
    noticeDown();
    if tansuoshouye() then
      break
    end
  end
  
end


---##################################################################################################  --第四页面结界突破




function seekPerson(...)
  local i,j;
  for i=0,2 do 
    for j=0,2 do 
      if (isColor( 715+(551*i),  373+(217*j), 0xcbbaa5, 85)) then
        return (715+(551*i)),(373+(217*j))
      end
    end
  end
  return -1,-1;
end

function seekPerson3(...)
  local i,j,x,y;
  local coun = 0;  
  for i=0,2 do 
    for j=0,2 do 
      if (isColor( 715+(551*i),  373+(217*j), 0xcbbaa5, 85)) then
      else
        coun =coun +1;
      end
    end
  end
  return coun
end


function breakthroughPerson(...)
  local x,y,x1,y1;  
  whileCount=0;
  while (true) do
    whileCount=whileCount+1;
    if whileCount>200 then --找位置
      --在主页面
      errorLoop()  
      dialog("请来到探索主页面,再运行脚本。【注意:辅助的首页设置Home键位置】", 0)
      lua_exit()    
    end
    invite();
    timeOut()--检查关闭时间
    mSleep(500)
    if tansuoshouye() then  
      randomTap(666, 1410,2) --点击结界突破
      mSleep(1500);
    else
      --  noticeDown() 
    end--点击结界突破
    
    if tupoInHome() then--突破首页
      break;
    end 
    
  end 
  
  while (true) do
    
    if tansuoshouye() then  
      randomTap(666, 1410,2) --点击结界突破
      mSleep(1500);
    end
    
    
    tupoCountNun = tupoCount()--检查卷的数量
    if tupoCountNun== 1 then 
      return;
    end
    x,y = seekPerson()
    if x ~= -1 and y ~= -1 then --找到可以挑战的
      touchDown(1,x,  y ); --点击结界突破
      mSleep(50);
      touchUp(1,x,  y );
      mSleep(1000);
    else--否则刷新按钮
      if (isColor(1602, 1060, 0xf3b25e, 85)) then--刷新按钮
        randomTap(1680, 1058,5)--按刷新按钮
        mSleep(1500)
      else
        if tupoInHome() then
          toast("等待刷新,1分钟后自动继续,本框1分钟后自动关闭", 60)
          mSleep(60000)
        end
      end
    end
    
    
    if (isColor( 716,  866, 0xdf6851, 85) and isColor(1328,  902, 0xf3b25e, 85) and isColor(1038,  624, 0xcbb59c, 85) and isColor(1012,  926, 0xcbb59c, 85)) then  
      randomTap(1216,  876,2)
      mSleep(1500);
    end--弹出了确定框
    
    x1,y1 = findMultiColorInRegionFuzzy( 0xf3b25e, "-80|-34|0xf3b25e,-85|28|0xf4b35e,-170|4|0xcbb59c", 90, 174, 277, 1866, 1141)
    --攻击
    if x1 ~= -1 and y1 ~= -1 then  
      touchDown(1,x1,  y1); --点击结界突破
      mSleep(50);
      touchUp(1,x1,  y1);
      mSleep(1500);
    end
    
    
    if zhandouhuamian() then --进入战斗
      while (true) do
        noticeDown();
        ready6();
        fightManual6();
        if zhandouhuamian() then
          mSleep(math.random(100,300))
        end  
        x2,y2 = windrum2_6()
        --胜利--windrum2_6
        if x2 ~= -1 and y2 ~= -1 then 
          while (true) do   
            if tupoInHome() or tansuoshouye() then
              break; --弹出选择框就结束
            else
              randomTap(986, 1282,2)--激活一下
              mSleep(1500); 
            end
          end
          
        end     
        x3,y3 = windrum3_6()
        --失败--windrum3_6
        if x3 ~= -1 and y3 ~= -1 then 
          while (true) do   
            if tupoInHome() or tansuoshouye() then
              break; --弹出选择框就结束
            else
              randomTap(986, 1282,2)--激活一下
              mSleep(1500); 
            end
          end
        end 
        
        
        if tupoInHome() or tansuoshouye() then
          break;
        end --弹出选择框就结束
        
      end--if
    end--while
  end   
end




function breakthroughPerson3(...)
  local x,y,x1,y1;  
  whileCount=0;
  while (true) do
    whileCount=whileCount+1;
    if whileCount>200 then --找位置
      --在主页面
      errorLoop()  
      dialog("请来到探索主页面,再运行脚本。【注意:辅助的首页设置Home键位置】", 0)
      lua_exit()    
    end
    invite();
    timeOut()--检查关闭时间
    mSleep(500)
    if tansuoshouye() then  
      randomTap(666, 1410,2) --点击结界突破
      mSleep(1500);
    else
      --  noticeDown() 
    end--点击结界突破
    
    if tupoInHome() then--突破首页
      break;
    end 
    
  end 
  
  while (true) do
    
    if tansuoshouye() then  
      randomTap(666, 1410,2) --点击结界突破
      mSleep(1500);
    end
    
    
    tupoCountNun = tupoCount()--检查卷的数量
    if tupoCountNun== 1 then 
      return;
    end
    
    
    if tupoInHome() then
      if seekPerson3() < 3 then
        
        x,y =seekPerson3Click();
        if x ~= -1 and y ~= -1 then --找到可以挑战的
          randomTap(x,y,2); 
          mSleep(1000);
        else
          if (isColor(1602, 1060, 0xf3b25e, 85)) then--刷新按钮
            randomTap(1680, 1058,5)--按刷新按钮
            mSleep(1500)
          end
        end  
        
      else--否则刷新按钮
        if (isColor(1602, 1060, 0xf3b25e, 85)) then--刷新按钮
          randomTap(1680, 1058,5)--按刷新按钮
          mSleep(1500)
        else
          if tupoInHome() then
            toast("等待刷新,1分钟后自动继续,本框1分钟后自动关闭", 60)
            mSleep(60000)
          end
        end
      end
    end
    
    if (isColor( 716,  866, 0xdf6851, 85) and isColor(1328,  902, 0xf3b25e, 85) and isColor(1038,  624, 0xcbb59c, 85) and isColor(1012,  926, 0xcbb59c, 85)) then  
      randomTap(1216,  876,2)
      mSleep(1500);
    end--弹出了确定框
    
    x1,y1 = findMultiColorInRegionFuzzy( 0xf3b25e, "-80|-34|0xf3b25e,-85|28|0xf4b35e,-170|4|0xcbb59c", 90, 174, 277, 1866, 1141)
    --攻击
    if x1 ~= -1 and y1 ~= -1 then  
      touchDown(1,x1,  y1); --点击结界突破
      mSleep(50);
      touchUp(1,x1,  y1);
      mSleep(1500);
    end
    
    
    if zhandouhuamian() then --进入战斗
      while (true) do
        noticeDown();
        ready6();
        fightManual6();
        if zhandouhuamian() then
          mSleep(math.random(100,300))
        end  
        x2,y2 = windrum2_6()
        --胜利--windrum2_6
        if x2 ~= -1 and y2 ~= -1 then 
          while (true) do   
            if tupoInHome() or tansuoshouye() then
              break; --弹出选择框就结束
            else
              randomTap(986, 1282,2)--激活一下
              mSleep(1500); 
            end
          end
          
        end     
        x3,y3 = windrum3_6()
        --失败--windrum3_6
        if x3 ~= -1 and y3 ~= -1 then 
          while (true) do   
            if tupoInHome() or tansuoshouye() then
              break; --弹出选择框就结束
            else
              randomTap(986, 1282,2)--激活一下
              mSleep(1500); 
            end
          end
        end 
        
        
        if tupoInHome() or tansuoshouye() then
          break;
        end --弹出选择框就结束
        
      end--if
    end--while
  end   
end


function F突破结束(...)
  -- body
end

---##################################################################################################  --第结界突破


---##################################################################################################  --觉醒御魂当队长
function F觉醒御魂开始(...)
  -- body
end



function simpleyuhun(...)
  local temp  = 1;
  
  while (true) do
    if temp == 1 then
      temp = simpleyuhunClass1();
    end
    mSleep(500)
    if temp == 2 then
      temp = simpleyuhunClass2();
    end
    mSleep(500)
    if temp == 3 then
      temp = simpleyuhunClass3();
    end
    mSleep(500)
    if temp == 4 then
      temp = simpleyuhunClass4();
    end 
    mSleep(500)
  end
end




function SimpleJXCL(...)
  local temp  = 1;
  
  while (true) do
    if temp == 1 then
      temp = SimpleJXCLClass1();
    end
    mSleep(500)
    if temp == 2 then
      temp = SimpleJXCLClass2();
    end
    mSleep(500)
    if temp == 3 then
      temp = SimpleJXCLClass3();
    end
    mSleep(500)
    if temp == 4 then
      temp = SimpleJXCLClass4();
    end 
    mSleep(500)
  end   
  
end



function waitingPlayer(...)
    local x,y,x1,y1,x2,y2;
        
    if values.a061 == "0" then--公开组队

    else
        if (isColor(1132,  919, 0xf4eaae, 85) and isColor(1183,  926, 0xddc16b, 85) and isColor(1222,  992, 0xa29b93, 85)) then--第一个位置--邀请按钮
            randomTap(1006,  777,2)--p
            mSleep(1500)
        end
        
        if (isColor( 718, 1111, 0xdf6851, 85) and isColor(1022, 1116, 0xcbb59c, 85) and isColor(1161, 1115, 0xf3b25e, 85) and isColor(1375,  410, 0x9f876d, 85)) then--p
            --邀请好友界面
            x,y = findMultiColorInRegionFuzzy( 0xd4cdc5, "12|-1|0xffd910,106|-5|0xffcf11", 90, 552, 458, 1494, 1057)
             if x ~= -1 and y ~= -1 then        --如果在指定区域找到某图片符合条件
                randomTap(x,y,2)
                mSleep(1200)
                randomTap(1238, 1108,2)--点击邀请
                mSleep(1500)
            else
                toast("没有找到最近组队好友,请手动邀请一次",1)
                mSleep(2500)
                randomTap(1238, 1108,2)--点击邀请
                mSleep(1500)
            end 
        end     
        
        
        if values.a052 == "0" then--三个玩家
            if (isColor(1671,  920, 0xf4eaae, 85) and isColor(1725,  926, 0xddc16b, 85) and isColor(1755,  994, 0xa29b93, 85)) then--第二个位置--邀请按钮
                randomTap(1556,  779,2)--p
                mSleep(1500)
            end
            if (isColor( 718, 1111, 0xdf6851, 85) and isColor(1022, 1116, 0xcbb59c, 85) and isColor(1161, 1115, 0xf3b25e, 85) and isColor(1375,  410, 0x9f876d, 85)) then--p
                --邀请好友界面
             x1,y1 = findMultiColorInRegionFuzzy( 0xd4cdc5, "12|-1|0xffd910,106|-5|0xffcf11", 90, 552, 458, 1494, 1057)
             if x1 ~= -1 and y1 ~= -1 then        --如果在指定区域找到某图片符合条件
                randomTap(x1,y1,2)
                mSleep(1200)

            else
                toast("没有找到最近组队好友,请手动邀请一次",1)
                mSleep(2500)
            end
            
            x2,y2 = findMultiColorInRegionFuzzy( 0xd4cdc5, "12|-1|0xffd910,106|-5|0xffcf11", 90, 552, 458, 1494, 1057)
             if x2 ~= -1 and y2 ~= -1 then        --如果在指定区域找到某图片符合条件
                randomTap(x2,y2,2)
                mSleep(1200)
                randomTap(1238, 1108,2)--点击邀请
                mSleep(1500)
            else
                toast("没有找到最近组队好友,请手动邀请一次",1)
                mSleep(2500)
                randomTap(1238, 1108,2)--点击邀请
                mSleep(1500)
            end     
        end                 
        
            
        end
        
        if (isColor( 488, 1158, 0x9e4939, 85) and isColor( 532, 1158, 0x8d857f, 85)) then
          randomTap( 830, 1256,2)
          mSleep(500)
        end--点到了好友资料
    
        toast("等待队员加入,三秒后重新邀请",3)
        mSleep(5000)

        

        
    end
    
    
    if values.a052 == "0" then--p
      
      if (isColor(1738,  568, 0xcec6bc, 85) and isColor(1556, 1134, 0xf3b25e, 85)) then
        randomTap(1668, 1150,5)
        mSleep(1500);
      end--三个玩家都齐了 那么开始
    else
      if (isColor(1184,  564, 0xcec6bc, 85) and isColor(1558, 1136, 0xf3b25e, 85)) then
        randomTap(1668, 1150,5)
        mSleep(1500);
      end--两个玩家都齐了 那么开始
    end

end


function isOpenInvitation(...)
    if values.a061 == "0" then--公开组队
        if (isColor( 488, 1020, 0x402f11, 85) and isColor(1326, 1118, 0xf3b25e, 85)) then
          randomTap(494, 1016,2)
          mSleep(1000);
        end--所有人可见;
            
        
        if (isColor( 490, 1012, 0x4b5de9, 85) and isColor(1326, 1116, 0xf3b25e, 85)) then--创建--如果超时会回到这个界面
          
          if dianjizutuiBtn then
            toast("准备点击组队,如果要设置等级范围抓紧,停留5秒!!",5)
            mSleep(6500)
            dianjizutuiBtn = false;
          end
          randomTap(1400, 1134,3) 
          mSleep(1000);         
        end--创建--如果超时会回到这个界面
        
        
    else
        if (isColor(1218, 1022, 0x402f11, 85) and isColor(1331, 1134, 0xf3b25e, 85)) then
          randomTap(1218, 1022,2)
          mSleep(1000);
        end--所有人可见;
            
        
        if (isColor(1215, 1011, 0x485be2, 85) and isColor(1328, 1138, 0xf3b25e, 85)) then--创建--如果超时会回到这个界面
          
          if dianjizutuiBtn then
            toast("准备点击组队,如果要设置等级范围抓紧,停留5秒!!",5)
            mSleep(6500)
            dianjizutuiBtn = false;
          end
          randomTap(1400, 1134,3) 
          mSleep(1000);         
        end--创建--如果超时会回到这个界面        

    end
end

---##################################################################################################  --第五页面御魂队长
local countMis = 0;
function simpleyuhunClass1(...)
  timeOut()--检查关闭时间
  toast("步骤1,选择层数",1)
  mSleep(1000)
  dianjizutuiBtn = true;
  local currentClass = values.cb052;;
  
  whileCount=0;
  while (true) do
    whileCount=whileCount+1;
    invite()
    if whileCount>=100 then
      dialog("请到探索页面再运行脚本。【注意:辅助的首页设置Home键位置】", 0)
      lua_exit();   
    end
    --点击yuhun-
    if tansuoshouye() then--ipad
      randomTap(322, 1400,2)--IPAD御魂按钮
      mSleep(1000)
    end--选御魂
    
    if (isColor( 106, 1084, 0xffd621, 85) and isColor(1938, 1086, 0xffd821, 85) and isColor(2022,  430, 0xd273b9, 85)) then--ipad
      randomTap(646,  520,2)
      mSleep(1000)
    end--选左边
    
    if (isColor( 106, 1084, 0xffd621, 85) and isColor(1938, 1086, 0xffd821, 85) and isColor(2022,  430, 0xd273b9, 85)) then--ipad
      randomTap(646,  520,2)
      mSleep(1000)
    end--选左边-暗
    
    
    if yuhunjuexingTZ() then
      break
    end
    
  end
  
  
  
  --while (true) do--- 真正的刷副本在这里进行
  
  if yuhunjuexingTZ() then
    
    if countMis<2 then
      juexingMissoin[currentClass-0]();
      countMis = countMis+1;--只执行两次 后面就开始直接打了
    end
    
  end   
  
  return 2;--组队到进入游戏
  
  
end



function simpleyuhunClass2(...)--组队到进入游戏
  toast("步骤2,发起组队",1)
  mSleep(1000)
  while (true) do
    invite()
    
    if yuhunjuexingTZ() then
      randomTap(1036,  985,5)
      mSleep(1500);
    end --组队
    
    
    if zuduiCreatQu() then
      randomTap(1672, 1297,5)--p
      mSleep(1000);
    end --创建队伍--按钮
    
    isOpenInvitation()--是否公开邀请
    
    
    if zuduiLoading() then
      break
    end--来到等待战斗画面
    
  end
  
  return 3;--执行等待画面到进入战斗
end

function simpleyuhunClass3(...)--执行等待画面到进入战斗
  toast("步骤3,等待进入战斗",1)
  mSleep(1000)
  while (true) do
    invite()
    if zuduiCreatType() then--超时回来了这个页面
      break;
    end
    
    waitingPlayer()--邀请组员
    
    if zhandouhuamian() then
      break;
    end--进到战斗画面了
  end
  
  
  if zuduiCreatType() then--超时回来了这个页面
    return 2;
  end
  
  if zhandouhuamian() then
    return 4;--来到了战斗画面
  end--进到战斗画面了
  
end



function simpleyuhunClass4(inviteType)
  toast("步骤4,进入战斗",1)
  local markzudi = false;
  while (true) do
    invite();
    ready6()
    fightManual6()
    if zhandouhuamian() then   
      assFight()--集火
      mSleep(math.random(100,200))
    end    
    x2,y2 = windrum2_6()
    --胜利--windrum2_6
    if x2 ~= -1 and y2 ~= -1 then 
      while (true) do   
        if zuduiBox() then
            markzudi = true;
          break; --弹出选择框就结束
        else
          windrumClick()
        end
      end
      
    end     
    
    
    
    
    x3,y3 = windrum3_6()
    --失败--windrum3_6
    if x3 ~= -1 and y3 ~= -1 then 
      while (true) do   
        if zuduiBox() then
            markzudi = true;
          break; --弹出选择框就结束
        else
          windrumClick()
        end
      end
    end 
    
    
    if inviteType == 2 then 
      zuduiJujue(); 
      mSleep(3500)
      if tansuoshouye() then
        return;
      end --弹出选择框就结束    
    else
      
     if zuduiBox() and markzudi then
        break;
      end --弹出选择框就结束    
      
    end
    
  end 
  
  while (true) do
    invite();
    if zuduiBox() then
      zuduiJieshou();
      mSleep(50)
      toast("重新组队,等待组队满了才开始,超时则回到步骤1",3)
      mSleep(3500);
    end --弹出选择框就结束
    
    if zuduiLoading() then
      break
    end--来到等待战斗画面
    
    
  end
  
  while (true) do
   invite();
   waitingPlayer()--邀请组员
    
    if zhandouhuamian() then
      break;
    end--战斗画面
    
    if tansuoshouye() then
      break;
    end--超时回到首页;

  end 
  
  
  if zhandouhuamian() then
    return 4;--来到了战斗画面
  end--进到战斗画面了
  
  if tansuoshouye() then
    return 1;--首页重新开始
  end--超时回到首页;
end

---##################################################################################################  --第五页面御魂队长



---##################################################################################################  --第五页面觉醒队长
local countMisJXCLC = 0;
function SimpleJXCLClass1(...)
  timeOut()--检查关闭时间
  dianjizutuiBtn = true;
  local currentClass = values.cb052;
  local awakeType =  "业火轮";  --业火轮,风转符,水灵鲤,天雷鼓
  
  if values.a051=="0" then
    awakeType = "业火轮";
  elseif values.a051=="1" then
    awakeType = "风转符" ;
  elseif values.a051=="2" then
    awakeType = "水灵鲤" ;
  elseif values.a051=="3" then
    awakeType = "天雷鼓";
  else
  end
  
  
  toast("正在查找"..awakeType,1)
  mSleep(1000)
  
  
  whileCount=0;
  while (true) do
    whileCount=whileCount+1;
    invite()
    if whileCount>=100 then
      dialog("请到探索页面再运行脚本。【注意:辅助的首页设置Home键位置】", 0)
      lua_exit();   
    end
    if tansuoshouye() then
      randomTap(150, 1408,1)
      mSleep(2000)
    end
    
    if (isColor( 426, 1156, 0x8b392c, 85) and isColor( 860, 1150, 0x398e7c, 85) and isColor(1290, 1152, 0x4383a6, 85)) then
      break
    end
    
  end
  
  mSleep(100)
  
  while (true) do
    
    if awakeType == "风转符" then
      if (isColor( 860, 1154, 0x398e7c, 85)) then
        randomTap(860, 1154,2)
        mSleep(1000);
      end
    end
    if awakeType == "业火轮" then
      if (isColor( 428, 1152, 0x8b3a2c, 85)) then
        randomTap(428, 1152,2)
        mSleep(1000);
      end
    end
    if awakeType == "水灵鲤" then
      if (isColor(1284, 1156, 0x4282a4, 85)) then
        randomTap(1284, 1156,2)
        mSleep(1000);
      end
    end 
    if awakeType == "天雷鼓" then
      if (isColor(1718, 1154, 0x6d4c93, 85)) then
        randomTap(1718, 1154,2)
        mSleep(1000);
      end
    end 
    
    if yuhunjuexingTZ() then
      break;
    end--来到页面了
    
  end
  
  
  --while (true) do--- 真正的刷副本在这里进行
  
  if yuhunjuexingTZ() then
    if countMisJXCLC<2 then
      juexingMissoin[currentClass-0]();
      countMisJXCLC =countMisJXCLC +1;--只执行两次 后面就开始直接打了
    end
  end   
  --end
  
  return 2;--组队到进入游戏
  
end


function SimpleJXCLClass2(...)--组队到进入游戏
  toast("步骤2,发起组队",1)
  mSleep(1000)
  while (true) do
    invite()
    
    if yuhunjuexingTZ() then
      randomTap(1036,  985,5)
      mSleep(1500);
    end --组队
    
    
    if zuduiCreatQu() then
      randomTap(1672, 1297,5)--p
      mSleep(1000);
    end --创建队伍--按钮
    
    isOpenInvitation()--是否公开邀请
    
    
    if zuduiLoading() then
      break
    end--来到等待战斗画面
    
  end
  
  return 3;--执行等待画面到进入战斗
end

function SimpleJXCLClass3(...)--执行等待画面到进入战斗
  toast("步骤3,等待进入战斗",1)
  mSleep(1000)
  while (true) do
    invite()
    if zuduiCreatType() then--超时回来了这个页面
      break;
    end
    
    waitingPlayer()--邀请组员
    
    if zhandouhuamian() then
      break;
    end--进到战斗画面了
  end
  
  
  if zuduiCreatType() then--超时回来了这个页面
    return 2;
  end
  
  if zhandouhuamian() then
    return 4;--来到了战斗画面
  end--进到战斗画面了
  
end



function SimpleJXCLClass4(inviteType)
  toast("步骤4,进入战斗",1)
  local markzudi = false;
  while (true) do
    invite();
    ready6();
    fightManual6();
    
    x2,y2 = windrum2_6()
    --胜利--windrum2_6
    if x2 ~= -1 and y2 ~= -1 then 
      while (true) do   
        if zuduiBox() then
            markzudi = true;
          break; --弹出选择框就结束
        else
          windrumClick();
        end
      end
      
    end     
    
    
    
    x3,y3 = windrum3_6()
    --失败--windrum3_6
    if x3 ~= -1 and y3 ~= -1 then 
      while (true) do   
        if zuduiBox() then
            markzudi = true;
          break; --弹出选择框就结束
        else
          windrumClick();
        end
      end
    end 
    
    
    if inviteType == 2 then 
      zuduiJujue(); 
      mSleep(3500)
      if tansuoshouye() then
        return;
      end --弹出选择框就结束    
    else
      
      if zuduiBox() and markzudi then
        break;
      end --弹出选择框就结束    
      
    end
    
  end 
  
  while (true) do
    invite();
    if zuduiBox() then
      zuduiJieshou();
      mSleep(50)
      toast("重新组队,等待组队满了才开始,超时则回到步骤1",3)
      mSleep(3500);
    end --弹出选择框就结束
    
    if zuduiLoading() then
      break
    end--来到等待战斗画面
    
    
  end
  
  while (true) do
   invite();
   waitingPlayer()--邀请组员
    
    if zhandouhuamian() then
      break;
    end--战斗画面
    
    if tansuoshouye() then
      break;
    end--超时回到首页;

  end 
  
  
  if zhandouhuamian() then
    return 4;--来到了战斗画面
  end--进到战斗画面了
  
  if tansuoshouye() then
    return 1;--首页重新开始
  end--超时回到首页;
end


---##################################################################################################  --第五页面觉醒队长




function F觉醒御魂结束(...)
  -- body
end


---##################################################################################################  --觉醒御魂当队长




---##################################################################################################  --独立功能大集合

function F独立功能大集合开始(...)
  -- body
end
function simplejuexingInStep(...)--觉醒御魂自动模式
  
  whileCount=0;
  while (true) do
    whileCount=whileCount+1;
    if whileCount>=20 then
      dialog("请到御魂、觉醒选好层数后,停留在有“挑战”按钮的页面再运行脚本。。【注意:辅助的首页设置Home键位置】", 0)
      lua_exit();           
    end
    
    if yuhunjuexingTZ() then
      break
    end
  end
  
  
  
  while (true) do
    
    if yuhunjuexingTZ() then
      randomTap(1524,  986,3)
      mSleep(2000);
    else --挑战
      
      noticeDown()
      if zhandouhuamian() then
        assFight()--集火
        mSleep(math.random(100,300))
      end   
      ready6();
      fightManual6();       
      x2,y2 = windrum2_6()
      --胜利--windrum2_6
      if x2 ~= -1 and y2 ~= -1 then 
        while (true) do 
          if yuhunjuexingTZ() then
            break;
          else
            windrumClick()
          end
        end
      end       
      
      x3,y3 = windrum3_6()
      --失败--windrum3_6
      if x3 ~= -1 and y3 ~= -1 then 
        while (true) do 
          if yuhunjuexingTZ() then
            break;
          else
            windrumClick()
          end
        end
      end   
      
      if values.a014 =="0" and values.a026 =="0" then--御魂,集火功能--旁边小怪
        if (isColor(  72, 1302, 0xa77333, 85) and isColor(  50, 1318, 0xd3ad6d, 85)) then--扭转--ipad
          touchDown(1,60, 1308); 
          mSleep(50);
          touchUp(1,60, 1308);
          mSleep(800);
        end 
        if zhandouhuamian() then
          randomTap( 534,  468,5)
          mSleep(50)
          randomTap( 1604,  482,5)
          mSleep(300)
        end
      end
      
      if values.a014 =="0" and values.a026 =="1" then--御魂,集火功能--中间大怪
        if (isColor(  72, 1302, 0xa77333, 85) and isColor(  50, 1318, 0xd3ad6d, 85)) then--扭转--ipad
          touchDown(1,60, 1308); 
          mSleep(50);
          touchUp(1,60, 1308);
          mSleep(800);
        end 
        if zhandouhuamian() then
          randomTap( 1052,  430,5)
          mSleep(300)
        end
      end
      
      
      
    end
  end
  
end






function simplejuexingInBoya(...)--源博雅模式
  
  
  whileCount=0;
  while (true) do
    whileCount=whileCount+1;
    if whileCount>=20 then
      dialog("请到御魂、觉醒选好层数后,停留在有“挑战”按钮的页面再运行脚本。。【注意:辅助的首页设置Home键位置】", 0)
      lua_exit();           
    end
    
    if yuhunjuexingTZ() then
      break
    end
  end
  
  
  
  
  while (true) do
    
    if yuhunjuexingTZ() then
      randomTap(1524,  986,3)
      mSleep(2000);
      otherguai = 0;
    else --挑战
      
      noticeDown()
      
    end
    
    otherguai = otherguai+1;
    
    
    
    if (isColor( 938,  676, 0xdac4ab, 85) and isColor(1028,  670, 0xd3b797, 85) and isColor(1136,  684, 0xdfc5a6, 85) and isColor(1122,  968, 0x9c190b, 85)) then
      --出现了回目
      otherguai=0;
      boyuanyaCount = 1;
    end 
    
    x4,y4 = findMultiColorInRegionFuzzy( 0xfceee6, "-25|9|0xe3dcd4,32|5|0xe3dcd4,-3|-26|0x6b2522,-30|-31|0x161517", 90, 1912, 1026, 2042, 1144)--IPAD
    
    --博雅备战图标
    if x4 ~= -1 and y4 ~= -1 then        --如果在指定区域找到某图片符合条件
      --toast("boyuanya",1)
      if boyuanyaCount == 3 then
        if (isColor(  72, 1302, 0xa77333, 85) and isColor(  50, 1318, 0xd3ad6d, 85)) then--扭转--ipad
          touchDown(1,60, 1308); 
          mSleep(50);
          touchUp(1,60, 1308);
          mSleep(1500);
        end 
        randomTap(534,  488,5)  --怪1
        mSleep(50);                 
        randomTap(1062,  376,5) --怪2
        mSleep(50);                 
        randomTap(1584,  494,5); --怪3
        mSleep(2000)
      else
        otherguai=0;
        boyuanyaIsCheck = true;
        boyuanyaCountTemp = boyabeizhan(boyuanyaCount);
        if boyuanyaCountTemp == boyuanyaCount then  
          if (isColor(  72, 1302, 0xa77333, 85) and isColor(  50, 1318, 0xd3ad6d, 85)) then--扭转--ipad
            touchDown(1,60, 1308); 
            mSleep(50);
            touchUp(1,60, 1308);
            mSleep(1500);
          end                               
          randomTap(534,  488,5)  --怪1
          mSleep(50);                   
          randomTap(1062,  376,5) --怪2
          mSleep(50);                   
          randomTap(1584,  494,5); --怪3
          mSleep(2000)
        else
          boyuanyaCount = boyuanyaCountTemp;
        end
      end
    end
    
    
    x5,y5 = findMultiColorInRegionFuzzy( 0xf4e1c9, "-28|-14|0xe3dcd4,43|-20|0xe3dcd4,19|-26|0xea6a65", 90, 1913, 1013, 2042, 1152)--ipad
    
    --兔子图标
    if x5 ~= -1 and y5 ~= -1 then        --如果在指定区域找到某图片符合条件
      otherguai=0;
      boyuanyaIsCheck = true;
      tuzibeizhan();
    else
      if otherguai >= 30 and boyuanyaIsCheck then --35次的话 可能是其他怪物;直接点击对面
        otherguai= 0;
        if (isColor(  72, 1302, 0xa77333, 85) and isColor(  50, 1318, 0xd3ad6d, 85)) then--扭转--ipad
          touchDown(1,60, 1308); 
          mSleep(50);
          touchUp(1,60, 1308);
          mSleep(1500); 
          randomTap(534,  488,5)  --怪1
          mSleep(50);                   
          randomTap(1062,  376,5) --怪2
          mSleep(50);                   
          randomTap(1584,  494,5); --怪3
          mSleep(2000) 
          
          boyuanyaIsCheck= false;
        else                    
          randomTap(534,  488,5)  --怪1
          mSleep(50);                   
          randomTap(1062,  376,5) --怪2
          mSleep(50);                   
          randomTap(1584,  494,5); --怪3
          mSleep(2000)
          
          boyuanyaIsCheck= false;
        end
        otherguai = 0;
      end
    end
    
    
    
    x6,y6 =  findMultiColorInRegionFuzzy( 0xe6dfdc, "-39|18|0xe3dcd4,42|18|0xe3dcd4,37|-1|0x15f6f7", 90, 1914, 1023, 2045, 1139)--IPAD
    
    --打火机图标
    if x6 ~= -1 and y6 ~= -1 then        --如果在指定区域找到某图片符合条件
      otherguai=0;
      boyuanyaIsCheck = true;
      dahuojizhandou();
    end
    
    
    
    if (isColor( 938,  676, 0xdac4ab, 85) and isColor(1028,  670, 0xd3b797, 85) and isColor(1136,  684, 0xdfc5a6, 85) and isColor(1122,  968, 0x9c190b, 85)) then
      --出现了回目
      otherguai=0;
      boyuanyaCount = 1;
    end 
    
    
    
    x1,y1 = findMultiColorInRegionFuzzy( 0xfff1cb, "60|6|0xfff2ce,122|170|0x9f1f0d,-28|-2|0xfff4d3", 90, 1696, 1126, 2028, 1462)--ipad
    --ready6
    if x1 ~= -1 and y1 ~= -1 then        --如果在指定区域找到某图片符合条件
      touchDown(1,x1,y1); 
      mSleep(50);
      touchUp(1,x1,y1); 
      mSleep(1000);
      x1=-1;
      y1=-1;
      otherguai=0;
    end
    
    
    
    x,y = findMultiColorInRegionFuzzy( 0xf2edda, "0|-13|0xf8f3e0,17|-15|0xe9e5d2,3|-22|0xf4eedc", 90, 42, 1399, 144, 1491)--ipad
    --fightManual6
    if x ~= -1 and y ~= -1 then        --如果在指定区域找到某图片符合条件
      
    else                    
      randomTap(88, 1441,2)--换成手动
      mSleep(1500)
    end 
    
    
    
    x2,y2 = windrum2_6()
    --胜利--windrum2_6
    if x2 ~= -1 and y2 ~= -1 then 
      while (true) do   
        if yuhunjuexingTZ() then 
          break;
        else
          windrumClick()
        end
      end
      
    end     
    
    x3,y3 = windrum3_6()
    --失败--windrum3_6
    if x3 ~= -1 and y3 ~= -1 then 
      while (true) do   
        if yuhunjuexingTZ() then 
          break;
        else
          windrumClick()
        end
      end
    end     
    
    
    
    if otherguai>60 then
      boyuanyaIsCheck = true;
    end
    
  end 
  
end







function F独立功能大集合结束(...)
  -- body
end
---##################################################################################################  --独立功能大集合




---##################################################################################################  --黑科技兔子打火机
function F黑科技兔子打火机开始(...)
  -- body
end


function boyabeizhan(boyuanyaCount)
  
  while (true) do--换成手动
    x,y = findMultiColorInRegionFuzzy( 0xf2edda, "0|-13|0xf8f3e0,17|-15|0xe9e5d2,3|-22|0xf4eedc", 90, 42, 1399, 144, 1491)--ipad
    --fightManual6
    if x ~= -1 and y ~= -1 then        --如果在指定区域找到某图片符合条件
      mSleep(2000);
      break;
    else                    
      randomTap(88, 1441,2)--换成手动
      mSleep(1500)
    end 
  end
  
  
  
  if boyuanyaCount ==1 then--影分身
    --          toast("源博雅放影分身,如果没成功,下次继续放",1)
    --          mSleep(1200);
    
    whileCount=0;
    while (true) do
      whileCount=whileCount+1;
      if whileCount>=20 then
        break;
      end--选择影子
      x,y = findMultiColorInRegionFuzzy( 0x2b0605, "52|12|0x4a1a15,48|-54|0x450e0a", 90, 1474, 1356, 2038, 1530)
      if x ~= -1 and y ~= -1 then        --如果在指定区域找到某图片符合条件
        mSleep(100);                    
        touchDown(1,x,y); --选择影子
        mSleep(30);
        touchUp(1,x,y);  
        mSleep(500); 
      end   
      x1,y1 = findMultiColorInRegionFuzzy( 0x2f0504, "58|2|0x4b1c18,28|-96|0xbfeff8", 90, 1484, 1364, 2040, 1530)
      if x1 ~= -1 and y1 ~= -1 then        --如果在指定区域找到某图片符合条件
        break
      end   
      
    end
    
    whileCount=0;
    while (true) do
      whileCount=whileCount+1;
      if whileCount>=25 then
        break;
      end--影子技能的释放;
      if (isColor(  72, 1302, 0xa77333, 85) and isColor(  50, 1318, 0xd3ad6d, 85)) then--扭转--ipad
        touchDown(1,60, 1308); 
        mSleep(50);
        touchUp(1,60, 1308);
        mSleep(1500); 
      else
        randomTap(1050,  720,2) --点击放影子
        mSleep(50)
        randomTap(1072,  646,5) --点击放影子
        mSleep(4000);
        return 2;
      end
      
      x6,y6 = findMultiColorInRegionFuzzy( 0xfceee6, "-25|9|0xe3dcd4,32|5|0xe3dcd4,-3|-26|0x6b2522,-30|-31|0x161517", 90, 1912, 1026, 2042, 1144)--IPAD
      if x6 == -1 and y6 == -1 then        --如果在指定区域找到某图片符合条件
        --右边渊博的头像
        if whileCount>=3 then
          return 1;
        end
      end   
      
    end
    
    
    
    
    return 1;
  end
  
  
  
  
  if boyuanyaCount ==2 then--'诛邪箭' 
    --          toast("源博雅放诛邪箭,如果没成功,下次继续放",1)
    --          mSleep(1200)            
    
    whileCount=0;
    while (true) do
      whileCount=whileCount+1;
      if whileCount>=10 then
        break;
      end--选择三箭
      x,y = findMultiColorInRegionFuzzy( 0x0b0603, "62|-2|0x000000,58|52|0x080000", 90, 1474, 1356, 2038, 1530)
      if x ~= -1 and y ~= -1 then        --如果在指定区域找到某图片符合条件
        mSleep(100);                    
        touchDown(1,x,y); --选择三箭
        mSleep(30);
        touchUp(1,x,y);  
        mSleep(500); 
      end   
      x1,y1 = findMultiColorInRegionFuzzy( 0x0b0603, "62|-4|0x000000,58|50|0x0a0000,28|-58|0xc9f3f8", 90, 1484, 1364, 2040, 1530)
      if x1 ~= -1 and y1 ~= -1 then        --如果在指定区域找到某图片符合条件
        break
      end   
      
    end
    
    whileCount=0;
    while (true) do
      whileCount=whileCount+1;
      if whileCount>=25 then
        break;
      end--三件箭技能的释放;
      if (isColor(  72, 1302, 0xa77333, 85) and isColor(  50, 1318, 0xd3ad6d, 85)) then--扭转--ipad
        touchDown(1,60, 1308); 
        mSleep(50);
        touchUp(1,60, 1308);
        mSleep(1500); 
        randomTap(534,  488,5)  --怪1
        mSleep(50);                 
        randomTap(1062,  376,5) --怪2
        mSleep(50);                 
        randomTap(1061,  530,5) --怪2.2
        mSleep(50); 
        randomTap(1584,  494,5); --怪3
        mSleep(4000);
        break
      else
        randomTap(534,  488,5)  --怪1
        mSleep(50);                 
        randomTap(1062,  376,5) --怪2
        mSleep(50);                 
        randomTap(1061,  530,5) --怪2.2
        mSleep(50); 
        randomTap(1584,  494,5); --怪3
        mSleep(4000);
        break;
      end
      
      x6,y6 = findMultiColorInRegionFuzzy( 0x161316, "20|36|0xe3dcd4,56|40|0xe3dcd4,40|-14|0x6a2320", 90, 2072, 688, 2192, 820)--6p
      if x6 == -1 and y6 == -1 then        --如果在指定区域找到某图片符合条件
        --右边渊博的头像
        if whileCount>=3 then
          return 2;
        end
      end   
      
    end     
    return 3;
  end
  
  
  
  
end



function tuzibeizhan(...)
  
  markJinengTZ = "1";--技能是否冻结,1是冻结
  while (true) do--换成手动
    x,y = findMultiColorInRegionFuzzy( 0xf2edda, "0|-13|0xf8f3e0,17|-15|0xe9e5d2,3|-22|0xf4eedc", 90, 42, 1399, 144, 1491)--ipad
    --fightManual6
    if x ~= -1 and y ~= -1 then        --如果在指定区域找到某图片符合条件
      mSleep(1000);
      break;
    else
      randomTap(88, 1441,2)--换成手动
      mSleep(1500)
    end 
  end
  
  --找兔子图标
  
  whileCount=0;
  while (true) do
    whileCount = whileCount +1;
    if whileCount > 20 then
      break;
    end-- body
    x,y  =  findMultiColorInRegionFuzzy( 0x87be27, "-38|16|0x0d0c14,58|22|0x0c0b12", 90, 1485, 1362, 2036, 1526)--p
    if x ~= -1 and y ~= -1 then        --如果在指定区域找到某图片符合条件
      markJinengTZ = "2";--技能是否冻结
      mSleep(100);                  
      touchDown(1,x,y); --点开兔子
      mSleep(30);
      touchUp(1,x,y);  
      mSleep(500);  
    end
    
    x1,y1 = findMultiColorInRegionFuzzy( 0x8bc228, "-38|15|0x0c0c13,57|22|0x0c0a12,6|-70|0xaee9f7", 90, 1484, 1353, 2026, 1526)--p
    if x1 ~= -1 and y1 ~= -1 then        --如果在指定区域找到某图片符合条件
      break
    end 
    
    
  end
  
  mSleep(500)
  
  whileCount=0;
  while (true) do
    whileCount=whileCount+1;
    if whileCount>=25 then
      break;
    end--兔子技能的释放;
    if (isColor(  72, 1302, 0xa77333, 85) and isColor(  50, 1318, 0xd3ad6d, 85)) then--扭转--ipad
      touchDown(1,60, 1308); 
      mSleep(50);
      touchUp(1,60, 1308);
      mSleep(1500); 
      
    else
      if markJinengTZ == "1" then --1是技能冻结
        randomTap(534,  488,5)  --怪1
        mSleep(50);                 
        randomTap(1062,  376,5) --怪2
        randomTap(1061,  530,5) --怪2.2
        mSleep(50); 
        mSleep(50);                 
        randomTap(1584,  494,5); --怪3
        
        mSleep(3000);
      else  
        randomTap(346,  906,5)   --点击自己1
        mSleep(50);                 
        randomTap(714,  908,5) -- --点击自己2
        mSleep(50);                 
        randomTap(1092,  868,5); -- --点击自己3
        mSleep(50);                 
        randomTap(1434,  850,5); -- --点击自己4 
        mSleep(50);                 
        randomTap(1794,  898,5); -- --点击自己4 
        mSleep(3000);
      end 
      
      
      
      
      
      break;
      
    end
    
  end
  
  
end

function dahuojizhandou(...)
  
  markJinengDHJ = "1";--技能是否冻结,1是冻结
  while (true) do--换成手动
    x,y = findMultiColorInRegionFuzzy( 0xf2edda, "0|-13|0xf8f3e0,17|-15|0xe9e5d2,3|-22|0xf4eedc", 90, 42, 1399, 144, 1491)--ipad
    --fightManual6
    if x ~= -1 and y ~= -1 then        --如果在指定区域找到某图片符合条件
      mSleep(1000);
      break;
    else
      randomTap(88, 1441,2)--换成手动
      mSleep(1500)
    end 
  end
  
  --找打火图标
  
  whileCount=0;
  while (true) do
    whileCount = whileCount +1;
    if whileCount > 3 then
      break;
    end-- body
    x,y = findMultiColorInRegionFuzzy( 0x00060b, "-28|5|0x001837,28|5|0x001837,15|13|0x16ffc9", 90, 1478, 1359, 2020, 1526)--p
    if x ~= -1 and y ~= -1 then        --如果在指定区域找到某图片符合条件
      markJinengDHJ = "2";--技能是否冻结                  
      touchDown(1,x,y); --点开打火图标
      mSleep(30);
      touchUp(1,x,y);  
      mSleep(800);  
    end
    
    x1,y1 = findMultiColorInRegionFuzzy( 0x00070c, "-30|4|0x001837,27|6|0x001837,12|13|0x17ffc8,-3|-61|0xaee9f7", 90, 1493, 1351, 2034, 1525)--p
    if x1 ~= -1 and y1 ~= -1 then        --如果在指定区域找到某图片符合条件
      break
    end 
    
    x6,y6 =   findMultiColorInRegionFuzzy( 0xe6dfdc, "-39|18|0xe3dcd4,42|18|0xe3dcd4,37|-1|0x15f6f7", 90, 1914, 1023, 2045, 1139)--IPAD
    if x6 == -1 and y6 == -1 then        --如果在指定区域找到某图片符合条件
      --右边打火机
      if whileCount>=3 then
        return 2;--因为是被控制的,所以根本没放技能;
      end
    end     
  end
  
  
  
  whileCount=0;
  while (true) do
    whileCount=whileCount+1;
    if whileCount>=25 then
      break;
    end--兔子技能的释放;
    if (isColor(  72, 1302, 0xa77333, 85) and isColor(  50, 1318, 0xd3ad6d, 85)) then--扭转--ipad
      touchDown(1,60, 1308); 
      mSleep(50);
      touchUp(1,60, 1308);
      mSleep(1500); 
      
    else
      if markJinengDHJ == "1" then --1是技能冻结
        randomTap(534,  488,5)  --怪1
        mSleep(50);                 
        randomTap(1062,  376,5) --怪2
        mSleep(50);                 
        randomTap(1584,  494,5); --怪3
        
        mSleep(3000);
      else  
        randomTap(346,  906,5)   --点击自己1
        mSleep(50);                 
        randomTap(714,  908,5) -- --点击自己2
        mSleep(50);                 
        randomTap(1092,  868,5); -- --点击自己3
        mSleep(50);                 
        randomTap(1434,  850,5); -- --点击自己4 
        mSleep(50);                 
        randomTap(1794,  898,5); -- --点击自己4 
        mSleep(3000);
      end 
      
      break;
      
    end
    
  end
  
end




function F黑科技兔子打火机结束(...)
  -- body
end
---##################################################################################################  --黑科技兔子大件货机



---##################################################################################################  --业火原

function F业火原开始(...)
  -- body
end


function yehuoyuanFun(...)
  countCheck=0;--从其他页面来到主页
  while (true) do
    countCheck = countCheck +1;
    if countCheck > 50 then
      dialog("请来到游戏探索界面打开御魂后,停留在有“挑战”按钮的页面,然后执行脚本,卷用完了停止脚本。。【注意:辅助的首页设置Home键位置】", 0)
      lua_exit()
    end
    
    if yuhunjuexingTZ() then--在业火原主页面--挑战和叉叉
      break;
    end--直接来到了业火原-选到了业火原
    
    --点击yuhun-
    if tansuoshouye() then--ipad
      randomTap(322, 1400,2)--IPAD御魂按钮
      mSleep(1000)
    end--选御魂
    
    if (isColor( 106, 1084, 0xffd621, 85) and isColor(1938, 1086, 0xffd821, 85) and isColor(2022,  430, 0xd273b9, 85)) then--ipad
      randomTap(1518,  534,2)
      mSleep(1000)
    end--选右边
    
    if (isColor( 104, 1086, 0xb49817, 85) and isColor(1940, 1086, 0xb49817, 85) and isColor(2024,  428, 0x945183, 85)) then--ipad
      randomTap(1518,  534,2)
      mSleep(1000)
    end--选右边-暗
    
    
  end
  
  whileCount=0;
  while (true) do
    whileCount=whileCount+1;
    if whileCount>=4 then
      break;
    end--直到点击进到页面
    if yehuoyuanTpye =="tan" then--ipad
      randomTap( 622,  477,2)
      mSleep(200)   
    end
    
    if yehuoyuanTpye =="chen" then
      randomTap( 615,  634,2)
      mSleep(200)   
    end
    
    if yehuoyuanTpye =="chi" then
      randomTap(616,  789,2)
      mSleep(200)   
    end
  end 
  
  
  --这里开始战斗
  
  while (true) do
    invite()
    
    if yuhunjuexingTZ() then
      randomTap(1526,  984,2)
      mSleep(2000);
    end --挑战
    
    
    if yuhunjuexingTZ() then--在业火原主页面--挑战和叉叉
      
    else--不在这个页面 那就是战斗画面;
      if zhandouhuamian() then
        assFight()--集火
        mSleep(math.random(100,300))
      end   
      ready6()
      fightManual6()    
      x2,y2 = windrum2_6()
      --胜利--windrum2_6
      if x2 ~= -1 and y2 ~= -1 then 
        while (true) do 
          if yuhunjuexingTZ() then--在业火原主页面--挑战和叉叉
            break;
          else
            windrumClick()
          end
        end
        
      end       
      
      x3,y3 = windrum3_6()
      --失败--windrum3_6
      if x3 ~= -1 and y3 ~= -1 then 
        while (true) do 
          if yuhunjuexingTZ() then--在业火原主页面--挑战和叉叉
            break;
          else
            windrumClick()
          end
        end
      end   
      
      mSleep(3000)
      
    end 
    
    
  end
  
end




function yehuoyuanFBoya(...)--博雅
  countCheck=0;--从其他页面来到主页
  while (true) do
    countCheck = countCheck +1;
    if countCheck > 50 then
      dialog("请来到游戏探索界面打开御魂后,停留在有“挑战”按钮的页面,然后执行脚本,卷用完了停止脚本。【注意:辅助的首页设置Home键位置】", 0)
      lua_exit()
    end
    if yuhunjuexingTZ() then--在业火原主页面--挑战和叉叉
      break;
    end--直接来到了业火原-选到了业火原
    
    --点击yuhun-
    if tansuoshouye() then--ipad
      randomTap(322, 1400,2)--IPAD御魂按钮
      mSleep(1000)
    end--选御魂
    
    if (isColor( 106, 1084, 0xffd621, 85) and isColor(1938, 1086, 0xffd821, 85) and isColor(2022,  430, 0xd273b9, 85)) then--ipad
      randomTap(1518,  534,2)
      mSleep(1000)
    end--选右边
    
    if (isColor( 104, 1086, 0xb49817, 85) and isColor(1940, 1086, 0xb49817, 85) and isColor(2024,  428, 0x945183, 85)) then--ipad
      randomTap(1518,  534,2)
      mSleep(1000)
    end--选右边-暗
    
    
  end
  
  whileCount=0;
  while (true) do
    whileCount=whileCount+1;
    if whileCount>=4 then
      break;
    end--直到点击进到页面
    if yehuoyuanTpye =="tan" then--ipad
      randomTap( 622,  477,2)
      mSleep(200)   
    end
    
    if yehuoyuanTpye =="chen" then
      randomTap( 615,  634,2)
      mSleep(200)   
    end
    
    if yehuoyuanTpye =="chi" then
      randomTap(616,  789,2)
      mSleep(200)   
    end
  end 
  
  
  --这里开始战斗
  --这里开始战斗
  boyuanyaIsCheck = false;
  boyuanyaCount = 1;
  otherguai = 1;
  while (true) do
    invite()
    if yuhunjuexingTZ() then--在业火原主页面--挑战和叉叉
      
      boyuanyaCount = 1;
    end
    
    
    if yuhunjuexingTZ() then
      randomTap(1526,  984,2)--挑战按钮
      mSleep(1500);
      otherguai = 1;
    end--点击挑战按钮
    
    
    
    if  yuhunjuexingTZ() then--在业火原主页面--挑战和叉叉
      
    else--不在这个页面 那就是战斗画面;
      
      otherguai = otherguai+1;
      
      
      
      if (isColor( 938,  676, 0xdac4ab, 85) and isColor(1028,  670, 0xd3b797, 85) and isColor(1136,  684, 0xdfc5a6, 85) and isColor(1122,  968, 0x9c190b, 85)) then
        --出现了回目
        otherguai=0;
        boyuanyaCount = 1;
      end   
      
      x4,y4 = findMultiColorInRegionFuzzy( 0xfceee6, "-25|9|0xe3dcd4,32|5|0xe3dcd4,-3|-26|0x6b2522,-30|-31|0x161517", 90, 1912, 1026, 2042, 1144)--IPAD
      
      --博雅备战图标
      if x4 ~= -1 and y4 ~= -1 then        --如果在指定区域找到某图片符合条件
        --toast("boyuanya",1)
        if boyuanyaCount == 3 then
          if (isColor(  72, 1302, 0xa77333, 85) and isColor(  50, 1318, 0xd3ad6d, 85)) then--扭转--ipad
            touchDown(1,60, 1308); 
            mSleep(50);
            touchUp(1,60, 1308);
            mSleep(1500);
          end   
          randomTap(534,  488,5)  --怪1
          mSleep(50);                   
          randomTap(1062,  376,5) --怪2
          mSleep(50);           
          randomTap(1061,  530,5) --怪2.2
          mSleep(50);   
          randomTap(1584,  494,5); --怪3
          mSleep(2000)
        else
          otherguai=0;
          boyuanyaIsCheck = true;
          boyuanyaCountTemp = boyabeizhan(boyuanyaCount);
          if boyuanyaCountTemp == boyuanyaCount then    
            if (isColor(  72, 1302, 0xa77333, 85) and isColor(  50, 1318, 0xd3ad6d, 85)) then--扭转--ipad
              touchDown(1,60, 1308); 
              mSleep(50);
              touchUp(1,60, 1308);
              mSleep(1500);
            end                             
            randomTap(534,  488,5)  --怪1
            mSleep(50);                 
            randomTap(1062,  376,5) --怪2
            mSleep(50);         
            randomTap(1061,  530,5) --怪2.2
            mSleep(50); 
            randomTap(1584,  494,5); --怪3
            mSleep(2000)
          else
            boyuanyaCount = boyuanyaCountTemp;
          end
        end
      end
      
      
      x5,y5 = findMultiColorInRegionFuzzy( 0xf4e1c9, "-28|-14|0xe3dcd4,43|-20|0xe3dcd4,19|-26|0xea6a65", 90, 1913, 1013, 2042, 1152)--ipad
      
      --兔子图标
      if x5 ~= -1 and y5 ~= -1 then        --如果在指定区域找到某图片符合条件
        otherguai=0;
        boyuanyaIsCheck = true;
        tuzibeizhan();
      else
        if otherguai >= 30 and boyuanyaIsCheck then --35次的话 可能是其他怪物;直接点击对面
          otherguai= 0;
          if (isColor(  72, 1302, 0xa77333, 85) and isColor(  50, 1318, 0xd3ad6d, 85)) then--扭转--ipad
            touchDown(1,60, 1308); 
            mSleep(50);
            touchUp(1,60, 1308);
            mSleep(1500); 
            randomTap(534,  488,5)  --怪1
            mSleep(50);                 
            randomTap(1062,  376,5) --怪2
            mSleep(50);     
            randomTap(1061,  530,5) --怪2.2
            mSleep(50); 
            randomTap(1584,  494,5); --怪3
            mSleep(2000) 
            
            boyuanyaIsCheck= false;
          else                  
            randomTap(534,  488,5)  --怪1
            mSleep(50);                 
            randomTap(1062,  376,5) --怪2
            mSleep(50);         
            randomTap(1061,  530,5) --怪2.2
            mSleep(50); 
            randomTap(1584,  494,5); --怪3
            mSleep(2000)
            
            boyuanyaIsCheck= false;
          end
          otherguai = 0;
        end
      end
      
      
      
      x6,y6 =  findMultiColorInRegionFuzzy( 0xe6dfdc, "-39|18|0xe3dcd4,42|18|0xe3dcd4,37|-1|0x15f6f7", 90, 1914, 1023, 2045, 1139)--IPAD
      
      --打火机图标
      if x6 ~= -1 and y6 ~= -1 then        --如果在指定区域找到某图片符合条件
        otherguai=0;
        boyuanyaIsCheck = true;
        dahuojizhandou();
      end
      
      
      
      if (isColor( 938,  676, 0xdac4ab, 85) and isColor(1028,  670, 0xd3b797, 85) and isColor(1136,  684, 0xdfc5a6, 85) and isColor(1122,  968, 0x9c190b, 85)) then
        --出现了回目
        otherguai=0;
        boyuanyaCount = 1;
      end   
      
      
      
      x1,y1 = findMultiColorInRegionFuzzy( 0xfff1cb, "60|6|0xfff2ce,122|170|0x9f1f0d,-28|-2|0xfff4d3", 90, 1696, 1126, 2028, 1462)--ipad
      --ready6
      if x1 ~= -1 and y1 ~= -1 then        --如果在指定区域找到某图片符合条件
        touchDown(1,x1,y1); 
        mSleep(50);
        touchUp(1,x1,y1); 
        mSleep(1000);
        x1=-1;
        y1=-1;
        otherguai=0;
      end
      
      
      
      x,y = findMultiColorInRegionFuzzy( 0xf2edda, "0|-13|0xf8f3e0,17|-15|0xe9e5d2,3|-22|0xf4eedc", 90, 42, 1399, 144, 1491)--ipad
      --fightManual6
      if x ~= -1 and y ~= -1 then        --如果在指定区域找到某图片符合条件
        
      else                  
        randomTap(88, 1441,2)--换成手动
        mSleep(1500)
      end   
      
      
      
      x2,y2 = windrum2_6()
      --胜利--windrum2_6
      if x2 ~= -1 and y2 ~= -1 then 
        while (true) do 
          if yuhunjuexingTZ() then 
            break;
          else
            windrumClick()
          end
        end
        
      end       
      
      x3,y3 = windrum3_6()
      --失败--windrum3_6
      if x3 ~= -1 and y3 ~= -1 then 
        while (true) do 
          if yuhunjuexingTZ() then 
            break;
          else
            windrumClick()
          end
        end
      end       
      
      
      
      if otherguai>60 then
        boyuanyaIsCheck = true;
      end
      
    end 
    
  end
  
end

---##################################################################################################  --业火原--源博雅模式

function F业火原结束(...)
  -- body
end
---##################################################################################################  --业火原





---##################################################################################################  --第四页 一直接受任务
function F一直接受任务开始(...)
  -- body
end



function breakthroughInvitation(...)
  dialog("寮队员开启成功,【请注意辅助首页设置屏幕方向,不然会出错】。然后在【首页】或【探索主页】等待组队,按确定开始",5)
  mSleep(3500);
  
  while (true) do--一直接受活动;  
    inviteAccept();
    invite();
    mSleep(math.random(100,300))  
    if zhandouhuamian() then
      assFight();  
      mSleep(math.random(100,300))   
      ready6();
      fightManual6();
    end
    
    
    x2,y2 = windrum2_6();
    --胜利--windrum2_6
    if x2 ~= -1 and y2 ~= -1 then 
      while (true) do   
        if youxishouye() or tansuoshouye() or zhandouhuamian() then--首页
          break; 
        else
          homeIconClick();
        end
      end
    end     
    
    x3,y3 = windrum3_6();
    --失败--windrum3_6
    if x3 ~= -1 and y3 ~= -1 then 
      while (true) do   
        if youxishouye()or tansuoshouye()  or zhandouhuamian() then--首页
          break; 
        else
          homeIconClick();
        end
      end
    end 
    
  end
end


function acceptInvitation(...)
  
  dialog("接受任务模式开启成功,【请注意辅助首页设置屏幕方向,不然会出错】。快去找个队伍吧,战斗画面开始后,就不要碰屏幕了,然后在【首页】坐等别人组,按确定开始",5)
  mSleep(3500);
  
  while (true) do--一直接受活动;  
    inviteAccept();
    invite();
    mSleep(math.random(100,300))  
    if zhandouhuamian() then
      assFight();  
      mSleep(math.random(100,300))   
      ready6();
      fightManual6();
    end
    x2,y2 = windrum2_6();
    --胜利--windrum2_6
    if x2 ~= -1 and y2 ~= -1 then 
      while (true) do   
        if youxishouye() or tansuoshouye() or zhandouhuamian() then--首页
          break; 
        else
          homeIconClick();
        end
      end
    end     
    
    x3,y3 = windrum3_6();
    --失败--windrum3_6
    if x3 ~= -1 and y3 ~= -1 then 
      while (true) do   
        if youxishouye() or tansuoshouye() or zhandouhuamian() then--首页
          break; 
        else
          homeIconClick();
        end
      end
    end 
    
  end
end


function tansuoInvitation(...)--探索队员模式
  -- body
  dialog("探索队员开启成功,【请注意辅助首页设置屏幕方向,不然会出错】。请在探索主页开启,按确定开始",5)
  mSleep(3500);
  
  while (true) do--一直接受活动;  
    inviteAccept();
    invite();
    mSleep(math.random(100,300))  
    if zhandouhuamian() then
      assFight();  
      mSleep(math.random(100,300))   
      fightManual6();

    
    
      x1,y1 = findMultiColorInRegionFuzzy( 0xfff1cb, "60|6|0xfff2ce,122|170|0x9f1f0d,-28|-2|0xfff4d3", 90, 1696, 1126, 2028, 1462)--ipad
      --ready6
      if x1 ~= -1 and y1 ~= -1 then        --如果在指定区域找到某图片符合条件
        
        if GLchangeLeadNum >=2 or GLchangeViewer then
          GLchagahe()
          mSleep(1000);
          touchDown(1,x1,y1); 
          mSleep(50);
          touchUp(1,x1,y1); 
          mSleep(1000);
        else
          
          mSleep(1000);
          touchDown(1,x1,y1); 
          mSleep(50);
          touchUp(1,x1,y1); 
          mSleep(1000);
        end
        x1=-1;
        y1=-1;
      end   
      
    end
    x2, y2 = windrum2_6()
    --windrum2
    if x2 ~= -1 and y2 ~= -1 then        --如果在指定区域找到某图片符合条件
      
      GLchagaheSeek()
      
      while (true) do   
        if tansuoInHome() or zhandouhuamian() then--
          break; 
        else
          windrumClick();
        end
      end
    end     
    
    x3,y3 = windrum3_6();
    --失败--windrum3_6
    if x3 ~= -1 and y3 ~= -1 then 
      while (true) do   
        if tansuoInHome() or zhandouhuamian() then--
          break; 
        else
          windrumClick();
        end
      end
    end 
    
    
    if tansuoInHome() then 
      if (isColor(  44,  715, 0xf0eddb, 85) and isColor(  74,  712, 0xf8f9ee, 85) and isColor(  96,  692, 0x483624, 85)) then
      else--组队标志
        whileCount=0;
        while (true) do
          whileCount=whileCount+1;
          if whileCount>=100 then
            break;  --执行了一百次都不能就是卡住了自动退出 重新开始执行脚本
          end--直到点击进到页面
          noticeDown();
          if tansuoshouye() then
            
            break;
          end--识别返回和突破
          
          if tansuoInHome() then--外面的界面
            if tansuoshouye() then
              
            else
              randomTap(72,  104,2)
              mSleep(500);
            end
          end
          
          if (isColor( 688,  816, 0xf3b25e, 85) and isColor( 916,  858, 0xf3b25e, 85) and isColor(1130,  822, 0xf3b25e, 85) and isColor(1344,  852, 0xf3b25e, 85) and isColor(1016,  644, 0xcbb59c, 85)) then
            randomTap(1242,  834,2)
            mSleep(1500);
          end   --IPAD
          
          if tansuoshouye() then
            break;
          end--识别返回和突破
        end
      end
    end
  end
end




function F一直接受任务结束(...)
  -- body
end

---##################################################################################################  --第四页 一直接受任务

function F一键消耗体力突破卷(...)
  -- body
end

function gotoTansuoHome(...)--回到探索首页
  -- body
  while (true) do
    noticeDown()
    if exhaustion() then--出现了体力不足够 
      randomTap(1499,  502,2)--关闭体力框;ip
      mSleep(1500)
    end
    if youxishouye() then 
      HomeToExplore()
    end
    
    if tansuoInHome() then--外面的界面
      if tansuoshouye() then
        
      else
        randomTap(72,  104,2)
        mSleep(500);
      end
    end
    
    if (isColor( 688,  816, 0xf3b25e, 85) and isColor( 916,  858, 0xf3b25e, 85) and isColor(1130,  822, 0xf3b25e, 85) and isColor(1344,  852, 0xf3b25e, 85) and isColor(1016,  644, 0xcbb59c, 85)) then
      randomTap(1242,  834,2)
      mSleep(1500);
    end --IPAD
    
    if tansuoshouye() then 
      break;
    end
  end
  
  
end

task1,task2,task3,task4,task5 = true,true,true,true,true;
function simpleExhaustion(...)--一键消耗体力与突破卷
  local currentClass = values.cb7011;
  
  
  if values.a501 == "0" then task1 = false end 
  if values.a502 == "0" then task2 = false end 
  if values.a503 == "0" then task3 = false end 
  if values.a504 == "0" then task4 = false end 
  if values.a505 == "0" then task5 = false end   
  
  
  local task1Count,task2Count,task3Count,task4Count;
  local task1CurrentCount,task2CurrentCount,task3CurrentCount,task4CurrentCount = 0,0,0,0;  
  if values.a5011 == "0" then task1Count = nil end
  if values.a5011 == "1" then task1Count = 3 end --体力消耗完(默认),探索三回合,探索十回合
  if values.a5011 == "2" then task1Count = 10 end 
  
  if values.a5022 == "0" then task2Count = nil end
  if values.a5022 == "1" then task2Count = 3 end --体力消耗完(默认),御魂三回合,御魂十回合
  if values.a522 == "2" then task2Count = 10 end 
  
  if values.a5033 == "0" then task3Count = nil end
  if values.a5033 == "1" then task3Count = 3 end --体力消耗完(默认),觉醒三回合,觉醒十回合
  if values.a5033 == "2" then task3Count = 10 end
  
  if values.a5044 == "0" then task4Count = 10 end --满10卷打突破(默认),满1卷打突破
  if values.a5044 == "1" then task4Count = 1 end 
  
  
  while (true) do
    if tansuoshouye() then 
      if task1 and task2 and task3 and task4 and task5 then
        energyLoop();--已经全部跑完了
      end
    end
    timeOut()--检查关闭时间
    if values.a501 == "0" and tansuoTL() == "1" and task1==false  then --加入探索
      
      while (true) do
        if tansuoshouye() then 
          if values.cb701 == "0" and values.a7000 =="0" then --妖怪发现(普通)勾选了队长模式
            dialog("普通副本请不要勾选[困难本的队长模式],按确定脚本重启", 0)
            mSleep(1000)
            lua_restart()
          end
          invite()
          findGreater(fubenMissoin[currentClass-0][1],fubenMissoin[currentClass-0][2]);
          
          if values.a704 == "0" or values.a705 == "0" then
            GLyaoguaifaxianInStepExp()  
            
          else
            GLyaoguaifaxianInStep()
            clickChest()
          end
        else
          gotoTansuoHome()
        end 
        task1CurrentCount = task1CurrentCount + 1;
        if task1Count and task1CurrentCount >= task1Count then --有值说明要计时;
          task1,task2,task3,task4,task5 = false,false,false,false,false;  
          task1 = true;
          break;  
        end
      end 
      if tansuoshouye() then else gotoTansuoHome(); end--回到探索首页  
    end
    
    local temp  = 1;
    local inviteType = 1;
    if values.a502 == "0" and tansuoTL() == "1" and task2==false  then --加入御魂
      while (true) do
        
        if temp == 1 then
          temp = simpleyuhunClass1();
        end
        mSleep(500)
        if temp == 2 then
          temp = simpleyuhunClass2();
        end
        mSleep(500)
        if temp == 3 then
          temp = simpleyuhunClass3();
        end
        mSleep(500)
        if temp == 4 then
          temp = simpleyuhunClass4(inviteType);
          task2CurrentCount = task2CurrentCount + 1;  
          if task2Count and task2CurrentCount >= task2Count then --有值说明要计时;
            inviteType = 2;
          end   
          mSleep(500)
        end  
        if tansuoshouye() then  
          if task2Count and task2CurrentCount >= task2Count then --有值说明要计时;
            task1,task2,task3,task4,task5 = false,false,false,false,false;    
            task2 = true;
            break;  
          end
        end     
        
        
        
      end
      
      if tansuoshouye() then else gotoTansuoHome(); end--回到探索首页
    end 
    
    temp  = 1;
    inviteType = 1;
    
    if values.a503 == "0" and tansuoTL() == "1" and task3==false  then --加入觉醒
      
      while (true) do
        
        if temp == 1 then
          temp = SimpleJXCLClass1();
        end
        mSleep(500)
        if temp == 2 then
          temp = SimpleJXCLClass2();
        end
        mSleep(500)
        if temp == 3 then
          temp = SimpleJXCLClass3();
        end
        mSleep(500)
        if temp == 4 then
          temp = SimpleJXCLClass4(inviteType);
          task3CurrentCount = task3CurrentCount + 1;  
          if task3Count and task3CurrentCount >= task3Count then --有值说明要计时;
            inviteType = 2;
          end   
          mSleep(500)
        end
        if tansuoshouye() then  
          if task3Count and task3CurrentCount >= task3Count then --有值说明要计时;
            task1,task2,task3,task4,task5 = false,false,false,false,false;    
            task3 = true;
            break;  
          end
        end     
        
        
        
      end
      if tansuoshouye() then else gotoTansuoHome(); end--回到探索首页  
    end     
    
    if values.a504 == "0" and tansuoTPJ(task4Count) == "1" and task4==false  then --加入突破
      breakthroughPerson3() 
      if tansuoshouye() then else gotoTansuoHome(); end--回到探索首页 
    else
      if tansuoTPJ(task4Count) == "0" and task1 then
        task1,task2,task3,task4,task5 = false,false,false,false,false;  
        task4 = true;
      end
    end         
    --dialog(tansuoTL(30), 0)
    if values.a505 == "0" and tansuoTL(30) == "1" and task5==false then --加入石距
      --石头车--一个小时
      currentTimeRock = getNetTime(); 
      tmpTimeRock = currentTimeRock -originTimeRock;
      if tmpTimeRock >3600 then
        originTimeRock = currentTimeRock;
        mSleep(1000)
        ExploreToHome()
        seekRock()--石头车
        HomeToExplore()  
        mSleep(1000)
      else
        tmpTime1Rock = 3600-tmpTimeRock;
        toast("还有"..tostring(tmpTime1Rock).."秒打石头车",1); 
        mSleep(1200)
      end
      
      if tansuoshouye() then else gotoTansuoHome(); end--回到探索首页
      
      
    end         
    
  end
end


function F一键消耗体力突破卷(...)
  -- body
end




---##################################################################################################  --一键切换账号
function F一键切换账号开始(...)
  -- body
end

function QUICKinitGame()
  toast("正在重启游戏,切换账号",1)
  closeApp("com.netease.onmyoji");
  mSleep(500)
  clearKeyChain("com.netease.onmyoji");
  mSleep(1000)
  countWhile = 0;
  isfront = isFrontApp("com.netease.onmyoji")
  if isfront==0 then
    while true do
      
      countWhile = countWhile+1;
      if countWhile>=10 then 
        toast("您的阴阳师不是官方的,不能自动跳转",2)
        mSleep(2500)
        toast("非官方版本不能使用切换账号功能",2)
        mSleep(4000);
        break;
      end
      
      
      
      
      flag=runApp("com.netease.onmyoji")
      if flag==0 then
        QUICKtouchCenter() 
        break 
      end
    end
  end
end


errorCount = 0;

function QUICKtouchCenter()  --只登陆刷天数
  whileCount = 0
  while (true) do
    whileCount=whileCount+1;
    if whileCount>=5000 then
      errorLoop()
    end
    --toast("进到第一个循环",1)
    noticeDown() --特定很大的公告栏
    if (isColor( 778,  850, 0xdf6851, 85) and isColor(1282,  894, 0xf3b25e, 85) and isColor(1028,  904, 0xcbb59c, 85)) then
      randomTap( 1218,  868,2); -- 更新按钮
      mSleep(1000)
    else
      randomTap(990, 1242,2);       --点击中间进入游戏按钮
      mSleep(1500);
    end 
    
    if (isColor(1834,  317, 0xe8d4cf, 85) and isColor(1877,  316, 0xca6aac, 85) and isColor(1844,  349, 0xcc6e95, 85) and isColor(1726,  310, 0xcfc6bc, 85)) then
      randomTap(1836,  318,2)
      mSleep(1000)
    end --新版游戏公告
    
    
    if (isColor( 738,  860, 0x079ddb, 85) and isColor(1016,  856, 0x3cdedf, 85) and isColor(1312,  864, 0xd1201f, 85)) then--出现了网易游戏
      break 
    end
  end
  
  
  whileCount=0;
  while (true) do
    whileCount=whileCount+1;
    if whileCount>=100 then
      errorLoop()
    end--输入密码
    noticeDown() --特定很大的公告栏
    if (isColor( 738,  860, 0x079ddb, 85) and isColor(1016,  856, 0x3cdedf, 85) and isColor(1312,  864, 0xd1201f, 85)) then--出现了网易游戏
      randomTap(1308,  828,1)--点击网易账号
      mSleep(1000)
    end   
    
    if (isColor( 572,  562, 0xffffff, 85)) then
      usr = runAccount;
      pwd =runPassword;
      
      mSleep(100);      --点击输入账号    
      touchDown(1, 914,  598); 
      mSleep(50);
      touchUp(1, 914,  598);
      mSleep(1000);     --点击删除按钮
      
      
      inputText("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b") 
      mSleep(30)
      usr=string.gsub(usr, "^%s*(.-)%s*$", "%1")
      inputText(usr.."#ENTER#")
      mSleep(800)
      
      
      mSleep(30)
      pwd=string.gsub(pwd, "^%s*(.-)%s*$", "%1")
      inputText(pwd)
      mSleep(30)
      keyDown"ReturnOrEnter" 
      mSleep(30)
      keyUp"ReturnOrEnter" 
      mSleep(3000)
    end
    if (isColor(1005,  441, 0x090705, 85) and isColor(1013,  593, 0x140f0b, 85) and isColor(1045,  753, 0x221a14, 85)) then--阴阳师p
      toast("登录成功",1)   
      
      break --成功绑定了 
    else
      
      if (isColor( 570,  636, 0xffffff, 85) and isColor( 680,  576, 0xffffff, 85)) then
        toast("登陆失败,继续登陆",1)
        errorCount = errorCount+1;
        if errorCount >1 then 
          dialog("您输入的账号或者密码有误,请核实后再次登录,脚本退出", 0)
          lua_exit();
        end
      end
      
    end
  end
  
  
end


function F一键切换账号开始(...)
  -- body
end

---##################################################################################################  --一键切换账号
---##################################################################################################  --百鬼夜行
function F百鬼夜行(...)
  -- body
end

function throwGhost(...)
  local order = math.random(1,3);
  local x,y,x1,y1,x2,y2 ;
  
  while (true) do
    
    downloadVoice()
    accountIdentification()--取消认证
    if  youxishouye() then
      mSleep(1000)
      moveTo(1961,  750,1088,  750)
      mSleep(1000)      
      if (isColor( 734,  654, 0xa6a59d, 85)) then--町中
        randomTap(743,  646,2)--p
        mSleep(1500)   
      end
      
      if (isColor(1471,  630, 0xa8a5a0, 85)) then--庭院
        randomTap(1266,  348,2)--p
        mSleep(1500)
      end
      
      
    end
    
    if tansuoshouye() then
      randomTap(63,   98,2)--p
      mSleep(3000);
    end--探索首页--返回-御魂-挑战卷
    
    
    
    if noticeGhost() then
      randomTap(1536, 1043,2)--p
      mSleep(1500)
    end
    
    if choiceGhost() then
      order =  math.random(3)
      if order == 1 then
        randomTap(290, 1074,5)
        mSleep(1000)
      end
      if order == 2 then
        randomTap(1034, 1020,5)
        mSleep(1000)            
      end
      if order == 3 then
        randomTap(1752,  988,5)
        mSleep(1000)            
      end       
      if (isColor(1822, 1405, 0xf8f2db, 85) and isColor(1952, 1400, 0xf9f5e0, 85)) then--开始
        randomTap(1891, 1382,5)--p
        mSleep(1000)                
      end
    end
    
    
    
    
    if homeGhost() then 
      if (isColor( 635, 1452, 0x361d0f, 85)) then--5个
        moveTo(635, 1452,865, 1452)
        mSleep(500)
      end
      
      x,y = findMultiColorInRegionFuzzy( 0x271925, "34|0|0x261a29", 90, 30, 1052, 2042, 1185)
      if x ~= -1 and y ~= -1 then 
        randomTap(x,y,2)
        mSleep(500)
      end
      
      
      
    end
    
    
    if boxGhost() then
      windrumClick()
    end
    
    
    
  end
  
  
end

---##################################################################################################  --百鬼夜行

---##################################################################################################  --御灵
function F御灵(...)
  -- body
end

function yulinTZ(...)
    return (isColor(1450,  970, 0xf3b25e, 85) and isColor(1446, 1008, 0xf3b25e, 85) and isColor(1602, 1004, 0xf3b25e, 85) and isColor(1684,  418, 0x6a2f39, 85))
end

function simpleyuling(...)
  

  while (true) do
    
    
    if tansuoshouye() then--探索主页面
      mSleep(100);
      randomTap(838, 1446,2)--御灵--p
      mSleep(1500)  
    end
    
    
    if (isColor( 122,  520, 0xc3d7de, 85) and isColor(2026, 1136, 0xa6b4cd, 85) and isColor(1990,  484, 0xbd79a4, 85)) then--p
      if values.a401 =="8" then--御灵神龙
        if (isColor( 234, 1156, 0x8b2f2c, 85)) then
            randomTap(234, 1156,2)
            mSleep(1000)
        end
      end   
      if values.a401 =="9" then--御灵白藏主
        if (isColor( 652, 1154, 0x2d6b42, 85)) then
            randomTap(652, 1154,2)
            mSleep(1000)
        end
      end       
    
      if values.a401 =="10" then--御灵黑豹
        if (isColor(1096, 1156, 0x654c8e, 85)) then
            randomTap(1096, 1156,2)
            mSleep(1000)
        end
      end       
      if values.a401 =="11" then--御灵孔雀
        if (isColor(1524, 1158, 0x2b7484, 85)) then
            randomTap(1524, 1158,2)
            mSleep(1000)
        end
      end 
        
    end --选项卡界面
    
    if yulinTZ() then--p
        toast("3秒后开始挑战",1)
        mSleep(3000)
        randomTap(1528,  984,2)--挑战--p
        mSleep(2000)
    else --挑战
      
      noticeDown()
      
      if zhandouhuamian() then
        assFight()--集火
        mSleep(math.random(100,1000))
      end       
      
      ready6();
      fightManual6();           
      x2,y2 = windrum2_6()
      --胜利--windrum2_6
      if x2 ~= -1 and y2 ~= -1 then 
        while (true) do 
          if yulinTZ() or tansuoshouye() then
            break;
          else
            windrumClick()
          end
        end
      end       
      
      x3,y3 = windrum3_6()
      --失败--windrum3_6
      if x3 ~= -1 and y3 ~= -1 then 
        while (true) do 
          if yulinTZ() or tansuoshouye() then
            break;
          else
            windrumClick()
          end
        end
      end   
      
    end
  end
  
end


---##################################################################################################  --御灵


---##################################################################################################  --无人值守

function F无人值守开始(...)
  -- body
end



function errorInit(...)
  -- body
  toast("正在重启游戏",1)
  closeApp("com.netease.onmyoji");
  mSleep(1000)
  countWhile = 0;
  isfront = isFrontApp("com.netease.onmyoji")
  if isfront==0 then
    while true do
      
      countWhile = countWhile+1;
      if countWhile>=10 then 
        toast("您的阴阳师不是官方的,不能自动跳转",2)
        mSleep(2500)
        toast("非官方版本不能使用自动重启游戏功能",2)
        mSleep(4000);
        break;
      end
      
      flag=runApp("com.netease.onmyoji")
      if flag==0 then
        errorGoHome() 
        break 
      end
    end
  end  
end

function errorGoHome(...)
  while (true) do
    -- body
    noticeDown() --特定很大的公告栏
    if (isColor( 778,  850, 0xdf6851, 85) and isColor(1282,  894, 0xf3b25e, 85) and isColor(1028,  904, 0xcbb59c, 85)) then
      randomTap( 1218,  868,2); -- 更新按钮
      mSleep(1000)
    end 
    mSleep(1000)
    if (isColor(1834,  317, 0xe8d4cf, 85) and isColor(1877,  316, 0xca6aac, 85) and isColor(1844,  349, 0xcc6e95, 85) and isColor(1726,  310, 0xcfc6bc, 85)) then
      randomTap(1836,  318,2)
      mSleep(1000)
    end --新版游戏公告
    if (isColor( 717, 1412, 0xcf4231, 85) and isColor(1331, 1458, 0x23b260, 85) and isColor(1023, 1433, 0xffffff, 85)) then
      randomTap(1190, 1433,2)
      mSleep(800)
    end--用户协议
    mSleep(1000)
    if (isColor( 104,   42, 0xffffff, 85) and isColor( 490,   44, 0xffffff, 85) and isColor( 926,   34, 0xffffff, 85)) then
      randomTap(1964,   36,2)
      mSleep(1500)
    end--白色网页
    accountIdentification()--取消认证
    mSleep(1000)
    if youxishouye() then
      break
    else
      mSleep(50);
      randomTap(1018, 1138,5) -- 点击进入游戏按钮
      mSleep(1500);
    end
  end
  
  
  if values.a03 ~="1" then
    while (true) do
      -- body
      if (isColor( 104,   42, 0xffffff, 85) and isColor( 490,   44, 0xffffff, 85) and isColor( 926,   34, 0xffffff, 85)) then
        randomTap(1964,   36,2)
        mSleep(1500)
      end--白色网页
      accountIdentification()--取消认证
      x,y = findMultiColorInRegionFuzzy( 0xffffc6, "11|5|0x23180d,24|7|0xffffb8,12|45|0x271c0e", 90, 518, 275, 1887, 365)
      --exploreIconIPAD
      if x ~= -1 and y ~= -1 then        --如果在指定区域找到某图片符合条件 
        touchDown(1,x,  y); 
        mSleep(50);
        touchUp(1,x,  y);
        mSleep(2000);
        x=-1;
        y=-1;
      else
        mSleep(50)
        moveTo( 1958,  750, 1000,  750,50,800)
        mSleep(1000)
      end--避免在公告栏移动
      
      x1, y1 = findMultiColorInRegionFuzzy( 0xffffca, "9|6|0x2a1c0f,22|6|0xffffc2,9|46|0x302010", 90, 518, 275, 1887, 365)
      --exploreIconIPAD_1
      if x1 ~= -1 and y1 ~= -1 then        --如果在指定区域找到某图片符合条件           
        touchDown(1,x1,y1); 
        mSleep(50);
        touchUp(1,x1,y1);
        mSleep(2000)
        x1=-1;
        y1=-1;
      end 
      
      
      if tansuoshouye() then
        break;
      end--探索首页--返回-御魂-挑战卷
      
      
    end
  end
  allAction()    
end

function errorLoop(...)
  if values.a01 == "0" then--开启了无人值守
    errorInit()
  end
end


---##################################################################################################  --无人值守

---##################################################################################################  --体力用完
function F体力用完(...)
  -- body
end


function energyLoop(...)--体力用完的时候做的事情
  if values.a04 =="0" then--灭屏幕
    lockDevice(); 
    lua_exit();
  end
  
  if values.a04 =="1" then--切换账号
    accountNumfile = isFileExist(appPath.."/res/wdyysNum.txt")--当前个数
    if accountNumfile then
      accountNumlist = readFile(appPath.."/res/wdyysNum.txt")
      accountNum = tonumber(accountNumlist[1]) or 0;
    else
      accountNum = 0;
    end
    
    accountNum = accountNum +1;
    accountNumlist1={};
    accountNumlist1[1]= accountNum;
    delFile(appPath.."/res/wdyysNum.txt")
    mSleep(500)
    writeFile(appPath.."/res/wdyysNum.txt",accountNumlist1,"w")
    mSleep(500)  
    
    
    energyExh()--重启游戏登录
    errorGoHome() --重新执行任务;
  end   
end


function energyExh(...)--体力用完
  
  closeApp("com.netease.onmyoji");
  mSleep(500)
  clearKeyChain("com.netease.onmyoji");
  mSleep(1000)
  
  countWhile = 0;
  isfront = isFrontApp("com.netease.onmyoji")
  if isfront==0 then
    while true do
      
      countWhile = countWhile+1;
      if countWhile>=10 then 
        toast("您的阴阳师不是官方的,不能自动跳转",2)
        mSleep(2500)
        toast("非官方版本不能使用自动重启游戏功能",2)
        mSleep(4000);
        break;
      end
      
      flag=runApp("com.netease.onmyoji")
      if flag==0 then
        
        break 
      end
    end
  end  
  
  
  
  
  local errorCount = 0
  whileCount = 0
  while (true) do
    whileCount=whileCount+1;
    if whileCount>=5000 then
      errorLoop()
    end
    --toast("进到第一个循环",1)
    noticeDown() --特定很大的公告栏
    if (isColor( 778,  850, 0xdf6851, 85) and isColor(1282,  894, 0xf3b25e, 85) and isColor(1028,  904, 0xcbb59c, 85)) then
      randomTap( 1218,  868,2); -- 更新按钮
      mSleep(1000)
    else
      randomTap(990, 1242,2);       --点击中间进入游戏按钮
      mSleep(1500);
    end 
    
    if (isColor(1834,  317, 0xe8d4cf, 85) and isColor(1877,  316, 0xca6aac, 85) and isColor(1844,  349, 0xcc6e95, 85) and isColor(1726,  310, 0xcfc6bc, 85)) then
      randomTap(1836,  318,2)
      mSleep(1000)
    end --新版游戏公告
    
    
    if (isColor( 738,  860, 0x079ddb, 85) and isColor(1016,  856, 0x3cdedf, 85) and isColor(1312,  864, 0xd1201f, 85)) then--出现了网易游戏
      break 
    end
  end
  
  
  whileCount=0;
  while (true) do
    usr,pwd =WuDisplit(accountList[accountNum]);
    whileCount=whileCount+1;
    if whileCount>=100 then
      errorLoop()
    end--输入密码
    noticeDown() --特定很大的公告栏
    if (isColor( 738,  860, 0x079ddb, 85) and isColor(1016,  856, 0x3cdedf, 85) and isColor(1312,  864, 0xd1201f, 85)) then--出现了网易游戏
      randomTap(1308,  828,1)--点击网易账号
      mSleep(1000)
    end   
    
    if (isColor( 572,  562, 0xffffff, 85)) then
      
      
      mSleep(100);      --点击输入账号    
      touchDown(1, 914,  598); 
      mSleep(50);
      touchUp(1, 914,  598);
      mSleep(1000);     --点击删除按钮
      
      
      inputText("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b") 
      mSleep(30)
      usr=string.gsub(usr, "^%s*(.-)%s*$", "%1")
      inputText(usr.."#ENTER#")
      mSleep(800)
      
      
      mSleep(30)
      pwd=string.gsub(pwd, "^%s*(.-)%s*$", "%1")
      inputText(pwd)
      mSleep(30)
      keyDown"ReturnOrEnter" 
      mSleep(30)
      keyUp"ReturnOrEnter" 
      mSleep(3000)
    end
    if (isColor(1005,  441, 0x090705, 85) and isColor(1013,  593, 0x140f0b, 85) and isColor(1045,  753, 0x221a14, 85)) then--阴阳师p
      toast("登录成功",1)   
      
      break --成功绑定了 
    else
      mSleep(2000)
      if (isColor( 570,  636, 0xffffff, 85) and isColor( 680,  576, 0xffffff, 85)) then
        toast("登陆失败,继续登陆",1)
        errorCount = errorCount+1;
        if errorCount >3 then 
          accountNum=accountNum+1
          if accountNum >= #accountList then 
            accountNum=1;
          end
        end
      end
      
    end
  end
  
  
  accountNum = accountNum +1;
  accountNumlist1={};
  accountNumlist1[1]= accountNum;
  delFile(appPath.."/res/wdyysNum.txt")
  mSleep(500)
  writeFile(appPath.."/res/wdyysNum.txt",accountNumlist1,"w")
  mSleep(500)    
  
  
  
  
  local markRegion = false;
  while (true) do
    if (isColor(1005,  441, 0x090705, 85) and isColor(1013,  593, 0x140f0b, 85) and isColor(1045,  753, 0x221a14, 85)) then--阴阳师p
      randomTap(861,  548,2)--p
      mSleep(1000) 
    end--开始选区
    
    if (isColor( 885,  296, 0xebd098, 85) and isColor( 977,  289, 0xf0d9a5, 85) and isColor(1151,  286, 0xf3ddaa, 85)) then--p
      if (isColor( 400, 1116, 0xa6351e, 85) and isColor( 582, 1113, 0x861d0f, 85)) then--已有角色
        randomTap(483, 1118,2)
        mSleep(500)
      end
    end--选择区域
    
    if (isColor( 402,  894, 0xa6351e, 85) and isColor( 585,  897, 0x851c0e, 85)) then
      randomTap(499, 1053,2)
      markRegion = true;
      mSleep(1000)
    end--已经有角色  
    
    
    if (isColor(1005,  441, 0x090705, 85) and isColor(1013,  593, 0x140f0b, 85) and isColor(1045,  753, 0x221a14, 85)) and markRegion then--p
      break;
    end--开始选区
    
    
  end
  
  ---来到桌面
  
  
  while (true) do
    if (isColor(1005,  441, 0x090705, 85) and isColor(1013,  593, 0x140f0b, 85) and isColor(1045,  753, 0x221a14, 85)) then--阴阳师p
      randomTap(1015, 1178,2)
      mSleep(1500)
    end--进入游戏按钮
    
    
    if (isColor( 717, 1412, 0xcf4231, 85) and isColor(1331, 1458, 0x23b260, 85) and isColor(1023, 1433, 0xffffff, 85)) then
      randomTap(1190, 1433,2)
      mSleep(800)
    end--用户协议
    
    noticeDown();
    if (isColor( 716,  860, 0xdf6851, 85) and isColor(1096,  854, 0xf3b25e, 85) and isColor(1017,  935, 0xcbb59c, 85) and isColor(1028,  585, 0xcbb59c, 85)) then
      accountNumfile = isFileExist(appPath.."/res/wdyysNum.txt")--当前个数
      if accountNumfile then
        accountNumlist = readFile(appPath.."/res/wdyysNum.txt")
        accountNum = tonumber(accountNumlist[1]) or 0;
      else
        accountNum = 0;
      end
      
      accountNum = accountNum +1;
      accountNumlist1={};
      accountNumlist1[1]= accountNum;
      delFile(appPath.."/res/wdyysNum.txt")
      mSleep(500)
      writeFile(appPath.."/res/wdyysNum.txt",accountNumlist1,"w")
      mSleep(500)  
      
      
      energyExh()--重启游戏登录
      errorGoHome() --重新执行任务;
    end--被封号了   
    if (isColor( 166,   33, 0xffffff, 85) and isColor( 423,   52, 0xffffff, 85) and isColor( 910,   50, 0xffffff, 85)) then
      randomTap(1966,   37,2)
      mSleep(1500)
    else--白色-网页广告   
      if youxishouye() then
        break;
      else
        randomTap(1975, 1075,2)
        mSleep(1000)
      end
      
    end
    
  end
  
end


function allAction(...)
  -- body
  
  if UIretMack==1 then
    
    
    if values.a03 =="0" then--探索副本换狗粮
      init("0",screenOir)
      isfront = isFrontApp("com.netease.onmyoji")
      if isfront==0 then
        countWhile = 0;
        while true do
          countWhile = countWhile+1;
          if countWhile>=10 then 
            toast("您的阴阳师不是官方的,不能自动跳转",2)
            mSleep(2500)
            toast("需要在游戏界面,按音量键开启脚本,或者手动打开游戏",2)
            mSleep(4000);
            break;
          end
          
          flag=runApp("com.netease.onmyoji")
          if flag==0 then   
            toast("跳转到阴阳师应用中",2)
            mSleep(3000);
            break 
          end
        end
      end
      
      whileCount=0;
      while (true) do
        whileCount=whileCount+1;
        if whileCount>100 then --找位置
          --在主页面    
          dialog("请来到探索主页面,再运行脚本。【注意:辅助的首页设置Home键位置】", 0)
          lua_exit()
        end
        if tansuoshouye() then
          break;
        end--识别返回和突破
      end
      
      if values.cb701 == "2" then --探索队员模式
        tansuoInvitation()
      end
      
      if values.cb701 == "0" or values.cb701 == "1" then--困难-普通模式
        toast("开始探索",1)
        mSleep(1200)
        GLyaoguaifaxian();
      end
      
    end 
    
    
    
    
    
    if values.a03 =="1" then--快速上车
      init("0",screenOir);          
      isfront = isFrontApp("com.netease.onmyoji")
      if isfront==0 then
        countWhile = 0;
        while true do
          countWhile = countWhile+1;
          if countWhile>=10 then 
            toast("您的阴阳师不是官方的,不能自动跳转",2)
            mSleep(2500)
            toast("需要在游戏界面,按音量键开启脚本,或者手动打开游戏",2)
            mSleep(4000);
            break;
          end
          
          flag=runApp("com.netease.onmyoji")
          if flag==0 then   
            toast("跳转到阴阳师应用中",2)
            mSleep(3000);
            break 
          end
        end
      end
      
      while (true) do
        timeOut()--检查关闭时间  
        check();
        toast("开始运行,当前:"..STitle,1);
        mSleep(1000)
        seekTitle()
        mSleep(1000)
        if values.a015 =="0" then
          currentTime = getNetTime(); 
          tmpTime = currentTime -originTime;
          if tmpTime >600 then
            originTime = currentTime;
            HomeToExplore()
            breakthrough(1)
            ExploreToHome()
            toast("完成结节突破",1)   
            mSleep(1200)
          else
            tmpTime1 = 600-tmpTime;
            toast("还有"..tostring(tmpTime1).."秒打结界",1);
            mSleep(1200)
          end
        end
      end
    end
    
    
    
    if values.a03 =="2" then--御魂队长模式
      init("0",screenOir)
      isfront = isFrontApp("com.netease.onmyoji")
      if isfront==0 then
        countWhile = 0;
        while true do
          countWhile = countWhile+1;
          if countWhile>=10 then 
            toast("您的阴阳师不是官方的,不能自动跳转",2)
            mSleep(2500)
            toast("需要在游戏界面,按音量键开启脚本,或者手动打开游戏",2)
            mSleep(4000);
            break;
          end
          
          flag=runApp("com.netease.onmyoji")
          if flag==0 then   
            toast("跳转到阴阳师应用中",2)
            mSleep(3000);
            break 
          end
        end
      end
      if values.cb051 =="0" then
        simpleyuhun();
      end
      if values.cb051 =="1" then  
        SimpleJXCL();
      end   
      if values.cb051 =="2" then  
        acceptInvitation();
      end         
    end
    
    
    
    if values.a03 =="3" then--独立功能大集合
      init("0",screenOir);
      isfront = isFrontApp("com.netease.onmyoji")
      if isfront==0 then
        countWhile = 0;
        while true do
          countWhile = countWhile+1;
          if countWhile>=10 then 
            toast("您的阴阳师不是官方的,不能自动跳转",2)
            mSleep(2500)
            toast("需要在游戏界面,按音量键开启脚本,或者手动打开游戏",2)
            mSleep(4000);
            break;
          end
          
          flag=runApp("com.netease.onmyoji")
          if flag==0 then   
            toast("跳转到阴阳师应用中",2)
            mSleep(3000);
            break 
          end
        end
      end
      
      --刷新组队时间
      originTime = getNetTime(); --获取时间
      originTimeZD = originTime;--组队时间  
      mSleep(500)
      
      
      
      if values.a401 =="0" then--御魂单人挂机
        if values.a402 =="0" then --技能自动挂机
          simplejuexingInStep()
        end 
        if values.a402 =="1" then --兔子黑科技
          simplejuexingInBoya()
        end                 
        
      end
      
      if values.a401 =="1" then--觉醒单人挂机
        if values.a402 =="0" then --技能自动挂机
          simplejuexingInStep()
        end             
      end
      
      
      if values.a401 =="2" then--结界突破个人
        if values.a402 =="0" then --打满9个刷新
          breakthroughPerson()
        end 
        if values.a402 =="1" then --打完3个刷新
          breakthroughPerson3()
        end 
        
      end
      
      if values.a401 =="3" then--结界突破阴阳寮
        if values.a402 =="0" then --单人挑战—+石距
          breakthroughOriBase()
        end 
        if values.a402 =="1" then --单人挑战—+石距
          breakthroughOri()
        end 
        if values.a402 =="2" then --单人挑战+组队
          breakthroughOriZDBase()
        end         
        if values.a402 =="3" then --单人挑战+组队+石距
          breakthroughOriZD()
        end 
        if values.a402 =="4" then --突破队员
          breakthroughInvitation()
        end         
        
      end   
      
      if values.a401 =="4" then--业火原-贪
        toast("贪之阵",1)
        mSleep(1000)
        yehuoyuanTpye ="tan"         
        if values.a402 =="0" then --技能自动挂机
          yehuoyuanFun()    
        end 
        if values.a402 =="1" then --兔子黑科技
          yehuoyuanFBoya()
        end 
      end 
      
      if values.a401 =="5" then--业火原-嗔
        toast("嗔之阵",1)
        mSleep(1000)
        yehuoyuanTpye ="chen"       
        
        if values.a402 =="0" then --技能自动挂机
          yehuoyuanFun()    
        end 
        if values.a402 =="1" then --兔子黑科技
          yehuoyuanFBoya()
        end 
      end 
      
      if values.a401 =="6" then--业火原-痴
        toast("痴之阵",1)
        mSleep(1000)
        yehuoyuanTpye ="chi"         
        if values.a402 =="0" then --技能自动挂机
          yehuoyuanFun()    
        end 
        if values.a402 =="1" then --兔子黑科技
          yehuoyuanFBoya()
        end 
      end   
      
      if values.a401 =="7" then--百鬼夜行
        toast("百鬼夜行",1)
        mSleep(1000)
        throwGhost()
      end       
      
      if values.a401 =="8" then--御灵神龙
        toast("御灵神龙",1)
        mSleep(1000)
        simpleyuling()
      end   
      if values.a401 =="9" then--御灵白藏主
        toast("御灵白藏主",1)
        mSleep(1000)
        simpleyuling()
      end       
    
      if values.a401 =="10" then--御灵黑豹
        toast("御灵黑豹",1)
        mSleep(1000)
        simpleyuling()
      end       
      if values.a401 =="11" then--御灵孔雀
        toast("御灵孔雀",1)
        mSleep(1000)
        simpleyuling()
      end       
      
    end
    
    
    
    if values.a03 =="4" then--一键每日
      init("0",screenOir)
      isfront = isFrontApp("com.netease.onmyoji")
      if isfront==0 then
        countWhile = 0;
        while true do
          countWhile = countWhile+1;
          if countWhile>=10 then 
            toast("您的阴阳师不是官方的,不能自动跳转",2)
            mSleep(2500)
            toast("需要在游戏界面,按音量键开启脚本,或者手动打开游戏",2)
            mSleep(4000);
            break;
          end
          
          flag=runApp("com.netease.onmyoji")
          if flag==0 then   
            toast("跳转到阴阳师应用中",2)
            mSleep(3000);
            break 
          end
        end
      end
      
      whileCount=0;
      while (true) do
        whileCount=whileCount+1;
        if whileCount>100 then --找位置
          --在主页面    
          dialog("请来到探索页面,再运行脚本", 0)
          lua_exit()
        end
        if tansuoshouye() then
          break;
        end--识别返回和突破
      end
      
      
      simpleExhaustion()--一键消耗  
      
    end
    
    if values.a03 =="5" then--一键切换账号
      init("0",screenOir)
      QUICKinitGame()
      toast("登录成功,脚本退出,请选择账号所在的区服",3)
      
    end
    
    
  end
end





do
  
  initialStatu()  
  allAction()
  
end

你可能感兴趣的:(阴阳师脚本代码,供学习)