家国梦自动收取金币、货物、升级建筑、拆相册等脚本

时间:2022-07-23
本文章向大家介绍家国梦自动收取金币、货物、升级建筑、拆相册等脚本,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

工具

PC、按键精灵手机助手、雷电模拟器、家园梦apk

模拟器配置

步骤

1、先PC装按键精灵手机助手 2、把代码复制到按键精灵手机助手上去 3、按键精灵上点“调试”,会自动在模拟器上安装手机版按键精灵 4、按键精灵上点“连接模拟器” 5、完成后,手动打开“家国梦app” 6、按键精灵上点“调试”

按键精灵代码

Sub Auto()
	Tap 90, 1820
	Delay 500
	
	Dim HOUSE_X = Array(300,545,800,290,560,800,290,560,780)
	Dim HOUSE_Y = Array(1200,1080,950,960,820,725,720,580,450)
	Dim HOUSE_INDEX = 1
	
	Dim X(3), Y(3)
	X(1) = 660
	X(2) = 825
	X(3) = 975
	Y(1) = 1635
	Y(2) = 1555
	Y(3) = 1470
	
	Dim INDEX, UPCNT
	UPCNT = 0
	While True
		
		For INDEX = 1 To 3
			//TracePrint INDEX
			TouchDown X(INDEX), Y(INDEX)
			Delay 1000
			Dim IntX,IntY
			FindColor 0,0,0,0,"80FFFF|81FFFF|80FF00",0,1.0,intX,intY
			If intX >-1 then
    			Traceprint "找到货物"
    			TouchMove intX + 50, intY
    			Delay 200
			Else
    			Traceprint "没有货物"
			End If
			TouchUp
		Next
		
		Delay 1000
		TouchDown 200, 1280
		TouchMove 1000, 825
		TouchMove 820, 700
		TouchMove 170, 1045
		TouchMove 210, 760
		TouchMove 900, 400
		TouchUp
	
		Delay 1000
		
		UPCNT = UPCNT + 1
		If UPCNT >= 10 Then 
			UPCNT = 0
			Call Up(HOUSE_X(HOUSE_INDEX), HOUSE_Y(HOUSE_INDEX)) //升级指定房屋
			HOUSE_INDEX = HOUSE_INDEX + 1
			If HOUSE_INDEX > 9 Then 
				HOUSE_INDEX = 1
			End If
			Delay 1000
		End If
	Wend
End Sub


Sub Up(X, Y)
	Tap 970, 1145 //进入升级
	Delay 1000
	
	while CmpColor(1050, 1160, "4DDDFF", 1.0) < 0
		Traceprint "等待进入升级页面"
		Delay 500
	Wend
	Tap X, Y  //点击建筑
	Delay 1000
	
	Dim intX, intY, res
	res = FindColor(900,1670, 990, 1700, "FFFFFF", 0, 1.0, intX, intY)
	//如果没有找到,intX和intY的值都会被置为-1
	While res > -1
		Tap 870, 1750
		Traceprint "升级一次"
		Delay 100
		res = FindColor(900,1670, 990, 1700, "FFFFFF", 0, 1.0, intX, intY)
	Wend
	
	Traceprint "金币不足"
	Tap 970, 1145 //退出升级
	Delay 1000
End Sub


Sub HB()
	Dim intX, intY, res
	Tap 525, 1810
	Delay 1000
	
	
	// 相册
	res = FindColor(540, 1520, 590, 1555, "3942FA", 0, 1.0, intX, intY)
	If res > -1 Then 
		TracePrint "无相册"
	Else
		Tap 100, 1330
		Delay 500
		res = FindColor(790, 1070, 910, 1140, "2CD3FF", 0, 1.0, intX, intY)
		If res > -1 Then 
			TracePrint "无相册"
		End If
		While intX = -1 And intY = -1
			Tap 100, 1330
			Delay 500
            If FindColor(540, 1520, 590, 1555, "3942FA", 0, 1.0, intX, intY) > -1 Then 
				Goto skip
			End If
			FindColor 790, 1070, 910, 1140, "2CD3FF", 0, 1.0, intX, intY
		Wend
		Tap 300, 1120
		Delay 500
	End If
	
Rem skip
	// 满福红包
	res = FindColor(800, 825, 860, 875, "F2D075|F2CE75", 0, 1.0, intX, intY)
	If res > -1 Then 
		TracePrint "无满福红包"
	End If
	While res<0
		TracePrint "满福红包 "
		Tap 865, 630
		Delay 1000
		res = FindColor(695, 1485, 715, 1540, "FFFFFF", 0, 1.0, intX, intY)
		While res>-1
			TracePrint "tap "&res
			Tap 545, 1040
			Delay 1000
			res = FindColor(695, 1485, 715, 1540, "FFFFFF", 0, 1.0, intX, intY)
		Wend
		res = FindColor(800, 825, 860, 875, "F2D075|F2CE75", 0, 1.0, intX, intY)
	Wend
	Delay 100
	
	// 多福红包
	res = FindColor(460, 825, 525, 875, "F2D075|F2CE75", 0, 1.0, intX, intY)
	If res > -1 Then 
		TracePrint "无多福红包"
	End If
	While res<0
		TracePrint "多福红包 "
		Tap 530, 630
		Delay 1000
		res = FindColor(695, 1485, 715, 1540, "FFFFFF", 0, 1.0, intX, intY)
		While res>-1
			TracePrint "tap "&res
			Tap 545, 1040
			Delay 1000
			res = FindColor(695, 1485, 715, 1540, "FFFFFF", 0, 1.0, intX, intY)
		Wend
		res = FindColor(460, 825, 525, 875, "F2D075|F2CE75", 0, 1.0, intX, intY)
	Wend
	Delay 100
	
	// 福气红包
	res = FindColor(140, 825, 200, 875, "F2D075|F2CE75", 0, 1.0, intX, intY)
	If res > -1 Then 
		TracePrint "无福气红包"
	End If
	While res<0
		TracePrint "福气红包 "
		Tap 200, 630
		Delay 1000
		res = FindColor(695, 1485, 715, 1540, "FFFFFF", 0, 1.0, intX, intY)
		While res>-1
			TracePrint "tap"
			Tap 545, 1040
			Delay 1000
			res = FindColor(695, 1485, 715, 1540, "FFFFFF", 0, 1.0, intX, intY)
		Wend
		res = FindColor(120, 825, 165, 875, "F2D075|F2CE75", 0, 1.0, intX, intY)
	Wend
	Delay 100
	
End Sub



Call HB()
Call Auto()

效果图

收获物

收金币

GitHub:https://github.com/1061700625/FamilyDream_Script