Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
2,854
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.29 KB | None | 0 0
  1. 家国梦:100: 自动化脚本
  2.  
  3. 所需工具: Windows10、按键精灵手机助手、雷电模拟器
  4.  
  5. 使用步骤:
  6. 1. 雷电模拟器设置分辨率为 手机版 1080*1920, 安装家国梦, 并登录;
  7. 2. PC上安装按键精灵手机助手, 连接雷电模拟器, 新建脚本, 把下边的脚本内容填进去, 点击调试;
  8. 3. enjoy
  9.  
  10. 注: 不需要自动升级建筑, 自动打开红包的, 把对应的代码用 // 注释符号 注释掉就行了
  11.  
  12. ```
  13. Sub Auto()
  14. Tap 90, 1820
  15. Delay 500
  16.  
  17. Dim HOUSE_X = Array(300,545,800,290,560,800,290,560,780)
  18. Dim HOUSE_Y = Array(1200,1080,950,960,820,725,720,580,450)
  19. Dim HOUSE_INDEX = 1
  20.  
  21. Dim X(3), Y(3)
  22. X(1) = 660
  23. X(2) = 825
  24. X(3) = 975
  25. Y(1) = 1635
  26. Y(2) = 1555
  27. Y(3) = 1470
  28.  
  29. Dim INDEX, UPCNT
  30. UPCNT = 0
  31. While True
  32.  
  33. For INDEX = 1 To 3
  34. //TracePrint INDEX
  35. TouchDown X(INDEX), Y(INDEX)
  36. Delay 500
  37. Dim IntX,IntY
  38. FindColor 0,0,0,0,"80FFFF|81FFFF|80FF00",0,1.0,intX,intY
  39. If intX >-1 then
  40. Traceprint "找到货物"
  41. TouchMove intX + 50, intY
  42. Delay 200
  43. Else
  44. Traceprint "没有货物"
  45. End If
  46. TouchUp
  47. Next
  48.  
  49. Delay 500
  50. TouchDown 200, 1280
  51. TouchMove 1000, 825
  52. TouchMove 820, 700
  53. TouchMove 170, 1045
  54. TouchMove 210, 760
  55. TouchMove 900, 400
  56. TouchUp
  57.  
  58. Delay 500
  59.  
  60. UPCNT = UPCNT + 1
  61. If UPCNT >= 10 Then
  62. UPCNT = 0
  63. Call Up(HOUSE_X(HOUSE_INDEX), HOUSE_Y(HOUSE_INDEX)) //升级指定房屋
  64. HOUSE_INDEX = HOUSE_INDEX + 1
  65. If HOUSE_INDEX > 9 Then
  66. HOUSE_INDEX = 1
  67. End If
  68. Delay 1000
  69. End If
  70. Wend
  71. End Sub
  72.  
  73.  
  74. Sub Up(X, Y)
  75. Tap 970, 1145 //进入升级
  76. Delay 1000
  77.  
  78. while CmpColor(1050, 1160, "4DDDFF", 1.0) < 0
  79. Traceprint "等待进入升级页面"
  80. Delay 500
  81. Wend
  82. Tap X, Y //点击建筑
  83. Delay 1000
  84.  
  85. Dim intX, intY, res
  86. res = FindColor(900,1670, 990, 1700, "FFFFFF", 0, 1.0, intX, intY)
  87. //如果没有找到,intX和intY的值都会被置为-1
  88. While res > -1
  89. Tap 870, 1750
  90. Traceprint "升级一次"
  91. Delay 100
  92. res = FindColor(900,1670, 990, 1700, "FFFFFF", 0, 1.0, intX, intY)
  93. Wend
  94.  
  95. Traceprint "金币不足"
  96. Tap 970, 1145 //退出升级
  97. Delay 1000
  98. End Sub
  99.  
  100.  
  101. Sub HB()
  102. Dim intX, intY, res
  103. Tap 525, 1810
  104. Delay 1000
  105.  
  106.  
  107. // 相册
  108. res = FindColor(540, 1520, 590, 1555, "3942FA", 0, 1.0, intX, intY)
  109. If res > -1 Then
  110. TracePrint "无相册"
  111. Else
  112. Tap 100, 1330
  113. Delay 500
  114. res = FindColor(790, 1070, 910, 1140, "2CD3FF", 0, 1.0, intX, intY)
  115. If res > -1 Then
  116. TracePrint "无相册"
  117. End If
  118. While intX = -1 And intY = -1
  119. Tap 100, 1330
  120. Delay 500
  121. If FindColor(540, 1520, 590, 1555, "3942FA", 0, 1.0, intX, intY) > -1 Then
  122. Goto skip
  123. End If
  124. FindColor 790, 1070, 910, 1140, "2CD3FF", 0, 1.0, intX, intY
  125. Wend
  126. Tap 300, 1120
  127. Delay 500
  128. End If
  129.  
  130. Rem skip
  131. // 满福红包
  132. res = FindColor(800, 825, 860, 875, "F2D075|F2CE75", 0, 1.0, intX, intY)
  133. If res > -1 Then
  134. TracePrint "无满福红包"
  135. End If
  136. While res<0
  137. TracePrint "满福红包 "
  138. Tap 865, 630
  139. Delay 1000
  140. res = FindColor(695, 1485, 715, 1540, "FFFFFF", 0, 1.0, intX, intY)
  141. While res>-1
  142. TracePrint "tap "&res
  143. Tap 545, 1040
  144. Delay 1000
  145. res = FindColor(695, 1485, 715, 1540, "FFFFFF", 0, 1.0, intX, intY)
  146. Wend
  147. res = FindColor(800, 825, 860, 875, "F2D075|F2CE75", 0, 1.0, intX, intY)
  148. Wend
  149. Delay 100
  150.  
  151. // 多福红包
  152. res = FindColor(460, 825, 525, 875, "F2D075|F2CE75", 0, 1.0, intX, intY)
  153. If res > -1 Then
  154. TracePrint "无多福红包"
  155. End If
  156. While res<0
  157. TracePrint "多福红包 "
  158. Tap 530, 630
  159. Delay 1000
  160. res = FindColor(695, 1485, 715, 1540, "FFFFFF", 0, 1.0, intX, intY)
  161. While res>-1
  162. TracePrint "tap "&res
  163. Tap 545, 1040
  164. Delay 1000
  165. res = FindColor(695, 1485, 715, 1540, "FFFFFF", 0, 1.0, intX, intY)
  166. Wend
  167. res = FindColor(460, 825, 525, 875, "F2D075|F2CE75", 0, 1.0, intX, intY)
  168. Wend
  169. Delay 100
  170.  
  171. // 福气红包
  172. res = FindColor(140, 825, 200, 875, "F2D075|F2CE75", 0, 1.0, intX, intY)
  173. If res > -1 Then
  174. TracePrint "无福气红包"
  175. End If
  176. While res<0
  177. TracePrint "福气红包 "
  178. Tap 200, 630
  179. Delay 1000
  180. res = FindColor(695, 1485, 715, 1540, "FFFFFF", 0, 1.0, intX, intY)
  181. While res>-1
  182. TracePrint "tap"
  183. Tap 545, 1040
  184. Delay 1000
  185. res = FindColor(695, 1485, 715, 1540, "FFFFFF", 0, 1.0, intX, intY)
  186. Wend
  187. res = FindColor(120, 825, 165, 875, "F2D075|F2CE75", 0, 1.0, intX, intY)
  188. Wend
  189. Delay 100
  190.  
  191. End Sub
  192.  
  193.  
  194. Call HB()
  195. Call Auto()
  196. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement