1、本源码适用于按键精灵手机版Dim 现在时(),Advertisement,barnfull,barnlevel,dw1,dw2,aaa,aCall 调整屏幕()Call 定位干扰()Call 重新联机()Call 定位种田()Call 主程序()Sub 主程序()DoIf ReadUIConfig(fans) Then Call 粉丝移除()End IfFor 2Call 种植小麦()Call 小麦收割()Delay 300NextCall 粮仓()If barnfull = 1 Then TracePrint 判定粮仓满了Call 商店()End IfCall 粮仓水位()/读取界面元素名称
2、为账号的默认值,如果该元素未设置默认值则读出100If ReadUIConfig(honey) ThenCall 收集()End If/-找邻居卖东西 If ReadUIConfig(neighbor) Then /-开始找邻居的时间 Call 读现在时(1) If 计时器(30, 1, false) Then Goto jumpfind End If Delay 200 /-点击次数 aaa=0 Do Until 计时器(30, 1, false) =True Call 找邻居() Call 邻居小麦() Delay 1000 Loop Delay 200 Rem jumpfind End
3、IfCall 商店()Call 重新联机()FindPic 917, 443, 967, 491, Attachment:定位图.png, 000000, 0, 0.7, dw1, dw2 If dw1 0 And dw2 0 And cornerY 0 Then TracePrint 已定位种田 Delay 200 TouchDown 635, 422 Delay 200 TouchMove 635, 160 Delay 200 TouchUp Delay 200 TracePrint 调整完毕 Exit Do End If If 计时器(10, 0, false) Then TracePr
4、int 指定时间到 Call 调整屏幕() Call 定位干扰() Call 重新联机() End If LoopEnd SubSub 种植小麦() Dim landX,landY /-无云- FindPic 569,530,651,595,Attachment:First Farmland0.png,000000,0,0.6,landX,landY If landX 0 And landY 0 And landY 0 Then TracePrint 开始种植 Call 第一田() Delay 500 If 小麦() = 1 Then TracePrint 准备刷地 Call 刷地() End
5、 If Delay 1000 /TXL = now /PlantingNumber=PlantingNumber+1 End IfEnd SubSub 小麦收割() Dim land2X,land2Y /-无云- FindPic 580,528,647,584,Attachment:First Farmland2.png,000000,0,0.7,land2X,land2Y If land2X 0 And land2Y 0 And land2Y 0 Then TracePrint 开始收割 Call 第一田() Delay 500 If 收割() = 1 Then Call 刷地() End
6、If Delay 1000 End IfEnd Sub/-点击第一块土地Sub 第一田() Delay 200 Tap 609,564 TracePrint 已点击第一田 Delay 200End SubFunction 小麦()Dim intX,intY FindPic 497,436,573,512,Attachment:wheat0.png,000000,0,0.7,intX,intY If intX 0 And intY 0 Then TracePrint 已找到小麦图标 TouchDown 537,473,0 TracePrint 已点击小麦图标 Delay 100 小麦 = 1 E
7、lse TracePrint 未找到小麦图标 小麦=-1 End IfEnd FunctionFunction 收割() Dim intX,intY FindPic 465,472,556,552,Attachment:Sickle.png,000000,0,0.7,intX,intY If intX 0 And intY 0 Then TouchDown 511,492,0 TracePrint 已按镰刀 Delay 100 收割 = 1 Else TracePrint 未找到镰刀图标 收割=-1 End IfEnd FunctionSub 刷地() /种植速度,24是延时 /读取界面元素名
8、称为账号的默认值,如果该元素未设置默认值则读出100 Dim fa TracePrint 刷地 fa=ReadUIConfig(farm) /将小麦移动至第一块田 TouchMove 606,568, 0, 200 Delay 200 /刷第一排 TouchMove 941,395, 0, 800 Delay 200 If fa = 0 Then TouchUp 0 Goto farmland End If /调整至第二排 TouchMove 905, 376, 0, 200 Delay 200 /刷第二排 TouchMove 567, 545, 0, 800 If fa = 1 Then T
9、ouchUp 0 Goto farmland End If /调整至第三排 TouchMove 531, 528, 0, 200 /刷第三排 TouchMove 869, 359, 0, 800 If fa = 2 Then TouchUp 0 Goto farmland End If /调整至第四排 TouchMove 832, 342, 0, 200 /刷第四排 TouchMove 496, 508, 0, 800 If fa = 3 Then TouchUp 0 Goto farmland End If /调整至第五排 TouchMove 463, 496, 0, 200 /刷第五排 T
10、ouchMove 792, 324, 0, 800 If fa = 4 Then TouchUp 0 Goto farmland End If /调整至第六排 TouchMove 759,307, 0, 200 /刷第六排 TouchMove 425, 473, 0, 800 If fa = 5 Then TouchUp 0 Goto farmland End If /调整至第七排 TouchMove 389,457, 0, 200 /刷第七排 TouchMove 721, 288, 0, 800 If fa = 6 Then TouchUp 0 Goto farmland End If /调
11、整至第八排 TouchMove 686,272, 0, 200 /刷第八排 TouchMove 353, 438, 0, 800 If fa = 7 Then TouchUp 0 Goto farmland End If /调整至第九排 TouchMove 327,412, 0, 200 /刷第九排 TouchMove 653, 253, 0, 800 If fa = 8 Then TouchUp 0 Goto farmland End If Rem farmland Delay 100 TouchUp Delay 100 End SubSub 粮仓()Dim barnX,barnY Adve
12、rtisement = 0FindPic 539,126, 735,267, Attachment:full.png, 000000, 0, 0.6, barnX, barnY If barnX 0 And barnY 0 Then TracePrint 粮仓已满 Tap 873,199 Delay 1000 barnfull = 1 Else TracePrint 粮仓未满 End If Call 种植小麦() Delay 100 Call 定位干扰() Delay 100 End SubSub 粮仓水位() Dim barnlevelX, barnlevelY,barnlevel2X,ba
13、rnlevel2Y,BarnlevelText,ba,bbbarnlevel = 5 ba = ReadUIConfig(barn) Select Case (ba) Case 0 bb = 50 Case 1 bb = 60 Case 2 bb = 70 Case 3 bb = 80 End Select FindColor 951,493, 963,584, 4FF8FF, 0, 0.8, barnlevelX, barnlevelY If barnlevelX 0 And barnlevelY 0 Then TracePrint 粮仓水位以找到 BarnlevelText = (584
14、- barnlevelY) * 100 87 - 10 TracePrint BarnlevelText TracePrint bb / BarnlevelText barnlevel =bb / BarnlevelText Else FindColor 951,493, 963,584, 4AD5F7, 0, 0.8,barnlevel2X,barnlevel2Y If barnlevel2X 0 And barnlevel2Y 0 Then TracePrint 粮仓水位以找到 BarnlevelText = (584 - barnlevel2Y) * 100 87 - 10 TraceP
15、rint BarnlevelText TracePrint bb / BarnlevelText barnlevel = bb / BarnlevelText End If End If End SubSub 商店() Call 粮仓水位() Delay 500 Call 开启商店() Delay 500 Call 金钱收集() Delay 100 If barnlevel = 1 or barnfull =1 Then Call 商品上架() End If Delay 100 Call 广告() /-商品架下一页 For ReadUIConfig(shoppage) Call 商品架下一页(
16、) Delay 500 Call 金钱收集() Delay 100 If barnlevel =1 or barnfull =1 Then Call 商品上架() End If Delay 100 Call 广告() Next barnfull = 0 /重置粮仓 Call 关闭商店() Delay 1000 FindPic 917, 443, 967, 491, Attachment:定位图.png, 000000, 0, 0.7, dw1, dw2 If dw1 0 And dw2 0 And soldY 0 Then TracePrint 找到已卖出商品 sold2X = soldX s
17、old2Y = soldY-50 Tap sold2X, sold2Y Delay 300 Else TracePrint (没有卖出商品) Delay 50 Exit For End If NextEnd Sub/-商品上架-Sub 商品上架() Dim emptyX, emptyY,empty2X, empty2Y,shopx shopx=ReadUIConfig(shopnumber)+4 For shopx FindPic 320,206, 987,518, Attachment:empty.png,000000,0, 0.9, emptyX, emptyY If emptyX 0 A
18、nd emptyY 0 Then TracePrint 找到空闲位置 empty2X = emptyX + 33 Tap empty2X, emptyY TracePrint 点击空闲位置 Delay 400 Call 小麦商品上架() Advertisement = 1 Else TracePrint (没有空闲位置) Exit For End If Delay 500 NextEnd SubSub 小麦商品上架() Dim wheatX, wheatY,wheat2X, wheat2Y,soldingX, soldingY Tap 312,195 Delay 500 FindPic 371
19、,159, 682,551, Attachment:wheat.png, 000000,0,0.7, wheatX, wheatY If wheatX 0 And wheatY 0 Then TracePrint 找到小麦 wheat2X = wheatX+ 33 Tap wheat2X, wheatY Delay 500 FindPic 752,205, 817,281, Attachment:solding10.png,000000,0, 0.7, soldingX, soldingY If soldingX 0 And soldingY 0 Then TracePrint 作物充足 Ca
20、ll 价格调整() Delay 100 Tap 810,515 Delay 100 Else TracePrint 作物不足 Tap 910,125 Delay 100 End If Else TracePrint 未找到小麦可以卖 Tap 910,125 Delay 100 End IfEnd SubSub 价格调整() For 9 Tap 735, 367 Delay 50 NextEnd Sub/-广告-Sub 广告() Dim unsoldX, unsoldY,unsold2X, unsold2Y If Advertisement = 0 Then FindPic 694,234, 7
21、50,298, Attachment:unsold.png,000000,0, 0.7, unsoldX, unsoldY If unsoldX 0 And unsoldY 0 Then TracePrint 找到贩卖中产品 unsold2X = unsoldX +50 unsold2Y = unsoldY +50 Tap unsoldX, unsold2Y Delay 700 Call 创建广告() TracePrint 创建广告 Advertisement = 1 Else TracePrint (没有未售出商品) End If End IfEnd SubSub 创建广告() Dim ha
22、dadX, hadadY FindColor 726-5,344-5,726+5,344+5, 00B145,0, 0.8, hadadX, hadadY If hadadX 0 And hadadY 0 Then TracePrint 可创建广告 Tap 640,423 Delay 700 Else TracePrint 无法创建广告 Tap 768,143 Delay 700 End IfEnd SubSub 定位干扰() Dim intX,intY FindColor 64-5,648-5,64+5,648+5,002638,0,0.7,intX,intY If intX 0 And i
23、ntY 0 Then TracePrint 有干扰画面 Tap 52,332 Delay 500 Else TracePrint 无干扰画面 End If FindColor 53-5,650-5,53+5,650+5,22B613,0,0.8,intX,intY If intX 0 And intY 0 Then TracePrint 跑到其他人的家 Tap 54,614 Delay 10000 Call 调整屏幕() Else TracePrint 无干扰画面 End If FindPic 97,594,174,669,Attachment:home.png,000000,0,0.8,in
24、tX,intY If intX 0 And intY 0 Then TracePrint 跑到其他场景 Tap 138,639 Delay 10000 Call 调整屏幕() Else TracePrint 无干扰画面 End If End SubSub 重新联机() Dim reconnectX,reconnectY FindPic 593,456,673,521,Attachment:reconnecting.png,000000,0,0.8,reconnectX,reconnectY If reconnectX 0 And reconnectY 0 Then Tap 638,492 Tr
25、acePrint 重新连接 Delay 20000 Call 调整屏幕() Call 定位种田() End IfEnd SubSub 收集 Dim intX,intY,Xa, Ya FindColor 898-5,290-5,898+5,290+5,336A8F,0,0.8,intX,intY If intX 0 And intY 0 Then TracePrint 找到蜜蜂树 Delay 200 Tap 898,290 Delay 2000 End If FindPic 753,136, 840,224, Attachment:honey.png,000000,0, 0.8, intX, i
26、ntY If intX 0 And intY 0 Then TracePrint 收集蜂蜜 /Xa = intX + 20 /Ya = intY +10 TouchDown 774, 174,1 Delay 200 TouchMove 871, 212, 1,200 Delay 200 TouchMove 948, 215, 1,200 Delay 200 TouchMove 924, 272, 1,200 Delay 200 TouchMove 845, 287, 1,200 Delay 200 TouchUp 1 Delay 200 Tap 1000,263 Else Tap 1000,2
27、63 Delay 1000 End IfEnd SubSub 找邻居() Dim FindNeighborX,FindNeighborY,FindNeighborColor1,FindNeighborColor2,NeighborA,NeighborB,intX,intY,i /-判定点X轴 FindNeighborX = array(1040,1068,1098,1129,1099,1119) /-判定点Y轴 FindNeighborY = array(369,351,369,392,392,371) /-判定点颜色 FindNeighborColor1 = array(10C797,11C
28、394,2C6DC9,2F6EC3,367CD5,0DBF90) /-判定点阴影下颜色 FindNeighborColor2 = array(11AE81,13AD82,2C63B4,2F68B4,3470BE,11AF84) If aaa 6 and 计时器(30,1,false) Then Call 商店() End If Do Until 计时器(30,1,false)=True i = 0 Delay 200 For 6 TracePrint i+1 Delay 10 FindColor FindNeighborX(i)-2,FindNeighborY(i)-2,FindNeighbo
29、rX(i)+2,FindNeighborY(i)-2,FindNeighborColor1(i),0,0.9,intX,intY If intX 0 And intY 0 Then NeighborA = 0 Else NeighborA = 1 End If FindColor FindNeighborX(i)-2,FindNeighborY(i)-2,FindNeighborX(i)+2,FindNeighborY(i)-2,FindNeighborColor2(i),0,0.9,intX,intY If intX 0 And intY 0 Then NeighborB = 0 Else NeighborB = 1 End If If NeighborA + NeighborB = 2 Then /