Yuma Sports Crack: Fully Automatic Run

·

·

·

·

·

·

·

·

·

·

·

·

·

·

·

·

Foreword:

I became more and more lazy after Crack was completed, thinking about whether it can be fully automatic, but I only need to input the coordinates of the three flags, and after Run Finished, the distance is not enough to ask if I need to input another latitude and longitude to run for a while.

um~ just lazy

·

·

·

·

·

·

·

·

·

·

·

·

·

·

·

·

·

·

·

·

·

·

·

·

Ideas:

Use the json data returned by the API provided by Baidu map route planning, and get the latitude and longitude coordinates after parsing. By calculating the five parameters of the App's Run time, you can determine the Sleep for each modification of the location. As for the modification of the location, use the commands provided by Xiaoyao.

from requests import get
from os import system
from time import sleep
# 对百度地图提供的API发起请求,参数: Ak , 起点经纬度 , 终点经纬度
def Request(Start_Point, End_Point):
    RespOne = get(f'https://api.map.baidu.com/directionlite/v1/walking?origin={Start_Point}&destination={End_Point}&ak=SVTGvOGqoo7YgD7KOgsSfTVLIFGD6sc6')
    return RespOne.json(), RespOne.status_code   # 返回响应的json文件

#   对请求百度地图API步行路线规划返回的数据进行粗加工
def data_handle_rough_machining(RespOne_json):
    Request_status = list(RespOne_json.values())[0]     # 数据加工得到请求状态码,用于后续判断程序是否进行
    Request_result_duration_total = list(list(list(RespOne_json.values())[2].values())[2][0].values())[1]   # 数据加工得到路线规划总时间
    Request_result_distances_total = list(list(list(RespOne_json.values())[2].values())[2][0].values())[0]  # 数据加工得到路线规划总距离

    Request_result_routes_steps = list(list(list(RespOne_json.values())[2].values())[2][0].values())[2]  # 数据加工得到每段路线规划的数据

    return Request_status, Request_result_distances_total, Request_result_duration_total, Request_result_routes_steps   # 返回含有粗加工后数据的元组

# 对粗加工函数返回的每段路线规划的数据进行细加工
def data_handle_Fine_machining(Request_result_routes_steps):
    Step_Path = []
    for item in Request_result_routes_steps:    # 遍历含有每段路线规划数据(以字典在列表中每一项存在)的列表
        item = list(item.values())[4].split(';')    # 以';'为分割得到含有步行的每个经纬度
        Step_Path.append(item)  # 将每段步行路线添加到列表中 , 以后续遍历使用
    return Step_Path
def execute_command(Step_Path):
    for Outer in Step_Path:
        for Lnner in Outer:
            Lnner = Lnner.split(',')
            system(f'memuc setgps -i 2 {Lnner[1]} {Lnner[0]}')
            sleep(5)
def request_of_flags(flage_):
    global Start_Point, FlagOne_Point, FlagTwo_Point, FlagThree_Point
    Start_Point = ''
    FlagOne_Point = ''
    FlagTwo_Point = ''
    FlagThree_Point = ''
    if flage_ == 1:
        Start_Point = input('起点经纬度(小数点不超过六位)(如:40.01116,116.339303):>')
        FlagOne_point = input('第一旗经纬度(格式同上):>')
        Response_json_and_statucode = Request(Start_Point, FlagOne_point)
        return Response_json_and_statucode
    elif flage_ == 2:
        FlagTwo_Point = input('第二旗经纬度(格式同上):>')
        Response_json_and_statucode = Request(FlagOne_Point, FlagTwo_Point)
        return Response_json_and_statucode
    elif flage_ == 3:
        FlagThree_Point = input('第三旗经纬度(格式同上):>')
        Response_json_and_statucode = Request(FlagTwo_Point, FlagThree_Point)
        return Response_json_and_statucode

if __name__ == "__main__":
    for flage in range(1, 4):
        Response_json_and_statucode = request_of_flags(flage)
        if Response_json_and_statucode[1] == 200:
            Rough_Machined_Product_tuple = data_handle_rough_machining(Response_json_and_statucode[0])
            if Rough_Machined_Product_tuple[0] == 0:
                Fine_Machined_Product = data_handle_Fine_machining(Rough_Machined_Product_tuple[3])
                execute_command(Fine_Machined_Product)
            else:
                print('状态码异常')
                break
        else:
            print('百度地图API请求状态码异常')
            break

Please forgive me for the poor code (because it is for personal use, so some big bugs are ignored), as long as it can be used

Code 2022.3.25 record

Guess you like

Origin blog.csdn.net/superwang04/article/details/123762558