出站挖矿 回站放矿 残血逃命
直接上代码。认真阅读前几行注释。而且建议绿色游戏,我写了这个代码,毁了我对这个游戏的热情。大家娱乐敲代码就好了。最后给大家一个演示视频。
演示视频,b站BV1pK4y1x73X)
#注意因为采用的是模拟点击 所以分辨率会有影响,以下是1920*1080
#当然这也是需要改界面的,图在最后,或者看我视频。或者宁可以设置一下参数
#第二采用了百度文字识别的api,我实在是没找到一个好的本地的识别
#以下没有的库 采用pip install
import pyautogui
import random
import os
from PIL import Image
from PIL import ImageGrab
from aip import AipOcr #注意这个库的名字叫 baidu-aip
import time
APP_ID = '21544943'
API_KEY = 'QgVPZ6660pPluA5lMcAXSukp'
SECRET_KEY = 'kePKhRQukcLAChyIpMx3EsCuIjhn9oO1'
client = AipOcr(APP_ID, API_KEY, SECRET_KEY)
def Textget(x1,y1,x2,y2): #基本文字识别 文字识别死了 百度腾讯nmsl
img = ImageGrab.grab(bbox=(x1,y1,x2,y2))
img.save('temp.jpg')
img = open('temp.jpg','rb')
img = img.read()
text= client.basicAccurate(img)
if ('error_msg' in text.keys()):
print("今天的百度识别次数已经用完了,不能挂机了,30秒后关机")
Getplane()
os.system('shutdown -s -t 30')
time.sleep(30)
return text
kwlist = ['斜长岩','蓝色斜长岩','富有斜长岩']
kwlist2 = ['流体干焦岩','固体干焦岩','干焦岩']
kwlist3 = ['富凡晶石','凡晶石']
def Gotohomeplace(name):#回某个空间站
pyautogui.moveTo(x=1450, y=200, duration=1, tween=pyautogui.easeInOutQuad)
time.sleep(1)
pyautogui.click()
time.sleep(1)
text=Textget(1536,235,1714,863)
j=0
for i in text['words_result']:
#print(i['words'],name)
if i['words'] == name:
break
else:
j=j+1
else:
print("未找到目标地")
return 0
pyautogui.moveTo(x=1704, y=243+19*j, duration=1, tween=pyautogui.easeInOutQuad)
pyautogui.rightClick()
pyautogui.moveRel(xOffset=28, yOffset=71, duration=0.0, tween=pyautogui.linear)
time.sleep(2)
pyautogui.click()
time.sleep(60)
return 1
def Gotoplace(name):#回某个空间站
pyautogui.moveTo(x=1450, y=200, duration=1, tween=pyautogui.easeInOutQuad)
time.sleep(1)
pyautogui.click